@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
@@ -50,7 +50,7 @@ const MWaterCustomTablesetListComponent = (props) => {
50
50
  // Remove from extra tables
51
51
  const match = props.extraTables.find((t) => (t || "").startsWith(`custom.${ts.code}.`));
52
52
  if (match) {
53
- if (confirm("Remove this set of tables? Some widgets may not work correctly.")) {
53
+ if (confirm(T `Remove this set of tables? Some widgets may not work correctly.`)) {
54
54
  props.onChange(null);
55
55
  props.onExtraTableRemove(match);
56
56
  }
@@ -59,7 +59,8 @@ const MWaterCustomTablesetListComponent = (props) => {
59
59
  if (!tablesets || extraTableNeeded) {
60
60
  return (react_2.default.createElement("div", null,
61
61
  react_2.default.createElement("i", { className: "fa fa-spin fa-spinner" }),
62
- " Loading..."));
62
+ " ",
63
+ T `Loading...`));
63
64
  }
64
65
  const renderTableset = (ts) => {
65
66
  const name = expressions_1.ExprUtils.localizeString(ts.design.name, props.locale) || "";
@@ -85,9 +86,9 @@ const MWaterCustomTablesetListComponent = (props) => {
85
86
  };
86
87
  const visibleTablesets = tablesets.filter((ts) => (showSystem || !ts.design.system) && !ts.design.deprecated);
87
88
  return (react_2.default.createElement("div", null,
88
- react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder: "Search..." }),
89
+ react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder: T `Search...` }),
89
90
  visibleTablesets.map((ts) => renderTableset(ts)),
90
91
  react_2.default.createElement("div", null,
91
- react_2.default.createElement("button", { className: "btn btn-link btn-sm", onClick: () => setShowSystem(!showSystem) }, showSystem ? "Hide system tables" : "Show system tables"))));
92
+ react_2.default.createElement("button", { className: "btn btn-link btn-sm", onClick: () => setShowSystem(!showSystem) }, showSystem ? T `Hide system tables` : T `Show system tables`))));
92
93
  };
93
94
  exports.MWaterCustomTablesetListComponent = MWaterCustomTablesetListComponent;
@@ -79,22 +79,22 @@ class MWaterGlobalFiltersComponent extends react_1.default.Component {
79
79
  else {
80
80
  adminRegions = null;
81
81
  }
82
- return R("div", null, R(ui.FormGroup, { label: "Only sites managed by", labelMuted: true }, R(expressions_ui_1.IdLiteralComponent, {
82
+ return R("div", null, R(ui.FormGroup, { label: T `Only sites managed by`, labelMuted: true }, R(expressions_ui_1.IdLiteralComponent, {
83
83
  value: managedBy,
84
84
  onChange: this.handleManagedByChange,
85
85
  idTable: "groups",
86
86
  schema: this.props.schema,
87
87
  dataSource: this.props.dataSource,
88
- placeholder: "All Organizations",
88
+ placeholder: T `All Organizations`,
89
89
  multi: false,
90
90
  filter: { type: "field", tableAlias: "main", column: "canManageEntities" }
91
- })), R(ui.FormGroup, { label: "Only sites located in", labelMuted: true }, R(expressions_ui_1.IdLiteralComponent, {
91
+ })), R(ui.FormGroup, { label: T `Only sites located in`, labelMuted: true }, R(expressions_ui_1.IdLiteralComponent, {
92
92
  value: adminRegions,
93
93
  onChange: this.handleRegionsChange,
94
94
  idTable: "admin_regions",
95
95
  schema: this.props.schema,
96
96
  dataSource: this.props.dataSource,
97
- placeholder: "All Regions",
97
+ placeholder: T `All Regions`,
98
98
  multi: true,
99
99
  orderBy: [{ expr: { type: "field", tableAlias: "main", column: "level" }, direction: "asc" }]
100
100
  })));
@@ -44,11 +44,11 @@ export default class MWaterLoaderComponent extends AsyncLoadComponent<{
44
44
  load(props: any, prevProps: any, callback: any): void;
45
45
  render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.CElement<import("@mwater/react-library/lib/LoadingComponent").LoadingComponentProps, LoadingComponent> | React.CElement<{
46
46
  apiUrl: string;
47
- client?: string | undefined;
48
- user?: string | undefined;
47
+ client?: string;
48
+ user?: string;
49
49
  schema: Schema;
50
- extraTables?: string[] | undefined;
51
- onExtraTablesChange?: ((extraTables: string[]) => void) | undefined;
52
- addLayerElementFactory?: AddLayerElementFactory | undefined;
50
+ extraTables?: string[];
51
+ onExtraTablesChange?: (extraTables: string[]) => void;
52
+ addLayerElementFactory?: AddLayerElementFactory;
53
53
  }, MWaterContextComponent>;
54
54
  }
@@ -44,7 +44,7 @@ class MWaterLoaderComponent extends AsyncLoadComponent_1.default {
44
44
  origin: props.origin
45
45
  }, (error, config) => {
46
46
  if (error) {
47
- const defaultError = `Cannot load one of the forms that this depends on. Perhaps the administrator has not shared the form with you? Details: ${error.message}`;
47
+ const defaultError = T `Cannot load one of the forms that this depends on. Perhaps the administrator has not shared the form with you? Details: ${error.message}`;
48
48
  if (this.props.errorFormatter) {
49
49
  try {
50
50
  const parsedError = JSON.parse(error.message);
@@ -4,14 +4,14 @@ import React from "react";
4
4
  export declare const MWaterMetricsTableListComponent: (props: {
5
5
  apiUrl: string;
6
6
  schema: Schema;
7
- client?: string | undefined;
7
+ client?: string;
8
8
  /** User id */
9
- user?: string | undefined;
9
+ user?: string;
10
10
  /** Called with table selected */
11
11
  onChange: (tableId: string | null) => void;
12
12
  extraTables: string[];
13
13
  onExtraTableAdd: (tableId: string) => void;
14
14
  onExtraTableRemove: (tableId: string) => void;
15
15
  /** e.g. "en" */
16
- locale?: string | undefined;
16
+ locale?: string;
17
17
  }) => React.JSX.Element;
@@ -47,7 +47,7 @@ const MWaterMetricsTableListComponent = (props) => {
47
47
  // Remove from extra tables
48
48
  const match = props.extraTables.find((t) => t == `metrics:${metric._id}`);
49
49
  if (match) {
50
- if (confirm("Remove this table? Some widgets may not work correctly.")) {
50
+ if (confirm(T `Remove this table? Some widgets may not work correctly.`)) {
51
51
  props.onChange(null);
52
52
  props.onExtraTableRemove(match);
53
53
  }
@@ -56,7 +56,8 @@ const MWaterMetricsTableListComponent = (props) => {
56
56
  if (!metrics || extraTableNeeded) {
57
57
  return (react_2.default.createElement("div", null,
58
58
  react_2.default.createElement("i", { className: "fa fa-spin fa-spinner" }),
59
- " Loading..."));
59
+ " ",
60
+ T `Loading...`));
60
61
  }
61
62
  const renderMetrics = () => {
62
63
  const items = metrics
@@ -73,7 +74,7 @@ const MWaterMetricsTableListComponent = (props) => {
73
74
  return react_2.default.createElement(UIComponents_1.OptionListComponent, { items: items });
74
75
  };
75
76
  return (react_2.default.createElement("div", null,
76
- react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder: "Search..." }),
77
+ react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder: T `Search...` }),
77
78
  renderMetrics()));
78
79
  };
79
80
  exports.MWaterMetricsTableListComponent = MWaterMetricsTableListComponent;
@@ -135,11 +135,11 @@ class MWaterResponsesFilterComponent extends react_1.default.Component {
135
135
  col.join.toTable.startsWith("entities.") &&
136
136
  col.id.match(/^data:/));
137
137
  const siteColumnId = this.getSiteValue();
138
- return R("div", { style: { paddingLeft: 5, paddingTop: 5 } }, R("div", { style: { paddingBottom: 5 } }, "Data Source Options:"), R("div", { style: { paddingLeft: 5 } }, siteColumns.length > 0
139
- ? R("div", null, R("i", null, "This data source contains links to monitoring sites. Would you like to:"), R("div", { style: { paddingLeft: 8 } }, R(ui.Radio, { key: "all", value: siteColumnId, radioValue: null, onChange: this.handleSiteChange }, "Show all survey responses (even if there are more than one per site)"), lodash_1.default.map(siteColumns, (column) => {
140
- return R(ui.Radio, { key: column.id, value: siteColumnId, radioValue: column.id, onChange: this.handleSiteChange }, "Show only the latest response for each ", R("i", null, `${expressions_1.ExprUtils.localizeString(this.props.schema.getTable(column.join.toTable)?.name)}`), " in the question ", R("i", null, `'${expressions_1.ExprUtils.localizeString(column.name)}'`));
138
+ return R("div", { style: { paddingLeft: 5, paddingTop: 5 } }, R("div", { style: { paddingBottom: 5 } }, T `Data Source Options:`), R("div", { style: { paddingLeft: 5 } }, siteColumns.length > 0
139
+ ? R("div", null, R("i", null, T `This data source contains links to monitoring sites. Would you like to:`), R("div", { style: { paddingLeft: 8 } }, R(ui.Radio, { key: "all", value: siteColumnId, radioValue: null, onChange: this.handleSiteChange }, T `Show all survey responses (even if there are more than one per site)`), lodash_1.default.map(siteColumns, (column) => {
140
+ return R(ui.Radio, { key: column.id, value: siteColumnId, radioValue: column.id, onChange: this.handleSiteChange }, T `Show only the latest response for each `, R("i", null, `${expressions_1.ExprUtils.localizeString(this.props.schema.getTable(column.join.toTable)?.name)}`), T ` in the question `, R("i", null, `'${expressions_1.ExprUtils.localizeString(column.name)}'`));
141
141
  })))
142
- : undefined, R(ui.Checkbox, { value: this.isFinal(), onChange: this.handleFinalChange }, "Only include final responses (recommended)")));
142
+ : undefined, R(ui.Checkbox, { value: this.isFinal(), onChange: this.handleFinalChange }, T `Only include final responses (recommended)`)));
143
143
  }
144
144
  }
145
145
  exports.default = MWaterResponsesFilterComponent;
@@ -23,7 +23,7 @@ interface MWaterTableSelectComponentState {
23
23
  export default class MWaterTableSelectComponent extends React.Component<MWaterTableSelectComponentProps, MWaterTableSelectComponentState> {
24
24
  static contextType: React.Context<string>;
25
25
  toggleEdit: any;
26
- constructor(props: any);
26
+ constructor(props: MWaterTableSelectComponentProps);
27
27
  componentWillReceiveProps(nextProps: any): any;
28
28
  handleChange: (tableId: any) => any;
29
29
  handleTableChange: (tableId: any) => any;
@@ -86,12 +86,12 @@ class MWaterTableSelectComponent extends react_1.default.Component {
86
86
  return R("div", null,
87
87
  // Show message if loading
88
88
  this.state.pendingExtraTable
89
- ? R("div", { className: "alert alert-info", key: "pendingExtraTable" }, R("i", { className: "fa fa-spinner fa-spin" }), "\u00a0Please wait...")
89
+ ? R("div", { className: "alert alert-info", key: "pendingExtraTable" }, R("i", { className: "fa fa-spinner fa-spin" }), `\u00a0${T `Please wait...`}`)
90
90
  : undefined, R(UIComponents_1.ToggleEditComponent, {
91
91
  ref: (c) => {
92
92
  this.toggleEdit = c;
93
93
  },
94
- forceOpen: !this.props.table,
94
+ forceOpen: !this.props.table, // Must have table
95
95
  label: this.props.table
96
96
  ? expressions_1.ExprUtils.localizeString(this.props.schema.getTable(this.props.table)?.name, this.context)
97
97
  : "",
@@ -165,10 +165,10 @@ class EditModeTableSelectComponent extends react_1.default.Component {
165
165
  };
166
166
  render() {
167
167
  return (react_1.default.createElement(expressions_ui_1.ActiveTablesContext.Consumer, null, activeTables => (react_1.default.createElement("div", null,
168
- this.state.completeMode ? (react_1.default.createElement(ModalPopupComponent_1.default, { header: "Select Data Source", onClose: () => this.setState({ completeMode: false }), showCloseX: true, size: "x-large" },
168
+ this.state.completeMode ? (react_1.default.createElement(ModalPopupComponent_1.default, { header: T `Select Data Source`, onClose: () => this.setState({ completeMode: false }), showCloseX: true, size: "x-large" },
169
169
  react_1.default.createElement(MWaterCompleteTableSelectComponent_1.default, { apiUrl: this.props.apiUrl, client: this.props.client, schema: this.props.schema, user: this.props.user, table: this.props.table, onChange: this.handleCompleteChange, extraTables: this.props.extraTables, onExtraTablesChange: this.props.onExtraTablesChange }))) : null,
170
170
  this.getTableShortlist(activeTables).length > 0 ? (react_1.default.createElement(react_1.default.Fragment, null,
171
- react_1.default.createElement("div", { className: "text-muted" }, "Select Data Source:"),
171
+ react_1.default.createElement("div", { className: "text-muted" }, T `Select Data Source:`),
172
172
  react_1.default.createElement(UIComponents_1.OptionListComponent, { items: this.getTableShortlist(activeTables).map((tableId) => {
173
173
  const table = this.props.schema.getTable(tableId);
174
174
  return {
@@ -178,6 +178,6 @@ class EditModeTableSelectComponent extends react_1.default.Component {
178
178
  };
179
179
  }) }),
180
180
  react_1.default.createElement("div", null,
181
- react_1.default.createElement("button", { type: "button", className: "btn btn-link btn-sm", onClick: this.handleShowMore }, "Show All Available Data Sources...")))) : (react_1.default.createElement("button", { type: "button", className: "btn btn-link", onClick: this.handleShowMore }, "Select Data Source..."))))));
181
+ react_1.default.createElement("button", { type: "button", className: "btn btn-link btn-sm", onClick: this.handleShowMore }, T `Show All Available Data Sources...`)))) : (react_1.default.createElement("button", { type: "button", className: "btn btn-link", onClick: this.handleShowMore }, T `Select Data Source...`))))));
182
182
  }
183
183
  }
@@ -7,9 +7,9 @@ export interface PopoverComponentProps {
7
7
  visible: boolean;
8
8
  }
9
9
  export default class PopoverComponent extends React.Component<PopoverComponentProps> {
10
- componentDidMount(): Element | undefined;
11
- componentWillUnmount(): Element | undefined;
12
- componentDidUpdate(prevProps: any): Element | undefined;
13
- updatePopover(props: any, oldProps: any): Element | undefined;
10
+ componentDidMount(): any;
11
+ componentWillUnmount(): any;
12
+ componentDidUpdate(prevProps: any): any;
13
+ updatePopover(props: any, oldProps: any): any;
14
14
  render(): boolean | {} | React.ReactChild | React.ReactPortal | null | undefined;
15
15
  }
@@ -1,5 +1,4 @@
1
1
  import React, { ReactNode } from "react";
2
- import * as motion from "react-motion";
3
2
  export interface SectionComponentProps {
4
3
  icon?: string;
5
4
  label?: any;
@@ -50,7 +49,11 @@ export declare class SwitchViewComponent extends React.Component<SwitchViewCompo
50
49
  componentWillReceiveProps(nextProps: any): void;
51
50
  refCallback: (id: any, comp: any) => any;
52
51
  componentDidUpdate(prevProps: any, prevState: any): void;
53
- render(): React.CElement<motion.MotionProps, motion.Motion>;
52
+ render(): React.CElement<{
53
+ style: {};
54
+ }, React.Component<{
55
+ style: {};
56
+ }, any, any>>;
54
57
  }
55
58
  export interface ToggleEditComponentProps {
56
59
  forceOpen?: boolean;
@@ -187,26 +187,26 @@ class AxisBuilder {
187
187
  // xform validation
188
188
  if (options.axis.xform && options.axis.xform.type === "bin") {
189
189
  if (!options.axis.xform.numBins) {
190
- return "Missing numBins";
190
+ return T `Missing numBins`;
191
191
  }
192
192
  if (options.axis.xform.min == null) {
193
- return "Missing min";
193
+ return T `Missing min`;
194
194
  }
195
195
  if (options.axis.xform.max == null) {
196
- return "Missing max";
196
+ return T `Missing max`;
197
197
  }
198
198
  if (options.axis.xform.max < options.axis.xform.min) {
199
- return "Max < min";
199
+ return T `Max < min`;
200
200
  }
201
201
  }
202
202
  // xform validation
203
203
  if (options.axis.xform && options.axis.xform.type === "ranges") {
204
204
  if (!options.axis.xform.ranges || !lodash_1.default.isArray(options.axis.xform.ranges)) {
205
- return "Missing ranges";
205
+ return T `Missing ranges`;
206
206
  }
207
207
  for (let range of options.axis.xform.ranges) {
208
208
  if (range.minValue != null && range.maxValue != null && range.minValue > range.maxValue) {
209
- return "Max < min";
209
+ return T `Max < min`;
210
210
  }
211
211
  }
212
212
  }
@@ -379,8 +379,7 @@ class AxisBuilder {
379
379
  // from (select expression as val, ntile(numBins + 2) over (order by expression asc) as ntilenum
380
380
  // from the_table where exprssion is not null)
381
381
  // where inner.ntilenum > 1 and inner.ntilenum < numBins + 2
382
- // Inspired by: http://dba.stackexchange.com/questions/17086/fast-general-method-to-calculate-percentiles
383
- // expr is mwater expression on table
382
+ // Inspired by: http://dba.stackexchange.com/questions/17086/fast-general-method-to-calculate-percentiles // expr is mwater expression on table
384
383
  // filterExpr is optional filter on values to include
385
384
  // Result can be null if no query could be computed
386
385
  compileBinMinMax(expr, table, filterExpr, numBins) {
@@ -479,7 +478,7 @@ class AxisBuilder {
479
478
  */
480
479
  getCategories(axis, values, options = {}) {
481
480
  let categories, current, end, format, label, max, min, value, year;
482
- const noneCategory = { value: null, label: axis.nullLabel || "None" };
481
+ const noneCategory = { value: null, label: axis.nullLabel || T `None` };
483
482
  const hasNone = lodash_1.default.any(values || [], (v) => v == null);
484
483
  // Handle ranges
485
484
  if (axis.xform && axis.xform.type === "ranges") {
@@ -496,7 +495,7 @@ class AxisBuilder {
496
495
  }
497
496
  if (range.maxValue != null) {
498
497
  if (label) {
499
- label += " and ";
498
+ label += T ` and `;
500
499
  }
501
500
  if (range.maxOpen) {
502
501
  label += `< ${range.maxValue}`;
@@ -525,9 +524,9 @@ class AxisBuilder {
525
524
  // Special case of single value (min and max within epsilon or 0.01% of each other since epsilon might be too small to add to a big number)
526
525
  if (max - min <= epsilon || Math.abs((max - min) / (max + min)) < 0.0001) {
527
526
  return [
528
- { value: 0, label: `< ${min}` },
529
- { value: 1, label: `= ${min}` },
530
- { value: axis.xform.numBins + 1, label: `> ${min}` },
527
+ { value: 0, label: T `< ${min}` },
528
+ { value: 1, label: T `= ${min}` },
529
+ { value: axis.xform.numBins + 1, label: T `> ${min}` },
531
530
  noneCategory
532
531
  ];
533
532
  }
@@ -539,7 +538,7 @@ class AxisBuilder {
539
538
  format = d3Format.format(",." + precision + "f");
540
539
  categories = [];
541
540
  if (!axis.xform.excludeLower) {
542
- categories.push({ value: 0, label: `< ${format(min)}` });
541
+ categories.push({ value: 0, label: T `< ${format(min)}` });
543
542
  }
544
543
  for (let i = 1, end1 = numBins, asc = 1 <= end1; asc ? i <= end1 : i >= end1; asc ? i++ : i--) {
545
544
  const start = ((i - 1) / numBins) * (max - min) + min;
@@ -547,7 +546,7 @@ class AxisBuilder {
547
546
  categories.push({ value: i, label: `${format(start)} - ${format(end)}` });
548
547
  }
549
548
  if (!axis.xform.excludeUpper) {
550
- categories.push({ value: axis.xform.numBins + 1, label: `> ${format(max)}` });
549
+ categories.push({ value: axis.xform.numBins + 1, label: T `> ${format(max)}` });
551
550
  }
552
551
  categories.push(noneCategory);
553
552
  return categories;
@@ -575,18 +574,18 @@ class AxisBuilder {
575
574
  }
576
575
  if (axis.xform && axis.xform.type === "month") {
577
576
  categories = [
578
- { value: "01", label: "January" },
579
- { value: "02", label: "February" },
580
- { value: "03", label: "March" },
581
- { value: "04", label: "April" },
582
- { value: "05", label: "May" },
583
- { value: "06", label: "June" },
584
- { value: "07", label: "July" },
585
- { value: "08", label: "August" },
586
- { value: "09", label: "September" },
587
- { value: "10", label: "October" },
588
- { value: "11", label: "November" },
589
- { value: "12", label: "December" }
577
+ { value: "01", label: T `January` },
578
+ { value: "02", label: T `February` },
579
+ { value: "03", label: T `March` },
580
+ { value: "04", label: T `April` },
581
+ { value: "05", label: T `May` },
582
+ { value: "06", label: T `June` },
583
+ { value: "07", label: T `July` },
584
+ { value: "08", label: T `August` },
585
+ { value: "09", label: T `September` },
586
+ { value: "10", label: T `October` },
587
+ { value: "11", label: T `November` },
588
+ { value: "12", label: T `December` }
590
589
  ];
591
590
  // Add none if needed
592
591
  if (hasNone) {
@@ -654,7 +653,7 @@ class AxisBuilder {
654
653
  }
655
654
  if (options.onlyValuesPresent) {
656
655
  // Sort and take only present
657
- categories = lodash_1.default.sortBy(lodash_1.default.uniq(values), item => item).map(value => ({ value, label: (0, moment_1.default)(value, "YYYY-MM-DD").format("MMM YYYY") }));
656
+ categories = lodash_1.default.sortBy(lodash_1.default.uniq(values), item => item).map(value => ({ value, label: (0, moment_1.default)(value, "YYYY-MM-DD").format(T `MMM YYYY`) }));
658
657
  if (hasNone) {
659
658
  categories.push(noneCategory);
660
659
  }
@@ -668,7 +667,7 @@ class AxisBuilder {
668
667
  end = (0, moment_1.default)(max, "YYYY-MM-DD");
669
668
  categories = [];
670
669
  while (!current.isAfter(end)) {
671
- categories.push({ value: current.format("YYYY-MM-DD"), label: current.format("MMM YYYY") });
670
+ categories.push({ value: current.format("YYYY-MM-DD"), label: current.format(T `MMM YYYY`) });
672
671
  current.add(1, "months");
673
672
  if (categories.length >= 1000) {
674
673
  break;
@@ -724,16 +723,16 @@ class AxisBuilder {
724
723
  const year = value.substr(0, 4);
725
724
  const quarter = value.substr(value.length - 1, 1);
726
725
  if (quarter === "1") {
727
- label = `${year} Jan-Mar`;
726
+ label = `${year} ${T `Jan-Mar`}`;
728
727
  }
729
728
  else if (quarter === "2") {
730
- label = `${year} Apr-Jun`;
729
+ label = `${year} ${T `Apr-Jun`}`;
731
730
  }
732
731
  else if (quarter === "3") {
733
- label = `${year} Jul-Sep`;
732
+ label = `${year} ${T `Jul-Sep`}`;
734
733
  }
735
734
  else if (quarter === "4") {
736
- label = `${year} Oct-Dec`;
735
+ label = `${year} ${T `Oct-Dec`}`;
737
736
  }
738
737
  else {
739
738
  label = "";
@@ -757,16 +756,16 @@ class AxisBuilder {
757
756
  const quarter = current.format("Q");
758
757
  year = current.format("YYYY");
759
758
  if (quarter === "1") {
760
- label = `${year} Jan-Mar`;
759
+ label = `${year} ${T `Jan-Mar`}`;
761
760
  }
762
761
  else if (quarter === "2") {
763
- label = `${year} Apr-Jun`;
762
+ label = `${year} ${T `Apr-Jun`}`;
764
763
  }
765
764
  else if (quarter === "3") {
766
- label = `${year} Jul-Sep`;
765
+ label = `${year} ${T `Jul-Sep`}`;
767
766
  }
768
767
  else if (quarter === "4") {
769
- label = `${year} Oct-Dec`;
768
+ label = `${year} ${T `Oct-Dec`}`;
770
769
  }
771
770
  else {
772
771
  label = "";
@@ -812,7 +811,7 @@ class AxisBuilder {
812
811
  // Return unique values
813
812
  categories = lodash_1.default.map(lodash_1.default.compact(lodash_1.default.uniq(values || [])).sort(), (v) => ({
814
813
  value: v,
815
- label: v || "None"
814
+ label: v || T `None`
816
815
  }));
817
816
  if (hasNone) {
818
817
  categories.push(noneCategory);
@@ -820,7 +819,7 @@ class AxisBuilder {
820
819
  return categories;
821
820
  case "boolean":
822
821
  // Return unique values
823
- return [{ value: true, label: "True" }, { value: false, label: "False" }, noneCategory];
822
+ return [{ value: true, label: T `True` }, { value: false, label: T `False` }, noneCategory];
824
823
  case "date":
825
824
  values = lodash_1.default.compact(values || []);
826
825
  if (values.length === 0) {
@@ -896,7 +895,7 @@ class AxisBuilder {
896
895
  // Summarize axis as a string
897
896
  summarizeAxis(axis, locale) {
898
897
  if (!axis) {
899
- return "None";
898
+ return T `None`;
900
899
  }
901
900
  return this.exprUtils.summarizeExpr(axis.expr, locale);
902
901
  }
@@ -904,7 +903,7 @@ class AxisBuilder {
904
903
  // Get a string (or React DOM actually) representation of an axis value
905
904
  formatValue(axis, value, locale, legacyPercentFormat) {
906
905
  if (value == null) {
907
- return axis?.nullLabel || "None";
906
+ return axis?.nullLabel || T `None`;
908
907
  }
909
908
  const type = this.getAxisType(axis);
910
909
  // If has categories, use those
@@ -921,7 +920,7 @@ class AxisBuilder {
921
920
  return this.formatCategory(axis, category);
922
921
  }
923
922
  else {
924
- return "???";
923
+ return T `???`;
925
924
  }
926
925
  }).join(", ");
927
926
  }
@@ -931,7 +930,7 @@ class AxisBuilder {
931
930
  return this.formatCategory(axis, category);
932
931
  }
933
932
  else {
934
- return "???";
933
+ return T `???`;
935
934
  }
936
935
  }
937
936
  }
@@ -19,21 +19,21 @@ export interface AxisColorEditorComponentProps {
19
19
  autosetColors?: boolean;
20
20
  }
21
21
  interface AxisColorEditorComponentState {
22
- mode: any;
22
+ mode: "normal" | "palette";
23
23
  }
24
24
  export default class AxisColorEditorComponent extends React.Component<AxisColorEditorComponentProps, AxisColorEditorComponentState> {
25
25
  static defaultProps: {
26
26
  reorderable: boolean;
27
27
  autosetColors: boolean;
28
28
  };
29
- constructor(props: any);
30
- componentWillMount(): void;
29
+ constructor(props: AxisColorEditorComponentProps);
30
+ componentDidMount(): void;
31
31
  componentDidUpdate(): void;
32
32
  updateColorMap(): void;
33
33
  handleSelectPalette: () => void;
34
34
  handleResetPalette: () => void;
35
35
  handlePaletteChange: (palette: ColorMap) => void;
36
36
  handleCancelCustomize: () => void;
37
- render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
37
+ render(): React.JSX.Element;
38
38
  }
39
39
  export {};
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
7
  const react_1 = __importDefault(require("react"));
8
- const R = react_1.default.createElement;
9
8
  const CategoryMapComponent_1 = __importDefault(require("./CategoryMapComponent"));
10
9
  const ColorSchemeFactory_1 = __importDefault(require("../ColorSchemeFactory"));
11
10
  const ColorPaletteCollectionComponent_1 = __importDefault(require("./ColorPaletteCollectionComponent"));
@@ -24,11 +23,11 @@ class AxisColorEditorComponent extends react_1.default.Component {
24
23
  mode: "normal"
25
24
  };
26
25
  }
27
- componentWillMount() {
28
- return this.updateColorMap();
26
+ componentDidMount() {
27
+ this.updateColorMap();
29
28
  }
30
29
  componentDidUpdate() {
31
- return this.updateColorMap();
30
+ this.updateColorMap();
32
31
  }
33
32
  // Update color map if categories no longer match
34
33
  updateColorMap() {
@@ -42,31 +41,37 @@ class AxisColorEditorComponent extends react_1.default.Component {
42
41
  !lodash_1.default.isEqual(lodash_1.default.pluck(this.props.axis.colorMap, "value").sort(), lodash_1.default.pluck(this.props.categories, "value").sort())) {
43
42
  let colorMap;
44
43
  if (this.props.autosetColors) {
45
- colorMap = ColorSchemeFactory_1.default.createColorMapForCategories(this.props.categories, axisBuilder.isCategorical(this.props.axis));
44
+ // Find categories that are not in the color map
45
+ const missingCategories = lodash_1.default.filter(this.props.categories, (category) => !(this.props.axis.colorMap || []).find(cm => cm.value === category.value));
46
+ if (missingCategories.length == 0) {
47
+ return;
48
+ }
49
+ const missingColorMap = ColorSchemeFactory_1.default.createColorMapForCategories(missingCategories, axisBuilder.isCategorical(this.props.axis));
50
+ colorMap = (this.props.axis.colorMap || []).concat(missingColorMap);
46
51
  }
47
52
  else {
48
53
  // Keep existing
49
54
  const existing = lodash_1.default.indexBy(this.props.axis.colorMap || [], "value");
50
- colorMap = lodash_1.default.map(this.props.categories, (category, i) => ({
55
+ colorMap = lodash_1.default.map(this.props.categories, (category) => ({
51
56
  value: category.value,
52
57
  color: existing[category.value] ? existing[category.value].color : null
53
58
  }));
54
59
  }
55
60
  this.handlePaletteChange(colorMap);
56
- return this.setState({ mode: "normal" });
61
+ this.setState({ mode: "normal" });
57
62
  }
58
63
  }
59
64
  handleSelectPalette = () => {
60
- return this.setState({ mode: "palette" });
65
+ this.setState({ mode: "palette" });
61
66
  };
62
67
  handleResetPalette = () => {
63
68
  // Completely reset
64
- const colorMap = lodash_1.default.map(this.props.categories || [], (category, i) => ({
69
+ const colorMap = lodash_1.default.map(this.props.categories || [], (category) => ({
65
70
  value: category.value,
66
71
  color: null
67
72
  }));
68
73
  this.handlePaletteChange(colorMap);
69
- return this.setState({ mode: "normal" });
74
+ this.setState({ mode: "normal" });
70
75
  };
71
76
  handlePaletteChange = (palette) => {
72
77
  this.props.onChange((0, immer_1.default)(this.props.axis, (draft) => {
@@ -76,58 +81,18 @@ class AxisColorEditorComponent extends react_1.default.Component {
76
81
  this.setState({ mode: "normal" });
77
82
  };
78
83
  handleCancelCustomize = () => {
79
- return this.setState({ mode: "normal" });
84
+ this.setState({ mode: "normal" });
80
85
  };
81
- // renderPreview() {
82
- // return R(
83
- // "div",
84
- // { className: "axis-palette" },
85
- // _.map(this.props.categories.slice(0, 6), (category, i) => {
86
- // const color = _.find(this.props.axis.colorMap, { value: category.value })
87
- // const cellStyle = {
88
- // display: "inline-block",
89
- // height: 20,
90
- // width: 20,
91
- // backgroundColor: color ? color.color : this.props.defaultColor
92
- // }
93
- // return R("div", { style: cellStyle, key: i }, " ")
94
- // })
95
- // )
96
- // }
97
86
  render() {
98
- return R("div", null, (() => {
99
- if (this.state.mode === "palette") {
100
- if (this.props.categories) {
101
- return R(ColorPaletteCollectionComponent_1.default, {
102
- onPaletteSelected: this.handlePaletteChange,
103
- axis: this.props.axis,
104
- categories: this.props.categories,
105
- onCancel: this.handleCancelCustomize
106
- });
107
- }
108
- }
109
- return null;
110
- })(), this.state.mode === "normal"
111
- ? R("div", null, R("p", null, R("a", { className: "link-plain", onClick: this.handleSelectPalette, key: "select-palette" }, "Change color scheme"), !this.props.autosetColors
112
- ? R("a", {
113
- className: "btn btn-sm btn-link",
114
- onClick: this.handleResetPalette,
115
- key: "reset-palette"
116
- }, "Reset colors")
117
- : undefined), this.props.axis.colorMap
118
- ? R("div", { key: "selected-palette" }, R("div", null, R(CategoryMapComponent_1.default, {
119
- schema: this.props.schema,
120
- axis: this.props.axis,
121
- onChange: this.props.onChange,
122
- categories: this.props.categories,
123
- key: "colorMap",
124
- reorderable: this.props.reorderable,
125
- allowExcludedValues: this.props.allowExcludedValues,
126
- showColorMap: true,
127
- initiallyExpanded: this.props.initiallyExpanded
128
- })))
129
- : undefined)
130
- : undefined);
87
+ return (react_1.default.createElement("div", null,
88
+ this.state.mode === "palette" && this.props.categories && (react_1.default.createElement(ColorPaletteCollectionComponent_1.default, { onPaletteSelected: this.handlePaletteChange, axis: this.props.axis, categories: this.props.categories, onCancel: this.handleCancelCustomize })),
89
+ this.state.mode === "normal" && (react_1.default.createElement("div", null,
90
+ react_1.default.createElement("p", null,
91
+ react_1.default.createElement("a", { className: "link-plain", onClick: this.handleSelectPalette }, T `Change color scheme`),
92
+ !this.props.autosetColors && (react_1.default.createElement("a", { className: "btn btn-sm btn-link", onClick: this.handleResetPalette }, T `Reset colors`))),
93
+ this.props.axis.colorMap && (react_1.default.createElement("div", null,
94
+ react_1.default.createElement("div", null,
95
+ react_1.default.createElement(CategoryMapComponent_1.default, { schema: this.props.schema, axis: this.props.axis, onChange: this.props.onChange, categories: this.props.categories, reorderable: this.props.reorderable, allowExcludedValues: this.props.allowExcludedValues, showColorMap: true, initiallyExpanded: this.props.initiallyExpanded }))))))));
131
96
  }
132
97
  }
133
98
  exports.default = AxisColorEditorComponent;