@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
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import _ from "lodash"
|
|
2
|
-
import $ from "jquery"
|
|
3
|
-
import React from "react"
|
|
4
|
-
import ReactDOM from "react-dom"
|
|
5
|
-
const R = React.createElement
|
|
6
|
-
|
|
7
|
-
export interface DropdownWidgetComponentProps {
|
|
8
|
-
/** Width specification */
|
|
9
|
-
width?: any
|
|
10
|
-
/** Height specification */
|
|
11
|
-
height?: any
|
|
12
|
-
dropdownItems: any
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Widget wrapper that adds a dropdown menu in a gear floating
|
|
16
|
-
export default class DropdownWidgetComponent extends React.Component<DropdownWidgetComponentProps> {
|
|
17
|
-
renderDropdownItem = (item: any, i: any) => {
|
|
18
|
-
return R(
|
|
19
|
-
"li",
|
|
20
|
-
{ key: `${i}` },
|
|
21
|
-
R(
|
|
22
|
-
"a",
|
|
23
|
-
{ className: "dropdown-item", onClick: item.onClick },
|
|
24
|
-
item.icon ? R("span", { className: `glyphicon glyphicon-${item.icon} text-muted` }) : undefined,
|
|
25
|
-
item.icon ? " " : undefined,
|
|
26
|
-
item.label
|
|
27
|
-
)
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
renderDropdown() {
|
|
32
|
-
if (this.props.dropdownItems.length === 0) {
|
|
33
|
-
return null
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const dropdownStyle = {
|
|
37
|
-
position: "absolute",
|
|
38
|
-
right: 3,
|
|
39
|
-
top: 3,
|
|
40
|
-
cursor: "pointer",
|
|
41
|
-
zIndex: 1029
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const elem = R(
|
|
45
|
-
"div",
|
|
46
|
-
{ style: dropdownStyle, "data-bs-toggle": "dropdown" },
|
|
47
|
-
R("div", { className: "mwater-visualization-simple-widget-gear-button" }, R("span", { className: "fas fa-cog" }))
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
return R(
|
|
51
|
-
"div",
|
|
52
|
-
{ style: dropdownStyle },
|
|
53
|
-
elem,
|
|
54
|
-
R(
|
|
55
|
-
"ul",
|
|
56
|
-
{ className: "dropdown-menu dropdown-menu-end", style: { top: 25 } },
|
|
57
|
-
_.map(this.props.dropdownItems, this.renderDropdownItem)
|
|
58
|
-
)
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
closeMenu = () => {
|
|
63
|
-
return $(ReactDOM.findDOMNode(this) as Element).find('[data-bs-toggle="dropdown"]').parent().removeClass("open")
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
render() {
|
|
67
|
-
return R(
|
|
68
|
-
"div",
|
|
69
|
-
{
|
|
70
|
-
className: "mwater-visualization-simple-widget",
|
|
71
|
-
onMouseLeave: this.closeMenu,
|
|
72
|
-
style: { width: this.props.width, height: this.props.height }
|
|
73
|
-
},
|
|
74
|
-
this.props.children,
|
|
75
|
-
this.renderDropdown()
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
|
-
import React from "react"
|
|
3
|
-
const R = React.createElement
|
|
4
|
-
import _ from "lodash"
|
|
5
|
-
import TextComponent from "./TextComponent"
|
|
6
|
-
import TextWidget from "./TextWidget"
|
|
7
|
-
import AsyncLoadComponent from "@mwater/react-library/lib/AsyncLoadComponent"
|
|
8
|
-
import { DataSource, Schema } from "@mwater/expressions"
|
|
9
|
-
import { JsonQLFilter } from "../../JsonQLFilter"
|
|
10
|
-
import { TextWidgetDesign } from "./TextWidgetDesign"
|
|
11
|
-
import { HtmlItem } from "../../richtext/ItemsHtmlConverter"
|
|
12
|
-
import { HtmlItemExpr } from "../../richtext/ExprItemsHtmlConverter"
|
|
13
|
-
|
|
14
|
-
export interface TextWidgetComponentProps {
|
|
15
|
-
design: TextWidgetDesign
|
|
16
|
-
/** Called with new design. null/undefined for readonly */
|
|
17
|
-
onDesignChange?: (design: TextWidgetDesign) => void
|
|
18
|
-
filters: JsonQLFilter[]
|
|
19
|
-
schema: Schema
|
|
20
|
-
/** Data source to use for chart */
|
|
21
|
-
dataSource: DataSource
|
|
22
|
-
widgetDataSource: any
|
|
23
|
-
width?: number
|
|
24
|
-
height?: number
|
|
25
|
-
/** Table that is filtered to have one row */
|
|
26
|
-
singleRowTable?: string
|
|
27
|
-
namedStrings?: any
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Widget which displays styled text with embedded expressions
|
|
31
|
-
export default class TextWidgetComponent extends AsyncLoadComponent<TextWidgetComponentProps, { loading: boolean, exprValues: any, error: any, cacheExpiry: any }> {
|
|
32
|
-
divComp: HTMLElement | null
|
|
33
|
-
constructor(props: any) {
|
|
34
|
-
super(props)
|
|
35
|
-
|
|
36
|
-
this.state = {
|
|
37
|
-
loading: false,
|
|
38
|
-
// Map of expression id to expression value
|
|
39
|
-
exprValues: {},
|
|
40
|
-
error: null,
|
|
41
|
-
cacheExpiry: props.dataSource.getCacheExpiry() // Save cache expiry to see if changes
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Override to determine if a load is needed. Not called on mounting
|
|
46
|
-
isLoadNeeded(newProps: any, oldProps: any) {
|
|
47
|
-
// Get expression items recursively
|
|
48
|
-
function getExprItems(items: HtmlItem[]): HtmlItemExpr[] {
|
|
49
|
-
let exprItems: HtmlItemExpr[] = []
|
|
50
|
-
for (let item of items || []) {
|
|
51
|
-
if (typeof item === "object") {
|
|
52
|
-
if (item.type === "expr") {
|
|
53
|
-
exprItems.push(item as HtmlItemExpr)
|
|
54
|
-
}
|
|
55
|
-
if (item.items) {
|
|
56
|
-
exprItems = exprItems.concat(getExprItems(item.items))
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return exprItems
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Reload if filters or expressions have changed or cache expiry
|
|
64
|
-
return (
|
|
65
|
-
!_.isEqual(newProps.filters, oldProps.filters) ||
|
|
66
|
-
!_.isEqual(getExprItems(newProps.design.items), getExprItems(oldProps.design.items)) ||
|
|
67
|
-
newProps.dataSource.getCacheExpiry() !== this.state.cacheExpiry
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Call callback with state changes
|
|
72
|
-
load(props: any, prevProps: any, callback: any) {
|
|
73
|
-
// Shortcut if no expressions in text widget
|
|
74
|
-
const widget = new TextWidget()
|
|
75
|
-
if (widget.getExprItems(props.design.items).length === 0) {
|
|
76
|
-
callback({ error: null, exprValues: {} }, props.dataSource.getCacheExpiry())
|
|
77
|
-
return
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Get data
|
|
81
|
-
props.widgetDataSource.getData(props.design, props.filters, (error: any, data: any) => {
|
|
82
|
-
callback({ error, exprValues: data || {}, cacheExpiry: props.dataSource.getCacheExpiry() })
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
scrollToTOCEntry(entryId: any) {
|
|
87
|
-
// Find entry in divComp
|
|
88
|
-
const entries = this.divComp!.querySelectorAll("h1,h2,h3,h4,h5,h6,h7,h8,h9")
|
|
89
|
-
|
|
90
|
-
const entry = entries[entryId]
|
|
91
|
-
if (entry) {
|
|
92
|
-
return entry.scrollIntoView(true)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
render() {
|
|
97
|
-
// If loading, don't display old values
|
|
98
|
-
const exprValues = !this.state.loading ? this.state.exprValues : {}
|
|
99
|
-
|
|
100
|
-
return R(
|
|
101
|
-
"div",
|
|
102
|
-
{
|
|
103
|
-
ref: (c) => {
|
|
104
|
-
this.divComp = c
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
R(TextComponent, {
|
|
108
|
-
design: this.props.design,
|
|
109
|
-
onDesignChange: this.props.onDesignChange,
|
|
110
|
-
schema: this.props.schema,
|
|
111
|
-
dataSource: this.props.dataSource,
|
|
112
|
-
exprValues,
|
|
113
|
-
width: this.props.width,
|
|
114
|
-
height: this.props.height,
|
|
115
|
-
singleRowTable: this.props.singleRowTable,
|
|
116
|
-
namedStrings: this.props.namedStrings
|
|
117
|
-
})
|
|
118
|
-
)
|
|
119
|
-
}
|
|
120
|
-
}
|