@mwater/visualization 5.4.1 → 5.4.3
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.js +2 -1
- package/lib/IdSelection.d.ts +16 -0
- package/lib/IdSelection.js +59 -0
- package/lib/MWaterAddRelatedIndicatorComponent.js +2 -2
- package/lib/MWaterCompleteTableSelectComponent.d.ts +3 -8
- package/lib/MWaterCompleteTableSelectComponent.js +36 -42
- package/lib/MWaterLoaderComponent.d.ts +11 -10
- package/lib/MWaterLoaderComponent.js +1 -1
- package/lib/MWaterResponsesFilterComponent.js +1 -1
- package/lib/MWaterTableSelectComponent.d.ts +0 -1
- package/lib/MWaterTableSelectComponent.js +4 -6
- package/lib/autotranslate.d.ts +20 -0
- package/lib/autotranslate.js +122 -0
- package/lib/axes/AxisBuilder.js +3 -3
- package/lib/axes/AxisColorEditorComponent.js +4 -0
- package/lib/axes/AxisComponent.d.ts +8 -12
- package/lib/axes/AxisComponent.js +32 -80
- package/lib/axes/CategoryMapComponent.js +4 -4
- package/lib/axes/RangesComponent.js +2 -2
- package/lib/dashboards/DashboardComponent.d.ts +12 -20
- package/lib/dashboards/DashboardComponent.js +109 -69
- package/lib/dashboards/DashboardDesign.d.ts +11 -2
- package/lib/dashboards/DashboardUtils.d.ts +5 -0
- package/lib/dashboards/DashboardUtils.js +30 -0
- package/lib/dashboards/DashboardViewComponent.d.ts +2 -0
- package/lib/dashboards/DashboardViewComponent.js +16 -3
- package/lib/dashboards/ServerDashboardDataSource.js +2 -1
- package/lib/dashboards/SettingsModalComponent.d.ts +1 -1
- package/lib/dashboards/SettingsModalComponent.js +256 -19
- package/lib/dashboards/WidgetComponent.d.ts +6 -3
- package/lib/dashboards/WidgetComponent.js +3 -1
- package/lib/datagrids/CellEditor.d.ts +19 -0
- package/lib/datagrids/CellEditor.js +223 -0
- package/lib/datagrids/DatagridComponent.d.ts +18 -87
- package/lib/datagrids/DatagridComponent.js +304 -222
- package/lib/datagrids/DatagridViewComponent.d.ts +15 -53
- package/lib/datagrids/DatagridViewComponent.js +256 -257
- package/lib/datagrids/DirectDatagridDataSource.js +2 -3
- package/lib/datagrids/ExprCellComponent.d.ts +8 -15
- package/lib/datagrids/ExprCellComponent.js +11 -15
- package/lib/datagrids/FindReplaceModalComponent.d.ts +4 -6
- package/lib/datagrids/FindReplaceModalComponent.js +38 -75
- package/lib/index.css +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/languages.js +6 -1
- package/lib/layouts/blocks/HorizontalBlockComponent.js +2 -2
- package/lib/mWaterLoader.d.ts +1 -1
- package/lib/maps/BufferLayer.d.ts +7 -5
- package/lib/maps/BufferLayer.js +69 -48
- package/lib/maps/BufferLayerDesign.d.ts +21 -14
- package/lib/maps/BufferLayerDesignerComponent.d.ts +16 -31
- package/lib/maps/BufferLayerDesignerComponent.js +68 -102
- package/lib/maps/ChoroplethLayer.d.ts +5 -4
- package/lib/maps/ChoroplethLayer.js +32 -9
- package/lib/maps/ChoroplethLayerDesign.d.ts +6 -2
- package/lib/maps/ChoroplethLayerDesigner.js +4 -2
- package/lib/maps/ClusterLayer.d.ts +3 -4
- package/lib/maps/ClusterLayer.js +2 -1
- package/lib/maps/DetailLevelSelectComponent.js +1 -1
- package/lib/maps/DirectMapDataSource.js +2 -1
- package/lib/maps/EditPopupComponent.js +5 -3
- package/lib/maps/GridLayer.d.ts +3 -4
- package/lib/maps/GridLayer.js +2 -1
- package/lib/maps/GridLayerDesigner.js +5 -3
- package/lib/maps/HoverContent.d.ts +11 -3
- package/lib/maps/HoverContent.js +25 -9
- package/lib/maps/Layer.d.ts +24 -3
- package/lib/maps/Layer.js +5 -1
- package/lib/maps/LayerFactory.js +0 -8
- package/lib/maps/LayerLegendComponent.js +0 -1
- package/lib/maps/LayerSwitcherComponent.d.ts +1 -0
- package/lib/maps/LayerSwitcherComponent.js +1 -1
- package/lib/maps/LeafletMapComponent.js +3 -1
- package/lib/maps/LegendComponent.d.ts +1 -0
- package/lib/maps/LegendComponent.js +9 -1
- package/lib/maps/MWaterServerLayer.d.ts +2 -2
- package/lib/maps/MWaterServerLayer.js +2 -2
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MapDesign.d.ts +2 -0
- package/lib/maps/MapDesignerComponent.d.ts +4 -3
- package/lib/maps/MapDesignerComponent.js +68 -74
- package/lib/maps/MapLayerViewDesignerComponent.js +2 -2
- package/lib/maps/MapUtils.d.ts +4 -0
- package/lib/maps/MapUtils.js +19 -0
- package/lib/maps/MapViewComponent.d.ts +8 -3
- package/lib/maps/MarkersLayer.d.ts +5 -4
- package/lib/maps/MarkersLayer.js +33 -7
- package/lib/maps/MarkersLayerDesign.d.ts +19 -16
- package/lib/maps/PopupFilterJoinsUtils.d.ts +6 -3
- package/lib/maps/PopupFilterJoinsUtils.js +0 -6
- package/lib/maps/RasterMapViewComponent.d.ts +3 -31
- package/lib/maps/RasterMapViewComponent.js +7 -2
- package/lib/maps/ServerMapDataSource.js +2 -1
- package/lib/maps/SwitchableTileUrlLayer.d.ts +3 -3
- package/lib/maps/SwitchableTileUrlLayer.js +2 -1
- package/lib/maps/TileUrlLayer.d.ts +4 -5
- package/lib/maps/TileUrlLayer.js +2 -1
- package/lib/maps/VectorMapViewComponent.d.ts +5 -37
- package/lib/maps/VectorMapViewComponent.js +19 -8
- package/lib/maps/maps.d.ts +3 -0
- package/lib/quickfilter/Quickfilter.d.ts +2 -0
- package/lib/quickfilter/QuickfiltersComponent.d.ts +2 -0
- package/lib/quickfilter/QuickfiltersComponent.js +9 -7
- package/lib/quickfilter/QuickfiltersDesignComponent.d.ts +5 -30
- package/lib/quickfilter/QuickfiltersDesignComponent.js +56 -63
- package/lib/richtext/ExprItemsHtmlConverter.d.ts +5 -2
- package/lib/richtext/ExprItemsHtmlConverter.js +4 -4
- package/lib/richtext/ExprItemsTranslator.d.ts +5 -0
- package/lib/richtext/ExprItemsTranslator.js +149 -0
- package/lib/richtext/ItemsHtmlConverter.d.ts +1 -1
- package/lib/richtext/ItemsHtmlConverter.js +31 -15
- package/lib/wellknown.js +12 -9
- package/lib/widgets/IFrameWidget.d.ts +4 -4
- package/lib/widgets/ImageWidget.d.ts +7 -4
- package/lib/widgets/ImageWidget.js +9 -1
- package/lib/widgets/ImageWidgetComponent.d.ts +1 -0
- package/lib/widgets/ImageWidgetComponent.js +1 -1
- package/lib/widgets/MapWidget.d.ts +5 -48
- package/lib/widgets/MapWidget.js +26 -63
- package/lib/widgets/MarkdownWidget.d.ts +3 -0
- package/lib/widgets/MarkdownWidget.js +3 -0
- package/lib/widgets/TOCWidget.d.ts +15 -27
- package/lib/widgets/TOCWidget.js +107 -183
- package/lib/widgets/Widget.d.ts +18 -7
- package/lib/widgets/Widget.js +4 -0
- package/lib/widgets/WidgetScopesViewComponent.js +1 -1
- package/lib/widgets/charts/Chart.d.ts +10 -1
- package/lib/widgets/charts/Chart.js +22 -11
- package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartViewComponent.js +6 -3
- package/lib/widgets/charts/ChartWidget.d.ts +2 -0
- package/lib/widgets/charts/ChartWidget.js +9 -1
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +2 -2
- package/lib/widgets/charts/calendar/CalendarChart.d.ts +1 -0
- package/lib/widgets/charts/calendar/CalendarChart.js +26 -0
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +3 -1
- package/lib/widgets/charts/imagemosaic/ImageMosaicChart.d.ts +1 -0
- package/lib/widgets/charts/imagemosaic/ImageMosaicChart.js +8 -0
- package/lib/widgets/charts/layered/LayeredChart.d.ts +2 -0
- package/lib/widgets/charts/layered/LayeredChart.js +63 -3
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +1 -1
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +2 -2
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +8 -3
- package/lib/widgets/charts/pivot/PivotChart.d.ts +1 -0
- package/lib/widgets/charts/pivot/PivotChart.js +63 -0
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +1 -1
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +7 -4
- package/lib/widgets/charts/table/OrderingsComponent.js +1 -1
- package/lib/widgets/charts/table/TableChart.d.ts +1 -0
- package/lib/widgets/charts/table/TableChart.js +15 -0
- package/lib/widgets/text/TextComponent.d.ts +11 -4
- package/lib/widgets/text/TextComponent.js +11 -8
- package/lib/widgets/text/TextWidget.d.ts +6 -3
- package/lib/widgets/text/TextWidget.js +7 -1
- package/lib/widgets/text/TextWidgetComponent.d.ts +4 -0
- package/lib/widgets/text/TextWidgetComponent.js +7 -1
- package/lib/widgets/text/TextWidgetDesign.d.ts +2 -4
- package/lib/widgets/text/TextWidgetDesign.js +1 -1
- package/package.json +7 -8
- package/src/ColorComponent.tsx +1 -2
- package/src/IdSelection.ts +62 -0
- package/src/MWaterAddRelatedIndicatorComponent.ts +3 -2
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -46
- package/src/MWaterLoaderComponent.ts +28 -26
- package/src/MWaterResponsesFilterComponent.ts +5 -2
- package/src/MWaterTableSelectComponent.tsx +5 -9
- package/src/autotranslate.ts +141 -0
- package/src/axes/AxisBuilder.ts +3 -3
- package/src/axes/AxisColorEditorComponent.tsx +5 -0
- package/src/axes/{AxisComponent.ts → AxisComponent.tsx} +106 -106
- package/src/axes/CategoryMapComponent.ts +4 -4
- package/src/axes/RangesComponent.ts +3 -2
- package/src/dashboards/DashboardComponent.tsx +189 -125
- package/src/dashboards/DashboardDesign.ts +9 -2
- package/src/dashboards/DashboardUtils.ts +39 -0
- package/src/dashboards/DashboardViewComponent.tsx +22 -3
- package/src/dashboards/ServerDashboardDataSource.ts +2 -1
- package/src/dashboards/SettingsModalComponent.tsx +450 -35
- package/src/dashboards/WidgetComponent.tsx +12 -6
- package/src/datagrids/CellEditor.tsx +354 -0
- package/src/datagrids/DatagridComponent.tsx +646 -0
- package/src/datagrids/DatagridViewComponent.tsx +539 -0
- package/src/datagrids/DirectDatagridDataSource.ts +2 -3
- package/src/datagrids/{ExprCellComponent.ts → ExprCellComponent.tsx} +28 -23
- package/src/datagrids/{FindReplaceModalComponent.ts → FindReplaceModalComponent.tsx} +109 -122
- package/src/index.css +1 -1
- package/src/index.ts +0 -1
- package/src/languages.ts +6 -1
- package/src/layouts/blocks/HorizontalBlockComponent.ts +2 -2
- package/src/mWaterLoader.ts +1 -1
- package/src/maps/BufferLayer.ts +83 -60
- package/src/maps/BufferLayerDesign.ts +20 -14
- package/src/maps/BufferLayerDesignerComponent.tsx +309 -0
- package/src/maps/ChoroplethLayer.ts +40 -19
- package/src/maps/ChoroplethLayerDesign.ts +4 -2
- package/src/maps/ChoroplethLayerDesigner.tsx +4 -2
- package/src/maps/ClusterLayer.ts +4 -10
- package/src/maps/DetailLevelSelectComponent.ts +1 -1
- package/src/maps/DirectMapDataSource.ts +2 -1
- package/src/maps/EditPopupComponent.ts +7 -3
- package/src/maps/GridLayer.ts +4 -10
- package/src/maps/GridLayerDesigner.tsx +5 -3
- package/src/maps/HoverContent.tsx +40 -16
- package/src/maps/Layer.ts +28 -10
- package/src/maps/LayerFactory.ts +0 -8
- package/src/maps/LayerLegendComponent.ts +2 -4
- package/src/maps/LayerSwitcherComponent.tsx +6 -2
- package/src/maps/LeafletMapComponent.tsx +3 -1
- package/src/maps/LegendComponent.tsx +10 -1
- package/src/maps/MWaterServerLayer.ts +3 -3
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MapDesign.ts +3 -0
- package/src/maps/MapDesignerComponent.tsx +165 -162
- package/src/maps/MapLayerViewDesignerComponent.ts +2 -2
- package/src/maps/MapUtils.ts +24 -0
- package/src/maps/MapViewComponent.tsx +11 -3
- package/src/maps/MarkersLayer.ts +44 -18
- package/src/maps/MarkersLayerDesign.ts +19 -16
- package/src/maps/PopupFilterJoinsUtils.ts +6 -2
- package/src/maps/RasterMapViewComponent.ts +9 -45
- package/src/maps/ServerMapDataSource.ts +2 -2
- package/src/maps/SwitchableTileUrlLayer.tsx +4 -10
- package/src/maps/TileUrlLayer.tsx +4 -10
- package/src/maps/VectorMapViewComponent.tsx +28 -55
- package/src/maps/maps.ts +3 -0
- package/src/quickfilter/Quickfilter.ts +3 -0
- package/src/quickfilter/QuickfiltersComponent.ts +13 -7
- package/src/quickfilter/QuickfiltersDesignComponent.tsx +127 -128
- package/src/richtext/ExprItemsHtmlConverter.ts +9 -5
- package/src/richtext/ExprItemsTranslator.ts +176 -0
- package/src/richtext/ItemsHtmlConverter.ts +33 -18
- package/src/wellknown.ts +33 -30
- package/src/widgets/ImageWidget.ts +10 -1
- package/src/widgets/ImageWidgetComponent.ts +3 -2
- package/src/widgets/{MapWidget.ts → MapWidget.tsx} +90 -101
- package/src/widgets/MarkdownWidget.ts +3 -0
- package/src/widgets/TOCWidget.tsx +281 -0
- package/src/widgets/Widget.ts +25 -5
- package/src/widgets/WidgetScopesViewComponent.ts +2 -1
- package/src/widgets/charts/Chart.ts +31 -12
- package/src/widgets/charts/ChartViewComponent.ts +13 -3
- package/src/widgets/charts/ChartWidget.ts +11 -1
- package/src/widgets/charts/ChartWidgetComponent.tsx +9 -1
- package/src/widgets/charts/calendar/CalendarChart.ts +29 -0
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +3 -1
- package/src/widgets/charts/imagemosaic/ImageMosaicChart.ts +9 -0
- package/src/widgets/charts/layered/LayeredChart.ts +71 -3
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +2 -2
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +4 -2
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +10 -4
- package/src/widgets/charts/pivot/PivotChart.ts +73 -0
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +1 -1
- package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +6 -4
- package/src/widgets/charts/table/OrderingsComponent.tsx +2 -1
- package/src/widgets/charts/table/TableChart.ts +17 -0
- package/src/widgets/text/TextComponent.tsx +22 -12
- package/src/widgets/text/TextWidget.ts +9 -2
- package/src/widgets/text/TextWidgetComponent.tsx +16 -1
- package/src/widgets/text/TextWidgetDesign.ts +4 -7
- package/test/IdSelectionTests.ts +54 -0
- package/test/LayeredChartCompilerTests.ts +0 -2
- package/test/richtext/ExprItemsTranslatorTests.ts +144 -0
- package/test/wellknownTests.ts +144 -0
- package/src/datagrids/DatagridComponent.ts +0 -478
- package/src/datagrids/DatagridViewComponent.ts +0 -464
- package/src/datagrids/EditExprCellComponent.tsx +0 -305
- package/src/datagrids/README.md +0 -3
- package/src/maps/BufferLayerDesignerComponent.ts +0 -311
- package/src/widgets/TOCWidget.ts +0 -326
- package/test/LegoLayoutEngineTests.ts +0 -69
|
@@ -5,21 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const R = react_1.default.createElement;
|
|
9
8
|
const moment_1 = __importDefault(require("moment"));
|
|
10
9
|
const expressions_1 = require("@mwater/expressions");
|
|
11
10
|
const react_linkify_1 = __importDefault(require("react-linkify"));
|
|
12
|
-
const fixed_data_table_2_1 = require("fixed-data-table-2");
|
|
13
11
|
const valueFormatter_1 = require("../valueFormatter");
|
|
14
12
|
const valueFormatter_2 = require("../valueFormatter");
|
|
15
13
|
// Cell that displays an expression column cell
|
|
16
14
|
class ExprCellComponent extends react_1.default.Component {
|
|
17
|
-
handleClick = () => {
|
|
18
|
-
return this.setState({ editing: true });
|
|
19
|
-
};
|
|
20
15
|
renderImage(id) {
|
|
21
16
|
const url = this.props.dataSource.getImageUrl(id);
|
|
22
|
-
return
|
|
17
|
+
return react_1.default.createElement("a", { href: url, key: id, target: "_blank", style: { paddingLeft: 5, paddingRight: 5 } }, T `Image`);
|
|
23
18
|
}
|
|
24
19
|
render() {
|
|
25
20
|
let node;
|
|
@@ -41,7 +36,7 @@ class ExprCellComponent extends react_1.default.Component {
|
|
|
41
36
|
// Convert to node based on type
|
|
42
37
|
switch (this.props.exprType) {
|
|
43
38
|
case "text":
|
|
44
|
-
node =
|
|
39
|
+
node = react_1.default.createElement(react_linkify_1.default, { properties: { target: "_blank" } }, value);
|
|
45
40
|
break;
|
|
46
41
|
case "boolean":
|
|
47
42
|
case "enum":
|
|
@@ -66,16 +61,17 @@ class ExprCellComponent extends react_1.default.Component {
|
|
|
66
61
|
}
|
|
67
62
|
}
|
|
68
63
|
}
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
onClick: this.props.onClick,
|
|
73
|
-
style: {
|
|
64
|
+
return (react_1.default.createElement("div", { style: {
|
|
65
|
+
width: this.props.width,
|
|
66
|
+
height: this.props.height,
|
|
74
67
|
whiteSpace: "nowrap",
|
|
75
68
|
textAlign: ["number"].includes(this.props.exprType) ? "right" : "left",
|
|
76
|
-
opacity: this.props.muted ? 0.4 : undefined
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
opacity: this.props.muted ? 0.4 : undefined,
|
|
70
|
+
padding: 8,
|
|
71
|
+
cursor: this.props.onClick ? "pointer" : undefined,
|
|
72
|
+
overflow: "hidden",
|
|
73
|
+
textOverflow: "ellipsis"
|
|
74
|
+
}, onClick: this.props.onClick, onDoubleClick: this.props.onDoubleClick }, node));
|
|
79
75
|
}
|
|
80
76
|
}
|
|
81
77
|
exports.default = ExprCellComponent;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import AutoSizeComponent from "@mwater/react-library/lib/AutoSizeComponent";
|
|
3
2
|
import { RowUpdate } from "./DatagridViewComponent";
|
|
4
|
-
import ModalPopupComponent from "@mwater/react-library/lib/ModalPopupComponent";
|
|
5
3
|
import { DataSource, Expr, Schema } from "@mwater/expressions";
|
|
6
4
|
import { DatagridDesign, JsonQLFilter } from "..";
|
|
7
5
|
export interface FindReplaceModalComponentProps {
|
|
@@ -26,11 +24,11 @@ interface FindReplaceModalComponentState {
|
|
|
26
24
|
busy: boolean;
|
|
27
25
|
}
|
|
28
26
|
export default class FindReplaceModalComponent extends React.Component<FindReplaceModalComponentProps, FindReplaceModalComponentState> {
|
|
29
|
-
constructor(props:
|
|
27
|
+
constructor(props: FindReplaceModalComponentProps);
|
|
30
28
|
show(): void;
|
|
31
29
|
performReplace(): Promise<void>;
|
|
32
|
-
renderPreview(): React.
|
|
33
|
-
renderContents(): React.
|
|
34
|
-
render(): React.
|
|
30
|
+
renderPreview(): React.JSX.Element;
|
|
31
|
+
renderContents(): React.JSX.Element;
|
|
32
|
+
render(): React.JSX.Element | null;
|
|
35
33
|
}
|
|
36
34
|
export {};
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const R = react_1.default.createElement;
|
|
9
8
|
const react_select_1 = __importDefault(require("react-select"));
|
|
10
9
|
const AutoSizeComponent_1 = __importDefault(require("@mwater/react-library/lib/AutoSizeComponent"));
|
|
11
10
|
const DatagridViewComponent_1 = __importDefault(require("./DatagridViewComponent"));
|
|
@@ -21,10 +20,10 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
21
20
|
constructor(props) {
|
|
22
21
|
super(props);
|
|
23
22
|
this.state = {
|
|
24
|
-
open: false,
|
|
25
|
-
replaceColumn: null,
|
|
26
|
-
withExpr: null,
|
|
27
|
-
conditionExpr: null,
|
|
23
|
+
open: false,
|
|
24
|
+
replaceColumn: null,
|
|
25
|
+
withExpr: null,
|
|
26
|
+
conditionExpr: null,
|
|
28
27
|
busy: false
|
|
29
28
|
};
|
|
30
29
|
}
|
|
@@ -168,23 +167,14 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
169
|
});
|
|
171
|
-
return
|
|
172
|
-
return
|
|
173
|
-
width: size.width,
|
|
174
|
-
height: 400,
|
|
175
|
-
schema: this.props.schema,
|
|
176
|
-
dataSource: this.props.dataSource,
|
|
177
|
-
datagridDataSource: new DirectDatagridDataSource_1.default({
|
|
170
|
+
return (react_1.default.createElement(AutoSizeComponent_1.default, { injectWidth: true }, (size) => {
|
|
171
|
+
return react_1.default.createElement(DatagridViewComponent_1.default, { width: size.width, height: 400, schema: this.props.schema, dataSource: this.props.dataSource, datagridDataSource: new DirectDatagridDataSource_1.default({
|
|
178
172
|
schema: this.props.schema,
|
|
179
173
|
dataSource: this.props.dataSource
|
|
180
|
-
}),
|
|
181
|
-
|
|
182
|
-
filters: this.props.filters
|
|
183
|
-
});
|
|
184
|
-
});
|
|
174
|
+
}), design: design, filters: this.props.filters });
|
|
175
|
+
}));
|
|
185
176
|
}
|
|
186
177
|
renderContents() {
|
|
187
|
-
let value;
|
|
188
178
|
const exprUtils = new expressions_1.ExprUtils(this.props.schema);
|
|
189
179
|
// Determine which columns are replace-able. Excludes subtables and aggregates
|
|
190
180
|
const replaceColumns = lodash_1.default.filter(this.props.design.columns, column => !column.subtable && exprUtils.getExprAggrStatus(column.expr) === "individual");
|
|
@@ -194,69 +184,42 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
194
184
|
}));
|
|
195
185
|
// Show progress
|
|
196
186
|
if (this.state.busy) {
|
|
197
|
-
return
|
|
187
|
+
return (react_1.default.createElement("div", null,
|
|
188
|
+
react_1.default.createElement("h3", null, T `Working...`),
|
|
189
|
+
react_1.default.createElement("div", { className: "progress" },
|
|
190
|
+
react_1.default.createElement("div", { className: "progress-bar progress-bar-striped progress-bar-animated", style: { width: "100%" } }))));
|
|
198
191
|
}
|
|
199
|
-
return
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
preferLiteral: true,
|
|
222
|
-
placeholder: T `(Blank)`,
|
|
223
|
-
refExpr: replaceExpr
|
|
224
|
-
}));
|
|
225
|
-
}
|
|
226
|
-
return null;
|
|
227
|
-
})(), R("div", { key: "condition", className: "mb-3" }, R("label", null, T `Only in rows that (optional)` + ":"), R(expressions_ui_1.ExprComponent, {
|
|
228
|
-
schema: this.props.schema,
|
|
229
|
-
dataSource: this.props.dataSource,
|
|
230
|
-
table: this.props.design.table,
|
|
231
|
-
value: this.state.conditionExpr,
|
|
232
|
-
onChange: value => this.setState({ conditionExpr: value }),
|
|
233
|
-
types: ["boolean"],
|
|
234
|
-
placeholder: T `All Rows`
|
|
235
|
-
})), R("div", { key: "preview" }, R("h4", null, T `Preview`), this.renderPreview()));
|
|
192
|
+
return (react_1.default.createElement("div", null,
|
|
193
|
+
react_1.default.createElement("div", { key: "replace", className: "mb-3" },
|
|
194
|
+
react_1.default.createElement("label", null,
|
|
195
|
+
T `Column with data to replace`,
|
|
196
|
+
": "),
|
|
197
|
+
react_1.default.createElement(react_select_1.default, { options: replaceColumnOptions, value: lodash_1.default.findWhere(replaceColumnOptions, { value: this.state.replaceColumn }) || null, onChange: (opt) => this.setState({ replaceColumn: opt.value }), placeholder: T `Select Column...`, styles: {
|
|
198
|
+
// Keep menu above fixed data table headers
|
|
199
|
+
menu: style => lodash_1.default.extend({}, style, { zIndex: 2 })
|
|
200
|
+
} })),
|
|
201
|
+
this.state.replaceColumn ? (react_1.default.createElement("div", { key: "with", className: "mb-3" },
|
|
202
|
+
react_1.default.createElement("label", null,
|
|
203
|
+
T `Value to replace data with`,
|
|
204
|
+
": "),
|
|
205
|
+
react_1.default.createElement(expressions_ui_1.ExprComponent, { schema: this.props.schema, dataSource: this.props.dataSource, table: this.props.design.table, value: this.state.withExpr, onChange: value => this.setState({ withExpr: value }), types: [exprUtils.getExprType(lodash_1.default.findWhere(this.props.design.columns, { id: this.state.replaceColumn }).expr)], enumValues: exprUtils.getExprEnumValues(lodash_1.default.findWhere(this.props.design.columns, { id: this.state.replaceColumn }).expr) || undefined, idTable: exprUtils.getExprIdTable(lodash_1.default.findWhere(this.props.design.columns, { id: this.state.replaceColumn }).expr) || undefined, preferLiteral: true, placeholder: T `(Blank)`, refExpr: lodash_1.default.findWhere(this.props.design.columns, { id: this.state.replaceColumn }).expr }))) : null,
|
|
206
|
+
react_1.default.createElement("div", { key: "condition", className: "mb-3" },
|
|
207
|
+
react_1.default.createElement("label", null,
|
|
208
|
+
T `Only in rows that (optional)`,
|
|
209
|
+
":"),
|
|
210
|
+
react_1.default.createElement(expressions_ui_1.ExprComponent, { schema: this.props.schema, dataSource: this.props.dataSource, table: this.props.design.table, value: this.state.conditionExpr, onChange: value => this.setState({ conditionExpr: value }), types: ["boolean"], placeholder: T `All Rows` })),
|
|
211
|
+
react_1.default.createElement("div", { key: "preview" },
|
|
212
|
+
react_1.default.createElement("h4", null, T `Preview`),
|
|
213
|
+
this.renderPreview())));
|
|
236
214
|
}
|
|
237
215
|
render() {
|
|
238
216
|
if (!this.state.open) {
|
|
239
217
|
return null;
|
|
240
218
|
}
|
|
241
|
-
return
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
R("button", {
|
|
246
|
-
key: "cancel",
|
|
247
|
-
type: "button",
|
|
248
|
-
onClick: () => this.setState({ open: false }),
|
|
249
|
-
className: "btn btn-secondary"
|
|
250
|
-
}, T `Cancel`),
|
|
251
|
-
R("button", {
|
|
252
|
-
key: "apply",
|
|
253
|
-
type: "button",
|
|
254
|
-
disabled: !this.state.replaceColumn || this.state.busy,
|
|
255
|
-
onClick: () => this.performReplace(),
|
|
256
|
-
className: "btn btn-primary"
|
|
257
|
-
}, T `Apply`)
|
|
258
|
-
]
|
|
259
|
-
}, this.renderContents());
|
|
219
|
+
return (react_1.default.createElement(ModalPopupComponent_1.default, { size: "large", header: T `Find/Replace`, footer: [
|
|
220
|
+
react_1.default.createElement("button", { key: "cancel", type: "button", onClick: () => this.setState({ open: false }), className: "btn btn-secondary" }, T `Cancel`),
|
|
221
|
+
react_1.default.createElement("button", { key: "apply", type: "button", disabled: !this.state.replaceColumn || this.state.busy, onClick: () => this.performReplace(), className: "btn btn-primary" }, T `Apply`)
|
|
222
|
+
] }, this.renderContents()));
|
|
260
223
|
}
|
|
261
224
|
}
|
|
262
225
|
exports.default = FindReplaceModalComponent;
|
package/lib/index.css
CHANGED
|
@@ -434,7 +434,7 @@ Lato, Lora, Inter, Merriweather, Roboto
|
|
|
434
434
|
.dropzone {
|
|
435
435
|
width: 100%;
|
|
436
436
|
padding: 80px 40px;
|
|
437
|
-
border: 2px dashed
|
|
437
|
+
border: 2px dashed var(--bs-border-color);
|
|
438
438
|
border-radius: 5px;
|
|
439
439
|
text-align: center;
|
|
440
440
|
vertical-align: middle;
|
package/lib/index.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export { default as mWaterLoader } from "./mWaterLoader";
|
|
|
23
23
|
export { WidgetDataSource } from "./widgets/WidgetDataSource";
|
|
24
24
|
export { default as DirectWidgetDataSource } from "./widgets/DirectWidgetDataSource";
|
|
25
25
|
import "leaflet/dist/leaflet.css";
|
|
26
|
-
import "fixed-data-table-2/dist/fixed-data-table.min.css";
|
|
27
26
|
import "rc-slider/assets/index.css";
|
|
28
27
|
import "./layouts/decorated-block.css";
|
|
29
28
|
import "react-datepicker/dist/react-datepicker.css";
|
package/lib/index.js
CHANGED
|
@@ -57,7 +57,6 @@ Object.defineProperty(exports, "mWaterLoader", { enumerable: true, get: function
|
|
|
57
57
|
var DirectWidgetDataSource_1 = require("./widgets/DirectWidgetDataSource");
|
|
58
58
|
Object.defineProperty(exports, "DirectWidgetDataSource", { enumerable: true, get: function () { return __importDefault(DirectWidgetDataSource_1).default; } });
|
|
59
59
|
require("leaflet/dist/leaflet.css");
|
|
60
|
-
require("fixed-data-table-2/dist/fixed-data-table.min.css");
|
|
61
60
|
require("rc-slider/assets/index.css");
|
|
62
61
|
require("./layouts/decorated-block.css");
|
|
63
62
|
require("react-datepicker/dist/react-datepicker.css");
|
package/lib/languages.js
CHANGED
|
@@ -51,14 +51,14 @@ class HorizontalBlockComponent extends react_1.default.Component {
|
|
|
51
51
|
if (dragXOffset > this.state.rightSize - 100) {
|
|
52
52
|
dragXOffset = this.state.rightSize - 100;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
this.setState({ dragXOffset });
|
|
55
55
|
};
|
|
56
56
|
handleMouseUp = (ev) => {
|
|
57
57
|
// Remove listeners
|
|
58
58
|
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
59
59
|
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
60
60
|
// Determine weights of two blocks
|
|
61
|
-
const weights = this.props.block.weights || [];
|
|
61
|
+
const weights = [...(this.props.block.weights || [])];
|
|
62
62
|
const newLeftSize = this.state.leftSize + this.state.dragXOffset;
|
|
63
63
|
const newRightSize = this.state.rightSize - this.state.dragXOffset;
|
|
64
64
|
// Get current weights
|
package/lib/mWaterLoader.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface MWaterLoaderOptions {
|
|
|
9
9
|
/** Load schema as a specific user (for shared dashboards, etc). optional */
|
|
10
10
|
asUser?: string;
|
|
11
11
|
/** Extra tables to load in schema. Forms are not loaded by default as they are too many */
|
|
12
|
-
extraTables
|
|
12
|
+
extraTables?: string[];
|
|
13
13
|
/** False to disable local caching of queries. Default true */
|
|
14
14
|
localCaching?: boolean;
|
|
15
15
|
/** Locales of the schema to load. Default is all. */
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { JsonQLQuery } from "@mwater/jsonql";
|
|
2
2
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { ReactNode } from "react";
|
|
4
4
|
import { JsonQLFilter } from "../JsonQLFilter";
|
|
5
5
|
import { BufferLayerDesign } from "./BufferLayerDesign";
|
|
6
|
-
import Layer, { OnGridClickOptions, OnGridHoverOptions, VectorTileDef } from "./Layer";
|
|
6
|
+
import Layer, { OnGridClickOptions, OnGridHoverOptions, VectorTileDef, LegendOptions } from "./Layer";
|
|
7
7
|
import { OnGridClickResults, OnGridHoverResults } from "./maps";
|
|
8
|
-
|
|
8
|
+
/** Layer which draws a buffer around geometries (i.e. a radius circle around points) */
|
|
9
9
|
export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
10
10
|
/** Gets the type of layer definition */
|
|
11
11
|
getLayerDefinitionType(): "VectorTile";
|
|
12
12
|
getVectorTile(design: BufferLayerDesign, sourceId: string, schema: Schema, filters: JsonQLFilter[], opacity: number): VectorTileDef;
|
|
13
|
-
|
|
13
|
+
createVectorJsonQL(design: BufferLayerDesign, schema: Schema, filters: JsonQLFilter[]): JsonQLQuery;
|
|
14
14
|
getJsonQLCss(design: BufferLayerDesign, schema: Schema, filters: JsonQLFilter[]): {
|
|
15
15
|
layers: {
|
|
16
16
|
id: string;
|
|
@@ -35,7 +35,7 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
35
35
|
getBounds(design: BufferLayerDesign, schema: Schema, dataSource: DataSource, filters: JsonQLFilter[], callback: any): void;
|
|
36
36
|
getMinZoom(design: BufferLayerDesign): number | undefined;
|
|
37
37
|
getMaxZoom(design: BufferLayerDesign): number;
|
|
38
|
-
getLegend(
|
|
38
|
+
getLegend(options: LegendOptions<BufferLayerDesign>): ReactNode;
|
|
39
39
|
getFilterableTables(design: BufferLayerDesign, schema: Schema): string[];
|
|
40
40
|
isEditable(): boolean;
|
|
41
41
|
isIncomplete(design: BufferLayerDesign, schema: Schema): boolean;
|
|
@@ -48,4 +48,6 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
48
48
|
}): React.ReactElement<{}>;
|
|
49
49
|
cleanDesign(design: BufferLayerDesign, schema: Schema): BufferLayerDesign;
|
|
50
50
|
validateDesign(design: BufferLayerDesign, schema: Schema): string | null;
|
|
51
|
+
/** Get strings to be translated */
|
|
52
|
+
getTranslatableStrings(design: BufferLayerDesign, schema: Schema): string[];
|
|
51
53
|
}
|
package/lib/maps/BufferLayer.js
CHANGED
|
@@ -37,34 +37,16 @@ const LayerLegendComponent_1 = __importDefault(require("./LayerLegendComponent")
|
|
|
37
37
|
const PopupFilterJoinsUtils = __importStar(require("./PopupFilterJoinsUtils"));
|
|
38
38
|
const HoverContent_1 = __importDefault(require("./HoverContent"));
|
|
39
39
|
const layoutOptions_1 = require("../dashboards/layoutOptions");
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Design is:
|
|
44
|
-
table: table to get data from
|
|
45
|
-
axes: axes (see below)
|
|
46
|
-
filter: optional logical expression to filter by
|
|
47
|
-
color: color of layer (e.g. #FF8800). Color axis overrides
|
|
48
|
-
fillOpacity: Opacity to fill the circles (0-1)
|
|
49
|
-
radius: radius to draw in meters
|
|
50
|
-
minZoom: minimum zoom level
|
|
51
|
-
maxZoom: maximum zoom level
|
|
52
|
-
|
|
53
|
-
popup: contains items: which is BlocksLayoutManager items. Will be displayed when the circle is clicked
|
|
54
|
-
popupFilterJoins: customizable filtering for popup. See PopupFilterJoins.md
|
|
55
|
-
|
|
56
|
-
axes:
|
|
57
|
-
geometry: where to draw buffers around
|
|
58
|
-
color: color axis
|
|
59
|
-
|
|
60
|
-
*/
|
|
40
|
+
const BlocksLayoutManager_1 = __importDefault(require("../layouts/blocks/BlocksLayoutManager"));
|
|
41
|
+
const DashboardUtils_1 = require("../dashboards/DashboardUtils");
|
|
42
|
+
/** Layer which draws a buffer around geometries (i.e. a radius circle around points) */
|
|
61
43
|
class BufferLayer extends Layer_1.default {
|
|
62
44
|
/** Gets the type of layer definition */
|
|
63
45
|
getLayerDefinitionType() {
|
|
64
46
|
return "VectorTile";
|
|
65
47
|
}
|
|
66
48
|
getVectorTile(design, sourceId, schema, filters, opacity) {
|
|
67
|
-
const jsonql = this.
|
|
49
|
+
const jsonql = this.createVectorJsonQL(design, schema, filters);
|
|
68
50
|
const mapLayers = [];
|
|
69
51
|
// If color axes, add color conditions
|
|
70
52
|
const color = (0, mapboxUtils_1.compileColorMapToMapbox)(design.axes.color || undefined, design.color || "transparent");
|
|
@@ -102,7 +84,7 @@ class BufferLayer extends Layer_1.default {
|
|
|
102
84
|
maxZoom: this.getMaxZoom(design)
|
|
103
85
|
};
|
|
104
86
|
}
|
|
105
|
-
|
|
87
|
+
createVectorJsonQL(design, schema, filters) {
|
|
106
88
|
let colorExpr;
|
|
107
89
|
const axisBuilder = new AxisBuilder_1.default({ schema });
|
|
108
90
|
const exprCompiler = new expressions_1.ExprCompiler(schema);
|
|
@@ -147,8 +129,13 @@ class BufferLayer extends Layer_1.default {
|
|
|
147
129
|
// ST_Expand(ST_MakeEnvelope(-180, -85, 180, 85, 4326), -<radius in degrees>))
|
|
148
130
|
// , <radius in degrees>})
|
|
149
131
|
// , 3857)
|
|
150
|
-
//
|
|
151
|
-
const
|
|
132
|
+
// Get radius expression
|
|
133
|
+
const radiusCompiledExpr = exprCompiler.compileExpr({
|
|
134
|
+
expr: design.radiusExpr ?? { type: "literal", valueType: "number", value: design.radius },
|
|
135
|
+
tableAlias: "main"
|
|
136
|
+
});
|
|
137
|
+
// Convert radius in meters to a maximum number of degrees latitude
|
|
138
|
+
const radiusDegCompiledExpr = { type: "op", op: "/", exprs: [radiusCompiledExpr, 100000] };
|
|
152
139
|
const boundingBox = {
|
|
153
140
|
type: "op",
|
|
154
141
|
op: "ST_Transform",
|
|
@@ -165,11 +152,14 @@ class BufferLayer extends Layer_1.default {
|
|
|
165
152
|
{
|
|
166
153
|
type: "op",
|
|
167
154
|
op: "ST_Expand",
|
|
168
|
-
exprs: [
|
|
155
|
+
exprs: [
|
|
156
|
+
{ type: "op", op: "ST_MakeEnvelope", exprs: [-180, -85, 180, 85, 4326] },
|
|
157
|
+
{ type: "op", op: "*", exprs: [radiusDegCompiledExpr, -1] }
|
|
158
|
+
]
|
|
169
159
|
}
|
|
170
160
|
]
|
|
171
161
|
},
|
|
172
|
-
|
|
162
|
+
radiusDegCompiledExpr
|
|
173
163
|
]
|
|
174
164
|
},
|
|
175
165
|
3857
|
|
@@ -208,7 +198,7 @@ class BufferLayer extends Layer_1.default {
|
|
|
208
198
|
type: "op",
|
|
209
199
|
op: "/",
|
|
210
200
|
exprs: [
|
|
211
|
-
|
|
201
|
+
radiusCompiledExpr,
|
|
212
202
|
{
|
|
213
203
|
type: "op",
|
|
214
204
|
op: "cos",
|
|
@@ -331,6 +321,13 @@ class BufferLayer extends Layer_1.default {
|
|
|
331
321
|
let colorExpr;
|
|
332
322
|
const axisBuilder = new AxisBuilder_1.default({ schema });
|
|
333
323
|
const exprCompiler = new expressions_1.ExprCompiler(schema);
|
|
324
|
+
// Get radius expression
|
|
325
|
+
const radiusCompiledExpr = exprCompiler.compileExpr({
|
|
326
|
+
expr: design.radiusExpr ?? { type: "literal", valueType: "number", value: design.radius },
|
|
327
|
+
tableAlias: "main"
|
|
328
|
+
});
|
|
329
|
+
// Convert radius in meters to a maximum number of degrees latitude
|
|
330
|
+
const radiusDegCompiledExpr = { type: "op", op: "/", exprs: [radiusCompiledExpr, 100000] };
|
|
334
331
|
/*
|
|
335
332
|
Query:
|
|
336
333
|
select
|
|
@@ -363,7 +360,7 @@ class BufferLayer extends Layer_1.default {
|
|
|
363
360
|
type: "op",
|
|
364
361
|
op: "/",
|
|
365
362
|
exprs: [
|
|
366
|
-
{ type: "op", op: "*", exprs: [
|
|
363
|
+
{ type: "op", op: "*", exprs: [radiusCompiledExpr, 2] },
|
|
367
364
|
{
|
|
368
365
|
type: "op",
|
|
369
366
|
op: "*",
|
|
@@ -414,15 +411,6 @@ class BufferLayer extends Layer_1.default {
|
|
|
414
411
|
selects,
|
|
415
412
|
from: exprCompiler.compileTable(design.table, "main")
|
|
416
413
|
};
|
|
417
|
-
// ST_Transform(ST_Expand(
|
|
418
|
-
// # Prevent 3857 overflow (i.e. > 85 degrees lat)
|
|
419
|
-
// ST_Intersection(
|
|
420
|
-
// ST_Transform(!bbox!, 4326),
|
|
421
|
-
// ST_Expand(ST_MakeEnvelope(-180, -85, 180, 85, 4326), -<radius in degrees>))
|
|
422
|
-
// , <radius in degrees>})
|
|
423
|
-
// , 3857)
|
|
424
|
-
// TODO document how we compute this
|
|
425
|
-
const radiusDeg = design.radius / 100000;
|
|
426
414
|
const boundingBox = {
|
|
427
415
|
type: "op",
|
|
428
416
|
op: "ST_Transform",
|
|
@@ -439,11 +427,14 @@ class BufferLayer extends Layer_1.default {
|
|
|
439
427
|
{
|
|
440
428
|
type: "op",
|
|
441
429
|
op: "ST_Expand",
|
|
442
|
-
exprs: [
|
|
430
|
+
exprs: [
|
|
431
|
+
{ type: "op", op: "ST_MakeEnvelope", exprs: [-180, -85, 180, 85, 4326] },
|
|
432
|
+
{ type: "op", op: "*", exprs: [radiusDegCompiledExpr, -1] }
|
|
433
|
+
]
|
|
443
434
|
}
|
|
444
435
|
]
|
|
445
436
|
},
|
|
446
|
-
|
|
437
|
+
radiusDegCompiledExpr
|
|
447
438
|
]
|
|
448
439
|
},
|
|
449
440
|
3857
|
|
@@ -624,10 +615,11 @@ marker-fill: ` +
|
|
|
624
615
|
design: options.design,
|
|
625
616
|
scope: null,
|
|
626
617
|
filters,
|
|
627
|
-
|
|
628
|
-
onDesignChange: null,
|
|
618
|
+
onDesignChange: undefined,
|
|
629
619
|
width: options.width,
|
|
630
|
-
height: options.height
|
|
620
|
+
height: options.height,
|
|
621
|
+
locale: clickOptions.locale,
|
|
622
|
+
translate: clickOptions.translate
|
|
631
623
|
});
|
|
632
624
|
}
|
|
633
625
|
});
|
|
@@ -655,8 +647,11 @@ marker-fill: ` +
|
|
|
655
647
|
key: ev.data.id,
|
|
656
648
|
schema: hoverOptions.schema,
|
|
657
649
|
dataSource: hoverOptions.dataSource,
|
|
658
|
-
|
|
659
|
-
|
|
650
|
+
table,
|
|
651
|
+
items: hoverOptions.design.hoverOver.items,
|
|
652
|
+
filters: popupFilters,
|
|
653
|
+
locale: hoverOptions.locale,
|
|
654
|
+
translate: hoverOptions.translate
|
|
660
655
|
});
|
|
661
656
|
}
|
|
662
657
|
return results;
|
|
@@ -694,7 +689,8 @@ marker-fill: ` +
|
|
|
694
689
|
}
|
|
695
690
|
// Get the legend to be optionally displayed on the map. Returns
|
|
696
691
|
// a React element
|
|
697
|
-
getLegend(
|
|
692
|
+
getLegend(options) {
|
|
693
|
+
const { design, schema, name, dataSource, locale, filters } = options;
|
|
698
694
|
const _filters = filters.slice();
|
|
699
695
|
if (design.filter != null) {
|
|
700
696
|
const exprCompiler = new expressions_1.ExprCompiler(schema);
|
|
@@ -765,7 +761,12 @@ marker-fill: ` +
|
|
|
765
761
|
// Default color
|
|
766
762
|
draft.color = design.color || "#0088FF";
|
|
767
763
|
draft.axes = design.axes || {};
|
|
768
|
-
|
|
764
|
+
// Default radius if both radius and radiusExpr are not specified
|
|
765
|
+
if (design.radius == null && design.radiusExpr == null) {
|
|
766
|
+
draft.radius = 1000;
|
|
767
|
+
draft.radiusExpr = { type: "literal", valueType: "number", value: 1000 };
|
|
768
|
+
}
|
|
769
|
+
// Default fill opacity
|
|
769
770
|
draft.fillOpacity = design.fillOpacity != null ? design.fillOpacity : 0.5;
|
|
770
771
|
draft.axes.geometry = axisBuilder.cleanAxis({
|
|
771
772
|
axis: draft.axes.geometry ? (0, immer_1.original)(draft.axes.geometry) || null : null,
|
|
@@ -790,7 +791,7 @@ marker-fill: ` +
|
|
|
790
791
|
if (!design.table) {
|
|
791
792
|
return T `Missing table`;
|
|
792
793
|
}
|
|
793
|
-
if (design.radius == null) {
|
|
794
|
+
if (design.radius == null && design.radiusExpr == null) {
|
|
794
795
|
return T `Missing radius`;
|
|
795
796
|
}
|
|
796
797
|
if (!design.axes || !design.axes.geometry) {
|
|
@@ -815,5 +816,25 @@ marker-fill: ` +
|
|
|
815
816
|
}
|
|
816
817
|
return null;
|
|
817
818
|
}
|
|
819
|
+
/** Get strings to be translated */
|
|
820
|
+
getTranslatableStrings(design, schema) {
|
|
821
|
+
const strings = [];
|
|
822
|
+
// Add strings from hoverOver items
|
|
823
|
+
if (design.hoverOver && design.hoverOver.items) {
|
|
824
|
+
for (const item of design.hoverOver.items) {
|
|
825
|
+
if (item.label) {
|
|
826
|
+
strings.push(item.label);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
// Add strings from popup items using a layout manager approach
|
|
831
|
+
if (design.popup && design.popup.items) {
|
|
832
|
+
const layoutManager = new BlocksLayoutManager_1.default();
|
|
833
|
+
const popupStrings = (0, DashboardUtils_1.getTranslatableStringsFromLayoutManager)(layoutManager, design.popup.items, schema);
|
|
834
|
+
strings.push(...popupStrings);
|
|
835
|
+
}
|
|
836
|
+
// Remove duplicates
|
|
837
|
+
return lodash_1.default.uniq(strings);
|
|
838
|
+
}
|
|
818
839
|
}
|
|
819
840
|
exports.default = BufferLayer;
|
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
import { Expr } from "@mwater/expressions";
|
|
2
2
|
import { Axis } from "../axes/Axis";
|
|
3
3
|
import { HoverOverItem } from "./maps";
|
|
4
|
+
import { LayoutBlock } from "../layouts/blocks/blockUtils";
|
|
5
|
+
import { PopupFilterJoins } from "./PopupFilterJoinsUtils";
|
|
4
6
|
/** Layer which draws a buffer around geometries (i.e. a radius circle around points) */
|
|
5
7
|
export interface BufferLayerDesign {
|
|
6
|
-
/**
|
|
8
|
+
/** Table to get data from */
|
|
7
9
|
table: string;
|
|
8
|
-
/**
|
|
10
|
+
/** Axes (see below) */
|
|
9
11
|
axes: {
|
|
10
|
-
/**
|
|
12
|
+
/** Where to draw buffers around */
|
|
11
13
|
geometry: Axis | null;
|
|
12
|
-
/**
|
|
14
|
+
/** Color axis */
|
|
13
15
|
color: Axis | null;
|
|
14
16
|
};
|
|
15
|
-
/**
|
|
17
|
+
/** Optional logical expression to filter by */
|
|
16
18
|
filter?: Expr;
|
|
17
|
-
/**
|
|
19
|
+
/** Color of layer (e.g. #FF8800). Color axis overrides */
|
|
18
20
|
color?: string;
|
|
19
21
|
/** Opacity to fill the circles (0-1) */
|
|
20
22
|
fillOpacity: number;
|
|
21
|
-
/**
|
|
22
|
-
radius
|
|
23
|
-
/**
|
|
23
|
+
/** Radius to draw in meters @deprecated use radiusExpr instead */
|
|
24
|
+
radius?: number;
|
|
25
|
+
/** Expression to get radius in meters */
|
|
26
|
+
radiusExpr?: Expr;
|
|
27
|
+
/** Minimum zoom level */
|
|
24
28
|
minZoom?: number;
|
|
25
|
-
/**
|
|
29
|
+
/** Maximum zoom level */
|
|
26
30
|
maxZoom?: number;
|
|
27
31
|
/** True to union circles together. Makes ids unavailable as geometries are combined.
|
|
28
32
|
* Only implemented for vector tiles */
|
|
29
33
|
unionShapes?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
popup:
|
|
34
|
+
/** Contains items: which is BlocksLayoutManager items. Will be displayed when the circle is clicked */
|
|
35
|
+
popup: {
|
|
36
|
+
items: LayoutBlock;
|
|
37
|
+
};
|
|
38
|
+
/** Contains items: which is HoverOverItem[] */
|
|
32
39
|
hoverOver: {
|
|
33
40
|
items: HoverOverItem[];
|
|
34
41
|
};
|
|
35
|
-
/**
|
|
36
|
-
popupFilterJoins:
|
|
42
|
+
/** Customizable filtering for popup. See PopupFilterJoins.md */
|
|
43
|
+
popupFilterJoins: PopupFilterJoins;
|
|
37
44
|
}
|