@adaptabletools/adaptable 11.1.6 → 11.1.9

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.
Files changed (184) hide show
  1. package/base.css +16 -0
  2. package/bundle.cjs.js +106 -106
  3. package/index.css +20 -0
  4. package/package.json +1 -1
  5. package/publishTimestamp.d.ts +1 -1
  6. package/publishTimestamp.js +1 -1
  7. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
  8. package/src/AdaptableOptions/AdaptableOptions.d.ts +1 -1
  9. package/src/AdaptableOptions/AlertOptions.d.ts +9 -2
  10. package/src/AdaptableOptions/FinancePluginOptions.d.ts +58 -17
  11. package/src/AdaptableOptions/GeneralOptions.d.ts +7 -0
  12. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +7 -0
  13. package/src/Api/AdaptableApi.d.ts +5 -0
  14. package/src/Api/CellSummaryApi.d.ts +8 -0
  15. package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
  16. package/src/Api/Implementation/AdaptableApiImpl.js +2 -0
  17. package/src/Api/Implementation/AlertApiImpl.js +32 -15
  18. package/src/Api/Implementation/CellSummaryApiImpl.d.ts +2 -0
  19. package/src/Api/Implementation/CellSummaryApiImpl.js +34 -0
  20. package/src/Api/Implementation/ConfigApiImpl.js +3 -0
  21. package/src/Api/Implementation/GridApiImpl.js +0 -4
  22. package/src/Api/Implementation/InternalApiImpl.d.ts +2 -1
  23. package/src/Api/Implementation/InternalApiImpl.js +29 -7
  24. package/src/Api/Implementation/QueryApiImpl.d.ts +1 -0
  25. package/src/Api/Implementation/QueryApiImpl.js +12 -0
  26. package/src/Api/Implementation/StatusBarApiImpl.d.ts +8 -0
  27. package/src/Api/Implementation/StatusBarApiImpl.js +17 -0
  28. package/src/Api/InternalApi.d.ts +2 -1
  29. package/src/Api/QueryApi.d.ts +6 -0
  30. package/src/Api/StatusBarApi.d.ts +10 -0
  31. package/src/Api/StatusBarApi.js +2 -0
  32. package/src/PredefinedConfig/AdaptableState.d.ts +2 -0
  33. package/src/PredefinedConfig/Common/FDC3Context.d.ts +61 -29
  34. package/src/PredefinedConfig/Common/Types.d.ts +4 -2
  35. package/src/PredefinedConfig/Common/Types.js +32 -1
  36. package/src/PredefinedConfig/FormatColumnState.d.ts +1 -1
  37. package/src/PredefinedConfig/GridState.d.ts +1 -1
  38. package/src/PredefinedConfig/PredefinedConfig.d.ts +5 -0
  39. package/src/PredefinedConfig/StatusBarState.d.ts +27 -0
  40. package/src/PredefinedConfig/StatusBarState.js +7 -0
  41. package/src/PredefinedConfig/ToolPanelState.d.ts +1 -1
  42. package/src/Redux/ActionsReducers/GridRedux.d.ts +2 -2
  43. package/src/Redux/ActionsReducers/GridRedux.js +4 -4
  44. package/src/Redux/ActionsReducers/StatusBarRedux.d.ts +22 -0
  45. package/src/Redux/ActionsReducers/StatusBarRedux.js +31 -0
  46. package/src/Redux/ActionsReducers/SystemRedux.d.ts +8 -3
  47. package/src/Redux/ActionsReducers/SystemRedux.js +22 -5
  48. package/src/Redux/Store/AdaptableReduxMerger.js +2 -2
  49. package/src/Redux/Store/AdaptableStore.js +24 -10
  50. package/src/Strategy/AlertModule.d.ts +3 -0
  51. package/src/Strategy/AlertModule.js +6 -0
  52. package/src/Strategy/CellSummaryModule.d.ts +6 -0
  53. package/src/Strategy/CellSummaryModule.js +14 -0
  54. package/src/Strategy/DataChangeHistoryModule.d.ts +7 -0
  55. package/src/Strategy/DataChangeHistoryModule.js +11 -0
  56. package/src/Strategy/ExportModule.d.ts +1 -0
  57. package/src/Strategy/ExportModule.js +1 -0
  58. package/src/Strategy/FilterModule.d.ts +6 -0
  59. package/src/Strategy/FilterModule.js +21 -0
  60. package/src/Strategy/Interface/IModule.d.ts +21 -10
  61. package/src/Strategy/LayoutModule.d.ts +7 -0
  62. package/src/Strategy/LayoutModule.js +13 -0
  63. package/src/Strategy/QueryModule.d.ts +8 -0
  64. package/src/Strategy/QueryModule.js +18 -0
  65. package/src/Strategy/QuickSearchModule.d.ts +6 -0
  66. package/src/Strategy/QuickSearchModule.js +10 -0
  67. package/src/Strategy/StatusBarModule.d.ts +8 -0
  68. package/src/Strategy/StatusBarModule.js +39 -0
  69. package/src/Strategy/SystemStatusModule.d.ts +6 -0
  70. package/src/Strategy/SystemStatusModule.js +10 -0
  71. package/src/Strategy/ThemeModule.d.ts +7 -0
  72. package/src/Strategy/ThemeModule.js +12 -0
  73. package/src/Strategy/Utilities/getAlertBehaviourViewItems.js +1 -1
  74. package/src/Utilities/Constants/ModuleConstants.d.ts +1 -0
  75. package/src/Utilities/Constants/ModuleConstants.js +2 -1
  76. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +4 -1
  77. package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -0
  78. package/src/Utilities/Services/ModuleService.js +6 -6
  79. package/src/View/AdaptablePopover/index.d.ts +1 -0
  80. package/src/View/AdaptablePopover/index.js +5 -2
  81. package/src/View/AdaptableViewFactory.js +2 -2
  82. package/src/View/Alert/AlertStatusSubPanel.d.ts +2 -0
  83. package/src/View/Alert/AlertStatusSubPanel.js +56 -0
  84. package/src/View/Alert/AlertViewPanel.js +6 -7
  85. package/src/View/Alert/AlertsPanel.d.ts +1 -1
  86. package/src/View/Alert/AlertsPanel.js +2 -1
  87. package/src/View/Alert/Utilities/getAlertButtonStyle.d.ts +5 -0
  88. package/src/View/Alert/Utilities/getAlertButtonStyle.js +15 -0
  89. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +18 -7
  90. package/src/View/Alert/Wizard/AlertButtonsEditor.js +1 -8
  91. package/src/View/Alert/Wizard/AlertWizard.js +3 -2
  92. package/src/View/CellSummary/CellSummaryStatusBarSubPanelPopover.d.ts +2 -0
  93. package/src/View/CellSummary/CellSummaryStatusBarSubPanelPopover.js +15 -0
  94. package/src/View/CellSummary/CellSummaryStatusPanel.d.ts +2 -0
  95. package/src/View/CellSummary/CellSummaryStatusPanel.js +36 -0
  96. package/src/View/CellSummary/CellSummaryViewPanel.js +2 -20
  97. package/src/View/ColorPicker.d.ts +1 -1
  98. package/src/View/Components/AdaptableDateInput/index.d.ts +1 -1
  99. package/src/View/Components/AdaptableInput/index.d.ts +1 -1
  100. package/src/View/Components/Buttons/ButtonDelete.d.ts +1 -1
  101. package/src/View/Components/Forms/AdaptableFormControlTextClear.d.ts +1 -1
  102. package/src/View/Components/Forms/AdaptableFormControlTextClear.js +1 -1
  103. package/src/View/Components/Panels/PanelWithImage.d.ts +2 -2
  104. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -5
  105. package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +1 -1
  106. package/src/View/Components/RangesComponent.js +6 -2
  107. package/src/View/Components/StyleComponent.js +18 -6
  108. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +1 -1
  109. package/src/View/Components/ToolPanel/ToolPanelPopup.js +3 -3
  110. package/src/View/Dashboard/DashboardPopup.js +2 -2
  111. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +5 -13
  112. package/src/View/DataChangeHistory/DataChangeHistoryStatusBarContent.d.ts +2 -0
  113. package/src/View/DataChangeHistory/DataChangeHistoryStatusBarContent.js +9 -0
  114. package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.d.ts +4 -16
  115. package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.js +32 -40
  116. package/src/View/Filter/ActiveFiltersPanel.d.ts +0 -2
  117. package/src/View/Filter/FilterStatusBarSubPanelPopover.d.ts +2 -0
  118. package/src/View/Filter/FilterStatusBarSubPanelPopover.js +18 -0
  119. package/src/View/Filter/FilterViewPanel.js +1 -1
  120. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +1 -1
  121. package/src/View/GridInfo/GridInfoPopup.js +4 -1
  122. package/src/View/Layout/EditCurrentLayoutButton.d.ts +2 -0
  123. package/src/View/Layout/EditCurrentLayoutButton.js +14 -0
  124. package/src/View/Layout/LayoutPopup.d.ts +1 -1
  125. package/src/View/Layout/LayoutPopup.js +3 -3
  126. package/src/View/Layout/LayoutRadioSelector.d.ts +1 -0
  127. package/src/View/Layout/LayoutRadioSelector.js +2 -2
  128. package/src/View/Layout/LayoutStatusBarSubPanelPopover.d.ts +2 -0
  129. package/src/View/Layout/LayoutStatusBarSubPanelPopover.js +29 -0
  130. package/src/View/Layout/Wizard/LayoutEditor/ColumnLabels.js +2 -1
  131. package/src/View/Layout/Wizard/LayoutEditorWizard.js +2 -1
  132. package/src/View/Query/EditCurrentQueryButton.d.ts +2 -0
  133. package/src/View/Query/EditCurrentQueryButton.js +15 -0
  134. package/src/View/Query/QueryViewPanel.d.ts +0 -1
  135. package/src/View/Query/QueryViewPanel.js +2 -11
  136. package/src/View/QuickSearch/QuickSearchPopup.js +1 -1
  137. package/src/View/QuickSearch/QuickSearchStatusBarContent.d.ts +2 -0
  138. package/src/View/QuickSearch/QuickSearchStatusBarContent.js +16 -0
  139. package/src/View/StatusBar/AdaptableStatusBar.d.ts +3 -0
  140. package/src/View/StatusBar/AdaptableStatusBar.js +44 -0
  141. package/src/View/StatusBar/StatusBarPanel.d.ts +42 -0
  142. package/src/View/StatusBar/StatusBarPanel.js +45 -0
  143. package/src/View/StatusBar/StatusBarPopup.d.ts +3 -0
  144. package/src/View/StatusBar/StatusBarPopup.js +43 -0
  145. package/src/View/SystemStatus/SystemStatusStatusBarContent.d.ts +2 -0
  146. package/src/View/SystemStatus/SystemStatusStatusBarContent.js +15 -0
  147. package/src/View/SystemStatus/SystemStatusViewPanel.js +3 -7
  148. package/src/View/SystemStatus/Utilities/getStatusItemStyle.d.ts +5 -0
  149. package/src/View/SystemStatus/Utilities/getStatusItemStyle.js +16 -0
  150. package/src/View/Theme/ThemeStatusPanelPopover.d.ts +2 -0
  151. package/src/View/Theme/ThemeStatusPanelPopover.js +36 -0
  152. package/src/agGrid/Adaptable.d.ts +2 -0
  153. package/src/agGrid/Adaptable.js +27 -0
  154. package/src/agGrid/agGridHelper.js +2 -0
  155. package/src/agGrid/createAgStatusPanelComponent.d.ts +21 -0
  156. package/src/agGrid/createAgStatusPanelComponent.js +31 -0
  157. package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +1 -1
  158. package/src/components/Dashboard/DashboardManager.js +9 -162
  159. package/src/components/Datepicker/index.d.ts +1 -1
  160. package/src/components/DragAndDropContext/DragAndDropContext.d.ts +7 -0
  161. package/src/components/DragAndDropContext/DragAndDropContext.js +14 -0
  162. package/src/components/DragAndDropContext/ModuleManager.d.ts +17 -0
  163. package/src/components/DragAndDropContext/ModuleManager.js +81 -0
  164. package/src/components/DragAndDropContext/TabList.d.ts +29 -0
  165. package/src/components/DragAndDropContext/TabList.js +72 -0
  166. package/src/components/DragAndDropContext/UnusedPanel.d.ts +6 -0
  167. package/src/components/DragAndDropContext/UnusedPanel.js +46 -0
  168. package/src/components/DragAndDropContext/types.d.ts +8 -0
  169. package/src/components/DragAndDropContext/types.js +2 -0
  170. package/src/components/Input/index.d.ts +1 -1
  171. package/src/components/List/ListGroupItem/index.d.ts +1 -1
  172. package/src/components/PopupWithFooter.d.ts +1 -1
  173. package/src/components/SimpleButton/index.js +3 -0
  174. package/src/components/Textarea/index.d.ts +1 -1
  175. package/src/components/icons/DefaultIcon.d.ts +2 -1
  176. package/src/components/icons/DefaultIcon.js +2 -2
  177. package/src/components/icons/index.js +2 -0
  178. package/src/components/icons/statusbar.d.ts +3 -0
  179. package/src/components/icons/statusbar.js +8 -0
  180. package/src/metamodel/adaptable.metamodel.d.ts +231 -0
  181. package/src/metamodel/adaptable.metamodel.js +433 -37
  182. package/src/types.d.ts +4 -3
  183. package/version.d.ts +1 -1
  184. package/version.js +1 -1
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThemeStatusPanelPopover = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const rebass_1 = require("rebass");
7
+ const Radio_1 = tslib_1.__importDefault(require("../../components/Radio"));
8
+ const AdaptableContext_1 = require("../AdaptableContext");
9
+ const AdaptableObjectRow_1 = require("../Components/AdaptableObjectRow");
10
+ const PanelWithRow_1 = require("../Components/Panels/PanelWithRow");
11
+ const colItems = [
12
+ { Content: 'Current', Size: 2 },
13
+ { Content: 'Theme Name', Size: 4 },
14
+ ];
15
+ exports.ThemeStatusPanelPopover = () => {
16
+ const adaptable = AdaptableContext_1.useAdaptable();
17
+ const themes = adaptable.api.themeApi.getAllTheme();
18
+ const currentTheme = adaptable.api.themeApi.getCurrentTheme();
19
+ const handleThemeChange = React.useCallback((theme) => {
20
+ adaptable.api.themeApi.loadTheme(theme.Name);
21
+ }, []);
22
+ return (React.createElement(rebass_1.Flex, { flexDirection: "column" },
23
+ React.createElement(PanelWithRow_1.PanelWithRow, { colItems: colItems }),
24
+ themes.map((theme) => {
25
+ return (React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { key: theme.Name, colItems: [
26
+ {
27
+ Content: (React.createElement(Radio_1.default, { onClick: () => handleThemeChange(theme), id: theme.Name, checked: currentTheme === theme.Name })),
28
+ Size: 1,
29
+ },
30
+ {
31
+ Content: (React.createElement("label", { style: { cursor: 'pointer' }, htmlFor: theme.Name }, theme.Name)),
32
+ Size: 4,
33
+ },
34
+ ] }));
35
+ })));
36
+ };
@@ -105,6 +105,8 @@ export declare class Adaptable implements IAdaptable {
105
105
  private initializeAgGrid;
106
106
  private isAgGridReady;
107
107
  private initAgGridContainerFromInitializedAgGrid;
108
+ private createStatusBars;
109
+ getAgGridStatusPanels(): import("@ag-grid-community/all-modules").StatusPanelDef[];
108
110
  debouncedSetColumnIntoStore: import("lodash").DebouncedFunc<() => void>;
109
111
  debouncedSaveGridLayout: import("lodash").DebouncedFunc<() => void>;
110
112
  debouncedSetSelectedCells: import("lodash").DebouncedFunc<() => void>;
@@ -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) {
@@ -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
  }
@@ -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 react_beautiful_dnd_1 = require("react-beautiful-dnd");
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 contextValue = react_1.useMemo(() => ({
108
- availableToolbars,
109
- }), [availableToolbars]);
110
- const unusedToolbars = react_1.useMemo(() => availableToolbars
111
- .map((t) => t.Id)
112
- .filter((toolbar) => {
113
- return !tabs.some((tab) => tab.Toolbars.includes(toolbar));
114
- }), [tabs, availableToolbars]);
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" | "download" | "value" | "checked" | "onClick" | "name" | "colSpan" | "rowSpan" | "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" | "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" | "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" | "maxLength" | "minLength" | "readOnly" | "htmlFor" | "httpEquiv" | "optimum" | "reversed" | "selected" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "headers" | "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>>;
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" | "download" | "value" | "checked" | "onClick" | "name" | "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" | "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" | "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" | "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;