@mwater/visualization 5.2.0 → 5.3.1
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 +9 -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 +380 -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,22 +1,24 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
1
|
import _ from "lodash"
|
|
3
2
|
import React from "react"
|
|
4
|
-
const R = React.createElement
|
|
5
|
-
|
|
6
3
|
import * as ui from "@mwater/react-library/lib/bootstrap"
|
|
7
4
|
import update from "@mwater/react-library/lib/update"
|
|
8
5
|
import { default as Rcslider } from "rc-slider"
|
|
9
6
|
import AxisComponent from "../../../axes/AxisComponent"
|
|
10
7
|
import ColorComponent from "../../../ColorComponent"
|
|
11
|
-
import { FilterExprComponent } from "@mwater/expressions-ui"
|
|
8
|
+
import { FilterExprComponent, TableSelectComponent } from "@mwater/expressions-ui"
|
|
12
9
|
import { ExprComponent } from "@mwater/expressions-ui"
|
|
13
10
|
import { DataSource, Expr, Schema } from "@mwater/expressions"
|
|
14
|
-
import { PivotChartIntersection } from "./PivotChartDesign"
|
|
11
|
+
import { PivotChartDesign, PivotChartIntersection, PivotChartSegment } from "./PivotChartDesign"
|
|
15
12
|
import { JsonQLFilter } from "../../../JsonQLFilter"
|
|
16
13
|
import { ListEditorComponent } from "@mwater/react-library/lib/ListEditorComponent"
|
|
14
|
+
import { getAllSegments } from "./PivotChartUtils"
|
|
15
|
+
import AxisBuilder from "../../../axes/AxisBuilder"
|
|
16
|
+
import produce from "immer"
|
|
17
17
|
|
|
18
18
|
export interface IntersectionDesignerComponentProps {
|
|
19
|
+
design: PivotChartDesign
|
|
19
20
|
intersection: PivotChartIntersection
|
|
21
|
+
intersectionId: string
|
|
20
22
|
table: string
|
|
21
23
|
schema: Schema
|
|
22
24
|
dataSource: DataSource
|
|
@@ -25,211 +27,289 @@ export interface IntersectionDesignerComponentProps {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
// Design an intersection of a pivot table
|
|
28
|
-
export default
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.update = this.update.bind(this)
|
|
33
|
-
}
|
|
30
|
+
export default function IntersectionDesignerComponent(props: IntersectionDesignerComponentProps) {
|
|
31
|
+
// Determine table to use (use overrideTable if set, otherwise use table from props)
|
|
32
|
+
const table = props.intersection.tableOverride || props.table
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const handleBackgroundColorAxisChange = (backgroundColorAxis: any) => {
|
|
35
|
+
const opacity = props.intersection.backgroundColorOpacity || 1
|
|
36
|
+
props.onChange({ ...props.intersection, backgroundColorAxis, backgroundColorOpacity: opacity })
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
const opacity =
|
|
42
|
-
|
|
39
|
+
const handleBackgroundColorChange = (backgroundColor: any) => {
|
|
40
|
+
const opacity = props.intersection.backgroundColorOpacity || 1
|
|
41
|
+
props.onChange({ ...props.intersection, backgroundColor, backgroundColorOpacity: opacity })
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
const opacity =
|
|
47
|
-
|
|
44
|
+
const handleBackgroundColorConditionsChange = (backgroundColorConditions: any) => {
|
|
45
|
+
const opacity = props.intersection.backgroundColorOpacity || 1
|
|
46
|
+
props.onChange({ ...props.intersection, backgroundColorConditions, backgroundColorOpacity: opacity })
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return this.update({ backgroundColorConditions, backgroundColorOpacity: opacity })
|
|
49
|
+
const handleBackgroundColorOpacityChange = (newValue: any) => {
|
|
50
|
+
props.onChange({ ...props.intersection, backgroundColorOpacity: newValue / 100 })
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
const handleFilterChange = (filter: any) => {
|
|
54
|
+
props.onChange({ ...props.intersection, filter })
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const handleTableOverrideChange = (tableOverride: string) => {
|
|
58
|
+
props.onChange({ ...props.intersection, tableOverride })
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
renderValueAxis() {
|
|
64
|
-
return
|
|
65
|
-
ui.FormGroup
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
const renderValueAxis = () => {
|
|
62
|
+
return (
|
|
63
|
+
<ui.FormGroup
|
|
64
|
+
labelMuted={true}
|
|
65
|
+
label="Calculation"
|
|
66
|
+
help="This is the calculated value that is displayed. Leave as blank to make an empty section"
|
|
67
|
+
>
|
|
68
|
+
<AxisComponent
|
|
69
|
+
schema={props.schema}
|
|
70
|
+
dataSource={props.dataSource}
|
|
71
|
+
table={table}
|
|
72
|
+
types={["enum", "text", "boolean", "date", "number"]}
|
|
73
|
+
aggrNeed="required"
|
|
74
|
+
value={props.intersection.valueAxis}
|
|
75
|
+
onChange={valueAxis => props.onChange({ ...props.intersection, valueAxis })}
|
|
76
|
+
showFormat={true}
|
|
77
|
+
filters={props.filters}
|
|
78
|
+
/>
|
|
79
|
+
</ui.FormGroup>
|
|
82
80
|
)
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
renderNullValue() {
|
|
86
|
-
if (
|
|
87
|
-
return
|
|
88
|
-
ui.FormGroup
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
83
|
+
const renderNullValue = () => {
|
|
84
|
+
if (props.intersection.valueAxis) {
|
|
85
|
+
return (
|
|
86
|
+
<ui.FormGroup
|
|
87
|
+
labelMuted={true}
|
|
88
|
+
label="Show Empty Cells as"
|
|
89
|
+
>
|
|
90
|
+
<ui.TextInput
|
|
91
|
+
value={props.intersection.valueAxis.nullLabel ?? null}
|
|
92
|
+
emptyNull={true}
|
|
93
|
+
onChange={nullLabel => props.onChange({ ...props.intersection, valueAxis: { ...props.intersection.valueAxis!, nullLabel: nullLabel ?? undefined } })}
|
|
94
|
+
placeholder="Blank"
|
|
95
|
+
/>
|
|
96
|
+
</ui.FormGroup>
|
|
99
97
|
)
|
|
100
98
|
}
|
|
101
99
|
return null
|
|
102
100
|
}
|
|
103
101
|
|
|
104
|
-
renderFilter() {
|
|
105
|
-
return
|
|
106
|
-
ui.FormGroup
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
102
|
+
const renderFilter = () => {
|
|
103
|
+
return (
|
|
104
|
+
<ui.FormGroup
|
|
105
|
+
labelMuted={true}
|
|
106
|
+
label={<><ui.Icon id="glyphicon-filter" /> Filters</>}
|
|
107
|
+
>
|
|
108
|
+
<FilterExprComponent
|
|
109
|
+
schema={props.schema}
|
|
110
|
+
dataSource={props.dataSource}
|
|
111
|
+
onChange={handleFilterChange}
|
|
112
|
+
table={table}
|
|
113
|
+
value={props.intersection.filter}
|
|
114
|
+
/>
|
|
115
|
+
</ui.FormGroup>
|
|
118
116
|
)
|
|
119
117
|
}
|
|
120
118
|
|
|
121
|
-
renderStyling() {
|
|
122
|
-
return
|
|
123
|
-
ui.FormGroup
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
ui.Checkbox
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
119
|
+
const renderStyling = () => {
|
|
120
|
+
return (
|
|
121
|
+
<ui.FormGroup
|
|
122
|
+
labelMuted={true}
|
|
123
|
+
key="styling"
|
|
124
|
+
label="Styling"
|
|
125
|
+
>
|
|
126
|
+
<ui.Checkbox
|
|
127
|
+
key="bold"
|
|
128
|
+
inline={true}
|
|
129
|
+
value={props.intersection.bold}
|
|
130
|
+
onChange={bold => props.onChange({ ...props.intersection, bold })}
|
|
131
|
+
>
|
|
132
|
+
Bold
|
|
133
|
+
</ui.Checkbox>
|
|
134
|
+
<ui.Checkbox
|
|
135
|
+
key="italic"
|
|
136
|
+
inline={true}
|
|
137
|
+
value={props.intersection.italic}
|
|
138
|
+
onChange={italic => props.onChange({ ...props.intersection, italic })}
|
|
139
|
+
>
|
|
140
|
+
Italic
|
|
141
|
+
</ui.Checkbox>
|
|
142
|
+
</ui.FormGroup>
|
|
139
143
|
)
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
renderBackgroundColorConditions() {
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
const renderBackgroundColorConditions = () => {
|
|
147
|
+
return (
|
|
148
|
+
<BackgroundColorConditionsComponent
|
|
149
|
+
schema={props.schema}
|
|
150
|
+
dataSource={props.dataSource}
|
|
151
|
+
table={table}
|
|
152
|
+
colorConditions={props.intersection.backgroundColorConditions}
|
|
153
|
+
onChange={handleBackgroundColorConditionsChange}
|
|
154
|
+
/>
|
|
155
|
+
)
|
|
150
156
|
}
|
|
151
157
|
|
|
152
|
-
renderBackgroundColorAxis() {
|
|
153
|
-
return
|
|
154
|
-
ui.FormGroup
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
158
|
+
const renderBackgroundColorAxis = () => {
|
|
159
|
+
return (
|
|
160
|
+
<ui.FormGroup
|
|
161
|
+
labelMuted={true}
|
|
162
|
+
label="Background Color From Values"
|
|
163
|
+
help="This is an optional background color to set on cells that is controlled by the data"
|
|
164
|
+
>
|
|
165
|
+
<AxisComponent
|
|
166
|
+
schema={props.schema}
|
|
167
|
+
dataSource={props.dataSource}
|
|
168
|
+
table={table}
|
|
169
|
+
types={["enum", "text", "boolean", "date"]}
|
|
170
|
+
aggrNeed="required"
|
|
171
|
+
value={props.intersection.backgroundColorAxis}
|
|
172
|
+
onChange={handleBackgroundColorAxisChange}
|
|
173
|
+
showColorMap={true}
|
|
174
|
+
filters={props.filters}
|
|
175
|
+
/>
|
|
176
|
+
</ui.FormGroup>
|
|
171
177
|
)
|
|
172
178
|
}
|
|
173
179
|
|
|
174
|
-
renderBackgroundColor() {
|
|
175
|
-
if (
|
|
180
|
+
const renderBackgroundColor = () => {
|
|
181
|
+
if (props.intersection.backgroundColorAxis) {
|
|
176
182
|
return
|
|
177
183
|
}
|
|
178
184
|
|
|
179
|
-
return
|
|
180
|
-
ui.FormGroup
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
185
|
+
return (
|
|
186
|
+
<ui.FormGroup
|
|
187
|
+
labelMuted={true}
|
|
188
|
+
label="Background Color"
|
|
189
|
+
help="This is an optional background color to set on all cells"
|
|
190
|
+
>
|
|
191
|
+
<ColorComponent
|
|
192
|
+
color={props.intersection.backgroundColor}
|
|
193
|
+
onChange={handleBackgroundColorChange}
|
|
194
|
+
/>
|
|
195
|
+
</ui.FormGroup>
|
|
190
196
|
)
|
|
191
197
|
}
|
|
192
198
|
|
|
193
|
-
renderBackgroundColorOpacityControl() {
|
|
199
|
+
const renderBackgroundColorOpacityControl = () => {
|
|
194
200
|
if (
|
|
195
|
-
!
|
|
196
|
-
!
|
|
197
|
-
!
|
|
201
|
+
!props.intersection.backgroundColorAxis &&
|
|
202
|
+
!props.intersection.backgroundColor &&
|
|
203
|
+
!props.intersection.backgroundColorConditions?.[0]
|
|
198
204
|
) {
|
|
199
205
|
return
|
|
200
206
|
}
|
|
201
207
|
|
|
202
|
-
return
|
|
203
|
-
ui.FormGroup
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
208
|
+
return (
|
|
209
|
+
<ui.FormGroup
|
|
210
|
+
labelMuted={true}
|
|
211
|
+
label={`Background Opacity: ${Math.round((props.intersection.backgroundColorOpacity ?? 1) * 100)}%`}
|
|
212
|
+
>
|
|
213
|
+
<Rcslider
|
|
214
|
+
min={0}
|
|
215
|
+
max={100}
|
|
216
|
+
step={1}
|
|
217
|
+
tipTransitionName="rc-slider-tooltip-zoom-down"
|
|
218
|
+
value={(props.intersection.backgroundColorOpacity ?? 1) * 100}
|
|
219
|
+
onChange={handleBackgroundColorOpacityChange}
|
|
220
|
+
/>
|
|
221
|
+
</ui.FormGroup>
|
|
216
222
|
)
|
|
217
223
|
}
|
|
218
224
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
const renderSegmentValueAxisOverride = (segment: PivotChartSegment) => {
|
|
226
|
+
// Get type of segment axis
|
|
227
|
+
const axisBuilder = new AxisBuilder({ schema: props.schema })
|
|
228
|
+
|
|
229
|
+
const segmentValueAxisType = axisBuilder.getAxisType(segment.valueAxis!)
|
|
230
|
+
if (!segmentValueAxisType) {
|
|
231
|
+
return null
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const overrideValueAxis = (props.intersection.segmentValueAxisOverrides || {})[segment.id]
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<ui.FormGroup
|
|
238
|
+
labelMuted={true}
|
|
239
|
+
label={(segment.label || axisBuilder.summarizeAxis(segment.valueAxis!)) + ":"}
|
|
240
|
+
>
|
|
241
|
+
<AxisComponent
|
|
242
|
+
schema={props.schema}
|
|
243
|
+
dataSource={props.dataSource}
|
|
244
|
+
table={table}
|
|
245
|
+
types={[segmentValueAxisType]}
|
|
246
|
+
aggrNeed="none"
|
|
247
|
+
value={overrideValueAxis}
|
|
248
|
+
onChange={valueAxis => props.onChange(produce(props.intersection, (draft: PivotChartIntersection) => {
|
|
249
|
+
draft.segmentValueAxisOverrides = draft.segmentValueAxisOverrides || {}
|
|
250
|
+
draft.segmentValueAxisOverrides[segment.id] = valueAxis
|
|
251
|
+
}))}
|
|
252
|
+
allowExcludedValues={false}
|
|
253
|
+
collapseCategories={true}
|
|
254
|
+
/>
|
|
255
|
+
</ui.FormGroup>
|
|
231
256
|
)
|
|
232
257
|
}
|
|
258
|
+
|
|
259
|
+
const renderSegmentValueAxisOverrides = () => {
|
|
260
|
+
if (!props.intersection.tableOverride) {
|
|
261
|
+
return null
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Get all segments
|
|
265
|
+
const segments = getAllSegments(props.design.rows).concat(getAllSegments(props.design.columns))
|
|
266
|
+
|
|
267
|
+
// Filter out segments that are not intersecting
|
|
268
|
+
const intersectingSegmentIds = props.intersectionId.split(/[,:]/).filter(id => id !== "")
|
|
269
|
+
const intersectingSegments = segments.filter(segment => intersectingSegmentIds.includes(segment.id) && segment.valueAxis)
|
|
270
|
+
|
|
271
|
+
return (
|
|
272
|
+
<ui.FormGroup
|
|
273
|
+
labelMuted={true}
|
|
274
|
+
label="Fields to disaggregate data by (required)"
|
|
275
|
+
>
|
|
276
|
+
{intersectingSegments.map(segment => renderSegmentValueAxisOverride(segment))}
|
|
277
|
+
</ui.FormGroup>
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const renderOverrideTable = () => {
|
|
282
|
+
return (
|
|
283
|
+
<ui.CollapsibleSection
|
|
284
|
+
label="Advanced: Override Data Source"
|
|
285
|
+
hint="Use a different data source for this cell"
|
|
286
|
+
labelMuted={true}
|
|
287
|
+
initiallyOpen={props.intersection.tableOverride != null}
|
|
288
|
+
>
|
|
289
|
+
<TableSelectComponent
|
|
290
|
+
schema={props.schema}
|
|
291
|
+
value={props.intersection.tableOverride}
|
|
292
|
+
onChange={handleTableOverrideChange}
|
|
293
|
+
/>
|
|
294
|
+
<br />
|
|
295
|
+
{renderSegmentValueAxisOverrides()}
|
|
296
|
+
</ui.CollapsibleSection>
|
|
297
|
+
)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return (
|
|
301
|
+
<div>
|
|
302
|
+
{renderValueAxis()}
|
|
303
|
+
{renderNullValue()}
|
|
304
|
+
{renderFilter()}
|
|
305
|
+
{renderStyling()}
|
|
306
|
+
{renderBackgroundColorAxis()}
|
|
307
|
+
{renderBackgroundColorConditions()}
|
|
308
|
+
{renderBackgroundColor()}
|
|
309
|
+
{renderBackgroundColorOpacityControl()}
|
|
310
|
+
{renderOverrideTable()}
|
|
311
|
+
</div>
|
|
312
|
+
)
|
|
233
313
|
}
|
|
234
314
|
|
|
235
315
|
interface BackgroundColorConditionsComponentProps {
|
|
@@ -250,33 +330,37 @@ class BackgroundColorConditionsComponent extends React.Component<BackgroundColor
|
|
|
250
330
|
|
|
251
331
|
render() {
|
|
252
332
|
// List conditions
|
|
253
|
-
return
|
|
254
|
-
ui.FormGroup
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
ui.Button
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
333
|
+
return (
|
|
334
|
+
<ui.FormGroup
|
|
335
|
+
label="Color Conditions"
|
|
336
|
+
labelMuted={true}
|
|
337
|
+
help="Add conditions that, if met, set the color of the cell. Useful for flagging certain values"
|
|
338
|
+
>
|
|
339
|
+
<ListEditorComponent<{ condition?: Expr, color?: string }>
|
|
340
|
+
items={this.props.colorConditions || []}
|
|
341
|
+
renderItem={(item, index, onItemChange) => {
|
|
342
|
+
return (
|
|
343
|
+
<BackgroundColorConditionComponent
|
|
344
|
+
key={index}
|
|
345
|
+
colorCondition={item}
|
|
346
|
+
table={this.props.table}
|
|
347
|
+
schema={this.props.schema}
|
|
348
|
+
dataSource={this.props.dataSource}
|
|
349
|
+
onChange={onItemChange}
|
|
350
|
+
/>
|
|
351
|
+
)
|
|
352
|
+
}}
|
|
353
|
+
onItemsChange={this.props.onChange}
|
|
354
|
+
/>
|
|
355
|
+
<ui.Button
|
|
356
|
+
type="link"
|
|
357
|
+
size="sm"
|
|
358
|
+
onClick={this.handleAdd}
|
|
359
|
+
>
|
|
360
|
+
<ui.Icon id="fa-plus" />
|
|
361
|
+
Add Condition
|
|
362
|
+
</ui.Button>
|
|
363
|
+
</ui.FormGroup>
|
|
280
364
|
)
|
|
281
365
|
}
|
|
282
366
|
}
|
|
@@ -289,7 +373,9 @@ interface BackgroundColorConditionComponentProps {
|
|
|
289
373
|
onChange: any
|
|
290
374
|
}
|
|
291
375
|
|
|
292
|
-
|
|
376
|
+
/**
|
|
377
|
+
* Displays single background color condition
|
|
378
|
+
*/
|
|
293
379
|
class BackgroundColorConditionComponent extends React.Component<BackgroundColorConditionComponentProps> {
|
|
294
380
|
constructor(props: BackgroundColorConditionComponentProps) {
|
|
295
381
|
super(props)
|
|
@@ -302,37 +388,35 @@ class BackgroundColorConditionComponent extends React.Component<BackgroundColorC
|
|
|
302
388
|
}
|
|
303
389
|
|
|
304
390
|
render() {
|
|
305
|
-
return
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
onChange: this.update("color")
|
|
334
|
-
})
|
|
335
|
-
)
|
|
391
|
+
return (
|
|
392
|
+
<div>
|
|
393
|
+
<ui.FormGroup
|
|
394
|
+
labelMuted={true}
|
|
395
|
+
label="Condition"
|
|
396
|
+
>
|
|
397
|
+
<ExprComponent
|
|
398
|
+
schema={this.props.schema}
|
|
399
|
+
dataSource={this.props.dataSource}
|
|
400
|
+
onChange={this.update("condition")}
|
|
401
|
+
types={["boolean"]}
|
|
402
|
+
aggrStatuses={["aggregate", "literal"]}
|
|
403
|
+
table={this.props.table}
|
|
404
|
+
value={this.props.colorCondition.condition}
|
|
405
|
+
/>
|
|
406
|
+
</ui.FormGroup>
|
|
407
|
+
|
|
408
|
+
<ui.FormGroup
|
|
409
|
+
labelMuted={true}
|
|
410
|
+
label="Color"
|
|
411
|
+
hint="Color to display when condition is met"
|
|
412
|
+
>
|
|
413
|
+
<ColorComponent
|
|
414
|
+
color={this.props.colorCondition.color}
|
|
415
|
+
onChange={this.update("color")}
|
|
416
|
+
/>
|
|
417
|
+
</ui.FormGroup>
|
|
418
|
+
</div>
|
|
336
419
|
)
|
|
337
420
|
}
|
|
338
421
|
}
|
|
422
|
+
|