@adaptabletools/adaptable 11.1.7 → 11.1.10
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 +16 -0
- package/bundle.cjs.js +106 -106
- package/index.css +20 -0
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +1 -1
- package/src/AdaptableOptions/AlertOptions.d.ts +9 -2
- package/src/AdaptableOptions/FinancePluginOptions.d.ts +57 -16
- package/src/AdaptableOptions/GeneralOptions.d.ts +7 -0
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +7 -0
- package/src/Api/AdaptableApi.d.ts +5 -0
- package/src/Api/CellSummaryApi.d.ts +8 -0
- package/src/Api/ColumnApi.d.ts +6 -1
- package/src/Api/ConfigApi.d.ts +8 -2
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
- package/src/Api/Implementation/AdaptableApiImpl.js +2 -0
- package/src/Api/Implementation/AlertApiImpl.js +32 -15
- package/src/Api/Implementation/CellSummaryApiImpl.d.ts +2 -0
- package/src/Api/Implementation/CellSummaryApiImpl.js +34 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -1
- package/src/Api/Implementation/ColumnApiImpl.js +7 -3
- package/src/Api/Implementation/ConfigApiImpl.d.ts +2 -2
- package/src/Api/Implementation/ConfigApiImpl.js +8 -29
- package/src/Api/Implementation/GridApiImpl.js +0 -4
- package/src/Api/Implementation/InternalApiImpl.d.ts +2 -1
- package/src/Api/Implementation/InternalApiImpl.js +29 -7
- package/src/Api/Implementation/LayoutApiImpl.d.ts +5 -4
- package/src/Api/Implementation/LayoutApiImpl.js +13 -7
- package/src/Api/Implementation/QueryApiImpl.d.ts +1 -0
- package/src/Api/Implementation/QueryApiImpl.js +12 -0
- package/src/Api/Implementation/StatusBarApiImpl.d.ts +8 -0
- package/src/Api/Implementation/StatusBarApiImpl.js +17 -0
- package/src/Api/InternalApi.d.ts +2 -1
- package/src/Api/LayoutApi.d.ts +16 -9
- package/src/Api/QueryApi.d.ts +6 -0
- package/src/Api/StatusBarApi.d.ts +10 -0
- package/src/Api/StatusBarApi.js +2 -0
- package/src/PredefinedConfig/AdaptableState.d.ts +20 -8
- package/src/PredefinedConfig/Common/FDC3Context.d.ts +61 -29
- package/src/PredefinedConfig/Common/Types.d.ts +6 -3
- package/src/PredefinedConfig/Common/Types.js +32 -1
- package/src/PredefinedConfig/FlashingCellState.d.ts +1 -1
- package/src/PredefinedConfig/FormatColumnState.d.ts +1 -1
- package/src/PredefinedConfig/GridState.d.ts +1 -1
- package/src/PredefinedConfig/PredefinedConfig.d.ts +5 -0
- package/src/PredefinedConfig/StatusBarState.d.ts +27 -0
- package/src/PredefinedConfig/StatusBarState.js +7 -0
- package/src/PredefinedConfig/ToolPanelState.d.ts +1 -1
- package/src/Redux/ActionsReducers/GridRedux.d.ts +2 -2
- package/src/Redux/ActionsReducers/GridRedux.js +4 -4
- package/src/Redux/ActionsReducers/StatusBarRedux.d.ts +22 -0
- package/src/Redux/ActionsReducers/StatusBarRedux.js +31 -0
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +8 -3
- package/src/Redux/ActionsReducers/SystemRedux.js +22 -5
- package/src/Redux/Store/AdaptableReduxMerger.js +2 -2
- package/src/Redux/Store/AdaptableStore.js +24 -10
- package/src/Strategy/AlertModule.d.ts +3 -0
- package/src/Strategy/AlertModule.js +6 -0
- package/src/Strategy/CellSummaryModule.d.ts +6 -0
- package/src/Strategy/CellSummaryModule.js +14 -0
- package/src/Strategy/DataChangeHistoryModule.d.ts +7 -0
- package/src/Strategy/DataChangeHistoryModule.js +11 -0
- package/src/Strategy/ExportModule.d.ts +1 -0
- package/src/Strategy/ExportModule.js +1 -0
- package/src/Strategy/FilterModule.d.ts +6 -0
- package/src/Strategy/FilterModule.js +21 -0
- package/src/Strategy/Interface/IModule.d.ts +21 -10
- package/src/Strategy/LayoutModule.d.ts +7 -0
- package/src/Strategy/LayoutModule.js +14 -1
- package/src/Strategy/QueryModule.d.ts +8 -0
- package/src/Strategy/QueryModule.js +18 -0
- package/src/Strategy/QuickSearchModule.d.ts +6 -0
- package/src/Strategy/QuickSearchModule.js +10 -0
- package/src/Strategy/StatusBarModule.d.ts +8 -0
- package/src/Strategy/StatusBarModule.js +39 -0
- package/src/Strategy/SystemStatusModule.d.ts +6 -0
- package/src/Strategy/SystemStatusModule.js +10 -0
- package/src/Strategy/ThemeModule.d.ts +7 -0
- package/src/Strategy/ThemeModule.js +12 -0
- package/src/Strategy/Utilities/getAlertBehaviourViewItems.js +1 -1
- package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
- package/src/Utilities/Constants/GeneralConstants.js +2 -1
- package/src/Utilities/Constants/ModuleConstants.d.ts +1 -0
- package/src/Utilities/Constants/ModuleConstants.js +2 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +4 -1
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -0
- package/src/Utilities/Services/ModuleService.js +6 -6
- package/src/View/AdaptablePopover/index.d.ts +1 -0
- package/src/View/AdaptablePopover/index.js +5 -2
- package/src/View/AdaptableViewFactory.js +2 -2
- package/src/View/Alert/AlertStatusSubPanel.d.ts +2 -0
- package/src/View/Alert/AlertStatusSubPanel.js +56 -0
- package/src/View/Alert/AlertViewPanel.js +6 -7
- package/src/View/Alert/AlertsPanel.d.ts +1 -1
- package/src/View/Alert/AlertsPanel.js +2 -1
- package/src/View/Alert/Utilities/getAlertButtonStyle.d.ts +5 -0
- package/src/View/Alert/Utilities/getAlertButtonStyle.js +15 -0
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +18 -7
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +1 -8
- package/src/View/Alert/Wizard/AlertWizard.js +3 -2
- package/src/View/CellSummary/CellSummaryStatusBarSubPanelPopover.d.ts +2 -0
- package/src/View/CellSummary/CellSummaryStatusBarSubPanelPopover.js +15 -0
- package/src/View/CellSummary/CellSummaryStatusPanel.d.ts +2 -0
- package/src/View/CellSummary/CellSummaryStatusPanel.js +36 -0
- package/src/View/CellSummary/CellSummaryViewPanel.js +2 -20
- package/src/View/ColorPicker.d.ts +1 -1
- package/src/View/Components/AdaptableDateInput/index.d.ts +1 -1
- package/src/View/Components/AdaptableInput/index.d.ts +1 -1
- package/src/View/Components/Buttons/ButtonDelete.d.ts +1 -1
- package/src/View/Components/FilterForm/getDefaultColumnFilterPredicate.d.ts +1 -1
- package/src/View/Components/Forms/AdaptableFormControlTextClear.d.ts +1 -1
- package/src/View/Components/Forms/AdaptableFormControlTextClear.js +1 -1
- package/src/View/Components/Panels/PanelWithImage.d.ts +6 -6
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +5 -4
- package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +1 -1
- package/src/View/Components/RangesComponent.js +6 -2
- package/src/View/Components/StyleComponent.js +18 -6
- package/src/View/Components/ToolPanel/AdaptableToolPanel.js +1 -1
- package/src/View/Components/ToolPanel/ToolPanelPopup.js +3 -3
- package/src/View/Dashboard/DashboardPopup.js +2 -2
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +5 -13
- package/src/View/DataChangeHistory/DataChangeHistoryStatusBarContent.d.ts +2 -0
- package/src/View/DataChangeHistory/DataChangeHistoryStatusBarContent.js +9 -0
- package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.d.ts +4 -16
- package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.js +32 -40
- package/src/View/Filter/ActiveFiltersPanel.d.ts +0 -2
- package/src/View/Filter/FilterStatusBarSubPanelPopover.d.ts +2 -0
- package/src/View/Filter/FilterStatusBarSubPanelPopover.js +18 -0
- package/src/View/Filter/FilterViewPanel.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +1 -1
- package/src/View/GridInfo/GridInfoPopup.js +4 -1
- package/src/View/Layout/EditCurrentLayoutButton.d.ts +2 -0
- package/src/View/Layout/EditCurrentLayoutButton.js +14 -0
- package/src/View/Layout/LayoutPopup.d.ts +1 -1
- package/src/View/Layout/LayoutPopup.js +3 -3
- package/src/View/Layout/LayoutRadioSelector.d.ts +1 -0
- package/src/View/Layout/LayoutRadioSelector.js +2 -2
- package/src/View/Layout/LayoutStatusBarSubPanelPopover.d.ts +2 -0
- package/src/View/Layout/LayoutStatusBarSubPanelPopover.js +29 -0
- package/src/View/Layout/Wizard/LayoutEditor/ColumnLabels.js +2 -1
- package/src/View/Layout/Wizard/LayoutEditor/index.js +1 -1
- package/src/View/Layout/Wizard/LayoutEditorWizard.js +2 -1
- package/src/View/Query/EditCurrentQueryButton.d.ts +2 -0
- package/src/View/Query/EditCurrentQueryButton.js +15 -0
- package/src/View/Query/QueryViewPanel.d.ts +0 -1
- package/src/View/Query/QueryViewPanel.js +2 -11
- package/src/View/QuickSearch/QuickSearchPopup.js +1 -1
- package/src/View/QuickSearch/QuickSearchStatusBarContent.d.ts +2 -0
- package/src/View/QuickSearch/QuickSearchStatusBarContent.js +16 -0
- package/src/View/StateManagement/StateManagementPopup.js +9 -7
- package/src/View/StateManagement/StateManagementViewPanel.js +1 -2
- package/src/View/StateManagement/components/ExportDropdown.d.ts +1 -1
- package/src/View/StateManagement/components/ExportDropdown.js +3 -7
- package/src/View/StateManagement/handleExportState.d.ts +1 -1
- package/src/View/StatusBar/AdaptableStatusBar.d.ts +3 -0
- package/src/View/StatusBar/AdaptableStatusBar.js +44 -0
- package/src/View/StatusBar/StatusBarPanel.d.ts +42 -0
- package/src/View/StatusBar/StatusBarPanel.js +45 -0
- package/src/View/StatusBar/StatusBarPopup.d.ts +3 -0
- package/src/View/StatusBar/StatusBarPopup.js +43 -0
- package/src/View/SystemStatus/SystemStatusStatusBarContent.d.ts +2 -0
- package/src/View/SystemStatus/SystemStatusStatusBarContent.js +15 -0
- package/src/View/SystemStatus/SystemStatusViewPanel.js +3 -7
- package/src/View/SystemStatus/Utilities/getStatusItemStyle.d.ts +5 -0
- package/src/View/SystemStatus/Utilities/getStatusItemStyle.js +16 -0
- package/src/View/Theme/ThemeStatusPanelPopover.d.ts +2 -0
- package/src/View/Theme/ThemeStatusPanelPopover.js +36 -0
- package/src/agGrid/Adaptable.d.ts +2 -0
- package/src/agGrid/Adaptable.js +30 -3
- package/src/agGrid/agGridHelper.js +2 -0
- package/src/agGrid/agGridMenuHelper.js +2 -2
- package/src/agGrid/createAgStatusPanelComponent.d.ts +21 -0
- package/src/agGrid/createAgStatusPanelComponent.js +31 -0
- package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +1 -1
- package/src/components/Dashboard/DashboardManager.js +9 -162
- package/src/components/Datepicker/index.d.ts +1 -1
- package/src/components/DragAndDropContext/DragAndDropContext.d.ts +7 -0
- package/src/components/DragAndDropContext/DragAndDropContext.js +14 -0
- package/src/components/DragAndDropContext/ModuleManager.d.ts +17 -0
- package/src/components/DragAndDropContext/ModuleManager.js +81 -0
- package/src/components/DragAndDropContext/TabList.d.ts +29 -0
- package/src/components/DragAndDropContext/TabList.js +72 -0
- package/src/components/DragAndDropContext/UnusedPanel.d.ts +6 -0
- package/src/components/DragAndDropContext/UnusedPanel.js +46 -0
- package/src/components/DragAndDropContext/types.d.ts +8 -0
- package/src/components/DragAndDropContext/types.js +2 -0
- package/src/components/FormLayout/index.d.ts +1 -0
- package/src/components/Input/index.d.ts +1 -1
- package/src/components/List/ListGroupItem/index.d.ts +1 -1
- package/src/components/PopupWithFooter.d.ts +1 -1
- package/src/components/SimpleButton/index.js +3 -0
- package/src/components/Textarea/index.d.ts +1 -1
- package/src/components/icons/DefaultIcon.d.ts +2 -1
- package/src/components/icons/DefaultIcon.js +2 -2
- package/src/components/icons/index.js +2 -0
- package/src/components/icons/statusbar.d.ts +3 -0
- package/src/components/icons/statusbar.js +8 -0
- package/src/metamodel/adaptable.metamodel.d.ts +236 -0
- package/src/metamodel/adaptable.metamodel.js +466 -47
- package/src/types.d.ts +5 -4
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -58,6 +58,9 @@ const DocumentationLinkConstants_1 = require("../Utilities/Constants/Documentati
|
|
|
58
58
|
const ModuleConstants_1 = require("../Utilities/Constants/ModuleConstants");
|
|
59
59
|
const CheckboxRenderer_1 = require("./CheckboxRenderer");
|
|
60
60
|
const DateHelper_1 = require("../Utilities/Helpers/DateHelper");
|
|
61
|
+
const StatusBarState_1 = require("../PredefinedConfig/StatusBarState");
|
|
62
|
+
const createAgStatusPanelComponent_1 = require("./createAgStatusPanelComponent");
|
|
63
|
+
const AdaptableStatusBar_1 = require("../View/StatusBar/AdaptableStatusBar");
|
|
61
64
|
const tinycolor = require('tinycolor2');
|
|
62
65
|
all_modules_1.ModuleRegistry.registerModules(all_modules_1.AllCommunityModules);
|
|
63
66
|
const GROUP_PATH_SEPARATOR = '/';
|
|
@@ -561,6 +564,7 @@ class Adaptable {
|
|
|
561
564
|
}
|
|
562
565
|
}
|
|
563
566
|
}
|
|
567
|
+
this.createStatusBars();
|
|
564
568
|
const checkAgGridContainer = () => {
|
|
565
569
|
let agGridContainer = this.getAgGridContainerElement();
|
|
566
570
|
if (!agGridContainer) {
|
|
@@ -635,6 +639,29 @@ class Adaptable {
|
|
|
635
639
|
}
|
|
636
640
|
return (this.adaptableOptions.containerOptions.agGridContainer = agGridContainer);
|
|
637
641
|
}
|
|
642
|
+
createStatusBars() {
|
|
643
|
+
var _a, _b;
|
|
644
|
+
const statusBarOptions = Object.assign({}, this.gridOptions.statusBar);
|
|
645
|
+
const statusPanels = (_b = ((_a = statusBarOptions === null || statusBarOptions === void 0 ? void 0 : statusBarOptions.statusPanels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.map((statusPanel) => {
|
|
646
|
+
if (statusPanel.statusPanel === StatusBarState_1.ADAPTABLE_STATUS_PANEL) {
|
|
647
|
+
const context = {
|
|
648
|
+
Key: statusPanel.key,
|
|
649
|
+
};
|
|
650
|
+
return Object.assign(Object.assign({}, statusPanel), { statusPanel: createAgStatusPanelComponent_1.createAgStatusPanelComponent(AdaptableStatusBar_1.AdaptableStatusBar, this, context) });
|
|
651
|
+
}
|
|
652
|
+
return statusPanel;
|
|
653
|
+
});
|
|
654
|
+
statusBarOptions.statusPanels = statusPanels;
|
|
655
|
+
this.gridOptions.statusBar = statusBarOptions;
|
|
656
|
+
const statusBarModule = this.ModuleService.getModuleById(ModuleConstants.StatusBarModuleId);
|
|
657
|
+
this.api.eventApi.on('AdaptableReady', () => {
|
|
658
|
+
statusBarModule.syncStateWithOptions();
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
getAgGridStatusPanels() {
|
|
662
|
+
var _a, _b, _c;
|
|
663
|
+
return (_c = (_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.statusBar) === null || _b === void 0 ? void 0 : _b.statusPanels) !== null && _c !== void 0 ? _c : [];
|
|
664
|
+
}
|
|
638
665
|
filterOnEditDataChange() {
|
|
639
666
|
if (this.adaptableOptions.filterOptions.filterActionOnUserDataChange.applyFilter ==
|
|
640
667
|
Enums_1.FilterOnDataChangeOptions.Always) {
|
|
@@ -758,7 +785,7 @@ class Adaptable {
|
|
|
758
785
|
// TODO sort the visible columns by layout order
|
|
759
786
|
agGridCols.forEach((agGridColumn) => {
|
|
760
787
|
const colId = agGridColumn.getColId();
|
|
761
|
-
if (!this.api.columnApi.
|
|
788
|
+
if (!this.api.columnApi.isAutoRowGroupColumn(colId)) {
|
|
762
789
|
allColumns.push(this.createAdaptableColumn(agGridColumn, colsToGroups));
|
|
763
790
|
}
|
|
764
791
|
});
|
|
@@ -1081,8 +1108,8 @@ class Adaptable {
|
|
|
1081
1108
|
const colId2 = colState2.colId;
|
|
1082
1109
|
const originalIndex1 = columnsStateIndexes[colId1];
|
|
1083
1110
|
const originalIndex2 = columnsStateIndexes[colId2];
|
|
1084
|
-
const isRowGroup1 = this.api.columnApi.
|
|
1085
|
-
const isRowGroup2 = this.api.columnApi.
|
|
1111
|
+
const isRowGroup1 = this.api.columnApi.isAutoRowGroupColumn(colId1);
|
|
1112
|
+
const isRowGroup2 = this.api.columnApi.isAutoRowGroupColumn(colId2);
|
|
1086
1113
|
if (isRowGroup1 && isRowGroup2) {
|
|
1087
1114
|
return 1;
|
|
1088
1115
|
}
|
|
@@ -40,6 +40,7 @@ const SettingsPanelModule_1 = require("../Strategy/SettingsPanelModule");
|
|
|
40
40
|
const ChartingModule_1 = require("../Strategy/ChartingModule");
|
|
41
41
|
const PercentBarRenderer_1 = require("./PercentBarRenderer");
|
|
42
42
|
const Helper_1 = require("../Utilities/Helpers/Helper");
|
|
43
|
+
const StatusBarModule_1 = require("../Strategy/StatusBarModule");
|
|
43
44
|
const tinycolor = require('tinycolor2');
|
|
44
45
|
/**
|
|
45
46
|
* Adaptable AG Grid implementation is getting really big and unwieldy
|
|
@@ -97,6 +98,7 @@ class agGridHelper {
|
|
|
97
98
|
modules.set(ModuleConstants.ThemeModuleId, new ThemeModule_1.ThemeModule(api));
|
|
98
99
|
modules.set(ModuleConstants.GridInfoModuleId, new GridInfoModule_1.GridInfoModule(api));
|
|
99
100
|
modules.set(ModuleConstants.SettingsPanelModuleId, new SettingsPanelModule_1.SettingsPanelModule(api));
|
|
101
|
+
modules.set(ModuleConstants.StatusBarModuleId, new StatusBarModule_1.StatusBarModule(api));
|
|
100
102
|
modules.set(ModuleConstants.ChartingModuleId, new ChartingModule_1.ChartingModule(api));
|
|
101
103
|
return modules;
|
|
102
104
|
}
|
|
@@ -219,7 +219,7 @@ class agGridMenuHelper {
|
|
|
219
219
|
adaptableColumn: adaptableColumn,
|
|
220
220
|
agGridColumn: agGridColumn,
|
|
221
221
|
adaptableApi: this.adaptable.api,
|
|
222
|
-
isRowGroupColumn: this.adaptable.api.columnApi.
|
|
222
|
+
isRowGroupColumn: this.adaptable.api.columnApi.isAutoRowGroupColumn(agGridColumn.getColId()),
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
createContextMenuContextObject(params, adaptableColumn) {
|
|
@@ -254,7 +254,7 @@ class agGridMenuHelper {
|
|
|
254
254
|
adaptableApi: this.adaptable.api,
|
|
255
255
|
selectedCellInfo: selectedCellInfo,
|
|
256
256
|
selectedRowInfo: selectedRowInfo,
|
|
257
|
-
isRowGroupColumn: this.adaptable.api.columnApi.
|
|
257
|
+
isRowGroupColumn: this.adaptable.api.columnApi.isAutoRowGroupColumn(params.column.getColId()),
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
260
|
createAgGridContextMenuItems(originalgetContextMenuItems, params) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IStatusPanelParams } from '@ag-grid-community/all-modules';
|
|
3
|
+
import { AdaptableApi } from '../../types';
|
|
4
|
+
import { IAdaptable } from '../AdaptableInterfaces/IAdaptable';
|
|
5
|
+
export interface StatusPanelProps {
|
|
6
|
+
params: IStatusPanelParams;
|
|
7
|
+
adaptableApi: AdaptableApi;
|
|
8
|
+
context: {
|
|
9
|
+
Key: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const createAgStatusPanelComponent: (component: React.FunctionComponent<StatusPanelProps>, adaptable: IAdaptable, context: StatusPanelProps['context']) => {
|
|
13
|
+
new (): {
|
|
14
|
+
params: IStatusPanelParams;
|
|
15
|
+
eGui: HTMLElement;
|
|
16
|
+
init(params: IStatusPanelParams): void;
|
|
17
|
+
render(): void;
|
|
18
|
+
getGui(): HTMLElement;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAgStatusPanelComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const ReactDOM = tslib_1.__importStar(require("react-dom"));
|
|
7
|
+
const renderWithAdaptableContext_1 = require("../View/renderWithAdaptableContext");
|
|
8
|
+
exports.createAgStatusPanelComponent = (component, adaptable, context) => {
|
|
9
|
+
return class StatusBarRenderer {
|
|
10
|
+
init(params) {
|
|
11
|
+
this.params = params;
|
|
12
|
+
this.eGui = document.createElement('div');
|
|
13
|
+
this.render();
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
const props = {
|
|
17
|
+
params: this.params,
|
|
18
|
+
adaptableApi: adaptable.api,
|
|
19
|
+
context,
|
|
20
|
+
};
|
|
21
|
+
const children = renderWithAdaptableContext_1.renderWithAdaptableContext(React.createElement(component, props), adaptable);
|
|
22
|
+
ReactDOM.render(children, this.eGui);
|
|
23
|
+
}
|
|
24
|
+
getGui() {
|
|
25
|
+
return this.eGui;
|
|
26
|
+
}
|
|
27
|
+
destroy() {
|
|
28
|
+
ReactDOM.unmountComponentAtNode(this.eGui);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -76,7 +76,7 @@ function AdaptableFormComponent({ formDef, data, onChange, onButtonClick, displa
|
|
|
76
76
|
overflow: 'hidden',
|
|
77
77
|
textOverflow: 'ellipsis',
|
|
78
78
|
fontSize: 'small',
|
|
79
|
-
}, items: items, className: "ab-options__select", variant: "outlined" }, value));
|
|
79
|
+
}, items: items, className: "ab-options__select", variant: "outlined", columns: ['label'] }, value));
|
|
80
80
|
case 'checkbox':
|
|
81
81
|
return (React.createElement(Input_1.default, { type: "checkbox", name: field.name, checked: value, onChange: (event) => {
|
|
82
82
|
setFieldValue(field.name, event.target.checked);
|
|
@@ -1,171 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const react_1 = require("react");
|
|
5
4
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const
|
|
7
|
-
const SimpleButton_1 = tslib_1.__importDefault(require("../SimpleButton"));
|
|
8
|
-
const icons_1 = require("../icons");
|
|
9
|
-
const PanelWithButton_1 = require("../../View/Components/Panels/PanelWithButton");
|
|
10
|
-
const DashboardManagerContext = react_1.createContext({
|
|
11
|
-
availableToolbars: [],
|
|
12
|
-
});
|
|
13
|
-
const getToolbarTitle = (availableToolbars, toolbarId) => {
|
|
14
|
-
const found = availableToolbars.find((t) => t.Id === toolbarId);
|
|
15
|
-
return found ? found.Title : toolbarId;
|
|
16
|
-
};
|
|
17
|
-
function TabList({ tabs, onRemoveTab, onRemoveToolbar, onChangeTabName, disabled, }) {
|
|
18
|
-
return (React.createElement(react_beautiful_dnd_1.Droppable, { droppableId: "MAIN", type: "TAB", direction: "horizontal" }, (provided) => (React.createElement("div", Object.assign({ ref: provided.innerRef }, provided.droppableProps, { style: { display: 'flex' }, "data-name": "dashboard-tabs" }),
|
|
19
|
-
tabs.map((tab, tabIndex) => (React.createElement(TabItem, { disabled: disabled, key: tabIndex, tabIndex: tabIndex, tab: tab, onRemove: () => onRemoveTab(tabIndex), onRemoveToolbar: (toolbarIndex) => onRemoveToolbar(tabIndex, toolbarIndex), onChangeTabName: (tabName) => onChangeTabName(tabIndex, tabName) }))),
|
|
20
|
-
provided.placeholder))));
|
|
21
|
-
}
|
|
22
|
-
function TabItem({ tab, tabIndex, onRemove, onRemoveToolbar, onChangeTabName, disabled, }) {
|
|
23
|
-
return (React.createElement(react_beautiful_dnd_1.Draggable, { isDragDisabled: disabled, draggableId: String(tabIndex), index: tabIndex }, (provided) => (React.createElement("div", Object.assign({ "data-name": "dashboard-tab", ref: provided.innerRef }, provided.draggableProps, { style: Object.assign(Object.assign({}, (disabled ? {} : provided.draggableProps.style)), { boxSizing: 'border-box', border: '1px solid var(--ab-color-primarydark)', borderRadius: 'var(--ab__border-radius)', marginRight: 'var(--ab-space-2)', width: 160, display: 'flex', flexDirection: 'column' }) }),
|
|
24
|
-
React.createElement("div", { style: {
|
|
25
|
-
display: 'flex',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
padding: 'var(--ab-space-1)',
|
|
28
|
-
borderBottom: '1px solid var(--ab-color-primarydark)',
|
|
29
|
-
} },
|
|
30
|
-
React.createElement("div", Object.assign({}, (disabled ? {} : provided.dragHandleProps), { style: {} }),
|
|
31
|
-
React.createElement(icons_1.Icon, { name: "drag" })),
|
|
32
|
-
React.createElement("input", { type: "text", disabled: disabled, value: tab.Name, style: {
|
|
33
|
-
flex: 1,
|
|
34
|
-
width: '100%',
|
|
35
|
-
border: 'none',
|
|
36
|
-
marginLeft: 'var(--ab-space-1)',
|
|
37
|
-
marginRight: 'var(--ab-space-1)',
|
|
38
|
-
alignSelf: 'stretch',
|
|
39
|
-
background: 'transparent',
|
|
40
|
-
color: 'var(--ab-color-text-on-primary)',
|
|
41
|
-
}, onChange: (event) => {
|
|
42
|
-
onChangeTabName(event.target.value);
|
|
43
|
-
} }),
|
|
44
|
-
React.createElement(SimpleButton_1.default, { disabled: disabled, icon: "delete", variant: "text", onClick: onRemove })),
|
|
45
|
-
React.createElement(ToolbarList, { disabled: disabled, toolbars: tab.Toolbars, droppableId: String(tabIndex), onRemove: onRemoveToolbar })))));
|
|
46
|
-
}
|
|
47
|
-
function ToolbarList({ toolbars, droppableId, onRemove, disabled, }) {
|
|
48
|
-
return (React.createElement(react_beautiful_dnd_1.Droppable, { droppableId: droppableId, type: "TOOLBAR" }, (provided, snapshot) => (React.createElement("div", Object.assign({ ref: provided.innerRef }, (disabled ? {} : provided.droppableProps), { "data-name": "dashboard-toolbar-drop-target", style: {
|
|
49
|
-
flex: 1,
|
|
50
|
-
padding: 4,
|
|
51
|
-
paddingBottom: 0,
|
|
52
|
-
background: snapshot.isDraggingOver
|
|
53
|
-
? 'var(--ab-dashboard-tab-drop-target__background)'
|
|
54
|
-
: '',
|
|
55
|
-
minHeight: 200,
|
|
56
|
-
} }),
|
|
57
|
-
toolbars.map((toolbar, toolbarIndex) => (React.createElement(ToolbarItem, { disabled: disabled, key: toolbar, toolbar: toolbar, toolbarIndex: toolbarIndex, onRemove: () => onRemove(toolbarIndex) }))),
|
|
58
|
-
provided.placeholder))));
|
|
59
|
-
}
|
|
60
|
-
function ToolbarItem({ toolbar, toolbarIndex, onRemove, disabled, }) {
|
|
61
|
-
const { availableToolbars } = react_1.useContext(DashboardManagerContext);
|
|
62
|
-
return (React.createElement(react_beautiful_dnd_1.Draggable, { isDragDisabled: disabled, draggableId: toolbar, index: toolbarIndex }, (provided, snapshot) => (React.createElement("div", Object.assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { style: Object.assign(Object.assign({}, provided.draggableProps.style), { display: 'flex', alignItems: 'center', border: '1px solid var(--ab-color-primary)', backgroundColor: snapshot.isDragging
|
|
63
|
-
? 'var(--ab-dashboard-toolbar-drag__background)'
|
|
64
|
-
: 'var(--ab-color-primarylight)', paddingLeft: 'var(--ab-space-1)', marginBottom: 'var(--ab-space-1)' }) }),
|
|
65
|
-
React.createElement("div", { style: { flex: 1 } }, getToolbarTitle(availableToolbars, toolbar)),
|
|
66
|
-
React.createElement(SimpleButton_1.default, { disabled: disabled, icon: "clear", variant: "text", padding: 1, onClick: onRemove })))));
|
|
67
|
-
}
|
|
68
|
-
function UnusedPanel({ toolbars, disabled }) {
|
|
69
|
-
return (React.createElement("div", { "data-name": "dashboard-toolbars", style: {
|
|
70
|
-
border: '1px solid var(--ab-color-primarydark)',
|
|
71
|
-
borderRadius: 'var(--ab__border-radius)',
|
|
72
|
-
marginBottom: 'var(--ab-space-2)',
|
|
73
|
-
paddingBottom: 'var(--ab-space-1)',
|
|
74
|
-
backgroundColor: 'var(--ab-color-defaultbackground)',
|
|
75
|
-
} },
|
|
76
|
-
React.createElement("div", { style: { padding: 'var(--ab-space-2)' } },
|
|
77
|
-
React.createElement("b", null, "Available Toolbars"),
|
|
78
|
-
" (drag into a Tab below)"),
|
|
79
|
-
React.createElement(UnusedToolbarList, { disabled: disabled, toolbars: toolbars })));
|
|
80
|
-
}
|
|
81
|
-
function UnusedToolbarList({ toolbars, disabled }) {
|
|
82
|
-
return (React.createElement(react_beautiful_dnd_1.Droppable, { droppableId: "UNUSED", type: "TOOLBAR", isDropDisabled: true, direction: "horizontal" }, (provided) => (React.createElement("div", Object.assign({ ref: provided.innerRef, "data-name": "dashboard-toolbars-list" }, provided.droppableProps, { style: {
|
|
83
|
-
display: 'flex',
|
|
84
|
-
flexDirection: 'row',
|
|
85
|
-
flexWrap: 'wrap',
|
|
86
|
-
paddingLeft: 'var(--ab-space-2)',
|
|
87
|
-
paddingRight: 'var(--ab-space-2)',
|
|
88
|
-
} }),
|
|
89
|
-
toolbars.map((toolbar, toolbarIndex) => (React.createElement(UnusedToolbarItem, { disabled: disabled, key: toolbar, toolbar: toolbar, toolbarIndex: toolbarIndex }))),
|
|
90
|
-
provided.placeholder))));
|
|
91
|
-
}
|
|
92
|
-
function UnusedToolbarItem({ toolbar, toolbarIndex, disabled, }) {
|
|
93
|
-
const { availableToolbars } = react_1.useContext(DashboardManagerContext);
|
|
94
|
-
return (React.createElement(react_beautiful_dnd_1.Draggable, { isDragDisabled: disabled, draggableId: toolbar, index: toolbarIndex }, (provided, snapshot) => {
|
|
95
|
-
const eventHandlers = disabled
|
|
96
|
-
? {}
|
|
97
|
-
: Object.assign(Object.assign({}, provided.draggableProps), provided.dragHandleProps);
|
|
98
|
-
const dragStyle = disabled ? {} : provided.draggableProps.style;
|
|
99
|
-
return (React.createElement("div", Object.assign({ "data-name": "dashboard-toolbar", ref: provided.innerRef }, eventHandlers, { style: Object.assign(Object.assign({}, dragStyle), { border: '1px solid var(--ab-color-primary)', backgroundColor: snapshot.isDragging
|
|
100
|
-
? 'var(--ab-dashboard-toolbar-drag__background)'
|
|
101
|
-
: 'var(--ab-color-primarylight)', padding: 'var(--ab-space-1) var(--ab-space-2)', marginRight: 'var(--ab-space-1)', marginBottom: 'var(--ab-space-1)' }) }), getToolbarTitle(availableToolbars, toolbar)));
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
5
|
+
const ModuleManager_1 = require("../DragAndDropContext/ModuleManager");
|
|
104
6
|
const DashboardManager = ({ tabs, onTabsChange, availableToolbars, api, disabled, }) => {
|
|
105
7
|
const moduleService = api.internalApi.getModuleService();
|
|
106
8
|
const moduleInfo = moduleService.getModuleInfoByModule('Dashboard');
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
})
|
|
110
|
-
const
|
|
111
|
-
.map((
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const handleToolbarDragEnd = (result) => {
|
|
116
|
-
const { source, destination, draggableId } = result;
|
|
117
|
-
if (!source || !destination) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (source.droppableId !== 'UNUSED') {
|
|
121
|
-
const sourceTabToolbars = tabs[Number(source.droppableId)].Toolbars;
|
|
122
|
-
sourceTabToolbars.splice(source.index, 1);
|
|
123
|
-
}
|
|
124
|
-
if (destination.droppableId !== 'UNUSED') {
|
|
125
|
-
const destinationTabToolbars = tabs[Number(destination.droppableId)].Toolbars;
|
|
126
|
-
destinationTabToolbars.splice(destination.index, 0, draggableId);
|
|
127
|
-
}
|
|
128
|
-
onTabsChange([...tabs]);
|
|
129
|
-
};
|
|
130
|
-
const handleTabDragEnd = (result) => {
|
|
131
|
-
const { source, destination } = result;
|
|
132
|
-
if (!source || !destination)
|
|
133
|
-
return;
|
|
134
|
-
const [removed] = tabs.splice(source.index, 1);
|
|
135
|
-
tabs.splice(destination.index, 0, removed);
|
|
136
|
-
onTabsChange([...tabs]);
|
|
137
|
-
};
|
|
138
|
-
const handleRemoveTab = (tabIndex) => {
|
|
139
|
-
onTabsChange(tabs.filter((_, index) => index !== tabIndex));
|
|
140
|
-
};
|
|
141
|
-
const handleTabAdd = () => {
|
|
142
|
-
onTabsChange([...tabs, { Name: 'New Tab', Toolbars: [] }]);
|
|
143
|
-
};
|
|
144
|
-
const handleRemoveToolbar = (tabIndex, toolbarIndex) => {
|
|
145
|
-
onTabsChange(tabs.map((tab, index) => {
|
|
146
|
-
if (index !== tabIndex)
|
|
147
|
-
return tab;
|
|
148
|
-
return Object.assign(Object.assign({}, tab), { Toolbars: tab.Toolbars.filter((_, index) => index !== toolbarIndex) });
|
|
149
|
-
}));
|
|
150
|
-
};
|
|
151
|
-
const handleChangeTabName = (tabIndex, tabName) => {
|
|
152
|
-
onTabsChange(tabs.map((tab, index) => {
|
|
153
|
-
if (index !== tabIndex)
|
|
154
|
-
return tab;
|
|
155
|
-
return Object.assign(Object.assign({}, tab), { Name: tabName });
|
|
156
|
-
}));
|
|
157
|
-
};
|
|
158
|
-
return (React.createElement(react_beautiful_dnd_1.DragDropContext, { onDragEnd: (result) => {
|
|
159
|
-
if (result.type === 'TAB')
|
|
160
|
-
handleTabDragEnd(result);
|
|
161
|
-
if (result.type === 'TOOLBAR')
|
|
162
|
-
handleToolbarDragEnd(result);
|
|
163
|
-
} },
|
|
164
|
-
React.createElement(DashboardManagerContext.Provider, { value: contextValue },
|
|
165
|
-
React.createElement("div", { style: { display: 'flex', flexDirection: 'column' } },
|
|
166
|
-
React.createElement(UnusedPanel, { disabled: disabled, toolbars: unusedToolbars }),
|
|
167
|
-
React.createElement(PanelWithButton_1.PanelWithButton, { headerText: moduleInfo.FriendlyName + ' Tabs', button: React.createElement(SimpleButton_1.default, { disabled: disabled, onClick: handleTabAdd }, "Add Tab") },
|
|
168
|
-
React.createElement("div", { style: { display: 'flex', flex: 1 } },
|
|
169
|
-
React.createElement(TabList, { disabled: disabled, tabs: tabs, onRemoveTab: handleRemoveTab, onRemoveToolbar: handleRemoveToolbar, onChangeTabName: handleChangeTabName })))))));
|
|
9
|
+
const preparedTabs = tabs.map((tab) => {
|
|
10
|
+
return Object.assign(Object.assign({}, tab), { Items: tab.Toolbars });
|
|
11
|
+
});
|
|
12
|
+
const handleTabsChange = React.useCallback((tabs) => {
|
|
13
|
+
const preparedTabs = tabs.map((tab) => (Object.assign(Object.assign({}, tab), { Toolbars: tab.Items })));
|
|
14
|
+
onTabsChange(preparedTabs);
|
|
15
|
+
}, []);
|
|
16
|
+
return (React.createElement(ModuleManager_1.ModuleManager, { availableItems: availableToolbars, disabled: disabled, onTabsChange: handleTabsChange, tabs: preparedTabs, tabsTitle: moduleInfo.FriendlyName + ' Tabs', unusedPanelTitle: 'Available Toolbars' }));
|
|
170
17
|
};
|
|
171
18
|
exports.default = DashboardManager;
|
|
@@ -15,4 +15,4 @@ export declare type DatepickerProps = Omit<BoxProps, 'value' | 'onChange' | 'def
|
|
|
15
15
|
showWeekNumber?: boolean;
|
|
16
16
|
showOutsideDays?: boolean;
|
|
17
17
|
};
|
|
18
|
-
export declare const Datepicker: React.ForwardRefExoticComponent<Pick<DatepickerProps, "max" | "required" | "default" | "high" | "low" | "disabled" | "start" | "open" | "media" | "hidden" | "cite" | "data" | "dir" | "form" | "label" | "p" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "async" | "defer" | "manifest" | "m" | "color" | "content" | "size" | "flex" | "wrap" | "padding" | "multiple" | "alignSelf" | "backgroundColor" | "fontSize" | "height" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "opacity" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "translate" | "width" | "margin" | "children" | "key" | "list" | "step" | "contextMenu" | "type" | "min" | "rows" | "
|
|
18
|
+
export declare const Datepicker: React.ForwardRefExoticComponent<Pick<DatepickerProps, "max" | "required" | "default" | "high" | "low" | "disabled" | "start" | "open" | "media" | "hidden" | "cite" | "data" | "dir" | "form" | "label" | "p" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "async" | "defer" | "manifest" | "m" | "color" | "content" | "size" | "flex" | "wrap" | "padding" | "multiple" | "alignSelf" | "backgroundColor" | "fontSize" | "height" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "opacity" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "translate" | "width" | "margin" | "children" | "key" | "list" | "step" | "contextMenu" | "type" | "min" | "rows" | "name" | "value" | "className" | "id" | "lang" | "method" | "target" | "role" | "tabIndex" | "crossOrigin" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "classID" | "useMap" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "draggable" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "as" | "hrefLang" | "integrity" | "rel" | "sizes" | "charSet" | "kind" | "src" | "srcLang" | "download" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dateTime" | "acceptCharset" | "action" | "autoComplete" | "encType" | "noValidate" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "srcSet" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "readOnly" | "htmlFor" | "httpEquiv" | "optimum" | "reversed" | "selected" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "poster" | "challenge" | "keyType" | "keyParams" | "mt" | "mb" | "ml" | "mr" | "my" | "marginY" | "mx" | "marginX" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "css" | "bg" | "showClearButton" | "showOutsideDays" | "showWeekNumber" | "onHide" | "datepickerButtons" | "dateProps"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ModuleManagerProps } from './ModuleManager';
|
|
3
|
+
import { ModuleDraggableItem } from './types';
|
|
4
|
+
export declare const DragAndDropContext: React.Context<{
|
|
5
|
+
availableItems: ModuleDraggableItem[];
|
|
6
|
+
permittedActions: ModuleManagerProps['permittedActions'];
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DragAndDropContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
exports.DragAndDropContext = React.createContext({
|
|
7
|
+
availableItems: [],
|
|
8
|
+
permittedActions: {
|
|
9
|
+
createTab: true,
|
|
10
|
+
editTabName: true,
|
|
11
|
+
dragAndDropTab: true,
|
|
12
|
+
deleteTab: true,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BaseModuleTab, ModuleDraggableItem } from './types';
|
|
3
|
+
export interface ModuleManagerProps {
|
|
4
|
+
availableItems: ModuleDraggableItem[];
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
onTabsChange: (tabs: BaseModuleTab[]) => void;
|
|
7
|
+
tabs: BaseModuleTab[];
|
|
8
|
+
unusedPanelTitle: string;
|
|
9
|
+
tabsTitle?: string;
|
|
10
|
+
permittedActions?: {
|
|
11
|
+
createTab?: boolean;
|
|
12
|
+
editTabName?: boolean;
|
|
13
|
+
dragAndDropTab?: boolean;
|
|
14
|
+
deleteTab?: boolean;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare const ModuleManager: React.FunctionComponent<ModuleManagerProps>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModuleManager = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_beautiful_dnd_1 = require("react-beautiful-dnd");
|
|
7
|
+
const PanelWithButton_1 = require("../../View/Components/Panels/PanelWithButton");
|
|
8
|
+
const SimpleButton_1 = tslib_1.__importDefault(require("../SimpleButton"));
|
|
9
|
+
const DragAndDropContext_1 = require("./DragAndDropContext");
|
|
10
|
+
const TabList_1 = require("./TabList");
|
|
11
|
+
const UnusedPanel_1 = require("./UnusedPanel");
|
|
12
|
+
exports.ModuleManager = (props) => {
|
|
13
|
+
const { availableItems, tabs, onTabsChange, tabsTitle, disabled, unusedPanelTitle, permittedActions, } = props;
|
|
14
|
+
const contextValue = React.useMemo(() => {
|
|
15
|
+
const preparedPermittedAction = Object.assign({ createTab: true, editTabName: true, dragAndDropTab: true, deleteTab: true }, permittedActions);
|
|
16
|
+
return {
|
|
17
|
+
permittedActions: preparedPermittedAction,
|
|
18
|
+
availableItems: props.availableItems,
|
|
19
|
+
};
|
|
20
|
+
}, [props.availableItems, props.permittedActions]);
|
|
21
|
+
const unusedToolbars = React.useMemo(() => availableItems
|
|
22
|
+
.map((t) => t.Id)
|
|
23
|
+
.filter((item) => {
|
|
24
|
+
return !tabs.some((tab) => tab.Items.includes(item));
|
|
25
|
+
}), [tabs, availableItems]);
|
|
26
|
+
const handleToolbarDragEnd = (result) => {
|
|
27
|
+
const { source, destination, draggableId } = result;
|
|
28
|
+
if (!source || !destination) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (source.droppableId !== 'UNUSED') {
|
|
32
|
+
const sourceTabToolbars = tabs[Number(source.droppableId)].Items;
|
|
33
|
+
sourceTabToolbars.splice(source.index, 1);
|
|
34
|
+
}
|
|
35
|
+
if (destination.droppableId !== 'UNUSED') {
|
|
36
|
+
const destinationTabToolbars = tabs[Number(destination.droppableId)].Items;
|
|
37
|
+
destinationTabToolbars.splice(destination.index, 0, draggableId);
|
|
38
|
+
}
|
|
39
|
+
onTabsChange([...tabs]);
|
|
40
|
+
};
|
|
41
|
+
const handleTabDragEnd = (result) => {
|
|
42
|
+
const { source, destination } = result;
|
|
43
|
+
if (!source || !destination)
|
|
44
|
+
return;
|
|
45
|
+
const [removed] = tabs.splice(source.index, 1);
|
|
46
|
+
tabs.splice(destination.index, 0, removed);
|
|
47
|
+
onTabsChange([...tabs]);
|
|
48
|
+
};
|
|
49
|
+
const handleRemoveTab = (tabIndex) => {
|
|
50
|
+
onTabsChange(tabs.filter((_, index) => index !== tabIndex));
|
|
51
|
+
};
|
|
52
|
+
const handleTabAdd = () => {
|
|
53
|
+
onTabsChange([...tabs, { Name: 'New Tab', Items: [] }]);
|
|
54
|
+
};
|
|
55
|
+
const handleRemoveToolbar = (tabIndex, toolbarIndex) => {
|
|
56
|
+
onTabsChange(tabs.map((tab, index) => {
|
|
57
|
+
if (index !== tabIndex)
|
|
58
|
+
return tab;
|
|
59
|
+
return Object.assign(Object.assign({}, tab), { Items: tab.Items.filter((_, index) => index !== toolbarIndex) });
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
const handleChangeTabName = (tabIndex, tabName) => {
|
|
63
|
+
onTabsChange(tabs.map((tab, index) => {
|
|
64
|
+
if (index !== tabIndex)
|
|
65
|
+
return tab;
|
|
66
|
+
return Object.assign(Object.assign({}, tab), { Name: tabName });
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
return (React.createElement(react_beautiful_dnd_1.DragDropContext, { onDragEnd: (result) => {
|
|
70
|
+
if (result.type === 'TAB')
|
|
71
|
+
handleTabDragEnd(result);
|
|
72
|
+
if (result.type === 'TOOLBAR')
|
|
73
|
+
handleToolbarDragEnd(result);
|
|
74
|
+
} },
|
|
75
|
+
React.createElement(DragAndDropContext_1.DragAndDropContext.Provider, { value: contextValue },
|
|
76
|
+
React.createElement("div", { style: { display: 'flex', flexDirection: 'column' } },
|
|
77
|
+
React.createElement(UnusedPanel_1.UnusedPanel, { title: unusedPanelTitle, disabled: disabled, toolbars: unusedToolbars }),
|
|
78
|
+
React.createElement(PanelWithButton_1.PanelWithButton, { headerText: tabsTitle, button: contextValue.permittedActions.createTab && (React.createElement(SimpleButton_1.default, { disabled: disabled, onClick: handleTabAdd }, "Add Tab")) },
|
|
79
|
+
React.createElement("div", { style: { display: 'flex', flex: 1 } },
|
|
80
|
+
React.createElement(TabList_1.TabList, { disabled: disabled, tabs: tabs, onRemoveTab: handleRemoveTab, onRemoveToolbar: handleRemoveToolbar, onChangeTabName: handleChangeTabName })))))));
|
|
81
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseModuleTab } from './types';
|
|
3
|
+
export declare function TabList({ tabs, onRemoveTab, onRemoveToolbar, onChangeTabName, disabled, }: {
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
tabs: BaseModuleTab[];
|
|
6
|
+
onRemoveTab: (tabIndex: number) => void;
|
|
7
|
+
onRemoveToolbar: (tabIndex: number, toolbarIndex: number) => void;
|
|
8
|
+
onChangeTabName: (tabIndex: number, tabName: string) => void;
|
|
9
|
+
}): JSX.Element;
|
|
10
|
+
export declare function TabItem({ tab, tabIndex, onRemove, onRemoveToolbar, onChangeTabName, disabled, }: {
|
|
11
|
+
tab: BaseModuleTab;
|
|
12
|
+
tabIndex: number;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
onRemove: () => void;
|
|
15
|
+
onRemoveToolbar: (toolbarIndex: number) => void;
|
|
16
|
+
onChangeTabName: (tabName: string) => void;
|
|
17
|
+
}): JSX.Element;
|
|
18
|
+
export declare function ToolbarList({ toolbars, droppableId, onRemove, disabled, }: {
|
|
19
|
+
toolbars: string[];
|
|
20
|
+
droppableId: string;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
onRemove: (toolbarIndex: number) => void;
|
|
23
|
+
}): JSX.Element;
|
|
24
|
+
export declare function ToolbarItem({ toolbar, toolbarIndex, onRemove, disabled, }: {
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
toolbar: string;
|
|
27
|
+
toolbarIndex: number;
|
|
28
|
+
onRemove: () => void;
|
|
29
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToolbarItem = exports.ToolbarList = exports.TabItem = exports.TabList = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_beautiful_dnd_1 = require("react-beautiful-dnd");
|
|
7
|
+
const icons_1 = require("../icons");
|
|
8
|
+
const SimpleButton_1 = tslib_1.__importDefault(require("../SimpleButton"));
|
|
9
|
+
const DragAndDropContext_1 = require("./DragAndDropContext");
|
|
10
|
+
function TabList({ tabs, onRemoveTab, onRemoveToolbar, onChangeTabName, disabled, }) {
|
|
11
|
+
return (React.createElement(react_beautiful_dnd_1.Droppable, { droppableId: "MAIN", type: "TAB", direction: "horizontal" }, (provided) => (React.createElement("div", Object.assign({ ref: provided.innerRef }, provided.droppableProps, { style: { display: 'flex' }, "data-name": "dashboard-tabs" }),
|
|
12
|
+
tabs.map((tab, tabIndex) => (React.createElement(TabItem, { disabled: disabled, key: tabIndex, tabIndex: tabIndex, tab: tab, onRemove: () => onRemoveTab(tabIndex), onRemoveToolbar: (toolbarIndex) => onRemoveToolbar(tabIndex, toolbarIndex), onChangeTabName: (tabName) => onChangeTabName(tabIndex, tabName) }))),
|
|
13
|
+
provided.placeholder))));
|
|
14
|
+
}
|
|
15
|
+
exports.TabList = TabList;
|
|
16
|
+
function TabItem({ tab, tabIndex, onRemove, onRemoveToolbar, onChangeTabName, disabled, }) {
|
|
17
|
+
const context = React.useContext(DragAndDropContext_1.DragAndDropContext);
|
|
18
|
+
const isDragDisabled = disabled || !context.permittedActions.dragAndDropTab;
|
|
19
|
+
return (React.createElement(react_beautiful_dnd_1.Draggable, { isDragDisabled: isDragDisabled, draggableId: String(tabIndex), index: tabIndex }, (provided) => (React.createElement("div", Object.assign({ "data-name": "dashboard-tab", ref: provided.innerRef }, provided.draggableProps, { style: Object.assign(Object.assign({}, (isDragDisabled ? {} : provided.draggableProps.style)), { boxSizing: 'border-box', border: '1px solid var(--ab-color-primarydark)', borderRadius: 'var(--ab__border-radius)', marginRight: 'var(--ab-space-2)', width: 160, display: 'flex', flexDirection: 'column' }) }),
|
|
20
|
+
React.createElement("div", { style: {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
padding: 'var(--ab-space-1)',
|
|
24
|
+
borderBottom: '1px solid var(--ab-color-primarydark)',
|
|
25
|
+
} },
|
|
26
|
+
React.createElement("div", Object.assign({}, (disabled ? {} : provided.dragHandleProps), { style: context.permittedActions.dragAndDropTab
|
|
27
|
+
? {}
|
|
28
|
+
: {
|
|
29
|
+
display: 'none',
|
|
30
|
+
} }),
|
|
31
|
+
React.createElement(icons_1.Icon, { name: "drag" })),
|
|
32
|
+
context.permittedActions.editTabName ? (React.createElement("input", { type: "text", disabled: disabled, value: tab.Name, style: {
|
|
33
|
+
flex: 1,
|
|
34
|
+
width: '100%',
|
|
35
|
+
border: 'none',
|
|
36
|
+
marginLeft: 'var(--ab-space-1)',
|
|
37
|
+
marginRight: 'var(--ab-space-1)',
|
|
38
|
+
alignSelf: 'stretch',
|
|
39
|
+
background: 'transparent',
|
|
40
|
+
color: 'var(--ab-color-text-on-primary)',
|
|
41
|
+
}, onChange: (event) => {
|
|
42
|
+
onChangeTabName(event.target.value);
|
|
43
|
+
} })) : (tab.Name),
|
|
44
|
+
context.permittedActions.deleteTab && (React.createElement(SimpleButton_1.default, { disabled: disabled, icon: "delete", variant: "text", onClick: onRemove }))),
|
|
45
|
+
React.createElement(ToolbarList, { disabled: disabled, toolbars: tab.Items, droppableId: String(tabIndex), onRemove: onRemoveToolbar })))));
|
|
46
|
+
}
|
|
47
|
+
exports.TabItem = TabItem;
|
|
48
|
+
function ToolbarList({ toolbars, droppableId, onRemove, disabled, }) {
|
|
49
|
+
return (React.createElement(react_beautiful_dnd_1.Droppable, { droppableId: droppableId, type: "TOOLBAR" }, (provided, snapshot) => (React.createElement("div", Object.assign({ ref: provided.innerRef }, (disabled ? {} : provided.droppableProps), { "data-name": "dashboard-toolbar-drop-target", style: {
|
|
50
|
+
flex: 1,
|
|
51
|
+
padding: 4,
|
|
52
|
+
paddingBottom: 0,
|
|
53
|
+
background: snapshot.isDraggingOver
|
|
54
|
+
? 'var(--ab-dashboard-tab-drop-target__background)'
|
|
55
|
+
: '',
|
|
56
|
+
minHeight: 200,
|
|
57
|
+
} }),
|
|
58
|
+
toolbars.map((toolbar, toolbarIndex) => (React.createElement(ToolbarItem, { disabled: disabled, key: toolbar, toolbar: toolbar, toolbarIndex: toolbarIndex, onRemove: () => onRemove(toolbarIndex) }))),
|
|
59
|
+
provided.placeholder))));
|
|
60
|
+
}
|
|
61
|
+
exports.ToolbarList = ToolbarList;
|
|
62
|
+
function ToolbarItem({ toolbar, toolbarIndex, onRemove, disabled, }) {
|
|
63
|
+
const { availableItems } = React.useContext(DragAndDropContext_1.DragAndDropContext);
|
|
64
|
+
let currentItem = availableItems.find((t) => t.Id === toolbar);
|
|
65
|
+
const title = currentItem ? currentItem.Title : toolbar;
|
|
66
|
+
return (React.createElement(react_beautiful_dnd_1.Draggable, { isDragDisabled: disabled, draggableId: toolbar, index: toolbarIndex }, (provided, snapshot) => (React.createElement("div", Object.assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { style: Object.assign(Object.assign({}, provided.draggableProps.style), { display: 'flex', alignItems: 'center', border: '1px solid var(--ab-color-primary)', backgroundColor: snapshot.isDragging
|
|
67
|
+
? 'var(--ab-dashboard-toolbar-drag__background)'
|
|
68
|
+
: 'var(--ab-color-primarylight)', paddingLeft: 'var(--ab-space-1)', marginBottom: 'var(--ab-space-1)' }) }),
|
|
69
|
+
React.createElement("div", { style: { flex: 1 } }, title),
|
|
70
|
+
React.createElement(SimpleButton_1.default, { disabled: disabled, icon: "clear", variant: "text", padding: 1, onClick: onRemove })))));
|
|
71
|
+
}
|
|
72
|
+
exports.ToolbarItem = ToolbarItem;
|