@adaptabletools/adaptable 18.0.0-canary.28 → 18.0.0-canary.29

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 (55) hide show
  1. package/base.css +3 -13
  2. package/base.css.map +1 -1
  3. package/index.css +3 -13
  4. package/index.css.map +1 -1
  5. package/package.json +1 -1
  6. package/src/AdaptableOptions/AdaptableFrameworkComponent.d.ts +3 -0
  7. package/src/AdaptableOptions/MenuOptions.d.ts +1 -1
  8. package/src/Api/GridApi.d.ts +4 -1
  9. package/src/Api/Implementation/ConfigApiImpl.js +0 -1
  10. package/src/Api/Implementation/GridApiImpl.d.ts +1 -1
  11. package/src/Api/Implementation/GridApiImpl.js +6 -1
  12. package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +14 -5
  13. package/src/Api/Implementation/UserInterfaceApiImpl.js +26 -4
  14. package/src/Api/Internal/AdaptableInternalApi.d.ts +0 -1
  15. package/src/Api/Internal/AdaptableInternalApi.js +2 -6
  16. package/src/Api/Internal/FormatColumnInternalApi.js +6 -2
  17. package/src/Api/Internal/LayoutInternalApi.js +1 -1
  18. package/src/Api/UserInterfaceApi.d.ts +15 -2
  19. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  20. package/src/PredefinedConfig/Common/Menu.d.ts +1 -1
  21. package/src/PredefinedConfig/Common/Menu.js +22 -12
  22. package/src/PredefinedConfig/FormatColumnState.d.ts +4 -0
  23. package/src/PredefinedConfig/PopupState.d.ts +1 -2
  24. package/src/PredefinedConfig/StyledColumnState.d.ts +5 -0
  25. package/src/PredefinedConfig/SystemState.d.ts +4 -2
  26. package/src/Redux/ActionsReducers/PopupRedux.d.ts +5 -13
  27. package/src/Redux/ActionsReducers/PopupRedux.js +0 -19
  28. package/src/Redux/ActionsReducers/SystemRedux.d.ts +9 -3
  29. package/src/Redux/ActionsReducers/SystemRedux.js +8 -5
  30. package/src/Strategy/ExportModule.d.ts +0 -1
  31. package/src/Strategy/ExportModule.js +39 -28
  32. package/src/Strategy/LayoutModule.d.ts +1 -8
  33. package/src/Strategy/LayoutModule.js +3 -113
  34. package/src/Strategy/StyledColumnModule.js +5 -2
  35. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.js +1 -0
  36. package/src/Utilities/Interface/MessagePopups.d.ts +0 -3
  37. package/src/Utilities/Services/RowSummaryService.d.ts +22 -0
  38. package/src/Utilities/Services/RowSummaryService.js +141 -0
  39. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +11 -2
  40. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +1 -1
  41. package/src/View/StyledColumn/Wizard/StyledColumnWizardSettingsSection.js +14 -10
  42. package/src/agGrid/AgGridColumnAdapter.js +19 -13
  43. package/src/agGrid/AgGridMenuAdapter.d.ts +5 -0
  44. package/src/agGrid/AgGridMenuAdapter.js +111 -57
  45. package/src/agGrid/BadgeRenderer.js +7 -1
  46. package/src/agGrid/PercentBarRenderer.js +3 -1
  47. package/src/components/CheckBox/index.js +1 -1
  48. package/src/components/ProgressIndicator/ProgressIndicator.js +15 -6
  49. package/src/components/icons/copy.d.ts +3 -0
  50. package/src/components/icons/copy.js +4 -0
  51. package/src/components/icons/index.js +2 -0
  52. package/src/env.js +2 -2
  53. package/src/metamodel/adaptable.metamodel.js +1 -1
  54. package/src/types.d.ts +1 -1
  55. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -47,7 +47,7 @@ export class AgGridMenuAdapter {
47
47
  'separator',
48
48
  ...defaultColumnMenuStructure.map((adaptableItem) => this.mapAdaptableMenuItemToAgGridMenuDefinition(adaptableItem)),
49
49
  ];
50
- return defaultContextMenu;
50
+ return this.removeConsecutiveSeparators(defaultContextMenu);
51
51
  }
52
52
  buildContextMenu(params, originalGetContextMenuItems) {
53
53
  var _a;
@@ -57,8 +57,7 @@ export class AgGridMenuAdapter {
57
57
  const menuOptions = this.adaptableOptions.menuOptions;
58
58
  const agGridMenuItems = (params.defaultItems ? [...params.defaultItems] : []);
59
59
  if (!params.column) {
60
- // return only AG Grid context if the Adaptable column is not found (should not happen)
61
- return agGridMenuItems;
60
+ return [];
62
61
  }
63
62
  const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId((_a = params.column) === null || _a === void 0 ? void 0 : _a.getColId());
64
63
  const menuContext = this.createContextMenuContextObject(params, adaptableColumn);
@@ -80,12 +79,37 @@ export class AgGridMenuAdapter {
80
79
  .filter(Boolean);
81
80
  }
82
81
  // 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));
83
86
  const defaultContextMenu = [
84
- ...agGridMenuItems,
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,
85
99
  'separator',
86
100
  ...defaultContextMenuStructure.map((adaptableItem) => this.mapAdaptableMenuItemToAgGridMenuDefinition(adaptableItem)),
87
101
  ];
88
- return defaultContextMenu;
102
+ return this.removeConsecutiveSeparators(defaultContextMenu);
103
+ }
104
+ // due to entitlements or other reasons, some menu items might be hidden, leading to consecutive separators
105
+ removeConsecutiveSeparators(menuItems, separator = 'separator') {
106
+ return menuItems.reduce((acc, item, index, array) => {
107
+ if (item === separator && array[index + 1] === separator) {
108
+ return acc;
109
+ }
110
+ acc.push(item);
111
+ return acc;
112
+ }, []);
89
113
  }
90
114
  createColumnMenuContextObject(adaptableColumn, agGridColumn) {
91
115
  return Object.assign(Object.assign({}, this.adaptableInstance.api.internalApi.buildBaseContext()), { adaptableColumn: adaptableColumn, agGridColumn: agGridColumn, isRowGroupColumn: this.adaptableInstance.api.columnApi.isAutoRowGroupColumn(agGridColumn.getColId()) });
@@ -251,6 +275,17 @@ export class AgGridMenuAdapter {
251
275
  ...gridInfoMenuItems,
252
276
  ],
253
277
  };
278
+ const editMenuItem = {
279
+ name: 'edit-group',
280
+ label: 'Edit',
281
+ // TODO
282
+ module: 'ColumnInfo',
283
+ isVisible: true,
284
+ icon: {
285
+ name: 'edit-table',
286
+ },
287
+ subItems: [...bulkUpdateMenuItems, ...smartEditMenuItems],
288
+ };
254
289
  const columnMenuItem = {
255
290
  name: 'column-group',
256
291
  label: 'Column',
@@ -260,27 +295,39 @@ export class AgGridMenuAdapter {
260
295
  icon: {
261
296
  name: 'columns',
262
297
  },
263
- subItems: [
264
- ...bulkUpdateMenuItems,
265
- ...smartEditMenuItems,
266
- ...calculatedColumnMenuItems,
267
- ...columnInfoMenuItems,
268
- ],
298
+ subItems: [...calculatedColumnMenuItems, ...columnInfoMenuItems],
269
299
  };
270
- return [
300
+ return this.removeConsecutiveSeparators([
301
+ ...exportMenuItems,
302
+ '-',
271
303
  ...noteMenuItems,
272
304
  ...commentMenuItems,
273
- '-',
274
- ...settingsPanelMenuItems,
275
- ...dashboardMenuItems,
276
305
  ...columnFilterMenuItems,
277
- gridMenuItem,
278
- columnMenuItem,
279
- ...exportMenuItems,
280
306
  ...flashingCellMenuItems,
281
307
  ...alertMenuItems,
282
308
  ...fdc3MenuItems,
283
- ];
309
+ '-',
310
+ ...settingsPanelMenuItems,
311
+ ...dashboardMenuItems,
312
+ '-',
313
+ ...this.normalizeMenuGroup(editMenuItem),
314
+ '-',
315
+ ...this.normalizeMenuGroup(gridMenuItem),
316
+ ...this.normalizeMenuGroup(columnMenuItem),
317
+ ], '-');
318
+ }
319
+ /**
320
+ * Hide menu group with no subitems or elevate single subitem to parent level
321
+ */
322
+ normalizeMenuGroup(menuItem) {
323
+ var _a, _b;
324
+ if (!((_a = menuItem.subItems) === null || _a === void 0 ? void 0 : _a.length)) {
325
+ return [];
326
+ }
327
+ if (((_b = menuItem.subItems) === null || _b === void 0 ? void 0 : _b.length) === 1) {
328
+ return [menuItem.subItems[0]];
329
+ }
330
+ return [menuItem];
284
331
  }
285
332
  /**
286
333
  * Default strategy for menu items: return as is if there is only one item, otherwise group them under a parent item
@@ -300,35 +347,41 @@ export class AgGridMenuAdapter {
300
347
  if (!exportMenuItems.length) {
301
348
  return [];
302
349
  }
303
- const cellSelectionItems = exportMenuItems.filter((item) => item.name.startsWith('export-cells'));
304
- const canExportCells = cellSelectionItems.length;
305
- const rowSelectionItems = exportMenuItems.filter((item) => item.name.startsWith('export-rows'));
306
- const canExportRows = rowSelectionItems.length;
307
- if (canExportCells && !canExportRows) {
308
- return [
309
- this.buildMenuGroupParent('Export', cellSelectionItems, {
310
- label: 'Export Selected Cells',
311
- }),
312
- ];
313
- }
314
- if (!canExportCells && canExportRows) {
315
- return [
316
- this.buildMenuGroupParent('Export', rowSelectionItems, {
317
- label: 'Export Selected Rows',
318
- }),
319
- ];
320
- }
321
- if (canExportCells && canExportRows) {
322
- const cellsSubMenu = this.buildMenuGroupParent('Export', cellSelectionItems, {
323
- label: 'Cells',
324
- });
325
- const rowsSubMenu = this.buildMenuGroupParent('Export', rowSelectionItems, { label: 'Rows' });
326
- return [
327
- this.buildMenuGroupParent('Export', [cellsSubMenu, rowsSubMenu], {
328
- label: 'Export Selected',
350
+ const visualReportItems = exportMenuItems.filter((item) => item.name.startsWith('export-visual-data-excel'));
351
+ const visualDataExportItems = visualReportItems.length
352
+ ? [
353
+ this.buildMenuGroupParent('Export', exportMenuItems.filter((item) => item.name.startsWith('export-visual-data-excel')), {
354
+ label: 'Visual Data',
355
+ icon: false,
329
356
  }),
330
- ];
331
- }
357
+ ]
358
+ : [];
359
+ const allDataExportItems = this.normalizeMenuGroup(this.buildMenuGroupParent('Export', exportMenuItems.filter((item) => item.name.startsWith('export-all-data')), {
360
+ label: 'All Data',
361
+ icon: false,
362
+ }));
363
+ const currentDataExportItems = this.normalizeMenuGroup(this.buildMenuGroupParent('Export', exportMenuItems.filter((item) => item.name.startsWith('export-current-data')), {
364
+ label: 'Current Data',
365
+ icon: false,
366
+ }));
367
+ const selectedCellsExportItems = this.normalizeMenuGroup(this.buildMenuGroupParent('Export', exportMenuItems.filter((item) => item.name.startsWith('export-selected-cells')), {
368
+ label: 'Selected Cells',
369
+ icon: false,
370
+ }));
371
+ const selectedRowsExportItems = this.normalizeMenuGroup(this.buildMenuGroupParent('Export', exportMenuItems.filter((item) => item.name.startsWith('export-selected-rows')), {
372
+ label: 'Selected Rows',
373
+ icon: false,
374
+ }));
375
+ return this.normalizeMenuGroup(this.buildMenuGroupParent('Export', [
376
+ ...visualDataExportItems,
377
+ ...allDataExportItems,
378
+ ...currentDataExportItems,
379
+ ...selectedCellsExportItems,
380
+ ...selectedRowsExportItems,
381
+ ], {
382
+ label: 'Export',
383
+ icon: 'export',
384
+ }));
332
385
  }
333
386
  getLayoutContextMenuStructure(menuItems) {
334
387
  const layoutMenuItems = menuItems.filter((menuItem) => menuItem.module === 'Layout');
@@ -347,14 +400,15 @@ export class AgGridMenuAdapter {
347
400
  buildMenuGroupParent(module, menuItems, config) {
348
401
  var _a, _b;
349
402
  const moduleInfo = this.adaptableInstance.ModuleService.getModuleInfoByModule(module);
403
+ const icon = config && config.icon === false
404
+ ? undefined
405
+ : { name: (_a = config === null || config === void 0 ? void 0 : config.icon) !== null && _a !== void 0 ? _a : moduleInfo.Glyph };
350
406
  return {
351
407
  name: 'menu-group',
352
- label: (_a = config === null || config === void 0 ? void 0 : config.label) !== null && _a !== void 0 ? _a : moduleInfo.FriendlyName,
408
+ label: (_b = config === null || config === void 0 ? void 0 : config.label) !== null && _b !== void 0 ? _b : moduleInfo.FriendlyName,
353
409
  isVisible: true,
354
410
  module: moduleInfo.ModuleName,
355
- icon: {
356
- name: (_b = config === null || config === void 0 ? void 0 : config.icon) !== null && _b !== void 0 ? _b : moduleInfo.Glyph,
357
- },
411
+ icon,
358
412
  subItems: menuItems,
359
413
  };
360
414
  }
@@ -441,16 +495,16 @@ export class AgGridMenuAdapter {
441
495
  icon: {
442
496
  name: 'brush',
443
497
  },
444
- subItems: [...flashingCellMenuItems, ...formatColumnMenuItems, ...styledColumnMenuItems],
498
+ subItems: [...formatColumnMenuItems, ...styledColumnMenuItems, ...flashingCellMenuItems],
445
499
  };
446
- return [
500
+ return this.removeConsecutiveSeparators([
447
501
  ...settingsPanelMenuItems,
448
502
  ...dashboardMenuItems,
449
503
  ...columnFilterGroup,
450
- createStyleMenuItem,
451
- gridMenuItem,
452
- columnMenuItem,
453
- ];
504
+ ...this.normalizeMenuGroup(createStyleMenuItem),
505
+ ...this.normalizeMenuGroup(gridMenuItem),
506
+ ...this.normalizeMenuGroup(columnMenuItem),
507
+ ], '-');
454
508
  }
455
509
  getColumnFilterColumnMenuStructure(menuItems) {
456
510
  const columnFilterMenuItems = menuItems.filter((menuItem) => menuItem.module === 'ColumnFilter');
@@ -1,6 +1,7 @@
1
1
  import { Badge } from '../View/Components/Badge';
2
2
  import { renderWithAdaptableContext } from '../View/renderWithAdaptableContext';
3
3
  import * as React from 'react';
4
+ import { ROW_SUMMARY_ROW_ID } from '../PredefinedConfig/Common/RowSummary';
4
5
  export const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
5
6
  if (!styledColumn.BadgeStyle) {
6
7
  return;
@@ -11,7 +12,7 @@ export const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
11
12
  return adaptable;
12
13
  }
13
14
  init(params) {
14
- var _a, _b, _c;
15
+ var _a, _b, _c, _d, _e, _f, _g;
15
16
  const adaptable = this.getAdaptableInstance(params);
16
17
  const adapatableApi = adaptable.api;
17
18
  this.eGui = document.createElement('div');
@@ -23,6 +24,11 @@ export const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
23
24
  this.eGui.innerHTML = formattedValue;
24
25
  return;
25
26
  }
27
+ if (((_d = params === null || params === void 0 ? void 0 : params.data) === null || _d === void 0 ? void 0 : _d[ROW_SUMMARY_ROW_ID]) && !styledColumn.IncludeRowSummaries) {
28
+ const formattedValue = (_g = (_f = (_e = params.formatValue) === null || _e === void 0 ? void 0 : _e.call(params, params.value)) !== null && _f !== void 0 ? _f : params.value) !== null && _g !== void 0 ? _g : '';
29
+ this.eGui.innerHTML = formattedValue;
30
+ return;
31
+ }
26
32
  if (['NumberArray', 'StringArray'].includes(abColumn.dataType)) {
27
33
  this.renderArrayValues(params, adapatableApi);
28
34
  }
@@ -13,7 +13,9 @@ export const getPercentBarRendererForColumn = (styledColumn, abColumn, api) => {
13
13
  if (Helper.objectNotExists(value)) {
14
14
  value = 0;
15
15
  }
16
- if (!styledColumn.IncludeGroupedRows && api.gridApi.isGroupRowNode(params.node)) {
16
+ // No longer support showing Percent Bar in Grouped Rows
17
+ if (api.gridApi.isGroupRowNode(params.node)) {
18
+ // if (!styledColumn.IncludeGroupedRows && api.gridApi.isGroupRowNode(params.node)) {
17
19
  if (params.value) {
18
20
  this.eGui = document.createElement('div');
19
21
  this.eGui.append(params.value);
@@ -1,6 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import * as React from 'react';
3
- import { useState, useRef } from 'react';
3
+ import { useRef, useState } from 'react';
4
4
  import { Box, Flex } from 'rebass';
5
5
  import join from '../utils/join';
6
6
  const Square = (props) => {
@@ -3,8 +3,12 @@ import { useSelector } from 'react-redux';
3
3
  import { useEffect, useState } from 'react';
4
4
  import { LoaderSpinner } from '../Loader';
5
5
  import { useAdaptable } from '../../View/AdaptableContext';
6
+ import { ExternalRenderer } from '../../View/Components/ExternalRenderer';
7
+ import Dialog from '../Dialog';
8
+ import { Box, Flex } from 'rebass';
6
9
  export const ProgressIndicator = () => {
7
- const { active, label } = useSelector((state) => state.System.ProgressIndicator);
10
+ const adaptable = useAdaptable();
11
+ const { active, text, render, frameworkComponent } = useSelector((state) => state.System.ProgressIndicator);
8
12
  const [visible, setVisible] = useState(false);
9
13
  const [progressIndicatorCoordinates, setProgressIndicatorCoordinates] = useState({
10
14
  top: 0,
@@ -12,7 +16,6 @@ export const ProgressIndicator = () => {
12
16
  height: 0,
13
17
  width: 0,
14
18
  });
15
- const adaptable = useAdaptable();
16
19
  const disableAdaptableGrid = (containerElement, disabled) => {
17
20
  const DISABLING_CSS_CLASS = 'ab-wait-for-progress-indicator';
18
21
  if (!containerElement) {
@@ -35,14 +38,20 @@ export const ProgressIndicator = () => {
35
38
  useEffect(() => {
36
39
  disableAdaptableGrid(adaptable.getAdaptableContainerElement(), active);
37
40
  disableAdaptableGrid(adaptable.getAgGridContainerElement(), active);
38
- updateGridContainerCoordinates(adaptable.getAdaptableContainerElement());
41
+ updateGridContainerCoordinates(adaptable.getAgGridContainerElement());
39
42
  // without rAF the progress indicator would be rendered instantly, without the 'transition-delay' defined via CSS
40
43
  requestAnimationFrame(() => {
41
44
  setVisible(active);
42
45
  });
43
46
  }, [active]);
44
- return (React.createElement(React.Fragment, null, active && (React.createElement("div", { className: `ab-progress-indicator-wrapper ${visible ? 'ab-progress-indicator-wrapper--visible' : ''}`, style: progressIndicatorCoordinates },
45
- React.createElement("div", { className: "ab-progress-indicator-body" },
47
+ let customEl = null;
48
+ if (render || frameworkComponent) {
49
+ customEl = React.createElement(ExternalRenderer, { render: render, frameworkComponent: frameworkComponent });
50
+ }
51
+ return (React.createElement(React.Fragment, null, active && (React.createElement(Dialog, { modal: true, isOpen: true, showCloseButton: false, className: `ab-ProgressIndicator ${visible ? 'ab-ProgressIndicator--visible' : ''}` },
52
+ React.createElement(Flex, { alignItems: "center", flexDirection: "column", p: 3, className: "ab-ProgressIndicator-body" },
46
53
  React.createElement(LoaderSpinner, null),
47
- React.createElement("span", { style: { marginLeft: 'var(--ab-space-2)' } }, label))))));
54
+ React.createElement(Box, { mt: 3 },
55
+ text && React.createElement(Box, null, text),
56
+ customEl))))));
48
57
  };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import DefaultIcon from './DefaultIcon';
3
+ export default (props) => (React.createElement(DefaultIcon, Object.assign({}, props, { viewBox: "0 -960 960 960" }),
4
+ React.createElement("path", { d: "M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z" })));
@@ -161,6 +161,7 @@ import Comments from './comments';
161
161
  import SelectAll from './select-all';
162
162
  import SelectOff from './select-off';
163
163
  import SelectFwd from './select-fwd';
164
+ import Copy from './copy';
164
165
  import { IconComponent } from '../Icon';
165
166
  import { AdaptableLogger } from '../../agGrid/AdaptableLogger';
166
167
  export const allIcons = {
@@ -168,6 +169,7 @@ export const allIcons = {
168
169
  grid: Layout,
169
170
  cells: CellSummary,
170
171
  columns: ColumnChooser,
172
+ copy: Copy,
171
173
  'chart-and-grid': CalculatedColumn,
172
174
  laptop: Application,
173
175
  alert: Alert,
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: 1712667835989 || Date.now(),
4
- VERSION: "18.0.0-canary.28" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1712751917039 || Date.now(),
4
+ VERSION: "18.0.0-canary.29" || '--current-version--',
5
5
  };