@mwater/visualization 5.2.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ColorComponent.d.ts +10 -11
- package/lib/ColorComponent.js +78 -29
- package/lib/ColorSchemeFactory.d.ts +13 -2
- package/lib/ColorSchemeFactory.js +7 -5
- package/lib/CustomColorsContext.d.ts +6 -0
- package/lib/CustomColorsContext.js +6 -0
- package/lib/FiltersDesignerComponent.d.ts +1 -4
- package/lib/FiltersDesignerComponent.js +2 -3
- package/lib/LocaleContextInjector.d.ts +5 -11
- package/lib/LocaleContextInjector.js +4 -12
- package/lib/MWaterAddRelatedFormComponent.js +3 -3
- package/lib/MWaterAddRelatedIndicatorComponent.d.ts +1 -4
- package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
- package/lib/MWaterCompleteTableSelectComponent.d.ts +5 -16
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +4 -6
- package/lib/MWaterContextComponent.js +4 -13
- package/lib/MWaterLoaderComponent.d.ts +5 -3
- package/lib/MWaterLoaderComponent.js +2 -1
- package/lib/MWaterTableSelectComponent.d.ts +1 -4
- package/lib/MWaterTableSelectComponent.js +10 -12
- package/lib/UIComponents.d.ts +2 -2
- package/lib/UIComponents.js +4 -12
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +3 -1
- package/lib/axes/AxisComponent.d.ts +2 -5
- package/lib/axes/AxisComponent.js +1 -2
- package/lib/axes/ColorPaletteCollectionComponent.d.ts +5 -12
- package/lib/axes/ColorPaletteCollectionComponent.js +67 -36
- package/lib/dashboards/DashboardComponent.d.ts +4 -12
- package/lib/dashboards/DashboardComponent.js +18 -38
- package/lib/dashboards/DashboardDesign.d.ts +3 -3
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +109 -132
- package/lib/dashboards/FontStyleEditor.d.ts +8 -0
- package/lib/dashboards/FontStyleEditor.js +130 -0
- package/lib/dashboards/LayoutOptionsComponent.d.ts +0 -1
- package/lib/dashboards/LayoutOptionsComponent.js +211 -42
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/WidgetComponent.d.ts +3 -3
- package/lib/dashboards/WidgetComponent.js +3 -6
- package/lib/dashboards/WidgetDataSourcePrioritizer.d.ts +20 -0
- package/lib/dashboards/WidgetDataSourcePrioritizer.js +72 -0
- package/lib/dashboards/layoutOptions.d.ts +83 -0
- package/lib/dashboards/layoutOptions.js +436 -10
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.js +87 -33
- package/lib/demo.js +3 -3
- package/lib/index.css +5 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -1
- package/lib/layouts/LayoutManager.d.ts +33 -29
- package/lib/layouts/LayoutManager.js +2 -8
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +26 -57
- package/lib/layouts/blocks/BlocksDisplayComponent.js +122 -205
- package/lib/layouts/blocks/BlocksLayoutManager.d.ts +6 -22
- package/lib/layouts/blocks/BlocksLayoutManager.js +5 -14
- package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +5 -4
- package/lib/layouts/blocks/HorizontalBlockComponent.js +5 -5
- package/lib/mWaterLoader.d.ts +2 -0
- package/lib/mWaterLoader.js +2 -1
- package/lib/maps/AddLayerComponent.d.ts +6 -8
- package/lib/maps/AddLayerComponent.js +6 -6
- package/lib/maps/BingLayer.js +10 -20
- package/lib/maps/BufferLayer.js +2 -1
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/DirectMapDataSource.d.ts +5 -2
- package/lib/maps/DirectMapDataSource.js +2 -1
- package/lib/maps/EditPopupComponent.js +2 -1
- package/lib/maps/MapComponent.d.ts +1 -4
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +1 -4
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/ServerMapDataSource.d.ts +2 -3
- package/lib/maps/ServerMapDataSource.js +5 -5
- package/lib/maps/VectorMapViewComponent.js +2 -1
- package/lib/maps/mapSymbols.js +2 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/vectorMaps.js +61 -55
- package/lib/quickfilter/QuickfiltersComponent.d.ts +1 -4
- package/lib/quickfilter/QuickfiltersComponent.js +3 -3
- package/lib/richtext/DropdownPaletteItem.d.ts +32 -0
- package/lib/richtext/DropdownPaletteItem.js +82 -0
- package/lib/richtext/FontColorPaletteItem.d.ts +1 -5
- package/lib/richtext/FontColorPaletteItem.js +32 -27
- package/lib/richtext/ItemsHtmlConverter.js +12 -3
- package/lib/richtext/RichTextComponent.d.ts +26 -52
- package/lib/richtext/RichTextComponent.js +166 -128
- package/lib/valueFormatter.js +6 -1
- package/lib/wellknown.d.ts +5 -0
- package/lib/wellknown.js +288 -0
- package/lib/widgets/DropdownWidgetComponent.d.ts +8 -25
- package/lib/widgets/DropdownWidgetComponent.js +48 -25
- package/lib/widgets/IFrameWidgetComponent.d.ts +1 -2
- package/lib/widgets/ImageWidgetComponent.d.ts +2 -3
- package/lib/widgets/MapWidget.d.ts +2 -0
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/TOCWidget.js +2 -1
- package/lib/widgets/Widget.d.ts +2 -0
- package/lib/widgets/WidgetDataSource.d.ts +3 -1
- package/lib/widgets/charts/Chart.d.ts +0 -1
- package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartViewComponent.js +11 -3
- package/lib/widgets/charts/ChartWidget.d.ts +1 -62
- package/lib/widgets/charts/ChartWidget.js +4 -183
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +51 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +167 -0
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +4 -4
- package/lib/widgets/charts/layered/LayeredChart.d.ts +5 -10
- package/lib/widgets/charts/layered/LayeredChart.js +6 -7
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +4 -2
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +46 -32
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +4 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +3 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -2
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -1
- package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +89 -38
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +5 -112
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +122 -166
- package/lib/widgets/charts/pivot/PivotChart.d.ts +6 -0
- package/lib/widgets/charts/pivot/PivotChart.js +47 -17
- package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +11 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +1 -1
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +20 -36
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +0 -1
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +23 -2
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +215 -181
- package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +9 -28
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/table/TableChart.js +8 -4
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +3 -3
- package/lib/widgets/charts/table/TableChartViewComponent.js +11 -11
- package/lib/widgets/text/TextComponent.d.ts +5 -12
- package/lib/widgets/text/TextComponent.js +19 -39
- package/lib/widgets/text/TextWidget.d.ts +2 -1
- package/lib/widgets/text/TextWidget.js +5 -1
- package/lib/widgets/text/TextWidgetComponent.d.ts +15 -3
- package/lib/widgets/text/TextWidgetComponent.js +76 -19
- package/lib/widgets/text/TextWidgetDesign.d.ts +13 -1
- package/lib/widgets/text/TextWidgetDesign.js +6 -0
- package/package.json +4 -4
- package/src/ColorComponent.tsx +177 -0
- package/src/ColorSchemeFactory.ts +12 -6
- package/src/CustomColorsContext.tsx +9 -0
- package/src/FiltersDesignerComponent.ts +3 -4
- package/src/LocaleContextInjector.tsx +14 -13
- package/src/MWaterAddRelatedFormComponent.ts +3 -3
- package/src/MWaterAddRelatedIndicatorComponent.ts +6 -6
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -36
- package/src/MWaterContextComponent.tsx +8 -17
- package/src/MWaterLoaderComponent.ts +6 -3
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/AxisBuilder.ts +7 -5
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +71 -107
- package/src/dashboards/DashboardDesign.ts +3 -3
- package/src/dashboards/DashboardUpgrader.ts +41 -1
- package/src/dashboards/DashboardViewComponent.tsx +313 -0
- package/src/dashboards/FontStyleEditor.tsx +166 -0
- package/src/dashboards/LayoutOptionsComponent.tsx +380 -75
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/ServerDatagridDataSource.ts +106 -43
- package/src/demo.ts +3 -3
- package/src/index.css +5 -0
- package/src/index.ts +1 -1
- package/src/layouts/LayoutManager.ts +44 -42
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +498 -0
- package/src/layouts/blocks/BlocksLayoutManager.ts +6 -15
- package/src/layouts/blocks/HorizontalBlockComponent.ts +9 -8
- package/src/mWaterLoader.ts +4 -1
- package/src/maps/AddLayerComponent.ts +9 -9
- package/src/maps/BingLayer.ts +16 -26
- package/src/maps/BufferLayer.ts +2 -1
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +7 -7
- package/src/maps/VectorMapViewComponent.tsx +2 -1
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +79 -74
- package/src/quickfilter/QuickfiltersComponent.ts +3 -3
- package/src/richtext/DropdownPaletteItem.tsx +144 -0
- package/src/richtext/FontColorPaletteItem.tsx +160 -0
- package/src/richtext/ItemsHtmlConverter.ts +15 -5
- package/src/richtext/RichTextComponent.tsx +274 -232
- package/src/valueFormatter.ts +5 -1
- package/src/wellknown.ts +286 -0
- package/src/widgets/DropdownWidgetComponent.tsx +75 -0
- package/src/widgets/MapWidget.ts +5 -2
- package/src/widgets/TOCWidget.ts +2 -1
- package/src/widgets/Widget.ts +3 -0
- package/src/widgets/WidgetDataSource.ts +3 -1
- package/src/widgets/charts/Chart.ts +1 -1
- package/src/widgets/charts/ChartViewComponent.ts +16 -3
- package/src/widgets/charts/ChartWidget.ts +3 -275
- package/src/widgets/charts/ChartWidgetComponent.tsx +281 -0
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +4 -4
- package/src/widgets/charts/layered/LayeredChart.ts +4 -6
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +80 -63
- package/src/widgets/charts/layered/LayeredChartDesign.ts +7 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +43 -10
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +6 -6
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +140 -88
- package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +305 -221
- package/src/widgets/charts/pivot/PivotChart.ts +56 -18
- package/src/widgets/charts/pivot/PivotChartDesign.ts +12 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +4 -3
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +39 -76
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +0 -1
- package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +230 -189
- package/src/widgets/charts/pivot/PivotChartUtils.ts +4 -4
- package/src/widgets/charts/pivot/{PivotChartViewComponent.ts → PivotChartViewComponent.tsx} +86 -89
- package/src/widgets/charts/table/TableChart.ts +8 -4
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +4 -4
- package/src/widgets/charts/table/TableChartViewComponent.ts +13 -14
- package/src/widgets/text/TextComponent.tsx +47 -49
- package/src/widgets/text/TextWidget.ts +8 -3
- package/src/widgets/text/TextWidgetComponent.tsx +249 -0
- package/src/widgets/text/TextWidgetDesign.ts +22 -1
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -303
- package/src/dashboards/layoutOptions.ts +0 -40
- package/src/layout-styles.css +0 -263
- package/src/layouts/blocks/BlocksDisplayComponent.ts +0 -461
- package/src/layouts/grid/GridLayoutComponent.ts +0 -67
- package/src/layouts/grid/GridLayoutManager.ts +0 -185
- package/src/layouts/grid/LegoLayoutEngine.ts +0 -142
- package/src/layouts/grid/PaletteItemComponent.ts +0 -28
- package/src/layouts/grid/README.md +0 -14
- package/src/layouts/grid/WidgetContainerComponent.ts +0 -420
- package/src/richtext/FontColorPaletteItem.ts +0 -172
- package/src/richtext/FontSizePaletteItem.ts +0 -110
- package/src/widgets/DropdownWidgetComponent.ts +0 -78
- package/src/widgets/text/TextWidgetComponent.ts +0 -120
|
@@ -27,9 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
30
|
-
const
|
|
31
|
-
const react_1 = __importDefault(require("react"));
|
|
32
|
-
const R = react_1.default.createElement;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
33
31
|
const ImplicitFilterBuilder_1 = __importDefault(require("../ImplicitFilterBuilder"));
|
|
34
32
|
const DashboardUtils = __importStar(require("./DashboardUtils"));
|
|
35
33
|
const WidgetFactory_1 = __importDefault(require("../widgets/WidgetFactory"));
|
|
@@ -40,85 +38,85 @@ const WidgetScopesViewComponent_1 = __importDefault(require("../widgets/WidgetSc
|
|
|
40
38
|
const layoutOptions_1 = require("./layoutOptions");
|
|
41
39
|
const WidgetComponent_1 = require("./WidgetComponent");
|
|
42
40
|
const vectorMaps_1 = require("../maps/vectorMaps");
|
|
41
|
+
const WidgetDataSourcePrioritizer_1 = require("./WidgetDataSourcePrioritizer");
|
|
42
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
43
43
|
/**
|
|
44
44
|
* Displays a dashboard, handling removing of widgets. No title bar or other decorations.
|
|
45
45
|
* Handles scoping and stores the state of scope
|
|
46
46
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
widgetComps;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
const DashboardViewComponent = react_1.default.forwardRef((props, ref) => {
|
|
48
|
+
const [widgetScoper, setWidgetScoper] = (0, react_1.useState)(new WidgetScoper_1.default());
|
|
49
|
+
const widgetComps = (0, react_1.useRef)({});
|
|
50
|
+
const [forceUpdate, setForceUpdate] = (0, react_1.useState)(0);
|
|
51
|
+
const widgetDataSourcePrioritizer = (0, react_1.useMemo)(() => {
|
|
52
|
+
return new WidgetDataSourcePrioritizer_1.WidgetDataSourcePrioritizer(props.dashboardDataSource, 10);
|
|
53
|
+
}, [props.dashboardDataSource]);
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
55
|
+
return () => {
|
|
56
|
+
// Clear queue on component unmount
|
|
57
|
+
widgetDataSourcePrioritizer.cancel();
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (this.props.initialTOCEntryScroll) {
|
|
59
|
+
}, [widgetDataSourcePrioritizer]);
|
|
60
|
+
(0, react_1.useEffect)(() => {
|
|
61
|
+
if (props.initialTOCEntryScroll) {
|
|
63
62
|
// Getting heights of widgets properly requires a 0 length timeout
|
|
64
63
|
setTimeout(() => {
|
|
65
|
-
|
|
64
|
+
handleScrollToTOCEntry(props.initialTOCEntryScroll.widgetId, props.initialTOCEntryScroll.entryId);
|
|
66
65
|
}, 0);
|
|
67
66
|
}
|
|
68
67
|
// Add listener to localstorage to update clipboard display
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
handleStorageChange = () => {
|
|
76
|
-
|
|
68
|
+
window.addEventListener("storage", handleStorageChange);
|
|
69
|
+
return () => {
|
|
70
|
+
// Remove listener
|
|
71
|
+
window.removeEventListener("storage", handleStorageChange);
|
|
72
|
+
};
|
|
73
|
+
}, [props.initialTOCEntryScroll]);
|
|
74
|
+
const handleStorageChange = () => {
|
|
75
|
+
setForceUpdate(forceUpdate + 1);
|
|
77
76
|
};
|
|
78
|
-
handleScopeChange = (id, scope) => {
|
|
79
|
-
|
|
77
|
+
const handleScopeChange = (id, scope) => {
|
|
78
|
+
setWidgetScoper(widgetScoper.applyScope(id, scope));
|
|
80
79
|
};
|
|
81
|
-
handleRemoveScope = (id) => {
|
|
82
|
-
|
|
80
|
+
const handleRemoveScope = (id) => {
|
|
81
|
+
setWidgetScoper(widgetScoper.applyScope(id, null));
|
|
83
82
|
};
|
|
84
|
-
handleItemsChange = (items) => {
|
|
85
|
-
const design = lodash_1.default.extend({},
|
|
86
|
-
|
|
83
|
+
const handleItemsChange = (items) => {
|
|
84
|
+
const design = lodash_1.default.extend({}, props.design, { items });
|
|
85
|
+
props.onDesignChange(design);
|
|
87
86
|
};
|
|
88
|
-
|
|
89
|
-
handleClipboardChange = (block) => {
|
|
87
|
+
const handleClipboardChange = (block) => {
|
|
90
88
|
try {
|
|
91
89
|
// If empty, just set it
|
|
92
90
|
if (!block) {
|
|
93
91
|
window.localStorage.removeItem("DashboardViewComponent.clipboard");
|
|
94
|
-
|
|
92
|
+
setForceUpdate(forceUpdate + 1);
|
|
95
93
|
return;
|
|
96
94
|
}
|
|
97
95
|
// Determine which tables are used (just peek for any uses of the table name. Not ideal, but easy)
|
|
98
|
-
const tables = lodash_1.default.pluck(lodash_1.default.filter(
|
|
96
|
+
const tables = lodash_1.default.pluck(lodash_1.default.filter(props.schema.getTables(), (table) => JSON.stringify(block).includes(JSON.stringify(table.id))), "id");
|
|
99
97
|
// Store in clipboard
|
|
100
98
|
window.localStorage.setItem("DashboardViewComponent.clipboard", JSON.stringify({ block, tables }));
|
|
101
|
-
|
|
99
|
+
setForceUpdate(forceUpdate + 1);
|
|
102
100
|
}
|
|
103
101
|
catch (err) {
|
|
104
102
|
return alert("Clipboard not available");
|
|
105
103
|
}
|
|
106
104
|
};
|
|
107
|
-
getClipboardContents() {
|
|
105
|
+
const getClipboardContents = () => {
|
|
108
106
|
try {
|
|
109
107
|
return JSON.parse(window.localStorage.getItem("DashboardViewComponent.clipboard") || "null");
|
|
110
108
|
}
|
|
111
109
|
catch (err) {
|
|
112
110
|
return null;
|
|
113
111
|
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
print = async () => {
|
|
112
|
+
};
|
|
113
|
+
const print = async () => {
|
|
117
114
|
// Temporarily enable print mode for vector maps
|
|
118
115
|
try {
|
|
119
116
|
(0, vectorMaps_1.setPrintingModeEnabled)(true);
|
|
120
117
|
// Create element at 1080 wide (use as standard printing width)
|
|
121
|
-
const elem =
|
|
118
|
+
const elem = (react_1.default.createElement("div", { style: { width: 1080 } },
|
|
119
|
+
react_1.default.createElement(DashboardViewComponent, { ...props, onDesignChange: undefined, printMode: true })));
|
|
122
120
|
const printer = new ReactElementPrinter_1.default();
|
|
123
121
|
await printer.print(elem, { delay: 5000 });
|
|
124
122
|
}
|
|
@@ -126,109 +124,88 @@ class DashboardViewComponent extends react_1.default.Component {
|
|
|
126
124
|
(0, vectorMaps_1.setPrintingModeEnabled)(false);
|
|
127
125
|
}
|
|
128
126
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
128
|
+
print
|
|
129
|
+
}));
|
|
130
|
+
const getCompiledFilters = () => {
|
|
131
|
+
let compiledFilters = DashboardUtils.getCompiledFilters(props.design, props.schema, DashboardUtils.getFilterableTables(props.design, props.schema));
|
|
132
|
+
compiledFilters = compiledFilters.concat(props.filters || []);
|
|
133
133
|
return compiledFilters;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
getTOCEntries(layoutManager) {
|
|
134
|
+
};
|
|
135
|
+
const getTOCEntries = (layoutManager) => {
|
|
137
136
|
const entries = [];
|
|
138
|
-
for (let { id, type, design } of layoutManager.getAllWidgets(
|
|
137
|
+
for (let { id, type, design } of layoutManager.getAllWidgets(props.design.items)) {
|
|
139
138
|
const widget = WidgetFactory_1.default.createWidget(type);
|
|
140
139
|
// Add widgetId to each one
|
|
141
|
-
for (let entry of widget.getTOCEntries(design,
|
|
140
|
+
for (let entry of widget.getTOCEntries(design, props.namedStrings)) {
|
|
142
141
|
entries.push(lodash_1.default.extend({}, entry, { widgetId: id }));
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
return entries;
|
|
146
|
-
}
|
|
147
|
-
handleScrollToTOCEntry = (widgetId, entryId) => {
|
|
148
|
-
const widgetComp =
|
|
145
|
+
};
|
|
146
|
+
const handleScrollToTOCEntry = (widgetId, entryId) => {
|
|
147
|
+
const widgetComp = widgetComps.current[widgetId];
|
|
149
148
|
if (!widgetComp) {
|
|
150
149
|
return;
|
|
151
150
|
}
|
|
152
151
|
// Call scrollToTOCEntry if present
|
|
153
152
|
return widgetComp.scrollToTOCEntry?.(entryId);
|
|
154
153
|
};
|
|
155
|
-
renderScopes() {
|
|
156
|
-
return
|
|
157
|
-
scopes: this.state.widgetScoper.getScopes(),
|
|
158
|
-
onRemoveScope: this.handleRemoveScope
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
compRef = (widgetId, comp) => {
|
|
162
|
-
return (this.widgetComps[widgetId] = comp);
|
|
154
|
+
const renderScopes = () => {
|
|
155
|
+
return (react_1.default.createElement(WidgetScopesViewComponent_1.default, { scopes: widgetScoper.getScopes(), onRemoveScope: handleRemoveScope }));
|
|
163
156
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
key: options.id,
|
|
190
|
-
id: options.id,
|
|
191
|
-
type: options.type,
|
|
192
|
-
schema: this.props.schema,
|
|
193
|
-
dataSource: this.props.dataSource,
|
|
194
|
-
dashboardDataSource: this.props.dashboardDataSource,
|
|
195
|
-
design: options.design,
|
|
196
|
-
scope: this.state.widgetScoper.getScope(options.id),
|
|
197
|
-
filters,
|
|
198
|
-
onScopeChange: this.handleScopeChange.bind(null, options.id),
|
|
199
|
-
onDesignChange: options.onDesignChange,
|
|
200
|
-
width: options.width,
|
|
201
|
-
height: options.height,
|
|
202
|
-
onRowClick: this.props.onRowClick,
|
|
203
|
-
namedStrings: this.props.namedStrings,
|
|
204
|
-
tocEntries,
|
|
205
|
-
onScrollToTOCEntry: this.handleScrollToTOCEntry,
|
|
206
|
-
// Keep references to widget elements
|
|
207
|
-
widgetRef: this.compRef.bind(null, options.id),
|
|
208
|
-
refreshKey: this.props.refreshKey
|
|
209
|
-
});
|
|
210
|
-
return widgetElem;
|
|
211
|
-
};
|
|
212
|
-
const style = {
|
|
213
|
-
height: "100%",
|
|
214
|
-
position: "relative"
|
|
215
|
-
};
|
|
216
|
-
if (!this.props.printMode) {
|
|
217
|
-
// Prevent this block from taking up too much space. Scrolling handled by layout manager.
|
|
218
|
-
// Setting overflow-x stops the inner div from becoming too tall
|
|
219
|
-
style.overflowX = "auto";
|
|
157
|
+
const compRef = (widgetId, comp) => {
|
|
158
|
+
return (widgetComps.current[widgetId] = comp);
|
|
159
|
+
};
|
|
160
|
+
let cantPasteMessage = "";
|
|
161
|
+
const layoutManager = LayoutManager_1.default.createLayoutManager(props.design.layout);
|
|
162
|
+
const compiledFilters = getCompiledFilters();
|
|
163
|
+
// Get filterable tables
|
|
164
|
+
const filterableTables = DashboardUtils.getFilterableTables(props.design, props.schema);
|
|
165
|
+
// Determine toc entries
|
|
166
|
+
const tocEntries = getTOCEntries(layoutManager);
|
|
167
|
+
// Get clipboard contents
|
|
168
|
+
const clipboardContents = getClipboardContents();
|
|
169
|
+
// Check if can't paste because of missing table
|
|
170
|
+
if (clipboardContents && !lodash_1.default.all(clipboardContents.tables, (table) => props.schema.getTable(table))) {
|
|
171
|
+
cantPasteMessage = "Dashboard is missing one or more data sources needed for the copied item.";
|
|
172
|
+
}
|
|
173
|
+
const renderWidget = (options) => {
|
|
174
|
+
const widgetDataSource = widgetDataSourcePrioritizer.getWidgetDataSource(options.type, options.id, options.priority ?? 0);
|
|
175
|
+
// Get filters (passed in plus dashboard widget scoper filters)
|
|
176
|
+
let filters = compiledFilters.concat(widgetScoper.getFilters(options.id));
|
|
177
|
+
// Extend the filters to include implicit filters (filter children in 1-n relationships)
|
|
178
|
+
if (props.design.implicitFiltersEnabled || props.design.implicitFiltersEnabled == null) {
|
|
179
|
+
// Default is true
|
|
180
|
+
const implicitFilterBuilder = new ImplicitFilterBuilder_1.default(props.schema);
|
|
181
|
+
filters = implicitFilterBuilder.extendFilters(filterableTables, filters);
|
|
220
182
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
183
|
+
const widgetElem = (react_1.default.createElement(WidgetComponent_1.WidgetComponent, { key: options.id, id: options.id, type: options.type, schema: props.schema, dataSource: props.dataSource, widgetDataSource: widgetDataSource, design: options.design, scope: widgetScoper.getScope(options.id), filters: filters, onScopeChange: handleScopeChange.bind(null, options.id), onDesignChange: options.onDesignChange, width: options.width, height: options.height, onRowClick: props.onRowClick, namedStrings: props.namedStrings, tocEntries: tocEntries, onScrollToTOCEntry: handleScrollToTOCEntry,
|
|
184
|
+
// Keep references to widget elements
|
|
185
|
+
widgetRef: compRef.bind(null, options.id), refreshKey: props.refreshKey }));
|
|
186
|
+
return widgetElem;
|
|
187
|
+
};
|
|
188
|
+
const style = {
|
|
189
|
+
height: "100%",
|
|
190
|
+
position: "relative"
|
|
191
|
+
};
|
|
192
|
+
if (!props.printMode) {
|
|
193
|
+
// Prevent this block from taking up too much space. Scrolling handled by layout manager.
|
|
194
|
+
// Setting overflow-x stops the inner div from becoming too tall
|
|
195
|
+
style.overflowX = "auto";
|
|
232
196
|
}
|
|
233
|
-
|
|
197
|
+
// Render widget container
|
|
198
|
+
return (react_1.default.createElement(contexts_1.LocaleContext.Provider, { value: props.design.locale ?? "en" },
|
|
199
|
+
react_1.default.createElement("div", { style: style },
|
|
200
|
+
!props.hideScopes ? renderScopes() : undefined,
|
|
201
|
+
layoutManager.renderLayout({
|
|
202
|
+
items: props.design.items,
|
|
203
|
+
onItemsChange: props.onDesignChange != null ? handleItemsChange : undefined,
|
|
204
|
+
layoutOptions: (0, layoutOptions_1.getLayoutOptions)(props.design),
|
|
205
|
+
renderWidget,
|
|
206
|
+
clipboard: clipboardContents?.block,
|
|
207
|
+
onClipboardChange: handleClipboardChange,
|
|
208
|
+
cantPasteMessage
|
|
209
|
+
}))));
|
|
210
|
+
});
|
|
234
211
|
exports.default = DashboardViewComponent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FontStyle } from "./layoutOptions";
|
|
3
|
+
interface FontStyleEditorProps {
|
|
4
|
+
value: FontStyle;
|
|
5
|
+
onChange: (value: FontStyle) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const FontStyleEditor: ({ value, onChange }: FontStyleEditorProps) => React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.FontStyleEditor = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const ActionCancelModalComponent_1 = __importDefault(require("@mwater/react-library/lib/ActionCancelModalComponent"));
|
|
32
|
+
const layoutOptions_1 = require("./layoutOptions");
|
|
33
|
+
const react_select_1 = __importDefault(require("react-select"));
|
|
34
|
+
const bootstrap_1 = require("@mwater/react-library/lib/bootstrap");
|
|
35
|
+
const ColorComponent_1 = __importDefault(require("../ColorComponent"));
|
|
36
|
+
const FontStyleEditor = ({ value, onChange }) => {
|
|
37
|
+
const [isModalOpen, setIsModalOpen] = (0, react_1.useState)(false);
|
|
38
|
+
const handleOpenModal = () => setIsModalOpen(true);
|
|
39
|
+
const handleCloseModal = () => setIsModalOpen(false);
|
|
40
|
+
const handleSave = (newValue) => {
|
|
41
|
+
onChange(newValue);
|
|
42
|
+
handleCloseModal();
|
|
43
|
+
};
|
|
44
|
+
return react_1.default.createElement(react_1.default.Fragment, null,
|
|
45
|
+
react_1.default.createElement("div", { style: { display: 'flex', alignItems: 'center', cursor: 'pointer', border: 'solid 1px #DDD', padding: '4px', borderRadius: '6px', justifyContent: 'space-between' }, onClick: handleOpenModal },
|
|
46
|
+
react_1.default.createElement("div", { style: {
|
|
47
|
+
fontFamily: (0, layoutOptions_1.expandFontFamily)(value.family),
|
|
48
|
+
fontSize: `${value.size}px`,
|
|
49
|
+
fontWeight: value.weight,
|
|
50
|
+
color: value.color
|
|
51
|
+
} }, "Sample"),
|
|
52
|
+
react_1.default.createElement("div", { style: { fontSize: '10px', color: '#888', marginTop: '2px' } },
|
|
53
|
+
value.family,
|
|
54
|
+
", ",
|
|
55
|
+
value.size,
|
|
56
|
+
"px")),
|
|
57
|
+
isModalOpen && (react_1.default.createElement(FontEditorModal, { initialValue: value, onSave: handleSave, onCancel: handleCloseModal })));
|
|
58
|
+
};
|
|
59
|
+
exports.FontStyleEditor = FontStyleEditor;
|
|
60
|
+
const FontEditorModal = ({ initialValue, onSave, onCancel }) => {
|
|
61
|
+
const [currentValue, setCurrentValue] = (0, react_1.useState)(initialValue);
|
|
62
|
+
const handleChange = (field, value) => {
|
|
63
|
+
if (field == "family") {
|
|
64
|
+
setCurrentValue(prev => ({ ...prev, [field]: value, weight: "400" }));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
setCurrentValue(prev => ({ ...prev, [field]: value }));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
// Generate font size options from 5 to 48
|
|
71
|
+
const fontSizeOptions = Array.from({ length: 44 }, (_, i) => i + 5).map(size => ({
|
|
72
|
+
value: size,
|
|
73
|
+
label: `${size}px`
|
|
74
|
+
}));
|
|
75
|
+
// If the font is variable, then the font weight options are much wider
|
|
76
|
+
const fontWeightOptions = [];
|
|
77
|
+
if (currentValue.family === "Roboto") {
|
|
78
|
+
fontWeightOptions.push("100", "300", "400", "500", "700", "900");
|
|
79
|
+
}
|
|
80
|
+
else if (currentValue.family === "Lora") {
|
|
81
|
+
fontWeightOptions.push("400", "500", "600", "700");
|
|
82
|
+
}
|
|
83
|
+
else if (currentValue.family === "Inter") {
|
|
84
|
+
fontWeightOptions.push("100", "200", "300", "400", "500", "600", "700", "800", "900");
|
|
85
|
+
}
|
|
86
|
+
else if (currentValue.family === "Merriweather") {
|
|
87
|
+
fontWeightOptions.push("300", "400", "700", "900");
|
|
88
|
+
}
|
|
89
|
+
else if (currentValue.family === "Lato") {
|
|
90
|
+
fontWeightOptions.push("100", "300", "400", "700", "900");
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
fontWeightOptions.push("400", "700");
|
|
94
|
+
}
|
|
95
|
+
return (react_1.default.createElement(ActionCancelModalComponent_1.default, { title: "Edit Font", onAction: () => onSave(currentValue), onCancel: onCancel },
|
|
96
|
+
react_1.default.createElement("div", { style: {
|
|
97
|
+
border: '1px solid #ccc',
|
|
98
|
+
padding: '10px',
|
|
99
|
+
marginBottom: '15px',
|
|
100
|
+
borderRadius: '4px'
|
|
101
|
+
} },
|
|
102
|
+
react_1.default.createElement("div", { style: {
|
|
103
|
+
marginBottom: '10px',
|
|
104
|
+
fontSize: '14px',
|
|
105
|
+
fontWeight: 'bold'
|
|
106
|
+
} }, "Sample Text:"),
|
|
107
|
+
react_1.default.createElement("div", { style: {
|
|
108
|
+
fontFamily: (0, layoutOptions_1.expandFontFamily)(currentValue.family),
|
|
109
|
+
fontSize: `${currentValue.size}px`,
|
|
110
|
+
fontWeight: currentValue.weight,
|
|
111
|
+
color: currentValue.color
|
|
112
|
+
} }, "The quick brown fox jumps over the lazy dog.")),
|
|
113
|
+
react_1.default.createElement(bootstrap_1.FormGroup, { label: "Font Family" },
|
|
114
|
+
react_1.default.createElement(react_select_1.default, { value: { value: currentValue.family, label: currentValue.family }, onChange: (option) => handleChange('family', option?.value || ''), options: [
|
|
115
|
+
{ value: 'Helvetica Neue', label: 'Helvetica Neue' },
|
|
116
|
+
{ value: 'Georgia', label: 'Georgia' },
|
|
117
|
+
{ value: 'Inter', label: 'Inter' },
|
|
118
|
+
{ value: 'Lato', label: 'Lato' },
|
|
119
|
+
{ value: 'Lora', label: 'Lora' },
|
|
120
|
+
{ value: 'Lucida Grande', label: 'Lucida Grande' },
|
|
121
|
+
{ value: 'Merriweather', label: 'Merriweather' },
|
|
122
|
+
{ value: 'Roboto', label: 'Roboto' },
|
|
123
|
+
], formatOptionLabel: (option) => (react_1.default.createElement("span", { style: { fontFamily: (0, layoutOptions_1.expandFontFamily)(option.value) } }, option.label)), isClearable: false, menuPortalTarget: document.body, styles: { menuPortal: (style) => ({ ...style, zIndex: 2000 }) } })),
|
|
124
|
+
react_1.default.createElement(bootstrap_1.FormGroup, { label: "Font Size:", horizontal: true },
|
|
125
|
+
react_1.default.createElement(bootstrap_1.Select, { value: currentValue.size, onChange: (value) => handleChange('size', value || 12), options: fontSizeOptions })),
|
|
126
|
+
react_1.default.createElement(bootstrap_1.FormGroup, { label: "Font Weight:", horizontal: true },
|
|
127
|
+
react_1.default.createElement(bootstrap_1.Select, { value: currentValue.weight, onChange: (value) => handleChange('weight', value), options: fontWeightOptions.map(weight => ({ value: weight, label: weight })) })),
|
|
128
|
+
react_1.default.createElement(bootstrap_1.FormGroup, { label: "Font Color:", horizontal: true },
|
|
129
|
+
react_1.default.createElement(ColorComponent_1.default, { color: currentValue.color, onChange: (value) => handleChange('color', value), disableReset: true }))));
|
|
130
|
+
};
|
|
@@ -3,7 +3,6 @@ import { DashboardDesign } from "./DashboardDesign";
|
|
|
3
3
|
export declare function LayoutOptionsComponent(props: {
|
|
4
4
|
design: DashboardDesign;
|
|
5
5
|
onDesignChange: (design: DashboardDesign) => void;
|
|
6
|
-
onClose: () => void;
|
|
7
6
|
/** Dashboard view to preview*/
|
|
8
7
|
dashboardView: ReactNode;
|
|
9
8
|
/** Quickfilters to preview */
|