@hpcc-js/react 2.49.6 → 2.51.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/dist/index.es6.js +150 -38
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +151 -37
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -4
- package/src/ImageChar.tsx +9 -2
- package/src/__package__.ts +2 -2
- package/src/edge.tsx +4 -1
- package/src/icon.tsx +7 -1
- package/src/index.ts +1 -0
- package/src/shape.tsx +13 -1
- package/src/text.tsx +37 -29
- package/src/vertex.tsx +9 -7
- package/src/vertex2.tsx +3 -1
- package/src/vertex3.tsx +6 -3
- package/src/vertex4.tsx +307 -0
- package/types/ImageChar.d.ts.map +1 -1
- package/types/__package__.d.ts +2 -2
- package/types/edge.d.ts.map +1 -1
- package/types/icon.d.ts +3 -1
- package/types/icon.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/shape.d.ts +2 -1
- package/types/shape.d.ts.map +1 -1
- package/types/text.d.ts.map +1 -1
- package/types/vertex.d.ts.map +1 -1
- package/types/vertex2.d.ts.map +1 -1
- package/types/vertex3.d.ts.map +1 -1
- package/types/vertex4.d.ts +32 -0
- package/types/vertex4.d.ts.map +1 -0
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/icon.d.ts +3 -1
- package/types-3.4/index.d.ts +1 -0
- package/types-3.4/shape.d.ts +2 -1
- package/types-3.4/vertex4.d.ts +32 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.51.0",
|
|
4
4
|
"description": "hpcc-js - Viz React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es6",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"update": "npx npm-check-updates -u -t minor"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@hpcc-js/common": "^2.
|
|
42
|
-
"@hpcc-js/preact-shim": "^2.
|
|
41
|
+
"@hpcc-js/common": "^2.71.0",
|
|
42
|
+
"@hpcc-js/preact-shim": "^2.16.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@hpcc-js/bundle": "^2.11.1",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
57
57
|
},
|
|
58
58
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "f7b7633dbb01360f18424eb1c9226424696ea920"
|
|
60
60
|
}
|
package/src/ImageChar.tsx
CHANGED
|
@@ -20,7 +20,13 @@ export const ImageChar: React.FunctionComponent<ImageChar> = ({
|
|
|
20
20
|
stroke,
|
|
21
21
|
fontFamily = "FontAwesome",
|
|
22
22
|
char = ""
|
|
23
|
-
}) =>
|
|
23
|
+
}) => {
|
|
24
|
+
|
|
25
|
+
const renderChar = React.useMemo(() => {
|
|
26
|
+
return fontFamily === "FontAwesome" ? Utility.faChar(char) : char;
|
|
27
|
+
}, [char, fontFamily]);
|
|
28
|
+
|
|
29
|
+
return <text
|
|
24
30
|
x={x}
|
|
25
31
|
y={y}
|
|
26
32
|
fill={fill}
|
|
@@ -29,4 +35,5 @@ export const ImageChar: React.FunctionComponent<ImageChar> = ({
|
|
|
29
35
|
font-size={`${height}px`}
|
|
30
36
|
dominant-baseline="middle"
|
|
31
37
|
style="text-anchor: middle;alignment-baseline:middle;"
|
|
32
|
-
>{
|
|
38
|
+
>{renderChar}</text>;
|
|
39
|
+
};
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/react";
|
|
2
|
-
export const PKG_VERSION = "2.
|
|
3
|
-
export const BUILD_VERSION = "2.
|
|
2
|
+
export const PKG_VERSION = "2.51.0";
|
|
3
|
+
export const BUILD_VERSION = "2.104.1";
|
package/src/edge.tsx
CHANGED
|
@@ -37,5 +37,8 @@ export const Edge: React.FunctionComponent<Edge> = ({
|
|
|
37
37
|
stroke = "black",
|
|
38
38
|
strokeDasharray
|
|
39
39
|
}) => {
|
|
40
|
-
|
|
40
|
+
const d = React.useMemo(() => {
|
|
41
|
+
return line(calcArc(points, curveDepth));
|
|
42
|
+
}, [curveDepth, points]);
|
|
43
|
+
return <path stroke={stroke} stroke-dasharray={strokeDasharray} d={d}></path>;
|
|
41
44
|
};
|
package/src/icon.tsx
CHANGED
|
@@ -4,7 +4,8 @@ import { ImageChar } from "./ImageChar";
|
|
|
4
4
|
import { Shape } from "./shape";
|
|
5
5
|
|
|
6
6
|
export interface Icon {
|
|
7
|
-
shape?: "circle" | "square";
|
|
7
|
+
shape?: "circle" | "square" | "rectangle";
|
|
8
|
+
width?: number;
|
|
8
9
|
height?: number;
|
|
9
10
|
padding?: number;
|
|
10
11
|
fill?: string;
|
|
@@ -13,6 +14,7 @@ export interface Icon {
|
|
|
13
14
|
imageFontFamily?: string;
|
|
14
15
|
imageChar?: string;
|
|
15
16
|
imageCharFill?: string;
|
|
17
|
+
xOffset?: number;
|
|
16
18
|
yOffset?: number;
|
|
17
19
|
cornerRadius?: number;
|
|
18
20
|
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
@@ -20,6 +22,7 @@ export interface Icon {
|
|
|
20
22
|
|
|
21
23
|
export const Icon: React.FunctionComponent<Icon> = ({
|
|
22
24
|
shape = "circle",
|
|
25
|
+
width,
|
|
23
26
|
height = 32,
|
|
24
27
|
fill,
|
|
25
28
|
stroke,
|
|
@@ -28,6 +31,7 @@ export const Icon: React.FunctionComponent<Icon> = ({
|
|
|
28
31
|
imageChar = "",
|
|
29
32
|
imageCharFill = Palette.textColor(fill),
|
|
30
33
|
padding = height / 5,
|
|
34
|
+
xOffset = 0,
|
|
31
35
|
yOffset = 0,
|
|
32
36
|
cornerRadius,
|
|
33
37
|
shapeRendering
|
|
@@ -35,6 +39,7 @@ export const Icon: React.FunctionComponent<Icon> = ({
|
|
|
35
39
|
return <>
|
|
36
40
|
<Shape
|
|
37
41
|
shape={shape}
|
|
42
|
+
width={width}
|
|
38
43
|
height={height}
|
|
39
44
|
fill={fill}
|
|
40
45
|
stroke={stroke}
|
|
@@ -43,6 +48,7 @@ export const Icon: React.FunctionComponent<Icon> = ({
|
|
|
43
48
|
cornerRadius={cornerRadius}
|
|
44
49
|
/>
|
|
45
50
|
<ImageChar
|
|
51
|
+
x={xOffset}
|
|
46
52
|
y={yOffset}
|
|
47
53
|
height={height - padding}
|
|
48
54
|
fontFamily={imageFontFamily}
|
package/src/index.ts
CHANGED
package/src/shape.tsx
CHANGED
|
@@ -85,8 +85,9 @@ export const Rectangle: React.FunctionComponent<Rectangle> = ({
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
interface Shape {
|
|
88
|
-
shape?: "circle" | "square";
|
|
88
|
+
shape?: "circle" | "square" | "rectangle";
|
|
89
89
|
height?: number;
|
|
90
|
+
width?: number;
|
|
90
91
|
fill?: string;
|
|
91
92
|
stroke?: string;
|
|
92
93
|
strokeWidth?: number;
|
|
@@ -97,6 +98,7 @@ interface Shape {
|
|
|
97
98
|
export const Shape: React.FunctionComponent<Shape> = ({
|
|
98
99
|
shape = "circle",
|
|
99
100
|
height = 128,
|
|
101
|
+
width,
|
|
100
102
|
fill,
|
|
101
103
|
stroke,
|
|
102
104
|
strokeWidth = 1,
|
|
@@ -113,6 +115,16 @@ export const Shape: React.FunctionComponent<Shape> = ({
|
|
|
113
115
|
shapeRendering={shapeRendering}
|
|
114
116
|
cornerRadius={cornerRadius}
|
|
115
117
|
/>;
|
|
118
|
+
case "rectangle":
|
|
119
|
+
return <Rectangle
|
|
120
|
+
width={width ?? height}
|
|
121
|
+
height={height}
|
|
122
|
+
fill={fill}
|
|
123
|
+
stroke={stroke}
|
|
124
|
+
strokeWidth={strokeWidth}
|
|
125
|
+
shapeRendering={shapeRendering}
|
|
126
|
+
cornerRadius={cornerRadius}
|
|
127
|
+
/>;
|
|
116
128
|
case "circle":
|
|
117
129
|
default:
|
|
118
130
|
return <Circle
|
package/src/text.tsx
CHANGED
|
@@ -44,28 +44,37 @@ export const Text: React.FunctionComponent<Text> = ({
|
|
|
44
44
|
fill = "black",
|
|
45
45
|
onSizeUpdate
|
|
46
46
|
}) => {
|
|
47
|
-
const [totalWidth,
|
|
48
|
-
const [totalHeight,
|
|
47
|
+
const [totalWidth, setTotalWidthUpdate] = React.useState(0);
|
|
48
|
+
const [totalHeight, setTotalHeightUpdate] = React.useState(0);
|
|
49
|
+
|
|
49
50
|
React.useEffect(() => {
|
|
50
51
|
onSizeUpdate && onSizeUpdate({ width: totalWidth, height: totalHeight });
|
|
51
52
|
}, [totalWidth, totalHeight, onSizeUpdate]);
|
|
52
53
|
|
|
53
|
-
const parts =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const parts = React.useMemo(() => {
|
|
55
|
+
return text.split("\n");
|
|
56
|
+
}, [text]);
|
|
57
|
+
|
|
58
|
+
const ts = React.useMemo(() => {
|
|
59
|
+
return Utility.textSize(parts, fontFamily, height);
|
|
60
|
+
}, [fontFamily, height, parts]);
|
|
61
|
+
|
|
62
|
+
setTotalWidthUpdate(ts.width);
|
|
63
|
+
setTotalHeightUpdate(parts.length * (height + 2) - 2);
|
|
57
64
|
|
|
58
65
|
const yOffset = -(totalHeight / 2) + (height / 2);
|
|
59
|
-
const TextLines =
|
|
60
|
-
return
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const TextLines = React.useMemo(() => {
|
|
67
|
+
return parts.map((p, i) => {
|
|
68
|
+
return <g key={i} transform={`translate(0 ${yOffset + i * (height + 2)})`}>
|
|
69
|
+
<TextLine
|
|
70
|
+
text={p}
|
|
71
|
+
height={height}
|
|
72
|
+
fontFamily={fontFamily}
|
|
73
|
+
fill={fill}
|
|
74
|
+
/>
|
|
75
|
+
</g>;
|
|
76
|
+
});
|
|
77
|
+
}, [fill, fontFamily, height, parts, yOffset]);
|
|
69
78
|
|
|
70
79
|
return <>{TextLines}</>;
|
|
71
80
|
};
|
|
@@ -96,15 +105,22 @@ export const TextBox: React.FunctionComponent<TextBox> = ({
|
|
|
96
105
|
cornerRadius = 0,
|
|
97
106
|
onSizeUpdate
|
|
98
107
|
}) => {
|
|
99
|
-
const [textWidth,
|
|
100
|
-
const [textHeight,
|
|
108
|
+
const [textWidth, setTextWidthUpdate] = React.useState(0);
|
|
109
|
+
const [textHeight, setTextHeightUpdate] = React.useState(0);
|
|
110
|
+
|
|
101
111
|
React.useEffect(() => {
|
|
102
112
|
onSizeUpdate && onSizeUpdate({ width: textWidth, height: textHeight });
|
|
103
113
|
}, [textWidth, textHeight, onSizeUpdate]);
|
|
104
114
|
|
|
115
|
+
const onTextSizeUpdate = React.useCallback(size => {
|
|
116
|
+
setTextWidthUpdate(size.width);
|
|
117
|
+
setTextHeightUpdate(size.height);
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
105
120
|
const w = textWidth + padding * 2 + strokeWidth;
|
|
106
121
|
const h = textHeight + padding * 2 + strokeWidth;
|
|
107
122
|
const textOffsetY = Math.floor(height / 10);
|
|
123
|
+
|
|
108
124
|
return <>
|
|
109
125
|
<Rectangle
|
|
110
126
|
width={w}
|
|
@@ -123,13 +139,7 @@ export const TextBox: React.FunctionComponent<TextBox> = ({
|
|
|
123
139
|
onSizeUpdate={onTextSizeUpdate}
|
|
124
140
|
/>
|
|
125
141
|
</g>
|
|
126
|
-
|
|
127
|
-
;
|
|
128
|
-
|
|
129
|
-
function onTextSizeUpdate(size) {
|
|
130
|
-
onTextWidthUpdate(size.width);
|
|
131
|
-
onTextHeightUpdate(size.height);
|
|
132
|
-
}
|
|
142
|
+
</>;
|
|
133
143
|
};
|
|
134
144
|
|
|
135
145
|
export interface LabelledRect extends TextBox {
|
|
@@ -176,8 +186,7 @@ export const LabelledRect: React.FunctionComponent<LabelledRect> = ({
|
|
|
176
186
|
baseline="hanging"
|
|
177
187
|
/>
|
|
178
188
|
</g>
|
|
179
|
-
|
|
180
|
-
;
|
|
189
|
+
</>;
|
|
181
190
|
};
|
|
182
191
|
|
|
183
192
|
export const IconLabelledRect: React.FunctionComponent<IconLabelledRect> = ({
|
|
@@ -225,6 +234,5 @@ export const IconLabelledRect: React.FunctionComponent<IconLabelledRect> = ({
|
|
|
225
234
|
baseline="hanging"
|
|
226
235
|
/>
|
|
227
236
|
</g>
|
|
228
|
-
|
|
229
|
-
;
|
|
237
|
+
</>;
|
|
230
238
|
};
|
package/src/vertex.tsx
CHANGED
|
@@ -58,8 +58,9 @@ export const Vertex: React.FunctionComponent<Vertex> = ({
|
|
|
58
58
|
onSizeUpdate,
|
|
59
59
|
showLabel = true
|
|
60
60
|
}) => {
|
|
61
|
-
const [textBoxWidth,
|
|
62
|
-
const [textBoxHeight,
|
|
61
|
+
const [textBoxWidth, setTextBoxWidthUpdate] = React.useState(0);
|
|
62
|
+
const [textBoxHeight, setTextBoxHeightUpdate] = React.useState(0);
|
|
63
|
+
|
|
63
64
|
React.useEffect(() => {
|
|
64
65
|
onSizeUpdate && onSizeUpdate({ width: 0, height: 0 });
|
|
65
66
|
}, [textBoxWidth, textBoxHeight, onSizeUpdate]);
|
|
@@ -79,6 +80,12 @@ export const Vertex: React.FunctionComponent<Vertex> = ({
|
|
|
79
80
|
offsetY += (textHeight + 8) / 2;
|
|
80
81
|
annotationOffsetY -= textBoxHeight + textPadding;
|
|
81
82
|
}
|
|
83
|
+
|
|
84
|
+
const onTextBoxSizeUpdate = React.useCallback(size => {
|
|
85
|
+
setTextBoxWidthUpdate(size.width);
|
|
86
|
+
setTextBoxHeightUpdate(size.height);
|
|
87
|
+
}, []);
|
|
88
|
+
|
|
82
89
|
const label = showLabel ? <g transform={`translate(0 ${textboxOffsetY})`}>
|
|
83
90
|
<TextBox
|
|
84
91
|
text={text}
|
|
@@ -101,9 +108,4 @@ export const Vertex: React.FunctionComponent<Vertex> = ({
|
|
|
101
108
|
<Icon {...icon} />
|
|
102
109
|
{label}
|
|
103
110
|
</g>;
|
|
104
|
-
|
|
105
|
-
function onTextBoxSizeUpdate(size) {
|
|
106
|
-
onTextBoxWidthUpdate(size.width);
|
|
107
|
-
onTextBoxHeightUpdate(size.height);
|
|
108
|
-
}
|
|
109
111
|
};
|
package/src/vertex2.tsx
CHANGED
|
@@ -26,7 +26,9 @@ export const Vertex2: React.FunctionComponent<Vertex> = ({
|
|
|
26
26
|
...icon
|
|
27
27
|
};
|
|
28
28
|
const textBoxHeight = textHeight + textPadding * 2;
|
|
29
|
-
const { width } =
|
|
29
|
+
const { width } = React.useMemo(() => {
|
|
30
|
+
return Utility.textSize(text, textFontFamily, textHeight, false);
|
|
31
|
+
}, [text, textFontFamily, textHeight]);
|
|
30
32
|
|
|
31
33
|
const stepSize = annotationsHeight;
|
|
32
34
|
const textboxStrokeWidth = 1;
|
package/src/vertex3.tsx
CHANGED
|
@@ -63,7 +63,10 @@ export const Vertex3: React.FunctionComponent<IVertex3> = ({
|
|
|
63
63
|
|
|
64
64
|
const annoOffsetY = 0;
|
|
65
65
|
|
|
66
|
-
const labelWidth =
|
|
66
|
+
const labelWidth = React.useMemo(() => {
|
|
67
|
+
return Utility.textSize(text, textFontFamily, textHeight, false).width;
|
|
68
|
+
}, [text, textFontFamily, textHeight]);
|
|
69
|
+
|
|
67
70
|
let labelShapeWidth = 0;
|
|
68
71
|
if (text !== "") {
|
|
69
72
|
labelShapeWidth = labelWidth + (textPadding * 2) + (textboxStrokeWidth * 2);
|
|
@@ -73,13 +76,13 @@ export const Vertex3: React.FunctionComponent<IVertex3> = ({
|
|
|
73
76
|
|
|
74
77
|
const textShapeHeight = textHeight + (textPadding * 2) + (textboxStrokeWidth * 2);
|
|
75
78
|
const annotationArr = [];
|
|
76
|
-
annotations.forEach(anno => {
|
|
79
|
+
annotations.forEach((anno, idx) => {
|
|
77
80
|
const annoText = anno.imageChar;
|
|
78
81
|
const annoShapeWidth = textShapeHeight;
|
|
79
82
|
fullAnnotationWidth += annoShapeWidth + annotationGutter;
|
|
80
83
|
const annoOffsetX = fullAnnotationWidth - (annoShapeWidth / 2);
|
|
81
84
|
annotationArr.push(
|
|
82
|
-
<g class="vertex3-anno" transform={`translate(${annoOffsetX} ${annoOffsetY})`}>
|
|
85
|
+
<g key={idx} class="vertex3-anno" transform={`translate(${annoOffsetX} ${annoOffsetY})`}>
|
|
83
86
|
<Icon
|
|
84
87
|
{...anno}
|
|
85
88
|
shape="square"
|
package/src/vertex4.tsx
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/* eslint-disable no-debugger, no-console */
|
|
2
|
+
import { Utility } from "@hpcc-js/common";
|
|
3
|
+
import * as React from "@hpcc-js/preact-shim";
|
|
4
|
+
import { Icon } from "./icon";
|
|
5
|
+
import { TextBox } from "./text";
|
|
6
|
+
import { Vertex } from "./vertex";
|
|
7
|
+
|
|
8
|
+
export interface IVertex4Annotation extends Icon {
|
|
9
|
+
shapeOffsetX?: number;
|
|
10
|
+
shapeOffsetY?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IVertex4 extends Vertex {
|
|
14
|
+
textboxStrokeWidth?: number;
|
|
15
|
+
annotations?: IVertex4Annotation[];
|
|
16
|
+
iconAnnotations?: IVertex4Annotation[];
|
|
17
|
+
annotationGutter?: number;
|
|
18
|
+
cornerRadius?: number;
|
|
19
|
+
subText?: any;
|
|
20
|
+
noLabelRadius?: number;
|
|
21
|
+
iconBorderWidth?: number;
|
|
22
|
+
iconBorderColor?: string;
|
|
23
|
+
iconBackgroundColor?: string;
|
|
24
|
+
shapeOffsetX?: number;
|
|
25
|
+
shapeOffsetY?: number;
|
|
26
|
+
iconOffsetX?: number;
|
|
27
|
+
iconOffsetY?: number;
|
|
28
|
+
iconPadding?: number;
|
|
29
|
+
iconFontSize?: number;
|
|
30
|
+
iconFontColor?: string;
|
|
31
|
+
iconFontFamily?: string;
|
|
32
|
+
iconText?: string;
|
|
33
|
+
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const Vertex4: React.FunctionComponent<IVertex4> = ({
|
|
37
|
+
categoryID = "",
|
|
38
|
+
text = "",
|
|
39
|
+
textHeight = 10,
|
|
40
|
+
textPadding = 4,
|
|
41
|
+
textFill = "#287EC4",
|
|
42
|
+
textboxFill = "white",
|
|
43
|
+
textboxStroke = "#CCCCCC",
|
|
44
|
+
textboxStrokeWidth = 1,
|
|
45
|
+
textFontFamily = "Verdana",
|
|
46
|
+
annotationGutter = 2,
|
|
47
|
+
annotations = [],
|
|
48
|
+
iconAnnotations = [],
|
|
49
|
+
cornerRadius = 3,
|
|
50
|
+
icon = {},
|
|
51
|
+
subText = {},
|
|
52
|
+
showLabel = true,
|
|
53
|
+
noLabelRadius = 5,
|
|
54
|
+
|
|
55
|
+
iconBorderWidth = 1,
|
|
56
|
+
iconBorderColor = "#333",
|
|
57
|
+
|
|
58
|
+
iconBackgroundColor = "#fff",
|
|
59
|
+
|
|
60
|
+
iconFontColor = "#000",
|
|
61
|
+
iconFontSize=20,
|
|
62
|
+
iconFontFamily="FontAwesome",
|
|
63
|
+
|
|
64
|
+
shapeOffsetX = 0,
|
|
65
|
+
shapeOffsetY = 0,
|
|
66
|
+
iconOffsetX = 0,
|
|
67
|
+
iconOffsetY = 0,
|
|
68
|
+
|
|
69
|
+
iconPadding = 4,
|
|
70
|
+
iconText="?",
|
|
71
|
+
shapeRendering="auto"
|
|
72
|
+
}) => {
|
|
73
|
+
icon = {
|
|
74
|
+
height: 50,
|
|
75
|
+
imageChar: "?",
|
|
76
|
+
imageFontFamily: "FontAwesome",
|
|
77
|
+
imageCharFill: "#555555",
|
|
78
|
+
fill: "transparent",
|
|
79
|
+
strokeWidth: 0,
|
|
80
|
+
...icon
|
|
81
|
+
};
|
|
82
|
+
subText = {
|
|
83
|
+
text: "",
|
|
84
|
+
fill: "white",
|
|
85
|
+
textFill: "#555555",
|
|
86
|
+
...subText
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const annoOffsetY = 0;
|
|
90
|
+
const labelWidth = React.useMemo(() => {
|
|
91
|
+
return Utility.textSize(text, textFontFamily, textHeight, false).width;
|
|
92
|
+
}, [text, textFontFamily, textHeight]);
|
|
93
|
+
|
|
94
|
+
let labelShapeWidth = 0;
|
|
95
|
+
if (text !== "") {
|
|
96
|
+
labelShapeWidth = labelWidth + (textPadding * 2) + (textboxStrokeWidth * 2);
|
|
97
|
+
}
|
|
98
|
+
let fullAnnotationWidth = labelShapeWidth + annotationGutter;
|
|
99
|
+
const textOffsetX = fullAnnotationWidth - (labelShapeWidth / 2);
|
|
100
|
+
|
|
101
|
+
const textShapeHeight = textHeight + (annotationGutter*2) + (textboxStrokeWidth * 2);
|
|
102
|
+
const annoWidthArr = annotations.map((anno, i) => {
|
|
103
|
+
return Utility.textSize(anno.imageChar, anno.imageFontFamily, anno.height, false).width;
|
|
104
|
+
});
|
|
105
|
+
const annotationArr = [];
|
|
106
|
+
let _labelAnnoOffsetX = fullAnnotationWidth;
|
|
107
|
+
annotations.forEach((anno, i) => {
|
|
108
|
+
const annoText = anno.imageChar;
|
|
109
|
+
const annoTextHeight = anno.height ?? textShapeHeight;
|
|
110
|
+
_labelAnnoOffsetX += annoWidthArr[i] + annotationGutter;
|
|
111
|
+
const annoOffsetX = _labelAnnoOffsetX - (annoWidthArr[i] / 2);
|
|
112
|
+
annotationArr.push(
|
|
113
|
+
<g key={i} class="vertex3-anno" data-anno={JSON.stringify(anno)} transform={`translate(${annoOffsetX} ${annoOffsetY})`}>
|
|
114
|
+
<Icon
|
|
115
|
+
{...anno}
|
|
116
|
+
shape="rectangle"
|
|
117
|
+
width={annoWidthArr[i]}
|
|
118
|
+
height={annoTextHeight}
|
|
119
|
+
imageChar={annoText}
|
|
120
|
+
imageFontFamily={anno.imageFontFamily}
|
|
121
|
+
cornerRadius={cornerRadius}
|
|
122
|
+
strokeWidth={0}
|
|
123
|
+
/>
|
|
124
|
+
</g>
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
if (annotations.length > 0) {
|
|
129
|
+
fullAnnotationWidth += annotationGutter * (annotations.length - 1);
|
|
130
|
+
}
|
|
131
|
+
const iconAnnotationArr = [];
|
|
132
|
+
iconAnnotations.forEach((anno, i) => {
|
|
133
|
+
const x = anno.shapeOffsetX;
|
|
134
|
+
const y = anno.shapeOffsetY;
|
|
135
|
+
iconAnnotationArr.push(
|
|
136
|
+
<g key={i} class="vertex3-iconAnno" data-anno={JSON.stringify(anno)} transform={`translate(${x} ${y})`}>
|
|
137
|
+
<Icon
|
|
138
|
+
{...anno}
|
|
139
|
+
shape={anno.shape ?? "square"}
|
|
140
|
+
imageChar={anno.imageChar}
|
|
141
|
+
imageFontFamily={anno.imageFontFamily}
|
|
142
|
+
cornerRadius={cornerRadius}
|
|
143
|
+
stroke={anno.stroke}
|
|
144
|
+
strokeWidth={anno.strokeWidth}
|
|
145
|
+
/>
|
|
146
|
+
</g>
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const textElement = <g transform={`translate(${textOffsetX} ${annoOffsetY})`}>
|
|
151
|
+
{!showLabel || text === "" ? <circle r={noLabelRadius} stroke={textboxStroke} fill={textFill} /> : <TextBox
|
|
152
|
+
text={text}
|
|
153
|
+
height={textHeight}
|
|
154
|
+
padding={textPadding}
|
|
155
|
+
strokeWidth={textboxStrokeWidth}
|
|
156
|
+
stroke={textboxStroke}
|
|
157
|
+
fill={textboxFill}
|
|
158
|
+
textFill={textFill}
|
|
159
|
+
fontFamily={textFontFamily}
|
|
160
|
+
cornerRadius={cornerRadius}
|
|
161
|
+
/>}
|
|
162
|
+
</g>;
|
|
163
|
+
|
|
164
|
+
const subTextOffsetX = 0;
|
|
165
|
+
const subTextOffsetY = textShapeHeight + (annotationGutter * 2);
|
|
166
|
+
|
|
167
|
+
const subtextElement = subText.text === "" ? null : <g
|
|
168
|
+
transform={`translate(${subTextOffsetX} ${subTextOffsetY})`}
|
|
169
|
+
>
|
|
170
|
+
<TextBox
|
|
171
|
+
fill={subText.fill || "#FFFFFF"}
|
|
172
|
+
textFill={subText.textFill || textFill}
|
|
173
|
+
{...subText}
|
|
174
|
+
height={textHeight}
|
|
175
|
+
padding={textPadding}
|
|
176
|
+
strokeWidth={0}
|
|
177
|
+
stroke={textboxStroke}
|
|
178
|
+
fontFamily={textFontFamily}
|
|
179
|
+
cornerRadius={cornerRadius}
|
|
180
|
+
/>
|
|
181
|
+
</g>;
|
|
182
|
+
return <g>
|
|
183
|
+
<g
|
|
184
|
+
transform={`translate(${shapeOffsetX} ${shapeOffsetY})`}
|
|
185
|
+
>
|
|
186
|
+
<Icon
|
|
187
|
+
{...icon}
|
|
188
|
+
strokeWidth={iconBorderWidth}
|
|
189
|
+
shape="circle"
|
|
190
|
+
height={iconFontSize}
|
|
191
|
+
fill={iconBackgroundColor}
|
|
192
|
+
stroke={iconBorderColor}
|
|
193
|
+
imageFontFamily={iconFontFamily}
|
|
194
|
+
imageChar={iconText}
|
|
195
|
+
imageCharFill={iconFontColor}
|
|
196
|
+
padding={iconPadding}
|
|
197
|
+
xOffset={iconOffsetX}
|
|
198
|
+
yOffset={iconOffsetY}
|
|
199
|
+
cornerRadius={cornerRadius}
|
|
200
|
+
shapeRendering={shapeRendering}
|
|
201
|
+
/>
|
|
202
|
+
{iconAnnotationArr}
|
|
203
|
+
</g>
|
|
204
|
+
<g
|
|
205
|
+
transform={`translate(${-fullAnnotationWidth / 2} ${annoOffsetY})`}
|
|
206
|
+
>
|
|
207
|
+
{textElement}
|
|
208
|
+
{annotationArr}
|
|
209
|
+
</g>
|
|
210
|
+
{subtextElement}
|
|
211
|
+
</g>
|
|
212
|
+
;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export const CentroidVertex4: React.FunctionComponent<IVertex4> = function ({
|
|
216
|
+
categoryID = "",
|
|
217
|
+
text = "",
|
|
218
|
+
textHeight = 12,
|
|
219
|
+
textPadding = 10,
|
|
220
|
+
textFill = "#287EC4",
|
|
221
|
+
textboxFill = "white",
|
|
222
|
+
textboxStroke = "#CCCCCC",
|
|
223
|
+
textboxStrokeWidth = 1,
|
|
224
|
+
textFontFamily = "Verdana",
|
|
225
|
+
annotationGutter = 2,
|
|
226
|
+
annotations = [],
|
|
227
|
+
iconAnnotations = [],
|
|
228
|
+
cornerRadius,
|
|
229
|
+
icon = {},
|
|
230
|
+
subText = {},
|
|
231
|
+
showLabel = true,
|
|
232
|
+
noLabelRadius = 5,
|
|
233
|
+
|
|
234
|
+
iconBorderWidth = 1,
|
|
235
|
+
iconBorderColor = "#333",
|
|
236
|
+
|
|
237
|
+
iconBackgroundColor = "#fff",
|
|
238
|
+
|
|
239
|
+
iconFontColor = "#000",
|
|
240
|
+
iconFontSize=20,
|
|
241
|
+
iconFontFamily="FontAwesome",
|
|
242
|
+
|
|
243
|
+
shapeOffsetX = 0,
|
|
244
|
+
shapeOffsetY = 0,
|
|
245
|
+
iconOffsetX = 0,
|
|
246
|
+
iconOffsetY = 0,
|
|
247
|
+
|
|
248
|
+
iconPadding = 4,
|
|
249
|
+
iconText="?",
|
|
250
|
+
shapeRendering="auto"
|
|
251
|
+
}) {
|
|
252
|
+
icon = {
|
|
253
|
+
height: 91,
|
|
254
|
+
padding: 40,
|
|
255
|
+
imageCharFill: "#555555",
|
|
256
|
+
imageFontFamily: "FontAwesome",
|
|
257
|
+
fill: "#FFCC33",
|
|
258
|
+
stroke: "#DFDFDF",
|
|
259
|
+
imageChar: "?",
|
|
260
|
+
strokeWidth: 4,
|
|
261
|
+
yOffset: -15,
|
|
262
|
+
...icon
|
|
263
|
+
};
|
|
264
|
+
subText = {
|
|
265
|
+
text: "",
|
|
266
|
+
fill: "transparent",
|
|
267
|
+
textFill: "#555555",
|
|
268
|
+
...subText
|
|
269
|
+
};
|
|
270
|
+
const props = {
|
|
271
|
+
categoryID,
|
|
272
|
+
text,
|
|
273
|
+
textHeight,
|
|
274
|
+
textPadding,
|
|
275
|
+
textFill,
|
|
276
|
+
textboxFill,
|
|
277
|
+
textboxStroke,
|
|
278
|
+
textboxStrokeWidth,
|
|
279
|
+
textFontFamily,
|
|
280
|
+
annotationGutter,
|
|
281
|
+
annotations,
|
|
282
|
+
iconAnnotations,
|
|
283
|
+
cornerRadius,
|
|
284
|
+
icon,
|
|
285
|
+
subText,
|
|
286
|
+
showLabel,
|
|
287
|
+
noLabelRadius,
|
|
288
|
+
iconBorderWidth,
|
|
289
|
+
iconBorderColor,
|
|
290
|
+
iconBackgroundColor,
|
|
291
|
+
iconFontColor,
|
|
292
|
+
iconFontSize,
|
|
293
|
+
iconFontFamily,
|
|
294
|
+
shapeOffsetX,
|
|
295
|
+
shapeOffsetY,
|
|
296
|
+
iconOffsetX,
|
|
297
|
+
iconOffsetY,
|
|
298
|
+
iconPadding,
|
|
299
|
+
iconText,
|
|
300
|
+
shapeRendering
|
|
301
|
+
};
|
|
302
|
+
return <Vertex4
|
|
303
|
+
{...props}
|
|
304
|
+
icon={icon}
|
|
305
|
+
subText={subText}
|
|
306
|
+
/>;
|
|
307
|
+
};
|
package/types/ImageChar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageChar.d.ts","sourceRoot":"","sources":["../src/ImageChar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAE9C,UAAU,SAAS;IACf,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"ImageChar.d.ts","sourceRoot":"","sources":["../src/ImageChar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAE9C,UAAU,SAAS;IACf,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAwBxD,CAAC"}
|
package/types/__package__.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const PKG_NAME = "@hpcc-js/react";
|
|
2
|
-
export declare const PKG_VERSION = "2.
|
|
3
|
-
export declare const BUILD_VERSION = "2.
|
|
2
|
+
export declare const PKG_VERSION = "2.51.0";
|
|
3
|
+
export declare const BUILD_VERSION = "2.104.1";
|
|
4
4
|
//# sourceMappingURL=__package__.d.ts.map
|
package/types/edge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../src/edge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAyB9C,MAAM,WAAW,IAAI;IACjB,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../src/edge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAyB9C,MAAM,WAAW,IAAI;IACjB,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAU9C,CAAC"}
|