@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
@@ -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.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:mr-1 twa:mb-1", children: [rowSummary.Position, ":", ' ', Object.keys(rowSummary.ColumnsMap).map((colId) => {
112
- if (colId === 'Source' || colId === 'Uuid')
113
- return null;
114
- return ((0, jsx_runtime_1.jsxs)(Tag_1.ColumnTag, { className: "twa:mr-1", children: [rowSummary.ColumnsMap[colId], "(", adaptable.api.columnApi.getFriendlyNameForColumnId(colId), ")"] }, colId));
115
- })] }, index) }));
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 RowSummaryEditor = React.memo(({ rowSummary, onChange, availableScalarExpressions, onDelete, }) => {
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.jsx)(Panel_1.default, { className: "twa:mb-3", bodyProps: { className: 'twa:p-2' }, children: (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { className: "twa:w-full", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium twa:flex-1", children: "Row Summary" }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2 twa:shrink-0", children: [(0, jsx_runtime_1.jsx)(SuspendToggleButton_1.SuspendToggleButton, { onSuspend: () => {
136
- onChange({
137
- ...rowSummary,
138
- IsSuspended: true,
139
- });
140
- }, onUnSuspend: () => {
141
- onChange({
142
- ...rowSummary,
143
- IsSuspended: false,
144
- });
145
- }, suspendableObject: rowSummary }), (0, jsx_runtime_1.jsx)(SimpleButton_1.default, { icon: "delete", onClick: () => {
146
- onDelete();
147
- } })] })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card.Body, { className: "twa:p-1 twa:gap-3", 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:h-[400px] 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
- } }) })] })] })] }) }));
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
- return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-3 twa:p-3 twa:h-full", 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: "Row Summaries" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Add summary rows at the top or bottom of the grid with aggregated column values" })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card.Body, { className: "twa:p-1", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: "twa:mb-2", children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: "twa:flex-1" }), (0, jsx_runtime_1.jsx)(ButtonNew_1.ButtonNew, { onClick: () => {
212
- props.onChange({
213
- ...layout,
214
- RowSummaries: [
215
- ...(layout.RowSummaries ?? []),
216
- {
217
- Position: 'Top',
218
- ColumnsMap: {},
219
- IncludeOnlyFilteredRows: true,
220
- },
221
- ],
222
- });
223
- }, children: "Add Row Summary" })] }), (layout.RowSummaries ?? []).map((rowSummary, index) => {
224
- return ((0, jsx_runtime_1.jsx)(RowSummaryEditor, { onDelete: () => {
225
- const newSummaries = [...layout.RowSummaries];
226
- newSummaries.splice(index, 1);
227
- props.onChange({
228
- ...layout,
229
- RowSummaries: newSummaries,
230
- });
231
- }, availableScalarExpressions: availableScalarExpressions, rowSummary: rowSummary, onChange: (rowSummary) => {
232
- const newSummaries = [...layout.RowSummaries];
233
- newSummaries[index] = rowSummary;
234
- props.onChange({
235
- ...layout,
236
- RowSummaries: newSummaries,
237
- });
238
- } }, index));
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/StyledColumnState';
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
- if (badge.Icon) {
64
+ const iconProps = badge.IconProperties;
65
+ if (iconProps?.Icon) {
65
66
  items.push({
66
67
  label: 'Icon',
67
- value: 'name' in badge.Icon ? badge.Icon.name : 'Custom',
68
- icon: badge.Icon,
68
+ value: 'name' in iconProps.Icon ? iconProps.Icon.name : 'Custom',
69
+ icon: iconProps.Icon,
69
70
  });
70
71
  }
71
- if (badge.IconOnly) {
72
+ if (iconProps?.IconOnly) {
72
73
  items.push({ label: 'Icon Only', value: 'Yes' });
73
74
  }
74
- if (badge.Icon && badge.IconPosition) {
75
- items.push({ label: 'Icon Position', value: badge.IconPosition });
75
+ if (iconProps?.Icon && iconProps.Position) {
76
+ items.push({ label: 'Icon Position', value: iconProps.Position });
76
77
  }
77
- if (typeof badge.IconGap === 'number') {
78
- items.push({ label: 'Icon Gap', value: `${badge.IconGap}px` });
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.IconPosition, shape: badge.Shape, density: density, iconGap: badge.IconGap, children: badge.IconOnly ? '' : previewValue }));
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 hasIcon = Boolean(badge.Icon);
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: !badge.Icon || 'name' in badge.Icon ? ((0, jsx_runtime_1.jsx)(AdaptableIconSelector_1.AdaptableIconSelector, { value: badge?.Icon && 'name' in badge.Icon ? badge.Icon.name : undefined, onChange: (iconName) => {
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
- onChange({
110
- ...badge,
111
- Icon: {
112
- name: iconName,
113
- },
124
+ updateIconProperties({
125
+ Icon: { name: iconName },
114
126
  });
115
127
  }
116
128
  else {
117
- onChange({
118
- ...badge,
119
- Icon: undefined,
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: badge.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: badge.IconPosition ?? 'Start', onValueChange: (v) => onChange({ ...badge, IconPosition: v }), items: [
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: badge.IconOnly, onClick: () => onChange({ ...badge, IconOnly: !badge.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 || badge.IconOnly, value: badge.IconGap ?? '', placeholder: "auto", step: 1, min: 0, style: { width: 70 }, onChange: (value) => {
129
- onChange({
130
- ...badge,
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 initialExpandedCardId = badges.length === 1 ? badgeCardId(0) : null;
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. Percent Bar's "Auto / Left /
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
  }