@adaptabletools/adaptable 16.1.1-canary.1 → 16.2.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/base.css +5 -0
- package/base.css.map +1 -1
- package/bundle.cjs.js +195 -197
- package/index.css +9 -0
- 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/Api/Internal/AlertInternalApi.d.ts +3 -2
- package/src/Api/Internal/AlertInternalApi.js +35 -5
- package/src/Api/Internal/GridInternalApi.js +1 -0
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +4 -4
- package/src/PredefinedConfig/Common/Fdc3Intent.js +4 -19
- 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/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/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 +5 -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/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -2,32 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Dashboard = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const kebabCase_1 = tslib_1.__importDefault(require("lodash/kebabCase"));
|
|
5
6
|
const React = tslib_1.__importStar(require("react"));
|
|
6
7
|
const react_redux_1 = require("react-redux");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
|
|
8
|
+
const rebass_1 = require("rebass");
|
|
9
|
+
const Dashboard_1 = require("../../components/Dashboard");
|
|
10
10
|
const DashboardRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/DashboardRedux"));
|
|
11
11
|
const PopupRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/PopupRedux"));
|
|
12
12
|
const QuickSearchRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/QuickSearchRedux"));
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
13
|
+
const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
|
|
14
|
+
const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
|
|
15
|
+
const AdaptableViewFactory_1 = require("../AdaptableViewFactory");
|
|
16
|
+
const AdaptableButton_1 = require("../Components/AdaptableButton");
|
|
17
|
+
const AdaptableIconComponent_1 = require("../Components/AdaptableIconComponent");
|
|
16
18
|
const AdaptableFormControlTextClear_1 = require("../Components/Forms/AdaptableFormControlTextClear");
|
|
17
19
|
const useQuickSearchDebounced_1 = require("../QuickSearch/useQuickSearchDebounced");
|
|
18
20
|
const UIHelper_1 = tslib_1.__importDefault(require("../UIHelper"));
|
|
19
|
-
const ModuleToolbarWrapper_1 = require("./ModuleToolbarWrapper");
|
|
20
|
-
const CustomToolbarWrapper_1 = require("./CustomToolbarWrapper");
|
|
21
21
|
const CustomDashboardButton_1 = require("./CustomDashboardButton");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
const CustomToolbar_1 = require("./CustomToolbar");
|
|
23
|
+
const DashboardToolbarFactory_1 = require("./DashboardToolbarFactory");
|
|
24
|
+
const PinnedDashboard_1 = require("./PinnedDashboard");
|
|
25
|
+
const ModuleToolbarWrapper_1 = require("./ModuleToolbarWrapper");
|
|
24
26
|
const DashboardComponent = (props) => {
|
|
25
27
|
const [searchText, search] = (0, useQuickSearchDebounced_1.useQuickSearchDebounced)(props);
|
|
26
28
|
const dashboardAccessLevel = props.api.internalApi
|
|
27
29
|
.getEntitlementService()
|
|
28
30
|
.getEntitlementAccessLevelForModule('Dashboard');
|
|
29
31
|
const renderTab = (tab) => {
|
|
30
|
-
// JW: dont understand why we need this line but we do...
|
|
31
32
|
const visibleToolbarNames = tab.Toolbars.filter((vt) => vt);
|
|
32
33
|
const customToolbars = props.api.dashboardApi.getCustomToolbars();
|
|
33
34
|
let visibleDashboardElements = visibleToolbarNames.map((visibleToolbarName) => {
|
|
@@ -35,28 +36,20 @@ const DashboardComponent = (props) => {
|
|
|
35
36
|
if (customToolbar) {
|
|
36
37
|
if (dashboardAccessLevel != 'Hidden') {
|
|
37
38
|
return (React.createElement(rebass_1.Box, { key: customToolbar.name, className: `ab-Dashboard__container ab-Dashboard__container--customToolbar` },
|
|
38
|
-
React.createElement(
|
|
39
|
+
React.createElement(CustomToolbar_1.CustomToolbarWrapper, { customToolbar: customToolbar, dashboardRevision: props.DashboardRevision })));
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
42
|
-
|
|
43
|
+
const moduleToolbarName = visibleToolbarName;
|
|
43
44
|
if (props.api.internalApi.getModuleService().isModuleAvailable(moduleToolbarName)) {
|
|
44
|
-
let accessLevel = props.api.internalApi
|
|
45
|
-
.getEntitlementService()
|
|
46
|
-
.getEntitlementAccessLevelForModule(moduleToolbarName);
|
|
47
45
|
let moduleToolbarView = AdaptableViewFactory_1.AdaptableViewPanelFactory.get(moduleToolbarName);
|
|
48
46
|
if (moduleToolbarView) {
|
|
49
47
|
let moduleInfo = props.api.internalApi
|
|
50
48
|
.getModuleService()
|
|
51
49
|
.getModuleInfoByModule(moduleToolbarName);
|
|
52
|
-
let moduleToolbarElement = React.createElement(moduleToolbarView, {
|
|
53
|
-
viewType: 'Toolbar',
|
|
54
|
-
api: props.api,
|
|
55
|
-
accessLevel,
|
|
56
|
-
moduleInfo,
|
|
57
|
-
});
|
|
58
50
|
return (React.createElement(rebass_1.Box, { key: moduleToolbarName, className: `ab-Dashboard__container ab-Dashboard__container--${moduleToolbarName}` },
|
|
59
|
-
React.createElement(ModuleToolbarWrapper_1.ModuleToolbarWrapper, { moduleInfo: moduleInfo, accessLevel: dashboardAccessLevel },
|
|
51
|
+
React.createElement(ModuleToolbarWrapper_1.ModuleToolbarWrapper, { moduleInfo: moduleInfo, accessLevel: dashboardAccessLevel },
|
|
52
|
+
React.createElement(DashboardToolbarFactory_1.DashboardToolbarFactory, { toolbarName: moduleToolbarName }))));
|
|
60
53
|
}
|
|
61
54
|
else {
|
|
62
55
|
props.api.logError('Cannot find Dashboard Control for ' + visibleToolbarName);
|
|
@@ -106,7 +99,10 @@ const DashboardComponent = (props) => {
|
|
|
106
99
|
const shouldRenderQuickSearchHeader = dashboardOptions.showQuickSearchInHeader &&
|
|
107
100
|
props.api.internalApi.getModuleService().getModuleById(ModuleConstants_1.QuickSearchModuleId).isModuleAvailable();
|
|
108
101
|
const applicationIcon = props.api.optionsApi.getUserInterfaceOptions().applicationIcon;
|
|
109
|
-
|
|
102
|
+
if (props.DashboardState.IsHidden) {
|
|
103
|
+
return React.createElement("div", null);
|
|
104
|
+
}
|
|
105
|
+
return (React.createElement(Dashboard_1.Dashboard, { title: instanceName, canFloat: props.api.optionsApi.getDashboardOptions().canFloat, footer: React.createElement(PinnedDashboard_1.PinnedDashboard, null), activeTabIndex: props.DashboardState.ActiveTabIndex, onActiveTabIndexChange: (ActiveTabIndex) => {
|
|
110
106
|
props.onSetActiveTabIndex(ActiveTabIndex);
|
|
111
107
|
}, collapsed: props.DashboardState.IsCollapsed, onCollapsedChange: (IsCollapsed) => {
|
|
112
108
|
props.onSetIsCollapsed(IsCollapsed);
|
|
@@ -17,7 +17,8 @@ interface DashboardPopupComponentProps extends ModuleViewPopupProps<DashboardPop
|
|
|
17
17
|
}
|
|
18
18
|
export declare enum DashboardConfigView {
|
|
19
19
|
Toolbars = "Toolbars",
|
|
20
|
-
Buttons = "Buttons"
|
|
20
|
+
Buttons = "Buttons",
|
|
21
|
+
PinnedToolbars = "PinnedToolbars"
|
|
21
22
|
}
|
|
22
23
|
export interface DashboardPopupState {
|
|
23
24
|
DashboardConfigView: DashboardConfigView;
|
|
@@ -13,10 +13,12 @@ const DashboardManager_1 = tslib_1.__importDefault(require("../../components/Das
|
|
|
13
13
|
const ModuleValueSelector_1 = require("../Components/ModuleValueSelector");
|
|
14
14
|
const CheckBox_1 = require("../../components/CheckBox");
|
|
15
15
|
const Panel_1 = tslib_1.__importDefault(require("../../components/Panel"));
|
|
16
|
+
const PinnedToolbarsSelector_1 = require("./PinnedToolbarsSelector");
|
|
16
17
|
var DashboardConfigView;
|
|
17
18
|
(function (DashboardConfigView) {
|
|
18
19
|
DashboardConfigView["Toolbars"] = "Toolbars";
|
|
19
20
|
DashboardConfigView["Buttons"] = "Buttons";
|
|
21
|
+
DashboardConfigView["PinnedToolbars"] = "PinnedToolbars";
|
|
20
22
|
})(DashboardConfigView = exports.DashboardConfigView || (exports.DashboardConfigView = {}));
|
|
21
23
|
class DashboardPopupComponent extends React.Component {
|
|
22
24
|
constructor(props) {
|
|
@@ -26,8 +28,8 @@ class DashboardPopupComponent extends React.Component {
|
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
render() {
|
|
29
|
-
const availableToolbars = Types_1.ALL_TOOLBARS;
|
|
30
31
|
const moduleService = this.props.api.internalApi.getModuleService();
|
|
32
|
+
const availableToolbars = Types_1.ALL_TOOLBARS;
|
|
31
33
|
const systemToolbars = availableToolbars
|
|
32
34
|
.filter((at) => this.props.api.internalApi.getModuleService().isModuleAvailable(at))
|
|
33
35
|
.map((at) => ({
|
|
@@ -80,12 +82,14 @@ class DashboardPopupComponent extends React.Component {
|
|
|
80
82
|
React.createElement(Panel_1.default, { header: 'Dashboard Contents', style: { borderBottom: '1px solid var(--ab-color-primary)' }, variant: "default", borderRadius: "none", marginTop: 4 },
|
|
81
83
|
React.createElement(rebass_1.Flex, { className: `${baseClassName}__contents-selector`, flexDirection: "row", padding: 2 },
|
|
82
84
|
React.createElement(Radio_1.default, { marginLeft: 3, value: DashboardConfigView.Toolbars, checked: this.state.DashboardConfigView == DashboardConfigView.Toolbars, onChange: (_, e) => this.onDashboardConfigViewChanged(e) }, "Toolbars"),
|
|
83
|
-
React.createElement(Radio_1.default, { marginLeft: 3, value: DashboardConfigView.Buttons, checked: this.state.DashboardConfigView == DashboardConfigView.Buttons, onChange: (_, e) => this.onDashboardConfigViewChanged(e) }, "Buttons")
|
|
85
|
+
React.createElement(Radio_1.default, { marginLeft: 3, value: DashboardConfigView.Buttons, checked: this.state.DashboardConfigView == DashboardConfigView.Buttons, onChange: (_, e) => this.onDashboardConfigViewChanged(e) }, "Buttons"),
|
|
86
|
+
React.createElement(Radio_1.default, { marginLeft: 3, value: DashboardConfigView.PinnedToolbars, checked: this.state.DashboardConfigView == DashboardConfigView.PinnedToolbars, onChange: (_, e) => this.onDashboardConfigViewChanged(e) }, "Pinned Toolbars")),
|
|
84
87
|
React.createElement(rebass_1.Box, { className: `${baseClassName}__Module-Selector`, "data-name": this.state.DashboardConfigView === DashboardConfigView.Toolbars
|
|
85
88
|
? 'toolbars'
|
|
86
89
|
: 'buttons', style: { minHeight: 0, flex: '1 1 0' }, padding: 2 },
|
|
87
90
|
this.state.DashboardConfigView == DashboardConfigView.Toolbars && (React.createElement(DashboardManager_1.default, { disabled: isDashboardDisabled, availableToolbars: [...systemToolbars, ...customToolbars], tabs: tabs, onTabsChange: this.props.onDashboardSetTabs, api: this.props.api })),
|
|
88
|
-
this.state.DashboardConfigView == DashboardConfigView.Buttons && (React.createElement(ModuleValueSelector_1.ModuleValueSelector, { disabled: isDashboardDisabled, options: allModuleButtons, value: selectedModuleButtons, noSelectionLabel: 'No selected Module Button', isOptionDisabled: isModuleCheckboxDisabled, xSelectedLabel: () => `Visible Module Buttons:`, onChange: (selectedValues) => this.props.onDashboardSetModuleButtons(selectedValues) }))
|
|
91
|
+
this.state.DashboardConfigView == DashboardConfigView.Buttons && (React.createElement(ModuleValueSelector_1.ModuleValueSelector, { disabled: isDashboardDisabled, options: allModuleButtons, value: selectedModuleButtons, noSelectionLabel: 'No selected Module Button', isOptionDisabled: isModuleCheckboxDisabled, xSelectedLabel: () => `Visible Module Buttons:`, onChange: (selectedValues) => this.props.onDashboardSetModuleButtons(selectedValues) })),
|
|
92
|
+
this.state.DashboardConfigView === DashboardConfigView.PinnedToolbars && (React.createElement(PinnedToolbarsSelector_1.PinnedToolbarsSelector, null)))))));
|
|
89
93
|
}
|
|
90
94
|
onDashboardConfigViewChanged(event) {
|
|
91
95
|
let e = event.target;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AdaptableModule } from '../../types';
|
|
3
|
+
interface DashboardToolbarFactoryProps {
|
|
4
|
+
toolbarName: AdaptableModule | string;
|
|
5
|
+
}
|
|
6
|
+
export declare const DashboardToolbarFactory: React.FunctionComponent<DashboardToolbarFactoryProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DashboardToolbarFactory = 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 Types_1 = require("../../PredefinedConfig/Common/Types");
|
|
8
|
+
const AdaptableContext_1 = require("../AdaptableContext");
|
|
9
|
+
const AdaptableViewFactory_1 = require("../AdaptableViewFactory");
|
|
10
|
+
const CustomToolbar_1 = require("./CustomToolbar");
|
|
11
|
+
const SystemDashboardToolbarFactory = (props) => {
|
|
12
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
13
|
+
const moduleInfo = adaptable.api.internalApi
|
|
14
|
+
.getModuleService()
|
|
15
|
+
.getModuleInfoByModule(props.toolbarName);
|
|
16
|
+
const accessLevel = adaptable.api.internalApi
|
|
17
|
+
.getEntitlementService()
|
|
18
|
+
.getEntitlementAccessLevelForModule(props.toolbarName);
|
|
19
|
+
const moduleToolbarView = AdaptableViewFactory_1.AdaptableViewPanelFactory.get(props.toolbarName);
|
|
20
|
+
const moduleToolbarElement = React.createElement(moduleToolbarView, {
|
|
21
|
+
viewType: 'Toolbar',
|
|
22
|
+
api: adaptable.api,
|
|
23
|
+
accessLevel,
|
|
24
|
+
moduleInfo,
|
|
25
|
+
});
|
|
26
|
+
return moduleToolbarElement;
|
|
27
|
+
};
|
|
28
|
+
const CustomDashboardToolbarFactory = (props) => {
|
|
29
|
+
const revision = (0, react_redux_1.useSelector)((state) => state.System.DashboardRevision);
|
|
30
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
31
|
+
const customToolbars = adaptable.api.dashboardApi.getCustomToolbars();
|
|
32
|
+
const customToolbar = customToolbars && customToolbars.find((ct) => ct.name == props.toolbarName);
|
|
33
|
+
if (customToolbar) {
|
|
34
|
+
return React.createElement(CustomToolbar_1.CustomToolbarCmp, { customToolbar: customToolbar, dashboardRevision: revision });
|
|
35
|
+
}
|
|
36
|
+
return React.createElement(React.Fragment, null);
|
|
37
|
+
};
|
|
38
|
+
const DashboardToolbarFactory = (props) => {
|
|
39
|
+
if (Types_1.ALL_MODULES.includes(props.toolbarName)) {
|
|
40
|
+
return React.createElement(SystemDashboardToolbarFactory, { toolbarName: props.toolbarName });
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return React.createElement(CustomDashboardToolbarFactory, { toolbarName: props.toolbarName });
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.DashboardToolbarFactory = DashboardToolbarFactory;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PinnedDashboard = 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 DashboardToolbarFactory_1 = require("./DashboardToolbarFactory");
|
|
9
|
+
const PinnedDashboard = (props) => {
|
|
10
|
+
const dashboardState = (0, react_redux_1.useSelector)((state) => state.Dashboard);
|
|
11
|
+
const pinnedToolbars = dashboardState.PinnedToolbars;
|
|
12
|
+
if (!pinnedToolbars || pinnedToolbars.length == 0) {
|
|
13
|
+
return React.createElement(React.Fragment, null);
|
|
14
|
+
}
|
|
15
|
+
return (React.createElement(rebass_1.Flex, { p: 1, className: "ab-Dashboard__pinned-content" }, pinnedToolbars.map((toolbar, index) => {
|
|
16
|
+
return (React.createElement(rebass_1.Box, { mr: 2, mb: 1, className: `ab-Dashboard__pinned-container ab-Dashboard__pinned-container--${toolbar}` },
|
|
17
|
+
React.createElement(rebass_1.Box, { className: "ab-Dashboard__toolbar-content" },
|
|
18
|
+
React.createElement(DashboardToolbarFactory_1.DashboardToolbarFactory, { key: index, toolbarName: toolbar }))));
|
|
19
|
+
})));
|
|
20
|
+
};
|
|
21
|
+
exports.PinnedDashboard = PinnedDashboard;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PinnedToolbarsSelector = 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 ModuleManager_1 = require("../../components/DragAndDropContext/ModuleManager");
|
|
8
|
+
const Types_1 = require("../../PredefinedConfig/Common/Types");
|
|
9
|
+
const DashboardRedux_1 = require("../../Redux/ActionsReducers/DashboardRedux");
|
|
10
|
+
const AdaptableContext_1 = require("../AdaptableContext");
|
|
11
|
+
const PinnedToolbarsSelector = (props) => {
|
|
12
|
+
const { api } = (0, AdaptableContext_1.useAdaptable)();
|
|
13
|
+
const dashboardAccessLevel = api.internalApi
|
|
14
|
+
.getEntitlementService()
|
|
15
|
+
.getEntitlementAccessLevelForModule('Dashboard');
|
|
16
|
+
const isDashboardDisabled = dashboardAccessLevel === 'ReadOnly';
|
|
17
|
+
const dashboardState = (0, react_redux_1.useSelector)((state) => state.Dashboard);
|
|
18
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
19
|
+
const pinnedToolbars = dashboardState.PinnedToolbars;
|
|
20
|
+
const moduleService = api.internalApi.getModuleService();
|
|
21
|
+
const toolbars = React.useMemo(() => {
|
|
22
|
+
const availableToolbars = Types_1.ALL_TOOLBARS;
|
|
23
|
+
const systemToolbars = availableToolbars
|
|
24
|
+
.filter((at) => api.internalApi.getModuleService().isModuleAvailable(at))
|
|
25
|
+
.map((at) => ({
|
|
26
|
+
Id: at,
|
|
27
|
+
Title: moduleService.getModuleInfoByModule(at).FriendlyName,
|
|
28
|
+
}));
|
|
29
|
+
const customToolbars = api.dashboardApi.getCustomToolbars().map((ct) => ({
|
|
30
|
+
Id: ct.name,
|
|
31
|
+
Title: ct.title ? ct.title : ct.name,
|
|
32
|
+
}));
|
|
33
|
+
return [...systemToolbars, ...customToolbars];
|
|
34
|
+
}, []);
|
|
35
|
+
const tabs = React.useMemo(() => {
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
Name: 'Pinned Toolbars',
|
|
39
|
+
Items: pinnedToolbars !== null && pinnedToolbars !== void 0 ? pinnedToolbars : [],
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}, [pinnedToolbars]);
|
|
43
|
+
return (React.createElement(ModuleManager_1.ModuleManager, { permittedActions: {
|
|
44
|
+
createTab: false,
|
|
45
|
+
dragAndDropTab: false,
|
|
46
|
+
deleteTab: false,
|
|
47
|
+
editTabName: false,
|
|
48
|
+
}, onTabsChange: (tabs) => {
|
|
49
|
+
dispatch((0, DashboardRedux_1.DashboardSetPinnedToolbars)(tabs[0].Items));
|
|
50
|
+
}, disabled: isDashboardDisabled, tabs: tabs, availableItems: toolbars, tabsTitle: 'Pinned Toolbars', unusedPanelTitle: "Available Pinned Toolbar Panels", dragItemText: "Drag into the Panel below" }));
|
|
51
|
+
};
|
|
52
|
+
exports.PinnedToolbarsSelector = PinnedToolbarsSelector;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataImportValidationError } from '../../../types';
|
|
2
|
+
import { AdaptableColumn, DataImportValidationError } from '../../../types';
|
|
3
3
|
export interface ValidationErrorsMap {
|
|
4
4
|
[key: string]: DataImportValidationError[] | null;
|
|
5
5
|
}
|
|
6
|
+
export declare type ColumnsMap = {
|
|
7
|
+
field: string;
|
|
8
|
+
abColumn?: AdaptableColumn;
|
|
9
|
+
include?: boolean;
|
|
10
|
+
};
|
|
6
11
|
export declare const DataImportWizard: (props: {
|
|
7
12
|
onClose: () => void;
|
|
8
13
|
}) => JSX.Element;
|
|
@@ -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 {};
|