@adaptabletools/adaptable 23.0.0-canary.4 → 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/EditOptions.d.ts +2 -2
- package/src/AdaptableState/Common/AggregationColumns.d.ts +14 -6
- package/src/AdaptableState/Common/AggregationColumns.js +27 -2
- package/src/AdaptableState/Common/ColumnScope.d.ts +4 -0
- package/src/AdaptableState/Common/Enums.d.ts +5 -5
- package/src/AdaptableState/Common/Enums.js +4 -4
- package/src/AdaptableState/PlusMinusState.d.ts +3 -3
- package/src/AdaptableState/ShortcutState.d.ts +2 -6
- package/src/AdaptableState/StyledColumnState.d.ts +3 -5
- package/src/AdaptableState/ThemeState.d.ts +33 -28
- package/src/Api/EventApi.d.ts +14 -1
- package/src/Api/Events/ThemeChanged.d.ts +6 -0
- package/src/Api/Events/ThemeSelected.d.ts +11 -0
- package/src/Api/Events/ThemeSelected.js +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 +17 -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/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/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 +32 -41
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.js +4 -31
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/PreviewChartSection.d.ts +5 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/PreviewChartSection.js +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/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/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 +21 -22
- 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/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/agGrid/AdaptableAgGrid.d.ts +1 -0
- package/src/agGrid/AdaptableAgGrid.js +35 -25
- package/src/agGrid/AgGridAdapter.d.ts +1 -1
- package/src/agGrid/AgGridAdapter.js +27 -17
- package/src/agGrid/AgGridColumnAdapter.js +9 -15
- package/src/agGrid/AgGridMenuAdapter.d.ts +0 -1
- package/src/agGrid/AgGridMenuAdapter.js +20 -37
- package/src/agGrid/buildValueAggregationMenuItem.d.ts +19 -0
- package/src/agGrid/buildValueAggregationMenuItem.js +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/DragAndDropContext/UnusedPanel.js +1 -1
- package/src/components/ExpressionEditor/BaseEditorInput.js +1 -1
- package/src/components/ExpressionEditor/ExpressionFunctionDocumentation.js +1 -1
- package/src/components/Input/NumberInput.js +1 -1
- package/src/components/Panel/index.js +1 -1
- package/src/components/SimpleButton/index.js +4 -4
- package/src/components/Toggle/Toggle.js +1 -1
- package/src/components/Toggle/ToggleGroup.js +1 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.js +2 -9
- package/src/metamodel/adaptable.metamodel.d.ts +39 -29
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +5 -4
- package/themes/dark.css +1 -68
- package/themes/light.css +1 -5
- package/tsconfig.esm.tsbuildinfo +1 -1
- 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/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
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { IAggFuncParams } from 'ag-grid-enterprise';
|
|
2
|
-
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
3
|
-
import { AdaptableColumn } from '../AdaptableState/Common/AdaptableColumn';
|
|
4
|
-
import { AggregationColumnValue, ParameterizedAggFunc } from '../AdaptableState/Common/AggregationColumns';
|
|
5
|
-
import { ColumnAggregationModel } from '../layout-manager/src/LayoutManagerModel';
|
|
6
|
-
export interface ParameterizedAggregationDefinition<T extends ParameterizedAggFunc = ParameterizedAggFunc> {
|
|
7
|
-
type: T['type'];
|
|
8
|
-
agGridAggFuncName: string;
|
|
9
|
-
label: string;
|
|
10
|
-
/** Label for the secondary column picker in the Layout wizard */
|
|
11
|
-
argColumnLabel?: string;
|
|
12
|
-
isComplete(def: T): boolean;
|
|
13
|
-
isAvailableForColumn(column: AdaptableColumn): boolean;
|
|
14
|
-
compute(params: IAggFuncParams, valueColumnId: string, def: T): unknown;
|
|
15
|
-
toColumnAggregationModel(def: T): ColumnAggregationModel;
|
|
16
|
-
fromColumnAggregationModel(model: ColumnAggregationModel): T | null;
|
|
17
|
-
createInitialDefinition(): T;
|
|
18
|
-
createDefinition?(argColumnId: string): T;
|
|
19
|
-
/**
|
|
20
|
-
* Value inside parentheses when agg is shown in header.
|
|
21
|
-
* For column-arg aggs, use "ValueColumn-ArgColumn" (e.g. Interest-Book).
|
|
22
|
-
*/
|
|
23
|
-
getHeaderParenthesisValue?(api: AdaptableApi, valueColumnId: string, def: T): string;
|
|
24
|
-
/** Short label for wizard summaries, e.g. "weightedAvg(Interest-Book)" */
|
|
25
|
-
formatSummaryLabel?(api: AdaptableApi, valueColumnId: string, def: T): string;
|
|
26
|
-
}
|
|
27
|
-
export declare function getParameterizedAggregationDefinitions(): ParameterizedAggregationDefinition[];
|
|
28
|
-
export declare function getParameterizedAggregationDefinition(type: string): ParameterizedAggregationDefinition | undefined;
|
|
29
|
-
export declare function getParameterizedAggregationDefinitionByAgGridName(agGridAggFuncName: string): ParameterizedAggregationDefinition | undefined;
|
|
30
|
-
export declare function isParameterizedAggFuncName(aggFunc: string): boolean;
|
|
31
|
-
export declare function isParameterizedAggregation(aggFunc: AggregationColumnValue): aggFunc is ParameterizedAggFunc;
|
|
32
|
-
export declare function getParameterizedAggFuncName(aggFunc: AggregationColumnValue): string | undefined;
|
|
33
|
-
export declare function aggregationValueToColumnAggregationModel(aggFunc: AggregationColumnValue): ColumnAggregationModel;
|
|
34
|
-
export declare function aggregationValueFromColumnAggregationModel(columnAggregationModel: ColumnAggregationModel): AggregationColumnValue | undefined;
|
|
35
|
-
export declare function computeParameterizedAggregation(params: IAggFuncParams, valueColumnId: string, def: ParameterizedAggFunc): unknown;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { weightedAverageAggregationDefinition } from './definitions/weightedAverageAggregationDefinition';
|
|
2
|
-
const PARAMETERIZED_AGGREGATION_DEFINITIONS = [
|
|
3
|
-
weightedAverageAggregationDefinition,
|
|
4
|
-
];
|
|
5
|
-
const definitionsByType = new Map(PARAMETERIZED_AGGREGATION_DEFINITIONS.map((definition) => [definition.type, definition]));
|
|
6
|
-
const definitionsByAgGridName = new Map(PARAMETERIZED_AGGREGATION_DEFINITIONS.map((definition) => [
|
|
7
|
-
definition.agGridAggFuncName,
|
|
8
|
-
definition,
|
|
9
|
-
]));
|
|
10
|
-
export function getParameterizedAggregationDefinitions() {
|
|
11
|
-
return PARAMETERIZED_AGGREGATION_DEFINITIONS;
|
|
12
|
-
}
|
|
13
|
-
export function getParameterizedAggregationDefinition(type) {
|
|
14
|
-
return definitionsByType.get(type);
|
|
15
|
-
}
|
|
16
|
-
export function getParameterizedAggregationDefinitionByAgGridName(agGridAggFuncName) {
|
|
17
|
-
return definitionsByAgGridName.get(agGridAggFuncName);
|
|
18
|
-
}
|
|
19
|
-
export function isParameterizedAggFuncName(aggFunc) {
|
|
20
|
-
return definitionsByAgGridName.has(aggFunc);
|
|
21
|
-
}
|
|
22
|
-
export function isParameterizedAggregation(aggFunc) {
|
|
23
|
-
return (typeof aggFunc === 'object' &&
|
|
24
|
-
aggFunc != null &&
|
|
25
|
-
'type' in aggFunc &&
|
|
26
|
-
definitionsByType.has(aggFunc.type));
|
|
27
|
-
}
|
|
28
|
-
export function getParameterizedAggFuncName(aggFunc) {
|
|
29
|
-
if (!isParameterizedAggregation(aggFunc)) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
return getParameterizedAggregationDefinition(aggFunc.type)?.agGridAggFuncName;
|
|
33
|
-
}
|
|
34
|
-
export function aggregationValueToColumnAggregationModel(aggFunc) {
|
|
35
|
-
if (isParameterizedAggregation(aggFunc)) {
|
|
36
|
-
const definition = getParameterizedAggregationDefinition(aggFunc.type);
|
|
37
|
-
if (definition) {
|
|
38
|
-
return definition.toColumnAggregationModel(aggFunc);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return { aggFunc: aggFunc };
|
|
42
|
-
}
|
|
43
|
-
export function aggregationValueFromColumnAggregationModel(columnAggregationModel) {
|
|
44
|
-
if (columnAggregationModel &&
|
|
45
|
-
typeof columnAggregationModel.aggFunc === 'string' &&
|
|
46
|
-
isParameterizedAggFuncName(columnAggregationModel.aggFunc)) {
|
|
47
|
-
const definition = getParameterizedAggregationDefinitionByAgGridName(columnAggregationModel.aggFunc);
|
|
48
|
-
if (definition) {
|
|
49
|
-
const parameterizedValue = definition.fromColumnAggregationModel(columnAggregationModel);
|
|
50
|
-
if (parameterizedValue) {
|
|
51
|
-
return parameterizedValue;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
export function computeParameterizedAggregation(params, valueColumnId, def) {
|
|
58
|
-
const definition = getParameterizedAggregationDefinition(def.type);
|
|
59
|
-
if (!definition || !definition.isComplete(def)) {
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
return definition.compute(params, valueColumnId, def);
|
|
63
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { WeightedAverageAggregation } from '../../AdaptableState/Common/AggregationColumns';
|
|
2
|
-
import { ParameterizedAggregationDefinition } from '../ParameterizedAggregationRegistry';
|
|
3
|
-
export declare const weightedAverageAggregationDefinition: ParameterizedAggregationDefinition<WeightedAverageAggregation>;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { WEIGHTED_AVERAGE_AGG_FN_NAME, } from '../../AdaptableState/Common/AggregationColumns';
|
|
2
|
-
import { weightedAverage } from '../../Utilities/weightedAverage';
|
|
3
|
-
function formatValueAndArgColumnHeaderLabel(api, valueColumnId, argColumnId) {
|
|
4
|
-
const valueName = api.columnApi.getFriendlyNameForColumnId(valueColumnId);
|
|
5
|
-
const argName = api.columnApi.getFriendlyNameForColumnId(argColumnId);
|
|
6
|
-
return `${valueName}-${argName}`;
|
|
7
|
-
}
|
|
8
|
-
export const weightedAverageAggregationDefinition = {
|
|
9
|
-
type: 'weightedAverage',
|
|
10
|
-
agGridAggFuncName: WEIGHTED_AVERAGE_AGG_FN_NAME,
|
|
11
|
-
label: 'Weighted Average',
|
|
12
|
-
argColumnLabel: 'Weight',
|
|
13
|
-
isComplete(def) {
|
|
14
|
-
return !!def.weightedColumnId;
|
|
15
|
-
},
|
|
16
|
-
isAvailableForColumn(column) {
|
|
17
|
-
return column.dataType === 'number' && column.aggregatable;
|
|
18
|
-
},
|
|
19
|
-
compute(params, valueColumnId, def) {
|
|
20
|
-
return weightedAverage(params, valueColumnId, def.weightedColumnId);
|
|
21
|
-
},
|
|
22
|
-
toColumnAggregationModel(def) {
|
|
23
|
-
return {
|
|
24
|
-
aggFunc: WEIGHTED_AVERAGE_AGG_FN_NAME,
|
|
25
|
-
weightedColumnId: def.weightedColumnId,
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
fromColumnAggregationModel(model) {
|
|
29
|
-
if (model.aggFunc !== WEIGHTED_AVERAGE_AGG_FN_NAME) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
type: 'weightedAverage',
|
|
34
|
-
weightedColumnId: model.weightedColumnId,
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
createInitialDefinition() {
|
|
38
|
-
return {
|
|
39
|
-
type: 'weightedAverage',
|
|
40
|
-
weightedColumnId: null,
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
createDefinition(weightColumnId) {
|
|
44
|
-
return {
|
|
45
|
-
type: 'weightedAverage',
|
|
46
|
-
weightedColumnId: weightColumnId,
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
getHeaderParenthesisValue(api, valueColumnId, def) {
|
|
50
|
-
return formatValueAndArgColumnHeaderLabel(api, valueColumnId, def.weightedColumnId);
|
|
51
|
-
},
|
|
52
|
-
formatSummaryLabel(api, valueColumnId, def) {
|
|
53
|
-
return `${WEIGHTED_AVERAGE_AGG_FN_NAME}(${formatValueAndArgColumnHeaderLabel(api, valueColumnId, def.weightedColumnId)})`;
|
|
54
|
-
},
|
|
55
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DefaultMenuItem, MenuItemDef } from 'ag-grid-enterprise';
|
|
2
|
-
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
3
|
-
import { AdaptableColumn } from '../AdaptableState/Common/AdaptableColumn';
|
|
4
|
-
import { ParameterizedAggFunc } from '../AdaptableState/Common/AggregationColumns';
|
|
5
|
-
export declare function buildParameterizedAggregationMenuItems(api: AdaptableApi, column: AdaptableColumn, onSelect: (columnId: string, parameterizedAgg: ParameterizedAggFunc) => void): MenuItemDef[];
|
|
6
|
-
export declare function buildConsolidatedAggregationColumnMenuItem(api: AdaptableApi, column: AdaptableColumn, onSelectParameterizedAgg: (columnId: string, parameterizedAgg: ParameterizedAggFunc) => void, onSelectStandardAgg: (columnId: string, aggFunc: string | null) => void): MenuItemDef | null;
|
|
7
|
-
export declare function isValueAggregationMenuItem(item: DefaultMenuItem | MenuItemDef): boolean;
|
|
8
|
-
export declare function findParameterizedAggMenuInsertIndex(menuItems: (DefaultMenuItem | MenuItemDef)[]): number;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { isPivotLayout } from '../Api/Implementation/LayoutHelpers';
|
|
2
|
-
import { getAggregationValueForColumn, getNumericWeightColumnCandidates, isParameterizedAggFuncAllowedForColumn, isValueAggregationColumnMenuAvailable, } from './parameterizedAggregationHelpers';
|
|
3
|
-
import { getParameterizedAggregationDefinitions, getParameterizedAggregationDefinition, isParameterizedAggregation, } from './ParameterizedAggregationRegistry';
|
|
4
|
-
const DEFAULT_AGG_FUNC_LABELS = {
|
|
5
|
-
sum: 'Sum',
|
|
6
|
-
min: 'Min',
|
|
7
|
-
max: 'Max',
|
|
8
|
-
count: 'Count',
|
|
9
|
-
avg: 'Average',
|
|
10
|
-
first: 'First',
|
|
11
|
-
last: 'Last',
|
|
12
|
-
only: 'Only',
|
|
13
|
-
};
|
|
14
|
-
function getAggFuncLabel(aggFuncName) {
|
|
15
|
-
return DEFAULT_AGG_FUNC_LABELS[aggFuncName] ?? aggFuncName;
|
|
16
|
-
}
|
|
17
|
-
function isCurrentStandardAgg(layoutAgg, aggFuncName) {
|
|
18
|
-
return typeof layoutAgg === 'string' && layoutAgg === aggFuncName;
|
|
19
|
-
}
|
|
20
|
-
export function buildParameterizedAggregationMenuItems(api, column, onSelect) {
|
|
21
|
-
const layout = api.layoutApi.getCurrentLayout();
|
|
22
|
-
const features = api.layoutApi.internalApi.getLayoutSupportedFeatures();
|
|
23
|
-
const supportsAggregations = isPivotLayout(layout)
|
|
24
|
-
? features.PivotAggregationColumns
|
|
25
|
-
: features.TableAggregationColumns;
|
|
26
|
-
if (!supportsAggregations) {
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
29
|
-
// Match AG Grid: "Value Aggregation" is only offered when the grid is grouped.
|
|
30
|
-
if (!isValueAggregationColumnMenuAvailable(api, layout)) {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
const layoutAgg = getAggregationValueForColumn(column.columnId, layout);
|
|
34
|
-
const weightColumnCandidates = getNumericWeightColumnCandidates(api, column.columnId);
|
|
35
|
-
return getParameterizedAggregationDefinitions()
|
|
36
|
-
.filter((definition) => definition.isAvailableForColumn(column) &&
|
|
37
|
-
isParameterizedAggFuncAllowedForColumn(api, column, definition.agGridAggFuncName))
|
|
38
|
-
.map((definition) => {
|
|
39
|
-
const isCurrentType = isParameterizedAggregation(layoutAgg) &&
|
|
40
|
-
layoutAgg.type === definition.type &&
|
|
41
|
-
definition.isComplete(layoutAgg);
|
|
42
|
-
return {
|
|
43
|
-
name: definition.label,
|
|
44
|
-
subMenu: weightColumnCandidates.length === 0
|
|
45
|
-
? [
|
|
46
|
-
{
|
|
47
|
-
name: 'No weight columns available',
|
|
48
|
-
disabled: true,
|
|
49
|
-
},
|
|
50
|
-
]
|
|
51
|
-
: weightColumnCandidates.map((weightColumn) => {
|
|
52
|
-
const isSelected = isCurrentType &&
|
|
53
|
-
isParameterizedAggregation(layoutAgg) &&
|
|
54
|
-
layoutAgg.weightedColumnId === weightColumn.columnId;
|
|
55
|
-
return {
|
|
56
|
-
name: weightColumn.friendlyName,
|
|
57
|
-
checked: isSelected,
|
|
58
|
-
action: () => {
|
|
59
|
-
if (definition.createDefinition) {
|
|
60
|
-
onSelect(column.columnId, definition.createDefinition(weightColumn.columnId));
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}),
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
export function buildConsolidatedAggregationColumnMenuItem(api, column, onSelectParameterizedAgg, onSelectStandardAgg) {
|
|
69
|
-
const parameterizedMenuItems = buildParameterizedAggregationMenuItems(api, column, onSelectParameterizedAgg);
|
|
70
|
-
if (!parameterizedMenuItems.length) {
|
|
71
|
-
// No parameterized options: keep AG Grid's native Value Aggregation menu.
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
const layout = api.layoutApi.getCurrentLayout();
|
|
75
|
-
// Layout is the source of truth; the grid is updated from layout on each selection.
|
|
76
|
-
const layoutAgg = getAggregationValueForColumn(column.columnId, layout);
|
|
77
|
-
const currentParameterizedDefinition = isParameterizedAggregation(layoutAgg)
|
|
78
|
-
? getParameterizedAggregationDefinition(layoutAgg.type)
|
|
79
|
-
: undefined;
|
|
80
|
-
const standardAggFuncs = [...new Set(column.availableAggregationFunctions ?? [])];
|
|
81
|
-
const standardAggMenuItems = [
|
|
82
|
-
{
|
|
83
|
-
name: 'None',
|
|
84
|
-
checked: layoutAgg == null,
|
|
85
|
-
action: () => onSelectStandardAgg(column.columnId, null),
|
|
86
|
-
},
|
|
87
|
-
...standardAggFuncs.map((aggFuncName) => ({
|
|
88
|
-
name: getAggFuncLabel(aggFuncName),
|
|
89
|
-
checked: isCurrentStandardAgg(layoutAgg, aggFuncName),
|
|
90
|
-
action: () => onSelectStandardAgg(column.columnId, aggFuncName),
|
|
91
|
-
})),
|
|
92
|
-
];
|
|
93
|
-
const subMenu = standardAggMenuItems.length && parameterizedMenuItems.length
|
|
94
|
-
? [...standardAggMenuItems, 'separator', ...parameterizedMenuItems]
|
|
95
|
-
: [...standardAggMenuItems, ...parameterizedMenuItems];
|
|
96
|
-
const currentParameterizedAggName = currentParameterizedDefinition
|
|
97
|
-
? currentParameterizedDefinition.label
|
|
98
|
-
: undefined;
|
|
99
|
-
return {
|
|
100
|
-
name: 'Value Aggregation',
|
|
101
|
-
subMenu,
|
|
102
|
-
tooltip: currentParameterizedAggName != null
|
|
103
|
-
? `Current: ${currentParameterizedAggName}`
|
|
104
|
-
: undefined,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
export function isValueAggregationMenuItem(item) {
|
|
108
|
-
if (item === 'valueAggSubMenu') {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
if (typeof item !== 'object' || item == null) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
const name = item.name;
|
|
115
|
-
return (name === 'valueAggSubMenu' ||
|
|
116
|
-
name === 'Value Aggregation' ||
|
|
117
|
-
(typeof name === 'string' && name.toLowerCase().includes('value agg')));
|
|
118
|
-
}
|
|
119
|
-
export function findParameterizedAggMenuInsertIndex(menuItems) {
|
|
120
|
-
const valueAggSubMenuIndex = menuItems.findIndex((item) => isValueAggregationMenuItem(item));
|
|
121
|
-
if (valueAggSubMenuIndex !== -1) {
|
|
122
|
-
return valueAggSubMenuIndex + 1;
|
|
123
|
-
}
|
|
124
|
-
const separatorBeforeAdaptableIndex = menuItems.findIndex((item) => item === 'separator');
|
|
125
|
-
if (separatorBeforeAdaptableIndex !== -1) {
|
|
126
|
-
return separatorBeforeAdaptableIndex;
|
|
127
|
-
}
|
|
128
|
-
const rowUnGroupIndex = menuItems.findIndex((item) => item === 'rowUnGroup');
|
|
129
|
-
if (rowUnGroupIndex !== -1) {
|
|
130
|
-
return rowUnGroupIndex + 1;
|
|
131
|
-
}
|
|
132
|
-
const rowGroupIndex = menuItems.findIndex((item) => item === 'rowGroup');
|
|
133
|
-
if (rowGroupIndex !== -1) {
|
|
134
|
-
return rowGroupIndex + 1;
|
|
135
|
-
}
|
|
136
|
-
return menuItems.length;
|
|
137
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
2
|
-
import { Layout } from '../AdaptableState/LayoutState';
|
|
3
|
-
/**
|
|
4
|
-
* Layout may still list a parameterized agg while the column no longer has an active aggFunc
|
|
5
|
-
* (e.g. user cleared aggregation from the column menu). Only customise headers when both match.
|
|
6
|
-
*/
|
|
7
|
-
export declare function isParameterizedAggregationActiveOnColumn(api: AdaptableApi, valueColumnId: string, layout: Layout): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* When agg func names are shown in the header, AG Grid renders: `${aggLabel}(${headerValue})`.
|
|
10
|
-
* For parameterized aggs, return the weight (or other arg) column friendly name for that slot.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getParameterizedAggregationHeaderParenthesisValue(api: AdaptableApi, valueColumnId: string, layout: Layout): string | null;
|
|
13
|
-
export declare function getParameterizedAggregationDisplayName(api: AdaptableApi, aggFunc: import('../AdaptableState/Common/AggregationColumns').AggregationColumnValue, valueColumnId?: string): string;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { getParameterizedAggregationDefinition, getParameterizedAggregationDefinitionByAgGridName, isParameterizedAggFuncName, isParameterizedAggregation, } from './ParameterizedAggregationRegistry';
|
|
2
|
-
import { getParameterizedAggForColumn } from './parameterizedAggregationHelpers';
|
|
3
|
-
/**
|
|
4
|
-
* Layout may still list a parameterized agg while the column no longer has an active aggFunc
|
|
5
|
-
* (e.g. user cleared aggregation from the column menu). Only customise headers when both match.
|
|
6
|
-
*/
|
|
7
|
-
export function isParameterizedAggregationActiveOnColumn(api, valueColumnId, layout) {
|
|
8
|
-
const layoutDef = getParameterizedAggForColumn(valueColumnId, layout);
|
|
9
|
-
if (!layoutDef) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
const definition = getParameterizedAggregationDefinition(layoutDef.type);
|
|
13
|
-
if (!definition?.isComplete(layoutDef)) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
const agColumn = api.columnApi.internalApi.getAgGridColumnForAdaptableColumn(valueColumnId);
|
|
17
|
-
const activeAggFunc = agColumn?.getColDef()?.aggFunc;
|
|
18
|
-
if (typeof activeAggFunc !== 'string' || !isParameterizedAggFuncName(activeAggFunc)) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
return getParameterizedAggregationDefinitionByAgGridName(activeAggFunc)?.type === layoutDef.type;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* When agg func names are shown in the header, AG Grid renders: `${aggLabel}(${headerValue})`.
|
|
25
|
-
* For parameterized aggs, return the weight (or other arg) column friendly name for that slot.
|
|
26
|
-
*/
|
|
27
|
-
export function getParameterizedAggregationHeaderParenthesisValue(api, valueColumnId, layout) {
|
|
28
|
-
if (!isParameterizedAggregationActiveOnColumn(api, valueColumnId, layout)) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const def = getParameterizedAggForColumn(valueColumnId, layout);
|
|
32
|
-
if (!def) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
const definition = getParameterizedAggregationDefinition(def.type);
|
|
36
|
-
if (!definition?.isComplete(def) || !definition.getHeaderParenthesisValue) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
return definition.getHeaderParenthesisValue(api, valueColumnId, def);
|
|
40
|
-
}
|
|
41
|
-
export function getParameterizedAggregationDisplayName(api, aggFunc, valueColumnId) {
|
|
42
|
-
if (isParameterizedAggregation(aggFunc)) {
|
|
43
|
-
const definition = getParameterizedAggregationDefinition(aggFunc.type);
|
|
44
|
-
if (definition?.isComplete(aggFunc) &&
|
|
45
|
-
definition.formatSummaryLabel &&
|
|
46
|
-
valueColumnId) {
|
|
47
|
-
return definition.formatSummaryLabel(api, valueColumnId, aggFunc);
|
|
48
|
-
}
|
|
49
|
-
if (definition) {
|
|
50
|
-
return definition.label;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (typeof aggFunc === 'string') {
|
|
54
|
-
return aggFunc;
|
|
55
|
-
}
|
|
56
|
-
if (aggFunc === true) {
|
|
57
|
-
return 'default';
|
|
58
|
-
}
|
|
59
|
-
return String(aggFunc);
|
|
60
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
2
|
-
import { AdaptableColumn } from '../AdaptableState/Common/AdaptableColumn';
|
|
3
|
-
import { AggregationColumnValue, ParameterizedAggFunc, TableAggregationColumns } from '../AdaptableState/Common/AggregationColumns';
|
|
4
|
-
import { Layout, PivotLayout, TableLayout } from '../AdaptableState/LayoutState';
|
|
5
|
-
export declare function getAggregationColumnsFromLayout(layout: Layout): TableAggregationColumns | undefined;
|
|
6
|
-
export declare function getParameterizedAggForColumn(columnId: string, layout: Layout): ParameterizedAggFunc | null;
|
|
7
|
-
export declare function getAggregationValueForColumn(columnId: string, layout: Layout): AggregationColumnValue | undefined;
|
|
8
|
-
export declare function upsertColumnAggregationInLayout(layout: TableLayout | PivotLayout, columnId: string, aggFunc: AggregationColumnValue): void;
|
|
9
|
-
export declare function removeColumnAggregationFromLayout(layout: TableLayout | PivotLayout, columnId: string): void;
|
|
10
|
-
/**
|
|
11
|
-
* Whether the Value Aggregation / parameterized agg column menu should be available.
|
|
12
|
-
* Aligns with AG Grid, which only offers value aggregation when the grid is grouped.
|
|
13
|
-
*/
|
|
14
|
-
export declare function isValueAggregationColumnMenuAvailable(api: AdaptableApi, layout: Layout): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Whether a parameterized agg (e.g. `weightedAvg`) may be offered for a column.
|
|
17
|
-
* Uses `allowedAggFuncs` from the user's Grid Options only, not Adaptable's rewritten list.
|
|
18
|
-
*/
|
|
19
|
-
export declare function isParameterizedAggFuncAllowedForColumn(api: AdaptableApi, column: AdaptableColumn, agGridAggFuncName: string): boolean;
|
|
20
|
-
export declare function getNumericWeightColumnCandidates(api: AdaptableApi, valueColumnId: string): {
|
|
21
|
-
columnId: string;
|
|
22
|
-
friendlyName: string;
|
|
23
|
-
}[];
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { isPivotLayout } from '../Api/Implementation/LayoutHelpers';
|
|
2
|
-
import { getParameterizedAggregationDefinition, isParameterizedAggregation, } from './ParameterizedAggregationRegistry';
|
|
3
|
-
export function getAggregationColumnsFromLayout(layout) {
|
|
4
|
-
if (isPivotLayout(layout)) {
|
|
5
|
-
return layout.PivotAggregationColumns;
|
|
6
|
-
}
|
|
7
|
-
return layout.TableAggregationColumns;
|
|
8
|
-
}
|
|
9
|
-
export function getParameterizedAggForColumn(columnId, layout) {
|
|
10
|
-
if (!columnId) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const aggregationColumns = getAggregationColumnsFromLayout(layout) || [];
|
|
14
|
-
const aggFunc = aggregationColumns.find((col) => col.ColumnId === columnId)?.AggFunc;
|
|
15
|
-
if (isParameterizedAggregation(aggFunc) && getParameterizedAggregationDefinition(aggFunc.type)) {
|
|
16
|
-
return aggFunc;
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
export function getAggregationValueForColumn(columnId, layout) {
|
|
21
|
-
if (!columnId) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
const aggregationColumns = getAggregationColumnsFromLayout(layout) || [];
|
|
25
|
-
return aggregationColumns.find((col) => col.ColumnId === columnId)?.AggFunc;
|
|
26
|
-
}
|
|
27
|
-
export function upsertColumnAggregationInLayout(layout, columnId, aggFunc) {
|
|
28
|
-
if (isPivotLayout(layout)) {
|
|
29
|
-
let pivotAggregationColumns = [...(layout.PivotAggregationColumns || [])];
|
|
30
|
-
let found = false;
|
|
31
|
-
pivotAggregationColumns = pivotAggregationColumns.map((entry) => {
|
|
32
|
-
if (entry.ColumnId === columnId) {
|
|
33
|
-
found = true;
|
|
34
|
-
return { ...entry, AggFunc: aggFunc };
|
|
35
|
-
}
|
|
36
|
-
return entry;
|
|
37
|
-
});
|
|
38
|
-
if (!found) {
|
|
39
|
-
pivotAggregationColumns.push({ ColumnId: columnId, AggFunc: aggFunc });
|
|
40
|
-
}
|
|
41
|
-
layout.PivotAggregationColumns = pivotAggregationColumns;
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
let tableAggregationColumns = [...(layout.TableAggregationColumns || [])];
|
|
45
|
-
let found = false;
|
|
46
|
-
tableAggregationColumns = tableAggregationColumns.map((entry) => {
|
|
47
|
-
if (entry.ColumnId === columnId) {
|
|
48
|
-
found = true;
|
|
49
|
-
return { ColumnId: columnId, AggFunc: aggFunc };
|
|
50
|
-
}
|
|
51
|
-
return entry;
|
|
52
|
-
});
|
|
53
|
-
if (!found) {
|
|
54
|
-
tableAggregationColumns.push({ ColumnId: columnId, AggFunc: aggFunc });
|
|
55
|
-
}
|
|
56
|
-
layout.TableAggregationColumns = tableAggregationColumns;
|
|
57
|
-
}
|
|
58
|
-
export function removeColumnAggregationFromLayout(layout, columnId) {
|
|
59
|
-
if (isPivotLayout(layout)) {
|
|
60
|
-
layout.PivotAggregationColumns = (layout.PivotAggregationColumns || []).filter((entry) => entry.ColumnId !== columnId);
|
|
61
|
-
if (!layout.PivotAggregationColumns?.length) {
|
|
62
|
-
delete layout.PivotAggregationColumns;
|
|
63
|
-
}
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
layout.TableAggregationColumns = (layout.TableAggregationColumns || []).filter((entry) => entry.ColumnId !== columnId);
|
|
67
|
-
if (!layout.TableAggregationColumns?.length) {
|
|
68
|
-
delete layout.TableAggregationColumns;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Whether the Value Aggregation / parameterized agg column menu should be available.
|
|
73
|
-
* Aligns with AG Grid, which only offers value aggregation when the grid is grouped.
|
|
74
|
-
*/
|
|
75
|
-
export function isValueAggregationColumnMenuAvailable(api, layout) {
|
|
76
|
-
const rowGroupColumnCount = api.agGridApi.getRowGroupColumns?.()?.length ?? 0;
|
|
77
|
-
if (rowGroupColumnCount > 0) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
if (isPivotLayout(layout)) {
|
|
81
|
-
return (layout.PivotGroupedColumns?.length ?? 0) > 0;
|
|
82
|
-
}
|
|
83
|
-
return (layout.RowGroupedColumns?.length ?? 0) > 0;
|
|
84
|
-
}
|
|
85
|
-
function getUserAllowedAggFuncsForColumn(api, columnId) {
|
|
86
|
-
const adaptable = api.internalApi.getAdaptableInstance();
|
|
87
|
-
const userColumnAllowed = adaptable?.agGridColumnAdapter?.getUserColDefProperty(columnId, 'allowedAggFuncs');
|
|
88
|
-
const userDefaultColDef = adaptable?.agGridAdapter?.getUserGridOptionsProperty('defaultColDef');
|
|
89
|
-
const userAllowed = userColumnAllowed ?? userDefaultColDef?.allowedAggFuncs;
|
|
90
|
-
return Array.isArray(userAllowed) ? [...userAllowed] : undefined;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Whether a parameterized agg (e.g. `weightedAvg`) may be offered for a column.
|
|
94
|
-
* Uses `allowedAggFuncs` from the user's Grid Options only, not Adaptable's rewritten list.
|
|
95
|
-
*/
|
|
96
|
-
export function isParameterizedAggFuncAllowedForColumn(api, column, agGridAggFuncName) {
|
|
97
|
-
const userAllowedAggFuncs = getUserAllowedAggFuncsForColumn(api, column.columnId);
|
|
98
|
-
if (!userAllowedAggFuncs) {
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
return userAllowedAggFuncs.includes(agGridAggFuncName);
|
|
102
|
-
}
|
|
103
|
-
export function getNumericWeightColumnCandidates(api, valueColumnId) {
|
|
104
|
-
return api.columnApi
|
|
105
|
-
.getNumericColumns()
|
|
106
|
-
.filter((col) => col.columnId !== valueColumnId)
|
|
107
|
-
.map((col) => ({
|
|
108
|
-
columnId: col.columnId,
|
|
109
|
-
friendlyName: col.friendlyName,
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AdaptableColumn } from '../AdaptableState/Common/AdaptableColumn';
|
|
2
|
-
import { AggregationColumnValue, TableAggregationColumns } from '../AdaptableState/Common/AggregationColumns';
|
|
3
|
-
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
4
|
-
export declare function getAdaptableAggFuncNamesForColumn(column: AdaptableColumn): string[];
|
|
5
|
-
export declare function buildAggregationColumnsMap(entries: TableAggregationColumns, allColumnsMap: Record<string, AdaptableColumn | null>): Record<string, string>;
|
|
6
|
-
export declare function resolveAggFuncValueFromWizardSelection(fnName: string): AggregationColumnValue;
|
|
7
|
-
export declare function upsertColumnAggregationEntry(entries: TableAggregationColumns, columnId: string, aggFunc: AggregationColumnValue): TableAggregationColumns;
|
|
8
|
-
export declare function getParameterizedArgColumnLabel(aggFuncName: string): string;
|
|
9
|
-
export declare function formatParameterizedArgSelectionLabel(api: AdaptableApi, valueColumnId: string, aggValue: AggregationColumnValue | undefined): string;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { getAggFuncName, } from '../AdaptableState/Common/AggregationColumns';
|
|
2
|
-
import { getParameterizedAggregationDefinition, getParameterizedAggregationDefinitionByAgGridName, getParameterizedAggregationDefinitions, isParameterizedAggregation, } from './ParameterizedAggregationRegistry';
|
|
3
|
-
export function getAdaptableAggFuncNamesForColumn(column) {
|
|
4
|
-
return getParameterizedAggregationDefinitions()
|
|
5
|
-
.filter((definition) => definition.isAvailableForColumn(column))
|
|
6
|
-
.map((definition) => definition.agGridAggFuncName);
|
|
7
|
-
}
|
|
8
|
-
export function buildAggregationColumnsMap(entries, allColumnsMap) {
|
|
9
|
-
return (entries || []).reduce((acc, { ColumnId: colId, AggFunc }) => {
|
|
10
|
-
if (typeof AggFunc === 'boolean') {
|
|
11
|
-
const defaultFn = allColumnsMap[colId]?.aggregationFunction;
|
|
12
|
-
acc[colId] = typeof defaultFn === 'string' ? defaultFn : '';
|
|
13
|
-
}
|
|
14
|
-
else if (isParameterizedAggregation(AggFunc)) {
|
|
15
|
-
const fnName = getAggFuncName(AggFunc);
|
|
16
|
-
acc[colId] = typeof fnName === 'string' ? fnName : '';
|
|
17
|
-
}
|
|
18
|
-
else if (typeof AggFunc === 'string') {
|
|
19
|
-
acc[colId] = AggFunc;
|
|
20
|
-
}
|
|
21
|
-
return acc;
|
|
22
|
-
}, {});
|
|
23
|
-
}
|
|
24
|
-
export function resolveAggFuncValueFromWizardSelection(fnName) {
|
|
25
|
-
const definition = getParameterizedAggregationDefinitionByAgGridName(fnName);
|
|
26
|
-
if (definition) {
|
|
27
|
-
return definition.createInitialDefinition();
|
|
28
|
-
}
|
|
29
|
-
return fnName;
|
|
30
|
-
}
|
|
31
|
-
export function upsertColumnAggregationEntry(entries, columnId, aggFunc) {
|
|
32
|
-
let aggCols = [...(entries || [])];
|
|
33
|
-
let found = false;
|
|
34
|
-
aggCols = aggCols.map((entry) => {
|
|
35
|
-
if (entry.ColumnId === columnId) {
|
|
36
|
-
found = true;
|
|
37
|
-
return { ColumnId: columnId, AggFunc: aggFunc };
|
|
38
|
-
}
|
|
39
|
-
return entry;
|
|
40
|
-
});
|
|
41
|
-
if (!found) {
|
|
42
|
-
aggCols.push({ ColumnId: columnId, AggFunc: aggFunc });
|
|
43
|
-
}
|
|
44
|
-
return aggCols;
|
|
45
|
-
}
|
|
46
|
-
export function getParameterizedArgColumnLabel(aggFuncName) {
|
|
47
|
-
return getParameterizedAggregationDefinitionByAgGridName(aggFuncName)?.argColumnLabel ?? 'Argument';
|
|
48
|
-
}
|
|
49
|
-
export function formatParameterizedArgSelectionLabel(api, valueColumnId, aggValue) {
|
|
50
|
-
if (!isParameterizedAggregation(aggValue)) {
|
|
51
|
-
return 'Select';
|
|
52
|
-
}
|
|
53
|
-
const definition = getParameterizedAggregationDefinition(aggValue.type);
|
|
54
|
-
if (!definition) {
|
|
55
|
-
return 'Select';
|
|
56
|
-
}
|
|
57
|
-
if (definition.isComplete(aggValue) && definition.formatSummaryLabel) {
|
|
58
|
-
const shortLabel = definition.formatSummaryLabel(api, valueColumnId, aggValue);
|
|
59
|
-
const argPart = shortLabel.match(/\(([^)]+)\)/)?.[1];
|
|
60
|
-
if (argPart?.includes('-')) {
|
|
61
|
-
return argPart.split('-').slice(1).join('-');
|
|
62
|
-
}
|
|
63
|
-
return argPart ?? 'Select';
|
|
64
|
-
}
|
|
65
|
-
return `Select ${definition.argColumnLabel ?? 'value'}`;
|
|
66
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Layout, PivotLayout, TableLayout } from '../AdaptableState/LayoutState';
|
|
2
|
-
export declare function validateParameterizedAggregationsInLayout(layout: Layout): true | string;
|
|
3
|
-
export declare function validateTableLayoutAggregations(layout: TableLayout): true | string;
|
|
4
|
-
export declare function validatePivotLayoutAggregations(layout: PivotLayout): true | string;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { getParameterizedAggregationDefinition, isParameterizedAggregation, } from './ParameterizedAggregationRegistry';
|
|
2
|
-
import { getAggregationColumnsFromLayout } from './parameterizedAggregationHelpers';
|
|
3
|
-
export function validateParameterizedAggregationsInLayout(layout) {
|
|
4
|
-
const entries = getAggregationColumnsFromLayout(layout) || [];
|
|
5
|
-
for (const { AggFunc } of entries) {
|
|
6
|
-
if (isParameterizedAggregation(AggFunc)) {
|
|
7
|
-
const definition = getParameterizedAggregationDefinition(AggFunc.type);
|
|
8
|
-
if (definition && !definition.isComplete(AggFunc)) {
|
|
9
|
-
return `${definition.label} requires all arguments to be selected.`;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
export function validateTableLayoutAggregations(layout) {
|
|
16
|
-
return validateParameterizedAggregationsInLayout(layout);
|
|
17
|
-
}
|
|
18
|
-
export function validatePivotLayoutAggregations(layout) {
|
|
19
|
-
return validateParameterizedAggregationsInLayout(layout);
|
|
20
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { AdaptableColumn } from '../../../../AdaptableState/Common/AdaptableColumn';
|
|
3
|
-
import { AggregationColumnValue, TableAggregationColumns } from '../../../../AdaptableState/Common/AggregationColumns';
|
|
4
|
-
export declare const ParameterizedAggFuncPicker: React.FunctionComponent<{
|
|
5
|
-
column: AdaptableColumn;
|
|
6
|
-
aggValue?: AggregationColumnValue;
|
|
7
|
-
aggregationColumnsMap: Record<string, string>;
|
|
8
|
-
numberColumns: AdaptableColumn[];
|
|
9
|
-
aggregationEntries: TableAggregationColumns;
|
|
10
|
-
onChangeEntries: (entries: TableAggregationColumns) => void;
|
|
11
|
-
availableAggregationFunctions?: string[];
|
|
12
|
-
}>;
|