1 line
22 KiB
JSON
1 line
22 KiB
JSON
|
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"id\", \"open\", \"clearIcon\", \"suffixIcon\", \"activeHelp\", \"allHelp\", \"focused\", \"onFocus\", \"onBlur\", \"onKeyDown\", \"locale\", \"generateConfig\", \"placeholder\", \"className\", \"style\", \"onClick\", \"onClear\", \"internalPicker\", \"value\", \"onChange\", \"onSubmit\", \"onInputChange\", \"multiple\", \"maxTagCount\", \"format\", \"maskFormat\", \"preserveInvalidOnBlur\", \"onInvalid\", \"disabled\", \"invalid\", \"inputReadOnly\", \"direction\", \"onOpenChange\", \"onMouseDown\", \"required\", \"aria-required\", \"autoFocus\", \"removeIcon\"];\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport { isSame } from \"../../../utils/dateUtil\";\nimport PickerContext from \"../../context\";\nimport useInputProps from \"../hooks/useInputProps\";\nimport useRootProps from \"../hooks/useRootProps\";\nimport Icon, { ClearIcon } from \"../Icon\";\nimport Input from \"../Input\";\nimport MultipleDates from \"./MultipleDates\";\nfunction SingleSelector(props, ref) {\n var id = props.id,\n open = props.open,\n clearIcon = props.clearIcon,\n suffixIcon = props.suffixIcon,\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 internalPicker = props.internalPicker,\n value = props.value,\n onChange = props.onChange,\n onSubmit = props.onSubmit,\n onInputChange = props.onInputChange,\n multiple = props.multiple,\n maxTagCount = props.maxTagCount,\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 _onMouseDown = props.onMouseDown,\n required = props.required,\n ariaRequired = props['aria-required'],\n autoFocus = props.autoFocus,\n removeIcon = props.removeIcon,\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 // ========================= Refs =========================\n var rootRef = React.useRef();\n var inputRef = React.useRef();\n React.useImperativeHandle(ref, function () {\n return {\n nativeElement: rootRef.current,\n focus: function focus(options) {\n var _inputRef$current;\n (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus(options);\n },\n blur: function blur() {\n var _inputRef$current2;\n (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.blur();\n }\n };\n });\n\n // ======================== Props =========================\n var rootProps = useRootProps(restProps);\n\n // ======================== Change ========================\n var onSingleChange = function onSingleChange(date) {\n onChange([date]);\n };\n var onMultipleRemove = function onMultipleRemove(date) {\n var nextValues = value.filter(function (oriDate) {\n return oriDate && !isSame(generateConfig, locale, oriDate, date, i
|