@mwater/visualization 5.4.1 → 5.4.3

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 (273) hide show
  1. package/lib/ColorComponent.js +2 -1
  2. package/lib/IdSelection.d.ts +16 -0
  3. package/lib/IdSelection.js +59 -0
  4. package/lib/MWaterAddRelatedIndicatorComponent.js +2 -2
  5. package/lib/MWaterCompleteTableSelectComponent.d.ts +3 -8
  6. package/lib/MWaterCompleteTableSelectComponent.js +36 -42
  7. package/lib/MWaterLoaderComponent.d.ts +11 -10
  8. package/lib/MWaterLoaderComponent.js +1 -1
  9. package/lib/MWaterResponsesFilterComponent.js +1 -1
  10. package/lib/MWaterTableSelectComponent.d.ts +0 -1
  11. package/lib/MWaterTableSelectComponent.js +4 -6
  12. package/lib/autotranslate.d.ts +20 -0
  13. package/lib/autotranslate.js +122 -0
  14. package/lib/axes/AxisBuilder.js +3 -3
  15. package/lib/axes/AxisColorEditorComponent.js +4 -0
  16. package/lib/axes/AxisComponent.d.ts +8 -12
  17. package/lib/axes/AxisComponent.js +32 -80
  18. package/lib/axes/CategoryMapComponent.js +4 -4
  19. package/lib/axes/RangesComponent.js +2 -2
  20. package/lib/dashboards/DashboardComponent.d.ts +12 -20
  21. package/lib/dashboards/DashboardComponent.js +109 -69
  22. package/lib/dashboards/DashboardDesign.d.ts +11 -2
  23. package/lib/dashboards/DashboardUtils.d.ts +5 -0
  24. package/lib/dashboards/DashboardUtils.js +30 -0
  25. package/lib/dashboards/DashboardViewComponent.d.ts +2 -0
  26. package/lib/dashboards/DashboardViewComponent.js +16 -3
  27. package/lib/dashboards/ServerDashboardDataSource.js +2 -1
  28. package/lib/dashboards/SettingsModalComponent.d.ts +1 -1
  29. package/lib/dashboards/SettingsModalComponent.js +256 -19
  30. package/lib/dashboards/WidgetComponent.d.ts +6 -3
  31. package/lib/dashboards/WidgetComponent.js +3 -1
  32. package/lib/datagrids/CellEditor.d.ts +19 -0
  33. package/lib/datagrids/CellEditor.js +223 -0
  34. package/lib/datagrids/DatagridComponent.d.ts +18 -87
  35. package/lib/datagrids/DatagridComponent.js +304 -222
  36. package/lib/datagrids/DatagridViewComponent.d.ts +15 -53
  37. package/lib/datagrids/DatagridViewComponent.js +256 -257
  38. package/lib/datagrids/DirectDatagridDataSource.js +2 -3
  39. package/lib/datagrids/ExprCellComponent.d.ts +8 -15
  40. package/lib/datagrids/ExprCellComponent.js +11 -15
  41. package/lib/datagrids/FindReplaceModalComponent.d.ts +4 -6
  42. package/lib/datagrids/FindReplaceModalComponent.js +38 -75
  43. package/lib/index.css +1 -1
  44. package/lib/index.d.ts +0 -1
  45. package/lib/index.js +0 -1
  46. package/lib/languages.js +6 -1
  47. package/lib/layouts/blocks/HorizontalBlockComponent.js +2 -2
  48. package/lib/mWaterLoader.d.ts +1 -1
  49. package/lib/maps/BufferLayer.d.ts +7 -5
  50. package/lib/maps/BufferLayer.js +69 -48
  51. package/lib/maps/BufferLayerDesign.d.ts +21 -14
  52. package/lib/maps/BufferLayerDesignerComponent.d.ts +16 -31
  53. package/lib/maps/BufferLayerDesignerComponent.js +68 -102
  54. package/lib/maps/ChoroplethLayer.d.ts +5 -4
  55. package/lib/maps/ChoroplethLayer.js +32 -9
  56. package/lib/maps/ChoroplethLayerDesign.d.ts +6 -2
  57. package/lib/maps/ChoroplethLayerDesigner.js +4 -2
  58. package/lib/maps/ClusterLayer.d.ts +3 -4
  59. package/lib/maps/ClusterLayer.js +2 -1
  60. package/lib/maps/DetailLevelSelectComponent.js +1 -1
  61. package/lib/maps/DirectMapDataSource.js +2 -1
  62. package/lib/maps/EditPopupComponent.js +5 -3
  63. package/lib/maps/GridLayer.d.ts +3 -4
  64. package/lib/maps/GridLayer.js +2 -1
  65. package/lib/maps/GridLayerDesigner.js +5 -3
  66. package/lib/maps/HoverContent.d.ts +11 -3
  67. package/lib/maps/HoverContent.js +25 -9
  68. package/lib/maps/Layer.d.ts +24 -3
  69. package/lib/maps/Layer.js +5 -1
  70. package/lib/maps/LayerFactory.js +0 -8
  71. package/lib/maps/LayerLegendComponent.js +0 -1
  72. package/lib/maps/LayerSwitcherComponent.d.ts +1 -0
  73. package/lib/maps/LayerSwitcherComponent.js +1 -1
  74. package/lib/maps/LeafletMapComponent.js +3 -1
  75. package/lib/maps/LegendComponent.d.ts +1 -0
  76. package/lib/maps/LegendComponent.js +9 -1
  77. package/lib/maps/MWaterServerLayer.d.ts +2 -2
  78. package/lib/maps/MWaterServerLayer.js +2 -2
  79. package/lib/maps/MapComponent.js +3 -3
  80. package/lib/maps/MapDesign.d.ts +2 -0
  81. package/lib/maps/MapDesignerComponent.d.ts +4 -3
  82. package/lib/maps/MapDesignerComponent.js +68 -74
  83. package/lib/maps/MapLayerViewDesignerComponent.js +2 -2
  84. package/lib/maps/MapUtils.d.ts +4 -0
  85. package/lib/maps/MapUtils.js +19 -0
  86. package/lib/maps/MapViewComponent.d.ts +8 -3
  87. package/lib/maps/MarkersLayer.d.ts +5 -4
  88. package/lib/maps/MarkersLayer.js +33 -7
  89. package/lib/maps/MarkersLayerDesign.d.ts +19 -16
  90. package/lib/maps/PopupFilterJoinsUtils.d.ts +6 -3
  91. package/lib/maps/PopupFilterJoinsUtils.js +0 -6
  92. package/lib/maps/RasterMapViewComponent.d.ts +3 -31
  93. package/lib/maps/RasterMapViewComponent.js +7 -2
  94. package/lib/maps/ServerMapDataSource.js +2 -1
  95. package/lib/maps/SwitchableTileUrlLayer.d.ts +3 -3
  96. package/lib/maps/SwitchableTileUrlLayer.js +2 -1
  97. package/lib/maps/TileUrlLayer.d.ts +4 -5
  98. package/lib/maps/TileUrlLayer.js +2 -1
  99. package/lib/maps/VectorMapViewComponent.d.ts +5 -37
  100. package/lib/maps/VectorMapViewComponent.js +19 -8
  101. package/lib/maps/maps.d.ts +3 -0
  102. package/lib/quickfilter/Quickfilter.d.ts +2 -0
  103. package/lib/quickfilter/QuickfiltersComponent.d.ts +2 -0
  104. package/lib/quickfilter/QuickfiltersComponent.js +9 -7
  105. package/lib/quickfilter/QuickfiltersDesignComponent.d.ts +5 -30
  106. package/lib/quickfilter/QuickfiltersDesignComponent.js +56 -63
  107. package/lib/richtext/ExprItemsHtmlConverter.d.ts +5 -2
  108. package/lib/richtext/ExprItemsHtmlConverter.js +4 -4
  109. package/lib/richtext/ExprItemsTranslator.d.ts +5 -0
  110. package/lib/richtext/ExprItemsTranslator.js +149 -0
  111. package/lib/richtext/ItemsHtmlConverter.d.ts +1 -1
  112. package/lib/richtext/ItemsHtmlConverter.js +31 -15
  113. package/lib/wellknown.js +12 -9
  114. package/lib/widgets/IFrameWidget.d.ts +4 -4
  115. package/lib/widgets/ImageWidget.d.ts +7 -4
  116. package/lib/widgets/ImageWidget.js +9 -1
  117. package/lib/widgets/ImageWidgetComponent.d.ts +1 -0
  118. package/lib/widgets/ImageWidgetComponent.js +1 -1
  119. package/lib/widgets/MapWidget.d.ts +5 -48
  120. package/lib/widgets/MapWidget.js +26 -63
  121. package/lib/widgets/MarkdownWidget.d.ts +3 -0
  122. package/lib/widgets/MarkdownWidget.js +3 -0
  123. package/lib/widgets/TOCWidget.d.ts +15 -27
  124. package/lib/widgets/TOCWidget.js +107 -183
  125. package/lib/widgets/Widget.d.ts +18 -7
  126. package/lib/widgets/Widget.js +4 -0
  127. package/lib/widgets/WidgetScopesViewComponent.js +1 -1
  128. package/lib/widgets/charts/Chart.d.ts +10 -1
  129. package/lib/widgets/charts/Chart.js +22 -11
  130. package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
  131. package/lib/widgets/charts/ChartViewComponent.js +6 -3
  132. package/lib/widgets/charts/ChartWidget.d.ts +2 -0
  133. package/lib/widgets/charts/ChartWidget.js +9 -1
  134. package/lib/widgets/charts/ChartWidgetComponent.d.ts +4 -0
  135. package/lib/widgets/charts/ChartWidgetComponent.js +2 -2
  136. package/lib/widgets/charts/calendar/CalendarChart.d.ts +1 -0
  137. package/lib/widgets/charts/calendar/CalendarChart.js +26 -0
  138. package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +3 -1
  139. package/lib/widgets/charts/imagemosaic/ImageMosaicChart.d.ts +1 -0
  140. package/lib/widgets/charts/imagemosaic/ImageMosaicChart.js +8 -0
  141. package/lib/widgets/charts/layered/LayeredChart.d.ts +2 -0
  142. package/lib/widgets/charts/layered/LayeredChart.js +63 -3
  143. package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +1 -1
  144. package/lib/widgets/charts/layered/LayeredChartCompiler.js +1 -1
  145. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +2 -2
  146. package/lib/widgets/charts/layered/LayeredChartViewComponent.js +8 -3
  147. package/lib/widgets/charts/pivot/PivotChart.d.ts +1 -0
  148. package/lib/widgets/charts/pivot/PivotChart.js +63 -0
  149. package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +1 -1
  150. package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +7 -4
  151. package/lib/widgets/charts/table/OrderingsComponent.js +1 -1
  152. package/lib/widgets/charts/table/TableChart.d.ts +1 -0
  153. package/lib/widgets/charts/table/TableChart.js +15 -0
  154. package/lib/widgets/text/TextComponent.d.ts +11 -4
  155. package/lib/widgets/text/TextComponent.js +11 -8
  156. package/lib/widgets/text/TextWidget.d.ts +6 -3
  157. package/lib/widgets/text/TextWidget.js +7 -1
  158. package/lib/widgets/text/TextWidgetComponent.d.ts +4 -0
  159. package/lib/widgets/text/TextWidgetComponent.js +7 -1
  160. package/lib/widgets/text/TextWidgetDesign.d.ts +2 -4
  161. package/lib/widgets/text/TextWidgetDesign.js +1 -1
  162. package/package.json +7 -8
  163. package/src/ColorComponent.tsx +1 -2
  164. package/src/IdSelection.ts +62 -0
  165. package/src/MWaterAddRelatedIndicatorComponent.ts +3 -2
  166. package/src/MWaterCompleteTableSelectComponent.tsx +36 -46
  167. package/src/MWaterLoaderComponent.ts +28 -26
  168. package/src/MWaterResponsesFilterComponent.ts +5 -2
  169. package/src/MWaterTableSelectComponent.tsx +5 -9
  170. package/src/autotranslate.ts +141 -0
  171. package/src/axes/AxisBuilder.ts +3 -3
  172. package/src/axes/AxisColorEditorComponent.tsx +5 -0
  173. package/src/axes/{AxisComponent.ts → AxisComponent.tsx} +106 -106
  174. package/src/axes/CategoryMapComponent.ts +4 -4
  175. package/src/axes/RangesComponent.ts +3 -2
  176. package/src/dashboards/DashboardComponent.tsx +189 -125
  177. package/src/dashboards/DashboardDesign.ts +9 -2
  178. package/src/dashboards/DashboardUtils.ts +39 -0
  179. package/src/dashboards/DashboardViewComponent.tsx +22 -3
  180. package/src/dashboards/ServerDashboardDataSource.ts +2 -1
  181. package/src/dashboards/SettingsModalComponent.tsx +450 -35
  182. package/src/dashboards/WidgetComponent.tsx +12 -6
  183. package/src/datagrids/CellEditor.tsx +354 -0
  184. package/src/datagrids/DatagridComponent.tsx +646 -0
  185. package/src/datagrids/DatagridViewComponent.tsx +539 -0
  186. package/src/datagrids/DirectDatagridDataSource.ts +2 -3
  187. package/src/datagrids/{ExprCellComponent.ts → ExprCellComponent.tsx} +28 -23
  188. package/src/datagrids/{FindReplaceModalComponent.ts → FindReplaceModalComponent.tsx} +109 -122
  189. package/src/index.css +1 -1
  190. package/src/index.ts +0 -1
  191. package/src/languages.ts +6 -1
  192. package/src/layouts/blocks/HorizontalBlockComponent.ts +2 -2
  193. package/src/mWaterLoader.ts +1 -1
  194. package/src/maps/BufferLayer.ts +83 -60
  195. package/src/maps/BufferLayerDesign.ts +20 -14
  196. package/src/maps/BufferLayerDesignerComponent.tsx +309 -0
  197. package/src/maps/ChoroplethLayer.ts +40 -19
  198. package/src/maps/ChoroplethLayerDesign.ts +4 -2
  199. package/src/maps/ChoroplethLayerDesigner.tsx +4 -2
  200. package/src/maps/ClusterLayer.ts +4 -10
  201. package/src/maps/DetailLevelSelectComponent.ts +1 -1
  202. package/src/maps/DirectMapDataSource.ts +2 -1
  203. package/src/maps/EditPopupComponent.ts +7 -3
  204. package/src/maps/GridLayer.ts +4 -10
  205. package/src/maps/GridLayerDesigner.tsx +5 -3
  206. package/src/maps/HoverContent.tsx +40 -16
  207. package/src/maps/Layer.ts +28 -10
  208. package/src/maps/LayerFactory.ts +0 -8
  209. package/src/maps/LayerLegendComponent.ts +2 -4
  210. package/src/maps/LayerSwitcherComponent.tsx +6 -2
  211. package/src/maps/LeafletMapComponent.tsx +3 -1
  212. package/src/maps/LegendComponent.tsx +10 -1
  213. package/src/maps/MWaterServerLayer.ts +3 -3
  214. package/src/maps/MapComponent.ts +3 -3
  215. package/src/maps/MapDesign.ts +3 -0
  216. package/src/maps/MapDesignerComponent.tsx +165 -162
  217. package/src/maps/MapLayerViewDesignerComponent.ts +2 -2
  218. package/src/maps/MapUtils.ts +24 -0
  219. package/src/maps/MapViewComponent.tsx +11 -3
  220. package/src/maps/MarkersLayer.ts +44 -18
  221. package/src/maps/MarkersLayerDesign.ts +19 -16
  222. package/src/maps/PopupFilterJoinsUtils.ts +6 -2
  223. package/src/maps/RasterMapViewComponent.ts +9 -45
  224. package/src/maps/ServerMapDataSource.ts +2 -2
  225. package/src/maps/SwitchableTileUrlLayer.tsx +4 -10
  226. package/src/maps/TileUrlLayer.tsx +4 -10
  227. package/src/maps/VectorMapViewComponent.tsx +28 -55
  228. package/src/maps/maps.ts +3 -0
  229. package/src/quickfilter/Quickfilter.ts +3 -0
  230. package/src/quickfilter/QuickfiltersComponent.ts +13 -7
  231. package/src/quickfilter/QuickfiltersDesignComponent.tsx +127 -128
  232. package/src/richtext/ExprItemsHtmlConverter.ts +9 -5
  233. package/src/richtext/ExprItemsTranslator.ts +176 -0
  234. package/src/richtext/ItemsHtmlConverter.ts +33 -18
  235. package/src/wellknown.ts +33 -30
  236. package/src/widgets/ImageWidget.ts +10 -1
  237. package/src/widgets/ImageWidgetComponent.ts +3 -2
  238. package/src/widgets/{MapWidget.ts → MapWidget.tsx} +90 -101
  239. package/src/widgets/MarkdownWidget.ts +3 -0
  240. package/src/widgets/TOCWidget.tsx +281 -0
  241. package/src/widgets/Widget.ts +25 -5
  242. package/src/widgets/WidgetScopesViewComponent.ts +2 -1
  243. package/src/widgets/charts/Chart.ts +31 -12
  244. package/src/widgets/charts/ChartViewComponent.ts +13 -3
  245. package/src/widgets/charts/ChartWidget.ts +11 -1
  246. package/src/widgets/charts/ChartWidgetComponent.tsx +9 -1
  247. package/src/widgets/charts/calendar/CalendarChart.ts +29 -0
  248. package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +3 -1
  249. package/src/widgets/charts/imagemosaic/ImageMosaicChart.ts +9 -0
  250. package/src/widgets/charts/layered/LayeredChart.ts +71 -3
  251. package/src/widgets/charts/layered/LayeredChartCompiler.ts +2 -2
  252. package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +4 -2
  253. package/src/widgets/charts/layered/LayeredChartViewComponent.ts +10 -4
  254. package/src/widgets/charts/pivot/PivotChart.ts +73 -0
  255. package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +1 -1
  256. package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +6 -4
  257. package/src/widgets/charts/table/OrderingsComponent.tsx +2 -1
  258. package/src/widgets/charts/table/TableChart.ts +17 -0
  259. package/src/widgets/text/TextComponent.tsx +22 -12
  260. package/src/widgets/text/TextWidget.ts +9 -2
  261. package/src/widgets/text/TextWidgetComponent.tsx +16 -1
  262. package/src/widgets/text/TextWidgetDesign.ts +4 -7
  263. package/test/IdSelectionTests.ts +54 -0
  264. package/test/LayeredChartCompilerTests.ts +0 -2
  265. package/test/richtext/ExprItemsTranslatorTests.ts +144 -0
  266. package/test/wellknownTests.ts +144 -0
  267. package/src/datagrids/DatagridComponent.ts +0 -478
  268. package/src/datagrids/DatagridViewComponent.ts +0 -464
  269. package/src/datagrids/EditExprCellComponent.tsx +0 -305
  270. package/src/datagrids/README.md +0 -3
  271. package/src/maps/BufferLayerDesignerComponent.ts +0 -311
  272. package/src/widgets/TOCWidget.ts +0 -326
  273. package/test/LegoLayoutEngineTests.ts +0 -69
@@ -27,23 +27,26 @@ export default class ImageWidget extends Widget {
27
27
  dataSource: DataSource;
28
28
  widgetDataSource: import("./WidgetDataSource").WidgetDataSource;
29
29
  filters: JsonQLFilter[];
30
- design: object;
31
- onDesignChange: ((design: object) => void) | null | undefined;
30
+ design: any;
31
+ onDesignChange: ((design: any) => void) | null | undefined;
32
32
  width: number | undefined;
33
33
  height: number | undefined;
34
34
  singleRowTable: string | undefined;
35
+ translate: (input: string) => string;
35
36
  }, React.Component<{
36
37
  schema: Schema;
37
38
  dataSource: DataSource;
38
39
  widgetDataSource: import("./WidgetDataSource").WidgetDataSource;
39
40
  filters: JsonQLFilter[];
40
- design: object;
41
- onDesignChange: ((design: object) => void) | null | undefined;
41
+ design: any;
42
+ onDesignChange: ((design: any) => void) | null | undefined;
42
43
  width: number | undefined;
43
44
  height: number | undefined;
44
45
  singleRowTable: string | undefined;
46
+ translate: (input: string) => string;
45
47
  }, any, any>>;
46
48
  getData(design: ImageWidgetDesign, schema: Schema, dataSource: DataSource, filters: JsonQLFilter[], callback: any): any;
47
49
  isAutoHeight(): boolean;
48
50
  getFilterableTables(design: any, schema: Schema): any[];
51
+ getTranslatableStrings(design: ImageWidgetDesign, schema: Schema): string[];
49
52
  }
@@ -35,7 +35,8 @@ class ImageWidget extends Widget_1.default {
35
35
  onDesignChange: options.onDesignChange,
36
36
  width: options.width,
37
37
  height: options.height,
38
- singleRowTable: options.singleRowTable
38
+ singleRowTable: options.singleRowTable,
39
+ translate: options.translate
39
40
  });
40
41
  }
41
42
  // Get the data that the widget needs. This will be called on the server, typically.
@@ -108,5 +109,12 @@ class ImageWidget extends Widget_1.default {
108
109
  }
109
110
  return [];
110
111
  }
112
+ getTranslatableStrings(design, schema) {
113
+ const strings = [];
114
+ if (design.caption) {
115
+ strings.push(design.caption);
116
+ }
117
+ return strings;
118
+ }
111
119
  }
112
120
  exports.default = ImageWidget;
@@ -17,6 +17,7 @@ export interface ImageWidgetComponentProps {
17
17
  width: number;
18
18
  height: number;
19
19
  singleRowTable?: string;
20
+ translate: (input: string) => string;
20
21
  }
21
22
  export default class ImageWidgetComponent extends AsyncLoadComponent<ImageWidgetComponentProps, {
22
23
  data: any;
@@ -143,7 +143,7 @@ class ImageWidgetComponent extends AsyncLoadComponent_1.default {
143
143
  : R("div", {
144
144
  className: "mwater-visualization-image-widget",
145
145
  style: { position: "relative", width: this.props.width, height: this.props.height }
146
- }, captionPosition === "top" ? R("div", { className: "caption" }, this.props.design.caption) : undefined, R("div", { className: "image" }, this.renderContent()), captionPosition === "bottom" ? R("div", { className: "caption" }, this.props.design.caption) : undefined));
146
+ }, captionPosition === "top" && this.props.design.caption ? R("div", { className: "caption" }, this.props.translate(this.props.design.caption)) : undefined, R("div", { className: "image" }, this.renderContent()), captionPosition === "bottom" && this.props.design.caption ? R("div", { className: "caption" }, this.props.translate(this.props.design.caption)) : undefined));
147
147
  }
148
148
  }
149
149
  exports.default = ImageWidgetComponent;
@@ -1,52 +1,9 @@
1
1
  import React from "react";
2
2
  import Widget, { CreateViewElementOptions } from "./Widget";
3
- import ModalWindowComponent from "@mwater/react-library/lib/ModalWindowComponent";
4
- import { DataSource, Schema } from "@mwater/expressions";
5
- import { WidgetDataSource } from "./WidgetDataSource";
3
+ import { Schema } from "@mwater/expressions";
4
+ import { MapDesign } from "../maps/MapDesign";
6
5
  export default class MapWidget extends Widget {
7
- createViewElement(options: CreateViewElementOptions): React.CElement<any, MapWidgetComponent>;
8
- getFilterableTables(design: any, schema: Schema): string[];
6
+ createViewElement(options: CreateViewElementOptions): React.JSX.Element;
7
+ getFilterableTables(design: MapDesign, schema: Schema): string[];
8
+ getTranslatableStrings(design: MapDesign, schema: Schema): string[];
9
9
  }
10
- interface MapWidgetComponentProps {
11
- /** Schema to use */
12
- schema: Schema;
13
- /** Data source to use */
14
- dataSource: DataSource;
15
- widgetDataSource: WidgetDataSource;
16
- /** See Map Design.md */
17
- design: any;
18
- /** Called with new design. null/undefined for readonly */
19
- onDesignChange?: any;
20
- width?: number;
21
- height?: number;
22
- /** scope of the widget (when the widget self-selects a particular scope) */
23
- scope?: any;
24
- /** array of filters to apply. Each is { table: table id, jsonql: jsonql condition with {alias} for tableAlias. Use injectAlias to correct */
25
- filters?: any;
26
- /** called with (scope) as a scope to apply to self and filter to apply to other widgets. See WidgetScoper for details */
27
- onScopeChange?: any;
28
- onRowClick?: any;
29
- /** TODO: implement refreshing */
30
- refreshKey?: any;
31
- }
32
- interface MapWidgetComponentState {
33
- editDesign: any;
34
- transientDesign: any;
35
- }
36
- declare class MapWidgetComponent extends React.Component<MapWidgetComponentProps, MapWidgetComponentState> {
37
- constructor(props: any);
38
- componentDidUpdate(prevProps: any): void;
39
- handleStartEditing: () => void;
40
- handleEndEditing: () => void;
41
- handleEditDesignChange: (design: any) => void;
42
- renderEditor(): React.CElement<import("@mwater/react-library/lib/ModalWindowComponent").ModalWindowComponentProps, ModalWindowComponent> | null;
43
- renderContent(design: any, onDesignChange: any, width: any, height: any): React.DetailedReactHTMLElement<{
44
- style: {
45
- width: any;
46
- height: any;
47
- padding: number;
48
- };
49
- }, HTMLElement>;
50
- render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
51
- }
52
- export {};
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const react_1 = __importDefault(require("react"));
30
- const R = react_1.default.createElement;
31
30
  const lodash_1 = __importDefault(require("lodash"));
32
31
  const Widget_1 = __importDefault(require("./Widget"));
33
32
  const DropdownWidgetComponent_1 = __importDefault(require("./DropdownWidgetComponent"));
@@ -49,26 +48,16 @@ class MapWidget extends Widget_1.default {
49
48
  // height: height in pixels on screen
50
49
  // onRowClick: Called with (tableId, rowId) when item is clicked
51
50
  createViewElement(options) {
52
- return react_1.default.createElement(MapWidgetComponent, {
53
- schema: options.schema,
54
- dataSource: options.dataSource,
55
- widgetDataSource: options.widgetDataSource,
56
- design: options.design,
57
- onDesignChange: options.onDesignChange,
58
- scope: options.scope,
59
- filters: options.filters,
60
- onScopeChange: options.onScopeChange,
61
- width: options.width,
62
- height: options.height,
63
- onRowClick: options.onRowClick,
64
- refreshKey: options.refreshKey
65
- });
51
+ return react_1.default.createElement(MapWidgetComponent, { schema: options.schema, dataSource: options.dataSource, widgetDataSource: options.widgetDataSource, design: options.design, onDesignChange: options.onDesignChange, scope: options.scope, filters: options.filters, onScopeChange: options.onScopeChange, width: options.width, height: options.height, onRowClick: options.onRowClick, refreshKey: options.refreshKey, locale: options.locale, translate: options.translate });
66
52
  }
67
53
  // Get a list of table ids that can be filtered on
68
54
  getFilterableTables(design, schema) {
69
55
  // Get filterable tables
70
56
  return MapUtils.getFilterableTables(design, schema);
71
57
  }
58
+ getTranslatableStrings(design, schema) {
59
+ return MapUtils.getTranslatableStrings(design, schema);
60
+ }
72
61
  }
73
62
  exports.default = MapWidget;
74
63
  class MapWidgetComponent extends react_1.default.Component {
@@ -102,53 +91,31 @@ class MapWidgetComponent extends react_1.default.Component {
102
91
  // Require here to prevent server require problems
103
92
  const MapDesignerComponent = require("../maps/MapDesignerComponent").default;
104
93
  // Create editor
105
- const editor = react_1.default.createElement(MapDesignerComponent, {
106
- schema: this.props.schema,
107
- dataSource: this.props.dataSource,
108
- design: this.state.editDesign,
109
- onDesignChange: this.handleEditDesignChange,
110
- filters: this.props.filters
111
- });
94
+ const editor = react_1.default.createElement(MapDesignerComponent, { schema: this.props.schema, dataSource: this.props.dataSource, design: this.state.editDesign, onDesignChange: this.handleEditDesignChange, filters: this.props.filters });
112
95
  // Create map (maxing out at half of width of screen)
113
- const width = Math.min(document.body.clientWidth / 2, this.props.width);
114
- const height = (this.props.height * width) / this.props.width;
96
+ const width = Math.min(document.body.clientWidth / 2, this.props.width || 0);
97
+ const height = ((this.props.height || 0) * width) / (this.props.width || 1);
115
98
  const chart = this.renderContent(this.state.editDesign, this.handleEditDesignChange, width, height);
116
- const content = R("div", { style: { height: "100%", width: "100%" } }, R("div", {
117
- style: {
118
- position: "absolute",
119
- left: 0,
120
- top: 0,
121
- border: "solid 2px #EEE",
122
- borderRadius: 8,
123
- padding: 10,
124
- width: width + 20,
125
- height: height + 20
126
- }
127
- }, chart), R("div", { style: { width: "100%", height: "100%", paddingLeft: width + 40 } }, R("div", {
128
- style: { width: "100%", height: "100%", overflowY: "auto", paddingLeft: 20, borderLeft: "solid 3px #AAA" }
129
- }, editor)));
130
- return react_1.default.createElement(ModalWindowComponent_1.default, {
131
- isOpen: true,
132
- onRequestClose: this.handleEndEditing
133
- }, content);
99
+ const content = react_1.default.createElement("div", { style: { height: "100%", width: "100%" } },
100
+ react_1.default.createElement("div", { style: {
101
+ position: "absolute",
102
+ left: 0,
103
+ top: 0,
104
+ border: "solid 2px #EEE",
105
+ borderRadius: 8,
106
+ padding: 10,
107
+ width: width + 20,
108
+ height: height + 20
109
+ } }, chart),
110
+ react_1.default.createElement("div", { style: { width: "100%", height: "100%", paddingLeft: width + 40 } },
111
+ react_1.default.createElement("div", { style: { width: "100%", height: "100%", overflowY: "auto", paddingLeft: 20, borderLeft: "solid 3px #AAA" } }, editor)));
112
+ return react_1.default.createElement(ModalWindowComponent_1.default, { isOpen: true, onRequestClose: this.handleEndEditing }, content);
134
113
  }
135
114
  renderContent(design, onDesignChange, width, height) {
136
115
  // Require here to prevent server require problems
137
116
  const { MapViewComponent } = require("../maps/MapViewComponent");
138
- return R("div", { style: { width, height, padding: 10 } }, react_1.default.createElement(MapViewComponent, {
139
- schema: this.props.schema,
140
- design,
141
- dataSource: this.props.dataSource,
142
- mapDataSource: this.props.widgetDataSource.getMapDataSource(design),
143
- onDesignChange,
144
- scope: this.props.scope,
145
- onScopeChange: this.props.onScopeChange,
146
- extraFilters: this.props.filters,
147
- width: width - 20,
148
- height: height - 20,
149
- scrollWheelZoom: false, // Prevent accidental zooming
150
- onRowClick: this.props.onRowClick
151
- }));
117
+ return react_1.default.createElement("div", { style: { width, height, padding: 10 } },
118
+ react_1.default.createElement(MapViewComponent, { schema: this.props.schema, design: design, dataSource: this.props.dataSource, mapDataSource: this.props.widgetDataSource.getMapDataSource(design), onDesignChange: onDesignChange, scope: this.props.scope, onScopeChange: this.props.onScopeChange, extraFilters: this.props.filters, width: width - 20, height: height - 20, scrollWheelZoom: false, onRowClick: this.props.onRowClick, locale: this.props.locale, translate: this.props.translate }));
152
119
  }
153
120
  render() {
154
121
  const dropdownItems = [];
@@ -157,12 +124,8 @@ class MapWidgetComponent extends react_1.default.Component {
157
124
  }
158
125
  const handleDesignChange = (d) => this.setState({ transientDesign: d });
159
126
  // Wrap in a simple widget
160
- return R("div", null, this.props.onDesignChange != null ? this.renderEditor() : undefined,
161
- // Use transient design (as it may be affected by toggling layers)
162
- react_1.default.createElement(DropdownWidgetComponent_1.default, {
163
- width: this.props.width,
164
- height: this.props.height,
165
- dropdownItems
166
- }, this.renderContent(this.state.transientDesign, handleDesignChange, this.props.width, this.props.height)));
127
+ return react_1.default.createElement("div", null,
128
+ this.props.onDesignChange != null ? this.renderEditor() : undefined,
129
+ react_1.default.createElement(DropdownWidgetComponent_1.default, { width: this.props.width, height: this.props.height, dropdownItems: dropdownItems }, this.renderContent(this.state.transientDesign, handleDesignChange, this.props.width, this.props.height)));
167
130
  }
168
131
  }
@@ -1,6 +1,9 @@
1
1
  import React from "react";
2
2
  import Widget, { CreateViewElementOptions } from "./Widget";
3
3
  import ModalWindowComponent from "@mwater/react-library/lib/ModalWindowComponent";
4
+ /** Widget for displaying markdown. Deprecated. Use TextWidget instead.
5
+ * @deprecated
6
+ */
4
7
  export default class MarkdownWidget extends Widget {
5
8
  createViewElement(options: CreateViewElementOptions): React.CElement<any, MarkdownWidgetComponent>;
6
9
  isAutoHeight(): boolean;
@@ -10,6 +10,9 @@ const Widget_1 = __importDefault(require("./Widget"));
10
10
  const DropdownWidgetComponent_1 = __importDefault(require("./DropdownWidgetComponent"));
11
11
  const markdown_it_1 = __importDefault(require("markdown-it"));
12
12
  const ModalWindowComponent_1 = __importDefault(require("@mwater/react-library/lib/ModalWindowComponent"));
13
+ /** Widget for displaying markdown. Deprecated. Use TextWidget instead.
14
+ * @deprecated
15
+ */
13
16
  class MarkdownWidget extends Widget_1.default {
14
17
  // Creates a React element that is a view of the widget
15
18
  // options:
@@ -1,32 +1,20 @@
1
- import PropTypes from "prop-types";
2
1
  import React from "react";
3
2
  import Widget, { CreateViewElementOptions } from "./Widget";
4
- import ModalPopupComponent from "@mwater/react-library/lib/ModalPopupComponent";
3
+ import { Schema } from "@mwater/expressions";
4
+ export interface TOCWidgetDesign {
5
+ /** Header text. Defaults to blank */
6
+ header?: string;
7
+ /** Border weight. Defaults to 0=None. 1=light, 2=medium, 3=heavy */
8
+ borderWeight?: number;
9
+ /** True/false for prepending numbering to entries (e.g. 3.4.1) */
10
+ numbering?: boolean;
11
+ }
12
+ /**
13
+ * Table of contents widget that displays the h1, h2, etc entries from all text fields in one widget
14
+ */
5
15
  export default class TOCWidget extends Widget {
6
- createViewElement(options: CreateViewElementOptions): React.CElement<any, TOCWidgetComponent>;
16
+ /** Creates a React element that is a view of the widget */
17
+ createViewElement(options: CreateViewElementOptions): React.JSX.Element;
7
18
  isAutoHeight(): boolean;
19
+ getTranslatableStrings(design: TOCWidgetDesign, schema: Schema): string[];
8
20
  }
9
- declare class TOCWidgetComponent extends React.Component {
10
- static propTypes: {
11
- design: PropTypes.Validator<object>;
12
- onDesignChange: PropTypes.Requireable<(...args: any[]) => any>;
13
- width: PropTypes.Requireable<number>;
14
- height: PropTypes.Requireable<number>;
15
- tocEntries: PropTypes.Requireable<(PropTypes.InferProps<{
16
- id: PropTypes.Requireable<any>;
17
- widgetId: PropTypes.Validator<string>;
18
- level: PropTypes.Validator<number>;
19
- text: PropTypes.Validator<string>;
20
- }> | null | undefined)[]>;
21
- onScrollToTOCEntry: PropTypes.Requireable<(...args: any[]) => any>;
22
- };
23
- constructor(props: any);
24
- handleStartEditing: () => void;
25
- handleEndEditing: () => void;
26
- renderEditor(): React.CElement<import("@mwater/react-library/lib/ModalPopupComponent").ModalPopupComponentProps, ModalPopupComponent> | null;
27
- renderContent(): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
28
- render(): React.DetailedReactHTMLElement<{
29
- onDoubleClick: () => void;
30
- }, HTMLElement>;
31
- }
32
- export {};