import { isLeaf, toPathKey } from '../utils/commonUtil'; import Checkbox from './Checkbox'; import type { DefaultOptionType, SingleValueType } from '../Cascader'; import { SEARCH_MARK } from '../hooks/useSearchOptions'; import type { Key } from '../../_util/type'; import { useInjectCascader } from '../context'; import { cloneElement } from '../../_util/vnode'; export const FIX_LABEL = '__cascader_fix_label__'; export interface ColumnProps { prefixCls: string; multiple?: boolean; options: DefaultOptionType[]; /** Current Column opened item key */ activeValue?: Key; /** The value path before current column */ prevValuePath: Key[]; onToggleOpen: (open: boolean) => void; onSelect: (valuePath: SingleValueType, leaf: boolean) => void; onActive: (valuePath: SingleValueType) => void; checkedSet: Set; halfCheckedSet: Set; loadingKeys: Key[]; isSelectable: (option: DefaultOptionType) => boolean; } export default function Column({ prefixCls, multiple, options, activeValue, prevValuePath, onToggleOpen, onSelect, onActive, checkedSet, halfCheckedSet, loadingKeys, isSelectable, }: ColumnProps) { const menuPrefixCls = `${prefixCls}-menu`; const menuItemPrefixCls = `${prefixCls}-menu-item`; const { fieldNames, changeOnSelect, expandTrigger, expandIcon: expandIconRef, loadingIcon: loadingIconRef, dropdownMenuColumnStyle, customSlots, } = useInjectCascader(); const expandIcon = expandIconRef.value ?? customSlots.value.expandIcon?.(); const loadingIcon = loadingIconRef.value ?? customSlots.value.loadingIcon?.(); const hoverOpen = expandTrigger.value === 'hover'; // ============================ Render ============================ return ( ); } Column.props = [ 'prefixCls', 'multiple', 'options', 'activeValue', 'prevValuePath', 'onToggleOpen', 'onSelect', 'onActive', 'checkedSet', 'halfCheckedSet', 'loadingKeys', 'isSelectable', ]; Column.displayName = 'Column'; Column.inheritAttrs = false;