@adaptabletools/adaptable 12.1.7 → 12.1.8-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 (185) hide show
  1. package/base.css +11 -49
  2. package/bundle.cjs.js +105 -105
  3. package/index.css +13 -60
  4. package/package.json +1 -1
  5. package/publishTimestamp.d.ts +1 -1
  6. package/publishTimestamp.js +1 -1
  7. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
  8. package/src/AdaptableOptions/FilterOptions.d.ts +12 -0
  9. package/src/AdaptableOptions/FinancePluginOptions.d.ts +22 -1
  10. package/src/AdaptableOptions/StateOptions.d.ts +25 -12
  11. package/src/Api/ColumnApi.d.ts +5 -0
  12. package/src/Api/ExportApi.d.ts +5 -0
  13. package/src/Api/FilterApi.d.ts +23 -0
  14. package/src/Api/GridApi.d.ts +1 -0
  15. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  16. package/src/Api/Implementation/ColumnApiImpl.js +5 -0
  17. package/src/Api/Implementation/ExportApiImpl.d.ts +3 -1
  18. package/src/Api/Implementation/ExportApiImpl.js +19 -3
  19. package/src/Api/Implementation/FilterApiImpl.d.ts +5 -0
  20. package/src/Api/Implementation/FilterApiImpl.js +25 -2
  21. package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
  22. package/src/Api/Implementation/InternalApiImpl.d.ts +0 -1
  23. package/src/Api/Implementation/InternalApiImpl.js +0 -3
  24. package/src/Api/Implementation/PredicateApiImpl.js +4 -0
  25. package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -1
  26. package/src/Api/InternalApi.d.ts +0 -1
  27. package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -2
  28. package/src/PredefinedConfig/Common/AdaptablePredicate.js +16 -4
  29. package/src/PredefinedConfig/Common/AdaptableQuery.js +1 -1
  30. package/src/PredefinedConfig/Common/AggregationColumns.d.ts +6 -0
  31. package/src/PredefinedConfig/Common/AggregationColumns.js +4 -0
  32. package/src/PredefinedConfig/Common/ColumnFilter.d.ts +2 -2
  33. package/src/PredefinedConfig/Common/Enums.d.ts +0 -15
  34. package/src/PredefinedConfig/Common/Enums.js +1 -18
  35. package/src/PredefinedConfig/ExportState.d.ts +12 -4
  36. package/src/PredefinedConfig/LayoutState.d.ts +2 -1
  37. package/src/PredefinedConfig/PopupState.d.ts +1 -2
  38. package/src/Redux/ActionsReducers/AlertRedux.d.ts +1 -1
  39. package/src/Redux/ActionsReducers/AlertRedux.js +1 -1
  40. package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +1 -1
  41. package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +1 -1
  42. package/src/Redux/ActionsReducers/CustomSortRedux.d.ts +1 -1
  43. package/src/Redux/ActionsReducers/CustomSortRedux.js +1 -1
  44. package/src/Redux/ActionsReducers/FlashingCellRedux.d.ts +1 -1
  45. package/src/Redux/ActionsReducers/FlashingCellRedux.js +1 -1
  46. package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +1 -1
  47. package/src/Redux/ActionsReducers/FormatColumnRedux.js +1 -1
  48. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +28 -0
  49. package/src/Redux/ActionsReducers/LayoutRedux.js +80 -2
  50. package/src/Redux/ActionsReducers/PlusMinusRedux.d.ts +1 -1
  51. package/src/Redux/ActionsReducers/PlusMinusRedux.js +1 -1
  52. package/src/Redux/ActionsReducers/PopupRedux.d.ts +0 -2
  53. package/src/Redux/ActionsReducers/PopupRedux.js +1 -28
  54. package/src/Redux/ActionsReducers/ScheduleRedux.d.ts +5 -5
  55. package/src/Redux/ActionsReducers/ScheduleRedux.js +5 -5
  56. package/src/Redux/ActionsReducers/ShortcutRedux.d.ts +1 -1
  57. package/src/Redux/ActionsReducers/ShortcutRedux.js +1 -1
  58. package/src/Redux/Store/AdaptableStore.js +15 -6
  59. package/src/Strategy/AlertModule.d.ts +1 -0
  60. package/src/Strategy/AlertModule.js +20 -0
  61. package/src/Strategy/CalculatedColumnModule.js +2 -2
  62. package/src/Strategy/ExportModule.d.ts +0 -1
  63. package/src/Strategy/ExportModule.js +0 -16
  64. package/src/Strategy/FilterModule.js +6 -0
  65. package/src/Strategy/Interface/IModule.d.ts +4 -0
  66. package/src/Strategy/LayoutModule.js +20 -20
  67. package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +16 -1
  68. package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +15 -11
  69. package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
  70. package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
  71. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +2 -0
  72. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +12 -2
  73. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +30 -66
  74. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +22 -6
  75. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +423 -220
  76. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +7 -1
  77. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +23 -7
  78. package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.d.ts +0 -1
  79. package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +6 -54
  80. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +17 -5
  81. package/src/Utilities/Interface/MessagePopups.d.ts +0 -4
  82. package/src/Utilities/ObjectFactory.d.ts +4 -2
  83. package/src/Utilities/ObjectFactory.js +16 -3
  84. package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +25 -0
  85. package/src/Utilities/Services/AggregatedScalarLiveValue.js +103 -0
  86. package/src/Utilities/Services/AlertService.d.ts +0 -1
  87. package/src/Utilities/Services/AlertService.js +5 -17
  88. package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +4 -4
  89. package/src/Utilities/Services/CalculatedColumnExpressionService.js +29 -154
  90. package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +2 -2
  91. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +6 -3
  92. package/src/Utilities/Services/QueryLanguageService.d.ts +6 -3
  93. package/src/Utilities/Services/QueryLanguageService.js +23 -6
  94. package/src/Utilities/Services/ReportService.js +47 -46
  95. package/src/View/AdaptableView.js +1 -2
  96. package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingsTags.d.ts +2 -0
  97. package/src/View/CalculatedColumn/Utilities/{getCalculatedColumnSettingTags.js → getCalculatedColumnSettingsTags.js} +3 -3
  98. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.d.ts +10 -0
  99. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +80 -0
  100. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +20 -11
  101. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.d.ts +1 -2
  102. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +9 -52
  103. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +17 -6
  104. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +42 -6
  105. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
  106. package/src/View/Components/EntityRulesEditor/index.js +26 -5
  107. package/src/View/Components/FilterForm/FilterForm.js +8 -4
  108. package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -0
  109. package/src/View/Components/FilterForm/QuickFilterForm.js +10 -6
  110. package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.d.ts +9 -0
  111. package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.js +28 -0
  112. package/src/View/Components/PermittedValuesSelector/index.d.ts +1 -0
  113. package/src/View/Components/PermittedValuesSelector/index.js +5 -0
  114. package/src/View/Components/Popups/AdaptablePopup/Navigation.js +2 -2
  115. package/src/View/Components/Popups/AdaptableToaster.js +2 -7
  116. package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
  117. package/src/View/Components/Popups/WindowPopups/windowFactory.js +1 -4
  118. package/src/View/Export/ExportViewPanel.d.ts +1 -2
  119. package/src/View/Export/ExportViewPanel.js +2 -6
  120. package/src/View/Export/Wizard/ReportColumnTypeWizard.d.ts +1 -2
  121. package/src/View/Export/Wizard/ReportColumnTypeWizard.js +11 -12
  122. package/src/View/Export/Wizard/ReportRowTypeWizard.d.ts +1 -2
  123. package/src/View/Export/Wizard/ReportRowTypeWizard.js +12 -13
  124. package/src/View/Export/Wizard/ReportSettingsWizard.js +1 -2
  125. package/src/View/Filter/FilterViewPanel.js +20 -4
  126. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
  127. package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.d.ts +0 -0
  128. package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.js +0 -0
  129. package/src/View/Layout/Wizard/LayoutWizard.js +1 -0
  130. package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +1 -0
  131. package/src/View/Layout/Wizard/sections/AggregationsSection.js +69 -8
  132. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  133. package/src/View/Query/QueryViewPanel.js +1 -1
  134. package/src/agGrid/Adaptable.d.ts +10 -3
  135. package/src/agGrid/Adaptable.js +211 -142
  136. package/src/agGrid/agGridHelper.d.ts +1 -0
  137. package/src/agGrid/agGridHelper.js +5 -3
  138. package/src/agGrid/agGridMenuHelper.d.ts +1 -0
  139. package/src/agGrid/agGridMenuHelper.js +4 -2
  140. package/src/agGrid/weightedAverage.d.ts +6 -0
  141. package/src/agGrid/weightedAverage.js +66 -0
  142. package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -0
  143. package/src/components/ExpressionEditor/BaseEditorInput.js +2 -3
  144. package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
  145. package/src/components/ExpressionEditor/EditorInput.js +24 -4
  146. package/src/components/ExpressionEditor/{EditorInputReactive.d.ts → EditorInputWithWhereClause.d.ts} +3 -3
  147. package/src/components/ExpressionEditor/{EditorInputReactive.js → EditorInputWithWhereClause.js} +6 -5
  148. package/src/components/ExpressionEditor/editorButtonsAggregatedBoolean.d.ts +2 -0
  149. package/src/components/ExpressionEditor/{editorButtonsReactive.js → editorButtonsAggregatedBoolean.js} +22 -37
  150. package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
  151. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.d.ts +2 -0
  152. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +50 -0
  153. package/src/components/ExpressionEditor/editorButtonsObservable.d.ts +2 -0
  154. package/src/components/ExpressionEditor/editorButtonsObservable.js +40 -0
  155. package/src/components/ExpressionEditor/index.d.ts +1 -1
  156. package/src/components/ExpressionEditor/index.js +26 -5
  157. package/src/metamodel/adaptable.metamodel.d.ts +55 -1
  158. package/src/metamodel/adaptable.metamodel.js +1 -1
  159. package/src/types.d.ts +3 -3
  160. package/version.d.ts +1 -1
  161. package/version.js +1 -1
  162. package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingTags.d.ts +0 -2
  163. package/src/View/Layout/LayoutEditorStandalonePopup.d.ts +0 -3
  164. package/src/View/Layout/LayoutEditorStandalonePopup.js +0 -78
  165. package/src/View/Layout/Wizard/LayoutEditor/ColumnList.d.ts +0 -27
  166. package/src/View/Layout/Wizard/LayoutEditor/ColumnList.js +0 -86
  167. package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.d.ts +0 -16
  168. package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.js +0 -89
  169. package/src/View/Layout/Wizard/LayoutEditor/PivotList.d.ts +0 -15
  170. package/src/View/Layout/Wizard/LayoutEditor/PivotList.js +0 -70
  171. package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.d.ts +0 -15
  172. package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.js +0 -70
  173. package/src/View/Layout/Wizard/LayoutEditor/droppableIds.d.ts +0 -7
  174. package/src/View/Layout/Wizard/LayoutEditor/droppableIds.js +0 -11
  175. package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.d.ts +0 -6
  176. package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.js +0 -26
  177. package/src/View/Layout/Wizard/LayoutEditor/index.d.ts +0 -9
  178. package/src/View/Layout/Wizard/LayoutEditor/index.js +0 -367
  179. package/src/View/Layout/Wizard/LayoutEditor/reducer.d.ts +0 -28
  180. package/src/View/Layout/Wizard/LayoutEditor/reducer.js +0 -46
  181. package/src/View/Layout/Wizard/LayoutEditor/utils.d.ts +0 -10
  182. package/src/View/Layout/Wizard/LayoutEditor/utils.js +0 -14
  183. package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +0 -30
  184. package/src/View/Layout/Wizard/LayoutEditorWizard.js +0 -132
  185. package/src/components/ExpressionEditor/editorButtonsReactive.d.ts +0 -2
@@ -25,7 +25,7 @@ class AdaptableView extends React.Component {
25
25
  this.props.AdaptableApi.internalApi.getModuleService().isModuleAvailable('Dashboard') && (React.createElement(Dashboard_1.Dashboard, { api: this.props.AdaptableApi })),
26
26
  React.createElement(AdaptableLoadingScreen_1.AdaptableLoadingScreen, { onClose: this.props.onCloseLoadingPopup, showLoadingScreen: this.props.PopupState.LoadingPopup.ShowLoadingPopup }),
27
27
  this.props.PopupState.PromptPopup.ShowPromptPopup && (React.createElement(AdaptablePopupPrompt_1.AdaptablePopupPrompt, { message: this.props.PopupState.PromptPopup.Message, header: this.props.PopupState.PromptPopup.Header, onClose: this.props.onClosePromptPopup, onConfirm: this.props.onConfirmPromptPopup, onConfirmActionCreator: this.props.PopupState.PromptPopup.ConfirmActionCreator, defaultValue: this.props.PopupState.PromptPopup.DefaultValue })),
28
- React.createElement(AdaptablePopupConfirmation_1.AdaptablePopupConfirmation, { header: this.props.PopupState.ConfirmationPopup.Header, messsage: this.props.PopupState.ConfirmationPopup.Msg, showPopup: this.props.PopupState.ConfirmationPopup.ShowConfirmationPopup, cancelButtonText: this.props.PopupState.ConfirmationPopup.CancelButtonText, confirmButtonText: this.props.PopupState.ConfirmationPopup.ConfirmButtonText, onCancel: this.props.onCancelConfirmationPopup, onConfirm: this.props.onConfirmConfirmationPopup, showInputBox: this.props.PopupState.ConfirmationPopup.ShowInputBox, messageType: this.props.PopupState.ConfirmationPopup.MessageType, api: this.props.AdaptableApi }),
28
+ Boolean(this.props.PopupState.ConfirmationPopup.ShowConfirmationPopup) && (React.createElement(AdaptablePopupConfirmation_1.AdaptablePopupConfirmation, { header: this.props.PopupState.ConfirmationPopup.Header, messsage: this.props.PopupState.ConfirmationPopup.Msg, showPopup: this.props.PopupState.ConfirmationPopup.ShowConfirmationPopup, cancelButtonText: this.props.PopupState.ConfirmationPopup.CancelButtonText, confirmButtonText: this.props.PopupState.ConfirmationPopup.ConfirmButtonText, onCancel: this.props.onCancelConfirmationPopup, onConfirm: this.props.onConfirmConfirmationPopup, showInputBox: this.props.PopupState.ConfirmationPopup.ShowInputBox, messageType: this.props.PopupState.ConfirmationPopup.MessageType, api: this.props.AdaptableApi })),
29
29
  Boolean(this.props.PopupState.ScreenPopup.ShowScreenPopup) && (React.createElement(AdaptablePopup_1.AdaptablePopup, { componentName: this.props.PopupState.ScreenPopup.ComponentName, componentModule: this.props.PopupState.ScreenPopup.ComponentModule, onHide: this.props.onCloseScreenPopup, api: this.props.AdaptableApi, onClearParams: () => this.props.onClearPopupParams(), moduleParams: this.props.PopupState.ScreenPopup.Params, moduleProps: this.props.PopupState.ScreenPopup.PopupProps })),
30
30
  React.createElement(Toastify_1.ToastContainer
31
31
  // we NEEEEED!!!! this containerId, otherwise, toastify will have memory leaks when the adaptable
@@ -50,7 +50,6 @@ function mapStateToProps(state, ownProps) {
50
50
  function mapDispatchToProps(dispatch) {
51
51
  return {
52
52
  onCloseScreenPopup: () => dispatch(PopupRedux.PopupHideScreen()),
53
- onCloseAlertPopup: () => dispatch(PopupRedux.PopupHideAlert()),
54
53
  onClosePromptPopup: () => dispatch(PopupRedux.PopupHidePrompt()),
55
54
  onConfirmPromptPopup: (inputText) => dispatch(PopupRedux.PopupConfirmPrompt(inputText)),
56
55
  onConfirmConfirmationPopup: (comment) => dispatch(PopupRedux.PopupConfirmConfirmation(comment)),
@@ -0,0 +1,2 @@
1
+ import { CalculatedColumnSettings } from '../../../types';
2
+ export declare const getCalculatedColumnSettingsTags: (settings: CalculatedColumnSettings) => string[];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCalculatedColumnSettingTags = void 0;
4
- const getCalculatedColumnSettingTags = (settings) => {
3
+ exports.getCalculatedColumnSettingsTags = void 0;
4
+ const getCalculatedColumnSettingsTags = (settings) => {
5
5
  const { DataType, Width, Filterable, Resizable, Groupable, Sortable, Pivotable, Aggregatable } = settings !== null && settings !== void 0 ? settings : {};
6
6
  const colTypes = (settings === null || settings === void 0 ? void 0 : settings.ColumnTypes) ? settings.ColumnTypes.join(', ') : '';
7
7
  return [
@@ -16,4 +16,4 @@ const getCalculatedColumnSettingTags = (settings) => {
16
16
  colTypes ? `Column Types: ${colTypes}` : null,
17
17
  ].filter(Boolean);
18
18
  };
19
- exports.getCalculatedColumnSettingTags = getCalculatedColumnSettingTags;
19
+ exports.getCalculatedColumnSettingsTags = getCalculatedColumnSettingsTags;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { AdaptableApi } from '../../../Api/AdaptableApi';
3
+ import { CalculatedColumn } from '../../../PredefinedConfig/CalculatedColumnState';
4
+ export declare type CalculatedColumnDefinitionWizardSectionProps = {
5
+ onChange: (data: CalculatedColumn) => void;
6
+ isEdit: boolean;
7
+ };
8
+ export declare const renderCalculatedColumnDefinitionSummary: (data: CalculatedColumn) => JSX.Element;
9
+ export declare const isValidCalculatedColumnDefinition: (data: CalculatedColumn, api: AdaptableApi) => true | string;
10
+ export declare const CalculatedColumnDefinitionWizardSection: (props: CalculatedColumnDefinitionWizardSectionProps) => JSX.Element;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CalculatedColumnDefinitionWizardSection = exports.isValidCalculatedColumnDefinition = exports.renderCalculatedColumnDefinitionSummary = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const react_1 = require("react");
7
+ const rebass_1 = require("rebass");
8
+ const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
9
+ const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
10
+ const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
11
+ const CheckBox_1 = require("../../../components/CheckBox");
12
+ const ErrorBox_1 = tslib_1.__importDefault(require("../../../components/ErrorBox"));
13
+ const Tabs_1 = require("../../../components/Tabs");
14
+ const Tag_1 = require("../../../components/Tag");
15
+ const renderCalculatedColumnDefinitionSummary = (data) => {
16
+ var _a;
17
+ return (React.createElement(rebass_1.Box, { fontSize: 2 },
18
+ React.createElement(rebass_1.Box, null,
19
+ "Column Identifier: ",
20
+ React.createElement(Tag_1.Tag, null, data.ColumnId)),
21
+ data.FriendlyName ? (React.createElement(rebass_1.Box, { mt: 3 },
22
+ "Column Name: ",
23
+ React.createElement(Tag_1.Tag, null, (_a = data.FriendlyName) !== null && _a !== void 0 ? _a : data.ColumnId))) : null));
24
+ };
25
+ exports.renderCalculatedColumnDefinitionSummary = renderCalculatedColumnDefinitionSummary;
26
+ const isValidCalculatedColumnDefinition = (data, api) => {
27
+ const columns = api.columnApi.getColumns();
28
+ if (!data.ColumnId) {
29
+ return 'Column Id cannot be empty';
30
+ }
31
+ const columnsWithSameIdCount = columns.filter((c) => c.columnId === data.ColumnId).length;
32
+ const hasAlreadyExistingId = data.Uuid ? columnsWithSameIdCount > 1 : columnsWithSameIdCount > 0;
33
+ return hasAlreadyExistingId ? 'A Column already exists with that id' : true;
34
+ };
35
+ exports.isValidCalculatedColumnDefinition = isValidCalculatedColumnDefinition;
36
+ const CalculatedColumnDefinitionWizardSection = (props) => {
37
+ var _a;
38
+ const { data, api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
39
+ const handleColumnIdChange = (event) => {
40
+ let e = event.target;
41
+ props.onChange(Object.assign(Object.assign({}, data), { ColumnId: e.value }));
42
+ };
43
+ const handleColumnNameChange = (event) => {
44
+ let e = event.target;
45
+ props.onChange(Object.assign(Object.assign({}, data), { FriendlyName: e.value }));
46
+ };
47
+ const inEdit = props.isEdit;
48
+ const validCheck = exports.isValidCalculatedColumnDefinition(data, api);
49
+ const ErrorMessage = validCheck === true ? null : validCheck;
50
+ const [ColumnNameFocused, setColumnNameFocused] = react_1.useState(false);
51
+ const ColumnName = data.FriendlyName;
52
+ const ColumnId = data.ColumnId;
53
+ const { ShowToolTip, HeaderToolTip } = (_a = data.CalculatedColumnSettings) !== null && _a !== void 0 ? _a : {};
54
+ const handleSpecialColumnSettingsChange = (settings) => {
55
+ props.onChange(Object.assign(Object.assign({}, data), { CalculatedColumnSettings: Object.assign(Object.assign({}, data.CalculatedColumnSettings), settings) }));
56
+ };
57
+ return (React.createElement(rebass_1.Box, { "data-name": 'calculated-column-definition' },
58
+ React.createElement(Tabs_1.Tabs, { autoFocus: false },
59
+ React.createElement(Tabs_1.Tabs.Tab, null, "Column Details"),
60
+ React.createElement(Tabs_1.Tabs.Content, null,
61
+ React.createElement(rebass_1.Flex, { flexDirection: "row" },
62
+ React.createElement(FormLayout_1.default, null,
63
+ React.createElement(FormLayout_1.FormRow, { label: "Column Id" },
64
+ React.createElement(Input_1.default, { "data-name": "column-id", value: data.ColumnId || '', width: 300, autoFocus: !inEdit, disabled: inEdit, type: "text", placeholder: "Enter an Id for the column", onChange: handleColumnIdChange })),
65
+ React.createElement(FormLayout_1.FormRow, { label: "Name" },
66
+ React.createElement(Input_1.default, { "data-name": "column-name", autoFocus: inEdit, onFocus: () => {
67
+ setColumnNameFocused(true);
68
+ }, onBlur: () => {
69
+ setColumnNameFocused(false);
70
+ }, value: ColumnNameFocused ? ColumnName || '' : ColumnName || ColumnId || '', width: 300, type: "text", placeholder: "Enter column name", onChange: handleColumnNameChange })),
71
+ React.createElement(FormLayout_1.FormRow, { label: "Header Tooltip" },
72
+ React.createElement(Input_1.default, { "data-name": "header-tooltip", type: "text", width: 300, value: HeaderToolTip, onChange: (e) => handleSpecialColumnSettingsChange({
73
+ HeaderToolTip: e.target.value,
74
+ }) })),
75
+ ' ',
76
+ React.createElement(FormLayout_1.FormRow, { label: "" },
77
+ React.createElement(CheckBox_1.CheckBox, { "data-name": "column-show-tooltip", onChange: (checked) => handleSpecialColumnSettingsChange({ ShowToolTip: checked }), checked: ShowToolTip }, "Show Expression as Cell Tooltip")))))),
78
+ ErrorMessage ? React.createElement(ErrorBox_1.default, { marginTop: 2 }, ErrorMessage) : null));
79
+ };
80
+ exports.CalculatedColumnDefinitionWizardSection = CalculatedColumnDefinitionWizardSection;
@@ -46,18 +46,24 @@ QueryTab.defaultProps = {
46
46
  const CalculatedColumnExpressionWizardSection = (props) => {
47
47
  const { api, data, moduleInfo } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
48
48
  const initialData = react_1.useMemo(() => api.internalApi.getQueryPreviewData(), []);
49
- const type = data.Query.AggregatedScalarExpression != undefined
50
- ? 'AggregatedScalarExpression'
51
- : 'ScalarExpression';
52
- const [selectedTab, setSelectedTab] = React.useState(type);
53
- const setType = (type) => {
54
- setSelectedTab(type);
55
- if (type === 'ScalarExpression') {
49
+ const [selectedTab, setSelectedTab] = React.useState(() => {
50
+ return data.Query.AggregatedScalarExpression == undefined
51
+ ? 'ScalarExpression'
52
+ : api.internalApi
53
+ .getQueryLanguageService()
54
+ .isCumulativeAggregate(data.Query.AggregatedScalarExpression)
55
+ ? 'CumulativeAggregateExpression'
56
+ : 'AggregatedScalarExpression';
57
+ });
58
+ const updateExpressionType = (expressionType) => {
59
+ setSelectedTab(expressionType);
60
+ if (expressionType === 'ScalarExpression') {
56
61
  props.onChange(Object.assign(Object.assign({}, data), { Query: {
57
62
  ScalarExpression: '',
58
63
  } }));
59
64
  }
60
65
  else {
66
+ // CumulativeAggregateExpression & AggregatedScalarExpression use the same property
61
67
  props.onChange(Object.assign(Object.assign({}, data), { Query: {
62
68
  AggregatedScalarExpression: '',
63
69
  } }));
@@ -68,12 +74,15 @@ const CalculatedColumnExpressionWizardSection = (props) => {
68
74
  const dataType = calculatedColumnExpressionService.getCalculatedColumnDataType(calculatedColumnQuery);
69
75
  props.onChange(Object.assign(Object.assign({}, data), { Query: calculatedColumnQuery, CalculatedColumnSettings: Object.assign(Object.assign({}, data.CalculatedColumnSettings), { DataType: dataType }) }));
70
76
  };
71
- return (React.createElement(Tabs_1.Tabs, { onValueChange: setType, value: selectedTab, p: 2, style: { height: '100%', flex: 1, overflow: 'auto' } },
72
- React.createElement(QueryTab, { value: "ScalarExpression", type: type, label: "Scalar" }),
77
+ return (React.createElement(Tabs_1.Tabs, { onValueChange: updateExpressionType, value: selectedTab, p: 2, style: { height: '100%', flex: 1, overflow: 'auto' } },
78
+ React.createElement(QueryTab, { value: "ScalarExpression", type: selectedTab, label: "Scalar" }),
73
79
  React.createElement(Tabs_1.Tabs.Content, { value: 'ScalarExpression' },
74
80
  React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'scalar', module: moduleInfo.ModuleName, style: { paddingLeft: 0 }, value: data.Query.ScalarExpression, onChange: (ScalarExpression) => setCalculatedColumnExpression({ ScalarExpression }), initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.queryApi.getAllNamedQuery(), isFullExpression: true, api: api })),
75
- React.createElement(QueryTab, { value: "AggregatedScalarExpression", type: type, label: "AggregatedScalar" }),
81
+ React.createElement(QueryTab, { value: "AggregatedScalarExpression", type: selectedTab, label: "AggregatedScalar" }),
76
82
  React.createElement(Tabs_1.Tabs.Content, { value: 'AggregatedScalarExpression' },
77
- React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'aggregatedScalar', module: moduleInfo.ModuleName, style: { paddingLeft: 0 }, value: data.Query.AggregatedScalarExpression, onChange: (AggregatedScalarExpression) => setCalculatedColumnExpression({ AggregatedScalarExpression }), initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.queryApi.getAllNamedQuery(), isFullExpression: true, api: api }))));
83
+ React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'aggregatedScalar', module: moduleInfo.ModuleName, style: { paddingLeft: 0 }, value: data.Query.AggregatedScalarExpression, onChange: (AggregatedScalarExpression) => setCalculatedColumnExpression({ AggregatedScalarExpression }), initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.queryApi.getAllNamedQuery(), isFullExpression: true, api: api })),
84
+ React.createElement(QueryTab, { value: "CumulativeAggregateExpression", type: selectedTab, label: "CumulativeAggregatedScalar" }),
85
+ React.createElement(Tabs_1.Tabs.Content, { value: 'CumulativeAggregateExpression' },
86
+ React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'cumulativeAggregatedScalar', module: moduleInfo.ModuleName, style: { paddingLeft: 0 }, value: data.Query.AggregatedScalarExpression, onChange: (AggregatedScalarExpression) => setCalculatedColumnExpression({ AggregatedScalarExpression }), initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.queryApi.getAllNamedQuery(), isFullExpression: true, api: api }))));
78
87
  };
79
88
  exports.CalculatedColumnExpressionWizardSection = CalculatedColumnExpressionWizardSection;
@@ -1,10 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { AdaptableApi } from '../../../Api/AdaptableApi';
3
2
  import { CalculatedColumn } from '../../../PredefinedConfig/CalculatedColumnState';
4
3
  export declare type CalculatedColumnSettingsWizardSectionProps = {
5
4
  onChange: (data: CalculatedColumn) => void;
6
5
  isEdit: boolean;
7
6
  };
8
7
  export declare const renderCalculatedColumnSettingsSummary: (data: CalculatedColumn) => JSX.Element;
9
- export declare const isValidCalculatedColumnSettings: (data: CalculatedColumn, api: AdaptableApi) => true | string;
8
+ export declare const isValidCalculatedColumnSettings: (data: CalculatedColumn) => true | string;
10
9
  export declare const CalculatedColumnSettingsWizardSection: (props: CalculatedColumnSettingsWizardSectionProps) => JSX.Element;
@@ -3,66 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CalculatedColumnSettingsWizardSection = exports.isValidCalculatedColumnSettings = exports.renderCalculatedColumnSettingsSummary = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
+ const react_1 = require("react");
6
7
  const rebass_1 = require("rebass");
7
8
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
8
9
  const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
9
10
  const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
10
- const react_1 = require("react");
11
11
  const DropdownButton_1 = tslib_1.__importDefault(require("../../../components/DropdownButton"));
12
- const CheckBox_1 = require("../../../components/CheckBox");
13
12
  const ErrorBox_1 = tslib_1.__importDefault(require("../../../components/ErrorBox"));
14
13
  const Tabs_1 = require("../../../components/Tabs");
15
14
  const ValueSelector_1 = require("../../Components/ValueSelector");
16
- const Tag_1 = require("../../../components/Tag");
17
- const getCalculatedColumnSettingTags_1 = require("../Utilities/getCalculatedColumnSettingTags");
18
15
  const SpecialColumnSettingsWizardStep_1 = require("../../SpecialColumnSettingsWizardStep");
16
+ const getCalculatedColumnSettingsTags_1 = require("../Utilities/getCalculatedColumnSettingsTags");
19
17
  const renderCalculatedColumnSettingsSummary = (data) => {
20
- var _a;
21
- const options = getCalculatedColumnSettingTags_1.getCalculatedColumnSettingTags(data.CalculatedColumnSettings);
18
+ const options = getCalculatedColumnSettingsTags_1.getCalculatedColumnSettingsTags(data.CalculatedColumnSettings);
22
19
  return (React.createElement(rebass_1.Box, { fontSize: 2 },
23
- React.createElement(rebass_1.Box, null,
24
- "Column Identifier: ",
25
- React.createElement(Tag_1.Tag, null, data.ColumnId)),
26
- data.FriendlyName ? (React.createElement(rebass_1.Box, { mt: 3 },
27
- "Column Name: ",
28
- React.createElement(Tag_1.Tag, null, (_a = data.FriendlyName) !== null && _a !== void 0 ? _a : data.ColumnId))) : null,
29
- React.createElement(rebass_1.Box, { mb: 3 }),
30
20
  React.createElement(ValueSelector_1.ValueOptionsTags, { toLabel: (x) => x, toIdentifier: (c) => c, readOnly: true, options: options, value: options })));
31
21
  };
32
22
  exports.renderCalculatedColumnSettingsSummary = renderCalculatedColumnSettingsSummary;
33
- const isValidCalculatedColumnSettings = (data, api) => {
23
+ const isValidCalculatedColumnSettings = (data) => {
34
24
  var _a;
35
- const columns = api.columnApi.getColumns();
36
- if (!data.ColumnId) {
37
- return 'Column Id cannot be empty';
38
- }
39
25
  if (!((_a = data.CalculatedColumnSettings) === null || _a === void 0 ? void 0 : _a.DataType)) {
40
26
  return 'No data type is specified and it could not be inferred from the defined expression';
41
27
  }
42
- const columnsWithSameIdCount = columns.filter((c) => c.columnId === data.ColumnId).length;
43
- const hasAlreadyExistingId = data.Uuid ? columnsWithSameIdCount > 1 : columnsWithSameIdCount > 0;
44
- return hasAlreadyExistingId ? 'A Column already exists with that id' : true;
28
+ return true;
45
29
  };
46
30
  exports.isValidCalculatedColumnSettings = isValidCalculatedColumnSettings;
47
31
  const CalculatedColumnSettingsWizardSection = (props) => {
48
32
  var _a, _b;
49
33
  const { data, api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
50
34
  const calculatedColumnExpressionService = react_1.useMemo(() => api.internalApi.getCalculatedColumnExpressionService(), []);
51
- const handleColumnIdChange = (event) => {
52
- let e = event.target;
53
- props.onChange(Object.assign(Object.assign({}, data), { ColumnId: e.value }));
54
- };
55
- const handleColumnNameChange = (event) => {
56
- let e = event.target;
57
- props.onChange(Object.assign(Object.assign({}, data), { FriendlyName: e.value }));
58
- };
59
35
  const handleDataTypeChange = (dataType) => {
60
36
  var _a;
61
37
  const aggregatable = dataType == 'Number' ? (_a = data.CalculatedColumnSettings) === null || _a === void 0 ? void 0 : _a.Aggregatable : false;
62
38
  props.onChange(Object.assign(Object.assign({}, data), { CalculatedColumnSettings: Object.assign(Object.assign({}, data.CalculatedColumnSettings), { DataType: dataType, Aggregatable: aggregatable }) }));
63
39
  };
64
- const inEdit = props.isEdit;
65
- const validCheck = exports.isValidCalculatedColumnSettings(data, api);
40
+ const validCheck = exports.isValidCalculatedColumnSettings(data);
66
41
  const ErrorMessage = validCheck === true ? null : validCheck;
67
42
  let options = [
68
43
  { value: 'Number', label: 'Number' },
@@ -70,11 +45,8 @@ const CalculatedColumnSettingsWizardSection = (props) => {
70
45
  { value: 'Date', label: 'Date' },
71
46
  { value: 'Boolean', label: 'Boolean' },
72
47
  ];
73
- const [ColumnNameFocused, setColumnNameFocused] = react_1.useState(false);
74
- const ColumnName = data.FriendlyName;
75
- const ColumnId = data.ColumnId;
76
48
  let { DataType: dataType } = (_a = data.CalculatedColumnSettings) !== null && _a !== void 0 ? _a : {};
77
- const { Width, ShowToolTip, HeaderToolTip } = (_b = data.CalculatedColumnSettings) !== null && _b !== void 0 ? _b : {};
49
+ const { Width } = (_b = data.CalculatedColumnSettings) !== null && _b !== void 0 ? _b : {};
78
50
  const handleSpecialColumnSettingsChange = (settings) => {
79
51
  props.onChange(Object.assign(Object.assign({}, data), { CalculatedColumnSettings: Object.assign(Object.assign({}, data.CalculatedColumnSettings), settings) }));
80
52
  };
@@ -86,18 +58,10 @@ const CalculatedColumnSettingsWizardSection = (props) => {
86
58
  }, []);
87
59
  return (React.createElement(rebass_1.Box, { "data-name": 'calculated-column-settings' },
88
60
  React.createElement(Tabs_1.Tabs, { autoFocus: false },
89
- React.createElement(Tabs_1.Tabs.Tab, null, "Column Details"),
61
+ React.createElement(Tabs_1.Tabs.Tab, null, "Column Settings"),
90
62
  React.createElement(Tabs_1.Tabs.Content, null,
91
63
  React.createElement(rebass_1.Flex, { flexDirection: "row" },
92
64
  React.createElement(FormLayout_1.default, null,
93
- React.createElement(FormLayout_1.FormRow, { label: "Column Id" },
94
- React.createElement(Input_1.default, { "data-name": "column-id", value: data.ColumnId || '', width: 300, autoFocus: !inEdit, disabled: inEdit, type: "text", placeholder: "Enter an Id for the column", onChange: handleColumnIdChange })),
95
- React.createElement(FormLayout_1.FormRow, { label: "Name" },
96
- React.createElement(Input_1.default, { "data-name": "column-name", autoFocus: inEdit, onFocus: () => {
97
- setColumnNameFocused(true);
98
- }, onBlur: () => {
99
- setColumnNameFocused(false);
100
- }, value: ColumnNameFocused ? ColumnName || '' : ColumnName || ColumnId || '', width: 300, type: "text", placeholder: "Enter column name", onChange: handleColumnNameChange })),
101
65
  React.createElement(FormLayout_1.FormRow, { label: "Data Type" },
102
66
  React.createElement(DropdownButton_1.default, { "data-name": "column-type", style: {
103
67
  width: '300px',
@@ -112,14 +76,7 @@ const CalculatedColumnSettingsWizardSection = (props) => {
112
76
  React.createElement(FormLayout_1.FormRow, { label: "Width" },
113
77
  React.createElement(Input_1.default, { "data-name": "column-width", type: "number", width: 300, value: Width || '', onChange: (e) => handleSpecialColumnSettingsChange({
114
78
  Width: Number(e.target.value),
115
- }) })),
116
- React.createElement(FormLayout_1.FormRow, { label: "Header Tooltip" },
117
- React.createElement(Input_1.default, { "data-name": "header-tooltip", type: "text", width: 300, value: HeaderToolTip, onChange: (e) => handleSpecialColumnSettingsChange({
118
- HeaderToolTip: e.target.value,
119
- }) })),
120
- ' ',
121
- React.createElement(FormLayout_1.FormRow, { label: "" },
122
- React.createElement(CheckBox_1.CheckBox, { "data-name": "column-show-tooltip", onChange: (checked) => handleSpecialColumnSettingsChange({ ShowToolTip: checked }), checked: ShowToolTip }, "Show Expression as Cell Tooltip")))))),
79
+ }) })))))),
123
80
  ErrorMessage ? React.createElement(ErrorBox_1.default, { marginTop: 2 }, ErrorMessage) : null,
124
81
  React.createElement(SpecialColumnSettingsWizardStep_1.SpecialColumnSettingsWizardStep, { isEditable: false, settings: data.CalculatedColumnSettings, onChange: handleSpecialColumnSettingsChange })));
125
82
  };
@@ -8,12 +8,13 @@ const Helper_1 = require("../../../Utilities/Helpers/Helper");
8
8
  const react_1 = require("react");
9
9
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
10
10
  const CalculatedColumnExpressionWizardSection_1 = require("./CalculatedColumnExpressionWizardSection");
11
- const CalculatedColumnSettingsWizardSection_1 = require("./CalculatedColumnSettingsWizardSection");
11
+ const CalculatedColumnDefinitionWizardSection_1 = require("./CalculatedColumnDefinitionWizardSection");
12
12
  const AdaptableContext_1 = require("../../AdaptableContext");
13
13
  const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/ObjectFactory"));
14
14
  const react_redux_1 = require("react-redux");
15
15
  const CalculatedColumnRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/CalculatedColumnRedux"));
16
16
  const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection");
17
+ const CalculatedColumnSettingsWizardSection_1 = require("./CalculatedColumnSettingsWizardSection");
17
18
  const CalculatedColumnWizard = (props) => {
18
19
  var _a;
19
20
  const adaptable = AdaptableContext_1.useAdaptable();
@@ -44,13 +45,13 @@ const CalculatedColumnWizard = (props) => {
44
45
  };
45
46
  return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: calculatedColumn, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
46
47
  {
47
- title: 'Settings',
48
- details: 'Specify Column details and properties',
49
- isValid: CalculatedColumnSettingsWizardSection_1.isValidCalculatedColumnSettings,
50
- renderSummary: CalculatedColumnSettingsWizardSection_1.renderCalculatedColumnSettingsSummary,
48
+ title: 'Definition',
49
+ details: 'Specify Column details',
50
+ isValid: CalculatedColumnDefinitionWizardSection_1.isValidCalculatedColumnDefinition,
51
+ renderSummary: CalculatedColumnDefinitionWizardSection_1.renderCalculatedColumnDefinitionSummary,
51
52
  render: () => {
52
53
  return (React.createElement(rebass_1.Box, { padding: 2 },
53
- React.createElement(CalculatedColumnSettingsWizardSection_1.CalculatedColumnSettingsWizardSection, { isEdit: isEdit, onChange: setCalculatedColumn })));
54
+ React.createElement(CalculatedColumnDefinitionWizardSection_1.CalculatedColumnDefinitionWizardSection, { isEdit: isEdit, onChange: setCalculatedColumn })));
54
55
  },
55
56
  },
56
57
  {
@@ -62,6 +63,16 @@ const CalculatedColumnWizard = (props) => {
62
63
  return React.createElement(CalculatedColumnExpressionWizardSection_1.CalculatedColumnExpressionWizardSection, { onChange: setCalculatedColumn });
63
64
  },
64
65
  },
66
+ {
67
+ title: 'Settings',
68
+ details: 'Specify Column properties',
69
+ isValid: CalculatedColumnSettingsWizardSection_1.isValidCalculatedColumnSettings,
70
+ renderSummary: CalculatedColumnSettingsWizardSection_1.renderCalculatedColumnSettingsSummary,
71
+ render: () => {
72
+ return (React.createElement(rebass_1.Box, { padding: 2 },
73
+ React.createElement(CalculatedColumnSettingsWizardSection_1.CalculatedColumnSettingsWizardSection, { isEdit: isEdit, onChange: setCalculatedColumn })));
74
+ },
75
+ },
65
76
  {
66
77
  details: 'Select Calculated Column tags',
67
78
  title: 'Tags',
@@ -11,7 +11,7 @@ const ValueSelector_1 = require("../ValueSelector");
11
11
  const baseClassName = 'ab-Adaptable-Object-Compact-List';
12
12
  const ICON_SIZE = 20;
13
13
  const AdaptableObjectCompactListItem = (props) => {
14
- var _a, _b, _c, _d, _e, _f;
14
+ var _a, _b, _c, _d, _e, _f, _g, _h;
15
15
  const dispatch = react_redux_1.useDispatch();
16
16
  const adaptable = AdaptableContext_1.useAdaptable();
17
17
  const objectView = props.module.toViewCompact(props.abObject);
@@ -20,9 +20,24 @@ const AdaptableObjectCompactListItem = (props) => {
20
20
  const moduleAccessLevel = adaptable.api.internalApi
21
21
  .getEntitlementService()
22
22
  .getEntitlementAccessLevelForModule(props.module.moduleInfo.ModuleName);
23
- const handleDelete = React.useCallback(() => {
23
+ const suspendAction = (_d = viewOptions === null || viewOptions === void 0 ? void 0 : viewOptions.getCompactSuspendAction) === null || _d === void 0 ? void 0 : _d.call(viewOptions, props.abObject);
24
+ const unSuspendAction = (_e = viewOptions === null || viewOptions === void 0 ? void 0 : viewOptions.getCompactUnSuspendAction) === null || _e === void 0 ? void 0 : _e.call(viewOptions, props.abObject);
25
+ const isSuspended = props.abObject.IsSuspended;
26
+ const handleDelete = React.useCallback((event) => {
27
+ event.stopPropagation();
28
+ event.preventDefault();
24
29
  dispatch(deleteAction);
25
30
  }, []);
31
+ const handleSuspendUnSuspend = React.useCallback((event) => {
32
+ event.stopPropagation();
33
+ event.preventDefault();
34
+ if (isSuspended) {
35
+ dispatch(unSuspendAction);
36
+ }
37
+ else {
38
+ dispatch(suspendAction);
39
+ }
40
+ }, [props.abObject]);
26
41
  let labelEl = objectView.item.label;
27
42
  if (typeof labelEl === 'function') {
28
43
  labelEl = React.createElement(labelEl, { data: props.abObject });
@@ -35,21 +50,42 @@ const AdaptableObjectCompactListItem = (props) => {
35
50
  React.createElement(objectView.item.view, {
36
51
  data: props.abObject,
37
52
  }),
38
- Boolean(((_d = objectView.item) === null || _d === void 0 ? void 0 : _d.values) && ((_f = (_e = objectView.item) === null || _e === void 0 ? void 0 : _e.values) === null || _f === void 0 ? void 0 : _f.length)) && (React.createElement(rebass_1.Box, { mb: 2, className: `${baseClassName}__Item__Values` },
53
+ Boolean(((_f = objectView.item) === null || _f === void 0 ? void 0 : _f.values) && ((_h = (_g = objectView.item) === null || _g === void 0 ? void 0 : _g.values) === null || _h === void 0 ? void 0 : _h.length)) && (React.createElement(rebass_1.Box, { mb: 2, className: `${baseClassName}__Item__Values` },
39
54
  React.createElement(ValueSelector_1.ValueOptionsTags, { style: { marginRight: 0 }, readOnly: true, options: objectView.item.values, value: objectView.item.values, allowWrap: true, toIdentifier: (c) => c, toLabel: (c) => React.createElement(React.Fragment, null, c) })))),
40
- React.createElement(rebass_1.Flex, { ml: 1 }, deleteAction && (React.createElement(SimpleButton_1.default, { iconSize: ICON_SIZE, icon: "delete", variant: "text", onClick: handleDelete, accessLevel: moduleAccessLevel })))));
55
+ suspendAction && unSuspendAction && (React.createElement(SimpleButton_1.default, { onMouseDown: handleSuspendUnSuspend, tone: isSuspended ? 'neutral' : 'success', variant: "text", icon: isSuspended ? 'play' : 'pause' })),
56
+ React.createElement(rebass_1.Flex, { ml: 1 }, deleteAction && (React.createElement(SimpleButton_1.default, { iconSize: ICON_SIZE, icon: "delete", variant: "text", onMouseDown: handleDelete, accessLevel: moduleAccessLevel })))));
41
57
  };
42
58
  exports.AdaptableObjectCompactListItem = AdaptableObjectCompactListItem;
43
59
  const AdaptableObjectCompactList = (props) => {
44
- var _a, _b, _c;
60
+ var _a, _b, _c, _d, _e;
61
+ const adaptable = AdaptableContext_1.useAdaptable();
45
62
  const viewProperties = (_b = (_a = props.module).getViewProperties) === null || _b === void 0 ? void 0 : _b.call(_a);
46
63
  const deleteAllAction = (_c = viewProperties === null || viewProperties === void 0 ? void 0 : viewProperties.getDeleteAllAction) === null || _c === void 0 ? void 0 : _c.call(viewProperties);
64
+ const suspendAllAction = (_d = viewProperties === null || viewProperties === void 0 ? void 0 : viewProperties.getSuspendAllAction) === null || _d === void 0 ? void 0 : _d.call(viewProperties);
65
+ const unSuspendAllAction = (_e = viewProperties === null || viewProperties === void 0 ? void 0 : viewProperties.getUnSuspendAllAction) === null || _e === void 0 ? void 0 : _e.call(viewProperties);
47
66
  const dispatch = react_redux_1.useDispatch();
67
+ const accessLevel = adaptable.api.internalApi
68
+ .getEntitlementService()
69
+ .getEntitlementAccessLevelForModule(props.module.moduleInfo.ModuleName);
70
+ const isAtLeastOneAbObjectActive = props.abObjects.some((abObject) => {
71
+ return !abObject.IsSuspended;
72
+ });
73
+ const handleSuspendUnsuspendAll = React.useCallback((event) => {
74
+ event.stopPropagation();
75
+ event.preventDefault();
76
+ if (isAtLeastOneAbObjectActive) {
77
+ dispatch(suspendAllAction);
78
+ }
79
+ else {
80
+ dispatch(unSuspendAllAction);
81
+ }
82
+ }, [isAtLeastOneAbObjectActive]);
48
83
  return (React.createElement(rebass_1.Flex, { flexDirection: "column", className: baseClassName },
49
84
  React.createElement(rebass_1.Flex, { className: `${baseClassName}__Header`, fontSize: 3 },
50
85
  React.createElement(rebass_1.Box, { className: `${baseClassName}__Title` }, props.module.moduleInfo.FriendlyName),
51
86
  React.createElement(rebass_1.Box, { flex: 1 }),
52
- deleteAllAction && (React.createElement(SimpleButton_1.default, { onClick: () => dispatch(deleteAllAction), variant: "raised", tone: "neutral", accessLevel: 'Full' }, "Clear All"))),
87
+ suspendAllAction && unSuspendAllAction && (React.createElement(SimpleButton_1.default, { mr: 2, onMouseDown: handleSuspendUnsuspendAll, tone: isAtLeastOneAbObjectActive ? 'neutral' : 'success', variant: "raised", icon: isAtLeastOneAbObjectActive ? 'pause' : 'play', accessLevel: accessLevel }, isAtLeastOneAbObjectActive ? 'Suspend All' : 'Unsuspend All')),
88
+ deleteAllAction && (React.createElement(SimpleButton_1.default, { onMouseDown: () => dispatch(deleteAllAction), variant: "raised", tone: "neutral", accessLevel: accessLevel }, "Clear All"))),
53
89
  React.createElement(rebass_1.Box, { className: `${baseClassName}__Body` }, props.abObjects.map((abObject) => {
54
90
  return (React.createElement(exports.AdaptableObjectCompactListItem, { key: abObject.Uuid, abObject: abObject, module: props.module }));
55
91
  }))));
@@ -28,7 +28,7 @@ const AdaptableObjectListItemView = (props) => {
28
28
  labelEl = React.createElement(tag.label, { data: props.abObject });
29
29
  }
30
30
  labelEl = labelEl !== null && labelEl !== void 0 ? labelEl : tag.name;
31
- return (React.createElement(rebass_1.Flex, { "data-name": tag.name, key: index, mb: 2, className: `${baseClassName}__row` },
31
+ return (React.createElement(rebass_1.Flex, { "data-name": tag.name, key: `${index}-${tag.name}`, mb: 2, className: `${baseClassName}__row` },
32
32
  React.createElement(rebass_1.Box, { className: `${baseClassName}__label`, mr: 3 },
33
33
  labelEl,
34
34
  props.showEditButton && (React.createElement(SimpleButton_1.default, { accessLevel: props.accessLevel, className: `${baseClassName}__edit-property`, ml: 1, icon: "edit", tooltip: "edit", iconSize: 18, variant: "text", onClick: () => {
@@ -14,6 +14,7 @@ const AdaptableContext_1 = require("../../AdaptableContext");
14
14
  const ButtonInfo_1 = require("../Buttons/ButtonInfo");
15
15
  const DocumentationLinkConstants_1 = require("../../../Utilities/Constants/DocumentationLinkConstants");
16
16
  const react_1 = require("react");
17
+ const PermittedValuesSelector_1 = require("../PermittedValuesSelector");
17
18
  const isRuleValid = (abObject, api, context) => {
18
19
  var _a, _b, _c, _d, _e, _f;
19
20
  if (!((_a = abObject === null || abObject === void 0 ? void 0 : abObject.Rule) === null || _a === void 0 ? void 0 : _a.Predicate) && !((_b = abObject === null || abObject === void 0 ? void 0 : abObject.Rule) === null || _b === void 0 ? void 0 : _b.BooleanExpression)) {
@@ -90,6 +91,19 @@ const EntityRulesEditor = (props) => {
90
91
  const predicateId = data.Rule.Predicate != undefined ? data.Rule.Predicate.PredicateId : undefined;
91
92
  const predicateInputs = predicateId ? (_a = data.Rule.Predicate.Inputs) !== null && _a !== void 0 ? _a : [] : [];
92
93
  const currentPredicateDef = api.predicateApi.getPredicateDefById(predicateId);
94
+ const isValuesPredicateDef = (colDef) => colDef && ['Values', 'ExcludeValues'].includes(colDef.id);
95
+ const predicateDefsOptions = predicateDefs
96
+ .filter((def) => {
97
+ if (isValuesPredicateDef(def)) {
98
+ return 'ColumnIds' in data.Scope && data.Scope.ColumnIds.length === 1;
99
+ }
100
+ return true;
101
+ })
102
+ .map((item) => ({
103
+ value: item.id,
104
+ label: item.label,
105
+ onClick: () => onPredicateChange(item),
106
+ }));
93
107
  const onPredicateInputChange = (e, index) => {
94
108
  const { value } = e.target;
95
109
  const newInputs = [...predicateInputs];
@@ -101,6 +115,14 @@ const EntityRulesEditor = (props) => {
101
115
  },
102
116
  } }));
103
117
  };
118
+ const onPredicateValuesChange = (inputs) => {
119
+ props.onChange(Object.assign(Object.assign({}, data), { Rule: {
120
+ Predicate: {
121
+ PredicateId: predicateId,
122
+ Inputs: inputs,
123
+ },
124
+ } }));
125
+ };
104
126
  const onPredicateChange = (item) => {
105
127
  var _a;
106
128
  if (item) {
@@ -146,14 +168,13 @@ const EntityRulesEditor = (props) => {
146
168
  overflow: 'hidden',
147
169
  textOverflow: 'ellipsis',
148
170
  maxWidth: 'inherit',
149
- }, placeholder: "Select Rule", showClearButton: !!data.Rule.Predicate, onClear: clearPredicate, items: predicateDefs.map((item) => ({
150
- value: item.id,
151
- label: item.label,
152
- onClick: () => onPredicateChange(item),
153
- })), columns: ['label'] }, currentPredicateDef ? currentPredicateDef.label : 'Select Rule'), (_b = currentPredicateDef === null || currentPredicateDef === void 0 ? void 0 : currentPredicateDef.inputs) === null || _b === void 0 ? void 0 :
171
+ }, placeholder: "Select Rule", showClearButton: !!data.Rule.Predicate, onClear: clearPredicate, items: predicateDefsOptions, columns: ['label'] }, currentPredicateDef ? currentPredicateDef.label : 'Select Rule'), (_b = currentPredicateDef === null || currentPredicateDef === void 0 ? void 0 : currentPredicateDef.inputs) === null || _b === void 0 ? void 0 :
154
172
  _b.map((predicateDefInput, index) => (React.createElement(rebass_1.Flex, { key: predicateId + index, flexDirection: "column" },
155
173
  index > 0 && React.createElement(HelpBlock_1.default, { marginTop: 2 }, "AND"),
156
174
  React.createElement(AdaptableInput_1.default, { marginTop: 2, type: predicateDefInput.type, autoFocus: index === 0, value: predicateInputs[index], onChange: (e) => onPredicateInputChange(e, index) })))),
175
+ isValuesPredicateDef(currentPredicateDef) &&
176
+ 'ColumnIds' in data.Scope &&
177
+ data.Scope.ColumnIds.length === 1 && (React.createElement(PermittedValuesSelector_1.PermitedValuesSelector, { onPredicateValuesChange: onPredicateValuesChange, predicate: data.Rule.Predicate, scope: data.Scope })),
157
178
  showDocumentationLinks && (React.createElement(HelpBlock_1.default, { "data-name": "query-documentation", mt: 3, mb: 2, style: {
158
179
  fontSize: 'var(--ab-font-size-3)',
159
180
  padding: 0,
@@ -144,7 +144,7 @@ class FilterFormComponent extends React.Component {
144
144
  React.createElement(Radio_1.default, { marginLeft: 2, flex: 1, checked: this.state.currentTab == 'predicates', onChange: () => this.setState({ currentTab: 'predicates' }) },
145
145
  React.createElement(rebass_1.Flex, { fontSize: 'var( --ab-font-size-2)' }, "Filters")))),
146
146
  this.state.currentTab === 'values' && (React.createElement("div", null,
147
- React.createElement(ListBoxFilterForm_1.ListBoxFilterForm, { suppressClientSideFilter: this.state.suppressClientSideFilter, isLoading: this.state.isDistinctColumnValuesLoading, onFilterChange: this.handleFilterChange, currentColumn: this.props.currentColumn, columns: this.props.columns, columnDistinctValues: this.state.distinctColumnValues, dataType: this.props.currentColumn.dataType, uiSelectedColumnValues: uiSelectedColumnValues, useAgGridStyle: useAgGridStyle, onColumnValueSelectedChange: (list) => this.onColumnValuesChange(list) }))),
147
+ React.createElement(ListBoxFilterForm_1.ListBoxFilterForm, { disabled: this.isFilterDisabled(), suppressClientSideFilter: this.state.suppressClientSideFilter, isLoading: this.state.isDistinctColumnValuesLoading, onFilterChange: this.handleFilterChange, currentColumn: this.props.currentColumn, columns: this.props.columns, columnDistinctValues: this.state.distinctColumnValues, dataType: this.props.currentColumn.dataType, uiSelectedColumnValues: uiSelectedColumnValues, useAgGridStyle: useAgGridStyle, onColumnValueSelectedChange: (list) => this.onColumnValuesChange(list) }))),
148
148
  this.state.currentTab === 'predicates' && (React.createElement("div", null,
149
149
  ' ',
150
150
  this.state.showTab && React.createElement("hr", null),
@@ -157,7 +157,7 @@ class FilterFormComponent extends React.Component {
157
157
  const { editedColumnFilter } = this.state;
158
158
  const checked = ((_a = editedColumnFilter === null || editedColumnFilter === void 0 ? void 0 : editedColumnFilter.Predicate) === null || _a === void 0 ? void 0 : _a.PredicateId) === predicateDef.id;
159
159
  return (React.createElement(rebass_1.Flex, { key: index, flexDirection: "column" },
160
- React.createElement(Radio_1.default, { fontSize: 'var(--ab-font-size-2)', margin: 1, flex: 1, checked: checked, onChange: () => this.selectColumnPredicate(predicateDef) }, predicateDef.label),
160
+ React.createElement(Radio_1.default, { disabled: this.isFilterDisabled(), fontSize: 'var(--ab-font-size-2)', margin: 1, flex: 1, checked: checked, onChange: () => this.selectColumnPredicate(predicateDef) }, predicateDef.label),
161
161
  React.createElement(rebass_1.Flex, { flexDirection: "column", flex: 0, marginLeft: 3, marginRight: 2 }, checked && this.renderPredicateInput(predicateDef, editedColumnFilter))));
162
162
  }
163
163
  renderPredicateInput(predicateDef, filter) {
@@ -165,7 +165,7 @@ class FilterFormComponent extends React.Component {
165
165
  if ((predicateDef === null || predicateDef === void 0 ? void 0 : predicateDef.id) === 'BooleanToggle') {
166
166
  // custom tri-state checkbox: true, false, all(indeterminate)
167
167
  return (React.createElement(rebass_1.Flex, { flexDirection: "row", flex: 1, justifyContent: "center", alignItems: "center" },
168
- React.createElement(CheckBox_1.CheckBox, { checked: filter.Predicate.Inputs[0] === 'true'
168
+ React.createElement(CheckBox_1.CheckBox, { disabled: this.isFilterDisabled(), checked: filter.Predicate.Inputs[0] === 'true'
169
169
  ? true
170
170
  : filter.Predicate.Inputs[0] === 'false'
171
171
  ? false
@@ -181,12 +181,16 @@ class FilterFormComponent extends React.Component {
181
181
  } })));
182
182
  }
183
183
  return (_a = predicateDef.inputs) === null || _a === void 0 ? void 0 : _a.map((predicateInput, index) => (React.createElement(rebass_1.Flex, { key: index, flexDirection: "row" },
184
- React.createElement(AdaptableInput_1.default, { type: predicateInput.type, autoFocus: index === 0, value: filter.Predicate.Inputs[index], onChange: (e) => this.changeColumnPredicateInput(e.target.value, index), style: {
184
+ React.createElement(AdaptableInput_1.default, { disabled: this.isFilterDisabled(), type: predicateInput.type, autoFocus: index === 0, value: filter.Predicate.Inputs[index], onChange: (e) => this.changeColumnPredicateInput(e.target.value, index), style: {
185
185
  marginBottom: 5,
186
186
  flex: 1,
187
187
  fontSize: 'var( --ab-font-size-2)',
188
188
  } }))));
189
189
  }
190
+ isFilterDisabled() {
191
+ var _a;
192
+ return Boolean((_a = this.state.editedColumnFilter) === null || _a === void 0 ? void 0 : _a.IsSuspended);
193
+ }
190
194
  isFilterable() {
191
195
  if (!this.props.currentColumn.filterable) {
192
196
  return 'Column is not filterable';
@@ -58,6 +58,7 @@ const ListBoxFilterForm = (props) => {
58
58
  children: distinctValue.label,
59
59
  checked: isActive,
60
60
  onChange: () => onClickItemColumnValue(distinctValue.value),
61
+ disabled: props.disabled,
61
62
  });
62
63
  }
63
64
  return (React.createElement(ListGroupItem_1.default, { noZebra: props.useAgGridStyle, key: 'columnValue' + index, onClick: () => onClickItemColumnValue(distinctValue.value), active: isActive, value: distinctValue.value }, distinctValue.label));