@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
|
@@ -13,10 +13,7 @@ export interface DatagridDesign {
|
|
|
13
13
|
/** array of subtables (1-n joins) */
|
|
14
14
|
subtables?: DatagridDesignSubtable[];
|
|
15
15
|
/** array of { expr: expression to order on, direction: "asc"/"desc" } */
|
|
16
|
-
orderBys?:
|
|
17
|
-
expr: Expr;
|
|
18
|
-
direction: "asc" | "desc";
|
|
19
|
-
}[];
|
|
16
|
+
orderBys?: DatagridDesignOrderBy[];
|
|
20
17
|
/** array of quick filters (user-selectable filters). See quickfilter/README.md */
|
|
21
18
|
quickfilters?: Quickfilter[];
|
|
22
19
|
/** true to show row numbers */
|
|
@@ -26,6 +23,10 @@ export interface DatagridDesign {
|
|
|
26
23
|
/** true to show number of rows */
|
|
27
24
|
showNumRows?: boolean;
|
|
28
25
|
}
|
|
26
|
+
export interface DatagridDesignOrderBy {
|
|
27
|
+
expr: Expr;
|
|
28
|
+
direction: "asc" | "desc";
|
|
29
|
+
}
|
|
29
30
|
export interface DatagridDesignColumn {
|
|
30
31
|
/** unique id of the column */
|
|
31
32
|
id: string;
|
|
@@ -39,7 +40,7 @@ export interface DatagridDesignColumn {
|
|
|
39
40
|
type: "expr";
|
|
40
41
|
/** Expression */
|
|
41
42
|
expr: Expr;
|
|
42
|
-
/** Format for formattable types (number and geometry) */
|
|
43
|
+
/** Format for formattable types (number and geometry). See libraries/visualization/src/valueFormatter.ts */
|
|
43
44
|
format?: string;
|
|
44
45
|
}
|
|
45
46
|
export interface DatagridDesignSubtable {
|
|
@@ -52,7 +53,7 @@ export interface DatagridDesignSubtable {
|
|
|
52
53
|
/** mwater-expression */
|
|
53
54
|
filter?: Expr;
|
|
54
55
|
/** array of { expr: expression to order on, direction: "asc"/"desc" } */
|
|
55
|
-
orderBys
|
|
56
|
+
orderBys?: {
|
|
56
57
|
expr: Expr;
|
|
57
58
|
direction: "asc" | "desc";
|
|
58
59
|
}[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
4
|
-
import
|
|
3
|
+
import TabbedComponent from "@mwater/react-library/lib/TabbedComponent";
|
|
5
4
|
import { DatagridDesign } from "..";
|
|
6
5
|
export interface DatagridDesignerComponentProps {
|
|
7
6
|
/** schema to use */
|
|
@@ -14,101 +13,11 @@ export interface DatagridDesignerComponentProps {
|
|
|
14
13
|
onDesignChange: (design: DatagridDesign) => void;
|
|
15
14
|
}
|
|
16
15
|
export default class DatagridDesignerComponent extends React.Component<DatagridDesignerComponentProps> {
|
|
17
|
-
static contextTypes: {
|
|
18
|
-
globalFiltersElementFactory: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
-
};
|
|
20
16
|
handleTableChange: (table: any) => void;
|
|
21
17
|
handleColumnsChange: (columns: any) => void;
|
|
22
18
|
handleFilterChange: (filter: any) => void;
|
|
23
19
|
handleGlobalFiltersChange: (globalFilters: any) => void;
|
|
24
20
|
handleOrderBysChange: (orderBys: any) => void;
|
|
25
|
-
renderTabs(): React.CElement<
|
|
26
|
-
initialTabId: string;
|
|
27
|
-
tabs: ({
|
|
28
|
-
id: string;
|
|
29
|
-
label: string;
|
|
30
|
-
elem: React.CElement<ColumnsDesignerComponentProps, ColumnsDesignerComponent>;
|
|
31
|
-
} | {
|
|
32
|
-
id: string;
|
|
33
|
-
label: string;
|
|
34
|
-
elem: React.DetailedReactHTMLElement<{
|
|
35
|
-
style: {
|
|
36
|
-
marginBottom: number;
|
|
37
|
-
};
|
|
38
|
-
}, HTMLElement>;
|
|
39
|
-
})[];
|
|
40
|
-
}, React.Component<{
|
|
41
|
-
initialTabId: string;
|
|
42
|
-
tabs: ({
|
|
43
|
-
id: string;
|
|
44
|
-
label: string;
|
|
45
|
-
elem: React.CElement<ColumnsDesignerComponentProps, ColumnsDesignerComponent>;
|
|
46
|
-
} | {
|
|
47
|
-
id: string;
|
|
48
|
-
label: string;
|
|
49
|
-
elem: React.DetailedReactHTMLElement<{
|
|
50
|
-
style: {
|
|
51
|
-
marginBottom: number;
|
|
52
|
-
};
|
|
53
|
-
}, HTMLElement>;
|
|
54
|
-
})[];
|
|
55
|
-
}, any, any>>;
|
|
21
|
+
renderTabs(): React.CElement<any, TabbedComponent>;
|
|
56
22
|
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
57
23
|
}
|
|
58
|
-
interface ColumnsDesignerComponentProps {
|
|
59
|
-
/** schema to use */
|
|
60
|
-
schema: Schema;
|
|
61
|
-
/** dataSource to use */
|
|
62
|
-
dataSource: DataSource;
|
|
63
|
-
table: string;
|
|
64
|
-
/** Columns list See README.md of this folder */
|
|
65
|
-
columns: any;
|
|
66
|
-
onColumnsChange: any;
|
|
67
|
-
}
|
|
68
|
-
declare class ColumnsDesignerComponent extends React.Component<ColumnsDesignerComponentProps> {
|
|
69
|
-
handleColumnChange: (columnIndex: any, column: any) => any;
|
|
70
|
-
handleAddColumn: () => any;
|
|
71
|
-
handleAddIdColumn: () => any;
|
|
72
|
-
handleAddDefaultColumns: () => any;
|
|
73
|
-
handleRemoveAllColumns: () => any;
|
|
74
|
-
renderColumn: (column: DatagridDesignColumn, columnIndex: any, connectDragSource: any, connectDragPreview: any, connectDropTarget: any) => React.CElement<ColumnDesignerComponentProps, ColumnDesignerComponent>;
|
|
75
|
-
render(): React.DetailedReactHTMLElement<{
|
|
76
|
-
style: {
|
|
77
|
-
height: string;
|
|
78
|
-
overflowY: "auto";
|
|
79
|
-
overflowX: "hidden";
|
|
80
|
-
};
|
|
81
|
-
}, HTMLElement>;
|
|
82
|
-
}
|
|
83
|
-
interface ColumnDesignerComponentProps {
|
|
84
|
-
/** schema to use */
|
|
85
|
-
schema: Schema;
|
|
86
|
-
/** dataSource to use */
|
|
87
|
-
dataSource: DataSource;
|
|
88
|
-
table: string;
|
|
89
|
-
/** Column See README.md of this folder */
|
|
90
|
-
column: DatagridDesignColumn;
|
|
91
|
-
/** Called when column changes. Null to remove. Array to replace with multiple entries */
|
|
92
|
-
onColumnChange: (column: DatagridDesignColumn | null | DatagridDesignColumn[]) => void;
|
|
93
|
-
/** Connect drag source (handle) here */
|
|
94
|
-
connectDragSource: any;
|
|
95
|
-
/** Connect drag preview here */
|
|
96
|
-
connectDragPreview: any;
|
|
97
|
-
connectDropTarget: any;
|
|
98
|
-
}
|
|
99
|
-
declare class ColumnDesignerComponent extends React.Component<ColumnDesignerComponentProps> {
|
|
100
|
-
handleExprChange: (expr: any) => void;
|
|
101
|
-
handleLabelChange: (label: any) => void;
|
|
102
|
-
handleFormatChange: (ev: any) => void;
|
|
103
|
-
handleSplitEnumset: () => void;
|
|
104
|
-
handleSplitGeometry: () => void;
|
|
105
|
-
renderSplit(): React.DetailedReactHTMLElement<{
|
|
106
|
-
className: string;
|
|
107
|
-
onClick: () => void;
|
|
108
|
-
}, HTMLElement> | null;
|
|
109
|
-
renderFormat(): React.DetailedReactHTMLElement<{
|
|
110
|
-
className: string;
|
|
111
|
-
}, HTMLElement> | null;
|
|
112
|
-
render: () => any;
|
|
113
|
-
}
|
|
114
|
-
export {};
|
|
@@ -26,7 +26,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
30
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
31
30
|
const react_1 = __importStar(require("react"));
|
|
32
31
|
const R = react_1.default.createElement;
|
|
@@ -47,9 +46,9 @@ const update_object_1 = __importDefault(require("update-object"));
|
|
|
47
46
|
const ui = __importStar(require("@mwater/react-library/lib/bootstrap"));
|
|
48
47
|
const valueFormatter_1 = require("../valueFormatter");
|
|
49
48
|
const valueFormatter_2 = require("../valueFormatter");
|
|
49
|
+
const MWaterContextComponent_1 = require("../MWaterContextComponent");
|
|
50
50
|
// Designer for the datagrid. Currenly allows only single-table designs (no subtable rows)
|
|
51
51
|
class DatagridDesignerComponent extends react_1.default.Component {
|
|
52
|
-
static contextTypes = { globalFiltersElementFactory: prop_types_1.default.func };
|
|
53
52
|
handleTableChange = (table) => {
|
|
54
53
|
const design = {
|
|
55
54
|
table,
|
|
@@ -95,8 +94,8 @@ class DatagridDesignerComponent extends react_1.default.Component {
|
|
|
95
94
|
table: this.props.design.table,
|
|
96
95
|
value: this.props.design.filter,
|
|
97
96
|
onChange: this.handleFilterChange
|
|
98
|
-
}),
|
|
99
|
-
? R("div", { style: { marginTop: 20 } },
|
|
97
|
+
}), react_1.default.createElement(MWaterContextComponent_1.GlobalFiltersElementFactoryContext.Consumer, null, (globalFiltersElementFactory) => globalFiltersElementFactory
|
|
98
|
+
? R("div", { style: { marginTop: 20 } }, globalFiltersElementFactory({
|
|
100
99
|
schema: this.props.schema,
|
|
101
100
|
dataSource: this.props.dataSource,
|
|
102
101
|
filterableTables: [this.props.design.table],
|
|
@@ -104,7 +103,7 @@ class DatagridDesignerComponent extends react_1.default.Component {
|
|
|
104
103
|
onChange: this.handleGlobalFiltersChange,
|
|
105
104
|
nullIfIrrelevant: true
|
|
106
105
|
}))
|
|
107
|
-
: undefined)
|
|
106
|
+
: undefined))
|
|
108
107
|
},
|
|
109
108
|
{
|
|
110
109
|
id: "order",
|
|
@@ -378,7 +377,10 @@ class ColumnDesignerComponent extends react_1.default.Component {
|
|
|
378
377
|
aggrStatuses: ["literal", "individual", "aggregate"],
|
|
379
378
|
types: allowedTypes,
|
|
380
379
|
onChange: this.handleExprChange
|
|
381
|
-
}), this.renderSplit(), this.renderFormat(), error ?
|
|
380
|
+
}), this.renderSplit(), this.renderFormat(), error ? react_1.default.createElement("span", { className: "text-danger" },
|
|
381
|
+
react_1.default.createElement("i", { className: "fa fa-exclamation-circle" }),
|
|
382
|
+
" ",
|
|
383
|
+
error) : undefined), R("div", { className: "col-4" }, R("input", {
|
|
382
384
|
type: "text",
|
|
383
385
|
className: "form-control",
|
|
384
386
|
placeholder: exprUtils.summarizeExpr(this.props.column.expr),
|
|
@@ -202,7 +202,7 @@ class DatagridViewComponent extends react_1.default.Component {
|
|
|
202
202
|
this.editCellComp = comp;
|
|
203
203
|
};
|
|
204
204
|
handleRowDoubleClick = (ev, rowIndex) => {
|
|
205
|
-
if (this.props.onRowDoubleClick != null && this.state.rows[rowIndex]
|
|
205
|
+
if (this.props.onRowDoubleClick != null && this.state.rows[rowIndex]?.id) {
|
|
206
206
|
this.props.onRowDoubleClick(this.props.design.table, this.state.rows[rowIndex].id, rowIndex);
|
|
207
207
|
}
|
|
208
208
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import AutoSizeComponent from "@mwater/react-library/lib/AutoSizeComponent";
|
|
2
3
|
import { RowUpdate } from "./DatagridViewComponent";
|
|
4
|
+
import ModalPopupComponent from "@mwater/react-library/lib/ModalPopupComponent";
|
|
3
5
|
import { DataSource, Expr, Schema } from "@mwater/expressions";
|
|
4
6
|
import { DatagridDesign, JsonQLFilter } from "..";
|
|
5
7
|
export interface FindReplaceModalComponentProps {
|
|
@@ -27,26 +29,8 @@ export default class FindReplaceModalComponent extends React.Component<FindRepla
|
|
|
27
29
|
constructor(props: any);
|
|
28
30
|
show(): void;
|
|
29
31
|
performReplace(): Promise<void>;
|
|
30
|
-
renderPreview(): React.CElement<
|
|
32
|
+
renderPreview(): React.CElement<import("@mwater/react-library/lib/AutoSizeComponent").AutoSizeComponentProps, AutoSizeComponent>;
|
|
31
33
|
renderContents(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
32
|
-
render(): React.CElement<
|
|
33
|
-
size: string;
|
|
34
|
-
header: string;
|
|
35
|
-
footer: React.DetailedReactHTMLElement<{
|
|
36
|
-
key: string;
|
|
37
|
-
type: string;
|
|
38
|
-
onClick: () => void;
|
|
39
|
-
className: string;
|
|
40
|
-
}, HTMLElement>[];
|
|
41
|
-
}, React.Component<{
|
|
42
|
-
size: string;
|
|
43
|
-
header: string;
|
|
44
|
-
footer: React.DetailedReactHTMLElement<{
|
|
45
|
-
key: string;
|
|
46
|
-
type: string;
|
|
47
|
-
onClick: () => void;
|
|
48
|
-
className: string;
|
|
49
|
-
}, HTMLElement>[];
|
|
50
|
-
}, any, any>> | null;
|
|
34
|
+
render(): React.CElement<import("@mwater/react-library/lib/ModalPopupComponent").ModalPopupComponentProps, ModalPopupComponent> | null;
|
|
51
35
|
}
|
|
52
36
|
export {};
|
|
@@ -38,6 +38,17 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
38
38
|
const design = this.props.design;
|
|
39
39
|
// Get expr of replace column
|
|
40
40
|
const replaceExpr = lodash_1.default.findWhere(this.props.design.columns, { id: this.state.replaceColumn }).expr;
|
|
41
|
+
const exprType = exprUtils.getExprType(this.state.withExpr);
|
|
42
|
+
let compiledWithExpr = exprCompiler.compileExpr({ expr: this.state.withExpr, tableAlias: "main" });
|
|
43
|
+
if (exprType === "geometry") {
|
|
44
|
+
compiledWithExpr = {
|
|
45
|
+
type: "op",
|
|
46
|
+
op: "ST_AsGeoJSON",
|
|
47
|
+
exprs: [
|
|
48
|
+
{ type: "op", op: "ST_Transform", exprs: [{ type: "op", op: "::geometry", exprs: [compiledWithExpr] }, 4326] }
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
41
52
|
// Get ids and with value, filtered by filters, design.filter and conditionExpr (if present)
|
|
42
53
|
const query = {
|
|
43
54
|
type: "query",
|
|
@@ -53,7 +64,7 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
53
64
|
},
|
|
54
65
|
{
|
|
55
66
|
type: "select",
|
|
56
|
-
expr:
|
|
67
|
+
expr: compiledWithExpr,
|
|
57
68
|
alias: "withValue"
|
|
58
69
|
}
|
|
59
70
|
],
|
|
@@ -80,7 +91,12 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
80
91
|
continue;
|
|
81
92
|
}
|
|
82
93
|
// Create expr
|
|
83
|
-
let expr = {
|
|
94
|
+
let expr = {
|
|
95
|
+
type: "op",
|
|
96
|
+
op: filter.op,
|
|
97
|
+
table: design.table,
|
|
98
|
+
exprs: [columnExpr].concat(filter.exprs)
|
|
99
|
+
};
|
|
84
100
|
// Clean expr
|
|
85
101
|
expr = exprCleaner.cleanExpr(expr, { table: design.table });
|
|
86
102
|
wheres.push(exprCompiler.compileExpr({ expr, tableAlias: "main" }));
|
|
@@ -103,7 +119,7 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
103
119
|
await this.props.updateExprValues(this.props.design.table, rows.map(row => ({
|
|
104
120
|
primaryKey: row.id,
|
|
105
121
|
expr: replaceExpr,
|
|
106
|
-
value: row.withValue
|
|
122
|
+
value: exprType === "geometry" ? JSON.parse(row.withValue) : row.withValue
|
|
107
123
|
})));
|
|
108
124
|
alert(T("Successfully replaced {0} values", rows.length));
|
|
109
125
|
this.setState({ open: false });
|
|
@@ -134,7 +150,8 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
134
150
|
// Unchanged
|
|
135
151
|
else: replaceColumn.expr
|
|
136
152
|
};
|
|
137
|
-
replaceColumn.label =
|
|
153
|
+
replaceColumn.label =
|
|
154
|
+
replaceColumn.label || exprUtils.summarizeExpr(replaceColumn.expr, this.props.design.locale);
|
|
138
155
|
}
|
|
139
156
|
// Add filter
|
|
140
157
|
if (this.state.conditionExpr) {
|
|
@@ -143,10 +160,7 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
143
160
|
type: "op",
|
|
144
161
|
op: "and",
|
|
145
162
|
table: this.props.design.table,
|
|
146
|
-
exprs: [
|
|
147
|
-
draft.filter,
|
|
148
|
-
this.state.conditionExpr
|
|
149
|
-
]
|
|
163
|
+
exprs: [draft.filter, this.state.conditionExpr]
|
|
150
164
|
};
|
|
151
165
|
}
|
|
152
166
|
else {
|
|
@@ -173,8 +187,8 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
173
187
|
let value;
|
|
174
188
|
const exprUtils = new expressions_1.ExprUtils(this.props.schema);
|
|
175
189
|
// Determine which columns are replace-able. Excludes subtables and aggregates
|
|
176
|
-
const replaceColumns = lodash_1.default.filter(this.props.design.columns,
|
|
177
|
-
const replaceColumnOptions = lodash_1.default.map(replaceColumns,
|
|
190
|
+
const replaceColumns = lodash_1.default.filter(this.props.design.columns, column => !column.subtable && exprUtils.getExprAggrStatus(column.expr) === "individual");
|
|
191
|
+
const replaceColumnOptions = lodash_1.default.map(replaceColumns, column => ({
|
|
178
192
|
value: column.id,
|
|
179
193
|
label: column.label || exprUtils.summarizeExpr(column.expr, this.props.design.locale)
|
|
180
194
|
}));
|
|
@@ -189,7 +203,7 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
189
203
|
placeholder: T("Select Column..."),
|
|
190
204
|
styles: {
|
|
191
205
|
// Keep menu above fixed data table headers
|
|
192
|
-
menu:
|
|
206
|
+
menu: style => lodash_1.default.extend({}, style, { zIndex: 2 })
|
|
193
207
|
}
|
|
194
208
|
})), (() => {
|
|
195
209
|
if (this.state.replaceColumn) {
|
|
@@ -200,7 +214,7 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
200
214
|
dataSource: this.props.dataSource,
|
|
201
215
|
table: this.props.design.table,
|
|
202
216
|
value: this.state.withExpr,
|
|
203
|
-
onChange:
|
|
217
|
+
onChange: value => this.setState({ withExpr: value }),
|
|
204
218
|
types: [exprUtils.getExprType(replaceExpr)],
|
|
205
219
|
enumValues: exprUtils.getExprEnumValues(replaceExpr) || undefined,
|
|
206
220
|
idTable: exprUtils.getExprIdTable(replaceExpr) || undefined,
|
|
@@ -215,7 +229,7 @@ class FindReplaceModalComponent extends react_1.default.Component {
|
|
|
215
229
|
dataSource: this.props.dataSource,
|
|
216
230
|
table: this.props.design.table,
|
|
217
231
|
value: this.state.conditionExpr,
|
|
218
|
-
onChange:
|
|
232
|
+
onChange: value => this.setState({ conditionExpr: value }),
|
|
219
233
|
types: ["boolean"],
|
|
220
234
|
placeholder: T("All Rows")
|
|
221
235
|
})), R("div", { key: "preview" }, R("h4", null, T("Preview")), this.renderPreview()));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
/// <reference types="jquery" />
|
|
2
1
|
import DatagridDataSource from "./DatagridDataSource";
|
|
3
|
-
import { DatagridDesign } from "..";
|
|
2
|
+
import { DatagridDesign, JsonQLFilter } from "..";
|
|
3
|
+
import { QuickfiltersDataSource } from "../quickfilter/QuickfiltersDataSource";
|
|
4
|
+
import { Expr, Row } from "@mwater/expressions";
|
|
4
5
|
export interface ServerDatagridDataSourceOptions {
|
|
5
6
|
/** API url to use for talking to mWater server */
|
|
6
7
|
apiUrl: string;
|
|
@@ -14,11 +15,11 @@ export interface ServerDatagridDataSourceOptions {
|
|
|
14
15
|
rev?: number;
|
|
15
16
|
}
|
|
16
17
|
/** Uses mWater server to get datagrid data to allow sharing with unprivileged users */
|
|
17
|
-
export default class ServerDatagridDataSource
|
|
18
|
+
export default class ServerDatagridDataSource implements DatagridDataSource {
|
|
18
19
|
options: ServerDatagridDataSourceOptions;
|
|
19
20
|
constructor(options: ServerDatagridDataSourceOptions);
|
|
20
|
-
getRows(design: DatagridDesign, offset:
|
|
21
|
-
countRows(design: DatagridDesign, filters: any, callback: any):
|
|
21
|
+
getRows(design: DatagridDesign, offset: number, limit: number, filters: JsonQLFilter[] | undefined, callback: (error: any, rows?: Row[]) => void): Promise<void>;
|
|
22
|
+
countRows(design: DatagridDesign, filters: any, callback: any): Promise<void>;
|
|
22
23
|
getQuickfiltersDataSource(): ServerQuickfilterDataSource;
|
|
23
24
|
}
|
|
24
25
|
interface ServerQuickfilterDataSourceOptions {
|
|
@@ -33,9 +34,9 @@ interface ServerQuickfilterDataSourceOptions {
|
|
|
33
34
|
/** revision to use to allow caching */
|
|
34
35
|
rev?: number;
|
|
35
36
|
}
|
|
36
|
-
declare class ServerQuickfilterDataSource {
|
|
37
|
+
declare class ServerQuickfilterDataSource implements QuickfiltersDataSource {
|
|
37
38
|
options: ServerQuickfilterDataSourceOptions;
|
|
38
39
|
constructor(options: ServerQuickfilterDataSourceOptions);
|
|
39
|
-
getValues(index:
|
|
40
|
+
getValues(index: number, expr: Expr, filters: JsonQLFilter[], offset: number | null, limit: number, callback: (error: any, values?: any[]) => void): Promise<void>;
|
|
40
41
|
}
|
|
41
42
|
export {};
|
|
@@ -3,12 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jquery_1 = __importDefault(require("jquery"));
|
|
7
|
-
const querystring_1 = __importDefault(require("querystring"));
|
|
8
|
-
const DatagridDataSource_1 = __importDefault(require("./DatagridDataSource"));
|
|
9
6
|
const compressJson_1 = __importDefault(require("../compressJson"));
|
|
7
|
+
const querystring_1 = __importDefault(require("querystring"));
|
|
10
8
|
/** Uses mWater server to get datagrid data to allow sharing with unprivileged users */
|
|
11
|
-
class ServerDatagridDataSource
|
|
9
|
+
class ServerDatagridDataSource {
|
|
12
10
|
options;
|
|
13
11
|
// options:
|
|
14
12
|
// apiUrl: API url to use for talking to mWater server
|
|
@@ -17,43 +15,80 @@ class ServerDatagridDataSource extends DatagridDataSource_1.default {
|
|
|
17
15
|
// datagridId: datagrid id to use on server
|
|
18
16
|
// rev: revision to use to allow caching
|
|
19
17
|
constructor(options) {
|
|
20
|
-
super();
|
|
21
18
|
this.options = options;
|
|
22
19
|
}
|
|
23
20
|
// Get the data that the widget needs. The widget should implement getData method (see above) to get the data from the server
|
|
24
21
|
// design: design of the widget. Ignored in the case of server-side rendering
|
|
25
22
|
// filters: array of filters to apply. Each is { table: table id, jsonql: jsonql condition with {alias} for tableAlias. Use injectAlias to correct
|
|
26
|
-
getRows(design, offset, limit, filters, callback) {
|
|
23
|
+
async getRows(design, offset, limit, filters, callback) {
|
|
27
24
|
const query = {
|
|
28
25
|
client: this.options.client,
|
|
29
26
|
share: this.options.share,
|
|
30
|
-
filters: (0, compressJson_1.default)(filters),
|
|
31
27
|
rev: this.options.rev,
|
|
32
28
|
offset,
|
|
33
29
|
limit
|
|
34
30
|
};
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
const filtersJson = JSON.stringify(filters);
|
|
32
|
+
const baseUrl = this.options.apiUrl + `datagrids/${this.options.datagridId}/data`;
|
|
33
|
+
try {
|
|
34
|
+
let response;
|
|
35
|
+
// If the filters are too large, we need to send them in the body
|
|
36
|
+
if (filtersJson.length > 5000) {
|
|
37
|
+
response = await fetch(baseUrl + '?' + querystring_1.default.stringify(query), {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
headers: { 'Content-Type': 'application/json' },
|
|
40
|
+
body: JSON.stringify({ filters: (0, compressJson_1.default)(filters) }),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
query.filters = (0, compressJson_1.default)(filters);
|
|
45
|
+
const url = baseUrl + '?' + querystring_1.default.stringify(query);
|
|
46
|
+
response = await fetch(url);
|
|
47
|
+
}
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
50
|
+
}
|
|
51
|
+
const data = await response.json();
|
|
52
|
+
callback(null, data);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.error(error);
|
|
56
|
+
callback(error);
|
|
57
|
+
}
|
|
42
58
|
}
|
|
43
|
-
countRows(design, filters, callback) {
|
|
59
|
+
async countRows(design, filters, callback) {
|
|
44
60
|
const query = {
|
|
45
61
|
client: this.options.client,
|
|
46
62
|
share: this.options.share,
|
|
47
|
-
|
|
48
|
-
rev: this.options.rev,
|
|
63
|
+
rev: this.options.rev
|
|
49
64
|
};
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
const filtersJson = JSON.stringify(filters);
|
|
66
|
+
const baseUrl = this.options.apiUrl + `datagrids/${this.options.datagridId}/summary`;
|
|
67
|
+
try {
|
|
68
|
+
let response;
|
|
69
|
+
// If the filters are too large, we need to send them in the body
|
|
70
|
+
if (filtersJson.length > 5000) {
|
|
71
|
+
response = await fetch(baseUrl + '?' + querystring_1.default.stringify(query), {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: { 'Content-Type': 'application/json' },
|
|
74
|
+
body: JSON.stringify({ filters: (0, compressJson_1.default)(filters) }),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
query.filters = (0, compressJson_1.default)(filters);
|
|
79
|
+
const url = baseUrl + '?' + querystring_1.default.stringify(query);
|
|
80
|
+
response = await fetch(url);
|
|
81
|
+
}
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
84
|
+
}
|
|
85
|
+
const data = await response.json();
|
|
86
|
+
callback(null, data?.[0]?.cnt);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error(error);
|
|
90
|
+
callback(error);
|
|
91
|
+
}
|
|
57
92
|
}
|
|
58
93
|
getQuickfiltersDataSource() {
|
|
59
94
|
return new ServerQuickfilterDataSource(this.options);
|
|
@@ -72,23 +107,40 @@ class ServerQuickfilterDataSource {
|
|
|
72
107
|
this.options = options;
|
|
73
108
|
}
|
|
74
109
|
// Gets the values of the quickfilter at index
|
|
75
|
-
getValues(index, expr, filters, offset, limit, callback) {
|
|
110
|
+
async getValues(index, expr, filters, offset, limit, callback) {
|
|
76
111
|
const query = {
|
|
77
112
|
client: this.options.client,
|
|
78
113
|
share: this.options.share,
|
|
79
|
-
|
|
80
|
-
offset,
|
|
114
|
+
offset: offset ?? 0,
|
|
81
115
|
limit,
|
|
82
116
|
rev: this.options.rev
|
|
83
117
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
118
|
+
try {
|
|
119
|
+
let response;
|
|
120
|
+
const url = this.options.apiUrl + `datagrids/${this.options.datagridId}/quickfilters/${index}/values`;
|
|
121
|
+
const filtersJson = JSON.stringify(filters);
|
|
122
|
+
// If the filters are too large, we need to send them in the body
|
|
123
|
+
if (filtersJson.length > 5000) {
|
|
124
|
+
query.filters = (0, compressJson_1.default)(filters);
|
|
125
|
+
response = await fetch(url + '?' + querystring_1.default.stringify(query), {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: { 'Content-Type': 'application/json' },
|
|
128
|
+
body: JSON.stringify({ filters: (0, compressJson_1.default)(filters) }),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
query.filters = filtersJson;
|
|
133
|
+
response = await fetch(url + '?' + querystring_1.default.stringify(query));
|
|
134
|
+
}
|
|
135
|
+
if (!response.ok) {
|
|
136
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
137
|
+
}
|
|
138
|
+
const data = await response.json();
|
|
139
|
+
callback(null, data);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.error(error);
|
|
143
|
+
callback(error);
|
|
144
|
+
}
|
|
93
145
|
}
|
|
94
146
|
}
|
package/lib/demo.js
CHANGED
|
@@ -53,14 +53,14 @@ global.T = ez_localize_1.defaultT;
|
|
|
53
53
|
// Set demo key
|
|
54
54
|
(0, vectorMaps_1.setMapTilerApiKey)("cNNyJl2nwIIKEUYSeXYc");
|
|
55
55
|
(0, jquery_1.default)(function () {
|
|
56
|
-
const sample = R(react_dnd_1.DragDropContextProvider, { backend: react_dnd_html5_backend_1.default }, R("div", { className: "container-fluid", style: { height: "100%", paddingLeft: 0, paddingRight: 0 } }, R("style", null, "html, body, #main { height: 100% }"), R(
|
|
56
|
+
const sample = R(react_dnd_1.DragDropContextProvider, { backend: react_dnd_html5_backend_1.default }, R("div", { className: "container-fluid", style: { height: "100%", paddingLeft: 0, paddingRight: 0 } }, R("style", null, "html, body, #main { height: 100% }"), R(MWaterDirectDashboardPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
57
|
+
//R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "38d803820a7a4bf5a1d5ef19cf8c64f3"})
|
|
58
|
+
// R(MWaterDirectMapPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
57
59
|
// R(RichTextPane)
|
|
58
60
|
// R(MWaterMapPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1)})
|
|
59
61
|
// R(TestPane, apiUrl: "https://api.mwater.co/v3/")
|
|
60
62
|
// R(MWaterDashboardPane, apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "a855eb0587d845d3ac27aed03c463976", share: "817c76088c7649ec8cc0b8193e547a09")
|
|
61
63
|
// R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "f99f206ddd4442a981761b8342c58058"})
|
|
62
|
-
// R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "38d803820a7a4bf5a1d5ef19cf8c64f3"})
|
|
63
|
-
// R(MWaterDirectDashboardPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
64
64
|
//R(MWaterDirectDashboardPane, { apiUrl: "http://localhost:1234/v3/", client: window.location.hash.substr(1) })
|
|
65
65
|
//R(MWaterDatagridPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
66
66
|
// R(MWaterDirectMapPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
|
|
@@ -389,7 +389,7 @@ class WaterOrgDashboardPane extends react_1.default.Component {
|
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
391
|
componentWillMount() {
|
|
392
|
-
const url = this.props.apiUrl + "
|
|
392
|
+
const url = this.props.apiUrl + "schema";
|
|
393
393
|
return jquery_1.default.getJSON(url, (schemaJson) => {
|
|
394
394
|
const schema = new expressions_1.Schema(schemaJson);
|
|
395
395
|
const dataSource = new MWaterDataSource_1.default(this.props.apiUrl, null, { serverCaching: false, localCaching: true });
|
package/lib/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/lib/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { languages } from "./languages";
|
|
|
20
20
|
export { default as MWaterLoaderComponent } from "./MWaterLoaderComponent";
|
|
21
21
|
export { default as MWaterContextComponent } from "./MWaterContextComponent";
|
|
22
22
|
export { default as mWaterLoader } from "./mWaterLoader";
|
|
23
|
+
export { WidgetDataSource } from "./widgets/WidgetDataSource";
|
|
23
24
|
export { default as DirectWidgetDataSource } from "./widgets/DirectWidgetDataSource";
|
|
24
25
|
import "leaflet/dist/leaflet.css";
|
|
25
26
|
import "fixed-data-table-2/dist/fixed-data-table.min.css";
|
|
@@ -28,7 +29,6 @@ import "./layouts/decorated-block.css";
|
|
|
28
29
|
import "react-datepicker/dist/react-datepicker.css";
|
|
29
30
|
import "billboard.js/dist/billboard.css";
|
|
30
31
|
import "./index.css";
|
|
31
|
-
import "./layout-styles.css";
|
|
32
32
|
export { setMapTilerApiKey } from "./maps/vectorMaps";
|
|
33
33
|
export { default as UndoStack } from "./UndoStack";
|
|
34
34
|
export { default as DashboardViewComponent } from "./dashboards/DashboardViewComponent";
|
|
@@ -51,6 +51,7 @@ export { default as AxisBuilder } from "./axes/AxisBuilder";
|
|
|
51
51
|
export { default as ColorSchemeFactory } from "./ColorSchemeFactory";
|
|
52
52
|
export { default as DatagridComponent } from "./datagrids/DatagridComponent";
|
|
53
53
|
export { default as DatagridViewComponent } from "./datagrids/DatagridViewComponent";
|
|
54
|
+
export { default as DatagridDataSource } from "./datagrids/DatagridDataSource";
|
|
54
55
|
export { default as ServerDashboardDataSource } from "./dashboards/ServerDashboardDataSource";
|
|
55
56
|
export { default as ServerMapDataSource } from "./maps/ServerMapDataSource";
|
|
56
57
|
export { default as DirectMapDataSource } from "./maps/DirectMapDataSource";
|
package/lib/index.js
CHANGED
|
@@ -63,7 +63,6 @@ require("./layouts/decorated-block.css");
|
|
|
63
63
|
require("react-datepicker/dist/react-datepicker.css");
|
|
64
64
|
require("billboard.js/dist/billboard.css");
|
|
65
65
|
require("./index.css");
|
|
66
|
-
require("./layout-styles.css");
|
|
67
66
|
var vectorMaps_1 = require("./maps/vectorMaps");
|
|
68
67
|
Object.defineProperty(exports, "setMapTilerApiKey", { enumerable: true, get: function () { return vectorMaps_1.setMapTilerApiKey; } });
|
|
69
68
|
var UndoStack_1 = require("./UndoStack");
|