@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
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
import { useContext, useMemo, createContext } from "react"
|
|
2
|
+
import { DashboardDesign } from "./DashboardDesign"
|
|
3
|
+
import React from "react"
|
|
4
|
+
import { CustomColorsContext } from "../CustomColorsContext"
|
|
5
|
+
|
|
6
|
+
export type DashboardTheme = "default" | "greybg" | "story"
|
|
7
|
+
|
|
8
|
+
/** Width buckets for dashboards */
|
|
9
|
+
export type WidthBucket = "sm" | "md" | "lg" | "xl"
|
|
10
|
+
|
|
11
|
+
export interface BlocksLayoutOptions {
|
|
12
|
+
/** Width at which to collapse columns. Null to not collapse */
|
|
13
|
+
collapseColumnsWidth: number | null
|
|
14
|
+
|
|
15
|
+
/** Width below which scales or scrolls */
|
|
16
|
+
minimumWidth: number | null
|
|
17
|
+
|
|
18
|
+
/** What to do when below minimum width */
|
|
19
|
+
belowMinimumWidth: "scale" | "scroll"
|
|
20
|
+
|
|
21
|
+
/** Width above which pads */
|
|
22
|
+
maximumWidth: number | null
|
|
23
|
+
|
|
24
|
+
/** Width at which to hide quickfilters. Null for never */
|
|
25
|
+
hideQuickfiltersWidth: number | null
|
|
26
|
+
|
|
27
|
+
/** The padding around the entire dashboard */
|
|
28
|
+
outerPadding: number
|
|
29
|
+
|
|
30
|
+
/** The background color of the dashboard */
|
|
31
|
+
backgroundColor: string
|
|
32
|
+
|
|
33
|
+
/** Whether to collapse spacers on narrow screens */
|
|
34
|
+
collapseSpacers: boolean
|
|
35
|
+
|
|
36
|
+
/** The font style for text widgets */
|
|
37
|
+
textWidgetFont: FontStyle
|
|
38
|
+
|
|
39
|
+
/** The line height for text widgets */
|
|
40
|
+
textWidgetLineHeight: number | null
|
|
41
|
+
|
|
42
|
+
/** The spacing between paragraphs in text widgets */
|
|
43
|
+
textWidgetParagraphSpacing: number
|
|
44
|
+
|
|
45
|
+
/** The line height for text widgets */
|
|
46
|
+
textWidgetListLineHeight: number | null
|
|
47
|
+
|
|
48
|
+
/** The margin top for H1 text widgets */
|
|
49
|
+
textWidgetH1MarginTop: number
|
|
50
|
+
|
|
51
|
+
/** The font style for H1 text widgets */
|
|
52
|
+
textWidgetH1Font: FontStyle
|
|
53
|
+
|
|
54
|
+
/** The margin top for H2 text widgets */
|
|
55
|
+
textWidgetH2MarginTop: number
|
|
56
|
+
|
|
57
|
+
/** The font style for H2 text widgets */
|
|
58
|
+
textWidgetH2Font: FontStyle
|
|
59
|
+
|
|
60
|
+
/** The font style for title widgets */
|
|
61
|
+
titleWidgetFont: FontStyle
|
|
62
|
+
|
|
63
|
+
/** The margin around blocks */
|
|
64
|
+
blockMargin: Spacing
|
|
65
|
+
|
|
66
|
+
/** The padding inside of blocks */
|
|
67
|
+
blockPadding: Spacing
|
|
68
|
+
|
|
69
|
+
/** The border radius of blocks */
|
|
70
|
+
blockBorderRadius: number
|
|
71
|
+
|
|
72
|
+
/** The background color of blocks */
|
|
73
|
+
blockBackgroundColor: string
|
|
74
|
+
|
|
75
|
+
/** The font style for widget headers */
|
|
76
|
+
widgetHeaderFont: FontStyle
|
|
77
|
+
|
|
78
|
+
/** The font style for widget footers */
|
|
79
|
+
widgetFooterFont: FontStyle
|
|
80
|
+
|
|
81
|
+
/** The font style for charts */
|
|
82
|
+
chartFont: FontStyle
|
|
83
|
+
|
|
84
|
+
/** The font style for tables */
|
|
85
|
+
tableFont: FontStyle
|
|
86
|
+
|
|
87
|
+
/** The font style for pivot tables */
|
|
88
|
+
pivotTableFont: FontStyle
|
|
89
|
+
|
|
90
|
+
/** Custom colors */
|
|
91
|
+
customColors: (string | null)[]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface Spacing {
|
|
95
|
+
top: number
|
|
96
|
+
bottom: number
|
|
97
|
+
left: number
|
|
98
|
+
right: number
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface FontStyle {
|
|
102
|
+
size: number
|
|
103
|
+
color: string
|
|
104
|
+
family: string
|
|
105
|
+
weight: string
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** React context for block layout options */
|
|
109
|
+
export const BlocksLayoutOptionsContext = createContext<BlocksLayoutOptions | null>(null)
|
|
110
|
+
|
|
111
|
+
/** Get default layout options for a theme */
|
|
112
|
+
export function getDefaultLayoutOptions(theme?: DashboardTheme | undefined): BlocksLayoutOptions {
|
|
113
|
+
if (!theme || theme === "default") {
|
|
114
|
+
return defaultTheme
|
|
115
|
+
}
|
|
116
|
+
if (theme === "greybg") {
|
|
117
|
+
return greybgTheme
|
|
118
|
+
}
|
|
119
|
+
if (theme === "story") {
|
|
120
|
+
return storyTheme
|
|
121
|
+
}
|
|
122
|
+
throw new Error(`Unknown theme: ${theme}`)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Gets the current layout options for a design */
|
|
126
|
+
export function getLayoutOptions(design: DashboardDesign): BlocksLayoutOptions {
|
|
127
|
+
if (!design.layoutOptions) {
|
|
128
|
+
return getDefaultLayoutOptions(design.style)
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
...getDefaultLayoutOptions(design.style),
|
|
132
|
+
...design.layoutOptions
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Injects the dashboard style into the child component. Also provides a context for layout options.
|
|
138
|
+
* This is to allow modals to reinject the layout options when they are opened.
|
|
139
|
+
*/
|
|
140
|
+
export function DashboardStyleWrapper(props: {
|
|
141
|
+
layoutOptions: BlocksLayoutOptions
|
|
142
|
+
children: React.ReactNode
|
|
143
|
+
style: React.CSSProperties
|
|
144
|
+
}) {
|
|
145
|
+
const scope = useMemo(() => {
|
|
146
|
+
return `id_${Math.random().toString(36).substring(7)}`
|
|
147
|
+
}, [])
|
|
148
|
+
|
|
149
|
+
// Get outer custom colors from context and merge with layout options
|
|
150
|
+
const outerCustomColors = useContext(CustomColorsContext) || { customColors: [] }
|
|
151
|
+
const mergedCustomColors = outerCustomColors.customColors.map((outerColor, index) =>
|
|
152
|
+
props.layoutOptions.customColors[index] || outerColor
|
|
153
|
+
).concat(props.layoutOptions.customColors.slice(outerCustomColors.customColors.length))
|
|
154
|
+
|
|
155
|
+
return <div id={scope} style={props.style}>
|
|
156
|
+
<style dangerouslySetInnerHTML={{ __html: createDashboardStyles("#" + scope, props.layoutOptions) }} />
|
|
157
|
+
<CustomColorsContext.Provider value={{ customColors: mergedCustomColors }}>
|
|
158
|
+
<BlocksLayoutOptionsContext.Provider value={props.layoutOptions}>
|
|
159
|
+
{props.children}
|
|
160
|
+
</BlocksLayoutOptionsContext.Provider>
|
|
161
|
+
</CustomColorsContext.Provider>
|
|
162
|
+
</div>
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Bootstrap default font color */
|
|
166
|
+
const defaultFontColor = "#212529"
|
|
167
|
+
|
|
168
|
+
const defaultTheme: BlocksLayoutOptions = {
|
|
169
|
+
outerPadding: 30,
|
|
170
|
+
backgroundColor: "white",
|
|
171
|
+
collapseSpacers: false,
|
|
172
|
+
|
|
173
|
+
textWidgetFont: {
|
|
174
|
+
size: 15,
|
|
175
|
+
color: defaultFontColor,
|
|
176
|
+
family: "Helvetica Neue",
|
|
177
|
+
weight: "400"
|
|
178
|
+
},
|
|
179
|
+
textWidgetLineHeight: null,
|
|
180
|
+
textWidgetParagraphSpacing: 5,
|
|
181
|
+
|
|
182
|
+
textWidgetH1MarginTop: 10,
|
|
183
|
+
textWidgetH1Font: {
|
|
184
|
+
size: 19,
|
|
185
|
+
color: defaultFontColor,
|
|
186
|
+
family: "Helvetica Neue",
|
|
187
|
+
weight: "400"
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
textWidgetH2MarginTop: 8,
|
|
191
|
+
textWidgetH2Font: {
|
|
192
|
+
size: 17,
|
|
193
|
+
color: defaultFontColor,
|
|
194
|
+
family: "Helvetica Neue",
|
|
195
|
+
weight: "400"
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
titleWidgetFont: {
|
|
199
|
+
size: 25,
|
|
200
|
+
color: defaultFontColor,
|
|
201
|
+
family: "Helvetica Neue",
|
|
202
|
+
weight: "400"
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
textWidgetListLineHeight: null,
|
|
206
|
+
|
|
207
|
+
blockMargin: {
|
|
208
|
+
top: 0,
|
|
209
|
+
bottom: 0,
|
|
210
|
+
left: 0,
|
|
211
|
+
right: 0,
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
blockPadding: {
|
|
215
|
+
top: 0,
|
|
216
|
+
bottom: 15,
|
|
217
|
+
left: 15,
|
|
218
|
+
right: 15,
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
blockBorderRadius: 5,
|
|
222
|
+
blockBackgroundColor: "white",
|
|
223
|
+
|
|
224
|
+
widgetHeaderFont: {
|
|
225
|
+
size: 14,
|
|
226
|
+
color: defaultFontColor,
|
|
227
|
+
family: "Helvetica Neue",
|
|
228
|
+
weight: "600"
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
widgetFooterFont: {
|
|
232
|
+
size: 13,
|
|
233
|
+
color: defaultFontColor,
|
|
234
|
+
family: "Helvetica Neue",
|
|
235
|
+
weight: "400"
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
chartFont: {
|
|
239
|
+
size: 10,
|
|
240
|
+
color: defaultFontColor,
|
|
241
|
+
family: "Helvetica Neue",
|
|
242
|
+
weight: "400"
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
tableFont: {
|
|
246
|
+
size: 13,
|
|
247
|
+
color: defaultFontColor,
|
|
248
|
+
family: "Helvetica Neue",
|
|
249
|
+
weight: "400"
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
pivotTableFont: {
|
|
253
|
+
size: 14,
|
|
254
|
+
color: defaultFontColor,
|
|
255
|
+
family: "Helvetica Neue",
|
|
256
|
+
weight: "400"
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
collapseColumnsWidth: 600,
|
|
260
|
+
minimumWidth: 600,
|
|
261
|
+
belowMinimumWidth: "scale",
|
|
262
|
+
maximumWidth: 1600,
|
|
263
|
+
hideQuickfiltersWidth: 600,
|
|
264
|
+
customColors: []
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const greybgTheme: BlocksLayoutOptions = {
|
|
268
|
+
...defaultTheme,
|
|
269
|
+
outerPadding: 10,
|
|
270
|
+
backgroundColor: "#ddd",
|
|
271
|
+
|
|
272
|
+
blockMargin: {
|
|
273
|
+
top: 9,
|
|
274
|
+
bottom: 9,
|
|
275
|
+
left: 9,
|
|
276
|
+
right: 9,
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
blockPadding: {
|
|
280
|
+
top: 8,
|
|
281
|
+
bottom: 8,
|
|
282
|
+
left: 8,
|
|
283
|
+
right: 8,
|
|
284
|
+
},
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const storyTheme: BlocksLayoutOptions = {
|
|
288
|
+
...defaultTheme,
|
|
289
|
+
textWidgetFont: {
|
|
290
|
+
size: 18,
|
|
291
|
+
color: "#333",
|
|
292
|
+
family: "Georgia",
|
|
293
|
+
weight: "400"
|
|
294
|
+
},
|
|
295
|
+
textWidgetLineHeight: 33,
|
|
296
|
+
textWidgetParagraphSpacing: 8,
|
|
297
|
+
textWidgetListLineHeight: 28,
|
|
298
|
+
|
|
299
|
+
textWidgetH1MarginTop: 40,
|
|
300
|
+
textWidgetH1Font: {
|
|
301
|
+
size: 32,
|
|
302
|
+
color: "black",
|
|
303
|
+
family: "Lucida Grande",
|
|
304
|
+
weight: "700"
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
textWidgetH2MarginTop: 30,
|
|
308
|
+
textWidgetH2Font: {
|
|
309
|
+
size: 24,
|
|
310
|
+
color: "black",
|
|
311
|
+
family: "Lucida Grande",
|
|
312
|
+
weight: "700"
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
titleWidgetFont: {
|
|
316
|
+
size: 38,
|
|
317
|
+
color: "black",
|
|
318
|
+
family: "Lucida Grande",
|
|
319
|
+
weight: "700"
|
|
320
|
+
},
|
|
321
|
+
minimumWidth: 400,
|
|
322
|
+
maximumWidth: 1000,
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Expands a font family to include fallbacks
|
|
328
|
+
* @param fontFamily The font family to expand
|
|
329
|
+
* @returns The expanded font family
|
|
330
|
+
*/
|
|
331
|
+
export function expandFontFamily(fontFamily: string) {
|
|
332
|
+
// Handle legacy font families
|
|
333
|
+
if (fontFamily === "Helvetica Neue") {
|
|
334
|
+
return `"${fontFamily}", Helvetica, Arial, sans-serif`
|
|
335
|
+
}
|
|
336
|
+
if (fontFamily === "Lucida Grande") {
|
|
337
|
+
return `"${fontFamily}", "Lucida Sans Unicode", "Lucida Sans", Geneva, Arial, sans-serif`
|
|
338
|
+
}
|
|
339
|
+
if (fontFamily === "Georgia") {
|
|
340
|
+
return `"${fontFamily}", Cambria, "Times New Roman", Times, serif`
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Add fallback fonts
|
|
344
|
+
if (fontFamily === "Merriweather") {
|
|
345
|
+
return `"${fontFamily}", serif`
|
|
346
|
+
}
|
|
347
|
+
return `"${fontFamily}", sans-serif`
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Create a CSS style string from a LayoutOptions object
|
|
353
|
+
*
|
|
354
|
+
* @param scope The scope of the style (e.g. "#id_1234")
|
|
355
|
+
* @param layoutOptions The layout options
|
|
356
|
+
* @returns A CSS style string
|
|
357
|
+
*/
|
|
358
|
+
export function createDashboardStyles(scope: string, layoutOptions: BlocksLayoutOptions) {
|
|
359
|
+
return `
|
|
360
|
+
${scope} .mwater-visualization-block-parent-outer {
|
|
361
|
+
padding: ${layoutOptions.outerPadding}px;
|
|
362
|
+
background-color: ${layoutOptions.backgroundColor};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
${scope} .mwater-visualization-block-parent-inner {
|
|
366
|
+
height: 100%;
|
|
367
|
+
margin-left: auto;
|
|
368
|
+
margin-right: auto;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
@media print {
|
|
372
|
+
/* Add a border on printing */
|
|
373
|
+
${scope} .mwater-visualization-block-parent-outer .mwater-visualization-block {
|
|
374
|
+
border: solid 1px ${layoutOptions.backgroundColor};
|
|
375
|
+
}
|
|
376
|
+
${scope} .mwater-visualization-block-parent-outer .mwater-visualization-block.mwater-visualization-block-spacer {
|
|
377
|
+
border: solid 1px transparent;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/* --- Text widget styles --- */
|
|
382
|
+
${scope} .mwater-visualization-text-widget-style-default {
|
|
383
|
+
font-size: ${layoutOptions.textWidgetFont.size}px;
|
|
384
|
+
font-weight: ${layoutOptions.textWidgetFont.weight};
|
|
385
|
+
color: ${layoutOptions.textWidgetFont.color};
|
|
386
|
+
line-height: ${layoutOptions.textWidgetLineHeight ? `${layoutOptions.textWidgetLineHeight}px` : "inherit"};
|
|
387
|
+
font-family: ${expandFontFamily(layoutOptions.textWidgetFont.family)};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
${scope} .mwater-visualization-text-widget-style-default div:not(:first-child) {
|
|
391
|
+
margin-top: ${layoutOptions.textWidgetParagraphSpacing}px;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
${scope} .mwater-visualization-text-widget-style-default ul {
|
|
395
|
+
line-height: ${layoutOptions.textWidgetListLineHeight ? `${layoutOptions.textWidgetListLineHeight}px` : "inherit"};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
${scope} .mwater-visualization-text-widget-style-default h1:not(:first-child) {
|
|
399
|
+
margin-top: ${layoutOptions.textWidgetH1MarginTop}px;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
${scope} .mwater-visualization-text-widget-style-default h1 {
|
|
403
|
+
line-height: 1.2;
|
|
404
|
+
margin: 0px;
|
|
405
|
+
font-size: ${layoutOptions.textWidgetH1Font.size}px;
|
|
406
|
+
color: ${layoutOptions.textWidgetH1Font.color};
|
|
407
|
+
font-family: ${expandFontFamily(layoutOptions.textWidgetH1Font.family)};
|
|
408
|
+
font-weight: ${layoutOptions.textWidgetH1Font.weight};
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
${scope} .mwater-visualization-text-widget-style-default h2:not(:first-child) {
|
|
412
|
+
margin-top: ${layoutOptions.textWidgetH2MarginTop}px;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
${scope} .mwater-visualization-text-widget-style-default h2 {
|
|
416
|
+
margin: 0px;
|
|
417
|
+
line-height: 1.2;
|
|
418
|
+
|
|
419
|
+
font-size: ${layoutOptions.textWidgetH2Font.size}px;
|
|
420
|
+
font-family: ${expandFontFamily(layoutOptions.textWidgetH2Font.family)};
|
|
421
|
+
font-weight: ${layoutOptions.textWidgetH2Font.weight};
|
|
422
|
+
color: ${layoutOptions.textWidgetH2Font.color};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/* NOTE: h3 is deprecated */
|
|
426
|
+
${scope} .mwater-visualization-text-widget-style-default h3:not(:first-child) {
|
|
427
|
+
margin-top: 5px;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
${scope} .mwater-visualization-text-widget-style-default h3 {
|
|
431
|
+
font-size: 15px;
|
|
432
|
+
margin: 0px;
|
|
433
|
+
font-weight: bold;
|
|
434
|
+
font-family: inherit;
|
|
435
|
+
line-height: 1.2;
|
|
436
|
+
color: inherit;
|
|
437
|
+
|
|
438
|
+
/* Story: TODO REMOVE
|
|
439
|
+
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Arial, sans-serif;
|
|
440
|
+
font-size: 20px;
|
|
441
|
+
font-weight: bold;
|
|
442
|
+
margin-top: 20px;
|
|
443
|
+
color: black;
|
|
444
|
+
*/
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/* --- Title block styles --- */
|
|
448
|
+
${scope} .mwater-visualization-text-widget-style-title {
|
|
449
|
+
font-size: ${layoutOptions.titleWidgetFont.size}px;
|
|
450
|
+
color: ${layoutOptions.titleWidgetFont.color};
|
|
451
|
+
font-family: ${expandFontFamily(layoutOptions.titleWidgetFont.family)};
|
|
452
|
+
font-weight: ${layoutOptions.titleWidgetFont.weight};
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/* --- InlineExprEditorComponent --- */
|
|
456
|
+
${scope} .mwater-visualization-text-widget-expr {
|
|
457
|
+
cursor: pointer;
|
|
458
|
+
border-radius: 2px;
|
|
459
|
+
padding-left: 2px;
|
|
460
|
+
padding-right: 2px;
|
|
461
|
+
background-color: rgba(212, 235, 255, 0.8);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/* --- Block styles --- */
|
|
465
|
+
${scope} .mwater-visualization-block-parent-outer .mwater-visualization-block {
|
|
466
|
+
margin: ${layoutOptions.blockMargin.top}px ${layoutOptions.blockMargin.right}px ${layoutOptions.blockMargin.bottom}px ${layoutOptions.blockMargin.left}px;
|
|
467
|
+
padding: ${layoutOptions.blockPadding.top}px ${layoutOptions.blockPadding.right}px ${layoutOptions.blockPadding.bottom}px ${layoutOptions.blockPadding.left}px;
|
|
468
|
+
border-radius: ${layoutOptions.blockBorderRadius}px;
|
|
469
|
+
background-color: ${layoutOptions.blockBackgroundColor};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/* Hide spacers */
|
|
473
|
+
${scope} .mwater-visualization-block-parent-outer .mwater-visualization-block-spacer {
|
|
474
|
+
background-color: ${layoutOptions.backgroundColor};
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
${layoutOptions.collapseSpacers ? `
|
|
478
|
+
/* On narrow screens, optionally collapse spacers and make all horizontal blocks take up the whole width */
|
|
479
|
+
@media only screen and (max-width: 1000px) {
|
|
480
|
+
/* Fill screen when small */
|
|
481
|
+
${scope} .mwater-visualization-block-parent-outer.mwater-visualization-block-viewing
|
|
482
|
+
.mwater-visualization-horizontal-block-item {
|
|
483
|
+
width: 100% !important;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/* Hide spacers when small */
|
|
487
|
+
${scope} .mwater-visualization-block-parent-outer.mwater-visualization-block-viewing .mwater-visualization-block-spacer {
|
|
488
|
+
display: none;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
` : ""}
|
|
492
|
+
|
|
493
|
+
/* --- TextWidgets inside of other widgets --- */
|
|
494
|
+
${scope} .mwater-visualization-text-widget-style-header {
|
|
495
|
+
text-align: center;
|
|
496
|
+
font-size: ${layoutOptions.widgetHeaderFont.size}px;
|
|
497
|
+
font-weight: ${layoutOptions.widgetHeaderFont.weight};
|
|
498
|
+
font-family: ${expandFontFamily(layoutOptions.widgetHeaderFont.family)};
|
|
499
|
+
color: ${layoutOptions.widgetHeaderFont.color};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
${scope} .mwater-visualization-text-widget-style-footer {
|
|
503
|
+
text-align: center;
|
|
504
|
+
font-size: ${layoutOptions.widgetFooterFont.size}px;
|
|
505
|
+
font-weight: ${layoutOptions.widgetFooterFont.weight};
|
|
506
|
+
font-family: ${expandFontFamily(layoutOptions.widgetFooterFont.family)};
|
|
507
|
+
color: ${layoutOptions.widgetFooterFont.color};
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** --- Chart styles --- */
|
|
511
|
+
${scope} .bb text {
|
|
512
|
+
font-size: ${layoutOptions.chartFont.size}px;
|
|
513
|
+
fill: ${layoutOptions.chartFont.color};
|
|
514
|
+
font-family: ${expandFontFamily(layoutOptions.chartFont.family)};
|
|
515
|
+
font-weight: ${layoutOptions.chartFont.weight};
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/* --- Table styles --- */
|
|
519
|
+
${scope} .mwater-visualization-table {
|
|
520
|
+
font-size: ${layoutOptions.tableFont.size}px;
|
|
521
|
+
color: ${layoutOptions.tableFont.color};
|
|
522
|
+
font-family: ${expandFontFamily(layoutOptions.tableFont.family)};
|
|
523
|
+
font-weight: ${layoutOptions.tableFont.weight};
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
${scope} .mwater-visualization-table > thead > tr > th {
|
|
527
|
+
background-color: ${layoutOptions.blockBackgroundColor};
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/* --- Pivot Table styles --- */
|
|
531
|
+
${scope} .pivot-chart-table {
|
|
532
|
+
font-size: ${layoutOptions.pivotTableFont.size}px;
|
|
533
|
+
color: ${layoutOptions.pivotTableFont.color};
|
|
534
|
+
font-family: ${expandFontFamily(layoutOptions.pivotTableFont.family)};
|
|
535
|
+
font-weight: ${layoutOptions.pivotTableFont.weight};
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
${scope} .pivot-chart-table .cell {
|
|
539
|
+
padding: 5px;
|
|
540
|
+
vertical-align: top;
|
|
541
|
+
background-color: ${layoutOptions.blockBackgroundColor};
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/* --- Placeholders --- */
|
|
545
|
+
${scope} .mwater-visualization-widget-placeholder {
|
|
546
|
+
position: absolute;
|
|
547
|
+
bottom: 0;
|
|
548
|
+
left: 0px;
|
|
549
|
+
right: 0px;
|
|
550
|
+
text-align: center;
|
|
551
|
+
top: 0;
|
|
552
|
+
cursor: pointer;
|
|
553
|
+
background: #f8f8f8;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
${scope} .mwater-visualization-widget-placeholder .fa,
|
|
557
|
+
${scope} .mwater-visualization-widget-placeholder .glyphicon {
|
|
558
|
+
position: absolute;
|
|
559
|
+
top: 50%;
|
|
560
|
+
left: 50%;
|
|
561
|
+
transform: translate(-50%, -50%);
|
|
562
|
+
color: #e0e0e0;
|
|
563
|
+
font-size: 60px;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
${scope} .mwater-visualization-widget-placeholder:hover .fa,
|
|
567
|
+
${scope} .mwater-visualization-widget-placeholder:hover .glyphicon {
|
|
568
|
+
color: #c0c0c0;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
${scope} .mwater-visualization-widget-placeholder-message {
|
|
572
|
+
color: #666;
|
|
573
|
+
position: absolute;
|
|
574
|
+
bottom: 10px;
|
|
575
|
+
left: 0px;
|
|
576
|
+
right: 0px;
|
|
577
|
+
font-size: 11px;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
`
|
|
581
|
+
}
|
|
@@ -2,28 +2,22 @@ import { Row } from "@mwater/expressions"
|
|
|
2
2
|
import { DatagridDesign, JsonQLFilter } from ".."
|
|
3
3
|
import { QuickfiltersDataSource } from "../quickfilter/QuickfiltersDataSource"
|
|
4
4
|
|
|
5
|
-
export default
|
|
5
|
+
export default interface DatagridDataSource {
|
|
6
6
|
/** Gets the rows specified */
|
|
7
7
|
getRows(
|
|
8
8
|
design: DatagridDesign,
|
|
9
9
|
offset: number,
|
|
10
10
|
limit: number,
|
|
11
11
|
filters: JsonQLFilter[] | undefined,
|
|
12
|
-
callback: (error: any, rows
|
|
13
|
-
): void
|
|
14
|
-
throw new Error("Not implemented")
|
|
15
|
-
}
|
|
12
|
+
callback: (error: any, rows?: Row[]) => void
|
|
13
|
+
): void
|
|
16
14
|
|
|
17
15
|
countRows(
|
|
18
16
|
design: DatagridDesign,
|
|
19
17
|
filters: JsonQLFilter[] | undefined,
|
|
20
|
-
callback: (error: any, numRows
|
|
21
|
-
): void
|
|
22
|
-
throw new Error("Not implemented")
|
|
23
|
-
}
|
|
18
|
+
callback: (error: any, numRows?: number) => void
|
|
19
|
+
): void
|
|
24
20
|
|
|
25
21
|
/** Gets the quickfilters data source */
|
|
26
|
-
getQuickfiltersDataSource(): QuickfiltersDataSource
|
|
27
|
-
throw new Error("Not implemented")
|
|
28
|
-
}
|
|
22
|
+
getQuickfiltersDataSource(): QuickfiltersDataSource
|
|
29
23
|
}
|
|
@@ -19,7 +19,7 @@ export interface DatagridDesign {
|
|
|
19
19
|
subtables?: DatagridDesignSubtable[]
|
|
20
20
|
|
|
21
21
|
/** array of { expr: expression to order on, direction: "asc"/"desc" } */
|
|
22
|
-
orderBys?:
|
|
22
|
+
orderBys?: DatagridDesignOrderBy[]
|
|
23
23
|
|
|
24
24
|
/** array of quick filters (user-selectable filters). See quickfilter/README.md */
|
|
25
25
|
quickfilters?: Quickfilter[]
|
|
@@ -34,6 +34,11 @@ export interface DatagridDesign {
|
|
|
34
34
|
showNumRows?: boolean
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export interface DatagridDesignOrderBy {
|
|
38
|
+
expr: Expr
|
|
39
|
+
direction: "asc" | "desc"
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
export interface DatagridDesignColumn {
|
|
38
43
|
/** unique id of the column */
|
|
39
44
|
id: string
|
|
@@ -53,7 +58,7 @@ export interface DatagridDesignColumn {
|
|
|
53
58
|
/** Expression */
|
|
54
59
|
expr: Expr
|
|
55
60
|
|
|
56
|
-
/** Format for formattable types (number and geometry) */
|
|
61
|
+
/** Format for formattable types (number and geometry). See libraries/visualization/src/valueFormatter.ts */
|
|
57
62
|
format?: string
|
|
58
63
|
}
|
|
59
64
|
|
|
@@ -71,7 +76,7 @@ export interface DatagridDesignSubtable {
|
|
|
71
76
|
filter?: Expr
|
|
72
77
|
|
|
73
78
|
/** array of { expr: expression to order on, direction: "asc"/"desc" } */
|
|
74
|
-
orderBys
|
|
79
|
+
orderBys?: { expr: Expr; direction: "asc" | "desc" }[]
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
/** Global Filters
|