@adaptabletools/adaptable-cjs 20.1.4 → 20.1.6
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/base.css +1 -0
- package/base.css.map +1 -1
- package/index.css +1 -0
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -1
- package/src/AdaptableState/Common/AdaptableFilterState.d.ts +1 -1
- package/src/AdaptableState/Common/AdaptableSortState.d.ts +8 -3
- package/src/Api/CustomSortApi.d.ts +19 -9
- package/src/Api/GridApi.d.ts +3 -3
- package/src/Api/Implementation/CustomSortApiImpl.d.ts +3 -0
- package/src/Api/Implementation/CustomSortApiImpl.js +36 -0
- package/src/Api/Implementation/LayoutApiImpl.js +1 -1
- package/src/Api/Implementation/LayoutHelpers.d.ts +3 -3
- package/src/Api/Implementation/LayoutHelpers.js +126 -79
- package/src/Api/Implementation/StateApiImpl.d.ts +1 -2
- package/src/Api/Implementation/StateApiImpl.js +2 -4
- package/src/Api/Internal/EventInternalApi.d.ts +1 -1
- package/src/Api/Internal/EventInternalApi.js +11 -9
- package/src/Redux/ActionsReducers/LayoutRedux.js +24 -1
- package/src/Redux/Store/AdaptableStore.js +7 -4
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -1
- package/src/agGrid/AdaptableAgGrid.d.ts +7 -10
- package/src/agGrid/AdaptableAgGrid.js +80 -108
- package/src/components/ExpressionEditor/BaseEditorInput.js +2 -0
- package/src/components/Select/Select.d.ts +1 -0
- package/src/components/Select/Select.js +41 -15
- package/src/env.js +2 -2
- package/src/layout-manager/src/LayoutManagerModel.d.ts +29 -2
- package/src/layout-manager/src/index.d.ts +3 -0
- package/src/layout-manager/src/index.js +101 -30
- package/src/layout-manager/src/isLayoutEqual.js +11 -2
- package/src/layout-manager/src/normalizeLayoutModel.js +6 -0
- package/src/layout-manager/src/simplifyLayoutModel.js +3 -3
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -220,15 +220,43 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
220
220
|
}
|
|
221
221
|
this.triggerGridLayoutChange(layout);
|
|
222
222
|
}
|
|
223
|
-
triggerGridLayoutChange(layout) {
|
|
223
|
+
triggerGridLayoutChange(layout, prevLayout = this._prevFiredLayout, options) {
|
|
224
224
|
layout = (0, simplifyLayoutModel_1.simplifyLayoutModel)(layout);
|
|
225
|
-
|
|
225
|
+
prevLayout = prevLayout ? (0, simplifyLayoutModel_1.simplifyLayoutModel)(prevLayout) : undefined;
|
|
226
|
+
const shouldSkipTriggerChange = options?.skipTriggerChange === true;
|
|
226
227
|
this._prevFiredLayout = layout;
|
|
227
228
|
this.currentLayout = layout;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
if ((!prevLayout?.RowGroupedColumns || !prevLayout?.RowGroupedColumns.length) &&
|
|
230
|
+
layout.RowGroupedColumns &&
|
|
231
|
+
layout.RowGroupedColumns.length > 0 &&
|
|
232
|
+
layout.RowGroupValues) {
|
|
233
|
+
// most likely the user has changed grouping via some AG Grid action
|
|
234
|
+
// and we need to make sure the expand/collapse state is applied
|
|
235
|
+
// but we want to suspend the listener
|
|
236
|
+
// as it would re-trigger another change
|
|
237
|
+
const unsupress = this.suspendAgGridListener();
|
|
238
|
+
this.applyRowGroupValues(layout.RowGroupValues);
|
|
239
|
+
unsupress();
|
|
240
|
+
}
|
|
241
|
+
if ((!prevLayout?.RowGroupedColumns || !prevLayout?.RowGroupedColumns.length) &&
|
|
242
|
+
layout.RowGroupedColumns &&
|
|
243
|
+
layout.RowGroupedColumns.length > 0 &&
|
|
244
|
+
layout.RowGroupValues) {
|
|
245
|
+
// most likely the user has changed grouping via some AG Grid action
|
|
246
|
+
// and we need to make sure the expand/collapse state is applied
|
|
247
|
+
// but we want to suspend the listener
|
|
248
|
+
// as it would re-trigger another change
|
|
249
|
+
const unsupress = this.suspendAgGridListener();
|
|
250
|
+
this.applyRowGroupValues(layout.RowGroupValues);
|
|
251
|
+
unsupress();
|
|
252
|
+
}
|
|
253
|
+
if (!shouldSkipTriggerChange) {
|
|
254
|
+
// emit an event that the layout has changed from the grid
|
|
255
|
+
this.emitSync('gridLayoutChanged', layout);
|
|
256
|
+
const log = this.debugger.extend('gridLayoutChanged');
|
|
257
|
+
const changes = (0, isLayoutEqual_1.getChanges)(prevLayout, layout);
|
|
258
|
+
log('current grid layout:', JSON.stringify(layout, null, 2), '\nprev layout:\n', prevLayout ? JSON.stringify(prevLayout, null, 2) : 'no prev layout', '\nchanges from prev to current:\n', changes);
|
|
259
|
+
}
|
|
232
260
|
}
|
|
233
261
|
onChange(fn) {
|
|
234
262
|
return this.on('gridLayoutChanged', fn);
|
|
@@ -263,6 +291,17 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
263
291
|
}
|
|
264
292
|
delete layout.TableColumns;
|
|
265
293
|
const pivotLayout = {
|
|
294
|
+
Ignore_Name: layout.Ignore_Name,
|
|
295
|
+
Ignore_GridFilter: layout.Ignore_GridFilter,
|
|
296
|
+
Ignore_ColumnFilters: layout.Ignore_ColumnFilters,
|
|
297
|
+
Ignore_ColumnHeaders: layout.Ignore_ColumnHeaders,
|
|
298
|
+
Ignore_AutoSizeColumns: layout.Ignore_AutoSizeColumns,
|
|
299
|
+
Ignore_RowSummaries: layout.Ignore_RowSummaries,
|
|
300
|
+
Ignore_IsReadOnly: layout.Ignore_IsReadOnly,
|
|
301
|
+
Ignore_Tags: layout.Ignore_Tags,
|
|
302
|
+
Ignore_Source: layout.Ignore_Source,
|
|
303
|
+
Ignore_AdaptableVersion: layout.Ignore_AdaptableVersion,
|
|
304
|
+
Ignore_Uuid: layout.Ignore_Uuid,
|
|
266
305
|
PivotColumns,
|
|
267
306
|
ColumnPinning: layout.ColumnPinning,
|
|
268
307
|
ColumnSorts: layout.ColumnSorts,
|
|
@@ -426,6 +465,10 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
426
465
|
});
|
|
427
466
|
}
|
|
428
467
|
if (RowGroupedColumns && RowGroupedColumns.length) {
|
|
468
|
+
// if it's a new grouping, try and take it
|
|
469
|
+
const isGroupingNew = RowGroupedColumns &&
|
|
470
|
+
!this.currentLayout?.RowGroupedColumns &&
|
|
471
|
+
!this.currentLayout?.PivotGroupedColumns;
|
|
429
472
|
if (this.currentLayout?.RowGroupValues) {
|
|
430
473
|
const currentRowGroupValues = this.currentLayout.RowGroupValues;
|
|
431
474
|
if (currentRowGroupValues.RowGroupDisplay === 'always-collapsed') {
|
|
@@ -439,18 +482,22 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
439
482
|
};
|
|
440
483
|
}
|
|
441
484
|
else if (currentRowGroupValues.RowGroupDisplay === 'collapsed') {
|
|
442
|
-
const ExpandedValues =
|
|
443
|
-
|
|
444
|
-
|
|
485
|
+
const ExpandedValues = isGroupingNew
|
|
486
|
+
? currentRowGroupValues.Values || []
|
|
487
|
+
: this.getRowGroupNodePathsAs({
|
|
488
|
+
expanded: true,
|
|
489
|
+
});
|
|
445
490
|
RowGroupValues = {
|
|
446
491
|
RowGroupDisplay: 'collapsed',
|
|
447
492
|
Values: ExpandedValues,
|
|
448
493
|
};
|
|
449
494
|
}
|
|
450
495
|
else if (currentRowGroupValues.RowGroupDisplay === 'expanded') {
|
|
451
|
-
const CollapsedValues =
|
|
452
|
-
|
|
453
|
-
|
|
496
|
+
const CollapsedValues = isGroupingNew
|
|
497
|
+
? currentRowGroupValues.Values || []
|
|
498
|
+
: this.getRowGroupNodePathsAs({
|
|
499
|
+
expanded: false,
|
|
500
|
+
});
|
|
454
501
|
RowGroupValues = {
|
|
455
502
|
RowGroupDisplay: 'expanded',
|
|
456
503
|
Values: CollapsedValues,
|
|
@@ -458,7 +505,23 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
458
505
|
}
|
|
459
506
|
}
|
|
460
507
|
}
|
|
508
|
+
else {
|
|
509
|
+
if (this.currentLayout?.RowGroupValues) {
|
|
510
|
+
RowGroupValues = this.currentLayout.RowGroupValues;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
461
513
|
const layout = (0, simplifyLayoutModel_1.simplifyTableLayoutModel)({
|
|
514
|
+
Ignore_Name: this.currentLayout?.Ignore_Name || 'Default',
|
|
515
|
+
Ignore_GridFilter: this.currentLayout?.Ignore_GridFilter,
|
|
516
|
+
Ignore_ColumnFilters: this.currentLayout?.Ignore_ColumnFilters,
|
|
517
|
+
Ignore_ColumnHeaders: this.currentLayout?.Ignore_ColumnHeaders,
|
|
518
|
+
Ignore_AutoSizeColumns: this.currentLayout?.Ignore_AutoSizeColumns,
|
|
519
|
+
Ignore_RowSummaries: this.currentLayout?.Ignore_RowSummaries,
|
|
520
|
+
Ignore_IsReadOnly: this.currentLayout?.Ignore_IsReadOnly,
|
|
521
|
+
Ignore_Tags: this.currentLayout?.Ignore_Tags,
|
|
522
|
+
Ignore_Source: this.currentLayout?.Ignore_Source,
|
|
523
|
+
Ignore_AdaptableVersion: this.currentLayout?.Ignore_AdaptableVersion,
|
|
524
|
+
Ignore_Uuid: this.currentLayout?.Ignore_Uuid,
|
|
462
525
|
TableColumns: TableColumns,
|
|
463
526
|
ColumnVisibility,
|
|
464
527
|
ColumnWidths: ColumnWidths,
|
|
@@ -671,18 +734,39 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
671
734
|
}
|
|
672
735
|
setLayout(layout, options) {
|
|
673
736
|
layout = (0, normalizeLayoutModel_1.normalizeLayoutModel)(layout, { isTree: this.isTreeMode() });
|
|
737
|
+
const shouldSkipTriggerChange = options?.skipTriggerChange === true;
|
|
674
738
|
const shouldSkipEqualityCheck = options?.force === true;
|
|
675
739
|
if (!shouldSkipEqualityCheck && (0, isLayoutEqual_1.isLayoutEqual)(this.currentLayout, layout)) {
|
|
676
740
|
return false;
|
|
677
741
|
}
|
|
742
|
+
const prevCurrent = this.currentLayout;
|
|
678
743
|
this.silentSetCurrentLayout(layout);
|
|
679
744
|
this.applyLayout(layout, options);
|
|
680
|
-
this.triggerGridLayoutChange(layout
|
|
745
|
+
this.triggerGridLayoutChange(layout, prevCurrent, {
|
|
746
|
+
skipTriggerChange: shouldSkipTriggerChange,
|
|
747
|
+
});
|
|
681
748
|
return true;
|
|
682
749
|
}
|
|
683
750
|
isCurrentLayoutPivot() {
|
|
684
751
|
return this.currentLayout && (0, isPivotLayoutModel_1.isPivotLayoutModel)(this.currentLayout);
|
|
685
752
|
}
|
|
753
|
+
suspendAgGridListener() {
|
|
754
|
+
if (this.supressGlobalAgGridEventTimeoutId) {
|
|
755
|
+
clearTimeout(this.supressGlobalAgGridEventTimeoutId);
|
|
756
|
+
this.supressGlobalAgGridEventTimeoutId = null;
|
|
757
|
+
}
|
|
758
|
+
this.suppressGlobalAgGridEventListener = true;
|
|
759
|
+
return () => this.resumeAgGridListener();
|
|
760
|
+
}
|
|
761
|
+
resumeAgGridListener(options) {
|
|
762
|
+
if (options?.immediate) {
|
|
763
|
+
this.suppressGlobalAgGridEventListener = false;
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
this.supressGlobalAgGridEventTimeoutId = setTimeout(() => {
|
|
767
|
+
this.suppressGlobalAgGridEventListener = false;
|
|
768
|
+
}, 0);
|
|
769
|
+
}
|
|
686
770
|
applyLayout(layout, options) {
|
|
687
771
|
this.warn('applyLayout', layout);
|
|
688
772
|
// we want to do this supress/unsupress thing
|
|
@@ -691,16 +775,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
691
775
|
// yes, we do check for same layout and bail out if it is the same
|
|
692
776
|
// but we still want to avoid this unnecessary initial loop
|
|
693
777
|
// which may cause more adaptable work
|
|
694
|
-
|
|
695
|
-
clearTimeout(this.supressGlobalAgGridEventTimeoutId);
|
|
696
|
-
this.supressGlobalAgGridEventTimeoutId = null;
|
|
697
|
-
}
|
|
698
|
-
const unsuppress = () => {
|
|
699
|
-
this.supressGlobalAgGridEventTimeoutId = setTimeout(() => {
|
|
700
|
-
this.suppressGlobalAgGridEventListener = false;
|
|
701
|
-
}, 0);
|
|
702
|
-
};
|
|
703
|
-
this.suppressGlobalAgGridEventListener = true;
|
|
778
|
+
const resume = this.suspendAgGridListener();
|
|
704
779
|
const pivotMode = this.gridApi.isPivotMode();
|
|
705
780
|
if (!!layout.SuppressAggFuncInHeader !== !!this.gridApi.getGridOption('suppressAggFuncInHeader')) {
|
|
706
781
|
this.gridApi.setGridOption('suppressAggFuncInHeader', !!layout.SuppressAggFuncInHeader);
|
|
@@ -724,7 +799,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
724
799
|
perfApplyPivot.end();
|
|
725
800
|
}
|
|
726
801
|
finally {
|
|
727
|
-
|
|
802
|
+
resume();
|
|
728
803
|
}
|
|
729
804
|
return;
|
|
730
805
|
}
|
|
@@ -737,7 +812,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
737
812
|
perfApplyTable.end();
|
|
738
813
|
}
|
|
739
814
|
finally {
|
|
740
|
-
|
|
815
|
+
resume();
|
|
741
816
|
}
|
|
742
817
|
}
|
|
743
818
|
applyTableLayout(layout, options) {
|
|
@@ -824,7 +899,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
824
899
|
}
|
|
825
900
|
computeColumnStateForPivotLayout(layout) {
|
|
826
901
|
let columnState = {};
|
|
827
|
-
const pivotColumnsToIndexes = layout.PivotColumns.reduce((acc, colId, index) => {
|
|
902
|
+
const pivotColumnsToIndexes = (layout.PivotColumns || []).reduce((acc, colId, index) => {
|
|
828
903
|
acc[colId] = index;
|
|
829
904
|
return acc;
|
|
830
905
|
}, {});
|
|
@@ -837,10 +912,6 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
837
912
|
...layout.PivotColumns,
|
|
838
913
|
...(layout.PivotAggregationColumns || []).map((col) => col.ColumnId),
|
|
839
914
|
], this.gridApi.getColumnDefs());
|
|
840
|
-
const pivotAggsToIndexes = layout.PivotAggregationColumns.reduce((acc, { ColumnId }, index) => {
|
|
841
|
-
acc[ColumnId] = index;
|
|
842
|
-
return acc;
|
|
843
|
-
}, {});
|
|
844
915
|
columnState.state = columnIds.map((columnId) => {
|
|
845
916
|
const pivotIndex = pivotColumnsToIndexes[columnId];
|
|
846
917
|
const rowGroupIndex = rowGroupColumnIndexes[columnId];
|
|
@@ -54,8 +54,17 @@ function isTableLayoutEqual(l1, l2) {
|
|
|
54
54
|
exports.isTableLayoutEqual = isTableLayoutEqual;
|
|
55
55
|
//#clearIgnoredProperties
|
|
56
56
|
function clearIgnoredProperties(layout) {
|
|
57
|
-
delete layout.
|
|
58
|
-
delete layout.
|
|
57
|
+
delete layout.Ignore_GridFilter;
|
|
58
|
+
delete layout.Ignore_ColumnFilters;
|
|
59
|
+
delete layout.Ignore_Name;
|
|
60
|
+
delete layout.Ignore_ColumnHeaders;
|
|
61
|
+
delete layout.Ignore_AutoSizeColumns;
|
|
62
|
+
delete layout.Ignore_RowSummaries;
|
|
63
|
+
delete layout.Ignore_IsReadOnly;
|
|
64
|
+
delete layout.Ignore_Tags;
|
|
65
|
+
delete layout.Ignore_Source;
|
|
66
|
+
delete layout.Ignore_AdaptableVersion;
|
|
67
|
+
delete layout.Ignore_Uuid;
|
|
59
68
|
}
|
|
60
69
|
function isPivotLayoutEqual(l1, l2) {
|
|
61
70
|
l1 = (0, normalizeLayoutModel_1.normalizePivotLayoutModel)(l1);
|
|
@@ -17,6 +17,9 @@ function normalizeTableLayoutModel(layout, options) {
|
|
|
17
17
|
if (!layout.TableAggregationColumns) {
|
|
18
18
|
layout.TableAggregationColumns = [];
|
|
19
19
|
}
|
|
20
|
+
if (!layout.Ignore_ColumnFilters) {
|
|
21
|
+
layout.Ignore_ColumnFilters = [];
|
|
22
|
+
}
|
|
20
23
|
if (!layout.ColumnSorts) {
|
|
21
24
|
layout.ColumnSorts = [];
|
|
22
25
|
}
|
|
@@ -118,6 +121,9 @@ function normalizePivotLayoutModel(layout) {
|
|
|
118
121
|
if (!layout.ColumnVisibility) {
|
|
119
122
|
layout.ColumnVisibility = {};
|
|
120
123
|
}
|
|
124
|
+
if (!layout.Ignore_ColumnFilters) {
|
|
125
|
+
layout.Ignore_ColumnFilters = [];
|
|
126
|
+
}
|
|
121
127
|
if (!layout.PivotAggregationColumns) {
|
|
122
128
|
layout.PivotAggregationColumns = [];
|
|
123
129
|
}
|
|
@@ -14,6 +14,9 @@ function simplifyTableLayoutModel(layout) {
|
|
|
14
14
|
if (layout.ColumnSorts && !layout.ColumnSorts.length) {
|
|
15
15
|
delete layout.ColumnSorts;
|
|
16
16
|
}
|
|
17
|
+
if (layout.Ignore_ColumnFilters && !layout.Ignore_ColumnFilters) {
|
|
18
|
+
delete layout.Ignore_ColumnFilters;
|
|
19
|
+
}
|
|
17
20
|
if (layout.RowGroupedColumns && !layout.RowGroupedColumns.length) {
|
|
18
21
|
delete layout.RowGroupedColumns;
|
|
19
22
|
}
|
|
@@ -76,9 +79,6 @@ function simplifyPivotLayoutModel(layout) {
|
|
|
76
79
|
if (layout.ColumnSorts && !layout.ColumnSorts.length) {
|
|
77
80
|
delete layout.ColumnSorts;
|
|
78
81
|
}
|
|
79
|
-
if (!layout.PivotGroupedColumns && layout.RowGroupValues) {
|
|
80
|
-
delete layout.RowGroupValues;
|
|
81
|
-
}
|
|
82
82
|
if (layout.GrandTotalRow === undefined) {
|
|
83
83
|
delete layout.GrandTotalRow;
|
|
84
84
|
}
|