@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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from "lodash"
|
|
2
2
|
import React from "react"
|
|
3
|
-
const R = React.createElement
|
|
4
3
|
import { default as ReactSelect } from "react-select"
|
|
5
4
|
import AutoSizeComponent from "@mwater/react-library/lib/AutoSizeComponent"
|
|
6
5
|
import DatagridViewComponent, { RowUpdate } from "./DatagridViewComponent"
|
|
@@ -47,14 +46,14 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
47
46
|
FindReplaceModalComponentProps,
|
|
48
47
|
FindReplaceModalComponentState
|
|
49
48
|
> {
|
|
50
|
-
constructor(props:
|
|
49
|
+
constructor(props: FindReplaceModalComponentProps) {
|
|
51
50
|
super(props)
|
|
52
51
|
|
|
53
52
|
this.state = {
|
|
54
|
-
open: false,
|
|
55
|
-
replaceColumn: null,
|
|
56
|
-
withExpr: null,
|
|
57
|
-
conditionExpr: null,
|
|
53
|
+
open: false,
|
|
54
|
+
replaceColumn: null,
|
|
55
|
+
withExpr: null,
|
|
56
|
+
conditionExpr: null,
|
|
58
57
|
busy: false
|
|
59
58
|
}
|
|
60
59
|
}
|
|
@@ -222,24 +221,27 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
222
221
|
}
|
|
223
222
|
})
|
|
224
223
|
|
|
225
|
-
return
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
224
|
+
return (
|
|
225
|
+
<AutoSizeComponent injectWidth={true}>
|
|
226
|
+
{(size: any) => {
|
|
227
|
+
return <DatagridViewComponent
|
|
228
|
+
width={size.width}
|
|
229
|
+
height={400}
|
|
230
|
+
schema={this.props.schema}
|
|
231
|
+
dataSource={this.props.dataSource}
|
|
232
|
+
datagridDataSource={new DirectDatagridDataSource({
|
|
233
|
+
schema: this.props.schema,
|
|
234
|
+
dataSource: this.props.dataSource
|
|
235
|
+
})}
|
|
236
|
+
design={design}
|
|
237
|
+
filters={this.props.filters}
|
|
238
|
+
/>
|
|
239
|
+
}}
|
|
240
|
+
</AutoSizeComponent>
|
|
241
|
+
)
|
|
239
242
|
}
|
|
240
243
|
|
|
241
244
|
renderContents() {
|
|
242
|
-
let value
|
|
243
245
|
const exprUtils = new ExprUtils(this.props.schema)
|
|
244
246
|
|
|
245
247
|
// Determine which columns are replace-able. Excludes subtables and aggregates
|
|
@@ -254,80 +256,69 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
254
256
|
|
|
255
257
|
// Show progress
|
|
256
258
|
if (this.state.busy) {
|
|
257
|
-
return
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
R("div", { className: "progress-bar progress-bar-striped progress-bar-animated", style: { width: `100%` } })
|
|
265
|
-
)
|
|
259
|
+
return (
|
|
260
|
+
<div>
|
|
261
|
+
<h3>{T`Working...`}</h3>
|
|
262
|
+
<div className="progress">
|
|
263
|
+
<div className="progress-bar progress-bar-striped progress-bar-animated" style={{ width: "100%" }} />
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
266
|
)
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
return
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
table: this.props.design.table!,
|
|
323
|
-
value: this.state.conditionExpr,
|
|
324
|
-
onChange: value => this.setState({ conditionExpr: value }),
|
|
325
|
-
types: ["boolean"],
|
|
326
|
-
placeholder: T`All Rows`
|
|
327
|
-
})
|
|
328
|
-
),
|
|
329
|
-
|
|
330
|
-
R("div", { key: "preview" }, R("h4", null, T`Preview`), this.renderPreview())
|
|
269
|
+
return (
|
|
270
|
+
<div>
|
|
271
|
+
<div key="replace" className="mb-3">
|
|
272
|
+
<label>{T`Column with data to replace`}: </label>
|
|
273
|
+
<ReactSelect
|
|
274
|
+
options={replaceColumnOptions}
|
|
275
|
+
value={_.findWhere(replaceColumnOptions, { value: this.state.replaceColumn }) || null}
|
|
276
|
+
onChange={(opt: any) => this.setState({ replaceColumn: opt.value })}
|
|
277
|
+
placeholder={T`Select Column...`}
|
|
278
|
+
styles={{
|
|
279
|
+
// Keep menu above fixed data table headers
|
|
280
|
+
menu: style => _.extend({}, style, { zIndex: 2 })
|
|
281
|
+
}}
|
|
282
|
+
/>
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
{this.state.replaceColumn ? (
|
|
286
|
+
<div key="with" className="mb-3">
|
|
287
|
+
<label>{T`Value to replace data with`}: </label>
|
|
288
|
+
<ExprComponent
|
|
289
|
+
schema={this.props.schema}
|
|
290
|
+
dataSource={this.props.dataSource}
|
|
291
|
+
table={this.props.design.table!}
|
|
292
|
+
value={this.state.withExpr}
|
|
293
|
+
onChange={value => this.setState({ withExpr: value })}
|
|
294
|
+
types={[exprUtils.getExprType(_.findWhere(this.props.design.columns, { id: this.state.replaceColumn })!.expr)!]}
|
|
295
|
+
enumValues={exprUtils.getExprEnumValues(_.findWhere(this.props.design.columns, { id: this.state.replaceColumn })!.expr) || undefined}
|
|
296
|
+
idTable={exprUtils.getExprIdTable(_.findWhere(this.props.design.columns, { id: this.state.replaceColumn })!.expr) || undefined}
|
|
297
|
+
preferLiteral={true}
|
|
298
|
+
placeholder={T`(Blank)`}
|
|
299
|
+
refExpr={_.findWhere(this.props.design.columns, { id: this.state.replaceColumn })!.expr}
|
|
300
|
+
/>
|
|
301
|
+
</div>
|
|
302
|
+
) : null}
|
|
303
|
+
|
|
304
|
+
<div key="condition" className="mb-3">
|
|
305
|
+
<label>{T`Only in rows that (optional)`}:</label>
|
|
306
|
+
<ExprComponent
|
|
307
|
+
schema={this.props.schema}
|
|
308
|
+
dataSource={this.props.dataSource}
|
|
309
|
+
table={this.props.design.table!}
|
|
310
|
+
value={this.state.conditionExpr}
|
|
311
|
+
onChange={value => this.setState({ conditionExpr: value })}
|
|
312
|
+
types={["boolean"]}
|
|
313
|
+
placeholder={T`All Rows`}
|
|
314
|
+
/>
|
|
315
|
+
</div>
|
|
316
|
+
|
|
317
|
+
<div key="preview">
|
|
318
|
+
<h4>{T`Preview`}</h4>
|
|
319
|
+
{this.renderPreview()}
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
331
322
|
)
|
|
332
323
|
}
|
|
333
324
|
|
|
@@ -336,36 +327,32 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
336
327
|
return null
|
|
337
328
|
}
|
|
338
329
|
|
|
339
|
-
return
|
|
340
|
-
ModalPopupComponent
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
"button"
|
|
347
|
-
{
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
)
|
|
366
|
-
]
|
|
367
|
-
},
|
|
368
|
-
this.renderContents()
|
|
330
|
+
return (
|
|
331
|
+
<ModalPopupComponent
|
|
332
|
+
size="large"
|
|
333
|
+
header={T`Find/Replace`}
|
|
334
|
+
footer={[
|
|
335
|
+
<button
|
|
336
|
+
key="cancel"
|
|
337
|
+
type="button"
|
|
338
|
+
onClick={() => this.setState({ open: false })}
|
|
339
|
+
className="btn btn-secondary"
|
|
340
|
+
>
|
|
341
|
+
{T`Cancel`}
|
|
342
|
+
</button>,
|
|
343
|
+
<button
|
|
344
|
+
key="apply"
|
|
345
|
+
type="button"
|
|
346
|
+
disabled={!this.state.replaceColumn || this.state.busy}
|
|
347
|
+
onClick={() => this.performReplace()}
|
|
348
|
+
className="btn btn-primary"
|
|
349
|
+
>
|
|
350
|
+
{T`Apply`}
|
|
351
|
+
</button>
|
|
352
|
+
]}
|
|
353
|
+
>
|
|
354
|
+
{this.renderContents()}
|
|
355
|
+
</ModalPopupComponent>
|
|
369
356
|
)
|
|
370
357
|
}
|
|
371
358
|
}
|
package/src/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/src/index.ts
CHANGED
|
@@ -45,7 +45,6 @@ export { WidgetDataSource } from "./widgets/WidgetDataSource"
|
|
|
45
45
|
export { default as DirectWidgetDataSource } from "./widgets/DirectWidgetDataSource"
|
|
46
46
|
|
|
47
47
|
import "leaflet/dist/leaflet.css"
|
|
48
|
-
import "fixed-data-table-2/dist/fixed-data-table.min.css"
|
|
49
48
|
import "rc-slider/assets/index.css"
|
|
50
49
|
import "./layouts/decorated-block.css"
|
|
51
50
|
import "react-datepicker/dist/react-datepicker.css"
|
package/src/languages.ts
CHANGED
|
@@ -84,7 +84,7 @@ export default class HorizontalBlockComponent extends React.Component<
|
|
|
84
84
|
dragXOffset = this.state.rightSize - 100
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
this.setState({ dragXOffset })
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
handleMouseUp = (ev: any) => {
|
|
@@ -93,7 +93,7 @@ export default class HorizontalBlockComponent extends React.Component<
|
|
|
93
93
|
document.removeEventListener("mouseup", this.handleMouseUp)
|
|
94
94
|
|
|
95
95
|
// Determine weights of two blocks
|
|
96
|
-
const weights = this.props.block.weights || []
|
|
96
|
+
const weights = [...(this.props.block.weights || [])]
|
|
97
97
|
const newLeftSize = this.state.leftSize + this.state.dragXOffset
|
|
98
98
|
const newRightSize = this.state.rightSize - this.state.dragXOffset
|
|
99
99
|
|
package/src/mWaterLoader.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface MWaterLoaderOptions {
|
|
|
14
14
|
/** Load schema as a specific user (for shared dashboards, etc). optional */
|
|
15
15
|
asUser?: string
|
|
16
16
|
/** Extra tables to load in schema. Forms are not loaded by default as they are too many */
|
|
17
|
-
extraTables
|
|
17
|
+
extraTables?: string[]
|
|
18
18
|
/** False to disable local caching of queries. Default true */
|
|
19
19
|
localCaching?: boolean
|
|
20
20
|
/** Locales of the schema to load. Default is all. */
|
package/src/maps/BufferLayer.ts
CHANGED
|
@@ -2,42 +2,24 @@ import _ from "lodash"
|
|
|
2
2
|
import produce, { original } from "immer"
|
|
3
3
|
import { JsonQLExpr, JsonQLQuery, JsonQLScalar, JsonQLSelect } from "@mwater/jsonql"
|
|
4
4
|
import { DataSource, ExprCleaner, ExprCompiler, ExprValidator, injectTableAlias, Schema } from "@mwater/expressions"
|
|
5
|
-
import React from "react"
|
|
5
|
+
import React, { ReactNode } from "react"
|
|
6
6
|
import { JsonQLFilter } from "../JsonQLFilter"
|
|
7
7
|
import AxisBuilder from "../axes/AxisBuilder"
|
|
8
8
|
import { BufferLayerDesign } from "./BufferLayerDesign"
|
|
9
|
-
import Layer, { OnGridClickOptions, OnGridHoverOptions, VectorTileDef } from "./Layer"
|
|
9
|
+
import Layer, { OnGridClickOptions, OnGridHoverOptions, VectorTileDef, LegendOptions } from "./Layer"
|
|
10
10
|
import { OnGridClickResults, OnGridHoverResults } from "./maps"
|
|
11
11
|
import { compileColorMapToMapbox } from "./mapboxUtils"
|
|
12
12
|
|
|
13
|
-
import LegendGroup from "./LegendGroup"
|
|
14
13
|
import LayerLegendComponent from "./LayerLegendComponent"
|
|
15
14
|
import * as PopupFilterJoinsUtils from "./PopupFilterJoinsUtils"
|
|
16
15
|
import { LayerSpecification } from "maplibre-gl"
|
|
17
16
|
import HoverContent from "./HoverContent"
|
|
18
17
|
import { getDefaultLayoutOptions } from "../dashboards/layoutOptions"
|
|
18
|
+
import Widget from "../widgets/Widget"
|
|
19
|
+
import BlocksLayoutManager from "../layouts/blocks/BlocksLayoutManager"
|
|
20
|
+
import { getTranslatableStringsFromLayoutManager } from "../dashboards/DashboardUtils"
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
Layer which draws a buffer around geometries (i.e. a radius circle around points)
|
|
22
|
-
|
|
23
|
-
Design is:
|
|
24
|
-
table: table to get data from
|
|
25
|
-
axes: axes (see below)
|
|
26
|
-
filter: optional logical expression to filter by
|
|
27
|
-
color: color of layer (e.g. #FF8800). Color axis overrides
|
|
28
|
-
fillOpacity: Opacity to fill the circles (0-1)
|
|
29
|
-
radius: radius to draw in meters
|
|
30
|
-
minZoom: minimum zoom level
|
|
31
|
-
maxZoom: maximum zoom level
|
|
32
|
-
|
|
33
|
-
popup: contains items: which is BlocksLayoutManager items. Will be displayed when the circle is clicked
|
|
34
|
-
popupFilterJoins: customizable filtering for popup. See PopupFilterJoins.md
|
|
35
|
-
|
|
36
|
-
axes:
|
|
37
|
-
geometry: where to draw buffers around
|
|
38
|
-
color: color axis
|
|
39
|
-
|
|
40
|
-
*/
|
|
22
|
+
/** Layer which draws a buffer around geometries (i.e. a radius circle around points) */
|
|
41
23
|
export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
42
24
|
/** Gets the type of layer definition */
|
|
43
25
|
getLayerDefinitionType(): "VectorTile" {
|
|
@@ -51,7 +33,7 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
51
33
|
filters: JsonQLFilter[],
|
|
52
34
|
opacity: number
|
|
53
35
|
): VectorTileDef {
|
|
54
|
-
const jsonql = this.
|
|
36
|
+
const jsonql = this.createVectorJsonQL(design, schema, filters)
|
|
55
37
|
|
|
56
38
|
const mapLayers: LayerSpecification[] = []
|
|
57
39
|
|
|
@@ -95,7 +77,7 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
95
77
|
}
|
|
96
78
|
}
|
|
97
79
|
|
|
98
|
-
|
|
80
|
+
createVectorJsonQL(design: BufferLayerDesign, schema: Schema, filters: JsonQLFilter[]): JsonQLQuery {
|
|
99
81
|
let colorExpr: JsonQLExpr
|
|
100
82
|
const axisBuilder = new AxisBuilder({ schema })
|
|
101
83
|
const exprCompiler = new ExprCompiler(schema)
|
|
@@ -144,8 +126,15 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
144
126
|
// ST_Expand(ST_MakeEnvelope(-180, -85, 180, 85, 4326), -<radius in degrees>))
|
|
145
127
|
// , <radius in degrees>})
|
|
146
128
|
// , 3857)
|
|
147
|
-
|
|
148
|
-
|
|
129
|
+
|
|
130
|
+
// Get radius expression
|
|
131
|
+
const radiusCompiledExpr: JsonQLExpr = exprCompiler.compileExpr({
|
|
132
|
+
expr: design.radiusExpr ?? { type: "literal", valueType: "number", value: design.radius },
|
|
133
|
+
tableAlias: "main"
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
// Convert radius in meters to a maximum number of degrees latitude
|
|
137
|
+
const radiusDegCompiledExpr: JsonQLExpr = { type: "op", op: "/", exprs: [radiusCompiledExpr, 100000] }
|
|
149
138
|
|
|
150
139
|
const boundingBox: JsonQLExpr = {
|
|
151
140
|
type: "op",
|
|
@@ -163,11 +152,14 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
163
152
|
{
|
|
164
153
|
type: "op",
|
|
165
154
|
op: "ST_Expand",
|
|
166
|
-
exprs: [
|
|
155
|
+
exprs: [
|
|
156
|
+
{ type: "op", op: "ST_MakeEnvelope", exprs: [-180, -85, 180, 85, 4326] },
|
|
157
|
+
{ type: "op", op: "*", exprs: [radiusDegCompiledExpr, -1] }
|
|
158
|
+
]
|
|
167
159
|
}
|
|
168
160
|
]
|
|
169
161
|
},
|
|
170
|
-
|
|
162
|
+
radiusDegCompiledExpr
|
|
171
163
|
]
|
|
172
164
|
},
|
|
173
165
|
3857
|
|
@@ -211,7 +203,7 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
211
203
|
type: "op",
|
|
212
204
|
op: "/",
|
|
213
205
|
exprs: [
|
|
214
|
-
|
|
206
|
+
radiusCompiledExpr,
|
|
215
207
|
{
|
|
216
208
|
type: "op",
|
|
217
209
|
op: "cos",
|
|
@@ -349,6 +341,15 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
349
341
|
const axisBuilder = new AxisBuilder({ schema })
|
|
350
342
|
const exprCompiler = new ExprCompiler(schema)
|
|
351
343
|
|
|
344
|
+
// Get radius expression
|
|
345
|
+
const radiusCompiledExpr: JsonQLExpr = exprCompiler.compileExpr({
|
|
346
|
+
expr: design.radiusExpr ?? { type: "literal", valueType: "number", value: design.radius },
|
|
347
|
+
tableAlias: "main"
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
// Convert radius in meters to a maximum number of degrees latitude
|
|
351
|
+
const radiusDegCompiledExpr: JsonQLExpr = { type: "op", op: "/", exprs: [radiusCompiledExpr, 100000] }
|
|
352
|
+
|
|
352
353
|
/*
|
|
353
354
|
Query:
|
|
354
355
|
select
|
|
@@ -383,7 +384,7 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
383
384
|
type: "op",
|
|
384
385
|
op: "/",
|
|
385
386
|
exprs: [
|
|
386
|
-
{ type: "op", op: "*", exprs: [
|
|
387
|
+
{ type: "op", op: "*", exprs: [radiusCompiledExpr, 2] },
|
|
387
388
|
{
|
|
388
389
|
type: "op",
|
|
389
390
|
op: "*",
|
|
@@ -438,16 +439,6 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
438
439
|
from: exprCompiler.compileTable(design.table, "main")
|
|
439
440
|
}
|
|
440
441
|
|
|
441
|
-
// ST_Transform(ST_Expand(
|
|
442
|
-
// # Prevent 3857 overflow (i.e. > 85 degrees lat)
|
|
443
|
-
// ST_Intersection(
|
|
444
|
-
// ST_Transform(!bbox!, 4326),
|
|
445
|
-
// ST_Expand(ST_MakeEnvelope(-180, -85, 180, 85, 4326), -<radius in degrees>))
|
|
446
|
-
// , <radius in degrees>})
|
|
447
|
-
// , 3857)
|
|
448
|
-
// TODO document how we compute this
|
|
449
|
-
const radiusDeg = design.radius / 100000
|
|
450
|
-
|
|
451
442
|
const boundingBox: JsonQLExpr = {
|
|
452
443
|
type: "op",
|
|
453
444
|
op: "ST_Transform",
|
|
@@ -464,11 +455,14 @@ export default class BufferLayer extends Layer<BufferLayerDesign> {
|
|
|
464
455
|
{
|
|
465
456
|
type: "op",
|
|
466
457
|
op: "ST_Expand",
|
|
467
|
-
exprs: [
|
|
458
|
+
exprs: [
|
|
459
|
+
{ type: "op", op: "ST_MakeEnvelope", exprs: [-180, -85, 180, 85, 4326] },
|
|
460
|
+
{ type: "op", op: "*", exprs: [radiusDegCompiledExpr, -1] }
|
|
461
|
+
]
|
|
468
462
|
}
|
|
469
463
|
]
|
|
470
464
|
},
|
|
471
|
-
|
|
465
|
+
radiusDegCompiledExpr
|
|
472
466
|
]
|
|
473
467
|
},
|
|
474
468
|
3857
|
|
@@ -662,7 +656,7 @@ marker-fill: ` +
|
|
|
662
656
|
items: clickOptions.design.popup.items,
|
|
663
657
|
layoutOptions: getDefaultLayoutOptions("default"),
|
|
664
658
|
renderWidget: (options: any) => {
|
|
665
|
-
const widget = WidgetFactory.createWidget(options.type)
|
|
659
|
+
const widget = WidgetFactory.createWidget(options.type) as Widget
|
|
666
660
|
|
|
667
661
|
const filters = clickOptions.filters.concat(popupFilters)
|
|
668
662
|
|
|
@@ -679,10 +673,11 @@ marker-fill: ` +
|
|
|
679
673
|
design: options.design,
|
|
680
674
|
scope: null,
|
|
681
675
|
filters,
|
|
682
|
-
|
|
683
|
-
onDesignChange: null,
|
|
676
|
+
onDesignChange: undefined,
|
|
684
677
|
width: options.width,
|
|
685
|
-
height: options.height
|
|
678
|
+
height: options.height,
|
|
679
|
+
locale: clickOptions.locale,
|
|
680
|
+
translate: clickOptions.translate
|
|
686
681
|
})
|
|
687
682
|
}
|
|
688
683
|
})
|
|
@@ -721,8 +716,11 @@ marker-fill: ` +
|
|
|
721
716
|
key: ev.data.id,
|
|
722
717
|
schema: hoverOptions.schema,
|
|
723
718
|
dataSource: hoverOptions.dataSource,
|
|
724
|
-
|
|
725
|
-
|
|
719
|
+
table,
|
|
720
|
+
items: hoverOptions.design.hoverOver.items,
|
|
721
|
+
filters: popupFilters,
|
|
722
|
+
locale: hoverOptions.locale,
|
|
723
|
+
translate: hoverOptions.translate
|
|
726
724
|
})
|
|
727
725
|
}
|
|
728
726
|
|
|
@@ -773,14 +771,8 @@ marker-fill: ` +
|
|
|
773
771
|
|
|
774
772
|
// Get the legend to be optionally displayed on the map. Returns
|
|
775
773
|
// a React element
|
|
776
|
-
getLegend(
|
|
777
|
-
design
|
|
778
|
-
schema: Schema,
|
|
779
|
-
name: string,
|
|
780
|
-
dataSource: DataSource,
|
|
781
|
-
locale: string,
|
|
782
|
-
filters: JsonQLFilter[]
|
|
783
|
-
) {
|
|
774
|
+
getLegend(options: LegendOptions<BufferLayerDesign>): ReactNode {
|
|
775
|
+
const { design, schema, name, dataSource, locale, filters } = options
|
|
784
776
|
const _filters = filters.slice()
|
|
785
777
|
if (design.filter != null) {
|
|
786
778
|
const exprCompiler = new ExprCompiler(schema)
|
|
@@ -865,7 +857,14 @@ marker-fill: ` +
|
|
|
865
857
|
draft.color = design.color || "#0088FF"
|
|
866
858
|
|
|
867
859
|
draft.axes = design.axes || {}
|
|
868
|
-
|
|
860
|
+
|
|
861
|
+
// Default radius if both radius and radiusExpr are not specified
|
|
862
|
+
if (design.radius == null && design.radiusExpr == null) {
|
|
863
|
+
draft.radius = 1000
|
|
864
|
+
draft.radiusExpr = { type: "literal", valueType: "number", value: 1000 }
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
// Default fill opacity
|
|
869
868
|
draft.fillOpacity = design.fillOpacity != null ? design.fillOpacity : 0.5
|
|
870
869
|
|
|
871
870
|
draft.axes.geometry = axisBuilder.cleanAxis({
|
|
@@ -896,7 +895,7 @@ marker-fill: ` +
|
|
|
896
895
|
return T`Missing table`
|
|
897
896
|
}
|
|
898
897
|
|
|
899
|
-
if (design.radius == null) {
|
|
898
|
+
if (design.radius == null && design.radiusExpr == null) {
|
|
900
899
|
return T`Missing radius`
|
|
901
900
|
}
|
|
902
901
|
|
|
@@ -927,4 +926,28 @@ marker-fill: ` +
|
|
|
927
926
|
|
|
928
927
|
return null
|
|
929
928
|
}
|
|
929
|
+
|
|
930
|
+
/** Get strings to be translated */
|
|
931
|
+
getTranslatableStrings(design: BufferLayerDesign, schema: Schema): string[] {
|
|
932
|
+
const strings: string[] = []
|
|
933
|
+
|
|
934
|
+
// Add strings from hoverOver items
|
|
935
|
+
if (design.hoverOver && design.hoverOver.items) {
|
|
936
|
+
for (const item of design.hoverOver.items) {
|
|
937
|
+
if (item.label) {
|
|
938
|
+
strings.push(item.label)
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// Add strings from popup items using a layout manager approach
|
|
944
|
+
if (design.popup && design.popup.items) {
|
|
945
|
+
const layoutManager = new BlocksLayoutManager()
|
|
946
|
+
const popupStrings = getTranslatableStringsFromLayoutManager(layoutManager, design.popup.items, schema)
|
|
947
|
+
strings.push(...popupStrings)
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// Remove duplicates
|
|
951
|
+
return _.uniq(strings)
|
|
952
|
+
}
|
|
930
953
|
}
|