@adaptabletools/adaptable 22.0.1-canary.0 → 22.0.1-canary.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "22.0.1-canary.0",
3
+ "version": "22.0.1-canary.1",
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",
@@ -34,6 +34,10 @@ export declare abstract class AdaptablePlugin {
34
34
  afterInitStore(adaptable: IAdaptable): void;
35
35
  afterInit(ab: IAdaptable): void;
36
36
  afterSetLayout(adaptable: IAdaptable, layout: Layout): void;
37
+ onBeforeStoreEvent(eventName: string, data: {
38
+ action: Redux.Action;
39
+ state: AdaptableState;
40
+ }, adaptableStore: IAdaptableStore): void;
37
41
  onStoreEvent(eventName: string, data: {
38
42
  action: Redux.Action;
39
43
  state: AdaptableState;
@@ -39,6 +39,7 @@ export class AdaptablePlugin {
39
39
  afterInit(ab) { }
40
40
  // hook executed after each layout update (Adaptable.setLayout())
41
41
  afterSetLayout(adaptable, layout) { }
42
+ onBeforeStoreEvent(eventName, data, adaptableStore) { }
42
43
  onStoreEvent(eventName, data, adaptableStore) { }
43
44
  onAdaptableReady(adaptable, adaptableOptions) { }
44
45
  interceptSetupColumnProperty;
@@ -1,4 +1,4 @@
1
- import { AdaptableReadyInfo, AdaptableStateChangedInfo, AdaptableStateReloadedInfo, AlertFiredInfo, CalculatedColumnChangedInfo, CellChangedInfo, CellSelectionChangedInfo, ChartChangedInfo, ColumnFilterAppliedInfo, CommentChangedInfo, CustomToolbarConfiguredInfo, DashboardChangedInfo, DataImportedInfo, DataSetSelectedInfo, Fdc3MessageInfo, FlashingCellDisplayedInfo, GridFilterAppliedInfo, GridSortedInfo, LayoutChangedInfo, LiveDataChangedInfo, RowChangedInfo, RowFormSubmittedInfo, RowSelectionChangedInfo, ScheduleTriggeredInfo, SystemStatusMessageDisplayedInfo, TeamSharingEntityChangedInfo, ThemeChangedInfo } from '../types';
1
+ import { AdaptableReadyInfo, AdaptableStateChangedInfo, AdaptableStateReloadedInfo, BeforeAdaptableStateChangeInfo, AlertFiredInfo, CalculatedColumnChangedInfo, CellChangedInfo, CellSelectionChangedInfo, ChartChangedInfo, ColumnFilterAppliedInfo, CommentChangedInfo, CustomToolbarConfiguredInfo, DashboardChangedInfo, DataImportedInfo, DataSetSelectedInfo, Fdc3MessageInfo, FlashingCellDisplayedInfo, GridFilterAppliedInfo, GridSortedInfo, LayoutChangedInfo, LiveDataChangedInfo, RowChangedInfo, RowFormSubmittedInfo, RowSelectionChangedInfo, ScheduleTriggeredInfo, SystemStatusMessageDisplayedInfo, TeamSharingEntityChangedInfo, ThemeChangedInfo } from '../types';
2
2
  /**
3
3
  * Responsible for publishing the many Events that AdapTable fires
4
4
  */
@@ -210,6 +210,17 @@ export interface EventApi {
210
210
  * Unsubscribe from DashboardChanged
211
211
  */
212
212
  off(eventName: 'DashboardChanged', callback: (dashboardChangedInfo: DashboardChangedInfo) => void): void;
213
+ /**
214
+ * Event fired **before** Adaptable State changes (before the action is processed)
215
+ * @param eventName BeforeAdaptableStateChange
216
+ * @param callback BeforeAdaptableStateChangeInfo
217
+ * @returns the unsubscribe function
218
+ */
219
+ on(eventName: 'BeforeAdaptableStateChange', callback: (beforeAdaptableStateChangeInfo: BeforeAdaptableStateChangeInfo) => void): () => void;
220
+ /**
221
+ * Unsubscribe from BeforeAdaptableStateChange
222
+ */
223
+ off(eventName: 'BeforeAdaptableStateChange', callback: (beforeAdaptableStateChangeInfo: BeforeAdaptableStateChangeInfo) => void): void;
213
224
  /**
214
225
  * Event fired whenever **Adaptable State changes**
215
226
  * @param eventName AdaptableStateChanged
@@ -336,9 +347,10 @@ export interface EventApi {
336
347
  * @param callbackFdc3MessageInfo
337
348
  */
338
349
  off(eventName: 'Fdc3Message', callback: (fdc3MessageInfo: Fdc3MessageInfo) => void): void;
350
+ emitSync(eventName: 'BeforeAdaptableStateChange', data?: any): any[];
339
351
  emitSync(eventName: 'DashboardChanged', data?: any): any[];
340
352
  emitSync(eventName: 'FlashingCellDisplayed', data?: any): any[];
341
353
  emitSync(eventName: 'AdaptableDestroy'): any[];
342
- emit(eventName: 'RowFormSubmitted' | 'AdaptableReady' | 'AlertFired' | 'AdaptableStateChanged' | 'AdaptableStateReloaded' | 'CellChanged' | 'ChartChanged' | 'CheckboxColumnClicked' | 'CustomToolbarConfigured' | 'DashboardChanged' | 'DataImported' | 'DataSetSelected' | 'ColumnFilterApplied' | 'Fdc3Message' | 'RowChanged' | 'GridSorted' | 'LayoutChanged' | 'CalculatedColumnChanged' | 'LiveDataChanged' | 'ScheduleTriggered' | 'SearchChanged' | 'CellSelectionChanged' | 'RowSelectionChanged' | 'SystemStatusMessageDisplayed' | 'TeamSharingEntityChanged' | 'ThemeChanged' | 'GridFilterApplied' | 'CommentChanged', data?: any): Promise<any>;
354
+ emit(eventName: 'RowFormSubmitted' | 'AdaptableReady' | 'AlertFired' | 'BeforeAdaptableStateChange' | 'AdaptableStateChanged' | 'AdaptableStateReloaded' | 'CellChanged' | 'ChartChanged' | 'CheckboxColumnClicked' | 'CustomToolbarConfigured' | 'DashboardChanged' | 'DataImported' | 'DataSetSelected' | 'ColumnFilterApplied' | 'Fdc3Message' | 'RowChanged' | 'GridSorted' | 'LayoutChanged' | 'CalculatedColumnChanged' | 'LiveDataChanged' | 'ScheduleTriggered' | 'SearchChanged' | 'CellSelectionChanged' | 'RowSelectionChanged' | 'SystemStatusMessageDisplayed' | 'TeamSharingEntityChanged' | 'ThemeChanged' | 'GridFilterApplied' | 'CommentChanged', data?: any): Promise<any>;
343
355
  destroy(): void;
344
356
  }
@@ -0,0 +1,20 @@
1
+ import * as Redux from 'redux';
2
+ import { AdaptableState } from '../../AdaptableState/AdaptableState';
3
+ import { BaseContext } from '../../types';
4
+ /**
5
+ * Object returned by the `BeforeAdaptableStateChange` event, fired before the action is processed by the reducer
6
+ */
7
+ export interface BeforeAdaptableStateChangeInfo extends BaseContext {
8
+ /**
9
+ * Name of the Action about to be performed
10
+ */
11
+ actionName: string;
12
+ /**
13
+ * The Redux Action that is about to be invoked
14
+ */
15
+ action: Redux.Action;
16
+ /**
17
+ * Current Adaptable State (before the Action is applied)
18
+ */
19
+ state: AdaptableState;
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -17,6 +17,7 @@ export declare class EventInternalApi extends ApiBase {
17
17
  fireDataSetSelectedEvent(dataSet: DataSet): void;
18
18
  fireSystemStatusMessageDisplayedEvent(systemStatusMessageInfo: SystemStatusMessageInfo): void;
19
19
  fireDataImportedEvent(importData: any[], addedRows: IRowNode[], updatedRows: IRowNode[]): DataImportedInfo;
20
+ fireBeforeAdaptableStateChangeEvent(action: Redux.Action, state: AdaptableState): void;
20
21
  fireAdaptableStateChangedEvent(action: Redux.Action, oldState: AdaptableState, newState: AdaptableState): void;
21
22
  fireAdaptableStateReloadedEvent(oldState: AdaptablePersistentState, newState: AdaptablePersistentState): void;
22
23
  fireCalculatedColumnChangedEvent(trigger: string, calculatedColumn: CalculatedColumn): void;
@@ -129,6 +129,15 @@ export class EventInternalApi extends ApiBase {
129
129
  this.getEventApi().emit('DataImported', dataImportedInfo);
130
130
  return dataImportedInfo;
131
131
  }
132
+ fireBeforeAdaptableStateChangeEvent(action, state) {
133
+ const beforeAdaptableStateChangeInfo = {
134
+ actionName: action.type,
135
+ ...this.getAdaptableInternalApi().buildBaseContext(),
136
+ action: action,
137
+ state: state,
138
+ };
139
+ this.getEventApi().emitSync('BeforeAdaptableStateChange', beforeAdaptableStateChangeInfo);
140
+ }
132
141
  fireAdaptableStateChangedEvent(action, oldState, newState) {
133
142
  const adaptableStateChangedInfo = {
134
143
  actionName: action.type,
@@ -22,6 +22,7 @@ export declare class AdaptableStore implements IAdaptableStore {
22
22
  TheStore: Redux.Store<AdaptableState, Redux.Action>;
23
23
  Load: Promise<any>;
24
24
  private emitter;
25
+ private beforeEmitter;
25
26
  private storageEngine;
26
27
  private currentStorageState?;
27
28
  private previousStorageState?;
@@ -29,6 +30,7 @@ export declare class AdaptableStore implements IAdaptableStore {
29
30
  private loadStateOnStartup;
30
31
  on: (eventName: string, callback: EmitterCallback) => (() => void);
31
32
  onAny: (callback: EmitterAnyCallback) => (() => void);
33
+ onBeforeAny: (callback: EmitterAnyCallback) => (() => void);
32
34
  emit: (eventName: string, data: any) => Promise<any>;
33
35
  /**
34
36
  *
@@ -70,6 +70,7 @@ export class AdaptableStore {
70
70
  TheStore;
71
71
  Load;
72
72
  emitter;
73
+ beforeEmitter;
73
74
  storageEngine;
74
75
  currentStorageState;
75
76
  previousStorageState;
@@ -81,6 +82,9 @@ export class AdaptableStore {
81
82
  onAny = (callback) => {
82
83
  return this.emitter.onAny(callback);
83
84
  };
85
+ onBeforeAny = (callback) => {
86
+ return this.beforeEmitter.onAny(callback);
87
+ };
84
88
  emit = (eventName, data) => {
85
89
  return this.emitter.emit(eventName, data);
86
90
  };
@@ -149,6 +153,7 @@ export class AdaptableStore {
149
153
  };
150
154
  let storageEngine;
151
155
  this.emitter = new Emitter();
156
+ this.beforeEmitter = new Emitter();
152
157
  // If the user has remote storage set then we use Remote Engine, otherwise we use Local Enginge
153
158
  // not sure we can do this as we need to be backwardly compatible with existing users so need to stick with adaptable id (which should be unique)
154
159
  // const localStorageKey = 'adaptable-adaptable-state-' + adaptable.adaptableOptions.primaryKey;
@@ -204,6 +209,13 @@ export class AdaptableStore {
204
209
  }
205
210
  return finalState;
206
211
  };
212
+ const beforeEmitterMiddleware = (middlewareAPI) => (next) => (action) => {
213
+ this.beforeEmitter.emitSync(action.type, {
214
+ action,
215
+ state: middlewareAPI.getState(),
216
+ });
217
+ return next(action);
218
+ };
207
219
  const devToolsActionMarkerMiddleware = createDevToolsActionMarkerMiddleware(adaptable);
208
220
  const pluginsMiddleware = [];
209
221
  adaptable.forPlugins((plugin) => {
@@ -212,6 +224,7 @@ export class AdaptableStore {
212
224
  }
213
225
  });
214
226
  const middlewares = [
227
+ beforeEmitterMiddleware, // fires before anything else processes the action
215
228
  devToolsActionMarkerMiddleware,
216
229
  adaptableMiddleware(adaptable), // the main middleware that actually does stuff,
217
230
  ...pluginsMiddleware, // the plugins middleware
@@ -224,6 +237,8 @@ export class AdaptableStore {
224
237
  destroy() {
225
238
  this.emitter?.clearListeners();
226
239
  this.emitter = null;
240
+ this.beforeEmitter?.clearListeners();
241
+ this.beforeEmitter = null;
227
242
  }
228
243
  getCurrentStorageState() {
229
244
  return this.currentStorageState;
@@ -17,6 +17,7 @@ export interface IAdaptableStore {
17
17
  saveStateNow: (adaptable: IAdaptable) => Promise<any>;
18
18
  on: (eventName: string, callback: (data?: any) => any) => () => void;
19
19
  onAny: (callback: (eventName: string, data?: any) => any) => () => void;
20
+ onBeforeAny: (callback: (eventName: string, data?: any) => any) => () => void;
20
21
  emit: (eventName: string, data: any) => Promise<any>;
21
22
  destroy: () => void;
22
23
  }
@@ -957,6 +957,7 @@ export class AdaptableAgGrid {
957
957
  if (rowGroupDisplayType === 'single') {
958
958
  return true;
959
959
  }
960
+ // this is required because of AG Grid bug, see https://github.com/AdaptableTools/adaptable/issues/3212
960
961
  if (rowGroupDisplayType === 'multi') {
961
962
  const groupedColumnFilterConfig = this.api.layoutApi.internalApi.areAllGroupedColumnsFilterable();
962
963
  if (groupedColumnFilterConfig.floatingFilter) {
@@ -1612,6 +1613,12 @@ export class AdaptableAgGrid {
1612
1613
  const perfNewAdaptableStore = this.logger.beginPerf(`initAdaptableStore()`);
1613
1614
  const initAdaptableStoreMarker = getMarker(this.adaptableOptions.adaptableId).track.Init.label.InitStore.start();
1614
1615
  const adaptableStore = new AdaptableStore(this);
1616
+ adaptableStore.onBeforeAny((eventName, data) => {
1617
+ if (this.isReady) {
1618
+ this.api.eventApi.internalApi.fireBeforeAdaptableStateChangeEvent(data.action, data.state);
1619
+ }
1620
+ this.forPlugins((plugin) => plugin.onBeforeStoreEvent?.(eventName, data, this.adaptableStore));
1621
+ });
1615
1622
  adaptableStore.onAny((eventName, data) => {
1616
1623
  if (this.isReady) {
1617
1624
  this.api.eventApi.internalApi.fireAdaptableStateChangedEvent(data.action, data.state, data.newState);
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1772037233183 || Date.now(),
4
- VERSION: "22.0.1-canary.0" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1772179361165 || Date.now(),
4
+ VERSION: "22.0.1-canary.1" || '--current-version--',
5
5
  };
package/src/types.d.ts CHANGED
@@ -139,6 +139,7 @@ export type { ThemeChangedInfo } from './Api/Events/ThemeChanged';
139
139
  export type { DashboardChangedInfo } from './Api/Events/DashboardChanged';
140
140
  export type { ScheduleTriggeredInfo } from './Api/Events/ScheduleTriggered';
141
141
  export type { AdaptableStateChangedInfo } from './Api/Events/AdaptableStateChanged';
142
+ export type { BeforeAdaptableStateChangeInfo } from './Api/Events/BeforeAdaptableStateChange';
142
143
  export type { CommentChangedInfo } from './Api/Events/CommentChanged';
143
144
  export type { Fdc3MessageInfo, Fdc3MessageSentInfo, Fdc3MessageReceivedInfo, } from './Api/Events/Fdc3MessageInfo';
144
145
  export type { AdaptableState, AdaptablePersistentState, AdaptableTransientState, } from './AdaptableState/AdaptableState';