1 line
7.8 KiB
JSON
1 line
7.8 KiB
JSON
{"ast":null,"code":"\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Circle as RCCircle } from 'rc-progress';\nimport Tooltip from '../tooltip';\nimport { getPercentage, getSize, getStrokeColor } from './utils';\nconst CIRCLE_MIN_STROKE_WIDTH = 3;\nconst getMinPercent = width => CIRCLE_MIN_STROKE_WIDTH / width * 100;\nconst Circle = props => {\n const {\n prefixCls,\n trailColor = null,\n strokeLinecap = 'round',\n gapPosition,\n gapDegree,\n width: originWidth = 120,\n type,\n children,\n success,\n size = originWidth,\n steps\n } = props;\n const [width, height] = getSize(size, 'circle');\n let {\n strokeWidth\n } = props;\n if (strokeWidth === undefined) {\n strokeWidth = Math.max(getMinPercent(width), 6);\n }\n const circleStyle = {\n width,\n height,\n fontSize: width * 0.15 + 6\n };\n const realGapDegree = React.useMemo(() => {\n // Support gapDeg = 0 when type = 'dashboard'\n if (gapDegree || gapDegree === 0) {\n return gapDegree;\n }\n if (type === 'dashboard') {\n return 75;\n }\n return undefined;\n }, [gapDegree, type]);\n const percentArray = getPercentage(props);\n const gapPos = gapPosition || type === 'dashboard' && 'bottom' || undefined;\n // using className to style stroke color\n const isGradient = Object.prototype.toString.call(props.strokeColor) === '[object Object]';\n const strokeColor = getStrokeColor({\n success,\n strokeColor: props.strokeColor\n });\n const wrapperClassName = classNames(`${prefixCls}-inner`, {\n [`${prefixCls}-circle-gradient`]: isGradient\n });\n const circleContent = /*#__PURE__*/React.createElement(RCCircle, {\n steps: steps,\n percent: steps ? percentArray[1] : percentArray,\n strokeWidth: strokeWidth,\n trailWidth: strokeWidth,\n strokeColor: steps ? strokeColor[1] : strokeColor,\n strokeLinecap: strokeLinecap,\n trailColor: trailColor,\n prefixCls: prefixCls,\n gapDegree: realGapDegree,\n gapPosition: gapPos\n });\n const smallCircle = width <= 20;\n const node = /*#__PURE__*/React.createElement(\"div\", {\n className: wrapperClassName,\n style: circleStyle\n }, circleContent, !smallCircle && children);\n if (smallCircle) {\n return /*#__PURE__*/React.createElement(Tooltip, {\n title: children\n }, node);\n }\n return node;\n};\nexport default Circle;","map":{"version":3,"names":["React","classNames","Circle","RCCircle","Tooltip","getPercentage","getSize","getStrokeColor","CIRCLE_MIN_STROKE_WIDTH","getMinPercent","width","props","prefixCls","trailColor","strokeLinecap","gapPosition","gapDegree","originWidth","type","children","success","size","steps","height","strokeWidth","undefined","Math","max","circleStyle","fontSize","realGapDegree","useMemo","percentArray","gapPos","isGradient","Object","prototype","toString","call","strokeColor","wrapperClassName","circleContent","createElement","percent","trailWidth","smallCircle","node","className","style","title"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/progress/Circle.js"],"sourcesContent":["\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Circle as RCCircle } from 'rc-progress';\nimport Tooltip from '../tooltip';\nimport { getPercentage, getSize, getStrokeColor } from './utils';\nconst CIRCLE_MIN_STROKE_WIDTH = 3;\nconst getMinPercent = width => CIRCLE_MIN_STROKE_WIDTH / width * 100;\nconst Circle = props => {\n const {\n prefixCls,\n trailColor = null,\n strokeLinecap = 'round',\n gapPosition,\n gapDegree,\n width: originWidth = 120,\n type,\n children,\n success,\n size = originWidth,\n steps\n } = props;\n const [width, height] = getSize(size, 'circle');\n let {\n strokeWidth\n } = props;\n if (strokeWidth === undefined) {\n strokeWidth = Math.max(getMinPercent(width), 6);\n }\n const circleStyle = {\n width,\n height,\n fontSize: width * 0.15 + 6\n };\n const realGapDegree = React.useMemo(() => {\n // Support gapDeg = 0 when type = 'dashboard'\n if (gapDegree || gapDegree === 0) {\n return gapDegree;\n }\n if (type === 'dashboard') {\n return 75;\n }\n return undefined;\n }, [gapDegree, type]);\n const percentArray = getPercentage(props);\n const gapPos = gapPosition || type === 'dashboard' && 'bottom' || undefined;\n // using className to style stroke color\n const isGradient = Object.prototype.toString.call(props.strokeColor) === '[object Object]';\n const strokeColor = getStrokeColor({\n success,\n strokeColor: props.strokeColor\n });\n const wrapperClassName = classNames(`${prefixCls}-inner`, {\n [`${prefixCls}-circle-gradient`]: isGradient\n });\n const circleContent = /*#__PURE__*/React.createElement(RCCircle, {\n steps: steps,\n percent: steps ? percentArray[1] : percentArray,\n strokeWidth: strokeWidth,\n trailWidth: strokeWidth,\n strokeColor: steps ? strokeColor[1] : strokeColor,\n strokeLinecap: strokeLinecap,\n trailColor: trailColor,\n prefixCls: prefixCls,\n gapDegree: realGapDegree,\n gapPosition: gapPos\n });\n const smallCircle = width <= 20;\n const node = /*#__PURE__*/React.createElement(\"div\", {\n className: wrapperClassName,\n style: circleStyle\n }, circleContent, !smallCircle && children);\n if (smallCircle) {\n return /*#__PURE__*/React.createElement(Tooltip, {\n title: children\n }, node);\n }\n return node;\n};\nexport default Circle;"],"mappings":"AAAA,YAAY;;AAEZ,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,MAAM,IAAIC,QAAQ,QAAQ,aAAa;AAChD,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,aAAa,EAAEC,OAAO,EAAEC,cAAc,QAAQ,SAAS;AAChE,MAAMC,uBAAuB,GAAG,CAAC;AACjC,MAAMC,aAAa,GAAGC,KAAK,IAAIF,uBAAuB,GAAGE,KAAK,GAAG,GAAG;AACpE,MAAMR,MAAM,GAAGS,KAAK,IAAI;EACtB,MAAM;IACJC,SAAS;IACTC,UAAU,GAAG,IAAI;IACjBC,aAAa,GAAG,OAAO;IACvBC,WAAW;IACXC,SAAS;IACTN,KAAK,EAAEO,WAAW,GAAG,GAAG;IACxBC,IAAI;IACJC,QAAQ;IACRC,OAAO;IACPC,IAAI,GAAGJ,WAAW;IAClBK;EACF,CAAC,GAAGX,KAAK;EACT,MAAM,CAACD,KAAK,EAAEa,MAAM,CAAC,GAAGjB,OAAO,CAACe,IAAI,EAAE,QAAQ,CAAC;EAC/C,IAAI;IACFG;EACF,CAAC,GAAGb,KAAK;EACT,IA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