@mwater/visualization 5.4.1 → 5.4.2
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 +6 -0
- package/lib/dashboards/DashboardComponent.js +44 -12
- 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/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/QuickfiltersComponent.d.ts +2 -0
- package/lib/quickfilter/QuickfiltersComponent.js +9 -7
- package/lib/quickfilter/QuickfiltersDesignComponent.d.ts +1 -1
- package/lib/quickfilter/QuickfiltersDesignComponent.js +19 -35
- 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 +79 -14
- 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/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/QuickfiltersComponent.ts +13 -7
- package/src/quickfilter/QuickfiltersDesignComponent.tsx +56 -74
- 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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
|
-
import EditPopupComponent from "./EditPopupComponent";
|
|
2
|
+
import { DataSource, Expr, Schema } from "@mwater/expressions";
|
|
4
3
|
import { BufferLayerDesign } from "./BufferLayerDesign";
|
|
5
4
|
import { JsonQLFilter } from "../JsonQLFilter";
|
|
6
5
|
export interface BufferLayerDesignerComponentProps {
|
|
@@ -14,36 +13,22 @@ export interface BufferLayerDesignerComponentProps {
|
|
|
14
13
|
filters?: JsonQLFilter[];
|
|
15
14
|
}
|
|
16
15
|
export default class BufferLayerDesignerComponent extends React.Component<BufferLayerDesignerComponentProps> {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
handleTableChange: (table: any) => void;
|
|
20
|
-
handleRadiusChange: (radius: any) => void;
|
|
16
|
+
handleTableChange: (table: string) => void;
|
|
17
|
+
handleRadiusExprChange: (expr: Expr) => void;
|
|
21
18
|
handleGeometryAxisChange: (axis: any) => void;
|
|
22
|
-
handleFilterChange: (
|
|
23
|
-
handleColorChange: (color:
|
|
19
|
+
handleFilterChange: (filter: Expr) => void;
|
|
20
|
+
handleColorChange: (color: string) => void;
|
|
24
21
|
handleColorAxisChange: (axis: any) => void;
|
|
25
|
-
handleFillOpacityChange: (fillOpacity:
|
|
22
|
+
handleFillOpacityChange: (fillOpacity: number) => void;
|
|
26
23
|
handleUnionShapesChange: (unionShapes: boolean) => void;
|
|
27
|
-
renderTable(): React.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
className: string;
|
|
38
|
-
}, HTMLElement> | null;
|
|
39
|
-
renderColor(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | undefined;
|
|
40
|
-
renderFillOpacity(): React.DetailedReactHTMLElement<{
|
|
41
|
-
className: string;
|
|
42
|
-
}, HTMLElement>;
|
|
43
|
-
renderFilter(): React.DetailedReactHTMLElement<{
|
|
44
|
-
className: string;
|
|
45
|
-
}, HTMLElement> | null;
|
|
46
|
-
renderPopup(): React.CElement<any, EditPopupComponent> | null;
|
|
47
|
-
renderHoverOver(): React.FunctionComponentElement<import("./EditHoverOver").EditHoverOverProps> | null;
|
|
48
|
-
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
24
|
+
renderTable(): React.JSX.Element;
|
|
25
|
+
renderGeometryAxis(): React.JSX.Element | undefined;
|
|
26
|
+
renderRadius(): React.JSX.Element;
|
|
27
|
+
renderUnionShapes(): React.JSX.Element | null;
|
|
28
|
+
renderColor(): React.JSX.Element | undefined;
|
|
29
|
+
renderFillOpacity(): React.JSX.Element;
|
|
30
|
+
renderFilter(): React.JSX.Element | null;
|
|
31
|
+
renderPopup(): React.JSX.Element | null;
|
|
32
|
+
renderHoverOver(): React.JSX.Element | null;
|
|
33
|
+
render(): React.JSX.Element;
|
|
49
34
|
}
|
|
@@ -28,11 +28,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
30
30
|
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const R = react_1.default.createElement;
|
|
32
31
|
const expressions_ui_1 = require("@mwater/expressions-ui");
|
|
33
32
|
const expressions_1 = require("@mwater/expressions");
|
|
34
|
-
const
|
|
35
|
-
const AxisComponent_1 = __importDefault(require("./../axes/AxisComponent"));
|
|
33
|
+
const AxisComponent_1 = __importDefault(require("../axes/AxisComponent"));
|
|
36
34
|
const ColorComponent_1 = __importDefault(require("../ColorComponent"));
|
|
37
35
|
const expressions_ui_2 = require("@mwater/expressions-ui");
|
|
38
36
|
const rc_slider_1 = __importDefault(require("rc-slider"));
|
|
@@ -43,53 +41,48 @@ const bootstrap_1 = require("@mwater/react-library/lib/bootstrap");
|
|
|
43
41
|
const vectorMaps_1 = require("./vectorMaps");
|
|
44
42
|
const EditHoverOver_1 = __importDefault(require("./EditHoverOver"));
|
|
45
43
|
class BufferLayerDesignerComponent extends react_1.default.Component {
|
|
46
|
-
// Apply updates to design
|
|
47
|
-
update(updates) {
|
|
48
|
-
return this.props.onDesignChange(lodash_1.default.extend({}, this.props.design, updates));
|
|
49
|
-
}
|
|
50
|
-
// Update axes with specified changes
|
|
51
|
-
updateAxes(changes) {
|
|
52
|
-
const axes = lodash_1.default.extend({}, this.props.design.axes, changes);
|
|
53
|
-
return this.update({ axes });
|
|
54
|
-
}
|
|
55
44
|
handleTableChange = (table) => {
|
|
56
|
-
|
|
45
|
+
this.props.onDesignChange({ ...this.props.design, table });
|
|
57
46
|
};
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
handleRadiusExprChange = (expr) => {
|
|
48
|
+
const radius = expr?.type === "literal" ? expr.value : null;
|
|
49
|
+
this.props.onDesignChange({ ...this.props.design, radiusExpr: expr, radius });
|
|
60
50
|
};
|
|
61
51
|
handleGeometryAxisChange = (axis) => {
|
|
62
|
-
|
|
52
|
+
this.props.onDesignChange({ ...this.props.design, axes: { ...this.props.design.axes, geometry: axis } });
|
|
63
53
|
};
|
|
64
|
-
handleFilterChange = (
|
|
65
|
-
|
|
54
|
+
handleFilterChange = (filter) => {
|
|
55
|
+
this.props.onDesignChange({ ...this.props.design, filter });
|
|
66
56
|
};
|
|
67
57
|
handleColorChange = (color) => {
|
|
68
|
-
|
|
58
|
+
this.props.onDesignChange({ ...this.props.design, color });
|
|
69
59
|
};
|
|
70
60
|
handleColorAxisChange = (axis) => {
|
|
71
|
-
|
|
61
|
+
this.props.onDesignChange({ ...this.props.design, axes: { ...this.props.design.axes, color: axis } });
|
|
72
62
|
};
|
|
73
63
|
handleFillOpacityChange = (fillOpacity) => {
|
|
74
|
-
|
|
64
|
+
this.props.onDesignChange({ ...this.props.design, fillOpacity: fillOpacity / 100 });
|
|
75
65
|
};
|
|
76
66
|
handleUnionShapesChange = (unionShapes) => {
|
|
77
67
|
this.props.onDesignChange({ ...this.props.design, unionShapes });
|
|
78
68
|
};
|
|
79
69
|
renderTable() {
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
71
|
+
react_1.default.createElement("label", { className: "text-muted" },
|
|
72
|
+
react_1.default.createElement("i", { className: "fa fa-database" }),
|
|
73
|
+
" ",
|
|
74
|
+
T `Data Source`),
|
|
75
|
+
react_1.default.createElement("div", { style: { marginLeft: 10 } },
|
|
76
|
+
react_1.default.createElement(expressions_ui_2.TableSelectComponent, { schema: this.props.schema, value: this.props.design.table, onChange: this.handleTableChange, filter: this.props.design.filter, onFilterChange: this.handleFilterChange }))));
|
|
87
77
|
}
|
|
88
78
|
renderGeometryAxis() {
|
|
89
79
|
if (!this.props.design.table) {
|
|
90
80
|
return;
|
|
91
81
|
}
|
|
92
|
-
const title =
|
|
82
|
+
const title = (react_1.default.createElement("span", null,
|
|
83
|
+
react_1.default.createElement("span", { className: "fas fa-map-marker-alt" }),
|
|
84
|
+
" ",
|
|
85
|
+
T `Circle Centers`));
|
|
93
86
|
const filters = lodash_1.default.clone(this.props.filters) || [];
|
|
94
87
|
if (this.props.design.filter != null) {
|
|
95
88
|
const exprCompiler = new expressions_1.ExprCompiler(this.props.schema);
|
|
@@ -98,32 +91,25 @@ class BufferLayerDesignerComponent extends react_1.default.Component {
|
|
|
98
91
|
filters.push({ table: this.props.design.filter.table, jsonql });
|
|
99
92
|
}
|
|
100
93
|
}
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
types: ["geometry"],
|
|
106
|
-
aggrNeed: "none",
|
|
107
|
-
value: this.props.design.axes.geometry,
|
|
108
|
-
onChange: this.handleGeometryAxisChange,
|
|
109
|
-
filters
|
|
110
|
-
})));
|
|
94
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
95
|
+
react_1.default.createElement("label", { className: "text-muted" }, title),
|
|
96
|
+
react_1.default.createElement("div", { style: { marginLeft: 10 } },
|
|
97
|
+
react_1.default.createElement(AxisComponent_1.default, { schema: this.props.schema, dataSource: this.props.dataSource, table: this.props.design.table, types: ["geometry"], aggrNeed: "none", value: this.props.design.axes.geometry, onChange: this.handleGeometryAxisChange, filters: filters }))));
|
|
111
98
|
}
|
|
112
99
|
renderRadius() {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
const radiusExpr = this.props.design.radiusExpr ?? { type: "literal", valueType: "number", value: this.props.design.radius };
|
|
101
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
102
|
+
react_1.default.createElement("label", { className: "text-muted" }, T `Radius (meters)`),
|
|
103
|
+
":",
|
|
104
|
+
react_1.default.createElement(expressions_ui_1.ExprComponent, { schema: this.props.schema, value: radiusExpr, onChange: this.handleRadiusExprChange, dataSource: this.props.dataSource, table: this.props.design.table, types: ["number"] })));
|
|
117
105
|
}
|
|
118
106
|
renderUnionShapes() {
|
|
119
107
|
// Only implemented for vector maps
|
|
120
108
|
if (!(0, vectorMaps_1.areVectorMapsEnabled)()) {
|
|
121
109
|
return null;
|
|
122
110
|
}
|
|
123
|
-
return
|
|
124
|
-
value: this.props.design.unionShapes,
|
|
125
|
-
onChange: this.handleUnionShapesChange
|
|
126
|
-
}, T `Combine circles (advanced)`));
|
|
111
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
112
|
+
react_1.default.createElement(bootstrap_1.Checkbox, { value: this.props.design.unionShapes, onChange: this.handleUnionShapesChange }, T `Combine circles (advanced)`)));
|
|
127
113
|
}
|
|
128
114
|
renderColor() {
|
|
129
115
|
if (!this.props.design.axes.geometry) {
|
|
@@ -137,81 +123,61 @@ class BufferLayerDesignerComponent extends react_1.default.Component {
|
|
|
137
123
|
filters.push({ table: this.props.design.filter.table, jsonql });
|
|
138
124
|
}
|
|
139
125
|
}
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
defaultColor: this.props.design.color,
|
|
153
|
-
showColorMap: true,
|
|
154
|
-
onChange: this.handleColorAxisChange,
|
|
155
|
-
allowExcludedValues: true,
|
|
156
|
-
reorderable: true,
|
|
157
|
-
filters
|
|
158
|
-
})));
|
|
126
|
+
return (react_1.default.createElement("div", null,
|
|
127
|
+
!this.props.design.axes.color && (react_1.default.createElement("div", { className: "mb-3" },
|
|
128
|
+
react_1.default.createElement("label", { className: "text-muted" },
|
|
129
|
+
react_1.default.createElement("span", { className: "fas fa-tint" }),
|
|
130
|
+
T `Circle Color`),
|
|
131
|
+
react_1.default.createElement("div", null,
|
|
132
|
+
react_1.default.createElement(ColorComponent_1.default, { color: this.props.design.color, onChange: this.handleColorChange })))),
|
|
133
|
+
react_1.default.createElement("div", { className: "mb-3" },
|
|
134
|
+
react_1.default.createElement("label", { className: "text-muted" },
|
|
135
|
+
react_1.default.createElement("span", { className: "fas fa-tint" }),
|
|
136
|
+
T `Color By Data`),
|
|
137
|
+
react_1.default.createElement(AxisComponent_1.default, { schema: this.props.schema, dataSource: this.props.dataSource, table: this.props.design.table, types: ["text", "enum", "boolean", "date"], aggrNeed: "none", value: this.props.design.axes.color, defaultColor: this.props.design.color, showColorMap: true, onChange: this.handleColorAxisChange, allowExcludedValues: true, reorderable: true, filters: filters }))));
|
|
159
138
|
}
|
|
160
139
|
renderFillOpacity() {
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
step: 1,
|
|
165
|
-
tipTransitionName: "rc-slider-tooltip-zoom-down",
|
|
166
|
-
value: this.props.design.fillOpacity * 100,
|
|
167
|
-
onChange: this.handleFillOpacityChange
|
|
168
|
-
}));
|
|
140
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
141
|
+
react_1.default.createElement("label", { className: "text-muted" }, T `Circle Opacity (%)`),
|
|
142
|
+
":",
|
|
143
|
+
react_1.default.createElement(rc_slider_1.default, { min: 0, max: 100, step: 1, tipTransitionName: "rc-slider-tooltip-zoom-down", value: this.props.design.fillOpacity * 100, onChange: this.handleFillOpacityChange })));
|
|
169
144
|
}
|
|
170
145
|
renderFilter() {
|
|
171
146
|
// If no data, hide
|
|
172
147
|
if (!this.props.design.axes.geometry) {
|
|
173
148
|
return null;
|
|
174
149
|
}
|
|
175
|
-
return
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
})));
|
|
150
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
151
|
+
react_1.default.createElement("label", { className: "text-muted" },
|
|
152
|
+
react_1.default.createElement("span", { className: "fas fa-filter" }),
|
|
153
|
+
T `Filters`),
|
|
154
|
+
react_1.default.createElement("div", { style: { marginLeft: 8 } },
|
|
155
|
+
react_1.default.createElement(expressions_ui_1.FilterExprComponent, { schema: this.props.schema, dataSource: this.props.dataSource, onChange: this.handleFilterChange, table: this.props.design.table, value: this.props.design.filter }))));
|
|
182
156
|
}
|
|
183
157
|
renderPopup() {
|
|
184
158
|
if (!this.props.design.table) {
|
|
185
159
|
return null;
|
|
186
160
|
}
|
|
187
|
-
return
|
|
188
|
-
design: this.props.design,
|
|
189
|
-
onDesignChange: this.props.onDesignChange,
|
|
190
|
-
schema: this.props.schema,
|
|
191
|
-
dataSource: this.props.dataSource,
|
|
192
|
-
table: this.props.design.table,
|
|
193
|
-
idTable: this.props.design.table,
|
|
194
|
-
defaultPopupFilterJoins: PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table)
|
|
195
|
-
});
|
|
161
|
+
return (react_1.default.createElement(EditPopupComponent_1.default, { design: this.props.design, onDesignChange: this.props.onDesignChange, schema: this.props.schema, dataSource: this.props.dataSource, table: this.props.design.table, idTable: this.props.design.table, defaultPopupFilterJoins: PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table) }));
|
|
196
162
|
}
|
|
197
163
|
renderHoverOver() {
|
|
198
164
|
if (!this.props.design.table) {
|
|
199
165
|
return null;
|
|
200
166
|
}
|
|
201
|
-
return
|
|
202
|
-
design: this.props.design,
|
|
203
|
-
onDesignChange: this.props.onDesignChange,
|
|
204
|
-
schema: this.props.schema,
|
|
205
|
-
dataSource: this.props.dataSource,
|
|
206
|
-
table: this.props.design.table,
|
|
207
|
-
idTable: this.props.design.table,
|
|
208
|
-
defaultPopupFilterJoins: PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table)
|
|
209
|
-
});
|
|
167
|
+
return (react_1.default.createElement(EditHoverOver_1.default, { design: this.props.design, onDesignChange: this.props.onDesignChange, schema: this.props.schema, dataSource: this.props.dataSource, table: this.props.design.table, idTable: this.props.design.table, defaultPopupFilterJoins: PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table) }));
|
|
210
168
|
}
|
|
211
169
|
render() {
|
|
212
|
-
return
|
|
213
|
-
|
|
214
|
-
|
|
170
|
+
return (react_1.default.createElement("div", null,
|
|
171
|
+
this.renderTable(),
|
|
172
|
+
this.renderGeometryAxis(),
|
|
173
|
+
this.renderRadius(),
|
|
174
|
+
this.renderUnionShapes(),
|
|
175
|
+
this.renderColor(),
|
|
176
|
+
this.renderFillOpacity(),
|
|
177
|
+
this.renderFilter(),
|
|
178
|
+
this.renderPopup(),
|
|
179
|
+
this.renderHoverOver(),
|
|
180
|
+
this.props.design.table && (react_1.default.createElement(ZoomLevelsComponent_1.default, { design: this.props.design, onDesignChange: this.props.onDesignChange }))));
|
|
215
181
|
}
|
|
216
182
|
}
|
|
217
183
|
exports.default = BufferLayerDesignerComponent;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Layer, { OnGridClickOptions, OnGridHoverOptions, VectorTileDef } from "./Layer";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import Layer, { OnGridClickOptions, OnGridHoverOptions, VectorTileDef, LegendOptions } from "./Layer";
|
|
3
3
|
import { Schema, DataSource } from "@mwater/expressions";
|
|
4
4
|
import { LayerDefinition, OnGridClickResults, OnGridHoverResults } from "./maps";
|
|
5
5
|
import { JsonQLFilter } from "../index";
|
|
6
6
|
import ChoroplethLayerDesign from "./ChoroplethLayerDesign";
|
|
7
7
|
import { JsonQLQuery } from "@mwater/jsonql";
|
|
8
|
-
import LayerLegendComponent from "./LayerLegendComponent";
|
|
9
8
|
export default class ChoroplethLayer extends Layer<ChoroplethLayerDesign> {
|
|
10
9
|
/** Gets the type of layer definition */
|
|
11
10
|
getLayerDefinitionType(): "VectorTile";
|
|
@@ -58,7 +57,7 @@ export default class ChoroplethLayer extends Layer<ChoroplethLayerDesign> {
|
|
|
58
57
|
getBounds(design: ChoroplethLayerDesign, schema: Schema, dataSource: DataSource, filters: JsonQLFilter[], callback: any): void;
|
|
59
58
|
getMinZoom(design: ChoroplethLayerDesign): number | undefined;
|
|
60
59
|
getMaxZoom(design: ChoroplethLayerDesign): number;
|
|
61
|
-
getLegend(
|
|
60
|
+
getLegend(options: LegendOptions<ChoroplethLayerDesign>): ReactNode;
|
|
62
61
|
getFilterableTables(design: ChoroplethLayerDesign, schema: Schema): string[];
|
|
63
62
|
/** True if layer can be edited */
|
|
64
63
|
isEditable(): boolean;
|
|
@@ -71,4 +70,6 @@ export default class ChoroplethLayer extends Layer<ChoroplethLayerDesign> {
|
|
|
71
70
|
onDesignChange: (design: ChoroplethLayerDesign) => void;
|
|
72
71
|
filters: JsonQLFilter[];
|
|
73
72
|
}): React.ReactElement<{}>;
|
|
73
|
+
/** Get strings to be translated */
|
|
74
|
+
getTranslatableStrings(design: ChoroplethLayerDesign, schema: Schema): string[];
|
|
74
75
|
}
|
|
@@ -37,6 +37,8 @@ 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
|
+
const BlocksLayoutManager_1 = __importDefault(require("../layouts/blocks/BlocksLayoutManager"));
|
|
41
|
+
const DashboardUtils_1 = require("../dashboards/DashboardUtils");
|
|
40
42
|
class ChoroplethLayer extends Layer_1.default {
|
|
41
43
|
/** Gets the type of layer definition */
|
|
42
44
|
getLayerDefinitionType() {
|
|
@@ -1228,10 +1230,10 @@ class ChoroplethLayer extends Layer_1.default {
|
|
|
1228
1230
|
design: options.design,
|
|
1229
1231
|
scope: null,
|
|
1230
1232
|
filters,
|
|
1231
|
-
onScopeChange: null,
|
|
1232
|
-
onDesignChange: null,
|
|
1233
1233
|
width: options.width,
|
|
1234
|
-
height: options.height
|
|
1234
|
+
height: options.height,
|
|
1235
|
+
locale: clickOptions.locale,
|
|
1236
|
+
translate: clickOptions.translate
|
|
1235
1237
|
});
|
|
1236
1238
|
}
|
|
1237
1239
|
});
|
|
@@ -1272,8 +1274,11 @@ class ChoroplethLayer extends Layer_1.default {
|
|
|
1272
1274
|
key: ev.data.id,
|
|
1273
1275
|
schema: hoverOptions.schema,
|
|
1274
1276
|
dataSource: hoverOptions.dataSource,
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
+
table,
|
|
1278
|
+
items: hoverOptions.design.hoverOver.items,
|
|
1279
|
+
filters: popupFilters,
|
|
1280
|
+
locale: hoverOptions.locale,
|
|
1281
|
+
translate: hoverOptions.translate
|
|
1277
1282
|
});
|
|
1278
1283
|
}
|
|
1279
1284
|
return results;
|
|
@@ -1326,10 +1331,8 @@ class ChoroplethLayer extends Layer_1.default {
|
|
|
1326
1331
|
}
|
|
1327
1332
|
// Get the legend to be optionally displayed on the map. Returns
|
|
1328
1333
|
// a React element
|
|
1329
|
-
getLegend(
|
|
1330
|
-
|
|
1331
|
-
filters = [];
|
|
1332
|
-
}
|
|
1334
|
+
getLegend(options) {
|
|
1335
|
+
const { design, schema, name, dataSource, locale, filters } = options;
|
|
1333
1336
|
const _filters = filters.slice();
|
|
1334
1337
|
if (design.filter != null) {
|
|
1335
1338
|
const exprCompiler = new expressions_1.ExprCompiler(schema);
|
|
@@ -1512,5 +1515,25 @@ class ChoroplethLayer extends Layer_1.default {
|
|
|
1512
1515
|
}
|
|
1513
1516
|
});
|
|
1514
1517
|
}
|
|
1518
|
+
/** Get strings to be translated */
|
|
1519
|
+
getTranslatableStrings(design, schema) {
|
|
1520
|
+
const strings = [];
|
|
1521
|
+
// Add strings from hoverOver items
|
|
1522
|
+
if (design.hoverOver && design.hoverOver.items) {
|
|
1523
|
+
for (const item of design.hoverOver.items) {
|
|
1524
|
+
if (item.label) {
|
|
1525
|
+
strings.push(item.label);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
// Add strings from popup items using a layout manager approach
|
|
1530
|
+
if (design.popup && design.popup.items) {
|
|
1531
|
+
const layoutManager = new BlocksLayoutManager_1.default();
|
|
1532
|
+
const popupStrings = (0, DashboardUtils_1.getTranslatableStringsFromLayoutManager)(layoutManager, design.popup.items, schema);
|
|
1533
|
+
strings.push(...popupStrings);
|
|
1534
|
+
}
|
|
1535
|
+
// Remove duplicates
|
|
1536
|
+
return lodash_1.default.uniq(strings);
|
|
1537
|
+
}
|
|
1515
1538
|
}
|
|
1516
1539
|
exports.default = ChoroplethLayer;
|
|
@@ -1,6 +1,8 @@
|
|
|
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
|
/**
|
|
5
7
|
* Layer that is composed of regions colored. Now extended to any other regions as well, so name
|
|
6
8
|
* is legacy, as is adminRegionExpr field.
|
|
@@ -43,12 +45,14 @@ export default interface ChoroplethLayerDesign {
|
|
|
43
45
|
/** true to display name labels on regions */
|
|
44
46
|
displayNames: boolean;
|
|
45
47
|
/** contains items: which is BlocksLayoutManager items. Will be displayed when the region is clicked. Only when region mode is "indirect" */
|
|
46
|
-
popup:
|
|
48
|
+
popup: {
|
|
49
|
+
items: LayoutBlock;
|
|
50
|
+
};
|
|
47
51
|
hoverOver: {
|
|
48
52
|
items: HoverOverItem[];
|
|
49
53
|
};
|
|
50
54
|
/** customizable filtering for popup. See PopupFilterJoins.md. Only when region mode is "indirect" */
|
|
51
|
-
popupFilterJoins:
|
|
55
|
+
popupFilterJoins: PopupFilterJoins;
|
|
52
56
|
/** minimum zoom level */
|
|
53
57
|
minZoom?: number;
|
|
54
58
|
/** maximum zoom level */
|
|
@@ -146,7 +146,8 @@ class ChoroplethLayerDesigner extends react_1.default.Component {
|
|
|
146
146
|
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
147
147
|
react_1.default.createElement("label", { className: "text-muted" },
|
|
148
148
|
react_1.default.createElement("i", { className: "fa fa-database" }),
|
|
149
|
-
|
|
149
|
+
" ",
|
|
150
|
+
T `Data Source`),
|
|
150
151
|
react_1.default.createElement(expressions_ui_2.TableSelectComponent, { schema: this.props.schema, value: this.props.design.table, onChange: this.handleTableChange, filter: this.props.design.filter, onFilterChange: this.handleFilterChange })));
|
|
151
152
|
}
|
|
152
153
|
renderRegionsTable() {
|
|
@@ -173,7 +174,8 @@ class ChoroplethLayerDesigner extends react_1.default.Component {
|
|
|
173
174
|
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
174
175
|
react_1.default.createElement("label", { className: "text-muted" },
|
|
175
176
|
react_1.default.createElement("i", { className: "fas fa-map-marker-alt" }),
|
|
176
|
-
|
|
177
|
+
" ",
|
|
178
|
+
T `Location`),
|
|
177
179
|
react_1.default.createElement("div", { style: { marginLeft: 8 } },
|
|
178
180
|
react_1.default.createElement(expressions_ui_1.ExprComponent, { schema: this.props.schema, dataSource: this.props.dataSource, onChange: this.handleAdminRegionExprChange, table: this.props.design.table, types: ["id"], idTable: regionsTable, value: this.props.design.adminRegionExpr || null }))));
|
|
179
181
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
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 { ClusterLayerDesign } from "./ClusterLayerDesign";
|
|
6
|
-
import Layer, { VectorTileDef } from "./Layer";
|
|
7
|
-
import LayerLegendComponent from "./LayerLegendComponent";
|
|
6
|
+
import Layer, { LegendOptions, VectorTileDef } from "./Layer";
|
|
8
7
|
export default class ClusterLayer extends Layer<ClusterLayerDesign> {
|
|
9
8
|
/** Gets the type of layer definition */
|
|
10
9
|
getLayerDefinitionType(): "VectorTile";
|
|
@@ -22,7 +21,7 @@ export default class ClusterLayer extends Layer<ClusterLayerDesign> {
|
|
|
22
21
|
getBounds(design: ClusterLayerDesign, schema: Schema, dataSource: DataSource, filters: JsonQLFilter[], callback: any): void;
|
|
23
22
|
getMinZoom(design: ClusterLayerDesign): number | undefined;
|
|
24
23
|
getMaxZoom(design: ClusterLayerDesign): number;
|
|
25
|
-
getLegend(
|
|
24
|
+
getLegend(options: LegendOptions<ClusterLayerDesign>): ReactNode;
|
|
26
25
|
getFilterableTables(design: ClusterLayerDesign, schema: Schema): string[];
|
|
27
26
|
isEditable(): boolean;
|
|
28
27
|
isIncomplete(design: ClusterLayerDesign, schema: Schema): boolean;
|
package/lib/maps/ClusterLayer.js
CHANGED
|
@@ -643,7 +643,8 @@ class ClusterLayer extends Layer_1.default {
|
|
|
643
643
|
}
|
|
644
644
|
// Get the legend to be optionally displayed on the map. Returns
|
|
645
645
|
// a React element
|
|
646
|
-
getLegend(
|
|
646
|
+
getLegend(options) {
|
|
647
|
+
const { design, schema, name, dataSource, locale, filters } = options;
|
|
647
648
|
const _filters = filters.slice();
|
|
648
649
|
if (design.filter != null) {
|
|
649
650
|
const exprCompiler = new expressions_1.ExprCompiler(schema);
|
|
@@ -84,7 +84,7 @@ class DetailLevelSelectComponent extends react_1.default.Component {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
|
-
return R("div", { className: "text-muted" }, R("i", { className: "fa fa-spinner fa-spin" }), T `
|
|
87
|
+
return R("div", { className: "text-muted" }, R("i", { className: "fa fa-spinner fa-spin" }), " ", T `Loading...`);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -86,7 +86,8 @@ async function getVectorTileFromDirectRequest(options) {
|
|
|
86
86
|
throw new Error("Error getting tiles");
|
|
87
87
|
}
|
|
88
88
|
const { token, expires } = await response.json();
|
|
89
|
-
|
|
89
|
+
// Client isn't necessary, but allows tracking of usage easier
|
|
90
|
+
return { url: apiUrl + `vector_tiles/tiles/{z}/{x}/{y}?token=${token}&client=${client ?? ""}`, expires };
|
|
90
91
|
}
|
|
91
92
|
/**
|
|
92
93
|
* React hook to get a direct URL for a vector tile source.
|
|
@@ -29,8 +29,8 @@ class EditPopupComponent extends react_1.default.Component {
|
|
|
29
29
|
return this.props.onDesignChange(design);
|
|
30
30
|
};
|
|
31
31
|
render() {
|
|
32
|
-
return R("div", null, R("a", { className: "btn btn-link", onClick: () => this.setState({ editing: true }) }, R("i", { className: "fa fa-pencil" }), T `
|
|
33
|
-
? R("a", { className: "btn btn-link", onClick: this.handleRemovePopup }, R("i", { className: "fa fa-times" }), T `
|
|
32
|
+
return R("div", null, R("a", { className: "btn btn-link", onClick: () => this.setState({ editing: true }) }, R("i", { className: "fa fa-pencil" }), " ", T `Customize Popup`), this.props.design.popup
|
|
33
|
+
? R("a", { className: "btn btn-link", onClick: this.handleRemovePopup }, R("i", { className: "fa fa-times" }), " ", T `Remove Popup`)
|
|
34
34
|
: undefined, this.props.design.popup
|
|
35
35
|
? R(PopupFilterJoinsEditComponent_1.default, {
|
|
36
36
|
schema: this.props.schema,
|
|
@@ -62,10 +62,12 @@ class EditPopupComponent extends react_1.default.Component {
|
|
|
62
62
|
design: options.design,
|
|
63
63
|
scope: null,
|
|
64
64
|
filters: [],
|
|
65
|
-
onScopeChange: () => { },
|
|
66
65
|
onDesignChange: options.onDesignChange,
|
|
67
66
|
width: options.width,
|
|
68
67
|
height: options.height,
|
|
68
|
+
// TODO: fix
|
|
69
|
+
locale: "en",
|
|
70
|
+
translate: (input) => input,
|
|
69
71
|
singleRowTable: this.props.table
|
|
70
72
|
});
|
|
71
73
|
}
|
package/lib/maps/GridLayer.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Layer, { VectorTileDef } from "./Layer";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import Layer, { LegendOptions, VectorTileDef } from "./Layer";
|
|
3
3
|
import { Schema, DataSource } from "@mwater/expressions";
|
|
4
4
|
import { LayerDefinition } from "./maps";
|
|
5
5
|
import { JsonQLFilter } from "../index";
|
|
6
6
|
import GridLayerDesign from "./GridLayerDesign";
|
|
7
7
|
import { JsonQLQuery } from "@mwater/jsonql";
|
|
8
|
-
import LayerLegendComponent from "./LayerLegendComponent";
|
|
9
8
|
/** Layer which is a grid of squares or flat-topped hexagons. Depends on "Grid Functions.sql" having been run */
|
|
10
9
|
export default class GridLayer extends Layer<GridLayerDesign> {
|
|
11
10
|
/** Gets the type of layer definition */
|
|
@@ -30,7 +29,7 @@ export default class GridLayer extends Layer<GridLayerDesign> {
|
|
|
30
29
|
getMaxZoom(design: GridLayerDesign): number;
|
|
31
30
|
/** Get the legend to be optionally displayed on the map. Returns
|
|
32
31
|
* a React element */
|
|
33
|
-
getLegend(
|
|
32
|
+
getLegend(options: LegendOptions<GridLayerDesign>): ReactNode;
|
|
34
33
|
getFilterableTables(design: GridLayerDesign, schema: Schema): string[];
|
|
35
34
|
/** True if layer can be edited */
|
|
36
35
|
isEditable(): boolean;
|
package/lib/maps/GridLayer.js
CHANGED
|
@@ -563,7 +563,8 @@ class GridLayer extends Layer_1.default {
|
|
|
563
563
|
}
|
|
564
564
|
/** Get the legend to be optionally displayed on the map. Returns
|
|
565
565
|
* a React element */
|
|
566
|
-
getLegend(
|
|
566
|
+
getLegend(options) {
|
|
567
|
+
const { design, schema, name, dataSource, locale, filters } = options;
|
|
567
568
|
const axisBuilder = new AxisBuilder_1.default({ schema });
|
|
568
569
|
return react_1.default.createElement(LayerLegendComponent_1.default, {
|
|
569
570
|
schema,
|
|
@@ -125,7 +125,8 @@ class GridLayerDesigner extends react_1.default.Component {
|
|
|
125
125
|
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
126
126
|
react_1.default.createElement("label", { className: "text-muted" },
|
|
127
127
|
react_1.default.createElement("i", { className: "fa fa-database" }),
|
|
128
|
-
|
|
128
|
+
" ",
|
|
129
|
+
T `Data Source`),
|
|
129
130
|
react_1.default.createElement(expressions_ui_2.TableSelectComponent, { schema: this.props.schema, value: this.props.design.table, onChange: this.handleTableChange, filter: this.props.design.filter, onFilterChange: this.handleFilterChange })));
|
|
130
131
|
}
|
|
131
132
|
renderGeometryExpr() {
|
|
@@ -136,7 +137,8 @@ class GridLayerDesigner extends react_1.default.Component {
|
|
|
136
137
|
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
137
138
|
react_1.default.createElement("label", { className: "text-muted" },
|
|
138
139
|
react_1.default.createElement("i", { className: "fas fa-map-marker-alt" }),
|
|
139
|
-
|
|
140
|
+
" ",
|
|
141
|
+
T `Location`),
|
|
140
142
|
react_1.default.createElement("div", { style: { marginLeft: 8 } },
|
|
141
143
|
react_1.default.createElement(expressions_ui_1.ExprComponent, { schema: this.props.schema, dataSource: this.props.dataSource, onChange: this.handleGeometryExprChange, table: this.props.design.table, types: ["geometry"], value: this.props.design.geometryExpr }))));
|
|
142
144
|
}
|
|
@@ -191,7 +193,7 @@ class GridLayerDesigner extends react_1.default.Component {
|
|
|
191
193
|
if (!this.props.design.table) {
|
|
192
194
|
return null;
|
|
193
195
|
}
|
|
194
|
-
return R("div", { className: "mb-3" }, R("label", { className: "text-muted" }, R("span", { className: "fas fa-filter" }), T `
|
|
196
|
+
return R("div", { className: "mb-3" }, R("label", { className: "text-muted" }, R("span", { className: "fas fa-filter" }), " ", T `Filters`), R("div", { style: { marginLeft: 8 } }, R(expressions_ui_1.FilterExprComponent, {
|
|
195
197
|
schema: this.props.schema,
|
|
196
198
|
dataSource: this.props.dataSource,
|
|
197
199
|
onChange: this.handleFilterChange,
|