@mwater/visualization 5.0.1 → 5.2.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 (172) hide show
  1. package/lib/GlobalFilter.d.ts +13 -0
  2. package/lib/GlobalFilter.js +2 -0
  3. package/lib/MWaterAddRelatedFormComponent.d.ts +1 -1
  4. package/lib/MWaterAddRelatedFormComponent.js +10 -17
  5. package/lib/MWaterCompleteTableSelectComponent.d.ts +2 -9
  6. package/lib/MWaterContextComponent.d.ts +31 -9
  7. package/lib/MWaterContextComponent.js +85 -76
  8. package/lib/MWaterCustomTablesetListComponent.js +9 -3
  9. package/lib/MWaterGlobalFiltersComponent.d.ts +6 -5
  10. package/lib/MWaterGlobalFiltersComponent.js +4 -4
  11. package/lib/MWaterLoaderComponent.d.ts +14 -4
  12. package/lib/MWaterLoaderComponent.js +10 -2
  13. package/lib/MWaterTableSelectComponent.d.ts +0 -1
  14. package/lib/MWaterTableSelectComponent.js +20 -41
  15. package/lib/axes/Axis.d.ts +20 -25
  16. package/lib/axes/AxisBuilder.js +9 -7
  17. package/lib/axes/AxisComponent.d.ts +4 -4
  18. package/lib/axes/RangesComponent.d.ts +12 -6
  19. package/lib/axes/RangesComponent.js +21 -10
  20. package/lib/dashboards/DashboardComponent.d.ts +1 -14
  21. package/lib/dashboards/DashboardComponent.js +18 -56
  22. package/lib/dashboards/DashboardDesign.d.ts +2 -17
  23. package/lib/dashboards/DashboardViewComponent.js +3 -4
  24. package/lib/dashboards/LayoutOptionsComponent.js +4 -3
  25. package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -0
  26. package/lib/dashboards/ServerDashboardDataSource.js +3 -0
  27. package/lib/dashboards/SettingsModalComponent.d.ts +4 -15
  28. package/lib/dashboards/SettingsModalComponent.js +24 -38
  29. package/lib/datagrids/DatagridComponent.d.ts +10 -13
  30. package/lib/datagrids/DatagridComponent.js +27 -5
  31. package/lib/datagrids/DatagridDataSource.d.ts +3 -2
  32. package/lib/datagrids/DatagridDataSource.js +0 -11
  33. package/lib/datagrids/DatagridDesign.d.ts +2 -0
  34. package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -93
  35. package/lib/datagrids/DatagridDesignerComponent.js +11 -8
  36. package/lib/datagrids/DatagridViewComponent.js +2 -2
  37. package/lib/datagrids/DirectDatagridDataSource.d.ts +1 -0
  38. package/lib/datagrids/DirectDatagridDataSource.js +26 -0
  39. package/lib/datagrids/FindReplaceModalComponent.d.ts +4 -20
  40. package/lib/datagrids/FindReplaceModalComponent.js +27 -13
  41. package/lib/datagrids/ServerDatagridDataSource.d.ts +2 -1
  42. package/lib/datagrids/ServerDatagridDataSource.js +16 -3
  43. package/lib/demo.js +1 -1
  44. package/lib/index.d.ts +1 -1
  45. package/lib/index.js +2 -4
  46. package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +2 -1
  47. package/lib/layouts/blocks/BlocksDisplayComponent.js +2 -2
  48. package/lib/layouts/grid/GridLayoutManager.d.ts +2 -1
  49. package/lib/layouts/grid/LegoLayoutEngine.d.ts +1 -1
  50. package/lib/maps/BufferLayer.js +3 -1
  51. package/lib/maps/BufferLayerDesignerComponent.js +2 -2
  52. package/lib/maps/ChoroplethLayerDesigner.js +2 -2
  53. package/lib/maps/ClusterLayer.js +3 -1
  54. package/lib/maps/ClusterLayerDesignerComponent.js +2 -2
  55. package/lib/maps/DirectMapDataSource.js +1 -2
  56. package/lib/maps/GridLayer.js +5 -3
  57. package/lib/maps/GridLayerDesigner.js +2 -3
  58. package/lib/maps/LayerSwitcherComponent.js +1 -1
  59. package/lib/maps/MapComponent.d.ts +2 -7
  60. package/lib/maps/MapDesign.d.ts +2 -13
  61. package/lib/maps/MapDesignerComponent.d.ts +1 -12
  62. package/lib/maps/MapDesignerComponent.js +5 -12
  63. package/lib/maps/MapFiltersDesignerComponent.d.ts +0 -4
  64. package/lib/maps/MapFiltersDesignerComponent.js +4 -5
  65. package/lib/maps/MarkersLayerDesignerComponent.js +2 -2
  66. package/lib/maps/PopupFilterJoinsUtils.d.ts +6 -1
  67. package/lib/maps/PopupFilterJoinsUtils.js +4 -3
  68. package/lib/maps/RasterMapViewComponent.d.ts +2 -9
  69. package/lib/maps/RegionSelectComponent.d.ts +2 -1
  70. package/lib/maps/ServerMapDataSource.d.ts +1 -1
  71. package/lib/maps/UtfGridLayer.js +1 -1
  72. package/lib/maps/vectorMaps.d.ts +1 -0
  73. package/lib/maps/vectorMaps.js +10 -2
  74. package/lib/quickfilter/QuickfilterCompiler.d.ts +1 -1
  75. package/lib/widgets/IFrameWidgetComponent.d.ts +2 -9
  76. package/lib/widgets/ImageWidgetComponent.d.ts +6 -24
  77. package/lib/widgets/ImageWidgetComponent.js +2 -2
  78. package/lib/widgets/MapWidget.d.ts +2 -7
  79. package/lib/widgets/MarkdownWidget.d.ts +2 -7
  80. package/lib/widgets/TOCWidget.d.ts +2 -9
  81. package/lib/widgets/charts/ChartWidget.d.ts +3 -15
  82. package/lib/widgets/charts/calendar/CalendarChartDesignerComponent.js +2 -2
  83. package/lib/widgets/charts/imagemosaic/ImageMosaicChart.d.ts +1 -1
  84. package/lib/widgets/charts/imagemosaic/ImageMosaicChart.js +1 -1
  85. package/lib/widgets/charts/imagemosaic/ImageMosaicChartDesignerComponent.js +2 -2
  86. package/lib/widgets/charts/imagemosaic/ImagePopupComponent.d.ts +2 -7
  87. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +2 -31
  88. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +2 -7
  89. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -2
  90. package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +73 -66
  91. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +10 -6
  92. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +2 -2
  93. package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +3 -22
  94. package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +55 -58
  95. package/lib/widgets/charts/table/TableChartDesignerComponent.js +2 -2
  96. package/lib/widgets/charts/table/TableChartViewComponent.js +21 -7
  97. package/lib/widgets/text/ExprInsertModalComponent.d.ts +2 -13
  98. package/lib/widgets/text/ExprItemEditorComponent.js +2 -2
  99. package/lib/widgets/text/ExprUpdateModalComponent.d.ts +2 -13
  100. package/lib/widgets/text/TextWidgetDesign.d.ts +3 -1
  101. package/package.json +1 -1
  102. package/src/GlobalFilter.ts +17 -0
  103. package/src/MWaterAddRelatedFormComponent.ts +15 -20
  104. package/src/MWaterContextComponent.tsx +158 -0
  105. package/src/MWaterCustomTablesetListComponent.tsx +21 -3
  106. package/src/MWaterGlobalFiltersComponent.ts +8 -8
  107. package/src/MWaterLoaderComponent.ts +10 -3
  108. package/src/{MWaterTableSelectComponent.ts → MWaterTableSelectComponent.tsx} +61 -66
  109. package/src/axes/Axis.ts +24 -25
  110. package/src/axes/AxisBuilder.ts +10 -9
  111. package/src/axes/RangesComponent.ts +27 -16
  112. package/src/dashboards/{DashboardComponent.ts → DashboardComponent.tsx} +39 -80
  113. package/src/dashboards/DashboardDesign.ts +2 -22
  114. package/src/dashboards/DashboardViewComponent.ts +4 -5
  115. package/src/dashboards/LayoutOptionsComponent.tsx +6 -4
  116. package/src/dashboards/ServerDashboardDataSource.ts +16 -12
  117. package/src/dashboards/SettingsModalComponent.tsx +170 -0
  118. package/src/datagrids/DatagridComponent.ts +45 -14
  119. package/src/datagrids/DatagridDataSource.ts +10 -8
  120. package/src/datagrids/DatagridDesign.ts +3 -0
  121. package/src/datagrids/DatagridDesignerComponent.tsx +31 -19
  122. package/src/datagrids/DatagridViewComponent.ts +4 -4
  123. package/src/datagrids/DirectDatagridDataSource.ts +35 -0
  124. package/src/datagrids/ExprCellComponent.ts +0 -1
  125. package/src/datagrids/FindReplaceModalComponent.ts +39 -22
  126. package/src/datagrids/ServerDatagridDataSource.ts +23 -6
  127. package/src/demo.ts +1 -1
  128. package/src/index.ts +1 -2
  129. package/src/layouts/blocks/BlocksDisplayComponent.ts +2 -2
  130. package/src/layouts/grid/LegoLayoutEngine.ts +2 -2
  131. package/src/layouts/grid/WidgetContainerComponent.ts +2 -2
  132. package/src/maps/BingLayer.ts +2 -2
  133. package/src/maps/BufferLayer.ts +3 -1
  134. package/src/maps/BufferLayerDesignerComponent.ts +1 -1
  135. package/src/maps/ChoroplethLayerDesigner.tsx +1 -1
  136. package/src/maps/ClusterLayer.ts +3 -1
  137. package/src/maps/ClusterLayerDesignerComponent.ts +1 -1
  138. package/src/maps/DirectMapDataSource.ts +1 -2
  139. package/src/maps/GridLayer.ts +5 -3
  140. package/src/maps/GridLayerDesigner.tsx +1 -2
  141. package/src/maps/LayerSwitcherComponent.tsx +1 -1
  142. package/src/maps/LegendGroup.ts +1 -1
  143. package/src/maps/MWaterServerLayer.ts +2 -2
  144. package/src/maps/MapDesign.ts +2 -17
  145. package/src/maps/{MapDesignerComponent.ts → MapDesignerComponent.tsx} +8 -16
  146. package/src/maps/{MapFiltersDesignerComponent.ts → MapFiltersDesignerComponent.tsx} +25 -25
  147. package/src/maps/MarkersLayerDesignerComponent.ts +1 -1
  148. package/src/maps/PopupFilterJoinsUtils.ts +4 -4
  149. package/src/maps/ServerMapDataSource.ts +7 -7
  150. package/src/maps/SwitchableTileUrlLayerDesigner.tsx +1 -13
  151. package/src/maps/UtfGridLayer.ts +4 -4
  152. package/src/maps/VectorMapViewComponent.tsx +0 -1
  153. package/src/maps/mapboxUtils.ts +2 -2
  154. package/src/maps/vectorMaps.tsx +10 -1
  155. package/src/quickfilter/QuickfilterCompiler.ts +1 -1
  156. package/src/richtext/ExprItemsHtmlConverter.ts +1 -1
  157. package/src/richtext/FontColorPaletteItem.ts +1 -1
  158. package/src/richtext/FontSizePaletteItem.ts +1 -1
  159. package/src/richtext/ItemsHtmlConverter.ts +2 -2
  160. package/src/widgets/ImageWidgetComponent.ts +1 -1
  161. package/src/widgets/charts/calendar/CalendarChartDesignerComponent.ts +1 -1
  162. package/src/widgets/charts/imagemosaic/ImageMosaicChart.ts +1 -1
  163. package/src/widgets/charts/imagemosaic/ImageMosaicChartDesignerComponent.ts +1 -1
  164. package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +1 -1
  165. package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +1 -1
  166. package/src/widgets/charts/table/TableChartDesignerComponent.ts +1 -1
  167. package/src/widgets/charts/table/TableChartViewComponent.ts +21 -7
  168. package/src/widgets/text/ExprItemEditorComponent.tsx +1 -1
  169. package/src/widgets/text/TextWidgetDesign.ts +4 -1
  170. package/src/MWaterContextComponent.ts +0 -141
  171. package/src/TableSelectComponent.ts +0 -60
  172. package/src/dashboards/SettingsModalComponent.ts +0 -169
@@ -1,169 +0,0 @@
1
- import PropTypes from "prop-types"
2
- import _ from "lodash"
3
- import React from "react"
4
- const R = React.createElement
5
- import update from "update-object"
6
- import { languages } from "../languages"
7
- import * as ui from "@mwater/react-library/lib/bootstrap"
8
- import { default as ReactSelect } from "react-select"
9
- import * as DashboardUtils from "./DashboardUtils"
10
- import ActionCancelModalComponent from "@mwater/react-library/lib/ActionCancelModalComponent"
11
- import QuickfiltersDesignComponent from "../quickfilter/QuickfiltersDesignComponent"
12
- import FiltersDesignerComponent from "../FiltersDesignerComponent"
13
- import { DataSource, Schema } from "@mwater/expressions"
14
-
15
- export interface SettingsModalComponentProps {
16
- onDesignChange: any
17
- schema: Schema
18
- dataSource: DataSource
19
- }
20
-
21
- interface SettingsModalComponentState {
22
- design: any
23
- }
24
-
25
- // Popup with settings for dashboard
26
- export default class SettingsModalComponent extends React.Component<
27
- SettingsModalComponentProps,
28
- SettingsModalComponentState
29
- > {
30
- static contextTypes = { globalFiltersElementFactory: PropTypes.func }
31
-
32
- constructor(props: any) {
33
- super(props)
34
- this.state = {
35
- design: null // Set when being edited
36
- }
37
- }
38
-
39
- show(design: any) {
40
- return this.setState({ design })
41
- }
42
-
43
- handleSave = () => {
44
- this.props.onDesignChange(this.state.design)
45
- return this.setState({ design: null })
46
- }
47
-
48
- handleCancel = () => {
49
- return this.setState({ design: null })
50
- }
51
- handleDesignChange = (design: any) => {
52
- return this.setState({ design })
53
- }
54
-
55
- handleFiltersChange = (filters: any) => {
56
- const design = _.extend({}, this.state.design, { filters })
57
- return this.handleDesignChange(design)
58
- }
59
-
60
- handleGlobalFiltersChange = (globalFilters: any) => {
61
- const design = _.extend({}, this.state.design, { globalFilters })
62
- return this.handleDesignChange(design)
63
- }
64
-
65
- render() {
66
- // Don't show if not editing
67
- if (!this.state.design) {
68
- return null
69
- }
70
-
71
- // Get filterable tables
72
- const filterableTables = DashboardUtils.getFilterableTables(this.state.design, this.props.schema)
73
-
74
- const localeOptions = _.map(languages, (language) => {
75
- return {
76
- value: language.code,
77
- label: language.en + " (" + language.name + ")"
78
- }
79
- })
80
-
81
- return R(
82
- ActionCancelModalComponent,
83
- {
84
- size: "large",
85
- onCancel: this.handleCancel,
86
- onAction: this.handleSave
87
- },
88
- R(
89
- "div",
90
- { style: { paddingBottom: 200 } },
91
- R("h4", null, "Quick Filters"),
92
- R(
93
- "div",
94
- { className: "text-muted" },
95
- "Quick filters are shown to the user as a dropdown at the top of the dashboard and can be used to filter data of widgets."
96
- ),
97
-
98
- filterableTables.length > 0
99
- ? R(QuickfiltersDesignComponent, {
100
- design: this.state.design.quickfilters || [],
101
- onDesignChange: (design: any) =>
102
- this.handleDesignChange(update(this.state.design, { quickfilters: { $set: design } })),
103
- schema: this.props.schema,
104
- dataSource: this.props.dataSource,
105
- tables: filterableTables
106
- })
107
- : "Nothing to quickfilter. Add widgets to the dashboard",
108
-
109
- R("h4", { style: { paddingTop: 10 } }, "Filters"),
110
- R(
111
- "div",
112
- { className: "text-muted" },
113
- "Filters are built in to the dashboard and cannot be changed by viewers of the dashboard."
114
- ),
115
-
116
- filterableTables.length > 0
117
- ? R(FiltersDesignerComponent, {
118
- schema: this.props.schema,
119
- dataSource: this.props.dataSource,
120
- filters: this.state.design.filters,
121
- onFiltersChange: this.handleFiltersChange,
122
- filterableTables
123
- })
124
- : "Nothing to filter. Add widgets to the dashboard",
125
-
126
- this.context.globalFiltersElementFactory
127
- ? R(
128
- "div",
129
- null,
130
- R("h4", { style: { paddingTop: 10 } }, "Global Filters"),
131
-
132
- this.context.globalFiltersElementFactory({
133
- schema: this.props.schema,
134
- dataSource: this.props.dataSource,
135
- filterableTables,
136
- globalFilters: this.state.design.globalFilters || [],
137
- onChange: this.handleGlobalFiltersChange
138
- })
139
- )
140
- : undefined,
141
-
142
- R("h4", { style: { paddingTop: 10 } }, "Language"),
143
- R(
144
- "div",
145
- { className: "text-muted" },
146
- "Controls the preferred language of widgets and uses specified language when available"
147
- ),
148
-
149
- R(ReactSelect, {
150
- value: _.findWhere(localeOptions, { value: this.state.design.locale || "en" }) || null,
151
- options: localeOptions,
152
- onChange: (locale: any) =>
153
- this.handleDesignChange(update(this.state.design, { locale: { $set: locale.value } }))
154
- }),
155
-
156
- R("h4", { style: { paddingTop: 10 } }, "Advanced"),
157
- R(
158
- ui.Checkbox,
159
- {
160
- value: this.state.design.implicitFiltersEnabled != null ? this.state.design.implicitFiltersEnabled : true,
161
- onChange: (value) =>
162
- this.handleDesignChange(update(this.state.design, { implicitFiltersEnabled: { $set: value } }))
163
- },
164
- "Enable Implicit Filtering (leave unchecked for new dashboards)"
165
- )
166
- )
167
- )
168
- }
169
- }