@mwater/visualization 5.4.0 → 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 +3 -3
- 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/PivotChartDesignerComponent.d.ts +1 -0
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +1 -1
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +6 -0
- 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 +4 -4
- 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,54 +1,57 @@
|
|
|
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
|
/** Design for a markers layer */
|
|
6
8
|
export interface MarkersLayerDesign {
|
|
7
9
|
/** table to get data from */
|
|
8
10
|
table: string
|
|
9
11
|
|
|
10
|
-
/**
|
|
12
|
+
/** Axes */
|
|
11
13
|
axes: {
|
|
12
|
-
/**
|
|
14
|
+
/** Where to place markers */
|
|
13
15
|
geometry: Axis
|
|
14
16
|
|
|
15
|
-
/**
|
|
17
|
+
/** Color axis (to split into series based on a color) */
|
|
16
18
|
color?: Axis
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
/**
|
|
21
|
+
/** Optional logical expression to filter by */
|
|
20
22
|
filter?: Expr
|
|
21
23
|
|
|
22
|
-
/**
|
|
24
|
+
/** Color of layer (e.g. #FF8800). Color axis overrides */
|
|
23
25
|
color?: string
|
|
24
26
|
|
|
25
|
-
/**
|
|
27
|
+
/** Symbol to use for layer. e.g. "font-awesome/bell". Will be converted on server to proper uri. */
|
|
26
28
|
symbol?: string
|
|
27
29
|
|
|
28
|
-
/**
|
|
30
|
+
/** Size in pixels of the markers. Default 10. */
|
|
29
31
|
markerSize?: number
|
|
30
32
|
|
|
31
|
-
/**
|
|
33
|
+
/** Size of the lines in pixels. Default 3 */
|
|
32
34
|
lineWidth?: number
|
|
33
35
|
|
|
34
|
-
/**
|
|
36
|
+
/** Opacity of polygon fill (0-1). Default is 0.25 */
|
|
35
37
|
polygonFillOpacity?: number
|
|
36
38
|
|
|
37
|
-
/**
|
|
39
|
+
/** Color of polygon borders (defaults to color of fill) */
|
|
38
40
|
polygonBorderColor?: string
|
|
39
41
|
|
|
40
|
-
/**
|
|
41
|
-
popup: { items:
|
|
42
|
+
/** Contains items: which is BlocksLayoutManager items. Will be displayed when the marker is clicked */
|
|
43
|
+
popup: { items: LayoutBlock }
|
|
42
44
|
|
|
45
|
+
/** Contains items to display when hovering over the layer */
|
|
43
46
|
hoverOver: { items: HoverOverItem[] }
|
|
44
47
|
|
|
45
|
-
/**
|
|
46
|
-
popupFilterJoins:
|
|
48
|
+
/** Customizable filtering for popup */
|
|
49
|
+
popupFilterJoins: PopupFilterJoins
|
|
47
50
|
|
|
48
|
-
/**
|
|
51
|
+
/** Minimum zoom level */
|
|
49
52
|
minZoom?: number
|
|
50
53
|
|
|
51
|
-
/**
|
|
54
|
+
/** Maximum zoom level */
|
|
52
55
|
maxZoom?: number
|
|
53
56
|
|
|
54
57
|
/** @deprecated LEGACY sublayers array that contains above design */
|
|
@@ -3,7 +3,6 @@ import { ExprUtils } from "@mwater/expressions"
|
|
|
3
3
|
import { JsonQLFilter } from ".."
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Utilities for popup filter joins.
|
|
7
6
|
* Object keyed by table name that has expressions as values.
|
|
8
7
|
* Each value is an expression for its key's table that is a type `id` or `idTable` of the layer's table.
|
|
9
8
|
* This is used to filter the popup so that the rows are scoped to the item clicked on.
|
|
@@ -11,8 +10,13 @@ import { JsonQLFilter } from ".."
|
|
|
11
10
|
* However, it could also filter to only water points that are related to the water system by adding the following key-value:
|
|
12
11
|
* entities.water_point: { table: "entities.water_point", type: "field", column: "water_system" }
|
|
13
12
|
*/
|
|
13
|
+
export type PopupFilterJoins = { [tableId: string]: Expr }
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Utilities for popup filter joins.
|
|
17
|
+
*/
|
|
14
18
|
export function createPopupFilters(
|
|
15
|
-
popupFilterJoins:
|
|
19
|
+
popupFilterJoins: PopupFilterJoins,
|
|
16
20
|
schema: Schema,
|
|
17
21
|
layerTable: any,
|
|
18
22
|
rowId: any,
|
|
@@ -10,53 +10,12 @@ import { LayerSwitcherComponent } from "./LayerSwitcherComponent"
|
|
|
10
10
|
import { default as LegendComponent } from "./LegendComponent"
|
|
11
11
|
import { JsonQLFilter } from "../JsonQLFilter"
|
|
12
12
|
import { MapDesign } from "./MapDesign"
|
|
13
|
-
import { MapDataSource } from "./MapDataSource"
|
|
14
|
-
import { MapScope } from "./MapUtils"
|
|
15
13
|
import { LocaleContext } from "@mwater/expressions-ui"
|
|
14
|
+
import { MapViewComponentProps } from "./MapViewComponent"
|
|
16
15
|
|
|
17
|
-
export interface RasterMapViewComponentProps {
|
|
18
|
-
schema: Schema
|
|
19
|
-
dataSource: DataSource
|
|
20
|
-
mapDataSource: MapDataSource
|
|
21
|
-
|
|
22
|
-
design: MapDesign
|
|
23
|
-
onDesignChange?: (design: MapDesign) => void
|
|
24
|
-
|
|
25
|
-
/** Width in pixels */
|
|
26
|
-
width: number
|
|
27
|
-
|
|
28
|
-
/** Height in pixels */
|
|
29
|
-
height: number
|
|
30
|
-
|
|
31
|
-
/** Called with (tableId, rowId) when item is clicked */
|
|
32
|
-
onRowClick?: (tableId: string, rowId: any) => void
|
|
33
|
-
|
|
34
|
-
/** Extra filters to apply to view */
|
|
35
|
-
extraFilters?: JsonQLFilter[]
|
|
36
|
-
|
|
37
|
-
/** scope of the map (when a layer self-selects a particular scope) */
|
|
38
|
-
scope?: MapScope
|
|
39
|
-
|
|
40
|
-
/** called with (scope) as a scope to apply to self and filter to apply to other widgets. See WidgetScoper for details */
|
|
41
|
-
onScopeChange?: (scope: MapScope | null) => void
|
|
42
|
-
|
|
43
|
-
/** Whether the map be draggable with mouse/touch or not. Default true */
|
|
44
|
-
dragging?: boolean
|
|
45
|
-
|
|
46
|
-
/** Whether the map can be zoomed by touch-dragging with two fingers. Default true */
|
|
47
|
-
touchZoom?: boolean
|
|
48
|
-
|
|
49
|
-
/** Whether the map can be zoomed by using the mouse wheel. Default true */
|
|
50
|
-
scrollWheelZoom?: boolean
|
|
51
|
-
|
|
52
|
-
/** Whether changes to zoom level should be persisted. Default false */
|
|
53
|
-
zoomLocked?: boolean
|
|
54
|
-
|
|
16
|
+
export interface RasterMapViewComponentProps extends MapViewComponentProps {
|
|
55
17
|
/** Called with underlying leaflet map component */
|
|
56
18
|
leafletMapRef?: (map: LeafletMapComponent | null) => void
|
|
57
|
-
|
|
58
|
-
/** Whether to disable interaction or not. Default false (implemented for printing to reduce number of tiles request) */
|
|
59
|
-
disableInteraction?: boolean
|
|
60
19
|
}
|
|
61
20
|
|
|
62
21
|
/** Component that displays just the map, using raster tile technology */
|
|
@@ -154,13 +113,16 @@ export default class RasterMapViewComponent extends React.Component<
|
|
|
154
113
|
const design = layer.cleanDesign(layerView.design, this.props.schema)
|
|
155
114
|
|
|
156
115
|
// Handle click of layer
|
|
116
|
+
// TODO not translated
|
|
157
117
|
const results = layer.onGridClick(ev, {
|
|
158
118
|
design,
|
|
159
119
|
schema: this.props.schema,
|
|
160
120
|
dataSource: this.props.dataSource,
|
|
161
121
|
layerDataSource: this.props.mapDataSource.getLayerDataSource(layerViewId),
|
|
162
122
|
scopeData: this.props.scope?.data?.layerViewId === layerViewId ? this.props.scope!.data.data : undefined,
|
|
163
|
-
filters: this.getCompiledFilters()
|
|
123
|
+
filters: this.getCompiledFilters(),
|
|
124
|
+
locale: this.context,
|
|
125
|
+
translate: (input: string) => input
|
|
164
126
|
})
|
|
165
127
|
|
|
166
128
|
if (!results) {
|
|
@@ -216,6 +178,7 @@ export default class RasterMapViewComponent extends React.Component<
|
|
|
216
178
|
filters: this.getCompiledFilters(),
|
|
217
179
|
dataSource: this.props.dataSource,
|
|
218
180
|
locale: this.context,
|
|
181
|
+
translate: this.props.translate ?? (() => ""),
|
|
219
182
|
onHide: () => this.setState({ legendHidden: true }),
|
|
220
183
|
zoom: null
|
|
221
184
|
})
|
|
@@ -322,7 +285,8 @@ export default class RasterMapViewComponent extends React.Component<
|
|
|
322
285
|
this.props.onDesignChange && this.props.design.showLayerSwitcher
|
|
323
286
|
? R(LayerSwitcherComponent, {
|
|
324
287
|
design: this.props.design,
|
|
325
|
-
onDesignChange: this.props.onDesignChange
|
|
288
|
+
onDesignChange: this.props.onDesignChange,
|
|
289
|
+
translate: this.props.translate ?? (() => "")
|
|
326
290
|
})
|
|
327
291
|
: undefined
|
|
328
292
|
)
|
|
@@ -184,8 +184,8 @@ class ServerLayerDataSource implements MapLayerDataSource {
|
|
|
184
184
|
throw new Error("Error getting tiles token")
|
|
185
185
|
}
|
|
186
186
|
const { token, expires } = await response.json()
|
|
187
|
-
|
|
188
|
-
return { url: this.options.apiUrl + `vector_tiles/tiles/{z}/{x}/{y}?token=${token}`, expires }
|
|
187
|
+
// Client isn't necessary, but allows tracking of usage easier
|
|
188
|
+
return { url: this.options.apiUrl + `vector_tiles/tiles/{z}/{x}/{y}?token=${token}&client=${this.options.client ?? ""}`, expires }
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
// Gets widget data source for a popup widget
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _ from "lodash"
|
|
2
|
-
import Layer from "./Layer"
|
|
2
|
+
import Layer, { LegendOptions } from "./Layer"
|
|
3
3
|
import { LocalizedString, Schema, DataSource } from "@mwater/expressions"
|
|
4
4
|
import { JsonQLFilter } from "../index"
|
|
5
|
-
import React from "react"
|
|
5
|
+
import React, { ReactNode } from "react"
|
|
6
6
|
import { HtmlUrlLegend } from "./HtmlUrlLegend"
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -79,14 +79,8 @@ export default class SwitchableTileUrlLayer extends Layer<SwitchableTileUrlLayer
|
|
|
79
79
|
return option.utfGridUrl || null
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
getLegend(
|
|
83
|
-
design
|
|
84
|
-
schema: Schema,
|
|
85
|
-
name: string,
|
|
86
|
-
dataSource: DataSource,
|
|
87
|
-
locale: string,
|
|
88
|
-
filters: JsonQLFilter[]
|
|
89
|
-
) {
|
|
82
|
+
getLegend(options: LegendOptions<SwitchableTileUrlLayerDesign>): ReactNode {
|
|
83
|
+
const { design, name } = options
|
|
90
84
|
// Find active option
|
|
91
85
|
const option = design.options.find((d) => d.id === design.activeOption)
|
|
92
86
|
if (!option || !option.legendUrl) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _ from "lodash"
|
|
2
|
-
import React from "react"
|
|
2
|
+
import React, { ReactNode } from "react"
|
|
3
3
|
const R = React.createElement
|
|
4
4
|
|
|
5
|
-
import Layer from "./Layer"
|
|
5
|
+
import Layer, { LegendOptions } from "./Layer"
|
|
6
6
|
import { DataSource, ExprCompiler, Schema } from "@mwater/expressions"
|
|
7
7
|
import { JsonQLFilter } from "../JsonQLFilter"
|
|
8
8
|
import { HtmlUrlLegend } from "./HtmlUrlLegend"
|
|
@@ -64,14 +64,8 @@ export default class TileUrlLayer extends Layer<TileUrlLayerDesign> {
|
|
|
64
64
|
return this.validateDesign(this.cleanDesign(design, schema), schema) != null
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
getLegend(
|
|
68
|
-
design
|
|
69
|
-
schema: Schema,
|
|
70
|
-
name: string,
|
|
71
|
-
dataSource: DataSource,
|
|
72
|
-
locale: string,
|
|
73
|
-
filters: JsonQLFilter[]
|
|
74
|
-
) {
|
|
67
|
+
getLegend(options: LegendOptions<TileUrlLayerDesign>): ReactNode {
|
|
68
|
+
const { design } = options
|
|
75
69
|
// Find active option
|
|
76
70
|
if (!design.legendUrl) {
|
|
77
71
|
return null
|
|
@@ -26,57 +26,17 @@ import {
|
|
|
26
26
|
useStyleMap,
|
|
27
27
|
useVectorMap
|
|
28
28
|
} from "./vectorMaps"
|
|
29
|
+
import { MapViewComponentProps } from "./MapViewComponent"
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
export function VectorMapViewComponent(props: {
|
|
32
|
-
schema: Schema
|
|
33
|
-
dataSource: DataSource
|
|
34
|
-
mapDataSource: MapDataSource
|
|
35
|
-
|
|
36
|
-
design: MapDesign
|
|
37
|
-
onDesignChange?: (design: MapDesign) => void
|
|
38
|
-
|
|
39
|
-
/** Width in pixels */
|
|
40
|
-
width: number
|
|
41
|
-
|
|
42
|
-
/** Height in pixels */
|
|
43
|
-
height: number
|
|
44
|
-
|
|
45
|
-
/** Called with (tableId, rowId) when item is clicked */
|
|
46
|
-
onRowClick?: (tableId: string, rowId: any) => void
|
|
47
|
-
|
|
48
|
-
/** Extra filters to apply to view */
|
|
49
|
-
extraFilters?: JsonQLFilter[]
|
|
50
|
-
|
|
51
|
-
/** scope of the map (when a layer self-selects a particular scope) */
|
|
52
|
-
scope?: MapScope
|
|
53
|
-
|
|
54
|
-
/** called with (scope) as a scope to apply to self and filter to apply to other widgets. See WidgetScoper for details */
|
|
55
|
-
onScopeChange?: (scope: MapScope | null) => void
|
|
56
|
-
|
|
57
|
-
/** Whether the map be draggable with mouse/touch or not. Default true */
|
|
58
|
-
dragging?: boolean
|
|
59
|
-
|
|
60
|
-
/** Whether the map can be zoomed by touch-dragging with two fingers. Default true */
|
|
61
|
-
touchZoom?: boolean
|
|
62
|
-
|
|
63
|
-
/** Whether the map can be zoomed by using the mouse wheel. Default true */
|
|
64
|
-
scrollWheelZoom?: boolean
|
|
65
|
-
|
|
66
|
-
/** Whether changes to zoom level should be persisted. Default false */
|
|
67
|
-
zoomLocked?: boolean
|
|
68
|
-
|
|
69
|
-
/** Locale to use. Overrides map design locale */
|
|
70
|
-
locale?: string
|
|
71
|
-
|
|
72
|
-
/** Increment to force refresh */
|
|
73
|
-
refreshTrigger?: number
|
|
74
|
-
|
|
31
|
+
export interface VectorMapViewComponentProps extends MapViewComponentProps {
|
|
75
32
|
/** Optional callback that gets updated MapLibre map each render. Used to allow
|
|
76
33
|
* external zooming/panning.
|
|
77
34
|
*/
|
|
78
35
|
onMapUpdate?: (map: maplibregl.Map) => void
|
|
79
|
-
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Component that displays just the map, using vector tile technology */
|
|
39
|
+
export function VectorMapViewComponent(props: VectorMapViewComponentProps) {
|
|
80
40
|
const [mapDiv, setMapDiv] = useState<HTMLDivElement | null>(null)
|
|
81
41
|
|
|
82
42
|
/** Last published bounds, to avoid recentering when self-changed bounds */
|
|
@@ -113,6 +73,12 @@ export function VectorMapViewComponent(props: {
|
|
|
113
73
|
initialLegendDisplay == "closed" || (props.width < 500 && initialLegendDisplay == "closedIfSmall")
|
|
114
74
|
)
|
|
115
75
|
|
|
76
|
+
// Locale to use
|
|
77
|
+
const locale = props.locale || props.design.locale || "en"
|
|
78
|
+
|
|
79
|
+
// Translate function to use TODO
|
|
80
|
+
const translate = props.translate || ((input: string) => input)
|
|
81
|
+
|
|
116
82
|
// Last feature that mouse entered
|
|
117
83
|
const lastFeature = useRef<string>()
|
|
118
84
|
|
|
@@ -145,11 +111,11 @@ export function VectorMapViewComponent(props: {
|
|
|
145
111
|
const layer = LayerFactory.createLayer(layerView.type)
|
|
146
112
|
|
|
147
113
|
// Clean design (prevent ever displaying invalid/legacy designs)
|
|
148
|
-
const
|
|
114
|
+
const layerDesign = layer.cleanDesign(layerView.design, props.schema)
|
|
149
115
|
|
|
150
116
|
// Handle click of layer
|
|
151
117
|
const results = layer.onGridHoverOver(ev, {
|
|
152
|
-
design:
|
|
118
|
+
design: layerDesign,
|
|
153
119
|
schema: props.schema,
|
|
154
120
|
dataSource: props.dataSource,
|
|
155
121
|
layerDataSource: props.mapDataSource.getLayerDataSource(layerViewId),
|
|
@@ -157,7 +123,9 @@ export function VectorMapViewComponent(props: {
|
|
|
157
123
|
props.scope && props.scope.data && props.scope.data.layerViewId == layerViewId
|
|
158
124
|
? props.scope.data.data
|
|
159
125
|
: undefined,
|
|
160
|
-
filters: getCompiledFilters()
|
|
126
|
+
filters: getCompiledFilters(),
|
|
127
|
+
locale: locale,
|
|
128
|
+
translate: translate
|
|
161
129
|
})
|
|
162
130
|
|
|
163
131
|
if (!results) {
|
|
@@ -191,7 +159,9 @@ export function VectorMapViewComponent(props: {
|
|
|
191
159
|
props.scope && props.scope.data && props.scope.data.layerViewId == layerViewId
|
|
192
160
|
? props.scope.data.data
|
|
193
161
|
: undefined,
|
|
194
|
-
filters: getCompiledFilters()
|
|
162
|
+
filters: getCompiledFilters(),
|
|
163
|
+
locale: locale,
|
|
164
|
+
translate: translate
|
|
195
165
|
})
|
|
196
166
|
|
|
197
167
|
if (!results) {
|
|
@@ -505,7 +475,10 @@ export function VectorMapViewComponent(props: {
|
|
|
505
475
|
setBusy(b => b - 1)
|
|
506
476
|
|
|
507
477
|
if (bounds) {
|
|
508
|
-
map!.fitBounds([bounds.w, bounds.s, bounds.e, bounds.n], {
|
|
478
|
+
map!.fitBounds([bounds.w, bounds.s, bounds.e, bounds.n], {
|
|
479
|
+
padding: 30,
|
|
480
|
+
duration: (props.design.animateAutoBounds ?? true) ? 2500 : 0
|
|
481
|
+
})
|
|
509
482
|
|
|
510
483
|
// Also record if editable as part of bounds
|
|
511
484
|
setBounds(bounds)
|
|
@@ -590,7 +563,6 @@ export function VectorMapViewComponent(props: {
|
|
|
590
563
|
return
|
|
591
564
|
}
|
|
592
565
|
|
|
593
|
-
|
|
594
566
|
const layers = layerClickHandlers.map(clickHandler => clickHandler.mapLayerId)
|
|
595
567
|
|
|
596
568
|
const onEnter = (ev: MapLayerMouseEvent) => {
|
|
@@ -634,7 +606,8 @@ export function VectorMapViewComponent(props: {
|
|
|
634
606
|
filters={getCompiledFilters()}
|
|
635
607
|
zoom={map ? map.getZoom() : null}
|
|
636
608
|
dataSource={props.dataSource}
|
|
637
|
-
locale={
|
|
609
|
+
locale={locale}
|
|
610
|
+
translate={translate}
|
|
638
611
|
onHide={() => setLegendHidden(true)}
|
|
639
612
|
/>
|
|
640
613
|
)
|
|
@@ -676,7 +649,7 @@ export function VectorMapViewComponent(props: {
|
|
|
676
649
|
maxWidth: 250
|
|
677
650
|
}
|
|
678
651
|
|
|
679
|
-
return <div style={style}>{hoverContents
|
|
652
|
+
return <div style={style}>{hoverContents}</div>
|
|
680
653
|
}
|
|
681
654
|
|
|
682
655
|
// Overflow hidden because of problem of exceeding div
|
|
@@ -687,7 +660,7 @@ export function VectorMapViewComponent(props: {
|
|
|
687
660
|
<div style={{ position: "absolute", maxWidth: 250, top: 10, right: 10, zIndex: 999, userSelect: "none" }}>
|
|
688
661
|
<div style={{ display: "flex", gap: 6, position: "relative", flexDirection: "column", alignItems: "right" }}>
|
|
689
662
|
{props.onDesignChange != null && props.design.showLayerSwitcher ? (
|
|
690
|
-
<LayerSwitcherComponent design={props.design} onDesignChange={props.onDesignChange} />
|
|
663
|
+
<LayerSwitcherComponent design={props.design} onDesignChange={props.onDesignChange} translate={translate} />
|
|
691
664
|
) : null}
|
|
692
665
|
{renderHoverContent()}
|
|
693
666
|
</div>
|
package/src/maps/maps.ts
CHANGED
|
@@ -31,8 +31,11 @@ export type OnGridHoverResults = {
|
|
|
31
31
|
hoverOver?: React.ReactElement<{}>
|
|
32
32
|
} | null
|
|
33
33
|
|
|
34
|
+
/** Item in hover over */
|
|
34
35
|
export interface HoverOverItem {
|
|
35
36
|
id: string
|
|
36
37
|
label: string
|
|
37
38
|
value?: Expr
|
|
39
|
+
/** See valueFormatter.ts */
|
|
40
|
+
format?: string
|
|
38
41
|
}
|
|
@@ -38,6 +38,9 @@ export interface QuickfiltersComponentProps {
|
|
|
38
38
|
|
|
39
39
|
/** Called when user hides the quickfilter bar */
|
|
40
40
|
onHide?: () => void
|
|
41
|
+
|
|
42
|
+
/** Translate function to use for display */
|
|
43
|
+
translate?: (input: string) => string
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
/** Displays quick filters and allows their value to be modified */
|
|
@@ -52,6 +55,9 @@ export default class QuickfiltersComponent extends React.Component<QuickfiltersC
|
|
|
52
55
|
let values = this.props.values || []
|
|
53
56
|
let itemValue = values[index]
|
|
54
57
|
|
|
58
|
+
// Translate label
|
|
59
|
+
const label = this.props.translate?.(item.label) ?? item.label
|
|
60
|
+
|
|
55
61
|
// Clean expression first
|
|
56
62
|
const expr = new ExprCleaner(this.props.schema).cleanExpr(item.expr)
|
|
57
63
|
|
|
@@ -106,7 +112,7 @@ export default class QuickfiltersComponent extends React.Component<QuickfiltersC
|
|
|
106
112
|
if (["enum", "enumset"].includes(type)) {
|
|
107
113
|
return R(EnumQuickfilterComponent, {
|
|
108
114
|
key: JSON.stringify(item),
|
|
109
|
-
label
|
|
115
|
+
label,
|
|
110
116
|
schema: this.props.schema,
|
|
111
117
|
options: new ExprUtils(this.props.schema).getExprEnumValues(expr)!,
|
|
112
118
|
value: itemValue,
|
|
@@ -119,7 +125,7 @@ export default class QuickfiltersComponent extends React.Component<QuickfiltersC
|
|
|
119
125
|
return R(TextQuickfilterComponent, {
|
|
120
126
|
key: JSON.stringify(item),
|
|
121
127
|
index,
|
|
122
|
-
label
|
|
128
|
+
label,
|
|
123
129
|
expr,
|
|
124
130
|
schema: this.props.schema,
|
|
125
131
|
quickfiltersDataSource: this.props.quickfiltersDataSource,
|
|
@@ -133,7 +139,7 @@ export default class QuickfiltersComponent extends React.Component<QuickfiltersC
|
|
|
133
139
|
if (["date", "datetime"].includes(type)) {
|
|
134
140
|
return R(DateQuickfilterComponent, {
|
|
135
141
|
key: JSON.stringify(item),
|
|
136
|
-
label
|
|
142
|
+
label,
|
|
137
143
|
expr,
|
|
138
144
|
schema: this.props.schema,
|
|
139
145
|
value: itemValue,
|
|
@@ -145,7 +151,7 @@ export default class QuickfiltersComponent extends React.Component<QuickfiltersC
|
|
|
145
151
|
return R(IdArrayQuickfilterComponent, {
|
|
146
152
|
key: JSON.stringify(item),
|
|
147
153
|
index,
|
|
148
|
-
label
|
|
154
|
+
label,
|
|
149
155
|
expr,
|
|
150
156
|
schema: this.props.schema,
|
|
151
157
|
dataSource: this.props.dataSource,
|
|
@@ -160,7 +166,7 @@ export default class QuickfiltersComponent extends React.Component<QuickfiltersC
|
|
|
160
166
|
return R(TextArrayQuickfilterComponent, {
|
|
161
167
|
key: JSON.stringify(item),
|
|
162
168
|
index,
|
|
163
|
-
label
|
|
169
|
+
label,
|
|
164
170
|
expr,
|
|
165
171
|
schema: this.props.schema,
|
|
166
172
|
quickfiltersDataSource: this.props.quickfiltersDataSource,
|
|
@@ -239,7 +245,7 @@ class EnumQuickfilterComponent extends React.Component<EnumQuickfilterComponentP
|
|
|
239
245
|
|
|
240
246
|
renderSingleSelect(options: any[]) {
|
|
241
247
|
return R(ReactSelect, {
|
|
242
|
-
placeholder:
|
|
248
|
+
placeholder: T`All`,
|
|
243
249
|
value: _.findWhere(options, { value: this.props.value }) || null,
|
|
244
250
|
options,
|
|
245
251
|
isClearable: true,
|
|
@@ -258,7 +264,7 @@ class EnumQuickfilterComponent extends React.Component<EnumQuickfilterComponentP
|
|
|
258
264
|
|
|
259
265
|
renderMultiSelect(options: any[]) {
|
|
260
266
|
return R(ReactSelect, {
|
|
261
|
-
placeholder:
|
|
267
|
+
placeholder: T`All`,
|
|
262
268
|
value: _.map(this.props.value, (v) => _.find(options, (o) => o.value === v)),
|
|
263
269
|
isClearable: true,
|
|
264
270
|
isMulti: true,
|
|
@@ -117,7 +117,7 @@ export default class QuickfiltersDesignComponent extends React.Component<Quickfi
|
|
|
117
117
|
? R(
|
|
118
118
|
"button",
|
|
119
119
|
{ type: "button", className: "btn btn-sm btn-link", onClick: this.handleAdd },
|
|
120
|
-
R("span", { className: "fas fa-plus" }),
|
|
120
|
+
R("span", { className: "fas fa-plus me-1" }),
|
|
121
121
|
T`Add Quick Filter`
|
|
122
122
|
)
|
|
123
123
|
: undefined
|
|
@@ -175,83 +175,65 @@ class QuickfilterDesignComponent extends React.Component<
|
|
|
175
175
|
handleMultiChange = (multi: any) => {
|
|
176
176
|
return this.props.onChange(update(this.props.design, { multi: { $set: multi } }))
|
|
177
177
|
}
|
|
178
|
-
|
|
179
178
|
render() {
|
|
180
179
|
// Determine type of expression
|
|
181
180
|
const exprType = new ExprUtils(this.props.schema).getExprType(this.props.design.expr)
|
|
182
181
|
|
|
183
|
-
return
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
onChange: this.handleMergedChange
|
|
239
|
-
},
|
|
240
|
-
T`Merge with previous quickfilter `,
|
|
241
|
-
R("span", { className: "text-muted" }, T`- displays as one single control that filters both`)
|
|
242
|
-
)
|
|
243
|
-
: undefined,
|
|
244
|
-
|
|
245
|
-
["enum", "text", "enumset", "id[]", "text[]"].includes(exprType!)
|
|
246
|
-
? R(
|
|
247
|
-
ui.Checkbox,
|
|
248
|
-
{
|
|
249
|
-
value: this.props.design.multi,
|
|
250
|
-
onChange: this.handleMultiChange
|
|
251
|
-
},
|
|
252
|
-
T`Allow multiple selections`
|
|
253
|
-
)
|
|
254
|
-
: undefined
|
|
182
|
+
return (
|
|
183
|
+
<div>
|
|
184
|
+
<div className="mb-3 mt-1" key="table">
|
|
185
|
+
<label className="text-muted">{T`Data Source`}</label>
|
|
186
|
+
<ui.Select
|
|
187
|
+
value={this.state.table}
|
|
188
|
+
options={_.map(this.props.tables, (table) => ({
|
|
189
|
+
value: table,
|
|
190
|
+
label: ExprUtils.localizeString(this.props.schema.getTable(table)!.name)
|
|
191
|
+
}))}
|
|
192
|
+
onChange={this.handleTableChange}
|
|
193
|
+
nullLabel={T`Select...`}
|
|
194
|
+
/>
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
<div className="mb-3" key="expr">
|
|
198
|
+
<label className="text-muted">{T`Filter By`}</label>
|
|
199
|
+
<div>
|
|
200
|
+
<ExprComponent
|
|
201
|
+
schema={this.props.schema}
|
|
202
|
+
dataSource={this.props.dataSource}
|
|
203
|
+
table={this.state.table}
|
|
204
|
+
value={this.props.design.expr}
|
|
205
|
+
onChange={this.handleExprChange}
|
|
206
|
+
types={["enum", "text", "enumset", "date", "datetime", "id[]", "text[]"]}
|
|
207
|
+
/>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
{this.props.design.expr ? (
|
|
212
|
+
<div className="mb-3" key="label">
|
|
213
|
+
<label className="text-muted">{T`Label`}</label>
|
|
214
|
+
<input
|
|
215
|
+
type="text"
|
|
216
|
+
className="form-control form-control-sm"
|
|
217
|
+
value={this.props.design.label || ""}
|
|
218
|
+
onChange={this.handleLabelChange}
|
|
219
|
+
placeholder={T`Optional Label`}
|
|
220
|
+
/>
|
|
221
|
+
</div>
|
|
222
|
+
) : undefined}
|
|
223
|
+
|
|
224
|
+
{this.props.mergeable ? (
|
|
225
|
+
<ui.Checkbox value={this.props.design.merged} onChange={this.handleMergedChange}>
|
|
226
|
+
{T`Merge with previous quickfilter `}
|
|
227
|
+
<span className="text-muted">{`- ${T`displays as one single control that filters both`}`}</span>
|
|
228
|
+
</ui.Checkbox>
|
|
229
|
+
) : undefined}
|
|
230
|
+
|
|
231
|
+
{["enum", "text", "enumset", "id[]", "text[]"].includes(exprType!) ? (
|
|
232
|
+
<ui.Checkbox value={this.props.design.multi} onChange={this.handleMultiChange}>
|
|
233
|
+
{T`Allow multiple selections`}
|
|
234
|
+
</ui.Checkbox>
|
|
235
|
+
) : undefined}
|
|
236
|
+
</div>
|
|
255
237
|
)
|
|
256
238
|
}
|
|
257
239
|
}
|