@adaptabletools/adaptable 16.2.2 → 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 +63 -63
- 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/OptionsApiImpl.d.ts +1 -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/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/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
|
*/
|
|
@@ -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
|
}
|
|
@@ -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>>[];
|
|
@@ -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;
|