@yanqirenshi/d3.wireframe 0.0.6 → 0.1.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/babel.config.js +10 -14
- package/dist/DataBackground.js +37 -0
- package/dist/DataFont.js +39 -0
- package/dist/DataPosition.js +39 -0
- package/dist/DataRectangle.js +37 -0
- package/dist/DataStroke.js +37 -0
- package/dist/Digestion.js +320 -0
- package/dist/Drawer.js +317 -0
- package/dist/Element.js +98 -0
- package/dist/ElementButton.js +128 -0
- package/dist/ElementDialog.js +112 -0
- package/dist/ElementFounder.js +116 -0
- package/dist/ElementFrame.js +112 -0
- package/dist/ElementIcon.js +83 -0
- package/dist/ElementImage.js +112 -0
- package/dist/ElementLabel.js +82 -0
- package/dist/ElementModal.js +93 -0
- package/dist/Rectum.js +161 -0
- package/dist/components/D3Wireframe.js +16 -0
- package/dist/index.js +16 -0
- package/jest.config.js +23 -17
- package/package.json +41 -35
- package/src/Element.js +1 -1
- package/src/ElementFounder.js +1 -0
- package/src/{D3Wireframe.js → Rectum.js} +115 -111
- package/src/components/D3Wireframe.js +9 -0
- package/src/index.js +9 -0
- package/tests/D3Wireframe.test.js +54 -7
- package/tests/d3-stub.js +4 -0
- package/docs/asset-manifest.json +0 -23
- package/docs/favicon.ico +0 -0
- package/docs/index.html +0 -1
- package/docs/logo192.png +0 -0
- package/docs/logo512.png +0 -0
- package/docs/manifest.json +0 -25
- package/docs/precache-manifest.5f1fad934ed0507dbc92de6788eff788.js +0 -30
- package/docs/robots.txt +0 -3
- package/docs/service-worker.js +0 -39
- package/docs/static/css/main.5f361e03.chunk.css +0 -2
- package/docs/static/css/main.5f361e03.chunk.css.map +0 -1
- package/docs/static/js/2.e2326255.chunk.js +0 -3
- package/docs/static/js/2.e2326255.chunk.js.LICENSE.txt +0 -32
- package/docs/static/js/2.e2326255.chunk.js.map +0 -1
- package/docs/static/js/main.7f51684e.chunk.js +0 -2
- package/docs/static/js/main.7f51684e.chunk.js.map +0 -1
- package/docs/static/js/runtime-main.0c5b98f9.js +0 -2
- package/docs/static/js/runtime-main.0c5b98f9.js.map +0 -1
- package/docs/static/media/logo.5d5d9eef.svg +0 -7
- package/documents/README.md +0 -68
- package/documents/package-lock.json +0 -13792
- package/documents/package.json +0 -34
- package/documents/public/favicon.ico +0 -0
- package/documents/public/index.html +0 -43
- package/documents/public/logo192.png +0 -0
- package/documents/public/logo512.png +0 -0
- package/documents/public/manifest.json +0 -25
- package/documents/public/robots.txt +0 -3
- package/documents/src/App.css +0 -38
- package/documents/src/App.js +0 -26
- package/documents/src/App.test.js +0 -9
- package/documents/src/index.css +0 -13
- package/documents/src/index.js +0 -17
- package/documents/src/logo.svg +0 -7
- package/documents/src/serviceWorker.js +0 -141
- package/documents/src/setupTests.js +0 -5
- package/example/README.md +0 -68
- package/example/package-lock.json +0 -14729
- package/example/package.json +0 -36
- package/example/public/favicon.ico +0 -0
- package/example/public/index.html +0 -43
- package/example/public/logo192.png +0 -0
- package/example/public/logo512.png +0 -0
- package/example/public/manifest.json +0 -25
- package/example/public/robots.txt +0 -3
- package/example/src/App.css +0 -38
- package/example/src/App.js +0 -14
- package/example/src/App.test.js +0 -9
- package/example/src/data/WIREFRAME_DATA.js +0 -11
- package/example/src/data/WIREFRAME_DATA_DIALOG.js +0 -65
- package/example/src/data/WIREFRAME_DATA_FRAME.js +0 -70
- package/example/src/data/WIREFRAME_DATA_MODAL.js +0 -10
- package/example/src/index.css +0 -13
- package/example/src/index.js +0 -17
- package/example/src/js/D3Wireframe.js +0 -111
- package/example/src/js/DataBackground.js +0 -23
- package/example/src/js/DataFont.js +0 -25
- package/example/src/js/DataPosition.js +0 -21
- package/example/src/js/DataRectangle.js +0 -20
- package/example/src/js/DataStroke.js +0 -23
- package/example/src/js/Digestion.js +0 -273
- package/example/src/js/Drawer.js +0 -270
- package/example/src/js/Element.js +0 -67
- package/example/src/js/ElementButton.js +0 -94
- package/example/src/js/ElementDialog.js +0 -77
- package/example/src/js/ElementFounder.js +0 -84
- package/example/src/js/ElementFrame.js +0 -77
- package/example/src/js/ElementIcon.js +0 -56
- package/example/src/js/ElementImage.js +0 -77
- package/example/src/js/ElementLabel.js +0 -51
- package/example/src/js/ElementModal.js +0 -65
- package/example/src/pages/ExampleGraph.js +0 -39
- package/example/src/pages/Explanation.js +0 -43
- package/example/src/pages/PageExample.js +0 -41
- package/example/src/serviceWorker.js +0 -141
- package/example/src/setupTests.js +0 -5
- package/index.js +0 -3
- package/riot.v3/index.html +0 -21
- package/riot.v3/index.js +0 -86
- package/riot.v3/scketch.js +0 -96
- package/riot.v3/wireframe.js +0 -11
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import ElementFounder from './ElementFounder';
|
|
2
|
-
import ElementLabel from './ElementLabel';
|
|
3
|
-
import ElementIcon from './ElementIcon';
|
|
4
|
-
|
|
5
|
-
import STROKE from './DataStroke';
|
|
6
|
-
|
|
7
|
-
export default class ElementButton extends ElementFounder {
|
|
8
|
-
constructor (params) {
|
|
9
|
-
super('button', params);
|
|
10
|
-
|
|
11
|
-
this.label = new ElementLabel({idm:this.idm});
|
|
12
|
-
this.icon = new ElementIcon({idm:this.idm});
|
|
13
|
-
}
|
|
14
|
-
/* **************************************************************** *
|
|
15
|
-
* Data
|
|
16
|
-
* **************************************************************** */
|
|
17
|
-
templateElement () {
|
|
18
|
-
return this.makeTemplateElement({
|
|
19
|
-
round:10,
|
|
20
|
-
stroke: { color: '#afafb0', width: 1 },
|
|
21
|
-
labels: [],
|
|
22
|
-
children: [],
|
|
23
|
-
icon: null,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
makeElement (core, parent) {
|
|
27
|
-
let element = this.templateElement();
|
|
28
|
-
|
|
29
|
-
this.initElement(element, core, parent);
|
|
30
|
-
|
|
31
|
-
if (core.round)
|
|
32
|
-
element.round = core.round;
|
|
33
|
-
|
|
34
|
-
this.fittingRectangle(element, core);
|
|
35
|
-
this.fittingPosition(element, core);
|
|
36
|
-
this.fittingBackground(element, core);
|
|
37
|
-
|
|
38
|
-
if (core.stroke===null)
|
|
39
|
-
element.stroke = null;
|
|
40
|
-
else
|
|
41
|
-
this.fittingStroke(element, core);
|
|
42
|
-
|
|
43
|
-
element.labels = this.label.makeElements (core.labels);
|
|
44
|
-
element.icons = this.icon.makeElements(core.icons, element);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return element;
|
|
48
|
-
}
|
|
49
|
-
mergeCore (core, element) {
|
|
50
|
-
element._core = core;
|
|
51
|
-
core._element = element;
|
|
52
|
-
}
|
|
53
|
-
/* **************************************************************** *
|
|
54
|
-
* Draw
|
|
55
|
-
* **************************************************************** */
|
|
56
|
-
drawAdd (place, data) {
|
|
57
|
-
const g = place.selectAll(`g.${this.name}`)
|
|
58
|
-
.data([data], (d) => { return d._id; })
|
|
59
|
-
.enter()
|
|
60
|
-
.append('g')
|
|
61
|
-
.attr('class', this.name)
|
|
62
|
-
.attr("transform", d => {
|
|
63
|
-
return `translate(${d.position.x}, ${d.position.y})`;
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
g.append('rect')
|
|
67
|
-
.attr('class', 'base')
|
|
68
|
-
.attr('width', d => d.rectangle.w)
|
|
69
|
-
.attr('height', d => d.rectangle.h)
|
|
70
|
-
.attr('rx', d => d.round || 0)
|
|
71
|
-
.attr('ry', d => d.round || 0)
|
|
72
|
-
.attr('fill', d => d.background.color)
|
|
73
|
-
.attr('stroke', d => this.stroke(d))
|
|
74
|
-
.attr('stroke-width', d => this.strokeWidth(d));
|
|
75
|
-
|
|
76
|
-
this.icon.draw(g, data);
|
|
77
|
-
this.label.draw(g, data);
|
|
78
|
-
}
|
|
79
|
-
drawUpdate (place, data) {
|
|
80
|
-
place.selectAll(`g.${this.name}`)
|
|
81
|
-
.data([data], (d) => { return d._id; });
|
|
82
|
-
}
|
|
83
|
-
drawDelete (place, data) {
|
|
84
|
-
place.selectAll(`g.${this.name}`)
|
|
85
|
-
.data([data], (d) => { return d._id; })
|
|
86
|
-
.exit()
|
|
87
|
-
.remove();
|
|
88
|
-
}
|
|
89
|
-
draw (place, data) {
|
|
90
|
-
// this.drawDelete(place, data);
|
|
91
|
-
this.drawUpdate(place, data);
|
|
92
|
-
this.drawAdd(place, data);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import ElementFounder from './ElementFounder';
|
|
2
|
-
import ElementLabel from './ElementLabel';
|
|
3
|
-
|
|
4
|
-
export default class ElementDialog extends ElementFounder {
|
|
5
|
-
constructor (params) {
|
|
6
|
-
super('dialog', params);
|
|
7
|
-
|
|
8
|
-
this.label = new ElementLabel({idm:this.idm});
|
|
9
|
-
}
|
|
10
|
-
/* **************************************************************** *
|
|
11
|
-
* Data
|
|
12
|
-
* **************************************************************** */
|
|
13
|
-
templateElement () {
|
|
14
|
-
return this.makeTemplateElement({
|
|
15
|
-
rectangle: null,
|
|
16
|
-
position: null,
|
|
17
|
-
background: null,
|
|
18
|
-
stroke: null,
|
|
19
|
-
labels: [],
|
|
20
|
-
children: [],
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
makeElement (core, parent) {
|
|
24
|
-
let element = this.templateElement();
|
|
25
|
-
|
|
26
|
-
this.initElement(element, core, parent);
|
|
27
|
-
|
|
28
|
-
this.fittingRectangle(element, core);
|
|
29
|
-
this.fittingPosition(element, core);
|
|
30
|
-
this.fittingBackground(element, core);
|
|
31
|
-
this.fittingStroke(element, core);
|
|
32
|
-
|
|
33
|
-
element.labels = this.label.makeElements (core.labels);
|
|
34
|
-
|
|
35
|
-
return element;
|
|
36
|
-
}
|
|
37
|
-
/* **************************************************************** *
|
|
38
|
-
* Draw
|
|
39
|
-
* **************************************************************** */
|
|
40
|
-
drawAdd (place, data) {
|
|
41
|
-
const g = place.selectAll(`g.${this.name}`)
|
|
42
|
-
.data([data], (d) => { return d._id; })
|
|
43
|
-
.enter()
|
|
44
|
-
.append('g')
|
|
45
|
-
.attr('class', this.name)
|
|
46
|
-
.attr("transform", d => {
|
|
47
|
-
return `translate(${d.position.x}, ${d.position.y})`;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
g.append('rect')
|
|
51
|
-
.attr('class', 'base')
|
|
52
|
-
.attr('width', d => d.rectangle.w)
|
|
53
|
-
.attr('height', d => d.rectangle.h)
|
|
54
|
-
.attr('rx', d => d.round || 0)
|
|
55
|
-
.attr('ry', d => d.round || 0)
|
|
56
|
-
.attr('fill', d => d.background.color)
|
|
57
|
-
.attr('stroke', d => this.stroke(d))
|
|
58
|
-
.attr('stroke-width', d => this.strokeWidth(d));
|
|
59
|
-
|
|
60
|
-
this.label.draw(g, data);
|
|
61
|
-
}
|
|
62
|
-
drawUpdate (place, data) {
|
|
63
|
-
place.selectAll(`g.${this.name}`)
|
|
64
|
-
.data([data], (d) => { return d._id; });
|
|
65
|
-
}
|
|
66
|
-
drawDelete (place, data) {
|
|
67
|
-
place.selectAll(`g.${this.name}`)
|
|
68
|
-
.data([data], (d) => { return d._id; })
|
|
69
|
-
.exit()
|
|
70
|
-
.remove();
|
|
71
|
-
}
|
|
72
|
-
draw (place, data) {
|
|
73
|
-
// this.drawDelete(place, data);
|
|
74
|
-
this.drawUpdate(place, data);
|
|
75
|
-
this.drawAdd(place, data);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import POSITION from './DataPosition';
|
|
2
|
-
import RECTANGLE from './DataRectangle';
|
|
3
|
-
import BACKGROUND from './DataBackground';
|
|
4
|
-
import STROKE from './DataStroke';
|
|
5
|
-
import FONT from './DataFont';
|
|
6
|
-
|
|
7
|
-
export default class ElementFounder {
|
|
8
|
-
constructor (name, params) {
|
|
9
|
-
this.name = name;
|
|
10
|
-
|
|
11
|
-
this.idm = params.idm;
|
|
12
|
-
}
|
|
13
|
-
/* **************************************************************** *
|
|
14
|
-
* Data
|
|
15
|
-
* **************************************************************** */
|
|
16
|
-
makeTemplateElement (attributes) {
|
|
17
|
-
return {
|
|
18
|
-
...{
|
|
19
|
-
element_type: this.name,
|
|
20
|
-
visible: true,
|
|
21
|
-
_id: null,
|
|
22
|
-
_core: null,
|
|
23
|
-
},
|
|
24
|
-
...attributes
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
makeCrossReference (element, core) {
|
|
28
|
-
element._core = core;
|
|
29
|
-
core._element = element;
|
|
30
|
-
}
|
|
31
|
-
initElementID (element, core) {
|
|
32
|
-
element._id = core.id || this.idm.nextID();
|
|
33
|
-
}
|
|
34
|
-
initElementVisible (element, core) {
|
|
35
|
-
if (core.visible===true || core.visible===false)
|
|
36
|
-
element.visible = core.visible;
|
|
37
|
-
}
|
|
38
|
-
initElementParent (element, parent) {
|
|
39
|
-
if (parent)
|
|
40
|
-
element._parent = parent;
|
|
41
|
-
}
|
|
42
|
-
initElement (element, core, parent) {
|
|
43
|
-
this.makeCrossReference(element, core);
|
|
44
|
-
this.initElementID(element, core);
|
|
45
|
-
this.initElementVisible(element, core);
|
|
46
|
-
this.initElementParent(element, parent);
|
|
47
|
-
}
|
|
48
|
-
fittingRectangle (element, core) {
|
|
49
|
-
element.rectangle = RECTANGLE.build(core.rectangle);
|
|
50
|
-
}
|
|
51
|
-
fittingPosition (element, core) {
|
|
52
|
-
element.position = POSITION.build(core.position);
|
|
53
|
-
}
|
|
54
|
-
fittingBackground (element, core) {
|
|
55
|
-
element.background = BACKGROUND.build(core.background);
|
|
56
|
-
}
|
|
57
|
-
fittingStroke (element, core) {
|
|
58
|
-
element.stroke = STROKE.build(core.stroke || element.stroke);
|
|
59
|
-
}
|
|
60
|
-
fittingFont (element, core) {
|
|
61
|
-
element.font = FONT.build(core.font);
|
|
62
|
-
}
|
|
63
|
-
/* **************************************************************** *
|
|
64
|
-
* Draw
|
|
65
|
-
* **************************************************************** */
|
|
66
|
-
stroke (d) {
|
|
67
|
-
if (!d.stroke)
|
|
68
|
-
return null;
|
|
69
|
-
|
|
70
|
-
if (!d.stroke)
|
|
71
|
-
return '#333';
|
|
72
|
-
|
|
73
|
-
return d.stroke.color || '#333';
|
|
74
|
-
}
|
|
75
|
-
strokeWidth (d) {
|
|
76
|
-
if (!d.stroke)
|
|
77
|
-
return null;
|
|
78
|
-
|
|
79
|
-
if (!d.stroke)
|
|
80
|
-
return 1;
|
|
81
|
-
|
|
82
|
-
return d.stroke.width || 1;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import ElementFounder from './ElementFounder';
|
|
2
|
-
import ElementLabel from './ElementLabel';
|
|
3
|
-
|
|
4
|
-
export default class ElementFrame extends ElementFounder {
|
|
5
|
-
constructor (params) {
|
|
6
|
-
super('frame', params);
|
|
7
|
-
|
|
8
|
-
this.label = new ElementLabel({idm:this.idm});
|
|
9
|
-
}
|
|
10
|
-
/* **************************************************************** *
|
|
11
|
-
* Data
|
|
12
|
-
* **************************************************************** */
|
|
13
|
-
templateElement () {
|
|
14
|
-
return this.makeTemplateElement({
|
|
15
|
-
rectangle: null,
|
|
16
|
-
position: null,
|
|
17
|
-
background: null,
|
|
18
|
-
stroke: null,
|
|
19
|
-
labels: [],
|
|
20
|
-
children: [],
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
makeElement (core, parent) {
|
|
24
|
-
let element = this.templateElement();
|
|
25
|
-
|
|
26
|
-
this.initElement(element, core, parent);
|
|
27
|
-
|
|
28
|
-
this.fittingRectangle(element, core);
|
|
29
|
-
this.fittingPosition(element, core);
|
|
30
|
-
this.fittingBackground(element, core);
|
|
31
|
-
this.fittingStroke(element, core);
|
|
32
|
-
|
|
33
|
-
element.labels = this.label.makeElements (core.labels);
|
|
34
|
-
|
|
35
|
-
return element;
|
|
36
|
-
}
|
|
37
|
-
/* **************************************************************** *
|
|
38
|
-
* Draw
|
|
39
|
-
* **************************************************************** */
|
|
40
|
-
drawAdd (place, data) {
|
|
41
|
-
const g = place.selectAll(`g.${this.name}`)
|
|
42
|
-
.data([data], (d) => { return d._id; })
|
|
43
|
-
.enter()
|
|
44
|
-
.append('g')
|
|
45
|
-
.attr('class', this.name)
|
|
46
|
-
.attr("transform", d => {
|
|
47
|
-
return `translate(${d.position.x}, ${d.position.y})`;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
g.append('rect')
|
|
51
|
-
.attr('class', 'base')
|
|
52
|
-
.attr('width', d => d.rectangle.w)
|
|
53
|
-
.attr('height', d => d.rectangle.h)
|
|
54
|
-
.attr('rx', d => d.round || 0)
|
|
55
|
-
.attr('ry', d => d.round || 0)
|
|
56
|
-
.attr('fill', d => d.background.color)
|
|
57
|
-
.attr('stroke', d => this.stroke(d))
|
|
58
|
-
.attr('stroke-width', d => this.strokeWidth(d));
|
|
59
|
-
|
|
60
|
-
this.label.draw(g, data);
|
|
61
|
-
}
|
|
62
|
-
drawUpdate (place, data) {
|
|
63
|
-
place.selectAll(`g.${this.name}`)
|
|
64
|
-
.data([data], (d) => { return d._id; });
|
|
65
|
-
}
|
|
66
|
-
drawDelete (place, data) {
|
|
67
|
-
place.selectAll(`g.${this.name}`)
|
|
68
|
-
.data([data], (d) => { return d._id; })
|
|
69
|
-
.exit()
|
|
70
|
-
.remove();
|
|
71
|
-
}
|
|
72
|
-
draw (place, data) {
|
|
73
|
-
// this.drawDelete(place, data);
|
|
74
|
-
this.drawUpdate(place, data);
|
|
75
|
-
this.drawAdd(place, data);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import ElementFounder from './ElementFounder';
|
|
2
|
-
|
|
3
|
-
export default class ElementIcon extends ElementFounder {
|
|
4
|
-
constructor (params) {
|
|
5
|
-
super('icon', params);
|
|
6
|
-
|
|
7
|
-
this.idm = params.idm;
|
|
8
|
-
}
|
|
9
|
-
/* **************************************************************** *
|
|
10
|
-
* Data
|
|
11
|
-
* **************************************************************** */
|
|
12
|
-
templateElement () {
|
|
13
|
-
return this.makeTemplateElement({
|
|
14
|
-
position: null,
|
|
15
|
-
rectangle: null,
|
|
16
|
-
url: null,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
makeElement (core, parent) {
|
|
20
|
-
let element = this.templateElement();
|
|
21
|
-
|
|
22
|
-
this.initElement(element, core, parent);
|
|
23
|
-
|
|
24
|
-
this.fittingPosition(element, core);
|
|
25
|
-
|
|
26
|
-
if (core.size)
|
|
27
|
-
this.fittingRectangle(element, core);
|
|
28
|
-
else
|
|
29
|
-
element.size = parent.rectangle;
|
|
30
|
-
|
|
31
|
-
if (core.url)
|
|
32
|
-
element.url = core.url;
|
|
33
|
-
|
|
34
|
-
return element;
|
|
35
|
-
}
|
|
36
|
-
makeElements (icons, parent) {
|
|
37
|
-
if (!icons)
|
|
38
|
-
return [];
|
|
39
|
-
|
|
40
|
-
return icons.map(icon => this.makeElement(icon, parent));
|
|
41
|
-
}
|
|
42
|
-
/* **************************************************************** *
|
|
43
|
-
* Draw
|
|
44
|
-
* **************************************************************** */
|
|
45
|
-
draw (place, data) {
|
|
46
|
-
place.selectAll('image')
|
|
47
|
-
.data(data.icons || [], d => d._id)
|
|
48
|
-
.enter()
|
|
49
|
-
.append('image')
|
|
50
|
-
.attr('xlink:href', d => d.url)
|
|
51
|
-
.attr('x', d => (d.position && d.position.x) || 0)
|
|
52
|
-
.attr('y', d => (d.position && d.position.y) || 0)
|
|
53
|
-
.attr('width', d => (d.size && d.size.w) || d.rectangle.w)
|
|
54
|
-
.attr('height', d => (d.size && d.size.h) || d.rectangle.h);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import ElementFounder from './ElementFounder';
|
|
2
|
-
import ElementLabel from './ElementLabel';
|
|
3
|
-
|
|
4
|
-
export default class ElementImage extends ElementFounder {
|
|
5
|
-
constructor (params) {
|
|
6
|
-
super('image', params);
|
|
7
|
-
|
|
8
|
-
this.label = new ElementLabel({idm:this.idm});
|
|
9
|
-
}
|
|
10
|
-
/* **************************************************************** *
|
|
11
|
-
* Data
|
|
12
|
-
* **************************************************************** */
|
|
13
|
-
templateElement () {
|
|
14
|
-
return this.makeTemplateElement({
|
|
15
|
-
rectangle: null,
|
|
16
|
-
position: null,
|
|
17
|
-
background: null,
|
|
18
|
-
stroke: null,
|
|
19
|
-
labels: [],
|
|
20
|
-
children: [],
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
makeElement (core, parent) {
|
|
24
|
-
let element = this.templateElement();
|
|
25
|
-
|
|
26
|
-
this.initElement(element, core, parent);
|
|
27
|
-
|
|
28
|
-
this.fittingRectangle(element, core);
|
|
29
|
-
this.fittingPosition(element, core);
|
|
30
|
-
this.fittingBackground(element, core);
|
|
31
|
-
this.fittingStroke(element, core);
|
|
32
|
-
|
|
33
|
-
element.labels = this.label.makeElements (core.labels);
|
|
34
|
-
|
|
35
|
-
return element;
|
|
36
|
-
}
|
|
37
|
-
/* **************************************************************** *
|
|
38
|
-
* Draw
|
|
39
|
-
* **************************************************************** */
|
|
40
|
-
drawAdd (place, data) {
|
|
41
|
-
const g = place.selectAll(`g.${this.name}`)
|
|
42
|
-
.data([data], (d) => { return d._id; })
|
|
43
|
-
.enter()
|
|
44
|
-
.append('g')
|
|
45
|
-
.attr('class', this.name)
|
|
46
|
-
.attr("transform", d => {
|
|
47
|
-
return `translate(${d.position.x}, ${d.position.y})`;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
g.append('rect')
|
|
51
|
-
.attr('class', 'base')
|
|
52
|
-
.attr('width', d => d.rectangle.w)
|
|
53
|
-
.attr('height', d => d.rectangle.h)
|
|
54
|
-
.attr('rx', d => d.round || 0)
|
|
55
|
-
.attr('ry', d => d.round || 0)
|
|
56
|
-
.attr('fill', d => d.background.color)
|
|
57
|
-
.attr('stroke', d => this.stroke(d))
|
|
58
|
-
.attr('stroke-width', d => this.strokeWidth(d));
|
|
59
|
-
|
|
60
|
-
this.label.draw(g, data);
|
|
61
|
-
}
|
|
62
|
-
drawUpdate (place, data) {
|
|
63
|
-
place.selectAll(`g.${this.name}`)
|
|
64
|
-
.data([data], (d) => { return d._id; });
|
|
65
|
-
}
|
|
66
|
-
drawDelete (place, data) {
|
|
67
|
-
place.selectAll(`g.${this.name}`)
|
|
68
|
-
.data([data], (d) => { return d._id; })
|
|
69
|
-
.exit()
|
|
70
|
-
.remove();
|
|
71
|
-
}
|
|
72
|
-
draw (place, data) {
|
|
73
|
-
// this.drawDelete(place, data);
|
|
74
|
-
this.drawUpdate(place, data);
|
|
75
|
-
this.drawAdd(place, data);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import ElementFounder from './ElementFounder';
|
|
2
|
-
|
|
3
|
-
export default class ElementLabel extends ElementFounder {
|
|
4
|
-
constructor (params) {
|
|
5
|
-
super('label', params);
|
|
6
|
-
}
|
|
7
|
-
/* **************************************************************** *
|
|
8
|
-
* Data
|
|
9
|
-
* **************************************************************** */
|
|
10
|
-
templateElement () {
|
|
11
|
-
return this.makeTemplateElement({
|
|
12
|
-
text: '????????',
|
|
13
|
-
position: null,
|
|
14
|
-
font: null,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
makeElement (core, parent) {
|
|
18
|
-
let element = this.templateElement();
|
|
19
|
-
|
|
20
|
-
this.initElement(element, core, parent);
|
|
21
|
-
|
|
22
|
-
if (core.text)
|
|
23
|
-
element.text = core.text;
|
|
24
|
-
|
|
25
|
-
this.fittingPosition(element, core);
|
|
26
|
-
this.fittingFont(element, core);
|
|
27
|
-
|
|
28
|
-
return element;
|
|
29
|
-
}
|
|
30
|
-
makeElements (labels) {
|
|
31
|
-
if (!labels)
|
|
32
|
-
return [];
|
|
33
|
-
|
|
34
|
-
return labels.map((d) => this.makeElement(d));
|
|
35
|
-
}
|
|
36
|
-
/* **************************************************************** *
|
|
37
|
-
* Draw
|
|
38
|
-
* **************************************************************** */
|
|
39
|
-
draw (place, data) {
|
|
40
|
-
place.selectAll('label')
|
|
41
|
-
.data(data.labels, d => d._id)
|
|
42
|
-
.enter()
|
|
43
|
-
.append("text")
|
|
44
|
-
.attr("x", d => d.position.x)
|
|
45
|
-
.attr("y", d => d.position.y)
|
|
46
|
-
.style("font-size", d => `${d.font.size}px`)
|
|
47
|
-
.style("fill", d => d.font.color)
|
|
48
|
-
.style("font-weight", d => d.font.weight)
|
|
49
|
-
.text(d => d.text);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import ElementFounder from './ElementFounder';
|
|
2
|
-
|
|
3
|
-
export default class ElementModal extends ElementFounder {
|
|
4
|
-
constructor (params) {
|
|
5
|
-
super('modal', params);
|
|
6
|
-
}
|
|
7
|
-
/* **************************************************************** *
|
|
8
|
-
* Data
|
|
9
|
-
* **************************************************************** */
|
|
10
|
-
templateElement () {
|
|
11
|
-
return this.makeTemplateElement({
|
|
12
|
-
position: null,
|
|
13
|
-
rectangle: null,
|
|
14
|
-
children: [],
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
makeElement (core, parent) {
|
|
18
|
-
let element = this.templateElement();
|
|
19
|
-
|
|
20
|
-
this.initElement(element, core, parent);
|
|
21
|
-
|
|
22
|
-
this.fittingRectangle(element, core);
|
|
23
|
-
this.fittingPosition(element, core);
|
|
24
|
-
this.fittingBackground(element, core);
|
|
25
|
-
|
|
26
|
-
return element;
|
|
27
|
-
}
|
|
28
|
-
/* **************************************************************** *
|
|
29
|
-
* Draw
|
|
30
|
-
* **************************************************************** */
|
|
31
|
-
drawAdd (place, data) {
|
|
32
|
-
const g = place.selectAll(`g.${this.name}`)
|
|
33
|
-
.data([data], (d) => { return d._id; })
|
|
34
|
-
.enter()
|
|
35
|
-
.append('g')
|
|
36
|
-
.attr('class', this.name)
|
|
37
|
-
.attr("transform", d => {
|
|
38
|
-
return `translate(${d.position.x}, ${d.position.y})`;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
g.append('rect')
|
|
42
|
-
.attr('class', 'base')
|
|
43
|
-
.attr('width', d => d.rectangle.w)
|
|
44
|
-
.attr('height', d => d.rectangle.h)
|
|
45
|
-
.attr('rx', 0)
|
|
46
|
-
.attr('ry', 0)
|
|
47
|
-
.attr('fill', d => d.background.color)
|
|
48
|
-
.attr('fill-opacity', d => d.background.opacity);
|
|
49
|
-
}
|
|
50
|
-
drawUpdate (place, data) {
|
|
51
|
-
place.selectAll(`g.${this.name}`)
|
|
52
|
-
.data([data], (d) => { return d._id; });
|
|
53
|
-
}
|
|
54
|
-
drawDelete (place, data) {
|
|
55
|
-
place.selectAll(`g.${this.name}`)
|
|
56
|
-
.data([data], (d) => { return d._id; })
|
|
57
|
-
.exit()
|
|
58
|
-
.remove();
|
|
59
|
-
}
|
|
60
|
-
draw (place, data) {
|
|
61
|
-
// this.drawDelete(place, data);
|
|
62
|
-
this.drawUpdate(place, data);
|
|
63
|
-
this.drawAdd(place, data);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
import D3Wireframe from '../js/D3Wireframe.js';
|
|
4
|
-
|
|
5
|
-
function ExampleGraph (props) {
|
|
6
|
-
const [d3graph] = useState(new D3Wireframe().init({
|
|
7
|
-
svg: {
|
|
8
|
-
selector: '#sitemap-graph',
|
|
9
|
-
},
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
d3graph.focus();
|
|
14
|
-
d3graph.data(props.source);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const style = {
|
|
18
|
-
root: {
|
|
19
|
-
background: '#f3f3f3',
|
|
20
|
-
width: '100%',
|
|
21
|
-
height: '777px',
|
|
22
|
-
},
|
|
23
|
-
operators: {
|
|
24
|
-
marginTop: '11px',
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<>
|
|
30
|
-
<div style={style.root}>
|
|
31
|
-
<svg id='sitemap-graph'/>
|
|
32
|
-
</div>
|
|
33
|
-
<div style={style.operators}>
|
|
34
|
-
</div>
|
|
35
|
-
</>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default ExampleGraph;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import Tabs from './Tabs';
|
|
4
|
-
import TabContents from './TabContents';
|
|
5
|
-
|
|
6
|
-
function Explanation (props) {
|
|
7
|
-
const [selected_tab, setSelectedTab] = useState(0);
|
|
8
|
-
|
|
9
|
-
const style = {
|
|
10
|
-
root: {},
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const tabs = [
|
|
14
|
-
{ id: 0, label: 'React Componet' },
|
|
15
|
-
{ id: 1, label: 'Data: Ndoe' },
|
|
16
|
-
{ id: 2, label: 'Data: Edge' },
|
|
17
|
-
{ id: 3, label: 'Usage' },
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
const callback = (action, data) => {
|
|
21
|
-
if (action==='click-tab') {
|
|
22
|
-
setSelectedTab(data);
|
|
23
|
-
return;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div style={style.root}>
|
|
29
|
-
<div>
|
|
30
|
-
<Tabs tabs={tabs}
|
|
31
|
-
selected_tab={selected_tab}
|
|
32
|
-
callback={callback} />
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
<div>
|
|
36
|
-
<TabContents selected_tab={selected_tab}
|
|
37
|
-
graph_data={props.graph_data} />
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default Explanation;
|