@adaptabletools/adaptable-cjs 20.2.0 → 20.2.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 (66) hide show
  1. package/base.css +7 -7
  2. package/base.css.map +1 -1
  3. package/index.css +7 -7
  4. package/index.css.map +1 -1
  5. package/package.json +1 -1
  6. package/src/AdaptableOptions/QuickSearchOptions.d.ts +1 -1
  7. package/src/AdaptableOptions/StateOptions.d.ts +60 -15
  8. package/src/AdaptableState/Common/AdaptableColumn.d.ts +4 -0
  9. package/src/AdaptableState/FormatColumnState.d.ts +11 -6
  10. package/src/AdaptableState/LayoutState.d.ts +16 -2
  11. package/src/AdaptableState/QuickSearchState.d.ts +5 -5
  12. package/src/Api/Implementation/ColumnApiImpl.js +4 -2
  13. package/src/Api/Implementation/LayoutHelpers.d.ts +3 -0
  14. package/src/Api/Implementation/LayoutHelpers.js +80 -41
  15. package/src/Api/Implementation/QuickSearchApiImpl.d.ts +2 -2
  16. package/src/Api/Implementation/QuickSearchApiImpl.js +4 -4
  17. package/src/Api/Implementation/StateApiImpl.d.ts +1 -0
  18. package/src/Api/Implementation/StateApiImpl.js +6 -5
  19. package/src/Api/Internal/ColumnInternalApi.d.ts +1 -0
  20. package/src/Api/Internal/ColumnInternalApi.js +5 -0
  21. package/src/Api/Internal/FormatColumnInternalApi.d.ts +1 -1
  22. package/src/Api/Internal/FormatColumnInternalApi.js +8 -8
  23. package/src/Api/QuickSearchApi.d.ts +2 -2
  24. package/src/Api/StateApi.d.ts +9 -0
  25. package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +4 -4
  26. package/src/Redux/ActionsReducers/QuickSearchRedux.js +9 -9
  27. package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +14 -18
  28. package/src/Redux/Store/AdaptableStore.d.ts +2 -0
  29. package/src/Redux/Store/AdaptableStore.js +13 -5
  30. package/src/Redux/Store/Interface/IAdaptableStore.d.ts +1 -0
  31. package/src/Redux/Store/Interface/IStorageEngine.d.ts +4 -4
  32. package/src/Redux/Store/buildAdaptableStateFunctionConfig.d.ts +3 -0
  33. package/src/Redux/Store/buildAdaptableStateFunctionConfig.js +13 -0
  34. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +1 -1
  35. package/src/Utilities/Helpers/StyleHelper.d.ts +1 -1
  36. package/src/Utilities/Helpers/StyleHelper.js +11 -0
  37. package/src/Utilities/Services/LicenseService/index.js +1 -1
  38. package/src/Utilities/license/decode.js +1 -1
  39. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -3
  40. package/src/View/Components/EntityRulesEditor/index.js +3 -3
  41. package/src/View/Components/ExpressionWizard.js +1 -1
  42. package/src/View/Components/StyleComponent.d.ts +1 -0
  43. package/src/View/Components/StyleComponent.js +2 -1
  44. package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
  45. package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
  46. package/src/View/Layout/Wizard/sections/ColumnsSection.js +27 -8
  47. package/src/View/Layout/Wizard/sections/GridFilterSection.js +1 -1
  48. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +4 -4
  49. package/src/View/License/LicenseWatermark.js +1 -1
  50. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
  51. package/src/View/QuickSearch/QuickSearchInput.js +3 -2
  52. package/src/View/QuickSearch/QuickSearchPopup.d.ts +1 -1
  53. package/src/View/QuickSearch/QuickSearchPopup.js +7 -4
  54. package/src/agGrid/AdaptableAgGrid.js +21 -10
  55. package/src/agGrid/AgGridAdapter.js +6 -1
  56. package/src/agGrid/AgGridColumnAdapter.d.ts +1 -0
  57. package/src/agGrid/AgGridColumnAdapter.js +39 -17
  58. package/src/agGrid/AgGridExportAdapter.js +22 -10
  59. package/src/env.js +2 -2
  60. package/src/layout-manager/src/LayoutManagerModel.d.ts +17 -4
  61. package/src/layout-manager/src/index.d.ts +1 -1
  62. package/src/layout-manager/src/index.js +61 -18
  63. package/src/metamodel/adaptable.metamodel.d.ts +43 -16
  64. package/src/metamodel/adaptable.metamodel.js +1 -1
  65. package/src/types.d.ts +2 -2
  66. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPivotLayout = exports.pivotLayoutModelToPivotLayout = exports.tableLayoutModelToTableLayout = exports.pivotLayoutToPivotLayoutModel = exports.tableLayoutToTableLayoutModel = exports.checkForDuplicateColumns = exports.normalizePivotLayout = exports.normalizeTableLayout = exports.normalizeLayout = exports.areLayoutsEqual = exports.layoutModelToLayoutState = exports.layoutStateToLayoutModel = void 0;
3
+ exports.isPivotLayout = exports.pivotLayoutModelToPivotLayout = exports.tableLayoutModelToTableLayout = exports.pivotLayoutToPivotLayoutModel = exports.tableLayoutToTableLayoutModel = exports.checkForDuplicateColumns = exports.toRowGroupValuesForLayoutModel = exports.toRowGroupValuesForLayoutState = exports.getLayoutRowGroupValuesExceptionGroupKeys = exports.normalizePivotLayout = exports.normalizeTableLayout = exports.normalizeLayout = exports.areLayoutsEqual = exports.layoutModelToLayoutState = exports.layoutStateToLayoutModel = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
6
6
  const isPivotLayoutModel_1 = require("../../layout-manager/src/isPivotLayoutModel");
@@ -74,6 +74,81 @@ const errorOnce = (message) => {
74
74
  console.error(message);
75
75
  errorOnceMessages.set(message, true);
76
76
  };
77
+ const getLayoutRowGroupValuesExceptionGroupKeys = (layout) => {
78
+ if (!layout.RowGroupValues) {
79
+ return [];
80
+ }
81
+ if (layout.RowGroupValues?.RowGroupDefaultBehavior === 'always-collapsed') {
82
+ return [];
83
+ }
84
+ if (layout.RowGroupValues?.RowGroupDefaultBehavior === 'always-expanded') {
85
+ return [];
86
+ }
87
+ if (Array.isArray(layout.RowGroupValues?.GroupKeys)) {
88
+ const currentGroupedColumns = (layout.RowGroupedColumns || []).join(',');
89
+ const matchingGroupKeys = layout.RowGroupValues.GroupKeys.find(({ RowGroupedColumns }) => {
90
+ return RowGroupedColumns.join(',') === currentGroupedColumns;
91
+ });
92
+ if (matchingGroupKeys) {
93
+ return matchingGroupKeys.ExceptionGroupKeys;
94
+ }
95
+ }
96
+ return layout.RowGroupValues.ExceptionGroupKeys || [];
97
+ };
98
+ exports.getLayoutRowGroupValuesExceptionGroupKeys = getLayoutRowGroupValuesExceptionGroupKeys;
99
+ const toRowGroupValuesForLayoutState = (rowGroupValuesModel) => {
100
+ if (!rowGroupValuesModel) {
101
+ return undefined;
102
+ }
103
+ const rowGroupValuesState = {
104
+ RowGroupDefaultBehavior: rowGroupValuesModel.RowGroupDisplay,
105
+ };
106
+ if (rowGroupValuesModel.RowGroupDisplay === 'collapsed' ||
107
+ rowGroupValuesModel.RowGroupDisplay === 'expanded') {
108
+ if (rowGroupValuesModel.GroupKeys) {
109
+ rowGroupValuesState.GroupKeys =
110
+ rowGroupValuesModel.GroupKeys.map(({ RowGroupedColumns, Values }) => {
111
+ return {
112
+ RowGroupedColumns,
113
+ ExceptionGroupKeys: Values,
114
+ };
115
+ });
116
+ }
117
+ else {
118
+ rowGroupValuesState.ExceptionGroupKeys =
119
+ rowGroupValuesModel.Values;
120
+ }
121
+ }
122
+ return rowGroupValuesState;
123
+ };
124
+ exports.toRowGroupValuesForLayoutState = toRowGroupValuesForLayoutState;
125
+ const toRowGroupValuesForLayoutModel = (rowGroupValuesState) => {
126
+ if (!rowGroupValuesState) {
127
+ return undefined;
128
+ }
129
+ if (rowGroupValuesState.RowGroupDefaultBehavior === 'always-collapsed' ||
130
+ rowGroupValuesState.RowGroupDefaultBehavior === 'always-expanded') {
131
+ return {
132
+ RowGroupDisplay: rowGroupValuesState.RowGroupDefaultBehavior,
133
+ };
134
+ }
135
+ if (rowGroupValuesState.GroupKeys) {
136
+ return {
137
+ RowGroupDisplay: rowGroupValuesState.RowGroupDefaultBehavior,
138
+ GroupKeys: rowGroupValuesState.GroupKeys.map(({ RowGroupedColumns, ExceptionGroupKeys }) => {
139
+ return {
140
+ RowGroupedColumns,
141
+ Values: ExceptionGroupKeys,
142
+ };
143
+ }),
144
+ };
145
+ }
146
+ return {
147
+ RowGroupDisplay: rowGroupValuesState.RowGroupDefaultBehavior,
148
+ Values: rowGroupValuesState.ExceptionGroupKeys || [],
149
+ };
150
+ };
151
+ exports.toRowGroupValuesForLayoutModel = toRowGroupValuesForLayoutModel;
77
152
  const checkForDuplicateColumns = (layout) => {
78
153
  if (layout.TableColumns) {
79
154
  const set = new Set(layout.TableColumns);
@@ -108,17 +183,7 @@ const tableLayoutToTableLayoutModel = (tableLayout) => {
108
183
  ColumnSorts: tableLayout.ColumnSorts,
109
184
  RowGroupedColumns: tableLayout.RowGroupedColumns,
110
185
  ColumnPinning: tableLayout.ColumnPinning,
111
- RowGroupValues: tableLayout.RowGroupValues
112
- ? tableLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-collapsed' ||
113
- tableLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-expanded'
114
- ? {
115
- RowGroupDisplay: tableLayout.RowGroupValues.RowGroupDefaultBehavior,
116
- }
117
- : {
118
- RowGroupDisplay: tableLayout.RowGroupValues.RowGroupDefaultBehavior,
119
- Values: tableLayout.RowGroupValues.ExceptionGroupKeys || [],
120
- }
121
- : undefined,
186
+ RowGroupValues: (0, exports.toRowGroupValuesForLayoutModel)(tableLayout.RowGroupValues),
122
187
  ColumnGroupValues: tableLayout.ColumnGroupValues
123
188
  ? tableLayout.ColumnGroupValues.ColumnGroupDefaultBehavior === 'always-expanded' ||
124
189
  tableLayout.ColumnGroupValues.ColumnGroupDefaultBehavior === 'always-collapsed'
@@ -192,17 +257,7 @@ const pivotLayoutToPivotLayoutModel = (pivotLayout) => {
192
257
  GrandTotalRow: pivotLayout.GrandTotalRow,
193
258
  PivotGrandTotal: pivotLayout.PivotGrandTotal,
194
259
  PivotColumnTotal: pivotLayout.PivotColumnTotal,
195
- RowGroupValues: pivotLayout.RowGroupValues
196
- ? pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-collapsed' ||
197
- pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-expanded'
198
- ? {
199
- RowGroupDisplay: pivotLayout.RowGroupValues.RowGroupDefaultBehavior,
200
- }
201
- : {
202
- RowGroupDisplay: pivotLayout.RowGroupValues.RowGroupDefaultBehavior,
203
- Values: pivotLayout.RowGroupValues.ExceptionGroupKeys || [],
204
- }
205
- : undefined,
260
+ RowGroupValues: (0, exports.toRowGroupValuesForLayoutModel)(pivotLayout.RowGroupValues),
206
261
  ColumnGroupValues: pivotLayout.ColumnGroupValues
207
262
  ? pivotLayout.ColumnGroupValues.ColumnGroupDefaultBehavior === 'always-expanded' ||
208
263
  pivotLayout.ColumnGroupValues.ColumnGroupDefaultBehavior === 'always-collapsed'
@@ -308,15 +363,7 @@ const tableLayoutModelToTableLayout = (layoutModel) => {
308
363
  delete tableLayout.ColumnPinning;
309
364
  }
310
365
  if (layoutModel.RowGroupValues) {
311
- tableLayout.RowGroupValues = {
312
- RowGroupDefaultBehavior: layoutModel.RowGroupValues.RowGroupDisplay,
313
- };
314
- if ((layoutModel.RowGroupValues.RowGroupDisplay === 'collapsed' ||
315
- layoutModel.RowGroupValues.RowGroupDisplay === 'expanded') &&
316
- layoutModel.RowGroupValues.Values) {
317
- // @ts-ignore
318
- tableLayout.RowGroupValues.ExceptionGroupKeys = layoutModel.RowGroupValues.Values;
319
- }
366
+ tableLayout.RowGroupValues = (0, exports.toRowGroupValuesForLayoutState)(layoutModel.RowGroupValues);
320
367
  }
321
368
  else {
322
369
  delete tableLayout.RowGroupValues;
@@ -411,15 +458,7 @@ const pivotLayoutModelToPivotLayout = (layoutModel) => {
411
458
  delete pivotLayout.PivotGroupedColumns;
412
459
  }
413
460
  if (layoutModel.RowGroupValues) {
414
- pivotLayout.RowGroupValues = {
415
- RowGroupDefaultBehavior: layoutModel.RowGroupValues.RowGroupDisplay,
416
- };
417
- if ((layoutModel.RowGroupValues.RowGroupDisplay === 'collapsed' ||
418
- layoutModel.RowGroupValues.RowGroupDisplay === 'expanded') &&
419
- layoutModel.RowGroupValues.Values) {
420
- // @ts-ignore
421
- pivotLayout.RowGroupValues.ExceptionGroupKeys = layoutModel.RowGroupValues.Values;
422
- }
461
+ pivotLayout.RowGroupValues = (0, exports.toRowGroupValuesForLayoutState)(layoutModel.RowGroupValues);
423
462
  }
424
463
  else {
425
464
  delete pivotLayout.RowGroupValues;
@@ -9,10 +9,10 @@ export declare class QuickSearchApiImpl extends ApiBase implements QuickSearchAp
9
9
  gotoNextMatch(): void;
10
10
  gotoPreviousMatch(): void;
11
11
  getQuickSearchValue(): string;
12
- getQuickSearchStyle(): AdaptableStyle;
12
+ getQuickSearchCellMatchStyle(): AdaptableStyle;
13
13
  getQuickSearchTextMatchStyle(): AdaptableStyle | undefined;
14
14
  getQuickSearchCurrentTextMatchStyle(): AdaptableStyle | undefined;
15
- setQuickSearchStyle(style: AdaptableStyle): void;
15
+ setQuickSearchCellMatchStyle(style: AdaptableStyle): void;
16
16
  openQuickSearchSettingsPanel(): void;
17
17
  showFloatingQuickSearch(): void;
18
18
  hideFloatingQuickSearch(): void;
@@ -25,8 +25,8 @@ class QuickSearchApiImpl extends ApiBase_1.ApiBase {
25
25
  getQuickSearchValue() {
26
26
  return this.getQuickSearchState().QuickSearchText;
27
27
  }
28
- getQuickSearchStyle() {
29
- return this.getQuickSearchState().Style;
28
+ getQuickSearchCellMatchStyle() {
29
+ return this.getQuickSearchState().CellMatchStyle;
30
30
  }
31
31
  getQuickSearchTextMatchStyle() {
32
32
  return this.getQuickSearchState().TextMatchStyle;
@@ -34,8 +34,8 @@ class QuickSearchApiImpl extends ApiBase_1.ApiBase {
34
34
  getQuickSearchCurrentTextMatchStyle() {
35
35
  return this.getQuickSearchState().CurrentTextMatchStyle;
36
36
  }
37
- setQuickSearchStyle(style) {
38
- this.dispatchAction(QuickSearchRedux.QuickSearchSetStyle(style));
37
+ setQuickSearchCellMatchStyle(style) {
38
+ this.dispatchAction(QuickSearchRedux.QuickSearchSetCellMatchingStyle(style));
39
39
  }
40
40
  openQuickSearchSettingsPanel() {
41
41
  this.showModulePopup(ModuleConstants.QuickSearchModuleId);
@@ -40,6 +40,7 @@ export declare class StateApiImpl extends ApiBase implements StateApi {
40
40
  flushCurrentState?: boolean;
41
41
  progressIndicatorLabel?: string;
42
42
  }): Promise<void>;
43
+ persistAdaptableState(): Promise<AdaptableState>;
43
44
  getDescriptionForModule(module: AdaptableModule): string;
44
45
  getHelpPageForModule(module: AdaptableModule): string;
45
46
  getUserStateByStateKey(stateKey: AdaptableStateKey, returnJson?: boolean): BaseState | string;
@@ -27,6 +27,7 @@ const SmartEditRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers
27
27
  const ThemeRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ThemeRedux"));
28
28
  const ToolPanelRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ToolPanelRedux"));
29
29
  const logDeprecation_1 = require("../../Utilities/logDeprecation");
30
+ const buildAdaptableStateFunctionConfig_1 = require("../../Redux/Store/buildAdaptableStateFunctionConfig");
30
31
  class StateApiImpl extends ApiBase_1.ApiBase {
31
32
  configInit() {
32
33
  this.dispatchAction((0, AdaptableStore_1.InitState)());
@@ -68,11 +69,7 @@ class StateApiImpl extends ApiBase_1.ApiBase {
68
69
  this.getAdaptableStore()
69
70
  .saveStateNow(this._adaptable)
70
71
  .then(() => {
71
- const promise = clearStateFn({
72
- adaptableId: adaptableOptions.adaptableId,
73
- adaptableStateKey: adaptableOptions.adaptableStateKey,
74
- userName: adaptableOptions.userName,
75
- });
72
+ const promise = clearStateFn((0, buildAdaptableStateFunctionConfig_1.buildAdaptableStateFunctionConfig)(this._adaptable));
76
73
  promise.then(() => {
77
74
  this.setAdaptableStateKey(adaptableOptions.adaptableStateKey, {
78
75
  initialState: newInitialState || adaptableOptions.initialState,
@@ -168,6 +165,10 @@ class StateApiImpl extends ApiBase_1.ApiBase {
168
165
  });
169
166
  });
170
167
  }
168
+ async persistAdaptableState() {
169
+ await this.getAdaptableStore().saveStateNow(this._adaptable);
170
+ return this.getAdaptableStore().getCurrentStorageState();
171
+ }
171
172
  getDescriptionForModule(module) {
172
173
  return this._adaptable.ModuleService.getModuleInfoByModule(module).Description;
173
174
  }
@@ -33,4 +33,5 @@ export declare class ColumnInternalApi extends ApiBase {
33
33
  isSpecialColumn(columnId: string, column?: AdaptableColumn): boolean;
34
34
  getColumnHeaderName(params: HeaderValueGetterParams): string;
35
35
  private buildColumnHeaderContext;
36
+ getQueryableColumnsForUIEditor(): AdaptableColumn[];
36
37
  }
@@ -287,5 +287,10 @@ class ColumnInternalApi extends ApiBase_1.ApiBase {
287
287
  // if nothing matched, we skip this column[group]
288
288
  return 'skip';
289
289
  }
290
+ getQueryableColumnsForUIEditor() {
291
+ return this.getColumnApi()
292
+ .getQueryableColumns()
293
+ .filter((column) => !column.isGeneratedPivotResultColumn && !column.isGeneratedRowGroupColumn);
294
+ }
290
295
  }
291
296
  exports.ColumnInternalApi = ColumnInternalApi;
@@ -77,7 +77,7 @@ export declare class FormatColumnInternalApi extends ApiBase {
77
77
  * @param scope Scope to check
78
78
  */
79
79
  getFormatColumnDefsForScope(scope: ColumnScope): AdaptablePredicateDef[];
80
- formatColumnWithColumnGroupStateShouldRender(formatColumn: FormatColumn, column: AdaptableColumn): boolean;
80
+ formatColumnWithColumnGroupScopeShouldRender(formatColumn: FormatColumn, column: AdaptableColumn): boolean;
81
81
  /**
82
82
  * Checks if format column is relevant for a given cell (intersection of given AdaptableColumn and RowNode)
83
83
  *
@@ -176,8 +176,8 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
176
176
  .predicateApi.internalApi.getFormatColumnPredicateDefs(scope)
177
177
  .filter((predicateDef) => this.getColumnScopeApi().isScopeInScope(scope, predicateDef.columnScope));
178
178
  }
179
- formatColumnWithColumnGroupStateShouldRender(formatColumn, column) {
180
- if (!formatColumn.ColumnGroupState) {
179
+ formatColumnWithColumnGroupScopeShouldRender(formatColumn, column) {
180
+ if (!formatColumn.ColumnGroupScope) {
181
181
  return true;
182
182
  }
183
183
  const agGridApi = this.getAdaptableApi().agGridApi;
@@ -191,7 +191,7 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
191
191
  if (!columnGroupParentForCurrentColumn) {
192
192
  return false;
193
193
  }
194
- const columnGroupState = columnGroupParentForCurrentColumn.isExpanded()
194
+ const columnGroupScope = columnGroupParentForCurrentColumn.isExpanded()
195
195
  ? 'Expanded'
196
196
  : 'Collapsed';
197
197
  const columnGroupLeafColumns = columnGroupParentForCurrentColumn.getLeafColumns();
@@ -199,13 +199,13 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
199
199
  columnGroupLeafColumns.length === 1 &&
200
200
  columnGroupLeafColumns[0] === agGridColumn;
201
201
  if (columnIsTopLevel) {
202
- // for top-level columns don't apply formatColumns that have an explicit ColumnGroupState defined
202
+ // for top-level columns don't apply formatColumns that have an explicit ColumnGroupScope defined
203
203
  return false;
204
204
  }
205
- if (formatColumn.ColumnGroupState === 'Both') {
205
+ if (formatColumn.ColumnGroupScope === 'Both') {
206
206
  return true;
207
207
  }
208
- return formatColumn.ColumnGroupState === columnGroupState;
208
+ return formatColumn.ColumnGroupScope === columnGroupScope;
209
209
  }
210
210
  /**
211
211
  * Checks if format column is relevant for a given cell (intersection of given AdaptableColumn and RowNode)
@@ -237,8 +237,8 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
237
237
  return false;
238
238
  }
239
239
  }
240
- if (formatColumn.ColumnGroupState &&
241
- !this.formatColumnWithColumnGroupStateShouldRender(formatColumn, column)) {
240
+ if (formatColumn.ColumnGroupScope &&
241
+ !this.formatColumnWithColumnGroupScopeShouldRender(formatColumn, column)) {
242
242
  return false;
243
243
  }
244
244
  if (!formatColumn.Rule) {
@@ -32,7 +32,7 @@ export interface QuickSearchApi {
32
32
  /**
33
33
  * Retrieves current Quick Search style
34
34
  */
35
- getQuickSearchStyle(): AdaptableStyle;
35
+ getQuickSearchCellMatchStyle(): AdaptableStyle;
36
36
  /**
37
37
  * Retrieves the style for the text match in the Quick Search
38
38
  */
@@ -45,7 +45,7 @@ export interface QuickSearchApi {
45
45
  * Sets style for Quick Search; can be name of (a provided) css style
46
46
  * @param style the style to use
47
47
  */
48
- setQuickSearchStyle(style: AdaptableStyle): void;
48
+ setQuickSearchCellMatchStyle(style: AdaptableStyle): void;
49
49
  /**
50
50
  * Opens Settings Panel with Quick Search section selected and visible
51
51
  */
@@ -210,4 +210,13 @@ export interface StateApi {
210
210
  * @param module Module which is Ready
211
211
  */
212
212
  dispatchStateReadyAction(module: AdaptableModule): void;
213
+ /**
214
+ * Persists the current Adaptable State to storage.
215
+ *
216
+ * This method first calls StateOption.saveState() to prepare the state
217
+ * and then StateOptions.persistState() to save it to the configured storage.
218
+ *
219
+ * @returns Promise<AdaptableState> - A promise that resolves to the persisted state
220
+ */
221
+ persistAdaptableState(): Promise<AdaptableState>;
213
222
  }
@@ -8,7 +8,7 @@ export declare const QUICK_SEARCH_RUN = "QUICK_SEARCH_RUN";
8
8
  /**
9
9
  * @ReduxAction Sets Quick Search style
10
10
  */
11
- export declare const QUICK_SEARCH_SET_STYLE = "QUICK_SEARCH_SET_STYLE";
11
+ export declare const QUICK_SEARCH_SET_CELL_MATCHING_STYLE = "QUICK_SEARCH_SET_CELL_MATCHING_STYLE";
12
12
  /**
13
13
  * @ReduxAction Quick Search Module is ready
14
14
  */
@@ -16,13 +16,13 @@ export declare const QUICK_SEARCH_READY = "QUICK_SEARCH_READY";
16
16
  export interface QuickSearchRunAction extends Redux.Action {
17
17
  quickSearchText: string;
18
18
  }
19
- export interface QuickSearchSetStyleAction extends Redux.Action {
20
- style: AdaptableStyle;
19
+ export interface QuickSearchSetMatchingCellStyleAction extends Redux.Action {
20
+ matchingCellStyle: AdaptableStyle;
21
21
  }
22
22
  export interface QuickSearchReadyAction extends Redux.Action {
23
23
  quickSearchState: QuickSearchState;
24
24
  }
25
25
  export declare const QuickSearchRun: (quickSearchText: string) => QuickSearchRunAction;
26
- export declare const QuickSearchSetStyle: (style: AdaptableStyle) => QuickSearchSetStyleAction;
26
+ export declare const QuickSearchSetCellMatchingStyle: (matchingCellStyle: AdaptableStyle) => QuickSearchSetMatchingCellStyleAction;
27
27
  export declare const QuickSearchReady: (quickSearchState: QuickSearchState) => QuickSearchReadyAction;
28
28
  export declare const QuickSearchReducer: Redux.Reducer<QuickSearchState>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuickSearchReducer = exports.QuickSearchReady = exports.QuickSearchSetStyle = exports.QuickSearchRun = exports.QUICK_SEARCH_READY = exports.QUICK_SEARCH_SET_STYLE = exports.QUICK_SEARCH_RUN = void 0;
3
+ exports.QuickSearchReducer = exports.QuickSearchReady = exports.QuickSearchSetCellMatchingStyle = exports.QuickSearchRun = exports.QUICK_SEARCH_READY = exports.QUICK_SEARCH_SET_CELL_MATCHING_STYLE = exports.QUICK_SEARCH_RUN = void 0;
4
4
  const ReduxConstants_1 = require("../../Utilities/Constants/ReduxConstants");
5
5
  const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
6
6
  /**
@@ -10,7 +10,7 @@ exports.QUICK_SEARCH_RUN = 'QUICK_SEARCH_RUN';
10
10
  /**
11
11
  * @ReduxAction Sets Quick Search style
12
12
  */
13
- exports.QUICK_SEARCH_SET_STYLE = 'QUICK_SEARCH_SET_STYLE';
13
+ exports.QUICK_SEARCH_SET_CELL_MATCHING_STYLE = 'QUICK_SEARCH_SET_CELL_MATCHING_STYLE';
14
14
  /**
15
15
  * @ReduxAction Quick Search Module is ready
16
16
  */
@@ -20,11 +20,11 @@ const QuickSearchRun = (quickSearchText) => ({
20
20
  quickSearchText,
21
21
  });
22
22
  exports.QuickSearchRun = QuickSearchRun;
23
- const QuickSearchSetStyle = (style) => ({
24
- type: exports.QUICK_SEARCH_SET_STYLE,
25
- style,
23
+ const QuickSearchSetCellMatchingStyle = (matchingCellStyle) => ({
24
+ type: exports.QUICK_SEARCH_SET_CELL_MATCHING_STYLE,
25
+ matchingCellStyle: matchingCellStyle,
26
26
  });
27
- exports.QuickSearchSetStyle = QuickSearchSetStyle;
27
+ exports.QuickSearchSetCellMatchingStyle = QuickSearchSetCellMatchingStyle;
28
28
  const QuickSearchReady = (quickSearchState) => ({
29
29
  type: exports.QUICK_SEARCH_READY,
30
30
  quickSearchState,
@@ -32,7 +32,7 @@ const QuickSearchReady = (quickSearchState) => ({
32
32
  exports.QuickSearchReady = QuickSearchReady;
33
33
  const initialState = {
34
34
  QuickSearchText: GeneralConstants_1.EMPTY_STRING,
35
- Style: {
35
+ CellMatchStyle: {
36
36
  BackColor: ReduxConstants_1.QUICK_SEARCH_DEFAULT_BACK_COLOR,
37
37
  ForeColor: ReduxConstants_1.QUICK_SEARCH_DEFAULT_FORE_COLOR,
38
38
  },
@@ -43,9 +43,9 @@ const QuickSearchReducer = (state = initialState, action) => {
43
43
  return Object.assign({}, state, {
44
44
  QuickSearchText: action.quickSearchText,
45
45
  });
46
- case exports.QUICK_SEARCH_SET_STYLE:
46
+ case exports.QUICK_SEARCH_SET_CELL_MATCHING_STYLE:
47
47
  return Object.assign({}, state, {
48
- Style: action.style,
48
+ CellMatchStyle: action.matchingCellStyle,
49
49
  });
50
50
  default:
51
51
  return state;
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
6
6
  const AdaptableReduxMerger_1 = require("./AdaptableReduxMerger");
7
7
  const AdaptableLogger_1 = require("../../agGrid/AdaptableLogger");
8
+ const buildAdaptableStateFunctionConfig_1 = require("./buildAdaptableStateFunctionConfig");
8
9
  const checkStatus = (response) => {
9
10
  const error = new Error(response.statusText);
10
11
  if (response.status >= 200 && response.status < 300) {
@@ -46,12 +47,8 @@ class AdaptableReduxLocalStorageEngine {
46
47
  setStateKey(adaptableStateKey) {
47
48
  this.adaptableStateKey = adaptableStateKey;
48
49
  }
49
- load(initialState = this.initialState) {
50
- return (this.loadState || loadState)({
51
- adaptableId: this.adaptableId,
52
- adaptableStateKey: this.adaptableStateKey,
53
- userName: this.userName,
54
- }).then((parsedJsonState) => {
50
+ load(adaptableInstance, initialState = this.initialState) {
51
+ return (this.loadState || loadState)((0, buildAdaptableStateFunctionConfig_1.buildAdaptableStateFunctionConfig)(adaptableInstance)).then((parsedJsonState) => {
55
52
  // we need to merge the Initial Adaptable State
56
53
  return Promise.resolve(initialState)
57
54
  .then((parsedInitialState) => {
@@ -60,20 +57,19 @@ class AdaptableReduxLocalStorageEngine {
60
57
  .catch((err) => AdaptableLogger_1.AdaptableLogger.consoleErrorBase(`AdaptableId: ${this.adaptableId}`, err));
61
58
  });
62
59
  }
63
- save(state, getState) {
64
- return this.saveNow(state, getState);
60
+ save(adaptableInstance, state, actionName) {
61
+ return this.saveNow(adaptableInstance, state, actionName);
65
62
  }
66
- saveNow(state, getState) {
67
- const config = {
68
- adaptableId: this.adaptableId,
69
- adaptableStateKey: this.adaptableStateKey,
70
- userName: this.userName,
71
- };
72
- let result = state;
73
- if (getState) {
74
- result = getState(state, config);
63
+ saveNow(adaptableInstance, state, actionName) {
64
+ const config = (0, buildAdaptableStateFunctionConfig_1.buildAdaptableStateFunctionConfig)(adaptableInstance);
65
+ config.actionName = actionName;
66
+ config.previousState = adaptableInstance.adaptableStore.getPreviousStorageState() || null;
67
+ let stateObject = structuredClone(state);
68
+ const getTransformedState = adaptableInstance.adaptableOptions.stateOptions.saveState;
69
+ if (getTransformedState) {
70
+ stateObject = getTransformedState(stateObject, config);
75
71
  }
76
- const promise = (this.persistState || persistState)(result, config)?.catch(rejectWithMessage);
72
+ const promise = (this.persistState || persistState)(stateObject, config)?.catch(rejectWithMessage);
77
73
  if (!(promise instanceof Promise)) {
78
74
  AdaptableLogger_1.AdaptableLogger.consoleWarnBase(`AdaptableId: ${this.adaptableId}`, 'stateOptions.persistState should return a promise, it returned', 'Error', promise);
79
75
  }
@@ -26,6 +26,7 @@ export declare class AdaptableStore implements IAdaptableStore {
26
26
  private emitter;
27
27
  private storageEngine;
28
28
  private currentStorageState?;
29
+ private previousStorageState?;
29
30
  private loadStorageInProgress;
30
31
  private loadStateOnStartup;
31
32
  on: (eventName: string, callback: EmitterCallback) => (() => void);
@@ -39,6 +40,7 @@ export declare class AdaptableStore implements IAdaptableStore {
39
40
  constructor(adaptable: IAdaptable);
40
41
  destroy(): void;
41
42
  getCurrentStorageState(): AdaptableState;
43
+ getPreviousStorageState(): AdaptableState;
42
44
  saveStateNow(adaptable: IAdaptable): Promise<any>;
43
45
  loadStore: (config: LoadStoreConfig) => Promise<any>;
44
46
  }
@@ -43,6 +43,7 @@ const TeamSharingRedux = tslib_1.__importStar(require("../ActionsReducers/TeamSh
43
43
  const ThemeRedux = tslib_1.__importStar(require("../ActionsReducers/ThemeRedux"));
44
44
  const ToolPanelRedux = tslib_1.__importStar(require("../ActionsReducers/ToolPanelRedux"));
45
45
  const TeamSharingState_1 = require("../../AdaptableState/TeamSharingState");
46
+ const buildAdaptableStateFunctionConfig_1 = require("./buildAdaptableStateFunctionConfig");
46
47
  exports.INIT_STATE = 'INIT_STATE';
47
48
  exports.LOAD_STATE = 'LOAD_STATE';
48
49
  const NON_PERSIST_ACTIONS = {
@@ -97,10 +98,10 @@ class AdaptableStore {
97
98
  // START STATE LOAD
98
99
  this.loadStorageInProgress = true;
99
100
  return (this.Load = this.storageEngine
100
- .load(initialState)
101
+ .load(adaptable, initialState)
101
102
  .then((storedState) => {
102
103
  if (storedState && this.loadStateOnStartup) {
103
- this.TheStore.dispatch((0, exports.LoadState)(postProcessState(adaptable.adaptableOptions.stateOptions.applyState(storedState))));
104
+ this.TheStore.dispatch((0, exports.LoadState)(postProcessState(adaptable.adaptableOptions.stateOptions.applyState(storedState, (0, buildAdaptableStateFunctionConfig_1.buildAdaptableStateFunctionConfig)(adaptable)))));
104
105
  }
105
106
  })
106
107
  .then(() => {
@@ -224,7 +225,11 @@ class AdaptableStore {
224
225
  delete storageState[key];
225
226
  });
226
227
  this.currentStorageState = storageState;
227
- storageEngine.save(storageState, adaptable.adaptableOptions.stateOptions.saveState);
228
+ this.previousStorageState = { ...state };
229
+ NON_PERSISTENT_STORE_KEYS.forEach((key) => {
230
+ delete this.previousStorageState[key];
231
+ });
232
+ storageEngine.save(adaptable, storageState, action.type);
228
233
  }
229
234
  return finalState;
230
235
  };
@@ -248,10 +253,13 @@ class AdaptableStore {
248
253
  getCurrentStorageState() {
249
254
  return this.currentStorageState;
250
255
  }
256
+ getPreviousStorageState() {
257
+ return this.previousStorageState;
258
+ }
251
259
  saveStateNow(adaptable) {
252
260
  const storageState = this.getCurrentStorageState();
253
261
  if (storageState) {
254
- return this.storageEngine.saveNow(storageState, adaptable.adaptableOptions.stateOptions.saveState);
262
+ return this.storageEngine.saveNow(adaptable, storageState, 'API_CALL_SAVE_STATE');
255
263
  }
256
264
  return Promise.resolve(true);
257
265
  }
@@ -465,7 +473,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
465
473
  * Use Case: We have updated an AdapTable Module that affects rendering
466
474
  * Action: We set up all columns again
467
475
  */
468
- case QuickSearchRedux.QUICK_SEARCH_SET_STYLE:
476
+ case QuickSearchRedux.QUICK_SEARCH_SET_CELL_MATCHING_STYLE:
469
477
  case FormatColumnRedux.FORMAT_COLUMN_ADD:
470
478
  case FormatColumnRedux.FORMAT_COLUMN_EDIT:
471
479
  case FormatColumnRedux.FORMAT_COLUMN_DELETE:
@@ -13,6 +13,7 @@ export interface IAdaptableStore {
13
13
  Load: Promise<any>;
14
14
  loadStore: (config: LoadStoreConfig) => Promise<any>;
15
15
  getCurrentStorageState: () => AdaptableState | void;
16
+ getPreviousStorageState: () => AdaptableState | void;
16
17
  saveStateNow: (adaptable: IAdaptable) => Promise<any>;
17
18
  on: (eventName: string, callback: (data?: any) => any) => () => void;
18
19
  onAny: (callback: (eventName: string, data?: any) => any) => () => void;
@@ -1,9 +1,9 @@
1
- import { AdaptableSaveStateFunction } from '../../../AdaptableOptions/StateOptions';
2
1
  import { AdaptableState } from '../../../AdaptableState/AdaptableState';
3
2
  import { InitialState } from '../../../AdaptableState/InitialState';
3
+ import { IAdaptable } from '../../../AdaptableInterfaces/IAdaptable';
4
4
  export default interface IStorageEngine {
5
- load(initialState?: string | InitialState): Promise<any>;
6
- save(state: AdaptableState, getEnhancedState?: AdaptableSaveStateFunction): Promise<any>;
7
- saveNow(state: AdaptableState, getEnhancedState?: AdaptableSaveStateFunction): Promise<any>;
5
+ load(adaptable: IAdaptable, initialState?: string | InitialState): Promise<any>;
6
+ save(adaptable: IAdaptable, state: AdaptableState, actionName: string): Promise<any>;
7
+ saveNow(adaptable: IAdaptable, state: AdaptableState, actionName: string): Promise<any>;
8
8
  setStateKey(stateKey: string): void;
9
9
  }
@@ -0,0 +1,3 @@
1
+ import { AdaptableStateFunctionConfig } from '../../AdaptableOptions/StateOptions';
2
+ import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
3
+ export declare function buildAdaptableStateFunctionConfig(adaptable: IAdaptable): AdaptableStateFunctionConfig;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAdaptableStateFunctionConfig = void 0;
4
+ function buildAdaptableStateFunctionConfig(adaptable) {
5
+ return {
6
+ adaptableId: adaptable.adaptableOptions.adaptableId,
7
+ adaptableStateKey: adaptable.adaptableOptions.adaptableStateKey,
8
+ userName: adaptable.adaptableOptions.userName,
9
+ adaptableApi: adaptable.api,
10
+ adaptableContext: adaptable.api?.optionsApi?.getAdaptableContext(),
11
+ };
12
+ }
13
+ exports.buildAdaptableStateFunctionConfig = buildAdaptableStateFunctionConfig;
@@ -295,7 +295,7 @@ const getDataChangedInfoStub = (context) => {
295
295
  const rowNode = rowNodeStub;
296
296
  if (rowNode) {
297
297
  const primaryKeyValue = context.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(rowNode);
298
- const columnId = context.adaptableApi.columnApi.getQueryableColumns()[0]?.columnId;
298
+ const columnId = context.adaptableApi.columnApi.internalApi.getQueryableColumnsForUIEditor()[0]?.columnId;
299
299
  const oldValue = context.adaptableApi.gridApi.getCellRawValue(primaryKeyValue, columnId);
300
300
  const column = context.adaptableApi.columnApi.getColumnWithColumnId(columnId);
301
301
  const newValue = oldValue;
@@ -1,5 +1,5 @@
1
1
  import { AdaptableStyle } from '../../types';
2
- export declare const AgGridCellStyleProperties: readonly ["backgroundColor", "color", "fontWeight", "fontStyle", "fontSize", "borderColor"];
2
+ export declare const AgGridCellStyleProperties: readonly ["backgroundColor", "color", "fontWeight", "fontStyle", "fontSize", "borderColor", "--ab-dynamic-background-color", "--ab-dynamic-color", "--ab-dynamic-font-weight", "--ab-dynamic-font-style", "--ab-dynamic-font-size", "--ab-dynamic-text-decoration", "--ab-dynamic-border-radius", "--ab-dynamic-border-color"];
3
3
  export declare const normalizeStyleForAgGrid: (style: Record<string, any>) => {
4
4
  [x: string]: any;
5
5
  };
@@ -10,6 +10,17 @@ exports.AgGridCellStyleProperties = [
10
10
  'fontStyle',
11
11
  'fontSize',
12
12
  'borderColor',
13
+ // needed for quick search
14
+ // as otherwise, the currentTextMatchStyle is not removed correctly
15
+ // from the cell when looping through the values, and the cell is no longer the current match
16
+ '--ab-dynamic-background-color',
17
+ '--ab-dynamic-color',
18
+ '--ab-dynamic-font-weight',
19
+ '--ab-dynamic-font-style',
20
+ '--ab-dynamic-font-size',
21
+ '--ab-dynamic-text-decoration',
22
+ '--ab-dynamic-border-radius',
23
+ '--ab-dynamic-border-color',
13
24
  ];
14
25
  // see https://github.com/AdaptableTools/adaptable/issues/2119
15
26
  // since v29 AG Grid ignores style properties with null or undefined values