@adaptabletools/adaptable-cjs 23.0.0-canary.4 → 23.0.0-canary.6
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 +117 -62
- package/package.json +9 -4
- package/src/AdaptableOptions/EditOptions.d.ts +2 -2
- package/src/AdaptableState/Common/AggregationColumns.d.ts +14 -6
- package/src/AdaptableState/Common/AggregationColumns.js +30 -3
- package/src/AdaptableState/Common/ColumnScope.d.ts +4 -0
- package/src/AdaptableState/Common/Enums.d.ts +5 -5
- package/src/AdaptableState/Common/Enums.js +4 -4
- package/src/AdaptableState/PlusMinusState.d.ts +3 -3
- package/src/AdaptableState/ShortcutState.d.ts +2 -6
- package/src/AdaptableState/StyledColumnState.d.ts +3 -5
- package/src/AdaptableState/ThemeState.d.ts +33 -28
- package/src/Api/EventApi.d.ts +14 -1
- package/src/Api/Events/ThemeChanged.d.ts +6 -0
- package/src/Api/Events/ThemeSelected.d.ts +11 -0
- package/src/Api/Events/ThemeSelected.js +2 -0
- package/src/Api/Implementation/EventApiImpl.js +4 -0
- package/src/Api/Implementation/LayoutApiImpl.d.ts +0 -2
- package/src/Api/Implementation/LayoutApiImpl.js +0 -14
- package/src/Api/Implementation/LayoutHelpers.d.ts +2 -0
- package/src/Api/Implementation/LayoutHelpers.js +19 -8
- package/src/Api/Implementation/ThemeApiImpl.d.ts +3 -2
- package/src/Api/Implementation/ThemeApiImpl.js +19 -15
- package/src/Api/Internal/EventInternalApi.d.ts +2 -0
- package/src/Api/Internal/EventInternalApi.js +8 -1
- package/src/Api/Internal/StyledColumnInternalApi.d.ts +4 -4
- package/src/Api/Internal/StyledColumnInternalApi.js +4 -4
- package/src/Api/Internal/ThemeInternalApi.d.ts +0 -1
- package/src/Api/Internal/ThemeInternalApi.js +0 -10
- package/src/Api/LayoutApi.d.ts +1 -8
- package/src/Api/ThemeApi.d.ts +6 -2
- package/src/Redux/ActionsReducers/ThemeRedux.d.ts +3 -3
- package/src/Strategy/FormatColumnModule.js +12 -5
- package/src/Strategy/LayoutModule.js +13 -8
- package/src/Strategy/StyledColumnModule.js +58 -30
- package/src/Utilities/Constants/ReduxConstants.d.ts +2 -2
- package/src/Utilities/Constants/ReduxConstants.js +1 -14
- package/src/Utilities/Helpers/FormatHelper.js +20 -1
- package/src/Utilities/Helpers/SparklineOptionsHelper.d.ts +7 -0
- package/src/Utilities/Helpers/SparklineOptionsHelper.js +68 -0
- package/src/Utilities/Helpers/StyledColumnGradientHelper.d.ts +23 -1
- package/src/Utilities/Helpers/StyledColumnGradientHelper.js +212 -1
- package/src/Utilities/Helpers/ThemeHelpers.d.ts +5 -0
- package/src/Utilities/Helpers/ThemeHelpers.js +43 -0
- package/src/Utilities/Helpers/percentBarPreviewHelper.d.ts +19 -0
- package/src/Utilities/Helpers/percentBarPreviewHelper.js +155 -0
- package/src/Utilities/ObjectFactory.d.ts +1 -3
- package/src/Utilities/ObjectFactory.js +0 -9
- package/src/Utilities/Services/ThemeService.js +1 -1
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +17 -16
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +113 -102
- package/src/View/Alert/Wizard/AlertMessageWizardSection.js +12 -13
- package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +54 -54
- package/src/View/Alert/Wizard/AlertRulesWizardSection.js +4 -3
- package/src/View/Alert/Wizard/AlertScheduledWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +29 -37
- package/src/View/Alert/Wizard/AlertTypeWizardSection.js +2 -3
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +9 -13
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +28 -15
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +7 -9
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +2 -2
- package/src/View/CellSummary/CellSummaryViewPanel.js +1 -1
- package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.js +3 -10
- package/src/View/Charting/ChartingWizard/AgChargingWizard/PreviewChartSection.js +1 -1
- package/src/View/Charting/ChartingWizard/AgChargingWizard/SettingsSection.js +32 -41
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.js +4 -31
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/PreviewChartSection.d.ts +5 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/PreviewChartSection.js +26 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.d.ts +1 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +9 -6
- package/src/View/Comments/CommentsEditor.js +1 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInput.js +0 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInputList.js +3 -1
- package/src/View/Components/ModuleProfile.js +1 -1
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +1 -2
- package/src/View/Components/RangesComponent.d.ts +7 -2
- package/src/View/Components/RangesComponent.js +94 -22
- package/src/View/Components/StyleComponent.d.ts +1 -0
- package/src/View/Components/StyleComponent.js +1 -1
- package/src/View/Components/ValueSelector/index.js +70 -57
- package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +8 -13
- package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +8 -8
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -1
- package/src/View/DataImport/DataImportWizard/sections/ColumnsSection.js +11 -12
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadSection.js +5 -4
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadTextSection.js +2 -1
- package/src/View/DataImport/DataImportWizard/sections/ValidationSection.js +4 -15
- package/src/View/Export/Wizard/ReportColumnsWizardSection.js +24 -27
- package/src/View/Export/Wizard/ReportNameWizardSection.js +8 -11
- package/src/View/Export/Wizard/ReportRowsWizardSection.js +19 -22
- package/src/View/Export/Wizard/ScheduledReportSettings.d.ts +2 -0
- package/src/View/Export/Wizard/ScheduledReportSettings.js +12 -12
- package/src/View/Export/Wizard/ScheduledReportWizard.js +2 -3
- package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +8 -6
- package/src/View/FlashingCell/Wizard/FlashingCellScopeWizardSection.js +19 -20
- package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +20 -11
- package/src/View/FlashingCell/Wizard/FlashingCellStyleWizardSection.js +19 -3
- package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +4 -4
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +7 -0
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +120 -13
- package/src/View/FormatColumn/Wizard/FormatColumnPreview.d.ts +15 -0
- package/src/View/FormatColumn/Wizard/FormatColumnPreview.js +78 -0
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.d.ts +4 -0
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +34 -0
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +11 -6
- package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +3 -1
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +64 -13
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +3 -1
- package/src/View/FreeTextColumn/Utilities/getFreeTextColumnSettingsTags.d.ts +2 -0
- package/src/View/FreeTextColumn/Utilities/getFreeTextColumnSettingsTags.js +19 -0
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnDefinitionWizardSection.d.ts +10 -0
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnDefinitionWizardSection.js +60 -0
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +2 -3
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +35 -70
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +14 -10
- package/src/View/Layout/TransposedPopup.js +2 -2
- package/src/View/Layout/Wizard/LayoutWizard.js +3 -3
- package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +2 -3
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +116 -26
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +79 -79
- package/src/View/Layout/Wizard/sections/FilterSection.js +31 -32
- package/src/View/Layout/Wizard/sections/GridFilterSection.js +10 -10
- package/src/View/Layout/Wizard/sections/PivotAggregationsSection.d.ts +1 -2
- package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +101 -51
- package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +9 -8
- package/src/View/Layout/Wizard/sections/PivotRowGroupingSection.js +4 -4
- package/src/View/Layout/Wizard/sections/RowGroupingSection.js +36 -33
- package/src/View/Layout/Wizard/sections/RowSelectionSection.js +2 -2
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +95 -73
- package/src/View/Layout/Wizard/sections/SettingsSection.js +3 -4
- package/src/View/Layout/Wizard/sections/SortSection.js +2 -2
- package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
- package/src/View/NamedQuery/Wizard/NamedQuerySettingsWizardSection.js +7 -12
- package/src/View/NamedQuery/Wizard/NamedQueryWizard.js +1 -3
- package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.d.ts +4 -0
- package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +45 -12
- package/src/View/PlusMinus/Wizard/PlusMinusScopeWizardSection.js +10 -17
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.d.ts +2 -6
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +5 -21
- package/src/View/PlusMinus/Wizard/PlusMinusWizard.js +15 -21
- package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +2 -2
- package/src/View/Shortcut/Wizard/ShortcutScopeWizardSection.js +10 -17
- package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +16 -5
- package/src/View/Shortcut/Wizard/ShortcutWizard.js +2 -2
- package/src/View/Shortcut/shortcutOperations.d.ts +3 -0
- package/src/View/Shortcut/shortcutOperations.js +32 -1
- package/src/View/SpecialColumnSettingsWizardStep.js +7 -6
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.js +26 -16
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.d.ts +10 -2
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +100 -15
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +14 -0
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.js +48 -25
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.d.ts +2 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +109 -33
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +20 -12
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +124 -23
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.d.ts +1 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.js +35 -11
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +88 -11
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +125 -35
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.d.ts +1 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.js +55 -74
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.js +20 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/GradientSummaryPreview.js +6 -12
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarColumnComparisonPreview.js +5 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarRangesPreview.js +2 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarStylePreview.d.ts +5 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarStylePreview.js +11 -13
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.js +20 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.d.ts +3 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.js +32 -3
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.d.ts +9 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.js +64 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview.d.ts +10 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview.js +35 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.d.ts +10 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.js +96 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.d.ts +8 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.js +57 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.d.ts +8 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.js +58 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.d.ts +18 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.js +66 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview.d.ts +10 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview.js +133 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardRangesSection.js +12 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.d.ts +1 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +53 -29
- package/src/View/SystemStatus/Utilities/getStatusItemStyle.js +1 -1
- package/src/View/Theme/ThemePopup.d.ts +2 -14
- package/src/View/Theme/ThemePopup.js +1 -36
- package/src/View/UIHelper.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +6 -20
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -0
- package/src/agGrid/AdaptableAgGrid.js +34 -24
- package/src/agGrid/AgGridAdapter.d.ts +1 -1
- package/src/agGrid/AgGridAdapter.js +27 -17
- package/src/agGrid/AgGridColumnAdapter.js +9 -15
- package/src/agGrid/AgGridMenuAdapter.d.ts +0 -1
- package/src/agGrid/AgGridMenuAdapter.js +20 -37
- package/src/agGrid/buildValueAggregationMenuItem.d.ts +19 -0
- package/src/agGrid/buildValueAggregationMenuItem.js +114 -0
- package/src/agGrid/cellRenderers/IconRenderer.d.ts +6 -0
- package/src/agGrid/cellRenderers/IconRenderer.js +46 -17
- package/src/agGrid/createAgGridIcon.d.ts +10 -0
- package/src/agGrid/createAgGridIcon.js +19 -0
- package/src/components/DragAndDropContext/UnusedPanel.js +1 -1
- package/src/components/ExpressionEditor/BaseEditorInput.js +1 -1
- package/src/components/ExpressionEditor/ExpressionFunctionDocumentation.js +1 -1
- package/src/components/Input/NumberInput.js +1 -1
- package/src/components/Panel/index.js +1 -1
- package/src/components/SimpleButton/index.js +4 -4
- package/src/components/Toggle/Toggle.js +1 -1
- package/src/components/Toggle/ToggleGroup.js +1 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.js +2 -9
- package/src/metamodel/adaptable.metamodel.d.ts +39 -29
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +5 -4
- package/themes/dark.css +1 -68
- package/themes/light.css +1 -5
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/src/Aggregation/ParameterizedAggregationRegistry.d.ts +0 -35
- package/src/Aggregation/ParameterizedAggregationRegistry.js +0 -74
- package/src/Aggregation/definitions/weightedAverageAggregationDefinition.d.ts +0 -3
- package/src/Aggregation/definitions/weightedAverageAggregationDefinition.js +0 -58
- package/src/Aggregation/parameterizedAggregationColumnMenu.d.ts +0 -8
- package/src/Aggregation/parameterizedAggregationColumnMenu.js +0 -143
- package/src/Aggregation/parameterizedAggregationHeader.d.ts +0 -13
- package/src/Aggregation/parameterizedAggregationHeader.js +0 -65
- package/src/Aggregation/parameterizedAggregationHelpers.d.ts +0 -23
- package/src/Aggregation/parameterizedAggregationHelpers.js +0 -121
- package/src/Aggregation/parameterizedAggregationWizardHelpers.d.ts +0 -9
- package/src/Aggregation/parameterizedAggregationWizardHelpers.js +0 -74
- package/src/Aggregation/validateParameterizedAggregations.d.ts +0 -4
- package/src/Aggregation/validateParameterizedAggregations.js +0 -25
- package/src/View/Layout/Wizard/sections/ParameterizedAggFuncPicker.d.ts +0 -12
- package/src/View/Layout/Wizard/sections/ParameterizedAggFuncPicker.js +0 -48
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.d.ts +0 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.js +0 -32
- package/src/View/Theme/VariantSelector.d.ts +0 -8
- package/src/View/Theme/VariantSelector.js +0 -25
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StyledColumnWizardRatingSection = exports.isValidRatingStyle = exports.renderStyledColumnRatingSummary = void 0;
|
|
3
|
+
exports.StyledColumnWizardRatingSection = exports.isValidRatingStyle = exports.renderStyledColumnRatingSummary = exports.getStyledColumnRatingStyleViewValues = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const React = tslib_1.__importStar(require("react"));
|
|
7
6
|
const CheckBox_1 = require("../../../components/CheckBox");
|
|
8
7
|
const ErrorBox_1 = tslib_1.__importDefault(require("../../../components/ErrorBox"));
|
|
9
8
|
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
|
|
@@ -15,7 +14,7 @@ const NewSelect_1 = require("../../../components/NewSelect");
|
|
|
15
14
|
const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
|
|
16
15
|
const StyledColumnSliceStyleEditors_1 = require("./StyledColumnSliceStyleEditors");
|
|
17
16
|
const Card_1 = require("../../../components/Card");
|
|
18
|
-
const
|
|
17
|
+
const StyledColumnRatingPreview_1 = require("./StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview");
|
|
19
18
|
const STYLE_FORM_SIZES = ['200px', '1fr'];
|
|
20
19
|
const ICON_CHOICES = [
|
|
21
20
|
{ value: 'Star', label: 'Star' },
|
|
@@ -23,13 +22,49 @@ const ICON_CHOICES = [
|
|
|
23
22
|
{ value: 'Circle', label: 'Circle' },
|
|
24
23
|
{ value: 'Thumb', label: 'Thumb' },
|
|
25
24
|
];
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
const formatRatingToolTipSummary = (toolTipText) => toolTipText
|
|
26
|
+
?.map((t) => (t === 'CellValue' ? 'Cell Value' : 'Percentage Value'))
|
|
27
|
+
.join(' + ') ?? '';
|
|
28
|
+
const buildStyledColumnRatingStyleSummaryStrings = (rating, options) => {
|
|
29
|
+
const items = [
|
|
30
|
+
`Max: ${rating.Max ?? StyledColumnRatingPreview_1.DEFAULT_RATING_MAX}`,
|
|
31
|
+
`Icon: ${rating.Icon ?? StyledColumnRatingPreview_1.DEFAULT_RATING_ICON}`,
|
|
32
|
+
];
|
|
33
|
+
if (rating.FilledColor) {
|
|
34
|
+
items.push(`Filled Colour: ${rating.FilledColor}`);
|
|
35
|
+
}
|
|
36
|
+
if (rating.EmptyColor) {
|
|
37
|
+
items.push(`Empty Colour: ${rating.EmptyColor}`);
|
|
38
|
+
}
|
|
39
|
+
if (rating.Size != null) {
|
|
40
|
+
items.push(`Icon Size: ${rating.Size}px`);
|
|
41
|
+
}
|
|
42
|
+
if (rating.Gap != null) {
|
|
43
|
+
items.push(`Icon Gap: ${rating.Gap}px`);
|
|
44
|
+
}
|
|
45
|
+
items.push(`Allow Half: ${(rating.AllowHalf ?? true) ? 'Yes' : 'No'}`);
|
|
46
|
+
items.push(`Show Value: ${rating.ShowValue ? 'Yes' : 'No'}`);
|
|
47
|
+
if (rating.ToolTipText?.length) {
|
|
48
|
+
items.push(`Tooltip: ${formatRatingToolTipSummary(rating.ToolTipText)}`);
|
|
49
|
+
}
|
|
50
|
+
else if (options.includeEmptyTooltip) {
|
|
51
|
+
items.push('Tooltip: No Tooltip');
|
|
52
|
+
}
|
|
53
|
+
(0, StyledColumnSliceStyleEditors_1.getCellBoxStyleSummaryItems)(rating.Cell).forEach(({ label, value }) => {
|
|
54
|
+
items.push(`${label}: ${value}`);
|
|
55
|
+
});
|
|
56
|
+
return items;
|
|
57
|
+
};
|
|
58
|
+
const getStyledColumnRatingStyleViewValues = (data) => {
|
|
59
|
+
const rating = data.RatingStyle;
|
|
60
|
+
if (!rating) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return buildStyledColumnRatingStyleSummaryStrings(rating, {
|
|
64
|
+
includeEmptyTooltip: false,
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.getStyledColumnRatingStyleViewValues = getStyledColumnRatingStyleViewValues;
|
|
33
68
|
/**
|
|
34
69
|
* Resolve a CSS custom property (e.g. `--ab-color-warn`) to its computed
|
|
35
70
|
* value at runtime. Returns the fallback hex on SSR or when the variable
|
|
@@ -53,17 +88,10 @@ const resolveCssVar = (varName, fallbackHex) => {
|
|
|
53
88
|
* the user hasn't chosen one. The renderer uses `var(--ab-color-warn,
|
|
54
89
|
* #f5a623)`, but `ColorPicker` can't parse a `var(...)` with a fallback,
|
|
55
90
|
* so we resolve the variable manually and pass a concrete hex.
|
|
56
|
-
*
|
|
57
|
-
* State remains untouched - the picker only writes to state when the user
|
|
58
|
-
* actively picks a colour, so we never accidentally bake the resolved
|
|
59
|
-
* theme value into the saved styled column.
|
|
60
91
|
*/
|
|
61
92
|
const getDisplayedFilledColor = (rating) => rating.FilledColor || resolveCssVar('--ab-color-warn', '#f5a623');
|
|
62
93
|
/**
|
|
63
|
-
* Best-effort preview colour for the wizard's `Empty Colour` picker.
|
|
64
|
-
* renderer's actual default is `color-mix(in srgb, currentColor 22%,
|
|
65
|
-
* transparent)`, which the picker can't parse either; we approximate it
|
|
66
|
-
* by reading the document foreground colour and setting alpha to 0.22.
|
|
94
|
+
* Best-effort preview colour for the wizard's `Empty Colour` picker.
|
|
67
95
|
*/
|
|
68
96
|
const getDisplayedEmptyColor = (rating) => {
|
|
69
97
|
if (rating.EmptyColor)
|
|
@@ -82,63 +110,17 @@ const getDisplayedEmptyColor = (rating) => {
|
|
|
82
110
|
}
|
|
83
111
|
return 'rgba(127, 127, 127, 0.22)';
|
|
84
112
|
};
|
|
85
|
-
// ---------------------------------------------------------------------------
|
|
86
|
-
// Inline preview (also reused by the wizard summary so the user sees a
|
|
87
|
-
// pixel-accurate idea of the resulting cell at all times).
|
|
88
|
-
// ---------------------------------------------------------------------------
|
|
89
|
-
const ICON_PATHS = {
|
|
90
|
-
Star: 'M12 2 L14.9 8.6 L22 9.3 L16.7 14.1 L18.2 21 L12 17.4 L5.8 21 L7.3 14.1 L2 9.3 L9.1 8.6 Z',
|
|
91
|
-
Heart: 'M12 21 C 12 21 3 14.5 3 8.5 C 3 5.5 5.5 3 8.5 3 C 10.3 3 11.7 4 12 5.2 C 12.3 4 13.7 3 15.5 3 C 18.5 3 21 5.5 21 8.5 C 21 14.5 12 21 12 21 Z',
|
|
92
|
-
Circle: 'M12 4 a8 8 0 1 0 0.0001 0 Z',
|
|
93
|
-
Thumb: 'M2 11 h4 v10 h-4 z M7 11 l4 -8 c.5 -1 2 -1 2 0 l-1 5 h6 c1 0 2 1 1.7 2 l-2 8 c-.3 1 -1 1.6 -2 1.6 H7 z',
|
|
94
|
-
};
|
|
95
|
-
const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
|
|
96
|
-
function getRatingCellChromeCss(cell) {
|
|
97
|
-
if (!cell || !(0, StyleHelper_1.hasCellBoxStyle)(cell)) {
|
|
98
|
-
return {};
|
|
99
|
-
}
|
|
100
|
-
return (0, StyleHelper_1.convertAdaptableStyleToCSS)(cell);
|
|
101
|
-
}
|
|
102
|
-
const RatingPreview = ({ rating, value, }) => {
|
|
103
|
-
const max = rating.Max ?? DEFAULT_MAX;
|
|
104
|
-
const size = rating.Size ?? DEFAULT_SIZE;
|
|
105
|
-
const gap = rating.Gap ?? DEFAULT_GAP;
|
|
106
|
-
const icon = rating.Icon ?? DEFAULT_ICON;
|
|
107
|
-
const filledColor = rating.FilledColor ?? DEFAULT_FILLED_COLOR;
|
|
108
|
-
const emptyColor = rating.EmptyColor ?? DEFAULT_EMPTY_COLOR;
|
|
109
|
-
const allowHalf = rating.AllowHalf ?? true;
|
|
110
|
-
const previewValue = value ?? Math.max(1, Math.min(max, max * 0.7));
|
|
111
|
-
const effective = allowHalf ? previewValue : Math.round(previewValue);
|
|
112
|
-
const d = ICON_PATHS[icon];
|
|
113
|
-
return ((0, jsx_runtime_1.jsxs)("span", { style: {
|
|
114
|
-
display: 'inline-flex',
|
|
115
|
-
alignItems: 'center',
|
|
116
|
-
gap: `${gap}px`,
|
|
117
|
-
lineHeight: 1,
|
|
118
|
-
}, "aria-hidden": "true", children: [Array.from({ length: max }).map((_, i) => {
|
|
119
|
-
const fill = clamp(effective - i, 0, 1);
|
|
120
|
-
const clipId = `ab-rating-preview-clip-${i}-${icon}-${size}`;
|
|
121
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("path", { d: d, fill: emptyColor }), fill > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: clipId, children: (0, jsx_runtime_1.jsx)("rect", { x: 0, y: 0, width: 24 * fill, height: 24 }) }) }), (0, jsx_runtime_1.jsx)("path", { d: d, fill: filledColor, clipPath: `url(#${clipId})` })] }))] }, i));
|
|
122
|
-
}), rating.ShowValue && ((0, jsx_runtime_1.jsx)("span", { style: { marginLeft: 6, fontVariantNumeric: 'tabular-nums' }, children: previewValue }))] }));
|
|
123
|
-
};
|
|
124
|
-
// ---------------------------------------------------------------------------
|
|
125
|
-
// Wizard summary
|
|
126
|
-
// ---------------------------------------------------------------------------
|
|
127
113
|
const renderStyledColumnRatingSummary = (data) => {
|
|
128
114
|
const rating = data.RatingStyle;
|
|
129
115
|
if (!rating) {
|
|
130
116
|
return (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: "No Styling Defined" });
|
|
131
117
|
}
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2 twa:flex-wrap", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:inline-flex twa:items-center twa:gap-2 twa:box-border", style: getRatingCellChromeCss(rating.Cell), children: (0, jsx_runtime_1.jsx)(RatingPreview, { rating: rating }) }), (0, jsx_runtime_1.jsxs)(Flex_1.Box, { children: ["Out of ", (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: max })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Box, { children: ["Icon: ", (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: icon })] }), toolTipTokens.length > 0 && ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { children: ["Tooltip: ", (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: toolTipTokens.join(', ') })] })), cellTags && (0, jsx_runtime_1.jsxs)(Flex_1.Box, { children: ["Cell: ", cellTags] })] }));
|
|
118
|
+
const items = buildStyledColumnRatingStyleSummaryStrings(rating, {
|
|
119
|
+
includeEmptyTooltip: true,
|
|
120
|
+
});
|
|
121
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignItems: "center", className: "twa:flex-wrap twa:gap-2", children: items.map((item) => ((0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: item }, item))) }));
|
|
137
122
|
};
|
|
138
123
|
exports.renderStyledColumnRatingSummary = renderStyledColumnRatingSummary;
|
|
139
|
-
// ---------------------------------------------------------------------------
|
|
140
|
-
// Wizard validation
|
|
141
|
-
// ---------------------------------------------------------------------------
|
|
142
124
|
const isValidRatingStyle = (data) => {
|
|
143
125
|
const rating = data.RatingStyle;
|
|
144
126
|
if (!rating) {
|
|
@@ -173,8 +155,7 @@ const StyledColumnWizardRatingSection = (props) => {
|
|
|
173
155
|
: current.filter((t) => t !== token);
|
|
174
156
|
update({ ToolTipText: next });
|
|
175
157
|
};
|
|
176
|
-
|
|
177
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:mb-3 twa:p-3 twa:rounded-standard twa:border twa:border-border twa:gap-3", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-3 twa:font-medium", children: "Preview:" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:inline-flex twa:items-center twa:box-border", style: previewCellChrome, children: (0, jsx_runtime_1.jsx)(RatingPreview, { rating: rating }) }), (0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:text-2 twa:opacity-70", children: ["(sample value ", (rating.Max ?? DEFAULT_MAX) * 0.7, ")"] })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, className: "twa:mb-3", children: [(0, jsx_runtime_1.jsx)(Card_1.Card.Title, { children: "Icon" }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { sizes: [...STYLE_FORM_SIZES], children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Max:", children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsx)(Input_1.default, { type: "number", min: 1, step: 1, value: rating.Max ?? '', placeholder: String(DEFAULT_MAX), style: { width: 80 }, onChange: (event) => {
|
|
158
|
+
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.jsx)(Card_1.Card.Title, { children: "Icon" }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { sizes: [...STYLE_FORM_SIZES], children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Max:", children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsx)(Input_1.default, { type: "number", min: 1, step: 1, value: rating.Max ?? '', placeholder: String(StyledColumnRatingPreview_1.DEFAULT_RATING_MAX), style: { width: 80 }, onChange: (event) => {
|
|
178
159
|
const raw = event.target.value;
|
|
179
160
|
if (raw === '' || raw == null) {
|
|
180
161
|
update({ Max: undefined });
|
|
@@ -184,7 +165,7 @@ const StyledColumnWizardRatingSection = (props) => {
|
|
|
184
165
|
update({
|
|
185
166
|
Max: Number.isFinite(parsed) && parsed >= 1 ? Math.floor(parsed) : undefined,
|
|
186
167
|
});
|
|
187
|
-
} }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Icon count and rating cap (no auto scaling is applied)" })] }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Icon:", 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: rating.Icon ??
|
|
168
|
+
} }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Icon count and rating cap (no auto scaling is applied)" })] }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Icon:", 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: rating.Icon ?? StyledColumnRatingPreview_1.DEFAULT_RATING_ICON, onValueChange: (v) => update({ Icon: v }), items: ICON_CHOICES }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Filled Colour:", children: (0, jsx_runtime_1.jsx)(ColorPicker_1.ColorPicker, { disabled: disabled, api: api, value: getDisplayedFilledColor(rating), onChange: (c) => update({ FilledColor: c }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Empty Colour:", children: (0, jsx_runtime_1.jsx)(ColorPicker_1.ColorPicker, { disabled: disabled, api: api, value: getDisplayedEmptyColor(rating), onChange: (c) => update({ EmptyColor: c }) }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Icon Size (px):", children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsx)(Input_1.default, { type: "number", min: 4, step: 1, value: rating.Size ?? '', placeholder: String(StyledColumnRatingPreview_1.DEFAULT_RATING_SIZE), style: { width: 80 }, onChange: (event) => {
|
|
188
169
|
const raw = event.target.value;
|
|
189
170
|
if (raw === '' || raw == null) {
|
|
190
171
|
update({ Size: undefined });
|
|
@@ -194,7 +175,7 @@ const StyledColumnWizardRatingSection = (props) => {
|
|
|
194
175
|
update({
|
|
195
176
|
Size: Number.isFinite(parsed) && parsed >= 4 ? parsed : undefined,
|
|
196
177
|
});
|
|
197
|
-
} }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Square pixel size of each icon" })] }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Icon Gap (px):", children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsx)(Input_1.default, { type: "number", min: 0, step: 1, value: rating.Gap ?? '', placeholder: String(
|
|
178
|
+
} }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Square pixel size of each icon" })] }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Icon Gap (px):", children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsx)(Input_1.default, { type: "number", min: 0, step: 1, value: rating.Gap ?? '', placeholder: String(StyledColumnRatingPreview_1.DEFAULT_RATING_GAP), style: { width: 80 }, onChange: (event) => {
|
|
198
179
|
const raw = event.target.value;
|
|
199
180
|
if (raw === '' || raw == null) {
|
|
200
181
|
update({ Gap: undefined });
|
|
@@ -204,7 +185,7 @@ const StyledColumnWizardRatingSection = (props) => {
|
|
|
204
185
|
update({
|
|
205
186
|
Gap: Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined,
|
|
206
187
|
});
|
|
207
|
-
} }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Pixel space between adjacent icons" })] }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Allow Half Icons:", children: (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, className: "twa:ml-2", checked: rating.AllowHalf ?? true, onChange: (checked) => update({ AllowHalf: checked }), children: "Render fractional values as a partial icon (e.g. 3.5 \u2192 \u2605\u2605\u2605\u00BD\u2606)" }) })] }) })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, className: "twa:mb-3", children: [(0, jsx_runtime_1.jsx)(Card_1.Card.Title, { children: "Text" }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { sizes: [...STYLE_FORM_SIZES], children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Show Value:", children: (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, className: "twa:ml-2", checked: rating.ShowValue ?? false, onChange: (checked) => update({ ShowValue: checked }), children: "Display the numeric value beside the icons" }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Tooltip:", children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-1 twa:ml-2", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, checked: rating.ToolTipText?.includes('CellValue') ?? false, onChange: (checked) => toggleToolTipText('CellValue', checked), children: "Cell Value" }), (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, checked: rating.ToolTipText?.includes('PercentageValue') ?? false, onChange: (checked) => toggleToolTipText('PercentageValue', checked), children: "Percentage Value (value \u00F7 Max)" })] }) })] }) })] }), (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: "Cell" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[500px]", children: "Optional Cell Style properties overrides Format Column properties)" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsx)(StyledColumnSliceStyleEditors_1.StyledColumnCellStyleEditor, { api: api, disabled: disabled, value: rating.Cell, onChange: (next) => {
|
|
188
|
+
} }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Pixel space between adjacent icons" })] }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Allow Half Icons:", children: (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, className: "twa:ml-2", checked: rating.AllowHalf ?? true, onChange: (checked) => update({ AllowHalf: checked }), children: "Render fractional values as a partial icon (e.g. 3.5 \u2192 \u2605\u2605\u2605\u00BD\u2606)" }) })] }) })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, className: "twa:mb-3", children: [(0, jsx_runtime_1.jsx)(Card_1.Card.Title, { children: "Text" }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsxs)(FormLayout_1.default, { sizes: [...STYLE_FORM_SIZES], children: [(0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Show Value:", children: (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, className: "twa:ml-2", checked: rating.ShowValue ?? false, onChange: (checked) => update({ ShowValue: checked }), children: "Display the numeric value beside the icons" }) }), (0, jsx_runtime_1.jsx)(FormLayout_1.FormRow, { label: "Tooltip:", children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-1 twa:ml-2", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, checked: rating.ToolTipText?.includes('CellValue') ?? false, onChange: (checked) => toggleToolTipText('CellValue', checked), children: "Cell Value" }), (0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: disabled, checked: rating.ToolTipText?.includes('PercentageValue') ?? false, onChange: (checked) => toggleToolTipText('PercentageValue', checked), children: "Percentage Value (value \u00F7 Max)" })] }) })] }) })] }), (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" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[500px]", children: "Optional Cell Style properties overrides Format Column properties)" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { children: (0, jsx_runtime_1.jsx)(StyledColumnSliceStyleEditors_1.StyledColumnCellStyleEditor, { api: api, disabled: disabled, value: rating.Cell, onChange: (next) => {
|
|
208
189
|
if (next) {
|
|
209
190
|
update({ Cell: next });
|
|
210
191
|
}
|
|
@@ -213,6 +194,6 @@ const StyledColumnWizardRatingSection = (props) => {
|
|
|
213
194
|
delete cleaned.Cell;
|
|
214
195
|
props.onChange({ ...data, RatingStyle: cleaned });
|
|
215
196
|
}
|
|
216
|
-
} }) })] })] }));
|
|
197
|
+
} }) })] }), (0, jsx_runtime_1.jsx)(StyledColumnRatingPreview_1.StyledColumnRatingPreviewCard, { data: data })] }));
|
|
217
198
|
};
|
|
218
199
|
exports.StyledColumnWizardRatingSection = StyledColumnWizardRatingSection;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BulletRangesSummaryPreview = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Flex_1 = require("../../../../../components/Flex");
|
|
6
|
+
const Tag_1 = require("../../../../../components/Tag");
|
|
7
|
+
const StyleHelper_1 = require("../../../../../Utilities/Helpers/StyleHelper");
|
|
8
|
+
const stripClassName = 'twa:h-6 twa:w-[128px] twa:rounded twa:overflow-hidden twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_15%,transparent)]';
|
|
9
|
+
const BulletRangesSummaryPreview = ({ bulletStyle }) => {
|
|
10
|
+
const ranges = bulletStyle.CellRanges ?? [];
|
|
11
|
+
if (!ranges.length) {
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: "No bands defined" });
|
|
13
|
+
}
|
|
14
|
+
let postfix = '';
|
|
15
|
+
if (bulletStyle.RangeValueType === 'Percentage') {
|
|
16
|
+
postfix = '%';
|
|
17
|
+
}
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: ranges.map((range, i) => ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:flex-wrap twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: [range.Min, postfix, " \u2192 ", range.Max, postfix] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: stripClassName, style: { background: (0, StyleHelper_1.getVariableColor)(range.Color) } })] }, i))) }));
|
|
19
|
+
};
|
|
20
|
+
exports.BulletRangesSummaryPreview = BulletRangesSummaryPreview;
|
|
@@ -6,6 +6,7 @@ const tslib_1 = require("tslib");
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const tinycolor2_1 = tslib_1.__importDefault(require("tinycolor2"));
|
|
8
8
|
const Flex_1 = require("../../../../../components/Flex");
|
|
9
|
+
const Tag_1 = require("../../../../../components/Tag");
|
|
9
10
|
const StyleHelper_1 = require("../../../../../Utilities/Helpers/StyleHelper");
|
|
10
11
|
const StyledColumnGradientHelper_1 = require("../../../../../Utilities/Helpers/StyledColumnGradientHelper");
|
|
11
12
|
function clamp01(n) {
|
|
@@ -24,16 +25,9 @@ function gradientRangeStripCss(color, reverseGradient, minAlpha, maxAlpha) {
|
|
|
24
25
|
const c2 = (0, tinycolor2_1.default)(prepared).setAlpha(rightA).toRgbString();
|
|
25
26
|
return `linear-gradient(to right, ${c1}, ${c2})`;
|
|
26
27
|
}
|
|
27
|
-
function isDivergingZeroPair(ranges) {
|
|
28
|
-
if (!ranges || ranges.length !== 2) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
const [a, b] = ranges;
|
|
32
|
-
return a.Max === 0 && b.Min === 0;
|
|
33
|
-
}
|
|
34
28
|
const stripClassName = 'twa:h-6 twa:w-[128px] twa:rounded twa:overflow-hidden twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_15%,transparent)]';
|
|
35
29
|
function zeroCentredSplitPreview(negativeColor, positiveColor, postfix, minA, maxA) {
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:flex-wrap twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:flex-wrap twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: ["Col-Min", postfix, " \u2192 0", postfix] }), (0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: ["0", postfix, " \u2192 Col-Max", postfix] })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: `${stripClassName} twa:w-[200px]`, children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1", style: {
|
|
37
31
|
background: gradientRangeStripCss(negativeColor, true, minA, maxA),
|
|
38
32
|
} }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1", style: {
|
|
39
33
|
background: gradientRangeStripCss(positiveColor, false, minA, maxA),
|
|
@@ -52,15 +46,15 @@ const GradientRangesSummaryPreview = (props) => {
|
|
|
52
46
|
return zeroCentredSplitPreview(props.zeroCentred.NegativeColor, props.zeroCentred.PositiveColor, postfix, minA, maxA);
|
|
53
47
|
}
|
|
54
48
|
const ranges = props.ranges ?? [];
|
|
55
|
-
if (
|
|
49
|
+
if ((0, StyledColumnGradientHelper_1.isDivergingZeroCellRanges)(ranges)) {
|
|
56
50
|
const [r0, r1] = ranges;
|
|
57
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:flex-wrap twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:flex-wrap twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: [r0.Min, postfix, " \u2192 ", r0.Max, postfix] }), (0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: [r1.Min, postfix, " \u2192 ", r1.Max, postfix] })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { className: `${stripClassName} twa:w-[200px]`, children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1", style: {
|
|
58
52
|
background: gradientRangeStripCss(r0.Color, !!r0.ReverseGradient, minA, maxA),
|
|
59
53
|
} }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1", style: {
|
|
60
54
|
background: gradientRangeStripCss(r1.Color, !!r1.ReverseGradient, minA, maxA),
|
|
61
55
|
} })] })] }));
|
|
62
56
|
}
|
|
63
|
-
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: ranges.map((r, i) => ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:flex-wrap twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: ranges.map((r, i) => ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:flex-wrap twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: [r.Min, postfix, " \u2192 ", r.Max, postfix] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: stripClassName, style: {
|
|
64
58
|
background: gradientRangeStripCss(r.Color, !!r.ReverseGradient, minA, maxA),
|
|
65
59
|
} })] }, i))) }));
|
|
66
60
|
};
|
|
@@ -71,7 +65,7 @@ const GradientColumnComparisonSummaryPreview = (props) => {
|
|
|
71
65
|
const fmt = (v) => isNaN(Number(v))
|
|
72
66
|
? `[${props.api.columnApi.getFriendlyNameForColumnId(String(v))}]`
|
|
73
67
|
: v;
|
|
74
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(
|
|
68
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: ["Min: ", fmt(props.columnComparison.MinValue), " \u2014 Max: ", fmt(props.columnComparison.MaxValue)] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: `${stripClassName} twa:w-[200px]`, style: {
|
|
75
69
|
background: gradientRangeStripCss(props.columnComparison.Color, false, minA, maxA),
|
|
76
70
|
} })] }));
|
|
77
71
|
};
|
|
@@ -5,13 +5,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const AdaptableContext_1 = require("../../../../AdaptableContext");
|
|
6
6
|
const PercentBarStylePreview_1 = require("./PercentBarStylePreview");
|
|
7
7
|
const Flex_1 = require("../../../../../components/Flex");
|
|
8
|
+
const Tag_1 = require("../../../../../components/Tag");
|
|
8
9
|
const PercentBarColumnComparisonPreview = (props) => {
|
|
9
10
|
const { api } = (0, AdaptableContext_1.useAdaptable)();
|
|
10
11
|
const columnComparison = props.percentBarStyle.ColumnComparison;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
: columnComparison.MaxValue, ' '] }), (0, jsx_runtime_1.jsx)(PercentBarStylePreview_1.PercentBarStylePreview, { backgroundColor: columnComparison.Color, barBackgroundColor: props.percentBarStyle.BackColor, cellText: props.percentBarStyle.CellText, toolTipText: props.percentBarStyle.ToolTipText })] }));
|
|
12
|
+
const fmt = (v) => isNaN(Number(v))
|
|
13
|
+
? `[${api.columnApi.getFriendlyNameForColumnId(String(v))}]`
|
|
14
|
+
: v;
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: ["Min: ", fmt(columnComparison.MinValue), " \u2014 Max: ", fmt(columnComparison.MaxValue)] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:max-w-[200px]", children: (0, jsx_runtime_1.jsx)(PercentBarStylePreview_1.PercentBarStylePreview, { backgroundColor: props.percentBarStyle.BackColor, barBackgroundColor: columnComparison.Color }) })] }));
|
|
16
16
|
};
|
|
17
17
|
exports.PercentBarColumnComparisonPreview = PercentBarColumnComparisonPreview;
|
|
@@ -4,11 +4,12 @@ exports.PercentBarPreview = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const PercentBarStylePreview_1 = require("./PercentBarStylePreview");
|
|
6
6
|
const Flex_1 = require("../../../../../components/Flex");
|
|
7
|
+
const Tag_1 = require("../../../../../components/Tag");
|
|
7
8
|
const PercentBarPreview = (props) => {
|
|
8
9
|
let postfix = '';
|
|
9
10
|
if (props.percentBarStyle.RangeValueType === 'Percentage') {
|
|
10
11
|
postfix = '%';
|
|
11
12
|
}
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: props.percentBarStyle.CellRanges.map((range, i) => ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "stretch", className: "twa:flex-wrap twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: [range.Min, postfix, " \u2192 ", range.Max, postfix] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1 twa:min-w-[120px]", children: (0, jsx_runtime_1.jsx)(PercentBarStylePreview_1.PercentBarStylePreview, { backgroundColor: props.percentBarStyle.BackColor, barBackgroundColor: range.Color }) })] }, i))) }));
|
|
13
14
|
};
|
|
14
15
|
exports.PercentBarPreview = PercentBarPreview;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Compact range-colour strip for Percent Bar range summaries.
|
|
4
|
+
* Cell text / origin / font are shown in `StyledColumnPercentBarPreview`.
|
|
5
|
+
*/
|
|
3
6
|
export declare const PercentBarStylePreview: React.FunctionComponent<{
|
|
4
|
-
backgroundColor
|
|
7
|
+
backgroundColor?: string | null;
|
|
5
8
|
barBackgroundColor?: string;
|
|
6
|
-
cellText?: CellTextOptions;
|
|
7
|
-
toolTipText?: CellTextOptions;
|
|
8
9
|
}>;
|
|
@@ -3,19 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PercentBarStylePreview = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const Flex_1 = require("../../../../../components/Flex");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
text += ' (50%)';
|
|
13
|
-
}
|
|
14
|
-
return text.trim();
|
|
15
|
-
};
|
|
6
|
+
const StyleHelper_1 = require("../../../../../Utilities/Helpers/StyleHelper");
|
|
7
|
+
const stripClassName = 'twa:h-6 twa:w-[128px] twa:rounded twa:overflow-hidden twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_15%,transparent)]';
|
|
8
|
+
/**
|
|
9
|
+
* Compact range-colour strip for Percent Bar range summaries.
|
|
10
|
+
* Cell text / origin / font are shown in `StyledColumnPercentBarPreview`.
|
|
11
|
+
*/
|
|
16
12
|
const PercentBarStylePreview = (props) => {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
13
|
+
const trackColor = props.backgroundColor ? (0, StyleHelper_1.getVariableColor)(props.backgroundColor) : undefined;
|
|
14
|
+
const barColor = props.barBackgroundColor
|
|
15
|
+
? (0, StyleHelper_1.getVariableColor)(props.barBackgroundColor)
|
|
16
|
+
: undefined;
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: stripClassName, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: "twa:h-full twa:relative", style: trackColor ? { backgroundColor: trackColor } : undefined, children: barColor && ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:absolute twa:top-0 twa:left-0 twa:h-full twa:w-1/2", style: { background: barColor } })) }) }));
|
|
20
18
|
};
|
|
21
19
|
exports.PercentBarStylePreview = PercentBarStylePreview;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RangeBarRangesSummaryPreview = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Flex_1 = require("../../../../../components/Flex");
|
|
6
|
+
const Tag_1 = require("../../../../../components/Tag");
|
|
7
|
+
const StyleHelper_1 = require("../../../../../Utilities/Helpers/StyleHelper");
|
|
8
|
+
const stripClassName = 'twa:h-6 twa:w-[128px] twa:rounded twa:overflow-hidden twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_15%,transparent)]';
|
|
9
|
+
const RangeBarRangesSummaryPreview = ({ rangeStyle }) => {
|
|
10
|
+
const ranges = rangeStyle.CellRanges ?? [];
|
|
11
|
+
if (!ranges.length) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
let postfix = '';
|
|
15
|
+
if (rangeStyle.RangeValueType === 'Percentage') {
|
|
16
|
+
postfix = '%';
|
|
17
|
+
}
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-2", children: ranges.map((range, i) => ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "center", className: "twa:flex-wrap twa:gap-2", children: [(0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: [range.Min, postfix, " \u2192 ", range.Max, postfix] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: stripClassName, style: { background: (0, StyleHelper_1.getVariableColor)(range.Color) } })] }, i))) }));
|
|
19
|
+
};
|
|
20
|
+
exports.RangeBarRangesSummaryPreview = RangeBarRangesSummaryPreview;
|
|
@@ -8,3 +8,6 @@ import { StyledColumn } from '../../../../../types';
|
|
|
8
8
|
export declare const StyledColumnBadgePreview: React.FunctionComponent<React.PropsWithChildren<{
|
|
9
9
|
data: StyledColumn;
|
|
10
10
|
}>>;
|
|
11
|
+
export declare const StyledColumnBadgePreviewCard: React.FunctionComponent<React.PropsWithChildren<{
|
|
12
|
+
data: StyledColumn;
|
|
13
|
+
}>>;
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StyledColumnBadgePreview = void 0;
|
|
3
|
+
exports.StyledColumnBadgePreviewCard = exports.StyledColumnBadgePreview = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const GeneralConstants_1 = require("../../../../../Utilities/Constants/GeneralConstants");
|
|
6
|
+
const StyleHelper_1 = require("../../../../../Utilities/Helpers/StyleHelper");
|
|
6
7
|
const AdaptableContext_1 = require("../../../../AdaptableContext");
|
|
7
8
|
const Badge_1 = require("../../../../Components/Badge");
|
|
8
9
|
const Flex_1 = require("../../../../../components/Flex");
|
|
10
|
+
const Card_1 = require("../../../../../components/Card");
|
|
11
|
+
const Tag_1 = require("../../../../../components/Tag");
|
|
9
12
|
const OVERFLOW_CLASS = {
|
|
10
13
|
Truncate: 'ab-Badge__wrapper--truncate',
|
|
11
14
|
Wrap: 'ab-Badge__wrapper--wrap',
|
|
12
15
|
Scroll: 'ab-Badge__wrapper--scroll',
|
|
13
16
|
};
|
|
17
|
+
const PREVIEW_CELL_CLASS = 'ab-BadgePreviewCell twa:min-w-[140px] twa:min-h-[32px] twa:px-2 twa:py-1 twa:rounded-standard twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_15%,transparent)]';
|
|
18
|
+
const resolveBadgeRowJustify = (alignment) => {
|
|
19
|
+
switch (alignment) {
|
|
20
|
+
case 'Center':
|
|
21
|
+
return 'center';
|
|
22
|
+
case 'Right':
|
|
23
|
+
return 'flex-end';
|
|
24
|
+
case 'Left':
|
|
25
|
+
return 'flex-start';
|
|
26
|
+
default:
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
14
30
|
/**
|
|
15
31
|
* Pixel-parity preview of the badges as they would render in the cell.
|
|
16
32
|
* Uses the same wrapper/badge classes (and the same `Badge` component) as
|
|
@@ -20,13 +36,24 @@ const StyledColumnBadgePreview = ({ data }) => {
|
|
|
20
36
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
21
37
|
const badgeStyle = data.BadgeStyle;
|
|
22
38
|
if (!badgeStyle || !badgeStyle.Badges || badgeStyle.Badges.length === 0) {
|
|
23
|
-
return (0, jsx_runtime_1.jsx)(
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: "No Badges Defined" });
|
|
24
40
|
}
|
|
25
41
|
const overflow = badgeStyle.OverflowMode ?? 'Truncate';
|
|
26
42
|
const wrapperClassName = `ab-Badge__wrapper ${OVERFLOW_CLASS[overflow]}`;
|
|
27
43
|
const spacing = typeof badgeStyle.Spacing === 'number' ? badgeStyle.Spacing : null;
|
|
44
|
+
const rowJustify = resolveBadgeRowJustify(badgeStyle.Font?.Alignment);
|
|
45
|
+
const cellStyle = badgeStyle.Cell ? (0, StyleHelper_1.convertAdaptableStyleToCSS)(badgeStyle.Cell) : undefined;
|
|
28
46
|
const dataType = adaptable.api.columnApi.getColumnDataTypeForColumnId(data.ColumnId);
|
|
29
|
-
|
|
47
|
+
const wrapperStyle = {
|
|
48
|
+
...(spacing != null ? { ['--ab-cmp-badge__spacing']: `${spacing}px` } : {}),
|
|
49
|
+
...(rowJustify
|
|
50
|
+
? {
|
|
51
|
+
justifyContent: rowJustify,
|
|
52
|
+
width: '100%',
|
|
53
|
+
}
|
|
54
|
+
: {}),
|
|
55
|
+
};
|
|
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) => {
|
|
30
57
|
const badgeValue = badge.IconOnly
|
|
31
58
|
? ''
|
|
32
59
|
: dataType === 'number'
|
|
@@ -36,3 +63,5 @@ const StyledColumnBadgePreview = ({ data }) => {
|
|
|
36
63
|
}) }) }));
|
|
37
64
|
};
|
|
38
65
|
exports.StyledColumnBadgePreview = StyledColumnBadgePreview;
|
|
66
|
+
const StyledColumnBadgePreviewCard = ({ data }) => ((0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, children: [(0, jsx_runtime_1.jsx)(Card_1.Card.Title, { children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Preview" }) }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:p-1", children: (0, jsx_runtime_1.jsx)(exports.StyledColumnBadgePreview, { data: data }) })] }));
|
|
67
|
+
exports.StyledColumnBadgePreviewCard = StyledColumnBadgePreviewCard;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BulletChartStyle, StyledColumn } from '../../../../../AdaptableState/StyledColumnState';
|
|
3
|
+
export declare const StyledColumnBulletPreview: React.FunctionComponent<React.PropsWithChildren<{
|
|
4
|
+
data: StyledColumn;
|
|
5
|
+
}>>;
|
|
6
|
+
export declare const StyledColumnBulletPreviewCard: React.FunctionComponent<React.PropsWithChildren<{
|
|
7
|
+
data: StyledColumn;
|
|
8
|
+
}>>;
|
|
9
|
+
export declare const hasBulletChartRangesConfigured: (bullet: BulletChartStyle | undefined) => boolean;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasBulletChartRangesConfigured = exports.StyledColumnBulletPreviewCard = exports.StyledColumnBulletPreview = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const StyleHelper_1 = require("../../../../../Utilities/Helpers/StyleHelper");
|
|
6
|
+
const Flex_1 = require("../../../../../components/Flex");
|
|
7
|
+
const Card_1 = require("../../../../../components/Card");
|
|
8
|
+
const Tag_1 = require("../../../../../components/Tag");
|
|
9
|
+
const StyledColumnChartListPreviews_1 = require("./StyledColumnChartListPreviews");
|
|
10
|
+
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
|
+
const getBulletPreviewSample = (bullet) => {
|
|
12
|
+
const ranges = bullet.CellRanges ?? [];
|
|
13
|
+
const numeric = ranges.filter((range) => typeof range.Min === 'number' && typeof range.Max === 'number');
|
|
14
|
+
let min = 0;
|
|
15
|
+
let max = 100;
|
|
16
|
+
if (numeric.length) {
|
|
17
|
+
min = Math.min(...numeric.map((range) => range.Min));
|
|
18
|
+
max = Math.max(...numeric.map((range) => range.Max));
|
|
19
|
+
}
|
|
20
|
+
const span = max - min || 1;
|
|
21
|
+
// Matches the schematic bar width (~58%) in `StyledColumnBulletChartListPreview`.
|
|
22
|
+
const sampleValue = min + span * 0.58;
|
|
23
|
+
const valueFraction = (sampleValue - min) / span;
|
|
24
|
+
return {
|
|
25
|
+
sampleValue,
|
|
26
|
+
valueFraction: Math.max(0, Math.min(1, valueFraction)),
|
|
27
|
+
};
|
|
28
|
+
};
|
|
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
|
+
const BulletChartPreviewContent = ({ bullet, }) => {
|
|
40
|
+
const { sampleValue, valueFraction } = getBulletPreviewSample(bullet);
|
|
41
|
+
const cellText = formatBulletPreviewCellText(sampleValue, valueFraction, bullet);
|
|
42
|
+
const hasCellText = Boolean(bullet.CellText?.length && cellText);
|
|
43
|
+
const textPosition = bullet.CellTextPosition ?? 'Below';
|
|
44
|
+
const fontStyle = bullet.Font ? (0, StyleHelper_1.convertAdaptableStyleToCSS)(bullet.Font) : undefined;
|
|
45
|
+
const isVertical = bullet.Orientation === 'Vertical';
|
|
46
|
+
const chartEl = (0, jsx_runtime_1.jsx)(StyledColumnChartListPreviews_1.StyledColumnBulletChartListPreview, { bullet: bullet });
|
|
47
|
+
const textEl = hasCellText ? ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "ab-BulletChart__text twa:text-2 twa:leading-tight twa:truncate twa:max-w-full", style: fontStyle, children: cellText })) : null;
|
|
48
|
+
if (hasCellText && textPosition === 'Merged') {
|
|
49
|
+
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)(Flex_1.Box, { className: "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, children: cellText })] }));
|
|
50
|
+
}
|
|
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 && textPosition === 'Above' && textEl, chartEl, hasCellText && textPosition === 'Below' && textEl] }));
|
|
52
|
+
};
|
|
53
|
+
const StyledColumnBulletPreview = ({ data }) => {
|
|
54
|
+
const bullet = data.BulletChartStyle;
|
|
55
|
+
if (!bullet) {
|
|
56
|
+
return (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: "No Bullet Chart Style" });
|
|
57
|
+
}
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: PREVIEW_CELL_CLASS, children: (0, jsx_runtime_1.jsx)(BulletChartPreviewContent, { bullet: bullet }) }));
|
|
59
|
+
};
|
|
60
|
+
exports.StyledColumnBulletPreview = StyledColumnBulletPreview;
|
|
61
|
+
const StyledColumnBulletPreviewCard = ({ data }) => ((0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, children: [(0, jsx_runtime_1.jsx)(Card_1.Card.Title, { children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Preview" }) }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:p-1", children: (0, jsx_runtime_1.jsx)(exports.StyledColumnBulletPreview, { data: data }) })] }));
|
|
62
|
+
exports.StyledColumnBulletPreviewCard = StyledColumnBulletPreviewCard;
|
|
63
|
+
const hasBulletChartRangesConfigured = (bullet) => Boolean(bullet?.CellRanges?.length);
|
|
64
|
+
exports.hasBulletChartRangesConfigured = hasBulletChartRangesConfigured;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyledColumn } from '../../../../../AdaptableState/StyledColumnState';
|
|
3
|
+
import { AdaptableApi } from '../../../../../Api/AdaptableApi';
|
|
4
|
+
export declare const StyledColumnGradientPreview: React.FunctionComponent<React.PropsWithChildren<{
|
|
5
|
+
data: StyledColumn;
|
|
6
|
+
api?: AdaptableApi;
|
|
7
|
+
}>>;
|
|
8
|
+
export declare const StyledColumnGradientPreviewCard: React.FunctionComponent<React.PropsWithChildren<{
|
|
9
|
+
data: StyledColumn;
|
|
10
|
+
}>>;
|