@yanqirenshi/d3.deployment 0.5.2 → 0.6.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.
|
@@ -86,6 +86,7 @@ var Node = exports["default"] = /*#__PURE__*/function () {
|
|
|
86
86
|
color: '#333333'
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
|
+
description: '',
|
|
89
90
|
position: null,
|
|
90
91
|
size: null,
|
|
91
92
|
background: null,
|
|
@@ -103,6 +104,7 @@ var Node = exports["default"] = /*#__PURE__*/function () {
|
|
|
103
104
|
var core = data._core;
|
|
104
105
|
if (core.id || core.id === 0) data._id = core.id;
|
|
105
106
|
if (core.type) data.type = core.type;
|
|
107
|
+
if (core.description) data.description = core.description;
|
|
106
108
|
if (core.link) data.link = core.link;else data.link = {
|
|
107
109
|
url: null
|
|
108
110
|
};
|
|
@@ -37,13 +37,21 @@ var Nodes = exports["default"] = /*#__PURE__*/function () {
|
|
|
37
37
|
}, {
|
|
38
38
|
key: "drawGroup",
|
|
39
39
|
value: function drawGroup(place, data, type) {
|
|
40
|
-
|
|
40
|
+
var groups = place.selectAll('g.' + type).data([data], function (d) {
|
|
41
41
|
return d._id;
|
|
42
42
|
}).enter().append('g').attr('class', type).attr("transform", function (d) {
|
|
43
43
|
return "translate(" + d._position.x + "," + d._position.y + ")";
|
|
44
44
|
}).attr('level', function (d) {
|
|
45
45
|
return d._level;
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
// description はホバーツールチップ(SVG <title>)として表示する
|
|
49
|
+
groups.filter(function (d) {
|
|
50
|
+
return !!d.description;
|
|
51
|
+
}).append('title').text(function (d) {
|
|
52
|
+
return d.description;
|
|
53
|
+
});
|
|
54
|
+
return groups;
|
|
47
55
|
}
|
|
48
56
|
}, {
|
|
49
57
|
key: "drawBody",
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yanqirenshi/d3.deployment",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "See [Documents](https://yanqirenshi.github.io/D3.Deployment/)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"directories": {
|
|
7
|
-
"doc": "docs"
|
|
8
|
-
"example": "example"
|
|
7
|
+
"doc": "docs"
|
|
9
8
|
},
|
|
10
9
|
"peerDependencies": {
|
|
11
10
|
"react": "^18.2.0",
|
package/tests/Rectum.test.js
CHANGED
|
@@ -6,6 +6,7 @@ const NESTED_SAMPLE = () => ({
|
|
|
6
6
|
{
|
|
7
7
|
type: 'NODE', id: 1,
|
|
8
8
|
label: { text: 'P', position: { x: 20, y: 20 } },
|
|
9
|
+
description: '親ノードの説明',
|
|
9
10
|
size: { w: 300, h: 300 }, position: { x: 0, y: 0 },
|
|
10
11
|
children: [
|
|
11
12
|
{
|
|
@@ -76,6 +77,13 @@ test('edges without an explicit id inherit the auto-numbered _id (drag redraw ne
|
|
|
76
77
|
expect(typeof edges[0]._id).toBe('number');
|
|
77
78
|
});
|
|
78
79
|
|
|
80
|
+
test('node description is normalized (kept when given, empty by default)', () => {
|
|
81
|
+
const { data } = buildData();
|
|
82
|
+
|
|
83
|
+
expect(data.nodes.ht[1].description).toBe('親ノードの説明');
|
|
84
|
+
expect(data.nodes.ht[2].description).toBe(''); // 未指定は空文字
|
|
85
|
+
});
|
|
86
|
+
|
|
79
87
|
test('collectSubtree gathers a node and all descendants', () => {
|
|
80
88
|
const { rectum, data } = buildData();
|
|
81
89
|
|