@adaptabletools/adaptable 16.0.8 → 16.0.10-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.
Files changed (197) hide show
  1. package/base.css +14 -14
  2. package/base.css.map +1 -1
  3. package/bundle.cjs.js +169 -169
  4. package/index.css +14 -14
  5. package/index.css.map +1 -1
  6. package/package.json +1 -1
  7. package/publishTimestamp.d.ts +1 -1
  8. package/publishTimestamp.js +1 -1
  9. package/src/AdaptableOptions/AdaptableOptions.d.ts +2 -2
  10. package/src/AdaptableOptions/ChartingOptions.d.ts +40 -0
  11. package/src/AdaptableOptions/ColumnOptions.d.ts +17 -0
  12. package/src/AdaptableOptions/NotesOptions.d.ts +23 -0
  13. package/src/AdaptableOptions/QuickSearchOptions.d.ts +8 -0
  14. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +2 -0
  15. package/src/Api/AdaptableApi.d.ts +3 -3
  16. package/src/Api/ChartingApi.d.ts +30 -0
  17. package/src/Api/ColumnApi.d.ts +5 -0
  18. package/src/Api/ConfigApi.d.ts +4 -3
  19. package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -2
  20. package/src/Api/Implementation/AdaptableApiImpl.js +2 -2
  21. package/src/Api/Implementation/ApiBase.d.ts +2 -2
  22. package/src/Api/Implementation/ApiBase.js +2 -2
  23. package/src/Api/Implementation/ChartingApiImpl.d.ts +8 -2
  24. package/src/Api/Implementation/ChartingApiImpl.js +64 -0
  25. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  26. package/src/Api/Implementation/ColumnApiImpl.js +4 -0
  27. package/src/Api/Implementation/ConfigApiImpl.d.ts +3 -2
  28. package/src/Api/Implementation/ConfigApiImpl.js +9 -9
  29. package/src/Api/Implementation/NotesApiImpl.d.ts +20 -0
  30. package/src/Api/Implementation/NotesApiImpl.js +58 -0
  31. package/src/Api/Implementation/OptionsApiImpl.d.ts +2 -2
  32. package/src/Api/Implementation/OptionsApiImpl.js +2 -2
  33. package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +2 -0
  34. package/src/Api/Implementation/UserInterfaceApiImpl.js +8 -0
  35. package/src/Api/Internal/AdaptableInternalApi.d.ts +0 -2
  36. package/src/Api/Internal/AdaptableInternalApi.js +0 -6
  37. package/src/Api/Internal/CalculatedColumnInternalApi.d.ts +2 -0
  38. package/src/Api/Internal/CalculatedColumnInternalApi.js +12 -0
  39. package/src/Api/Internal/ChartingInternalApi.d.ts +7 -0
  40. package/src/Api/Internal/ChartingInternalApi.js +45 -0
  41. package/src/Api/Internal/ColumnInternalApi.d.ts +3 -0
  42. package/src/Api/Internal/ColumnInternalApi.js +3 -0
  43. package/src/Api/NotesAPi.d.ts +50 -0
  44. package/src/Api/OptionsApi.d.ts +3 -3
  45. package/src/Api/UserInterfaceApi.d.ts +8 -0
  46. package/src/PredefinedConfig/AdaptableState.d.ts +2 -2
  47. package/src/PredefinedConfig/ChartingState.d.ts +22 -0
  48. package/src/PredefinedConfig/ChartingState.js +9 -0
  49. package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +12 -0
  50. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  51. package/src/PredefinedConfig/Common/Menu.d.ts +1 -1
  52. package/src/PredefinedConfig/Common/Types.d.ts +2 -2
  53. package/src/PredefinedConfig/Common/Types.js +1 -1
  54. package/src/PredefinedConfig/NotesState.d.ts +59 -0
  55. package/src/PredefinedConfig/PredefinedConfig.d.ts +2 -2
  56. package/src/PredefinedConfig/SystemState.d.ts +5 -3
  57. package/src/Redux/ActionsReducers/ChartingRedux.d.ts +28 -3
  58. package/src/Redux/ActionsReducers/ChartingRedux.js +52 -5
  59. package/src/Redux/ActionsReducers/NotesRedux.d.ts +39 -0
  60. package/src/Redux/ActionsReducers/NotesRedux.js +88 -0
  61. package/src/Redux/ActionsReducers/SystemRedux.d.ts +10 -10
  62. package/src/Redux/ActionsReducers/SystemRedux.js +23 -22
  63. package/src/Redux/Store/AdaptableStore.js +19 -11
  64. package/src/Strategy/ChartingModule.d.ts +5 -2
  65. package/src/Strategy/ChartingModule.js +28 -7
  66. package/src/Strategy/ColumnInfoModule.d.ts +11 -0
  67. package/src/Strategy/ColumnInfoModule.js +47 -0
  68. package/src/Strategy/DataSetModule.js +1 -0
  69. package/src/Strategy/Fdc3Module.js +28 -26
  70. package/src/Strategy/FilterModule.js +5 -0
  71. package/src/Strategy/GridInfoModule.js +13 -82
  72. package/src/Strategy/Interface/IModule.d.ts +2 -0
  73. package/src/Strategy/{CommentsModule.d.ts → NotesModule.d.ts} +6 -6
  74. package/src/Strategy/{CommentsModule.js → NotesModule.js} +41 -41
  75. package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.d.ts +2 -0
  76. package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +20 -18
  77. package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
  78. package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
  79. package/src/Utilities/Constants/ModuleConstants.d.ts +6 -3
  80. package/src/Utilities/Constants/ModuleConstants.js +8 -5
  81. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +3 -1
  82. package/src/Utilities/Defaults/DefaultSettingsPanel.js +2 -1
  83. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -2
  84. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +36 -10
  85. package/src/Utilities/Extensions/ObjectExtensions.d.ts +1 -0
  86. package/src/Utilities/Extensions/ObjectExtensions.js +5 -1
  87. package/src/Utilities/ObjectFactory.d.ts +2 -1
  88. package/src/Utilities/ObjectFactory.js +10 -2
  89. package/src/Utilities/Services/Interface/IEntitlementService.d.ts +4 -0
  90. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +1 -1
  91. package/src/Utilities/Services/QueryLanguageService.d.ts +1 -2
  92. package/src/Utilities/Services/QueryLanguageService.js +1 -6
  93. package/src/Utilities/Services/ValidationService.js +15 -5
  94. package/src/View/AdaptableView.js +2 -2
  95. package/src/View/AdaptableViewFactory.js +5 -3
  96. package/src/View/Alert/Wizard/AlertButtonsEditor.js +20 -4
  97. package/src/View/Alert/Wizard/AlertWizard.js +14 -7
  98. package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +1 -1
  99. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.d.ts +2 -0
  100. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +25 -46
  101. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.d.ts +8 -0
  102. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +19 -0
  103. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.d.ts +2 -0
  104. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +44 -3
  105. package/src/View/CalculatedColumn/utils.d.ts +2 -0
  106. package/src/View/CalculatedColumn/utils.js +14 -0
  107. package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.d.ts +6 -0
  108. package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.js +47 -0
  109. package/src/View/Charting/ChartingWizard/{PreviewChartSection.d.ts → AgChargingWizard/PreviewChartSection.d.ts} +1 -1
  110. package/src/View/Charting/ChartingWizard/{PreviewChartSection.js → AgChargingWizard/PreviewChartSection.js} +2 -2
  111. package/src/View/Charting/ChartingWizard/{SettingsSection.d.ts → AgChargingWizard/SettingsSection.d.ts} +1 -1
  112. package/src/View/Charting/ChartingWizard/{SettingsSection.js → AgChargingWizard/SettingsSection.js} +4 -4
  113. package/src/View/Charting/ChartingWizard/AgChargingWizard/index.d.ts +1 -0
  114. package/src/View/Charting/ChartingWizard/AgChargingWizard/index.js +4 -0
  115. package/src/View/Charting/ChartingWizard/ChartingWizard.d.ts +4 -3
  116. package/src/View/Charting/ChartingWizard/ChartingWizard.js +12 -39
  117. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.d.ts +6 -0
  118. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.js +59 -0
  119. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.d.ts +9 -0
  120. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +25 -0
  121. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/index.d.ts +1 -0
  122. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/index.js +4 -0
  123. package/src/View/Charting/ChartingWizard/index.d.ts +1 -0
  124. package/src/View/Charting/ChartingWizard/index.js +4 -0
  125. package/src/View/Charting/DeleteChartButton.d.ts +2 -1
  126. package/src/View/Charting/DeleteChartButton.js +4 -2
  127. package/src/View/Charting/EditChartButton.d.ts +2 -1
  128. package/src/View/Charting/ShowChartButton.js +47 -16
  129. package/src/View/Charting/{useChartState.d.ts → useAgChartState.d.ts} +1 -1
  130. package/src/View/Charting/{useChartState.js → useAgChartState.js} +7 -7
  131. package/src/View/Charting/useChartingElements.d.ts +2 -1
  132. package/src/View/Charting/useChartingElements.js +36 -26
  133. package/src/View/Charting/useExternalChartState.d.ts +7 -0
  134. package/src/View/Charting/useExternalChartState.js +56 -0
  135. package/src/View/ColumnInfo/ColumnInfo.d.ts +5 -0
  136. package/src/View/ColumnInfo/ColumnInfo.js +185 -0
  137. package/src/View/ColumnInfo/ColumnInfoPopup.d.ts +3 -0
  138. package/src/View/ColumnInfo/ColumnInfoPopup.js +15 -0
  139. package/src/View/Components/AdaptableIconSelector/index.d.ts +1 -1
  140. package/src/View/Components/Selectors/ColumnSelector.js +1 -1
  141. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +6 -1
  142. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +9 -0
  143. package/src/View/GridInfo/{AdaptableObjectsSummary.js → GridInfoPopup/AdaptableObjectsSummary.js} +2 -2
  144. package/src/View/GridInfo/{AdaptableOptionsComponent.d.ts → GridInfoPopup/AdaptableOptionsComponent.d.ts} +1 -1
  145. package/src/View/GridInfo/{AdaptableOptionsComponent.js → GridInfoPopup/AdaptableOptionsComponent.js} +6 -6
  146. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.d.ts +6 -0
  147. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +82 -0
  148. package/src/View/GridInfo/GridInfoPopup/index.d.ts +1 -0
  149. package/src/View/GridInfo/GridInfoPopup/index.js +4 -0
  150. package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
  151. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  152. package/src/View/Notes/NotesListing.d.ts +2 -0
  153. package/src/View/{Comments/CommentListing.js → Notes/NotesListing.js} +13 -14
  154. package/src/View/Notes/NotesPopup.d.ts +2 -0
  155. package/src/View/{Comments/CommentPopup.js → Notes/NotesPopup.js} +21 -21
  156. package/src/View/Shortcut/Wizard/ShortcutWizard.js +6 -1
  157. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +14 -0
  158. package/src/agGrid/Adaptable.d.ts +1 -1
  159. package/src/agGrid/Adaptable.js +28 -16
  160. package/src/agGrid/agGridHelper.d.ts +3 -3
  161. package/src/agGrid/agGridHelper.js +56 -30
  162. package/src/agGrid/agGridMenuHelper.js +4 -2
  163. package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
  164. package/src/components/ExpressionEditor/EditorInput.js +15 -6
  165. package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
  166. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +5 -5
  167. package/src/components/ExpressionEditor/editorButtonsQuantileAggregatedScalar.d.ts +2 -0
  168. package/src/components/ExpressionEditor/editorButtonsQuantileAggregatedScalar.js +25 -0
  169. package/src/components/ExpressionEditor/index.d.ts +1 -1
  170. package/src/components/ExpressionEditor/index.js +2 -1
  171. package/src/components/icons/index.js +2 -0
  172. package/src/components/icons/note.d.ts +3 -0
  173. package/src/components/icons/note.js +7 -0
  174. package/src/metamodel/adaptable.metamodel.d.ts +72 -59
  175. package/src/metamodel/adaptable.metamodel.js +1 -1
  176. package/src/types.d.ts +4 -4
  177. package/version.d.ts +1 -1
  178. package/version.js +1 -1
  179. package/src/AdaptableOptions/CommentsOptions.d.ts +0 -23
  180. package/src/Api/CommentsApi.d.ts +0 -50
  181. package/src/Api/Implementation/CommentsApiImpl.d.ts +0 -20
  182. package/src/Api/Implementation/CommentsApiImpl.js +0 -58
  183. package/src/PredefinedConfig/CommentsState.d.ts +0 -59
  184. package/src/Redux/ActionsReducers/CommentsRedux.d.ts +0 -39
  185. package/src/Redux/ActionsReducers/CommentsRedux.js +0 -92
  186. package/src/View/Comments/CommentListing.d.ts +0 -2
  187. package/src/View/Comments/CommentPopup.d.ts +0 -2
  188. package/src/View/GridInfo/ColumnInfoComponent.d.ts +0 -20
  189. package/src/View/GridInfo/ColumnInfoComponent.js +0 -176
  190. package/src/View/GridInfo/GridInfoPopup.d.ts +0 -16
  191. package/src/View/GridInfo/GridInfoPopup.js +0 -117
  192. package/src/View/GridInfo/GridOptionsComponent.d.ts +0 -16
  193. package/src/View/GridInfo/GridOptionsComponent.js +0 -36
  194. /package/src/AdaptableOptions/{CommentsOptions.js → NotesOptions.js} +0 -0
  195. /package/src/Api/{CommentsApi.js → NotesAPi.js} +0 -0
  196. /package/src/PredefinedConfig/{CommentsState.js → NotesState.js} +0 -0
  197. /package/src/View/GridInfo/{AdaptableObjectsSummary.d.ts → GridInfoPopup/AdaptableObjectsSummary.d.ts} +0 -0
@@ -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().externalCharting) === 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,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./ExternalChartingWizard"), exports);
@@ -0,0 +1 @@
1
+ export * from './ChartingWizard';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./ChartingWizard"), exports);
@@ -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
- var _a;
10
- return (React.createElement(ButtonDelete_1.ButtonDelete, { iconSize: props.iconSize, disabled: !props.chart, ConfirmAction: ChartingRedux.ChartingDeleteChart((_a = props.chart) === null || _a === void 0 ? void 0 : _a.Name), ConfirmationMsg: `Are you sure you want to delete this Charts?`, ConfirmationTitle: 'Delete Charts', accessLevel: props.accessLevel, tooltip: "Delete Chart" }));
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 ShowChartButton = (props) => {
12
- var _a, _b;
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
- const { isOpen, showChart, closeChart } = (0, useChartState_1.useChartState)(props.data);
17
- if (isOpen) {
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: () => showChart(), variant: "text", tone: "success", icon: "visibility-on", tooltip: "Show Chart" }));
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(DropdownButton_1.default, { "data-name": "show-chart-dropdown", variant: "text", columns: ['label'], items: containerOptions },
38
- React.createElement(SimpleButton_1.default, { variant: "raised", tone: "success" }, "Open")));
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 useChartState: (chartDefinition?: ChartDefinition) => {
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.useChartState = void 0;
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 useChartState = (chartDefinition) => {
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 handleShowChart = React.useCallback((chartContainer) => {
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 handleCloseChart = React.useCallback(() => {
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: handleShowChart,
72
- closeChart: handleCloseChart,
71
+ showChart,
72
+ closeChart,
73
73
  };
74
74
  };
75
- exports.useChartState = useChartState;
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 useChartState_1 = require("./useChartState");
12
+ const AdaptableContext_1 = require("../AdaptableContext");
13
13
  const DeleteChartButton_1 = require("./DeleteChartButton");
14
14
  const EditChartButton_1 = require("./EditChartButton");
15
- const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
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 chartDefinitions.length > 0 ? chartDefinitions[0].Uuid : null;
27
+ return allChartDefinitions.length > 0 ? allChartDefinitions[0].Uuid : null;
25
28
  });
26
- const selectedChart = chartDefinitions.find((chart) => chart.Uuid === selectedChartId);
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
- const { isOpen, showChart, closeChart } = (0, useChartState_1.useChartState)(selectedChart);
30
- const options = chartDefinitions.map((chartDefinition) => ({
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 content = '';
49
+ let selectedChartValue = '';
40
50
  if (hasCharts && selectedChart) {
41
- content = (_b = chartDefinitions.find((chart) => chart.Uuid === selectedChart.Uuid)) === null || _b === void 0 ? void 0 : _b.Name;
51
+ selectedChartValue = selectedChart.Name;
42
52
  }
43
53
  else if (hasCharts) {
44
- content = 'Select Chart';
54
+ selectedChartValue = 'Select Chart';
45
55
  }
46
56
  else {
47
- content = 'No Charts';
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
- const containerOptions = [
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
- ...(chartContainers
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 }, content));
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) || chartingOptions.agGridContainerName || GeneralConstants_1.AG_GRID_CHART_WINDOW));
80
- const chartButton = (React.createElement(SimpleButton_1.default, { style: style, mr: 1, onClick: () => (isOpen ? closeChart() : showChart(selectedContainer)), disabled: !Boolean(selectedChart), variant: 'text', tone: 'neutral', icon: isOpen ? 'visibility-off' : 'visibility-on', tooltip: isOpen ? 'Hide Chart' : 'Show Chart' }));
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;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface ColumnInfoProps {
3
+ selectedColumnId: string;
4
+ }
5
+ export declare const ColumnInfo: React.FunctionComponent<ColumnInfoProps>;