PromoCursed/node_modules/.cache/babel-loader/da0b7dfb62fb28e3444ce69c2d145cb3ea73e982744e3c0bb242b86953277474.json

1 line
38 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"active\", \"showActiveCls\", \"suffixIcon\", \"format\", \"validateFormat\", \"onChange\", \"onInput\", \"helped\", \"onHelp\", \"onSubmit\", \"onKeyDown\", \"preserveInvalidOnBlur\", \"invalid\", \"clearIcon\"];\nimport classNames from 'classnames';\nimport { useEvent } from 'rc-util';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport raf from \"rc-util/es/raf\";\nimport * as React from 'react';\nimport { leftPad } from \"../../utils/miscUtil\";\nimport PickerContext from \"../context\";\nimport useLockEffect from \"../hooks/useLockEffect\";\nimport Icon from \"./Icon\";\nimport MaskFormat from \"./MaskFormat\";\nimport { getMaskRange } from \"./util\";\n\n// Format logic\n//\n// First time on focus:\n// 1. check if the text is valid, if not fill with format\n// 2. set highlight cell to the first cell\n// Cells\n// 1. Selection the index cell, set inner `cacheValue` to ''\n// 2. Key input filter non-number char, patch after the `cacheValue`\n// 1. Replace the `cacheValue` with input align the cell length\n// 2. Re-selection the mask cell\n// 3. If `cacheValue` match the limit length or cell format (like 1 ~ 12 month), go to next cell\n\nvar Input = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var active = props.active,\n _props$showActiveCls = props.showActiveCls,\n showActiveCls = _props$showActiveCls === void 0 ? true : _props$showActiveCls,\n suffixIcon = props.suffixIcon,\n format = props.format,\n validateFormat = props.validateFormat,\n onChange = props.onChange,\n onInput = props.onInput,\n helped = props.helped,\n onHelp = props.onHelp,\n onSubmit = props.onSubmit,\n onKeyDown = props.onKeyDown,\n _props$preserveInvali = props.preserveInvalidOnBlur,\n preserveInvalidOnBlur = _props$preserveInvali === void 0 ? false : _props$preserveInvali,\n invalid = props.invalid,\n clearIcon = props.clearIcon,\n restProps = _objectWithoutProperties(props, _excluded);\n var value = props.value,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n onMouseUp = props.onMouseUp;\n var _React$useContext = React.useContext(PickerContext),\n prefixCls = _React$useContext.prefixCls,\n _React$useContext$inp = _React$useContext.input,\n Component = _React$useContext$inp === void 0 ? 'input' : _React$useContext$inp;\n var inputPrefixCls = \"\".concat(prefixCls, \"-input\");\n\n // ======================== Value =========================\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n focused = _React$useState2[0],\n setFocused = _React$useState2[1];\n var _React$useState3 = React.useState(value),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n internalInputValue = _React$useState4[0],\n setInputValue = _React$useState4[1];\n var _React$useState5 = React.useState(''),\n _React$useState6 = _slicedToArray(_React$useState5, 2),\n focusCellText = _React$useState6[0],\n setFocusCellText = _React$useState6[1];\n var _React$useState7 = React.useState(null),\n _React$useState8 = _slicedToArray(_React$useState7, 2),\n focusCellIndex = _React$useState8[0],\n setFocusCellIndex = _React$useState8[1];\n var _React$useState9 = React.useState(null),\n _React$useState10 = _slicedToArray(_React$useState9, 2),\n forceSelectionSyncMark = _React$useState10[0],\n forceSelectionSync = _React$useState10[1];\n var inputValue = internalInputValue || '';\n\n // Sync value if needed\n React.useEffect(function () {\n setInputValue(value);\n }, [value]);\n\n // ========================= Refs =========================\n var holderRef = React.useRef();\n var inputRef = React.useRef();\