@arcblock/ux 2.10.71 → 2.10.72
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/Sparkline/index.d.ts +16 -21
- package/lib/Sparkline/index.js +5 -9
- package/package.json +5 -5
- package/src/Sparkline/index.tsx +10 -12
package/lib/Sparkline/index.d.ts
CHANGED
@@ -1,22 +1,17 @@
|
|
1
|
-
export
|
2
|
-
|
3
|
-
|
1
|
+
export default function sparkline(svg: SVGElement, rawEntries?: number[] | {
|
2
|
+
value: number;
|
3
|
+
}[], options?: {
|
4
|
+
fetch?: (entry: {
|
4
5
|
value: number;
|
5
|
-
}
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
onmouseout?: (event: MouseEvent) => void;
|
18
|
-
spotRadius?: number;
|
19
|
-
cursorWidth?: number;
|
20
|
-
};
|
21
|
-
}
|
22
|
-
export default function sparkline({ svg, entries: _entries, options }: SparklineProps): void;
|
6
|
+
}) => number;
|
7
|
+
interactive?: boolean;
|
8
|
+
onmousemove?: (event: MouseEvent, currentDataPoint: {
|
9
|
+
value: number;
|
10
|
+
index: number;
|
11
|
+
x: number;
|
12
|
+
y: number;
|
13
|
+
}) => void;
|
14
|
+
onmouseout?: (event: MouseEvent) => void;
|
15
|
+
spotRadius?: number;
|
16
|
+
cursorWidth?: number;
|
17
|
+
}): void;
|
package/lib/Sparkline/index.js
CHANGED
@@ -17,24 +17,20 @@ function buildElement(tag, attrs) {
|
|
17
17
|
}
|
18
18
|
return element;
|
19
19
|
}
|
20
|
-
export default function sparkline({
|
21
|
-
svg,
|
22
|
-
entries: _entries = [],
|
23
|
-
options = {}
|
24
|
-
}) {
|
20
|
+
export default function sparkline(svg, rawEntries = [], options = {}) {
|
25
21
|
removeChildren(svg);
|
26
|
-
if (
|
22
|
+
if (rawEntries.length <= 1) {
|
27
23
|
return;
|
28
24
|
}
|
29
25
|
let entries = [];
|
30
|
-
if (typeof
|
31
|
-
entries =
|
26
|
+
if (typeof rawEntries[0] === 'number') {
|
27
|
+
entries = rawEntries.map(entry => {
|
32
28
|
return {
|
33
29
|
value: entry
|
34
30
|
};
|
35
31
|
});
|
36
32
|
} else {
|
37
|
-
entries =
|
33
|
+
entries = rawEntries;
|
38
34
|
}
|
39
35
|
|
40
36
|
// This function will be called whenever the mouse moves
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.10.
|
3
|
+
"version": "2.10.72",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -67,12 +67,12 @@
|
|
67
67
|
"react": ">=18.2.0",
|
68
68
|
"react-router-dom": ">=6.22.3"
|
69
69
|
},
|
70
|
-
"gitHead": "
|
70
|
+
"gitHead": "d86e8264076397fddb47b583423b4081d2e16b5f",
|
71
71
|
"dependencies": {
|
72
72
|
"@arcblock/did-motif": "^1.1.13",
|
73
|
-
"@arcblock/icons": "^2.10.
|
74
|
-
"@arcblock/nft-display": "^2.10.
|
75
|
-
"@arcblock/react-hooks": "^2.10.
|
73
|
+
"@arcblock/icons": "^2.10.72",
|
74
|
+
"@arcblock/nft-display": "^2.10.72",
|
75
|
+
"@arcblock/react-hooks": "^2.10.72",
|
76
76
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
77
77
|
"@fontsource/inter": "^5.0.16",
|
78
78
|
"@fontsource/ubuntu-mono": "^5.0.18",
|
package/src/Sparkline/index.tsx
CHANGED
@@ -22,33 +22,31 @@ function buildElement(tag: string, attrs: Record<string, any>) {
|
|
22
22
|
return element;
|
23
23
|
}
|
24
24
|
|
25
|
-
export
|
26
|
-
svg: SVGElement
|
27
|
-
|
28
|
-
options
|
25
|
+
export default function sparkline(
|
26
|
+
svg: SVGElement,
|
27
|
+
rawEntries: number[] | { value: number }[] = [],
|
28
|
+
options: {
|
29
29
|
fetch?: (entry: { value: number }) => number;
|
30
30
|
interactive?: boolean;
|
31
31
|
onmousemove?: (event: MouseEvent, currentDataPoint: { value: number; index: number; x: number; y: number }) => void;
|
32
32
|
onmouseout?: (event: MouseEvent) => void;
|
33
33
|
spotRadius?: number;
|
34
34
|
cursorWidth?: number;
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
export default function sparkline({ svg, entries: _entries = [], options = {} }: SparklineProps) {
|
35
|
+
} = {}
|
36
|
+
) {
|
39
37
|
removeChildren(svg);
|
40
38
|
|
41
|
-
if (
|
39
|
+
if (rawEntries.length <= 1) {
|
42
40
|
return;
|
43
41
|
}
|
44
42
|
|
45
43
|
let entries: { value: number }[] = [];
|
46
|
-
if (typeof
|
47
|
-
entries = (
|
44
|
+
if (typeof rawEntries[0] === 'number') {
|
45
|
+
entries = (rawEntries as number[]).map((entry) => {
|
48
46
|
return { value: entry };
|
49
47
|
});
|
50
48
|
} else {
|
51
|
-
entries =
|
49
|
+
entries = rawEntries as typeof entries;
|
52
50
|
}
|
53
51
|
|
54
52
|
// This function will be called whenever the mouse moves
|