@adaptabletools/adaptable 14.0.3 → 14.1.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 (201) hide show
  1. package/base.css +7 -1
  2. package/base.css.map +1 -1
  3. package/bundle.cjs.js +170 -169
  4. package/index.css +76 -62
  5. package/index.css.map +1 -1
  6. package/package.json +2 -2
  7. package/publishTimestamp.d.ts +1 -1
  8. package/publishTimestamp.js +1 -1
  9. package/src/AdaptableOptions/ActionOptions.d.ts +3 -0
  10. package/src/AdaptableOptions/AdaptablePlugin.d.ts +3 -0
  11. package/src/AdaptableOptions/AdaptablePlugin.js +3 -0
  12. package/src/AdaptableOptions/ChartingOptions.d.ts +1 -1
  13. package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +26 -26
  14. package/src/AdaptableOptions/ExportOptions.d.ts +17 -3
  15. package/src/Api/CalculatedColumnApi.d.ts +9 -0
  16. package/src/Api/ChartingApi.d.ts +41 -14
  17. package/src/Api/ColumnApi.d.ts +4 -0
  18. package/src/Api/DataSetApi.d.ts +2 -2
  19. package/src/Api/EventApi.d.ts +15 -1
  20. package/src/Api/Events/ChartChanged.d.ts +8 -0
  21. package/src/Api/Events/ChartChanged.js +2 -0
  22. package/src/Api/ExportApi.d.ts +5 -0
  23. package/src/Api/Implementation/CalculatedColumnApiImpl.d.ts +2 -0
  24. package/src/Api/Implementation/CalculatedColumnApiImpl.js +24 -0
  25. package/src/Api/Implementation/ChartingApiImpl.d.ts +16 -2
  26. package/src/Api/Implementation/ChartingApiImpl.js +54 -2
  27. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  28. package/src/Api/Implementation/ColumnApiImpl.js +3 -0
  29. package/src/Api/Implementation/ExportApiImpl.d.ts +2 -0
  30. package/src/Api/Implementation/ExportApiImpl.js +10 -0
  31. package/src/Api/Implementation/PredicateApiImpl.d.ts +6 -4
  32. package/src/Api/Implementation/PredicateApiImpl.js +20 -1
  33. package/src/Api/Implementation/QueryApiImpl.js +8 -2
  34. package/src/Api/Internal/AdaptableInternalApi.d.ts +7 -1
  35. package/src/Api/Internal/AdaptableInternalApi.js +2 -1
  36. package/src/Api/Internal/AlertInternalApi.js +1 -1
  37. package/src/Api/Internal/CalculatedColumnInternalApi.d.ts +2 -0
  38. package/src/Api/Internal/CalculatedColumnInternalApi.js +9 -0
  39. package/src/Api/Internal/ChartingInternalApi.d.ts +6 -0
  40. package/src/Api/Internal/ChartingInternalApi.js +24 -0
  41. package/src/Api/Internal/FormatColumnInternalApi.d.ts +5 -0
  42. package/src/Api/Internal/FormatColumnInternalApi.js +25 -1
  43. package/src/Api/PredicateApi.d.ts +17 -1
  44. package/src/PredefinedConfig/AlertState.d.ts +5 -2
  45. package/src/PredefinedConfig/Common/AdaptableAlert.d.ts +6 -0
  46. package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +15 -11
  47. package/src/PredefinedConfig/Common/AdaptableForm.d.ts +6 -0
  48. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  49. package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +6 -0
  50. package/src/PredefinedConfig/Common/AdaptableQuery.d.ts +15 -0
  51. package/src/PredefinedConfig/Common/Enums.d.ts +2 -1
  52. package/src/PredefinedConfig/Common/Enums.js +1 -0
  53. package/src/PredefinedConfig/Common/FDC3Context.d.ts +3 -0
  54. package/src/PredefinedConfig/Common/Types.d.ts +21 -6
  55. package/src/PredefinedConfig/Common/Types.js +1 -3
  56. package/src/PredefinedConfig/FlashingCellState.d.ts +2 -2
  57. package/src/PredefinedConfig/FormatColumnState.d.ts +3 -2
  58. package/src/PredefinedConfig/FreeTextColumnState.d.ts +1 -1
  59. package/src/PredefinedConfig/PredefinedConfig.d.ts +4 -4
  60. package/src/PredefinedConfig/ThemeState.d.ts +0 -4
  61. package/src/Redux/ActionsReducers/PopupRedux.d.ts +2 -0
  62. package/src/Redux/ActionsReducers/PopupRedux.js +2 -0
  63. package/src/Redux/ActionsReducers/StatusBarRedux.d.ts +2 -2
  64. package/src/Redux/ActionsReducers/StatusBarRedux.js +4 -4
  65. package/src/Redux/Store/AdaptableStore.js +1 -11
  66. package/src/Strategy/AlertModule.js +7 -3
  67. package/src/Strategy/ChartingModule.js +5 -3
  68. package/src/Strategy/ExportModule.d.ts +1 -0
  69. package/src/Strategy/ExportModule.js +43 -0
  70. package/src/Strategy/FlashingCellModule.js +1 -1
  71. package/src/Strategy/FormatColumnModule.js +7 -2
  72. package/src/Strategy/Interface/IModule.d.ts +1 -1
  73. package/src/Strategy/LayoutModule.js +8 -1
  74. package/src/Strategy/StyledColumnModule.js +5 -0
  75. package/src/Strategy/ThemeModule.js +8 -2
  76. package/src/Strategy/Utilities/Alert/getAlertPreviewViewItems.js +2 -2
  77. package/src/Strategy/Utilities/Alert/getAlertTypeViewItems.d.ts +5 -0
  78. package/src/Strategy/Utilities/Alert/getAlertTypeViewItems.js +13 -0
  79. package/src/Strategy/Utilities/getObjectTagsViewItems.js +3 -3
  80. package/src/Utilities/Constants/ModuleConstants.d.ts +0 -3
  81. package/src/Utilities/Constants/ModuleConstants.js +2 -5
  82. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -0
  83. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +1 -1
  84. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +3 -1
  85. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +1 -1
  86. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +64 -3
  87. package/src/Utilities/Interface/MessagePopups.d.ts +1 -0
  88. package/src/Utilities/Services/AggregatedScalarLiveValue.js +13 -0
  89. package/src/Utilities/Services/ChartingService.d.ts +8 -0
  90. package/src/Utilities/Services/ChartingService.js +16 -0
  91. package/src/Utilities/Services/ReportService.js +1 -1
  92. package/src/View/AdaptableViewFactory.js +1 -1
  93. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +3 -2
  94. package/src/View/Alert/Utilities/getAlertType.d.ts +15 -0
  95. package/src/View/Alert/Utilities/getAlertType.js +58 -0
  96. package/src/View/Alert/Utilities/getAvailablePredicates.d.ts +3 -0
  97. package/src/View/Alert/Utilities/getAvailablePredicates.js +19 -0
  98. package/src/View/Alert/Utilities/getDefaultAlertDefinition.d.ts +37 -0
  99. package/src/View/Alert/Utilities/getDefaultAlertDefinition.js +32 -0
  100. package/src/View/Alert/Utilities/mapAlertDefinition.d.ts +2 -0
  101. package/src/View/Alert/Utilities/mapAlertDefinition.js +38 -0
  102. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.d.ts +4 -2
  103. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +18 -11
  104. package/src/View/Alert/Wizard/AlertButtonsEditor.d.ts +2 -0
  105. package/src/View/Alert/Wizard/AlertButtonsEditor.js +15 -6
  106. package/src/View/Alert/Wizard/AlertMessageWizardSection.d.ts +10 -0
  107. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +57 -0
  108. package/src/View/Alert/Wizard/{AlertDisplayWizardSection.d.ts → AlertNotificationWizardSection.d.ts} +7 -5
  109. package/src/View/Alert/Wizard/{AlertDisplayWizardSection.js → AlertNotificationWizardSection.js} +12 -50
  110. package/src/View/Alert/Wizard/AlertRulesWizardSection.d.ts +7 -4
  111. package/src/View/Alert/Wizard/AlertRulesWizardSection.js +66 -6
  112. package/src/View/Alert/Wizard/AlertScopeWizardSection.d.ts +2 -0
  113. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +41 -2
  114. package/src/View/Alert/Wizard/AlertTypeWizardSection.d.ts +9 -0
  115. package/src/View/Alert/Wizard/AlertTypeWizardSection.js +27 -0
  116. package/src/View/Alert/Wizard/AlertWizard.js +53 -98
  117. package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.d.ts +1 -6
  118. package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +4 -39
  119. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +1 -1
  120. package/src/View/{Components/Charting → Charting}/ChartingStatusBarPopover.d.ts +0 -0
  121. package/src/View/{Components/Charting → Charting}/ChartingStatusBarPopover.js +2 -2
  122. package/src/View/{Components/Charting → Charting}/ChartingViewPanel.d.ts +1 -1
  123. package/src/View/{Components/Charting → Charting}/ChartingViewPanel.js +0 -0
  124. package/src/View/{Components/Charting → Charting}/ChartingWizard/ChartingWizard.d.ts +2 -2
  125. package/src/View/{Components/Charting → Charting}/ChartingWizard/ChartingWizard.js +12 -2
  126. package/src/View/{Components/Charting → Charting}/ChartingWizard/PreviewChartSection.d.ts +1 -1
  127. package/src/View/{Components/Charting → Charting}/ChartingWizard/PreviewChartSection.js +2 -2
  128. package/src/View/{Components/Charting → Charting}/ChartingWizard/SettingsSection.d.ts +1 -1
  129. package/src/View/{Components/Charting → Charting}/ChartingWizard/SettingsSection.js +4 -4
  130. package/src/View/{Components/Charting → Charting}/DeleteChartButton.d.ts +1 -1
  131. package/src/View/{Components/Charting → Charting}/DeleteChartButton.js +3 -3
  132. package/src/View/{Components/Charting → Charting}/EditChartButton.d.ts +1 -1
  133. package/src/View/{Components/Charting → Charting}/EditChartButton.js +3 -3
  134. package/src/View/{Components/Charting → Charting}/ShowChartButton.d.ts +1 -1
  135. package/src/View/{Components/Charting → Charting}/ShowChartButton.js +5 -5
  136. package/src/View/{Components/Charting → Charting}/useChartState.d.ts +1 -1
  137. package/src/View/{Components/Charting → Charting}/useChartState.js +5 -5
  138. package/src/View/{Components/Charting → Charting}/useChartingElements.d.ts +1 -1
  139. package/src/View/{Components/Charting → Charting}/useChartingElements.js +6 -6
  140. package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/EntityRulePredicateEditor.d.ts +12 -0
  141. package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/EntityRulePredicateEditor.js +85 -0
  142. package/src/View/Components/EntityRulesEditor/{PredicatesEditor.d.ts → EntityRulePredicatesEditor/EntityRulePredicatesEditor.d.ts} +6 -4
  143. package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/EntityRulePredicatesEditor.js +87 -0
  144. package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/index.d.ts +1 -0
  145. package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/index.js +5 -0
  146. package/src/View/Components/EntityRulesEditor/Utilities.js +7 -1
  147. package/src/View/Components/EntityRulesEditor/index.d.ts +4 -2
  148. package/src/View/Components/EntityRulesEditor/index.js +27 -10
  149. package/src/View/Components/NewScopeComponent.d.ts +9 -5
  150. package/src/View/Components/NewScopeComponent.js +19 -10
  151. package/src/View/Components/Popups/WindowPopups/WindowPopups.js +2 -2
  152. package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +1 -0
  153. package/src/View/Components/Popups/WindowPopups/windowFactory.js +4 -1
  154. package/src/View/Components/PredicateEditor/PredicateEditor.js +16 -5
  155. package/src/View/Components/PreviewResultsPanel.js +30 -3
  156. package/src/View/CustomSort/Wizard/CustomSortWizard.js +1 -1
  157. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +3 -0
  158. package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +1 -1
  159. package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.js +1 -1
  160. package/src/View/Export/ExportTablePopup.d.ts +3 -0
  161. package/src/View/Export/ExportTablePopup.js +59 -0
  162. package/src/View/Export/Wizard/NewReportWizard.js +1 -1
  163. package/src/View/Export/Wizard/ReportColumnsWizardSection.js +1 -1
  164. package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +1 -1
  165. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +2 -2
  166. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
  167. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
  168. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +1 -1
  169. package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +1 -1
  170. package/src/View/GridInfo/GridInfoPopup.js +1 -1
  171. package/src/View/PlusMinus/Wizard/PlusMinusWizard.js +1 -1
  172. package/src/View/Query/Wizard/NamedQueryWizard.js +1 -1
  173. package/src/View/Schedule/Wizard/ScheduleWizard.js +1 -1
  174. package/src/View/Shortcut/Wizard/ShortcutWizard.js +1 -1
  175. package/src/View/StatusBar/StatusBarPanel.d.ts +3 -4
  176. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +7 -4
  177. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +5 -5
  178. package/src/View/TeamSharing/TeamSharingApplyButton.js +1 -1
  179. package/src/View/Theme/ThemeStatusPanelPopover.js +10 -2
  180. package/src/View/Wizard/TypeRadio.d.ts +7 -0
  181. package/src/View/Wizard/TypeRadio.js +12 -0
  182. package/src/agGrid/Adaptable.d.ts +3 -1
  183. package/src/agGrid/Adaptable.js +28 -4
  184. package/src/agGrid/agGridHelper.d.ts +1 -0
  185. package/src/agGrid/agGridHelper.js +15 -0
  186. package/src/components/ExpressionEditor/EditorInputWithWhereClause.js +4 -0
  187. package/src/components/ExpressionEditor/editorButtonsAggregatedBoolean.js +5 -0
  188. package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -0
  189. package/src/components/icons/index.js +4 -0
  190. package/src/components/icons/visibility-off.d.ts +3 -0
  191. package/src/components/icons/visibility-off.js +7 -0
  192. package/src/components/icons/visibility.d.ts +3 -0
  193. package/src/components/icons/visibility.js +8 -0
  194. package/src/metamodel/adaptable.metamodel.d.ts +129 -0
  195. package/src/metamodel/adaptable.metamodel.js +1 -1
  196. package/src/types.d.ts +5 -4
  197. package/version.d.ts +1 -1
  198. package/version.js +1 -1
  199. package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.d.ts +0 -9
  200. package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.js +0 -30
  201. package/src/View/Components/EntityRulesEditor/PredicatesEditor.js +0 -86
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { AccessLevel, ChartDefinition } from '../../../types';
2
+ import { AccessLevel, ChartDefinition } from '../../types';
3
3
  export declare const useChartingElements: ({ elementType, accessLevel, size, }: {
4
4
  elementType: string;
5
5
  accessLevel: AccessLevel;
@@ -4,11 +4,11 @@ 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
- const DropdownButton_1 = tslib_1.__importDefault(require("../../../components/DropdownButton"));
9
- const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
10
- const ChartingRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/ChartingRedux"));
11
- const AdaptableHelper_1 = tslib_1.__importDefault(require("../../../Utilities/Helpers/AdaptableHelper"));
7
+ const AdaptableContext_1 = require("../AdaptableContext");
8
+ const DropdownButton_1 = tslib_1.__importDefault(require("../../components/DropdownButton"));
9
+ const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
10
+ const ChartingRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ChartingRedux"));
11
+ const AdaptableHelper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/AdaptableHelper"));
12
12
  const useChartState_1 = require("./useChartState");
13
13
  const DeleteChartButton_1 = require("./DeleteChartButton");
14
14
  const EditChartButton_1 = require("./EditChartButton");
@@ -75,7 +75,7 @@ const useChartingElements = ({ elementType, accessLevel, size = 'normal', }) =>
75
75
  }
76
76
  const chartSelector = (React.createElement(DropdownButton_1.default, { style: style, width: "100%", columns: ['label'], className: `ab-${elementType}__Chart__select`, items: options, disabled: !hasCharts }, content));
77
77
  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) || 'Ag Grid Window'));
78
- const chartButton = (React.createElement(SimpleButton_1.default, { style: style, mr: 1, onClick: () => (isOpen ? closeChart() : showChart(selectedContainer)), disabled: !Boolean(selectedChart), variant: 'outlined', tone: 'neutral' }, isOpen ? 'Close' : 'Open'));
78
+ 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', tooltip: isOpen ? 'Hide Chart' : 'Show Chart' }));
79
79
  const deleteButton = (React.createElement(DeleteChartButton_1.DeleteChartButton, { iconSize: iconSize, chart: selectedChart, accessLevel: chartAccessLevel }));
80
80
  const editButton = (React.createElement(EditChartButton_1.EditChartButton, { iconSize: iconSize, chart: selectedChart, accessLevel: chartAccessLevel, isOpen: isOpen }));
81
81
  return {
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { AdaptableColumnPredicate, AdaptablePredicateDef } from '../../../../types';
3
+ import { EntityRulePredicatesEditorProps } from './EntityRulePredicatesEditor';
4
+ export interface EntityPredicateEditorProps {
5
+ data: EntityRulePredicatesEditorProps['data'];
6
+ predicate?: AdaptableColumnPredicate;
7
+ onChange: EntityRulePredicatesEditorProps['onChange'];
8
+ predicateDefs: AdaptablePredicateDef[];
9
+ getPredicateDefsForColId?: (colId: string) => AdaptablePredicateDef[];
10
+ columnPredicateEnabled: boolean;
11
+ }
12
+ export declare const EntityRulePredicateEditor: React.FC<EntityPredicateEditorProps>;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityRulePredicateEditor = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const rebass_1 = require("rebass");
7
+ const DropdownButton_1 = tslib_1.__importDefault(require("../../../../components/DropdownButton"));
8
+ const FormLayout_1 = tslib_1.__importStar(require("../../../../components/FormLayout"));
9
+ const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
10
+ const AdaptableContext_1 = require("../../../AdaptableContext");
11
+ const PredicateEditor_1 = require("../../PredicateEditor/PredicateEditor");
12
+ const EntityRulePredicateEditor = (props) => {
13
+ var _a, _b, _c, _d, _e;
14
+ const { api } = (0, AdaptableContext_1.useAdaptable)();
15
+ const { predicate } = props;
16
+ const allColumns = React.useMemo(() => {
17
+ return api.columnApi.getColumns().map((column) => ({
18
+ label: column.friendlyName,
19
+ value: column.columnId,
20
+ }));
21
+ }, []);
22
+ const handleClear = () => {
23
+ var _a, _b;
24
+ const newPredicates = (_b = (_a = props.data.Rule) === null || _a === void 0 ? void 0 : _a.Predicates) === null || _b === void 0 ? void 0 : _b.filter((prevPredicate) => prevPredicate !== predicate);
25
+ props.onChange(Object.assign(Object.assign({}, props.data), { Rule: {
26
+ Predicates: newPredicates,
27
+ } }));
28
+ };
29
+ const handlePredicateChange = (newPredicateDef) => {
30
+ var _a, _b;
31
+ let newPredicates = [];
32
+ if (predicate) {
33
+ newPredicates = (_b = (_a = props.data.Rule) === null || _a === void 0 ? void 0 : _a.Predicates) === null || _b === void 0 ? void 0 : _b.map((prevPredicate) => {
34
+ if (prevPredicate === predicate) {
35
+ return newPredicateDef;
36
+ }
37
+ return prevPredicate;
38
+ });
39
+ }
40
+ else {
41
+ // no previous predicate, e.g. it was cleared
42
+ newPredicates = [newPredicateDef];
43
+ }
44
+ props.onChange(Object.assign(Object.assign({}, props.data), { Rule: {
45
+ Predicates: newPredicates,
46
+ } }));
47
+ };
48
+ const predicateDefs = React.useMemo(() => {
49
+ var _a;
50
+ let preparedPredicates = [];
51
+ if (props.getPredicateDefsForColId && ((_a = props === null || props === void 0 ? void 0 : props.predicate) === null || _a === void 0 ? void 0 : _a.ColumnId)) {
52
+ preparedPredicates = props.getPredicateDefsForColId(props.predicate.ColumnId);
53
+ }
54
+ else {
55
+ preparedPredicates = props.predicateDefs;
56
+ }
57
+ return preparedPredicates;
58
+ }, [props.predicate]);
59
+ const columnIdPredicateScopeEnabled = Boolean(props.columnPredicateEnabled);
60
+ const columnFriendlyName = (_a = allColumns.find((col) => col.value === (predicate === null || predicate === void 0 ? void 0 : predicate.ColumnId))) === null || _a === void 0 ? void 0 : _a.label;
61
+ const columnOptions = allColumns.map((col) => ({
62
+ label: col.label,
63
+ onClick: () => {
64
+ handlePredicateChange({ PredicateId: null, ColumnId: col.value, Inputs: [] });
65
+ },
66
+ }));
67
+ // use global scope or custom scope
68
+ let predicateColumnId = null;
69
+ if ((predicate === null || predicate === void 0 ? void 0 : predicate.ColumnId) && predicate.ColumnId !== '') {
70
+ predicateColumnId = predicate.ColumnId;
71
+ }
72
+ else if ('ColumnIds' in props.data.Scope && ((_c = (_b = props.data.Scope) === null || _b === void 0 ? void 0 : _b.ColumnIds) === null || _c === void 0 ? void 0 : _c[0])) {
73
+ predicateColumnId = (_e = (_d = props.data.Scope) === null || _d === void 0 ? void 0 : _d.ColumnIds) === null || _e === void 0 ? void 0 : _e[0];
74
+ }
75
+ return (React.createElement(rebass_1.Flex, { className: "ab-EntityRulePredicateEditor", p: 3, mb: 3 },
76
+ React.createElement(rebass_1.Box, { flex: 1 },
77
+ React.createElement(FormLayout_1.default, null,
78
+ columnIdPredicateScopeEnabled && (React.createElement(FormLayout_1.FormRow, { label: "Column" },
79
+ React.createElement(DropdownButton_1.default, { width: "100%", columns: ['label'], items: columnOptions }, columnFriendlyName !== null && columnFriendlyName !== void 0 ? columnFriendlyName : 'Select Column'))),
80
+ React.createElement(FormLayout_1.FormRow, { label: "Predicate" },
81
+ React.createElement(PredicateEditor_1.PredicateEditor, { columnId: predicateColumnId, predicateDefs: predicateDefs, predicate: predicate, onChange: handlePredicateChange, onClear: handleClear })))),
82
+ React.createElement(rebass_1.Box, null,
83
+ React.createElement(SimpleButton_1.default, { disabled: !predicate, ml: 2, onClick: handleClear, icon: "delete" }))));
84
+ };
85
+ exports.EntityRulePredicateEditor = EntityRulePredicateEditor;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { AdaptablePredicateDef, AdaptableScope } from '../../../types';
3
- import { EntityRulesEditorProps, RuleType } from './index';
4
- export interface PredicatesEditorProps {
2
+ import { AdaptablePredicateDef, AdaptableScope } from '../../../../types';
3
+ import { EntityRulesEditorProps, RuleType } from '../index';
4
+ export interface EntityRulePredicatesEditorProps {
5
5
  descriptions: EntityRulesEditorProps<any>['descriptions'];
6
6
  data: {
7
7
  Rule: RuleType;
@@ -12,5 +12,7 @@ export interface PredicatesEditorProps {
12
12
  Scope: AdaptableScope;
13
13
  }) => void;
14
14
  predicateDefs: AdaptablePredicateDef[];
15
+ getPredicateDefsForColId?: (colId: string) => AdaptablePredicateDef[];
16
+ enablePredicateColumnId?: boolean;
15
17
  }
16
- export declare const PredicatesEditor: React.FunctionComponent<PredicatesEditorProps>;
18
+ export declare const EntityRulePredicatesEditor: React.FunctionComponent<EntityRulePredicatesEditorProps>;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityRulePredicatesEditor = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const rebass_1 = require("rebass");
7
+ const HelpBlock_1 = tslib_1.__importDefault(require("../../../../components/HelpBlock"));
8
+ const AdaptableContext_1 = require("../../../AdaptableContext");
9
+ const ButtonInfo_1 = require("../../Buttons/ButtonInfo");
10
+ const DocumentationLinkConstants_1 = require("../../../../Utilities/Constants/DocumentationLinkConstants");
11
+ const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
12
+ const Tag_1 = require("../../../../components/Tag");
13
+ const EntityRulePredicateEditor_1 = require("./EntityRulePredicateEditor");
14
+ const Radio_1 = tslib_1.__importDefault(require("../../../../components/Radio"));
15
+ const getScopeViewItems_1 = require("../../../../Strategy/Utilities/getScopeViewItems");
16
+ const EntityRulePredicatesEditor = (props) => {
17
+ var _a, _b, _c, _d, _e;
18
+ const { api } = (0, AdaptableContext_1.useAdaptable)();
19
+ const showDocumentationLinks = api.internalApi.isDocumentationLinksDisplayed();
20
+ const columnPredicateEnabled = props.data.Rule.Predicates.some((predicate) => predicate.ColumnId !== undefined);
21
+ // filter out predicates that are already in use
22
+ const defaultPredicateDefs = props.predicateDefs.filter((predicateDef) => {
23
+ var _a, _b;
24
+ return (_b = (_a = props.data.Rule) === null || _a === void 0 ? void 0 : _a.Predicates) === null || _b === void 0 ? void 0 : _b.every((rulePrediate) => rulePrediate.PredicateId !== predicateDef.id);
25
+ });
26
+ const handlePredicateScopeTypeChange = (columnPredicateEnabled) => {
27
+ if (columnPredicateEnabled) {
28
+ props.onChange(Object.assign(Object.assign({}, props.data), { Rule: {
29
+ Predicates: [
30
+ {
31
+ PredicateId: null,
32
+ ColumnId: '',
33
+ },
34
+ ],
35
+ } }));
36
+ }
37
+ else {
38
+ props.onChange(Object.assign(Object.assign({}, props.data), { Rule: {
39
+ Predicates: [],
40
+ } }));
41
+ }
42
+ };
43
+ const handleAddNewPredicate = () => {
44
+ var _a;
45
+ props.onChange(Object.assign(Object.assign({}, props.data), { Rule: {
46
+ Predicates: [
47
+ ...(((_a = props.data.Rule) === null || _a === void 0 ? void 0 : _a.Predicates) || []),
48
+ {
49
+ PredicateId: defaultPredicateDefs[0].id,
50
+ Inputs: [],
51
+ },
52
+ ],
53
+ } }));
54
+ };
55
+ const scopeString = (0, getScopeViewItems_1.getScopeViewItems)(props.data.Scope, api).values.join(', ');
56
+ const enablePredicateColumnId = (_a = props.enablePredicateColumnId) !== null && _a !== void 0 ? _a : true;
57
+ return (React.createElement(React.Fragment, null,
58
+ React.createElement(rebass_1.Flex, { mb: 2, justifyContent: "space-between" },
59
+ React.createElement(rebass_1.Text, { fontSize: 2, mb: 2 }, props.descriptions.selectPredicate),
60
+ React.createElement(SimpleButton_1.default, { disabled: !((_c = (_b = props.data.Rule) === null || _b === void 0 ? void 0 : _b.Predicates) === null || _c === void 0 ? void 0 : _c.length), onClick: handleAddNewPredicate, icon: "plus", variant: "raised" }, "Add Predicate")),
61
+ enablePredicateColumnId && (React.createElement(rebass_1.Flex, { className: "ab-EntityRulePredicateEditor-ScopeTypeSelector", p: 2, mb: 2, flexDirection: "column" },
62
+ React.createElement(rebass_1.Text, { mb: 2 }, "Create Predicate Rule(s) using"),
63
+ React.createElement(Radio_1.default, { "data-name": "entity-scope", onClick: () => handlePredicateScopeTypeChange(false), mr: 3, checked: !columnPredicateEnabled },
64
+ "The Alert's Trigger:",
65
+ ' ',
66
+ React.createElement(Tag_1.Tag, { ml: 1, mr: 1 }, scopeString || 'Not Defined'),
67
+ ' '),
68
+ React.createElement(Radio_1.default, { "data-name": "column-scope", onClick: () => handlePredicateScopeTypeChange(true), checked: columnPredicateEnabled }, "Selected Columns (overriding the Alert's Trigger)"))),
69
+ (((_e = (_d = props.data.Rule) === null || _d === void 0 ? void 0 : _d.Predicates) === null || _e === void 0 ? void 0 : _e.length) ? props.data.Rule.Predicates : [null]).map((predicate, index) => {
70
+ const currentPredicatDef = props.predicateDefs.find((pd) => pd.id === (predicate === null || predicate === void 0 ? void 0 : predicate.PredicateId));
71
+ let editorPredicateDefs = defaultPredicateDefs;
72
+ if (currentPredicatDef) {
73
+ editorPredicateDefs = [currentPredicatDef, ...defaultPredicateDefs];
74
+ }
75
+ return (React.createElement(React.Fragment, { key: `${index}-${predicate === null || predicate === void 0 ? void 0 : predicate.PredicateId}` },
76
+ index > 0 && (React.createElement(rebass_1.Box, null,
77
+ React.createElement(Tag_1.Tag, { mb: 3 }, "AND"))),
78
+ React.createElement(EntityRulePredicateEditor_1.EntityRulePredicateEditor, { data: props.data, predicate: predicate, onChange: props.onChange, predicateDefs: editorPredicateDefs, getPredicateDefsForColId: props.getPredicateDefsForColId, columnPredicateEnabled: columnPredicateEnabled })));
79
+ }),
80
+ showDocumentationLinks && (React.createElement(HelpBlock_1.default, { "data-name": "query-documentation", mt: 3, mb: 2, style: {
81
+ fontSize: 'var(--ab-font-size-3)',
82
+ padding: 0,
83
+ } },
84
+ React.createElement(ButtonInfo_1.ButtonInfo, { mr: 2, onClick: () => window.open(DocumentationLinkConstants_1.PredicateDocsLink, '_blank') }),
85
+ "See Predicate documentation for more details and examples"))));
86
+ };
87
+ exports.EntityRulePredicatesEditor = EntityRulePredicatesEditor;
@@ -0,0 +1 @@
1
+ export { EntityRulePredicatesEditor } from './EntityRulePredicatesEditor';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityRulePredicatesEditor = void 0;
4
+ var EntityRulePredicatesEditor_1 = require("./EntityRulePredicatesEditor");
5
+ Object.defineProperty(exports, "EntityRulePredicatesEditor", { enumerable: true, get: function () { return EntityRulePredicatesEditor_1.EntityRulePredicatesEditor; } });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isAdaptableRuleValid = void 0;
4
4
  const isAdaptableRuleValid = (abObject, api, context) => {
5
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
5
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
6
6
  if ((_b = (_a = abObject === null || abObject === void 0 ? void 0 : abObject.Rule) === null || _a === void 0 ? void 0 : _a.Predicates) === null || _b === void 0 ? void 0 : _b.length) {
7
7
  if (!api.predicateApi.isEveryPredicateValid((_c = abObject === null || abObject === void 0 ? void 0 : abObject.Rule) === null || _c === void 0 ? void 0 : _c.Predicates)) {
8
8
  return `The Predicate${((_e = (_d = abObject === null || abObject === void 0 ? void 0 : abObject.Rule) === null || _d === void 0 ? void 0 : _d.Predicates) === null || _e === void 0 ? void 0 : _e.length) === 1 ? ' is' : 's are'} not valid`;
@@ -23,6 +23,12 @@ const isAdaptableRuleValid = (abObject, api, context) => {
23
23
  return 'The Expression is not a valid Aggregated Boolean Expression';
24
24
  }
25
25
  }
26
+ if ((_o = (_m = abObject === null || abObject === void 0 ? void 0 : abObject.Rule) === null || _m === void 0 ? void 0 : _m.Predicates) === null || _o === void 0 ? void 0 : _o.length) {
27
+ const isAPredicateWithInvalidColumnId = (_q = (_p = abObject === null || abObject === void 0 ? void 0 : abObject.Rule) === null || _p === void 0 ? void 0 : _p.Predicates) === null || _q === void 0 ? void 0 : _q.some((predicate) => predicate.ColumnId !== undefined && predicate.ColumnId === '');
28
+ if (isAPredicateWithInvalidColumnId) {
29
+ return 'Predicates with custom scope need a valid column';
30
+ }
31
+ }
26
32
  return true;
27
33
  };
28
34
  exports.isAdaptableRuleValid = isAdaptableRuleValid;
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { FlexProps } from 'rebass';
3
- import type { AdaptableModule, AdaptablePredicate, AdaptablePredicateDef, AdaptableScope } from '../../../types';
3
+ import type { AdaptableColumnPredicate, AdaptableModule, AdaptablePredicateDef, AdaptableScope } from '../../../types';
4
4
  import type { XOR } from '../../../Utilities/Extensions/TypeExtensions';
5
5
  import { AdaptableQuery } from '../../../PredefinedConfig/Common/AdaptableQuery';
6
6
  export declare type RuleType = XOR<{
7
- Predicates: AdaptablePredicate[];
7
+ Predicates: AdaptableColumnPredicate[];
8
8
  }, AdaptableQuery>;
9
9
  export declare type EntityRulesEditorProps<T> = {
10
10
  data: T;
@@ -17,6 +17,8 @@ export declare type EntityRulesEditorProps<T> = {
17
17
  onChange: (data: T) => void;
18
18
  defaultPredicateId: string;
19
19
  predicateDefs: AdaptablePredicateDef[];
20
+ getPredicateDefsForColId?: (colId: string) => AdaptablePredicateDef[];
21
+ enablePredicateColumnId?: boolean;
20
22
  children?: React.ReactNode;
21
23
  descriptions: {
22
24
  selectPredicate: React.ReactNode;
@@ -9,32 +9,49 @@ const Tabs_1 = require("../../../components/Tabs");
9
9
  const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
10
10
  const ExpressionEditor_1 = require("../../../components/ExpressionEditor");
11
11
  const AdaptableContext_1 = require("../../AdaptableContext");
12
- const PredicatesEditor_1 = require("./PredicatesEditor");
12
+ const EntityRulePredicatesEditor_1 = require("./EntityRulePredicatesEditor");
13
13
  const QueryTab = (props) => {
14
14
  const { type, label, disabled = false } = props, tabProps = tslib_1.__rest(props, ["type", "label", "disabled"]);
15
15
  const text = (React.createElement(rebass_1.Flex, { flexDirection: "column" },
16
16
  label,
17
17
  " ",
18
18
  React.createElement(rebass_1.Text, { fontSize: 2 }, "query")));
19
- return (React.createElement(Tabs_1.Tabs.Tab, Object.assign({ style: { flex: 1 } }, tabProps), !disabled ? (React.createElement(Radio_1.default, { tabIndex: -1, margin: 0, checked: type === props.value, style: { alignItems: 'baseline' } }, text)) : (text)));
19
+ return (React.createElement(Tabs_1.Tabs.Tab, Object.assign({ style: { flex: 1 } }, tabProps), !disabled && props.showRadio ? (React.createElement(Radio_1.default, { tabIndex: -1, margin: 0, checked: type === props.value, style: { alignItems: 'baseline' } }, text)) : (text)));
20
20
  };
21
21
  // needed here to be considered a child Tab component, inside the Tabs component
22
22
  QueryTab.defaultProps = {
23
23
  isTabsTab: true,
24
24
  };
25
25
  const EntityRulesSummary = (props) => {
26
- var _a, _b, _c;
26
+ var _a, _b, _c, _d, _e, _f, _g, _h;
27
27
  const { data } = props;
28
28
  const { api: { predicateApi, internalApi }, } = (0, AdaptableContext_1.useAdaptable)();
29
- return (React.createElement(rebass_1.Text, { fontSize: 2 }, data.Rule.Predicates ? (React.createElement(React.Fragment, null, (_c = (_b = (_a = data.Rule) === null || _a === void 0 ? void 0 : _a.Predicates) === null || _b === void 0 ? void 0 : _b.map) === null || _c === void 0 ? void 0 : _c.call(_b, (predicate, index) => (
29
+ if (!((_b = (_a = data === null || data === void 0 ? void 0 : data.Rule) === null || _a === void 0 ? void 0 : _a.Predicates) === null || _b === void 0 ? void 0 : _b.length) &&
30
+ !((_c = data === null || data === void 0 ? void 0 : data.Rule) === null || _c === void 0 ? void 0 : _c.BooleanExpression) &&
31
+ !((_d = data === null || data === void 0 ? void 0 : data.Rule) === null || _d === void 0 ? void 0 : _d.ObservableExpression) &&
32
+ !((_e = data === null || data === void 0 ? void 0 : data.Rule) === null || _e === void 0 ? void 0 : _e.AggregatedBooleanExpression)) {
33
+ return React.createElement(rebass_1.Text, { fontSize: 2 }, "No Rule defined");
34
+ }
35
+ return (React.createElement(rebass_1.Text, { fontSize: 2 }, data.Rule.Predicates ? (React.createElement(React.Fragment, null, (_h = (_g = (_f = data.Rule) === null || _f === void 0 ? void 0 : _f.Predicates) === null || _g === void 0 ? void 0 : _g.map) === null || _h === void 0 ? void 0 : _h.call(_g, (predicate, index) => (
30
36
  // predicate id is not unique
31
37
  React.createElement(React.Fragment, { key: index }, props.renderPredicate(predicateApi.predicateToString(predicate))))))) : (React.createElement(React.Fragment, null, props.renderQueryExpression(internalApi.getAdaptableQueryExpressionText(data.Rule))))));
32
38
  };
33
39
  exports.EntityRulesSummary = EntityRulesSummary;
40
+ const RuleTabTitle = (props) => {
41
+ return props.showRadio ? (React.createElement(Radio_1.default, { tabIndex: -1, margin: 0, checked: props.checked }, props.children)) : (React.createElement(React.Fragment, null, "props.children"));
42
+ };
34
43
  const EntityRulesEditor = (props) => {
35
44
  var _a, _b, _c;
36
45
  const { data, children, descriptions, predicateDefs, showNoRule = false, showPredicate = true, showObservable = true, showBoolean = true, showAggregation = true, flexProps, module, } = props;
37
46
  const { api } = (0, AdaptableContext_1.useAdaptable)();
47
+ const numberOfTabs = [
48
+ showNoRule,
49
+ showPredicate,
50
+ showObservable,
51
+ showBoolean,
52
+ showAggregation,
53
+ ].filter(Boolean).length;
54
+ const showRadioButtons = numberOfTabs > 1;
38
55
  const type = data.Rule == undefined
39
56
  ? 'NoRule'
40
57
  : data.Rule.BooleanExpression != undefined
@@ -98,20 +115,20 @@ const EntityRulesEditor = (props) => {
98
115
  children,
99
116
  React.createElement(Tabs_1.Tabs, { onValueChange: setType, value: selectedTab, pt: 2, pl: 2, style: { flex: 1, overflow: 'auto' } },
100
117
  showNoRule ? (React.createElement(Tabs_1.Tabs.Tab, { value: 'NoRule', style: { flex: 1 } },
101
- React.createElement(Radio_1.default, { tabIndex: -1, margin: 0, checked: type === 'NoRule' }, "No Condition"))) : null,
118
+ React.createElement(RuleTabTitle, { showRadio: showRadioButtons, checked: type === 'NoRule' }, "No Condition"))) : null,
102
119
  showNoRule ? (React.createElement(Tabs_1.Tabs.Content, { value: 'NoRule' },
103
120
  React.createElement(rebass_1.Text, { fontSize: 2, mb: 2 }, 'Format Column is always applied'))) : null,
104
121
  showPredicate ? (React.createElement(Tabs_1.Tabs.Tab, { value: 'Predicate', style: { flex: 1 } },
105
- React.createElement(Radio_1.default, { tabIndex: -1, margin: 0, checked: type === 'Predicate' }, "Predicate"))) : null,
122
+ React.createElement(RuleTabTitle, { showRadio: showRadioButtons, checked: type === 'Predicate' }, "Predicate"))) : null,
106
123
  showPredicate ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "Predicate", value: "Predicate" },
107
- React.createElement(PredicatesEditor_1.PredicatesEditor, { data: data, descriptions: descriptions, predicateDefs: filteredPredicateDefs, onChange: props.onChange }))) : null,
108
- showBoolean ? React.createElement(QueryTab, { value: "BooleanExpression", type: type, label: "Boolean" }) : null,
124
+ React.createElement(EntityRulePredicatesEditor_1.EntityRulePredicatesEditor, { enablePredicateColumnId: props.enablePredicateColumnId, data: data, descriptions: descriptions, predicateDefs: filteredPredicateDefs, getPredicateDefsForColId: props.getPredicateDefsForColId, onChange: props.onChange }))) : null,
125
+ showBoolean ? (React.createElement(QueryTab, { showRadio: showRadioButtons, value: "BooleanExpression", type: type, label: "Boolean" })) : null,
109
126
  showBoolean ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "BooleanExpression", value: 'BooleanExpression', paddingLeft: 0 },
110
127
  React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'boolean', module: module, value: (_a = data.Rule) === null || _a === void 0 ? void 0 : _a.BooleanExpression, onChange: setBooleanExpression, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.queryApi.getNamedQueries(), api: api }))) : null,
111
- showObservable ? (React.createElement(QueryTab, { value: "ObservableExpression", type: type, label: "Observable" })) : null,
128
+ showObservable ? (React.createElement(QueryTab, { showRadio: showRadioButtons, value: "ObservableExpression", type: type, label: "Observable" })) : null,
112
129
  showObservable ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "ObservableExpression", value: 'ObservableExpression', paddingLeft: 0 },
113
130
  React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'observable', module: module, value: (_b = data.Rule) === null || _b === void 0 ? void 0 : _b.ObservableExpression, onChange: setReactiveExpression, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.queryApi.getNamedQueries(), api: api }))) : null,
114
- showAggregation ? (React.createElement(QueryTab, { value: "AggregatedBooleanExpression", type: type, label: "Aggregated Boolean" })) : null,
131
+ showAggregation ? (React.createElement(QueryTab, { showRadio: showRadioButtons, value: "AggregatedBooleanExpression", type: type, label: "Aggregated Boolean" })) : null,
115
132
  showAggregation ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "AggregatedBooleanExpression", value: 'AggregatedBooleanExpression', paddingLeft: 0 },
116
133
  React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'aggregatedBoolean', module: module, value: (_c = data.Rule) === null || _c === void 0 ? void 0 : _c.AggregatedBooleanExpression, onChange: setAggregationExpression, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.queryApi.getNamedQueries(), api: api }))) : null)));
117
134
  };
@@ -4,6 +4,11 @@ import { AdaptableColumn } from '../../types';
4
4
  export declare const isScopeValid: ({ Scope }: {
5
5
  Scope: AdaptableScope;
6
6
  }) => string | true;
7
+ export declare const renderScopeSummary: (scope: AdaptableScope, labels: {
8
+ scopeWholeRow: string;
9
+ scopeColumns: string;
10
+ scopeDataTypes: string;
11
+ }) => JSX.Element;
7
12
  export interface NewScopeComponentProps extends React.ClassAttributes<any> {
8
13
  scope: AdaptableScope;
9
14
  scopeColumns?: AdaptableColumn[];
@@ -14,11 +19,10 @@ export interface NewScopeComponentProps extends React.ClassAttributes<any> {
14
19
  descriptions: {
15
20
  rowScope: string;
16
21
  columnScope: string;
22
+ dataTypeScope?: string;
17
23
  };
24
+ disableDataTypes?: boolean;
25
+ disableColumns?: boolean;
26
+ isColumnAvailable?: (column: AdaptableColumn) => boolean;
18
27
  }
19
- export declare const renderScopeSummary: (scope: AdaptableScope, labels: {
20
- scopeWholeRow: string;
21
- scopeColumns: string;
22
- scopeDataTypes: string;
23
- }) => JSX.Element;
24
28
  export declare const NewScopeComponent: (props: NewScopeComponentProps) => JSX.Element;
@@ -45,7 +45,6 @@ const DATA_TYPES_MAP = {
45
45
  value: 'Boolean',
46
46
  },
47
47
  };
48
- const DATA_TYPES_OPTIONS = Object.values(DATA_TYPES_MAP);
49
48
  const renderScopeSummary = (scope, labels) => {
50
49
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
51
50
  const scopeApi = adaptable.api.scopeApi;
@@ -61,11 +60,18 @@ const renderScopeSummary = (scope, labels) => {
61
60
  React.createElement(ValueSelector_1.ValueOptionsTags, { readOnly: true, options: scope.DataTypes, value: scope.DataTypes, toLabel: (c) => c, allowWrap: true, renderLabel: (c) => React.createElement(rebass_1.Text, { fontSize: 2 }, `DataType: ${c}`), toIdentifier: (c) => c }))) : null)));
62
61
  };
63
62
  exports.renderScopeSummary = renderScopeSummary;
63
+ const DATA_TYPES_OPTIONS = Object.values(DATA_TYPES_MAP);
64
64
  const NewScopeComponent = (props) => {
65
65
  const { api } = (0, AdaptableContext_1.useAdaptable)();
66
66
  const { scopeApi, columnApi } = api;
67
67
  const [columnsSearchText, setColumnsSearchText] = (0, react_1.useState)('');
68
- const scopeColumns = props.scopeColumns || columnApi.getColumns();
68
+ const scopeColumns = React.useMemo(() => {
69
+ const allColumns = props.scopeColumns || columnApi.getColumns();
70
+ if (typeof props.isColumnAvailable === 'function') {
71
+ return allColumns.filter((c) => props.isColumnAvailable(c));
72
+ }
73
+ return allColumns;
74
+ }, []);
69
75
  const getScopeChoice = (scope) => {
70
76
  if (!scope) {
71
77
  return undefined;
@@ -131,19 +137,22 @@ const NewScopeComponent = (props) => {
131
137
  return (React.createElement(Tabs_1.Tabs, { "data-name": 'scope-component', className: "ab-ScopeComponent", value: scopeChoice, style: Object.assign({ height: '100%' }, props.style), onValueChange: onScopeSelectChanged },
132
138
  props.hideWholeRow ? null : (React.createElement(Tabs_1.Tabs.Tab, { value: "Row" },
133
139
  React.createElement(Radio_1.default, { margin: 0, checked: scopeChoice == 'All', tabIndex: -1 }, "All Columns"))),
134
- React.createElement(Tabs_1.Tabs.Tab, { value: "Column" },
135
- React.createElement(Radio_1.default, { margin: 0, value: "Column", checked: scopeChoice == 'Column', tabIndex: -1 }, "Selected Columns")),
136
- React.createElement(Tabs_1.Tabs.Tab, { value: "DataType" },
137
- React.createElement(Radio_1.default, { margin: 0, value: "DataType", checked: scopeChoice == 'DataType', tabIndex: -1 }, "Data Types")),
140
+ !props.disableColumns && (React.createElement(Tabs_1.Tabs.Tab, { value: "Column" },
141
+ React.createElement(Radio_1.default, { margin: 0, value: "Column", checked: scopeChoice == 'Column', tabIndex: -1 }, "Selected Columns"))),
142
+ !props.disableDataTypes && (React.createElement(Tabs_1.Tabs.Tab, { value: "DataType" },
143
+ React.createElement(Radio_1.default, { margin: 0, value: "DataType", checked: scopeChoice == 'DataType', tabIndex: -1 }, "Data Types"))),
138
144
  props.hideWholeRow ? null : (React.createElement(Tabs_1.Tabs.Content, { value: "Row", style: { flex: 'none' }, "data-name": "row-scope" },
139
- React.createElement(rebass_1.Text, { padding: 2, fontSize: 2 }, props.descriptions.rowScope))),
140
- React.createElement(Tabs_1.Tabs.Content, { value: "Column", style: { flex: 1, overflow: 'auto' }, "data-name": "column-scope", padding: 0 },
145
+ React.createElement(rebass_1.Text, { padding: 2, pl: 0, fontSize: 2 }, props.descriptions.rowScope))),
146
+ !props.disableColumns && (React.createElement(Tabs_1.Tabs.Content, { value: "Column", style: { flex: 1, overflow: 'auto' }, "data-name": "column-scope", padding: 0 },
141
147
  React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", padding: 2 },
142
148
  React.createElement(rebass_1.Text, { fontSize: 2 }, props.descriptions.columnScope),
143
149
  React.createElement(rebass_1.Flex, { flex: 3 }),
144
150
  React.createElement(AdaptableFormControlTextClear_1.AdaptableFormControlTextClear, { value: columnsSearchText, OnTextChange: setColumnsSearchText, placeholder: "Type to search columns", style: { flex: 1 } })),
145
151
  React.createElement(rebass_1.Flex, { paddingLeft: 2, flex: 1, style: { overflow: 'hidden' } },
146
- React.createElement(ColumnSelector_1.NewColumnSelector, { columnFilterText: columnsSearchText, allowReorder: false, availableColumns: scopeColumns, selected: scopeApi.getColumnIdsInScope(props.scope), onChange: onColumnsSelectedChanged }))),
147
- React.createElement(Tabs_1.Tabs.Content, { value: "DataType", style: { flex: 'none' }, "data-name": "datatype-scope" }, dataTypeOptions.map((dataTypeOption) => (React.createElement(CheckBox_1.CheckBox, { "data-name": "scope", "data-value": dataTypeOption.value, key: dataTypeOption.value, checked: dataTypesInScope && dataTypesInScope.includes(dataTypeOption.value), onChange: (checked) => onCheckBoxDataTypeChecked(checked, dataTypeOption.value) }, dataTypeOption.label))))));
152
+ React.createElement(ColumnSelector_1.NewColumnSelector, { columnFilterText: columnsSearchText, allowReorder: false, availableColumns: scopeColumns, selected: scopeApi.getColumnIdsInScope(props.scope), onChange: onColumnsSelectedChanged })))),
153
+ !props.disableDataTypes && (React.createElement(Tabs_1.Tabs.Content, { value: "DataType", style: { flex: 'none' }, "data-name": "datatype-scope" },
154
+ React.createElement(rebass_1.Box, null,
155
+ props.descriptions.dataTypeScope && (React.createElement(rebass_1.Text, { p: 2, pl: 0, mb: 2, fontSize: 2 }, props.descriptions.dataTypeScope)),
156
+ React.createElement(rebass_1.Flex, { flexDirection: "column" }, dataTypeOptions.map((dataTypeOption) => (React.createElement(CheckBox_1.CheckBox, { "data-name": "scope", "data-value": dataTypeOption.value, key: dataTypeOption.value, checked: dataTypesInScope && dataTypesInScope.includes(dataTypeOption.value), onChange: (checked) => onCheckBoxDataTypeChecked(checked, dataTypeOption.value) }, dataTypeOption.label)))))))));
148
157
  };
149
158
  exports.NewScopeComponent = NewScopeComponent;
@@ -18,9 +18,9 @@ const WindowPopups = () => {
18
18
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
19
19
  const dispatch = (0, react_redux_1.useDispatch)();
20
20
  const windowItems = (0, react_redux_1.useSelector)((state) => state.Popup.WindowPopup.PopupList);
21
- return (React.createElement(React.Fragment, null, windowItems === null || windowItems === void 0 ? void 0 : windowItems.map((windowItem, index) => {
21
+ return (React.createElement(React.Fragment, null, windowItems === null || windowItems === void 0 ? void 0 : windowItems.map((windowItem) => {
22
22
  var _a, _b, _c, _d, _e, _f;
23
- const Component = (_a = windowFactory_1.windowFactory[windowItem.Id]) !== null && _a !== void 0 ? _a : NoopComponent;
23
+ const Component = (_a = windowFactory_1.windowFactory[windowItem.FactoryId]) !== null && _a !== void 0 ? _a : NoopComponent;
24
24
  const _g = (_b = windowItem === null || windowItem === void 0 ? void 0 : windowItem.PopupProps) !== null && _b !== void 0 ? _b : {}, { windowModalProps } = _g, restPopupProps = tslib_1.__rest(_g, ["windowModalProps"]);
25
25
  const handleDismiss = () => {
26
26
  dispatch((0, PopupRedux_1.PopupHideWindow)(windowItem.Id));
@@ -2,4 +2,5 @@
2
2
  import { WindowPopupChildProps } from './WindowPopups';
3
3
  export declare const WINDOW_QUERY_EDITOR = "WINDOW_QUERY_EDITOR";
4
4
  export declare const SHOW_PIVOT_COLUMN_DETAILS = "SHOW_PIVOT_COLUMN_DETAILS";
5
+ export declare const SHOW_EXPORT_TABLE = "SHOW_EXPORT_TABLE";
5
6
  export declare const windowFactory: Record<string, React.FunctionComponent<WindowPopupChildProps>>;
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.windowFactory = exports.SHOW_PIVOT_COLUMN_DETAILS = exports.WINDOW_QUERY_EDITOR = void 0;
3
+ exports.windowFactory = exports.SHOW_EXPORT_TABLE = exports.SHOW_PIVOT_COLUMN_DETAILS = exports.WINDOW_QUERY_EDITOR = void 0;
4
4
  const ExpandedQueryPopup_1 = require("../../../Query/ExpandedQueryPopup");
5
5
  const PivotDetailsPopoup_1 = require("../../../Layout/PivotDetailsPopoup");
6
+ const ExportTablePopup_1 = require("../../../Export/ExportTablePopup");
6
7
  exports.WINDOW_QUERY_EDITOR = 'WINDOW_QUERY_EDITOR';
7
8
  exports.SHOW_PIVOT_COLUMN_DETAILS = 'SHOW_PIVOT_COLUMN_DETAILS';
9
+ exports.SHOW_EXPORT_TABLE = 'SHOW_EXPORT_TABLE';
8
10
  exports.windowFactory = {
9
11
  [exports.WINDOW_QUERY_EDITOR]: ExpandedQueryPopup_1.ExpandedQueryPopup,
10
12
  [exports.SHOW_PIVOT_COLUMN_DETAILS]: PivotDetailsPopoup_1.PivotDetailsPopoup,
13
+ [exports.SHOW_EXPORT_TABLE]: ExportTablePopup_1.ExportTablePopup,
11
14
  };
@@ -4,8 +4,11 @@ exports.PredicateEditor = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const rebass_1 = require("rebass");
7
+ const AdaptableIconComponent_1 = require("../../../components/AdaptableIconComponent");
7
8
  const DropdownButton_1 = tslib_1.__importDefault(require("../../../components/DropdownButton"));
8
9
  const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock"));
10
+ const icons_1 = require("../../../components/icons");
11
+ const Tag_1 = require("../../../components/Tag");
9
12
  const AdaptableInput_1 = tslib_1.__importDefault(require("../AdaptableInput"));
10
13
  const PermittedValuesSelector_1 = require("../PermittedValuesSelector");
11
14
  const isValuesPredicateDef = (colDef) => colDef && ['Values', 'ExcludeValues'].includes(colDef.id);
@@ -17,10 +20,7 @@ const PredicateEditor = (props) => {
17
20
  label: item.label,
18
21
  onClick: () => {
19
22
  var _a;
20
- props.onChange({
21
- PredicateId: item.id,
22
- Inputs: ((_a = item === null || item === void 0 ? void 0 : item.inputs) !== null && _a !== void 0 ? _a : []).map((input) => { var _a; return (_a = input.defaultValue) !== null && _a !== void 0 ? _a : ''; }),
23
- });
23
+ props.onChange(Object.assign(Object.assign({}, props.predicate), { PredicateId: item.id, Inputs: ((_a = item === null || item === void 0 ? void 0 : item.inputs) !== null && _a !== void 0 ? _a : []).map((input) => { var _a; return (_a = input.defaultValue) !== null && _a !== void 0 ? _a : ''; }) }));
24
24
  },
25
25
  })), [props.predicateDefs, props.onChange]);
26
26
  const handlePredicateInputChange = (e, index) => {
@@ -33,8 +33,19 @@ const PredicateEditor = (props) => {
33
33
  props.onChange(Object.assign(Object.assign({}, props.predicate), { Inputs: inputs }));
34
34
  };
35
35
  const currentPredicateDef = props.predicateDefs.find((item) => { var _a; return item.id === ((_a = props.predicate) === null || _a === void 0 ? void 0 : _a.PredicateId); });
36
+ let icon = null;
37
+ if (currentPredicateDef) {
38
+ if ((0, AdaptableIconComponent_1.isAdaptableInternalIcon)(currentPredicateDef === null || currentPredicateDef === void 0 ? void 0 : currentPredicateDef.icon)) {
39
+ icon = React.createElement(icons_1.Icon, { name: currentPredicateDef.icon.name });
40
+ }
41
+ else if ((currentPredicateDef === null || currentPredicateDef === void 0 ? void 0 : currentPredicateDef.icon) && 'text' in (currentPredicateDef === null || currentPredicateDef === void 0 ? void 0 : currentPredicateDef.icon)) {
42
+ icon = React.createElement("span", null, currentPredicateDef.icon.text);
43
+ }
44
+ }
36
45
  return (React.createElement(rebass_1.Box, { className: baseClassName },
37
- React.createElement(DropdownButton_1.default, { listStyle: { minWidth: 150 }, "data-name": "select-predicate", mb: 2, width: "100%", className: `${baseClassName}__predicate-dropdown`, placeholder: "Select Rule", showClearButton: !!props.predicate, onClear: props.onClear, items: predicateDefsOptions, columns: ['label'] }, currentPredicateDef ? currentPredicateDef.label : 'Select Rule'),
46
+ React.createElement(rebass_1.Flex, { justifyContent: "stretch", alignItems: "center" },
47
+ icon && React.createElement(Tag_1.Tag, { mr: 2 }, icon),
48
+ React.createElement(DropdownButton_1.default, { mb: 0, style: { flex: 1 }, listStyle: { minWidth: 150 }, "data-name": "select-predicate", className: `${baseClassName}__predicate-dropdown`, placeholder: "Select Rule", showClearButton: !!props.predicate, onClear: props.onClear, items: predicateDefsOptions, columns: ['label'] }, currentPredicateDef ? currentPredicateDef.label : 'Select Rule')),
38
49
  React.createElement(rebass_1.Flex, null, (_a = currentPredicateDef === null || currentPredicateDef === void 0 ? void 0 : currentPredicateDef.inputs) === null || _a === void 0 ? void 0 : _a.map((predicateDefInput, index) => (React.createElement(React.Fragment, null,
39
50
  index > 0 && React.createElement(HelpBlock_1.default, { margin: 2 }, "AND"),
40
51
  React.createElement(rebass_1.Flex, { key: index, flex: 1, flexDirection: "column" },
@@ -9,9 +9,36 @@ const check_1 = tslib_1.__importDefault(require("../../components/icons/check"))
9
9
  const UIHelper_1 = tslib_1.__importDefault(require("../UIHelper"));
10
10
  const Panel_1 = tslib_1.__importDefault(require("../../components/Panel"));
11
11
  const columnsMap = new Map([
12
- ['InitialValue', { field: 'InitialValue', defaultFlex: 1, header: 'Current', align: 'center' }],
13
- ['ComputedValue', { field: 'ComputedValue', defaultFlex: 1, header: 'New', align: 'center' }],
14
- ['ValidInfo', { field: 'ValidInfo', defaultWidth: 80, header: 'Valid', align: 'center' }],
12
+ [
13
+ 'InitialValue',
14
+ {
15
+ field: 'InitialValue',
16
+ defaultFlex: 1,
17
+ header: 'Current',
18
+ align: 'center',
19
+ renderMenuIcon: false,
20
+ },
21
+ ],
22
+ [
23
+ 'ComputedValue',
24
+ {
25
+ field: 'ComputedValue',
26
+ defaultFlex: 1,
27
+ header: 'New',
28
+ align: 'center',
29
+ renderMenuIcon: false,
30
+ },
31
+ ],
32
+ [
33
+ 'ValidInfo',
34
+ {
35
+ field: 'ValidInfo',
36
+ defaultWidth: 80,
37
+ header: 'Valid',
38
+ align: 'center',
39
+ renderMenuIcon: false,
40
+ },
41
+ ],
15
42
  ]);
16
43
  const tableDOMProps = {
17
44
  style: { flex: 1 },
@@ -61,7 +61,7 @@ const CustomSortWizard = (props) => {
61
61
  React.createElement(CustomSortValuesWizardSection_1.CustomSortValuesWizardSection, { onChange: setCustomSort }))),
62
62
  },
63
63
  {
64
- details: 'Select Custom Sort tags',
64
+ details: 'Select Custom Sort Tags',
65
65
  title: 'Tags',
66
66
  isVisible: (_, api) => api.internalApi.shouldDisplayTagSections(),
67
67
  render: () => (React.createElement(rebass_1.Box, { padding: 2 },