@mwater/visualization 5.1.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ColorComponent.d.ts +10 -11
- package/lib/ColorComponent.js +78 -29
- package/lib/ColorSchemeFactory.d.ts +13 -2
- package/lib/ColorSchemeFactory.js +7 -5
- package/lib/CustomColorsContext.d.ts +6 -0
- package/lib/CustomColorsContext.js +6 -0
- package/lib/FiltersDesignerComponent.d.ts +1 -4
- package/lib/FiltersDesignerComponent.js +2 -3
- package/lib/GlobalFilter.d.ts +13 -0
- package/lib/GlobalFilter.js +2 -0
- 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 +7 -25
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +19 -9
- package/lib/MWaterContextComponent.js +38 -22
- package/lib/MWaterCustomTablesetListComponent.js +9 -3
- package/lib/MWaterGlobalFiltersComponent.d.ts +6 -5
- package/lib/MWaterGlobalFiltersComponent.js +4 -4
- package/lib/MWaterLoaderComponent.d.ts +15 -3
- package/lib/MWaterLoaderComponent.js +11 -2
- 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/Axis.d.ts +20 -25
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +12 -8
- package/lib/axes/AxisComponent.d.ts +6 -9
- 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 -17
- package/lib/dashboards/DashboardComponent.js +20 -67
- package/lib/dashboards/DashboardDesign.d.ts +5 -20
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +112 -136
- 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 +209 -39
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/SettingsModalComponent.d.ts +4 -15
- package/lib/dashboards/SettingsModalComponent.js +24 -38
- 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/DatagridComponent.d.ts +2 -9
- package/lib/datagrids/DatagridDataSource.d.ts +3 -3
- package/lib/datagrids/DatagridDataSource.js +0 -14
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -93
- package/lib/datagrids/DatagridDesignerComponent.js +8 -6
- package/lib/datagrids/DatagridViewComponent.js +1 -1
- package/lib/datagrids/FindReplaceModalComponent.d.ts +4 -20
- package/lib/datagrids/FindReplaceModalComponent.js +27 -13
- package/lib/datagrids/ServerDatagridDataSource.d.ts +8 -7
- package/lib/datagrids/ServerDatagridDataSource.js +88 -36
- package/lib/demo.js +4 -4
- package/lib/index.css +5 -0
- package/lib/index.d.ts +2 -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 -56
- 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/layouts/grid/GridLayoutManager.d.ts +2 -1
- 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 +5 -2
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/ClusterLayer.js +3 -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/GridLayer.js +5 -3
- package/lib/maps/GridLayerDesigner.js +0 -1
- package/lib/maps/LayerSwitcherComponent.js +1 -1
- package/lib/maps/MapComponent.d.ts +3 -11
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MapDesign.d.ts +2 -13
- package/lib/maps/MapFiltersDesignerComponent.d.ts +0 -4
- package/lib/maps/MapFiltersDesignerComponent.js +4 -5
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +3 -13
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/RegionSelectComponent.d.ts +2 -1
- package/lib/maps/ServerMapDataSource.d.ts +3 -4
- 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.d.ts +1 -0
- package/lib/maps/vectorMaps.js +70 -56
- package/lib/quickfilter/QuickfilterCompiler.d.ts +1 -1
- 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 +3 -11
- package/lib/widgets/ImageWidgetComponent.d.ts +8 -27
- package/lib/widgets/MapWidget.d.ts +4 -7
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/MarkdownWidget.d.ts +2 -7
- package/lib/widgets/TOCWidget.d.ts +2 -9
- 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 -74
- 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/imagemosaic/ImagePopupComponent.d.ts +2 -7
- 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 +5 -31
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -7
- 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 -105
- 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 +11 -7
- 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 -47
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +55 -58
- 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 +30 -16
- package/lib/widgets/text/ExprInsertModalComponent.d.ts +2 -13
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +2 -13
- 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 +16 -2
- package/lib/widgets/text/TextWidgetDesign.js +6 -0
- package/package.json +4 -4
- package/src/ColorComponent.tsx +177 -0
- package/src/ColorSchemeFactory.ts +12 -6
- package/src/CustomColorsContext.tsx +8 -0
- package/src/FiltersDesignerComponent.ts +3 -4
- package/src/GlobalFilter.ts +17 -0
- 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 +42 -33
- package/src/MWaterCustomTablesetListComponent.tsx +21 -3
- package/src/MWaterGlobalFiltersComponent.ts +8 -8
- package/src/MWaterLoaderComponent.ts +14 -4
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/Axis.ts +24 -25
- package/src/axes/AxisBuilder.ts +16 -13
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +73 -147
- package/src/dashboards/DashboardDesign.ts +5 -25
- 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 +377 -71
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/SettingsModalComponent.tsx +170 -0
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDataSource.ts +6 -12
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/DatagridDesignerComponent.tsx +22 -18
- package/src/datagrids/DatagridViewComponent.ts +3 -3
- package/src/datagrids/ExprCellComponent.ts +0 -1
- package/src/datagrids/FindReplaceModalComponent.ts +39 -22
- package/src/datagrids/ServerDatagridDataSource.ts +107 -45
- package/src/demo.ts +4 -4
- package/src/index.css +5 -0
- package/src/index.ts +2 -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 +5 -2
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/ClusterLayer.ts +3 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/GridLayer.ts +5 -3
- package/src/maps/GridLayerDesigner.tsx +0 -1
- package/src/maps/LayerSwitcherComponent.tsx +1 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MapDesign.ts +2 -17
- package/src/maps/{MapFiltersDesignerComponent.ts → MapFiltersDesignerComponent.tsx} +25 -25
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +8 -8
- package/src/maps/VectorMapViewComponent.tsx +2 -2
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +88 -74
- package/src/quickfilter/QuickfilterCompiler.ts +1 -1
- 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 +32 -19
- 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 +26 -2
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -304
- package/src/dashboards/SettingsModalComponent.ts +0 -169
- 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
|
@@ -26,10 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
30
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
31
30
|
const react_1 = __importDefault(require("react"));
|
|
32
|
-
const R = react_1.default.createElement;
|
|
33
31
|
const ActionCancelModalComponent_1 = __importDefault(require("@mwater/react-library/lib/ActionCancelModalComponent"));
|
|
34
32
|
const TextComponent_1 = __importDefault(require("../../text/TextComponent"));
|
|
35
33
|
const PivotChartUtils = __importStar(require("./PivotChartUtils"));
|
|
@@ -37,9 +35,10 @@ const PivotChartLayoutComponent_1 = __importDefault(require("./PivotChartLayoutC
|
|
|
37
35
|
const PivotChartLayoutBuilder_1 = __importDefault(require("./PivotChartLayoutBuilder"));
|
|
38
36
|
const SegmentDesignerComponent_1 = __importDefault(require("./SegmentDesignerComponent"));
|
|
39
37
|
const IntersectionDesignerComponent_1 = __importDefault(require("./IntersectionDesignerComponent"));
|
|
38
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
40
39
|
// Displays a pivot chart
|
|
41
40
|
class PivotChartViewComponent extends react_1.default.Component {
|
|
42
|
-
static
|
|
41
|
+
static contextType = contexts_1.LocaleContext;
|
|
43
42
|
constructor(props) {
|
|
44
43
|
super(props);
|
|
45
44
|
this.state = {
|
|
@@ -128,78 +127,39 @@ class PivotChartViewComponent extends react_1.default.Component {
|
|
|
128
127
|
return this.props.onDesignChange(design);
|
|
129
128
|
};
|
|
130
129
|
renderHeader() {
|
|
131
|
-
return
|
|
132
|
-
design: this.props.design.header,
|
|
133
|
-
onDesignChange: this.props.onDesignChange ? this.handleHeaderChange : undefined,
|
|
134
|
-
schema: this.props.schema,
|
|
135
|
-
dataSource: this.props.dataSource,
|
|
136
|
-
exprValues: this.props.data.header || {},
|
|
137
|
-
width: this.props.width
|
|
138
|
-
}));
|
|
130
|
+
return (react_1.default.createElement("div", { style: { paddingLeft: 10, paddingRight: 10 } },
|
|
131
|
+
react_1.default.createElement(TextComponent_1.default, { design: this.props.design.header, onDesignChange: this.props.onDesignChange ? this.handleHeaderChange : undefined, schema: this.props.schema, dataSource: this.props.dataSource, exprValues: this.props.data.header || {}, width: this.props.width })));
|
|
139
132
|
}
|
|
140
133
|
renderFooter() {
|
|
141
|
-
return
|
|
142
|
-
design: this.props.design.footer,
|
|
143
|
-
onDesignChange: this.props.onDesignChange ? this.handleFooterChange : undefined,
|
|
144
|
-
schema: this.props.schema,
|
|
145
|
-
dataSource: this.props.dataSource,
|
|
146
|
-
exprValues: this.props.data.footer || {},
|
|
147
|
-
width: this.props.width
|
|
148
|
-
}));
|
|
134
|
+
return (react_1.default.createElement("div", { style: { paddingLeft: 10, paddingRight: 10 } },
|
|
135
|
+
react_1.default.createElement(TextComponent_1.default, { design: this.props.design.footer, onDesignChange: this.props.onDesignChange ? this.handleFooterChange : undefined, schema: this.props.schema, dataSource: this.props.dataSource, exprValues: this.props.data.footer || {}, width: this.props.width })));
|
|
149
136
|
}
|
|
150
137
|
renderEditSegmentModal() {
|
|
151
138
|
if (!this.state.editSegment) {
|
|
152
|
-
return;
|
|
139
|
+
return null;
|
|
153
140
|
}
|
|
154
141
|
const segmentType = PivotChartUtils.findSegment(this.props.design.rows, this.state.editSegment.id)
|
|
155
142
|
? "row"
|
|
156
143
|
: "column";
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
onAction: this.handleSaveEditSegment,
|
|
160
|
-
onCancel: this.handleCancelEditSegment,
|
|
161
|
-
size: "large"
|
|
162
|
-
}, R(SegmentDesignerComponent_1.default, {
|
|
163
|
-
segment: this.state.editSegment,
|
|
164
|
-
table: this.props.design.table,
|
|
165
|
-
schema: this.props.schema,
|
|
166
|
-
dataSource: this.props.dataSource,
|
|
167
|
-
segmentType,
|
|
168
|
-
onChange: (segment) => this.setState({ editSegment: segment }),
|
|
169
|
-
filters: this.props.filters
|
|
170
|
-
}));
|
|
144
|
+
return (react_1.default.createElement(ActionCancelModalComponent_1.default, { title: `Edit ${segmentType}`, onAction: this.handleSaveEditSegment, onCancel: this.handleCancelEditSegment, size: "large" },
|
|
145
|
+
react_1.default.createElement(SegmentDesignerComponent_1.default, { segment: this.state.editSegment, table: this.props.design.table, schema: this.props.schema, dataSource: this.props.dataSource, segmentType: segmentType, onChange: (segment) => this.setState({ editSegment: segment }), filters: this.props.filters })));
|
|
171
146
|
}
|
|
172
147
|
renderEditIntersectionModal() {
|
|
173
148
|
if (!this.state.editIntersectionId) {
|
|
174
|
-
return;
|
|
149
|
+
return null;
|
|
175
150
|
}
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
onAction: this.handleSaveEditIntersection,
|
|
179
|
-
onCancel: this.handleCancelEditIntersection,
|
|
180
|
-
size: "large"
|
|
181
|
-
}, R(IntersectionDesignerComponent_1.default, {
|
|
182
|
-
intersection: this.state.editIntersection,
|
|
183
|
-
table: this.props.design.table,
|
|
184
|
-
schema: this.props.schema,
|
|
185
|
-
dataSource: this.props.dataSource,
|
|
186
|
-
onChange: (intersection) => this.setState({ editIntersection: intersection }),
|
|
187
|
-
filters: this.props.filters
|
|
188
|
-
}));
|
|
151
|
+
return (react_1.default.createElement(ActionCancelModalComponent_1.default, { title: "Edit Value", onAction: this.handleSaveEditIntersection, onCancel: this.handleCancelEditIntersection, size: "large" },
|
|
152
|
+
react_1.default.createElement(IntersectionDesignerComponent_1.default, { design: this.props.design, intersectionId: this.state.editIntersectionId, intersection: this.state.editIntersection, table: this.props.design.table, schema: this.props.schema, dataSource: this.props.dataSource, onChange: (intersection) => this.setState({ editIntersection: intersection }), filters: this.props.filters })));
|
|
189
153
|
}
|
|
190
154
|
render() {
|
|
191
|
-
const layout = new PivotChartLayoutBuilder_1.default({ schema: this.props.schema }).buildLayout(this.props.design, this.props.data, this.context
|
|
192
|
-
return
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
onInsertAfterSegment: this.props.onDesignChange != null ? this.handleInsertAfterSegment : undefined,
|
|
200
|
-
onAddChildSegment: this.props.onDesignChange != null ? this.handleAddChildSegment : undefined,
|
|
201
|
-
onSummarizeSegment: this.props.onDesignChange != null ? this.handleSummarizeSegment : undefined
|
|
202
|
-
})), this.renderFooter());
|
|
155
|
+
const layout = new PivotChartLayoutBuilder_1.default({ schema: this.props.schema }).buildLayout(this.props.design, this.props.data, this.context);
|
|
156
|
+
return (react_1.default.createElement("div", { style: { width: this.props.width, height: this.props.height } },
|
|
157
|
+
this.renderHeader(),
|
|
158
|
+
this.renderEditSegmentModal(),
|
|
159
|
+
this.renderEditIntersectionModal(),
|
|
160
|
+
react_1.default.createElement("div", { key: "layout", style: { margin: 5, marginTop: 12, overflowX: "auto", padding: 7 } },
|
|
161
|
+
react_1.default.createElement(PivotChartLayoutComponent_1.default, { layout: layout, editable: this.props.onDesignChange != null, onEditSection: this.props.onDesignChange != null ? this.handleEditSection : undefined, onRemoveSegment: this.props.onDesignChange != null ? this.handleRemoveSegment : undefined, onInsertBeforeSegment: this.props.onDesignChange != null ? this.handleInsertBeforeSegment : undefined, onInsertAfterSegment: this.props.onDesignChange != null ? this.handleInsertAfterSegment : undefined, onAddChildSegment: this.props.onDesignChange != null ? this.handleAddChildSegment : undefined, onSummarizeSegment: this.props.onDesignChange != null ? this.handleSummarizeSegment : undefined })),
|
|
162
|
+
this.renderFooter()));
|
|
203
163
|
}
|
|
204
164
|
}
|
|
205
165
|
exports.default = PivotChartViewComponent;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import * as ui from "@mwater/react-library/lib/bootstrap";
|
|
2
3
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
4
|
import { PivotChartSegment } from "./PivotChartDesign";
|
|
4
5
|
export interface SegmentDesignerComponentProps {
|
|
@@ -27,70 +28,66 @@ export default class SegmentDesignerComponent extends React.Component<SegmentDes
|
|
|
27
28
|
handleOrderExprChange: (orderExpr: any) => any;
|
|
28
29
|
handleOrderDirChange: (orderDir: any) => any;
|
|
29
30
|
renderMode(): React.CElement<{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
label: React.ReactNode;
|
|
32
|
+
labelMuted?: boolean | undefined;
|
|
33
|
+
hint?: React.ReactNode;
|
|
34
|
+
help?: React.ReactNode;
|
|
35
|
+
required?: boolean | undefined;
|
|
36
|
+
hasSuccess?: boolean | undefined;
|
|
37
|
+
hasWarnings?: boolean | undefined;
|
|
38
|
+
hasErrors?: boolean | undefined;
|
|
39
|
+
}, ui.FormGroup>;
|
|
36
40
|
renderLabel(): React.CElement<{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
label: React.ReactNode;
|
|
42
|
+
labelMuted?: boolean | undefined;
|
|
43
|
+
hint?: React.ReactNode;
|
|
44
|
+
help?: React.ReactNode;
|
|
45
|
+
required?: boolean | undefined;
|
|
46
|
+
hasSuccess?: boolean | undefined;
|
|
47
|
+
hasWarnings?: boolean | undefined;
|
|
48
|
+
hasErrors?: boolean | undefined;
|
|
49
|
+
}, ui.FormGroup>;
|
|
45
50
|
renderValueAxis(): React.JSX.Element;
|
|
46
51
|
renderFilter(): React.CElement<{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
label: (string | React.CElement<{
|
|
57
|
-
id: string;
|
|
58
|
-
}, React.Component<{
|
|
59
|
-
id: string;
|
|
60
|
-
}, any, any>>)[];
|
|
61
|
-
hint: string;
|
|
62
|
-
}, any, any>>;
|
|
52
|
+
label: React.ReactNode;
|
|
53
|
+
labelMuted?: boolean | undefined;
|
|
54
|
+
hint?: React.ReactNode;
|
|
55
|
+
help?: React.ReactNode;
|
|
56
|
+
required?: boolean | undefined;
|
|
57
|
+
hasSuccess?: boolean | undefined;
|
|
58
|
+
hasWarnings?: boolean | undefined;
|
|
59
|
+
hasErrors?: boolean | undefined;
|
|
60
|
+
}, ui.FormGroup>;
|
|
63
61
|
renderStyling(): React.CElement<{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
label: React.ReactNode;
|
|
63
|
+
labelMuted?: boolean | undefined;
|
|
64
|
+
hint?: React.ReactNode;
|
|
65
|
+
help?: React.ReactNode;
|
|
66
|
+
required?: boolean | undefined;
|
|
67
|
+
hasSuccess?: boolean | undefined;
|
|
68
|
+
hasWarnings?: boolean | undefined;
|
|
69
|
+
hasErrors?: boolean | undefined;
|
|
70
|
+
}, ui.FormGroup>;
|
|
70
71
|
renderBorders(): React.CElement<{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
label: React.ReactNode;
|
|
73
|
+
labelMuted?: boolean | undefined;
|
|
74
|
+
hint?: React.ReactNode;
|
|
75
|
+
help?: React.ReactNode;
|
|
76
|
+
required?: boolean | undefined;
|
|
77
|
+
hasSuccess?: boolean | undefined;
|
|
78
|
+
hasWarnings?: boolean | undefined;
|
|
79
|
+
hasErrors?: boolean | undefined;
|
|
80
|
+
}, ui.FormGroup>;
|
|
77
81
|
renderOrderExpr(): React.CElement<{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
label: (string | React.CElement<{
|
|
88
|
-
id: string;
|
|
89
|
-
}, React.Component<{
|
|
90
|
-
id: string;
|
|
91
|
-
}, any, any>>)[];
|
|
92
|
-
hint: string;
|
|
93
|
-
}, any, any>>;
|
|
82
|
+
label: React.ReactNode;
|
|
83
|
+
labelMuted?: boolean | undefined;
|
|
84
|
+
hint?: React.ReactNode;
|
|
85
|
+
help?: React.ReactNode;
|
|
86
|
+
required?: boolean | undefined;
|
|
87
|
+
hasSuccess?: boolean | undefined;
|
|
88
|
+
hasWarnings?: boolean | undefined;
|
|
89
|
+
hasErrors?: boolean | undefined;
|
|
90
|
+
}, ui.FormGroup>;
|
|
94
91
|
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
95
92
|
}
|
|
96
93
|
export {};
|
|
@@ -149,10 +149,14 @@ class TableChart extends Chart_1.default {
|
|
|
149
149
|
// Convert to 4326 (lat/long). Force ::geometry for null
|
|
150
150
|
compiledExpr = {
|
|
151
151
|
type: "op",
|
|
152
|
-
op: "
|
|
153
|
-
exprs: [
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
op: "::jsonb",
|
|
153
|
+
exprs: [{
|
|
154
|
+
type: "op",
|
|
155
|
+
op: "ST_AsGeoJSON",
|
|
156
|
+
exprs: [
|
|
157
|
+
{ type: "op", op: "ST_Transform", exprs: [{ type: "op", op: "::geometry", exprs: [compiledExpr] }, 4326] }
|
|
158
|
+
]
|
|
159
|
+
}]
|
|
156
160
|
};
|
|
157
161
|
}
|
|
158
162
|
query.selects.push({
|
|
@@ -26,7 +26,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
30
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
31
30
|
const react_1 = __importDefault(require("react"));
|
|
32
31
|
const R = react_1.default.createElement;
|
|
@@ -42,6 +41,7 @@ const ui = __importStar(require("@mwater/react-library/lib/bootstrap"));
|
|
|
42
41
|
const valueFormatter_1 = require("../../../valueFormatter");
|
|
43
42
|
const valueFormatter_2 = require("../../../valueFormatter");
|
|
44
43
|
const AxisComponent_1 = __importDefault(require("../../../axes/AxisComponent"));
|
|
44
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
45
45
|
class TableChartDesignerComponent extends react_1.default.Component {
|
|
46
46
|
// Updates design with the specified changes
|
|
47
47
|
updateDesign(changes) {
|
|
@@ -173,7 +173,7 @@ class TableChartDesignerComponent extends react_1.default.Component {
|
|
|
173
173
|
}
|
|
174
174
|
exports.default = TableChartDesignerComponent;
|
|
175
175
|
class TableChartColumnDesignerComponent extends react_1.default.Component {
|
|
176
|
-
static
|
|
176
|
+
static contextType = contexts_1.LocaleContext;
|
|
177
177
|
// Updates column with the specified changes
|
|
178
178
|
updateColumn(changes) {
|
|
179
179
|
const column = lodash_1.default.extend({}, this.props.design.columns[this.props.index], changes);
|
|
@@ -235,7 +235,7 @@ class TableChartColumnDesignerComponent extends react_1.default.Component {
|
|
|
235
235
|
renderHeader() {
|
|
236
236
|
const column = this.props.design.columns[this.props.index];
|
|
237
237
|
const axisBuilder = new AxisBuilder_1.default({ schema: this.props.schema });
|
|
238
|
-
const placeholder = column.textAxis ? axisBuilder.summarizeAxis(column.textAxis ?? null, this.context
|
|
238
|
+
const placeholder = column.textAxis ? axisBuilder.summarizeAxis(column.textAxis ?? null, this.context) : "";
|
|
239
239
|
return R("div", null, R("label", { className: "text-muted" }, "Header"), ": ", R("input", {
|
|
240
240
|
type: "text",
|
|
241
241
|
className: "form-control form-control-sm",
|
|
@@ -3,7 +3,6 @@ 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
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
7
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const react_1 = __importDefault(require("react"));
|
|
9
8
|
const R = react_1.default.createElement;
|
|
@@ -12,6 +11,7 @@ const AxisBuilder_1 = __importDefault(require("../../../axes/AxisBuilder"));
|
|
|
12
11
|
const expressions_1 = require("@mwater/expressions");
|
|
13
12
|
const valueFormatter_1 = require("../../../valueFormatter");
|
|
14
13
|
const color_1 = __importDefault(require("color"));
|
|
14
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
15
15
|
class TableChartViewComponent extends react_1.default.Component {
|
|
16
16
|
shouldComponentUpdate(prevProps) {
|
|
17
17
|
return !lodash_1.default.isEqual(prevProps, this.props);
|
|
@@ -33,7 +33,7 @@ class TableChartViewComponent extends react_1.default.Component {
|
|
|
33
33
|
}
|
|
34
34
|
exports.default = TableChartViewComponent;
|
|
35
35
|
class TableContentsComponent extends react_1.default.Component {
|
|
36
|
-
static
|
|
36
|
+
static contextType = contexts_1.LocaleContext;
|
|
37
37
|
constructor(props) {
|
|
38
38
|
super(props);
|
|
39
39
|
this.state = {
|
|
@@ -89,7 +89,7 @@ class TableContentsComponent extends react_1.default.Component {
|
|
|
89
89
|
const axisBuilder = new AxisBuilder_1.default({ schema: this.props.schema });
|
|
90
90
|
const column = this.props.columns[index];
|
|
91
91
|
//(this.state.sort?.direction === 'asc' ? "":"")
|
|
92
|
-
const text = column.headerText ?? (column.textAxis ? axisBuilder.summarizeAxis(column.textAxis, this.context
|
|
92
|
+
const text = column.headerText ?? (column.textAxis ? axisBuilder.summarizeAxis(column.textAxis, this.context) : "");
|
|
93
93
|
return R("th", {
|
|
94
94
|
key: index,
|
|
95
95
|
style: { cursor: "pointer" },
|
|
@@ -124,7 +124,7 @@ class TableContentsComponent extends react_1.default.Component {
|
|
|
124
124
|
}
|
|
125
125
|
renderImage(id) {
|
|
126
126
|
const url = this.props.dataSource.getImageUrl(id);
|
|
127
|
-
return R("a", { href: url, key: id, target: "_blank", style: { paddingLeft: 5, paddingRight: 5 } }, "Image");
|
|
127
|
+
return R("a", { href: url, onClick: (e) => { e.stopPropagation(); }, key: id, target: "_blank", style: { paddingLeft: 5, paddingRight: 5 } }, "Image");
|
|
128
128
|
}
|
|
129
129
|
renderCell(rowIndex, columnIndex) {
|
|
130
130
|
const axisBuilder = new AxisBuilder_1.default({ schema: this.props.schema });
|
|
@@ -133,7 +133,7 @@ class TableContentsComponent extends react_1.default.Component {
|
|
|
133
133
|
const column = this.props.columns[columnIndex];
|
|
134
134
|
// Set background color
|
|
135
135
|
let backgroundColor = "transparent";
|
|
136
|
-
let textColor = "
|
|
136
|
+
let textColor = "inherit";
|
|
137
137
|
const exprUtils = new expressions_1.ExprUtils(this.props.schema);
|
|
138
138
|
if (!column.textAxis) {
|
|
139
139
|
node = null;
|
|
@@ -142,6 +142,9 @@ class TableContentsComponent extends react_1.default.Component {
|
|
|
142
142
|
const exprType = exprUtils.getExprType(column.textAxis.expr);
|
|
143
143
|
// Get value
|
|
144
144
|
let value = row[`c${columnIndex}`];
|
|
145
|
+
if (column.backgroundColorAxis) {
|
|
146
|
+
backgroundColor = axisBuilder.getValueColor(column.backgroundColorAxis, row[`bc${columnIndex}`]) ?? "#fff";
|
|
147
|
+
}
|
|
145
148
|
if (value == null) {
|
|
146
149
|
node = null;
|
|
147
150
|
}
|
|
@@ -156,13 +159,12 @@ class TableContentsComponent extends react_1.default.Component {
|
|
|
156
159
|
value = null;
|
|
157
160
|
}
|
|
158
161
|
}
|
|
159
|
-
if (column.backgroundColorAxis && row[`bc${columnIndex}`] != null) {
|
|
160
|
-
backgroundColor = axisBuilder.getValueColor(column.backgroundColorAxis, row[`bc${columnIndex}`]) ?? "#fff";
|
|
161
|
-
}
|
|
162
162
|
// Convert to node based on type
|
|
163
163
|
switch (exprType) {
|
|
164
164
|
case "text":
|
|
165
|
-
|
|
165
|
+
if (lodash_1.default.isString(value)) {
|
|
166
|
+
node = R(react_linkify_1.default, { properties: { target: "_blank" } }, value);
|
|
167
|
+
}
|
|
166
168
|
break;
|
|
167
169
|
case "number":
|
|
168
170
|
case "geometry":
|
|
@@ -170,21 +172,33 @@ class TableContentsComponent extends react_1.default.Component {
|
|
|
170
172
|
break;
|
|
171
173
|
case "boolean":
|
|
172
174
|
case "enum":
|
|
175
|
+
node = exprUtils.stringifyExprLiteral(column.textAxis?.expr, value, this.context);
|
|
176
|
+
break;
|
|
173
177
|
case "enumset":
|
|
174
178
|
case "text[]":
|
|
175
|
-
|
|
179
|
+
if (lodash_1.default.isArray(value)) {
|
|
180
|
+
node = exprUtils.stringifyExprLiteral(column.textAxis?.expr, value, this.context);
|
|
181
|
+
}
|
|
176
182
|
break;
|
|
177
183
|
case "date":
|
|
178
|
-
|
|
184
|
+
if (lodash_1.default.isString(value)) {
|
|
185
|
+
node = (0, valueFormatter_1.formatValue)(exprType, value, column.format);
|
|
186
|
+
}
|
|
179
187
|
break;
|
|
180
188
|
case "datetime":
|
|
181
|
-
|
|
189
|
+
if (lodash_1.default.isString(value)) {
|
|
190
|
+
node = (0, valueFormatter_1.formatValue)(exprType, value, column.format);
|
|
191
|
+
}
|
|
182
192
|
break;
|
|
183
193
|
case "image":
|
|
184
|
-
|
|
194
|
+
if (lodash_1.default.isObject(value) && value.id != null) {
|
|
195
|
+
node = this.renderImage(value.id);
|
|
196
|
+
}
|
|
185
197
|
break;
|
|
186
198
|
case "imagelist":
|
|
187
|
-
|
|
199
|
+
if (lodash_1.default.isArray(value)) {
|
|
200
|
+
node = lodash_1.default.map(value, (v) => this.renderImage(v.id));
|
|
201
|
+
}
|
|
188
202
|
break;
|
|
189
203
|
default:
|
|
190
204
|
node = "" + value;
|
|
@@ -195,7 +209,7 @@ class TableContentsComponent extends react_1.default.Component {
|
|
|
195
209
|
const c = (0, color_1.default)(backgroundColor);
|
|
196
210
|
// Get lightness (taking into account alpha)
|
|
197
211
|
const lightness = 1 - (1 - c.luminosity()) * c.alpha();
|
|
198
|
-
textColor = lightness < 0.3 ? "rgb(204,204,204)" : "
|
|
212
|
+
textColor = lightness < 0.3 ? "rgb(204,204,204)" : "inherit";
|
|
199
213
|
}
|
|
200
214
|
return R("td", { key: columnIndex, style: { backgroundColor, color: textColor } }, node);
|
|
201
215
|
}
|
|
@@ -206,6 +220,6 @@ class TableContentsComponent extends react_1.default.Component {
|
|
|
206
220
|
return R("tbody", { key: "body" }, lodash_1.default.map(this.state.data, (row, i) => this.renderRow(i)));
|
|
207
221
|
}
|
|
208
222
|
render() {
|
|
209
|
-
return R("table", { className: "mwater-visualization-table", style: {
|
|
223
|
+
return R("table", { className: "mwater-visualization-table", style: { marginBottom: 0 } }, this.renderHeader(), this.renderBody(), this.renderFooter());
|
|
210
224
|
}
|
|
211
225
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
|
+
import ActionCancelModalComponent from "@mwater/react-library/lib/ActionCancelModalComponent";
|
|
3
4
|
import { HtmlItemExpr } from "../../richtext/ExprItemsHtmlConverter";
|
|
4
5
|
export interface ExprInsertModalComponentProps {
|
|
5
6
|
/** Schema to use */
|
|
@@ -18,18 +19,6 @@ export default class ExprInsertModalComponent extends React.Component<ExprInsert
|
|
|
18
19
|
constructor(props: ExprInsertModalComponentProps);
|
|
19
20
|
open(): void;
|
|
20
21
|
handleInsert: () => void;
|
|
21
|
-
render(): React.CElement<
|
|
22
|
-
actionLabel: string;
|
|
23
|
-
onAction: () => void;
|
|
24
|
-
onCancel: () => void;
|
|
25
|
-
title: string;
|
|
26
|
-
size: string;
|
|
27
|
-
}, React.Component<{
|
|
28
|
-
actionLabel: string;
|
|
29
|
-
onAction: () => void;
|
|
30
|
-
onCancel: () => void;
|
|
31
|
-
title: string;
|
|
32
|
-
size: string;
|
|
33
|
-
}, any, any>> | null;
|
|
22
|
+
render(): React.CElement<import("@mwater/react-library/lib/ActionCancelModalComponent").ActionCancelModalComponentProps, ActionCancelModalComponent> | null;
|
|
34
23
|
}
|
|
35
24
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
|
+
import ActionCancelModalComponent from "@mwater/react-library/lib/ActionCancelModalComponent";
|
|
3
4
|
import { HtmlItemExpr } from "../../richtext/ExprItemsHtmlConverter";
|
|
4
5
|
export interface ExprUpdateModalComponentProps {
|
|
5
6
|
/** Schema to use */
|
|
@@ -16,18 +17,6 @@ interface ExprUpdateModalComponentState {
|
|
|
16
17
|
export default class ExprUpdateModalComponent extends React.Component<ExprUpdateModalComponentProps, ExprUpdateModalComponentState> {
|
|
17
18
|
constructor(props: any);
|
|
18
19
|
open(item: any, onUpdate: any): void;
|
|
19
|
-
render(): React.CElement<
|
|
20
|
-
actionLabel: string;
|
|
21
|
-
onAction: () => void;
|
|
22
|
-
onCancel: () => void;
|
|
23
|
-
title: string;
|
|
24
|
-
size: string;
|
|
25
|
-
}, React.Component<{
|
|
26
|
-
actionLabel: string;
|
|
27
|
-
onAction: () => void;
|
|
28
|
-
onCancel: () => void;
|
|
29
|
-
title: string;
|
|
30
|
-
size: string;
|
|
31
|
-
}, any, any>> | null;
|
|
20
|
+
render(): React.CElement<import("@mwater/react-library/lib/ActionCancelModalComponent").ActionCancelModalComponentProps, ActionCancelModalComponent> | null;
|
|
32
21
|
}
|
|
33
22
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import RichTextComponent from "../../richtext/RichTextComponent";
|
|
4
3
|
import ExprInsertModalComponent from "./ExprInsertModalComponent";
|
|
@@ -25,9 +24,7 @@ export interface TextComponentProps {
|
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
export default class TextComponent extends React.Component<TextComponentProps> {
|
|
28
|
-
static
|
|
29
|
-
locale: PropTypes.Requireable<string>;
|
|
30
|
-
};
|
|
27
|
+
static contextType: React.Context<string>;
|
|
31
28
|
exprInsertModal: ExprInsertModalComponent | null;
|
|
32
29
|
exprUpdateModal: ExprUpdateModalComponent | null;
|
|
33
30
|
editor: RichTextComponent | null;
|
|
@@ -36,13 +33,9 @@ export default class TextComponent extends React.Component<TextComponentProps> {
|
|
|
36
33
|
handleInsertExpr: (item: any) => void;
|
|
37
34
|
replaceItem(item: any): void;
|
|
38
35
|
handleItemClick: (item: any) => void;
|
|
39
|
-
handleAddExpr: (ev:
|
|
40
|
-
renderExtraPaletteButtons(): React.
|
|
41
|
-
|
|
42
|
-
className: string;
|
|
43
|
-
onMouseDown: (ev: any) => void;
|
|
44
|
-
}, HTMLElement>;
|
|
45
|
-
renderModals(): (React.CElement<import("./ExprInsertModalComponent").ExprInsertModalComponentProps, ExprInsertModalComponent> | React.CElement<any, ExprUpdateModalComponent>)[];
|
|
36
|
+
handleAddExpr: (ev: React.MouseEvent<HTMLDivElement>) => void;
|
|
37
|
+
renderExtraPaletteButtons(): React.JSX.Element;
|
|
38
|
+
renderModals(): React.JSX.Element[];
|
|
46
39
|
refRichTextComponent: (c: RichTextComponent | null) => void;
|
|
47
|
-
render(): React.
|
|
40
|
+
render(): React.JSX.Element;
|
|
48
41
|
}
|
|
@@ -3,27 +3,26 @@ 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
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
7
6
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const R = react_1.default.createElement;
|
|
9
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
10
8
|
const RichTextComponent_1 = __importDefault(require("../../richtext/RichTextComponent"));
|
|
11
9
|
const ExprInsertModalComponent_1 = __importDefault(require("./ExprInsertModalComponent"));
|
|
12
10
|
const ExprUpdateModalComponent_1 = __importDefault(require("./ExprUpdateModalComponent"));
|
|
13
11
|
const ExprItemsHtmlConverter_1 = __importDefault(require("../../richtext/ExprItemsHtmlConverter"));
|
|
12
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
14
13
|
// Text component which is provided with the data it needs, rather than loading it.
|
|
15
14
|
// Used by TextWidgetComponent and also by other components that embed text fields
|
|
16
15
|
class TextComponent extends react_1.default.Component {
|
|
17
|
-
static
|
|
18
|
-
exprInsertModal;
|
|
19
|
-
exprUpdateModal;
|
|
20
|
-
editor;
|
|
16
|
+
static contextType = contexts_1.LocaleContext;
|
|
17
|
+
exprInsertModal = null;
|
|
18
|
+
exprUpdateModal = null;
|
|
19
|
+
editor = null;
|
|
21
20
|
createItemsHtmlConverter() {
|
|
22
21
|
return new ExprItemsHtmlConverter_1.default(this.props.schema, this.props.onDesignChange != null, this.props.exprValues,
|
|
23
22
|
// Display summaries if in design more and singleRowTable is set
|
|
24
23
|
this.props.onDesignChange != null && this.props.singleRowTable != null,
|
|
25
24
|
// Only replace named strings if not editing
|
|
26
|
-
this.props.onDesignChange == null ? this.props.namedStrings : undefined, this.context
|
|
25
|
+
this.props.onDesignChange == null ? this.props.namedStrings : undefined, this.context);
|
|
27
26
|
}
|
|
28
27
|
handleItemsChange = (items) => {
|
|
29
28
|
const design = { ...this.props.design, items };
|
|
@@ -59,29 +58,18 @@ class TextComponent extends react_1.default.Component {
|
|
|
59
58
|
return this.exprInsertModal.open();
|
|
60
59
|
};
|
|
61
60
|
renderExtraPaletteButtons() {
|
|
62
|
-
return
|
|
61
|
+
return (react_1.default.createElement("div", { key: "expr", className: "mwater-visualization-text-palette-item", onMouseDown: this.handleAddExpr },
|
|
62
|
+
react_1.default.createElement("i", { className: "fa fa-plus" }),
|
|
63
|
+
" Expression"));
|
|
63
64
|
}
|
|
64
65
|
renderModals() {
|
|
65
66
|
return [
|
|
66
|
-
|
|
67
|
-
key: "exprInsertModal",
|
|
68
|
-
ref: (c) => {
|
|
67
|
+
react_1.default.createElement(ExprInsertModalComponent_1.default, { key: "exprInsertModal", ref: (c) => {
|
|
69
68
|
this.exprInsertModal = c;
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
dataSource: this.props.dataSource,
|
|
73
|
-
onInsert: this.handleInsertExpr,
|
|
74
|
-
singleRowTable: this.props.singleRowTable
|
|
75
|
-
}),
|
|
76
|
-
R(ExprUpdateModalComponent_1.default, {
|
|
77
|
-
key: "exprUpdateModal",
|
|
78
|
-
ref: (c) => {
|
|
69
|
+
}, schema: this.props.schema, dataSource: this.props.dataSource, onInsert: this.handleInsertExpr, singleRowTable: this.props.singleRowTable }),
|
|
70
|
+
react_1.default.createElement(ExprUpdateModalComponent_1.default, { key: "exprUpdateModal", ref: (c) => {
|
|
79
71
|
this.exprUpdateModal = c;
|
|
80
|
-
},
|
|
81
|
-
schema: this.props.schema,
|
|
82
|
-
dataSource: this.props.dataSource,
|
|
83
|
-
singleRowTable: this.props.singleRowTable
|
|
84
|
-
})
|
|
72
|
+
}, schema: this.props.schema, dataSource: this.props.dataSource, singleRowTable: this.props.singleRowTable })
|
|
85
73
|
];
|
|
86
74
|
}
|
|
87
75
|
refRichTextComponent = (c) => {
|
|
@@ -89,21 +77,13 @@ class TextComponent extends react_1.default.Component {
|
|
|
89
77
|
};
|
|
90
78
|
render() {
|
|
91
79
|
const style = {
|
|
92
|
-
position: "relative"
|
|
80
|
+
position: "relative",
|
|
81
|
+
width: this.props.width,
|
|
82
|
+
height: this.props.height
|
|
93
83
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
ref: this.refRichTextComponent,
|
|
98
|
-
className: `mwater-visualization-text-widget-style-${this.props.design.style || "default"}`,
|
|
99
|
-
style,
|
|
100
|
-
items: this.props.design.items,
|
|
101
|
-
onItemsChange: this.props.onDesignChange ? this.handleItemsChange : undefined,
|
|
102
|
-
onItemClick: this.handleItemClick,
|
|
103
|
-
itemsHtmlConverter: this.createItemsHtmlConverter(),
|
|
104
|
-
includeHeadings: this.props.design.style === "default" || !this.props.design.style,
|
|
105
|
-
extraPaletteButtons: this.renderExtraPaletteButtons()
|
|
106
|
-
}));
|
|
84
|
+
return (react_1.default.createElement("div", null,
|
|
85
|
+
this.renderModals(),
|
|
86
|
+
react_1.default.createElement(RichTextComponent_1.default, { ref: this.refRichTextComponent, className: `mwater-visualization-text-widget-style-${this.props.design.style || "default"}`, style: style, items: this.props.design.items, onItemsChange: this.props.onDesignChange ? this.handleItemsChange : undefined, onItemClick: this.handleItemClick, itemsHtmlConverter: this.createItemsHtmlConverter(), includeHeadings: this.props.design.style === "default" || !this.props.design.style, extraPaletteButtons: this.renderExtraPaletteButtons() })));
|
|
107
87
|
}
|
|
108
88
|
}
|
|
109
89
|
exports.default = TextComponent;
|
|
@@ -20,10 +20,11 @@ export default class TextWidget extends Widget {
|
|
|
20
20
|
[key: string]: string;
|
|
21
21
|
} | undefined;
|
|
22
22
|
ref: ((widget: any) => void) | undefined;
|
|
23
|
+
refreshKey: any;
|
|
23
24
|
}, any>;
|
|
24
25
|
getData(design: any, schema: Schema, dataSource: DataSource, filters: JsonQLFilter[], callback: any): void;
|
|
25
26
|
isAutoHeight(): boolean;
|
|
26
27
|
getExprItems(items: HtmlItem[]): HtmlItemExpr[];
|
|
27
|
-
getFilterableTables(design: TextWidgetDesign, schema: Schema): string[];
|
|
28
|
+
getFilterableTables(design: TextWidgetDesign | undefined, schema: Schema): string[];
|
|
28
29
|
getTOCEntries(design: any, namedStrings: any): any;
|
|
29
30
|
}
|