@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
|
@@ -4,26 +4,33 @@ exports.StyledColumnPercentBarPreviewCard = exports.StyledColumnPercentBarPrevie
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const StyleHelper_1 = require("../../../../../Utilities/Helpers/StyleHelper");
|
|
6
6
|
const percentBarPreviewHelper_1 = require("../../../../../Utilities/Helpers/percentBarPreviewHelper");
|
|
7
|
+
const barChartCellText_1 = require("../../../../../Utilities/Helpers/barChartCellText");
|
|
7
8
|
const Flex_1 = require("../../../../../components/Flex");
|
|
8
9
|
const Card_1 = require("../../../../../components/Card");
|
|
9
10
|
const Tag_1 = require("../../../../../components/Tag");
|
|
11
|
+
const BarChartCellTextPreview_1 = require("./BarChartCellTextPreview");
|
|
10
12
|
const PREVIEW_CELL_CLASS = 'ab-PercentBarPreviewCell twa:w-[72px] twa:min-h-[32px] twa:px-1 twa:py-1 twa:rounded-standard twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_15%,transparent)]';
|
|
11
13
|
const PercentBarPreviewCell = ({ styledColumn, value, min, max }) => {
|
|
12
14
|
const pb = styledColumn.PercentBarStyle;
|
|
13
15
|
const { barLeftPercent, barWidthPercent, percentageValue, barColor } = (0, percentBarPreviewHelper_1.getPercentBarPreviewGeometry)(value, pb, min, max);
|
|
14
16
|
const trackColor = (0, percentBarPreviewHelper_1.getPercentBarPreviewTrackColor)(pb);
|
|
15
17
|
const fillColor = (0, percentBarPreviewHelper_1.getPercentBarPreviewResolvedBarColor)(barColor);
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
18
|
+
const cellTextProperties = pb.CellTextProperties;
|
|
19
|
+
const labels = (0, barChartCellText_1.buildBarChartCellTextLabels)(cellTextProperties, Number.isInteger(value) ? String(value) : value.toFixed(1), `${percentageValue.toFixed(0)}%`);
|
|
20
|
+
const hasCellText = (0, barChartCellText_1.hasBarChartCellTextConfigured)(cellTextProperties) &&
|
|
21
|
+
Boolean(labels.cellValue || labels.percentage);
|
|
22
|
+
const presence = (0, barChartCellText_1.getBarChartCellTextSlotPresence)(cellTextProperties);
|
|
19
23
|
const fontStyle = pb.Font ? (0, StyleHelper_1.convertAdaptableStyleToCSS)(pb.Font) : undefined;
|
|
20
|
-
const
|
|
24
|
+
const cellTextClassName = 'ab-PercentBar__text twa:text-2 twa:leading-tight twa:truncate';
|
|
21
25
|
const barEl = ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "ab-PercentBar__bar twa:relative twa:flex-1 twa:min-h-[6px]", style: trackColor ? { background: (0, percentBarPreviewHelper_1.getPercentBarPreviewResolvedBarColor)(trackColor) } : undefined, children: [fillColor && ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "ab-PercentBar__barInside twa:absolute twa:top-0 twa:h-full", style: {
|
|
22
26
|
background: fillColor,
|
|
23
27
|
left: `${barLeftPercent.toFixed(2)}%`,
|
|
24
28
|
width: `${barWidthPercent.toFixed(2)}%`,
|
|
25
|
-
} })), hasCellText &&
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: `ab-PercentBar__wrapper ${PREVIEW_CELL_CLASS}`, flexDirection: "column", style: {
|
|
29
|
+
} })), hasCellText && presence.hasMerged && ((0, jsx_runtime_1.jsx)(BarChartCellTextPreview_1.BarChartCellTextPreview, { mergedOverlayClassName: "ab-PercentBar__text twa:absolute twa:inset-x-0 twa:top-1/2 twa:-translate-y-1/2 twa:px-1 twa:text-2 twa:truncate", style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Merged" }))] }));
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: `ab-PercentBar__wrapper ${PREVIEW_CELL_CLASS}`, flexDirection: "column", style: {
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
height: (0, BarChartCellTextPreview_1.shouldShowBarChartCellTextOutsideBar)(cellTextProperties, hasCellText) ? '100%' : undefined,
|
|
33
|
+
}, children: [hasCellText && presence.hasAbove && ((0, jsx_runtime_1.jsx)(BarChartCellTextPreview_1.BarChartCellTextPreview, { className: cellTextClassName, style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Above" })), barEl, hasCellText && presence.hasBelow && ((0, jsx_runtime_1.jsx)(BarChartCellTextPreview_1.BarChartCellTextPreview, { className: cellTextClassName, style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Below" }))] }));
|
|
27
34
|
};
|
|
28
35
|
const StyledColumnPercentBarPreview = ({ data }) => {
|
|
29
36
|
const pb = data.PercentBarStyle;
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StyledColumnRangeBarPreviewCard = exports.StyledColumnRangeBarPreview = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const barChartCellText_1 = require("../../../../../Utilities/Helpers/barChartCellText");
|
|
5
6
|
const Flex_1 = require("../../../../../components/Flex");
|
|
6
7
|
const Card_1 = require("../../../../../components/Card");
|
|
7
8
|
const Tag_1 = require("../../../../../components/Tag");
|
|
8
9
|
const StyledColumnChartListPreviews_1 = require("./StyledColumnChartListPreviews");
|
|
10
|
+
const BarChartCellTextPreview_1 = require("./BarChartCellTextPreview");
|
|
9
11
|
const PREVIEW_CELL_CLASS = 'ab-RangeBarPreviewCell 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)]';
|
|
10
12
|
const getRangeBarPreviewSample = (range) => {
|
|
11
13
|
let min = 0;
|
|
@@ -23,28 +25,20 @@ const getRangeBarPreviewSample = (range) => {
|
|
|
23
25
|
valueFraction: Math.max(0, Math.min(1, valueFraction)),
|
|
24
26
|
};
|
|
25
27
|
};
|
|
26
|
-
const formatRangeBarPreviewCellText = (sampleValue, valueFraction, range) => {
|
|
27
|
-
const parts = [];
|
|
28
|
-
if (range.CellText?.includes('CellValue')) {
|
|
29
|
-
parts.push(Number.isInteger(sampleValue) ? String(sampleValue) : sampleValue.toFixed(1));
|
|
30
|
-
}
|
|
31
|
-
if (range.CellText?.includes('PercentageValue')) {
|
|
32
|
-
parts.push(`${(valueFraction * 100).toFixed(0)}%`);
|
|
33
|
-
}
|
|
34
|
-
return parts.join(' ');
|
|
35
|
-
};
|
|
36
28
|
const RangeBarPreviewContent = ({ range }) => {
|
|
37
29
|
const { sampleValue, valueFraction } = getRangeBarPreviewSample(range);
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
30
|
+
const cellTextProperties = range.CellTextProperties;
|
|
31
|
+
const labels = (0, barChartCellText_1.buildBarChartCellTextLabels)(cellTextProperties, Number.isInteger(sampleValue) ? String(sampleValue) : sampleValue.toFixed(1), `${(valueFraction * 100).toFixed(0)}%`);
|
|
32
|
+
const hasCellText = (0, barChartCellText_1.hasBarChartCellTextConfigured)(cellTextProperties) &&
|
|
33
|
+
Boolean(labels.cellValue || labels.percentage);
|
|
34
|
+
const presence = (0, barChartCellText_1.getBarChartCellTextSlotPresence)(cellTextProperties);
|
|
41
35
|
const isVertical = range.Orientation === 'Vertical';
|
|
36
|
+
const cellTextClassName = 'ab-RangeBar__text twa:text-2 twa:leading-tight twa:truncate twa:max-w-full';
|
|
42
37
|
const chartEl = (0, jsx_runtime_1.jsx)(StyledColumnChartListPreviews_1.StyledColumnRangeBarListPreview, { range: range });
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "ab-RangeBar__wrapper twa:relative twa:inline-flex", children: [chartEl, (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "ab-RangeBar__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", children: cellText })] }));
|
|
38
|
+
if (hasCellText && presence.hasMerged && !presence.hasAbove && !presence.hasBelow) {
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "ab-RangeBar__wrapper twa:relative twa:inline-flex", children: [chartEl, (0, jsx_runtime_1.jsx)(BarChartCellTextPreview_1.BarChartCellTextPreview, { mergedOverlayClassName: "ab-RangeBar__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", cellTextProperties: cellTextProperties, labels: labels, vertical: "Merged" })] }));
|
|
46
40
|
}
|
|
47
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: "ab-RangeBar__wrapper", flexDirection: "column", alignItems: isVertical ? 'center' : 'stretch', style: { justifyContent: 'center', gap: hasCellText ? 2 : 0 }, children: [hasCellText &&
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: "ab-RangeBar__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, 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-RangeBar__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", cellTextProperties: cellTextProperties, labels: labels, vertical: "Merged" }))] }), hasCellText && presence.hasBelow && ((0, jsx_runtime_1.jsx)(BarChartCellTextPreview_1.BarChartCellTextPreview, { className: cellTextClassName, cellTextProperties: cellTextProperties, labels: labels, vertical: "Below" }))] }));
|
|
48
42
|
};
|
|
49
43
|
const StyledColumnRangeBarPreview = ({ data }) => {
|
|
50
44
|
const range = data.RangeBarStyle;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { CellBoxStyle } from '../../../../../AdaptableState/Common/AdaptableStyle';
|
|
3
|
-
import {
|
|
3
|
+
import { StyledColumn } from '../../../../../AdaptableState/StyledColumnState';
|
|
4
|
+
import { RatingIconShape, RatingStyle } from '../../../../../AdaptableState/StyledColumns/RatingStyle';
|
|
4
5
|
export declare const DEFAULT_RATING_MAX = 5;
|
|
5
6
|
export declare const DEFAULT_RATING_SIZE = 14;
|
|
6
7
|
export declare const DEFAULT_RATING_GAP = 2;
|
|
@@ -7,13 +7,13 @@ const CheckBox_1 = require("../../../../components/CheckBox");
|
|
|
7
7
|
const ErrorBox_1 = tslib_1.__importDefault(require("../../../../components/ErrorBox"));
|
|
8
8
|
const FormLayout_1 = tslib_1.__importStar(require("../../../../components/FormLayout"));
|
|
9
9
|
const Tag_1 = require("../../../../components/Tag");
|
|
10
|
+
const barChartCellText_1 = require("../../../../Utilities/Helpers/barChartCellText");
|
|
11
|
+
const BarChartCellTextLayoutEditor_1 = require("./Components/BarChartCellTextLayoutEditor");
|
|
10
12
|
const ColorPicker_1 = require("../../../../components/ColorPicker");
|
|
11
13
|
const UIHelper_1 = require("../../../UIHelper");
|
|
12
14
|
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
|
|
13
|
-
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/ArrayExtensions"));
|
|
14
15
|
const Flex_1 = require("../../../../components/Flex");
|
|
15
16
|
const Radio_1 = tslib_1.__importStar(require("../../../../components/Radio"));
|
|
16
|
-
const Toggle_1 = require("../../../../components/Toggle");
|
|
17
17
|
const StyledColumnSliceStyleEditors_1 = require("../StyledColumnSliceStyleEditors");
|
|
18
18
|
const Card_1 = require("../../../../components/Card");
|
|
19
19
|
const SummaryColorTag_1 = require("../../../Wizard/SummaryColorTag");
|
|
@@ -42,11 +42,12 @@ const formatPercentBarToolTipSummary = (toolTipText) => toolTipText
|
|
|
42
42
|
.join(' + ') ?? '';
|
|
43
43
|
const buildStyledColumnPercentBarStyleSummaryStrings = (pb, options) => {
|
|
44
44
|
const items = [`Origin: ${formatOriginLabel(pb.Origin)}`];
|
|
45
|
-
if (pb.
|
|
46
|
-
|
|
47
|
-
items.push(`Cell Text
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
if ((0, barChartCellText_1.hasBarChartCellTextConfigured)(pb.CellTextProperties)) {
|
|
46
|
+
const tokens = (0, barChartCellText_1.getActiveBarChartCellTextTokens)(pb.CellTextProperties);
|
|
47
|
+
items.push(`Cell Text: ${formatPercentBarCellTextSummary(tokens)}`);
|
|
48
|
+
const layoutSummary = (0, barChartCellText_1.formatBarChartCellTextLayoutSummary)((0, barChartCellText_1.resolveBarChartCellTextLayout)(pb.CellTextProperties));
|
|
49
|
+
if (layoutSummary) {
|
|
50
|
+
items.push(`Placement: ${layoutSummary}`);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
else if (options.includeEmptyCellText) {
|
|
@@ -101,11 +102,6 @@ exports.renderFormatColumnStyleWizardSummary = renderFormatColumnStyleWizardSumm
|
|
|
101
102
|
// Pinning the width forces colons to line up vertically across cards rather than
|
|
102
103
|
// each FormLayout sizing its label column independently from its own longest label.
|
|
103
104
|
const STYLE_FORM_SIZES = ['200px', '1fr'];
|
|
104
|
-
const CELL_TEXT_POSITION_CHOICES = [
|
|
105
|
-
{ value: 'Above', label: 'Above Bar' },
|
|
106
|
-
{ value: 'Below', label: 'Below Bar' },
|
|
107
|
-
{ value: 'Merged', label: 'Merged' },
|
|
108
|
-
];
|
|
109
105
|
const ORIGIN_CHOICES = [
|
|
110
106
|
{
|
|
111
107
|
value: 'Auto',
|
|
@@ -130,6 +126,7 @@ const StyledColumnWizardStyleSection = (props) => {
|
|
|
130
126
|
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { children: !data.ColumnId && ((0, jsx_runtime_1.jsx)(ErrorBox_1.default, { className: "twa:mt-2", children: "You need to select a column before styling." })) }));
|
|
131
127
|
}
|
|
132
128
|
const pb = data.PercentBarStyle;
|
|
129
|
+
const cellTextProperties = pb.CellTextProperties;
|
|
133
130
|
// ---- updaters -----------------------------------------------------------
|
|
134
131
|
const update = (patch) => {
|
|
135
132
|
props.onChange({
|
|
@@ -137,12 +134,13 @@ const StyledColumnWizardStyleSection = (props) => {
|
|
|
137
134
|
PercentBarStyle: { ...pb, ...patch },
|
|
138
135
|
});
|
|
139
136
|
};
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
const onCellTextLayoutToggle = (token, show) => {
|
|
138
|
+
update((0, barChartCellText_1.toggleBarChartCellTextToken)(cellTextProperties, token, show));
|
|
139
|
+
};
|
|
140
|
+
const onCellTextPlacementChange = (token, patch) => {
|
|
141
|
+
update({
|
|
142
|
+
CellTextProperties: (0, barChartCellText_1.patchBarChartCellTextPlacement)(cellTextProperties, token, patch),
|
|
143
|
+
});
|
|
146
144
|
};
|
|
147
145
|
const onToolTipTextChanged = (token, checked) => {
|
|
148
146
|
const current = pb.ToolTipText ?? [];
|
|
@@ -151,38 +149,7 @@ const StyledColumnWizardStyleSection = (props) => {
|
|
|
151
149
|
: current.filter((t) => t !== token);
|
|
152
150
|
update({ ToolTipText: next });
|
|
153
151
|
};
|
|
154
|
-
const handleCellTextPositionChange = (pos) => update({ CellTextPosition: pos });
|
|
155
152
|
const handleOriginChange = (origin) => update({ Origin: origin });
|
|
156
|
-
const handleCellTextAlignmentChange = (choice) => {
|
|
157
|
-
if (choice === 'Inherit') {
|
|
158
|
-
const next = { ...pb };
|
|
159
|
-
delete next.CellTextAlignment;
|
|
160
|
-
props.onChange({ ...data, PercentBarStyle: next });
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
update({ CellTextAlignment: choice });
|
|
164
|
-
};
|
|
165
|
-
const onAutoCellTextAlignmentChecked = (checked) => {
|
|
166
|
-
if (!checked) {
|
|
167
|
-
handleCellTextAlignmentChange('Inherit');
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
let nextFont = pb.Font ? { ...pb.Font } : undefined;
|
|
171
|
-
if (nextFont) {
|
|
172
|
-
delete nextFont.Alignment;
|
|
173
|
-
if (Object.keys(nextFont).length === 0) {
|
|
174
|
-
nextFont = undefined;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
props.onChange({
|
|
178
|
-
...data,
|
|
179
|
-
PercentBarStyle: {
|
|
180
|
-
...pb,
|
|
181
|
-
CellTextAlignment: 'Auto',
|
|
182
|
-
Font: nextFont,
|
|
183
|
-
},
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
153
|
const onBackColorChange = (color) => {
|
|
187
154
|
if (color) {
|
|
188
155
|
update({ BackColor: color });
|
|
@@ -191,14 +158,11 @@ const StyledColumnWizardStyleSection = (props) => {
|
|
|
191
158
|
const { BackColor: _removed, ...rest } = pb;
|
|
192
159
|
props.onChange({ ...data, PercentBarStyle: rest });
|
|
193
160
|
};
|
|
194
|
-
const cellTextDisabled =
|
|
195
|
-
const currentAlignment = pb.CellTextAlignment ?? 'Inherit';
|
|
161
|
+
const cellTextDisabled = !(0, barChartCellText_1.hasBarChartCellTextConfigured)(cellTextProperties) || disabled;
|
|
196
162
|
const currentOrigin = typeof pb.Origin === 'number'
|
|
197
163
|
? 'Min' // numeric origin doesn't fit the radio set; treat as Min for selection state
|
|
198
164
|
: pb.Origin ?? 'Auto';
|
|
199
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { 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: "Bar Position" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Set the position of the cell text relative to the bar" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsx)(Radio_1.RadioGroup, { orientation: "vertical", name: "ab-percentbar-origin", value: currentOrigin, onRadioChange: handleOriginChange, children: ORIGIN_CHOICES.map((choice) => ((0, jsx_runtime_1.jsx)(Radio_1.default, { value: choice.value, disabled: disabled, children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:min-w-[60px]", children: choice.label }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70", children: choice.hint })] }) }, choice.value))) }) })] }), (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: "Cell Text" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[540px]", children: "
|
|
200
|
-
? 'twa:opacity-50 twa:pointer-events-none'
|
|
201
|
-
: '', children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2", children: (0, jsx_runtime_1.jsxs)(Toggle_1.ToggleGroup, { children: [(0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { icon: "align-left", pressed: currentAlignment === 'Left', onPressedChange: (pressed) => handleCellTextAlignmentChange(pressed ? 'Left' : 'Inherit') }), (0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { icon: "align-center", pressed: currentAlignment === 'Center', onPressedChange: (pressed) => handleCellTextAlignmentChange(pressed ? 'Center' : 'Inherit') }), (0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { icon: "align-right", pressed: currentAlignment === 'Right', onPressedChange: (pressed) => handleCellTextAlignmentChange(pressed ? 'Right' : 'Inherit') })] }) }) }) }) })] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: `twa:mt-3 twa:pt-3 twa:border-t twa:border-foreground/15 ${cellTextDisabled ? 'twa:opacity-50' : ''}`, children: (0, jsx_runtime_1.jsx)(StyledColumnSliceStyleEditors_1.StyledColumnFontStyleEditor, { api: api, disabled: cellTextDisabled, hideAlignment: true, value: pb.Font, onChange: (next) => {
|
|
165
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { 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: "Bar Position" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Set the position of the cell text relative to the bar" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsx)(Radio_1.RadioGroup, { orientation: "vertical", name: "ab-percentbar-origin", value: currentOrigin, onRadioChange: handleOriginChange, children: ORIGIN_CHOICES.map((choice) => ((0, jsx_runtime_1.jsx)(Radio_1.default, { value: choice.value, disabled: disabled, children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:min-w-[60px]", children: choice.label }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70", children: choice.hint })] }) }, choice.value))) }) })] }), (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: "Cell Text" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[540px]", children: "Pick which values to display and where each one sits around the bar (font properties take precedence over Format Column)" })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card.Body, { children: [(0, jsx_runtime_1.jsx)(FormLayout_1.default, { sizes: [...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: cellTextProperties, onToggle: onCellTextLayoutToggle, onPlacementChange: onCellTextPlacementChange }) }) }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: `twa:mt-3 twa:pt-3 twa:border-t twa:border-foreground/15 ${cellTextDisabled ? 'twa:opacity-50' : ''}`, children: (0, jsx_runtime_1.jsx)(StyledColumnSliceStyleEditors_1.StyledColumnFontStyleEditor, { api: api, disabled: cellTextDisabled, value: pb.Font, onChange: (next) => {
|
|
202
166
|
if (next) {
|
|
203
167
|
update({ Font: next });
|
|
204
168
|
}
|
|
@@ -7,6 +7,7 @@ const kebabCase_1 = tslib_1.__importDefault(require("../Utilities/utils/kebabCas
|
|
|
7
7
|
const AdaptableFormatPresets_1 = require("../AdaptableState/Common/AdaptableFormatPresets");
|
|
8
8
|
const merge_1 = tslib_1.__importDefault(require("../Utilities/utils/merge"));
|
|
9
9
|
const SparklineOptionsHelper_1 = require("../Utilities/Helpers/SparklineOptionsHelper");
|
|
10
|
+
const barChartCellText_1 = require("../Utilities/Helpers/barChartCellText");
|
|
10
11
|
const StyleHelper_1 = require("../Utilities/Helpers/StyleHelper");
|
|
11
12
|
const StringExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensions/StringExtensions"));
|
|
12
13
|
const AdaptableColumn_1 = require("../AdaptableState/Common/AdaptableColumn");
|
|
@@ -1450,7 +1451,7 @@ class AgGridColumnAdapter {
|
|
|
1450
1451
|
}
|
|
1451
1452
|
}
|
|
1452
1453
|
}
|
|
1453
|
-
if (styledColumn.PercentBarStyle && styledColumn.PercentBarStyle.
|
|
1454
|
+
if (styledColumn.PercentBarStyle && (0, barChartCellText_1.hasBarChartCellTextConfigured)(styledColumn.PercentBarStyle.CellTextProperties)) {
|
|
1454
1455
|
style.paddingTop = 0;
|
|
1455
1456
|
style.paddingBottom = 0;
|
|
1456
1457
|
}
|
|
@@ -87,7 +87,9 @@ const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
87
87
|
...adaptableApi.internalApi.buildBaseContext(),
|
|
88
88
|
};
|
|
89
89
|
const badge = api.styledColumnApi.internalApi.getApplicableBadge(badgeStyle, predicateDefHandlerContext);
|
|
90
|
-
const formattedValue = badge?.IconOnly
|
|
90
|
+
const formattedValue = badge?.IconProperties?.IconOnly
|
|
91
|
+
? ''
|
|
92
|
+
: params.formatValue?.(value) ?? value ?? '';
|
|
91
93
|
const isNullValue = formattedValue === '' || formattedValue === null || formattedValue === undefined;
|
|
92
94
|
if (!isNullValue) {
|
|
93
95
|
const config = { value: formattedValue };
|
|
@@ -117,7 +119,7 @@ const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
117
119
|
this.eGui.innerHTML = formattedValue;
|
|
118
120
|
return;
|
|
119
121
|
}
|
|
120
|
-
if (badge.IconOnly) {
|
|
122
|
+
if (badge.IconProperties?.IconOnly) {
|
|
121
123
|
formattedValue = '';
|
|
122
124
|
}
|
|
123
125
|
this.renderBadges([
|
|
@@ -141,11 +143,11 @@ const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
141
143
|
key: index,
|
|
142
144
|
pillStyle: badge.PillStyle,
|
|
143
145
|
children: value,
|
|
144
|
-
icon: badge.Icon,
|
|
145
|
-
iconPosition: badge.
|
|
146
|
+
icon: badge.IconProperties?.Icon,
|
|
147
|
+
iconPosition: badge.IconProperties?.Position ?? 'start',
|
|
146
148
|
shape: badge.Shape,
|
|
147
149
|
density: badgeStyle.Density ?? 'Normal',
|
|
148
|
-
iconGap: badge.
|
|
150
|
+
iconGap: badge.IconProperties?.Gap,
|
|
149
151
|
});
|
|
150
152
|
});
|
|
151
153
|
this.unmountReactRoot = api.internalApi
|
|
@@ -4,6 +4,7 @@ exports.getBulletChartRendererForColumn = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
|
|
6
6
|
const clamp_1 = tslib_1.__importDefault(require("../../Utilities/utils/clamp"));
|
|
7
|
+
const barChartCellText_1 = require("../../Utilities/Helpers/barChartCellText");
|
|
7
8
|
const shouldRenderStyledColumnOnRow_1 = require("./shouldRenderStyledColumnOnRow");
|
|
8
9
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
9
10
|
const DEFAULT_BAR_HEIGHT = 8;
|
|
@@ -56,19 +57,18 @@ const normaliseMarker = (override, base) => {
|
|
|
56
57
|
};
|
|
57
58
|
};
|
|
58
59
|
const resolveTargets = (bulletStyle, styledColumn, abColumn, rowNode, api) => {
|
|
59
|
-
|
|
60
|
+
const targetSpec = bulletStyle.TargetProperties?.Target;
|
|
61
|
+
if (targetSpec == undefined) {
|
|
60
62
|
return [];
|
|
61
63
|
}
|
|
62
|
-
const targets = Array.isArray(
|
|
63
|
-
? bulletStyle.Target
|
|
64
|
-
: [bulletStyle.Target];
|
|
64
|
+
const targets = Array.isArray(targetSpec) ? targetSpec : [targetSpec];
|
|
65
65
|
const resolved = [];
|
|
66
66
|
for (const target of targets) {
|
|
67
67
|
const value = resolveTargetValue(target, styledColumn, abColumn, rowNode, api);
|
|
68
68
|
if (value == undefined || isNaN(value)) {
|
|
69
69
|
continue;
|
|
70
70
|
}
|
|
71
|
-
const marker = normaliseMarker(isTargetDefinition(target) ? target.Marker : undefined, bulletStyle.
|
|
71
|
+
const marker = normaliseMarker(isTargetDefinition(target) ? target.Marker : undefined, bulletStyle.TargetProperties?.Marker);
|
|
72
72
|
resolved.push({
|
|
73
73
|
value,
|
|
74
74
|
marker,
|
|
@@ -156,10 +156,10 @@ const getBulletChartRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
156
156
|
// `BarThickness` is the bar's *short* axis (height in horizontal,
|
|
157
157
|
// width in vertical). `BandThickness` is the matching short-axis
|
|
158
158
|
// size of the surrounding bands.
|
|
159
|
-
const barThickness = bulletStyle.
|
|
159
|
+
const barThickness = bulletStyle.Bar?.Height ?? DEFAULT_BAR_HEIGHT;
|
|
160
160
|
const bandThickness = Math.max(barThickness + 6, DEFAULT_BAND_HEIGHT);
|
|
161
|
-
const
|
|
162
|
-
const
|
|
161
|
+
const cellTextProperties = bulletStyle.CellTextProperties;
|
|
162
|
+
const hasCellText = (0, barChartCellText_1.hasBarChartCellTextConfigured)(cellTextProperties);
|
|
163
163
|
// Map a 0..1 value fraction onto the long-axis viewBox (0..100).
|
|
164
164
|
// In horizontal: 0 -> left, 1 -> right.
|
|
165
165
|
// In vertical: 0 -> bottom, 1 -> top (SVG y origin is at the top so
|
|
@@ -176,7 +176,7 @@ const getBulletChartRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
176
176
|
this.eGui.style.alignItems = isVertical ? 'center' : 'stretch';
|
|
177
177
|
this.eGui.style.justifyContent = 'center';
|
|
178
178
|
this.eGui.style.position = 'relative';
|
|
179
|
-
this.eGui.style.height =
|
|
179
|
+
this.eGui.style.height = '100%';
|
|
180
180
|
// SVG chart - we let `preserveAspectRatio="none"` stretch the long axis
|
|
181
181
|
// (viewBox 0..100) to fill the cell while the short axis stays fixed
|
|
182
182
|
// in pixels.
|
|
@@ -247,7 +247,7 @@ const getBulletChartRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
247
247
|
const barCrossOffset = (bandThickness - barThickness) / 2;
|
|
248
248
|
const bar = document.createElementNS(SVG_NS, 'rect');
|
|
249
249
|
setRectAxes(bar, Math.min(valueCoord, originCoord), Math.abs(valueCoord - originCoord), barCrossOffset, barThickness);
|
|
250
|
-
bar.setAttribute('fill', bulletStyle.
|
|
250
|
+
bar.setAttribute('fill', bulletStyle.Bar?.Color ?? DEFAULT_BAR_COLOR);
|
|
251
251
|
bar.setAttribute('class', 'ab-BulletChart__bar');
|
|
252
252
|
svg.appendChild(bar);
|
|
253
253
|
// Target markers
|
|
@@ -259,39 +259,40 @@ const getBulletChartRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
259
259
|
svg.appendChild(marker);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
|
|
262
|
+
// Wrap the SVG in a positioned container so a `Merged` text row can
|
|
263
|
+
// be absolute-positioned to the centre of the *bar* (matching Percent
|
|
264
|
+
// Bar's behaviour) instead of falling through to the wrapper centre,
|
|
265
|
+
// which would otherwise overlap an `Above` / `Below` band.
|
|
266
|
+
const svgContainer = document.createElement('div');
|
|
267
|
+
svgContainer.style.position = 'relative';
|
|
268
|
+
svgContainer.style.display = 'flex';
|
|
269
|
+
svgContainer.style.alignItems = 'center';
|
|
270
|
+
svgContainer.style.justifyContent = 'center';
|
|
271
|
+
// Horizontal: take the SVG's natural (bandThickness) height.
|
|
272
|
+
// Vertical: stretch to fill the wrapper so the SVG's `height: 100%`
|
|
273
|
+
// resolves against a real size.
|
|
274
|
+
if (isVertical) {
|
|
275
|
+
svgContainer.style.flex = '1 1 auto';
|
|
276
|
+
svgContainer.style.minHeight = '0';
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
svgContainer.style.flex = '0 0 auto';
|
|
280
|
+
}
|
|
281
|
+
svgContainer.appendChild(svg);
|
|
282
|
+
this.eGui.appendChild(svgContainer);
|
|
263
283
|
if (hasCellText) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
case 'Above':
|
|
277
|
-
this.eGui.prepend(textEl);
|
|
278
|
-
break;
|
|
279
|
-
case 'Merged':
|
|
280
|
-
textEl.style.position = 'absolute';
|
|
281
|
-
textEl.style.top = '50%';
|
|
282
|
-
textEl.style.transform = 'translateY(-50%)';
|
|
283
|
-
textEl.style.left = '0';
|
|
284
|
-
textEl.style.right = '0';
|
|
285
|
-
textEl.style.paddingLeft = '5px';
|
|
286
|
-
textEl.style.paddingRight = '5px';
|
|
287
|
-
textEl.style.pointerEvents = 'none';
|
|
288
|
-
this.eGui.appendChild(textEl);
|
|
289
|
-
break;
|
|
290
|
-
case 'Below':
|
|
291
|
-
default:
|
|
292
|
-
this.eGui.appendChild(textEl);
|
|
293
|
-
break;
|
|
294
|
-
}
|
|
284
|
+
// See PercentBarRenderer: `params.formatValue` on a column without a
|
|
285
|
+
// `valueFormatter` returns the raw value (a number here), so coerce
|
|
286
|
+
// to string before it flows into the helpers.
|
|
287
|
+
const formattedCellValue = String(params.formatValue?.(cellValue) ?? cellValue);
|
|
288
|
+
const labels = (0, barChartCellText_1.buildBarChartCellTextLabels)(cellTextProperties, formattedCellValue, `${(valueFraction * 100).toFixed(0)}%`);
|
|
289
|
+
(0, barChartCellText_1.mountBarChartCellText)({
|
|
290
|
+
wrapperEl: this.eGui,
|
|
291
|
+
mergedOverlayEl: svgContainer,
|
|
292
|
+
textClassName: 'ab-BulletChart__text',
|
|
293
|
+
cellTextProperties,
|
|
294
|
+
labels,
|
|
295
|
+
});
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
298
|
getGui() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StyledColumn } from '../../AdaptableState/StyledColumnState';
|
|
2
|
+
import { IconStyle, IconStyleMapping } from '../../AdaptableState/StyledColumns/IconStyle';
|
|
2
3
|
import { AdaptableApi } from '../../Api/AdaptableApi';
|
|
3
4
|
import { AdaptableColumn } from '../../AdaptableState/Common/AdaptableColumn';
|
|
4
5
|
/**
|
|
@@ -199,7 +199,9 @@ const getIconRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
199
199
|
const iconStyle = styledColumn.IconStyle;
|
|
200
200
|
const size = iconStyle.Size ?? DEFAULT_SIZE;
|
|
201
201
|
const gap = iconStyle.Gap ?? DEFAULT_GAP;
|
|
202
|
-
const
|
|
202
|
+
const cellTextProperties = iconStyle.CellTextProperties;
|
|
203
|
+
const textPosition = cellTextProperties?.CellTextPosition ?? 'After';
|
|
204
|
+
const cellTextTokens = cellTextProperties?.CellText ?? [];
|
|
203
205
|
const matchMode = iconStyle.MatchMode ?? 'Exact';
|
|
204
206
|
// Resolve once at column-setup time. Cheap; recomputed when the column
|
|
205
207
|
// is reconfigured (which is when this factory is re-invoked anyway).
|
|
@@ -236,16 +238,15 @@ const getIconRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
236
238
|
const formatted = params.formatValue?.(cellValue) ??
|
|
237
239
|
(cellValue != undefined ? String(cellValue) : '');
|
|
238
240
|
// `CellText` describes the *companion text alongside a matched icon*.
|
|
239
|
-
// `
|
|
240
|
-
// independent: when there is no match,
|
|
241
|
-
// — `CellText` does not get to override `
|
|
241
|
+
// `FallbackProperties.Mode` describes *what to do when no mapping matches*.
|
|
242
|
+
// They are independent: when there is no match, the fallback decides
|
|
243
|
+
// on its own — `CellText` does not get to override `Mode: 'Hide'`.
|
|
242
244
|
let iconSpec;
|
|
243
245
|
let text;
|
|
244
246
|
let descriptionForTooltip;
|
|
245
247
|
if (matched) {
|
|
246
248
|
iconSpec = matched.Icon;
|
|
247
249
|
descriptionForTooltip = matched.Description;
|
|
248
|
-
const cellTextTokens = iconStyle.CellText ?? [];
|
|
249
250
|
const textParts = [];
|
|
250
251
|
if (cellTextTokens.includes('CellValue') && formatted) {
|
|
251
252
|
textParts.push(formatted);
|
|
@@ -256,17 +257,18 @@ const getIconRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
256
257
|
text = textParts.length > 0 ? textParts.join(' · ') : undefined;
|
|
257
258
|
}
|
|
258
259
|
else if (!cellValueIsEmpty) {
|
|
259
|
-
// Unmatched, non-empty cell: defer entirely to
|
|
260
|
-
const
|
|
261
|
-
|
|
260
|
+
// Unmatched, non-empty cell: defer entirely to the fallback config.
|
|
261
|
+
const fallbackMode = iconStyle.FallbackProperties?.Mode ?? 'Hide';
|
|
262
|
+
const fallbackIcon = iconStyle.FallbackProperties?.Icon;
|
|
263
|
+
if (fallbackMode === 'ShowText') {
|
|
262
264
|
text = formatted || undefined;
|
|
263
265
|
}
|
|
264
|
-
else if (
|
|
265
|
-
iconSpec =
|
|
266
|
+
else if (fallbackMode === 'Icon' && fallbackIcon) {
|
|
267
|
+
iconSpec = fallbackIcon;
|
|
266
268
|
}
|
|
267
269
|
// 'Hide' (and the unsupported permutations) render nothing.
|
|
268
270
|
}
|
|
269
|
-
// else: empty cell → render nothing, regardless of
|
|
271
|
+
// else: empty cell → render nothing, regardless of fallback config.
|
|
270
272
|
// If we have nothing to draw, leave the cell empty (and skip mounting
|
|
271
273
|
// a React root for this row).
|
|
272
274
|
if (!iconSpec && !text) {
|