@oddle.me/react-calendar-timeline 0.29.0 → 0.29.1
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 +103 -100
- package/lib/lib/Timeline.js +40 -3
- package/lib/lib/layout/Sidebar.js +25 -7
- package/lib/lib/markers/MarkerCanvas.js +7 -2
- package/lib/lib/scroll/ScrollElement.js +10 -14
- package/package.json +3 -1
- package/src/global.d.ts +373 -0
package/lib/Timeline.css
CHANGED
|
@@ -1,107 +1,110 @@
|
|
|
1
|
-
.react-calendar-timeline
|
|
2
|
-
box-sizing: border-box; }
|
|
3
|
-
|
|
4
|
-
.react-calendar-timeline .rct-outer {
|
|
5
|
-
display: block;
|
|
1
|
+
.react-calendar-timeline {
|
|
6
2
|
overflow: hidden;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.react-calendar-timeline
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
overflow-x: scroll;
|
|
14
|
-
overflow-y: hidden;
|
|
15
|
-
-ms-touch-action: none;
|
|
16
|
-
touch-action: none; }
|
|
17
|
-
|
|
18
|
-
.react-calendar-timeline .rct-item:hover {
|
|
19
|
-
z-index: 88; }
|
|
20
|
-
|
|
21
|
-
.react-calendar-timeline .rct-item .rct-item-content {
|
|
22
|
-
position: sticky;
|
|
23
|
-
position: -webkit-sticky;
|
|
24
|
-
left: 0px;
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
display: inline-block;
|
|
27
|
-
border-radius: 2px;
|
|
28
|
-
padding: 0 6px;
|
|
29
|
-
height: 100%; }
|
|
30
|
-
|
|
31
|
-
.react-calendar-timeline .rct-sidebar {
|
|
32
|
-
overflow: hidden;
|
|
33
|
-
white-space: normal;
|
|
34
|
-
display: inline-block;
|
|
35
|
-
vertical-align: top;
|
|
36
|
-
position: relative;
|
|
37
|
-
box-sizing: border-box;
|
|
38
|
-
border-right: 1px solid #bbb; }
|
|
39
|
-
.react-calendar-timeline .rct-sidebar.rct-sidebar-right {
|
|
40
|
-
border-right: 0;
|
|
41
|
-
border-left: 1px solid #bbb; }
|
|
42
|
-
.react-calendar-timeline .rct-sidebar .rct-sidebar-row {
|
|
43
|
-
padding: 0 4px;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column; }
|
|
5
|
+
.react-calendar-timeline * {
|
|
6
|
+
box-sizing: border-box; }
|
|
7
|
+
.react-calendar-timeline .rct-outer {
|
|
8
|
+
display: block;
|
|
44
9
|
overflow: hidden;
|
|
45
10
|
white-space: nowrap;
|
|
46
|
-
|
|
11
|
+
flex: 1;
|
|
12
|
+
height: 0;
|
|
13
|
+
overflow: hidden; }
|
|
14
|
+
.react-calendar-timeline .rct-scroll {
|
|
15
|
+
display: inline-block;
|
|
16
|
+
white-space: normal;
|
|
17
|
+
vertical-align: top;
|
|
18
|
+
overflow-x: hidden;
|
|
19
|
+
overflow-y: scroll;
|
|
20
|
+
-ms-touch-action: none;
|
|
21
|
+
touch-action: none;
|
|
22
|
+
height: 100% !important; }
|
|
23
|
+
.react-calendar-timeline .rct-item:hover {
|
|
24
|
+
z-index: 88; }
|
|
25
|
+
.react-calendar-timeline .rct-item .rct-item-content {
|
|
26
|
+
position: sticky;
|
|
27
|
+
position: -webkit-sticky;
|
|
28
|
+
left: 0px;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
display: inline-block;
|
|
31
|
+
border-radius: 2px;
|
|
32
|
+
padding: 0 6px;
|
|
33
|
+
height: 100%; }
|
|
34
|
+
.react-calendar-timeline .rct-sidebar {
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
white-space: normal;
|
|
37
|
+
display: inline-block;
|
|
38
|
+
vertical-align: top;
|
|
39
|
+
position: relative;
|
|
47
40
|
box-sizing: border-box;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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; }
|
|
51
|
+
.react-calendar-timeline .rct-sidebar.rct-sidebar-right {
|
|
52
|
+
border-right: 0;
|
|
53
|
+
border-left: 1px solid #bbb; }
|
|
54
|
+
.react-calendar-timeline .rct-sidebar .rct-sidebar-row {
|
|
55
|
+
padding: 0 4px;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
margin: 0;
|
|
61
|
+
border-bottom: 1px solid #bbb; }
|
|
62
|
+
.react-calendar-timeline .rct-sidebar .rct-sidebar-row.rct-sidebar-row-odd {
|
|
63
|
+
background: rgba(0, 0, 0, 0.05); }
|
|
64
|
+
.react-calendar-timeline .rct-sidebar .rct-sidebar-row.rct-sidebar-row-even {
|
|
65
|
+
background: transparent; }
|
|
66
|
+
.react-calendar-timeline .rct-vertical-lines .rct-vl {
|
|
67
|
+
position: absolute;
|
|
68
|
+
border-left: 1px solid #bbb;
|
|
69
|
+
z-index: 30; }
|
|
70
|
+
.react-calendar-timeline .rct-vertical-lines .rct-vl.rct-vl-first {
|
|
71
|
+
border-left-width: 2px; }
|
|
72
|
+
.react-calendar-timeline .rct-horizontal-lines {
|
|
73
|
+
-webkit-user-select: none;
|
|
74
|
+
-moz-user-select: -moz-none;
|
|
75
|
+
-ms-user-select: none;
|
|
76
|
+
user-select: none; }
|
|
77
|
+
.react-calendar-timeline .rct-horizontal-lines .rct-hl-even,
|
|
78
|
+
.react-calendar-timeline .rct-horizontal-lines .rct-hl-odd {
|
|
79
|
+
border-bottom: 1px solid #bbb;
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
z-index: 40; }
|
|
82
|
+
.react-calendar-timeline .rct-horizontal-lines .rct-hl-odd {
|
|
51
83
|
background: rgba(0, 0, 0, 0.05); }
|
|
52
|
-
.react-calendar-timeline .rct-
|
|
84
|
+
.react-calendar-timeline .rct-horizontal-lines .rct-hl-even {
|
|
53
85
|
background: transparent; }
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.react-calendar-timeline .rct-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.react-calendar-timeline .rct-horizontal-lines {
|
|
65
|
-
-webkit-user-select: none;
|
|
66
|
-
-moz-user-select: -moz-none;
|
|
67
|
-
-ms-user-select: none;
|
|
68
|
-
user-select: none; }
|
|
69
|
-
.react-calendar-timeline .rct-horizontal-lines .rct-hl-even,
|
|
70
|
-
.react-calendar-timeline .rct-horizontal-lines .rct-hl-odd {
|
|
86
|
+
.react-calendar-timeline .rct-cursor-line {
|
|
87
|
+
position: absolute;
|
|
88
|
+
width: 2px;
|
|
89
|
+
background: #2196f3;
|
|
90
|
+
z-index: 51; }
|
|
91
|
+
.react-calendar-timeline .rct-dateHeader {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
height: 100%;
|
|
71
96
|
border-bottom: 1px solid #bbb;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
.react-calendar-timeline .rct-
|
|
77
|
-
background:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
display: flex;
|
|
87
|
-
align-items: center;
|
|
88
|
-
justify-content: center;
|
|
89
|
-
height: 100%;
|
|
90
|
-
border-bottom: 1px solid #bbb;
|
|
91
|
-
cursor: pointer;
|
|
92
|
-
font-size: 14px;
|
|
93
|
-
background-color: #f0f0f0;
|
|
94
|
-
border-left: 2px solid #bbb; }
|
|
95
|
-
|
|
96
|
-
.react-calendar-timeline .rct-dateHeader-primary {
|
|
97
|
-
background-color: initial;
|
|
98
|
-
border-left: 1px solid #bbb;
|
|
99
|
-
border-right: 1px solid #bbb;
|
|
100
|
-
color: #fff; }
|
|
101
|
-
|
|
102
|
-
.react-calendar-timeline .rct-header-root {
|
|
103
|
-
background: #c52020;
|
|
104
|
-
border-bottom: 1px solid #bbb; }
|
|
105
|
-
|
|
106
|
-
.react-calendar-timeline .rct-calendar-header {
|
|
107
|
-
border: 1px solid #bbb; }
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
font-size: 14px;
|
|
99
|
+
background-color: #f0f0f0;
|
|
100
|
+
border-left: 2px solid #bbb; }
|
|
101
|
+
.react-calendar-timeline .rct-dateHeader-primary {
|
|
102
|
+
background-color: initial;
|
|
103
|
+
border-left: 1px solid #bbb;
|
|
104
|
+
border-right: 1px solid #bbb;
|
|
105
|
+
color: #fff; }
|
|
106
|
+
.react-calendar-timeline .rct-header-root {
|
|
107
|
+
background: #c52020;
|
|
108
|
+
border-bottom: 1px solid #bbb; }
|
|
109
|
+
.react-calendar-timeline .rct-calendar-header {
|
|
110
|
+
border: 1px solid #bbb; }
|
package/lib/lib/Timeline.js
CHANGED
|
@@ -154,7 +154,7 @@ function (_Component) {
|
|
|
154
154
|
_this.scrollHeaderRef.scrollLeft = scrollLeft;
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
_defineProperty(_assertThisInitialized(_this), "onScroll", function (scrollX) {
|
|
157
|
+
_defineProperty(_assertThisInitialized(_this), "onScroll", function (scrollX, scrollY) {
|
|
158
158
|
var width = _this.state.width;
|
|
159
159
|
var canvasTimeStart = _this.state.canvasTimeStart;
|
|
160
160
|
var zoom = _this.state.visibleTimeEnd - _this.state.visibleTimeStart;
|
|
@@ -163,6 +163,24 @@ function (_Component) {
|
|
|
163
163
|
if (_this.state.visibleTimeStart !== visibleTimeStart || _this.state.visibleTimeEnd !== visibleTimeStart + zoom) {
|
|
164
164
|
_this.props.onTimeChange(visibleTimeStart, visibleTimeStart + zoom, _this.updateScrollCanvas, _this.getTimelineUnit());
|
|
165
165
|
}
|
|
166
|
+
|
|
167
|
+
if (scrollY) {
|
|
168
|
+
_this.scrollComponent.scrollTo({
|
|
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
|
+
});
|
|
183
|
+
}
|
|
166
184
|
});
|
|
167
185
|
|
|
168
186
|
_defineProperty(_assertThisInitialized(_this), "updateScrollCanvas", function (visibleTimeStart, visibleTimeEnd, forceUpdateDimensions) {
|
|
@@ -428,6 +446,10 @@ function (_Component) {
|
|
|
428
446
|
_this.scrollComponent = el;
|
|
429
447
|
});
|
|
430
448
|
|
|
449
|
+
_defineProperty(_assertThisInitialized(_this), "getSidebarScrollElmRef", function (el) {
|
|
450
|
+
_this.sidebarScrollRef = el;
|
|
451
|
+
});
|
|
452
|
+
|
|
431
453
|
_this.getSelected = _this.getSelected.bind(_assertThisInitialized(_this));
|
|
432
454
|
_this.hasSelectedItem = _this.hasSelectedItem.bind(_assertThisInitialized(_this));
|
|
433
455
|
_this.isItemSelected = _this.isItemSelected.bind(_assertThisInitialized(_this));
|
|
@@ -495,6 +517,15 @@ function (_Component) {
|
|
|
495
517
|
_window["default"].addListener(this);
|
|
496
518
|
|
|
497
519
|
this.lastTouchDistance = null;
|
|
520
|
+
|
|
521
|
+
if (this.props.initialScrollTop) {
|
|
522
|
+
this.scrollComponent.scrollTo({
|
|
523
|
+
top: this.props.initialScrollTop
|
|
524
|
+
});
|
|
525
|
+
this.sidebarScrollRef.scrollTo({
|
|
526
|
+
top: this.props.initialScrollTop
|
|
527
|
+
});
|
|
528
|
+
}
|
|
498
529
|
}
|
|
499
530
|
}, {
|
|
500
531
|
key: "componentWillUnmount",
|
|
@@ -601,7 +632,9 @@ function (_Component) {
|
|
|
601
632
|
keys: this.props.keys,
|
|
602
633
|
width: sidebarWidth,
|
|
603
634
|
groupHeights: groupHeights,
|
|
604
|
-
height: height
|
|
635
|
+
height: height,
|
|
636
|
+
getSidebarScrollElmRef: this.getSidebarScrollElmRef,
|
|
637
|
+
onScroll: this.onSidebarScroll
|
|
605
638
|
});
|
|
606
639
|
}
|
|
607
640
|
}, {
|
|
@@ -754,7 +787,9 @@ function (_Component) {
|
|
|
754
787
|
traditionalZoom: traditionalZoom,
|
|
755
788
|
onScroll: this.onScroll,
|
|
756
789
|
isInteractingWithItem: isInteractingWithItem
|
|
757
|
-
}, _react["default"].createElement(_MarkerCanvas["default"],
|
|
790
|
+
}, _react["default"].createElement(_MarkerCanvas["default"], {
|
|
791
|
+
height: height
|
|
792
|
+
}, this.columns(canvasTimeStart, canvasTimeEnd, canvasWidth, minUnit, timeSteps, height), this.rows(canvasWidth, groupHeights, groups), this.items(canvasTimeStart, zoom, canvasTimeEnd, canvasWidth, minUnit, dimensionItems, groupHeights, groupTops), this.childrenWithProps(canvasTimeStart, canvasTimeEnd, canvasWidth, dimensionItems, groupHeights, groupTops, height, visibleTimeStart, visibleTimeEnd, minUnit, timeSteps))), rightSidebarWidth > 0 ? this.rightSidebar(height, groupHeights) : null)))));
|
|
758
793
|
}
|
|
759
794
|
}], [{
|
|
760
795
|
key: "getDerivedStateFromProps",
|
|
@@ -857,6 +892,7 @@ _defineProperty(ReactCalendarTimeline, "propTypes", {
|
|
|
857
892
|
visibleTimeEnd: _propTypes["default"].number,
|
|
858
893
|
onTimeChange: _propTypes["default"].func,
|
|
859
894
|
onBoundsChange: _propTypes["default"].func,
|
|
895
|
+
initialScrollTop: _propTypes["default"].number,
|
|
860
896
|
selected: _propTypes["default"].array,
|
|
861
897
|
resizeDetector: _propTypes["default"].shape({
|
|
862
898
|
addListener: _propTypes["default"].func,
|
|
@@ -915,6 +951,7 @@ _defineProperty(ReactCalendarTimeline, "defaultProps", {
|
|
|
915
951
|
// which needs to update the props visibleTimeStart and visibleTimeEnd to the ones passed
|
|
916
952
|
visibleTimeStart: null,
|
|
917
953
|
visibleTimeEnd: null,
|
|
954
|
+
initialScrollTop: 0,
|
|
918
955
|
onTimeChange: function onTimeChange(visibleTimeStart, visibleTimeEnd, updateScrollCanvas) {
|
|
919
956
|
updateScrollCanvas(visibleTimeStart, visibleTimeEnd);
|
|
920
957
|
},
|
|
@@ -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 _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
-
|
|
30
28
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
29
|
|
|
30
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
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,9 +41,23 @@ function (_Component) {
|
|
|
41
41
|
_inherits(Sidebar, _Component);
|
|
42
42
|
|
|
43
43
|
function Sidebar() {
|
|
44
|
+
var _getPrototypeOf2;
|
|
45
|
+
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
44
48
|
_classCallCheck(this, Sidebar);
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
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;
|
|
47
61
|
}
|
|
48
62
|
|
|
49
63
|
_createClass(Sidebar, [{
|
|
@@ -66,7 +80,7 @@ function (_Component) {
|
|
|
66
80
|
}, {
|
|
67
81
|
key: "render",
|
|
68
82
|
value: function render() {
|
|
69
|
-
var
|
|
83
|
+
var _this2 = this;
|
|
70
84
|
|
|
71
85
|
var _this$props = this.props,
|
|
72
86
|
width = _this$props.width,
|
|
@@ -93,11 +107,13 @@ function (_Component) {
|
|
|
93
107
|
key: (0, _generic._get)(group, groupIdKey),
|
|
94
108
|
className: 'rct-sidebar-row rct-sidebar-row-' + (index % 2 === 0 ? 'even' : 'odd'),
|
|
95
109
|
style: elementStyle
|
|
96
|
-
},
|
|
110
|
+
}, _this2.renderGroupContent(group, isRightSidebar, groupTitleKey, groupRightTitleKey));
|
|
97
111
|
});
|
|
98
112
|
return _react["default"].createElement("div", {
|
|
99
113
|
className: 'rct-sidebar' + (isRightSidebar ? ' rct-sidebar-right' : ''),
|
|
100
|
-
style: sidebarStyle
|
|
114
|
+
style: sidebarStyle,
|
|
115
|
+
onScroll: this.handleScroll,
|
|
116
|
+
ref: this.props.getSidebarScrollElmRef
|
|
101
117
|
}, _react["default"].createElement("div", {
|
|
102
118
|
style: groupsStyle
|
|
103
119
|
}, groupLines));
|
|
@@ -116,5 +132,7 @@ _defineProperty(Sidebar, "propTypes", {
|
|
|
116
132
|
groupHeights: _propTypes["default"].array.isRequired,
|
|
117
133
|
keys: _propTypes["default"].object.isRequired,
|
|
118
134
|
groupRenderer: _propTypes["default"].func,
|
|
119
|
-
isRightSidebar: _propTypes["default"].bool
|
|
135
|
+
isRightSidebar: _propTypes["default"].bool,
|
|
136
|
+
getSidebarScrollElmRef: _propTypes["default"].func,
|
|
137
|
+
onScroll: _propTypes["default"].func
|
|
120
138
|
});
|
|
@@ -21,6 +21,8 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
21
21
|
|
|
22
22
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
23
23
|
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { if (i % 2) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } else { Object.defineProperties(target, Object.getOwnPropertyDescriptors(arguments[i])); } } return target; }
|
|
25
|
+
|
|
24
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
27
|
|
|
26
28
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -128,7 +130,9 @@ function (_React$Component) {
|
|
|
128
130
|
return _react["default"].createElement(_MarkerCanvasContext.MarkerCanvasProvider, {
|
|
129
131
|
value: this.state
|
|
130
132
|
}, _react["default"].createElement("div", {
|
|
131
|
-
style: staticStyles,
|
|
133
|
+
style: _objectSpread({}, staticStyles, {
|
|
134
|
+
height: this.props.height
|
|
135
|
+
}),
|
|
132
136
|
onMouseMove: this.handleMouseMove,
|
|
133
137
|
onMouseLeave: this.handleMouseLeave,
|
|
134
138
|
ref: function ref(el) {
|
|
@@ -143,7 +147,8 @@ function (_React$Component) {
|
|
|
143
147
|
|
|
144
148
|
_defineProperty(MarkerCanvas, "propTypes", {
|
|
145
149
|
getDateFromLeftOffsetPosition: _propTypes["default"].func.isRequired,
|
|
146
|
-
children: _propTypes["default"].node
|
|
150
|
+
children: _propTypes["default"].node,
|
|
151
|
+
height: _propTypes["default"].number
|
|
147
152
|
});
|
|
148
153
|
|
|
149
154
|
var MarkerCanvasWrapper = function MarkerCanvasWrapper(props) {
|
|
@@ -49,8 +49,9 @@ function (_Component) {
|
|
|
49
49
|
|
|
50
50
|
_defineProperty(_assertThisInitialized(_this), "handleScroll", function () {
|
|
51
51
|
var scrollX = _this.scrollComponent.scrollLeft;
|
|
52
|
+
var scrollY = _this.scrollComponent.scrollTop;
|
|
52
53
|
|
|
53
|
-
_this.props.onScroll(scrollX);
|
|
54
|
+
_this.props.onScroll(scrollX, scrollY);
|
|
54
55
|
});
|
|
55
56
|
|
|
56
57
|
_defineProperty(_assertThisInitialized(_this), "refHandler", function (el) {
|
|
@@ -83,11 +84,6 @@ function (_Component) {
|
|
|
83
84
|
checking deltaX first in this ternary prevents bugs when both deltaY and deltaX are changing by prioritizing deltaX*/
|
|
84
85
|
|
|
85
86
|
_this.props.onScroll(_this.scrollComponent.scrollLeft + (e.deltaX || e.deltaY));
|
|
86
|
-
} else {
|
|
87
|
-
// no modifier pressed?
|
|
88
|
-
e.preventDefault();
|
|
89
|
-
_this.scrollComponent.scrollLeft += e.deltaX;
|
|
90
|
-
window.scrollBy(0, e.deltaY);
|
|
91
87
|
}
|
|
92
88
|
});
|
|
93
89
|
|
|
@@ -117,9 +113,12 @@ function (_Component) {
|
|
|
117
113
|
var yPositionChange = _this.dragLastPosition.y - e.pageY;
|
|
118
114
|
window.scrollBy(0, yPositionChange);
|
|
119
115
|
|
|
120
|
-
_this.props.onScroll(_this.scrollComponent.scrollLeft + _this.dragLastPosition.x - e.pageX);
|
|
116
|
+
_this.props.onScroll(_this.scrollComponent.scrollLeft + _this.dragLastPosition.x - e.pageX, _this.scrollComponent.scrollTop + _this.dragLastPosition.y - e.pageY);
|
|
121
117
|
|
|
122
|
-
_this.dragLastPosition
|
|
118
|
+
_this.dragLastPosition = {
|
|
119
|
+
x: e.pageX,
|
|
120
|
+
y: e.pageY
|
|
121
|
+
};
|
|
123
122
|
}
|
|
124
123
|
});
|
|
125
124
|
|
|
@@ -192,6 +191,7 @@ function (_Component) {
|
|
|
192
191
|
var x = e.touches[0].clientX;
|
|
193
192
|
var y = e.touches[0].clientY;
|
|
194
193
|
var deltaX = x - _this.lastSingleTouch.x;
|
|
194
|
+
var deltaY = x - _this.lastSingleTouch.y;
|
|
195
195
|
var deltaX0 = x - _this.singleTouchStart.x;
|
|
196
196
|
var deltaY0 = y - _this.singleTouchStart.y;
|
|
197
197
|
_this.lastSingleTouch = {
|
|
@@ -201,12 +201,8 @@ function (_Component) {
|
|
|
201
201
|
var moveX = Math.abs(deltaX0) * 3 > Math.abs(deltaY0);
|
|
202
202
|
var moveY = Math.abs(deltaY0) * 3 > Math.abs(deltaX0);
|
|
203
203
|
|
|
204
|
-
if (deltaX !== 0 && moveX) {
|
|
205
|
-
_this.props.onScroll(_this.scrollComponent.scrollLeft - deltaX);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (moveY) {
|
|
209
|
-
window.scrollTo(window.pageXOffset, _this.singleTouchStart.screenY - deltaY0);
|
|
204
|
+
if (deltaX !== 0 && moveX || deltaY !== 0 && moveY) {
|
|
205
|
+
_this.props.onScroll(_this.scrollComponent.scrollLeft - deltaX, _this.scrollComponent.scrollTop - deltaY);
|
|
210
206
|
}
|
|
211
207
|
}
|
|
212
208
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oddle.me/react-calendar-timeline",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.1",
|
|
4
4
|
"description": "react calendar timeline",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"types": "src/global.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"build": "npm run build:lib",
|
|
8
9
|
"build:demo": "echo '!!! Building Demo' && cross-env NODE_ENV=production webpack --progress",
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
"test:watch": "jest --watch"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
19
|
+
"src/global.d.ts",
|
|
18
20
|
"lib"
|
|
19
21
|
],
|
|
20
22
|
"publishConfig": {
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
// Project: https://github.com/namespace-ee/react-calendar-timeline
|
|
2
|
+
// Definitions by: Rajab Shakirov <https://github.com/radziksh>
|
|
3
|
+
// Andrii Los <https://github.com/rip21>
|
|
4
|
+
// Jon Caruana <https://github.com/joncar>
|
|
5
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
6
|
+
// TypeScript Version: 3.5
|
|
7
|
+
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { Moment } from 'moment';
|
|
10
|
+
|
|
11
|
+
declare module '@oddle.me/react-calendar-timeline' {
|
|
12
|
+
type Id = number | string;
|
|
13
|
+
|
|
14
|
+
export interface TimelineGroupBase {
|
|
15
|
+
id: Id;
|
|
16
|
+
title: React.ReactNode;
|
|
17
|
+
rightTitle?: React.ReactNode | undefined;
|
|
18
|
+
height?: number | undefined;
|
|
19
|
+
stackItems?: boolean | undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface TimelineItemBase<DateType> {
|
|
23
|
+
id: Id;
|
|
24
|
+
group: Id;
|
|
25
|
+
title?: React.ReactNode | undefined;
|
|
26
|
+
start_time: DateType;
|
|
27
|
+
end_time: DateType;
|
|
28
|
+
canMove?: boolean | undefined;
|
|
29
|
+
canResize?: boolean | 'left' | 'right' | 'both' | undefined;
|
|
30
|
+
canChangeGroup?: boolean | undefined;
|
|
31
|
+
className?: string | undefined;
|
|
32
|
+
style?: React.CSSProperties | undefined;
|
|
33
|
+
itemProps?: React.HTMLAttributes<HTMLDivElement> | undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type TimelineItem<CustomItemFields, DateType = number> = TimelineItemBase<DateType> & CustomItemFields;
|
|
37
|
+
export type TimelineGroup<CustomGroupFields> = TimelineGroupBase & CustomGroupFields;
|
|
38
|
+
|
|
39
|
+
export interface TimelineContext {
|
|
40
|
+
timelineWidth: number;
|
|
41
|
+
visibleTimeStart: number;
|
|
42
|
+
visibleTimeEnd: number;
|
|
43
|
+
canvasTimeStart: number;
|
|
44
|
+
canvasTimeEnd: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ItemContext {
|
|
48
|
+
dimensions: {
|
|
49
|
+
collisionLeft: number;
|
|
50
|
+
collisionWidth: number;
|
|
51
|
+
height: number;
|
|
52
|
+
isDragging: boolean;
|
|
53
|
+
left: number;
|
|
54
|
+
order: {
|
|
55
|
+
group: {
|
|
56
|
+
id: string;
|
|
57
|
+
};
|
|
58
|
+
index: number;
|
|
59
|
+
};
|
|
60
|
+
originalLeft: number;
|
|
61
|
+
stack: boolean;
|
|
62
|
+
top: number | null;
|
|
63
|
+
width: number;
|
|
64
|
+
};
|
|
65
|
+
useResizeHandle: boolean;
|
|
66
|
+
title: string;
|
|
67
|
+
canMove: boolean;
|
|
68
|
+
canResizeLeft: boolean;
|
|
69
|
+
canResizeRight: boolean;
|
|
70
|
+
selected: boolean;
|
|
71
|
+
dragging: boolean;
|
|
72
|
+
dragStart: {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
};
|
|
76
|
+
dragTime: number;
|
|
77
|
+
dragGroupDelta: number;
|
|
78
|
+
resizing: boolean;
|
|
79
|
+
resizeEdge: 'left' | 'right';
|
|
80
|
+
resizeStart: number;
|
|
81
|
+
resizeTime: number;
|
|
82
|
+
width: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface TimeFormat {
|
|
86
|
+
long: string;
|
|
87
|
+
mediumLong: string;
|
|
88
|
+
medium: string;
|
|
89
|
+
short: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface LabelFormat {
|
|
93
|
+
year: TimeFormat;
|
|
94
|
+
month: TimeFormat;
|
|
95
|
+
week: TimeFormat;
|
|
96
|
+
day: TimeFormat;
|
|
97
|
+
hour: TimeFormat;
|
|
98
|
+
minute: TimeFormat;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface ItemRendererGetItemPropsReturnType {
|
|
102
|
+
key: Id;
|
|
103
|
+
ref: React.Ref<any>;
|
|
104
|
+
className: string;
|
|
105
|
+
onMouseDown: React.MouseEventHandler;
|
|
106
|
+
onMouseUp: React.MouseEventHandler;
|
|
107
|
+
onTouchStart: React.TouchEventHandler;
|
|
108
|
+
onTouchEnd: React.TouchEventHandler;
|
|
109
|
+
onDoubleClick: React.MouseEventHandler;
|
|
110
|
+
onContextMenu: React.ReactEventHandler;
|
|
111
|
+
style: React.CSSProperties;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type GetItemsProps = Partial<Omit<ItemRendererGetItemPropsReturnType, 'key' | 'ref'>>;
|
|
115
|
+
|
|
116
|
+
export interface ItemRendererGetResizePropsReturnType {
|
|
117
|
+
left?: {
|
|
118
|
+
ref: React.Ref<any>;
|
|
119
|
+
className: string;
|
|
120
|
+
style: React.CSSProperties;
|
|
121
|
+
} | undefined;
|
|
122
|
+
right?: {
|
|
123
|
+
ref: React.Ref<any>;
|
|
124
|
+
className: string;
|
|
125
|
+
style: React.CSSProperties;
|
|
126
|
+
} | undefined;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type GetResizeProps = {
|
|
130
|
+
leftStyle?: React.CSSProperties | undefined;
|
|
131
|
+
rightStyle?: React.CSSProperties | undefined;
|
|
132
|
+
leftClassName?: string | undefined;
|
|
133
|
+
rightClassName?: string | undefined;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export interface ReactCalendarItemRendererProps<
|
|
137
|
+
CustomItem extends TimelineItemBase<any> = TimelineItemBase<number>
|
|
138
|
+
> {
|
|
139
|
+
item: CustomItem;
|
|
140
|
+
itemContext: ItemContext;
|
|
141
|
+
getItemProps: (
|
|
142
|
+
props: GetItemsProps,
|
|
143
|
+
) => {
|
|
144
|
+
key: Id;
|
|
145
|
+
ref: React.Ref<any>;
|
|
146
|
+
className: string;
|
|
147
|
+
onMouseDown: React.MouseEventHandler;
|
|
148
|
+
onMouseUp: React.MouseEventHandler;
|
|
149
|
+
onTouchStart: React.TouchEventHandler;
|
|
150
|
+
onTouchEnd: React.TouchEventHandler;
|
|
151
|
+
onDoubleClick: React.MouseEventHandler;
|
|
152
|
+
onContextMenu: React.ReactEventHandler;
|
|
153
|
+
style: React.CSSProperties;
|
|
154
|
+
};
|
|
155
|
+
getResizeProps: (propsOverride?: GetResizeProps) => ItemRendererGetResizePropsReturnType;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface ReactCalendarGroupRendererProps<CustomGroup extends TimelineGroupBase = TimelineGroupBase> {
|
|
159
|
+
group: CustomGroup;
|
|
160
|
+
isRightSidebar?: boolean | undefined;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface OnItemDragObjectBase {
|
|
164
|
+
eventType: 'move' | 'resize';
|
|
165
|
+
itemId: Id;
|
|
166
|
+
time: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface OnItemDragObjectMove extends OnItemDragObjectBase {
|
|
170
|
+
eventType: 'move';
|
|
171
|
+
newGroupOrder: number;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface OnItemDragObjectResize extends OnItemDragObjectBase {
|
|
175
|
+
eventType: 'resize';
|
|
176
|
+
edge?: 'left' | 'right' | undefined;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface TimelineKeys {
|
|
180
|
+
groupIdKey: string;
|
|
181
|
+
groupTitleKey: string;
|
|
182
|
+
groupRightTitleKey: string;
|
|
183
|
+
itemIdKey: string;
|
|
184
|
+
itemTitleKey: string;
|
|
185
|
+
itemDivTitleKey: string;
|
|
186
|
+
itemGroupKey: string;
|
|
187
|
+
itemTimeStartKey: string;
|
|
188
|
+
itemTimeEndKey: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface ReactCalendarTimelineProps<
|
|
192
|
+
CustomItem extends TimelineItemBase<any> = TimelineItemBase<number>,
|
|
193
|
+
CustomGroup extends TimelineGroupBase = TimelineGroupBase
|
|
194
|
+
> {
|
|
195
|
+
children?: React.ReactNode;
|
|
196
|
+
groups: CustomGroup[];
|
|
197
|
+
items: CustomItem[];
|
|
198
|
+
keys?: TimelineKeys | undefined;
|
|
199
|
+
defaultTimeStart?: Date | Moment | undefined;
|
|
200
|
+
defaultTimeEnd?: Date | Moment | undefined;
|
|
201
|
+
visibleTimeStart?: Date | Moment | number | undefined;
|
|
202
|
+
visibleTimeEnd?: Date | Moment | number | undefined;
|
|
203
|
+
selected?: Id[] | undefined;
|
|
204
|
+
sidebarWidth?: number | undefined;
|
|
205
|
+
sidebarContent?: React.ReactNode | undefined;
|
|
206
|
+
rightSidebarWidth?: number | undefined;
|
|
207
|
+
rightSidebarContent?: React.ReactNode | undefined;
|
|
208
|
+
dragSnap?: number | undefined;
|
|
209
|
+
minResizeWidth?: number | undefined;
|
|
210
|
+
lineHeight?: number | undefined;
|
|
211
|
+
itemHeightRatio?: number | undefined;
|
|
212
|
+
minZoom?: number | undefined;
|
|
213
|
+
maxZoom?: number | undefined;
|
|
214
|
+
clickTolerance?: number | undefined;
|
|
215
|
+
canMove?: boolean | undefined;
|
|
216
|
+
canChangeGroup?: boolean | undefined;
|
|
217
|
+
canResize?: false | true | 'left' | 'right' | 'both' | undefined;
|
|
218
|
+
useResizeHandle?: boolean | undefined;
|
|
219
|
+
stackItems?: boolean | undefined;
|
|
220
|
+
traditionalZoom?: boolean | undefined;
|
|
221
|
+
itemTouchSendsClick?: boolean | undefined;
|
|
222
|
+
timeSteps?: TimelineTimeSteps | undefined;
|
|
223
|
+
scrollRef?: React.Ref<any> | undefined;
|
|
224
|
+
onItemDrag?(itemDragObject: OnItemDragObjectMove | OnItemDragObjectResize): void;
|
|
225
|
+
onItemMove?(itemId: Id, dragTime: number, newGroupOrder: number): void;
|
|
226
|
+
onItemResize?(itemId: Id, endTimeOrStartTime: number, edge: 'left' | 'right'): void;
|
|
227
|
+
onItemSelect?(itemId: Id, e: any, time: number): void;
|
|
228
|
+
onItemDeselect?(e: React.SyntheticEvent): void;
|
|
229
|
+
onItemClick?(itemId: Id, e: React.SyntheticEvent, time: number): void;
|
|
230
|
+
onItemDoubleClick?(itemId: Id, e: React.SyntheticEvent, time: number): void;
|
|
231
|
+
onItemContextMenu?(itemId: Id, e: React.SyntheticEvent, time: number): void;
|
|
232
|
+
onCanvasClick?(groupId: Id, time: number, e: React.SyntheticEvent): void;
|
|
233
|
+
onCanvasDoubleClick?(groupId: Id, time: number, e: React.SyntheticEvent): void;
|
|
234
|
+
onCanvasContextMenu?(groupId: Id, time: number, e: React.SyntheticEvent): void;
|
|
235
|
+
onZoom?(timelineContext: TimelineContext, unit: Unit): void;
|
|
236
|
+
moveResizeValidator?(
|
|
237
|
+
action: 'move' | 'resize',
|
|
238
|
+
itemId: Id,
|
|
239
|
+
time: number,
|
|
240
|
+
resizeEdge: 'left' | 'right',
|
|
241
|
+
): number;
|
|
242
|
+
onTimeChange?(
|
|
243
|
+
visibleTimeStart: number,
|
|
244
|
+
visibleTimeEnd: number,
|
|
245
|
+
updateScrollCanvas: (start: number, end: number) => void,
|
|
246
|
+
unit: Unit
|
|
247
|
+
): any;
|
|
248
|
+
onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any;
|
|
249
|
+
itemRenderer?: ((props: ReactCalendarItemRendererProps<CustomItem>) => React.ReactNode) | undefined;
|
|
250
|
+
groupRenderer?: ((props: ReactCalendarGroupRendererProps<CustomGroup>) => React.ReactNode) | undefined;
|
|
251
|
+
resizeDetector?: ((containerResizeDetector: any) => void) | undefined;
|
|
252
|
+
verticalLineClassNamesForTime?: ((start: number, end: number) => string[] | undefined) | undefined;
|
|
253
|
+
horizontalLineClassNamesForGroup?: ((group: CustomGroup) => string[]) | undefined;
|
|
254
|
+
buffer?: number | undefined;
|
|
255
|
+
// Fields that are in propTypes but not documented
|
|
256
|
+
headerRef?: React.Ref<any> | undefined;
|
|
257
|
+
className?: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface TimelineTimeSteps {
|
|
261
|
+
second: number;
|
|
262
|
+
minute: number;
|
|
263
|
+
hour: number;
|
|
264
|
+
day: number;
|
|
265
|
+
month: number;
|
|
266
|
+
year: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export class TimelineMarkers extends React.Component {}
|
|
270
|
+
|
|
271
|
+
export interface CustomMarkerChildrenProps {
|
|
272
|
+
styles: React.CSSProperties;
|
|
273
|
+
date: number;
|
|
274
|
+
}
|
|
275
|
+
export interface MarkerProps {
|
|
276
|
+
date: Date | number;
|
|
277
|
+
children?: ((props: CustomMarkerChildrenProps) => React.ReactNode) | undefined;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export class CustomMarker extends React.Component<MarkerProps> {}
|
|
281
|
+
|
|
282
|
+
export interface TodayMarkerProps extends MarkerProps {
|
|
283
|
+
interval?: number | undefined;
|
|
284
|
+
}
|
|
285
|
+
export class TodayMarker extends React.Component<TodayMarkerProps> {}
|
|
286
|
+
|
|
287
|
+
export type CursorMarkerProps = Omit<MarkerProps, 'date'>;
|
|
288
|
+
export class CursorMarker extends React.Component<CursorMarkerProps> {}
|
|
289
|
+
|
|
290
|
+
export interface TimelineHeadersProps {
|
|
291
|
+
children?: React.ReactNode;
|
|
292
|
+
style?: React.CSSProperties | undefined;
|
|
293
|
+
className?: string | undefined;
|
|
294
|
+
calendarHeaderStyle?: React.CSSProperties | undefined;
|
|
295
|
+
calendarHeaderClassName?: string | undefined;
|
|
296
|
+
headerRef?: React.Ref<any> | undefined;
|
|
297
|
+
}
|
|
298
|
+
export class TimelineHeaders extends React.Component<TimelineHeadersProps> {}
|
|
299
|
+
|
|
300
|
+
export type TimelineHeaderProps = TimelineHeadersProps;
|
|
301
|
+
|
|
302
|
+
export interface SidebarHeaderChildrenFnProps<Data> {
|
|
303
|
+
getRootProps: (propsToOverride?: { style: React.CSSProperties }) => { style: React.CSSProperties };
|
|
304
|
+
data: Data;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface SidebarHeaderProps<Data> {
|
|
308
|
+
variant?: 'left' | 'right' | undefined;
|
|
309
|
+
headerData?: Data | undefined;
|
|
310
|
+
children: (props: SidebarHeaderChildrenFnProps<Data>) => React.ReactNode;
|
|
311
|
+
}
|
|
312
|
+
export class SidebarHeader<Data = any> extends React.Component<SidebarHeaderProps<Data>> {}
|
|
313
|
+
|
|
314
|
+
export type Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'isoWeek' | 'month' | 'year';
|
|
315
|
+
|
|
316
|
+
export interface IntervalContext {
|
|
317
|
+
interval: { startTime: number; endTime: number; labelWidth: number; left: number };
|
|
318
|
+
intervalText: string;
|
|
319
|
+
}
|
|
320
|
+
export interface GetIntervalProps {
|
|
321
|
+
interval?: Interval | undefined;
|
|
322
|
+
style?: React.CSSProperties | undefined;
|
|
323
|
+
onClick?: React.MouseEventHandler | undefined;
|
|
324
|
+
}
|
|
325
|
+
export interface IntervalRenderer<Data> {
|
|
326
|
+
intervalContext: IntervalContext;
|
|
327
|
+
getIntervalProps: (props?: GetIntervalProps) => Required<GetIntervalProps> & { key: string | number };
|
|
328
|
+
data?: Data | undefined;
|
|
329
|
+
}
|
|
330
|
+
export interface DateHeaderProps<Data> {
|
|
331
|
+
style?: React.CSSProperties | undefined;
|
|
332
|
+
className?: string | undefined;
|
|
333
|
+
unit?: Unit | 'primaryHeader' | undefined;
|
|
334
|
+
labelFormat?: string | (([startTime, endTime]: [Moment, Moment], unit: Unit, labelWidth: number) => string) | undefined;
|
|
335
|
+
intervalRenderer?: ((props?: IntervalRenderer<Data>) => React.ReactNode) | undefined;
|
|
336
|
+
headerData?: Data | undefined;
|
|
337
|
+
children?: ((props: SidebarHeaderChildrenFnProps<Data>) => React.ReactNode) | undefined;
|
|
338
|
+
height?: number | undefined;
|
|
339
|
+
}
|
|
340
|
+
export class DateHeader<Data = any> extends React.Component<DateHeaderProps<Data>> {}
|
|
341
|
+
export interface Interval {
|
|
342
|
+
startTime: Moment;
|
|
343
|
+
endTime: Moment;
|
|
344
|
+
}
|
|
345
|
+
export interface HeaderContext {
|
|
346
|
+
intervals: { startTime: Moment; endTime: Moment }[];
|
|
347
|
+
unit: string;
|
|
348
|
+
}
|
|
349
|
+
export interface CustomHeaderPropsChildrenFnProps<Data> {
|
|
350
|
+
timelineContext: TimelineContext;
|
|
351
|
+
headerContext: HeaderContext;
|
|
352
|
+
getIntervalProps: (props?: GetIntervalProps) => Required<GetIntervalProps> & { key: string | number };
|
|
353
|
+
getRootProps: (propsToOverride?: { style: React.CSSProperties }) => { style: React.CSSProperties };
|
|
354
|
+
showPeriod: (startDate: Moment | number, endDate: Moment | number) => void;
|
|
355
|
+
data: Data;
|
|
356
|
+
}
|
|
357
|
+
export interface CustomHeaderProps<Data> {
|
|
358
|
+
unit?: Unit | undefined;
|
|
359
|
+
headerData?: Data | undefined;
|
|
360
|
+
height?: number | undefined;
|
|
361
|
+
children: (props?: CustomHeaderPropsChildrenFnProps<Data>) => React.ReactNode;
|
|
362
|
+
}
|
|
363
|
+
export class CustomHeader<Data = any> extends React.Component<CustomHeaderProps<Data>> {}
|
|
364
|
+
|
|
365
|
+
export const defaultKeys: TimelineKeys;
|
|
366
|
+
export const defaultTimeSteps: TimelineTimeSteps;
|
|
367
|
+
export const defaultHeaderFormats: LabelFormat;
|
|
368
|
+
|
|
369
|
+
export default class ReactCalendarTimeline<
|
|
370
|
+
CustomItem extends TimelineItemBase<any> = TimelineItemBase<number>,
|
|
371
|
+
CustomGroup extends TimelineGroupBase = TimelineGroupBase
|
|
372
|
+
> extends React.Component<ReactCalendarTimelineProps<CustomItem, CustomGroup>> {}
|
|
373
|
+
}
|