@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,37 +1,41 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { BlocksLayoutOptions } from "../dashboards/layoutOptions";
|
|
3
|
+
/** Options for rendering a widget */
|
|
4
|
+
export interface RenderWidgetOptions {
|
|
5
|
+
id: string;
|
|
6
|
+
type: string;
|
|
7
|
+
design: any;
|
|
8
|
+
onDesignChange?: (design: any) => void;
|
|
9
|
+
width: number;
|
|
10
|
+
/** height of widget. If not specified, is auto height */
|
|
11
|
+
height?: number;
|
|
12
|
+
/** Priority of widget. Higher priority widgets are rendered first */
|
|
13
|
+
priority?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface RenderLayoutOptions {
|
|
16
|
+
/** width of layout */
|
|
17
|
+
width?: number;
|
|
18
|
+
/** opaque items object that layout manager understands */
|
|
19
|
+
items: any;
|
|
20
|
+
/** Called when items changes */
|
|
21
|
+
onItemsChange?: (items: any) => void;
|
|
22
|
+
/** called with ({ id:, type:, design:, onDesignChange:, width:, height: }) */
|
|
23
|
+
renderWidget: (options: RenderWidgetOptions) => ReactElement;
|
|
24
|
+
/** layout options to use */
|
|
25
|
+
layoutOptions: BlocksLayoutOptions;
|
|
26
|
+
/** true to disable maps */
|
|
27
|
+
disableMaps?: boolean;
|
|
28
|
+
/** clipboard contents */
|
|
29
|
+
clipboard?: any;
|
|
30
|
+
/** called when clipboard is changed */
|
|
31
|
+
onClipboardChange?: (clipboard: any) => void;
|
|
32
|
+
/** message to display if clipboard can't be pasted into current dashboard */
|
|
33
|
+
cantPasteMessage?: string;
|
|
34
|
+
}
|
|
3
35
|
/** Responsible for laying out items, rendering widgets and holding them in a data structure that is layout manager specific */
|
|
4
36
|
export default class LayoutManager {
|
|
5
37
|
/** Renders the layout as a react element */
|
|
6
|
-
renderLayout(options:
|
|
7
|
-
/** width of layout */
|
|
8
|
-
width?: number;
|
|
9
|
-
/** opaque items object that layout manager understands */
|
|
10
|
-
items: any;
|
|
11
|
-
/** Called when items changes */
|
|
12
|
-
onItemsChange?: (items: any) => void;
|
|
13
|
-
/** called with ({ id:, type:, design:, onDesignChange:, width:, height: }) */
|
|
14
|
-
renderWidget: (options: {
|
|
15
|
-
id: string;
|
|
16
|
-
type: string;
|
|
17
|
-
design: any;
|
|
18
|
-
onDesignChange: (design: any) => void;
|
|
19
|
-
width: number;
|
|
20
|
-
height: number;
|
|
21
|
-
}) => ReactElement;
|
|
22
|
-
/** style to use for layout. null for default */
|
|
23
|
-
style: string | null;
|
|
24
|
-
/** layout options to use */
|
|
25
|
-
layoutOptions: BlocksLayoutOptions | null;
|
|
26
|
-
/** true to disable maps */
|
|
27
|
-
disableMaps?: boolean;
|
|
28
|
-
/** clipboard contents */
|
|
29
|
-
clipboard: any;
|
|
30
|
-
/** called when clipboard is changed */
|
|
31
|
-
onClipboardChange: (clipboard: any) => void;
|
|
32
|
-
/** message to display if clipboard can't be pasted into current dashboard */
|
|
33
|
-
cantPasteMessage: string;
|
|
34
|
-
}): ReactNode;
|
|
38
|
+
renderLayout(options: RenderLayoutOptions): ReactNode;
|
|
35
39
|
/** Tests if dashboard has any items */
|
|
36
40
|
isEmpty(items: any): boolean;
|
|
37
41
|
/** Gets { type, design } of a widget */
|
|
@@ -19,17 +19,11 @@ class LayoutManager {
|
|
|
19
19
|
return [];
|
|
20
20
|
}
|
|
21
21
|
static createLayoutManager(type) {
|
|
22
|
-
|
|
23
|
-
type = type || "grid";
|
|
22
|
+
type = type || "blocks";
|
|
24
23
|
switch (type) {
|
|
25
|
-
case "
|
|
26
|
-
var GridLayoutManager = require("./grid/GridLayoutManager").default;
|
|
27
|
-
return new GridLayoutManager();
|
|
28
|
-
break;
|
|
29
|
-
case "blocks": // New one
|
|
24
|
+
case "blocks":
|
|
30
25
|
var BlocksLayoutManager = require("./blocks/BlocksLayoutManager").default;
|
|
31
26
|
return new BlocksLayoutManager();
|
|
32
|
-
break;
|
|
33
27
|
default:
|
|
34
28
|
throw new Error(`Unknown layout manager type ${type}`);
|
|
35
29
|
}
|
|
@@ -1,75 +1,45 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import { DashboardTheme } from "../../dashboards/layoutOptions";
|
|
3
3
|
import { LayoutBlock } from "./blockUtils";
|
|
4
|
+
import { RenderWidgetOptions } from "../LayoutManager";
|
|
4
5
|
export interface BlocksDisplayComponentProps {
|
|
5
6
|
items: LayoutBlock;
|
|
6
7
|
onItemsChange?: (items: LayoutBlock) => void;
|
|
7
8
|
/** Stylesheet to use. null for default */
|
|
8
|
-
style?:
|
|
9
|
+
style?: DashboardTheme;
|
|
9
10
|
/** layout options to use */
|
|
10
11
|
layoutOptions?: any;
|
|
11
12
|
/** Renders a widget. Passed (options) */
|
|
12
|
-
renderWidget:
|
|
13
|
+
renderWidget: (options: RenderWidgetOptions) => ReactElement;
|
|
13
14
|
/** True to prevent maps */
|
|
14
15
|
disableMaps?: boolean;
|
|
15
|
-
/**
|
|
16
|
+
/** clipboard contents */
|
|
16
17
|
clipboard?: any;
|
|
17
|
-
onClipboardChange
|
|
18
|
+
/** Including onClipboardChange adds a clipboard palette item that can be used to copy and paste widgets */
|
|
19
|
+
onClipboardChange?: (clipboard: any) => void;
|
|
20
|
+
/** message to display if clipboard can't be pasted into current dashboard */
|
|
18
21
|
cantPasteMessage?: string;
|
|
19
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
Renders the complete layout of the blocks and also optionally a palette to the left
|
|
25
|
+
that can be used to drag new items into the layout. Palette is only displayed if onItemsChange is not null
|
|
26
|
+
*/
|
|
20
27
|
declare class BlocksDisplayComponent extends React.Component<BlocksDisplayComponentProps> {
|
|
21
|
-
handleBlockDrop: (sourceBlock:
|
|
22
|
-
handleBlockRemove: (block:
|
|
23
|
-
handleBlockUpdate: (block:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
handleBlockDrop: (sourceBlock: LayoutBlock, targetBlock: LayoutBlock, side: "top" | "left" | "right" | "bottom") => void;
|
|
29
|
+
handleBlockRemove: (block: LayoutBlock) => void;
|
|
30
|
+
handleBlockUpdate: (block: LayoutBlock) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Render a single block (and its children)
|
|
33
|
+
* @param block Block to render
|
|
34
|
+
* @param collapseColumns True to collapse columns
|
|
35
|
+
* @param priority Priority of widget. Higher priority widgets are rendered first
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
renderBlock: (block: LayoutBlock, collapseColumns: boolean, priority: number) => ReactElement;
|
|
28
39
|
createBlockItem(block: any): () => {
|
|
29
40
|
block: {};
|
|
30
41
|
};
|
|
31
|
-
renderPalette(): React.
|
|
32
|
-
|
|
33
|
-
style: {
|
|
34
|
-
width: number;
|
|
35
|
-
height: string;
|
|
36
|
-
position: "absolute";
|
|
37
|
-
top: number;
|
|
38
|
-
left: number;
|
|
39
|
-
};
|
|
40
|
-
}, HTMLElement>;
|
|
41
|
-
render(): React.CElement<any, React.Component<any, any, any>> | React.DetailedReactHTMLElement<{
|
|
42
|
-
style: {
|
|
43
|
-
width: string;
|
|
44
|
-
height: string;
|
|
45
|
-
overflow: "hidden";
|
|
46
|
-
position: "relative";
|
|
47
|
-
};
|
|
48
|
-
}, HTMLElement>;
|
|
42
|
+
renderPalette(): React.JSX.Element;
|
|
43
|
+
render(): React.JSX.Element;
|
|
49
44
|
}
|
|
50
45
|
export default BlocksDisplayComponent;
|
|
51
|
-
interface RootBlockComponentProps {
|
|
52
|
-
block: any;
|
|
53
|
-
collapseColumns?: boolean;
|
|
54
|
-
renderBlock: any;
|
|
55
|
-
/** Called with (sourceBlock, targetBlock, side) when block is dropped on it. side is top, left, bottom, right */
|
|
56
|
-
onBlockDrop?: any;
|
|
57
|
-
onBlockRemove?: any;
|
|
58
|
-
}
|
|
59
|
-
declare class RootBlockComponent extends React.Component<RootBlockComponentProps> {
|
|
60
|
-
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | React.CElement<{
|
|
61
|
-
block: any;
|
|
62
|
-
onBlockDrop: any;
|
|
63
|
-
style: {
|
|
64
|
-
height: string;
|
|
65
|
-
};
|
|
66
|
-
onlyBottom: boolean;
|
|
67
|
-
}, React.Component<{
|
|
68
|
-
block: any;
|
|
69
|
-
onBlockDrop: any;
|
|
70
|
-
style: {
|
|
71
|
-
height: string;
|
|
72
|
-
};
|
|
73
|
-
onlyBottom: boolean;
|
|
74
|
-
}, any, any>>;
|
|
75
|
-
}
|
|
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
30
30
|
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const R = react_1.default.createElement;
|
|
32
31
|
const uuid_1 = __importDefault(require("uuid"));
|
|
33
32
|
const DraggableBlockComponent_1 = __importDefault(require("./DraggableBlockComponent"));
|
|
34
33
|
const DecoratedBlockComponent_1 = __importDefault(require("../DecoratedBlockComponent"));
|
|
@@ -38,9 +37,9 @@ const blockUtils = __importStar(require("./blockUtils"));
|
|
|
38
37
|
const AutoSizeComponent_1 = __importDefault(require("@mwater/react-library/lib/AutoSizeComponent"));
|
|
39
38
|
const HorizontalBlockComponent_1 = __importDefault(require("./HorizontalBlockComponent"));
|
|
40
39
|
const layoutOptions_1 = require("../../dashboards/layoutOptions");
|
|
41
|
-
|
|
42
|
-
Renders the complete layout of the blocks and also optionally a palette to the left
|
|
43
|
-
that can be used to drag new items into the layout. Palette is only displayed if onItemsChange is not null
|
|
40
|
+
/**
|
|
41
|
+
Renders the complete layout of the blocks and also optionally a palette to the left
|
|
42
|
+
that can be used to drag new items into the layout. Palette is only displayed if onItemsChange is not null
|
|
44
43
|
*/
|
|
45
44
|
class BlocksDisplayComponent extends react_1.default.Component {
|
|
46
45
|
handleBlockDrop = (sourceBlock, targetBlock, side) => {
|
|
@@ -62,98 +61,58 @@ class BlocksDisplayComponent extends react_1.default.Component {
|
|
|
62
61
|
items = blockUtils.cleanBlock(items);
|
|
63
62
|
return this.props.onItemsChange(items);
|
|
64
63
|
};
|
|
65
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Render a single block (and its children)
|
|
66
|
+
* @param block Block to render
|
|
67
|
+
* @param collapseColumns True to collapse columns
|
|
68
|
+
* @param priority Priority of widget. Higher priority widgets are rendered first
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
renderBlock = (block, collapseColumns, priority) => {
|
|
66
72
|
let elem = null;
|
|
67
73
|
switch (block.type) {
|
|
68
74
|
case "root":
|
|
69
|
-
return
|
|
70
|
-
key: block.id,
|
|
71
|
-
block,
|
|
72
|
-
collapseColumns,
|
|
73
|
-
renderBlock: this.renderBlock,
|
|
74
|
-
onBlockDrop: this.props.onItemsChange != null ? this.handleBlockDrop : undefined,
|
|
75
|
-
onBlockRemove: this.props.onItemsChange != null ? this.handleBlockRemove : undefined
|
|
76
|
-
});
|
|
77
|
-
break;
|
|
75
|
+
return react_1.default.createElement(RootBlockComponent, { key: block.id, block: block, collapseColumns: collapseColumns, renderBlock: this.renderBlock, onBlockDrop: this.props.onItemsChange != null ? this.handleBlockDrop : undefined, onBlockRemove: this.props.onItemsChange != null ? this.handleBlockRemove : undefined, priority: priority });
|
|
78
76
|
case "vertical":
|
|
79
|
-
return
|
|
80
|
-
key: block.id,
|
|
81
|
-
block,
|
|
82
|
-
collapseColumns,
|
|
83
|
-
renderBlock: this.renderBlock,
|
|
84
|
-
onBlockDrop: this.props.onItemsChange != null ? this.handleBlockDrop : undefined,
|
|
85
|
-
onBlockRemove: this.props.onItemsChange != null ? this.handleBlockRemove : undefined
|
|
86
|
-
});
|
|
87
|
-
break;
|
|
77
|
+
return react_1.default.createElement(VerticalBlockComponent, { key: block.id, block: block, collapseColumns: collapseColumns, renderBlock: this.renderBlock, onBlockDrop: this.props.onItemsChange != null ? this.handleBlockDrop : undefined, onBlockRemove: this.props.onItemsChange != null ? this.handleBlockRemove : undefined, priority: priority });
|
|
88
78
|
case "horizontal":
|
|
89
|
-
return
|
|
90
|
-
key: block.id,
|
|
91
|
-
block,
|
|
92
|
-
collapseColumns,
|
|
93
|
-
renderBlock: this.renderBlock,
|
|
94
|
-
onBlockDrop: this.props.onItemsChange != null ? this.handleBlockDrop : undefined,
|
|
95
|
-
onBlockRemove: this.props.onItemsChange != null ? this.handleBlockRemove : undefined,
|
|
96
|
-
onBlockUpdate: this.props.onItemsChange != null ? this.handleBlockUpdate : undefined
|
|
97
|
-
});
|
|
98
|
-
break;
|
|
79
|
+
return react_1.default.createElement(HorizontalBlockComponent_1.default, { key: block.id, block: block, collapseColumns: collapseColumns, renderBlock: this.renderBlock, onBlockDrop: this.props.onItemsChange != null ? this.handleBlockDrop : undefined, onBlockRemove: this.props.onItemsChange != null ? this.handleBlockRemove : undefined, priority: priority, onBlockUpdate: this.props.onItemsChange != null ? this.handleBlockUpdate : undefined });
|
|
99
80
|
case "spacer":
|
|
100
|
-
elem =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
width: size.width,
|
|
105
|
-
height: block.aspectRatio != null ? size.width / block.aspectRatio : undefined
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
});
|
|
81
|
+
elem = react_1.default.createElement(AutoSizeComponent_1.default, { injectWidth: true, key: block.id }, (size) => (react_1.default.createElement("div", { id: block.id, style: {
|
|
82
|
+
width: size.width,
|
|
83
|
+
height: block.aspectRatio != null ? size.width / block.aspectRatio : undefined
|
|
84
|
+
} })));
|
|
109
85
|
if (this.props.onItemsChange) {
|
|
110
|
-
elem =
|
|
111
|
-
key: block.id,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}, R(DecoratedBlockComponent_1.default, {
|
|
115
|
-
key: block.id,
|
|
116
|
-
aspectRatio: block.aspectRatio,
|
|
117
|
-
onAspectRatioChange: block.aspectRatio != null
|
|
118
|
-
? (aspectRatio) => this.props.onItemsChange(blockUtils.updateBlock(this.props.items, lodash_1.default.extend({}, block, { aspectRatio })))
|
|
119
|
-
: undefined,
|
|
120
|
-
onBlockRemove: this.props.onItemsChange != null ? this.handleBlockDrop.bind(null, block) : undefined
|
|
121
|
-
}, elem));
|
|
86
|
+
elem = (react_1.default.createElement(DraggableBlockComponent_1.default, { key: block.id, block: block, onBlockDrop: this.handleBlockDrop },
|
|
87
|
+
react_1.default.createElement(DecoratedBlockComponent_1.default, { key: block.id, isDragging: false, aspectRatio: block.aspectRatio, onAspectRatioChange: block.aspectRatio != null
|
|
88
|
+
? (aspectRatio) => this.props.onItemsChange(blockUtils.updateBlock(this.props.items, lodash_1.default.extend({}, block, { aspectRatio })))
|
|
89
|
+
: undefined, onBlockRemove: this.props.onItemsChange != null ? this.handleBlockDrop.bind(null, block) : undefined }, elem)));
|
|
122
90
|
}
|
|
123
91
|
break;
|
|
124
92
|
case "widget":
|
|
125
|
-
elem =
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
93
|
+
elem = react_1.default.createElement(AutoSizeComponent_1.default, { injectWidth: true, key: block.id }, (size) => this.props.renderWidget({
|
|
94
|
+
id: block.id,
|
|
95
|
+
type: block.widgetType,
|
|
96
|
+
design: block.design,
|
|
97
|
+
onDesignChange: this.props.onItemsChange
|
|
98
|
+
? (design) => this.props.onItemsChange(blockUtils.updateBlock(this.props.items, lodash_1.default.extend({}, block, { design })))
|
|
99
|
+
: undefined,
|
|
100
|
+
width: size.width,
|
|
101
|
+
height: block.aspectRatio != null ? size.width / block.aspectRatio : undefined,
|
|
102
|
+
priority
|
|
103
|
+
}));
|
|
137
104
|
if (this.props.onItemsChange) {
|
|
138
|
-
elem =
|
|
139
|
-
key: block.id,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}, R(DecoratedBlockComponent_1.default, {
|
|
143
|
-
key: block.id,
|
|
144
|
-
aspectRatio: block.aspectRatio,
|
|
145
|
-
onAspectRatioChange: block.aspectRatio != null
|
|
146
|
-
? (aspectRatio) => this.props.onItemsChange(blockUtils.updateBlock(this.props.items, lodash_1.default.extend({}, block, { aspectRatio })))
|
|
147
|
-
: undefined,
|
|
148
|
-
onBlockRemove: this.props.onItemsChange != null ? this.handleBlockDrop.bind(null, block) : undefined
|
|
149
|
-
}, elem));
|
|
105
|
+
elem = (react_1.default.createElement(DraggableBlockComponent_1.default, { key: block.id, block: block, onBlockDrop: this.handleBlockDrop },
|
|
106
|
+
react_1.default.createElement(DecoratedBlockComponent_1.default, { key: block.id, isDragging: false, aspectRatio: block.aspectRatio, onAspectRatioChange: block.aspectRatio != null
|
|
107
|
+
? (aspectRatio) => this.props.onItemsChange(blockUtils.updateBlock(this.props.items, lodash_1.default.extend({}, block, { aspectRatio })))
|
|
108
|
+
: undefined, onBlockRemove: this.props.onItemsChange != null ? this.handleBlockDrop.bind(null, block) : undefined }, elem)));
|
|
150
109
|
}
|
|
151
110
|
break;
|
|
152
111
|
default:
|
|
153
112
|
throw new Error(`Unknown block type ${block.type}`);
|
|
154
113
|
}
|
|
155
114
|
// Wrap block in padding
|
|
156
|
-
return
|
|
115
|
+
return (react_1.default.createElement("div", { key: block.id, className: `mwater-visualization-block mwater-visualization-block-${block.type}` }, elem));
|
|
157
116
|
};
|
|
158
117
|
createBlockItem(block) {
|
|
159
118
|
// Add unique id
|
|
@@ -162,101 +121,55 @@ class BlocksDisplayComponent extends react_1.default.Component {
|
|
|
162
121
|
});
|
|
163
122
|
}
|
|
164
123
|
renderPalette() {
|
|
165
|
-
return
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
createItem: this.createBlockItem({
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}), R(PaletteItemComponent_1.default, {
|
|
215
|
-
createItem: this.createBlockItem({
|
|
216
|
-
type: "widget",
|
|
217
|
-
aspectRatio: 1.4,
|
|
218
|
-
widgetType: "CalendarChart",
|
|
219
|
-
design: {}
|
|
220
|
-
}),
|
|
221
|
-
title: R("i", { className: "fa fa-calendar" }),
|
|
222
|
-
subtitle: "Calendar"
|
|
223
|
-
}), R(PaletteItemComponent_1.default, {
|
|
224
|
-
createItem: this.createBlockItem({
|
|
225
|
-
type: "widget",
|
|
226
|
-
aspectRatio: 1.4,
|
|
227
|
-
widgetType: "ImageMosaicChart",
|
|
228
|
-
design: {}
|
|
229
|
-
}),
|
|
230
|
-
title: R("i", { className: "fa fa-th" }),
|
|
231
|
-
subtitle: "Mosaic"
|
|
232
|
-
}), R(PaletteItemComponent_1.default, {
|
|
233
|
-
createItem: this.createBlockItem({ type: "spacer", aspectRatio: 2 }),
|
|
234
|
-
title: R("i", { className: "fa fa-square-o" }),
|
|
235
|
-
subtitle: "Spacer"
|
|
236
|
-
}), R(PaletteItemComponent_1.default, {
|
|
237
|
-
createItem: this.createBlockItem({
|
|
238
|
-
type: "widget",
|
|
239
|
-
aspectRatio: 16.0 / 9.0,
|
|
240
|
-
widgetType: "IFrame",
|
|
241
|
-
design: {}
|
|
242
|
-
}),
|
|
243
|
-
title: R("i", { className: "fa fa-youtube-play" }),
|
|
244
|
-
subtitle: "Video"
|
|
245
|
-
}), R(PaletteItemComponent_1.default, {
|
|
246
|
-
createItem: this.createBlockItem({
|
|
247
|
-
type: "widget",
|
|
248
|
-
widgetType: "TOC",
|
|
249
|
-
design: { numbering: false, borderWeight: 2, header: "Contents" }
|
|
250
|
-
}),
|
|
251
|
-
title: R("i", { className: "fa fa-list-ol" }),
|
|
252
|
-
subtitle: "TOC"
|
|
253
|
-
}), this.props.onClipboardChange
|
|
254
|
-
? R(ClipboardPaletteItemComponent_1.default, {
|
|
255
|
-
clipboard: this.props.clipboard,
|
|
256
|
-
onClipboardChange: this.props.onClipboardChange,
|
|
257
|
-
cantPasteMessage: this.props.cantPasteMessage
|
|
258
|
-
})
|
|
259
|
-
: undefined));
|
|
124
|
+
return (react_1.default.createElement("div", { key: "palette", style: { width: 141, height: "100%", position: "absolute", top: 0, left: 0 } },
|
|
125
|
+
react_1.default.createElement("div", { className: "mwater-visualization-palette", style: { height: "100%" } },
|
|
126
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({ type: "widget", widgetType: "Text", design: { style: "title" } }), title: react_1.default.createElement("i", { className: "fa fa-font" }), subtitle: "Title" }),
|
|
127
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({ type: "widget", widgetType: "Text", design: {} }), title: react_1.default.createElement("i", { className: "fa fa-align-left" }), subtitle: "Text" }),
|
|
128
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({ type: "widget", aspectRatio: 1.4, widgetType: "Image", design: {} }), title: react_1.default.createElement("i", { className: "fa fa-picture-o" }), subtitle: "Image" }),
|
|
129
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({
|
|
130
|
+
type: "widget",
|
|
131
|
+
aspectRatio: 1.4,
|
|
132
|
+
widgetType: "LayeredChart",
|
|
133
|
+
design: {}
|
|
134
|
+
}), title: react_1.default.createElement("i", { className: "fa fa-bar-chart" }), subtitle: "Chart" }),
|
|
135
|
+
!this.props.disableMaps && (react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({
|
|
136
|
+
type: "widget",
|
|
137
|
+
aspectRatio: 2,
|
|
138
|
+
widgetType: "Map",
|
|
139
|
+
design: {
|
|
140
|
+
baseLayer: "bing_road",
|
|
141
|
+
layerViews: [],
|
|
142
|
+
filters: {},
|
|
143
|
+
bounds: { w: -40, n: 25, e: 40, s: -25 }
|
|
144
|
+
}
|
|
145
|
+
}), title: react_1.default.createElement("i", { className: "fa fa-map-o" }), subtitle: "Map" })),
|
|
146
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({ type: "widget", aspectRatio: 1.4, widgetType: "TableChart", design: {} }), title: react_1.default.createElement("i", { className: "fa fa-table" }), subtitle: "Table" }),
|
|
147
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({ type: "widget", widgetType: "PivotChart", design: {} }), title: react_1.default.createElement("img", { width: 24, height: 24, src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAb0lEQVRIx91VQQrAIAwzo/7/ydllG0MQS21EzMW2ICFtoyBZlLDn/LOgySPAG1xFDDmBtZI6efoMvODozkyL2IlTCOisfS2KrqG0RXus6fkEVBIw08khE62aQY0ogMdEswqwYouwvQ8s+4M576m4Ae/tET/u1taEAAAAAElFTkSuQmCC" }), subtitle: "Pivot" }),
|
|
148
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({
|
|
149
|
+
type: "widget",
|
|
150
|
+
aspectRatio: 1.4,
|
|
151
|
+
widgetType: "CalendarChart",
|
|
152
|
+
design: {}
|
|
153
|
+
}), title: react_1.default.createElement("i", { className: "fa fa-calendar" }), subtitle: "Calendar" }),
|
|
154
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({
|
|
155
|
+
type: "widget",
|
|
156
|
+
aspectRatio: 1.4,
|
|
157
|
+
widgetType: "ImageMosaicChart",
|
|
158
|
+
design: {}
|
|
159
|
+
}), title: react_1.default.createElement("i", { className: "fa fa-th" }), subtitle: "Mosaic" }),
|
|
160
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({ type: "spacer", aspectRatio: 2 }), title: react_1.default.createElement("i", { className: "fa fa-square-o" }), subtitle: "Spacer" }),
|
|
161
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({
|
|
162
|
+
type: "widget",
|
|
163
|
+
aspectRatio: 16.0 / 9.0,
|
|
164
|
+
widgetType: "IFrame",
|
|
165
|
+
design: {}
|
|
166
|
+
}), title: react_1.default.createElement("i", { className: "fa fa-youtube-play" }), subtitle: "Video" }),
|
|
167
|
+
react_1.default.createElement(PaletteItemComponent_1.default, { createItem: this.createBlockItem({
|
|
168
|
+
type: "widget",
|
|
169
|
+
widgetType: "TOC",
|
|
170
|
+
design: { numbering: false, borderWeight: 2, header: "Contents" }
|
|
171
|
+
}), title: react_1.default.createElement("i", { className: "fa fa-list-ol" }), subtitle: "TOC" }),
|
|
172
|
+
this.props.onClipboardChange && (react_1.default.createElement(ClipboardPaletteItemComponent_1.default, { clipboard: this.props.clipboard, onClipboardChange: this.props.onClipboardChange, cantPasteMessage: this.props.cantPasteMessage })))));
|
|
260
173
|
}
|
|
261
174
|
render() {
|
|
262
175
|
let innerParentStyle;
|
|
@@ -264,18 +177,27 @@ class BlocksDisplayComponent extends react_1.default.Component {
|
|
|
264
177
|
if (this.props.onItemsChange) {
|
|
265
178
|
innerParentStyle = {};
|
|
266
179
|
innerParentStyle.maxWidth = layoutOptions.maximumWidth || undefined;
|
|
267
|
-
return
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
180
|
+
return (react_1.default.createElement(layoutOptions_1.DashboardStyleWrapper, { style: { width: "100%", height: "100%", overflow: "hidden", position: "relative" }, layoutOptions: layoutOptions },
|
|
181
|
+
this.renderPalette(),
|
|
182
|
+
react_1.default.createElement("div", { style: {
|
|
183
|
+
position: "absolute",
|
|
184
|
+
left: 141,
|
|
185
|
+
top: 0,
|
|
186
|
+
bottom: 0,
|
|
187
|
+
right: 0,
|
|
188
|
+
overflowX: "auto",
|
|
189
|
+
overflowY: "scroll"
|
|
190
|
+
}, className: `mwater-visualization-block-parent-outer mwater-visualization-block-editing` },
|
|
191
|
+
react_1.default.createElement("div", { key: "inner", className: `mwater-visualization-block-parent-inner mwater-visualization-block-parent-inner-${this.props.style || "default"}`, style: innerParentStyle }, this.renderBlock(this.props.items, false, 0)))));
|
|
275
192
|
}
|
|
276
193
|
else {
|
|
277
|
-
return
|
|
278
|
-
const outerParentStyle = {
|
|
194
|
+
return (react_1.default.createElement(AutoSizeComponent_1.default, { injectWidth: true, injectHeight: true }, (size) => {
|
|
195
|
+
const outerParentStyle = {
|
|
196
|
+
width: "100%",
|
|
197
|
+
height: "100%",
|
|
198
|
+
overflowX: "auto",
|
|
199
|
+
overflowY: "scroll"
|
|
200
|
+
};
|
|
279
201
|
innerParentStyle = {};
|
|
280
202
|
// Remove padding if small
|
|
281
203
|
if (size.width < 600) {
|
|
@@ -295,32 +217,25 @@ class BlocksDisplayComponent extends react_1.default.Component {
|
|
|
295
217
|
outerParentStyle.transformOrigin = "top left";
|
|
296
218
|
}
|
|
297
219
|
}
|
|
298
|
-
return
|
|
299
|
-
style: outerParentStyle,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
key: "inner",
|
|
303
|
-
className: `mwater-visualization-block-parent-inner mwater-visualization-block-parent-inner-${this.props.style || "default"}`,
|
|
304
|
-
style: innerParentStyle
|
|
305
|
-
}, this.renderBlock(this.props.items, layoutOptions.collapseColumnsWidth != null && size.width <= layoutOptions.collapseColumnsWidth)));
|
|
306
|
-
});
|
|
220
|
+
return (react_1.default.createElement(layoutOptions_1.DashboardStyleWrapper, { style: { width: "100%", height: "100%" }, layoutOptions: layoutOptions },
|
|
221
|
+
react_1.default.createElement("div", { style: outerParentStyle, className: `mwater-visualization-block-parent-outer mwater-visualization-block-parent-outer-${this.props.style || "default"} mwater-visualization-block-viewing` },
|
|
222
|
+
react_1.default.createElement("div", { key: "inner", className: `mwater-visualization-block-parent-inner mwater-visualization-block-parent-inner-${this.props.style || "default"}`, style: innerParentStyle }, this.renderBlock(this.props.items, layoutOptions.collapseColumnsWidth != null && size.width <= layoutOptions.collapseColumnsWidth, 0)))));
|
|
223
|
+
}));
|
|
307
224
|
}
|
|
308
225
|
}
|
|
309
226
|
}
|
|
310
227
|
exports.default = BlocksDisplayComponent;
|
|
311
228
|
class RootBlockComponent extends react_1.default.Component {
|
|
312
229
|
render() {
|
|
313
|
-
const elem =
|
|
314
|
-
|
|
315
|
-
})
|
|
230
|
+
const elem = (
|
|
231
|
+
// Flex to prevent margin collapse
|
|
232
|
+
react_1.default.createElement("div", { key: "root", style: { display: "flex", flexDirection: "column" } }, lodash_1.default.map(this.props.block.blocks, (block, index) => {
|
|
233
|
+
// Render with negative priority so that the first block is rendered first
|
|
234
|
+
return this.props.renderBlock(block, this.props.collapseColumns, this.props.priority - index);
|
|
235
|
+
})));
|
|
316
236
|
// If draggable
|
|
317
237
|
if (this.props.onBlockDrop != null) {
|
|
318
|
-
return
|
|
319
|
-
block: this.props.block,
|
|
320
|
-
onBlockDrop: this.props.onBlockDrop,
|
|
321
|
-
style: { height: "100%" },
|
|
322
|
-
onlyBottom: true
|
|
323
|
-
}, elem);
|
|
238
|
+
return (react_1.default.createElement(DraggableBlockComponent_1.default, { block: this.props.block, onBlockDrop: this.props.onBlockDrop, style: { height: "100%" }, onlyBottom: true }, elem));
|
|
324
239
|
}
|
|
325
240
|
else {
|
|
326
241
|
return elem;
|
|
@@ -329,8 +244,10 @@ class RootBlockComponent extends react_1.default.Component {
|
|
|
329
244
|
}
|
|
330
245
|
class VerticalBlockComponent extends react_1.default.Component {
|
|
331
246
|
render() {
|
|
332
|
-
return
|
|
333
|
-
|
|
334
|
-
}
|
|
247
|
+
return (
|
|
248
|
+
// Flex to prevent margin collapse
|
|
249
|
+
react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column" } }, lodash_1.default.map(this.props.block.blocks, block => {
|
|
250
|
+
return this.props.renderBlock(block, this.props.collapseColumns, this.props.priority);
|
|
251
|
+
})));
|
|
335
252
|
}
|
|
336
253
|
}
|
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import LayoutManager from "../LayoutManager";
|
|
2
|
+
import LayoutManager, { RenderLayoutOptions } from "../LayoutManager";
|
|
3
|
+
import BlocksDisplayComponent from "./BlocksDisplayComponent";
|
|
3
4
|
export default class BlocksLayoutManager extends LayoutManager {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
layoutOptions: any;
|
|
9
|
-
renderWidget: any;
|
|
10
|
-
disableMaps: any;
|
|
11
|
-
clipboard: any;
|
|
12
|
-
onClipboardChange: any;
|
|
13
|
-
cantPasteMessage: any;
|
|
14
|
-
}, React.Component<{
|
|
15
|
-
items: any;
|
|
16
|
-
onItemsChange: any;
|
|
17
|
-
style: any;
|
|
18
|
-
layoutOptions: any;
|
|
19
|
-
renderWidget: any;
|
|
20
|
-
disableMaps: any;
|
|
21
|
-
clipboard: any;
|
|
22
|
-
onClipboardChange: any;
|
|
23
|
-
cantPasteMessage: any;
|
|
24
|
-
}, any, any>>;
|
|
5
|
+
/**
|
|
6
|
+
* Renders the layout as a react element
|
|
7
|
+
*/
|
|
8
|
+
renderLayout(options: RenderLayoutOptions): React.CElement<import("./BlocksDisplayComponent").BlocksDisplayComponentProps, BlocksDisplayComponent>;
|
|
25
9
|
isEmpty(items: any): boolean;
|
|
26
10
|
getWidgetTypeAndDesign(items: any, widgetId: any): {
|
|
27
11
|
type: string;
|