@mwater/visualization 5.3.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ColorComponent.d.ts +1 -1
- package/lib/ColorComponent.js +2 -2
- package/lib/CustomColorsContext.d.ts +1 -1
- package/lib/DateRangeComponent.js +10 -10
- package/lib/LocaleContextInjector.js +2 -2
- package/lib/MWaterAddRelatedFormComponent.js +8 -8
- package/lib/MWaterAddRelatedIndicatorComponent.d.ts +0 -1
- package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
- package/lib/MWaterAssetSystemsListComponent.d.ts +3 -3
- package/lib/MWaterAssetSystemsListComponent.js +4 -3
- package/lib/MWaterCompleteTableSelectComponent.d.ts +33 -34
- package/lib/MWaterCompleteTableSelectComponent.js +39 -38
- package/lib/MWaterCustomTablesetListComponent.d.ts +3 -3
- package/lib/MWaterCustomTablesetListComponent.js +5 -4
- package/lib/MWaterGlobalFiltersComponent.js +4 -4
- package/lib/MWaterLoaderComponent.d.ts +5 -5
- package/lib/MWaterLoaderComponent.js +1 -1
- package/lib/MWaterMetricsTableListComponent.d.ts +3 -3
- package/lib/MWaterMetricsTableListComponent.js +4 -3
- package/lib/MWaterResponsesFilterComponent.js +4 -4
- package/lib/MWaterTableSelectComponent.d.ts +1 -1
- package/lib/MWaterTableSelectComponent.js +5 -5
- package/lib/PopoverComponent.d.ts +4 -4
- package/lib/UIComponents.d.ts +5 -2
- package/lib/axes/AxisBuilder.js +42 -43
- package/lib/axes/AxisColorEditorComponent.d.ts +4 -4
- package/lib/axes/AxisColorEditorComponent.js +25 -60
- package/lib/axes/AxisComponent.d.ts +2 -3
- package/lib/axes/AxisComponent.js +20 -20
- package/lib/axes/BinsComponent.js +6 -6
- package/lib/axes/CategoryMapComponent.d.ts +2 -1
- package/lib/axes/CategoryMapComponent.js +7 -5
- package/lib/axes/ColorPaletteCollectionComponent.js +9 -9
- package/lib/axes/RangesComponent.js +12 -12
- package/lib/compressJson.js +1 -1
- package/lib/dashboards/DashboardComponent.d.ts +2 -0
- package/lib/dashboards/DashboardComponent.js +15 -8
- package/lib/dashboards/DashboardUtils.js +2 -3
- package/lib/dashboards/DashboardViewComponent.js +4 -4
- package/lib/dashboards/FontStyleEditor.js +8 -8
- package/lib/dashboards/LayoutOptionsComponent.js +102 -75
- package/lib/dashboards/SettingsModalComponent.d.ts +3 -4
- package/lib/dashboards/SettingsModalComponent.js +54 -40
- package/lib/dashboards/WidgetComponent.d.ts +0 -1
- package/lib/dashboards/WidgetComponent.js +1 -2
- package/lib/dashboards/layoutOptions.js +11 -7
- package/lib/datagrids/DatagridComponent.d.ts +1 -8
- package/lib/datagrids/DatagridComponent.js +14 -13
- package/lib/datagrids/DatagridDesignerComponent.js +18 -18
- package/lib/datagrids/DatagridQueryBuilder.d.ts +4 -4
- package/lib/datagrids/DatagridUtils.js +2 -2
- package/lib/datagrids/DatagridViewComponent.js +4 -4
- package/lib/datagrids/ExprCellComponent.js +1 -1
- package/lib/datagrids/FindReplaceModalComponent.js +17 -17
- package/lib/datagrids/OrderBysDesignerComponent.js +2 -2
- package/lib/languages.js +2 -2
- package/lib/layouts/DecoratedBlockComponent.js +2 -2
- package/lib/layouts/blocks/BlocksDisplayComponent.js +13 -13
- package/lib/layouts/blocks/BlocksLayoutManager.d.ts +2 -1
- package/lib/layouts/blocks/ClipboardPaletteItemComponent.js +3 -3
- package/lib/layouts/blocks/HorizontalBlockComponent.js +3 -3
- package/lib/layouts/blocks/blockUtils.js +4 -5
- package/lib/mWaterLoader.js +1 -1
- package/lib/maps/AddLayerComponent.js +13 -13
- package/lib/maps/AdminScopeAndDetailLevelComponent.js +5 -5
- package/lib/maps/BaseLayerDesignerComponent.js +2 -2
- package/lib/maps/BufferLayer.js +7 -7
- package/lib/maps/BufferLayerDesignerComponent.js +8 -8
- package/lib/maps/ChoroplethLayer.js +6 -6
- package/lib/maps/ChoroplethLayerDesigner.js +16 -16
- package/lib/maps/ClusterLayer.js +3 -3
- package/lib/maps/ClusterLayerDesignerComponent.js +5 -5
- package/lib/maps/DetailLevelSelectComponent.d.ts +11 -1
- package/lib/maps/DetailLevelSelectComponent.js +3 -3
- package/lib/maps/DirectMapDataSource.js +1 -2
- package/lib/maps/EditHoverOver.js +7 -5
- package/lib/maps/EditPopupComponent.js +2 -2
- package/lib/maps/GridLayer.js +5 -5
- package/lib/maps/GridLayerDesigner.js +15 -15
- package/lib/maps/LayerSwitcherComponent.js +1 -2
- package/lib/maps/LeafletMapComponent.d.ts +1 -1
- package/lib/maps/LeafletMapComponent.js +1 -1
- package/lib/maps/LegendComponent.js +1 -1
- package/lib/maps/MWaterServerLayer.d.ts +0 -1
- package/lib/maps/MWaterServerLayer.js +1 -1
- package/lib/maps/MapComponent.js +8 -8
- package/lib/maps/MapControlComponent.js +1 -1
- package/lib/maps/MapDesignerComponent.js +16 -16
- package/lib/maps/MapFiltersDesignerComponent.js +2 -2
- package/lib/maps/MapLayerViewDesignerComponent.js +8 -8
- package/lib/maps/MapUtils.js +6 -7
- package/lib/maps/MapViewComponent.js +1 -2
- package/lib/maps/MarkerSymbolSelectComponent.js +3 -3
- package/lib/maps/MarkersLayer.js +6 -7
- package/lib/maps/MarkersLayerDesignerComponent.js +22 -22
- package/lib/maps/PopupFilterJoinsEditComponent.js +4 -4
- package/lib/maps/PopupFilterJoinsUtils.js +2 -3
- package/lib/maps/RasterMapViewComponent.d.ts +3 -3
- package/lib/maps/RasterMapViewComponent.js +4 -4
- package/lib/maps/RegionSelectComponent.d.ts +1 -3
- package/lib/maps/RegionSelectComponent.js +1 -2
- package/lib/maps/ScopeAndDetailLevelComponent.js +3 -3
- package/lib/maps/TileUrlLayer.d.ts +1 -1
- package/lib/maps/TileUrlLayer.js +3 -3
- package/lib/maps/VectorMapViewComponent.js +6 -7
- package/lib/maps/ZoomLevelsComponent.js +5 -5
- package/lib/maps/mapSymbols.d.ts +1 -1
- package/lib/maps/mapSymbols.js +51 -50
- package/lib/maps/mapboxUtils.js +2 -3
- package/lib/maps/maps.d.ts +0 -1
- package/lib/maps/vectorMaps.js +14 -15
- package/lib/memoizedDebounce.js +1 -2
- package/lib/quickfilter/DateExprComponent.d.ts +4 -0
- package/lib/quickfilter/DateExprComponent.js +17 -16
- package/lib/quickfilter/IdArrayQuickfilterComponent.js +1 -1
- package/lib/quickfilter/QuickfilterUtils.js +1 -2
- package/lib/quickfilter/QuickfiltersComponent.d.ts +23 -2
- package/lib/quickfilter/QuickfiltersComponent.js +2 -2
- package/lib/quickfilter/QuickfiltersDesignComponent.js +8 -8
- package/lib/quickfilter/TextLiteralComponent.d.ts +35 -2
- package/lib/quickfilter/TextLiteralComponent.js +6 -6
- package/lib/richtext/DropdownPaletteItem.js +1 -1
- package/lib/richtext/ExprItemsHtmlConverter.js +8 -10
- package/lib/richtext/FontColorPaletteItem.js +7 -7
- package/lib/richtext/ItemsHtmlConverter.js +0 -1
- package/lib/richtext/RichTextComponent.d.ts +1 -0
- package/lib/richtext/RichTextComponent.js +33 -29
- package/lib/valueFormatter.js +18 -19
- package/lib/wellknown.js +2 -3
- package/lib/widgets/IFrameWidgetComponent.d.ts +9 -1
- package/lib/widgets/IFrameWidgetComponent.js +3 -3
- package/lib/widgets/ImageUploaderComponent.js +5 -5
- package/lib/widgets/ImageWidget.js +2 -2
- package/lib/widgets/ImageWidgetComponent.d.ts +9 -1
- package/lib/widgets/ImageWidgetComponent.js +20 -20
- package/lib/widgets/ImagelistCarouselComponent.js +1 -1
- package/lib/widgets/MapWidget.js +2 -2
- package/lib/widgets/MarkdownWidget.d.ts +1 -1
- package/lib/widgets/MarkdownWidget.js +1 -1
- package/lib/widgets/TOCWidget.js +11 -12
- package/lib/widgets/WidgetScopesViewComponent.js +1 -1
- package/lib/widgets/charts/Chart.js +1 -1
- package/lib/widgets/charts/ChartViewComponent.js +9 -9
- package/lib/widgets/charts/ChartWidgetComponent.js +4 -4
- package/lib/widgets/charts/calendar/CalendarChart.js +4 -4
- package/lib/widgets/charts/calendar/CalendarChartDesignerComponent.js +7 -7
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +3 -3
- package/lib/widgets/charts/imagemosaic/ImageMosaicChart.d.ts +18 -5
- package/lib/widgets/charts/imagemosaic/ImageMosaicChart.js +3 -4
- package/lib/widgets/charts/imagemosaic/ImageMosaicChartDesignerComponent.js +5 -5
- package/lib/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.d.ts +5 -19
- package/lib/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.js +66 -70
- package/lib/widgets/charts/imagemosaic/ImagePopupComponent.js +1 -1
- package/lib/widgets/charts/layered/LayeredChart.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChart.js +9 -9
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +8 -8
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +15 -15
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +33 -33
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +16 -16
- package/lib/widgets/charts/layered/LayeredChartUtils.js +1 -2
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +4 -4
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +18 -17
- package/lib/widgets/charts/pivot/PivotChart.d.ts +1 -1
- package/lib/widgets/charts/pivot/PivotChart.js +12 -4
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +5 -5
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +10 -10
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +5 -5
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +1 -1
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +5 -6
- package/lib/widgets/charts/pivot/PivotChartUtils.js +11 -12
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +9 -9
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +30 -30
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +28 -26
- package/lib/widgets/charts/table/OrderingsComponent.js +2 -2
- package/lib/widgets/charts/table/TableChart.js +3 -3
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +17 -17
- package/lib/widgets/charts/table/TableChartViewComponent.js +3 -3
- package/lib/widgets/text/ExprInsertModalComponent.d.ts +2 -3
- package/lib/widgets/text/ExprInsertModalComponent.js +2 -14
- package/lib/widgets/text/ExprItemEditorComponent.js +4 -4
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +2 -3
- package/lib/widgets/text/ExprUpdateModalComponent.js +3 -15
- package/lib/widgets/text/TextComponent.js +3 -3
- package/lib/widgets/text/TextWidget.d.ts +1 -1
- package/lib/widgets/text/TextWidgetComponent.js +11 -11
- package/lib/widgets/text/TextWidgetDesign.d.ts +2 -1
- package/lib/widgets/text/TextWidgetDesign.js +1 -2
- package/package.json +3 -3
- package/src/ColorComponent.tsx +2 -2
- package/src/DateRangeComponent.ts +10 -10
- package/src/LocaleContextInjector.tsx +1 -1
- package/src/MWaterAddRelatedFormComponent.ts +7 -7
- package/src/MWaterAddRelatedIndicatorComponent.ts +5 -5
- package/src/MWaterAssetSystemsListComponent.tsx +3 -3
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -35
- package/src/MWaterCustomTablesetListComponent.tsx +4 -4
- package/src/MWaterGlobalFiltersComponent.ts +4 -4
- package/src/MWaterLoaderComponent.ts +1 -1
- package/src/MWaterMetricsTableListComponent.tsx +3 -3
- package/src/MWaterResponsesFilterComponent.ts +6 -6
- package/src/MWaterTableSelectComponent.tsx +6 -7
- package/src/axes/AxisBuilder.ts +42 -44
- package/src/axes/AxisColorEditorComponent.tsx +178 -0
- package/src/axes/AxisComponent.ts +20 -20
- package/src/axes/BinsComponent.tsx +6 -6
- package/src/axes/CategoryMapComponent.ts +10 -10
- package/src/axes/ColorPaletteCollectionComponent.tsx +3 -3
- package/src/axes/RangesComponent.ts +14 -14
- package/src/dashboards/DashboardComponent.tsx +21 -9
- package/src/dashboards/DashboardViewComponent.tsx +3 -3
- package/src/dashboards/FontStyleEditor.tsx +8 -8
- package/src/dashboards/LayoutOptionsComponent.tsx +74 -74
- package/src/dashboards/SettingsModalComponent.tsx +134 -107
- package/src/dashboards/layoutOptions.tsx +5 -1
- package/src/datagrids/DatagridComponent.ts +65 -62
- package/src/datagrids/DatagridDesignerComponent.tsx +17 -17
- package/src/datagrids/DatagridUtils.ts +2 -2
- package/src/datagrids/DatagridViewComponent.ts +3 -3
- package/src/datagrids/ExprCellComponent.ts +1 -1
- package/src/datagrids/FindReplaceModalComponent.ts +13 -13
- package/src/datagrids/OrderBysDesignerComponent.tsx +2 -2
- package/src/globals.d.ts +7 -1
- package/src/languages.ts +2 -2
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +13 -13
- package/src/layouts/blocks/BlocksLayoutManager.ts +3 -2
- package/src/layouts/blocks/ClipboardPaletteItemComponent.ts +3 -3
- package/src/maps/AddLayerComponent.ts +13 -13
- package/src/maps/AdminScopeAndDetailLevelComponent.ts +5 -5
- package/src/maps/BaseLayerDesignerComponent.ts +8 -8
- package/src/maps/BufferLayer.ts +5 -5
- package/src/maps/BufferLayerDesignerComponent.ts +8 -8
- package/src/maps/ChoroplethLayer.ts +3 -3
- package/src/maps/ChoroplethLayerDesigner.tsx +16 -16
- package/src/maps/ClusterLayer.ts +3 -3
- package/src/maps/ClusterLayerDesignerComponent.ts +5 -5
- package/src/maps/DetailLevelSelectComponent.ts +3 -3
- package/src/maps/EditHoverOver.tsx +5 -5
- package/src/maps/EditPopupComponent.ts +2 -2
- package/src/maps/GridLayer.ts +5 -5
- package/src/maps/GridLayerDesigner.tsx +15 -16
- package/src/maps/MWaterServerLayer.ts +1 -1
- package/src/maps/MapComponent.ts +6 -6
- package/src/maps/MapControlComponent.ts +1 -1
- package/src/maps/MapDesignerComponent.tsx +20 -20
- package/src/maps/MapFiltersDesignerComponent.tsx +3 -3
- package/src/maps/MapLayerViewDesignerComponent.ts +9 -9
- package/src/maps/MarkerSymbolSelectComponent.ts +4 -5
- package/src/maps/MarkersLayerDesignerComponent.ts +22 -22
- package/src/maps/PopupFilterJoinsEditComponent.ts +4 -4
- package/src/maps/RasterMapViewComponent.ts +2 -2
- package/src/maps/RegionSelectComponent.ts +1 -2
- package/src/maps/ScopeAndDetailLevelComponent.ts +3 -3
- package/src/maps/TileUrlLayer.tsx +3 -3
- package/src/maps/VectorMapViewComponent.tsx +5 -5
- package/src/maps/ZoomLevelsComponent.ts +6 -6
- package/src/maps/mapSymbols.ts +49 -49
- package/src/maps/vectorMaps.tsx +2 -2
- package/src/quickfilter/DateExprComponent.ts +19 -18
- package/src/quickfilter/IdArrayQuickfilterComponent.ts +1 -1
- package/src/quickfilter/QuickfiltersComponent.ts +1 -1
- package/src/quickfilter/QuickfiltersDesignComponent.tsx +9 -9
- package/src/quickfilter/TextLiteralComponent.ts +4 -4
- package/src/richtext/DropdownPaletteItem.tsx +1 -1
- package/src/richtext/ExprItemsHtmlConverter.ts +8 -10
- package/src/richtext/ItemsHtmlConverter.ts +0 -1
- package/src/richtext/RichTextComponent.tsx +31 -31
- package/src/valueFormatter.ts +14 -14
- package/src/widgets/IFrameWidgetComponent.ts +3 -3
- package/src/widgets/ImageUploaderComponent.tsx +5 -5
- package/src/widgets/ImageWidget.ts +2 -2
- package/src/widgets/ImageWidgetComponent.ts +26 -26
- package/src/widgets/ImagelistCarouselComponent.ts +2 -2
- package/src/widgets/MapWidget.ts +1 -1
- package/src/widgets/MarkdownWidget.ts +1 -1
- package/src/widgets/TOCWidget.ts +13 -14
- package/src/widgets/WidgetScopesViewComponent.ts +1 -1
- package/src/widgets/charts/Chart.ts +1 -1
- package/src/widgets/charts/ChartViewComponent.ts +4 -4
- package/src/widgets/charts/ChartWidgetComponent.tsx +3 -3
- package/src/widgets/charts/calendar/CalendarChart.ts +4 -4
- package/src/widgets/charts/calendar/CalendarChartDesignerComponent.ts +7 -7
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +2 -2
- package/src/widgets/charts/imagemosaic/ImageMosaicChart.ts +25 -8
- package/src/widgets/charts/imagemosaic/ImageMosaicChartDesignerComponent.ts +5 -5
- package/src/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.tsx +128 -0
- package/src/widgets/charts/layered/LayeredChart.ts +9 -9
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +45 -45
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +39 -39
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +18 -19
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +1 -1
- package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +22 -23
- package/src/widgets/charts/pivot/PivotChart.ts +15 -5
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +12 -12
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +5 -5
- package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +7 -8
- package/src/widgets/charts/pivot/PivotChartViewComponent.tsx +6 -6
- package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +30 -30
- package/src/widgets/charts/table/OrderingsComponent.tsx +2 -2
- package/src/widgets/charts/table/TableChart.ts +3 -3
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +16 -16
- package/src/widgets/charts/table/TableChartViewComponent.ts +2 -2
- package/src/widgets/text/{ExprInsertModalComponent.ts → ExprInsertModalComponent.tsx} +18 -20
- package/src/widgets/text/ExprItemEditorComponent.tsx +4 -4
- package/src/widgets/text/{ExprUpdateModalComponent.ts → ExprUpdateModalComponent.tsx} +18 -20
- package/src/widgets/text/TextComponent.tsx +2 -2
- package/src/widgets/text/TextWidgetComponent.tsx +10 -10
- package/src/widgets/text/TextWidgetDesign.ts +3 -1
- package/src/axes/AxisColorEditorComponent.ts +0 -210
- package/src/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.ts +0 -117
package/lib/valueFormatter.js
CHANGED
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.canFormatType = canFormatType;
|
|
7
|
+
exports.getFormatOptions = getFormatOptions;
|
|
8
|
+
exports.getDefaultFormat = getDefaultFormat;
|
|
9
|
+
exports.formatValue = formatValue;
|
|
7
10
|
const d3_format_1 = require("d3-format");
|
|
8
11
|
const utm_1 = require("utm");
|
|
9
12
|
const dayjs_1 = __importDefault(require("./dayjs"));
|
|
@@ -12,26 +15,25 @@ const wellknown_1 = require("./wellknown");
|
|
|
12
15
|
function canFormatType(type) {
|
|
13
16
|
return type == "number" || type == "geometry" || type === "date" || type === "datetime";
|
|
14
17
|
}
|
|
15
|
-
exports.canFormatType = canFormatType;
|
|
16
18
|
/** Get available options for formatting a type. Null if not available */
|
|
17
19
|
function getFormatOptions(type) {
|
|
18
20
|
if (type == "number") {
|
|
19
21
|
return [
|
|
20
|
-
{ value: "", label:
|
|
21
|
-
{ value: ",", label:
|
|
22
|
-
{ value: ",.0f", label:
|
|
23
|
-
{ value: ",.2f", label:
|
|
24
|
-
{ value: "$,.2f", label:
|
|
25
|
-
{ value: "$,.0f", label:
|
|
26
|
-
{ value: ".0%", label:
|
|
27
|
-
{ value: ".2%", label:
|
|
22
|
+
{ value: "", label: T `Plain: 1234.567` },
|
|
23
|
+
{ value: ",", label: T `Normal: 1,234.567` },
|
|
24
|
+
{ value: ",.0f", label: T `Rounded: 1,234` },
|
|
25
|
+
{ value: ",.2f", label: T `Two decimals: 1,234.56` },
|
|
26
|
+
{ value: "$,.2f", label: T `Currency: $1,234.56` },
|
|
27
|
+
{ value: "$,.0f", label: T `Currency rounded: $1,234` },
|
|
28
|
+
{ value: ".0%", label: T `Percent rounded: 12%` },
|
|
29
|
+
{ value: ".2%", label: T `Percent decimal: 12.34%` }
|
|
28
30
|
];
|
|
29
31
|
}
|
|
30
32
|
if (type == "geometry") {
|
|
31
33
|
return [
|
|
32
|
-
{ value: "lat, lng", label:
|
|
33
|
-
{ value: "UTM", label:
|
|
34
|
-
{ value: "WKT", label:
|
|
34
|
+
{ value: "lat, lng", label: T `Latitude, Longitude` },
|
|
35
|
+
{ value: "UTM", label: T `UTM` },
|
|
36
|
+
{ value: "WKT", label: T `Well-Known Text` }
|
|
35
37
|
];
|
|
36
38
|
}
|
|
37
39
|
if (type == "date") {
|
|
@@ -71,7 +73,6 @@ function getFormatOptions(type) {
|
|
|
71
73
|
}
|
|
72
74
|
return null;
|
|
73
75
|
}
|
|
74
|
-
exports.getFormatOptions = getFormatOptions;
|
|
75
76
|
/** Get default format */
|
|
76
77
|
function getDefaultFormat(type) {
|
|
77
78
|
if (type == "number") {
|
|
@@ -86,9 +87,8 @@ function getDefaultFormat(type) {
|
|
|
86
87
|
if (type == "datetime") {
|
|
87
88
|
return "lll";
|
|
88
89
|
}
|
|
89
|
-
throw new Error(
|
|
90
|
+
throw new Error(T `Not supported`);
|
|
90
91
|
}
|
|
91
|
-
exports.getDefaultFormat = getDefaultFormat;
|
|
92
92
|
/** Format a value of a specified type as a string. For historical reasons,
|
|
93
93
|
* LayeredCharts multiply by 100 before adding the % sign. Set legacyPercentFormat to true to replicate
|
|
94
94
|
*/
|
|
@@ -118,10 +118,10 @@ function formatValue(type, value, format, locale, legacyPercentFormat) {
|
|
|
118
118
|
const latitude = value.coordinates[1];
|
|
119
119
|
const longitude = value.coordinates[0];
|
|
120
120
|
if (latitude > 84 || latitude < -80) {
|
|
121
|
-
return
|
|
121
|
+
return T `latitude out of range`;
|
|
122
122
|
}
|
|
123
123
|
if (longitude > 180 || longitude < -180) {
|
|
124
|
-
return
|
|
124
|
+
return T `longitude out of range`;
|
|
125
125
|
}
|
|
126
126
|
const { easting, northing, zoneNum, zoneLetter } = (0, utm_1.fromLatLon)(latitude, longitude);
|
|
127
127
|
return `${zoneNum}${zoneLetter} ${easting.toFixed(0)} ${northing.toFixed(0)}`;
|
|
@@ -146,4 +146,3 @@ function formatValue(type, value, format, locale, legacyPercentFormat) {
|
|
|
146
146
|
return value + "";
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
exports.formatValue = formatValue;
|
package/lib/wellknown.js
CHANGED
|
@@ -19,7 +19,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
19
19
|
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.
|
|
22
|
+
exports.parse = parse;
|
|
23
|
+
exports.stringify = stringify;
|
|
23
24
|
const numberRegexp = /[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/;
|
|
24
25
|
// Matches sequences like '100 100' or '100 100 100'.
|
|
25
26
|
const tuples = new RegExp('^' + numberRegexp.source + '(\\s' + numberRegexp.source + '){1,}');
|
|
@@ -245,7 +246,6 @@ function parse(input) {
|
|
|
245
246
|
}
|
|
246
247
|
return crs(root());
|
|
247
248
|
}
|
|
248
|
-
exports.parse = parse;
|
|
249
249
|
/**
|
|
250
250
|
* Stringifies a GeoJSON object into WKT
|
|
251
251
|
*/
|
|
@@ -285,4 +285,3 @@ function stringify(gj) {
|
|
|
285
285
|
throw new Error('stringify requires a valid GeoJSON Feature or geometry object as input');
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
exports.stringify = stringify;
|
|
@@ -20,6 +20,14 @@ export default class IFrameWidgetComponent extends React.Component<IFrameWidgetC
|
|
|
20
20
|
className: string;
|
|
21
21
|
onClick: () => void;
|
|
22
22
|
}, HTMLElement>;
|
|
23
|
-
render(): React.FunctionComponentElement<
|
|
23
|
+
render(): React.FunctionComponentElement<{
|
|
24
|
+
width: number | undefined;
|
|
25
|
+
height: number | undefined;
|
|
26
|
+
dropdownItems: {
|
|
27
|
+
label: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
onClick: () => void;
|
|
30
|
+
}[];
|
|
31
|
+
}>;
|
|
24
32
|
}
|
|
25
33
|
export {};
|
|
@@ -52,14 +52,14 @@ class IFrameWidgetComponent extends react_1.default.Component {
|
|
|
52
52
|
if (!this.state.editing) {
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
|
-
const content = R("div", { className: "mb-3" }, R("label", null,
|
|
55
|
+
const content = R("div", { className: "mb-3" }, R("label", null, T `URL to embed`), R("input", {
|
|
56
56
|
type: "text",
|
|
57
57
|
className: "form-control",
|
|
58
58
|
value: this.state.editUrl || "",
|
|
59
59
|
onChange: (ev) => this.setState({ editUrl: ev.target.value })
|
|
60
60
|
}), R("div", { className: "form-text text-muted" }, "e.g. https://www.youtube.com/embed/dQw4w9WgXcQ"));
|
|
61
61
|
return R(ModalPopupComponent_1.default, {
|
|
62
|
-
header:
|
|
62
|
+
header: T `Configure`,
|
|
63
63
|
showCloseX: true,
|
|
64
64
|
onClose: this.handleEndEditing
|
|
65
65
|
}, content);
|
|
@@ -73,7 +73,7 @@ class IFrameWidgetComponent extends react_1.default.Component {
|
|
|
73
73
|
render() {
|
|
74
74
|
const dropdownItems = [];
|
|
75
75
|
if (this.props.onDesignChange != null) {
|
|
76
|
-
dropdownItems.push({ label:
|
|
76
|
+
dropdownItems.push({ label: T `Edit`, icon: "pencil", onClick: this.handleStartEditing });
|
|
77
77
|
}
|
|
78
78
|
return R(DropdownWidgetComponent_1.default, {
|
|
79
79
|
width: this.props.width,
|
|
@@ -50,7 +50,7 @@ class ImageUploaderComponent extends react_1.default.Component {
|
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
this.setState({ uploading: false, files: null, editing: false });
|
|
53
|
-
alert(`Upload failed: ${e.target.responseText}`);
|
|
53
|
+
alert(T `Upload failed: ${e.target.responseText}`);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
createId() {
|
|
@@ -66,9 +66,9 @@ class ImageUploaderComponent extends react_1.default.Component {
|
|
|
66
66
|
this.progressBar = c;
|
|
67
67
|
} }))
|
|
68
68
|
: react_1.default.createElement("div", null, isDragActive ?
|
|
69
|
-
|
|
70
|
-
:
|
|
71
|
-
this.state.uid && react_1.default.createElement("a", { className: "link-plain", onClick: () => this.setState({ editing: false }) },
|
|
69
|
+
T `Drop the files here`
|
|
70
|
+
: T `Drop file here or click to select file`)))),
|
|
71
|
+
this.state.uid && react_1.default.createElement("a", { className: "link-plain", onClick: () => this.setState({ editing: false }) }, T `Cancel`));
|
|
72
72
|
}
|
|
73
73
|
renderPreview() {
|
|
74
74
|
const thumbnailStyle = {
|
|
@@ -79,7 +79,7 @@ class ImageUploaderComponent extends react_1.default.Component {
|
|
|
79
79
|
border: "1px solid #aeaeae",
|
|
80
80
|
marginRight: 20
|
|
81
81
|
};
|
|
82
|
-
return R("div", null, R("img", { style: thumbnailStyle, src: this.props.dataSource.getImageUrl(this.state.uid) }), R("a", { className: "btn btn-secondary", onClick: this.handleChangeImage },
|
|
82
|
+
return R("div", null, R("img", { style: thumbnailStyle, src: this.props.dataSource.getImageUrl(this.state.uid) }), R("a", { className: "btn btn-secondary", onClick: this.handleChangeImage }, T `Change`));
|
|
83
83
|
}
|
|
84
84
|
handleChangeImage = () => {
|
|
85
85
|
return this.setState({ editing: true });
|
|
@@ -46,12 +46,12 @@ class ImageWidget extends Widget_1.default {
|
|
|
46
46
|
// callback: (error, data)
|
|
47
47
|
getData(design, schema, dataSource, filters, callback) {
|
|
48
48
|
if (!design.expr) {
|
|
49
|
-
return callback(null);
|
|
49
|
+
return callback(null, null);
|
|
50
50
|
}
|
|
51
51
|
const exprCleaner = new expressions_1.ExprCleaner(schema);
|
|
52
52
|
const expr = exprCleaner.cleanExpr(design.expr);
|
|
53
53
|
if (!expr) {
|
|
54
|
-
return callback(null);
|
|
54
|
+
return callback(null, null);
|
|
55
55
|
}
|
|
56
56
|
const { table } = design.expr;
|
|
57
57
|
const exprCompiler = new expressions_1.ExprCompiler(schema);
|
|
@@ -33,7 +33,15 @@ export default class ImageWidgetComponent extends AsyncLoadComponent<ImageWidget
|
|
|
33
33
|
renderEditor(): React.CElement<any, ImageWidgetDesignComponent>;
|
|
34
34
|
renderExpression(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | React.CElement<import("@mwater/react-library/lib/AutoSizeComponent").AutoSizeComponentProps, AutoSizeComponent> | null;
|
|
35
35
|
renderContent(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | React.CElement<import("@mwater/react-library/lib/AutoSizeComponent").AutoSizeComponentProps, AutoSizeComponent> | React.CElement<RotatedImageComponentProps, RotatedImageComponent> | null;
|
|
36
|
-
render(): React.FunctionComponentElement<
|
|
36
|
+
render(): React.FunctionComponentElement<{
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
dropdownItems: {
|
|
40
|
+
label: string;
|
|
41
|
+
icon: string;
|
|
42
|
+
onClick: () => void;
|
|
43
|
+
}[];
|
|
44
|
+
}>;
|
|
37
45
|
}
|
|
38
46
|
interface ImageWidgetDesignComponentProps {
|
|
39
47
|
design: any;
|
|
@@ -75,7 +75,7 @@ class ImageWidgetComponent extends AsyncLoadComponent_1.default {
|
|
|
75
75
|
}
|
|
76
76
|
renderExpression() {
|
|
77
77
|
if (this.state.loading) {
|
|
78
|
-
return R("span", null,
|
|
78
|
+
return R("span", null, T `Loading`);
|
|
79
79
|
}
|
|
80
80
|
else if (this.state.data) {
|
|
81
81
|
// Make into array if not
|
|
@@ -131,7 +131,7 @@ class ImageWidgetComponent extends AsyncLoadComponent_1.default {
|
|
|
131
131
|
render() {
|
|
132
132
|
const dropdownItems = [];
|
|
133
133
|
if (this.props.onDesignChange != null) {
|
|
134
|
-
dropdownItems.push({ label:
|
|
134
|
+
dropdownItems.push({ label: T `Edit`, icon: "pencil", onClick: this.handleStartEditing });
|
|
135
135
|
}
|
|
136
136
|
const captionPosition = this.props.design.captionPosition || "bottom";
|
|
137
137
|
return R(DropdownWidgetComponent_1.default, {
|
|
@@ -257,8 +257,8 @@ class ImageWidgetDesignComponent extends react_1.default.Component {
|
|
|
257
257
|
});
|
|
258
258
|
};
|
|
259
259
|
renderExpressionEditor() {
|
|
260
|
-
return R("div", { className: "mb-3" }, R("label", { className: "text-muted" }, R("i", { className: "fa fa-database" }), " ",
|
|
261
|
-
? R("div", { className: "mb-3" }, R("label", { className: "text-muted" },
|
|
260
|
+
return R("div", { className: "mb-3" }, R("label", { className: "text-muted" }, R("i", { className: "fa fa-database" }), " ", T `Data Source`), ": ", R(expressions_ui_2.TableSelectComponent, { schema: this.props.schema, value: this.state.table, onChange: this.handleTableChange }), R("br"), this.state.table
|
|
261
|
+
? R("div", { className: "mb-3" }, R("label", { className: "text-muted" }, T `Field`), ": ", R(expressions_ui_1.ExprComponent, {
|
|
262
262
|
schema: this.props.schema,
|
|
263
263
|
dataSource: this.props.dataSource,
|
|
264
264
|
table: this.state.table,
|
|
@@ -270,59 +270,59 @@ class ImageWidgetDesignComponent extends react_1.default.Component {
|
|
|
270
270
|
: undefined);
|
|
271
271
|
}
|
|
272
272
|
renderRotation() {
|
|
273
|
-
return R("div", { style: { paddingTop: 10 } },
|
|
273
|
+
return R("div", { style: { paddingTop: 10 } }, T `Rotation: `, R(ui.Radio, { value: this.state.rotation || null, radioValue: null, onChange: this.handleRotationChange, inline: true }, T `0 degrees`), R(ui.Radio, { value: this.state.rotation || null, radioValue: 90, onChange: this.handleRotationChange, inline: true }, T `90 degrees`), R(ui.Radio, { value: this.state.rotation || null, radioValue: 180, onChange: this.handleRotationChange, inline: true }, T `180 degrees`), R(ui.Radio, { value: this.state.rotation || null, radioValue: 270, onChange: this.handleRotationChange, inline: true }, T `270 degrees`));
|
|
274
274
|
}
|
|
275
275
|
renderImageUrlEditor() {
|
|
276
|
-
return R("div", { className: "mb-3" }, R("label", null,
|
|
276
|
+
return R("div", { className: "mb-3" }, R("label", null, T `URL of image`), R("input", {
|
|
277
277
|
type: "text",
|
|
278
278
|
className: "form-control",
|
|
279
279
|
value: this.state.imageUrl || "",
|
|
280
280
|
onChange: this.handleImageUrlChange
|
|
281
|
-
}), R("div", { className: "form-text text-muted" },
|
|
281
|
+
}), R("div", { className: "form-text text-muted" }, T `e.g. http://somesite.com/image.jpg`), this.renderRotation());
|
|
282
282
|
}
|
|
283
283
|
renderUrlEditor() {
|
|
284
|
-
return R("div", { className: "mb-3" }, R("label", null,
|
|
284
|
+
return R("div", { className: "mb-3" }, R("label", null, T `URL to open`), R("input", {
|
|
285
285
|
type: "text",
|
|
286
286
|
className: "form-control",
|
|
287
287
|
value: this.state.url || "",
|
|
288
288
|
onChange: this.handleUrlChange
|
|
289
|
-
}), R("div", { className: "form-text text-muted" },
|
|
289
|
+
}), R("div", { className: "form-text text-muted" }, T `e.g. http://somesite.com/`), R("div", { className: "form-text text-muted" }, T `When clicked on image, this link will open`), R("div", null, R(ui.Checkbox, {
|
|
290
290
|
value: !this.state.openUrlInSameTab,
|
|
291
291
|
onChange: this.handleOpenUrlInSameTabChange
|
|
292
|
-
},
|
|
292
|
+
}, T `Open link in new tab`)));
|
|
293
293
|
}
|
|
294
294
|
render() {
|
|
295
295
|
if (!this.state.editing) {
|
|
296
296
|
return null;
|
|
297
297
|
}
|
|
298
|
-
const content = R("div", null, R("div", { className: "mb-3" }, R("label", null,
|
|
298
|
+
const content = R("div", null, R("div", { className: "mb-3" }, R("label", null, T `Caption`), R("input", {
|
|
299
299
|
type: "text",
|
|
300
300
|
className: "form-control",
|
|
301
301
|
value: this.state.caption || "",
|
|
302
302
|
onChange: this.handleCaptionChange,
|
|
303
|
-
placeholder:
|
|
303
|
+
placeholder: T `Optional caption to display below image`
|
|
304
304
|
})), this.state.caption
|
|
305
|
-
? R("div", { className: "mb-3" }, R("label", null,
|
|
305
|
+
? R("div", { className: "mb-3" }, R("label", null, T `Caption position`), R(ui.Select, {
|
|
306
306
|
options: [
|
|
307
|
-
{ value: "bottom", label:
|
|
308
|
-
{ value: "top", label:
|
|
307
|
+
{ value: "bottom", label: T `Bottom` },
|
|
308
|
+
{ value: "top", label: T `Top` }
|
|
309
309
|
],
|
|
310
310
|
value: this.state.captionPosition,
|
|
311
311
|
onChange: this.handleCaptionPositionChange
|
|
312
312
|
}))
|
|
313
313
|
: undefined, R(TabbedComponent_1.default, {
|
|
314
314
|
tabs: [
|
|
315
|
-
{ id: "upload", label:
|
|
316
|
-
{ id: "expression", label:
|
|
317
|
-
{ id: "url", label:
|
|
315
|
+
{ id: "upload", label: T `Upload`, elem: this.renderUploadEditor() },
|
|
316
|
+
{ id: "expression", label: T `From Data`, elem: this.renderExpressionEditor() },
|
|
317
|
+
{ id: "url", label: T `From URL`, elem: this.renderImageUrlEditor() }
|
|
318
318
|
],
|
|
319
319
|
initialTabId: this.state.currentTab
|
|
320
320
|
}),
|
|
321
321
|
// No target URL when using expressions
|
|
322
322
|
this.state.imageUrl || this.state.uid ? this.renderUrlEditor() : undefined);
|
|
323
|
-
const footer = R("div", null, R("button", { key: "save", type: "button", className: "btn btn-primary me-2", onClick: this.handleSave },
|
|
323
|
+
const footer = R("div", null, R("button", { key: "save", type: "button", className: "btn btn-primary me-2", onClick: this.handleSave }, T `Save`), R("button", { key: "cancel", type: "button", className: "btn btn-secondary", onClick: this.handleCancel }, T `Cancel`));
|
|
324
324
|
return R(ModalPopupComponent_1.default, {
|
|
325
|
-
header:
|
|
325
|
+
header: T `Image`,
|
|
326
326
|
footer
|
|
327
327
|
}, content);
|
|
328
328
|
}
|
|
@@ -58,7 +58,7 @@ class ImagelistCarouselComponent extends react_1.default.Component {
|
|
|
58
58
|
}))
|
|
59
59
|
: undefined,
|
|
60
60
|
// Wrapper for slides
|
|
61
|
-
R("div", { className: "carousel-inner" }, this.renderImages(imageManager)), R("button", { className: "carousel-control-prev", onClick: this.handleLeft }, R("span", { className: "carousel-control-prev-icon" })), R("button", { className: "carousel-control-next", onClick: this.handleRight }, R("span", { className: "carousel-control-next-icon" })));
|
|
61
|
+
R("div", { className: "carousel-inner" }, this.renderImages(imageManager)), R("button", { className: "carousel-control-prev", onClick: this.handleLeft }, R("span", { className: "carousel-control-prev-icon", "aria-label": T `Previous` })), R("button", { className: "carousel-control-next", onClick: this.handleRight }, R("span", { className: "carousel-control-next-icon", "aria-label": T `Next` })));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
exports.default = ImagelistCarouselComponent;
|
package/lib/widgets/MapWidget.js
CHANGED
|
@@ -146,14 +146,14 @@ class MapWidgetComponent extends react_1.default.Component {
|
|
|
146
146
|
extraFilters: this.props.filters,
|
|
147
147
|
width: width - 20,
|
|
148
148
|
height: height - 20,
|
|
149
|
-
scrollWheelZoom: false,
|
|
149
|
+
scrollWheelZoom: false, // Prevent accidental zooming
|
|
150
150
|
onRowClick: this.props.onRowClick
|
|
151
151
|
}));
|
|
152
152
|
}
|
|
153
153
|
render() {
|
|
154
154
|
const dropdownItems = [];
|
|
155
155
|
if (this.props.onDesignChange != null) {
|
|
156
|
-
dropdownItems.push({ label:
|
|
156
|
+
dropdownItems.push({ label: T `Edit`, icon: "pencil", onClick: this.handleStartEditing });
|
|
157
157
|
}
|
|
158
158
|
const handleDesignChange = (d) => this.setState({ transientDesign: d });
|
|
159
159
|
// Wrap in a simple widget
|
|
@@ -96,7 +96,7 @@ class MarkdownWidgetComponent extends react_1.default.Component {
|
|
|
96
96
|
render() {
|
|
97
97
|
const dropdownItems = [];
|
|
98
98
|
if (this.props.onDesignChange != null) {
|
|
99
|
-
dropdownItems.push({ label:
|
|
99
|
+
dropdownItems.push({ label: T `Edit`, icon: "pencil", onClick: this.handleStartEditing });
|
|
100
100
|
}
|
|
101
101
|
// Wrap in a simple widget
|
|
102
102
|
return R("div", { onDoubleClick: this.handleStartEditing }, this.props.onDesignChange != null ? this.renderEditor() : undefined, react_1.default.createElement(DropdownWidgetComponent_1.default, {
|
package/lib/widgets/TOCWidget.js
CHANGED
|
@@ -73,8 +73,8 @@ class TOCWidget extends Widget_1.default {
|
|
|
73
73
|
exports.default = TOCWidget;
|
|
74
74
|
class TOCWidgetComponent extends react_1.default.Component {
|
|
75
75
|
static propTypes = {
|
|
76
|
-
design: prop_types_1.default.object.isRequired,
|
|
77
|
-
onDesignChange: prop_types_1.default.func,
|
|
76
|
+
design: prop_types_1.default.object.isRequired, // See Map Design.md
|
|
77
|
+
onDesignChange: prop_types_1.default.func, // Called with new design. null/undefined for readonly
|
|
78
78
|
width: prop_types_1.default.number,
|
|
79
79
|
height: prop_types_1.default.number,
|
|
80
80
|
tocEntries: prop_types_1.default.arrayOf(prop_types_1.default.shape({
|
|
@@ -108,7 +108,7 @@ class TOCWidgetComponent extends react_1.default.Component {
|
|
|
108
108
|
});
|
|
109
109
|
return R(ModalPopupComponent_1.default, {
|
|
110
110
|
showCloseX: true,
|
|
111
|
-
header:
|
|
111
|
+
header: T `Table of Contents Options`,
|
|
112
112
|
onClose: this.handleEndEditing
|
|
113
113
|
}, editor);
|
|
114
114
|
}
|
|
@@ -125,7 +125,7 @@ class TOCWidgetComponent extends react_1.default.Component {
|
|
|
125
125
|
render() {
|
|
126
126
|
const dropdownItems = [];
|
|
127
127
|
if (this.props.onDesignChange != null) {
|
|
128
|
-
dropdownItems.push({ label:
|
|
128
|
+
dropdownItems.push({ label: T `Edit`, icon: "pencil", onClick: this.handleStartEditing });
|
|
129
129
|
}
|
|
130
130
|
// Wrap in a simple widget
|
|
131
131
|
return R("div", { onDoubleClick: this.handleStartEditing }, this.props.onDesignChange != null ? this.renderEditor() : undefined, R(DropdownWidgetComponent_1.default, {
|
|
@@ -138,8 +138,8 @@ class TOCWidgetComponent extends react_1.default.Component {
|
|
|
138
138
|
// Displays the contents of the widget
|
|
139
139
|
class TOCWidgetViewComponent extends react_1.default.Component {
|
|
140
140
|
static propTypes = {
|
|
141
|
-
design: prop_types_1.default.object.isRequired,
|
|
142
|
-
onDesignChange: prop_types_1.default.func,
|
|
141
|
+
design: prop_types_1.default.object.isRequired, // Design of chart
|
|
142
|
+
onDesignChange: prop_types_1.default.func, // Called with new design. null/undefined for readonly
|
|
143
143
|
width: prop_types_1.default.number,
|
|
144
144
|
height: prop_types_1.default.number,
|
|
145
145
|
tocEntries: prop_types_1.default.arrayOf(prop_types_1.default.shape({
|
|
@@ -151,7 +151,6 @@ class TOCWidgetViewComponent extends react_1.default.Component {
|
|
|
151
151
|
onScrollToTOCEntry: prop_types_1.default.func
|
|
152
152
|
};
|
|
153
153
|
handleEntryClick = (tocEntry) => {
|
|
154
|
-
debugger;
|
|
155
154
|
return this.props.onScrollToTOCEntry?.(tocEntry.widgetId, tocEntry.id);
|
|
156
155
|
};
|
|
157
156
|
renderTOCEntry(tocEntry, index) {
|
|
@@ -205,7 +204,7 @@ class TOCWidgetViewComponent extends react_1.default.Component {
|
|
|
205
204
|
}),
|
|
206
205
|
// Add placeholder if none and editable
|
|
207
206
|
this.props.onDesignChange && (this.props.tocEntries || []).length === 0
|
|
208
|
-
? R("div", { className: "text-muted" },
|
|
207
|
+
? R("div", { className: "text-muted" }, T `Table of Contents will appear here as text blocks with headings are added to the dashboard`)
|
|
209
208
|
: undefined);
|
|
210
209
|
}
|
|
211
210
|
}
|
|
@@ -228,17 +227,17 @@ class TOCWidgetDesignerComponent extends react_1.default.Component {
|
|
|
228
227
|
return this.props.onDesignChange(design);
|
|
229
228
|
};
|
|
230
229
|
render() {
|
|
231
|
-
return R("div", null, R(ui.FormGroup, { label:
|
|
230
|
+
return R("div", null, R(ui.FormGroup, { label: T `Header` }, R(ui.TextInput, { value: this.props.design.header || "", onChange: this.update("header"), placeholder: T `None` })), R(ui.FormGroup, { label: T `Border` }, R(BorderComponent, { value: this.props.design.borderWeight || 0, onChange: this.update("borderWeight") })), R(ui.FormGroup, { label: T `Numbering` }, R(ui.Radio, {
|
|
232
231
|
inline: true,
|
|
233
232
|
value: this.props.design.numbering || false,
|
|
234
233
|
radioValue: true,
|
|
235
234
|
onChange: this.update("numbering")
|
|
236
|
-
},
|
|
235
|
+
}, T `On`), R(ui.Radio, {
|
|
237
236
|
inline: true,
|
|
238
237
|
value: this.props.design.numbering || false,
|
|
239
238
|
radioValue: false,
|
|
240
239
|
onChange: this.update("numbering")
|
|
241
|
-
},
|
|
240
|
+
}, T `Off`)));
|
|
242
241
|
}
|
|
243
242
|
}
|
|
244
243
|
// Allows setting border heaviness
|
|
@@ -250,6 +249,6 @@ class BorderComponent extends react_1.default.Component {
|
|
|
250
249
|
};
|
|
251
250
|
render() {
|
|
252
251
|
const value = this.props.value != null ? this.props.value : this.props.defaultValue;
|
|
253
|
-
return R("div", null, R(ui.Radio, { inline: true, value, radioValue: 0, onChange: this.props.onChange },
|
|
252
|
+
return R("div", null, R(ui.Radio, { inline: true, value, radioValue: 0, onChange: this.props.onChange }, T `None`), R(ui.Radio, { inline: true, value, radioValue: 1, onChange: this.props.onChange }, T `Light`), R(ui.Radio, { inline: true, value, radioValue: 2, onChange: this.props.onChange }, T `Medium`), R(ui.Radio, { inline: true, value, radioValue: 3, onChange: this.props.onChange }, T `Heavy`));
|
|
254
253
|
}
|
|
255
254
|
}
|
|
@@ -30,7 +30,7 @@ class WidgetScopesViewComponent extends react_1.default.Component {
|
|
|
30
30
|
if (lodash_1.default.compact(lodash_1.default.values(scopes)).length === 0) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
|
-
return R("div", { className: "alert alert-info" }, R("span", { className: "fas fa-filter" }),
|
|
33
|
+
return R("div", { className: "alert alert-info" }, R("span", { className: "fas fa-filter" }), T ` Filters: `, lodash_1.default.map(lodash_1.default.keys(scopes), (id) => this.renderScope(id, scopes[id])));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
exports.default = WidgetScopesViewComponent;
|
|
@@ -19,11 +19,11 @@ class ChartViewComponent extends react_1.default.Component {
|
|
|
19
19
|
super(props);
|
|
20
20
|
this.updateSeq = 0;
|
|
21
21
|
this.state = {
|
|
22
|
-
validDesign: null,
|
|
23
|
-
data: null,
|
|
24
|
-
dataLoading: false,
|
|
25
|
-
dataError: null,
|
|
26
|
-
cacheExpiry: props.dataSource.getCacheExpiry(),
|
|
22
|
+
validDesign: null, // last valid design
|
|
23
|
+
data: null, // data for chart
|
|
24
|
+
dataLoading: false, // True when loading data
|
|
25
|
+
dataError: null, // Set when data loading returned error
|
|
26
|
+
cacheExpiry: props.dataSource.getCacheExpiry(), // Save cache expiry to see if changes
|
|
27
27
|
showErrorDetails: false
|
|
28
28
|
};
|
|
29
29
|
}
|
|
@@ -76,17 +76,17 @@ class ChartViewComponent extends react_1.default.Component {
|
|
|
76
76
|
const errorText = (this.state.dataError.message || this.state.dataError || "") + "";
|
|
77
77
|
const isTimeout = errorText.match(/timeout/) != null;
|
|
78
78
|
return R("div", { style: { marginTop: 20, textAlign: "center" } }, R("div", { className: "text-danger" }, isTimeout ?
|
|
79
|
-
|
|
80
|
-
:
|
|
79
|
+
T `This widget has timed out. Placing widgets across console tabs instead of having them all in one dashboard can improve performance.`
|
|
80
|
+
: T `There was an error loading data for this widget.`), R("div", { className: "mt-3" }, R("button", {
|
|
81
81
|
className: "btn btn-secondary btn-sm",
|
|
82
82
|
disabled: this.state.dataLoading,
|
|
83
83
|
onClick: () => {
|
|
84
84
|
this.updateData();
|
|
85
85
|
}
|
|
86
|
-
}, R("i", { className: "fas fa-redo" }),
|
|
86
|
+
}, R("i", { className: "fas fa-redo" }), T `Try again`)), R("button", {
|
|
87
87
|
className: "btn btn-link btn-sm mt-2",
|
|
88
88
|
onClick: () => this.setState({ showErrorDetails: !this.state.showErrorDetails })
|
|
89
|
-
}, this.state.showErrorDetails ?
|
|
89
|
+
}, this.state.showErrorDetails ? T `Hide details` : T `Show details`), this.state.showErrorDetails ?
|
|
90
90
|
R("div", { style: { marginTop: 10, fontSize: 10 } }, `Error: ${this.state.dataError.message || this.state.dataError}`) : null);
|
|
91
91
|
}
|
|
92
92
|
render() {
|
|
@@ -34,11 +34,11 @@ const ActionCancelModalComponent_1 = __importDefault(require("@mwater/react-libr
|
|
|
34
34
|
const ChartViewComponent_1 = __importDefault(require("./ChartViewComponent"));
|
|
35
35
|
const ModalWindowComponent_1 = __importDefault(require("@mwater/react-library/lib/ModalWindowComponent"));
|
|
36
36
|
const ui = __importStar(require("@mwater/react-library/lib/bootstrap"));
|
|
37
|
-
const
|
|
37
|
+
const expressions_ui_1 = require("@mwater/expressions-ui");
|
|
38
38
|
const layoutOptions_1 = require("../../dashboards/layoutOptions");
|
|
39
39
|
// Complete chart widget
|
|
40
40
|
class ChartWidgetComponent extends react_1.default.PureComponent {
|
|
41
|
-
static contextType =
|
|
41
|
+
static contextType = expressions_ui_1.LocaleContext;
|
|
42
42
|
constructor(props) {
|
|
43
43
|
super(props);
|
|
44
44
|
this.state = {
|
|
@@ -51,7 +51,7 @@ class ChartWidgetComponent extends react_1.default.PureComponent {
|
|
|
51
51
|
// Get the data
|
|
52
52
|
return this.props.widgetDataSource.getData(this.props.design, this.props.filters, (err, data) => {
|
|
53
53
|
if (err) {
|
|
54
|
-
return alert(
|
|
54
|
+
return alert(T `Failed to get data: ${err.message}`);
|
|
55
55
|
}
|
|
56
56
|
// Create data table
|
|
57
57
|
const table = this.props.chart.createDataTable(this.props.design, this.props.schema, this.props.dataSource, data, this.context);
|
|
@@ -149,7 +149,7 @@ class ChartWidgetComponent extends react_1.default.PureComponent {
|
|
|
149
149
|
// Create dropdown items
|
|
150
150
|
const dropdownItems = this.props.chart.createDropdownItems(design, this.props.schema, this.props.widgetDataSource, this.props.filters);
|
|
151
151
|
if (!designError) {
|
|
152
|
-
dropdownItems.push({ label:
|
|
152
|
+
dropdownItems.push({ label: T `Export Data`, icon: "save-file", onClick: this.handleSaveCsvFile });
|
|
153
153
|
}
|
|
154
154
|
if (this.props.onDesignChange != null) {
|
|
155
155
|
dropdownItems.unshift({
|
|
@@ -42,15 +42,15 @@ class CalendarChart extends Chart_1.default {
|
|
|
42
42
|
const axisBuilder = new AxisBuilder_1.default({ schema });
|
|
43
43
|
// Check that has table
|
|
44
44
|
if (!design.table) {
|
|
45
|
-
return
|
|
45
|
+
return T `Missing data source`;
|
|
46
46
|
}
|
|
47
47
|
// Check that has axes
|
|
48
48
|
let error = null;
|
|
49
49
|
if (!design.dateAxis) {
|
|
50
|
-
error = error ||
|
|
50
|
+
error = error || T `Missing date`;
|
|
51
51
|
}
|
|
52
52
|
if (!design.valueAxis) {
|
|
53
|
-
error = error ||
|
|
53
|
+
error = error || T `Missing value`;
|
|
54
54
|
}
|
|
55
55
|
error = error || axisBuilder.validateAxis({ axis: design.dateAxis });
|
|
56
56
|
error = error || axisBuilder.validateAxis({ axis: design.valueAxis });
|
|
@@ -159,7 +159,7 @@ class CalendarChart extends Chart_1.default {
|
|
|
159
159
|
return react_1.default.createElement(CalendarChartViewComponent, props);
|
|
160
160
|
}
|
|
161
161
|
createDataTable(design, schema, dataSource, data) {
|
|
162
|
-
const header = [
|
|
162
|
+
const header = [T `Date`, T `Value`];
|
|
163
163
|
const rows = lodash_1.default.map(data, (row) => [(0, moment_1.default)(row.date).format("YYYY-MM-DD"), row.value]);
|
|
164
164
|
return [header].concat(rows);
|
|
165
165
|
}
|