@adaptabletools/adaptable 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",
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",
@@ -60,7 +60,7 @@
60
60
  "tinycolor2": "^1.4.2",
61
61
  "tslib": "^2.3.0",
62
62
  "uuid": "^3.3.2",
63
- "react-toastify": "10.0.1"
63
+ "react-toastify": "9.1.3"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@ag-grid-community/core": ">=31.1.0"
@@ -22,17 +22,19 @@ export var LicenseValidityType;
22
22
  const SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
23
23
  const SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
24
24
  const DEMO_REGEX = /(https):\/\/\S+(\.adaptabletools\.com)/g;
25
- const origin = typeof window !== 'undefined' ? window.location.origin : '';
25
+ const getOrigin = () => {
26
+ return typeof window !== 'undefined' ? window.location.origin : '';
27
+ };
26
28
  const isInsideSandpack = () => {
27
- const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(origin) || []);
29
+ const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(getOrigin()) || []);
28
30
  return protocol === 'https' && sandpackUrl === 'sandpack.codesandbox.io';
29
31
  };
30
32
  const isInsideSandbox = () => {
31
- const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
33
+ const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(getOrigin()) || []);
32
34
  return protocol === 'https' && sandboxUrl === '.csb.app';
33
35
  };
34
36
  const isDemoApp = () => {
35
- const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(origin) || []);
37
+ const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(getOrigin()) || []);
36
38
  return protocol === 'https' && demoAppUrl === '.adaptabletools.com';
37
39
  };
38
40
  export class LicenseService {
@@ -31,7 +31,7 @@ class AdaptableView extends React.Component {
31
31
  , {
32
32
  // we NEEEEED!!!! this containerId, otherwise, toastify will have memory leaks when the adaptable
33
33
  // instance is destroyed and re-created many times
34
- containerId: adaptableOptions.adaptableId, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
34
+ containerId: `Toastify-${adaptableOptions.adaptableId}`, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
35
35
  (watermark === null || watermark === void 0 ? void 0 : watermark.show) && React.createElement(LicenseWatermark, null, watermark === null || watermark === void 0 ? void 0 : watermark.text),
36
36
  React.createElement(WindowPopups, null),
37
37
  React.createElement(FormPopups, null),
@@ -12,7 +12,7 @@ export const showToast = (props) => {
12
12
  });
13
13
  const adaptableOptions = props.api.optionsApi.getAdaptableOptions();
14
14
  const toastProps = ObjectFactory.CreateToastOptions(adaptableOptions.notificationsOptions, {
15
- containerId: adaptableOptions.adaptableId,
15
+ containerId: `Toastify-${adaptableOptions.adaptableId}`,
16
16
  onClose: () => {
17
17
  off();
18
18
  },
@@ -1,9 +1,10 @@
1
1
  import * as React from 'react';
2
- import { useAdaptable } from '../AdaptableContext';
3
2
  import { useEffect, useRef, useState } from 'react';
3
+ import { useAdaptable } from '../AdaptableContext';
4
4
  import usePrevious from '../../components/utils/usePrevious';
5
5
  import { DataChangeHistoryModuleId } from '../../Utilities/Constants/ModuleConstants';
6
6
  import { buildActionColumnButton } from './buildActionColumnButton';
7
+ import { AdaptableAgGrid } from '../../agGrid/AdaptableAgGrid';
7
8
  export const DataChangeHistoryGrid = (props) => {
8
9
  const { changeHistoryLog, adaptableContainerId, agGridContainerId, onUndoChange, onClearRow } = props;
9
10
  const mainAdaptableInstance = useAdaptable();
@@ -20,13 +21,12 @@ export const DataChangeHistoryGrid = (props) => {
20
21
  const gridOptions = buildGridOptions(mainAdaptableInstance, changeHistoryLog);
21
22
  const adaptableOptions = buildAdaptableOptions(mainAdaptableInstance, gridOptions, adaptableContainerId, agGridContainerId, undoChangeEnabled, onUndoChange, onClearRow);
22
23
  const modules = mainAdaptableInstance.getAgGridRegisteredModules();
23
- const agGridConfig = {
24
+ const dataChangeHistoryAdaptableApi = await AdaptableAgGrid._initInternal({
25
+ variant: 'vanilla',
26
+ adaptableOptions,
24
27
  gridOptions,
25
- modules: modules,
26
- };
27
- // to avoid direct dependency to Adaptable.ts and thus creating a circular dependency;
28
- const adaptableInitFn = Object.getPrototypeOf(mainAdaptableInstance).constructor.init;
29
- const dataChangeHistoryAdaptableApi = await adaptableInitFn(adaptableOptions, agGridConfig);
28
+ modules,
29
+ });
30
30
  setAdaptableApi(dataChangeHistoryAdaptableApi);
31
31
  };
32
32
  initializeAdaptableGrid();
@@ -94,7 +94,7 @@ export const TransposedPopup = (props) => {
94
94
  },
95
95
  layoutOptions: {
96
96
  createDefaultLayout: false,
97
- autoSizeColumnsInLayout: false,
97
+ autoSizeColumnsInLayout: true,
98
98
  },
99
99
  predefinedConfig: {
100
100
  Layout: {
@@ -5,7 +5,7 @@ import { renderWithAdaptableContext } from '../View/renderWithAdaptableContext';
5
5
  const ActionButtons = (props) => {
6
6
  const { buttons, adaptableApi, context, rerender } = props;
7
7
  return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
8
- var _a, _b;
8
+ var _a, _b, _c, _d, _e, _f;
9
9
  if (button.hidden && button.hidden(button, context)) {
10
10
  return;
11
11
  }
@@ -27,7 +27,8 @@ const ActionButtons = (props) => {
27
27
  }, 16);
28
28
  };
29
29
  const disabled = button.disabled && button.disabled(button, context);
30
- return (React.createElement(SimpleButton, { 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));
30
+ 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}`;
31
+ return (React.createElement(SimpleButton, { 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));
31
32
  })));
32
33
  };
33
34
  export 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;
@@ -8,7 +8,7 @@ import Emitter from '../Utilities/Emitter';
8
8
  import { applyDefaultAdaptableOptions } from './defaultAdaptableOptions';
9
9
  import { AgGridAdapter } from './AgGridAdapter';
10
10
  import * as GeneralConstants from '../Utilities/Constants/GeneralConstants';
11
- import { AB_FDC3_COLUMN, AB_SPECIAL_COLUMN, AUTOGENERATED_PK_COLUMN, BLANK_DISTINCT_COLUMN_VALUE, DARK_THEME, DEFAULT_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, LIGHT_THEME, } from '../Utilities/Constants/GeneralConstants';
11
+ import { AB_FDC3_COLUMN, AB_SPECIAL_COLUMN, ADAPTABLE_ROW_ACTION_BUTTONS, AUTOGENERATED_PK_COLUMN, BLANK_DISTINCT_COLUMN_VALUE, DARK_THEME, DEFAULT_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, LIGHT_THEME, } from '../Utilities/Constants/GeneralConstants';
12
12
  import { DataService } from '../Utilities/Services/DataService';
13
13
  import { AdaptableStore } from '../Redux/Store/AdaptableStore';
14
14
  import { AdaptableApiImpl } from '../Api/Implementation/AdaptableApiImpl';
@@ -191,6 +191,9 @@ export class AdaptableAgGrid {
191
191
  get isReady() {
192
192
  return this.lifecycleState === 'ready';
193
193
  }
194
+ get isAvailable() {
195
+ return this.lifecycleState === 'available' || this.lifecycleState === 'ready';
196
+ }
194
197
  get isDestroyed() {
195
198
  return this.lifecycleState === 'preDestroyed';
196
199
  }
@@ -242,73 +245,6 @@ export class AdaptableAgGrid {
242
245
  return doInit(adaptableInstance);
243
246
  }
244
247
  }
245
- normaliseLayoutState(state, config) {
246
- var _a, _b, _c;
247
- if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
248
- const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
249
- const layoutState = state.Layout || {};
250
- const availableLayouts = layoutState.Layouts || [];
251
- availableLayouts.push(defaultLayout);
252
- layoutState.Layouts = availableLayouts;
253
- layoutState.CurrentLayout = defaultLayout.Name;
254
- state.Layout = layoutState;
255
- }
256
- else {
257
- const layoutState = state.Layout;
258
- // ensure CurrentLayout is valid
259
- if (!layoutState.CurrentLayout ||
260
- !layoutState.Layouts.find((l) => l.Name === layoutState.CurrentLayout)) {
261
- layoutState.CurrentLayout = (_b = (_a = layoutState.Layouts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Name;
262
- }
263
- }
264
- // for the initial state, we need to dynamically add the ActionRowColumn (if necessary)
265
- // for subsequent layout changes, the `Adaptable.setLayout()` method handles this
266
- // this is a serious code smell, hopefully we will delete `setLayout()` at some point
267
- const actionRowColDefs = this.api.actionRowApi.internalApi.getColDefsForActionRowColumns();
268
- actionRowColDefs.forEach((actionRowColDef) => {
269
- const currentLayout = state.Layout.Layouts.find((l) => l.Name === state.Layout.CurrentLayout);
270
- if (currentLayout && !currentLayout.Columns.includes(actionRowColDef.colId)) {
271
- currentLayout.Columns.push(actionRowColDef.colId);
272
- currentLayout.PinnedColumnsMap = currentLayout.PinnedColumnsMap || {};
273
- currentLayout.PinnedColumnsMap[actionRowColDef.colId] = actionRowColDef.pinned;
274
- }
275
- });
276
- /**
277
- * Viewport mode does not support a few
278
- * features instead of complicating the
279
- * logic where layout is applied, it is easier and
280
- * less error prone to just remove it.
281
- */
282
- if (config.gridOptions.rowModelType === 'viewport') {
283
- (_c = state.Layout.Layouts) === null || _c === void 0 ? void 0 : _c.forEach((layout) => {
284
- if (layout.RowGroupedColumns) {
285
- delete layout.RowGroupedColumns;
286
- }
287
- if (layout.AggregationColumns) {
288
- delete layout.AggregationColumns;
289
- }
290
- if (layout.PivotColumns) {
291
- delete layout.PivotColumns;
292
- delete layout.EnablePivot;
293
- }
294
- });
295
- }
296
- return state;
297
- }
298
- normaliseToolPanelState(state) {
299
- var _a, _b, _c;
300
- if ((_a = state === null || state === void 0 ? void 0 : state.ToolPanel) === null || _a === void 0 ? void 0 : _a.ToolPanels) {
301
- return state;
302
- }
303
- // no predefined config provided, we will display all the panels collapsed (custom & module)
304
- const defaultToolPanels = [];
305
- (_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 }));
306
- ALL_TOOL_PANELS.forEach((moduleToolPanel) => defaultToolPanels.push({ Name: moduleToolPanel }));
307
- const toolPanelState = state.ToolPanel || {};
308
- toolPanelState.ToolPanels = defaultToolPanels;
309
- state.ToolPanel = toolPanelState;
310
- return state;
311
- }
312
248
  async _initAdaptableAgGrid(config) {
313
249
  var _a, _b;
314
250
  // Phase 1: Preprocess Adaptable Options
@@ -383,6 +319,8 @@ export class AdaptableAgGrid {
383
319
  }
384
320
  this.forPlugins((plugin) => plugin.afterInitServices(this));
385
321
  this.forPlugins((plugin) => plugin.afterInitModules(this, this.adaptableModules));
322
+ // do this now so it sets module entitlements
323
+ this.EntitlementService.setModulesEntitlements();
386
324
  /**
387
325
  * At this point it's mandatory to have the ALL the Adaptable blocks initialized:
388
326
  * Store, APIs, Services, Modules
@@ -409,7 +347,10 @@ export class AdaptableAgGrid {
409
347
  /**
410
348
  * At this point AG Grid is initialized!
411
349
  */
412
- this.updateColumnModelAndRefreshGrid();
350
+ this.deriveAdaptableColumnStateFromAgGrid();
351
+ this.agGridColumnAdapter.setupColumns();
352
+ // we need this because we need the internal Column state to be ready before doing any extra business logic
353
+ this.lifecycleState = 'available';
413
354
  this.api.themeApi.applyCurrentTheme();
414
355
  this.validatePrimaryKey();
415
356
  this.embedColumnMenu = this.agGridAdapter.isModulePresent(ModuleNames.MenuModule);
@@ -419,8 +360,8 @@ export class AdaptableAgGrid {
419
360
  this.applyColumnFiltering();
420
361
  this.addGridEventListeners();
421
362
  this.temporaryAdaptableStateUpdates();
422
- // do this now so it sets module entitlements
423
- this.EntitlementService.setModulesEntitlements();
363
+ this.redrawBody();
364
+ this.refreshHeader();
424
365
  // create the module menu (for use in the dashboard and the toolpanel)
425
366
  // TODO see #create-create-module-menu - make sure it's the same here and there
426
367
  this.ModuleService.createModuleMenus();
@@ -441,6 +382,75 @@ export class AdaptableAgGrid {
441
382
  perfInitAdaptableAgGrid.end();
442
383
  return Promise.resolve(this.api);
443
384
  }
385
+ normaliseLayoutState(state, config) {
386
+ var _a, _b, _c, _d, _e, _f;
387
+ if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
388
+ const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
389
+ const layoutState = state.Layout || {};
390
+ const availableLayouts = layoutState.Layouts || [];
391
+ availableLayouts.push(defaultLayout);
392
+ layoutState.Layouts = availableLayouts;
393
+ layoutState.CurrentLayout = defaultLayout.Name;
394
+ state.Layout = layoutState;
395
+ }
396
+ else {
397
+ const layoutState = state.Layout;
398
+ // ensure CurrentLayout is valid
399
+ if (!layoutState.CurrentLayout ||
400
+ !layoutState.Layouts.find((l) => l.Name === layoutState.CurrentLayout)) {
401
+ layoutState.CurrentLayout = (_b = (_a = layoutState.Layouts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Name;
402
+ }
403
+ }
404
+ // for the initial state, we need to dynamically add the ActionRowColumn (if necessary)
405
+ // for subsequent layout changes, the `Adaptable.setLayout()` method handles this
406
+ // this is a serious code smell, hopefully we will delete `setLayout()` at some point
407
+ const hasActionRowButtons = !!((_c = this.adaptableOptions.actionRowOptions) === null || _c === void 0 ? void 0 : _c.actionRowButtons);
408
+ if (hasActionRowButtons) {
409
+ const currentLayout = state.Layout.Layouts.find((l) => l.Name === state.Layout.CurrentLayout);
410
+ if (currentLayout && !currentLayout.Columns.includes(ADAPTABLE_ROW_ACTION_BUTTONS)) {
411
+ currentLayout.Columns.push(ADAPTABLE_ROW_ACTION_BUTTONS);
412
+ const columnPosition = (_e = (_d = this.adaptableOptions.actionRowOptions) === null || _d === void 0 ? void 0 : _d.actionRowButtonOptions) === null || _e === void 0 ? void 0 : _e.position;
413
+ currentLayout.PinnedColumnsMap = currentLayout.PinnedColumnsMap || {};
414
+ currentLayout.PinnedColumnsMap[ADAPTABLE_ROW_ACTION_BUTTONS] =
415
+ columnPosition === 'pinnedRight' ? 'right' : 'left';
416
+ }
417
+ }
418
+ /**
419
+ * Viewport mode does not support a few
420
+ * features instead of complicating the
421
+ * logic where layout is applied, it is easier and
422
+ * less error prone to just remove it.
423
+ */
424
+ if (config.gridOptions.rowModelType === 'viewport') {
425
+ (_f = state.Layout.Layouts) === null || _f === void 0 ? void 0 : _f.forEach((layout) => {
426
+ if (layout.RowGroupedColumns) {
427
+ delete layout.RowGroupedColumns;
428
+ }
429
+ if (layout.AggregationColumns) {
430
+ delete layout.AggregationColumns;
431
+ }
432
+ if (layout.PivotColumns) {
433
+ delete layout.PivotColumns;
434
+ delete layout.EnablePivot;
435
+ }
436
+ });
437
+ }
438
+ return state;
439
+ }
440
+ normaliseToolPanelState(state) {
441
+ var _a, _b, _c;
442
+ if ((_a = state === null || state === void 0 ? void 0 : state.ToolPanel) === null || _a === void 0 ? void 0 : _a.ToolPanels) {
443
+ return state;
444
+ }
445
+ // no predefined config provided, we will display all the panels collapsed (custom & module)
446
+ const defaultToolPanels = [];
447
+ (_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 }));
448
+ ALL_TOOL_PANELS.forEach((moduleToolPanel) => defaultToolPanels.push({ Name: moduleToolPanel }));
449
+ const toolPanelState = state.ToolPanel || {};
450
+ toolPanelState.ToolPanels = defaultToolPanels;
451
+ state.ToolPanel = toolPanelState;
452
+ return state;
453
+ }
444
454
  applyColumnFiltering() {
445
455
  if (this.api.columnFilterApi.isQuickFilterAvailable()) {
446
456
  if (this.api.columnFilterApi.isQuickFilterVisible()) {
@@ -588,7 +598,7 @@ export class AdaptableAgGrid {
588
598
  */
589
599
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'isExternalFilterPresent', (original_isExternalFilterPresent) => {
590
600
  return (params) => {
591
- if (this.isDestroyed) {
601
+ if (!this.isAvailable) {
592
602
  return true;
593
603
  }
594
604
  const columnFilters = this.api.columnFilterApi.getActiveColumnFilters();
@@ -605,7 +615,7 @@ export class AdaptableAgGrid {
605
615
  */
606
616
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'doesExternalFilterPass', (original_doesExternalFilterPass) => {
607
617
  return (node) => {
608
- if (this.isDestroyed) {
618
+ if (!this.isAvailable) {
609
619
  return true;
610
620
  }
611
621
  // first we assess a Grid Filter (if its running locally)
@@ -916,7 +926,8 @@ export class AdaptableAgGrid {
916
926
  const gridRoot = agGridApi.ctrlsService.gridBodyCtrl.eGridBody;
917
927
  const gridContainer = gridRoot === null || gridRoot === void 0 ? void 0 : gridRoot.closest('[class*="ag-theme"]');
918
928
  if (!gridContainer) {
919
- this.logger.consoleError('No AG Grid container element found in the DOM. Please provide a valid container element in `ContainerOptions.agGridContainer`');
929
+ this.logger.consoleError(`No AG Grid container could be derived from the Adaptable framework wrapper.
930
+ Please contact AdapTable Support and in the meantime provide a valid container element in 'ContainerOptions.agGridContainer'!`);
920
931
  }
921
932
  this.DANGER_USE_GETTER_agGridContainerElement = gridContainer;
922
933
  }
@@ -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;
@@ -1,4 +1,4 @@
1
- import { ModuleRegistry, } from '@ag-grid-community/core';
1
+ import { GridApi, ModuleRegistry, } from '@ag-grid-community/core';
2
2
  import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME, ADAPTABLE_ROW_ACTION_BUTTONS, ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME, } from '../Utilities/Constants/GeneralConstants';
3
3
  import { createUuid } from '../PredefinedConfig/Uuid';
4
4
  import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
@@ -26,10 +26,30 @@ export class AgGridAdapter {
26
26
  if (this.DANGER_USE_GETTER_gridApi) {
27
27
  return this.DANGER_USE_GETTER_gridApi;
28
28
  }
29
+ if (this.DANGER_gridApi_from_args) {
30
+ return this.DANGER_gridApi_from_args;
31
+ }
29
32
  if (!skipLogging) {
30
33
  console.error('AgGridApi is not available yet');
31
34
  }
32
35
  }
36
+ /**
37
+ * 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)
38
+ * yet we need it when evaluating custom GridOptions properties on the first render.
39
+ * to handle this edge case, we try to extract the AG GridApi from the invocation arguments
40
+ */
41
+ grabAgGridApiOnTheFly(args) {
42
+ var _a, _b;
43
+ if (this.DANGER_USE_GETTER_gridApi) {
44
+ return;
45
+ }
46
+ if (Array.isArray(args) &&
47
+ typeof ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.api) === 'object' &&
48
+ ((_b = args[0]) === null || _b === void 0 ? void 0 : _b.api) instanceof GridApi) {
49
+ this.DANGER_gridApi_from_args = args[0].api;
50
+ }
51
+ }
52
+ // TODO AFL check if this is still needed if GridAPI offers the `getOption` method
33
53
  // do NOT ever mutate the returned object!!
34
54
  getLiveGridOptions() {
35
55
  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
  }
@@ -30,6 +30,7 @@ export class AgGridOptionsService {
30
30
  if (this.adaptableInstance.isDestroyed) {
31
31
  return;
32
32
  }
33
+ this.agGridAdapter.grabAgGridApiOnTheFly(args);
33
34
  return previousValue(...args);
34
35
  };
35
36
  }
@@ -47,4 +48,7 @@ export class AgGridOptionsService {
47
48
  gridOptions[propertyName] = userValue;
48
49
  }
49
50
  }
51
+ get agGridAdapter() {
52
+ return this.adaptableInstance.agGridAdapter;
53
+ }
50
54
  }
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  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: 1710607821606 || Date.now(),
4
- VERSION: "18.0.0-canary.6" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1710788423776 || Date.now(),
4
+ VERSION: "18.0.0-canary.8" || '--current-version--',
5
5
  };
@@ -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;
@@ -4409,6 +4409,12 @@ export const ADAPTABLE_METAMODEL = {
4409
4409
  "desc": "Callback function invoked when a batch successfully updates",
4410
4410
  "isOpt": true
4411
4411
  },
4412
+ {
4413
+ "name": "flushAsync",
4414
+ "kind": "b",
4415
+ "desc": "Whether to flush async updates.",
4416
+ "isOpt": true
4417
+ },
4412
4418
  {
4413
4419
  "name": "runAsync",
4414
4420
  "kind": "b",
@@ -8972,6 +8978,33 @@ export const ADAPTABLE_METAMODEL = {
8972
8978
  }
8973
8979
  ]
8974
8980
  },
8981
+ "UpgradeConfig": {
8982
+ "name": "UpgradeConfig",
8983
+ "kind": "I",
8984
+ "desc": "The upgrade config object",
8985
+ "props": [
8986
+ {
8987
+ "name": "fromVersion",
8988
+ "kind": "n",
8989
+ "desc": "The version to upgrade from"
8990
+ },
8991
+ {
8992
+ "name": "logger",
8993
+ "kind": "R",
8994
+ "desc": "The logger object",
8995
+ "isOpt": true,
8996
+ "defVal": "The console object",
8997
+ "ref": "unknown"
8998
+ },
8999
+ {
9000
+ "name": "toVersion",
9001
+ "kind": "n",
9002
+ "desc": "The version to upgrade to",
9003
+ "isOpt": true,
9004
+ "defVal": "The current version"
9005
+ }
9006
+ ]
9007
+ },
8975
9008
  "UserColumnMenuItem": {
8976
9009
  "name": "UserColumnMenuItem",
8977
9010
  "kind": "I",
@@ -9154,6 +9187,27 @@ export const ADAPTABLE_METAMODEL = {
9154
9187
  "desc": "Custom column values for Values Column Filter and Grid Filter Builder",
9155
9188
  "isOpt": true
9156
9189
  },
9190
+ {
9191
+ "name": "loadingScreenDelay",
9192
+ "kind": "n",
9193
+ "desc": "Delay in milliseconds before Loading Screen appears. `showLoadingScreen` must be true for this to take effect",
9194
+ "isOpt": true,
9195
+ "defVal": "200"
9196
+ },
9197
+ {
9198
+ "name": "loadingScreenText",
9199
+ "kind": "s",
9200
+ "desc": "Text to display in Loading Screen.",
9201
+ "isOpt": true,
9202
+ "defVal": "&#39;Retrieving your settings and setting up the grid...&#39;"
9203
+ },
9204
+ {
9205
+ "name": "loadingScreenTitle",
9206
+ "kind": "s",
9207
+ "desc": "Title to display in Loading Screen.",
9208
+ "isOpt": true,
9209
+ "defVal": "&#39;Initialising Grid&#39;"
9210
+ },
9157
9211
  {
9158
9212
  "name": "objectTags",
9159
9213
  "kind": "u",