@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
|
@@ -14,7 +14,6 @@ const RangesComponent_1 = require("../../Components/RangesComponent");
|
|
|
14
14
|
const ColumnSelector_1 = require("../../Components/Selectors/ColumnSelector");
|
|
15
15
|
const UIHelper_1 = require("../../UIHelper");
|
|
16
16
|
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
17
|
-
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/ArrayExtensions"));
|
|
18
17
|
const AdaptableInput_1 = tslib_1.__importDefault(require("../../Components/AdaptableInput"));
|
|
19
18
|
const Flex_1 = require("../../../components/Flex");
|
|
20
19
|
const NewSelect_1 = require("../../../components/NewSelect");
|
|
@@ -22,6 +21,8 @@ const RangeBarRangesSummaryPreview_1 = require("./StyledColumnWizardStyleSection
|
|
|
22
21
|
const StyledColumnRangeBarPreview_1 = require("./StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview");
|
|
23
22
|
const Card_1 = require("../../../components/Card");
|
|
24
23
|
const SummaryColorTag_1 = require("../../Wizard/SummaryColorTag");
|
|
24
|
+
const barChartCellText_1 = require("../../../Utilities/Helpers/barChartCellText");
|
|
25
|
+
const BarChartCellTextLayoutEditor_1 = require("./StyledColumnWizardStyleSection/Components/BarChartCellTextLayoutEditor");
|
|
25
26
|
const RANGE_STYLE_FORM_SIZES = ['200px', '1fr'];
|
|
26
27
|
const BOUND_MODE_LABELS = {
|
|
27
28
|
Number: 'Fixed Number',
|
|
@@ -126,8 +127,8 @@ const getStyledColumnRangeBarRangeViewValues = (data) => {
|
|
|
126
127
|
`Min: ${summarizeBound(range.Min)}`,
|
|
127
128
|
`Max: ${summarizeBound(range.Max)}`,
|
|
128
129
|
];
|
|
129
|
-
if (range.Reference != undefined) {
|
|
130
|
-
items.push(`Reference: ${summarizeBound(range.Reference)}`);
|
|
130
|
+
if (range.Reference?.Value != undefined) {
|
|
131
|
+
items.push(`Reference: ${summarizeBound(range.Reference.Value)}`);
|
|
131
132
|
}
|
|
132
133
|
const bandCount = range.CellRanges?.length ?? 0;
|
|
133
134
|
if (bandCount > 0) {
|
|
@@ -142,7 +143,8 @@ exports.getStyledColumnRangeBarRangeViewValues = getStyledColumnRangeBarRangeVie
|
|
|
142
143
|
const buildStyledColumnRangeBarDisplaySummaryStrings = (range, options) => {
|
|
143
144
|
const items = [];
|
|
144
145
|
const valueMarker = range.Marker;
|
|
145
|
-
const
|
|
146
|
+
const referenceProperties = range.Reference;
|
|
147
|
+
const referenceMarker = referenceProperties?.Marker;
|
|
146
148
|
items.push(`Value Marker Shape: ${valueMarker?.Shape ?? 'Diamond'}`);
|
|
147
149
|
if (valueMarker?.Color) {
|
|
148
150
|
items.push(`Value Marker Colour: ${valueMarker.Color}`);
|
|
@@ -150,7 +152,7 @@ const buildStyledColumnRangeBarDisplaySummaryStrings = (range, options) => {
|
|
|
150
152
|
if (valueMarker?.Size != null) {
|
|
151
153
|
items.push(`Value Marker Size: ${valueMarker.Size}px`);
|
|
152
154
|
}
|
|
153
|
-
if (
|
|
155
|
+
if (referenceProperties?.Value != undefined) {
|
|
154
156
|
items.push(`Reference Marker Shape: ${referenceMarker?.Shape ?? 'Line'}`);
|
|
155
157
|
if (referenceMarker?.Color) {
|
|
156
158
|
items.push(`Reference Marker Colour: ${referenceMarker.Color}`);
|
|
@@ -162,25 +164,31 @@ const buildStyledColumnRangeBarDisplaySummaryStrings = (range, options) => {
|
|
|
162
164
|
if (range.Orientation === 'Vertical') {
|
|
163
165
|
items.push('Orientation: Vertical');
|
|
164
166
|
}
|
|
165
|
-
const
|
|
167
|
+
const outOfRangeProperties = range.OutOfRange;
|
|
168
|
+
const outOfRangeMode = outOfRangeProperties?.Mode ?? 'Clamp';
|
|
166
169
|
if (outOfRangeMode !== 'Clamp') {
|
|
167
170
|
items.push(`Out of Range: ${outOfRangeMode}`);
|
|
168
171
|
}
|
|
169
|
-
if (
|
|
170
|
-
items.push(`Out of Range Colour: ${
|
|
172
|
+
if (outOfRangeProperties?.Color) {
|
|
173
|
+
items.push(`Out of Range Colour: ${outOfRangeProperties.Color}`);
|
|
171
174
|
}
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
const trackProperties = range.Track;
|
|
176
|
+
if (trackProperties?.Color) {
|
|
177
|
+
items.push(`Track Colour: ${trackProperties.Color}`);
|
|
174
178
|
}
|
|
175
|
-
if (
|
|
176
|
-
items.push(`Track Height: ${
|
|
179
|
+
if (trackProperties?.Height != null) {
|
|
180
|
+
items.push(`Track Height: ${trackProperties.Height}px`);
|
|
177
181
|
}
|
|
178
182
|
if (range.BackColor) {
|
|
179
183
|
items.push(`Back Colour: ${range.BackColor}`);
|
|
180
184
|
}
|
|
181
|
-
if (range.
|
|
182
|
-
|
|
183
|
-
items.push(`Cell Text
|
|
185
|
+
if ((0, barChartCellText_1.hasBarChartCellTextConfigured)(range.CellTextProperties)) {
|
|
186
|
+
const tokens = (0, barChartCellText_1.getActiveBarChartCellTextTokens)(range.CellTextProperties);
|
|
187
|
+
items.push(`Cell Text: ${formatRangeBarCellTextSummary(tokens)}`);
|
|
188
|
+
const layoutSummary = (0, barChartCellText_1.formatBarChartCellTextLayoutSummary)((0, barChartCellText_1.resolveBarChartCellTextLayout)(range.CellTextProperties));
|
|
189
|
+
if (layoutSummary) {
|
|
190
|
+
items.push(`Placement: ${layoutSummary}`);
|
|
191
|
+
}
|
|
184
192
|
}
|
|
185
193
|
else if (options.includeEmptyCellText) {
|
|
186
194
|
items.push('Cell Text: None');
|
|
@@ -332,15 +340,41 @@ const StyledColumnWizardRangeBarSection = (props) => {
|
|
|
332
340
|
},
|
|
333
341
|
});
|
|
334
342
|
}, [data, range]);
|
|
335
|
-
const
|
|
343
|
+
const updateBackColor = (color) => {
|
|
336
344
|
if (color) {
|
|
337
|
-
update({
|
|
345
|
+
update({ BackColor: color });
|
|
338
346
|
return;
|
|
339
347
|
}
|
|
340
348
|
const next = { ...range };
|
|
341
|
-
delete next
|
|
349
|
+
delete next.BackColor;
|
|
342
350
|
props.onChange({ ...data, RangeBarStyle: next });
|
|
343
351
|
};
|
|
352
|
+
const updateTrackProperties = (patch) => {
|
|
353
|
+
const merged = {
|
|
354
|
+
...range.Track,
|
|
355
|
+
...patch,
|
|
356
|
+
};
|
|
357
|
+
const isEmpty = merged.Color == undefined && merged.Height == undefined;
|
|
358
|
+
update({ Track: isEmpty ? undefined : merged });
|
|
359
|
+
};
|
|
360
|
+
const updateOutOfRangeProperties = (patch) => {
|
|
361
|
+
const merged = {
|
|
362
|
+
...range.OutOfRange,
|
|
363
|
+
...patch,
|
|
364
|
+
};
|
|
365
|
+
// Default mode is `Clamp` with no override colour; drop the wrapper in
|
|
366
|
+
// that case so empty state serialises cleanly.
|
|
367
|
+
const isEmpty = (merged.Mode == undefined || merged.Mode === 'Clamp') && merged.Color == undefined;
|
|
368
|
+
update({ OutOfRange: isEmpty ? undefined : merged });
|
|
369
|
+
};
|
|
370
|
+
const updateReferenceProperties = (patch) => {
|
|
371
|
+
const merged = {
|
|
372
|
+
Value: range.Reference?.Value,
|
|
373
|
+
...range.Reference,
|
|
374
|
+
...patch,
|
|
375
|
+
};
|
|
376
|
+
update({ Reference: merged });
|
|
377
|
+
};
|
|
344
378
|
// -- Bound editors ---------------------------------------------------------
|
|
345
379
|
// Resolved values for the column-wide aggregate bound modes, shown read-only
|
|
346
380
|
// in the bound editor so the user sees the underlying number.
|
|
@@ -359,6 +393,16 @@ const StyledColumnWizardRangeBarSection = (props) => {
|
|
|
359
393
|
*/
|
|
360
394
|
const renderBoundEditor = (opts) => {
|
|
361
395
|
const setBound = (next) => {
|
|
396
|
+
if (opts.field === 'Reference') {
|
|
397
|
+
if (next === undefined) {
|
|
398
|
+
const cleaned = { ...range };
|
|
399
|
+
delete cleaned.Reference;
|
|
400
|
+
props.onChange({ ...data, RangeBarStyle: cleaned });
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
updateReferenceProperties({ Value: next });
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
362
406
|
if (next === undefined) {
|
|
363
407
|
const cleaned = { ...range };
|
|
364
408
|
delete cleaned[opts.field];
|
|
@@ -367,7 +411,8 @@ const StyledColumnWizardRangeBarSection = (props) => {
|
|
|
367
411
|
}
|
|
368
412
|
update({ [opts.field]: next });
|
|
369
413
|
};
|
|
370
|
-
|
|
414
|
+
const value = opts.field === 'Reference' ? range.Reference?.Value : range[opts.field];
|
|
415
|
+
return ((0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: `${opts.label}:`, children: (0, jsx_runtime_1.jsx)(RangeBarBoundInput, { api: api, value: value, optional: opts.optional, fallbackNumber: opts.fallbackNumber, excludeColumnId: data.ColumnId, resolved: resolvedBoundValues, disabled: disabled, onChange: setBound }) }));
|
|
371
416
|
};
|
|
372
417
|
// -- Marker editors --------------------------------------------------------
|
|
373
418
|
const updateValueMarker = (patch) => {
|
|
@@ -380,10 +425,10 @@ const StyledColumnWizardRangeBarSection = (props) => {
|
|
|
380
425
|
});
|
|
381
426
|
};
|
|
382
427
|
const updateReferenceMarker = (patch) => {
|
|
383
|
-
|
|
384
|
-
|
|
428
|
+
updateReferenceProperties({
|
|
429
|
+
Marker: {
|
|
385
430
|
Shape: 'Line',
|
|
386
|
-
...range.
|
|
431
|
+
...range.Reference?.Marker,
|
|
387
432
|
...patch,
|
|
388
433
|
},
|
|
389
434
|
});
|
|
@@ -395,18 +440,20 @@ const StyledColumnWizardRangeBarSection = (props) => {
|
|
|
395
440
|
Color: range.Marker?.Color ?? '',
|
|
396
441
|
Size: range.Marker?.Size ?? (range.Marker?.Shape === 'Line' ? 2 : 10),
|
|
397
442
|
};
|
|
443
|
+
const referenceMarkerCfg = range.Reference?.Marker;
|
|
398
444
|
const referenceMarker = {
|
|
399
|
-
Shape:
|
|
400
|
-
Color:
|
|
401
|
-
Size:
|
|
445
|
+
Shape: referenceMarkerCfg?.Shape ?? 'Line',
|
|
446
|
+
Color: referenceMarkerCfg?.Color ?? '',
|
|
447
|
+
Size: referenceMarkerCfg?.Size ?? (referenceMarkerCfg?.Shape === 'Line' ? 2 : 8),
|
|
402
448
|
};
|
|
403
449
|
// -- Cell text -------------------------------------------------------------
|
|
404
|
-
const toggleCellText = (token,
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
450
|
+
const toggleCellText = (token, show) => {
|
|
451
|
+
update((0, barChartCellText_1.toggleBarChartCellTextToken)(range.CellTextProperties, token, show));
|
|
452
|
+
};
|
|
453
|
+
const onCellTextPlacementChange = (token, patch) => {
|
|
454
|
+
update({
|
|
455
|
+
CellTextProperties: (0, barChartCellText_1.patchBarChartCellTextPlacement)(range.CellTextProperties, token, patch),
|
|
456
|
+
});
|
|
410
457
|
};
|
|
411
458
|
const toggleToolTipText = (token, checked) => {
|
|
412
459
|
const current = range.ToolTipText ?? [];
|
|
@@ -415,9 +462,6 @@ const StyledColumnWizardRangeBarSection = (props) => {
|
|
|
415
462
|
: current.filter((t) => t !== token);
|
|
416
463
|
update({ ToolTipText: next });
|
|
417
464
|
};
|
|
418
|
-
const handleCellTextPositionChange = (pos) => {
|
|
419
|
-
update({ CellTextPosition: pos });
|
|
420
|
-
};
|
|
421
465
|
// -------------------------------------------------------------------------
|
|
422
466
|
// Render
|
|
423
467
|
// -------------------------------------------------------------------------
|
|
@@ -426,8 +470,8 @@ const StyledColumnWizardRangeBarSection = (props) => {
|
|
|
426
470
|
? 'You need to select a column before styling.'
|
|
427
471
|
: `Column "${data.ColumnId}" was not found in the grid.` }) }));
|
|
428
472
|
}
|
|
429
|
-
const hasReference = range.Reference != undefined;
|
|
430
|
-
const outOfRangeMode = range.
|
|
473
|
+
const hasReference = range.Reference?.Value != undefined;
|
|
474
|
+
const outOfRangeMode = range.OutOfRange?.Mode ?? 'Clamp';
|
|
431
475
|
const isRangeVariant = props.variant === 'range';
|
|
432
476
|
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { children: [isRangeVariant && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, className: "twa:mb-3", children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Bounds" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Set each row's track scale. A bound can be a fixed number, another column's value (read per row), or a column-wide aggregate (min, max, average, median). Reference is an optional second marker." })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [renderBoundEditor({
|
|
433
477
|
label: 'Min',
|
|
@@ -449,16 +493,14 @@ const StyledColumnWizardRangeBarSection = (props) => {
|
|
|
449
493
|
: 'Optional second marker when a Reference bound is set on the Style step.' })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: hasReference ? ((0, jsx_runtime_1.jsxs)(FormLayout_1.default, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Shape:", children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:max-w-[160px]", children: (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { className: "twa:w-full", value: referenceMarker.Shape, onValueChange: (s) => updateReferenceMarker({ Shape: s }), items: MARKER_SHAPES.map((s) => ({ value: s.value, label: s.label })) }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: `${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: (0, jsx_runtime_1.jsx)(ColorPicker_1.ColorPicker, { disabled: disabled, api: api, value: referenceMarker.Color || undefined, onChange: (c) => updateReferenceMarker({ Color: c }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Size:", children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:max-w-[100px]", children: (0, jsx_runtime_1.jsx)(AdaptableInput_1.default, { type: "number", min: 1, value: referenceMarker.Size, onChange: (e) => updateReferenceMarker({ Size: Number(e.target.value) }) }) }) })] })) : ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-60 twa:max-w-[520px]", children: "Add a Reference value on the Style step (Bounds section) to enable this marker (e.g. previous close, target, midpoint)." })) })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, className: "twa:mb-3", children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Track" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "The line representing the [Min, Max] interval, plus optional cell background." })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Orientation:", children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:max-w-[160px]", children: (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { className: "twa:w-full", value: range.Orientation ?? 'Horizontal', onValueChange: (v) => update({ Orientation: v }), items: [
|
|
450
494
|
{ value: 'Horizontal', label: 'Horizontal' },
|
|
451
495
|
{ value: 'Vertical', label: 'Vertical' },
|
|
452
|
-
] }) }) }), range.Orientation === 'Vertical' && ((0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "", children: (0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:text-xs twa:text-neutral-500 twa:max-w-[520px]", children: ["Tip: vertical Range Bars need a tall row height to be readable (we recommend at least 60px). Set ", (0, jsx_runtime_1.jsx)("code", { children: "rowHeight" }), " on ", (0, jsx_runtime_1.jsx)("code", { children: " gridOptions " }), " or use ", (0, jsx_runtime_1.jsx)("code", { children: "getRowHeight" }), "."] }) })), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: `Track ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: (0, jsx_runtime_1.jsx)(ColorPicker_1.OptionalColorPicker, { disabled: disabled, api: api, value: range.
|
|
453
|
-
|
|
454
|
-
}), placeholder: "4" }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: `Back ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: (0, jsx_runtime_1.jsx)(ColorPicker_1.OptionalColorPicker, { disabled: disabled, api: api, value: range.BackColor ?? undefined, defaultColor: (0, UIHelper_1.getGraySwatchColor)(), onChange: (c) =>
|
|
496
|
+
] }) }) }), range.Orientation === 'Vertical' && ((0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "", children: (0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:text-xs twa:text-neutral-500 twa:max-w-[520px]", children: ["Tip: vertical Range Bars need a tall row height to be readable (we recommend at least 60px). Set ", (0, jsx_runtime_1.jsx)("code", { children: "rowHeight" }), " on ", (0, jsx_runtime_1.jsx)("code", { children: " gridOptions " }), " or use ", (0, jsx_runtime_1.jsx)("code", { children: "getRowHeight" }), "."] }) })), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: `Track ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: (0, jsx_runtime_1.jsx)(ColorPicker_1.OptionalColorPicker, { disabled: disabled, api: api, value: range.Track?.Color, defaultColor: (0, UIHelper_1.getGraySwatchColor)(), onChange: (c) => updateTrackProperties({ Color: c }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: range.Orientation === 'Vertical' ? 'Track Width (px):' : 'Track Height (px):', children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:max-w-[100px]", children: (0, jsx_runtime_1.jsx)(AdaptableInput_1.default, { type: "number", min: 1, value: range.Track?.Height ?? '', onChange: (e) => updateTrackProperties({
|
|
497
|
+
Height: e.target.value === '' ? undefined : Number(e.target.value),
|
|
498
|
+
}), placeholder: "4" }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: `Back ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: (0, jsx_runtime_1.jsx)(ColorPicker_1.OptionalColorPicker, { disabled: disabled, api: api, value: range.BackColor ?? undefined, defaultColor: (0, UIHelper_1.getGraySwatchColor)(), onChange: (c) => updateBackColor(c) }) })] }) })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, className: "twa:mb-3", children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Out of Range" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "How to draw the value marker when the cell value falls outside [Min, Max]." })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Behaviour:", children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:max-w-[160px]", children: (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { className: "twa:w-full", value: outOfRangeMode, onValueChange: (v) => updateOutOfRangeProperties({
|
|
499
|
+
Mode: v,
|
|
500
|
+
}), items: [
|
|
455
501
|
{ value: 'Clamp', label: 'Clamp to edge' },
|
|
456
502
|
{ value: 'Overflow', label: 'Show outside' },
|
|
457
503
|
{ value: 'Hide', label: 'Hide marker' },
|
|
458
|
-
] }) }) }), outOfRangeMode === 'Clamp' && ((0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: `Out-of-range ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: (0, jsx_runtime_1.jsx)(ColorPicker_1.OptionalColorPicker, { disabled: disabled, api: api, value: range.
|
|
459
|
-
{ value: 'Above', label: 'Above Bar' },
|
|
460
|
-
{ value: 'Below', label: 'Below Bar' },
|
|
461
|
-
{ value: 'Merged', label: 'Merged' },
|
|
462
|
-
] }) }) }), (0, jsx_runtime_1.jsxs)(FormLayout_1.FormRow, { label: "Tooltip Display:", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, checked: range.ToolTipText?.includes('CellValue'), onChange: (checked) => toggleToolTipText('CellValue', checked), children: "Cell Value" }), ' ', (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, className: "twa:ml-3", checked: range.ToolTipText?.includes('PercentageValue'), onChange: (checked) => toggleToolTipText('PercentageValue', checked), children: "Percent Value" })] })] }) })] }), (0, jsx_runtime_1.jsx)(StyledColumnRangeBarPreview_1.StyledColumnRangeBarPreviewCard, { data: data })] }))] }));
|
|
504
|
+
] }) }) }), outOfRangeMode === 'Clamp' && ((0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: `Out-of-range ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: (0, jsx_runtime_1.jsx)(ColorPicker_1.OptionalColorPicker, { disabled: disabled, api: api, value: range.OutOfRange?.Color, defaultColor: "crimson", onChange: (c) => updateOutOfRangeProperties({ Color: c }) }) }))] }) })] }), (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: "Text & Tooltip" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Optional cell-text overlay and AG Grid tooltip content." })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Cell Text Layout:", children: (0, jsx_runtime_1.jsx)(BarChartCellTextLayoutEditor_1.BarChartCellTextLayoutEditor, { disabled: disabled, cellTextProperties: range.CellTextProperties, onToggle: toggleCellText, onPlacementChange: onCellTextPlacementChange }) }), (0, jsx_runtime_1.jsxs)(FormLayout_1.FormRow, { label: "Tooltip Display:", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, checked: range.ToolTipText?.includes('CellValue'), onChange: (checked) => toggleToolTipText('CellValue', checked), children: "Cell Value" }), ' ', (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, className: "twa:ml-3", checked: range.ToolTipText?.includes('PercentageValue'), onChange: (checked) => toggleToolTipText('PercentageValue', checked), children: "Percent Value" })] })] }) })] }), (0, jsx_runtime_1.jsx)(StyledColumnRangeBarPreview_1.StyledColumnRangeBarPreviewCard, { data: data })] }))] }));
|
|
463
505
|
};
|
|
464
506
|
exports.StyledColumnWizardRangeBarSection = StyledColumnWizardRangeBarSection;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BarChartCellTextPlacement, BarChartCellTextProperties } from '../../../../../AdaptableState/StyledColumns/Common/BarChartCellText';
|
|
3
|
+
import { CellTextOption } from '../../../../../AdaptableState/StyledColumns/Common/CellTextOptions';
|
|
4
|
+
export declare const BarChartCellTextLayoutEditor: React.FunctionComponent<{
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
cellTextProperties?: BarChartCellTextProperties;
|
|
7
|
+
onToggle: (token: CellTextOption, show: boolean) => void;
|
|
8
|
+
onPlacementChange: (token: CellTextOption, patch: Partial<BarChartCellTextPlacement>) => void;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BarChartCellTextLayoutEditor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const React = tslib_1.__importStar(require("react"));
|
|
7
|
+
const barChartCellText_1 = require("../../../../../Utilities/Helpers/barChartCellText");
|
|
8
|
+
const CheckBox_1 = require("../../../../../components/CheckBox");
|
|
9
|
+
const Flex_1 = require("../../../../../components/Flex");
|
|
10
|
+
const NewSelect_1 = require("../../../../../components/NewSelect");
|
|
11
|
+
const TOKEN_LABELS = {
|
|
12
|
+
CellValue: 'Cell Value',
|
|
13
|
+
PercentageValue: 'Percent Value',
|
|
14
|
+
};
|
|
15
|
+
const TOKENS = ['CellValue', 'PercentageValue'];
|
|
16
|
+
const HORIZONTAL_CHOICES = [
|
|
17
|
+
{ value: 'Left', label: 'Left' },
|
|
18
|
+
{ value: 'Center', label: 'Center' },
|
|
19
|
+
{ value: 'Right', label: 'Right' },
|
|
20
|
+
];
|
|
21
|
+
const VERTICAL_CHOICES = [
|
|
22
|
+
{ value: 'Above', label: 'Above Bar' },
|
|
23
|
+
{ value: 'Below', label: 'Below Bar' },
|
|
24
|
+
{ value: 'Merged', label: 'Merged' },
|
|
25
|
+
];
|
|
26
|
+
const tokenKey = (token) => token === 'CellValue' ? 'CellValue' : 'PercentValue';
|
|
27
|
+
const BarChartCellTextLayoutEditor = ({ disabled, cellTextProperties, onToggle, onPlacementChange }) => {
|
|
28
|
+
const layout = (0, barChartCellText_1.resolveBarChartCellTextLayout)(cellTextProperties);
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:inline-grid twa:grid-cols-[160px_140px_140px] twa:gap-x-4 twa:gap-y-2 twa:items-center", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:font-medium twa:opacity-80", children: "Value" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:font-medium twa:opacity-80", children: "Horizontal" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:font-medium twa:opacity-80", children: "Vertical" }), TOKENS.map((token) => {
|
|
30
|
+
const placement = layout[tokenKey(token)];
|
|
31
|
+
const isShown = Boolean(placement);
|
|
32
|
+
const rowDisabled = disabled || !isShown;
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignItems: "center", children: (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, checked: isShown, onChange: (checked) => onToggle(token, checked), children: TOKEN_LABELS[token] }) }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { children: (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { className: "twa:w-full", disabled: rowDisabled, value: placement?.Horizontal ?? 'Left', onValueChange: (v) => onPlacementChange(token, {
|
|
34
|
+
Horizontal: v,
|
|
35
|
+
}), items: HORIZONTAL_CHOICES }) }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { children: (0, jsx_runtime_1.jsx)(NewSelect_1.SingleSelect, { className: "twa:w-full", disabled: rowDisabled, value: placement?.Vertical ?? 'Below', onValueChange: (v) => onPlacementChange(token, {
|
|
36
|
+
Vertical: v,
|
|
37
|
+
}), items: VERTICAL_CHOICES }) })] }, token));
|
|
38
|
+
})] }));
|
|
39
|
+
};
|
|
40
|
+
exports.BarChartCellTextLayoutEditor = BarChartCellTextLayoutEditor;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BarChartCellTextProperties } from '../../../../../AdaptableState/StyledColumns/Common/BarChartCellText';
|
|
3
|
+
import { BarChartCellTextLabels } from '../../../../../Utilities/Helpers/barChartCellText';
|
|
4
|
+
/**
|
|
5
|
+
* Preview of the per-value cell-text layout. Renders three potential bands:
|
|
6
|
+
* - `Above` slots (above the bar)
|
|
7
|
+
* - `Merged` slots (overlay on top of the bar — uses `mergedOverlayClassName`)
|
|
8
|
+
* - `Below` slots (below the bar)
|
|
9
|
+
*
|
|
10
|
+
* Each band has three horizontal slots (Left/Center/Right) so the spacing is
|
|
11
|
+
* stable. When `vertical` is provided, only the band matching that value is
|
|
12
|
+
* rendered (used by the preview cards to position bands around the bar).
|
|
13
|
+
*/
|
|
14
|
+
export declare const BarChartCellTextPreview: React.FunctionComponent<{
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
cellTextProperties?: BarChartCellTextProperties;
|
|
18
|
+
labels: BarChartCellTextLabels;
|
|
19
|
+
mergedOverlayClassName?: string;
|
|
20
|
+
/** Render only the band matching this vertical position. */
|
|
21
|
+
vertical?: 'Above' | 'Below' | 'Merged';
|
|
22
|
+
}>;
|
|
23
|
+
export declare const shouldShowBarChartCellTextOutsideBar: (cellTextProperties: BarChartCellTextProperties | undefined, hasCellText: boolean) => boolean;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldShowBarChartCellTextOutsideBar = exports.BarChartCellTextPreview = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const barChartCellText_1 = require("../../../../../Utilities/Helpers/barChartCellText");
|
|
6
|
+
const Flex_1 = require("../../../../../components/Flex");
|
|
7
|
+
const HORIZONTAL_ORDER = ['Left', 'Center', 'Right'];
|
|
8
|
+
const HORIZONTAL_JUSTIFY = {
|
|
9
|
+
Left: 'flex-start',
|
|
10
|
+
Center: 'center',
|
|
11
|
+
Right: 'flex-end',
|
|
12
|
+
};
|
|
13
|
+
const HORIZONTAL_TEXT_ALIGN = {
|
|
14
|
+
Left: 'left',
|
|
15
|
+
Center: 'center',
|
|
16
|
+
Right: 'right',
|
|
17
|
+
};
|
|
18
|
+
const CellTextRow = ({ className, style, slots }) => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: className, alignItems: "center", style: { ...style, width: '100%', gap: 4 }, children: HORIZONTAL_ORDER.map((horizontal) => {
|
|
19
|
+
const slot = slots.find((s) => s.horizontal === horizontal);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:truncate", style: {
|
|
21
|
+
flex: 1,
|
|
22
|
+
minWidth: 0,
|
|
23
|
+
display: 'flex',
|
|
24
|
+
justifyContent: HORIZONTAL_JUSTIFY[horizontal],
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
textAlign: HORIZONTAL_TEXT_ALIGN[horizontal],
|
|
27
|
+
}, children: slot?.text ?? '' }, horizontal));
|
|
28
|
+
}) }));
|
|
29
|
+
/**
|
|
30
|
+
* Preview of the per-value cell-text layout. Renders three potential bands:
|
|
31
|
+
* - `Above` slots (above the bar)
|
|
32
|
+
* - `Merged` slots (overlay on top of the bar — uses `mergedOverlayClassName`)
|
|
33
|
+
* - `Below` slots (below the bar)
|
|
34
|
+
*
|
|
35
|
+
* Each band has three horizontal slots (Left/Center/Right) so the spacing is
|
|
36
|
+
* stable. When `vertical` is provided, only the band matching that value is
|
|
37
|
+
* rendered (used by the preview cards to position bands around the bar).
|
|
38
|
+
*/
|
|
39
|
+
const BarChartCellTextPreview = ({ className, style, cellTextProperties, labels, mergedOverlayClassName, vertical }) => {
|
|
40
|
+
if (!labels.cellValue && !labels.percentage) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const slots = (0, barChartCellText_1.resolveBarChartCellTextSlots)(cellTextProperties, labels);
|
|
44
|
+
if (!slots.length) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const bandSlots = vertical ? slots.filter((s) => s.vertical === vertical) : slots;
|
|
48
|
+
if (!bandSlots.length) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const usedClassName = vertical === 'Merged' ? mergedOverlayClassName ?? className : className;
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(CellTextRow, { className: usedClassName, style: style, slots: bandSlots.map((s) => ({ horizontal: s.horizontal, text: s.text })) }));
|
|
53
|
+
};
|
|
54
|
+
exports.BarChartCellTextPreview = BarChartCellTextPreview;
|
|
55
|
+
const shouldShowBarChartCellTextOutsideBar = (cellTextProperties, hasCellText) => {
|
|
56
|
+
if (!hasCellText || !(0, barChartCellText_1.hasBarChartCellTextConfigured)(cellTextProperties)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const { hasAbove, hasBelow } = (0, barChartCellText_1.getBarChartCellTextSlotPresence)(cellTextProperties);
|
|
60
|
+
return hasAbove || hasBelow;
|
|
61
|
+
};
|
|
62
|
+
exports.shouldShowBarChartCellTextOutsideBar = shouldShowBarChartCellTextOutsideBar;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BulletChartStyle } from '../../../../../AdaptableState/
|
|
2
|
+
import { BulletChartStyle } from '../../../../../AdaptableState/StyledColumns/BulletChartStyle';
|
|
3
3
|
export declare const BulletRangesSummaryPreview: React.FunctionComponent<{
|
|
4
4
|
bulletStyle: BulletChartStyle;
|
|
5
5
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { CellColorRange, ColumnComparison,
|
|
2
|
+
import { CellColorRange, ColumnComparison, NumericStyledColumn } from '../../../../../AdaptableState/StyledColumns/Common/NumericStyledColumn';
|
|
3
|
+
import { GradientStyle, GradientZeroCentredColors } from '../../../../../AdaptableState/StyledColumns/GradientStyle';
|
|
3
4
|
import { AdaptableApi } from '../../../../../types';
|
|
4
5
|
export declare function gradientRangeStripCss(color: string, reverseGradient: boolean, minAlpha: number, maxAlpha: number): string;
|
|
5
6
|
export interface GradientRangesSummaryPreviewProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { RangeBarStyle } from '../../../../../AdaptableState/
|
|
2
|
+
import { RangeBarStyle } from '../../../../../AdaptableState/StyledColumns/RangeBarStyle';
|
|
3
3
|
export declare const RangeBarRangesSummaryPreview: React.FunctionComponent<{
|
|
4
4
|
rangeStyle: RangeBarStyle;
|
|
5
5
|
}>;
|
|
@@ -54,12 +54,13 @@ const StyledColumnBadgePreview = ({ data }) => {
|
|
|
54
54
|
: {}),
|
|
55
55
|
};
|
|
56
56
|
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: PREVIEW_CELL_CLASS, style: cellStyle, children: (0, jsx_runtime_1.jsx)("div", { className: wrapperClassName, style: wrapperStyle, children: badgeStyle.Badges.map((badge, index) => {
|
|
57
|
-
const
|
|
57
|
+
const iconProps = badge.IconProperties;
|
|
58
|
+
const badgeValue = iconProps?.IconOnly
|
|
58
59
|
? ''
|
|
59
60
|
: dataType === 'number'
|
|
60
61
|
? GeneralConstants_1.DEFAULT_INTEGER_DISPLAY_VALUE
|
|
61
62
|
: GeneralConstants_1.DEFAULT_STRING_DISPLAY_VALUE;
|
|
62
|
-
return ((0, jsx_runtime_1.jsx)(Badge_1.Badge, { icon:
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(Badge_1.Badge, { icon: iconProps?.Icon, pillStyle: badge.PillStyle, iconPosition: iconProps?.Position, shape: badge.Shape, density: badgeStyle.Density ?? 'Normal', iconGap: iconProps?.Gap, children: badgeValue }, index));
|
|
63
64
|
}) }) }));
|
|
64
65
|
};
|
|
65
66
|
exports.StyledColumnBadgePreview = StyledColumnBadgePreview;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyledColumn } from '../../../../../AdaptableState/StyledColumnState';
|
|
3
|
+
import { BulletChartStyle } from '../../../../../AdaptableState/StyledColumns/BulletChartStyle';
|
|
3
4
|
export declare const StyledColumnBulletPreview: React.FunctionComponent<React.PropsWithChildren<{
|
|
4
5
|
data: StyledColumn;
|
|
5
6
|
}>>;
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.hasBulletChartRangesConfigured = exports.StyledColumnBulletPreviewCard = exports.StyledColumnBulletPreview = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const StyleHelper_1 = require("../../../../../Utilities/Helpers/StyleHelper");
|
|
6
|
+
const barChartCellText_1 = require("../../../../../Utilities/Helpers/barChartCellText");
|
|
6
7
|
const Flex_1 = require("../../../../../components/Flex");
|
|
7
8
|
const Card_1 = require("../../../../../components/Card");
|
|
8
9
|
const Tag_1 = require("../../../../../components/Tag");
|
|
9
10
|
const StyledColumnChartListPreviews_1 = require("./StyledColumnChartListPreviews");
|
|
11
|
+
const BarChartCellTextPreview_1 = require("./BarChartCellTextPreview");
|
|
10
12
|
const PREVIEW_CELL_CLASS = 'ab-BulletPreviewCell twa:inline-flex twa:items-center twa:min-w-[180px] twa:min-h-[36px] twa:px-2 twa:py-1 twa:rounded-standard twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_15%,transparent)]';
|
|
11
13
|
const getBulletPreviewSample = (bullet) => {
|
|
12
14
|
const ranges = bullet.CellRanges ?? [];
|
|
@@ -26,29 +28,23 @@ const getBulletPreviewSample = (bullet) => {
|
|
|
26
28
|
valueFraction: Math.max(0, Math.min(1, valueFraction)),
|
|
27
29
|
};
|
|
28
30
|
};
|
|
29
|
-
const formatBulletPreviewCellText = (sampleValue, valueFraction, bullet) => {
|
|
30
|
-
const parts = [];
|
|
31
|
-
if (bullet.CellText?.includes('CellValue')) {
|
|
32
|
-
parts.push(Number.isInteger(sampleValue) ? String(sampleValue) : sampleValue.toFixed(1));
|
|
33
|
-
}
|
|
34
|
-
if (bullet.CellText?.includes('PercentageValue')) {
|
|
35
|
-
parts.push(`${(valueFraction * 100).toFixed(0)}%`);
|
|
36
|
-
}
|
|
37
|
-
return parts.join(' ');
|
|
38
|
-
};
|
|
39
31
|
const BulletChartPreviewContent = ({ bullet, }) => {
|
|
40
32
|
const { sampleValue, valueFraction } = getBulletPreviewSample(bullet);
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
33
|
+
const cellTextProperties = bullet.CellTextProperties;
|
|
34
|
+
const labels = (0, barChartCellText_1.buildBarChartCellTextLabels)(cellTextProperties, Number.isInteger(sampleValue) ? String(sampleValue) : sampleValue.toFixed(1), `${(valueFraction * 100).toFixed(0)}%`);
|
|
35
|
+
const hasCellText = (0, barChartCellText_1.hasBarChartCellTextConfigured)(cellTextProperties) &&
|
|
36
|
+
Boolean(labels.cellValue || labels.percentage);
|
|
37
|
+
const presence = (0, barChartCellText_1.getBarChartCellTextSlotPresence)(cellTextProperties);
|
|
44
38
|
const fontStyle = bullet.Font ? (0, StyleHelper_1.convertAdaptableStyleToCSS)(bullet.Font) : undefined;
|
|
45
39
|
const isVertical = bullet.Orientation === 'Vertical';
|
|
40
|
+
const cellTextClassName = 'ab-BulletChart__text twa:text-2 twa:leading-tight twa:truncate twa:max-w-full';
|
|
46
41
|
const chartEl = (0, jsx_runtime_1.jsx)(StyledColumnChartListPreviews_1.StyledColumnBulletChartListPreview, { bullet: bullet });
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
// Merged-only with no outside bands → relative container so the overlay sits
|
|
43
|
+
// on top of the chart, matching the runtime renderer's behaviour.
|
|
44
|
+
if (hasCellText && presence.hasMerged && !presence.hasAbove && !presence.hasBelow) {
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "ab-BulletChart__wrapper twa:relative twa:inline-flex", children: [chartEl, (0, jsx_runtime_1.jsx)(BarChartCellTextPreview_1.BarChartCellTextPreview, { mergedOverlayClassName: "ab-BulletChart__text twa:absolute twa:inset-x-0 twa:top-1/2 twa:-translate-y-1/2 twa:px-1 twa:text-2 twa:truncate twa:pointer-events-none", style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Merged" })] }));
|
|
50
46
|
}
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: "ab-BulletChart__wrapper", flexDirection: "column", alignItems: isVertical ? 'center' : 'stretch', style: { justifyContent: 'center', gap: hasCellText ? 2 : 0 }, children: [hasCellText &&
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: "ab-BulletChart__wrapper twa:relative", flexDirection: "column", alignItems: isVertical ? 'center' : 'stretch', style: { justifyContent: 'center', gap: hasCellText ? 2 : 0 }, children: [hasCellText && presence.hasAbove && ((0, jsx_runtime_1.jsx)(BarChartCellTextPreview_1.BarChartCellTextPreview, { className: cellTextClassName, style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Above" })), (0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:relative twa:w-full", style: { display: 'inline-flex' }, children: [chartEl, hasCellText && presence.hasMerged && ((0, jsx_runtime_1.jsx)(BarChartCellTextPreview_1.BarChartCellTextPreview, { mergedOverlayClassName: "ab-BulletChart__text twa:absolute twa:inset-x-0 twa:top-1/2 twa:-translate-y-1/2 twa:px-1 twa:text-2 twa:truncate twa:pointer-events-none", style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Merged" }))] }), hasCellText && presence.hasBelow && ((0, jsx_runtime_1.jsx)(BarChartCellTextPreview_1.BarChartCellTextPreview, { className: cellTextClassName, style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Below" }))] }));
|
|
52
48
|
};
|
|
53
49
|
const StyledColumnBulletPreview = ({ data }) => {
|
|
54
50
|
const bullet = data.BulletChartStyle;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BulletChartStyle
|
|
2
|
+
import { BulletChartStyle } from '../../../../../AdaptableState/StyledColumns/BulletChartStyle';
|
|
3
|
+
import { RangeBarStyle } from '../../../../../AdaptableState/StyledColumns/RangeBarStyle';
|
|
3
4
|
/**
|
|
4
5
|
* Compact schematic of a Range Bar (bands + track + value / reference markers)
|
|
5
6
|
* for the Styled Columns object list and wizard step summaries.
|
|
@@ -44,10 +44,10 @@ const DEFAULT_MARKER = 'var(--ab-color-foreground, #333)';
|
|
|
44
44
|
const StyledColumnRangeBarListPreview = (props) => {
|
|
45
45
|
const { range } = props;
|
|
46
46
|
const segments = bandSegmentsForPreview(range.CellRanges);
|
|
47
|
-
const trackFill = range.
|
|
47
|
+
const trackFill = range.Track?.Color ?? DEFAULT_TRACK;
|
|
48
48
|
const valueColor = range.Marker?.Color || DEFAULT_BAR;
|
|
49
|
-
const refColor = range.
|
|
50
|
-
const hasRef = range.Reference != undefined;
|
|
49
|
+
const refColor = range.Reference?.Marker?.Color || DEFAULT_MARKER;
|
|
50
|
+
const hasRef = range.Reference?.Value != undefined;
|
|
51
51
|
const isVertical = range.Orientation === 'Vertical';
|
|
52
52
|
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:rounded twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_12%,transparent)] twa:bg-[color-mix(in_srgb,var(--ab-color-primary)_40%,transparent)] twa:px-1 twa:py-0.5", style: { width: PREVIEW_WIDTH, height: PREVIEW_HEIGHT }, children: (0, jsx_runtime_1.jsxs)("svg", { width: "100%", height: "100%", viewBox: `0 0 ${VB_W} ${VB_H}`, preserveAspectRatio: "none", "aria-hidden": true, children: [segments.length === 0 ? ((0, jsx_runtime_1.jsx)("rect", { x: "0", y: "0", width: VB_W, height: VB_H, fill: range.BackColor ?? 'transparent' })) : (segments.map((s, i) => ((0, jsx_runtime_1.jsx)("rect", { x: s.x0 * VB_W, y: "0", width: (s.x1 - s.x0) * VB_W, height: VB_H, fill: s.color, opacity: 0.55 }, i)))), isVertical ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("rect", { x: VB_W * 0.42, y: "2", width: "5", height: VB_H - 4, rx: "1", fill: trackFill }), hasRef && ((0, jsx_runtime_1.jsx)("line", { x1: VB_W * 0.46, y1: "3", x2: VB_W * 0.46, y2: VB_H - 3, stroke: refColor, strokeWidth: "2", vectorEffect: "non-scaling-stroke" })), (0, jsx_runtime_1.jsx)("polygon", { points: `${VB_W * 0.52},${VB_H * 0.35} ${VB_W * 0.62},${VB_H * 0.5} ${VB_W * 0.52},${VB_H * 0.65}`, fill: valueColor })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("rect", { x: "2", y: VB_H * 0.38, width: VB_W - 4, height: "5", rx: "1", fill: trackFill }), hasRef && ((0, jsx_runtime_1.jsx)("line", { x1: VB_W * 0.38, y1: VB_H * 0.2, x2: VB_W * 0.38, y2: VB_H * 0.8, stroke: refColor, strokeWidth: "2", vectorEffect: "non-scaling-stroke" })), (0, jsx_runtime_1.jsx)("polygon", { points: `${VB_W * 0.72},${VB_H * 0.2} ${VB_W * 0.82},${VB_H * 0.5} ${VB_W * 0.72},${VB_H * 0.8}`, fill: valueColor })] }))] }) }));
|
|
53
53
|
};
|
|
@@ -59,8 +59,8 @@ exports.StyledColumnRangeBarListPreview = StyledColumnRangeBarListPreview;
|
|
|
59
59
|
const StyledColumnBulletChartListPreview = (props) => {
|
|
60
60
|
const { bullet } = props;
|
|
61
61
|
const segments = bandSegmentsForPreview(bullet.CellRanges);
|
|
62
|
-
const barColor = bullet.
|
|
63
|
-
const markerColor = bullet.
|
|
62
|
+
const barColor = bullet.Bar?.Color ?? DEFAULT_BAR;
|
|
63
|
+
const markerColor = bullet.TargetProperties?.Marker?.Color || DEFAULT_MARKER;
|
|
64
64
|
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:rounded twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_12%,transparent)] twa:bg-[color-mix(in_srgb,var(--ab-color-primary)_40%,transparent)] twa:px-1 twa:py-0.5", style: { width: PREVIEW_WIDTH, height: PREVIEW_HEIGHT }, children: (0, jsx_runtime_1.jsxs)("svg", { width: "100%", height: "100%", viewBox: `0 0 ${VB_W} ${VB_H}`, preserveAspectRatio: "none", "aria-hidden": true, children: [segments.length === 0 ? ((0, jsx_runtime_1.jsx)("rect", { x: "0", y: "0", width: VB_W, height: VB_H, fill: bullet.BackColor ?? 'transparent' })) : (segments.map((s, i) => ((0, jsx_runtime_1.jsx)("rect", { x: s.x0 * VB_W, y: "2", width: (s.x1 - s.x0) * VB_W, height: VB_H - 4, fill: s.color, opacity: 0.5 }, i)))), (0, jsx_runtime_1.jsx)("rect", { x: VB_W * 0.04, y: VB_H * 0.35, width: VB_W * 0.58, height: VB_H * 0.3, rx: "1", fill: barColor }), (0, jsx_runtime_1.jsx)("line", { x1: VB_W * 0.78, y1: VB_H * 0.12, x2: VB_W * 0.78, y2: VB_H * 0.88, stroke: markerColor, strokeWidth: "2.5", vectorEffect: "non-scaling-stroke" })] }) }));
|
|
65
65
|
};
|
|
66
66
|
exports.StyledColumnBulletChartListPreview = StyledColumnBulletChartListPreview;
|
|
@@ -39,7 +39,7 @@ const renderIconSpecForPreview = (spec, size) => {
|
|
|
39
39
|
return null;
|
|
40
40
|
};
|
|
41
41
|
const buildPreviewText = (mapping, iconStyle) => {
|
|
42
|
-
const cellTextTokens = iconStyle.CellText ?? [];
|
|
42
|
+
const cellTextTokens = iconStyle.CellTextProperties?.CellText ?? [];
|
|
43
43
|
const formatted = String(mapping.Key);
|
|
44
44
|
const textParts = [];
|
|
45
45
|
if (cellTextTokens.includes('CellValue') && formatted) {
|
|
@@ -53,7 +53,7 @@ const buildPreviewText = (mapping, iconStyle) => {
|
|
|
53
53
|
const IconCellPreviewTree = ({ iconStyle, mapping }) => {
|
|
54
54
|
const size = iconStyle.Size ?? exports.DEFAULT_ICON_STYLE_SIZE;
|
|
55
55
|
const gap = iconStyle.Gap ?? exports.DEFAULT_ICON_STYLE_GAP;
|
|
56
|
-
const textPosition = iconStyle.CellTextPosition ?? 'After';
|
|
56
|
+
const textPosition = iconStyle.CellTextProperties?.CellTextPosition ?? 'After';
|
|
57
57
|
const text = buildPreviewText(mapping, iconStyle);
|
|
58
58
|
const fontStyle = iconStyle.Font ? (0, StyleHelper_1.convertAdaptableStyleToCSS)(iconStyle.Font) : undefined;
|
|
59
59
|
const iconNode = renderIconSpecForPreview(mapping.Icon, size);
|