@adaptabletools/adaptable-cjs 18.0.0-canary.33 → 18.0.0-canary.35

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 (49) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableOptions/MenuOptions.d.ts +36 -16
  3. package/src/AdaptableOptions/MenuOptions.js +5 -0
  4. package/src/PredefinedConfig/Common/Menu.d.ts +14 -6
  5. package/src/PredefinedConfig/Common/Menu.js +3 -0
  6. package/src/Strategy/AdaptableModuleBase.d.ts +8 -8
  7. package/src/Strategy/AlertModule.d.ts +3 -2
  8. package/src/Strategy/BulkUpdateModule.d.ts +3 -2
  9. package/src/Strategy/CalculatedColumnModule.d.ts +3 -4
  10. package/src/Strategy/CalculatedColumnModule.js +16 -12
  11. package/src/Strategy/CellSummaryModule.d.ts +3 -4
  12. package/src/Strategy/CellSummaryModule.js +17 -14
  13. package/src/Strategy/ColumnFilterModule.d.ts +3 -3
  14. package/src/Strategy/ColumnInfoModule.d.ts +3 -3
  15. package/src/Strategy/CommentModule.d.ts +3 -2
  16. package/src/Strategy/CustomSortModule.d.ts +1 -2
  17. package/src/Strategy/DashboardModule.d.ts +3 -3
  18. package/src/Strategy/DataImportModule.d.ts +2 -2
  19. package/src/Strategy/ExportModule.d.ts +1 -1
  20. package/src/Strategy/Fdc3Module.d.ts +1 -1
  21. package/src/Strategy/FlashingCellModule.d.ts +4 -3
  22. package/src/Strategy/FormatColumnModule.d.ts +1 -1
  23. package/src/Strategy/FormatColumnModule.js +0 -1
  24. package/src/Strategy/FreeTextColumnModule.d.ts +1 -2
  25. package/src/Strategy/GridInfoModule.d.ts +3 -3
  26. package/src/Strategy/Interface/IModule.d.ts +3 -3
  27. package/src/Strategy/LayoutModule.d.ts +2 -2
  28. package/src/Strategy/NoteModule.d.ts +2 -2
  29. package/src/Strategy/PlusMinusModule.d.ts +1 -2
  30. package/src/Strategy/SettingsPanelModule.d.ts +2 -2
  31. package/src/Strategy/SmartEditModule.d.ts +3 -2
  32. package/src/Strategy/StyledColumnModule.d.ts +1 -1
  33. package/src/Strategy/StyledColumnModule.js +0 -8
  34. package/src/Strategy/SystemStatusModule.d.ts +3 -3
  35. package/src/Strategy/SystemStatusModule.js +3 -1
  36. package/src/Utilities/MenuItem.d.ts +9 -9
  37. package/src/Utilities/Services/RowSummaryService.d.ts +7 -3
  38. package/src/Utilities/Services/RowSummaryService.js +29 -15
  39. package/src/View/BulkUpdate/BulkUpdatePopup.js +2 -2
  40. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +4 -1
  41. package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +1 -0
  42. package/src/View/SmartEdit/SmartEditPopup.js +1 -1
  43. package/src/agGrid/AgGridMenuAdapter.d.ts +1 -0
  44. package/src/agGrid/AgGridMenuAdapter.js +70 -59
  45. package/src/env.js +2 -2
  46. package/src/metamodel/adaptable.metamodel.d.ts +10 -0
  47. package/src/metamodel/adaptable.metamodel.js +1 -1
  48. package/src/types.d.ts +1 -1
  49. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -28,18 +28,19 @@ class AgGridMenuAdapter {
28
28
  }
29
29
  const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId((_a = params.column) === null || _a === void 0 ? void 0 : _a.getColId());
30
30
  const menuContext = this.createColumnMenuContextObject(adaptableColumn, params.column);
31
+ /**
32
+ * AG Grid items
33
+ */
34
+ const agGridDefaultStructure = agGridMenuItems.map((itemName) => this.mapAgGridItemTypeToAgGridMenuItem(itemName));
31
35
  const adaptableMenuItems = this.createAdaptableColumnMenuItems(menuContext);
32
36
  const defaultColumnMenuStructure = this.buildColumnMenuDefaultStructure(adaptableMenuItems, menuContext);
33
37
  // 1. first check if there is a custom column menu defined
34
38
  if (typeof menuOptions.customColumnMenu === 'function') {
35
- const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => ({
36
- menuType: 'AgGrid',
37
- name: itemName,
38
- }));
39
+ const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => this.mapAgGridItemTypeToAgGridMenuItem(itemName));
39
40
  const defaultAdaptableMenuItems = adaptableMenuItems.map((adaptableItem) => (Object.assign({ menuType: 'Adaptable' }, adaptableItem)));
40
41
  const customMenuItems = menuOptions
41
42
  .customColumnMenu(Object.assign(Object.assign({}, menuContext), { defaultAgGridMenuItems,
42
- defaultAdaptableMenuItems, defaultAdaptableMenuStructure: this.mapAdaptableMenuItemToSystemMenuItems(defaultColumnMenuStructure) }))
43
+ defaultAdaptableMenuItems, defaultAdaptableMenuStructure: this.mapAdaptableMenuItemToSystemMenuItems(defaultColumnMenuStructure), defaultAgGridMenuStructure: agGridDefaultStructure }))
43
44
  .filter(Boolean);
44
45
  return customMenuItems
45
46
  .map((customMenuItem) => this.mapCustomMenuItemToAgGridMenuDefinition(customMenuItem, menuContext))
@@ -55,56 +56,70 @@ class AgGridMenuAdapter {
55
56
  }
56
57
  buildContextMenu(params, originalGetContextMenuItems) {
57
58
  var _a;
59
+ if (!params.column) {
60
+ return [];
61
+ }
58
62
  // we do this in order to refresh the internal state of selected cells (technically query the AG Grid cellRanges)
59
63
  // (right-click selected the current cell, but this was not reflected in the internal state of the selected cells)
60
64
  this.adaptableInstance.refreshSelectedCellsState();
61
65
  const menuOptions = this.adaptableOptions.menuOptions;
62
- const agGridMenuItems = (params.defaultItems ? [...params.defaultItems] : []);
63
- if (!params.column) {
64
- return [];
65
- }
66
66
  const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId((_a = params.column) === null || _a === void 0 ? void 0 : _a.getColId());
67
67
  const menuContext = this.createContextMenuContextObject(params, adaptableColumn);
68
+ /**
69
+ * AG Grid Items
70
+ */
71
+ const agGridMenuItems = (params.defaultItems ? [...params.defaultItems] : []);
72
+ const agGridCopyItems = agGridMenuItems.filter((item) => ['copy', 'copyWithHeaders', 'copyWithGroupHeaders', 'cut', 'paste'].includes(item));
73
+ const otherAgGridItems = agGridMenuItems.filter((item) => !agGridCopyItems.includes(item) &&
74
+ // we provide Adaptable exports in the context menu
75
+ !['export', 'csvExport', 'excelExport'].includes(item));
76
+ const agGridDefaultStructure = [
77
+ {
78
+ menuType: 'Group',
79
+ label: 'Copy & Paste',
80
+ icon: {
81
+ name: 'copy',
82
+ },
83
+ subMenuItems: agGridCopyItems.map((item) => this.mapAgGridItemTypeToAgGridMenuItem(item)),
84
+ },
85
+ ...otherAgGridItems
86
+ .filter((itemName) => itemName !== 'separator')
87
+ .map((itemName) => this.mapAgGridItemTypeToAgGridMenuItem(itemName)),
88
+ ];
89
+ /**
90
+ * Adaptable Items
91
+ */
68
92
  const adaptableMenuItems = this.createAdaptableContextMenuItems(menuContext);
69
- const defaultContextMenuStructure = this.buildContextMenuDefaultStructure(adaptableMenuItems, menuContext);
93
+ const adaptableDefaultStructure = this.buildContextMenuDefaultStructure(adaptableMenuItems, menuContext);
94
+ /**
95
+ * Build the context menu
96
+ */
70
97
  // 1. first check if there is a custom context menu defined
71
98
  if (typeof menuOptions.customContextMenu === 'function') {
72
- const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => ({
73
- menuType: 'AgGrid',
74
- name: itemName,
75
- }));
99
+ const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => this.mapAgGridItemTypeToAgGridMenuItem(itemName));
76
100
  const defaultAdaptableMenuItems = adaptableMenuItems.map((adaptableItem) => (Object.assign({ menuType: 'Adaptable' }, adaptableItem)));
77
101
  const customMenuItems = menuOptions
78
102
  .customContextMenu(Object.assign(Object.assign({}, menuContext), { defaultAgGridMenuItems,
79
- defaultAdaptableMenuItems, defaultAdaptableMenuStructure: this.mapAdaptableMenuItemToSystemMenuItems(defaultContextMenuStructure) }))
103
+ defaultAdaptableMenuItems, defaultAdaptableMenuStructure: this.mapAdaptableMenuItemToSystemMenuItems(adaptableDefaultStructure), defaultAgGridMenuStructure: agGridDefaultStructure }))
80
104
  .filter(Boolean);
81
105
  return customMenuItems
82
106
  .map((customMenuItem) => this.mapCustomMenuItemToAgGridMenuDefinition(customMenuItem, menuContext))
83
107
  .filter(Boolean);
84
108
  }
85
109
  // 2. if not, return the default context menu
86
- const agGridCopyItems = agGridMenuItems.filter((item) => ['copy', 'copyWithHeaders', 'copyWithGroupHeaders', 'cut', 'paste'].includes(item));
87
- const otherAgGridItems = agGridMenuItems.filter((item) => !agGridCopyItems.includes(item) &&
88
- // we provide Adaptable exports in the context menu
89
- !['export', 'csvExport', 'excelExport'].includes(item));
90
110
  const defaultContextMenu = [
91
- this.mapCustomMenuItemToAgGridMenuDefinition({
92
- menuType: 'Group',
93
- label: 'Copy & Paste',
94
- icon: {
95
- name: 'copy',
96
- },
97
- subMenuItems: agGridCopyItems.map((item) => ({
98
- menuType: 'AgGrid',
99
- name: item,
100
- })),
101
- }, menuContext),
102
- ...otherAgGridItems,
111
+ ...agGridDefaultStructure.map((agGridItem) => this.mapCustomMenuItemToAgGridMenuDefinition(agGridItem, menuContext)),
103
112
  'separator',
104
- ...defaultContextMenuStructure.map((adaptableItem) => this.mapAdaptableMenuItemToAgGridMenuDefinition(adaptableItem)),
113
+ ...adaptableDefaultStructure.map((adaptableItem) => this.mapAdaptableMenuItemToAgGridMenuDefinition(adaptableItem)),
105
114
  ];
106
115
  return this.removeConsecutiveSeparators(defaultContextMenu);
107
116
  }
117
+ mapAgGridItemTypeToAgGridMenuItem(itemName) {
118
+ return {
119
+ menuType: 'AgGrid',
120
+ name: itemName,
121
+ };
122
+ }
108
123
  // due to entitlements or other reasons, some menu items might be hidden, leading to consecutive separators
109
124
  removeConsecutiveSeparators(menuItems, separator = 'separator') {
110
125
  return menuItems.reduce((acc, item, index, array) => {
@@ -237,7 +252,7 @@ class AgGridMenuAdapter {
237
252
  // Comment
238
253
  const commentMenuItems = this.getModuleSpecificStructure('Comment', availableMenuItems);
239
254
  // Dashboard
240
- const dashboardMenuItems = this.getModuleSpecificStructure('Dashboard', availableMenuItems);
255
+ const dashboardMenuItems = this.getModuleSpecificStructure('Dashboard', availableMenuItems, 'dashboard-group');
241
256
  // DataImport
242
257
  const dataImportMenuItems = this.getModuleSpecificStructure('DataImport', availableMenuItems);
243
258
  // Export
@@ -264,8 +279,7 @@ class AgGridMenuAdapter {
264
279
  const gridMenuItem = {
265
280
  name: 'grid-group',
266
281
  label: 'Grid',
267
- // TODO
268
- module: 'ColumnInfo',
282
+ module: 'Group',
269
283
  isVisible: true,
270
284
  icon: {
271
285
  name: 'grid',
@@ -282,8 +296,7 @@ class AgGridMenuAdapter {
282
296
  const editMenuItem = {
283
297
  name: 'edit-group',
284
298
  label: 'Edit',
285
- // TODO
286
- module: 'ColumnInfo',
299
+ module: 'Group',
287
300
  isVisible: true,
288
301
  icon: {
289
302
  name: 'edit-table',
@@ -293,8 +306,7 @@ class AgGridMenuAdapter {
293
306
  const columnMenuItem = {
294
307
  name: 'column-group',
295
308
  label: 'Column',
296
- // TODO
297
- module: 'ColumnInfo',
309
+ module: 'Group',
298
310
  isVisible: true,
299
311
  icon: {
300
312
  name: 'columns',
@@ -336,11 +348,11 @@ class AgGridMenuAdapter {
336
348
  /**
337
349
  * Default strategy for menu items: return as is if there is only one item, otherwise group them under a parent item
338
350
  */
339
- getModuleSpecificStructure(module, menuItems) {
351
+ getModuleSpecificStructure(module, menuItems, groupName) {
340
352
  const moduleItems = menuItems.filter((menuItem) => menuItem.module === module);
341
353
  if (moduleItems.length > 1) {
342
354
  const moduleInfo = this.adaptableInstance.ModuleService.getModuleInfoByModule(module);
343
- return [this.buildMenuGroupParent(module, moduleItems)];
355
+ return [this.buildMenuGroupParent(module, moduleItems, { groupName })];
344
356
  }
345
357
  else {
346
358
  return moduleItems;
@@ -385,6 +397,7 @@ class AgGridMenuAdapter {
385
397
  ], {
386
398
  label: 'Export',
387
399
  icon: 'export',
400
+ groupName: 'export-group',
388
401
  }));
389
402
  }
390
403
  getLayoutContextMenuStructure(menuItems) {
@@ -402,14 +415,14 @@ class AgGridMenuAdapter {
402
415
  return [gridActionsItems, otherLayoutItems];
403
416
  }
404
417
  buildMenuGroupParent(module, menuItems, config) {
405
- var _a, _b;
418
+ var _a, _b, _c;
406
419
  const moduleInfo = this.adaptableInstance.ModuleService.getModuleInfoByModule(module);
407
420
  const icon = config && config.icon === false
408
421
  ? undefined
409
422
  : { name: (_a = config === null || config === void 0 ? void 0 : config.icon) !== null && _a !== void 0 ? _a : moduleInfo.Glyph };
410
423
  return {
411
- name: 'menu-group',
412
- label: (_b = config === null || config === void 0 ? void 0 : config.label) !== null && _b !== void 0 ? _b : moduleInfo.FriendlyName,
424
+ name: (_b = config === null || config === void 0 ? void 0 : config.groupName) !== null && _b !== void 0 ? _b : 'menu-group',
425
+ label: (_c = config === null || config === void 0 ? void 0 : config.label) !== null && _c !== void 0 ? _c : moduleInfo.FriendlyName,
413
426
  isVisible: true,
414
427
  module: moduleInfo.ModuleName,
415
428
  icon,
@@ -428,7 +441,7 @@ class AgGridMenuAdapter {
428
441
  // CustomSort
429
442
  const customSortMenuItems = this.getModuleSpecificStructure('CustomSort', availableMenuItems);
430
443
  // Dashboard
431
- const dashboardMenuItems = this.getModuleSpecificStructure('Dashboard', availableMenuItems);
444
+ const dashboardMenuItems = this.getModuleSpecificStructure('Dashboard', availableMenuItems, 'dashboard-group');
432
445
  // DataImport
433
446
  const dataImportMenuItems = this.getModuleSpecificStructure('DataImport', availableMenuItems);
434
447
  // FlashingCell
@@ -455,8 +468,7 @@ class AgGridMenuAdapter {
455
468
  const gridMenuItem = {
456
469
  name: 'grid-group',
457
470
  label: 'Grid',
458
- // TODO
459
- module: 'ColumnInfo',
471
+ module: 'Group',
460
472
  isVisible: true,
461
473
  icon: {
462
474
  name: 'grid',
@@ -474,8 +486,7 @@ class AgGridMenuAdapter {
474
486
  const columnMenuItem = {
475
487
  name: 'column-group',
476
488
  label: 'Column',
477
- // TODO
478
- module: 'ColumnInfo',
489
+ module: 'Group',
479
490
  isVisible: true,
480
491
  icon: {
481
492
  name: 'columns',
@@ -493,8 +504,7 @@ class AgGridMenuAdapter {
493
504
  const createStyleMenuItem = {
494
505
  name: 'styling-group',
495
506
  label: 'Styling',
496
- // TODO
497
- module: 'ColumnInfo',
507
+ module: 'Group',
498
508
  isVisible: true,
499
509
  icon: {
500
510
  name: 'brush',
@@ -553,26 +563,27 @@ class AgGridMenuAdapter {
553
563
  return styledColumnMenuItems;
554
564
  }
555
565
  mapAdaptableMenuItemToSystemMenuItems(adaptableMenuItems) {
556
- return (adaptableMenuItems !== null && adaptableMenuItems !== void 0 ? adaptableMenuItems : []).map((menuItem) => {
566
+ if (!adaptableMenuItems) {
567
+ return;
568
+ }
569
+ return adaptableMenuItems.map((menuItem) => {
557
570
  if (menuItem === '-') {
558
571
  return menuItem;
559
572
  }
560
- let subItems = menuItem.subItems;
561
- if (subItems && subItems.length > 0) {
562
- subItems = subItems.map((subItem) => this.mapAdaptableMenuItemToSystemMenuItems(subItem.subItems));
563
- }
573
+ // @ts-ignore
574
+ const subItems = this.mapAdaptableMenuItemToSystemMenuItems(menuItem.subItems);
564
575
  return Object.assign(Object.assign({}, menuItem), { menuType: 'Adaptable', subItems });
565
576
  });
566
577
  }
567
578
  createAdaptableColumnMenuItems(menuContext) {
568
- let contextMenuItems = [];
579
+ let columnMenuItems = [];
569
580
  this.adaptableInstance.adaptableModules.forEach((s) => {
570
581
  let menuItems = s.createColumnMenuItems(menuContext.adaptableColumn);
571
582
  if (menuItems) {
572
- contextMenuItems.push(...menuItems.filter(Boolean).filter((item) => item.isVisible !== false));
583
+ columnMenuItems.push(...menuItems.filter(Boolean).filter((item) => item.isVisible !== false));
573
584
  }
574
585
  });
575
- return contextMenuItems;
586
+ return columnMenuItems;
576
587
  }
577
588
  // TODO AFL MIG: pretty sure this logic is duplicated in several other places
578
589
  mapAdaptableIconToAgGridIcon(adaptableIcon, style) {
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  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" || '',
5
- PUBLISH_TIMESTAMP: 1712842436737 || Date.now(),
6
- VERSION: "18.0.0-canary.33" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1712929490526 || Date.now(),
6
+ VERSION: "18.0.0-canary.35" || '--current-version--',
7
7
  };
@@ -357,6 +357,11 @@ export declare const ADAPTABLE_METAMODEL: {
357
357
  desc: string;
358
358
  }[];
359
359
  };
360
+ AdaptableColumnMenuItem: {
361
+ name: string;
362
+ kind: string;
363
+ desc: string;
364
+ };
360
365
  AdaptableColumnPredicate: {
361
366
  name: string;
362
367
  kind: string;
@@ -413,6 +418,11 @@ export declare const ADAPTABLE_METAMODEL: {
413
418
  ref: string;
414
419
  }[];
415
420
  };
421
+ AdaptableContextMenuItem: {
422
+ name: string;
423
+ kind: string;
424
+ desc: string;
425
+ };
416
426
  AdaptableCoordinate: {
417
427
  name: string;
418
428
  kind: string;