1 line
11 KiB
JSON
1 line
11 KiB
JSON
{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nimport { useMemo } from 'react';\nimport classNames from 'classnames';\nimport CSSMotion, { CSSMotionList } from 'rc-motion';\nimport initCollapseMotion from '../_util/motion';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport { FormItemPrefixContext } from './context';\nimport useDebounce from './hooks/useDebounce';\nimport useStyle from './style';\nconst EMPTY_LIST = [];\nfunction toErrorEntity(error, prefix, errorStatus) {\n let index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n return {\n key: typeof error === 'string' ? error : `${prefix}-${index}`,\n error,\n errorStatus\n };\n}\nconst ErrorList = _ref => {\n let {\n help,\n helpStatus,\n errors = EMPTY_LIST,\n warnings = EMPTY_LIST,\n className: rootClassName,\n fieldId,\n onVisibleChanged\n } = _ref;\n const {\n prefixCls\n } = React.useContext(FormItemPrefixContext);\n const baseClassName = `${prefixCls}-item-explain`;\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n const collapseMotion = useMemo(() => initCollapseMotion(prefixCls), [prefixCls]);\n // We have to debounce here again since somewhere use ErrorList directly still need no shaking\n // ref: https://github.com/ant-design/ant-design/issues/36336\n const debounceErrors = useDebounce(errors);\n const debounceWarnings = useDebounce(warnings);\n const fullKeyList = React.useMemo(() => {\n if (help !== undefined && help !== null) {\n return [toErrorEntity(help, 'help', helpStatus)];\n }\n return [].concat(_toConsumableArray(debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index))), _toConsumableArray(debounceWarnings.map((warning, index) => toErrorEntity(warning, 'warning', 'warning', index))));\n }, [help, helpStatus, debounceErrors, debounceWarnings]);\n const helpProps = {};\n if (fieldId) {\n helpProps.id = `${fieldId}_help`;\n }\n return wrapCSSVar( /*#__PURE__*/React.createElement(CSSMotion, {\n motionDeadline: collapseMotion.motionDeadline,\n motionName: `${prefixCls}-show-help`,\n visible: !!fullKeyList.length,\n onVisibleChanged: onVisibleChanged\n }, holderProps => {\n const {\n className: holderClassName,\n style: holderStyle\n } = holderProps;\n return /*#__PURE__*/React.createElement(\"div\", Object.assign({}, helpProps, {\n className: classNames(baseClassName, holderClassName, cssVarCls, rootCls, rootClassName, hashId),\n style: holderStyle,\n role: \"alert\"\n }), /*#__PURE__*/React.createElement(CSSMotionList, Object.assign({\n keys: fullKeyList\n }, initCollapseMotion(prefixCls), {\n motionName: `${prefixCls}-show-help-item`,\n component: false\n }), itemProps => {\n const {\n key,\n error,\n errorStatus,\n className: itemClassName,\n style: itemStyle\n } = itemProps;\n return /*#__PURE__*/React.createElement(\"div\", {\n key: key,\n className: classNames(itemClassName, {\n [`${baseClassName}-${errorStatus}`]: errorStatus\n }),\n style: itemStyle\n }, error);\n }));\n }));\n};\nexport default ErrorList;","map":{"version":3,"names":["_toConsumableArray","React","useMemo","classNames","CSSMotion","CSSMotionList","initCollapseMotion","useCSSVarCls","FormItemPrefixContext","useDebounce","useStyle","EMPTY_LIST","toErrorEntity","error","prefix","errorStatus","index","arguments","length","undefined","key","ErrorList","_ref","help","helpStatus","errors","warnings","className","rootClassName","fieldId","onVisibleChanged","prefixCls","useContext","baseClassName","rootCls","wrapCSSVar","hashId","cssVarCls","collapseMotion","debounceErrors","debounceWarnings","fullKeyList","concat","map","warning","helpProps","id","createElement","motionDeadline","motionName","visible","holderProps","holderClassName","style","holderStyle","Object","assign","role","keys","component","itemProps","itemClassName","itemStyle"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/form/ErrorList.js"],"sourcesContent":["\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nimport { useMemo } from 'react';\nimport classNames from 'classnames';\nimport CSSMotion, { CSSMotionList } from 'rc-motion';\nimport initCollapseMotion from '../_util/motion';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport { FormItemPrefixContext } from './context';\nimport useDebounce from './hooks/useDebounce';\nimport useStyle from './style';\nconst EMPTY_LIST = [];\nfunction toErrorEntity(error, prefix, errorStatus) {\n let index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n return {\n key: typeof error === 'string' ? error : `${prefix}-${index}`,\n error,\n errorStatus\n };\n}\nconst ErrorList = _ref => {\n let {\n help,\n helpStatus,\n errors = EMPTY_LIST,\n warnings = EMPTY_LIST,\n className: rootClassName,\n fieldId,\n onVisibleChanged\n } = _ref;\n const {\n prefixCls\n } = React.useContext(FormItemPrefixContext);\n const baseClassName = `${prefixCls}-item-explain`;\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n const collapseMotion = useMemo(() => initCollapseMotion(prefixCls), [prefixCls]);\n // We have to debounce here again since somewhere use ErrorList directly still need no shaking\n // ref: https://github.com/ant-design/ant-design/issues/36336\n const debounceErrors = useDebounce(errors);\n const debounceWarnings = useDebounce(warnings);\n const fullKeyList = React.useMemo(() => {\n if (help !== undefined && help !== null) {\n return [toErrorEntity(help, 'help', helpStatus)];\n }\n return [].concat(_toConsumableArray(debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index))), _toConsumableArray(debounceWarnings.map((warning, index) => toErrorEntity(warning, 'warning', 'warning', index))));\n }, [help, helpStatus, debounceErrors, debounceWarnings]);\n const helpProps = {};\n if (fieldId) {\n helpProps.id = `${fieldId}_help`;\n }\n return wrapCSSVar( /*#__PURE__*/React.createElement(CSSMotion, {\n motionDeadline: collapseMotion.motionDeadline,\n motionName: `${prefixCls}-show-help`,\n visible: !!fullKeyList.length,\n onVisibleChanged: onVisibleChanged\n }, holderProps => {\n const {\n className: holderClassName,\n style: holderStyle\n } = holderProps;\n return /*#__PURE__*/React.createElement(\"div\", Object.assign({}, helpProps, {\n className: classNames(baseClassName, holderClassName, cssVarCls, rootCls, rootClassName, hashId),\n style: holderStyle,\n role: \"alert\"\n }), /*#__PURE__*/React.createElement(CSSMotionList, Object.assign({\n keys: fullKeyList\n }, initCollapseMotion(prefixCls), {\n motionName: `${prefixCls}-show-help-item`,\n component: false\n }), itemProps => {\n const {\n key,\n error,\n errorStatus,\n className: itemClassName,\n style: itemStyle\n } = itemProps;\n return /*#__PURE__*/React.createElement(\"div\", {\n key: key,\n className: classNames(itemClassName, {\n [`${baseClassName}-${errorStatus}`]: errorStatus\n }),\n style: itemStyle\n }, error);\n }));\n }));\n};\nexport default ErrorList;"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,OAAO,QAAQ,OAAO;AAC/B,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,IAAIC,aAAa,QAAQ,WAAW;AACpD,OAAOC,kBAAkB,MAAM,iBAAiB;AAChD,OAAOC,YAAY,MAAM,uCAAuC;AAChE,SAASC,qBAAqB,QAAQ,WAAW;AACjD,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,OAAOC,QAAQ,MAAM,SAAS;AAC9B,MAAMC,UAAU,GAAG,EAAE;AACrB,SAASC,aAAaA,CAACC,KAAK,EAAEC,MAAM,EAAEC,WAAW,EAAE;EACjD,IAAIC,KAAK,GAAGC,SAAS,CAACC,MAAM,GAAG,CAAC,IAAID,SAAS,CAAC,CAAC,CAAC,KAAKE,SAAS,GAAGF,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;EACjF,OAAO;IACLG,GAAG,EAAE,OAAOP,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,GAAGC,MAAM,IAAIE,KAAK,EAAE;IAC7DH,KAAK;IACLE;EACF,CAAC;AACH;AACA,MAAMM,SAAS,GAAGC,IAAI,IAAI;EACxB,IAAI;IACFC,IAAI;IACJC,UAAU;IACVC,MAAM,GAAGd,UAAU;IACnBe,QAAQ,GAAGf,UAA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