@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
@@ -1,441 +0,0 @@
1
- import _ from "lodash"
2
- import React from "react"
3
- const R = React.createElement
4
- import uuid from "uuid"
5
- import { DataSource, ExprUtils, Schema } from "@mwater/expressions"
6
- import AxisBuilder from "../../../axes/AxisBuilder"
7
- import { ExprComponent } from "@mwater/expressions-ui"
8
- import { FilterExprComponent } from "@mwater/expressions-ui"
9
- import OrderingsComponent from "./OrderingsComponent"
10
- import { TableSelectComponent } from "@mwater/expressions-ui"
11
- import ReorderableListComponent from "@mwater/react-library/lib/reorderable/ReorderableListComponent"
12
- import * as ui from "@mwater/react-library/lib/bootstrap"
13
- import { getFormatOptions } from "../../../valueFormatter"
14
- import { getDefaultFormat } from "../../../valueFormatter"
15
- import { TableChartColumn, TableChartDesign } from "./TableChart"
16
- import AxisComponent from "../../../axes/AxisComponent"
17
- import { Axis } from "../../../axes/Axis"
18
-
19
- import { LocaleContext } from "@mwater/expressions-ui"
20
-
21
- export interface TableChartDesignerComponentProps {
22
- design: TableChartDesign
23
- schema: Schema
24
- dataSource: DataSource
25
- onDesignChange: (design: TableChartDesign) => void
26
- }
27
-
28
- export default class TableChartDesignerComponent extends React.Component<TableChartDesignerComponentProps> {
29
- // Updates design with the specified changes
30
- updateDesign(changes: Partial<TableChartDesign>) {
31
- const design = _.extend({}, this.props.design, changes) as TableChartDesign
32
- this.props.onDesignChange(design)
33
- }
34
-
35
- handleTitleTextChange = (ev: any) => {
36
- this.updateDesign({ titleText: ev.target.value })
37
- }
38
- handleTableChange = (table: any) => {
39
- this.updateDesign({ table })
40
- }
41
- handleFilterChange = (filter: any) => {
42
- this.updateDesign({ filter })
43
- }
44
- handleOrderingsChange = (orderings: any) => {
45
- this.updateDesign({ orderings })
46
- }
47
- handleLimitChange = (limit: any) => {
48
- this.updateDesign({ limit })
49
- }
50
-
51
- handleColumnChange = (index: any, column: any) => {
52
- const columns = this.props.design.columns.slice()
53
- columns[index] = column
54
- this.updateDesign({ columns })
55
- }
56
-
57
- handleRemoveColumn = (index: any) => {
58
- const columns = this.props.design.columns.slice()
59
- columns.splice(index, 1)
60
- this.updateDesign({ columns })
61
- }
62
-
63
- handleAddColumn = () => {
64
- const columns = this.props.design.columns.slice()
65
- columns.push({ id: uuid() })
66
- this.updateDesign({ columns })
67
- }
68
-
69
- renderTable() {
70
- return R(
71
- "div",
72
- { className: "mb-3" },
73
- R("label", { className: "text-muted" }, R("i", { className: "fa fa-database" }), " ", T`Data Source`),
74
- ": ",
75
- R(TableSelectComponent, {
76
- schema: this.props.schema,
77
- value: this.props.design.table,
78
- onChange: this.handleTableChange,
79
- filter: this.props.design.filter,
80
- onFilterChange: this.handleFilterChange
81
- })
82
- )
83
- }
84
-
85
- renderTitle() {
86
- return R(
87
- "div",
88
- { className: "mb-3" },
89
- R("label", { className: "text-muted" }, T`Title`),
90
- R("input", {
91
- type: "text",
92
- className: "form-control form-control-sm",
93
- value: this.props.design.titleText,
94
- onChange: this.handleTitleTextChange,
95
- placeholder: T`Untitled`
96
- })
97
- )
98
- }
99
-
100
- renderColumn = (column: any, index: any, connectDragSource: any, connectDragPreview: any, connectDropTarget: any) => {
101
- const style = {
102
- borderTop: "solid 1px #EEE",
103
- paddingTop: 10,
104
- paddingBottom: 10
105
- }
106
-
107
- return connectDragPreview(
108
- connectDropTarget(
109
- R(
110
- "div",
111
- { key: index, style },
112
- React.createElement(TableChartColumnDesignerComponent, {
113
- design: this.props.design,
114
- schema: this.props.schema,
115
- dataSource: this.props.dataSource,
116
- index,
117
- onChange: this.handleColumnChange.bind(null, index),
118
- onRemove: this.handleRemoveColumn.bind(null, index),
119
- connectDragSource
120
- })
121
- )
122
- )
123
- )
124
- }
125
-
126
- handleReorder = (map: any) => {
127
- return this.updateDesign({ columns: map })
128
- }
129
-
130
- renderColumns() {
131
- if (!this.props.design.table) {
132
- return
133
- }
134
-
135
- return R(
136
- "div",
137
- null,
138
- R(ReorderableListComponent, {
139
- items: this.props.design.columns,
140
- onReorder: this.handleReorder,
141
- renderItem: this.renderColumn,
142
- getItemId: (item: TableChartColumn) => item.id
143
- }),
144
- R(
145
- "button",
146
- { className: "btn btn-secondary btn-sm", type: "button", onClick: this.handleAddColumn },
147
- R("span", { className: "fas fa-plus" }),
148
- " ", T`Add Column`
149
- )
150
- )
151
- }
152
- // return R 'div', className: "form-group",
153
- // _.map(@props.design.columns, (column, i) => @renderColumn(i))
154
- //
155
-
156
- renderOrderings() {
157
- // If no table, hide
158
- if (!this.props.design.table) {
159
- return null
160
- }
161
-
162
- return R(
163
- "div",
164
- { className: "mb-3" },
165
- R("label", { className: "text-muted" }, R("span", { className: "fas fa-sort-amount-down" }), " ", T`Ordering`),
166
- R(
167
- "div",
168
- { style: { marginLeft: 8 } },
169
- React.createElement(OrderingsComponent, {
170
- schema: this.props.schema,
171
- dataSource: this.props.dataSource,
172
- orderings: this.props.design.orderings,
173
- onOrderingsChange: this.handleOrderingsChange,
174
- table: this.props.design.table
175
- })
176
- )
177
- )
178
- }
179
-
180
- renderFilter() {
181
- // If no table, hide
182
- if (!this.props.design.table) {
183
- return null
184
- }
185
-
186
- return R(
187
- "div",
188
- { className: "mb-3" },
189
- R("label", { className: "text-muted" }, R("span", { className: "fas fa-filter" }), " ", T`Filters`),
190
- R(
191
- "div",
192
- { style: { marginLeft: 8 } },
193
- React.createElement(FilterExprComponent, {
194
- schema: this.props.schema,
195
- dataSource: this.props.dataSource,
196
- onChange: this.handleFilterChange,
197
- table: this.props.design.table,
198
- value: this.props.design.filter
199
- })
200
- )
201
- )
202
- }
203
-
204
- renderLimit() {
205
- // If no table, hide
206
- if (!this.props.design.table) {
207
- return null
208
- }
209
-
210
- return R(
211
- "div",
212
- { className: "mb-3" },
213
- R("label", { className: "text-muted" }, T`Maximum Number of Rows (up to 1000)`),
214
- R(
215
- "div",
216
- { style: { marginLeft: 8 } },
217
- R(ui.NumberInput, {
218
- value: this.props.design.limit,
219
- onChange: this.handleLimitChange,
220
- decimal: false,
221
- placeholder: "1000"
222
- })
223
- )
224
- )
225
- }
226
-
227
- render() {
228
- return R(
229
- "div",
230
- null,
231
- this.renderTable(),
232
- this.renderColumns(),
233
- this.props.design.table ? R("hr") : undefined,
234
- this.renderOrderings(),
235
- this.renderFilter(),
236
- this.renderLimit(),
237
- R("hr"),
238
- this.renderTitle()
239
- )
240
- }
241
- }
242
-
243
- export interface TableChartColumnDesignerComponentProps {
244
- design: TableChartDesign
245
- schema: Schema
246
- dataSource: DataSource
247
- index: number
248
- onChange: any
249
- onRemove: any
250
- connectDragSource: any
251
- }
252
-
253
- class TableChartColumnDesignerComponent extends React.Component<TableChartColumnDesignerComponentProps> {
254
- static contextType = LocaleContext
255
-
256
- // Updates column with the specified changes
257
- updateColumn(changes: any) {
258
- const column = _.extend({}, this.props.design.columns[this.props.index], changes)
259
- return this.props.onChange(column)
260
- }
261
-
262
- updateTextAxis(changes: any) {
263
- const textAxis = _.extend({}, this.props.design.columns[this.props.index].textAxis, changes)
264
- return this.updateColumn({ textAxis })
265
- }
266
-
267
- handleExprChange = (expr: any) => {
268
- return this.updateTextAxis({ expr })
269
- }
270
- handleHeaderTextChange = (ev: any) => {
271
- return this.updateColumn({ headerText: ev.target.value })
272
- }
273
- handleAggrChange = (aggr: any) => {
274
- return this.updateTextAxis({ aggr })
275
- }
276
- handleFormatChange = (ev: any) => {
277
- return this.updateColumn({ format: ev.target.value })
278
- }
279
-
280
- renderRemove() {
281
- if (this.props.design.columns.length > 1) {
282
- return R(
283
- "button",
284
- { className: "btn btn-sm btn-link float-end", type: "button", onClick: this.props.onRemove },
285
- R("span", { className: "fas fa-times" })
286
- )
287
- }
288
- return null
289
- }
290
-
291
- renderExpr() {
292
- const column = this.props.design.columns[this.props.index]
293
-
294
- const title = T`Value`
295
-
296
- return R(
297
- "div",
298
- null,
299
- R("label", { className: "text-muted" }, title),
300
- ": ",
301
- React.createElement(ExprComponent, {
302
- schema: this.props.schema,
303
- dataSource: this.props.dataSource,
304
- table: this.props.design.table,
305
- value: column.textAxis ? column.textAxis.expr : null,
306
- onChange: this.handleExprChange,
307
- aggrStatuses: ["literal", "individual", "aggregate"]
308
- })
309
- )
310
- }
311
-
312
- renderFormat() {
313
- const column = this.props.design.columns[this.props.index]
314
-
315
- // Get type
316
- const exprUtils = new ExprUtils(this.props.schema)
317
- const exprType = exprUtils.getExprType(column.textAxis?.expr ?? null)
318
- if (!exprType) {
319
- return null
320
- }
321
-
322
- const formats = getFormatOptions(exprType)
323
- if (!formats) {
324
- return null
325
- }
326
-
327
- return R(
328
- "div",
329
- { className: "mb-3" },
330
- R("label", { className: "text-muted" }, T`Format`),
331
- ": ",
332
- R(
333
- "select",
334
- {
335
- value: column.format != null ? column.format : getDefaultFormat(exprType),
336
- className: "form-select",
337
- style: { width: "auto", display: "inline-block" },
338
- onChange: this.handleFormatChange
339
- },
340
- _.map(formats, (format) => R("option", { key: format.value, value: format.value }, format.label))
341
- )
342
- )
343
- }
344
-
345
- renderHeader() {
346
- const column = this.props.design.columns[this.props.index]
347
-
348
- const axisBuilder = new AxisBuilder({ schema: this.props.schema })
349
- const placeholder = column.textAxis ? axisBuilder.summarizeAxis(column.textAxis ?? null, this.context): ""
350
-
351
- return R(
352
- "div",
353
- null,
354
- R("label", { className: "text-muted" }, T`Header`),
355
- ": ",
356
- R("input", {
357
- type: "text",
358
- className: "form-control form-control-sm",
359
- style: { display: "inline-block", width: "15em" },
360
- value: column.headerText,
361
- onChange: this.handleHeaderTextChange,
362
- placeholder
363
- })
364
- )
365
- }
366
-
367
- renderSummarize() {
368
- const column = this.props.design.columns[this.props.index]
369
- const exprUtils = new ExprUtils(this.props.schema)
370
- const exprType = exprUtils.getExprType(column.textAxis?.expr ?? null)
371
- if (!exprType || exprType !== 'number') {
372
- return null
373
- }
374
-
375
- return R('div', null,
376
- R(ui.Checkbox, {value: column.summarize, inline: true, onChange: (summarize) => this.updateColumn({ summarize, summaryType: column.summaryType ?? 'sum' })}, T`Summarize`),
377
- column.summarize ?
378
- R('div', null,
379
- R("label", { className: "text-muted" }, T`Summary Type`),
380
- ": ",
381
- R(ui.Select, {
382
- inline: true,
383
- value: column.summaryType,
384
- onChange: (summaryType) => this.updateColumn({ summaryType }),
385
- options: [{value: 'avg', label: T`Average`}, {value: 'sum', label: T`Sum`}, {value: 'min', label: T`Minimum`}, {value: 'max', label: T`Maximum`} ]
386
- })
387
- ) : undefined
388
- )
389
- }
390
-
391
- renderBackgroundColorAxis() {
392
- const column = this.props.design.columns[this.props.index]
393
-
394
- if(!column.textAxis) return null
395
-
396
- return R(
397
- ui.CollapsibleSection,
398
- {
399
- label: T`Background color by data`,
400
- labelMuted: true
401
- },
402
- R(AxisComponent, {
403
- schema: this.props.schema,
404
- dataSource: this.props.dataSource,
405
- table: this.props.design.table,
406
- types: ["enum", "text", "boolean", "date"],
407
- value: column.backgroundColorAxis,
408
- onChange: (backgroundColorAxis: Axis | null) => this.updateColumn({ backgroundColorAxis }),
409
- showColorMap: true,
410
- aggrNeed: "optional"
411
- })
412
-
413
- )
414
- }
415
-
416
- render() {
417
- const iconStyle = {
418
- cursor: "move",
419
- marginRight: 8,
420
- opacity: 0.5,
421
- fontSize: 12,
422
- height: 20
423
- }
424
- return R(
425
- "div",
426
- null,
427
- this.props.connectDragSource(R("i", { className: "fa fa-bars", style: iconStyle })),
428
- this.renderRemove(),
429
- R("label", null, T`Column ${this.props.index + 1}`),
430
- R(
431
- "div",
432
- { style: { marginLeft: 5 } },
433
- this.renderExpr(),
434
- this.renderFormat(),
435
- this.renderHeader(),
436
- this.renderSummarize(),
437
- this.renderBackgroundColorAxis()
438
- )
439
- )
440
- }
441
- }
@@ -1,29 +0,0 @@
1
- // TODO: This file was created by bulk-decaffeinate.
2
- // Sanity-check the conversion and remove this comment.
3
- let UpdateableComponent;
4
- import _ from 'lodash';
5
- import React from 'react';
6
-
7
- // Convenience wrapper that allows updating state
8
- export default UpdateableComponent = class UpdateableComponent extends React.Component {
9
- constructor(props) {
10
- super(props);
11
- this.state = _.clone(this.props || {});
12
- }
13
-
14
- // Creates update function
15
- update = name => {
16
- return value => {
17
- const upt = {};
18
- upt[name] = value;
19
- this.setState(upt);
20
- return console.log(JSON.stringify(upt, null, 2));
21
- };
22
- };
23
- // action("update")(upt)
24
-
25
- render() {
26
- return this.props.children(this.state, this.update);
27
- }
28
- };
29
-
@@ -1,202 +0,0 @@
1
- // TODO: This file was created by bulk-decaffeinate.
2
- // Sanity-check the conversion and remove this comment.
3
- import PropTypes from 'prop-types';
4
- import _ from 'lodash';
5
- import React from 'react';
6
- const H = React.DOM;
7
- const R = React.createElement;
8
-
9
- import uuid from 'uuid';
10
- import { storiesOf } from '@kadira/storybook';
11
- import ConsoleComponent from '../src/consoles/ConsoleComponent';
12
- import DirectConsoleDataSource from '../src/consoles/DirectConsoleDataSource';
13
- import MWaterLoaderComponent from '../src/MWaterLoaderComponent';
14
- import UpdateableComponent from './UpdateableComponent';
15
-
16
- storiesOf('console', module)
17
- .add('simple console', () => {
18
- return R(ConsoleTest);
19
- });
20
-
21
- // .add 'table dashboard', =>
22
- // R DashboardTest, design: tableDashboardDesign
23
-
24
- // .add 'popup', =>
25
- // R DashboardPopupTest
26
-
27
-
28
- class ConsoleTest extends React.Component {
29
- static initClass() {
30
- this.propTypes =
31
- {design: PropTypes.object};
32
- }
33
-
34
- render() {
35
- return R(UpdateableComponent,
36
- {design: this.props.design || { tabs: [{ id: uuid(), type: "blank", name: "New Tab" }], popups: [] }},
37
- (state, update) => {
38
- const apiUrl = "https://api.mwater.co/v3/";
39
- return R(MWaterLoaderComponent, {
40
- apiUrl,
41
- client: null,
42
- user: null
43
- // onExtraTablesChange: (extraTables) => @setState(extraTables: extraTables)
44
- // extraTables: @state.extraTables
45
- }, (error, config) => {
46
- if (error) {
47
- alert("Error: " + error.message);
48
- return null;
49
- }
50
-
51
- const consoleDataSource = new DirectConsoleDataSource({
52
- apiUrl,
53
- client: null,
54
- schema: config.schema,
55
- dataSource: config.dataSource,
56
- design: state.design
57
- });
58
-
59
- return H.div({style: { height: 800 }},
60
- React.createElement(ConsoleComponent, {
61
- schema: config.schema,
62
- dataSource: config.dataSource,
63
- consoleDataSource,
64
- design: state.design,
65
- onDesignChange: update("design"),
66
- activeTabId: state.activeTabId,
67
- onActiveTabIdChange: update("activeTabId"),
68
- titleElem: "Sample"
69
- })
70
- );
71
- });
72
- });
73
- }
74
- }
75
- ConsoleTest.initClass();
76
-
77
-
78
- // class DashboardPopupTest extends React.Component
79
- // render: ->
80
- // R UpdateableComponent,
81
- // popup: { name: "Untitled", design: { items: { id: "root", type: "root", blocks: [] }, layout: "blocks" } }
82
- // (state, update) =>
83
- // apiUrl = "https://api.mwater.co/v3/"
84
- // R MWaterLoaderComponent, {
85
- // apiUrl: apiUrl
86
- // client: null
87
- // user: null
88
- // # onExtraTablesChange: (extraTables) => @setState(extraTables: extraTables)
89
- // # extraTables: @state.extraTables
90
- // }, (error, config) =>
91
- // if error
92
- // alert("Error: " + error.message)
93
- // return null
94
-
95
- // dashboardDataSource = new DirectDashboardDataSource({
96
- // apiUrl: apiUrl
97
- // client: null
98
- // design: state.popup.design
99
- // schema: config.schema
100
- // dataSource: config.dataSource
101
- // })
102
-
103
- // return H.div null,
104
- // R DashboardPopupComponent,
105
- // ref: (comp) => @popupComponent = comp
106
- // schema: config.schema
107
- // dataSource: config.dataSource
108
- // dashboardDataSource: dashboardDataSource
109
- // popup: state.popup
110
- // onPopupChange: update("popup")
111
-
112
- // H.button
113
- // type: "button"
114
- // onClick: => @popupComponent.show()
115
- // className: "btn btn-default",
116
- // "Show"
117
-
118
-
119
- // ModalWindowComponent = require 'react-library/lib/ModalWindowComponent'
120
- // ui = require 'react-library/lib/bootstrap'
121
- // update = require 'react-library/lib/update'
122
-
123
- // class DashboardPopupComponent extends React.Component
124
- // @propTypes:
125
- // popup: PropTypes.object.isRequired
126
- // onPopupChange: PropTypes.func # If not set, readonly
127
- // schema: PropTypes.object.isRequired
128
- // dataSource: PropTypes.object.isRequired
129
- // dashboardDataSource: PropTypes.object.isRequired # dashboard data source
130
-
131
- // onRowClick: PropTypes.func # Called with (tableId, rowId) when item is clicked
132
- // namedStrings: PropTypes.object # Optional lookup of string name to value. Used for {{branding}} and other replacement strings in text widget
133
-
134
- // # Filters to add to the dashboard
135
- // filters: PropTypes.arrayOf(PropTypes.shape({
136
- // table: PropTypes.string.isRequired # id table to filter
137
- // jsonql: PropTypes.object.isRequired # jsonql filter with {alias} for tableAlias
138
- // }))
139
-
140
- // constructor: ->
141
- // super
142
-
143
- // @state = {
144
- // open: false
145
- // }
146
-
147
- // # Updates with the specified changes
148
- // update: => update(@props.popup, @props.onPopupChange, arguments)
149
-
150
- // show: ->
151
- // @setState(open: true)
152
-
153
- // render: ->
154
- // R ModalWindowComponent,
155
- // onRequestClose: => @setState(open: false)
156
- // isOpen: @state.open,
157
- // R DashboardComponent, {
158
- // schema: @props.schema
159
- // dataSource: @props.dataSource
160
- // dashboardDataSource: @props.dashboardDataSource
161
- // design: @props.popup.design
162
- // onDesignChange: @update("design")
163
- // # titleElem: H.span style: { fontSize: 20, cursor: "pointer" },
164
- // # H.span className: "text-muted", onClick: (=> @setState(open: false)),
165
- // # R ui.Icon, id: "fa-arrow-left"
166
- // }
167
-
168
-
169
- // tableDashboardDesign = {
170
- // "items": {
171
- // "id": "root",
172
- // "type": "root",
173
- // "blocks": [
174
- // {
175
- // "type": "widget",
176
- // "aspectRatio": 1.4,
177
- // "widgetType": "TableChart",
178
- // "design": {
179
- // "version": 1,
180
- // "columns": [
181
- // {
182
- // "id": "f1532afb-c0ea-48de-8e4e-931b147eeb6f",
183
- // "textAxis": {
184
- // "expr": {
185
- // "type": "field",
186
- // "table": "entities.place_of_worship",
187
- // "column": "name"
188
- // }
189
- // }
190
- // }
191
- // ],
192
- // "orderings": [],
193
- // "table": "entities.place_of_worship"
194
- // },
195
- // "id": "193bbc40-9177-4547-8b83-c2b5441f72c3"
196
- // }
197
- // ]
198
- // },
199
- // "layout": "blocks"
200
- // }
201
-
202
-