PromoCursed/node_modules/.cache/babel-loader/904f4f4531b830ed93f839d065c6b08ebf34b367e545e388e4063b2ac79a42d5.json

1 line
17 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport classNames from 'classnames';\nimport { useEvent, useMergedState } from 'rc-util';\nimport * as React from 'react';\nimport CascaderContext from \"./context\";\nimport useMissingValues from \"./hooks/useMissingValues\";\nimport useOptions from \"./hooks/useOptions\";\nimport useSelect from \"./hooks/useSelect\";\nimport useValues from \"./hooks/useValues\";\nimport RawOptionList from \"./OptionList/List\";\nimport { fillFieldNames, toRawValues } from \"./utils/commonUtil\";\nimport { toPathOptions } from \"./utils/treeUtil\";\nfunction noop() {}\nexport default function Panel(props) {\n var _ref = props,\n _ref$prefixCls = _ref.prefixCls,\n prefixCls = _ref$prefixCls === void 0 ? 'rc-cascader' : _ref$prefixCls,\n style = _ref.style,\n className = _ref.className,\n options = _ref.options,\n checkable = _ref.checkable,\n defaultValue = _ref.defaultValue,\n value = _ref.value,\n fieldNames = _ref.fieldNames,\n changeOnSelect = _ref.changeOnSelect,\n onChange = _ref.onChange,\n showCheckedStrategy = _ref.showCheckedStrategy,\n loadData = _ref.loadData,\n expandTrigger = _ref.expandTrigger,\n _ref$expandIcon = _ref.expandIcon,\n expandIcon = _ref$expandIcon === void 0 ? '>' : _ref$expandIcon,\n loadingIcon = _ref.loadingIcon,\n direction = _ref.direction,\n _ref$notFoundContent = _ref.notFoundContent,\n notFoundContent = _ref$notFoundContent === void 0 ? 'Not Found' : _ref$notFoundContent;\n\n // ======================== Multiple ========================\n var multiple = !!checkable;\n\n // ========================= Values =========================\n var _useMergedState = useMergedState(defaultValue, {\n value: value,\n postState: toRawValues\n }),\n _useMergedState2 = _slicedToArray(_useMergedState, 2),\n rawValues = _useMergedState2[0],\n setRawValues = _useMergedState2[1];\n\n // ========================= FieldNames =========================\n var mergedFieldNames = React.useMemo(function () {\n return fillFieldNames(fieldNames);\n }, /* eslint-disable react-hooks/exhaustive-deps */\n [JSON.stringify(fieldNames)]\n /* eslint-enable react-hooks/exhaustive-deps */);\n\n // =========================== Option ===========================\n var _useOptions = useOptions(mergedFieldNames, options),\n _useOptions2 = _slicedToArray(_useOptions, 3),\n mergedOptions = _useOptions2[0],\n getPathKeyEntities = _useOptions2[1],\n getValueByKeyPath = _useOptions2[2];\n\n // ========================= Values =========================\n var getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);\n\n // Fill `rawValues` with checked conduction values\n var _useValues = useValues(multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues),\n _useValues2 = _slicedToArray(_useValues, 3),\n checkedValues = _useValues2[0],\n halfCheckedValues = _useValues2[1],\n missingCheckedValues = _useValues2[2];\n\n // =========================== Change ===========================\n var triggerChange = useEvent(function (nextValues) {\n setRawValues(nextValues);\n\n // Save perf if no need trigger event\n if (onChange) {\n var nextRawValues = toRawValues(nextValues);\n var valueOptions = nextRawValues.map(function (valueCells) {\n return toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(function (valueOpt) {\n return valueOpt.option;\n });\n });\n var triggerValues = multiple ? nextRawValues : nextRawValues[0];\n var triggerOptions = multiple ? valueOptions : valueOptions[0];\n onChange(triggerValues, triggerOptions);\n }\n });\n\n // =========================== Select ===========================\n var handleSelection = useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, missingCheckedValues, getPathKeyEntities, getValueByKeyPath, sh