1 line
33 KiB
JSON
1 line
33 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\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 classNames from 'classnames';\nimport RcCascader from 'rc-cascader';\nimport omit from \"rc-util/es/omit\";\nimport { useZIndex } from '../_util/hooks/useZIndex';\nimport { getTransitionName } from '../_util/motion';\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 DisabledContext from '../config-provider/DisabledContext';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport useSize from '../config-provider/hooks/useSize';\nimport { FormItemInputContext } from '../form/context';\nimport useVariant from '../form/hooks/useVariants';\nimport mergedBuiltinPlacements from '../select/mergedBuiltinPlacements';\nimport useSelectStyle from '../select/style';\nimport useIcons from '../select/useIcons';\nimport useShowArrow from '../select/useShowArrow';\nimport { useCompactItemContext } from '../space/Compact';\nimport useBase from './hooks/useBase';\nimport useCheckable from './hooks/useCheckable';\nimport useColumnIcons from './hooks/useColumnIcons';\nimport CascaderPanel from './Panel';\nimport useStyle from './style';\nconst {\n SHOW_CHILD,\n SHOW_PARENT\n} = RcCascader;\nfunction highlightKeyword(str, lowerKeyword, prefixCls) {\n const cells = str.toLowerCase().split(lowerKeyword).reduce((list, cur, index) => index === 0 ? [cur] : [].concat(_toConsumableArray(list), [lowerKeyword, cur]), []);\n const fillCells = [];\n let start = 0;\n cells.forEach((cell, index) => {\n const end = start + cell.length;\n let originWorld = str.slice(start, end);\n start = end;\n if (index % 2 === 1) {\n originWorld = /*#__PURE__*/\n // eslint-disable-next-line react/no-array-index-key\n React.createElement(\"span\", {\n className: `${prefixCls}-menu-item-keyword`,\n key: `separator-${index}`\n }, originWorld);\n }\n fillCells.push(originWorld);\n });\n return fillCells;\n}\nconst defaultSearchRender = (inputValue, path, prefixCls, fieldNames) => {\n const optionList = [];\n // We do lower here to save perf\n const lower = inputValue.toLowerCase();\n path.forEach((node, index) => {\n if (index !== 0) {\n optionList.push(' / ');\n }\n let label = node[fieldNames.label];\n const type = typeof label;\n if (type === 'string' || type === 'number') {\n label = highlightKeyword(String(label), lower, prefixCls);\n }\n optionList.push(label);\n });\n return optionList;\n};\nconst Cascader = /*#__PURE__*/React.forwardRef((props, ref) => {\n var _a;\n const {\n prefixCls: customizePrefixCls,\n size: customizeSize,\n disabled: customDisabled,\n className,\n rootClassName,\n multiple,\n bordered = true,\n transitionName,\n choiceTransitionName = '',\n popupClassName,\n dropdownClassName,\n expandIcon,\n placement,\n showSearch,\n allowClear = true,\n notFoundContent,\n direction,\n getPopupContainer,\n status: customStatus,\n showArrow,\n builtinPlacements,\n style,\n variant: customVariant\n } = props,\n rest = __rest(props, [\"prefixCls\", \"size\", \"disabled\", \"className\", \"rootClassName\", \"multiple\", \"bordered\", \"transitionName\", \"choiceTransitionName\
|