@mwater/visualization 5.3.2 → 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 +0 -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 +3 -3
- 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 +101 -74
- 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
|
@@ -50,7 +50,7 @@ const MWaterCustomTablesetListComponent = (props) => {
|
|
|
50
50
|
// Remove from extra tables
|
|
51
51
|
const match = props.extraTables.find((t) => (t || "").startsWith(`custom.${ts.code}.`));
|
|
52
52
|
if (match) {
|
|
53
|
-
if (confirm(
|
|
53
|
+
if (confirm(T `Remove this set of tables? Some widgets may not work correctly.`)) {
|
|
54
54
|
props.onChange(null);
|
|
55
55
|
props.onExtraTableRemove(match);
|
|
56
56
|
}
|
|
@@ -59,7 +59,8 @@ const MWaterCustomTablesetListComponent = (props) => {
|
|
|
59
59
|
if (!tablesets || extraTableNeeded) {
|
|
60
60
|
return (react_2.default.createElement("div", null,
|
|
61
61
|
react_2.default.createElement("i", { className: "fa fa-spin fa-spinner" }),
|
|
62
|
-
"
|
|
62
|
+
" ",
|
|
63
|
+
T `Loading...`));
|
|
63
64
|
}
|
|
64
65
|
const renderTableset = (ts) => {
|
|
65
66
|
const name = expressions_1.ExprUtils.localizeString(ts.design.name, props.locale) || "";
|
|
@@ -85,9 +86,9 @@ const MWaterCustomTablesetListComponent = (props) => {
|
|
|
85
86
|
};
|
|
86
87
|
const visibleTablesets = tablesets.filter((ts) => (showSystem || !ts.design.system) && !ts.design.deprecated);
|
|
87
88
|
return (react_2.default.createElement("div", null,
|
|
88
|
-
react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder:
|
|
89
|
+
react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder: T `Search...` }),
|
|
89
90
|
visibleTablesets.map((ts) => renderTableset(ts)),
|
|
90
91
|
react_2.default.createElement("div", null,
|
|
91
|
-
react_2.default.createElement("button", { className: "btn btn-link btn-sm", onClick: () => setShowSystem(!showSystem) }, showSystem ?
|
|
92
|
+
react_2.default.createElement("button", { className: "btn btn-link btn-sm", onClick: () => setShowSystem(!showSystem) }, showSystem ? T `Hide system tables` : T `Show system tables`))));
|
|
92
93
|
};
|
|
93
94
|
exports.MWaterCustomTablesetListComponent = MWaterCustomTablesetListComponent;
|
|
@@ -79,22 +79,22 @@ class MWaterGlobalFiltersComponent extends react_1.default.Component {
|
|
|
79
79
|
else {
|
|
80
80
|
adminRegions = null;
|
|
81
81
|
}
|
|
82
|
-
return R("div", null, R(ui.FormGroup, { label:
|
|
82
|
+
return R("div", null, R(ui.FormGroup, { label: T `Only sites managed by`, labelMuted: true }, R(expressions_ui_1.IdLiteralComponent, {
|
|
83
83
|
value: managedBy,
|
|
84
84
|
onChange: this.handleManagedByChange,
|
|
85
85
|
idTable: "groups",
|
|
86
86
|
schema: this.props.schema,
|
|
87
87
|
dataSource: this.props.dataSource,
|
|
88
|
-
placeholder:
|
|
88
|
+
placeholder: T `All Organizations`,
|
|
89
89
|
multi: false,
|
|
90
90
|
filter: { type: "field", tableAlias: "main", column: "canManageEntities" }
|
|
91
|
-
})), R(ui.FormGroup, { label:
|
|
91
|
+
})), R(ui.FormGroup, { label: T `Only sites located in`, labelMuted: true }, R(expressions_ui_1.IdLiteralComponent, {
|
|
92
92
|
value: adminRegions,
|
|
93
93
|
onChange: this.handleRegionsChange,
|
|
94
94
|
idTable: "admin_regions",
|
|
95
95
|
schema: this.props.schema,
|
|
96
96
|
dataSource: this.props.dataSource,
|
|
97
|
-
placeholder:
|
|
97
|
+
placeholder: T `All Regions`,
|
|
98
98
|
multi: true,
|
|
99
99
|
orderBy: [{ expr: { type: "field", tableAlias: "main", column: "level" }, direction: "asc" }]
|
|
100
100
|
})));
|
|
@@ -44,11 +44,11 @@ export default class MWaterLoaderComponent extends AsyncLoadComponent<{
|
|
|
44
44
|
load(props: any, prevProps: any, callback: any): void;
|
|
45
45
|
render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.CElement<import("@mwater/react-library/lib/LoadingComponent").LoadingComponentProps, LoadingComponent> | React.CElement<{
|
|
46
46
|
apiUrl: string;
|
|
47
|
-
client?: string
|
|
48
|
-
user?: string
|
|
47
|
+
client?: string;
|
|
48
|
+
user?: string;
|
|
49
49
|
schema: Schema;
|
|
50
|
-
extraTables?: string[]
|
|
51
|
-
onExtraTablesChange?: (
|
|
52
|
-
addLayerElementFactory?: AddLayerElementFactory
|
|
50
|
+
extraTables?: string[];
|
|
51
|
+
onExtraTablesChange?: (extraTables: string[]) => void;
|
|
52
|
+
addLayerElementFactory?: AddLayerElementFactory;
|
|
53
53
|
}, MWaterContextComponent>;
|
|
54
54
|
}
|
|
@@ -44,7 +44,7 @@ class MWaterLoaderComponent extends AsyncLoadComponent_1.default {
|
|
|
44
44
|
origin: props.origin
|
|
45
45
|
}, (error, config) => {
|
|
46
46
|
if (error) {
|
|
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}`;
|
|
47
|
+
const defaultError = T `Cannot load one of the forms that this depends on. Perhaps the administrator has not shared the form with you? Details: ${error.message}`;
|
|
48
48
|
if (this.props.errorFormatter) {
|
|
49
49
|
try {
|
|
50
50
|
const parsedError = JSON.parse(error.message);
|
|
@@ -4,14 +4,14 @@ import React from "react";
|
|
|
4
4
|
export declare const MWaterMetricsTableListComponent: (props: {
|
|
5
5
|
apiUrl: string;
|
|
6
6
|
schema: Schema;
|
|
7
|
-
client?: string
|
|
7
|
+
client?: string;
|
|
8
8
|
/** User id */
|
|
9
|
-
user?: string
|
|
9
|
+
user?: string;
|
|
10
10
|
/** Called with table selected */
|
|
11
11
|
onChange: (tableId: string | null) => void;
|
|
12
12
|
extraTables: string[];
|
|
13
13
|
onExtraTableAdd: (tableId: string) => void;
|
|
14
14
|
onExtraTableRemove: (tableId: string) => void;
|
|
15
15
|
/** e.g. "en" */
|
|
16
|
-
locale?: string
|
|
16
|
+
locale?: string;
|
|
17
17
|
}) => React.JSX.Element;
|
|
@@ -47,7 +47,7 @@ const MWaterMetricsTableListComponent = (props) => {
|
|
|
47
47
|
// Remove from extra tables
|
|
48
48
|
const match = props.extraTables.find((t) => t == `metrics:${metric._id}`);
|
|
49
49
|
if (match) {
|
|
50
|
-
if (confirm(
|
|
50
|
+
if (confirm(T `Remove this table? Some widgets may not work correctly.`)) {
|
|
51
51
|
props.onChange(null);
|
|
52
52
|
props.onExtraTableRemove(match);
|
|
53
53
|
}
|
|
@@ -56,7 +56,8 @@ const MWaterMetricsTableListComponent = (props) => {
|
|
|
56
56
|
if (!metrics || extraTableNeeded) {
|
|
57
57
|
return (react_2.default.createElement("div", null,
|
|
58
58
|
react_2.default.createElement("i", { className: "fa fa-spin fa-spinner" }),
|
|
59
|
-
"
|
|
59
|
+
" ",
|
|
60
|
+
T `Loading...`));
|
|
60
61
|
}
|
|
61
62
|
const renderMetrics = () => {
|
|
62
63
|
const items = metrics
|
|
@@ -73,7 +74,7 @@ const MWaterMetricsTableListComponent = (props) => {
|
|
|
73
74
|
return react_2.default.createElement(UIComponents_1.OptionListComponent, { items: items });
|
|
74
75
|
};
|
|
75
76
|
return (react_2.default.createElement("div", null,
|
|
76
|
-
react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder:
|
|
77
|
+
react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder: T `Search...` }),
|
|
77
78
|
renderMetrics()));
|
|
78
79
|
};
|
|
79
80
|
exports.MWaterMetricsTableListComponent = MWaterMetricsTableListComponent;
|
|
@@ -135,11 +135,11 @@ class MWaterResponsesFilterComponent extends react_1.default.Component {
|
|
|
135
135
|
col.join.toTable.startsWith("entities.") &&
|
|
136
136
|
col.id.match(/^data:/));
|
|
137
137
|
const siteColumnId = this.getSiteValue();
|
|
138
|
-
return R("div", { style: { paddingLeft: 5, paddingTop: 5 } }, R("div", { style: { paddingBottom: 5 } },
|
|
139
|
-
? R("div", null, R("i", null,
|
|
140
|
-
return R(ui.Radio, { key: column.id, value: siteColumnId, radioValue: column.id, onChange: this.handleSiteChange },
|
|
138
|
+
return R("div", { style: { paddingLeft: 5, paddingTop: 5 } }, R("div", { style: { paddingBottom: 5 } }, T `Data Source Options:`), R("div", { style: { paddingLeft: 5 } }, siteColumns.length > 0
|
|
139
|
+
? R("div", null, R("i", null, T `This data source contains links to monitoring sites. Would you like to:`), R("div", { style: { paddingLeft: 8 } }, R(ui.Radio, { key: "all", value: siteColumnId, radioValue: null, onChange: this.handleSiteChange }, T `Show all survey responses (even if there are more than one per site)`), lodash_1.default.map(siteColumns, (column) => {
|
|
140
|
+
return R(ui.Radio, { key: column.id, value: siteColumnId, radioValue: column.id, onChange: this.handleSiteChange }, T `Show only the latest response for each `, R("i", null, `${expressions_1.ExprUtils.localizeString(this.props.schema.getTable(column.join.toTable)?.name)}`), T ` in the question `, R("i", null, `'${expressions_1.ExprUtils.localizeString(column.name)}'`));
|
|
141
141
|
})))
|
|
142
|
-
: undefined, R(ui.Checkbox, { value: this.isFinal(), onChange: this.handleFinalChange },
|
|
142
|
+
: undefined, R(ui.Checkbox, { value: this.isFinal(), onChange: this.handleFinalChange }, T `Only include final responses (recommended)`)));
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
exports.default = MWaterResponsesFilterComponent;
|
|
@@ -23,7 +23,7 @@ interface MWaterTableSelectComponentState {
|
|
|
23
23
|
export default class MWaterTableSelectComponent extends React.Component<MWaterTableSelectComponentProps, MWaterTableSelectComponentState> {
|
|
24
24
|
static contextType: React.Context<string>;
|
|
25
25
|
toggleEdit: any;
|
|
26
|
-
constructor(props:
|
|
26
|
+
constructor(props: MWaterTableSelectComponentProps);
|
|
27
27
|
componentWillReceiveProps(nextProps: any): any;
|
|
28
28
|
handleChange: (tableId: any) => any;
|
|
29
29
|
handleTableChange: (tableId: any) => any;
|
|
@@ -86,12 +86,12 @@ class MWaterTableSelectComponent extends react_1.default.Component {
|
|
|
86
86
|
return R("div", null,
|
|
87
87
|
// Show message if loading
|
|
88
88
|
this.state.pendingExtraTable
|
|
89
|
-
? R("div", { className: "alert alert-info", key: "pendingExtraTable" }, R("i", { className: "fa fa-spinner fa-spin" }),
|
|
89
|
+
? R("div", { className: "alert alert-info", key: "pendingExtraTable" }, R("i", { className: "fa fa-spinner fa-spin" }), `\u00a0${T `Please wait...`}`)
|
|
90
90
|
: undefined, R(UIComponents_1.ToggleEditComponent, {
|
|
91
91
|
ref: (c) => {
|
|
92
92
|
this.toggleEdit = c;
|
|
93
93
|
},
|
|
94
|
-
forceOpen: !this.props.table,
|
|
94
|
+
forceOpen: !this.props.table, // Must have table
|
|
95
95
|
label: this.props.table
|
|
96
96
|
? expressions_1.ExprUtils.localizeString(this.props.schema.getTable(this.props.table)?.name, this.context)
|
|
97
97
|
: "",
|
|
@@ -165,10 +165,10 @@ class EditModeTableSelectComponent extends react_1.default.Component {
|
|
|
165
165
|
};
|
|
166
166
|
render() {
|
|
167
167
|
return (react_1.default.createElement(expressions_ui_1.ActiveTablesContext.Consumer, null, activeTables => (react_1.default.createElement("div", null,
|
|
168
|
-
this.state.completeMode ? (react_1.default.createElement(ModalPopupComponent_1.default, { header:
|
|
168
|
+
this.state.completeMode ? (react_1.default.createElement(ModalPopupComponent_1.default, { header: T `Select Data Source`, onClose: () => this.setState({ completeMode: false }), showCloseX: true, size: "x-large" },
|
|
169
169
|
react_1.default.createElement(MWaterCompleteTableSelectComponent_1.default, { apiUrl: this.props.apiUrl, client: this.props.client, schema: this.props.schema, user: this.props.user, table: this.props.table, onChange: this.handleCompleteChange, extraTables: this.props.extraTables, onExtraTablesChange: this.props.onExtraTablesChange }))) : null,
|
|
170
170
|
this.getTableShortlist(activeTables).length > 0 ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
171
|
-
react_1.default.createElement("div", { className: "text-muted" },
|
|
171
|
+
react_1.default.createElement("div", { className: "text-muted" }, T `Select Data Source:`),
|
|
172
172
|
react_1.default.createElement(UIComponents_1.OptionListComponent, { items: this.getTableShortlist(activeTables).map((tableId) => {
|
|
173
173
|
const table = this.props.schema.getTable(tableId);
|
|
174
174
|
return {
|
|
@@ -178,6 +178,6 @@ class EditModeTableSelectComponent extends react_1.default.Component {
|
|
|
178
178
|
};
|
|
179
179
|
}) }),
|
|
180
180
|
react_1.default.createElement("div", null,
|
|
181
|
-
react_1.default.createElement("button", { type: "button", className: "btn btn-link btn-sm", onClick: this.handleShowMore },
|
|
181
|
+
react_1.default.createElement("button", { type: "button", className: "btn btn-link btn-sm", onClick: this.handleShowMore }, T `Show All Available Data Sources...`)))) : (react_1.default.createElement("button", { type: "button", className: "btn btn-link", onClick: this.handleShowMore }, T `Select Data Source...`))))));
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -7,9 +7,9 @@ export interface PopoverComponentProps {
|
|
|
7
7
|
visible: boolean;
|
|
8
8
|
}
|
|
9
9
|
export default class PopoverComponent extends React.Component<PopoverComponentProps> {
|
|
10
|
-
componentDidMount():
|
|
11
|
-
componentWillUnmount():
|
|
12
|
-
componentDidUpdate(prevProps: any):
|
|
13
|
-
updatePopover(props: any, oldProps: any):
|
|
10
|
+
componentDidMount(): any;
|
|
11
|
+
componentWillUnmount(): any;
|
|
12
|
+
componentDidUpdate(prevProps: any): any;
|
|
13
|
+
updatePopover(props: any, oldProps: any): any;
|
|
14
14
|
render(): boolean | {} | React.ReactChild | React.ReactPortal | null | undefined;
|
|
15
15
|
}
|
package/lib/UIComponents.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import * as motion from "react-motion";
|
|
3
2
|
export interface SectionComponentProps {
|
|
4
3
|
icon?: string;
|
|
5
4
|
label?: any;
|
|
@@ -50,7 +49,11 @@ export declare class SwitchViewComponent extends React.Component<SwitchViewCompo
|
|
|
50
49
|
componentWillReceiveProps(nextProps: any): void;
|
|
51
50
|
refCallback: (id: any, comp: any) => any;
|
|
52
51
|
componentDidUpdate(prevProps: any, prevState: any): void;
|
|
53
|
-
render(): React.CElement<
|
|
52
|
+
render(): React.CElement<{
|
|
53
|
+
style: {};
|
|
54
|
+
}, React.Component<{
|
|
55
|
+
style: {};
|
|
56
|
+
}, any, any>>;
|
|
54
57
|
}
|
|
55
58
|
export interface ToggleEditComponentProps {
|
|
56
59
|
forceOpen?: boolean;
|
package/lib/axes/AxisBuilder.js
CHANGED
|
@@ -187,26 +187,26 @@ class AxisBuilder {
|
|
|
187
187
|
// xform validation
|
|
188
188
|
if (options.axis.xform && options.axis.xform.type === "bin") {
|
|
189
189
|
if (!options.axis.xform.numBins) {
|
|
190
|
-
return
|
|
190
|
+
return T `Missing numBins`;
|
|
191
191
|
}
|
|
192
192
|
if (options.axis.xform.min == null) {
|
|
193
|
-
return
|
|
193
|
+
return T `Missing min`;
|
|
194
194
|
}
|
|
195
195
|
if (options.axis.xform.max == null) {
|
|
196
|
-
return
|
|
196
|
+
return T `Missing max`;
|
|
197
197
|
}
|
|
198
198
|
if (options.axis.xform.max < options.axis.xform.min) {
|
|
199
|
-
return
|
|
199
|
+
return T `Max < min`;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
// xform validation
|
|
203
203
|
if (options.axis.xform && options.axis.xform.type === "ranges") {
|
|
204
204
|
if (!options.axis.xform.ranges || !lodash_1.default.isArray(options.axis.xform.ranges)) {
|
|
205
|
-
return
|
|
205
|
+
return T `Missing ranges`;
|
|
206
206
|
}
|
|
207
207
|
for (let range of options.axis.xform.ranges) {
|
|
208
208
|
if (range.minValue != null && range.maxValue != null && range.minValue > range.maxValue) {
|
|
209
|
-
return
|
|
209
|
+
return T `Max < min`;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
}
|
|
@@ -379,8 +379,7 @@ class AxisBuilder {
|
|
|
379
379
|
// from (select expression as val, ntile(numBins + 2) over (order by expression asc) as ntilenum
|
|
380
380
|
// from the_table where exprssion is not null)
|
|
381
381
|
// where inner.ntilenum > 1 and inner.ntilenum < numBins + 2
|
|
382
|
-
// Inspired by: http://dba.stackexchange.com/questions/17086/fast-general-method-to-calculate-percentiles
|
|
383
|
-
// expr is mwater expression on table
|
|
382
|
+
// Inspired by: http://dba.stackexchange.com/questions/17086/fast-general-method-to-calculate-percentiles // expr is mwater expression on table
|
|
384
383
|
// filterExpr is optional filter on values to include
|
|
385
384
|
// Result can be null if no query could be computed
|
|
386
385
|
compileBinMinMax(expr, table, filterExpr, numBins) {
|
|
@@ -479,7 +478,7 @@ class AxisBuilder {
|
|
|
479
478
|
*/
|
|
480
479
|
getCategories(axis, values, options = {}) {
|
|
481
480
|
let categories, current, end, format, label, max, min, value, year;
|
|
482
|
-
const noneCategory = { value: null, label: axis.nullLabel ||
|
|
481
|
+
const noneCategory = { value: null, label: axis.nullLabel || T `None` };
|
|
483
482
|
const hasNone = lodash_1.default.any(values || [], (v) => v == null);
|
|
484
483
|
// Handle ranges
|
|
485
484
|
if (axis.xform && axis.xform.type === "ranges") {
|
|
@@ -496,7 +495,7 @@ class AxisBuilder {
|
|
|
496
495
|
}
|
|
497
496
|
if (range.maxValue != null) {
|
|
498
497
|
if (label) {
|
|
499
|
-
label +=
|
|
498
|
+
label += T ` and `;
|
|
500
499
|
}
|
|
501
500
|
if (range.maxOpen) {
|
|
502
501
|
label += `< ${range.maxValue}`;
|
|
@@ -525,9 +524,9 @@ class AxisBuilder {
|
|
|
525
524
|
// Special case of single value (min and max within epsilon or 0.01% of each other since epsilon might be too small to add to a big number)
|
|
526
525
|
if (max - min <= epsilon || Math.abs((max - min) / (max + min)) < 0.0001) {
|
|
527
526
|
return [
|
|
528
|
-
{ value: 0, label: `< ${min}` },
|
|
529
|
-
{ value: 1, label: `= ${min}` },
|
|
530
|
-
{ value: axis.xform.numBins + 1, label: `> ${min}` },
|
|
527
|
+
{ value: 0, label: T `< ${min}` },
|
|
528
|
+
{ value: 1, label: T `= ${min}` },
|
|
529
|
+
{ value: axis.xform.numBins + 1, label: T `> ${min}` },
|
|
531
530
|
noneCategory
|
|
532
531
|
];
|
|
533
532
|
}
|
|
@@ -539,7 +538,7 @@ class AxisBuilder {
|
|
|
539
538
|
format = d3Format.format(",." + precision + "f");
|
|
540
539
|
categories = [];
|
|
541
540
|
if (!axis.xform.excludeLower) {
|
|
542
|
-
categories.push({ value: 0, label: `< ${format(min)}` });
|
|
541
|
+
categories.push({ value: 0, label: T `< ${format(min)}` });
|
|
543
542
|
}
|
|
544
543
|
for (let i = 1, end1 = numBins, asc = 1 <= end1; asc ? i <= end1 : i >= end1; asc ? i++ : i--) {
|
|
545
544
|
const start = ((i - 1) / numBins) * (max - min) + min;
|
|
@@ -547,7 +546,7 @@ class AxisBuilder {
|
|
|
547
546
|
categories.push({ value: i, label: `${format(start)} - ${format(end)}` });
|
|
548
547
|
}
|
|
549
548
|
if (!axis.xform.excludeUpper) {
|
|
550
|
-
categories.push({ value: axis.xform.numBins + 1, label: `> ${format(max)}` });
|
|
549
|
+
categories.push({ value: axis.xform.numBins + 1, label: T `> ${format(max)}` });
|
|
551
550
|
}
|
|
552
551
|
categories.push(noneCategory);
|
|
553
552
|
return categories;
|
|
@@ -575,18 +574,18 @@ class AxisBuilder {
|
|
|
575
574
|
}
|
|
576
575
|
if (axis.xform && axis.xform.type === "month") {
|
|
577
576
|
categories = [
|
|
578
|
-
{ value: "01", label:
|
|
579
|
-
{ value: "02", label:
|
|
580
|
-
{ value: "03", label:
|
|
581
|
-
{ value: "04", label:
|
|
582
|
-
{ value: "05", label:
|
|
583
|
-
{ value: "06", label:
|
|
584
|
-
{ value: "07", label:
|
|
585
|
-
{ value: "08", label:
|
|
586
|
-
{ value: "09", label:
|
|
587
|
-
{ value: "10", label:
|
|
588
|
-
{ value: "11", label:
|
|
589
|
-
{ value: "12", label:
|
|
577
|
+
{ value: "01", label: T `January` },
|
|
578
|
+
{ value: "02", label: T `February` },
|
|
579
|
+
{ value: "03", label: T `March` },
|
|
580
|
+
{ value: "04", label: T `April` },
|
|
581
|
+
{ value: "05", label: T `May` },
|
|
582
|
+
{ value: "06", label: T `June` },
|
|
583
|
+
{ value: "07", label: T `July` },
|
|
584
|
+
{ value: "08", label: T `August` },
|
|
585
|
+
{ value: "09", label: T `September` },
|
|
586
|
+
{ value: "10", label: T `October` },
|
|
587
|
+
{ value: "11", label: T `November` },
|
|
588
|
+
{ value: "12", label: T `December` }
|
|
590
589
|
];
|
|
591
590
|
// Add none if needed
|
|
592
591
|
if (hasNone) {
|
|
@@ -654,7 +653,7 @@ class AxisBuilder {
|
|
|
654
653
|
}
|
|
655
654
|
if (options.onlyValuesPresent) {
|
|
656
655
|
// Sort and take only present
|
|
657
|
-
categories = lodash_1.default.sortBy(lodash_1.default.uniq(values), item => item).map(value => ({ value, label: (0, moment_1.default)(value, "YYYY-MM-DD").format(
|
|
656
|
+
categories = lodash_1.default.sortBy(lodash_1.default.uniq(values), item => item).map(value => ({ value, label: (0, moment_1.default)(value, "YYYY-MM-DD").format(T `MMM YYYY`) }));
|
|
658
657
|
if (hasNone) {
|
|
659
658
|
categories.push(noneCategory);
|
|
660
659
|
}
|
|
@@ -668,7 +667,7 @@ class AxisBuilder {
|
|
|
668
667
|
end = (0, moment_1.default)(max, "YYYY-MM-DD");
|
|
669
668
|
categories = [];
|
|
670
669
|
while (!current.isAfter(end)) {
|
|
671
|
-
categories.push({ value: current.format("YYYY-MM-DD"), label: current.format(
|
|
670
|
+
categories.push({ value: current.format("YYYY-MM-DD"), label: current.format(T `MMM YYYY`) });
|
|
672
671
|
current.add(1, "months");
|
|
673
672
|
if (categories.length >= 1000) {
|
|
674
673
|
break;
|
|
@@ -724,16 +723,16 @@ class AxisBuilder {
|
|
|
724
723
|
const year = value.substr(0, 4);
|
|
725
724
|
const quarter = value.substr(value.length - 1, 1);
|
|
726
725
|
if (quarter === "1") {
|
|
727
|
-
label = `${year} Jan-Mar`;
|
|
726
|
+
label = `${year} ${T `Jan-Mar`}`;
|
|
728
727
|
}
|
|
729
728
|
else if (quarter === "2") {
|
|
730
|
-
label = `${year} Apr-Jun`;
|
|
729
|
+
label = `${year} ${T `Apr-Jun`}`;
|
|
731
730
|
}
|
|
732
731
|
else if (quarter === "3") {
|
|
733
|
-
label = `${year} Jul-Sep`;
|
|
732
|
+
label = `${year} ${T `Jul-Sep`}`;
|
|
734
733
|
}
|
|
735
734
|
else if (quarter === "4") {
|
|
736
|
-
label = `${year} Oct-Dec`;
|
|
735
|
+
label = `${year} ${T `Oct-Dec`}`;
|
|
737
736
|
}
|
|
738
737
|
else {
|
|
739
738
|
label = "";
|
|
@@ -757,16 +756,16 @@ class AxisBuilder {
|
|
|
757
756
|
const quarter = current.format("Q");
|
|
758
757
|
year = current.format("YYYY");
|
|
759
758
|
if (quarter === "1") {
|
|
760
|
-
label = `${year} Jan-Mar`;
|
|
759
|
+
label = `${year} ${T `Jan-Mar`}`;
|
|
761
760
|
}
|
|
762
761
|
else if (quarter === "2") {
|
|
763
|
-
label = `${year} Apr-Jun`;
|
|
762
|
+
label = `${year} ${T `Apr-Jun`}`;
|
|
764
763
|
}
|
|
765
764
|
else if (quarter === "3") {
|
|
766
|
-
label = `${year} Jul-Sep`;
|
|
765
|
+
label = `${year} ${T `Jul-Sep`}`;
|
|
767
766
|
}
|
|
768
767
|
else if (quarter === "4") {
|
|
769
|
-
label = `${year} Oct-Dec`;
|
|
768
|
+
label = `${year} ${T `Oct-Dec`}`;
|
|
770
769
|
}
|
|
771
770
|
else {
|
|
772
771
|
label = "";
|
|
@@ -812,7 +811,7 @@ class AxisBuilder {
|
|
|
812
811
|
// Return unique values
|
|
813
812
|
categories = lodash_1.default.map(lodash_1.default.compact(lodash_1.default.uniq(values || [])).sort(), (v) => ({
|
|
814
813
|
value: v,
|
|
815
|
-
label: v ||
|
|
814
|
+
label: v || T `None`
|
|
816
815
|
}));
|
|
817
816
|
if (hasNone) {
|
|
818
817
|
categories.push(noneCategory);
|
|
@@ -820,7 +819,7 @@ class AxisBuilder {
|
|
|
820
819
|
return categories;
|
|
821
820
|
case "boolean":
|
|
822
821
|
// Return unique values
|
|
823
|
-
return [{ value: true, label:
|
|
822
|
+
return [{ value: true, label: T `True` }, { value: false, label: T `False` }, noneCategory];
|
|
824
823
|
case "date":
|
|
825
824
|
values = lodash_1.default.compact(values || []);
|
|
826
825
|
if (values.length === 0) {
|
|
@@ -896,7 +895,7 @@ class AxisBuilder {
|
|
|
896
895
|
// Summarize axis as a string
|
|
897
896
|
summarizeAxis(axis, locale) {
|
|
898
897
|
if (!axis) {
|
|
899
|
-
return
|
|
898
|
+
return T `None`;
|
|
900
899
|
}
|
|
901
900
|
return this.exprUtils.summarizeExpr(axis.expr, locale);
|
|
902
901
|
}
|
|
@@ -904,7 +903,7 @@ class AxisBuilder {
|
|
|
904
903
|
// Get a string (or React DOM actually) representation of an axis value
|
|
905
904
|
formatValue(axis, value, locale, legacyPercentFormat) {
|
|
906
905
|
if (value == null) {
|
|
907
|
-
return axis?.nullLabel ||
|
|
906
|
+
return axis?.nullLabel || T `None`;
|
|
908
907
|
}
|
|
909
908
|
const type = this.getAxisType(axis);
|
|
910
909
|
// If has categories, use those
|
|
@@ -921,7 +920,7 @@ class AxisBuilder {
|
|
|
921
920
|
return this.formatCategory(axis, category);
|
|
922
921
|
}
|
|
923
922
|
else {
|
|
924
|
-
return
|
|
923
|
+
return T `???`;
|
|
925
924
|
}
|
|
926
925
|
}).join(", ");
|
|
927
926
|
}
|
|
@@ -931,7 +930,7 @@ class AxisBuilder {
|
|
|
931
930
|
return this.formatCategory(axis, category);
|
|
932
931
|
}
|
|
933
932
|
else {
|
|
934
|
-
return
|
|
933
|
+
return T `???`;
|
|
935
934
|
}
|
|
936
935
|
}
|
|
937
936
|
}
|
|
@@ -19,21 +19,21 @@ export interface AxisColorEditorComponentProps {
|
|
|
19
19
|
autosetColors?: boolean;
|
|
20
20
|
}
|
|
21
21
|
interface AxisColorEditorComponentState {
|
|
22
|
-
mode:
|
|
22
|
+
mode: "normal" | "palette";
|
|
23
23
|
}
|
|
24
24
|
export default class AxisColorEditorComponent extends React.Component<AxisColorEditorComponentProps, AxisColorEditorComponentState> {
|
|
25
25
|
static defaultProps: {
|
|
26
26
|
reorderable: boolean;
|
|
27
27
|
autosetColors: boolean;
|
|
28
28
|
};
|
|
29
|
-
constructor(props:
|
|
30
|
-
|
|
29
|
+
constructor(props: AxisColorEditorComponentProps);
|
|
30
|
+
componentDidMount(): void;
|
|
31
31
|
componentDidUpdate(): void;
|
|
32
32
|
updateColorMap(): void;
|
|
33
33
|
handleSelectPalette: () => void;
|
|
34
34
|
handleResetPalette: () => void;
|
|
35
35
|
handlePaletteChange: (palette: ColorMap) => void;
|
|
36
36
|
handleCancelCustomize: () => void;
|
|
37
|
-
render(): React.
|
|
37
|
+
render(): React.JSX.Element;
|
|
38
38
|
}
|
|
39
39
|
export {};
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const R = react_1.default.createElement;
|
|
9
8
|
const CategoryMapComponent_1 = __importDefault(require("./CategoryMapComponent"));
|
|
10
9
|
const ColorSchemeFactory_1 = __importDefault(require("../ColorSchemeFactory"));
|
|
11
10
|
const ColorPaletteCollectionComponent_1 = __importDefault(require("./ColorPaletteCollectionComponent"));
|
|
@@ -24,11 +23,11 @@ class AxisColorEditorComponent extends react_1.default.Component {
|
|
|
24
23
|
mode: "normal"
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
componentDidMount() {
|
|
27
|
+
this.updateColorMap();
|
|
29
28
|
}
|
|
30
29
|
componentDidUpdate() {
|
|
31
|
-
|
|
30
|
+
this.updateColorMap();
|
|
32
31
|
}
|
|
33
32
|
// Update color map if categories no longer match
|
|
34
33
|
updateColorMap() {
|
|
@@ -42,31 +41,37 @@ class AxisColorEditorComponent extends react_1.default.Component {
|
|
|
42
41
|
!lodash_1.default.isEqual(lodash_1.default.pluck(this.props.axis.colorMap, "value").sort(), lodash_1.default.pluck(this.props.categories, "value").sort())) {
|
|
43
42
|
let colorMap;
|
|
44
43
|
if (this.props.autosetColors) {
|
|
45
|
-
|
|
44
|
+
// Find categories that are not in the color map
|
|
45
|
+
const missingCategories = lodash_1.default.filter(this.props.categories, (category) => !(this.props.axis.colorMap || []).find(cm => cm.value === category.value));
|
|
46
|
+
if (missingCategories.length == 0) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const missingColorMap = ColorSchemeFactory_1.default.createColorMapForCategories(missingCategories, axisBuilder.isCategorical(this.props.axis));
|
|
50
|
+
colorMap = (this.props.axis.colorMap || []).concat(missingColorMap);
|
|
46
51
|
}
|
|
47
52
|
else {
|
|
48
53
|
// Keep existing
|
|
49
54
|
const existing = lodash_1.default.indexBy(this.props.axis.colorMap || [], "value");
|
|
50
|
-
colorMap = lodash_1.default.map(this.props.categories, (category
|
|
55
|
+
colorMap = lodash_1.default.map(this.props.categories, (category) => ({
|
|
51
56
|
value: category.value,
|
|
52
57
|
color: existing[category.value] ? existing[category.value].color : null
|
|
53
58
|
}));
|
|
54
59
|
}
|
|
55
60
|
this.handlePaletteChange(colorMap);
|
|
56
|
-
|
|
61
|
+
this.setState({ mode: "normal" });
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
handleSelectPalette = () => {
|
|
60
|
-
|
|
65
|
+
this.setState({ mode: "palette" });
|
|
61
66
|
};
|
|
62
67
|
handleResetPalette = () => {
|
|
63
68
|
// Completely reset
|
|
64
|
-
const colorMap = lodash_1.default.map(this.props.categories || [], (category
|
|
69
|
+
const colorMap = lodash_1.default.map(this.props.categories || [], (category) => ({
|
|
65
70
|
value: category.value,
|
|
66
71
|
color: null
|
|
67
72
|
}));
|
|
68
73
|
this.handlePaletteChange(colorMap);
|
|
69
|
-
|
|
74
|
+
this.setState({ mode: "normal" });
|
|
70
75
|
};
|
|
71
76
|
handlePaletteChange = (palette) => {
|
|
72
77
|
this.props.onChange((0, immer_1.default)(this.props.axis, (draft) => {
|
|
@@ -76,58 +81,18 @@ class AxisColorEditorComponent extends react_1.default.Component {
|
|
|
76
81
|
this.setState({ mode: "normal" });
|
|
77
82
|
};
|
|
78
83
|
handleCancelCustomize = () => {
|
|
79
|
-
|
|
84
|
+
this.setState({ mode: "normal" });
|
|
80
85
|
};
|
|
81
|
-
// renderPreview() {
|
|
82
|
-
// return R(
|
|
83
|
-
// "div",
|
|
84
|
-
// { className: "axis-palette" },
|
|
85
|
-
// _.map(this.props.categories.slice(0, 6), (category, i) => {
|
|
86
|
-
// const color = _.find(this.props.axis.colorMap, { value: category.value })
|
|
87
|
-
// const cellStyle = {
|
|
88
|
-
// display: "inline-block",
|
|
89
|
-
// height: 20,
|
|
90
|
-
// width: 20,
|
|
91
|
-
// backgroundColor: color ? color.color : this.props.defaultColor
|
|
92
|
-
// }
|
|
93
|
-
// return R("div", { style: cellStyle, key: i }, " ")
|
|
94
|
-
// })
|
|
95
|
-
// )
|
|
96
|
-
// }
|
|
97
86
|
render() {
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return null;
|
|
110
|
-
})(), this.state.mode === "normal"
|
|
111
|
-
? R("div", null, R("p", null, R("a", { className: "link-plain", onClick: this.handleSelectPalette, key: "select-palette" }, "Change color scheme"), !this.props.autosetColors
|
|
112
|
-
? R("a", {
|
|
113
|
-
className: "btn btn-sm btn-link",
|
|
114
|
-
onClick: this.handleResetPalette,
|
|
115
|
-
key: "reset-palette"
|
|
116
|
-
}, "Reset colors")
|
|
117
|
-
: undefined), this.props.axis.colorMap
|
|
118
|
-
? R("div", { key: "selected-palette" }, R("div", null, R(CategoryMapComponent_1.default, {
|
|
119
|
-
schema: this.props.schema,
|
|
120
|
-
axis: this.props.axis,
|
|
121
|
-
onChange: this.props.onChange,
|
|
122
|
-
categories: this.props.categories,
|
|
123
|
-
key: "colorMap",
|
|
124
|
-
reorderable: this.props.reorderable,
|
|
125
|
-
allowExcludedValues: this.props.allowExcludedValues,
|
|
126
|
-
showColorMap: true,
|
|
127
|
-
initiallyExpanded: this.props.initiallyExpanded
|
|
128
|
-
})))
|
|
129
|
-
: undefined)
|
|
130
|
-
: undefined);
|
|
87
|
+
return (react_1.default.createElement("div", null,
|
|
88
|
+
this.state.mode === "palette" && this.props.categories && (react_1.default.createElement(ColorPaletteCollectionComponent_1.default, { onPaletteSelected: this.handlePaletteChange, axis: this.props.axis, categories: this.props.categories, onCancel: this.handleCancelCustomize })),
|
|
89
|
+
this.state.mode === "normal" && (react_1.default.createElement("div", null,
|
|
90
|
+
react_1.default.createElement("p", null,
|
|
91
|
+
react_1.default.createElement("a", { className: "link-plain", onClick: this.handleSelectPalette }, T `Change color scheme`),
|
|
92
|
+
!this.props.autosetColors && (react_1.default.createElement("a", { className: "btn btn-sm btn-link", onClick: this.handleResetPalette }, T `Reset colors`))),
|
|
93
|
+
this.props.axis.colorMap && (react_1.default.createElement("div", null,
|
|
94
|
+
react_1.default.createElement("div", null,
|
|
95
|
+
react_1.default.createElement(CategoryMapComponent_1.default, { schema: this.props.schema, axis: this.props.axis, onChange: this.props.onChange, categories: this.props.categories, reorderable: this.props.reorderable, allowExcludedValues: this.props.allowExcludedValues, showColorMap: true, initiallyExpanded: this.props.initiallyExpanded }))))))));
|
|
131
96
|
}
|
|
132
97
|
}
|
|
133
98
|
exports.default = AxisColorEditorComponent;
|