tdesign-vue-next
Version:
TDesign Component for vue-next
38 lines (34 loc) • 2.04 kB
JavaScript
/**
* tdesign v1.11.5
* (c) 2025 tdesign
* @license MIT
*/
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
function getFakeArrowIconClass(prefix, STATUS, cascaderContext) {
var disabled = cascaderContext.disabled;
return ["".concat(prefix, "-cascader__icon"), _defineProperty({}, STATUS.disabled, disabled)];
}
function getNodeStatusClass(node, STATUS, cascaderContext) {
var checkStrictly = cascaderContext.checkStrictly,
multiple = cascaderContext.multiple,
value = cascaderContext.value,
max = cascaderContext.max;
var expandedActive = !checkStrictly && node.expanded && (multiple ? !node.isLeaf() : true) || checkStrictly && node.expanded;
var isLeaf = node.isLeaf();
var isDisabled = node.disabled || multiple && value.length >= max && max !== 0;
var isSelected = node.checked || multiple && !checkStrictly && node.expanded && !isLeaf;
if (!multiple && !checkStrictly && !isLeaf) {
isSelected = node.expanded;
}
return [_defineProperty(_defineProperty(_defineProperty({}, STATUS.selected, !isDisabled && isSelected), STATUS.expanded, !isDisabled && expandedActive), STATUS.disabled, isDisabled)];
}
function getCascaderItemClass(prefix, node, SIZE, STATUS, cascaderContext) {
var size = cascaderContext.size;
return ["".concat(prefix, "-cascader__item")].concat(_toConsumableArray(getNodeStatusClass(node, STATUS, cascaderContext)), [SIZE[size], _defineProperty(_defineProperty({}, "".concat(prefix, "-cascader__item--with-icon"), !!node.children), "".concat(prefix, "-cascader__item--leaf"), node.isLeaf())]);
}
function getCascaderItemIconClass(prefix, node, STATUS, cascaderContext) {
return ["".concat(prefix, "-cascader__item-icon"), "".concat(prefix, "-icon")].concat(_toConsumableArray(getNodeStatusClass(node, STATUS, cascaderContext)));
}
export { getCascaderItemClass, getCascaderItemIconClass, getFakeArrowIconClass, getNodeStatusClass };
//# sourceMappingURL=className.js.map