@adaptabletools/adaptable 16.2.1 → 16.2.3
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/bundle.cjs.js +145 -145
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/DataImportOptions.d.ts +8 -8
- package/src/Api/Implementation/ColumnApiImpl.js +1 -2
- package/src/Api/Implementation/DashboardApiImpl.js +2 -0
- package/src/Api/Implementation/OptionsApiImpl.d.ts +1 -1
- package/src/Api/Internal/DashboardInternalApi.js +11 -1
- package/src/Api/Internal/DataImportInternalApi.js +0 -3
- package/src/View/DataImport/DataImportWizard/DataImportWizard.js +17 -2
- package/src/View/DataImport/systemFileHandlers.d.ts +1 -1
- package/src/agGrid/Adaptable.js +1 -1
- package/src/metamodel/adaptable.metamodel.d.ts +10 -10
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/agGrid/GroupCellRenderer.d.ts +0 -5
- package/src/agGrid/GroupCellRenderer.js +0 -82
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "16.2.
|
|
3
|
+
"version": "16.2.3",
|
|
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",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1701111826846;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -3,7 +3,7 @@ import { IRowNode } from '@ag-grid-community/core';
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for managing the Data Import function
|
|
5
5
|
*/
|
|
6
|
-
export interface DataImportOptions<T = Record<string,
|
|
6
|
+
export interface DataImportOptions<T = Record<string, any>> {
|
|
7
7
|
/**
|
|
8
8
|
* File extensions that the Data Import function accepts
|
|
9
9
|
*/
|
|
@@ -25,7 +25,7 @@ export interface DataImportOptions<T = Record<string, unknown>> {
|
|
|
25
25
|
*
|
|
26
26
|
* @experimental It might change in a future version
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
_preprocessRowData?: (context: PreprocessRowDataContext<T>) => Record<string, any>;
|
|
29
29
|
/**
|
|
30
30
|
* Function to get the Primary Key value for a data row (defaults to value of the primaryKey column)
|
|
31
31
|
*
|
|
@@ -36,16 +36,16 @@ export interface DataImportOptions<T = Record<string, unknown>> {
|
|
|
36
36
|
/**
|
|
37
37
|
* Context used when pre-processing Import Data
|
|
38
38
|
*/
|
|
39
|
-
export interface
|
|
39
|
+
export interface PreprocessRowDataContext<T = Record<string, any>> extends BaseContext {
|
|
40
40
|
/**
|
|
41
41
|
* Data which has been imported
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
rowData: T;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Context used when importing Data
|
|
47
47
|
*/
|
|
48
|
-
export interface HandleImportedDataContext<T = Record<string,
|
|
48
|
+
export interface HandleImportedDataContext<T = Record<string, any>> extends BaseContext {
|
|
49
49
|
/**
|
|
50
50
|
* Data which has been imported
|
|
51
51
|
*/
|
|
@@ -54,7 +54,7 @@ export interface HandleImportedDataContext<T = Record<string, unknown>> extends
|
|
|
54
54
|
/**
|
|
55
55
|
* Files that can be handled by Data Import
|
|
56
56
|
*/
|
|
57
|
-
export interface DataImportFileHandler<T = Record<string,
|
|
57
|
+
export interface DataImportFileHandler<T = Record<string, any>> {
|
|
58
58
|
/**
|
|
59
59
|
* Name of File Extension
|
|
60
60
|
*/
|
|
@@ -80,7 +80,7 @@ export interface DataImportValidationError {
|
|
|
80
80
|
/**
|
|
81
81
|
* Context passed to the `validate` function
|
|
82
82
|
*/
|
|
83
|
-
export interface DataImportValidateContext<T = Record<string,
|
|
83
|
+
export interface DataImportValidateContext<T = Record<string, any>> extends BaseContext {
|
|
84
84
|
/**
|
|
85
85
|
* Imported Row Data
|
|
86
86
|
*/
|
|
@@ -89,7 +89,7 @@ export interface DataImportValidateContext<T = Record<string, unknown>> extends
|
|
|
89
89
|
/**
|
|
90
90
|
* Context passed to the `getPrimaryKeyValue` function
|
|
91
91
|
*/
|
|
92
|
-
export interface GetPrimaryKeyValueContext<T = Record<string,
|
|
92
|
+
export interface GetPrimaryKeyValueContext<T = Record<string, any>> extends BaseContext {
|
|
93
93
|
/**
|
|
94
94
|
* Data being imported
|
|
95
95
|
*/
|
|
@@ -4,7 +4,6 @@ exports.ColumnApiImpl = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ApiBase_1 = require("./ApiBase");
|
|
6
6
|
const GeneralConstants = tslib_1.__importStar(require("../../Utilities/Constants/GeneralConstants"));
|
|
7
|
-
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
|
|
8
7
|
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
|
|
9
8
|
const ColumnInternalApi_1 = require("../Internal/ColumnInternalApi");
|
|
10
9
|
class ColumnApiImpl extends ApiBase_1.ApiBase {
|
|
@@ -58,7 +57,7 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
|
|
|
58
57
|
// put this here as there might be other indicators we are not aware of
|
|
59
58
|
// perhaps with non auto groups ?
|
|
60
59
|
//https://www.ag-grid.com/javascript-grid-grouping/
|
|
61
|
-
return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(
|
|
60
|
+
return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_GROUPED_COLUMN);
|
|
62
61
|
}
|
|
63
62
|
isAutoPivotColumn(columnId) {
|
|
64
63
|
// put this here as there might be other indicators we are not aware of?
|
|
@@ -60,9 +60,11 @@ class DashboardApiImpl extends ApiBase_1.ApiBase {
|
|
|
60
60
|
return document.getElementById(this.internalApi.getCustomToolbarRenderContainerId(customToolbarName));
|
|
61
61
|
}
|
|
62
62
|
if (customToolbar.toolbarButtons) {
|
|
63
|
+
this.logWarn(`(get/set)CustomToolbarHTMLElement(${customToolbarName}) should only be used in Vanilla AdapTable for toolbars created via a 'render' function! For React/Adaptable components let the framework renderer handle it!`);
|
|
63
64
|
return document.getElementById(this.internalApi.getCustomToolbarButtonsContainerId(customToolbarName));
|
|
64
65
|
}
|
|
65
66
|
if (customToolbar.frameworkComponent) {
|
|
67
|
+
this.logWarn(`(get/set)CustomToolbarHTMLElement(${customToolbarName}) should only be used in Vanilla AdapTable for toolbars created via a 'render' function! For React/Adaptable components let the framework renderer handle it!`);
|
|
66
68
|
return document.getElementById(this.internalApi.getCustomToolbarComponentContainerId(customToolbarName));
|
|
67
69
|
}
|
|
68
70
|
}
|
|
@@ -43,5 +43,5 @@ export declare class OptionsApiImpl extends ApiBase implements OptionsApi {
|
|
|
43
43
|
getFlashingCellOptions(): FlashingCellOptions;
|
|
44
44
|
getSettingsPanelOptions(): SettingsPanelOptions;
|
|
45
45
|
getFdc3Options(): Fdc3Options;
|
|
46
|
-
getDataImportOptions(): import("../../types").DataImportOptions<Record<string,
|
|
46
|
+
getDataImportOptions(): import("../../types").DataImportOptions<Record<string, any>>;
|
|
47
47
|
}
|
|
@@ -12,11 +12,21 @@ class DashboardInternalApi extends ApiBase_1.ApiBase {
|
|
|
12
12
|
const isToolbarStateChangedToVisible = (toolbarName) => {
|
|
13
13
|
const visibleInNewState = this.isToolbarInActiveTab(toolbarName, newDashboardState);
|
|
14
14
|
const visibleInOldState = this.isToolbarInActiveTab(toolbarName, oldDashboardState);
|
|
15
|
+
if (visibleInNewState && visibleInOldState) {
|
|
16
|
+
// check for dashboard collapse/expand/hidden changes
|
|
17
|
+
return ((oldDashboardState.IsCollapsed && !newDashboardState.IsCollapsed) ||
|
|
18
|
+
(oldDashboardState.IsHidden && !newDashboardState.IsHidden));
|
|
19
|
+
}
|
|
15
20
|
return visibleInNewState && !visibleInOldState;
|
|
16
21
|
};
|
|
17
22
|
const isToolbarStateChangedToHidden = (toolbarName) => {
|
|
18
23
|
const visibleInNewState = this.isToolbarInActiveTab(toolbarName, newDashboardState);
|
|
19
24
|
const visibleInOldState = this.isToolbarInActiveTab(toolbarName, oldDashboardState);
|
|
25
|
+
if (visibleInNewState && visibleInOldState) {
|
|
26
|
+
// check for dashboard collapse/expand/hidden changes
|
|
27
|
+
return ((!oldDashboardState.IsCollapsed && newDashboardState.IsCollapsed) ||
|
|
28
|
+
(!oldDashboardState.IsHidden && newDashboardState.IsHidden));
|
|
29
|
+
}
|
|
20
30
|
return visibleInOldState && !visibleInNewState;
|
|
21
31
|
};
|
|
22
32
|
const dashboardChangedInfo = {
|
|
@@ -30,7 +40,7 @@ class DashboardInternalApi extends ApiBase_1.ApiBase {
|
|
|
30
40
|
adaptableId: this.adaptable.api.optionsApi.getAdaptableId(),
|
|
31
41
|
};
|
|
32
42
|
if (!(0, isEqual_1.default)(oldDashboardState, newDashboardState)) {
|
|
33
|
-
this.adaptable.api.eventApi.
|
|
43
|
+
setTimeout(() => this.adaptable.api.eventApi.emit('DashboardChanged', dashboardChangedInfo));
|
|
34
44
|
}
|
|
35
45
|
}
|
|
36
46
|
isToolbarInActiveTab(toolbarName, dashboardState) {
|
|
@@ -8,9 +8,6 @@ class DataImportInternalApi extends ApiBase_1.ApiBase {
|
|
|
8
8
|
async importData(partialRows) {
|
|
9
9
|
const dataImportOptions = this.getOptions().dataImportOptions;
|
|
10
10
|
let importData = partialRows;
|
|
11
|
-
if (typeof dataImportOptions._preprocessData === 'function') {
|
|
12
|
-
importData = dataImportOptions._preprocessData(Object.assign({ data: partialRows }, (0, ObjectFactory_1.createBaseContext)(this.getAdaptableApi())));
|
|
13
|
-
}
|
|
14
11
|
if (typeof dataImportOptions.handleImportedData === 'function') {
|
|
15
12
|
const resolution = await dataImportOptions.handleImportedData(Object.assign({ data: importData }, (0, ObjectFactory_1.createBaseContext)(this.getAdaptableApi())));
|
|
16
13
|
if (resolution && (resolution === null || resolution === void 0 ? void 0 : resolution.emitDataImportedEvent)) {
|
|
@@ -32,6 +32,20 @@ const DataImportWizard = (props) => {
|
|
|
32
32
|
}
|
|
33
33
|
return rowData[primaryKey];
|
|
34
34
|
};
|
|
35
|
+
const preprocessRowData = (rowData) => {
|
|
36
|
+
if (typeof (dataImportOptions === null || dataImportOptions === void 0 ? void 0 : dataImportOptions._preprocessRowData) === 'function') {
|
|
37
|
+
return dataImportOptions._preprocessRowData(Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(adaptable.api)), { rowData }));
|
|
38
|
+
}
|
|
39
|
+
// by default just trim the keys
|
|
40
|
+
let processedRowData = {};
|
|
41
|
+
if (rowData) {
|
|
42
|
+
processedRowData = Object.keys(rowData).reduce((acc, key) => {
|
|
43
|
+
acc[key.trim()] = rowData[key];
|
|
44
|
+
return acc;
|
|
45
|
+
}, processedRowData);
|
|
46
|
+
}
|
|
47
|
+
return processedRowData;
|
|
48
|
+
};
|
|
35
49
|
// ---- COLUMNS ----
|
|
36
50
|
const [columnsMap, setColumnsMap] = React.useState(null);
|
|
37
51
|
const mappedRowDataToColumns = React.useMemo(() => {
|
|
@@ -57,9 +71,10 @@ const DataImportWizard = (props) => {
|
|
|
57
71
|
}, [columnsMap]);
|
|
58
72
|
const handleNewRowData = React.useCallback((data) => {
|
|
59
73
|
if (Array.isArray(data)) {
|
|
60
|
-
|
|
74
|
+
const processedData = data.map((rowData) => preprocessRowData(rowData));
|
|
75
|
+
setRowData(processedData);
|
|
61
76
|
const fields = new Set();
|
|
62
|
-
|
|
77
|
+
processedData.forEach((row) => {
|
|
63
78
|
Object.keys(row).forEach((field) => {
|
|
64
79
|
fields.add(field);
|
|
65
80
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DataImportFileHandler } from '../../types';
|
|
2
2
|
export declare const parseCSV: (content: string) => Record<string, unknown>[];
|
|
3
|
-
export declare const systemFileHandlers: DataImportFileHandler<Record<string,
|
|
3
|
+
export declare const systemFileHandlers: DataImportFileHandler<Record<string, any>>[];
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -1626,7 +1626,7 @@ class Adaptable {
|
|
|
1626
1626
|
.columnApi.getColumnState()
|
|
1627
1627
|
.reduce((acc, col) => {
|
|
1628
1628
|
var _a;
|
|
1629
|
-
if (col.colId
|
|
1629
|
+
if (this.api.columnApi.isAutoRowGroupColumn(col.colId)) {
|
|
1630
1630
|
const widthInLayout = (_a = layout.ColumnWidthMap) === null || _a === void 0 ? void 0 : _a[col.colId];
|
|
1631
1631
|
if (widthInLayout && widthInLayout !== col.width) {
|
|
1632
1632
|
acc.push(Object.assign(Object.assign({}, col), { width: widthInLayout }));
|
|
@@ -4108,16 +4108,6 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
4108
4108
|
defVal?: undefined;
|
|
4109
4109
|
})[];
|
|
4110
4110
|
};
|
|
4111
|
-
PreprocessDataContext: {
|
|
4112
|
-
name: string;
|
|
4113
|
-
kind: string;
|
|
4114
|
-
desc: string;
|
|
4115
|
-
props: {
|
|
4116
|
-
name: string;
|
|
4117
|
-
kind: string;
|
|
4118
|
-
desc: string;
|
|
4119
|
-
}[];
|
|
4120
|
-
};
|
|
4121
4111
|
PreProcessExportContext: {
|
|
4122
4112
|
name: string;
|
|
4123
4113
|
kind: string;
|
|
@@ -4134,6 +4124,16 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
4134
4124
|
ref: string;
|
|
4135
4125
|
})[];
|
|
4136
4126
|
};
|
|
4127
|
+
PreprocessRowDataContext: {
|
|
4128
|
+
name: string;
|
|
4129
|
+
kind: string;
|
|
4130
|
+
desc: string;
|
|
4131
|
+
props: {
|
|
4132
|
+
name: string;
|
|
4133
|
+
kind: string;
|
|
4134
|
+
desc: string;
|
|
4135
|
+
}[];
|
|
4136
|
+
};
|
|
4137
4137
|
QueryableColumnContext: {
|
|
4138
4138
|
name: string;
|
|
4139
4139
|
kind: string;
|