@adaptabletools/adaptable 16.1.1-canary.2 → 16.2.0-canary.1
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/base.css +6 -1
- package/base.css.map +1 -1
- package/bundle.cjs.js +195 -197
- package/index.css +10 -1
- package/index.css.map +1 -1
- package/package.json +2 -2
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +1 -1
- package/src/AdaptableOptions/DataImportOptions.d.ts +17 -5
- package/src/AdaptableOptions/GroupingOptions.d.ts +1 -1
- package/src/AdaptableOptions/MenuOptions.d.ts +1 -1
- package/src/Api/ColumnApi.d.ts +3 -3
- package/src/Api/EventApi.d.ts +13 -2
- package/src/Api/Events/DataImported.d.ts +22 -0
- package/src/Api/Events/DataImported.js +2 -0
- package/src/Api/Internal/AlertInternalApi.d.ts +3 -2
- package/src/Api/Internal/AlertInternalApi.js +35 -5
- package/src/Api/Internal/DataImportInternalApi.d.ts +5 -0
- package/src/Api/Internal/DataImportInternalApi.js +28 -10
- package/src/Api/Internal/FilterInternalApi.d.ts +1 -1
- package/src/Api/Internal/FilterInternalApi.js +1 -1
- package/src/Api/Internal/GridInternalApi.js +1 -0
- package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +3 -3
- package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +1 -1
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +4 -4
- package/src/PredefinedConfig/Common/Fdc3Intent.js +4 -19
- package/src/PredefinedConfig/Common/Menu.d.ts +2 -2
- package/src/PredefinedConfig/DashboardState.d.ts +4 -0
- package/src/Redux/ActionsReducers/DashboardRedux.d.ts +11 -0
- package/src/Redux/ActionsReducers/DashboardRedux.js +14 -1
- package/src/Strategy/AlertModule.js +14 -31
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +3 -1
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +2 -0
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +14 -2
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +1 -1
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +93 -1
- package/src/Utilities/Services/AlertService.js +13 -6
- package/src/Utilities/Services/DataService.d.ts +4 -1
- package/src/Utilities/Services/DataService.js +10 -5
- package/src/Utilities/Services/Interface/IAlertService.d.ts +12 -3
- package/src/Utilities/Services/Interface/IAlertService.js +9 -0
- package/src/Utilities/Services/Interface/IDataService.d.ts +3 -0
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +2 -1
- package/src/Utilities/Services/ModuleService.js +2 -0
- package/src/Utilities/Services/QueryLanguageService.d.ts +2 -2
- package/src/View/Components/Selectors/ColumnSelector.js +0 -5
- package/src/View/Dashboard/{CustomToolbarWrapper.d.ts → CustomToolbar.d.ts} +1 -0
- package/src/View/Dashboard/{CustomToolbarWrapper.js → CustomToolbar.js} +36 -33
- package/src/View/Dashboard/Dashboard.d.ts +2 -2
- package/src/View/Dashboard/Dashboard.js +20 -24
- package/src/View/Dashboard/DashboardPopup.d.ts +2 -1
- package/src/View/Dashboard/DashboardPopup.js +7 -3
- package/src/View/Dashboard/DashboardToolbarFactory.d.ts +7 -0
- package/src/View/Dashboard/DashboardToolbarFactory.js +46 -0
- package/src/View/Dashboard/PinnedDashboard.d.ts +5 -0
- package/src/View/Dashboard/PinnedDashboard.js +21 -0
- package/src/View/Dashboard/PinnedToolbarsSelector.d.ts +5 -0
- package/src/View/Dashboard/PinnedToolbarsSelector.js +52 -0
- package/src/View/DataImport/DataImportPopup.js +1 -1
- package/src/View/DataImport/DataImportWizard/DataImportWizard.d.ts +6 -1
- package/src/View/DataImport/DataImportWizard/DataImportWizard.js +71 -9
- package/src/View/DataImport/DataImportWizard/sections/ColumnsSection.d.ts +8 -0
- package/src/View/DataImport/DataImportWizard/sections/ColumnsSection.js +119 -0
- package/src/View/DataImport/DataImportWizard/sections/DataPreview.d.ts +2 -1
- package/src/View/DataImport/DataImportWizard/sections/DataPreview.js +13 -17
- package/src/View/DataImport/DataImportWizard/sections/ValidationSection.d.ts +2 -1
- package/src/View/DataImport/DataImportWizard/sections/ValidationSection.js +1 -1
- package/src/View/QuickSearch/QuickSearchInput.js +1 -1
- package/src/components/Dashboard/Dashboard.d.ts +1 -0
- package/src/components/Dashboard/Dashboard.js +2 -1
- package/src/components/DragAndDropContext/ModuleManager.js +1 -1
- package/src/components/DragAndDropContext/TabList.js +1 -1
- package/src/components/ExpressionEditor/editorButtonsObservable.js +10 -0
- package/src/metamodel/adaptable.metamodel.d.ts +20 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/index.js +4 -1
- package/src/parser/src/tokenizer.js +5 -2
- package/src/types.d.ts +2 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -9,6 +9,7 @@ const ObjectFactory_1 = require("../../../Utilities/ObjectFactory");
|
|
|
9
9
|
const AdaptableContext_1 = require("../../AdaptableContext");
|
|
10
10
|
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
11
11
|
const systemFileHandlers_1 = require("../systemFileHandlers");
|
|
12
|
+
const ColumnsSection_1 = require("./sections/ColumnsSection");
|
|
12
13
|
const UploadSection_1 = require("./sections/UploadSection");
|
|
13
14
|
const ValidationSection_1 = require("./sections/ValidationSection");
|
|
14
15
|
const DataImportWizard = (props) => {
|
|
@@ -19,6 +20,9 @@ const DataImportWizard = (props) => {
|
|
|
19
20
|
const [rowData, setRowData] = React.useState(null);
|
|
20
21
|
const [file, setFile] = React.useState(null);
|
|
21
22
|
const [text, setText] = React.useState('');
|
|
23
|
+
// This needs to be called only when:
|
|
24
|
+
// - columnsMap changes
|
|
25
|
+
// - new data is loaded
|
|
22
26
|
const [importType, setImportType] = React.useState('file');
|
|
23
27
|
const primaryKey = adaptable.api.optionsApi.getPrimaryKey();
|
|
24
28
|
const getPrimaryKeyValue = (rowData) => {
|
|
@@ -27,6 +31,50 @@ const DataImportWizard = (props) => {
|
|
|
27
31
|
}
|
|
28
32
|
return rowData[primaryKey];
|
|
29
33
|
};
|
|
34
|
+
// ---- COLUMNS ----
|
|
35
|
+
const [columnsMap, setColumnsMap] = React.useState(null);
|
|
36
|
+
const mappedRowDataToColumns = React.useMemo(() => {
|
|
37
|
+
return (rowData !== null && rowData !== void 0 ? rowData : []).map((row) => {
|
|
38
|
+
// pick only included columns, and need to map to abColumn.field
|
|
39
|
+
return columnsMap === null || columnsMap === void 0 ? void 0 : columnsMap.reduce((acc, colMap) => {
|
|
40
|
+
if (colMap.include && colMap.abColumn && colMap.abColumn.field) {
|
|
41
|
+
acc[colMap.abColumn.field] = row[colMap.field];
|
|
42
|
+
}
|
|
43
|
+
return acc;
|
|
44
|
+
}, {});
|
|
45
|
+
});
|
|
46
|
+
}, [rowData, columnsMap]);
|
|
47
|
+
const columnsErrors = React.useMemo(() => {
|
|
48
|
+
return columnsMap
|
|
49
|
+
? columnsMap.reduce((acc, colMap) => {
|
|
50
|
+
if (colMap.include && !colMap.abColumn) {
|
|
51
|
+
acc[colMap.field] = `Field ${colMap.field} does not have a coresponding column.`;
|
|
52
|
+
}
|
|
53
|
+
return acc;
|
|
54
|
+
}, {})
|
|
55
|
+
: null;
|
|
56
|
+
}, [columnsMap]);
|
|
57
|
+
const handleNewRowData = React.useCallback((data) => {
|
|
58
|
+
if (Array.isArray(data)) {
|
|
59
|
+
setRowData(data);
|
|
60
|
+
const fields = new Set();
|
|
61
|
+
data.forEach((row) => {
|
|
62
|
+
Object.keys(row).forEach((field) => {
|
|
63
|
+
fields.add(field);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const allAbColumns = adaptable.api.columnApi.getColumns();
|
|
67
|
+
const columnsMap = Array.from(fields).map((field) => {
|
|
68
|
+
const abColumn = allAbColumns.find((c) => c.field === field);
|
|
69
|
+
return { field, abColumn, include: true };
|
|
70
|
+
});
|
|
71
|
+
setColumnsMap(columnsMap);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
setRowData(null);
|
|
75
|
+
setColumnsMap(null);
|
|
76
|
+
}
|
|
77
|
+
}, []);
|
|
30
78
|
const handleRowDataChange = React.useCallback((data) => {
|
|
31
79
|
if (Array.isArray(data)) {
|
|
32
80
|
setRowData(data);
|
|
@@ -38,7 +86,7 @@ const DataImportWizard = (props) => {
|
|
|
38
86
|
const handleChangeImportType = React.useCallback((importType) => {
|
|
39
87
|
setImportType(importType);
|
|
40
88
|
// clear data
|
|
41
|
-
|
|
89
|
+
handleNewRowData(null);
|
|
42
90
|
setFile(null);
|
|
43
91
|
setText('');
|
|
44
92
|
}, []);
|
|
@@ -63,7 +111,7 @@ const DataImportWizard = (props) => {
|
|
|
63
111
|
try {
|
|
64
112
|
const data = await handler.handleFile(file);
|
|
65
113
|
setFile(file);
|
|
66
|
-
|
|
114
|
+
handleNewRowData(data);
|
|
67
115
|
return data;
|
|
68
116
|
}
|
|
69
117
|
catch (_c) {
|
|
@@ -101,7 +149,7 @@ const DataImportWizard = (props) => {
|
|
|
101
149
|
try {
|
|
102
150
|
textRawData = await textHandler(text);
|
|
103
151
|
if (Array.isArray(textRawData)) {
|
|
104
|
-
|
|
152
|
+
handleNewRowData(textRawData);
|
|
105
153
|
setTextError('');
|
|
106
154
|
}
|
|
107
155
|
else {
|
|
@@ -109,7 +157,7 @@ const DataImportWizard = (props) => {
|
|
|
109
157
|
}
|
|
110
158
|
}
|
|
111
159
|
catch (_b) {
|
|
112
|
-
|
|
160
|
+
handleNewRowData(null);
|
|
113
161
|
setTextError('Error parsing text');
|
|
114
162
|
}
|
|
115
163
|
}
|
|
@@ -134,11 +182,8 @@ const DataImportWizard = (props) => {
|
|
|
134
182
|
}, {});
|
|
135
183
|
}, [rowData])) !== null && _a !== void 0 ? _a : {};
|
|
136
184
|
const [skipInvalidRows, setSkipInvalidRows] = React.useState(false);
|
|
137
|
-
const handleValidationDataChange = (data) => {
|
|
138
|
-
handleRowDataChange(data);
|
|
139
|
-
};
|
|
140
185
|
const handleFinish = () => {
|
|
141
|
-
const validData =
|
|
186
|
+
const validData = mappedRowDataToColumns.filter((row) => {
|
|
142
187
|
const rowErrors = errors[getPrimaryKeyValue(row)];
|
|
143
188
|
return !rowErrors || rowErrors.length === 0;
|
|
144
189
|
});
|
|
@@ -164,6 +209,23 @@ const DataImportWizard = (props) => {
|
|
|
164
209
|
text: text, onTextChange: handleTextChange, textMessage: textMessage }));
|
|
165
210
|
},
|
|
166
211
|
},
|
|
212
|
+
{
|
|
213
|
+
title: 'Columns',
|
|
214
|
+
isValid: () => {
|
|
215
|
+
if (columnsErrors && Object.keys(columnsErrors).length > 0) {
|
|
216
|
+
return 'Some fields do not have a corresponding column.';
|
|
217
|
+
}
|
|
218
|
+
if (!(columnsMap === null || columnsMap === void 0 ? void 0 : columnsMap.some((map) => { var _a; return ((_a = map === null || map === void 0 ? void 0 : map.abColumn) === null || _a === void 0 ? void 0 : _a.field) === primaryKey; }))) {
|
|
219
|
+
return 'You need to select a column for the primary key.';
|
|
220
|
+
}
|
|
221
|
+
return true;
|
|
222
|
+
},
|
|
223
|
+
render: () => {
|
|
224
|
+
return (React.createElement(ColumnsSection_1.ColumnsSection, { columnsMap: columnsMap, onColumnsChange: (columnsMap) => {
|
|
225
|
+
setColumnsMap(columnsMap);
|
|
226
|
+
} }));
|
|
227
|
+
},
|
|
228
|
+
},
|
|
167
229
|
{
|
|
168
230
|
title: 'Validation',
|
|
169
231
|
details: 'Check the Data is Valid',
|
|
@@ -175,7 +237,7 @@ const DataImportWizard = (props) => {
|
|
|
175
237
|
return true;
|
|
176
238
|
},
|
|
177
239
|
render: () => {
|
|
178
|
-
return (React.createElement(ValidationSection_1.ValidationSection, { errors: errors, data: rowData, onDataChange:
|
|
240
|
+
return (React.createElement(ValidationSection_1.ValidationSection, { errors: errors, data: rowData, columnsMap: columnsMap, onDataChange: handleRowDataChange, skipInvalidRows: skipInvalidRows, onSkipInvalidRowsChange: setSkipInvalidRows }));
|
|
179
241
|
},
|
|
180
242
|
},
|
|
181
243
|
] }));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ColumnsMap } from '../DataImportWizard';
|
|
3
|
+
interface ColumnsSectionProps {
|
|
4
|
+
columnsMap: ColumnsMap[] | null;
|
|
5
|
+
onColumnsChange: (columns: ColumnsMap[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ColumnsSection: React.FunctionComponent<ColumnsSectionProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnsSection = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const CheckBox_1 = require("../../../../components/CheckBox");
|
|
8
|
+
const DropdownButton_1 = tslib_1.__importDefault(require("../../../../components/DropdownButton"));
|
|
9
|
+
const HelpBlock_1 = tslib_1.__importDefault(require("../../../../components/HelpBlock"));
|
|
10
|
+
const icons_1 = require("../../../../components/icons");
|
|
11
|
+
const InfiniteTable_1 = require("../../../../components/InfiniteTable");
|
|
12
|
+
const Tabs_1 = require("../../../../components/Tabs");
|
|
13
|
+
const Tag_1 = require("../../../../components/Tag");
|
|
14
|
+
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
15
|
+
const AdaptablePopover_1 = require("../../../AdaptablePopover");
|
|
16
|
+
const UIHelper_1 = tslib_1.__importDefault(require("../../../UIHelper"));
|
|
17
|
+
const tableDOMProps = {
|
|
18
|
+
style: {
|
|
19
|
+
height: '100%',
|
|
20
|
+
minWidth: '10rem',
|
|
21
|
+
minHeight: 300,
|
|
22
|
+
flex: 1,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const ColumnsSection = (props) => {
|
|
26
|
+
const { api } = (0, AdaptableContext_1.useAdaptable)();
|
|
27
|
+
const primaryKey = api.optionsApi.getPrimaryKey();
|
|
28
|
+
const allColumns = React.useMemo(() => {
|
|
29
|
+
return api.columnApi
|
|
30
|
+
.getColumns()
|
|
31
|
+
.filter((col) => col.field)
|
|
32
|
+
.map((column) => ({
|
|
33
|
+
label: column.friendlyName,
|
|
34
|
+
value: column,
|
|
35
|
+
}));
|
|
36
|
+
}, []);
|
|
37
|
+
const handleColumnMapChange = (newColMap) => {
|
|
38
|
+
var _a;
|
|
39
|
+
props.onColumnsChange((_a = props.columnsMap) === null || _a === void 0 ? void 0 : _a.map((cm) => {
|
|
40
|
+
if (cm.field === newColMap.field) {
|
|
41
|
+
return Object.assign(Object.assign({}, cm), newColMap);
|
|
42
|
+
}
|
|
43
|
+
return cm;
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
const columns = React.useMemo(() => {
|
|
47
|
+
return {
|
|
48
|
+
include: {
|
|
49
|
+
field: 'include',
|
|
50
|
+
header: 'Included',
|
|
51
|
+
maxWidth: 110,
|
|
52
|
+
align: 'center',
|
|
53
|
+
render: (params) => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
return (React.createElement(CheckBox_1.CheckBox, { disabled: ((_b = (_a = params.data) === null || _a === void 0 ? void 0 : _a.abColumn) === null || _b === void 0 ? void 0 : _b.field) === primaryKey, onChange: (checked) => {
|
|
56
|
+
handleColumnMapChange(Object.assign(Object.assign({}, params.data), { include: checked }));
|
|
57
|
+
}, checked: Boolean(params.data.include) }));
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
field: {
|
|
61
|
+
field: 'field',
|
|
62
|
+
header: 'Data Field',
|
|
63
|
+
},
|
|
64
|
+
abColumn: {
|
|
65
|
+
header: 'AdapTable Column',
|
|
66
|
+
render: (params) => {
|
|
67
|
+
var _a, _b, _c, _d, _e, _f;
|
|
68
|
+
// filter out used columns
|
|
69
|
+
const availableColumns = allColumns
|
|
70
|
+
.filter((c) => { var _a; return !((_a = props.columnsMap) === null || _a === void 0 ? void 0 : _a.find((cm) => cm.abColumn === c.value)); })
|
|
71
|
+
.map((col) => {
|
|
72
|
+
return Object.assign(Object.assign({}, col), { onClick: () => {
|
|
73
|
+
handleColumnMapChange(Object.assign(Object.assign({}, params.data), { abColumn: col.value, include: true }));
|
|
74
|
+
} });
|
|
75
|
+
});
|
|
76
|
+
return (React.createElement(DropdownButton_1.default, { showClearButton: true, onClear: () => {
|
|
77
|
+
handleColumnMapChange(Object.assign(Object.assign({}, params.data), { abColumn: null, include: false }));
|
|
78
|
+
}, width: "100%", columns: ['label'], items: availableColumns }, (_f = (_c = (_b = (_a = params.data) === null || _a === void 0 ? void 0 : _a.abColumn) === null || _b === void 0 ? void 0 : _b.friendlyName) !== null && _c !== void 0 ? _c : (_e = (_d = params.data) === null || _d === void 0 ? void 0 : _d.abColumn) === null || _e === void 0 ? void 0 : _e.columnId) !== null && _f !== void 0 ? _f : 'Select Column'));
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
valid: {
|
|
82
|
+
header: 'Valid',
|
|
83
|
+
maxWidth: 100,
|
|
84
|
+
minWidth: 90,
|
|
85
|
+
align: 'center',
|
|
86
|
+
render: (row) => {
|
|
87
|
+
if (!row.data.abColumn) {
|
|
88
|
+
return (React.createElement(AdaptablePopover_1.AdaptablePopover, { popoverMinWidth: 200, showEvent: "mouseenter", hideEvent: "mouseleave", headerText: 'Validation Error', bodyText: ['Select Column'], MessageType: 'Error' }));
|
|
89
|
+
}
|
|
90
|
+
const successColor = UIHelper_1.default.getColorByMessageType('Success');
|
|
91
|
+
return React.createElement(icons_1.Icon, { name: "check", style: { color: successColor, fill: 'currentColor' } });
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}, [props.columnsMap]);
|
|
96
|
+
if (!props.columnsMap) {
|
|
97
|
+
return (React.createElement(rebass_1.Box, { p: 2 },
|
|
98
|
+
React.createElement(HelpBlock_1.default, { color: 'var(--ab-color-error)' },
|
|
99
|
+
"No Data has been Imported. Go to ",
|
|
100
|
+
React.createElement(Tag_1.Tag, null, "Upload"),
|
|
101
|
+
" step and provide Data")));
|
|
102
|
+
}
|
|
103
|
+
return (React.createElement(rebass_1.Flex, { flexDirection: "column", p: 2, height: "100%" },
|
|
104
|
+
React.createElement(Tabs_1.Tabs, { mb: 2, height: "100%" },
|
|
105
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Columns"),
|
|
106
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
107
|
+
React.createElement(InfiniteTable_1.DataSource, { data: props.columnsMap, primaryKey: 'field' },
|
|
108
|
+
React.createElement(InfiniteTable_1.InfiniteTable, { columnPinning: {
|
|
109
|
+
valid: 'end',
|
|
110
|
+
type: 'end',
|
|
111
|
+
}, columnTypes: {
|
|
112
|
+
default: {
|
|
113
|
+
minWidth: 100,
|
|
114
|
+
defaultFlex: 1,
|
|
115
|
+
},
|
|
116
|
+
}, domProps: tableDOMProps, columns: columns }))))));
|
|
117
|
+
};
|
|
118
|
+
exports.ColumnsSection = ColumnsSection;
|
|
119
|
+
exports.ColumnsSection.displayName = 'ColumnsSection';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ValidationErrorsMap } from '../DataImportWizard';
|
|
2
|
+
import { ColumnsMap, ValidationErrorsMap } from '../DataImportWizard';
|
|
3
3
|
interface DataPreviewProps {
|
|
4
4
|
data?: Record<string, unknown>[];
|
|
5
5
|
onDataChange?: (data: Record<string, unknown>[]) => void;
|
|
6
6
|
errors: ValidationErrorsMap | null;
|
|
7
7
|
editable?: boolean;
|
|
8
|
+
columnsMap?: ColumnsMap[] | null;
|
|
8
9
|
}
|
|
9
10
|
export declare const DataPreview: React.FunctionComponent<DataPreviewProps>;
|
|
10
11
|
export {};
|
|
@@ -43,15 +43,9 @@ const DataPreview = (props) => {
|
|
|
43
43
|
" step and provide Data"));
|
|
44
44
|
}
|
|
45
45
|
const primaryKey = adaptable.api.optionsApi.getPrimaryKey();
|
|
46
|
-
const dataSample = props.data[0];
|
|
47
46
|
const columns = React.useMemo(() => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
const adaptableColumnsInData = adaptable.api.columnApi.getColumns().filter((c) => {
|
|
52
|
-
var _a;
|
|
53
|
-
return dataSample && ((_a = c.field) !== null && _a !== void 0 ? _a : c.columnId) in dataSample;
|
|
54
|
-
});
|
|
47
|
+
var _a;
|
|
48
|
+
const mappedAdaptableColumns = (_a = props.columnsMap) === null || _a === void 0 ? void 0 : _a.filter((map) => map.include && map.abColumn);
|
|
55
49
|
const mapDataType = (dataType) => {
|
|
56
50
|
switch (dataType) {
|
|
57
51
|
case 'Boolean':
|
|
@@ -69,23 +63,25 @@ const DataPreview = (props) => {
|
|
|
69
63
|
}
|
|
70
64
|
return rowData[primaryKey];
|
|
71
65
|
};
|
|
72
|
-
const infiniteColumns =
|
|
73
|
-
|
|
66
|
+
const infiniteColumns = mappedAdaptableColumns.reduce((acc, colMap) => {
|
|
67
|
+
var _a;
|
|
68
|
+
const isPrimaryKey = ((_a = colMap === null || colMap === void 0 ? void 0 : colMap.abColumn) === null || _a === void 0 ? void 0 : _a.columnId) === primaryKey;
|
|
74
69
|
let editable = !isPrimaryKey;
|
|
75
70
|
if (props.editable !== undefined && !isPrimaryKey) {
|
|
76
71
|
editable = props.editable;
|
|
77
72
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
const abColumn = colMap.abColumn;
|
|
74
|
+
acc[colMap.field] = {
|
|
75
|
+
field: colMap.field,
|
|
76
|
+
header: adaptable.api.columnApi.getFriendlyNameForColumnId(colMap.abColumn.columnId),
|
|
77
|
+
dataType: mapDataType(abColumn.dataType),
|
|
82
78
|
defaultEditable: editable,
|
|
83
79
|
valueGetter: (params) => {
|
|
84
|
-
if (
|
|
85
|
-
return params.data[
|
|
80
|
+
if (abColumn.dataType === 'Boolean') {
|
|
81
|
+
return params.data[colMap.field] ? 'True' : 'False';
|
|
86
82
|
}
|
|
87
83
|
else {
|
|
88
|
-
return params.data[
|
|
84
|
+
return params.data[colMap.field];
|
|
89
85
|
}
|
|
90
86
|
},
|
|
91
87
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ValidationErrorsMap } from '../DataImportWizard';
|
|
2
|
+
import { ColumnsMap, ValidationErrorsMap } from '../DataImportWizard';
|
|
3
3
|
interface ValidationSectionProps {
|
|
4
4
|
data?: Record<string, unknown>[];
|
|
5
5
|
onDataChange?: (data: Record<string, unknown>[]) => void;
|
|
6
6
|
errors: ValidationErrorsMap | null;
|
|
7
7
|
skipInvalidRows: boolean;
|
|
8
8
|
onSkipInvalidRowsChange: (skipInvalidRows: boolean) => void;
|
|
9
|
+
columnsMap: ColumnsMap[] | null;
|
|
9
10
|
}
|
|
10
11
|
export declare const ValidationSection: React.FunctionComponent<ValidationSectionProps>;
|
|
11
12
|
export {};
|
|
@@ -30,6 +30,6 @@ const ValidationSection = (props) => {
|
|
|
30
30
|
React.createElement(Tabs_1.Tabs, { flex: 1 },
|
|
31
31
|
React.createElement(Tabs_1.Tabs.Tab, null, "Preview"),
|
|
32
32
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
33
|
-
React.createElement(DataPreview_1.DataPreview, { data: props.data, errors: props.errors, editable: true, onDataChange: props.onDataChange })))));
|
|
33
|
+
React.createElement(DataPreview_1.DataPreview, { columnsMap: props.columnsMap, data: props.data, errors: props.errors, editable: true, onDataChange: props.onDataChange })))));
|
|
34
34
|
};
|
|
35
35
|
exports.ValidationSection = ValidationSection;
|
|
@@ -17,6 +17,6 @@ const QuickSearchInput = (props) => {
|
|
|
17
17
|
QuickSearchText,
|
|
18
18
|
onRunQuickSearch,
|
|
19
19
|
});
|
|
20
|
-
return (react_1.default.createElement(AdaptableFormControlTextClear_1.AdaptableFormControlTextClear, { type: "text", autoFocus: props.autoFocus, placeholder: adaptable.api.optionsApi.getQuickSearchOptions().quickSearchPlaceholder, className: props.className, value: searchText, OnTextChange: search, style: { height: '100%' }, inputStyle: { width: '
|
|
20
|
+
return (react_1.default.createElement(AdaptableFormControlTextClear_1.AdaptableFormControlTextClear, { type: "text", autoFocus: props.autoFocus, placeholder: adaptable.api.optionsApi.getQuickSearchOptions().quickSearchPlaceholder, className: props.className, value: searchText, OnTextChange: search, style: { height: '100%' }, inputStyle: { width: '10rem' } }));
|
|
21
21
|
};
|
|
22
22
|
exports.QuickSearchInput = QuickSearchInput;
|
|
@@ -78,6 +78,7 @@ function Dashboard(props) {
|
|
|
78
78
|
// @ts-ignore
|
|
79
79
|
ref: targetRef, className: (0, join_1.default)(`ab-Dashboard`, collapsed ? 'ab-Dashboard--collapsed' : '', floating ? 'ab-Dashboard--floating' : '', inline ? 'ab-Dashboard--inline' : ''), style: floating ? floatingStyle : undefined },
|
|
80
80
|
expanded && inline ? renderHomeToolbar() : renderBar(),
|
|
81
|
-
expanded && children && children.length ? (React.createElement("div", { className: "ab-Dashboard__content" }, children[activeTabIndex] ? children[activeTabIndex].props.children : null)) : null
|
|
81
|
+
expanded && children && children.length ? (React.createElement("div", { className: "ab-Dashboard__content" }, children[activeTabIndex] ? children[activeTabIndex].props.children : null)) : null,
|
|
82
|
+
props.footer));
|
|
82
83
|
}
|
|
83
84
|
exports.Dashboard = Dashboard;
|
|
@@ -21,7 +21,7 @@ const ModuleManager = (props) => {
|
|
|
21
21
|
const unusedItems = React.useMemo(() => availableItems
|
|
22
22
|
.map((t) => t.Id)
|
|
23
23
|
.filter((item) => {
|
|
24
|
-
return !tabs.some((tab) => tab.Items.includes(item));
|
|
24
|
+
return !tabs.some((tab) => { var _a; return (_a = tab.Items) === null || _a === void 0 ? void 0 : _a.includes(item); });
|
|
25
25
|
}), [tabs, availableItems]);
|
|
26
26
|
const handleToolbarDragEnd = (result) => {
|
|
27
27
|
const { source, destination, draggableId } = result;
|
|
@@ -33,7 +33,7 @@ function TabItem({ tab, tabIndex, onRemove, onRemoveToolbar, onChangeTabName, di
|
|
|
33
33
|
}
|
|
34
34
|
exports.TabItem = TabItem;
|
|
35
35
|
function ToolbarList({ toolbars, droppableId, onRemove, disabled, }) {
|
|
36
|
-
return (React.createElement(react_beautiful_dnd_1.Droppable, { droppableId: droppableId, type: "TOOLBAR" }, (provided, snapshot) => (React.createElement(rebass_1.Box, Object.assign({ className: "ab-ModuleSelector__ToolbarList", ref: provided.innerRef }, (disabled ? {} : provided.droppableProps), { "data-name": "dashboard-toolbar-drop-target", backgroundColor: snapshot.isDraggingOver ? 'var(--ab-dashboard-tab-drop-target__background)' : '' }),
|
|
36
|
+
return (React.createElement(react_beautiful_dnd_1.Droppable, { droppableId: droppableId, type: "TOOLBAR" }, (provided, snapshot) => (React.createElement(rebass_1.Box, Object.assign({ className: "ab-ModuleSelector__ToolbarList", ref: provided.innerRef }, (disabled ? {} : provided.droppableProps), { "data-name": "dashboard-toolbar-drop-target", backgroundColor: snapshot.isDraggingOver ? 'var(--ab-dashboard-tab-drop-target__background)' : '' }), toolbars === null || toolbars === void 0 ? void 0 :
|
|
37
37
|
toolbars.map((toolbar, toolbarIndex) => (React.createElement(ToolbarItem, { disabled: disabled, key: toolbar, toolbar: toolbar, toolbarIndex: toolbarIndex, onRemove: () => onRemove(toolbarIndex) }))),
|
|
38
38
|
provided.placeholder))));
|
|
39
39
|
}
|
|
@@ -12,6 +12,16 @@ exports.editorButtonsObservable = [
|
|
|
12
12
|
data: 'GRID_CHANGE()',
|
|
13
13
|
text: 'GridChange',
|
|
14
14
|
},
|
|
15
|
+
{
|
|
16
|
+
functionName: 'ROW_ADDED',
|
|
17
|
+
data: 'ROW_ADDED()',
|
|
18
|
+
text: 'RowAdded',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
functionName: 'ROW_REMOVED',
|
|
22
|
+
data: 'ROW_REMOVED()',
|
|
23
|
+
text: 'RowRemoved',
|
|
24
|
+
},
|
|
15
25
|
{
|
|
16
26
|
functionName: 'COUNT',
|
|
17
27
|
data: 'COUNT()',
|
|
@@ -2308,6 +2308,16 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
2308
2308
|
desc: string;
|
|
2309
2309
|
}[];
|
|
2310
2310
|
};
|
|
2311
|
+
DataImportValidationError: {
|
|
2312
|
+
name: string;
|
|
2313
|
+
kind: string;
|
|
2314
|
+
desc: string;
|
|
2315
|
+
props: {
|
|
2316
|
+
name: string;
|
|
2317
|
+
kind: string;
|
|
2318
|
+
desc: string;
|
|
2319
|
+
}[];
|
|
2320
|
+
};
|
|
2311
2321
|
DataSet: {
|
|
2312
2322
|
name: string;
|
|
2313
2323
|
kind: string;
|
|
@@ -4078,6 +4088,16 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
4078
4088
|
defVal?: undefined;
|
|
4079
4089
|
})[];
|
|
4080
4090
|
};
|
|
4091
|
+
PreprocessDataContext: {
|
|
4092
|
+
name: string;
|
|
4093
|
+
kind: string;
|
|
4094
|
+
desc: string;
|
|
4095
|
+
props: {
|
|
4096
|
+
name: string;
|
|
4097
|
+
kind: string;
|
|
4098
|
+
desc: string;
|
|
4099
|
+
}[];
|
|
4100
|
+
};
|
|
4081
4101
|
PreProcessExportContext: {
|
|
4082
4102
|
name: string;
|
|
4083
4103
|
kind: string;
|