From 23624679fe088f226d1d790154f4bae15e0937b5 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Fri, 28 Jan 2022 10:10:56 +0800 Subject: [PATCH] feat: add title prop for progress, close #4929 --- .../__tests__/__snapshots__/demo.test.js.snap | 44 +++++++++---------- .../__snapshots__/index.test.js.snap | 26 +++++------ components/progress/progress.tsx | 19 ++++++-- components/progress/props.ts | 1 + 4 files changed, 51 insertions(+), 39 deletions(-) diff --git a/components/progress/__tests__/__snapshots__/demo.test.js.snap b/components/progress/__tests__/__snapshots__/demo.test.js.snap index 8ac901cc7..7414d0493 100644 --- a/components/progress/__tests__/__snapshots__/demo.test.js.snap +++ b/components/progress/__tests__/__snapshots__/demo.test.js.snap @@ -13,7 +13,7 @@ exports[`renders ./components/progress/demo/circle.vue correctly 1`] = ` - 75% + 75%
@@ -59,7 +59,7 @@ exports[`renders ./components/progress/demo/circle-dynamic.vue correctly 1`] = ` - 0%
+ 0%
@@ -78,7 +78,7 @@ exports[`renders ./components/progress/demo/circle-mini.vue correctly 1`] = ` - 30% + 30%
@@ -124,7 +124,7 @@ exports[`renders ./components/progress/demo/dashboard.vue correctly 1`] = ` - 75%
+ 75%
`; @@ -137,7 +137,7 @@ exports[`renders ./components/progress/demo/dynamic.vue correctly 1`] = `
- 0% + 0%
@@ -157,7 +157,7 @@ exports[`renders ./components/progress/demo/format.vue correctly 1`] = ` - 75 Days + 75 Days
@@ -171,7 +171,7 @@ exports[`renders ./components/progress/demo/format.vue correctly 1`] = ` - Done
+ Done
@@ -198,7 +198,7 @@ exports[`renders ./components/progress/demo/gradient-line.vue correctly 1`] = `
-
99.9% + 99.9%
@@ -206,7 +206,7 @@ exports[`renders ./components/progress/demo/gradient-line.vue correctly 1`] = `
-
99.9% + 99.9%
@@ -225,7 +225,7 @@ exports[`renders ./components/progress/demo/gradient-line.vue correctly 1`] = ` - 90%
+ 90%
@@ -256,7 +256,7 @@ exports[`renders ./components/progress/demo/line.vue correctly 1`] = `
-
30% + 30%
@@ -264,7 +264,7 @@ exports[`renders ./components/progress/demo/line.vue correctly 1`] = `
-
50% + 50%
@@ -301,7 +301,7 @@ exports[`renders ./components/progress/demo/line-mini.vue correctly 1`] = `
-
30% + 30%
@@ -309,7 +309,7 @@ exports[`renders ./components/progress/demo/line-mini.vue correctly 1`] = `
-
50% + 50%
@@ -338,7 +338,7 @@ exports[`renders ./components/progress/demo/linecap.vue correctly 1`] = `
-
75% + 75%
@@ -352,7 +352,7 @@ exports[`renders ./components/progress/demo/linecap.vue correctly 1`] = ` - 75%
+ 75%
@@ -366,7 +366,7 @@ exports[`renders ./components/progress/demo/linecap.vue correctly 1`] = ` - 75%
+ 75%
`; @@ -380,7 +380,7 @@ exports[`renders ./components/progress/demo/segment.vue correctly 1`] = `
- 60% + 60%
@@ -395,7 +395,7 @@ exports[`renders ./components/progress/demo/segment.vue correctly 1`] = ` - 60%
+ 60%
@@ -410,7 +410,7 @@ exports[`renders ./components/progress/demo/segment.vue correctly 1`] = ` - 60%
+ 60% `; @@ -420,7 +420,7 @@ exports[`renders ./components/progress/demo/steps.vue correctly 1`] = `
-
50% +
50%

@@ -430,7 +430,7 @@ exports[`renders ./components/progress/demo/steps.vue correctly 1`] = `
-
30% +
30%
diff --git a/components/progress/__tests__/__snapshots__/index.test.js.snap b/components/progress/__tests__/__snapshots__/index.test.js.snap index 5aeac6b59..0f52246db 100644 --- a/components/progress/__tests__/__snapshots__/index.test.js.snap +++ b/components/progress/__tests__/__snapshots__/index.test.js.snap @@ -13,7 +13,7 @@ exports[`Progress render dashboard 295 gapDegree 1`] = ` - 0% + 0% `; @@ -30,7 +30,7 @@ exports[`Progress render dashboard 296 gapDegree 1`] = ` - 0% + 0% `; @@ -47,7 +47,7 @@ exports[`Progress render dashboard zero gapDegree 1`] = ` - 0% + 0% `; @@ -58,7 +58,7 @@ exports[`Progress render format 1`] = `
- 50 10 + 50 10 `; @@ -69,7 +69,7 @@ exports[`Progress render negative progress 1`] = `
- 0% + 0% `; @@ -80,7 +80,7 @@ exports[`Progress render negative successPercent 1`] = `
- 50% + 50% `; @@ -91,7 +91,7 @@ exports[`Progress render normal progress 1`] = `
- 0% + 0% `; @@ -130,7 +130,7 @@ exports[`Progress render strokeColor 1`] = ` - 50% + 50% `; @@ -141,7 +141,7 @@ exports[`Progress render strokeColor 2`] = `
- 50% + 50% `; @@ -152,7 +152,7 @@ exports[`Progress render strokeColor 3`] = `
- 50% + 50% `; @@ -163,7 +163,7 @@ exports[`Progress render successColor progress 1`] = `
- 60% + 60% `; @@ -174,7 +174,7 @@ exports[`Progress render trailColor progress 1`] = `
- 0% + 0% `; @@ -183,7 +183,7 @@ exports[`Progress should support steps 1`] = `
-
0% +
0%
`; diff --git a/components/progress/progress.tsx b/components/progress/progress.tsx index 6b4cdf303..e14215768 100644 --- a/components/progress/progress.tsx +++ b/components/progress/progress.tsx @@ -63,7 +63,7 @@ export default defineComponent({ }); const renderProcessInfo = () => { - const { showInfo, format, type, percent } = props; + const { showInfo, format, type, percent, title } = props; const successPercent = getSuccessPercent(props); if (!showInfo) return null; @@ -81,11 +81,18 @@ export default defineComponent({ } else if (progressStatus.value === 'success') { text = isLineType ? : ; } - return {text}; + return ( + + {text} + + ); }; return () => { - const { type, steps, strokeColor } = props; + const { type, steps, strokeColor, title } = props; const progressInfo = renderProcessInfo(); let progress: VueNode; @@ -118,7 +125,11 @@ export default defineComponent({ [`${prefixCls.value}-status-${progressStatus.value}`]: true, }; - return
{progress}
; + return ( +
+ {progress} +
+ ); }; }, }); diff --git a/components/progress/props.ts b/components/progress/props.ts index 371ea5079..27a4b096c 100644 --- a/components/progress/props.ts +++ b/components/progress/props.ts @@ -42,6 +42,7 @@ export const progressProps = () => ({ steps: PropTypes.number, /** @deprecated Use `success` instead */ successPercent: PropTypes.number, + title: String, }); export type ProgressProps = Partial>>;