@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.
Files changed (305) hide show
  1. package/lib/ColorComponent.d.ts +10 -11
  2. package/lib/ColorComponent.js +78 -29
  3. package/lib/ColorSchemeFactory.d.ts +13 -2
  4. package/lib/ColorSchemeFactory.js +7 -5
  5. package/lib/CustomColorsContext.d.ts +6 -0
  6. package/lib/CustomColorsContext.js +6 -0
  7. package/lib/FiltersDesignerComponent.d.ts +1 -4
  8. package/lib/FiltersDesignerComponent.js +2 -3
  9. package/lib/GlobalFilter.d.ts +13 -0
  10. package/lib/GlobalFilter.js +2 -0
  11. package/lib/LocaleContextInjector.d.ts +5 -11
  12. package/lib/LocaleContextInjector.js +4 -12
  13. package/lib/MWaterAddRelatedFormComponent.js +3 -3
  14. package/lib/MWaterAddRelatedIndicatorComponent.d.ts +1 -4
  15. package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
  16. package/lib/MWaterCompleteTableSelectComponent.d.ts +7 -25
  17. package/lib/MWaterCompleteTableSelectComponent.js +36 -36
  18. package/lib/MWaterContextComponent.d.ts +19 -9
  19. package/lib/MWaterContextComponent.js +38 -22
  20. package/lib/MWaterCustomTablesetListComponent.js +9 -3
  21. package/lib/MWaterGlobalFiltersComponent.d.ts +6 -5
  22. package/lib/MWaterGlobalFiltersComponent.js +4 -4
  23. package/lib/MWaterLoaderComponent.d.ts +15 -3
  24. package/lib/MWaterLoaderComponent.js +11 -2
  25. package/lib/MWaterTableSelectComponent.d.ts +1 -4
  26. package/lib/MWaterTableSelectComponent.js +10 -12
  27. package/lib/UIComponents.d.ts +2 -2
  28. package/lib/UIComponents.js +4 -12
  29. package/lib/axes/Axis.d.ts +20 -25
  30. package/lib/axes/AxisBuilder.d.ts +7 -4
  31. package/lib/axes/AxisBuilder.js +12 -8
  32. package/lib/axes/AxisComponent.d.ts +6 -9
  33. package/lib/axes/AxisComponent.js +1 -2
  34. package/lib/axes/ColorPaletteCollectionComponent.d.ts +5 -12
  35. package/lib/axes/ColorPaletteCollectionComponent.js +67 -36
  36. package/lib/dashboards/DashboardComponent.d.ts +4 -17
  37. package/lib/dashboards/DashboardComponent.js +20 -67
  38. package/lib/dashboards/DashboardDesign.d.ts +5 -20
  39. package/lib/dashboards/DashboardUpgrader.js +36 -1
  40. package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
  41. package/lib/dashboards/DashboardViewComponent.js +112 -136
  42. package/lib/dashboards/FontStyleEditor.d.ts +8 -0
  43. package/lib/dashboards/FontStyleEditor.js +130 -0
  44. package/lib/dashboards/LayoutOptionsComponent.d.ts +0 -1
  45. package/lib/dashboards/LayoutOptionsComponent.js +209 -39
  46. package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
  47. package/lib/dashboards/ServerDashboardDataSource.js +52 -33
  48. package/lib/dashboards/SettingsModalComponent.d.ts +4 -15
  49. package/lib/dashboards/SettingsModalComponent.js +24 -38
  50. package/lib/dashboards/WidgetComponent.d.ts +3 -3
  51. package/lib/dashboards/WidgetComponent.js +3 -6
  52. package/lib/dashboards/WidgetDataSourcePrioritizer.d.ts +20 -0
  53. package/lib/dashboards/WidgetDataSourcePrioritizer.js +72 -0
  54. package/lib/dashboards/layoutOptions.d.ts +83 -0
  55. package/lib/dashboards/layoutOptions.js +436 -10
  56. package/lib/datagrids/DatagridComponent.d.ts +2 -9
  57. package/lib/datagrids/DatagridDataSource.d.ts +3 -3
  58. package/lib/datagrids/DatagridDataSource.js +0 -14
  59. package/lib/datagrids/DatagridDesign.d.ts +7 -6
  60. package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -93
  61. package/lib/datagrids/DatagridDesignerComponent.js +8 -6
  62. package/lib/datagrids/DatagridViewComponent.js +1 -1
  63. package/lib/datagrids/FindReplaceModalComponent.d.ts +4 -20
  64. package/lib/datagrids/FindReplaceModalComponent.js +27 -13
  65. package/lib/datagrids/ServerDatagridDataSource.d.ts +8 -7
  66. package/lib/datagrids/ServerDatagridDataSource.js +88 -36
  67. package/lib/demo.js +4 -4
  68. package/lib/index.css +5 -0
  69. package/lib/index.d.ts +2 -1
  70. package/lib/index.js +0 -1
  71. package/lib/layouts/LayoutManager.d.ts +33 -29
  72. package/lib/layouts/LayoutManager.js +2 -8
  73. package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +26 -56
  74. package/lib/layouts/blocks/BlocksDisplayComponent.js +122 -205
  75. package/lib/layouts/blocks/BlocksLayoutManager.d.ts +6 -22
  76. package/lib/layouts/blocks/BlocksLayoutManager.js +5 -14
  77. package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +5 -4
  78. package/lib/layouts/blocks/HorizontalBlockComponent.js +5 -5
  79. package/lib/layouts/grid/GridLayoutManager.d.ts +2 -1
  80. package/lib/mWaterLoader.d.ts +2 -0
  81. package/lib/mWaterLoader.js +2 -1
  82. package/lib/maps/AddLayerComponent.d.ts +6 -8
  83. package/lib/maps/AddLayerComponent.js +6 -6
  84. package/lib/maps/BingLayer.js +10 -20
  85. package/lib/maps/BufferLayer.js +5 -2
  86. package/lib/maps/ChoroplethLayer.js +2 -1
  87. package/lib/maps/ClusterLayer.js +3 -1
  88. package/lib/maps/DirectMapDataSource.d.ts +5 -2
  89. package/lib/maps/DirectMapDataSource.js +2 -1
  90. package/lib/maps/EditPopupComponent.js +2 -1
  91. package/lib/maps/GridLayer.js +5 -3
  92. package/lib/maps/GridLayerDesigner.js +0 -1
  93. package/lib/maps/LayerSwitcherComponent.js +1 -1
  94. package/lib/maps/MapComponent.d.ts +3 -11
  95. package/lib/maps/MapComponent.js +3 -3
  96. package/lib/maps/MapDesign.d.ts +2 -13
  97. package/lib/maps/MapFiltersDesignerComponent.d.ts +0 -4
  98. package/lib/maps/MapFiltersDesignerComponent.js +4 -5
  99. package/lib/maps/MarkersLayer.js +30 -25
  100. package/lib/maps/RasterMapViewComponent.d.ts +3 -13
  101. package/lib/maps/RasterMapViewComponent.js +3 -3
  102. package/lib/maps/RegionSelectComponent.d.ts +2 -1
  103. package/lib/maps/ServerMapDataSource.d.ts +3 -4
  104. package/lib/maps/ServerMapDataSource.js +5 -5
  105. package/lib/maps/VectorMapViewComponent.js +2 -1
  106. package/lib/maps/mapSymbols.js +2 -0
  107. package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
  108. package/lib/maps/vectorMaps.d.ts +1 -0
  109. package/lib/maps/vectorMaps.js +70 -56
  110. package/lib/quickfilter/QuickfilterCompiler.d.ts +1 -1
  111. package/lib/quickfilter/QuickfiltersComponent.d.ts +1 -4
  112. package/lib/quickfilter/QuickfiltersComponent.js +3 -3
  113. package/lib/richtext/DropdownPaletteItem.d.ts +32 -0
  114. package/lib/richtext/DropdownPaletteItem.js +82 -0
  115. package/lib/richtext/FontColorPaletteItem.d.ts +1 -5
  116. package/lib/richtext/FontColorPaletteItem.js +32 -27
  117. package/lib/richtext/ItemsHtmlConverter.js +12 -3
  118. package/lib/richtext/RichTextComponent.d.ts +26 -52
  119. package/lib/richtext/RichTextComponent.js +166 -128
  120. package/lib/valueFormatter.js +6 -1
  121. package/lib/wellknown.d.ts +5 -0
  122. package/lib/wellknown.js +288 -0
  123. package/lib/widgets/DropdownWidgetComponent.d.ts +8 -25
  124. package/lib/widgets/DropdownWidgetComponent.js +48 -25
  125. package/lib/widgets/IFrameWidgetComponent.d.ts +3 -11
  126. package/lib/widgets/ImageWidgetComponent.d.ts +8 -27
  127. package/lib/widgets/MapWidget.d.ts +4 -7
  128. package/lib/widgets/MapWidget.js +2 -1
  129. package/lib/widgets/MarkdownWidget.d.ts +2 -7
  130. package/lib/widgets/TOCWidget.d.ts +2 -9
  131. package/lib/widgets/TOCWidget.js +2 -1
  132. package/lib/widgets/Widget.d.ts +2 -0
  133. package/lib/widgets/WidgetDataSource.d.ts +3 -1
  134. package/lib/widgets/charts/Chart.d.ts +0 -1
  135. package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
  136. package/lib/widgets/charts/ChartViewComponent.js +11 -3
  137. package/lib/widgets/charts/ChartWidget.d.ts +1 -74
  138. package/lib/widgets/charts/ChartWidget.js +4 -183
  139. package/lib/widgets/charts/ChartWidgetComponent.d.ts +51 -0
  140. package/lib/widgets/charts/ChartWidgetComponent.js +167 -0
  141. package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +1 -4
  142. package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +4 -4
  143. package/lib/widgets/charts/imagemosaic/ImagePopupComponent.d.ts +2 -7
  144. package/lib/widgets/charts/layered/LayeredChart.d.ts +5 -10
  145. package/lib/widgets/charts/layered/LayeredChart.js +6 -7
  146. package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +4 -2
  147. package/lib/widgets/charts/layered/LayeredChartCompiler.js +46 -32
  148. package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +4 -0
  149. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +5 -31
  150. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
  151. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -7
  152. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -1
  153. package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +1 -4
  154. package/lib/widgets/charts/layered/LayeredChartViewComponent.js +89 -38
  155. package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +5 -105
  156. package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +122 -166
  157. package/lib/widgets/charts/pivot/PivotChart.d.ts +6 -0
  158. package/lib/widgets/charts/pivot/PivotChart.js +47 -17
  159. package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +11 -0
  160. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +11 -7
  161. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +1 -1
  162. package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +2 -2
  163. package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +20 -36
  164. package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +0 -1
  165. package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +23 -2
  166. package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +215 -181
  167. package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +2 -2
  168. package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +9 -47
  169. package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
  170. package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +55 -58
  171. package/lib/widgets/charts/table/TableChart.js +8 -4
  172. package/lib/widgets/charts/table/TableChartDesignerComponent.js +3 -3
  173. package/lib/widgets/charts/table/TableChartViewComponent.js +30 -16
  174. package/lib/widgets/text/ExprInsertModalComponent.d.ts +2 -13
  175. package/lib/widgets/text/ExprUpdateModalComponent.d.ts +2 -13
  176. package/lib/widgets/text/TextComponent.d.ts +5 -12
  177. package/lib/widgets/text/TextComponent.js +19 -39
  178. package/lib/widgets/text/TextWidget.d.ts +2 -1
  179. package/lib/widgets/text/TextWidget.js +5 -1
  180. package/lib/widgets/text/TextWidgetComponent.d.ts +15 -3
  181. package/lib/widgets/text/TextWidgetComponent.js +76 -19
  182. package/lib/widgets/text/TextWidgetDesign.d.ts +16 -2
  183. package/lib/widgets/text/TextWidgetDesign.js +6 -0
  184. package/package.json +4 -4
  185. package/src/ColorComponent.tsx +177 -0
  186. package/src/ColorSchemeFactory.ts +12 -6
  187. package/src/CustomColorsContext.tsx +8 -0
  188. package/src/FiltersDesignerComponent.ts +3 -4
  189. package/src/GlobalFilter.ts +17 -0
  190. package/src/LocaleContextInjector.tsx +14 -13
  191. package/src/MWaterAddRelatedFormComponent.ts +3 -3
  192. package/src/MWaterAddRelatedIndicatorComponent.ts +6 -6
  193. package/src/MWaterCompleteTableSelectComponent.tsx +36 -36
  194. package/src/MWaterContextComponent.tsx +42 -33
  195. package/src/MWaterCustomTablesetListComponent.tsx +21 -3
  196. package/src/MWaterGlobalFiltersComponent.ts +8 -8
  197. package/src/MWaterLoaderComponent.ts +14 -4
  198. package/src/MWaterTableSelectComponent.tsx +11 -12
  199. package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
  200. package/src/axes/Axis.ts +24 -25
  201. package/src/axes/AxisBuilder.ts +16 -13
  202. package/src/axes/AxisComponent.ts +3 -4
  203. package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
  204. package/src/dashboards/DashboardComponent.tsx +73 -147
  205. package/src/dashboards/DashboardDesign.ts +5 -25
  206. package/src/dashboards/DashboardUpgrader.ts +41 -1
  207. package/src/dashboards/DashboardViewComponent.tsx +313 -0
  208. package/src/dashboards/FontStyleEditor.tsx +166 -0
  209. package/src/dashboards/LayoutOptionsComponent.tsx +377 -71
  210. package/src/dashboards/ServerDashboardDataSource.ts +52 -33
  211. package/src/dashboards/SettingsModalComponent.tsx +170 -0
  212. package/src/dashboards/WidgetComponent.tsx +6 -12
  213. package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
  214. package/src/dashboards/layoutOptions.tsx +581 -0
  215. package/src/datagrids/DatagridDataSource.ts +6 -12
  216. package/src/datagrids/DatagridDesign.ts +8 -3
  217. package/src/datagrids/DatagridDesignerComponent.tsx +22 -18
  218. package/src/datagrids/DatagridViewComponent.ts +3 -3
  219. package/src/datagrids/ExprCellComponent.ts +0 -1
  220. package/src/datagrids/FindReplaceModalComponent.ts +39 -22
  221. package/src/datagrids/ServerDatagridDataSource.ts +107 -45
  222. package/src/demo.ts +4 -4
  223. package/src/index.css +5 -0
  224. package/src/index.ts +2 -1
  225. package/src/layouts/LayoutManager.ts +44 -42
  226. package/src/layouts/blocks/BlocksDisplayComponent.tsx +498 -0
  227. package/src/layouts/blocks/BlocksLayoutManager.ts +6 -15
  228. package/src/layouts/blocks/HorizontalBlockComponent.ts +9 -8
  229. package/src/mWaterLoader.ts +4 -1
  230. package/src/maps/AddLayerComponent.ts +9 -9
  231. package/src/maps/BingLayer.ts +16 -26
  232. package/src/maps/BufferLayer.ts +5 -2
  233. package/src/maps/ChoroplethLayer.ts +2 -1
  234. package/src/maps/ClusterLayer.ts +3 -1
  235. package/src/maps/DirectMapDataSource.ts +12 -3
  236. package/src/maps/EditPopupComponent.ts +2 -1
  237. package/src/maps/GridLayer.ts +5 -3
  238. package/src/maps/GridLayerDesigner.tsx +0 -1
  239. package/src/maps/LayerSwitcherComponent.tsx +1 -1
  240. package/src/maps/MapComponent.ts +3 -3
  241. package/src/maps/MapDesign.ts +2 -17
  242. package/src/maps/{MapFiltersDesignerComponent.ts → MapFiltersDesignerComponent.tsx} +25 -25
  243. package/src/maps/MarkersLayer.ts +38 -41
  244. package/src/maps/RasterMapViewComponent.ts +3 -3
  245. package/src/maps/ServerMapDataSource.ts +8 -8
  246. package/src/maps/VectorMapViewComponent.tsx +2 -2
  247. package/src/maps/mapSymbols.ts +2 -0
  248. package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
  249. package/src/maps/vectorMaps.tsx +88 -74
  250. package/src/quickfilter/QuickfilterCompiler.ts +1 -1
  251. package/src/quickfilter/QuickfiltersComponent.ts +3 -3
  252. package/src/richtext/DropdownPaletteItem.tsx +144 -0
  253. package/src/richtext/FontColorPaletteItem.tsx +160 -0
  254. package/src/richtext/ItemsHtmlConverter.ts +15 -5
  255. package/src/richtext/RichTextComponent.tsx +274 -232
  256. package/src/valueFormatter.ts +5 -1
  257. package/src/wellknown.ts +286 -0
  258. package/src/widgets/DropdownWidgetComponent.tsx +75 -0
  259. package/src/widgets/MapWidget.ts +5 -2
  260. package/src/widgets/TOCWidget.ts +2 -1
  261. package/src/widgets/Widget.ts +3 -0
  262. package/src/widgets/WidgetDataSource.ts +3 -1
  263. package/src/widgets/charts/Chart.ts +1 -1
  264. package/src/widgets/charts/ChartViewComponent.ts +16 -3
  265. package/src/widgets/charts/ChartWidget.ts +3 -275
  266. package/src/widgets/charts/ChartWidgetComponent.tsx +281 -0
  267. package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +4 -4
  268. package/src/widgets/charts/layered/LayeredChart.ts +4 -6
  269. package/src/widgets/charts/layered/LayeredChartCompiler.ts +80 -63
  270. package/src/widgets/charts/layered/LayeredChartDesign.ts +7 -1
  271. package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +43 -10
  272. package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +6 -6
  273. package/src/widgets/charts/layered/LayeredChartViewComponent.ts +140 -88
  274. package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +305 -221
  275. package/src/widgets/charts/pivot/PivotChart.ts +56 -18
  276. package/src/widgets/charts/pivot/PivotChartDesign.ts +12 -0
  277. package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +4 -3
  278. package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +39 -76
  279. package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +0 -1
  280. package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +230 -189
  281. package/src/widgets/charts/pivot/PivotChartUtils.ts +4 -4
  282. package/src/widgets/charts/pivot/{PivotChartViewComponent.ts → PivotChartViewComponent.tsx} +86 -89
  283. package/src/widgets/charts/table/TableChart.ts +8 -4
  284. package/src/widgets/charts/table/TableChartDesignerComponent.ts +4 -4
  285. package/src/widgets/charts/table/TableChartViewComponent.ts +32 -19
  286. package/src/widgets/text/TextComponent.tsx +47 -49
  287. package/src/widgets/text/TextWidget.ts +8 -3
  288. package/src/widgets/text/TextWidgetComponent.tsx +249 -0
  289. package/src/widgets/text/TextWidgetDesign.ts +26 -2
  290. package/src/ColorComponent.ts +0 -117
  291. package/src/dashboards/DashboardViewComponent.ts +0 -304
  292. package/src/dashboards/SettingsModalComponent.ts +0 -169
  293. package/src/dashboards/layoutOptions.ts +0 -40
  294. package/src/layout-styles.css +0 -263
  295. package/src/layouts/blocks/BlocksDisplayComponent.ts +0 -461
  296. package/src/layouts/grid/GridLayoutComponent.ts +0 -67
  297. package/src/layouts/grid/GridLayoutManager.ts +0 -185
  298. package/src/layouts/grid/LegoLayoutEngine.ts +0 -142
  299. package/src/layouts/grid/PaletteItemComponent.ts +0 -28
  300. package/src/layouts/grid/README.md +0 -14
  301. package/src/layouts/grid/WidgetContainerComponent.ts +0 -420
  302. package/src/richtext/FontColorPaletteItem.ts +0 -172
  303. package/src/richtext/FontSizePaletteItem.ts +0 -110
  304. package/src/widgets/DropdownWidgetComponent.ts +0 -78
  305. 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
- // Default is old grid type
23
- type = type || "grid";
22
+ type = type || "blocks";
24
23
  switch (type) {
25
- case "grid": // Old one
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 HorizontalBlockComponent from "./HorizontalBlockComponent";
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?: string;
9
+ style?: DashboardTheme;
9
10
  /** layout options to use */
10
11
  layoutOptions?: any;
11
12
  /** Renders a widget. Passed (options) */
12
- renderWidget: any;
13
+ renderWidget: (options: RenderWidgetOptions) => ReactElement;
13
14
  /** True to prevent maps */
14
15
  disableMaps?: boolean;
15
- /** Including onClipboardChange adds a clipboard palette item that can be used to copy and paste widgets */
16
+ /** clipboard contents */
16
17
  clipboard?: any;
17
- onClipboardChange?: any;
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: any, targetBlock: any, side: "top" | "left" | "right" | "bottom") => void;
22
- handleBlockRemove: (block: any) => void;
23
- handleBlockUpdate: (block: any) => void;
24
- renderBlock: (block: any, collapseColumns?: boolean) => React.CElement<RootBlockComponentProps, RootBlockComponent> | React.CElement<any, HorizontalBlockComponent> | React.DetailedReactHTMLElement<{
25
- key: any;
26
- className: string;
27
- }, HTMLElement>;
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.DetailedReactHTMLElement<{
32
- key: string;
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
- renderBlock = (block, collapseColumns = false) => {
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 R(RootBlockComponent, {
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 R(VerticalBlockComponent, {
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 R(HorizontalBlockComponent_1.default, {
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 = R(AutoSizeComponent_1.default, { injectWidth: true, key: block.id }, (size) => {
101
- return R("div", {
102
- id: block.id,
103
- style: {
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 = R(DraggableBlockComponent_1.default, {
111
- key: block.id,
112
- block,
113
- onBlockDrop: this.handleBlockDrop
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 = R(AutoSizeComponent_1.default, { injectWidth: true, key: block.id }, (size) => {
126
- return this.props.renderWidget({
127
- id: block.id,
128
- type: block.widgetType,
129
- design: block.design,
130
- onDesignChange: this.props.onItemsChange
131
- ? (design) => this.props.onItemsChange(blockUtils.updateBlock(this.props.items, lodash_1.default.extend({}, block, { design })))
132
- : undefined,
133
- width: size.width,
134
- height: block.aspectRatio != null ? size.width / block.aspectRatio : undefined
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 = R(DraggableBlockComponent_1.default, {
139
- key: block.id,
140
- block,
141
- onBlockDrop: this.handleBlockDrop
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 R("div", { key: block.id, className: `mwater-visualization-block mwater-visualization-block-${block.type}` }, elem);
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 R("div", { key: "palette", style: { width: 141, height: "100%", position: "absolute", top: 0, left: 0 } }, R("div", { className: "mwater-visualization-palette", style: { height: "100%" } }, R(PaletteItemComponent_1.default, {
166
- createItem: this.createBlockItem({ type: "widget", widgetType: "Text", design: { style: "title" } }),
167
- title: R("i", { className: "fa fa-font" }),
168
- subtitle: "Title"
169
- }), R(PaletteItemComponent_1.default, {
170
- createItem: this.createBlockItem({ type: "widget", widgetType: "Text", design: {} }),
171
- title: R("i", { className: "fa fa-align-left" }),
172
- subtitle: "Text"
173
- }), R(PaletteItemComponent_1.default, {
174
- createItem: this.createBlockItem({ type: "widget", aspectRatio: 1.4, widgetType: "Image", design: {} }),
175
- title: R("i", { className: "fa fa-picture-o" }),
176
- subtitle: "Image"
177
- }), R(PaletteItemComponent_1.default, {
178
- createItem: this.createBlockItem({
179
- type: "widget",
180
- aspectRatio: 1.4,
181
- widgetType: "LayeredChart",
182
- design: {}
183
- }),
184
- title: R("i", { className: "fa fa-bar-chart" }),
185
- subtitle: "Chart"
186
- }), !this.props.disableMaps
187
- ? R(PaletteItemComponent_1.default, {
188
- createItem: this.createBlockItem({
189
- type: "widget",
190
- aspectRatio: 2,
191
- widgetType: "Map",
192
- design: {
193
- baseLayer: "bing_road",
194
- layerViews: [],
195
- filters: {},
196
- bounds: { w: -40, n: 25, e: 40, s: -25 }
197
- }
198
- }),
199
- title: R("i", { className: "fa fa-map-o" }),
200
- subtitle: "Map"
201
- })
202
- : undefined, R(PaletteItemComponent_1.default, {
203
- createItem: this.createBlockItem({ type: "widget", aspectRatio: 1.4, widgetType: "TableChart", design: {} }),
204
- title: R("i", { className: "fa fa-table" }),
205
- subtitle: "Table"
206
- }), R(PaletteItemComponent_1.default, {
207
- createItem: this.createBlockItem({ type: "widget", widgetType: "PivotChart", design: {} }),
208
- title: R("img", {
209
- width: 24,
210
- height: 24,
211
- src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAb0lEQVRIx91VQQrAIAwzo/7/ydllG0MQS21EzMW2ICFtoyBZlLDn/LOgySPAG1xFDDmBtZI6efoMvODozkyL2IlTCOisfS2KrqG0RXus6fkEVBIw08khE62aQY0ogMdEswqwYouwvQ8s+4M576m4Ae/tET/u1taEAAAAAElFTkSuQmCC"
212
- }),
213
- subtitle: "Pivot"
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 R("div", { style: { width: "100%", height: "100%", overflow: "hidden", position: "relative" } }, this.renderPalette(), R("div", {
268
- style: { position: "absolute", left: 141, top: 0, bottom: 0, right: 0, overflowX: "auto", overflowY: "scroll" },
269
- className: `mwater-visualization-block-parent-outer mwater-visualization-block-parent-outer-${this.props.style || "default"} mwater-visualization-block-editing`
270
- }, R("div", {
271
- key: "inner",
272
- className: `mwater-visualization-block-parent-inner mwater-visualization-block-parent-inner-${this.props.style || "default"}`,
273
- style: innerParentStyle
274
- }, this.renderBlock(this.props.items))));
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 R(AutoSizeComponent_1.default, { injectWidth: true, injectHeight: true }, (size) => {
278
- const outerParentStyle = { width: "100%", height: "100%", overflowX: "auto", overflowY: "scroll" };
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 R("div", {
299
- style: outerParentStyle,
300
- className: `mwater-visualization-block-parent-outer mwater-visualization-block-parent-outer-${this.props.style || "default"} mwater-visualization-block-viewing`
301
- }, R("div", {
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 = R("div", { key: "root" }, lodash_1.default.map(this.props.block.blocks, (block) => {
314
- return this.props.renderBlock(block, this.props.collapseColumns);
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 R(DraggableBlockComponent_1.default, {
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 R("div", null, lodash_1.default.map(this.props.block.blocks, (block) => {
333
- return this.props.renderBlock(block, this.props.collapseColumns);
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
- renderLayout(options: any): React.CElement<{
5
- items: any;
6
- onItemsChange: any;
7
- style: any;
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;