@adaptabletools/adaptable 16.0.9 → 16.1.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/agGrid.d.ts +4 -0
- package/agGrid.js +4 -0
- package/base.css +16 -14
- package/base.css.map +1 -1
- package/bundle.cjs.js +171 -170
- package/index.css +18 -14
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/AdaptableFrameworkComponent.d.ts +12 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +7 -2
- package/src/AdaptableOptions/ChartingOptions.d.ts +48 -3
- package/src/AdaptableOptions/ColumnOptions.d.ts +17 -0
- package/src/AdaptableOptions/DataImportOptions.d.ts +57 -0
- package/src/AdaptableOptions/MenuOptions.d.ts +147 -8
- package/src/AdaptableOptions/MenuOptions.js +75 -0
- package/src/AdaptableOptions/NotesOptions.d.ts +23 -0
- package/src/AdaptableOptions/QuickSearchOptions.d.ts +8 -0
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +2 -0
- package/src/Api/AdaptableApi.d.ts +8 -3
- package/src/Api/ChartingApi.d.ts +30 -0
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/ConfigApi.d.ts +4 -3
- package/src/Api/DataImportApi.d.ts +9 -0
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +4 -2
- package/src/Api/Implementation/AdaptableApiImpl.js +4 -2
- package/src/Api/Implementation/ApiBase.d.ts +2 -2
- package/src/Api/Implementation/ApiBase.js +2 -2
- package/src/Api/Implementation/ChartingApiImpl.d.ts +8 -2
- package/src/Api/Implementation/ChartingApiImpl.js +64 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +4 -0
- package/src/Api/Implementation/ConfigApiImpl.d.ts +3 -2
- package/src/Api/Implementation/ConfigApiImpl.js +9 -9
- package/src/Api/Implementation/DataImportApiImpl.d.ts +10 -0
- package/src/Api/Implementation/DataImportApiImpl.js +14 -0
- package/src/Api/Implementation/ExpressionApiImpl.js +1 -1
- package/src/Api/Implementation/NotesApiImpl.d.ts +20 -0
- package/src/Api/Implementation/NotesApiImpl.js +58 -0
- package/src/Api/Implementation/OptionsApiImpl.d.ts +3 -2
- package/src/Api/Implementation/OptionsApiImpl.js +5 -2
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +7 -1
- package/src/Api/Implementation/UserInterfaceApiImpl.js +30 -0
- package/src/Api/Internal/AdaptableInternalApi.d.ts +0 -2
- package/src/Api/Internal/AdaptableInternalApi.js +0 -6
- package/src/Api/Internal/CalculatedColumnInternalApi.d.ts +2 -0
- package/src/Api/Internal/CalculatedColumnInternalApi.js +12 -0
- package/src/Api/Internal/ChartingInternalApi.d.ts +7 -0
- package/src/Api/Internal/ChartingInternalApi.js +45 -0
- package/src/Api/Internal/ColumnInternalApi.d.ts +3 -0
- package/src/Api/Internal/ColumnInternalApi.js +3 -0
- package/src/Api/Internal/DataImportInternalApi.d.ts +4 -0
- package/src/Api/Internal/DataImportInternalApi.js +49 -0
- package/src/Api/NotesAPi.d.ts +50 -0
- package/src/Api/NotesAPi.js +2 -0
- package/src/Api/OptionsApi.d.ts +8 -3
- package/src/Api/UserInterfaceApi.d.ts +22 -0
- package/src/PredefinedConfig/AdaptableState.d.ts +2 -2
- package/src/PredefinedConfig/ChartingState.d.ts +22 -0
- package/src/PredefinedConfig/ChartingState.js +9 -0
- package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +12 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/Menu.d.ts +2 -7
- package/src/PredefinedConfig/Common/Types.d.ts +4 -4
- package/src/PredefinedConfig/Common/Types.js +3 -1
- package/src/PredefinedConfig/NotesState.d.ts +59 -0
- package/src/PredefinedConfig/NotesState.js +2 -0
- package/src/PredefinedConfig/PredefinedConfig.d.ts +2 -2
- package/src/PredefinedConfig/SystemState.d.ts +5 -3
- package/src/Redux/ActionsReducers/ChartingRedux.d.ts +28 -3
- package/src/Redux/ActionsReducers/ChartingRedux.js +52 -5
- package/src/Redux/ActionsReducers/NotesRedux.d.ts +39 -0
- package/src/Redux/ActionsReducers/NotesRedux.js +88 -0
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +10 -10
- package/src/Redux/ActionsReducers/SystemRedux.js +23 -22
- package/src/Redux/Store/AdaptableStore.js +19 -11
- package/src/Strategy/ChartingModule.d.ts +5 -2
- package/src/Strategy/ChartingModule.js +28 -7
- package/src/Strategy/ColumnInfoModule.d.ts +11 -0
- package/src/Strategy/ColumnInfoModule.js +47 -0
- package/src/Strategy/DataImportModule.d.ts +11 -0
- package/src/Strategy/DataImportModule.js +36 -0
- package/src/Strategy/DataSetModule.js +1 -0
- package/src/Strategy/Fdc3Module.js +3 -2
- package/src/Strategy/FilterModule.js +5 -0
- package/src/Strategy/GridInfoModule.js +13 -82
- package/src/Strategy/Interface/IModule.d.ts +2 -0
- package/src/Strategy/LayoutModule.js +1 -0
- package/src/Strategy/{CommentsModule.d.ts → NotesModule.d.ts} +6 -6
- package/src/Strategy/{CommentsModule.js → NotesModule.js} +41 -41
- package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.d.ts +2 -0
- package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +20 -18
- package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
- package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
- package/src/Utilities/Constants/ModuleConstants.d.ts +9 -3
- package/src/Utilities/Constants/ModuleConstants.js +11 -5
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +5 -1
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +3 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -2
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +36 -10
- package/src/Utilities/Extensions/ObjectExtensions.d.ts +1 -0
- package/src/Utilities/Extensions/ObjectExtensions.js +5 -1
- package/src/Utilities/Helpers/AdaptableHelper.js +2 -0
- package/src/Utilities/Interface/MessagePopups.d.ts +2 -2
- package/src/Utilities/ObjectFactory.d.ts +2 -1
- package/src/Utilities/ObjectFactory.js +10 -2
- package/src/Utilities/Services/Interface/IEntitlementService.d.ts +4 -0
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +1 -1
- package/src/Utilities/Services/ModuleService.js +2 -0
- package/src/Utilities/Services/QueryLanguageService.d.ts +1 -2
- package/src/Utilities/Services/QueryLanguageService.js +1 -6
- package/src/Utilities/Services/ValidationService.js +15 -5
- package/src/View/AdaptableView.js +2 -2
- package/src/View/AdaptableViewFactory.js +7 -3
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +20 -4
- package/src/View/Alert/Wizard/AlertWizard.js +14 -7
- package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.d.ts +2 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +25 -46
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.d.ts +8 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +19 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.d.ts +2 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +44 -3
- package/src/View/CalculatedColumn/utils.d.ts +2 -0
- package/src/View/CalculatedColumn/utils.js +14 -0
- package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.d.ts +6 -0
- package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.js +47 -0
- package/src/View/Charting/ChartingWizard/{PreviewChartSection.d.ts → AgChargingWizard/PreviewChartSection.d.ts} +1 -1
- package/src/View/Charting/ChartingWizard/{PreviewChartSection.js → AgChargingWizard/PreviewChartSection.js} +2 -2
- package/src/View/Charting/ChartingWizard/{SettingsSection.d.ts → AgChargingWizard/SettingsSection.d.ts} +1 -1
- package/src/View/Charting/ChartingWizard/{SettingsSection.js → AgChargingWizard/SettingsSection.js} +4 -4
- package/src/View/Charting/ChartingWizard/AgChargingWizard/index.d.ts +1 -0
- package/src/View/Charting/ChartingWizard/AgChargingWizard/index.js +4 -0
- package/src/View/Charting/ChartingWizard/ChartingWizard.d.ts +4 -3
- package/src/View/Charting/ChartingWizard/ChartingWizard.js +12 -39
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.d.ts +6 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.js +59 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.d.ts +9 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +25 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/index.d.ts +1 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/index.js +4 -0
- package/src/View/Charting/ChartingWizard/index.d.ts +1 -0
- package/src/View/Charting/ChartingWizard/index.js +4 -0
- package/src/View/Charting/DeleteChartButton.d.ts +2 -1
- package/src/View/Charting/DeleteChartButton.js +4 -2
- package/src/View/Charting/EditChartButton.d.ts +2 -1
- package/src/View/Charting/ShowChartButton.js +47 -16
- package/src/View/Charting/{useChartState.d.ts → useAgChartState.d.ts} +1 -1
- package/src/View/Charting/{useChartState.js → useAgChartState.js} +7 -7
- package/src/View/Charting/useChartingElements.d.ts +2 -1
- package/src/View/Charting/useChartingElements.js +36 -26
- package/src/View/Charting/useExternalChartState.d.ts +7 -0
- package/src/View/Charting/useExternalChartState.js +56 -0
- package/src/View/ColumnInfo/ColumnInfo.d.ts +5 -0
- package/src/View/ColumnInfo/ColumnInfo.js +185 -0
- package/src/View/ColumnInfo/ColumnInfoPopup.d.ts +3 -0
- package/src/View/ColumnInfo/ColumnInfoPopup.js +15 -0
- package/src/View/Components/AdaptableIconSelector/index.d.ts +1 -1
- package/src/View/Components/ExternalRenderer.d.ts +1 -0
- package/src/View/Components/ExternalRenderer.js +2 -1
- package/src/View/Components/Panels/PanelWithImage.js +3 -3
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +1 -1
- package/src/View/Components/Popups/AdaptablePopup/Navigation.js +4 -1
- package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +3 -0
- package/src/View/Components/Popups/WindowPopups/WindowPopups.d.ts +1 -0
- package/src/View/Components/Popups/WindowPopups/WindowPopups.js +12 -2
- package/src/View/Components/Selectors/ColumnSelector.js +1 -1
- package/src/View/DataImport/DataImportPopup.d.ts +6 -0
- package/src/View/DataImport/DataImportPopup.js +32 -0
- package/src/View/DataImport/DataImportWizard/DataImportWizard.d.ts +8 -0
- package/src/View/DataImport/DataImportWizard/DataImportWizard.js +176 -0
- package/src/View/DataImport/DataImportWizard/index.d.ts +1 -0
- package/src/View/DataImport/DataImportWizard/index.js +4 -0
- package/src/View/DataImport/DataImportWizard/sections/DataPreview.d.ts +10 -0
- package/src/View/DataImport/DataImportWizard/sections/DataPreview.js +154 -0
- package/src/View/DataImport/DataImportWizard/sections/ImportSection.d.ts +9 -0
- package/src/View/DataImport/DataImportWizard/sections/ImportSection.js +24 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadFileSection.d.ts +8 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadFileSection.js +11 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadSection.d.ts +13 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadSection.js +23 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadTextSection.d.ts +8 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadTextSection.js +13 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/index.d.ts +1 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/index.js +4 -0
- package/src/View/DataImport/DataImportWizard/sections/ValidationSection.d.ts +11 -0
- package/src/View/DataImport/DataImportWizard/sections/ValidationSection.js +35 -0
- package/src/View/DataImport/systemFileHandlers.d.ts +3 -0
- package/src/View/DataImport/systemFileHandlers.js +44 -0
- package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +6 -1
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +9 -0
- package/src/View/GridInfo/{AdaptableObjectsSummary.js → GridInfoPopup/AdaptableObjectsSummary.js} +2 -2
- package/src/View/GridInfo/{AdaptableOptionsComponent.d.ts → GridInfoPopup/AdaptableOptionsComponent.d.ts} +1 -1
- package/src/View/GridInfo/{AdaptableOptionsComponent.js → GridInfoPopup/AdaptableOptionsComponent.js} +6 -6
- package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.d.ts +6 -0
- package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +82 -0
- package/src/View/GridInfo/GridInfoPopup/index.d.ts +1 -0
- package/src/View/GridInfo/GridInfoPopup/index.js +4 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
- package/src/View/Notes/NotesListing.d.ts +2 -0
- package/src/View/{Comments/CommentListing.js → Notes/NotesListing.js} +13 -14
- package/src/View/Notes/NotesPopup.d.ts +2 -0
- package/src/View/{Comments/CommentPopup.js → Notes/NotesPopup.js} +21 -21
- package/src/View/Shortcut/Wizard/ShortcutWizard.js +6 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +14 -0
- package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -0
- package/src/View/Wizard/OnePageWizards.d.ts +1 -0
- package/src/View/Wizard/OnePageWizards.js +2 -2
- package/src/agGrid/Adaptable.d.ts +1 -1
- package/src/agGrid/Adaptable.js +28 -16
- package/src/agGrid/agGridHelper.d.ts +3 -3
- package/src/agGrid/agGridHelper.js +58 -30
- package/src/agGrid/agGridMenuHelper.d.ts +20 -9
- package/src/agGrid/agGridMenuHelper.js +292 -135
- package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
- package/src/components/ExpressionEditor/EditorInput.js +15 -6
- package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
- package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +5 -5
- package/src/components/ExpressionEditor/editorButtonsQuantileAggregatedScalar.d.ts +2 -0
- package/src/components/ExpressionEditor/editorButtonsQuantileAggregatedScalar.js +25 -0
- package/src/components/ExpressionEditor/index.d.ts +1 -1
- package/src/components/ExpressionEditor/index.js +2 -1
- package/src/components/FileDroppable/index.d.ts +2 -1
- package/src/components/FileDroppable/index.js +8 -7
- package/src/components/icons/import.d.ts +3 -0
- package/src/components/icons/import.js +7 -0
- package/src/components/icons/index.js +4 -0
- package/src/components/icons/note.d.ts +3 -0
- package/src/components/icons/note.js +7 -0
- package/src/metamodel/adaptable.metamodel.d.ts +243 -61
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/index.d.ts +2 -2
- package/src/parser/src/index.js +4 -4
- package/src/parser/src/tokenizer.d.ts +1 -1
- package/src/parser/src/tokenizer.js +14 -6
- package/src/parser/src/types.d.ts +2 -2
- package/src/types.d.ts +9 -8
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/AdaptableOptions/CommentsOptions.d.ts +0 -23
- package/src/Api/CommentsApi.d.ts +0 -50
- package/src/Api/Implementation/CommentsApiImpl.d.ts +0 -20
- package/src/Api/Implementation/CommentsApiImpl.js +0 -58
- package/src/PredefinedConfig/CommentsState.d.ts +0 -59
- package/src/Redux/ActionsReducers/CommentsRedux.d.ts +0 -39
- package/src/Redux/ActionsReducers/CommentsRedux.js +0 -92
- package/src/View/Comments/CommentListing.d.ts +0 -2
- package/src/View/Comments/CommentPopup.d.ts +0 -2
- package/src/View/GridInfo/ColumnInfoComponent.d.ts +0 -20
- package/src/View/GridInfo/ColumnInfoComponent.js +0 -176
- package/src/View/GridInfo/GridInfoPopup.d.ts +0 -16
- package/src/View/GridInfo/GridInfoPopup.js +0 -117
- package/src/View/GridInfo/GridOptionsComponent.d.ts +0 -16
- package/src/View/GridInfo/GridOptionsComponent.js +0 -36
- /package/src/AdaptableOptions/{CommentsOptions.js → DataImportOptions.js} +0 -0
- /package/src/{Api/CommentsApi.js → AdaptableOptions/NotesOptions.js} +0 -0
- /package/src/{PredefinedConfig/CommentsState.js → Api/DataImportApi.js} +0 -0
- /package/src/View/GridInfo/{AdaptableObjectsSummary.d.ts → GridInfoPopup/AdaptableObjectsSummary.d.ts} +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnInfo = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const rebass_1 = require("rebass");
|
|
8
|
+
const FormLayout_1 = tslib_1.__importStar(require("../../components/FormLayout"));
|
|
9
|
+
const InfiniteTable_1 = require("../../components/InfiniteTable");
|
|
10
|
+
const Panel_1 = tslib_1.__importDefault(require("../../components/Panel"));
|
|
11
|
+
const Tabs_1 = require("../../components/Tabs");
|
|
12
|
+
const Enums_1 = require("../../PredefinedConfig/Common/Enums");
|
|
13
|
+
const AdaptableContext_1 = require("../AdaptableContext");
|
|
14
|
+
const AdaptableObjectList_1 = require("../Components/AdaptableObjectList");
|
|
15
|
+
const ButtonNew_1 = require("../Components/Buttons/ButtonNew");
|
|
16
|
+
const ColumnSelector_1 = require("../Components/Selectors/ColumnSelector");
|
|
17
|
+
const BASE_CLASS_NAME = 'ab-AdaptableColumns';
|
|
18
|
+
// TODOS:
|
|
19
|
+
// - use column from props as initial value
|
|
20
|
+
// - table summary
|
|
21
|
+
// - access level for edit/new buttons
|
|
22
|
+
const MODULES_WITH_COLUMN = [
|
|
23
|
+
'Alert',
|
|
24
|
+
'CalculatedColumn',
|
|
25
|
+
'CustomSort',
|
|
26
|
+
'Filter',
|
|
27
|
+
'FormatColumn',
|
|
28
|
+
'FlashingCell',
|
|
29
|
+
'PlusMinus',
|
|
30
|
+
'Shortcut',
|
|
31
|
+
'StyledColumn', // Scope
|
|
32
|
+
];
|
|
33
|
+
const MODULES_WITH_SCOPE = [
|
|
34
|
+
'Alert',
|
|
35
|
+
'FormatColumn',
|
|
36
|
+
'PlusMinus',
|
|
37
|
+
'Shortcut',
|
|
38
|
+
'StyledColumn',
|
|
39
|
+
];
|
|
40
|
+
// These modules are shown only if they have objects defiend
|
|
41
|
+
const MODULES_WITH_VIEW_ONLY = ['CalculatedColumn', 'Filter'];
|
|
42
|
+
const MODULES_WITHOUT_NEW = ['CalculatedColumn', 'Filter'];
|
|
43
|
+
const ColumnDefPreview = (props) => {
|
|
44
|
+
const keyValuePairs = [
|
|
45
|
+
{
|
|
46
|
+
Key: 'Column Id',
|
|
47
|
+
Value: props.column ? props.column.columnId : null,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
Key: 'Header',
|
|
51
|
+
Value: props.column ? props.column.friendlyName : null,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
Key: 'Aggregatable',
|
|
55
|
+
Value: props.column ? props.column.aggregatable : null,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
Key: 'DataType',
|
|
59
|
+
Value: props.column ? props.column.dataType : null,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
Key: 'Groupable',
|
|
63
|
+
Value: props.column ? props.column.groupable : null,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
Key: 'Filterable',
|
|
67
|
+
Value: props.column ? props.column.filterable : null,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
Key: 'Hideable',
|
|
71
|
+
Value: props.column ? props.column.hideable : null,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
Key: 'Editable',
|
|
75
|
+
Value: props.column ? !props.column.IsReadOnly : null,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
Key: 'Moveable',
|
|
79
|
+
Value: props.column ? props.column.moveable : null,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
Key: 'Pivotable',
|
|
83
|
+
Value: props.column ? props.column.pivotable : null,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
Key: 'Queryable',
|
|
87
|
+
Value: props.column ? props.column.queryable : null,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
Key: 'Sortable',
|
|
91
|
+
Value: props.column ? props.column.sortable : null,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
Key: 'Visible',
|
|
95
|
+
Value: props.column ? props.column.visible : null,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
Key: 'Grouped',
|
|
99
|
+
Value: props.column ? props.column.isGrouped : null,
|
|
100
|
+
},
|
|
101
|
+
]
|
|
102
|
+
.map((keyValuePair) => {
|
|
103
|
+
return {
|
|
104
|
+
Key: keyValuePair.Key,
|
|
105
|
+
Value: keyValuePair.Value === true ? 'Yes' : keyValuePair.Value,
|
|
106
|
+
};
|
|
107
|
+
})
|
|
108
|
+
.filter((x) => x.Value);
|
|
109
|
+
const columnsMap = {
|
|
110
|
+
Key: { field: 'Key', header: 'Property', defaultFlex: 1 },
|
|
111
|
+
Value: { field: 'Value', header: 'Value', defaultFlex: 3 },
|
|
112
|
+
};
|
|
113
|
+
return (React.createElement(InfiniteTable_1.DataSource, { data: keyValuePairs, primaryKey: "Key" },
|
|
114
|
+
React.createElement(InfiniteTable_1.InfiniteTable, { domProps: {
|
|
115
|
+
style: {
|
|
116
|
+
height: '460px',
|
|
117
|
+
width: '100%',
|
|
118
|
+
},
|
|
119
|
+
}, columns: columnsMap })));
|
|
120
|
+
};
|
|
121
|
+
const ModuleView = (props) => {
|
|
122
|
+
var _a, _b, _c, _d;
|
|
123
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
124
|
+
const module = adaptable.ModuleService.getModuleById(props.moduleName);
|
|
125
|
+
if (!module.isModuleAvailable()) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const moduleInfo = module.moduleInfo;
|
|
129
|
+
const [isWizardOpen, setIsWizardOpen] = React.useState(false);
|
|
130
|
+
const EditWizard = (_c = (_b = (_a = module === null || module === void 0 ? void 0 : module.getViewProperties) === null || _a === void 0 ? void 0 : _a.call(module)) === null || _b === void 0 ? void 0 : _b.getEditWizard) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
131
|
+
const column = adaptable.api.columnApi.getColumnWithColumnId(props.selectedColumnId);
|
|
132
|
+
const allItems = (_d = module === null || module === void 0 ? void 0 : module.toViewAll) === null || _d === void 0 ? void 0 : _d.call(module);
|
|
133
|
+
if (MODULES_WITH_VIEW_ONLY.includes(props.moduleName) && !(allItems === null || allItems === void 0 ? void 0 : allItems.length)) {
|
|
134
|
+
return React.createElement(React.Fragment, null);
|
|
135
|
+
}
|
|
136
|
+
const itemsInScope = allItems.filter((item) => {
|
|
137
|
+
var _a;
|
|
138
|
+
if ('Scope' in item.abObject) {
|
|
139
|
+
const abColumn = adaptable.api.columnApi.getColumnWithColumnId(props.selectedColumnId);
|
|
140
|
+
return adaptable.api.scopeApi.isColumnInScope(abColumn, item.abObject.Scope);
|
|
141
|
+
}
|
|
142
|
+
if ('ColumnId' in item.abObject) {
|
|
143
|
+
return ((_a = item.abObject) === null || _a === void 0 ? void 0 : _a.ColumnId) === props.selectedColumnId;
|
|
144
|
+
}
|
|
145
|
+
return false;
|
|
146
|
+
});
|
|
147
|
+
if (!itemsInScope) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const handleWizardClose = React.useCallback(() => {
|
|
151
|
+
setIsWizardOpen(false);
|
|
152
|
+
}, []);
|
|
153
|
+
// filter out items with scope
|
|
154
|
+
return (React.createElement(rebass_1.Box, { "data-name": module.moduleInfo.ModuleName, className: `${BASE_CLASS_NAME}__module-list`, key: module.moduleInfo.ModuleName, mb: 4 },
|
|
155
|
+
React.createElement(rebass_1.Flex, null,
|
|
156
|
+
React.createElement("b", { className: `${BASE_CLASS_NAME}__header` }, module.moduleInfo.FriendlyName),
|
|
157
|
+
React.createElement(rebass_1.Box, { flex: 1 }),
|
|
158
|
+
!MODULES_WITHOUT_NEW.includes(props.moduleName) && (React.createElement(ButtonNew_1.ButtonNew, { onClick: () => setIsWizardOpen(true) }, "New"))),
|
|
159
|
+
(itemsInScope === null || itemsInScope === void 0 ? void 0 : itemsInScope.length) ? React.createElement(AdaptableObjectList_1.AdaptableObjectList, { items: itemsInScope, module: module }) : null,
|
|
160
|
+
isWizardOpen && EditWizard && (React.createElement(EditWizard, { popupParams: {
|
|
161
|
+
column,
|
|
162
|
+
action: 'New',
|
|
163
|
+
source: 'ModuleButton',
|
|
164
|
+
}, moduleInfo: moduleInfo, data: null, configEntities: null, onCloseWizard: handleWizardClose, onFinishWizard: handleWizardClose }))));
|
|
165
|
+
};
|
|
166
|
+
const ColumnInfo = (props) => {
|
|
167
|
+
const state = (0, react_redux_1.useSelector)((state) => state);
|
|
168
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
169
|
+
const [selectedColumnId, setSelectedColumnId] = React.useState(props.selectedColumnId);
|
|
170
|
+
const column = adaptable.api.columnApi.getColumnWithColumnId(selectedColumnId);
|
|
171
|
+
return (React.createElement(Panel_1.default, { flex: 1 },
|
|
172
|
+
React.createElement(rebass_1.Box, { mb: 3 },
|
|
173
|
+
React.createElement(FormLayout_1.default, null,
|
|
174
|
+
React.createElement(FormLayout_1.FormRow, { label: "Select Column" },
|
|
175
|
+
React.createElement(ColumnSelector_1.ColumnSelector, { SelectedColumnIds: [selectedColumnId], ColumnList: adaptable.api.columnApi.getColumns(), onColumnChange: (columns) => { var _a, _b; return setSelectedColumnId((_b = (_a = columns === null || columns === void 0 ? void 0 : columns[0]) === null || _a === void 0 ? void 0 : _a.columnId) !== null && _b !== void 0 ? _b : undefined); }, SelectionMode: Enums_1.SelectionMode.Single })))),
|
|
176
|
+
selectedColumnId && (React.createElement(Tabs_1.Tabs, { mb: 3 },
|
|
177
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Config"),
|
|
178
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Info"),
|
|
179
|
+
React.createElement(Tabs_1.Tabs.Content, null, selectedColumnId && (React.createElement(rebass_1.Box, { className: BASE_CLASS_NAME }, MODULES_WITH_COLUMN.map((moduleName) => {
|
|
180
|
+
return (React.createElement(ModuleView, { key: moduleName, moduleName: moduleName, selectedColumnId: selectedColumnId }));
|
|
181
|
+
})))),
|
|
182
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
183
|
+
React.createElement(rebass_1.Flex, { flex: 1 }, selectedColumnId && React.createElement(ColumnDefPreview, { column: column })))))));
|
|
184
|
+
};
|
|
185
|
+
exports.ColumnInfo = ColumnInfo;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnInfoPopup = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const PopupPanel_1 = require("../Components/Popups/AdaptablePopup/PopupPanel");
|
|
8
|
+
const ColumnInfo_1 = require("./ColumnInfo");
|
|
9
|
+
const ColumnInfoPopup = (props) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
return (React.createElement(PopupPanel_1.PopupPanel, { headerText: 'Column Info', glyphicon: 'info' },
|
|
12
|
+
React.createElement(rebass_1.Flex, { flexDirection: "column", flex: 1, height: "100%" },
|
|
13
|
+
React.createElement(ColumnInfo_1.ColumnInfo, { selectedColumnId: (_b = (_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.columnId }))));
|
|
14
|
+
};
|
|
15
|
+
exports.ColumnInfoPopup = ColumnInfoPopup;
|
|
@@ -3,4 +3,4 @@ import { IconSelectorProps } from '../../../components/IconSelector';
|
|
|
3
3
|
/**
|
|
4
4
|
* This component connects to adaptable to retrieve custom icons
|
|
5
5
|
*/
|
|
6
|
-
export declare const AdaptableIconSelector: React.FunctionComponent<IconSelectorProps
|
|
6
|
+
export declare const AdaptableIconSelector: React.FunctionComponent<Omit<IconSelectorProps, 'customIcons'>>;
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const AdaptableContext_1 = require("../AdaptableContext");
|
|
7
7
|
const ExternalRenderer = (_a) => {
|
|
8
|
-
var { render, frameworkComponent, componentName = 'N/A' } = _a, rest = tslib_1.__rest(_a, ["render", "frameworkComponent", "componentName"]);
|
|
8
|
+
var { render, frameworkComponent, componentName = 'N/A', onDestroy } = _a, rest = tslib_1.__rest(_a, ["render", "frameworkComponent", "componentName", "onDestroy"]);
|
|
9
9
|
const ref = React.useRef();
|
|
10
10
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
11
11
|
const [contentsHTML, setContentsHTML] = React.useState('');
|
|
@@ -36,6 +36,7 @@ const ExternalRenderer = (_a) => {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
else if (frameworkComponent) {
|
|
39
|
+
onDestroy === null || onDestroy === void 0 ? void 0 : onDestroy();
|
|
39
40
|
adaptableApi.internalApi.destroyFrameworkComponent(element, frameworkComponent,
|
|
40
41
|
// @ts-ignore
|
|
41
42
|
componentName);
|
|
@@ -13,6 +13,7 @@ const ButtonInfo_1 = require("../Buttons/ButtonInfo");
|
|
|
13
13
|
//let { buttonContent, ...other } = this.props
|
|
14
14
|
class PanelWithImageCmp extends React.Component {
|
|
15
15
|
render() {
|
|
16
|
+
var _a;
|
|
16
17
|
const IconCmp = icons_1.allIcons[(this.props.icon || this.props.glyphicon)];
|
|
17
18
|
const headerStyle = {};
|
|
18
19
|
if (this.props.headerColor) {
|
|
@@ -21,10 +22,9 @@ class PanelWithImageCmp extends React.Component {
|
|
|
21
22
|
}
|
|
22
23
|
let headerRow = (React.createElement(rebass_1.Flex, { flex: 1 },
|
|
23
24
|
React.createElement(rebass_1.Flex, { alignItems: "center" },
|
|
24
|
-
React.createElement(rebass_1.Flex, { alignItems: "center", style: headerStyle },
|
|
25
|
+
React.createElement(rebass_1.Flex, { minHeight: 15, alignItems: "center", style: headerStyle },
|
|
25
26
|
IconCmp ? React.createElement(IconCmp, null) : null,
|
|
26
|
-
React.createElement(rebass_1.Box, { marginRight: 2 }),
|
|
27
|
-
this.props.header,
|
|
27
|
+
React.createElement(rebass_1.Box, { marginRight: 2 }), (_a = this.props.header) !== null && _a !== void 0 ? _a : '',
|
|
28
28
|
React.createElement(rebass_1.Box, { marginRight: 2, "data-name": "space-after" }),
|
|
29
29
|
this.props.infoLink != null && !this.props.infoLinkDisabled && (React.createElement(ButtonInfo_1.ButtonInfo, { onClick: () => window.open(this.props.infoLink, '_blank' // <- opens the link in a new tab or window.
|
|
30
30
|
) }))),
|
|
@@ -39,7 +39,7 @@ const AdaptablePopup = (props) => {
|
|
|
39
39
|
let componentName = props.componentName;
|
|
40
40
|
// ts forces to check for General, there is no menu item General
|
|
41
41
|
const useFirstItem = !props.componentName;
|
|
42
|
-
if (useFirstItem && firstMenuModule !== 'General') {
|
|
42
|
+
if (useFirstItem && firstMenuModule !== 'General' && firstMenuModule !== 'CustomSettingsPanel') {
|
|
43
43
|
componentModule = firstMenuModule;
|
|
44
44
|
}
|
|
45
45
|
const customSettingsPanel = (_c = settingsPanelOptions === null || settingsPanelOptions === void 0 ? void 0 : settingsPanelOptions.customSettingsPanels) === null || _c === void 0 ? void 0 : _c.find((customPanel) => useFirstItem ? customPanel.name === firstMenuItem.label : customPanel.name === componentName);
|
|
@@ -43,10 +43,13 @@ const Navigation = (props) => {
|
|
|
43
43
|
const isActive = props.activeItem === menuItem.module || menuItem.label === props.activeItem;
|
|
44
44
|
const className = (0, join_1.default)(baseClassName, isActive && `${baseClassName}--active`);
|
|
45
45
|
let customIcon = (_d = (_c = (_b = (_a = props.customSettingsPanels) === null || _a === void 0 ? void 0 : _a.find) === null || _b === void 0 ? void 0 : _b.call(_a, (customSettingPanel) => customSettingPanel.name === menuItem.label)) === null || _c === void 0 ? void 0 : _c.icon) !== null && _d !== void 0 ? _d : null;
|
|
46
|
+
const dataName = menuItem.module === 'CustomSettingsPanel'
|
|
47
|
+
? `CSP-${menuItem.label}`
|
|
48
|
+
: (_e = menuItem.module) !== null && _e !== void 0 ? _e : menuItem.label;
|
|
46
49
|
return (React.createElement("li", { className: className, key: menuItem.label },
|
|
47
50
|
React.createElement("button", { type: "button", className: `${baseClassName}__Button`, onClick: () => {
|
|
48
51
|
dispatch(menuItem.reduxAction);
|
|
49
|
-
}, "data-name":
|
|
52
|
+
}, "data-name": dataName },
|
|
50
53
|
menuItem.icon && (React.createElement(AdaptableIconComponent_1.AdaptableIconComponent, { icon: menuItem.icon, iconClassName: `${baseClassName}__Icon` })),
|
|
51
54
|
customIcon && React.createElement(AdaptableIconComponent_1.AdaptableIconComponent, { icon: customIcon }),
|
|
52
55
|
menuItem.label)));
|
|
@@ -21,6 +21,7 @@ const useMenuItems = () => {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
const visibleItems = allMenuItems.filter((item) => item.module !== 'General' &&
|
|
24
|
+
item.module !== 'CustomSettingsPanel' &&
|
|
24
25
|
!DefaultSettingsPanel_1.STANDALONE_MODULE_POPUPS.includes(item.module) &&
|
|
25
26
|
item.isVisible);
|
|
26
27
|
return navigationItems
|
|
@@ -32,7 +33,9 @@ const useMenuItems = () => {
|
|
|
32
33
|
const customSettingsPanel = (_b = (_a = settingsPanelOptions === null || settingsPanelOptions === void 0 ? void 0 : settingsPanelOptions.customSettingsPanels) === null || _a === void 0 ? void 0 : _a.find) === null || _b === void 0 ? void 0 : _b.call(_a, (panel) => panel.name === moduleName);
|
|
33
34
|
let customPanelMenuItem = null;
|
|
34
35
|
if (customSettingsPanel) {
|
|
36
|
+
// @ts-ignore
|
|
35
37
|
customPanelMenuItem = {
|
|
38
|
+
module: 'CustomSettingsPanel',
|
|
36
39
|
label: customSettingsPanel.name,
|
|
37
40
|
isVisible: true,
|
|
38
41
|
reduxAction: PopupRedux.PopupShowScreen(null, customSettingsPanel.name),
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WindowPopups = void 0;
|
|
3
|
+
exports.WindowPopups = exports.CUSTOM_WINDOW_FACTORY_ID = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const react_redux_1 = require("react-redux");
|
|
7
7
|
const Dialog_1 = tslib_1.__importDefault(require("../../../../components/Dialog"));
|
|
8
8
|
const PopupRedux_1 = require("../../../../Redux/ActionsReducers/PopupRedux");
|
|
9
9
|
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
10
|
+
const ExternalRenderer_1 = require("../../ExternalRenderer");
|
|
10
11
|
const PanelWithImage_1 = require("../../Panels/PanelWithImage");
|
|
11
12
|
const Utilities_1 = require("../Utilities");
|
|
12
13
|
const windowFactory_1 = require("./windowFactory");
|
|
13
14
|
const NoopComponent = () => {
|
|
14
15
|
return React.createElement(React.Fragment, null);
|
|
15
16
|
};
|
|
17
|
+
exports.CUSTOM_WINDOW_FACTORY_ID = 'CUSTOM_WINDOW_FACTORY_ID';
|
|
16
18
|
const WindowPopups = () => {
|
|
17
19
|
const [windowModalSettings, setWindowModalSettings] = React.useState({});
|
|
18
20
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
@@ -20,7 +22,15 @@ const WindowPopups = () => {
|
|
|
20
22
|
const windowItems = (0, react_redux_1.useSelector)((state) => state.Popup.WindowPopup.PopupList);
|
|
21
23
|
return (React.createElement(React.Fragment, null, windowItems === null || windowItems === void 0 ? void 0 : windowItems.map((windowItem) => {
|
|
22
24
|
var _a, _b, _c, _d, _e, _f;
|
|
23
|
-
|
|
25
|
+
let Component = (_a = windowFactory_1.windowFactory[windowItem.FactoryId]) !== null && _a !== void 0 ? _a : null;
|
|
26
|
+
if (!Component &&
|
|
27
|
+
(windowItem.PopupProps.render || windowItem.PopupProps.frameworkComponent)) {
|
|
28
|
+
// check if it is custom window
|
|
29
|
+
Component = () => (React.createElement(ExternalRenderer_1.ExternalRenderer, { render: windowItem.PopupProps.render, frameworkComponent: windowItem.PopupProps.frameworkComponent, onDestroy: windowItem.PopupProps.onFrameworkComponentDestroyed }));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
Component = Component !== null && Component !== void 0 ? Component : NoopComponent;
|
|
33
|
+
}
|
|
24
34
|
const _g = (_b = windowItem === null || windowItem === void 0 ? void 0 : windowItem.PopupProps) !== null && _b !== void 0 ? _b : {}, { windowModalProps } = _g, restPopupProps = tslib_1.__rest(_g, ["windowModalProps"]);
|
|
25
35
|
const handleDismiss = () => {
|
|
26
36
|
dispatch((0, PopupRedux_1.PopupHideWindow)(windowItem.Id));
|
|
@@ -41,7 +41,7 @@ class ColumnSelector extends React.Component {
|
|
|
41
41
|
return (React.createElement("div", { "data-name": 'column-selector' },
|
|
42
42
|
React.createElement(FormLayout_1.default, { columns: [{ name: 'columnSelector', style: { display: 'flex' } }], style: this.props.style },
|
|
43
43
|
React.createElement(FormLayout_1.FormRow, null,
|
|
44
|
-
React.createElement(DropdownButton_1.default, { marginRight: 2, columns: ['label'], showClearButton: currentColumnName != 'Select a column', onClear: () => this.onClearButton(), style: { width: '100%', fontSize: 'small' },
|
|
44
|
+
React.createElement(DropdownButton_1.default, { marginRight: 2, columns: ['label'], showClearButton: currentColumnName != 'Select a column', onClear: () => this.onClearButton(), style: { width: '100%', fontSize: 'small' }, items: sortedColumnOptions, disabled: this.props.disabled || sortedColumnOptions.length == 0 }, currentColumnName)))));
|
|
45
45
|
}
|
|
46
46
|
onClearButton() {
|
|
47
47
|
this.props.onColumnChange([]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ModuleViewPopupProps } from '../Components/SharedProps/ModuleViewPopupProps';
|
|
3
|
+
interface DataImportPopupProps extends ModuleViewPopupProps<null> {
|
|
4
|
+
}
|
|
5
|
+
export declare const DataImportPopup: React.FunctionComponent<DataImportPopupProps>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataImportPopup = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const HelpBlock_1 = tslib_1.__importDefault(require("../../components/HelpBlock"));
|
|
8
|
+
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
|
|
9
|
+
const PopupPanel_1 = require("../Components/Popups/AdaptablePopup/PopupPanel");
|
|
10
|
+
const DataImportWizard_1 = require("./DataImportWizard");
|
|
11
|
+
const DataImportPopup = (props) => {
|
|
12
|
+
const [isWizardOpen, setIsWizardOpen] = React.useState(false);
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
if (((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'New' && ((_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.source) !== 'ModuleMenu') {
|
|
16
|
+
setIsWizardOpen(true);
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
return (React.createElement(React.Fragment, null,
|
|
20
|
+
React.createElement(PopupPanel_1.PopupPanel, { headerText: 'Data Import', glyphicon: 'import' },
|
|
21
|
+
React.createElement(rebass_1.Box, null,
|
|
22
|
+
React.createElement(HelpBlock_1.default, { mb: 2, fontSize: 3 }, "Click the 'Import Data' button to insert or update data into AdapTable"),
|
|
23
|
+
React.createElement(SimpleButton_1.default, { icon: "import", variant: "raised", onClick: () => setIsWizardOpen(true) }, "Import Data"))),
|
|
24
|
+
isWizardOpen && (React.createElement(DataImportWizard_1.DataImportWizard, { onClose: () => {
|
|
25
|
+
var _a;
|
|
26
|
+
setIsWizardOpen(false);
|
|
27
|
+
if (['Toolbar', 'ContextMenu', 'ColumnMenu', 'ModuleButton'].includes((_a = props === null || props === void 0 ? void 0 : props.popupParams) === null || _a === void 0 ? void 0 : _a.source)) {
|
|
28
|
+
props.onClosePopup();
|
|
29
|
+
}
|
|
30
|
+
} }))));
|
|
31
|
+
};
|
|
32
|
+
exports.DataImportPopup = DataImportPopup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DataImportValidationError } from '../../../types';
|
|
3
|
+
export interface ValidationErrorsMap {
|
|
4
|
+
[key: string]: DataImportValidationError[] | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const DataImportWizard: (props: {
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataImportWizard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock"));
|
|
7
|
+
const Tag_1 = require("../../../components/Tag");
|
|
8
|
+
const ObjectFactory_1 = require("../../../Utilities/ObjectFactory");
|
|
9
|
+
const AdaptableContext_1 = require("../../AdaptableContext");
|
|
10
|
+
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
11
|
+
const systemFileHandlers_1 = require("../systemFileHandlers");
|
|
12
|
+
const UploadSection_1 = require("./sections/UploadSection");
|
|
13
|
+
const ValidationSection_1 = require("./sections/ValidationSection");
|
|
14
|
+
const DataImportWizard = (props) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
17
|
+
const primaryKey = adaptable.api.optionsApi.getPrimaryKey();
|
|
18
|
+
const dataImportOptions = adaptable.api.optionsApi.getDataImportOptions();
|
|
19
|
+
const module = adaptable.ModuleService.getModuleById('DataImport');
|
|
20
|
+
const [rowData, setRowData] = React.useState(null);
|
|
21
|
+
const [file, setFile] = React.useState(null);
|
|
22
|
+
const [text, setText] = React.useState('');
|
|
23
|
+
const [importType, setImportType] = React.useState('file');
|
|
24
|
+
const handleRowDataChange = React.useCallback((data) => {
|
|
25
|
+
if (Array.isArray(data)) {
|
|
26
|
+
setRowData(data);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
setRowData(null);
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
32
|
+
const handleChangeImportType = React.useCallback((importType) => {
|
|
33
|
+
setImportType(importType);
|
|
34
|
+
// clear data
|
|
35
|
+
handleRowDataChange(null);
|
|
36
|
+
setFile(null);
|
|
37
|
+
setText('');
|
|
38
|
+
}, []);
|
|
39
|
+
// ---- FILE HANDLERS ----
|
|
40
|
+
const fileHandlers = React.useMemo(() => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
const userDefinedHandlers = (_b = (_a = adaptable.api.optionsApi.getDataImportOptions()) === null || _a === void 0 ? void 0 : _a.fileHandlers) !== null && _b !== void 0 ? _b : [];
|
|
43
|
+
return [...userDefinedHandlers, ...systemFileHandlers_1.systemFileHandlers];
|
|
44
|
+
}, []);
|
|
45
|
+
const supportedFileFormats = React.useMemo(() => {
|
|
46
|
+
return fileHandlers.map((h) => h.fileExtension).join(', ');
|
|
47
|
+
}, [fileHandlers]);
|
|
48
|
+
const readFile = React.useCallback(async (file) => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
const userDefinedFileHandlers = (_b = (_a = adaptable.api.optionsApi.getDataImportOptions()) === null || _a === void 0 ? void 0 : _a.fileHandlers) !== null && _b !== void 0 ? _b : [];
|
|
51
|
+
const fileExtension = `.${file.name.split('.').pop()}`;
|
|
52
|
+
const handler = [...userDefinedFileHandlers, ...systemFileHandlers_1.systemFileHandlers].find((fh) => fh.fileExtension === fileExtension);
|
|
53
|
+
if (!handler) {
|
|
54
|
+
adaptable.api.logError(`No file handler found for file extension ${fileExtension}. Please provide a file handler in Data Import Options.`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const data = await handler.handleFile(file);
|
|
59
|
+
setFile(file);
|
|
60
|
+
handleRowDataChange(data);
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
catch (_c) {
|
|
64
|
+
adaptable.api.logError(`Error reading file ${file.name}. Please check the file is valid.`);
|
|
65
|
+
}
|
|
66
|
+
}, [adaptable]);
|
|
67
|
+
const fileMessage = file ? (React.createElement(HelpBlock_1.default, { mb: 2 },
|
|
68
|
+
"File ",
|
|
69
|
+
React.createElement(Tag_1.Tag, null, file.name),
|
|
70
|
+
" is ready to be imported.")) : (React.createElement(HelpBlock_1.default, { mb: 2 },
|
|
71
|
+
"Supported file types: ",
|
|
72
|
+
supportedFileFormats));
|
|
73
|
+
// ---- TEXT IMPORT ----
|
|
74
|
+
const [textError, setTextError] = React.useState(null);
|
|
75
|
+
const handleTextChange = React.useCallback(async (text) => {
|
|
76
|
+
var _a;
|
|
77
|
+
//
|
|
78
|
+
let textHandler = (_a = adaptable.api.optionsApi.getDataImportOptions()) === null || _a === void 0 ? void 0 : _a.textHandler;
|
|
79
|
+
if (!textHandler) {
|
|
80
|
+
// regex to test for json
|
|
81
|
+
const jsonRegex = /^\s*[\[{]/;
|
|
82
|
+
if (text && jsonRegex.test(text)) {
|
|
83
|
+
textHandler = JSON.parse;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
textHandler = systemFileHandlers_1.parseCSV;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
setText(text);
|
|
90
|
+
let textRawData = null;
|
|
91
|
+
if (!text || text === '') {
|
|
92
|
+
setTextError(null);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
try {
|
|
96
|
+
textRawData = await textHandler(text);
|
|
97
|
+
if (Array.isArray(textRawData)) {
|
|
98
|
+
handleRowDataChange(textRawData);
|
|
99
|
+
setTextError('');
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
throw 'Error parsing text';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (_b) {
|
|
106
|
+
handleRowDataChange(null);
|
|
107
|
+
setTextError('Error parsing text');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, []);
|
|
111
|
+
const textMessage = textError !== null && textError !== void 0 ? textError : (!rowData ? 'Paste your data here' : '');
|
|
112
|
+
// ---- VALIDATION ----
|
|
113
|
+
const errors = (_a = React.useMemo(() => {
|
|
114
|
+
var _a;
|
|
115
|
+
if (!(dataImportOptions === null || dataImportOptions === void 0 ? void 0 : dataImportOptions.validate)) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
if (!rowData) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return (_a = rowData === null || rowData === void 0 ? void 0 : rowData.reduce) === null || _a === void 0 ? void 0 : _a.call(rowData, (acc, rowData) => {
|
|
122
|
+
const error = dataImportOptions.validate(Object.assign({ rowData }, (0, ObjectFactory_1.createBaseContext)(adaptable.api)));
|
|
123
|
+
if (error && rowData[primaryKey] && error.length) {
|
|
124
|
+
acc[rowData[primaryKey]] = error;
|
|
125
|
+
}
|
|
126
|
+
return acc;
|
|
127
|
+
}, {});
|
|
128
|
+
}, [rowData])) !== null && _a !== void 0 ? _a : {};
|
|
129
|
+
const [skipInvalidRows, setSkipInvalidRows] = React.useState(false);
|
|
130
|
+
const handleValidationDataChange = (data) => {
|
|
131
|
+
handleRowDataChange(data);
|
|
132
|
+
};
|
|
133
|
+
const handleFinish = () => {
|
|
134
|
+
const validData = rowData.filter((row) => {
|
|
135
|
+
const rowErrors = errors[row[primaryKey]];
|
|
136
|
+
return !rowErrors || rowErrors.length === 0;
|
|
137
|
+
});
|
|
138
|
+
adaptable.api.dataImportApi.internalApi.importData(validData);
|
|
139
|
+
};
|
|
140
|
+
return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { data: null, moduleInfo: module.moduleInfo, finishText: "Import", onFinish: () => {
|
|
141
|
+
handleFinish();
|
|
142
|
+
props.onClose();
|
|
143
|
+
}, onHide: () => {
|
|
144
|
+
props.onClose();
|
|
145
|
+
}, sections: [
|
|
146
|
+
{
|
|
147
|
+
title: 'Upload',
|
|
148
|
+
isValid: () => {
|
|
149
|
+
return rowData ? true : 'No valid data uploaded';
|
|
150
|
+
},
|
|
151
|
+
details: 'Upload the data',
|
|
152
|
+
render: () => {
|
|
153
|
+
return (React.createElement(UploadSection_1.UploadSection, { importType: importType, onImportTypeChange: handleChangeImportType,
|
|
154
|
+
// FILE
|
|
155
|
+
readFile: readFile, supportedFileFormats: supportedFileFormats, fileMessage: fileMessage,
|
|
156
|
+
// TEXT
|
|
157
|
+
text: text, onTextChange: handleTextChange, textMessage: textMessage }));
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
title: 'Validation',
|
|
162
|
+
details: 'Check the Data is Valid',
|
|
163
|
+
isValid: () => {
|
|
164
|
+
if (errors && Object.keys(errors).length > 0) {
|
|
165
|
+
if (!skipInvalidRows)
|
|
166
|
+
return 'There are errors in the data.';
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
169
|
+
},
|
|
170
|
+
render: () => {
|
|
171
|
+
return (React.createElement(ValidationSection_1.ValidationSection, { errors: errors, data: rowData, onDataChange: handleValidationDataChange, skipInvalidRows: skipInvalidRows, onSkipInvalidRowsChange: setSkipInvalidRows }));
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
] }));
|
|
175
|
+
};
|
|
176
|
+
exports.DataImportWizard = DataImportWizard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DataImportWizard';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ValidationErrorsMap } from '../DataImportWizard';
|
|
3
|
+
interface DataPreviewProps {
|
|
4
|
+
data?: Record<string, unknown>[];
|
|
5
|
+
onDataChange?: (data: Record<string, unknown>[]) => void;
|
|
6
|
+
errors: ValidationErrorsMap | null;
|
|
7
|
+
editable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const DataPreview: React.FunctionComponent<DataPreviewProps>;
|
|
10
|
+
export {};
|