@adaptabletools/adaptable 20.2.1 → 20.2.2

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.
Files changed (32) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableState/Common/AdaptableColumn.d.ts +4 -0
  3. package/src/AdaptableState/LayoutState.d.ts +16 -2
  4. package/src/AdaptableState/QuickSearchState.d.ts +5 -5
  5. package/src/Api/Implementation/ColumnApiImpl.js +1 -0
  6. package/src/Api/Implementation/LayoutHelpers.d.ts +3 -0
  7. package/src/Api/Implementation/LayoutHelpers.js +76 -40
  8. package/src/Api/Implementation/QuickSearchApiImpl.d.ts +2 -2
  9. package/src/Api/Implementation/QuickSearchApiImpl.js +4 -4
  10. package/src/Api/Internal/FormatColumnInternalApi.d.ts +1 -1
  11. package/src/Api/Internal/FormatColumnInternalApi.js +4 -4
  12. package/src/Api/QuickSearchApi.d.ts +2 -2
  13. package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +4 -4
  14. package/src/Redux/ActionsReducers/QuickSearchRedux.js +7 -7
  15. package/src/Redux/Store/AdaptableStore.js +1 -1
  16. package/src/View/Components/StyleComponent.d.ts +1 -0
  17. package/src/View/Components/StyleComponent.js +2 -1
  18. package/src/View/Layout/Wizard/sections/ColumnsSection.js +27 -8
  19. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +2 -2
  20. package/src/View/QuickSearch/QuickSearchPopup.d.ts +1 -1
  21. package/src/View/QuickSearch/QuickSearchPopup.js +7 -4
  22. package/src/agGrid/AdaptableAgGrid.js +20 -9
  23. package/src/agGrid/AgGridAdapter.js +6 -1
  24. package/src/agGrid/AgGridColumnAdapter.js +10 -8
  25. package/src/env.js +2 -2
  26. package/src/layout-manager/src/LayoutManagerModel.d.ts +17 -4
  27. package/src/layout-manager/src/index.d.ts +1 -1
  28. package/src/layout-manager/src/index.js +61 -18
  29. package/src/metamodel/adaptable.metamodel.d.ts +10 -0
  30. package/src/metamodel/adaptable.metamodel.js +1 -1
  31. package/src/types.d.ts +1 -1
  32. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -90,7 +90,7 @@ import { weightedAverage } from '../Utilities/weightedAverage';
90
90
  import { ROW_SUMMARY_ROW_ID } from '../AdaptableState/Common/RowSummary';
91
91
  import { FlashingCellService } from '../Utilities/Services/FlashingCellService';
92
92
  import { AgGridExportAdapter } from './AgGridExportAdapter';
93
- import { checkForDuplicateColumns, isPivotLayout, layoutModelToLayoutState, layoutStateToLayoutModel, normalizeLayout, } from '../Api/Implementation/LayoutHelpers';
93
+ import { checkForDuplicateColumns, getLayoutRowGroupValuesExceptionGroupKeys, isPivotLayout, layoutModelToLayoutState, layoutStateToLayoutModel, normalizeLayout, } from '../Api/Implementation/LayoutHelpers';
94
94
  import { LayoutManager } from '../layout-manager/src';
95
95
  import { isPivotLayoutModel } from '../layout-manager/src/isPivotLayoutModel';
96
96
  import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE, PIVOT_ANY_TOTAL_COLUMN_TYPE, PIVOT_COLUMN_TOTAL_COLUMN_TYPE, PIVOT_GRAND_TOTAL_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
@@ -449,7 +449,7 @@ export class AdaptableAgGrid {
449
449
  this.updateColumnModelAndRefreshGrid();
450
450
  }
451
451
  const layoutModelForApply = layoutStateToLayoutModel(currentLayout);
452
- this.layoutManager.applyRowGroupValues(layoutModelForApply.RowGroupValues);
452
+ this.layoutManager.applyRowGroupValues(layoutModelForApply.RowGroupValues, layoutModelForApply.RowGroupedColumns);
453
453
  this.layoutManager.applyColumnGroupCollapseExpandState(layoutModelForApply);
454
454
  this.autoSizeLayoutIfNeeded();
455
455
  this.ModuleService.createModuleUIItems();
@@ -2014,7 +2014,7 @@ You need to define at least one Layout!`);
2014
2014
  layout = this.api.layoutApi.getCurrentLayout();
2015
2015
  }
2016
2016
  const layoutModel = layoutStateToLayoutModel(layout);
2017
- this.layoutManager.applyRowGroupValues(layoutModel.RowGroupValues);
2017
+ this.layoutManager.applyRowGroupValues(layoutModel.RowGroupValues, layoutModel.RowGroupedColumns);
2018
2018
  }
2019
2019
  isGroupRowNode(rowNode) {
2020
2020
  if (!rowNode) {
@@ -3107,12 +3107,23 @@ You need to define at least one Layout!`);
3107
3107
  checkForDuplicateColumns(layout);
3108
3108
  const isLayoutSwitch = this._prevLayout && layout.Name != this._prevLayout.Name;
3109
3109
  let shouldUpdateExpandState = isLayoutSwitch;
3110
- if (!isLayoutSwitch &&
3111
- this._prevLayout &&
3112
- layout.RowGroupValues?.RowGroupDefaultBehavior &&
3113
- this._prevLayout?.RowGroupValues?.RowGroupDefaultBehavior !=
3114
- layout.RowGroupValues?.RowGroupDefaultBehavior) {
3115
- shouldUpdateExpandState = true;
3110
+ if (!isLayoutSwitch && this._prevLayout) {
3111
+ if (layout.RowGroupValues?.RowGroupDefaultBehavior &&
3112
+ this._prevLayout?.RowGroupValues?.RowGroupDefaultBehavior !=
3113
+ layout.RowGroupValues?.RowGroupDefaultBehavior) {
3114
+ shouldUpdateExpandState = true;
3115
+ }
3116
+ else {
3117
+ const prevLayoutExceptionGroupKeys = getLayoutRowGroupValuesExceptionGroupKeys(this._prevLayout)
3118
+ .flat()
3119
+ .join(',');
3120
+ const currentLayoutExceptionGroupKeys = getLayoutRowGroupValuesExceptionGroupKeys(layout)
3121
+ .flat()
3122
+ .join(',');
3123
+ if (prevLayoutExceptionGroupKeys !== currentLayoutExceptionGroupKeys) {
3124
+ shouldUpdateExpandState = true;
3125
+ }
3126
+ }
3116
3127
  }
3117
3128
  this._prevLayout = layout;
3118
3129
  const perfSetLayout = this.logger.beginPerf(`setLayout(${layout.Name})`);
@@ -425,6 +425,7 @@ export class AgGridAdapter {
425
425
  const isFdc3MainActionColumn = this.adaptableApi.fdc3Api.internalApi.isFdc3MainActionColumn(colId);
426
426
  let friendlyName;
427
427
  const isGeneratedRowGroupColumn = columnApi.isAutoRowGroupColumn(ColumnId);
428
+ const isGeneratedSelectionColumn = columnApi.isSelectionColumn(ColumnId);
428
429
  const isGeneratedPivotResultColumn = columnApi.isPivotResultColumn(ColumnId) && !agGridColumn.isPrimary();
429
430
  const colExists = columnApi.doesColumnExist(ColumnId) ||
430
431
  isGeneratedRowGroupColumn ||
@@ -464,7 +465,7 @@ export class AgGridAdapter {
464
465
  colDef.lockVisible === true &&
465
466
  colDef.suppressColumnsToolPanel === true &&
466
467
  colDef.suppressFiltersToolPanel === true;
467
- const isGenerated = isGeneratedRowGroupColumn || isGeneratedPivotResultColumn;
468
+ const isGenerated = isGeneratedRowGroupColumn || isGeneratedPivotResultColumn || isGeneratedSelectionColumn;
468
469
  const abColumn = {
469
470
  Uuid: createUuid(),
470
471
  isTreeColumn,
@@ -491,6 +492,7 @@ export class AgGridAdapter {
491
492
  hideable: this.isColumnHideable(colDef),
492
493
  isGrouped: isGenerated ? false : this.isColumnRowGrouped(colDef),
493
494
  isGeneratedRowGroupColumn,
495
+ isGeneratedSelectionColumn,
494
496
  isGeneratedPivotResultColumn,
495
497
  isFixed: this.isColumnFixed(colDef),
496
498
  pinned: this.getColumnPinnedPosition(colDef),
@@ -676,6 +678,9 @@ export class AgGridAdapter {
676
678
  this.adaptableApi.columnApi.isAutoRowGroupColumn(colDef.colId)) {
677
679
  return false;
678
680
  }
681
+ if (this.adaptableApi.columnApi.isSelectionColumn(colDef.colId)) {
682
+ return false;
683
+ }
679
684
  if (colDef.lockVisible != null && colDef.lockVisible == true) {
680
685
  return false;
681
686
  }
@@ -88,12 +88,16 @@ export class AgGridColumnAdapter {
88
88
  }
89
89
  shouldSkipColumn(colId) {
90
90
  /**
91
- * This skips columns like `ag-Grid-SelectionColumn` and possibly other columns
92
- * that ag grid will implement in the future
91
+ * This skips special columns that ag grid will likely implement in the future
93
92
  *
94
- * BUT DOES NOT SKIP GROUP COLUMNS!!!
93
+ * BUT DOES NOT SKIP GROUP COLUMNS or SELECTION COLUMNS!!!
94
+ *
95
+ * It's probably here for historical reasons - previously it used to skip the selection column
96
+ * but now it's not skipping it anymore
95
97
  */
96
- return colId.startsWith('ag-Grid-') && !this.adaptableApi.columnApi.isAutoRowGroupColumn(colId);
98
+ return (colId.startsWith('ag-Grid-') &&
99
+ !this.adaptableApi.columnApi.isAutoRowGroupColumn(colId) &&
100
+ !this.adaptableApi.columnApi.isSelectionColumn(colId));
97
101
  }
98
102
  setupColumns() {
99
103
  const pivotMode = this.agGridApi.isPivotMode();
@@ -153,10 +157,8 @@ export class AgGridColumnAdapter {
153
157
  setupColumnCellClass({ col, colId, abColumn }) {
154
158
  this.setColDefProperty(col, 'cellClass', (userCellClass) => {
155
159
  const formatColumns = this.adaptableApi.formatColumnApi.internalApi.getFormatColumnWithStyleClassNameForColumn(abColumn);
156
- const quickSearchStyleClassName = this.adaptableApi.quickSearchApi.getQuickSearchStyle().ClassName;
157
160
  const quickSearchTextMatchStyle = this.getQuickSearchTextMatchStyle();
158
161
  const quickSearchCurrentTextMatchStyle = this.getQuickSearchCurrentTextMatchStyle();
159
- const hasQuickSearchStyleClassName = StringExtensions.IsNotNullOrEmpty(quickSearchStyleClassName);
160
162
  const cellClass = (params) => {
161
163
  const gridCell = this.adaptableApi.gridApi.getGridCellFromRowNode(params.node, abColumn.columnId);
162
164
  if (!gridCell.column) {
@@ -183,7 +185,7 @@ export class AgGridColumnAdapter {
183
185
  !hasStyledColumn && formatColumns.length
184
186
  ? this.getFormatColumnCellClass(formatColumns, abColumn, params)
185
187
  : null,
186
- isQuickSearchActive && hasQuickSearchStyleClassName ? quickSearchStyleClassName : null,
188
+ // isQuickSearchActive && hasQuickSearchStyleClassName ? quickSearchStyleClassName : null,
187
189
  isQuickSearchActive && (quickSearchTextMatchStyle || quickSearchCurrentTextMatchStyle)
188
190
  ? 'ab-QuickSearchFind'
189
191
  : null,
@@ -848,7 +850,7 @@ export class AgGridColumnAdapter {
848
850
  return classNames;
849
851
  }
850
852
  getQuickSearchCellStyle() {
851
- const quickSearchStyle = this.adaptableApi.quickSearchApi.getQuickSearchStyle();
853
+ const quickSearchStyle = this.adaptableApi.quickSearchApi.getQuickSearchCellMatchStyle();
852
854
  if (!quickSearchStyle || StringExtensions.IsNotNullOrEmpty(quickSearchStyle.ClassName)) {
853
855
  return undefined;
854
856
  }
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: 1750416425464 || Date.now(),
4
- VERSION: "20.2.1" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1750862989331 || Date.now(),
4
+ VERSION: "20.2.2" || '--current-version--',
5
5
  };
@@ -1,3 +1,4 @@
1
+ import { XOR } from '../../Utilities/Extensions/TypeExtensions';
1
2
  /**
2
3
  * Defines how a Column is sorted
3
4
  */
@@ -64,15 +65,27 @@ export interface BaseLayoutModel {
64
65
  */
65
66
  RowGroupValues?: {
66
67
  RowGroupDisplay: 'always-expanded';
67
- } | {
68
+ } | ({
68
69
  RowGroupDisplay: 'expanded';
70
+ } & XOR<{
69
71
  Values: any[][];
70
- } | {
72
+ }, {
73
+ GroupKeys: {
74
+ RowGroupedColumns: string[];
75
+ Values?: any[][];
76
+ }[];
77
+ }>) | {
71
78
  RowGroupDisplay: 'always-collapsed';
72
- } | {
79
+ } | ({
73
80
  RowGroupDisplay: 'collapsed';
81
+ } & XOR<{
74
82
  Values: any[][];
75
- };
83
+ }, {
84
+ GroupKeys: {
85
+ RowGroupedColumns: string[];
86
+ Values?: any[][];
87
+ }[];
88
+ }>);
76
89
  /**
77
90
  * Behaviour for Expanding / Collapsing Column Groups
78
91
  */
@@ -62,7 +62,7 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
62
62
  private applyLayout;
63
63
  private applyTableLayout;
64
64
  private getRowGroupNodePathsAs;
65
- applyRowGroupValues(RowGroupValues: TableLayoutModel['RowGroupValues']): void;
65
+ applyRowGroupValues(RowGroupValues: TableLayoutModel['RowGroupValues'], rowGroupedColumns: string[]): void;
66
66
  private computeColumnStateForPivotLayout;
67
67
  private computePivotAggregations;
68
68
  private computeColumnStateForTableLayout;
@@ -232,7 +232,7 @@ export class LayoutManager extends LMEmitter {
232
232
  // but we want to suspend the listener
233
233
  // as it would re-trigger another change
234
234
  const unsupress = this.suspendAgGridListener();
235
- this.applyRowGroupValues(layout.RowGroupValues);
235
+ this.applyRowGroupValues(layout.RowGroupValues, layout.RowGroupedColumns);
236
236
  unsupress();
237
237
  }
238
238
  if ((!prevLayout?.RowGroupedColumns || !prevLayout?.RowGroupedColumns.length) &&
@@ -244,7 +244,7 @@ export class LayoutManager extends LMEmitter {
244
244
  // but we want to suspend the listener
245
245
  // as it would re-trigger another change
246
246
  const unsupress = this.suspendAgGridListener();
247
- this.applyRowGroupValues(layout.RowGroupValues);
247
+ this.applyRowGroupValues(layout.RowGroupValues, layout.RowGroupedColumns);
248
248
  unsupress();
249
249
  }
250
250
  if (!shouldSkipTriggerChange) {
@@ -331,9 +331,8 @@ export class LayoutManager extends LMEmitter {
331
331
  return this.gridApi.getGridOption('treeData');
332
332
  }
333
333
  getUndecidedLayoutModelFromGrid(columnState) {
334
- let TableColumns = columnState
335
- .map((c) => c.colId)
336
- .filter((colId) => colId !== 'ag-Grid-SelectionColumn');
334
+ let TableColumns = columnState.map((c) => c.colId);
335
+ // .filter((colId) => colId !== 'ag-Grid-SelectionColumn');
337
336
  let ColumnWidths = {};
338
337
  let ColumnSorts = [];
339
338
  let RowGroupedColumns = [];
@@ -496,10 +495,26 @@ export class LayoutManager extends LMEmitter {
496
495
  : this.getRowGroupNodePathsAs({
497
496
  expanded: true,
498
497
  });
499
- RowGroupValues = {
500
- RowGroupDisplay: 'collapsed',
501
- Values: ExpandedValues,
502
- };
498
+ if (Array.isArray(currentRowGroupValues.GroupKeys)) {
499
+ RowGroupValues = {
500
+ RowGroupDisplay: 'collapsed',
501
+ GroupKeys: currentRowGroupValues.GroupKeys.map((item) => {
502
+ if ((item.RowGroupedColumns || []).join(',') === (RowGroupedColumns || []).join(',')) {
503
+ return {
504
+ RowGroupedColumns: item.RowGroupedColumns,
505
+ Values: ExpandedValues,
506
+ };
507
+ }
508
+ return item;
509
+ }),
510
+ };
511
+ }
512
+ else {
513
+ RowGroupValues = {
514
+ RowGroupDisplay: 'collapsed',
515
+ Values: ExpandedValues,
516
+ };
517
+ }
503
518
  }
504
519
  else if (currentRowGroupValues.RowGroupDisplay === 'expanded') {
505
520
  const CollapsedValues = isGroupingNew
@@ -507,10 +522,26 @@ export class LayoutManager extends LMEmitter {
507
522
  : this.getRowGroupNodePathsAs({
508
523
  expanded: false,
509
524
  });
510
- RowGroupValues = {
511
- RowGroupDisplay: 'expanded',
512
- Values: CollapsedValues,
513
- };
525
+ if (Array.isArray(currentRowGroupValues.GroupKeys)) {
526
+ RowGroupValues = {
527
+ RowGroupDisplay: 'expanded',
528
+ GroupKeys: currentRowGroupValues.GroupKeys.map((item) => {
529
+ if ((item.RowGroupedColumns || []).join(',') === (RowGroupedColumns || []).join(',')) {
530
+ return {
531
+ RowGroupedColumns: item.RowGroupedColumns,
532
+ Values: CollapsedValues,
533
+ };
534
+ }
535
+ return item;
536
+ }),
537
+ };
538
+ }
539
+ else {
540
+ RowGroupValues = {
541
+ RowGroupDisplay: 'expanded',
542
+ Values: CollapsedValues,
543
+ };
544
+ }
514
545
  }
515
546
  }
516
547
  }
@@ -897,7 +928,7 @@ export class LayoutManager extends LMEmitter {
897
928
  this.gridApi.applyColumnState(this.computeColumnStateForTableLayout(layout));
898
929
  // but also let's not forget to apply the row group values
899
930
  if (hasGroupedColumns && layout.RowGroupValues && !options?.skipApplyRowGroupsExpandedState) {
900
- this.applyRowGroupValues(layout.RowGroupValues);
931
+ this.applyRowGroupValues(layout.RowGroupValues, layout.RowGroupedColumns);
901
932
  }
902
933
  this.applyColumnGroupCollapseExpandState(layout);
903
934
  });
@@ -921,7 +952,7 @@ export class LayoutManager extends LMEmitter {
921
952
  });
922
953
  return result;
923
954
  }
924
- applyRowGroupValues(RowGroupValues) {
955
+ applyRowGroupValues(RowGroupValues, rowGroupedColumns) {
925
956
  if (!RowGroupValues) {
926
957
  return;
927
958
  }
@@ -934,9 +965,21 @@ export class LayoutManager extends LMEmitter {
934
965
  return;
935
966
  }
936
967
  const defaultExpanded = RowGroupValues.RowGroupDisplay === 'expanded';
937
- if (RowGroupValues.Values) {
968
+ let currentRowGroupedValues = RowGroupValues.Values;
969
+ if (RowGroupValues.GroupKeys) {
970
+ const matchingRowGroupColumnValues = RowGroupValues.GroupKeys.find((item) => {
971
+ return (item.RowGroupedColumns || []).join(',') === (rowGroupedColumns || []).join(',');
972
+ });
973
+ if (matchingRowGroupColumnValues) {
974
+ currentRowGroupedValues = matchingRowGroupColumnValues.Values;
975
+ }
976
+ else {
977
+ currentRowGroupedValues = [];
978
+ }
979
+ }
980
+ if (currentRowGroupedValues) {
938
981
  const deepMap = new DeepMap();
939
- RowGroupValues.Values.forEach((rowGroupValue) => {
982
+ currentRowGroupedValues.forEach((rowGroupValue) => {
940
983
  deepMap.set(rowGroupValue, true);
941
984
  });
942
985
  this.gridApi.forEachNode((node) => {
@@ -1228,7 +1271,7 @@ export class LayoutManager extends LMEmitter {
1228
1271
  const hasGroupedColumns = layout.PivotGroupedColumns && layout.PivotGroupedColumns.length;
1229
1272
  // but also let's not forget to apply the row group values
1230
1273
  if (hasGroupedColumns && layout.RowGroupValues && !options?.skipApplyRowGroupsExpandedState) {
1231
- this.applyRowGroupValues(layout.RowGroupValues);
1274
+ this.applyRowGroupValues(layout.RowGroupValues, layout.PivotGroupedColumns);
1232
1275
  }
1233
1276
  }
1234
1277
  applyPivotTotals(layout) {
@@ -2005,6 +2005,16 @@ export declare const ADAPTABLE_METAMODEL: {
2005
2005
  kind: string;
2006
2006
  desc: string;
2007
2007
  };
2008
+ ColumnGroupValues: {
2009
+ name: string;
2010
+ kind: string;
2011
+ desc: string;
2012
+ };
2013
+ ColumnGroupValuesWithExceptionKeys: {
2014
+ name: string;
2015
+ kind: string;
2016
+ desc: string;
2017
+ };
2008
2018
  ColumnMenuContext: {
2009
2019
  name: string;
2010
2020
  kind: string;