@mwater/visualization 5.1.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/GlobalFilter.d.ts +13 -0
- package/lib/GlobalFilter.js +2 -0
- 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 +7 -25
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +19 -9
- package/lib/MWaterContextComponent.js +38 -22
- package/lib/MWaterCustomTablesetListComponent.js +9 -3
- package/lib/MWaterGlobalFiltersComponent.d.ts +6 -5
- package/lib/MWaterGlobalFiltersComponent.js +4 -4
- package/lib/MWaterLoaderComponent.d.ts +15 -3
- package/lib/MWaterLoaderComponent.js +11 -2
- 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/Axis.d.ts +20 -25
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +12 -8
- package/lib/axes/AxisComponent.d.ts +6 -9
- 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 -17
- package/lib/dashboards/DashboardComponent.js +20 -67
- package/lib/dashboards/DashboardDesign.d.ts +5 -20
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +112 -136
- 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 +209 -39
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/SettingsModalComponent.d.ts +4 -15
- package/lib/dashboards/SettingsModalComponent.js +24 -38
- 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/DatagridComponent.d.ts +2 -9
- package/lib/datagrids/DatagridDataSource.d.ts +3 -3
- package/lib/datagrids/DatagridDataSource.js +0 -14
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -93
- package/lib/datagrids/DatagridDesignerComponent.js +8 -6
- package/lib/datagrids/DatagridViewComponent.js +1 -1
- package/lib/datagrids/FindReplaceModalComponent.d.ts +4 -20
- package/lib/datagrids/FindReplaceModalComponent.js +27 -13
- package/lib/datagrids/ServerDatagridDataSource.d.ts +8 -7
- package/lib/datagrids/ServerDatagridDataSource.js +88 -36
- package/lib/demo.js +4 -4
- package/lib/index.css +5 -0
- package/lib/index.d.ts +2 -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 -56
- 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/layouts/grid/GridLayoutManager.d.ts +2 -1
- 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 +5 -2
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/ClusterLayer.js +3 -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/GridLayer.js +5 -3
- package/lib/maps/GridLayerDesigner.js +0 -1
- package/lib/maps/LayerSwitcherComponent.js +1 -1
- package/lib/maps/MapComponent.d.ts +3 -11
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MapDesign.d.ts +2 -13
- package/lib/maps/MapFiltersDesignerComponent.d.ts +0 -4
- package/lib/maps/MapFiltersDesignerComponent.js +4 -5
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +3 -13
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/RegionSelectComponent.d.ts +2 -1
- package/lib/maps/ServerMapDataSource.d.ts +3 -4
- 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.d.ts +1 -0
- package/lib/maps/vectorMaps.js +70 -56
- package/lib/quickfilter/QuickfilterCompiler.d.ts +1 -1
- 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 +3 -11
- package/lib/widgets/ImageWidgetComponent.d.ts +8 -27
- package/lib/widgets/MapWidget.d.ts +4 -7
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/MarkdownWidget.d.ts +2 -7
- package/lib/widgets/TOCWidget.d.ts +2 -9
- 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 -74
- 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/imagemosaic/ImagePopupComponent.d.ts +2 -7
- 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 +5 -31
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -7
- 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 -105
- 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 +11 -7
- 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 -47
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +55 -58
- 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 +30 -16
- package/lib/widgets/text/ExprInsertModalComponent.d.ts +2 -13
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +2 -13
- 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 +16 -2
- 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/GlobalFilter.ts +17 -0
- 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 +42 -33
- package/src/MWaterCustomTablesetListComponent.tsx +21 -3
- package/src/MWaterGlobalFiltersComponent.ts +8 -8
- package/src/MWaterLoaderComponent.ts +14 -4
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/Axis.ts +24 -25
- package/src/axes/AxisBuilder.ts +16 -13
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +73 -147
- package/src/dashboards/DashboardDesign.ts +5 -25
- 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 +377 -71
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/SettingsModalComponent.tsx +170 -0
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDataSource.ts +6 -12
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/DatagridDesignerComponent.tsx +22 -18
- package/src/datagrids/DatagridViewComponent.ts +3 -3
- package/src/datagrids/ExprCellComponent.ts +0 -1
- package/src/datagrids/FindReplaceModalComponent.ts +39 -22
- package/src/datagrids/ServerDatagridDataSource.ts +107 -45
- package/src/demo.ts +4 -4
- package/src/index.css +5 -0
- package/src/index.ts +2 -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 +5 -2
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/ClusterLayer.ts +3 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/GridLayer.ts +5 -3
- package/src/maps/GridLayerDesigner.tsx +0 -1
- package/src/maps/LayerSwitcherComponent.tsx +1 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MapDesign.ts +2 -17
- package/src/maps/{MapFiltersDesignerComponent.ts → MapFiltersDesignerComponent.tsx} +25 -25
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +8 -8
- package/src/maps/VectorMapViewComponent.tsx +2 -2
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +88 -74
- package/src/quickfilter/QuickfilterCompiler.ts +1 -1
- 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 +32 -19
- 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 +26 -2
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -304
- package/src/dashboards/SettingsModalComponent.ts +0 -169
- 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,25 +1,22 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
1
|
import _ from "lodash"
|
|
3
2
|
import React, { ReactNode } from "react"
|
|
4
3
|
const R = React.createElement
|
|
5
4
|
|
|
6
5
|
import { DataSource, ExprCompiler, Schema } from "@mwater/expressions"
|
|
7
|
-
import { ExprCleaner } from "@mwater/expressions"
|
|
8
6
|
import UndoStack from "../UndoStack"
|
|
9
7
|
import * as DashboardUtils from "./DashboardUtils"
|
|
10
|
-
import DashboardViewComponent from "./DashboardViewComponent"
|
|
8
|
+
import DashboardViewComponent, { DashboardViewComponentHandle } from "./DashboardViewComponent"
|
|
11
9
|
import QuickfiltersComponent from "../quickfilter/QuickfiltersComponent"
|
|
12
10
|
import QuickfilterCompiler from "../quickfilter/QuickfilterCompiler"
|
|
13
11
|
import SettingsModalComponent from "./SettingsModalComponent"
|
|
14
12
|
import LayoutManager from "../layouts/LayoutManager"
|
|
15
|
-
import DashboardUpgrader from "./DashboardUpgrader"
|
|
16
13
|
import { LayoutOptionsComponent } from "./LayoutOptionsComponent"
|
|
17
14
|
import ModalWindowComponent from "@mwater/react-library/lib/ModalWindowComponent"
|
|
18
15
|
import { getLayoutOptions } from "./layoutOptions"
|
|
19
16
|
import { DashboardDesign } from "./DashboardDesign"
|
|
20
17
|
import DashboardDataSource from "./DashboardDataSource"
|
|
21
18
|
import { JsonQLFilter } from ".."
|
|
22
|
-
import { ActiveTablesContext } from "@mwater/expressions-ui"
|
|
19
|
+
import { ActiveTablesContext, LocaleContext } from "@mwater/expressions-ui"
|
|
23
20
|
|
|
24
21
|
export interface DashboardComponentProps {
|
|
25
22
|
design: DashboardDesign
|
|
@@ -75,31 +72,20 @@ export interface DashboardComponentState {
|
|
|
75
72
|
* Manages undo stack and quickfilter value
|
|
76
73
|
*/
|
|
77
74
|
export default class DashboardComponent extends React.Component<DashboardComponentProps, DashboardComponentState> {
|
|
78
|
-
dashboardView:
|
|
75
|
+
dashboardView: DashboardViewComponentHandle | null
|
|
79
76
|
|
|
80
77
|
static defaultProps = { printScaling: true }
|
|
81
78
|
|
|
82
|
-
static childContextTypes = {
|
|
83
|
-
locale: PropTypes.string,
|
|
84
|
-
}
|
|
85
|
-
|
|
86
79
|
settings: SettingsModalComponent | null
|
|
87
80
|
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
// Pass locale down. Both here and DashboardViewComponent to ensure that quickfilters also get context
|
|
91
|
-
locale: this.props.design.locale,
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
constructor(props: any) {
|
|
81
|
+
constructor(props: DashboardComponentProps) {
|
|
96
82
|
super(props)
|
|
97
83
|
|
|
98
84
|
const layoutOptions = getLayoutOptions(props.design)
|
|
99
85
|
|
|
100
86
|
this.state = {
|
|
101
87
|
undoStack: new UndoStack().push(props.design),
|
|
102
|
-
quickfiltersValues: props.quickfiltersValues,
|
|
88
|
+
quickfiltersValues: props.quickfiltersValues || null,
|
|
103
89
|
editing:
|
|
104
90
|
LayoutManager.createLayoutManager(props.design.layout).isEmpty(props.design.items) &&
|
|
105
91
|
props.onDesignChange != null,
|
|
@@ -138,7 +124,7 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
138
124
|
}
|
|
139
125
|
|
|
140
126
|
handlePrint = () => {
|
|
141
|
-
this.dashboardView
|
|
127
|
+
this.dashboardView?.print()
|
|
142
128
|
}
|
|
143
129
|
|
|
144
130
|
handleUndo = () => {
|
|
@@ -198,21 +184,6 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
198
184
|
return this.setState({ hideQuickfilters: false })
|
|
199
185
|
}
|
|
200
186
|
|
|
201
|
-
handleUpgrade = () => {
|
|
202
|
-
if (
|
|
203
|
-
!confirm(
|
|
204
|
-
"This will upgrade your dashboard to the new kind with enhanced features. You can click Undo immediately afterwards if you wish to revert it. Continue?"
|
|
205
|
-
)
|
|
206
|
-
) {
|
|
207
|
-
return
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const design = new DashboardUpgrader().upgrade(this.props.design)
|
|
211
|
-
this.props.onDesignChange!(design)
|
|
212
|
-
|
|
213
|
-
alert("Upgrade completed. Some widgets may need to be resized. Click Undo to revert back to old dashboard style.")
|
|
214
|
-
}
|
|
215
|
-
|
|
216
187
|
// Get filters from props filters combined with dashboard filters
|
|
217
188
|
getCompiledFilters() {
|
|
218
189
|
let compiledFilters = DashboardUtils.getCompiledFilters(
|
|
@@ -237,45 +208,6 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
237
208
|
)
|
|
238
209
|
}
|
|
239
210
|
|
|
240
|
-
renderStyleItem(style: any) {
|
|
241
|
-
const isActive = (this.props.design.style || "default") === style
|
|
242
|
-
|
|
243
|
-
const content = (() => {
|
|
244
|
-
switch (style) {
|
|
245
|
-
case "default":
|
|
246
|
-
return [
|
|
247
|
-
R("h4", { key: "name", className: "list-group-item-heading" }, "Classic Dashboard"),
|
|
248
|
-
R("p", { key: "description", className: "" }, "Ideal for data display with minimal text")
|
|
249
|
-
]
|
|
250
|
-
case "greybg":
|
|
251
|
-
return [
|
|
252
|
-
R("h4", { key: "name", className: "list-group-item-heading" }, "Framed Dashboard"),
|
|
253
|
-
R("p", { key: "description", className: "" }, "Each widget is white on a grey background")
|
|
254
|
-
]
|
|
255
|
-
case "story":
|
|
256
|
-
return [
|
|
257
|
-
R("h4", { key: "name", className: "list-group-item-heading" }, "Story"),
|
|
258
|
-
R(
|
|
259
|
-
"p",
|
|
260
|
-
{ key: "description", className: "" },
|
|
261
|
-
"Ideal for data-driven storytelling with lots of text. Responsive and mobile-friendly"
|
|
262
|
-
)
|
|
263
|
-
]
|
|
264
|
-
}
|
|
265
|
-
return null
|
|
266
|
-
})()
|
|
267
|
-
|
|
268
|
-
return R(
|
|
269
|
-
"a",
|
|
270
|
-
{
|
|
271
|
-
key: style,
|
|
272
|
-
className: `list-group-item ${isActive ? "active" : ""}`,
|
|
273
|
-
onClick: this.handleStyleChange.bind(null, style)
|
|
274
|
-
},
|
|
275
|
-
content
|
|
276
|
-
)
|
|
277
|
-
}
|
|
278
|
-
|
|
279
211
|
renderStyle() {
|
|
280
212
|
return R(
|
|
281
213
|
"button",
|
|
@@ -289,37 +221,30 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
289
221
|
return R(
|
|
290
222
|
"div",
|
|
291
223
|
null,
|
|
292
|
-
this.state.editing && (this.props.design.layout || "grid") === "grid"
|
|
293
|
-
? R(
|
|
294
|
-
"a",
|
|
295
|
-
{ key: "upgrade", className: "btn btn-info btn-sm", onClick: this.handleUpgrade },
|
|
296
|
-
"Upgrade Dashboard..."
|
|
297
|
-
)
|
|
298
|
-
: undefined,
|
|
299
224
|
this.state.editing
|
|
300
225
|
? [
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
226
|
+
R(
|
|
227
|
+
"a",
|
|
228
|
+
{
|
|
229
|
+
key: "undo",
|
|
230
|
+
className: `btn btn-link btn-sm ${!this.state.undoStack.canUndo() ? "disabled" : ""}`,
|
|
231
|
+
onClick: this.handleUndo
|
|
232
|
+
},
|
|
233
|
+
R("span", { className: "fas fa-caret-left" }),
|
|
234
|
+
R("span", { className: "hide-600px" }, " Undo")
|
|
235
|
+
),
|
|
236
|
+
" ",
|
|
237
|
+
R(
|
|
238
|
+
"a",
|
|
239
|
+
{
|
|
240
|
+
key: "redo",
|
|
241
|
+
className: `btn btn-link btn-sm ${!this.state.undoStack.canRedo() ? "disabled" : ""}`,
|
|
242
|
+
onClick: this.handleRedo
|
|
243
|
+
},
|
|
244
|
+
R("span", { className: "fas fa-caret-right" }),
|
|
245
|
+
R("span", { className: "hide-600px" }, " Redo")
|
|
246
|
+
)
|
|
247
|
+
]
|
|
323
248
|
: undefined,
|
|
324
249
|
R(
|
|
325
250
|
"a",
|
|
@@ -335,11 +260,11 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
335
260
|
),
|
|
336
261
|
this.state.hideQuickfilters && this.props.design.quickfilters && this.props.design.quickfilters.length > 0
|
|
337
262
|
? R(
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
263
|
+
"a",
|
|
264
|
+
{ key: "showQuickfilters", className: "btn btn-link btn-sm", onClick: this.handleShowQuickfilters },
|
|
265
|
+
R("span", { className: "fa fa-filter" }),
|
|
266
|
+
R("span", { className: "hide-600px" }, " Show Quickfilters")
|
|
267
|
+
)
|
|
343
268
|
: undefined,
|
|
344
269
|
|
|
345
270
|
// R 'a', key: "export", className: "btn btn-link btn-sm", onClick: @handleSaveDesignFile,
|
|
@@ -347,11 +272,11 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
347
272
|
// " Export"
|
|
348
273
|
this.state.editing
|
|
349
274
|
? R(
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
275
|
+
"a",
|
|
276
|
+
{ key: "settings", className: "btn btn-link btn-sm", onClick: this.handleSettings },
|
|
277
|
+
R("span", { className: "fas fa-cog" }),
|
|
278
|
+
R("span", { className: "hide-600px" }, " Settings")
|
|
279
|
+
)
|
|
355
280
|
: undefined,
|
|
356
281
|
this.state.editing ? this.renderStyle() : undefined,
|
|
357
282
|
this.props.extraTitleButtonsElem,
|
|
@@ -379,12 +304,13 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
379
304
|
locks: this.props.quickfilterLocks,
|
|
380
305
|
filters: this.getCompiledFilters(),
|
|
381
306
|
hideTopBorder: this.props.hideTitleBar,
|
|
382
|
-
|
|
307
|
+
// Don't hide if title bar is hidden as it can't be shown again
|
|
308
|
+
onHide: () => !this.props.hideTitleBar ? this.setState({ hideQuickfilters: true }) : undefined
|
|
383
309
|
})
|
|
384
310
|
}
|
|
385
311
|
|
|
386
312
|
refDashboardView = (el: any) => {
|
|
387
|
-
|
|
313
|
+
this.dashboardView = el
|
|
388
314
|
}
|
|
389
315
|
|
|
390
316
|
render() {
|
|
@@ -427,39 +353,39 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
427
353
|
|
|
428
354
|
|
|
429
355
|
// Pass active tables down to table select components so they can present a shorter list
|
|
430
|
-
return <ActiveTablesContext.Provider
|
|
356
|
+
return <ActiveTablesContext.Provider
|
|
431
357
|
value={DashboardUtils.getFilterableTables(this.props.design, this.props.schema)}>
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
358
|
+
<LocaleContext.Provider value={this.props.design.locale ?? "en"}>
|
|
359
|
+
<div style={{
|
|
360
|
+
display: "grid",
|
|
361
|
+
gridTemplateRows: this.props.hideTitleBar ? "auto 1fr" : "auto auto 1fr",
|
|
362
|
+
height: "100%"
|
|
363
|
+
}}>
|
|
364
|
+
{!this.props.hideTitleBar ? this.renderTitleBar() : undefined}
|
|
365
|
+
<div>{!this.state.hideQuickfilters ? this.renderQuickfilter() : undefined}</div>
|
|
366
|
+
{dashboardView}
|
|
367
|
+
{this.props.onDesignChange != null && (
|
|
368
|
+
<SettingsModalComponent
|
|
369
|
+
onDesignChange={this.handleDesignChange}
|
|
370
|
+
schema={this.props.schema}
|
|
371
|
+
dataSource={this.props.dataSource}
|
|
372
|
+
ref={(c: SettingsModalComponent | null) => {
|
|
373
|
+
this.settings = c
|
|
374
|
+
}}
|
|
375
|
+
/>
|
|
376
|
+
)}
|
|
377
|
+
{this.state.layoutOptionsOpen && (
|
|
378
|
+
<ModalWindowComponent isOpen={true} outerPadding={10} innerPadding={10} onRequestClose={() => this.setState({ layoutOptionsOpen: false })}>
|
|
379
|
+
<LayoutOptionsComponent
|
|
380
|
+
design={this.props.design}
|
|
381
|
+
onDesignChange={this.props.onDesignChange!}
|
|
382
|
+
dashboardView={readonlyDashboardView}
|
|
383
|
+
quickfiltersView={this.renderQuickfilter()}
|
|
384
|
+
/>
|
|
385
|
+
</ModalWindowComponent>
|
|
386
|
+
)}
|
|
387
|
+
</div>
|
|
388
|
+
</LocaleContext.Provider>
|
|
463
389
|
</ActiveTablesContext.Provider>
|
|
464
390
|
}
|
|
465
391
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JsonQLFilter } from "../JsonQLFilter"
|
|
2
1
|
import { Quickfilter } from "../quickfilter/Quickfilter"
|
|
3
|
-
import {
|
|
2
|
+
import { Expr } from "@mwater/expressions"
|
|
4
3
|
import { BlocksLayoutOptions, DashboardTheme } from "./layoutOptions"
|
|
4
|
+
import { GlobalFilter } from "../GlobalFilter"
|
|
5
5
|
|
|
6
6
|
/** Dashboard design
|
|
7
7
|
* Each understands enough of the dashboard design to create widgets.
|
|
@@ -15,13 +15,13 @@ export interface DashboardDesign {
|
|
|
15
15
|
quickfilters?: Quickfilter[]
|
|
16
16
|
|
|
17
17
|
/** layout engine to use (`blocks` is new default) */
|
|
18
|
-
layout: "blocks"
|
|
18
|
+
layout: "blocks"
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/** Optional theme to use. Defaults to "default" theme. */
|
|
21
21
|
style?: DashboardTheme
|
|
22
22
|
|
|
23
23
|
/** Options for layout including responsiveness, scaling, etc */
|
|
24
|
-
layoutOptions?: BlocksLayoutOptions
|
|
24
|
+
layoutOptions?: Partial<BlocksLayoutOptions>
|
|
25
25
|
|
|
26
26
|
/** filter expression indexed by table. e.g. { sometable: logical expression, etc. } */
|
|
27
27
|
filters?: { [tableId: string]: Expr }
|
|
@@ -35,23 +35,3 @@ export interface DashboardDesign {
|
|
|
35
35
|
/** array of global filters. See below. */
|
|
36
36
|
globalFilters?: GlobalFilter[]
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
/** Global Filters:
|
|
40
|
-
|
|
41
|
-
Global filters apply to multiple tables at once if a certain column is present. User-interface to set them is application-specific
|
|
42
|
-
and the default (non-mWater) dashboard applies them but does not allow editing.
|
|
43
|
-
|
|
44
|
-
*/
|
|
45
|
-
export interface GlobalFilter {
|
|
46
|
-
/** id of column to filter */
|
|
47
|
-
columnId: string
|
|
48
|
-
|
|
49
|
-
/** type of column to filter (to ensure that consistent) */
|
|
50
|
-
columnType: LiteralType
|
|
51
|
-
|
|
52
|
-
/** op of expression for filtering */
|
|
53
|
-
op: string
|
|
54
|
-
|
|
55
|
-
/** array of expressions to use for filtering. field expression for column will be injected as expression 0 in the resulting filter expression */
|
|
56
|
-
exprs: Expr[]
|
|
57
|
-
}
|
|
@@ -60,7 +60,47 @@ export default class DashboardUpgrader {
|
|
|
60
60
|
delete items[li]
|
|
61
61
|
}
|
|
62
62
|
} else if (lineItems.length === 1) {
|
|
63
|
-
|
|
63
|
+
const item = items[lineItems[0]]
|
|
64
|
+
const convertedBlock = convertBlock(lineItems[0], item)
|
|
65
|
+
|
|
66
|
+
// If widget goes all the way across
|
|
67
|
+
if (item.layout.x + item.layout.w == 24) {
|
|
68
|
+
newItems.blocks.push(convertedBlock)
|
|
69
|
+
} else {
|
|
70
|
+
const leftSpacerWidth = item.layout.x
|
|
71
|
+
const rightSpacerWidth = 24 - (item.layout.x + item.layout.w)
|
|
72
|
+
const blocks = []
|
|
73
|
+
const weights = []
|
|
74
|
+
|
|
75
|
+
if (leftSpacerWidth > 0) {
|
|
76
|
+
blocks.push({
|
|
77
|
+
id: uuid(),
|
|
78
|
+
type: "spacer",
|
|
79
|
+
aspectRatio: 3,
|
|
80
|
+
})
|
|
81
|
+
weights.push(leftSpacerWidth)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
blocks.push(convertedBlock)
|
|
85
|
+
weights.push(item.layout.w)
|
|
86
|
+
|
|
87
|
+
if (rightSpacerWidth > 0) {
|
|
88
|
+
blocks.push({
|
|
89
|
+
id: uuid(),
|
|
90
|
+
type: "spacer",
|
|
91
|
+
aspectRatio: 3,
|
|
92
|
+
})
|
|
93
|
+
weights.push(rightSpacerWidth)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
newItems.blocks.push({
|
|
97
|
+
id: uuid(),
|
|
98
|
+
type: "horizontal",
|
|
99
|
+
blocks,
|
|
100
|
+
weights,
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
64
104
|
delete items[lineItems[0]]
|
|
65
105
|
}
|
|
66
106
|
|