@adaptabletools/adaptable 23.0.0-canary.7 → 23.0.0-canary.9
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 +98 -17
- package/package.json +1 -1
- package/src/{Utilities → AdaptableState/Aggregations}/weightedAverage.js +1 -1
- package/src/AdaptableState/Common/Enums.d.ts +0 -12
- package/src/AdaptableState/Common/Enums.js +0 -15
- package/src/{Utilities → AdaptableState/Common}/MenuItem.d.ts +4 -4
- package/src/{Utilities → AdaptableState/Common}/MenuItem.js +1 -1
- package/src/AdaptableState/StyledColumnState.d.ts +8 -850
- package/src/AdaptableState/StyledColumnState.js +1 -9
- package/src/AdaptableState/StyledColumns/BadgeStyle.d.ts +143 -0
- package/src/AdaptableState/StyledColumns/BadgeStyle.js +9 -0
- package/src/AdaptableState/StyledColumns/BulletChartStyle.d.ts +147 -0
- package/src/AdaptableState/StyledColumns/BulletChartStyle.js +1 -0
- package/src/AdaptableState/StyledColumns/Common/BarStyleProperties.d.ts +84 -0
- package/src/AdaptableState/StyledColumns/Common/BarStyleProperties.js +5 -0
- package/src/AdaptableState/StyledColumns/Common/CellTextOptions.d.ts +13 -0
- package/src/AdaptableState/StyledColumns/Common/CellTextOptions.js +6 -0
- package/src/AdaptableState/StyledColumns/Common/NumericStyledColumn.d.ts +79 -0
- package/src/AdaptableState/StyledColumns/Common/NumericStyledColumn.js +9 -0
- package/src/AdaptableState/StyledColumns/GradientStyle.d.ts +48 -0
- package/src/AdaptableState/StyledColumns/GradientStyle.js +1 -0
- package/src/AdaptableState/StyledColumns/IconStyle.d.ts +158 -0
- package/src/AdaptableState/StyledColumns/IconStyle.js +1 -0
- package/src/AdaptableState/StyledColumns/PercentBarStyle.d.ts +32 -0
- package/src/AdaptableState/StyledColumns/PercentBarStyle.js +1 -0
- package/src/AdaptableState/StyledColumns/RangeBarStyle.d.ts +155 -0
- package/src/AdaptableState/StyledColumns/RangeBarStyle.js +1 -0
- package/src/AdaptableState/StyledColumns/RatingStyle.d.ts +111 -0
- package/src/AdaptableState/StyledColumns/RatingStyle.js +1 -0
- package/src/AdaptableState/StyledColumns/SparklineStyle.d.ts +21 -0
- package/src/AdaptableState/StyledColumns/SparklineStyle.js +1 -0
- package/src/Api/ColumnScopeApi.d.ts +1 -1
- package/src/Api/Implementation/AlertApiImpl.js +1 -1
- package/src/Api/Implementation/ChartingApiImpl.js +1 -1
- package/src/Api/Implementation/ColumnScopeApiImpl.d.ts +1 -1
- package/src/Api/Implementation/ExportApiImpl.js +1 -1
- package/src/Api/Implementation/LayoutHelpers.js +1 -1
- package/src/Api/Implementation/QuickSearchApiImpl.js +1 -1
- package/src/Api/Implementation/ThemeApiImpl.js +1 -1
- package/src/Api/Internal/ActionColumnInternalApi.js +1 -1
- package/src/Api/Internal/AlertInternalApi.js +1 -1
- package/src/Api/Internal/ChartingInternalApi.js +1 -1
- package/src/Api/Internal/ColumnInternalApi.js +1 -1
- package/src/Api/Internal/EventInternalApi.js +1 -1
- package/src/Api/Internal/ExportInternalApi.js +1 -1
- package/src/Api/Internal/FormatColumnInternalApi.js +1 -1
- package/src/Api/Internal/GridInternalApi.js +1 -1
- package/src/Api/Internal/StyledColumnInternalApi.d.ts +3 -1
- package/src/Api/Internal/StyledColumnInternalApi.js +1 -1
- package/src/Redux/ActionsReducers/ExportRedux.js +1 -1
- package/src/Redux/ActionsReducers/InternalRedux.js +1 -1
- package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +1 -1
- package/src/Redux/Store/AdaptableReduxMerger.js +2 -4
- package/src/Redux/Store/AdaptableStore.js +3 -3
- package/src/Strategy/AdaptableModuleBase.d.ts +1 -1
- package/src/Strategy/AdaptableModuleBase.js +1 -1
- package/src/Strategy/AlertModule.d.ts +1 -1
- package/src/Strategy/AlertModule.js +2 -2
- package/src/Strategy/BulkUpdateModule.d.ts +1 -1
- package/src/Strategy/CalculatedColumnModule.d.ts +2 -2
- package/src/Strategy/CellSummaryModule.d.ts +2 -2
- package/src/Strategy/ChartingModule.d.ts +1 -1
- package/src/Strategy/ChartingModule.js +1 -1
- package/src/Strategy/ColumnInfoModule.d.ts +2 -2
- package/src/Strategy/CommentModule.d.ts +1 -1
- package/src/Strategy/CustomSortModule.d.ts +1 -1
- package/src/Strategy/ExportModule.js +2 -2
- package/src/Strategy/FlashingCellModule.d.ts +1 -1
- package/src/Strategy/FreeTextColumnModule.d.ts +1 -1
- package/src/Strategy/GridInfoModule.d.ts +2 -2
- package/src/Strategy/LayoutModule.js +1 -1
- package/src/Strategy/NoteModule.d.ts +1 -1
- package/src/Strategy/PlusMinusModule.d.ts +1 -1
- package/src/Strategy/PlusMinusModule.js +1 -1
- package/src/Strategy/SettingsPanelModule.d.ts +2 -2
- package/src/Strategy/SmartEditModule.d.ts +1 -1
- package/src/Strategy/SystemStatusModule.d.ts +2 -2
- package/src/Strategy/TeamSharingModule.js +2 -2
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +1 -1
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +1 -1
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +1 -1
- package/src/Utilities/Extensions/ArrayExtensions.d.ts +32 -0
- package/src/Utilities/Extensions/ArrayExtensions.js +49 -0
- package/src/Utilities/Extensions/NumberExtensions.d.ts +21 -0
- package/src/Utilities/Extensions/NumberExtensions.js +74 -0
- package/src/Utilities/Extensions/ObjectExtensions.d.ts +44 -0
- package/src/Utilities/Extensions/ObjectExtensions.js +271 -0
- package/src/Utilities/Extensions/StringExtensions.d.ts +26 -0
- package/src/Utilities/Extensions/StringExtensions.js +44 -1
- package/src/Utilities/Helpers/AdaptableHelper.js +2 -2
- package/src/Utilities/Helpers/{alertFormHelper.js → AlertHelper.js} +1 -1
- package/src/Utilities/Helpers/DateHelper.js +1 -1
- package/src/Utilities/Helpers/{FormatHelper.js → DisplayFormatHelper.js} +1 -1
- package/src/Utilities/Helpers/Helper.d.ts +0 -6
- package/src/Utilities/Helpers/Helper.js +0 -35
- package/src/Utilities/Helpers/{QuickSearchStyleHelper.js → QuickSearchHelper.js} +1 -1
- package/src/Utilities/Helpers/{ScheduleHelper.d.ts → Scheduling/ScheduleHelper.d.ts} +1 -1
- package/src/Utilities/Helpers/{ScheduleHelper.js → Scheduling/ScheduleHelper.js} +1 -1
- package/src/Utilities/Helpers/{ScheduleJobManager.d.ts → Scheduling/ScheduleJobManager.d.ts} +1 -1
- package/src/Utilities/Helpers/{ScheduleJobRunner.d.ts → Scheduling/ScheduleJobRunner.d.ts} +1 -1
- package/src/Utilities/Helpers/{ScheduledAlertHelper.d.ts → Scheduling/ScheduledAlertHelper.d.ts} +1 -1
- package/src/Utilities/Helpers/{ScheduledAlertHelper.js → Scheduling/ScheduledAlertHelper.js} +4 -4
- package/src/Utilities/Helpers/{ScheduledJobsMiddlewareHelper.d.ts → Scheduling/ScheduledJobsMiddlewareHelper.d.ts} +1 -1
- package/src/Utilities/Helpers/{ScheduledJobsMiddlewareHelper.js → Scheduling/ScheduledJobsMiddlewareHelper.js} +1 -1
- package/src/Utilities/Helpers/{ScheduledReportHelper.d.ts → Scheduling/ScheduledReportHelper.d.ts} +1 -1
- package/src/Utilities/Helpers/{ScheduledReportHelper.js → Scheduling/ScheduledReportHelper.js} +1 -1
- package/src/Utilities/Helpers/SettingsPanelHelper.d.ts +5 -0
- package/src/Utilities/{Defaults/DefaultSettingsPanel.js → Helpers/SettingsPanelHelper.js} +14 -0
- package/src/Utilities/Helpers/StyledColumns/BarStylesHelper.d.ts +63 -0
- package/src/Utilities/Helpers/StyledColumns/BarStylesHelper.js +317 -0
- package/src/Utilities/Helpers/{StyledColumnGradientHelper.d.ts → StyledColumns/GradientStyleHelper.d.ts} +4 -2
- package/src/Utilities/Helpers/{StyledColumnGradientHelper.js → StyledColumns/GradientStyleHelper.js} +3 -3
- package/src/Utilities/Helpers/{IconStylePresets.d.ts → StyledColumns/IconStyleHelper.d.ts} +6 -1
- package/src/Utilities/Helpers/{IconStylePresets.js → StyledColumns/IconStyleHelper.js} +15 -0
- package/src/Utilities/Helpers/{percentBarPreviewHelper.d.ts → StyledColumns/PercentBarStyleHelper.d.ts} +2 -1
- package/src/Utilities/Helpers/{percentBarPreviewHelper.js → StyledColumns/PercentBarStyleHelper.js} +7 -12
- package/src/Utilities/Helpers/{SparklineOptionsHelper.js → StyledColumns/SparklineStyleHelper.js} +1 -1
- package/src/Utilities/Helpers/StyledColumns/StyledColumnHelper.d.ts +52 -0
- package/src/{agGrid/cellRenderers/shouldRenderStyledColumnOnRow.js → Utilities/Helpers/StyledColumns/StyledColumnHelper.js} +64 -2
- package/src/Utilities/Helpers/TimingHelper.d.ts +34 -0
- package/src/Utilities/{utils/debounce.js → Helpers/TimingHelper.js} +23 -9
- package/src/Utilities/ObjectFactory.js +1 -1
- package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +2 -0
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +114 -1
- package/src/Utilities/Services/LicenseService/index.js +1 -1
- package/src/Utilities/Services/RowSummaryService.d.ts +1 -1
- package/src/Utilities/Services/RowSummaryService.js +4 -4
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +1 -1
- package/src/View/Alert/Utilities/getAlertType.js +1 -1
- package/src/View/Alert/Utilities/getDefaultAlertDefinition.js +1 -1
- package/src/View/Alert/Utilities/mapAlertDefinition.js +1 -1
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +160 -127
- package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +3 -3
- package/src/View/Alert/Wizard/AlertRulesWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertScheduledWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertWizard.js +10 -2
- package/src/View/Alert/Wizard/isValidAlertRules.js +1 -1
- package/src/View/Charting/ChartingWizard/AgChargingWizard/PreviewChartSection.js +1 -1
- package/src/View/Charting/ChartingWizard/AgChargingWizard/SettingsSection.js +1 -1
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +1 -1
- package/src/View/Comments/CommentsEditor.js +1 -1
- package/src/View/Comments/CommentsPopup.js +1 -1
- package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +3 -2
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +3 -2
- package/src/View/Components/AdaptableObjectList/objectListActionButtonStyles.d.ts +2 -0
- package/src/View/Components/AdaptableObjectList/objectListActionButtonStyles.js +2 -0
- package/src/View/Components/Buttons/EntityListActionButtons.js +1 -1
- package/src/View/Components/Buttons/SuspendToggleButton/SuspendToggleButton.d.ts +1 -0
- package/src/View/Components/Buttons/SuspendToggleButton/SuspendToggleButton.js +8 -8
- package/src/View/Components/ColumnFilter/ColumnFilter.js +14 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInput.js +1 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInputList.js +1 -1
- package/src/View/Components/ColumnFilter/components/FloatingFilterInputList.js +1 -1
- package/src/View/Components/Forms/AdaptableFormControlTextClear.js +2 -1
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +1 -1
- package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +1 -1
- package/src/View/Components/Popups/AdaptablePopupAlert.js +1 -1
- package/src/View/Components/Popups/Utilities.js +1 -1
- package/src/View/Components/RangesComponent.d.ts +4 -3
- package/src/View/Components/RangesComponent.js +3 -7
- package/src/View/Components/ToolPanel/AdaptableToolPanel.js +1 -1
- package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
- package/src/View/Dashboard/CustomDashboardButton.js +1 -1
- package/src/View/Dashboard/Dashboard.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryTable.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.js +1 -1
- package/src/View/DataImport/DataImportWizard/sections/DataPreview.js +1 -1
- package/src/View/Export/ExportSchedulesTab.js +3 -4
- package/src/View/Filter/FilterViewPanel.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +3 -3
- package/src/View/FormatColumn/Wizard/FormatColumnPreview.js +1 -1
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +1 -1
- package/src/View/Layout/LayoutViewPanel.js +1 -1
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +129 -103
- package/src/View/Note/NoteEditor.js +1 -1
- package/src/View/Note/NotePopup.js +1 -1
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +1 -1
- package/src/View/QuickSearch/QuickSearchPopup.js +1 -1
- package/src/View/QuickSearch/useQuickSearchDebounced.js +1 -1
- package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +1 -1
- package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +36 -30
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +1 -3
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +79 -68
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +39 -12
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +92 -52
- package/src/View/StyledColumn/Wizard/StyledColumnWizardScopeSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarStyleCellTextLayoutEditor.d.ts +9 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarStyleCellTextLayoutEditor.js +33 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarStyleCellTextPreview.d.ts +23 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BarStyleCellTextPreview.js +57 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.d.ts +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/GradientSummaryPreview.d.ts +3 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/GradientSummaryPreview.js +2 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.d.ts +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.js +3 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.d.ts +2 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.js +13 -17
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnChartListPreviews.d.ts +2 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnChartListPreviews.js +5 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.js +16 -7
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.js +11 -17
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.d.ts +2 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +20 -60
- package/src/View/UIHelper.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +1 -1
- package/src/View/Wizard/OnePageWizards.js +3 -1
- package/src/agGrid/AdaptableAgGrid.js +6 -6
- package/src/agGrid/AgGridColumnAdapter.js +16 -14
- package/src/agGrid/AgGridExportAdapter.js +1 -1
- package/src/agGrid/AgGridMenuAdapter.js +127 -2
- package/src/agGrid/cellRenderers/BadgeRenderer.js +8 -6
- package/src/agGrid/cellRenderers/BulletChartRenderer.js +45 -44
- package/src/agGrid/cellRenderers/IconRenderer.d.ts +2 -1
- package/src/agGrid/cellRenderers/IconRenderer.js +15 -14
- package/src/agGrid/cellRenderers/PercentBarRenderer.js +26 -98
- package/src/agGrid/cellRenderers/RangeBarRenderer.js +52 -50
- package/src/agGrid/cellRenderers/RatingRenderer.js +2 -2
- package/src/agGrid/editors/AdaptableDateEditor/index.js +1 -1
- package/src/components/ColorPicker/ColorPicker.js +1 -1
- package/src/components/Datepicker/index.js +1 -1
- package/src/components/FormLayout/index.js +1 -1
- package/src/components/OverlayTrigger/index.js +1 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/isLayoutEqual.js +1 -1
- package/src/metamodel/adaptable.metamodel.d.ts +118 -19
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/migration/VersionUpgrade23.d.ts +27 -31
- package/src/migration/VersionUpgrade23.js +110 -29
- package/src/types.d.ts +12 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/Utilities/Defaults/DefaultSettingsPanel.d.ts +0 -3
- package/src/Utilities/Helpers/iconStyledColumnColumnSupport.d.ts +0 -5
- package/src/Utilities/Helpers/iconStyledColumnColumnSupport.js +0 -15
- package/src/Utilities/Helpers/resolveSettingsPanelNavigation.d.ts +0 -3
- package/src/Utilities/Helpers/resolveSettingsPanelNavigation.js +0 -15
- package/src/Utilities/Helpers/styledColumnRowKindSupport.d.ts +0 -25
- package/src/Utilities/Helpers/styledColumnRowKindSupport.js +0 -63
- package/src/Utilities/Services/CalculatedColumnSyntheticChange.d.ts +0 -4
- package/src/Utilities/Services/CalculatedColumnSyntheticChange.js +0 -115
- package/src/Utilities/utils/chunk.d.ts +0 -6
- package/src/Utilities/utils/chunk.js +0 -17
- package/src/Utilities/utils/clamp.d.ts +0 -5
- package/src/Utilities/utils/clamp.js +0 -7
- package/src/Utilities/utils/cloneDeepWith.d.ts +0 -9
- package/src/Utilities/utils/cloneDeepWith.js +0 -67
- package/src/Utilities/utils/debounce.d.ts +0 -20
- package/src/Utilities/utils/flatten.d.ts +0 -5
- package/src/Utilities/utils/flatten.js +0 -7
- package/src/Utilities/utils/flattenDeep.d.ts +0 -5
- package/src/Utilities/utils/flattenDeep.js +0 -7
- package/src/Utilities/utils/get.d.ts +0 -6
- package/src/Utilities/utils/get.js +0 -35
- package/src/Utilities/utils/index.d.ts +0 -22
- package/src/Utilities/utils/index.js +0 -22
- package/src/Utilities/utils/isArray.d.ts +0 -6
- package/src/Utilities/utils/isArray.js +0 -6
- package/src/Utilities/utils/isEqual.d.ts +0 -5
- package/src/Utilities/utils/isEqual.js +0 -124
- package/src/Utilities/utils/isObject.d.ts +0 -6
- package/src/Utilities/utils/isObject.js +0 -9
- package/src/Utilities/utils/isPlainObject.d.ts +0 -6
- package/src/Utilities/utils/isPlainObject.js +0 -17
- package/src/Utilities/utils/kebabCase.d.ts +0 -5
- package/src/Utilities/utils/kebabCase.js +0 -8
- package/src/Utilities/utils/merge.d.ts +0 -11
- package/src/Utilities/utils/merge.js +0 -40
- package/src/Utilities/utils/mergeWith.d.ts +0 -7
- package/src/Utilities/utils/mergeWith.js +0 -46
- package/src/Utilities/utils/orderBy.d.ts +0 -8
- package/src/Utilities/utils/orderBy.js +0 -30
- package/src/Utilities/utils/parseInt.d.ts +0 -6
- package/src/Utilities/utils/parseInt.js +0 -9
- package/src/Utilities/utils/sentenceCase.d.ts +0 -6
- package/src/Utilities/utils/sentenceCase.js +0 -15
- package/src/Utilities/utils/startCase.d.ts +0 -5
- package/src/Utilities/utils/startCase.js +0 -11
- package/src/Utilities/utils/throttle.d.ts +0 -17
- package/src/Utilities/utils/throttle.js +0 -19
- package/src/Utilities/utils/toNumber.d.ts +0 -5
- package/src/Utilities/utils/toNumber.js +0 -39
- package/src/Utilities/utils/uniq.d.ts +0 -7
- package/src/Utilities/utils/uniq.js +0 -9
- package/src/Utilities/utils/uniqBy.d.ts +0 -8
- package/src/Utilities/utils/uniqBy.js +0 -22
- package/src/Utilities/utils/words.d.ts +0 -7
- package/src/Utilities/utils/words.js +0 -10
- package/src/agGrid/buildValueAggregationMenuItem.d.ts +0 -19
- package/src/agGrid/buildValueAggregationMenuItem.js +0 -111
- package/src/agGrid/cellRenderers/shouldRenderStyledColumnOnRow.d.ts +0 -30
- package/src/agGrid/createAgGridIcon.d.ts +0 -10
- package/src/agGrid/createAgGridIcon.js +0 -16
- /package/src/{Utilities → AdaptableState/Aggregations}/only.d.ts +0 -0
- /package/src/{Utilities → AdaptableState/Aggregations}/only.js +0 -0
- /package/src/{Utilities → AdaptableState/Aggregations}/weightedAverage.d.ts +0 -0
- /package/src/Utilities/Helpers/{ActionColumnWidthHelper.d.ts → ActionColumnHelper.d.ts} +0 -0
- /package/src/Utilities/Helpers/{ActionColumnWidthHelper.js → ActionColumnHelper.js} +0 -0
- /package/src/Utilities/Helpers/{alertFormHelper.d.ts → AlertHelper.d.ts} +0 -0
- /package/src/Utilities/Helpers/{chartingHelper.d.ts → ChartHelper.d.ts} +0 -0
- /package/src/Utilities/Helpers/{chartingHelper.js → ChartHelper.js} +0 -0
- /package/src/Utilities/Helpers/{FormatHelper.d.ts → DisplayFormatHelper.d.ts} +0 -0
- /package/src/Utilities/Helpers/{plusMinusTriggerKeys.d.ts → PlusMinusHelper.d.ts} +0 -0
- /package/src/Utilities/Helpers/{plusMinusTriggerKeys.js → PlusMinusHelper.js} +0 -0
- /package/src/Utilities/Helpers/{QuickSearchStyleHelper.d.ts → QuickSearchHelper.d.ts} +0 -0
- /package/src/Utilities/Helpers/{ScheduleJobManager.js → Scheduling/ScheduleJobManager.js} +0 -0
- /package/src/Utilities/Helpers/{ScheduleJobRunner.js → Scheduling/ScheduleJobRunner.js} +0 -0
- /package/src/Utilities/Helpers/{SparklineOptionsHelper.d.ts → StyledColumns/SparklineStyleHelper.d.ts} +0 -0
- /package/src/Utilities/Helpers/{ThemeHelpers.d.ts → ThemeHelper.d.ts} +0 -0
- /package/src/Utilities/Helpers/{ThemeHelpers.js → ThemeHelper.js} +0 -0
|
@@ -3,7 +3,7 @@ import { Box, Flex } from '../../../../../components/Flex';
|
|
|
3
3
|
import { Card } from '../../../../../components/Card';
|
|
4
4
|
import { Tag } from '../../../../../components/Tag';
|
|
5
5
|
import { useAdaptable } from '../../../../AdaptableContext';
|
|
6
|
-
import { getGradientPreviewCellStyle, getGradientPreviewSampleValues, hasGradientRangesConfigured, } from '../../../../../Utilities/Helpers/
|
|
6
|
+
import { getGradientPreviewCellStyle, getGradientPreviewSampleValues, hasGradientRangesConfigured, } from '../../../../../Utilities/Helpers/StyledColumns/GradientStyleHelper';
|
|
7
7
|
const formatPreviewValue = (value) => {
|
|
8
8
|
if (Number.isInteger(value)) {
|
|
9
9
|
return value.toLocaleString();
|
|
@@ -36,7 +36,7 @@ const renderIconSpecForPreview = (spec, size) => {
|
|
|
36
36
|
return null;
|
|
37
37
|
};
|
|
38
38
|
const buildPreviewText = (mapping, iconStyle) => {
|
|
39
|
-
const cellTextTokens = iconStyle.CellText ?? [];
|
|
39
|
+
const cellTextTokens = iconStyle.CellTextProperties?.CellText ?? [];
|
|
40
40
|
const formatted = String(mapping.Key);
|
|
41
41
|
const textParts = [];
|
|
42
42
|
if (cellTextTokens.includes('CellValue') && formatted) {
|
|
@@ -50,7 +50,7 @@ const buildPreviewText = (mapping, iconStyle) => {
|
|
|
50
50
|
const IconCellPreviewTree = ({ iconStyle, mapping }) => {
|
|
51
51
|
const size = iconStyle.Size ?? DEFAULT_ICON_STYLE_SIZE;
|
|
52
52
|
const gap = iconStyle.Gap ?? DEFAULT_ICON_STYLE_GAP;
|
|
53
|
-
const textPosition = iconStyle.CellTextPosition ?? 'After';
|
|
53
|
+
const textPosition = iconStyle.CellTextProperties?.CellTextPosition ?? 'After';
|
|
54
54
|
const text = buildPreviewText(mapping, iconStyle);
|
|
55
55
|
const fontStyle = iconStyle.Font ? convertAdaptableStyleToCSS(iconStyle.Font) : undefined;
|
|
56
56
|
const iconNode = renderIconSpecForPreview(mapping.Icon, size);
|
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { convertAdaptableStyleToCSS } from '../../../../../Utilities/Helpers/StyleHelper';
|
|
3
|
-
import {
|
|
3
|
+
import { getPercentBarPreviewGeometry, getPercentBarPreviewResolvedBarColor, getPercentBarPreviewSampleValues, getPercentBarPreviewScale, getPercentBarPreviewTrackColor, hasPercentBarRangesConfigured, } from '../../../../../Utilities/Helpers/StyledColumns/PercentBarStyleHelper';
|
|
4
|
+
import { buildBarStyleCellTextLabels, getBarStyleCellTextSlotPresence, hasBarStyleCellTextConfigured, } from '../../../../../Utilities/Helpers/StyledColumns/BarStylesHelper';
|
|
4
5
|
import { Box, Flex } from '../../../../../components/Flex';
|
|
5
6
|
import { Card } from '../../../../../components/Card';
|
|
6
7
|
import { Tag } from '../../../../../components/Tag';
|
|
8
|
+
import { BarStyleCellTextPreview, shouldShowBarStyleCellTextOutsideBar, } from './BarStyleCellTextPreview';
|
|
7
9
|
const PREVIEW_CELL_CLASS = 'ab-PercentBarPreviewCell twa:w-[72px] twa:min-h-[32px] twa:px-1 twa:py-1 twa:rounded-standard twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_15%,transparent)]';
|
|
8
10
|
const PercentBarPreviewCell = ({ styledColumn, value, min, max }) => {
|
|
9
11
|
const pb = styledColumn.PercentBarStyle;
|
|
10
12
|
const { barLeftPercent, barWidthPercent, percentageValue, barColor } = getPercentBarPreviewGeometry(value, pb, min, max);
|
|
11
13
|
const trackColor = getPercentBarPreviewTrackColor(pb);
|
|
12
14
|
const fillColor = getPercentBarPreviewResolvedBarColor(barColor);
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
15
|
+
const cellTextProperties = pb.CellTextProperties;
|
|
16
|
+
const labels = buildBarStyleCellTextLabels(cellTextProperties, Number.isInteger(value) ? String(value) : value.toFixed(1), `${percentageValue.toFixed(0)}%`);
|
|
17
|
+
const hasCellText = hasBarStyleCellTextConfigured(cellTextProperties) &&
|
|
18
|
+
Boolean(labels.cellValue || labels.percentage);
|
|
19
|
+
const presence = getBarStyleCellTextSlotPresence(cellTextProperties);
|
|
16
20
|
const fontStyle = pb.Font ? convertAdaptableStyleToCSS(pb.Font) : undefined;
|
|
17
|
-
const
|
|
21
|
+
const cellTextClassName = 'ab-PercentBar__text twa:text-2 twa:leading-tight twa:truncate';
|
|
18
22
|
const barEl = (_jsxs(Box, { className: "ab-PercentBar__bar twa:relative twa:flex-1 twa:min-h-[6px]", style: trackColor ? { background: getPercentBarPreviewResolvedBarColor(trackColor) } : undefined, children: [fillColor && (_jsx(Box, { className: "ab-PercentBar__barInside twa:absolute twa:top-0 twa:h-full", style: {
|
|
19
23
|
background: fillColor,
|
|
20
24
|
left: `${barLeftPercent.toFixed(2)}%`,
|
|
21
25
|
width: `${barWidthPercent.toFixed(2)}%`,
|
|
22
|
-
} })), hasCellText &&
|
|
23
|
-
return (_jsxs(Flex, { className: `ab-PercentBar__wrapper ${PREVIEW_CELL_CLASS}`, flexDirection: "column", style: {
|
|
26
|
+
} })), hasCellText && presence.hasMerged && (_jsx(BarStyleCellTextPreview, { mergedOverlayClassName: "ab-PercentBar__text twa:absolute twa:inset-x-0 twa:top-1/2 twa:-translate-y-1/2 twa:px-1 twa:text-2 twa:truncate", style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Merged" }))] }));
|
|
27
|
+
return (_jsxs(Flex, { className: `ab-PercentBar__wrapper ${PREVIEW_CELL_CLASS}`, flexDirection: "column", style: {
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
height: shouldShowBarStyleCellTextOutsideBar(cellTextProperties, hasCellText)
|
|
30
|
+
? '100%'
|
|
31
|
+
: undefined,
|
|
32
|
+
}, children: [hasCellText && presence.hasAbove && (_jsx(BarStyleCellTextPreview, { className: cellTextClassName, style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Above" })), barEl, hasCellText && presence.hasBelow && (_jsx(BarStyleCellTextPreview, { className: cellTextClassName, style: fontStyle, cellTextProperties: cellTextProperties, labels: labels, vertical: "Below" }))] }));
|
|
24
33
|
};
|
|
25
34
|
export const StyledColumnPercentBarPreview = ({ data }) => {
|
|
26
35
|
const pb = data.PercentBarStyle;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { buildBarStyleCellTextLabels, getBarStyleCellTextSlotPresence, hasBarStyleCellTextConfigured, } from '../../../../../Utilities/Helpers/StyledColumns/BarStylesHelper';
|
|
2
3
|
import { Box, Flex } from '../../../../../components/Flex';
|
|
3
4
|
import { Card } from '../../../../../components/Card';
|
|
4
5
|
import { Tag } from '../../../../../components/Tag';
|
|
5
6
|
import { StyledColumnRangeBarListPreview } from './StyledColumnChartListPreviews';
|
|
7
|
+
import { BarStyleCellTextPreview } from './BarStyleCellTextPreview';
|
|
6
8
|
const PREVIEW_CELL_CLASS = 'ab-RangeBarPreviewCell twa:inline-flex twa:items-center twa:min-w-[180px] twa:min-h-[36px] twa:px-2 twa:py-1 twa:rounded-standard twa:border twa:border-[color-mix(in_srgb,var(--ab-color-foreground)_15%,transparent)]';
|
|
7
9
|
const getRangeBarPreviewSample = (range) => {
|
|
8
10
|
let min = 0;
|
|
@@ -20,28 +22,20 @@ const getRangeBarPreviewSample = (range) => {
|
|
|
20
22
|
valueFraction: Math.max(0, Math.min(1, valueFraction)),
|
|
21
23
|
};
|
|
22
24
|
};
|
|
23
|
-
const formatRangeBarPreviewCellText = (sampleValue, valueFraction, range) => {
|
|
24
|
-
const parts = [];
|
|
25
|
-
if (range.CellText?.includes('CellValue')) {
|
|
26
|
-
parts.push(Number.isInteger(sampleValue) ? String(sampleValue) : sampleValue.toFixed(1));
|
|
27
|
-
}
|
|
28
|
-
if (range.CellText?.includes('PercentageValue')) {
|
|
29
|
-
parts.push(`${(valueFraction * 100).toFixed(0)}%`);
|
|
30
|
-
}
|
|
31
|
-
return parts.join(' ');
|
|
32
|
-
};
|
|
33
25
|
const RangeBarPreviewContent = ({ range }) => {
|
|
34
26
|
const { sampleValue, valueFraction } = getRangeBarPreviewSample(range);
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
27
|
+
const cellTextProperties = range.CellTextProperties;
|
|
28
|
+
const labels = buildBarStyleCellTextLabels(cellTextProperties, Number.isInteger(sampleValue) ? String(sampleValue) : sampleValue.toFixed(1), `${(valueFraction * 100).toFixed(0)}%`);
|
|
29
|
+
const hasCellText = hasBarStyleCellTextConfigured(cellTextProperties) &&
|
|
30
|
+
Boolean(labels.cellValue || labels.percentage);
|
|
31
|
+
const presence = getBarStyleCellTextSlotPresence(cellTextProperties);
|
|
38
32
|
const isVertical = range.Orientation === 'Vertical';
|
|
33
|
+
const cellTextClassName = 'ab-RangeBar__text twa:text-2 twa:leading-tight twa:truncate twa:max-w-full';
|
|
39
34
|
const chartEl = _jsx(StyledColumnRangeBarListPreview, { range: range });
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return (_jsxs(Box, { className: "ab-RangeBar__wrapper twa:relative twa:inline-flex", children: [chartEl, _jsx(Box, { className: "ab-RangeBar__text twa:absolute twa:inset-x-0 twa:top-1/2 twa:-translate-y-1/2 twa:px-1 twa:text-2 twa:truncate twa:pointer-events-none", children: cellText })] }));
|
|
35
|
+
if (hasCellText && presence.hasMerged && !presence.hasAbove && !presence.hasBelow) {
|
|
36
|
+
return (_jsxs(Box, { className: "ab-RangeBar__wrapper twa:relative twa:inline-flex", children: [chartEl, _jsx(BarStyleCellTextPreview, { mergedOverlayClassName: "ab-RangeBar__text twa:absolute twa:inset-x-0 twa:top-1/2 twa:-translate-y-1/2 twa:px-1 twa:text-2 twa:truncate twa:pointer-events-none", cellTextProperties: cellTextProperties, labels: labels, vertical: "Merged" })] }));
|
|
43
37
|
}
|
|
44
|
-
return (_jsxs(Flex, { className: "ab-RangeBar__wrapper", flexDirection: "column", alignItems: isVertical ? 'center' : 'stretch', style: { justifyContent: 'center', gap: hasCellText ? 2 : 0 }, children: [hasCellText &&
|
|
38
|
+
return (_jsxs(Flex, { className: "ab-RangeBar__wrapper twa:relative", flexDirection: "column", alignItems: isVertical ? 'center' : 'stretch', style: { justifyContent: 'center', gap: hasCellText ? 2 : 0 }, children: [hasCellText && presence.hasAbove && (_jsx(BarStyleCellTextPreview, { className: cellTextClassName, cellTextProperties: cellTextProperties, labels: labels, vertical: "Above" })), _jsxs(Box, { className: "twa:relative twa:w-full", style: { display: 'inline-flex' }, children: [chartEl, hasCellText && presence.hasMerged && (_jsx(BarStyleCellTextPreview, { mergedOverlayClassName: "ab-RangeBar__text twa:absolute twa:inset-x-0 twa:top-1/2 twa:-translate-y-1/2 twa:px-1 twa:text-2 twa:truncate twa:pointer-events-none", cellTextProperties: cellTextProperties, labels: labels, vertical: "Merged" }))] }), hasCellText && presence.hasBelow && (_jsx(BarStyleCellTextPreview, { className: cellTextClassName, cellTextProperties: cellTextProperties, labels: labels, vertical: "Below" }))] }));
|
|
45
39
|
};
|
|
46
40
|
export const StyledColumnRangeBarPreview = ({ data }) => {
|
|
47
41
|
const range = data.RangeBarStyle;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { CellBoxStyle } from '../../../../../AdaptableState/Common/AdaptableStyle';
|
|
3
|
-
import {
|
|
3
|
+
import { StyledColumn } from '../../../../../AdaptableState/StyledColumnState';
|
|
4
|
+
import { RatingIconShape, RatingStyle } from '../../../../../AdaptableState/StyledColumns/RatingStyle';
|
|
4
5
|
export declare const DEFAULT_RATING_MAX = 5;
|
|
5
6
|
export declare const DEFAULT_RATING_SIZE = 14;
|
|
6
7
|
export declare const DEFAULT_RATING_GAP = 2;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { AgChartsEnterpriseModule } from 'ag-charts-enterprise';
|
|
4
4
|
import { AdaptableHelper } from '../../../../../Utilities/Helpers/AdaptableHelper';
|
|
5
|
-
import { resolveSparklineOptionsForRender } from '../../../../../Utilities/Helpers/
|
|
5
|
+
import { resolveSparklineOptionsForRender } from '../../../../../Utilities/Helpers/StyledColumns/SparklineStyleHelper';
|
|
6
6
|
import { convertAdaptableStyleToCSS, hasCellBoxStyle, } from '../../../../../Utilities/Helpers/StyleHelper';
|
|
7
7
|
import { Box } from '../../../../../components/Flex';
|
|
8
8
|
import { Card } from '../../../../../components/Card';
|
|
@@ -3,13 +3,13 @@ import { CheckBox } from '../../../../components/CheckBox';
|
|
|
3
3
|
import ErrorBox from '../../../../components/ErrorBox';
|
|
4
4
|
import FormLayout, { FormRow } from '../../../../components/FormLayout';
|
|
5
5
|
import { Tag } from '../../../../components/Tag';
|
|
6
|
+
import { formatBarStyleCellTextLayoutSummary, getActiveBarStyleCellTextTokens, hasBarStyleCellTextConfigured, patchBarStyleCellTextPlacement, resolveBarStyleCellTextLayout, toggleBarStyleCellTextToken, } from '../../../../Utilities/Helpers/StyledColumns/BarStylesHelper';
|
|
7
|
+
import { BarStyleCellTextLayoutEditor } from './Components/BarStyleCellTextLayoutEditor';
|
|
6
8
|
import { OptionalColorPicker } from '../../../../components/ColorPicker';
|
|
7
9
|
import { getGraySwatchColor } from '../../../UIHelper';
|
|
8
10
|
import { useOnePageAdaptableWizardContext } from '../../../Wizard/OnePageAdaptableWizard';
|
|
9
|
-
import ArrayExtensions from '../../../../Utilities/Extensions/ArrayExtensions';
|
|
10
11
|
import { Box, Flex } from '../../../../components/Flex';
|
|
11
12
|
import Radio, { RadioGroup } from '../../../../components/Radio';
|
|
12
|
-
import { Toggle, ToggleGroup } from '../../../../components/Toggle';
|
|
13
13
|
import { getCellFontStyleSummaryItems, StyledColumnFontStyleEditor, } from '../StyledColumnSliceStyleEditors';
|
|
14
14
|
import { Card } from '../../../../components/Card';
|
|
15
15
|
import { renderSummaryStringTags } from '../../../Wizard/SummaryColorTag';
|
|
@@ -28,19 +28,16 @@ const formatOriginLabel = (origin) => {
|
|
|
28
28
|
}
|
|
29
29
|
return origin;
|
|
30
30
|
};
|
|
31
|
-
const formatPercentBarCellTextSummary = (cellText) => cellText
|
|
32
|
-
|
|
33
|
-
.join(' + ') ?? '';
|
|
34
|
-
const formatPercentBarToolTipSummary = (toolTipText) => toolTipText
|
|
35
|
-
?.map((t) => (t === 'CellValue' ? 'Cell Value' : 'Percent Value'))
|
|
36
|
-
.join(' + ') ?? '';
|
|
31
|
+
const formatPercentBarCellTextSummary = (cellText) => cellText?.map((t) => (t === 'CellValue' ? 'Cell Value' : 'Percent Value')).join(' + ') ?? '';
|
|
32
|
+
const formatPercentBarToolTipSummary = (toolTipText) => toolTipText?.map((t) => (t === 'CellValue' ? 'Cell Value' : 'Percent Value')).join(' + ') ?? '';
|
|
37
33
|
const buildStyledColumnPercentBarStyleSummaryStrings = (pb, options) => {
|
|
38
34
|
const items = [`Origin: ${formatOriginLabel(pb.Origin)}`];
|
|
39
|
-
if (pb.
|
|
40
|
-
|
|
41
|
-
items.push(`Cell Text
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
if (hasBarStyleCellTextConfigured(pb.CellTextProperties)) {
|
|
36
|
+
const tokens = getActiveBarStyleCellTextTokens(pb.CellTextProperties);
|
|
37
|
+
items.push(`Cell Text: ${formatPercentBarCellTextSummary(tokens)}`);
|
|
38
|
+
const layoutSummary = formatBarStyleCellTextLayoutSummary(resolveBarStyleCellTextLayout(pb.CellTextProperties));
|
|
39
|
+
if (layoutSummary) {
|
|
40
|
+
items.push(`Placement: ${layoutSummary}`);
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
43
|
else if (options.includeEmptyCellText) {
|
|
@@ -92,11 +89,6 @@ export const renderFormatColumnStyleWizardSummary = (data) => {
|
|
|
92
89
|
// Pinning the width forces colons to line up vertically across cards rather than
|
|
93
90
|
// each FormLayout sizing its label column independently from its own longest label.
|
|
94
91
|
const STYLE_FORM_SIZES = ['200px', '1fr'];
|
|
95
|
-
const CELL_TEXT_POSITION_CHOICES = [
|
|
96
|
-
{ value: 'Above', label: 'Above Bar' },
|
|
97
|
-
{ value: 'Below', label: 'Below Bar' },
|
|
98
|
-
{ value: 'Merged', label: 'Merged' },
|
|
99
|
-
];
|
|
100
92
|
const ORIGIN_CHOICES = [
|
|
101
93
|
{
|
|
102
94
|
value: 'Auto',
|
|
@@ -121,6 +113,7 @@ export const StyledColumnWizardStyleSection = (props) => {
|
|
|
121
113
|
return (_jsx(Box, { children: !data.ColumnId && (_jsx(ErrorBox, { className: "twa:mt-2", children: "You need to select a column before styling." })) }));
|
|
122
114
|
}
|
|
123
115
|
const pb = data.PercentBarStyle;
|
|
116
|
+
const cellTextProperties = pb.CellTextProperties;
|
|
124
117
|
// ---- updaters -----------------------------------------------------------
|
|
125
118
|
const update = (patch) => {
|
|
126
119
|
props.onChange({
|
|
@@ -128,12 +121,13 @@ export const StyledColumnWizardStyleSection = (props) => {
|
|
|
128
121
|
PercentBarStyle: { ...pb, ...patch },
|
|
129
122
|
});
|
|
130
123
|
};
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
124
|
+
const onCellTextLayoutToggle = (token, show) => {
|
|
125
|
+
update(toggleBarStyleCellTextToken(cellTextProperties, token, show));
|
|
126
|
+
};
|
|
127
|
+
const onCellTextPlacementChange = (token, patch) => {
|
|
128
|
+
update({
|
|
129
|
+
CellTextProperties: patchBarStyleCellTextPlacement(cellTextProperties, token, patch),
|
|
130
|
+
});
|
|
137
131
|
};
|
|
138
132
|
const onToolTipTextChanged = (token, checked) => {
|
|
139
133
|
const current = pb.ToolTipText ?? [];
|
|
@@ -142,38 +136,7 @@ export const StyledColumnWizardStyleSection = (props) => {
|
|
|
142
136
|
: current.filter((t) => t !== token);
|
|
143
137
|
update({ ToolTipText: next });
|
|
144
138
|
};
|
|
145
|
-
const handleCellTextPositionChange = (pos) => update({ CellTextPosition: pos });
|
|
146
139
|
const handleOriginChange = (origin) => update({ Origin: origin });
|
|
147
|
-
const handleCellTextAlignmentChange = (choice) => {
|
|
148
|
-
if (choice === 'Inherit') {
|
|
149
|
-
const next = { ...pb };
|
|
150
|
-
delete next.CellTextAlignment;
|
|
151
|
-
props.onChange({ ...data, PercentBarStyle: next });
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
update({ CellTextAlignment: choice });
|
|
155
|
-
};
|
|
156
|
-
const onAutoCellTextAlignmentChecked = (checked) => {
|
|
157
|
-
if (!checked) {
|
|
158
|
-
handleCellTextAlignmentChange('Inherit');
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
let nextFont = pb.Font ? { ...pb.Font } : undefined;
|
|
162
|
-
if (nextFont) {
|
|
163
|
-
delete nextFont.Alignment;
|
|
164
|
-
if (Object.keys(nextFont).length === 0) {
|
|
165
|
-
nextFont = undefined;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
props.onChange({
|
|
169
|
-
...data,
|
|
170
|
-
PercentBarStyle: {
|
|
171
|
-
...pb,
|
|
172
|
-
CellTextAlignment: 'Auto',
|
|
173
|
-
Font: nextFont,
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
};
|
|
177
140
|
const onBackColorChange = (color) => {
|
|
178
141
|
if (color) {
|
|
179
142
|
update({ BackColor: color });
|
|
@@ -182,14 +145,11 @@ export const StyledColumnWizardStyleSection = (props) => {
|
|
|
182
145
|
const { BackColor: _removed, ...rest } = pb;
|
|
183
146
|
props.onChange({ ...data, PercentBarStyle: rest });
|
|
184
147
|
};
|
|
185
|
-
const cellTextDisabled =
|
|
186
|
-
const currentAlignment = pb.CellTextAlignment ?? 'Inherit';
|
|
148
|
+
const cellTextDisabled = !hasBarStyleCellTextConfigured(cellTextProperties) || disabled;
|
|
187
149
|
const currentOrigin = typeof pb.Origin === 'number'
|
|
188
150
|
? 'Min' // numeric origin doesn't fit the radio set; treat as Min for selection state
|
|
189
151
|
: pb.Origin ?? 'Auto';
|
|
190
|
-
return (_jsxs(Box, { children: [_jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Bar Position" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Set the position of the cell text relative to the bar" })] }), _jsx(Card.Body, { children: _jsx(RadioGroup, { orientation: "vertical", name: "ab-percentbar-origin", value: currentOrigin, onRadioChange: handleOriginChange, children: ORIGIN_CHOICES.map((choice) => (_jsx(Radio, { value: choice.value, disabled: disabled, children: _jsxs(Flex, { alignItems: "center", children: [_jsx(Box, { className: "twa:min-w-[60px]", children: choice.label }), _jsx(Box, { className: "twa:text-xs twa:opacity-70", children: choice.hint })] }) }, choice.value))) }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Cell Text" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[540px]", children: "
|
|
191
|
-
? 'twa:opacity-50 twa:pointer-events-none'
|
|
192
|
-
: '', children: _jsx(Flex, { alignItems: "center", className: "twa:gap-2", children: _jsxs(ToggleGroup, { children: [_jsx(Toggle, { icon: "align-left", pressed: currentAlignment === 'Left', onPressedChange: (pressed) => handleCellTextAlignmentChange(pressed ? 'Left' : 'Inherit') }), _jsx(Toggle, { icon: "align-center", pressed: currentAlignment === 'Center', onPressedChange: (pressed) => handleCellTextAlignmentChange(pressed ? 'Center' : 'Inherit') }), _jsx(Toggle, { icon: "align-right", pressed: currentAlignment === 'Right', onPressedChange: (pressed) => handleCellTextAlignmentChange(pressed ? 'Right' : 'Inherit') })] }) }) }) }) })] }), _jsx(Box, { className: `twa:mt-3 twa:pt-3 twa:border-t twa:border-foreground/15 ${cellTextDisabled ? 'twa:opacity-50' : ''}`, children: _jsx(StyledColumnFontStyleEditor, { api: api, disabled: cellTextDisabled, hideAlignment: true, value: pb.Font, onChange: (next) => {
|
|
152
|
+
return (_jsxs(Box, { children: [_jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Bar Position" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Set the position of the cell text relative to the bar" })] }), _jsx(Card.Body, { children: _jsx(RadioGroup, { orientation: "vertical", name: "ab-percentbar-origin", value: currentOrigin, onRadioChange: handleOriginChange, children: ORIGIN_CHOICES.map((choice) => (_jsx(Radio, { value: choice.value, disabled: disabled, children: _jsxs(Flex, { alignItems: "center", children: [_jsx(Box, { className: "twa:min-w-[60px]", children: choice.label }), _jsx(Box, { className: "twa:text-xs twa:opacity-70", children: choice.hint })] }) }, choice.value))) }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Cell Text" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[540px]", children: "Pick which values to display and where each one sits around the bar (font properties take precedence over Format Column)" })] }), _jsxs(Card.Body, { children: [_jsx(FormLayout, { sizes: [...STYLE_FORM_SIZES], children: _jsx(BarStyleCellTextLayoutEditor, { disabled: disabled, cellTextProperties: cellTextProperties, onToggle: onCellTextLayoutToggle, onPlacementChange: onCellTextPlacementChange }) }), _jsx(Box, { className: `twa:mt-3 twa:pt-3 twa:border-t twa:border-foreground/15 ${cellTextDisabled ? 'twa:opacity-50' : ''}`, children: _jsx(StyledColumnFontStyleEditor, { api: api, disabled: cellTextDisabled, value: pb.Font, onChange: (next) => {
|
|
193
153
|
if (next) {
|
|
194
154
|
update({ Font: next });
|
|
195
155
|
}
|
package/src/View/UIHelper.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WizardStatus, } from './Components/SharedProps/EditableConfigEntityState';
|
|
2
2
|
import { FontWeight, FontStyle, StatusColour } from '../AdaptableState/Common/Enums';
|
|
3
3
|
import { StringExtensions } from '../Utilities/Extensions/StringExtensions';
|
|
4
|
-
import { getScheduleDescription as getScheduleDescriptionFromHelper } from '../Utilities/Helpers/ScheduleHelper';
|
|
4
|
+
import { getScheduleDescription as getScheduleDescriptionFromHelper } from '../Utilities/Helpers/Scheduling/ScheduleHelper';
|
|
5
5
|
import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
|
|
6
6
|
import { resolveContainerElement } from '../Utilities/resolveContainerElement';
|
|
7
7
|
/** Generic swatch entries for the Colour Picker (resolved at runtime per active theme). */
|
|
@@ -8,7 +8,7 @@ import { Card } from '../../components/Card';
|
|
|
8
8
|
import { ButtonEdit } from '../Components/Buttons/ButtonEdit';
|
|
9
9
|
import { NamedQueryContext, } from '../../components/ExpressionEditor/NamedQueryContext';
|
|
10
10
|
import { OnePageWizard, useOnePageWizardContext } from './OnePageWizards';
|
|
11
|
-
import kebabCase from '../../Utilities/
|
|
11
|
+
import { kebabCase } from '../../Utilities/Extensions/StringExtensions';
|
|
12
12
|
import { Box } from '../../components/Flex';
|
|
13
13
|
import { twMerge } from '../../twMerge';
|
|
14
14
|
export const SummaryTag = (props) => (_jsx(Box, { ...props }));
|
|
@@ -163,6 +163,8 @@ export const OnePageWizard = (props) => {
|
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
165
|
setCurrentSection(index);
|
|
166
|
-
}, children: [_jsx(KeyHint, { className:
|
|
166
|
+
}, children: [_jsx(KeyHint, { className: cn('twa:mr-2 twa:inline-block', {
|
|
167
|
+
'twa:text-accent-foreground': active,
|
|
168
|
+
}), children: navIndex }), _jsx("div", { className: "twa:flex-1", children: section.title }), _jsx(Icon, { name: "error", className: cn('twa:ml-2', validSectionsMap.get(index) !== true ? 'twa:visible' : 'twa:invisible') })] }, section.title));
|
|
167
169
|
}), selectedFeedback, _jsx(Box, { className: "twa:flex-1" }), _jsxs(KeyHint, { className: "ab-OnePageWizard__key-hint twa:leading-normal", children: [isMacLike() ? 'Cmd' : 'Ctrl', " + #", _jsx("br", {}), "or arrow keys", _jsx("br", {}), "to navigate"] })] }), _jsx(Flex, { flexDirection: "column", className: "ab-OnePageWizard__section-container twa:min-h-0 twa:min-w-0 twa:flex-1", children: renderSection(currentSection) })] }), _jsxs(Flex, { flexDirection: "row", alignItems: "center", className: "ab-WizardDialog__footer ab-OnePageWizard__footer twa:p-2", children: [_jsx(SimpleButton, { tone: "neutral", variant: "text", "data-name": "close", onClick: () => props.onHide?.(), tooltip: props.closeTooltip ?? 'Close wizard', accessLevel: ACCESS_LEVEL_FULL, children: props.closeText ?? 'CLOSE' }), _jsx(KeyHint, { className: "twa:ml-2", children: "Esc" }), _jsx(Box, { className: "ab-OnePageWizard__error twa:text-2 twa:mr-3 twa:flex-1 twa:text-destructive twa:text-end", children: firstErrorMessage }), _jsx(SimpleButton, { tone: "accent", "data-name": "finish", variant: "raised", disabled: canFinish !== true, onClick: () => handleClickFinish(), icon: 'check', accessLevel: ACCESS_LEVEL_FULL, children: props.finishText ?? 'Finish' })] })] }) }) }) }));
|
|
168
170
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import debounce from '../Utilities/
|
|
1
|
+
import { debounce } from '../Utilities/Helpers/TimingHelper';
|
|
2
2
|
import { createGrid, LocalEventService, } from 'ag-grid-enterprise';
|
|
3
3
|
import { AdaptableLogger } from './AdaptableLogger';
|
|
4
4
|
import { PrimaryKeyDocsLink } from '../Utilities/Constants/DocumentationLinkConstants';
|
|
5
5
|
import StringExtensions from '../Utilities/Extensions/StringExtensions';
|
|
6
|
-
import { applyQuickSearchFindCssVars } from '../Utilities/Helpers/
|
|
6
|
+
import { applyQuickSearchFindCssVars } from '../Utilities/Helpers/QuickSearchHelper';
|
|
7
7
|
import Emitter from '../Utilities/Emitter';
|
|
8
8
|
import { applyDefaultAdaptableOptions } from '../AdaptableOptions/DefaultAdaptableOptions';
|
|
9
9
|
import { resolveContainerElement } from '../Utilities/resolveContainerElement';
|
|
@@ -20,7 +20,7 @@ import { ThemeService } from '../Utilities/Services/ThemeService';
|
|
|
20
20
|
import { ValidationService } from '../Utilities/Services/ValidationService';
|
|
21
21
|
import { ModuleService } from '../Utilities/Services/ModuleService';
|
|
22
22
|
import { CalculatedColumnExpressionService } from '../Utilities/Services/CalculatedColumnExpressionService';
|
|
23
|
-
import { expandCellDataChangedInfosWithCalculatedColumns } from '../Utilities/Services/
|
|
23
|
+
import { expandCellDataChangedInfosWithCalculatedColumns } from '../Utilities/Services/CalculatedColumnExpressionService';
|
|
24
24
|
import { QueryLanguageService } from '../Utilities/Services/QueryLanguageService';
|
|
25
25
|
import { AlertService } from '../Utilities/Services/AlertService';
|
|
26
26
|
import { TeamSharingService } from '../Utilities/Services/TeamSharingService';
|
|
@@ -86,8 +86,8 @@ import { ensureLoadingScreenPortalElement } from '../components/Modal';
|
|
|
86
86
|
import { AdaptableLoadingScreen } from '../View/Components/Popups/AdaptableLoadingScreen';
|
|
87
87
|
import { createElement } from 'react';
|
|
88
88
|
import { createAgStatusPanelComponent } from '../Utilities/createAgStatusPanelComponent';
|
|
89
|
-
import { only } from '../
|
|
90
|
-
import { weightedAverage } from '../
|
|
89
|
+
import { only } from '../AdaptableState/Aggregations/only';
|
|
90
|
+
import { weightedAverage } from '../AdaptableState/Aggregations/weightedAverage';
|
|
91
91
|
import { ROW_SUMMARY_ROW_ID } from '../AdaptableState/Common/RowSummary';
|
|
92
92
|
import { FlashingCellService } from '../Utilities/Services/FlashingCellService';
|
|
93
93
|
import { AgGridExportAdapter } from './AgGridExportAdapter';
|
|
@@ -103,7 +103,7 @@ import { tagProvidedByAdaptable } from '../Utilities/adaptableOverrideCheck';
|
|
|
103
103
|
import { AgGridModulesAdapter } from './AgGridModulesAdapter';
|
|
104
104
|
import { getMarker } from '../devTools';
|
|
105
105
|
import { DeepMap } from '@infinite-table/infinite-react';
|
|
106
|
-
import { DateFormatter } from '../Utilities/Helpers/
|
|
106
|
+
import { DateFormatter } from '../Utilities/Helpers/DisplayFormatHelper';
|
|
107
107
|
import { clearPredicateDefMapMemo } from '../Api/Implementation/PredicateApiImpl';
|
|
108
108
|
import { AgGridFilterAdapterFactory } from './AgGridFilterAdapter';
|
|
109
109
|
import { AdaptableFilterHandler } from './AdaptableFilterHandler';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import kebabCase from '../Utilities/
|
|
1
|
+
import { kebabCase } from '../Utilities/Extensions/StringExtensions';
|
|
2
2
|
import { resolveDisplayFormat } from '../AdaptableState/Common/AdaptableFormatPresets';
|
|
3
|
-
import merge from '../Utilities/
|
|
4
|
-
import { resolveSparklineOptionsForRender } from '../Utilities/Helpers/
|
|
3
|
+
import { merge } from '../Utilities/Extensions/ObjectExtensions';
|
|
4
|
+
import { resolveSparklineOptionsForRender } from '../Utilities/Helpers/StyledColumns/SparklineStyleHelper';
|
|
5
|
+
import { hasBarStyleCellTextConfigured } from '../Utilities/Helpers/StyledColumns/BarStylesHelper';
|
|
5
6
|
import { convertAdaptableStyleToCSS, getAutoContrastTextColor, getVariableColor, hasCellBoxStyle, hasCellFontStyle, normalizeStyleForAgGrid, } from '../Utilities/Helpers/StyleHelper';
|
|
6
7
|
import StringExtensions from '../Utilities/Extensions/StringExtensions';
|
|
7
8
|
import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
|
|
@@ -12,11 +13,11 @@ import { getBadgeRendererForColumn } from './cellRenderers/BadgeRenderer';
|
|
|
12
13
|
import { getBulletChartRendererForColumn } from './cellRenderers/BulletChartRenderer';
|
|
13
14
|
import { getRangeBarRendererForColumn } from './cellRenderers/RangeBarRenderer';
|
|
14
15
|
import { getRatingRendererForColumn } from './cellRenderers/RatingRenderer';
|
|
15
|
-
import { shouldRenderStyledColumnOnRow } from '
|
|
16
|
+
import { shouldRenderStyledColumnOnRow } from '../Utilities/Helpers/StyledColumns/StyledColumnHelper';
|
|
16
17
|
import { findIconStyleMappingForValue, getIconRendererForColumn, } from './cellRenderers/IconRenderer';
|
|
17
|
-
import
|
|
18
|
-
import { getRuleAlertProperties } from '../Utilities/Helpers/ScheduledAlertHelper';
|
|
19
|
-
import { isNegativeZeroCentredBand, expandGradientCellRanges, gradientStyleRangeLookupValueType, DEFAULT_GRADIENT_MIN_ALPHA, DEFAULT_GRADIENT_MAX_ALPHA, } from '../Utilities/Helpers/
|
|
18
|
+
import { clamp } from '../Utilities/Extensions/NumberExtensions';
|
|
19
|
+
import { getRuleAlertProperties } from '../Utilities/Helpers/Scheduling/ScheduledAlertHelper';
|
|
20
|
+
import { isNegativeZeroCentredBand, expandGradientCellRanges, gradientStyleRangeLookupValueType, DEFAULT_GRADIENT_MIN_ALPHA, DEFAULT_GRADIENT_MAX_ALPHA, } from '../Utilities/Helpers/StyledColumns/GradientStyleHelper';
|
|
20
21
|
import { AdaptableNumberEditor, AdaptableReactNumberEditor } from './editors/AdaptableNumberEditor';
|
|
21
22
|
import { AdaptableDateEditor, AdaptableReactDateEditor } from './editors/AdaptableDateEditor';
|
|
22
23
|
import { AgGridExportAdapter } from './AgGridExportAdapter';
|
|
@@ -26,7 +27,7 @@ import { AdaptableFilterHandler } from './AdaptableFilterHandler';
|
|
|
26
27
|
import { AgGridFilterAdapterFactory } from './AgGridFilterAdapter';
|
|
27
28
|
import { AgGridFloatingFilterAdapterFactory } from './AgGridFloatingFilterAdapter';
|
|
28
29
|
import { errorOnce } from './AdaptableLogger';
|
|
29
|
-
import { isUnsupportedColumnDataTypeForIconStyle } from '../Utilities/Helpers/
|
|
30
|
+
import { isUnsupportedColumnDataTypeForIconStyle } from '../Utilities/Helpers/StyledColumns/IconStyleHelper';
|
|
30
31
|
import { isWeightedAverageAggFuncName, } from '../AdaptableState/Common/AggregationColumns';
|
|
31
32
|
/**
|
|
32
33
|
* CSS property keys produced by `convertAdaptableStyleToCSS` from a
|
|
@@ -610,7 +611,7 @@ export class AgGridColumnAdapter {
|
|
|
610
611
|
if (ratingToolTip.includes('PercentageValue') && ratingMax > 0) {
|
|
611
612
|
const n = Number(params.value);
|
|
612
613
|
if (!isNaN(n)) {
|
|
613
|
-
const clamped =
|
|
614
|
+
const clamped = clamp(n, 0, ratingMax);
|
|
614
615
|
const percentageValue = (clamped / ratingMax) * 100;
|
|
615
616
|
const pct = `${percentageValue.toFixed(0)}%`;
|
|
616
617
|
returnValue = returnValue ? `${returnValue} (${pct})` : pct;
|
|
@@ -658,7 +659,7 @@ export class AgGridColumnAdapter {
|
|
|
658
659
|
}
|
|
659
660
|
else {
|
|
660
661
|
const scaleSpan = max - min;
|
|
661
|
-
const clamped =
|
|
662
|
+
const clamped = clamp(Number(params.value), min, max);
|
|
662
663
|
percentageValue = scaleSpan === 0 ? 0 : ((clamped - min) / scaleSpan) * 100;
|
|
663
664
|
}
|
|
664
665
|
returnValue += ` (${percentageValue.toFixed(0)}%)`;
|
|
@@ -1426,11 +1427,11 @@ export class AgGridColumnAdapter {
|
|
|
1426
1427
|
}
|
|
1427
1428
|
const minAlphaBound = gradientStyle.MinAlpha ?? DEFAULT_GRADIENT_MIN_ALPHA;
|
|
1428
1429
|
const maxAlphaBound = gradientStyle.MaxAlpha ?? DEFAULT_GRADIENT_MAX_ALPHA;
|
|
1429
|
-
const lo = Math.min(
|
|
1430
|
-
const hi = Math.max(
|
|
1430
|
+
const lo = Math.min(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
|
|
1431
|
+
const hi = Math.max(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
|
|
1431
1432
|
const span = Math.abs(max - min);
|
|
1432
1433
|
let t = span === 0 ? 0.5 : (Number(colValue) - min) / span;
|
|
1433
|
-
t =
|
|
1434
|
+
t = clamp(t, 0, 1);
|
|
1434
1435
|
if (reverseGradient) {
|
|
1435
1436
|
t = 1 - t;
|
|
1436
1437
|
}
|
|
@@ -1445,7 +1446,8 @@ export class AgGridColumnAdapter {
|
|
|
1445
1446
|
}
|
|
1446
1447
|
}
|
|
1447
1448
|
}
|
|
1448
|
-
if (styledColumn.PercentBarStyle &&
|
|
1449
|
+
if (styledColumn.PercentBarStyle &&
|
|
1450
|
+
hasBarStyleCellTextConfigured(styledColumn.PercentBarStyle.CellTextProperties)) {
|
|
1449
1451
|
style.paddingTop = 0;
|
|
1450
1452
|
style.paddingBottom = 0;
|
|
1451
1453
|
}
|
|
@@ -5,7 +5,7 @@ import { createUuid } from '../AdaptableState/Uuid';
|
|
|
5
5
|
import { AG_GRID_GROUPED_COLUMN, AG_GRID_SELECTION_COLUMN, } from '../Utilities/Constants/GeneralConstants';
|
|
6
6
|
import { ExportModuleId } from '../Utilities/Constants/ModuleConstants';
|
|
7
7
|
import StringExtensions from '../Utilities/Extensions/StringExtensions';
|
|
8
|
-
import FormatHelper, { DateFormatter } from '../Utilities/Helpers/
|
|
8
|
+
import FormatHelper, { DateFormatter } from '../Utilities/Helpers/DisplayFormatHelper';
|
|
9
9
|
import { convertCSSAbsoluteFontSizeToPt, getVariableColor, sanitizeStyle, } from '../Utilities/Helpers/StyleHelper';
|
|
10
10
|
import { waitForTimeout } from '../Utilities/waitForTimeout';
|
|
11
11
|
export class AgGridExportAdapter {
|
|
@@ -2,8 +2,133 @@ import { isAdaptableElementIcon } from '../components/Icon';
|
|
|
2
2
|
import { iconToString } from '../components/icons';
|
|
3
3
|
import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
|
|
4
4
|
import { MENU_SEPARATOR } from '../Utilities/Constants/GeneralConstants';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { getAggFuncName, getDisplayAggFuncNames, isWeightedAverageAggregation, WEIGHTED_AVERAGE_AGG_FN_NAME, } from '../AdaptableState/Common/AggregationColumns';
|
|
6
|
+
/**
|
|
7
|
+
* Creates an AG Grid icon element for the given icon name.
|
|
8
|
+
*
|
|
9
|
+
* Mimics AG Grid's internal icon creation, producing a
|
|
10
|
+
* `<span class="ag-icon ag-icon-{name}" role="presentation" unselectable="on">`
|
|
11
|
+
* so the icon picks up AG Grid's own icon font/theme styling.
|
|
12
|
+
*
|
|
13
|
+
* @see https://github.com/ag-grid/ag-grid/blob/5ca14e73188f6f52fd7d545d595c067bf1b72168/packages/ag-grid-community/src/utils/icon.ts#L139
|
|
14
|
+
*/
|
|
15
|
+
function createAgGridIcon(name) {
|
|
16
|
+
const element = document.createElement('span');
|
|
17
|
+
element.className = `ag-icon ag-icon-${name}`;
|
|
18
|
+
element.setAttribute('role', 'presentation');
|
|
19
|
+
element.setAttribute('unselectable', 'on');
|
|
20
|
+
return element;
|
|
21
|
+
}
|
|
22
|
+
const toFuncLabel = (funcName) => {
|
|
23
|
+
if (funcName === 'avg') {
|
|
24
|
+
return 'Average';
|
|
25
|
+
}
|
|
26
|
+
if (funcName === 'weightedAvg') {
|
|
27
|
+
return 'Weighted Average';
|
|
28
|
+
}
|
|
29
|
+
return funcName ? funcName.charAt(0).toUpperCase() + funcName.slice(1) : funcName;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Builds the replacement for AG Grid's built-in `valueAggSubMenu` column menu item.
|
|
33
|
+
*
|
|
34
|
+
* AG Grid does not allow customizing the built-in submenu, so we rebuild an
|
|
35
|
+
* equivalent one: the column's existing aggregation functions plus a
|
|
36
|
+
* `Weighted Average` item whose submenu lists the numeric columns that can be
|
|
37
|
+
* used as the weight parameter.
|
|
38
|
+
*
|
|
39
|
+
* Both standard and weighted selections persist through the current Layout
|
|
40
|
+
* (`updateCurrentLayout`), so the existing `weightedAvg` aggFunc can read the
|
|
41
|
+
* chosen `weightedColumnId` back from the Layout.
|
|
42
|
+
*
|
|
43
|
+
* Weighted Average is never used in Pivot Layouts, so this only deals with the
|
|
44
|
+
* Table Layout aggregations and the caller skips it entirely in Pivot mode.
|
|
45
|
+
*/
|
|
46
|
+
function buildValueAggregationMenuItem(adaptableApi, menuContext) {
|
|
47
|
+
const column = menuContext.adaptableColumn;
|
|
48
|
+
const columnId = column.columnId;
|
|
49
|
+
const currentLayout = adaptableApi.layoutApi.getCurrentLayout();
|
|
50
|
+
const aggregationColumns = currentLayout.TableAggregationColumns || [];
|
|
51
|
+
const currentAggFunc = aggregationColumns.find((agg) => agg.ColumnId === columnId)?.AggFunc;
|
|
52
|
+
let activeAggFuncName;
|
|
53
|
+
if (currentAggFunc != null) {
|
|
54
|
+
const aggFuncName = getAggFuncName(currentAggFunc);
|
|
55
|
+
activeAggFuncName = aggFuncName === true ? column.aggregationFunction : aggFuncName;
|
|
56
|
+
}
|
|
57
|
+
const activeWeightColumnId = isWeightedAverageAggregation(currentAggFunc)
|
|
58
|
+
? currentAggFunc.weightedColumnId
|
|
59
|
+
: undefined;
|
|
60
|
+
const applyAggregation = (aggFuncValue) => {
|
|
61
|
+
const upsert = (cols) => {
|
|
62
|
+
const list = cols ? [...cols] : [];
|
|
63
|
+
const index = list.findIndex((col) => col.ColumnId === columnId);
|
|
64
|
+
if (index >= 0) {
|
|
65
|
+
list[index] = { ...list[index], AggFunc: aggFuncValue };
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
list.push({ ColumnId: columnId, AggFunc: aggFuncValue });
|
|
69
|
+
}
|
|
70
|
+
return list;
|
|
71
|
+
};
|
|
72
|
+
adaptableApi.layoutApi.updateCurrentLayout((layout) => {
|
|
73
|
+
const tableLayout = layout;
|
|
74
|
+
return {
|
|
75
|
+
...tableLayout,
|
|
76
|
+
TableAggregationColumns: upsert(tableLayout.TableAggregationColumns),
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
const removeAggregation = () => {
|
|
81
|
+
adaptableApi.layoutApi.updateCurrentLayout((layout) => {
|
|
82
|
+
const tableLayout = layout;
|
|
83
|
+
return {
|
|
84
|
+
...tableLayout,
|
|
85
|
+
TableAggregationColumns: (tableLayout.TableAggregationColumns || []).filter((col) => col.ColumnId !== columnId),
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
// 'None' clears any aggregation for the column and is checked when none is set
|
|
90
|
+
const subMenu = [
|
|
91
|
+
{
|
|
92
|
+
name: 'None',
|
|
93
|
+
checked: activeAggFuncName == null,
|
|
94
|
+
action: () => removeAggregation(),
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
// getDisplayAggFuncNames already positions weightedAvg right after 'avg'
|
|
98
|
+
// (and only includes it when the column is eligible)
|
|
99
|
+
const aggFuncItems = getDisplayAggFuncNames(column).map((funcName) => {
|
|
100
|
+
// Weighted Average needs a weight column parameter, so instead of a plain
|
|
101
|
+
// action it gets a submenu listing the numeric columns usable as the weight.
|
|
102
|
+
if (funcName === WEIGHTED_AVERAGE_AGG_FN_NAME) {
|
|
103
|
+
const weightColumnItems = adaptableApi.columnApi
|
|
104
|
+
.getNumericColumns()
|
|
105
|
+
.filter((numericColumn) => numericColumn.columnId !== columnId)
|
|
106
|
+
.map((numericColumn) => ({
|
|
107
|
+
name: numericColumn.friendlyName ?? numericColumn.columnId,
|
|
108
|
+
checked: activeWeightColumnId === numericColumn.columnId,
|
|
109
|
+
action: () => applyAggregation({
|
|
110
|
+
type: 'weightedAverage',
|
|
111
|
+
weightedColumnId: numericColumn.columnId,
|
|
112
|
+
}),
|
|
113
|
+
}));
|
|
114
|
+
return {
|
|
115
|
+
name: 'Weighted Average',
|
|
116
|
+
checked: activeAggFuncName === WEIGHTED_AVERAGE_AGG_FN_NAME,
|
|
117
|
+
subMenu: weightColumnItems,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
name: toFuncLabel(funcName),
|
|
122
|
+
checked: activeAggFuncName === funcName,
|
|
123
|
+
action: () => applyAggregation(funcName),
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
subMenu.push(...aggFuncItems);
|
|
127
|
+
return {
|
|
128
|
+
name: 'Value Aggregation',
|
|
129
|
+
subMenu,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
7
132
|
export class AgGridMenuAdapter {
|
|
8
133
|
_adaptableInstance;
|
|
9
134
|
constructor(_adaptableInstance) {
|