@mwater/visualization 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ColorComponent.d.ts +10 -11
- package/lib/ColorComponent.js +78 -29
- package/lib/ColorSchemeFactory.d.ts +13 -2
- package/lib/ColorSchemeFactory.js +7 -5
- package/lib/CustomColorsContext.d.ts +6 -0
- package/lib/CustomColorsContext.js +6 -0
- package/lib/FiltersDesignerComponent.d.ts +1 -4
- package/lib/FiltersDesignerComponent.js +2 -3
- package/lib/LocaleContextInjector.d.ts +5 -11
- package/lib/LocaleContextInjector.js +4 -12
- package/lib/MWaterAddRelatedFormComponent.js +3 -3
- package/lib/MWaterAddRelatedIndicatorComponent.d.ts +1 -4
- package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
- package/lib/MWaterCompleteTableSelectComponent.d.ts +5 -16
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +4 -6
- package/lib/MWaterContextComponent.js +4 -13
- package/lib/MWaterLoaderComponent.d.ts +5 -3
- package/lib/MWaterLoaderComponent.js +2 -1
- package/lib/MWaterTableSelectComponent.d.ts +1 -4
- package/lib/MWaterTableSelectComponent.js +10 -12
- package/lib/UIComponents.d.ts +2 -2
- package/lib/UIComponents.js +4 -12
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +3 -1
- package/lib/axes/AxisComponent.d.ts +2 -5
- package/lib/axes/AxisComponent.js +1 -2
- package/lib/axes/ColorPaletteCollectionComponent.d.ts +5 -12
- package/lib/axes/ColorPaletteCollectionComponent.js +67 -36
- package/lib/dashboards/DashboardComponent.d.ts +4 -12
- package/lib/dashboards/DashboardComponent.js +18 -38
- package/lib/dashboards/DashboardDesign.d.ts +3 -3
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +109 -132
- package/lib/dashboards/FontStyleEditor.d.ts +8 -0
- package/lib/dashboards/FontStyleEditor.js +130 -0
- package/lib/dashboards/LayoutOptionsComponent.d.ts +0 -1
- package/lib/dashboards/LayoutOptionsComponent.js +211 -42
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/WidgetComponent.d.ts +3 -3
- package/lib/dashboards/WidgetComponent.js +3 -6
- package/lib/dashboards/WidgetDataSourcePrioritizer.d.ts +20 -0
- package/lib/dashboards/WidgetDataSourcePrioritizer.js +72 -0
- package/lib/dashboards/layoutOptions.d.ts +83 -0
- package/lib/dashboards/layoutOptions.js +436 -10
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.js +87 -33
- package/lib/demo.js +3 -3
- package/lib/index.css +5 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -1
- package/lib/layouts/LayoutManager.d.ts +33 -29
- package/lib/layouts/LayoutManager.js +2 -8
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +26 -57
- package/lib/layouts/blocks/BlocksDisplayComponent.js +122 -205
- package/lib/layouts/blocks/BlocksLayoutManager.d.ts +6 -22
- package/lib/layouts/blocks/BlocksLayoutManager.js +5 -14
- package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +5 -4
- package/lib/layouts/blocks/HorizontalBlockComponent.js +5 -5
- package/lib/mWaterLoader.d.ts +2 -0
- package/lib/mWaterLoader.js +2 -1
- package/lib/maps/AddLayerComponent.d.ts +6 -8
- package/lib/maps/AddLayerComponent.js +6 -6
- package/lib/maps/BingLayer.js +10 -20
- package/lib/maps/BufferLayer.js +2 -1
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/DirectMapDataSource.d.ts +5 -2
- package/lib/maps/DirectMapDataSource.js +2 -1
- package/lib/maps/EditPopupComponent.js +2 -1
- package/lib/maps/MapComponent.d.ts +1 -4
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +1 -4
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/ServerMapDataSource.d.ts +2 -3
- package/lib/maps/ServerMapDataSource.js +5 -5
- package/lib/maps/VectorMapViewComponent.js +2 -1
- package/lib/maps/mapSymbols.js +2 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/vectorMaps.js +61 -55
- package/lib/quickfilter/QuickfiltersComponent.d.ts +1 -4
- package/lib/quickfilter/QuickfiltersComponent.js +3 -3
- package/lib/richtext/DropdownPaletteItem.d.ts +32 -0
- package/lib/richtext/DropdownPaletteItem.js +82 -0
- package/lib/richtext/FontColorPaletteItem.d.ts +1 -5
- package/lib/richtext/FontColorPaletteItem.js +32 -27
- package/lib/richtext/ItemsHtmlConverter.js +12 -3
- package/lib/richtext/RichTextComponent.d.ts +26 -52
- package/lib/richtext/RichTextComponent.js +166 -128
- package/lib/valueFormatter.js +6 -1
- package/lib/wellknown.d.ts +5 -0
- package/lib/wellknown.js +288 -0
- package/lib/widgets/DropdownWidgetComponent.d.ts +8 -25
- package/lib/widgets/DropdownWidgetComponent.js +48 -25
- package/lib/widgets/IFrameWidgetComponent.d.ts +1 -2
- package/lib/widgets/ImageWidgetComponent.d.ts +2 -3
- package/lib/widgets/MapWidget.d.ts +2 -0
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/TOCWidget.js +2 -1
- package/lib/widgets/Widget.d.ts +2 -0
- package/lib/widgets/WidgetDataSource.d.ts +3 -1
- package/lib/widgets/charts/Chart.d.ts +0 -1
- package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartViewComponent.js +11 -3
- package/lib/widgets/charts/ChartWidget.d.ts +1 -62
- package/lib/widgets/charts/ChartWidget.js +4 -183
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +51 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +167 -0
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +4 -4
- package/lib/widgets/charts/layered/LayeredChart.d.ts +5 -10
- package/lib/widgets/charts/layered/LayeredChart.js +6 -7
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +4 -2
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +46 -32
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +4 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +3 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -2
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -1
- package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +89 -38
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +5 -112
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +122 -166
- package/lib/widgets/charts/pivot/PivotChart.d.ts +6 -0
- package/lib/widgets/charts/pivot/PivotChart.js +47 -17
- package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +11 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +1 -1
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +20 -36
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +0 -1
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +23 -2
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +215 -181
- package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +9 -28
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/table/TableChart.js +8 -4
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +3 -3
- package/lib/widgets/charts/table/TableChartViewComponent.js +11 -11
- package/lib/widgets/text/TextComponent.d.ts +5 -12
- package/lib/widgets/text/TextComponent.js +19 -39
- package/lib/widgets/text/TextWidget.d.ts +2 -1
- package/lib/widgets/text/TextWidget.js +5 -1
- package/lib/widgets/text/TextWidgetComponent.d.ts +15 -3
- package/lib/widgets/text/TextWidgetComponent.js +76 -19
- package/lib/widgets/text/TextWidgetDesign.d.ts +13 -1
- package/lib/widgets/text/TextWidgetDesign.js +6 -0
- package/package.json +4 -4
- package/src/ColorComponent.tsx +177 -0
- package/src/ColorSchemeFactory.ts +12 -6
- package/src/CustomColorsContext.tsx +8 -0
- package/src/FiltersDesignerComponent.ts +3 -4
- package/src/LocaleContextInjector.tsx +14 -13
- package/src/MWaterAddRelatedFormComponent.ts +3 -3
- package/src/MWaterAddRelatedIndicatorComponent.ts +6 -6
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -36
- package/src/MWaterContextComponent.tsx +8 -17
- package/src/MWaterLoaderComponent.ts +6 -3
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/AxisBuilder.ts +7 -5
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +71 -107
- package/src/dashboards/DashboardDesign.ts +3 -3
- package/src/dashboards/DashboardUpgrader.ts +41 -1
- package/src/dashboards/DashboardViewComponent.tsx +313 -0
- package/src/dashboards/FontStyleEditor.tsx +166 -0
- package/src/dashboards/LayoutOptionsComponent.tsx +379 -75
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/ServerDatagridDataSource.ts +106 -43
- package/src/demo.ts +3 -3
- package/src/index.css +5 -0
- package/src/index.ts +1 -1
- package/src/layouts/LayoutManager.ts +44 -42
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +498 -0
- package/src/layouts/blocks/BlocksLayoutManager.ts +6 -15
- package/src/layouts/blocks/HorizontalBlockComponent.ts +9 -8
- package/src/mWaterLoader.ts +4 -1
- package/src/maps/AddLayerComponent.ts +9 -9
- package/src/maps/BingLayer.ts +16 -26
- package/src/maps/BufferLayer.ts +2 -1
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +7 -7
- package/src/maps/VectorMapViewComponent.tsx +2 -1
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +79 -74
- package/src/quickfilter/QuickfiltersComponent.ts +3 -3
- package/src/richtext/DropdownPaletteItem.tsx +144 -0
- package/src/richtext/FontColorPaletteItem.tsx +160 -0
- package/src/richtext/ItemsHtmlConverter.ts +15 -5
- package/src/richtext/RichTextComponent.tsx +274 -232
- package/src/valueFormatter.ts +5 -1
- package/src/wellknown.ts +286 -0
- package/src/widgets/DropdownWidgetComponent.tsx +75 -0
- package/src/widgets/MapWidget.ts +5 -2
- package/src/widgets/TOCWidget.ts +2 -1
- package/src/widgets/Widget.ts +3 -0
- package/src/widgets/WidgetDataSource.ts +3 -1
- package/src/widgets/charts/Chart.ts +1 -1
- package/src/widgets/charts/ChartViewComponent.ts +16 -3
- package/src/widgets/charts/ChartWidget.ts +3 -275
- package/src/widgets/charts/ChartWidgetComponent.tsx +281 -0
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +4 -4
- package/src/widgets/charts/layered/LayeredChart.ts +4 -6
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +80 -63
- package/src/widgets/charts/layered/LayeredChartDesign.ts +7 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +43 -10
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +6 -6
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +140 -88
- package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +305 -221
- package/src/widgets/charts/pivot/PivotChart.ts +56 -18
- package/src/widgets/charts/pivot/PivotChartDesign.ts +12 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +4 -3
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +39 -76
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +0 -1
- package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +230 -189
- package/src/widgets/charts/pivot/PivotChartUtils.ts +4 -4
- package/src/widgets/charts/pivot/{PivotChartViewComponent.ts → PivotChartViewComponent.tsx} +86 -89
- package/src/widgets/charts/table/TableChart.ts +8 -4
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +4 -4
- package/src/widgets/charts/table/TableChartViewComponent.ts +13 -14
- package/src/widgets/text/TextComponent.tsx +47 -49
- package/src/widgets/text/TextWidget.ts +8 -3
- package/src/widgets/text/TextWidgetComponent.tsx +249 -0
- package/src/widgets/text/TextWidgetDesign.ts +22 -1
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -303
- package/src/dashboards/layoutOptions.ts +0 -40
- package/src/layout-styles.css +0 -263
- package/src/layouts/blocks/BlocksDisplayComponent.ts +0 -461
- package/src/layouts/grid/GridLayoutComponent.ts +0 -67
- package/src/layouts/grid/GridLayoutManager.ts +0 -185
- package/src/layouts/grid/LegoLayoutEngine.ts +0 -142
- package/src/layouts/grid/PaletteItemComponent.ts +0 -28
- package/src/layouts/grid/README.md +0 -14
- package/src/layouts/grid/WidgetContainerComponent.ts +0 -420
- package/src/richtext/FontColorPaletteItem.ts +0 -172
- package/src/richtext/FontSizePaletteItem.ts +0 -110
- package/src/widgets/DropdownWidgetComponent.ts +0 -78
- package/src/widgets/text/TextWidgetComponent.ts +0 -120
|
@@ -1,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,7 +69,6 @@ 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;
|
|
@@ -97,6 +89,6 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
97
89
|
};
|
|
98
90
|
}, HTMLElement>;
|
|
99
91
|
renderQuickfilter(): React.CElement<import("../quickfilter/QuickfiltersComponent").QuickfiltersComponentProps, QuickfiltersComponent>;
|
|
100
|
-
refDashboardView: (el: any) =>
|
|
92
|
+
refDashboardView: (el: any) => void;
|
|
101
93
|
render(): React.JSX.Element;
|
|
102
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));
|
|
@@ -164,9 +145,7 @@ class DashboardComponent extends react_1.default.Component {
|
|
|
164
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 "));
|
|
165
146
|
}
|
|
166
147
|
renderActionLinks() {
|
|
167
|
-
return R("div", null, this.state.editing
|
|
168
|
-
? R("a", { key: "upgrade", className: "btn btn-info btn-sm", onClick: this.handleUpgrade }, "Upgrade Dashboard...")
|
|
169
|
-
: undefined, this.state.editing
|
|
148
|
+
return R("div", null, this.state.editing
|
|
170
149
|
? [
|
|
171
150
|
R("a", {
|
|
172
151
|
key: "undo",
|
|
@@ -209,7 +188,7 @@ class DashboardComponent extends react_1.default.Component {
|
|
|
209
188
|
});
|
|
210
189
|
}
|
|
211
190
|
refDashboardView = (el) => {
|
|
212
|
-
|
|
191
|
+
this.dashboardView = el;
|
|
213
192
|
};
|
|
214
193
|
render() {
|
|
215
194
|
let filters = this.props.filters || [];
|
|
@@ -241,19 +220,20 @@ class DashboardComponent extends react_1.default.Component {
|
|
|
241
220
|
});
|
|
242
221
|
// Pass active tables down to table select components so they can present a shorter list
|
|
243
222
|
return react_1.default.createElement(expressions_ui_1.ActiveTablesContext.Provider, { value: DashboardUtils.getFilterableTables(this.props.design, this.props.schema) },
|
|
244
|
-
react_1.default.createElement(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
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() }))))));
|
|
257
237
|
}
|
|
258
238
|
}
|
|
259
239
|
exports.default = DashboardComponent;
|
|
@@ -12,11 +12,11 @@ export interface DashboardDesign {
|
|
|
12
12
|
/** array of quick filters (user-selectable filters). See quickfilter/README.md */
|
|
13
13
|
quickfilters?: Quickfilter[];
|
|
14
14
|
/** layout engine to use (`blocks` is new default) */
|
|
15
|
-
layout: "blocks"
|
|
16
|
-
/**
|
|
15
|
+
layout: "blocks";
|
|
16
|
+
/** Optional theme to use. Defaults to "default" theme. */
|
|
17
17
|
style?: DashboardTheme;
|
|
18
18
|
/** Options for layout including responsiveness, scaling, etc */
|
|
19
|
-
layoutOptions?: BlocksLayoutOptions
|
|
19
|
+
layoutOptions?: Partial<BlocksLayoutOptions>;
|
|
20
20
|
/** filter expression indexed by table. e.g. { sometable: logical expression, etc. } */
|
|
21
21
|
filters?: {
|
|
22
22
|
[tableId: string]: Expr;
|
|
@@ -54,7 +54,42 @@ class DashboardUpgrader {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
else if (lineItems.length === 1) {
|
|
57
|
-
|
|
57
|
+
const item = items[lineItems[0]];
|
|
58
|
+
const convertedBlock = convertBlock(lineItems[0], item);
|
|
59
|
+
// If widget goes all the way across
|
|
60
|
+
if (item.layout.x + item.layout.w == 24) {
|
|
61
|
+
newItems.blocks.push(convertedBlock);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const leftSpacerWidth = item.layout.x;
|
|
65
|
+
const rightSpacerWidth = 24 - (item.layout.x + item.layout.w);
|
|
66
|
+
const blocks = [];
|
|
67
|
+
const weights = [];
|
|
68
|
+
if (leftSpacerWidth > 0) {
|
|
69
|
+
blocks.push({
|
|
70
|
+
id: (0, uuid_1.default)(),
|
|
71
|
+
type: "spacer",
|
|
72
|
+
aspectRatio: 3,
|
|
73
|
+
});
|
|
74
|
+
weights.push(leftSpacerWidth);
|
|
75
|
+
}
|
|
76
|
+
blocks.push(convertedBlock);
|
|
77
|
+
weights.push(item.layout.w);
|
|
78
|
+
if (rightSpacerWidth > 0) {
|
|
79
|
+
blocks.push({
|
|
80
|
+
id: (0, uuid_1.default)(),
|
|
81
|
+
type: "spacer",
|
|
82
|
+
aspectRatio: 3,
|
|
83
|
+
});
|
|
84
|
+
weights.push(rightSpacerWidth);
|
|
85
|
+
}
|
|
86
|
+
newItems.blocks.push({
|
|
87
|
+
id: (0, uuid_1.default)(),
|
|
88
|
+
type: "horizontal",
|
|
89
|
+
blocks,
|
|
90
|
+
weights,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
58
93
|
delete items[lineItems[0]];
|
|
59
94
|
}
|
|
60
95
|
y += 1;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
4
|
-
import WidgetScoper from "../widgets/WidgetScoper";
|
|
5
|
-
import WidgetScopesViewComponent from "../widgets/WidgetScopesViewComponent";
|
|
6
3
|
import { DashboardDataSource, DashboardDesign, JsonQLFilter } from "..";
|
|
7
4
|
export interface DashboardViewComponentProps {
|
|
8
5
|
/** schema to use */
|
|
@@ -34,38 +31,12 @@ export interface DashboardViewComponentProps {
|
|
|
34
31
|
/** Change to force a refresh */
|
|
35
32
|
refreshKey?: any;
|
|
36
33
|
}
|
|
34
|
+
export interface DashboardViewComponentHandle {
|
|
35
|
+
print: () => Promise<void>;
|
|
36
|
+
}
|
|
37
37
|
/**
|
|
38
38
|
* Displays a dashboard, handling removing of widgets. No title bar or other decorations.
|
|
39
39
|
* Handles scoping and stores the state of scope
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}> {
|
|
44
|
-
static childContextTypes: {
|
|
45
|
-
locale: PropTypes.Requireable<string>;
|
|
46
|
-
};
|
|
47
|
-
widgetComps: {
|
|
48
|
-
[widgetId: string]: any;
|
|
49
|
-
};
|
|
50
|
-
getChildContext(): {
|
|
51
|
-
locale: string | undefined;
|
|
52
|
-
};
|
|
53
|
-
constructor(props: any);
|
|
54
|
-
componentDidMount(): void;
|
|
55
|
-
componentWillUnmount(): void;
|
|
56
|
-
handleStorageChange: () => void;
|
|
57
|
-
handleScopeChange: (id: any, scope: any) => void;
|
|
58
|
-
handleRemoveScope: (id: any) => void;
|
|
59
|
-
handleItemsChange: (items: any) => void;
|
|
60
|
-
handleClipboardChange: (block: any) => void;
|
|
61
|
-
getClipboardContents(): any;
|
|
62
|
-
print: () => Promise<void>;
|
|
63
|
-
getCompiledFilters(): JsonQLFilter[];
|
|
64
|
-
getTOCEntries(layoutManager: any): any[];
|
|
65
|
-
handleScrollToTOCEntry: (widgetId: any, entryId: any) => any;
|
|
66
|
-
renderScopes(): React.CElement<import("../widgets/WidgetScopesViewComponent").WidgetScopesViewComponentProps, WidgetScopesViewComponent>;
|
|
67
|
-
compRef: (widgetId: any, comp: any) => any;
|
|
68
|
-
render(): React.DetailedReactHTMLElement<{
|
|
69
|
-
style: React.CSSProperties;
|
|
70
|
-
}, HTMLElement>;
|
|
71
|
-
}
|
|
41
|
+
declare const DashboardViewComponent: React.ForwardRefExoticComponent<DashboardViewComponentProps & React.RefAttributes<DashboardViewComponentHandle>>;
|
|
42
|
+
export default DashboardViewComponent;
|