import { SuggestionsGroupSelected } from '../../constants'; import { CheckBoxTreeItemType, CheckBoxTreeGroupItem, ItemState, CheckBoxTreeChangeEvent } from './types'; /** * Helper defines if CheckBoxTree item has child items * @param {CheckBoxTreeItemType} item - Parent item * * @returns {boolean} Does CheckBoxTree element have any children? */ export declare const getHasChildItems: (item: CheckBoxTreeItemType) => item is CheckBoxTreeGroupItem; /** * Helper checks if there are child items in item's state * @param {ItemState} item - Parent item * * @returns {boolean} Are there any children in element state? */ export declare const getHasChildItemsInState: (item: ItemState) => boolean; /** * Helper defines if all checkboxes in subgroup are selected * @param {number[]} childrenIds - Children ids * @param {Set} selectedChildrenIds - Selected children ids * * @returns {boolean} Are all checkboxes in subgroup selected? */ export declare const getIsAllSelected: (childrenIds: number[], selectedChildrenIds: Set) => boolean; /** * Helper defines if none of checkboxes in subgroup are selected * @param {Set} selectedChildrenIds - Selected children ids * * @returns {boolean} Are none of the checkboxes in subgroup selected? */ export declare const getIsNothingSelected: (selectedChildrenIds: Set) => boolean; /** * Helper defines if some checkboxes in subgroup are selected or partly selected * @param {number[]} childrenIds - Children ids * @param {Set} selectedChildrenIds - Selected children ids * @param {ItemState} treeState - Tree state * * @returns {boolean} Are some checkboxes selected in a subgroup or partially? */ export declare const getIsSomeSelected: (childrenIds: number[], selectedChildrenIds: Set, treeState: Map) => boolean; /** * Helper returns new selectedChildren Set with all child items ids * @param {ItemState} item - Parent item * * @returns {Set} New set of selectedChildren with all child ids */ export declare const getAllChildItemsSelected: (item: ItemState) => Set; /** * Helper gets new child item state * @param {ItemState} childItem - Child item * @param {SuggestionsGroupSelected} parentValue - Parent value * * @returns {ItemState} Item state */ export declare const getUpdatedChildItemState: ({ childItem, parentValue, }: { childItem: ItemState; parentValue: SuggestionsGroupSelected; }) => ItemState; /** * Helper gets part of tree state with children Items, performs state updates * and returns new updated part of tree state * @param {number[]} childrenIds - Children ids * @param {Map | undefined} childrenState - Children state * @param {Map} treeState - Tree state * @param {SuggestionsGroupSelected} value - Current tree state value * * @returns {Map} New updated part of the tree state */ export declare const getUpdatedChildrenState: ({ childrenIds, treeState, parentValue, childrenState, }: { childrenIds?: number[] | undefined; childrenState?: Map | undefined; parentValue: SuggestionsGroupSelected; treeState: Map; }) => Map; /** * Helper gets part of tree state with parent Items, performs state updates * and returns new updated part of tree state * @param {number} currentId - Current id * @param {number | undefined} parentId - Parent id * @param {Map | undefined} parentsState - Parents state * @param {Map} treeState - Tree state * @param {SuggestionsGroupSelected} value - Current tree state value * * @returns {Map} New updated part of the tree state */ export declare const getUpdatedParentsState: ({ parentId, currentId, treeState, childValue, parentsState, }: { childValue: SuggestionsGroupSelected; currentId: number; parentId?: number | undefined; parentsState?: Map | undefined; treeState: Map; }) => Map; /** * Helper forms CheckBoxTree state as flat Map structure from data supplied to component * @param {CheckBoxTreeItemType[]} items - Check box tree items * @param {Map | undefined} treeState - Tree state * @param {number | undefined} parentId - Parent id * * @returns {Map} New updated part of the tree state */ export declare const getTreeStateFromData: ({ items, state, parentId, }: { items: CheckBoxTreeItemType[]; parentId?: number | undefined; state?: Map | undefined; }) => Map; /** * Helper gets selected items ids from tree state and returns custom change event * @param {Map} treeState - Tree state * * @returns {CheckBoxTreeChangeEvent} Check box tree change event */ export declare const getCustomEvent: (treeState: Map) => CheckBoxTreeChangeEvent; /** * Helper updates tree state * @param {number} id - Current item id in tree state * @param {newValue} newValue - New tree state value * @param {prevState} prevState - Previous tree state value * * @returns {Map} New updates tree state */ export declare const getUpdatedTreeState: ({ id, newValue, prevState, }: { id: number; newValue: SuggestionsGroupSelected; prevState: Map; }) => Map;