@mwater/visualization 5.4.5 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/MWaterContextComponent.d.ts +1 -1
- package/lib/MWaterContextComponent.js +1 -1
- package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
- package/lib/MWaterGlobalFiltersComponent.js +11 -20
- package/lib/MWaterLoaderComponent.d.ts +5 -14
- package/lib/MWaterLoaderComponent.js +2 -11
- package/lib/UndoStack.d.ts +2 -1
- package/lib/UndoStack.js +12 -6
- package/lib/dashboards/DashboardComponent.js +7 -5
- package/lib/dashboards/DashboardDesign.d.ts +1 -1
- package/lib/dashboards/LayoutOptionsComponent.js +18 -11
- package/lib/dashboards/ServerDashboardDataSource.d.ts +10 -1
- package/lib/dashboards/ServerDashboardDataSource.js +29 -10
- package/lib/dashboards/SettingsModalComponent.js +1 -1
- package/lib/dashboards/layoutOptions.d.ts +5 -1
- package/lib/datagrids/DatagridComponent.js +23 -3
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
- package/lib/datagrids/DatagridDesignerComponent.js +108 -120
- package/lib/datagrids/DatagridViewComponent.js +3 -2
- package/lib/datagrids/ExprCellComponent.d.ts +1 -0
- package/lib/datagrids/ExprCellComponent.js +22 -20
- package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
- package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
- package/lib/index.css +45 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +2 -3
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
- package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
- package/lib/maps/BufferLayer.d.ts +18 -0
- package/lib/maps/BufferLayer.js +36 -14
- package/lib/maps/BufferLayerDesign.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.js +2 -2
- package/lib/maps/ChoroplethLayer.d.ts +18 -0
- package/lib/maps/ChoroplethLayer.js +46 -25
- package/lib/maps/ChoroplethLayerDesign.d.ts +7 -3
- package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -22
- package/lib/maps/ChoroplethLayerDesigner.js +58 -89
- package/lib/maps/DirectMapDataSource.js +17 -10
- package/lib/maps/EditHoverOver.d.ts +4 -3
- package/lib/maps/EditHoverOver.js +64 -35
- package/lib/maps/HoverContent.d.ts +10 -5
- package/lib/maps/HoverContent.js +7 -36
- package/lib/maps/Layer.d.ts +37 -0
- package/lib/maps/Layer.js +30 -4
- package/lib/maps/LeafletMapComponent.js +10 -19
- package/lib/maps/MWaterServerLayer.d.ts +2 -2
- package/lib/maps/MWaterServerLayer.js +6 -6
- package/lib/maps/MapComponent.js +0 -1
- package/lib/maps/MapLayerDataSource.d.ts +9 -0
- package/lib/maps/MapUtils.d.ts +19 -1
- package/lib/maps/MapUtils.js +80 -1
- package/lib/maps/MarkersLayer.d.ts +18 -0
- package/lib/maps/MarkersLayer.js +42 -26
- package/lib/maps/MarkersLayerDesign.d.ts +1 -1
- package/lib/maps/MarkersLayerDesignerComponent.d.ts +12 -28
- package/lib/maps/MarkersLayerDesignerComponent.js +81 -111
- package/lib/maps/RasterMapViewComponent.js +1 -1
- package/lib/maps/ServerMapDataSource.d.ts +9 -0
- package/lib/maps/ServerMapDataSource.js +29 -10
- package/lib/maps/VectorMapViewComponent.js +7 -15
- package/lib/maps/maps.d.ts +4 -2
- package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
- package/lib/maps/symbols/font-awesome/ban.png +0 -0
- package/lib/maps/symbols/font-awesome/beer.png +0 -0
- package/lib/maps/symbols/font-awesome/bell.png +0 -0
- package/lib/maps/symbols/font-awesome/bolt.png +0 -0
- package/lib/maps/symbols/font-awesome/building.png +0 -0
- package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
- package/lib/maps/symbols/font-awesome/bus.png +0 -0
- package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
- package/lib/maps/symbols/font-awesome/certificate.png +0 -0
- package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/check.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud.png +0 -0
- package/lib/maps/symbols/font-awesome/comment.png +0 -0
- package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/lib/maps/symbols/font-awesome/female.png +0 -0
- package/lib/maps/symbols/font-awesome/file.png +0 -0
- package/lib/maps/symbols/font-awesome/flag.png +0 -0
- package/lib/maps/symbols/font-awesome/flask.png +0 -0
- package/lib/maps/symbols/font-awesome/h-square.png +0 -0
- package/lib/maps/symbols/font-awesome/home.png +0 -0
- package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/male.png +0 -0
- package/lib/maps/symbols/font-awesome/medkit.png +0 -0
- package/lib/maps/symbols/font-awesome/mobile.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
- package/lib/maps/symbols/font-awesome/plus.png +0 -0
- package/lib/maps/symbols/font-awesome/square.png +0 -0
- package/lib/maps/symbols/font-awesome/star.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/lib/maps/symbols/font-awesome/ticket.png +0 -0
- package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/times.png +0 -0
- package/lib/maps/symbols/font-awesome/tint.png +0 -0
- package/lib/maps/symbols/font-awesome/tree.png +0 -0
- package/lib/maps/symbols/font-awesome/university.png +0 -0
- package/lib/maps/symbols/font-awesome/usd.png +0 -0
- package/lib/maps/symbols/font-awesome/user.png +0 -0
- package/lib/maps/symbols/font-awesome/users.png +0 -0
- package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/lib/maps/symbols/sdf-ize.sh +93 -0
- package/lib/maps/vectorMaps.d.ts +1 -0
- package/lib/maps/vectorMaps.js +20 -36
- package/lib/mwater_table_selection/FormsListComponent.d.ts +33 -0
- package/lib/mwater_table_selection/FormsListComponent.js +141 -0
- package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +49 -0
- package/lib/mwater_table_selection/IndicatorsListComponent.js +251 -0
- package/lib/mwater_table_selection/IssuesListComponent.d.ts +29 -0
- package/lib/mwater_table_selection/IssuesListComponent.js +123 -0
- package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.d.ts +20 -0
- package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.js +157 -0
- package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.js +79 -0
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.d.ts +18 -0
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.d.ts +63 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +461 -0
- package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.js +94 -0
- package/lib/mwater_table_selection/MWaterMetricsTableListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterMetricsTableListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +32 -0
- package/lib/mwater_table_selection/MWaterTableSelectComponent.js +163 -0
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.d.ts +19 -0
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.js +111 -0
- package/lib/quickfilter/QuickfiltersComponent.d.ts +3 -102
- package/lib/quickfilter/QuickfiltersComponent.js +53 -110
- package/lib/quickfilter/TextLiteralComponent.d.ts +23 -47
- package/lib/quickfilter/TextLiteralComponent.js +85 -82
- package/lib/widgets/MapWidget.js +4 -2
- package/lib/widgets/charts/Chart.d.ts +11 -0
- package/lib/widgets/charts/Chart.js +15 -0
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +1 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +27 -1
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +5 -12
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +43 -57
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +113 -110
- package/lib/widgets/charts/layered/LayeredChartUtils.d.ts +2 -1
- package/lib/widgets/charts/layered/LayeredChartUtils.js +0 -2
- package/lib/widgets/charts/pivot/PivotChart.d.ts +2 -0
- package/lib/widgets/charts/pivot/PivotChart.js +156 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +5 -20
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +31 -61
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +4 -0
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +4 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.d.ts +5 -44
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +38 -63
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +7 -68
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +58 -106
- package/lib/widgets/charts/table/TableChart.d.ts +2 -0
- package/lib/widgets/charts/table/TableChart.js +172 -1
- package/lib/widgets/charts/table/TableChartDesignerComponent.d.ts +7 -17
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +79 -95
- package/lib/widgets/charts/table/TableChartViewComponent.d.ts +1 -7
- package/lib/widgets/charts/table/TableChartViewComponent.js +19 -27
- package/lib/widgets/text/ExprItemEditorComponent.d.ts +3 -8
- package/lib/widgets/text/ExprItemEditorComponent.js +36 -33
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +1 -0
- package/package.json +4 -10
- package/src/MWaterContextComponent.tsx +2 -2
- package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
- package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +18 -19
- package/src/UndoStack.ts +14 -6
- package/src/dashboards/DashboardComponent.tsx +7 -5
- package/src/dashboards/DashboardDesign.ts +1 -1
- package/src/dashboards/LayoutOptionsComponent.tsx +22 -10
- package/src/dashboards/ServerDashboardDataSource.ts +36 -13
- package/src/dashboards/SettingsModalComponent.tsx +1 -1
- package/src/dashboards/layoutOptions.tsx +5 -1
- package/src/datagrids/DatagridComponent.tsx +31 -3
- package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
- package/src/datagrids/DatagridViewComponent.tsx +3 -2
- package/src/datagrids/ExprCellComponent.tsx +23 -20
- package/src/datagrids/OrderBysDesignerComponent.tsx +61 -70
- package/src/index.css +45 -2
- package/src/index.ts +5 -11
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +60 -5
- package/src/maps/BufferLayer.ts +48 -20
- package/src/maps/BufferLayerDesign.ts +1 -1
- package/src/maps/BufferLayerDesignerComponent.tsx +2 -1
- package/src/maps/ChoroplethLayer.ts +70 -39
- package/src/maps/ChoroplethLayerDesign.ts +6 -2
- package/src/maps/ChoroplethLayerDesigner.tsx +171 -167
- package/src/maps/DirectMapDataSource.ts +21 -13
- package/src/maps/EditHoverOver.tsx +98 -54
- package/src/maps/HoverContent.tsx +17 -48
- package/src/maps/Layer.ts +42 -4
- package/src/maps/LeafletMapComponent.tsx +10 -19
- package/src/maps/MWaterServerLayer.ts +6 -6
- package/src/maps/MapComponent.ts +0 -1
- package/src/maps/MapLayerDataSource.ts +8 -0
- package/src/maps/MapUtils.ts +82 -3
- package/src/maps/MarkersLayer.ts +54 -27
- package/src/maps/MarkersLayerDesign.ts +1 -1
- package/src/maps/MarkersLayerDesignerComponent.tsx +360 -0
- package/src/maps/RasterMapViewComponent.ts +1 -1
- package/src/maps/ServerMapDataSource.ts +35 -12
- package/src/maps/VectorMapViewComponent.tsx +8 -19
- package/src/maps/maps.ts +4 -2
- package/src/maps/symbols/font-awesome/asterisk.png +0 -0
- package/src/maps/symbols/font-awesome/ban.png +0 -0
- package/src/maps/symbols/font-awesome/beer.png +0 -0
- package/src/maps/symbols/font-awesome/bell.png +0 -0
- package/src/maps/symbols/font-awesome/bolt.png +0 -0
- package/src/maps/symbols/font-awesome/building.png +0 -0
- package/src/maps/symbols/font-awesome/bullseye.png +0 -0
- package/src/maps/symbols/font-awesome/bus.png +0 -0
- package/src/maps/symbols/font-awesome/caret-up.png +0 -0
- package/src/maps/symbols/font-awesome/certificate.png +0 -0
- package/src/maps/symbols/font-awesome/check-circle.png +0 -0
- package/src/maps/symbols/font-awesome/check.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/symbols/font-awesome/cloud.png +0 -0
- package/src/maps/symbols/font-awesome/comment.png +0 -0
- package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/src/maps/symbols/font-awesome/female.png +0 -0
- package/src/maps/symbols/font-awesome/file.png +0 -0
- package/src/maps/symbols/font-awesome/flag.png +0 -0
- package/src/maps/symbols/font-awesome/flask.png +0 -0
- package/src/maps/symbols/font-awesome/h-square.png +0 -0
- package/src/maps/symbols/font-awesome/home.png +0 -0
- package/src/maps/symbols/font-awesome/info-circle.png +0 -0
- package/src/maps/symbols/font-awesome/male.png +0 -0
- package/src/maps/symbols/font-awesome/medkit.png +0 -0
- package/src/maps/symbols/font-awesome/mobile.png +0 -0
- package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/src/maps/symbols/font-awesome/plus-square.png +0 -0
- package/src/maps/symbols/font-awesome/plus.png +0 -0
- package/src/maps/symbols/font-awesome/square.png +0 -0
- package/src/maps/symbols/font-awesome/star.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/src/maps/symbols/font-awesome/ticket.png +0 -0
- package/src/maps/symbols/font-awesome/times-circle.png +0 -0
- package/src/maps/symbols/font-awesome/times.png +0 -0
- package/src/maps/symbols/font-awesome/tint.png +0 -0
- package/src/maps/symbols/font-awesome/tree.png +0 -0
- package/src/maps/symbols/font-awesome/university.png +0 -0
- package/src/maps/symbols/font-awesome/usd.png +0 -0
- package/src/maps/symbols/font-awesome/user.png +0 -0
- package/src/maps/symbols/font-awesome/users.png +0 -0
- package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/src/maps/symbols/sdf-ize.sh +93 -0
- package/src/maps/vectorMaps.tsx +20 -44
- package/src/mwater_table_selection/FormsListComponent.tsx +188 -0
- package/src/mwater_table_selection/IndicatorsListComponent.tsx +411 -0
- package/src/mwater_table_selection/IssuesListComponent.tsx +167 -0
- package/src/mwater_table_selection/MWaterAccountingSystemListComponent.tsx +225 -0
- package/src/{MWaterAssetSystemsListComponent.tsx → mwater_table_selection/MWaterAssetSystemsListComponent.tsx} +2 -2
- package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
- package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +713 -0
- package/src/{MWaterCustomTablesetListComponent.tsx → mwater_table_selection/MWaterCustomTablesetListComponent.tsx} +1 -1
- package/src/{MWaterMetricsTableListComponent.tsx → mwater_table_selection/MWaterMetricsTableListComponent.tsx} +1 -1
- package/src/{MWaterTableSelectComponent.tsx → mwater_table_selection/MWaterTableSelectComponent.tsx} +91 -90
- package/src/mwater_table_selection/MWaterWorkflowsSelectComponent.tsx +159 -0
- package/src/quickfilter/{QuickfiltersComponent.ts → QuickfiltersComponent.tsx} +165 -158
- package/src/quickfilter/TextLiteralComponent.tsx +197 -0
- package/src/widgets/MapWidget.tsx +9 -1
- package/src/widgets/charts/Chart.ts +17 -0
- package/src/widgets/charts/ChartWidgetComponent.tsx +36 -1
- package/src/widgets/charts/layered/LayeredChartDesign.ts +1 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +23 -24
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +260 -211
- package/src/widgets/charts/layered/LayeredChartUtils.ts +7 -7
- package/src/widgets/charts/pivot/PivotChart.ts +191 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +124 -129
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +4 -2
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +120 -149
- package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +178 -198
- package/src/widgets/charts/table/TableChart.ts +177 -1
- package/src/widgets/charts/table/TableChartDesignerComponent.tsx +422 -0
- package/src/widgets/charts/table/{TableChartViewComponent.ts → TableChartViewComponent.tsx} +65 -60
- package/src/widgets/text/ExprItemEditorComponent.tsx +83 -77
- package/src/widgets/text/ExprUpdateModalComponent.tsx +1 -0
- package/test/UndoStackTests.ts +52 -1
- package/.storybook/config.js +0 -7
- package/.storybook/head.html +0 -4
- package/.storybook/webpack.config.js +0 -15
- package/src/MWaterCompleteTableSelectComponent.tsx +0 -975
- package/src/maps/BingLayer.ts +0 -146
- package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
- package/src/quickfilter/TextLiteralComponent.ts +0 -165
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +0 -441
- package/stories/UpdateableComponent.js +0 -29
- package/stories/consoles.js +0 -202
- package/stories/dashboards.js +0 -217
- package/stories/datagridDesign.js +0 -114
- package/stories/datagrids.js +0 -69
- package/stories/dates.js +0 -80
- package/stories/exprcomponent.js +0 -43
- package/stories/index.js +0 -18
- package/stories/leaflet.js +0 -59
- package/stories/maps.js +0 -24
- package/stories/pivotChart.js +0 -235
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from "lodash"
|
|
2
2
|
import React from "react"
|
|
3
|
-
const R = React.createElement
|
|
4
3
|
|
|
5
4
|
import * as ui from "@mwater/react-library/lib/bootstrap"
|
|
6
5
|
import { IdLiteralComponent } from "@mwater/expressions-ui"
|
|
@@ -14,12 +13,14 @@ export interface MWaterGlobalFiltersComponentProps {
|
|
|
14
13
|
dataSource: DataSource
|
|
15
14
|
filterableTables: string[]
|
|
16
15
|
globalFilters?: GlobalFilter[]
|
|
17
|
-
onChange
|
|
16
|
+
onChange?: (globalFilters: GlobalFilter[]) => void
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
// Control to edit the global filters (_managed_by and admin_region)
|
|
21
20
|
export default class MWaterGlobalFiltersComponent extends React.Component<MWaterGlobalFiltersComponentProps> {
|
|
22
21
|
handleRegionsChange = (regions: any) => {
|
|
22
|
+
if (!this.props.onChange) { return }
|
|
23
|
+
|
|
23
24
|
// Remove existing filter
|
|
24
25
|
const globalFilters = _.filter(
|
|
25
26
|
this.props.globalFilters || [],
|
|
@@ -40,6 +41,8 @@ export default class MWaterGlobalFiltersComponent extends React.Component<MWater
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
handleManagedByChange = (managedBy: any) => {
|
|
44
|
+
if (!this.props.onChange) { return }
|
|
45
|
+
|
|
43
46
|
// Remove existing filter
|
|
44
47
|
const globalFilters = _.filter(
|
|
45
48
|
this.props.globalFilters || [],
|
|
@@ -80,38 +83,34 @@ export default class MWaterGlobalFiltersComponent extends React.Component<MWater
|
|
|
80
83
|
adminRegions = null
|
|
81
84
|
}
|
|
82
85
|
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
filter: { type: "field", tableAlias: "main", column: "canManageEntities" }
|
|
98
|
-
})
|
|
99
|
-
),
|
|
86
|
+
return (
|
|
87
|
+
<div>
|
|
88
|
+
<ui.FormGroup label={T`Only sites managed by`} labelMuted={true}>
|
|
89
|
+
<IdLiteralComponent
|
|
90
|
+
value={managedBy}
|
|
91
|
+
onChange={ this.props.onChange ? this.handleManagedByChange : undefined}
|
|
92
|
+
idTable="groups"
|
|
93
|
+
schema={this.props.schema}
|
|
94
|
+
dataSource={this.props.dataSource}
|
|
95
|
+
placeholder={T`All Organizations`}
|
|
96
|
+
multi={false}
|
|
97
|
+
filter={{ type: "field", tableAlias: "main", column: "canManageEntities" }}
|
|
98
|
+
/>
|
|
99
|
+
</ui.FormGroup>
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
)
|
|
101
|
+
<ui.FormGroup label={T`Only sites located in`} labelMuted={true}>
|
|
102
|
+
<IdLiteralComponent
|
|
103
|
+
value={adminRegions}
|
|
104
|
+
onChange={this.props.onChange ? this.handleRegionsChange : undefined}
|
|
105
|
+
idTable="admin_regions"
|
|
106
|
+
schema={this.props.schema}
|
|
107
|
+
dataSource={this.props.dataSource}
|
|
108
|
+
placeholder={T`All Regions`}
|
|
109
|
+
multi={true}
|
|
110
|
+
orderBy={[{ expr: { type: "field", tableAlias: "main", column: "level" }, direction: "asc" }]}
|
|
111
|
+
/>
|
|
112
|
+
</ui.FormGroup>
|
|
113
|
+
</div>
|
|
115
114
|
)
|
|
116
115
|
}
|
|
117
116
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from "lodash"
|
|
2
|
-
import React, { ReactElement } from "react"
|
|
3
|
-
const R = React.createElement
|
|
2
|
+
import React, { ReactElement, ReactNode } from "react"
|
|
4
3
|
|
|
5
4
|
import { DataSource, Schema } from "@mwater/expressions"
|
|
6
5
|
import AsyncLoadComponent from "@mwater/react-library/lib/AsyncLoadComponent"
|
|
@@ -24,9 +23,9 @@ export interface MWaterLoaderComponentProps {
|
|
|
24
23
|
locales?: string[]
|
|
25
24
|
/** Override default add layer component. See AddLayerComponent for details */
|
|
26
25
|
addLayerElementFactory?: AddLayerElementFactory
|
|
27
|
-
children: (error: any, config?: { schema: Schema; dataSource: DataSource }) => ReactElement<any>
|
|
26
|
+
children: (error: any, config?: { schema: Schema; dataSource: DataSource }) => ReactElement<any> | null
|
|
28
27
|
/** Custom error formatter that returns React node or string, gets passed the error response from server */
|
|
29
|
-
errorFormatter?: (data: any, defaultError:
|
|
28
|
+
errorFormatter?: (data: any, defaultError: ReactNode) => ReactNode
|
|
30
29
|
/** Origin of usage. e.g. "dashboards:43445364..." */
|
|
31
30
|
origin?: string
|
|
32
31
|
}
|
|
@@ -110,21 +109,21 @@ export default class MWaterLoaderComponent extends AsyncLoadComponent<
|
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
// Inject context
|
|
113
|
-
return
|
|
114
|
-
MWaterContextComponent
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
112
|
+
return (
|
|
113
|
+
<MWaterContextComponent
|
|
114
|
+
apiUrl={this.props.apiUrl}
|
|
115
|
+
client={this.props.client}
|
|
116
|
+
user={this.props.user}
|
|
117
|
+
schema={this.state.schema!}
|
|
118
|
+
extraTables={this.props.extraTables}
|
|
119
|
+
onExtraTablesChange={this.props.onExtraTablesChange}
|
|
120
|
+
addLayerElementFactory={this.props.addLayerElementFactory}
|
|
121
|
+
>
|
|
122
|
+
{this.props.children(this.state.error, {
|
|
123
|
+
schema: this.state.schema!,
|
|
124
|
+
dataSource: this.state.dataSource!
|
|
125
|
+
})}
|
|
126
|
+
</MWaterContextComponent>
|
|
128
127
|
)
|
|
129
128
|
}
|
|
130
129
|
}
|
package/src/UndoStack.ts
CHANGED
|
@@ -4,24 +4,32 @@ import _ from "lodash"
|
|
|
4
4
|
export default class UndoStack {
|
|
5
5
|
undoStack: any[]
|
|
6
6
|
redoStack: any[]
|
|
7
|
+
maxDepth?: number
|
|
7
8
|
|
|
8
|
-
constructor(undoStack?: any, redoStack?: any) {
|
|
9
|
+
constructor(undoStack?: any, redoStack?: any, maxDepth?: number) {
|
|
9
10
|
this.undoStack = undoStack || []
|
|
10
11
|
this.redoStack = redoStack || []
|
|
12
|
+
this.maxDepth = maxDepth
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
// Add a value to the stack
|
|
14
16
|
push(value: any) {
|
|
15
17
|
// No trivial pushes
|
|
16
|
-
if (
|
|
18
|
+
if (JSON.stringify(this.getValue()) === JSON.stringify(value)) {
|
|
17
19
|
return this
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
let undoStack = this.undoStack.slice()
|
|
21
23
|
undoStack.push(value)
|
|
24
|
+
|
|
25
|
+
// Limit stack depth if maxDepth is set
|
|
26
|
+
if (this.maxDepth && undoStack.length > this.maxDepth) {
|
|
27
|
+
undoStack = undoStack.slice(undoStack.length - this.maxDepth)
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
const redoStack: any = []
|
|
23
31
|
|
|
24
|
-
return new UndoStack(undoStack, redoStack)
|
|
32
|
+
return new UndoStack(undoStack, redoStack, this.maxDepth)
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
canUndo() {
|
|
@@ -39,7 +47,7 @@ export default class UndoStack {
|
|
|
39
47
|
|
|
40
48
|
const undoStack = _.initial(this.undoStack)
|
|
41
49
|
|
|
42
|
-
return new UndoStack(undoStack, redoStack)
|
|
50
|
+
return new UndoStack(undoStack, redoStack, this.maxDepth)
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
redo() {
|
|
@@ -49,7 +57,7 @@ export default class UndoStack {
|
|
|
49
57
|
|
|
50
58
|
const redoStack = _.initial(this.redoStack)
|
|
51
59
|
|
|
52
|
-
return new UndoStack(undoStack, redoStack)
|
|
60
|
+
return new UndoStack(undoStack, redoStack, this.maxDepth)
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
// Get the current value
|
|
@@ -107,7 +107,8 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
107
107
|
props.onDesignChange != null,
|
|
108
108
|
layoutOptionsOpen: false,
|
|
109
109
|
hideQuickfilters:
|
|
110
|
-
layoutOptions.hideQuickfiltersWidth
|
|
110
|
+
layoutOptions.hideQuickfiltersWidth === 0 ||
|
|
111
|
+
(layoutOptions.hideQuickfiltersWidth != null && layoutOptions.hideQuickfiltersWidth > document.body.clientWidth),
|
|
111
112
|
refreshKey: 1,
|
|
112
113
|
locale: initialLocale
|
|
113
114
|
}
|
|
@@ -303,23 +304,23 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
303
304
|
: undefined}
|
|
304
305
|
<a key="print" className="btn btn-link btn-sm" onClick={this.handlePrint}>
|
|
305
306
|
<span className="fas fa-print"/>
|
|
306
|
-
<span className="hide-
|
|
307
|
+
<span className="hide-800px"> {T`Print`}</span>
|
|
307
308
|
</a>
|
|
308
309
|
<a key="refresh" className="btn btn-link btn-sm" onClick={this.handleRefreshData}>
|
|
309
310
|
<span className="fas fa-sync"/>
|
|
310
|
-
<span className="hide-
|
|
311
|
+
<span className="hide-800px"> {T`Refresh`}</span>
|
|
311
312
|
</a>
|
|
312
313
|
{this.state.hideQuickfilters && this.props.design.quickfilters && this.props.design.quickfilters.length > 0
|
|
313
314
|
? <a key="showQuickfilters" className="btn btn-link btn-sm" onClick={this.handleShowQuickfilters}>
|
|
314
315
|
<span className="fa fa-filter"/>
|
|
315
|
-
<span className="hide-
|
|
316
|
+
<span className="hide-800px"> {T`Show Quickfilters`}</span>
|
|
316
317
|
</a>
|
|
317
318
|
: undefined}
|
|
318
319
|
|
|
319
320
|
{this.state.editing
|
|
320
321
|
? <a key="settings" className="btn btn-link btn-sm" onClick={this.handleSettings}>
|
|
321
322
|
<span className="fas fa-cog"/>
|
|
322
|
-
<span className="hide-
|
|
323
|
+
<span className="hide-800px"> {T`Settings`}</span>
|
|
323
324
|
</a>
|
|
324
325
|
: undefined}
|
|
325
326
|
{this.state.editing ? this.renderStyle() : undefined}
|
|
@@ -434,6 +435,7 @@ export default class DashboardComponent extends React.Component<DashboardCompone
|
|
|
434
435
|
<div style={{
|
|
435
436
|
display: "grid",
|
|
436
437
|
gridTemplateRows: this.props.hideTitleBar ? "auto 1fr" : "auto auto 1fr",
|
|
438
|
+
gridTemplateColumns: "minmax(0, 1fr)",
|
|
437
439
|
height: "100%"
|
|
438
440
|
}}>
|
|
439
441
|
{!this.props.hideTitleBar ? this.renderTitleBar() : undefined}
|
|
@@ -39,6 +39,6 @@ export interface DashboardDesign {
|
|
|
39
39
|
/** true to enable implicit filtering (see ImplicitFilterBuilder). Defaults to true for older dashboards. */
|
|
40
40
|
implicitFiltersEnabled?: boolean
|
|
41
41
|
|
|
42
|
-
/**
|
|
42
|
+
/** Array of global filters */
|
|
43
43
|
globalFilters?: GlobalFilter[]
|
|
44
44
|
}
|
|
@@ -91,8 +91,9 @@ export function LayoutOptionsComponent(props: {
|
|
|
91
91
|
<div style={{ backgroundColor: "#888" }}></div>
|
|
92
92
|
<div style={{ height: "100%", display: "grid", gridTemplateRows: "auto 1fr" }}>
|
|
93
93
|
<div key="quickfilters">
|
|
94
|
-
{layoutOptions.hideQuickfiltersWidth
|
|
95
|
-
|
|
94
|
+
{(layoutOptions.hideQuickfiltersWidth !== 0) &&
|
|
95
|
+
(layoutOptions.hideQuickfiltersWidth == null ||
|
|
96
|
+
sizeOptions[previewSize].value.width > layoutOptions.hideQuickfiltersWidth)
|
|
96
97
|
? props.quickfiltersView
|
|
97
98
|
: null}
|
|
98
99
|
</div>
|
|
@@ -376,6 +377,7 @@ function CustomizeLayout(props: { layoutOptions: BlocksLayoutOptions; onLayoutOp
|
|
|
376
377
|
onLayoutOptionsChange({ ...layoutOptions, hideQuickfiltersWidth })
|
|
377
378
|
}}
|
|
378
379
|
sign="< "
|
|
380
|
+
includeAlways
|
|
379
381
|
/>
|
|
380
382
|
</FormGroup>
|
|
381
383
|
<FormGroup label={T`Minimum Width (before scrolling or scaling)`}>
|
|
@@ -515,20 +517,30 @@ function WidthSelector(props: {
|
|
|
515
517
|
onChange: (value: number | null) => void
|
|
516
518
|
/** E.g. >=, <= */
|
|
517
519
|
sign: string
|
|
520
|
+
/** If true, include an "Always" option with value 0 */
|
|
521
|
+
includeAlways?: boolean
|
|
518
522
|
}) {
|
|
523
|
+
// Create options array with conditional "Always" option
|
|
524
|
+
const options = [
|
|
525
|
+
{ value: 400, label: `${props.sign}400px (${T`Phone`})` },
|
|
526
|
+
{ value: 600, label: `${props.sign}600px (${T`Small tablet`})` },
|
|
527
|
+
{ value: 800, label: `${props.sign}800px (${T`Tablet`})` },
|
|
528
|
+
{ value: 1000, label: `${props.sign}1000px (${T`Laptop`})` },
|
|
529
|
+
{ value: 1200, label: `${props.sign}1200px (${T`Desktop`})` },
|
|
530
|
+
{ value: 1600, label: `${props.sign}1600px (${T`Wide Desktop`})` }
|
|
531
|
+
]
|
|
532
|
+
|
|
533
|
+
// Add "Always" option if requested
|
|
534
|
+
if (props.includeAlways) {
|
|
535
|
+
options.push({ value: 0, label: T`Always` })
|
|
536
|
+
}
|
|
537
|
+
|
|
519
538
|
return (
|
|
520
539
|
<Select
|
|
521
540
|
value={props.value}
|
|
522
541
|
onChange={props.onChange}
|
|
523
542
|
nullLabel={T`N/A`}
|
|
524
|
-
options={
|
|
525
|
-
{ value: 400, label: `${props.sign}400px (${T`Phone`})` },
|
|
526
|
-
{ value: 600, label: `${props.sign}600px (${T`Small tablet`})` },
|
|
527
|
-
{ value: 800, label: `${props.sign}800px (${T`Tablet`})` },
|
|
528
|
-
{ value: 1000, label: `${props.sign}1000px (${T`Laptop`})` },
|
|
529
|
-
{ value: 1200, label: `${props.sign}1200px (${T`Desktop`})` },
|
|
530
|
-
{ value: 1600, label: `${props.sign}1600px (${T`Wide Desktop`})` }
|
|
531
|
-
]}
|
|
543
|
+
options={options}
|
|
532
544
|
/>
|
|
533
545
|
)
|
|
534
546
|
}
|
|
@@ -28,7 +28,7 @@ interface ServerDashboardDataSourceOptions {
|
|
|
28
28
|
dataSource: DataSource
|
|
29
29
|
|
|
30
30
|
/** revision to use to allow caching */
|
|
31
|
-
rev
|
|
31
|
+
rev?: number
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
interface ServerWidgetDataSourceOptions extends ServerDashboardDataSourceOptions {
|
|
@@ -407,12 +407,6 @@ class ServerWidgetLayerDataSource implements MapLayerDataSource {
|
|
|
407
407
|
|
|
408
408
|
let url = `${this.options.apiUrl}maps/tiles/{z}/{x}/{y}.${extension}?` + querystring.stringify(query)
|
|
409
409
|
|
|
410
|
-
// Add subdomains: {s} will be substituted with "a", "b" or "c" in leaflet for api.mwater.co only.
|
|
411
|
-
// Used to speed queries
|
|
412
|
-
if (url.match(/^https:\/\/api\.mwater\.co\//)) {
|
|
413
|
-
url = url.replace(/^https:\/\/api\.mwater\.co\//, "https://{s}-api.mwater.co/")
|
|
414
|
-
}
|
|
415
|
-
|
|
416
410
|
return url
|
|
417
411
|
}
|
|
418
412
|
|
|
@@ -421,12 +415,6 @@ class ServerWidgetLayerDataSource implements MapLayerDataSource {
|
|
|
421
415
|
let where
|
|
422
416
|
let url = `${this.options.apiUrl}maps/tiles/{z}/{x}/{y}.${extension}?type=${design.type}&radius=1000`
|
|
423
417
|
|
|
424
|
-
// Add subdomains: {s} will be substituted with "a", "b" or "c" in leaflet for api.mwater.co only.
|
|
425
|
-
// Used to speed queries
|
|
426
|
-
if (url.match(/^https:\/\/api\.mwater\.co\//)) {
|
|
427
|
-
url = url.replace(/^https:\/\/api\.mwater\.co\//, "https://{s}-api.mwater.co/")
|
|
428
|
-
}
|
|
429
|
-
|
|
430
418
|
if (this.options.client) {
|
|
431
419
|
url += `&client=${this.options.client}`
|
|
432
420
|
}
|
|
@@ -454,6 +442,41 @@ class ServerWidgetLayerDataSource implements MapLayerDataSource {
|
|
|
454
442
|
|
|
455
443
|
return url
|
|
456
444
|
}
|
|
445
|
+
|
|
446
|
+
/** Gets hover over data for hover over items
|
|
447
|
+
* @param design The design of the layer
|
|
448
|
+
* @param data The data of the current item being hovered over. e.g. { id: 123 }
|
|
449
|
+
* @param filters The filters to apply to the layer does not include filters that narrow down to a specific item
|
|
450
|
+
* @returns A promise that resolves to the hover over data, indexed by the id of the hover over item
|
|
451
|
+
*/
|
|
452
|
+
async getHoverOverData(design: any, data: any, filters: JsonQLFilter[]): Promise<{ [key: string]: any }> {
|
|
453
|
+
const query = {
|
|
454
|
+
client: this.options.client,
|
|
455
|
+
share: this.options.share,
|
|
456
|
+
filters: compressJson(filters || []),
|
|
457
|
+
data: compressJson(data),
|
|
458
|
+
rev: this.options.rev
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
const url =
|
|
462
|
+
`${this.options.apiUrl}dashboards/${this.options.dashboardId}/widgets/${this.options.widgetId}/layers/${this.options.layerView.id}/hoverdata?` +
|
|
463
|
+
querystring.stringify(query)
|
|
464
|
+
|
|
465
|
+
const response = await fetch(url, {
|
|
466
|
+
method: "GET",
|
|
467
|
+
headers: {
|
|
468
|
+
Accept: "application/json"
|
|
469
|
+
}
|
|
470
|
+
})
|
|
471
|
+
|
|
472
|
+
if (!response.ok) {
|
|
473
|
+
const errorText = await response.text()
|
|
474
|
+
console.error(errorText)
|
|
475
|
+
throw new Error(`Error fetching hover data: ${response.statusText}`)
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return await response.json()
|
|
479
|
+
}
|
|
457
480
|
}
|
|
458
481
|
|
|
459
482
|
interface ServerWidgetLayerPopupDataSourceOptions extends ServerDashboardDataSourceOptions {
|
|
@@ -259,7 +259,7 @@ function LanguageTab({ design, onDesignChange, schema }: LanguageTabProps) {
|
|
|
259
259
|
).length
|
|
260
260
|
|
|
261
261
|
// Round down to nearest percent
|
|
262
|
-
percentages[locale] = Math.floor((translatedCount / totalStrings) * 100)
|
|
262
|
+
percentages[locale] = (totalStrings > 0) ? Math.floor((translatedCount / totalStrings) * 100) : 0
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
return percentages
|
|
@@ -21,7 +21,11 @@ export interface BlocksLayoutOptions {
|
|
|
21
21
|
/** Width above which pads */
|
|
22
22
|
maximumWidth: number | null
|
|
23
23
|
|
|
24
|
-
/** Width at which to hide quickfilters.
|
|
24
|
+
/** Width at which to hide quickfilters.
|
|
25
|
+
* Null for never hide
|
|
26
|
+
* 0 for always hide
|
|
27
|
+
* Positive number for responsive hiding based on width
|
|
28
|
+
*/
|
|
25
29
|
hideQuickfiltersWidth: number | null
|
|
26
30
|
|
|
27
31
|
/** The padding around the entire dashboard */
|
|
@@ -380,7 +380,7 @@ export default forwardRef<DatagridComponentRef, DatagridComponentProps>(function
|
|
|
380
380
|
return (
|
|
381
381
|
<div style={{ position: "absolute", top: 0, left: 0, right: 0, height: 40, padding: 4 }}>
|
|
382
382
|
<div style={{ float: "right" }}>
|
|
383
|
-
{design.showNumRows && numRows ? <small className='text-muted text-sm'>{`${d3Format(',')(numRows)} rows`}</small> : undefined}
|
|
383
|
+
{design.showNumRows && numRows ? <small className='text-muted text-sm me-2'>{`${d3Format(',')(numRows)} rows`}</small> : undefined}
|
|
384
384
|
{renderDeleteRows()}
|
|
385
385
|
{renderFindReplace()}
|
|
386
386
|
{renderCellEdit()}
|
|
@@ -529,8 +529,36 @@ export default forwardRef<DatagridComponentRef, DatagridComponentProps>(function
|
|
|
529
529
|
)
|
|
530
530
|
} else if (onDesignChange) {
|
|
531
531
|
return (
|
|
532
|
-
<div style={{
|
|
533
|
-
|
|
532
|
+
<div style={{
|
|
533
|
+
display: "flex",
|
|
534
|
+
flexDirection: "column",
|
|
535
|
+
alignItems: "center",
|
|
536
|
+
justifyContent: "center",
|
|
537
|
+
height: "100%",
|
|
538
|
+
padding: "40px"
|
|
539
|
+
}}>
|
|
540
|
+
<div style={{
|
|
541
|
+
textAlign: "center",
|
|
542
|
+
marginBottom: "24px"
|
|
543
|
+
}}>
|
|
544
|
+
<i className="fas fa-table text-muted" style={{
|
|
545
|
+
fontSize: "48px",
|
|
546
|
+
marginBottom: "16px"
|
|
547
|
+
}} />
|
|
548
|
+
<div style={{
|
|
549
|
+
fontSize: "14px"
|
|
550
|
+
}} className="text-muted">
|
|
551
|
+
{T`Configure a data source and columns to get started.`}
|
|
552
|
+
</div>
|
|
553
|
+
</div>
|
|
554
|
+
|
|
555
|
+
<button
|
|
556
|
+
className="btn btn-primary"
|
|
557
|
+
onClick={handleEdit}
|
|
558
|
+
>
|
|
559
|
+
<i className="fas fa-cog" style={{ marginRight: "8px" }} />
|
|
560
|
+
{T`Configure`}
|
|
561
|
+
</button>
|
|
534
562
|
</div>
|
|
535
563
|
)
|
|
536
564
|
} else {
|