@adaptabletools/adaptable 15.4.0 → 15.4.2

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 (47) hide show
  1. package/bundle.cjs.js +120 -120
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +0 -2
  6. package/src/Api/BulkUpdateApi.d.ts +3 -3
  7. package/src/Api/GridApi.d.ts +10 -19
  8. package/src/Api/Implementation/BulkUpdateApiImpl.d.ts +2 -2
  9. package/src/Api/Implementation/BulkUpdateApiImpl.js +2 -2
  10. package/src/Api/Implementation/GridApiImpl.d.ts +5 -13
  11. package/src/Api/Implementation/GridApiImpl.js +43 -13
  12. package/src/Api/Implementation/PlusMinusApiImpl.d.ts +2 -2
  13. package/src/Api/Implementation/PlusMinusApiImpl.js +2 -2
  14. package/src/Api/Implementation/SmartEditApiImpl.d.ts +2 -2
  15. package/src/Api/Implementation/SmartEditApiImpl.js +2 -2
  16. package/src/Api/Internal/ActionInternalApi.d.ts +0 -1
  17. package/src/Api/Internal/ActionInternalApi.js +0 -28
  18. package/src/Api/Internal/GridInternalApi.d.ts +0 -3
  19. package/src/Api/Internal/GridInternalApi.js +0 -23
  20. package/src/Api/PlusMinusApi.d.ts +3 -3
  21. package/src/Api/SmartEditApi.d.ts +3 -3
  22. package/src/PredefinedConfig/Selection/GridCell.d.ts +21 -0
  23. package/src/Redux/ActionsReducers/BulkUpdateRedux.d.ts +3 -3
  24. package/src/Redux/ActionsReducers/BulkUpdateRedux.js +2 -2
  25. package/src/Redux/ActionsReducers/PlusMinusRedux.d.ts +3 -3
  26. package/src/Redux/ActionsReducers/PlusMinusRedux.js +2 -2
  27. package/src/Redux/ActionsReducers/SmartEditRedux.d.ts +3 -3
  28. package/src/Redux/ActionsReducers/SmartEditRedux.js +2 -2
  29. package/src/Redux/Store/AdaptableStore.js +5 -5
  30. package/src/Strategy/CalculatedColumnModule.d.ts +4 -1
  31. package/src/Strategy/CalculatedColumnModule.js +30 -13
  32. package/src/Strategy/Interface/ISmartEditModule.d.ts +2 -2
  33. package/src/Strategy/PlusMinusModule.js +10 -1
  34. package/src/Strategy/SmartEditModule.d.ts +2 -2
  35. package/src/Strategy/SmartEditModule.js +2 -2
  36. package/src/Utilities/Helpers/FormatHelper.js +1 -1
  37. package/src/Utilities/Helpers/PreviewHelper.d.ts +3 -1
  38. package/src/Utilities/Helpers/PreviewHelper.js +31 -1
  39. package/src/Utilities/Helpers/StyleHelper.d.ts +4 -0
  40. package/src/Utilities/Helpers/StyleHelper.js +25 -1
  41. package/src/agGrid/Adaptable.d.ts +0 -1
  42. package/src/agGrid/Adaptable.js +5 -13
  43. package/src/metamodel/adaptable.metamodel.d.ts +16 -0
  44. package/src/metamodel/adaptable.metamodel.js +1 -1
  45. package/src/types.d.ts +1 -1
  46. package/version.d.ts +1 -1
  47. package/version.js +1 -1
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { AdaptableModuleBase } from './AdaptableModuleBase';
3
3
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
4
- import { AdaptableMenuItem } from '../PredefinedConfig/Common/Menu';
4
+ import { AdaptableMenuItem, ContextMenuContext } from '../PredefinedConfig/Common/Menu';
5
5
  import * as CalculatedColumnRedux from '../Redux/ActionsReducers/CalculatedColumnRedux';
6
6
  import { TeamSharingImportInfo } from '../PredefinedConfig/TeamSharingState';
7
7
  import { CalculatedColumn } from '../PredefinedConfig/CalculatedColumnState';
@@ -16,7 +16,10 @@ export declare class CalculatedColumnModule extends AdaptableModuleBase implemen
16
16
  updateOldConfig(): void;
17
17
  getExplicitlyReferencedColumnIds(calculatedColumn: CalculatedColumn): string[];
18
18
  getReferencedNamedQueryNames(calculatedColumn: CalculatedColumn): string[];
19
+ private isCalculatedColumn;
19
20
  addColumnMenuItems(column: AdaptableColumn): AdaptableMenuItem[] | undefined;
21
+ addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
22
+ createEditCalculatedColumnMenuItem(column: AdaptableColumn): AdaptableMenuItem[];
20
23
  getTeamSharingAction(): TeamSharingImportInfo<CalculatedColumn>;
21
24
  toView(calculateColumn: CalculatedColumn): {
22
25
  items: AdaptableObjectItemView[];
@@ -10,6 +10,7 @@ const CalculatedColumnWizard_1 = require("../View/CalculatedColumn/Wizard/Calcul
10
10
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensions/ArrayExtensions"));
11
11
  const getObjectTagsViewItems_1 = require("./Utilities/getObjectTagsViewItems");
12
12
  const getCalculatedColumnSettingsTags_1 = require("../View/CalculatedColumn/Utilities/getCalculatedColumnSettingsTags");
13
+ const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"));
13
14
  class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
14
15
  constructor(api) {
15
16
  super(ModuleConstants.CalculatedColumnModuleId, ModuleConstants.CalculatedColumnFriendlyName, 'chart-and-grid', 'CalculatedColumnPopup', 'Create bespoke columns whose cell value is derived dynamically from an Expression', api);
@@ -51,22 +52,38 @@ class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
51
52
  var _a;
52
53
  return ((_a = this.api.queryApi.internalApi.getReferencedNamedQueryNames(this.api.queryLanguageApi.getAdaptableQueryExpression(calculatedColumn.Query))) !== null && _a !== void 0 ? _a : []);
53
54
  }
54
- addColumnMenuItems(column) {
55
- if (column && this.isModuleEditable()) {
56
- if (this.api.calculatedColumnApi
55
+ isCalculatedColumn(column) {
56
+ return (column &&
57
+ Helper_1.default.objectExists(this.api.calculatedColumnApi
57
58
  .getCalculatedColumns()
58
- .find((cc) => cc.ColumnId == column.columnId)) {
59
- let popupParam = {
60
- column: column,
61
- action: 'Edit',
62
- source: 'ColumnMenu',
63
- };
64
- return [
65
- this.createColumnMenuItemShowPopup('Edit Calculated Column', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
66
- ];
67
- }
59
+ .find((cc) => cc.ColumnId == column.columnId)));
60
+ }
61
+ addColumnMenuItems(column) {
62
+ if (this.isModuleEditable() && this.isCalculatedColumn(column)) {
63
+ return this.createEditCalculatedColumnMenuItem(column);
68
64
  }
69
65
  }
66
+ addContextMenuItems(menuContext) {
67
+ if (!this.isModuleAvailable()) {
68
+ return;
69
+ }
70
+ if (this.isModuleEditable() &&
71
+ this.isCalculatedColumn(menuContext.adaptableColumn) &&
72
+ !menuContext.isRowGroupColumn &&
73
+ menuContext.isSingleSelectedCell) {
74
+ return this.createEditCalculatedColumnMenuItem(menuContext.adaptableColumn);
75
+ }
76
+ }
77
+ createEditCalculatedColumnMenuItem(column) {
78
+ let popupParam = {
79
+ column: column,
80
+ action: 'Edit',
81
+ source: 'ColumnMenu',
82
+ };
83
+ return [
84
+ this.createColumnMenuItemShowPopup('Edit Calculated Column', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
85
+ ];
86
+ }
70
87
  getTeamSharingAction() {
71
88
  return {
72
89
  ModuleEntities: this.api.calculatedColumnApi.getCalculatedColumns(),
@@ -2,9 +2,9 @@ import { IModule } from './IModule';
2
2
  import { IModuleActionReturn } from './IModuleActionReturn';
3
3
  import { MathOperation } from '../../PredefinedConfig/Common/Enums';
4
4
  import { PreviewInfo } from '../../Utilities/Interface/Preview';
5
- import { GridCell } from '../../PredefinedConfig/Selection/GridCell';
5
+ import { CellUpdateRequest } from '../../PredefinedConfig/Selection/GridCell';
6
6
  export interface ISmartEditModule extends IModule {
7
7
  CheckCorrectCellSelection(): IModuleActionReturn<boolean>;
8
8
  BuildPreviewValues(smartEditValue: number, smartEditOperation: MathOperation): PreviewInfo;
9
- ApplySmartEdit(newValues: GridCell[]): void;
9
+ ApplySmartEdit(cellUpdateRequests: CellUpdateRequest[]): void;
10
10
  }
@@ -144,7 +144,16 @@ class PlusMinusModule extends AdaptableModuleBase_1.AdaptableModuleBase {
144
144
  });
145
145
  this.ShowErrorPreventMessage(failedPreventEdits);
146
146
  if (ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(successfulValues)) {
147
- this.api.plusMinusApi.applyPlusMinus(successfulValues);
147
+ const cellUpdateRequests = [];
148
+ successfulValues.forEach((gridCell) => {
149
+ cellUpdateRequests.push({
150
+ columnId: gridCell.column.columnId,
151
+ newValue: gridCell.normalisedValue,
152
+ primaryKeyValue: gridCell.primaryKeyValue,
153
+ rowNode: gridCell.rowNode,
154
+ });
155
+ });
156
+ this.api.plusMinusApi.applyPlusMinus(cellUpdateRequests);
148
157
  }
149
158
  return shouldApplyPlusMinus;
150
159
  }
@@ -2,7 +2,7 @@ import { AdaptableModuleBase } from './AdaptableModuleBase';
2
2
  import { IModuleActionReturn } from './Interface/IModuleActionReturn';
3
3
  import { ISmartEditModule } from './Interface/ISmartEditModule';
4
4
  import { PreviewInfo } from '../Utilities/Interface/Preview';
5
- import { GridCell } from '../PredefinedConfig/Selection/GridCell';
5
+ import { CellUpdateRequest } from '../PredefinedConfig/Selection/GridCell';
6
6
  import { AdaptableMenuItem, ContextMenuContext } from '../PredefinedConfig/Common/Menu';
7
7
  import { AdaptableApi } from '../Api/AdaptableApi';
8
8
  import { AccessLevel } from '../PredefinedConfig/Common/Entitlement';
@@ -11,7 +11,7 @@ export declare class SmartEditModule extends AdaptableModuleBase implements ISma
11
11
  constructor(api: AdaptableApi);
12
12
  getViewAccessLevel(): AccessLevel;
13
13
  addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
14
- ApplySmartEdit(newValues: GridCell[]): void;
14
+ ApplySmartEdit(cellUpdateRequests: CellUpdateRequest[]): void;
15
15
  CheckCorrectCellSelection(): IModuleActionReturn<boolean>;
16
16
  BuildPreviewValues(smartEditValue: number, smartEditOperation: SmartEditOperation): PreviewInfo;
17
17
  }
@@ -41,8 +41,8 @@ class SmartEditModule extends AdaptableModuleBase_1.AdaptableModuleBase {
41
41
  }
42
42
  return [menuItemShowPopup];
43
43
  }
44
- ApplySmartEdit(newValues) {
45
- this.api.smartEditApi.applySmartEdit(newValues);
44
+ ApplySmartEdit(cellUpdateRequests) {
45
+ this.api.smartEditApi.applySmartEdit(cellUpdateRequests);
46
46
  }
47
47
  CheckCorrectCellSelection() {
48
48
  let selectedCellInfo = this.api.gridApi.getSelectedCellInfo();
@@ -113,7 +113,7 @@ function StringFormatter(input, options = {}) {
113
113
  return undefined;
114
114
  }
115
115
  if (options.Empty) {
116
- return '';
116
+ return ' ';
117
117
  }
118
118
  let s = preparedInput;
119
119
  if (options.Prefix !== undefined) {
@@ -1,11 +1,13 @@
1
1
  import { PreviewResult, PreviewValidationSummary, PreviewInfo } from '../Interface/Preview';
2
- import { GridCell } from '../../PredefinedConfig/Selection/GridCell';
2
+ import { CellUpdateRequest, GridCell } from '../../PredefinedConfig/Selection/GridCell';
3
3
  export declare function GetPreviewValidationSummary(previewResults: PreviewResult[]): PreviewValidationSummary;
4
4
  export declare function GetValidationMessage(previewInfo: PreviewInfo, newValue: string): string;
5
5
  export declare function GetCellInfosFromPreview(previewInfo: PreviewInfo, bypassValidationWarnings: boolean): GridCell[];
6
+ export declare function GetCellUpdateRequestsFromPreview(previewInfo: PreviewInfo, bypassValidationWarnings: boolean): CellUpdateRequest[];
6
7
  export declare const PreviewHelper: {
7
8
  GetPreviewValidationSummary: typeof GetPreviewValidationSummary;
8
9
  GetValidationMessage: typeof GetValidationMessage;
9
10
  GetCellInfosFromPreview: typeof GetCellInfosFromPreview;
11
+ GetCellUpdateRequestsFromPreview: typeof GetCellUpdateRequestsFromPreview;
10
12
  };
11
13
  export default PreviewHelper;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PreviewHelper = exports.GetCellInfosFromPreview = exports.GetValidationMessage = exports.GetPreviewValidationSummary = void 0;
3
+ exports.PreviewHelper = exports.GetCellUpdateRequestsFromPreview = exports.GetCellInfosFromPreview = exports.GetValidationMessage = exports.GetPreviewValidationSummary = void 0;
4
4
  const StringExtensions_1 = require("../Extensions/StringExtensions");
5
5
  function GetPreviewValidationSummary(previewResults) {
6
6
  let hasAnyValidation = false;
@@ -65,9 +65,39 @@ function GetCellInfosFromPreview(previewInfo, bypassValidationWarnings) {
65
65
  return newValues;
66
66
  }
67
67
  exports.GetCellInfosFromPreview = GetCellInfosFromPreview;
68
+ function GetCellUpdateRequestsFromPreview(previewInfo, bypassValidationWarnings) {
69
+ let newValues = [];
70
+ if (bypassValidationWarnings) {
71
+ for (let previewResult of previewInfo.previewResults) {
72
+ if (previewResult.validationRules.length == 0) {
73
+ newValues.push({
74
+ primaryKeyValue: previewResult.id,
75
+ newValue: previewResult.computedValue,
76
+ rowNode: previewResult.rowNode,
77
+ columnId: previewInfo.column.columnId,
78
+ });
79
+ }
80
+ }
81
+ }
82
+ else {
83
+ previewInfo.previewResults
84
+ .filter((p) => p.validationRules.length == 0)
85
+ .forEach((pr) => {
86
+ newValues.push({
87
+ primaryKeyValue: pr.id,
88
+ columnId: previewInfo.column.columnId,
89
+ newValue: pr.computedValue,
90
+ rowNode: pr.rowNode,
91
+ });
92
+ });
93
+ }
94
+ return newValues;
95
+ }
96
+ exports.GetCellUpdateRequestsFromPreview = GetCellUpdateRequestsFromPreview;
68
97
  exports.PreviewHelper = {
69
98
  GetPreviewValidationSummary,
70
99
  GetValidationMessage,
71
100
  GetCellInfosFromPreview,
101
+ GetCellUpdateRequestsFromPreview,
72
102
  };
73
103
  exports.default = exports.PreviewHelper;
@@ -1,5 +1,9 @@
1
1
  import { AdaptableStyle } from '../../types';
2
2
  export declare const AgGridCellStyleProperties: readonly ["backgroundColor", "color", "fontWeight", "fontStyle", "fontSize", "borderColor"];
3
+ export declare const normalizeStyleForAgGrid: (style: Record<string, any>) => {
4
+ [x: string]: any;
5
+ };
6
+ export declare const sanitizeStyle: (style: Record<string, any>) => Record<string, any>;
3
7
  export declare const convertAdaptableStyleToCSS: (style: AdaptableStyle) => {
4
8
  [cssProperty: string]: string;
5
9
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVariableColor = exports.toStyle = exports.convertCSSAbsoluteFontSizeToPt = exports.convertAdaptableStyleToCSS = exports.AgGridCellStyleProperties = void 0;
3
+ exports.getVariableColor = exports.toStyle = exports.convertCSSAbsoluteFontSizeToPt = exports.convertAdaptableStyleToCSS = exports.sanitizeStyle = exports.normalizeStyleForAgGrid = exports.AgGridCellStyleProperties = void 0;
4
4
  const EnumExtensions_1 = require("../Extensions/EnumExtensions");
5
5
  // required for hacky fix for https://github.com/AdaptableTools/adaptable/issues/2119
6
6
  exports.AgGridCellStyleProperties = [
@@ -11,6 +11,30 @@ exports.AgGridCellStyleProperties = [
11
11
  'fontSize',
12
12
  'borderColor',
13
13
  ];
14
+ // see https://github.com/AdaptableTools/adaptable/issues/2119
15
+ // since v29 AG Grid ignores style properties with null or undefined values
16
+ // Fix: pass empty string instead of null/undefined
17
+ const normalizeStyleForAgGrid = (style) => {
18
+ const normalizedStyle = Object.assign({}, style);
19
+ exports.AgGridCellStyleProperties.forEach((cellStylePropKey) => {
20
+ if (normalizedStyle[cellStylePropKey] == null) {
21
+ normalizedStyle[cellStylePropKey] = '';
22
+ }
23
+ });
24
+ return normalizedStyle;
25
+ };
26
+ exports.normalizeStyleForAgGrid = normalizeStyleForAgGrid;
27
+ // the inverse of normalizeStyleForAgGrid, see comments above
28
+ const sanitizeStyle = (style) => {
29
+ const sanitizedStyle = {};
30
+ Object.keys(style).forEach((key) => {
31
+ if (style[key] != null && style[key] !== '') {
32
+ sanitizedStyle[key] = style[key];
33
+ }
34
+ });
35
+ return sanitizedStyle;
36
+ };
37
+ exports.sanitizeStyle = sanitizeStyle;
14
38
  const convertAdaptableStyleToCSS = (style) => {
15
39
  let result = {};
16
40
  if (style.BackColor !== undefined && style.BackColor !== null) {
@@ -199,7 +199,6 @@ export declare class Adaptable implements IAdaptable {
199
199
  setSelectedCells(): SelectedCellInfo | undefined;
200
200
  setSelectedRows(): SelectedRowInfo | undefined;
201
201
  setDataValue(value: any, column: AdaptableColumn, primaryKeyValue: any, rowNode?: IRowNode): void;
202
- setCellValue(cellDataChangedInfo: CellDataChangedInfo): void;
203
202
  cancelEdit(): void;
204
203
  isCellEditable(rowNode: IRowNode, column: Column): boolean;
205
204
  getGridCellsForColumn(columnId: string): GridCell[] | undefined;
@@ -1779,9 +1779,6 @@ class Adaptable {
1779
1779
  }
1780
1780
  }
1781
1781
  }
1782
- setCellValue(cellDataChangedInfo) {
1783
- this.setDataValue(cellDataChangedInfo.newValue, cellDataChangedInfo.column, cellDataChangedInfo.primaryKeyValue, cellDataChangedInfo.rowNode);
1784
- }
1785
1782
  cancelEdit() {
1786
1783
  this.gridOptions.api.stopEditing(true);
1787
1784
  }
@@ -3277,13 +3274,7 @@ class Adaptable {
3277
3274
  const cellStyle = (params) => {
3278
3275
  const isQuickSearchActive = hasQuickSearchStyle && this.isQuickSearchActive(abColumn, params);
3279
3276
  const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.getReadOnlyCellStyle(abColumn, params)), this.getEditableCellStyle(abColumn, params)), (typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle)), this.getFormatColumnAndStyledColumnCellStyle(abColumn, colId, params)), (isQuickSearchActive ? quickSearchStyle : {})), this.getAlertCellStyle(abColumn, params)), this.getFlashingCellStyle(abColumn, params)), this.getCellHighlightStyle(abColumn, params));
3280
- // see https://github.com/AdaptableTools/adaptable/issues/2119
3281
- StyleHelper_1.AgGridCellStyleProperties.forEach((cellStylePropKey) => {
3282
- if (result[cellStylePropKey] == null) {
3283
- result[cellStylePropKey] = '';
3284
- }
3285
- });
3286
- return result;
3277
+ return (0, StyleHelper_1.normalizeStyleForAgGrid)(result);
3287
3278
  };
3288
3279
  return cellStyle;
3289
3280
  });
@@ -3614,7 +3605,7 @@ class Adaptable {
3614
3605
  }
3615
3606
  // we allowed it go reach this point
3616
3607
  // just to run isCellEditable
3617
- // and since this has already run and we have no other valitaions
3608
+ // and since this has already run and we have no other validations
3618
3609
  // just assign the new value and exit
3619
3610
  if (field) {
3620
3611
  params.data[field] = params.newValue;
@@ -4654,8 +4645,9 @@ class Adaptable {
4654
4645
  }
4655
4646
  return result;
4656
4647
  }, {}));
4657
- if (Object.values(adaptableStyle).some((style) => style != null)) {
4658
- excelStyles.push(this.convertCSSToExcelStyle(adaptableStyle));
4648
+ const sanitizedAdaptableStyle = (0, StyleHelper_1.sanitizeStyle)(adaptableStyle);
4649
+ if (Object.values(sanitizedAdaptableStyle).some((style) => style != null)) {
4650
+ excelStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableStyle));
4659
4651
  }
4660
4652
  const excelDataType = this.api.exportApi.internalApi.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
4661
4653
  const rawValue = this.getRawValueFromRowNode(node, column.getId());
@@ -1387,6 +1387,22 @@ export declare const ADAPTABLE_METAMODEL: {
1387
1387
  kind: string;
1388
1388
  desc: string;
1389
1389
  };
1390
+ CellUpdateRequest: {
1391
+ name: string;
1392
+ kind: string;
1393
+ desc: string;
1394
+ props: ({
1395
+ name: string;
1396
+ kind: string;
1397
+ desc: string;
1398
+ isOpt?: undefined;
1399
+ } | {
1400
+ name: string;
1401
+ kind: string;
1402
+ desc: string;
1403
+ isOpt: boolean;
1404
+ })[];
1405
+ };
1390
1406
  ChartContainer: {
1391
1407
  name: string;
1392
1408
  kind: string;