@mwater/visualization 5.3.1 → 5.4.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 (309) hide show
  1. package/lib/ColorComponent.d.ts +1 -1
  2. package/lib/ColorComponent.js +2 -2
  3. package/lib/CustomColorsContext.d.ts +1 -1
  4. package/lib/DateRangeComponent.js +10 -10
  5. package/lib/LocaleContextInjector.js +2 -2
  6. package/lib/MWaterAddRelatedFormComponent.js +8 -8
  7. package/lib/MWaterAddRelatedIndicatorComponent.d.ts +0 -1
  8. package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
  9. package/lib/MWaterAssetSystemsListComponent.d.ts +3 -3
  10. package/lib/MWaterAssetSystemsListComponent.js +4 -3
  11. package/lib/MWaterCompleteTableSelectComponent.d.ts +33 -34
  12. package/lib/MWaterCompleteTableSelectComponent.js +39 -38
  13. package/lib/MWaterCustomTablesetListComponent.d.ts +3 -3
  14. package/lib/MWaterCustomTablesetListComponent.js +5 -4
  15. package/lib/MWaterGlobalFiltersComponent.js +4 -4
  16. package/lib/MWaterLoaderComponent.d.ts +5 -5
  17. package/lib/MWaterLoaderComponent.js +1 -1
  18. package/lib/MWaterMetricsTableListComponent.d.ts +3 -3
  19. package/lib/MWaterMetricsTableListComponent.js +4 -3
  20. package/lib/MWaterResponsesFilterComponent.js +4 -4
  21. package/lib/MWaterTableSelectComponent.d.ts +1 -1
  22. package/lib/MWaterTableSelectComponent.js +5 -5
  23. package/lib/PopoverComponent.d.ts +4 -4
  24. package/lib/UIComponents.d.ts +5 -2
  25. package/lib/axes/AxisBuilder.js +42 -43
  26. package/lib/axes/AxisColorEditorComponent.d.ts +4 -4
  27. package/lib/axes/AxisColorEditorComponent.js +25 -60
  28. package/lib/axes/AxisComponent.d.ts +2 -3
  29. package/lib/axes/AxisComponent.js +20 -20
  30. package/lib/axes/BinsComponent.js +6 -6
  31. package/lib/axes/CategoryMapComponent.d.ts +2 -1
  32. package/lib/axes/CategoryMapComponent.js +7 -5
  33. package/lib/axes/ColorPaletteCollectionComponent.js +9 -9
  34. package/lib/axes/RangesComponent.js +12 -12
  35. package/lib/compressJson.js +1 -1
  36. package/lib/dashboards/DashboardComponent.d.ts +2 -0
  37. package/lib/dashboards/DashboardComponent.js +15 -8
  38. package/lib/dashboards/DashboardUtils.js +2 -3
  39. package/lib/dashboards/DashboardViewComponent.js +4 -4
  40. package/lib/dashboards/FontStyleEditor.js +8 -8
  41. package/lib/dashboards/LayoutOptionsComponent.js +102 -75
  42. package/lib/dashboards/SettingsModalComponent.d.ts +3 -4
  43. package/lib/dashboards/SettingsModalComponent.js +54 -40
  44. package/lib/dashboards/WidgetComponent.d.ts +0 -1
  45. package/lib/dashboards/WidgetComponent.js +1 -2
  46. package/lib/dashboards/layoutOptions.js +11 -7
  47. package/lib/datagrids/DatagridComponent.d.ts +1 -8
  48. package/lib/datagrids/DatagridComponent.js +14 -13
  49. package/lib/datagrids/DatagridDesignerComponent.js +18 -18
  50. package/lib/datagrids/DatagridQueryBuilder.d.ts +4 -4
  51. package/lib/datagrids/DatagridUtils.js +2 -2
  52. package/lib/datagrids/DatagridViewComponent.js +4 -4
  53. package/lib/datagrids/ExprCellComponent.js +1 -1
  54. package/lib/datagrids/FindReplaceModalComponent.js +17 -17
  55. package/lib/datagrids/OrderBysDesignerComponent.js +2 -2
  56. package/lib/languages.js +2 -2
  57. package/lib/layouts/DecoratedBlockComponent.js +2 -2
  58. package/lib/layouts/blocks/BlocksDisplayComponent.js +13 -13
  59. package/lib/layouts/blocks/BlocksLayoutManager.d.ts +2 -1
  60. package/lib/layouts/blocks/ClipboardPaletteItemComponent.js +3 -3
  61. package/lib/layouts/blocks/HorizontalBlockComponent.js +3 -3
  62. package/lib/layouts/blocks/blockUtils.js +4 -5
  63. package/lib/mWaterLoader.js +1 -1
  64. package/lib/maps/AddLayerComponent.js +13 -13
  65. package/lib/maps/AdminScopeAndDetailLevelComponent.js +5 -5
  66. package/lib/maps/BaseLayerDesignerComponent.js +2 -2
  67. package/lib/maps/BufferLayer.js +7 -7
  68. package/lib/maps/BufferLayerDesignerComponent.js +8 -8
  69. package/lib/maps/ChoroplethLayer.js +6 -6
  70. package/lib/maps/ChoroplethLayerDesigner.js +16 -16
  71. package/lib/maps/ClusterLayer.js +3 -3
  72. package/lib/maps/ClusterLayerDesignerComponent.js +5 -5
  73. package/lib/maps/DetailLevelSelectComponent.d.ts +11 -1
  74. package/lib/maps/DetailLevelSelectComponent.js +3 -3
  75. package/lib/maps/DirectMapDataSource.js +1 -2
  76. package/lib/maps/EditHoverOver.js +7 -5
  77. package/lib/maps/EditPopupComponent.js +2 -2
  78. package/lib/maps/GridLayer.js +5 -5
  79. package/lib/maps/GridLayerDesigner.js +15 -15
  80. package/lib/maps/LayerSwitcherComponent.js +1 -2
  81. package/lib/maps/LeafletMapComponent.d.ts +1 -1
  82. package/lib/maps/LeafletMapComponent.js +1 -1
  83. package/lib/maps/LegendComponent.js +1 -1
  84. package/lib/maps/MWaterServerLayer.d.ts +0 -1
  85. package/lib/maps/MWaterServerLayer.js +1 -1
  86. package/lib/maps/MapComponent.js +8 -8
  87. package/lib/maps/MapControlComponent.js +1 -1
  88. package/lib/maps/MapDesignerComponent.js +16 -16
  89. package/lib/maps/MapFiltersDesignerComponent.js +2 -2
  90. package/lib/maps/MapLayerViewDesignerComponent.js +8 -8
  91. package/lib/maps/MapUtils.js +6 -7
  92. package/lib/maps/MapViewComponent.js +1 -2
  93. package/lib/maps/MarkerSymbolSelectComponent.js +3 -3
  94. package/lib/maps/MarkersLayer.js +6 -7
  95. package/lib/maps/MarkersLayerDesignerComponent.js +22 -22
  96. package/lib/maps/PopupFilterJoinsEditComponent.js +4 -4
  97. package/lib/maps/PopupFilterJoinsUtils.js +2 -3
  98. package/lib/maps/RasterMapViewComponent.d.ts +3 -3
  99. package/lib/maps/RasterMapViewComponent.js +4 -4
  100. package/lib/maps/RegionSelectComponent.d.ts +1 -3
  101. package/lib/maps/RegionSelectComponent.js +1 -2
  102. package/lib/maps/ScopeAndDetailLevelComponent.js +3 -3
  103. package/lib/maps/TileUrlLayer.d.ts +1 -1
  104. package/lib/maps/TileUrlLayer.js +3 -3
  105. package/lib/maps/VectorMapViewComponent.js +6 -7
  106. package/lib/maps/ZoomLevelsComponent.js +5 -5
  107. package/lib/maps/mapSymbols.d.ts +1 -1
  108. package/lib/maps/mapSymbols.js +51 -50
  109. package/lib/maps/mapboxUtils.js +2 -3
  110. package/lib/maps/maps.d.ts +0 -1
  111. package/lib/maps/vectorMaps.js +14 -15
  112. package/lib/memoizedDebounce.js +1 -2
  113. package/lib/quickfilter/DateExprComponent.d.ts +4 -0
  114. package/lib/quickfilter/DateExprComponent.js +17 -16
  115. package/lib/quickfilter/IdArrayQuickfilterComponent.js +1 -1
  116. package/lib/quickfilter/QuickfilterUtils.js +1 -2
  117. package/lib/quickfilter/QuickfiltersComponent.d.ts +23 -2
  118. package/lib/quickfilter/QuickfiltersComponent.js +2 -2
  119. package/lib/quickfilter/QuickfiltersDesignComponent.js +8 -8
  120. package/lib/quickfilter/TextLiteralComponent.d.ts +35 -2
  121. package/lib/quickfilter/TextLiteralComponent.js +6 -6
  122. package/lib/richtext/DropdownPaletteItem.js +1 -1
  123. package/lib/richtext/ExprItemsHtmlConverter.js +8 -10
  124. package/lib/richtext/FontColorPaletteItem.js +7 -7
  125. package/lib/richtext/ItemsHtmlConverter.js +0 -1
  126. package/lib/richtext/RichTextComponent.d.ts +1 -0
  127. package/lib/richtext/RichTextComponent.js +33 -29
  128. package/lib/valueFormatter.js +18 -19
  129. package/lib/wellknown.js +2 -3
  130. package/lib/widgets/IFrameWidgetComponent.d.ts +9 -1
  131. package/lib/widgets/IFrameWidgetComponent.js +3 -3
  132. package/lib/widgets/ImageUploaderComponent.js +5 -5
  133. package/lib/widgets/ImageWidget.js +2 -2
  134. package/lib/widgets/ImageWidgetComponent.d.ts +9 -1
  135. package/lib/widgets/ImageWidgetComponent.js +20 -20
  136. package/lib/widgets/ImagelistCarouselComponent.js +1 -1
  137. package/lib/widgets/MapWidget.js +2 -2
  138. package/lib/widgets/MarkdownWidget.d.ts +1 -1
  139. package/lib/widgets/MarkdownWidget.js +1 -1
  140. package/lib/widgets/TOCWidget.js +11 -12
  141. package/lib/widgets/WidgetScopesViewComponent.js +1 -1
  142. package/lib/widgets/charts/Chart.js +1 -1
  143. package/lib/widgets/charts/ChartViewComponent.js +9 -9
  144. package/lib/widgets/charts/ChartWidgetComponent.js +4 -4
  145. package/lib/widgets/charts/calendar/CalendarChart.js +4 -4
  146. package/lib/widgets/charts/calendar/CalendarChartDesignerComponent.js +7 -7
  147. package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +3 -3
  148. package/lib/widgets/charts/imagemosaic/ImageMosaicChart.d.ts +18 -5
  149. package/lib/widgets/charts/imagemosaic/ImageMosaicChart.js +3 -4
  150. package/lib/widgets/charts/imagemosaic/ImageMosaicChartDesignerComponent.js +5 -5
  151. package/lib/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.d.ts +5 -19
  152. package/lib/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.js +66 -70
  153. package/lib/widgets/charts/imagemosaic/ImagePopupComponent.js +1 -1
  154. package/lib/widgets/charts/layered/LayeredChart.d.ts +1 -1
  155. package/lib/widgets/charts/layered/LayeredChart.js +9 -9
  156. package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +8 -8
  157. package/lib/widgets/charts/layered/LayeredChartCompiler.js +15 -15
  158. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +33 -33
  159. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +16 -16
  160. package/lib/widgets/charts/layered/LayeredChartUtils.js +1 -2
  161. package/lib/widgets/charts/layered/LayeredChartViewComponent.js +4 -4
  162. package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +18 -17
  163. package/lib/widgets/charts/pivot/PivotChart.d.ts +1 -1
  164. package/lib/widgets/charts/pivot/PivotChart.js +12 -4
  165. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +5 -5
  166. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +10 -10
  167. package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +5 -5
  168. package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +1 -1
  169. package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +5 -6
  170. package/lib/widgets/charts/pivot/PivotChartUtils.js +11 -12
  171. package/lib/widgets/charts/pivot/PivotChartViewComponent.js +9 -9
  172. package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +30 -30
  173. package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +28 -26
  174. package/lib/widgets/charts/table/OrderingsComponent.js +2 -2
  175. package/lib/widgets/charts/table/TableChart.js +3 -3
  176. package/lib/widgets/charts/table/TableChartDesignerComponent.js +17 -17
  177. package/lib/widgets/charts/table/TableChartViewComponent.js +3 -3
  178. package/lib/widgets/text/ExprInsertModalComponent.d.ts +2 -3
  179. package/lib/widgets/text/ExprInsertModalComponent.js +2 -14
  180. package/lib/widgets/text/ExprItemEditorComponent.js +4 -4
  181. package/lib/widgets/text/ExprUpdateModalComponent.d.ts +2 -3
  182. package/lib/widgets/text/ExprUpdateModalComponent.js +3 -15
  183. package/lib/widgets/text/TextComponent.js +3 -3
  184. package/lib/widgets/text/TextWidget.d.ts +1 -1
  185. package/lib/widgets/text/TextWidgetComponent.js +11 -11
  186. package/lib/widgets/text/TextWidgetDesign.d.ts +2 -1
  187. package/lib/widgets/text/TextWidgetDesign.js +1 -2
  188. package/package.json +3 -3
  189. package/src/ColorComponent.tsx +2 -2
  190. package/src/DateRangeComponent.ts +10 -10
  191. package/src/LocaleContextInjector.tsx +1 -1
  192. package/src/MWaterAddRelatedFormComponent.ts +7 -7
  193. package/src/MWaterAddRelatedIndicatorComponent.ts +5 -5
  194. package/src/MWaterAssetSystemsListComponent.tsx +3 -3
  195. package/src/MWaterCompleteTableSelectComponent.tsx +36 -35
  196. package/src/MWaterCustomTablesetListComponent.tsx +4 -4
  197. package/src/MWaterGlobalFiltersComponent.ts +4 -4
  198. package/src/MWaterLoaderComponent.ts +1 -1
  199. package/src/MWaterMetricsTableListComponent.tsx +3 -3
  200. package/src/MWaterResponsesFilterComponent.ts +6 -6
  201. package/src/MWaterTableSelectComponent.tsx +6 -7
  202. package/src/axes/AxisBuilder.ts +42 -44
  203. package/src/axes/AxisColorEditorComponent.tsx +178 -0
  204. package/src/axes/AxisComponent.ts +20 -20
  205. package/src/axes/BinsComponent.tsx +6 -6
  206. package/src/axes/CategoryMapComponent.ts +10 -10
  207. package/src/axes/ColorPaletteCollectionComponent.tsx +3 -3
  208. package/src/axes/RangesComponent.ts +14 -14
  209. package/src/dashboards/DashboardComponent.tsx +21 -9
  210. package/src/dashboards/DashboardViewComponent.tsx +3 -3
  211. package/src/dashboards/FontStyleEditor.tsx +8 -8
  212. package/src/dashboards/LayoutOptionsComponent.tsx +74 -74
  213. package/src/dashboards/SettingsModalComponent.tsx +134 -107
  214. package/src/dashboards/layoutOptions.tsx +5 -1
  215. package/src/datagrids/DatagridComponent.ts +65 -62
  216. package/src/datagrids/DatagridDesignerComponent.tsx +17 -17
  217. package/src/datagrids/DatagridUtils.ts +2 -2
  218. package/src/datagrids/DatagridViewComponent.ts +3 -3
  219. package/src/datagrids/ExprCellComponent.ts +1 -1
  220. package/src/datagrids/FindReplaceModalComponent.ts +13 -13
  221. package/src/datagrids/OrderBysDesignerComponent.tsx +2 -2
  222. package/src/globals.d.ts +7 -1
  223. package/src/languages.ts +2 -2
  224. package/src/layouts/blocks/BlocksDisplayComponent.tsx +13 -13
  225. package/src/layouts/blocks/BlocksLayoutManager.ts +3 -2
  226. package/src/layouts/blocks/ClipboardPaletteItemComponent.ts +3 -3
  227. package/src/maps/AddLayerComponent.ts +13 -13
  228. package/src/maps/AdminScopeAndDetailLevelComponent.ts +5 -5
  229. package/src/maps/BaseLayerDesignerComponent.ts +8 -8
  230. package/src/maps/BufferLayer.ts +5 -5
  231. package/src/maps/BufferLayerDesignerComponent.ts +8 -8
  232. package/src/maps/ChoroplethLayer.ts +3 -3
  233. package/src/maps/ChoroplethLayerDesigner.tsx +16 -16
  234. package/src/maps/ClusterLayer.ts +3 -3
  235. package/src/maps/ClusterLayerDesignerComponent.ts +5 -5
  236. package/src/maps/DetailLevelSelectComponent.ts +3 -3
  237. package/src/maps/EditHoverOver.tsx +5 -5
  238. package/src/maps/EditPopupComponent.ts +2 -2
  239. package/src/maps/GridLayer.ts +5 -5
  240. package/src/maps/GridLayerDesigner.tsx +15 -16
  241. package/src/maps/MWaterServerLayer.ts +1 -1
  242. package/src/maps/MapComponent.ts +6 -6
  243. package/src/maps/MapControlComponent.ts +1 -1
  244. package/src/maps/MapDesignerComponent.tsx +20 -20
  245. package/src/maps/MapFiltersDesignerComponent.tsx +3 -3
  246. package/src/maps/MapLayerViewDesignerComponent.ts +9 -9
  247. package/src/maps/MarkerSymbolSelectComponent.ts +4 -5
  248. package/src/maps/MarkersLayerDesignerComponent.ts +22 -22
  249. package/src/maps/PopupFilterJoinsEditComponent.ts +4 -4
  250. package/src/maps/RasterMapViewComponent.ts +2 -2
  251. package/src/maps/RegionSelectComponent.ts +1 -2
  252. package/src/maps/ScopeAndDetailLevelComponent.ts +3 -3
  253. package/src/maps/TileUrlLayer.tsx +3 -3
  254. package/src/maps/VectorMapViewComponent.tsx +5 -5
  255. package/src/maps/ZoomLevelsComponent.ts +6 -6
  256. package/src/maps/mapSymbols.ts +49 -49
  257. package/src/maps/vectorMaps.tsx +2 -2
  258. package/src/quickfilter/DateExprComponent.ts +19 -18
  259. package/src/quickfilter/IdArrayQuickfilterComponent.ts +1 -1
  260. package/src/quickfilter/QuickfiltersComponent.ts +1 -1
  261. package/src/quickfilter/QuickfiltersDesignComponent.tsx +9 -9
  262. package/src/quickfilter/TextLiteralComponent.ts +4 -4
  263. package/src/richtext/DropdownPaletteItem.tsx +1 -1
  264. package/src/richtext/ExprItemsHtmlConverter.ts +8 -10
  265. package/src/richtext/ItemsHtmlConverter.ts +0 -1
  266. package/src/richtext/RichTextComponent.tsx +31 -31
  267. package/src/valueFormatter.ts +14 -14
  268. package/src/widgets/IFrameWidgetComponent.ts +3 -3
  269. package/src/widgets/ImageUploaderComponent.tsx +5 -5
  270. package/src/widgets/ImageWidget.ts +2 -2
  271. package/src/widgets/ImageWidgetComponent.ts +26 -26
  272. package/src/widgets/ImagelistCarouselComponent.ts +2 -2
  273. package/src/widgets/MapWidget.ts +1 -1
  274. package/src/widgets/MarkdownWidget.ts +1 -1
  275. package/src/widgets/TOCWidget.ts +13 -14
  276. package/src/widgets/WidgetScopesViewComponent.ts +1 -1
  277. package/src/widgets/charts/Chart.ts +1 -1
  278. package/src/widgets/charts/ChartViewComponent.ts +4 -4
  279. package/src/widgets/charts/ChartWidgetComponent.tsx +3 -3
  280. package/src/widgets/charts/calendar/CalendarChart.ts +4 -4
  281. package/src/widgets/charts/calendar/CalendarChartDesignerComponent.ts +7 -7
  282. package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +2 -2
  283. package/src/widgets/charts/imagemosaic/ImageMosaicChart.ts +25 -8
  284. package/src/widgets/charts/imagemosaic/ImageMosaicChartDesignerComponent.ts +5 -5
  285. package/src/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.tsx +128 -0
  286. package/src/widgets/charts/layered/LayeredChart.ts +9 -9
  287. package/src/widgets/charts/layered/LayeredChartCompiler.ts +45 -45
  288. package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +39 -39
  289. package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +18 -19
  290. package/src/widgets/charts/layered/LayeredChartViewComponent.ts +1 -1
  291. package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +22 -23
  292. package/src/widgets/charts/pivot/PivotChart.ts +15 -5
  293. package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +12 -12
  294. package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +5 -5
  295. package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +7 -8
  296. package/src/widgets/charts/pivot/PivotChartViewComponent.tsx +6 -6
  297. package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +30 -30
  298. package/src/widgets/charts/table/OrderingsComponent.tsx +2 -2
  299. package/src/widgets/charts/table/TableChart.ts +3 -3
  300. package/src/widgets/charts/table/TableChartDesignerComponent.ts +16 -16
  301. package/src/widgets/charts/table/TableChartViewComponent.ts +2 -2
  302. package/src/widgets/text/{ExprInsertModalComponent.ts → ExprInsertModalComponent.tsx} +18 -20
  303. package/src/widgets/text/ExprItemEditorComponent.tsx +4 -4
  304. package/src/widgets/text/{ExprUpdateModalComponent.ts → ExprUpdateModalComponent.tsx} +18 -20
  305. package/src/widgets/text/TextComponent.tsx +2 -2
  306. package/src/widgets/text/TextWidgetComponent.tsx +10 -10
  307. package/src/widgets/text/TextWidgetDesign.ts +3 -1
  308. package/src/axes/AxisColorEditorComponent.ts +0 -210
  309. package/src/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.ts +0 -117
@@ -0,0 +1,128 @@
1
+ import React from "react"
2
+ import _ from "lodash"
3
+ import { useCallback, useRef, useState, useEffect } from "react"
4
+ import { LazyLoadComponent as LazyLoad } from "react-lazy-load-image-component"
5
+ import RotationAwareImageComponent from "@mwater/forms/lib/RotationAwareImageComponent"
6
+ import ImagePopupComponent from "./ImagePopupComponent"
7
+ import { DataSource } from "@mwater/expressions"
8
+ import { ImageMosaicChartDesign } from "./ImageMosaicChart"
9
+
10
+ export interface ImageMosaicChartViewComponentProps {
11
+ /** Design of chart */
12
+ design: ImageMosaicChartDesign
13
+ /** Data that the chart has requested. In format [image: {image data or imagelist data}] */
14
+ data: any
15
+
16
+ /** Data source to use */
17
+ dataSource: DataSource
18
+
19
+ width?: number
20
+ height?: number
21
+ onRowClick?: any
22
+ }
23
+
24
+ /** Creates an image mosaic chart */
25
+ function ImageMosaicChartViewComponent(props: ImageMosaicChartViewComponentProps) {
26
+ const { design, data, dataSource, width, height, onRowClick } = props
27
+ const imagePopupRef = useRef<ImagePopupComponent | null>(null)
28
+ const [isPrinting, setIsPrinting] = useState(false)
29
+
30
+ useEffect(() => {
31
+ const mediaQueryList = window.matchMedia('print')
32
+ const handlePrintChange = (mql: MediaQueryListEvent) => {
33
+ setIsPrinting(mql.matches)
34
+ }
35
+
36
+ mediaQueryList.addEventListener('change', handlePrintChange)
37
+ return () => {
38
+ mediaQueryList.removeEventListener('change', handlePrintChange)
39
+ }
40
+ }, [])
41
+
42
+ const handleClick = useCallback((primaryKey: any, image: any) => {
43
+ if (onRowClick) {
44
+ return onRowClick(design.table, primaryKey)
45
+ } else {
46
+ return imagePopupRef.current?.show(image)
47
+ }
48
+ }, [onRowClick, design.table])
49
+
50
+ // Render a single image
51
+ const renderImage = useCallback((primaryKey: any, image: any, imageManager: any) => {
52
+ const imageComponent = (
53
+ <RotationAwareImageComponent
54
+ imageManager={imageManager}
55
+ image={image}
56
+ thumbnail={true}
57
+ height={120}
58
+ width={80}
59
+ onClick={() => handleClick(primaryKey, image)}
60
+ />
61
+ )
62
+
63
+ // DISABLED PRINTING AS WAS CRASHING CHROME
64
+ return isPrinting && false ? (
65
+ <div style={{ display: "inline-block", minWidth: "50px" }} key={image.id}>{imageComponent}</div>
66
+ ) : (
67
+ <LazyLoad key={image.id}>{imageComponent}</LazyLoad>
68
+ )
69
+ }, [handleClick, isPrinting])
70
+
71
+ // Render images
72
+ const renderImages = useCallback((imageManager: any) => {
73
+ const result = []
74
+ for (let row of data) {
75
+ let imageObj = row.image
76
+
77
+ // Ignore nulls (https://github.com/mWater/mwater-server/issues/202)
78
+ if (!imageObj) {
79
+ continue
80
+ }
81
+
82
+ if (_.isString(imageObj)) {
83
+ imageObj = JSON.parse(imageObj)
84
+ }
85
+
86
+ if (_.isArray(imageObj)) {
87
+ result.push(imageObj.map((image) => renderImage(row.id, image, imageManager)))
88
+ } else {
89
+ result.push(renderImage(row.id, imageObj, imageManager))
90
+ }
91
+ }
92
+ return result
93
+ }, [data, renderImage])
94
+
95
+ const titleStyle = {
96
+ textAlign: "center",
97
+ fontSize: "14px",
98
+ fontWeight: "bold"
99
+ } as React.CSSProperties
100
+
101
+ const style = {
102
+ width,
103
+ height,
104
+ position: "relative",
105
+ overflowY: "auto"
106
+ } as React.CSSProperties
107
+
108
+ const title = design.titleText
109
+
110
+ const imageManager = {
111
+ getImageThumbnailUrl: (id: any, success: any, error: any) => success(dataSource.getImageUrl(id, 100)),
112
+ getImageUrl: (id: any, success: any, error: any) => success(dataSource.getImageUrl(id))
113
+ }
114
+
115
+ return (
116
+ <div style={style} className="image-mosaic">
117
+ {title && <p style={titleStyle}>{title}</p>}
118
+
119
+ <ImagePopupComponent
120
+ ref={imagePopupRef}
121
+ imageManager={imageManager}
122
+ />
123
+ <div>{renderImages(imageManager)}</div>
124
+ </div>
125
+ )
126
+ }
127
+
128
+ export default ImageMosaicChartViewComponent
@@ -110,7 +110,7 @@ export default class LayeredChart extends Chart {
110
110
  )
111
111
 
112
112
  if (xAxisTypes.length > 1) {
113
- return "All x axes must be of same type"
113
+ return T`All x axes must be of same type`
114
114
  }
115
115
 
116
116
  for (
@@ -122,19 +122,19 @@ export default class LayeredChart extends Chart {
122
122
 
123
123
  // Check that has table
124
124
  if (!layer.table) {
125
- return "Missing data source"
125
+ return T`Missing data source`
126
126
  }
127
127
 
128
128
  // Check that has y axis
129
129
  if (!layer.axes.y) {
130
- return "Missing Y Axis"
130
+ return T`Missing Y Axis`
131
131
  }
132
132
 
133
133
  if (!layer.axes.x && compiler.isXAxisRequired(design, layerId)) {
134
- return "Missing X Axis"
134
+ return T`Missing X Axis`
135
135
  }
136
136
  if (!layer.axes.color && compiler.isColorAxisRequired(design, layerId)) {
137
- return "Missing Color Axis"
137
+ return T`Missing Color Axis`
138
138
  }
139
139
 
140
140
  error = null
@@ -258,7 +258,7 @@ export default class LayeredChart extends Chart {
258
258
  design = this.cleanDesign(design, schema)
259
259
  return widgetDataSource.getData(design, filters, (err: any, data: any) => {
260
260
  if (err) {
261
- return alert("Unable to load data")
261
+ return alert(T`Unable to load data`)
262
262
  } else {
263
263
  return LayeredChartSvgFileSaver.save(design, data, schema, format)
264
264
  }
@@ -271,8 +271,8 @@ export default class LayeredChart extends Chart {
271
271
  }
272
272
 
273
273
  return [
274
- { label: "Save as SVG", onClick: save.bind(null, "svg") },
275
- { label: "Save as PNG", onClick: save.bind(null, "png") }
274
+ { label: T`Save as SVG`, onClick: save.bind(null, "svg") },
275
+ { label: T`Save as PNG`, onClick: save.bind(null, "png") }
276
276
  ]
277
277
  }
278
278
 
@@ -284,7 +284,7 @@ export default class LayeredChart extends Chart {
284
284
 
285
285
  // Only allow if either all layers have x axis or one layer
286
286
  if (!design.layers.every((layer) => layer.axes.x != null) && design.layers.length > 1) {
287
- throw new Error("Cannot export multi-layer charts without x axis")
287
+ throw new Error(T`Cannot export multi-layer charts without x axis`)
288
288
  }
289
289
 
290
290
  for (let layerNum = 0; layerNum < design.layers.length; layerNum++) {
@@ -378,8 +378,8 @@ export default class LayeredChartCompiler {
378
378
  if (options.design.labels) {
379
379
  // same color values gets hidden!! https://github.com/naver/billboard.js/issues/871
380
380
  chartDesign.data!.labels = {
381
- colors: chartDesign.data!.columns!.reduce((a, c) => {
382
- a[c[0] as string] = "#000"
381
+ colors: chartDesign.data!.columns!.reduce((a: any, c: any) => {
382
+ a[c[0]] = "var(--chart-text-color)"
383
383
  return a
384
384
  }, {})
385
385
  }
@@ -435,7 +435,7 @@ export default class LayeredChartCompiler {
435
435
  // # If x axis is year only, display year in ticks
436
436
  // if options.design.layers[0]?.axes.x?.xform?.type == "year"
437
437
  // chartDesign.axis.x.tick.format = (x) -> if _.isDate(x) then x.getFullYear() else x
438
- console.log(chartDesign)
438
+ // console.log(chartDesign)
439
439
  return chartDesign
440
440
  }
441
441
 
@@ -476,11 +476,11 @@ export default class LayeredChartCompiler {
476
476
  compileDataPolar(design: LayeredChartDesign, data: C3ChartData, locale: any): C3Data {
477
477
  let order: "asc" | "desc" | null
478
478
  const columns: any = []
479
- const types = {}
480
- const names = {}
481
- const dataMap = {}
482
- const colors = {}
483
- const format = {}
479
+ const types: { [key: string]: ChartTypes } = {}
480
+ const names: Record<string, string> = {}
481
+ const dataMap: Record<string, { layerIndex: number; row: any }> = {}
482
+ const colors: Record<string, string> = {}
483
+ const format: Record<string, (value: any) => string> = {}
484
484
 
485
485
  // For each layer
486
486
  _.each(design.layers, (layer, layerIndex) => {
@@ -492,7 +492,7 @@ export default class LayeredChartCompiler {
492
492
  const categories = this.axisBuilder.getCategories(layer.axes.color, _.pluck(layerData, "color"), { locale })
493
493
 
494
494
  // Get indexed ordering of categories (lookup from value to index) without removing excluded values
495
- const categoryOrder = _.zipObject(_.map(categories, (c, i) => [c.value, i]))
495
+ const categoryOrder: Record<string, number> = _.zipObject(_.map(categories, (c, i) => [c.value, i]))
496
496
 
497
497
  // Sort by category order
498
498
  layerData = _.sortBy(layerData, row => categoryOrder[row.color])
@@ -528,7 +528,7 @@ export default class LayeredChartCompiler {
528
528
  types[series] = this.getLayerType(design, layerIndex)
529
529
 
530
530
  // Name is name of entire layer
531
- names[series] = layer.name || (design.layers.length === 1 ? "Value" : `Series ${layerIndex + 1}`)
531
+ names[series] = layer.name || (design.layers.length === 1 ? T`Value` : T`Series ${layerIndex + 1}`)
532
532
  dataMap[series] = { layerIndex, row }
533
533
  format[series] = (value: any) =>
534
534
  value != null ? this.axisBuilder.formatValue(layer.axes.y!, value, locale, true) : ""
@@ -568,15 +568,15 @@ export default class LayeredChartCompiler {
568
568
  // Compiles data for a chart like line or scatter that does not have a categorical x axis
569
569
  compileDataNonCategorical(design: LayeredChartDesign, data: C3ChartData, locale?: string): C3Data {
570
570
  const columns: any = []
571
- const types = {}
572
- const names = {}
573
- const dataMap = {}
574
- const colors = {}
575
- const xs = {}
571
+ const types: { [key: string]: ChartTypes } = {}
572
+ const names: Record<string, string> = {}
573
+ const dataMap: Record<string, { layerIndex: number; row: any }> = {}
574
+ const colors: Record<string, string> = {}
575
+ const xs: Record<string, string> = {}
576
576
  let groups: any = []
577
- const format = {}
577
+ const format: Record<string, (value: any) => string> = {}
578
578
  const legendHide: any = [] // Which series to hide
579
- const classes = {} // Custom classes to add to series
579
+ const classes: Record<string, string> = {} // Custom classes to add to series
580
580
 
581
581
  const xType = this.axisBuilder.getAxisType(design.layers[0].axes.x)
582
582
 
@@ -603,7 +603,7 @@ export default class LayeredChartCompiler {
603
603
  const categories = this.axisBuilder.getCategories(layer.axes.color, colorValues, { locale })
604
604
 
605
605
  // Get indexed ordering of categories (lookup from value to index) without removing excluded values
606
- const categoryOrder = _.zipObject(_.map(categories, (c, i) => [c.value, i]))
606
+ const categoryOrder: Record<string, number> = _.zipObject(_.map(categories, (c, i) => [c.value, i]))
607
607
 
608
608
  // Sort
609
609
  colorValues = _.sortBy(colorValues, v => categoryOrder[v])
@@ -654,7 +654,7 @@ export default class LayeredChartCompiler {
654
654
  columns.push([seriesX].concat(xValues))
655
655
 
656
656
  types[seriesY] = this.getLayerType(design, layerIndex)
657
- names[seriesY] = layer.name || (design.layers.length === 1 ? "Value" : `Series ${layerIndex + 1}`)
657
+ names[seriesY] = layer.name || (design.layers.length === 1 ? T`Value` : T`Series ${layerIndex + 1}`)
658
658
  xs[seriesY] = seriesX
659
659
  colors[seriesY] = layer.color || defaultColors[layerIndex]
660
660
  format[seriesY] = (value: any) =>
@@ -670,7 +670,7 @@ export default class LayeredChartCompiler {
670
670
  const trendlineSeries = seriesY + ":trendline"
671
671
  columns.push([trendlineSeries].concat(calculateLinearRegression(yValues, xValues)))
672
672
  types[trendlineSeries] = line()
673
- names[trendlineSeries] = names[seriesY] + " Trendline"
673
+ names[trendlineSeries] = names[seriesY] + T` Trendline`
674
674
  xs[trendlineSeries] = seriesX
675
675
  colors[trendlineSeries] = layer.color || defaultColors[layerIndex]
676
676
  legendHide.push(trendlineSeries) // Hide in legend
@@ -756,16 +756,16 @@ export default class LayeredChartCompiler {
756
756
  compileDataCategorical(design: LayeredChartDesign, data: C3ChartData, locale?: string): C3Data {
757
757
  let categoryXs: any
758
758
  const columns: any[][] = []
759
- const types = {}
760
- const names = {}
761
- const dataMap = {}
762
- const colors = {}
763
- const xs = {}
759
+ const types: { [key: string]: ChartTypes } = {}
760
+ const names: Record<string, string> = {}
761
+ const dataMap: Record<string, { layerIndex: number; row: any }> = {}
762
+ const colors: Record<string, string> = {}
763
+ const xs: Record<string, string> = {}
764
764
  let groups: any[][] = []
765
- const format = {}
766
- const colorOverrides = {} // Mapping of "<layer>:<index>" to color if overridden
765
+ const format: Record<string, (value: any) => string> = {}
766
+ const colorOverrides: Record<string, string> = {} // Mapping of "<layer>:<index>" to color if overridden
767
767
  const legendHide: any = [] // Which series to hide
768
- const classes = {} // Custom classes to add to series
768
+ const classes: Record<string, string> = {} // Custom classes to add to series
769
769
 
770
770
  // Get all values of the x-axis, taking into account values that might be missing
771
771
  const xAxis: Axis = _.extend({}, design.layers[0].axes.x)
@@ -789,7 +789,7 @@ export default class LayeredChartCompiler {
789
789
  })
790
790
 
791
791
  // Get indexed ordering of categories (lookup from value to index) without removing excluded values
792
- const categoryOrder = _.zipObject(_.map(categories, (c, i) => [c.value, i]))
792
+ const categoryOrder: Record<string, number> = _.zipObject(_.map(categories, (c, i) => [c.value, i]))
793
793
 
794
794
  // Exclude excluded values
795
795
  categories = _.filter(categories, category => !_.includes(xAxis.excludedValues || [], category.value))
@@ -802,7 +802,7 @@ export default class LayeredChartCompiler {
802
802
  }
803
803
 
804
804
  // Create map of category value to index
805
- const categoryMap = _.object(_.map(categories, (c, i) => [c.value, i]))
805
+ const categoryMap: Record<string, number> = _.object(_.map(categories, (c, i) => [c.value, i]))
806
806
 
807
807
  // Create common x series
808
808
  columns.push(["x"].concat(_.map(categories, category => this.axisBuilder.formatCategory(xAxis, category))))
@@ -844,7 +844,7 @@ export default class LayeredChartCompiler {
844
844
  const colorCategories = this.axisBuilder.getCategories(layer.axes.color, colorValues, { locale })
845
845
 
846
846
  // Get indexed ordering of categories (lookup from value to index) without removing excluded values
847
- const colorCategoryOrder = _.zipObject(_.map(colorCategories, (c, i) => [c.value, i]))
847
+ const colorCategoryOrder: Record<string, number> = _.zipObject(_.map(colorCategories, (c, i) => [c.value, i]))
848
848
 
849
849
  // Sort
850
850
  colorValues = _.sortBy(colorValues, v => colorCategoryOrder[v])
@@ -1035,7 +1035,7 @@ export default class LayeredChartCompiler {
1035
1035
  legendHide,
1036
1036
  classes,
1037
1037
  xAxisType: "category",
1038
- xAxisTickFit: xType !== "date", // Put a tick for each point since categorical unless date
1038
+ xAxisTickFit: xType !== "date" || xAxis.xform?.type != "date", // Put a tick for each point since categorical unless untransformed date which has too many ticks
1039
1039
  xAxisTickMultiline: design.xAxisTickMultiline,
1040
1040
  xAxisLabelText: this.compileXAxisLabelText(design, locale),
1041
1041
  yAxisLabelText: this.compileYAxisLabelText(design, locale),
@@ -1074,7 +1074,7 @@ export default class LayeredChartCompiler {
1074
1074
  }
1075
1075
 
1076
1076
  // Get layer type, defaulting to overall type
1077
- getLayerType(design: any, layerIndex: any) {
1077
+ getLayerType(design: LayeredChartDesign, layerIndex: number) {
1078
1078
  // Special handling for mocha tests where chartTypes has all undefined values
1079
1079
  // See https://github.com/mWater/mwater-visualization/issues/453#issuecomment-1103671467
1080
1080
  const chartTypeString = design.layers[layerIndex].type || design.type
@@ -1084,22 +1084,22 @@ export default class LayeredChartCompiler {
1084
1084
  return chartTypeString
1085
1085
  }
1086
1086
 
1087
- getLayerTypeString(design: any, layerIndex: any) {
1087
+ getLayerTypeString(design: LayeredChartDesign, layerIndex: number) {
1088
1088
  return design.layers[layerIndex].type || design.type
1089
1089
  }
1090
1090
 
1091
1091
  // Determine if layer required grouping by x (and color)
1092
- doesLayerNeedGrouping(design: any, layerIndex: any) {
1092
+ doesLayerNeedGrouping(design: LayeredChartDesign, layerIndex: number) {
1093
1093
  return this.getLayerTypeString(design, layerIndex) !== "scatter"
1094
1094
  }
1095
1095
 
1096
1096
  // Determine if layer can use x axis
1097
- canLayerUseXExpr(design: any, layerIndex: any) {
1097
+ canLayerUseXExpr(design: LayeredChartDesign, layerIndex: number) {
1098
1098
  let needle
1099
1099
  return (needle = this.getLayerTypeString(design, layerIndex)), !["pie", "donut"].includes(needle)
1100
1100
  }
1101
1101
 
1102
- isXAxisRequired(design: any, layerIndex: any) {
1102
+ isXAxisRequired(design: LayeredChartDesign) {
1103
1103
  let needle
1104
1104
  return _.any(
1105
1105
  design.layers,
@@ -1107,12 +1107,12 @@ export default class LayeredChartCompiler {
1107
1107
  )
1108
1108
  }
1109
1109
 
1110
- isColorAxisRequired(design: any, layerIndex: any) {
1110
+ isColorAxisRequired(design: LayeredChartDesign, layerIndex: number) {
1111
1111
  let needle
1112
1112
  return (needle = this.getLayerTypeString(design, layerIndex)), ["pie", "donut"].includes(needle)
1113
1113
  }
1114
1114
 
1115
- compileDefaultTitleText(design: any, locale: any) {
1115
+ compileDefaultTitleText(design: LayeredChartDesign, locale?: string) {
1116
1116
  // Don't default this for now
1117
1117
  return ""
1118
1118
  }
@@ -1121,8 +1121,8 @@ export default class LayeredChartCompiler {
1121
1121
  // else
1122
1122
  // return @compileYAxisLabelText(design) + " by " + @axisBuilder.summarizeAxis(design.layers[0].axes.color)
1123
1123
 
1124
- compileDefaultYAxisLabelText(design: any, locale?: string) {
1125
- return this.axisBuilder.summarizeAxis(design.layers[0].axes.y, locale)
1124
+ compileDefaultYAxisLabelText(design: LayeredChartDesign, locale?: string) {
1125
+ return this.axisBuilder.summarizeAxis(design.layers[0].axes.y!, locale)
1126
1126
  }
1127
1127
 
1128
1128
  compileDefaultXAxisLabelText(design: any, locale?: string) {
@@ -1189,7 +1189,7 @@ export default class LayeredChartCompiler {
1189
1189
 
1190
1190
  names.push(
1191
1191
  this.axisBuilder.summarizeAxis(layer.axes.x, locale) +
1192
- " includes " +
1192
+ ` ${T`includes`} ` +
1193
1193
  this.exprUtils.stringifyExprLiteral(layer.axes.x.expr, [row.x], locale)
1194
1194
  )
1195
1195
  data.x = row.x
@@ -1210,7 +1210,7 @@ export default class LayeredChartCompiler {
1210
1210
  filterExprs.push(this.axisBuilder.createValueFilterExpr(layer.axes.color, row.color))
1211
1211
  names.push(
1212
1212
  this.axisBuilder.summarizeAxis(layer.axes.color, locale) +
1213
- " is " +
1213
+ ` ${T`is`} ` +
1214
1214
  this.axisBuilder.formatValue(layer.axes.color, row.color, locale, true)
1215
1215
  )
1216
1216
  data.color = row.color
@@ -1240,7 +1240,7 @@ export default class LayeredChartCompiler {
1240
1240
  }
1241
1241
 
1242
1242
  const scope: WidgetScope = {
1243
- name: ExprUtils.localizeString(this.schema.getTable(layer.table)!.name, locale) + " " + names.join(" and "),
1243
+ name: ExprUtils.localizeString(this.schema.getTable(layer.table)!.name, locale) + " " + names.join(` ${T`and`} `),
1244
1244
  filter,
1245
1245
  filterExpr,
1246
1246
  data
@@ -1252,7 +1252,7 @@ export default class LayeredChartCompiler {
1252
1252
  // Converts a series of rows to have cumulative y axis, separating out by color axis if present
1253
1253
  makeRowsCumulative(rows: any) {
1254
1254
  // Indexed by color
1255
- const totals = {}
1255
+ const totals: Record<string, number> = {}
1256
1256
 
1257
1257
  const newRows = []
1258
1258
  for (let row of rows) {