@adaptabletools/adaptable 23.0.18 → 23.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "23.0.18",
3
+ "version": "23.0.20",
4
4
  "description": "Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -198,7 +198,7 @@ export interface AdaptableOptions<TData = any, TContext = Record<string, any>> {
198
198
  *
199
199
  * @noCodeContainer
200
200
  */
201
- layoutOptions?: LayoutOptions;
201
+ layoutOptions?: LayoutOptions<TData>;
202
202
  /**
203
203
  * Options for managing personal Notes
204
204
  */
@@ -209,6 +209,7 @@ const DefaultAdaptableOptions = {
209
209
  layoutOptions: {
210
210
  layoutCreationDefaultProperties: undefined,
211
211
  pivotPreviewColumns: undefined,
212
+ isRowSelectionCheckboxVisible: undefined,
212
213
  layoutViewOptions: {
213
214
  maxColumnsToDisplay: 10,
214
215
  },
@@ -1,10 +1,12 @@
1
+ import { IRowNode } from 'ag-grid-enterprise';
1
2
  import { Layout, PivotLayout, TableLayout } from '../AdaptableState/LayoutState';
2
3
  import { AdaptableObjectTag } from '../AdaptableState/Common/AdaptableObject';
4
+ import { AdaptableColumnContext } from '../AdaptableState/Common/AdaptableColumnContext';
3
5
  import { BaseContext, LayoutExtensionModule, LayoutExtensionObject } from '../../types';
4
6
  /**
5
7
  * Options for configuring Layouts; manage Column visibility, order, sorting, grouping, width etc.
6
8
  */
7
- export interface LayoutOptions {
9
+ export interface LayoutOptions<TData = any> {
8
10
  /**
9
11
  * Set of options for how Layouts are displayed in Settings Panel
10
12
  */
@@ -21,6 +23,17 @@ export interface LayoutOptions {
21
23
  * Default properties to apply when creating a new Layout (Table or Pivot)
22
24
  */
23
25
  layoutCreationDefaultProperties?: LayoutCreationDefaultProperties | ((context: LayoutCreationDefaultPropertiesContext) => TableLayoutCreationDefaultProperties | PivotLayoutCreationDefaultProperties);
26
+ /**
27
+ * Function which checks if the Row Selection checkbox should be visible for a given row.
28
+ *
29
+ * When provided, this overrides `LayoutRowSelection.Checkboxes` and any `gridOptions.rowSelection.checkboxes` value,
30
+ * and forces AG Grid `hideDisabledCheckboxes: true` so returning `false` hides (rather than greys out) the checkbox.
31
+ *
32
+ * Does not apply when the Layout sets `RowSelection: false` (row selection is fully disabled for that Layout).
33
+ *
34
+ * Use `context.rowNode` for group / footer / pinned / total rows (`data` may be `undefined` for those).
35
+ */
36
+ isRowSelectionCheckboxVisible?: (context: LayoutRowSelectionContext<TData>) => boolean;
24
37
  }
25
38
  /**
26
39
  * Options for managing Tags in Layouts (used to enhance Layouts)
@@ -127,3 +140,21 @@ export interface LayoutCreationDefaultPropertiesContext extends BaseContext {
127
140
  */
128
141
  layoutType: 'table' | 'pivot';
129
142
  }
143
+ /**
144
+ * Context for `LayoutOptions.isRowSelectionCheckboxVisible` function
145
+ */
146
+ export interface LayoutRowSelectionContext<TData = any> extends AdaptableColumnContext<TData> {
147
+ /**
148
+ * Current Layout
149
+ */
150
+ layout: Layout;
151
+ /**
152
+ * The Row Node being evaluated
153
+ */
154
+ rowNode: IRowNode<TData>;
155
+ /**
156
+ * The data in the Row Node.
157
+ * `undefined` for group, footer, pinned, and other non-data rows — use `rowNode` for those cases.
158
+ */
159
+ data: TData | undefined;
160
+ }
@@ -93,5 +93,6 @@ export type SystemFormatColumnPredicateId = 'Blanks' | 'NonBlanks' | 'Equals' |
93
93
  */
94
94
  export interface FormatColumnConfig extends LayoutExtendedConfig {
95
95
  includeSuspended?: boolean;
96
+ includeReadOnly?: boolean;
96
97
  target?: FormatColumnTarget;
97
98
  }
@@ -310,7 +310,9 @@ export interface LayoutRowSelection {
310
310
  */
311
311
  Mode: 'singleRow' | 'multiRow';
312
312
  /**
313
- * Whether to display checkboxes in Selection Column
313
+ * Whether to display checkboxes in Selection Column.
314
+ * Overridden by `LayoutOptions.isRowSelectionCheckboxVisible` when that function is provided
315
+ * (except when `RowSelection` is `false`, which disables selection entirely).
314
316
  * @defaultValue true
315
317
  */
316
318
  Checkboxes?: boolean;
@@ -78,7 +78,7 @@ export class FormatColumnApiImpl extends ApiBase {
78
78
  this.dispatchAction(FormatColumnRedux.FormatColumnUnSuspendAll());
79
79
  }
80
80
  getFormatColumnsForColumn(column, config) {
81
- const formatColumns = this.getFormatColumns(config).filter((formatColumn) => config?.includeSuspended || !formatColumn.IsSuspended);
81
+ const formatColumns = this.getFormatColumns(config).filter((formatColumn) => (config?.includeSuspended || !formatColumn.IsSuspended) && (config?.includeReadOnly || !formatColumn.IsReadOnly));
82
82
  return this.internalApi.getFormatColumnWithColumnInScope(formatColumns, column);
83
83
  }
84
84
  getFormatColumnsForColumnId(columnId, config) {
@@ -50,7 +50,7 @@ export class FormatColumnModule extends AdaptableModuleBase {
50
50
  source: 'ColumnMenu',
51
51
  };
52
52
  returnColumnMenuItems.push(this.createMenuItemShowPopup('format-column-add', 'Create Format Column', this.moduleInfo.Popup, this.moduleInfo.Glyph, createPopupParam));
53
- const formatColumnsForColumn = this.api.formatColumnApi.getFormatColumnsForColumnId(column.columnId);
53
+ const formatColumnsForColumn = this.api.formatColumnApi.getFormatColumnsForColumnId(column.columnId, { includeReadOnly: false });
54
54
  if (formatColumnsForColumn.length === 1) {
55
55
  let editPopupParam = {
56
56
  column: column,
@@ -109,6 +109,12 @@ export declare class AdaptableAgGrid implements IAdaptable {
109
109
  private listenerSortChanged;
110
110
  private listenerColumnGroupOpened;
111
111
  private layoutManager;
112
+ /**
113
+ * Stable AG Grid `rowSelection.checkboxes` wrapper for `LayoutOptions.isRowSelectionCheckboxVisible`.
114
+ * Cached so layout re-applies do not create a new function identity (avoids needless refreshCells).
115
+ * `null` = not yet resolved; `undefined` = Options callback not provided.
116
+ */
117
+ private rowSelectionCheckboxesOverride;
112
118
  private columnMinMaxValuesCache;
113
119
  renderReactRoot: RenderReactRootFn;
114
120
  private unmountReactRoot?;
@@ -147,6 +153,12 @@ export declare class AdaptableAgGrid implements IAdaptable {
147
153
  private normaliseLayoutState;
148
154
  private normaliseToolPanelState;
149
155
  private getCurrentLayoutModel;
156
+ /**
157
+ * Highest-precedence override for AG Grid `rowSelection.checkboxes`, sourced from
158
+ * `LayoutOptions.isRowSelectionCheckboxVisible`.
159
+ * Returns a stable function identity for the lifetime of this Adaptable instance.
160
+ */
161
+ private getRowSelectionCheckboxesOverride;
150
162
  silentUpdateCurrentLayoutModel(layoutModel?: TableLayoutModel | PivotLayoutModel): void;
151
163
  getDefaultColumnWidthForCol(columnId: string): number;
152
164
  /**
@@ -9,7 +9,8 @@ import { applyDefaultAdaptableOptions } from '../AdaptableOptions/DefaultAdaptab
9
9
  import { resolveContainerElement } from '../Utilities/resolveContainerElement';
10
10
  import { AgGridAdapter } from './AgGridAdapter';
11
11
  import * as GeneralConstants from '../Utilities/Constants/GeneralConstants';
12
- import { AG_GRID_GRAND_TOTAL_ROW_ID, AG_GRID_GROUPED_COLUMN, AUTOGENERATED_PK_COLUMN, ERROR_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, QUARTER_SECOND, } from '../Utilities/Constants/GeneralConstants';
12
+ import { AG_GRID_GRAND_TOTAL_ROW_ID, AG_GRID_GROUPED_COLUMN, AG_GRID_SELECTION_COLUMN, AUTOGENERATED_PK_COLUMN, ERROR_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, QUARTER_SECOND, } from '../Utilities/Constants/GeneralConstants';
13
+ import { generateSelectionColumn } from '../Api/Implementation/ColumnApiImpl';
13
14
  import { DataService } from '../Utilities/Services/DataService';
14
15
  import { AdaptableStore } from '../Redux/Store/AdaptableStore';
15
16
  import { AdaptableApiImpl } from '../Api/Implementation/AdaptableApiImpl';
@@ -202,6 +203,7 @@ export class AdaptableAgGrid {
202
203
  listenerSortChanged;
203
204
  listenerColumnGroupOpened;
204
205
  layoutManager;
206
+ rowSelectionCheckboxesOverride = null;
205
207
  columnMinMaxValuesCache = {};
206
208
  renderReactRoot = (node, container) => defaultRenderReactRoot(node, container);
207
209
  unmountReactRoot;
@@ -420,7 +422,7 @@ export class AdaptableAgGrid {
420
422
  lockPosition: false,
421
423
  };
422
424
  }
423
- gridOptions.rowSelection = LayoutManager.getGridOptionForRowSelectionFromLayout(layoutModel.RowSelection, gridOptions.rowSelection);
425
+ gridOptions.rowSelection = LayoutManager.getGridOptionForRowSelectionFromLayout(layoutModel.RowSelection, gridOptions.rowSelection, this.getRowSelectionCheckboxesOverride());
424
426
  }
425
427
  this.lifecycleState = 'initAgGrid';
426
428
  this.agGridAdapter.initialGridOptions = gridOptions;
@@ -438,6 +440,7 @@ export class AdaptableAgGrid {
438
440
  gridApi: agGridApi,
439
441
  debugId: this.adaptableOptions.adaptableId,
440
442
  initialRowSelection,
443
+ getRowSelectionCheckboxesOverride: () => this.getRowSelectionCheckboxesOverride(),
441
444
  });
442
445
  this.silentUpdateCurrentLayoutModel(layoutModel);
443
446
  if (isPivotLayoutModel(layoutModel)) {
@@ -604,6 +607,36 @@ export class AdaptableAgGrid {
604
607
  }
605
608
  return layoutStateToLayoutModel(currentLayout);
606
609
  }
610
+ getRowSelectionCheckboxesOverride() {
611
+ if (this.rowSelectionCheckboxesOverride !== null) {
612
+ return this.rowSelectionCheckboxesOverride;
613
+ }
614
+ const isVisible = this.adaptableOptions.layoutOptions?.isRowSelectionCheckboxVisible;
615
+ if (typeof isVisible !== 'function') {
616
+ this.rowSelectionCheckboxesOverride = undefined;
617
+ return undefined;
618
+ }
619
+ this.rowSelectionCheckboxesOverride = (params) => {
620
+ const columnId = params.column?.getColId?.() ?? params.colDef?.colId ?? params.colDef?.field;
621
+ let column = this.api.columnApi.getColumnForColDef(params.colDef) ??
622
+ (columnId != null ? this.api.columnApi.getColumnWithColumnId(columnId) : undefined);
623
+ if (!column && columnId === AG_GRID_SELECTION_COLUMN) {
624
+ column = generateSelectionColumn();
625
+ }
626
+ if (!column) {
627
+ return false;
628
+ }
629
+ const context = {
630
+ ...this.api.internalApi.buildBaseContext(),
631
+ layout: this.api.layoutApi.getCurrentLayout(),
632
+ column,
633
+ rowNode: params.node,
634
+ data: params.data,
635
+ };
636
+ return isVisible(context);
637
+ };
638
+ return this.rowSelectionCheckboxesOverride;
639
+ }
607
640
  silentUpdateCurrentLayoutModel(layoutModel = this.getCurrentLayoutModel()) {
608
641
  if (!layoutModel) {
609
642
  return;
@@ -3334,6 +3367,7 @@ export class AdaptableAgGrid {
3334
3367
  this.__prevLayoutForRefresh = undefined;
3335
3368
  this.layoutManager?.destroy();
3336
3369
  this.layoutManager = null;
3370
+ this.rowSelectionCheckboxesOverride = null;
3337
3371
  clearPredicateDefMapMemo();
3338
3372
  const agGridApi = this.agGridAdapter?.getAgGridApi();
3339
3373
  if (agGridApi && !agGridApi.isDestroyed()) {
@@ -1,16 +1,16 @@
1
1
  import * as React from 'react';
2
- import { Combobox as ComboboxPrimitive } from '@base-ui/react';
2
+ import { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';
3
3
  declare const useFilteredItems: typeof ComboboxPrimitive.useFilteredItems;
4
4
  export { useFilteredItems, ComboboxPrimitive };
5
5
  declare const Combobox: typeof ComboboxPrimitive.Root;
6
6
  declare const RESIZABLE_VIRTUALIZED_LIST_CLASS = "twa:group-data-resizable/combobox-content:max-h-none twa:group-data-resizable/combobox-content:flex-1 twa:group-data-resizable/combobox-content:min-h-0 twa:group-data-resizable/combobox-content:flex twa:group-data-resizable/combobox-content:flex-col";
7
7
  declare const RESIZABLE_VIRTUALIZED_SCROLL_CLASS = "twa:group-data-resizable/combobox-content:h-auto twa:group-data-resizable/combobox-content:max-h-none twa:group-data-resizable/combobox-content:flex-1 twa:group-data-resizable/combobox-content:min-h-0";
8
8
  declare function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props): React.JSX.Element;
9
- declare const ComboboxTrigger: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxTriggerProps & {
9
+ declare const ComboboxTrigger: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxTriggerProps & {
10
10
  icon?: React.ReactNode;
11
11
  }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
12
- export declare const ComboboxClear: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteClearProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
13
- declare const ComboboxInput: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteInputProps & {
12
+ export declare const ComboboxClear: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxClearProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
13
+ declare const ComboboxInput: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxInputProps & {
14
14
  isLoading?: boolean;
15
15
  showTrigger?: boolean;
16
16
  showClear?: boolean;
@@ -23,17 +23,17 @@ declare function ComboboxContent({ className, side, sideOffset, align, alignOffs
23
23
  contentRef?: (el: HTMLDivElement | null) => void;
24
24
  maxLabelLength?: number;
25
25
  }): React.JSX.Element;
26
- declare const ComboboxList: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteListProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
27
- declare const ComboboxItem: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxItemProps & {
26
+ declare const ComboboxList: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxListProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
27
+ declare const ComboboxItem: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxItemProps & {
28
28
  renderCheckboxIndicator?: boolean | null | ComboboxPrimitive.ItemIndicator.Props["render"];
29
29
  }, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
- declare const ComboboxGroup: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
- declare const ComboboxLabel: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteGroupLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
+ declare const ComboboxGroup: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
+ declare const ComboboxLabel: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxGroupLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
32
32
  declare function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props): React.JSX.Element;
33
- declare const ComboboxEmpty: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteEmptyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
34
- declare const ComboboxSeparator: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
35
- declare const ComboboxChips: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxChipsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
36
- declare const ComboboxChip: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxChipProps & {
33
+ declare const ComboboxEmpty: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxEmptyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
34
+ declare const ComboboxSeparator: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
35
+ declare const ComboboxChips: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxChipsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
36
+ declare const ComboboxChip: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxChipProps & {
37
37
  showRemove?: boolean;
38
38
  /**
39
39
  * Optional override for the remove action. When provided, a plain button
@@ -45,6 +45,6 @@ declare const ComboboxChip: React.ForwardRefExoticComponent<Omit<import("@base-u
45
45
  */
46
46
  onRemove?: (event: React.MouseEvent<HTMLButtonElement>) => void;
47
47
  }, "ref"> & React.RefAttributes<HTMLDivElement>>;
48
- declare const ComboboxChipsInput: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
48
+ declare const ComboboxChipsInput: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
49
49
  declare function useComboboxAnchor(): React.RefObject<HTMLDivElement>;
50
50
  export { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, useComboboxAnchor, RESIZABLE_VIRTUALIZED_LIST_CLASS, RESIZABLE_VIRTUALIZED_SCROLL_CLASS, };
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { Combobox as ComboboxPrimitive } from '@base-ui/react';
3
+ import { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';
4
4
  import { cn, POPUP_Z_INDEX } from '../../lib/utils';
5
5
  import { Button } from './button';
6
6
  import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group';
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1785941951293 || Date.now(),
4
- VERSION: "23.0.18" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1786537581701 || Date.now(),
4
+ VERSION: "23.0.20" || '--current-version--',
5
5
  };
@@ -1,4 +1,4 @@
1
- import { ColDef, ColumnState, GridApi, GridOptions, GridState } from 'ag-grid-enterprise';
1
+ import { CheckboxSelectionCallbackParams, ColDef, ColumnState, GridApi, GridOptions, GridState } from 'ag-grid-enterprise';
2
2
  import { PivotLayoutModel, TableLayoutModel } from './LayoutManagerModel';
3
3
  import { LMEmitter } from './LMEmitter';
4
4
  import { LayoutRowSelection } from '../../AdaptableState/LayoutState';
@@ -11,6 +11,11 @@ export type LayoutManagerOptions = {
11
11
  debugId: string;
12
12
  layoutChangeDebounce?: number;
13
13
  initialRowSelection?: GridOptions['rowSelection'];
14
+ /**
15
+ * Highest-precedence override for `rowSelection.checkboxes` (from LayoutOptions).
16
+ * When this returns a function, it replaces layout/gridOptions checkbox config.
17
+ */
18
+ getRowSelectionCheckboxesOverride?: () => ((params: CheckboxSelectionCallbackParams) => boolean) | undefined;
14
19
  };
15
20
  type ApplyLayoutOptions = {
16
21
  skipApplyRowGroupsExpandedState?: boolean;
@@ -29,6 +34,7 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
29
34
  private supressGlobalAgGridEventTimeoutId;
30
35
  private layoutManagerDebugId;
31
36
  private initialRowSelection;
37
+ private getRowSelectionCheckboxesOverride?;
32
38
  constructor(options: LayoutManagerOptions);
33
39
  destroy(): void;
34
40
  private setupEvents;
@@ -73,12 +79,16 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
73
79
  applyColumnDefsChanges(layout: TableLayoutModel | PivotLayoutModel): boolean;
74
80
  private applyColumnSizingColumnDefsChanges;
75
81
  static readonly SELECTION_COLUMN_ID = "ag-Grid-SelectionColumn";
76
- static getGridOptionForRowSelectionFromLayout(layoutRowSelection: LayoutRowSelection | false | undefined, baseGridRowSelection: GridOptions['rowSelection']): GridOptions['rowSelection'] | undefined;
82
+ static getGridOptionForRowSelectionFromLayout(layoutRowSelection: LayoutRowSelection | false | undefined, baseGridRowSelection: GridOptions['rowSelection'], checkboxesOverride?: ((params: CheckboxSelectionCallbackParams) => boolean) | undefined): GridOptions['rowSelection'] | undefined;
77
83
  static isSelectionColumnInNonFirstPosition(tableColumns: string[] | undefined): boolean;
78
84
  static shouldUnlockSelectionColumnPosition(layout: TableLayoutModel): boolean;
79
85
  private ensureSelectionColumnPositionUnlocked;
80
86
  private getRowSelectionFromGrid;
81
87
  private applyRowSelection;
88
+ /**
89
+ * Columns that render selection checkboxes for the current rowSelection config.
90
+ */
91
+ private getRowSelectionCheckboxColumnIds;
82
92
  private applyTableLayout;
83
93
  private getRowGroupNodePathsAs;
84
94
  applyRowGroupValues(RowGroupValues: TableLayoutModel['RowGroupValues'], rowGroupedColumns: string[]): void;
@@ -152,6 +152,7 @@ export class LayoutManager extends LMEmitter {
152
152
  supressGlobalAgGridEventTimeoutId = null;
153
153
  layoutManagerDebugId;
154
154
  initialRowSelection;
155
+ getRowSelectionCheckboxesOverride;
155
156
  constructor(options) {
156
157
  super({ debugId: options.debugId });
157
158
  this.layoutChangeDebounce = options.layoutChangeDebounce ?? 0;
@@ -161,6 +162,7 @@ export class LayoutManager extends LMEmitter {
161
162
  }).bind(this);
162
163
  }
163
164
  this.initialRowSelection = options.initialRowSelection;
165
+ this.getRowSelectionCheckboxesOverride = options.getRowSelectionCheckboxesOverride;
164
166
  this.setOptions(options);
165
167
  this.gridApi.setGridOption('enableStrictPivotColumnOrder', true);
166
168
  this.setupEvents();
@@ -307,6 +309,9 @@ export class LayoutManager extends LMEmitter {
307
309
  setOptions(options) {
308
310
  this.gridApi = options.gridApi;
309
311
  this.layoutManagerDebugId = options.debugId;
312
+ if (options.getRowSelectionCheckboxesOverride !== undefined) {
313
+ this.getRowSelectionCheckboxesOverride = options.getRowSelectionCheckboxesOverride;
314
+ }
310
315
  }
311
316
  getLayoutModelFromGrid() {
312
317
  return this.isInPivotMode()
@@ -1070,12 +1075,22 @@ export class LayoutManager extends LMEmitter {
1070
1075
  return false;
1071
1076
  }
1072
1077
  static SELECTION_COLUMN_ID = 'ag-Grid-SelectionColumn';
1073
- static getGridOptionForRowSelectionFromLayout(layoutRowSelection, baseGridRowSelection) {
1078
+ static getGridOptionForRowSelectionFromLayout(layoutRowSelection, baseGridRowSelection, checkboxesOverride) {
1074
1079
  if (layoutRowSelection === false) {
1075
1080
  return undefined;
1076
1081
  }
1077
1082
  if (layoutRowSelection == null) {
1078
- return baseGridRowSelection;
1083
+ if (!checkboxesOverride) {
1084
+ return baseGridRowSelection;
1085
+ }
1086
+ const current = baseGridRowSelection && typeof baseGridRowSelection !== 'string'
1087
+ ? baseGridRowSelection
1088
+ : {};
1089
+ return {
1090
+ ...current,
1091
+ checkboxes: checkboxesOverride,
1092
+ hideDisabledCheckboxes: true,
1093
+ };
1079
1094
  }
1080
1095
  const current = baseGridRowSelection && typeof baseGridRowSelection !== 'string'
1081
1096
  ? baseGridRowSelection
@@ -1084,7 +1099,11 @@ export class LayoutManager extends LMEmitter {
1084
1099
  if (layoutRowSelection.Mode != null) {
1085
1100
  updated.mode = layoutRowSelection.Mode;
1086
1101
  }
1087
- if (layoutRowSelection.Checkboxes != null) {
1102
+ if (checkboxesOverride) {
1103
+ updated.checkboxes = checkboxesOverride;
1104
+ updated.hideDisabledCheckboxes = true;
1105
+ }
1106
+ else if (layoutRowSelection.Checkboxes != null) {
1088
1107
  updated.checkboxes = layoutRowSelection.Checkboxes;
1089
1108
  }
1090
1109
  if (layoutRowSelection.GroupSelectMode != null) {
@@ -1170,20 +1189,39 @@ export class LayoutManager extends LMEmitter {
1170
1189
  return result;
1171
1190
  }
1172
1191
  applyRowSelection(layout) {
1173
- const rowSelection = LayoutManager.getGridOptionForRowSelectionFromLayout(layout.RowSelection, this.initialRowSelection);
1192
+ const rowSelection = LayoutManager.getGridOptionForRowSelectionFromLayout(layout.RowSelection, this.initialRowSelection, this.getRowSelectionCheckboxesOverride?.());
1174
1193
  const prevRowSelection = this.gridApi.getGridOption('rowSelection');
1175
1194
  this.gridApi.setGridOption('rowSelection', rowSelection);
1176
1195
  if (typeof prevRowSelection === 'object' &&
1177
1196
  typeof rowSelection === 'object' &&
1178
- rowSelection.checkboxes !== prevRowSelection.checkboxes) {
1179
- const selectionColumn = this.gridApi.getColumn(LayoutManager.SELECTION_COLUMN_ID);
1180
- if (selectionColumn) {
1197
+ rowSelection?.checkboxes !== prevRowSelection?.checkboxes) {
1198
+ const columnsToRefresh = this.getRowSelectionCheckboxColumnIds(rowSelection, layout);
1199
+ if (columnsToRefresh.length) {
1181
1200
  this.gridApi.refreshCells({
1182
- columns: [LayoutManager.SELECTION_COLUMN_ID],
1201
+ columns: columnsToRefresh,
1183
1202
  });
1184
1203
  }
1185
1204
  }
1186
1205
  }
1206
+ getRowSelectionCheckboxColumnIds(rowSelection, layout) {
1207
+ const checkboxInGroupColumn = (typeof rowSelection === 'object' &&
1208
+ rowSelection.checkboxLocation === 'autoGroupColumn') ||
1209
+ (layout.RowSelection &&
1210
+ typeof layout.RowSelection === 'object' &&
1211
+ layout.RowSelection.CheckboxInGroupColumn === true);
1212
+ if (checkboxInGroupColumn) {
1213
+ const autoGroupColIds = this.gridApi
1214
+ .getColumns()
1215
+ ?.map((col) => col.getColId())
1216
+ .filter((colId) => colId === AUTO_GROUP_COLUMN_ID__SINGLE ||
1217
+ colId.startsWith(AUTO_GROUP_COLUMN_ID__MULTI_PREFIX)) ?? [];
1218
+ return autoGroupColIds;
1219
+ }
1220
+ if (this.gridApi.getColumn(LayoutManager.SELECTION_COLUMN_ID)) {
1221
+ return [LayoutManager.SELECTION_COLUMN_ID];
1222
+ }
1223
+ return [];
1224
+ }
1187
1225
  applyTableLayout(layout, options) {
1188
1226
  this.withSuppressColumnAnimation(() => {
1189
1227
  this.ensureSelectionColumnPositionUnlocked(layout);
package/src/types.d.ts CHANGED
@@ -28,7 +28,7 @@ export type { CellSummaryOptions } from './AdaptableOptions/CellSummaryOptions';
28
28
  export type { CustomSortOptions, ColumnValuesComparer } from './AdaptableOptions/CustomSortOptions';
29
29
  export type { NoteOptions, NotableCellContext } from './AdaptableOptions/NoteOptions';
30
30
  export type { CommentOptions, CommentableCellContext, CommentLoadContext, } from './AdaptableOptions/CommentOptions';
31
- export type { LayoutOptions, LayoutViewOptions, LayoutTagOptions, LayoutExtendedContext, AutoGenerateTagsForLayoutsContext, PivotPreviewColumnsContext, TableLayoutCreationDefaultProperties, PivotLayoutCreationDefaultProperties, LayoutCreationDefaultProperties, LayoutCreationDefaultPropertiesContext, } from './AdaptableOptions/LayoutOptions';
31
+ export type { LayoutOptions, LayoutViewOptions, LayoutTagOptions, LayoutExtendedContext, AutoGenerateTagsForLayoutsContext, PivotPreviewColumnsContext, TableLayoutCreationDefaultProperties, PivotLayoutCreationDefaultProperties, LayoutCreationDefaultProperties, LayoutCreationDefaultPropertiesContext, LayoutRowSelectionContext, } from './AdaptableOptions/LayoutOptions';
32
32
  export type { ChartingOptions, ChartContainer, ExternalChartingContext, ExternalChartingOptions, SaveChartBehaviour, } from './AdaptableOptions/ChartingOptions';
33
33
  export type { OpenFinPluginOptions } from './AdaptableOptions/OpenFinPluginOptions';
34
34
  export type { InteropioPluginOptions } from './AdaptableOptions/InteropioPluginOptions';