1 line
25 KiB
JSON
1 line
25 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport CheckCircleFilled from \"@ant-design/icons/es/icons/CheckCircleFilled\";\nimport CheckOutlined from \"@ant-design/icons/es/icons/CheckOutlined\";\nimport CloseCircleFilled from \"@ant-design/icons/es/icons/CloseCircleFilled\";\nimport CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport { TinyColor } from '@ctrl/tinycolor';\nimport classNames from 'classnames';\nimport omit from \"rc-util/es/omit\";\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport Circle from './Circle';\nimport Line from './Line';\nimport Steps from './Steps';\nimport useStyle from './style';\nimport { getSize, getSuccessPercent, validProgress } from './utils';\nexport const ProgressTypes = ['line', 'circle', 'dashboard'];\nconst ProgressStatuses = ['normal', 'exception', 'active', 'success'];\nconst Progress = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n steps,\n strokeColor,\n percent = 0,\n size = 'default',\n showInfo = true,\n type = 'line',\n status,\n format,\n style,\n percentPosition = {}\n } = props,\n restProps = __rest(props, [\"prefixCls\", \"className\", \"rootClassName\", \"steps\", \"strokeColor\", \"percent\", \"size\", \"showInfo\", \"type\", \"status\", \"format\", \"style\", \"percentPosition\"]);\n const {\n align: infoAlign = 'end',\n type: infoPosition = 'outer'\n } = percentPosition;\n const strokeColorNotArray = Array.isArray(strokeColor) ? strokeColor[0] : strokeColor;\n const strokeColorNotGradient = typeof strokeColor === 'string' || Array.isArray(strokeColor) ? strokeColor : undefined;\n const strokeColorIsBright = React.useMemo(() => {\n if (strokeColorNotArray) {\n const color = typeof strokeColorNotArray === 'string' ? strokeColorNotArray : Object.values(strokeColorNotArray)[0];\n return new TinyColor(color).isLight();\n }\n return false;\n }, [strokeColor]);\n const percentNumber = React.useMemo(() => {\n var _a, _b;\n const successPercent = getSuccessPercent(props);\n return parseInt(successPercent !== undefined ? (_a = successPercent !== null && successPercent !== void 0 ? successPercent : 0) === null || _a === void 0 ? void 0 : _a.toString() : (_b = percent !== null && percent !== void 0 ? percent : 0) === null || _b === void 0 ? void 0 : _b.toString(), 10);\n }, [percent, props.success, props.successPercent]);\n const progressStatus = React.useMemo(() => {\n if (!ProgressStatuses.includes(status) && percentNumber >= 100) {\n return 'success';\n }\n return status || 'normal';\n }, [status, percentNumber]);\n const {\n getPrefixCls,\n direction,\n progress: progressStyle\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('progress', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const isLineType = type === 'line';\n const isPureLineType = isLineType && !steps;\n const progressInfo = React.useMemo(() => {\n if (!showInfo) {\n return null;\n }\n const successPercent = getSuccessPercent(props);\n let text;\n const textFormatter = format || (number => `${number}%`);\n const isBrightInnerColor = isLineType && strokeColorIsBright && infoPosition === 'inner';\n if (infoPosition === 'inner' || format || progressStatus !== 'exception' && progressStatus !== 'success') {\n text = textFormatter(validProgress(percent), validPr
|