@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
package/lib/UIComponents.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as motion from "react-motion";
|
|
|
3
3
|
export interface SectionComponentProps {
|
|
4
4
|
icon?: string;
|
|
5
5
|
label?: any;
|
|
6
|
+
required?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare class SectionComponent extends React.Component<SectionComponentProps> {
|
|
8
9
|
render(): React.DetailedReactHTMLElement<{
|
|
@@ -56,7 +57,7 @@ export interface ToggleEditComponentProps {
|
|
|
56
57
|
initiallyOpen?: boolean;
|
|
57
58
|
label: any;
|
|
58
59
|
editor: any;
|
|
59
|
-
onRemove?:
|
|
60
|
+
onRemove?: () => void;
|
|
60
61
|
}
|
|
61
62
|
interface ToggleEditComponentState {
|
|
62
63
|
open: any;
|
|
@@ -66,7 +67,6 @@ export declare class ToggleEditComponent extends React.Component<ToggleEditCompo
|
|
|
66
67
|
close: () => void;
|
|
67
68
|
open: () => void;
|
|
68
69
|
handleToggle: () => void;
|
|
69
|
-
editorRef: (editorComp: any) => any;
|
|
70
70
|
render(): React.CElement<any, SwitchViewComponent>;
|
|
71
71
|
}
|
|
72
72
|
export interface RadioToggleComponentProps {
|
package/lib/UIComponents.js
CHANGED
|
@@ -42,7 +42,7 @@ class SectionComponent extends react_1.default.Component {
|
|
|
42
42
|
? [R("i", { className: `fa ${this.props.icon}` }), " "]
|
|
43
43
|
: undefined, this.props.icon && this.props.icon.match(/^glyphicon-/)
|
|
44
44
|
? [R("span", { className: `glyphicon ${this.props.icon}` }), " "]
|
|
45
|
-
: undefined, this.props.label), R("div", { style: { marginLeft: 10 } }, this.props.children));
|
|
45
|
+
: undefined, this.props.label, this.props.required ? react_1.default.createElement("span", { style: { color: "red" } }, " *") : undefined), R("div", { style: { marginLeft: 10 } }, this.props.children));
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
exports.SectionComponent = SectionComponent;
|
|
@@ -149,21 +149,13 @@ class ToggleEditComponent extends react_1.default.Component {
|
|
|
149
149
|
this.state = { open: props.initiallyOpen || false };
|
|
150
150
|
}
|
|
151
151
|
close = () => {
|
|
152
|
-
|
|
153
|
-
if (this.editorComp) {
|
|
154
|
-
this.editorHeight = react_dom_1.default.findDOMNode(this.editorComp).clientHeight;
|
|
155
|
-
}
|
|
156
|
-
return this.setState({ open: false });
|
|
152
|
+
this.setState({ open: false });
|
|
157
153
|
};
|
|
158
154
|
open = () => {
|
|
159
|
-
|
|
155
|
+
this.setState({ open: true });
|
|
160
156
|
};
|
|
161
157
|
handleToggle = () => {
|
|
162
|
-
|
|
163
|
-
};
|
|
164
|
-
// Save editor comp
|
|
165
|
-
editorRef = (editorComp) => {
|
|
166
|
-
return (this.editorComp = editorComp);
|
|
158
|
+
this.setState({ open: !this.state.open });
|
|
167
159
|
};
|
|
168
160
|
render() {
|
|
169
161
|
let { editor } = this.props;
|
package/lib/axes/Axis.d.ts
CHANGED
|
@@ -4,35 +4,15 @@ import { Expr } from "@mwater/expressions";
|
|
|
4
4
|
An axis is an expression with optional aggregation, transform and color mapping
|
|
5
5
|
In ggplot2 parlance, an "aesthetic"
|
|
6
6
|
|
|
7
|
-
It contains:
|
|
8
|
-
expr: expression
|
|
9
|
-
aggr: DEPRECATED: optional aggregation (e.g. sum)
|
|
10
|
-
xform: optional transformation to be applied. object with `type` field. See below
|
|
11
|
-
colorMap: optional array of color mappings. See below
|
|
12
|
-
excludedValues: Array of post-xform values to exclude when displaying.
|
|
13
|
-
format: optional d3-format format for numeric values. Default if null is ","
|
|
14
|
-
|
|
15
|
-
## Xforms
|
|
16
|
-
|
|
17
|
-
types:
|
|
18
|
-
|
|
19
|
-
|
|
20
7
|
*/
|
|
21
8
|
export interface Axis {
|
|
9
|
+
/** Expression to be displayed on axis */
|
|
22
10
|
expr: Expr;
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* `date`: convert to complete date e.g. `2015-02-08`. type date
|
|
26
|
-
* `year`: year only e.g. `2015-01-01`. type date
|
|
27
|
-
* `yearmonth`: year and month only e.g. `2015-02-01`. type date
|
|
28
|
-
* `yearquarter`: year and quarter only e.g. `2015-01`. type enum
|
|
29
|
-
* `yearweek`: year and week (ISO) only e.g. `2015-31`. type enum
|
|
30
|
-
* `month`: month only e.g. `02`. type enum
|
|
31
|
-
* `week`: ISO week of year e.g. `01` for the first week that contains January 4th
|
|
32
|
-
* `ranges`: convert to ranges. type enum. `ranges` is array of { id (unique id), label (optional label), minValue (null for none), maxValue (null for none), minOpen (true for >, false for >=), maxOpen (true for <, false for <=) }
|
|
33
|
-
* `floor`: convert to floor. type enum
|
|
11
|
+
/** Optional transformation to be applied. If a date is used, for example, it's generally
|
|
12
|
+
* better to use a transform to convert to a year or month rather than creating an expression.
|
|
34
13
|
*/
|
|
35
14
|
xform?: AxisXform;
|
|
15
|
+
/** optional array of color mappings */
|
|
36
16
|
colorMap?: ColorMap;
|
|
37
17
|
/** optional array of category values which define the order in which categories should be rendered */
|
|
38
18
|
drawOrder?: any[];
|
|
@@ -42,9 +22,11 @@ export interface Axis {
|
|
|
42
22
|
};
|
|
43
23
|
/** optional string for null category */
|
|
44
24
|
nullLabel?: string;
|
|
25
|
+
/** Array of post-xform values to exclude when displaying. */
|
|
45
26
|
excludedValues?: any[];
|
|
27
|
+
/** optional d3-format format for numeric values. Default if null is "," */
|
|
46
28
|
format?: string;
|
|
47
|
-
/** @deprecated */
|
|
29
|
+
/** @deprecated optional aggregation (e.g. sum) */
|
|
48
30
|
aggr?: string;
|
|
49
31
|
}
|
|
50
32
|
/**
|
|
@@ -63,6 +45,19 @@ export interface AxisCategory {
|
|
|
63
45
|
value: any;
|
|
64
46
|
}
|
|
65
47
|
export interface AxisXform {
|
|
48
|
+
/**
|
|
49
|
+
* Type of transformation
|
|
50
|
+
* `bin`: convert into bins. always has `numBins` integer and `min` and `max`. Can have `excludeUpper` and/or `excludeLower` to remove open bin on top or bottem. type enum
|
|
51
|
+
* `date`: convert to complete date e.g. `2015-02-08`. type date
|
|
52
|
+
* `year`: year only e.g. `2015-01-01`. type date
|
|
53
|
+
* `yearmonth`: year and month only e.g. `2015-02-01`. type date
|
|
54
|
+
* `yearquarter`: year and quarter only e.g. `2015-01`. type enum
|
|
55
|
+
* `yearweek`: year and week (ISO) only e.g. `2015-31`. type enum
|
|
56
|
+
* `month`: month only e.g. `02`. type enum
|
|
57
|
+
* `week`: ISO week of year e.g. `01` for the first week that contains January 4th
|
|
58
|
+
* `ranges`: convert to ranges. type enum. `ranges` is array of { id (unique id), label (optional label), minValue (null for none), maxValue (null for none), minOpen (true for >, false for >=), maxOpen (true for <, false for <=) }
|
|
59
|
+
* `floor`: convert to floor. type enum
|
|
60
|
+
*/
|
|
66
61
|
type: "bin" | "date" | "year" | "yearmonth" | "month" | "week" | "ranges" | "yearweek" | "yearquarter" | "floor";
|
|
67
62
|
numBins?: number;
|
|
68
63
|
min?: number;
|
|
@@ -53,10 +53,13 @@ export default class AxisBuilder {
|
|
|
53
53
|
*/
|
|
54
54
|
onlyValuesPresent?: boolean;
|
|
55
55
|
}): AxisCategory[];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Get type of axis output
|
|
58
|
+
*/
|
|
59
|
+
getAxisType(axis: Axis | null | undefined): LiteralType | null;
|
|
60
|
+
isAxisAggr(axis: Axis | null | undefined): string | boolean;
|
|
61
|
+
doesAxisSupportCumulative(axis: Axis): boolean;
|
|
62
|
+
formatCategory(axis: Axis, category: any): any;
|
|
60
63
|
summarizeAxis(axis: Axis, locale?: string): string;
|
|
61
64
|
formatValue(axis: Axis, value: any, locale?: string, legacyPercentFormat?: any): any;
|
|
62
65
|
createValueFilter(axis: Axis, value: any): JsonQLExpr;
|
package/lib/axes/AxisBuilder.js
CHANGED
|
@@ -38,6 +38,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
38
38
|
const R = react_1.default.createElement;
|
|
39
39
|
const immer_1 = __importDefault(require("immer"));
|
|
40
40
|
const valueFormatter_1 = require("../valueFormatter");
|
|
41
|
+
const dayjs_1 = __importDefault(require("../dayjs"));
|
|
41
42
|
const xforms = [
|
|
42
43
|
{ type: "bin", input: "number", output: "enum" },
|
|
43
44
|
{ type: "ranges", input: "number", output: "enum" },
|
|
@@ -827,7 +828,7 @@ class AxisBuilder {
|
|
|
827
828
|
}
|
|
828
829
|
if (options.onlyValuesPresent) {
|
|
829
830
|
// Sort and take only present
|
|
830
|
-
categories = lodash_1.default.sortBy(lodash_1.default.uniq(values), item => item).map(value => ({ value, label: (0,
|
|
831
|
+
categories = lodash_1.default.sortBy(lodash_1.default.uniq(values), item => item).map(value => ({ value, label: (0, valueFormatter_1.formatValue)("date", value, axis.format) }));
|
|
831
832
|
if (hasNone) {
|
|
832
833
|
categories.push(noneCategory);
|
|
833
834
|
}
|
|
@@ -837,12 +838,12 @@ class AxisBuilder {
|
|
|
837
838
|
min = values.sort()[0];
|
|
838
839
|
max = values.sort().slice(-1)[0];
|
|
839
840
|
// Use moment to get range
|
|
840
|
-
current = (0,
|
|
841
|
-
end = (0,
|
|
841
|
+
current = (0, dayjs_1.default)(min);
|
|
842
|
+
end = (0, dayjs_1.default)(max);
|
|
842
843
|
categories = [];
|
|
843
844
|
while (!current.isAfter(end)) {
|
|
844
|
-
categories.push({ value: current.format("YYYY-MM-DD"), label: current.format("ll") });
|
|
845
|
-
current.add(1, "days");
|
|
845
|
+
categories.push({ value: current.format("YYYY-MM-DD"), label: current.format(axis.format ?? "ll") });
|
|
846
|
+
current = current.add(1, "days");
|
|
846
847
|
if (categories.length >= 1000) {
|
|
847
848
|
break;
|
|
848
849
|
}
|
|
@@ -854,7 +855,9 @@ class AxisBuilder {
|
|
|
854
855
|
}
|
|
855
856
|
return [];
|
|
856
857
|
}
|
|
857
|
-
|
|
858
|
+
/**
|
|
859
|
+
* Get type of axis output
|
|
860
|
+
*/
|
|
858
861
|
getAxisType(axis) {
|
|
859
862
|
if (!axis) {
|
|
860
863
|
return null;
|
|
@@ -947,9 +950,10 @@ class AxisBuilder {
|
|
|
947
950
|
}
|
|
948
951
|
return R("div", null, lodash_1.default.map(value, (v, i) => R("div", { key: i }, v)));
|
|
949
952
|
case "date":
|
|
950
|
-
|
|
953
|
+
console.log(axis);
|
|
954
|
+
return (0, valueFormatter_1.formatValue)(type, value, axis.format);
|
|
951
955
|
case "datetime":
|
|
952
|
-
return (0,
|
|
956
|
+
return (0, valueFormatter_1.formatValue)(type, value, axis.format);
|
|
953
957
|
}
|
|
954
958
|
return "" + value;
|
|
955
959
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import AsyncLoadComponent from "@mwater/react-library/lib/AsyncLoadComponent";
|
|
4
3
|
import { DataSource, LiteralType, Schema } from "@mwater/expressions";
|
|
@@ -15,7 +14,7 @@ export interface AxisComponentProps {
|
|
|
15
14
|
/** Optional types to limit to */
|
|
16
15
|
types?: LiteralType[];
|
|
17
16
|
aggrNeed: "none" | "optional" | "required";
|
|
18
|
-
value?: Axis;
|
|
17
|
+
value?: Axis | null;
|
|
19
18
|
onChange: (axis: Axis | null) => void;
|
|
20
19
|
/** Makes this a required value */
|
|
21
20
|
required?: boolean;
|
|
@@ -44,16 +43,14 @@ export default class AxisComponent extends AsyncLoadComponent<AxisComponentProps
|
|
|
44
43
|
allowExcludedValues: boolean;
|
|
45
44
|
autosetColors: boolean;
|
|
46
45
|
};
|
|
47
|
-
static
|
|
48
|
-
locale: PropTypes.Requireable<string>;
|
|
49
|
-
};
|
|
46
|
+
static contextType: React.Context<string>;
|
|
50
47
|
constructor(props: any);
|
|
51
48
|
isLoadNeeded(newProps: any, oldProps: any): boolean;
|
|
52
49
|
load(props: any, prevProps: any, callback: any): any;
|
|
53
|
-
handleExprChange: (expr: any) =>
|
|
54
|
-
handleFormatChange: (ev: any) =>
|
|
55
|
-
handleXformTypeChange: (type: any) =>
|
|
56
|
-
handleXformChange: (xform: any) =>
|
|
50
|
+
handleExprChange: (expr: any) => void;
|
|
51
|
+
handleFormatChange: (ev: any) => void;
|
|
52
|
+
handleXformTypeChange: (type: any) => void;
|
|
53
|
+
handleXformChange: (xform: any) => void;
|
|
57
54
|
cleanAxis(axis: any): Axis | null;
|
|
58
55
|
renderXform(axis: any): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | React.CElement<ui.RadioToggleComponentProps, ui.RadioToggleComponent> | null;
|
|
59
56
|
renderColorMap(axis: any): (React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | React.CElement<any, AxisColorEditorComponent>)[] | null;
|
|
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
30
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
31
30
|
const react_1 = __importDefault(require("react"));
|
|
32
31
|
const R = react_1.default.createElement;
|
|
33
32
|
const uuid_1 = __importDefault(require("uuid"));
|
|
@@ -52,7 +51,7 @@ class AxisComponent extends AsyncLoadComponent_1.default {
|
|
|
52
51
|
allowExcludedValues: false,
|
|
53
52
|
autosetColors: true
|
|
54
53
|
};
|
|
55
|
-
static
|
|
54
|
+
static contextType = expressions_ui_1.LocaleContext;
|
|
56
55
|
constructor(props) {
|
|
57
56
|
super(props);
|
|
58
57
|
this.state = {
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Axis, AxisCategory } from "./Axis";
|
|
2
|
+
import { Axis, AxisCategory, ColorMap } from "./Axis";
|
|
3
3
|
export interface ColorPaletteCollectionComponentProps {
|
|
4
|
-
onPaletteSelected: any;
|
|
5
4
|
axis: Axis;
|
|
6
5
|
categories: AxisCategory[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export default class ColorPaletteCollectionComponent extends React.Component<ColorPaletteCollectionComponentProps> {
|
|
10
|
-
static palettes: {
|
|
11
|
-
type: string;
|
|
12
|
-
reversed: boolean;
|
|
13
|
-
}[];
|
|
14
|
-
onPaletteSelected: (index: any) => any;
|
|
15
|
-
renderCancel: () => React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | null;
|
|
16
|
-
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
6
|
+
onPaletteSelected: (colorMap: ColorMap) => void;
|
|
7
|
+
onCancel: () => void;
|
|
17
8
|
}
|
|
9
|
+
declare function ColorPaletteCollectionComponent(props: ColorPaletteCollectionComponentProps): React.JSX.Element;
|
|
10
|
+
export default ColorPaletteCollectionComponent;
|
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const react_1 =
|
|
8
|
-
const R = react_1.default.createElement;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
9
31
|
const ColorSchemeFactory_1 = __importDefault(require("../ColorSchemeFactory"));
|
|
10
|
-
|
|
11
|
-
|
|
32
|
+
const CustomColorsContext_1 = require("../CustomColorsContext");
|
|
33
|
+
function ColorPaletteCollectionComponent(props) {
|
|
34
|
+
const palettes = [
|
|
12
35
|
{ type: "schemeSet1", reversed: false },
|
|
13
36
|
{ type: "schemeSet2", reversed: false },
|
|
14
37
|
{ type: "schemeSet3", reversed: false },
|
|
@@ -72,59 +95,67 @@ class ColorPaletteCollectionComponent extends react_1.default.Component {
|
|
|
72
95
|
{ type: "interpolateRdYlGn", reversed: false },
|
|
73
96
|
{ type: "interpolateRdYlGn", reversed: true }
|
|
74
97
|
];
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
// Get custom colors
|
|
99
|
+
const customColorsContext = (0, react_1.useContext)(CustomColorsContext_1.CustomColorsContext);
|
|
100
|
+
// Number of colors needed. Null doesn't count to length
|
|
101
|
+
const numColors = props.categories.filter((c) => c.value != null).length;
|
|
102
|
+
if (customColorsContext && customColorsContext.customColors.filter((c) => c != null).length > 0) {
|
|
103
|
+
const filteredCustomColors = customColorsContext.customColors.filter((c) => c != null);
|
|
104
|
+
const customPalettes = [];
|
|
105
|
+
for (let i = 0; i < filteredCustomColors.length; i += 6) {
|
|
106
|
+
const customPalette = filteredCustomColors.slice(i, i + 6);
|
|
107
|
+
customPalettes.push({ type: "custom", reversed: false, colors: customPalette });
|
|
108
|
+
}
|
|
109
|
+
palettes.unshift(...customPalettes);
|
|
110
|
+
}
|
|
111
|
+
function generatePaletteColors(palette, numColors) {
|
|
112
|
+
if (palette.type === "custom") {
|
|
113
|
+
return palette.colors;
|
|
114
|
+
}
|
|
115
|
+
return ColorSchemeFactory_1.default.createColorScheme({
|
|
116
|
+
type: palette.type,
|
|
117
|
+
number: numColors,
|
|
118
|
+
reversed: palette.reversed
|
|
84
119
|
});
|
|
85
|
-
|
|
120
|
+
}
|
|
121
|
+
const onPaletteSelected = (index) => {
|
|
122
|
+
// Generate color map
|
|
123
|
+
const scheme = generatePaletteColors(palettes[index], Math.min(numColors, 6));
|
|
124
|
+
const colorMap = lodash_1.default.map(props.categories, (category, i) => ({
|
|
86
125
|
value: category.value,
|
|
87
126
|
color: category.value === null ? "#aaaaaa" : scheme[i % scheme.length]
|
|
88
127
|
}));
|
|
89
|
-
return
|
|
128
|
+
return props.onPaletteSelected(colorMap);
|
|
90
129
|
};
|
|
91
|
-
renderCancel = () => {
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
130
|
+
const renderCancel = () => {
|
|
131
|
+
if (props.axis.colorMap) {
|
|
132
|
+
return (react_1.default.createElement("div", null,
|
|
133
|
+
react_1.default.createElement("a", { className: "link-plain", onClick: props.onCancel, key: "cancel-customize" }, "Cancel")));
|
|
94
134
|
}
|
|
95
135
|
return null;
|
|
96
136
|
};
|
|
97
|
-
|
|
98
|
-
return
|
|
99
|
-
return R(ColorPaletteComponent, {
|
|
100
|
-
key: index,
|
|
101
|
-
index,
|
|
102
|
-
colorSet: ColorSchemeFactory_1.default.createColorScheme({
|
|
103
|
-
type: config.type,
|
|
104
|
-
number: Math.min(this.props.categories.length - 1, 6),
|
|
105
|
-
reversed: config.reversed
|
|
106
|
-
}),
|
|
107
|
-
onPaletteSelected: this.onPaletteSelected,
|
|
108
|
-
number: this.props.categories.length
|
|
109
|
-
});
|
|
110
|
-
}), this.renderCancel());
|
|
137
|
+
function renderPalette(palette, index) {
|
|
138
|
+
return (react_1.default.createElement(ColorPaletteComponent, { key: index, index: index, colorSet: generatePaletteColors(palette, 6), onPaletteSelected: onPaletteSelected }));
|
|
111
139
|
}
|
|
140
|
+
return (react_1.default.createElement("div", null,
|
|
141
|
+
react_1.default.createElement("p", null, "Please select a color scheme"),
|
|
142
|
+
palettes.map((palette, index) => renderPalette(palette, index)),
|
|
143
|
+
renderCancel()));
|
|
112
144
|
}
|
|
113
145
|
exports.default = ColorPaletteCollectionComponent;
|
|
114
146
|
class ColorPaletteComponent extends react_1.default.Component {
|
|
115
|
-
static defaultProps = { number: 6 };
|
|
116
147
|
handleSelect = () => {
|
|
117
148
|
return this.props.onPaletteSelected(this.props.index);
|
|
118
149
|
};
|
|
119
150
|
render() {
|
|
120
|
-
return
|
|
151
|
+
return (react_1.default.createElement("div", { onClick: this.handleSelect, className: "axis-palette" }, lodash_1.default.map(this.props.colorSet, (color, i) => {
|
|
121
152
|
const cellStyle = {
|
|
122
153
|
display: "inline-block",
|
|
123
154
|
height: 20,
|
|
124
155
|
width: 20,
|
|
125
156
|
backgroundColor: color
|
|
126
157
|
};
|
|
127
|
-
return
|
|
128
|
-
}));
|
|
158
|
+
return react_1.default.createElement("div", { style: cellStyle, key: i }, " ");
|
|
159
|
+
})));
|
|
129
160
|
}
|
|
130
161
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React, { ReactNode } from "react";
|
|
3
2
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
4
3
|
import UndoStack from "../UndoStack";
|
|
5
|
-
import
|
|
4
|
+
import { DashboardViewComponentHandle } from "./DashboardViewComponent";
|
|
6
5
|
import QuickfiltersComponent from "../quickfilter/QuickfiltersComponent";
|
|
7
6
|
import SettingsModalComponent from "./SettingsModalComponent";
|
|
8
7
|
import { DashboardDesign } from "./DashboardDesign";
|
|
@@ -51,18 +50,12 @@ export interface DashboardComponentState {
|
|
|
51
50
|
* Manages undo stack and quickfilter value
|
|
52
51
|
*/
|
|
53
52
|
export default class DashboardComponent extends React.Component<DashboardComponentProps, DashboardComponentState> {
|
|
54
|
-
dashboardView:
|
|
53
|
+
dashboardView: DashboardViewComponentHandle | null;
|
|
55
54
|
static defaultProps: {
|
|
56
55
|
printScaling: boolean;
|
|
57
56
|
};
|
|
58
|
-
static childContextTypes: {
|
|
59
|
-
locale: PropTypes.Requireable<string>;
|
|
60
|
-
};
|
|
61
57
|
settings: SettingsModalComponent | null;
|
|
62
|
-
|
|
63
|
-
locale: string | undefined;
|
|
64
|
-
};
|
|
65
|
-
constructor(props: any);
|
|
58
|
+
constructor(props: DashboardComponentProps);
|
|
66
59
|
getQuickfilterValues: () => any[];
|
|
67
60
|
componentWillReceiveProps(nextProps: any): void;
|
|
68
61
|
handlePrint: () => void;
|
|
@@ -76,18 +69,12 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
76
69
|
handleStyleChange: (style: any) => void;
|
|
77
70
|
handleDesignChange: (design: any) => void;
|
|
78
71
|
handleShowQuickfilters: () => void;
|
|
79
|
-
handleUpgrade: () => void;
|
|
80
72
|
getCompiledFilters(): JsonQLFilter[];
|
|
81
73
|
renderEditingSwitch(): React.DetailedReactHTMLElement<{
|
|
82
74
|
key: string;
|
|
83
75
|
className: string;
|
|
84
76
|
onClick: () => void;
|
|
85
77
|
}, HTMLElement>;
|
|
86
|
-
renderStyleItem(style: any): React.DetailedReactHTMLElement<{
|
|
87
|
-
key: any;
|
|
88
|
-
className: string;
|
|
89
|
-
onClick: () => void;
|
|
90
|
-
}, HTMLElement>;
|
|
91
78
|
renderStyle(): React.DetailedReactHTMLElement<{
|
|
92
79
|
type: string;
|
|
93
80
|
key: string;
|
|
@@ -102,6 +89,6 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
102
89
|
};
|
|
103
90
|
}, HTMLElement>;
|
|
104
91
|
renderQuickfilter(): React.CElement<import("../quickfilter/QuickfiltersComponent").QuickfiltersComponentProps, QuickfiltersComponent>;
|
|
105
|
-
refDashboardView: (el: any) =>
|
|
92
|
+
refDashboardView: (el: any) => void;
|
|
106
93
|
render(): React.JSX.Element;
|
|
107
94
|
}
|
|
@@ -26,7 +26,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
30
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
31
30
|
const react_1 = __importDefault(require("react"));
|
|
32
31
|
const R = react_1.default.createElement;
|
|
@@ -37,7 +36,6 @@ const QuickfiltersComponent_1 = __importDefault(require("../quickfilter/Quickfil
|
|
|
37
36
|
const QuickfilterCompiler_1 = __importDefault(require("../quickfilter/QuickfilterCompiler"));
|
|
38
37
|
const SettingsModalComponent_1 = __importDefault(require("./SettingsModalComponent"));
|
|
39
38
|
const LayoutManager_1 = __importDefault(require("../layouts/LayoutManager"));
|
|
40
|
-
const DashboardUpgrader_1 = __importDefault(require("./DashboardUpgrader"));
|
|
41
39
|
const LayoutOptionsComponent_1 = require("./LayoutOptionsComponent");
|
|
42
40
|
const ModalWindowComponent_1 = __importDefault(require("@mwater/react-library/lib/ModalWindowComponent"));
|
|
43
41
|
const layoutOptions_1 = require("./layoutOptions");
|
|
@@ -48,22 +46,13 @@ const expressions_ui_1 = require("@mwater/expressions-ui");
|
|
|
48
46
|
class DashboardComponent extends react_1.default.Component {
|
|
49
47
|
dashboardView;
|
|
50
48
|
static defaultProps = { printScaling: true };
|
|
51
|
-
static childContextTypes = {
|
|
52
|
-
locale: prop_types_1.default.string,
|
|
53
|
-
};
|
|
54
49
|
settings;
|
|
55
|
-
getChildContext() {
|
|
56
|
-
return {
|
|
57
|
-
// Pass locale down. Both here and DashboardViewComponent to ensure that quickfilters also get context
|
|
58
|
-
locale: this.props.design.locale,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
50
|
constructor(props) {
|
|
62
51
|
super(props);
|
|
63
52
|
const layoutOptions = (0, layoutOptions_1.getLayoutOptions)(props.design);
|
|
64
53
|
this.state = {
|
|
65
54
|
undoStack: new UndoStack_1.default().push(props.design),
|
|
66
|
-
quickfiltersValues: props.quickfiltersValues,
|
|
55
|
+
quickfiltersValues: props.quickfiltersValues || null,
|
|
67
56
|
editing: LayoutManager_1.default.createLayoutManager(props.design.layout).isEmpty(props.design.items) &&
|
|
68
57
|
props.onDesignChange != null,
|
|
69
58
|
layoutOptionsOpen: false,
|
|
@@ -93,7 +82,7 @@ class DashboardComponent extends react_1.default.Component {
|
|
|
93
82
|
}
|
|
94
83
|
}
|
|
95
84
|
handlePrint = () => {
|
|
96
|
-
this.dashboardView
|
|
85
|
+
this.dashboardView?.print();
|
|
97
86
|
};
|
|
98
87
|
handleUndo = () => {
|
|
99
88
|
const undoStack = this.state.undoStack.undo();
|
|
@@ -139,14 +128,6 @@ class DashboardComponent extends react_1.default.Component {
|
|
|
139
128
|
handleShowQuickfilters = () => {
|
|
140
129
|
return this.setState({ hideQuickfilters: false });
|
|
141
130
|
};
|
|
142
|
-
handleUpgrade = () => {
|
|
143
|
-
if (!confirm("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?")) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const design = new DashboardUpgrader_1.default().upgrade(this.props.design);
|
|
147
|
-
this.props.onDesignChange(design);
|
|
148
|
-
alert("Upgrade completed. Some widgets may need to be resized. Click Undo to revert back to old dashboard style.");
|
|
149
|
-
};
|
|
150
131
|
// Get filters from props filters combined with dashboard filters
|
|
151
132
|
getCompiledFilters() {
|
|
152
133
|
let compiledFilters = DashboardUtils.getCompiledFilters(this.props.design, this.props.schema, DashboardUtils.getFilterableTables(this.props.design, this.props.schema));
|
|
@@ -160,41 +141,11 @@ class DashboardComponent extends react_1.default.Component {
|
|
|
160
141
|
onClick: this.handleToggleEditing
|
|
161
142
|
}, R("span", { className: "fas fa-pencil-alt" }), this.state.editing ? " Editing" : " Edit");
|
|
162
143
|
}
|
|
163
|
-
renderStyleItem(style) {
|
|
164
|
-
const isActive = (this.props.design.style || "default") === style;
|
|
165
|
-
const content = (() => {
|
|
166
|
-
switch (style) {
|
|
167
|
-
case "default":
|
|
168
|
-
return [
|
|
169
|
-
R("h4", { key: "name", className: "list-group-item-heading" }, "Classic Dashboard"),
|
|
170
|
-
R("p", { key: "description", className: "" }, "Ideal for data display with minimal text")
|
|
171
|
-
];
|
|
172
|
-
case "greybg":
|
|
173
|
-
return [
|
|
174
|
-
R("h4", { key: "name", className: "list-group-item-heading" }, "Framed Dashboard"),
|
|
175
|
-
R("p", { key: "description", className: "" }, "Each widget is white on a grey background")
|
|
176
|
-
];
|
|
177
|
-
case "story":
|
|
178
|
-
return [
|
|
179
|
-
R("h4", { key: "name", className: "list-group-item-heading" }, "Story"),
|
|
180
|
-
R("p", { key: "description", className: "" }, "Ideal for data-driven storytelling with lots of text. Responsive and mobile-friendly")
|
|
181
|
-
];
|
|
182
|
-
}
|
|
183
|
-
return null;
|
|
184
|
-
})();
|
|
185
|
-
return R("a", {
|
|
186
|
-
key: style,
|
|
187
|
-
className: `list-group-item ${isActive ? "active" : ""}`,
|
|
188
|
-
onClick: this.handleStyleChange.bind(null, style)
|
|
189
|
-
}, content);
|
|
190
|
-
}
|
|
191
144
|
renderStyle() {
|
|
192
145
|
return R("button", { type: "button", key: "style", className: "btn btn-link btn-sm", onClick: this.handleOpenLayoutOptions }, R("span", { className: "fa fa-mobile" }), R("span", { className: "hide-600px" }, " Layout "));
|
|
193
146
|
}
|
|
194
147
|
renderActionLinks() {
|
|
195
|
-
return R("div", null, this.state.editing
|
|
196
|
-
? R("a", { key: "upgrade", className: "btn btn-info btn-sm", onClick: this.handleUpgrade }, "Upgrade Dashboard...")
|
|
197
|
-
: undefined, this.state.editing
|
|
148
|
+
return R("div", null, this.state.editing
|
|
198
149
|
? [
|
|
199
150
|
R("a", {
|
|
200
151
|
key: "undo",
|
|
@@ -232,11 +183,12 @@ class DashboardComponent extends react_1.default.Component {
|
|
|
232
183
|
locks: this.props.quickfilterLocks,
|
|
233
184
|
filters: this.getCompiledFilters(),
|
|
234
185
|
hideTopBorder: this.props.hideTitleBar,
|
|
235
|
-
|
|
186
|
+
// Don't hide if title bar is hidden as it can't be shown again
|
|
187
|
+
onHide: () => !this.props.hideTitleBar ? this.setState({ hideQuickfilters: true }) : undefined
|
|
236
188
|
});
|
|
237
189
|
}
|
|
238
190
|
refDashboardView = (el) => {
|
|
239
|
-
|
|
191
|
+
this.dashboardView = el;
|
|
240
192
|
};
|
|
241
193
|
render() {
|
|
242
194
|
let filters = this.props.filters || [];
|
|
@@ -268,19 +220,20 @@ class DashboardComponent extends react_1.default.Component {
|
|
|
268
220
|
});
|
|
269
221
|
// Pass active tables down to table select components so they can present a shorter list
|
|
270
222
|
return react_1.default.createElement(expressions_ui_1.ActiveTablesContext.Provider, { value: DashboardUtils.getFilterableTables(this.props.design, this.props.schema) },
|
|
271
|
-
react_1.default.createElement(
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
react_1.default.createElement(
|
|
223
|
+
react_1.default.createElement(expressions_ui_1.LocaleContext.Provider, { value: this.props.design.locale ?? "en" },
|
|
224
|
+
react_1.default.createElement("div", { style: {
|
|
225
|
+
display: "grid",
|
|
226
|
+
gridTemplateRows: this.props.hideTitleBar ? "auto 1fr" : "auto auto 1fr",
|
|
227
|
+
height: "100%"
|
|
228
|
+
} },
|
|
229
|
+
!this.props.hideTitleBar ? this.renderTitleBar() : undefined,
|
|
230
|
+
react_1.default.createElement("div", null, !this.state.hideQuickfilters ? this.renderQuickfilter() : undefined),
|
|
231
|
+
dashboardView,
|
|
232
|
+
this.props.onDesignChange != null && (react_1.default.createElement(SettingsModalComponent_1.default, { onDesignChange: this.handleDesignChange, schema: this.props.schema, dataSource: this.props.dataSource, ref: (c) => {
|
|
233
|
+
this.settings = c;
|
|
234
|
+
} })),
|
|
235
|
+
this.state.layoutOptionsOpen && (react_1.default.createElement(ModalWindowComponent_1.default, { isOpen: true, outerPadding: 10, innerPadding: 10, onRequestClose: () => this.setState({ layoutOptionsOpen: false }) },
|
|
236
|
+
react_1.default.createElement(LayoutOptionsComponent_1.LayoutOptionsComponent, { design: this.props.design, onDesignChange: this.props.onDesignChange, dashboardView: readonlyDashboardView, quickfiltersView: this.renderQuickfilter() }))))));
|
|
284
237
|
}
|
|
285
238
|
}
|
|
286
239
|
exports.default = DashboardComponent;
|