@mwater/visualization 5.2.0 → 5.3.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/ColorComponent.d.ts +10 -11
- package/lib/ColorComponent.js +78 -29
- package/lib/ColorSchemeFactory.d.ts +13 -2
- package/lib/ColorSchemeFactory.js +7 -5
- package/lib/CustomColorsContext.d.ts +6 -0
- package/lib/CustomColorsContext.js +6 -0
- package/lib/FiltersDesignerComponent.d.ts +1 -4
- package/lib/FiltersDesignerComponent.js +2 -3
- package/lib/LocaleContextInjector.d.ts +5 -11
- package/lib/LocaleContextInjector.js +4 -12
- package/lib/MWaterAddRelatedFormComponent.js +3 -3
- package/lib/MWaterAddRelatedIndicatorComponent.d.ts +1 -4
- package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
- package/lib/MWaterCompleteTableSelectComponent.d.ts +5 -16
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +4 -6
- package/lib/MWaterContextComponent.js +4 -13
- package/lib/MWaterLoaderComponent.d.ts +5 -3
- package/lib/MWaterLoaderComponent.js +2 -1
- package/lib/MWaterTableSelectComponent.d.ts +1 -4
- package/lib/MWaterTableSelectComponent.js +10 -12
- package/lib/UIComponents.d.ts +2 -2
- package/lib/UIComponents.js +4 -12
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +3 -1
- package/lib/axes/AxisComponent.d.ts +2 -5
- package/lib/axes/AxisComponent.js +1 -2
- package/lib/axes/ColorPaletteCollectionComponent.d.ts +5 -12
- package/lib/axes/ColorPaletteCollectionComponent.js +67 -36
- package/lib/dashboards/DashboardComponent.d.ts +4 -12
- package/lib/dashboards/DashboardComponent.js +18 -38
- package/lib/dashboards/DashboardDesign.d.ts +3 -3
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +109 -132
- package/lib/dashboards/FontStyleEditor.d.ts +8 -0
- package/lib/dashboards/FontStyleEditor.js +130 -0
- package/lib/dashboards/LayoutOptionsComponent.d.ts +0 -1
- package/lib/dashboards/LayoutOptionsComponent.js +211 -42
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/WidgetComponent.d.ts +3 -3
- package/lib/dashboards/WidgetComponent.js +3 -6
- package/lib/dashboards/WidgetDataSourcePrioritizer.d.ts +20 -0
- package/lib/dashboards/WidgetDataSourcePrioritizer.js +72 -0
- package/lib/dashboards/layoutOptions.d.ts +83 -0
- package/lib/dashboards/layoutOptions.js +436 -10
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.js +87 -33
- package/lib/demo.js +3 -3
- package/lib/index.css +5 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -1
- package/lib/layouts/LayoutManager.d.ts +33 -29
- package/lib/layouts/LayoutManager.js +2 -8
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +26 -57
- package/lib/layouts/blocks/BlocksDisplayComponent.js +122 -205
- package/lib/layouts/blocks/BlocksLayoutManager.d.ts +6 -22
- package/lib/layouts/blocks/BlocksLayoutManager.js +5 -14
- package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +5 -4
- package/lib/layouts/blocks/HorizontalBlockComponent.js +5 -5
- package/lib/mWaterLoader.d.ts +2 -0
- package/lib/mWaterLoader.js +2 -1
- package/lib/maps/AddLayerComponent.d.ts +6 -8
- package/lib/maps/AddLayerComponent.js +6 -6
- package/lib/maps/BingLayer.js +10 -20
- package/lib/maps/BufferLayer.js +2 -1
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/DirectMapDataSource.d.ts +5 -2
- package/lib/maps/DirectMapDataSource.js +2 -1
- package/lib/maps/EditPopupComponent.js +2 -1
- package/lib/maps/MapComponent.d.ts +1 -4
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +1 -4
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/ServerMapDataSource.d.ts +2 -3
- package/lib/maps/ServerMapDataSource.js +5 -5
- package/lib/maps/VectorMapViewComponent.js +2 -1
- package/lib/maps/mapSymbols.js +2 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/vectorMaps.js +61 -55
- package/lib/quickfilter/QuickfiltersComponent.d.ts +1 -4
- package/lib/quickfilter/QuickfiltersComponent.js +3 -3
- package/lib/richtext/DropdownPaletteItem.d.ts +32 -0
- package/lib/richtext/DropdownPaletteItem.js +82 -0
- package/lib/richtext/FontColorPaletteItem.d.ts +1 -5
- package/lib/richtext/FontColorPaletteItem.js +32 -27
- package/lib/richtext/ItemsHtmlConverter.js +12 -3
- package/lib/richtext/RichTextComponent.d.ts +26 -52
- package/lib/richtext/RichTextComponent.js +166 -128
- package/lib/valueFormatter.js +6 -1
- package/lib/wellknown.d.ts +5 -0
- package/lib/wellknown.js +288 -0
- package/lib/widgets/DropdownWidgetComponent.d.ts +8 -25
- package/lib/widgets/DropdownWidgetComponent.js +48 -25
- package/lib/widgets/IFrameWidgetComponent.d.ts +1 -2
- package/lib/widgets/ImageWidgetComponent.d.ts +2 -3
- package/lib/widgets/MapWidget.d.ts +2 -0
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/TOCWidget.js +2 -1
- package/lib/widgets/Widget.d.ts +2 -0
- package/lib/widgets/WidgetDataSource.d.ts +3 -1
- package/lib/widgets/charts/Chart.d.ts +0 -1
- package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartViewComponent.js +11 -3
- package/lib/widgets/charts/ChartWidget.d.ts +1 -62
- package/lib/widgets/charts/ChartWidget.js +4 -183
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +51 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +167 -0
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +4 -4
- package/lib/widgets/charts/layered/LayeredChart.d.ts +5 -10
- package/lib/widgets/charts/layered/LayeredChart.js +6 -7
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +4 -2
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +46 -32
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +4 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +3 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -2
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -1
- package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +89 -38
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +5 -112
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +122 -166
- package/lib/widgets/charts/pivot/PivotChart.d.ts +6 -0
- package/lib/widgets/charts/pivot/PivotChart.js +47 -17
- package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +11 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +1 -1
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +20 -36
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +0 -1
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +23 -2
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +215 -181
- package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +9 -28
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/table/TableChart.js +8 -4
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +3 -3
- package/lib/widgets/charts/table/TableChartViewComponent.js +11 -11
- package/lib/widgets/text/TextComponent.d.ts +5 -12
- package/lib/widgets/text/TextComponent.js +19 -39
- package/lib/widgets/text/TextWidget.d.ts +2 -1
- package/lib/widgets/text/TextWidget.js +5 -1
- package/lib/widgets/text/TextWidgetComponent.d.ts +15 -3
- package/lib/widgets/text/TextWidgetComponent.js +76 -19
- package/lib/widgets/text/TextWidgetDesign.d.ts +13 -1
- package/lib/widgets/text/TextWidgetDesign.js +6 -0
- package/package.json +4 -4
- package/src/ColorComponent.tsx +177 -0
- package/src/ColorSchemeFactory.ts +12 -6
- package/src/CustomColorsContext.tsx +8 -0
- package/src/FiltersDesignerComponent.ts +3 -4
- package/src/LocaleContextInjector.tsx +14 -13
- package/src/MWaterAddRelatedFormComponent.ts +3 -3
- package/src/MWaterAddRelatedIndicatorComponent.ts +6 -6
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -36
- package/src/MWaterContextComponent.tsx +8 -17
- package/src/MWaterLoaderComponent.ts +6 -3
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/AxisBuilder.ts +7 -5
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +71 -107
- package/src/dashboards/DashboardDesign.ts +3 -3
- package/src/dashboards/DashboardUpgrader.ts +41 -1
- package/src/dashboards/DashboardViewComponent.tsx +313 -0
- package/src/dashboards/FontStyleEditor.tsx +166 -0
- package/src/dashboards/LayoutOptionsComponent.tsx +379 -75
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/ServerDatagridDataSource.ts +106 -43
- package/src/demo.ts +3 -3
- package/src/index.css +5 -0
- package/src/index.ts +1 -1
- package/src/layouts/LayoutManager.ts +44 -42
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +498 -0
- package/src/layouts/blocks/BlocksLayoutManager.ts +6 -15
- package/src/layouts/blocks/HorizontalBlockComponent.ts +9 -8
- package/src/mWaterLoader.ts +4 -1
- package/src/maps/AddLayerComponent.ts +9 -9
- package/src/maps/BingLayer.ts +16 -26
- package/src/maps/BufferLayer.ts +2 -1
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +7 -7
- package/src/maps/VectorMapViewComponent.tsx +2 -1
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +79 -74
- package/src/quickfilter/QuickfiltersComponent.ts +3 -3
- package/src/richtext/DropdownPaletteItem.tsx +144 -0
- package/src/richtext/FontColorPaletteItem.tsx +160 -0
- package/src/richtext/ItemsHtmlConverter.ts +15 -5
- package/src/richtext/RichTextComponent.tsx +274 -232
- package/src/valueFormatter.ts +5 -1
- package/src/wellknown.ts +286 -0
- package/src/widgets/DropdownWidgetComponent.tsx +75 -0
- package/src/widgets/MapWidget.ts +5 -2
- package/src/widgets/TOCWidget.ts +2 -1
- package/src/widgets/Widget.ts +3 -0
- package/src/widgets/WidgetDataSource.ts +3 -1
- package/src/widgets/charts/Chart.ts +1 -1
- package/src/widgets/charts/ChartViewComponent.ts +16 -3
- package/src/widgets/charts/ChartWidget.ts +3 -275
- package/src/widgets/charts/ChartWidgetComponent.tsx +281 -0
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +4 -4
- package/src/widgets/charts/layered/LayeredChart.ts +4 -6
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +80 -63
- package/src/widgets/charts/layered/LayeredChartDesign.ts +7 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +43 -10
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +6 -6
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +140 -88
- package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +305 -221
- package/src/widgets/charts/pivot/PivotChart.ts +56 -18
- package/src/widgets/charts/pivot/PivotChartDesign.ts +12 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +4 -3
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +39 -76
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +0 -1
- package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +230 -189
- package/src/widgets/charts/pivot/PivotChartUtils.ts +4 -4
- package/src/widgets/charts/pivot/{PivotChartViewComponent.ts → PivotChartViewComponent.tsx} +86 -89
- package/src/widgets/charts/table/TableChart.ts +8 -4
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +4 -4
- package/src/widgets/charts/table/TableChartViewComponent.ts +13 -14
- package/src/widgets/text/TextComponent.tsx +47 -49
- package/src/widgets/text/TextWidget.ts +8 -3
- package/src/widgets/text/TextWidgetComponent.tsx +249 -0
- package/src/widgets/text/TextWidgetDesign.ts +22 -1
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -303
- package/src/dashboards/layoutOptions.ts +0 -40
- package/src/layout-styles.css +0 -263
- package/src/layouts/blocks/BlocksDisplayComponent.ts +0 -461
- package/src/layouts/grid/GridLayoutComponent.ts +0 -67
- package/src/layouts/grid/GridLayoutManager.ts +0 -185
- package/src/layouts/grid/LegoLayoutEngine.ts +0 -142
- package/src/layouts/grid/PaletteItemComponent.ts +0 -28
- package/src/layouts/grid/README.md +0 -14
- package/src/layouts/grid/WidgetContainerComponent.ts +0 -420
- package/src/richtext/FontColorPaletteItem.ts +0 -172
- package/src/richtext/FontSizePaletteItem.ts +0 -110
- package/src/widgets/DropdownWidgetComponent.ts +0 -78
- package/src/widgets/text/TextWidgetComponent.ts +0 -120
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mwater/visualization",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Visualization library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"async": "^1.2.1",
|
|
30
30
|
"async-latest": "^1.0.0",
|
|
31
31
|
"backbone": "~1.1.2",
|
|
32
|
-
"billboard.js": "^3.
|
|
32
|
+
"billboard.js": "^3.13.0",
|
|
33
33
|
"canonical-json": "0.0.4",
|
|
34
34
|
"classnames": "^2.3.1",
|
|
35
35
|
"color": "^3.2.1",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"maplibre-gl": "^3.3.1",
|
|
55
55
|
"markdown-it": "^12.0.4",
|
|
56
56
|
"moment": "^2.29.1",
|
|
57
|
+
"p-queue": "^8.0.1",
|
|
57
58
|
"pako": "^1.0.11",
|
|
58
59
|
"prop-types": "^15.7.2",
|
|
59
60
|
"querystring": "^0.2.0",
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
"react-linkify": "^0.2.2",
|
|
71
72
|
"react-motion": "^0.5.2",
|
|
72
73
|
"react-onclickout": "^2.0.4",
|
|
73
|
-
"react-select": "^5.
|
|
74
|
+
"react-select": "^5.8.0",
|
|
74
75
|
"save-svg-as-png": "^1.4.17",
|
|
75
76
|
"shallowequal": "^0.2.2",
|
|
76
77
|
"update-object": "^1.0.0",
|
|
@@ -94,7 +95,6 @@
|
|
|
94
95
|
"@types/react-color": "^2.17.6",
|
|
95
96
|
"@types/react-datepicker": "^1.8.0",
|
|
96
97
|
"@types/react-dropzone": "^5.1.0",
|
|
97
|
-
"@types/react-select": "^3.0.27",
|
|
98
98
|
"@types/uuid": "^3.4.10",
|
|
99
99
|
"build-library": "github:mWater/build-library",
|
|
100
100
|
"chai": "~2.0.0",
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import React, { CSSProperties, useContext } from "react"
|
|
2
|
+
import ReactDOM from "react-dom"
|
|
3
|
+
import ClickOutHandler from "react-onclickout"
|
|
4
|
+
import { ColorState, SketchPicker, SwatchesPicker } from "react-color"
|
|
5
|
+
import { CustomColorsContext } from "./CustomColorsContext"
|
|
6
|
+
|
|
7
|
+
export interface ColorComponentProps {
|
|
8
|
+
color: string | null | undefined
|
|
9
|
+
onChange: (value: string | null) => void
|
|
10
|
+
disableReset?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ColorComponentState {
|
|
14
|
+
open: boolean
|
|
15
|
+
advanced: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Simple color well with popup
|
|
19
|
+
export default class ColorComponent extends React.Component<ColorComponentProps, ColorComponentState> {
|
|
20
|
+
constructor(props: ColorComponentProps) {
|
|
21
|
+
super(props)
|
|
22
|
+
this.state = { open: false, advanced: false }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
handleClick = () => {
|
|
26
|
+
return this.setState({ open: !this.state.open, advanced: false })
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
handleColor = (color: ColorState) => {
|
|
30
|
+
return this.props.onChange(color.hex)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
handleReset = () => {
|
|
34
|
+
this.setState({ open: false })
|
|
35
|
+
return this.props.onChange(null)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
handleTransparent = () => {
|
|
39
|
+
this.setState({ open: false })
|
|
40
|
+
return this.props.onChange("transparent")
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
handleAdvanced = () => {
|
|
44
|
+
return this.setState({ advanced: !this.state.advanced })
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
renderPopup() {
|
|
48
|
+
if (!this.state.open || !this.colorWellRef) return null
|
|
49
|
+
|
|
50
|
+
const rect = this.colorWellRef.getBoundingClientRect()
|
|
51
|
+
|
|
52
|
+
const popupPosition: CSSProperties = {
|
|
53
|
+
position: "fixed",
|
|
54
|
+
top: `${rect.bottom + window.scrollY}px`,
|
|
55
|
+
left: `${rect.left + window.scrollX}px`,
|
|
56
|
+
zIndex: 1070,
|
|
57
|
+
backgroundColor: "white",
|
|
58
|
+
border: "solid 1px #DDD",
|
|
59
|
+
borderRadius: 3
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return ReactDOM.createPortal(
|
|
63
|
+
<ClickOutHandler onClickOut={() => this.setState({ open: false })}>
|
|
64
|
+
<div style={popupPosition}>
|
|
65
|
+
{!this.props.disableReset && (
|
|
66
|
+
<button type="button" className="btn btn-link btn-sm" onClick={this.handleReset}>
|
|
67
|
+
<i className="fa fa-undo" />
|
|
68
|
+
{" Reset Color"}
|
|
69
|
+
</button>
|
|
70
|
+
)}
|
|
71
|
+
<button type="button" className="btn btn-link btn-sm" onClick={this.handleAdvanced}>
|
|
72
|
+
{this.state.advanced ? "Basic" : "Advanced"}
|
|
73
|
+
</button>
|
|
74
|
+
|
|
75
|
+
<CustomColors
|
|
76
|
+
color={this.props.color}
|
|
77
|
+
onChange={this.props.onChange}
|
|
78
|
+
/>
|
|
79
|
+
{this.state.advanced ? (
|
|
80
|
+
<SketchPicker
|
|
81
|
+
color={this.props.color || undefined}
|
|
82
|
+
disableAlpha={true}
|
|
83
|
+
onChangeComplete={this.handleColor}
|
|
84
|
+
/>
|
|
85
|
+
) : (
|
|
86
|
+
<SwatchesPicker
|
|
87
|
+
color={this.props.color || undefined}
|
|
88
|
+
onChangeComplete={this.handleColor}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
</ClickOutHandler>,
|
|
93
|
+
document.body
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
colorWellRef: HTMLDivElement | null = null
|
|
98
|
+
|
|
99
|
+
render() {
|
|
100
|
+
const style: CSSProperties = {
|
|
101
|
+
height: 20,
|
|
102
|
+
width: 20,
|
|
103
|
+
border: "solid 2px #888",
|
|
104
|
+
borderRadius: 4,
|
|
105
|
+
backgroundColor: this.props.color || undefined,
|
|
106
|
+
cursor: "pointer",
|
|
107
|
+
display: "inline-block"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (!this.props.color) {
|
|
111
|
+
// http://lea.verou.me/css3patterns/#diagonal-stripes
|
|
112
|
+
style.backgroundColor = "#AAA"
|
|
113
|
+
style.backgroundImage =
|
|
114
|
+
"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,.7) 2px, rgba(255,255,255,.7) 4px)"
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div style={{ position: "relative", display: "inline-block" }}>
|
|
119
|
+
<div
|
|
120
|
+
style={style}
|
|
121
|
+
onClick={this.handleClick}
|
|
122
|
+
ref={ref => this.colorWellRef = ref}
|
|
123
|
+
/>
|
|
124
|
+
{this.renderPopup()}
|
|
125
|
+
</div>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Custom colors component for the color picker that allows the user to select from a set of custom colors
|
|
132
|
+
* that are defined in CSS variables.
|
|
133
|
+
* @param props
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
function CustomColors(props: {
|
|
137
|
+
color: string | null | undefined
|
|
138
|
+
onChange: (value: string | null) => void
|
|
139
|
+
}) {
|
|
140
|
+
const customColors = useContext(CustomColorsContext)
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(5, 42px)', gap: 8, margin: 5, marginLeft: 16 }}>
|
|
144
|
+
{customColors?.customColors.filter(color => color != null).map((color) => {
|
|
145
|
+
const isSelected = props.color === color
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<div
|
|
149
|
+
key={color}
|
|
150
|
+
title={color}
|
|
151
|
+
tabIndex={0}
|
|
152
|
+
onClick={() => props.onChange(color)}
|
|
153
|
+
style={{
|
|
154
|
+
background: color,
|
|
155
|
+
height: '24px',
|
|
156
|
+
width: '40px',
|
|
157
|
+
cursor: 'pointer',
|
|
158
|
+
position: 'relative',
|
|
159
|
+
outline: 'none',
|
|
160
|
+
marginBottom: '1px',
|
|
161
|
+
overflow: 'hidden',
|
|
162
|
+
boxShadow: isSelected ? `${color} 0 0 4px` : 'none'
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
{isSelected && (
|
|
166
|
+
<div style={{ color: '#FFFFFF', marginLeft: '8px' }}>
|
|
167
|
+
<svg viewBox="0 0 24 24" style={{ fill: 'currentcolor', width: '24px', height: '24px' }}>
|
|
168
|
+
<path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path>
|
|
169
|
+
</svg>
|
|
170
|
+
</div>
|
|
171
|
+
)}
|
|
172
|
+
</div>
|
|
173
|
+
)
|
|
174
|
+
})}
|
|
175
|
+
</div>
|
|
176
|
+
)
|
|
177
|
+
}
|
|
@@ -27,12 +27,18 @@ function generateSequentialSet(set: any, number: any, reversed: any) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export default class ColorSchemeFactory {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Creates a color scheme
|
|
32
|
+
* @param options
|
|
33
|
+
* @param options.type - type of the color scheme
|
|
34
|
+
* @param options.number - number of colors to be generated
|
|
35
|
+
* @param options.reversed - true to reversed
|
|
36
|
+
*/
|
|
37
|
+
static createColorScheme(options: {
|
|
38
|
+
type: string
|
|
39
|
+
number: number
|
|
40
|
+
reversed: boolean
|
|
41
|
+
}): string[] {
|
|
36
42
|
switch (options.type) {
|
|
37
43
|
case "schemeAccent":
|
|
38
44
|
return generateCategoricalSet(brewer.schemeAccent, options.number, options.reversed)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _ from "lodash"
|
|
2
|
-
import PropTypes from "prop-types"
|
|
3
2
|
import React from "react"
|
|
4
3
|
const R = React.createElement
|
|
5
|
-
import { FilterExprComponent } from "@mwater/expressions-ui"
|
|
4
|
+
import { FilterExprComponent, LocaleContext } from "@mwater/expressions-ui"
|
|
6
5
|
import { DataSource, Expr, ExprCleaner, Schema } from "@mwater/expressions"
|
|
7
6
|
import { ExprUtils } from "@mwater/expressions"
|
|
8
7
|
|
|
@@ -20,7 +19,7 @@ export interface FiltersDesignerComponentProps {
|
|
|
20
19
|
// Designer for filters of multiple tables. Used for maps and dashboards
|
|
21
20
|
// Filters are in format mwater-expression filter expression indexed by table. e.g. { sometable: logical expression, etc. }
|
|
22
21
|
export default class FiltersDesignerComponent extends React.Component<FiltersDesignerComponentProps> {
|
|
23
|
-
static
|
|
22
|
+
static contextType = LocaleContext
|
|
24
23
|
|
|
25
24
|
handleFilterChange = (table: any, expr: any) => {
|
|
26
25
|
// Clean filter
|
|
@@ -33,7 +32,7 @@ export default class FiltersDesignerComponent extends React.Component<FiltersDes
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
renderFilterableTable = (table: any) => {
|
|
36
|
-
const name = ExprUtils.localizeString(this.props.schema.getTable(table)!.name, this.context
|
|
35
|
+
const name = ExprUtils.localizeString(this.props.schema.getTable(table)!.name, this.context)
|
|
37
36
|
|
|
38
37
|
return R(
|
|
39
38
|
"div",
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import
|
|
2
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
getChildContext() {
|
|
11
|
-
return { locale: this.props.locale }
|
|
12
|
-
}
|
|
4
|
+
export interface LocaleContextProps {
|
|
5
|
+
locale: string
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
}
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
/** Adds the locale to the context */
|
|
10
|
+
const LocaleContextInjector: React.FC<LocaleContextProps> = ({ locale, children }) => {
|
|
11
|
+
return (
|
|
12
|
+
<LocaleContext.Provider value={locale}>
|
|
13
|
+
{children}
|
|
14
|
+
</LocaleContext.Provider>
|
|
15
|
+
)
|
|
17
16
|
}
|
|
17
|
+
|
|
18
|
+
export default LocaleContextInjector
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import $ from "jquery"
|
|
2
|
-
import PropTypes from "prop-types"
|
|
3
2
|
import _ from "lodash"
|
|
4
3
|
import React from "react"
|
|
5
4
|
const R = React.createElement
|
|
@@ -11,6 +10,7 @@ import { ExprUtils, Schema } from "@mwater/expressions"
|
|
|
11
10
|
import * as ui from "./UIComponents"
|
|
12
11
|
import * as formUtils from "@mwater/forms/lib/formUtils" // TODO requireing this directly because of bizarre backbone issue
|
|
13
12
|
import { Form, FormDesign } from "@mwater/forms"
|
|
13
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
14
14
|
|
|
15
15
|
export interface MWaterAddRelatedFormComponentProps {
|
|
16
16
|
/** Entities table id */
|
|
@@ -115,7 +115,7 @@ class AddRelatedFormModalComponent extends React.Component<
|
|
|
115
115
|
AddRelatedFormModalComponentProps,
|
|
116
116
|
AddRelatedFormModalComponentState
|
|
117
117
|
> {
|
|
118
|
-
static
|
|
118
|
+
static contextType = LocaleContext
|
|
119
119
|
|
|
120
120
|
constructor(props: any) {
|
|
121
121
|
super(props)
|
|
@@ -149,7 +149,7 @@ class AddRelatedFormModalComponent extends React.Component<
|
|
|
149
149
|
|
|
150
150
|
// Get _id, name, and description
|
|
151
151
|
const items = _.map(forms, (form) => ({
|
|
152
|
-
name: ExprUtils.localizeString(form.design.name, this.context
|
|
152
|
+
name: ExprUtils.localizeString(form.design.name, this.context),
|
|
153
153
|
desc: `Modified ${moment(form.modified!.on, moment.ISO_8601).format("ll")}`,
|
|
154
154
|
onClick: this.props.onSelect.bind(null, "responses:" + form._id)
|
|
155
155
|
}))
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import $ from "jquery"
|
|
2
|
-
import PropTypes from "prop-types"
|
|
3
2
|
import _ from "lodash"
|
|
4
3
|
import React from "react"
|
|
5
4
|
const R = React.createElement
|
|
6
5
|
|
|
7
6
|
import querystring from "querystring"
|
|
8
7
|
import { ExprUtils, Schema } from "@mwater/expressions"
|
|
8
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
9
9
|
|
|
10
10
|
export interface MWaterAddRelatedIndicatorComponentProps {
|
|
11
11
|
table: string
|
|
@@ -30,7 +30,7 @@ export default class MWaterAddRelatedIndicatorComponent extends React.Component<
|
|
|
30
30
|
MWaterAddRelatedIndicatorComponentProps,
|
|
31
31
|
MWaterAddRelatedIndicatorComponentState
|
|
32
32
|
> {
|
|
33
|
-
static
|
|
33
|
+
static contextType = LocaleContext
|
|
34
34
|
|
|
35
35
|
constructor(props: any) {
|
|
36
36
|
super(props)
|
|
@@ -69,7 +69,7 @@ export default class MWaterAddRelatedIndicatorComponent extends React.Component<
|
|
|
69
69
|
indicators,
|
|
70
70
|
[
|
|
71
71
|
(indicator) => (indicator.design.recommended ? 0 : 1),
|
|
72
|
-
(indicator) => ExprUtils.localizeString(indicator.design.name, this.context
|
|
72
|
+
(indicator) => ExprUtils.localizeString(indicator.design.name, this.context)
|
|
73
73
|
],
|
|
74
74
|
["asc", "asc"]
|
|
75
75
|
)
|
|
@@ -112,7 +112,7 @@ export default class MWaterAddRelatedIndicatorComponent extends React.Component<
|
|
|
112
112
|
// Filter by search
|
|
113
113
|
if (this.props.filter) {
|
|
114
114
|
indicators = _.filter(indicators, (indicator) =>
|
|
115
|
-
filterMatches(this.props.filter, ExprUtils.localizeString(indicator.design.name, this.context
|
|
115
|
+
filterMatches(this.props.filter, ExprUtils.localizeString(indicator.design.name, this.context))
|
|
116
116
|
)
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -134,8 +134,8 @@ export default class MWaterAddRelatedIndicatorComponent extends React.Component<
|
|
|
134
134
|
"div",
|
|
135
135
|
{ style: { paddingLeft: 10 } },
|
|
136
136
|
_.map(indicators, (indicator) => {
|
|
137
|
-
const name = ExprUtils.localizeString(indicator.design.name, this.context
|
|
138
|
-
const desc = ExprUtils.localizeString(indicator.design.desc, this.context
|
|
137
|
+
const name = ExprUtils.localizeString(indicator.design.name, this.context)
|
|
138
|
+
const desc = ExprUtils.localizeString(indicator.design.desc, this.context)
|
|
139
139
|
|
|
140
140
|
// If added, put special message
|
|
141
141
|
if (this.props.schema.getTable(`indicator_values:${indicator._id}`)) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from "lodash"
|
|
2
2
|
import $ from "jquery"
|
|
3
|
-
import PropTypes from "prop-types"
|
|
4
3
|
import React from "react"
|
|
5
4
|
const R = React.createElement
|
|
6
5
|
import querystring from "querystring"
|
|
@@ -13,6 +12,7 @@ import { MWaterCustomTablesetListComponent } from "./MWaterCustomTablesetListCom
|
|
|
13
12
|
import { MWaterMetricsTableListComponent } from "./MWaterMetricsTableListComponent"
|
|
14
13
|
import { Form } from "@mwater/forms"
|
|
15
14
|
import { MWaterAssetSystemsListComponent } from "./MWaterAssetSystemsListComponent"
|
|
15
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
16
16
|
|
|
17
17
|
const sitesOrder: { [table: string]: number } = {
|
|
18
18
|
"entities.water_point": 1,
|
|
@@ -52,7 +52,7 @@ interface MWaterCompleteTableSelectComponentProps {
|
|
|
52
52
|
export default class MWaterCompleteTableSelectComponent extends React.Component<MWaterCompleteTableSelectComponentProps, {
|
|
53
53
|
showLegacyAssets: boolean
|
|
54
54
|
}> {
|
|
55
|
-
static
|
|
55
|
+
static contextType = LocaleContext
|
|
56
56
|
|
|
57
57
|
constructor(props: MWaterCompleteTableSelectComponentProps) {
|
|
58
58
|
super(props)
|
|
@@ -104,8 +104,8 @@ export default class MWaterCompleteTableSelectComponent extends React.Component<
|
|
|
104
104
|
_.map(types, (tableId) => {
|
|
105
105
|
table = this.props.schema.getTable(tableId)!
|
|
106
106
|
return {
|
|
107
|
-
name: ExprUtils.localizeString(table.name, this.context
|
|
108
|
-
desc: ExprUtils.localizeString(table.desc, this.context
|
|
107
|
+
name: ExprUtils.localizeString(table.name, this.context),
|
|
108
|
+
desc: ExprUtils.localizeString(table.desc, this.context),
|
|
109
109
|
onClick: this.props.onChange.bind(null, table.id)
|
|
110
110
|
}
|
|
111
111
|
})
|
|
@@ -159,8 +159,8 @@ export default class MWaterCompleteTableSelectComponent extends React.Component<
|
|
|
159
159
|
return R(uiComponents.OptionListComponent, {
|
|
160
160
|
items: _.map(sweetSenseTables, (table) => {
|
|
161
161
|
return {
|
|
162
|
-
name: ExprUtils.localizeString(table.name, this.context
|
|
163
|
-
desc: ExprUtils.localizeString(table.desc, this.context
|
|
162
|
+
name: ExprUtils.localizeString(table.name, this.context),
|
|
163
|
+
desc: ExprUtils.localizeString(table.desc, this.context),
|
|
164
164
|
onClick: this.props.onChange.bind(null, table.id)
|
|
165
165
|
}
|
|
166
166
|
})
|
|
@@ -177,7 +177,7 @@ export default class MWaterCompleteTableSelectComponent extends React.Component<
|
|
|
177
177
|
extraTables: this.props.extraTables,
|
|
178
178
|
onExtraTableAdd: this.handleExtraTableAdd,
|
|
179
179
|
onExtraTableRemove: this.handleExtraTableRemove,
|
|
180
|
-
locale: this.context
|
|
180
|
+
locale: this.context
|
|
181
181
|
})
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -191,7 +191,7 @@ export default class MWaterCompleteTableSelectComponent extends React.Component<
|
|
|
191
191
|
extraTables: this.props.extraTables,
|
|
192
192
|
onExtraTableAdd: this.handleExtraTableAdd,
|
|
193
193
|
onExtraTableRemove: this.handleExtraTableRemove,
|
|
194
|
-
locale: this.context
|
|
194
|
+
locale: this.context
|
|
195
195
|
})
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -208,8 +208,8 @@ export default class MWaterCompleteTableSelectComponent extends React.Component<
|
|
|
208
208
|
continue
|
|
209
209
|
}
|
|
210
210
|
items.push({
|
|
211
|
-
name: ExprUtils.localizeString(table.name, this.context
|
|
212
|
-
desc: ExprUtils.localizeString(table.desc, this.context
|
|
211
|
+
name: ExprUtils.localizeString(table.name, this.context),
|
|
212
|
+
desc: ExprUtils.localizeString(table.desc, this.context),
|
|
213
213
|
onClick: this.props.onChange.bind(null, table.id)
|
|
214
214
|
})
|
|
215
215
|
}
|
|
@@ -236,7 +236,7 @@ export default class MWaterCompleteTableSelectComponent extends React.Component<
|
|
|
236
236
|
extraTables: this.props.extraTables,
|
|
237
237
|
onExtraTableAdd: this.handleExtraTableAdd,
|
|
238
238
|
onExtraTableRemove: this.handleExtraTableRemove,
|
|
239
|
-
locale: this.context
|
|
239
|
+
locale: this.context
|
|
240
240
|
})
|
|
241
241
|
}
|
|
242
242
|
|
|
@@ -294,8 +294,8 @@ export default class MWaterCompleteTableSelectComponent extends React.Component<
|
|
|
294
294
|
return R(uiComponents.OptionListComponent, {
|
|
295
295
|
items: _.map(otherTables, (table) => {
|
|
296
296
|
return {
|
|
297
|
-
name: ExprUtils.localizeString(table.name, this.context
|
|
298
|
-
desc: ExprUtils.localizeString(table.desc, this.context
|
|
297
|
+
name: ExprUtils.localizeString(table.name, this.context),
|
|
298
|
+
desc: ExprUtils.localizeString(table.desc, this.context),
|
|
299
299
|
onClick: this.props.onChange.bind(null, table.id)
|
|
300
300
|
}
|
|
301
301
|
})
|
|
@@ -383,7 +383,7 @@ interface FormsListComponentState {
|
|
|
383
383
|
|
|
384
384
|
// Searchable list of forms
|
|
385
385
|
class FormsListComponent extends React.Component<FormsListComponentProps, FormsListComponentState> {
|
|
386
|
-
static
|
|
386
|
+
static contextType = LocaleContext
|
|
387
387
|
|
|
388
388
|
constructor(props: any) {
|
|
389
389
|
super(props)
|
|
@@ -424,7 +424,7 @@ class FormsListComponent extends React.Component<FormsListComponentProps, FormsL
|
|
|
424
424
|
// TODO use name instead of design.name
|
|
425
425
|
this.setState({
|
|
426
426
|
forms: _.map(forms, (form) => {
|
|
427
|
-
let desc = ExprUtils.localizeString(form.design.description,
|
|
427
|
+
let desc = ExprUtils.localizeString(form.design.description, null) || ""
|
|
428
428
|
if (desc) {
|
|
429
429
|
desc += " - "
|
|
430
430
|
}
|
|
@@ -432,7 +432,7 @@ class FormsListComponent extends React.Component<FormsListComponentProps, FormsL
|
|
|
432
432
|
|
|
433
433
|
return {
|
|
434
434
|
id: form._id,
|
|
435
|
-
name: ExprUtils.localizeString(form.design.name,
|
|
435
|
+
name: ExprUtils.localizeString(form.design.name, null),
|
|
436
436
|
desc
|
|
437
437
|
}
|
|
438
438
|
})
|
|
@@ -447,7 +447,7 @@ class FormsListComponent extends React.Component<FormsListComponentProps, FormsL
|
|
|
447
447
|
confirm(
|
|
448
448
|
`Remove ${ExprUtils.localizeString(
|
|
449
449
|
table.name,
|
|
450
|
-
this.context
|
|
450
|
+
this.context
|
|
451
451
|
)}? Any widgets that depend on it will no longer work properly.`
|
|
452
452
|
)
|
|
453
453
|
) {
|
|
@@ -496,8 +496,8 @@ class FormsListComponent extends React.Component<FormsListComponentProps, FormsL
|
|
|
496
496
|
? R(uiComponents.OptionListComponent, {
|
|
497
497
|
items: _.map(tables, (table) => {
|
|
498
498
|
return {
|
|
499
|
-
name: ExprUtils.localizeString(table.name, this.context
|
|
500
|
-
desc: ExprUtils.localizeString(table.desc, this.context
|
|
499
|
+
name: ExprUtils.localizeString(table.name, this.context),
|
|
500
|
+
desc: ExprUtils.localizeString(table.desc, this.context),
|
|
501
501
|
onClick: this.props.onChange.bind(null, table.id),
|
|
502
502
|
onRemove: this.handleTableRemove.bind(null, table)
|
|
503
503
|
}
|
|
@@ -562,7 +562,7 @@ interface IndicatorsListComponentState {
|
|
|
562
562
|
|
|
563
563
|
// Searchable list of indicators
|
|
564
564
|
class IndicatorsListComponent extends React.Component<IndicatorsListComponentProps, IndicatorsListComponentState> {
|
|
565
|
-
static
|
|
565
|
+
static contextType = LocaleContext
|
|
566
566
|
addIndicatorConfirmPopup: AddIndicatorConfirmPopupComponent | null
|
|
567
567
|
|
|
568
568
|
constructor(props: any) {
|
|
@@ -590,7 +590,7 @@ class IndicatorsListComponent extends React.Component<IndicatorsListComponentPro
|
|
|
590
590
|
[
|
|
591
591
|
(indicator: any) => ((this.props.extraTables || []).includes("indicator_values:" + indicator._id) ? 0 : 1),
|
|
592
592
|
(indicator: any) => (indicator.design.recommended ? 0 : 1),
|
|
593
|
-
(indicator: any) => ExprUtils.localizeString(indicator.design.name, this.context
|
|
593
|
+
(indicator: any) => ExprUtils.localizeString(indicator.design.name, this.context)
|
|
594
594
|
],
|
|
595
595
|
["asc", "asc", "asc"]
|
|
596
596
|
)
|
|
@@ -598,8 +598,8 @@ class IndicatorsListComponent extends React.Component<IndicatorsListComponentPro
|
|
|
598
598
|
return this.setState({
|
|
599
599
|
indicators: _.map(indicators, (indicator) => ({
|
|
600
600
|
id: indicator._id,
|
|
601
|
-
name: ExprUtils.localizeString(indicator.design.name, this.context
|
|
602
|
-
desc: ExprUtils.localizeString(indicator.design.desc, this.context
|
|
601
|
+
name: ExprUtils.localizeString(indicator.design.name, this.context),
|
|
602
|
+
desc: ExprUtils.localizeString(indicator.design.desc, this.context)
|
|
603
603
|
}))
|
|
604
604
|
})
|
|
605
605
|
}).fail((xhr: any) => {
|
|
@@ -612,7 +612,7 @@ class IndicatorsListComponent extends React.Component<IndicatorsListComponentPro
|
|
|
612
612
|
confirm(
|
|
613
613
|
`Remove ${ExprUtils.localizeString(
|
|
614
614
|
table.name,
|
|
615
|
-
this.context
|
|
615
|
+
this.context
|
|
616
616
|
)}? Any widgets that depend on it will no longer work properly.`
|
|
617
617
|
)
|
|
618
618
|
) {
|
|
@@ -679,8 +679,8 @@ class IndicatorsListComponent extends React.Component<IndicatorsListComponentPro
|
|
|
679
679
|
? R(uiComponents.OptionListComponent, {
|
|
680
680
|
items: _.map(tables, (table) => {
|
|
681
681
|
return {
|
|
682
|
-
name: ExprUtils.localizeString(table.name, this.context
|
|
683
|
-
desc: ExprUtils.localizeString(table.desc, this.context
|
|
682
|
+
name: ExprUtils.localizeString(table.name, this.context),
|
|
683
|
+
desc: ExprUtils.localizeString(table.desc, this.context),
|
|
684
684
|
onClick: this.handleSelect.bind(null, table.id),
|
|
685
685
|
onRemove: this.handleTableRemove.bind(null, table)
|
|
686
686
|
}
|
|
@@ -738,7 +738,7 @@ class AddIndicatorConfirmPopupComponent extends React.Component<
|
|
|
738
738
|
AddIndicatorConfirmPopupComponentProps,
|
|
739
739
|
AddIndicatorConfirmPopupComponentState
|
|
740
740
|
> {
|
|
741
|
-
static
|
|
741
|
+
static contextType = LocaleContext
|
|
742
742
|
|
|
743
743
|
constructor(props: any) {
|
|
744
744
|
super(props)
|
|
@@ -781,8 +781,8 @@ are certain that you want to use the raw indicator table`
|
|
|
781
781
|
|
|
782
782
|
R(uiComponents.OptionListComponent, {
|
|
783
783
|
items: _.map(entityColumns, (entityColumn) => ({
|
|
784
|
-
name: ExprUtils.localizeString(entityColumn.name, this.context
|
|
785
|
-
desc: ExprUtils.localizeString(entityColumn.desc, this.context
|
|
784
|
+
name: ExprUtils.localizeString(entityColumn.name, this.context),
|
|
785
|
+
desc: ExprUtils.localizeString(entityColumn.desc, this.context),
|
|
786
786
|
onClick: () => {
|
|
787
787
|
// Select table
|
|
788
788
|
this.props.onChange(entityColumn.join!.toTable)
|
|
@@ -845,7 +845,7 @@ interface IssuesListComponentState {
|
|
|
845
845
|
|
|
846
846
|
// Searchable list of issue types
|
|
847
847
|
class IssuesListComponent extends React.Component<IssuesListComponentProps, IssuesListComponentState> {
|
|
848
|
-
static
|
|
848
|
+
static contextType = LocaleContext
|
|
849
849
|
|
|
850
850
|
constructor(props: any) {
|
|
851
851
|
super(props)
|
|
@@ -869,7 +869,7 @@ class IssuesListComponent extends React.Component<IssuesListComponentProps, Issu
|
|
|
869
869
|
[
|
|
870
870
|
(issueType) => ((this.props.extraTables || []).includes("issues:" + issueType._id) ? 0 : 1),
|
|
871
871
|
(issueType) => (issueType.created.by === this.props.user ? 0 : 1),
|
|
872
|
-
(issueType) => ExprUtils.localizeString(issueType.name, this.context
|
|
872
|
+
(issueType) => ExprUtils.localizeString(issueType.name, this.context)
|
|
873
873
|
],
|
|
874
874
|
["asc", "asc", "asc"]
|
|
875
875
|
)
|
|
@@ -877,8 +877,8 @@ class IssuesListComponent extends React.Component<IssuesListComponentProps, Issu
|
|
|
877
877
|
return this.setState({
|
|
878
878
|
issueTypes: _.map(issueTypes, (issueType) => ({
|
|
879
879
|
id: issueType._id,
|
|
880
|
-
name: ExprUtils.localizeString(issueType.name, this.context
|
|
881
|
-
desc: ExprUtils.localizeString(issueType.desc, this.context
|
|
880
|
+
name: ExprUtils.localizeString(issueType.name, this.context),
|
|
881
|
+
desc: ExprUtils.localizeString(issueType.desc, this.context)
|
|
882
882
|
}))
|
|
883
883
|
})
|
|
884
884
|
}).fail((xhr: any) => {
|
|
@@ -891,7 +891,7 @@ class IssuesListComponent extends React.Component<IssuesListComponentProps, Issu
|
|
|
891
891
|
confirm(
|
|
892
892
|
`Remove ${ExprUtils.localizeString(
|
|
893
893
|
table.name,
|
|
894
|
-
this.context
|
|
894
|
+
this.context
|
|
895
895
|
)}? Any widgets that depend on it will no longer work properly.`
|
|
896
896
|
)
|
|
897
897
|
) {
|
|
@@ -940,8 +940,8 @@ class IssuesListComponent extends React.Component<IssuesListComponentProps, Issu
|
|
|
940
940
|
? R(uiComponents.OptionListComponent, {
|
|
941
941
|
items: _.map(tables, (table) => {
|
|
942
942
|
return {
|
|
943
|
-
name: ExprUtils.localizeString(table.name, this.context
|
|
944
|
-
desc: ExprUtils.localizeString(table.desc, this.context
|
|
943
|
+
name: ExprUtils.localizeString(table.name, this.context),
|
|
944
|
+
desc: ExprUtils.localizeString(table.desc, this.context),
|
|
945
945
|
onClick: this.props.onChange.bind(null, table.id),
|
|
946
946
|
onRemove: this.handleTableRemove.bind(null, table)
|
|
947
947
|
}
|