@adaptabletools/adaptable 20.0.7-canary.1 → 20.0.7-canary.3

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 (48) hide show
  1. package/agGrid.d.ts +37 -0
  2. package/agGrid.js +38 -0
  3. package/base.css +19 -3
  4. package/base.css.map +1 -1
  5. package/index.css +17 -3
  6. package/index.css.map +1 -1
  7. package/package.json +3 -3
  8. package/src/AdaptableOptions/LayoutOptions.d.ts +3 -6
  9. package/src/AdaptableState/Common/AdaptableColumn.d.ts +14 -5
  10. package/src/AdaptableState/Common/AdaptableColumn.js +26 -0
  11. package/src/AdaptableState/Common/AggregationColumns.d.ts +10 -0
  12. package/src/AdaptableState/Common/AggregationColumns.js +11 -0
  13. package/src/AdaptableState/LayoutState.d.ts +4 -4
  14. package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -2
  15. package/src/Api/Implementation/ColumnApiImpl.js +36 -3
  16. package/src/Api/Implementation/LayoutHelpers.js +7 -0
  17. package/src/Api/Internal/ColumnInternalApi.js +3 -3
  18. package/src/View/Alert/Wizard/AlertButtonsEditor.js +9 -10
  19. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +26 -25
  20. package/src/View/Components/ColumnFilter/ColumnFilter.js +1 -1
  21. package/src/View/Components/FilterForm/ListBoxFilterForm.js +6 -3
  22. package/src/View/Components/NewScopeComponent.js +2 -1
  23. package/src/View/Layout/Wizard/LayoutWizard.js +2 -2
  24. package/src/View/Layout/Wizard/sections/AggregationsSection.js +16 -1
  25. package/src/View/Layout/Wizard/sections/PivotAggregationsSection.d.ts +2 -2
  26. package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +219 -43
  27. package/src/agGrid/AdaptableAgGrid.d.ts +1 -0
  28. package/src/agGrid/AdaptableAgGrid.js +9 -1
  29. package/src/agGrid/AgGridAdapter.d.ts +1 -0
  30. package/src/agGrid/AgGridAdapter.js +10 -1
  31. package/src/components/Select/Select.js +15 -3
  32. package/src/env.js +2 -2
  33. package/src/layout-manager/src/LayoutManagerModel.d.ts +4 -4
  34. package/src/layout-manager/src/index.d.ts +1 -1
  35. package/src/layout-manager/src/index.js +41 -21
  36. package/src/layout-manager/src/isPivotAggTotalColumn.d.ts +2 -0
  37. package/src/layout-manager/src/{isPivotTotalColumn.js → isPivotAggTotalColumn.js} +1 -1
  38. package/src/layout-manager/src/isPivotGrandTotalColumn.d.ts +2 -0
  39. package/src/layout-manager/src/isPivotGrandTotalColumn.js +3 -0
  40. package/src/layout-manager/src/isPivotGroupTotalColumn.d.ts +1 -2
  41. package/src/layout-manager/src/isPivotGroupTotalColumn.js +2 -2
  42. package/src/layout-manager/src/normalizeLayoutModel.js +0 -3
  43. package/src/layout-manager/src/simplifyLayoutModel.js +3 -0
  44. package/src/metamodel/adaptable.metamodel.d.ts +13 -7
  45. package/src/metamodel/adaptable.metamodel.js +1 -1
  46. package/src/types.d.ts +1 -1
  47. package/tsconfig.esm.tsbuildinfo +1 -1
  48. package/src/layout-manager/src/isPivotTotalColumn.d.ts +0 -2
@@ -1,11 +1,14 @@
1
1
  import { ColumnApiModule, } from 'ag-grid-enterprise';
2
2
  import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
3
- import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME, } from '../Utilities/Constants/GeneralConstants';
3
+ import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME } from '../Utilities/Constants/GeneralConstants';
4
4
  import { createUuid } from '../AdaptableState/Uuid';
5
5
  import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
6
6
  import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
7
7
  import { ALL_AG_GRID_MODULES } from './agGridModules';
8
8
  import { agGridDataTypeDefinitions, ALL_ADAPTABLE_DATA_TYPES } from './agGridDataTypeDefinitions';
9
+ import { isPivotGrandTotalColumn } from '../Api/Implementation/ColumnApiImpl';
10
+ import { isPivotGroupTotalColumn } from '../layout-manager/src/isPivotGroupTotalColumn';
11
+ import { isPivotAggTotalColumn } from '../layout-manager/src/isPivotAggTotalColumn';
9
12
  // AG GRID obfuscates its internals, this is (currently) the best way to get hold of its internal services
10
13
  const DANGER_AG_GRID_BEANS_MAP = {};
11
14
  const getColumnApiModule = () => ColumnApiModule;
@@ -432,6 +435,7 @@ export class AgGridAdapter {
432
435
  isCalculatedColumn: this.isCalculatedColumn(colDef),
433
436
  isFreeTextColumn: this.isFreeTextColumn(colDef),
434
437
  isActionColumn: this.isActionColumn(colDef),
438
+ isPivotTotalColumn: this.isPivotTotalColumn(colDef),
435
439
  };
436
440
  abColumn.queryable = this.isColumnQueryable(abColumn);
437
441
  abColumn.exportable = this.isColumnExportable(abColumn);
@@ -605,6 +609,11 @@ export class AgGridAdapter {
605
609
  isActionColumn(colDef) {
606
610
  return this.adaptableApi.actionColumnApi.getActionColumnForColumnId(colDef.colId) != null;
607
611
  }
612
+ isPivotTotalColumn(colDef) {
613
+ return (isPivotGrandTotalColumn(colDef.colId) ||
614
+ isPivotGroupTotalColumn(colDef.colId) ||
615
+ isPivotAggTotalColumn(colDef));
616
+ }
608
617
  isColumnFilterable(colDef) {
609
618
  // follow agGrid logic which is that ONLY filterable if explicitly set
610
619
  if (this.adaptableApi.entitlementApi.getEntitlementAccessLevelForModule(ModuleConstants.ColumnFilterModuleId) == 'Hidden') {
@@ -28,8 +28,10 @@ const INFINITE_COLUMNS_WITH_CHECKBOX = {
28
28
  },
29
29
  resizable: false,
30
30
  defaultSortable: false,
31
- renderSelectionCheckBox: ({ renderBag }) => {
32
- return renderBag.selectionCheckBox;
31
+ renderSelectionCheckBox: true,
32
+ className: 'ab-Select-CheckboxColumn',
33
+ renderValue: ({ renderBag }) => {
34
+ return React.createElement("div", { className: "InfiniteCell_content_value" }, renderBag.value);
33
35
  },
34
36
  renderHeader: (headerParams) => {
35
37
  return (React.createElement(React.Fragment, null,
@@ -74,8 +76,15 @@ const doesOptionMatchValue = function (value) {
74
76
  };
75
77
  };
76
78
  export const Select = function (props) {
79
+ let maxLabelLength = 0;
77
80
  const ref = React.useRef(null);
78
- const valueToOptionMap = new Map((props.options || []).map((opt) => [opt.value, opt]));
81
+ const valueToOptionMap = new Map((props.options || []).map((opt) => {
82
+ let label = opt.label;
83
+ if (typeof label === 'string' || typeof label === 'number' || typeof label === 'boolean') {
84
+ maxLabelLength = Math.max(maxLabelLength, `${label}`.length);
85
+ }
86
+ return [opt.value, opt];
87
+ }));
79
88
  const findOptionByValue = (value) => {
80
89
  const option = valueToOptionMap.get(value);
81
90
  if (option) {
@@ -416,7 +425,10 @@ export const Select = function (props) {
416
425
  zIndex: 999999,
417
426
  boxShadow: 'var(--ab-cmp-select-menu__box-shadow)',
418
427
  minWidth: `var(--ab-cmp-select-menu__min-width)`,
428
+ width: `${Math.max(maxLabelLength, 10)}ch`,
419
429
  '--ab-cmp-select-menu__min-height': `min(${(props.options || []).length + (showHeaderSelectionCheckbox ? 1 : 0)} * var(--ab-grid-row-height), 20rem)`,
430
+ maxHeight: 'var(--ab-cmp-select-menu__max-height)',
431
+ maxWidth: 'var(--ab-cmp-select-menu__max-width)',
420
432
  ...commonStyles(state),
421
433
  ...props.menuStyle,
422
434
  };
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: 1745430358199 || Date.now(),
4
- VERSION: "20.0.7-canary.1" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1745852629865 || Date.now(),
4
+ VERSION: "20.0.7-canary.3" || '--current-version--',
5
5
  };
@@ -57,6 +57,10 @@ export interface BaseLayoutModel {
57
57
  ColumnPinning?: {
58
58
  [columnId: string]: 'left' | 'right';
59
59
  };
60
+ /**
61
+ * Display Grand Total Row at the top or bottom of the Pivot Table
62
+ */
63
+ GrandTotalRow?: 'top' | 'bottom' | boolean;
60
64
  }
61
65
  export type ColumnAggregationModel = {
62
66
  aggFunc: string | true;
@@ -109,10 +113,6 @@ export interface PivotLayoutModel extends BaseLayoutModel {
109
113
  */
110
114
  PivotGroupedColumns?: string[];
111
115
  RowGroupedColumns?: never;
112
- /**
113
- * Display Grand Total Row at the top or bottom of the Pivot Table
114
- */
115
- GrandTotalRow?: 'top' | 'bottom' | boolean;
116
116
  /**
117
117
  * Display Total of all Pivot Columns before or after the Pivot Columns
118
118
  */
@@ -72,8 +72,8 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
72
72
  applyPivotTotals(layout: PivotLayoutModel): void;
73
73
  applyPivotExpandLevel(layout: PivotLayoutModel): void;
74
74
  private withSuppressColumnAnimation;
75
+ private patchColDefType;
75
76
  private setupPivotTotals;
76
- private isPivotRowTotalColDef;
77
77
  private patchPivotTotalColumn;
78
78
  private getPivotTotalColumnConfig;
79
79
  }
@@ -6,7 +6,9 @@ import { isLayoutEqual } from './isLayoutEqual';
6
6
  import { simplifyLayoutModel, simplifyPivotLayoutModel, simplifyTableLayoutModel, } from './simplifyLayoutModel';
7
7
  import { sortColumnIdsByOrder } from './sortColumnIdsByOrder';
8
8
  import { destructurePivotColumnId } from './destructurePivotColumnId';
9
- import { isPivotTotalColumn } from './isPivotTotalColumn';
9
+ import { isPivotAggTotalColumn } from './isPivotAggTotalColumn';
10
+ import { isPivotGrandTotalColumn } from './isPivotGrandTotalColumn';
11
+ import { isPivotGroupTotalColumn } from './isPivotGroupTotalColumn';
10
12
  function flattenColDefs(colDefs) {
11
13
  const res = [];
12
14
  const iteration = (c) => {
@@ -256,12 +258,9 @@ export class LayoutManager extends LMEmitter {
256
258
  RowGroupValues: layout.RowGroupValues,
257
259
  PivotGroupedColumns: layout.RowGroupedColumns,
258
260
  PivotAggregationColumns: layout.TableAggregationColumns,
261
+ GrandTotalRow: layout.GrandTotalRow,
259
262
  PivotExpandLevel: prevLayout?.PivotExpandLevel ?? -1,
260
263
  };
261
- const grandTotalRow = this.gridApi.getGridOption('grandTotalRow');
262
- if (grandTotalRow) {
263
- pivotLayout.GrandTotalRow = grandTotalRow;
264
- }
265
264
  const grandTotalColumn = this.gridApi.getGridOption('pivotRowTotals');
266
265
  if (grandTotalColumn) {
267
266
  pivotLayout.GrandTotalColumn = grandTotalColumn;
@@ -443,6 +442,7 @@ export class LayoutManager extends LMEmitter {
443
442
  }
444
443
  }
445
444
  }
445
+ const grandTotalRow = this.gridApi.getGridOption('grandTotalRow');
446
446
  const layout = simplifyTableLayoutModel({
447
447
  TableColumns: TableColumns,
448
448
  ColumnVisibility,
@@ -452,6 +452,7 @@ export class LayoutManager extends LMEmitter {
452
452
  TableAggregationColumns,
453
453
  ColumnPinning: ColumnPinning,
454
454
  RowGroupValues,
455
+ GrandTotalRow: grandTotalRow,
455
456
  });
456
457
  return layout;
457
458
  }
@@ -690,6 +691,17 @@ export class LayoutManager extends LMEmitter {
690
691
  // @ts-ignore
691
692
  this.gridApi.setGridOption('suppressAggFuncInHeader', layout.SuppressAggFuncInHeader);
692
693
  }
694
+ if (layout.GrandTotalRow) {
695
+ const grandTotalRow = layout.GrandTotalRow === true || layout.GrandTotalRow === 'top'
696
+ ? 'top'
697
+ : layout.GrandTotalRow === 'bottom'
698
+ ? 'bottom'
699
+ : null;
700
+ this.gridApi.setGridOption('grandTotalRow', grandTotalRow);
701
+ }
702
+ else {
703
+ this.gridApi.setGridOption('grandTotalRow', null);
704
+ }
693
705
  if (isPivotLayoutModel(layout)) {
694
706
  try {
695
707
  const perfApplyPivot = this.beginPerf('applyLayout:pivot');
@@ -1033,17 +1045,7 @@ export class LayoutManager extends LMEmitter {
1033
1045
  /**
1034
1046
  * GrandTotalRow
1035
1047
  */
1036
- if (layout.GrandTotalRow) {
1037
- const grandTotalRow = layout.GrandTotalRow === true || layout.GrandTotalRow === 'top'
1038
- ? 'top'
1039
- : layout.GrandTotalRow === 'bottom'
1040
- ? 'bottom'
1041
- : null;
1042
- this.gridApi.setGridOption('grandTotalRow', grandTotalRow);
1043
- }
1044
- else {
1045
- this.gridApi.setGridOption('grandTotalRow', null);
1046
- }
1048
+ // is common to both Table and Pivot and is applied in applyLayout()
1047
1049
  /**
1048
1050
  * GrandTotalColumn
1049
1051
  */
@@ -1108,8 +1110,28 @@ export class LayoutManager extends LMEmitter {
1108
1110
  }
1109
1111
  return res;
1110
1112
  }
1113
+ patchColDefType(colDef, colTypes) {
1114
+ const originalTypes = colDef.type == undefined ? [] : Array.isArray(colDef.type) ? colDef.type : [colDef.type];
1115
+ const columnTypes = new Set(originalTypes);
1116
+ colTypes.forEach((colType) => {
1117
+ columnTypes.add(colType);
1118
+ });
1119
+ colDef.type = Array.from(columnTypes);
1120
+ }
1111
1121
  setupPivotTotals() {
1112
1122
  const _original_processPivotResultColDef = this.gridApi.getGridOption('processPivotResultColDef');
1123
+ this.gridApi.setGridOption('processPivotResultColDef', (colDef) => {
1124
+ _original_processPivotResultColDef?.(colDef);
1125
+ if (!isPivotLayoutModel(this.currentLayout)) {
1126
+ return;
1127
+ }
1128
+ if (isPivotGrandTotalColumn(colDef)) {
1129
+ this.patchColDefType(colDef, ['pivotTotalColumn', 'pivotGrandTotalColumn']);
1130
+ }
1131
+ if (isPivotGroupTotalColumn(colDef.colId)) {
1132
+ this.patchColDefType(colDef, ['pivotTotalColumn', 'pivotGroupTotalColumn']);
1133
+ }
1134
+ });
1113
1135
  const _original_processPivotResultColGroupDef = this.gridApi.getGridOption('processPivotResultColGroupDef');
1114
1136
  this.gridApi.setGridOption('processPivotResultColGroupDef', (colGroupDef) => {
1115
1137
  _original_processPivotResultColGroupDef?.(colGroupDef);
@@ -1119,9 +1141,6 @@ export class LayoutManager extends LMEmitter {
1119
1141
  this.patchPivotTotalColumn(colGroupDef);
1120
1142
  });
1121
1143
  }
1122
- isPivotRowTotalColDef(colDef) {
1123
- return colDef.colId?.startsWith('PivotRowTotal_');
1124
- }
1125
1144
  patchPivotTotalColumn(colGroupDef) {
1126
1145
  const hasPivotTotalCols = (pivotLayout) => {
1127
1146
  return pivotLayout.PivotAggregationColumns?.some((aggCol) => !!aggCol.TotalColumn);
@@ -1135,7 +1154,7 @@ export class LayoutManager extends LMEmitter {
1135
1154
  const pivotTotalColDefsAfter = [];
1136
1155
  const normalColDefs = [];
1137
1156
  colGroupDef.children.forEach((colDef) => {
1138
- if (this.isPivotRowTotalColDef(colDef)) {
1157
+ if (isPivotGrandTotalColumn(colDef)) {
1139
1158
  if (this.gridApi.getGridOption('pivotRowTotals') === 'after') {
1140
1159
  pivotRowTotalColDefsAfter.push(colDef);
1141
1160
  }
@@ -1144,11 +1163,12 @@ export class LayoutManager extends LMEmitter {
1144
1163
  }
1145
1164
  return;
1146
1165
  }
1147
- if (isPivotTotalColumn(colDef)) {
1166
+ if (isPivotAggTotalColumn(colDef)) {
1148
1167
  if (!colDef.colId.startsWith('pivot_')) {
1149
1168
  this.warn(`Pivot total column ${colDef.colId} is not prefixed with 'pivot_', skipping...`);
1150
1169
  return;
1151
1170
  }
1171
+ this.patchColDefType(colDef, ['pivotTotalColumn', 'pivotAggregationTotalColumn']);
1152
1172
  // we do this for all total cols, but we will hide the ones that are not visible
1153
1173
  colDef.columnGroupShow = undefined;
1154
1174
  const totalColConfig = this.getPivotTotalColumnConfig(colDef, this.currentLayout);
@@ -0,0 +1,2 @@
1
+ import { ColDef } from 'ag-grid-enterprise';
2
+ export declare function isPivotAggTotalColumn(colDef: ColDef): colDef is ColDef;
@@ -1,3 +1,3 @@
1
- export function isPivotTotalColumn(colDef) {
1
+ export function isPivotAggTotalColumn(colDef) {
2
2
  return !!colDef.pivotTotalColumnIds?.length;
3
3
  }
@@ -0,0 +1,2 @@
1
+ import { ColDef, ColGroupDef } from 'ag-grid-enterprise';
2
+ export declare function isPivotGrandTotalColumn(colDef: ColDef | ColGroupDef): boolean;
@@ -0,0 +1,3 @@
1
+ export function isPivotGrandTotalColumn(colDef) {
2
+ return colDef?.colId?.startsWith('PivotRowTotal_pivot_');
3
+ }
@@ -1,2 +1 @@
1
- import { ColDef } from 'ag-grid-enterprise';
2
- export declare function isPivotGroupTotalColumn(colDef: ColDef): boolean;
1
+ export declare function isPivotGroupTotalColumn(colId: string): boolean;
@@ -1,5 +1,5 @@
1
- export function isPivotGroupTotalColumn(colDef) {
1
+ export function isPivotGroupTotalColumn(colId) {
2
2
  // pivot group total are spanning cross all aggregations
3
3
  // therefore the last part of the colId is empty (hence the "dangling" underscore)
4
- return colDef.colId?.startsWith('pivot_') && colDef.colId?.endsWith('_');
4
+ return colId?.startsWith('pivot_') && colId?.endsWith('_');
5
5
  }
@@ -139,9 +139,6 @@ export function normalizePivotLayoutModel(layout) {
139
139
  // make it an own property
140
140
  layout.SuppressAggFuncInHeader = undefined;
141
141
  }
142
- if (!layout.GrandTotalRow) {
143
- layout.GrandTotalRow = false;
144
- }
145
142
  return layout;
146
143
  }
147
144
  export function normalizeLayoutModel(layout, options) {
@@ -53,6 +53,9 @@ export function simplifyTableLayoutModel(layout) {
53
53
  });
54
54
  layout.RowGroupDisplayType = displayType;
55
55
  }
56
+ if (!layout.GrandTotalRow) {
57
+ delete layout.GrandTotalRow;
58
+ }
56
59
  return layout;
57
60
  }
58
61
  export function simplifyPivotLayoutModel(layout) {
@@ -314,6 +314,11 @@ export declare const ADAPTABLE_METAMODEL: {
314
314
  isOpt: boolean;
315
315
  }[];
316
316
  };
317
+ AdaptableColumnType: {
318
+ name: string;
319
+ kind: string;
320
+ desc: string;
321
+ };
317
322
  AdaptableComment: {
318
323
  name: string;
319
324
  kind: string;
@@ -920,11 +925,6 @@ export declare const ADAPTABLE_METAMODEL: {
920
925
  desc: string;
921
926
  }[];
922
927
  };
923
- AdaptableSpecialColumnType: {
924
- name: string;
925
- kind: string;
926
- desc: string;
927
- };
928
928
  AdaptableState: {
929
929
  name: string;
930
930
  kind: string;
@@ -4056,13 +4056,19 @@ export declare const ADAPTABLE_METAMODEL: {
4056
4056
  name: string;
4057
4057
  kind: string;
4058
4058
  desc: string;
4059
- props: {
4059
+ props: ({
4060
4060
  name: string;
4061
4061
  kind: string;
4062
4062
  desc: string;
4063
4063
  isOpt: boolean;
4064
4064
  defVal: string;
4065
- }[];
4065
+ } | {
4066
+ name: string;
4067
+ kind: string;
4068
+ desc: string;
4069
+ isOpt: boolean;
4070
+ defVal?: undefined;
4071
+ })[];
4066
4072
  };
4067
4073
  LayoutViewOptions: {
4068
4074
  name: string;