UNPKG

@progress/kendo-angular-grid

Version:

Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.

164 lines (163 loc) 5.45 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { SelectionAggregate, SelectionAggregates } from '../aggregates/aggregate-types'; import { ColumnComponent } from './../columns/column.component'; import { RowArgs } from './../rendering/common/row-args'; /** * Represents the callback that is used by the * [cellSelected]({% slug api_grid_gridcomponent %}#toc-cellselected) property ([see example](slug:grid_selection_custom#toc-setting-the-selected-cells)). */ export type CellSelectedFn = (row: RowArgs, column: ColumnComponent, colIndex: number) => { selected: boolean; item: CellSelectionItem; }; /** * Arguments for the Grid [`selectionChange`](slug:api_grid_gridcomponent#toc-selectionchange) event. */ export interface SelectionEvent { /** * The cell selection aggregates. */ cellAggregates?: SelectionAggregates; /** * The row items that were added to the selection. */ selectedRows?: RowArgs[]; /** * The row items that were removed from the selection. */ deselectedRows?: RowArgs[]; /** * The cell items that were added to the selection. */ selectedCells?: CellSelectionItem[]; /** * The cell items that were removed from the selection. */ deselectedCells?: CellSelectionItem[]; /** * Shows the state of the `Ctrl` key (or the `Command` key on a Mac) during the selection. */ ctrlKey?: boolean; /** * Shows the state of the `Shift` key during the selection. */ shiftKey?: boolean; /** * Represents the initially clicked row in a shift-click range row selection */ rangeStartRow?: RowArgs; /** * Represents the shift-clicked item in a shift-click range row selection */ rangeEndRow?: RowArgs; /** * Represents the initially clicked cell in a shift-click range cell selection */ rangeStartCell?: CellSelectionItem; /** * Represents the shift-clicked cell in a shift-click range cell selection */ rangeEndCell?: CellSelectionItem; } /** * The settings for the selection functionality of the Grid ([more information and example]({% slug selection_grid %}#toc-setup)). * * @example * ```html * <kendo-grid [data]="gridData" [selectable]="{ checkboxOnly: true, mode: 'multiple' }"> * <kendo-grid-column field="ProductID"> </kendo-grid-column> * <kendo-grid-column field="ProductName"> </kendo-grid-column> * </kendo-grid> * ``` */ export interface SelectableSettings { /** * Determines if selection aggregates will be enabled. By default the property is set to `false`. * If cellAggregates is set to `true` it will calculate all aggregate options. * You can choose which aggregates to calculate by passing an array of [SelectionAggregate]({% slug api_grid_selectionaggregate %}) type options. */ cellAggregates?: boolean | SelectionAggregate[]; /** * Determines if selection is allowed. * */ enabled?: boolean; /** * Determines if the selection is performed only through clicking a checkbox. * If enabled, clicking the row itself will not select the row. * Applicable if at least one checkbox column is present. * */ checkboxOnly?: boolean; /** * Determines the selectable mode. */ mode?: SelectableMode; /** * Determines if cell selection is allowed. * */ cell?: boolean; /** * Determines if drag selection is allowed. * */ drag?: boolean; /** * Determines whether a meta key (Ctrl or Command) will be needed to perform multiple selection. By default, adding a new row or cell to the selection requires pressing a meta key. * */ metaKeyMultiSelect?: boolean; } /** * Represents the available selection modes. [See example](slug:grid_row_selection). * * The available values are: * * `single`&mdash;Enables single selection. If you click the selected row, it will not be deselected. [See example](slug:grid_row_selection#toc-single-row-selection). * * `multiple`&mdash;Enables multiple selection. [See example](slug:grid_row_selection#toc-multiple-rows-selection). * * @example * ```html * <kendo-grid [selectable]="{mode: 'multiple'}"></kendo-grid> * ``` */ export type SelectableMode = "single" | "multiple"; /** * Represents the possible states of the select-all checkbox. * * @example * ```html * <kendo-grid-column> * <ng-template kendoGridHeaderTemplate> * <input * kendoGridSelectAllCheckbox * state="indeterminate" * ... * /> * </ng-template> * <kendo-grid-column> * ``` */ export type SelectAllCheckboxState = "checked" | "unchecked" | "indeterminate"; /** * The Grid `cell` selection items type. */ export interface CellSelectionItem { /** * The key that identifies the selected item. */ itemKey?: any; /** * The key that identifies the selected item column. */ columnKey?: any; } /** * The possible data types of the Grid selection items. * * @hidden */ export type GridSelectionItem = number | RowArgs | CellSelectionItem;