vis-rails 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +2 -0
- data/lib/vis/rails/version.rb +1 -1
- data/vendor/assets/javascripts/module/exports-only-timeline.js +55 -0
- data/vendor/assets/javascripts/vis-only-timeline.js +23 -0
- data/vendor/assets/javascripts/vis.js +3 -3
- data/vendor/assets/stylesheets/vis-only-timeline.css +3 -0
- data/vendor/assets/vis/DataSet.js +106 -130
- data/vendor/assets/vis/DataView.js +35 -37
- data/vendor/assets/vis/graph/Edge.js +225 -45
- data/vendor/assets/vis/graph/Graph.js +120 -24
- data/vendor/assets/vis/graph/Node.js +16 -16
- data/vendor/assets/vis/graph/graphMixins/HierarchicalLayoutMixin.js +1 -1
- data/vendor/assets/vis/graph/graphMixins/ManipulationMixin.js +143 -0
- data/vendor/assets/vis/graph/graphMixins/SelectionMixin.js +81 -3
- data/vendor/assets/vis/graph3d/Graph3d.js +3306 -0
- data/vendor/assets/vis/module/exports.js +2 -3
- data/vendor/assets/vis/timeline/Range.js +93 -80
- data/vendor/assets/vis/timeline/Timeline.js +525 -428
- data/vendor/assets/vis/timeline/component/Component.js +19 -53
- data/vendor/assets/vis/timeline/component/CurrentTime.js +57 -25
- data/vendor/assets/vis/timeline/component/CustomTime.js +55 -19
- data/vendor/assets/vis/timeline/component/Group.js +47 -50
- data/vendor/assets/vis/timeline/component/ItemSet.js +402 -206
- data/vendor/assets/vis/timeline/component/TimeAxis.js +112 -169
- data/vendor/assets/vis/timeline/component/css/animation.css +33 -0
- data/vendor/assets/vis/timeline/component/css/currenttime.css +1 -1
- data/vendor/assets/vis/timeline/component/css/customtime.css +1 -1
- data/vendor/assets/vis/timeline/component/css/item.css +1 -11
- data/vendor/assets/vis/timeline/component/css/itemset.css +13 -18
- data/vendor/assets/vis/timeline/component/css/labelset.css +8 -6
- data/vendor/assets/vis/timeline/component/css/panel.css +56 -13
- data/vendor/assets/vis/timeline/component/css/timeaxis.css +15 -8
- data/vendor/assets/vis/timeline/component/item/Item.js +16 -15
- data/vendor/assets/vis/timeline/component/item/ItemBox.js +30 -30
- data/vendor/assets/vis/timeline/component/item/ItemPoint.js +20 -21
- data/vendor/assets/vis/timeline/component/item/ItemRange.js +23 -24
- data/vendor/assets/vis/timeline/component/item/ItemRangeOverflow.js +10 -10
- data/vendor/assets/vis/timeline/stack.js +5 -5
- data/vendor/assets/vis/util.js +81 -35
- metadata +7 -4
- data/vendor/assets/vis/timeline/component/Panel.js +0 -170
- data/vendor/assets/vis/timeline/component/RootPanel.js +0 -176
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vis-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AlexVangelov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: momentjs-rails
|
@@ -87,7 +87,10 @@ files:
|
|
87
87
|
- lib/vis/rails/engine.rb
|
88
88
|
- lib/vis/rails/version.rb
|
89
89
|
- vendor/assets/component/emitter.js
|
90
|
+
- vendor/assets/javascripts/module/exports-only-timeline.js
|
91
|
+
- vendor/assets/javascripts/vis-only-timeline.js
|
90
92
|
- vendor/assets/javascripts/vis.js
|
93
|
+
- vendor/assets/stylesheets/vis-only-timeline.css
|
91
94
|
- vendor/assets/stylesheets/vis.css
|
92
95
|
- vendor/assets/vis/DataSet.js
|
93
96
|
- vendor/assets/vis/DataView.js
|
@@ -127,6 +130,7 @@ files:
|
|
127
130
|
- vendor/assets/vis/graph/img/upArrow.png
|
128
131
|
- vendor/assets/vis/graph/img/zoomExtends.png
|
129
132
|
- vendor/assets/vis/graph/shapes.js
|
133
|
+
- vendor/assets/vis/graph3d/Graph3d.js
|
130
134
|
- vendor/assets/vis/module/exports.js
|
131
135
|
- vendor/assets/vis/module/header.js
|
132
136
|
- vendor/assets/vis/module/imports.js
|
@@ -139,9 +143,8 @@ files:
|
|
139
143
|
- vendor/assets/vis/timeline/component/CustomTime.js
|
140
144
|
- vendor/assets/vis/timeline/component/Group.js
|
141
145
|
- vendor/assets/vis/timeline/component/ItemSet.js
|
142
|
-
- vendor/assets/vis/timeline/component/Panel.js
|
143
|
-
- vendor/assets/vis/timeline/component/RootPanel.js
|
144
146
|
- vendor/assets/vis/timeline/component/TimeAxis.js
|
147
|
+
- vendor/assets/vis/timeline/component/css/animation.css
|
145
148
|
- vendor/assets/vis/timeline/component/css/currenttime.css
|
146
149
|
- vendor/assets/vis/timeline/component/css/customtime.css
|
147
150
|
- vendor/assets/vis/timeline/component/css/item.css
|
@@ -1,170 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* A panel can contain components
|
3
|
-
* @param {Object} [options] Available parameters:
|
4
|
-
* {String | Number | function} [left]
|
5
|
-
* {String | Number | function} [top]
|
6
|
-
* {String | Number | function} [width]
|
7
|
-
* {String | Number | function} [height]
|
8
|
-
* {String | function} [className]
|
9
|
-
* @constructor Panel
|
10
|
-
* @extends Component
|
11
|
-
*/
|
12
|
-
function Panel(options) {
|
13
|
-
this.id = util.randomUUID();
|
14
|
-
this.parent = null;
|
15
|
-
this.childs = [];
|
16
|
-
|
17
|
-
this.options = options || {};
|
18
|
-
|
19
|
-
// create frame
|
20
|
-
this.frame = (typeof document !== 'undefined') ? document.createElement('div') : null;
|
21
|
-
}
|
22
|
-
|
23
|
-
Panel.prototype = new Component();
|
24
|
-
|
25
|
-
/**
|
26
|
-
* Set options. Will extend the current options.
|
27
|
-
* @param {Object} [options] Available parameters:
|
28
|
-
* {String | function} [className]
|
29
|
-
* {String | Number | function} [left]
|
30
|
-
* {String | Number | function} [top]
|
31
|
-
* {String | Number | function} [width]
|
32
|
-
* {String | Number | function} [height]
|
33
|
-
*/
|
34
|
-
Panel.prototype.setOptions = Component.prototype.setOptions;
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Get the outer frame of the panel
|
38
|
-
* @returns {HTMLElement} frame
|
39
|
-
*/
|
40
|
-
Panel.prototype.getFrame = function () {
|
41
|
-
return this.frame;
|
42
|
-
};
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Append a child to the panel
|
46
|
-
* @param {Component} child
|
47
|
-
*/
|
48
|
-
Panel.prototype.appendChild = function (child) {
|
49
|
-
this.childs.push(child);
|
50
|
-
child.parent = this;
|
51
|
-
|
52
|
-
// attach to the DOM
|
53
|
-
var frame = child.getFrame();
|
54
|
-
if (frame) {
|
55
|
-
if (frame.parentNode) {
|
56
|
-
frame.parentNode.removeChild(frame);
|
57
|
-
}
|
58
|
-
this.frame.appendChild(frame);
|
59
|
-
}
|
60
|
-
};
|
61
|
-
|
62
|
-
/**
|
63
|
-
* Insert a child to the panel
|
64
|
-
* @param {Component} child
|
65
|
-
* @param {Component} beforeChild
|
66
|
-
*/
|
67
|
-
Panel.prototype.insertBefore = function (child, beforeChild) {
|
68
|
-
var index = this.childs.indexOf(beforeChild);
|
69
|
-
if (index != -1) {
|
70
|
-
this.childs.splice(index, 0, child);
|
71
|
-
child.parent = this;
|
72
|
-
|
73
|
-
// attach to the DOM
|
74
|
-
var frame = child.getFrame();
|
75
|
-
if (frame) {
|
76
|
-
if (frame.parentNode) {
|
77
|
-
frame.parentNode.removeChild(frame);
|
78
|
-
}
|
79
|
-
|
80
|
-
var beforeFrame = beforeChild.getFrame();
|
81
|
-
if (beforeFrame) {
|
82
|
-
this.frame.insertBefore(frame, beforeFrame);
|
83
|
-
}
|
84
|
-
else {
|
85
|
-
this.frame.appendChild(frame);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
}
|
89
|
-
};
|
90
|
-
|
91
|
-
/**
|
92
|
-
* Remove a child from the panel
|
93
|
-
* @param {Component} child
|
94
|
-
*/
|
95
|
-
Panel.prototype.removeChild = function (child) {
|
96
|
-
var index = this.childs.indexOf(child);
|
97
|
-
if (index != -1) {
|
98
|
-
this.childs.splice(index, 1);
|
99
|
-
child.parent = null;
|
100
|
-
|
101
|
-
// remove from the DOM
|
102
|
-
var frame = child.getFrame();
|
103
|
-
if (frame && frame.parentNode) {
|
104
|
-
this.frame.removeChild(frame);
|
105
|
-
}
|
106
|
-
}
|
107
|
-
};
|
108
|
-
|
109
|
-
/**
|
110
|
-
* Test whether the panel contains given child
|
111
|
-
* @param {Component} child
|
112
|
-
*/
|
113
|
-
Panel.prototype.hasChild = function (child) {
|
114
|
-
var index = this.childs.indexOf(child);
|
115
|
-
return (index != -1);
|
116
|
-
};
|
117
|
-
|
118
|
-
/**
|
119
|
-
* Repaint the component
|
120
|
-
* @return {boolean} Returns true if the component was resized since previous repaint
|
121
|
-
*/
|
122
|
-
Panel.prototype.repaint = function () {
|
123
|
-
var asString = util.option.asString,
|
124
|
-
options = this.options,
|
125
|
-
frame = this.getFrame();
|
126
|
-
|
127
|
-
// update className
|
128
|
-
frame.className = 'vpanel' + (options.className ? (' ' + asString(options.className)) : '');
|
129
|
-
|
130
|
-
// repaint the child components
|
131
|
-
var childsResized = this._repaintChilds();
|
132
|
-
|
133
|
-
// update frame size
|
134
|
-
this._updateSize();
|
135
|
-
|
136
|
-
return this._isResized() || childsResized;
|
137
|
-
};
|
138
|
-
|
139
|
-
/**
|
140
|
-
* Repaint all childs of the panel
|
141
|
-
* @return {boolean} Returns true if the component is resized
|
142
|
-
* @private
|
143
|
-
*/
|
144
|
-
Panel.prototype._repaintChilds = function () {
|
145
|
-
var resized = false;
|
146
|
-
for (var i = 0, ii = this.childs.length; i < ii; i++) {
|
147
|
-
resized = this.childs[i].repaint() || resized;
|
148
|
-
}
|
149
|
-
return resized;
|
150
|
-
};
|
151
|
-
|
152
|
-
/**
|
153
|
-
* Apply the size from options to the panel, and recalculate it's actual size.
|
154
|
-
* @private
|
155
|
-
*/
|
156
|
-
Panel.prototype._updateSize = function () {
|
157
|
-
// apply size
|
158
|
-
this.frame.style.top = util.option.asSize(this.options.top);
|
159
|
-
this.frame.style.bottom = util.option.asSize(this.options.bottom);
|
160
|
-
this.frame.style.left = util.option.asSize(this.options.left);
|
161
|
-
this.frame.style.right = util.option.asSize(this.options.right);
|
162
|
-
this.frame.style.width = util.option.asSize(this.options.width, '100%');
|
163
|
-
this.frame.style.height = util.option.asSize(this.options.height, '');
|
164
|
-
|
165
|
-
// get actual size
|
166
|
-
this.top = this.frame.offsetTop;
|
167
|
-
this.left = this.frame.offsetLeft;
|
168
|
-
this.width = this.frame.offsetWidth;
|
169
|
-
this.height = this.frame.offsetHeight;
|
170
|
-
};
|
@@ -1,176 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* A root panel can hold components. The root panel must be initialized with
|
3
|
-
* a DOM element as container.
|
4
|
-
* @param {HTMLElement} container
|
5
|
-
* @param {Object} [options] Available parameters: see RootPanel.setOptions.
|
6
|
-
* @constructor RootPanel
|
7
|
-
* @extends Panel
|
8
|
-
*/
|
9
|
-
function RootPanel(container, options) {
|
10
|
-
this.id = util.randomUUID();
|
11
|
-
this.container = container;
|
12
|
-
|
13
|
-
this.options = options || {};
|
14
|
-
this.defaultOptions = {
|
15
|
-
autoResize: true
|
16
|
-
};
|
17
|
-
|
18
|
-
// create the HTML DOM
|
19
|
-
this._create();
|
20
|
-
|
21
|
-
// attach the root panel to the provided container
|
22
|
-
if (!this.container) throw new Error('Cannot repaint root panel: no container attached');
|
23
|
-
this.container.appendChild(this.getFrame());
|
24
|
-
|
25
|
-
|
26
|
-
this._initWatch();
|
27
|
-
}
|
28
|
-
|
29
|
-
RootPanel.prototype = new Panel();
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Create the HTML DOM for the root panel
|
33
|
-
*/
|
34
|
-
RootPanel.prototype._create = function _create() {
|
35
|
-
// create frame
|
36
|
-
this.frame = document.createElement('div');
|
37
|
-
|
38
|
-
// create event listeners for all interesting events, these events will be
|
39
|
-
// emitted via emitter
|
40
|
-
this.hammer = Hammer(this.frame, {
|
41
|
-
prevent_default: true
|
42
|
-
});
|
43
|
-
this.listeners = {};
|
44
|
-
|
45
|
-
var me = this;
|
46
|
-
var events = [
|
47
|
-
'touch', 'pinch', 'tap', 'doubletap', 'hold',
|
48
|
-
'dragstart', 'drag', 'dragend',
|
49
|
-
'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is for Firefox
|
50
|
-
];
|
51
|
-
events.forEach(function (event) {
|
52
|
-
var listener = function () {
|
53
|
-
var args = [event].concat(Array.prototype.slice.call(arguments, 0));
|
54
|
-
me.emit.apply(me, args);
|
55
|
-
};
|
56
|
-
me.hammer.on(event, listener);
|
57
|
-
me.listeners[event] = listener;
|
58
|
-
});
|
59
|
-
};
|
60
|
-
|
61
|
-
/**
|
62
|
-
* Set options. Will extend the current options.
|
63
|
-
* @param {Object} [options] Available parameters:
|
64
|
-
* {String | function} [className]
|
65
|
-
* {String | Number | function} [left]
|
66
|
-
* {String | Number | function} [top]
|
67
|
-
* {String | Number | function} [width]
|
68
|
-
* {String | Number | function} [height]
|
69
|
-
* {Boolean | function} [autoResize]
|
70
|
-
*/
|
71
|
-
RootPanel.prototype.setOptions = function setOptions(options) {
|
72
|
-
if (options) {
|
73
|
-
util.extend(this.options, options);
|
74
|
-
|
75
|
-
this.repaint();
|
76
|
-
|
77
|
-
this._initWatch();
|
78
|
-
}
|
79
|
-
};
|
80
|
-
|
81
|
-
/**
|
82
|
-
* Get the frame of the root panel
|
83
|
-
*/
|
84
|
-
RootPanel.prototype.getFrame = function getFrame() {
|
85
|
-
return this.frame;
|
86
|
-
};
|
87
|
-
|
88
|
-
/**
|
89
|
-
* Repaint the root panel
|
90
|
-
*/
|
91
|
-
RootPanel.prototype.repaint = function repaint() {
|
92
|
-
// update class name
|
93
|
-
var options = this.options;
|
94
|
-
var editable = options.editable.updateTime || options.editable.updateGroup;
|
95
|
-
var className = 'vis timeline rootpanel ' + options.orientation + (editable ? ' editable' : '');
|
96
|
-
if (options.className) className += ' ' + util.option.asString(className);
|
97
|
-
this.frame.className = className;
|
98
|
-
|
99
|
-
// repaint the child components
|
100
|
-
var childsResized = this._repaintChilds();
|
101
|
-
|
102
|
-
// update frame size
|
103
|
-
this.frame.style.maxHeight = util.option.asSize(this.options.maxHeight, '');
|
104
|
-
this.frame.style.minHeight = util.option.asSize(this.options.minHeight, '');
|
105
|
-
this._updateSize();
|
106
|
-
|
107
|
-
// if the root panel or any of its childs is resized, repaint again,
|
108
|
-
// as other components may need to be resized accordingly
|
109
|
-
var resized = this._isResized() || childsResized;
|
110
|
-
if (resized) {
|
111
|
-
setTimeout(this.repaint.bind(this), 0);
|
112
|
-
}
|
113
|
-
};
|
114
|
-
|
115
|
-
/**
|
116
|
-
* Initialize watching when option autoResize is true
|
117
|
-
* @private
|
118
|
-
*/
|
119
|
-
RootPanel.prototype._initWatch = function _initWatch() {
|
120
|
-
var autoResize = this.getOption('autoResize');
|
121
|
-
if (autoResize) {
|
122
|
-
this._watch();
|
123
|
-
}
|
124
|
-
else {
|
125
|
-
this._unwatch();
|
126
|
-
}
|
127
|
-
};
|
128
|
-
|
129
|
-
/**
|
130
|
-
* Watch for changes in the size of the frame. On resize, the Panel will
|
131
|
-
* automatically redraw itself.
|
132
|
-
* @private
|
133
|
-
*/
|
134
|
-
RootPanel.prototype._watch = function _watch() {
|
135
|
-
var me = this;
|
136
|
-
|
137
|
-
this._unwatch();
|
138
|
-
|
139
|
-
var checkSize = function checkSize() {
|
140
|
-
var autoResize = me.getOption('autoResize');
|
141
|
-
if (!autoResize) {
|
142
|
-
// stop watching when the option autoResize is changed to false
|
143
|
-
me._unwatch();
|
144
|
-
return;
|
145
|
-
}
|
146
|
-
|
147
|
-
if (me.frame) {
|
148
|
-
// check whether the frame is resized
|
149
|
-
if ((me.frame.clientWidth != me.lastWidth) ||
|
150
|
-
(me.frame.clientHeight != me.lastHeight)) {
|
151
|
-
me.lastWidth = me.frame.clientWidth;
|
152
|
-
me.lastHeight = me.frame.clientHeight;
|
153
|
-
me.repaint();
|
154
|
-
// TODO: emit a resize event instead?
|
155
|
-
}
|
156
|
-
}
|
157
|
-
};
|
158
|
-
|
159
|
-
// TODO: automatically cleanup the event listener when the frame is deleted
|
160
|
-
util.addEventListener(window, 'resize', checkSize);
|
161
|
-
|
162
|
-
this.watchTimer = setInterval(checkSize, 1000);
|
163
|
-
};
|
164
|
-
|
165
|
-
/**
|
166
|
-
* Stop watching for a resize of the frame.
|
167
|
-
* @private
|
168
|
-
*/
|
169
|
-
RootPanel.prototype._unwatch = function _unwatch() {
|
170
|
-
if (this.watchTimer) {
|
171
|
-
clearInterval(this.watchTimer);
|
172
|
-
this.watchTimer = undefined;
|
173
|
-
}
|
174
|
-
|
175
|
-
// TODO: remove event listener on window.resize
|
176
|
-
};
|