@adaptabletools/adaptable 23.0.19 → 23.0.21
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 +1 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +1 -1
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +1 -0
- package/src/AdaptableOptions/FilterOptions.d.ts +8 -0
- package/src/AdaptableOptions/LayoutOptions.d.ts +25 -1
- package/src/AdaptableState/InitialState.d.ts +1 -1
- package/src/AdaptableState/LayoutState.d.ts +3 -1
- package/src/Api/Implementation/FormatColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/FormatColumnApiImpl.js +15 -0
- package/src/Api/Implementation/FreeTextColumnApiImpl.js +0 -3
- package/src/Api/Implementation/StateApiImpl.d.ts +2 -0
- package/src/Api/Implementation/StateApiImpl.js +15 -0
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +7 -1
- package/src/Api/Internal/ColumnFilterInternalApi.js +3 -0
- package/src/Api/Internal/FormatColumnInternalApi.d.ts +5 -0
- package/src/Api/Internal/FormatColumnInternalApi.js +22 -0
- package/src/Api/Internal/StateInternalApi.d.ts +6 -1
- package/src/Api/Internal/StateInternalApi.js +44 -0
- package/src/Api/StateApi.d.ts +20 -0
- package/src/Redux/Store/AdaptableReduxMerger.js +24 -6
- package/src/Redux/Store/AdaptableStore.js +1 -1
- package/src/Utilities/Helpers/SettingsPanelHelper.js +2 -2
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +9 -40
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +15 -13
- package/src/agGrid/AdaptableAgGrid.d.ts +13 -0
- package/src/agGrid/AdaptableAgGrid.js +51 -2
- package/src/agGrid/AdaptableFilterHandler.d.ts +5 -1
- package/src/agGrid/AdaptableFilterHandler.js +44 -0
- package/src/components/Combobox/comboboxUtils.d.ts +6 -0
- package/src/components/Combobox/comboboxUtils.js +1 -1
- package/src/components/Combobox/index.js +11 -2
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.d.ts +12 -2
- package/src/layout-manager/src/index.js +46 -8
- package/src/types.d.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -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
|
/**
|
|
@@ -279,6 +291,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
279
291
|
autoSizeColumns(columnIds?: string[]): void;
|
|
280
292
|
autoSizeAllColumns(): void;
|
|
281
293
|
getDistinctValuesForColumn(column: AdaptableColumn): Promise<GridCell[]>;
|
|
294
|
+
private getSelectedInFilterValues;
|
|
282
295
|
getDistinctFilterValuesForColumn(options: {
|
|
283
296
|
column: AdaptableColumn;
|
|
284
297
|
currentSearchValue: string;
|
|
@@ -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;
|
|
@@ -2339,6 +2372,18 @@ export class AdaptableAgGrid {
|
|
|
2339
2372
|
async getDistinctValuesForColumn(column) {
|
|
2340
2373
|
return this.getDistinctGridCellsForColumn(column);
|
|
2341
2374
|
}
|
|
2375
|
+
getSelectedInFilterValues(column) {
|
|
2376
|
+
const columnFilterApi = this.api.filterApi.columnFilterApi;
|
|
2377
|
+
const columnFilter = columnFilterApi.getColumnFilterForColumn(column.columnId);
|
|
2378
|
+
const filterHandler = columnFilterApi.internalApi.getAdaptableFilterHandler(column.columnId);
|
|
2379
|
+
const inputs = (columnFilter?.Predicates ?? [])
|
|
2380
|
+
.filter((predicate) => predicate.PredicateId === 'In' || predicate.PredicateId === 'NotIn')
|
|
2381
|
+
.flatMap((predicate) => (Array.isArray(predicate.Inputs) ? predicate.Inputs : []));
|
|
2382
|
+
return inputs.map((value) => {
|
|
2383
|
+
const known = filterHandler?.getRememberedLazyInFilterValue(value);
|
|
2384
|
+
return known ?? { value, label: value == null ? '' : String(value) };
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2342
2387
|
async getDistinctFilterValuesForColumn(options) {
|
|
2343
2388
|
const { column, previousResult } = options;
|
|
2344
2389
|
const offset = options.offset ?? 0;
|
|
@@ -2393,6 +2438,9 @@ export class AdaptableAgGrid {
|
|
|
2393
2438
|
previousFilterResult: previousResult,
|
|
2394
2439
|
offset,
|
|
2395
2440
|
limit,
|
|
2441
|
+
get selectedValues() {
|
|
2442
|
+
return self.getSelectedInFilterValues(column);
|
|
2443
|
+
},
|
|
2396
2444
|
get currentSearchValue() {
|
|
2397
2445
|
return options.currentSearchValue;
|
|
2398
2446
|
},
|
|
@@ -3334,6 +3382,7 @@ export class AdaptableAgGrid {
|
|
|
3334
3382
|
this.__prevLayoutForRefresh = undefined;
|
|
3335
3383
|
this.layoutManager?.destroy();
|
|
3336
3384
|
this.layoutManager = null;
|
|
3385
|
+
this.rowSelectionCheckboxesOverride = null;
|
|
3337
3386
|
clearPredicateDefMapMemo();
|
|
3338
3387
|
const agGridApi = this.agGridAdapter?.getAgGridApi();
|
|
3339
3388
|
if (agGridApi && !agGridApi.isDestroyed()) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { DoesFilterPassParams, FilterHandler, FilterHandlerParams } from 'ag-grid-enterprise';
|
|
2
2
|
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
3
|
-
import { InFilterValueResult } from '../AdaptableOptions/FilterOptions';
|
|
3
|
+
import { InFilterValue, InFilterValueResult } from '../AdaptableOptions/FilterOptions';
|
|
4
4
|
import { ColumnFilter } from '../types';
|
|
5
5
|
export declare class AdaptableFilterHandler implements FilterHandler<any, any, ColumnFilter> {
|
|
6
6
|
private adaptableApi;
|
|
7
7
|
colId: string;
|
|
8
8
|
private filterDisplayValuesResult;
|
|
9
9
|
private previousFilterDisplayValuesResult;
|
|
10
|
+
private rememberedInFilterValues;
|
|
10
11
|
constructor(adaptableApi: AdaptableApi);
|
|
11
12
|
init(params: FilterHandlerParams): void;
|
|
12
13
|
doesFilterPass(params: DoesFilterPassParams<any, any, ColumnFilter>): boolean;
|
|
@@ -22,6 +23,9 @@ export declare class AdaptableFilterHandler implements FilterHandler<any, any, C
|
|
|
22
23
|
offset?: number;
|
|
23
24
|
limit?: number;
|
|
24
25
|
}): Promise<InFilterValueResult>;
|
|
26
|
+
private rememberSelectedLazyInFilterValues;
|
|
27
|
+
getRememberedLazyInFilterValues(): InFilterValue[];
|
|
28
|
+
getRememberedLazyInFilterValue(value: any): InFilterValue | undefined;
|
|
25
29
|
onNewRowsLoaded(): void;
|
|
26
30
|
onAnyFilterChanged(): void;
|
|
27
31
|
resetFilterDisplayValues(): void;
|
|
@@ -3,6 +3,7 @@ export class AdaptableFilterHandler {
|
|
|
3
3
|
colId;
|
|
4
4
|
filterDisplayValuesResult;
|
|
5
5
|
previousFilterDisplayValuesResult;
|
|
6
|
+
rememberedInFilterValues = new Map();
|
|
6
7
|
constructor(adaptableApi) {
|
|
7
8
|
this.adaptableApi = adaptableApi;
|
|
8
9
|
}
|
|
@@ -44,6 +45,7 @@ export class AdaptableFilterHandler {
|
|
|
44
45
|
return this.fetchFilterDisplayValues(options);
|
|
45
46
|
}
|
|
46
47
|
async fetchFilterDisplayValues(options) {
|
|
48
|
+
this.rememberSelectedLazyInFilterValues(undefined);
|
|
47
49
|
return this.adaptableApi.gridApi.internalApi
|
|
48
50
|
.getDistinctFilterDisplayValuesForColumn({
|
|
49
51
|
columnId: this.colId,
|
|
@@ -55,10 +57,51 @@ export class AdaptableFilterHandler {
|
|
|
55
57
|
limit: options.limit,
|
|
56
58
|
})
|
|
57
59
|
.then((result) => {
|
|
60
|
+
this.rememberSelectedLazyInFilterValues(result);
|
|
58
61
|
this.filterDisplayValuesResult = result;
|
|
59
62
|
return result;
|
|
60
63
|
});
|
|
61
64
|
}
|
|
65
|
+
rememberSelectedLazyInFilterValues(result) {
|
|
66
|
+
if (!this.adaptableApi.optionsApi.getFilterOptions().customInFilterValues) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const paginatedResult = result ?? this.getLastCachedFilterDisplayValues();
|
|
70
|
+
if (paginatedResult?.hasMore === undefined) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const columnFilter = this.adaptableApi.filterApi.columnFilterApi.getColumnFilterForColumn(this.colId);
|
|
74
|
+
const selectedInputs = new Set((columnFilter?.Predicates ?? [])
|
|
75
|
+
.filter((predicate) => predicate.PredicateId === 'In' || predicate.PredicateId === 'NotIn')
|
|
76
|
+
.flatMap((predicate) => (Array.isArray(predicate.Inputs) ? predicate.Inputs : [])));
|
|
77
|
+
for (const value of this.rememberedInFilterValues.keys()) {
|
|
78
|
+
if (!selectedInputs.has(value)) {
|
|
79
|
+
this.rememberedInFilterValues.delete(value);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!selectedInputs.size) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const visit = (values) => {
|
|
86
|
+
if (!values) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
for (const item of values) {
|
|
90
|
+
if (selectedInputs.has(item.value)) {
|
|
91
|
+
this.rememberedInFilterValues.set(item.value, item);
|
|
92
|
+
}
|
|
93
|
+
visit(item.children);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
visit(this.getLastCachedFilterDisplayValues()?.values);
|
|
97
|
+
visit(result?.values);
|
|
98
|
+
}
|
|
99
|
+
getRememberedLazyInFilterValues() {
|
|
100
|
+
return Array.from(this.rememberedInFilterValues.values());
|
|
101
|
+
}
|
|
102
|
+
getRememberedLazyInFilterValue(value) {
|
|
103
|
+
return this.rememberedInFilterValues.get(value);
|
|
104
|
+
}
|
|
62
105
|
onNewRowsLoaded() {
|
|
63
106
|
this.resetFilterDisplayValues();
|
|
64
107
|
}
|
|
@@ -83,5 +126,6 @@ export class AdaptableFilterHandler {
|
|
|
83
126
|
destroy() {
|
|
84
127
|
this.filterDisplayValuesResult = undefined;
|
|
85
128
|
this.previousFilterDisplayValuesResult = undefined;
|
|
129
|
+
this.rememberedInFilterValues.clear();
|
|
86
130
|
}
|
|
87
131
|
}
|
|
@@ -57,6 +57,12 @@ export type ComboboxCommonProps<T extends ComboboxItemType> = {
|
|
|
57
57
|
* is cleared on close and every open starts from the full list.
|
|
58
58
|
*/
|
|
59
59
|
persistFilterOnReopen?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Extra items used only to resolve selected values that are not in `items`
|
|
62
|
+
* (e.g. selected In Filter values hidden by the current search page).
|
|
63
|
+
* Not shown in the dropdown list.
|
|
64
|
+
*/
|
|
65
|
+
lookupItems?: T[];
|
|
60
66
|
/**
|
|
61
67
|
* Custom filter function, or `null` to disable built-in filtering
|
|
62
68
|
* (e.g. when options are already filtered server-side).
|
|
@@ -17,7 +17,7 @@ export function valueToItem(stringValue, lookup) {
|
|
|
17
17
|
export function valueToItems(stringValues, lookup) {
|
|
18
18
|
if (stringValues == null)
|
|
19
19
|
return undefined;
|
|
20
|
-
return stringValues.map((v) => lookup.get(v)
|
|
20
|
+
return stringValues.map((v) => lookup.get(v) ?? { value: v, label: String(v ?? '') });
|
|
21
21
|
}
|
|
22
22
|
export function toStringValue(item) {
|
|
23
23
|
return item?.value ?? null;
|
|
@@ -196,9 +196,18 @@ const useGetAllItems = (props) => {
|
|
|
196
196
|
?
|
|
197
197
|
[].concat(props.items)
|
|
198
198
|
: props.items;
|
|
199
|
+
const lookupItems = props.lookupItems;
|
|
199
200
|
const itemByValue = useMemo(() => {
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
const map = new Map(allItems.map((item) => [item.value, item]));
|
|
202
|
+
if (lookupItems) {
|
|
203
|
+
for (const item of lookupItems) {
|
|
204
|
+
if (!map.has(item.value)) {
|
|
205
|
+
map.set(item.value, item);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return map;
|
|
210
|
+
}, [allItems, lookupItems]);
|
|
202
211
|
const creatableInput = useCreatable(props, allItems, itemByValue);
|
|
203
212
|
const { inputValue, onInputValueChange } = useMenulistFilterInput(props, {
|
|
204
213
|
inputValue: creatableInput.inputValue,
|
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:
|
|
4
|
-
VERSION: "23.0.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1787139899825 || Date.now(),
|
|
4
|
+
VERSION: "23.0.21" || '--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
|
-
|
|
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 (
|
|
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
|
|
1179
|
-
const
|
|
1180
|
-
if (
|
|
1197
|
+
rowSelection?.checkboxes !== prevRowSelection?.checkboxes) {
|
|
1198
|
+
const columnsToRefresh = this.getRowSelectionCheckboxColumnIds(rowSelection, layout);
|
|
1199
|
+
if (columnsToRefresh.length) {
|
|
1181
1200
|
this.gridApi.refreshCells({
|
|
1182
|
-
columns:
|
|
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';
|