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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -1
  3. data/README.md +2 -0
  4. data/lib/vis/rails/version.rb +1 -1
  5. data/vendor/assets/javascripts/module/exports-only-timeline.js +55 -0
  6. data/vendor/assets/javascripts/vis-only-timeline.js +23 -0
  7. data/vendor/assets/javascripts/vis.js +3 -3
  8. data/vendor/assets/stylesheets/vis-only-timeline.css +3 -0
  9. data/vendor/assets/vis/DataSet.js +106 -130
  10. data/vendor/assets/vis/DataView.js +35 -37
  11. data/vendor/assets/vis/graph/Edge.js +225 -45
  12. data/vendor/assets/vis/graph/Graph.js +120 -24
  13. data/vendor/assets/vis/graph/Node.js +16 -16
  14. data/vendor/assets/vis/graph/graphMixins/HierarchicalLayoutMixin.js +1 -1
  15. data/vendor/assets/vis/graph/graphMixins/ManipulationMixin.js +143 -0
  16. data/vendor/assets/vis/graph/graphMixins/SelectionMixin.js +81 -3
  17. data/vendor/assets/vis/graph3d/Graph3d.js +3306 -0
  18. data/vendor/assets/vis/module/exports.js +2 -3
  19. data/vendor/assets/vis/timeline/Range.js +93 -80
  20. data/vendor/assets/vis/timeline/Timeline.js +525 -428
  21. data/vendor/assets/vis/timeline/component/Component.js +19 -53
  22. data/vendor/assets/vis/timeline/component/CurrentTime.js +57 -25
  23. data/vendor/assets/vis/timeline/component/CustomTime.js +55 -19
  24. data/vendor/assets/vis/timeline/component/Group.js +47 -50
  25. data/vendor/assets/vis/timeline/component/ItemSet.js +402 -206
  26. data/vendor/assets/vis/timeline/component/TimeAxis.js +112 -169
  27. data/vendor/assets/vis/timeline/component/css/animation.css +33 -0
  28. data/vendor/assets/vis/timeline/component/css/currenttime.css +1 -1
  29. data/vendor/assets/vis/timeline/component/css/customtime.css +1 -1
  30. data/vendor/assets/vis/timeline/component/css/item.css +1 -11
  31. data/vendor/assets/vis/timeline/component/css/itemset.css +13 -18
  32. data/vendor/assets/vis/timeline/component/css/labelset.css +8 -6
  33. data/vendor/assets/vis/timeline/component/css/panel.css +56 -13
  34. data/vendor/assets/vis/timeline/component/css/timeaxis.css +15 -8
  35. data/vendor/assets/vis/timeline/component/item/Item.js +16 -15
  36. data/vendor/assets/vis/timeline/component/item/ItemBox.js +30 -30
  37. data/vendor/assets/vis/timeline/component/item/ItemPoint.js +20 -21
  38. data/vendor/assets/vis/timeline/component/item/ItemRange.js +23 -24
  39. data/vendor/assets/vis/timeline/component/item/ItemRangeOverflow.js +10 -10
  40. data/vendor/assets/vis/timeline/stack.js +5 -5
  41. data/vendor/assets/vis/util.js +81 -35
  42. metadata +7 -4
  43. data/vendor/assets/vis/timeline/component/Panel.js +0 -170
  44. data/vendor/assets/vis/timeline/component/RootPanel.js +0 -176
@@ -1,5 +1,5 @@
1
1
  .vis.timeline .currenttime {
2
2
  background-color: #FF7F6E;
3
3
  width: 2px;
4
- z-index: 9;
4
+ z-index: 1;
5
5
  }
@@ -2,5 +2,5 @@
2
2
  background-color: #6E94FF;
3
3
  width: 2px;
4
4
  cursor: move;
5
- z-index: 9;
5
+ z-index: 1;
6
6
  }
@@ -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 .foreground {
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
- overflow: visible;
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.top .group {
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.top .labelset .vlabel {
22
- border-top: 1px solid #bfbfbf;
23
- border-bottom: none;
21
+ .vis.timeline .labelset .vlabel {
22
+ border-bottom: 1px solid #bfbfbf;
24
23
  }
25
24
 
26
- .vis.timeline.bottom .labelset .vlabel {
27
- border-top: none;
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.rootpanel {
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 .vpanel {
13
+ .vis.timeline .vispanel {
16
14
  position: absolute;
17
- overflow: hidden;
15
+
16
+ padding: 0;
17
+ margin: 0;
18
18
 
19
19
  box-sizing: border-box;
20
20
  }
21
21
 
22
- .vis.timeline .vpanel.side {
23
- border-right: 1px solid #bfbfbf;
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 .vpanel.side.hidden {
27
- display: none;
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 {Object} [options] Options to set initial property values
6
- * @param {Object} [defaultOptions] default options
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, options, defaultOptions) {
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 select() {
31
+ Item.prototype.select = function() {
31
32
  this.selected = true;
32
- if (this.displayed) this.repaint();
33
+ if (this.displayed) this.redraw();
33
34
  };
34
35
 
35
36
  /**
36
37
  * Unselect current item
37
38
  */
38
- Item.prototype.unselect = function unselect() {
39
+ Item.prototype.unselect = function() {
39
40
  this.selected = false;
40
- if (this.displayed) this.repaint();
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 setParent(parent) {
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 isVisible (range) {
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 show() {
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 hide() {
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.repaint = function repaint() {
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 repositionX() {
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 repositionY() {
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 {Object} [options] Options to set initial property values
7
- * @param {Object} [defaultOptions] default options
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, options, defaultOptions) {
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, options, defaultOptions);
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 isVisible (range) {
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.repaint = function repaint() {
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 repaint item: no parent attached');
79
+ throw new Error('Cannot redraw item: no parent attached');
79
80
  }
80
81
  if (!dom.box.parentNode) {
81
- var foreground = this.parent.getForeground();
82
- if (!foreground) throw new Error('Cannot repaint time axis: parent has no foreground container element');
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.getBackground();
87
- if (!background) throw new Error('Cannot repaint time axis: parent has no background container element');
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.getAxis();
92
- if (!background) throw new Error('Cannot repaint time axis: parent has no axis container element');
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 show() {
145
+ ItemBox.prototype.show = function() {
145
146
  if (!this.displayed) {
146
- this.repaint();
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 hide() {
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 repositionX() {
173
- var start = this.defaultOptions.toScreen(this.data.start),
174
- align = this.options.align || this.defaultOptions.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 repositionY () {
207
- var orientation = this.options.orientation || this.defaultOptions.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 = (this.top || 0) + 'px';
214
- box.style.bottom = '';
214
+ box.style.top = (this.top || 0) + 'px';
215
215
 
216
- line.style.top = '0';
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
- box.style.top = '';
222
- box.style.bottom = (this.top || 0) + 'px';
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
- line.style.top = (this.parent.top + this.parent.height - this.top - 1) + 'px';
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';