PromoCursed/node_modules/.cache/babel-loader/32a91d0892051aec84667ec2c7a47a9901288b8815dd3d4496f15afd4bd20b0f.json

1 line
19 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport { warning } from 'rc-util';\nimport * as React from 'react';\nimport useLocale from \"../../hooks/useLocale\";\nimport { fillShowTimeConfig, getTimeProps } from \"../../hooks/useTimeConfig\";\nimport { toArray } from \"../../utils/miscUtil\";\nimport { fillClearIcon } from \"../Selector/hooks/useClearIcon\";\nimport useDisabledBoundary from \"./useDisabledBoundary\";\nimport { useFieldFormat } from \"./useFieldFormat\";\nimport useInputReadOnly from \"./useInputReadOnly\";\nimport useInvalidate from \"./useInvalidate\";\nfunction useList(value) {\n var fillMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var values = React.useMemo(function () {\n var list = value ? toArray(value) : value;\n if (fillMode && list) {\n list[1] = list[1] || list[0];\n }\n return list;\n }, [value, fillMode]);\n return values;\n}\n\n/**\n * Align the outer props with unique typed and fill undefined props.\n * This is shared with both RangePicker and Picker. This will do:\n * - Convert `value` & `defaultValue` to array\n * - handle the legacy props fill like `clearIcon` + `allowClear` = `clearIcon`\n */\nexport default function useFilledProps(props, updater) {\n var generateConfig = props.generateConfig,\n locale = props.locale,\n _props$picker = props.picker,\n picker = _props$picker === void 0 ? 'date' : _props$picker,\n _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-picker' : _props$prefixCls,\n _props$styles = props.styles,\n styles = _props$styles === void 0 ? {} : _props$styles,\n _props$classNames = props.classNames,\n classNames = _props$classNames === void 0 ? {} : _props$classNames,\n _props$order = props.order,\n order = _props$order === void 0 ? true : _props$order,\n _props$components = props.components,\n components = _props$components === void 0 ? {} : _props$components,\n inputRender = props.inputRender,\n allowClear = props.allowClear,\n clearIcon = props.clearIcon,\n needConfirm = props.needConfirm,\n multiple = props.multiple,\n format = props.format,\n inputReadOnly = props.inputReadOnly,\n disabledDate = props.disabledDate,\n minDate = props.minDate,\n maxDate = props.maxDate,\n showTime = props.showTime,\n value = props.value,\n defaultValue = props.defaultValue,\n pickerValue = props.pickerValue,\n defaultPickerValue = props.defaultPickerValue;\n var values = useList(value);\n var defaultValues = useList(defaultValue);\n var pickerValues = useList(pickerValue);\n var defaultPickerValues = useList(defaultPickerValue);\n\n // ======================== Picker ========================\n /** Almost same as `picker`, but add `datetime` for `date` with `showTime` */\n var internalPicker = picker === 'date' && showTime ? 'datetime' : picker;\n\n /** The picker is `datetime` or `time` */\n var multipleInteractivePicker = internalPicker === 'time' || internalPicker === 'datetime';\n var complexPicker = multipleInteractivePicker || multiple;\n var mergedNeedConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : multipleInteractivePicker;\n\n // ========================== Time ==========================\n // Auto `format` need to check `showTime.showXXX` first.\n // And then merge the `locale` into `mergedShowTime`.\n var _getTimeProps = getTimeProps(props),\n _getTimeProps2 = _slicedToArray(_getTimeProps, 4),\n timeProps = _getTimeProps2[0],\n localeTimeProps = _getTimeProps2[1],\n showTimeFormat = _getTimeProps2[2],\n propFormat = _getTimeProps2[3];\n\n // ======================= Locales ========================\n var mergedLocale = useLocale(locale, localeTimeProps);\n var mergedShowTime = React.useMemo(function () {\n return fillShowTimeConfig(internalPicker, showTimeFormat, propFormat, timeProps, mergedLocale);\n }, [internalPic