@adaptabletools/adaptable-cjs 22.0.10 → 22.1.0-canary.0

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 (71) hide show
  1. package/index.css +33 -1
  2. package/index.css.map +1 -1
  3. package/package.json +3 -4
  4. package/src/AdaptableState/Common/AdaptablePredicate.js +1 -1
  5. package/src/AdaptableState/InitialState.d.ts +2 -2
  6. package/src/AdaptableState/LayoutState.d.ts +47 -0
  7. package/src/Api/CalendarApi.d.ts +15 -0
  8. package/src/Api/ColumnScopeApi.d.ts +5 -0
  9. package/src/Api/DataChangeHistoryApi.d.ts +7 -2
  10. package/src/Api/Implementation/CalendarApiImpl.d.ts +3 -0
  11. package/src/Api/Implementation/CalendarApiImpl.js +10 -0
  12. package/src/Api/Implementation/ColumnScopeApiImpl.d.ts +1 -0
  13. package/src/Api/Implementation/ColumnScopeApiImpl.js +12 -0
  14. package/src/Api/Implementation/DataChangeHistoryApiImpl.d.ts +2 -1
  15. package/src/Api/Implementation/DataChangeHistoryApiImpl.js +7 -0
  16. package/src/Api/Implementation/LayoutHelpers.js +12 -0
  17. package/src/Api/Internal/AlertInternalApi.js +4 -1
  18. package/src/Api/Internal/FormatColumnInternalApi.js +3 -3
  19. package/src/Strategy/FlashingCellModule.js +1 -0
  20. package/src/Strategy/PlusMinusModule.js +3 -3
  21. package/src/Utilities/Constants/GeneralConstants.js +2 -1
  22. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +1 -1
  23. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +41 -2
  24. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -1
  25. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +31 -2
  26. package/src/Utilities/Helpers/AdaptableHelper.js +30 -4
  27. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +1 -0
  28. package/src/Utilities/Services/MetamodelService.js +18 -18
  29. package/src/Utilities/Services/QueryLanguageService.d.ts +2 -0
  30. package/src/Utilities/Services/QueryLanguageService.js +20 -8
  31. package/src/Utilities/Services/ValidationService.js +3 -1
  32. package/src/View/Components/EntityRulesEditor/index.js +1 -1
  33. package/src/View/Components/ModuleValueSelector/index.js +9 -1
  34. package/src/View/Components/ReorderDraggable/index.js +21 -35
  35. package/src/View/Components/ValueSelector/index.js +45 -49
  36. package/src/View/Dashboard/PinnedToolbarsSelector.js +1 -1
  37. package/src/View/Layout/Wizard/LayoutWizard.js +16 -1
  38. package/src/View/Layout/Wizard/sections/RowSelectionSection.d.ts +8 -0
  39. package/src/View/Layout/Wizard/sections/RowSelectionSection.js +147 -0
  40. package/src/View/NamedQuery/Wizard/NamedQuerySettingsWizardSection.js +0 -1
  41. package/src/agGrid/AdaptableAgGrid.js +10 -0
  42. package/src/components/Dashboard/Dashboard.js +1 -1
  43. package/src/components/DragAndDropContext/ModuleManager.d.ts +1 -0
  44. package/src/components/DragAndDropContext/ModuleManager.js +11 -36
  45. package/src/components/DragAndDropContext/TabList.d.ts +11 -6
  46. package/src/components/DragAndDropContext/TabList.js +77 -35
  47. package/src/components/DragAndDropContext/UnusedPanel.js +9 -20
  48. package/src/components/ExpressionEditor/BaseEditorInput.d.ts +2 -0
  49. package/src/components/ExpressionEditor/BaseEditorInput.js +4 -0
  50. package/src/components/ExpressionEditor/EditorInput.d.ts +3 -1
  51. package/src/components/ExpressionEditor/EditorInput.js +20 -9
  52. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +2 -1
  53. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +1 -10
  54. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +16 -18
  55. package/src/components/ExpressionEditor/index.d.ts +2 -1
  56. package/src/components/ExpressionEditor/index.js +1 -1
  57. package/src/components/Tree/TreeDropdown/index.js +37 -26
  58. package/src/components/dnd/index.d.ts +3 -13
  59. package/src/components/dnd/index.js +11 -59
  60. package/src/env.js +2 -2
  61. package/src/layout-manager/src/LayoutManagerModel.d.ts +2 -1
  62. package/src/layout-manager/src/index.d.ts +9 -0
  63. package/src/layout-manager/src/index.js +97 -1
  64. package/src/layout-manager/src/normalizeLayoutModel.js +8 -0
  65. package/src/layout-manager/src/simplifyLayoutModel.js +6 -0
  66. package/src/metamodel/adaptable-metamodel-model.d.ts +22 -13
  67. package/src/metamodel/adaptable.metamodel.d.ts +3773 -5143
  68. package/src/metamodel/adaptable.metamodel.js +1 -1
  69. package/src/parser/src/parser.js +55 -1218
  70. package/src/parser/src/types.d.ts +5 -0
  71. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -1,4 +1,4 @@
1
- import { ColumnSizingMap } from '../../AdaptableState/LayoutState';
1
+ import { ColumnSizingMap, LayoutRowSelection } from '../../AdaptableState/LayoutState';
2
2
  import { XOR } from '../../Utilities/Extensions/TypeExtensions';
3
3
  /**
4
4
  * Defines how a Column is sorted
@@ -112,6 +112,7 @@ export interface BaseLayoutModel {
112
112
  ColumnPinning?: {
113
113
  [columnId: string]: 'left' | 'right';
114
114
  };
115
+ RowSelection?: LayoutRowSelection | false;
115
116
  /**
116
117
  * Display Grand Total Row of the Pivot Table
117
118
  */
@@ -1,6 +1,7 @@
1
1
  import { ColumnState, GridApi, GridOptions, GridState } from 'ag-grid-enterprise';
2
2
  import { PivotLayoutModel, TableLayoutModel } from './LayoutManagerModel';
3
3
  import { LMEmitter } from './LMEmitter';
4
+ import { LayoutRowSelection } from '../../AdaptableState/LayoutState';
4
5
  export declare const PIVOT_ANY_TOTAL_COL_TYPE = "pivotAnyTotal";
5
6
  export declare const PIVOT_GRAND_TOTAL_COL_TYPE = "pivotGrandTotal";
6
7
  export declare const PIVOT_COLUMN_TOTAL_COL_TYPE = "pivotColumnTotal";
@@ -9,6 +10,7 @@ export type LayoutManagerOptions = {
9
10
  gridApi: GridApi;
10
11
  debugId: string;
11
12
  layoutChangeDebounce?: number;
13
+ initialRowSelection?: GridOptions['rowSelection'];
12
14
  };
13
15
  type ApplyLayoutOptions = {
14
16
  skipApplyRowGroupsExpandedState?: boolean;
@@ -26,6 +28,7 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
26
28
  private suppressGlobalAgGridEventListener;
27
29
  private supressGlobalAgGridEventTimeoutId;
28
30
  private layoutManagerDebugId;
31
+ private initialRowSelection;
29
32
  constructor(options: LayoutManagerOptions);
30
33
  destroy(): void;
31
34
  private setupEvents;
@@ -69,6 +72,12 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
69
72
  private getLayoutDetailsAsString;
70
73
  applyColumnDefsChanges(layout: TableLayoutModel | PivotLayoutModel): boolean;
71
74
  private applyColumnSizingColumnDefsChanges;
75
+ static readonly SELECTION_COLUMN_ID = "ag-Grid-SelectionColumn";
76
+ static getGridOptionForRowSelectionFromLayout(layoutRowSelection: LayoutRowSelection | false | undefined, baseGridRowSelection: GridOptions['rowSelection']): GridOptions['rowSelection'] | undefined;
77
+ static isSelectionColumnInNonFirstPosition(tableColumns: string[] | undefined): boolean;
78
+ private ensureSelectionColumnPositionUnlocked;
79
+ private getRowSelectionFromGrid;
80
+ private applyRowSelection;
72
81
  private applyTableLayout;
73
82
  private getRowGroupNodePathsAs;
74
83
  applyRowGroupValues(RowGroupValues: TableLayoutModel['RowGroupValues'], rowGroupedColumns: string[]): void;
@@ -154,6 +154,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
154
154
  suppressGlobalAgGridEventListener = false;
155
155
  supressGlobalAgGridEventTimeoutId = null;
156
156
  layoutManagerDebugId;
157
+ initialRowSelection;
157
158
  constructor(options) {
158
159
  super({ debugId: options.debugId });
159
160
  this.layoutChangeDebounce = options.layoutChangeDebounce ?? 0;
@@ -162,6 +163,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
162
163
  wait: this.layoutChangeDebounce,
163
164
  }).bind(this);
164
165
  }
166
+ this.initialRowSelection = options.initialRowSelection;
165
167
  this.setOptions(options);
166
168
  // this ensures the grand total columns are positioned correctly (before/after) even when changed at runtime
167
169
  // see https://www.ag-grid.com/react-data-grid/pivoting-column-groups/#changing-data-filters-and-configurations
@@ -403,6 +405,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
403
405
  PivotGroupedColumns: layout.RowGroupedColumns,
404
406
  PivotAggregationColumns: layout.TableAggregationColumns,
405
407
  GrandTotalRow: layout.GrandTotalRow,
408
+ RowSelection: layout.RowSelection,
406
409
  PivotExpandLevel: prevLayout?.PivotExpandLevel ?? -1,
407
410
  };
408
411
  if (storePivotResultColumns) {
@@ -434,7 +437,6 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
434
437
  }
435
438
  getUndecidedLayoutModelFromGrid(columnState) {
436
439
  let TableColumns = columnState.map((c) => c.colId);
437
- // .filter((colId) => colId !== 'ag-Grid-SelectionColumn');
438
440
  let ColumnSorts = [];
439
441
  const RowGroupedColumns = [];
440
442
  let RowGroupValues = undefined;
@@ -742,6 +744,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
742
744
  GrandTotalRow: this.gridApi.getGridOption('grandTotalRow'),
743
745
  SuppressAggFuncInHeader: this.gridApi.getGridOption('suppressAggFuncInHeader'),
744
746
  RowGroupDisplayType: this.gridApi.getGridOption('groupDisplayType') === 'multipleColumns' ? 'multi' : 'single',
747
+ RowSelection: this.getRowSelectionFromGrid(),
745
748
  });
746
749
  return layout;
747
750
  }
@@ -816,6 +819,8 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
816
819
  const flatColDefs = flattenColDefs(colDefs);
817
820
  const colDefsById = new Map(flatColDefs.map((colDef) => [colDef.colId ?? colDef.field, colDef]));
818
821
  const getColDef = (colId) => colDefsById.get(colId);
822
+ // TODO to implement support for row selection in server-side row model
823
+ // agGridState.rowSelection = { ... }
819
824
  agGridState.columnVisibility = {
820
825
  hiddenColIds: flatColDefs
821
826
  .filter((colDef) => {
@@ -1104,6 +1109,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1104
1109
  else {
1105
1110
  this.gridApi.setGridOption('grandTotalRow', null);
1106
1111
  }
1112
+ this.applyRowSelection(layout);
1107
1113
  this.applyColumnDefsChanges(layout);
1108
1114
  if ((0, isPivotLayoutModel_1.isPivotLayoutModel)(layout)) {
1109
1115
  try {
@@ -1161,8 +1167,98 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1161
1167
  }
1162
1168
  return false;
1163
1169
  }
1170
+ static SELECTION_COLUMN_ID = 'ag-Grid-SelectionColumn';
1171
+ static getGridOptionForRowSelectionFromLayout(layoutRowSelection, baseGridRowSelection) {
1172
+ if (layoutRowSelection === false) {
1173
+ return undefined;
1174
+ }
1175
+ if (layoutRowSelection == null) {
1176
+ return baseGridRowSelection;
1177
+ }
1178
+ const current = baseGridRowSelection && typeof baseGridRowSelection !== 'string'
1179
+ ? baseGridRowSelection
1180
+ : {};
1181
+ const updated = { ...current };
1182
+ if (layoutRowSelection.Mode != null) {
1183
+ updated.mode = layoutRowSelection.Mode;
1184
+ }
1185
+ if (layoutRowSelection.Checkboxes != null) {
1186
+ updated.checkboxes = layoutRowSelection.Checkboxes;
1187
+ }
1188
+ if (layoutRowSelection.GroupSelectMode != null) {
1189
+ updated.groupSelects = layoutRowSelection.GroupSelectMode;
1190
+ }
1191
+ if (layoutRowSelection.SelectAllMode != null) {
1192
+ updated.selectAll = layoutRowSelection.SelectAllMode;
1193
+ }
1194
+ if (layoutRowSelection.HeaderCheckbox != null) {
1195
+ updated.headerCheckbox = layoutRowSelection.HeaderCheckbox;
1196
+ }
1197
+ if (layoutRowSelection.EnableClickSelection != null) {
1198
+ updated.enableClickSelection = layoutRowSelection.EnableClickSelection;
1199
+ }
1200
+ if (layoutRowSelection.CheckboxInGroupColumn != null) {
1201
+ updated.checkboxLocation = layoutRowSelection.CheckboxInGroupColumn
1202
+ ? 'autoGroupColumn'
1203
+ : 'selectionColumn';
1204
+ }
1205
+ return updated;
1206
+ }
1207
+ static isSelectionColumnInNonFirstPosition(tableColumns) {
1208
+ if (!tableColumns) {
1209
+ return false;
1210
+ }
1211
+ const index = tableColumns.indexOf(LayoutManager.SELECTION_COLUMN_ID);
1212
+ return index > 0;
1213
+ }
1214
+ ensureSelectionColumnPositionUnlocked(layout) {
1215
+ if (LayoutManager.isSelectionColumnInNonFirstPosition(layout.TableColumns)) {
1216
+ const current = this.gridApi.getGridOption('selectionColumnDef');
1217
+ if (!current || current.lockPosition !== false) {
1218
+ this.gridApi.setGridOption('selectionColumnDef', {
1219
+ ...current,
1220
+ lockPosition: false,
1221
+ });
1222
+ }
1223
+ }
1224
+ }
1225
+ getRowSelectionFromGrid() {
1226
+ const gridRowSelection = this.gridApi.getGridOption('rowSelection');
1227
+ if (!gridRowSelection || typeof gridRowSelection === 'string') {
1228
+ return this.currentLayout?.RowSelection === false ? false : undefined;
1229
+ }
1230
+ const rs = gridRowSelection;
1231
+ const result = {
1232
+ Mode: rs.mode ?? 'singleRow',
1233
+ };
1234
+ if (rs.checkboxes != null) {
1235
+ result.Checkboxes = rs.checkboxes;
1236
+ }
1237
+ if (rs.mode === 'multiRow' && rs.groupSelects != null) {
1238
+ result.GroupSelectMode = rs.groupSelects;
1239
+ }
1240
+ if (rs.mode === 'multiRow' && rs.selectAll != null) {
1241
+ result.SelectAllMode = rs.selectAll;
1242
+ }
1243
+ if (rs.mode === 'multiRow' && rs.headerCheckbox != null) {
1244
+ result.HeaderCheckbox = rs.headerCheckbox;
1245
+ }
1246
+ if (rs.enableClickSelection != null) {
1247
+ result.EnableClickSelection =
1248
+ rs.enableClickSelection;
1249
+ }
1250
+ if (rs.checkboxLocation != null) {
1251
+ result.CheckboxInGroupColumn = rs.checkboxLocation === 'autoGroupColumn';
1252
+ }
1253
+ return result;
1254
+ }
1255
+ applyRowSelection(layout) {
1256
+ const rowSelection = LayoutManager.getGridOptionForRowSelectionFromLayout(layout.RowSelection, this.initialRowSelection);
1257
+ this.gridApi.setGridOption('rowSelection', rowSelection);
1258
+ }
1164
1259
  applyTableLayout(layout, options) {
1165
1260
  this.withSuppressColumnAnimation(() => {
1261
+ this.ensureSelectionColumnPositionUnlocked(layout);
1166
1262
  // if we apply the state here, before calling setGridOption for groupDisplayType
1167
1263
  // the order is not always correctly applied
1168
1264
  // this.gridApi.applyColumnState(state);
@@ -41,6 +41,10 @@ function normalizeTableLayoutModel(layout, options) {
41
41
  // make it an own property
42
42
  layout.GrandTotalRow = undefined;
43
43
  }
44
+ if (!('RowSelection' in layout)) {
45
+ // make it an own property
46
+ layout.RowSelection = undefined;
47
+ }
44
48
  const ColumnOrderSet = new Set(layout.TableColumns);
45
49
  if (layout.RowGroupedColumns && layout.RowGroupedColumns.length && layout.TableColumns) {
46
50
  // the layout.TableColumns might not include the group columns
@@ -174,6 +178,10 @@ function normalizePivotLayoutModel(layout) {
174
178
  // make it an own property
175
179
  layout.PivotColumnTotal = undefined;
176
180
  }
181
+ if (!('RowSelection' in layout)) {
182
+ // make it an own property
183
+ layout.RowSelection = undefined;
184
+ }
177
185
  // if (layout.PivotGroupedColumns && layout.PivotGroupedColumns.length) {
178
186
  layout.RowGroupDisplayType = layout.RowGroupDisplayType || 'single';
179
187
  // }
@@ -13,6 +13,9 @@ function simplifyTableLayoutModel(layout) {
13
13
  if (layout.ColumnSizing && !Object.keys(layout.ColumnSizing).length) {
14
14
  delete layout.ColumnSizing;
15
15
  }
16
+ if (layout.RowSelection == undefined) {
17
+ delete layout.RowSelection;
18
+ }
16
19
  if (layout.ColumnSorts && !layout.ColumnSorts.length) {
17
20
  delete layout.ColumnSorts;
18
21
  }
@@ -77,6 +80,9 @@ function simplifyPivotLayoutModel(layout) {
77
80
  if (layout.ColumnSizing && !Object.keys(layout.ColumnSizing).length) {
78
81
  delete layout.ColumnSizing;
79
82
  }
83
+ if (layout.RowSelection == undefined) {
84
+ delete layout.RowSelection;
85
+ }
80
86
  if (!layout.SuppressAggFuncInHeader) {
81
87
  delete layout.SuppressAggFuncInHeader;
82
88
  }
@@ -1,19 +1,28 @@
1
1
  export type AdaptableMetamodel = Record<string, MetamodelItem>;
2
2
  export interface MetamodelItem {
3
- name: string;
4
- kind: 'A' | 'I' | 'C';
5
- desc: string;
6
- props?: MetamodelItemProperty[];
3
+ /** Item kind: 'A' (type alias), 'I' (interface), 'C' (class) */
4
+ k: 'A' | 'I' | 'C';
5
+ /** Description (only present for noCode-tagged items) */
6
+ d?: string;
7
+ /** Properties of this item */
8
+ p?: MetamodelItemProperty[];
7
9
  }
8
10
  export interface MetamodelItemProperty {
9
- name: string;
10
- kind: MetamodelItemPropertyKind;
11
- desc: string;
12
- uiLabel?: string;
13
- ref?: string;
14
- isOpt?: boolean;
15
- defVal?: unknown;
16
- gridInfo?: 'item' | 'container';
17
- noCode?: 'item' | 'container';
11
+ /** Property name */
12
+ n: string;
13
+ /** Property kind / type */
14
+ k: MetamodelItemPropertyKind;
15
+ /** Description (only present for noCode-tagged properties) */
16
+ d?: string;
17
+ /** UI label override for display */
18
+ l?: string;
19
+ /** Reference to another MetamodelItem key */
20
+ r?: string;
21
+ /** Whether the property is optional */
22
+ o?: boolean;
23
+ /** Grid Info role: 'item' or 'container' */
24
+ g?: 'item' | 'container';
25
+ /** No-Code role: 'item' or 'container' */
26
+ nC?: 'item' | 'container';
18
27
  }
19
28
  export type MetamodelItemPropertyKind = 'R' | 'n' | 's' | 'b' | 'd' | 'f' | 'a' | 'i' | 'u';