1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport Input from \"./Input\";\nimport { getTitle } from \"../utils/commonUtil\";\nvar SingleSelector = function SingleSelector(props) {\n var inputElement = props.inputElement,\n prefixCls = props.prefixCls,\n id = props.id,\n inputRef = props.inputRef,\n disabled = props.disabled,\n autoFocus = props.autoFocus,\n autoComplete = props.autoComplete,\n activeDescendantId = props.activeDescendantId,\n mode = props.mode,\n open = props.open,\n values = props.values,\n placeholder = props.placeholder,\n tabIndex = props.tabIndex,\n showSearch = props.showSearch,\n searchValue = props.searchValue,\n activeValue = props.activeValue,\n maxLength = props.maxLength,\n onInputKeyDown = props.onInputKeyDown,\n onInputMouseDown = props.onInputMouseDown,\n onInputChange = props.onInputChange,\n onInputPaste = props.onInputPaste,\n onInputCompositionStart = props.onInputCompositionStart,\n onInputCompositionEnd = props.onInputCompositionEnd,\n title = props.title;\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n inputChanged = _React$useState2[0],\n setInputChanged = _React$useState2[1];\n var combobox = mode === 'combobox';\n var inputEditable = combobox || showSearch;\n var item = values[0];\n var inputValue = searchValue || '';\n if (combobox && activeValue && !inputChanged) {\n inputValue = activeValue;\n }\n React.useEffect(function () {\n if (combobox) {\n setInputChanged(false);\n }\n }, [combobox, activeValue]);\n\n // Not show text when closed expect combobox mode\n var hasTextInput = mode !== 'combobox' && !open && !showSearch ? false : !!inputValue;\n\n // Get title of selection item\n var selectionTitle = title === undefined ? getTitle(item) : title;\n var placeholderNode = React.useMemo(function () {\n if (item) {\n return null;\n }\n return /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-placeholder\"),\n style: hasTextInput ? {\n visibility: 'hidden'\n } : undefined\n }, placeholder);\n }, [item, hasTextInput, placeholder, prefixCls]);\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-search\")\n }, /*#__PURE__*/React.createElement(Input, {\n ref: inputRef,\n prefixCls: prefixCls,\n id: id,\n open: open,\n inputElement: inputElement,\n disabled: disabled,\n autoFocus: autoFocus,\n autoComplete: autoComplete,\n editable: inputEditable,\n activeDescendantId: activeDescendantId,\n value: inputValue,\n onKeyDown: onInputKeyDown,\n onMouseDown: onInputMouseDown,\n onChange: function onChange(e) {\n setInputChanged(true);\n onInputChange(e);\n },\n onPaste: onInputPaste,\n onCompositionStart: onInputCompositionStart,\n onCompositionEnd: onInputCompositionEnd,\n tabIndex: tabIndex,\n attrs: pickAttrs(props, true),\n maxLength: combobox ? maxLength : undefined\n })), !combobox && item ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-item\"),\n title: selectionTitle\n // 当 Select 已经选中选项时,还需 selection 隐藏但留在原地占位\n // https://github.com/ant-design/ant-design/issues/27688\n // https://github.com/ant-design/ant-design/issues/41530\n ,\n\n style: hasTextInput ? {\n visibility: 'hidden'\n } : undefined\n }, item.label) : null, placeholderNode);\n};\nexport default SingleSelector;","map":{"version":3,"names":["_slicedToArray","React","pickAttrs","Input","getTitle","SingleSelector","props","inputElement","prefixCls","id","inputRef","disabled","autoFocus","autoComplete","activeDescendantId","mode","open","values","placeholder","tabIndex","showSearch","searchValue","activeValue","maxLength","onInputKeyDown","onInputMouseDown","onInputChange","onInputPaste","onInputCompositionStart","onInputCompositionEnd","title","_React$useState","useState","_React$useState2","inputChanged","setInputChanged","combobox","inputEditable","item","inputValue","useEffect","hasTextInput","selectionTitle","undefined","placeholderNode","useMemo","createElement","className","concat","style","visibility","Fragment","ref","editable","value","onKeyDown","onMouseDown","onChange","e","onPaste","onCompositionStart","onCompositionEnd","attrs","label"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-select/es/Selector/SingleSelector.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport Input from \"./Input\";\nimport { getTitle } from \"../utils/commonUtil\";\nvar SingleSelector = function SingleSelector(props) {\n var inputElement = props.inputElement,\n prefixCls = props.prefixCls,\n id = props.id,\n inputRef = props.inputRef,\n disabled = props.disabled,\n autoFocus = props.autoFocus,\n autoComplete = props.autoComplete,\n activeDescendantId = props.activeDescendantId,\n mode = props.mode,\n open = props.open,\n values = props.values,\n placeholder = props.placeholder,\n tabIndex = props.tabIndex,\n showSearch = props.showSearch,\n searchValue = props.searchValue,\n activeValue = props.activeValue,\n maxLength = props.maxLength,\n onInputKeyDown = props.onInputKeyDown,\n onInputMouseDown = props.onInputMouseDown,\n onInputChange = props.onInputChange,\n onInputPaste = props.onInputPaste,\n onInputCompositionStart = props.onInputCompositionStart,\n onInputCompositionEnd = props.onInputCompositionEnd,\n title = props.title;\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n inputChanged = _React$useState2[0],\n setInputChanged = _React$useState2[1];\n var combobox = mode === 'combobox';\n var inputEditable = combobox || showSearch;\n var item = values[0];\n var inputValue = searchValue || '';\n if (combobox && activeValue && !inputChanged) {\n inputValue = activeValue;\n }\n React.useEffect(function () {\n if (combobox) {\n setInputChanged(false);\n }\n }, [combobox, activeValue]);\n\n // Not show text when closed expect combobox mode\n var hasTextInput = mode !== 'combobox' && !open && !showSearch ? false : !!inputValue;\n\n // Get title of selection item\n var selectionTitle = title === undefined ? getTitle(item) : title;\n var placeholderNode = React.useMemo(function () {\n if (item) {\n return null;\n }\n return /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-placeholder\"),\n style: hasTextInput ? {\n visibility: 'hidden'\n } : undefined\n }, placeholder);\n }, [item, hasTextInput, placeholder, prefixCls]);\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-search\")\n }, /*#__PURE__*/React.createElement(Input, {\n ref: inputRef,\n prefixCls: prefixCls,\n id: id,\n open: open,\n inputElement: inputElement,\n disabled: disabled,\n autoFocus: autoFocus,\n autoComplete: autoComplete,\n editable: inputEditable,\n activeDescendantId: activeDescendantId,\n value: inputValue,\n onKeyDown: onInputKeyDown,\n onMouseDown: onInputMouseDown,\n onChange: function onChange(e) {\n setInputChanged(true);\n onInputChange(e);\n },\n onPaste: onInputPaste,\n onCompositionStart: onInputCompositionStart,\n onCompositionEnd: onInputCompositionEnd,\n tabIndex: tabIndex,\n attrs: pickAttrs(props, true),\n maxLength: combobox ? maxLength : undefined\n })), !combobox && item ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-selection-item\"),\n title: selectionTitle\n // 当 Select 已经选中选项时,还需 selection 隐藏但留在原地占位\n // https://github.com/ant-design/ant-design/issues/27688\n // https://github.com/ant-design/ant-design/issues/41530\n ,\n style: hasTextInput ? {\n visibility: 'hidden'\n } : undefined\n }, item.label) : null, placeholderNode);\n};\nexport default SingleSelector;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,SAAS,MAAM,sBAAsB;AAC5C,OAAOC,KAAK,MAAM,SAAS;AAC3B,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,IAAIC,cAAc,GAAG,SAASA,cAAcA,CAACC,KAAK,EAAE;EAClD,IAAIC,YAAY,GAAGD,KAAK,CAACC,YAAY;IACnCC,SAAS,GAAGF,KAAK,CAACE,SAAS;IAC3BC,EAAE,GAAGH,KAAK,CAACG,EAAE;IACbC,QAAQ,GAAGJ,KAAK,CAACI,QAAQ;IACzBC,QAAQ,GAAGL,KAAK,CAACK,QAAQ;IACzBC,SAAS,GAAGN,KAAK,CAACM,SAAS;IAC3BC,YAAY,GAAGP,KAAK,CAACO,YAAY;IACjCC,kBAA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