@mwater/visualization 5.1.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/GlobalFilter.d.ts +13 -0
- package/lib/GlobalFilter.js +2 -0
- 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 +7 -25
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +19 -9
- package/lib/MWaterContextComponent.js +38 -22
- package/lib/MWaterCustomTablesetListComponent.js +9 -3
- package/lib/MWaterGlobalFiltersComponent.d.ts +6 -5
- package/lib/MWaterGlobalFiltersComponent.js +4 -4
- package/lib/MWaterLoaderComponent.d.ts +15 -3
- package/lib/MWaterLoaderComponent.js +11 -2
- 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/Axis.d.ts +20 -25
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +12 -8
- package/lib/axes/AxisComponent.d.ts +6 -9
- 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 -17
- package/lib/dashboards/DashboardComponent.js +20 -67
- package/lib/dashboards/DashboardDesign.d.ts +5 -20
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +112 -136
- 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 +209 -39
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/SettingsModalComponent.d.ts +4 -15
- package/lib/dashboards/SettingsModalComponent.js +24 -38
- 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/DatagridComponent.d.ts +2 -9
- package/lib/datagrids/DatagridDataSource.d.ts +3 -3
- package/lib/datagrids/DatagridDataSource.js +0 -14
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -93
- package/lib/datagrids/DatagridDesignerComponent.js +8 -6
- package/lib/datagrids/DatagridViewComponent.js +1 -1
- package/lib/datagrids/FindReplaceModalComponent.d.ts +4 -20
- package/lib/datagrids/FindReplaceModalComponent.js +27 -13
- package/lib/datagrids/ServerDatagridDataSource.d.ts +8 -7
- package/lib/datagrids/ServerDatagridDataSource.js +88 -36
- package/lib/demo.js +4 -4
- package/lib/index.css +5 -0
- package/lib/index.d.ts +2 -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 -56
- 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/layouts/grid/GridLayoutManager.d.ts +2 -1
- 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 +5 -2
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/ClusterLayer.js +3 -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/GridLayer.js +5 -3
- package/lib/maps/GridLayerDesigner.js +0 -1
- package/lib/maps/LayerSwitcherComponent.js +1 -1
- package/lib/maps/MapComponent.d.ts +3 -11
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MapDesign.d.ts +2 -13
- package/lib/maps/MapFiltersDesignerComponent.d.ts +0 -4
- package/lib/maps/MapFiltersDesignerComponent.js +4 -5
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +3 -13
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/RegionSelectComponent.d.ts +2 -1
- package/lib/maps/ServerMapDataSource.d.ts +3 -4
- 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.d.ts +1 -0
- package/lib/maps/vectorMaps.js +70 -56
- package/lib/quickfilter/QuickfilterCompiler.d.ts +1 -1
- 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 +3 -11
- package/lib/widgets/ImageWidgetComponent.d.ts +8 -27
- package/lib/widgets/MapWidget.d.ts +4 -7
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/MarkdownWidget.d.ts +2 -7
- package/lib/widgets/TOCWidget.d.ts +2 -9
- 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 -74
- 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/imagemosaic/ImagePopupComponent.d.ts +2 -7
- 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 +5 -31
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -7
- 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 -105
- 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 +11 -7
- 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 -47
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +55 -58
- 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 +30 -16
- package/lib/widgets/text/ExprInsertModalComponent.d.ts +2 -13
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +2 -13
- 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 +16 -2
- 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/GlobalFilter.ts +17 -0
- 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 +42 -33
- package/src/MWaterCustomTablesetListComponent.tsx +21 -3
- package/src/MWaterGlobalFiltersComponent.ts +8 -8
- package/src/MWaterLoaderComponent.ts +14 -4
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/Axis.ts +24 -25
- package/src/axes/AxisBuilder.ts +16 -13
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +73 -147
- package/src/dashboards/DashboardDesign.ts +5 -25
- 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 +377 -71
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/SettingsModalComponent.tsx +170 -0
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDataSource.ts +6 -12
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/DatagridDesignerComponent.tsx +22 -18
- package/src/datagrids/DatagridViewComponent.ts +3 -3
- package/src/datagrids/ExprCellComponent.ts +0 -1
- package/src/datagrids/FindReplaceModalComponent.ts +39 -22
- package/src/datagrids/ServerDatagridDataSource.ts +107 -45
- package/src/demo.ts +4 -4
- package/src/index.css +5 -0
- package/src/index.ts +2 -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 +5 -2
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/ClusterLayer.ts +3 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/GridLayer.ts +5 -3
- package/src/maps/GridLayerDesigner.tsx +0 -1
- package/src/maps/LayerSwitcherComponent.tsx +1 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MapDesign.ts +2 -17
- package/src/maps/{MapFiltersDesignerComponent.ts → MapFiltersDesignerComponent.tsx} +25 -25
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +8 -8
- package/src/maps/VectorMapViewComponent.tsx +2 -2
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +88 -74
- package/src/quickfilter/QuickfilterCompiler.ts +1 -1
- 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 +32 -19
- 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 +26 -2
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -304
- package/src/dashboards/SettingsModalComponent.ts +0 -169
- 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,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
1
|
import _ from "lodash"
|
|
3
2
|
import React, { useMemo } from "react"
|
|
4
3
|
const R = React.createElement
|
|
@@ -22,6 +21,7 @@ import { getFormatOptions } from "../valueFormatter"
|
|
|
22
21
|
import { getDefaultFormat } from "../valueFormatter"
|
|
23
22
|
import { DatagridDesignColumn } from "./DatagridDesign"
|
|
24
23
|
import { DatagridDesign } from ".."
|
|
24
|
+
import { GlobalFiltersElementFactoryContext } from "../MWaterContextComponent"
|
|
25
25
|
|
|
26
26
|
export interface DatagridDesignerComponentProps {
|
|
27
27
|
/** schema to use */
|
|
@@ -36,8 +36,6 @@ export interface DatagridDesignerComponentProps {
|
|
|
36
36
|
|
|
37
37
|
// Designer for the datagrid. Currenly allows only single-table designs (no subtable rows)
|
|
38
38
|
export default class DatagridDesignerComponent extends React.Component<DatagridDesignerComponentProps> {
|
|
39
|
-
static contextTypes = { globalFiltersElementFactory: PropTypes.func }
|
|
40
|
-
|
|
41
39
|
handleTableChange = (table: any) => {
|
|
42
40
|
const design = {
|
|
43
41
|
table,
|
|
@@ -93,20 +91,24 @@ export default class DatagridDesignerComponent extends React.Component<DatagridD
|
|
|
93
91
|
value: this.props.design.filter,
|
|
94
92
|
onChange: this.handleFilterChange
|
|
95
93
|
}),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
94
|
+
<GlobalFiltersElementFactoryContext.Consumer>
|
|
95
|
+
{(globalFiltersElementFactory) =>
|
|
96
|
+
globalFiltersElementFactory
|
|
97
|
+
? R(
|
|
98
|
+
"div",
|
|
99
|
+
{ style: { marginTop: 20 } },
|
|
100
|
+
globalFiltersElementFactory({
|
|
101
|
+
schema: this.props.schema,
|
|
102
|
+
dataSource: this.props.dataSource,
|
|
103
|
+
filterableTables: [this.props.design.table!],
|
|
104
|
+
globalFilters: this.props.design.globalFilters,
|
|
105
|
+
onChange: this.handleGlobalFiltersChange,
|
|
106
|
+
nullIfIrrelevant: true
|
|
107
|
+
})
|
|
108
|
+
)
|
|
109
|
+
: undefined
|
|
110
|
+
}
|
|
111
|
+
</GlobalFiltersElementFactoryContext.Consumer>
|
|
110
112
|
)
|
|
111
113
|
},
|
|
112
114
|
{
|
|
@@ -562,7 +564,9 @@ class ColumnDesignerComponent extends React.Component<ColumnDesignerComponentPro
|
|
|
562
564
|
}),
|
|
563
565
|
this.renderSplit(),
|
|
564
566
|
this.renderFormat(),
|
|
565
|
-
error ?
|
|
567
|
+
error ? <span className="text-danger">
|
|
568
|
+
<i className="fa fa-exclamation-circle" /> {error}
|
|
569
|
+
</span> : undefined
|
|
566
570
|
),
|
|
567
571
|
|
|
568
572
|
R(
|
|
@@ -191,8 +191,8 @@ export default class DatagridViewComponent extends React.Component<
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
const newRows = produce(this.state.rows, draft => {
|
|
194
|
-
if (rows[0]) {
|
|
195
|
-
draft[rowIndex] = rows[0]
|
|
194
|
+
if (rows![0]) {
|
|
195
|
+
draft[rowIndex] = rows![0]
|
|
196
196
|
}
|
|
197
197
|
else {
|
|
198
198
|
// If row missing, remove it from list
|
|
@@ -308,7 +308,7 @@ export default class DatagridViewComponent extends React.Component<
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
handleRowDoubleClick = (ev: any, rowIndex: any) => {
|
|
311
|
-
if (this.props.onRowDoubleClick != null && this.state.rows[rowIndex]
|
|
311
|
+
if (this.props.onRowDoubleClick != null && this.state.rows[rowIndex]?.id) {
|
|
312
312
|
this.props.onRowDoubleClick(this.props.design.table!, this.state.rows[rowIndex].id, rowIndex)
|
|
313
313
|
}
|
|
314
314
|
}
|
|
@@ -24,7 +24,7 @@ export interface FindReplaceModalComponentProps {
|
|
|
24
24
|
|
|
25
25
|
/** Update cell values by updating set of expressions and values */
|
|
26
26
|
updateExprValues: (tableId: string, rowUpdates: RowUpdate[]) => Promise<void>
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
onUpdate: () => void
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -73,6 +73,18 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
73
73
|
// Get expr of replace column
|
|
74
74
|
const replaceExpr = _.findWhere(this.props.design.columns, { id: this.state.replaceColumn })!.expr
|
|
75
75
|
|
|
76
|
+
const exprType = exprUtils.getExprType(this.state.withExpr)
|
|
77
|
+
let compiledWithExpr = exprCompiler.compileExpr({ expr: this.state.withExpr, tableAlias: "main" })
|
|
78
|
+
if (exprType === "geometry") {
|
|
79
|
+
compiledWithExpr = {
|
|
80
|
+
type: "op",
|
|
81
|
+
op: "ST_AsGeoJSON",
|
|
82
|
+
exprs: [
|
|
83
|
+
{ type: "op", op: "ST_Transform", exprs: [{ type: "op", op: "::geometry", exprs: [compiledWithExpr] }, 4326] }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
76
88
|
// Get ids and with value, filtered by filters, design.filter and conditionExpr (if present)
|
|
77
89
|
const query: JsonQLSelectQuery = {
|
|
78
90
|
type: "query",
|
|
@@ -88,7 +100,7 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
88
100
|
},
|
|
89
101
|
{
|
|
90
102
|
type: "select",
|
|
91
|
-
expr:
|
|
103
|
+
expr: compiledWithExpr,
|
|
92
104
|
alias: "withValue"
|
|
93
105
|
}
|
|
94
106
|
],
|
|
@@ -120,7 +132,12 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
120
132
|
}
|
|
121
133
|
|
|
122
134
|
// Create expr
|
|
123
|
-
let expr: Expr = {
|
|
135
|
+
let expr: Expr = {
|
|
136
|
+
type: "op",
|
|
137
|
+
op: filter.op,
|
|
138
|
+
table: design.table!,
|
|
139
|
+
exprs: [columnExpr as Expr].concat(filter.exprs)
|
|
140
|
+
}
|
|
124
141
|
|
|
125
142
|
// Clean expr
|
|
126
143
|
expr = exprCleaner.cleanExpr(expr, { table: design.table! })
|
|
@@ -147,16 +164,19 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
147
164
|
}
|
|
148
165
|
|
|
149
166
|
// Perform updates
|
|
150
|
-
await this.props.updateExprValues(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
167
|
+
await this.props.updateExprValues(
|
|
168
|
+
this.props.design.table!,
|
|
169
|
+
rows.map(row => ({
|
|
170
|
+
primaryKey: row.id,
|
|
171
|
+
expr: replaceExpr,
|
|
172
|
+
value: exprType === "geometry" ? JSON.parse(row.withValue) : row.withValue
|
|
173
|
+
}))
|
|
174
|
+
)
|
|
175
|
+
|
|
156
176
|
alert(T("Successfully replaced {0} values", rows.length))
|
|
157
177
|
this.setState({ open: false })
|
|
158
178
|
this.props.onUpdate()
|
|
159
|
-
} catch(error) {
|
|
179
|
+
} catch (error) {
|
|
160
180
|
alert(`Error: ${error.message}`)
|
|
161
181
|
} finally {
|
|
162
182
|
this.setState({ busy: false })
|
|
@@ -183,7 +203,8 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
183
203
|
else: replaceColumn.expr
|
|
184
204
|
}
|
|
185
205
|
|
|
186
|
-
replaceColumn.label =
|
|
206
|
+
replaceColumn.label =
|
|
207
|
+
replaceColumn.label || exprUtils.summarizeExpr(replaceColumn.expr, this.props.design.locale)
|
|
187
208
|
}
|
|
188
209
|
|
|
189
210
|
// Add filter
|
|
@@ -193,13 +214,9 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
193
214
|
type: "op",
|
|
194
215
|
op: "and",
|
|
195
216
|
table: this.props.design.table!,
|
|
196
|
-
exprs: [
|
|
197
|
-
draft.filter,
|
|
198
|
-
this.state.conditionExpr
|
|
199
|
-
]
|
|
217
|
+
exprs: [draft.filter, this.state.conditionExpr]
|
|
200
218
|
}
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
219
|
+
} else {
|
|
203
220
|
draft.filter = this.state.conditionExpr
|
|
204
221
|
}
|
|
205
222
|
}
|
|
@@ -228,9 +245,9 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
228
245
|
// Determine which columns are replace-able. Excludes subtables and aggregates
|
|
229
246
|
const replaceColumns = _.filter(
|
|
230
247
|
this.props.design.columns,
|
|
231
|
-
|
|
248
|
+
column => !column.subtable && exprUtils.getExprAggrStatus(column.expr) === "individual"
|
|
232
249
|
)
|
|
233
|
-
const replaceColumnOptions = _.map(replaceColumns,
|
|
250
|
+
const replaceColumnOptions = _.map(replaceColumns, column => ({
|
|
234
251
|
value: column.id,
|
|
235
252
|
label: column.label || exprUtils.summarizeExpr(column.expr, this.props.design.locale)
|
|
236
253
|
}))
|
|
@@ -263,7 +280,7 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
263
280
|
placeholder: T("Select Column..."),
|
|
264
281
|
styles: {
|
|
265
282
|
// Keep menu above fixed data table headers
|
|
266
|
-
menu:
|
|
283
|
+
menu: style => _.extend({}, style, { zIndex: 2 })
|
|
267
284
|
}
|
|
268
285
|
})
|
|
269
286
|
),
|
|
@@ -282,7 +299,7 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
282
299
|
dataSource: this.props.dataSource,
|
|
283
300
|
table: this.props.design.table!,
|
|
284
301
|
value: this.state.withExpr,
|
|
285
|
-
onChange:
|
|
302
|
+
onChange: value => this.setState({ withExpr: value }),
|
|
286
303
|
types: [exprUtils.getExprType(replaceExpr)!],
|
|
287
304
|
enumValues: exprUtils.getExprEnumValues(replaceExpr) || undefined,
|
|
288
305
|
idTable: exprUtils.getExprIdTable(replaceExpr) || undefined,
|
|
@@ -304,7 +321,7 @@ export default class FindReplaceModalComponent extends React.Component<
|
|
|
304
321
|
dataSource: this.props.dataSource,
|
|
305
322
|
table: this.props.design.table!,
|
|
306
323
|
value: this.state.conditionExpr,
|
|
307
|
-
onChange:
|
|
324
|
+
onChange: value => this.setState({ conditionExpr: value }),
|
|
308
325
|
types: ["boolean"],
|
|
309
326
|
placeholder: T("All Rows")
|
|
310
327
|
})
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import $ from "jquery"
|
|
2
|
-
import querystring from "querystring"
|
|
3
1
|
import DatagridDataSource from "./DatagridDataSource"
|
|
4
2
|
import compressJson from "../compressJson"
|
|
5
|
-
import
|
|
3
|
+
import querystring from "querystring"
|
|
4
|
+
import { DatagridDesign, JsonQLFilter } from ".."
|
|
5
|
+
import { QuickfiltersDataSource } from "../quickfilter/QuickfiltersDataSource"
|
|
6
|
+
import { Expr, Row } from "@mwater/expressions"
|
|
6
7
|
|
|
7
8
|
export interface ServerDatagridDataSourceOptions {
|
|
8
9
|
/** API url to use for talking to mWater server */
|
|
@@ -22,7 +23,7 @@ export interface ServerDatagridDataSourceOptions {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
/** Uses mWater server to get datagrid data to allow sharing with unprivileged users */
|
|
25
|
-
export default class ServerDatagridDataSource
|
|
26
|
+
export default class ServerDatagridDataSource implements DatagridDataSource {
|
|
26
27
|
options: ServerDatagridDataSourceOptions
|
|
27
28
|
|
|
28
29
|
// options:
|
|
@@ -32,49 +33,92 @@ export default class ServerDatagridDataSource extends DatagridDataSource {
|
|
|
32
33
|
// datagridId: datagrid id to use on server
|
|
33
34
|
// rev: revision to use to allow caching
|
|
34
35
|
constructor(options: ServerDatagridDataSourceOptions) {
|
|
35
|
-
super()
|
|
36
36
|
this.options = options
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// Get the data that the widget needs. The widget should implement getData method (see above) to get the data from the server
|
|
40
40
|
// design: design of the widget. Ignored in the case of server-side rendering
|
|
41
41
|
// filters: array of filters to apply. Each is { table: table id, jsonql: jsonql condition with {alias} for tableAlias. Use injectAlias to correct
|
|
42
|
-
getRows(
|
|
43
|
-
|
|
42
|
+
async getRows(
|
|
43
|
+
design: DatagridDesign,
|
|
44
|
+
offset: number,
|
|
45
|
+
limit: number,
|
|
46
|
+
filters: JsonQLFilter[] | undefined,
|
|
47
|
+
callback: (error: any, rows?: Row[]) => void
|
|
48
|
+
) {
|
|
49
|
+
const query: Record<string, any> = {
|
|
44
50
|
client: this.options.client,
|
|
45
51
|
share: this.options.share,
|
|
46
|
-
filters: compressJson(filters),
|
|
47
52
|
rev: this.options.rev,
|
|
48
53
|
offset,
|
|
49
54
|
limit
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const filtersJson = JSON.stringify(filters)
|
|
58
|
+
const baseUrl = this.options.apiUrl + `datagrids/${this.options.datagridId}/data`
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
let response: Response
|
|
62
|
+
|
|
63
|
+
// If the filters are too large, we need to send them in the body
|
|
64
|
+
if (filtersJson.length > 5000) {
|
|
65
|
+
response = await fetch(baseUrl + '?' + querystring.stringify(query), {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
headers: { 'Content-Type': 'application/json' },
|
|
68
|
+
body: JSON.stringify({ filters: compressJson(filters) }),
|
|
69
|
+
})
|
|
70
|
+
} else {
|
|
71
|
+
query.filters = compressJson(filters)
|
|
72
|
+
const url = baseUrl + '?' + querystring.stringify(query)
|
|
73
|
+
response = await fetch(url)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
throw new Error(`HTTP error! status: ${response.status}`)
|
|
78
|
+
}
|
|
79
|
+
const data = await response.json()
|
|
80
|
+
callback(null, data)
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error(error)
|
|
83
|
+
callback(error)
|
|
84
|
+
}
|
|
60
85
|
}
|
|
61
86
|
|
|
62
|
-
countRows(design: DatagridDesign, filters: any, callback: any) {
|
|
63
|
-
const query = {
|
|
87
|
+
async countRows(design: DatagridDesign, filters: any, callback: any) {
|
|
88
|
+
const query: Record<string, any> = {
|
|
64
89
|
client: this.options.client,
|
|
65
90
|
share: this.options.share,
|
|
66
|
-
|
|
67
|
-
rev: this.options.rev,
|
|
91
|
+
rev: this.options.rev
|
|
68
92
|
}
|
|
69
93
|
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
94
|
+
const filtersJson = JSON.stringify(filters)
|
|
95
|
+
const baseUrl = this.options.apiUrl + `datagrids/${this.options.datagridId}/summary`
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
let response: Response
|
|
99
|
+
|
|
100
|
+
// If the filters are too large, we need to send them in the body
|
|
101
|
+
if (filtersJson.length > 5000) {
|
|
102
|
+
response = await fetch(baseUrl + '?' + querystring.stringify(query), {
|
|
103
|
+
method: 'POST',
|
|
104
|
+
headers: { 'Content-Type': 'application/json' },
|
|
105
|
+
body: JSON.stringify({ filters: compressJson(filters) }),
|
|
106
|
+
})
|
|
107
|
+
} else {
|
|
108
|
+
query.filters = compressJson(filters)
|
|
109
|
+
const url = baseUrl + '?' + querystring.stringify(query)
|
|
110
|
+
response = await fetch(url)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (!response.ok) {
|
|
114
|
+
throw new Error(`HTTP error! status: ${response.status}`)
|
|
115
|
+
}
|
|
116
|
+
const data = await response.json()
|
|
117
|
+
callback(null, data?.[0]?.cnt)
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error(error)
|
|
120
|
+
callback(error)
|
|
121
|
+
}
|
|
78
122
|
}
|
|
79
123
|
|
|
80
124
|
getQuickfiltersDataSource() {
|
|
@@ -99,7 +143,7 @@ interface ServerQuickfilterDataSourceOptions {
|
|
|
99
143
|
rev?: number
|
|
100
144
|
}
|
|
101
145
|
|
|
102
|
-
class ServerQuickfilterDataSource {
|
|
146
|
+
class ServerQuickfilterDataSource implements QuickfiltersDataSource {
|
|
103
147
|
options: ServerQuickfilterDataSourceOptions
|
|
104
148
|
// options:
|
|
105
149
|
// apiUrl: API url to use for talking to mWater server
|
|
@@ -112,26 +156,44 @@ class ServerQuickfilterDataSource {
|
|
|
112
156
|
}
|
|
113
157
|
|
|
114
158
|
// Gets the values of the quickfilter at index
|
|
115
|
-
getValues(index:
|
|
116
|
-
const query = {
|
|
159
|
+
async getValues(index: number, expr: Expr, filters: JsonQLFilter[], offset: number | null, limit: number, callback: (error: any, values?: any[]) => void) {
|
|
160
|
+
const query: Record<string, any> = {
|
|
117
161
|
client: this.options.client,
|
|
118
162
|
share: this.options.share,
|
|
119
|
-
|
|
120
|
-
offset,
|
|
163
|
+
offset: offset ?? 0,
|
|
121
164
|
limit,
|
|
122
165
|
rev: this.options.rev
|
|
123
166
|
}
|
|
124
167
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
168
|
+
try {
|
|
169
|
+
let response: Response
|
|
170
|
+
|
|
171
|
+
const url = this.options.apiUrl + `datagrids/${this.options.datagridId}/quickfilters/${index}/values`
|
|
172
|
+
|
|
173
|
+
const filtersJson = JSON.stringify(filters)
|
|
174
|
+
|
|
175
|
+
// If the filters are too large, we need to send them in the body
|
|
176
|
+
if (filtersJson.length > 5000) {
|
|
177
|
+
query.filters = compressJson(filters)
|
|
178
|
+
response = await fetch(url + '?' + querystring.stringify(query), {
|
|
179
|
+
method: 'POST',
|
|
180
|
+
headers: { 'Content-Type': 'application/json' },
|
|
181
|
+
body: JSON.stringify({ filters: compressJson(filters) }),
|
|
182
|
+
})
|
|
183
|
+
} else {
|
|
184
|
+
query.filters = filtersJson
|
|
185
|
+
response = await fetch(url + '?' + querystring.stringify(query))
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (!response.ok) {
|
|
189
|
+
throw new Error(`HTTP error! status: ${response.status}`)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const data = await response.json()
|
|
193
|
+
callback(null, data)
|
|
194
|
+
} catch (error) {
|
|
195
|
+
console.error(error)
|
|
196
|
+
callback(error)
|
|
197
|
+
}
|
|
136
198
|
}
|
|
137
|
-
}
|
|
199
|
+
}
|
package/src/demo.ts
CHANGED
|
@@ -42,14 +42,14 @@ $(function () {
|
|
|
42
42
|
"div",
|
|
43
43
|
{ className: "container-fluid", style: { height: "100%", paddingLeft: 0, paddingRight: 0 } },
|
|
44
44
|
R("style", null, "html, body, #main { height: 100% }"),
|
|
45
|
-
R(
|
|
45
|
+
R(MWaterDirectDashboardPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
46
|
+
//R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "38d803820a7a4bf5a1d5ef19cf8c64f3"})
|
|
47
|
+
// R(MWaterDirectMapPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
46
48
|
// R(RichTextPane)
|
|
47
49
|
// R(MWaterMapPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1)})
|
|
48
50
|
// R(TestPane, apiUrl: "https://api.mwater.co/v3/")
|
|
49
51
|
// R(MWaterDashboardPane, apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "a855eb0587d845d3ac27aed03c463976", share: "817c76088c7649ec8cc0b8193e547a09")
|
|
50
52
|
// R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "f99f206ddd4442a981761b8342c58058"})
|
|
51
|
-
// R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "38d803820a7a4bf5a1d5ef19cf8c64f3"})
|
|
52
|
-
// R(MWaterDirectDashboardPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
53
53
|
//R(MWaterDirectDashboardPane, { apiUrl: "http://localhost:1234/v3/", client: window.location.hash.substr(1) })
|
|
54
54
|
//R(MWaterDatagridPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
55
55
|
// R(MWaterDirectMapPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
@@ -471,7 +471,7 @@ class WaterOrgDashboardPane extends React.Component {
|
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
componentWillMount() {
|
|
474
|
-
const url = this.props.apiUrl + "
|
|
474
|
+
const url = this.props.apiUrl + "schema"
|
|
475
475
|
return $.getJSON(url, (schemaJson) => {
|
|
476
476
|
const schema = new Schema(schemaJson)
|
|
477
477
|
const dataSource = new MWaterDataSource(this.props.apiUrl, null, { serverCaching: false, localCaching: true })
|
package/src/index.css
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Lato, Lora, Inter, Merriweather, Roboto
|
|
3
|
+
*/
|
|
4
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Lora:ital,wght@0,400..700;1,400..700&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
|
|
5
|
+
|
|
1
6
|
/** Plain link with cursor pointer. Can be span or a */
|
|
2
7
|
.link-plain {
|
|
3
8
|
color: var(--bs-primary);
|
package/src/index.ts
CHANGED
|
@@ -41,6 +41,7 @@ export { default as MWaterContextComponent } from "./MWaterContextComponent"
|
|
|
41
41
|
|
|
42
42
|
export { default as mWaterLoader } from "./mWaterLoader"
|
|
43
43
|
|
|
44
|
+
export { WidgetDataSource } from "./widgets/WidgetDataSource"
|
|
44
45
|
export { default as DirectWidgetDataSource } from "./widgets/DirectWidgetDataSource"
|
|
45
46
|
|
|
46
47
|
import "leaflet/dist/leaflet.css"
|
|
@@ -50,7 +51,6 @@ import "./layouts/decorated-block.css"
|
|
|
50
51
|
import "react-datepicker/dist/react-datepicker.css"
|
|
51
52
|
import "billboard.js/dist/billboard.css"
|
|
52
53
|
import "./index.css"
|
|
53
|
-
import "./layout-styles.css"
|
|
54
54
|
|
|
55
55
|
export { setMapTilerApiKey } from "./maps/vectorMaps"
|
|
56
56
|
|
|
@@ -75,6 +75,7 @@ export { default as AxisBuilder } from "./axes/AxisBuilder"
|
|
|
75
75
|
export { default as ColorSchemeFactory } from "./ColorSchemeFactory"
|
|
76
76
|
export { default as DatagridComponent } from "./datagrids/DatagridComponent"
|
|
77
77
|
export { default as DatagridViewComponent } from "./datagrids/DatagridViewComponent"
|
|
78
|
+
export { default as DatagridDataSource } from "./datagrids/DatagridDataSource"
|
|
78
79
|
export { default as ServerDashboardDataSource } from "./dashboards/ServerDashboardDataSource"
|
|
79
80
|
export { default as ServerMapDataSource } from "./maps/ServerMapDataSource"
|
|
80
81
|
export { default as DirectMapDataSource } from "./maps/DirectMapDataSource"
|
|
@@ -1,47 +1,56 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from "react"
|
|
2
|
-
import { BlocksLayoutOptions } from "../dashboards/layoutOptions"
|
|
2
|
+
import { BlocksLayoutOptions, DashboardTheme } from "../dashboards/layoutOptions"
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/** Options for rendering a widget */
|
|
5
|
+
export interface RenderWidgetOptions {
|
|
6
|
+
id: string
|
|
7
|
+
type: string
|
|
8
|
+
|
|
9
|
+
design: any
|
|
10
|
+
onDesignChange?: (design: any) => void
|
|
11
|
+
|
|
12
|
+
width: number
|
|
13
|
+
|
|
14
|
+
/** height of widget. If not specified, is auto height */
|
|
15
|
+
height?: number
|
|
16
|
+
|
|
17
|
+
/** Priority of widget. Higher priority widgets are rendered first */
|
|
18
|
+
priority?: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface RenderLayoutOptions {
|
|
22
|
+
/** width of layout */
|
|
23
|
+
width?: number
|
|
10
24
|
|
|
11
|
-
|
|
12
|
-
|
|
25
|
+
/** opaque items object that layout manager understands */
|
|
26
|
+
items: any
|
|
13
27
|
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
/** Called when items changes */
|
|
29
|
+
onItemsChange?: (items: any) => void
|
|
16
30
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
id: string
|
|
20
|
-
type: string
|
|
21
|
-
design: any
|
|
22
|
-
onDesignChange: (design: any) => void
|
|
23
|
-
width: number
|
|
24
|
-
height: number
|
|
25
|
-
}) => ReactElement
|
|
31
|
+
/** called with ({ id:, type:, design:, onDesignChange:, width:, height: }) */
|
|
32
|
+
renderWidget: (options: RenderWidgetOptions) => ReactElement
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
/** layout options to use */
|
|
35
|
+
layoutOptions: BlocksLayoutOptions
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
/** true to disable maps */
|
|
38
|
+
disableMaps?: boolean
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
/** clipboard contents */
|
|
41
|
+
clipboard?: any
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
/** called when clipboard is changed */
|
|
44
|
+
onClipboardChange?: (clipboard: any) => void
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
/** message to display if clipboard can't be pasted into current dashboard */
|
|
47
|
+
cantPasteMessage?: string
|
|
48
|
+
}
|
|
41
49
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
/** Responsible for laying out items, rendering widgets and holding them in a data structure that is layout manager specific */
|
|
51
|
+
export default class LayoutManager {
|
|
52
|
+
/** Renders the layout as a react element */
|
|
53
|
+
renderLayout(options: RenderLayoutOptions): ReactNode {
|
|
45
54
|
return null
|
|
46
55
|
}
|
|
47
56
|
|
|
@@ -61,19 +70,12 @@ export default class LayoutManager {
|
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
static createLayoutManager(type: string): LayoutManager {
|
|
64
|
-
|
|
65
|
-
type = type || "grid"
|
|
73
|
+
type = type || "blocks"
|
|
66
74
|
|
|
67
75
|
switch (type) {
|
|
68
|
-
case "
|
|
69
|
-
var GridLayoutManager = require("./grid/GridLayoutManager").default
|
|
70
|
-
return new GridLayoutManager()
|
|
71
|
-
break
|
|
72
|
-
|
|
73
|
-
case "blocks": // New one
|
|
76
|
+
case "blocks":
|
|
74
77
|
var BlocksLayoutManager = require("./blocks/BlocksLayoutManager").default
|
|
75
78
|
return new BlocksLayoutManager()
|
|
76
|
-
break
|
|
77
79
|
|
|
78
80
|
default:
|
|
79
81
|
throw new Error(`Unknown layout manager type ${type}`)
|