@adaptabletools/adaptable 23.0.0-canary.3 → 23.0.0-canary.5
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 +116 -61
- package/package.json +9 -4
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +0 -4
- package/src/AdaptableOptions/EditOptions.d.ts +2 -2
- package/src/AdaptableOptions/FilterOptions.d.ts +0 -7
- package/src/AdaptableState/Common/AdaptableForm.d.ts +18 -1
- package/src/AdaptableState/Common/AdaptableForm.js +31 -0
- package/src/AdaptableState/Common/AggregationColumns.d.ts +14 -6
- package/src/AdaptableState/Common/AggregationColumns.js +27 -2
- package/src/AdaptableState/Common/CellDataChangedInfo.d.ts +3 -2
- package/src/AdaptableState/Common/ColumnScope.d.ts +4 -0
- package/src/AdaptableState/Common/Enums.d.ts +5 -10
- package/src/AdaptableState/Common/Enums.js +4 -10
- 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 +1 -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 +29 -7
- 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/CalculatedColumnModule.js +3 -1
- package/src/Strategy/FormatColumnModule.js +14 -7
- package/src/Strategy/LayoutModule.js +13 -8
- package/src/Strategy/StyledColumnModule.js +64 -36
- 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 +65 -0
- package/src/Utilities/Helpers/StyledColumnGradientHelper.d.ts +23 -1
- package/src/Utilities/Helpers/StyledColumnGradientHelper.js +204 -0
- package/src/Utilities/Helpers/ThemeHelpers.d.ts +5 -0
- package/src/Utilities/Helpers/ThemeHelpers.js +38 -0
- package/src/Utilities/Helpers/percentBarPreviewHelper.d.ts +19 -0
- package/src/Utilities/Helpers/percentBarPreviewHelper.js +143 -0
- package/src/Utilities/ObjectFactory.d.ts +1 -3
- package/src/Utilities/ObjectFactory.js +0 -8
- package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +1 -0
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +7 -0
- package/src/Utilities/Services/CalculatedColumnSyntheticChange.d.ts +4 -0
- package/src/Utilities/Services/CalculatedColumnSyntheticChange.js +115 -0
- package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +1 -0
- package/src/Utilities/Services/ThemeService.js +1 -1
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +17 -16
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +114 -103
- package/src/View/Alert/Wizard/AlertMessageWizardSection.js +13 -14
- package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +55 -55
- package/src/View/Alert/Wizard/AlertRulesWizardSection.js +3 -2
- package/src/View/Alert/Wizard/AlertScheduledWizardSection.js +2 -2
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +31 -39
- package/src/View/Alert/Wizard/AlertTypeWizardSection.js +3 -4
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +9 -13
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +30 -17
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +7 -9
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +3 -3
- 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 +35 -52
- 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 +21 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.d.ts +1 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +10 -7
- package/src/View/Comments/CommentsEditor.js +1 -1
- package/src/View/Components/ColumnFilter/ColumnFilterWindow.js +1 -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 +0 -1
- package/src/View/Components/RangesComponent.d.ts +7 -2
- package/src/View/Components/RangesComponent.js +94 -22
- package/src/View/Components/Selectors/ColumnSelector.js +5 -0
- 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 +6 -4
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadTextSection.js +3 -2
- package/src/View/DataImport/DataImportWizard/sections/ValidationSection.js +5 -15
- package/src/View/Export/Wizard/ReportColumnsWizardSection.js +24 -26
- package/src/View/Export/Wizard/ReportNameWizardSection.js +10 -13
- package/src/View/Export/Wizard/ReportRowsWizardSection.js +20 -22
- package/src/View/Export/Wizard/ScheduledReportSettings.d.ts +2 -0
- package/src/View/Export/Wizard/ScheduledReportSettings.js +13 -13
- package/src/View/Export/Wizard/ScheduledReportWizard.js +4 -5
- package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +8 -6
- package/src/View/FlashingCell/Wizard/FlashingCellScopeWizardSection.js +24 -23
- package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +20 -11
- package/src/View/FlashingCell/Wizard/FlashingCellStyleWizardSection.js +21 -5
- 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 +117 -12
- package/src/View/FormatColumn/Wizard/FormatColumnPreview.d.ts +15 -0
- package/src/View/FormatColumn/Wizard/FormatColumnPreview.js +66 -0
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.d.ts +4 -0
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +30 -0
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +13 -8
- 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 +62 -13
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +5 -3
- package/src/View/FreeTextColumn/Utilities/getFreeTextColumnSettingsTags.d.ts +2 -0
- package/src/View/FreeTextColumn/Utilities/getFreeTextColumnSettingsTags.js +15 -0
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnDefinitionWizardSection.d.ts +10 -0
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnDefinitionWizardSection.js +53 -0
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +2 -3
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +33 -68
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +15 -11
- package/src/View/Layout/LayoutViewPanel.js +23 -21
- 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 +115 -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 +11 -11
- package/src/View/Layout/Wizard/sections/PivotAggregationsSection.d.ts +1 -2
- package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +101 -52
- 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 +4 -5
- 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 +9 -14
- 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 +43 -13
- package/src/View/PlusMinus/Wizard/PlusMinusScopeWizardSection.js +11 -18
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.d.ts +2 -6
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +6 -22
- 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 +11 -18
- package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +17 -6
- package/src/View/Shortcut/Wizard/ShortcutWizard.js +3 -3
- package/src/View/Shortcut/shortcutOperations.d.ts +3 -0
- package/src/View/Shortcut/shortcutOperations.js +28 -0
- package/src/View/SpecialColumnSettingsWizardStep.js +9 -8
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.js +24 -15
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.d.ts +10 -2
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +96 -16
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +14 -0
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.js +45 -24
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.d.ts +2 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +108 -33
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +21 -13
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +121 -23
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.d.ts +1 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.js +34 -11
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +86 -12
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +121 -34
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.d.ts +1 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.js +55 -75
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.js +16 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/GradientSummaryPreview.js +7 -13
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarColumnComparisonPreview.js +5 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarRangesPreview.js +4 -3
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarStylePreview.d.ts +5 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarStylePreview.js +12 -14
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.js +16 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.d.ts +3 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.js +31 -3
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.d.ts +9 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.js +58 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview.d.ts +10 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview.js +30 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.d.ts +10 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.js +91 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.d.ts +8 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.js +52 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.d.ts +8 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.js +53 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.d.ts +18 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.js +58 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview.d.ts +10 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview.js +126 -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 +52 -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 +7 -21
- package/src/View/renderWithAdaptableContext.js +2 -3
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -1
- package/src/agGrid/AdaptableAgGrid.js +38 -43
- package/src/agGrid/AgGridAdapter.d.ts +1 -1
- package/src/agGrid/AgGridAdapter.js +27 -17
- package/src/agGrid/AgGridColumnAdapter.js +10 -19
- 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 +111 -0
- package/src/agGrid/cellRenderers/IconRenderer.d.ts +6 -0
- package/src/agGrid/cellRenderers/IconRenderer.js +43 -15
- package/src/agGrid/createAgGridIcon.d.ts +10 -0
- package/src/agGrid/createAgGridIcon.js +16 -0
- package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +11 -6
- package/src/components/Combobox/VirtualizedList.js +5 -5
- package/src/components/Combobox/comboboxUtils.d.ts +4 -1
- package/src/components/Combobox/comboboxUtils.js +2 -0
- package/src/components/Combobox/index.d.ts +1 -0
- package/src/components/Combobox/index.js +35 -15
- 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/components/Tree/TreeDropdown/index.js +2 -6
- package/src/env.js +2 -2
- package/src/layout-manager/src/LayoutManagerModel.d.ts +5 -1
- package/src/layout-manager/src/index.js +2 -9
- package/src/metamodel/adaptable.metamodel.d.ts +39 -46
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +5 -5
- package/themes/dark.css +1 -68
- package/themes/light.css +1 -5
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/AdaptableState/Common/FilterActionOnDataChange.d.ts +0 -17
- package/src/AdaptableState/Common/FilterActionOnDataChange.js +0 -4
- package/src/Aggregation/ParameterizedAggregationRegistry.d.ts +0 -35
- package/src/Aggregation/ParameterizedAggregationRegistry.js +0 -63
- package/src/Aggregation/definitions/weightedAverageAggregationDefinition.d.ts +0 -3
- package/src/Aggregation/definitions/weightedAverageAggregationDefinition.js +0 -55
- package/src/Aggregation/parameterizedAggregationColumnMenu.d.ts +0 -8
- package/src/Aggregation/parameterizedAggregationColumnMenu.js +0 -137
- package/src/Aggregation/parameterizedAggregationHeader.d.ts +0 -13
- package/src/Aggregation/parameterizedAggregationHeader.js +0 -60
- package/src/Aggregation/parameterizedAggregationHelpers.d.ts +0 -23
- package/src/Aggregation/parameterizedAggregationHelpers.js +0 -111
- package/src/Aggregation/parameterizedAggregationWizardHelpers.d.ts +0 -9
- package/src/Aggregation/parameterizedAggregationWizardHelpers.js +0 -66
- package/src/Aggregation/validateParameterizedAggregations.d.ts +0 -4
- package/src/Aggregation/validateParameterizedAggregations.js +0 -20
- package/src/View/AdaptableComputedCSSVarsContext.d.ts +0 -12
- package/src/View/AdaptableComputedCSSVarsContext.js +0 -29
- package/src/View/Layout/Wizard/sections/ParameterizedAggFuncPicker.d.ts +0 -12
- package/src/View/Layout/Wizard/sections/ParameterizedAggFuncPicker.js +0 -43
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.d.ts +0 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.js +0 -28
- package/src/View/Theme/VariantSelector.d.ts +0 -8
- package/src/View/Theme/VariantSelector.js +0 -20
- package/src/components/Select/CSSNumericVariableWatch.d.ts +0 -11
- package/src/components/Select/CSSNumericVariableWatch.js +0 -45
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import tinycolor from 'tinycolor2';
|
|
2
|
+
import { convertAdaptableStyleToCSS } from './StyleHelper';
|
|
3
|
+
import { getVariableColor } from './StyleHelper';
|
|
4
|
+
import clamp from '../utils/clamp';
|
|
1
5
|
/**
|
|
2
6
|
* Default alpha at the **low** end of a Gradient range when `MinAlpha` is unset.
|
|
3
7
|
* Slightly above zero so the bottom-edge value of every range still shows its
|
|
@@ -8,6 +12,206 @@ export const DEFAULT_GRADIENT_MIN_ALPHA = 0.15;
|
|
|
8
12
|
* Default alpha at the **high** end of a Gradient range when `MaxAlpha` is unset.
|
|
9
13
|
*/
|
|
10
14
|
export const DEFAULT_GRADIENT_MAX_ALPHA = 1;
|
|
15
|
+
export const hasGradientRangesConfigured = (gs) => !!(gs?.ZeroCentred || gs?.CellRanges?.length || gs?.ColumnComparison);
|
|
16
|
+
const evenlySpacedValues = (min, max, count) => {
|
|
17
|
+
if (count <= 1) {
|
|
18
|
+
return [min];
|
|
19
|
+
}
|
|
20
|
+
const step = (max - min) / (count - 1);
|
|
21
|
+
return Array.from({ length: count }, (_, i) => min + step * i);
|
|
22
|
+
};
|
|
23
|
+
/** Number of sample cells shown in Gradient / Percent Bar style previews. */
|
|
24
|
+
export const STYLED_COLUMN_PREVIEW_SAMPLE_COUNT = 6;
|
|
25
|
+
/** Illustrative zero-centred scale endpoints for preview geometry. */
|
|
26
|
+
export const ZERO_CENTRED_PREVIEW_SCALE_MIN = -20;
|
|
27
|
+
export const ZERO_CENTRED_PREVIEW_SCALE_MAX = 20;
|
|
28
|
+
/** @deprecated Use {@link getZeroCentredGradientPreviewValues} — kept for callers using endpoints. */
|
|
29
|
+
export const ZERO_CENTRED_GRADIENT_PREVIEW_VALUES = evenlySpacedValues(ZERO_CENTRED_PREVIEW_SCALE_MIN, ZERO_CENTRED_PREVIEW_SCALE_MAX, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
|
|
30
|
+
export const getZeroCentredGradientPreviewValues = () => evenlySpacedValues(ZERO_CENTRED_PREVIEW_SCALE_MIN, ZERO_CENTRED_PREVIEW_SCALE_MAX, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
|
|
31
|
+
export function isDivergingZeroCellRanges(ranges) {
|
|
32
|
+
if (!ranges || ranges.length !== 2) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const [a, b] = ranges;
|
|
36
|
+
return a.Max === 0 && b.Min === 0;
|
|
37
|
+
}
|
|
38
|
+
export function isZeroCentredGradientStyle(gs) {
|
|
39
|
+
return !!(gs.ZeroCentred || isDivergingZeroCellRanges(gs.CellRanges));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Sample cell values for gradient preview strips — spread across the effective scale.
|
|
43
|
+
*/
|
|
44
|
+
export const getGradientPreviewSampleValues = (styledColumn, api) => {
|
|
45
|
+
const gs = styledColumn.GradientStyle;
|
|
46
|
+
if (!gs || !hasGradientRangesConfigured(gs)) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
if (isZeroCentredGradientStyle(gs)) {
|
|
50
|
+
return getZeroCentredGradientPreviewValues();
|
|
51
|
+
}
|
|
52
|
+
if (gs.ColumnComparison) {
|
|
53
|
+
const min = Number(gs.ColumnComparison.MinValue);
|
|
54
|
+
const max = Number(gs.ColumnComparison.MaxValue);
|
|
55
|
+
if (!Number.isNaN(min) && !Number.isNaN(max)) {
|
|
56
|
+
return evenlySpacedValues(min, max, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
|
|
57
|
+
}
|
|
58
|
+
return evenlySpacedValues(0, 100, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
|
|
59
|
+
}
|
|
60
|
+
const column = styledColumn.ColumnId
|
|
61
|
+
? api.columnApi.getColumnWithColumnId(styledColumn.ColumnId)
|
|
62
|
+
: undefined;
|
|
63
|
+
if (!column) {
|
|
64
|
+
return evenlySpacedValues(0, 100, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
|
|
65
|
+
}
|
|
66
|
+
const colMin = api.styledColumnApi.internalApi.getMinValueForNumericColumn(column);
|
|
67
|
+
const colMax = api.styledColumnApi.internalApi.getMaxValueForNumericColumn(column);
|
|
68
|
+
if (colMin === colMax) {
|
|
69
|
+
return [colMin];
|
|
70
|
+
}
|
|
71
|
+
return evenlySpacedValues(colMin, colMax, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
|
|
72
|
+
};
|
|
73
|
+
const getZeroCentredPreviewColors = (gradientStyle) => {
|
|
74
|
+
if (gradientStyle.ZeroCentred) {
|
|
75
|
+
return {
|
|
76
|
+
negative: gradientStyle.ZeroCentred.NegativeColor,
|
|
77
|
+
positive: gradientStyle.ZeroCentred.PositiveColor,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const ranges = gradientStyle.CellRanges;
|
|
81
|
+
if (isDivergingZeroCellRanges(ranges)) {
|
|
82
|
+
return {
|
|
83
|
+
negative: ranges[0].Color,
|
|
84
|
+
positive: ranges[1].Color,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Zero-centred preview uses a fixed -20…20 illustrative scale so negative
|
|
91
|
+
* colours always appear — independent of whether the column currently has
|
|
92
|
+
* negative values (Col-Min may be above zero today).
|
|
93
|
+
*/
|
|
94
|
+
const getZeroCentredGradientPreviewCellStyle = (cellValue, gradientStyle) => {
|
|
95
|
+
const colors = getZeroCentredPreviewColors(gradientStyle);
|
|
96
|
+
if (!colors) {
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
const previewMin = ZERO_CENTRED_PREVIEW_SCALE_MIN;
|
|
100
|
+
const previewMax = ZERO_CENTRED_PREVIEW_SCALE_MAX;
|
|
101
|
+
const syntheticRanges = [
|
|
102
|
+
{ Min: previewMin, Max: 0, Color: colors.negative },
|
|
103
|
+
{ Min: 0, Max: previewMax, Color: colors.positive },
|
|
104
|
+
];
|
|
105
|
+
let matchingRange = null;
|
|
106
|
+
for (const range of syntheticRanges) {
|
|
107
|
+
const min = range.Min;
|
|
108
|
+
const max = range.Max;
|
|
109
|
+
if (cellValue >= min && cellValue <= max) {
|
|
110
|
+
matchingRange = range;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (!matchingRange) {
|
|
115
|
+
return {};
|
|
116
|
+
}
|
|
117
|
+
const min = matchingRange.Min;
|
|
118
|
+
const max = matchingRange.Max;
|
|
119
|
+
const reverseGradient = matchingRange.Min === previewMin && matchingRange.Max === 0;
|
|
120
|
+
const minAlphaBound = gradientStyle.MinAlpha ?? DEFAULT_GRADIENT_MIN_ALPHA;
|
|
121
|
+
const maxAlphaBound = gradientStyle.MaxAlpha ?? DEFAULT_GRADIENT_MAX_ALPHA;
|
|
122
|
+
const lo = Math.min(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
|
|
123
|
+
const hi = Math.max(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
|
|
124
|
+
const span = Math.abs(max - min);
|
|
125
|
+
let t = span === 0 ? 0.5 : (Number(cellValue) - min) / span;
|
|
126
|
+
t = clamp(t, 0, 1);
|
|
127
|
+
if (reverseGradient) {
|
|
128
|
+
t = 1 - t;
|
|
129
|
+
}
|
|
130
|
+
const alpha = Number((lo + t * (hi - lo)).toPrecision(4));
|
|
131
|
+
let style = {};
|
|
132
|
+
const bg = tinycolor(getVariableColor(matchingRange.Color)).setAlpha(alpha);
|
|
133
|
+
style.backgroundColor = bg.toRgbString();
|
|
134
|
+
if (gradientStyle.AutoContrastText) {
|
|
135
|
+
style.color = bg.getLuminance() > 0.45 ? '#111111' : '#ffffff';
|
|
136
|
+
}
|
|
137
|
+
const autoContrastColor = gradientStyle.AutoContrastText && style.color ? style.color : undefined;
|
|
138
|
+
if (gradientStyle.Font) {
|
|
139
|
+
style = { ...style, ...convertAdaptableStyleToCSS(gradientStyle.Font) };
|
|
140
|
+
}
|
|
141
|
+
if (autoContrastColor) {
|
|
142
|
+
style.color = autoContrastColor;
|
|
143
|
+
}
|
|
144
|
+
if (gradientStyle.Font?.Alignment && gradientStyle.Font.Alignment !== 'Default') {
|
|
145
|
+
style.textAlign = gradientStyle.Font.Alignment.toLowerCase();
|
|
146
|
+
}
|
|
147
|
+
return style;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Cell CSS for gradient preview — mirrors `AgGridColumnAdapter.getStyledColumnStyle` gradient path.
|
|
151
|
+
*/
|
|
152
|
+
export const getGradientPreviewCellStyle = (cellValue, styledColumn, api, rowNode) => {
|
|
153
|
+
const gradientStyle = styledColumn.GradientStyle;
|
|
154
|
+
if (!gradientStyle || !hasGradientRangesConfigured(gradientStyle)) {
|
|
155
|
+
return {};
|
|
156
|
+
}
|
|
157
|
+
if (isZeroCentredGradientStyle(gradientStyle)) {
|
|
158
|
+
return getZeroCentredGradientPreviewCellStyle(cellValue, gradientStyle);
|
|
159
|
+
}
|
|
160
|
+
const column = styledColumn.ColumnId
|
|
161
|
+
? api.columnApi.getColumnWithColumnId(styledColumn.ColumnId)
|
|
162
|
+
: undefined;
|
|
163
|
+
if (!column) {
|
|
164
|
+
return {};
|
|
165
|
+
}
|
|
166
|
+
const node = rowNode ?? api.gridApi?.getRowNodeForIndex(0) ?? null;
|
|
167
|
+
const internalApi = api.styledColumnApi.internalApi;
|
|
168
|
+
let style = {};
|
|
169
|
+
const min = internalApi.getNumericStyleMinValue(styledColumn, column, node, cellValue);
|
|
170
|
+
const max = internalApi.getNumericStyleMaxValue(styledColumn, column, node, cellValue);
|
|
171
|
+
let cellBackColor;
|
|
172
|
+
let reverseGradient = false;
|
|
173
|
+
if (gradientStyle.ColumnComparison) {
|
|
174
|
+
cellBackColor = gradientStyle.ColumnComparison.Color;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
const matchingRange = internalApi.findRangeForColumn(expandGradientCellRanges(gradientStyle), column, gradientStyleRangeLookupValueType(gradientStyle), cellValue);
|
|
178
|
+
if (matchingRange) {
|
|
179
|
+
cellBackColor = matchingRange.Color;
|
|
180
|
+
reverseGradient =
|
|
181
|
+
(!!gradientStyle.ZeroCentred && isNegativeZeroCentredBand(matchingRange)) ||
|
|
182
|
+
!!matchingRange.ReverseGradient;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const minAlphaBound = gradientStyle.MinAlpha ?? DEFAULT_GRADIENT_MIN_ALPHA;
|
|
186
|
+
const maxAlphaBound = gradientStyle.MaxAlpha ?? DEFAULT_GRADIENT_MAX_ALPHA;
|
|
187
|
+
const lo = Math.min(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
|
|
188
|
+
const hi = Math.max(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
|
|
189
|
+
const span = Math.abs(max - min);
|
|
190
|
+
let t = span === 0 ? 0.5 : (Number(cellValue) - min) / span;
|
|
191
|
+
t = clamp(t, 0, 1);
|
|
192
|
+
if (reverseGradient) {
|
|
193
|
+
t = 1 - t;
|
|
194
|
+
}
|
|
195
|
+
const alpha = Number((lo + t * (hi - lo)).toPrecision(4));
|
|
196
|
+
if (cellBackColor) {
|
|
197
|
+
const bg = tinycolor(getVariableColor(cellBackColor)).setAlpha(alpha);
|
|
198
|
+
style.backgroundColor = bg.toRgbString();
|
|
199
|
+
if (gradientStyle.AutoContrastText) {
|
|
200
|
+
style.color = bg.getLuminance() > 0.45 ? '#111111' : '#ffffff';
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const autoContrastColor = gradientStyle.AutoContrastText && style.color ? style.color : undefined;
|
|
204
|
+
if (gradientStyle.Font) {
|
|
205
|
+
style = { ...style, ...convertAdaptableStyleToCSS(gradientStyle.Font) };
|
|
206
|
+
}
|
|
207
|
+
if (autoContrastColor) {
|
|
208
|
+
style.color = autoContrastColor;
|
|
209
|
+
}
|
|
210
|
+
if (gradientStyle.Font?.Alignment && gradientStyle.Font.Alignment !== 'Default') {
|
|
211
|
+
style.textAlign = gradientStyle.Font.Alignment.toLowerCase();
|
|
212
|
+
}
|
|
213
|
+
return style;
|
|
214
|
+
};
|
|
11
215
|
/**
|
|
12
216
|
* Effective cell ranges for gradient rendering / range lookup.
|
|
13
217
|
* When `ZeroCentred` is set, expands to the canonical Col-Min…0 and 0…Col-Max bands.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AdaptableTheme, SystemThemeEntry } from '../../AdaptableState/ThemeState';
|
|
2
|
+
import { AdaptableLogger } from '../../agGrid/AdaptableLogger';
|
|
3
|
+
export declare function isLegacySystemThemeObject(theme: SystemThemeEntry | AdaptableTheme): theme is AdaptableTheme;
|
|
4
|
+
export declare function resolveSystemThemeDescription(name: string): string;
|
|
5
|
+
export declare function systemThemeEntryToAdaptableTheme(theme: SystemThemeEntry | AdaptableTheme, logger?: AdaptableLogger): AdaptableTheme;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { StaticThemes } from '../../themes';
|
|
2
|
+
import { logDeprecation } from '../logDeprecation';
|
|
3
|
+
const LEGACY_SYSTEM_THEME_PROPS = ['Description', 'CSSVariables', 'Variant'];
|
|
4
|
+
export function isLegacySystemThemeObject(theme) {
|
|
5
|
+
if (typeof theme === 'string') {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return LEGACY_SYSTEM_THEME_PROPS.some((prop) => prop in theme && theme[prop] !== undefined);
|
|
9
|
+
}
|
|
10
|
+
export function resolveSystemThemeDescription(name) {
|
|
11
|
+
return StaticThemes.find((staticTheme) => staticTheme.Name === name)?.Description ?? name;
|
|
12
|
+
}
|
|
13
|
+
export function systemThemeEntryToAdaptableTheme(theme, logger) {
|
|
14
|
+
if (typeof theme === 'string') {
|
|
15
|
+
return {
|
|
16
|
+
Name: theme,
|
|
17
|
+
Description: resolveSystemThemeDescription(theme),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (isLegacySystemThemeObject(theme)) {
|
|
21
|
+
if (logger) {
|
|
22
|
+
logDeprecation(logger, 'ThemeState', 'SystemThemes', undefined, 'Passing a full AdaptableTheme object in SystemThemes is deprecated. Use a theme name string or SystemThemeOptions (Name with AgThemeMode / AgGridClassName only).');
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
Name: theme.Name,
|
|
26
|
+
Description: theme.Description ?? resolveSystemThemeDescription(theme.Name),
|
|
27
|
+
AgThemeMode: theme.AgThemeMode,
|
|
28
|
+
AgGridClassName: theme.AgGridClassName,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const options = theme;
|
|
32
|
+
return {
|
|
33
|
+
Name: options.Name,
|
|
34
|
+
Description: resolveSystemThemeDescription(options.Name),
|
|
35
|
+
AgThemeMode: options.AgThemeMode,
|
|
36
|
+
AgGridClassName: options.AgGridClassName,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PercentBarStyle, StyledColumn } from '../../AdaptableState/StyledColumnState';
|
|
2
|
+
export declare const hasPercentBarRangesConfigured: (pb: PercentBarStyle | undefined) => boolean;
|
|
3
|
+
/** Illustrative scale for preview — shows negatives when origin is Auto or Zero. */
|
|
4
|
+
export declare const getPercentBarPreviewScale: (pb: PercentBarStyle) => {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const getPercentBarPreviewSampleValues: (pb: PercentBarStyle) => number[];
|
|
9
|
+
export type PercentBarPreviewGeometry = {
|
|
10
|
+
barLeftPercent: number;
|
|
11
|
+
barWidthPercent: number;
|
|
12
|
+
percentageValue: number;
|
|
13
|
+
barColor?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const getPercentBarPreviewGeometry: (numericValue: number, pb: PercentBarStyle, min: number, max: number) => PercentBarPreviewGeometry;
|
|
16
|
+
export declare const formatPercentBarPreviewCellText: (numericValue: number, percentageValue: number, pb: PercentBarStyle) => string;
|
|
17
|
+
export declare const getPercentBarPreviewTrackColor: (pb: PercentBarStyle) => string | undefined;
|
|
18
|
+
export declare const getPercentBarPreviewResolvedBarColor: (color: string | undefined) => string | undefined;
|
|
19
|
+
export declare const hasPercentBarStylePreview: (styledColumn: StyledColumn) => boolean;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { getVariableColor } from './StyleHelper';
|
|
2
|
+
import clamp from '../utils/clamp';
|
|
3
|
+
import { STYLED_COLUMN_PREVIEW_SAMPLE_COUNT, ZERO_CENTRED_PREVIEW_SCALE_MAX, ZERO_CENTRED_PREVIEW_SCALE_MIN, } from './StyledColumnGradientHelper';
|
|
4
|
+
const evenlySpacedValues = (min, max, count) => {
|
|
5
|
+
if (count <= 1) {
|
|
6
|
+
return [min];
|
|
7
|
+
}
|
|
8
|
+
const step = (max - min) / (count - 1);
|
|
9
|
+
return Array.from({ length: count }, (_, i) => min + step * i);
|
|
10
|
+
};
|
|
11
|
+
const toFraction = (value, min, max) => {
|
|
12
|
+
if (max === min) {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
return clamp((value - min) / (max - min), 0, 1);
|
|
16
|
+
};
|
|
17
|
+
const resolveOrigin = (percentBarStyle, cellValue, min, max) => {
|
|
18
|
+
const origin = percentBarStyle.Origin ?? 'Auto';
|
|
19
|
+
if (typeof origin === 'number') {
|
|
20
|
+
return origin;
|
|
21
|
+
}
|
|
22
|
+
if (origin === 'Zero') {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
if (origin === 'Min') {
|
|
26
|
+
return min;
|
|
27
|
+
}
|
|
28
|
+
if (min < 0 || max < 0 || cellValue < 0) {
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
return min;
|
|
32
|
+
};
|
|
33
|
+
const columnComparisonUsesCentredAxis = (origin) => {
|
|
34
|
+
const o = origin ?? 'Auto';
|
|
35
|
+
if (typeof o === 'number') {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return o === 'Zero' || o === 'Auto';
|
|
39
|
+
};
|
|
40
|
+
const resolveRangeEndpoint = (endpoint, scaleMin, scaleMax) => {
|
|
41
|
+
if (endpoint === 'Col-Min') {
|
|
42
|
+
return scaleMin;
|
|
43
|
+
}
|
|
44
|
+
if (endpoint === 'Col-Max') {
|
|
45
|
+
return scaleMax;
|
|
46
|
+
}
|
|
47
|
+
if (typeof endpoint === 'number') {
|
|
48
|
+
return endpoint;
|
|
49
|
+
}
|
|
50
|
+
return scaleMin;
|
|
51
|
+
};
|
|
52
|
+
const getPreviewBarColor = (value, pb, scaleMin, scaleMax) => {
|
|
53
|
+
if (pb.ColumnComparison) {
|
|
54
|
+
return pb.ColumnComparison.Color;
|
|
55
|
+
}
|
|
56
|
+
for (const range of pb.CellRanges ?? []) {
|
|
57
|
+
const rMin = resolveRangeEndpoint(range.Min, scaleMin, scaleMax);
|
|
58
|
+
const rMax = resolveRangeEndpoint(range.Max, scaleMin, scaleMax);
|
|
59
|
+
if (value >= Math.min(rMin, rMax) && value <= Math.max(rMin, rMax)) {
|
|
60
|
+
return range.Color;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return pb.CellRanges?.[0]?.Color;
|
|
64
|
+
};
|
|
65
|
+
export const hasPercentBarRangesConfigured = (pb) => !!(pb?.CellRanges?.length || pb?.ColumnComparison);
|
|
66
|
+
/** Illustrative scale for preview — shows negatives when origin is Auto or Zero. */
|
|
67
|
+
export const getPercentBarPreviewScale = (pb) => {
|
|
68
|
+
const origin = pb.Origin ?? 'Auto';
|
|
69
|
+
if (origin === 'Zero' || origin === 'Auto') {
|
|
70
|
+
return { min: ZERO_CENTRED_PREVIEW_SCALE_MIN, max: ZERO_CENTRED_PREVIEW_SCALE_MAX };
|
|
71
|
+
}
|
|
72
|
+
return { min: 0, max: 100 };
|
|
73
|
+
};
|
|
74
|
+
export const getPercentBarPreviewSampleValues = (pb) => {
|
|
75
|
+
const { min, max } = getPercentBarPreviewScale(pb);
|
|
76
|
+
return evenlySpacedValues(min, max, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
|
|
77
|
+
};
|
|
78
|
+
export const getPercentBarPreviewGeometry = (numericValue, pb, min, max) => {
|
|
79
|
+
let percentageValue = 0;
|
|
80
|
+
let barLeftPercent = 0;
|
|
81
|
+
let barWidthPercent = 0;
|
|
82
|
+
if (pb.ColumnComparison) {
|
|
83
|
+
const absMax = Math.abs(max);
|
|
84
|
+
percentageValue = absMax === 0 ? 0 : (numericValue / absMax) * 100;
|
|
85
|
+
const magnitude = Math.min(100, Math.abs(percentageValue));
|
|
86
|
+
const origin = pb.Origin ?? 'Auto';
|
|
87
|
+
const isCentred = columnComparisonUsesCentredAxis(origin);
|
|
88
|
+
if (isCentred) {
|
|
89
|
+
const halfWidth = magnitude / 2;
|
|
90
|
+
if (percentageValue >= 0) {
|
|
91
|
+
barLeftPercent = 50;
|
|
92
|
+
barWidthPercent = halfWidth;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
barLeftPercent = 50 - halfWidth;
|
|
96
|
+
barWidthPercent = halfWidth;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
barLeftPercent = 0;
|
|
101
|
+
barWidthPercent = magnitude;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else if (max === min) {
|
|
105
|
+
percentageValue = 0;
|
|
106
|
+
barLeftPercent = 0;
|
|
107
|
+
barWidthPercent = 0;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
percentageValue = ((clamp(numericValue, min, max) - min) / (max - min)) * 100;
|
|
111
|
+
const origin = resolveOrigin(pb, numericValue, min, max);
|
|
112
|
+
const valueFrac = toFraction(numericValue, min, max);
|
|
113
|
+
const originFrac = toFraction(origin, min, max);
|
|
114
|
+
const start = Math.min(valueFrac, originFrac);
|
|
115
|
+
const end = Math.max(valueFrac, originFrac);
|
|
116
|
+
barLeftPercent = start * 100;
|
|
117
|
+
barWidthPercent = (end - start) * 100;
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
barLeftPercent,
|
|
121
|
+
barWidthPercent,
|
|
122
|
+
percentageValue,
|
|
123
|
+
barColor: getPreviewBarColor(numericValue, pb, min, max),
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export const formatPercentBarPreviewCellText = (numericValue, percentageValue, pb) => {
|
|
127
|
+
const parts = [];
|
|
128
|
+
if (pb.CellText?.includes('CellValue')) {
|
|
129
|
+
parts.push(Number.isInteger(numericValue) ? String(numericValue) : numericValue.toFixed(1));
|
|
130
|
+
}
|
|
131
|
+
if (pb.CellText?.includes('PercentageValue')) {
|
|
132
|
+
parts.push(`${percentageValue.toFixed(0)}%`);
|
|
133
|
+
}
|
|
134
|
+
return parts.join(' ');
|
|
135
|
+
};
|
|
136
|
+
export const getPercentBarPreviewTrackColor = (pb) => {
|
|
137
|
+
if (pb.ColumnComparison) {
|
|
138
|
+
return pb.BackColor ?? undefined;
|
|
139
|
+
}
|
|
140
|
+
return pb.BackColor ?? undefined;
|
|
141
|
+
};
|
|
142
|
+
export const getPercentBarPreviewResolvedBarColor = (color) => color ? getVariableColor(color) : undefined;
|
|
143
|
+
export const hasPercentBarStylePreview = (styledColumn) => hasPercentBarRangesConfigured(styledColumn.PercentBarStyle);
|
|
@@ -16,7 +16,7 @@ import { PlusMinusNudge } from '../AdaptableState/PlusMinusState';
|
|
|
16
16
|
import { Shortcut } from '../AdaptableState/ShortcutState';
|
|
17
17
|
import { NotificationsOptions } from '../AdaptableOptions/NotificationsOptions';
|
|
18
18
|
import { CellSummmaryInfo } from '../AdaptableState/Common/CellSummary';
|
|
19
|
-
import {
|
|
19
|
+
import { ChartDefinition, ColumnFilter, CommentThread, CustomDisplayFormatterContext, FlashingCellDefinition, RowDataChangedInfo, SpecialColumnSettings, SystemFilterPredicateId } from '../types';
|
|
20
20
|
import { IRowNode } from 'ag-grid-enterprise';
|
|
21
21
|
import { AdaptableApi, AdaptableComment, BadgeStyleDefinition, CellAddress, NamedQuery, PivotLayout, TableLayout } from '../../types';
|
|
22
22
|
import { ToastOptions } from '../components/Toastify';
|
|
@@ -54,7 +54,6 @@ export declare function CreateEmptyStyledColumn(): StyledColumn;
|
|
|
54
54
|
export declare function CreateDefaultStyledColumnBadge(): BadgeStyleDefinition;
|
|
55
55
|
export declare function CreateEmptyChartDefinition(chartDefinition?: ChartDefinition): ChartDefinition;
|
|
56
56
|
export declare function CreateCustomDisplayFormatterContext(value: any, node: IRowNode, abColumn: AdaptableColumn, api: AdaptableApi): CustomDisplayFormatterContext;
|
|
57
|
-
export declare function CreateEmptyTheme(name?: string): AdaptableTheme;
|
|
58
57
|
export declare function CreateEmptyCommentThread(cellAddress: CellAddress): CommentThread;
|
|
59
58
|
export declare function CreateToastOptions(notificationsOptions: NotificationsOptions, { onClose, containerId }: {
|
|
60
59
|
onClose?: VoidFunction;
|
|
@@ -91,7 +90,6 @@ export declare const ObjectFactory: {
|
|
|
91
90
|
CreateEmptyStyledColumn: typeof CreateEmptyStyledColumn;
|
|
92
91
|
CreateDefaultStyledColumnBadge: typeof CreateDefaultStyledColumnBadge;
|
|
93
92
|
CreateEmptyChartDefinition: typeof CreateEmptyChartDefinition;
|
|
94
|
-
CreateEmptyTheme: typeof CreateEmptyTheme;
|
|
95
93
|
CreateEmptyCommentThread: typeof CreateEmptyCommentThread;
|
|
96
94
|
CreateAdaptableComment: typeof CreateAdaptableComment;
|
|
97
95
|
CreateDefaultSchedule: typeof CreateDefaultSchedule;
|
|
@@ -288,13 +288,6 @@ export function CreateCustomDisplayFormatterContext(value, node, abColumn, api)
|
|
|
288
288
|
...api.internalApi.buildBaseContext(),
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
-
export function CreateEmptyTheme(name) {
|
|
292
|
-
return {
|
|
293
|
-
Uuid: createUuid(),
|
|
294
|
-
Name: name || 'Custom Theme',
|
|
295
|
-
Description: name || 'Custom Theme',
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
291
|
export function CreateEmptyCommentThread(cellAddress) {
|
|
299
292
|
return {
|
|
300
293
|
...cellAddress,
|
|
@@ -389,7 +382,6 @@ export const ObjectFactory = {
|
|
|
389
382
|
CreateEmptyStyledColumn,
|
|
390
383
|
CreateDefaultStyledColumnBadge,
|
|
391
384
|
CreateEmptyChartDefinition,
|
|
392
|
-
CreateEmptyTheme,
|
|
393
385
|
CreateEmptyCommentThread,
|
|
394
386
|
CreateAdaptableComment,
|
|
395
387
|
CreateDefaultSchedule,
|
|
@@ -8,6 +8,7 @@ export declare class CalculatedColumnExpressionService implements ICalculatedCol
|
|
|
8
8
|
private adaptableApi;
|
|
9
9
|
private aggregatedScalarLiveValuesMap;
|
|
10
10
|
constructor(adaptableApi: AdaptableApi);
|
|
11
|
+
buildSyntheticCellDataChangedInfosForCalcColumns(cellDataChangedInfo: CellDataChangedInfo): CellDataChangedInfo[];
|
|
11
12
|
listentoCellDataChange(cellDataChangedInfo: CellDataChangedInfo): void;
|
|
12
13
|
listentoRowDataChange(rowDataChangedInfo: RowDataChangedInfo): void;
|
|
13
14
|
destroy(): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CalculatedColumnModuleId } from '../Constants/ModuleConstants';
|
|
2
2
|
import { AggregatedScalarLiveValue } from './AggregatedScalarLiveValue';
|
|
3
|
+
import { buildSyntheticCellDataChangedInfosForCalcColumns } from './CalculatedColumnSyntheticChange';
|
|
3
4
|
export class CalculatedColumnExpressionService {
|
|
4
5
|
adaptableApi;
|
|
5
6
|
aggregatedScalarLiveValuesMap = new Map();
|
|
@@ -7,7 +8,13 @@ export class CalculatedColumnExpressionService {
|
|
|
7
8
|
this.adaptableApi = adaptableApi;
|
|
8
9
|
this.adaptableApi = adaptableApi;
|
|
9
10
|
}
|
|
11
|
+
buildSyntheticCellDataChangedInfosForCalcColumns(cellDataChangedInfo) {
|
|
12
|
+
return buildSyntheticCellDataChangedInfosForCalcColumns(this.adaptableApi, cellDataChangedInfo);
|
|
13
|
+
}
|
|
10
14
|
listentoCellDataChange(cellDataChangedInfo) {
|
|
15
|
+
if (cellDataChangedInfo.trigger === 'calculatedColumnChange') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
11
18
|
const refreshedCalculatedColumns = [];
|
|
12
19
|
this.aggregatedScalarLiveValuesMap.forEach((aggregatedScalarLiveValue, calculatedColumnId) => {
|
|
13
20
|
const calculatedColumn = this.adaptableApi.calculatedColumnApi.getCalculatedColumnById(calculatedColumnId);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AdaptableApi } from '../../types';
|
|
2
|
+
import { CellDataChangedInfo } from '../../AdaptableState/Common/CellDataChangedInfo';
|
|
3
|
+
export declare function buildSyntheticCellDataChangedInfosForCalcColumns(adaptableApi: AdaptableApi, info: CellDataChangedInfo): CellDataChangedInfo[];
|
|
4
|
+
export declare function expandCellDataChangedInfosWithCalculatedColumns(adaptableApi: AdaptableApi, cellDataChangedInfos: CellDataChangedInfo[]): CellDataChangedInfo[];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as parser from '../../parser/src';
|
|
2
|
+
import { CalculatedColumnModuleId } from '../Constants/ModuleConstants';
|
|
3
|
+
import Helper from '../Helpers/Helper';
|
|
4
|
+
function isScalarCalculatedColumn(calculatedColumn) {
|
|
5
|
+
return !!calculatedColumn.Query?.ScalarExpression;
|
|
6
|
+
}
|
|
7
|
+
function collectDependentScalarCalculatedColumns(adaptableApi, rootColumnId) {
|
|
8
|
+
const collected = [];
|
|
9
|
+
const seenCalcColumnIds = new Set();
|
|
10
|
+
const queue = [rootColumnId];
|
|
11
|
+
while (queue.length > 0) {
|
|
12
|
+
const columnId = queue.shift();
|
|
13
|
+
const adaptableColumn = adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
14
|
+
if (!adaptableColumn) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const dependentColumnIds = adaptableApi.calculatedColumnApi.internalApi.getCalculatedColumnsDependentOnColumn(adaptableColumn);
|
|
18
|
+
dependentColumnIds.forEach((dependentColumnId) => {
|
|
19
|
+
if (seenCalcColumnIds.has(dependentColumnId)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const calculatedColumn = adaptableApi.calculatedColumnApi.getCalculatedColumnForColumnId(dependentColumnId);
|
|
23
|
+
if (!calculatedColumn || !isScalarCalculatedColumn(calculatedColumn)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
seenCalcColumnIds.add(dependentColumnId);
|
|
27
|
+
collected.push(calculatedColumn);
|
|
28
|
+
queue.push(dependentColumnId);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return collected;
|
|
32
|
+
}
|
|
33
|
+
function buildShadowRowData(adaptableApi, info) {
|
|
34
|
+
const shadowData = Helper.cloneObject(info.rowNode?.data ?? info.rowData ?? {});
|
|
35
|
+
const fieldName = info.column.field ?? info.column.columnId;
|
|
36
|
+
adaptableApi.internalApi.setValueUsingField(shadowData, fieldName, info.oldValue);
|
|
37
|
+
return shadowData;
|
|
38
|
+
}
|
|
39
|
+
function evaluateScalarExpressionWithShadowData(adaptableApi, calculatedColumn, rowNode, shadowData) {
|
|
40
|
+
const internalApi = adaptableApi.internalApi;
|
|
41
|
+
const moduleFns = internalApi
|
|
42
|
+
.getQueryLanguageService()
|
|
43
|
+
.getModuleExpressionFunctionsMap(CalculatedColumnModuleId);
|
|
44
|
+
const baseFunctions = { ...moduleFns.booleanFunctions, ...moduleFns.scalarFunctions };
|
|
45
|
+
const resolveColumnValue = (columnId) => {
|
|
46
|
+
const childCalculatedColumn = adaptableApi.calculatedColumnApi.getCalculatedColumnForColumnId(columnId);
|
|
47
|
+
if (childCalculatedColumn?.Query?.ScalarExpression) {
|
|
48
|
+
return evaluateScalarExpressionWithShadowData(adaptableApi, childCalculatedColumn, rowNode, shadowData);
|
|
49
|
+
}
|
|
50
|
+
const adaptableColumn = adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
51
|
+
return internalApi.getValueUsingField(shadowData, adaptableColumn?.field ?? columnId);
|
|
52
|
+
};
|
|
53
|
+
const customFunctions = {
|
|
54
|
+
...baseFunctions,
|
|
55
|
+
COL: {
|
|
56
|
+
...baseFunctions.COL,
|
|
57
|
+
handler: (args) => resolveColumnValue(args[0]),
|
|
58
|
+
},
|
|
59
|
+
FIELD: {
|
|
60
|
+
...baseFunctions.FIELD,
|
|
61
|
+
handler: (args) => internalApi.getValueUsingField(shadowData, args[0]),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
return parser.evaluate(calculatedColumn.Query.ScalarExpression, {
|
|
65
|
+
node: { ...rowNode, data: shadowData },
|
|
66
|
+
functions: customFunctions,
|
|
67
|
+
...internalApi.buildBaseContext(),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export function buildSyntheticCellDataChangedInfosForCalcColumns(adaptableApi, info) {
|
|
71
|
+
if (!info.rowNode ||
|
|
72
|
+
info.preventEdit ||
|
|
73
|
+
info.trigger === 'undo' ||
|
|
74
|
+
info.trigger === 'aggChange' ||
|
|
75
|
+
info.trigger === 'calculatedColumnChange') {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
const calculatedColumns = collectDependentScalarCalculatedColumns(adaptableApi, info.column.columnId);
|
|
79
|
+
if (!calculatedColumns.length) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
const shadowData = buildShadowRowData(adaptableApi, info);
|
|
83
|
+
const expressionService = adaptableApi.internalApi.getCalculatedColumnExpressionService();
|
|
84
|
+
const syntheticEvents = [];
|
|
85
|
+
calculatedColumns.forEach((calculatedColumn) => {
|
|
86
|
+
const oldValue = evaluateScalarExpressionWithShadowData(adaptableApi, calculatedColumn, info.rowNode, shadowData);
|
|
87
|
+
const newValue = expressionService.evaluateCalculatedColumnQuery(calculatedColumn, info.rowNode);
|
|
88
|
+
if (oldValue == newValue) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const column = adaptableApi.columnApi.getColumnWithColumnId(calculatedColumn.ColumnId);
|
|
92
|
+
if (!column) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
syntheticEvents.push(adaptableApi.internalApi.buildCellDataChangedInfo({
|
|
96
|
+
oldValue,
|
|
97
|
+
newValue,
|
|
98
|
+
column,
|
|
99
|
+
primaryKeyValue: info.primaryKeyValue,
|
|
100
|
+
rowNode: info.rowNode,
|
|
101
|
+
trigger: 'calculatedColumnChange',
|
|
102
|
+
}));
|
|
103
|
+
});
|
|
104
|
+
return syntheticEvents;
|
|
105
|
+
}
|
|
106
|
+
export function expandCellDataChangedInfosWithCalculatedColumns(adaptableApi, cellDataChangedInfos) {
|
|
107
|
+
if (!cellDataChangedInfos.length) {
|
|
108
|
+
return cellDataChangedInfos;
|
|
109
|
+
}
|
|
110
|
+
const syntheticEvents = cellDataChangedInfos.flatMap((info) => buildSyntheticCellDataChangedInfosForCalcColumns(adaptableApi, info));
|
|
111
|
+
if (!syntheticEvents.length) {
|
|
112
|
+
return cellDataChangedInfos;
|
|
113
|
+
}
|
|
114
|
+
return [...cellDataChangedInfos, ...syntheticEvents];
|
|
115
|
+
}
|
|
@@ -11,4 +11,5 @@ export interface ICalculatedColumnExpressionService extends IAdaptableService {
|
|
|
11
11
|
destroyAggregatedScalarLiveValue(calculatedColumn: CalculatedColumn): void;
|
|
12
12
|
listentoCellDataChange(cellDataChangedInfo: CellDataChangedInfo): void;
|
|
13
13
|
listentoRowDataChange(rowDataChangedInfo: RowDataChangedInfo): void;
|
|
14
|
+
buildSyntheticCellDataChangedInfosForCalcColumns(cellDataChangedInfo: CellDataChangedInfo): CellDataChangedInfo[];
|
|
14
15
|
}
|
|
@@ -20,7 +20,7 @@ export class ThemeService {
|
|
|
20
20
|
document.adoptedStyleSheets = [...document.adoptedStyleSheets].filter((sheet) => sheet !== this.styleSheetObject);
|
|
21
21
|
}
|
|
22
22
|
subscribe() {
|
|
23
|
-
const themeChangedUnsubscribe = this.api.eventApi.on('
|
|
23
|
+
const themeChangedUnsubscribe = this.api.eventApi.on('ThemeSelected', this.onThemeChanged);
|
|
24
24
|
const prefferedColorSchemeUnsubscribe = this.attachPrefferedColorSchemeListener();
|
|
25
25
|
this.unsubscribe = () => {
|
|
26
26
|
themeChangedUnsubscribe();
|