@oddle.me/react-calendar-timeline 0.29.0-rc3
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/LICENSE.md +8 -0
- package/README.md +1298 -0
- package/lib/Timeline.css +107 -0
- package/lib/index.js +77 -0
- package/lib/lib/Timeline.js +929 -0
- package/lib/lib/columns/Columns.js +137 -0
- package/lib/lib/default-config.js +73 -0
- package/lib/lib/headers/CustomDateHeader.js +48 -0
- package/lib/lib/headers/CustomHeader.js +276 -0
- package/lib/lib/headers/DateHeader.js +206 -0
- package/lib/lib/headers/HeadersContext.js +94 -0
- package/lib/lib/headers/Interval.js +131 -0
- package/lib/lib/headers/SidebarHeader.js +130 -0
- package/lib/lib/headers/TimelineHeaders.js +180 -0
- package/lib/lib/headers/constants.js +10 -0
- package/lib/lib/interaction/PreventClickOnDrag.js +99 -0
- package/lib/lib/items/Item.js +627 -0
- package/lib/lib/items/Items.js +178 -0
- package/lib/lib/items/defaultItemRenderer.js +40 -0
- package/lib/lib/items/styles.js +65 -0
- package/lib/lib/layout/Sidebar.js +120 -0
- package/lib/lib/markers/MarkerCanvas.js +159 -0
- package/lib/lib/markers/MarkerCanvasContext.js +28 -0
- package/lib/lib/markers/TimelineMarkersContext.js +157 -0
- package/lib/lib/markers/TimelineMarkersRenderer.js +69 -0
- package/lib/lib/markers/implementations/CursorMarker.js +137 -0
- package/lib/lib/markers/implementations/CustomMarker.js +79 -0
- package/lib/lib/markers/implementations/TodayMarker.js +123 -0
- package/lib/lib/markers/implementations/shared.js +51 -0
- package/lib/lib/markers/markerType.js +12 -0
- package/lib/lib/markers/public/CursorMarker.js +97 -0
- package/lib/lib/markers/public/CustomMarker.js +116 -0
- package/lib/lib/markers/public/TimelineMarkers.js +27 -0
- package/lib/lib/markers/public/TodayMarker.js +121 -0
- package/lib/lib/row/GroupRow.js +94 -0
- package/lib/lib/row/GroupRows.js +117 -0
- package/lib/lib/scroll/ScrollElement.js +289 -0
- package/lib/lib/timeline/TimelineStateContext.js +155 -0
- package/lib/lib/utility/calendar.js +672 -0
- package/lib/lib/utility/dom-helpers.js +62 -0
- package/lib/lib/utility/events.js +23 -0
- package/lib/lib/utility/generic.js +44 -0
- package/lib/resize-detector/container.js +36 -0
- package/lib/resize-detector/window.js +25 -0
- package/package.json +160 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _TimelineMarkersContext = require("../TimelineMarkersContext");
|
|
13
|
+
|
|
14
|
+
var _markerType = require("../markerType");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
+
|
|
24
|
+
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); } }
|
|
25
|
+
|
|
26
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
27
|
+
|
|
28
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
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
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
+
|
|
34
|
+
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); }
|
|
35
|
+
|
|
36
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
|
+
|
|
38
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
|
+
|
|
40
|
+
var CursorMarker =
|
|
41
|
+
/*#__PURE__*/
|
|
42
|
+
function (_React$Component) {
|
|
43
|
+
_inherits(CursorMarker, _React$Component);
|
|
44
|
+
|
|
45
|
+
function CursorMarker() {
|
|
46
|
+
_classCallCheck(this, CursorMarker);
|
|
47
|
+
|
|
48
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(CursorMarker).apply(this, arguments));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_createClass(CursorMarker, [{
|
|
52
|
+
key: "componentDidMount",
|
|
53
|
+
value: function componentDidMount() {
|
|
54
|
+
var _this$props$subscribe = this.props.subscribeMarker({
|
|
55
|
+
type: _markerType.TimelineMarkerType.Cursor,
|
|
56
|
+
renderer: this.props.children
|
|
57
|
+
}),
|
|
58
|
+
unsubscribe = _this$props$subscribe.unsubscribe;
|
|
59
|
+
|
|
60
|
+
this.unsubscribe = unsubscribe;
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "componentWillUnmount",
|
|
64
|
+
value: function componentWillUnmount() {
|
|
65
|
+
if (this.unsubscribe != null) {
|
|
66
|
+
this.unsubscribe();
|
|
67
|
+
this.unsubscribe = null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "render",
|
|
72
|
+
value: function render() {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}]);
|
|
76
|
+
|
|
77
|
+
return CursorMarker;
|
|
78
|
+
}(_react["default"].Component); // TODO: turn into HOC?
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
_defineProperty(CursorMarker, "propTypes", {
|
|
82
|
+
subscribeMarker: _propTypes["default"].func.isRequired,
|
|
83
|
+
children: _propTypes["default"].func
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
var CursorMarkerWrapper = function CursorMarkerWrapper(props) {
|
|
87
|
+
return _react["default"].createElement(_TimelineMarkersContext.TimelineMarkersConsumer, null, function (_ref) {
|
|
88
|
+
var subscribeMarker = _ref.subscribeMarker;
|
|
89
|
+
return _react["default"].createElement(CursorMarker, _extends({
|
|
90
|
+
subscribeMarker: subscribeMarker
|
|
91
|
+
}, props));
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
CursorMarkerWrapper.displayName = 'CursorMarkerWrapper';
|
|
96
|
+
var _default = CursorMarkerWrapper;
|
|
97
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _TimelineMarkersContext = require("../TimelineMarkersContext");
|
|
13
|
+
|
|
14
|
+
var _markerType = require("../markerType");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
+
|
|
26
|
+
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); } }
|
|
27
|
+
|
|
28
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
|
+
|
|
30
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
31
|
+
|
|
32
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
+
|
|
34
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
35
|
+
|
|
36
|
+
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); }
|
|
37
|
+
|
|
38
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
+
|
|
40
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
|
+
|
|
42
|
+
var CustomMarker =
|
|
43
|
+
/*#__PURE__*/
|
|
44
|
+
function (_React$Component) {
|
|
45
|
+
_inherits(CustomMarker, _React$Component);
|
|
46
|
+
|
|
47
|
+
function CustomMarker() {
|
|
48
|
+
_classCallCheck(this, CustomMarker);
|
|
49
|
+
|
|
50
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(CustomMarker).apply(this, arguments));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_createClass(CustomMarker, [{
|
|
54
|
+
key: "componentDidUpdate",
|
|
55
|
+
value: function componentDidUpdate(prevProps) {
|
|
56
|
+
if (prevProps.date !== this.props.date && this.getMarker) {
|
|
57
|
+
var marker = this.getMarker();
|
|
58
|
+
this.props.updateMarker(_objectSpread({}, marker, {
|
|
59
|
+
date: this.props.date
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "componentDidMount",
|
|
65
|
+
value: function componentDidMount() {
|
|
66
|
+
var _this$props$subscribe = this.props.subscribeMarker({
|
|
67
|
+
type: _markerType.TimelineMarkerType.Custom,
|
|
68
|
+
renderer: this.props.children,
|
|
69
|
+
date: this.props.date
|
|
70
|
+
}),
|
|
71
|
+
unsubscribe = _this$props$subscribe.unsubscribe,
|
|
72
|
+
getMarker = _this$props$subscribe.getMarker;
|
|
73
|
+
|
|
74
|
+
this.unsubscribe = unsubscribe;
|
|
75
|
+
this.getMarker = getMarker;
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "componentWillUnmount",
|
|
79
|
+
value: function componentWillUnmount() {
|
|
80
|
+
if (this.unsubscribe != null) {
|
|
81
|
+
this.unsubscribe();
|
|
82
|
+
this.unsubscribe = null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "render",
|
|
87
|
+
value: function render() {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}]);
|
|
91
|
+
|
|
92
|
+
return CustomMarker;
|
|
93
|
+
}(_react["default"].Component); // TODO: turn into HOC?
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
_defineProperty(CustomMarker, "propTypes", {
|
|
97
|
+
subscribeMarker: _propTypes["default"].func.isRequired,
|
|
98
|
+
updateMarker: _propTypes["default"].func.isRequired,
|
|
99
|
+
children: _propTypes["default"].func,
|
|
100
|
+
date: _propTypes["default"].number.isRequired
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
var CustomMarkerWrapper = function CustomMarkerWrapper(props) {
|
|
104
|
+
return _react["default"].createElement(_TimelineMarkersContext.TimelineMarkersConsumer, null, function (_ref) {
|
|
105
|
+
var subscribeMarker = _ref.subscribeMarker,
|
|
106
|
+
updateMarker = _ref.updateMarker;
|
|
107
|
+
return _react["default"].createElement(CustomMarker, _extends({
|
|
108
|
+
subscribeMarker: subscribeMarker,
|
|
109
|
+
updateMarker: updateMarker
|
|
110
|
+
}, props));
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
CustomMarkerWrapper.displayName = 'CustomMarkerWrapper';
|
|
115
|
+
var _default = CustomMarkerWrapper;
|
|
116
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
// Is this necessary? The initial reason for including this is for organization sake in the
|
|
9
|
+
// user code e.g.
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
<Timeline {...otherProps}>
|
|
13
|
+
<TimelineMarkers> // would there be props passed in here?
|
|
14
|
+
<TodayLine />
|
|
15
|
+
<CursorLine />
|
|
16
|
+
<CustomLine />
|
|
17
|
+
</TimelineMarkers>
|
|
18
|
+
</Timeline>
|
|
19
|
+
|
|
20
|
+
*/
|
|
21
|
+
// If we decide to pass in props to TimelineMarkers, then yes, this is necessary.
|
|
22
|
+
var TimelineMarkers = function TimelineMarkers(props) {
|
|
23
|
+
return props.children || null;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var _default = TimelineMarkers;
|
|
27
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _TimelineMarkersContext = require("../TimelineMarkersContext");
|
|
13
|
+
|
|
14
|
+
var _markerType = require("../markerType");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
+
|
|
26
|
+
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); } }
|
|
27
|
+
|
|
28
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
|
+
|
|
30
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
31
|
+
|
|
32
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
+
|
|
34
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
35
|
+
|
|
36
|
+
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); }
|
|
37
|
+
|
|
38
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
+
|
|
40
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
|
+
|
|
42
|
+
var TodayMarker =
|
|
43
|
+
/*#__PURE__*/
|
|
44
|
+
function (_React$Component) {
|
|
45
|
+
_inherits(TodayMarker, _React$Component);
|
|
46
|
+
|
|
47
|
+
function TodayMarker() {
|
|
48
|
+
_classCallCheck(this, TodayMarker);
|
|
49
|
+
|
|
50
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(TodayMarker).apply(this, arguments));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_createClass(TodayMarker, [{
|
|
54
|
+
key: "componentDidMount",
|
|
55
|
+
value: function componentDidMount() {
|
|
56
|
+
var _this$props$subscribe = this.props.subscribeMarker({
|
|
57
|
+
type: _markerType.TimelineMarkerType.Today,
|
|
58
|
+
renderer: this.props.children,
|
|
59
|
+
interval: this.props.interval
|
|
60
|
+
}),
|
|
61
|
+
unsubscribe = _this$props$subscribe.unsubscribe,
|
|
62
|
+
getMarker = _this$props$subscribe.getMarker;
|
|
63
|
+
|
|
64
|
+
this.unsubscribe = unsubscribe;
|
|
65
|
+
this.getMarker = getMarker;
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "componentWillUnmount",
|
|
69
|
+
value: function componentWillUnmount() {
|
|
70
|
+
if (this.unsubscribe != null) {
|
|
71
|
+
this.unsubscribe();
|
|
72
|
+
this.unsubscribe = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "componentDidUpdate",
|
|
77
|
+
value: function componentDidUpdate(prevProps) {
|
|
78
|
+
if (prevProps.interval !== this.props.interval && this.getMarker) {
|
|
79
|
+
var marker = this.getMarker();
|
|
80
|
+
this.props.updateMarker(_objectSpread({}, marker, {
|
|
81
|
+
interval: this.props.interval
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "render",
|
|
87
|
+
value: function render() {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}]);
|
|
91
|
+
|
|
92
|
+
return TodayMarker;
|
|
93
|
+
}(_react["default"].Component); // TODO: turn into HOC?
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
_defineProperty(TodayMarker, "propTypes", {
|
|
97
|
+
subscribeMarker: _propTypes["default"].func.isRequired,
|
|
98
|
+
updateMarker: _propTypes["default"].func.isRequired,
|
|
99
|
+
interval: _propTypes["default"].number,
|
|
100
|
+
children: _propTypes["default"].func
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
_defineProperty(TodayMarker, "defaultProps", {
|
|
104
|
+
interval: 1000 * 10 // default to ten seconds
|
|
105
|
+
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
var TodayMarkerWrapper = function TodayMarkerWrapper(props) {
|
|
109
|
+
return _react["default"].createElement(_TimelineMarkersContext.TimelineMarkersConsumer, null, function (_ref) {
|
|
110
|
+
var subscribeMarker = _ref.subscribeMarker,
|
|
111
|
+
updateMarker = _ref.updateMarker;
|
|
112
|
+
return _react["default"].createElement(TodayMarker, _extends({
|
|
113
|
+
subscribeMarker: subscribeMarker,
|
|
114
|
+
updateMarker: updateMarker
|
|
115
|
+
}, props));
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
TodayMarkerWrapper.displayName = 'TodayMarkerWrapper';
|
|
120
|
+
var _default = TodayMarkerWrapper;
|
|
121
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _PreventClickOnDrag = _interopRequireDefault(require("../interaction/PreventClickOnDrag"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
22
|
+
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); } }
|
|
23
|
+
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
25
|
+
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
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
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
|
|
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
|
+
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
+
|
|
36
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
+
|
|
38
|
+
var GroupRow =
|
|
39
|
+
/*#__PURE__*/
|
|
40
|
+
function (_Component) {
|
|
41
|
+
_inherits(GroupRow, _Component);
|
|
42
|
+
|
|
43
|
+
function GroupRow() {
|
|
44
|
+
_classCallCheck(this, GroupRow);
|
|
45
|
+
|
|
46
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(GroupRow).apply(this, arguments));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_createClass(GroupRow, [{
|
|
50
|
+
key: "render",
|
|
51
|
+
value: function render() {
|
|
52
|
+
var _this$props = this.props,
|
|
53
|
+
onContextMenu = _this$props.onContextMenu,
|
|
54
|
+
onDoubleClick = _this$props.onDoubleClick,
|
|
55
|
+
isEvenRow = _this$props.isEvenRow,
|
|
56
|
+
style = _this$props.style,
|
|
57
|
+
onClick = _this$props.onClick,
|
|
58
|
+
clickTolerance = _this$props.clickTolerance,
|
|
59
|
+
horizontalLineClassNamesForGroup = _this$props.horizontalLineClassNamesForGroup,
|
|
60
|
+
group = _this$props.group;
|
|
61
|
+
var classNamesForGroup = [];
|
|
62
|
+
|
|
63
|
+
if (horizontalLineClassNamesForGroup) {
|
|
64
|
+
classNamesForGroup = horizontalLineClassNamesForGroup(group);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return _react["default"].createElement(_PreventClickOnDrag["default"], {
|
|
68
|
+
clickTolerance: clickTolerance,
|
|
69
|
+
onClick: onClick
|
|
70
|
+
}, _react["default"].createElement("div", {
|
|
71
|
+
onContextMenu: onContextMenu,
|
|
72
|
+
onDoubleClick: onDoubleClick,
|
|
73
|
+
className: (isEvenRow ? 'rct-hl-even ' : 'rct-hl-odd ') + (classNamesForGroup ? classNamesForGroup.join(' ') : ''),
|
|
74
|
+
style: style
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
}]);
|
|
78
|
+
|
|
79
|
+
return GroupRow;
|
|
80
|
+
}(_react.Component);
|
|
81
|
+
|
|
82
|
+
_defineProperty(GroupRow, "propTypes", {
|
|
83
|
+
onClick: _propTypes["default"].func.isRequired,
|
|
84
|
+
onDoubleClick: _propTypes["default"].func.isRequired,
|
|
85
|
+
onContextMenu: _propTypes["default"].func.isRequired,
|
|
86
|
+
isEvenRow: _propTypes["default"].bool.isRequired,
|
|
87
|
+
style: _propTypes["default"].object.isRequired,
|
|
88
|
+
clickTolerance: _propTypes["default"].number.isRequired,
|
|
89
|
+
group: _propTypes["default"].object.isRequired,
|
|
90
|
+
horizontalLineClassNamesForGroup: _propTypes["default"].func
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
var _default = GroupRow;
|
|
94
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _GroupRow = _interopRequireDefault(require("./GroupRow"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
22
|
+
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); } }
|
|
23
|
+
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
25
|
+
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
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
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
|
|
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
|
+
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
+
|
|
36
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
+
|
|
38
|
+
var GroupRows =
|
|
39
|
+
/*#__PURE__*/
|
|
40
|
+
function (_Component) {
|
|
41
|
+
_inherits(GroupRows, _Component);
|
|
42
|
+
|
|
43
|
+
function GroupRows() {
|
|
44
|
+
_classCallCheck(this, GroupRows);
|
|
45
|
+
|
|
46
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(GroupRows).apply(this, arguments));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_createClass(GroupRows, [{
|
|
50
|
+
key: "shouldComponentUpdate",
|
|
51
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
52
|
+
return !(nextProps.canvasWidth === this.props.canvasWidth && nextProps.lineCount === this.props.lineCount && nextProps.groupHeights === this.props.groupHeights && nextProps.groups === this.props.groups);
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "render",
|
|
56
|
+
value: function render() {
|
|
57
|
+
var _this$props = this.props,
|
|
58
|
+
canvasWidth = _this$props.canvasWidth,
|
|
59
|
+
lineCount = _this$props.lineCount,
|
|
60
|
+
groupHeights = _this$props.groupHeights,
|
|
61
|
+
onRowClick = _this$props.onRowClick,
|
|
62
|
+
onRowDoubleClick = _this$props.onRowDoubleClick,
|
|
63
|
+
clickTolerance = _this$props.clickTolerance,
|
|
64
|
+
groups = _this$props.groups,
|
|
65
|
+
horizontalLineClassNamesForGroup = _this$props.horizontalLineClassNamesForGroup,
|
|
66
|
+
onRowContextClick = _this$props.onRowContextClick;
|
|
67
|
+
var lines = [];
|
|
68
|
+
|
|
69
|
+
var _loop = function _loop(i) {
|
|
70
|
+
lines.push(_react["default"].createElement(_GroupRow["default"], {
|
|
71
|
+
clickTolerance: clickTolerance,
|
|
72
|
+
onContextMenu: function onContextMenu(evt) {
|
|
73
|
+
return onRowContextClick(evt, i);
|
|
74
|
+
},
|
|
75
|
+
onClick: function onClick(evt) {
|
|
76
|
+
return onRowClick(evt, i);
|
|
77
|
+
},
|
|
78
|
+
onDoubleClick: function onDoubleClick(evt) {
|
|
79
|
+
return onRowDoubleClick(evt, i);
|
|
80
|
+
},
|
|
81
|
+
key: "horizontal-line-".concat(i),
|
|
82
|
+
isEvenRow: i % 2 === 0,
|
|
83
|
+
group: groups[i],
|
|
84
|
+
horizontalLineClassNamesForGroup: horizontalLineClassNamesForGroup,
|
|
85
|
+
style: {
|
|
86
|
+
width: "".concat(canvasWidth, "px"),
|
|
87
|
+
height: "".concat(groupHeights[i], "px")
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
for (var i = 0; i < lineCount; i++) {
|
|
93
|
+
_loop(i);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return _react["default"].createElement("div", {
|
|
97
|
+
className: "rct-horizontal-lines"
|
|
98
|
+
}, lines);
|
|
99
|
+
}
|
|
100
|
+
}]);
|
|
101
|
+
|
|
102
|
+
return GroupRows;
|
|
103
|
+
}(_react.Component);
|
|
104
|
+
|
|
105
|
+
exports["default"] = GroupRows;
|
|
106
|
+
|
|
107
|
+
_defineProperty(GroupRows, "propTypes", {
|
|
108
|
+
canvasWidth: _propTypes["default"].number.isRequired,
|
|
109
|
+
lineCount: _propTypes["default"].number.isRequired,
|
|
110
|
+
groupHeights: _propTypes["default"].array.isRequired,
|
|
111
|
+
onRowClick: _propTypes["default"].func.isRequired,
|
|
112
|
+
onRowDoubleClick: _propTypes["default"].func.isRequired,
|
|
113
|
+
clickTolerance: _propTypes["default"].number.isRequired,
|
|
114
|
+
groups: _propTypes["default"].array.isRequired,
|
|
115
|
+
horizontalLineClassNamesForGroup: _propTypes["default"].func,
|
|
116
|
+
onRowContextClick: _propTypes["default"].func.isRequired
|
|
117
|
+
});
|