PromoCursed/node_modules/.cache/babel-loader/0fc24f05ef7f751d85869d148fdfcc7757f2d35bd103f122dc2fd8042bb023ea.json

1 line
20 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 _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport CascaderContext from \"../context\";\nimport { SEARCH_MARK } from \"../hooks/useSearchOptions\";\nimport { isLeaf, toPathKey } from \"../utils/commonUtil\";\nimport Checkbox from \"./Checkbox\";\nexport var FIX_LABEL = '__cascader_fix_label__';\nexport default function Column(_ref) {\n var prefixCls = _ref.prefixCls,\n multiple = _ref.multiple,\n options = _ref.options,\n activeValue = _ref.activeValue,\n prevValuePath = _ref.prevValuePath,\n onToggleOpen = _ref.onToggleOpen,\n onSelect = _ref.onSelect,\n onActive = _ref.onActive,\n checkedSet = _ref.checkedSet,\n halfCheckedSet = _ref.halfCheckedSet,\n loadingKeys = _ref.loadingKeys,\n isSelectable = _ref.isSelectable,\n searchValue = _ref.searchValue;\n var menuPrefixCls = \"\".concat(prefixCls, \"-menu\");\n var menuItemPrefixCls = \"\".concat(prefixCls, \"-menu-item\");\n var _React$useContext = React.useContext(CascaderContext),\n fieldNames = _React$useContext.fieldNames,\n changeOnSelect = _React$useContext.changeOnSelect,\n expandTrigger = _React$useContext.expandTrigger,\n expandIcon = _React$useContext.expandIcon,\n loadingIcon = _React$useContext.loadingIcon,\n dropdownMenuColumnStyle = _React$useContext.dropdownMenuColumnStyle,\n optionRender = _React$useContext.optionRender;\n var hoverOpen = expandTrigger === 'hover';\n\n // ============================ Option ============================\n var optionInfoList = React.useMemo(function () {\n return options.map(function (option) {\n var _option$FIX_LABEL;\n var disabled = option.disabled,\n disableCheckbox = option.disableCheckbox;\n var searchOptions = option[SEARCH_MARK];\n var label = (_option$FIX_LABEL = option[FIX_LABEL]) !== null && _option$FIX_LABEL !== void 0 ? _option$FIX_LABEL : option[fieldNames.label];\n var value = option[fieldNames.value];\n var isMergedLeaf = isLeaf(option, fieldNames);\n\n // Get real value of option. Search option is different way.\n var fullPath = searchOptions ? searchOptions.map(function (opt) {\n return opt[fieldNames.value];\n }) : [].concat(_toConsumableArray(prevValuePath), [value]);\n var fullPathKey = toPathKey(fullPath);\n var isLoading = loadingKeys.includes(fullPathKey);\n\n // >>>>> checked\n var checked = checkedSet.has(fullPathKey);\n\n // >>>>> halfChecked\n var halfChecked = halfCheckedSet.has(fullPathKey);\n return {\n disabled: disabled,\n label: label,\n value: value,\n isLeaf: isMergedLeaf,\n isLoading: isLoading,\n checked: checked,\n halfChecked: halfChecked,\n option: option,\n disableCheckbox: disableCheckbox,\n fullPath: fullPath,\n fullPathKey: fullPathKey\n };\n });\n }, [options, checkedSet, fieldNames, halfCheckedSet, loadingKeys, prevValuePath]);\n\n // ============================ Render ============================\n return /*#__PURE__*/React.createElement(\"ul\", {\n className: menuPrefixCls,\n role: \"menu\"\n }, optionInfoList.map(function (_ref2) {\n var disabled = _ref2.disabled,\n label = _ref2.label,\n value = _ref2.value,\n isMergedLeaf = _ref2.isLeaf,\n isLoading = _ref2.isLoading,\n checked = _ref2.checked,\n halfChecked = _ref2.halfChecked,\n option = _ref2.option,\n fullPath = _ref2.fullPath,\n fullPathKey = _ref2.fullPathKey,\n disableCheckbox = _ref2.disableCheckbox;\n // >>>>> Open\n var triggerOpenPath = function triggerOpenPath() {\n if (disabled || searchValue) {\n return;\n }\n var nextValueCells = _toConsumableArray(fullPath);\n if (hoverOpen && isMergedLeaf) {\n nextValueCells.pop();\n }\n onActive(nextValueCells);\n