@adaptabletools/adaptable 18.0.0-canary.33 → 18.0.0-canary.34

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.esm.tsbuildinfo +1 -1
@@ -24,18 +24,19 @@ export class AgGridMenuAdapter {
24
24
  }
25
25
  const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId((_a = params.column) === null || _a === void 0 ? void 0 : _a.getColId());
26
26
  const menuContext = this.createColumnMenuContextObject(adaptableColumn, params.column);
27
+ /**
28
+ * AG Grid items
29
+ */
30
+ const agGridDefaultStructure = agGridMenuItems.map((itemName) => this.mapAgGridItemTypeToAgGridMenuItem(itemName));
27
31
  const adaptableMenuItems = this.createAdaptableColumnMenuItems(menuContext);
28
32
  const defaultColumnMenuStructure = this.buildColumnMenuDefaultStructure(adaptableMenuItems, menuContext);
29
33
  // 1. first check if there is a custom column menu defined
30
34
  if (typeof menuOptions.customColumnMenu === 'function') {
31
- const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => ({
32
- menuType: 'AgGrid',
33
- name: itemName,
34
- }));
35
+ const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => this.mapAgGridItemTypeToAgGridMenuItem(itemName));
35
36
  const defaultAdaptableMenuItems = adaptableMenuItems.map((adaptableItem) => (Object.assign({ menuType: 'Adaptable' }, adaptableItem)));
36
37
  const customMenuItems = menuOptions
37
38
  .customColumnMenu(Object.assign(Object.assign({}, menuContext), { defaultAgGridMenuItems,
38
- defaultAdaptableMenuItems, defaultAdaptableMenuStructure: this.mapAdaptableMenuItemToSystemMenuItems(defaultColumnMenuStructure) }))
39
+ defaultAdaptableMenuItems, defaultAdaptableMenuStructure: this.mapAdaptableMenuItemToSystemMenuItems(defaultColumnMenuStructure), defaultAgGridMenuStructure: agGridDefaultStructure }))
39
40
  .filter(Boolean);
40
41
  return customMenuItems
41
42
  .map((customMenuItem) => this.mapCustomMenuItemToAgGridMenuDefinition(customMenuItem, menuContext))
@@ -51,56 +52,70 @@ export class AgGridMenuAdapter {
51
52
  }
52
53
  buildContextMenu(params, originalGetContextMenuItems) {
53
54
  var _a;
55
+ if (!params.column) {
56
+ return [];
57
+ }
54
58
  // we do this in order to refresh the internal state of selected cells (technically query the AG Grid cellRanges)
55
59
  // (right-click selected the current cell, but this was not reflected in the internal state of the selected cells)
56
60
  this.adaptableInstance.refreshSelectedCellsState();
57
61
  const menuOptions = this.adaptableOptions.menuOptions;
58
- const agGridMenuItems = (params.defaultItems ? [...params.defaultItems] : []);
59
- if (!params.column) {
60
- return [];
61
- }
62
62
  const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId((_a = params.column) === null || _a === void 0 ? void 0 : _a.getColId());
63
63
  const menuContext = this.createContextMenuContextObject(params, adaptableColumn);
64
+ /**
65
+ * AG Grid Items
66
+ */
67
+ const agGridMenuItems = (params.defaultItems ? [...params.defaultItems] : []);
68
+ const agGridCopyItems = agGridMenuItems.filter((item) => ['copy', 'copyWithHeaders', 'copyWithGroupHeaders', 'cut', 'paste'].includes(item));
69
+ const otherAgGridItems = agGridMenuItems.filter((item) => !agGridCopyItems.includes(item) &&
70
+ // we provide Adaptable exports in the context menu
71
+ !['export', 'csvExport', 'excelExport'].includes(item));
72
+ const agGridDefaultStructure = [
73
+ {
74
+ menuType: 'Group',
75
+ label: 'Copy & Paste',
76
+ icon: {
77
+ name: 'copy',
78
+ },
79
+ subMenuItems: agGridCopyItems.map((item) => this.mapAgGridItemTypeToAgGridMenuItem(item)),
80
+ },
81
+ ...otherAgGridItems
82
+ .filter((itemName) => itemName !== 'separator')
83
+ .map((itemName) => this.mapAgGridItemTypeToAgGridMenuItem(itemName)),
84
+ ];
85
+ /**
86
+ * Adaptable Items
87
+ */
64
88
  const adaptableMenuItems = this.createAdaptableContextMenuItems(menuContext);
65
- const defaultContextMenuStructure = this.buildContextMenuDefaultStructure(adaptableMenuItems, menuContext);
89
+ const adaptableDefaultStructure = this.buildContextMenuDefaultStructure(adaptableMenuItems, menuContext);
90
+ /**
91
+ * Build the context menu
92
+ */
66
93
  // 1. first check if there is a custom context menu defined
67
94
  if (typeof menuOptions.customContextMenu === 'function') {
68
- const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => ({
69
- menuType: 'AgGrid',
70
- name: itemName,
71
- }));
95
+ const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => this.mapAgGridItemTypeToAgGridMenuItem(itemName));
72
96
  const defaultAdaptableMenuItems = adaptableMenuItems.map((adaptableItem) => (Object.assign({ menuType: 'Adaptable' }, adaptableItem)));
73
97
  const customMenuItems = menuOptions
74
98
  .customContextMenu(Object.assign(Object.assign({}, menuContext), { defaultAgGridMenuItems,
75
- defaultAdaptableMenuItems, defaultAdaptableMenuStructure: this.mapAdaptableMenuItemToSystemMenuItems(defaultContextMenuStructure) }))
99
+ defaultAdaptableMenuItems, defaultAdaptableMenuStructure: this.mapAdaptableMenuItemToSystemMenuItems(adaptableDefaultStructure), defaultAgGridMenuStructure: agGridDefaultStructure }))
76
100
  .filter(Boolean);
77
101
  return customMenuItems
78
102
  .map((customMenuItem) => this.mapCustomMenuItemToAgGridMenuDefinition(customMenuItem, menuContext))
79
103
  .filter(Boolean);
80
104
  }
81
105
  // 2. if not, return the default context menu
82
- const agGridCopyItems = agGridMenuItems.filter((item) => ['copy', 'copyWithHeaders', 'copyWithGroupHeaders', 'cut', 'paste'].includes(item));
83
- const otherAgGridItems = agGridMenuItems.filter((item) => !agGridCopyItems.includes(item) &&
84
- // we provide Adaptable exports in the context menu
85
- !['export', 'csvExport', 'excelExport'].includes(item));
86
106
  const defaultContextMenu = [
87
- this.mapCustomMenuItemToAgGridMenuDefinition({
88
- menuType: 'Group',
89
- label: 'Copy & Paste',
90
- icon: {
91
- name: 'copy',
92
- },
93
- subMenuItems: agGridCopyItems.map((item) => ({
94
- menuType: 'AgGrid',
95
- name: item,
96
- })),
97
- }, menuContext),
98
- ...otherAgGridItems,
107
+ ...agGridDefaultStructure.map((agGridItem) => this.mapCustomMenuItemToAgGridMenuDefinition(agGridItem, menuContext)),
99
108
  'separator',
100
- ...defaultContextMenuStructure.map((adaptableItem) => this.mapAdaptableMenuItemToAgGridMenuDefinition(adaptableItem)),
109
+ ...adaptableDefaultStructure.map((adaptableItem) => this.mapAdaptableMenuItemToAgGridMenuDefinition(adaptableItem)),
101
110
  ];
102
111
  return this.removeConsecutiveSeparators(defaultContextMenu);
103
112
  }
113
+ mapAgGridItemTypeToAgGridMenuItem(itemName) {
114
+ return {
115
+ menuType: 'AgGrid',
116
+ name: itemName,
117
+ };
118
+ }
104
119
  // due to entitlements or other reasons, some menu items might be hidden, leading to consecutive separators
105
120
  removeConsecutiveSeparators(menuItems, separator = 'separator') {
106
121
  return menuItems.reduce((acc, item, index, array) => {
@@ -233,7 +248,7 @@ export class AgGridMenuAdapter {
233
248
  // Comment
234
249
  const commentMenuItems = this.getModuleSpecificStructure('Comment', availableMenuItems);
235
250
  // Dashboard
236
- const dashboardMenuItems = this.getModuleSpecificStructure('Dashboard', availableMenuItems);
251
+ const dashboardMenuItems = this.getModuleSpecificStructure('Dashboard', availableMenuItems, 'dashboard-group');
237
252
  // DataImport
238
253
  const dataImportMenuItems = this.getModuleSpecificStructure('DataImport', availableMenuItems);
239
254
  // Export
@@ -260,8 +275,7 @@ export class AgGridMenuAdapter {
260
275
  const gridMenuItem = {
261
276
  name: 'grid-group',
262
277
  label: 'Grid',
263
- // TODO
264
- module: 'ColumnInfo',
278
+ module: 'Group',
265
279
  isVisible: true,
266
280
  icon: {
267
281
  name: 'grid',
@@ -278,8 +292,7 @@ export class AgGridMenuAdapter {
278
292
  const editMenuItem = {
279
293
  name: 'edit-group',
280
294
  label: 'Edit',
281
- // TODO
282
- module: 'ColumnInfo',
295
+ module: 'Group',
283
296
  isVisible: true,
284
297
  icon: {
285
298
  name: 'edit-table',
@@ -289,8 +302,7 @@ export class AgGridMenuAdapter {
289
302
  const columnMenuItem = {
290
303
  name: 'column-group',
291
304
  label: 'Column',
292
- // TODO
293
- module: 'ColumnInfo',
305
+ module: 'Group',
294
306
  isVisible: true,
295
307
  icon: {
296
308
  name: 'columns',
@@ -332,11 +344,11 @@ export class AgGridMenuAdapter {
332
344
  /**
333
345
  * Default strategy for menu items: return as is if there is only one item, otherwise group them under a parent item
334
346
  */
335
- getModuleSpecificStructure(module, menuItems) {
347
+ getModuleSpecificStructure(module, menuItems, groupName) {
336
348
  const moduleItems = menuItems.filter((menuItem) => menuItem.module === module);
337
349
  if (moduleItems.length > 1) {
338
350
  const moduleInfo = this.adaptableInstance.ModuleService.getModuleInfoByModule(module);
339
- return [this.buildMenuGroupParent(module, moduleItems)];
351
+ return [this.buildMenuGroupParent(module, moduleItems, { groupName })];
340
352
  }
341
353
  else {
342
354
  return moduleItems;
@@ -381,6 +393,7 @@ export class AgGridMenuAdapter {
381
393
  ], {
382
394
  label: 'Export',
383
395
  icon: 'export',
396
+ groupName: 'export-group',
384
397
  }));
385
398
  }
386
399
  getLayoutContextMenuStructure(menuItems) {
@@ -398,14 +411,14 @@ export class AgGridMenuAdapter {
398
411
  return [gridActionsItems, otherLayoutItems];
399
412
  }
400
413
  buildMenuGroupParent(module, menuItems, config) {
401
- var _a, _b;
414
+ var _a, _b, _c;
402
415
  const moduleInfo = this.adaptableInstance.ModuleService.getModuleInfoByModule(module);
403
416
  const icon = config && config.icon === false
404
417
  ? undefined
405
418
  : { name: (_a = config === null || config === void 0 ? void 0 : config.icon) !== null && _a !== void 0 ? _a : moduleInfo.Glyph };
406
419
  return {
407
- name: 'menu-group',
408
- label: (_b = config === null || config === void 0 ? void 0 : config.label) !== null && _b !== void 0 ? _b : moduleInfo.FriendlyName,
420
+ name: (_b = config === null || config === void 0 ? void 0 : config.groupName) !== null && _b !== void 0 ? _b : 'menu-group',
421
+ label: (_c = config === null || config === void 0 ? void 0 : config.label) !== null && _c !== void 0 ? _c : moduleInfo.FriendlyName,
409
422
  isVisible: true,
410
423
  module: moduleInfo.ModuleName,
411
424
  icon,
@@ -424,7 +437,7 @@ export class AgGridMenuAdapter {
424
437
  // CustomSort
425
438
  const customSortMenuItems = this.getModuleSpecificStructure('CustomSort', availableMenuItems);
426
439
  // Dashboard
427
- const dashboardMenuItems = this.getModuleSpecificStructure('Dashboard', availableMenuItems);
440
+ const dashboardMenuItems = this.getModuleSpecificStructure('Dashboard', availableMenuItems, 'dashboard-group');
428
441
  // DataImport
429
442
  const dataImportMenuItems = this.getModuleSpecificStructure('DataImport', availableMenuItems);
430
443
  // FlashingCell
@@ -451,8 +464,7 @@ export class AgGridMenuAdapter {
451
464
  const gridMenuItem = {
452
465
  name: 'grid-group',
453
466
  label: 'Grid',
454
- // TODO
455
- module: 'ColumnInfo',
467
+ module: 'Group',
456
468
  isVisible: true,
457
469
  icon: {
458
470
  name: 'grid',
@@ -470,8 +482,7 @@ export class AgGridMenuAdapter {
470
482
  const columnMenuItem = {
471
483
  name: 'column-group',
472
484
  label: 'Column',
473
- // TODO
474
- module: 'ColumnInfo',
485
+ module: 'Group',
475
486
  isVisible: true,
476
487
  icon: {
477
488
  name: 'columns',
@@ -489,8 +500,7 @@ export class AgGridMenuAdapter {
489
500
  const createStyleMenuItem = {
490
501
  name: 'styling-group',
491
502
  label: 'Styling',
492
- // TODO
493
- module: 'ColumnInfo',
503
+ module: 'Group',
494
504
  isVisible: true,
495
505
  icon: {
496
506
  name: 'brush',
@@ -549,26 +559,27 @@ export class AgGridMenuAdapter {
549
559
  return styledColumnMenuItems;
550
560
  }
551
561
  mapAdaptableMenuItemToSystemMenuItems(adaptableMenuItems) {
552
- return (adaptableMenuItems !== null && adaptableMenuItems !== void 0 ? adaptableMenuItems : []).map((menuItem) => {
562
+ if (!adaptableMenuItems) {
563
+ return;
564
+ }
565
+ return adaptableMenuItems.map((menuItem) => {
553
566
  if (menuItem === '-') {
554
567
  return menuItem;
555
568
  }
556
- let subItems = menuItem.subItems;
557
- if (subItems && subItems.length > 0) {
558
- subItems = subItems.map((subItem) => this.mapAdaptableMenuItemToSystemMenuItems(subItem.subItems));
559
- }
569
+ // @ts-ignore
570
+ const subItems = this.mapAdaptableMenuItemToSystemMenuItems(menuItem.subItems);
560
571
  return Object.assign(Object.assign({}, menuItem), { menuType: 'Adaptable', subItems });
561
572
  });
562
573
  }
563
574
  createAdaptableColumnMenuItems(menuContext) {
564
- let contextMenuItems = [];
575
+ let columnMenuItems = [];
565
576
  this.adaptableInstance.adaptableModules.forEach((s) => {
566
577
  let menuItems = s.createColumnMenuItems(menuContext.adaptableColumn);
567
578
  if (menuItems) {
568
- contextMenuItems.push(...menuItems.filter(Boolean).filter((item) => item.isVisible !== false));
579
+ columnMenuItems.push(...menuItems.filter(Boolean).filter((item) => item.isVisible !== false));
569
580
  }
570
581
  });
571
- return contextMenuItems;
582
+ return columnMenuItems;
572
583
  }
573
584
  // TODO AFL MIG: pretty sure this logic is duplicated in several other places
574
585
  mapAdaptableIconToAgGridIcon(adaptableIcon, style) {
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  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: 1712842406643 || Date.now(),
4
- VERSION: "18.0.0-canary.33" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1712926394596 || Date.now(),
4
+ VERSION: "18.0.0-canary.34" || '--current-version--',
5
5
  };
@@ -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;