1 line
23 KiB
JSON
1 line
23 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};\n// eslint-disable-next-line import/no-named-as-default\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport RcMentions from 'rc-mentions';\nimport { composeRef } from \"rc-util/es/ref\";\nimport getAllowClear from '../_util/getAllowClear';\nimport genPurePanel from '../_util/PurePanel';\nimport { getMergedStatus, getStatusClassNames } from '../_util/statusUtils';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport DefaultRenderEmpty from '../config-provider/defaultRenderEmpty';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport { FormItemInputContext } from '../form/context';\nimport useVariant from '../form/hooks/useVariants';\nimport Spin from '../spin';\nimport useStyle from './style';\nexport const {\n Option\n} = RcMentions;\nfunction loadingFilterOption() {\n return true;\n}\nconst InternalMentions = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n disabled,\n loading,\n filterOption,\n children,\n notFoundContent,\n options,\n status: customStatus,\n allowClear = false,\n popupClassName,\n style,\n variant: customVariant\n } = props,\n restProps = __rest(props, [\"prefixCls\", \"className\", \"rootClassName\", \"disabled\", \"loading\", \"filterOption\", \"children\", \"notFoundContent\", \"options\", \"status\", \"allowClear\", \"popupClassName\", \"style\", \"variant\"]);\n const [focused, setFocused] = React.useState(false);\n const innerRef = React.useRef(null);\n const mergedRef = composeRef(ref, innerRef);\n // =================== Warning =====================\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Mentions');\n warning.deprecated(!children, 'Mentions.Option', 'options');\n }\n const {\n getPrefixCls,\n renderEmpty,\n direction,\n mentions: contextMentions\n } = React.useContext(ConfigContext);\n const {\n status: contextStatus,\n hasFeedback,\n feedbackIcon\n } = React.useContext(FormItemInputContext);\n const mergedStatus = getMergedStatus(contextStatus, customStatus);\n const onFocus = function () {\n if (restProps.onFocus) {\n restProps.onFocus.apply(restProps, arguments);\n }\n setFocused(true);\n };\n const onBlur = function () {\n if (restProps.onBlur) {\n restProps.onBlur.apply(restProps, arguments);\n }\n setFocused(false);\n };\n const notFoundContentEle = React.useMemo(() => {\n if (notFoundContent !== undefined) {\n return notFoundContent;\n }\n return (renderEmpty === null || renderEmpty === void 0 ? void 0 : renderEmpty('Select')) || /*#__PURE__*/React.createElement(DefaultRenderEmpty, {\n componentName: \"Select\"\n });\n }, [notFoundContent, renderEmpty]);\n const mentionOptions = React.useMemo(() => {\n if (loading) {\n return /*#__PURE__*/React.createElement(Option, {\n value: \"ANTD_SEARCHING\",\n disabled: true\n }, /*#__PURE__*/React.createElement(Spin, {\n size: \"small\"\n }));\n }\n return children;\n }, [loading, children]);\n const mergedOptions = loading ? [{\n value: 'ANTD_SEARCHING',\n disabled: true,\n label: /*#__PURE__*/React.createElement(Spin, {\n size: \"small\"\n })\n }] : options;\n const mentionsfilterOption = loading ? loadingFilterOption : filterOption;\n const prefixCls = getPrefixCls('mentions', customizePrefixCls);\n const mergedAll
|