@adaptabletools/adaptable-cjs 23.0.0-canary.7 → 23.0.0-canary.8

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 (90) hide show
  1. package/index.css +75 -9
  2. package/package.json +1 -1
  3. package/src/AdaptableState/StyledColumnState.d.ts +8 -850
  4. package/src/AdaptableState/StyledColumnState.js +0 -10
  5. package/src/AdaptableState/StyledColumns/BadgeStyle.d.ts +143 -0
  6. package/src/AdaptableState/StyledColumns/BadgeStyle.js +12 -0
  7. package/src/AdaptableState/StyledColumns/BulletChartStyle.d.ts +147 -0
  8. package/src/AdaptableState/StyledColumns/BulletChartStyle.js +2 -0
  9. package/src/AdaptableState/StyledColumns/Common/BarChartCellText.d.ts +60 -0
  10. package/src/AdaptableState/StyledColumns/Common/BarChartCellText.js +7 -0
  11. package/src/AdaptableState/StyledColumns/Common/BarChartMarker.d.ts +24 -0
  12. package/src/AdaptableState/StyledColumns/Common/BarChartMarker.js +6 -0
  13. package/src/AdaptableState/StyledColumns/Common/CellTextOptions.d.ts +13 -0
  14. package/src/AdaptableState/StyledColumns/Common/CellTextOptions.js +7 -0
  15. package/src/AdaptableState/StyledColumns/Common/NumericStyledColumn.d.ts +79 -0
  16. package/src/AdaptableState/StyledColumns/Common/NumericStyledColumn.js +10 -0
  17. package/src/AdaptableState/StyledColumns/GradientStyle.d.ts +48 -0
  18. package/src/AdaptableState/StyledColumns/GradientStyle.js +2 -0
  19. package/src/AdaptableState/StyledColumns/IconStyle.d.ts +158 -0
  20. package/src/AdaptableState/StyledColumns/IconStyle.js +2 -0
  21. package/src/AdaptableState/StyledColumns/PercentBarStyle.d.ts +32 -0
  22. package/src/AdaptableState/StyledColumns/PercentBarStyle.js +2 -0
  23. package/src/AdaptableState/StyledColumns/RangeBarStyle.d.ts +155 -0
  24. package/src/AdaptableState/StyledColumns/RangeBarStyle.js +2 -0
  25. package/src/AdaptableState/StyledColumns/RatingStyle.d.ts +111 -0
  26. package/src/AdaptableState/StyledColumns/RatingStyle.js +2 -0
  27. package/src/AdaptableState/StyledColumns/SparklineStyle.d.ts +21 -0
  28. package/src/AdaptableState/StyledColumns/SparklineStyle.js +2 -0
  29. package/src/Api/ColumnScopeApi.d.ts +1 -1
  30. package/src/Api/Implementation/ColumnScopeApiImpl.d.ts +1 -1
  31. package/src/Api/Internal/StyledColumnInternalApi.d.ts +3 -1
  32. package/src/Utilities/Helpers/IconStylePresets.d.ts +1 -1
  33. package/src/Utilities/Helpers/StyledColumnGradientHelper.d.ts +3 -1
  34. package/src/Utilities/Helpers/barChartCellText.d.ts +63 -0
  35. package/src/Utilities/Helpers/barChartCellText.js +333 -0
  36. package/src/Utilities/Helpers/percentBarPreviewHelper.d.ts +2 -1
  37. package/src/Utilities/Helpers/percentBarPreviewHelper.js +3 -8
  38. package/src/View/Alert/Wizard/AlertButtonsEditor.js +158 -125
  39. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +1 -1
  40. package/src/View/Alert/Wizard/AlertWizard.js +9 -1
  41. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +3 -2
  42. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +3 -2
  43. package/src/View/Components/AdaptableObjectList/objectListActionButtonStyles.d.ts +2 -0
  44. package/src/View/Components/AdaptableObjectList/objectListActionButtonStyles.js +6 -0
  45. package/src/View/Components/Buttons/EntityListActionButtons.js +1 -1
  46. package/src/View/Components/Buttons/SuspendToggleButton/SuspendToggleButton.d.ts +1 -0
  47. package/src/View/Components/Buttons/SuspendToggleButton/SuspendToggleButton.js +8 -8
  48. package/src/View/Components/ColumnFilter/ColumnFilter.js +14 -1
  49. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +1 -1
  50. package/src/View/Components/RangesComponent.d.ts +2 -1
  51. package/src/View/Export/ExportSchedulesTab.js +3 -4
  52. package/src/View/Filter/FilterViewPanel.js +1 -1
  53. package/src/View/Layout/Wizard/sections/RowSummarySection.js +128 -102
  54. package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +1 -1
  55. package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +36 -30
  56. package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +1 -3
  57. package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +73 -58
  58. package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +38 -11
  59. package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +86 -44
  60. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarChartCellTextLayoutEditor.d.ts +9 -0
  61. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarChartCellTextLayoutEditor.js +40 -0
  62. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarChartCellTextPreview.d.ts +23 -0
  63. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarChartCellTextPreview.js +62 -0
  64. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.d.ts +1 -1
  65. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/GradientSummaryPreview.d.ts +2 -1
  66. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.d.ts +1 -1
  67. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.js +3 -2
  68. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.d.ts +2 -1
  69. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.js +13 -17
  70. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnChartListPreviews.d.ts +2 -1
  71. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnChartListPreviews.js +5 -5
  72. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.js +2 -2
  73. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.js +13 -6
  74. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.js +11 -17
  75. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.d.ts +2 -1
  76. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +18 -54
  77. package/src/agGrid/AgGridColumnAdapter.js +2 -1
  78. package/src/agGrid/cellRenderers/BadgeRenderer.js +7 -5
  79. package/src/agGrid/cellRenderers/BulletChartRenderer.js +43 -42
  80. package/src/agGrid/cellRenderers/IconRenderer.d.ts +2 -1
  81. package/src/agGrid/cellRenderers/IconRenderer.js +13 -11
  82. package/src/agGrid/cellRenderers/PercentBarRenderer.js +24 -96
  83. package/src/agGrid/cellRenderers/RangeBarRenderer.js +49 -46
  84. package/src/env.js +2 -2
  85. package/src/metamodel/adaptable.metamodel.d.ts +80 -14
  86. package/src/metamodel/adaptable.metamodel.js +1 -1
  87. package/src/migration/VersionUpgrade23.d.ts +27 -31
  88. package/src/migration/VersionUpgrade23.js +110 -29
  89. package/src/types.d.ts +12 -1
  90. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -14,7 +14,10 @@ const AdaptableIconSelector_1 = require("../../Components/AdaptableIconSelector"
14
14
  const Flex_1 = require("../../../components/Flex");
15
15
  const sentenceCase_1 = tslib_1.__importDefault(require("../../../Utilities/utils/sentenceCase"));
16
16
  const NewSelect_1 = require("../../../components/NewSelect");
17
- const Card_1 = require("../../../components/Card");
17
+ const Tag_1 = require("../../../components/Tag");
18
+ const CollapsibleWizardCard_1 = require("../../Wizard/CollapsibleWizardCard");
19
+ const utils_1 = require("../../../lib/utils");
20
+ const alertButtonCardId = (index) => `alert-button-${index}`;
18
21
  const TONE_OPTIONS = [
19
22
  {
20
23
  label: 'Tone: Use Alert Tone',
@@ -38,6 +41,125 @@ const AlertButtonPreview = ({ button, messageType }) => {
38
41
  function renderTone(option) {
39
42
  return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(SimpleButton_1.default, { className: "twa:mr-2 twa:w-[10px] twa:h-[10px] twa:line-height-0 twa:rounded-[100%] twa:bg-current", tone: option.value, variant: "text" }), option.label] }));
40
43
  }
44
+ const getButtonCommands = (button) => {
45
+ if (button.Command && typeof button.Command === 'string') {
46
+ return [button.Command];
47
+ }
48
+ if (button.Command && Array.isArray(button.Command)) {
49
+ return button.Command;
50
+ }
51
+ return [];
52
+ };
53
+ const AlertButtonActionTags = ({ button }) => {
54
+ const commands = getButtonCommands(button);
55
+ if (!commands.length) {
56
+ return null;
57
+ }
58
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: commands.map((command) => ((0, jsx_runtime_1.jsx)(Tag_1.Tag, { className: "twa:shrink-0", children: (0, sentenceCase_1.default)(command) }, command))) }));
59
+ };
60
+ const AlertButtonCardSummary = ({ button }) => {
61
+ const commands = getButtonCommands(button);
62
+ if (!commands.length) {
63
+ return (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: "No actions" });
64
+ }
65
+ return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexWrap: "wrap", className: "twa:gap-1", children: (0, jsx_runtime_1.jsx)(AlertButtonActionTags, { button: button }) }));
66
+ };
67
+ const AlertButtonCompactSummary = ({ button }) => ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-1 twa:min-w-0 twa:overflow-hidden twa:flex-wrap", children: [(0, jsx_runtime_1.jsx)(Tag_1.Tag, { className: "twa:shrink-0", children: button.Label || 'Untitled' }), (0, jsx_runtime_1.jsx)(AlertButtonActionTags, { button: button })] }));
68
+ const AlertButtonEditorForm = ({ button, index, alertButtons, buttonCommands, onChange, }) => {
69
+ const buttonStyle = button.ButtonStyle;
70
+ const buttonLabel = button.Label;
71
+ const btnCommands = getButtonCommands(button);
72
+ const btnUserFunctions = btnCommands.filter((command) => !buttonCommands.includes(command));
73
+ const setVariant = (variant) => {
74
+ onChange(alertButtons.map((btn, i) => {
75
+ if (i === index) {
76
+ const nextButtonStyle = { ...btn.ButtonStyle };
77
+ nextButtonStyle.variant = variant;
78
+ return {
79
+ ...btn,
80
+ ButtonStyle: nextButtonStyle,
81
+ };
82
+ }
83
+ return btn;
84
+ }));
85
+ };
86
+ const setTone = (tone) => {
87
+ onChange(alertButtons.map((btn, i) => {
88
+ if (i === index) {
89
+ const nextButtonStyle = { ...btn.ButtonStyle };
90
+ if (tone == null) {
91
+ delete nextButtonStyle.tone;
92
+ }
93
+ else {
94
+ nextButtonStyle.tone = tone;
95
+ }
96
+ return {
97
+ ...btn,
98
+ ButtonStyle: nextButtonStyle,
99
+ };
100
+ }
101
+ return btn;
102
+ }));
103
+ };
104
+ const handleCommandChange = (checked, commandName) => {
105
+ let commands = btnCommands;
106
+ if (!checked) {
107
+ commands = commands.filter((a) => a !== commandName);
108
+ }
109
+ else {
110
+ commands = [...commands, commandName];
111
+ }
112
+ onChange(alertButtons.map((btn, i) => {
113
+ if (i === index) {
114
+ return {
115
+ ...btn,
116
+ Command: commands.length ? commands : undefined,
117
+ };
118
+ }
119
+ return btn;
120
+ }));
121
+ };
122
+ let iconSelector = null;
123
+ if (!button.icon || (button.icon && 'name' in button.icon)) {
124
+ iconSelector = ((0, jsx_runtime_1.jsx)(AdaptableIconSelector_1.AdaptableIconSelector, { value: button.icon && 'name' in button.icon ? button?.icon?.name : '', onChange: (iconName) => {
125
+ onChange(alertButtons.map((btn) => {
126
+ if (btn === button) {
127
+ return {
128
+ ...btn,
129
+ icon: {
130
+ name: iconName,
131
+ },
132
+ };
133
+ }
134
+ return btn;
135
+ }));
136
+ } }));
137
+ }
138
+ return ((0, jsx_runtime_1.jsxs)(FormLayout_1.default, { children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Button Text" }), children: (0, jsx_runtime_1.jsx)(Input_1.default, { value: buttonLabel, className: "twa:max-w-[200px]", onChange: (e) => {
139
+ onChange(alertButtons.map((btn, i) => {
140
+ if (i === index) {
141
+ return { ...btn, Label: e.target.value };
142
+ }
143
+ return btn;
144
+ }));
145
+ } }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Style" }), children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", className: "twa:gap-2 twa:flex-wrap", children: [(0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { items: ['text', 'outlined', 'raised'].map((variant) => {
146
+ return {
147
+ label: StringExtensions_1.default.CapitaliseFirstLetter(variant),
148
+ value: variant,
149
+ };
150
+ }), renderValue: (option) => `Variant: ${option.label}`, value: buttonStyle?.variant, onValueChange: (value) => {
151
+ setVariant(value);
152
+ } }), (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { items: TONE_OPTIONS, onValueChange: (value) => {
153
+ if (value === 'text') {
154
+ setTone(null);
155
+ return;
156
+ }
157
+ setTone(value);
158
+ }, value: buttonStyle?.tone ?? 'text' })] }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Actions" }), children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", className: "twa:gap-3 twa:flex-wrap", children: [buttonCommands.map((commandName) => {
159
+ return ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { onChange: (checked) => handleCommandChange(checked, commandName), checked: button.Command === commandName ||
160
+ (Array.isArray(button.Command) && button.Command.includes(commandName)), children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: (0, sentenceCase_1.default)(commandName) }) }, commandName));
161
+ }), btnUserFunctions.length ? ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { checked: true, disabled: true, children: (0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:text-2", children: ["User function", btnUserFunctions.length > 1 ? 's' : '', ": ", btnUserFunctions.join(', ')] }) })) : null] }) }), iconSelector && ((0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Icon" }), children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { children: iconSelector }) }))] }));
162
+ };
41
163
  const AlertButtonsEditor = (props) => {
42
164
  const { api, adaptableAlert } = props;
43
165
  const onChange = (newButtons) => {
@@ -45,22 +167,14 @@ const AlertButtonsEditor = (props) => {
45
167
  };
46
168
  const alertDefinition = adaptableAlert.alertDefinition;
47
169
  const messageType = alertDefinition?.MessageType ?? 'Info';
48
- // const rowAddedAlert =
49
- // api.alertApi.internalApi.isAlertDefinitionForAddedRowChangeEvent(alertDefinition);
50
170
  const isRowRemovedAlert = api.alertApi.internalApi.isAlertDefinitionForRemovedRowChangeEvent(alertDefinition);
51
- // except row change
52
171
  const hasHighlightCell = props.alertType !== 'RowChange';
53
- // all, except row removed
54
172
  const hasHighlightRow = !isRowRemovedAlert;
55
- // except row removed
56
173
  const hasJumpToCell = props.alertType !== 'RowChange';
57
- // all
58
174
  const hasJumpToRow = !isRowRemovedAlert;
59
- // all
60
175
  const hasSuspend = true;
61
- // only data change
62
176
  const hasUndo = props.alertType === 'DataChange';
63
- const AlertButtons = (0, Helper_1.cloneObject)(props.AlertButtons || []) || [];
177
+ const alertButtons = (0, Helper_1.cloneObject)(props.AlertButtons || []) || [];
64
178
  const buttonCommands = [];
65
179
  if (hasHighlightRow) {
66
180
  buttonCommands.push('highlight-row');
@@ -86,121 +200,40 @@ const AlertButtonsEditor = (props) => {
86
200
  buttonCommands.push(ch.name);
87
201
  });
88
202
  }
89
- return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:mt-3", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", justifyContent: "space-between", className: "twa:mb-3", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2 twa:max-w-[520px]", children: "Add buttons to the notification and set actions to perform when clicked" }), (0, jsx_runtime_1.jsx)(ButtonNew_1.ButtonNew, { onClick: () => {
90
- onChange([
91
- ...(AlertButtons || []),
92
- {
93
- Label: 'OK',
94
- ButtonStyle: {
95
- variant: 'raised',
96
- },
97
- },
98
- ]);
99
- }, children: "Add" })] }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-3", children: AlertButtons.map((button, index) => {
100
- let buttonStyle = button.ButtonStyle;
101
- let buttonLabel = button.Label;
102
- let btnCommands = [];
103
- if (button.Command && typeof button.Command === 'string') {
104
- btnCommands = [button.Command];
105
- }
106
- else if (button.Command && Array.isArray(button.Command)) {
107
- btnCommands = button.Command;
108
- }
109
- // filter out the adaptable standard commands
110
- const btnUserFunctions = btnCommands.filter((command) => !buttonCommands.includes(command));
111
- const setVariant = (variant) => {
112
- onChange(AlertButtons.map((btn, i) => {
113
- if (i === index) {
114
- const buttonStyle = { ...btn.ButtonStyle };
115
- buttonStyle.variant = variant;
116
- return {
117
- ...btn,
118
- ButtonStyle: buttonStyle,
119
- };
120
- }
121
- return btn;
122
- }));
123
- };
124
- const setTone = (tone) => {
125
- onChange(AlertButtons.map((btn, i) => {
126
- if (i === index) {
127
- const buttonStyle = { ...btn.ButtonStyle };
128
- if (tone == null) {
129
- delete buttonStyle.tone;
130
- }
131
- else {
132
- buttonStyle.tone = tone;
133
- }
134
- return {
135
- ...btn,
136
- ButtonStyle: buttonStyle,
137
- };
138
- }
139
- return btn;
140
- }));
141
- };
142
- const handleCommandChange = (checked, commandName) => {
143
- let commands = btnCommands;
144
- if (!checked) {
145
- // remove current Command
146
- commands = commands.filter((a) => a !== commandName);
147
- }
148
- else {
149
- commands = [...commands, commandName];
150
- }
151
- onChange(AlertButtons.map((btn, i) => {
152
- if (i === index) {
153
- return {
154
- ...btn,
155
- Command: commands.length ? commands : undefined,
156
- };
157
- }
158
- return btn;
159
- }));
160
- };
161
- let iconSelector = null;
162
- if (!button.icon || (button.icon && 'name' in button.icon)) {
163
- iconSelector = ((0, jsx_runtime_1.jsx)(AdaptableIconSelector_1.AdaptableIconSelector, { value: button.icon && 'name' in button.icon ? button?.icon?.name : '', onChange: (iconName) => {
164
- onChange(AlertButtons.map((btn) => {
165
- if (btn === button) {
166
- return {
167
- ...btn,
168
- icon: {
169
- name: iconName,
170
- },
171
- };
172
- }
173
- return btn;
174
- }));
175
- } }));
176
- }
177
- return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { className: "twa:justify-between twa:gap-3", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:font-medium twa:shrink-0", children: ["Button ", index + 1] }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { justifyContent: "center", className: "twa:flex-1 twa:min-w-0", children: (0, jsx_runtime_1.jsx)(AlertButtonPreview, { button: button, messageType: messageType }) }), (0, jsx_runtime_1.jsx)(SimpleButton_1.default, { icon: "close", tone: "error", disabled: AlertButtons.length <= 1, variant: "text", tooltip: AlertButtons.length <= 1 ? 'Cannot remove last button' : 'Remove button', onClick: () => {
178
- onChange(AlertButtons.filter((btn) => btn !== button));
179
- } })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Button Text" }), children: (0, jsx_runtime_1.jsx)(Input_1.default, { value: buttonLabel, className: "twa:max-w-[200px]", onChange: (e) => {
180
- onChange(AlertButtons.map((btn, i) => {
181
- if (i === index) {
182
- return { ...btn, Label: e.target.value };
183
- }
184
- return btn;
185
- }));
186
- } }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Style" }), children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", className: "twa:gap-2 twa:flex-wrap", children: [(0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { items: ['text', 'outlined', 'raised'].map((variant) => {
187
- return {
188
- label: StringExtensions_1.default.CapitaliseFirstLetter(variant),
189
- value: variant,
190
- };
191
- }), renderValue: (option) => `Variant: ${option.label}`, value: buttonStyle?.variant, onValueChange: (value) => {
192
- setVariant(value);
193
- } }), (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { items: TONE_OPTIONS, onValueChange: (value) => {
194
- if (value === 'text') {
195
- setTone(null);
196
- return;
197
- }
198
- setTone(value);
199
- }, value: buttonStyle?.tone ?? 'text' })] }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Actions" }), children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", className: "twa:gap-3 twa:flex-wrap", children: [buttonCommands.map((commandName) => {
200
- return ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { onChange: (checked) => handleCommandChange(checked, commandName), checked: button.Command === commandName ||
201
- (Array.isArray(button.Command) &&
202
- button.Command.includes(commandName)), children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: (0, sentenceCase_1.default)(commandName) }) }, commandName));
203
- }), btnUserFunctions.length ? ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { checked: true, disabled: true, children: (0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:text-2", children: ["User function", btnUserFunctions.length > 1 ? 's' : '', ":", ' ', btnUserFunctions.join(', ')] }) })) : null] }) }), iconSelector && ((0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Icon" }), children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { children: iconSelector }) }))] }) })] }, index));
203
+ const { bindCard, hasExpandedCard, expandedFillsSpace, expandedId, setExpandedId } = (0, CollapsibleWizardCard_1.useWizardCardAccordion)(null);
204
+ const handleAddButton = () => {
205
+ const newIndex = alertButtons.length;
206
+ onChange([
207
+ ...(alertButtons || []),
208
+ {
209
+ Label: 'OK',
210
+ ButtonStyle: {
211
+ variant: 'raised',
212
+ },
213
+ },
214
+ ]);
215
+ setExpandedId(alertButtonCardId(newIndex));
216
+ };
217
+ const handleDeleteButton = (index) => {
218
+ if (alertButtons.length <= 1) {
219
+ return;
220
+ }
221
+ const cardId = alertButtonCardId(index);
222
+ onChange(alertButtons.filter((_, i) => i !== index));
223
+ if (expandedId === cardId) {
224
+ setExpandedId(null);
225
+ return;
226
+ }
227
+ if (expandedId?.startsWith('alert-button-')) {
228
+ const expandedIndex = Number(expandedId.replace('alert-button-', ''));
229
+ if (!Number.isNaN(expandedIndex) && expandedIndex > index) {
230
+ setExpandedId(alertButtonCardId(expandedIndex - 1));
231
+ }
232
+ }
233
+ };
234
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: (0, utils_1.cn)((0, CollapsibleWizardCard_1.getWizardAccordionSectionClassName)(hasExpandedCard, expandedFillsSpace), 'twa:mt-3'), children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", justifyContent: "space-between", className: "twa:mb-2 twa:shrink-0", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2 twa:max-w-[520px]", children: "Add buttons to the notification and set actions to perform when clicked" }), (0, jsx_runtime_1.jsx)(ButtonNew_1.ButtonNew, { onClick: handleAddButton, children: "Add" })] }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-3 twa:min-h-0", children: alertButtons.map((button, index) => {
235
+ const cardBinding = bindCard(alertButtonCardId(index));
236
+ return ((0, jsx_runtime_1.jsx)(CollapsibleWizardCard_1.CollapsibleWizardCard, { ...cardBinding, surface: "panel", "data-name": `alert-button-${index}`, title: `Button ${index + 1}`, help: "Set button text, style, icon, and actions", collapsedHelp: false, compactSummary: (0, jsx_runtime_1.jsx)(AlertButtonCompactSummary, { button: button }), headerVisual: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", justifyContent: "space-end", className: "twa:gap-1 twa:min-w-0 twa:overflow-hidden twa:flex-wrap", children: [(0, jsx_runtime_1.jsx)(AlertButtonPreview, { button: button, messageType: messageType }), cardBinding.compact ? (0, jsx_runtime_1.jsx)(AlertButtonActionTags, { button: button }) : null] }), headerActions: (0, jsx_runtime_1.jsx)(SimpleButton_1.default, { icon: "delete", disabled: alertButtons.length <= 1, variant: "text", tooltip: alertButtons.length <= 1 ? 'Cannot remove last button' : 'Delete button', onClick: () => handleDeleteButton(index) }), summary: (0, jsx_runtime_1.jsx)(AlertButtonCardSummary, { button: button }), bodyClassName: "twa:!pt-0", children: (0, jsx_runtime_1.jsx)(AlertButtonEditorForm, { button: button, index: index, alertButtons: alertButtons, buttonCommands: buttonCommands, onChange: onChange }) }, alertButtonCardId(index)));
204
237
  }) })] }));
205
238
  };
206
239
  exports.AlertButtonsEditor = AlertButtonsEditor;
@@ -139,6 +139,6 @@ const AlertNotificationWizardSection = (props) => {
139
139
  } }));
140
140
  })()
141
141
  : null] })] }) }), data.AlertProperties?.DisplayNotification ? ((0, jsx_runtime_1.jsx)(Flex_1.Box, { "data-name": "alert-preview", children: (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Alert Preview" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Preview how the notification will appear when triggered" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: !isScheduled &&
142
- typeof data.AlertForm === 'string' ? ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Preview not available because form is dynamically driven" })) : ((0, jsx_runtime_1.jsx)(exports.AlertPreview, { alertDefinition: data, api: api })) })] }) })) : null] }));
142
+ typeof data.AlertForm === 'string' ? ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2", children: "Preview not available because form is dynamically driven" })) : ((0, jsx_runtime_1.jsx)(exports.AlertPreview, { alertDefinition: data, api: api, focusFirstButton: false })) })] }) })) : null] }));
143
143
  };
144
144
  exports.AlertNotificationWizardSection = AlertNotificationWizardSection;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AlertWizard = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const React = tslib_1.__importStar(require("react"));
6
7
  const react_1 = require("react");
7
8
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
8
9
  const Helper_1 = require("../../../Utilities/Helpers/Helper");
@@ -81,7 +82,14 @@ const AlertWizard = (props) => {
81
82
  setAlertType(newAlertType);
82
83
  doSetAlertDefinition((0, getDefaultAlertDefinition_1.getDefaultAlertDefinition)(alertDefinition, newAlertType));
83
84
  };
84
- return ((0, jsx_runtime_1.jsx)(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, modal: props.modal, data: alertDefinition, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
85
+ const defaultEditSectionName = React.useMemo(() => {
86
+ if (props.defaultCurrentSectionName || !props.data) {
87
+ return props.defaultCurrentSectionName;
88
+ }
89
+ const type = (0, getAlertType_1.getAlertType)(props.data);
90
+ return type === getAlertType_1.AlertType.Scheduled ? 'Schedule' : 'Rule';
91
+ }, [props.defaultCurrentSectionName, props.data]);
92
+ return ((0, jsx_runtime_1.jsx)(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: defaultEditSectionName, moduleInfo: props.moduleInfo, modal: props.modal, data: alertDefinition, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
85
93
  {
86
94
  title: 'Name & Type',
87
95
  isValid: AlertTypeWizardSection_1.isSettingsValid,
@@ -9,6 +9,7 @@ const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/Simp
9
9
  const AdaptableContext_1 = require("../../AdaptableContext");
10
10
  const Flex_1 = require("../../../components/Flex");
11
11
  const Tag_1 = require("../../../components/Tag/Tag");
12
+ const objectListActionButtonStyles_1 = require("./objectListActionButtonStyles");
12
13
  const baseClassName = 'ab-Adaptable-Object-Compact-List';
13
14
  const ICON_SIZE = 20;
14
15
  const AdaptableObjectCompactListItem = (props) => {
@@ -45,7 +46,7 @@ const AdaptableObjectCompactListItem = (props) => {
45
46
  ? React.createElement(objectView.item.view, {
46
47
  data: props.abObject,
47
48
  })
48
- : objectView.item.view, Boolean(objectView.item?.values && objectView.item?.values?.length) && ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: `${baseClassName}__Item__Values`, children: (0, jsx_runtime_1.jsx)(Tag_1.TagList, { tags: objectView.item.values, variant: objectView.item.tagVariant }) }))] }), suspendAction && unSuspendAction && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { onMouseDown: handleSuspendUnSuspend, tone: isSuspended ? 'neutral' : 'success', variant: "text", icon: isSuspended ? 'resume' : 'pause' })), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: "twa:ml-1 twa:flex-[0_0_auto]", children: deleteAction && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { iconSize: ICON_SIZE, icon: "delete", variant: "text", onMouseDown: handleDelete, accessLevel: moduleAccessLevel })) })] }));
49
+ : objectView.item.view, Boolean(objectView.item?.values && objectView.item?.values?.length) && ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: `${baseClassName}__Item__Values`, children: (0, jsx_runtime_1.jsx)(Tag_1.TagList, { tags: objectView.item.values, variant: objectView.item.tagVariant }) }))] }), suspendAction && unSuspendAction && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { onMouseDown: handleSuspendUnSuspend, tone: "neutral", variant: "text", iconSize: ICON_SIZE, icon: isSuspended ? 'resume' : 'pause', tooltip: isSuspended ? 'Resume' : 'Suspend', className: (0, objectListActionButtonStyles_1.objectListActionButtonClassName)('suspend', isSuspended ? 'twa:opacity-60' : undefined) })), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: "twa:ml-1 twa:flex-[0_0_auto] twa:gap-1", children: deleteAction && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { iconSize: ICON_SIZE, icon: "delete", variant: "text", onMouseDown: handleDelete, accessLevel: moduleAccessLevel, className: (0, objectListActionButtonStyles_1.objectListActionButtonClassName)('delete') })) })] }));
49
50
  };
50
51
  exports.AdaptableObjectCompactListItem = AdaptableObjectCompactListItem;
51
52
  const AdaptableObjectCompactList = (props) => {
@@ -69,7 +70,7 @@ const AdaptableObjectCompactList = (props) => {
69
70
  dispatch(unSuspendAllAction);
70
71
  }
71
72
  }, [isAtLeastOneAbObjectActive]);
72
- return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: baseClassName, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: `${baseClassName}__Header twa:text-3`, children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: `${baseClassName}__Title`, alignItems: 'center', children: props.module.moduleInfo.FriendlyName }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1" }), suspendAllAction && unSuspendAllAction && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { className: "twa:mr-2", onMouseDown: handleSuspendUnsuspendAll, tone: isAtLeastOneAbObjectActive ? 'neutral' : 'success', variant: "raised", icon: isAtLeastOneAbObjectActive ? 'pause' : 'resume', accessLevel: accessLevel, children: isAtLeastOneAbObjectActive ? 'Suspend All' : 'Unsuspend All' })), deleteAllAction && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { onMouseDown: () => dispatch(deleteAllAction), variant: "raised", tone: "neutral", accessLevel: accessLevel, children: "Clear All" }))] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: `${baseClassName}__Body`, children: props.abObjects.map((abObject) => {
73
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: baseClassName, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: `${baseClassName}__Header twa:text-3`, children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: `${baseClassName}__Title`, alignItems: 'center', children: props.module.moduleInfo.FriendlyName }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1" }), suspendAllAction && unSuspendAllAction && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { className: "twa:mr-2", onMouseDown: handleSuspendUnsuspendAll, tone: "neutral", variant: "raised", icon: isAtLeastOneAbObjectActive ? 'pause' : 'resume', accessLevel: accessLevel, children: isAtLeastOneAbObjectActive ? 'Suspend All' : 'Resume All' })), deleteAllAction && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { onMouseDown: () => dispatch(deleteAllAction), variant: "raised", tone: "neutral", accessLevel: accessLevel, children: "Clear All" }))] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: `${baseClassName}__Body`, children: props.abObjects.map((abObject) => {
73
74
  return ((0, jsx_runtime_1.jsx)(exports.AdaptableObjectCompactListItem, { abObject: abObject, module: props.module }, abObject.Uuid));
74
75
  }) })] }));
75
76
  };
@@ -17,6 +17,7 @@ const SuspendToggleButton_1 = require("../Buttons/SuspendToggleButton/SuspendTog
17
17
  const Flex_1 = require("../../../components/Flex");
18
18
  const twMerge_1 = require("../../../twMerge");
19
19
  const Tag_1 = require("../../../components/Tag/Tag");
20
+ const objectListActionButtonStyles_1 = require("./objectListActionButtonStyles");
20
21
  const ICON_SIZE = 26;
21
22
  const LIST_BASE_CLASS_NAME = 'ab-Adaptable-Object-List';
22
23
  const ITEM_BASE_CLASS_NAME = `${LIST_BASE_CLASS_NAME}__Item`;
@@ -39,7 +40,7 @@ const AdaptableObjectListItemView = (props) => {
39
40
  dispatch(props.deleteAction);
40
41
  };
41
42
  }
42
- const deleteActionButton = (0, jsx_runtime_1.jsx)(ButtonDelete_1.ButtonDelete, { ...deleteActionProps });
43
+ const deleteActionButton = ((0, jsx_runtime_1.jsx)(ButtonDelete_1.ButtonDelete, { ...deleteActionProps, className: (0, twMerge_1.twMerge)((0, objectListActionButtonStyles_1.objectListActionButtonClassName)('delete'), deleteActionProps.className) }));
43
44
  return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { "data-name": "adaptable-object-list-item", "data-value": props.abObject.Uuid, as: "li", className: (0, twMerge_1.twMerge)(baseClassName, 'twa:rounded-standard', props.className), style: props.style, children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: `twa:flex-1 ${baseClassName}__rows twa:gap-2 twa:flex twa:flex-col`, children: props.items.filter?.(Boolean)?.map((tag, index) => {
44
45
  const labelElement = typeof tag.label === 'function'
45
46
  ? React.createElement(tag.label, { key: index, data: props.abObject })
@@ -57,7 +58,7 @@ const AdaptableObjectListItemView = (props) => {
57
58
  module: props.module,
58
59
  })
59
60
  : tag.viewAfter] })] }, `${index}-${tag.name}`));
60
- }) }), props.showActions && ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: `${baseClassName}__buttons twa:ml-3 twa:pl-3 twa:text-right twa:min-w-[80px]`, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: "twa:justify-end", children: [props.actions, props.teamSharingActivated && ((0, jsx_runtime_1.jsx)(ButtonShare_1.ButtonShare, { iconSize: ICON_SIZE, Header: `TeamSharing ${props.entityType}`, accessLevel: props.accessLevel, onShare: props.onShare })), props.onDelete && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { "data-name": "delete", disabled: props.deleteDisabled, iconSize: ICON_SIZE, tooltip: props.deleteTooltip, icon: "delete", onClick: props.onDelete, variant: "text" })), props.deleteAction ? deleteActionButton : null, props.showEditButton && ((0, jsx_runtime_1.jsx)(ButtonEdit_1.ButtonEdit, { iconSize: ICON_SIZE, disabled: props.editDisabled, accessLevel: props.accessLevel, onClick: () => props.handleOnEdit() }))] }), props.suspendedEnabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1 twa:min-h-[20px]" }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: "twa:justify-end", children: (0, jsx_runtime_1.jsx)(SuspendToggleButton_1.SuspendToggleButton, { onSuspend: props.onSuspend, onUnSuspend: props.onUnSuspend, suspendableObject: props.abObject, accessLevel: props.accessLevel }) })] }))] }))] }));
61
+ }) }), props.showActions && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: `${baseClassName}__buttons twa:ml-3 twa:pl-3 twa:text-right twa:min-w-[80px]`, children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: "twa:justify-end twa:items-center twa:gap-1", children: [props.actions, props.teamSharingActivated && ((0, jsx_runtime_1.jsx)(ButtonShare_1.ButtonShare, { iconSize: ICON_SIZE, Header: `TeamSharing ${props.entityType}`, accessLevel: props.accessLevel, onShare: props.onShare, className: (0, objectListActionButtonStyles_1.objectListActionButtonClassName)('share') })), props.showEditButton && ((0, jsx_runtime_1.jsx)(ButtonEdit_1.ButtonEdit, { iconSize: ICON_SIZE, disabled: props.editDisabled, accessLevel: props.accessLevel, className: (0, objectListActionButtonStyles_1.objectListActionButtonClassName)('edit'), onClick: () => props.handleOnEdit() })), props.suspendedEnabled && ((0, jsx_runtime_1.jsx)(SuspendToggleButton_1.SuspendToggleButton, { iconSize: ICON_SIZE, className: (0, objectListActionButtonStyles_1.objectListActionButtonClassName)('suspend'), onSuspend: props.onSuspend, onUnSuspend: props.onUnSuspend, suspendableObject: props.abObject, accessLevel: props.accessLevel })), props.onDelete && ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { "data-name": "delete", disabled: props.deleteDisabled, iconSize: ICON_SIZE, tooltip: props.deleteTooltip, icon: "delete", onClick: props.onDelete, variant: "text", className: (0, objectListActionButtonStyles_1.objectListActionButtonClassName)('delete') })), props.deleteAction ? deleteActionButton : null] }) }))] }));
61
62
  };
62
63
  exports.AdaptableObjectListItemView = AdaptableObjectListItemView;
63
64
  const AdaptableObjectListItem = (props) => {
@@ -0,0 +1,2 @@
1
+ export type ObjectListActionKind = 'edit' | 'suspend' | 'delete' | 'share';
2
+ export declare const objectListActionButtonClassName: (kind: ObjectListActionKind, className?: string) => string;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectListActionButtonClassName = void 0;
4
+ const utils_1 = require("../../../lib/utils");
5
+ const objectListActionButtonClassName = (kind, className) => (0, utils_1.cn)('ab-ObjectListActionButton', `ab-ObjectListActionButton--${kind}`, className);
6
+ exports.objectListActionButtonClassName = objectListActionButtonClassName;
@@ -41,7 +41,7 @@ class EntityListActionButtons extends React.Component {
41
41
  'twa:justify-center': justifyContent === 'center',
42
42
  'twa:justify-end': justifyContent === 'end',
43
43
  }) || 'twa:justify-center';
44
- return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: `${justifyContentClassName} twa:m-0 twa:p-0`, onClick: stopPropagation, children: [this.props.showEdit && ((0, jsx_runtime_1.jsx)(ButtonEdit_1.ButtonEdit, { onClick: () => (this.props.editClick ? this.props.editClick() : null), className: `twa:ml-0 twa:mr-[2px] twa:my-[2px] twa:text-action-edit-foreground twa:bg-action-edit twa:fill-action-edit-foreground`, disabled: this.props.overrideDisableEdit || this.props.accessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY, tooltip: this.props.overrideTooltipEdit, accessLevel: this.props.accessLevel })), this.props.showClone && ((0, jsx_runtime_1.jsx)(ButtonClone_1.ButtonClone, { onClick: () => (this.props.cloneClick ? this.props.cloneClick() : null), className: `twa:ml-0 twa:mr-[2px] twa:my-[2px] twa:text-action-clone-foreground twa:bg-action-clone twa:fill-action-clone-foreground`, children: null, disabled: this.props.overrideDisableClone || this.props.cloneAccessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY, tooltip: this.props.overrideTooltipClone, accessLevel: this.props.cloneAccessLevel })), this.props.showDelete && ((0, jsx_runtime_1.jsx)(ButtonDelete_1.ButtonDelete, { "data-name": "delete", className: `twa:mx-[px] twa:my-[2px] twa:text-action-delete-foreground twa:bg-action-delete twa:fill-action-delete-foreground`, disabled: this.props.overrideDisableDelete || this.props.accessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY, tooltip: this.props.overrideTooltipDelete, ConfirmAction: this.props.confirmDeleteAction, ConfirmationMsg: 'Are you sure you want to delete this ' + this.props.entityType + '?', ConfirmationTitle: 'Delete ' + this.props.entityType, accessLevel: this.props.accessLevel })), this.props.showShare && ((0, jsx_runtime_1.jsx)(ButtonShare_1.ButtonShare, { className: `twa:mx-[1px] twa:my-[2px] twa:text-action-share-foreground twa:bg-action-share twa:fill-action-share-foreground`, onShare: (config) => this.props.shareClick ? this.props.shareClick(config) : null, Header: `TeamSharing ${this.props.entityType}`, disabled: this.props.overrideDisableShare || this.props.accessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY, tooltip: this.props.overrideTooltipShare, accessLevel: this.props.accessLevel })), this.props.showSuspend && this.props.suspendableObject && ((0, jsx_runtime_1.jsx)(SuspendToggleButton_1.SuspendToggleButton, { className: `twa:ml-[2px] twa:align-self-center`, onSuspend: this.props.onSuspend, onUnSuspend: this.props.onUnSuspend, suspendableObject: this.props.suspendableObject, disabled: this.props.accessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY }))] }));
44
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: `${justifyContentClassName} twa:m-0 twa:p-0`, onClick: stopPropagation, children: [this.props.showEdit && ((0, jsx_runtime_1.jsx)(ButtonEdit_1.ButtonEdit, { onClick: () => (this.props.editClick ? this.props.editClick() : null), className: `twa:ml-0 twa:mr-[2px] twa:my-[2px] twa:text-action-edit-foreground twa:bg-action-edit twa:fill-action-edit-foreground`, disabled: this.props.overrideDisableEdit || this.props.accessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY, tooltip: this.props.overrideTooltipEdit, accessLevel: this.props.accessLevel })), this.props.showClone && ((0, jsx_runtime_1.jsx)(ButtonClone_1.ButtonClone, { onClick: () => (this.props.cloneClick ? this.props.cloneClick() : null), className: `twa:ml-0 twa:mr-[2px] twa:my-[2px] twa:text-action-clone-foreground twa:bg-action-clone twa:fill-action-clone-foreground`, children: null, disabled: this.props.overrideDisableClone || this.props.cloneAccessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY, tooltip: this.props.overrideTooltipClone, accessLevel: this.props.cloneAccessLevel })), this.props.showDelete && ((0, jsx_runtime_1.jsx)(ButtonDelete_1.ButtonDelete, { "data-name": "delete", className: `twa:mx-[px] twa:my-[2px] twa:text-action-delete-foreground twa:bg-action-delete twa:fill-action-delete-foreground`, disabled: this.props.overrideDisableDelete || this.props.accessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY, tooltip: this.props.overrideTooltipDelete, ConfirmAction: this.props.confirmDeleteAction, ConfirmationMsg: 'Are you sure you want to delete this ' + this.props.entityType + '?', ConfirmationTitle: 'Delete ' + this.props.entityType, accessLevel: this.props.accessLevel })), this.props.showShare && ((0, jsx_runtime_1.jsx)(ButtonShare_1.ButtonShare, { className: `twa:mx-[1px] twa:my-[2px] twa:text-action-share-foreground twa:bg-action-share twa:fill-action-share-foreground`, onShare: (config) => this.props.shareClick ? this.props.shareClick(config) : null, Header: `TeamSharing ${this.props.entityType}`, disabled: this.props.overrideDisableShare || this.props.accessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY, tooltip: this.props.overrideTooltipShare, accessLevel: this.props.accessLevel })), this.props.showSuspend && this.props.suspendableObject && ((0, jsx_runtime_1.jsx)(SuspendToggleButton_1.SuspendToggleButton, { className: "twa:align-self-center", iconSize: 24, onSuspend: this.props.onSuspend, onUnSuspend: this.props.onUnSuspend, suspendableObject: this.props.suspendableObject, disabled: this.props.accessLevel == GeneralConstants_1.ACCESS_LEVEL_READ_ONLY }))] }));
45
45
  }
46
46
  }
47
47
  exports.EntityListActionButtons = EntityListActionButtons;
@@ -9,6 +9,7 @@ interface EntityListSuspendButtonProps {
9
9
  disabled?: boolean;
10
10
  accessLevel?: AccessLevel;
11
11
  className?: string;
12
+ iconSize?: number;
12
13
  }
13
14
  export declare const SuspendToggleButton: React.FunctionComponent<EntityListSuspendButtonProps>;
14
15
  export {};
@@ -4,19 +4,19 @@ exports.SuspendToggleButton = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const React = tslib_1.__importStar(require("react"));
7
- const ToggleButton_1 = require("../../../../components/ToggleButton");
7
+ const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
8
8
  const GeneralConstants_1 = require("../../../../Utilities/Constants/GeneralConstants");
9
9
  const utils_1 = require("../../../../lib/utils");
10
- exports.SuspendToggleButton = React.memo(({ suspendableObject, onUnSuspend, onSuspend, style, disabled, accessLevel, className }) => {
11
- const handleOnChange = React.useCallback((checked) => {
12
- if (checked) {
10
+ exports.SuspendToggleButton = React.memo(({ suspendableObject, onUnSuspend, onSuspend, style, disabled, accessLevel, className, iconSize = 26, }) => {
11
+ const preparedDisabled = (accessLevel && accessLevel === GeneralConstants_1.ACCESS_LEVEL_READ_ONLY) || disabled;
12
+ const isSuspended = suspendableObject.IsSuspended;
13
+ const handleClick = React.useCallback(() => {
14
+ if (isSuspended) {
13
15
  onUnSuspend(suspendableObject);
14
16
  }
15
17
  else {
16
18
  onSuspend(suspendableObject);
17
19
  }
18
- }, [onUnSuspend, onSuspend]);
19
- const preparedDisabled = (accessLevel && accessLevel === GeneralConstants_1.ACCESS_LEVEL_READ_ONLY) || disabled;
20
- const isSuspended = suspendableObject.IsSuspended;
21
- return ((0, jsx_runtime_1.jsx)(ToggleButton_1.ToggleButton, { className: (0, utils_1.cn)(`ab-SuspendButton`, className), "data-name": suspendableObject.IsSuspended ? 'un-suspend' : 'suspend', disabled: preparedDisabled, style: style, onChange: handleOnChange, checked: !isSuspended, children: isSuspended ? 'inactive' : 'active' }));
20
+ }, [isSuspended, onSuspend, onUnSuspend, suspendableObject]);
21
+ return ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { className: (0, utils_1.cn)('ab-SuspendButton', isSuspended && 'twa:opacity-60', className), "data-name": isSuspended ? 'resume' : 'suspend', disabled: preparedDisabled, style: style, variant: "text", tone: "neutral", iconSize: iconSize, icon: isSuspended ? 'resume' : 'pause', tooltip: isSuspended ? 'Resume' : 'Suspend', accessLevel: accessLevel, onClick: handleClick }));
22
22
  });
@@ -40,7 +40,14 @@ const ColumnFilterPredicateDropdown = (props) => {
40
40
  operator: value,
41
41
  args: [],
42
42
  });
43
- }, items: options, value: isAndOr ? 'Add Condition' : props.predicate?.operator }) }));
43
+ }, items: options,
44
+ // For the "Add Condition" picker the current predicate is the top-level
45
+ // AND/OR predicate, which is not a selectable item. Use `null` (a proper
46
+ // controlled empty value) plus a placeholder rather than a fake string
47
+ // value: passing a non-item value makes base-ui's Select reconcile and
48
+ // fire a spurious `onValueChange` when the items change (e.g. switching
49
+ // the filter to another column), which previously crashed.
50
+ placeholder: "Add Condition", value: isAndOr ? null : props.predicate?.operator }) }));
44
51
  };
45
52
  const ColumnFilterEditor = (props) => {
46
53
  return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:mb-3 twa:overflow-x-hidden twa:p-0.5", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: "twa:mb-2", children: [(0, jsx_runtime_1.jsx)(ColumnFilterPredicateDropdown, { columnId: props.columnId, disabled: props.disabled, predicate: props.predicate, predicateDefs: props.predicateDefs, onPredicateChange: props.onPredicateChange }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2", children: (0, jsx_runtime_1.jsx)(SimpleButton_1.default, { disabled: props.deleteDisabled, onClick: props.onDelete, variant: "text", icon: "delete" }) })] }), (0, jsx_runtime_1.jsx)(ColumnFilterInputList_1.ColumnFilterInputList, { columnId: props.columnId, disabled: props.disabled, predicate: props.predicate, onPredicateChange: props.onPredicateChange, predicateDefs: props.predicateDefs })] }));
@@ -128,6 +135,12 @@ const ColumnFilterComponent = (props) => {
128
135
  const isLastPredicateValid = true;
129
136
  const filterPredicateDropdown = ((0, jsx_runtime_1.jsx)(ColumnFilterPredicateDropdown, { columnId: props.columnId, disabled: props.disabled, predicate: currentPredicate, predicateDefs: props.predicateDefs, onPredicateChange: (predicate) => {
130
137
  const predicateDef = props.predicateDefs.find((predicateDef) => predicateDef.operator === predicate.operator);
138
+ // Guard against the select emitting a value that is not a known
139
+ // predicate for the current column (e.g. a stale/reconciled value while
140
+ // switching columns).
141
+ if (!predicateDef) {
142
+ return;
143
+ }
131
144
  onNewPredicate(predicateDef);
132
145
  }, targetProps: {
133
146
  tone: 'neutral',
@@ -108,7 +108,7 @@ const AdaptablePopupModuleView = (props) => {
108
108
  dispatch(unsuspendAllAction);
109
109
  }
110
110
  };
111
- suspendButton = ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { className: "twa:mr-2", onMouseDown: () => handleSuspendUnsuspendAll(), tone: isAtLeastOneAbObjectActive ? 'neutral' : 'success', variant: "raised", icon: isAtLeastOneAbObjectActive ? 'pause' : 'resume', accessLevel: props.accessLevel, children: isAtLeastOneAbObjectActive ? 'Suspend All' : 'Unsuspend All' }));
111
+ suspendButton = ((0, jsx_runtime_1.jsx)(SimpleButton_1.default, { className: "twa:mr-2", onMouseDown: () => handleSuspendUnsuspendAll(), tone: "neutral", variant: "raised", icon: isAtLeastOneAbObjectActive ? 'pause' : 'resume', accessLevel: props.accessLevel, children: isAtLeastOneAbObjectActive ? 'Suspend All' : 'Resume All' }));
112
112
  }
113
113
  const handleWizardClose = () => {
114
114
  setAbObjectType(null);
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { AdaptableApi } from '../../Api/AdaptableApi';
3
- import { CellColorRange, ColumnComparison, GradientZeroCentredColors, NumericStyledColumn } from '../../AdaptableState/StyledColumnState';
3
+ import { CellColorRange, ColumnComparison, NumericStyledColumn } from '../../AdaptableState/StyledColumns/Common/NumericStyledColumn';
4
+ import { GradientZeroCentredColors } from '../../AdaptableState/StyledColumns/GradientStyle';
4
5
  import { ColumnScope } from '../../AdaptableState/Common/ColumnScope';
5
6
  export interface RangesComponentProps extends React.ClassAttributes<RangesComponent> {
6
7
  ranges: CellColorRange[];
@@ -9,7 +9,7 @@ const ExportRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/Ex
9
9
  const formatScheduledReportSummary_1 = require("../../Strategy/Utilities/Export/formatScheduledReportSummary");
10
10
  const AdaptableContext_1 = require("../AdaptableContext");
11
11
  const AdaptableObjectList_1 = require("../Components/AdaptableObjectList/AdaptableObjectList");
12
- const ButtonDelete_1 = require("../Components/Buttons/ButtonDelete");
12
+ const objectListActionButtonStyles_1 = require("../Components/AdaptableObjectList/objectListActionButtonStyles");
13
13
  const ButtonEdit_1 = require("../Components/Buttons/ButtonEdit");
14
14
  const EmptyContent_1 = tslib_1.__importDefault(require("../../components/EmptyContent"));
15
15
  const ScheduledReportWizard_1 = require("./Wizard/ScheduledReportWizard");
@@ -53,7 +53,6 @@ const ExportScheduleListItem = (props) => {
53
53
  values: [(0, formatScheduledReportSummary_1.formatScheduledReportSummary)(reportSchedule)],
54
54
  },
55
55
  ], actions: [
56
- (0, jsx_runtime_1.jsx)(ButtonEdit_1.ButtonEdit, { accessLevel: accessLevel, onClick: props.onEdit, tooltip: "Edit Schedule" }, "edit"),
57
- (0, jsx_runtime_1.jsx)(ButtonDelete_1.ButtonDelete, { accessLevel: accessLevel, tooltip: "Delete Schedule", ConfirmationTitle: "Delete Schedule", ConfirmationMsg: "Are you sure you want to delete this schedule?", ConfirmAction: ExportRedux.ScheduledReportDelete(reportSchedule) }, "delete"),
58
- ], suspendedEnabled: true, onSuspend: props.onSuspend, onUnSuspend: props.onUnSuspend }));
56
+ (0, jsx_runtime_1.jsx)(ButtonEdit_1.ButtonEdit, { accessLevel: accessLevel, onClick: props.onEdit, tooltip: "Edit Schedule", className: (0, objectListActionButtonStyles_1.objectListActionButtonClassName)('edit') }, "edit"),
57
+ ], deleteAction: ExportRedux.ScheduledReportDelete(reportSchedule), deleteConfirmationMsg: "Are you sure you want to delete this schedule?", suspendedEnabled: true, onSuspend: props.onSuspend, onUnSuspend: props.onUnSuspend }));
59
58
  };
@@ -32,7 +32,7 @@ class FilterViewPanelComponent extends React.Component {
32
32
  this.props.api.filterApi.columnFilterApi.unSuspendAllColumnFilters();
33
33
  }
34
34
  };
35
- return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", className: `ab-${elementType}__Filter__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap', children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { children: [ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(this.props.ColumnFilters) && ((0, jsx_runtime_1.jsx)(AdaptablePopover_1.AdaptablePopover, { popupPadding: 0, className: `ab-${elementType}__Filter__info`, headerText: "", bodyText: [(0, jsx_runtime_1.jsx)(ActiveFiltersPanel_1.ActiveFiltersPanel, {})], useButton: true, showEvent: 'focus', hideEvent: "blur", popoverMinWidth: 400 })), (0, jsx_runtime_1.jsx)(ButtonClear_1.ButtonClear, { "aria-label": 'Clear Filters', className: `ab-${elementType}__Filter__clear twa:mx-1 twa:mb-0`, onClick: () => this.onClearFilters(), tooltip: "Clear Filters", disabled: this.props.ColumnFilters.length == 0, showText: this.props.viewType === 'ToolPanel', children: this.props.viewType === 'ToolPanel' && 'Clear' }), (0, jsx_runtime_1.jsx)(SimpleButton_1.default, { "aria-label": isAtLeastOneFilterActive ? 'Suspend All Filters' : 'Resume All Filters', className: (0, join_1.default)(`ab-${elementType}__Filter__suspend-button`, isAtLeastOneFilterActive && `ab-${elementType}__Filter__suspend-all`, !isAtLeastOneFilterActive && `ab-${elementType}__Filter__un-suspend-all`), disabled: !isAtLeastOneFilter, onClick: handleSuspendUnsuspendAll, tone: isAtLeastOneFilterActive ? 'neutral' : 'success', variant: "text", icon: isAtLeastOneFilterActive ? 'pause' : 'play', accessLevel: this.props.accessLevel })] }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignItems: "center", children: this.props.api.filterApi.columnFilterApi.isQuickFilterAvailable() && ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { "data-name": "quick-filter-toggle", className: `ab-${elementType}__Filter__active-check twa:my-0 twa:text-2 twa:p-1`, disabled: this.props.accessLevel === GeneralConstants_1.ACCESS_LEVEL_READ_ONLY ||
35
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", className: `ab-${elementType}__Filter__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap', children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { children: [ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(this.props.ColumnFilters) && ((0, jsx_runtime_1.jsx)(AdaptablePopover_1.AdaptablePopover, { popupPadding: 0, className: `ab-${elementType}__Filter__info`, headerText: "", bodyText: [(0, jsx_runtime_1.jsx)(ActiveFiltersPanel_1.ActiveFiltersPanel, {})], useButton: true, showEvent: 'focus', hideEvent: "blur", popoverMinWidth: 400 })), (0, jsx_runtime_1.jsx)(ButtonClear_1.ButtonClear, { "aria-label": 'Clear Filters', className: `ab-${elementType}__Filter__clear twa:mx-1 twa:mb-0`, onClick: () => this.onClearFilters(), tooltip: "Clear Filters", disabled: this.props.ColumnFilters.length == 0, showText: this.props.viewType === 'ToolPanel', children: this.props.viewType === 'ToolPanel' && 'Clear' }), (0, jsx_runtime_1.jsx)(SimpleButton_1.default, { "aria-label": isAtLeastOneFilterActive ? 'Suspend All Filters' : 'Resume All Filters', className: (0, join_1.default)(`ab-${elementType}__Filter__suspend-button`, isAtLeastOneFilterActive && `ab-${elementType}__Filter__suspend-all`, !isAtLeastOneFilterActive && `ab-${elementType}__Filter__un-suspend-all`), disabled: !isAtLeastOneFilter, onClick: handleSuspendUnsuspendAll, tone: "neutral", variant: "text", icon: isAtLeastOneFilterActive ? 'pause' : 'resume', accessLevel: this.props.accessLevel })] }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignItems: "center", children: this.props.api.filterApi.columnFilterApi.isQuickFilterAvailable() && ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { "data-name": "quick-filter-toggle", className: `ab-${elementType}__Filter__active-check twa:my-0 twa:text-2 twa:p-1`, disabled: this.props.accessLevel === GeneralConstants_1.ACCESS_LEVEL_READ_ONLY ||
36
36
  this.props.api.layoutApi.isCurrentLayoutPivot(), checked: this.props.IsQuickFilterVisible, onChange: (checked) => {
37
37
  checked ? this.props.onShowQuickFilterBar() : this.props.onHideQuickFilterBar();
38
38
  }, children: "Filter Bar" })) })] }));