@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
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
1
|
import _ from "lodash"
|
|
3
2
|
import React from "react"
|
|
4
|
-
import ReactDOM from "react-dom"
|
|
5
|
-
const R = React.createElement
|
|
6
3
|
|
|
7
4
|
import ActionCancelModalComponent from "@mwater/react-library/lib/ActionCancelModalComponent"
|
|
8
5
|
import { DataSource, ExprUtils, Schema } from "@mwater/expressions"
|
|
@@ -13,7 +10,9 @@ import PivotChartLayoutBuilder from "./PivotChartLayoutBuilder"
|
|
|
13
10
|
import SegmentDesignerComponent from "./SegmentDesignerComponent"
|
|
14
11
|
import IntersectionDesignerComponent from "./IntersectionDesignerComponent"
|
|
15
12
|
import { JsonQLFilter, WidgetScope } from "../../.."
|
|
16
|
-
import { PivotChartDesign } from "./PivotChartDesign"
|
|
13
|
+
import { PivotChartDesign, PivotChartIntersection } from "./PivotChartDesign"
|
|
14
|
+
|
|
15
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
17
16
|
|
|
18
17
|
export interface PivotChartViewComponentProps {
|
|
19
18
|
schema: Schema
|
|
@@ -38,16 +37,15 @@ export interface PivotChartViewComponentProps {
|
|
|
38
37
|
|
|
39
38
|
interface PivotChartViewComponentState {
|
|
40
39
|
editSegment: any
|
|
41
|
-
editIntersectionId:
|
|
42
|
-
editIntersection:
|
|
40
|
+
editIntersectionId: string | null
|
|
41
|
+
editIntersection: PivotChartIntersection | null
|
|
43
42
|
}
|
|
44
|
-
|
|
45
43
|
// Displays a pivot chart
|
|
46
44
|
export default class PivotChartViewComponent extends React.Component<
|
|
47
45
|
PivotChartViewComponentProps,
|
|
48
46
|
PivotChartViewComponentState
|
|
49
47
|
> {
|
|
50
|
-
static
|
|
48
|
+
static contextType = LocaleContext
|
|
51
49
|
|
|
52
50
|
constructor(props: any) {
|
|
53
51
|
super(props)
|
|
@@ -106,7 +104,7 @@ export default class PivotChartViewComponent extends React.Component<
|
|
|
106
104
|
|
|
107
105
|
handleSaveEditIntersection = () => {
|
|
108
106
|
const intersections = _.clone(this.props.design.intersections)
|
|
109
|
-
intersections[this.state.editIntersectionId] = this.state.editIntersection
|
|
107
|
+
intersections[this.state.editIntersectionId!] = this.state.editIntersection!
|
|
110
108
|
|
|
111
109
|
const design = { ...this.props.design, intersections }
|
|
112
110
|
this.props.onDesignChange!(design)
|
|
@@ -160,85 +158,87 @@ export default class PivotChartViewComponent extends React.Component<
|
|
|
160
158
|
}
|
|
161
159
|
|
|
162
160
|
renderHeader() {
|
|
163
|
-
return
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
161
|
+
return (
|
|
162
|
+
<div style={{ paddingLeft: 10, paddingRight: 10 }}>
|
|
163
|
+
<TextComponent
|
|
164
|
+
design={this.props.design.header}
|
|
165
|
+
onDesignChange={this.props.onDesignChange ? this.handleHeaderChange : undefined}
|
|
166
|
+
schema={this.props.schema}
|
|
167
|
+
dataSource={this.props.dataSource}
|
|
168
|
+
exprValues={this.props.data.header || {}}
|
|
169
|
+
width={this.props.width}
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
174
172
|
)
|
|
175
173
|
}
|
|
176
174
|
|
|
177
175
|
renderFooter() {
|
|
178
|
-
return
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
176
|
+
return (
|
|
177
|
+
<div style={{ paddingLeft: 10, paddingRight: 10 }}>
|
|
178
|
+
<TextComponent
|
|
179
|
+
design={this.props.design.footer}
|
|
180
|
+
onDesignChange={this.props.onDesignChange ? this.handleFooterChange : undefined}
|
|
181
|
+
schema={this.props.schema}
|
|
182
|
+
dataSource={this.props.dataSource}
|
|
183
|
+
exprValues={this.props.data.footer || {}}
|
|
184
|
+
width={this.props.width}
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
189
187
|
)
|
|
190
188
|
}
|
|
191
189
|
|
|
192
190
|
renderEditSegmentModal() {
|
|
193
191
|
if (!this.state.editSegment) {
|
|
194
|
-
return
|
|
192
|
+
return null
|
|
195
193
|
}
|
|
196
194
|
|
|
197
195
|
const segmentType = PivotChartUtils.findSegment(this.props.design.rows, this.state.editSegment.id)
|
|
198
196
|
? "row"
|
|
199
197
|
: "column"
|
|
200
198
|
|
|
201
|
-
return
|
|
202
|
-
ActionCancelModalComponent
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
199
|
+
return (
|
|
200
|
+
<ActionCancelModalComponent
|
|
201
|
+
title={`Edit ${segmentType}`}
|
|
202
|
+
onAction={this.handleSaveEditSegment}
|
|
203
|
+
onCancel={this.handleCancelEditSegment}
|
|
204
|
+
size="large"
|
|
205
|
+
>
|
|
206
|
+
<SegmentDesignerComponent
|
|
207
|
+
segment={this.state.editSegment}
|
|
208
|
+
table={this.props.design.table}
|
|
209
|
+
schema={this.props.schema}
|
|
210
|
+
dataSource={this.props.dataSource}
|
|
211
|
+
segmentType={segmentType}
|
|
212
|
+
onChange={(segment: any) => this.setState({ editSegment: segment })}
|
|
213
|
+
filters={this.props.filters}
|
|
214
|
+
/>
|
|
215
|
+
</ActionCancelModalComponent>
|
|
218
216
|
)
|
|
219
217
|
}
|
|
220
218
|
|
|
221
219
|
renderEditIntersectionModal() {
|
|
222
220
|
if (!this.state.editIntersectionId) {
|
|
223
|
-
return
|
|
221
|
+
return null
|
|
224
222
|
}
|
|
225
223
|
|
|
226
|
-
return
|
|
227
|
-
ActionCancelModalComponent
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
224
|
+
return (
|
|
225
|
+
<ActionCancelModalComponent
|
|
226
|
+
title="Edit Value"
|
|
227
|
+
onAction={this.handleSaveEditIntersection}
|
|
228
|
+
onCancel={this.handleCancelEditIntersection}
|
|
229
|
+
size="large"
|
|
230
|
+
>
|
|
231
|
+
<IntersectionDesignerComponent
|
|
232
|
+
design={this.props.design}
|
|
233
|
+
intersectionId={this.state.editIntersectionId}
|
|
234
|
+
intersection={this.state.editIntersection!}
|
|
235
|
+
table={this.props.design.table}
|
|
236
|
+
schema={this.props.schema}
|
|
237
|
+
dataSource={this.props.dataSource}
|
|
238
|
+
onChange={(intersection) => this.setState({ editIntersection: intersection })}
|
|
239
|
+
filters={this.props.filters}
|
|
240
|
+
/>
|
|
241
|
+
</ActionCancelModalComponent>
|
|
242
242
|
)
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -246,31 +246,28 @@ export default class PivotChartViewComponent extends React.Component<
|
|
|
246
246
|
const layout = new PivotChartLayoutBuilder({ schema: this.props.schema }).buildLayout(
|
|
247
247
|
this.props.design,
|
|
248
248
|
this.props.data,
|
|
249
|
-
this.context
|
|
249
|
+
this.context
|
|
250
250
|
)
|
|
251
251
|
|
|
252
|
-
return
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
),
|
|
272
|
-
|
|
273
|
-
this.renderFooter()
|
|
252
|
+
return (
|
|
253
|
+
<div style={{ width: this.props.width, height: this.props.height }}>
|
|
254
|
+
{this.renderHeader()}
|
|
255
|
+
{this.renderEditSegmentModal()}
|
|
256
|
+
{this.renderEditIntersectionModal()}
|
|
257
|
+
<div key="layout" style={{ margin: 5, marginTop: 12, overflowX: "auto", padding: 7 }}>
|
|
258
|
+
<PivotChartLayoutComponent
|
|
259
|
+
layout={layout}
|
|
260
|
+
editable={this.props.onDesignChange != null}
|
|
261
|
+
onEditSection={this.props.onDesignChange != null ? this.handleEditSection : undefined}
|
|
262
|
+
onRemoveSegment={this.props.onDesignChange != null ? this.handleRemoveSegment : undefined}
|
|
263
|
+
onInsertBeforeSegment={this.props.onDesignChange != null ? this.handleInsertBeforeSegment : undefined}
|
|
264
|
+
onInsertAfterSegment={this.props.onDesignChange != null ? this.handleInsertAfterSegment : undefined}
|
|
265
|
+
onAddChildSegment={this.props.onDesignChange != null ? this.handleAddChildSegment : undefined}
|
|
266
|
+
onSummarizeSegment={this.props.onDesignChange != null ? this.handleSummarizeSegment : undefined}
|
|
267
|
+
/>
|
|
268
|
+
</div>
|
|
269
|
+
{this.renderFooter()}
|
|
270
|
+
</div>
|
|
274
271
|
)
|
|
275
272
|
}
|
|
276
273
|
}
|
|
@@ -229,10 +229,14 @@ export default class TableChart extends Chart {
|
|
|
229
229
|
// Convert to 4326 (lat/long). Force ::geometry for null
|
|
230
230
|
compiledExpr = {
|
|
231
231
|
type: "op",
|
|
232
|
-
op: "
|
|
233
|
-
exprs: [
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
op: "::jsonb",
|
|
233
|
+
exprs: [{
|
|
234
|
+
type: "op",
|
|
235
|
+
op: "ST_AsGeoJSON",
|
|
236
|
+
exprs: [
|
|
237
|
+
{ type: "op", op: "ST_Transform", exprs: [{ type: "op", op: "::geometry", exprs: [compiledExpr] }, 4326] }
|
|
238
|
+
]
|
|
239
|
+
}]
|
|
236
240
|
}
|
|
237
241
|
}
|
|
238
242
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
1
|
import _ from "lodash"
|
|
3
2
|
import React from "react"
|
|
4
3
|
const R = React.createElement
|
|
5
4
|
import uuid from "uuid"
|
|
6
5
|
import { DataSource, ExprUtils, Schema } from "@mwater/expressions"
|
|
7
6
|
import AxisBuilder from "../../../axes/AxisBuilder"
|
|
8
|
-
import { LinkComponent } from "@mwater/expressions-ui"
|
|
9
7
|
import { ExprComponent } from "@mwater/expressions-ui"
|
|
10
8
|
import { FilterExprComponent } from "@mwater/expressions-ui"
|
|
11
9
|
import OrderingsComponent from "./OrderingsComponent"
|
|
@@ -18,6 +16,8 @@ import { TableChartColumn, TableChartDesign } from "./TableChart"
|
|
|
18
16
|
import AxisComponent from "../../../axes/AxisComponent"
|
|
19
17
|
import { Axis } from "../../../axes/Axis"
|
|
20
18
|
|
|
19
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
20
|
+
|
|
21
21
|
export interface TableChartDesignerComponentProps {
|
|
22
22
|
design: TableChartDesign
|
|
23
23
|
schema: Schema
|
|
@@ -251,7 +251,7 @@ export interface TableChartColumnDesignerComponentProps {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
class TableChartColumnDesignerComponent extends React.Component<TableChartColumnDesignerComponentProps> {
|
|
254
|
-
static
|
|
254
|
+
static contextType = LocaleContext
|
|
255
255
|
|
|
256
256
|
// Updates column with the specified changes
|
|
257
257
|
updateColumn(changes: any) {
|
|
@@ -346,7 +346,7 @@ class TableChartColumnDesignerComponent extends React.Component<TableChartColumn
|
|
|
346
346
|
const column = this.props.design.columns[this.props.index]
|
|
347
347
|
|
|
348
348
|
const axisBuilder = new AxisBuilder({ schema: this.props.schema })
|
|
349
|
-
const placeholder = column.textAxis ? axisBuilder.summarizeAxis(column.textAxis ?? null, this.context
|
|
349
|
+
const placeholder = column.textAxis ? axisBuilder.summarizeAxis(column.textAxis ?? null, this.context): ""
|
|
350
350
|
|
|
351
351
|
return R(
|
|
352
352
|
"div",
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _, { sortBy } from "lodash"
|
|
1
|
+
import _ from "lodash"
|
|
3
2
|
import React from "react"
|
|
4
3
|
const R = React.createElement
|
|
5
|
-
import moment from "moment"
|
|
6
4
|
import { default as Linkify } from "react-linkify"
|
|
7
5
|
import AxisBuilder from "../../../axes/AxisBuilder"
|
|
8
6
|
import { DataSource, ExprUtils, Schema } from "@mwater/expressions"
|
|
@@ -10,6 +8,7 @@ import { formatValue } from "../../../valueFormatter"
|
|
|
10
8
|
import { Image } from "@mwater/forms/lib/RotationAwareImageComponent"
|
|
11
9
|
import { TableChartColumn, TableChartDesign } from "./TableChart"
|
|
12
10
|
import Color from "color"
|
|
11
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
13
12
|
|
|
14
13
|
export interface TableChartViewComponentProps {
|
|
15
14
|
/** Design of chart */
|
|
@@ -78,7 +77,7 @@ interface TableContentsComponentState {
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
class TableContentsComponent extends React.Component<TableContentsComponentProps, TableContentsComponentState> {
|
|
81
|
-
static
|
|
80
|
+
static contextType = LocaleContext
|
|
82
81
|
|
|
83
82
|
constructor(props: TableContentsComponentProps) {
|
|
84
83
|
super(props)
|
|
@@ -155,7 +154,7 @@ class TableContentsComponent extends React.Component<TableContentsComponentProps
|
|
|
155
154
|
const column = this.props.columns[index]
|
|
156
155
|
//(this.state.sort?.direction === 'asc' ? "":"")
|
|
157
156
|
const text =
|
|
158
|
-
column.headerText ?? (column.textAxis ? axisBuilder.summarizeAxis(column.textAxis, this.context
|
|
157
|
+
column.headerText ?? (column.textAxis ? axisBuilder.summarizeAxis(column.textAxis, this.context) : "")
|
|
159
158
|
return R(
|
|
160
159
|
"th",
|
|
161
160
|
{
|
|
@@ -233,7 +232,7 @@ class TableContentsComponent extends React.Component<TableContentsComponentProps
|
|
|
233
232
|
const column = this.props.columns[columnIndex]
|
|
234
233
|
// Set background color
|
|
235
234
|
let backgroundColor = "transparent"
|
|
236
|
-
let textColor = "
|
|
235
|
+
let textColor = "inherit"
|
|
237
236
|
|
|
238
237
|
const exprUtils = new ExprUtils(this.props.schema)
|
|
239
238
|
if (!column.textAxis) {
|
|
@@ -244,6 +243,10 @@ class TableContentsComponent extends React.Component<TableContentsComponentProps
|
|
|
244
243
|
// Get value
|
|
245
244
|
let value = row[`c${columnIndex}`]
|
|
246
245
|
|
|
246
|
+
if (column.backgroundColorAxis) {
|
|
247
|
+
backgroundColor = axisBuilder.getValueColor(column.backgroundColorAxis, row[`bc${columnIndex}`]) ?? "#fff"
|
|
248
|
+
}
|
|
249
|
+
|
|
247
250
|
if (value == null) {
|
|
248
251
|
node = null
|
|
249
252
|
} else {
|
|
@@ -257,10 +260,6 @@ class TableContentsComponent extends React.Component<TableContentsComponentProps
|
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
|
|
260
|
-
if (column.backgroundColorAxis && row[`bc${columnIndex}`] != null) {
|
|
261
|
-
backgroundColor = axisBuilder.getValueColor(column.backgroundColorAxis, row[`bc${columnIndex}`]) ?? "#fff"
|
|
262
|
-
}
|
|
263
|
-
|
|
264
263
|
// Convert to node based on type
|
|
265
264
|
switch (exprType) {
|
|
266
265
|
case "text":
|
|
@@ -274,12 +273,12 @@ class TableContentsComponent extends React.Component<TableContentsComponentProps
|
|
|
274
273
|
break
|
|
275
274
|
case "boolean":
|
|
276
275
|
case "enum":
|
|
277
|
-
node = exprUtils.stringifyExprLiteral(column.textAxis?.expr, value, this.context
|
|
276
|
+
node = exprUtils.stringifyExprLiteral(column.textAxis?.expr, value, this.context)
|
|
278
277
|
break
|
|
279
278
|
case "enumset":
|
|
280
279
|
case "text[]":
|
|
281
280
|
if (_.isArray(value)) {
|
|
282
|
-
node = exprUtils.stringifyExprLiteral(column.textAxis?.expr, value, this.context
|
|
281
|
+
node = exprUtils.stringifyExprLiteral(column.textAxis?.expr, value, this.context)
|
|
283
282
|
}
|
|
284
283
|
break
|
|
285
284
|
case "date":
|
|
@@ -312,7 +311,7 @@ class TableContentsComponent extends React.Component<TableContentsComponentProps
|
|
|
312
311
|
const c = Color(backgroundColor)
|
|
313
312
|
// Get lightness (taking into account alpha)
|
|
314
313
|
const lightness = 1 - (1 - c.luminosity()) * c.alpha()
|
|
315
|
-
textColor = lightness < 0.3 ? "rgb(204,204,204)" : "
|
|
314
|
+
textColor = lightness < 0.3 ? "rgb(204,204,204)" : "inherit"
|
|
316
315
|
}
|
|
317
316
|
|
|
318
317
|
return R("td", { key: columnIndex, style: { backgroundColor, color: textColor } }, node)
|
|
@@ -337,7 +336,7 @@ class TableContentsComponent extends React.Component<TableContentsComponentProps
|
|
|
337
336
|
render() {
|
|
338
337
|
return R(
|
|
339
338
|
"table",
|
|
340
|
-
{ className: "mwater-visualization-table", style: {
|
|
339
|
+
{ className: "mwater-visualization-table", style: { marginBottom: 0 } },
|
|
341
340
|
this.renderHeader(),
|
|
342
341
|
this.renderBody(),
|
|
343
342
|
this.renderFooter()
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
1
|
import React, { CSSProperties } from "react"
|
|
3
|
-
const R = React.createElement
|
|
4
2
|
import _ from "lodash"
|
|
5
3
|
import RichTextComponent from "../../richtext/RichTextComponent"
|
|
6
4
|
import ExprInsertModalComponent from "./ExprInsertModalComponent"
|
|
@@ -8,6 +6,7 @@ import ExprUpdateModalComponent from "./ExprUpdateModalComponent"
|
|
|
8
6
|
import ExprItemsHtmlConverter from "../../richtext/ExprItemsHtmlConverter"
|
|
9
7
|
import { TextWidgetDesign } from "./TextWidgetDesign"
|
|
10
8
|
import { DataSource, Schema } from "@mwater/expressions"
|
|
9
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
11
10
|
|
|
12
11
|
export interface TextComponentProps {
|
|
13
12
|
design: TextWidgetDesign
|
|
@@ -29,10 +28,10 @@ export interface TextComponentProps {
|
|
|
29
28
|
// Text component which is provided with the data it needs, rather than loading it.
|
|
30
29
|
// Used by TextWidgetComponent and also by other components that embed text fields
|
|
31
30
|
export default class TextComponent extends React.Component<TextComponentProps> {
|
|
32
|
-
static
|
|
33
|
-
exprInsertModal: ExprInsertModalComponent | null
|
|
34
|
-
exprUpdateModal: ExprUpdateModalComponent | null
|
|
35
|
-
editor: RichTextComponent | null
|
|
31
|
+
static contextType = LocaleContext
|
|
32
|
+
exprInsertModal: ExprInsertModalComponent | null = null
|
|
33
|
+
exprUpdateModal: ExprUpdateModalComponent | null = null
|
|
34
|
+
editor: RichTextComponent | null = null
|
|
36
35
|
|
|
37
36
|
createItemsHtmlConverter() {
|
|
38
37
|
return new ExprItemsHtmlConverter(
|
|
@@ -43,7 +42,7 @@ export default class TextComponent extends React.Component<TextComponentProps> {
|
|
|
43
42
|
this.props.onDesignChange != null && this.props.singleRowTable != null,
|
|
44
43
|
// Only replace named strings if not editing
|
|
45
44
|
this.props.onDesignChange == null ? this.props.namedStrings : undefined,
|
|
46
|
-
this.context
|
|
45
|
+
this.context
|
|
47
46
|
)
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -81,41 +80,41 @@ export default class TextComponent extends React.Component<TextComponentProps> {
|
|
|
81
80
|
})
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
handleAddExpr = (ev:
|
|
83
|
+
handleAddExpr = (ev: React.MouseEvent<HTMLDivElement>) => {
|
|
85
84
|
ev.preventDefault()
|
|
86
85
|
return this.exprInsertModal!.open()
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
renderExtraPaletteButtons() {
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
return (
|
|
90
|
+
<div key="expr" className="mwater-visualization-text-palette-item" onMouseDown={this.handleAddExpr}>
|
|
91
|
+
<i className="fa fa-plus" />
|
|
92
|
+
{" Expression"}
|
|
93
|
+
</div>
|
|
95
94
|
)
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
renderModals() {
|
|
99
98
|
return [
|
|
100
|
-
|
|
101
|
-
key
|
|
102
|
-
ref
|
|
99
|
+
<ExprInsertModalComponent
|
|
100
|
+
key="exprInsertModal"
|
|
101
|
+
ref={(c: ExprInsertModalComponent | null) => {
|
|
103
102
|
this.exprInsertModal = c
|
|
104
|
-
}
|
|
105
|
-
schema
|
|
106
|
-
dataSource
|
|
107
|
-
onInsert
|
|
108
|
-
singleRowTable
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
key
|
|
112
|
-
ref
|
|
103
|
+
}}
|
|
104
|
+
schema={this.props.schema}
|
|
105
|
+
dataSource={this.props.dataSource}
|
|
106
|
+
onInsert={this.handleInsertExpr}
|
|
107
|
+
singleRowTable={this.props.singleRowTable}
|
|
108
|
+
/>,
|
|
109
|
+
<ExprUpdateModalComponent
|
|
110
|
+
key="exprUpdateModal"
|
|
111
|
+
ref={(c: ExprUpdateModalComponent | null) => {
|
|
113
112
|
this.exprUpdateModal = c
|
|
114
|
-
}
|
|
115
|
-
schema
|
|
116
|
-
dataSource
|
|
117
|
-
singleRowTable
|
|
118
|
-
|
|
113
|
+
}}
|
|
114
|
+
schema={this.props.schema}
|
|
115
|
+
dataSource={this.props.dataSource}
|
|
116
|
+
singleRowTable={this.props.singleRowTable}
|
|
117
|
+
/>
|
|
119
118
|
]
|
|
120
119
|
}
|
|
121
120
|
|
|
@@ -125,27 +124,26 @@ export default class TextComponent extends React.Component<TextComponentProps> {
|
|
|
125
124
|
|
|
126
125
|
render() {
|
|
127
126
|
const style: CSSProperties = {
|
|
128
|
-
position: "relative"
|
|
127
|
+
position: "relative",
|
|
128
|
+
width: this.props.width,
|
|
129
|
+
height: this.props.height
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
includeHeadings: this.props.design.style === "default" || !this.props.design.style,
|
|
147
|
-
extraPaletteButtons: this.renderExtraPaletteButtons()
|
|
148
|
-
})
|
|
132
|
+
return (
|
|
133
|
+
<div>
|
|
134
|
+
{this.renderModals()}
|
|
135
|
+
<RichTextComponent
|
|
136
|
+
ref={this.refRichTextComponent}
|
|
137
|
+
className={`mwater-visualization-text-widget-style-${this.props.design.style || "default"}`}
|
|
138
|
+
style={style}
|
|
139
|
+
items={this.props.design.items}
|
|
140
|
+
onItemsChange={this.props.onDesignChange ? this.handleItemsChange : undefined}
|
|
141
|
+
onItemClick={this.handleItemClick}
|
|
142
|
+
itemsHtmlConverter={this.createItemsHtmlConverter()}
|
|
143
|
+
includeHeadings={this.props.design.style === "default" || !this.props.design.style}
|
|
144
|
+
extraPaletteButtons={this.renderExtraPaletteButtons()}
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
149
147
|
)
|
|
150
148
|
}
|
|
151
149
|
}
|
|
@@ -43,7 +43,8 @@ export default class TextWidget extends Widget {
|
|
|
43
43
|
height: options.height,
|
|
44
44
|
singleRowTable: options.singleRowTable,
|
|
45
45
|
namedStrings: options.namedStrings,
|
|
46
|
-
ref: options.widgetRef
|
|
46
|
+
ref: options.widgetRef,
|
|
47
|
+
refreshKey: options.refreshKey
|
|
47
48
|
})
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -160,7 +161,7 @@ export default class TextWidget extends Widget {
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
// Map of value by id
|
|
163
|
-
const exprValues = {}
|
|
164
|
+
const exprValues: { [key: string]: any } = {}
|
|
164
165
|
|
|
165
166
|
return async.each(
|
|
166
167
|
this.getExprItems(design.items),
|
|
@@ -204,7 +205,11 @@ export default class TextWidget extends Widget {
|
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
// Get a list of table ids that can be filtered on
|
|
207
|
-
getFilterableTables(design: TextWidgetDesign, schema: Schema) {
|
|
208
|
+
getFilterableTables(design: TextWidgetDesign | undefined, schema: Schema) {
|
|
209
|
+
if (!design) {
|
|
210
|
+
return []
|
|
211
|
+
}
|
|
212
|
+
|
|
208
213
|
const exprItems = this.getExprItems(design.items)
|
|
209
214
|
|
|
210
215
|
let filterableTables = _.map(exprItems, (exprItem) => (exprItem.expr as OpExpr)?.table)
|