You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1807 lines
71 KiB
1807 lines
71 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[19842],{
|
|
|
|
/***/ 19842:
|
|
/*!*************************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/cascader/index.js + 18 modules ***!
|
|
\*************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ cascader; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
var toConsumableArray = __webpack_require__(95190);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/LeftOutlined.js + 1 modules
|
|
var LeftOutlined = __webpack_require__(33853);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/LoadingOutlined.js + 1 modules
|
|
var LoadingOutlined = __webpack_require__(58617);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/RightOutlined.js + 1 modules
|
|
var RightOutlined = __webpack_require__(38819);
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
|
|
var _classnames_2_5_1_classnames = __webpack_require__(92310);
|
|
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(14809);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__(50298);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(62646);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-select@14.8.1@rc-select/es/index.js + 28 modules
|
|
var es = __webpack_require__(77861);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-select@14.8.1@rc-select/es/hooks/useId.js
|
|
var useId = __webpack_require__(17115);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-tree@5.7.12@rc-tree/es/utils/conductUtil.js
|
|
var conductUtil = __webpack_require__(90782);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/hooks/useEvent.js
|
|
var useEvent = __webpack_require__(6089);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/hooks/useMergedState.js
|
|
var useMergedState = __webpack_require__(18929);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/context.js
|
|
|
|
var CascaderContext = /*#__PURE__*/_react_17_0_2_react.createContext(null);
|
|
/* harmony default export */ var context = (CascaderContext);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/typeof.js
|
|
var esm_typeof = __webpack_require__(93664);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__(4635);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(20439);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/hooks/useSearchOptions.js
|
|
|
|
|
|
|
|
|
|
var SEARCH_MARK = '__rc_cascader_search_mark__';
|
|
var defaultFilter = function defaultFilter(search, options, _ref) {
|
|
var label = _ref.label;
|
|
return options.some(function (opt) {
|
|
return String(opt[label]).toLowerCase().includes(search.toLowerCase());
|
|
});
|
|
};
|
|
var defaultRender = function defaultRender(inputValue, path, prefixCls, fieldNames) {
|
|
return path.map(function (opt) {
|
|
return opt[fieldNames.label];
|
|
}).join(' / ');
|
|
};
|
|
/* harmony default export */ var useSearchOptions = (function (search, options, fieldNames, prefixCls, config, changeOnSelect) {
|
|
var _config$filter = config.filter,
|
|
filter = _config$filter === void 0 ? defaultFilter : _config$filter,
|
|
_config$render = config.render,
|
|
render = _config$render === void 0 ? defaultRender : _config$render,
|
|
_config$limit = config.limit,
|
|
limit = _config$limit === void 0 ? 50 : _config$limit,
|
|
sort = config.sort;
|
|
return _react_17_0_2_react.useMemo(function () {
|
|
var filteredOptions = [];
|
|
if (!search) {
|
|
return [];
|
|
}
|
|
function dig(list, pathOptions) {
|
|
var parentDisabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
list.forEach(function (option) {
|
|
// Perf saving when `sort` is disabled and `limit` is provided
|
|
if (!sort && limit !== false && limit > 0 && filteredOptions.length >= limit) {
|
|
return;
|
|
}
|
|
var connectedPathOptions = [].concat((0,toConsumableArray/* default */.Z)(pathOptions), [option]);
|
|
var children = option[fieldNames.children];
|
|
var mergedDisabled = parentDisabled || option.disabled;
|
|
|
|
// If current option is filterable
|
|
if (
|
|
// If is leaf option
|
|
!children || children.length === 0 ||
|
|
// If is changeOnSelect
|
|
changeOnSelect) {
|
|
if (filter(search, connectedPathOptions, {
|
|
label: fieldNames.label
|
|
})) {
|
|
var _objectSpread2;
|
|
filteredOptions.push((0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, option), {}, (_objectSpread2 = {
|
|
disabled: mergedDisabled
|
|
}, (0,defineProperty/* default */.Z)(_objectSpread2, fieldNames.label, render(search, connectedPathOptions, prefixCls, fieldNames)), (0,defineProperty/* default */.Z)(_objectSpread2, SEARCH_MARK, connectedPathOptions), (0,defineProperty/* default */.Z)(_objectSpread2, fieldNames.children, undefined), _objectSpread2)));
|
|
}
|
|
}
|
|
if (children) {
|
|
dig(option[fieldNames.children], connectedPathOptions, mergedDisabled);
|
|
}
|
|
});
|
|
}
|
|
dig(options, []);
|
|
|
|
// Do sort
|
|
if (sort) {
|
|
filteredOptions.sort(function (a, b) {
|
|
return sort(a[SEARCH_MARK], b[SEARCH_MARK], search, fieldNames);
|
|
});
|
|
}
|
|
return limit !== false && limit > 0 ? filteredOptions.slice(0, limit) : filteredOptions;
|
|
}, [search, options, fieldNames, prefixCls, render, changeOnSelect, filter, sort, limit]);
|
|
});
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/utils/commonUtil.js
|
|
|
|
var VALUE_SPLIT = '__RC_CASCADER_SPLIT__';
|
|
var SHOW_PARENT = 'SHOW_PARENT';
|
|
var SHOW_CHILD = 'SHOW_CHILD';
|
|
|
|
/**
|
|
* Will convert value to string, and join with `VALUE_SPLIT`
|
|
*/
|
|
function toPathKey(value) {
|
|
return value.join(VALUE_SPLIT);
|
|
}
|
|
|
|
/**
|
|
* Batch convert value to string, and join with `VALUE_SPLIT`
|
|
*/
|
|
function toPathKeys(value) {
|
|
return value.map(toPathKey);
|
|
}
|
|
function toPathValueStr(pathKey) {
|
|
return pathKey.split(VALUE_SPLIT);
|
|
}
|
|
function fillFieldNames(fieldNames) {
|
|
var _ref = fieldNames || {},
|
|
label = _ref.label,
|
|
value = _ref.value,
|
|
children = _ref.children;
|
|
var val = value || 'value';
|
|
return {
|
|
label: label || 'label',
|
|
value: val,
|
|
key: val,
|
|
children: children || 'children'
|
|
};
|
|
}
|
|
function isLeaf(option, fieldNames) {
|
|
var _option$isLeaf, _option$fieldNames$ch;
|
|
return (_option$isLeaf = option.isLeaf) !== null && _option$isLeaf !== void 0 ? _option$isLeaf : !((_option$fieldNames$ch = option[fieldNames.children]) !== null && _option$fieldNames$ch !== void 0 && _option$fieldNames$ch.length);
|
|
}
|
|
function scrollIntoParentView(element) {
|
|
var parent = element.parentElement;
|
|
if (!parent) {
|
|
return;
|
|
}
|
|
var elementToParent = element.offsetTop - parent.offsetTop; // offsetParent may not be parent.
|
|
if (elementToParent - parent.scrollTop < 0) {
|
|
parent.scrollTo({
|
|
top: elementToParent
|
|
});
|
|
} else if (elementToParent + element.offsetHeight - parent.scrollTop > parent.offsetHeight) {
|
|
parent.scrollTo({
|
|
top: elementToParent + element.offsetHeight - parent.offsetHeight
|
|
});
|
|
}
|
|
}
|
|
function getFullPathKeys(options, fieldNames) {
|
|
return options.map(function (item) {
|
|
var _item$SEARCH_MARK;
|
|
return (_item$SEARCH_MARK = item[SEARCH_MARK]) === null || _item$SEARCH_MARK === void 0 ? void 0 : _item$SEARCH_MARK.map(function (opt) {
|
|
return opt[fieldNames.value];
|
|
});
|
|
});
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/utils/treeUtil.js
|
|
|
|
function formatStrategyValues(pathKeys, getKeyPathEntities, showCheckedStrategy) {
|
|
var valueSet = new Set(pathKeys);
|
|
var keyPathEntities = getKeyPathEntities();
|
|
return pathKeys.filter(function (key) {
|
|
var entity = keyPathEntities[key];
|
|
var parent = entity ? entity.parent : null;
|
|
var children = entity ? entity.children : null;
|
|
if (entity && entity.node.disabled) {
|
|
return true;
|
|
}
|
|
return showCheckedStrategy === SHOW_CHILD ? !(children && children.some(function (child) {
|
|
return child.key && valueSet.has(child.key);
|
|
})) : !(parent && !parent.node.disabled && valueSet.has(parent.key));
|
|
});
|
|
}
|
|
function toPathOptions(valueCells, options, fieldNames) {
|
|
var stringMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
var currentList = options;
|
|
var valueOptions = [];
|
|
var _loop = function _loop() {
|
|
var _currentList, _currentList2, _foundOption$fieldNam;
|
|
var valueCell = valueCells[i];
|
|
var foundIndex = (_currentList = currentList) === null || _currentList === void 0 ? void 0 : _currentList.findIndex(function (option) {
|
|
var val = option[fieldNames.value];
|
|
return stringMode ? String(val) === String(valueCell) : val === valueCell;
|
|
});
|
|
var foundOption = foundIndex !== -1 ? (_currentList2 = currentList) === null || _currentList2 === void 0 ? void 0 : _currentList2[foundIndex] : null;
|
|
valueOptions.push({
|
|
value: (_foundOption$fieldNam = foundOption === null || foundOption === void 0 ? void 0 : foundOption[fieldNames.value]) !== null && _foundOption$fieldNam !== void 0 ? _foundOption$fieldNam : valueCell,
|
|
index: foundIndex,
|
|
option: foundOption
|
|
});
|
|
currentList = foundOption === null || foundOption === void 0 ? void 0 : foundOption[fieldNames.children];
|
|
};
|
|
for (var i = 0; i < valueCells.length; i += 1) {
|
|
_loop();
|
|
}
|
|
return valueOptions;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/hooks/useDisplayValues.js
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var useDisplayValues = (function (rawValues, options, fieldNames, multiple, displayRender) {
|
|
return _react_17_0_2_react.useMemo(function () {
|
|
var mergedDisplayRender = displayRender ||
|
|
// Default displayRender
|
|
function (labels) {
|
|
var mergedLabels = multiple ? labels.slice(-1) : labels;
|
|
var SPLIT = ' / ';
|
|
if (mergedLabels.every(function (label) {
|
|
return ['string', 'number'].includes((0,esm_typeof/* default */.Z)(label));
|
|
})) {
|
|
return mergedLabels.join(SPLIT);
|
|
}
|
|
|
|
// If exist non-string value, use ReactNode instead
|
|
return mergedLabels.reduce(function (list, label, index) {
|
|
var keyedLabel = /*#__PURE__*/_react_17_0_2_react.isValidElement(label) ? /*#__PURE__*/_react_17_0_2_react.cloneElement(label, {
|
|
key: index
|
|
}) : label;
|
|
if (index === 0) {
|
|
return [keyedLabel];
|
|
}
|
|
return [].concat((0,toConsumableArray/* default */.Z)(list), [SPLIT, keyedLabel]);
|
|
}, []);
|
|
};
|
|
return rawValues.map(function (valueCells) {
|
|
var _valueOptions, _valueOptions$option;
|
|
var valueOptions = toPathOptions(valueCells, options, fieldNames);
|
|
var label = mergedDisplayRender(valueOptions.map(function (_ref) {
|
|
var _option$fieldNames$la;
|
|
var option = _ref.option,
|
|
value = _ref.value;
|
|
return (_option$fieldNames$la = option === null || option === void 0 ? void 0 : option[fieldNames.label]) !== null && _option$fieldNames$la !== void 0 ? _option$fieldNames$la : value;
|
|
}), valueOptions.map(function (_ref2) {
|
|
var option = _ref2.option;
|
|
return option;
|
|
}));
|
|
var value = toPathKey(valueCells);
|
|
return {
|
|
label: label,
|
|
value: value,
|
|
key: value,
|
|
valueCells: valueCells,
|
|
disabled: (_valueOptions = valueOptions[valueOptions.length - 1]) === null || _valueOptions === void 0 ? void 0 : (_valueOptions$option = _valueOptions.option) === null || _valueOptions$option === void 0 ? void 0 : _valueOptions$option.disabled
|
|
};
|
|
});
|
|
}, [rawValues, options, fieldNames, displayRender, multiple]);
|
|
});
|
|
// EXTERNAL MODULE: ./node_modules/_rc-tree@5.7.12@rc-tree/es/utils/treeUtil.js
|
|
var treeUtil = __webpack_require__(71430);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/hooks/useEntities.js
|
|
|
|
|
|
|
|
|
|
/** Lazy parse options data into conduct-able info to avoid perf issue in single mode */
|
|
/* harmony default export */ var useEntities = (function (options, fieldNames) {
|
|
var cacheRef = _react_17_0_2_react.useRef({
|
|
options: null,
|
|
info: null
|
|
});
|
|
var getEntities = _react_17_0_2_react.useCallback(function () {
|
|
if (cacheRef.current.options !== options) {
|
|
cacheRef.current.options = options;
|
|
cacheRef.current.info = (0,treeUtil/* convertDataToEntities */.I8)(options, {
|
|
fieldNames: fieldNames,
|
|
initWrapper: function initWrapper(wrapper) {
|
|
return (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, wrapper), {}, {
|
|
pathKeyEntities: {}
|
|
});
|
|
},
|
|
processEntity: function processEntity(entity, wrapper) {
|
|
var pathKey = entity.nodes.map(function (node) {
|
|
return node[fieldNames.value];
|
|
}).join(VALUE_SPLIT);
|
|
wrapper.pathKeyEntities[pathKey] = entity;
|
|
|
|
// Overwrite origin key.
|
|
// this is very hack but we need let conduct logic work with connect path
|
|
entity.key = pathKey;
|
|
}
|
|
});
|
|
}
|
|
return cacheRef.current.info.pathKeyEntities;
|
|
}, [fieldNames, options]);
|
|
return getEntities;
|
|
});
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/hooks/useMissingValues.js
|
|
|
|
|
|
/* harmony default export */ var useMissingValues = (function (options, fieldNames) {
|
|
return _react_17_0_2_react.useCallback(function (rawValues) {
|
|
var missingValues = [];
|
|
var existsValues = [];
|
|
rawValues.forEach(function (valueCell) {
|
|
var pathOptions = toPathOptions(valueCell, options, fieldNames);
|
|
if (pathOptions.every(function (opt) {
|
|
return opt.option;
|
|
})) {
|
|
existsValues.push(valueCell);
|
|
} else {
|
|
missingValues.push(valueCell);
|
|
}
|
|
});
|
|
return [existsValues, missingValues];
|
|
}, [options, fieldNames]);
|
|
});
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/warning.js
|
|
var es_warning = __webpack_require__(48736);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/hooks/useSearchConfig.js
|
|
|
|
|
|
|
|
|
|
// Convert `showSearch` to unique config
|
|
function useSearchConfig(showSearch) {
|
|
return _react_17_0_2_react.useMemo(function () {
|
|
if (!showSearch) {
|
|
return [false, {}];
|
|
}
|
|
var searchConfig = {
|
|
matchInputWidth: true,
|
|
limit: 50
|
|
};
|
|
if (showSearch && (0,esm_typeof/* default */.Z)(showSearch) === 'object') {
|
|
searchConfig = (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, searchConfig), showSearch);
|
|
}
|
|
if (searchConfig.limit <= 0) {
|
|
delete searchConfig.limit;
|
|
if (false) {}
|
|
}
|
|
return [true, searchConfig];
|
|
}, [showSearch]);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/OptionList/CacheContent.js
|
|
|
|
var CacheContent = /*#__PURE__*/_react_17_0_2_react.memo(function (_ref) {
|
|
var children = _ref.children;
|
|
return children;
|
|
}, function (_, next) {
|
|
return !next.open;
|
|
});
|
|
if (false) {}
|
|
/* harmony default export */ var OptionList_CacheContent = (CacheContent);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/OptionList/Checkbox.js
|
|
|
|
|
|
|
|
|
|
function Checkbox(_ref) {
|
|
var _classNames;
|
|
var prefixCls = _ref.prefixCls,
|
|
checked = _ref.checked,
|
|
halfChecked = _ref.halfChecked,
|
|
disabled = _ref.disabled,
|
|
onClick = _ref.onClick,
|
|
disableCheckbox = _ref.disableCheckbox;
|
|
var _React$useContext = _react_17_0_2_react.useContext(context),
|
|
checkable = _React$useContext.checkable;
|
|
var customCheckbox = typeof checkable !== 'boolean' ? checkable : null;
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
className: _classnames_2_5_1_classnames_default()("".concat(prefixCls), (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-checked"), checked), (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-indeterminate"), !checked && halfChecked), (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-disabled"), disabled || disableCheckbox), _classNames)),
|
|
onClick: onClick
|
|
}, customCheckbox);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/OptionList/Column.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var FIX_LABEL = '__cascader_fix_label__';
|
|
function Column(_ref) {
|
|
var prefixCls = _ref.prefixCls,
|
|
multiple = _ref.multiple,
|
|
options = _ref.options,
|
|
activeValue = _ref.activeValue,
|
|
prevValuePath = _ref.prevValuePath,
|
|
onToggleOpen = _ref.onToggleOpen,
|
|
onSelect = _ref.onSelect,
|
|
onActive = _ref.onActive,
|
|
checkedSet = _ref.checkedSet,
|
|
halfCheckedSet = _ref.halfCheckedSet,
|
|
loadingKeys = _ref.loadingKeys,
|
|
isSelectable = _ref.isSelectable,
|
|
searchValue = _ref.searchValue;
|
|
var menuPrefixCls = "".concat(prefixCls, "-menu");
|
|
var menuItemPrefixCls = "".concat(prefixCls, "-menu-item");
|
|
var _React$useContext = _react_17_0_2_react.useContext(context),
|
|
fieldNames = _React$useContext.fieldNames,
|
|
changeOnSelect = _React$useContext.changeOnSelect,
|
|
expandTrigger = _React$useContext.expandTrigger,
|
|
expandIcon = _React$useContext.expandIcon,
|
|
loadingIcon = _React$useContext.loadingIcon,
|
|
dropdownMenuColumnStyle = _React$useContext.dropdownMenuColumnStyle;
|
|
var hoverOpen = expandTrigger === 'hover';
|
|
|
|
// ============================ Option ============================
|
|
var optionInfoList = _react_17_0_2_react.useMemo(function () {
|
|
return options.map(function (option) {
|
|
var _option$FIX_LABEL;
|
|
var disabled = option.disabled,
|
|
disableCheckbox = option.disableCheckbox;
|
|
var searchOptions = option[SEARCH_MARK];
|
|
var label = (_option$FIX_LABEL = option[FIX_LABEL]) !== null && _option$FIX_LABEL !== void 0 ? _option$FIX_LABEL : option[fieldNames.label];
|
|
var value = option[fieldNames.value];
|
|
var isMergedLeaf = isLeaf(option, fieldNames);
|
|
|
|
// Get real value of option. Search option is different way.
|
|
var fullPath = searchOptions ? searchOptions.map(function (opt) {
|
|
return opt[fieldNames.value];
|
|
}) : [].concat((0,toConsumableArray/* default */.Z)(prevValuePath), [value]);
|
|
var fullPathKey = toPathKey(fullPath);
|
|
var isLoading = loadingKeys.includes(fullPathKey);
|
|
|
|
// >>>>> checked
|
|
var checked = checkedSet.has(fullPathKey);
|
|
|
|
// >>>>> halfChecked
|
|
var halfChecked = halfCheckedSet.has(fullPathKey);
|
|
return {
|
|
disabled: disabled,
|
|
label: label,
|
|
value: value,
|
|
isLeaf: isMergedLeaf,
|
|
isLoading: isLoading,
|
|
checked: checked,
|
|
halfChecked: halfChecked,
|
|
option: option,
|
|
disableCheckbox: disableCheckbox,
|
|
fullPath: fullPath,
|
|
fullPathKey: fullPathKey
|
|
};
|
|
});
|
|
}, [options, checkedSet, fieldNames, halfCheckedSet, loadingKeys, prevValuePath]);
|
|
|
|
// ============================ Render ============================
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("ul", {
|
|
className: menuPrefixCls,
|
|
role: "menu"
|
|
}, optionInfoList.map(function (_ref2) {
|
|
var _classNames;
|
|
var disabled = _ref2.disabled,
|
|
label = _ref2.label,
|
|
value = _ref2.value,
|
|
isMergedLeaf = _ref2.isLeaf,
|
|
isLoading = _ref2.isLoading,
|
|
checked = _ref2.checked,
|
|
halfChecked = _ref2.halfChecked,
|
|
option = _ref2.option,
|
|
fullPath = _ref2.fullPath,
|
|
fullPathKey = _ref2.fullPathKey,
|
|
disableCheckbox = _ref2.disableCheckbox;
|
|
// >>>>> Open
|
|
var triggerOpenPath = function triggerOpenPath() {
|
|
if (disabled || searchValue) {
|
|
return;
|
|
}
|
|
var nextValueCells = (0,toConsumableArray/* default */.Z)(fullPath);
|
|
if (hoverOpen && isMergedLeaf) {
|
|
nextValueCells.pop();
|
|
}
|
|
onActive(nextValueCells);
|
|
};
|
|
|
|
// >>>>> Selection
|
|
var triggerSelect = function triggerSelect() {
|
|
if (isSelectable(option)) {
|
|
onSelect(fullPath, isMergedLeaf);
|
|
}
|
|
};
|
|
|
|
// >>>>> Title
|
|
var title;
|
|
if (typeof option.title === 'string') {
|
|
title = option.title;
|
|
} else if (typeof label === 'string') {
|
|
title = label;
|
|
}
|
|
|
|
// >>>>> Render
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("li", {
|
|
key: fullPathKey,
|
|
className: _classnames_2_5_1_classnames_default()(menuItemPrefixCls, (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(menuItemPrefixCls, "-expand"), !isMergedLeaf), (0,defineProperty/* default */.Z)(_classNames, "".concat(menuItemPrefixCls, "-active"), activeValue === value || activeValue === fullPathKey), (0,defineProperty/* default */.Z)(_classNames, "".concat(menuItemPrefixCls, "-disabled"), disabled), (0,defineProperty/* default */.Z)(_classNames, "".concat(menuItemPrefixCls, "-loading"), isLoading), _classNames)),
|
|
style: dropdownMenuColumnStyle,
|
|
role: "menuitemcheckbox",
|
|
title: title,
|
|
"aria-checked": checked,
|
|
"data-path-key": fullPathKey,
|
|
onClick: function onClick() {
|
|
triggerOpenPath();
|
|
if (disableCheckbox) {
|
|
return;
|
|
}
|
|
if (!multiple || isMergedLeaf) {
|
|
triggerSelect();
|
|
}
|
|
},
|
|
onDoubleClick: function onDoubleClick() {
|
|
if (changeOnSelect) {
|
|
onToggleOpen(false);
|
|
}
|
|
},
|
|
onMouseEnter: function onMouseEnter() {
|
|
if (hoverOpen) {
|
|
triggerOpenPath();
|
|
}
|
|
},
|
|
onMouseDown: function onMouseDown(e) {
|
|
// Prevent selector from blurring
|
|
e.preventDefault();
|
|
}
|
|
}, multiple && /*#__PURE__*/_react_17_0_2_react.createElement(Checkbox, {
|
|
prefixCls: "".concat(prefixCls, "-checkbox"),
|
|
checked: checked,
|
|
halfChecked: halfChecked,
|
|
disabled: disabled || disableCheckbox,
|
|
disableCheckbox: disableCheckbox,
|
|
onClick: function onClick(e) {
|
|
if (disableCheckbox) {
|
|
return;
|
|
}
|
|
e.stopPropagation();
|
|
triggerSelect();
|
|
}
|
|
}), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(menuItemPrefixCls, "-content")
|
|
}, label), !isLoading && expandIcon && !isMergedLeaf && /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(menuItemPrefixCls, "-expand-icon")
|
|
}, expandIcon), isLoading && loadingIcon && /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(menuItemPrefixCls, "-loading-icon")
|
|
}, loadingIcon));
|
|
}));
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/OptionList/useActive.js
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Control the active open options path.
|
|
*/
|
|
/* harmony default export */ var useActive = (function () {
|
|
var _useBaseProps = (0,es/* useBaseProps */.lk)(),
|
|
multiple = _useBaseProps.multiple,
|
|
open = _useBaseProps.open;
|
|
var _React$useContext = _react_17_0_2_react.useContext(context),
|
|
values = _React$useContext.values;
|
|
|
|
// Record current dropdown active options
|
|
// This also control the open status
|
|
var _React$useState = _react_17_0_2_react.useState([]),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
activeValueCells = _React$useState2[0],
|
|
setActiveValueCells = _React$useState2[1];
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (open && !multiple) {
|
|
var firstValueCells = values[0];
|
|
setActiveValueCells(firstValueCells || []);
|
|
}
|
|
}, /* eslint-disable react-hooks/exhaustive-deps */
|
|
[open]
|
|
/* eslint-enable react-hooks/exhaustive-deps */);
|
|
|
|
return [activeValueCells, setActiveValueCells];
|
|
});
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/KeyCode.js
|
|
var KeyCode = __webpack_require__(10228);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/OptionList/useKeyboard.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var useKeyboard = (function (ref, options, fieldNames, activeValueCells, setActiveValueCells, onKeyBoardSelect) {
|
|
var _useBaseProps = (0,es/* useBaseProps */.lk)(),
|
|
direction = _useBaseProps.direction,
|
|
searchValue = _useBaseProps.searchValue,
|
|
toggleOpen = _useBaseProps.toggleOpen,
|
|
open = _useBaseProps.open;
|
|
var rtl = direction === 'rtl';
|
|
var _React$useMemo = _react_17_0_2_react.useMemo(function () {
|
|
var activeIndex = -1;
|
|
var currentOptions = options;
|
|
var mergedActiveIndexes = [];
|
|
var mergedActiveValueCells = [];
|
|
var len = activeValueCells.length;
|
|
var pathKeys = getFullPathKeys(options, fieldNames);
|
|
|
|
// Fill validate active value cells and index
|
|
var _loop = function _loop(i) {
|
|
// Mark the active index for current options
|
|
var nextActiveIndex = currentOptions.findIndex(function (option, index) {
|
|
return (pathKeys[index] ? toPathKey(pathKeys[index]) : option[fieldNames.value]) === activeValueCells[i];
|
|
});
|
|
if (nextActiveIndex === -1) {
|
|
return "break";
|
|
}
|
|
activeIndex = nextActiveIndex;
|
|
mergedActiveIndexes.push(activeIndex);
|
|
mergedActiveValueCells.push(activeValueCells[i]);
|
|
currentOptions = currentOptions[activeIndex][fieldNames.children];
|
|
};
|
|
for (var i = 0; i < len && currentOptions; i += 1) {
|
|
var _ret = _loop(i);
|
|
if (_ret === "break") break;
|
|
}
|
|
|
|
// Fill last active options
|
|
var activeOptions = options;
|
|
for (var _i = 0; _i < mergedActiveIndexes.length - 1; _i += 1) {
|
|
activeOptions = activeOptions[mergedActiveIndexes[_i]][fieldNames.children];
|
|
}
|
|
return [mergedActiveValueCells, activeIndex, activeOptions, pathKeys];
|
|
}, [activeValueCells, fieldNames, options]),
|
|
_React$useMemo2 = (0,slicedToArray/* default */.Z)(_React$useMemo, 4),
|
|
validActiveValueCells = _React$useMemo2[0],
|
|
lastActiveIndex = _React$useMemo2[1],
|
|
lastActiveOptions = _React$useMemo2[2],
|
|
fullPathKeys = _React$useMemo2[3];
|
|
|
|
// Update active value cells and scroll to target element
|
|
var internalSetActiveValueCells = function internalSetActiveValueCells(next) {
|
|
setActiveValueCells(next);
|
|
};
|
|
|
|
// Same options offset
|
|
var offsetActiveOption = function offsetActiveOption(offset) {
|
|
var len = lastActiveOptions.length;
|
|
var currentIndex = lastActiveIndex;
|
|
if (currentIndex === -1 && offset < 0) {
|
|
currentIndex = len;
|
|
}
|
|
for (var i = 0; i < len; i += 1) {
|
|
currentIndex = (currentIndex + offset + len) % len;
|
|
var _option = lastActiveOptions[currentIndex];
|
|
if (_option && !_option.disabled) {
|
|
var nextActiveCells = validActiveValueCells.slice(0, -1).concat(fullPathKeys[currentIndex] ? toPathKey(fullPathKeys[currentIndex]) : _option[fieldNames.value]);
|
|
internalSetActiveValueCells(nextActiveCells);
|
|
return;
|
|
}
|
|
}
|
|
};
|
|
|
|
// Different options offset
|
|
var prevColumn = function prevColumn() {
|
|
if (validActiveValueCells.length > 1) {
|
|
var nextActiveCells = validActiveValueCells.slice(0, -1);
|
|
internalSetActiveValueCells(nextActiveCells);
|
|
} else {
|
|
toggleOpen(false);
|
|
}
|
|
};
|
|
var nextColumn = function nextColumn() {
|
|
var _lastActiveOptions$la;
|
|
var nextOptions = ((_lastActiveOptions$la = lastActiveOptions[lastActiveIndex]) === null || _lastActiveOptions$la === void 0 ? void 0 : _lastActiveOptions$la[fieldNames.children]) || [];
|
|
var nextOption = nextOptions.find(function (option) {
|
|
return !option.disabled;
|
|
});
|
|
if (nextOption) {
|
|
var nextActiveCells = [].concat((0,toConsumableArray/* default */.Z)(validActiveValueCells), [nextOption[fieldNames.value]]);
|
|
internalSetActiveValueCells(nextActiveCells);
|
|
}
|
|
};
|
|
_react_17_0_2_react.useImperativeHandle(ref, function () {
|
|
return {
|
|
// scrollTo: treeRef.current?.scrollTo,
|
|
onKeyDown: function onKeyDown(event) {
|
|
var which = event.which;
|
|
switch (which) {
|
|
// >>> Arrow keys
|
|
case KeyCode/* default */.Z.UP:
|
|
case KeyCode/* default */.Z.DOWN:
|
|
{
|
|
var offset = 0;
|
|
if (which === KeyCode/* default */.Z.UP) {
|
|
offset = -1;
|
|
} else if (which === KeyCode/* default */.Z.DOWN) {
|
|
offset = 1;
|
|
}
|
|
if (offset !== 0) {
|
|
offsetActiveOption(offset);
|
|
}
|
|
break;
|
|
}
|
|
case KeyCode/* default */.Z.LEFT:
|
|
{
|
|
if (searchValue) {
|
|
break;
|
|
}
|
|
if (rtl) {
|
|
nextColumn();
|
|
} else {
|
|
prevColumn();
|
|
}
|
|
break;
|
|
}
|
|
case KeyCode/* default */.Z.RIGHT:
|
|
{
|
|
if (searchValue) {
|
|
break;
|
|
}
|
|
if (rtl) {
|
|
prevColumn();
|
|
} else {
|
|
nextColumn();
|
|
}
|
|
break;
|
|
}
|
|
case KeyCode/* default */.Z.BACKSPACE:
|
|
{
|
|
if (!searchValue) {
|
|
prevColumn();
|
|
}
|
|
break;
|
|
}
|
|
|
|
// >>> Select
|
|
case KeyCode/* default */.Z.ENTER:
|
|
{
|
|
if (validActiveValueCells.length) {
|
|
var _option2 = lastActiveOptions[lastActiveIndex];
|
|
|
|
// Search option should revert back of origin options
|
|
var originOptions = (_option2 === null || _option2 === void 0 ? void 0 : _option2[SEARCH_MARK]) || [];
|
|
if (originOptions.length) {
|
|
onKeyBoardSelect(originOptions.map(function (opt) {
|
|
return opt[fieldNames.value];
|
|
}), originOptions[originOptions.length - 1]);
|
|
} else {
|
|
onKeyBoardSelect(validActiveValueCells, lastActiveOptions[lastActiveIndex]);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
// >>> Close
|
|
case KeyCode/* default */.Z.ESC:
|
|
{
|
|
toggleOpen(false);
|
|
if (open) {
|
|
event.stopPropagation();
|
|
}
|
|
}
|
|
}
|
|
},
|
|
onKeyUp: function onKeyUp() {}
|
|
};
|
|
});
|
|
});
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/OptionList/index.js
|
|
|
|
|
|
|
|
|
|
|
|
/* eslint-disable default-case */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RefOptionList = /*#__PURE__*/_react_17_0_2_react.forwardRef(function (props, ref) {
|
|
var _optionColumns$, _optionColumns$$optio, _ref3, _classNames;
|
|
var _useBaseProps = (0,es/* useBaseProps */.lk)(),
|
|
prefixCls = _useBaseProps.prefixCls,
|
|
multiple = _useBaseProps.multiple,
|
|
searchValue = _useBaseProps.searchValue,
|
|
toggleOpen = _useBaseProps.toggleOpen,
|
|
notFoundContent = _useBaseProps.notFoundContent,
|
|
direction = _useBaseProps.direction,
|
|
open = _useBaseProps.open;
|
|
var containerRef = _react_17_0_2_react.useRef();
|
|
var rtl = direction === 'rtl';
|
|
var _React$useContext = _react_17_0_2_react.useContext(context),
|
|
options = _React$useContext.options,
|
|
values = _React$useContext.values,
|
|
halfValues = _React$useContext.halfValues,
|
|
fieldNames = _React$useContext.fieldNames,
|
|
changeOnSelect = _React$useContext.changeOnSelect,
|
|
onSelect = _React$useContext.onSelect,
|
|
searchOptions = _React$useContext.searchOptions,
|
|
dropdownPrefixCls = _React$useContext.dropdownPrefixCls,
|
|
loadData = _React$useContext.loadData,
|
|
expandTrigger = _React$useContext.expandTrigger;
|
|
var mergedPrefixCls = dropdownPrefixCls || prefixCls;
|
|
|
|
// ========================= loadData =========================
|
|
var _React$useState = _react_17_0_2_react.useState([]),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
loadingKeys = _React$useState2[0],
|
|
setLoadingKeys = _React$useState2[1];
|
|
var internalLoadData = function internalLoadData(valueCells) {
|
|
// Do not load when search
|
|
if (!loadData || searchValue) {
|
|
return;
|
|
}
|
|
var optionList = toPathOptions(valueCells, options, fieldNames);
|
|
var rawOptions = optionList.map(function (_ref) {
|
|
var option = _ref.option;
|
|
return option;
|
|
});
|
|
var lastOption = rawOptions[rawOptions.length - 1];
|
|
if (lastOption && !isLeaf(lastOption, fieldNames)) {
|
|
var pathKey = toPathKey(valueCells);
|
|
setLoadingKeys(function (keys) {
|
|
return [].concat((0,toConsumableArray/* default */.Z)(keys), [pathKey]);
|
|
});
|
|
loadData(rawOptions);
|
|
}
|
|
};
|
|
|
|
// zombieJ: This is bad. We should make this same as `rc-tree` to use Promise instead.
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (loadingKeys.length) {
|
|
loadingKeys.forEach(function (loadingKey) {
|
|
var valueStrCells = toPathValueStr(loadingKey);
|
|
var optionList = toPathOptions(valueStrCells, options, fieldNames, true).map(function (_ref2) {
|
|
var option = _ref2.option;
|
|
return option;
|
|
});
|
|
var lastOption = optionList[optionList.length - 1];
|
|
if (!lastOption || lastOption[fieldNames.children] || isLeaf(lastOption, fieldNames)) {
|
|
setLoadingKeys(function (keys) {
|
|
return keys.filter(function (key) {
|
|
return key !== loadingKey;
|
|
});
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}, [options, loadingKeys, fieldNames]);
|
|
|
|
// ========================== Values ==========================
|
|
var checkedSet = _react_17_0_2_react.useMemo(function () {
|
|
return new Set(toPathKeys(values));
|
|
}, [values]);
|
|
var halfCheckedSet = _react_17_0_2_react.useMemo(function () {
|
|
return new Set(toPathKeys(halfValues));
|
|
}, [halfValues]);
|
|
|
|
// ====================== Accessibility =======================
|
|
var _useActive = useActive(),
|
|
_useActive2 = (0,slicedToArray/* default */.Z)(_useActive, 2),
|
|
activeValueCells = _useActive2[0],
|
|
setActiveValueCells = _useActive2[1];
|
|
|
|
// =========================== Path ===========================
|
|
var onPathOpen = function onPathOpen(nextValueCells) {
|
|
setActiveValueCells(nextValueCells);
|
|
|
|
// Trigger loadData
|
|
internalLoadData(nextValueCells);
|
|
};
|
|
var isSelectable = function isSelectable(option) {
|
|
var disabled = option.disabled;
|
|
var isMergedLeaf = isLeaf(option, fieldNames);
|
|
return !disabled && (isMergedLeaf || changeOnSelect || multiple);
|
|
};
|
|
var onPathSelect = function onPathSelect(valuePath, leaf) {
|
|
var fromKeyboard = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
onSelect(valuePath);
|
|
if (!multiple && (leaf || changeOnSelect && (expandTrigger === 'hover' || fromKeyboard))) {
|
|
toggleOpen(false);
|
|
}
|
|
};
|
|
|
|
// ========================== Option ==========================
|
|
var mergedOptions = _react_17_0_2_react.useMemo(function () {
|
|
if (searchValue) {
|
|
return searchOptions;
|
|
}
|
|
return options;
|
|
}, [searchValue, searchOptions, options]);
|
|
|
|
// ========================== Column ==========================
|
|
var optionColumns = _react_17_0_2_react.useMemo(function () {
|
|
var optionList = [{
|
|
options: mergedOptions
|
|
}];
|
|
var currentList = mergedOptions;
|
|
var fullPathKeys = getFullPathKeys(currentList, fieldNames);
|
|
var _loop = function _loop() {
|
|
var activeValueCell = activeValueCells[i];
|
|
var currentOption = currentList.find(function (option, index) {
|
|
return (fullPathKeys[index] ? toPathKey(fullPathKeys[index]) : option[fieldNames.value]) === activeValueCell;
|
|
});
|
|
var subOptions = currentOption === null || currentOption === void 0 ? void 0 : currentOption[fieldNames.children];
|
|
if (!(subOptions !== null && subOptions !== void 0 && subOptions.length)) {
|
|
return "break";
|
|
}
|
|
currentList = subOptions;
|
|
optionList.push({
|
|
options: subOptions
|
|
});
|
|
};
|
|
for (var i = 0; i < activeValueCells.length; i += 1) {
|
|
var _ret = _loop();
|
|
if (_ret === "break") break;
|
|
}
|
|
return optionList;
|
|
}, [mergedOptions, activeValueCells, fieldNames]);
|
|
|
|
// ========================= Keyboard =========================
|
|
var onKeyboardSelect = function onKeyboardSelect(selectValueCells, option) {
|
|
if (isSelectable(option)) {
|
|
onPathSelect(selectValueCells, isLeaf(option, fieldNames), true);
|
|
}
|
|
};
|
|
useKeyboard(ref, mergedOptions, fieldNames, activeValueCells, onPathOpen, onKeyboardSelect);
|
|
|
|
// >>>>> Active Scroll
|
|
_react_17_0_2_react.useEffect(function () {
|
|
for (var i = 0; i < activeValueCells.length; i += 1) {
|
|
var _containerRef$current;
|
|
var cellPath = activeValueCells.slice(0, i + 1);
|
|
var cellKeyPath = toPathKey(cellPath);
|
|
var ele = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector("li[data-path-key=\"".concat(cellKeyPath.replace(/\\{0,2}"/g, '\\"'), "\"]") // matches unescaped double quotes
|
|
);
|
|
if (ele) {
|
|
scrollIntoParentView(ele);
|
|
}
|
|
}
|
|
}, [activeValueCells]);
|
|
|
|
// ========================== Render ==========================
|
|
// >>>>> Empty
|
|
var isEmpty = !((_optionColumns$ = optionColumns[0]) !== null && _optionColumns$ !== void 0 && (_optionColumns$$optio = _optionColumns$.options) !== null && _optionColumns$$optio !== void 0 && _optionColumns$$optio.length);
|
|
var emptyList = [(_ref3 = {}, (0,defineProperty/* default */.Z)(_ref3, fieldNames.value, '__EMPTY__'), (0,defineProperty/* default */.Z)(_ref3, FIX_LABEL, notFoundContent), (0,defineProperty/* default */.Z)(_ref3, "disabled", true), _ref3)];
|
|
var columnProps = (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, props), {}, {
|
|
multiple: !isEmpty && multiple,
|
|
onSelect: onPathSelect,
|
|
onActive: onPathOpen,
|
|
onToggleOpen: toggleOpen,
|
|
checkedSet: checkedSet,
|
|
halfCheckedSet: halfCheckedSet,
|
|
loadingKeys: loadingKeys,
|
|
isSelectable: isSelectable
|
|
});
|
|
|
|
// >>>>> Columns
|
|
var mergedOptionColumns = isEmpty ? [{
|
|
options: emptyList
|
|
}] : optionColumns;
|
|
var columnNodes = mergedOptionColumns.map(function (col, index) {
|
|
var prevValuePath = activeValueCells.slice(0, index);
|
|
var activeValue = activeValueCells[index];
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(Column, (0,esm_extends/* default */.Z)({
|
|
key: index
|
|
}, columnProps, {
|
|
searchValue: searchValue,
|
|
prefixCls: mergedPrefixCls,
|
|
options: col.options,
|
|
prevValuePath: prevValuePath,
|
|
activeValue: activeValue
|
|
}));
|
|
});
|
|
|
|
// >>>>> Render
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(OptionList_CacheContent, {
|
|
open: open
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: _classnames_2_5_1_classnames_default()("".concat(mergedPrefixCls, "-menus"), (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(mergedPrefixCls, "-menu-empty"), isEmpty), (0,defineProperty/* default */.Z)(_classNames, "".concat(mergedPrefixCls, "-rtl"), rtl), _classNames)),
|
|
ref: containerRef
|
|
}, columnNodes));
|
|
});
|
|
/* harmony default export */ var OptionList = (RefOptionList);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/utils/warningPropsUtil.js
|
|
|
|
function warningProps(props) {
|
|
var onPopupVisibleChange = props.onPopupVisibleChange,
|
|
popupVisible = props.popupVisible,
|
|
popupClassName = props.popupClassName,
|
|
popupPlacement = props.popupPlacement;
|
|
warning(!onPopupVisibleChange, '`onPopupVisibleChange` is deprecated. Please use `onDropdownVisibleChange` instead.');
|
|
warning(popupVisible === undefined, '`popupVisible` is deprecated. Please use `open` instead.');
|
|
warning(popupClassName === undefined, '`popupClassName` is deprecated. Please use `dropdownClassName` instead.');
|
|
warning(popupPlacement === undefined, '`popupPlacement` is deprecated. Please use `placement` instead.');
|
|
}
|
|
|
|
// value in Cascader options should not be null
|
|
function warningNullOptions(options, fieldNames) {
|
|
if (options) {
|
|
var recursiveOptions = function recursiveOptions(optionsList) {
|
|
for (var i = 0; i < optionsList.length; i++) {
|
|
var option = optionsList[i];
|
|
if (option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value] === null) {
|
|
warning(false, '`value` in Cascader options should not be `null`.');
|
|
return true;
|
|
}
|
|
if (Array.isArray(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]) && recursiveOptions(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children])) {
|
|
return true;
|
|
}
|
|
}
|
|
};
|
|
recursiveOptions(options);
|
|
}
|
|
}
|
|
/* harmony default export */ var warningPropsUtil = ((/* unused pure expression or super */ null && (warningProps)));
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/Cascader.js
|
|
|
|
|
|
|
|
|
|
var _excluded = ["id", "prefixCls", "fieldNames", "defaultValue", "value", "changeOnSelect", "onChange", "displayRender", "checkable", "autoClearSearchValue", "searchValue", "onSearch", "showSearch", "expandTrigger", "options", "dropdownPrefixCls", "loadData", "popupVisible", "open", "popupClassName", "dropdownClassName", "dropdownMenuColumnStyle", "popupPlacement", "placement", "onDropdownVisibleChange", "onPopupVisibleChange", "expandIcon", "loadingIcon", "children", "dropdownMatchSelectWidth", "showCheckedStrategy"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isMultipleValue(value) {
|
|
return Array.isArray(value) && Array.isArray(value[0]);
|
|
}
|
|
function toRawValues(value) {
|
|
if (!value) {
|
|
return [];
|
|
}
|
|
if (isMultipleValue(value)) {
|
|
return value;
|
|
}
|
|
return (value.length === 0 ? [] : [value]).map(function (val) {
|
|
return Array.isArray(val) ? val : [val];
|
|
});
|
|
}
|
|
var Cascader = /*#__PURE__*/_react_17_0_2_react.forwardRef(function (props, ref) {
|
|
var id = props.id,
|
|
_props$prefixCls = props.prefixCls,
|
|
prefixCls = _props$prefixCls === void 0 ? 'rc-cascader' : _props$prefixCls,
|
|
fieldNames = props.fieldNames,
|
|
defaultValue = props.defaultValue,
|
|
value = props.value,
|
|
changeOnSelect = props.changeOnSelect,
|
|
onChange = props.onChange,
|
|
displayRender = props.displayRender,
|
|
checkable = props.checkable,
|
|
_props$autoClearSearc = props.autoClearSearchValue,
|
|
autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,
|
|
searchValue = props.searchValue,
|
|
onSearch = props.onSearch,
|
|
showSearch = props.showSearch,
|
|
expandTrigger = props.expandTrigger,
|
|
options = props.options,
|
|
dropdownPrefixCls = props.dropdownPrefixCls,
|
|
loadData = props.loadData,
|
|
popupVisible = props.popupVisible,
|
|
open = props.open,
|
|
popupClassName = props.popupClassName,
|
|
dropdownClassName = props.dropdownClassName,
|
|
dropdownMenuColumnStyle = props.dropdownMenuColumnStyle,
|
|
popupPlacement = props.popupPlacement,
|
|
placement = props.placement,
|
|
onDropdownVisibleChange = props.onDropdownVisibleChange,
|
|
onPopupVisibleChange = props.onPopupVisibleChange,
|
|
_props$expandIcon = props.expandIcon,
|
|
expandIcon = _props$expandIcon === void 0 ? '>' : _props$expandIcon,
|
|
loadingIcon = props.loadingIcon,
|
|
children = props.children,
|
|
_props$dropdownMatchS = props.dropdownMatchSelectWidth,
|
|
dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? false : _props$dropdownMatchS,
|
|
_props$showCheckedStr = props.showCheckedStrategy,
|
|
showCheckedStrategy = _props$showCheckedStr === void 0 ? SHOW_PARENT : _props$showCheckedStr,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(props, _excluded);
|
|
var mergedId = (0,useId/* default */.ZP)(id);
|
|
var multiple = !!checkable;
|
|
|
|
// =========================== Values ===========================
|
|
var _useMergedState = (0,useMergedState/* default */.Z)(defaultValue, {
|
|
value: value,
|
|
postState: toRawValues
|
|
}),
|
|
_useMergedState2 = (0,slicedToArray/* default */.Z)(_useMergedState, 2),
|
|
rawValues = _useMergedState2[0],
|
|
setRawValues = _useMergedState2[1];
|
|
|
|
// ========================= FieldNames =========================
|
|
var mergedFieldNames = _react_17_0_2_react.useMemo(function () {
|
|
return fillFieldNames(fieldNames);
|
|
}, /* eslint-disable react-hooks/exhaustive-deps */
|
|
[JSON.stringify(fieldNames)]
|
|
/* eslint-enable react-hooks/exhaustive-deps */);
|
|
|
|
// =========================== Option ===========================
|
|
var mergedOptions = _react_17_0_2_react.useMemo(function () {
|
|
return options || [];
|
|
}, [options]);
|
|
|
|
// Only used in multiple mode, this fn will not call in single mode
|
|
var getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
|
|
|
|
/** Convert path key back to value format */
|
|
var getValueByKeyPath = _react_17_0_2_react.useCallback(function (pathKeys) {
|
|
var keyPathEntities = getPathKeyEntities();
|
|
return pathKeys.map(function (pathKey) {
|
|
var nodes = keyPathEntities[pathKey].nodes;
|
|
return nodes.map(function (node) {
|
|
return node[mergedFieldNames.value];
|
|
});
|
|
});
|
|
}, [getPathKeyEntities, mergedFieldNames]);
|
|
|
|
// =========================== Search ===========================
|
|
var _useMergedState3 = (0,useMergedState/* default */.Z)('', {
|
|
value: searchValue,
|
|
postState: function postState(search) {
|
|
return search || '';
|
|
}
|
|
}),
|
|
_useMergedState4 = (0,slicedToArray/* default */.Z)(_useMergedState3, 2),
|
|
mergedSearchValue = _useMergedState4[0],
|
|
setSearchValue = _useMergedState4[1];
|
|
var onInternalSearch = function onInternalSearch(searchText, info) {
|
|
setSearchValue(searchText);
|
|
if (info.source !== 'blur' && onSearch) {
|
|
onSearch(searchText);
|
|
}
|
|
};
|
|
var _useSearchConfig = useSearchConfig(showSearch),
|
|
_useSearchConfig2 = (0,slicedToArray/* default */.Z)(_useSearchConfig, 2),
|
|
mergedShowSearch = _useSearchConfig2[0],
|
|
searchConfig = _useSearchConfig2[1];
|
|
var searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, dropdownPrefixCls || prefixCls, searchConfig, changeOnSelect);
|
|
|
|
// =========================== Values ===========================
|
|
var getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
|
|
|
|
// Fill `rawValues` with checked conduction values
|
|
var _React$useMemo = _react_17_0_2_react.useMemo(function () {
|
|
var _getMissingValues = getMissingValues(rawValues),
|
|
_getMissingValues2 = (0,slicedToArray/* default */.Z)(_getMissingValues, 2),
|
|
existValues = _getMissingValues2[0],
|
|
missingValues = _getMissingValues2[1];
|
|
if (!multiple || !rawValues.length) {
|
|
return [existValues, [], missingValues];
|
|
}
|
|
var keyPathValues = toPathKeys(existValues);
|
|
var keyPathEntities = getPathKeyEntities();
|
|
var _conductCheck = (0,conductUtil/* conductCheck */.S)(keyPathValues, true, keyPathEntities),
|
|
checkedKeys = _conductCheck.checkedKeys,
|
|
halfCheckedKeys = _conductCheck.halfCheckedKeys;
|
|
|
|
// Convert key back to value cells
|
|
return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
|
|
}, [multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]),
|
|
_React$useMemo2 = (0,slicedToArray/* default */.Z)(_React$useMemo, 3),
|
|
checkedValues = _React$useMemo2[0],
|
|
halfCheckedValues = _React$useMemo2[1],
|
|
missingCheckedValues = _React$useMemo2[2];
|
|
var deDuplicatedValues = _react_17_0_2_react.useMemo(function () {
|
|
var checkedKeys = toPathKeys(checkedValues);
|
|
var deduplicateKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
return [].concat((0,toConsumableArray/* default */.Z)(missingCheckedValues), (0,toConsumableArray/* default */.Z)(getValueByKeyPath(deduplicateKeys)));
|
|
}, [checkedValues, getPathKeyEntities, getValueByKeyPath, missingCheckedValues, showCheckedStrategy]);
|
|
var displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, multiple, displayRender);
|
|
|
|
// =========================== Change ===========================
|
|
var triggerChange = (0,useEvent/* default */.Z)(function (nextValues) {
|
|
setRawValues(nextValues);
|
|
|
|
// Save perf if no need trigger event
|
|
if (onChange) {
|
|
var nextRawValues = toRawValues(nextValues);
|
|
var valueOptions = nextRawValues.map(function (valueCells) {
|
|
return toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(function (valueOpt) {
|
|
return valueOpt.option;
|
|
});
|
|
});
|
|
var triggerValues = multiple ? nextRawValues : nextRawValues[0];
|
|
var triggerOptions = multiple ? valueOptions : valueOptions[0];
|
|
onChange(triggerValues, triggerOptions);
|
|
}
|
|
});
|
|
|
|
// =========================== Select ===========================
|
|
var onInternalSelect = (0,useEvent/* default */.Z)(function (valuePath) {
|
|
if (!multiple || autoClearSearchValue) {
|
|
setSearchValue('');
|
|
}
|
|
if (!multiple) {
|
|
triggerChange(valuePath);
|
|
} else {
|
|
// Prepare conduct required info
|
|
var pathKey = toPathKey(valuePath);
|
|
var checkedPathKeys = toPathKeys(checkedValues);
|
|
var halfCheckedPathKeys = toPathKeys(halfCheckedValues);
|
|
var existInChecked = checkedPathKeys.includes(pathKey);
|
|
var existInMissing = missingCheckedValues.some(function (valueCells) {
|
|
return toPathKey(valueCells) === pathKey;
|
|
});
|
|
|
|
// Do update
|
|
var nextCheckedValues = checkedValues;
|
|
var nextMissingValues = missingCheckedValues;
|
|
if (existInMissing && !existInChecked) {
|
|
// Missing value only do filter
|
|
nextMissingValues = missingCheckedValues.filter(function (valueCells) {
|
|
return toPathKey(valueCells) !== pathKey;
|
|
});
|
|
} else {
|
|
// Update checked key first
|
|
var nextRawCheckedKeys = existInChecked ? checkedPathKeys.filter(function (key) {
|
|
return key !== pathKey;
|
|
}) : [].concat((0,toConsumableArray/* default */.Z)(checkedPathKeys), [pathKey]);
|
|
var pathKeyEntities = getPathKeyEntities();
|
|
|
|
// Conduction by selected or not
|
|
var checkedKeys;
|
|
if (existInChecked) {
|
|
var _conductCheck2 = (0,conductUtil/* conductCheck */.S)(nextRawCheckedKeys, {
|
|
checked: false,
|
|
halfCheckedKeys: halfCheckedPathKeys
|
|
}, pathKeyEntities);
|
|
checkedKeys = _conductCheck2.checkedKeys;
|
|
} else {
|
|
var _conductCheck3 = (0,conductUtil/* conductCheck */.S)(nextRawCheckedKeys, true, pathKeyEntities);
|
|
checkedKeys = _conductCheck3.checkedKeys;
|
|
}
|
|
|
|
// Roll up to parent level keys
|
|
var deDuplicatedKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
nextCheckedValues = getValueByKeyPath(deDuplicatedKeys);
|
|
}
|
|
triggerChange([].concat((0,toConsumableArray/* default */.Z)(nextMissingValues), (0,toConsumableArray/* default */.Z)(nextCheckedValues)));
|
|
}
|
|
});
|
|
|
|
// Display Value change logic
|
|
var onDisplayValuesChange = function onDisplayValuesChange(_, info) {
|
|
if (info.type === 'clear') {
|
|
triggerChange([]);
|
|
return;
|
|
}
|
|
|
|
// Cascader do not support `add` type. Only support `remove`
|
|
var _ref = info.values[0],
|
|
valueCells = _ref.valueCells;
|
|
onInternalSelect(valueCells);
|
|
};
|
|
|
|
// ============================ Open ============================
|
|
var mergedOpen = open !== undefined ? open : popupVisible;
|
|
var mergedDropdownClassName = dropdownClassName || popupClassName;
|
|
var mergedPlacement = placement || popupPlacement;
|
|
var onInternalDropdownVisibleChange = function onInternalDropdownVisibleChange(nextVisible) {
|
|
onDropdownVisibleChange === null || onDropdownVisibleChange === void 0 ? void 0 : onDropdownVisibleChange(nextVisible);
|
|
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextVisible);
|
|
};
|
|
|
|
// ========================== Warning ===========================
|
|
if (false) {}
|
|
|
|
// ========================== Context ===========================
|
|
var cascaderContext = _react_17_0_2_react.useMemo(function () {
|
|
return {
|
|
options: mergedOptions,
|
|
fieldNames: mergedFieldNames,
|
|
values: checkedValues,
|
|
halfValues: halfCheckedValues,
|
|
changeOnSelect: changeOnSelect,
|
|
onSelect: onInternalSelect,
|
|
checkable: checkable,
|
|
searchOptions: searchOptions,
|
|
dropdownPrefixCls: dropdownPrefixCls,
|
|
loadData: loadData,
|
|
expandTrigger: expandTrigger,
|
|
expandIcon: expandIcon,
|
|
loadingIcon: loadingIcon,
|
|
dropdownMenuColumnStyle: dropdownMenuColumnStyle
|
|
};
|
|
}, [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, dropdownPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, dropdownMenuColumnStyle]);
|
|
|
|
// ==============================================================
|
|
// == Render ==
|
|
// ==============================================================
|
|
var emptyOptions = !(mergedSearchValue ? searchOptions : mergedOptions).length;
|
|
var dropdownStyle =
|
|
// Search to match width
|
|
mergedSearchValue && searchConfig.matchInputWidth ||
|
|
// Empty keep the width
|
|
emptyOptions ? {} : {
|
|
minWidth: 'auto'
|
|
};
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(context.Provider, {
|
|
value: cascaderContext
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(es/* BaseSelect */.Ac, (0,esm_extends/* default */.Z)({}, restProps, {
|
|
// MISC
|
|
ref: ref,
|
|
id: mergedId,
|
|
prefixCls: prefixCls,
|
|
autoClearSearchValue: autoClearSearchValue,
|
|
dropdownMatchSelectWidth: dropdownMatchSelectWidth,
|
|
dropdownStyle: dropdownStyle
|
|
// Value
|
|
,
|
|
displayValues: displayValues,
|
|
onDisplayValuesChange: onDisplayValuesChange,
|
|
mode: multiple ? 'multiple' : undefined
|
|
// Search
|
|
,
|
|
searchValue: mergedSearchValue,
|
|
onSearch: onInternalSearch,
|
|
showSearch: mergedShowSearch
|
|
// Options
|
|
,
|
|
OptionList: OptionList,
|
|
emptyOptions: emptyOptions
|
|
// Open
|
|
,
|
|
open: mergedOpen,
|
|
dropdownClassName: mergedDropdownClassName,
|
|
placement: mergedPlacement,
|
|
onDropdownVisibleChange: onInternalDropdownVisibleChange
|
|
// Children
|
|
,
|
|
getRawInputElement: function getRawInputElement() {
|
|
return children;
|
|
}
|
|
})));
|
|
});
|
|
if (false) {}
|
|
Cascader.SHOW_PARENT = SHOW_PARENT;
|
|
Cascader.SHOW_CHILD = SHOW_CHILD;
|
|
/* harmony default export */ var es_Cascader = (Cascader);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-cascader@3.16.0@rc-cascader/es/index.js
|
|
|
|
/* harmony default export */ var _rc_cascader_3_16_0_rc_cascader_es = (es_Cascader);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/omit.js
|
|
var omit = __webpack_require__(2738);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/motion.js
|
|
var motion = __webpack_require__(62892);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/PurePanel.js
|
|
var PurePanel = __webpack_require__(53487);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/statusUtils.js
|
|
var statusUtils = __webpack_require__(19080);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
|
|
var config_provider_context = __webpack_require__(36355);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/defaultRenderEmpty.js
|
|
var defaultRenderEmpty = __webpack_require__(93891);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/DisabledContext.js
|
|
var DisabledContext = __webpack_require__(1684);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/hooks/useSize.js
|
|
var useSize = __webpack_require__(19716);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/context.js
|
|
var form_context = __webpack_require__(32441);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/style/index.js + 3 modules
|
|
var select_style = __webpack_require__(14154);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/useBuiltinPlacements.js
|
|
var useBuiltinPlacements = __webpack_require__(58582);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/useShowArrow.js
|
|
var useShowArrow = __webpack_require__(84443);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/utils/iconUtil.js
|
|
var iconUtil = __webpack_require__(66339);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/space/Compact.js
|
|
var Compact = __webpack_require__(33234);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/style/index.js
|
|
var style = __webpack_require__(98447);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/index.js
|
|
var es_style = __webpack_require__(17313);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/compact-item.js
|
|
var compact_item = __webpack_require__(74207);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
|
|
var genComponentStyleHook = __webpack_require__(83116);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/cascader/style/index.js
|
|
|
|
|
|
|
|
|
|
// =============================== Base ===============================
|
|
const genBaseStyle = token => {
|
|
const {
|
|
prefixCls,
|
|
componentCls,
|
|
antCls
|
|
} = token;
|
|
const cascaderMenuItemCls = `${componentCls}-menu-item`;
|
|
const iconCls = `
|
|
&${cascaderMenuItemCls}-expand ${cascaderMenuItemCls}-expand-icon,
|
|
${cascaderMenuItemCls}-loading-icon
|
|
`;
|
|
return [
|
|
// =====================================================
|
|
// == Control ==
|
|
// =====================================================
|
|
{
|
|
[componentCls]: {
|
|
width: token.controlWidth
|
|
}
|
|
},
|
|
// =====================================================
|
|
// == Popup ==
|
|
// =====================================================
|
|
{
|
|
[`${componentCls}-dropdown`]: [
|
|
// ==================== Checkbox ====================
|
|
(0,style/* getStyle */.C2)(`${prefixCls}-checkbox`, token), {
|
|
[`&${antCls}-select-dropdown`]: {
|
|
padding: 0
|
|
}
|
|
}, {
|
|
[componentCls]: {
|
|
// ================== Checkbox ==================
|
|
'&-checkbox': {
|
|
top: 0,
|
|
marginInlineEnd: token.paddingXS
|
|
},
|
|
// ==================== Menu ====================
|
|
// >>> Menus
|
|
'&-menus': {
|
|
display: 'flex',
|
|
flexWrap: 'nowrap',
|
|
alignItems: 'flex-start',
|
|
[`&${componentCls}-menu-empty`]: {
|
|
[`${componentCls}-menu`]: {
|
|
width: '100%',
|
|
height: 'auto',
|
|
[cascaderMenuItemCls]: {
|
|
color: token.colorTextDisabled
|
|
}
|
|
}
|
|
}
|
|
},
|
|
// >>> Menu
|
|
'&-menu': {
|
|
flexGrow: 1,
|
|
minWidth: token.controlItemWidth,
|
|
height: token.dropdownHeight,
|
|
margin: 0,
|
|
padding: token.menuPadding,
|
|
overflow: 'auto',
|
|
verticalAlign: 'top',
|
|
listStyle: 'none',
|
|
'-ms-overflow-style': '-ms-autohiding-scrollbar',
|
|
'&:not(:last-child)': {
|
|
borderInlineEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
|
|
},
|
|
'&-item': Object.assign(Object.assign({}, es_style/* textEllipsis */.vS), {
|
|
display: 'flex',
|
|
flexWrap: 'nowrap',
|
|
alignItems: 'center',
|
|
padding: token.optionPadding,
|
|
lineHeight: token.lineHeight,
|
|
cursor: 'pointer',
|
|
transition: `all ${token.motionDurationMid}`,
|
|
borderRadius: token.borderRadiusSM,
|
|
'&:hover': {
|
|
background: token.controlItemBgHover
|
|
},
|
|
'&-disabled': {
|
|
color: token.colorTextDisabled,
|
|
cursor: 'not-allowed',
|
|
'&:hover': {
|
|
background: 'transparent'
|
|
},
|
|
[iconCls]: {
|
|
color: token.colorTextDisabled
|
|
}
|
|
},
|
|
[`&-active:not(${cascaderMenuItemCls}-disabled)`]: {
|
|
[`&, &:hover`]: {
|
|
fontWeight: token.optionSelectedFontWeight,
|
|
backgroundColor: token.optionSelectedBg
|
|
}
|
|
},
|
|
'&-content': {
|
|
flex: 'auto'
|
|
},
|
|
[iconCls]: {
|
|
marginInlineStart: token.paddingXXS,
|
|
color: token.colorTextDescription,
|
|
fontSize: token.fontSizeIcon
|
|
},
|
|
'&-keyword': {
|
|
color: token.colorHighlight
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}]
|
|
},
|
|
// =====================================================
|
|
// == RTL ==
|
|
// =====================================================
|
|
{
|
|
[`${componentCls}-dropdown-rtl`]: {
|
|
direction: 'rtl'
|
|
}
|
|
},
|
|
// =====================================================
|
|
// == Space Compact ==
|
|
// =====================================================
|
|
(0,compact_item/* genCompactItemStyle */.c)(token)];
|
|
};
|
|
// ============================== Export ==============================
|
|
/* harmony default export */ var cascader_style = ((0,genComponentStyleHook/* default */.Z)('Cascader', token => [genBaseStyle(token)], token => {
|
|
const itemPaddingVertical = Math.round((token.controlHeight - token.fontSize * token.lineHeight) / 2);
|
|
return {
|
|
controlWidth: 184,
|
|
controlItemWidth: 111,
|
|
dropdownHeight: 180,
|
|
optionSelectedBg: token.controlItemBgActive,
|
|
optionSelectedFontWeight: token.fontWeightStrong,
|
|
optionPadding: `${itemPaddingVertical}px ${token.paddingSM}px`,
|
|
menuPadding: token.paddingXXS
|
|
};
|
|
}));
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/cascader/index.js
|
|
"use client";
|
|
|
|
|
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
SHOW_CHILD: cascader_SHOW_CHILD,
|
|
SHOW_PARENT: cascader_SHOW_PARENT
|
|
} = _rc_cascader_3_16_0_rc_cascader_es;
|
|
function highlightKeyword(str, lowerKeyword, prefixCls) {
|
|
const cells = str.toLowerCase().split(lowerKeyword).reduce((list, cur, index) => index === 0 ? [cur] : [].concat((0,toConsumableArray/* default */.Z)(list), [lowerKeyword, cur]), []);
|
|
const fillCells = [];
|
|
let start = 0;
|
|
cells.forEach((cell, index) => {
|
|
const end = start + cell.length;
|
|
let originWorld = str.slice(start, end);
|
|
start = end;
|
|
if (index % 2 === 1) {
|
|
originWorld =
|
|
/*#__PURE__*/
|
|
// eslint-disable-next-line react/no-array-index-key
|
|
_react_17_0_2_react.createElement("span", {
|
|
className: `${prefixCls}-menu-item-keyword`,
|
|
key: `separator-${index}`
|
|
}, originWorld);
|
|
}
|
|
fillCells.push(originWorld);
|
|
});
|
|
return fillCells;
|
|
}
|
|
const defaultSearchRender = (inputValue, path, prefixCls, fieldNames) => {
|
|
const optionList = [];
|
|
// We do lower here to save perf
|
|
const lower = inputValue.toLowerCase();
|
|
path.forEach((node, index) => {
|
|
if (index !== 0) {
|
|
optionList.push(' / ');
|
|
}
|
|
let label = node[fieldNames.label];
|
|
const type = typeof label;
|
|
if (type === 'string' || type === 'number') {
|
|
label = highlightKeyword(String(label), lower, prefixCls);
|
|
}
|
|
optionList.push(label);
|
|
});
|
|
return optionList;
|
|
};
|
|
const cascader_Cascader = /*#__PURE__*/_react_17_0_2_react.forwardRef((props, ref) => {
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
size: customizeSize,
|
|
disabled: customDisabled,
|
|
className,
|
|
rootClassName,
|
|
multiple,
|
|
bordered = true,
|
|
transitionName,
|
|
choiceTransitionName = '',
|
|
popupClassName,
|
|
dropdownClassName,
|
|
expandIcon,
|
|
placement,
|
|
showSearch,
|
|
allowClear = true,
|
|
notFoundContent,
|
|
direction,
|
|
getPopupContainer,
|
|
status: customStatus,
|
|
showArrow,
|
|
builtinPlacements,
|
|
style
|
|
} = props,
|
|
rest = __rest(props, ["prefixCls", "size", "disabled", "className", "rootClassName", "multiple", "bordered", "transitionName", "choiceTransitionName", "popupClassName", "dropdownClassName", "expandIcon", "placement", "showSearch", "allowClear", "notFoundContent", "direction", "getPopupContainer", "status", "showArrow", "builtinPlacements", "style"]);
|
|
const restProps = (0,omit/* default */.Z)(rest, ['suffixIcon']);
|
|
const {
|
|
getPopupContainer: getContextPopupContainer,
|
|
getPrefixCls,
|
|
renderEmpty,
|
|
direction: rootDirection,
|
|
popupOverflow,
|
|
cascader
|
|
} = _react_17_0_2_react.useContext(config_provider_context/* ConfigContext */.E_);
|
|
const mergedDirection = direction || rootDirection;
|
|
const isRtl = mergedDirection === 'rtl';
|
|
// =================== Form =====================
|
|
const {
|
|
status: contextStatus,
|
|
hasFeedback,
|
|
isFormItemInput,
|
|
feedbackIcon
|
|
} = _react_17_0_2_react.useContext(form_context/* FormItemInputContext */.aM);
|
|
const mergedStatus = (0,statusUtils/* getMergedStatus */.F)(contextStatus, customStatus);
|
|
// =================== Warning =====================
|
|
if (false) {}
|
|
// =================== No Found ====================
|
|
const mergedNotFoundContent = notFoundContent || (renderEmpty === null || renderEmpty === void 0 ? void 0 : renderEmpty('Cascader')) || /*#__PURE__*/_react_17_0_2_react.createElement(defaultRenderEmpty/* default */.Z, {
|
|
componentName: "Cascader"
|
|
});
|
|
// ==================== Prefix =====================
|
|
const rootPrefixCls = getPrefixCls();
|
|
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
const cascaderPrefixCls = getPrefixCls('cascader', customizePrefixCls);
|
|
const [wrapSelectSSR, hashId] = (0,select_style/* default */.Z)(prefixCls);
|
|
const [wrapCascaderSSR] = cascader_style(cascaderPrefixCls);
|
|
const {
|
|
compactSize,
|
|
compactItemClassnames
|
|
} = (0,Compact/* useCompactItemContext */.ri)(prefixCls, direction);
|
|
// =================== Dropdown ====================
|
|
const mergedDropdownClassName = _classnames_2_5_1_classnames_default()(popupClassName || dropdownClassName, `${cascaderPrefixCls}-dropdown`, {
|
|
[`${cascaderPrefixCls}-dropdown-rtl`]: mergedDirection === 'rtl'
|
|
}, rootClassName, hashId);
|
|
// ==================== Search =====================
|
|
const mergedShowSearch = _react_17_0_2_react.useMemo(() => {
|
|
if (!showSearch) {
|
|
return showSearch;
|
|
}
|
|
let searchConfig = {
|
|
render: defaultSearchRender
|
|
};
|
|
if (typeof showSearch === 'object') {
|
|
searchConfig = Object.assign(Object.assign({}, searchConfig), showSearch);
|
|
}
|
|
return searchConfig;
|
|
}, [showSearch]);
|
|
// ===================== Size ======================
|
|
const mergedSize = (0,useSize/* default */.Z)(ctx => {
|
|
var _a;
|
|
return (_a = customizeSize !== null && customizeSize !== void 0 ? customizeSize : compactSize) !== null && _a !== void 0 ? _a : ctx;
|
|
});
|
|
// ===================== Disabled =====================
|
|
const disabled = _react_17_0_2_react.useContext(DisabledContext/* default */.Z);
|
|
const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
|
// ===================== Icon ======================
|
|
let mergedExpandIcon = expandIcon;
|
|
if (!expandIcon) {
|
|
mergedExpandIcon = isRtl ? /*#__PURE__*/_react_17_0_2_react.createElement(LeftOutlined/* default */.Z, null) : /*#__PURE__*/_react_17_0_2_react.createElement(RightOutlined/* default */.Z, null);
|
|
}
|
|
const loadingIcon = /*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
className: `${prefixCls}-menu-item-loading-icon`
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(LoadingOutlined/* default */.Z, {
|
|
spin: true
|
|
}));
|
|
// =================== Multiple ====================
|
|
const checkable = _react_17_0_2_react.useMemo(() => multiple ? /*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
className: `${cascaderPrefixCls}-checkbox-inner`
|
|
}) : false, [multiple]);
|
|
// ===================== Icons =====================
|
|
const showSuffixIcon = (0,useShowArrow/* default */.Z)(props.suffixIcon, showArrow);
|
|
const {
|
|
suffixIcon,
|
|
removeIcon,
|
|
clearIcon
|
|
} = (0,iconUtil/* default */.Z)(Object.assign(Object.assign({}, props), {
|
|
hasFeedback,
|
|
feedbackIcon,
|
|
showSuffixIcon,
|
|
multiple,
|
|
prefixCls,
|
|
componentName: 'Cascader'
|
|
}));
|
|
// ===================== Placement =====================
|
|
const memoPlacement = _react_17_0_2_react.useMemo(() => {
|
|
if (placement !== undefined) {
|
|
return placement;
|
|
}
|
|
return isRtl ? 'bottomRight' : 'bottomLeft';
|
|
}, [placement, isRtl]);
|
|
const mergedBuiltinPlacements = (0,useBuiltinPlacements/* default */.Z)(builtinPlacements, popupOverflow);
|
|
const mergedAllowClear = allowClear === true ? {
|
|
clearIcon
|
|
} : allowClear;
|
|
// ==================== Render =====================
|
|
const renderNode = /*#__PURE__*/_react_17_0_2_react.createElement(_rc_cascader_3_16_0_rc_cascader_es, Object.assign({
|
|
prefixCls: prefixCls,
|
|
className: _classnames_2_5_1_classnames_default()(!customizePrefixCls && cascaderPrefixCls, {
|
|
[`${prefixCls}-lg`]: mergedSize === 'large',
|
|
[`${prefixCls}-sm`]: mergedSize === 'small',
|
|
[`${prefixCls}-rtl`]: isRtl,
|
|
[`${prefixCls}-borderless`]: !bordered,
|
|
[`${prefixCls}-in-form-item`]: isFormItemInput
|
|
}, (0,statusUtils/* getStatusClassNames */.Z)(prefixCls, mergedStatus, hasFeedback), compactItemClassnames, cascader === null || cascader === void 0 ? void 0 : cascader.className, className, rootClassName, hashId),
|
|
disabled: mergedDisabled,
|
|
style: Object.assign(Object.assign({}, cascader === null || cascader === void 0 ? void 0 : cascader.style), style)
|
|
}, restProps, {
|
|
builtinPlacements: mergedBuiltinPlacements,
|
|
direction: mergedDirection,
|
|
placement: memoPlacement,
|
|
notFoundContent: mergedNotFoundContent,
|
|
allowClear: mergedAllowClear,
|
|
showSearch: mergedShowSearch,
|
|
expandIcon: mergedExpandIcon,
|
|
suffixIcon: suffixIcon,
|
|
removeIcon: removeIcon,
|
|
loadingIcon: loadingIcon,
|
|
checkable: checkable,
|
|
dropdownClassName: mergedDropdownClassName,
|
|
dropdownPrefixCls: customizePrefixCls || cascaderPrefixCls,
|
|
choiceTransitionName: (0,motion/* getTransitionName */.m)(rootPrefixCls, '', choiceTransitionName),
|
|
transitionName: (0,motion/* getTransitionName */.m)(rootPrefixCls, 'slide-up', transitionName),
|
|
getPopupContainer: getPopupContainer || getContextPopupContainer,
|
|
ref: ref
|
|
}));
|
|
return wrapCascaderSSR(wrapSelectSSR(renderNode));
|
|
});
|
|
if (false) {}
|
|
// We don't care debug panel
|
|
/* istanbul ignore next */
|
|
const cascader_PurePanel = (0,PurePanel/* default */.Z)(cascader_Cascader);
|
|
cascader_Cascader.SHOW_PARENT = cascader_SHOW_PARENT;
|
|
cascader_Cascader.SHOW_CHILD = cascader_SHOW_CHILD;
|
|
cascader_Cascader._InternalPanelDoNotUseOrYouWillBeFired = cascader_PurePanel;
|
|
/* harmony default export */ var cascader = (cascader_Cascader);
|
|
|
|
/***/ })
|
|
|
|
}]); |