@adaptabletools/adaptable-cjs 18.0.0-canary.6 → 18.0.0-canary.8

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": "18.0.0-canary.6",
3
+ "version": "18.0.0-canary.8",
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",
@@ -61,7 +61,7 @@
61
61
  "tinycolor2": "^1.4.2",
62
62
  "tslib": "^2.3.0",
63
63
  "uuid": "^3.3.2",
64
- "react-toastify": "10.0.1"
64
+ "react-toastify": "9.1.3"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "ag-grid-community": ">=31.1.0"
@@ -26,17 +26,19 @@ var LicenseValidityType;
26
26
  const SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
27
27
  const SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
28
28
  const DEMO_REGEX = /(https):\/\/\S+(\.adaptabletools\.com)/g;
29
- const origin = typeof window !== 'undefined' ? window.location.origin : '';
29
+ const getOrigin = () => {
30
+ return typeof window !== 'undefined' ? window.location.origin : '';
31
+ };
30
32
  const isInsideSandpack = () => {
31
- const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(origin) || []);
33
+ const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(getOrigin()) || []);
32
34
  return protocol === 'https' && sandpackUrl === 'sandpack.codesandbox.io';
33
35
  };
34
36
  const isInsideSandbox = () => {
35
- const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
37
+ const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(getOrigin()) || []);
36
38
  return protocol === 'https' && sandboxUrl === '.csb.app';
37
39
  };
38
40
  const isDemoApp = () => {
39
- const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(origin) || []);
41
+ const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(getOrigin()) || []);
40
42
  return protocol === 'https' && demoAppUrl === '.adaptabletools.com';
41
43
  };
42
44
  class LicenseService {
@@ -35,7 +35,7 @@ class AdaptableView extends React.Component {
35
35
  , {
36
36
  // we NEEEEED!!!! this containerId, otherwise, toastify will have memory leaks when the adaptable
37
37
  // instance is destroyed and re-created many times
38
- containerId: adaptableOptions.adaptableId, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
38
+ containerId: `Toastify-${adaptableOptions.adaptableId}`, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
39
39
  (watermark === null || watermark === void 0 ? void 0 : watermark.show) && React.createElement(License_1.LicenseWatermark, null, watermark === null || watermark === void 0 ? void 0 : watermark.text),
40
40
  React.createElement(WindowPopups_1.WindowPopups, null),
41
41
  React.createElement(FormPopups_1.FormPopups, null),
@@ -16,7 +16,7 @@ const showToast = (props) => {
16
16
  });
17
17
  const adaptableOptions = props.api.optionsApi.getAdaptableOptions();
18
18
  const toastProps = ObjectFactory_1.default.CreateToastOptions(adaptableOptions.notificationsOptions, {
19
- containerId: adaptableOptions.adaptableId,
19
+ containerId: `Toastify-${adaptableOptions.adaptableId}`,
20
20
  onClose: () => {
21
21
  off();
22
22
  },
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataChangeHistoryGrid = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
- const AdaptableContext_1 = require("../AdaptableContext");
7
6
  const react_1 = require("react");
7
+ const AdaptableContext_1 = require("../AdaptableContext");
8
8
  const usePrevious_1 = tslib_1.__importDefault(require("../../components/utils/usePrevious"));
9
9
  const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
10
10
  const buildActionColumnButton_1 = require("./buildActionColumnButton");
11
+ const AdaptableAgGrid_1 = require("../../agGrid/AdaptableAgGrid");
11
12
  const DataChangeHistoryGrid = (props) => {
12
13
  const { changeHistoryLog, adaptableContainerId, agGridContainerId, onUndoChange, onClearRow } = props;
13
14
  const mainAdaptableInstance = (0, AdaptableContext_1.useAdaptable)();
@@ -24,13 +25,12 @@ const DataChangeHistoryGrid = (props) => {
24
25
  const gridOptions = buildGridOptions(mainAdaptableInstance, changeHistoryLog);
25
26
  const adaptableOptions = buildAdaptableOptions(mainAdaptableInstance, gridOptions, adaptableContainerId, agGridContainerId, undoChangeEnabled, onUndoChange, onClearRow);
26
27
  const modules = mainAdaptableInstance.getAgGridRegisteredModules();
27
- const agGridConfig = {
28
+ const dataChangeHistoryAdaptableApi = await AdaptableAgGrid_1.AdaptableAgGrid._initInternal({
29
+ variant: 'vanilla',
30
+ adaptableOptions,
28
31
  gridOptions,
29
- modules: modules,
30
- };
31
- // to avoid direct dependency to Adaptable.ts and thus creating a circular dependency;
32
- const adaptableInitFn = Object.getPrototypeOf(mainAdaptableInstance).constructor.init;
33
- const dataChangeHistoryAdaptableApi = await adaptableInitFn(adaptableOptions, agGridConfig);
32
+ modules,
33
+ });
34
34
  setAdaptableApi(dataChangeHistoryAdaptableApi);
35
35
  };
36
36
  initializeAdaptableGrid();
@@ -98,7 +98,7 @@ const TransposedPopup = (props) => {
98
98
  },
99
99
  layoutOptions: {
100
100
  createDefaultLayout: false,
101
- autoSizeColumnsInLayout: false,
101
+ autoSizeColumnsInLayout: true,
102
102
  },
103
103
  predefinedConfig: {
104
104
  Layout: {
@@ -9,7 +9,7 @@ const renderWithAdaptableContext_1 = require("../View/renderWithAdaptableContext
9
9
  const ActionButtons = (props) => {
10
10
  const { buttons, adaptableApi, context, rerender } = props;
11
11
  return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
12
- var _a, _b;
12
+ var _a, _b, _c, _d, _e, _f;
13
13
  if (button.hidden && button.hidden(button, context)) {
14
14
  return;
15
15
  }
@@ -31,7 +31,8 @@ const ActionButtons = (props) => {
31
31
  }, 16);
32
32
  };
33
33
  const disabled = button.disabled && button.disabled(button, context);
34
- return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${index + 1}`, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, tone: (_b = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _b !== void 0 ? _b : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' }, buttonLabel));
34
+ const identifier = (_d = (_c = (_a = button.label) !== null && _a !== void 0 ? _a : (_b = button.icon) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : button.tooltip) !== null && _d !== void 0 ? _d : `${index + 1}`;
35
+ return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${identifier}`, variant: (_e = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _e !== void 0 ? _e : 'text', disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, tone: (_f = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _f !== void 0 ? _f : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' }, buttonLabel));
35
36
  })));
36
37
  };
37
38
  const ReactActionColumnRenderer = (props) => {
@@ -27,7 +27,7 @@ import { AgGridOptionsService } from './AgGridOptionsService';
27
27
  import { AgGridColumnAdapter } from './AgGridColumnAdapter';
28
28
  import { RowEditService } from '../Utilities/Services/RowEditService';
29
29
  export type AdaptableVariant = 'vanilla' | 'react' | 'angular';
30
- export type AdaptableLifecycleState = 'initial' | 'preprocessOptions' | 'initAdaptableState' | 'setupAgGrid' | 'initAgGrid' | 'ready' | 'ready' | 'preDestroyed';
30
+ export type AdaptableLifecycleState = 'initial' | 'preprocessOptions' | 'initAdaptableState' | 'setupAgGrid' | 'initAgGrid' | 'available' | 'ready' | 'preDestroyed';
31
31
  type RenderAgGridFrameworkComponentResult = false | GridApi;
32
32
  interface AdaptableInitInternalConfig<TData = any> {
33
33
  variant: AdaptableVariant;
@@ -115,6 +115,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
115
115
  private static collectInstance;
116
116
  private static dismissInstance;
117
117
  get isReady(): boolean;
118
+ get isAvailable(): boolean;
118
119
  get isDestroyed(): boolean;
119
120
  _emit: (eventName: string, data?: any) => Promise<any>;
120
121
  _emitSync: (eventName: string, data?: any) => any;
@@ -125,9 +126,9 @@ export declare class AdaptableAgGrid implements IAdaptable {
125
126
  * @private
126
127
  */
127
128
  static _initInternal(config: AdaptableInitInternalConfig): Promise<AdaptableApi>;
129
+ private _initAdaptableAgGrid;
128
130
  private normaliseLayoutState;
129
131
  private normaliseToolPanelState;
130
- private _initAdaptableAgGrid;
131
132
  applyColumnFiltering(): void;
132
133
  applyGridFiltering(): void;
133
134
  private refreshColDefs;
@@ -195,6 +195,9 @@ class AdaptableAgGrid {
195
195
  get isReady() {
196
196
  return this.lifecycleState === 'ready';
197
197
  }
198
+ get isAvailable() {
199
+ return this.lifecycleState === 'available' || this.lifecycleState === 'ready';
200
+ }
198
201
  get isDestroyed() {
199
202
  return this.lifecycleState === 'preDestroyed';
200
203
  }
@@ -246,73 +249,6 @@ class AdaptableAgGrid {
246
249
  return doInit(adaptableInstance);
247
250
  }
248
251
  }
249
- normaliseLayoutState(state, config) {
250
- var _a, _b, _c;
251
- if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
252
- const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
253
- const layoutState = state.Layout || {};
254
- const availableLayouts = layoutState.Layouts || [];
255
- availableLayouts.push(defaultLayout);
256
- layoutState.Layouts = availableLayouts;
257
- layoutState.CurrentLayout = defaultLayout.Name;
258
- state.Layout = layoutState;
259
- }
260
- else {
261
- const layoutState = state.Layout;
262
- // ensure CurrentLayout is valid
263
- if (!layoutState.CurrentLayout ||
264
- !layoutState.Layouts.find((l) => l.Name === layoutState.CurrentLayout)) {
265
- layoutState.CurrentLayout = (_b = (_a = layoutState.Layouts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Name;
266
- }
267
- }
268
- // for the initial state, we need to dynamically add the ActionRowColumn (if necessary)
269
- // for subsequent layout changes, the `Adaptable.setLayout()` method handles this
270
- // this is a serious code smell, hopefully we will delete `setLayout()` at some point
271
- const actionRowColDefs = this.api.actionRowApi.internalApi.getColDefsForActionRowColumns();
272
- actionRowColDefs.forEach((actionRowColDef) => {
273
- const currentLayout = state.Layout.Layouts.find((l) => l.Name === state.Layout.CurrentLayout);
274
- if (currentLayout && !currentLayout.Columns.includes(actionRowColDef.colId)) {
275
- currentLayout.Columns.push(actionRowColDef.colId);
276
- currentLayout.PinnedColumnsMap = currentLayout.PinnedColumnsMap || {};
277
- currentLayout.PinnedColumnsMap[actionRowColDef.colId] = actionRowColDef.pinned;
278
- }
279
- });
280
- /**
281
- * Viewport mode does not support a few
282
- * features instead of complicating the
283
- * logic where layout is applied, it is easier and
284
- * less error prone to just remove it.
285
- */
286
- if (config.gridOptions.rowModelType === 'viewport') {
287
- (_c = state.Layout.Layouts) === null || _c === void 0 ? void 0 : _c.forEach((layout) => {
288
- if (layout.RowGroupedColumns) {
289
- delete layout.RowGroupedColumns;
290
- }
291
- if (layout.AggregationColumns) {
292
- delete layout.AggregationColumns;
293
- }
294
- if (layout.PivotColumns) {
295
- delete layout.PivotColumns;
296
- delete layout.EnablePivot;
297
- }
298
- });
299
- }
300
- return state;
301
- }
302
- normaliseToolPanelState(state) {
303
- var _a, _b, _c;
304
- if ((_a = state === null || state === void 0 ? void 0 : state.ToolPanel) === null || _a === void 0 ? void 0 : _a.ToolPanels) {
305
- return state;
306
- }
307
- // no predefined config provided, we will display all the panels collapsed (custom & module)
308
- const defaultToolPanels = [];
309
- (_c = (_b = this.adaptableOptions.toolPanelOptions) === null || _b === void 0 ? void 0 : _b.customToolPanels) === null || _c === void 0 ? void 0 : _c.forEach((customToolPanel) => defaultToolPanels.push({ Name: customToolPanel.name }));
310
- Types_1.ALL_TOOL_PANELS.forEach((moduleToolPanel) => defaultToolPanels.push({ Name: moduleToolPanel }));
311
- const toolPanelState = state.ToolPanel || {};
312
- toolPanelState.ToolPanels = defaultToolPanels;
313
- state.ToolPanel = toolPanelState;
314
- return state;
315
- }
316
252
  async _initAdaptableAgGrid(config) {
317
253
  var _a, _b;
318
254
  // Phase 1: Preprocess Adaptable Options
@@ -387,6 +323,8 @@ class AdaptableAgGrid {
387
323
  }
388
324
  this.forPlugins((plugin) => plugin.afterInitServices(this));
389
325
  this.forPlugins((plugin) => plugin.afterInitModules(this, this.adaptableModules));
326
+ // do this now so it sets module entitlements
327
+ this.EntitlementService.setModulesEntitlements();
390
328
  /**
391
329
  * At this point it's mandatory to have the ALL the Adaptable blocks initialized:
392
330
  * Store, APIs, Services, Modules
@@ -413,7 +351,10 @@ class AdaptableAgGrid {
413
351
  /**
414
352
  * At this point AG Grid is initialized!
415
353
  */
416
- this.updateColumnModelAndRefreshGrid();
354
+ this.deriveAdaptableColumnStateFromAgGrid();
355
+ this.agGridColumnAdapter.setupColumns();
356
+ // we need this because we need the internal Column state to be ready before doing any extra business logic
357
+ this.lifecycleState = 'available';
417
358
  this.api.themeApi.applyCurrentTheme();
418
359
  this.validatePrimaryKey();
419
360
  this.embedColumnMenu = this.agGridAdapter.isModulePresent(core_1.ModuleNames.MenuModule);
@@ -423,8 +364,8 @@ class AdaptableAgGrid {
423
364
  this.applyColumnFiltering();
424
365
  this.addGridEventListeners();
425
366
  this.temporaryAdaptableStateUpdates();
426
- // do this now so it sets module entitlements
427
- this.EntitlementService.setModulesEntitlements();
367
+ this.redrawBody();
368
+ this.refreshHeader();
428
369
  // create the module menu (for use in the dashboard and the toolpanel)
429
370
  // TODO see #create-create-module-menu - make sure it's the same here and there
430
371
  this.ModuleService.createModuleMenus();
@@ -445,6 +386,75 @@ class AdaptableAgGrid {
445
386
  perfInitAdaptableAgGrid.end();
446
387
  return Promise.resolve(this.api);
447
388
  }
389
+ normaliseLayoutState(state, config) {
390
+ var _a, _b, _c, _d, _e, _f;
391
+ if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
392
+ const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
393
+ const layoutState = state.Layout || {};
394
+ const availableLayouts = layoutState.Layouts || [];
395
+ availableLayouts.push(defaultLayout);
396
+ layoutState.Layouts = availableLayouts;
397
+ layoutState.CurrentLayout = defaultLayout.Name;
398
+ state.Layout = layoutState;
399
+ }
400
+ else {
401
+ const layoutState = state.Layout;
402
+ // ensure CurrentLayout is valid
403
+ if (!layoutState.CurrentLayout ||
404
+ !layoutState.Layouts.find((l) => l.Name === layoutState.CurrentLayout)) {
405
+ layoutState.CurrentLayout = (_b = (_a = layoutState.Layouts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Name;
406
+ }
407
+ }
408
+ // for the initial state, we need to dynamically add the ActionRowColumn (if necessary)
409
+ // for subsequent layout changes, the `Adaptable.setLayout()` method handles this
410
+ // this is a serious code smell, hopefully we will delete `setLayout()` at some point
411
+ const hasActionRowButtons = !!((_c = this.adaptableOptions.actionRowOptions) === null || _c === void 0 ? void 0 : _c.actionRowButtons);
412
+ if (hasActionRowButtons) {
413
+ const currentLayout = state.Layout.Layouts.find((l) => l.Name === state.Layout.CurrentLayout);
414
+ if (currentLayout && !currentLayout.Columns.includes(GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS)) {
415
+ currentLayout.Columns.push(GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS);
416
+ const columnPosition = (_e = (_d = this.adaptableOptions.actionRowOptions) === null || _d === void 0 ? void 0 : _d.actionRowButtonOptions) === null || _e === void 0 ? void 0 : _e.position;
417
+ currentLayout.PinnedColumnsMap = currentLayout.PinnedColumnsMap || {};
418
+ currentLayout.PinnedColumnsMap[GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS] =
419
+ columnPosition === 'pinnedRight' ? 'right' : 'left';
420
+ }
421
+ }
422
+ /**
423
+ * Viewport mode does not support a few
424
+ * features instead of complicating the
425
+ * logic where layout is applied, it is easier and
426
+ * less error prone to just remove it.
427
+ */
428
+ if (config.gridOptions.rowModelType === 'viewport') {
429
+ (_f = state.Layout.Layouts) === null || _f === void 0 ? void 0 : _f.forEach((layout) => {
430
+ if (layout.RowGroupedColumns) {
431
+ delete layout.RowGroupedColumns;
432
+ }
433
+ if (layout.AggregationColumns) {
434
+ delete layout.AggregationColumns;
435
+ }
436
+ if (layout.PivotColumns) {
437
+ delete layout.PivotColumns;
438
+ delete layout.EnablePivot;
439
+ }
440
+ });
441
+ }
442
+ return state;
443
+ }
444
+ normaliseToolPanelState(state) {
445
+ var _a, _b, _c;
446
+ if ((_a = state === null || state === void 0 ? void 0 : state.ToolPanel) === null || _a === void 0 ? void 0 : _a.ToolPanels) {
447
+ return state;
448
+ }
449
+ // no predefined config provided, we will display all the panels collapsed (custom & module)
450
+ const defaultToolPanels = [];
451
+ (_c = (_b = this.adaptableOptions.toolPanelOptions) === null || _b === void 0 ? void 0 : _b.customToolPanels) === null || _c === void 0 ? void 0 : _c.forEach((customToolPanel) => defaultToolPanels.push({ Name: customToolPanel.name }));
452
+ Types_1.ALL_TOOL_PANELS.forEach((moduleToolPanel) => defaultToolPanels.push({ Name: moduleToolPanel }));
453
+ const toolPanelState = state.ToolPanel || {};
454
+ toolPanelState.ToolPanels = defaultToolPanels;
455
+ state.ToolPanel = toolPanelState;
456
+ return state;
457
+ }
448
458
  applyColumnFiltering() {
449
459
  if (this.api.columnFilterApi.isQuickFilterAvailable()) {
450
460
  if (this.api.columnFilterApi.isQuickFilterVisible()) {
@@ -592,7 +602,7 @@ class AdaptableAgGrid {
592
602
  */
593
603
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'isExternalFilterPresent', (original_isExternalFilterPresent) => {
594
604
  return (params) => {
595
- if (this.isDestroyed) {
605
+ if (!this.isAvailable) {
596
606
  return true;
597
607
  }
598
608
  const columnFilters = this.api.columnFilterApi.getActiveColumnFilters();
@@ -609,7 +619,7 @@ class AdaptableAgGrid {
609
619
  */
610
620
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'doesExternalFilterPass', (original_doesExternalFilterPass) => {
611
621
  return (node) => {
612
- if (this.isDestroyed) {
622
+ if (!this.isAvailable) {
613
623
  return true;
614
624
  }
615
625
  // first we assess a Grid Filter (if its running locally)
@@ -920,7 +930,8 @@ class AdaptableAgGrid {
920
930
  const gridRoot = agGridApi.ctrlsService.gridBodyCtrl.eGridBody;
921
931
  const gridContainer = gridRoot === null || gridRoot === void 0 ? void 0 : gridRoot.closest('[class*="ag-theme"]');
922
932
  if (!gridContainer) {
923
- this.logger.consoleError('No AG Grid container element found in the DOM. Please provide a valid container element in `ContainerOptions.agGridContainer`');
933
+ this.logger.consoleError(`No AG Grid container could be derived from the Adaptable framework wrapper.
934
+ Please contact AdapTable Support and in the meantime provide a valid container element in 'ContainerOptions.agGridContainer'!`);
924
935
  }
925
936
  this.DANGER_USE_GETTER_agGridContainerElement = gridContainer;
926
937
  }
@@ -7,6 +7,7 @@ import { ColGroupDef } from '@ag-grid-community/core/dist/esm/es6/entities/colDe
7
7
  export declare class AgGridAdapter {
8
8
  private adaptableInstance;
9
9
  private DANGER_USE_GETTER_gridApi;
10
+ private DANGER_gridApi_from_args;
10
11
  initialGridOptions: GridOptions;
11
12
  constructor(adaptableInstance: AdaptableAgGrid);
12
13
  private get adaptableOptions();
@@ -15,6 +16,12 @@ export declare class AgGridAdapter {
15
16
  destroy(): void;
16
17
  setAgGridApi(gridApi: GridApi): void;
17
18
  getAgGridApi(skipLogging?: boolean): GridApi | undefined;
19
+ /**
20
+ * When AG Grid is rendered the first time, the AG GridApi is not yet set in the Adaptable context (as it's set only AFTER the grid is fully initialised)
21
+ * yet we need it when evaluating custom GridOptions properties on the first render.
22
+ * to handle this edge case, we try to extract the AG GridApi from the invocation arguments
23
+ */
24
+ grabAgGridApiOnTheFly(args: unknown): void;
18
25
  getLiveGridOptions(): GridOptions | undefined;
19
26
  updateGridOptions(options: ManagedGridOptions): void;
20
27
  setGridOption<Key extends ManagedGridOptionKey>(key: Key, value: GridOptions[Key]): void;
@@ -30,10 +30,30 @@ class AgGridAdapter {
30
30
  if (this.DANGER_USE_GETTER_gridApi) {
31
31
  return this.DANGER_USE_GETTER_gridApi;
32
32
  }
33
+ if (this.DANGER_gridApi_from_args) {
34
+ return this.DANGER_gridApi_from_args;
35
+ }
33
36
  if (!skipLogging) {
34
37
  console.error('AgGridApi is not available yet');
35
38
  }
36
39
  }
40
+ /**
41
+ * When AG Grid is rendered the first time, the AG GridApi is not yet set in the Adaptable context (as it's set only AFTER the grid is fully initialised)
42
+ * yet we need it when evaluating custom GridOptions properties on the first render.
43
+ * to handle this edge case, we try to extract the AG GridApi from the invocation arguments
44
+ */
45
+ grabAgGridApiOnTheFly(args) {
46
+ var _a, _b;
47
+ if (this.DANGER_USE_GETTER_gridApi) {
48
+ return;
49
+ }
50
+ if (Array.isArray(args) &&
51
+ typeof ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.api) === 'object' &&
52
+ ((_b = args[0]) === null || _b === void 0 ? void 0 : _b.api) instanceof core_1.GridApi) {
53
+ this.DANGER_gridApi_from_args = args[0].api;
54
+ }
55
+ }
56
+ // TODO AFL check if this is still needed if GridAPI offers the `getOption` method
37
57
  // do NOT ever mutate the returned object!!
38
58
  getLiveGridOptions() {
39
59
  var _a, _b;
@@ -8,4 +8,5 @@ export declare class AgGridOptionsService {
8
8
  destroy(): void;
9
9
  setGridOptionsProperty<T extends keyof GridOptions>(gridOptions: GridOptions, propertyName: T, propertyGetter: (userPropertyValue: GridOptions[T]) => GridOptions[T] | undefined): GridOptions;
10
10
  revertGridOptionsPropertiesToUserValue<T extends keyof GridOptions>(gridOptions: GridOptions, propertyNames: T[]): void;
11
+ private get agGridAdapter();
11
12
  }
@@ -33,6 +33,7 @@ class AgGridOptionsService {
33
33
  if (this.adaptableInstance.isDestroyed) {
34
34
  return;
35
35
  }
36
+ this.agGridAdapter.grabAgGridApiOnTheFly(args);
36
37
  return previousValue(...args);
37
38
  };
38
39
  }
@@ -50,5 +51,8 @@ class AgGridOptionsService {
50
51
  gridOptions[propertyName] = userValue;
51
52
  }
52
53
  }
54
+ get agGridAdapter() {
55
+ return this.adaptableInstance.agGridAdapter;
56
+ }
53
57
  }
54
58
  exports.AgGridOptionsService = AgGridOptionsService;
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  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: 1710607851386 || Date.now(),
6
- VERSION: "18.0.0-canary.6" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1710788450625 || Date.now(),
6
+ VERSION: "18.0.0-canary.8" || '--current-version--',
7
7
  };
@@ -5299,6 +5299,33 @@ export declare const ADAPTABLE_METAMODEL: {
5299
5299
  ref: string;
5300
5300
  }[];
5301
5301
  };
5302
+ UpgradeConfig: {
5303
+ name: string;
5304
+ kind: string;
5305
+ desc: string;
5306
+ props: ({
5307
+ name: string;
5308
+ kind: string;
5309
+ desc: string;
5310
+ isOpt?: undefined;
5311
+ defVal?: undefined;
5312
+ ref?: undefined;
5313
+ } | {
5314
+ name: string;
5315
+ kind: string;
5316
+ desc: string;
5317
+ isOpt: boolean;
5318
+ defVal: string;
5319
+ ref: string;
5320
+ } | {
5321
+ name: string;
5322
+ kind: string;
5323
+ desc: string;
5324
+ isOpt: boolean;
5325
+ defVal: string;
5326
+ ref?: undefined;
5327
+ })[];
5328
+ };
5302
5329
  UserColumnMenuItem: {
5303
5330
  name: string;
5304
5331
  kind: string;
@@ -4412,6 +4412,12 @@ exports.ADAPTABLE_METAMODEL = {
4412
4412
  "desc": "Callback function invoked when a batch successfully updates",
4413
4413
  "isOpt": true
4414
4414
  },
4415
+ {
4416
+ "name": "flushAsync",
4417
+ "kind": "b",
4418
+ "desc": "Whether to flush async updates.",
4419
+ "isOpt": true
4420
+ },
4415
4421
  {
4416
4422
  "name": "runAsync",
4417
4423
  "kind": "b",
@@ -8975,6 +8981,33 @@ exports.ADAPTABLE_METAMODEL = {
8975
8981
  }
8976
8982
  ]
8977
8983
  },
8984
+ "UpgradeConfig": {
8985
+ "name": "UpgradeConfig",
8986
+ "kind": "I",
8987
+ "desc": "The upgrade config object",
8988
+ "props": [
8989
+ {
8990
+ "name": "fromVersion",
8991
+ "kind": "n",
8992
+ "desc": "The version to upgrade from"
8993
+ },
8994
+ {
8995
+ "name": "logger",
8996
+ "kind": "R",
8997
+ "desc": "The logger object",
8998
+ "isOpt": true,
8999
+ "defVal": "The console object",
9000
+ "ref": "unknown"
9001
+ },
9002
+ {
9003
+ "name": "toVersion",
9004
+ "kind": "n",
9005
+ "desc": "The version to upgrade to",
9006
+ "isOpt": true,
9007
+ "defVal": "The current version"
9008
+ }
9009
+ ]
9010
+ },
8978
9011
  "UserColumnMenuItem": {
8979
9012
  "name": "UserColumnMenuItem",
8980
9013
  "kind": "I",
@@ -9157,6 +9190,27 @@ exports.ADAPTABLE_METAMODEL = {
9157
9190
  "desc": "Custom column values for Values Column Filter and Grid Filter Builder",
9158
9191
  "isOpt": true
9159
9192
  },
9193
+ {
9194
+ "name": "loadingScreenDelay",
9195
+ "kind": "n",
9196
+ "desc": "Delay in milliseconds before Loading Screen appears. `showLoadingScreen` must be true for this to take effect",
9197
+ "isOpt": true,
9198
+ "defVal": "200"
9199
+ },
9200
+ {
9201
+ "name": "loadingScreenText",
9202
+ "kind": "s",
9203
+ "desc": "Text to display in Loading Screen.",
9204
+ "isOpt": true,
9205
+ "defVal": "&#39;Retrieving your settings and setting up the grid...&#39;"
9206
+ },
9207
+ {
9208
+ "name": "loadingScreenTitle",
9209
+ "kind": "s",
9210
+ "desc": "Title to display in Loading Screen.",
9211
+ "isOpt": true,
9212
+ "defVal": "&#39;Initialising Grid&#39;"
9213
+ },
9160
9214
  {
9161
9215
  "name": "objectTags",
9162
9216
  "kind": "u",