@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.
- package/index.css +75 -9
- package/package.json +1 -1
- package/src/AdaptableState/StyledColumnState.d.ts +8 -850
- package/src/AdaptableState/StyledColumnState.js +0 -10
- package/src/AdaptableState/StyledColumns/BadgeStyle.d.ts +143 -0
- package/src/AdaptableState/StyledColumns/BadgeStyle.js +12 -0
- package/src/AdaptableState/StyledColumns/BulletChartStyle.d.ts +147 -0
- package/src/AdaptableState/StyledColumns/BulletChartStyle.js +2 -0
- package/src/AdaptableState/StyledColumns/Common/BarChartCellText.d.ts +60 -0
- package/src/AdaptableState/StyledColumns/Common/BarChartCellText.js +7 -0
- package/src/AdaptableState/StyledColumns/Common/BarChartMarker.d.ts +24 -0
- package/src/AdaptableState/StyledColumns/Common/BarChartMarker.js +6 -0
- package/src/AdaptableState/StyledColumns/Common/CellTextOptions.d.ts +13 -0
- package/src/AdaptableState/StyledColumns/Common/CellTextOptions.js +7 -0
- package/src/AdaptableState/StyledColumns/Common/NumericStyledColumn.d.ts +79 -0
- package/src/AdaptableState/StyledColumns/Common/NumericStyledColumn.js +10 -0
- package/src/AdaptableState/StyledColumns/GradientStyle.d.ts +48 -0
- package/src/AdaptableState/StyledColumns/GradientStyle.js +2 -0
- package/src/AdaptableState/StyledColumns/IconStyle.d.ts +158 -0
- package/src/AdaptableState/StyledColumns/IconStyle.js +2 -0
- package/src/AdaptableState/StyledColumns/PercentBarStyle.d.ts +32 -0
- package/src/AdaptableState/StyledColumns/PercentBarStyle.js +2 -0
- package/src/AdaptableState/StyledColumns/RangeBarStyle.d.ts +155 -0
- package/src/AdaptableState/StyledColumns/RangeBarStyle.js +2 -0
- package/src/AdaptableState/StyledColumns/RatingStyle.d.ts +111 -0
- package/src/AdaptableState/StyledColumns/RatingStyle.js +2 -0
- package/src/AdaptableState/StyledColumns/SparklineStyle.d.ts +21 -0
- package/src/AdaptableState/StyledColumns/SparklineStyle.js +2 -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 +333 -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 +158 -125
- 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 +6 -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 +128 -102
- 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 +40 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarChartCellTextPreview.d.ts +23 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarChartCellTextPreview.js +62 -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 +13 -6
- 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.cjs.tsbuildinfo +1 -1
|
@@ -6,7 +6,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const React = tslib_1.__importStar(require("react"));
|
|
7
7
|
const CheckBox_1 = require("../../../../components/CheckBox");
|
|
8
8
|
const FormLayout_1 = tslib_1.__importStar(require("../../../../components/FormLayout"));
|
|
9
|
-
const Panel_1 = tslib_1.__importDefault(require("../../../../components/Panel"));
|
|
10
9
|
const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
|
|
11
10
|
const ButtonNew_1 = require("../../../Components/Buttons/ButtonNew");
|
|
12
11
|
const Card_1 = require("../../../../components/Card");
|
|
@@ -24,6 +23,9 @@ const ColumnGroupTag_1 = require("../../../Components/ColumnGroupTag");
|
|
|
24
23
|
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/ArrayExtensions"));
|
|
25
24
|
const Flex_1 = require("../../../../components/Flex");
|
|
26
25
|
const NewSelect_1 = require("../../../../components/NewSelect");
|
|
26
|
+
const CollapsibleWizardCard_1 = require("../../../Wizard/CollapsibleWizardCard");
|
|
27
|
+
const utils_1 = require("../../../../lib/utils");
|
|
28
|
+
const objectListActionButtonStyles_1 = require("../../../Components/AdaptableObjectList/objectListActionButtonStyles");
|
|
27
29
|
const areSummaryRowsValid = (layout) => {
|
|
28
30
|
if (!layout.RowSummaries)
|
|
29
31
|
return true;
|
|
@@ -39,6 +41,7 @@ const areSummaryRowsValid = (layout) => {
|
|
|
39
41
|
return valid;
|
|
40
42
|
};
|
|
41
43
|
exports.areSummaryRowsValid = areSummaryRowsValid;
|
|
44
|
+
const rowSummaryCardId = (index) => `row-summary-${index}`;
|
|
42
45
|
const availableExpressionsForColumnTypeCache = new Map();
|
|
43
46
|
const getAvailableExpressionsForColumnType = (columnType, availableScalarExpressions) => {
|
|
44
47
|
const key = columnType;
|
|
@@ -104,19 +107,28 @@ const getDefaultRowSummaryExpression = (column, availableScalarExpressions, layo
|
|
|
104
107
|
}
|
|
105
108
|
return optionValues[0] ?? null;
|
|
106
109
|
};
|
|
110
|
+
const RowSummaryPositionTag = ({ position }) => (0, jsx_runtime_1.jsx)(Tag_1.Tag, { className: "twa:shrink-0", children: position });
|
|
111
|
+
const RowSummaryCardSummary = ({ rowSummary }) => {
|
|
112
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
113
|
+
const columnIds = Object.keys(rowSummary.ColumnsMap ?? {}).filter((colId) => colId !== 'Source' && colId !== 'Uuid');
|
|
114
|
+
if (!columnIds.length) {
|
|
115
|
+
return (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: "No columns" });
|
|
116
|
+
}
|
|
117
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexWrap: "wrap", className: "twa:gap-1", children: columnIds.map((colId) => ((0, jsx_runtime_1.jsxs)(Tag_1.ColumnTag, { children: [rowSummary.ColumnsMap[colId], "(", adaptable.api.columnApi.getFriendlyNameForColumnId(colId), ")"] }, colId))) }));
|
|
118
|
+
};
|
|
107
119
|
const RowSummarySectionSummary = () => {
|
|
108
120
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
109
121
|
const { data: layout } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
110
122
|
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex twa:flex-col", children: layout.RowSummaries?.length ? (layout.RowSummaries.map((rowSummary, index) => {
|
|
111
|
-
return ((0, jsx_runtime_1.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
123
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:mr-1 twa:mb-1", children: [rowSummary.Position, ":", ' ', Object.keys(rowSummary.ColumnsMap).map((colId) => {
|
|
124
|
+
if (colId === 'Source' || colId === 'Uuid')
|
|
125
|
+
return null;
|
|
126
|
+
return ((0, jsx_runtime_1.jsxs)(Tag_1.ColumnTag, { className: "twa:mr-1", children: [rowSummary.ColumnsMap[colId], "(", adaptable.api.columnApi.getFriendlyNameForColumnId(colId), ")"] }, colId));
|
|
127
|
+
})] }, index));
|
|
116
128
|
})) : ((0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: "No Row Summaries" })) }));
|
|
117
129
|
};
|
|
118
130
|
exports.RowSummarySectionSummary = RowSummarySectionSummary;
|
|
119
|
-
const
|
|
131
|
+
const RowSummaryEditorForm = React.memo(({ rowSummary, onChange, availableScalarExpressions, }) => {
|
|
120
132
|
const { data: layout } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
121
133
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
122
134
|
const columns = React.useMemo(() => {
|
|
@@ -132,110 +144,124 @@ const RowSummaryEditor = React.memo(({ rowSummary, onChange, availableScalarExpr
|
|
|
132
144
|
sortUnorderedItems: false,
|
|
133
145
|
}).map((colId) => adaptable.api.columnApi.getColumnWithColumnId(colId));
|
|
134
146
|
}, [rowSummary.ColumnsMap]);
|
|
135
|
-
return ((0, jsx_runtime_1.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
const column = adaptable.api.columnApi.getColumnWithColumnId(colId);
|
|
192
|
-
newColumnsMap[colId] = column
|
|
193
|
-
? getDefaultRowSummaryExpression(column, availableScalarExpressions, layout)
|
|
194
|
-
: null;
|
|
195
|
-
});
|
|
196
|
-
onChange({
|
|
197
|
-
...rowSummary,
|
|
198
|
-
ColumnsMap: newColumnsMap,
|
|
199
|
-
});
|
|
200
|
-
} }) })] })] })] }) }));
|
|
147
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:flex twa:flex-col twa:gap-3 twa:h-full twa:min-h-0 twa:overflow-hidden", children: [(0, jsx_runtime_1.jsxs)(FormLayout_1.default, { children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Position", children: (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { items: [
|
|
148
|
+
{
|
|
149
|
+
label: 'Top',
|
|
150
|
+
value: 'Top',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
label: 'Bottom',
|
|
154
|
+
value: 'Bottom',
|
|
155
|
+
},
|
|
156
|
+
], value: rowSummary.Position, onValueChange: (position) => {
|
|
157
|
+
onChange({
|
|
158
|
+
...rowSummary,
|
|
159
|
+
Position: position,
|
|
160
|
+
});
|
|
161
|
+
} }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "", children: (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { checked: rowSummary.IncludeOnlyFilteredRows ?? true, onChange: (IncludeOnlyFilteredRows) => {
|
|
162
|
+
onChange({
|
|
163
|
+
...rowSummary,
|
|
164
|
+
IncludeOnlyFilteredRows,
|
|
165
|
+
});
|
|
166
|
+
}, children: "Include Only Filtered Rows" }) })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, className: "twa:flex-1 twa:min-h-0 twa:overflow-hidden twa:flex twa:flex-col", children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Column Aggregations" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Select columns and choose an aggregation function for each" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:flex-1 twa:min-h-0 twa:overflow-hidden twa:p-1", children: (0, jsx_runtime_1.jsx)(ValueSelector_1.ValueSelector, { style: { minHeight: 0, maxHeight: '100%' }, showFilterInput: true, toggleSelectionOnRowClick: false, filter: Utilities_1.columnFilter, toIdentifier: (column) => column.columnId, toLabel: (option) => option.friendlyName ?? option.columnId, options: columns, optionLayout: "label-beside-checkbox", toListLabel: (column) => {
|
|
167
|
+
const label = column.friendlyName ?? column.columnId;
|
|
168
|
+
const disabled = !(column.columnId in (rowSummary.ColumnsMap ?? {}));
|
|
169
|
+
if (disabled) {
|
|
170
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2", children: [label, (0, jsx_runtime_1.jsx)(ColumnGroupTag_1.ColumnGroupTag, { column: column }), (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { disabled: true, items: [{ label: 'Select Aggregation', value: null }] })] }));
|
|
171
|
+
}
|
|
172
|
+
const expressionOptions = buildRowSummaryExpressionOptions(column, availableScalarExpressions, layout);
|
|
173
|
+
const expression = rowSummary.ColumnsMap[column.columnId];
|
|
174
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: "twa:mr-2", alignItems: 'center', children: [label, (0, jsx_runtime_1.jsx)(ColumnGroupTag_1.ColumnGroupTag, { column: column })] }), (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { value: expression, items: expressionOptions, onValueChange: (expression) => {
|
|
175
|
+
onChange({
|
|
176
|
+
...rowSummary,
|
|
177
|
+
ColumnsMap: {
|
|
178
|
+
...rowSummary.ColumnsMap,
|
|
179
|
+
[column.columnId]: expression,
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
} })] }));
|
|
183
|
+
}, value: Object.keys(rowSummary.ColumnsMap), onChange: (colIds) => {
|
|
184
|
+
const newColumnsMap = {};
|
|
185
|
+
colIds.forEach((colId) => {
|
|
186
|
+
const existing = rowSummary.ColumnsMap[colId];
|
|
187
|
+
if (existing) {
|
|
188
|
+
newColumnsMap[colId] = existing;
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const column = adaptable.api.columnApi.getColumnWithColumnId(colId);
|
|
192
|
+
newColumnsMap[colId] = column
|
|
193
|
+
? getDefaultRowSummaryExpression(column, availableScalarExpressions, layout)
|
|
194
|
+
: null;
|
|
195
|
+
});
|
|
196
|
+
onChange({
|
|
197
|
+
...rowSummary,
|
|
198
|
+
ColumnsMap: newColumnsMap,
|
|
199
|
+
});
|
|
200
|
+
} }) })] })] }));
|
|
201
201
|
});
|
|
202
202
|
const RowSummarySection = (props) => {
|
|
203
203
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
204
204
|
const { data: layout } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
205
|
+
const rowSummaries = layout.RowSummaries ?? [];
|
|
205
206
|
const availableScalarExpressions = React.useMemo(() => {
|
|
206
207
|
const sytemExpressions = adaptable.api.internalApi
|
|
207
208
|
.getQueryLanguageService()
|
|
208
209
|
.getModuleExpressionFunctionsMap(ModuleConstants_1.LayoutModuleId).aggregatedScalarFunctions;
|
|
209
210
|
return sytemExpressions;
|
|
210
211
|
}, []);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
212
|
+
const { bindCard, hasExpandedCard, expandedFillsSpace, expandedId, setExpandedId } = (0, CollapsibleWizardCard_1.useWizardCardAccordion)(null);
|
|
213
|
+
const handleAddRowSummary = () => {
|
|
214
|
+
const newIndex = rowSummaries.length;
|
|
215
|
+
props.onChange({
|
|
216
|
+
...layout,
|
|
217
|
+
RowSummaries: [
|
|
218
|
+
...rowSummaries,
|
|
219
|
+
{
|
|
220
|
+
Position: 'Top',
|
|
221
|
+
ColumnsMap: {},
|
|
222
|
+
IncludeOnlyFilteredRows: true,
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
});
|
|
226
|
+
setExpandedId(rowSummaryCardId(newIndex));
|
|
227
|
+
};
|
|
228
|
+
const handleDeleteRowSummary = (index) => {
|
|
229
|
+
const cardId = rowSummaryCardId(index);
|
|
230
|
+
const newSummaries = [...rowSummaries];
|
|
231
|
+
newSummaries.splice(index, 1);
|
|
232
|
+
props.onChange({
|
|
233
|
+
...layout,
|
|
234
|
+
RowSummaries: newSummaries,
|
|
235
|
+
});
|
|
236
|
+
if (expandedId === cardId) {
|
|
237
|
+
setExpandedId(null);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (expandedId?.startsWith('row-summary-')) {
|
|
241
|
+
const expandedIndex = Number(expandedId.replace('row-summary-', ''));
|
|
242
|
+
if (!Number.isNaN(expandedIndex) && expandedIndex > index) {
|
|
243
|
+
setExpandedId(rowSummaryCardId(expandedIndex - 1));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: (0, utils_1.cn)((0, CollapsibleWizardCard_1.getWizardAccordionSectionClassName)(hasExpandedCard, expandedFillsSpace), 'twa:p-3'), children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:mb-2 twa:max-w-[520px] twa:shrink-0", children: "Add summary rows at the top or bottom of the grid with aggregated column values" }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: "twa:justify-end twa:mb-2 twa:shrink-0", children: (0, jsx_runtime_1.jsx)(ButtonNew_1.ButtonNew, { onClick: handleAddRowSummary, children: "Add Row Summary" }) }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-3 twa:min-h-0", children: rowSummaries.map((rowSummary, index) => {
|
|
248
|
+
const cardBinding = bindCard(rowSummaryCardId(index), { fillAvailable: true });
|
|
249
|
+
return ((0, jsx_runtime_1.jsx)(CollapsibleWizardCard_1.CollapsibleWizardCard, { ...cardBinding, surface: "panel", "data-name": `row-summary-${index}`, title: `Row Summary ${index + 1}`, help: "Configure position, filters, and column aggregations for this summary row", collapsedHelp: false, compactSummary: (0, jsx_runtime_1.jsx)(RowSummaryPositionTag, { position: rowSummary.Position }), headerVisual: !cardBinding.expanded ? ((0, jsx_runtime_1.jsx)(RowSummaryPositionTag, { position: rowSummary.Position })) : undefined, headerActions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [cardBinding.expanded ? ((0, jsx_runtime_1.jsx)(SuspendToggleButton_1.SuspendToggleButton, { iconSize: 26, className: (0, objectListActionButtonStyles_1.objectListActionButtonClassName)('suspend'), onSuspend: () => {
|
|
250
|
+
const newSummaries = [...rowSummaries];
|
|
251
|
+
newSummaries[index] = { ...rowSummary, IsSuspended: true };
|
|
252
|
+
props.onChange({ ...layout, RowSummaries: newSummaries });
|
|
253
|
+
}, onUnSuspend: () => {
|
|
254
|
+
const newSummaries = [...rowSummaries];
|
|
255
|
+
newSummaries[index] = { ...rowSummary, IsSuspended: false };
|
|
256
|
+
props.onChange({ ...layout, RowSummaries: newSummaries });
|
|
257
|
+
}, suspendableObject: rowSummary })) : null, (0, jsx_runtime_1.jsx)(SimpleButton_1.default, { icon: "delete", variant: "text", tooltip: "Delete row summary", className: (0, objectListActionButtonStyles_1.objectListActionButtonClassName)('delete'), onClick: () => handleDeleteRowSummary(index) })] }), summary: (0, jsx_runtime_1.jsx)(RowSummaryCardSummary, { rowSummary: rowSummary }), className: "twa:overflow-hidden twa:flex twa:flex-col", bodyClassName: "twa:min-h-[200px] twa:max-h-[420px] twa:overflow-hidden twa:flex twa:flex-col twa:!pt-0", children: (0, jsx_runtime_1.jsx)(RowSummaryEditorForm, { rowSummary: rowSummary, availableScalarExpressions: availableScalarExpressions, onChange: (nextRowSummary) => {
|
|
258
|
+
const newSummaries = [...rowSummaries];
|
|
259
|
+
newSummaries[index] = nextRowSummary;
|
|
260
|
+
props.onChange({
|
|
261
|
+
...layout,
|
|
262
|
+
RowSummaries: newSummaries,
|
|
263
|
+
});
|
|
264
|
+
} }) }, rowSummaryCardId(index)));
|
|
265
|
+
}) })] }));
|
|
240
266
|
};
|
|
241
267
|
exports.RowSummarySection = RowSummarySection;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AdaptableApi } from '../../../Api/AdaptableApi';
|
|
3
|
-
import { BadgePillStyle } from '../../../AdaptableState/
|
|
3
|
+
import { BadgePillStyle } from '../../../AdaptableState/StyledColumns/BadgeStyle';
|
|
4
4
|
export interface BadgePillStyleEditorProps {
|
|
5
5
|
api: AdaptableApi;
|
|
6
6
|
/** Current pill style (may be undefined / partial). */
|
|
@@ -61,32 +61,47 @@ const getBadgeDefinitionSummaryItems = (badge, api) => {
|
|
|
61
61
|
items.push({ label: 'Rule', value: rule });
|
|
62
62
|
items.push({ label: 'Shape', value: badge.Shape ?? 'Rounded' });
|
|
63
63
|
items.push(...(0, BadgePillStyleEditor_1.getBadgePillStyleSummaryItems)(badge.PillStyle));
|
|
64
|
-
|
|
64
|
+
const iconProps = badge.IconProperties;
|
|
65
|
+
if (iconProps?.Icon) {
|
|
65
66
|
items.push({
|
|
66
67
|
label: 'Icon',
|
|
67
|
-
value: 'name' in
|
|
68
|
-
icon:
|
|
68
|
+
value: 'name' in iconProps.Icon ? iconProps.Icon.name : 'Custom',
|
|
69
|
+
icon: iconProps.Icon,
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
|
-
if (
|
|
72
|
+
if (iconProps?.IconOnly) {
|
|
72
73
|
items.push({ label: 'Icon Only', value: 'Yes' });
|
|
73
74
|
}
|
|
74
|
-
if (
|
|
75
|
-
items.push({ label: 'Icon Position', value:
|
|
75
|
+
if (iconProps?.Icon && iconProps.Position) {
|
|
76
|
+
items.push({ label: 'Icon Position', value: iconProps.Position });
|
|
76
77
|
}
|
|
77
|
-
if (typeof
|
|
78
|
-
items.push({ label: 'Icon Gap', value: `${
|
|
78
|
+
if (typeof iconProps?.Gap === 'number') {
|
|
79
|
+
items.push({ label: 'Icon Gap', value: `${iconProps.Gap}px` });
|
|
79
80
|
}
|
|
80
81
|
return items;
|
|
81
82
|
};
|
|
82
|
-
const BadgePreview = ({ badge, density, previewValue }) => ((0, jsx_runtime_1.jsx)(Badge_1.Badge, { pillStyle: badge.PillStyle, icon: badge.Icon, iconPosition: badge.
|
|
83
|
+
const BadgePreview = ({ badge, density, previewValue }) => ((0, jsx_runtime_1.jsx)(Badge_1.Badge, { pillStyle: badge.PillStyle, icon: badge.IconProperties?.Icon, iconPosition: badge.IconProperties?.Position, shape: badge.Shape, density: density, iconGap: badge.IconProperties?.Gap, children: badge.IconProperties?.IconOnly ? '' : previewValue }));
|
|
83
84
|
const BadgeCardSummary = ({ badge, api }) => ((0, jsx_runtime_1.jsx)(CollapsibleWizardCard_1.CollapsibleWizardValueSummary, { value: (0, SummaryColorTag_1.renderSummaryLabelValueTags)(getBadgeDefinitionSummaryItems(badge, api)) }));
|
|
84
85
|
const BadgeEditorForm = (props) => {
|
|
85
86
|
const { api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
86
87
|
const { badge, columnId, onChange } = props;
|
|
87
88
|
const predicateDefs = api.styledColumnApi.internalApi.getBadgePredicateDefsForColumn(columnId);
|
|
88
89
|
const currentShape = badge.Shape ?? 'Rounded';
|
|
89
|
-
const
|
|
90
|
+
const iconProps = badge.IconProperties;
|
|
91
|
+
const hasIcon = Boolean(iconProps?.Icon);
|
|
92
|
+
const updateIconProperties = (patch) => {
|
|
93
|
+
const next = {
|
|
94
|
+
...(iconProps ?? { Icon: undefined }),
|
|
95
|
+
...patch,
|
|
96
|
+
};
|
|
97
|
+
if (!next.Icon) {
|
|
98
|
+
const cleaned = { ...badge };
|
|
99
|
+
delete cleaned.IconProperties;
|
|
100
|
+
onChange(cleaned);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
onChange({ ...badge, IconProperties: next });
|
|
104
|
+
};
|
|
90
105
|
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-3 twa:p-2", 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: "Shape" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Define shape of the corners for this badge" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:p-1", children: (0, jsx_runtime_1.jsx)(Radio_1.RadioGroup, { orientation: "horizontal", name: `ab-badge-shape-${columnId}`, value: currentShape, onRadioChange: (value) => onChange({ ...badge, Shape: value }), className: "twa:gap-3", children: SHAPE_CHOICES.map((choice) => ((0, jsx_runtime_1.jsx)(Radio_1.default, { value: choice.value, children: choice.label }, choice.value))) }) })] }), (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: "Style" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Colours and font styling for the badge pill" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:p-1", children: (0, jsx_runtime_1.jsx)(BadgePillStyleEditor_1.BadgePillStyleEditor, { embedded: true, api: api, value: badge.PillStyle, onChange: (next) => {
|
|
91
106
|
if (next) {
|
|
92
107
|
onChange({ ...badge, PillStyle: next });
|
|
@@ -104,31 +119,23 @@ const BadgeEditorForm = (props) => {
|
|
|
104
119
|
}, onClear: () => onChange({
|
|
105
120
|
...badge,
|
|
106
121
|
Predicate: undefined,
|
|
107
|
-
}) })) : ((0, jsx_runtime_1.jsx)(ErrorBox_1.default, { children: "Select a column first" })) })] }), (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: "Icon" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Optional icon inside the badge \u2014 position and spacing apply once an icon is selected" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:p-1", children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Icon", children: !
|
|
122
|
+
}) })) : ((0, jsx_runtime_1.jsx)(ErrorBox_1.default, { children: "Select a column first" })) })] }), (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: "Icon" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Optional icon inside the badge \u2014 position and spacing apply once an icon is selected" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:p-1", children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Icon", children: !iconProps?.Icon || 'name' in iconProps.Icon ? ((0, jsx_runtime_1.jsx)(AdaptableIconSelector_1.AdaptableIconSelector, { value: iconProps?.Icon && 'name' in iconProps.Icon ? iconProps.Icon.name : undefined, onChange: (iconName) => {
|
|
108
123
|
if (iconName) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Icon: {
|
|
112
|
-
name: iconName,
|
|
113
|
-
},
|
|
124
|
+
updateIconProperties({
|
|
125
|
+
Icon: { name: iconName },
|
|
114
126
|
});
|
|
115
127
|
}
|
|
116
128
|
else {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
IconOnly: undefined,
|
|
121
|
-
IconPosition: undefined,
|
|
122
|
-
IconGap: undefined,
|
|
123
|
-
});
|
|
129
|
+
const cleaned = { ...badge };
|
|
130
|
+
delete cleaned.IconProperties;
|
|
131
|
+
onChange(cleaned);
|
|
124
132
|
}
|
|
125
|
-
} })) : ((0, jsx_runtime_1.jsx)(AdaptableIconComponent_1.AdaptableIconComponent, { icon:
|
|
133
|
+
} })) : ((0, jsx_runtime_1.jsx)(AdaptableIconComponent_1.AdaptableIconComponent, { icon: iconProps.Icon })) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Icon Position", children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:max-w-[160px]", children: (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { disabled: !hasIcon, className: "twa:w-full", value: iconProps?.Position ?? 'Start', onValueChange: (v) => updateIconProperties({ Position: v }), items: [
|
|
126
134
|
{ value: 'Start', label: 'Start' },
|
|
127
135
|
{ value: 'End', label: 'End' },
|
|
128
|
-
] }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Show Icon Only", children: (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: !hasIcon, checked:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
IconGap: typeof value === 'number' && value >= 0 ? value : undefined,
|
|
136
|
+
] }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Show Icon Only", children: (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: !hasIcon, checked: iconProps?.IconOnly, onClick: () => updateIconProperties({ IconOnly: !iconProps?.IconOnly }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Icon Gap", children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsx)(NumberInput_1.NumberInput, { disabled: !hasIcon || iconProps?.IconOnly, value: iconProps?.Gap ?? '', placeholder: "auto", step: 1, min: 0, style: { width: 70 }, onChange: (value) => {
|
|
137
|
+
updateIconProperties({
|
|
138
|
+
Gap: typeof value === 'number' && value >= 0 ? value : undefined,
|
|
132
139
|
});
|
|
133
140
|
} }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70", children: "px between icon and text \u2014 leave blank to follow Density" })] }) })] }) })] })] }));
|
|
134
141
|
};
|
|
@@ -198,8 +205,7 @@ const StyledColumnBadgeSection = (props) => {
|
|
|
198
205
|
? api.columnApi.getColumnDataTypeForColumnId(data.ColumnId)
|
|
199
206
|
: 'text';
|
|
200
207
|
const previewValue = getBadgePreviewValue(dataType);
|
|
201
|
-
const
|
|
202
|
-
const { bindCard, hasExpandedCard, expandedFillsSpace, expandedId, setExpandedId } = (0, CollapsibleWizardCard_1.useWizardCardAccordion)(initialExpandedCardId);
|
|
208
|
+
const { bindCard, hasExpandedCard, expandedFillsSpace, expandedId, setExpandedId } = (0, CollapsibleWizardCard_1.useWizardCardAccordion)(null);
|
|
203
209
|
const handleAddBadge = () => {
|
|
204
210
|
const newIndex = badges.length;
|
|
205
211
|
props.onChange({
|
|
@@ -13,9 +13,7 @@ export interface StyledColumnFontStyleEditorProps {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* When true, the Alignment row is omitted entirely. Used by Styled Columns
|
|
16
|
-
* that own horizontal alignment elsewhere (e.g.
|
|
17
|
-
* Center / Right" controls drive `CellTextAlignment`, so showing a second
|
|
18
|
-
* Alignment row inside the font editor is confusing).
|
|
16
|
+
* that own horizontal alignment elsewhere (e.g. Badge row layout).
|
|
19
17
|
*/
|
|
20
18
|
hideAlignment?: boolean;
|
|
21
19
|
}
|