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

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.7",
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",
@@ -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: {
@@ -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;
@@ -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
  }
@@ -413,7 +416,10 @@ class AdaptableAgGrid {
413
416
  /**
414
417
  * At this point AG Grid is initialized!
415
418
  */
416
- this.updateColumnModelAndRefreshGrid();
419
+ this.deriveAdaptableColumnStateFromAgGrid();
420
+ this.agGridColumnAdapter.setupColumns();
421
+ // we need this because we need the internal Column state to be ready before doing any extra business logic
422
+ this.lifecycleState = 'available';
417
423
  this.api.themeApi.applyCurrentTheme();
418
424
  this.validatePrimaryKey();
419
425
  this.embedColumnMenu = this.agGridAdapter.isModulePresent(core_1.ModuleNames.MenuModule);
@@ -423,6 +429,8 @@ class AdaptableAgGrid {
423
429
  this.applyColumnFiltering();
424
430
  this.addGridEventListeners();
425
431
  this.temporaryAdaptableStateUpdates();
432
+ this.redrawBody();
433
+ this.refreshHeader();
426
434
  // do this now so it sets module entitlements
427
435
  this.EntitlementService.setModulesEntitlements();
428
436
  // create the module menu (for use in the dashboard and the toolpanel)
@@ -592,7 +600,7 @@ class AdaptableAgGrid {
592
600
  */
593
601
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'isExternalFilterPresent', (original_isExternalFilterPresent) => {
594
602
  return (params) => {
595
- if (this.isDestroyed) {
603
+ if (!this.isAvailable) {
596
604
  return true;
597
605
  }
598
606
  const columnFilters = this.api.columnFilterApi.getActiveColumnFilters();
@@ -609,7 +617,7 @@ class AdaptableAgGrid {
609
617
  */
610
618
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'doesExternalFilterPass', (original_doesExternalFilterPass) => {
611
619
  return (node) => {
612
- if (this.isDestroyed) {
620
+ if (!this.isAvailable) {
613
621
  return true;
614
622
  }
615
623
  // first we assess a Grid Filter (if its running locally)
@@ -920,7 +928,8 @@ class AdaptableAgGrid {
920
928
  const gridRoot = agGridApi.ctrlsService.gridBodyCtrl.eGridBody;
921
929
  const gridContainer = gridRoot === null || gridRoot === void 0 ? void 0 : gridRoot.closest('[class*="ag-theme"]');
922
930
  if (!gridContainer) {
923
- this.logger.consoleError('No AG Grid container element found in the DOM. Please provide a valid container element in `ContainerOptions.agGridContainer`');
931
+ this.logger.consoleError(`No AG Grid container could be derived from the Adaptable framework wrapper.
932
+ Please contact AdapTable Support and in the meantime provide a valid container element in 'ContainerOptions.agGridContainer'!`);
924
933
  }
925
934
  this.DANGER_USE_GETTER_agGridContainerElement = gridContainer;
926
935
  }
@@ -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: 1710766638384 || Date.now(),
6
+ VERSION: "18.0.0-canary.7" || '--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",