diff --git a/docs/en-US/component/progress.md b/docs/en-US/component/progress.md index 701a30890f..d0a0ddaef5 100644 --- a/docs/en-US/component/progress.md +++ b/docs/en-US/component/progress.md @@ -77,26 +77,28 @@ progress/striped-progress ::: -## Attributes +## API -| Name | Description | Type | Accepted Values | Default | -| -------------- | ------------------------------------------------------------------------------------- | --------------------- | ------------------------- | ------- | -| percentage | percentage, **required** | number | (0-100) | 0 | -| type | the type of progress bar | string | line/circle/dashboard | line | -| stroke-width | the width of progress bar | number | — | 6 | -| text-inside | whether to place the percentage inside progress bar, only works when `type` is 'line' | boolean | — | false | -| status | the current status of progress bar | string | success/exception/warning | — | -| indeterminate | set indeterminate progress | boolean | - | false | -| duration | control the animation duration of indeterminate progress or striped flow progress | number | - | 3 | -| color | background color of progress bar. Overrides `status` prop | string/function/array | — | '' | -| width | the canvas width of circle progress bar | number | — | 126 | -| show-text | whether to show percentage | boolean | — | true | -| stroke-linecap | circle/dashboard type shape at the end path | string | butt/round/square | round | -| format | custom text format | function(percentage) | — | — | -| striped | stripe over the progress bar's color | boolean | — | false | -| striped-flow | get the stripes to flow | boolean | — | false | +### Attributes -## Slots +| Name | Description | Type | Default | +| -------------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ------- | +| percentage | percentage, **required** | ^[number]`(0-100)` | 0 | +| type | the type of progress bar | ^[enum]`'line' \| 'circle' \| 'dashboard'` | line | +| stroke-width | the width of progress bar | ^[number] | 6 | +| text-inside | whether to place the percentage inside progress bar, only works when `type` is 'line' | ^[boolean] | false | +| status | the current status of progress bar | ^[enum]`'success' \| 'exception' \| 'warning'` | — | +| indeterminate | set indeterminate progress | ^[boolean] | false | +| duration | control the animation duration of indeterminate progress or striped flow progress | ^[number] | 3 | +| color | background color of progress bar. Overrides `status` prop | ^[string] / ^[function]`(percentage: number) => string` / ^[Array]`{ color: string; percentage: number }[]` | '' | +| width | the canvas width of circle progress bar | ^[number] | 126 | +| show-text | whether to show percentage | ^[boolean] | true | +| stroke-linecap | circle/dashboard type shape at the end path | ^[enum]`'butt' \| 'round' \| 'square'` | round | +| format | custom text format | ^[Function]`(percentage: number) => string` | — | +| striped | stripe over the progress bar's color | ^[boolean] | false | +| striped-flow | get the stripes to flow | ^[boolean] | false | + +### Slots | Name | Description | | ------- | ------------------------------------------------- | diff --git a/packages/components/progress/src/progress.ts b/packages/components/progress/src/progress.ts index f737e89518..5fc1054e6d 100644 --- a/packages/components/progress/src/progress.ts +++ b/packages/components/progress/src/progress.ts @@ -6,49 +6,82 @@ export type ProgressColor = { color: string; percentage: number } export type ProgressFn = (percentage: number) => string export const progressProps = buildProps({ + /** + * @description type of progress bar + */ type: { type: String, default: 'line', values: ['line', 'circle', 'dashboard'], }, + /** + * @description percentage, required + */ percentage: { type: Number, default: 0, validator: (val: number): boolean => val >= 0 && val <= 100, }, + /** + * @description the current status of progress bar + */ status: { type: String, default: '', values: ['', 'success', 'exception', 'warning'], }, + /** + * @description set indeterminate progress + */ indeterminate: { type: Boolean, default: false, }, + /** + * @description control the animation duration of indeterminate progress or striped flow progress + */ duration: { type: Number, default: 3, }, + /** + * @description the width of progress bar + */ strokeWidth: { type: Number, default: 6, }, + /** + * @description butt/circle/dashboard type shape at the end path + */ strokeLinecap: { type: definePropType>(String), default: 'round', }, + /** + * @description whether to place the percentage inside progress bar, only works when `type` is 'line' + */ textInside: { type: Boolean, default: false, }, + /** + * @description the canvas width of circle progress bar + */ width: { type: Number, default: 126, }, + /** + * @description whether to show percentage + */ showText: { type: Boolean, default: true, }, + /** + * @description background color of progress bar. Overrides `status` prop + */ color: { type: definePropType([ String, @@ -57,8 +90,17 @@ export const progressProps = buildProps({ ]), default: '', }, + /** + * @description stripe over the progress bar's color + */ striped: Boolean, + /** + * @description get the stripes to flow + */ stripedFlow: Boolean, + /** + * @description custom text format + */ format: { type: definePropType(Function), default: (percentage: number): string => `${percentage}%`,