@mwater/visualization 5.2.0 → 5.3.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.
- package/lib/ColorComponent.d.ts +10 -11
- package/lib/ColorComponent.js +78 -29
- package/lib/ColorSchemeFactory.d.ts +13 -2
- package/lib/ColorSchemeFactory.js +7 -5
- package/lib/CustomColorsContext.d.ts +6 -0
- package/lib/CustomColorsContext.js +6 -0
- package/lib/FiltersDesignerComponent.d.ts +1 -4
- package/lib/FiltersDesignerComponent.js +2 -3
- package/lib/LocaleContextInjector.d.ts +5 -11
- package/lib/LocaleContextInjector.js +4 -12
- package/lib/MWaterAddRelatedFormComponent.js +3 -3
- package/lib/MWaterAddRelatedIndicatorComponent.d.ts +1 -4
- package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
- package/lib/MWaterCompleteTableSelectComponent.d.ts +5 -16
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +4 -6
- package/lib/MWaterContextComponent.js +4 -13
- package/lib/MWaterLoaderComponent.d.ts +5 -3
- package/lib/MWaterLoaderComponent.js +2 -1
- package/lib/MWaterTableSelectComponent.d.ts +1 -4
- package/lib/MWaterTableSelectComponent.js +10 -12
- package/lib/UIComponents.d.ts +2 -2
- package/lib/UIComponents.js +4 -12
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +3 -1
- package/lib/axes/AxisComponent.d.ts +2 -5
- package/lib/axes/AxisComponent.js +1 -2
- package/lib/axes/ColorPaletteCollectionComponent.d.ts +5 -12
- package/lib/axes/ColorPaletteCollectionComponent.js +67 -36
- package/lib/dashboards/DashboardComponent.d.ts +4 -12
- package/lib/dashboards/DashboardComponent.js +18 -38
- package/lib/dashboards/DashboardDesign.d.ts +3 -3
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +109 -132
- package/lib/dashboards/FontStyleEditor.d.ts +8 -0
- package/lib/dashboards/FontStyleEditor.js +130 -0
- package/lib/dashboards/LayoutOptionsComponent.d.ts +0 -1
- package/lib/dashboards/LayoutOptionsComponent.js +211 -42
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/WidgetComponent.d.ts +3 -3
- package/lib/dashboards/WidgetComponent.js +3 -6
- package/lib/dashboards/WidgetDataSourcePrioritizer.d.ts +20 -0
- package/lib/dashboards/WidgetDataSourcePrioritizer.js +72 -0
- package/lib/dashboards/layoutOptions.d.ts +83 -0
- package/lib/dashboards/layoutOptions.js +436 -10
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.js +87 -33
- package/lib/demo.js +3 -3
- package/lib/index.css +5 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -1
- package/lib/layouts/LayoutManager.d.ts +33 -29
- package/lib/layouts/LayoutManager.js +2 -8
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +26 -57
- package/lib/layouts/blocks/BlocksDisplayComponent.js +122 -205
- package/lib/layouts/blocks/BlocksLayoutManager.d.ts +6 -22
- package/lib/layouts/blocks/BlocksLayoutManager.js +5 -14
- package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +5 -4
- package/lib/layouts/blocks/HorizontalBlockComponent.js +5 -5
- package/lib/mWaterLoader.d.ts +2 -0
- package/lib/mWaterLoader.js +2 -1
- package/lib/maps/AddLayerComponent.d.ts +6 -8
- package/lib/maps/AddLayerComponent.js +6 -6
- package/lib/maps/BingLayer.js +10 -20
- package/lib/maps/BufferLayer.js +2 -1
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/DirectMapDataSource.d.ts +5 -2
- package/lib/maps/DirectMapDataSource.js +2 -1
- package/lib/maps/EditPopupComponent.js +2 -1
- package/lib/maps/MapComponent.d.ts +1 -4
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +1 -4
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/ServerMapDataSource.d.ts +2 -3
- package/lib/maps/ServerMapDataSource.js +5 -5
- package/lib/maps/VectorMapViewComponent.js +2 -1
- package/lib/maps/mapSymbols.js +2 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/vectorMaps.js +61 -55
- package/lib/quickfilter/QuickfiltersComponent.d.ts +1 -4
- package/lib/quickfilter/QuickfiltersComponent.js +3 -3
- package/lib/richtext/DropdownPaletteItem.d.ts +32 -0
- package/lib/richtext/DropdownPaletteItem.js +82 -0
- package/lib/richtext/FontColorPaletteItem.d.ts +1 -5
- package/lib/richtext/FontColorPaletteItem.js +32 -27
- package/lib/richtext/ItemsHtmlConverter.js +12 -3
- package/lib/richtext/RichTextComponent.d.ts +26 -52
- package/lib/richtext/RichTextComponent.js +166 -128
- package/lib/valueFormatter.js +6 -1
- package/lib/wellknown.d.ts +5 -0
- package/lib/wellknown.js +288 -0
- package/lib/widgets/DropdownWidgetComponent.d.ts +8 -25
- package/lib/widgets/DropdownWidgetComponent.js +48 -25
- package/lib/widgets/IFrameWidgetComponent.d.ts +1 -2
- package/lib/widgets/ImageWidgetComponent.d.ts +2 -3
- package/lib/widgets/MapWidget.d.ts +2 -0
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/TOCWidget.js +2 -1
- package/lib/widgets/Widget.d.ts +2 -0
- package/lib/widgets/WidgetDataSource.d.ts +3 -1
- package/lib/widgets/charts/Chart.d.ts +0 -1
- package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartViewComponent.js +11 -3
- package/lib/widgets/charts/ChartWidget.d.ts +1 -62
- package/lib/widgets/charts/ChartWidget.js +4 -183
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +51 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +167 -0
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +4 -4
- package/lib/widgets/charts/layered/LayeredChart.d.ts +5 -10
- package/lib/widgets/charts/layered/LayeredChart.js +6 -7
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +4 -2
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +46 -32
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +4 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +3 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -2
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -1
- package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +89 -38
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +5 -112
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +122 -166
- package/lib/widgets/charts/pivot/PivotChart.d.ts +6 -0
- package/lib/widgets/charts/pivot/PivotChart.js +47 -17
- package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +11 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +1 -1
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +20 -36
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +0 -1
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +23 -2
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +215 -181
- package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +9 -28
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/table/TableChart.js +8 -4
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +3 -3
- package/lib/widgets/charts/table/TableChartViewComponent.js +11 -11
- package/lib/widgets/text/TextComponent.d.ts +5 -12
- package/lib/widgets/text/TextComponent.js +19 -39
- package/lib/widgets/text/TextWidget.d.ts +2 -1
- package/lib/widgets/text/TextWidget.js +5 -1
- package/lib/widgets/text/TextWidgetComponent.d.ts +15 -3
- package/lib/widgets/text/TextWidgetComponent.js +76 -19
- package/lib/widgets/text/TextWidgetDesign.d.ts +13 -1
- package/lib/widgets/text/TextWidgetDesign.js +6 -0
- package/package.json +4 -4
- package/src/ColorComponent.tsx +177 -0
- package/src/ColorSchemeFactory.ts +12 -6
- package/src/CustomColorsContext.tsx +8 -0
- package/src/FiltersDesignerComponent.ts +3 -4
- package/src/LocaleContextInjector.tsx +14 -13
- package/src/MWaterAddRelatedFormComponent.ts +3 -3
- package/src/MWaterAddRelatedIndicatorComponent.ts +6 -6
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -36
- package/src/MWaterContextComponent.tsx +8 -17
- package/src/MWaterLoaderComponent.ts +6 -3
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/AxisBuilder.ts +7 -5
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +71 -107
- package/src/dashboards/DashboardDesign.ts +3 -3
- package/src/dashboards/DashboardUpgrader.ts +41 -1
- package/src/dashboards/DashboardViewComponent.tsx +313 -0
- package/src/dashboards/FontStyleEditor.tsx +166 -0
- package/src/dashboards/LayoutOptionsComponent.tsx +379 -75
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/ServerDatagridDataSource.ts +106 -43
- package/src/demo.ts +3 -3
- package/src/index.css +5 -0
- package/src/index.ts +1 -1
- package/src/layouts/LayoutManager.ts +44 -42
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +498 -0
- package/src/layouts/blocks/BlocksLayoutManager.ts +6 -15
- package/src/layouts/blocks/HorizontalBlockComponent.ts +9 -8
- package/src/mWaterLoader.ts +4 -1
- package/src/maps/AddLayerComponent.ts +9 -9
- package/src/maps/BingLayer.ts +16 -26
- package/src/maps/BufferLayer.ts +2 -1
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +7 -7
- package/src/maps/VectorMapViewComponent.tsx +2 -1
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +79 -74
- package/src/quickfilter/QuickfiltersComponent.ts +3 -3
- package/src/richtext/DropdownPaletteItem.tsx +144 -0
- package/src/richtext/FontColorPaletteItem.tsx +160 -0
- package/src/richtext/ItemsHtmlConverter.ts +15 -5
- package/src/richtext/RichTextComponent.tsx +274 -232
- package/src/valueFormatter.ts +5 -1
- package/src/wellknown.ts +286 -0
- package/src/widgets/DropdownWidgetComponent.tsx +75 -0
- package/src/widgets/MapWidget.ts +5 -2
- package/src/widgets/TOCWidget.ts +2 -1
- package/src/widgets/Widget.ts +3 -0
- package/src/widgets/WidgetDataSource.ts +3 -1
- package/src/widgets/charts/Chart.ts +1 -1
- package/src/widgets/charts/ChartViewComponent.ts +16 -3
- package/src/widgets/charts/ChartWidget.ts +3 -275
- package/src/widgets/charts/ChartWidgetComponent.tsx +281 -0
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +4 -4
- package/src/widgets/charts/layered/LayeredChart.ts +4 -6
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +80 -63
- package/src/widgets/charts/layered/LayeredChartDesign.ts +7 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +43 -10
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +6 -6
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +140 -88
- package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +305 -221
- package/src/widgets/charts/pivot/PivotChart.ts +56 -18
- package/src/widgets/charts/pivot/PivotChartDesign.ts +12 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +4 -3
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +39 -76
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +0 -1
- package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +230 -189
- package/src/widgets/charts/pivot/PivotChartUtils.ts +4 -4
- package/src/widgets/charts/pivot/{PivotChartViewComponent.ts → PivotChartViewComponent.tsx} +86 -89
- package/src/widgets/charts/table/TableChart.ts +8 -4
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +4 -4
- package/src/widgets/charts/table/TableChartViewComponent.ts +13 -14
- package/src/widgets/text/TextComponent.tsx +47 -49
- package/src/widgets/text/TextWidget.ts +8 -3
- package/src/widgets/text/TextWidgetComponent.tsx +249 -0
- package/src/widgets/text/TextWidgetDesign.ts +22 -1
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -303
- package/src/dashboards/layoutOptions.ts +0 -40
- package/src/layout-styles.css +0 -263
- package/src/layouts/blocks/BlocksDisplayComponent.ts +0 -461
- package/src/layouts/grid/GridLayoutComponent.ts +0 -67
- package/src/layouts/grid/GridLayoutManager.ts +0 -185
- package/src/layouts/grid/LegoLayoutEngine.ts +0 -142
- package/src/layouts/grid/PaletteItemComponent.ts +0 -28
- package/src/layouts/grid/README.md +0 -14
- package/src/layouts/grid/WidgetContainerComponent.ts +0 -420
- package/src/richtext/FontColorPaletteItem.ts +0 -172
- package/src/richtext/FontSizePaletteItem.ts +0 -110
- package/src/widgets/DropdownWidgetComponent.ts +0 -78
- package/src/widgets/text/TextWidgetComponent.ts +0 -120
|
@@ -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 jquery_1 = __importDefault(require("jquery"));
|
|
31
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
32
31
|
const react_1 = __importDefault(require("react"));
|
|
33
32
|
const R = react_1.default.createElement;
|
|
34
33
|
const querystring_1 = __importDefault(require("querystring"));
|
|
@@ -40,6 +39,7 @@ const ModalPopupComponent_1 = __importDefault(require("@mwater/react-library/lib
|
|
|
40
39
|
const MWaterCustomTablesetListComponent_1 = require("./MWaterCustomTablesetListComponent");
|
|
41
40
|
const MWaterMetricsTableListComponent_1 = require("./MWaterMetricsTableListComponent");
|
|
42
41
|
const MWaterAssetSystemsListComponent_1 = require("./MWaterAssetSystemsListComponent");
|
|
42
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
43
43
|
const sitesOrder = {
|
|
44
44
|
"entities.water_point": 1,
|
|
45
45
|
"entities.sanitation_facility": 2,
|
|
@@ -59,7 +59,7 @@ const assetEntities = [
|
|
|
59
59
|
];
|
|
60
60
|
// Allows selection of a table. Is the complete list mode of tables
|
|
61
61
|
class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
62
|
-
static
|
|
62
|
+
static contextType = contexts_1.LocaleContext;
|
|
63
63
|
constructor(props) {
|
|
64
64
|
super(props);
|
|
65
65
|
this.state = {
|
|
@@ -98,8 +98,8 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
98
98
|
items: lodash_1.default.compact(lodash_1.default.map(types, (tableId) => {
|
|
99
99
|
table = this.props.schema.getTable(tableId);
|
|
100
100
|
return {
|
|
101
|
-
name: expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
102
|
-
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context
|
|
101
|
+
name: expressions_1.ExprUtils.localizeString(table.name, this.context),
|
|
102
|
+
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context),
|
|
103
103
|
onClick: this.props.onChange.bind(null, table.id)
|
|
104
104
|
};
|
|
105
105
|
}))
|
|
@@ -147,8 +147,8 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
147
147
|
return R(uiComponents.OptionListComponent, {
|
|
148
148
|
items: lodash_1.default.map(sweetSenseTables, (table) => {
|
|
149
149
|
return {
|
|
150
|
-
name: expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
151
|
-
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context
|
|
150
|
+
name: expressions_1.ExprUtils.localizeString(table.name, this.context),
|
|
151
|
+
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context),
|
|
152
152
|
onClick: this.props.onChange.bind(null, table.id)
|
|
153
153
|
};
|
|
154
154
|
})
|
|
@@ -164,7 +164,7 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
164
164
|
extraTables: this.props.extraTables,
|
|
165
165
|
onExtraTableAdd: this.handleExtraTableAdd,
|
|
166
166
|
onExtraTableRemove: this.handleExtraTableRemove,
|
|
167
|
-
locale: this.context
|
|
167
|
+
locale: this.context
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
renderMetrics() {
|
|
@@ -177,7 +177,7 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
177
177
|
extraTables: this.props.extraTables,
|
|
178
178
|
onExtraTableAdd: this.handleExtraTableAdd,
|
|
179
179
|
onExtraTableRemove: this.handleExtraTableRemove,
|
|
180
|
-
locale: this.context
|
|
180
|
+
locale: this.context
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
renderAssets() {
|
|
@@ -188,8 +188,8 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
188
188
|
continue;
|
|
189
189
|
}
|
|
190
190
|
items.push({
|
|
191
|
-
name: expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
192
|
-
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context
|
|
191
|
+
name: expressions_1.ExprUtils.localizeString(table.name, this.context),
|
|
192
|
+
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context),
|
|
193
193
|
onClick: this.props.onChange.bind(null, table.id)
|
|
194
194
|
});
|
|
195
195
|
}
|
|
@@ -211,7 +211,7 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
211
211
|
extraTables: this.props.extraTables,
|
|
212
212
|
onExtraTableAdd: this.handleExtraTableAdd,
|
|
213
213
|
onExtraTableRemove: this.handleExtraTableRemove,
|
|
214
|
-
locale: this.context
|
|
214
|
+
locale: this.context
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
217
|
renderOther() {
|
|
@@ -258,8 +258,8 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
258
258
|
return R(uiComponents.OptionListComponent, {
|
|
259
259
|
items: lodash_1.default.map(otherTables, (table) => {
|
|
260
260
|
return {
|
|
261
|
-
name: expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
262
|
-
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context
|
|
261
|
+
name: expressions_1.ExprUtils.localizeString(table.name, this.context),
|
|
262
|
+
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context),
|
|
263
263
|
onClick: this.props.onChange.bind(null, table.id)
|
|
264
264
|
};
|
|
265
265
|
})
|
|
@@ -308,7 +308,7 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
308
308
|
exports.default = MWaterCompleteTableSelectComponent;
|
|
309
309
|
// Searchable list of forms
|
|
310
310
|
class FormsListComponent extends react_1.default.Component {
|
|
311
|
-
static
|
|
311
|
+
static contextType = contexts_1.LocaleContext;
|
|
312
312
|
constructor(props) {
|
|
313
313
|
super(props);
|
|
314
314
|
this.state = {
|
|
@@ -341,14 +341,14 @@ class FormsListComponent extends react_1.default.Component {
|
|
|
341
341
|
// TODO use name instead of design.name
|
|
342
342
|
this.setState({
|
|
343
343
|
forms: lodash_1.default.map(forms, (form) => {
|
|
344
|
-
let desc = expressions_1.ExprUtils.localizeString(form.design.description,
|
|
344
|
+
let desc = expressions_1.ExprUtils.localizeString(form.design.description, null) || "";
|
|
345
345
|
if (desc) {
|
|
346
346
|
desc += " - ";
|
|
347
347
|
}
|
|
348
348
|
desc += `Modified ${(0, moment_1.default)(form.modified?.on, moment_1.default.ISO_8601).format("ll")}`;
|
|
349
349
|
return {
|
|
350
350
|
id: form._id,
|
|
351
|
-
name: expressions_1.ExprUtils.localizeString(form.design.name,
|
|
351
|
+
name: expressions_1.ExprUtils.localizeString(form.design.name, null),
|
|
352
352
|
desc
|
|
353
353
|
};
|
|
354
354
|
})
|
|
@@ -358,7 +358,7 @@ class FormsListComponent extends react_1.default.Component {
|
|
|
358
358
|
});
|
|
359
359
|
}
|
|
360
360
|
handleTableRemove = (table) => {
|
|
361
|
-
if (confirm(`Remove ${expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
361
|
+
if (confirm(`Remove ${expressions_1.ExprUtils.localizeString(table.name, this.context)}? Any widgets that depend on it will no longer work properly.`)) {
|
|
362
362
|
return this.props.onExtraTableRemove(table.id);
|
|
363
363
|
}
|
|
364
364
|
};
|
|
@@ -391,8 +391,8 @@ class FormsListComponent extends react_1.default.Component {
|
|
|
391
391
|
? R(uiComponents.OptionListComponent, {
|
|
392
392
|
items: lodash_1.default.map(tables, (table) => {
|
|
393
393
|
return {
|
|
394
|
-
name: expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
395
|
-
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context
|
|
394
|
+
name: expressions_1.ExprUtils.localizeString(table.name, this.context),
|
|
395
|
+
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context),
|
|
396
396
|
onClick: this.props.onChange.bind(null, table.id),
|
|
397
397
|
onRemove: this.handleTableRemove.bind(null, table)
|
|
398
398
|
};
|
|
@@ -423,7 +423,7 @@ class FormsListComponent extends react_1.default.Component {
|
|
|
423
423
|
}
|
|
424
424
|
// Searchable list of indicators
|
|
425
425
|
class IndicatorsListComponent extends react_1.default.Component {
|
|
426
|
-
static
|
|
426
|
+
static contextType = contexts_1.LocaleContext;
|
|
427
427
|
addIndicatorConfirmPopup;
|
|
428
428
|
constructor(props) {
|
|
429
429
|
super(props);
|
|
@@ -445,13 +445,13 @@ class IndicatorsListComponent extends react_1.default.Component {
|
|
|
445
445
|
indicators = lodash_1.default.sortByOrder(indicators, [
|
|
446
446
|
(indicator) => ((this.props.extraTables || []).includes("indicator_values:" + indicator._id) ? 0 : 1),
|
|
447
447
|
(indicator) => (indicator.design.recommended ? 0 : 1),
|
|
448
|
-
(indicator) => expressions_1.ExprUtils.localizeString(indicator.design.name, this.context
|
|
448
|
+
(indicator) => expressions_1.ExprUtils.localizeString(indicator.design.name, this.context)
|
|
449
449
|
], ["asc", "asc", "asc"]);
|
|
450
450
|
return this.setState({
|
|
451
451
|
indicators: lodash_1.default.map(indicators, (indicator) => ({
|
|
452
452
|
id: indicator._id,
|
|
453
|
-
name: expressions_1.ExprUtils.localizeString(indicator.design.name, this.context
|
|
454
|
-
desc: expressions_1.ExprUtils.localizeString(indicator.design.desc, this.context
|
|
453
|
+
name: expressions_1.ExprUtils.localizeString(indicator.design.name, this.context),
|
|
454
|
+
desc: expressions_1.ExprUtils.localizeString(indicator.design.desc, this.context)
|
|
455
455
|
}))
|
|
456
456
|
});
|
|
457
457
|
}).fail((xhr) => {
|
|
@@ -459,7 +459,7 @@ class IndicatorsListComponent extends react_1.default.Component {
|
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
handleTableRemove = (table) => {
|
|
462
|
-
if (confirm(`Remove ${expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
462
|
+
if (confirm(`Remove ${expressions_1.ExprUtils.localizeString(table.name, this.context)}? Any widgets that depend on it will no longer work properly.`)) {
|
|
463
463
|
return this.props.onExtraTableRemove(table.id);
|
|
464
464
|
}
|
|
465
465
|
};
|
|
@@ -506,8 +506,8 @@ class IndicatorsListComponent extends react_1.default.Component {
|
|
|
506
506
|
? R(uiComponents.OptionListComponent, {
|
|
507
507
|
items: lodash_1.default.map(tables, (table) => {
|
|
508
508
|
return {
|
|
509
|
-
name: expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
510
|
-
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context
|
|
509
|
+
name: expressions_1.ExprUtils.localizeString(table.name, this.context),
|
|
510
|
+
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context),
|
|
511
511
|
onClick: this.handleSelect.bind(null, table.id),
|
|
512
512
|
onRemove: this.handleTableRemove.bind(null, table)
|
|
513
513
|
};
|
|
@@ -537,7 +537,7 @@ class IndicatorsListComponent extends react_1.default.Component {
|
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
class AddIndicatorConfirmPopupComponent extends react_1.default.Component {
|
|
540
|
-
static
|
|
540
|
+
static contextType = contexts_1.LocaleContext;
|
|
541
541
|
constructor(props) {
|
|
542
542
|
super(props);
|
|
543
543
|
this.state = {
|
|
@@ -559,8 +559,8 @@ class AddIndicatorConfirmPopupComponent extends react_1.default.Component {
|
|
|
559
559
|
below, then find the indicator values in the 'Related Indicators' section. Or click on 'Use Raw Indicator' if you
|
|
560
560
|
are certain that you want to use the raw indicator table`), R(uiComponents.OptionListComponent, {
|
|
561
561
|
items: lodash_1.default.map(entityColumns, (entityColumn) => ({
|
|
562
|
-
name: expressions_1.ExprUtils.localizeString(entityColumn.name, this.context
|
|
563
|
-
desc: expressions_1.ExprUtils.localizeString(entityColumn.desc, this.context
|
|
562
|
+
name: expressions_1.ExprUtils.localizeString(entityColumn.name, this.context),
|
|
563
|
+
desc: expressions_1.ExprUtils.localizeString(entityColumn.desc, this.context),
|
|
564
564
|
onClick: () => {
|
|
565
565
|
// Select table
|
|
566
566
|
this.props.onChange(entityColumn.join.toTable);
|
|
@@ -582,7 +582,7 @@ are certain that you want to use the raw indicator table`), R(uiComponents.Optio
|
|
|
582
582
|
}
|
|
583
583
|
// Searchable list of issue types
|
|
584
584
|
class IssuesListComponent extends react_1.default.Component {
|
|
585
|
-
static
|
|
585
|
+
static contextType = contexts_1.LocaleContext;
|
|
586
586
|
constructor(props) {
|
|
587
587
|
super(props);
|
|
588
588
|
this.state = {
|
|
@@ -601,13 +601,13 @@ class IssuesListComponent extends react_1.default.Component {
|
|
|
601
601
|
issueTypes = lodash_1.default.sortByOrder(issueTypes, [
|
|
602
602
|
(issueType) => ((this.props.extraTables || []).includes("issues:" + issueType._id) ? 0 : 1),
|
|
603
603
|
(issueType) => (issueType.created.by === this.props.user ? 0 : 1),
|
|
604
|
-
(issueType) => expressions_1.ExprUtils.localizeString(issueType.name, this.context
|
|
604
|
+
(issueType) => expressions_1.ExprUtils.localizeString(issueType.name, this.context)
|
|
605
605
|
], ["asc", "asc", "asc"]);
|
|
606
606
|
return this.setState({
|
|
607
607
|
issueTypes: lodash_1.default.map(issueTypes, (issueType) => ({
|
|
608
608
|
id: issueType._id,
|
|
609
|
-
name: expressions_1.ExprUtils.localizeString(issueType.name, this.context
|
|
610
|
-
desc: expressions_1.ExprUtils.localizeString(issueType.desc, this.context
|
|
609
|
+
name: expressions_1.ExprUtils.localizeString(issueType.name, this.context),
|
|
610
|
+
desc: expressions_1.ExprUtils.localizeString(issueType.desc, this.context)
|
|
611
611
|
}))
|
|
612
612
|
});
|
|
613
613
|
}).fail((xhr) => {
|
|
@@ -615,7 +615,7 @@ class IssuesListComponent extends react_1.default.Component {
|
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
617
|
handleTableRemove = (table) => {
|
|
618
|
-
if (confirm(`Remove ${expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
618
|
+
if (confirm(`Remove ${expressions_1.ExprUtils.localizeString(table.name, this.context)}? Any widgets that depend on it will no longer work properly.`)) {
|
|
619
619
|
return this.props.onExtraTableRemove(table.id);
|
|
620
620
|
}
|
|
621
621
|
};
|
|
@@ -648,8 +648,8 @@ class IssuesListComponent extends react_1.default.Component {
|
|
|
648
648
|
? R(uiComponents.OptionListComponent, {
|
|
649
649
|
items: lodash_1.default.map(tables, (table) => {
|
|
650
650
|
return {
|
|
651
|
-
name: expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
652
|
-
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context
|
|
651
|
+
name: expressions_1.ExprUtils.localizeString(table.name, this.context),
|
|
652
|
+
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context),
|
|
653
653
|
onClick: this.props.onChange.bind(null, table.id),
|
|
654
654
|
onRemove: this.handleTableRemove.bind(null, table)
|
|
655
655
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { DataSource, Schema, Section } from "@mwater/expressions";
|
|
4
3
|
import { CustomTableSelectComponentFactoryOptions, DecorateScalarExprTreeSectionChildrenOptions } from "@mwater/expressions-ui";
|
|
5
4
|
import { GlobalFilter } from "./GlobalFilter";
|
|
5
|
+
import { AddLayerComponentProps } from "./maps/AddLayerComponent";
|
|
6
6
|
export interface GlobalFiltersElementFactoryProps {
|
|
7
7
|
schema: Schema;
|
|
8
8
|
dataSource: DataSource;
|
|
@@ -14,6 +14,8 @@ export interface GlobalFiltersElementFactoryProps {
|
|
|
14
14
|
}
|
|
15
15
|
export type GlobalFiltersElementFactory = (props: GlobalFiltersElementFactoryProps) => React.ReactElement | null;
|
|
16
16
|
export declare const GlobalFiltersElementFactoryContext: React.Context<GlobalFiltersElementFactory | null>;
|
|
17
|
+
export type AddLayerElementFactory = (props: AddLayerComponentProps) => React.ReactElement | null;
|
|
18
|
+
export declare const AddLayerElementFactoryContext: React.Context<AddLayerElementFactory | undefined>;
|
|
17
19
|
/**
|
|
18
20
|
* Creates several contexts to allow selecting of a table in an mWater-friendly way
|
|
19
21
|
* and several other context items
|
|
@@ -29,13 +31,9 @@ export default class MWaterContextComponent extends React.Component<{
|
|
|
29
31
|
/** Called when extra tables are changed and schema will be reloaded */
|
|
30
32
|
onExtraTablesChange?: (extraTables: string[]) => void;
|
|
31
33
|
/** Override default add layer component. See AddLayerComponent for details */
|
|
32
|
-
addLayerElementFactory?:
|
|
34
|
+
addLayerElementFactory?: AddLayerElementFactory;
|
|
33
35
|
}> {
|
|
34
|
-
static childContextTypes: {
|
|
35
|
-
addLayerElementFactory: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
-
};
|
|
37
36
|
createTableSelectElementFactory: (options: CustomTableSelectComponentFactoryOptions) => React.JSX.Element;
|
|
38
|
-
getChildContext(): any;
|
|
39
37
|
createGlobalFiltersElementFactory: (props: GlobalFiltersElementFactoryProps) => React.JSX.Element | null;
|
|
40
38
|
isScalarExprTreeSectionMatch: (options: {
|
|
41
39
|
tableId: string;
|
|
@@ -26,8 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.GlobalFiltersElementFactoryContext = void 0;
|
|
30
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
29
|
+
exports.AddLayerElementFactoryContext = exports.GlobalFiltersElementFactoryContext = void 0;
|
|
31
30
|
const lodash_1 = __importDefault(require("lodash"));
|
|
32
31
|
const react_1 = __importStar(require("react"));
|
|
33
32
|
const R = react_1.default.createElement;
|
|
@@ -38,24 +37,15 @@ const MWaterGlobalFiltersComponent_1 = __importDefault(require("./MWaterGlobalFi
|
|
|
38
37
|
const expressions_ui_1 = require("@mwater/expressions-ui");
|
|
39
38
|
const expressions_ui_2 = require("@mwater/expressions-ui");
|
|
40
39
|
exports.GlobalFiltersElementFactoryContext = (0, react_1.createContext)(null);
|
|
40
|
+
exports.AddLayerElementFactoryContext = (0, react_1.createContext)(undefined);
|
|
41
41
|
/**
|
|
42
42
|
* Creates several contexts to allow selecting of a table in an mWater-friendly way
|
|
43
43
|
* and several other context items
|
|
44
44
|
*/
|
|
45
45
|
class MWaterContextComponent extends react_1.default.Component {
|
|
46
|
-
static childContextTypes = {
|
|
47
|
-
addLayerElementFactory: prop_types_1.default.func, // Call with props of AddLayerComponent
|
|
48
|
-
};
|
|
49
46
|
createTableSelectElementFactory = (options) => {
|
|
50
47
|
return (react_1.default.createElement(MWaterTableSelectComponent_1.default, { apiUrl: this.props.apiUrl, client: this.props.client, schema: options.schema, user: this.props.user, table: options.value ?? undefined, onChange: options.onChange, extraTables: this.props.extraTables, onExtraTablesChange: this.props.onExtraTablesChange, filter: options.filter, onFilterChange: options.onFilterChange }));
|
|
51
48
|
};
|
|
52
|
-
getChildContext() {
|
|
53
|
-
const context = {};
|
|
54
|
-
if (this.props.addLayerElementFactory) {
|
|
55
|
-
context.addLayerElementFactory = this.props.addLayerElementFactory;
|
|
56
|
-
}
|
|
57
|
-
return context;
|
|
58
|
-
}
|
|
59
49
|
createGlobalFiltersElementFactory = (props) => {
|
|
60
50
|
if (props.nullIfIrrelevant && !lodash_1.default.any(props.filterableTables, (t) => t.match(/^entities./))) {
|
|
61
51
|
return null;
|
|
@@ -110,7 +100,8 @@ class MWaterContextComponent extends react_1.default.Component {
|
|
|
110
100
|
react_1.default.createElement(exports.GlobalFiltersElementFactoryContext.Provider, { value: this.createGlobalFiltersElementFactory },
|
|
111
101
|
react_1.default.createElement(expressions_ui_2.IsScalarExprTreeSectionMatchContext.Provider, { value: this.isScalarExprTreeSectionMatch },
|
|
112
102
|
react_1.default.createElement(expressions_ui_2.IsScalarExprTreeSectionInitiallyOpenContext.Provider, { value: this.isScalarExprTreeSectionInitiallyOpen },
|
|
113
|
-
react_1.default.createElement(expressions_ui_1.DecorateScalarExprTreeSectionChildrenContext.Provider, { value: this.decorateScalarExprTreeSectionChildren },
|
|
103
|
+
react_1.default.createElement(expressions_ui_1.DecorateScalarExprTreeSectionChildrenContext.Provider, { value: this.decorateScalarExprTreeSectionChildren },
|
|
104
|
+
react_1.default.createElement(exports.AddLayerElementFactoryContext.Provider, { value: this.props.addLayerElementFactory }, this.props.children))))),
|
|
114
105
|
" ");
|
|
115
106
|
}
|
|
116
107
|
}
|
|
@@ -2,7 +2,7 @@ import React, { ReactElement } from "react";
|
|
|
2
2
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
3
|
import AsyncLoadComponent from "@mwater/react-library/lib/AsyncLoadComponent";
|
|
4
4
|
import LoadingComponent from "@mwater/react-library/lib/LoadingComponent";
|
|
5
|
-
import MWaterContextComponent from "./MWaterContextComponent";
|
|
5
|
+
import MWaterContextComponent, { AddLayerElementFactory } from "./MWaterContextComponent";
|
|
6
6
|
/**
|
|
7
7
|
* Loads an mWater schema from the server and creates child with schema and dataSource
|
|
8
8
|
* Also creates context to allow selecting of a table in an mWater-friendly way
|
|
@@ -23,13 +23,15 @@ export default class MWaterLoaderComponent extends AsyncLoadComponent<{
|
|
|
23
23
|
/** Locales of the schema to load. Default is all. */
|
|
24
24
|
locales?: string[];
|
|
25
25
|
/** Override default add layer component. See AddLayerComponent for details */
|
|
26
|
-
addLayerElementFactory?:
|
|
26
|
+
addLayerElementFactory?: AddLayerElementFactory;
|
|
27
27
|
children: (error: any, config?: {
|
|
28
28
|
schema: Schema;
|
|
29
29
|
dataSource: DataSource;
|
|
30
30
|
}) => ReactElement<any>;
|
|
31
31
|
/** Custom error formatter that returns React node or string, gets passed the error response from server */
|
|
32
32
|
errorFormatter?: (data: any, defaultError: string) => string;
|
|
33
|
+
/** Origin of usage. e.g. "dashboards:43445364..." */
|
|
34
|
+
origin?: string;
|
|
33
35
|
}, {
|
|
34
36
|
error: any;
|
|
35
37
|
schema: Schema | null;
|
|
@@ -47,6 +49,6 @@ export default class MWaterLoaderComponent extends AsyncLoadComponent<{
|
|
|
47
49
|
schema: Schema;
|
|
48
50
|
extraTables?: string[] | undefined;
|
|
49
51
|
onExtraTablesChange?: ((extraTables: string[]) => void) | undefined;
|
|
50
|
-
addLayerElementFactory?:
|
|
52
|
+
addLayerElementFactory?: AddLayerElementFactory | undefined;
|
|
51
53
|
}, MWaterContextComponent>;
|
|
52
54
|
}
|
|
@@ -40,7 +40,8 @@ class MWaterLoaderComponent extends AsyncLoadComponent_1.default {
|
|
|
40
40
|
share: props.share,
|
|
41
41
|
asUser: props.asUser,
|
|
42
42
|
extraTables: props.extraTables,
|
|
43
|
-
locales: props.locales
|
|
43
|
+
locales: props.locales,
|
|
44
|
+
origin: props.origin
|
|
44
45
|
}, (error, config) => {
|
|
45
46
|
if (error) {
|
|
46
47
|
const defaultError = `Cannot load one of the forms that this depends on. Perhaps the administrator has not shared the form with you? Details: ${error.message}`;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { Schema } from "@mwater/expressions";
|
|
4
3
|
export interface MWaterTableSelectComponentProps {
|
|
@@ -22,9 +21,7 @@ interface MWaterTableSelectComponentState {
|
|
|
22
21
|
pendingExtraTable: any;
|
|
23
22
|
}
|
|
24
23
|
export default class MWaterTableSelectComponent extends React.Component<MWaterTableSelectComponentProps, MWaterTableSelectComponentState> {
|
|
25
|
-
static
|
|
26
|
-
locale: PropTypes.Requireable<string>;
|
|
27
|
-
};
|
|
24
|
+
static contextType: React.Context<string>;
|
|
28
25
|
toggleEdit: any;
|
|
29
26
|
constructor(props: any);
|
|
30
27
|
componentWillReceiveProps(nextProps: any): any;
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
8
7
|
const react_1 = __importDefault(require("react"));
|
|
9
8
|
const R = react_1.default.createElement;
|
|
10
9
|
const UIComponents_1 = require("./UIComponents");
|
|
@@ -15,9 +14,7 @@ const MWaterCompleteTableSelectComponent_1 = __importDefault(require("./MWaterCo
|
|
|
15
14
|
const expressions_ui_1 = require("@mwater/expressions-ui");
|
|
16
15
|
// Allows selection of a mwater-visualization table. Loads forms as well and calls event if modified
|
|
17
16
|
class MWaterTableSelectComponent extends react_1.default.Component {
|
|
18
|
-
static
|
|
19
|
-
locale: prop_types_1.default.string, // e.g. "en"
|
|
20
|
-
};
|
|
17
|
+
static contextType = expressions_ui_1.LocaleContext;
|
|
21
18
|
toggleEdit;
|
|
22
19
|
constructor(props) {
|
|
23
20
|
super(props);
|
|
@@ -96,9 +93,12 @@ class MWaterTableSelectComponent extends react_1.default.Component {
|
|
|
96
93
|
},
|
|
97
94
|
forceOpen: !this.props.table,
|
|
98
95
|
label: this.props.table
|
|
99
|
-
? expressions_1.ExprUtils.localizeString(this.props.schema.getTable(this.props.table)?.name, this.context
|
|
96
|
+
? expressions_1.ExprUtils.localizeString(this.props.schema.getTable(this.props.table)?.name, this.context)
|
|
100
97
|
: "",
|
|
101
|
-
editor
|
|
98
|
+
editor,
|
|
99
|
+
onRemove: () => {
|
|
100
|
+
this.props.onChange(null);
|
|
101
|
+
}
|
|
102
102
|
}),
|
|
103
103
|
// Make sure table still exists
|
|
104
104
|
this.props.table &&
|
|
@@ -117,9 +117,7 @@ class MWaterTableSelectComponent extends react_1.default.Component {
|
|
|
117
117
|
exports.default = MWaterTableSelectComponent;
|
|
118
118
|
// Is the table select component when in edit mode. Toggles between complete list and simplified list
|
|
119
119
|
class EditModeTableSelectComponent extends react_1.default.Component {
|
|
120
|
-
static
|
|
121
|
-
locale: prop_types_1.default.string, // e.g. "en"
|
|
122
|
-
};
|
|
120
|
+
static contextType = expressions_ui_1.LocaleContext;
|
|
123
121
|
constructor(props) {
|
|
124
122
|
super(props);
|
|
125
123
|
this.state = {
|
|
@@ -158,7 +156,7 @@ class EditModeTableSelectComponent extends react_1.default.Component {
|
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
// Sort by name
|
|
161
|
-
tables = lodash_1.default.sortBy(tables, (tableId) => expressions_1.ExprUtils.localizeString(this.props.schema.getTable(tableId).name, this.context
|
|
159
|
+
tables = lodash_1.default.sortBy(tables, (tableId) => expressions_1.ExprUtils.localizeString(this.props.schema.getTable(tableId).name, this.context));
|
|
162
160
|
return tables;
|
|
163
161
|
}
|
|
164
162
|
handleCompleteChange = (tableId) => {
|
|
@@ -174,8 +172,8 @@ class EditModeTableSelectComponent extends react_1.default.Component {
|
|
|
174
172
|
react_1.default.createElement(UIComponents_1.OptionListComponent, { items: this.getTableShortlist(activeTables).map((tableId) => {
|
|
175
173
|
const table = this.props.schema.getTable(tableId);
|
|
176
174
|
return {
|
|
177
|
-
name: expressions_1.ExprUtils.localizeString(table.name, this.context
|
|
178
|
-
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context
|
|
175
|
+
name: expressions_1.ExprUtils.localizeString(table.name, this.context),
|
|
176
|
+
desc: expressions_1.ExprUtils.localizeString(table.desc, this.context),
|
|
179
177
|
onClick: () => this.props.onChange(table.id)
|
|
180
178
|
};
|
|
181
179
|
}) }),
|
package/lib/UIComponents.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as motion from "react-motion";
|
|
|
3
3
|
export interface SectionComponentProps {
|
|
4
4
|
icon?: string;
|
|
5
5
|
label?: any;
|
|
6
|
+
required?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare class SectionComponent extends React.Component<SectionComponentProps> {
|
|
8
9
|
render(): React.DetailedReactHTMLElement<{
|
|
@@ -56,7 +57,7 @@ export interface ToggleEditComponentProps {
|
|
|
56
57
|
initiallyOpen?: boolean;
|
|
57
58
|
label: any;
|
|
58
59
|
editor: any;
|
|
59
|
-
onRemove?:
|
|
60
|
+
onRemove?: () => void;
|
|
60
61
|
}
|
|
61
62
|
interface ToggleEditComponentState {
|
|
62
63
|
open: any;
|
|
@@ -66,7 +67,6 @@ export declare class ToggleEditComponent extends React.Component<ToggleEditCompo
|
|
|
66
67
|
close: () => void;
|
|
67
68
|
open: () => void;
|
|
68
69
|
handleToggle: () => void;
|
|
69
|
-
editorRef: (editorComp: any) => any;
|
|
70
70
|
render(): React.CElement<any, SwitchViewComponent>;
|
|
71
71
|
}
|
|
72
72
|
export interface RadioToggleComponentProps {
|
package/lib/UIComponents.js
CHANGED
|
@@ -42,7 +42,7 @@ class SectionComponent extends react_1.default.Component {
|
|
|
42
42
|
? [R("i", { className: `fa ${this.props.icon}` }), " "]
|
|
43
43
|
: undefined, this.props.icon && this.props.icon.match(/^glyphicon-/)
|
|
44
44
|
? [R("span", { className: `glyphicon ${this.props.icon}` }), " "]
|
|
45
|
-
: undefined, this.props.label), R("div", { style: { marginLeft: 10 } }, this.props.children));
|
|
45
|
+
: undefined, this.props.label, this.props.required ? react_1.default.createElement("span", { style: { color: "red" } }, " *") : undefined), R("div", { style: { marginLeft: 10 } }, this.props.children));
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
exports.SectionComponent = SectionComponent;
|
|
@@ -149,21 +149,13 @@ class ToggleEditComponent extends react_1.default.Component {
|
|
|
149
149
|
this.state = { open: props.initiallyOpen || false };
|
|
150
150
|
}
|
|
151
151
|
close = () => {
|
|
152
|
-
|
|
153
|
-
if (this.editorComp) {
|
|
154
|
-
this.editorHeight = react_dom_1.default.findDOMNode(this.editorComp).clientHeight;
|
|
155
|
-
}
|
|
156
|
-
return this.setState({ open: false });
|
|
152
|
+
this.setState({ open: false });
|
|
157
153
|
};
|
|
158
154
|
open = () => {
|
|
159
|
-
|
|
155
|
+
this.setState({ open: true });
|
|
160
156
|
};
|
|
161
157
|
handleToggle = () => {
|
|
162
|
-
|
|
163
|
-
};
|
|
164
|
-
// Save editor comp
|
|
165
|
-
editorRef = (editorComp) => {
|
|
166
|
-
return (this.editorComp = editorComp);
|
|
158
|
+
this.setState({ open: !this.state.open });
|
|
167
159
|
};
|
|
168
160
|
render() {
|
|
169
161
|
let { editor } = this.props;
|
|
@@ -53,10 +53,13 @@ export default class AxisBuilder {
|
|
|
53
53
|
*/
|
|
54
54
|
onlyValuesPresent?: boolean;
|
|
55
55
|
}): AxisCategory[];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Get type of axis output
|
|
58
|
+
*/
|
|
59
|
+
getAxisType(axis: Axis | null | undefined): LiteralType | null;
|
|
60
|
+
isAxisAggr(axis: Axis | null | undefined): string | boolean;
|
|
61
|
+
doesAxisSupportCumulative(axis: Axis): boolean;
|
|
62
|
+
formatCategory(axis: Axis, category: any): any;
|
|
60
63
|
summarizeAxis(axis: Axis, locale?: string): string;
|
|
61
64
|
formatValue(axis: Axis, value: any, locale?: string, legacyPercentFormat?: any): any;
|
|
62
65
|
createValueFilter(axis: Axis, value: any): JsonQLExpr;
|
package/lib/axes/AxisBuilder.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import AsyncLoadComponent from "@mwater/react-library/lib/AsyncLoadComponent";
|
|
4
3
|
import { DataSource, LiteralType, Schema } from "@mwater/expressions";
|
|
@@ -15,7 +14,7 @@ export interface AxisComponentProps {
|
|
|
15
14
|
/** Optional types to limit to */
|
|
16
15
|
types?: LiteralType[];
|
|
17
16
|
aggrNeed: "none" | "optional" | "required";
|
|
18
|
-
value?: Axis;
|
|
17
|
+
value?: Axis | null;
|
|
19
18
|
onChange: (axis: Axis | null) => void;
|
|
20
19
|
/** Makes this a required value */
|
|
21
20
|
required?: boolean;
|
|
@@ -44,9 +43,7 @@ export default class AxisComponent extends AsyncLoadComponent<AxisComponentProps
|
|
|
44
43
|
allowExcludedValues: boolean;
|
|
45
44
|
autosetColors: boolean;
|
|
46
45
|
};
|
|
47
|
-
static
|
|
48
|
-
locale: PropTypes.Requireable<string>;
|
|
49
|
-
};
|
|
46
|
+
static contextType: React.Context<string>;
|
|
50
47
|
constructor(props: any);
|
|
51
48
|
isLoadNeeded(newProps: any, oldProps: any): boolean;
|
|
52
49
|
load(props: any, prevProps: any, callback: any): any;
|
|
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
30
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
31
30
|
const react_1 = __importDefault(require("react"));
|
|
32
31
|
const R = react_1.default.createElement;
|
|
33
32
|
const uuid_1 = __importDefault(require("uuid"));
|
|
@@ -52,7 +51,7 @@ class AxisComponent extends AsyncLoadComponent_1.default {
|
|
|
52
51
|
allowExcludedValues: false,
|
|
53
52
|
autosetColors: true
|
|
54
53
|
};
|
|
55
|
-
static
|
|
54
|
+
static contextType = expressions_ui_1.LocaleContext;
|
|
56
55
|
constructor(props) {
|
|
57
56
|
super(props);
|
|
58
57
|
this.state = {
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Axis, AxisCategory } from "./Axis";
|
|
2
|
+
import { Axis, AxisCategory, ColorMap } from "./Axis";
|
|
3
3
|
export interface ColorPaletteCollectionComponentProps {
|
|
4
|
-
onPaletteSelected: any;
|
|
5
4
|
axis: Axis;
|
|
6
5
|
categories: AxisCategory[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export default class ColorPaletteCollectionComponent extends React.Component<ColorPaletteCollectionComponentProps> {
|
|
10
|
-
static palettes: {
|
|
11
|
-
type: string;
|
|
12
|
-
reversed: boolean;
|
|
13
|
-
}[];
|
|
14
|
-
onPaletteSelected: (index: any) => any;
|
|
15
|
-
renderCancel: () => React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | null;
|
|
16
|
-
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
6
|
+
onPaletteSelected: (colorMap: ColorMap) => void;
|
|
7
|
+
onCancel: () => void;
|
|
17
8
|
}
|
|
9
|
+
declare function ColorPaletteCollectionComponent(props: ColorPaletteCollectionComponentProps): React.JSX.Element;
|
|
10
|
+
export default ColorPaletteCollectionComponent;
|