1 line
9.6 KiB
JSON
1 line
9.6 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nimport * as React from 'react';\nimport CheckCircleFilled from \"@ant-design/icons/es/icons/CheckCircleFilled\";\nimport CloseCircleFilled from \"@ant-design/icons/es/icons/CloseCircleFilled\";\nimport ExclamationCircleFilled from \"@ant-design/icons/es/icons/ExclamationCircleFilled\";\nimport LoadingOutlined from \"@ant-design/icons/es/icons/LoadingOutlined\";\nimport classNames from 'classnames';\nimport { FormContext, FormItemInputContext } from '../context';\nimport { getStatus } from '../util';\nconst iconMap = {\n success: CheckCircleFilled,\n warning: ExclamationCircleFilled,\n error: CloseCircleFilled,\n validating: LoadingOutlined\n};\nexport default function StatusProvider(_ref) {\n let {\n children,\n errors,\n warnings,\n hasFeedback,\n validateStatus,\n prefixCls,\n meta,\n noStyle\n } = _ref;\n const itemPrefixCls = `${prefixCls}-item`;\n const {\n feedbackIcons\n } = React.useContext(FormContext);\n const mergedValidateStatus = getStatus(errors, warnings, meta, null, !!hasFeedback, validateStatus);\n const {\n isFormItemInput: parentIsFormItemInput,\n status: parentStatus,\n hasFeedback: parentHasFeedback,\n feedbackIcon: parentFeedbackIcon\n } = React.useContext(FormItemInputContext);\n // ====================== Context =======================\n const formItemStatusContext = React.useMemo(() => {\n var _a;\n let feedbackIcon;\n if (hasFeedback) {\n const customIcons = hasFeedback !== true && hasFeedback.icons || feedbackIcons;\n const customIconNode = mergedValidateStatus && ((_a = customIcons === null || customIcons === void 0 ? void 0 : customIcons({\n status: mergedValidateStatus,\n errors,\n warnings\n })) === null || _a === void 0 ? void 0 : _a[mergedValidateStatus]);\n const IconNode = mergedValidateStatus && iconMap[mergedValidateStatus];\n feedbackIcon = customIconNode !== false && IconNode ? ( /*#__PURE__*/React.createElement(\"span\", {\n className: classNames(`${itemPrefixCls}-feedback-icon`, `${itemPrefixCls}-feedback-icon-${mergedValidateStatus}`)\n }, customIconNode || /*#__PURE__*/React.createElement(IconNode, null))) : null;\n }\n const context = {\n status: mergedValidateStatus || '',\n errors,\n warnings,\n hasFeedback: !!hasFeedback,\n feedbackIcon,\n isFormItemInput: true\n };\n // No style will follow parent context\n if (noStyle) {\n context.status = (mergedValidateStatus !== null && mergedValidateStatus !== void 0 ? mergedValidateStatus : parentStatus) || '';\n context.isFormItemInput = parentIsFormItemInput;\n context.hasFeedback = !!(hasFeedback !== null && hasFeedback !== void 0 ? hasFeedback : parentHasFeedback);\n context.feedbackIcon = hasFeedback !== undefined ? context.feedbackIcon : parentFeedbackIcon;\n }\n return context;\n }, [mergedValidateStatus, hasFeedback, noStyle, parentIsFormItemInput, parentStatus]);\n // ======================= Render =======================\n return /*#__PURE__*/React.createElement(FormItemInputContext.Provider, {\n value: formItemStatusContext\n }, children);\n}","map":{"version":3,"names":["React","CheckCircleFilled","CloseCircleFilled","ExclamationCircleFilled","LoadingOutlined","classNames","FormContext","FormItemInputContext","getStatus","iconMap","success","warning","error","validating","StatusProvider","_ref","children","errors","warnings","hasFeedback","validateStatus","prefixCls","meta","noStyle","itemPrefixCls","feedbackIcons","useContext","mergedValidateStatus","isFormItemInput","parentIsFormItemInput","status","parentStatus","parentHasFeedback","feedbackIcon","parentFeedbackIcon","formItemStatusContext","useMemo","_a","customIcons","icons","customIconNode","IconNode","createElement","className","context","undefined","Provider","value"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/form/FormItem/StatusProvider.js"],"sourcesContent":["\"use client\";\n\nimport * as React from
|