1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"ast":null,"code":"\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport omit from \"rc-util/es/omit\";\nimport { useZIndex } from '../_util/hooks/useZIndex';\nimport genPurePanel from '../_util/PurePanel';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport Select from '../select';\nconst {\n Option\n} = Select;\nfunction isSelectOptionOrSelectOptGroup(child) {\n return (child === null || child === void 0 ? void 0 : child.type) && (child.type.isSelectOption || child.type.isSelectOptGroup);\n}\nconst AutoComplete = (props, ref) => {\n var _a;\n const {\n prefixCls: customizePrefixCls,\n className,\n popupClassName,\n dropdownClassName,\n children,\n dataSource\n } = props;\n const childNodes = toArray(children);\n // ============================= Input =============================\n let customizeInput;\n if (childNodes.length === 1 && /*#__PURE__*/React.isValidElement(childNodes[0]) && !isSelectOptionOrSelectOptGroup(childNodes[0])) {\n [customizeInput] = childNodes;\n }\n const getInputElement = customizeInput ? () => customizeInput : undefined;\n // ============================ Options ============================\n let optionChildren;\n // [Legacy] convert `children` or `dataSource` into option children\n if (childNodes.length && isSelectOptionOrSelectOptGroup(childNodes[0])) {\n optionChildren = children;\n } else {\n optionChildren = dataSource ? dataSource.map(item => {\n if ( /*#__PURE__*/React.isValidElement(item)) {\n return item;\n }\n switch (typeof item) {\n case 'string':\n return /*#__PURE__*/React.createElement(Option, {\n key: item,\n value: item\n }, item);\n case 'object':\n {\n const {\n value: optionValue\n } = item;\n return /*#__PURE__*/React.createElement(Option, {\n key: optionValue,\n value: optionValue\n }, item.text);\n }\n default:\n return undefined;\n }\n }) : [];\n }\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('AutoComplete');\n warning.deprecated(!('dataSource' in props), 'dataSource', 'options');\n process.env.NODE_ENV !== \"production\" ? warning(!customizeInput || !('size' in props), 'usage', 'You need to control style self instead of setting `size` when using customize input.') : void 0;\n warning.deprecated(!dropdownClassName, 'dropdownClassName', 'popupClassName');\n }\n const {\n getPrefixCls\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('select', customizePrefixCls);\n // ============================ zIndex ============================\n const [zIndex] = useZIndex('SelectLike', (_a = props.dropdownStyle) === null || _a === void 0 ? void 0 : _a.zIndex);\n return /*#__PURE__*/React.createElement(Select, Object.assign({\n ref: ref,\n suffixIcon: null\n }, omit(props, ['dataSource', 'dropdownClassName']), {\n prefixCls: prefixCls,\n popupClassName: popupClassName || dropdownClassName,\n dropdownStyle: Object.assign(Object.assign({}, props.dropdownStyle), {\n zIndex\n }),\n className: classNames(`${prefixCls}-auto-complete`, className),\n mode: Select.SECRET_COMBOBOX_MODE_DO_NOT_USE,\n // Internal api\n getInputElement\n }), optionChildren);\n};\nconst RefAutoComplete = /*#__PURE__*/React.forwardRef(AutoComplete);\n// We don't care debug panel\n/* istanbul ignore next */\nconst PurePanel = genPurePanel(RefAutoComplete);\nRefAutoComplete.Option = Option;\nRefAutoComplete._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;\nif (process.env.NODE_ENV !== 'production') {\n RefAutoComplete.displayName = 'AutoComplete';\n}\nexport default RefAutoComplete;","map":{"version":3,"names":["React","classNames","toArray","omit","useZIndex","genPurePanel","devUseWarning","ConfigContext","Select","Option","isSelectOptionOrSelectOptGroup","child","type","isSelectOption","isSelectOptGroup","AutoComplete","props","ref","_a","prefixCls","customizePrefixCls","className","popupClassName","dropdownClassName","children","dataSource","childNodes","customizeInput","length","isValidElement","getInputElement","undefined","optionChildren","map","item","createElement","key","value","optionValue","text","process","env","NODE_ENV","warning","deprecated","getPrefixCls","useContext","zIndex","dropdownStyle","Object","assign","suffixIcon","mode","SECRET_COMBOBOX_MODE_DO_NOT_USE","RefAutoComplete","forwardRef","PurePanel","_InternalPanelDoNotUseOrYouWillBeFired","displayName"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/auto-complete/index.js"],"sourcesContent":["\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport omit from \"rc-util/es/omit\";\nimport { useZIndex } from '../_util/hooks/useZIndex';\nimport genPurePanel from '../_util/PurePanel';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport Select from '../select';\nconst {\n Option\n} = Select;\nfunction isSelectOptionOrSelectOptGroup(child) {\n return (child === null || child === void 0 ? void 0 : child.type) && (child.type.isSelectOption || child.type.isSelectOptGroup);\n}\nconst AutoComplete = (props, ref) => {\n var _a;\n const {\n prefixCls: customizePrefixCls,\n className,\n popupClassName,\n dropdownClassName,\n children,\n dataSource\n } = props;\n const childNodes = toArray(children);\n // ============================= Input =============================\n let customizeInput;\n if (childNodes.length === 1 && /*#__PURE__*/React.isValidElement(childNodes[0]) && !isSelectOptionOrSelectOptGroup(childNodes[0])) {\n [customizeInput] = childNodes;\n }\n const getInputElement = customizeInput ? () => customizeInput : undefined;\n // ============================ Options ============================\n let optionChildren;\n // [Legacy] convert `children` or `dataSource` into option children\n if (childNodes.length && isSelectOptionOrSelectOptGroup(childNodes[0])) {\n optionChildren = children;\n } else {\n optionChildren = dataSource ? dataSource.map(item => {\n if ( /*#__PURE__*/React.isValidElement(item)) {\n return item;\n }\n switch (typeof item) {\n case 'string':\n return /*#__PURE__*/React.createElement(Option, {\n key: item,\n value: item\n }, item);\n case 'object':\n {\n const {\n value: optionValue\n } = item;\n return /*#__PURE__*/React.createElement(Option, {\n key: optionValue,\n value: optionValue\n }, item.text);\n }\n default:\n return undefined;\n }\n }) : [];\n }\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('AutoComplete');\n warning.deprecated(!('dataSource' in props), 'dataSource', 'options');\n process.env.NODE_ENV !== \"production\" ? warning(!customizeInput || !('size' in props), 'usage', 'You need to control style self instead of setting `size` when using customize input.') : void 0;\n warning.deprecated(!dropdownClassName, 'dropdownClassName', 'popupClassName');\n }\n const {\n getPrefixCls\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('select', customizePrefixCls);\n // ============================ zIndex ============================\n const [zIndex] = useZIndex('SelectLike', (_a = props.dropdownStyle) === null || _a === void 0 ? void 0 : _a.zIndex);\n return /*#__PURE__*/React.createElement(Select, Object.assign({\n ref: ref,\n suffixIcon: null\n }, omit(props, ['dataSource', 'dropdownClassName']), {\n prefixCls: prefixCls,\n popupClassName: popupClassName || dropdownClassName,\n dropdownStyle: Object.assign(Object.assign({}, props.dropdownStyle), {\n zIndex\n }),\n className: classNames(`${prefixCls}-auto-complete`, className),\n mode: Select.SECRET_COMBOBOX_MODE_DO_NOT_USE,\n // Internal api\n getInputElement\n }), optionChildren);\n};\nconst RefAutoComplete = /*#__PURE__*/React.forwardRef(AutoComplete);\n// We don't care debug panel\n/* istanbul ignore next */\nconst PurePanel = genPurePanel(RefAutoComplete);\nRefAutoComplete.Option = Option;\nRefAutoComplete._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;\nif (process.env.NODE_ENV !== 'production') {\n RefAutoComplete.displayName = 'AutoComplete';\n}\nexport default RefAutoComplete;"],"mappings":"AAAA,YAAY;;AAEZ,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,OAAO,MAAM,6BAA6B;AACjD,OAAOC,IAAI,MAAM,iBAAiB;AAClC,SAASC,SAAS,QAAQ,0BAA0B;AACpD,OAAOC,YAAY,MAAM,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAOC,MAAM,MAAM,WAAW;AAC9B,MAAM;EACJC;AACF,CAAC,GAAGD,MAAM;AACV,SAASE,8BAA8BA,CAACC,KAAK,EAAE;EAC7C,OAAO,CAACA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,KAAK,CAACC,IAAI,MAAMD,KAAK,CAACC,IAAI,CAACC,c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