a71e3a39afb9a37e0f157f75223106da.json
15.7 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/extends\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { composeRef } from \"rc-util/es/ref\";\nimport SearchOutlined from '@ant-design/icons/SearchOutlined';\nimport Input from './Input';\nimport Button from '../button';\nimport SizeContext from '../config-provider/SizeContext';\nimport { ConfigContext } from '../config-provider';\nimport { cloneElement } from '../_util/reactNode';\nvar Search = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var _classNames;\n\n var customizePrefixCls = props.prefixCls,\n customizeInputPrefixCls = props.inputPrefixCls,\n className = props.className,\n customizeSize = props.size,\n suffix = props.suffix,\n _props$enterButton = props.enterButton,\n enterButton = _props$enterButton === void 0 ? false : _props$enterButton,\n addonAfter = props.addonAfter,\n loading = props.loading,\n disabled = props.disabled,\n customOnSearch = props.onSearch,\n customOnChange = props.onChange,\n restProps = __rest(props, [\"prefixCls\", \"inputPrefixCls\", \"className\", \"size\", \"suffix\", \"enterButton\", \"addonAfter\", \"loading\", \"disabled\", \"onSearch\", \"onChange\"]);\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var contextSize = React.useContext(SizeContext);\n var size = customizeSize || contextSize;\n var inputRef = React.useRef(null);\n\n var onChange = function onChange(e) {\n if (e && e.target && e.type === 'click' && customOnSearch) {\n customOnSearch(e.target.value, e);\n }\n\n if (customOnChange) {\n customOnChange(e);\n }\n };\n\n var onMouseDown = function onMouseDown(e) {\n var _a;\n\n if (document.activeElement === ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input)) {\n e.preventDefault();\n }\n };\n\n var onSearch = function onSearch(e) {\n var _a;\n\n if (customOnSearch) {\n customOnSearch((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input.value, e);\n }\n };\n\n var prefixCls = getPrefixCls('input-search', customizePrefixCls);\n var inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);\n var searchIcon = typeof enterButton === 'boolean' || typeof enterButton === 'undefined' ? /*#__PURE__*/React.createElement(SearchOutlined, null) : null;\n var btnClassName = \"\".concat(prefixCls, \"-button\");\n var button;\n var enterButtonAsElement = enterButton || {};\n var isAntdButton = enterButtonAsElement.type && enterButtonAsElement.type.__ANT_BUTTON === true;\n\n if (isAntdButton || enterButtonAsElement.type === 'button') {\n button = cloneElement(enterButtonAsElement, _extends({\n onMouseDown: onMouseDown,\n onClick: onSearch,\n key: 'enterButton'\n }, isAntdButton ? {\n className: btnClassName,\n size: size\n } : {}));\n } else {\n button = /*#__PURE__*/React.createElement(Button, {\n className: btnClassName,\n type: enterButton ? 'primary' : undefined,\n size: size,\n disabled: disabled,\n key: \"enterButton\",\n onMouseDown: onMouseDown,\n onClick: onSearch,\n loading: loading,\n icon: searchIcon\n }, enterButton);\n }\n\n if (addonAfter) {\n button = [button, cloneElement(addonAfter, {\n key: 'addonAfter'\n })];\n }\n\n var cls = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(size), !!size), _defineProperty(_classNames, \"\".concat(prefixCls, \"-with-button\"), !!enterButton), _classNames), className);\n return /*#__PURE__*/React.createElement(Input, _extends({\n ref: composeRef(inputRef, ref),\n onPressEnter: onSearch\n }, restProps, {\n size: size,\n prefixCls: inputPrefixCls,\n addonAfter: button,\n suffix: suffix,\n onChange: onChange,\n className: cls,\n disabled: disabled\n }));\n});\nSearch.displayName = 'Search';\nexport default Search;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/input/Search.js"],"names":["_defineProperty","_extends","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","classNames","composeRef","SearchOutlined","Input","Button","SizeContext","ConfigContext","cloneElement","Search","forwardRef","props","ref","_classNames","customizePrefixCls","prefixCls","customizeInputPrefixCls","inputPrefixCls","className","customizeSize","size","suffix","_props$enterButton","enterButton","addonAfter","loading","disabled","customOnSearch","onSearch","customOnChange","onChange","restProps","_React$useContext","useContext","getPrefixCls","direction","contextSize","inputRef","useRef","target","type","value","onMouseDown","_a","document","activeElement","current","input","preventDefault","searchIcon","createElement","btnClassName","concat","button","enterButtonAsElement","isAntdButton","__ANT_BUTTON","onClick","key","undefined","icon","cls","onPressEnter","displayName"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,uCAA5B;AACA,OAAOC,QAAP,MAAqB,gCAArB;;AAEA,IAAIC,MAAM,GAAG,QAAQ,KAAKA,MAAb,IAAuB,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAClD,MAAIC,CAAC,GAAG,EAAR;;AAEA,OAAK,IAAIC,CAAT,IAAcH,CAAd,EAAiB;AACf,QAAII,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCP,CAArC,EAAwCG,CAAxC,KAA8CF,CAAC,CAACO,OAAF,CAAUL,CAAV,IAAe,CAAjE,EAAoED,CAAC,CAACC,CAAD,CAAD,GAAOH,CAAC,CAACG,CAAD,CAAR;AACrE;;AAED,MAAIH,CAAC,IAAI,IAAL,IAAa,OAAOI,MAAM,CAACK,qBAAd,KAAwC,UAAzD,EAAqE,KAAK,IAAIC,CAAC,GAAG,CAAR,EAAWP,CAAC,GAAGC,MAAM,CAACK,qBAAP,C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AAlH,EAAiLpC,eAAe,CAAC6B,WAAD,EAAc,GAAGuC,MAAH,CAAUrC,SAAV,EAAqB,cAArB,CAAd,EAAoD,CAAC,CAACQ,WAAtD,CAAhM,EAAoQV,WAAjR,GAA+RK,SAA/R,CAApB;AACA,SAAO,aAAalB,KAAK,CAACkD,aAAN,CAAoB9C,KAApB,EAA2BnB,QAAQ,CAAC;AACtD2B,IAAAA,GAAG,EAAEV,UAAU,CAACmC,QAAD,EAAWzB,GAAX,CADuC;AAEtDkD,IAAAA,YAAY,EAAElC;AAFwC,GAAD,EAGpDG,SAHoD,EAGzC;AACZX,IAAAA,IAAI,EAAEA,IADM;AAEZL,IAAAA,SAAS,EAAEE,cAFC;AAGZO,IAAAA,UAAU,EAAE6B,MAHA;AAIZhC,IAAAA,MAAM,EAAEA,MAJI;AAKZS,IAAAA,QAAQ,EAAEA,QALE;AAMZZ,IAAAA,SAAS,EAAE2C,GANC;AAOZnC,IAAAA,QAAQ,EAAEA;AAPE,GAHyC,CAAnC,CAApB;AAYD,CArGyB,CAA1B;AAsGAjB,MAAM,CAACsD,WAAP,GAAqB,QAArB;AACA,eAAetD,MAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/extends\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\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\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { composeRef } from \"rc-util/es/ref\";\nimport SearchOutlined from '@ant-design/icons/SearchOutlined';\nimport Input from './Input';\nimport Button from '../button';\nimport SizeContext from '../config-provider/SizeContext';\nimport { ConfigContext } from '../config-provider';\nimport { cloneElement } from '../_util/reactNode';\nvar Search = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var _classNames;\n\n var customizePrefixCls = props.prefixCls,\n customizeInputPrefixCls = props.inputPrefixCls,\n className = props.className,\n customizeSize = props.size,\n suffix = props.suffix,\n _props$enterButton = props.enterButton,\n enterButton = _props$enterButton === void 0 ? false : _props$enterButton,\n addonAfter = props.addonAfter,\n loading = props.loading,\n disabled = props.disabled,\n customOnSearch = props.onSearch,\n customOnChange = props.onChange,\n restProps = __rest(props, [\"prefixCls\", \"inputPrefixCls\", \"className\", \"size\", \"suffix\", \"enterButton\", \"addonAfter\", \"loading\", \"disabled\", \"onSearch\", \"onChange\"]);\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var contextSize = React.useContext(SizeContext);\n var size = customizeSize || contextSize;\n var inputRef = React.useRef(null);\n\n var onChange = function onChange(e) {\n if (e && e.target && e.type === 'click' && customOnSearch) {\n customOnSearch(e.target.value, e);\n }\n\n if (customOnChange) {\n customOnChange(e);\n }\n };\n\n var onMouseDown = function onMouseDown(e) {\n var _a;\n\n if (document.activeElement === ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input)) {\n e.preventDefault();\n }\n };\n\n var onSearch = function onSearch(e) {\n var _a;\n\n if (customOnSearch) {\n customOnSearch((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input.value, e);\n }\n };\n\n var prefixCls = getPrefixCls('input-search', customizePrefixCls);\n var inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);\n var searchIcon = typeof enterButton === 'boolean' || typeof enterButton === 'undefined' ? /*#__PURE__*/React.createElement(SearchOutlined, null) : null;\n var btnClassName = \"\".concat(prefixCls, \"-button\");\n var button;\n var enterButtonAsElement = enterButton || {};\n var isAntdButton = enterButtonAsElement.type && enterButtonAsElement.type.__ANT_BUTTON === true;\n\n if (isAntdButton || enterButtonAsElement.type === 'button') {\n button = cloneElement(enterButtonAsElement, _extends({\n onMouseDown: onMouseDown,\n onClick: onSearch,\n key: 'enterButton'\n }, isAntdButton ? {\n className: btnClassName,\n size: size\n } : {}));\n } else {\n button = /*#__PURE__*/React.createElement(Button, {\n className: btnClassName,\n type: enterButton ? 'primary' : undefined,\n size: size,\n disabled: disabled,\n key: \"enterButton\",\n onMouseDown: onMouseDown,\n onClick: onSearch,\n loading: loading,\n icon: searchIcon\n }, enterButton);\n }\n\n if (addonAfter) {\n button = [button, cloneElement(addonAfter, {\n key: 'addonAfter'\n })];\n }\n\n var cls = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(size), !!size), _defineProperty(_classNames, \"\".concat(prefixCls, \"-with-button\"), !!enterButton), _classNames), className);\n return /*#__PURE__*/React.createElement(Input, _extends({\n ref: composeRef(inputRef, ref),\n onPressEnter: onSearch\n }, restProps, {\n size: size,\n prefixCls: inputPrefixCls,\n addonAfter: button,\n suffix: suffix,\n onChange: onChange,\n className: cls,\n disabled: disabled\n }));\n});\nSearch.displayName = 'Search';\nexport default Search;"]},"metadata":{},"sourceType":"module"}