@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
|
@@ -8,24 +8,15 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const R = react_1.default.createElement;
|
|
9
9
|
const uuid_1 = __importDefault(require("uuid"));
|
|
10
10
|
const LayoutManager_1 = __importDefault(require("../LayoutManager"));
|
|
11
|
+
const BlocksDisplayComponent_1 = __importDefault(require("./BlocksDisplayComponent"));
|
|
11
12
|
class BlocksLayoutManager extends LayoutManager_1.default {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// onItemsChange: Called when items changes
|
|
16
|
-
// renderWidget: called with ({ id:, type:, design:, onDesignChange:, width:, height: })
|
|
17
|
-
// style: style to use for layout. null for default
|
|
18
|
-
// layoutOptions: layout options to use
|
|
19
|
-
// disableMaps: true to disable maps
|
|
20
|
-
// clipboard: clipboard contents
|
|
21
|
-
// onClipboardChange: called when clipboard is changed
|
|
22
|
-
// cantPasteMesssage: message to display if clipboard can't be pasted into current dashboard
|
|
13
|
+
/**
|
|
14
|
+
* Renders the layout as a react element
|
|
15
|
+
*/
|
|
23
16
|
renderLayout(options) {
|
|
24
|
-
|
|
25
|
-
return R(BlocksDisplayComponent, {
|
|
17
|
+
return R(BlocksDisplayComponent_1.default, {
|
|
26
18
|
items: options.items || { id: "root", type: "root", blocks: [] },
|
|
27
19
|
onItemsChange: options.onItemsChange,
|
|
28
|
-
style: options.style,
|
|
29
20
|
layoutOptions: options.layoutOptions,
|
|
30
21
|
renderWidget: options.renderWidget,
|
|
31
22
|
disableMaps: options.disableMaps,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
2
|
import { LayoutBlock } from "./blockUtils";
|
|
3
3
|
export interface HorizontalBlockComponentProps {
|
|
4
4
|
block: LayoutBlock;
|
|
5
|
-
collapseColumns
|
|
6
|
-
|
|
5
|
+
collapseColumns: boolean;
|
|
6
|
+
priority: number;
|
|
7
|
+
renderBlock: (block: LayoutBlock, collapseColumns: boolean, priority: number) => ReactElement;
|
|
7
8
|
/** Called with (sourceBlock, targetBlock, side) when block is dropped on it. side is top, left, bottom, right */
|
|
8
9
|
onBlockDrop?: any;
|
|
9
10
|
/** Called with (block) when block is removed */
|
|
@@ -21,7 +22,7 @@ export default class HorizontalBlockComponent extends React.Component<Horizontal
|
|
|
21
22
|
blockRefs: {
|
|
22
23
|
[blockId: string]: HTMLElement | null;
|
|
23
24
|
};
|
|
24
|
-
constructor(props:
|
|
25
|
+
constructor(props: HorizontalBlockComponentProps);
|
|
25
26
|
componentWillUnmount(): void;
|
|
26
27
|
handleMouseDown: (index: any, ev: any) => void;
|
|
27
28
|
handleMouseMove: (ev: any) => void;
|
|
@@ -23,7 +23,7 @@ class HorizontalBlockComponent extends react_1.default.Component {
|
|
|
23
23
|
componentWillUnmount() {
|
|
24
24
|
// Remove listeners
|
|
25
25
|
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
26
|
-
|
|
26
|
+
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
27
27
|
}
|
|
28
28
|
handleMouseDown = (index, ev) => {
|
|
29
29
|
// Prevent html5 drag
|
|
@@ -35,7 +35,7 @@ class HorizontalBlockComponent extends react_1.default.Component {
|
|
|
35
35
|
rightSize: this.blockRefs[`block${index + 1}`].offsetWidth
|
|
36
36
|
});
|
|
37
37
|
document.addEventListener("mousemove", this.handleMouseMove);
|
|
38
|
-
|
|
38
|
+
document.addEventListener("mouseup", this.handleMouseUp);
|
|
39
39
|
};
|
|
40
40
|
handleMouseMove = (ev) => {
|
|
41
41
|
if (!this.state.dragInitialX) {
|
|
@@ -76,7 +76,7 @@ class HorizontalBlockComponent extends react_1.default.Component {
|
|
|
76
76
|
let asc, end;
|
|
77
77
|
let asc1, end1;
|
|
78
78
|
if (this.props.collapseColumns) {
|
|
79
|
-
return R("div", null, lodash_1.default.map(this.props.block.blocks, (block
|
|
79
|
+
return R("div", null, lodash_1.default.map(this.props.block.blocks, (block) => this.props.renderBlock(block, true, this.props.priority)));
|
|
80
80
|
}
|
|
81
81
|
// Calculate widths (percentages)
|
|
82
82
|
let totalWeight = 0;
|
|
@@ -110,7 +110,7 @@ class HorizontalBlockComponent extends react_1.default.Component {
|
|
|
110
110
|
ref: (c) => {
|
|
111
111
|
return (this.blockRefs[`block${index}`] = c);
|
|
112
112
|
}
|
|
113
|
-
}, this.props.renderBlock(block))
|
|
113
|
+
}, this.props.renderBlock(block, false, this.props.priority))
|
|
114
114
|
];
|
|
115
115
|
}))));
|
|
116
116
|
// Allow dropping
|
|
@@ -131,7 +131,7 @@ class HorizontalBlockComponent extends react_1.default.Component {
|
|
|
131
131
|
return (this.blockRefs[`block${index}`] = c);
|
|
132
132
|
},
|
|
133
133
|
className: "mwater-visualization-horizontal-block-item"
|
|
134
|
-
}, this.props.renderBlock(block))
|
|
134
|
+
}, this.props.renderBlock(block, false, this.props.priority))
|
|
135
135
|
];
|
|
136
136
|
}));
|
|
137
137
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import LayoutManager from "../LayoutManager";
|
|
3
|
+
import AutoSizeComponent from "@mwater/react-library/lib/AutoSizeComponent";
|
|
3
4
|
export default class GridLayoutManager extends LayoutManager {
|
|
4
5
|
renderPalette(width: any): React.DetailedReactHTMLElement<{
|
|
5
6
|
className: string;
|
|
@@ -11,7 +12,7 @@ export default class GridLayoutManager extends LayoutManager {
|
|
|
11
12
|
width: number;
|
|
12
13
|
};
|
|
13
14
|
}, HTMLElement>;
|
|
14
|
-
renderLayout(options: any): React.CElement<
|
|
15
|
+
renderLayout(options: any): React.CElement<import("@mwater/react-library/lib/AutoSizeComponent").AutoSizeComponentProps, AutoSizeComponent>;
|
|
15
16
|
isEmpty(items: any): boolean;
|
|
16
17
|
getWidgetTypeAndDesign(items: any, widgetId: any): any;
|
|
17
18
|
getAllWidgets(items: any): {
|
package/lib/mWaterLoader.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface MWaterLoaderOptions {
|
|
|
14
14
|
localCaching?: boolean;
|
|
15
15
|
/** Locales of the schema to load. Default is all. */
|
|
16
16
|
locales?: string[];
|
|
17
|
+
/** Origin of usage. e.g. "dashboards:43445364..." */
|
|
18
|
+
origin?: string;
|
|
17
19
|
}
|
|
18
20
|
/** Loads a schema and data source that is specific to mWater server */
|
|
19
21
|
export default function mWaterLoader(options: MWaterLoaderOptions, callback: (error: any, config?: {
|
package/lib/mWaterLoader.js
CHANGED
|
@@ -42,7 +42,8 @@ function mWaterLoader(options, callback) {
|
|
|
42
42
|
const schema = new expressions_1.Schema(schemaJson);
|
|
43
43
|
const dataSource = new MWaterDataSource_1.default(options.apiUrl, options.client, {
|
|
44
44
|
serverCaching: false,
|
|
45
|
-
localCaching: options.localCaching != null ? options.localCaching : true
|
|
45
|
+
localCaching: options.localCaching != null ? options.localCaching : true,
|
|
46
|
+
origin: options.origin
|
|
46
47
|
});
|
|
47
48
|
return callback(null, {
|
|
48
49
|
schema,
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
|
+
import { MapDesign } from "..";
|
|
4
4
|
export interface AddLayerComponentProps {
|
|
5
5
|
/** Number of layers that already exist */
|
|
6
6
|
layerNumber: number;
|
|
7
7
|
/** See Map Design.md */
|
|
8
|
-
design:
|
|
8
|
+
design: MapDesign;
|
|
9
9
|
/** Called with new design */
|
|
10
|
-
onDesignChange:
|
|
10
|
+
onDesignChange: (design: MapDesign) => void;
|
|
11
11
|
/** Schema to use */
|
|
12
12
|
schema: Schema;
|
|
13
13
|
dataSource: DataSource;
|
|
14
14
|
}
|
|
15
15
|
export default class AddLayerComponent extends React.Component<AddLayerComponentProps> {
|
|
16
|
-
static
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
handleAddLayer: (newLayer: any) => any;
|
|
20
|
-
handleAddLayerView: (layerView: any) => any;
|
|
16
|
+
static contextType: React.Context<import("../MWaterContextComponent").AddLayerElementFactory | undefined>;
|
|
17
|
+
handleAddLayer: (newLayer: any) => void;
|
|
18
|
+
handleAddLayerView: (layerView: any) => void;
|
|
21
19
|
render(): any;
|
|
22
20
|
}
|
|
@@ -3,16 +3,16 @@ 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 prop_types_1 = __importDefault(require("prop-types"));
|
|
7
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const react_1 = __importDefault(require("react"));
|
|
9
8
|
const R = react_1.default.createElement;
|
|
10
9
|
const uuid_1 = __importDefault(require("uuid"));
|
|
11
10
|
const LayerFactory_1 = __importDefault(require("./LayerFactory"));
|
|
11
|
+
const MWaterContextComponent_1 = require("../MWaterContextComponent");
|
|
12
12
|
// Dropdown to add a new layer.
|
|
13
13
|
// Can be overridden by context of addLayerElementFactory which is called with all props
|
|
14
14
|
class AddLayerComponent extends react_1.default.Component {
|
|
15
|
-
static
|
|
15
|
+
static contextType = MWaterContextComponent_1.AddLayerElementFactoryContext;
|
|
16
16
|
handleAddLayer = (newLayer) => {
|
|
17
17
|
const layerView = {
|
|
18
18
|
id: (0, uuid_1.default)(),
|
|
@@ -32,12 +32,12 @@ class AddLayerComponent extends react_1.default.Component {
|
|
|
32
32
|
// Add to list
|
|
33
33
|
const layerViews = this.props.design.layerViews.slice();
|
|
34
34
|
layerViews.push(layerView);
|
|
35
|
-
const design =
|
|
36
|
-
|
|
35
|
+
const design = { ...this.props.design, layerViews };
|
|
36
|
+
this.props.onDesignChange(design);
|
|
37
37
|
};
|
|
38
38
|
render() {
|
|
39
|
-
if (this.context
|
|
40
|
-
return this.context
|
|
39
|
+
if (this.context) {
|
|
40
|
+
return this.context(this.props);
|
|
41
41
|
}
|
|
42
42
|
const newLayers = [
|
|
43
43
|
{
|
package/lib/maps/BingLayer.js
CHANGED
|
@@ -67,34 +67,24 @@ module.exports = leaflet_1.default.TileLayer.extend({
|
|
|
67
67
|
},
|
|
68
68
|
loadMetadata: function () {
|
|
69
69
|
var _this = this;
|
|
70
|
-
var
|
|
71
|
-
|
|
70
|
+
var url = `https://dev.virtualearth.net/REST/v1/Imagery/Metadata/${this.options.type}?include=ImageryProviders&key=${this._key}&UriScheme=https`;
|
|
71
|
+
fetch(url)
|
|
72
|
+
.then(response => response.json())
|
|
73
|
+
.then(meta => {
|
|
72
74
|
_this.meta = meta;
|
|
73
|
-
window[cbid] = undefined;
|
|
74
|
-
var e = document.getElementById(cbid);
|
|
75
|
-
e.parentNode.removeChild(e);
|
|
76
75
|
if (meta.errorDetails) {
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
78
|
_this.initMetadata();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
"//dev.virtualearth.net/REST/v1/Imagery/Metadata/" +
|
|
83
|
-
this.options.type +
|
|
84
|
-
"?include=ImageryProviders&jsonp=" +
|
|
85
|
-
cbid +
|
|
86
|
-
"&key=" +
|
|
87
|
-
this._key +
|
|
88
|
-
"&UriScheme=" +
|
|
89
|
-
document.location.protocol.slice(0, -1);
|
|
90
|
-
var script = document.createElement("script");
|
|
91
|
-
script.type = "text/javascript";
|
|
92
|
-
script.src = url;
|
|
93
|
-
script.id = cbid;
|
|
94
|
-
document.getElementsByTagName("head")[0].appendChild(script);
|
|
79
|
+
})
|
|
80
|
+
.catch(error => console.error('Error loading Bing Maps metadata:', error));
|
|
95
81
|
},
|
|
96
82
|
initMetadata: function () {
|
|
97
83
|
var r = this.meta.resourceSets[0].resources[0];
|
|
84
|
+
if (!r) {
|
|
85
|
+
console.error("Error loading Bing Maps metadata");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
98
88
|
this.options.subdomains = r.imageUrlSubdomains;
|
|
99
89
|
this._url = r.imageUrl;
|
|
100
90
|
this._providers = [];
|
package/lib/maps/BufferLayer.js
CHANGED
|
@@ -36,6 +36,7 @@ const mapboxUtils_1 = require("./mapboxUtils");
|
|
|
36
36
|
const LayerLegendComponent_1 = __importDefault(require("./LayerLegendComponent"));
|
|
37
37
|
const PopupFilterJoinsUtils = __importStar(require("./PopupFilterJoinsUtils"));
|
|
38
38
|
const HoverContent_1 = __importDefault(require("./HoverContent"));
|
|
39
|
+
const layoutOptions_1 = require("../dashboards/layoutOptions");
|
|
39
40
|
/*
|
|
40
41
|
Layer which draws a buffer around geometries (i.e. a radius circle around points)
|
|
41
42
|
|
|
@@ -96,7 +97,9 @@ class BufferLayer extends Layer_1.default {
|
|
|
96
97
|
sourceLayers: [{ id: "circles", jsonql: jsonql }],
|
|
97
98
|
ctes: [],
|
|
98
99
|
mapLayers: mapLayers,
|
|
99
|
-
mapLayersHandleClicks: [`${sourceId}:fill`]
|
|
100
|
+
mapLayersHandleClicks: [`${sourceId}:fill`],
|
|
101
|
+
minZoom: this.getMinZoom(design),
|
|
102
|
+
maxZoom: this.getMaxZoom(design)
|
|
100
103
|
};
|
|
101
104
|
}
|
|
102
105
|
createJsonQL(design, schema, filters) {
|
|
@@ -608,7 +611,7 @@ marker-fill: ` +
|
|
|
608
611
|
const WidgetFactory = require("../widgets/WidgetFactory").default;
|
|
609
612
|
results.popup = new BlocksLayoutManager().renderLayout({
|
|
610
613
|
items: clickOptions.design.popup.items,
|
|
611
|
-
|
|
614
|
+
layoutOptions: (0, layoutOptions_1.getDefaultLayoutOptions)("default"),
|
|
612
615
|
renderWidget: (options) => {
|
|
613
616
|
const widget = WidgetFactory.createWidget(options.type);
|
|
614
617
|
const filters = clickOptions.filters.concat(popupFilters);
|
|
@@ -36,6 +36,7 @@ const mapboxUtils_1 = require("./mapboxUtils");
|
|
|
36
36
|
const LayerLegendComponent_1 = __importDefault(require("./LayerLegendComponent"));
|
|
37
37
|
const PopupFilterJoinsUtils = __importStar(require("./PopupFilterJoinsUtils"));
|
|
38
38
|
const HoverContent_1 = __importDefault(require("./HoverContent"));
|
|
39
|
+
const layoutOptions_1 = require("../dashboards/layoutOptions");
|
|
39
40
|
class ChoroplethLayer extends Layer_1.default {
|
|
40
41
|
/** Gets the type of layer definition */
|
|
41
42
|
getLayerDefinitionType() {
|
|
@@ -1213,7 +1214,7 @@ class ChoroplethLayer extends Layer_1.default {
|
|
|
1213
1214
|
const WidgetFactory = require("../widgets/WidgetFactory").default;
|
|
1214
1215
|
results.popup = new BlocksLayoutManager().renderLayout({
|
|
1215
1216
|
items: clickOptions.design.popup.items,
|
|
1216
|
-
|
|
1217
|
+
layoutOptions: (0, layoutOptions_1.getDefaultLayoutOptions)("default"),
|
|
1217
1218
|
renderWidget: (options) => {
|
|
1218
1219
|
const widget = WidgetFactory.createWidget(options.type);
|
|
1219
1220
|
// Create filters for single row
|
package/lib/maps/ClusterLayer.js
CHANGED
|
@@ -90,7 +90,9 @@ class ClusterLayer extends Layer_1.default {
|
|
|
90
90
|
sourceLayers: [{ id: "clusters", jsonql: jsonql }],
|
|
91
91
|
ctes: [],
|
|
92
92
|
mapLayers: mapLayers,
|
|
93
|
-
mapLayersHandleClicks: [`${sourceId}:circles-single`, `${sourceId}:circles-multiple`]
|
|
93
|
+
mapLayersHandleClicks: [`${sourceId}:circles-single`, `${sourceId}:circles-multiple`],
|
|
94
|
+
minZoom: this.getMinZoom(design),
|
|
95
|
+
maxZoom: this.getMaxZoom(design)
|
|
94
96
|
};
|
|
95
97
|
}
|
|
96
98
|
createJsonQL(design, schema, filters) {
|
|
@@ -4,7 +4,7 @@ import { MapDesign } from "./MapDesign";
|
|
|
4
4
|
import { MapDataSource } from "./MapDataSource";
|
|
5
5
|
import { VectorTileCTE, VectorTileSourceLayer } from "./Layer";
|
|
6
6
|
import { MapLayerDataSource } from "./MapLayerDataSource";
|
|
7
|
-
interface DirectMapDataSourceOptions {
|
|
7
|
+
export interface DirectMapDataSourceOptions {
|
|
8
8
|
/** schema to use */
|
|
9
9
|
schema: Schema;
|
|
10
10
|
/** general data source */
|
|
@@ -15,6 +15,8 @@ interface DirectMapDataSourceOptions {
|
|
|
15
15
|
apiUrl: string;
|
|
16
16
|
/** client id to use for talking to mWater server */
|
|
17
17
|
client?: string;
|
|
18
|
+
/** Origin to which server time is recorded e.g. maps:232434... */
|
|
19
|
+
origin?: string;
|
|
18
20
|
}
|
|
19
21
|
export default class DirectMapDataSource implements MapDataSource {
|
|
20
22
|
options: DirectMapDataSourceOptions;
|
|
@@ -49,6 +51,8 @@ export interface VectorTileDirectTokenRequest {
|
|
|
49
51
|
minZoom?: number;
|
|
50
52
|
/** Enforced maximum zoom level */
|
|
51
53
|
maxZoom?: number;
|
|
54
|
+
/** Origin to which server time is recorded */
|
|
55
|
+
origin?: string;
|
|
52
56
|
}
|
|
53
57
|
/**
|
|
54
58
|
* React hook to get a direct URL for a vector tile source.
|
|
@@ -65,4 +69,3 @@ export declare function useDirectVectorTileUrl(options: {
|
|
|
65
69
|
/** Request to make for tiles */
|
|
66
70
|
directTokenRequest: VectorTileDirectTokenRequest;
|
|
67
71
|
}): string | null;
|
|
68
|
-
export {};
|
|
@@ -152,7 +152,8 @@ class DirectLayerDataSource {
|
|
|
152
152
|
maxZoom: vectorTile.maxZoom,
|
|
153
153
|
createdAfter: createdAfter,
|
|
154
154
|
// 12 hours
|
|
155
|
-
expiresAfter: new Date(Date.now() + 1000 * 3600 * 12).toISOString()
|
|
155
|
+
expiresAfter: new Date(Date.now() + 1000 * 3600 * 12).toISOString(),
|
|
156
|
+
origin: this.options.origin
|
|
156
157
|
};
|
|
157
158
|
const { url, expires } = await getVectorTileFromDirectRequest({
|
|
158
159
|
apiUrl: this.options.apiUrl,
|
|
@@ -11,6 +11,7 @@ const BlocksLayoutManager_1 = __importDefault(require("../layouts/blocks/BlocksL
|
|
|
11
11
|
const WidgetFactory_1 = __importDefault(require("../widgets/WidgetFactory"));
|
|
12
12
|
const DirectWidgetDataSource_1 = __importDefault(require("../widgets/DirectWidgetDataSource"));
|
|
13
13
|
const PopupFilterJoinsEditComponent_1 = __importDefault(require("./PopupFilterJoinsEditComponent"));
|
|
14
|
+
const layoutOptions_1 = require("../dashboards/layoutOptions");
|
|
14
15
|
// Modal for editing design of popup
|
|
15
16
|
class EditPopupComponent extends react_1.default.Component {
|
|
16
17
|
constructor(props) {
|
|
@@ -44,7 +45,7 @@ class EditPopupComponent extends react_1.default.Component {
|
|
|
44
45
|
: undefined, this.state.editing
|
|
45
46
|
? R(ModalWindowComponent_1.default, { isOpen: true, onRequestClose: () => this.setState({ editing: false }) }, new BlocksLayoutManager_1.default().renderLayout({
|
|
46
47
|
items: this.props.design.popup?.items,
|
|
47
|
-
|
|
48
|
+
layoutOptions: (0, layoutOptions_1.getDefaultLayoutOptions)("default"),
|
|
48
49
|
onItemsChange: this.handleItemsChange,
|
|
49
50
|
disableMaps: true,
|
|
50
51
|
renderWidget: (options) => {
|
package/lib/maps/GridLayer.js
CHANGED
|
@@ -51,7 +51,9 @@ class GridLayer extends Layer_1.default {
|
|
|
51
51
|
sourceLayers: [{ id: "grid", jsonql: jsonql }],
|
|
52
52
|
ctes: [],
|
|
53
53
|
mapLayers: mapLayers,
|
|
54
|
-
mapLayersHandleClicks: [`${sourceId}:fill`]
|
|
54
|
+
mapLayersHandleClicks: [`${sourceId}:fill`],
|
|
55
|
+
minZoom: this.getMinZoom(design),
|
|
56
|
+
maxZoom: this.getMaxZoom(design)
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
59
|
createJsonQL(design, schema, filters) {
|
|
@@ -544,9 +546,9 @@ class GridLayer extends Layer_1.default {
|
|
|
544
546
|
// }
|
|
545
547
|
// Get min and max zoom levels
|
|
546
548
|
getMinZoom(design) {
|
|
547
|
-
// Determine if too zoomed out to safely display (
|
|
549
|
+
// Determine if too zoomed out to safely display (200x200, so size = 4e7/(2^zoom) < 200)
|
|
548
550
|
if (design.sizeUnits === "meters") {
|
|
549
|
-
const minSafeZoom = Math.log2(
|
|
551
|
+
const minSafeZoom = Math.log2(200000.0 / (design.size || 20000));
|
|
550
552
|
if (design.minZoom) {
|
|
551
553
|
return Math.max(design.minZoom, minSafeZoom);
|
|
552
554
|
}
|
|
@@ -72,7 +72,7 @@ function LayerSwitcherComponent(props) {
|
|
|
72
72
|
}) },
|
|
73
73
|
react_1.default.createElement("div", { style: iconStyle, onClick: toggleDropdown },
|
|
74
74
|
react_1.default.createElement("i", { className: "fas fa-layer-group fa-fw" })),
|
|
75
|
-
dropdownOpen ? (react_1.default.createElement("div", { style: { backgroundColor: "white", padding: 5 } }, props.design.layerViews.map(renderLayerView))) : null));
|
|
75
|
+
dropdownOpen ? (react_1.default.createElement("div", { style: { backgroundColor: "white", padding: 5, textAlign: "left" } }, props.design.layerViews.map(renderLayerView))) : null));
|
|
76
76
|
}
|
|
77
77
|
exports.LayerSwitcherComponent = LayerSwitcherComponent;
|
|
78
78
|
/** Hook for click outside catching */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React, { ReactNode } from "react";
|
|
2
|
+
import AutoSizeComponent from "@mwater/react-library/lib/AutoSizeComponent";
|
|
3
3
|
import UndoStack from "../UndoStack";
|
|
4
4
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
5
5
|
import { MapDataSource } from "./MapDataSource";
|
|
@@ -39,9 +39,7 @@ interface MapComponentState {
|
|
|
39
39
|
}
|
|
40
40
|
/** Map with designer on right */
|
|
41
41
|
export default class MapComponent extends React.Component<MapComponentProps, MapComponentState> {
|
|
42
|
-
static
|
|
43
|
-
locale: PropTypes.Requireable<string>;
|
|
44
|
-
};
|
|
42
|
+
static contextType: React.Context<string>;
|
|
45
43
|
constructor(props: MapComponentProps);
|
|
46
44
|
componentDidUpdate(prevProps: MapComponentProps): void;
|
|
47
45
|
handleUndo: () => void;
|
|
@@ -60,13 +58,7 @@ export default class MapComponent extends React.Component<MapComponentProps, Map
|
|
|
60
58
|
getDesign(): MapDesign;
|
|
61
59
|
handleToggleDesignPanel: () => void;
|
|
62
60
|
getQuickfilterValues: () => any[];
|
|
63
|
-
renderView(): React.CElement<
|
|
64
|
-
injectWidth: boolean;
|
|
65
|
-
injectHeight: boolean;
|
|
66
|
-
}, React.Component<{
|
|
67
|
-
injectWidth: boolean;
|
|
68
|
-
injectHeight: boolean;
|
|
69
|
-
}, any, any>>;
|
|
61
|
+
renderView(): React.CElement<import("@mwater/react-library/lib/AutoSizeComponent").AutoSizeComponentProps, AutoSizeComponent>;
|
|
70
62
|
getCompiledFilters(): {
|
|
71
63
|
table: string;
|
|
72
64
|
jsonql: import("@mwater/jsonql").JsonQLExpr;
|
package/lib/maps/MapComponent.js
CHANGED
|
@@ -3,7 +3,6 @@ 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 prop_types_1 = __importDefault(require("prop-types"));
|
|
7
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const react_1 = __importDefault(require("react"));
|
|
9
8
|
const R = react_1.default.createElement;
|
|
@@ -16,9 +15,10 @@ const PopoverHelpComponent_1 = __importDefault(require("@mwater/react-library/li
|
|
|
16
15
|
const QuickfilterCompiler_1 = __importDefault(require("../quickfilter/QuickfilterCompiler"));
|
|
17
16
|
const QuickfiltersComponent_1 = __importDefault(require("../quickfilter/QuickfiltersComponent"));
|
|
18
17
|
const MapUtils_1 = require("./MapUtils");
|
|
18
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
19
19
|
/** Map with designer on right */
|
|
20
20
|
class MapComponent extends react_1.default.Component {
|
|
21
|
-
static
|
|
21
|
+
static contextType = contexts_1.LocaleContext;
|
|
22
22
|
constructor(props) {
|
|
23
23
|
super(props);
|
|
24
24
|
this.state = {
|
|
@@ -125,7 +125,7 @@ class MapComponent extends react_1.default.Component {
|
|
|
125
125
|
zoomLocked: this.state.zoomLocked,
|
|
126
126
|
onRowClick: this.props.onRowClick,
|
|
127
127
|
extraFilters: filters,
|
|
128
|
-
locale: this.context
|
|
128
|
+
locale: this.context,
|
|
129
129
|
width: size.width,
|
|
130
130
|
height: size.height
|
|
131
131
|
});
|
package/lib/maps/MapDesign.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Expr
|
|
1
|
+
import { Expr } from "@mwater/expressions";
|
|
2
2
|
import { Quickfilter } from "../quickfilter/Quickfilter";
|
|
3
|
+
import { GlobalFilter } from "../GlobalFilter";
|
|
3
4
|
/** Maps are stored as a base layer, a series of layers and filters. */
|
|
4
5
|
export interface MapDesign {
|
|
5
6
|
/** "bing_road"/"bing_aerial"/"cartodb_positron"/"cartodb_dark_matter"/"blank" */
|
|
@@ -63,15 +64,3 @@ export interface MapLayerView {
|
|
|
63
64
|
/** true to hide legend */
|
|
64
65
|
hideLegend?: boolean;
|
|
65
66
|
}
|
|
66
|
-
/** Global filters apply to multiple tables at once if a certain column is present. User-interface to set them is application-specific
|
|
67
|
-
and the default (non-mWater) dashboard applies them but does not allow editing. */
|
|
68
|
-
export interface GlobalFilter {
|
|
69
|
-
/** id of column to filter */
|
|
70
|
-
columnId: string;
|
|
71
|
-
/** type of column to filter (to ensure that consistent) */
|
|
72
|
-
columnType: LiteralType;
|
|
73
|
-
/** op of expression for filtering */
|
|
74
|
-
op: string;
|
|
75
|
-
/** array of expressions to use for filtering. field expression for column will be injected as expression 0 in the resulting filter expression */
|
|
76
|
-
exprs: Expr[];
|
|
77
|
-
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
4
3
|
export interface MapFiltersDesignerComponentProps {
|
|
@@ -12,9 +11,6 @@ export interface MapFiltersDesignerComponentProps {
|
|
|
12
11
|
onDesignChange: any;
|
|
13
12
|
}
|
|
14
13
|
export default class MapFiltersDesignerComponent extends React.Component<MapFiltersDesignerComponentProps> {
|
|
15
|
-
static contextTypes: {
|
|
16
|
-
globalFiltersElementFactory: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
-
};
|
|
18
14
|
handleFiltersChange: (filters: any) => any;
|
|
19
15
|
handleGlobalFiltersChange: (globalFilters: any) => any;
|
|
20
16
|
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | null;
|
|
@@ -27,15 +27,14 @@ 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 PopoverHelpComponent_1 = __importDefault(require("@mwater/react-library/lib/PopoverHelpComponent"));
|
|
34
33
|
const FiltersDesignerComponent_1 = __importDefault(require("../FiltersDesignerComponent"));
|
|
35
34
|
const MapUtils = __importStar(require("./MapUtils"));
|
|
35
|
+
const MWaterContextComponent_1 = require("../MWaterContextComponent");
|
|
36
36
|
// Designer for filters for a map
|
|
37
37
|
class MapFiltersDesignerComponent extends react_1.default.Component {
|
|
38
|
-
static contextTypes = { globalFiltersElementFactory: prop_types_1.default.func };
|
|
39
38
|
handleFiltersChange = (filters) => {
|
|
40
39
|
const design = lodash_1.default.extend({}, this.props.design, { filters });
|
|
41
40
|
return this.props.onDesignChange(design);
|
|
@@ -56,15 +55,15 @@ class MapFiltersDesignerComponent extends react_1.default.Component {
|
|
|
56
55
|
filters: this.props.design.filters,
|
|
57
56
|
onFiltersChange: this.handleFiltersChange,
|
|
58
57
|
filterableTables
|
|
59
|
-
}))),
|
|
60
|
-
? R("div", { className: "mb-3" }, R("label", { className: "text-muted" }, "Global Filters "), R("div", { style: { margin: 5 } },
|
|
58
|
+
}))), react_1.default.createElement(MWaterContextComponent_1.GlobalFiltersElementFactoryContext.Consumer, null, globalFiltersElementFactory => globalFiltersElementFactory
|
|
59
|
+
? R("div", { className: "mb-3" }, R("label", { className: "text-muted" }, "Global Filters "), R("div", { style: { margin: 5 } }, globalFiltersElementFactory({
|
|
61
60
|
schema: this.props.schema,
|
|
62
61
|
dataSource: this.props.dataSource,
|
|
63
62
|
filterableTables,
|
|
64
63
|
globalFilters: this.props.design.globalFilters || [],
|
|
65
64
|
onChange: this.handleGlobalFiltersChange
|
|
66
65
|
})))
|
|
67
|
-
: undefined);
|
|
66
|
+
: undefined));
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
exports.default = MapFiltersDesignerComponent;
|