e4b500eb736a7a1f1e94e4ec36fe8b22.json
28.9 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport ClearableLabeledInput, { hasPrefixSuffix } from './ClearableLabeledInput';\nimport { ConfigConsumer } from '../config-provider';\nimport SizeContext from '../config-provider/SizeContext';\nimport devWarning from '../_util/devWarning';\nexport function fixControlledValue(value) {\n if (typeof value === 'undefined' || value === null) {\n return '';\n }\n\n return value;\n}\nexport function resolveOnChange(target, e, onChange) {\n if (onChange) {\n var event = e;\n\n if (e.type === 'click') {\n // click clear icon\n event = Object.create(e);\n event.target = target;\n event.currentTarget = target;\n var originalInputValue = target.value; // change target ref value cause e.target.value should be '' when clear input\n\n target.value = '';\n onChange(event); // reset target ref value\n\n target.value = originalInputValue;\n return;\n }\n\n onChange(event);\n }\n}\nexport function getInputClassName(prefixCls, bordered, size, disabled, direction) {\n var _classNames;\n\n return classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-sm\"), size === 'small'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-lg\"), size === 'large'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-disabled\"), disabled), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-borderless\"), !bordered), _classNames));\n}\n\nvar Input = /*#__PURE__*/function (_React$Component) {\n _inherits(Input, _React$Component);\n\n var _super = _createSuper(Input);\n\n function Input(props) {\n var _this;\n\n _classCallCheck(this, Input);\n\n _this = _super.call(this, props);\n _this.direction = 'ltr';\n\n _this.focus = function () {\n _this.input.focus();\n };\n\n _this.saveClearableInput = function (input) {\n _this.clearableInput = input;\n };\n\n _this.saveInput = function (input) {\n _this.input = input;\n };\n\n _this.onFocus = function (e) {\n var onFocus = _this.props.onFocus;\n\n _this.setState({\n focused: true\n }, _this.clearPasswordValueAttribute);\n\n if (onFocus) {\n onFocus(e);\n }\n };\n\n _this.onBlur = function (e) {\n var onBlur = _this.props.onBlur;\n\n _this.setState({\n focused: false\n }, _this.clearPasswordValueAttribute);\n\n if (onBlur) {\n onBlur(e);\n }\n };\n\n _this.handleReset = function (e) {\n _this.setValue('', function () {\n _this.focus();\n });\n\n resolveOnChange(_this.input, e, _this.props.onChange);\n };\n\n _this.renderInput = function (prefixCls, size, bordered) {\n var input = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var _this$props = _this.props,\n className = _this$props.className,\n addonBefore = _this$props.addonBefore,\n addonAfter = _this$props.addonAfter,\n customizeSize = _this$props.size,\n disabled = _this$props.disabled; // Fix https://fb.me/react-unknown-prop\n\n var otherProps = omit(_this.props, ['prefixCls', 'onPressEnter', 'addonBefore', 'addonAfter', 'prefix', 'suffix', 'allowClear', // Input elements must be either controlled or uncontrolled,\n // specify either the value prop, or the defaultValue prop, but not both.\n 'defaultValue', 'size', 'inputType', 'bordered']);\n return /*#__PURE__*/React.createElement(\"input\", _extends({\n autoComplete: input.autoComplete\n }, otherProps, {\n onChange: _this.handleChange,\n onFocus: _this.onFocus,\n onBlur: _this.onBlur,\n onKeyDown: _this.handleKeyDown,\n className: classNames(getInputClassName(prefixCls, bordered, customizeSize || size, disabled, _this.direction), _defineProperty({}, className, className && !addonBefore && !addonAfter)),\n ref: _this.saveInput\n }));\n };\n\n _this.clearPasswordValueAttribute = function () {\n // https://github.com/ant-design/ant-design/issues/20541\n _this.removePasswordTimeout = setTimeout(function () {\n if (_this.input && _this.input.getAttribute('type') === 'password' && _this.input.hasAttribute('value')) {\n _this.input.removeAttribute('value');\n }\n });\n };\n\n _this.handleChange = function (e) {\n _this.setValue(e.target.value, _this.clearPasswordValueAttribute);\n\n resolveOnChange(_this.input, e, _this.props.onChange);\n };\n\n _this.handleKeyDown = function (e) {\n var _this$props2 = _this.props,\n onPressEnter = _this$props2.onPressEnter,\n onKeyDown = _this$props2.onKeyDown;\n\n if (e.keyCode === 13 && onPressEnter) {\n onPressEnter(e);\n }\n\n if (onKeyDown) {\n onKeyDown(e);\n }\n };\n\n _this.renderComponent = function (_ref) {\n var getPrefixCls = _ref.getPrefixCls,\n direction = _ref.direction,\n input = _ref.input;\n var _this$state = _this.state,\n value = _this$state.value,\n focused = _this$state.focused;\n var _this$props3 = _this.props,\n customizePrefixCls = _this$props3.prefixCls,\n _this$props3$bordered = _this$props3.bordered,\n bordered = _this$props3$bordered === void 0 ? true : _this$props3$bordered;\n var prefixCls = getPrefixCls('input', customizePrefixCls);\n _this.direction = direction;\n return /*#__PURE__*/React.createElement(SizeContext.Consumer, null, function (size) {\n return /*#__PURE__*/React.createElement(ClearableLabeledInput, _extends({\n size: size\n }, _this.props, {\n prefixCls: prefixCls,\n inputType: \"input\",\n value: fixControlledValue(value),\n element: _this.renderInput(prefixCls, size, bordered, input),\n handleReset: _this.handleReset,\n ref: _this.saveClearableInput,\n direction: direction,\n focused: focused,\n triggerFocus: _this.focus,\n bordered: bordered\n }));\n });\n };\n\n var value = typeof props.value === 'undefined' ? props.defaultValue : props.value;\n _this.state = {\n value: value,\n focused: false,\n // eslint-disable-next-line react/no-unused-state\n prevValue: props.value\n };\n return _this;\n }\n\n _createClass(Input, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.clearPasswordValueAttribute();\n } // Since polyfill `getSnapshotBeforeUpdate` need work with `componentDidUpdate`.\n // We keep an empty function here.\n\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {}\n }, {\n key: \"getSnapshotBeforeUpdate\",\n value: function getSnapshotBeforeUpdate(prevProps) {\n if (hasPrefixSuffix(prevProps) !== hasPrefixSuffix(this.props)) {\n devWarning(this.input !== document.activeElement, 'Input', \"When Input is focused, dynamic add or remove prefix / suffix will make it lose focus caused by dom structure change. Read more: https://ant.design/components/input/#FAQ\");\n }\n\n return null;\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.removePasswordTimeout) {\n clearTimeout(this.removePasswordTimeout);\n }\n }\n }, {\n key: \"blur\",\n value: function blur() {\n this.input.blur();\n }\n }, {\n key: \"setSelectionRange\",\n value: function setSelectionRange(start, end, direction) {\n this.input.setSelectionRange(start, end, direction);\n }\n }, {\n key: \"select\",\n value: function select() {\n this.input.select();\n }\n }, {\n key: \"setValue\",\n value: function setValue(value, callback) {\n if (this.props.value === undefined) {\n this.setState({\n value: value\n }, callback);\n } else {\n callback === null || callback === void 0 ? void 0 : callback();\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderComponent);\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, _ref2) {\n var prevValue = _ref2.prevValue;\n var newState = {\n prevValue: nextProps.value\n };\n\n if (nextProps.value !== undefined || prevValue !== nextProps.value) {\n newState.value = nextProps.value;\n }\n\n return newState;\n }\n }]);\n\n return Input;\n}(React.Component);\n\nInput.defaultProps = {\n type: 'text'\n};\nexport default Input;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/input/Input.js"],"names":["_extends","_classCallCheck","_createClass","_inherits","_createSuper","_defineProperty","React","classNames","omit","ClearableLabeledInput","hasPrefixSuffix","ConfigConsumer","SizeContext","devWarning","fixControlledValue","value","resolveOnChange","target","e","onChange","event","type","Object","create","currentTarget","originalInputValue","getInputClassName","prefixCls","bordered","size","disabled","direction","_classNames","concat","Input","_React$Component","_super","props","_this","call","focus","input","saveClearableInput","clearableInput","saveInput","onFocus","setState","focused","clearPasswordValueAttribute","onBlur","handleReset","setValue","renderInput","arguments","length","undefined","_this$props","className","addonBefore","addonAfter","customizeSize","otherProps","createElement","autoComplete","handleChange","onKeyDown","handleKeyDown","ref","removePasswordTimeout","setTimeout","getAttribute","hasAttribute","removeAttribute","_this$props2","onPressEnter","keyCode","renderComponent","_ref","getPrefixCls","_this$state","state","_this$props3","customizePrefixCls","_this$props3$bordered","Consumer","inputType","element","triggerFocus","defaultValue","prevValue","key","componentDidMount","componentDidUpdate","getSnapshotBeforeUpdate","prevProps","document","activeElement","componentWillUnmount","clearTimeout","blur","setSelectionRange","start","end","select","callback","render","getDerivedStateFromProps","nextProps","_ref2","newState","Component","defaultProps"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAOC,SAAP,MAAsB,iCAAtB;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,qBAAP,IAAgCC,eAAhC,QAAuD,yBAAvD;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,OAAOC,WAAP,MAAwB,gCAAxB;AACA,OAAOC,UAAP,MAAuB,qBAAvB;AACA,OAAO,SAASC,kBAAT,CAA4BC,KAA5B,EAAmC;AACxC,MAAI,OAAOA,KAAP,KAAiB,WAAjB,IAAgCA,KAAK,KAAK,IAA9C,EAAoD;AAClD,WAAO,EAAP;AACD;;AAED,SAAOA,KAAP;AACD;AACD,OAAO,SAASC,eAAT,CAAyBC,MAAzB,EAAiCC,CAAjC,EAAoCC,QAApC,EAA8C;AACnD,MAAIA,QAAJ,EAAc;AACZ,QAAIC,KAAK,GAAGF,CAAZ;;AAEA,QAAIA,CAAC,CAACG,IAAF,KAAW,OAAf,EAAwB;AACtB;AACAD,MAAAA,KAAK,GAAGE,MAAM,CAACC,MAAP,CAAc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_extends from \"@babel/runtime/helpers/extends\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport ClearableLabeledInput, { hasPrefixSuffix } from './ClearableLabeledInput';\nimport { ConfigConsumer } from '../config-provider';\nimport SizeContext from '../config-provider/SizeContext';\nimport devWarning from '../_util/devWarning';\nexport function fixControlledValue(value) {\n if (typeof value === 'undefined' || value === null) {\n return '';\n }\n\n return value;\n}\nexport function resolveOnChange(target, e, onChange) {\n if (onChange) {\n var event = e;\n\n if (e.type === 'click') {\n // click clear icon\n event = Object.create(e);\n event.target = target;\n event.currentTarget = target;\n var originalInputValue = target.value; // change target ref value cause e.target.value should be '' when clear input\n\n target.value = '';\n onChange(event); // reset target ref value\n\n target.value = originalInputValue;\n return;\n }\n\n onChange(event);\n }\n}\nexport function getInputClassName(prefixCls, bordered, size, disabled, direction) {\n var _classNames;\n\n return classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-sm\"), size === 'small'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-lg\"), size === 'large'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-disabled\"), disabled), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-borderless\"), !bordered), _classNames));\n}\n\nvar Input = /*#__PURE__*/function (_React$Component) {\n _inherits(Input, _React$Component);\n\n var _super = _createSuper(Input);\n\n function Input(props) {\n var _this;\n\n _classCallCheck(this, Input);\n\n _this = _super.call(this, props);\n _this.direction = 'ltr';\n\n _this.focus = function () {\n _this.input.focus();\n };\n\n _this.saveClearableInput = function (input) {\n _this.clearableInput = input;\n };\n\n _this.saveInput = function (input) {\n _this.input = input;\n };\n\n _this.onFocus = function (e) {\n var onFocus = _this.props.onFocus;\n\n _this.setState({\n focused: true\n }, _this.clearPasswordValueAttribute);\n\n if (onFocus) {\n onFocus(e);\n }\n };\n\n _this.onBlur = function (e) {\n var onBlur = _this.props.onBlur;\n\n _this.setState({\n focused: false\n }, _this.clearPasswordValueAttribute);\n\n if (onBlur) {\n onBlur(e);\n }\n };\n\n _this.handleReset = function (e) {\n _this.setValue('', function () {\n _this.focus();\n });\n\n resolveOnChange(_this.input, e, _this.props.onChange);\n };\n\n _this.renderInput = function (prefixCls, size, bordered) {\n var input = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var _this$props = _this.props,\n className = _this$props.className,\n addonBefore = _this$props.addonBefore,\n addonAfter = _this$props.addonAfter,\n customizeSize = _this$props.size,\n disabled = _this$props.disabled; // Fix https://fb.me/react-unknown-prop\n\n var otherProps = omit(_this.props, ['prefixCls', 'onPressEnter', 'addonBefore', 'addonAfter', 'prefix', 'suffix', 'allowClear', // Input elements must be either controlled or uncontrolled,\n // specify either the value prop, or the defaultValue prop, but not both.\n 'defaultValue', 'size', 'inputType', 'bordered']);\n return /*#__PURE__*/React.createElement(\"input\", _extends({\n autoComplete: input.autoComplete\n }, otherProps, {\n onChange: _this.handleChange,\n onFocus: _this.onFocus,\n onBlur: _this.onBlur,\n onKeyDown: _this.handleKeyDown,\n className: classNames(getInputClassName(prefixCls, bordered, customizeSize || size, disabled, _this.direction), _defineProperty({}, className, className && !addonBefore && !addonAfter)),\n ref: _this.saveInput\n }));\n };\n\n _this.clearPasswordValueAttribute = function () {\n // https://github.com/ant-design/ant-design/issues/20541\n _this.removePasswordTimeout = setTimeout(function () {\n if (_this.input && _this.input.getAttribute('type') === 'password' && _this.input.hasAttribute('value')) {\n _this.input.removeAttribute('value');\n }\n });\n };\n\n _this.handleChange = function (e) {\n _this.setValue(e.target.value, _this.clearPasswordValueAttribute);\n\n resolveOnChange(_this.input, e, _this.props.onChange);\n };\n\n _this.handleKeyDown = function (e) {\n var _this$props2 = _this.props,\n onPressEnter = _this$props2.onPressEnter,\n onKeyDown = _this$props2.onKeyDown;\n\n if (e.keyCode === 13 && onPressEnter) {\n onPressEnter(e);\n }\n\n if (onKeyDown) {\n onKeyDown(e);\n }\n };\n\n _this.renderComponent = function (_ref) {\n var getPrefixCls = _ref.getPrefixCls,\n direction = _ref.direction,\n input = _ref.input;\n var _this$state = _this.state,\n value = _this$state.value,\n focused = _this$state.focused;\n var _this$props3 = _this.props,\n customizePrefixCls = _this$props3.prefixCls,\n _this$props3$bordered = _this$props3.bordered,\n bordered = _this$props3$bordered === void 0 ? true : _this$props3$bordered;\n var prefixCls = getPrefixCls('input', customizePrefixCls);\n _this.direction = direction;\n return /*#__PURE__*/React.createElement(SizeContext.Consumer, null, function (size) {\n return /*#__PURE__*/React.createElement(ClearableLabeledInput, _extends({\n size: size\n }, _this.props, {\n prefixCls: prefixCls,\n inputType: \"input\",\n value: fixControlledValue(value),\n element: _this.renderInput(prefixCls, size, bordered, input),\n handleReset: _this.handleReset,\n ref: _this.saveClearableInput,\n direction: direction,\n focused: focused,\n triggerFocus: _this.focus,\n bordered: bordered\n }));\n });\n };\n\n var value = typeof props.value === 'undefined' ? props.defaultValue : props.value;\n _this.state = {\n value: value,\n focused: false,\n // eslint-disable-next-line react/no-unused-state\n prevValue: props.value\n };\n return _this;\n }\n\n _createClass(Input, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.clearPasswordValueAttribute();\n } // Since polyfill `getSnapshotBeforeUpdate` need work with `componentDidUpdate`.\n // We keep an empty function here.\n\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {}\n }, {\n key: \"getSnapshotBeforeUpdate\",\n value: function getSnapshotBeforeUpdate(prevProps) {\n if (hasPrefixSuffix(prevProps) !== hasPrefixSuffix(this.props)) {\n devWarning(this.input !== document.activeElement, 'Input', \"When Input is focused, dynamic add or remove prefix / suffix will make it lose focus caused by dom structure change. Read more: https://ant.design/components/input/#FAQ\");\n }\n\n return null;\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.removePasswordTimeout) {\n clearTimeout(this.removePasswordTimeout);\n }\n }\n }, {\n key: \"blur\",\n value: function blur() {\n this.input.blur();\n }\n }, {\n key: \"setSelectionRange\",\n value: function setSelectionRange(start, end, direction) {\n this.input.setSelectionRange(start, end, direction);\n }\n }, {\n key: \"select\",\n value: function select() {\n this.input.select();\n }\n }, {\n key: \"setValue\",\n value: function setValue(value, callback) {\n if (this.props.value === undefined) {\n this.setState({\n value: value\n }, callback);\n } else {\n callback === null || callback === void 0 ? void 0 : callback();\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderComponent);\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, _ref2) {\n var prevValue = _ref2.prevValue;\n var newState = {\n prevValue: nextProps.value\n };\n\n if (nextProps.value !== undefined || prevValue !== nextProps.value) {\n newState.value = nextProps.value;\n }\n\n return newState;\n }\n }]);\n\n return Input;\n}(React.Component);\n\nInput.defaultProps = {\n type: 'text'\n};\nexport default Input;"]},"metadata":{},"sourceType":"module"}