@mwater/visualization 5.4.5 → 5.6.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 (310) hide show
  1. package/lib/MWaterContextComponent.d.ts +1 -1
  2. package/lib/MWaterContextComponent.js +1 -1
  3. package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
  4. package/lib/MWaterGlobalFiltersComponent.js +11 -20
  5. package/lib/MWaterLoaderComponent.d.ts +5 -14
  6. package/lib/MWaterLoaderComponent.js +2 -11
  7. package/lib/UndoStack.d.ts +2 -1
  8. package/lib/UndoStack.js +12 -6
  9. package/lib/dashboards/DashboardComponent.js +7 -5
  10. package/lib/dashboards/DashboardDesign.d.ts +1 -1
  11. package/lib/dashboards/LayoutOptionsComponent.js +18 -11
  12. package/lib/dashboards/ServerDashboardDataSource.d.ts +10 -1
  13. package/lib/dashboards/ServerDashboardDataSource.js +29 -10
  14. package/lib/dashboards/SettingsModalComponent.js +1 -1
  15. package/lib/dashboards/layoutOptions.d.ts +5 -1
  16. package/lib/datagrids/DatagridComponent.js +23 -3
  17. package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
  18. package/lib/datagrids/DatagridDesignerComponent.js +108 -120
  19. package/lib/datagrids/DatagridViewComponent.js +3 -2
  20. package/lib/datagrids/ExprCellComponent.d.ts +1 -0
  21. package/lib/datagrids/ExprCellComponent.js +22 -20
  22. package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
  23. package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
  24. package/lib/index.css +45 -2
  25. package/lib/index.d.ts +5 -5
  26. package/lib/index.js +2 -3
  27. package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
  28. package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
  29. package/lib/maps/BufferLayer.d.ts +18 -0
  30. package/lib/maps/BufferLayer.js +36 -14
  31. package/lib/maps/BufferLayerDesign.d.ts +1 -1
  32. package/lib/maps/BufferLayerDesignerComponent.js +2 -2
  33. package/lib/maps/ChoroplethLayer.d.ts +18 -0
  34. package/lib/maps/ChoroplethLayer.js +46 -25
  35. package/lib/maps/ChoroplethLayerDesign.d.ts +7 -3
  36. package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -22
  37. package/lib/maps/ChoroplethLayerDesigner.js +58 -89
  38. package/lib/maps/DirectMapDataSource.js +17 -10
  39. package/lib/maps/EditHoverOver.d.ts +4 -3
  40. package/lib/maps/EditHoverOver.js +64 -35
  41. package/lib/maps/HoverContent.d.ts +10 -5
  42. package/lib/maps/HoverContent.js +7 -36
  43. package/lib/maps/Layer.d.ts +37 -0
  44. package/lib/maps/Layer.js +30 -4
  45. package/lib/maps/LeafletMapComponent.js +10 -19
  46. package/lib/maps/MWaterServerLayer.d.ts +2 -2
  47. package/lib/maps/MWaterServerLayer.js +6 -6
  48. package/lib/maps/MapComponent.js +0 -1
  49. package/lib/maps/MapLayerDataSource.d.ts +9 -0
  50. package/lib/maps/MapUtils.d.ts +19 -1
  51. package/lib/maps/MapUtils.js +80 -1
  52. package/lib/maps/MarkersLayer.d.ts +18 -0
  53. package/lib/maps/MarkersLayer.js +42 -26
  54. package/lib/maps/MarkersLayerDesign.d.ts +1 -1
  55. package/lib/maps/MarkersLayerDesignerComponent.d.ts +12 -28
  56. package/lib/maps/MarkersLayerDesignerComponent.js +81 -111
  57. package/lib/maps/RasterMapViewComponent.js +1 -1
  58. package/lib/maps/ServerMapDataSource.d.ts +9 -0
  59. package/lib/maps/ServerMapDataSource.js +29 -10
  60. package/lib/maps/VectorMapViewComponent.js +7 -15
  61. package/lib/maps/maps.d.ts +4 -2
  62. package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
  63. package/lib/maps/symbols/font-awesome/ban.png +0 -0
  64. package/lib/maps/symbols/font-awesome/beer.png +0 -0
  65. package/lib/maps/symbols/font-awesome/bell.png +0 -0
  66. package/lib/maps/symbols/font-awesome/bolt.png +0 -0
  67. package/lib/maps/symbols/font-awesome/building.png +0 -0
  68. package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
  69. package/lib/maps/symbols/font-awesome/bus.png +0 -0
  70. package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
  71. package/lib/maps/symbols/font-awesome/certificate.png +0 -0
  72. package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
  73. package/lib/maps/symbols/font-awesome/check.png +0 -0
  74. package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
  75. package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
  76. package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
  77. package/lib/maps/symbols/font-awesome/cloud.png +0 -0
  78. package/lib/maps/symbols/font-awesome/comment.png +0 -0
  79. package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
  80. package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
  81. package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
  82. package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
  83. package/lib/maps/symbols/font-awesome/female.png +0 -0
  84. package/lib/maps/symbols/font-awesome/file.png +0 -0
  85. package/lib/maps/symbols/font-awesome/flag.png +0 -0
  86. package/lib/maps/symbols/font-awesome/flask.png +0 -0
  87. package/lib/maps/symbols/font-awesome/h-square.png +0 -0
  88. package/lib/maps/symbols/font-awesome/home.png +0 -0
  89. package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
  90. package/lib/maps/symbols/font-awesome/male.png +0 -0
  91. package/lib/maps/symbols/font-awesome/medkit.png +0 -0
  92. package/lib/maps/symbols/font-awesome/mobile.png +0 -0
  93. package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
  94. package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
  95. package/lib/maps/symbols/font-awesome/plus.png +0 -0
  96. package/lib/maps/symbols/font-awesome/square.png +0 -0
  97. package/lib/maps/symbols/font-awesome/star.png +0 -0
  98. package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
  99. package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
  100. package/lib/maps/symbols/font-awesome/ticket.png +0 -0
  101. package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
  102. package/lib/maps/symbols/font-awesome/times.png +0 -0
  103. package/lib/maps/symbols/font-awesome/tint.png +0 -0
  104. package/lib/maps/symbols/font-awesome/tree.png +0 -0
  105. package/lib/maps/symbols/font-awesome/university.png +0 -0
  106. package/lib/maps/symbols/font-awesome/usd.png +0 -0
  107. package/lib/maps/symbols/font-awesome/user.png +0 -0
  108. package/lib/maps/symbols/font-awesome/users.png +0 -0
  109. package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
  110. package/lib/maps/symbols/sdf-ize.sh +93 -0
  111. package/lib/maps/vectorMaps.d.ts +1 -0
  112. package/lib/maps/vectorMaps.js +20 -36
  113. package/lib/mwater_table_selection/FormsListComponent.d.ts +33 -0
  114. package/lib/mwater_table_selection/FormsListComponent.js +141 -0
  115. package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +49 -0
  116. package/lib/mwater_table_selection/IndicatorsListComponent.js +251 -0
  117. package/lib/mwater_table_selection/IssuesListComponent.d.ts +29 -0
  118. package/lib/mwater_table_selection/IssuesListComponent.js +123 -0
  119. package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.d.ts +20 -0
  120. package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.js +157 -0
  121. package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.d.ts +17 -0
  122. package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.js +79 -0
  123. package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.d.ts +18 -0
  124. package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.js +80 -0
  125. package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.d.ts +63 -0
  126. package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +461 -0
  127. package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.d.ts +17 -0
  128. package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.js +94 -0
  129. package/lib/mwater_table_selection/MWaterMetricsTableListComponent.d.ts +17 -0
  130. package/lib/mwater_table_selection/MWaterMetricsTableListComponent.js +80 -0
  131. package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +32 -0
  132. package/lib/mwater_table_selection/MWaterTableSelectComponent.js +163 -0
  133. package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.d.ts +19 -0
  134. package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.js +111 -0
  135. package/lib/quickfilter/QuickfiltersComponent.d.ts +3 -102
  136. package/lib/quickfilter/QuickfiltersComponent.js +53 -110
  137. package/lib/quickfilter/TextLiteralComponent.d.ts +23 -47
  138. package/lib/quickfilter/TextLiteralComponent.js +85 -82
  139. package/lib/widgets/MapWidget.js +4 -2
  140. package/lib/widgets/charts/Chart.d.ts +11 -0
  141. package/lib/widgets/charts/Chart.js +15 -0
  142. package/lib/widgets/charts/ChartWidgetComponent.d.ts +1 -0
  143. package/lib/widgets/charts/ChartWidgetComponent.js +27 -1
  144. package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +1 -1
  145. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +1 -1
  146. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +5 -12
  147. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +43 -57
  148. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +113 -110
  149. package/lib/widgets/charts/layered/LayeredChartUtils.d.ts +2 -1
  150. package/lib/widgets/charts/layered/LayeredChartUtils.js +0 -2
  151. package/lib/widgets/charts/pivot/PivotChart.d.ts +2 -0
  152. package/lib/widgets/charts/pivot/PivotChart.js +156 -0
  153. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +5 -20
  154. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +31 -61
  155. package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +4 -0
  156. package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +4 -2
  157. package/lib/widgets/charts/pivot/PivotChartLayoutComponent.d.ts +5 -44
  158. package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +38 -63
  159. package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +7 -68
  160. package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +58 -106
  161. package/lib/widgets/charts/table/TableChart.d.ts +2 -0
  162. package/lib/widgets/charts/table/TableChart.js +172 -1
  163. package/lib/widgets/charts/table/TableChartDesignerComponent.d.ts +7 -17
  164. package/lib/widgets/charts/table/TableChartDesignerComponent.js +79 -95
  165. package/lib/widgets/charts/table/TableChartViewComponent.d.ts +1 -7
  166. package/lib/widgets/charts/table/TableChartViewComponent.js +19 -27
  167. package/lib/widgets/text/ExprItemEditorComponent.d.ts +3 -8
  168. package/lib/widgets/text/ExprItemEditorComponent.js +36 -33
  169. package/lib/widgets/text/ExprUpdateModalComponent.d.ts +1 -0
  170. package/package.json +4 -10
  171. package/src/MWaterContextComponent.tsx +2 -2
  172. package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
  173. package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +18 -19
  174. package/src/UndoStack.ts +14 -6
  175. package/src/dashboards/DashboardComponent.tsx +7 -5
  176. package/src/dashboards/DashboardDesign.ts +1 -1
  177. package/src/dashboards/LayoutOptionsComponent.tsx +22 -10
  178. package/src/dashboards/ServerDashboardDataSource.ts +36 -13
  179. package/src/dashboards/SettingsModalComponent.tsx +1 -1
  180. package/src/dashboards/layoutOptions.tsx +5 -1
  181. package/src/datagrids/DatagridComponent.tsx +31 -3
  182. package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
  183. package/src/datagrids/DatagridViewComponent.tsx +3 -2
  184. package/src/datagrids/ExprCellComponent.tsx +23 -20
  185. package/src/datagrids/OrderBysDesignerComponent.tsx +61 -70
  186. package/src/index.css +45 -2
  187. package/src/index.ts +5 -11
  188. package/src/layouts/blocks/BlocksDisplayComponent.tsx +60 -5
  189. package/src/maps/BufferLayer.ts +48 -20
  190. package/src/maps/BufferLayerDesign.ts +1 -1
  191. package/src/maps/BufferLayerDesignerComponent.tsx +2 -1
  192. package/src/maps/ChoroplethLayer.ts +70 -39
  193. package/src/maps/ChoroplethLayerDesign.ts +6 -2
  194. package/src/maps/ChoroplethLayerDesigner.tsx +171 -167
  195. package/src/maps/DirectMapDataSource.ts +21 -13
  196. package/src/maps/EditHoverOver.tsx +98 -54
  197. package/src/maps/HoverContent.tsx +17 -48
  198. package/src/maps/Layer.ts +42 -4
  199. package/src/maps/LeafletMapComponent.tsx +10 -19
  200. package/src/maps/MWaterServerLayer.ts +6 -6
  201. package/src/maps/MapComponent.ts +0 -1
  202. package/src/maps/MapLayerDataSource.ts +8 -0
  203. package/src/maps/MapUtils.ts +82 -3
  204. package/src/maps/MarkersLayer.ts +54 -27
  205. package/src/maps/MarkersLayerDesign.ts +1 -1
  206. package/src/maps/MarkersLayerDesignerComponent.tsx +360 -0
  207. package/src/maps/RasterMapViewComponent.ts +1 -1
  208. package/src/maps/ServerMapDataSource.ts +35 -12
  209. package/src/maps/VectorMapViewComponent.tsx +8 -19
  210. package/src/maps/maps.ts +4 -2
  211. package/src/maps/symbols/font-awesome/asterisk.png +0 -0
  212. package/src/maps/symbols/font-awesome/ban.png +0 -0
  213. package/src/maps/symbols/font-awesome/beer.png +0 -0
  214. package/src/maps/symbols/font-awesome/bell.png +0 -0
  215. package/src/maps/symbols/font-awesome/bolt.png +0 -0
  216. package/src/maps/symbols/font-awesome/building.png +0 -0
  217. package/src/maps/symbols/font-awesome/bullseye.png +0 -0
  218. package/src/maps/symbols/font-awesome/bus.png +0 -0
  219. package/src/maps/symbols/font-awesome/caret-up.png +0 -0
  220. package/src/maps/symbols/font-awesome/certificate.png +0 -0
  221. package/src/maps/symbols/font-awesome/check-circle.png +0 -0
  222. package/src/maps/symbols/font-awesome/check.png +0 -0
  223. package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
  224. package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
  225. package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
  226. package/src/maps/symbols/font-awesome/cloud.png +0 -0
  227. package/src/maps/symbols/font-awesome/comment.png +0 -0
  228. package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
  229. package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
  230. package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
  231. package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
  232. package/src/maps/symbols/font-awesome/female.png +0 -0
  233. package/src/maps/symbols/font-awesome/file.png +0 -0
  234. package/src/maps/symbols/font-awesome/flag.png +0 -0
  235. package/src/maps/symbols/font-awesome/flask.png +0 -0
  236. package/src/maps/symbols/font-awesome/h-square.png +0 -0
  237. package/src/maps/symbols/font-awesome/home.png +0 -0
  238. package/src/maps/symbols/font-awesome/info-circle.png +0 -0
  239. package/src/maps/symbols/font-awesome/male.png +0 -0
  240. package/src/maps/symbols/font-awesome/medkit.png +0 -0
  241. package/src/maps/symbols/font-awesome/mobile.png +0 -0
  242. package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
  243. package/src/maps/symbols/font-awesome/plus-square.png +0 -0
  244. package/src/maps/symbols/font-awesome/plus.png +0 -0
  245. package/src/maps/symbols/font-awesome/square.png +0 -0
  246. package/src/maps/symbols/font-awesome/star.png +0 -0
  247. package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
  248. package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
  249. package/src/maps/symbols/font-awesome/ticket.png +0 -0
  250. package/src/maps/symbols/font-awesome/times-circle.png +0 -0
  251. package/src/maps/symbols/font-awesome/times.png +0 -0
  252. package/src/maps/symbols/font-awesome/tint.png +0 -0
  253. package/src/maps/symbols/font-awesome/tree.png +0 -0
  254. package/src/maps/symbols/font-awesome/university.png +0 -0
  255. package/src/maps/symbols/font-awesome/usd.png +0 -0
  256. package/src/maps/symbols/font-awesome/user.png +0 -0
  257. package/src/maps/symbols/font-awesome/users.png +0 -0
  258. package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
  259. package/src/maps/symbols/sdf-ize.sh +93 -0
  260. package/src/maps/vectorMaps.tsx +20 -44
  261. package/src/mwater_table_selection/FormsListComponent.tsx +188 -0
  262. package/src/mwater_table_selection/IndicatorsListComponent.tsx +411 -0
  263. package/src/mwater_table_selection/IssuesListComponent.tsx +167 -0
  264. package/src/mwater_table_selection/MWaterAccountingSystemListComponent.tsx +225 -0
  265. package/src/{MWaterAssetSystemsListComponent.tsx → mwater_table_selection/MWaterAssetSystemsListComponent.tsx} +2 -2
  266. package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
  267. package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +713 -0
  268. package/src/{MWaterCustomTablesetListComponent.tsx → mwater_table_selection/MWaterCustomTablesetListComponent.tsx} +1 -1
  269. package/src/{MWaterMetricsTableListComponent.tsx → mwater_table_selection/MWaterMetricsTableListComponent.tsx} +1 -1
  270. package/src/{MWaterTableSelectComponent.tsx → mwater_table_selection/MWaterTableSelectComponent.tsx} +91 -90
  271. package/src/mwater_table_selection/MWaterWorkflowsSelectComponent.tsx +159 -0
  272. package/src/quickfilter/{QuickfiltersComponent.ts → QuickfiltersComponent.tsx} +165 -158
  273. package/src/quickfilter/TextLiteralComponent.tsx +197 -0
  274. package/src/widgets/MapWidget.tsx +9 -1
  275. package/src/widgets/charts/Chart.ts +17 -0
  276. package/src/widgets/charts/ChartWidgetComponent.tsx +36 -1
  277. package/src/widgets/charts/layered/LayeredChartDesign.ts +1 -1
  278. package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +23 -24
  279. package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +260 -211
  280. package/src/widgets/charts/layered/LayeredChartUtils.ts +7 -7
  281. package/src/widgets/charts/pivot/PivotChart.ts +191 -0
  282. package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +124 -129
  283. package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +4 -2
  284. package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +120 -149
  285. package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +178 -198
  286. package/src/widgets/charts/table/TableChart.ts +177 -1
  287. package/src/widgets/charts/table/TableChartDesignerComponent.tsx +422 -0
  288. package/src/widgets/charts/table/{TableChartViewComponent.ts → TableChartViewComponent.tsx} +65 -60
  289. package/src/widgets/text/ExprItemEditorComponent.tsx +83 -77
  290. package/src/widgets/text/ExprUpdateModalComponent.tsx +1 -0
  291. package/test/UndoStackTests.ts +52 -1
  292. package/.storybook/config.js +0 -7
  293. package/.storybook/head.html +0 -4
  294. package/.storybook/webpack.config.js +0 -15
  295. package/src/MWaterCompleteTableSelectComponent.tsx +0 -975
  296. package/src/maps/BingLayer.ts +0 -146
  297. package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
  298. package/src/quickfilter/TextLiteralComponent.ts +0 -165
  299. package/src/widgets/charts/table/TableChartDesignerComponent.ts +0 -441
  300. package/stories/UpdateableComponent.js +0 -29
  301. package/stories/consoles.js +0 -202
  302. package/stories/dashboards.js +0 -217
  303. package/stories/datagridDesign.js +0 -114
  304. package/stories/datagrids.js +0 -69
  305. package/stories/dates.js +0 -80
  306. package/stories/exprcomponent.js +0 -43
  307. package/stories/index.js +0 -18
  308. package/stories/leaflet.js +0 -59
  309. package/stories/maps.js +0 -24
  310. package/stories/pivotChart.js +0 -235
@@ -440,5 +440,161 @@ class PivotChart extends Chart_1.default {
440
440
  }
441
441
  });
442
442
  }
443
+ // Override to indicate this chart supports XLSX export
444
+ supportsXlsxExport() {
445
+ return true;
446
+ }
447
+ // Creates a SheetJS workbook for the pivot chart data
448
+ createXlsxWorkbook(design, schema, dataSource, data, locale) {
449
+ // Import XLSX here to ensure it's available
450
+ const XLSX = require("xlsx-js-style");
451
+ const Color = require("color");
452
+ // Create a new workbook
453
+ const workbook = XLSX.utils.book_new();
454
+ // Build layout using the layout builder
455
+ const layoutBuilder = new PivotChartLayoutBuilder_1.default({ schema });
456
+ const layout = layoutBuilder.buildLayout(design, data, locale);
457
+ // Create a 2D array for the worksheet data
458
+ const wsData = [];
459
+ // Process each row in the layout
460
+ layout.rows.forEach(layoutRow => {
461
+ const rowData = [];
462
+ // Process each cell in the row
463
+ layoutRow.cells.forEach(cell => {
464
+ // For skipped cells, still add an empty placeholder
465
+ if (cell.skip) {
466
+ rowData.push({ v: "", s: {} });
467
+ return;
468
+ }
469
+ // Create cell value and style
470
+ const cellObj = {
471
+ v: cell.text === null || cell.text === undefined ? "" : cell.text,
472
+ s: {}
473
+ };
474
+ // Apply alignment based on cell type and subtype
475
+ if (cell.align === "right") {
476
+ cellObj.s.alignment = { horizontal: "right" };
477
+ }
478
+ else if (cell.align === "center") {
479
+ cellObj.s.alignment = { horizontal: "center" };
480
+ }
481
+ else {
482
+ cellObj.s.alignment = { horizontal: "left" };
483
+ }
484
+ // Apply styles based on cell properties
485
+ if (cell.bold) {
486
+ cellObj.s.font = { ...cellObj.s.font, bold: true };
487
+ }
488
+ if (cell.italic) {
489
+ cellObj.s.font = { ...cellObj.s.font, italic: true };
490
+ }
491
+ // Apply background color if present
492
+ if (cell.backgroundColor) {
493
+ try {
494
+ const color = Color(cell.backgroundColor);
495
+ const hex = color.hex().substring(1); // Remove #
496
+ cellObj.s.fill = {
497
+ patternType: "solid",
498
+ fgColor: { rgb: hex },
499
+ bgColor: { rgb: hex }
500
+ };
501
+ // Adjust text color based on background lightness
502
+ const lightness = color.luminosity();
503
+ cellObj.s.font = {
504
+ ...cellObj.s.font,
505
+ color: { rgb: lightness < 0.3 ? "FFFFFF" : "000000" }
506
+ };
507
+ }
508
+ catch (e) {
509
+ // Silently ignore color errors
510
+ }
511
+ }
512
+ // Apply borders
513
+ const borders = {};
514
+ if (cell.borderTop) {
515
+ const style = cell.borderTop === 1 ? "thin" : cell.borderTop === 2 ? "medium" : "thick";
516
+ borders.top = { style };
517
+ }
518
+ if (cell.borderBottom) {
519
+ const style = cell.borderBottom === 1 ? "thin" : cell.borderBottom === 2 ? "medium" : "thick";
520
+ borders.bottom = { style };
521
+ }
522
+ if (cell.borderLeft) {
523
+ const style = cell.borderLeft === 1 ? "thin" : cell.borderLeft === 2 ? "medium" : "thick";
524
+ borders.left = { style };
525
+ }
526
+ if (cell.borderRight) {
527
+ const style = cell.borderRight === 1 ? "thin" : cell.borderRight === 2 ? "medium" : "thick";
528
+ borders.right = { style };
529
+ }
530
+ if (Object.keys(borders).length > 0) {
531
+ cellObj.s.border = borders;
532
+ }
533
+ rowData.push(cellObj);
534
+ });
535
+ wsData.push(rowData);
536
+ });
537
+ // Create a worksheet from the data
538
+ const worksheet = XLSX.utils.aoa_to_sheet(wsData);
539
+ // Process merged cells
540
+ const merges = [];
541
+ // Track current row and column position
542
+ let rowOffset = 0;
543
+ // Traverse layout again to collect merge info
544
+ layout.rows.forEach((layoutRow, rowIndex) => {
545
+ let colOffset = 0;
546
+ layoutRow.cells.forEach((cell, colIndex) => {
547
+ // Skip cells that are part of spans (already handled)
548
+ if (cell.skip) {
549
+ colOffset++;
550
+ return;
551
+ }
552
+ // Handle row spans
553
+ if (cell.rowSpan && cell.rowSpan > 1) {
554
+ merges.push({
555
+ s: { r: rowOffset, c: colOffset },
556
+ e: { r: rowOffset + cell.rowSpan - 1, c: colOffset }
557
+ });
558
+ }
559
+ // Handle column spans
560
+ if (cell.columnSpan && cell.columnSpan > 1) {
561
+ merges.push({
562
+ s: { r: rowOffset, c: colOffset },
563
+ e: { r: rowOffset, c: colOffset + cell.columnSpan - 1 }
564
+ });
565
+ }
566
+ colOffset++;
567
+ });
568
+ rowOffset++;
569
+ });
570
+ // Apply merges to worksheet
571
+ if (merges.length > 0) {
572
+ worksheet["!merges"] = merges;
573
+ }
574
+ // Set column widths based on content
575
+ const colWidths = [];
576
+ if (wsData.length > 0) {
577
+ for (let colIndex = 0; colIndex < wsData[0].length; colIndex++) {
578
+ // Start with reasonable default width
579
+ let maxWidth = 10;
580
+ // Check all rows for this column
581
+ for (let rowIndex = 0; rowIndex < wsData.length; rowIndex++) {
582
+ const cell = wsData[rowIndex][colIndex];
583
+ if (cell && cell.v) {
584
+ maxWidth = Math.max(maxWidth, String(cell.v).length);
585
+ }
586
+ }
587
+ // Add some padding and cap at 50 characters
588
+ colWidths.push(Math.min(maxWidth + 2, 50));
589
+ }
590
+ worksheet['!cols'] = colWidths.map(width => ({ wch: width }));
591
+ }
592
+ // Add the worksheet to the workbook
593
+ XLSX.utils.book_append_sheet(workbook, worksheet, "Pivot Table");
594
+ // Convert workbook to blob
595
+ const workbookBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
596
+ const blob = new Blob([workbookBuffer], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
597
+ return blob;
598
+ }
443
599
  }
444
600
  exports.default = PivotChart;
@@ -1,5 +1,4 @@
1
1
  import React from "react";
2
- import * as ui from "@mwater/react-library/lib/bootstrap";
3
2
  import { DataSource, Schema } from "@mwater/expressions";
4
3
  export interface PivotChartDesignerComponentProps {
5
4
  design: any;
@@ -19,24 +18,10 @@ export default class PivotChartDesignerComponent extends React.Component<PivotCh
19
18
  handleRowChange: (axis: any) => any;
20
19
  handleFilterChange: (filter: any) => any;
21
20
  handleIntersectionValueAxisChange: (valueAxis: any) => any;
22
- renderTable(): React.DetailedReactHTMLElement<{
23
- className: string;
24
- }, HTMLElement>;
25
- renderFilter(): React.DetailedReactHTMLElement<{
26
- className: string;
27
- }, HTMLElement> | null;
28
- renderStriping(): React.CElement<{
29
- label: React.ReactNode;
30
- labelMuted?: boolean;
31
- hint?: React.ReactNode;
32
- help?: React.ReactNode;
33
- required?: boolean;
34
- hasSuccess?: boolean;
35
- hasWarnings?: boolean;
36
- hasErrors?: boolean;
37
- horizontal?: boolean;
38
- }, ui.FormGroup> | null;
39
- renderSetup(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
40
- render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
21
+ renderTable(): React.JSX.Element;
22
+ renderFilter(): React.JSX.Element | null;
23
+ renderStriping(): React.JSX.Element | null;
24
+ renderSetup(): React.JSX.Element;
25
+ render(): React.JSX.Element;
41
26
  }
42
27
  export {};
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const lodash_1 = __importDefault(require("lodash"));
30
30
  const react_1 = __importDefault(require("react"));
31
- const R = react_1.default.createElement;
32
31
  const uuid_1 = __importDefault(require("uuid"));
33
32
  const ui = __importStar(require("@mwater/react-library/lib/bootstrap"));
34
33
  const expressions_ui_1 = require("@mwater/expressions-ui");
@@ -76,84 +75,55 @@ class PivotChartDesignerComponent extends react_1.default.Component {
76
75
  return this.updateDesign({ intersections });
77
76
  };
78
77
  renderTable() {
79
- return R("div", { className: "mb-3" }, R("label", { className: "text-muted" }, R("i", { className: "fa fa-database" }), " ", T `Data Source`), ": ", R(expressions_ui_2.TableSelectComponent, {
80
- schema: this.props.schema,
81
- value: this.props.design.table,
82
- onChange: this.handleTableChange,
83
- filter: this.props.design.filter,
84
- onFilterChange: this.handleFilterChange
85
- }));
78
+ return (react_1.default.createElement("div", { className: "mb-3" },
79
+ react_1.default.createElement("label", { className: "text-muted" },
80
+ react_1.default.createElement("i", { className: "fa fa-database" }),
81
+ " ",
82
+ T `Data Source`),
83
+ ": ",
84
+ " ",
85
+ react_1.default.createElement(expressions_ui_2.TableSelectComponent, { schema: this.props.schema, value: this.props.design.table, onChange: this.handleTableChange, filter: this.props.design.filter, onFilterChange: this.handleFilterChange })));
86
86
  }
87
87
  renderFilter() {
88
88
  // If no table, hide
89
89
  if (!this.props.design.table) {
90
90
  return null;
91
91
  }
92
- return R("div", { className: "mb-3" }, R("label", { className: "text-muted" }, R("span", { className: "fas fa-filter" }), " ", T `Filters`), R("div", { style: { marginLeft: 8 } }, R(expressions_ui_1.FilterExprComponent, {
93
- schema: this.props.schema,
94
- dataSource: this.props.dataSource,
95
- onChange: this.handleFilterChange,
96
- table: this.props.design.table,
97
- value: this.props.design.filter
98
- })));
92
+ return (react_1.default.createElement("div", { className: "mb-3" },
93
+ react_1.default.createElement("label", { className: "text-muted" },
94
+ react_1.default.createElement("span", { className: "fas fa-filter" }),
95
+ " ",
96
+ T `Filters`),
97
+ react_1.default.createElement("div", { style: { marginLeft: 8 } },
98
+ react_1.default.createElement(expressions_ui_1.FilterExprComponent, { schema: this.props.schema, dataSource: this.props.dataSource, onChange: this.handleFilterChange, table: this.props.design.table, value: this.props.design.filter }))));
99
99
  }
100
100
  renderStriping() {
101
101
  // If no table, hide
102
102
  if (!this.props.design.table) {
103
103
  return null;
104
104
  }
105
- return R(ui.FormGroup, {
106
- labelMuted: true,
107
- label: T `Striping`
108
- }, react_1.default.createElement(ui.Radio, { key: "none", inline: true, radioValue: null, value: this.props.design.striping || null, onChange: (value) => this.updateDesign({ striping: value }) }, T `None`), react_1.default.createElement(ui.Radio, { key: "columns", inline: true, radioValue: "columns", value: this.props.design.striping, onChange: (value) => this.updateDesign({ striping: value }) }, T `Columns`), react_1.default.createElement(ui.Radio, { key: "rows", inline: true, value: this.props.design.striping, radioValue: "rows", onChange: (value) => this.updateDesign({ striping: value }) }, T `Rows`));
105
+ return (react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: T `Striping` },
106
+ react_1.default.createElement(ui.Radio, { key: "none", inline: true, radioValue: null, value: this.props.design.striping || null, onChange: (value) => this.updateDesign({ striping: value }) }, T `None`),
107
+ react_1.default.createElement(ui.Radio, { key: "columns", inline: true, radioValue: "columns", value: this.props.design.striping, onChange: (value) => this.updateDesign({ striping: value }) }, T `Columns`),
108
+ react_1.default.createElement(ui.Radio, { key: "rows", inline: true, value: this.props.design.striping, radioValue: "rows", onChange: (value) => this.updateDesign({ striping: value }) }, T `Rows`)));
109
109
  }
110
110
  // Show setup options
111
111
  renderSetup() {
112
112
  const intersectionId = `${this.props.design.rows[0].id}:${this.props.design.columns[0].id}`;
113
- return R("div", null, R(ui.FormGroup, {
114
- labelMuted: true,
115
- label: T `Columns`,
116
- help: T `Field to optionally make columns out of`
117
- }, R(AxisComponent_1.default, {
118
- schema: this.props.schema,
119
- dataSource: this.props.dataSource,
120
- table: this.props.design.table,
121
- types: ["enum", "enumset", "text", "boolean", "date"],
122
- aggrNeed: "none",
123
- value: this.props.design.columns[0].valueAxis,
124
- onChange: this.handleColumnChange,
125
- filters: this.props.filters
126
- })), R(ui.FormGroup, {
127
- labelMuted: true,
128
- label: T `Rows`,
129
- help: T `Field to optionally make rows out of`
130
- }, R(AxisComponent_1.default, {
131
- schema: this.props.schema,
132
- dataSource: this.props.dataSource,
133
- table: this.props.design.table,
134
- types: ["enum", "enumset", "text", "boolean", "date"],
135
- aggrNeed: "none",
136
- value: this.props.design.rows[0].valueAxis,
137
- onChange: this.handleRowChange,
138
- filters: this.props.filters
139
- })), R(ui.FormGroup, {
140
- labelMuted: true,
141
- label: T `Value`,
142
- help: T `Field show in cells`
143
- }, R(AxisComponent_1.default, {
144
- schema: this.props.schema,
145
- dataSource: this.props.dataSource,
146
- table: this.props.design.table,
147
- types: ["enum", "text", "boolean", "date", "number"],
148
- aggrNeed: "required",
149
- value: this.props.design.intersections[intersectionId].valueAxis,
150
- onChange: this.handleIntersectionValueAxisChange,
151
- showFormat: true,
152
- filters: this.props.filters
153
- })));
113
+ return (react_1.default.createElement("div", null,
114
+ react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: T `Columns`, help: T `Field to optionally make columns out of` },
115
+ react_1.default.createElement(AxisComponent_1.default, { schema: this.props.schema, dataSource: this.props.dataSource, table: this.props.design.table, types: ["enum", "enumset", "text", "boolean", "date"], aggrNeed: "none", value: this.props.design.columns[0].valueAxis, onChange: this.handleColumnChange, filters: this.props.filters })),
116
+ react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: T `Rows`, help: T `Field to optionally make rows out of` },
117
+ react_1.default.createElement(AxisComponent_1.default, { schema: this.props.schema, dataSource: this.props.dataSource, table: this.props.design.table, types: ["enum", "enumset", "text", "boolean", "date"], aggrNeed: "none", value: this.props.design.rows[0].valueAxis, onChange: this.handleRowChange, filters: this.props.filters })),
118
+ react_1.default.createElement(ui.FormGroup, { labelMuted: true, label: T `Value`, help: T `Field show in cells` },
119
+ react_1.default.createElement(AxisComponent_1.default, { schema: this.props.schema, dataSource: this.props.dataSource, table: this.props.design.table, types: ["enum", "text", "boolean", "date", "number"], aggrNeed: "required", value: this.props.design.intersections[intersectionId].valueAxis, onChange: this.handleIntersectionValueAxisChange, showFormat: true, filters: this.props.filters }))));
154
120
  }
155
121
  render() {
156
- return R("div", null, this.renderTable(), this.state.isNew && this.props.design.table ? this.renderSetup() : undefined, this.renderFilter(), this.renderStriping());
122
+ return (react_1.default.createElement("div", null,
123
+ this.renderTable(),
124
+ this.state.isNew && this.props.design.table ? this.renderSetup() : undefined,
125
+ this.renderFilter(),
126
+ this.renderStriping()));
157
127
  }
158
128
  }
159
129
  exports.default = PivotChartDesignerComponent;
@@ -5,6 +5,10 @@ import { PivotChartLayout, PivotChartLayoutCell } from "./PivotChartLayout";
5
5
  export type PivotChartData = {
6
6
  [intersectionId: string]: any[];
7
7
  };
8
+ /**
9
+ * Builds pivot table layout from the design and data
10
+ * See PivotChartDesign.ts for more details
11
+ */
8
12
  export default class PivotChartLayoutBuilder {
9
13
  schema: Schema;
10
14
  exprUtils: ExprUtils;
@@ -34,8 +34,10 @@ const PivotChartUtils = __importStar(require("./PivotChartUtils"));
34
34
  const canonical_json_1 = __importDefault(require("canonical-json"));
35
35
  const maxRows = 500;
36
36
  const maxColumns = 50;
37
- // Builds pivot table layout from the design and data
38
- // See PivotChart Design.md for more detauls
37
+ /**
38
+ * Builds pivot table layout from the design and data
39
+ * See PivotChartDesign.ts for more details
40
+ */
39
41
  class PivotChartLayoutBuilder {
40
42
  schema;
41
43
  exprUtils;
@@ -26,49 +26,10 @@ export default class PivotChartLayoutComponent extends React.Component<PivotChar
26
26
  };
27
27
  constructor(props: PivotChartLayoutComponentProps);
28
28
  recordCellComp: (rowIndex: any, columnIndex: any, comp: any) => any;
29
- renderRow(row: PivotChartLayoutRow, rowIndex: number): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
30
- renderHoverPlusIcon: (key: any, x: any, y: any, onClick: any) => React.DetailedReactHTMLElement<{
31
- key: any;
32
- onClick: any;
33
- style: {
34
- position: "absolute";
35
- left: number;
36
- top: number;
37
- border: string;
38
- backgroundColor: "white";
39
- paddingLeft: number;
40
- paddingRight: number;
41
- paddingTop: number;
42
- color: "#337ab7";
43
- fontSize: number;
44
- cursor: "pointer";
45
- opacity: number;
46
- };
47
- }, HTMLElement>;
48
- renderHoverRemoveIcon: (key: any, x: any, y: any, onClick: any) => React.DetailedReactHTMLElement<{
49
- key: any;
50
- onClick: any;
51
- style: {
52
- position: "absolute";
53
- left: number;
54
- top: number;
55
- border: string;
56
- backgroundColor: "white";
57
- paddingLeft: number;
58
- paddingRight: number;
59
- paddingTop: number;
60
- color: "#337ab7";
61
- fontSize: number;
62
- cursor: "pointer";
63
- opacity: number;
64
- };
65
- }, HTMLElement>;
66
- renderHoverControls: () => React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | null | undefined;
67
- render(): React.DetailedReactHTMLElement<{
68
- style: {
69
- position: "relative";
70
- };
71
- onMouseLeave: () => void;
72
- }, HTMLElement>;
29
+ renderRow(row: PivotChartLayoutRow, rowIndex: number): React.JSX.Element;
30
+ renderHoverPlusIcon: (key: any, x: any, y: any, onClick: any) => React.JSX.Element;
31
+ renderHoverRemoveIcon: (key: any, x: any, y: any, onClick: any) => React.JSX.Element;
32
+ renderHoverControls: () => React.JSX.Element | null | undefined;
33
+ render(): React.JSX.Element;
73
34
  }
74
35
  export {};
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const lodash_1 = __importDefault(require("lodash"));
30
30
  const react_1 = __importDefault(require("react"));
31
- const R = react_1.default.createElement;
32
31
  const color_1 = __importDefault(require("color"));
33
32
  const ui = __importStar(require("@mwater/react-library/lib/bootstrap"));
34
33
  const classnames_1 = __importDefault(require("classnames"));
@@ -55,28 +54,15 @@ class PivotChartLayoutComponent extends react_1.default.Component {
55
54
  }
56
55
  };
57
56
  renderRow(row, rowIndex) {
58
- return R("tr", { key: rowIndex }, lodash_1.default.map(row.cells, (cell, columnIndex) => {
59
- return R(LayoutCellComponent, {
60
- ref: this.recordCellComp.bind(null, rowIndex, columnIndex),
61
- key: columnIndex,
62
- layout: this.props.layout,
63
- rowIndex,
64
- columnIndex,
65
- onHover: this.props.editable ? () => this.setState({ hoverSection: cell.section ?? null }) : undefined,
66
- hoverSection: this.props.editable ? this.state.hoverSection : undefined,
67
- onEditSection: this.props.onEditSection ? this.props.onEditSection.bind(null, cell.section) : undefined,
68
- onSummarizeSegment: this.props.onSummarizeSegment
57
+ return react_1.default.createElement("tr", { key: rowIndex }, lodash_1.default.map(row.cells, (cell, columnIndex) => {
58
+ return react_1.default.createElement(LayoutCellComponent, { ref: this.recordCellComp.bind(null, rowIndex, columnIndex), key: columnIndex, layout: this.props.layout, rowIndex: rowIndex, columnIndex: columnIndex, onHover: this.props.editable ? () => this.setState({ hoverSection: cell.section ?? null }) : undefined, hoverSection: this.props.editable ? this.state.hoverSection : undefined, onEditSection: this.props.onEditSection ? this.props.onEditSection.bind(null, cell.section) : undefined, onSummarizeSegment: this.props.onSummarizeSegment
69
59
  ? this.props.onSummarizeSegment.bind(null, cell.section)
70
- : undefined
71
- });
60
+ : undefined });
72
61
  }));
73
62
  }
74
63
  renderHoverPlusIcon = (key, x, y, onClick) => {
75
64
  // Render a plus box
76
- return R("div", {
77
- key,
78
- onClick,
79
- style: {
65
+ return react_1.default.createElement("div", { key: key, onClick: onClick, style: {
80
66
  position: "absolute",
81
67
  left: x - 7,
82
68
  top: y - 6,
@@ -89,15 +75,12 @@ class PivotChartLayoutComponent extends react_1.default.Component {
89
75
  fontSize: 9,
90
76
  cursor: "pointer",
91
77
  opacity: 0.8
92
- }
93
- }, R(ui.Icon, { id: "fa-plus" }));
78
+ } },
79
+ react_1.default.createElement(ui.Icon, { id: "fa-plus" }));
94
80
  };
95
81
  renderHoverRemoveIcon = (key, x, y, onClick) => {
96
82
  // Render a plus box
97
- return R("div", {
98
- key,
99
- onClick,
100
- style: {
83
+ return react_1.default.createElement("div", { key: key, onClick: onClick, style: {
101
84
  position: "absolute",
102
85
  left: x - 7,
103
86
  top: y - 6,
@@ -110,8 +93,8 @@ class PivotChartLayoutComponent extends react_1.default.Component {
110
93
  fontSize: 9,
111
94
  cursor: "pointer",
112
95
  opacity: 0.8
113
- }
114
- }, R(ui.Icon, { id: "fa-remove" }));
96
+ } },
97
+ react_1.default.createElement(ui.Icon, { id: "fa-remove" }));
115
98
  };
116
99
  // Render floating hover controls
117
100
  renderHoverControls = () => {
@@ -175,18 +158,11 @@ class PivotChartLayoutComponent extends react_1.default.Component {
175
158
  if (["row", "column"].includes(sectionType) && this.props.onRemoveSegment) {
176
159
  controls.push(this.renderHoverRemoveIcon("topright", maxX, minY, this.props.onRemoveSegment.bind(null, this.state.hoverSection)));
177
160
  }
178
- return R("div", { key: "hover-controls" }, controls);
161
+ return react_1.default.createElement("div", { key: "hover-controls" }, controls);
179
162
  };
180
163
  render() {
181
- return R("div", {
182
- style: { position: "relative" },
183
- onMouseLeave: () => this.setState({ hoverSection: null })
184
- },
185
- // Define CSS classes to keep HTML as small as possible
186
- // https://stackoverflow.com/a/19047221/876117
187
- // https://github.com/mWater/mwater-portal/issues/1183
188
- // cell borders not visible in firefox when you have a cell with position relative inside a table with collapsed borders
189
- R("style", null, `\
164
+ return react_1.default.createElement("div", { style: { position: "relative" }, onMouseLeave: () => this.setState({ hoverSection: null }) },
165
+ react_1.default.createElement("style", null, `\
190
166
  .pivot-chart-table {
191
167
  width: 100%;
192
168
  border-spacing: 0;
@@ -214,13 +190,19 @@ vertical-align: top;
214
190
  .pivot-chart-table .br1 { border-right: solid 1px #f4f4f4 }
215
191
  .pivot-chart-table .br2 { border-right: solid 1px #ccc }
216
192
  .pivot-chart-table .br3 { border-right: solid 1px #888 }\
217
- `), this.props.layout.tooManyRows
218
- ? R("div", { className: "text-warning", style: { fontSize: 12 } }, R("i", { className: "fa fa-exclamation-circle" }), T `Warning: Too many rows in table to display`)
219
- : undefined, this.props.layout.tooManyColumns
220
- ? R("div", { className: "text-warning", style: { fontSize: 12 } }, R("i", { className: "fa fa-exclamation-circle" }), T `Warning: Too many columns in table to display`)
221
- : undefined, R("div", { style: { position: "relative" } }, R("table", { className: "pivot-chart-table" }, R("tbody", null, lodash_1.default.map(this.props.layout.rows, (row, rowIndex) => {
222
- return this.renderRow(row, rowIndex);
223
- }))), this.renderHoverControls()));
193
+ `),
194
+ this.props.layout.tooManyRows ? (react_1.default.createElement("div", { className: "text-warning", style: { fontSize: 12 } },
195
+ react_1.default.createElement("i", { className: "fa fa-exclamation-circle" }),
196
+ T `Warning: Too many rows in table to display`)) : undefined,
197
+ this.props.layout.tooManyColumns ? (react_1.default.createElement("div", { className: "text-warning", style: { fontSize: 12 } },
198
+ react_1.default.createElement("i", { className: "fa fa-exclamation-circle" }),
199
+ T `Warning: Too many columns in table to display`)) : undefined,
200
+ react_1.default.createElement("div", { style: { position: "relative" } },
201
+ react_1.default.createElement("table", { className: "pivot-chart-table" },
202
+ react_1.default.createElement("tbody", null, lodash_1.default.map(this.props.layout.rows, (row, rowIndex) => {
203
+ return this.renderRow(row, rowIndex);
204
+ }))),
205
+ this.renderHoverControls()));
224
206
  }
225
207
  }
226
208
  exports.default = PivotChartLayoutComponent;
@@ -250,12 +232,12 @@ class LayoutCellComponent extends react_1.default.Component {
250
232
  if (!cell.section) {
251
233
  return null;
252
234
  }
253
- return R("span", { style: { fontSize: "90%" } }, R("a", { className: "link-plain", onClick: this.props.onEditSection }, T `Edit`), cell.summarize
254
- ? [
255
- R("span", { className: "text-muted" }, ` / `),
256
- R("a", { className: "link-plain", onClick: this.props.onSummarizeSegment }, T `Summarize`)
257
- ]
258
- : undefined);
235
+ return react_1.default.createElement("span", { style: { fontSize: "90%" } },
236
+ react_1.default.createElement("a", { className: "link-plain", onClick: this.props.onEditSection }, T `Edit`),
237
+ cell.summarize ? [
238
+ react_1.default.createElement("span", { className: "text-muted" }, " / "),
239
+ react_1.default.createElement("a", { className: "link-plain", onClick: this.props.onSummarizeSegment }, T `Summarize`)
240
+ ] : undefined);
259
241
  }
260
242
  render() {
261
243
  const cell = this.props.layout.rows[this.props.rowIndex].cells[this.props.columnIndex];
@@ -291,10 +273,10 @@ class LayoutCellComponent extends react_1.default.Component {
291
273
  textColor = lightness < 0.5 ? "rgb(204,204,204)" : undefined;
292
274
  }
293
275
  const style = {
294
- backgroundColor,
276
+ backgroundColor: backgroundColor || undefined,
295
277
  textAlign: cell.align,
296
278
  cursor: isHover && !cell.unconfigured ? "pointer" : undefined,
297
- color: textColor
279
+ color: textColor || undefined
298
280
  };
299
281
  const classes = (0, classnames_1.default)({
300
282
  cell: true,
@@ -318,18 +300,11 @@ class LayoutCellComponent extends react_1.default.Component {
318
300
  fontStyle: cell.italic ? "italic" : undefined,
319
301
  marginLeft: cell.indent ? cell.indent * 5 : undefined
320
302
  };
321
- return R("td", {
322
- ref: (c) => {
303
+ return react_1.default.createElement("td", { ref: (c) => {
323
304
  this.tdComponent = c;
324
- },
325
- onMouseEnter: this.props.onHover,
326
- onClick: this.handleClick,
327
- className: classes,
328
- style,
329
- colSpan: cell.columnSpan || null,
330
- rowSpan: cell.rowSpan || null
331
- }, R("span", { style: innerStyle }, cell.unconfigured && this.props.onEditSection
332
- ? this.renderUnconfigured(cell)
333
- : cell.text || "\u00A0\u00A0\u00A0"));
305
+ }, onMouseEnter: this.props.onHover, onClick: this.handleClick, className: classes, style: style, colSpan: cell.columnSpan || undefined, rowSpan: cell.rowSpan || undefined },
306
+ react_1.default.createElement("span", { style: innerStyle }, cell.unconfigured && this.props.onEditSection
307
+ ? this.renderUnconfigured(cell)
308
+ : cell.text || "\u00A0\u00A0\u00A0"));
334
309
  }
335
310
  }