1 line
28 KiB
JSON
1 line
28 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"id\", \"clearIcon\", \"suffixIcon\", \"separator\", \"activeIndex\", \"activeHelp\", \"allHelp\", \"focused\", \"onFocus\", \"onBlur\", \"onKeyDown\", \"locale\", \"generateConfig\", \"placeholder\", \"className\", \"style\", \"onClick\", \"onClear\", \"value\", \"onChange\", \"onSubmit\", \"onInputChange\", \"format\", \"maskFormat\", \"preserveInvalidOnBlur\", \"onInvalid\", \"disabled\", \"invalid\", \"inputReadOnly\", \"direction\", \"onOpenChange\", \"onActiveOffset\", \"placement\", \"onMouseDown\", \"required\", \"aria-required\", \"autoFocus\"],\n _excluded2 = [\"index\"];\nimport classNames from 'classnames';\nimport ResizeObserver from 'rc-resize-observer';\nimport { useEvent } from 'rc-util';\nimport * as React from 'react';\nimport PickerContext from \"../context\";\nimport useInputProps from \"./hooks/useInputProps\";\nimport useRootProps from \"./hooks/useRootProps\";\nimport Icon, { ClearIcon } from \"./Icon\";\nimport Input from \"./Input\";\nimport { getoffsetUnit, getRealPlacement } from \"../../utils/uiUtil\";\nfunction RangeSelector(props, ref) {\n var id = props.id,\n clearIcon = props.clearIcon,\n suffixIcon = props.suffixIcon,\n _props$separator = props.separator,\n separator = _props$separator === void 0 ? '~' : _props$separator,\n activeIndex = props.activeIndex,\n activeHelp = props.activeHelp,\n allHelp = props.allHelp,\n focused = props.focused,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n onKeyDown = props.onKeyDown,\n locale = props.locale,\n generateConfig = props.generateConfig,\n placeholder = props.placeholder,\n className = props.className,\n style = props.style,\n onClick = props.onClick,\n onClear = props.onClear,\n value = props.value,\n onChange = props.onChange,\n onSubmit = props.onSubmit,\n onInputChange = props.onInputChange,\n format = props.format,\n maskFormat = props.maskFormat,\n preserveInvalidOnBlur = props.preserveInvalidOnBlur,\n onInvalid = props.onInvalid,\n disabled = props.disabled,\n invalid = props.invalid,\n inputReadOnly = props.inputReadOnly,\n direction = props.direction,\n onOpenChange = props.onOpenChange,\n onActiveOffset = props.onActiveOffset,\n placement = props.placement,\n _onMouseDown = props.onMouseDown,\n required = props.required,\n ariaRequired = props['aria-required'],\n autoFocus = props.autoFocus,\n restProps = _objectWithoutProperties(props, _excluded);\n var rtl = direction === 'rtl';\n\n // ======================== Prefix ========================\n var _React$useContext = React.useContext(PickerContext),\n prefixCls = _React$useContext.prefixCls;\n\n // ========================== Id ==========================\n var ids = React.useMemo(function () {\n if (typeof id === 'string') {\n return [id];\n }\n var mergedId = id || {};\n return [mergedId.start, mergedId.end];\n }, [id]);\n\n // ========================= Refs =========================\n var rootRef = React.useRef();\n var inputStartRef = React.useRef();\n var inputEndRef = React.useRef();\n var getInput = function getInput(index) {\n var _index;\n return (_index = [inputStartRef, inputEndRef][index]) === null || _index === void 0 ? void 0 : _index.current;\n };\n React.useImperativeHandle(ref, function () {\n return {\n nativeElement: rootRef.current,\n focus: function focus(options) {\n if (_typeof(options) === 'object') {\n var _getInput;\n var _ref = options || {},\n _ref$index = _ref.index,\n
|