@adaptabletools/adaptable 16.0.9 → 16.1.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agGrid.d.ts +4 -0
- package/agGrid.js +4 -0
- package/base.css +16 -14
- package/base.css.map +1 -1
- package/bundle.cjs.js +171 -170
- package/index.css +18 -14
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/AdaptableFrameworkComponent.d.ts +12 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +7 -2
- package/src/AdaptableOptions/ChartingOptions.d.ts +48 -3
- package/src/AdaptableOptions/ColumnOptions.d.ts +17 -0
- package/src/AdaptableOptions/DataImportOptions.d.ts +57 -0
- package/src/AdaptableOptions/MenuOptions.d.ts +147 -8
- package/src/AdaptableOptions/MenuOptions.js +75 -0
- package/src/AdaptableOptions/NotesOptions.d.ts +23 -0
- package/src/AdaptableOptions/QuickSearchOptions.d.ts +8 -0
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +2 -0
- package/src/Api/AdaptableApi.d.ts +8 -3
- package/src/Api/ChartingApi.d.ts +30 -0
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/ConfigApi.d.ts +4 -3
- package/src/Api/DataImportApi.d.ts +9 -0
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +4 -2
- package/src/Api/Implementation/AdaptableApiImpl.js +4 -2
- package/src/Api/Implementation/ApiBase.d.ts +2 -2
- package/src/Api/Implementation/ApiBase.js +2 -2
- package/src/Api/Implementation/ChartingApiImpl.d.ts +8 -2
- package/src/Api/Implementation/ChartingApiImpl.js +64 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +4 -0
- package/src/Api/Implementation/ConfigApiImpl.d.ts +3 -2
- package/src/Api/Implementation/ConfigApiImpl.js +9 -9
- package/src/Api/Implementation/DataImportApiImpl.d.ts +10 -0
- package/src/Api/Implementation/DataImportApiImpl.js +14 -0
- package/src/Api/Implementation/ExpressionApiImpl.js +1 -1
- package/src/Api/Implementation/NotesApiImpl.d.ts +20 -0
- package/src/Api/Implementation/NotesApiImpl.js +58 -0
- package/src/Api/Implementation/OptionsApiImpl.d.ts +3 -2
- package/src/Api/Implementation/OptionsApiImpl.js +5 -2
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +7 -1
- package/src/Api/Implementation/UserInterfaceApiImpl.js +30 -0
- package/src/Api/Internal/AdaptableInternalApi.d.ts +0 -2
- package/src/Api/Internal/AdaptableInternalApi.js +0 -6
- package/src/Api/Internal/CalculatedColumnInternalApi.d.ts +2 -0
- package/src/Api/Internal/CalculatedColumnInternalApi.js +12 -0
- package/src/Api/Internal/ChartingInternalApi.d.ts +7 -0
- package/src/Api/Internal/ChartingInternalApi.js +45 -0
- package/src/Api/Internal/ColumnInternalApi.d.ts +3 -0
- package/src/Api/Internal/ColumnInternalApi.js +3 -0
- package/src/Api/Internal/DataImportInternalApi.d.ts +4 -0
- package/src/Api/Internal/DataImportInternalApi.js +49 -0
- package/src/Api/NotesAPi.d.ts +50 -0
- package/src/Api/NotesAPi.js +2 -0
- package/src/Api/OptionsApi.d.ts +8 -3
- package/src/Api/UserInterfaceApi.d.ts +22 -0
- package/src/PredefinedConfig/AdaptableState.d.ts +2 -2
- package/src/PredefinedConfig/ChartingState.d.ts +22 -0
- package/src/PredefinedConfig/ChartingState.js +9 -0
- package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +12 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/Menu.d.ts +2 -7
- package/src/PredefinedConfig/Common/Types.d.ts +4 -4
- package/src/PredefinedConfig/Common/Types.js +3 -1
- package/src/PredefinedConfig/NotesState.d.ts +59 -0
- package/src/PredefinedConfig/NotesState.js +2 -0
- package/src/PredefinedConfig/PredefinedConfig.d.ts +2 -2
- package/src/PredefinedConfig/SystemState.d.ts +5 -3
- package/src/Redux/ActionsReducers/ChartingRedux.d.ts +28 -3
- package/src/Redux/ActionsReducers/ChartingRedux.js +52 -5
- package/src/Redux/ActionsReducers/NotesRedux.d.ts +39 -0
- package/src/Redux/ActionsReducers/NotesRedux.js +88 -0
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +10 -10
- package/src/Redux/ActionsReducers/SystemRedux.js +23 -22
- package/src/Redux/Store/AdaptableStore.js +19 -11
- package/src/Strategy/ChartingModule.d.ts +5 -2
- package/src/Strategy/ChartingModule.js +28 -7
- package/src/Strategy/ColumnInfoModule.d.ts +11 -0
- package/src/Strategy/ColumnInfoModule.js +47 -0
- package/src/Strategy/DataImportModule.d.ts +11 -0
- package/src/Strategy/DataImportModule.js +36 -0
- package/src/Strategy/DataSetModule.js +1 -0
- package/src/Strategy/Fdc3Module.js +3 -2
- package/src/Strategy/FilterModule.js +5 -0
- package/src/Strategy/GridInfoModule.js +13 -82
- package/src/Strategy/Interface/IModule.d.ts +2 -0
- package/src/Strategy/LayoutModule.js +1 -0
- package/src/Strategy/{CommentsModule.d.ts → NotesModule.d.ts} +6 -6
- package/src/Strategy/{CommentsModule.js → NotesModule.js} +41 -41
- package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.d.ts +2 -0
- package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +20 -18
- package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
- package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
- package/src/Utilities/Constants/ModuleConstants.d.ts +9 -3
- package/src/Utilities/Constants/ModuleConstants.js +11 -5
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +5 -1
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +3 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -2
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +36 -10
- package/src/Utilities/Extensions/ObjectExtensions.d.ts +1 -0
- package/src/Utilities/Extensions/ObjectExtensions.js +5 -1
- package/src/Utilities/Helpers/AdaptableHelper.js +2 -0
- package/src/Utilities/Interface/MessagePopups.d.ts +2 -2
- package/src/Utilities/ObjectFactory.d.ts +2 -1
- package/src/Utilities/ObjectFactory.js +10 -2
- package/src/Utilities/Services/Interface/IEntitlementService.d.ts +4 -0
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +1 -1
- package/src/Utilities/Services/ModuleService.js +2 -0
- package/src/Utilities/Services/QueryLanguageService.d.ts +1 -2
- package/src/Utilities/Services/QueryLanguageService.js +1 -6
- package/src/Utilities/Services/ValidationService.js +15 -5
- package/src/View/AdaptableView.js +2 -2
- package/src/View/AdaptableViewFactory.js +7 -3
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +20 -4
- package/src/View/Alert/Wizard/AlertWizard.js +14 -7
- package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.d.ts +2 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +25 -46
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.d.ts +8 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +19 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.d.ts +2 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +44 -3
- package/src/View/CalculatedColumn/utils.d.ts +2 -0
- package/src/View/CalculatedColumn/utils.js +14 -0
- package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.d.ts +6 -0
- package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.js +47 -0
- package/src/View/Charting/ChartingWizard/{PreviewChartSection.d.ts → AgChargingWizard/PreviewChartSection.d.ts} +1 -1
- package/src/View/Charting/ChartingWizard/{PreviewChartSection.js → AgChargingWizard/PreviewChartSection.js} +2 -2
- package/src/View/Charting/ChartingWizard/{SettingsSection.d.ts → AgChargingWizard/SettingsSection.d.ts} +1 -1
- package/src/View/Charting/ChartingWizard/{SettingsSection.js → AgChargingWizard/SettingsSection.js} +4 -4
- package/src/View/Charting/ChartingWizard/AgChargingWizard/index.d.ts +1 -0
- package/src/View/Charting/ChartingWizard/AgChargingWizard/index.js +4 -0
- package/src/View/Charting/ChartingWizard/ChartingWizard.d.ts +4 -3
- package/src/View/Charting/ChartingWizard/ChartingWizard.js +12 -39
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.d.ts +6 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.js +59 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.d.ts +9 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +25 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/index.d.ts +1 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/index.js +4 -0
- package/src/View/Charting/ChartingWizard/index.d.ts +1 -0
- package/src/View/Charting/ChartingWizard/index.js +4 -0
- package/src/View/Charting/DeleteChartButton.d.ts +2 -1
- package/src/View/Charting/DeleteChartButton.js +4 -2
- package/src/View/Charting/EditChartButton.d.ts +2 -1
- package/src/View/Charting/ShowChartButton.js +47 -16
- package/src/View/Charting/{useChartState.d.ts → useAgChartState.d.ts} +1 -1
- package/src/View/Charting/{useChartState.js → useAgChartState.js} +7 -7
- package/src/View/Charting/useChartingElements.d.ts +2 -1
- package/src/View/Charting/useChartingElements.js +36 -26
- package/src/View/Charting/useExternalChartState.d.ts +7 -0
- package/src/View/Charting/useExternalChartState.js +56 -0
- package/src/View/ColumnInfo/ColumnInfo.d.ts +5 -0
- package/src/View/ColumnInfo/ColumnInfo.js +185 -0
- package/src/View/ColumnInfo/ColumnInfoPopup.d.ts +3 -0
- package/src/View/ColumnInfo/ColumnInfoPopup.js +15 -0
- package/src/View/Components/AdaptableIconSelector/index.d.ts +1 -1
- package/src/View/Components/ExternalRenderer.d.ts +1 -0
- package/src/View/Components/ExternalRenderer.js +2 -1
- package/src/View/Components/Panels/PanelWithImage.js +3 -3
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +1 -1
- package/src/View/Components/Popups/AdaptablePopup/Navigation.js +4 -1
- package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +3 -0
- package/src/View/Components/Popups/WindowPopups/WindowPopups.d.ts +1 -0
- package/src/View/Components/Popups/WindowPopups/WindowPopups.js +12 -2
- package/src/View/Components/Selectors/ColumnSelector.js +1 -1
- package/src/View/DataImport/DataImportPopup.d.ts +6 -0
- package/src/View/DataImport/DataImportPopup.js +32 -0
- package/src/View/DataImport/DataImportWizard/DataImportWizard.d.ts +8 -0
- package/src/View/DataImport/DataImportWizard/DataImportWizard.js +176 -0
- package/src/View/DataImport/DataImportWizard/index.d.ts +1 -0
- package/src/View/DataImport/DataImportWizard/index.js +4 -0
- package/src/View/DataImport/DataImportWizard/sections/DataPreview.d.ts +10 -0
- package/src/View/DataImport/DataImportWizard/sections/DataPreview.js +154 -0
- package/src/View/DataImport/DataImportWizard/sections/ImportSection.d.ts +9 -0
- package/src/View/DataImport/DataImportWizard/sections/ImportSection.js +24 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadFileSection.d.ts +8 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadFileSection.js +11 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadSection.d.ts +13 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadSection.js +23 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadTextSection.d.ts +8 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadTextSection.js +13 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/index.d.ts +1 -0
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/index.js +4 -0
- package/src/View/DataImport/DataImportWizard/sections/ValidationSection.d.ts +11 -0
- package/src/View/DataImport/DataImportWizard/sections/ValidationSection.js +35 -0
- package/src/View/DataImport/systemFileHandlers.d.ts +3 -0
- package/src/View/DataImport/systemFileHandlers.js +44 -0
- package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +6 -1
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +9 -0
- package/src/View/GridInfo/{AdaptableObjectsSummary.js → GridInfoPopup/AdaptableObjectsSummary.js} +2 -2
- package/src/View/GridInfo/{AdaptableOptionsComponent.d.ts → GridInfoPopup/AdaptableOptionsComponent.d.ts} +1 -1
- package/src/View/GridInfo/{AdaptableOptionsComponent.js → GridInfoPopup/AdaptableOptionsComponent.js} +6 -6
- package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.d.ts +6 -0
- package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +82 -0
- package/src/View/GridInfo/GridInfoPopup/index.d.ts +1 -0
- package/src/View/GridInfo/GridInfoPopup/index.js +4 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
- package/src/View/Notes/NotesListing.d.ts +2 -0
- package/src/View/{Comments/CommentListing.js → Notes/NotesListing.js} +13 -14
- package/src/View/Notes/NotesPopup.d.ts +2 -0
- package/src/View/{Comments/CommentPopup.js → Notes/NotesPopup.js} +21 -21
- package/src/View/Shortcut/Wizard/ShortcutWizard.js +6 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +14 -0
- package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -0
- package/src/View/Wizard/OnePageWizards.d.ts +1 -0
- package/src/View/Wizard/OnePageWizards.js +2 -2
- package/src/agGrid/Adaptable.d.ts +1 -1
- package/src/agGrid/Adaptable.js +28 -16
- package/src/agGrid/agGridHelper.d.ts +3 -3
- package/src/agGrid/agGridHelper.js +58 -30
- package/src/agGrid/agGridMenuHelper.d.ts +20 -9
- package/src/agGrid/agGridMenuHelper.js +292 -135
- package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
- package/src/components/ExpressionEditor/EditorInput.js +15 -6
- package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
- package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +5 -5
- package/src/components/ExpressionEditor/editorButtonsQuantileAggregatedScalar.d.ts +2 -0
- package/src/components/ExpressionEditor/editorButtonsQuantileAggregatedScalar.js +25 -0
- package/src/components/ExpressionEditor/index.d.ts +1 -1
- package/src/components/ExpressionEditor/index.js +2 -1
- package/src/components/FileDroppable/index.d.ts +2 -1
- package/src/components/FileDroppable/index.js +8 -7
- package/src/components/icons/import.d.ts +3 -0
- package/src/components/icons/import.js +7 -0
- package/src/components/icons/index.js +4 -0
- package/src/components/icons/note.d.ts +3 -0
- package/src/components/icons/note.js +7 -0
- package/src/metamodel/adaptable.metamodel.d.ts +243 -61
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/index.d.ts +2 -2
- package/src/parser/src/index.js +4 -4
- package/src/parser/src/tokenizer.d.ts +1 -1
- package/src/parser/src/tokenizer.js +14 -6
- package/src/parser/src/types.d.ts +2 -2
- package/src/types.d.ts +9 -8
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/AdaptableOptions/CommentsOptions.d.ts +0 -23
- package/src/Api/CommentsApi.d.ts +0 -50
- package/src/Api/Implementation/CommentsApiImpl.d.ts +0 -20
- package/src/Api/Implementation/CommentsApiImpl.js +0 -58
- package/src/PredefinedConfig/CommentsState.d.ts +0 -59
- package/src/Redux/ActionsReducers/CommentsRedux.d.ts +0 -39
- package/src/Redux/ActionsReducers/CommentsRedux.js +0 -92
- package/src/View/Comments/CommentListing.d.ts +0 -2
- package/src/View/Comments/CommentPopup.d.ts +0 -2
- package/src/View/GridInfo/ColumnInfoComponent.d.ts +0 -20
- package/src/View/GridInfo/ColumnInfoComponent.js +0 -176
- package/src/View/GridInfo/GridInfoPopup.d.ts +0 -16
- package/src/View/GridInfo/GridInfoPopup.js +0 -117
- package/src/View/GridInfo/GridOptionsComponent.d.ts +0 -16
- package/src/View/GridInfo/GridOptionsComponent.js +0 -36
- /package/src/AdaptableOptions/{CommentsOptions.js → DataImportOptions.js} +0 -0
- /package/src/{Api/CommentsApi.js → AdaptableOptions/NotesOptions.js} +0 -0
- /package/src/{PredefinedConfig/CommentsState.js → Api/DataImportApi.js} +0 -0
- /package/src/View/GridInfo/{AdaptableObjectsSummary.d.ts → GridInfoPopup/AdaptableObjectsSummary.d.ts} +0 -0
|
@@ -3,45 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ChartingWizard = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const PreviewChartSection_1 = require("./PreviewChartSection");
|
|
10
|
-
const SettingsSection_1 = require("./SettingsSection");
|
|
11
|
-
const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection");
|
|
6
|
+
const ChartingState_1 = require("../../../PredefinedConfig/ChartingState");
|
|
7
|
+
const AgChargingWizard_1 = require("./AgChargingWizard");
|
|
8
|
+
const ExternalChartingWizard_1 = require("./ExternalChartingWizard");
|
|
12
9
|
const ChartingWizard = (props) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: chartDefinition, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
|
|
23
|
-
{
|
|
24
|
-
title: 'Settings',
|
|
25
|
-
details: 'Chart Settings',
|
|
26
|
-
isValid: SettingsSection_1.isSettingsValid,
|
|
27
|
-
render: () => (React.createElement(rebass_1.Box, { padding: 2 },
|
|
28
|
-
React.createElement(SettingsSection_1.SettingsSection, { chartDefinition: chartDefinition, onChange: setChartDefinition }))),
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
details: 'Select Chart Tags',
|
|
32
|
-
title: 'Tags',
|
|
33
|
-
isVisible: () => adaptable.api.internalApi.shouldDisplayTagSections(),
|
|
34
|
-
render: () => (React.createElement(rebass_1.Box, { padding: 2 },
|
|
35
|
-
React.createElement(ObjectTagsWizardSection_1.ObjectTagsWizardSection, { onChange: setChartDefinition }))),
|
|
36
|
-
renderSummary: ObjectTagsWizardSection_1.renderObjectTagsSummary,
|
|
37
|
-
},
|
|
38
|
-
'-',
|
|
39
|
-
{
|
|
40
|
-
title: 'Preview Chart',
|
|
41
|
-
details: 'Chart Preview',
|
|
42
|
-
render: () => (React.createElement(rebass_1.Box, { p: 2 },
|
|
43
|
-
React.createElement(PreviewChartSection_1.PreviewChartSection, { chartDefinition: chartDefinition, onChange: setChartDefinition }))),
|
|
44
|
-
},
|
|
45
|
-
] }));
|
|
10
|
+
const { data, configEntities } = props, other = tslib_1.__rest(props, ["data", "configEntities"]);
|
|
11
|
+
if ((0, ChartingState_1.isAgChartDefinition)(data)) {
|
|
12
|
+
const chartDef = data;
|
|
13
|
+
return (React.createElement(AgChargingWizard_1.AgChargingWizard, Object.assign({}, other, { data: chartDef })));
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const chartDef = data;
|
|
17
|
+
return (React.createElement(ExternalChartingWizard_1.ExternalChartingWizard, Object.assign({}, other, { data: chartDef })));
|
|
18
|
+
}
|
|
46
19
|
};
|
|
47
20
|
exports.ChartingWizard = ChartingWizard;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ExternalChartDefinition } from '../../../../PredefinedConfig/ChartingState';
|
|
3
|
+
import { AdaptableOnePageWizardProps } from '../../../Wizard/Interface/IAdaptableWizard';
|
|
4
|
+
export interface ExternalChartingWizardProps extends AdaptableOnePageWizardProps<ExternalChartDefinition> {
|
|
5
|
+
}
|
|
6
|
+
export declare const ExternalChartingWizard: React.FunctionComponent<ExternalChartingWizardProps>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExternalChartingWizard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
8
|
+
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
|
|
9
|
+
const SettingsSection_1 = require("./SettingsSection");
|
|
10
|
+
const PreviewChartSection = ({ chartDefinition }) => {
|
|
11
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
12
|
+
const divRef = React.useRef(null);
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
if (!divRef.current) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const container = {
|
|
18
|
+
name: 'Preview Chart',
|
|
19
|
+
element: divRef.current,
|
|
20
|
+
};
|
|
21
|
+
const transientChartDefinition = adaptable.api.chartingApi.internalApi.onPreviewExternalChart(chartDefinition, container);
|
|
22
|
+
return () => {
|
|
23
|
+
adaptable.api.chartingApi.internalApi.onHideExternalChart(transientChartDefinition);
|
|
24
|
+
};
|
|
25
|
+
}, [divRef]);
|
|
26
|
+
return React.createElement("div", { ref: divRef });
|
|
27
|
+
};
|
|
28
|
+
const ExternalChartingWizard = (props) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
31
|
+
const onPreviewChart = (_a = adaptable.api.optionsApi.getChartingOptions().externalChartingOptions) === null || _a === void 0 ? void 0 : _a.onPreviewChart;
|
|
32
|
+
const [chartDefinition, setChartDefinition] = React.useState(() => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
return (_a = props.data) !== null && _a !== void 0 ? _a : (_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.value;
|
|
35
|
+
});
|
|
36
|
+
const handleFinish = () => {
|
|
37
|
+
adaptable.api.chartingApi.editExternalChartDefinition(chartDefinition);
|
|
38
|
+
props.onFinishWizard(props.data);
|
|
39
|
+
};
|
|
40
|
+
return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: chartDefinition, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
|
|
41
|
+
{
|
|
42
|
+
title: 'Settings',
|
|
43
|
+
details: 'Chart Settings',
|
|
44
|
+
isValid: SettingsSection_1.isSettingsValid,
|
|
45
|
+
render: () => (React.createElement(rebass_1.Box, { padding: 2 },
|
|
46
|
+
React.createElement(SettingsSection_1.SettingsSection, { chartDefinition: chartDefinition, onChange: setChartDefinition }))),
|
|
47
|
+
},
|
|
48
|
+
onPreviewChart
|
|
49
|
+
? {
|
|
50
|
+
title: 'Preview Chart',
|
|
51
|
+
render: () => {
|
|
52
|
+
return (React.createElement(rebass_1.Box, { padding: 2 },
|
|
53
|
+
React.createElement(PreviewChartSection, { chartDefinition: chartDefinition })));
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
: null,
|
|
57
|
+
].filter(Boolean) }));
|
|
58
|
+
};
|
|
59
|
+
exports.ExternalChartingWizard = ExternalChartingWizard;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExternalChartDefinition } from '../../../../PredefinedConfig/ChartingState';
|
|
3
|
+
import { AdaptableApi } from '../../../../types';
|
|
4
|
+
export declare const isSettingsValid: (chartDefinition: ExternalChartDefinition, api: AdaptableApi) => true | string;
|
|
5
|
+
export interface SettingsSectionProps {
|
|
6
|
+
chartDefinition: ExternalChartDefinition;
|
|
7
|
+
onChange: (chartDefinition: ExternalChartDefinition) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const SettingsSection: React.FunctionComponent<SettingsSectionProps>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingsSection = exports.isSettingsValid = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const FormLayout_1 = tslib_1.__importStar(require("../../../../components/FormLayout"));
|
|
7
|
+
const AdaptableInput_1 = tslib_1.__importDefault(require("../../../Components/AdaptableInput"));
|
|
8
|
+
const isSettingsValid = (chartDefinition, api) => {
|
|
9
|
+
if (!chartDefinition.Name) {
|
|
10
|
+
return 'Name is mandatory';
|
|
11
|
+
}
|
|
12
|
+
const allChartDefinitions = api.chartingApi.getExternalChartDefinitions();
|
|
13
|
+
if (allChartDefinitions.some((chartDefinitionLoopItem) => chartDefinitionLoopItem.Uuid !== chartDefinition.Uuid &&
|
|
14
|
+
chartDefinitionLoopItem.Name === chartDefinition.Name)) {
|
|
15
|
+
return 'There is already a chart with this name';
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
};
|
|
19
|
+
exports.isSettingsValid = isSettingsValid;
|
|
20
|
+
const SettingsSection = (props) => {
|
|
21
|
+
return (react_1.default.createElement(FormLayout_1.default, null,
|
|
22
|
+
react_1.default.createElement(FormLayout_1.FormRow, { label: "Name" },
|
|
23
|
+
react_1.default.createElement(AdaptableInput_1.default, { value: props.chartDefinition.Name, onChange: (e) => props.onChange(Object.assign(Object.assign({}, props.chartDefinition), { Name: e.target.value })) }))));
|
|
24
|
+
};
|
|
25
|
+
exports.SettingsSection = SettingsSection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ExternalChartingWizard';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChartingWizard';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AccessLevel, ChartDefinition } from '../../types';
|
|
3
|
+
import { ExternalChartDefinition } from '../../PredefinedConfig/ChartingState';
|
|
3
4
|
export interface ButtonDeleteProps {
|
|
4
|
-
chart: ChartDefinition;
|
|
5
|
+
chart: ChartDefinition | ExternalChartDefinition;
|
|
5
6
|
accessLevel: AccessLevel;
|
|
6
7
|
iconSize?: number;
|
|
7
8
|
}
|
|
@@ -5,8 +5,10 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const ButtonDelete_1 = require("../Components/Buttons/ButtonDelete");
|
|
7
7
|
const ChartingRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ChartingRedux"));
|
|
8
|
+
const ChartingState_1 = require("../../PredefinedConfig/ChartingState");
|
|
8
9
|
const DeleteChartButton = (props) => {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
return (React.createElement(ButtonDelete_1.ButtonDelete, { iconSize: props.iconSize, disabled: !props.chart, ConfirmAction: (0, ChartingState_1.isAgChartDefinition)(props.chart)
|
|
11
|
+
? ChartingRedux.ChartingDeleteChart(props.chart)
|
|
12
|
+
: ChartingRedux.ChartingDeleteExternalChart(props.chart), ConfirmationMsg: `Are you sure you want to delete this Charts?`, ConfirmationTitle: 'Delete Charts', accessLevel: props.accessLevel, tooltip: "Delete Chart" }));
|
|
11
13
|
};
|
|
12
14
|
exports.DeleteChartButton = DeleteChartButton;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AccessLevel, ChartDefinition } from '../../types';
|
|
3
|
+
import { ExternalChartDefinition } from '../../PredefinedConfig/ChartingState';
|
|
3
4
|
export interface EditChartButtonProps {
|
|
4
|
-
chart: ChartDefinition;
|
|
5
|
+
chart: ChartDefinition | ExternalChartDefinition;
|
|
5
6
|
accessLevel: AccessLevel;
|
|
6
7
|
isOpen: boolean;
|
|
7
8
|
iconSize?: number;
|
|
@@ -6,35 +6,66 @@ const React = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
|
|
7
7
|
const AdaptableContext_1 = require("../AdaptableContext");
|
|
8
8
|
const DropdownButton_1 = tslib_1.__importDefault(require("../../components/DropdownButton"));
|
|
9
|
-
const useChartState_1 = require("./useChartState");
|
|
10
9
|
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
|
|
11
|
-
const
|
|
12
|
-
|
|
10
|
+
const ChartingState_1 = require("../../PredefinedConfig/ChartingState");
|
|
11
|
+
const useAgChartState_1 = require("./useAgChartState");
|
|
12
|
+
const useExternalChartState_1 = require("./useExternalChartState");
|
|
13
|
+
const BaseShowChartButton = (props) => {
|
|
14
|
+
var _a;
|
|
13
15
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
14
16
|
const chartingOptions = (_a = adaptable.adaptableOptions) === null || _a === void 0 ? void 0 : _a.chartingOptions;
|
|
15
17
|
const chartContainers = chartingOptions === null || chartingOptions === void 0 ? void 0 : chartingOptions.chartContainers;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return (React.createElement(SimpleButton_1.default, { "data-name": "close-chart-button", onClick: closeChart, variant: "text", tone: "error", icon: "visibility-off", tooltip: "Hide Chart" }));
|
|
18
|
+
if (props.chartOpened) {
|
|
19
|
+
return (React.createElement(SimpleButton_1.default, { "data-name": "close-chart-button", onClick: props.onCloseChart, variant: "text", tone: "error", icon: "visibility-off", tooltip: "Hide Chart" }));
|
|
19
20
|
}
|
|
20
21
|
if (!(chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.length)) {
|
|
21
|
-
return (React.createElement(SimpleButton_1.default, { "data-name": "show-chart-button", onClick: () =>
|
|
22
|
+
return (React.createElement(SimpleButton_1.default, { "data-name": "show-chart-button", onClick: () => props.onShowChart(), variant: "text", tone: "success", icon: "visibility-on", tooltip: "Show Chart" }));
|
|
22
23
|
}
|
|
24
|
+
return (React.createElement(DropdownButton_1.default, { "data-name": "show-chart-dropdown", variant: "text", columns: ['label'], items: props.containerOptions },
|
|
25
|
+
React.createElement(SimpleButton_1.default, { variant: "raised", tone: "success" }, "Open")));
|
|
26
|
+
};
|
|
27
|
+
const ShowAgChartButton = (props) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
30
|
+
const chartingOptions = (_a = adaptable.adaptableOptions) === null || _a === void 0 ? void 0 : _a.chartingOptions;
|
|
31
|
+
const chartContainers = chartingOptions === null || chartingOptions === void 0 ? void 0 : chartingOptions.chartContainers;
|
|
32
|
+
const { isOpen, showChart, closeChart } = (0, useAgChartState_1.useAgChartState)(props.chartDefinition);
|
|
23
33
|
const containerOptions = [
|
|
24
|
-
{
|
|
25
|
-
label: (_b = chartingOptions.agGridContainerName) !== null && _b !== void 0 ? _b : GeneralConstants_1.AG_GRID_CHART_WINDOW,
|
|
26
|
-
onClick: () => {
|
|
34
|
+
Object.assign({ label: (_b = chartingOptions.agGridContainerName) !== null && _b !== void 0 ? _b : GeneralConstants_1.AG_GRID_CHART_WINDOW, onClick: () => {
|
|
27
35
|
showChart(null);
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
...(chartContainers
|
|
36
|
+
} }, (chartContainers
|
|
31
37
|
? chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.map((contianerDef) => ({
|
|
32
38
|
label: contianerDef.name,
|
|
33
39
|
onClick: () => showChart(contianerDef),
|
|
34
40
|
}))
|
|
35
|
-
: []),
|
|
41
|
+
: [])),
|
|
36
42
|
];
|
|
37
|
-
return (React.createElement(
|
|
38
|
-
|
|
43
|
+
return (React.createElement(BaseShowChartButton, { chartOpened: isOpen, onShowChart: showChart, onCloseChart: closeChart, containerOptions: containerOptions }));
|
|
44
|
+
};
|
|
45
|
+
const ShowExternalChartButton = (props) => {
|
|
46
|
+
var _a;
|
|
47
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
48
|
+
const chartingOptions = (_a = adaptable.adaptableOptions) === null || _a === void 0 ? void 0 : _a.chartingOptions;
|
|
49
|
+
const chartContainers = chartingOptions === null || chartingOptions === void 0 ? void 0 : chartingOptions.chartContainers;
|
|
50
|
+
/**
|
|
51
|
+
* Need to refresh after the chart is closed/opened
|
|
52
|
+
*/
|
|
53
|
+
const { isOpen, showChart: onShow, hideChart: onHide, } = (0, useExternalChartState_1.useExternalChartState)(props.chartDefinition);
|
|
54
|
+
const containerOptions = chartContainers
|
|
55
|
+
? chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.map((contianerDef) => ({
|
|
56
|
+
label: contianerDef.name,
|
|
57
|
+
onClick: () => onShow(contianerDef),
|
|
58
|
+
}))
|
|
59
|
+
: [];
|
|
60
|
+
return (React.createElement(BaseShowChartButton, { chartOpened: isOpen, onShowChart: onShow, onCloseChart: onHide, containerOptions: containerOptions }));
|
|
61
|
+
};
|
|
62
|
+
const ShowChartButton = (props) => {
|
|
63
|
+
if ((0, ChartingState_1.isAgChartDefinition)(props.data)) {
|
|
64
|
+
return React.createElement(ShowAgChartButton, { chartDefinition: props.data });
|
|
65
|
+
}
|
|
66
|
+
if ((0, ChartingState_1.isExternalChartDefinition)(props.data)) {
|
|
67
|
+
return React.createElement(ShowExternalChartButton, { chartDefinition: props.data });
|
|
68
|
+
}
|
|
69
|
+
return React.createElement(React.Fragment, null);
|
|
39
70
|
};
|
|
40
71
|
exports.ShowChartButton = ShowChartButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartDefinition } from '../../types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const useAgChartState: (chartDefinition?: ChartDefinition) => {
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
showChart: (chartContainer?: {
|
|
5
5
|
element: HTMLElement | string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useAgChartState = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const react_redux_1 = require("react-redux");
|
|
7
7
|
const AdaptableContext_1 = require("../AdaptableContext");
|
|
8
8
|
const SystemRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/SystemRedux"));
|
|
9
|
-
const
|
|
9
|
+
const useAgChartState = (chartDefinition) => {
|
|
10
10
|
const [chartRef, setChartRef] = React.useState(null);
|
|
11
11
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
12
12
|
const currentChartModels = (0, react_redux_1.useSelector)((state) => SystemRedux.SystemChartingCurrentChartModelsSelector(state.System));
|
|
@@ -31,7 +31,7 @@ const useChartState = (chartDefinition) => {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
const
|
|
34
|
+
const showChart = React.useCallback((chartContainer) => {
|
|
35
35
|
if (!adaptable || !chartDefinition) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
@@ -61,15 +61,15 @@ const useChartState = (chartDefinition) => {
|
|
|
61
61
|
adaptable.api.chartingApi.showChartDefinitionOnce(chartDefinition);
|
|
62
62
|
}
|
|
63
63
|
}, [chartDefinition, currentChartModels]);
|
|
64
|
-
const
|
|
64
|
+
const closeChart = React.useCallback(() => {
|
|
65
65
|
if (chartRef) {
|
|
66
66
|
chartRef.destroyChart();
|
|
67
67
|
}
|
|
68
68
|
}, [chartRef]);
|
|
69
69
|
return {
|
|
70
70
|
isOpen: Boolean(chartRef),
|
|
71
|
-
showChart
|
|
72
|
-
closeChart
|
|
71
|
+
showChart,
|
|
72
|
+
closeChart,
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
|
-
exports.
|
|
75
|
+
exports.useAgChartState = useAgChartState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ExternalChartDefinition } from '../../PredefinedConfig/ChartingState';
|
|
2
3
|
import { AccessLevel, ChartDefinition } from '../../types';
|
|
3
4
|
export declare const useChartingElements: ({ elementType, accessLevel, size, }: {
|
|
4
5
|
elementType: string;
|
|
@@ -10,5 +11,5 @@ export declare const useChartingElements: ({ elementType, accessLevel, size, }:
|
|
|
10
11
|
chartButton: JSX.Element;
|
|
11
12
|
deleteButton: JSX.Element;
|
|
12
13
|
editButton: JSX.Element;
|
|
13
|
-
selectedChart: ChartDefinition
|
|
14
|
+
selectedChart: ChartDefinition | ExternalChartDefinition<unknown>;
|
|
14
15
|
};
|
|
@@ -4,30 +4,40 @@ exports.useChartingElements = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const react_redux_1 = require("react-redux");
|
|
7
|
-
const AdaptableContext_1 = require("../AdaptableContext");
|
|
8
7
|
const DropdownButton_1 = tslib_1.__importDefault(require("../../components/DropdownButton"));
|
|
9
8
|
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
|
|
9
|
+
const ChartingState_1 = require("../../PredefinedConfig/ChartingState");
|
|
10
10
|
const ChartingRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ChartingRedux"));
|
|
11
11
|
const AdaptableHelper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/AdaptableHelper"));
|
|
12
|
-
const
|
|
12
|
+
const AdaptableContext_1 = require("../AdaptableContext");
|
|
13
13
|
const DeleteChartButton_1 = require("./DeleteChartButton");
|
|
14
14
|
const EditChartButton_1 = require("./EditChartButton");
|
|
15
|
-
const
|
|
15
|
+
const useAgChartState_1 = require("./useAgChartState");
|
|
16
|
+
const useExternalChartState_1 = require("./useExternalChartState");
|
|
16
17
|
const useChartingElements = ({ elementType, accessLevel, size = 'normal', }) => {
|
|
17
18
|
var _a, _b;
|
|
18
19
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
19
20
|
const chartDefinitions = (0, react_redux_1.useSelector)(ChartingRedux.ChartingGetChartModels);
|
|
21
|
+
const extenralChartDefinitions = (0, react_redux_1.useSelector)(ChartingRedux.ChartingGetExternalChartDefinitions);
|
|
22
|
+
const allChartDefinitions = [...chartDefinitions, ...extenralChartDefinitions];
|
|
20
23
|
const chartingOptions = (_a = adaptable.adaptableOptions) === null || _a === void 0 ? void 0 : _a.chartingOptions;
|
|
21
24
|
const chartContainers = chartingOptions === null || chartingOptions === void 0 ? void 0 : chartingOptions.chartContainers;
|
|
22
25
|
const [selectedChartId, setSelectedChartId] = React.useState(() => {
|
|
23
26
|
// ID is kept in state becaus that does not change, the definition might change
|
|
24
|
-
return
|
|
27
|
+
return allChartDefinitions.length > 0 ? allChartDefinitions[0].Uuid : null;
|
|
25
28
|
});
|
|
26
|
-
const selectedChart =
|
|
29
|
+
const selectedChart = allChartDefinitions.find((chart) => chart.Uuid === selectedChartId);
|
|
30
|
+
const isAgChart = (0, ChartingState_1.isAgChartDefinition)(selectedChart);
|
|
27
31
|
const chartAccessLevel = AdaptableHelper_1.default.getAppropriateAccessLevel(selectedChart, accessLevel);
|
|
28
32
|
const [selectedContainer, setSelectedContainer] = React.useState(null);
|
|
29
|
-
|
|
30
|
-
const
|
|
33
|
+
// Need to always call as they the rule for hooks
|
|
34
|
+
const { isOpen: isAgChartOpen, showChart: showAgChart, closeChart: hideAgChart, } = (0, useAgChartState_1.useAgChartState)(isAgChart ? selectedChart : undefined);
|
|
35
|
+
// Need to always call as they the rule for hooks
|
|
36
|
+
const { isOpen: isExternalChartOpened, showChart: showExternalChart, hideChart: hideExternalChart, } = (0, useExternalChartState_1.useExternalChartState)(!isAgChart ? selectedChart : undefined);
|
|
37
|
+
const isOpen = isAgChart ? isAgChartOpen : isExternalChartOpened;
|
|
38
|
+
const showChart = isAgChart ? showAgChart : showExternalChart;
|
|
39
|
+
const hideChart = isAgChart ? hideAgChart : hideExternalChart;
|
|
40
|
+
const options = allChartDefinitions.map((chartDefinition) => ({
|
|
31
41
|
label: chartDefinition.Name,
|
|
32
42
|
value: chartDefinition.Uuid,
|
|
33
43
|
onClick: () => {
|
|
@@ -36,15 +46,15 @@ const useChartingElements = ({ elementType, accessLevel, size = 'normal', }) =>
|
|
|
36
46
|
}));
|
|
37
47
|
const hasCharts = options.length > 0;
|
|
38
48
|
const isSelectedChart = hasCharts && selectedChart != null;
|
|
39
|
-
let
|
|
49
|
+
let selectedChartValue = '';
|
|
40
50
|
if (hasCharts && selectedChart) {
|
|
41
|
-
|
|
51
|
+
selectedChartValue = selectedChart.Name;
|
|
42
52
|
}
|
|
43
53
|
else if (hasCharts) {
|
|
44
|
-
|
|
54
|
+
selectedChartValue = 'Select Chart';
|
|
45
55
|
}
|
|
46
56
|
else {
|
|
47
|
-
|
|
57
|
+
selectedChartValue = 'No Charts';
|
|
48
58
|
}
|
|
49
59
|
React.useEffect(() => {
|
|
50
60
|
// select first
|
|
@@ -52,22 +62,22 @@ const useChartingElements = ({ elementType, accessLevel, size = 'normal', }) =>
|
|
|
52
62
|
setSelectedChartId(chartDefinitions[0].Uuid);
|
|
53
63
|
}
|
|
54
64
|
}, [chartDefinitions]);
|
|
55
|
-
|
|
56
|
-
{
|
|
65
|
+
let containerOptions = chartContainers
|
|
66
|
+
? chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.map((contianerDef) => ({
|
|
67
|
+
label: contianerDef.name,
|
|
68
|
+
onClick: () => {
|
|
69
|
+
setSelectedContainer(contianerDef);
|
|
70
|
+
},
|
|
71
|
+
}))
|
|
72
|
+
: [];
|
|
73
|
+
if ((0, ChartingState_1.isAgChartDefinition)(selectedChart)) {
|
|
74
|
+
containerOptions.unshift({
|
|
57
75
|
label: chartingOptions.agGridContainerName,
|
|
58
76
|
onClick: () => {
|
|
59
77
|
setSelectedContainer(null);
|
|
60
78
|
},
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
? chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.map((contianerDef) => ({
|
|
64
|
-
label: contianerDef.name,
|
|
65
|
-
onClick: () => {
|
|
66
|
-
setSelectedContainer(contianerDef);
|
|
67
|
-
},
|
|
68
|
-
}))
|
|
69
|
-
: []),
|
|
70
|
-
];
|
|
79
|
+
});
|
|
80
|
+
}
|
|
71
81
|
const style = {};
|
|
72
82
|
let iconSize;
|
|
73
83
|
if (size === 'small') {
|
|
@@ -75,9 +85,9 @@ const useChartingElements = ({ elementType, accessLevel, size = 'normal', }) =>
|
|
|
75
85
|
style.fontSize = 'small';
|
|
76
86
|
iconSize = 15;
|
|
77
87
|
}
|
|
78
|
-
const chartSelector = (React.createElement(DropdownButton_1.default, { style: style, width: "100%", columns: ['label'], className: `ab-${elementType}__Chart__select`, items: options, disabled: !hasCharts },
|
|
79
|
-
const containerSelector = Boolean(chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.length) && (React.createElement(DropdownButton_1.default, { style: style, width: "100%", columns: ['label'], items: containerOptions, disabled: !isSelectedChart }, (selectedContainer === null || selectedContainer === void 0 ? void 0 : selectedContainer.name)
|
|
80
|
-
const chartButton = (React.createElement(SimpleButton_1.default, { style: style, mr: 1, onClick: () => (isOpen ?
|
|
88
|
+
const chartSelector = (React.createElement(DropdownButton_1.default, { style: style, width: "100%", columns: ['label'], className: `ab-${elementType}__Chart__select`, items: options, disabled: !hasCharts }, selectedChartValue));
|
|
89
|
+
const containerSelector = Boolean(chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.length) && (React.createElement(DropdownButton_1.default, { style: style, width: "100%", columns: ['label'], items: containerOptions, disabled: !isSelectedChart }, (_b = selectedContainer === null || selectedContainer === void 0 ? void 0 : selectedContainer.name) !== null && _b !== void 0 ? _b : 'Select Container'));
|
|
90
|
+
const chartButton = (React.createElement(SimpleButton_1.default, { style: style, mr: 1, onClick: () => (isOpen ? hideChart() : showChart(selectedContainer)), disabled: !Boolean(selectedChart), variant: 'text', tone: 'neutral', icon: isOpen ? 'visibility-off' : 'visibility-on', tooltip: isOpen ? 'Hide Chart' : 'Show Chart' }));
|
|
81
91
|
const deleteButton = (React.createElement(DeleteChartButton_1.DeleteChartButton, { iconSize: iconSize, chart: selectedChart, accessLevel: chartAccessLevel }));
|
|
82
92
|
const editButton = (React.createElement(EditChartButton_1.EditChartButton, { iconSize: iconSize, chart: selectedChart, accessLevel: chartAccessLevel, isOpen: isOpen }));
|
|
83
93
|
return {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExternalChartDefinition } from '../../PredefinedConfig/ChartingState';
|
|
2
|
+
import { ChartContainer } from '../../types';
|
|
3
|
+
export declare const useExternalChartState: (chartDefinition?: ExternalChartDefinition) => {
|
|
4
|
+
showChart: (container?: ChartContainer) => void;
|
|
5
|
+
hideChart: () => void;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useExternalChartState = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const AdaptableContext_1 = require("../AdaptableContext");
|
|
7
|
+
// need to trigger other show-chart buttons to close/hide
|
|
8
|
+
const buttonChangeSubscribers = [];
|
|
9
|
+
const useExternalChartState = (chartDefinition) => {
|
|
10
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
11
|
+
// needs to update when ever a chart is:
|
|
12
|
+
// - opened, hidden
|
|
13
|
+
const [isOpen, setIsOpen] = react_1.default.useState(() => {
|
|
14
|
+
return (chartDefinition &&
|
|
15
|
+
adaptable.api.chartingApi.internalApi.isExternalChartOpened(chartDefinition));
|
|
16
|
+
});
|
|
17
|
+
const liveChartState = adaptable.api.chartingApi.internalApi.isExternalChartOpened(chartDefinition);
|
|
18
|
+
if (liveChartState !== isOpen) {
|
|
19
|
+
setIsOpen(liveChartState);
|
|
20
|
+
}
|
|
21
|
+
const updateIsOpen = react_1.default.useCallback(() => {
|
|
22
|
+
setIsOpen(chartDefinition &&
|
|
23
|
+
adaptable.api.chartingApi.internalApi.isExternalChartOpened(chartDefinition));
|
|
24
|
+
}, [chartDefinition]);
|
|
25
|
+
react_1.default.useEffect(() => {
|
|
26
|
+
const subscriber = () => {
|
|
27
|
+
updateIsOpen();
|
|
28
|
+
};
|
|
29
|
+
buttonChangeSubscribers.push(subscriber);
|
|
30
|
+
// clear own subscriptions
|
|
31
|
+
return () => {
|
|
32
|
+
const index = buttonChangeSubscribers.indexOf(subscriber);
|
|
33
|
+
if (index > -1) {
|
|
34
|
+
buttonChangeSubscribers.splice(index, 1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, [updateIsOpen]);
|
|
38
|
+
return {
|
|
39
|
+
showChart: (container) => {
|
|
40
|
+
adaptable.api.chartingApi.internalApi.onShowExternalChart(chartDefinition, container);
|
|
41
|
+
// The small delay allows the library to render the chart before the button is updated
|
|
42
|
+
requestAnimationFrame(() => {
|
|
43
|
+
buttonChangeSubscribers.forEach((subscriber) => subscriber());
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
hideChart: () => {
|
|
47
|
+
adaptable.api.chartingApi.internalApi.onHideExternalChart(chartDefinition);
|
|
48
|
+
// The small delay allows the library to destroy the chart before the button is updated
|
|
49
|
+
requestAnimationFrame(() => {
|
|
50
|
+
buttonChangeSubscribers.forEach((subscriber) => subscriber());
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
isOpen,
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
exports.useExternalChartState = useExternalChartState;
|