@adaptabletools/adaptable 20.1.4 → 20.1.6

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 (36) hide show
  1. package/base.css +1 -0
  2. package/base.css.map +1 -1
  3. package/index.css +1 -0
  4. package/index.css.map +1 -1
  5. package/package.json +1 -1
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -1
  7. package/src/AdaptableState/Common/AdaptableFilterState.d.ts +1 -1
  8. package/src/AdaptableState/Common/AdaptableSortState.d.ts +8 -3
  9. package/src/Api/CustomSortApi.d.ts +19 -9
  10. package/src/Api/GridApi.d.ts +3 -3
  11. package/src/Api/Implementation/CustomSortApiImpl.d.ts +3 -0
  12. package/src/Api/Implementation/CustomSortApiImpl.js +36 -0
  13. package/src/Api/Implementation/LayoutApiImpl.js +1 -1
  14. package/src/Api/Implementation/LayoutHelpers.d.ts +3 -3
  15. package/src/Api/Implementation/LayoutHelpers.js +126 -79
  16. package/src/Api/Implementation/StateApiImpl.d.ts +1 -2
  17. package/src/Api/Implementation/StateApiImpl.js +2 -4
  18. package/src/Api/Internal/EventInternalApi.d.ts +1 -1
  19. package/src/Api/Internal/EventInternalApi.js +11 -9
  20. package/src/Redux/ActionsReducers/LayoutRedux.js +24 -1
  21. package/src/Redux/Store/AdaptableStore.js +7 -4
  22. package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -1
  23. package/src/agGrid/AdaptableAgGrid.d.ts +7 -10
  24. package/src/agGrid/AdaptableAgGrid.js +80 -108
  25. package/src/components/ExpressionEditor/BaseEditorInput.js +2 -0
  26. package/src/components/Select/Select.d.ts +1 -0
  27. package/src/components/Select/Select.js +43 -17
  28. package/src/env.js +2 -2
  29. package/src/layout-manager/src/LayoutManagerModel.d.ts +29 -2
  30. package/src/layout-manager/src/index.d.ts +3 -0
  31. package/src/layout-manager/src/index.js +101 -30
  32. package/src/layout-manager/src/isLayoutEqual.js +11 -2
  33. package/src/layout-manager/src/normalizeLayoutModel.js +6 -0
  34. package/src/layout-manager/src/simplifyLayoutModel.js +3 -3
  35. package/src/metamodel/adaptable.metamodel.js +1 -1
  36. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -10,11 +10,11 @@ export const layoutStateToLayoutModel = (layout) => {
10
10
  }
11
11
  return tableLayoutToTableLayoutModel(layout);
12
12
  };
13
- export const layoutModelToLayoutState = (layoutModel, defaults) => {
13
+ export const layoutModelToLayoutState = (layoutModel) => {
14
14
  if (isPivotLayoutModel(layoutModel)) {
15
- return pivotLayoutModelToPivotLayout(layoutModel, defaults);
15
+ return pivotLayoutModelToPivotLayout(layoutModel);
16
16
  }
17
- return tableLayoutModelToTableLayout(layoutModel, defaults);
17
+ return tableLayoutModelToTableLayout(layoutModel);
18
18
  };
19
19
  function cleanupAdaptableObjectPrimitives(layout) {
20
20
  const l = layout;
@@ -45,55 +45,15 @@ export const normalizeLayout = (layout, options) => {
45
45
  return normalizeTableLayout(layout, options);
46
46
  };
47
47
  export const normalizeTableLayout = (tableLayout, options) => {
48
- const Source = tableLayout.Source;
49
- const Uuid = tableLayout.Uuid;
50
- const AdaptableVersion = tableLayout.AdaptableVersion;
51
- const ColumnFilters = tableLayout.ColumnFilters;
52
- const GridFilter = tableLayout.GridFilter;
53
48
  let model = tableLayoutToTableLayoutModel(tableLayout);
54
49
  model = normalizeTableLayoutModel(model, options);
55
- tableLayout = tableLayoutModelToTableLayout(model, tableLayout);
56
- if (Source) {
57
- tableLayout.Source = Source;
58
- }
59
- if (Uuid) {
60
- tableLayout.Uuid = Uuid;
61
- }
62
- if (AdaptableVersion) {
63
- tableLayout.AdaptableVersion = AdaptableVersion;
64
- }
65
- if (ColumnFilters) {
66
- tableLayout.ColumnFilters = ColumnFilters;
67
- }
68
- if (GridFilter) {
69
- tableLayout.GridFilter = GridFilter;
70
- }
50
+ tableLayout = tableLayoutModelToTableLayout(model);
71
51
  return tableLayout;
72
52
  };
73
53
  export const normalizePivotLayout = (pivotLayout) => {
74
- const Source = pivotLayout.Source;
75
- const Uuid = pivotLayout.Uuid;
76
- const AdaptableVersion = pivotLayout.AdaptableVersion;
77
- const ColumnFilters = pivotLayout.ColumnFilters;
78
- const GridFilter = pivotLayout.GridFilter;
79
54
  let model = pivotLayoutToPivotLayoutModel(pivotLayout);
80
55
  model = normalizePivotLayoutModel(model);
81
- pivotLayout = pivotLayoutModelToPivotLayout(model, pivotLayout);
82
- if (Source) {
83
- pivotLayout.Source = Source;
84
- }
85
- if (Uuid) {
86
- pivotLayout.Uuid = Uuid;
87
- }
88
- if (AdaptableVersion) {
89
- pivotLayout.AdaptableVersion = AdaptableVersion;
90
- }
91
- if (ColumnFilters) {
92
- pivotLayout.ColumnFilters = ColumnFilters;
93
- }
94
- if (GridFilter) {
95
- pivotLayout.GridFilter = GridFilter;
96
- }
56
+ pivotLayout = pivotLayoutModelToPivotLayout(model);
97
57
  return pivotLayout;
98
58
  };
99
59
  const errorOnceMessages = new Map();
@@ -122,15 +82,6 @@ export const checkForDuplicateColumns = (layout) => {
122
82
  export const tableLayoutToTableLayoutModel = (tableLayout) => {
123
83
  tableLayout = structuredClone(tableLayout);
124
84
  cleanupAdaptableObjectPrimitives(tableLayout);
125
- if (tableLayout.RowGroupValues) {
126
- // @ts-ignore
127
- delete tableLayout.RowGroupValues.Source;
128
- // @ts-ignore
129
- delete tableLayout.RowGroupValues.Uuid;
130
- // @ts-ignore
131
- delete tableLayout.RowGroupValues.AdaptableVersion;
132
- }
133
- delete tableLayout.ColumnHeaders;
134
85
  const TableAggregationColumns = (tableLayout.TableAggregationColumns || []).map(({ ColumnId, AggFunc }) => {
135
86
  return {
136
87
  ColumnId,
@@ -138,12 +89,12 @@ export const tableLayoutToTableLayoutModel = (tableLayout) => {
138
89
  };
139
90
  });
140
91
  const result = simplifyTableLayoutModel({
92
+ Ignore_Name: tableLayout.Name,
141
93
  SuppressAggFuncInHeader: tableLayout.SuppressAggFuncInHeader,
142
94
  TableColumns: tableLayout.TableColumns,
143
95
  ColumnWidths: tableLayout.ColumnWidths,
144
96
  ColumnVisibility: tableLayout.ColumnVisibility,
145
97
  ColumnSorts: tableLayout.ColumnSorts,
146
- // ColumnHeaders: tableLayout.ColumnHeaders,
147
98
  RowGroupedColumns: tableLayout.RowGroupedColumns,
148
99
  ColumnPinning: tableLayout.ColumnPinning,
149
100
  RowGroupValues: tableLayout.RowGroupValues
@@ -164,18 +115,42 @@ export const tableLayoutToTableLayoutModel = (tableLayout) => {
164
115
  result.RowGroupDisplayType = tableLayout.RowGroupDisplayType;
165
116
  }
166
117
  if (tableLayout.ColumnFilters) {
167
- result.ColumnFilters = tableLayout.ColumnFilters;
118
+ result.Ignore_ColumnFilters = tableLayout.ColumnFilters;
168
119
  }
169
120
  if (tableLayout.GridFilter) {
170
- result.GridFilter = tableLayout.GridFilter;
121
+ result.Ignore_GridFilter = tableLayout.GridFilter;
122
+ }
123
+ if (tableLayout.ColumnHeaders) {
124
+ result.Ignore_ColumnHeaders = tableLayout.ColumnHeaders;
125
+ }
126
+ if (tableLayout.AutoSizeColumns != null) {
127
+ result.Ignore_AutoSizeColumns = tableLayout.AutoSizeColumns;
128
+ }
129
+ if (tableLayout.IsReadOnly != null) {
130
+ result.Ignore_IsReadOnly = tableLayout.IsReadOnly;
131
+ }
132
+ if (tableLayout.Tags) {
133
+ result.Ignore_Tags = tableLayout.Tags;
134
+ }
135
+ if (tableLayout.Source) {
136
+ result.Ignore_Source = tableLayout.Source;
137
+ }
138
+ if (tableLayout.AdaptableVersion) {
139
+ result.Ignore_AdaptableVersion = tableLayout.AdaptableVersion;
140
+ }
141
+ if (tableLayout.Uuid) {
142
+ result.Ignore_Uuid = tableLayout.Uuid;
143
+ }
144
+ if (tableLayout.RowSummaries != null) {
145
+ result.Ignore_RowSummaries = tableLayout.RowSummaries;
171
146
  }
172
147
  return result;
173
148
  };
174
149
  export const pivotLayoutToPivotLayoutModel = (pivotLayout) => {
175
150
  pivotLayout = structuredClone(pivotLayout);
176
151
  cleanupAdaptableObjectPrimitives(pivotLayout);
177
- delete pivotLayout.ColumnHeaders;
178
152
  const result = simplifyPivotLayoutModel({
153
+ Ignore_Name: pivotLayout.Name,
179
154
  SuppressAggFuncInHeader: pivotLayout.SuppressAggFuncInHeader,
180
155
  ColumnWidths: pivotLayout.ColumnWidths,
181
156
  ColumnVisibility: pivotLayout.ColumnVisibility,
@@ -207,10 +182,31 @@ export const pivotLayoutToPivotLayoutModel = (pivotLayout) => {
207
182
  : undefined,
208
183
  });
209
184
  if (pivotLayout.ColumnFilters) {
210
- result.ColumnFilters = pivotLayout.ColumnFilters;
185
+ result.Ignore_ColumnFilters = pivotLayout.ColumnFilters;
211
186
  }
212
187
  if (pivotLayout.GridFilter) {
213
- result.GridFilter = pivotLayout.GridFilter;
188
+ result.Ignore_GridFilter = pivotLayout.GridFilter;
189
+ }
190
+ if (pivotLayout.ColumnHeaders) {
191
+ result.Ignore_ColumnHeaders = pivotLayout.ColumnHeaders;
192
+ }
193
+ if (pivotLayout.IsReadOnly != null) {
194
+ result.Ignore_IsReadOnly = pivotLayout.IsReadOnly;
195
+ }
196
+ if (pivotLayout.Tags) {
197
+ result.Ignore_Tags = pivotLayout.Tags;
198
+ }
199
+ if (pivotLayout.AutoSizeColumns != null) {
200
+ result.Ignore_AutoSizeColumns = pivotLayout.AutoSizeColumns;
201
+ }
202
+ if (pivotLayout.Source) {
203
+ result.Ignore_Source = pivotLayout.Source;
204
+ }
205
+ if (pivotLayout.AdaptableVersion) {
206
+ result.Ignore_AdaptableVersion = pivotLayout.AdaptableVersion;
207
+ }
208
+ if (pivotLayout.Uuid) {
209
+ result.Ignore_Uuid = pivotLayout.Uuid;
214
210
  }
215
211
  return result;
216
212
  };
@@ -220,14 +216,47 @@ function toAggFunc(aggFunc) {
220
216
  }
221
217
  return { aggFunc };
222
218
  }
223
- export const tableLayoutModelToTableLayout = (layoutModel, defaults) => {
219
+ export const tableLayoutModelToTableLayout = (layoutModel) => {
224
220
  const tableLayout = {
225
- ...defaults,
221
+ Name: layoutModel.Ignore_Name,
226
222
  TableColumns: layoutModel.TableColumns,
227
223
  ColumnWidths: layoutModel.ColumnWidths,
228
224
  ColumnVisibility: layoutModel.ColumnVisibility,
229
225
  ColumnSorts: layoutModel.ColumnSorts,
230
226
  };
227
+ if (layoutModel.SuppressAggFuncInHeader) {
228
+ tableLayout.SuppressAggFuncInHeader = layoutModel.SuppressAggFuncInHeader;
229
+ }
230
+ if (layoutModel.Ignore_GridFilter) {
231
+ tableLayout.GridFilter = layoutModel.Ignore_GridFilter;
232
+ }
233
+ if (layoutModel.Ignore_ColumnFilters) {
234
+ tableLayout.ColumnFilters = layoutModel.Ignore_ColumnFilters;
235
+ }
236
+ if (layoutModel.Ignore_ColumnHeaders) {
237
+ tableLayout.ColumnHeaders = layoutModel.Ignore_ColumnHeaders;
238
+ }
239
+ if (layoutModel.Ignore_AutoSizeColumns != null) {
240
+ tableLayout.AutoSizeColumns = layoutModel.Ignore_AutoSizeColumns;
241
+ }
242
+ if (layoutModel.Ignore_RowSummaries) {
243
+ tableLayout.RowSummaries = layoutModel.Ignore_RowSummaries;
244
+ }
245
+ if (layoutModel.Ignore_IsReadOnly != null) {
246
+ tableLayout.IsReadOnly = layoutModel.Ignore_IsReadOnly;
247
+ }
248
+ if (layoutModel.Ignore_Tags) {
249
+ tableLayout.Tags = layoutModel.Ignore_Tags;
250
+ }
251
+ if (layoutModel.Ignore_Source) {
252
+ tableLayout.Source = layoutModel.Ignore_Source;
253
+ }
254
+ if (layoutModel.Ignore_AdaptableVersion) {
255
+ tableLayout.AdaptableVersion = layoutModel.Ignore_AdaptableVersion;
256
+ }
257
+ if (layoutModel.Ignore_Uuid) {
258
+ tableLayout.Uuid = layoutModel.Ignore_Uuid;
259
+ }
231
260
  if (layoutModel.RowGroupDisplayType) {
232
261
  tableLayout.RowGroupDisplayType = layoutModel.RowGroupDisplayType;
233
262
  }
@@ -274,12 +303,6 @@ export const tableLayoutModelToTableLayout = (layoutModel, defaults) => {
274
303
  else {
275
304
  delete tableLayout.GrandTotalRow;
276
305
  }
277
- if (layoutModel.ColumnFilters) {
278
- tableLayout.ColumnFilters = layoutModel.ColumnFilters;
279
- }
280
- if (layoutModel.GridFilter) {
281
- tableLayout.GridFilter = layoutModel.GridFilter;
282
- }
283
306
  cleanupAdaptableObjectPrimitives(tableLayout);
284
307
  return tableLayout;
285
308
  };
@@ -293,9 +316,9 @@ function toAggregationColumnValue(columnAggregationModel) {
293
316
  }
294
317
  : columnAggregationModel.aggFunc;
295
318
  }
296
- export const pivotLayoutModelToPivotLayout = (layoutModel, defaults) => {
319
+ export const pivotLayoutModelToPivotLayout = (layoutModel) => {
297
320
  const pivotLayout = {
298
- ...defaults,
321
+ Name: layoutModel.Ignore_Name,
299
322
  PivotColumns: layoutModel.PivotColumns,
300
323
  TableColumns: layoutModel.TableColumns,
301
324
  ColumnWidths: layoutModel.ColumnWidths,
@@ -304,6 +327,36 @@ export const pivotLayoutModelToPivotLayout = (layoutModel, defaults) => {
304
327
  ColumnPinning: layoutModel.ColumnPinning,
305
328
  PivotExpandLevel: layoutModel.PivotExpandLevel,
306
329
  };
330
+ if (layoutModel.SuppressAggFuncInHeader) {
331
+ pivotLayout.SuppressAggFuncInHeader = layoutModel.SuppressAggFuncInHeader;
332
+ }
333
+ if (layoutModel.Ignore_GridFilter) {
334
+ pivotLayout.GridFilter = layoutModel.Ignore_GridFilter;
335
+ }
336
+ if (layoutModel.Ignore_ColumnFilters) {
337
+ pivotLayout.ColumnFilters = layoutModel.Ignore_ColumnFilters;
338
+ }
339
+ if (layoutModel.Ignore_ColumnHeaders) {
340
+ pivotLayout.ColumnHeaders = layoutModel.Ignore_ColumnHeaders;
341
+ }
342
+ if (layoutModel.Ignore_AutoSizeColumns != null) {
343
+ pivotLayout.AutoSizeColumns = layoutModel.Ignore_AutoSizeColumns;
344
+ }
345
+ if (layoutModel.Ignore_IsReadOnly != null) {
346
+ pivotLayout.IsReadOnly = layoutModel.Ignore_IsReadOnly;
347
+ }
348
+ if (layoutModel.Ignore_Tags) {
349
+ pivotLayout.Tags = layoutModel.Ignore_Tags;
350
+ }
351
+ if (layoutModel.Ignore_Source) {
352
+ pivotLayout.Source = layoutModel.Ignore_Source;
353
+ }
354
+ if (layoutModel.Ignore_AdaptableVersion) {
355
+ pivotLayout.AdaptableVersion = layoutModel.Ignore_AdaptableVersion;
356
+ }
357
+ if (layoutModel.Ignore_Uuid) {
358
+ pivotLayout.Uuid = layoutModel.Ignore_Uuid;
359
+ }
307
360
  if (layoutModel.PivotGroupedColumns) {
308
361
  pivotLayout.PivotGroupedColumns = layoutModel.PivotGroupedColumns;
309
362
  }
@@ -324,19 +377,19 @@ export const pivotLayoutModelToPivotLayout = (layoutModel, defaults) => {
324
377
  else {
325
378
  delete pivotLayout.RowGroupValues;
326
379
  }
327
- if (layoutModel.GrandTotalRow) {
380
+ if (layoutModel.GrandTotalRow != null) {
328
381
  pivotLayout.GrandTotalRow = layoutModel.GrandTotalRow;
329
382
  }
330
383
  else {
331
384
  delete pivotLayout.GrandTotalRow;
332
385
  }
333
- if (layoutModel.PivotGrandTotal) {
386
+ if (layoutModel.PivotGrandTotal != null) {
334
387
  pivotLayout.PivotGrandTotal = layoutModel.PivotGrandTotal;
335
388
  }
336
389
  else {
337
390
  delete pivotLayout.PivotGrandTotal;
338
391
  }
339
- if (layoutModel.PivotColumnTotal) {
392
+ if (layoutModel.PivotColumnTotal != null) {
340
393
  pivotLayout.PivotColumnTotal = layoutModel.PivotColumnTotal;
341
394
  }
342
395
  else {
@@ -352,12 +405,6 @@ export const pivotLayoutModelToPivotLayout = (layoutModel, defaults) => {
352
405
  else {
353
406
  delete pivotLayout.PivotAggregationColumns;
354
407
  }
355
- if (layoutModel.ColumnFilters) {
356
- pivotLayout.ColumnFilters = layoutModel.ColumnFilters;
357
- }
358
- if (layoutModel.GridFilter) {
359
- pivotLayout.GridFilter = layoutModel.GridFilter;
360
- }
361
408
  return pivotLayout;
362
409
  };
363
410
  export const isPivotLayout = (layout) => Array.isArray(layout.PivotColumns);
@@ -17,7 +17,7 @@ import { FreeTextColumnState } from '../../AdaptableState/FreeTextColumnState';
17
17
  import { ToolPanelState } from '../../AdaptableState/ToolPanelState';
18
18
  import { StateApi } from '../StateApi';
19
19
  import { AdaptableModule, AdaptableStateKey } from '../../AdaptableState/Common/Types';
20
- import { AdaptableOptions, AdaptableFilterState, AdaptableSortState, FlashingCellState, InitialState, NamedQueryState, ScheduleState, StatusBarState, StyledColumnState } from '../../types';
20
+ import { AdaptableFilterState, AdaptableSortState, FlashingCellState, InitialState, NamedQueryState, ScheduleState, StatusBarState, StyledColumnState } from '../../types';
21
21
  import { PredefinedConfig } from '../../AdaptableState/InitialState';
22
22
  import { ChartingState } from '../../AdaptableState/ChartingState';
23
23
  import { NoteState } from '../../AdaptableState/NoteState';
@@ -35,7 +35,6 @@ export declare class StateApiImpl extends ApiBase implements StateApi {
35
35
  loadUserState(state: InitialState): void;
36
36
  getAdaptableFilterState(): AdaptableFilterState;
37
37
  getAdaptableSortState(): AdaptableSortState;
38
- getAdaptableOptions(): Readonly<AdaptableOptions>;
39
38
  setAdaptableStateKey(adaptableStateKey: string, config?: {
40
39
  initialState?: InitialState;
41
40
  flushCurrentState?: boolean;
@@ -109,13 +109,11 @@ export class StateApiImpl extends ApiBase {
109
109
  getAdaptableSortState() {
110
110
  const adaptableSortState = {
111
111
  columnSorts: this.getGridApi().getColumnSorts(),
112
- customSorts: this.getCustomSortApi().getActiveCustomSorts(),
112
+ customSorts: this.getCustomSortApi().getLiveCustomSorts(),
113
+ customSortComparers: this.getCustomSortApi().getLiveCustomSortComparers(),
113
114
  };
114
115
  return adaptableSortState;
115
116
  }
116
- getAdaptableOptions() {
117
- return undefined;
118
- }
119
117
  setAdaptableStateKey(adaptableStateKey, config) {
120
118
  return new Promise((resolve, reject) => {
121
119
  this.getAdaptableInternalApi().executeWithProgressIndicator(config?.progressIndicatorLabel ?? `Initialising...`, () => {
@@ -11,7 +11,7 @@ export declare class EventInternalApi extends ApiBase {
11
11
  fireDashboardChangedEvent(trigger: string, oldDashboardState: DashboardState, newDashboardState: DashboardState): void;
12
12
  fireAlertFiredEvent(alertToFire: AdaptableAlert): void;
13
13
  fireThemeChangedEvent(theme: AdaptableTheme, trigger: 'ThemeSelected' | 'ThemeEdited'): void;
14
- fireLayoutChangedEvent(trigger: string, oldSate: LayoutState, newState: LayoutState): void;
14
+ fireLayoutChangedEvent(trigger: string, oldState: LayoutState, newState: LayoutState): void;
15
15
  fireScheduleTriggeredEvent(schedule: BaseSchedule): void;
16
16
  fireDataSetSelectedEvent(dataSet: DataSet): void;
17
17
  fireSystemStatusMessageDisplayedEvent(systemStatusMessageInfo: SystemStatusMessageInfo): void;
@@ -3,12 +3,14 @@ import isEqual from 'lodash/isEqual';
3
3
  export class EventInternalApi extends ApiBase {
4
4
  fireGridSortedEvent() {
5
5
  if (this.isAdapTableReady()) {
6
- const adaptableSortState = this.getStateApi().getAdaptableSortState();
7
- const gridSortedInfo = {
8
- adaptableSortState,
9
- ...this.getAdaptableInternalApi().buildBaseContext(),
10
- };
11
- this.getEventApi().emit('GridSorted', gridSortedInfo);
6
+ setTimeout(() => {
7
+ const adaptableSortState = this.getStateApi().getAdaptableSortState();
8
+ const gridSortedInfo = {
9
+ adaptableSortState,
10
+ ...this.getAdaptableInternalApi().buildBaseContext(),
11
+ };
12
+ this.getEventApi().emit('GridSorted', gridSortedInfo);
13
+ }, 50);
12
14
  }
13
15
  }
14
16
  fireCellChangedEvent(cellDataChangedInfo) {
@@ -82,13 +84,13 @@ export class EventInternalApi extends ApiBase {
82
84
  };
83
85
  this.getEventApi().emit('ThemeChanged', themeChangedInfo);
84
86
  }
85
- fireLayoutChangedEvent(trigger, oldSate, newState) {
86
- if (isEqual(oldSate, newState)) {
87
+ fireLayoutChangedEvent(trigger, oldState, newState) {
88
+ if (isEqual(oldState, newState)) {
87
89
  return;
88
90
  }
89
91
  const layoutChangedInfo = {
90
92
  actionName: trigger,
91
- oldLayoutState: oldSate,
93
+ oldLayoutState: oldState,
92
94
  newLayoutState: newState,
93
95
  ...this.getAdaptableInternalApi().buildBaseContext(),
94
96
  };
@@ -206,9 +206,32 @@ export const LayoutReducer = (state = initialState, action) => {
206
206
  }
207
207
  case LAYOUT_SAVE: {
208
208
  const actionLayout = action.layout;
209
+ let found = false;
210
+ let Layouts = state.Layouts.map((abObject) => {
211
+ if (found) {
212
+ // if already found, keep things as they were
213
+ return abObject;
214
+ }
215
+ found = abObject.Uuid === actionLayout.Uuid;
216
+ return found ? actionLayout : abObject;
217
+ });
218
+ if (!found) {
219
+ // let's try to find by name
220
+ Layouts = state.Layouts.map((abObject) => {
221
+ if (found) {
222
+ // if already found, keep things as they were
223
+ return abObject;
224
+ }
225
+ found = abObject.Name === actionLayout.Name;
226
+ return found ? actionLayout : abObject;
227
+ });
228
+ }
229
+ if (!found) {
230
+ Layouts = [...state.Layouts, actionLayout];
231
+ }
209
232
  return {
210
233
  ...state,
211
- Layouts: state.Layouts.map((abObject) => abObject.Uuid === actionLayout.Uuid ? actionLayout : abObject),
234
+ Layouts,
212
235
  };
213
236
  }
214
237
  case LAYOUT_DELETE: {
@@ -902,7 +902,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
902
902
  returnAction.type == LayoutRedux.LAYOUT_COLUMN_SET_CAPTION) {
903
903
  // tell AdapTable the Layout has been selected
904
904
  if (newLayout) {
905
- adaptable.setLayout(newLayout);
905
+ adaptable.updateLayoutInManagerAfterStoreHasChanged(newLayout);
906
906
  }
907
907
  }
908
908
  // when changing current layout via the api, the layout should update
@@ -913,7 +913,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
913
913
  // objects may have changed, but have the same contents
914
914
  // this prevents pivot layout from infinite set-layout
915
915
  !adaptable.api.layoutApi.internalApi.areLayoutsEqual(previousLayout, savingLayout)) {
916
- adaptable.setLayout(savingLayout);
916
+ adaptable.updateLayoutInManagerAfterStoreHasChanged(savingLayout);
917
917
  }
918
918
  }
919
919
  return returnAction;
@@ -937,8 +937,11 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
937
937
  const shouldTriggerColumnFiltering = adaptable.api.filterApi.columnFilterApi.internalApi.shouldNewColumnFilterTriggerColumnFiltering(action);
938
938
  const oldLayoutState = middlewareAPI.getState().Layout;
939
939
  returnAction = next(action);
940
- if (shouldTriggerColumnFiltering &&
941
- action.type !== LayoutRedux.LAYOUT_COLUMN_FILTER_EDIT) {
940
+ // we need to update the current layout model
941
+ // in the layout manager, so that onLayoutChange
942
+ // it will come back with the correct fields
943
+ adaptable.silentUpdateCurrentLayoutModel();
944
+ if (shouldTriggerColumnFiltering) {
942
945
  setTimeout(() => {
943
946
  adaptable.applyFiltering();
944
947
  }, 50);
@@ -29,7 +29,7 @@ export const ColumnValuesSelect = (props) => {
29
29
  minWidth: `var(--ab-cmp-select-column-menu-${column.columnId}__min-width, var(--ab-cmp-select-column-menu__min-width, 160px))`,
30
30
  };
31
31
  }, [column.columnId]);
32
- const component = (React.createElement(Select, { isMulti: true, showHeaderSelectionCheckbox: true, searchable: true, closeMenuOnSelect: false, menuStyle: menuStyle, ...props.selectProps, options: options, value: value, isLoading: props.isLoading, onChange: props.onChange }));
32
+ const component = (React.createElement(Select, { key: "select", isMulti: true, resizable: true, showHeaderSelectionCheckbox: true, searchable: true, closeMenuOnSelect: false, menuStyle: menuStyle, ...props.selectProps, options: options, value: value, isLoading: props.isLoading, onChange: props.onChange }));
33
33
  return (React.createElement("div", { className: join(baseClassName, props.isLoading && `${baseClassName}--loading`, !value.length && `${baseClassName}--empty`), onKeyDownCapture: (e) => {
34
34
  const event = e.nativeEvent || e;
35
35
  event.stopPropagation = () => {
@@ -29,6 +29,7 @@ import { RowFormService } from '../Utilities/Services/RowFormService';
29
29
  import { GridCellWithCount } from '../AdaptableState/Selection/GridCell';
30
30
  import { FlashingCellService } from '../Utilities/Services/FlashingCellService';
31
31
  import { AgGridExportAdapter } from './AgGridExportAdapter';
32
+ import { PivotLayoutModel, TableLayoutModel } from '../layout-manager/src/LayoutManagerModel';
32
33
  import { AgGridThemeAdapter } from './AgGridThemeAdapter';
33
34
  export type AdaptableLifecycleState = 'initial' | 'preprocessOptions' | 'initAdaptableState' | 'setupAgGrid' | 'initAgGrid' | 'agGridReady' | 'available' | 'ready' | 'preDestroyed';
34
35
  type RenderAgGridFrameworkComponentResult = false | GridApi;
@@ -99,19 +100,12 @@ export declare class AdaptableAgGrid implements IAdaptable {
99
100
  private agGridListenerKeydown;
100
101
  private agGridListenerMouseEnter;
101
102
  private agGridListenerMouseLeave;
102
- private listenerGlobalColumnEventsThatTriggerStateChange;
103
- private listenerGlobalColumnEventsThatTriggerAutoLayoutSave;
104
- private listenerGlobalRowGroupEventsThatTriggerAutoLayoutSave;
105
103
  private listenerGlobalSetRowSelection;
106
104
  private listenerCellEditingStarted;
107
105
  private listenerFirstDataRendered;
108
106
  private listenerPivotChanged;
109
- private listenerColumnRowGroupChanged;
110
- private listenerColumnResized;
111
107
  private listenerCellSelectionChanged;
112
108
  private listenerSortChanged;
113
- private listenerModelUpdated;
114
- private filteredOutPrimaryKeys;
115
109
  private layoutManager;
116
110
  private columnMinMaxValuesCache;
117
111
  renderReactRoot: RenderReactRootFn;
@@ -123,7 +117,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
123
117
  private adaptableStatusPanelKeys;
124
118
  _PRIVATE_adaptableJSXElement: React.JSX.Element;
125
119
  private _prevLayout;
126
- private __prevLayoutForOnChange;
120
+ private __prevLayoutForRefresh;
127
121
  constructor(config?: {
128
122
  getAgGridColumnApiModuleReference?: () => Module;
129
123
  });
@@ -148,6 +142,8 @@ export declare class AdaptableAgGrid implements IAdaptable {
148
142
  normalizeAdaptableState(state: AdaptableState, agGridOptions: NormalizeAdaptableStateOptions): AdaptableState;
149
143
  private normaliseLayoutState;
150
144
  private normaliseToolPanelState;
145
+ private getCurrentLayoutModel;
146
+ silentUpdateCurrentLayoutModel(layoutModel?: TableLayoutModel | PivotLayoutModel): void;
151
147
  applyFiltering(): void;
152
148
  showQuickFilter(): void;
153
149
  hideQuickFilter(): void;
@@ -186,6 +182,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
186
182
  private deriveAdaptableColumnStateFromAgGrid;
187
183
  private checkShouldClearExistingFiltersOrSearches;
188
184
  getGridCellFromRowNode(rowNode: IRowNode, columnId: string): GridCell | undefined;
185
+ isRowNodeAvailableAfterFiltering(rowNode: IRowNode): boolean;
189
186
  /**
190
187
  * Use (lazy evaluated) getters to avoid unnecessary calculations and memoization to avoid recalculating the same values
191
188
  */
@@ -260,7 +257,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
260
257
  }): Promise<GridCell[]>;
261
258
  getDistinctGridCellsForColumn(column: AdaptableColumn): GridCellWithCount[];
262
259
  private getGridCellsForCustomColumnValues;
263
- private isPrimaryKeyVisible;
264
260
  private addDistinctColumnValue;
265
261
  private getUniqueGridCells;
266
262
  getGridCellsForColumn(columnId: string, onlyVisibleRows?: boolean): GridCell[] | undefined;
@@ -322,7 +318,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
322
318
  isQuickFilterAvailable(): boolean;
323
319
  private hasFloatingFilterOnAtLeastOneColumn;
324
320
  getChartRef(chartId: string): ChartRef;
325
- setLayout(layout?: Layout): void;
321
+ updateLayoutInManagerAfterStoreHasChanged(layout?: Layout): void;
326
322
  private getActiveAdaptableAggFuncForCol;
327
323
  private onRowDataChanged;
328
324
  private onCellDataChanged;
@@ -344,6 +340,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
344
340
  private isRowGroupDifferentInLayout;
345
341
  private hasPivotTotalsInLayout;
346
342
  private onLayoutChange;
343
+ private refreshAdaptableAfterLayoutChange;
347
344
  private validateColumnDefTypes;
348
345
  }
349
346
  export {};