vis-rails 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vis/rails/version.rb +1 -1
- data/vendor/assets/javascripts/vis.js +26 -26
- metadata +16 -85
- data/vendor/assets/vis/DataSet.js +0 -926
- data/vendor/assets/vis/DataView.js +0 -283
- data/vendor/assets/vis/graph/Edge.js +0 -957
- data/vendor/assets/vis/graph/Graph.js +0 -2291
- data/vendor/assets/vis/graph/Groups.js +0 -80
- data/vendor/assets/vis/graph/Images.js +0 -41
- data/vendor/assets/vis/graph/Node.js +0 -966
- data/vendor/assets/vis/graph/Popup.js +0 -132
- data/vendor/assets/vis/graph/css/graph-manipulation.css +0 -128
- data/vendor/assets/vis/graph/css/graph-navigation.css +0 -66
- data/vendor/assets/vis/graph/dotparser.js +0 -829
- data/vendor/assets/vis/graph/graphMixins/ClusterMixin.js +0 -1143
- data/vendor/assets/vis/graph/graphMixins/HierarchicalLayoutMixin.js +0 -311
- data/vendor/assets/vis/graph/graphMixins/ManipulationMixin.js +0 -576
- data/vendor/assets/vis/graph/graphMixins/MixinLoader.js +0 -199
- data/vendor/assets/vis/graph/graphMixins/NavigationMixin.js +0 -205
- data/vendor/assets/vis/graph/graphMixins/SectorsMixin.js +0 -552
- data/vendor/assets/vis/graph/graphMixins/SelectionMixin.js +0 -648
- data/vendor/assets/vis/graph/graphMixins/physics/BarnesHut.js +0 -398
- data/vendor/assets/vis/graph/graphMixins/physics/HierarchialRepulsion.js +0 -64
- data/vendor/assets/vis/graph/graphMixins/physics/PhysicsMixin.js +0 -697
- data/vendor/assets/vis/graph/graphMixins/physics/Repulsion.js +0 -66
- data/vendor/assets/vis/graph/img/acceptDeleteIcon.png +0 -0
- data/vendor/assets/vis/graph/img/addNodeIcon.png +0 -0
- data/vendor/assets/vis/graph/img/backIcon.png +0 -0
- data/vendor/assets/vis/graph/img/connectIcon.png +0 -0
- data/vendor/assets/vis/graph/img/cross.png +0 -0
- data/vendor/assets/vis/graph/img/cross2.png +0 -0
- data/vendor/assets/vis/graph/img/deleteIcon.png +0 -0
- data/vendor/assets/vis/graph/img/downArrow.png +0 -0
- data/vendor/assets/vis/graph/img/editIcon.png +0 -0
- data/vendor/assets/vis/graph/img/leftArrow.png +0 -0
- data/vendor/assets/vis/graph/img/minus.png +0 -0
- data/vendor/assets/vis/graph/img/plus.png +0 -0
- data/vendor/assets/vis/graph/img/rightArrow.png +0 -0
- data/vendor/assets/vis/graph/img/upArrow.png +0 -0
- data/vendor/assets/vis/graph/img/zoomExtends.png +0 -0
- data/vendor/assets/vis/graph/shapes.js +0 -225
- data/vendor/assets/vis/graph3d/Graph3d.js +0 -3306
- data/vendor/assets/vis/module/exports.js +0 -65
- data/vendor/assets/vis/module/header.js +0 -24
- data/vendor/assets/vis/module/imports.js +0 -31
- data/vendor/assets/vis/shim.js +0 -252
- data/vendor/assets/vis/timeline/Range.js +0 -532
- data/vendor/assets/vis/timeline/TimeStep.js +0 -466
- data/vendor/assets/vis/timeline/Timeline.js +0 -851
- data/vendor/assets/vis/timeline/component/Component.js +0 -52
- data/vendor/assets/vis/timeline/component/CurrentTime.js +0 -128
- data/vendor/assets/vis/timeline/component/CustomTime.js +0 -182
- data/vendor/assets/vis/timeline/component/Group.js +0 -470
- data/vendor/assets/vis/timeline/component/ItemSet.js +0 -1332
- data/vendor/assets/vis/timeline/component/TimeAxis.js +0 -389
- data/vendor/assets/vis/timeline/component/css/animation.css +0 -33
- data/vendor/assets/vis/timeline/component/css/currenttime.css +0 -5
- data/vendor/assets/vis/timeline/component/css/customtime.css +0 -6
- data/vendor/assets/vis/timeline/component/css/item.css +0 -107
- data/vendor/assets/vis/timeline/component/css/itemset.css +0 -33
- data/vendor/assets/vis/timeline/component/css/labelset.css +0 -36
- data/vendor/assets/vis/timeline/component/css/panel.css +0 -71
- data/vendor/assets/vis/timeline/component/css/timeaxis.css +0 -48
- data/vendor/assets/vis/timeline/component/css/timeline.css +0 -2
- data/vendor/assets/vis/timeline/component/item/Item.js +0 -139
- data/vendor/assets/vis/timeline/component/item/ItemBox.js +0 -230
- data/vendor/assets/vis/timeline/component/item/ItemPoint.js +0 -190
- data/vendor/assets/vis/timeline/component/item/ItemRange.js +0 -262
- data/vendor/assets/vis/timeline/component/item/ItemRangeOverflow.js +0 -57
- data/vendor/assets/vis/timeline/img/delete.png +0 -0
- data/vendor/assets/vis/timeline/stack.js +0 -112
- data/vendor/assets/vis/util.js +0 -990
@@ -1,190 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @constructor ItemPoint
|
3
|
-
* @extends Item
|
4
|
-
* @param {Object} data Object containing parameters start
|
5
|
-
* content, className.
|
6
|
-
* @param {{toScreen: function, toTime: function}} conversion
|
7
|
-
* Conversion functions from time to screen and vice versa
|
8
|
-
* @param {Object} [options] Configuration options
|
9
|
-
* // TODO: describe available options
|
10
|
-
*/
|
11
|
-
function ItemPoint (data, conversion, options) {
|
12
|
-
this.props = {
|
13
|
-
dot: {
|
14
|
-
top: 0,
|
15
|
-
width: 0,
|
16
|
-
height: 0
|
17
|
-
},
|
18
|
-
content: {
|
19
|
-
height: 0,
|
20
|
-
marginLeft: 0
|
21
|
-
}
|
22
|
-
};
|
23
|
-
|
24
|
-
// validate data
|
25
|
-
if (data) {
|
26
|
-
if (data.start == undefined) {
|
27
|
-
throw new Error('Property "start" missing in item ' + data);
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
Item.call(this, data, conversion, options);
|
32
|
-
}
|
33
|
-
|
34
|
-
ItemPoint.prototype = new Item (null, null, null);
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Check whether this item is visible inside given range
|
38
|
-
* @returns {{start: Number, end: Number}} range with a timestamp for start and end
|
39
|
-
* @returns {boolean} True if visible
|
40
|
-
*/
|
41
|
-
ItemPoint.prototype.isVisible = function(range) {
|
42
|
-
// determine visibility
|
43
|
-
// TODO: account for the real width of the item. Right now we just add 1/4 to the window
|
44
|
-
var interval = (range.end - range.start) / 4;
|
45
|
-
return (this.data.start > range.start - interval) && (this.data.start < range.end + interval);
|
46
|
-
};
|
47
|
-
|
48
|
-
/**
|
49
|
-
* Repaint the item
|
50
|
-
*/
|
51
|
-
ItemPoint.prototype.redraw = function() {
|
52
|
-
var dom = this.dom;
|
53
|
-
if (!dom) {
|
54
|
-
// create DOM
|
55
|
-
this.dom = {};
|
56
|
-
dom = this.dom;
|
57
|
-
|
58
|
-
// background box
|
59
|
-
dom.point = document.createElement('div');
|
60
|
-
// className is updated in redraw()
|
61
|
-
|
62
|
-
// contents box, right from the dot
|
63
|
-
dom.content = document.createElement('div');
|
64
|
-
dom.content.className = 'content';
|
65
|
-
dom.point.appendChild(dom.content);
|
66
|
-
|
67
|
-
// dot at start
|
68
|
-
dom.dot = document.createElement('div');
|
69
|
-
dom.point.appendChild(dom.dot);
|
70
|
-
|
71
|
-
// attach this item as attribute
|
72
|
-
dom.point['timeline-item'] = this;
|
73
|
-
}
|
74
|
-
|
75
|
-
// append DOM to parent DOM
|
76
|
-
if (!this.parent) {
|
77
|
-
throw new Error('Cannot redraw item: no parent attached');
|
78
|
-
}
|
79
|
-
if (!dom.point.parentNode) {
|
80
|
-
var foreground = this.parent.dom.foreground;
|
81
|
-
if (!foreground) {
|
82
|
-
throw new Error('Cannot redraw time axis: parent has no foreground container element');
|
83
|
-
}
|
84
|
-
foreground.appendChild(dom.point);
|
85
|
-
}
|
86
|
-
this.displayed = true;
|
87
|
-
|
88
|
-
// update contents
|
89
|
-
if (this.data.content != this.content) {
|
90
|
-
this.content = this.data.content;
|
91
|
-
if (this.content instanceof Element) {
|
92
|
-
dom.content.innerHTML = '';
|
93
|
-
dom.content.appendChild(this.content);
|
94
|
-
}
|
95
|
-
else if (this.data.content != undefined) {
|
96
|
-
dom.content.innerHTML = this.content;
|
97
|
-
}
|
98
|
-
else {
|
99
|
-
throw new Error('Property "content" missing in item ' + this.data.id);
|
100
|
-
}
|
101
|
-
|
102
|
-
this.dirty = true;
|
103
|
-
}
|
104
|
-
|
105
|
-
// update class
|
106
|
-
var className = (this.data.className? ' ' + this.data.className : '') +
|
107
|
-
(this.selected ? ' selected' : '');
|
108
|
-
if (this.className != className) {
|
109
|
-
this.className = className;
|
110
|
-
dom.point.className = 'item point' + className;
|
111
|
-
dom.dot.className = 'item dot' + className;
|
112
|
-
|
113
|
-
this.dirty = true;
|
114
|
-
}
|
115
|
-
|
116
|
-
// recalculate size
|
117
|
-
if (this.dirty) {
|
118
|
-
this.width = dom.point.offsetWidth;
|
119
|
-
this.height = dom.point.offsetHeight;
|
120
|
-
this.props.dot.width = dom.dot.offsetWidth;
|
121
|
-
this.props.dot.height = dom.dot.offsetHeight;
|
122
|
-
this.props.content.height = dom.content.offsetHeight;
|
123
|
-
|
124
|
-
// resize contents
|
125
|
-
dom.content.style.marginLeft = 2 * this.props.dot.width + 'px';
|
126
|
-
//dom.content.style.marginRight = ... + 'px'; // TODO: margin right
|
127
|
-
|
128
|
-
dom.dot.style.top = ((this.height - this.props.dot.height) / 2) + 'px';
|
129
|
-
dom.dot.style.left = (this.props.dot.width / 2) + 'px';
|
130
|
-
|
131
|
-
this.dirty = false;
|
132
|
-
}
|
133
|
-
|
134
|
-
this._repaintDeleteButton(dom.point);
|
135
|
-
};
|
136
|
-
|
137
|
-
/**
|
138
|
-
* Show the item in the DOM (when not already visible). The items DOM will
|
139
|
-
* be created when needed.
|
140
|
-
*/
|
141
|
-
ItemPoint.prototype.show = function() {
|
142
|
-
if (!this.displayed) {
|
143
|
-
this.redraw();
|
144
|
-
}
|
145
|
-
};
|
146
|
-
|
147
|
-
/**
|
148
|
-
* Hide the item from the DOM (when visible)
|
149
|
-
*/
|
150
|
-
ItemPoint.prototype.hide = function() {
|
151
|
-
if (this.displayed) {
|
152
|
-
if (this.dom.point.parentNode) {
|
153
|
-
this.dom.point.parentNode.removeChild(this.dom.point);
|
154
|
-
}
|
155
|
-
|
156
|
-
this.top = null;
|
157
|
-
this.left = null;
|
158
|
-
|
159
|
-
this.displayed = false;
|
160
|
-
}
|
161
|
-
};
|
162
|
-
|
163
|
-
/**
|
164
|
-
* Reposition the item horizontally
|
165
|
-
* @Override
|
166
|
-
*/
|
167
|
-
ItemPoint.prototype.repositionX = function() {
|
168
|
-
var start = this.conversion.toScreen(this.data.start);
|
169
|
-
|
170
|
-
this.left = start - this.props.dot.width;
|
171
|
-
|
172
|
-
// reposition point
|
173
|
-
this.dom.point.style.left = this.left + 'px';
|
174
|
-
};
|
175
|
-
|
176
|
-
/**
|
177
|
-
* Reposition the item vertically
|
178
|
-
* @Override
|
179
|
-
*/
|
180
|
-
ItemPoint.prototype.repositionY = function() {
|
181
|
-
var orientation = this.options.orientation,
|
182
|
-
point = this.dom.point;
|
183
|
-
|
184
|
-
if (orientation == 'top') {
|
185
|
-
point.style.top = this.top + 'px';
|
186
|
-
}
|
187
|
-
else {
|
188
|
-
point.style.top = (this.parent.height - this.top - this.height) + 'px';
|
189
|
-
}
|
190
|
-
};
|
@@ -1,262 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @constructor ItemRange
|
3
|
-
* @extends Item
|
4
|
-
* @param {Object} data Object containing parameters start, end
|
5
|
-
* content, className.
|
6
|
-
* @param {{toScreen: function, toTime: function}} conversion
|
7
|
-
* Conversion functions from time to screen and vice versa
|
8
|
-
* @param {Object} [options] Configuration options
|
9
|
-
* // TODO: describe options
|
10
|
-
*/
|
11
|
-
function ItemRange (data, conversion, options) {
|
12
|
-
this.props = {
|
13
|
-
content: {
|
14
|
-
width: 0
|
15
|
-
}
|
16
|
-
};
|
17
|
-
|
18
|
-
// validate data
|
19
|
-
if (data) {
|
20
|
-
if (data.start == undefined) {
|
21
|
-
throw new Error('Property "start" missing in item ' + data.id);
|
22
|
-
}
|
23
|
-
if (data.end == undefined) {
|
24
|
-
throw new Error('Property "end" missing in item ' + data.id);
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
Item.call(this, data, conversion, options);
|
29
|
-
}
|
30
|
-
|
31
|
-
ItemRange.prototype = new Item (null, null, null);
|
32
|
-
|
33
|
-
ItemRange.prototype.baseClassName = 'item range';
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Check whether this item is visible inside given range
|
37
|
-
* @returns {{start: Number, end: Number}} range with a timestamp for start and end
|
38
|
-
* @returns {boolean} True if visible
|
39
|
-
*/
|
40
|
-
ItemRange.prototype.isVisible = function(range) {
|
41
|
-
// determine visibility
|
42
|
-
return (this.data.start < range.end) && (this.data.end > range.start);
|
43
|
-
};
|
44
|
-
|
45
|
-
/**
|
46
|
-
* Repaint the item
|
47
|
-
*/
|
48
|
-
ItemRange.prototype.redraw = function() {
|
49
|
-
var dom = this.dom;
|
50
|
-
if (!dom) {
|
51
|
-
// create DOM
|
52
|
-
this.dom = {};
|
53
|
-
dom = this.dom;
|
54
|
-
|
55
|
-
// background box
|
56
|
-
dom.box = document.createElement('div');
|
57
|
-
// className is updated in redraw()
|
58
|
-
|
59
|
-
// contents box
|
60
|
-
dom.content = document.createElement('div');
|
61
|
-
dom.content.className = 'content';
|
62
|
-
dom.box.appendChild(dom.content);
|
63
|
-
|
64
|
-
// attach this item as attribute
|
65
|
-
dom.box['timeline-item'] = this;
|
66
|
-
}
|
67
|
-
|
68
|
-
// append DOM to parent DOM
|
69
|
-
if (!this.parent) {
|
70
|
-
throw new Error('Cannot redraw item: no parent attached');
|
71
|
-
}
|
72
|
-
if (!dom.box.parentNode) {
|
73
|
-
var foreground = this.parent.dom.foreground;
|
74
|
-
if (!foreground) {
|
75
|
-
throw new Error('Cannot redraw time axis: parent has no foreground container element');
|
76
|
-
}
|
77
|
-
foreground.appendChild(dom.box);
|
78
|
-
}
|
79
|
-
this.displayed = true;
|
80
|
-
|
81
|
-
// update contents
|
82
|
-
if (this.data.content != this.content) {
|
83
|
-
this.content = this.data.content;
|
84
|
-
if (this.content instanceof Element) {
|
85
|
-
dom.content.innerHTML = '';
|
86
|
-
dom.content.appendChild(this.content);
|
87
|
-
}
|
88
|
-
else if (this.data.content != undefined) {
|
89
|
-
dom.content.innerHTML = this.content;
|
90
|
-
}
|
91
|
-
else {
|
92
|
-
throw new Error('Property "content" missing in item ' + this.data.id);
|
93
|
-
}
|
94
|
-
|
95
|
-
this.dirty = true;
|
96
|
-
}
|
97
|
-
|
98
|
-
// update class
|
99
|
-
var className = (this.data.className ? (' ' + this.data.className) : '') +
|
100
|
-
(this.selected ? ' selected' : '');
|
101
|
-
if (this.className != className) {
|
102
|
-
this.className = className;
|
103
|
-
dom.box.className = this.baseClassName + className;
|
104
|
-
|
105
|
-
this.dirty = true;
|
106
|
-
}
|
107
|
-
|
108
|
-
// recalculate size
|
109
|
-
if (this.dirty) {
|
110
|
-
this.props.content.width = this.dom.content.offsetWidth;
|
111
|
-
this.height = this.dom.box.offsetHeight;
|
112
|
-
|
113
|
-
this.dirty = false;
|
114
|
-
}
|
115
|
-
|
116
|
-
this._repaintDeleteButton(dom.box);
|
117
|
-
this._repaintDragLeft();
|
118
|
-
this._repaintDragRight();
|
119
|
-
};
|
120
|
-
|
121
|
-
/**
|
122
|
-
* Show the item in the DOM (when not already visible). The items DOM will
|
123
|
-
* be created when needed.
|
124
|
-
*/
|
125
|
-
ItemRange.prototype.show = function() {
|
126
|
-
if (!this.displayed) {
|
127
|
-
this.redraw();
|
128
|
-
}
|
129
|
-
};
|
130
|
-
|
131
|
-
/**
|
132
|
-
* Hide the item from the DOM (when visible)
|
133
|
-
* @return {Boolean} changed
|
134
|
-
*/
|
135
|
-
ItemRange.prototype.hide = function() {
|
136
|
-
if (this.displayed) {
|
137
|
-
var box = this.dom.box;
|
138
|
-
|
139
|
-
if (box.parentNode) {
|
140
|
-
box.parentNode.removeChild(box);
|
141
|
-
}
|
142
|
-
|
143
|
-
this.top = null;
|
144
|
-
this.left = null;
|
145
|
-
|
146
|
-
this.displayed = false;
|
147
|
-
}
|
148
|
-
};
|
149
|
-
|
150
|
-
/**
|
151
|
-
* Reposition the item horizontally
|
152
|
-
* @Override
|
153
|
-
*/
|
154
|
-
ItemRange.prototype.repositionX = function() {
|
155
|
-
var props = this.props,
|
156
|
-
parentWidth = this.parent.width,
|
157
|
-
start = this.conversion.toScreen(this.data.start),
|
158
|
-
end = this.conversion.toScreen(this.data.end),
|
159
|
-
padding = this.options.padding,
|
160
|
-
contentLeft;
|
161
|
-
|
162
|
-
// limit the width of the this, as browsers cannot draw very wide divs
|
163
|
-
if (start < -parentWidth) {
|
164
|
-
start = -parentWidth;
|
165
|
-
}
|
166
|
-
if (end > 2 * parentWidth) {
|
167
|
-
end = 2 * parentWidth;
|
168
|
-
}
|
169
|
-
|
170
|
-
// when range exceeds left of the window, position the contents at the left of the visible area
|
171
|
-
if (start < 0) {
|
172
|
-
contentLeft = Math.min(-start,
|
173
|
-
(end - start - props.content.width - 2 * padding));
|
174
|
-
// TODO: remove the need for options.padding. it's terrible.
|
175
|
-
}
|
176
|
-
else {
|
177
|
-
contentLeft = 0;
|
178
|
-
}
|
179
|
-
|
180
|
-
this.left = start;
|
181
|
-
this.width = Math.max(end - start, 1);
|
182
|
-
|
183
|
-
this.dom.box.style.left = this.left + 'px';
|
184
|
-
this.dom.box.style.width = this.width + 'px';
|
185
|
-
this.dom.content.style.left = contentLeft + 'px';
|
186
|
-
};
|
187
|
-
|
188
|
-
/**
|
189
|
-
* Reposition the item vertically
|
190
|
-
* @Override
|
191
|
-
*/
|
192
|
-
ItemRange.prototype.repositionY = function() {
|
193
|
-
var orientation = this.options.orientation,
|
194
|
-
box = this.dom.box;
|
195
|
-
|
196
|
-
if (orientation == 'top') {
|
197
|
-
box.style.top = this.top + 'px';
|
198
|
-
}
|
199
|
-
else {
|
200
|
-
box.style.top = (this.parent.height - this.top - this.height) + 'px';
|
201
|
-
}
|
202
|
-
};
|
203
|
-
|
204
|
-
/**
|
205
|
-
* Repaint a drag area on the left side of the range when the range is selected
|
206
|
-
* @protected
|
207
|
-
*/
|
208
|
-
ItemRange.prototype._repaintDragLeft = function () {
|
209
|
-
if (this.selected && this.options.editable.updateTime && !this.dom.dragLeft) {
|
210
|
-
// create and show drag area
|
211
|
-
var dragLeft = document.createElement('div');
|
212
|
-
dragLeft.className = 'drag-left';
|
213
|
-
dragLeft.dragLeftItem = this;
|
214
|
-
|
215
|
-
// TODO: this should be redundant?
|
216
|
-
Hammer(dragLeft, {
|
217
|
-
preventDefault: true
|
218
|
-
}).on('drag', function () {
|
219
|
-
//console.log('drag left')
|
220
|
-
});
|
221
|
-
|
222
|
-
this.dom.box.appendChild(dragLeft);
|
223
|
-
this.dom.dragLeft = dragLeft;
|
224
|
-
}
|
225
|
-
else if (!this.selected && this.dom.dragLeft) {
|
226
|
-
// delete drag area
|
227
|
-
if (this.dom.dragLeft.parentNode) {
|
228
|
-
this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft);
|
229
|
-
}
|
230
|
-
this.dom.dragLeft = null;
|
231
|
-
}
|
232
|
-
};
|
233
|
-
|
234
|
-
/**
|
235
|
-
* Repaint a drag area on the right side of the range when the range is selected
|
236
|
-
* @protected
|
237
|
-
*/
|
238
|
-
ItemRange.prototype._repaintDragRight = function () {
|
239
|
-
if (this.selected && this.options.editable.updateTime && !this.dom.dragRight) {
|
240
|
-
// create and show drag area
|
241
|
-
var dragRight = document.createElement('div');
|
242
|
-
dragRight.className = 'drag-right';
|
243
|
-
dragRight.dragRightItem = this;
|
244
|
-
|
245
|
-
// TODO: this should be redundant?
|
246
|
-
Hammer(dragRight, {
|
247
|
-
preventDefault: true
|
248
|
-
}).on('drag', function () {
|
249
|
-
//console.log('drag right')
|
250
|
-
});
|
251
|
-
|
252
|
-
this.dom.box.appendChild(dragRight);
|
253
|
-
this.dom.dragRight = dragRight;
|
254
|
-
}
|
255
|
-
else if (!this.selected && this.dom.dragRight) {
|
256
|
-
// delete drag area
|
257
|
-
if (this.dom.dragRight.parentNode) {
|
258
|
-
this.dom.dragRight.parentNode.removeChild(this.dom.dragRight);
|
259
|
-
}
|
260
|
-
this.dom.dragRight = null;
|
261
|
-
}
|
262
|
-
};
|