@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
|
@@ -2,7 +2,7 @@ import _ from "lodash"
|
|
|
2
2
|
import { Schema, LocalizedString, Table, ExprUtils } from "@mwater/expressions"
|
|
3
3
|
import { useState, useEffect } from "react"
|
|
4
4
|
import React from "react"
|
|
5
|
-
import { OptionListComponent } from "
|
|
5
|
+
import { OptionListComponent } from "../UIComponents"
|
|
6
6
|
import { TextInput } from "@mwater/react-library/lib/bootstrap"
|
|
7
7
|
|
|
8
8
|
/** Searchable list of custom tables */
|
|
@@ -2,7 +2,7 @@ import _ from "lodash"
|
|
|
2
2
|
import { Schema, LocalizedString, Table, ExprUtils } from "@mwater/expressions"
|
|
3
3
|
import { useState, useEffect } from "react"
|
|
4
4
|
import React from "react"
|
|
5
|
-
import { OptionListComponent } from "
|
|
5
|
+
import { OptionListComponent } from "../UIComponents"
|
|
6
6
|
import { TextInput } from "@mwater/react-library/lib/bootstrap"
|
|
7
7
|
|
|
8
8
|
/** Searchable list of metric tables */
|
package/src/{MWaterTableSelectComponent.tsx → mwater_table_selection/MWaterTableSelectComponent.tsx}
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _ from "lodash"
|
|
2
2
|
import React from "react"
|
|
3
|
-
|
|
4
|
-
import { ToggleEditComponent, OptionListComponent } from "./UIComponents"
|
|
3
|
+
import { ToggleEditComponent, OptionListComponent } from "../UIComponents"
|
|
5
4
|
import { ExprUtils, Schema } from "@mwater/expressions"
|
|
6
|
-
import MWaterResponsesFilterComponent from "
|
|
5
|
+
import MWaterResponsesFilterComponent from "../MWaterResponsesFilterComponent"
|
|
7
6
|
import ModalPopupComponent from "@mwater/react-library/lib/ModalPopupComponent"
|
|
8
7
|
import MWaterCompleteTableSelectComponent from "./MWaterCompleteTableSelectComponent"
|
|
9
8
|
import { ActiveTablesContext } from "@mwater/expressions-ui"
|
|
@@ -18,16 +17,16 @@ export interface MWaterTableSelectComponentProps {
|
|
|
18
17
|
user?: string
|
|
19
18
|
table?: string
|
|
20
19
|
/** Called with table selected */
|
|
21
|
-
onChange:
|
|
22
|
-
extraTables
|
|
23
|
-
onExtraTablesChange:
|
|
20
|
+
onChange: (table: string | null) => void
|
|
21
|
+
extraTables?: string[]
|
|
22
|
+
onExtraTablesChange?: (tables: string[]) => void
|
|
24
23
|
/** Can also perform filtering for some types. Include these props to enable this */
|
|
25
24
|
filter?: any
|
|
26
|
-
onFilterChange?: any
|
|
25
|
+
onFilterChange?: (filter: any) => void
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
interface MWaterTableSelectComponentState {
|
|
30
|
-
pendingExtraTable:
|
|
29
|
+
pendingExtraTable: string | null
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
// Allows selection of a mwater-visualization table. Loads forms as well and calls event if modified
|
|
@@ -35,7 +34,7 @@ export default class MWaterTableSelectComponent extends React.Component<
|
|
|
35
34
|
MWaterTableSelectComponentProps,
|
|
36
35
|
MWaterTableSelectComponentState
|
|
37
36
|
> {
|
|
38
|
-
toggleEdit:
|
|
37
|
+
toggleEdit: ToggleEditComponent | null = null
|
|
39
38
|
|
|
40
39
|
constructor(props: MWaterTableSelectComponentProps) {
|
|
41
40
|
super(props)
|
|
@@ -45,46 +44,46 @@ export default class MWaterTableSelectComponent extends React.Component<
|
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
componentDidUpdate(prevProps: MWaterTableSelectComponentProps) {
|
|
49
48
|
// If received new schema with pending extra table, select it
|
|
50
|
-
let table
|
|
49
|
+
let table: string | null = null
|
|
51
50
|
if (this.state.pendingExtraTable) {
|
|
52
51
|
table = this.state.pendingExtraTable
|
|
53
|
-
if (
|
|
52
|
+
if (this.props.schema.getTable(table)) {
|
|
54
53
|
// No longer waiting
|
|
55
54
|
this.setState({ pendingExtraTable: null })
|
|
56
55
|
|
|
57
56
|
// Close toggle edit
|
|
58
|
-
this.toggleEdit
|
|
57
|
+
this.toggleEdit?.close()
|
|
59
58
|
|
|
60
59
|
// Fire change
|
|
61
|
-
|
|
60
|
+
this.props.onChange(table)
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
// If table is newly selected and is a responses table and no filters, set filters to final only
|
|
66
65
|
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
!
|
|
71
|
-
|
|
66
|
+
this.props.table &&
|
|
67
|
+
this.props.table.match(/responses:/) &&
|
|
68
|
+
this.props.table !== prevProps.table &&
|
|
69
|
+
!this.props.filter &&
|
|
70
|
+
this.props.onFilterChange
|
|
72
71
|
) {
|
|
73
|
-
|
|
72
|
+
this.props.onFilterChange({
|
|
74
73
|
type: "op",
|
|
75
74
|
op: "= any",
|
|
76
|
-
table:
|
|
75
|
+
table: this.props.table,
|
|
77
76
|
exprs: [
|
|
78
|
-
{ type: "field", table:
|
|
77
|
+
{ type: "field", table: this.props.table, column: "status" },
|
|
79
78
|
{ type: "literal", valueType: "enumset", value: ["final"] }
|
|
80
79
|
]
|
|
81
80
|
})
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
handleChange = (tableId:
|
|
84
|
+
handleChange = (tableId: string | null) => {
|
|
86
85
|
// Close toggle edit
|
|
87
|
-
this.toggleEdit
|
|
86
|
+
this.toggleEdit?.close()
|
|
88
87
|
|
|
89
88
|
// Call onChange if different
|
|
90
89
|
if (tableId !== this.props.table) {
|
|
@@ -92,68 +91,70 @@ export default class MWaterTableSelectComponent extends React.Component<
|
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
handleTableChange = (tableId:
|
|
94
|
+
handleTableChange = (tableId: string | null) => {
|
|
96
95
|
// If not part of extra tables, add it and wait for new schema
|
|
97
96
|
if (tableId && !this.props.schema.getTable(tableId)) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
if (this.props.onExtraTablesChange) {
|
|
98
|
+
this.setState({ pendingExtraTable: tableId }, () => {
|
|
99
|
+
this.props.onExtraTablesChange!(_.union(this.props.extraTables || [], [tableId]))
|
|
100
|
+
})
|
|
101
|
+
} else {
|
|
102
|
+
alert(T`Cannot add new tables.`)
|
|
103
|
+
}
|
|
101
104
|
} else {
|
|
102
|
-
|
|
105
|
+
this.handleChange(tableId)
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
render() {
|
|
107
|
-
const editor =
|
|
108
|
-
apiUrl
|
|
109
|
-
client
|
|
110
|
-
schema
|
|
111
|
-
user
|
|
112
|
-
table
|
|
113
|
-
onChange
|
|
114
|
-
extraTables
|
|
115
|
-
onExtraTablesChange
|
|
116
|
-
|
|
110
|
+
const editor = <EditModeTableSelectComponent
|
|
111
|
+
apiUrl={this.props.apiUrl}
|
|
112
|
+
client={this.props.client}
|
|
113
|
+
schema={this.props.schema}
|
|
114
|
+
user={this.props.user}
|
|
115
|
+
table={this.props.table}
|
|
116
|
+
onChange={this.handleTableChange}
|
|
117
|
+
extraTables={this.props.extraTables}
|
|
118
|
+
onExtraTablesChange={this.props.onExtraTablesChange}
|
|
119
|
+
/>
|
|
117
120
|
|
|
118
|
-
return
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
`\u00a0${T`Please wait...`}`
|
|
128
|
-
)
|
|
129
|
-
: undefined,
|
|
121
|
+
return (
|
|
122
|
+
<div>
|
|
123
|
+
{/* Show message if loading */}
|
|
124
|
+
{this.state.pendingExtraTable ? (
|
|
125
|
+
<div className="alert alert-info" key="pendingExtraTable">
|
|
126
|
+
<i className="fa fa-spinner fa-spin"/>
|
|
127
|
+
{T`Please wait...`}
|
|
128
|
+
</div>
|
|
129
|
+
) : undefined}
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
131
|
+
<ToggleEditComponent
|
|
132
|
+
ref={(c: ToggleEditComponent | null) => {
|
|
133
|
+
this.toggleEdit = c
|
|
134
|
+
}}
|
|
135
|
+
forceOpen={!this.props.table} // Must have table
|
|
136
|
+
label={this.props.table
|
|
137
|
+
? ExprUtils.localizeString(this.props.schema.getTable(this.props.table)?.name, T.locale)
|
|
138
|
+
: ""}
|
|
139
|
+
editor={editor}
|
|
140
|
+
onRemove={() => {
|
|
141
|
+
this.props.onChange(null)
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
145
|
+
{/* Make sure table still exists */}
|
|
146
|
+
{this.props.table &&
|
|
147
|
+
this.props.onFilterChange &&
|
|
148
|
+
this.props.table.match(/^responses:/) &&
|
|
149
|
+
this.props.schema.getTable(this.props.table) ? (
|
|
150
|
+
<MWaterResponsesFilterComponent
|
|
151
|
+
schema={this.props.schema}
|
|
152
|
+
table={this.props.table}
|
|
153
|
+
filter={this.props.filter}
|
|
154
|
+
onFilterChange={this.props.onFilterChange}
|
|
155
|
+
/>
|
|
156
|
+
) : undefined}
|
|
157
|
+
</div>
|
|
157
158
|
)
|
|
158
159
|
}
|
|
159
160
|
}
|
|
@@ -168,13 +169,13 @@ interface EditModeTableSelectComponentProps {
|
|
|
168
169
|
user?: string
|
|
169
170
|
table?: string
|
|
170
171
|
/** Called with table selected */
|
|
171
|
-
onChange:
|
|
172
|
-
extraTables
|
|
173
|
-
onExtraTablesChange:
|
|
172
|
+
onChange: (table: string | null) => void
|
|
173
|
+
extraTables?: string[]
|
|
174
|
+
onExtraTablesChange?: (tables: string[]) => void
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
interface EditModeTableSelectComponentState {
|
|
177
|
-
completeMode:
|
|
178
|
+
completeMode: boolean
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
// Is the table select component when in edit mode. Toggles between complete list and simplified list
|
|
@@ -182,7 +183,7 @@ class EditModeTableSelectComponent extends React.Component<
|
|
|
182
183
|
EditModeTableSelectComponentProps,
|
|
183
184
|
EditModeTableSelectComponentState
|
|
184
185
|
> {
|
|
185
|
-
constructor(props:
|
|
186
|
+
constructor(props: EditModeTableSelectComponentProps) {
|
|
186
187
|
super(props)
|
|
187
188
|
|
|
188
189
|
this.state = {
|
|
@@ -203,7 +204,7 @@ class EditModeTableSelectComponent extends React.Component<
|
|
|
203
204
|
|
|
204
205
|
// Remove dead tables
|
|
205
206
|
tables = tables.filter(
|
|
206
|
-
(t:
|
|
207
|
+
(t: string) => this.props.schema.getTable(t) != null && !this.props.schema.getTable(t)?.deprecated
|
|
207
208
|
)
|
|
208
209
|
tables = _.union(
|
|
209
210
|
tables,
|
|
@@ -223,7 +224,7 @@ class EditModeTableSelectComponent extends React.Component<
|
|
|
223
224
|
}
|
|
224
225
|
} else {
|
|
225
226
|
// Add if exists
|
|
226
|
-
if (this.props.schema.getTable(extraTable) && !this.props.schema.getTable(extraTable)
|
|
227
|
+
if (this.props.schema.getTable(extraTable) && !this.props.schema.getTable(extraTable)?.deprecated) {
|
|
227
228
|
tables = _.union(tables, [extraTable])
|
|
228
229
|
}
|
|
229
230
|
}
|
|
@@ -231,13 +232,13 @@ class EditModeTableSelectComponent extends React.Component<
|
|
|
231
232
|
|
|
232
233
|
// Sort by name
|
|
233
234
|
tables = _.sortBy(tables, (tableId) =>
|
|
234
|
-
ExprUtils.localizeString(this.props.schema.getTable(tableId)
|
|
235
|
+
ExprUtils.localizeString(this.props.schema.getTable(tableId)?.name, T.locale)
|
|
235
236
|
)
|
|
236
237
|
|
|
237
238
|
return tables
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
handleCompleteChange = (tableId:
|
|
241
|
+
handleCompleteChange = (tableId: string | null) => {
|
|
241
242
|
this.setState({ completeMode: false })
|
|
242
243
|
return this.props.onChange(tableId)
|
|
243
244
|
}
|
|
@@ -245,7 +246,7 @@ class EditModeTableSelectComponent extends React.Component<
|
|
|
245
246
|
render() {
|
|
246
247
|
return (
|
|
247
248
|
<ActiveTablesContext.Consumer>
|
|
248
|
-
{activeTables => (
|
|
249
|
+
{(activeTables: string[]) => (
|
|
249
250
|
<div>
|
|
250
251
|
{this.state.completeMode ? (
|
|
251
252
|
<ModalPopupComponent
|
|
@@ -271,11 +272,11 @@ class EditModeTableSelectComponent extends React.Component<
|
|
|
271
272
|
<>
|
|
272
273
|
<div className="text-muted">{T`Select Data Source:`}</div>
|
|
273
274
|
<OptionListComponent items={this.getTableShortlist(activeTables).map((tableId) => {
|
|
274
|
-
const table = this.props.schema.getTable(tableId)
|
|
275
|
+
const table = this.props.schema.getTable(tableId)
|
|
275
276
|
return {
|
|
276
|
-
name: ExprUtils.localizeString(table
|
|
277
|
-
desc: ExprUtils.localizeString(table
|
|
278
|
-
onClick: () => this.props.onChange(table.id)
|
|
277
|
+
name: ExprUtils.localizeString(table?.name, T.locale),
|
|
278
|
+
desc: ExprUtils.localizeString(table?.desc, T.locale),
|
|
279
|
+
onClick: () => table && this.props.onChange(table.id)
|
|
279
280
|
}
|
|
280
281
|
})} />
|
|
281
282
|
<div>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import _ from "lodash"
|
|
2
|
+
import $ from "jquery"
|
|
3
|
+
import React, { useState, useEffect } from "react"
|
|
4
|
+
import querystring from "querystring"
|
|
5
|
+
import * as uiComponents from "../UIComponents"
|
|
6
|
+
import { ExprUtils, Schema } from "@mwater/expressions"
|
|
7
|
+
import { WorkflowType } from "@mwater/common/lib/tables/workflow_types"
|
|
8
|
+
|
|
9
|
+
interface MWaterWorkflowsSelectComponentProps {
|
|
10
|
+
/** Url to hit api */
|
|
11
|
+
apiUrl: string
|
|
12
|
+
/** Optional client */
|
|
13
|
+
client?: string
|
|
14
|
+
schema: Schema
|
|
15
|
+
/** User id */
|
|
16
|
+
user?: string
|
|
17
|
+
/** Called with table selected */
|
|
18
|
+
onChange: (tableId: string) => void
|
|
19
|
+
extraTables: string[]
|
|
20
|
+
onExtraTableAdd: (tableId: string) => void
|
|
21
|
+
onExtraTableRemove: (tableId: string) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface WorkflowTypeItem {
|
|
25
|
+
id: string
|
|
26
|
+
name: string
|
|
27
|
+
desc?: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Searchable list of workflow types */
|
|
31
|
+
export function MWaterWorkflowsSelectComponent(props: MWaterWorkflowsSelectComponentProps) {
|
|
32
|
+
const [workflowTypes, setWorkflowTypes] = useState<WorkflowTypeItem[] | null>(null)
|
|
33
|
+
const [search, setSearch] = useState("")
|
|
34
|
+
const [error, setError] = useState<string | null>(null)
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
// Get names and basic of workflow types
|
|
38
|
+
const query: any = {}
|
|
39
|
+
query.fields = JSON.stringify({
|
|
40
|
+
name: 1,
|
|
41
|
+
description: 1,
|
|
42
|
+
roles: 1,
|
|
43
|
+
_created_by: 1,
|
|
44
|
+
_modified_on: 1
|
|
45
|
+
})
|
|
46
|
+
query.client = props.client
|
|
47
|
+
|
|
48
|
+
// Get list of all workflow types
|
|
49
|
+
$.getJSON(props.apiUrl + "workflow_types?" + querystring.stringify(query), (types: WorkflowType[]) => {
|
|
50
|
+
// Sort by included first, then user-created, then by name
|
|
51
|
+
types = _.sortByOrder(
|
|
52
|
+
types,
|
|
53
|
+
[
|
|
54
|
+
(type: WorkflowType) => ((props.extraTables || []).includes("workflows:" + type._id) ? 0 : 1),
|
|
55
|
+
(type: WorkflowType) => (type._created_by === props.user ? 0 : 1),
|
|
56
|
+
(type: WorkflowType) => ExprUtils.localizeString(type.name, T.locale) || T`Untitled Workflow Type`
|
|
57
|
+
],
|
|
58
|
+
["asc", "asc", "asc"]
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
setWorkflowTypes(
|
|
62
|
+
_.map(types, (type) => ({
|
|
63
|
+
id: type._id,
|
|
64
|
+
name: ExprUtils.localizeString(type.name, T.locale) || T`Untitled Workflow Type`,
|
|
65
|
+
desc: ExprUtils.localizeString(type.description, T.locale)
|
|
66
|
+
}))
|
|
67
|
+
)
|
|
68
|
+
}).fail((xhr: any) => {
|
|
69
|
+
setError(xhr.responseText)
|
|
70
|
+
})
|
|
71
|
+
}, [props.apiUrl, props.client, props.user, props.extraTables])
|
|
72
|
+
|
|
73
|
+
const handleTableRemove = (table: WorkflowTypeItem) => {
|
|
74
|
+
if (
|
|
75
|
+
confirm(
|
|
76
|
+
T`Remove ${table.name}? Any widgets that depend on it will no longer work properly.`
|
|
77
|
+
)
|
|
78
|
+
) {
|
|
79
|
+
props.onExtraTableRemove(`workflows:${table.id}`)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (error) {
|
|
84
|
+
return <div className="alert alert-danger">{error}</div>
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Filter workflow types by search
|
|
88
|
+
let filteredWorkflowTypes: WorkflowTypeItem[] | null = workflowTypes
|
|
89
|
+
if (search && workflowTypes) {
|
|
90
|
+
const escapeRegExp = (s: string) => s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")
|
|
91
|
+
const searchStringRegExp = new RegExp(escapeRegExp(search), "i")
|
|
92
|
+
filteredWorkflowTypes = _.filter(workflowTypes, (type) => type.name.match(searchStringRegExp))
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Remove if already included
|
|
96
|
+
filteredWorkflowTypes = _.filter(
|
|
97
|
+
filteredWorkflowTypes || [],
|
|
98
|
+
(wt) => !(props.extraTables || []).includes(`workflows:${wt.id}`)
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
// Get included workflow tables from schema
|
|
102
|
+
let includedTables = _.filter(
|
|
103
|
+
props.schema.getTables(),
|
|
104
|
+
(table) => (table.id.match(/^workflows:/) || table.id.match(/^workflow_events:/)) && !table.deprecated
|
|
105
|
+
)
|
|
106
|
+
includedTables = _.sortBy(includedTables, (t) => t.name.en)
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div>
|
|
110
|
+
<label>{T`Included Workflows:`}</label>
|
|
111
|
+
{includedTables.length > 0 ? (
|
|
112
|
+
<uiComponents.OptionListComponent
|
|
113
|
+
items={_.map(includedTables, (table) => {
|
|
114
|
+
return {
|
|
115
|
+
name: ExprUtils.localizeString(table.name, T.locale),
|
|
116
|
+
desc: ExprUtils.localizeString(table.desc, T.locale),
|
|
117
|
+
onClick: () => props.onChange(table.id),
|
|
118
|
+
onRemove: () => handleTableRemove({ id: table.id.replace(/^workflows:/, ""), name: ExprUtils.localizeString(table.name, T.locale) })
|
|
119
|
+
}
|
|
120
|
+
})}
|
|
121
|
+
/>
|
|
122
|
+
) : (
|
|
123
|
+
<div>{T`None`}</div>
|
|
124
|
+
)}
|
|
125
|
+
|
|
126
|
+
<br />
|
|
127
|
+
|
|
128
|
+
<label>{T`All Workflows:`}</label>
|
|
129
|
+
{!workflowTypes || workflowTypes.length === 0 ? (
|
|
130
|
+
<div className="alert alert-info">
|
|
131
|
+
<i className="fa fa-spinner fa-spin" />
|
|
132
|
+
{T`Loading...`}
|
|
133
|
+
</div>
|
|
134
|
+
) : (
|
|
135
|
+
<>
|
|
136
|
+
<input
|
|
137
|
+
type="text"
|
|
138
|
+
className="form-control form-control-sm"
|
|
139
|
+
placeholder={T`Search...`}
|
|
140
|
+
key="search"
|
|
141
|
+
autoFocus
|
|
142
|
+
style={{ maxWidth: "20em", marginBottom: 10 }}
|
|
143
|
+
value={search}
|
|
144
|
+
onChange={(ev) => setSearch(ev.target.value)}
|
|
145
|
+
/>
|
|
146
|
+
|
|
147
|
+
<uiComponents.OptionListComponent
|
|
148
|
+
items={_.map(filteredWorkflowTypes, (workflowType) => ({
|
|
149
|
+
name: workflowType.name,
|
|
150
|
+
desc: workflowType.desc,
|
|
151
|
+
onClick: () => props.onChange("workflows:" + workflowType.id)
|
|
152
|
+
}))}
|
|
153
|
+
/>
|
|
154
|
+
</>
|
|
155
|
+
)}
|
|
156
|
+
</div>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|