vis-rails 1.0.2 → 2.0.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.
- 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
@@ -7,11 +7,6 @@
|
|
7
7
|
background-color: #D5DDF6;
|
8
8
|
display: inline-block;
|
9
9
|
padding: 5px;
|
10
|
-
|
11
|
-
/* TODO: enable css transitions
|
12
|
-
-webkit-transition: top .4s ease-in-out, bottom .4s ease-in-out;
|
13
|
-
transition: top .4s ease-in-out, bottom .4s ease-in-out;
|
14
|
-
/**/
|
15
10
|
}
|
16
11
|
|
17
12
|
.vis.timeline .item.selected {
|
@@ -20,7 +15,7 @@
|
|
20
15
|
z-index: 999;
|
21
16
|
}
|
22
17
|
|
23
|
-
.vis.timeline.editable .item.selected {
|
18
|
+
.vis.timeline .editable .item.selected {
|
24
19
|
cursor: move;
|
25
20
|
}
|
26
21
|
|
@@ -70,11 +65,6 @@
|
|
70
65
|
width: 0;
|
71
66
|
border-left-width: 1px;
|
72
67
|
border-left-style: solid;
|
73
|
-
|
74
|
-
/* TODO: enable css transitions
|
75
|
-
-webkit-transition: height .4s ease-in-out, top .4s ease-in-out;
|
76
|
-
transition: height .4s ease-in-out, top .4s ease-in-out;
|
77
|
-
/**/
|
78
68
|
}
|
79
69
|
|
80
70
|
.vis.timeline .item .content {
|
@@ -5,34 +5,29 @@
|
|
5
5
|
margin: 0;
|
6
6
|
|
7
7
|
box-sizing: border-box;
|
8
|
-
|
9
|
-
/* FIXME: get transition working for rootpanel and itemset
|
10
|
-
-webkit-transition: height 4s ease-in-out;
|
11
|
-
transition: height 4s ease-in-out;
|
12
|
-
/**/
|
13
|
-
}
|
14
|
-
|
15
|
-
.vis.timeline .background {
|
16
8
|
}
|
17
9
|
|
18
|
-
.vis.timeline .
|
10
|
+
.vis.timeline .itemset .background,
|
11
|
+
.vis.timeline .itemset .foreground {
|
12
|
+
position: absolute;
|
13
|
+
width: 100%;
|
14
|
+
height: 100%;
|
19
15
|
}
|
20
16
|
|
21
17
|
.vis.timeline .axis {
|
22
|
-
|
18
|
+
position: absolute;
|
19
|
+
width: 100%;
|
20
|
+
height: 0;
|
21
|
+
left: 1px;
|
22
|
+
z-index: 1;
|
23
23
|
}
|
24
24
|
|
25
|
-
.vis.timeline .group {
|
25
|
+
.vis.timeline .foreground .group {
|
26
26
|
position: relative;
|
27
27
|
box-sizing: border-box;
|
28
|
+
border-bottom: 1px solid #bfbfbf;
|
28
29
|
}
|
29
30
|
|
30
|
-
.vis.timeline.
|
31
|
-
border-top: 1px solid #bfbfbf;
|
31
|
+
.vis.timeline .foreground .group:last-child {
|
32
32
|
border-bottom: none;
|
33
33
|
}
|
34
|
-
|
35
|
-
.vis.timeline.bottom .group {
|
36
|
-
border-top: none;
|
37
|
-
border-bottom: 1px solid #bfbfbf;
|
38
|
-
}
|
@@ -18,17 +18,19 @@
|
|
18
18
|
box-sizing: border-box;
|
19
19
|
}
|
20
20
|
|
21
|
-
.vis.timeline
|
22
|
-
border-
|
23
|
-
border-bottom: none;
|
21
|
+
.vis.timeline .labelset .vlabel {
|
22
|
+
border-bottom: 1px solid #bfbfbf;
|
24
23
|
}
|
25
24
|
|
26
|
-
.vis.timeline
|
27
|
-
border-
|
28
|
-
border-bottom: 1px solid #bfbfbf;
|
25
|
+
.vis.timeline .labelset .vlabel:last-child {
|
26
|
+
border-bottom: none;
|
29
27
|
}
|
30
28
|
|
31
29
|
.vis.timeline .labelset .vlabel .inner {
|
32
30
|
display: inline-block;
|
33
31
|
padding: 5px;
|
34
32
|
}
|
33
|
+
|
34
|
+
.vis.timeline .labelset .vlabel .inner.hidden {
|
35
|
+
padding: 0;
|
36
|
+
}
|
@@ -1,28 +1,71 @@
|
|
1
1
|
|
2
|
-
.vis.timeline.
|
2
|
+
.vis.timeline.root {
|
3
3
|
position: relative;
|
4
|
+
border: 1px solid #bfbfbf;
|
5
|
+
|
4
6
|
overflow: hidden;
|
7
|
+
padding: 0;
|
8
|
+
margin: 0;
|
5
9
|
|
6
|
-
border: 1px solid #bfbfbf;
|
7
10
|
box-sizing: border-box;
|
8
|
-
|
9
|
-
/* FIXME: there is an issue with the height of the items when panel height is animated
|
10
|
-
-webkit-transition: height 4s ease-in-out;
|
11
|
-
transition: height 4s ease-in-out;
|
12
|
-
/**/
|
13
11
|
}
|
14
12
|
|
15
|
-
.vis.timeline .
|
13
|
+
.vis.timeline .vispanel {
|
16
14
|
position: absolute;
|
17
|
-
|
15
|
+
|
16
|
+
padding: 0;
|
17
|
+
margin: 0;
|
18
18
|
|
19
19
|
box-sizing: border-box;
|
20
20
|
}
|
21
21
|
|
22
|
-
.vis.timeline .
|
23
|
-
|
22
|
+
.vis.timeline .vispanel.center,
|
23
|
+
.vis.timeline .vispanel.left,
|
24
|
+
.vis.timeline .vispanel.right,
|
25
|
+
.vis.timeline .vispanel.top,
|
26
|
+
.vis.timeline .vispanel.bottom {
|
27
|
+
border: 1px #bfbfbf;
|
24
28
|
}
|
25
29
|
|
26
|
-
.vis.timeline .
|
27
|
-
|
30
|
+
.vis.timeline .vispanel.center,
|
31
|
+
.vis.timeline .vispanel.left,
|
32
|
+
.vis.timeline .vispanel.right {
|
33
|
+
border-top-style: solid;
|
34
|
+
border-bottom-style: solid;
|
35
|
+
overflow: hidden;
|
36
|
+
}
|
37
|
+
|
38
|
+
.vis.timeline .vispanel.center,
|
39
|
+
.vis.timeline .vispanel.top,
|
40
|
+
.vis.timeline .vispanel.bottom {
|
41
|
+
border-left-style: solid;
|
42
|
+
border-right-style: solid;
|
28
43
|
}
|
44
|
+
|
45
|
+
.vis.timeline .background {
|
46
|
+
overflow: hidden;
|
47
|
+
}
|
48
|
+
|
49
|
+
.vis.timeline .vispanel > .content {
|
50
|
+
position: relative;
|
51
|
+
}
|
52
|
+
|
53
|
+
.vis.timeline .vispanel .shadow {
|
54
|
+
position: absolute;
|
55
|
+
width: 100%;
|
56
|
+
height: 1px;
|
57
|
+
box-shadow: 0 0 10px rgba(0,0,0,0.8);
|
58
|
+
/* TODO: find a nice way to ensure shadows are drawn on top of items
|
59
|
+
z-index: 1;
|
60
|
+
*/
|
61
|
+
}
|
62
|
+
|
63
|
+
.vis.timeline .vispanel .shadow.top {
|
64
|
+
top: -1px;
|
65
|
+
left: 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
.vis.timeline .vispanel .shadow.bottom {
|
69
|
+
bottom: -1px;
|
70
|
+
left: 0;
|
71
|
+
}
|
@@ -1,5 +1,20 @@
|
|
1
1
|
.vis.timeline .timeaxis {
|
2
|
+
position: relative;
|
3
|
+
overflow: hidden;
|
4
|
+
}
|
5
|
+
|
6
|
+
.vis.timeline .timeaxis.foreground {
|
7
|
+
top: 0;
|
8
|
+
left: 0;
|
9
|
+
width: 100%;
|
10
|
+
}
|
11
|
+
|
12
|
+
.vis.timeline .timeaxis.background {
|
2
13
|
position: absolute;
|
14
|
+
top: 0;
|
15
|
+
left: 0;
|
16
|
+
width: 100%;
|
17
|
+
height: 100%;
|
3
18
|
}
|
4
19
|
|
5
20
|
.vis.timeline .timeaxis .text {
|
@@ -24,14 +39,6 @@
|
|
24
39
|
border-right: 1px solid;
|
25
40
|
}
|
26
41
|
|
27
|
-
.vis.timeline .timeaxis .grid.horizontal {
|
28
|
-
position: absolute;
|
29
|
-
left: 0;
|
30
|
-
width: 100%;
|
31
|
-
height: 0;
|
32
|
-
border-bottom: 1px solid;
|
33
|
-
}
|
34
|
-
|
35
42
|
.vis.timeline .timeaxis .grid.minor {
|
36
43
|
border-color: #e5e5e5;
|
37
44
|
}
|
@@ -2,17 +2,18 @@
|
|
2
2
|
* @constructor Item
|
3
3
|
* @param {Object} data Object containing (optional) parameters type,
|
4
4
|
* start, end, content, group, className.
|
5
|
-
* @param {
|
6
|
-
*
|
5
|
+
* @param {{toScreen: function, toTime: function}} conversion
|
6
|
+
* Conversion functions from time to screen and vice versa
|
7
|
+
* @param {Object} options Configuration options
|
7
8
|
* // TODO: describe available options
|
8
9
|
*/
|
9
|
-
function Item (data,
|
10
|
+
function Item (data, conversion, options) {
|
10
11
|
this.id = null;
|
11
12
|
this.parent = null;
|
12
13
|
this.data = data;
|
13
14
|
this.dom = null;
|
15
|
+
this.conversion = conversion || {};
|
14
16
|
this.options = options || {};
|
15
|
-
this.defaultOptions = defaultOptions || {};
|
16
17
|
|
17
18
|
this.selected = false;
|
18
19
|
this.displayed = false;
|
@@ -27,24 +28,24 @@ function Item (data, options, defaultOptions) {
|
|
27
28
|
/**
|
28
29
|
* Select current item
|
29
30
|
*/
|
30
|
-
Item.prototype.select = function
|
31
|
+
Item.prototype.select = function() {
|
31
32
|
this.selected = true;
|
32
|
-
if (this.displayed) this.
|
33
|
+
if (this.displayed) this.redraw();
|
33
34
|
};
|
34
35
|
|
35
36
|
/**
|
36
37
|
* Unselect current item
|
37
38
|
*/
|
38
|
-
Item.prototype.unselect = function
|
39
|
+
Item.prototype.unselect = function() {
|
39
40
|
this.selected = false;
|
40
|
-
if (this.displayed) this.
|
41
|
+
if (this.displayed) this.redraw();
|
41
42
|
};
|
42
43
|
|
43
44
|
/**
|
44
45
|
* Set a parent for the item
|
45
46
|
* @param {ItemSet | Group} parent
|
46
47
|
*/
|
47
|
-
Item.prototype.setParent = function
|
48
|
+
Item.prototype.setParent = function(parent) {
|
48
49
|
if (this.displayed) {
|
49
50
|
this.hide();
|
50
51
|
this.parent = parent;
|
@@ -62,7 +63,7 @@ Item.prototype.setParent = function setParent(parent) {
|
|
62
63
|
* @returns {{start: Number, end: Number}} range with a timestamp for start and end
|
63
64
|
* @returns {boolean} True if visible
|
64
65
|
*/
|
65
|
-
Item.prototype.isVisible = function
|
66
|
+
Item.prototype.isVisible = function(range) {
|
66
67
|
// Should be implemented by Item implementations
|
67
68
|
return false;
|
68
69
|
};
|
@@ -71,7 +72,7 @@ Item.prototype.isVisible = function isVisible (range) {
|
|
71
72
|
* Show the Item in the DOM (when not already visible)
|
72
73
|
* @return {Boolean} changed
|
73
74
|
*/
|
74
|
-
Item.prototype.show = function
|
75
|
+
Item.prototype.show = function() {
|
75
76
|
return false;
|
76
77
|
};
|
77
78
|
|
@@ -79,28 +80,28 @@ Item.prototype.show = function show() {
|
|
79
80
|
* Hide the Item from the DOM (when visible)
|
80
81
|
* @return {Boolean} changed
|
81
82
|
*/
|
82
|
-
Item.prototype.hide = function
|
83
|
+
Item.prototype.hide = function() {
|
83
84
|
return false;
|
84
85
|
};
|
85
86
|
|
86
87
|
/**
|
87
88
|
* Repaint the item
|
88
89
|
*/
|
89
|
-
Item.prototype.
|
90
|
+
Item.prototype.redraw = function() {
|
90
91
|
// should be implemented by the item
|
91
92
|
};
|
92
93
|
|
93
94
|
/**
|
94
95
|
* Reposition the Item horizontally
|
95
96
|
*/
|
96
|
-
Item.prototype.repositionX = function
|
97
|
+
Item.prototype.repositionX = function() {
|
97
98
|
// should be implemented by the item
|
98
99
|
};
|
99
100
|
|
100
101
|
/**
|
101
102
|
* Reposition the Item vertically
|
102
103
|
*/
|
103
|
-
Item.prototype.repositionY = function
|
104
|
+
Item.prototype.repositionY = function() {
|
104
105
|
// should be implemented by the item
|
105
106
|
};
|
106
107
|
|
@@ -3,11 +3,12 @@
|
|
3
3
|
* @extends Item
|
4
4
|
* @param {Object} data Object containing parameters start
|
5
5
|
* content, className.
|
6
|
-
* @param {
|
7
|
-
*
|
6
|
+
* @param {{toScreen: function, toTime: function}} conversion
|
7
|
+
* Conversion functions from time to screen and vice versa
|
8
|
+
* @param {Object} [options] Configuration options
|
8
9
|
* // TODO: describe available options
|
9
10
|
*/
|
10
|
-
function ItemBox (data,
|
11
|
+
function ItemBox (data, conversion, options) {
|
11
12
|
this.props = {
|
12
13
|
dot: {
|
13
14
|
width: 0,
|
@@ -26,17 +27,17 @@ function ItemBox (data, options, defaultOptions) {
|
|
26
27
|
}
|
27
28
|
}
|
28
29
|
|
29
|
-
Item.call(this, data,
|
30
|
+
Item.call(this, data, conversion, options);
|
30
31
|
}
|
31
32
|
|
32
|
-
ItemBox.prototype = new Item (null);
|
33
|
+
ItemBox.prototype = new Item (null, null, null);
|
33
34
|
|
34
35
|
/**
|
35
36
|
* Check whether this item is visible inside given range
|
36
37
|
* @returns {{start: Number, end: Number}} range with a timestamp for start and end
|
37
38
|
* @returns {boolean} True if visible
|
38
39
|
*/
|
39
|
-
ItemBox.prototype.isVisible = function
|
40
|
+
ItemBox.prototype.isVisible = function(range) {
|
40
41
|
// determine visibility
|
41
42
|
// TODO: account for the real width of the item. Right now we just add 1/4 to the window
|
42
43
|
var interval = (range.end - range.start) / 4;
|
@@ -46,7 +47,7 @@ ItemBox.prototype.isVisible = function isVisible (range) {
|
|
46
47
|
/**
|
47
48
|
* Repaint the item
|
48
49
|
*/
|
49
|
-
ItemBox.prototype.
|
50
|
+
ItemBox.prototype.redraw = function() {
|
50
51
|
var dom = this.dom;
|
51
52
|
if (!dom) {
|
52
53
|
// create DOM
|
@@ -75,21 +76,21 @@ ItemBox.prototype.repaint = function repaint() {
|
|
75
76
|
|
76
77
|
// append DOM to parent DOM
|
77
78
|
if (!this.parent) {
|
78
|
-
throw new Error('Cannot
|
79
|
+
throw new Error('Cannot redraw item: no parent attached');
|
79
80
|
}
|
80
81
|
if (!dom.box.parentNode) {
|
81
|
-
var foreground = this.parent.
|
82
|
-
if (!foreground) throw new Error('Cannot
|
82
|
+
var foreground = this.parent.dom.foreground;
|
83
|
+
if (!foreground) throw new Error('Cannot redraw time axis: parent has no foreground container element');
|
83
84
|
foreground.appendChild(dom.box);
|
84
85
|
}
|
85
86
|
if (!dom.line.parentNode) {
|
86
|
-
var background = this.parent.
|
87
|
-
if (!background) throw new Error('Cannot
|
87
|
+
var background = this.parent.dom.background;
|
88
|
+
if (!background) throw new Error('Cannot redraw time axis: parent has no background container element');
|
88
89
|
background.appendChild(dom.line);
|
89
90
|
}
|
90
91
|
if (!dom.dot.parentNode) {
|
91
|
-
var axis = this.parent.
|
92
|
-
if (!background) throw new Error('Cannot
|
92
|
+
var axis = this.parent.dom.axis;
|
93
|
+
if (!background) throw new Error('Cannot redraw time axis: parent has no axis container element');
|
93
94
|
axis.appendChild(dom.dot);
|
94
95
|
}
|
95
96
|
this.displayed = true;
|
@@ -141,16 +142,16 @@ ItemBox.prototype.repaint = function repaint() {
|
|
141
142
|
* Show the item in the DOM (when not already displayed). The items DOM will
|
142
143
|
* be created when needed.
|
143
144
|
*/
|
144
|
-
ItemBox.prototype.show = function
|
145
|
+
ItemBox.prototype.show = function() {
|
145
146
|
if (!this.displayed) {
|
146
|
-
this.
|
147
|
+
this.redraw();
|
147
148
|
}
|
148
149
|
};
|
149
150
|
|
150
151
|
/**
|
151
152
|
* Hide the item from the DOM (when visible)
|
152
153
|
*/
|
153
|
-
ItemBox.prototype.hide = function
|
154
|
+
ItemBox.prototype.hide = function() {
|
154
155
|
if (this.displayed) {
|
155
156
|
var dom = this.dom;
|
156
157
|
|
@@ -169,9 +170,9 @@ ItemBox.prototype.hide = function hide() {
|
|
169
170
|
* Reposition the item horizontally
|
170
171
|
* @Override
|
171
172
|
*/
|
172
|
-
ItemBox.prototype.repositionX = function
|
173
|
-
var start = this.
|
174
|
-
align = this.options.align
|
173
|
+
ItemBox.prototype.repositionX = function() {
|
174
|
+
var start = this.conversion.toScreen(this.data.start),
|
175
|
+
align = this.options.align,
|
175
176
|
left,
|
176
177
|
box = this.dom.box,
|
177
178
|
line = this.dom.line,
|
@@ -203,27 +204,26 @@ ItemBox.prototype.repositionX = function repositionX() {
|
|
203
204
|
* Reposition the item vertically
|
204
205
|
* @Override
|
205
206
|
*/
|
206
|
-
ItemBox.prototype.repositionY = function
|
207
|
-
var orientation = this.options.orientation
|
207
|
+
ItemBox.prototype.repositionY = function() {
|
208
|
+
var orientation = this.options.orientation,
|
208
209
|
box = this.dom.box,
|
209
210
|
line = this.dom.line,
|
210
211
|
dot = this.dom.dot;
|
211
212
|
|
212
213
|
if (orientation == 'top') {
|
213
|
-
box.style.top
|
214
|
-
box.style.bottom = '';
|
214
|
+
box.style.top = (this.top || 0) + 'px';
|
215
215
|
|
216
|
-
line.style.top
|
217
|
-
line.style.bottom = '';
|
216
|
+
line.style.top = '0';
|
218
217
|
line.style.height = (this.parent.top + this.top + 1) + 'px';
|
218
|
+
line.style.bottom = '';
|
219
219
|
}
|
220
220
|
else { // orientation 'bottom'
|
221
|
-
|
222
|
-
|
221
|
+
var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty
|
222
|
+
var lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top;
|
223
223
|
|
224
|
-
|
224
|
+
box.style.top = (this.parent.height - this.top - this.height || 0) + 'px';
|
225
|
+
line.style.top = (itemSetHeight - lineHeight) + 'px';
|
225
226
|
line.style.bottom = '0';
|
226
|
-
line.style.height = '';
|
227
227
|
}
|
228
228
|
|
229
229
|
dot.style.top = (-this.props.dot.height / 2) + 'px';
|