@adaptabletools/adaptable-plugin-master-detail-aggrid 18.0.0-canary.9 → 18.0.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 +2 -2
- package/src/DetailCellRenderer.js +23 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-plugin-master-detail-aggrid",
|
|
3
|
-
"version": "18.0.0
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "http://www.adaptabletools.com/",
|
|
6
6
|
"author": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"typings": "src/index.d.ts",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"tslib": "^2.3.0",
|
|
13
|
-
"@adaptabletools/adaptable": "18.0.0
|
|
13
|
+
"@adaptabletools/adaptable": "18.0.0"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@ag-grid-enterprise/master-detail": ">=31.1.0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AdaptableAgGrid } from '@adaptabletools/adaptable/src/agGrid/AdaptableAgGrid';
|
|
2
2
|
// @ts-ignore because we override the private setDetailGrid() method
|
|
3
3
|
// TODO: add interface to implement
|
|
4
4
|
export class DetailCellRenderer {
|
|
@@ -29,7 +29,27 @@ export class DetailCellRenderer {
|
|
|
29
29
|
: detailAdaptableOptions.predefinedConfig;
|
|
30
30
|
// AG Grid modules are already registered
|
|
31
31
|
const agGridModules = masterAdaptable.getAgGridRegisteredModules();
|
|
32
|
-
this.adaptableApi = await
|
|
32
|
+
this.adaptableApi = await AdaptableAgGrid._initInternal({
|
|
33
|
+
adaptableOptions: Object.assign(Object.assign({ licenseKey: masterAdaptable.api.optionsApi.getLicenseKey(), 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
|
+
modules: agGridModules,
|
|
35
|
+
gridOptions: detailGridOptions,
|
|
36
|
+
variant: 'vanilla',
|
|
37
|
+
isDetailGrid: true,
|
|
38
|
+
});
|
|
39
|
+
masterAdaptable.api.eventApi.on('ThemeChanged', () => {
|
|
40
|
+
const masterTheme = masterAdaptable.api.themeApi.getCurrentTheme();
|
|
41
|
+
const detailTheme = this.adaptableApi.themeApi.getCurrentTheme();
|
|
42
|
+
if (masterTheme !== detailTheme) {
|
|
43
|
+
this.adaptableApi.themeApi.loadTheme(masterTheme);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
this.adaptableApi.eventApi.on('ThemeChanged', () => {
|
|
47
|
+
const masterTheme = masterAdaptable.api.themeApi.getCurrentTheme();
|
|
48
|
+
const detailTheme = this.adaptableApi.themeApi.getCurrentTheme();
|
|
49
|
+
if (masterTheme !== detailTheme) {
|
|
50
|
+
masterAdaptable.api.themeApi.loadTheme(detailTheme);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
33
53
|
this.adaptableApi.internalApi.getAdaptableInstance().updateColumnModelAndRefreshGrid();
|
|
34
54
|
this.loadRowData();
|
|
35
55
|
if (onDetailInit) {
|
|
@@ -84,7 +104,7 @@ export class DetailCellRenderer {
|
|
|
84
104
|
}
|
|
85
105
|
const successCallback = (rowData) => {
|
|
86
106
|
const mostRecentCall = this.loadRowDataVersion === versionThisCall;
|
|
87
|
-
if (mostRecentCall) {
|
|
107
|
+
if (mostRecentCall && !this.adaptableDestroyed && this.adaptableApi) {
|
|
88
108
|
this.adaptableApi.gridApi.addGridData(rowData);
|
|
89
109
|
}
|
|
90
110
|
};
|