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