@mwater/visualization 5.2.0 → 5.3.0
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/lib/ColorComponent.d.ts +10 -11
- package/lib/ColorComponent.js +78 -29
- package/lib/ColorSchemeFactory.d.ts +13 -2
- package/lib/ColorSchemeFactory.js +7 -5
- package/lib/CustomColorsContext.d.ts +6 -0
- package/lib/CustomColorsContext.js +6 -0
- package/lib/FiltersDesignerComponent.d.ts +1 -4
- package/lib/FiltersDesignerComponent.js +2 -3
- package/lib/LocaleContextInjector.d.ts +5 -11
- package/lib/LocaleContextInjector.js +4 -12
- package/lib/MWaterAddRelatedFormComponent.js +3 -3
- package/lib/MWaterAddRelatedIndicatorComponent.d.ts +1 -4
- package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
- package/lib/MWaterCompleteTableSelectComponent.d.ts +5 -16
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +4 -6
- package/lib/MWaterContextComponent.js +4 -13
- package/lib/MWaterLoaderComponent.d.ts +5 -3
- package/lib/MWaterLoaderComponent.js +2 -1
- package/lib/MWaterTableSelectComponent.d.ts +1 -4
- package/lib/MWaterTableSelectComponent.js +10 -12
- package/lib/UIComponents.d.ts +2 -2
- package/lib/UIComponents.js +4 -12
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +3 -1
- package/lib/axes/AxisComponent.d.ts +2 -5
- package/lib/axes/AxisComponent.js +1 -2
- package/lib/axes/ColorPaletteCollectionComponent.d.ts +5 -12
- package/lib/axes/ColorPaletteCollectionComponent.js +67 -36
- package/lib/dashboards/DashboardComponent.d.ts +4 -12
- package/lib/dashboards/DashboardComponent.js +18 -38
- package/lib/dashboards/DashboardDesign.d.ts +3 -3
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +109 -132
- package/lib/dashboards/FontStyleEditor.d.ts +8 -0
- package/lib/dashboards/FontStyleEditor.js +130 -0
- package/lib/dashboards/LayoutOptionsComponent.d.ts +0 -1
- package/lib/dashboards/LayoutOptionsComponent.js +211 -42
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/WidgetComponent.d.ts +3 -3
- package/lib/dashboards/WidgetComponent.js +3 -6
- package/lib/dashboards/WidgetDataSourcePrioritizer.d.ts +20 -0
- package/lib/dashboards/WidgetDataSourcePrioritizer.js +72 -0
- package/lib/dashboards/layoutOptions.d.ts +83 -0
- package/lib/dashboards/layoutOptions.js +436 -10
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.js +87 -33
- package/lib/demo.js +3 -3
- package/lib/index.css +5 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -1
- package/lib/layouts/LayoutManager.d.ts +33 -29
- package/lib/layouts/LayoutManager.js +2 -8
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +26 -57
- package/lib/layouts/blocks/BlocksDisplayComponent.js +122 -205
- package/lib/layouts/blocks/BlocksLayoutManager.d.ts +6 -22
- package/lib/layouts/blocks/BlocksLayoutManager.js +5 -14
- package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +5 -4
- package/lib/layouts/blocks/HorizontalBlockComponent.js +5 -5
- package/lib/mWaterLoader.d.ts +2 -0
- package/lib/mWaterLoader.js +2 -1
- package/lib/maps/AddLayerComponent.d.ts +6 -8
- package/lib/maps/AddLayerComponent.js +6 -6
- package/lib/maps/BingLayer.js +10 -20
- package/lib/maps/BufferLayer.js +2 -1
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/DirectMapDataSource.d.ts +5 -2
- package/lib/maps/DirectMapDataSource.js +2 -1
- package/lib/maps/EditPopupComponent.js +2 -1
- package/lib/maps/MapComponent.d.ts +1 -4
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +1 -4
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/ServerMapDataSource.d.ts +2 -3
- package/lib/maps/ServerMapDataSource.js +5 -5
- package/lib/maps/VectorMapViewComponent.js +2 -1
- package/lib/maps/mapSymbols.js +2 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/vectorMaps.js +61 -55
- package/lib/quickfilter/QuickfiltersComponent.d.ts +1 -4
- package/lib/quickfilter/QuickfiltersComponent.js +3 -3
- package/lib/richtext/DropdownPaletteItem.d.ts +32 -0
- package/lib/richtext/DropdownPaletteItem.js +82 -0
- package/lib/richtext/FontColorPaletteItem.d.ts +1 -5
- package/lib/richtext/FontColorPaletteItem.js +32 -27
- package/lib/richtext/ItemsHtmlConverter.js +12 -3
- package/lib/richtext/RichTextComponent.d.ts +26 -52
- package/lib/richtext/RichTextComponent.js +166 -128
- package/lib/valueFormatter.js +6 -1
- package/lib/wellknown.d.ts +5 -0
- package/lib/wellknown.js +288 -0
- package/lib/widgets/DropdownWidgetComponent.d.ts +8 -25
- package/lib/widgets/DropdownWidgetComponent.js +48 -25
- package/lib/widgets/IFrameWidgetComponent.d.ts +1 -2
- package/lib/widgets/ImageWidgetComponent.d.ts +2 -3
- package/lib/widgets/MapWidget.d.ts +2 -0
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/TOCWidget.js +2 -1
- package/lib/widgets/Widget.d.ts +2 -0
- package/lib/widgets/WidgetDataSource.d.ts +3 -1
- package/lib/widgets/charts/Chart.d.ts +0 -1
- package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartViewComponent.js +11 -3
- package/lib/widgets/charts/ChartWidget.d.ts +1 -62
- package/lib/widgets/charts/ChartWidget.js +4 -183
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +51 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +167 -0
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +4 -4
- package/lib/widgets/charts/layered/LayeredChart.d.ts +5 -10
- package/lib/widgets/charts/layered/LayeredChart.js +6 -7
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +4 -2
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +46 -32
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +4 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +3 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -2
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -1
- package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +89 -38
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +5 -112
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +122 -166
- package/lib/widgets/charts/pivot/PivotChart.d.ts +6 -0
- package/lib/widgets/charts/pivot/PivotChart.js +47 -17
- package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +11 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +1 -1
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +20 -36
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +0 -1
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +23 -2
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +215 -181
- package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +9 -28
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/table/TableChart.js +8 -4
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +3 -3
- package/lib/widgets/charts/table/TableChartViewComponent.js +11 -11
- package/lib/widgets/text/TextComponent.d.ts +5 -12
- package/lib/widgets/text/TextComponent.js +19 -39
- package/lib/widgets/text/TextWidget.d.ts +2 -1
- package/lib/widgets/text/TextWidget.js +5 -1
- package/lib/widgets/text/TextWidgetComponent.d.ts +15 -3
- package/lib/widgets/text/TextWidgetComponent.js +76 -19
- package/lib/widgets/text/TextWidgetDesign.d.ts +13 -1
- package/lib/widgets/text/TextWidgetDesign.js +6 -0
- package/package.json +4 -4
- package/src/ColorComponent.tsx +177 -0
- package/src/ColorSchemeFactory.ts +12 -6
- package/src/CustomColorsContext.tsx +8 -0
- package/src/FiltersDesignerComponent.ts +3 -4
- package/src/LocaleContextInjector.tsx +14 -13
- package/src/MWaterAddRelatedFormComponent.ts +3 -3
- package/src/MWaterAddRelatedIndicatorComponent.ts +6 -6
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -36
- package/src/MWaterContextComponent.tsx +8 -17
- package/src/MWaterLoaderComponent.ts +6 -3
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/AxisBuilder.ts +7 -5
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +71 -107
- package/src/dashboards/DashboardDesign.ts +3 -3
- package/src/dashboards/DashboardUpgrader.ts +41 -1
- package/src/dashboards/DashboardViewComponent.tsx +313 -0
- package/src/dashboards/FontStyleEditor.tsx +166 -0
- package/src/dashboards/LayoutOptionsComponent.tsx +379 -75
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/ServerDatagridDataSource.ts +106 -43
- package/src/demo.ts +3 -3
- package/src/index.css +5 -0
- package/src/index.ts +1 -1
- package/src/layouts/LayoutManager.ts +44 -42
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +498 -0
- package/src/layouts/blocks/BlocksLayoutManager.ts +6 -15
- package/src/layouts/blocks/HorizontalBlockComponent.ts +9 -8
- package/src/mWaterLoader.ts +4 -1
- package/src/maps/AddLayerComponent.ts +9 -9
- package/src/maps/BingLayer.ts +16 -26
- package/src/maps/BufferLayer.ts +2 -1
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +7 -7
- package/src/maps/VectorMapViewComponent.tsx +2 -1
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +79 -74
- package/src/quickfilter/QuickfiltersComponent.ts +3 -3
- package/src/richtext/DropdownPaletteItem.tsx +144 -0
- package/src/richtext/FontColorPaletteItem.tsx +160 -0
- package/src/richtext/ItemsHtmlConverter.ts +15 -5
- package/src/richtext/RichTextComponent.tsx +274 -232
- package/src/valueFormatter.ts +5 -1
- package/src/wellknown.ts +286 -0
- package/src/widgets/DropdownWidgetComponent.tsx +75 -0
- package/src/widgets/MapWidget.ts +5 -2
- package/src/widgets/TOCWidget.ts +2 -1
- package/src/widgets/Widget.ts +3 -0
- package/src/widgets/WidgetDataSource.ts +3 -1
- package/src/widgets/charts/Chart.ts +1 -1
- package/src/widgets/charts/ChartViewComponent.ts +16 -3
- package/src/widgets/charts/ChartWidget.ts +3 -275
- package/src/widgets/charts/ChartWidgetComponent.tsx +281 -0
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +4 -4
- package/src/widgets/charts/layered/LayeredChart.ts +4 -6
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +80 -63
- package/src/widgets/charts/layered/LayeredChartDesign.ts +7 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +43 -10
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +6 -6
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +140 -88
- package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +305 -221
- package/src/widgets/charts/pivot/PivotChart.ts +56 -18
- package/src/widgets/charts/pivot/PivotChartDesign.ts +12 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +4 -3
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +39 -76
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +0 -1
- package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +230 -189
- package/src/widgets/charts/pivot/PivotChartUtils.ts +4 -4
- package/src/widgets/charts/pivot/{PivotChartViewComponent.ts → PivotChartViewComponent.tsx} +86 -89
- package/src/widgets/charts/table/TableChart.ts +8 -4
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +4 -4
- package/src/widgets/charts/table/TableChartViewComponent.ts +13 -14
- package/src/widgets/text/TextComponent.tsx +47 -49
- package/src/widgets/text/TextWidget.ts +8 -3
- package/src/widgets/text/TextWidgetComponent.tsx +249 -0
- package/src/widgets/text/TextWidgetDesign.ts +22 -1
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -303
- package/src/dashboards/layoutOptions.ts +0 -40
- package/src/layout-styles.css +0 -263
- package/src/layouts/blocks/BlocksDisplayComponent.ts +0 -461
- package/src/layouts/grid/GridLayoutComponent.ts +0 -67
- package/src/layouts/grid/GridLayoutManager.ts +0 -185
- package/src/layouts/grid/LegoLayoutEngine.ts +0 -142
- package/src/layouts/grid/PaletteItemComponent.ts +0 -28
- package/src/layouts/grid/README.md +0 -14
- package/src/layouts/grid/WidgetContainerComponent.ts +0 -420
- package/src/richtext/FontColorPaletteItem.ts +0 -172
- package/src/richtext/FontSizePaletteItem.ts +0 -110
- package/src/widgets/DropdownWidgetComponent.ts +0 -78
- package/src/widgets/text/TextWidgetComponent.ts +0 -120
|
@@ -1,122 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { PivotChartIntersection } from "./PivotChartDesign";
|
|
2
|
+
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
|
+
import { PivotChartDesign, PivotChartIntersection } from "./PivotChartDesign";
|
|
5
4
|
import { JsonQLFilter } from "../../../JsonQLFilter";
|
|
6
5
|
export interface IntersectionDesignerComponentProps {
|
|
6
|
+
design: PivotChartDesign;
|
|
7
7
|
intersection: PivotChartIntersection;
|
|
8
|
+
intersectionId: string;
|
|
8
9
|
table: string;
|
|
9
10
|
schema: Schema;
|
|
10
11
|
dataSource: DataSource;
|
|
11
12
|
onChange: (intersection: PivotChartIntersection) => void;
|
|
12
13
|
filters?: JsonQLFilter[];
|
|
13
14
|
}
|
|
14
|
-
export default
|
|
15
|
-
constructor(props: IntersectionDesignerComponentProps);
|
|
16
|
-
update(...args: any[]): any;
|
|
17
|
-
handleBackgroundColorAxisChange: (backgroundColorAxis: any) => any;
|
|
18
|
-
handleBackgroundColorChange: (backgroundColor: any) => any;
|
|
19
|
-
handleBackgroundColorConditionsChange: (backgroundColorConditions: any) => any;
|
|
20
|
-
handleBackgroundColorOpacityChange: (newValue: any) => any;
|
|
21
|
-
handleFilterChange: (filter: any) => any;
|
|
22
|
-
renderValueAxis(): React.CElement<{
|
|
23
|
-
label: React.ReactNode;
|
|
24
|
-
labelMuted?: boolean | undefined;
|
|
25
|
-
hint?: React.ReactNode;
|
|
26
|
-
help?: React.ReactNode;
|
|
27
|
-
required?: boolean | undefined;
|
|
28
|
-
hasSuccess?: boolean | undefined;
|
|
29
|
-
hasWarnings?: boolean | undefined;
|
|
30
|
-
hasErrors?: boolean | undefined;
|
|
31
|
-
}, ui.FormGroup>;
|
|
32
|
-
renderNullValue(): React.CElement<{
|
|
33
|
-
label: React.ReactNode;
|
|
34
|
-
labelMuted?: boolean | undefined;
|
|
35
|
-
hint?: React.ReactNode;
|
|
36
|
-
help?: React.ReactNode;
|
|
37
|
-
required?: boolean | undefined;
|
|
38
|
-
hasSuccess?: boolean | undefined;
|
|
39
|
-
hasWarnings?: boolean | undefined;
|
|
40
|
-
hasErrors?: boolean | undefined;
|
|
41
|
-
}, ui.FormGroup> | null;
|
|
42
|
-
renderFilter(): React.CElement<{
|
|
43
|
-
label: React.ReactNode;
|
|
44
|
-
labelMuted?: boolean | undefined;
|
|
45
|
-
hint?: React.ReactNode;
|
|
46
|
-
help?: React.ReactNode;
|
|
47
|
-
required?: boolean | undefined;
|
|
48
|
-
hasSuccess?: boolean | undefined;
|
|
49
|
-
hasWarnings?: boolean | undefined;
|
|
50
|
-
hasErrors?: boolean | undefined;
|
|
51
|
-
}, ui.FormGroup>;
|
|
52
|
-
renderStyling(): React.CElement<{
|
|
53
|
-
label: React.ReactNode;
|
|
54
|
-
labelMuted?: boolean | undefined;
|
|
55
|
-
hint?: React.ReactNode;
|
|
56
|
-
help?: React.ReactNode;
|
|
57
|
-
required?: boolean | undefined;
|
|
58
|
-
hasSuccess?: boolean | undefined;
|
|
59
|
-
hasWarnings?: boolean | undefined;
|
|
60
|
-
hasErrors?: boolean | undefined;
|
|
61
|
-
}, ui.FormGroup>;
|
|
62
|
-
renderBackgroundColorConditions(): React.CElement<BackgroundColorConditionsComponentProps, BackgroundColorConditionsComponent>;
|
|
63
|
-
renderBackgroundColorAxis(): React.CElement<{
|
|
64
|
-
label: React.ReactNode;
|
|
65
|
-
labelMuted?: boolean | undefined;
|
|
66
|
-
hint?: React.ReactNode;
|
|
67
|
-
help?: React.ReactNode;
|
|
68
|
-
required?: boolean | undefined;
|
|
69
|
-
hasSuccess?: boolean | undefined;
|
|
70
|
-
hasWarnings?: boolean | undefined;
|
|
71
|
-
hasErrors?: boolean | undefined;
|
|
72
|
-
}, ui.FormGroup>;
|
|
73
|
-
renderBackgroundColor(): React.CElement<{
|
|
74
|
-
label: React.ReactNode;
|
|
75
|
-
labelMuted?: boolean | undefined;
|
|
76
|
-
hint?: React.ReactNode;
|
|
77
|
-
help?: React.ReactNode;
|
|
78
|
-
required?: boolean | undefined;
|
|
79
|
-
hasSuccess?: boolean | undefined;
|
|
80
|
-
hasWarnings?: boolean | undefined;
|
|
81
|
-
hasErrors?: boolean | undefined;
|
|
82
|
-
}, ui.FormGroup> | undefined;
|
|
83
|
-
renderBackgroundColorOpacityControl(): React.CElement<{
|
|
84
|
-
label: React.ReactNode;
|
|
85
|
-
labelMuted?: boolean | undefined;
|
|
86
|
-
hint?: React.ReactNode;
|
|
87
|
-
help?: React.ReactNode;
|
|
88
|
-
required?: boolean | undefined;
|
|
89
|
-
hasSuccess?: boolean | undefined;
|
|
90
|
-
hasWarnings?: boolean | undefined;
|
|
91
|
-
hasErrors?: boolean | undefined;
|
|
92
|
-
}, ui.FormGroup> | undefined;
|
|
93
|
-
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
94
|
-
}
|
|
95
|
-
interface BackgroundColorConditionsComponentProps {
|
|
96
|
-
colorConditions?: {
|
|
97
|
-
condition?: Expr;
|
|
98
|
-
color?: string;
|
|
99
|
-
}[];
|
|
100
|
-
table: string;
|
|
101
|
-
schema: Schema;
|
|
102
|
-
dataSource: DataSource;
|
|
103
|
-
onChange: (colorConditions?: {
|
|
104
|
-
condition?: Expr;
|
|
105
|
-
color?: string;
|
|
106
|
-
}[]) => void;
|
|
107
|
-
}
|
|
108
|
-
/** Displays background color conditions */
|
|
109
|
-
declare class BackgroundColorConditionsComponent extends React.Component<BackgroundColorConditionsComponentProps> {
|
|
110
|
-
handleAdd: () => void;
|
|
111
|
-
render(): React.CElement<{
|
|
112
|
-
label: React.ReactNode;
|
|
113
|
-
labelMuted?: boolean | undefined;
|
|
114
|
-
hint?: React.ReactNode;
|
|
115
|
-
help?: React.ReactNode;
|
|
116
|
-
required?: boolean | undefined;
|
|
117
|
-
hasSuccess?: boolean | undefined;
|
|
118
|
-
hasWarnings?: boolean | undefined;
|
|
119
|
-
hasErrors?: boolean | undefined;
|
|
120
|
-
}, ui.FormGroup>;
|
|
121
|
-
}
|
|
122
|
-
export {};
|
|
15
|
+
export default function IntersectionDesignerComponent(props: IntersectionDesignerComponentProps): React.JSX.Element;
|
|
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const react_1 = __importDefault(require("react"));
|
|
30
|
-
const R = react_1.default.createElement;
|
|
31
30
|
const ui = __importStar(require("@mwater/react-library/lib/bootstrap"));
|
|
32
31
|
const update_1 = __importDefault(require("@mwater/react-library/lib/update"));
|
|
33
32
|
const rc_slider_1 = __importDefault(require("rc-slider"));
|
|
@@ -36,144 +35,120 @@ const ColorComponent_1 = __importDefault(require("../../../ColorComponent"));
|
|
|
36
35
|
const expressions_ui_1 = require("@mwater/expressions-ui");
|
|
37
36
|
const expressions_ui_2 = require("@mwater/expressions-ui");
|
|
38
37
|
const ListEditorComponent_1 = require("@mwater/react-library/lib/ListEditorComponent");
|
|
38
|
+
const PivotChartUtils_1 = require("./PivotChartUtils");
|
|
39
|
+
const AxisBuilder_1 = __importDefault(require("../../../axes/AxisBuilder"));
|
|
40
|
+
const immer_1 = __importDefault(require("immer"));
|
|
39
41
|
// Design an intersection of a pivot table
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
label: "
|
|
71
|
-
|
|
72
|
-
}, R(AxisComponent_1.default, {
|
|
73
|
-
schema: this.props.schema,
|
|
74
|
-
dataSource: this.props.dataSource,
|
|
75
|
-
table: this.props.table,
|
|
76
|
-
types: ["enum", "text", "boolean", "date", "number"],
|
|
77
|
-
aggrNeed: "required",
|
|
78
|
-
value: this.props.intersection.valueAxis,
|
|
79
|
-
onChange: this.update("valueAxis"),
|
|
80
|
-
showFormat: true,
|
|
81
|
-
filters: this.props.filters
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
renderNullValue() {
|
|
85
|
-
if (this.props.intersection.valueAxis) {
|
|
86
|
-
return R(ui.FormGroup, {
|
|
87
|
-
labelMuted: true,
|
|
88
|
-
label: "Show Empty Cells as"
|
|
89
|
-
}, R(ui.TextInput, {
|
|
90
|
-
value: this.props.intersection.valueAxis.nullLabel ?? null,
|
|
91
|
-
emptyNull: true,
|
|
92
|
-
onChange: this.update("valueAxis.nullLabel"),
|
|
93
|
-
placeholder: "Blank"
|
|
94
|
-
}));
|
|
42
|
+
function IntersectionDesignerComponent(props) {
|
|
43
|
+
// Determine table to use (use overrideTable if set, otherwise use table from props)
|
|
44
|
+
const table = props.intersection.tableOverride || props.table;
|
|
45
|
+
const handleBackgroundColorAxisChange = (backgroundColorAxis) => {
|
|
46
|
+
const opacity = props.intersection.backgroundColorOpacity || 1;
|
|
47
|
+
props.onChange({ ...props.intersection, backgroundColorAxis, backgroundColorOpacity: opacity });
|
|
48
|
+
};
|
|
49
|
+
const handleBackgroundColorChange = (backgroundColor) => {
|
|
50
|
+
const opacity = props.intersection.backgroundColorOpacity || 1;
|
|
51
|
+
props.onChange({ ...props.intersection, backgroundColor, backgroundColorOpacity: opacity });
|
|
52
|
+
};
|
|
53
|
+
const handleBackgroundColorConditionsChange = (backgroundColorConditions) => {
|
|
54
|
+
const opacity = props.intersection.backgroundColorOpacity || 1;
|
|
55
|
+
props.onChange({ ...props.intersection, backgroundColorConditions, backgroundColorOpacity: opacity });
|
|
56
|
+
};
|
|
57
|
+
const handleBackgroundColorOpacityChange = (newValue) => {
|
|
58
|
+
props.onChange({ ...props.intersection, backgroundColorOpacity: newValue / 100 });
|
|
59
|
+
};
|
|
60
|
+
const handleFilterChange = (filter) => {
|
|
61
|
+
props.onChange({ ...props.intersection, filter });
|
|
62
|
+
};
|
|
63
|
+
const handleTableOverrideChange = (tableOverride) => {
|
|
64
|
+
props.onChange({ ...props.intersection, tableOverride });
|
|
65
|
+
};
|
|
66
|
+
const renderValueAxis = () => {
|
|
67
|
+
return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: "Calculation", help: "This is the calculated value that is displayed. Leave as blank to make an empty section" },
|
|
68
|
+
react_1.default.createElement(AxisComponent_1.default, { schema: props.schema, dataSource: props.dataSource, table: table, types: ["enum", "text", "boolean", "date", "number"], aggrNeed: "required", value: props.intersection.valueAxis, onChange: valueAxis => props.onChange({ ...props.intersection, valueAxis }), showFormat: true, filters: props.filters })));
|
|
69
|
+
};
|
|
70
|
+
const renderNullValue = () => {
|
|
71
|
+
if (props.intersection.valueAxis) {
|
|
72
|
+
return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: "Show Empty Cells as" },
|
|
73
|
+
react_1.default.createElement(ui.TextInput, { value: props.intersection.valueAxis.nullLabel ?? null, emptyNull: true, onChange: nullLabel => props.onChange({ ...props.intersection, valueAxis: { ...props.intersection.valueAxis, nullLabel: nullLabel ?? undefined } }), placeholder: "Blank" })));
|
|
95
74
|
}
|
|
96
75
|
return null;
|
|
97
|
-
}
|
|
98
|
-
renderFilter() {
|
|
99
|
-
return
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
value:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return R(BackgroundColorConditionsComponent, {
|
|
119
|
-
schema: this.props.schema,
|
|
120
|
-
dataSource: this.props.dataSource,
|
|
121
|
-
table: this.props.table,
|
|
122
|
-
colorConditions: this.props.intersection.backgroundColorConditions,
|
|
123
|
-
onChange: this.handleBackgroundColorConditionsChange
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
renderBackgroundColorAxis() {
|
|
127
|
-
return R(ui.FormGroup, {
|
|
128
|
-
labelMuted: true,
|
|
129
|
-
label: "Background Color From Values",
|
|
130
|
-
help: "This is an optional background color to set on cells that is controlled by the data"
|
|
131
|
-
}, R(AxisComponent_1.default, {
|
|
132
|
-
schema: this.props.schema,
|
|
133
|
-
dataSource: this.props.dataSource,
|
|
134
|
-
table: this.props.table,
|
|
135
|
-
types: ["enum", "text", "boolean", "date"],
|
|
136
|
-
aggrNeed: "required",
|
|
137
|
-
value: this.props.intersection.backgroundColorAxis,
|
|
138
|
-
onChange: this.handleBackgroundColorAxisChange,
|
|
139
|
-
showColorMap: true,
|
|
140
|
-
filters: this.props.filters
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
renderBackgroundColor() {
|
|
144
|
-
if (this.props.intersection.backgroundColorAxis) {
|
|
76
|
+
};
|
|
77
|
+
const renderFilter = () => {
|
|
78
|
+
return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: react_1.default.createElement(react_1.default.Fragment, null,
|
|
79
|
+
react_1.default.createElement(ui.Icon, { id: "glyphicon-filter" }),
|
|
80
|
+
" Filters") },
|
|
81
|
+
react_1.default.createElement(expressions_ui_1.FilterExprComponent, { schema: props.schema, dataSource: props.dataSource, onChange: handleFilterChange, table: table, value: props.intersection.filter })));
|
|
82
|
+
};
|
|
83
|
+
const renderStyling = () => {
|
|
84
|
+
return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, key: "styling", label: "Styling" },
|
|
85
|
+
react_1.default.createElement(ui.Checkbox, { key: "bold", inline: true, value: props.intersection.bold, onChange: bold => props.onChange({ ...props.intersection, bold }) }, "Bold"),
|
|
86
|
+
react_1.default.createElement(ui.Checkbox, { key: "italic", inline: true, value: props.intersection.italic, onChange: italic => props.onChange({ ...props.intersection, italic }) }, "Italic")));
|
|
87
|
+
};
|
|
88
|
+
const renderBackgroundColorConditions = () => {
|
|
89
|
+
return (react_1.default.createElement(BackgroundColorConditionsComponent, { schema: props.schema, dataSource: props.dataSource, table: table, colorConditions: props.intersection.backgroundColorConditions, onChange: handleBackgroundColorConditionsChange }));
|
|
90
|
+
};
|
|
91
|
+
const renderBackgroundColorAxis = () => {
|
|
92
|
+
return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: "Background Color From Values", help: "This is an optional background color to set on cells that is controlled by the data" },
|
|
93
|
+
react_1.default.createElement(AxisComponent_1.default, { schema: props.schema, dataSource: props.dataSource, table: table, types: ["enum", "text", "boolean", "date"], aggrNeed: "required", value: props.intersection.backgroundColorAxis, onChange: handleBackgroundColorAxisChange, showColorMap: true, filters: props.filters })));
|
|
94
|
+
};
|
|
95
|
+
const renderBackgroundColor = () => {
|
|
96
|
+
if (props.intersection.backgroundColorAxis) {
|
|
145
97
|
return;
|
|
146
98
|
}
|
|
147
|
-
return
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}));
|
|
155
|
-
}
|
|
156
|
-
renderBackgroundColorOpacityControl() {
|
|
157
|
-
if (!this.props.intersection.backgroundColorAxis &&
|
|
158
|
-
!this.props.intersection.backgroundColor &&
|
|
159
|
-
!this.props.intersection.backgroundColorConditions?.[0]) {
|
|
99
|
+
return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: "Background Color", help: "This is an optional background color to set on all cells" },
|
|
100
|
+
react_1.default.createElement(ColorComponent_1.default, { color: props.intersection.backgroundColor, onChange: handleBackgroundColorChange })));
|
|
101
|
+
};
|
|
102
|
+
const renderBackgroundColorOpacityControl = () => {
|
|
103
|
+
if (!props.intersection.backgroundColorAxis &&
|
|
104
|
+
!props.intersection.backgroundColor &&
|
|
105
|
+
!props.intersection.backgroundColorConditions?.[0]) {
|
|
160
106
|
return;
|
|
161
107
|
}
|
|
162
|
-
return
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
108
|
+
return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: `Background Opacity: ${Math.round((props.intersection.backgroundColorOpacity ?? 1) * 100)}%` },
|
|
109
|
+
react_1.default.createElement(rc_slider_1.default, { min: 0, max: 100, step: 1, tipTransitionName: "rc-slider-tooltip-zoom-down", value: (props.intersection.backgroundColorOpacity ?? 1) * 100, onChange: handleBackgroundColorOpacityChange })));
|
|
110
|
+
};
|
|
111
|
+
const renderSegmentValueAxisOverride = (segment) => {
|
|
112
|
+
// Get type of segment axis
|
|
113
|
+
const axisBuilder = new AxisBuilder_1.default({ schema: props.schema });
|
|
114
|
+
const segmentValueAxisType = axisBuilder.getAxisType(segment.valueAxis);
|
|
115
|
+
if (!segmentValueAxisType) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
const overrideValueAxis = (props.intersection.segmentValueAxisOverrides || {})[segment.id];
|
|
119
|
+
return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: (segment.label || axisBuilder.summarizeAxis(segment.valueAxis)) + ":" },
|
|
120
|
+
react_1.default.createElement(AxisComponent_1.default, { schema: props.schema, dataSource: props.dataSource, table: table, types: [segmentValueAxisType], aggrNeed: "none", value: overrideValueAxis, onChange: valueAxis => props.onChange((0, immer_1.default)(props.intersection, (draft) => {
|
|
121
|
+
draft.segmentValueAxisOverrides = draft.segmentValueAxisOverrides || {};
|
|
122
|
+
draft.segmentValueAxisOverrides[segment.id] = valueAxis;
|
|
123
|
+
})), allowExcludedValues: false, collapseCategories: true })));
|
|
124
|
+
};
|
|
125
|
+
const renderSegmentValueAxisOverrides = () => {
|
|
126
|
+
if (!props.intersection.tableOverride) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
// Get all segments
|
|
130
|
+
const segments = (0, PivotChartUtils_1.getAllSegments)(props.design.rows).concat((0, PivotChartUtils_1.getAllSegments)(props.design.columns));
|
|
131
|
+
// Filter out segments that are not intersecting
|
|
132
|
+
const intersectingSegmentIds = props.intersectionId.split(/[,:]/).filter(id => id !== "");
|
|
133
|
+
const intersectingSegments = segments.filter(segment => intersectingSegmentIds.includes(segment.id) && segment.valueAxis);
|
|
134
|
+
return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: "Fields to disaggregate data by (required)" }, intersectingSegments.map(segment => renderSegmentValueAxisOverride(segment))));
|
|
135
|
+
};
|
|
136
|
+
const renderOverrideTable = () => {
|
|
137
|
+
return (react_1.default.createElement(ui.CollapsibleSection, { label: "Advanced: Override Data Source", hint: "Use a different data source for this cell", labelMuted: true, initiallyOpen: props.intersection.tableOverride != null },
|
|
138
|
+
react_1.default.createElement(expressions_ui_1.TableSelectComponent, { schema: props.schema, value: props.intersection.tableOverride, onChange: handleTableOverrideChange }),
|
|
139
|
+
react_1.default.createElement("br", null),
|
|
140
|
+
renderSegmentValueAxisOverrides()));
|
|
141
|
+
};
|
|
142
|
+
return (react_1.default.createElement("div", null,
|
|
143
|
+
renderValueAxis(),
|
|
144
|
+
renderNullValue(),
|
|
145
|
+
renderFilter(),
|
|
146
|
+
renderStyling(),
|
|
147
|
+
renderBackgroundColorAxis(),
|
|
148
|
+
renderBackgroundColorConditions(),
|
|
149
|
+
renderBackgroundColor(),
|
|
150
|
+
renderBackgroundColorOpacityControl(),
|
|
151
|
+
renderOverrideTable()));
|
|
177
152
|
}
|
|
178
153
|
exports.default = IntersectionDesignerComponent;
|
|
179
154
|
/** Displays background color conditions */
|
|
@@ -185,23 +160,18 @@ class BackgroundColorConditionsComponent extends react_1.default.Component {
|
|
|
185
160
|
};
|
|
186
161
|
render() {
|
|
187
162
|
// List conditions
|
|
188
|
-
return
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
colorCondition: item,
|
|
196
|
-
table: this.props.table,
|
|
197
|
-
schema: this.props.schema,
|
|
198
|
-
dataSource: this.props.dataSource,
|
|
199
|
-
onChange: onItemChange
|
|
200
|
-
});
|
|
201
|
-
}, onItemsChange: this.props.onChange }), R(ui.Button, { type: "link", size: "sm", onClick: this.handleAdd }, R(ui.Icon, { id: "fa-plus" }), " Add Condition"));
|
|
163
|
+
return (react_1.default.createElement(ui.FormGroup, { label: "Color Conditions", labelMuted: true, help: "Add conditions that, if met, set the color of the cell. Useful for flagging certain values" },
|
|
164
|
+
react_1.default.createElement(ListEditorComponent_1.ListEditorComponent, { items: this.props.colorConditions || [], renderItem: (item, index, onItemChange) => {
|
|
165
|
+
return (react_1.default.createElement(BackgroundColorConditionComponent, { key: index, colorCondition: item, table: this.props.table, schema: this.props.schema, dataSource: this.props.dataSource, onChange: onItemChange }));
|
|
166
|
+
}, onItemsChange: this.props.onChange }),
|
|
167
|
+
react_1.default.createElement(ui.Button, { type: "link", size: "sm", onClick: this.handleAdd },
|
|
168
|
+
react_1.default.createElement(ui.Icon, { id: "fa-plus" }),
|
|
169
|
+
"Add Condition")));
|
|
202
170
|
}
|
|
203
171
|
}
|
|
204
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Displays single background color condition
|
|
174
|
+
*/
|
|
205
175
|
class BackgroundColorConditionComponent extends react_1.default.Component {
|
|
206
176
|
constructor(props) {
|
|
207
177
|
super(props);
|
|
@@ -212,24 +182,10 @@ class BackgroundColorConditionComponent extends react_1.default.Component {
|
|
|
212
182
|
return (0, update_1.default)(this.props.colorCondition, this.props.onChange, arguments);
|
|
213
183
|
}
|
|
214
184
|
render() {
|
|
215
|
-
return
|
|
216
|
-
labelMuted: true,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
dataSource: this.props.dataSource,
|
|
221
|
-
onChange: this.update("condition"),
|
|
222
|
-
types: ["boolean"],
|
|
223
|
-
aggrStatuses: ["aggregate", "literal"],
|
|
224
|
-
table: this.props.table,
|
|
225
|
-
value: this.props.colorCondition.condition
|
|
226
|
-
})), R(ui.FormGroup, {
|
|
227
|
-
labelMuted: true,
|
|
228
|
-
label: "Color",
|
|
229
|
-
hint: "Color to display when condition is met"
|
|
230
|
-
}, R(ColorComponent_1.default, {
|
|
231
|
-
color: this.props.colorCondition.color,
|
|
232
|
-
onChange: this.update("color")
|
|
233
|
-
})));
|
|
185
|
+
return (react_1.default.createElement("div", null,
|
|
186
|
+
react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: "Condition" },
|
|
187
|
+
react_1.default.createElement(expressions_ui_2.ExprComponent, { schema: this.props.schema, dataSource: this.props.dataSource, onChange: this.update("condition"), types: ["boolean"], aggrStatuses: ["aggregate", "literal"], table: this.props.table, value: this.props.colorCondition.condition })),
|
|
188
|
+
react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: "Color", hint: "Color to display when condition is met" },
|
|
189
|
+
react_1.default.createElement(ColorComponent_1.default, { color: this.props.colorCondition.color, onChange: this.update("color") }))));
|
|
234
190
|
}
|
|
235
191
|
}
|
|
@@ -28,6 +28,12 @@ export default class PivotChart extends Chart {
|
|
|
28
28
|
* @param callback - Callback function to handle the result or error.
|
|
29
29
|
*/
|
|
30
30
|
getData(design: PivotChartDesign, schema: Schema, dataSource: DataSource, filters: JsonQLFilter[], callback: (error: any, data?: any) => void): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Create a view element for the chart
|
|
33
|
+
*
|
|
34
|
+
* @param options - Options for the view element
|
|
35
|
+
* @returns - React element
|
|
36
|
+
*/
|
|
31
37
|
createViewElement(options: ChartCreateViewElementOptions): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
32
38
|
createDropdownItems(design: any, schema: Schema, widgetDataSource: WidgetDataSource, filters: any): never[];
|
|
33
39
|
createDataTable(design: PivotChartDesign, schema: Schema, dataSource: DataSource, data: any, locale: string): (string | undefined)[][];
|
|
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
30
30
|
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const R = react_1.default.createElement;
|
|
32
31
|
const uuid_1 = __importDefault(require("uuid"));
|
|
33
32
|
const immer_1 = __importDefault(require("immer"));
|
|
34
33
|
const immer_2 = require("immer");
|
|
@@ -56,8 +55,10 @@ class PivotChart extends Chart_1.default {
|
|
|
56
55
|
draft.rows = design.rows || [];
|
|
57
56
|
draft.columns = design.columns || [];
|
|
58
57
|
draft.intersections = design.intersections || {};
|
|
59
|
-
draft.header = design.header || { style: "
|
|
58
|
+
draft.header = design.header || { style: "header", items: [] };
|
|
60
59
|
draft.footer = design.footer || { style: "footer", items: [] };
|
|
60
|
+
// Fix style of header
|
|
61
|
+
draft.header.style = "header";
|
|
61
62
|
if (design.table) {
|
|
62
63
|
// Add default row and column
|
|
63
64
|
let intersectionId, segment;
|
|
@@ -105,10 +106,11 @@ class PivotChart extends Chart_1.default {
|
|
|
105
106
|
// Clean all intersections
|
|
106
107
|
for (intersectionId in draft.intersections) {
|
|
107
108
|
const intersection = draft.intersections[intersectionId];
|
|
109
|
+
const intersectionTable = intersection.tableOverride || design.table;
|
|
108
110
|
if (intersection.valueAxis) {
|
|
109
111
|
intersection.valueAxis = axisBuilder.cleanAxis({
|
|
110
112
|
axis: intersection.valueAxis ? (0, immer_2.original)(intersection.valueAxis) : null,
|
|
111
|
-
table:
|
|
113
|
+
table: intersectionTable,
|
|
112
114
|
aggrNeed: "required",
|
|
113
115
|
types: ["enum", "text", "boolean", "date", "number"]
|
|
114
116
|
});
|
|
@@ -116,7 +118,7 @@ class PivotChart extends Chart_1.default {
|
|
|
116
118
|
if (intersection.backgroundColorAxis) {
|
|
117
119
|
intersection.backgroundColorAxis = axisBuilder.cleanAxis({
|
|
118
120
|
axis: intersection.backgroundColorAxis ? (0, immer_2.original)(intersection.backgroundColorAxis) : null,
|
|
119
|
-
table:
|
|
121
|
+
table: intersectionTable,
|
|
120
122
|
aggrNeed: "required",
|
|
121
123
|
types: ["enum", "text", "boolean", "date"]
|
|
122
124
|
});
|
|
@@ -126,17 +128,45 @@ class PivotChart extends Chart_1.default {
|
|
|
126
128
|
}
|
|
127
129
|
for (const colorCondition of intersection.backgroundColorConditions || []) {
|
|
128
130
|
colorCondition.condition = exprCleaner.cleanExpr(colorCondition.condition ? (0, immer_2.original)(colorCondition.condition) : null, {
|
|
129
|
-
table:
|
|
131
|
+
table: intersectionTable,
|
|
130
132
|
types: ["boolean"],
|
|
131
133
|
aggrStatuses: ["aggregate", "literal"]
|
|
132
134
|
});
|
|
133
135
|
}
|
|
134
136
|
if (intersection.filter) {
|
|
135
137
|
intersection.filter = exprCleaner.cleanExpr(intersection.filter ? (0, immer_2.original)(intersection.filter) : null, {
|
|
136
|
-
table:
|
|
138
|
+
table: intersectionTable,
|
|
137
139
|
types: ["boolean"]
|
|
138
140
|
});
|
|
139
141
|
}
|
|
142
|
+
if (intersection.tableOverride) {
|
|
143
|
+
const allSegments = PivotChartUtils.getAllSegments(design.rows).concat(PivotChartUtils.getAllSegments(design.columns));
|
|
144
|
+
// Clean segment value axis overrides
|
|
145
|
+
intersection.segmentValueAxisOverrides = intersection.segmentValueAxisOverrides || {};
|
|
146
|
+
for (const segmentId of Object.keys(intersection.segmentValueAxisOverrides)) {
|
|
147
|
+
// Find segment
|
|
148
|
+
const segment = allSegments.find((s) => s.id === segmentId);
|
|
149
|
+
if (!segment || !segment.valueAxis) {
|
|
150
|
+
delete intersection.segmentValueAxisOverrides[segmentId];
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
// Get type of the segment
|
|
154
|
+
const segmentValueAxisType = axisBuilder.getAxisType(segment.valueAxis);
|
|
155
|
+
intersection.segmentValueAxisOverrides[segmentId] = axisBuilder.cleanAxis({
|
|
156
|
+
axis: intersection.segmentValueAxisOverrides[segmentId] ? (0, immer_2.original)(intersection.segmentValueAxisOverrides[segmentId]) : null,
|
|
157
|
+
table: intersectionTable,
|
|
158
|
+
aggrNeed: "none",
|
|
159
|
+
types: [segmentValueAxisType]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// Determine all required segment overrides
|
|
163
|
+
const intersectingSegmentIds = intersectionId.split(/[,:]/).filter(id => id !== "");
|
|
164
|
+
const intersectingSegments = allSegments.filter(segment => intersectingSegmentIds.includes(segment.id) && segment.valueAxis);
|
|
165
|
+
intersection.segmentValueAxisOverridesComplete = intersectingSegments.every(segment => intersection.segmentValueAxisOverrides[segment.id]);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
delete intersection.segmentValueAxisOverridesComplete;
|
|
169
|
+
}
|
|
140
170
|
}
|
|
141
171
|
// Get all intersection ids
|
|
142
172
|
const allIntersectionIds = [];
|
|
@@ -195,6 +225,11 @@ class PivotChart extends Chart_1.default {
|
|
|
195
225
|
if (intersection.valueAxis) {
|
|
196
226
|
error = error || axisBuilder.validateAxis({ axis: intersection.valueAxis });
|
|
197
227
|
}
|
|
228
|
+
if (intersection.segmentValueAxisOverrides) {
|
|
229
|
+
for (const segmentId of Object.keys(intersection.segmentValueAxisOverrides)) {
|
|
230
|
+
error = error || axisBuilder.validateAxis({ axis: intersection.segmentValueAxisOverrides[segmentId] });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
198
233
|
}
|
|
199
234
|
return error;
|
|
200
235
|
}
|
|
@@ -290,17 +325,12 @@ class PivotChart extends Chart_1.default {
|
|
|
290
325
|
callback(error);
|
|
291
326
|
}
|
|
292
327
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
// data: results from queries
|
|
300
|
-
// width, height: size of the chart view
|
|
301
|
-
// scope: current scope of the view element
|
|
302
|
-
// onScopeChange: called when scope changes with new scope
|
|
303
|
-
// filters: array of filters
|
|
328
|
+
/**
|
|
329
|
+
* Create a view element for the chart
|
|
330
|
+
*
|
|
331
|
+
* @param options - Options for the view element
|
|
332
|
+
* @returns - React element
|
|
333
|
+
*/
|
|
304
334
|
createViewElement(options) {
|
|
305
335
|
const PivotChartViewComponent = require("./PivotChartViewComponent").default;
|
|
306
336
|
// Create chart
|
|
@@ -85,4 +85,15 @@ export interface PivotChartIntersection {
|
|
|
85
85
|
bold?: boolean;
|
|
86
86
|
/** true if italic */
|
|
87
87
|
italic?: boolean;
|
|
88
|
+
/** Overrides table */
|
|
89
|
+
tableOverride?: string;
|
|
90
|
+
/** If table is overridden, each related segment needs to have its valueAxis overridden */
|
|
91
|
+
segmentValueAxisOverrides?: {
|
|
92
|
+
[id: string]: Axis | null;
|
|
93
|
+
};
|
|
94
|
+
/** Set true when overrides are all present. If false and tableOverride is not null, then intersection cannot be rendered.
|
|
95
|
+
* This is set by cleanDesign. If some are missing, the design is still valid, but the intersection will not be queried
|
|
96
|
+
* and the intersection will be shaded red in design mode.
|
|
97
|
+
*/
|
|
98
|
+
segmentValueAxisOverridesComplete?: boolean;
|
|
88
99
|
}
|
|
@@ -14,7 +14,7 @@ interface PivotChartDesignerComponentState {
|
|
|
14
14
|
export default class PivotChartDesignerComponent extends React.Component<PivotChartDesignerComponentProps, PivotChartDesignerComponentState> {
|
|
15
15
|
constructor(props: any);
|
|
16
16
|
updateDesign(changes: any): any;
|
|
17
|
-
handleTableChange: (table: any) =>
|
|
17
|
+
handleTableChange: (table: any) => void;
|
|
18
18
|
handleColumnChange: (axis: any) => any;
|
|
19
19
|
handleRowChange: (axis: any) => any;
|
|
20
20
|
handleFilterChange: (filter: any) => any;
|
|
@@ -53,7 +53,7 @@ class PivotChartDesignerComponent extends react_1.default.Component {
|
|
|
53
53
|
const column = { id: (0, uuid_1.default)(), label: "" };
|
|
54
54
|
const intersections = {};
|
|
55
55
|
intersections[`${row.id}:${column.id}`] = { valueAxis: { expr: { type: "op", op: "count", table, exprs: [] } } };
|
|
56
|
-
|
|
56
|
+
this.updateDesign({
|
|
57
57
|
table,
|
|
58
58
|
rows: [row],
|
|
59
59
|
columns: [column],
|
|
@@ -25,8 +25,8 @@ export default class PivotChartLayoutBuilder {
|
|
|
25
25
|
type: string;
|
|
26
26
|
text: null;
|
|
27
27
|
};
|
|
28
|
-
setupSummarize(design: any, layout: any):
|
|
29
|
-
setupBorders(layout: any):
|
|
28
|
+
setupSummarize(design: any, layout: any): void;
|
|
29
|
+
setupBorders(layout: any): void;
|
|
30
30
|
getRowsOrColumns(isRow: boolean, segment: PivotChartSegment, data: {
|
|
31
31
|
[intersectionId: string]: any[];
|
|
32
32
|
}, locale: string, parentSegments?: PivotChartSegment[], parentValues?: any[]): {
|