@oddle.me/react-calendar-timeline 0.29.2 → 0.29.4
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/lib/Timeline.css +5 -17
- package/lib/lib/Timeline.js +10 -26
- package/lib/lib/layout/Sidebar.js +7 -25
- package/lib/lib/scroll/ScrollElement.js +1 -1
- package/package.json +1 -1
- package/src/global.d.ts +1 -0
package/lib/Timeline.css
CHANGED
|
@@ -6,20 +6,18 @@
|
|
|
6
6
|
box-sizing: border-box; }
|
|
7
7
|
.react-calendar-timeline .rct-outer {
|
|
8
8
|
display: block;
|
|
9
|
-
overflow:
|
|
9
|
+
overflow-y: auto;
|
|
10
|
+
overflow-x: hidden;
|
|
10
11
|
white-space: nowrap;
|
|
11
12
|
flex: 1;
|
|
12
|
-
height: 0;
|
|
13
|
-
overflow: hidden; }
|
|
13
|
+
height: 0; }
|
|
14
14
|
.react-calendar-timeline .rct-scroll {
|
|
15
15
|
display: inline-block;
|
|
16
16
|
white-space: normal;
|
|
17
17
|
vertical-align: top;
|
|
18
|
-
overflow-x: hidden;
|
|
19
|
-
overflow-y: scroll;
|
|
20
18
|
-ms-touch-action: none;
|
|
21
19
|
touch-action: none;
|
|
22
|
-
|
|
20
|
+
overflow-x: hidden; }
|
|
23
21
|
.react-calendar-timeline .rct-item:hover {
|
|
24
22
|
z-index: 88; }
|
|
25
23
|
.react-calendar-timeline .rct-item .rct-item-content {
|
|
@@ -32,22 +30,12 @@
|
|
|
32
30
|
padding: 0 6px;
|
|
33
31
|
height: 100%; }
|
|
34
32
|
.react-calendar-timeline .rct-sidebar {
|
|
35
|
-
overflow: hidden;
|
|
36
33
|
white-space: normal;
|
|
37
34
|
display: inline-block;
|
|
38
35
|
vertical-align: top;
|
|
39
36
|
position: relative;
|
|
40
37
|
box-sizing: border-box;
|
|
41
|
-
border-right: 1px solid #bbb;
|
|
42
|
-
overflow-x: hidden;
|
|
43
|
-
overflow-y: scroll;
|
|
44
|
-
height: 100% !important;
|
|
45
|
-
-ms-overflow-style: none;
|
|
46
|
-
/* IE and Edge */
|
|
47
|
-
scrollbar-width: none;
|
|
48
|
-
/* Firefox */ }
|
|
49
|
-
.react-calendar-timeline .rct-sidebar::-webkit-scrollbar {
|
|
50
|
-
display: none; }
|
|
38
|
+
border-right: 1px solid #bbb; }
|
|
51
39
|
.react-calendar-timeline .rct-sidebar.rct-sidebar-right {
|
|
52
40
|
border-right: 0;
|
|
53
41
|
border-left: 1px solid #bbb; }
|
package/lib/lib/Timeline.js
CHANGED
|
@@ -165,21 +165,7 @@ function (_Component) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
if (scrollY) {
|
|
168
|
-
_this.
|
|
169
|
-
top: scrollY
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
_this.sidebarScrollRef.scrollTo({
|
|
173
|
-
top: scrollY
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
_defineProperty(_assertThisInitialized(_this), "onSidebarScroll", function (newTop) {
|
|
179
|
-
if (_this.scrollComponent) {
|
|
180
|
-
_this.scrollComponent.scrollTo({
|
|
181
|
-
top: newTop
|
|
182
|
-
});
|
|
168
|
+
_this.outerScrollElm.scrollTop += scrollY;
|
|
183
169
|
}
|
|
184
170
|
});
|
|
185
171
|
|
|
@@ -446,8 +432,10 @@ function (_Component) {
|
|
|
446
432
|
_this.scrollComponent = el;
|
|
447
433
|
});
|
|
448
434
|
|
|
449
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
450
|
-
_this.
|
|
435
|
+
_defineProperty(_assertThisInitialized(_this), "getOuterScrollElementRef", function (el) {
|
|
436
|
+
_this.props.outerScrollRef(el);
|
|
437
|
+
|
|
438
|
+
_this.outerScrollElm = el;
|
|
451
439
|
});
|
|
452
440
|
|
|
453
441
|
_this.getSelected = _this.getSelected.bind(_assertThisInitialized(_this));
|
|
@@ -519,12 +507,7 @@ function (_Component) {
|
|
|
519
507
|
this.lastTouchDistance = null;
|
|
520
508
|
|
|
521
509
|
if (this.props.initialScrollTop) {
|
|
522
|
-
this.
|
|
523
|
-
top: this.props.initialScrollTop
|
|
524
|
-
});
|
|
525
|
-
this.sidebarScrollRef.scrollTo({
|
|
526
|
-
top: this.props.initialScrollTop
|
|
527
|
-
});
|
|
510
|
+
this.outerScrollElm.scrollTop = this.props.initialScrollTop;
|
|
528
511
|
}
|
|
529
512
|
}
|
|
530
513
|
}, {
|
|
@@ -632,9 +615,7 @@ function (_Component) {
|
|
|
632
615
|
keys: this.props.keys,
|
|
633
616
|
width: sidebarWidth,
|
|
634
617
|
groupHeights: groupHeights,
|
|
635
|
-
height: height
|
|
636
|
-
getSidebarScrollElmRef: this.getSidebarScrollElmRef,
|
|
637
|
-
onScroll: this.onSidebarScroll
|
|
618
|
+
height: height
|
|
638
619
|
});
|
|
639
620
|
}
|
|
640
621
|
}, {
|
|
@@ -777,6 +758,7 @@ function (_Component) {
|
|
|
777
758
|
className: "react-calendar-timeline ".concat(this.props.className)
|
|
778
759
|
}, this.renderHeaders(), _react["default"].createElement("div", {
|
|
779
760
|
style: outerComponentStyle,
|
|
761
|
+
ref: this.getOuterScrollElementRef,
|
|
780
762
|
className: "rct-outer"
|
|
781
763
|
}, sidebarWidth > 0 ? this.sidebar(height, groupHeights) : null, _react["default"].createElement(_ScrollElement["default"], {
|
|
782
764
|
scrollRef: this.getScrollElementRef,
|
|
@@ -878,6 +860,7 @@ _defineProperty(ReactCalendarTimeline, "propTypes", {
|
|
|
878
860
|
}),
|
|
879
861
|
headerRef: _propTypes["default"].func,
|
|
880
862
|
scrollRef: _propTypes["default"].func,
|
|
863
|
+
outerScrollRef: _propTypes["default"].func,
|
|
881
864
|
timeSteps: _propTypes["default"].shape({
|
|
882
865
|
second: _propTypes["default"].number,
|
|
883
866
|
minute: _propTypes["default"].number,
|
|
@@ -947,6 +930,7 @@ _defineProperty(ReactCalendarTimeline, "defaultProps", {
|
|
|
947
930
|
timeSteps: _defaultConfig.defaultTimeSteps,
|
|
948
931
|
headerRef: function headerRef() {},
|
|
949
932
|
scrollRef: function scrollRef() {},
|
|
933
|
+
outerScrollRef: function outerScrollRef() {},
|
|
950
934
|
// if you pass in visibleTimeStart and visibleTimeEnd, you must also pass onTimeChange(visibleTimeStart, visibleTimeEnd),
|
|
951
935
|
// which needs to update the props visibleTimeStart and visibleTimeEnd to the ones passed
|
|
952
936
|
visibleTimeStart: null,
|
|
@@ -25,10 +25,10 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
25
25
|
|
|
26
26
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
27
27
|
|
|
28
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
29
|
-
|
|
30
28
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
31
29
|
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
|
|
32
32
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
33
33
|
|
|
34
34
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
@@ -41,23 +41,9 @@ function (_Component) {
|
|
|
41
41
|
_inherits(Sidebar, _Component);
|
|
42
42
|
|
|
43
43
|
function Sidebar() {
|
|
44
|
-
var _getPrototypeOf2;
|
|
45
|
-
|
|
46
|
-
var _this;
|
|
47
|
-
|
|
48
44
|
_classCallCheck(this, Sidebar);
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
args[_key] = arguments[_key];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Sidebar)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
55
|
-
|
|
56
|
-
_defineProperty(_assertThisInitialized(_this), "handleScroll", function (e) {
|
|
57
|
-
_this.props.onScroll(e.target.scrollTop);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return _this;
|
|
46
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(Sidebar).apply(this, arguments));
|
|
61
47
|
}
|
|
62
48
|
|
|
63
49
|
_createClass(Sidebar, [{
|
|
@@ -80,7 +66,7 @@ function (_Component) {
|
|
|
80
66
|
}, {
|
|
81
67
|
key: "render",
|
|
82
68
|
value: function render() {
|
|
83
|
-
var
|
|
69
|
+
var _this = this;
|
|
84
70
|
|
|
85
71
|
var _this$props = this.props,
|
|
86
72
|
width = _this$props.width,
|
|
@@ -107,13 +93,11 @@ function (_Component) {
|
|
|
107
93
|
key: (0, _generic._get)(group, groupIdKey),
|
|
108
94
|
className: 'rct-sidebar-row rct-sidebar-row-' + (index % 2 === 0 ? 'even' : 'odd'),
|
|
109
95
|
style: elementStyle
|
|
110
|
-
},
|
|
96
|
+
}, _this.renderGroupContent(group, isRightSidebar, groupTitleKey, groupRightTitleKey));
|
|
111
97
|
});
|
|
112
98
|
return _react["default"].createElement("div", {
|
|
113
99
|
className: 'rct-sidebar' + (isRightSidebar ? ' rct-sidebar-right' : ''),
|
|
114
|
-
style: sidebarStyle
|
|
115
|
-
onScroll: this.handleScroll,
|
|
116
|
-
ref: this.props.getSidebarScrollElmRef
|
|
100
|
+
style: sidebarStyle
|
|
117
101
|
}, _react["default"].createElement("div", {
|
|
118
102
|
style: groupsStyle
|
|
119
103
|
}, groupLines));
|
|
@@ -132,7 +116,5 @@ _defineProperty(Sidebar, "propTypes", {
|
|
|
132
116
|
groupHeights: _propTypes["default"].array.isRequired,
|
|
133
117
|
keys: _propTypes["default"].object.isRequired,
|
|
134
118
|
groupRenderer: _propTypes["default"].func,
|
|
135
|
-
isRightSidebar: _propTypes["default"].bool
|
|
136
|
-
getSidebarScrollElmRef: _propTypes["default"].func,
|
|
137
|
-
onScroll: _propTypes["default"].func
|
|
119
|
+
isRightSidebar: _propTypes["default"].bool
|
|
138
120
|
});
|
|
@@ -191,7 +191,7 @@ function (_Component) {
|
|
|
191
191
|
var x = e.touches[0].clientX;
|
|
192
192
|
var y = e.touches[0].clientY;
|
|
193
193
|
var deltaX = x - _this.lastSingleTouch.x;
|
|
194
|
-
var deltaY =
|
|
194
|
+
var deltaY = y - _this.lastSingleTouch.y;
|
|
195
195
|
var deltaX0 = x - _this.singleTouchStart.x;
|
|
196
196
|
var deltaY0 = y - _this.singleTouchStart.y;
|
|
197
197
|
_this.lastSingleTouch = {
|
package/package.json
CHANGED
package/src/global.d.ts
CHANGED
|
@@ -221,6 +221,7 @@ declare module '@oddle.me/react-calendar-timeline' {
|
|
|
221
221
|
itemTouchSendsClick?: boolean | undefined;
|
|
222
222
|
timeSteps?: TimelineTimeSteps | undefined;
|
|
223
223
|
scrollRef?: React.Ref<any> | undefined;
|
|
224
|
+
outerScrollRef?: React.Ref<any> | undefined;
|
|
224
225
|
onItemDrag?(itemDragObject: OnItemDragObjectMove | OnItemDragObjectResize): void;
|
|
225
226
|
onItemMove?(itemId: Id, dragTime: number, newGroupOrder: number): void;
|
|
226
227
|
onItemResize?(itemId: Id, endTimeOrStartTime: number, edge: 'left' | 'right'): void;
|