@adaptabletools/adaptable-cjs 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-cjs",
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;
@@ -42,6 +42,7 @@ class AdaptablePlugin {
42
42
  afterInit(ab) { }
43
43
  // hook executed after each layout update (Adaptable.setLayout())
44
44
  afterSetLayout(adaptable, layout) { }
45
+ onBeforeStoreEvent(eventName, data, adaptableStore) { }
45
46
  onStoreEvent(eventName, data, adaptableStore) { }
46
47
  onAdaptableReady(adaptable, adaptableOptions) { }
47
48
  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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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;
@@ -133,6 +133,15 @@ class EventInternalApi extends ApiBase_1.ApiBase {
133
133
  this.getEventApi().emit('DataImported', dataImportedInfo);
134
134
  return dataImportedInfo;
135
135
  }
136
+ fireBeforeAdaptableStateChangeEvent(action, state) {
137
+ const beforeAdaptableStateChangeInfo = {
138
+ actionName: action.type,
139
+ ...this.getAdaptableInternalApi().buildBaseContext(),
140
+ action: action,
141
+ state: state,
142
+ };
143
+ this.getEventApi().emitSync('BeforeAdaptableStateChange', beforeAdaptableStateChangeInfo);
144
+ }
136
145
  fireAdaptableStateChangedEvent(action, oldState, newState) {
137
146
  const adaptableStateChangedInfo = {
138
147
  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
  *
@@ -76,6 +76,7 @@ class AdaptableStore {
76
76
  TheStore;
77
77
  Load;
78
78
  emitter;
79
+ beforeEmitter;
79
80
  storageEngine;
80
81
  currentStorageState;
81
82
  previousStorageState;
@@ -87,6 +88,9 @@ class AdaptableStore {
87
88
  onAny = (callback) => {
88
89
  return this.emitter.onAny(callback);
89
90
  };
91
+ onBeforeAny = (callback) => {
92
+ return this.beforeEmitter.onAny(callback);
93
+ };
90
94
  emit = (eventName, data) => {
91
95
  return this.emitter.emit(eventName, data);
92
96
  };
@@ -155,6 +159,7 @@ class AdaptableStore {
155
159
  };
156
160
  let storageEngine;
157
161
  this.emitter = new Emitter_1.default();
162
+ this.beforeEmitter = new Emitter_1.default();
158
163
  // If the user has remote storage set then we use Remote Engine, otherwise we use Local Enginge
159
164
  // 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)
160
165
  // const localStorageKey = 'adaptable-adaptable-state-' + adaptable.adaptableOptions.primaryKey;
@@ -210,6 +215,13 @@ class AdaptableStore {
210
215
  }
211
216
  return finalState;
212
217
  };
218
+ const beforeEmitterMiddleware = (middlewareAPI) => (next) => (action) => {
219
+ this.beforeEmitter.emitSync(action.type, {
220
+ action,
221
+ state: middlewareAPI.getState(),
222
+ });
223
+ return next(action);
224
+ };
213
225
  const devToolsActionMarkerMiddleware = createDevToolsActionMarkerMiddleware(adaptable);
214
226
  const pluginsMiddleware = [];
215
227
  adaptable.forPlugins((plugin) => {
@@ -218,6 +230,7 @@ class AdaptableStore {
218
230
  }
219
231
  });
220
232
  const middlewares = [
233
+ beforeEmitterMiddleware, // fires before anything else processes the action
221
234
  devToolsActionMarkerMiddleware,
222
235
  adaptableMiddleware(adaptable), // the main middleware that actually does stuff,
223
236
  ...pluginsMiddleware, // the plugins middleware
@@ -230,6 +243,8 @@ class AdaptableStore {
230
243
  destroy() {
231
244
  this.emitter?.clearListeners();
232
245
  this.emitter = null;
246
+ this.beforeEmitter?.clearListeners();
247
+ this.beforeEmitter = null;
233
248
  }
234
249
  getCurrentStorageState() {
235
250
  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
  }
@@ -961,6 +961,7 @@ class AdaptableAgGrid {
961
961
  if (rowGroupDisplayType === 'single') {
962
962
  return true;
963
963
  }
964
+ // this is required because of AG Grid bug, see https://github.com/AdaptableTools/adaptable/issues/3212
964
965
  if (rowGroupDisplayType === 'multi') {
965
966
  const groupedColumnFilterConfig = this.api.layoutApi.internalApi.areAllGroupedColumnsFilterable();
966
967
  if (groupedColumnFilterConfig.floatingFilter) {
@@ -1616,6 +1617,12 @@ class AdaptableAgGrid {
1616
1617
  const perfNewAdaptableStore = this.logger.beginPerf(`initAdaptableStore()`);
1617
1618
  const initAdaptableStoreMarker = (0, devTools_1.getMarker)(this.adaptableOptions.adaptableId).track.Init.label.InitStore.start();
1618
1619
  const adaptableStore = new AdaptableStore_1.AdaptableStore(this);
1620
+ adaptableStore.onBeforeAny((eventName, data) => {
1621
+ if (this.isReady) {
1622
+ this.api.eventApi.internalApi.fireBeforeAdaptableStateChangeEvent(data.action, data.state);
1623
+ }
1624
+ this.forPlugins((plugin) => plugin.onBeforeStoreEvent?.(eventName, data, this.adaptableStore));
1625
+ });
1619
1626
  adaptableStore.onAny((eventName, data) => {
1620
1627
  if (this.isReady) {
1621
1628
  this.api.eventApi.internalApi.fireAdaptableStateChangedEvent(data.action, data.state, data.newState);
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  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" || '',
5
- PUBLISH_TIMESTAMP: 1772037269052 || Date.now(),
6
- VERSION: "22.0.1-canary.0" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1772179397651 || Date.now(),
6
+ VERSION: "22.0.1-canary.1" || '--current-version--',
7
7
  };
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';