UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 5.83 kB
{"version":3,"file":"progress.mjs","sources":["../../../../../../packages/components/progress/src/progress.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes, SVGAttributes } from 'vue'\nimport type Progress from './progress.vue'\n\nexport type ProgressColor = { color: string; percentage: number }\nexport type ProgressFn = (percentage: number) => string\n\nexport interface ProgressProps {\n /**\n * @description type of progress bar\n */\n type?: 'line' | 'circle' | 'dashboard'\n /**\n * @description percentage, required\n */\n percentage?: number\n /**\n * @description the current status of progress bar\n */\n status?: '' | 'success' | 'exception' | 'warning'\n /**\n * @description set indeterminate progress\n */\n indeterminate?: boolean\n /**\n * @description control the animation duration of indeterminate progress or striped flow progress\n */\n duration?: number\n /**\n * @description the width of progress bar\n */\n strokeWidth?: number\n /**\n * @description butt/circle/dashboard type shape at the end path\n */\n strokeLinecap?: NonNullable<SVGAttributes['stroke-linecap']>\n /**\n * @description whether to place the percentage inside progress bar, only works when `type` is 'line'\n */\n textInside?: boolean\n /**\n * @description the canvas width of circle progress bar\n */\n width?: number\n /**\n * @description whether to show percentage\n */\n showText?: boolean\n /**\n * @description background color of progress bar. Overrides `status` prop\n */\n color?: string | ProgressColor[] | ProgressFn\n /**\n * @description stripe over the progress bar's color\n */\n striped?: boolean\n /**\n * @description get the stripes to flow\n */\n stripedFlow?: boolean\n /**\n * @description custom text format\n */\n format?: ProgressFn\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ProgressProps` instead.\n */\nexport const progressProps = buildProps({\n /**\n * @description type of progress bar\n */\n type: {\n type: String,\n default: 'line',\n values: ['line', 'circle', 'dashboard'],\n },\n /**\n * @description percentage, required\n */\n percentage: {\n type: Number,\n default: 0,\n validator: (val: number): boolean => val >= 0 && val <= 100,\n },\n /**\n * @description the current status of progress bar\n */\n status: {\n type: String,\n default: '',\n values: ['', 'success', 'exception', 'warning'],\n },\n /**\n * @description set indeterminate progress\n */\n indeterminate: Boolean,\n /**\n * @description control the animation duration of indeterminate progress or striped flow progress\n */\n duration: {\n type: Number,\n default: 3,\n },\n /**\n * @description the width of progress bar\n */\n strokeWidth: {\n type: Number,\n default: 6,\n },\n /**\n * @description butt/circle/dashboard type shape at the end path\n */\n strokeLinecap: {\n type: definePropType<NonNullable<SVGAttributes['stroke-linecap']>>(String),\n default: 'round',\n },\n /**\n * @description whether to place the percentage inside progress bar, only works when `type` is 'line'\n */\n textInside: Boolean,\n /**\n * @description the canvas width of circle progress bar\n */\n width: {\n type: Number,\n default: 126,\n },\n /**\n * @description whether to show percentage\n */\n showText: {\n type: Boolean,\n default: true,\n },\n /**\n * @description background color of progress bar. Overrides `status` prop\n */\n color: {\n type: definePropType<string | ProgressColor[] | ProgressFn>([\n String,\n Array,\n Function,\n ]),\n default: '',\n },\n /**\n * @description stripe over the progress bar's color\n */\n striped: Boolean,\n /**\n * @description get the stripes to flow\n */\n stripedFlow: Boolean,\n /**\n * @description custom text format\n */\n format: {\n type: definePropType<ProgressFn>(Function),\n default: (percentage: number): string => `${percentage}%`,\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `ProgressProps` instead.\n */\nexport type ProgressPropsPublic = ExtractPublicPropTypes<typeof progressProps>\nexport type ProgressInstance = InstanceType<typeof Progress> & unknown\n"],"names":[],"mappings":";;AAsEO,MAAM,gBAAgB,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAItC,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS,MAAA;AAAA,IACT,MAAA,EAAQ,CAAC,MAAA,EAAQ,QAAA,EAAU,WAAW;AAAA,GACxC;AAAA;AAAA;AAAA;AAAA,EAIA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS,CAAA;AAAA,IACT,SAAA,EAAW,CAAC,GAAA,KAAyB,GAAA,IAAO,KAAK,GAAA,IAAO;AAAA,GAC1D;AAAA;AA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