@adaptabletools/adaptable-cjs 23.0.0-canary.4 → 23.0.0-canary.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +117 -62
- package/package.json +9 -4
- package/src/AdaptableOptions/EditOptions.d.ts +2 -2
- package/src/AdaptableState/Common/AggregationColumns.d.ts +14 -6
- package/src/AdaptableState/Common/AggregationColumns.js +30 -3
- package/src/AdaptableState/Common/ColumnScope.d.ts +4 -0
- package/src/AdaptableState/Common/Enums.d.ts +5 -5
- package/src/AdaptableState/Common/Enums.js +4 -4
- package/src/AdaptableState/PlusMinusState.d.ts +3 -3
- package/src/AdaptableState/ShortcutState.d.ts +2 -6
- package/src/AdaptableState/StyledColumnState.d.ts +3 -5
- package/src/AdaptableState/ThemeState.d.ts +33 -28
- package/src/Api/EventApi.d.ts +14 -1
- package/src/Api/Events/ThemeChanged.d.ts +6 -0
- package/src/Api/Events/ThemeSelected.d.ts +11 -0
- package/src/Api/Events/ThemeSelected.js +2 -0
- package/src/Api/Implementation/EventApiImpl.js +4 -0
- package/src/Api/Implementation/LayoutApiImpl.d.ts +0 -2
- package/src/Api/Implementation/LayoutApiImpl.js +0 -14
- package/src/Api/Implementation/LayoutHelpers.d.ts +2 -0
- package/src/Api/Implementation/LayoutHelpers.js +19 -8
- package/src/Api/Implementation/ThemeApiImpl.d.ts +3 -2
- package/src/Api/Implementation/ThemeApiImpl.js +19 -15
- package/src/Api/Internal/EventInternalApi.d.ts +2 -0
- package/src/Api/Internal/EventInternalApi.js +8 -1
- package/src/Api/Internal/StyledColumnInternalApi.d.ts +4 -4
- package/src/Api/Internal/StyledColumnInternalApi.js +4 -4
- package/src/Api/Internal/ThemeInternalApi.d.ts +0 -1
- package/src/Api/Internal/ThemeInternalApi.js +0 -10
- package/src/Api/LayoutApi.d.ts +1 -8
- package/src/Api/ThemeApi.d.ts +6 -2
- package/src/Redux/ActionsReducers/ThemeRedux.d.ts +3 -3
- package/src/Strategy/FormatColumnModule.js +12 -5
- package/src/Strategy/LayoutModule.js +13 -8
- package/src/Strategy/StyledColumnModule.js +58 -30
- package/src/Utilities/Constants/ReduxConstants.d.ts +2 -2
- package/src/Utilities/Constants/ReduxConstants.js +1 -14
- package/src/Utilities/Helpers/FormatHelper.js +20 -1
- package/src/Utilities/Helpers/SparklineOptionsHelper.d.ts +7 -0
- package/src/Utilities/Helpers/SparklineOptionsHelper.js +68 -0
- package/src/Utilities/Helpers/StyledColumnGradientHelper.d.ts +23 -1
- package/src/Utilities/Helpers/StyledColumnGradientHelper.js +212 -1
- package/src/Utilities/Helpers/ThemeHelpers.d.ts +5 -0
- package/src/Utilities/Helpers/ThemeHelpers.js +43 -0
- package/src/Utilities/Helpers/percentBarPreviewHelper.d.ts +19 -0
- package/src/Utilities/Helpers/percentBarPreviewHelper.js +155 -0
- package/src/Utilities/ObjectFactory.d.ts +1 -3
- package/src/Utilities/ObjectFactory.js +0 -9
- package/src/Utilities/Services/ThemeService.js +1 -1
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +17 -16
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +113 -102
- package/src/View/Alert/Wizard/AlertMessageWizardSection.js +12 -13
- package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +54 -54
- package/src/View/Alert/Wizard/AlertRulesWizardSection.js +4 -3
- package/src/View/Alert/Wizard/AlertScheduledWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +29 -37
- package/src/View/Alert/Wizard/AlertTypeWizardSection.js +2 -3
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +9 -13
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +28 -15
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +7 -9
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +2 -2
- package/src/View/CellSummary/CellSummaryViewPanel.js +1 -1
- package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.js +3 -10
- package/src/View/Charting/ChartingWizard/AgChargingWizard/PreviewChartSection.js +1 -1
- package/src/View/Charting/ChartingWizard/AgChargingWizard/SettingsSection.js +32 -41
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.js +4 -31
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/PreviewChartSection.d.ts +5 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/PreviewChartSection.js +26 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.d.ts +1 -0
- package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +9 -6
- package/src/View/Comments/CommentsEditor.js +1 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInput.js +0 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInputList.js +3 -1
- package/src/View/Components/ModuleProfile.js +1 -1
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +1 -2
- package/src/View/Components/RangesComponent.d.ts +7 -2
- package/src/View/Components/RangesComponent.js +94 -22
- package/src/View/Components/StyleComponent.d.ts +1 -0
- package/src/View/Components/StyleComponent.js +1 -1
- package/src/View/Components/ValueSelector/index.js +70 -57
- package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +8 -13
- package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +8 -8
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -1
- package/src/View/DataImport/DataImportWizard/sections/ColumnsSection.js +11 -12
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadSection.js +5 -4
- package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadTextSection.js +2 -1
- package/src/View/DataImport/DataImportWizard/sections/ValidationSection.js +4 -15
- package/src/View/Export/Wizard/ReportColumnsWizardSection.js +24 -27
- package/src/View/Export/Wizard/ReportNameWizardSection.js +8 -11
- package/src/View/Export/Wizard/ReportRowsWizardSection.js +19 -22
- package/src/View/Export/Wizard/ScheduledReportSettings.d.ts +2 -0
- package/src/View/Export/Wizard/ScheduledReportSettings.js +12 -12
- package/src/View/Export/Wizard/ScheduledReportWizard.js +2 -3
- package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +8 -6
- package/src/View/FlashingCell/Wizard/FlashingCellScopeWizardSection.js +19 -20
- package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +20 -11
- package/src/View/FlashingCell/Wizard/FlashingCellStyleWizardSection.js +19 -3
- package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +4 -4
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +7 -0
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +120 -13
- package/src/View/FormatColumn/Wizard/FormatColumnPreview.d.ts +15 -0
- package/src/View/FormatColumn/Wizard/FormatColumnPreview.js +78 -0
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.d.ts +4 -0
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +34 -0
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +11 -6
- package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +3 -1
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +64 -13
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +3 -1
- package/src/View/FreeTextColumn/Utilities/getFreeTextColumnSettingsTags.d.ts +2 -0
- package/src/View/FreeTextColumn/Utilities/getFreeTextColumnSettingsTags.js +19 -0
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnDefinitionWizardSection.d.ts +10 -0
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnDefinitionWizardSection.js +60 -0
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +2 -3
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +35 -70
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +14 -10
- package/src/View/Layout/TransposedPopup.js +2 -2
- package/src/View/Layout/Wizard/LayoutWizard.js +3 -3
- package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +2 -3
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +116 -26
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +79 -79
- package/src/View/Layout/Wizard/sections/FilterSection.js +31 -32
- package/src/View/Layout/Wizard/sections/GridFilterSection.js +10 -10
- package/src/View/Layout/Wizard/sections/PivotAggregationsSection.d.ts +1 -2
- package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +101 -51
- package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +9 -8
- package/src/View/Layout/Wizard/sections/PivotRowGroupingSection.js +4 -4
- package/src/View/Layout/Wizard/sections/RowGroupingSection.js +36 -33
- package/src/View/Layout/Wizard/sections/RowSelectionSection.js +2 -2
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +95 -73
- package/src/View/Layout/Wizard/sections/SettingsSection.js +3 -4
- package/src/View/Layout/Wizard/sections/SortSection.js +2 -2
- package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
- package/src/View/NamedQuery/Wizard/NamedQuerySettingsWizardSection.js +7 -12
- package/src/View/NamedQuery/Wizard/NamedQueryWizard.js +1 -3
- package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.d.ts +4 -0
- package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +45 -12
- package/src/View/PlusMinus/Wizard/PlusMinusScopeWizardSection.js +10 -17
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.d.ts +2 -6
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +5 -21
- package/src/View/PlusMinus/Wizard/PlusMinusWizard.js +15 -21
- package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +2 -2
- package/src/View/Shortcut/Wizard/ShortcutScopeWizardSection.js +10 -17
- package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +16 -5
- package/src/View/Shortcut/Wizard/ShortcutWizard.js +2 -2
- package/src/View/Shortcut/shortcutOperations.d.ts +3 -0
- package/src/View/Shortcut/shortcutOperations.js +32 -1
- package/src/View/SpecialColumnSettingsWizardStep.js +7 -6
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.js +26 -16
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.d.ts +10 -2
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +100 -15
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +14 -0
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.js +48 -25
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.d.ts +2 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +109 -33
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +20 -12
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +124 -23
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.d.ts +1 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.js +35 -11
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +88 -11
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +125 -35
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.d.ts +1 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.js +55 -74
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.js +20 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/GradientSummaryPreview.js +6 -12
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarColumnComparisonPreview.js +5 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarRangesPreview.js +2 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarStylePreview.d.ts +5 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarStylePreview.js +11 -13
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.js +20 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.d.ts +3 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.js +32 -3
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.d.ts +9 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.js +64 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview.d.ts +10 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview.js +35 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.d.ts +10 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.js +96 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.d.ts +8 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.js +57 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.d.ts +8 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.js +58 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.d.ts +18 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.js +66 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview.d.ts +10 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview.js +133 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardRangesSection.js +12 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.d.ts +1 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +53 -29
- package/src/View/SystemStatus/Utilities/getStatusItemStyle.js +1 -1
- package/src/View/Theme/ThemePopup.d.ts +2 -14
- package/src/View/Theme/ThemePopup.js +1 -36
- package/src/View/UIHelper.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +6 -20
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -0
- package/src/agGrid/AdaptableAgGrid.js +34 -24
- package/src/agGrid/AgGridAdapter.d.ts +1 -1
- package/src/agGrid/AgGridAdapter.js +27 -17
- package/src/agGrid/AgGridColumnAdapter.js +9 -15
- package/src/agGrid/AgGridMenuAdapter.d.ts +0 -1
- package/src/agGrid/AgGridMenuAdapter.js +20 -37
- package/src/agGrid/buildValueAggregationMenuItem.d.ts +19 -0
- package/src/agGrid/buildValueAggregationMenuItem.js +114 -0
- package/src/agGrid/cellRenderers/IconRenderer.d.ts +6 -0
- package/src/agGrid/cellRenderers/IconRenderer.js +46 -17
- package/src/agGrid/createAgGridIcon.d.ts +10 -0
- package/src/agGrid/createAgGridIcon.js +19 -0
- package/src/components/DragAndDropContext/UnusedPanel.js +1 -1
- package/src/components/ExpressionEditor/BaseEditorInput.js +1 -1
- package/src/components/ExpressionEditor/ExpressionFunctionDocumentation.js +1 -1
- package/src/components/Input/NumberInput.js +1 -1
- package/src/components/Panel/index.js +1 -1
- package/src/components/SimpleButton/index.js +4 -4
- package/src/components/Toggle/Toggle.js +1 -1
- package/src/components/Toggle/ToggleGroup.js +1 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.js +2 -9
- package/src/metamodel/adaptable.metamodel.d.ts +39 -29
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +5 -4
- package/themes/dark.css +1 -68
- package/themes/light.css +1 -5
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/src/Aggregation/ParameterizedAggregationRegistry.d.ts +0 -35
- package/src/Aggregation/ParameterizedAggregationRegistry.js +0 -74
- package/src/Aggregation/definitions/weightedAverageAggregationDefinition.d.ts +0 -3
- package/src/Aggregation/definitions/weightedAverageAggregationDefinition.js +0 -58
- package/src/Aggregation/parameterizedAggregationColumnMenu.d.ts +0 -8
- package/src/Aggregation/parameterizedAggregationColumnMenu.js +0 -143
- package/src/Aggregation/parameterizedAggregationHeader.d.ts +0 -13
- package/src/Aggregation/parameterizedAggregationHeader.js +0 -65
- package/src/Aggregation/parameterizedAggregationHelpers.d.ts +0 -23
- package/src/Aggregation/parameterizedAggregationHelpers.js +0 -121
- package/src/Aggregation/parameterizedAggregationWizardHelpers.d.ts +0 -9
- package/src/Aggregation/parameterizedAggregationWizardHelpers.js +0 -74
- package/src/Aggregation/validateParameterizedAggregations.d.ts +0 -4
- package/src/Aggregation/validateParameterizedAggregations.js +0 -25
- package/src/View/Layout/Wizard/sections/ParameterizedAggFuncPicker.d.ts +0 -12
- package/src/View/Layout/Wizard/sections/ParameterizedAggFuncPicker.js +0 -48
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.d.ts +0 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.js +0 -32
- package/src/View/Theme/VariantSelector.d.ts +0 -8
- package/src/View/Theme/VariantSelector.js +0 -25
|
@@ -14,7 +14,7 @@ export interface RangesComponentProps extends React.ClassAttributes<RangesCompon
|
|
|
14
14
|
minMaxRangeValues: {
|
|
15
15
|
min: number;
|
|
16
16
|
max: number;
|
|
17
|
-
};
|
|
17
|
+
} | null;
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
/**
|
|
20
20
|
* When true, the user may delete every band so `ranges` becomes `[]`.
|
|
@@ -45,7 +45,7 @@ export interface RangesComponentProps extends React.ClassAttributes<RangesCompon
|
|
|
45
45
|
showRangeDirection?: boolean;
|
|
46
46
|
}
|
|
47
47
|
export interface RangesComponentState {
|
|
48
|
-
rangesType: 'NumberRange' | 'PercentageRange' | 'ZeroCentred' | 'ColumnComparison';
|
|
48
|
+
rangesType: 'None' | 'NumberRange' | 'PercentageRange' | 'ZeroCentred' | 'ColumnComparison';
|
|
49
49
|
}
|
|
50
50
|
export declare class RangesComponent extends React.Component<RangesComponentProps, RangesComponentState> {
|
|
51
51
|
constructor(props: RangesComponentProps);
|
|
@@ -60,6 +60,11 @@ export declare class RangesComponent extends React.Component<RangesComponentProp
|
|
|
60
60
|
setRangeColMin(range: CellColorRange): void;
|
|
61
61
|
setRangeColMax(range: CellColorRange): void;
|
|
62
62
|
addRange(): void;
|
|
63
|
+
/**
|
|
64
|
+
* When there is exactly one band spanning the full scale (Col-Min→Col-Max or
|
|
65
|
+
* 0→100), split at the midpoint instead of at the column maximum.
|
|
66
|
+
*/
|
|
67
|
+
private splitFullSpanRangeAtMidpoint;
|
|
63
68
|
changeColumnComparisonMinValue(value: number): void;
|
|
64
69
|
private onMinColumnSelectedChanged;
|
|
65
70
|
changeColumnComparisonMaxValue(value: number): void;
|
|
@@ -19,14 +19,16 @@ const DEFAULT_ZERO_CENTRED_COLORS = {
|
|
|
19
19
|
NegativeColor: 'rgba(220, 53, 69, 0.55)',
|
|
20
20
|
PositiveColor: 'rgba(40, 167, 69, 0.55)',
|
|
21
21
|
};
|
|
22
|
+
const hasConfiguredRanges = (ranges) => (ranges?.length ?? 0) > 0;
|
|
22
23
|
/**
|
|
23
|
-
* Decide which
|
|
24
|
+
* Decide which range tab should be active given the current props.
|
|
24
25
|
*
|
|
25
26
|
* Precedence:
|
|
26
27
|
* 1. `columnComparison` set → Column Comparison tab
|
|
27
28
|
* 2. Zero Centred set + supported → Zero Centred tab
|
|
28
|
-
* 3. `
|
|
29
|
-
* 4.
|
|
29
|
+
* 3. `allowEmptyRanges` + no bands → No Ranges tab
|
|
30
|
+
* 4. `rangeValueType === 'Percentage'` → Percentage Range tab
|
|
31
|
+
* 5. otherwise → Number Range tab (default for new styles)
|
|
30
32
|
*/
|
|
31
33
|
function deriveInitialRangesType(props) {
|
|
32
34
|
if (props.columnComparison) {
|
|
@@ -35,6 +37,9 @@ function deriveInitialRangesType(props) {
|
|
|
35
37
|
if (props.showZeroCentredTab && props.zeroCentred) {
|
|
36
38
|
return 'ZeroCentred';
|
|
37
39
|
}
|
|
40
|
+
if (props.allowEmptyRanges && !hasConfiguredRanges(props.ranges)) {
|
|
41
|
+
return 'None';
|
|
42
|
+
}
|
|
38
43
|
return props.rangeValueType === 'Percentage' ? 'PercentageRange' : 'NumberRange';
|
|
39
44
|
}
|
|
40
45
|
class RangesComponent extends React.Component {
|
|
@@ -70,6 +75,7 @@ class RangesComponent extends React.Component {
|
|
|
70
75
|
// vs Percentage Range tab) instead of an inline radio. The inner content
|
|
71
76
|
// is shared between the two range tabs and parameterised on this flag.
|
|
72
77
|
const isRangeValueTypeNumber = this.state.rangesType === 'NumberRange';
|
|
78
|
+
const renderNoneContent = () => ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-2 twa:opacity-70 twa:py-2 twa:max-w-[520px]", children: "No coloured bands configured" }));
|
|
73
79
|
const renderRangesContent = () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [this.props.ranges?.map((range, index, list) => ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignItems: "end", className: "twa:mb-2", "data-name": "percent-bar-range", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", children: [isRangeValueTypeNumber && index === 0 && ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { onClick: () => this.setRangeColMin(range), checked: range.Min === 'Col-Min', className: "twa:mt-0 twa:mb-1 twa:text-3", disabled: this.props.disabled, children: "Col Min" })), (0, jsx_runtime_1.jsx)(NumberInput_1.NumberInput, { disabled: this.props.disabled ||
|
|
74
80
|
range.Min === 'Col-Min' ||
|
|
75
81
|
(index === 0 && !isRangeValueTypeNumber), value: range.Min, onChange: (value) => {
|
|
@@ -101,7 +107,7 @@ class RangesComponent extends React.Component {
|
|
|
101
107
|
const tabFlex = { flex: 1 };
|
|
102
108
|
const radioCls = 'twa:m-0 twa:align-baseline';
|
|
103
109
|
const renderTabRadio = (label, value) => ((0, jsx_runtime_1.jsx)(Radio_1.default, { tabIndex: -1, className: radioCls, checked: this.state.rangesType === value, children: label }));
|
|
104
|
-
return ((0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { autoFocus: false, className: "twa:mt-2", value: this.state.rangesType, onValueChange: (v) => this.handleRangesModeTab(v), children: [(0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { value: "NumberRange", style: tabFlex, children: renderTabRadio('Number Range', 'NumberRange') }), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { value: "PercentageRange", style: tabFlex, children: renderTabRadio('Percentage Range', 'PercentageRange') }), this.props.showZeroCentredTab && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { value: "ZeroCentred", style: tabFlex, children: renderTabRadio('Zero Centred Range', 'ZeroCentred') })), !this.props.hideColumnComparison && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { value: "ColumnComparison", style: tabFlex, children: renderTabRadio('Column Comparison', 'ColumnComparison') })), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Content, { value: "NumberRange", children: renderRangesContent() }), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Content, { value: "PercentageRange", children: renderRangesContent() }), this.props.showZeroCentredTab && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Content, { value: "ZeroCentred", children: renderZeroCentredContent() })), !this.props.hideColumnComparison && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Content, { value: "ColumnComparison", children: renderColumnComparisonContent() }))] }));
|
|
110
|
+
return ((0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { autoFocus: false, className: "twa:mt-2", value: this.state.rangesType, onValueChange: (v) => this.handleRangesModeTab(v), children: [this.props.allowEmptyRanges && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { value: "None", style: tabFlex, children: renderTabRadio('No Ranges', 'None') })), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { value: "NumberRange", style: tabFlex, children: renderTabRadio('Number Range', 'NumberRange') }), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { value: "PercentageRange", style: tabFlex, children: renderTabRadio('Percentage Range', 'PercentageRange') }), this.props.showZeroCentredTab && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { value: "ZeroCentred", style: tabFlex, children: renderTabRadio('Zero Centred Range', 'ZeroCentred') })), !this.props.hideColumnComparison && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { value: "ColumnComparison", style: tabFlex, children: renderTabRadio('Column Comparison', 'ColumnComparison') })), this.props.allowEmptyRanges && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Content, { value: "None", children: renderNoneContent() })), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Content, { value: "NumberRange", children: renderRangesContent() }), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Content, { value: "PercentageRange", children: renderRangesContent() }), this.props.showZeroCentredTab && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Content, { value: "ZeroCentred", children: renderZeroCentredContent() })), !this.props.hideColumnComparison && ((0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Content, { value: "ColumnComparison", children: renderColumnComparisonContent() }))] }));
|
|
105
111
|
}
|
|
106
112
|
componentDidUpdate(prevProps) {
|
|
107
113
|
const wasComparison = !!prevProps.columnComparison;
|
|
@@ -129,12 +135,31 @@ class RangesComponent extends React.Component {
|
|
|
129
135
|
rangesType: this.props.rangeValueType === 'Percentage' ? 'PercentageRange' : 'NumberRange',
|
|
130
136
|
});
|
|
131
137
|
}
|
|
138
|
+
if (this.props.allowEmptyRanges) {
|
|
139
|
+
const hadRanges = hasConfiguredRanges(prevProps.ranges);
|
|
140
|
+
const hasRanges = hasConfiguredRanges(this.props.ranges);
|
|
141
|
+
if (!hadRanges && hasRanges && this.state.rangesType === 'None') {
|
|
142
|
+
this.setState({
|
|
143
|
+
rangesType: this.props.rangeValueType === 'Percentage' ? 'PercentageRange' : 'NumberRange',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
else if (hadRanges &&
|
|
147
|
+
!hasRanges &&
|
|
148
|
+
this.state.rangesType !== 'ColumnComparison' &&
|
|
149
|
+
this.state.rangesType !== 'ZeroCentred') {
|
|
150
|
+
this.setState({ rangesType: 'None' });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
132
153
|
}
|
|
133
154
|
handleRangesModeTab(value) {
|
|
134
155
|
if (value === this.state.rangesType) {
|
|
135
156
|
return;
|
|
136
157
|
}
|
|
137
158
|
this.setState({ rangesType: value });
|
|
159
|
+
if (value === 'None') {
|
|
160
|
+
this.props.updateRanges([]);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
138
163
|
if (value === 'ColumnComparison') {
|
|
139
164
|
const columnComparison = {
|
|
140
165
|
Color: (0, UIHelper_1.getGraySwatchColor)(),
|
|
@@ -202,7 +227,9 @@ class RangesComponent extends React.Component {
|
|
|
202
227
|
setRangeColMin(range) {
|
|
203
228
|
const newRanges = this.props.ranges.map((rangeItem) => {
|
|
204
229
|
if (rangeItem === range) {
|
|
205
|
-
let newMin = rangeItem.Min === 'Col-Min'
|
|
230
|
+
let newMin = rangeItem.Min === 'Col-Min'
|
|
231
|
+
? (this.props.minMaxRangeValues?.min ?? 0)
|
|
232
|
+
: 'Col-Min';
|
|
206
233
|
return {
|
|
207
234
|
...rangeItem,
|
|
208
235
|
Min: newMin,
|
|
@@ -236,32 +263,51 @@ class RangesComponent extends React.Component {
|
|
|
236
263
|
const existingRanges = this.props.ranges ?? [];
|
|
237
264
|
if (existingRanges.length === 0) {
|
|
238
265
|
const isPercentage = this.props.rangeValueType === 'Percentage';
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
266
|
+
const seedRanges = this.props.allowEmptyRanges
|
|
267
|
+
? [
|
|
268
|
+
{
|
|
269
|
+
Min: isPercentage ? 0 : 'Col-Min',
|
|
270
|
+
Max: isPercentage ? 100 : 'Col-Max',
|
|
271
|
+
Color: (0, UIHelper_1.getGraySwatchColor)(),
|
|
272
|
+
},
|
|
273
|
+
]
|
|
274
|
+
: (() => {
|
|
275
|
+
const min = isPercentage ? 0 : this.props.minMaxRangeValues?.min ?? 0;
|
|
276
|
+
const max = isPercentage ? 100 : this.props.minMaxRangeValues?.max ?? 100;
|
|
277
|
+
const mid = Math.round((min + max) / 2);
|
|
278
|
+
return [
|
|
279
|
+
{
|
|
280
|
+
Min: isPercentage ? 0 : 'Col-Min',
|
|
281
|
+
Max: mid,
|
|
282
|
+
Color: 'rgba(128, 128, 128, 0.25)',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
Min: mid,
|
|
286
|
+
Max: isPercentage ? 100 : 'Col-Max',
|
|
287
|
+
Color: 'rgba(128, 128, 128, 0.55)',
|
|
288
|
+
},
|
|
289
|
+
];
|
|
290
|
+
})();
|
|
254
291
|
this.props.updateRanges(seedRanges);
|
|
255
292
|
return;
|
|
256
293
|
}
|
|
294
|
+
// Splitting a single full-width band at the midpoint is easier to reason
|
|
295
|
+
// about than anchoring the break at the column maximum (e.g. tradeId 1–200 → 100).
|
|
296
|
+
if (existingRanges.length === 1) {
|
|
297
|
+
const splitAtMidpoint = this.splitFullSpanRangeAtMidpoint(existingRanges[0]);
|
|
298
|
+
if (splitAtMidpoint) {
|
|
299
|
+
this.props.updateRanges(splitAtMidpoint);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
257
303
|
const lastRange = existingRanges[existingRanges.length - 1];
|
|
258
304
|
let previousRange = lastRange;
|
|
259
305
|
let Min = null;
|
|
260
306
|
if (lastRange.Max === 'Col-Max') {
|
|
261
|
-
Min = this.props.minMaxRangeValues
|
|
307
|
+
Min = this.props.minMaxRangeValues?.max ?? 100;
|
|
262
308
|
previousRange = {
|
|
263
309
|
...previousRange,
|
|
264
|
-
Max: this.props.minMaxRangeValues
|
|
310
|
+
Max: this.props.minMaxRangeValues?.max ?? 100,
|
|
265
311
|
};
|
|
266
312
|
}
|
|
267
313
|
else {
|
|
@@ -275,6 +321,32 @@ class RangesComponent extends React.Component {
|
|
|
275
321
|
const newRanges = [...existingRanges.slice(0, -1), previousRange, newRange];
|
|
276
322
|
this.props.updateRanges(newRanges);
|
|
277
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* When there is exactly one band spanning the full scale (Col-Min→Col-Max or
|
|
326
|
+
* 0→100), split at the midpoint instead of at the column maximum.
|
|
327
|
+
*/
|
|
328
|
+
splitFullSpanRangeAtMidpoint(onlyRange) {
|
|
329
|
+
const isPercentage = this.props.rangeValueType === 'Percentage';
|
|
330
|
+
if (isPercentage) {
|
|
331
|
+
if (onlyRange.Min !== 0 || onlyRange.Max !== 100) {
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
return [
|
|
335
|
+
{ ...onlyRange, Max: 50 },
|
|
336
|
+
{ Min: 50, Max: 100, Color: (0, UIHelper_1.getGraySwatchColor)() },
|
|
337
|
+
];
|
|
338
|
+
}
|
|
339
|
+
if (onlyRange.Min !== 'Col-Min' || onlyRange.Max !== 'Col-Max') {
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
const min = this.props.minMaxRangeValues?.min ?? 0;
|
|
343
|
+
const max = this.props.minMaxRangeValues?.max ?? 100;
|
|
344
|
+
const mid = Math.round((min + max) / 2);
|
|
345
|
+
return [
|
|
346
|
+
{ ...onlyRange, Max: mid },
|
|
347
|
+
{ Min: mid, Max: 'Col-Max', Color: (0, UIHelper_1.getGraySwatchColor)() },
|
|
348
|
+
];
|
|
349
|
+
}
|
|
278
350
|
changeColumnComparisonMinValue(value) {
|
|
279
351
|
const { columnComparison } = this.props;
|
|
280
352
|
columnComparison.MinValue = value;
|
|
@@ -191,6 +191,6 @@ const StyleComponent = (props) => {
|
|
|
191
191
|
label: enumName,
|
|
192
192
|
value: enumName,
|
|
193
193
|
})),
|
|
194
|
-
], value: componentStyle.FontSize?.toString() ?? '', onValueChange: (value) => onFontSizeChange(value) }) }), (0, jsx_runtime_1.jsx)("span", { children: "Alignment" }), (0, jsx_runtime_1.jsxs)(Toggle_1.ToggleGroup, { children: [(0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { icon: "align-left", pressed: componentStyle.Alignment === 'Left', onPressedChange: (pressed) => pressed ? onAlignmentChange('Left') : onAlignmentChange('Default') }), (0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { icon: "align-center", pressed: componentStyle.Alignment === 'Center', onPressedChange: (pressed) => pressed ? onAlignmentChange('Center') : onAlignmentChange('Default') }), (0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { icon: "align-right", pressed: componentStyle.Alignment === 'Right', onPressedChange: (pressed) => pressed ? onAlignmentChange('Right') : onAlignmentChange('Default') })] })] }) }) })), !props.hidePreview && ((0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, children: [(0, jsx_runtime_1.jsx)(Card_1.Card.Title, { children: "Preview" }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:grid twa:place-items-center", children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:p-2 twa:inline-block", children: (0, jsx_runtime_1.jsx)(StylePreview_1.StylePreview, { className: "twa:mt-0", styleObject: componentStyle }) }) })] }))] }));
|
|
194
|
+
], value: componentStyle.FontSize?.toString() ?? '', onValueChange: (value) => onFontSizeChange(value) }) }), (0, jsx_runtime_1.jsx)("span", { children: "Alignment" }), (0, jsx_runtime_1.jsxs)(Toggle_1.ToggleGroup, { children: [(0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { icon: "align-left", pressed: componentStyle.Alignment === 'Left', onPressedChange: (pressed) => pressed ? onAlignmentChange('Left') : onAlignmentChange('Default') }), (0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { icon: "align-center", pressed: componentStyle.Alignment === 'Center', onPressedChange: (pressed) => pressed ? onAlignmentChange('Center') : onAlignmentChange('Default') }), (0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { icon: "align-right", pressed: componentStyle.Alignment === 'Right', onPressedChange: (pressed) => pressed ? onAlignmentChange('Right') : onAlignmentChange('Default') })] })] }) }) })), !props.hidePreview && ((0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, children: [(0, jsx_runtime_1.jsx)(Card_1.Card.Title, { children: "Preview" }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:grid twa:place-items-center", children: (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:p-2 twa:inline-block", children: (0, jsx_runtime_1.jsx)(StylePreview_1.StylePreview, { className: "twa:mt-0", styleObject: componentStyle, children: props.previewText }) }) })] }))] }));
|
|
195
195
|
};
|
|
196
196
|
exports.StyleComponent = StyleComponent;
|
|
@@ -51,40 +51,66 @@ function ValueSelector(props) {
|
|
|
51
51
|
toIdentifier,
|
|
52
52
|
value,
|
|
53
53
|
});
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const reorderEnabled = allowReorder !== false;
|
|
55
|
+
const commitSelection = (0, react_1.useCallback)((nextMap) => {
|
|
56
|
+
const newSelection = [...nextMap.keys()];
|
|
56
57
|
if (!newSelection.length && selectedOnly) {
|
|
57
58
|
setSelectedOnly(false);
|
|
58
59
|
}
|
|
59
|
-
onChange(newSelection,
|
|
60
|
-
}, [onChange, selectedOnly,
|
|
60
|
+
onChange(newSelection, nextMap);
|
|
61
|
+
}, [onChange, selectedOnly, setSelectedOnly]);
|
|
62
|
+
const updateSelection = (0, react_1.useCallback)((updater) => {
|
|
63
|
+
const nextMap = new Map(selectedMap);
|
|
64
|
+
updater(nextMap);
|
|
65
|
+
commitSelection(nextMap);
|
|
66
|
+
}, [commitSelection, selectedMap]);
|
|
67
|
+
const filteredOptions = (0, react_1.useMemo)(() => {
|
|
68
|
+
return options.filter((option) => {
|
|
69
|
+
let result = true;
|
|
70
|
+
if (filter) {
|
|
71
|
+
result = filter(option, searchInputValue);
|
|
72
|
+
}
|
|
73
|
+
result = result && (selectedOnly ? selectedMap.has(toIdentifier(option)) : true);
|
|
74
|
+
return result;
|
|
75
|
+
});
|
|
76
|
+
}, [filter, options, searchInputValue, selectedMap, selectedOnly, toIdentifier]);
|
|
77
|
+
const renderOptionRow = (option, index, reorderable, itemDomProps) => {
|
|
78
|
+
const identifier = toIdentifier(option);
|
|
79
|
+
const label = !reorderEnabled ? preparedToLabel(option) : null;
|
|
80
|
+
const { onPointerDown, className: itemClassName, ...restDomProps } = itemDomProps ?? {};
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignItems: "center", "data-index": index, "data-id": identifier, "data-name": "option", ...restDomProps, className: (0, clsx_1.default)('twa:bg-primary twa:text-primary-foreground twa:rounded-standard twa:p-2', {
|
|
82
|
+
'twa:mt-1': index,
|
|
83
|
+
'twa:mt-0': !index,
|
|
84
|
+
}, itemClassName, `${baseClassName}__option`), children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", className: "twa:flex-1", children: [reorderable ? ((0, jsx_runtime_1.jsx)(Flex_1.Box, { onPointerDown: onPointerDown, className: "twa:mr-3", children: (0, jsx_runtime_1.jsx)(icons_1.Icon, { name: "drag", style: { cursor: 'grab' } }) })) : null, singleSelect ? ((0, jsx_runtime_1.jsx)(Radio_1.default, { checked: selectedMap.has(identifier), "data-name": identifier, onChange: (checked) => {
|
|
85
|
+
updateSelection((next) => {
|
|
86
|
+
next.clear();
|
|
87
|
+
if (checked) {
|
|
88
|
+
next.set(identifier, option);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}, children: label })) : ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { "data-name": identifier, disabled: disabled || (isOptionDisabled ? isOptionDisabled(option) : false), onChange: (checked) => {
|
|
92
|
+
updateSelection((next) => {
|
|
93
|
+
if (checked) {
|
|
94
|
+
next.set(identifier, option);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
next.delete(identifier);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}, checked: selectedMap.has(identifier), children: label })), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:ml-2 twa:flex-1", children: reorderEnabled ? preparedToLabel(option) : null })] }) }));
|
|
101
|
+
};
|
|
61
102
|
const renderOption = (option, index) => {
|
|
62
103
|
const identifier = toIdentifier(option);
|
|
63
|
-
const label = !allowReorder ? preparedToLabel(option) : null;
|
|
64
104
|
const reorderable = typeof allowReorder === 'function' ? allowReorder(option) : allowReorder;
|
|
105
|
+
if (!reorderEnabled) {
|
|
106
|
+
return ((0, jsx_runtime_1.jsx)(React.Fragment, { children: renderOptionRow(option, index, false) }, identifier));
|
|
107
|
+
}
|
|
65
108
|
return ((0, jsx_runtime_1.jsx)(dnd_1.DragList.DraggableItem, { id: `${identifier}`, children: (itemDomProps) => {
|
|
66
109
|
const { onPointerDown, ...restDomProps } = itemDomProps;
|
|
67
|
-
return (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (checked) {
|
|
72
|
-
selectedMap.clear();
|
|
73
|
-
selectedMap.set(identifier, option);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
selectedMap.delete(identifier);
|
|
77
|
-
}
|
|
78
|
-
notifyChange();
|
|
79
|
-
}, children: label })) : ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { "data-name": identifier, disabled: disabled || (isOptionDisabled ? isOptionDisabled(option) : false), onChange: (checked) => {
|
|
80
|
-
if (checked) {
|
|
81
|
-
selectedMap.set(identifier, option);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
selectedMap.delete(identifier);
|
|
85
|
-
}
|
|
86
|
-
notifyChange();
|
|
87
|
-
}, checked: selectedMap.has(identifier), children: label })), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:ml-2 twa:flex-1", children: allowReorder ? preparedToLabel(option) : null })] }) }));
|
|
110
|
+
return renderOptionRow(option, index, reorderable, {
|
|
111
|
+
onPointerDown: reorderable ? onPointerDown : undefined,
|
|
112
|
+
...restDomProps,
|
|
113
|
+
});
|
|
88
114
|
} }, identifier));
|
|
89
115
|
};
|
|
90
116
|
const showOnlySelectedCheckbox = ((0, jsx_runtime_1.jsx)(CheckBox_1.CheckBox, { disabled: !value.length, checked: selectedOnly, onChange: setSelectedOnly, children: showSelectedOnlyLabel ?? 'Show Selected Only' }));
|
|
@@ -92,60 +118,47 @@ function ValueSelector(props) {
|
|
|
92
118
|
...props,
|
|
93
119
|
showOnlySelectedCheckbox,
|
|
94
120
|
onSelectAll: () => {
|
|
95
|
-
|
|
96
|
-
|
|
121
|
+
updateSelection((next) => {
|
|
122
|
+
options.forEach((option) => {
|
|
123
|
+
next.set(toIdentifier(option), option);
|
|
124
|
+
});
|
|
97
125
|
});
|
|
98
|
-
notifyChange();
|
|
99
126
|
},
|
|
100
127
|
onClearOption: (id) => {
|
|
101
|
-
|
|
102
|
-
|
|
128
|
+
updateSelection((next) => {
|
|
129
|
+
next.delete(id);
|
|
130
|
+
});
|
|
103
131
|
},
|
|
104
132
|
onClear: () => {
|
|
105
|
-
|
|
106
|
-
|
|
133
|
+
updateSelection((next) => {
|
|
134
|
+
next.clear();
|
|
135
|
+
});
|
|
107
136
|
},
|
|
108
137
|
};
|
|
109
|
-
|
|
138
|
+
const optionList = ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: `${baseClassName}__body twa:flex-1 twa:overflow-auto`, flexDirection: "column", children: (0, jsx_runtime_1.jsx)("div", { children: filteredOptions.map(renderOption) }) }));
|
|
139
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { style: props.style, className: (0, clsx_1.default)('twa:flex-1', baseClassName), flexDirection: "column", children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: "twa:mb-1", children: showFilterInput && filter ? ((0, jsx_runtime_1.jsx)(AdaptableFormControlTextClear_1.AdaptableFormControlTextClear, { value: searchInputValue, OnTextChange: setSearchInputValue, placeholder: "Type to search", inputClassName: "twa:p-3", className: "twa:flex-1 twa:m-[3px]" })) : ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1" })) }), (0, exports.renderSelectionSection)(selectionSectionProps), reorderEnabled ? ((0, jsx_runtime_1.jsx)(dnd_1.DragDropProvider, { children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { className: `${baseClassName}__body twa:flex-1 twa:overflow-auto`, flexDirection: "column", children: (0, jsx_runtime_1.jsx)(dnd_1.DragList, { dragListId: "value-selector", orientation: "vertical", onDragProxyMove: dnd_1.defaultDragProxyMove, onDragProxySetup: ({ proxyElement }) => {
|
|
110
140
|
proxyElement.classList.add('twa:shadow-md');
|
|
111
141
|
}, onDrop: (_sortedIndexes) => {
|
|
112
142
|
const selection = [];
|
|
113
143
|
const extraKeys = [];
|
|
114
|
-
for (const [key,
|
|
115
|
-
if (
|
|
144
|
+
for (const [key, mapValue] of selectedMap) {
|
|
145
|
+
if (mapValue != null) {
|
|
116
146
|
selection.push(key);
|
|
117
147
|
}
|
|
118
148
|
else {
|
|
119
|
-
// null/non-existent keys have to be stored separately
|
|
120
149
|
extraKeys.push(key);
|
|
121
150
|
}
|
|
122
151
|
}
|
|
123
|
-
const clone = new Map(selectedMap);
|
|
124
|
-
// const newSelection: ID_TYPE[] = ArrayExtensions.reorderArray(
|
|
125
|
-
// selection,
|
|
126
|
-
// dragIndex,
|
|
127
|
-
// dropIndex
|
|
128
|
-
// );
|
|
129
152
|
const newSelection = _sortedIndexes
|
|
130
153
|
.map((index) => selection[index])
|
|
131
154
|
.filter((x) => x != null);
|
|
132
155
|
newSelection.push(...extraKeys);
|
|
133
|
-
|
|
156
|
+
const nextMap = new Map();
|
|
134
157
|
newSelection.forEach((key) => {
|
|
135
|
-
|
|
158
|
+
nextMap.set(key, selectedMap.get(key));
|
|
136
159
|
});
|
|
137
|
-
|
|
138
|
-
}, children: (listDomProps) => (
|
|
139
|
-
.filter((option) => {
|
|
140
|
-
let result = true;
|
|
141
|
-
if (filter) {
|
|
142
|
-
result = filter(option, searchInputValue);
|
|
143
|
-
}
|
|
144
|
-
result =
|
|
145
|
-
result && (selectedOnly ? selectedMap.has(toIdentifier(option)) : true);
|
|
146
|
-
return result;
|
|
147
|
-
})
|
|
148
|
-
.map(renderOption) })) }) }) })] }));
|
|
160
|
+
commitSelection(nextMap);
|
|
161
|
+
}, children: (listDomProps) => (0, jsx_runtime_1.jsx)("div", { ...listDomProps, children: filteredOptions.map(renderOption) }) }) }) })) : (optionList)] }));
|
|
149
162
|
}
|
|
150
163
|
const renderSelectionSection = (props) => {
|
|
151
164
|
const { value, options, disabled, singleSelect, toLabel, toIdentifier, } = props;
|
|
@@ -4,14 +4,13 @@ exports.CustomSortColumnWizardSection = exports.isValidCustomSortColumn = export
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const React = tslib_1.__importStar(require("react"));
|
|
7
|
-
const Tabs_1 = require("../../../components/Tabs");
|
|
8
7
|
const Tag_1 = require("../../../components/Tag");
|
|
9
8
|
const ColumnSelector_1 = require("../../Components/ColumnSelector");
|
|
10
9
|
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
11
10
|
const Flex_1 = require("../../../components/Flex");
|
|
12
|
-
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
|
|
13
11
|
const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
|
|
14
12
|
const AdaptableFormControlTextClear_1 = require("../../Components/Forms/AdaptableFormControlTextClear");
|
|
13
|
+
const Card_1 = require("../../../components/Card");
|
|
15
14
|
const renderCustomSortColumn = (data) => {
|
|
16
15
|
const { api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
17
16
|
return ((0, jsx_runtime_1.jsxs)(Flex_1.Box, { className: "twa:text-2 twa:py-2 twa:pr-2", children: [(0, jsx_runtime_1.jsxs)(Tag_1.Tag, { className: "twa:mr-2", children: ["Name: ", data.Name] }), (0, jsx_runtime_1.jsxs)(Tag_1.Tag, { children: ["Column: ", api.columnApi.getFriendlyNameForColumnId(data.ColumnId)] })] }));
|
|
@@ -34,16 +33,12 @@ const CustomSortColumnWizardSection = (props) => {
|
|
|
34
33
|
const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
35
34
|
const sortableCols = React.useMemo(() => {
|
|
36
35
|
const sortableColumns = api.columnApi.getSortableColumns();
|
|
37
|
-
const nonComparerSortableColumns = sortableColumns.filter((c) => {
|
|
38
|
-
return api.customSortApi.internalApi.columnHasCustomSortComparer(c.columnId);
|
|
39
|
-
});
|
|
40
36
|
const customSorts = api.customSortApi.getCustomSorts();
|
|
41
37
|
const columnSortComparers = api.optionsApi.getCustomSortOptions().customSortComparers || [];
|
|
42
38
|
const usedColumnIds = [
|
|
43
39
|
...customSorts.map((customSort) => customSort.ColumnId),
|
|
44
40
|
...columnSortComparers.map((comparer) => api.columnScopeApi.getColumnIdsInScope(comparer.scope)),
|
|
45
41
|
];
|
|
46
|
-
// filter out used colum ids, but include the current one
|
|
47
42
|
return sortableColumns.filter((column) => {
|
|
48
43
|
if (api.customSortApi.internalApi.columnHasCustomSortComparer(column.columnId)) {
|
|
49
44
|
return false;
|
|
@@ -63,12 +58,12 @@ const CustomSortColumnWizardSection = (props) => {
|
|
|
63
58
|
Name: event.target.value,
|
|
64
59
|
});
|
|
65
60
|
};
|
|
66
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column",
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:h-full", children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:gap-3 twa:p-3 twa:shrink-0", children: (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Name" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Provide a unique name for the Custom Sort" })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:p-1", children: (0, jsx_runtime_1.jsx)(Input_1.default, { className: "twa:max-w-[300px] twa:w-full", "data-name": "custom-sort-name", onChange: onNameChange, value: data?.Name ?? '' }) })] }) }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:flex-1 twa:min-h-0", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", className: "twa:p-2 twa:gap-3 twa:border-b twa:mb-2 twa:border-b-foreground/20", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-5 twa:font-medium", children: "Column" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:max-w-[520px]", children: "Select the column to apply the Custom Sort to" })] }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", className: "twa:px-2 twa:pb-2 twa:gap-2", children: (0, jsx_runtime_1.jsx)(AdaptableFormControlTextClear_1.AdaptableFormControlTextClear, { value: columnsSearchText, OnTextChange: setColumnsSearchText, placeholder: "Type to search columns", className: "twa:flex-1" }) }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1 twa:min-h-0 twa:overflow-auto twa:px-2 twa:pb-2", children: (0, jsx_runtime_1.jsx)(ColumnSelector_1.NewColumnSelector, { columnFilterText: columnsSearchText, availableColumns: sortableCols, selected: data.ColumnId ? [data.ColumnId] : [], singleSelect: true, onChange: (ids) => {
|
|
62
|
+
props.onChange({
|
|
63
|
+
...data,
|
|
64
|
+
SortedValues: [],
|
|
65
|
+
ColumnId: ids[0],
|
|
66
|
+
});
|
|
67
|
+
}, allowReorder: false }) })] })] }));
|
|
73
68
|
};
|
|
74
69
|
exports.CustomSortColumnWizardSection = CustomSortColumnWizardSection;
|
|
@@ -6,7 +6,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const React = tslib_1.__importStar(require("react"));
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const Loader_1 = require("../../../components/Loader");
|
|
9
|
-
const Tabs_1 = require("../../../components/Tabs");
|
|
10
9
|
const join_1 = tslib_1.__importDefault(require("../../../components/utils/join"));
|
|
11
10
|
const runIfNotResolvedIn_1 = require("../../../Utilities/runIfNotResolvedIn");
|
|
12
11
|
const ValueSelector_1 = require("../../Components/ValueSelector");
|
|
@@ -14,6 +13,8 @@ const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
|
14
13
|
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../.././Utilities/Extensions/ArrayExtensions"));
|
|
15
14
|
const DateHelper_1 = require("../../../Utilities/Helpers/DateHelper");
|
|
16
15
|
const Tag_1 = require("../../../components/Tag");
|
|
16
|
+
const Flex_1 = require("../../../components/Flex");
|
|
17
|
+
const Card_1 = require("../../../components/Card");
|
|
17
18
|
const isValidCustomSortOrder = (data) => {
|
|
18
19
|
if (!data.SortedValues || !data.SortedValues.length) {
|
|
19
20
|
return 'At least one value is required for the Custom Sort order.';
|
|
@@ -33,7 +34,6 @@ const CustomSortValuesWizardSection = (props) => {
|
|
|
33
34
|
(0, react_1.useEffect)(() => {
|
|
34
35
|
let isMounted = true;
|
|
35
36
|
(async () => {
|
|
36
|
-
// for sync and very fast resolving promises does not make sense to show a loader
|
|
37
37
|
setDistinctValues([]);
|
|
38
38
|
const newValues = (await (0, runIfNotResolvedIn_1.runIfNotResolvedIn)(api.gridApi.internalApi.getDistinctValuesForColumn(data.ColumnId), () => isMounted && setIsDistinctValuesLoading(true))) ?? [];
|
|
39
39
|
if (!isMounted) {
|
|
@@ -76,11 +76,11 @@ const CustomSortValuesWizardSection = (props) => {
|
|
|
76
76
|
}, [allowReorder, distinctValues, data.SortedValues]);
|
|
77
77
|
const baseClassName = 'ab-CustomSortWizard__SortOrder';
|
|
78
78
|
const className = (0, join_1.default)(baseClassName, isDistinctValuesLoading && `${baseClassName}--loading`);
|
|
79
|
-
return ((0, jsx_runtime_1.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flexDirection: "column", className: "twa:h-full twa:p-3", children: (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, className: (0, join_1.default)('twa:flex-1 twa:min-h-0', className), children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Sort Order" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Specify the custom sort order \u2014 drag selected items to modify order" })] }), (0, jsx_runtime_1.jsxs)(Card_1.Card.Body, { className: "twa:flex-1 twa:min-h-0", children: [isDistinctValuesLoading && (0, jsx_runtime_1.jsx)(Loader_1.Loader, { children: "Loading" }), (0, jsx_runtime_1.jsx)(ValueSelector_1.ValueSelector, { toIdentifier: toIdentifier, toLabel: toLabel, options: options, value: data.SortedValues, allowReorder: allowReorder, onChange: (SortedValues) => {
|
|
80
|
+
props.onChange({
|
|
81
|
+
...data,
|
|
82
|
+
SortedValues,
|
|
83
|
+
});
|
|
84
|
+
} })] })] }) }));
|
|
85
85
|
};
|
|
86
86
|
exports.CustomSortValuesWizardSection = CustomSortValuesWizardSection;
|
|
@@ -198,7 +198,7 @@ const buildGridOptions = (mainAdaptableInstance, changeHistoryLog) => {
|
|
|
198
198
|
const mainPrimaryKeyColumnHeader = mainAdaptableInstance.api.columnApi.getPrimaryKeyColumn()?.friendlyName ?? 'Row ID';
|
|
199
199
|
const options = {
|
|
200
200
|
loading: false,
|
|
201
|
-
overlayNoRowsTemplate: '<div style="font-size: var(--ab-font-size-2);color: var(--ab-color-
|
|
201
|
+
overlayNoRowsTemplate: '<div style="font-size: var(--ab-font-size-2);color: var(--ab-color-primary-foreground);">No Data Changes</div>',
|
|
202
202
|
defaultColDef: {
|
|
203
203
|
floatingFilter: true,
|
|
204
204
|
filter: true,
|
|
@@ -9,12 +9,12 @@ const DropdownButton_1 = tslib_1.__importDefault(require("../../../../components
|
|
|
9
9
|
const HelpBlock_1 = tslib_1.__importDefault(require("../../../../components/HelpBlock"));
|
|
10
10
|
const icons_1 = require("../../../../components/icons");
|
|
11
11
|
const InfiniteTable_1 = require("../../../../components/InfiniteTable");
|
|
12
|
-
const Tabs_1 = require("../../../../components/Tabs");
|
|
13
12
|
const Tag_1 = require("../../../../components/Tag");
|
|
14
13
|
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
15
14
|
const AdaptablePopover_1 = require("../../../AdaptablePopover");
|
|
16
15
|
const UIHelper_1 = tslib_1.__importDefault(require("../../../UIHelper"));
|
|
17
16
|
const Flex_1 = require("../../../../components/Flex");
|
|
17
|
+
const Card_1 = require("../../../../components/Card");
|
|
18
18
|
const tableDOMProps = {
|
|
19
19
|
style: {
|
|
20
20
|
height: '100%',
|
|
@@ -66,7 +66,6 @@ const ColumnsSection = (props) => {
|
|
|
66
66
|
abColumn: {
|
|
67
67
|
header: 'AdapTable Column',
|
|
68
68
|
render: (params) => {
|
|
69
|
-
// filter out used columns
|
|
70
69
|
const availableColumns = allColumns
|
|
71
70
|
.filter((c) => !props.columnsMap?.find((cm) => cm.abColumn === c.value))
|
|
72
71
|
.map((col) => {
|
|
@@ -108,17 +107,17 @@ const ColumnsSection = (props) => {
|
|
|
108
107
|
};
|
|
109
108
|
}, [props.columnsMap]);
|
|
110
109
|
if (!props.columnsMap) {
|
|
111
|
-
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:p-
|
|
110
|
+
return ((0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:p-3", children: (0, jsx_runtime_1.jsxs)(HelpBlock_1.default, { className: "twa:text-error", children: ["No data has been imported. Go to the ", (0, jsx_runtime_1.jsx)(Tag_1.Tag, { children: "Upload" }), " step and provide data."] }) }));
|
|
112
111
|
}
|
|
113
|
-
return ((0, jsx_runtime_1.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "column", className: "twa:h-full", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", className: "twa:p-2 twa:gap-3 twa:border-b twa:mb-2 twa:border-b-foreground/20", children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-5 twa:font-medium", children: "Columns" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:max-w-[520px]", children: "Map imported fields to AdapTable columns and choose which to include" })] }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:flex-1 twa:min-h-0 twa:overflow-auto twa:p-3", children: (0, jsx_runtime_1.jsxs)(Card_1.Card, { shadow: false, className: "twa:h-full twa:min-h-[300px]", children: [(0, jsx_runtime_1.jsxs)(Card_1.Card.Title, { children: [(0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:font-medium", children: "Column Mapping" }), (0, jsx_runtime_1.jsx)(Flex_1.Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Match each data field to an AdapTable column. The primary key column cannot be excluded." })] }), (0, jsx_runtime_1.jsx)(Card_1.Card.Body, { className: "twa:flex-1 twa:min-h-0", children: (0, jsx_runtime_1.jsx)(InfiniteTable_1.DataSource, { data: props.columnsMap, primaryKey: 'field', children: (0, jsx_runtime_1.jsx)(InfiniteTable_1.InfiniteTableGrid, { columnPinning: {
|
|
113
|
+
valid: 'end',
|
|
114
|
+
type: 'end',
|
|
115
|
+
}, columnTypes: {
|
|
116
|
+
default: {
|
|
117
|
+
minWidth: 100,
|
|
118
|
+
defaultFlex: 1,
|
|
119
|
+
},
|
|
120
|
+
}, domProps: tableDOMProps, columns: columns }) }) })] }) })] }));
|
|
122
121
|
};
|
|
123
122
|
exports.ColumnsSection = ColumnsSection;
|
|
124
123
|
exports.ColumnsSection.displayName = 'ColumnsSection';
|