/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

function getFakeArrowIconClass(prefix, STATUS, cascaderContext) {
  const {
    disabled
  } = cascaderContext;
  return [`${prefix}-cascader__icon`, {
    [STATUS.disabled]: disabled
  }];
}
function getNodeStatusClass(node, STATUS, cascaderContext) {
  const {
    checkStrictly,
    multiple,
    value,
    max
  } = cascaderContext;
  const expandedActive = !checkStrictly && node.expanded && (multiple ? !node.isLeaf() : true) || checkStrictly && node.expanded;
  const isLeaf = node.isLeaf();
  const isDisabled = node.disabled || multiple && value.length >= max && max !== 0;
  const isSelected = node.checked || multiple && !checkStrictly && node.expanded && !isLeaf;
  return [{
    [STATUS.selected]: !isDisabled && isSelected,
    [STATUS.expanded]: !isDisabled && expandedActive,
    [STATUS.disabled]: isDisabled
  }];
}
function getCascaderItemClass(prefix, node, SIZE, STATUS, cascaderContext) {
  const {
    size
  } = cascaderContext;
  return [`${prefix}-cascader__item`, ...getNodeStatusClass(node, STATUS, cascaderContext), SIZE[size], {
    [`${prefix}-cascader__item--with-icon`]: !!node.children,
    [`${prefix}-cascader__item--leaf`]: node.isLeaf()
  }];
}
function getCascaderItemIconClass(prefix, node, STATUS, cascaderContext) {
  return [`${prefix}-cascader__item-icon`, `${prefix}-icon`, ...getNodeStatusClass(node, STATUS, cascaderContext)];
}

exports.getCascaderItemClass = getCascaderItemClass;
exports.getCascaderItemIconClass = getCascaderItemIconClass;
exports.getFakeArrowIconClass = getFakeArrowIconClass;
exports.getNodeStatusClass = getNodeStatusClass;
//# sourceMappingURL=className.js.map
