/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { TreeViewExpandChangeEvent } from './events.js'; import { TreeViewCheckDescriptor } from './TreeViewOperationDescriptors.js'; /** * The settings that configure the update of the check descriptor. */ export interface TreeViewCheckChangeSettings { /** * Determines a selection of a single node at a time. */ singleMode?: boolean; /** * Determines if the children checkboxes will be selected when the user selects the parent checkbox. */ checkChildren?: boolean; /** * Determines if the parent checkbox will be selected when the user selects all its children checkboxes. */ checkParents?: boolean; } /** * A helper function which updates the check descriptor. * * @param event - The event that triggered the change. * @param check - The check descriptor that will be updated. * @param data - The TreeView items. * @param settings - The additional settings that configure the update of the check descriptor. * @param childrenField - The field that points to the dataItem sub items. Defaults to `items`. * The default behavior allows the selection of multiple items. * @returns - The updated copy of the input check descriptor. * * @example * ```jsx * const App = () => { * const [check, setCheck] = React.useState([]); * const [items] = React.useState(tree); * * const onCheckChange = (event) => { * setCheck(handleTreeViewCheckChange(event, check, items)); * } * * return ( *
* *
* Press SPACE to check/uncheck the active item *
* Checked Indices: {check.join(",")} *
*
*
* ); * } * * const tree = [ { * text: 'Furniture', expanded: true, items: [ * { text: 'Tables & Chairs' }, { text: 'Sofas' }, { text: 'Occasional Furniture' } ] * }, { * text: 'Decor', expanded: true, items: [ * { text: 'Bed Linen' }, { text: 'Curtains & Blinds' }, { text: 'Carpets' } ] * } ]; * ``` */ export declare function handleTreeViewCheckChange(event: TreeViewExpandChangeEvent, check: string[] | TreeViewCheckDescriptor, data?: any[] | null, settings?: TreeViewCheckChangeSettings, childrenField?: string): any[] | (TreeViewCheckDescriptor & { ids: any[]; });