@adaptabletools/adaptable-cjs 22.0.0-canary.3 → 22.0.0-canary.5

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 (150) hide show
  1. package/index.css +58 -29
  2. package/index.css.map +1 -1
  3. package/package.json +1 -1
  4. package/src/AdaptableOptions/ActionColumnOptions.d.ts +2 -2
  5. package/src/AdaptableOptions/CustomSortOptions.d.ts +5 -0
  6. package/src/AdaptableOptions/DashboardOptions.d.ts +1 -2
  7. package/src/AdaptableOptions/ToolPanelOptions.d.ts +1 -2
  8. package/src/AdaptableState/AlertState.d.ts +2 -2
  9. package/src/AdaptableState/ChartingState.d.ts +3 -3
  10. package/src/AdaptableState/Common/AdaptableAlert.d.ts +2 -2
  11. package/src/AdaptableState/Common/AdaptableButton.d.ts +2 -2
  12. package/src/AdaptableState/Common/AdaptableFlashingCell.d.ts +2 -2
  13. package/src/AdaptableState/Common/AdaptableObject.d.ts +25 -2
  14. package/src/AdaptableState/Common/AdaptableStyle.d.ts +1 -1
  15. package/src/AdaptableState/Common/RowSummary.d.ts +1 -1
  16. package/src/AdaptableState/Common/Schedule.d.ts +3 -4
  17. package/src/AdaptableState/Common/SystemStatusMessageInfo.d.ts +2 -2
  18. package/src/AdaptableState/CustomSortState.d.ts +2 -2
  19. package/src/AdaptableState/DashboardState.d.ts +2 -2
  20. package/src/AdaptableState/ExportState.d.ts +2 -2
  21. package/src/AdaptableState/FlashingCellState.d.ts +2 -2
  22. package/src/AdaptableState/FormatColumnState.d.ts +2 -2
  23. package/src/AdaptableState/LayoutState.d.ts +8 -3
  24. package/src/AdaptableState/NamedQueryState.d.ts +2 -2
  25. package/src/AdaptableState/PlusMinusState.d.ts +2 -2
  26. package/src/AdaptableState/ShortcutState.d.ts +2 -2
  27. package/src/AdaptableState/StyledColumnState.d.ts +1 -1
  28. package/src/AdaptableState/ThemeState.d.ts +2 -2
  29. package/src/Api/CustomSortApi.d.ts +6 -3
  30. package/src/Api/Implementation/CustomSortApiImpl.d.ts +5 -1
  31. package/src/Api/Implementation/CustomSortApiImpl.js +2 -2
  32. package/src/Api/Implementation/LayoutHelpers.js +7 -0
  33. package/src/Api/Implementation/ScheduleApiImpl.js +1 -0
  34. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +1 -1
  35. package/src/Strategy/AlertModule.js +4 -0
  36. package/src/Strategy/CustomSortModule.js +4 -0
  37. package/src/Strategy/FlashingCellModule.js +5 -0
  38. package/src/Strategy/FormatColumnModule.js +4 -0
  39. package/src/Strategy/LayoutModule.js +4 -4
  40. package/src/Strategy/PlusMinusModule.js +4 -0
  41. package/src/Strategy/ScheduleModule.js +4 -0
  42. package/src/Strategy/ShortcutModule.js +4 -0
  43. package/src/Utilities/Extensions/StringExtensions.d.ts +2 -0
  44. package/src/Utilities/Extensions/StringExtensions.js +17 -0
  45. package/src/Utilities/Helpers/FormatHelper.js +9 -2
  46. package/src/Utilities/ObjectFactory.js +15 -2
  47. package/src/View/Alert/Utilities/getDefaultAlertDefinition.d.ts +2 -1
  48. package/src/View/Alert/Wizard/AlertTypeWizardSection.d.ts +5 -2
  49. package/src/View/Alert/Wizard/AlertTypeWizardSection.js +48 -12
  50. package/src/View/Alert/Wizard/AlertWizard.js +12 -8
  51. package/src/View/Components/Buttons/EntityListActionButtons.d.ts +1 -2
  52. package/src/View/Components/Buttons/SuspendToggleButton/SuspendToggleButton.d.ts +1 -2
  53. package/src/View/Components/StyleComponent.d.ts +1 -0
  54. package/src/View/Components/StyleComponent.js +84 -33
  55. package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.d.ts +2 -1
  56. package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +39 -13
  57. package/src/View/CustomSort/Wizard/CustomSortWizard.js +4 -4
  58. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -0
  59. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.d.ts +2 -1
  60. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +36 -15
  61. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +13 -9
  62. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +47 -29
  63. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +22 -11
  64. package/src/View/GridFilter/GridFilterExpressionEditor.js +6 -1
  65. package/src/View/GridFilter/GridFilterViewPanel.js +33 -70
  66. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +8 -0
  67. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +32 -9
  68. package/src/View/PlusMinus/Wizard/PlusMinusWizard.js +20 -15
  69. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsIPushPull.js +12 -1
  70. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsOpenFin.js +12 -1
  71. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReminder.js +12 -2
  72. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +12 -1
  73. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/isSettingsValid.d.ts +2 -1
  74. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/isSettingsValid.js +10 -1
  75. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.d.ts +2 -1
  76. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +25 -4
  77. package/src/View/Shortcut/Wizard/ShortcutWizard.js +18 -14
  78. package/src/components/ColorPicker/ColorPicker.js +5 -4
  79. package/src/components/ExpressionEditor/ExpressionFunctionDocumentation.js +1 -1
  80. package/src/env.js +2 -2
  81. package/src/layout-manager/src/LayoutManagerModel.d.ts +1 -0
  82. package/src/layout-manager/src/index.js +25 -7
  83. package/src/layout-manager/src/normalizeLayoutModel.js +3 -0
  84. package/src/metamodel/adaptable.metamodel.d.ts +30 -0
  85. package/src/metamodel/adaptable.metamodel.js +1 -1
  86. package/src/migration/AdaptableUpgradeHelper.js +1 -1
  87. package/src/migration/VersionUpgrade22.d.ts +15 -0
  88. package/src/migration/VersionUpgrade22.js +160 -0
  89. package/src/types.d.ts +1 -2
  90. package/tsconfig.cjs.tsbuildinfo +1 -1
  91. package/src/AdaptableState/Common/SuspendableObject.d.ts +0 -10
  92. package/src/AdaptableState/Common/SuspendableObject.js +0 -2
  93. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.d.ts +0 -1
  94. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.js +0 -633
  95. package/src/View/Alert/AlertEntityRow.d.ts +0 -11
  96. package/src/View/Alert/AlertEntityRow.js +0 -33
  97. package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +0 -21
  98. package/src/View/CalculatedColumn/CalculatedColumnSummary.js +0 -63
  99. package/src/View/Components/Buttons/ButtonFunction.d.ts +0 -7
  100. package/src/View/Components/Buttons/ButtonFunction.js +0 -13
  101. package/src/View/Components/Buttons/ButtonGeneral.d.ts +0 -5
  102. package/src/View/Components/Buttons/ButtonGeneral.js +0 -12
  103. package/src/View/Components/Buttons/ButtonPreviewDelete.d.ts +0 -4
  104. package/src/View/Components/Buttons/ButtonPreviewDelete.js +0 -8
  105. package/src/View/Components/Buttons/ButtonShow.d.ts +0 -5
  106. package/src/View/Components/Buttons/ButtonShow.js +0 -12
  107. package/src/View/Components/Buttons/ButtonShowChart.d.ts +0 -5
  108. package/src/View/Components/Buttons/ButtonShowChart.js +0 -12
  109. package/src/View/Components/Buttons/ButtonUndo.d.ts +0 -5
  110. package/src/View/Components/Buttons/ButtonUndo.js +0 -12
  111. package/src/View/Components/ExpressionWizard.d.ts +0 -24
  112. package/src/View/Components/ExpressionWizard.js +0 -82
  113. package/src/View/Components/FilterForm/Waiting.d.ts +0 -10
  114. package/src/View/Components/FilterForm/Waiting.js +0 -19
  115. package/src/View/Components/Panels/PanelFooter.d.ts +0 -10
  116. package/src/View/Components/Panels/PanelFooter.js +0 -14
  117. package/src/View/Components/Panels/PanelWithTwoButtons.d.ts +0 -12
  118. package/src/View/Components/Panels/PanelWithTwoButtons.js +0 -20
  119. package/src/View/Components/Panels/ToolPanelSettingsPanel.d.ts +0 -8
  120. package/src/View/Components/Panels/ToolPanelSettingsPanel.js +0 -31
  121. package/src/View/Components/Selectors/ColumnSelectorOld.d.ts +0 -18
  122. package/src/View/Components/Selectors/ColumnSelectorOld.js +0 -50
  123. package/src/View/Components/SharedProps/WizardScopeState.d.ts +0 -4
  124. package/src/View/Components/SharedProps/WizardScopeState.js +0 -2
  125. package/src/View/Components/WizardSummaryRow.d.ts +0 -9
  126. package/src/View/Components/WizardSummaryRow.js +0 -16
  127. package/src/View/CustomSort/CustomSortSummary.d.ts +0 -23
  128. package/src/View/CustomSort/CustomSortSummary.js +0 -110
  129. package/src/View/DataImport/DataImportWizard/sections/ImportSection.d.ts +0 -9
  130. package/src/View/DataImport/DataImportWizard/sections/ImportSection.js +0 -24
  131. package/src/View/Export/Wizard/ReportColumnTypeWizard.d.ts +0 -19
  132. package/src/View/Export/Wizard/ReportColumnTypeWizard.js +0 -73
  133. package/src/View/Export/Wizard/ReportRowTypeWizard.d.ts +0 -19
  134. package/src/View/Export/Wizard/ReportRowTypeWizard.js +0 -73
  135. package/src/View/Export/Wizard/ReportSettingsWizard.d.ts +0 -21
  136. package/src/View/Export/Wizard/ReportSettingsWizard.js +0 -61
  137. package/src/View/Export/Wizard/ReportSummaryWizard.d.ts +0 -15
  138. package/src/View/Export/Wizard/ReportSummaryWizard.js +0 -40
  139. package/src/View/Filter/FilterSummary.d.ts +0 -18
  140. package/src/View/Filter/FilterSummary.js +0 -53
  141. package/src/View/FormatColumn/FormatColumnSummary.d.ts +0 -22
  142. package/src/View/FormatColumn/FormatColumnSummary.js +0 -95
  143. package/src/View/FreeTextColumn/FreeTextColumnSummary.d.ts +0 -22
  144. package/src/View/FreeTextColumn/FreeTextColumnSummary.js +0 -93
  145. package/src/View/GridInfo/GridInfoPopup/AdaptableOptionsComponent.d.ts +0 -7
  146. package/src/View/GridInfo/GridInfoPopup/AdaptableOptionsComponent.js +0 -99
  147. package/src/View/PlusMinus/PlusMinusSummary.d.ts +0 -22
  148. package/src/View/PlusMinus/PlusMinusSummary.js +0 -100
  149. package/src/View/Wizard/WizardLegend.d.ts +0 -12
  150. package/src/View/Wizard/WizardLegend.js +0 -28
@@ -8,14 +8,26 @@ const Tag_1 = require("../../../components/Tag");
8
8
  const ColumnSelector_1 = require("../../Components/ColumnSelector");
9
9
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
10
10
  const Flex_1 = require("../../../components/Flex");
11
+ const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
12
+ const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
11
13
  const renderCustomSortColumn = (data) => {
12
14
  const { api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
13
15
  return (React.createElement(Flex_1.Box, { className: "twa:text-2 twa:py-2 twa:pr-2" },
14
- "Custom sort column: ",
15
- React.createElement(Tag_1.Tag, null, api.columnApi.getFriendlyNameForColumnId(data.ColumnId))));
16
+ React.createElement(Tag_1.Tag, { className: "twa:mr-2" },
17
+ "Name: ",
18
+ data.Name),
19
+ React.createElement(Tag_1.Tag, null,
20
+ "Column: ",
21
+ api.columnApi.getFriendlyNameForColumnId(data.ColumnId))));
16
22
  };
17
23
  exports.renderCustomSortColumn = renderCustomSortColumn;
18
- const isValidCustomSortColumn = (data) => {
24
+ const isValidCustomSortColumn = (data, allCustomSorts) => {
25
+ if (!data.Name) {
26
+ return 'Custom Sort Name cannot be blank';
27
+ }
28
+ if (allCustomSorts.some((customSort) => customSort.Name === data.Name && customSort.Uuid !== data.Uuid)) {
29
+ return 'A Custom Sort already exists with that name';
30
+ }
19
31
  if (!data.ColumnId) {
20
32
  return 'You have to select a Column for Custom Sort';
21
33
  }
@@ -48,15 +60,29 @@ const CustomSortColumnWizardSection = (props) => {
48
60
  });
49
61
  });
50
62
  }, []);
51
- return (React.createElement(Tabs_1.Tabs, { style: { height: '100%' } },
52
- React.createElement(Tabs_1.Tabs.Tab, null, "Column"),
53
- React.createElement(Tabs_1.Tabs.Content, null,
54
- React.createElement(ColumnSelector_1.NewColumnSelector, { availableColumns: sortableCols, selected: data.ColumnId ? [data.ColumnId] : [], singleSelect: true, onChange: (ids) => {
55
- props.onChange({
56
- ...data,
57
- SortedValues: [],
58
- ColumnId: ids[0],
59
- });
60
- }, allowReorder: false }))));
63
+ const onNameChange = (event) => {
64
+ props.onChange({
65
+ ...data,
66
+ Name: event.target.value,
67
+ });
68
+ };
69
+ return (React.createElement(Flex_1.Flex, { flexDirection: "column", style: { height: '100%' } },
70
+ React.createElement(Tabs_1.Tabs, { className: "twa:mb-3" },
71
+ React.createElement(Tabs_1.Tabs.Tab, null, "Settings"),
72
+ React.createElement(Tabs_1.Tabs.Content, null,
73
+ React.createElement(Flex_1.Flex, { flexDirection: "row" },
74
+ React.createElement(FormLayout_1.default, { className: "twa:max-w-[300px] twa:w-full" },
75
+ React.createElement(FormLayout_1.FormRow, { label: "Name" },
76
+ React.createElement(Input_1.default, { className: "twa:w-full", "data-name": "custom-sort-name", onChange: onNameChange, value: data?.Name ?? '' })))))),
77
+ React.createElement(Tabs_1.Tabs, { style: { flex: 1, minHeight: 0 } },
78
+ React.createElement(Tabs_1.Tabs.Tab, null, "Column"),
79
+ React.createElement(Tabs_1.Tabs.Content, null,
80
+ React.createElement(ColumnSelector_1.NewColumnSelector, { availableColumns: sortableCols, selected: data.ColumnId ? [data.ColumnId] : [], singleSelect: true, onChange: (ids) => {
81
+ props.onChange({
82
+ ...data,
83
+ SortedValues: [],
84
+ ColumnId: ids[0],
85
+ });
86
+ }, allowReorder: false })))));
61
87
  };
62
88
  exports.CustomSortColumnWizardSection = CustomSortColumnWizardSection;
@@ -41,14 +41,14 @@ const CustomSortWizard = (props) => {
41
41
  };
42
42
  return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: customSort, onFinish: handleFinish, onHide: props.onCloseWizard, sections: [
43
43
  {
44
- isValid: CustomSortColumnWizardSection_1.isValidCustomSortColumn,
44
+ isValid: (data) => (0, CustomSortColumnWizardSection_1.isValidCustomSortColumn)(data, allCustomSorts),
45
45
  renderSummary: CustomSortColumnWizardSection_1.renderCustomSortColumn,
46
- details: 'Select a Column for Custom Sort',
46
+ details: 'Enter Name and select a Column for Custom Sort',
47
47
  render: () => {
48
48
  return (React.createElement(Flex_1.Box, { className: "twa:p-2 twa:h-full" },
49
- React.createElement(CustomSortColumnWizardSection_1.CustomSortColumnWizardSection, { isNew: props.isNew, onChange: setCustomSort })));
49
+ React.createElement(CustomSortColumnWizardSection_1.CustomSortColumnWizardSection, { isNew: props.isNew, onChange: setCustomSort, allCustomSorts: allCustomSorts })));
50
50
  },
51
- title: 'Column',
51
+ title: 'Name & Column',
52
52
  },
53
53
  {
54
54
  title: 'Sort Order',
@@ -165,6 +165,7 @@ const buildAdaptableOptions = (mainAdaptableInstance, adaptableContainerId, agGr
165
165
  Revision: Date.now(),
166
166
  FormatColumns: [
167
167
  {
168
+ Name: 'Changed At',
168
169
  Scope: {
169
170
  ColumnIds: ['changeInfo.changedAt'],
170
171
  },
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
- import { FlashingCellDefinition } from '../../../types';
2
+ import { AdaptableApi, FlashingCellDefinition } from '../../../types';
3
3
  type FlashingAlertDurationWizardSectionProps = {
4
4
  readOnly?: boolean;
5
5
  flashingCell?: FlashingCellDefinition;
6
6
  onChange: (data: FlashingCellDefinition) => void;
7
7
  };
8
+ export declare const isSettingsValid: (data: FlashingCellDefinition, api: AdaptableApi) => true | "Name is required" | "A Flashing Cell already exists with that name";
8
9
  export declare const renderFlashingAlertSettingsSummary: (flashingAlert: FlashingCellDefinition) => React.JSX.Element;
9
10
  export declare const FlashingAlertSettingsWizardSection: (props: FlashingAlertDurationWizardSectionProps) => React.JSX.Element;
10
11
  export {};
@@ -1,20 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlashingAlertSettingsWizardSection = exports.renderFlashingAlertSettingsSummary = void 0;
3
+ exports.FlashingAlertSettingsWizardSection = exports.renderFlashingAlertSettingsSummary = exports.isSettingsValid = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const react_1 = require("react");
7
7
  const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
8
8
  const usePrevious_1 = tslib_1.__importDefault(require("../../../components/utils/usePrevious"));
9
- const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
10
9
  const Tabs_1 = require("../../../components/Tabs");
11
10
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
12
11
  const CodeBlock_1 = require("../../../components/CodeBlock");
13
12
  const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
14
13
  const CheckBox_1 = require("../../../components/CheckBox");
15
14
  const Flex_1 = require("../../../components/Flex");
15
+ const Tag_1 = require("../../../components/Tag");
16
+ const OnePageAdaptableWizard_2 = require("../../Wizard/OnePageAdaptableWizard");
17
+ const isSettingsValid = (data, api) => {
18
+ if (!data.Name?.trim()) {
19
+ return 'Name is required';
20
+ }
21
+ const allFlashingCells = api.flashingCellApi.getFlashingCellDefinitions();
22
+ const isDuplicateName = allFlashingCells.some((fc) => fc.Name === data.Name && fc.Uuid !== data.Uuid);
23
+ if (isDuplicateName) {
24
+ return 'A Flashing Cell already exists with that name';
25
+ }
26
+ return true;
27
+ };
28
+ exports.isSettingsValid = isSettingsValid;
16
29
  const renderFlashingAlertSettingsSummary = (flashingAlert) => {
17
30
  return (React.createElement(React.Fragment, null,
31
+ React.createElement(OnePageAdaptableWizard_2.SummaryText, null,
32
+ "Name ",
33
+ React.createElement(Tag_1.Tag, null, flashingAlert.Name || 'Not specified')),
18
34
  React.createElement(Flex_1.Box, { className: "twa:text-2" }, flashingAlert.FlashDuration === 'always' ? (React.createElement(React.Fragment, null, "Flashing is never removed")) : (React.createElement(React.Fragment, null,
19
35
  "Flashing is removed after ",
20
36
  React.createElement(CodeBlock_1.CodeBlock, null, flashingAlert.FlashDuration),
@@ -25,6 +41,12 @@ exports.renderFlashingAlertSettingsSummary = renderFlashingAlertSettingsSummary;
25
41
  const FlashingAlertSettingsWizardSection = (props) => {
26
42
  let { data: flashingCell } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
27
43
  flashingCell = flashingCell ?? props.flashingCell;
44
+ const handleNameChange = (event) => {
45
+ props.onChange({
46
+ ...flashingCell,
47
+ Name: event.target.value,
48
+ });
49
+ };
28
50
  const setDuration = (FlashDuration) => {
29
51
  props.onChange({ ...flashingCell, FlashDuration: FlashDuration });
30
52
  };
@@ -63,24 +85,23 @@ const FlashingAlertSettingsWizardSection = (props) => {
63
85
  React.createElement(Tabs_1.Tabs.Tab, null, "Flashing Cell Settings"),
64
86
  React.createElement(Tabs_1.Tabs.Content, null,
65
87
  React.createElement(FormLayout_1.default, null,
66
- React.createElement(FormLayout_1.FormRow, { label: "Duration Type" },
67
- React.createElement(Radio_1.default, { "data-name": "duration-type-always", className: "twa:mr-3", checked: duration == 'always', tabIndex: -1, onChange: () => handleTypeChange('always') }, "Always"),
68
- React.createElement(Radio_1.default, { "data-name": "duration-type-number", checked: duration !== 'always', tabIndex: -1, onChange: () => handleTypeChange('number') }, "Limited (ms)")),
69
- React.createElement(FormLayout_1.FormRow, { label: "" },
70
- duration !== 'always' && (React.createElement(Flex_1.Flex, { flexDirection: "row", alignItems: "baseline" },
71
- React.createElement(Flex_1.Box, { className: "twa:text-2 twa:mr-2" }, "After"),
72
- React.createElement(Input_1.default, { "data-name": "duration-input", readOnly: props.readOnly, type: "text", name: "value", ref: inputRef, className: "twa:mt-2 twa:mr-1", value: duration, onChange: (event) => {
73
- const value = event.target.value;
74
- setDuration(isNaN(Number(value)) ? 500 : Number(value));
75
- } }),
76
- React.createElement(Flex_1.Box, { className: "twa:text-2" }, "milliseconds"))),
77
- duration === 'always' && (React.createElement(Flex_1.Box, { className: "twa:text-3 twa:h-[43px]" }, "Persists the flashing style indeterminately - can be removed manually"))),
88
+ React.createElement(FormLayout_1.FormRow, { label: "Name" },
89
+ React.createElement(Input_1.default, { "data-name": "flashing-cell-name", className: "twa:flex-1 twa:mr-3", onChange: handleNameChange, placeholder: "Enter Name", value: flashingCell.Name ?? '' })),
78
90
  React.createElement(FormLayout_1.FormRow, { label: "Flash Target" },
79
91
  React.createElement(CheckBox_1.CheckBox, { "data-name": "flashing-target", onChange: (checked) => handleTargetChange('cell', checked), className: "twa:mr-3", checked: flashingCell?.FlashTarget === 'cell' ||
80
92
  flashingCell?.FlashTarget?.includes?.('cell'), tabIndex: -1 }, "Cell"),
81
93
  React.createElement(CheckBox_1.CheckBox, { "data-name": "flashing-target-row", className: "twa:mr-3", onChange: (checked) => handleTargetChange('row', checked), checked: flashingCell?.FlashTarget === 'row' ||
82
94
  flashingCell?.FlashTarget?.includes?.('row'), tabIndex: -1 }, "Row"),
83
95
  React.createElement(CheckBox_1.CheckBox, { "data-name": "flashing-target-aggFuncCell", onChange: (checked) => handleTargetChange('aggFuncCell', checked), checked: flashingCell?.FlashTarget === 'aggFuncCell' ||
84
- flashingCell?.FlashTarget?.includes?.('aggFuncCell'), tabIndex: -1 }, "Aggregated Function Cell")))))));
96
+ flashingCell?.FlashTarget?.includes?.('aggFuncCell'), tabIndex: -1 }, "Aggregated Function Cell")),
97
+ React.createElement(FormLayout_1.FormRow, { label: "Duration" },
98
+ React.createElement(Flex_1.Flex, { alignItems: "center" },
99
+ React.createElement(CheckBox_1.CheckBox, { "data-name": "duration-always", checked: duration === 'always', onChange: (checked) => handleTypeChange(checked ? 'always' : 'number'), className: "twa:mr-4", tabIndex: -1 }, "Always"),
100
+ duration !== 'always' && (React.createElement(React.Fragment, null,
101
+ React.createElement(Input_1.default, { "data-name": "duration-input", readOnly: props.readOnly, type: "number", name: "value", ref: inputRef, className: "twa:w-20 twa:mr-2", value: duration, onChange: (event) => {
102
+ const value = event.target.value;
103
+ setDuration(isNaN(Number(value)) ? 500 : Number(value));
104
+ } }),
105
+ React.createElement(Flex_1.Box, { className: "twa:text-2" }, "ms"))))))))));
85
106
  };
86
107
  exports.FlashingAlertSettingsWizardSection = FlashingAlertSettingsWizardSection;
@@ -21,7 +21,7 @@ const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection"
21
21
  const Flex_1 = require("../../../components/Flex");
22
22
  const FlashingCellWizard = (props) => {
23
23
  const { api } = (0, AdaptableContext_1.useAdaptable)();
24
- const [flashingCell, setFlashingCell] = (0, react_1.useState)(() => {
24
+ const [flashingCell, doSetFlashingCell] = (0, react_1.useState)(() => {
25
25
  let flashingCell = props.data
26
26
  ? (0, Helper_1.cloneObject)(props.data)
27
27
  : ObjectFactory_1.default.CreateEmptyFlashingCellDefinition();
@@ -37,9 +37,12 @@ const FlashingCellWizard = (props) => {
37
37
  }
38
38
  return flashingCell;
39
39
  });
40
+ const setFlashingCell = (0, react_1.useCallback)((data) => {
41
+ doSetFlashingCell(data);
42
+ }, []);
40
43
  const updateProperty = (propName) => {
41
44
  return (value) => {
42
- setFlashingCell((flashingCell) => {
45
+ doSetFlashingCell((flashingCell) => {
43
46
  flashingCell = { ...flashingCell, [propName]: value };
44
47
  return flashingCell;
45
48
  });
@@ -61,6 +64,14 @@ const FlashingCellWizard = (props) => {
61
64
  props.onFinishWizard(flashingCell);
62
65
  };
63
66
  return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: flashingCell, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
67
+ {
68
+ details: 'Set Name, Duration and Target Properties',
69
+ isValid: FlashingCellSettingsWizardSection_1.isSettingsValid,
70
+ render: () => (React.createElement(Flex_1.Box, { className: "twa:p-2" },
71
+ React.createElement(FlashingCellSettingsWizardSection_1.FlashingAlertSettingsWizardSection, { onChange: setFlashingCell }))),
72
+ renderSummary: FlashingCellSettingsWizardSection_1.renderFlashingAlertSettingsSummary,
73
+ title: 'Settings',
74
+ },
64
75
  {
65
76
  details: 'Specify which data changes should trigger Cell Flashing',
66
77
  isValid: NewScopeComponent_1.isScopeValid,
@@ -84,13 +95,6 @@ const FlashingCellWizard = (props) => {
84
95
  renderSummary: FlashingCellStyleWizardSection_1.renderFlashingAlertStyleSummary,
85
96
  title: 'Flash Styles',
86
97
  },
87
- {
88
- details: 'Set Duration and Target Properties',
89
- render: () => (React.createElement(Flex_1.Box, { className: "twa:p-2" },
90
- React.createElement(FlashingCellSettingsWizardSection_1.FlashingAlertSettingsWizardSection, { onChange: setFlashingCell }))),
91
- renderSummary: FlashingCellSettingsWizardSection_1.renderFlashingAlertSettingsSummary,
92
- title: 'Settings',
93
- },
94
98
  {
95
99
  details: 'Select Flashing Cell Tags',
96
100
  title: 'Tags',
@@ -9,9 +9,13 @@ const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
9
9
  const Tag_1 = require("../../../components/Tag");
10
10
  const Radio_1 = tslib_1.__importStar(require("../../../components/Radio"));
11
11
  const Flex_1 = require("../../../components/Flex");
12
- const Card_1 = require("../../../components/Card");
12
+ const Tabs_1 = require("../../../components/Tabs");
13
+ const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
13
14
  const renderFormatColumnSettingsSummary = (data) => {
14
15
  return (React.createElement(Flex_1.Box, { className: "twa:p-2" },
16
+ React.createElement(Flex_1.Box, { className: "twa:mt-3" },
17
+ "Name ",
18
+ React.createElement(Tag_1.Tag, null, data.Name)),
15
19
  React.createElement(Flex_1.Box, { className: "twa:mt-3" },
16
20
  "Data Rows ",
17
21
  React.createElement(Tag_1.Tag, null, data.RowScope?.ExcludeDataRows ? 'no' : 'yes')),
@@ -35,6 +39,12 @@ const renderFormatColumnSettingsSummary = (data) => {
35
39
  exports.renderFormatColumnSettingsSummary = renderFormatColumnSettingsSummary;
36
40
  const FormatColumnSettingsWizardSection = (props) => {
37
41
  const { data } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
42
+ const onNameChange = (event) => {
43
+ props.onChange({
44
+ ...data,
45
+ Name: event.target.value,
46
+ });
47
+ };
38
48
  const onExcludeDataRowsChanged = (ExcludeDataRows) => {
39
49
  props.onChange({
40
50
  ...data,
@@ -71,33 +81,41 @@ const FormatColumnSettingsWizardSection = (props) => {
71
81
  },
72
82
  });
73
83
  };
74
- return (React.createElement(Card_1.Card, null,
75
- React.createElement(Card_1.Card.Title, null, "Settings"),
76
- React.createElement(Card_1.Card.Body, null,
77
- React.createElement(Flex_1.Flex, { flexDirection: "row" },
78
- React.createElement(FormLayout_1.default, null,
79
- data.Target === 'cell' && (React.createElement(React.Fragment, null,
80
- React.createElement(FormLayout_1.FormRow, { label: "Exclude Data Rows:" },
81
- React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
82
- React.createElement(CheckBox_1.CheckBox, { "data-name": "exclude-data-rows-checkbox", checked: data.RowScope?.ExcludeDataRows, onChange: onExcludeDataRowsChanged, className: "twa:mr-2" }))),
83
- React.createElement(FormLayout_1.FormRow, { label: "Exclude Group Rows:" },
84
- React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
85
- React.createElement(CheckBox_1.CheckBox, { "data-name": "exclude-grouped-rows-checkbox", checked: data.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged, className: "twa:mr-2" }))),
86
- React.createElement(FormLayout_1.FormRow, { label: "Exclude Row Summaries:" },
87
- React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
88
- React.createElement(CheckBox_1.CheckBox, { "data-name": "exclude-summary-rows-checkbox", checked: data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, className: "twa:mr-2" }))),
89
- React.createElement(FormLayout_1.FormRow, { label: "Exclude Total Rows:" },
90
- React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
91
- React.createElement(CheckBox_1.CheckBox, { "data-name": "exclude-total-rows-checkbox", checked: data.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, className: "twa:mr-2" }))))),
92
- React.createElement(FormLayout_1.FormRow, { label: "Apply on Column Group:" },
93
- React.createElement(Radio_1.RadioGroup, { value: data.ColumnGroupScope || 'Both', name: "columnGroupScope", orientation: "horizontal", onRadioChange: (columnGroupScope) => {
94
- props.onChange({
95
- ...data,
96
- ColumnGroupScope: columnGroupScope,
97
- });
98
- } },
99
- React.createElement(Radio_1.default, { className: "twa:ml-1", value: "Both" }, "Always"),
100
- React.createElement(Radio_1.default, { className: "twa:ml-4", value: "Expanded" }, "Expanded"),
101
- React.createElement(Radio_1.default, { className: "twa:ml-4", value: "Collapsed" }, "Collapsed"))))))));
84
+ return (React.createElement(Flex_1.Flex, { flexDirection: "column", style: { height: '100%' } },
85
+ React.createElement(Tabs_1.Tabs, { className: "twa:mb-3" },
86
+ React.createElement(Tabs_1.Tabs.Tab, null, "Settings"),
87
+ React.createElement(Tabs_1.Tabs.Content, null,
88
+ React.createElement(Flex_1.Flex, { flexDirection: "row" },
89
+ React.createElement(FormLayout_1.default, { className: "twa:max-w-[300px] twa:w-full" },
90
+ React.createElement(FormLayout_1.FormRow, { label: "Name" },
91
+ React.createElement(Input_1.default, { className: "twa:w-full", "data-name": "format-column-name", onChange: onNameChange, value: data?.Name ?? '' })))))),
92
+ React.createElement(Tabs_1.Tabs, null,
93
+ React.createElement(Tabs_1.Tabs.Tab, null, "Configuration"),
94
+ React.createElement(Tabs_1.Tabs.Content, null,
95
+ React.createElement(Flex_1.Flex, { flexDirection: "row" },
96
+ React.createElement(FormLayout_1.default, null,
97
+ data.Target === 'cell' && (React.createElement(React.Fragment, null,
98
+ React.createElement(FormLayout_1.FormRow, { label: "Exclude Data Rows:" },
99
+ React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
100
+ React.createElement(CheckBox_1.CheckBox, { "data-name": "exclude-data-rows-checkbox", checked: data.RowScope?.ExcludeDataRows, onChange: onExcludeDataRowsChanged, className: "twa:mr-2" }))),
101
+ React.createElement(FormLayout_1.FormRow, { label: "Exclude Group Rows:" },
102
+ React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
103
+ React.createElement(CheckBox_1.CheckBox, { "data-name": "exclude-grouped-rows-checkbox", checked: data.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged, className: "twa:mr-2" }))),
104
+ React.createElement(FormLayout_1.FormRow, { label: "Exclude Row Summaries:" },
105
+ React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
106
+ React.createElement(CheckBox_1.CheckBox, { "data-name": "exclude-summary-rows-checkbox", checked: data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, className: "twa:mr-2" }))),
107
+ React.createElement(FormLayout_1.FormRow, { label: "Exclude Total Rows:" },
108
+ React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
109
+ React.createElement(CheckBox_1.CheckBox, { "data-name": "exclude-total-rows-checkbox", checked: data.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, className: "twa:mr-2" }))))),
110
+ React.createElement(FormLayout_1.FormRow, { label: "Apply on Column Group:" },
111
+ React.createElement(Radio_1.RadioGroup, { value: data.ColumnGroupScope || 'Both', name: "columnGroupScope", orientation: "horizontal", onRadioChange: (columnGroupScope) => {
112
+ props.onChange({
113
+ ...data,
114
+ ColumnGroupScope: columnGroupScope,
115
+ });
116
+ } },
117
+ React.createElement(Radio_1.default, { className: "twa:ml-1", value: "Both" }, "Always"),
118
+ React.createElement(Radio_1.default, { className: "twa:ml-4", value: "Expanded" }, "When Expanded"),
119
+ React.createElement(Radio_1.default, { className: "twa:ml-4", value: "Collapsed" }, "When Collapsed")))))))));
102
120
  };
103
121
  exports.FormatColumnSettingsWizardSection = FormatColumnSettingsWizardSection;
@@ -11,9 +11,10 @@ const FormatColumnStyleWizardSection_1 = require("./FormatColumnStyleWizardSecti
11
11
  const FormatColumnFormatWizardSection_1 = require("./FormatColumnFormatWizardSection");
12
12
  const AdaptableContext_1 = require("../../AdaptableContext");
13
13
  const FormatColumnSettingsWizardSection_1 = require("./FormatColumnSettingsWizardSection");
14
+ const react_redux_1 = require("react-redux");
14
15
  const NewScopeComponent_1 = require("../../Components/NewScopeComponent");
15
16
  const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/ObjectFactory"));
16
- const react_redux_1 = require("react-redux");
17
+ const react_redux_2 = require("react-redux");
17
18
  const FormatColumnRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/FormatColumnRedux"));
18
19
  const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection");
19
20
  const Utilities_1 = require("../../Components/EntityRulesEditor/Utilities");
@@ -61,6 +62,7 @@ const adjustFormatColumn = (formatColumn, api) => {
61
62
  };
62
63
  function FormatColumnWizard(props) {
63
64
  const { api } = (0, AdaptableContext_1.useAdaptable)();
65
+ const allFormatColumns = (0, react_redux_1.useSelector)((state) => state.FormatColumn?.FormatColumns ?? []);
64
66
  const data = props.data ?? props.popupParams?.value;
65
67
  const [formatColumn, doSetFormatColumn] = (0, react_1.useState)(() => {
66
68
  let formatColumn = data ? (0, Helper_1.cloneObject)(data) : ObjectFactory_1.default.CreateEmptyFormatColumn();
@@ -78,7 +80,7 @@ function FormatColumnWizard(props) {
78
80
  const setFormatColumn = React.useCallback((formatColumn) => {
79
81
  doSetFormatColumn(adjustFormatColumn(formatColumn, api));
80
82
  }, []);
81
- const dispatch = (0, react_redux_1.useDispatch)();
83
+ const dispatch = (0, react_redux_2.useDispatch)();
82
84
  const handleFinish = () => {
83
85
  if (formatColumn?.DisplayFormat?.Options &&
84
86
  (0, ObjectExtensions_1.isObjectEmpty)(formatColumn?.DisplayFormat?.Options)) {
@@ -96,6 +98,24 @@ function FormatColumnWizard(props) {
96
98
  props.onFinishWizard(formatColumn);
97
99
  };
98
100
  return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, modal: props.modal, data: formatColumn, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
101
+ {
102
+ title: 'Settings',
103
+ details: 'Enter Name and set Additional Properties',
104
+ isValid: (formatColumnData) => {
105
+ if (!formatColumnData.Name) {
106
+ return 'Format Column Name cannot be blank';
107
+ }
108
+ if (allFormatColumns.some((fc) => fc.Name === formatColumnData.Name && fc.Uuid !== formatColumnData.Uuid)) {
109
+ return 'A Format Column already exists with that name';
110
+ }
111
+ return true;
112
+ },
113
+ renderSummary: FormatColumnSettingsWizardSection_1.renderFormatColumnSettingsSummary,
114
+ render: () => {
115
+ return (React.createElement(Flex_1.Box, { className: "twa:p-2" },
116
+ React.createElement(FormatColumnSettingsWizardSection_1.FormatColumnSettingsWizardSection, { onChange: setFormatColumn })));
117
+ },
118
+ },
99
119
  {
100
120
  title: 'Scope',
101
121
  details: 'Select which Columns will be formatted',
@@ -146,15 +166,6 @@ function FormatColumnWizard(props) {
146
166
  return React.createElement(FormatColumnFormatWizardSection_1.FormatColumnFormatWizardSection, { onChange: setFormatColumn });
147
167
  },
148
168
  },
149
- {
150
- title: 'Settings',
151
- details: 'Set Additional Properties',
152
- renderSummary: FormatColumnSettingsWizardSection_1.renderFormatColumnSettingsSummary,
153
- render: () => {
154
- return (React.createElement(Flex_1.Box, { className: "twa:p-2" },
155
- React.createElement(FormatColumnSettingsWizardSection_1.FormatColumnSettingsWizardSection, { onChange: setFormatColumn })));
156
- },
157
- },
158
169
  {
159
170
  details: 'Select Format Column Tags',
160
171
  title: 'Tags',
@@ -32,6 +32,10 @@ const GridFilterExpressionEditor = (props) => {
32
32
  const onRunQuery = (expression) => {
33
33
  api.filterApi.gridFilterApi.setGridFilterExpression(expression);
34
34
  };
35
+ const onClearExpression = () => {
36
+ setExpression('');
37
+ api.filterApi.gridFilterApi.clearGridFilter();
38
+ };
35
39
  const onAddNamedQuery = (namedQuery) => dispatch(NamedQueryRedux.NamedQueryAdd(namedQuery));
36
40
  const handleSaveQuery = () => {
37
41
  dispatch((0, PopupRedux_1.PopupShowForm)({
@@ -84,7 +88,7 @@ const GridFilterExpressionEditor = (props) => {
84
88
  }));
85
89
  };
86
90
  const expressionEditorProps = (0, useGridFilterOptionsForExpressionEditor_1.useGridFilterOptionsForExpressionEditorProps)();
87
- const actionsDisabled = !isExpressionValid || (0, StringExtensions_1.IsNullOrEmpty)(expression) || hasNamedQueryError || isExistingNamedQuery;
91
+ const actionsDisabled = !isExpressionValid || (0, StringExtensions_1.IsNullOrEmpty)(expression) || hasNamedQueryError;
88
92
  return (React.createElement(NamedQueryContext_1.NamedQueryContext.Provider, { value: {
89
93
  namedQuery: namedQuery,
90
94
  setNamedQuery: (newQuery) => {
@@ -99,6 +103,7 @@ const GridFilterExpressionEditor = (props) => {
99
103
  } }, "CLOSE")),
100
104
  React.createElement(Flex_1.Box, { className: "twa:flex-1" }),
101
105
  React.createElement(SimpleButton_1.default, { disabled: actionsDisabled, onClick: handleSaveQuery, icon: "save" }, "Save Query"),
106
+ React.createElement(SimpleButton_1.default, { "data-name": "action-clear", onClick: onClearExpression, icon: "close", disabled: (0, StringExtensions_1.IsNullOrEmpty)(expression), className: "twa:ml-1" }, "Clear Query"),
102
107
  React.createElement(SimpleButton_1.default, { variant: "raised", tone: "accent", "data-name": "action-run", className: "twa:m-1", icon: "play", onClick: () => {
103
108
  if (namedQuery) {
104
109
  onAddNamedQuery({
@@ -3,100 +3,63 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GridFilterPanelControl = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
+ const clsx_1 = tslib_1.__importDefault(require("clsx"));
6
7
  const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
7
- const DropdownButton_1 = tslib_1.__importDefault(require("../../components/DropdownButton"));
8
8
  const FieldWrap_1 = tslib_1.__importDefault(require("../../components/FieldWrap"));
9
- const Textarea_1 = tslib_1.__importDefault(require("../../components/Textarea"));
10
- const icons_1 = require("../../components/icons");
11
9
  const ButtonClear_1 = require("../Components/Buttons/ButtonClear");
12
10
  const ButtonExpand_1 = require("../Components/Buttons/ButtonExpand");
13
11
  const ButtonInvalid_1 = require("../Components/Buttons/ButtonInvalid");
14
12
  const ButtonPause_1 = require("../Components/Buttons/ButtonPause");
15
- const ButtonPlay_1 = require("../Components/Buttons/ButtonPlay");
16
13
  const ButtonSave_1 = require("../Components/Buttons/ButtonSave");
17
14
  const ButtonUnsuspend_1 = require("../Components/Buttons/ButtonUnsuspend");
18
15
  const NamedQuerySelector_1 = require("./NamedQuerySelector");
19
16
  const useGridFilterExpressionEditor_1 = require("./useGridFilterExpressionEditor");
20
17
  const Flex_1 = require("../../components/Flex");
18
+ const Tooltip_1 = tslib_1.__importDefault(require("../../components/Tooltip"));
21
19
  const QueryViewPanelComponent = (props) => {
22
- const { cachedQueries, expression, setExpression, isExpressionNamedQuery, isExpressionValid, isSuspended, gridFilter, isAdaptableReady, namedQueries, availableColumns, runQuery, onExpand, clearQuery, namedQueryModuleAccessLevel, saveQuery, suspendGridFilter, unSuspendGridFilter, setGridFilterExpression, gridFilterAccessLevel, isReadOnly, } = (0, useGridFilterExpressionEditor_1.useGridFilterExpressionEditor)();
20
+ const { cachedQueries, expression, isExpressionNamedQuery, isExpressionValid, isSuspended, gridFilter, isAdaptableReady, namedQueries, runQuery, onExpand, clearQuery, namedQueryModuleAccessLevel, saveQuery, suspendGridFilter, unSuspendGridFilter, setGridFilterExpression, gridFilterAccessLevel, isReadOnly, } = (0, useGridFilterExpressionEditor_1.useGridFilterExpressionEditor)();
23
21
  if (!isAdaptableReady) {
24
22
  return null;
25
23
  }
26
24
  const elementType = props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
27
25
  const disabled = isReadOnly || isSuspended || gridFilterAccessLevel === 'ReadOnly';
28
- const handleEnter = (e) => {
29
- if (e.key === 'Enter') {
30
- e.preventDefault();
31
- runQuery();
32
- }
33
- };
34
26
  const buttonExpand = (React.createElement(ButtonExpand_1.ButtonExpand, { disabled: disabled, accessLevel: gridFilterAccessLevel, variant: "text", tone: "neutral", onClick: onExpand, tooltip: "Edit the Expression in UI", className: "twa:ml-1" }));
35
- const renderTextInput = () => {
36
- return props.viewType === 'Toolbar' ? (React.createElement(FieldWrap_1.default, { className: "twa:mr-1 twa:w-[500px] twa:overflow-visible" },
37
- buttonExpand,
38
- React.createElement(Flex_1.Box, { className: "twa:flex-1 twa:relative twa:h-full" },
39
- React.createElement(Textarea_1.default, { "data-name": "grid-filter-input", autoResizeOnFocus: true, style: {
40
- left: 0,
41
- top: 0,
42
- right: 0,
43
- border: 0,
44
- position: 'absolute',
45
- resize: 'none',
46
- fontFamily: 'monospace',
47
- fontSize: 12,
48
- maxHeight: 52,
49
- height: '100%',
50
- paddingTop: 6,
51
- overflow: 'hidden',
52
- zIndex: 100,
53
- }, placeholder: "Grid Filter", onChange: (x) => setExpression(x.target.value), value: expression })),
54
- isExpressionValid && (React.createElement(ButtonPlay_1.ButtonPlay, { onClick: () => runQuery(), tooltip: '', accessLevel: gridFilterAccessLevel, variant: "text", tone: "neutral", disabled: disabled || expression == '' || expression == gridFilter?.Expression, className: "twa:mr-1" })),
55
- gridFilter && !isExpressionValid && (React.createElement(ButtonInvalid_1.ButtonInvalid, { variant: "text", tone: "neutral", tooltip: "Invalid Grid Filter", className: "twa:mr-1" })),
56
- ' ',
57
- StringExtensions_1.default.IsNotNullOrEmpty(expression) && (React.createElement(ButtonClear_1.ButtonClear, { onClick: () => clearQuery(), tooltip: "Clear Grid Filter", accessLevel: gridFilterAccessLevel })))) : (React.createElement(FieldWrap_1.default, { className: "twa:w-full twa:overflow-visible" },
58
- ' ',
27
+ const renderExpressionLabel = () => {
28
+ const baseClasses = 'twa:font-mono twa:text-xs twa:py-1.5 twa:px-2 twa:overflow-hidden twa:text-ellipsis twa:whitespace-nowrap twa:bg-white twa:rounded twa:cursor-pointer twa:h-7 twa:leading-4';
29
+ const placeholderClasses = 'twa:text-gray-400 twa:italic';
30
+ const labelClassName = (0, clsx_1.default)(baseClasses, {
31
+ [placeholderClasses]: !expression,
32
+ });
33
+ const expressionLabel = (React.createElement(Tooltip_1.default, { label: expression || 'Click to edit Grid Filter' },
34
+ React.createElement(Flex_1.Box, { className: (0, clsx_1.default)('twa:flex-1 twa:h-full twa:min-w-0', labelClassName), "data-name": "grid-filter-input", onClick: onExpand }, expression || 'Grid Filter')));
35
+ return (React.createElement(FieldWrap_1.default, { className: "twa:flex-1 twa:min-w-0 twa:overflow-visible" },
59
36
  buttonExpand,
60
- React.createElement(Flex_1.Box, { className: "twa:flex-1 twa:relative twa:w-full twa:min-h-[40px]" },
61
- React.createElement(Textarea_1.default, { "data-name": "grid-filter-input", autoResizeOnFocus: true, style: {
62
- left: 0,
63
- top: 0,
64
- right: 0,
65
- border: 0,
66
- position: 'absolute',
67
- resize: 'none',
68
- fontFamily: 'monospace',
69
- fontSize: 12,
70
- maxHeight: 60,
71
- paddingTop: 7,
72
- zIndex: 100,
73
- height: '100%',
74
- overflow: 'hidden',
75
- }, placeholder: "Grid Filter", onChange: (x) => setExpression(x.target.value), value: expression }))));
37
+ expressionLabel,
38
+ gridFilter && !isExpressionValid && (React.createElement(ButtonInvalid_1.ButtonInvalid, { variant: "text", tone: "neutral", tooltip: "Invalid Grid Filter" }))));
76
39
  };
77
- const saveButton = (React.createElement(ButtonSave_1.ButtonSave, { onClick: () => saveQuery(), tooltip: "Save as Named Query", accessLevel: namedQueryModuleAccessLevel, disabled: disabled || !isExpressionValid || isExpressionNamedQuery || expression == '', variant: "text", tone: "neutral", className: "twa:mr-1" }));
78
- const suspendButton = (React.createElement(ButtonPause_1.ButtonPause, { onClick: () => suspendGridFilter(), tooltip: "Suspend Grid Filter", accessLevel: gridFilterAccessLevel, disabled: disabled || !isExpressionValid, variant: "text", tone: "neutral", className: "twa:mr-1" }));
79
- const unSuspendButton = (React.createElement(ButtonUnsuspend_1.ButtonUnsuspend, { onClick: () => unSuspendGridFilter(), tooltip: "Unsuspend Grid Filter", accessLevel: gridFilterAccessLevel, disabled: !isExpressionValid, variant: "text", tone: "neutral", className: "twa:mr-1" }));
80
- const namedQuerySelector = (React.createElement(NamedQuerySelector_1.NamedQuerySelector, { namedQueries: namedQueries, cachedQueries: cachedQueries, currentQuery: gridFilter?.Expression, onSelect: (query) => runQuery(query), setGridFilterExpression: (query) => setGridFilterExpression(query) }));
81
- const columnsDropdown = (React.createElement(DropdownButton_1.default, { disabled: disabled, accessLevel: gridFilterAccessLevel, variant: "text", items: availableColumns, className: "twa:mr-1", tooltip: "Pick Columns" },
82
- React.createElement(icons_1.Icon, { name: 'list' })));
40
+ const hasExpression = StringExtensions_1.default.IsNotNullOrEmpty(expression);
41
+ const hasActiveGridFilter = gridFilter != null && hasExpression;
42
+ const hasNamedQueries = namedQueries && namedQueries.length > 0;
43
+ const clearButton = hasExpression ? (React.createElement(ButtonClear_1.ButtonClear, { onClick: () => clearQuery(), tooltip: "Clear Grid Filter", accessLevel: gridFilterAccessLevel, variant: "text", tone: "neutral" })) : null;
44
+ const saveButton = hasExpression ? (React.createElement(ButtonSave_1.ButtonSave, { onClick: () => saveQuery(), tooltip: "Save as Named Query", accessLevel: namedQueryModuleAccessLevel, disabled: isReadOnly || gridFilterAccessLevel === 'ReadOnly' || !isExpressionValid || isExpressionNamedQuery, variant: "text", tone: "neutral" })) : null;
45
+ const suspendButton = hasActiveGridFilter ? (React.createElement(ButtonPause_1.ButtonPause, { onClick: () => suspendGridFilter(), tooltip: "Suspend Grid Filter", accessLevel: gridFilterAccessLevel, disabled: disabled || !isExpressionValid, variant: "text", tone: "neutral" })) : null;
46
+ const unSuspendButton = hasActiveGridFilter ? (React.createElement(ButtonUnsuspend_1.ButtonUnsuspend, { onClick: () => unSuspendGridFilter(), tooltip: "Unsuspend Grid Filter", accessLevel: gridFilterAccessLevel, disabled: !isExpressionValid, variant: "text", tone: "neutral" })) : null;
47
+ const namedQuerySelector = hasNamedQueries ? (React.createElement(NamedQuerySelector_1.NamedQuerySelector, { namedQueries: namedQueries, cachedQueries: cachedQueries, currentQuery: gridFilter?.Expression, onSelect: (query) => runQuery(query), setGridFilterExpression: (query) => setGridFilterExpression(query) })) : null;
83
48
  const renderButtons = () => {
84
- return props.viewType === 'Toolbar' ? (React.createElement(React.Fragment, null,
85
- saveButton,
49
+ return (React.createElement(React.Fragment, null,
50
+ clearButton,
86
51
  isSuspended ? unSuspendButton : suspendButton,
87
- columnsDropdown,
88
- namedQuerySelector,
89
- ' ')) : (React.createElement(React.Fragment, null,
90
- React.createElement(ButtonPlay_1.ButtonPlay, { "aria-label": 'Run Grid Filter', onClick: () => runQuery(), tooltip: "Run Grid Filter", accessLevel: gridFilterAccessLevel, variant: "text", tone: "neutral", disabled: disabled || !isExpressionValid || expression == '' || expression == gridFilter, className: "twa:mr-1" }),
91
- ' ',
92
- React.createElement(ButtonClear_1.ButtonClear, { onClick: () => clearQuery(), tooltip: "Clear Grid Filter", accessLevel: gridFilterAccessLevel, disabled: expression == '' }),
93
- ' ',
94
52
  saveButton,
95
- isSuspended ? unSuspendButton : suspendButton,
96
53
  namedQuerySelector));
97
54
  };
98
- return (React.createElement(Flex_1.Flex, { onKeyDown: handleEnter, flexDirection: "row", className: `ab-${elementType}__Query__wrap`, flexWrap: props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap' },
99
- React.createElement(Flex_1.Flex, { className: props.viewType === 'ToolPanel' ? 'twa:w-full' : 'twa:w-auto' }, renderTextInput()),
100
- React.createElement(Flex_1.Flex, null, renderButtons())));
55
+ const isToolbar = props.viewType === 'Toolbar';
56
+ return (React.createElement(Flex_1.Flex, { flexDirection: isToolbar ? 'row' : 'column', className: (0, clsx_1.default)(`ab-${elementType}__Query__wrap`, {
57
+ 'twa:w-[500px]': isToolbar,
58
+ }) },
59
+ React.createElement(Flex_1.Flex, { className: (0, clsx_1.default)({ 'twa:flex-1 twa:min-w-0': isToolbar }) }, renderExpressionLabel()),
60
+ React.createElement(Flex_1.Flex, { className: (0, clsx_1.default)('twa:flex-shrink-0', {
61
+ 'twa:pl-1': isToolbar,
62
+ 'twa:pt-1': !isToolbar,
63
+ }) }, renderButtons())));
101
64
  };
102
65
  exports.GridFilterPanelControl = QueryViewPanelComponent;