@mwater/visualization 5.2.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ColorComponent.d.ts +10 -11
- package/lib/ColorComponent.js +78 -29
- package/lib/ColorSchemeFactory.d.ts +13 -2
- package/lib/ColorSchemeFactory.js +7 -5
- package/lib/CustomColorsContext.d.ts +6 -0
- package/lib/CustomColorsContext.js +6 -0
- package/lib/FiltersDesignerComponent.d.ts +1 -4
- package/lib/FiltersDesignerComponent.js +2 -3
- package/lib/LocaleContextInjector.d.ts +5 -11
- package/lib/LocaleContextInjector.js +4 -12
- package/lib/MWaterAddRelatedFormComponent.js +3 -3
- package/lib/MWaterAddRelatedIndicatorComponent.d.ts +1 -4
- package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
- package/lib/MWaterCompleteTableSelectComponent.d.ts +5 -16
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +4 -6
- package/lib/MWaterContextComponent.js +4 -13
- package/lib/MWaterLoaderComponent.d.ts +5 -3
- package/lib/MWaterLoaderComponent.js +2 -1
- package/lib/MWaterTableSelectComponent.d.ts +1 -4
- package/lib/MWaterTableSelectComponent.js +10 -12
- package/lib/UIComponents.d.ts +2 -2
- package/lib/UIComponents.js +4 -12
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +3 -1
- package/lib/axes/AxisComponent.d.ts +2 -5
- package/lib/axes/AxisComponent.js +1 -2
- package/lib/axes/ColorPaletteCollectionComponent.d.ts +5 -12
- package/lib/axes/ColorPaletteCollectionComponent.js +67 -36
- package/lib/dashboards/DashboardComponent.d.ts +4 -12
- package/lib/dashboards/DashboardComponent.js +18 -38
- package/lib/dashboards/DashboardDesign.d.ts +3 -3
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +109 -132
- package/lib/dashboards/FontStyleEditor.d.ts +8 -0
- package/lib/dashboards/FontStyleEditor.js +130 -0
- package/lib/dashboards/LayoutOptionsComponent.d.ts +0 -1
- package/lib/dashboards/LayoutOptionsComponent.js +211 -42
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/WidgetComponent.d.ts +3 -3
- package/lib/dashboards/WidgetComponent.js +3 -6
- package/lib/dashboards/WidgetDataSourcePrioritizer.d.ts +20 -0
- package/lib/dashboards/WidgetDataSourcePrioritizer.js +72 -0
- package/lib/dashboards/layoutOptions.d.ts +83 -0
- package/lib/dashboards/layoutOptions.js +436 -10
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.js +87 -33
- package/lib/demo.js +3 -3
- package/lib/index.css +5 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -1
- package/lib/layouts/LayoutManager.d.ts +33 -29
- package/lib/layouts/LayoutManager.js +2 -8
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +26 -57
- package/lib/layouts/blocks/BlocksDisplayComponent.js +122 -205
- package/lib/layouts/blocks/BlocksLayoutManager.d.ts +6 -22
- package/lib/layouts/blocks/BlocksLayoutManager.js +5 -14
- package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +5 -4
- package/lib/layouts/blocks/HorizontalBlockComponent.js +5 -5
- package/lib/mWaterLoader.d.ts +2 -0
- package/lib/mWaterLoader.js +2 -1
- package/lib/maps/AddLayerComponent.d.ts +6 -8
- package/lib/maps/AddLayerComponent.js +6 -6
- package/lib/maps/BingLayer.js +10 -20
- package/lib/maps/BufferLayer.js +2 -1
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/DirectMapDataSource.d.ts +5 -2
- package/lib/maps/DirectMapDataSource.js +2 -1
- package/lib/maps/EditPopupComponent.js +2 -1
- package/lib/maps/MapComponent.d.ts +1 -4
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +1 -4
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/ServerMapDataSource.d.ts +2 -3
- package/lib/maps/ServerMapDataSource.js +5 -5
- package/lib/maps/VectorMapViewComponent.js +2 -1
- package/lib/maps/mapSymbols.js +2 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/vectorMaps.js +61 -55
- package/lib/quickfilter/QuickfiltersComponent.d.ts +1 -4
- package/lib/quickfilter/QuickfiltersComponent.js +3 -3
- package/lib/richtext/DropdownPaletteItem.d.ts +32 -0
- package/lib/richtext/DropdownPaletteItem.js +82 -0
- package/lib/richtext/FontColorPaletteItem.d.ts +1 -5
- package/lib/richtext/FontColorPaletteItem.js +32 -27
- package/lib/richtext/ItemsHtmlConverter.js +12 -3
- package/lib/richtext/RichTextComponent.d.ts +26 -52
- package/lib/richtext/RichTextComponent.js +166 -128
- package/lib/valueFormatter.js +6 -1
- package/lib/wellknown.d.ts +5 -0
- package/lib/wellknown.js +288 -0
- package/lib/widgets/DropdownWidgetComponent.d.ts +8 -25
- package/lib/widgets/DropdownWidgetComponent.js +48 -25
- package/lib/widgets/IFrameWidgetComponent.d.ts +1 -2
- package/lib/widgets/ImageWidgetComponent.d.ts +2 -3
- package/lib/widgets/MapWidget.d.ts +2 -0
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/TOCWidget.js +2 -1
- package/lib/widgets/Widget.d.ts +2 -0
- package/lib/widgets/WidgetDataSource.d.ts +3 -1
- package/lib/widgets/charts/Chart.d.ts +0 -1
- package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartViewComponent.js +11 -3
- package/lib/widgets/charts/ChartWidget.d.ts +1 -62
- package/lib/widgets/charts/ChartWidget.js +4 -183
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +51 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +167 -0
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +4 -4
- package/lib/widgets/charts/layered/LayeredChart.d.ts +5 -10
- package/lib/widgets/charts/layered/LayeredChart.js +6 -7
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +4 -2
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +46 -32
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +4 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +3 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -2
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -1
- package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +89 -38
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +5 -112
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +122 -166
- package/lib/widgets/charts/pivot/PivotChart.d.ts +6 -0
- package/lib/widgets/charts/pivot/PivotChart.js +47 -17
- package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +11 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +1 -1
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +20 -36
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +0 -1
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +23 -2
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +215 -181
- package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +9 -28
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/table/TableChart.js +8 -4
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +3 -3
- package/lib/widgets/charts/table/TableChartViewComponent.js +11 -11
- package/lib/widgets/text/TextComponent.d.ts +5 -12
- package/lib/widgets/text/TextComponent.js +19 -39
- package/lib/widgets/text/TextWidget.d.ts +2 -1
- package/lib/widgets/text/TextWidget.js +5 -1
- package/lib/widgets/text/TextWidgetComponent.d.ts +15 -3
- package/lib/widgets/text/TextWidgetComponent.js +76 -19
- package/lib/widgets/text/TextWidgetDesign.d.ts +13 -1
- package/lib/widgets/text/TextWidgetDesign.js +6 -0
- package/package.json +4 -4
- package/src/ColorComponent.tsx +177 -0
- package/src/ColorSchemeFactory.ts +12 -6
- package/src/CustomColorsContext.tsx +9 -0
- package/src/FiltersDesignerComponent.ts +3 -4
- package/src/LocaleContextInjector.tsx +14 -13
- package/src/MWaterAddRelatedFormComponent.ts +3 -3
- package/src/MWaterAddRelatedIndicatorComponent.ts +6 -6
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -36
- package/src/MWaterContextComponent.tsx +8 -17
- package/src/MWaterLoaderComponent.ts +6 -3
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/AxisBuilder.ts +7 -5
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +71 -107
- package/src/dashboards/DashboardDesign.ts +3 -3
- package/src/dashboards/DashboardUpgrader.ts +41 -1
- package/src/dashboards/DashboardViewComponent.tsx +313 -0
- package/src/dashboards/FontStyleEditor.tsx +166 -0
- package/src/dashboards/LayoutOptionsComponent.tsx +380 -75
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/ServerDatagridDataSource.ts +106 -43
- package/src/demo.ts +3 -3
- package/src/index.css +5 -0
- package/src/index.ts +1 -1
- package/src/layouts/LayoutManager.ts +44 -42
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +498 -0
- package/src/layouts/blocks/BlocksLayoutManager.ts +6 -15
- package/src/layouts/blocks/HorizontalBlockComponent.ts +9 -8
- package/src/mWaterLoader.ts +4 -1
- package/src/maps/AddLayerComponent.ts +9 -9
- package/src/maps/BingLayer.ts +16 -26
- package/src/maps/BufferLayer.ts +2 -1
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +7 -7
- package/src/maps/VectorMapViewComponent.tsx +2 -1
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +79 -74
- package/src/quickfilter/QuickfiltersComponent.ts +3 -3
- package/src/richtext/DropdownPaletteItem.tsx +144 -0
- package/src/richtext/FontColorPaletteItem.tsx +160 -0
- package/src/richtext/ItemsHtmlConverter.ts +15 -5
- package/src/richtext/RichTextComponent.tsx +274 -232
- package/src/valueFormatter.ts +5 -1
- package/src/wellknown.ts +286 -0
- package/src/widgets/DropdownWidgetComponent.tsx +75 -0
- package/src/widgets/MapWidget.ts +5 -2
- package/src/widgets/TOCWidget.ts +2 -1
- package/src/widgets/Widget.ts +3 -0
- package/src/widgets/WidgetDataSource.ts +3 -1
- package/src/widgets/charts/Chart.ts +1 -1
- package/src/widgets/charts/ChartViewComponent.ts +16 -3
- package/src/widgets/charts/ChartWidget.ts +3 -275
- package/src/widgets/charts/ChartWidgetComponent.tsx +281 -0
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +4 -4
- package/src/widgets/charts/layered/LayeredChart.ts +4 -6
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +80 -63
- package/src/widgets/charts/layered/LayeredChartDesign.ts +7 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +43 -10
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +6 -6
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +140 -88
- package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +305 -221
- package/src/widgets/charts/pivot/PivotChart.ts +56 -18
- package/src/widgets/charts/pivot/PivotChartDesign.ts +12 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +4 -3
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +39 -76
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +0 -1
- package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +230 -189
- package/src/widgets/charts/pivot/PivotChartUtils.ts +4 -4
- package/src/widgets/charts/pivot/{PivotChartViewComponent.ts → PivotChartViewComponent.tsx} +86 -89
- package/src/widgets/charts/table/TableChart.ts +8 -4
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +4 -4
- package/src/widgets/charts/table/TableChartViewComponent.ts +13 -14
- package/src/widgets/text/TextComponent.tsx +47 -49
- package/src/widgets/text/TextWidget.ts +8 -3
- package/src/widgets/text/TextWidgetComponent.tsx +249 -0
- package/src/widgets/text/TextWidgetDesign.ts +22 -1
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -303
- package/src/dashboards/layoutOptions.ts +0 -40
- package/src/layout-styles.css +0 -263
- package/src/layouts/blocks/BlocksDisplayComponent.ts +0 -461
- package/src/layouts/grid/GridLayoutComponent.ts +0 -67
- package/src/layouts/grid/GridLayoutManager.ts +0 -185
- package/src/layouts/grid/LegoLayoutEngine.ts +0 -142
- package/src/layouts/grid/PaletteItemComponent.ts +0 -28
- package/src/layouts/grid/README.md +0 -14
- package/src/layouts/grid/WidgetContainerComponent.ts +0 -420
- package/src/richtext/FontColorPaletteItem.ts +0 -172
- package/src/richtext/FontSizePaletteItem.ts +0 -110
- package/src/widgets/DropdownWidgetComponent.ts +0 -78
- package/src/widgets/text/TextWidgetComponent.ts +0 -120
|
@@ -3,9 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jquery_1 = __importDefault(require("jquery"));
|
|
7
|
-
const querystring_1 = __importDefault(require("querystring"));
|
|
8
6
|
const compressJson_1 = __importDefault(require("../compressJson"));
|
|
7
|
+
const querystring_1 = __importDefault(require("querystring"));
|
|
9
8
|
/** Uses mWater server to get datagrid data to allow sharing with unprivileged users */
|
|
10
9
|
class ServerDatagridDataSource {
|
|
11
10
|
options;
|
|
@@ -21,37 +20,75 @@ class ServerDatagridDataSource {
|
|
|
21
20
|
// Get the data that the widget needs. The widget should implement getData method (see above) to get the data from the server
|
|
22
21
|
// design: design of the widget. Ignored in the case of server-side rendering
|
|
23
22
|
// filters: array of filters to apply. Each is { table: table id, jsonql: jsonql condition with {alias} for tableAlias. Use injectAlias to correct
|
|
24
|
-
getRows(design, offset, limit, filters, callback) {
|
|
23
|
+
async getRows(design, offset, limit, filters, callback) {
|
|
25
24
|
const query = {
|
|
26
25
|
client: this.options.client,
|
|
27
26
|
share: this.options.share,
|
|
28
|
-
filters: (0, compressJson_1.default)(filters),
|
|
29
27
|
rev: this.options.rev,
|
|
30
28
|
offset,
|
|
31
29
|
limit
|
|
32
30
|
};
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
const filtersJson = JSON.stringify(filters);
|
|
32
|
+
const baseUrl = this.options.apiUrl + `datagrids/${this.options.datagridId}/data`;
|
|
33
|
+
try {
|
|
34
|
+
let response;
|
|
35
|
+
// If the filters are too large, we need to send them in the body
|
|
36
|
+
if (filtersJson.length > 5000) {
|
|
37
|
+
response = await fetch(baseUrl + '?' + querystring_1.default.stringify(query), {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
headers: { 'Content-Type': 'application/json' },
|
|
40
|
+
body: JSON.stringify({ filters: (0, compressJson_1.default)(filters) }),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
query.filters = (0, compressJson_1.default)(filters);
|
|
45
|
+
const url = baseUrl + '?' + querystring_1.default.stringify(query);
|
|
46
|
+
response = await fetch(url);
|
|
47
|
+
}
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
50
|
+
}
|
|
51
|
+
const data = await response.json();
|
|
52
|
+
callback(null, data);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.error(error);
|
|
56
|
+
callback(error);
|
|
57
|
+
}
|
|
40
58
|
}
|
|
41
|
-
countRows(design, filters, callback) {
|
|
59
|
+
async countRows(design, filters, callback) {
|
|
42
60
|
const query = {
|
|
43
61
|
client: this.options.client,
|
|
44
62
|
share: this.options.share,
|
|
45
|
-
|
|
46
|
-
rev: this.options.rev,
|
|
63
|
+
rev: this.options.rev
|
|
47
64
|
};
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
const filtersJson = JSON.stringify(filters);
|
|
66
|
+
const baseUrl = this.options.apiUrl + `datagrids/${this.options.datagridId}/summary`;
|
|
67
|
+
try {
|
|
68
|
+
let response;
|
|
69
|
+
// If the filters are too large, we need to send them in the body
|
|
70
|
+
if (filtersJson.length > 5000) {
|
|
71
|
+
response = await fetch(baseUrl + '?' + querystring_1.default.stringify(query), {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: { 'Content-Type': 'application/json' },
|
|
74
|
+
body: JSON.stringify({ filters: (0, compressJson_1.default)(filters) }),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
query.filters = (0, compressJson_1.default)(filters);
|
|
79
|
+
const url = baseUrl + '?' + querystring_1.default.stringify(query);
|
|
80
|
+
response = await fetch(url);
|
|
81
|
+
}
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
84
|
+
}
|
|
85
|
+
const data = await response.json();
|
|
86
|
+
callback(null, data?.[0]?.cnt);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error(error);
|
|
90
|
+
callback(error);
|
|
91
|
+
}
|
|
55
92
|
}
|
|
56
93
|
getQuickfiltersDataSource() {
|
|
57
94
|
return new ServerQuickfilterDataSource(this.options);
|
|
@@ -70,23 +107,40 @@ class ServerQuickfilterDataSource {
|
|
|
70
107
|
this.options = options;
|
|
71
108
|
}
|
|
72
109
|
// Gets the values of the quickfilter at index
|
|
73
|
-
getValues(index, expr, filters, offset, limit, callback) {
|
|
110
|
+
async getValues(index, expr, filters, offset, limit, callback) {
|
|
74
111
|
const query = {
|
|
75
112
|
client: this.options.client,
|
|
76
113
|
share: this.options.share,
|
|
77
|
-
|
|
78
|
-
offset,
|
|
114
|
+
offset: offset ?? 0,
|
|
79
115
|
limit,
|
|
80
116
|
rev: this.options.rev
|
|
81
117
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
118
|
+
try {
|
|
119
|
+
let response;
|
|
120
|
+
const url = this.options.apiUrl + `datagrids/${this.options.datagridId}/quickfilters/${index}/values`;
|
|
121
|
+
const filtersJson = JSON.stringify(filters);
|
|
122
|
+
// If the filters are too large, we need to send them in the body
|
|
123
|
+
if (filtersJson.length > 5000) {
|
|
124
|
+
query.filters = (0, compressJson_1.default)(filters);
|
|
125
|
+
response = await fetch(url + '?' + querystring_1.default.stringify(query), {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: { 'Content-Type': 'application/json' },
|
|
128
|
+
body: JSON.stringify({ filters: (0, compressJson_1.default)(filters) }),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
query.filters = filtersJson;
|
|
133
|
+
response = await fetch(url + '?' + querystring_1.default.stringify(query));
|
|
134
|
+
}
|
|
135
|
+
if (!response.ok) {
|
|
136
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
137
|
+
}
|
|
138
|
+
const data = await response.json();
|
|
139
|
+
callback(null, data);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.error(error);
|
|
143
|
+
callback(error);
|
|
144
|
+
}
|
|
91
145
|
}
|
|
92
146
|
}
|
package/lib/demo.js
CHANGED
|
@@ -53,14 +53,14 @@ global.T = ez_localize_1.defaultT;
|
|
|
53
53
|
// Set demo key
|
|
54
54
|
(0, vectorMaps_1.setMapTilerApiKey)("cNNyJl2nwIIKEUYSeXYc");
|
|
55
55
|
(0, jquery_1.default)(function () {
|
|
56
|
-
const sample = R(react_dnd_1.DragDropContextProvider, { backend: react_dnd_html5_backend_1.default }, R("div", { className: "container-fluid", style: { height: "100%", paddingLeft: 0, paddingRight: 0 } }, R("style", null, "html, body, #main { height: 100% }"), R(
|
|
56
|
+
const sample = R(react_dnd_1.DragDropContextProvider, { backend: react_dnd_html5_backend_1.default }, R("div", { className: "container-fluid", style: { height: "100%", paddingLeft: 0, paddingRight: 0 } }, R("style", null, "html, body, #main { height: 100% }"), R(MWaterDirectDashboardPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
57
|
+
//R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "38d803820a7a4bf5a1d5ef19cf8c64f3"})
|
|
58
|
+
// R(MWaterDirectMapPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
57
59
|
// R(RichTextPane)
|
|
58
60
|
// R(MWaterMapPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1)})
|
|
59
61
|
// R(TestPane, apiUrl: "https://api.mwater.co/v3/")
|
|
60
62
|
// R(MWaterDashboardPane, apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "a855eb0587d845d3ac27aed03c463976", share: "817c76088c7649ec8cc0b8193e547a09")
|
|
61
63
|
// R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "f99f206ddd4442a981761b8342c58058"})
|
|
62
|
-
// R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "38d803820a7a4bf5a1d5ef19cf8c64f3"})
|
|
63
|
-
// R(MWaterDirectDashboardPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
64
64
|
//R(MWaterDirectDashboardPane, { apiUrl: "http://localhost:1234/v3/", client: window.location.hash.substr(1) })
|
|
65
65
|
//R(MWaterDatagridPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
66
66
|
// R(MWaterDirectMapPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
package/lib/index.css
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Lato, Lora, Inter, Merriweather, Roboto
|
|
3
|
+
*/
|
|
4
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Lora:ital,wght@0,400..700;1,400..700&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
|
|
5
|
+
|
|
1
6
|
/** Plain link with cursor pointer. Can be span or a */
|
|
2
7
|
.link-plain {
|
|
3
8
|
color: var(--bs-primary);
|
package/lib/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { languages } from "./languages";
|
|
|
20
20
|
export { default as MWaterLoaderComponent } from "./MWaterLoaderComponent";
|
|
21
21
|
export { default as MWaterContextComponent } from "./MWaterContextComponent";
|
|
22
22
|
export { default as mWaterLoader } from "./mWaterLoader";
|
|
23
|
+
export { WidgetDataSource } from "./widgets/WidgetDataSource";
|
|
23
24
|
export { default as DirectWidgetDataSource } from "./widgets/DirectWidgetDataSource";
|
|
24
25
|
import "leaflet/dist/leaflet.css";
|
|
25
26
|
import "fixed-data-table-2/dist/fixed-data-table.min.css";
|
|
@@ -28,7 +29,6 @@ import "./layouts/decorated-block.css";
|
|
|
28
29
|
import "react-datepicker/dist/react-datepicker.css";
|
|
29
30
|
import "billboard.js/dist/billboard.css";
|
|
30
31
|
import "./index.css";
|
|
31
|
-
import "./layout-styles.css";
|
|
32
32
|
export { setMapTilerApiKey } from "./maps/vectorMaps";
|
|
33
33
|
export { default as UndoStack } from "./UndoStack";
|
|
34
34
|
export { default as DashboardViewComponent } from "./dashboards/DashboardViewComponent";
|
package/lib/index.js
CHANGED
|
@@ -63,7 +63,6 @@ require("./layouts/decorated-block.css");
|
|
|
63
63
|
require("react-datepicker/dist/react-datepicker.css");
|
|
64
64
|
require("billboard.js/dist/billboard.css");
|
|
65
65
|
require("./index.css");
|
|
66
|
-
require("./layout-styles.css");
|
|
67
66
|
var vectorMaps_1 = require("./maps/vectorMaps");
|
|
68
67
|
Object.defineProperty(exports, "setMapTilerApiKey", { enumerable: true, get: function () { return vectorMaps_1.setMapTilerApiKey; } });
|
|
69
68
|
var UndoStack_1 = require("./UndoStack");
|
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { BlocksLayoutOptions } from "../dashboards/layoutOptions";
|
|
3
|
+
/** Options for rendering a widget */
|
|
4
|
+
export interface RenderWidgetOptions {
|
|
5
|
+
id: string;
|
|
6
|
+
type: string;
|
|
7
|
+
design: any;
|
|
8
|
+
onDesignChange?: (design: any) => void;
|
|
9
|
+
width: number;
|
|
10
|
+
/** height of widget. If not specified, is auto height */
|
|
11
|
+
height?: number;
|
|
12
|
+
/** Priority of widget. Higher priority widgets are rendered first */
|
|
13
|
+
priority?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface RenderLayoutOptions {
|
|
16
|
+
/** width of layout */
|
|
17
|
+
width?: number;
|
|
18
|
+
/** opaque items object that layout manager understands */
|
|
19
|
+
items: any;
|
|
20
|
+
/** Called when items changes */
|
|
21
|
+
onItemsChange?: (items: any) => void;
|
|
22
|
+
/** called with ({ id:, type:, design:, onDesignChange:, width:, height: }) */
|
|
23
|
+
renderWidget: (options: RenderWidgetOptions) => ReactElement;
|
|
24
|
+
/** layout options to use */
|
|
25
|
+
layoutOptions: BlocksLayoutOptions;
|
|
26
|
+
/** true to disable maps */
|
|
27
|
+
disableMaps?: boolean;
|
|
28
|
+
/** clipboard contents */
|
|
29
|
+
clipboard?: any;
|
|
30
|
+
/** called when clipboard is changed */
|
|
31
|
+
onClipboardChange?: (clipboard: any) => void;
|
|
32
|
+
/** message to display if clipboard can't be pasted into current dashboard */
|
|
33
|
+
cantPasteMessage?: string;
|
|
34
|
+
}
|
|
3
35
|
/** Responsible for laying out items, rendering widgets and holding them in a data structure that is layout manager specific */
|
|
4
36
|
export default class LayoutManager {
|
|
5
37
|
/** Renders the layout as a react element */
|
|
6
|
-
renderLayout(options:
|
|
7
|
-
/** width of layout */
|
|
8
|
-
width?: number;
|
|
9
|
-
/** opaque items object that layout manager understands */
|
|
10
|
-
items: any;
|
|
11
|
-
/** Called when items changes */
|
|
12
|
-
onItemsChange?: (items: any) => void;
|
|
13
|
-
/** called with ({ id:, type:, design:, onDesignChange:, width:, height: }) */
|
|
14
|
-
renderWidget: (options: {
|
|
15
|
-
id: string;
|
|
16
|
-
type: string;
|
|
17
|
-
design: any;
|
|
18
|
-
onDesignChange: (design: any) => void;
|
|
19
|
-
width: number;
|
|
20
|
-
height: number;
|
|
21
|
-
}) => ReactElement;
|
|
22
|
-
/** style to use for layout. null for default */
|
|
23
|
-
style: string | null;
|
|
24
|
-
/** layout options to use */
|
|
25
|
-
layoutOptions: BlocksLayoutOptions | null;
|
|
26
|
-
/** true to disable maps */
|
|
27
|
-
disableMaps?: boolean;
|
|
28
|
-
/** clipboard contents */
|
|
29
|
-
clipboard: any;
|
|
30
|
-
/** called when clipboard is changed */
|
|
31
|
-
onClipboardChange: (clipboard: any) => void;
|
|
32
|
-
/** message to display if clipboard can't be pasted into current dashboard */
|
|
33
|
-
cantPasteMessage: string;
|
|
34
|
-
}): ReactNode;
|
|
38
|
+
renderLayout(options: RenderLayoutOptions): ReactNode;
|
|
35
39
|
/** Tests if dashboard has any items */
|
|
36
40
|
isEmpty(items: any): boolean;
|
|
37
41
|
/** Gets { type, design } of a widget */
|
|
@@ -19,17 +19,11 @@ class LayoutManager {
|
|
|
19
19
|
return [];
|
|
20
20
|
}
|
|
21
21
|
static createLayoutManager(type) {
|
|
22
|
-
|
|
23
|
-
type = type || "grid";
|
|
22
|
+
type = type || "blocks";
|
|
24
23
|
switch (type) {
|
|
25
|
-
case "
|
|
26
|
-
var GridLayoutManager = require("./grid/GridLayoutManager").default;
|
|
27
|
-
return new GridLayoutManager();
|
|
28
|
-
break;
|
|
29
|
-
case "blocks": // New one
|
|
24
|
+
case "blocks":
|
|
30
25
|
var BlocksLayoutManager = require("./blocks/BlocksLayoutManager").default;
|
|
31
26
|
return new BlocksLayoutManager();
|
|
32
|
-
break;
|
|
33
27
|
default:
|
|
34
28
|
throw new Error(`Unknown layout manager type ${type}`);
|
|
35
29
|
}
|
|
@@ -1,76 +1,45 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import HorizontalBlockComponent from "./HorizontalBlockComponent";
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import { DashboardTheme } from "../../dashboards/layoutOptions";
|
|
4
3
|
import { LayoutBlock } from "./blockUtils";
|
|
4
|
+
import { RenderWidgetOptions } from "../LayoutManager";
|
|
5
5
|
export interface BlocksDisplayComponentProps {
|
|
6
6
|
items: LayoutBlock;
|
|
7
7
|
onItemsChange?: (items: LayoutBlock) => void;
|
|
8
8
|
/** Stylesheet to use. null for default */
|
|
9
|
-
style?:
|
|
9
|
+
style?: DashboardTheme;
|
|
10
10
|
/** layout options to use */
|
|
11
11
|
layoutOptions?: any;
|
|
12
12
|
/** Renders a widget. Passed (options) */
|
|
13
|
-
renderWidget:
|
|
13
|
+
renderWidget: (options: RenderWidgetOptions) => ReactElement;
|
|
14
14
|
/** True to prevent maps */
|
|
15
15
|
disableMaps?: boolean;
|
|
16
|
-
/**
|
|
16
|
+
/** clipboard contents */
|
|
17
17
|
clipboard?: any;
|
|
18
|
-
onClipboardChange
|
|
18
|
+
/** Including onClipboardChange adds a clipboard palette item that can be used to copy and paste widgets */
|
|
19
|
+
onClipboardChange?: (clipboard: any) => void;
|
|
20
|
+
/** message to display if clipboard can't be pasted into current dashboard */
|
|
19
21
|
cantPasteMessage?: string;
|
|
20
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
Renders the complete layout of the blocks and also optionally a palette to the left
|
|
25
|
+
that can be used to drag new items into the layout. Palette is only displayed if onItemsChange is not null
|
|
26
|
+
*/
|
|
21
27
|
declare class BlocksDisplayComponent extends React.Component<BlocksDisplayComponentProps> {
|
|
22
|
-
handleBlockDrop: (sourceBlock:
|
|
23
|
-
handleBlockRemove: (block:
|
|
24
|
-
handleBlockUpdate: (block:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
handleBlockDrop: (sourceBlock: LayoutBlock, targetBlock: LayoutBlock, side: "top" | "left" | "right" | "bottom") => void;
|
|
29
|
+
handleBlockRemove: (block: LayoutBlock) => void;
|
|
30
|
+
handleBlockUpdate: (block: LayoutBlock) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Render a single block (and its children)
|
|
33
|
+
* @param block Block to render
|
|
34
|
+
* @param collapseColumns True to collapse columns
|
|
35
|
+
* @param priority Priority of widget. Higher priority widgets are rendered first
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
renderBlock: (block: LayoutBlock, collapseColumns: boolean, priority: number) => ReactElement;
|
|
29
39
|
createBlockItem(block: any): () => {
|
|
30
40
|
block: {};
|
|
31
41
|
};
|
|
32
|
-
renderPalette(): React.
|
|
33
|
-
|
|
34
|
-
style: {
|
|
35
|
-
width: number;
|
|
36
|
-
height: string;
|
|
37
|
-
position: "absolute";
|
|
38
|
-
top: number;
|
|
39
|
-
left: number;
|
|
40
|
-
};
|
|
41
|
-
}, HTMLElement>;
|
|
42
|
-
render(): React.CElement<import("@mwater/react-library/lib/AutoSizeComponent").AutoSizeComponentProps, AutoSizeComponent> | React.DetailedReactHTMLElement<{
|
|
43
|
-
style: {
|
|
44
|
-
width: string;
|
|
45
|
-
height: string;
|
|
46
|
-
overflow: "hidden";
|
|
47
|
-
position: "relative";
|
|
48
|
-
};
|
|
49
|
-
}, HTMLElement>;
|
|
42
|
+
renderPalette(): React.JSX.Element;
|
|
43
|
+
render(): React.JSX.Element;
|
|
50
44
|
}
|
|
51
45
|
export default BlocksDisplayComponent;
|
|
52
|
-
interface RootBlockComponentProps {
|
|
53
|
-
block: any;
|
|
54
|
-
collapseColumns?: boolean;
|
|
55
|
-
renderBlock: any;
|
|
56
|
-
/** Called with (sourceBlock, targetBlock, side) when block is dropped on it. side is top, left, bottom, right */
|
|
57
|
-
onBlockDrop?: any;
|
|
58
|
-
onBlockRemove?: any;
|
|
59
|
-
}
|
|
60
|
-
declare class RootBlockComponent extends React.Component<RootBlockComponentProps> {
|
|
61
|
-
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | React.CElement<{
|
|
62
|
-
block: any;
|
|
63
|
-
onBlockDrop: any;
|
|
64
|
-
style: {
|
|
65
|
-
height: string;
|
|
66
|
-
};
|
|
67
|
-
onlyBottom: boolean;
|
|
68
|
-
}, React.Component<{
|
|
69
|
-
block: any;
|
|
70
|
-
onBlockDrop: any;
|
|
71
|
-
style: {
|
|
72
|
-
height: string;
|
|
73
|
-
};
|
|
74
|
-
onlyBottom: boolean;
|
|
75
|
-
}, any, any>>;
|
|
76
|
-
}
|