@adaptabletools/adaptable-plugin-master-detail-aggrid 19.2.4 → 20.0.0-canary.0

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-plugin-master-detail-aggrid",
3
- "version": "19.2.4",
3
+ "version": "20.0.0-canary.0",
4
4
  "description": "",
5
5
  "homepage": "http://www.adaptabletools.com/",
6
6
  "author": {
@@ -9,11 +9,11 @@
9
9
  },
10
10
  "typings": "src/index.d.ts",
11
11
  "dependencies": {
12
- "tslib": "^2.3.0",
13
- "@adaptabletools/adaptable": "19.2.4"
12
+ "tslib": "^2.8.1",
13
+ "@adaptabletools/adaptable": "20.0.0-canary.0"
14
14
  },
15
15
  "peerDependencies": {
16
- "@ag-grid-enterprise/master-detail": ">=32.3.0"
16
+ "ag-grid-enterprise": ">=33.0.0"
17
17
  },
18
18
  "type": "module",
19
19
  "module": "src/index.js"
@@ -1,4 +1,4 @@
1
- import { GridOptions, IDetailCellRendererParams, ICellRenderer } from '@ag-grid-community/core';
1
+ import { GridOptions, IDetailCellRendererParams, ICellRenderer } from 'ag-grid-community';
2
2
  import { AdaptableApi } from '@adaptabletools/adaptable/types';
3
3
  export declare class DetailCellRenderer implements ICellRenderer {
4
4
  adaptableApi?: AdaptableApi;
@@ -7,7 +7,6 @@ export class DetailCellRenderer {
7
7
  this.loadRowDataVersion = 0;
8
8
  }
9
9
  async init(params) {
10
- var _a;
11
10
  this.params = params;
12
11
  this.eGui = document.createElement('div');
13
12
  this.eGui.classList.add('ag-details-row');
@@ -20,22 +19,35 @@ export class DetailCellRenderer {
20
19
  const detailGridOptions = params.detailGridOptions;
21
20
  detailGridOptions.detailCellRenderer = DetailCellRenderer;
22
21
  // Adaptable logic
23
- const adaptableContainerId = `adaptable-detail-${(_a = params.node) === null || _a === void 0 ? void 0 : _a.rowIndex}`;
22
+ const adaptableContainerId = `adaptable-detail-${params.node?.rowIndex}`;
24
23
  const adaptableContainer = document.createElement('div');
25
24
  adaptableContainer.id = adaptableContainerId;
26
25
  // Attach Adaptable
27
26
  this.eGui.prepend(adaptableContainer);
28
- const predefinedConfig = typeof detailAdaptableOptions.predefinedConfig === 'string'
29
- ? {}
30
- : detailAdaptableOptions.predefinedConfig;
27
+ const predefinedConfig = detailAdaptableOptions.predefinedConfig;
31
28
  // AG Grid modules are already registered
32
29
  const agGridModules = masterAdaptable.getAgGridRegisteredModules();
33
30
  this.adaptableApi = await AdaptableAgGrid._initInternal({
34
- adaptableOptions: Object.assign(Object.assign({ licenseKey: masterAdaptable.api.optionsApi.getLicenseKey(),
31
+ adaptableOptions: {
32
+ licenseKey: masterAdaptable.api.optionsApi.getLicenseKey(),
35
33
  // provide adaptableId just in case, but normally it should be provided by the user in detailAdaptableOptions
36
- adaptableId: `${masterAdaptable.adaptableOptions.adaptableId} Detail` }, detailAdaptableOptions), { predefinedConfig: Object.assign(Object.assign({}, predefinedConfig), { Dashboard: Object.assign({ IsCollapsed: true }, predefinedConfig.Dashboard) }), containerOptions: Object.assign(Object.assign({}, detailAdaptableOptions.containerOptions), { adaptableContainer: adaptableContainer, agGridContainer: this.eGui }) }),
34
+ adaptableId: `${masterAdaptable.adaptableOptions.adaptableId} Detail`,
35
+ ...detailAdaptableOptions,
36
+ predefinedConfig: {
37
+ ...predefinedConfig,
38
+ Dashboard: {
39
+ IsCollapsed: true,
40
+ ...predefinedConfig.Dashboard,
41
+ },
42
+ },
43
+ containerOptions: {
44
+ ...detailAdaptableOptions.containerOptions,
45
+ adaptableContainer: adaptableContainer,
46
+ agGridContainer: this.eGui,
47
+ },
48
+ },
37
49
  modules: agGridModules,
38
- gridOptions: Object.assign({}, detailGridOptions),
50
+ gridOptions: { ...detailGridOptions },
39
51
  variant: 'vanilla',
40
52
  isDetailGrid: true,
41
53
  isDetailGridForRowIndex: params.node.rowIndex,
@@ -58,12 +70,10 @@ export class DetailCellRenderer {
58
70
  this.loadRowData();
59
71
  if (onDetailInit) {
60
72
  const context = {
61
- adaptableApi: this.adaptableApi,
62
- userName: this.adaptableApi.optionsApi.getUserName(),
63
- adaptableId: this.adaptableApi.optionsApi.getAdaptableId(),
64
73
  rowNode: params.node,
65
74
  data: params.data,
66
75
  primaryKeyValue: masterAdaptable.api.gridApi.getPrimaryKeyValueForRowNode(params.node),
76
+ ...this.adaptableApi.internalApi.buildBaseContext(),
67
77
  };
68
78
  onDetailInit(context);
69
79
  }
@@ -88,15 +98,14 @@ export class DetailCellRenderer {
88
98
  * So the detail grid works with the ag-grid api
89
99
  */
90
100
  loadRowData() {
91
- var _a;
92
101
  this.loadRowDataVersion++;
93
102
  const versionThisCall = this.loadRowDataVersion;
94
103
  const detailGridOptions = this._detailGridOptions;
95
- if ((detailGridOptions === null || detailGridOptions === void 0 ? void 0 : detailGridOptions.rowModelType) === 'serverSide') {
104
+ if (detailGridOptions?.rowModelType === 'serverSide') {
96
105
  const node = this.params.node;
97
106
  const detailGridInfo = node.detailGridInfo;
98
107
  if (detailGridInfo) {
99
- (_a = detailGridInfo === null || detailGridInfo === void 0 ? void 0 : detailGridInfo.api) === null || _a === void 0 ? void 0 : _a.refreshServerSide({ purge: true });
108
+ detailGridInfo?.api?.refreshServerSide({ purge: true });
100
109
  }
101
110
  return;
102
111
  }
@@ -116,7 +125,7 @@ export class DetailCellRenderer {
116
125
  node: this.params.node,
117
126
  data: this.params.node.data,
118
127
  successCallback: successCallback,
119
- context: detailGridOptions === null || detailGridOptions === void 0 ? void 0 : detailGridOptions.context,
128
+ context: detailGridOptions?.context,
120
129
  };
121
130
  userFunc(funcParams);
122
131
  }
@@ -1,2 +1,2 @@
1
- import { GridOptions } from '@ag-grid-community/core';
1
+ import { GridOptions } from 'ag-grid-community';
2
2
  export declare const attachDetailCellRenderer: (gridOptions: GridOptions) => void;
package/src/index.js CHANGED
@@ -1,13 +1,15 @@
1
1
  import { AdaptablePlugin } from '@adaptabletools/adaptable/types';
2
+ import { version, name } from '../package.json';
3
+ import { version as coreVersion } from '@adaptabletools/adaptable/package.json';
2
4
  import { attachDetailCellRenderer } from './attachDetailCellRenderer';
3
- // const suffix = name.endsWith('-cjs') ? '-cjs' : '';
4
- // if (version !== coreVersion) {
5
- // console.warn(`
6
- // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7
- // !!!!!!! "@adaptabletools/adaptable-plugin-master-detail-aggrid${suffix}" (v @${version}) and "@adaptabletools/adaptable${suffix}" (v @${coreVersion}) have different versions - they should have the exact same version.
8
- // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9
- // `);
10
- // }
5
+ const suffix = name.endsWith('-cjs') ? '-cjs' : '';
6
+ if (version !== coreVersion) {
7
+ console.warn(`
8
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9
+ !!!!!!! "@adaptabletools/adaptable-plugin-master-detail-aggrid${suffix}" (v @${version}) and "@adaptabletools/adaptable${suffix}" (v @${coreVersion}) have different versions - they should have the exact same version.
10
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11
+ `);
12
+ }
11
13
  class MasterDetailPlugin extends AdaptablePlugin {
12
14
  constructor(pluginOptions) {
13
15
  super(pluginOptions);