@adaptabletools/adaptable-cjs 18.0.0-canary.11 → 18.0.0-canary.12

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 (80) hide show
  1. package/base.css +4 -0
  2. package/base.css.map +1 -1
  3. package/index.css +6 -0
  4. package/index.css.map +1 -1
  5. package/package.json +1 -1
  6. package/src/AdaptableOptions/AdaptableOptions.d.ts +2 -2
  7. package/src/AdaptableOptions/ColumnOptions.d.ts +7 -4
  8. package/src/AdaptableOptions/CommentOptions.d.ts +9 -7
  9. package/src/AdaptableOptions/NoteOptions.d.ts +4 -1
  10. package/src/Api/AdaptableApi.d.ts +2 -2
  11. package/src/Api/ColumnApi.d.ts +4 -0
  12. package/src/Api/CommentApi.d.ts +11 -12
  13. package/src/Api/ConfigApi.d.ts +2 -2
  14. package/src/Api/EventApi.d.ts +7 -9
  15. package/src/Api/Events/CommentChanged.d.ts +11 -0
  16. package/src/Api/GridApi.d.ts +4 -0
  17. package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -2
  18. package/src/Api/Implementation/AdaptableApiImpl.js +2 -2
  19. package/src/Api/Implementation/ApiBase.d.ts +2 -2
  20. package/src/Api/Implementation/ApiBase.js +1 -1
  21. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  22. package/src/Api/Implementation/ColumnApiImpl.js +10 -0
  23. package/src/Api/Implementation/CommentsApiImpl.d.ts +1 -2
  24. package/src/Api/Implementation/ConfigApiImpl.d.ts +2 -2
  25. package/src/Api/Implementation/ConfigApiImpl.js +2 -2
  26. package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
  27. package/src/Api/Implementation/GridApiImpl.js +9 -0
  28. package/src/Api/Implementation/{NotesApiImpl.d.ts → NoteApiImpl.d.ts} +7 -7
  29. package/src/Api/Implementation/{NotesApiImpl.js → NoteApiImpl.js} +6 -6
  30. package/src/Api/Implementation/OptionsApiImpl.d.ts +4 -5
  31. package/src/Api/Implementation/OptionsApiImpl.js +2 -12
  32. package/src/Api/Internal/AdaptableInternalApi.d.ts +1 -1
  33. package/src/Api/Internal/ExportInternalApi.d.ts +2 -1
  34. package/src/Api/Internal/ExportInternalApi.js +4 -1
  35. package/src/Api/Internal/NotesInternalApi.d.ts +1 -1
  36. package/src/Api/Internal/NotesInternalApi.js +3 -3
  37. package/src/Api/{NotesApi.d.ts → NoteApi.d.ts} +14 -14
  38. package/src/Api/OptionsApi.d.ts +8 -12
  39. package/src/PredefinedConfig/AdaptableState.d.ts +2 -2
  40. package/src/PredefinedConfig/CommentState.d.ts +13 -13
  41. package/src/PredefinedConfig/Common/RowSummary.d.ts +6 -0
  42. package/src/PredefinedConfig/{NotesState.d.ts → NoteState.d.ts} +2 -2
  43. package/src/PredefinedConfig/PredefinedConfig.d.ts +2 -2
  44. package/src/PredefinedConfig/Selection/GridCell.d.ts +13 -0
  45. package/src/PredefinedConfig/SystemState.d.ts +2 -3
  46. package/src/Redux/ActionsReducers/NotesRedux.d.ts +6 -6
  47. package/src/Redux/ActionsReducers/NotesRedux.js +1 -1
  48. package/src/Redux/ActionsReducers/SystemRedux.js +3 -3
  49. package/src/Redux/Store/AdaptableStore.js +3 -9
  50. package/src/Strategy/CommentsModule.js +4 -4
  51. package/src/Strategy/NotesModule.js +5 -5
  52. package/src/Utilities/Services/CellPopupService.js +2 -2
  53. package/src/Utilities/Services/Interface/IReportService.d.ts +1 -4
  54. package/src/Utilities/Services/ReportService.d.ts +7 -5
  55. package/src/Utilities/Services/ReportService.js +238 -22
  56. package/src/View/Components/NewScopeComponent.js +2 -2
  57. package/src/View/Components/Popups/GridCellPopup/GridCellPopup.js +1 -1
  58. package/src/View/Layout/LayoutViewPanel.js +2 -1
  59. package/src/View/Layout/Wizard/LayoutWizard.js +3 -2
  60. package/src/View/Notes/NotesPopup.js +3 -3
  61. package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
  62. package/src/agGrid/AdaptableAgGrid.d.ts +2 -0
  63. package/src/agGrid/AdaptableAgGrid.js +93 -54
  64. package/src/agGrid/AgGridAdapter.d.ts +1 -0
  65. package/src/agGrid/AgGridAdapter.js +3 -0
  66. package/src/agGrid/AgGridColumnAdapter.d.ts +1 -1
  67. package/src/agGrid/AgGridColumnAdapter.js +2 -2
  68. package/src/agGrid/AgGridOptionsService.d.ts +4 -1
  69. package/src/agGrid/AgGridOptionsService.js +22 -0
  70. package/src/env.js +2 -2
  71. package/src/metamodel/adaptable.metamodel.d.ts +41 -3
  72. package/src/metamodel/adaptable.metamodel.js +1 -1
  73. package/src/types.d.ts +22 -20
  74. package/tsconfig.cjs.tsbuildinfo +1 -1
  75. package/src/Api/Events/CommentsChangedInfo.d.ts +0 -5
  76. package/src/PredefinedConfig/CellAddress.d.ts +0 -13
  77. package/src/PredefinedConfig/CellAddress.js +0 -5
  78. /package/src/Api/Events/{CommentsChangedInfo.js → CommentChanged.js} +0 -0
  79. /package/src/Api/{NotesApi.js → NoteApi.js} +0 -0
  80. /package/src/PredefinedConfig/{NotesState.js → NoteState.js} +0 -0
@@ -11,6 +11,8 @@ const StringExtensions_1 = tslib_1.__importDefault(require("../Extensions/String
11
11
  const ModuleConstants_1 = require("../Constants/ModuleConstants");
12
12
  const uuid_1 = require("../../components/utils/uuid");
13
13
  const ObjectFactory_1 = require("../ObjectFactory");
14
+ const StyleHelper_1 = require("../Helpers/StyleHelper");
15
+ const tinycolor2_1 = tslib_1.__importDefault(require("tinycolor2"));
14
16
  class ReportService {
15
17
  constructor(adaptableApi) {
16
18
  this.adaptableApi = adaptableApi;
@@ -19,29 +21,12 @@ class ReportService {
19
21
  this.excelStylesWithFormattedDate = {};
20
22
  this.adaptableApi = adaptableApi;
21
23
  }
22
- resetExcelStyleMemoization() {
23
- this.excelStylesCache = {};
24
- this.cellClassKey2excelStyleIdMap = {};
25
- this.excelStylesWithFormattedDate = {};
26
- }
27
- registerExcelStyle(excelStyle, cellClassKey) {
28
- const excelStyleKey = JSON.stringify(excelStyle);
29
- if (!this.excelStylesCache[excelStyleKey]) {
30
- const excelStyleId = (0, uuid_1.createUuid)();
31
- const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
32
- this.excelStylesCache[excelStyleKey] = excelStyleWithId;
33
- }
34
- this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
35
- }
36
- getRegisteredExcelStyles() {
37
- return Object.values(this.excelStylesCache);
24
+ destroy() {
25
+ // TO DO
38
26
  }
39
27
  getExcelStyleIdForCellClassKey(cellClassKey) {
40
28
  return this.cellClassKey2excelStyleIdMap[cellClassKey];
41
29
  }
42
- registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
43
- this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
44
- }
45
30
  getExcelStyleWithFormattedDate(cellClassId) {
46
31
  return this.excelStylesWithFormattedDate[cellClassId];
47
32
  }
@@ -369,9 +354,6 @@ class ReportService {
369
354
  }
370
355
  return fileName;
371
356
  }
372
- destroy() {
373
- // TO DO
374
- }
375
357
  getCustomExportDateFormat() {
376
358
  return this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
377
359
  }
@@ -383,5 +365,239 @@ class ReportService {
383
365
  : // type === formattedValue
384
366
  this.adaptableApi.gridApi.getDisplayValueFromRawValue(rowNode, columnId, cellRawValue);
385
367
  }
368
+ // aggregate and merge all acive Adaptable styles with the user proviided ExcelStyles
369
+ buildExcelStylesForVisualReports() {
370
+ // for historical reasons, the styles are merged as class variables
371
+ // we could/should refactor this to be more functional
372
+ this.createExcelStyleMemoization();
373
+ return Object.values(this.excelStylesCache);
374
+ }
375
+ createExcelStyleMemoization() {
376
+ this.resetExcelStyleMemoization();
377
+ // we memoize as much as possible, as this is called quite A LOT
378
+ const adaptableColumnMap = {};
379
+ const getAdaptableColumnWithColumnId = (columnId) => {
380
+ const memoizedColumn = adaptableColumnMap[columnId];
381
+ if (memoizedColumn) {
382
+ return memoizedColumn;
383
+ }
384
+ const abColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
385
+ adaptableColumnMap[columnId] = abColumn;
386
+ return abColumn;
387
+ };
388
+ const formatColumnsWithDisplayFormatForColumn = {};
389
+ const getFormatColumnsWithDisplayFormatForColumn = (columnId) => {
390
+ const memoizedFormatColumns = formatColumnsWithDisplayFormatForColumn[columnId];
391
+ if (memoizedFormatColumns) {
392
+ return memoizedFormatColumns;
393
+ }
394
+ const abColumn = getAdaptableColumnWithColumnId(columnId);
395
+ const formatColumns = this.adaptableApi.formatColumnApi.internalApi.getFormatColumnsWithDisplayFormatForColumn(abColumn);
396
+ formatColumnsWithDisplayFormatForColumn[columnId] = formatColumns;
397
+ return formatColumns;
398
+ };
399
+ const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue();
400
+ const displayedColumns = this.adaptableApi.agGridApi.getAllDisplayedColumns();
401
+ const colDefs = displayedColumns.map((column) => {
402
+ return column.getColDef();
403
+ });
404
+ const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
405
+ const agGridApi = this.adaptableApi.agGridApi;
406
+ const userExcelStyles = this.adaptableApi.internalApi
407
+ .getAdaptableInstance()
408
+ .agGridAdapter.getUserGridOptionsProperty('excelStyles') || [];
409
+ this.adaptableApi.internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
410
+ var _a;
411
+ const rowParams = {
412
+ node,
413
+ data: node.data,
414
+ rowIndex,
415
+ api: agGridApi,
416
+ columnApi: null,
417
+ context: ((_a = agGridApi.__getContext) === null || _a === void 0 ? void 0 : _a.call(agGridApi)) || {},
418
+ };
419
+ const getRowStyleFn = agGridApi.getGridOption('getRowStyle');
420
+ const rowStyle = getRowStyleFn ? getRowStyleFn(rowParams) : {};
421
+ displayedColumns.forEach((column, columnIndex) => {
422
+ var _a, _b, _c;
423
+ const colDef = colDefs[columnIndex];
424
+ let cellClassParams;
425
+ const getLazyCellClassParams = () => {
426
+ if (!cellClassParams) {
427
+ cellClassParams = {
428
+ colDef,
429
+ node,
430
+ column,
431
+ data: node.data,
432
+ value: this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId()),
433
+ rowIndex,
434
+ api: agGridApi,
435
+ columnApi: null,
436
+ context: {},
437
+ };
438
+ }
439
+ return cellClassParams;
440
+ };
441
+ const cellStyle = typeof colDef.cellStyle === 'function' ? colDef.cellStyle(getLazyCellClassParams()) : {};
442
+ const excelStyles = [];
443
+ // add user defined excel styles
444
+ let userColDefCellClass = this.adaptableApi.internalApi
445
+ .getAdaptableInstance()
446
+ .agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
447
+ const userDefinedCellClass = typeof userColDefCellClass === 'function'
448
+ ? userColDefCellClass(getLazyCellClassParams())
449
+ : userColDefCellClass;
450
+ const userDefinedExcelStyle = userDefinedCellClass &&
451
+ userExcelStyles.find((excelStyle) => {
452
+ var _a;
453
+ return typeof userDefinedCellClass === 'string'
454
+ ? userDefinedCellClass === excelStyle.id
455
+ : (_a = userDefinedCellClass === null || userDefinedCellClass === void 0 ? void 0 : userDefinedCellClass.includes) === null || _a === void 0 ? void 0 : _a.call(userDefinedCellClass, excelStyle.id);
456
+ });
457
+ if (userDefinedExcelStyle) {
458
+ excelStyles.push(userDefinedExcelStyle);
459
+ }
460
+ // add adaptable derived styles (format column etc.)
461
+ const adaptableStyle = Object.assign(Object.assign({}, rowStyle), Object.keys(cellStyle).reduce((result, key) => {
462
+ if (cellStyle[key] !== null) {
463
+ result[key] = cellStyle[key];
464
+ }
465
+ return result;
466
+ }, {}));
467
+ const sanitizedAdaptableStyle = (0, StyleHelper_1.sanitizeStyle)(adaptableStyle);
468
+ if (Object.values(sanitizedAdaptableStyle).some((style) => style != null)) {
469
+ excelStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableStyle));
470
+ }
471
+ const excelDataType = this.adaptableApi.exportApi.internalApi.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
472
+ const rawValue = this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId());
473
+ // don't add the cell style if it has no adaptable custom styles
474
+ if (!excelStyles.length &&
475
+ // if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
476
+ !(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
477
+ return;
478
+ }
479
+ const cellClassId = this.adaptableApi.internalApi
480
+ .getAdaptableInstance()
481
+ .agGridColumnAdapter.getExcelClassNameForCell(column.getId(), this.adaptableApi.internalApi
482
+ .getAdaptableInstance()
483
+ .getPrimaryKeyValueFromRowNode(node), userDefinedCellClass);
484
+ const finalCellExcelStyle = Object.assign({}, ...excelStyles);
485
+ if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
486
+ let dateFormatPattern = this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
487
+ const abColumn = getAdaptableColumnWithColumnId(column.getColId());
488
+ if (!dateFormatPattern) {
489
+ const mostRelevantFormatColumn = this.adaptableApi.formatColumnApi.internalApi.getMostRelevantFormatColumnForColumn(getFormatColumnsWithDisplayFormatForColumn(column.getColId()), abColumn, { node, value: rawValue });
490
+ dateFormatPattern =
491
+ ((_a = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _a === void 0 ? void 0 : _a.Formatter) === 'DateFormatter' &&
492
+ ((_c = (_b = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _b === void 0 ? void 0 : _b.Options) === null || _c === void 0 ? void 0 : _c.Pattern);
493
+ }
494
+ if (dateFormatPattern) {
495
+ const normalisedValue = this.adaptableApi.internalApi
496
+ .getAdaptableInstance()
497
+ .getNormalisedValueFromRawValue(rawValue, abColumn);
498
+ if (normalisedValue) {
499
+ // we have to pass the date in the ISO format to Excel
500
+ // see https://www.ag-grid.com/javascript-data-grid/excel-export-data-types/#dates
501
+ // we can NOT use Date.toISOString() because we don't want the timezone corrections to kick in
502
+ const isoFormattedValue = (0, FormatHelper_1.DateFormatter)(normalisedValue, {
503
+ Pattern: `yyyy-MM-dd'T'HH:mm:ss.SSS`,
504
+ });
505
+ if (isoFormattedValue) {
506
+ finalCellExcelStyle.dataType = 'DateTime';
507
+ finalCellExcelStyle.numberFormat = { format: dateFormatPattern };
508
+ // create a new cell key to ensure any user provided className does not interfere
509
+ const cellKey = this.adaptableApi.internalApi
510
+ .getAdaptableInstance()
511
+ .agGridColumnAdapter.getExcelClassNameForCell(column.getColId(), this.adaptableApi.internalApi
512
+ .getAdaptableInstance()
513
+ .getPrimaryKeyValueFromRowNode(node));
514
+ // we need to register so that later the cellProcessor will put the isoFormattedValue through (thus giving the formatting responsability to Excel)
515
+ this.registerExcelStyleWithFormattedDate(cellKey, isoFormattedValue);
516
+ }
517
+ }
518
+ }
519
+ }
520
+ this.registerExcelStyle(finalCellExcelStyle, cellClassId);
521
+ });
522
+ }, forAllVisibleRowNodesDoConfig);
523
+ }
524
+ convertCSSToExcelStyle(style) {
525
+ const getHexColor = (color) => {
526
+ const preparedColor = (0, StyleHelper_1.getVariableColor)(color);
527
+ const t = (0, tinycolor2_1.default)(preparedColor);
528
+ const a = t.getAlpha();
529
+ return tinycolor2_1.default.mix((0, tinycolor2_1.default)('white'), t, a * 100).toHexString();
530
+ };
531
+ let result = {};
532
+ if (style.backgroundColor != null) {
533
+ result.interior = {
534
+ color: getHexColor(style.backgroundColor),
535
+ pattern: 'Solid',
536
+ };
537
+ }
538
+ if (style.borderColor != null) {
539
+ const excelBorder = {
540
+ color: style.borderColor,
541
+ lineStyle: 'Continuous',
542
+ weight: 1,
543
+ };
544
+ result.borders = {
545
+ borderBottom: excelBorder,
546
+ borderLeft: excelBorder,
547
+ borderRight: excelBorder,
548
+ borderTop: excelBorder,
549
+ };
550
+ }
551
+ if (style.textAlign) {
552
+ result.alignment = {
553
+ horizontal: StringExtensions_1.default.CapitaliseFirstLetter(style.textAlign),
554
+ };
555
+ }
556
+ if (style.color != null) {
557
+ if (!result.font) {
558
+ result.font = {};
559
+ }
560
+ result.font = {
561
+ color: getHexColor(style.color),
562
+ };
563
+ }
564
+ if (style.fontStyle === 'italic') {
565
+ if (!result.font) {
566
+ result.font = {};
567
+ }
568
+ result.font.italic = true;
569
+ }
570
+ if (style.fontWeight != null &&
571
+ (style.fontWeight === 'bold' || Number(style.fontWeight) >= 600)) {
572
+ if (!result.font) {
573
+ result.font = {};
574
+ }
575
+ result.font.bold = true;
576
+ }
577
+ if (style.fontSize != null) {
578
+ if (!result.font) {
579
+ result.font = {};
580
+ }
581
+ result.font.size = (0, StyleHelper_1.convertCSSAbsoluteFontSizeToPt)(style.fontSize);
582
+ }
583
+ return result;
584
+ }
585
+ resetExcelStyleMemoization() {
586
+ this.excelStylesCache = {};
587
+ this.cellClassKey2excelStyleIdMap = {};
588
+ this.excelStylesWithFormattedDate = {};
589
+ }
590
+ registerExcelStyle(excelStyle, cellClassKey) {
591
+ const excelStyleKey = JSON.stringify(excelStyle);
592
+ if (!this.excelStylesCache[excelStyleKey]) {
593
+ const excelStyleId = (0, uuid_1.createUuid)();
594
+ const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
595
+ this.excelStylesCache[excelStyleKey] = excelStyleWithId;
596
+ }
597
+ this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
598
+ }
599
+ registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
600
+ this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
601
+ }
386
602
  }
387
603
  exports.ReportService = ReportService;
@@ -145,7 +145,7 @@ const NewScopeComponent = (props) => {
145
145
  }
146
146
  const hasColumnTypes = React.useMemo(() => {
147
147
  var _a;
148
- return ((_a = api.optionsApi.getColumnTypes()) === null || _a === void 0 ? void 0 : _a.length) > 0;
148
+ return ((_a = api.columnApi.getColumnTypes()) === null || _a === void 0 ? void 0 : _a.length) > 0;
149
149
  }, []);
150
150
  return (React.createElement(Tabs_1.Tabs, { "data-name": 'scope-component', className: "ab-ScopeComponent", value: scopeChoice, style: Object.assign({ height: '100%' }, props.style), onValueChange: onScopeSelectChanged },
151
151
  props.hideWholeRow ? null : (React.createElement(Tabs_1.Tabs.Tab, { value: "Row" },
@@ -171,7 +171,7 @@ const NewScopeComponent = (props) => {
171
171
  React.createElement(rebass_1.Flex, { flexDirection: "column" }, dataTypeOptions.map((dataTypeOption) => (React.createElement(CheckBox_1.CheckBox, { "data-name": "scope", "data-value": dataTypeOption.value, key: dataTypeOption.value, checked: dataTypesInScope && dataTypesInScope.includes(dataTypeOption.value), onChange: (checked) => onCheckBoxDataTypeChecked(checked, dataTypeOption.value) }, dataTypeOption.label))))))),
172
172
  hasColumnTypes && (React.createElement(Tabs_1.Tabs.Content, { value: "ColumnType", style: { flex: 'none' }, "data-name": "column-type-scope" },
173
173
  React.createElement(rebass_1.Box, null,
174
- React.createElement(rebass_1.Flex, { flexDirection: "column" }, (_b = (_a = api.optionsApi.getColumnTypes()) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.call(_a, (columnType) => {
174
+ React.createElement(rebass_1.Flex, { flexDirection: "column" }, (_b = (_a = api.columnApi.getColumnTypes()) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.call(_a, (columnType) => {
175
175
  var _a;
176
176
  return (React.createElement(CheckBox_1.CheckBox, { "data-name": "scope", "data-value": columnType, key: columnType, checked: 'ColumnTypes' in props.scope && ((_a = props.scope.ColumnTypes) === null || _a === void 0 ? void 0 : _a.includes(columnType)), onChange: (checked) => {
177
177
  let columnTypes = [].concat(props.scope.ColumnTypes);
@@ -24,7 +24,7 @@ const ConnectedNoteEditor = ({ enableEditMode }) => {
24
24
  return cellAddress ? (0, NotesRedux_1.GetNotesSelector)(state.Notes, cellAddress) : [];
25
25
  });
26
26
  const handleNoteChange = React.useCallback((value) => {
27
- api.notesApi.updateNoteText(value, note);
27
+ api.noteApi.updateNoteText(value, note);
28
28
  }, [note]);
29
29
  return (React.createElement(rebass_1.Flex, { onClick: () => enableEditMode(), flexDirection: "column", className: "ab-NotesPopup" },
30
30
  React.createElement(NoteEditor_1.NoteEditor, { isReadonly: isReadonly, editMode: editMode, key: note === null || note === void 0 ? void 0 : note.Uuid, onClose: () => cellPopupService.hidePopup(), note: note === null || note === void 0 ? void 0 : note.Text, onNoteChange: (value) => handleNoteChange(value) })));
@@ -29,8 +29,9 @@ class LayoutViewPanelComponent extends React.Component {
29
29
  return Object.assign(Object.assign({}, layout), { label: layout.Name, value: layout.Name, onClick: () => this.props.onSelectLayout(layout.Name) });
30
30
  });
31
31
  const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
32
+ let layoutSelectStyle = elementType === 'ToolPanel' ? { minWidth: '100%' } : {};
32
33
  return (React.createElement(rebass_1.Flex, { flexDirection: "row", className: `ab-${elementType}__Layout__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap' },
33
- React.createElement(rebass_1.Flex, { flex: 1 },
34
+ React.createElement(rebass_1.Flex, { style: layoutSelectStyle, flex: 1 },
34
35
  React.createElement(Select_1.Select, { style: { width: '100%' }, options: availableLayoutOptions, className: `ab-${elementType}__Layout__select`, value: layoutEntity ? layoutEntity.Name : null, onChange: (layout) => this.props.onSelectLayout(layout) })),
35
36
  React.createElement(rebass_1.Flex, { flexDirection: "row", className: (0, join_1.default)(this.props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__Layout__wrap`) },
36
37
  isManualSaveLayout && (React.createElement(ButtonSave_1.ButtonSave, { className: `ab-${elementType}__Layout__save`, onClick: () => this.onSaveLayout(), tooltip: "Save Changes to Current Layout", disabled: !this.props.CanSave, accessLevel: accessLevel })),
@@ -37,8 +37,9 @@ const LayoutWizard = (props) => {
37
37
  preparedLayout = ObjectFactory_1.default.CreateEmptyLayout({ Name: '' });
38
38
  }
39
39
  if (preparedLayout.SuppressAggFuncInHeader === undefined) {
40
- preparedLayout.SuppressAggFuncInHeader =
41
- !!adaptable.agGridAdapter.initialGridOptions.suppressAggFuncInHeader;
40
+ preparedLayout.SuppressAggFuncInHeader = !!adaptable.agGridAdapter
41
+ .getAgGridApi()
42
+ .getGridOption('suppressAggFuncInHeader');
42
43
  }
43
44
  return preparedLayout;
44
45
  });
@@ -49,8 +49,8 @@ const NotesPopup = (props) => {
49
49
  defaultWidth: 50,
50
50
  render: (params) => {
51
51
  return (React.createElement(AdaptableButton_1.AdaptableButtonComponent, { variant: "text", icon: "delete", onClick: () => {
52
- const note = adaptable.api.notesApi.getNoteByUuid(params.data.Uuid);
53
- adaptable.api.notesApi.deleteNote(note);
52
+ const note = adaptable.api.noteApi.getNoteByUuid(params.data.Uuid);
53
+ adaptable.api.noteApi.deleteNote(note);
54
54
  } }));
55
55
  },
56
56
  },
@@ -66,7 +66,7 @@ const NotesPopup = (props) => {
66
66
  const data = change.data;
67
67
  const prevNote = allNotes.find((x) => x.Uuid === uuid);
68
68
  if (prevNote.Text !== data.Text) {
69
- adaptable.api.notesApi.updateNoteText(data.Text, prevNote);
69
+ adaptable.api.noteApi.updateNoteText(data.Text, prevNote);
70
70
  }
71
71
  }
72
72
  }
@@ -13,7 +13,7 @@ const AdaptableContext_1 = require("./AdaptableContext");
13
13
  const SpecialColumnSettingsWizardStep = (props) => {
14
14
  var _a, _b, _c;
15
15
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
16
- const possibleColumnTypes = (_a = adaptable.api.optionsApi.getColumnTypes()) !== null && _a !== void 0 ? _a : [];
16
+ const possibleColumnTypes = (_a = adaptable.api.columnApi.getColumnTypes()) !== null && _a !== void 0 ? _a : [];
17
17
  const { Filterable, Resizable, Groupable, Sortable, Pivotable, Aggregatable, SuppressMenu, SuppressMovable, } = (_b = props.settings) !== null && _b !== void 0 ? _b : {};
18
18
  const handleColumnTypeChange = (columnType, checked) => {
19
19
  var _a, _b, _c;
@@ -300,6 +300,8 @@ export declare class AdaptableAgGrid implements IAdaptable {
300
300
  canExportToExcel(): boolean;
301
301
  exportToExcel(reportData: ReportData, fileName: string): void;
302
302
  exportVisualDataToExcel(): void;
303
+ private processRowGroupForExcelExport;
304
+ private processCellForExcelExport;
303
305
  isQuickFilterAvailable(): boolean;
304
306
  private hasFloatingFilterOnAtLeastOneColumn;
305
307
  getChartRef(chartId: string): ChartRef;
@@ -364,7 +364,7 @@ class AdaptableAgGrid {
364
364
  this.api.themeApi.applyCurrentTheme();
365
365
  this.validatePrimaryKey();
366
366
  this.embedColumnMenu = this.agGridAdapter.isModulePresent(core_1.ModuleNames.MenuModule);
367
- this.api.internalApi.setTreeMode(this.agGridAdapter.initialGridOptions.treeData);
367
+ this.api.internalApi.setTreeMode(!!this.agGridAdapter.getAgGridApi().getGridOption('treeData'));
368
368
  // TODO AFL MIG: we could just patch the defautl Layout on init? instead
369
369
  this.checkShouldClearExistingFiltersOrSearches();
370
370
  this.applyColumnFiltering();
@@ -890,6 +890,13 @@ class AdaptableAgGrid {
890
890
  }
891
891
  return original_floatingFiltersHeight;
892
892
  });
893
+ /**
894
+ * `excelStyles`
895
+ */
896
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'excelStyles', (original_excelStyles) => {
897
+ // we need this here just to register the original excelStyles in the service
898
+ return original_excelStyles;
899
+ });
893
900
  /**
894
901
  * `columnTypes`
895
902
  */
@@ -1062,7 +1069,7 @@ class AdaptableAgGrid {
1062
1069
  return resultColDefs;
1063
1070
  }
1064
1071
  useRowNodeLookUp() {
1065
- return this.agGridAdapter.initialGridOptions.getRowId != undefined;
1072
+ return this.agGridAdapter.getAgGridApi().getGridOption('getRowId') != undefined;
1066
1073
  }
1067
1074
  getAgGridContainerElement() {
1068
1075
  if (!this.DANGER_USE_GETTER_agGridContainerElement) {
@@ -1109,8 +1116,8 @@ class AdaptableAgGrid {
1109
1116
  return selectedRowInfo;
1110
1117
  }
1111
1118
  isGridSelectable() {
1112
- return (this.agGridAdapter.initialGridOptions.rowSelection === 'single' ||
1113
- this.agGridAdapter.initialGridOptions.rowSelection === 'multiple');
1119
+ const rowSelection = this.agGridAdapter.getAgGridApi().getGridOption('rowSelection');
1120
+ return rowSelection === 'single' || rowSelection === 'multiple';
1114
1121
  }
1115
1122
  initAdaptableStore() {
1116
1123
  const perfNewAdaptableStore = this.logger.beginPerf(`initAdaptableStore()`);
@@ -1618,7 +1625,9 @@ class AdaptableAgGrid {
1618
1625
  this.api.eventApi.on('AdaptableReady', () => {
1619
1626
  var _a, _b;
1620
1627
  // update status bar state
1621
- const adaptableStatusPanels = (_b = (_a = this.agGridAdapter.initialGridOptions.statusBar) === null || _a === void 0 ? void 0 : _a.statusPanels) === null || _b === void 0 ? void 0 : _b.filter((statusPanel) => this.adaptableStatusPanelKeys.includes(statusPanel.key));
1628
+ const adaptableStatusPanels = (_b = (_a = this.agGridAdapter
1629
+ .getAgGridApi()
1630
+ .getGridOption('statusBar')) === null || _a === void 0 ? void 0 : _a.statusPanels) === null || _b === void 0 ? void 0 : _b.filter((statusPanel) => this.adaptableStatusPanelKeys.includes(statusPanel.key));
1622
1631
  const statusBarModule = this.ModuleService.getModuleById(ModuleConstants.StatusBarModuleId);
1623
1632
  // need to add only the adaptable panels
1624
1633
  statusBarModule.syncStateWithOptions(adaptableStatusPanels);
@@ -2411,10 +2420,10 @@ class AdaptableAgGrid {
2411
2420
  });
2412
2421
  }
2413
2422
  getAgGridRowModelType() {
2414
- var _a, _b;
2423
+ var _a;
2415
2424
  // it seems that this can be null so we need explicitly to return "clientSide" in this case
2416
2425
  // need to check that for ServerSideRowModel it is ALWAYS returned...
2417
- return (_b = (_a = this.agGridAdapter.initialGridOptions) === null || _a === void 0 ? void 0 : _a.rowModelType) !== null && _b !== void 0 ? _b : 'clientSide';
2426
+ return (_a = this.agGridAdapter.getAgGridApi().getGridOption('rowModelType')) !== null && _a !== void 0 ? _a : 'clientSide';
2418
2427
  }
2419
2428
  getAllRowNodes(config) {
2420
2429
  let rowNodes = [];
@@ -2537,7 +2546,7 @@ class AdaptableAgGrid {
2537
2546
  }
2538
2547
  canGenerateCharts() {
2539
2548
  return (this.agGridAdapter.isModulePresent(core_1.ModuleNames.GridChartsModule) &&
2540
- this.agGridAdapter.initialGridOptions.enableCharts);
2549
+ this.agGridAdapter.getAgGridApi().getGridOption('enableCharts'));
2541
2550
  }
2542
2551
  canDisplaySparklines() {
2543
2552
  return this.agGridAdapter.isModulePresent(core_1.ModuleNames.SparklinesModule);
@@ -3052,52 +3061,82 @@ class AdaptableAgGrid {
3052
3061
  ephemeralGridApi.destroy();
3053
3062
  }
3054
3063
  exportVisualDataToExcel() {
3055
- // // add adaptable style props to user defined props
3056
- // this.setExcelStylesForExport();
3057
- //
3058
- // this.gridOptions.api.exportDataAsExcel({
3059
- // sheetName: 'Sheet 1',
3060
- // fileName: this.ReportService.getReportFileName(this.adaptableOptions.adaptableId, 'Excel'),
3061
- // // delegate the cell value processing to Adaptable
3062
- // processCellCallback: ({ node, column, value }: ProcessCellForExportParams): string => {
3063
- // const columnId = column.getColId();
3064
- // if (
3065
- // node?.group &&
3066
- // (this.api.columnApi.isAutoRowGroupColumn(columnId) ||
3067
- // // we would still need to process the cell if this is a group row with an aggregated value
3068
- // node?.aggData?.[columnId] == undefined)
3069
- // ) {
3070
- // // skip processing of row groups, this was already handled in processRowGroupCallback()
3071
- // return value;
3072
- // }
3073
- // return this.processCellForExcelExport(node, columnId);
3074
- // },
3075
- // processRowGroupCallback: (params: ProcessRowGroupForExportParams): string => {
3076
- // // recreating the standard AG Grid styling for row groups: 'Parent -> Child'
3077
- // // additionally the values are formatted
3078
- // let rowGroupNode = params.node;
3079
- // const isFooterRow = rowGroupNode.footer;
3080
- // const rowGroupSummary = [this.processRowGroupForExcelExport(rowGroupNode) ?? ''];
3081
- // while (rowGroupNode.parent) {
3082
- // rowGroupNode = rowGroupNode.parent;
3083
- // const formattedParentNode = this.processRowGroupForExcelExport(rowGroupNode);
3084
- // if (formattedParentNode) {
3085
- // rowGroupSummary.push(formattedParentNode);
3086
- // }
3087
- // }
3088
- //
3089
- // let summary = rowGroupSummary.reverse().join(' -> ');
3090
- // if (isFooterRow) {
3091
- // summary = `Total: ${summary}`;
3092
- // }
3093
- // return summary;
3094
- // },
3095
- // });
3096
- //
3097
- // // keep only the user defined props
3098
- // this.setGridOptionsProperty('excelStyles', (userExcelStyles) => {
3099
- // return userExcelStyles;
3100
- // });
3064
+ try {
3065
+ const exportExcelStyles = this.ReportService.buildExcelStylesForVisualReports();
3066
+ this.agGridOptionsService.CAREFUL_patchGridOptionsProperty('excelStyles', exportExcelStyles);
3067
+ this.agGridAdapter.getAgGridApi().exportDataAsExcel({
3068
+ sheetName: 'Sheet 1',
3069
+ fileName: this.ReportService.getReportFileName(this.adaptableOptions.adaptableId, 'Excel'),
3070
+ // delegate the cell value processing to Adaptable
3071
+ processCellCallback: ({ node, column, value }) => {
3072
+ var _a;
3073
+ const columnId = column.getColId();
3074
+ if ((node === null || node === void 0 ? void 0 : node.group) &&
3075
+ (this.api.columnApi.isAutoRowGroupColumn(columnId) ||
3076
+ // we would still need to process the cell if this is a group row with an aggregated value
3077
+ ((_a = node === null || node === void 0 ? void 0 : node.aggData) === null || _a === void 0 ? void 0 : _a[columnId]) == undefined)) {
3078
+ // skip processing of row groups, this was already handled in processRowGroupCallback()
3079
+ return value;
3080
+ }
3081
+ return this.processCellForExcelExport(node, columnId);
3082
+ },
3083
+ processRowGroupCallback: (params) => {
3084
+ var _a;
3085
+ // recreating the standard AG Grid styling for row groups: 'Parent -> Child'
3086
+ // additionally the values are formatted
3087
+ let rowGroupNode = params.node;
3088
+ const isFooterRow = rowGroupNode.footer;
3089
+ const rowGroupSummary = [(_a = this.processRowGroupForExcelExport(rowGroupNode)) !== null && _a !== void 0 ? _a : ''];
3090
+ while (rowGroupNode.parent) {
3091
+ rowGroupNode = rowGroupNode.parent;
3092
+ const formattedParentNode = this.processRowGroupForExcelExport(rowGroupNode);
3093
+ if (formattedParentNode) {
3094
+ rowGroupSummary.push(formattedParentNode);
3095
+ }
3096
+ }
3097
+ let summary = rowGroupSummary.reverse().join(' -> ');
3098
+ if (isFooterRow) {
3099
+ summary = `Total: ${summary}`;
3100
+ }
3101
+ return summary;
3102
+ },
3103
+ });
3104
+ this.agGridOptionsService.revertGridOptionsPropertyToUserValue('excelStyles');
3105
+ }
3106
+ catch (error) {
3107
+ this.logger.consoleError('Error exporting visual data to Excel', error);
3108
+ }
3109
+ }
3110
+ processRowGroupForExcelExport(rowNode) {
3111
+ var _a, _b, _c, _d, _e;
3112
+ const columnId = (_c = (_a = rowNode.field) !== null && _a !== void 0 ? _a : (_b = rowNode.rowGroupColumn) === null || _b === void 0 ? void 0 : _b.getColId()) !== null && _c !== void 0 ? _c : (_e = (_d = rowNode.rowGroupColumn) === null || _d === void 0 ? void 0 : _d.getColDef()) === null || _e === void 0 ? void 0 : _e.field;
3113
+ if (!columnId || !rowNode.key) {
3114
+ return;
3115
+ }
3116
+ let rawValue = rowNode.key;
3117
+ if (this.api.columnApi.getColumnDataTypeForColumnId(columnId) === 'Date' &&
3118
+ typeof rawValue === 'string' &&
3119
+ // rawValue is composed only of digits
3120
+ /^\d+$/.test(rawValue)) {
3121
+ // AG-Grid converts the value to string, we have to reconvert it back
3122
+ const dateRawValue = parseInt(rawValue);
3123
+ if (dateRawValue != undefined) {
3124
+ // @ts-ignore
3125
+ rawValue = dateRawValue;
3126
+ }
3127
+ }
3128
+ return this.ReportService.getCellExportValueFromRawValue(rowNode, rawValue, columnId);
3129
+ }
3130
+ processCellForExcelExport(rowNode, columnId) {
3131
+ if (this.api.exportApi.internalApi.isVisualDataExportInProgress()) {
3132
+ const cellKey = this.agGridColumnAdapter.getExcelClassNameForCell(columnId, this.getPrimaryKeyValueFromRowNode(rowNode));
3133
+ const isoFormattedDate = this.ReportService.getExcelStyleWithFormattedDate(cellKey);
3134
+ if (isoFormattedDate) {
3135
+ // this is a Date cell which will be formatted by Excel
3136
+ return isoFormattedDate;
3137
+ }
3138
+ }
3139
+ return this.ReportService.getCellExportValueFromRowNode(rowNode, columnId);
3101
3140
  }
3102
3141
  isQuickFilterAvailable() {
3103
3142
  if (this.api.layoutApi.getCurrentLayout().EnablePivot) {
@@ -25,6 +25,7 @@ export declare class AgGridAdapter {
25
25
  getLiveGridOptions(): GridOptions | undefined;
26
26
  updateGridOptions(options: ManagedGridOptions): void;
27
27
  setGridOption<Key extends ManagedGridOptionKey>(key: Key, value: GridOptions[Key]): void;
28
+ getUserGridOptionsProperty<T extends keyof GridOptions>(propertyName: T): GridOptions[T];
28
29
  updateColumnFilterActiveState(): void;
29
30
  deriveSelectedCellInfoFromAgGrid(): SelectedCellInfo;
30
31
  deriveSelectedRowInfoFromAgGrid(): SelectedRowInfo;
@@ -68,6 +68,9 @@ class AgGridAdapter {
68
68
  var _a;
69
69
  (_a = this.getAgGridApi()) === null || _a === void 0 ? void 0 : _a.setGridOption(key, value);
70
70
  }
71
+ getUserGridOptionsProperty(propertyName) {
72
+ return this.adaptableInstance.agGridOptionsService.getUserGridOptionsProperty(propertyName);
73
+ }
71
74
  updateColumnFilterActiveState() {
72
75
  var _a;
73
76
  const columnFilters = this.adaptableApi.columnFilterApi.getActiveColumnFilters();
@@ -30,7 +30,7 @@ export declare class AgGridColumnAdapter {
30
30
  private setupColumnEditable;
31
31
  private setupColumnValueSetter;
32
32
  private setupColumnComparator;
33
- private getExcelClassNameForCell;
33
+ getExcelClassNameForCell(colId: string, primaryKeyValue: any, userDefinedCellClass?: string | string[]): string;
34
34
  private isQuickSearchActive;
35
35
  private getEditableCellClass;
36
36
  private getReadonlyCellClass;
@@ -610,14 +610,14 @@ class AgGridColumnAdapter {
610
610
  if (!this.adaptableApi.internalApi.getModuleService().isModuleAvailable('Notes')) {
611
611
  return;
612
612
  }
613
- if (!this.adaptableApi.notesApi.internalApi.areNotesAvailable()) {
613
+ if (!this.adaptableApi.noteApi.internalApi.areNotesAvailable()) {
614
614
  return;
615
615
  }
616
616
  const cellPosition = {
617
617
  PrimaryKeyValue: gridCell.primaryKeyValue,
618
618
  ColumnId: gridCell.column.columnId,
619
619
  };
620
- const cellNotes = this.adaptableApi.notesApi.getCellNotes(cellPosition);
620
+ const cellNotes = this.adaptableApi.noteApi.getCellNotes(cellPosition);
621
621
  if (!(cellNotes === null || cellNotes === void 0 ? void 0 : cellNotes.length)) {
622
622
  return undefined;
623
623
  }