@yanqirenshi/d3.wireframe 0.0.7 → 0.1.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/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/package.json +45 -35
- package/src/{D3Wireframe.js → Rectum.js} +115 -111
- package/src/components/D3Wireframe.js +9 -0
- package/src/index.js +9 -0
- package/babel.config.js +0 -14
- 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 -85
- 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/jest.config.js +0 -17
- 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
- package/tests/D3Wireframe.test.js +0 -7
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _DataPosition = _interopRequireDefault(require("./DataPosition"));
|
|
8
|
+
var _DataRectangle = _interopRequireDefault(require("./DataRectangle"));
|
|
9
|
+
var _DataBackground = _interopRequireDefault(require("./DataBackground"));
|
|
10
|
+
var _DataStroke = _interopRequireDefault(require("./DataStroke"));
|
|
11
|
+
var _DataFont = _interopRequireDefault(require("./DataFont"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
18
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
19
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
|
+
var ElementFounder = exports["default"] = /*#__PURE__*/function () {
|
|
23
|
+
function ElementFounder(name, params) {
|
|
24
|
+
_classCallCheck(this, ElementFounder);
|
|
25
|
+
this.name = name;
|
|
26
|
+
this.idm = params.idm;
|
|
27
|
+
}
|
|
28
|
+
/* **************************************************************** *
|
|
29
|
+
* Data
|
|
30
|
+
* **************************************************************** */
|
|
31
|
+
return _createClass(ElementFounder, [{
|
|
32
|
+
key: "makeTemplateElement",
|
|
33
|
+
value: function makeTemplateElement(attributes) {
|
|
34
|
+
return _objectSpread(_objectSpread({}, {
|
|
35
|
+
element_type: this.name,
|
|
36
|
+
visible: true,
|
|
37
|
+
_id: null,
|
|
38
|
+
_core: null
|
|
39
|
+
}), attributes);
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
key: "makeCrossReference",
|
|
43
|
+
value: function makeCrossReference(element, core) {
|
|
44
|
+
element._core = core;
|
|
45
|
+
core._element = element;
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: "initElementID",
|
|
49
|
+
value: function initElementID(element, core) {
|
|
50
|
+
element._id = core.id || this.idm.nextID();
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "initElementVisible",
|
|
54
|
+
value: function initElementVisible(element, core) {
|
|
55
|
+
if (core.visible === true || core.visible === false) element.visible = core.visible;
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "initElementParent",
|
|
59
|
+
value: function initElementParent(element, parent) {
|
|
60
|
+
if (parent) element._parent = parent;
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "initElement",
|
|
64
|
+
value: function initElement(element, core, parent) {
|
|
65
|
+
this.makeCrossReference(element, core);
|
|
66
|
+
this.initElementID(element, core);
|
|
67
|
+
this.initElementVisible(element, core);
|
|
68
|
+
this.initElementParent(element, parent);
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "fittingRectangle",
|
|
72
|
+
value: function fittingRectangle(element, core) {
|
|
73
|
+
element.rectangle = _DataRectangle["default"].build(core.rectangle);
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "fittingPosition",
|
|
77
|
+
value: function fittingPosition(element, core) {
|
|
78
|
+
element.position = _DataPosition["default"].build(core.position);
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "fittingBackground",
|
|
82
|
+
value: function fittingBackground(element, core) {
|
|
83
|
+
element.background = _DataBackground["default"].build(core.background);
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "fittingStroke",
|
|
87
|
+
value: function fittingStroke(element, core) {
|
|
88
|
+
element.stroke = _DataStroke["default"].build(core.stroke || element.stroke);
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "fittingFont",
|
|
92
|
+
value: function fittingFont(element, core) {
|
|
93
|
+
element.font = _DataFont["default"].build(core.font);
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
96
|
+
key: "merge",
|
|
97
|
+
value: function merge(core, element) {}
|
|
98
|
+
/* **************************************************************** *
|
|
99
|
+
* Draw
|
|
100
|
+
* **************************************************************** */
|
|
101
|
+
}, {
|
|
102
|
+
key: "stroke",
|
|
103
|
+
value: function stroke(d) {
|
|
104
|
+
if (!d.stroke) return null;
|
|
105
|
+
if (!d.stroke) return '#333';
|
|
106
|
+
return d.stroke.color || '#333';
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
key: "strokeWidth",
|
|
110
|
+
value: function strokeWidth(d) {
|
|
111
|
+
if (!d.stroke) return null;
|
|
112
|
+
if (!d.stroke) return 1;
|
|
113
|
+
return d.stroke.width || 1;
|
|
114
|
+
}
|
|
115
|
+
}]);
|
|
116
|
+
}();
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _ElementFounder2 = _interopRequireDefault(require("./ElementFounder"));
|
|
9
|
+
var _ElementLabel = _interopRequireDefault(require("./ElementLabel"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
12
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
13
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
17
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
18
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
21
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
22
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
23
|
+
var ElementFrame = exports["default"] = /*#__PURE__*/function (_ElementFounder) {
|
|
24
|
+
function ElementFrame(params) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, ElementFrame);
|
|
27
|
+
_this = _callSuper(this, ElementFrame, ['frame', params]);
|
|
28
|
+
_this.label = new _ElementLabel["default"]({
|
|
29
|
+
idm: _this.idm
|
|
30
|
+
});
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
/* **************************************************************** *
|
|
34
|
+
* Data
|
|
35
|
+
* **************************************************************** */
|
|
36
|
+
_inherits(ElementFrame, _ElementFounder);
|
|
37
|
+
return _createClass(ElementFrame, [{
|
|
38
|
+
key: "templateElement",
|
|
39
|
+
value: function templateElement() {
|
|
40
|
+
return this.makeTemplateElement({
|
|
41
|
+
rectangle: null,
|
|
42
|
+
position: null,
|
|
43
|
+
background: null,
|
|
44
|
+
stroke: null,
|
|
45
|
+
labels: [],
|
|
46
|
+
children: []
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "makeElement",
|
|
51
|
+
value: function makeElement(core, parent) {
|
|
52
|
+
var element = this.templateElement();
|
|
53
|
+
this.initElement(element, core, parent);
|
|
54
|
+
this.fittingRectangle(element, core);
|
|
55
|
+
this.fittingPosition(element, core);
|
|
56
|
+
this.fittingBackground(element, core);
|
|
57
|
+
this.fittingStroke(element, core);
|
|
58
|
+
element.labels = this.label.makeElements(core.labels);
|
|
59
|
+
return element;
|
|
60
|
+
}
|
|
61
|
+
/* **************************************************************** *
|
|
62
|
+
* Draw
|
|
63
|
+
* **************************************************************** */
|
|
64
|
+
}, {
|
|
65
|
+
key: "drawAdd",
|
|
66
|
+
value: function drawAdd(place, data) {
|
|
67
|
+
var _this2 = this;
|
|
68
|
+
var g = place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
69
|
+
return d._id;
|
|
70
|
+
}).enter().append('g').attr('class', this.name).attr("transform", function (d) {
|
|
71
|
+
return "translate(".concat(d.position.x, ", ").concat(d.position.y, ")");
|
|
72
|
+
});
|
|
73
|
+
g.append('rect').attr('class', 'base').attr('width', function (d) {
|
|
74
|
+
return d.rectangle.w;
|
|
75
|
+
}).attr('height', function (d) {
|
|
76
|
+
return d.rectangle.h;
|
|
77
|
+
}).attr('rx', function (d) {
|
|
78
|
+
return d.round || 0;
|
|
79
|
+
}).attr('ry', function (d) {
|
|
80
|
+
return d.round || 0;
|
|
81
|
+
}).attr('fill', function (d) {
|
|
82
|
+
return d.background.color;
|
|
83
|
+
}).attr('stroke', function (d) {
|
|
84
|
+
return _this2.stroke(d);
|
|
85
|
+
}).attr('stroke-width', function (d) {
|
|
86
|
+
return _this2.strokeWidth(d);
|
|
87
|
+
});
|
|
88
|
+
this.label.draw(g, data);
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "drawUpdate",
|
|
92
|
+
value: function drawUpdate(place, data) {
|
|
93
|
+
place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
94
|
+
return d._id;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "drawDelete",
|
|
99
|
+
value: function drawDelete(place, data) {
|
|
100
|
+
place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
101
|
+
return d._id;
|
|
102
|
+
}).exit().remove();
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "draw",
|
|
106
|
+
value: function draw(place, data) {
|
|
107
|
+
// this.drawDelete(place, data);
|
|
108
|
+
this.drawUpdate(place, data);
|
|
109
|
+
this.drawAdd(place, data);
|
|
110
|
+
}
|
|
111
|
+
}]);
|
|
112
|
+
}(_ElementFounder2["default"]);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _ElementFounder2 = _interopRequireDefault(require("./ElementFounder"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
17
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
18
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
20
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
21
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
22
|
+
var ElementIcon = exports["default"] = /*#__PURE__*/function (_ElementFounder) {
|
|
23
|
+
function ElementIcon(params) {
|
|
24
|
+
var _this;
|
|
25
|
+
_classCallCheck(this, ElementIcon);
|
|
26
|
+
_this = _callSuper(this, ElementIcon, ['icon', params]);
|
|
27
|
+
_this.idm = params.idm;
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
/* **************************************************************** *
|
|
31
|
+
* Data
|
|
32
|
+
* **************************************************************** */
|
|
33
|
+
_inherits(ElementIcon, _ElementFounder);
|
|
34
|
+
return _createClass(ElementIcon, [{
|
|
35
|
+
key: "templateElement",
|
|
36
|
+
value: function templateElement() {
|
|
37
|
+
return this.makeTemplateElement({
|
|
38
|
+
position: null,
|
|
39
|
+
rectangle: null,
|
|
40
|
+
url: null
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "makeElement",
|
|
45
|
+
value: function makeElement(core, parent) {
|
|
46
|
+
var element = this.templateElement();
|
|
47
|
+
this.initElement(element, core, parent);
|
|
48
|
+
this.fittingPosition(element, core);
|
|
49
|
+
if (core.size) this.fittingRectangle(element, core);else element.size = parent.rectangle;
|
|
50
|
+
if (core.url) element.url = core.url;
|
|
51
|
+
return element;
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "makeElements",
|
|
55
|
+
value: function makeElements(icons, parent) {
|
|
56
|
+
var _this2 = this;
|
|
57
|
+
if (!icons) return [];
|
|
58
|
+
return icons.map(function (icon) {
|
|
59
|
+
return _this2.makeElement(icon, parent);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/* **************************************************************** *
|
|
63
|
+
* Draw
|
|
64
|
+
* **************************************************************** */
|
|
65
|
+
}, {
|
|
66
|
+
key: "draw",
|
|
67
|
+
value: function draw(place, data) {
|
|
68
|
+
place.selectAll('image').data(data.icons || [], function (d) {
|
|
69
|
+
return d._id;
|
|
70
|
+
}).enter().append('image').attr('xlink:href', function (d) {
|
|
71
|
+
return d.url;
|
|
72
|
+
}).attr('x', function (d) {
|
|
73
|
+
return d.position && d.position.x || 0;
|
|
74
|
+
}).attr('y', function (d) {
|
|
75
|
+
return d.position && d.position.y || 0;
|
|
76
|
+
}).attr('width', function (d) {
|
|
77
|
+
return d.size && d.size.w || d.rectangle.w;
|
|
78
|
+
}).attr('height', function (d) {
|
|
79
|
+
return d.size && d.size.h || d.rectangle.h;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}]);
|
|
83
|
+
}(_ElementFounder2["default"]);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _ElementFounder2 = _interopRequireDefault(require("./ElementFounder"));
|
|
9
|
+
var _ElementLabel = _interopRequireDefault(require("./ElementLabel"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
12
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
13
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
17
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
18
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
21
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
22
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
23
|
+
var ElementImage = exports["default"] = /*#__PURE__*/function (_ElementFounder) {
|
|
24
|
+
function ElementImage(params) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, ElementImage);
|
|
27
|
+
_this = _callSuper(this, ElementImage, ['image', params]);
|
|
28
|
+
_this.label = new _ElementLabel["default"]({
|
|
29
|
+
idm: _this.idm
|
|
30
|
+
});
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
/* **************************************************************** *
|
|
34
|
+
* Data
|
|
35
|
+
* **************************************************************** */
|
|
36
|
+
_inherits(ElementImage, _ElementFounder);
|
|
37
|
+
return _createClass(ElementImage, [{
|
|
38
|
+
key: "templateElement",
|
|
39
|
+
value: function templateElement() {
|
|
40
|
+
return this.makeTemplateElement({
|
|
41
|
+
rectangle: null,
|
|
42
|
+
position: null,
|
|
43
|
+
background: null,
|
|
44
|
+
stroke: null,
|
|
45
|
+
labels: [],
|
|
46
|
+
children: []
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "makeElement",
|
|
51
|
+
value: function makeElement(core, parent) {
|
|
52
|
+
var element = this.templateElement();
|
|
53
|
+
this.initElement(element, core, parent);
|
|
54
|
+
this.fittingRectangle(element, core);
|
|
55
|
+
this.fittingPosition(element, core);
|
|
56
|
+
this.fittingBackground(element, core);
|
|
57
|
+
this.fittingStroke(element, core);
|
|
58
|
+
element.labels = this.label.makeElements(core.labels);
|
|
59
|
+
return element;
|
|
60
|
+
}
|
|
61
|
+
/* **************************************************************** *
|
|
62
|
+
* Draw
|
|
63
|
+
* **************************************************************** */
|
|
64
|
+
}, {
|
|
65
|
+
key: "drawAdd",
|
|
66
|
+
value: function drawAdd(place, data) {
|
|
67
|
+
var _this2 = this;
|
|
68
|
+
var g = place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
69
|
+
return d._id;
|
|
70
|
+
}).enter().append('g').attr('class', this.name).attr("transform", function (d) {
|
|
71
|
+
return "translate(".concat(d.position.x, ", ").concat(d.position.y, ")");
|
|
72
|
+
});
|
|
73
|
+
g.append('rect').attr('class', 'base').attr('width', function (d) {
|
|
74
|
+
return d.rectangle.w;
|
|
75
|
+
}).attr('height', function (d) {
|
|
76
|
+
return d.rectangle.h;
|
|
77
|
+
}).attr('rx', function (d) {
|
|
78
|
+
return d.round || 0;
|
|
79
|
+
}).attr('ry', function (d) {
|
|
80
|
+
return d.round || 0;
|
|
81
|
+
}).attr('fill', function (d) {
|
|
82
|
+
return d.background.color;
|
|
83
|
+
}).attr('stroke', function (d) {
|
|
84
|
+
return _this2.stroke(d);
|
|
85
|
+
}).attr('stroke-width', function (d) {
|
|
86
|
+
return _this2.strokeWidth(d);
|
|
87
|
+
});
|
|
88
|
+
this.label.draw(g, data);
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "drawUpdate",
|
|
92
|
+
value: function drawUpdate(place, data) {
|
|
93
|
+
place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
94
|
+
return d._id;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "drawDelete",
|
|
99
|
+
value: function drawDelete(place, data) {
|
|
100
|
+
place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
101
|
+
return d._id;
|
|
102
|
+
}).exit().remove();
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "draw",
|
|
106
|
+
value: function draw(place, data) {
|
|
107
|
+
// this.drawDelete(place, data);
|
|
108
|
+
this.drawUpdate(place, data);
|
|
109
|
+
this.drawAdd(place, data);
|
|
110
|
+
}
|
|
111
|
+
}]);
|
|
112
|
+
}(_ElementFounder2["default"]);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _ElementFounder2 = _interopRequireDefault(require("./ElementFounder"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
17
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
18
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
20
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
21
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
22
|
+
var ElementLabel = exports["default"] = /*#__PURE__*/function (_ElementFounder) {
|
|
23
|
+
function ElementLabel(params) {
|
|
24
|
+
_classCallCheck(this, ElementLabel);
|
|
25
|
+
return _callSuper(this, ElementLabel, ['label', params]);
|
|
26
|
+
}
|
|
27
|
+
/* **************************************************************** *
|
|
28
|
+
* Data
|
|
29
|
+
* **************************************************************** */
|
|
30
|
+
_inherits(ElementLabel, _ElementFounder);
|
|
31
|
+
return _createClass(ElementLabel, [{
|
|
32
|
+
key: "templateElement",
|
|
33
|
+
value: function templateElement() {
|
|
34
|
+
return this.makeTemplateElement({
|
|
35
|
+
text: '????????',
|
|
36
|
+
position: null,
|
|
37
|
+
font: null
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "makeElement",
|
|
42
|
+
value: function makeElement(core, parent) {
|
|
43
|
+
var element = this.templateElement();
|
|
44
|
+
this.initElement(element, core, parent);
|
|
45
|
+
if (core.text) element.text = core.text;
|
|
46
|
+
this.fittingPosition(element, core);
|
|
47
|
+
this.fittingFont(element, core);
|
|
48
|
+
return element;
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "makeElements",
|
|
52
|
+
value: function makeElements(labels) {
|
|
53
|
+
var _this = this;
|
|
54
|
+
if (!labels) return [];
|
|
55
|
+
return labels.map(function (d) {
|
|
56
|
+
return _this.makeElement(d);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/* **************************************************************** *
|
|
60
|
+
* Draw
|
|
61
|
+
* **************************************************************** */
|
|
62
|
+
}, {
|
|
63
|
+
key: "draw",
|
|
64
|
+
value: function draw(place, data) {
|
|
65
|
+
place.selectAll('label').data(data.labels, function (d) {
|
|
66
|
+
return d._id;
|
|
67
|
+
}).enter().append("text").attr("x", function (d) {
|
|
68
|
+
return d.position.x;
|
|
69
|
+
}).attr("y", function (d) {
|
|
70
|
+
return d.position.y;
|
|
71
|
+
}).style("font-size", function (d) {
|
|
72
|
+
return "".concat(d.font.size, "px");
|
|
73
|
+
}).style("fill", function (d) {
|
|
74
|
+
return d.font.color;
|
|
75
|
+
}).style("font-weight", function (d) {
|
|
76
|
+
return d.font.weight;
|
|
77
|
+
}).text(function (d) {
|
|
78
|
+
return d.text;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}]);
|
|
82
|
+
}(_ElementFounder2["default"]);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _ElementFounder2 = _interopRequireDefault(require("./ElementFounder"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
17
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
18
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
20
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
21
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
22
|
+
var ElementModal = exports["default"] = /*#__PURE__*/function (_ElementFounder) {
|
|
23
|
+
function ElementModal(params) {
|
|
24
|
+
_classCallCheck(this, ElementModal);
|
|
25
|
+
return _callSuper(this, ElementModal, ['modal', params]);
|
|
26
|
+
}
|
|
27
|
+
/* **************************************************************** *
|
|
28
|
+
* Data
|
|
29
|
+
* **************************************************************** */
|
|
30
|
+
_inherits(ElementModal, _ElementFounder);
|
|
31
|
+
return _createClass(ElementModal, [{
|
|
32
|
+
key: "templateElement",
|
|
33
|
+
value: function templateElement() {
|
|
34
|
+
return this.makeTemplateElement({
|
|
35
|
+
position: null,
|
|
36
|
+
rectangle: null,
|
|
37
|
+
children: []
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "makeElement",
|
|
42
|
+
value: function makeElement(core, parent) {
|
|
43
|
+
var element = this.templateElement();
|
|
44
|
+
this.initElement(element, core, parent);
|
|
45
|
+
this.fittingRectangle(element, core);
|
|
46
|
+
this.fittingPosition(element, core);
|
|
47
|
+
this.fittingBackground(element, core);
|
|
48
|
+
return element;
|
|
49
|
+
}
|
|
50
|
+
/* **************************************************************** *
|
|
51
|
+
* Draw
|
|
52
|
+
* **************************************************************** */
|
|
53
|
+
}, {
|
|
54
|
+
key: "drawAdd",
|
|
55
|
+
value: function drawAdd(place, data) {
|
|
56
|
+
var g = place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
57
|
+
return d._id;
|
|
58
|
+
}).enter().append('g').attr('class', this.name).attr("transform", function (d) {
|
|
59
|
+
return "translate(".concat(d.position.x, ", ").concat(d.position.y, ")");
|
|
60
|
+
});
|
|
61
|
+
g.append('rect').attr('class', 'base').attr('width', function (d) {
|
|
62
|
+
return d.rectangle.w;
|
|
63
|
+
}).attr('height', function (d) {
|
|
64
|
+
return d.rectangle.h;
|
|
65
|
+
}).attr('rx', 0).attr('ry', 0).attr('fill', function (d) {
|
|
66
|
+
return d.background.color;
|
|
67
|
+
}).attr('fill-opacity', function (d) {
|
|
68
|
+
return d.background.opacity;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "drawUpdate",
|
|
73
|
+
value: function drawUpdate(place, data) {
|
|
74
|
+
place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
75
|
+
return d._id;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "drawDelete",
|
|
80
|
+
value: function drawDelete(place, data) {
|
|
81
|
+
place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
82
|
+
return d._id;
|
|
83
|
+
}).exit().remove();
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "draw",
|
|
87
|
+
value: function draw(place, data) {
|
|
88
|
+
// this.drawDelete(place, data);
|
|
89
|
+
this.drawUpdate(place, data);
|
|
90
|
+
this.drawAdd(place, data);
|
|
91
|
+
}
|
|
92
|
+
}]);
|
|
93
|
+
}(_ElementFounder2["default"]);
|