@adaptabletools/adaptable-cjs 18.1.7 → 18.1.9

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 (33) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
  3. package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +4 -0
  4. package/src/Api/DataChangeHistoryApi.d.ts +6 -0
  5. package/src/Api/Implementation/DataChangeHistoryApiImpl.d.ts +2 -0
  6. package/src/Api/Implementation/DataChangeHistoryApiImpl.js +23 -2
  7. package/src/Api/Internal/AlertInternalApi.d.ts +0 -3
  8. package/src/Api/Internal/AlertInternalApi.js +12 -39
  9. package/src/Api/Internal/FormatColumnInternalApi.d.ts +2 -2
  10. package/src/Api/Internal/FormatColumnInternalApi.js +6 -6
  11. package/src/Api/Internal/GridInternalApi.js +13 -7
  12. package/src/PredefinedConfig/Common/AdaptableFormat.d.ts +9 -9
  13. package/src/Redux/ActionsReducers/SystemRedux.d.ts +9 -8
  14. package/src/Redux/ActionsReducers/SystemRedux.js +11 -11
  15. package/src/Strategy/DataChangeHistoryModule.js +1 -2
  16. package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
  17. package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
  18. package/src/Utilities/Helpers/FormatContentHelper.d.ts +22 -0
  19. package/src/Utilities/Helpers/FormatContentHelper.js +39 -0
  20. package/src/Utilities/Helpers/FormatHelper.d.ts +5 -4
  21. package/src/Utilities/Helpers/FormatHelper.js +41 -15
  22. package/src/Utilities/Helpers/Helper.d.ts +6 -0
  23. package/src/Utilities/Helpers/Helper.js +35 -1
  24. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +4 -3
  25. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +33 -10
  26. package/src/agGrid/AdaptableAgGrid.d.ts +2 -1
  27. package/src/agGrid/AdaptableAgGrid.js +29 -8
  28. package/src/agGrid/AgGridMenuAdapter.js +15 -1
  29. package/src/agGrid/defaultAdaptableOptions.js +1 -0
  30. package/src/env.js +2 -2
  31. package/src/metamodel/adaptable.metamodel.d.ts +8 -0
  32. package/src/metamodel/adaptable.metamodel.js +1 -1
  33. package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
3
- "version": "18.1.7",
3
+ "version": "18.1.9",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -177,7 +177,8 @@ export interface IAdaptable {
177
177
  getDisplayValueFromRowNode(rowNode: IRowNode, columnId: string): string | undefined;
178
178
  getDisplayValueFromRawValue(rowNode: IRowNode, columnId: string, rawValue: any): string | undefined;
179
179
  getNormalisedValueFromRawValue(rawValue: any, column: AdaptableColumn): string | number | boolean | Date | unknown;
180
- getGridCellsForColumn(columnId: string, includeBlanks?: boolean, onlyVisibleRows?: boolean): GridCell[] | undefined;
180
+ getGridCellsForColumn(columnId: string, onlyVisibleRows?: boolean): GridCell[] | undefined;
181
+ getGridCellsForColumnTemp(columnId: string, onlyVisibleRows?: boolean): GridCell[] | undefined;
181
182
  getRowNodesForPrimaryKeys(primaryKeyValues: any[]): IRowNode[];
182
183
  getRowNodeForPrimaryKey(primaryKeyValue: any): IRowNode;
183
184
  getRowNodeByIndex(index: number): IRowNode;
@@ -25,6 +25,10 @@ export interface DataChangeHistoryOptions<TData = any> {
25
25
  * @defaultValue undefined
26
26
  */
27
27
  changeHistoryButton?: DataChangeHistoryButton<TData> | DataChangeHistoryButton<TData>[];
28
+ /**
29
+ * Whether to show all changes for each cell or just the last one
30
+ */
31
+ showLastDataChangeOnly?: boolean;
28
32
  }
29
33
  /**
30
34
  * Built in `undo` or `clear` data change action
@@ -25,6 +25,12 @@ export interface DataChangeHistoryApi {
25
25
  * Retrieves all data changes which are currently available
26
26
  */
27
27
  getDataChangeHistoryLog(): CellDataChangedInfo[];
28
+ /**
29
+ * Adds item to Data Change History log
30
+ *
31
+ * @param dataChangeInfo the change to log
32
+ */
33
+ addDataChangeHistoryEntry(dataChangeInfo: CellDataChangedInfo): void;
28
34
  /**
29
35
  * Reverts the provided data change to its previous value
30
36
  *
@@ -7,7 +7,9 @@ export declare class DataChangeHistoryApiImpl extends ApiBase implements DataCha
7
7
  deactivateDataChangeHistory(): void;
8
8
  suspendDataChangeHistory(): void;
9
9
  getDataChangeHistoryLog(): CellDataChangedInfo[];
10
+ addDataChangeHistoryEntry(dataChangeInfo: CellDataChangedInfo): void;
10
11
  undoDataChangeHistoryEntry(dataChangeInfo: CellDataChangedInfo): void;
11
12
  clearDataChangeHistoryEntry(dataChangeInfo: CellDataChangedInfo): void;
12
13
  openDataChangeHistorySettingsPanel(): void;
14
+ private getDataChangeHistoryKey;
13
15
  }
@@ -6,6 +6,21 @@ const ApiBase_1 = require("./ApiBase");
6
6
  const SystemRedux_1 = require("../../Redux/ActionsReducers/SystemRedux");
7
7
  const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
8
8
  class DataChangeHistoryApiImpl extends ApiBase_1.ApiBase {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.getDataChangeHistoryKey = (dataChangeInfo) => {
12
+ const columnId = dataChangeInfo.column.columnId;
13
+ const primaryKeyValue = dataChangeInfo.primaryKeyValue;
14
+ const changedAt = dataChangeInfo.changedAt;
15
+ const showLastDataChangeOnly = this.getAdaptableApi().optionsApi.getDataChangeHistoryOptions().showLastDataChangeOnly;
16
+ if (showLastDataChangeOnly) {
17
+ return JSON.stringify({ columnId, primaryKeyValue });
18
+ }
19
+ else {
20
+ return JSON.stringify({ columnId, primaryKeyValue, changedAt });
21
+ }
22
+ };
23
+ }
9
24
  getDataChangeHistoryMode() {
10
25
  return this.getAdaptableState().System.DataChangeHistory.currentMode;
11
26
  }
@@ -37,11 +52,17 @@ class DataChangeHistoryApiImpl extends ApiBase_1.ApiBase {
37
52
  const changeLog = (_a = this.getAdaptableState().System.DataChangeHistory.logs) !== null && _a !== void 0 ? _a : {};
38
53
  return Object.values(changeLog);
39
54
  }
55
+ addDataChangeHistoryEntry(dataChangeInfo) {
56
+ const uniqueKey = this.getDataChangeHistoryKey(dataChangeInfo);
57
+ this.dispatchAction((0, SystemRedux_1.SystemDataChangeHistoryAdd)(dataChangeInfo, uniqueKey));
58
+ }
40
59
  undoDataChangeHistoryEntry(dataChangeInfo) {
41
- this.dispatchAction((0, SystemRedux_1.SystemDataChangeHistoryUndo)(dataChangeInfo));
60
+ const uniqueKey = this.getDataChangeHistoryKey(dataChangeInfo);
61
+ this.dispatchAction((0, SystemRedux_1.SystemDataChangeHistoryUndo)(dataChangeInfo, uniqueKey));
42
62
  }
43
63
  clearDataChangeHistoryEntry(dataChangeInfo) {
44
- this.dispatchAction((0, SystemRedux_1.SystemDataChangeHistoryClearRow)(dataChangeInfo));
64
+ const uniqueKey = this.getDataChangeHistoryKey(dataChangeInfo);
65
+ this.dispatchAction((0, SystemRedux_1.SystemDataChangeHistoryClearRow)(dataChangeInfo, uniqueKey));
45
66
  }
46
67
  openDataChangeHistorySettingsPanel() {
47
68
  this.showModulePopup(ModuleConstants.DataChangeHistoryModuleId);
@@ -156,7 +156,4 @@ export declare class AlertInternalApi extends ApiBase {
156
156
  * - trigger -> [trigger]
157
157
  */
158
158
  private annotateAlertText;
159
- private replaceAll;
160
- private extractColsFromText;
161
- private extractContextKeysFromText;
162
159
  }
@@ -9,6 +9,7 @@ const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Exten
9
9
  const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
10
10
  const IAlertService_1 = require("../../Utilities/Services/Interface/IAlertService");
11
11
  const ObjectFactory_1 = tslib_1.__importDefault(require("../../Utilities/ObjectFactory"));
12
+ const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
12
13
  class AlertInternalApi extends ApiBase_1.ApiBase {
13
14
  getExpressionForAlertRule(alertRule) {
14
15
  var expression;
@@ -635,19 +636,19 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
635
636
  return text;
636
637
  }
637
638
  if (context === null || context === void 0 ? void 0 : context.newValue) {
638
- text = this.replaceAll(text, '[newValue]', context.newValue);
639
+ text = Helper_1.default.replaceAll(text, '[newValue]', context.newValue);
639
640
  }
640
641
  if (context === null || context === void 0 ? void 0 : context.oldValue) {
641
- text = this.replaceAll(text, '[oldValue]', context.oldValue);
642
+ text = Helper_1.default.replaceAll(text, '[oldValue]', context.oldValue);
642
643
  }
643
644
  if (context === null || context === void 0 ? void 0 : context.primaryKeyValue) {
644
- text = this.replaceAll(text, '[primaryKeyValue]', context.primaryKeyValue);
645
+ text = Helper_1.default.replaceAll(text, '[primaryKeyValue]', context.primaryKeyValue);
645
646
  }
646
647
  if (context === null || context === void 0 ? void 0 : context.timestamp) {
647
- text = this.replaceAll(text, '[timestamp]', context.timestamp + '');
648
+ text = Helper_1.default.replaceAll(text, '[timestamp]', context.timestamp + '');
648
649
  }
649
650
  if (context === null || context === void 0 ? void 0 : context.numberOfRows) {
650
- text = this.replaceAll(text, '[numberOfRows]', context.numberOfRows + '');
651
+ text = Helper_1.default.replaceAll(text, '[numberOfRows]', context.numberOfRows + '');
651
652
  }
652
653
  if (context === null || context === void 0 ? void 0 : context.trigger) {
653
654
  const dataChangeTriggerMap = {
@@ -665,57 +666,29 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
665
666
  const mappedTrigger =
666
667
  // @ts-ignore
667
668
  (_a = (dataChangeTriggerMap[context.trigger] || rowChangeTriggerMap[context.trigger])) !== null && _a !== void 0 ? _a : context.trigger;
668
- text = this.replaceAll(text, '[trigger]', mappedTrigger);
669
+ text = Helper_1.default.replaceAll(text, '[trigger]', mappedTrigger);
669
670
  }
670
671
  if (context === null || context === void 0 ? void 0 : context.column) {
671
- text = this.replaceAll(text, '[column]', this.getColumnApi().getFriendlyNameForColumnId(context.column.columnId));
672
+ text = Helper_1.default.replaceAll(text, '[column]', this.getColumnApi().getFriendlyNameForColumnId(context.column.columnId));
672
673
  }
673
674
  if (context === null || context === void 0 ? void 0 : context.rowNode) {
674
- const columns = this.extractColsFromText(text);
675
+ const columns = Helper_1.default.extractColsFromText(text);
675
676
  for (const column of columns) {
676
677
  if (this.getColumnApi().getColumnWithColumnId(column)) {
677
- text = this.replaceAll(text, `[rowData.${column}]`, this.getGridApi().getRawValueFromRowNode(context.rowNode, column));
678
+ text = Helper_1.default.replaceAll(text, `[rowData.${column}]`, this.getGridApi().getRawValueFromRowNode(context.rowNode, column));
678
679
  }
679
680
  }
680
681
  }
681
682
  if (text.indexOf('[context') !== -1) {
682
683
  const agGridContext = (_c = (_b = this.adaptable.agGridAdapter).getGridOption) === null || _c === void 0 ? void 0 : _c.call(_b, 'context');
683
- const agGridContextKeys = this.extractContextKeysFromText(text);
684
+ const agGridContextKeys = Helper_1.default.extractContextKeysFromText(text);
684
685
  for (const key of agGridContextKeys) {
685
686
  if (agGridContext[key]) {
686
- text = this.replaceAll(text, `[context.${key}]`, agGridContext[key]);
687
+ text = Helper_1.default.replaceAll(text, `[context.${key}]`, agGridContext[key]);
687
688
  }
688
689
  }
689
690
  }
690
691
  return text;
691
692
  }
692
- replaceAll(text, toReplace, replaceWith) {
693
- if (!text) {
694
- return text;
695
- }
696
- // fails for []
697
- toReplace = toReplace.replace('[', '\\[').replace(']', '\\]');
698
- return text.replace(new RegExp(toReplace, 'g'), replaceWith);
699
- }
700
- extractColsFromText(text) {
701
- // rowData.columnName => columnName
702
- const regex = /\[rowData\.(.*?)\]/g;
703
- let m;
704
- const cols = [];
705
- while ((m = regex.exec(text)) !== null) {
706
- cols.push(m[1]);
707
- }
708
- return cols;
709
- }
710
- extractContextKeysFromText(text) {
711
- // context.columnName => columnName
712
- const regex = /\[context\.(.*?)\]/g;
713
- let m;
714
- const contextKeys = [];
715
- while ((m = regex.exec(text)) !== null) {
716
- contextKeys.push(m[1]);
717
- }
718
- return contextKeys;
719
- }
720
693
  }
721
694
  exports.AlertInternalApi = AlertInternalApi;
@@ -56,14 +56,14 @@ export declare class FormatColumnInternalApi extends ApiBase {
56
56
  * @param customDisplayFormatterContext context that includes value to format
57
57
  * @param options formatter options
58
58
  */
59
- getNumberFormattedValue(value: any, node: IRowNode, abColumn: AdaptableColumn, options: AdaptableFormat['Options']): any;
59
+ getNumberFormattedValue(value: any, node: IRowNode, column: AdaptableColumn, options: AdaptableFormat['Options']): any;
60
60
  /**
61
61
  * Format value according to format options.
62
62
  *
63
63
  * @param value context that includes value to format
64
64
  * @param options formatter options
65
65
  */
66
- getStringFormattedValue(value: any, node: IRowNode, abColumn: AdaptableColumn, options: StringFormatterOptions): string;
66
+ getStringFormattedValue(value: any, node: IRowNode, column: AdaptableColumn, options: StringFormatterOptions): string;
67
67
  /**
68
68
  * Format value according to format options.
69
69
  *
@@ -95,9 +95,9 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
95
95
  * @param customDisplayFormatterContext context that includes value to format
96
96
  * @param options formatter options
97
97
  */
98
- getNumberFormattedValue(value, node, abColumn, options) {
99
- const preparedValue = this.applyCustomFormatters(value, node, abColumn, options);
100
- return FormatHelper_1.default.NumberFormatter(preparedValue, options);
98
+ getNumberFormattedValue(value, node, column, options) {
99
+ const preparedValue = this.applyCustomFormatters(value, node, column, options);
100
+ return FormatHelper_1.default.NumberFormatter(preparedValue, options, node, column, this.getAdaptableApi());
101
101
  }
102
102
  /**
103
103
  * Format value according to format options.
@@ -105,9 +105,9 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
105
105
  * @param value context that includes value to format
106
106
  * @param options formatter options
107
107
  */
108
- getStringFormattedValue(value, node, abColumn, options) {
109
- const preparedValue = this.applyCustomFormatters(value, node, abColumn, options);
110
- return FormatHelper_1.default.StringFormatter(preparedValue, options);
108
+ getStringFormattedValue(value, node, column, options) {
109
+ const preparedValue = this.applyCustomFormatters(value, node, column, options);
110
+ return FormatHelper_1.default.StringFormatter(preparedValue, options, node, column, this.getAdaptableApi());
111
111
  }
112
112
  /**
113
113
  * Format value according to format options.
@@ -88,7 +88,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
88
88
  const shouldShowValuesCount = this.shouldShowValuesCount(abColumn);
89
89
  let valueOptions = [];
90
90
  if (shouldShowValuesCount) {
91
- const allGridCells = this.adaptable.getGridCellsForColumn(columnId, false, this.getColumnFilterOptions().valuesFilterOptions.showCurrentlyFilteredValuesCount);
91
+ const allGridCells = this.adaptable.getGridCellsForColumn(columnId, this.getColumnFilterOptions().valuesFilterOptions.showCurrentlyFilteredValuesCount);
92
92
  const allGridValues = allGridCells.map((gc) => gc.displayValue);
93
93
  const newsortedDistinctValues = sortedDistinctValues.filter((gc) => gc.displayValue != undefined && gc.displayValue != '' && gc.displayValue != null);
94
94
  valueOptions = newsortedDistinctValues.map((cv) => {
@@ -115,17 +115,17 @@ class GridInternalApi extends ApiBase_1.ApiBase {
115
115
  }
116
116
  shouldShowValuesCount(column) {
117
117
  const showValuesCount = this.getColumnFilterOptions().valuesFilterOptions.showValuesCount;
118
- let shouldShowValuesCount = false;
118
+ let returnValue = false;
119
119
  if (showValuesCount) {
120
120
  if (typeof showValuesCount === 'function') {
121
121
  const columnFilterContext = Object.assign({ column }, this.getAdaptableApi().internalApi.buildBaseContext());
122
- shouldShowValuesCount = showValuesCount(columnFilterContext);
122
+ returnValue = showValuesCount(columnFilterContext);
123
123
  }
124
124
  else {
125
- shouldShowValuesCount = showValuesCount;
125
+ returnValue = showValuesCount;
126
126
  }
127
127
  }
128
- return shouldShowValuesCount;
128
+ return returnValue;
129
129
  }
130
130
  async getDistinctFilterDisplayValuesForColumnForFiltersUI(columnId, filter, showFilteredRowsOnly) {
131
131
  const abColumn = this.getColumnApi().getColumnWithColumnId(columnId);
@@ -148,7 +148,13 @@ class GridInternalApi extends ApiBase_1.ApiBase {
148
148
  addPredicateValues(params) {
149
149
  var _a, _b, _c, _d;
150
150
  const { valueOptions, column, shouldShowValuesCount, visibleRowsOnly } = params;
151
- const allGridCells = this.adaptable.getGridCellsForColumn(column.columnId, true, visibleRowsOnly);
151
+ const visibleGridCells = this.adaptable.getGridCellsForColumnTemp(column.columnId, visibleRowsOnly);
152
+ let allGridCells;
153
+ if (shouldShowValuesCount) {
154
+ allGridCells = visibleRowsOnly
155
+ ? visibleGridCells
156
+ : this.adaptable.getGridCellsForColumnTemp(column.columnId, this.getColumnFilterOptions().valuesFilterOptions.showCurrentlyFilteredValuesCount);
157
+ }
152
158
  const adaptableApi = this.getAdaptableApi();
153
159
  const predicateIds = adaptableApi.columnFilterApi.internalApi.getValuesFitlerPredicateIds(column);
154
160
  if (ArrayExtensions_1.default.IsNullOrEmpty(predicateIds)) {
@@ -161,7 +167,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
161
167
  if (!visibleRowsOnly) {
162
168
  return true;
163
169
  }
164
- return this.isPredicateInVisibleCellValues(predicateId, allGridCells);
170
+ return this.isPredicateInVisibleCellValues(predicateId, visibleGridCells);
165
171
  })
166
172
  .map((predicateId) => {
167
173
  var _a;
@@ -35,19 +35,19 @@ export interface NumberFormatterOptions extends BaseFormatterOptions {
35
35
  */
36
36
  IntegerSeparator?: string;
37
37
  /**
38
- * Prefix to use before the number
38
+ * Prefix to use before cell value
39
39
  */
40
40
  Prefix?: string;
41
41
  /**
42
- * Suffix to use after the number
42
+ * Suffix to use after cell value
43
43
  */
44
44
  Suffix?: string;
45
45
  /**
46
- * Replaces cell value with supplied value
46
+ * Replaces cell value with supplied value (that can contain placeholders)
47
47
  */
48
48
  Content?: string | number;
49
49
  /**
50
- * Multiplier to use on the number
50
+ * Multiplier to use on cell value
51
51
  */
52
52
  Multiplier?: number;
53
53
  /**
@@ -55,23 +55,23 @@ export interface NumberFormatterOptions extends BaseFormatterOptions {
55
55
  */
56
56
  Parentheses?: boolean;
57
57
  /**
58
- * Truncates a number
58
+ * Truncates cell value
59
59
  */
60
60
  Truncate?: boolean;
61
61
  /**
62
- * Returns absolute value of a number
62
+ * Returns absolute value of cell value
63
63
  */
64
64
  Abs?: boolean;
65
65
  /**
66
- * Returns smallest integer > number
66
+ * Returns smallest integer greater than cell value
67
67
  */
68
68
  Ceiling?: boolean;
69
69
  /**
70
- * Returns largest intger < number
70
+ * Returns largest integer cell value
71
71
  */
72
72
  Floor?: boolean;
73
73
  /**
74
- * Rounds a Number
74
+ * Rounds cell value
75
75
  */
76
76
  Round?: boolean;
77
77
  }
@@ -210,14 +210,15 @@ export interface SystemLicenseShowWatermarkAction extends Redux.Action {
210
210
  }
211
211
  export interface SystemLicenseDisablePersistenceAction extends Redux.Action {
212
212
  }
213
- export interface SystemDataChangeHistoryAddAction extends Redux.Action {
213
+ export interface SystemDataChangeHistoryAction extends Redux.Action {
214
214
  changeInfo: CellDataChangedInfo;
215
+ uniqueKey: string;
215
216
  }
216
- export interface SystemDataChangeHistoryUndoAction extends Redux.Action {
217
- changeInfo: CellDataChangedInfo;
217
+ export interface SystemDataChangeHistoryAddAction extends SystemDataChangeHistoryAction {
218
218
  }
219
- export interface SystemDataChangeHistoryClearRowAction extends Redux.Action {
220
- changeInfo: CellDataChangedInfo;
219
+ export interface SystemDataChangeHistoryUndoAction extends SystemDataChangeHistoryAction {
220
+ }
221
+ export interface SystemDataChangeHistoryClearRowAction extends SystemDataChangeHistoryAction {
221
222
  }
222
223
  export interface SystemDataChangeHistoryEnableAction extends Redux.Action {
223
224
  }
@@ -307,9 +308,9 @@ export declare const SystemProgressIndicatorShow: (progressIndicatorConfig: Prog
307
308
  export declare const SystemProgressIndicatorHide: () => SystemProgressIndicatorHideAction;
308
309
  export declare const SystemLicenseShowWatermark: (text: string) => SystemLicenseShowWatermarkAction;
309
310
  export declare const SystemLicenseDisablePersistence: () => SystemLicenseDisablePersistenceAction;
310
- export declare const SystemDataChangeHistoryAdd: (changeInfo: CellDataChangedInfo) => SystemDataChangeHistoryAddAction;
311
- export declare const SystemDataChangeHistoryUndo: (changeInfo: CellDataChangedInfo) => SystemDataChangeHistoryUndoAction;
312
- export declare const SystemDataChangeHistoryClearRow: (changeInfo: CellDataChangedInfo) => SystemDataChangeHistoryClearRowAction;
311
+ export declare const SystemDataChangeHistoryAdd: (changeInfo: CellDataChangedInfo, uniqueKey: string) => SystemDataChangeHistoryAddAction;
312
+ export declare const SystemDataChangeHistoryUndo: (changeInfo: CellDataChangedInfo, uniqueKey: string) => SystemDataChangeHistoryUndoAction;
313
+ export declare const SystemDataChangeHistoryClearRow: (changeInfo: CellDataChangedInfo, uniqueKey: string) => SystemDataChangeHistoryClearRowAction;
313
314
  export declare const SystemDataChangeHistoryEnable: () => SystemDataChangeHistoryEnableAction;
314
315
  export declare const SystemDataChangeHistoryDisable: () => SystemDataChangeHistoryDisableAction;
315
316
  export declare const SystemDataChangeHistorySuspend: () => SystemDataChangeHistorySuspendAction;
@@ -275,19 +275,22 @@ const SystemLicenseDisablePersistence = () => ({
275
275
  type: exports.SYSTEM_LICENSE_DISABLE_PERSISTENCE,
276
276
  });
277
277
  exports.SystemLicenseDisablePersistence = SystemLicenseDisablePersistence;
278
- const SystemDataChangeHistoryAdd = (changeInfo) => ({
278
+ const SystemDataChangeHistoryAdd = (changeInfo, uniqueKey) => ({
279
279
  type: exports.SYSTEM_DATA_CHANGE_HISTORY_ADD,
280
280
  changeInfo,
281
+ uniqueKey,
281
282
  });
282
283
  exports.SystemDataChangeHistoryAdd = SystemDataChangeHistoryAdd;
283
- const SystemDataChangeHistoryUndo = (changeInfo) => ({
284
+ const SystemDataChangeHistoryUndo = (changeInfo, uniqueKey) => ({
284
285
  type: exports.SYSTEM_DATA_CHANGE_HISTORY_UNDO,
285
286
  changeInfo,
287
+ uniqueKey,
286
288
  });
287
289
  exports.SystemDataChangeHistoryUndo = SystemDataChangeHistoryUndo;
288
- const SystemDataChangeHistoryClearRow = (changeInfo) => ({
290
+ const SystemDataChangeHistoryClearRow = (changeInfo, uniqueKey) => ({
289
291
  type: exports.SYSTEM_DATA_CHANGE_HISTORY_CLEAR_ROW,
290
292
  changeInfo,
293
+ uniqueKey,
291
294
  });
292
295
  exports.SystemDataChangeHistoryClearRow = SystemDataChangeHistoryClearRow;
293
296
  const SystemDataChangeHistoryEnable = () => ({
@@ -727,7 +730,7 @@ const SystemReducer = (state = initialState, action) => {
727
730
  case exports.SYSTEM_DATA_CHANGE_HISTORY_ADD: {
728
731
  const actionTypedAdd = action;
729
732
  const cellDataChangedInfo = actionTypedAdd.changeInfo;
730
- const uniqueKey = getDataChangeHistoryKey(cellDataChangedInfo);
733
+ const uniqueKey = actionTypedAdd.uniqueKey;
731
734
  const updatedDataChangeHistoryLogs = Object.assign({}, state.DataChangeHistory.logs);
732
735
  updatedDataChangeHistoryLogs[uniqueKey] = cellDataChangedInfo;
733
736
  return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { logs: updatedDataChangeHistoryLogs }) });
@@ -735,15 +738,15 @@ const SystemReducer = (state = initialState, action) => {
735
738
  case exports.SYSTEM_DATA_CHANGE_HISTORY_UNDO: {
736
739
  const actionTypedUndo = action;
737
740
  const cellDataChangedInfo = actionTypedUndo.changeInfo;
738
- const uniqueKey = getDataChangeHistoryKey(cellDataChangedInfo);
741
+ const uniqueKey = actionTypedUndo.uniqueKey;
739
742
  const updatedDataChangeHistoryLogs = Object.assign({}, state.DataChangeHistory.logs);
740
743
  delete updatedDataChangeHistoryLogs[uniqueKey];
741
744
  return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { logs: updatedDataChangeHistoryLogs }) });
742
745
  }
743
746
  case exports.SYSTEM_DATA_CHANGE_HISTORY_CLEAR_ROW: {
744
- const actionTypedUndo = action;
745
- const cellDataChangedInfo = actionTypedUndo.changeInfo;
746
- const uniqueKey = getDataChangeHistoryKey(cellDataChangedInfo);
747
+ const actionTypedClearRow = action;
748
+ const cellDataChangedInfo = actionTypedClearRow.changeInfo;
749
+ const uniqueKey = actionTypedClearRow.uniqueKey;
747
750
  const updatedDataChangeHistoryLogs = Object.assign({}, state.DataChangeHistory.logs);
748
751
  delete updatedDataChangeHistoryLogs[uniqueKey];
749
752
  return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { logs: updatedDataChangeHistoryLogs }) });
@@ -849,6 +852,3 @@ const SystemReducer = (state = initialState, action) => {
849
852
  }
850
853
  };
851
854
  exports.SystemReducer = SystemReducer;
852
- const getDataChangeHistoryKey = ({ column: columnId, primaryKeyValue, }) => {
853
- return JSON.stringify({ columnId, primaryKeyValue });
854
- };
@@ -4,7 +4,6 @@ exports.DataChangeHistoryModule = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const AdaptableModuleBase_1 = require("./AdaptableModuleBase");
6
6
  const ModuleConstants = tslib_1.__importStar(require("../Utilities/Constants/ModuleConstants"));
7
- const SystemRedux_1 = require("../Redux/ActionsReducers/SystemRedux");
8
7
  const DataChangeHistoryStatusBarContent_1 = require("../View/DataChangeHistory/DataChangeHistoryStatusBarContent");
9
8
  const core_1 = require("ag-grid-community");
10
9
  class DataChangeHistoryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
@@ -17,7 +16,7 @@ class DataChangeHistoryModule extends AdaptableModuleBase_1.AdaptableModuleBase
17
16
  .on('CellDataChanged', (cellDataChangedInfo) => {
18
17
  if (cellDataChangedInfo.trigger !== 'undo' && cellDataChangedInfo.trigger !== 'aggChange') {
19
18
  if (this.shouldLogDataChange(cellDataChangedInfo)) {
20
- this.api.internalApi.dispatchReduxAction((0, SystemRedux_1.SystemDataChangeHistoryAdd)(cellDataChangedInfo));
19
+ this.api.dataChangeHistoryApi.addDataChangeHistoryEntry(cellDataChangedInfo);
21
20
  }
22
21
  }
23
22
  });
@@ -13,3 +13,4 @@ export declare const LicenseDocsLink: string;
13
13
  export declare const AdaptableOptionsDocsLink: string;
14
14
  export declare const AgGridModulesDocsLink: string;
15
15
  export declare const AlertMessageDocsLink: string;
16
+ export declare const FormatColumnPlaceholderDocsLink: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AlertMessageDocsLink = exports.AgGridModulesDocsLink = exports.AdaptableOptionsDocsLink = exports.LicenseDocsLink = exports.PrimaryKeyDocsLink = exports.PredicateDocsLink = exports.QuantileAggregatedScalarQueryDocsLink = exports.CumulativeAggregatedScalarQueryDocsLink = exports.AggregatedScalarQueryDocsLink = exports.AggregatedBooleanQueryDocsLink = exports.ObservableQueryDocsLink = exports.ScalarQueryDocsLink = exports.BooleanQueryDocsLink = exports.ExpressionEditorDocsLink = exports.HOST_URL_DOCS = void 0;
3
+ exports.FormatColumnPlaceholderDocsLink = exports.AlertMessageDocsLink = exports.AgGridModulesDocsLink = exports.AdaptableOptionsDocsLink = exports.LicenseDocsLink = exports.PrimaryKeyDocsLink = exports.PredicateDocsLink = exports.QuantileAggregatedScalarQueryDocsLink = exports.CumulativeAggregatedScalarQueryDocsLink = exports.AggregatedScalarQueryDocsLink = exports.AggregatedBooleanQueryDocsLink = exports.ObservableQueryDocsLink = exports.ScalarQueryDocsLink = exports.BooleanQueryDocsLink = exports.ExpressionEditorDocsLink = exports.HOST_URL_DOCS = void 0;
4
4
  exports.HOST_URL_DOCS = 'https://docs.adaptabletools.com';
5
5
  //export const HOST_URL_DOCS = 'http://localhost:3000';
6
6
  exports.ExpressionEditorDocsLink = `${exports.HOST_URL_DOCS}/guide/ui-expression-editor`;
@@ -17,3 +17,4 @@ exports.LicenseDocsLink = `${exports.HOST_URL_DOCS}/guide/licensing`;
17
17
  exports.AdaptableOptionsDocsLink = `${exports.HOST_URL_DOCS}/guide/reference-options-overview`;
18
18
  exports.AgGridModulesDocsLink = `${exports.HOST_URL_DOCS}/guide/dev-guide-aggrid-modules-overview`;
19
19
  exports.AlertMessageDocsLink = `${exports.HOST_URL_DOCS}/guide/handbook-alerting-message`;
20
+ exports.FormatColumnPlaceholderDocsLink = `${exports.HOST_URL_DOCS}/guide/handbook-column-formatting-display-format-placeholder`;
@@ -0,0 +1,22 @@
1
+ import { IRowNode } from '@ag-grid-community/core';
2
+ import { AdaptableApi, AdaptableColumn } from '../../types';
3
+ /**
4
+ * Context used for Placeholders in Display Format
5
+ */
6
+ export interface DisplayFormatPlaceholderContext {
7
+ column: AdaptableColumn;
8
+ rowNode: IRowNode;
9
+ input: any;
10
+ api: AdaptableApi;
11
+ }
12
+ /**
13
+ * Supported tokens:
14
+ * - column -> [column]
15
+ * - input -> [value]
16
+ * - rowData.colId -> [rowData.colId]
17
+ */
18
+ export declare function resolvePlaceholders(text: string, context: DisplayFormatPlaceholderContext): string;
19
+ export declare const FormatContentHelper: {
20
+ resolvePlaceholders: typeof resolvePlaceholders;
21
+ };
22
+ export default FormatContentHelper;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormatContentHelper = exports.resolvePlaceholders = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
6
+ /**
7
+ * Supported tokens:
8
+ * - column -> [column]
9
+ * - input -> [value]
10
+ * - rowData.colId -> [rowData.colId]
11
+ */
12
+ function resolvePlaceholders(text, context) {
13
+ if (!text) {
14
+ return text;
15
+ }
16
+ if (!context) {
17
+ return text;
18
+ }
19
+ if (context === null || context === void 0 ? void 0 : context.input) {
20
+ text = Helper_1.default.replaceAll(text, '[value]', context.input);
21
+ }
22
+ if (context === null || context === void 0 ? void 0 : context.column) {
23
+ text = Helper_1.default.replaceAll(text, '[column]', context.api.columnApi.getFriendlyNameForColumnId(context.column.columnId));
24
+ }
25
+ if (context === null || context === void 0 ? void 0 : context.rowNode) {
26
+ const columns = Helper_1.default.extractColsFromText(text);
27
+ for (const column of columns) {
28
+ if (context.api.columnApi.getColumnWithColumnId(column)) {
29
+ text = Helper_1.default.replaceAll(text, `[rowData.${column}]`, context.api.gridApi.getRawValueFromRowNode(context.rowNode, column));
30
+ }
31
+ }
32
+ }
33
+ return text;
34
+ }
35
+ exports.resolvePlaceholders = resolvePlaceholders;
36
+ exports.FormatContentHelper = {
37
+ resolvePlaceholders,
38
+ };
39
+ exports.default = exports.FormatContentHelper;
@@ -1,8 +1,9 @@
1
- import { NumberFormatterOptions, DateFormatterOptions, AdaptableFormat, StringFormatterOptions } from '../../PredefinedConfig/Common/AdaptableFormat';
2
- export declare function Format(input: any, format: AdaptableFormat): string;
3
- export declare function NumberFormatter(input: number | string, options?: NumberFormatterOptions): string;
1
+ import { NumberFormatterOptions, DateFormatterOptions, StringFormatterOptions } from '../../PredefinedConfig/Common/AdaptableFormat';
2
+ import { IRowNode } from '@ag-grid-community/core';
3
+ import { AdaptableApi, AdaptableColumn } from '../../types';
4
+ export declare function NumberFormatter(input: number, options?: NumberFormatterOptions, rowNode?: IRowNode, column?: AdaptableColumn, api?: AdaptableApi): string;
4
5
  export declare function DateFormatter(input: number | Date | string, options: DateFormatterOptions, strictFormatting?: boolean): string | undefined;
5
- export declare function StringFormatter(input: string, options?: StringFormatterOptions): string;
6
+ export declare function StringFormatter(input: string, options?: StringFormatterOptions, rowNode?: IRowNode, column?: AdaptableColumn, api?: AdaptableApi): string;
6
7
  declare const _default: {
7
8
  NumberFormatter: typeof NumberFormatter;
8
9
  DateFormatter: typeof DateFormatter;