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