react-big-schedule 5.4.6-beta.3 → 5.4.6
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/package.json +11 -11
- package/dist/components/AddMore.js +0 -50
- package/dist/components/AddMorePopover.js +0 -117
- package/dist/components/AgendaEventItem.js +0 -94
- package/dist/components/AgendaResourceEvents.js +0 -102
- package/dist/components/AgendaView.js +0 -69
- package/dist/components/BodyView.js +0 -59
- package/dist/components/DnDContext.js +0 -171
- package/dist/components/DnDSource.js +0 -125
- package/dist/components/EventItem.js +0 -771
- package/dist/components/EventItemPopover.js +0 -153
- package/dist/components/HeaderView.js +0 -183
- package/dist/components/ResourceEvents.js +0 -515
- package/dist/components/ResourceView.js +0 -158
- package/dist/components/SchedulerData.js +0 -1257
- package/dist/components/SchedulerHeader.js +0 -188
- package/dist/components/SelectedArea.js +0 -32
- package/dist/components/Summary.js +0 -61
- package/dist/components/WrapperFun.js +0 -23
- package/dist/components/index.js +0 -697
- package/dist/config/default.js +0 -36
- package/dist/config/i18n.js +0 -80
- package/dist/config/scheduler.js +0 -122
- package/dist/css/style.css +0 -256
- package/dist/helper/behaviors.js +0 -94
- package/dist/helper/utility.js +0 -20
- package/dist/index.d.ts +0 -457
- package/dist/index.js +0 -103
- package/dist/sample-data/sample1.js +0 -337
|
@@ -1,771 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _antd = require("antd");
|
|
8
|
-
var _propTypes = require("prop-types");
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _reactDnd = require("react-dnd");
|
|
11
|
-
var _default2 = require("../config/default");
|
|
12
|
-
var _EventItemPopover = _interopRequireDefault(require("./EventItemPopover"));
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
16
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
17
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
19
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
20
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
22
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
25
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
26
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
27
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
28
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
29
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
30
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
31
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
32
|
-
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
33
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
34
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
35
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
36
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
37
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
38
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
39
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
40
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
41
|
-
var stopDragHelper = function stopDragHelper(_ref) {
|
|
42
|
-
var count = _ref.count,
|
|
43
|
-
cellUnit = _ref.cellUnit,
|
|
44
|
-
config = _ref.config,
|
|
45
|
-
dragType = _ref.dragType,
|
|
46
|
-
eventItem = _ref.eventItem,
|
|
47
|
-
localeDayjs = _ref.localeDayjs,
|
|
48
|
-
value = _ref.value;
|
|
49
|
-
var whileTrue = true;
|
|
50
|
-
var tCount = 0;
|
|
51
|
-
var i = 0;
|
|
52
|
-
var result = value;
|
|
53
|
-
return new Promise(function (resolve) {
|
|
54
|
-
if (count !== 0 && cellUnit !== _default2.CellUnit.Hour && config.displayWeekend === false) {
|
|
55
|
-
while (whileTrue) {
|
|
56
|
-
i = count > 0 ? i + 1 : i - 1;
|
|
57
|
-
var date = localeDayjs(new Date(eventItem[dragType])).add(i, 'days');
|
|
58
|
-
var dayOfWeek = date.day();
|
|
59
|
-
if (dayOfWeek !== 0 && dayOfWeek !== 6) {
|
|
60
|
-
tCount = count > 0 ? tCount + 1 : tCount - 1;
|
|
61
|
-
if (tCount === count) {
|
|
62
|
-
result = date.format(_default2.DATETIME_FORMAT);
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
resolve(result);
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
var startResizable = function startResizable(_ref2) {
|
|
72
|
-
var eventItem = _ref2.eventItem,
|
|
73
|
-
isInPopover = _ref2.isInPopover,
|
|
74
|
-
schedulerData = _ref2.schedulerData;
|
|
75
|
-
return schedulerData.config.startResizable === true && isInPopover === false && (eventItem.resizable === undefined || eventItem.resizable !== false) && (eventItem.startResizable === undefined || eventItem.startResizable !== false);
|
|
76
|
-
};
|
|
77
|
-
var endResizable = function endResizable(_ref3) {
|
|
78
|
-
var eventItem = _ref3.eventItem,
|
|
79
|
-
isInPopover = _ref3.isInPopover,
|
|
80
|
-
schedulerData = _ref3.schedulerData;
|
|
81
|
-
return schedulerData.config.endResizable === true && isInPopover === false && (eventItem.resizable === undefined || eventItem.resizable !== false) && (eventItem.endResizable === undefined || eventItem.endResizable !== false);
|
|
82
|
-
};
|
|
83
|
-
var EventItem = /*#__PURE__*/function (_Component) {
|
|
84
|
-
function EventItem(_props) {
|
|
85
|
-
var _this;
|
|
86
|
-
_classCallCheck(this, EventItem);
|
|
87
|
-
_this = _callSuper(this, EventItem, [_props]);
|
|
88
|
-
_defineProperty(_this, "eventItemRef", function (ref) {
|
|
89
|
-
_this.eventItemElement = ref;
|
|
90
|
-
// Attach drag refs if they exist
|
|
91
|
-
var _this$props = _this.props,
|
|
92
|
-
dragRef = _this$props.dragRef,
|
|
93
|
-
dragPreviewRef = _this$props.dragPreviewRef;
|
|
94
|
-
if (dragRef && ref) {
|
|
95
|
-
dragRef(ref);
|
|
96
|
-
}
|
|
97
|
-
if (dragPreviewRef && ref) {
|
|
98
|
-
dragPreviewRef(ref);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
_defineProperty(_this, "resizerHelper", function (dragType) {
|
|
102
|
-
var eventType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'addEventListener';
|
|
103
|
-
var resizer = dragType === 'start' ? _this.startResizer : _this.endResizer;
|
|
104
|
-
var doDrag = dragType === 'start' ? _this.doStartDrag : _this.doEndDrag;
|
|
105
|
-
var stopDrag = dragType === 'start' ? _this.stopStartDrag : _this.stopEndDrag;
|
|
106
|
-
var cancelDrag = dragType === 'start' ? _this.cancelStartDrag : _this.cancelEndDrag;
|
|
107
|
-
if (_this.supportTouch) {
|
|
108
|
-
resizer[eventType]('touchmove', doDrag, false);
|
|
109
|
-
resizer[eventType]('touchend', stopDrag, false);
|
|
110
|
-
resizer[eventType]('touchcancel', cancelDrag, false);
|
|
111
|
-
} else {
|
|
112
|
-
document.documentElement[eventType]('mousemove', doDrag, false);
|
|
113
|
-
document.documentElement[eventType]('mouseup', stopDrag, false);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
_defineProperty(_this, "initDragHelper", function (ev, dragType) {
|
|
117
|
-
var _this$props2 = _this.props,
|
|
118
|
-
schedulerData = _this$props2.schedulerData,
|
|
119
|
-
eventItem = _this$props2.eventItem;
|
|
120
|
-
var slotId = schedulerData._getEventSlotId(eventItem);
|
|
121
|
-
var slot = schedulerData.getSlotById(slotId);
|
|
122
|
-
if (!!slot && !!slot.groupOnly) return;
|
|
123
|
-
if (schedulerData._isResizing()) return;
|
|
124
|
-
ev.stopPropagation();
|
|
125
|
-
var clientX = 0;
|
|
126
|
-
if (_this.supportTouch) {
|
|
127
|
-
if (ev.changedTouches.length === 0) return;
|
|
128
|
-
var touch = ev.changedTouches[0];
|
|
129
|
-
clientX = touch.pageX;
|
|
130
|
-
} else {
|
|
131
|
-
if (ev.buttons !== undefined && ev.buttons !== 1) return;
|
|
132
|
-
clientX = ev.clientX;
|
|
133
|
-
}
|
|
134
|
-
_this.setState(_defineProperty({}, dragType === 'start' ? 'startX' : 'endX', clientX));
|
|
135
|
-
schedulerData._startResizing();
|
|
136
|
-
_this.resizerHelper(dragType, 'addEventListener');
|
|
137
|
-
document.onselectstart = function () {
|
|
138
|
-
return false;
|
|
139
|
-
};
|
|
140
|
-
document.ondragstart = function () {
|
|
141
|
-
return false;
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
_defineProperty(_this, "initStartDrag", function (ev) {
|
|
145
|
-
_this.initDragHelper(ev, 'start');
|
|
146
|
-
});
|
|
147
|
-
_defineProperty(_this, "doStartDrag", function (ev) {
|
|
148
|
-
ev.stopPropagation();
|
|
149
|
-
var clientX = 0;
|
|
150
|
-
if (_this.supportTouch) {
|
|
151
|
-
if (ev.changedTouches.length === 0) return;
|
|
152
|
-
var touch = ev.changedTouches[0];
|
|
153
|
-
clientX = touch.pageX;
|
|
154
|
-
} else {
|
|
155
|
-
clientX = ev.clientX;
|
|
156
|
-
}
|
|
157
|
-
var _this$props3 = _this.props,
|
|
158
|
-
left = _this$props3.left,
|
|
159
|
-
width = _this$props3.width,
|
|
160
|
-
leftIndex = _this$props3.leftIndex,
|
|
161
|
-
rightIndex = _this$props3.rightIndex,
|
|
162
|
-
schedulerData = _this$props3.schedulerData;
|
|
163
|
-
var cellWidth = schedulerData.getContentCellWidth();
|
|
164
|
-
var offset = leftIndex > 0 ? 5 : 6;
|
|
165
|
-
var minWidth = cellWidth - offset;
|
|
166
|
-
var maxWidth = rightIndex * cellWidth - offset;
|
|
167
|
-
var startX = _this.state.startX;
|
|
168
|
-
var newLeft = left + clientX - startX;
|
|
169
|
-
var newWidth = width + startX - clientX;
|
|
170
|
-
if (newWidth < minWidth) {
|
|
171
|
-
newWidth = minWidth;
|
|
172
|
-
newLeft = (rightIndex - 1) * cellWidth + (rightIndex - 1 > 0 ? 2 : 3);
|
|
173
|
-
} else if (newWidth > maxWidth) {
|
|
174
|
-
newWidth = maxWidth;
|
|
175
|
-
newLeft = 3;
|
|
176
|
-
}
|
|
177
|
-
_this.setState({
|
|
178
|
-
left: newLeft,
|
|
179
|
-
width: newWidth
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
_defineProperty(_this, "stopStartDrag", /*#__PURE__*/function () {
|
|
183
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(ev) {
|
|
184
|
-
var _this$props4, width, left, top, leftIndex, rightIndex, schedulerData, eventItem, updateEventStart, conflictOccurred, stateWidth, clientX, touch, cellUnit, events, config, localeDayjs, cellWidth, offset, minWidth, maxWidth, startX, newWidth, deltaX, sign, count, newStart, hasConflict, slotId, slotName, slot, start, end;
|
|
185
|
-
return _regenerator().w(function (_context) {
|
|
186
|
-
while (1) switch (_context.n) {
|
|
187
|
-
case 0:
|
|
188
|
-
ev.stopPropagation();
|
|
189
|
-
_this.resizerHelper('start', 'removeEventListener');
|
|
190
|
-
document.onselectstart = null;
|
|
191
|
-
document.ondragstart = null;
|
|
192
|
-
_this$props4 = _this.props, width = _this$props4.width, left = _this$props4.left, top = _this$props4.top, leftIndex = _this$props4.leftIndex, rightIndex = _this$props4.rightIndex, schedulerData = _this$props4.schedulerData, eventItem = _this$props4.eventItem, updateEventStart = _this$props4.updateEventStart, conflictOccurred = _this$props4.conflictOccurred;
|
|
193
|
-
schedulerData._stopResizing();
|
|
194
|
-
stateWidth = _this.state.width;
|
|
195
|
-
if (!(stateWidth === width)) {
|
|
196
|
-
_context.n = 1;
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
return _context.a(2);
|
|
200
|
-
case 1:
|
|
201
|
-
clientX = 0;
|
|
202
|
-
if (!_this.supportTouch) {
|
|
203
|
-
_context.n = 3;
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
206
|
-
if (!(ev.changedTouches.length === 0)) {
|
|
207
|
-
_context.n = 2;
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
_this.setState({
|
|
211
|
-
left: left,
|
|
212
|
-
top: top,
|
|
213
|
-
width: width
|
|
214
|
-
});
|
|
215
|
-
return _context.a(2);
|
|
216
|
-
case 2:
|
|
217
|
-
touch = ev.changedTouches[0];
|
|
218
|
-
clientX = touch.pageX;
|
|
219
|
-
_context.n = 4;
|
|
220
|
-
break;
|
|
221
|
-
case 3:
|
|
222
|
-
clientX = ev.clientX;
|
|
223
|
-
case 4:
|
|
224
|
-
cellUnit = schedulerData.cellUnit, events = schedulerData.events, config = schedulerData.config, localeDayjs = schedulerData.localeDayjs;
|
|
225
|
-
cellWidth = schedulerData.getContentCellWidth();
|
|
226
|
-
offset = leftIndex > 0 ? 5 : 6;
|
|
227
|
-
minWidth = cellWidth - offset;
|
|
228
|
-
maxWidth = rightIndex * cellWidth - offset;
|
|
229
|
-
startX = _this.state.startX;
|
|
230
|
-
newWidth = width + startX - clientX;
|
|
231
|
-
deltaX = clientX - startX;
|
|
232
|
-
sign = 1;
|
|
233
|
-
if (deltaX < 0) {
|
|
234
|
-
sign = -1;
|
|
235
|
-
} else if (deltaX === 0) {
|
|
236
|
-
sign = 0;
|
|
237
|
-
}
|
|
238
|
-
count = (sign > 0 ? Math.floor(Math.abs(deltaX) / cellWidth) : Math.ceil(Math.abs(deltaX) / cellWidth)) * sign;
|
|
239
|
-
if (newWidth < minWidth) count = rightIndex - leftIndex - 1;else if (newWidth > maxWidth) count = -leftIndex;
|
|
240
|
-
newStart = localeDayjs(new Date(eventItem.start)).add(cellUnit === _default2.CellUnit.Hour ? count * config.minuteStep : count, cellUnit === _default2.CellUnit.Hour ? 'minutes' : 'days').format(_default2.DATETIME_FORMAT);
|
|
241
|
-
_context.n = 5;
|
|
242
|
-
return stopDragHelper({
|
|
243
|
-
count: count,
|
|
244
|
-
cellUnit: cellUnit,
|
|
245
|
-
config: config,
|
|
246
|
-
eventItem: eventItem,
|
|
247
|
-
localeDayjs: localeDayjs,
|
|
248
|
-
dragType: 'start',
|
|
249
|
-
value: newStart
|
|
250
|
-
});
|
|
251
|
-
case 5:
|
|
252
|
-
newStart = _context.v;
|
|
253
|
-
hasConflict = false;
|
|
254
|
-
slotId = schedulerData._getEventSlotId(eventItem);
|
|
255
|
-
slot = schedulerData.getSlotById(slotId);
|
|
256
|
-
if (slot) slotName = slot.name;
|
|
257
|
-
if (config.checkConflict) {
|
|
258
|
-
start = localeDayjs(new Date(newStart));
|
|
259
|
-
end = localeDayjs(new Date(eventItem.end));
|
|
260
|
-
events.forEach(function (e) {
|
|
261
|
-
if (schedulerData._getEventSlotId(e) === slotId && e.id !== eventItem.id) {
|
|
262
|
-
var eStart = localeDayjs(new Date(e.start));
|
|
263
|
-
var eEnd = localeDayjs(new Date(e.end));
|
|
264
|
-
if (start >= eStart && start < eEnd || end > eStart && end <= eEnd || eStart >= start && eStart < end || eEnd > start && eEnd <= end) hasConflict = true;
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
if (hasConflict) {
|
|
269
|
-
_this.setState({
|
|
270
|
-
left: left,
|
|
271
|
-
top: top,
|
|
272
|
-
width: width
|
|
273
|
-
});
|
|
274
|
-
if (conflictOccurred !== undefined) {
|
|
275
|
-
conflictOccurred(schedulerData, 'StartResize', eventItem, _default2.DnDTypes.EVENT, slotId, slotName, newStart, eventItem.end);
|
|
276
|
-
} else {
|
|
277
|
-
console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
|
|
278
|
-
}
|
|
279
|
-
_this.subscribeResizeEvent(_this.props);
|
|
280
|
-
} else if (updateEventStart !== undefined) updateEventStart(schedulerData, eventItem, newStart);
|
|
281
|
-
case 6:
|
|
282
|
-
return _context.a(2);
|
|
283
|
-
}
|
|
284
|
-
}, _callee);
|
|
285
|
-
}));
|
|
286
|
-
return function (_x) {
|
|
287
|
-
return _ref4.apply(this, arguments);
|
|
288
|
-
};
|
|
289
|
-
}());
|
|
290
|
-
_defineProperty(_this, "cancelStartDrag", function (ev) {
|
|
291
|
-
ev.stopPropagation();
|
|
292
|
-
_this.startResizer.removeEventListener('touchmove', _this.doStartDrag, false);
|
|
293
|
-
_this.startResizer.removeEventListener('touchend', _this.stopStartDrag, false);
|
|
294
|
-
_this.startResizer.removeEventListener('touchcancel', _this.cancelStartDrag, false);
|
|
295
|
-
document.onselectstart = null;
|
|
296
|
-
document.ondragstart = null;
|
|
297
|
-
var _this$props5 = _this.props,
|
|
298
|
-
schedulerData = _this$props5.schedulerData,
|
|
299
|
-
left = _this$props5.left,
|
|
300
|
-
top = _this$props5.top,
|
|
301
|
-
width = _this$props5.width;
|
|
302
|
-
schedulerData._stopResizing();
|
|
303
|
-
_this.setState({
|
|
304
|
-
left: left,
|
|
305
|
-
top: top,
|
|
306
|
-
width: width
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
_defineProperty(_this, "initEndDrag", function (ev) {
|
|
310
|
-
_this.initDragHelper(ev, 'end');
|
|
311
|
-
});
|
|
312
|
-
_defineProperty(_this, "doEndDrag", function (ev) {
|
|
313
|
-
ev.stopPropagation();
|
|
314
|
-
var clientX = 0;
|
|
315
|
-
if (_this.supportTouch) {
|
|
316
|
-
if (ev.changedTouches.length === 0) return;
|
|
317
|
-
var touch = ev.changedTouches[0];
|
|
318
|
-
clientX = touch.pageX;
|
|
319
|
-
} else {
|
|
320
|
-
clientX = ev.clientX;
|
|
321
|
-
}
|
|
322
|
-
var _this$props6 = _this.props,
|
|
323
|
-
width = _this$props6.width,
|
|
324
|
-
leftIndex = _this$props6.leftIndex,
|
|
325
|
-
schedulerData = _this$props6.schedulerData;
|
|
326
|
-
var headers = schedulerData.headers;
|
|
327
|
-
var cellWidth = schedulerData.getContentCellWidth();
|
|
328
|
-
var offset = leftIndex > 0 ? 5 : 6;
|
|
329
|
-
var minWidth = cellWidth - offset;
|
|
330
|
-
var maxWidth = (headers.length - leftIndex) * cellWidth - offset;
|
|
331
|
-
var endX = _this.state.endX;
|
|
332
|
-
var newWidth = width + clientX - endX;
|
|
333
|
-
if (newWidth < minWidth) newWidth = minWidth;else if (newWidth > maxWidth) newWidth = maxWidth;
|
|
334
|
-
_this.setState({
|
|
335
|
-
width: newWidth
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
_defineProperty(_this, "stopEndDrag", /*#__PURE__*/function () {
|
|
339
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(ev) {
|
|
340
|
-
var _this$props7, left, top, width, leftIndex, rightIndex, schedulerData, eventItem, updateEventEnd, conflictOccurred, stateWidth, clientX, touch, headers, cellUnit, events, config, localeDayjs, cellWidth, offset, minWidth, maxWidth, endX, newWidth, deltaX, sign, count, newEnd, hasConflict, slotId, slot, start, end;
|
|
341
|
-
return _regenerator().w(function (_context2) {
|
|
342
|
-
while (1) switch (_context2.n) {
|
|
343
|
-
case 0:
|
|
344
|
-
ev.stopPropagation();
|
|
345
|
-
_this.resizerHelper('end', 'removeEventListener');
|
|
346
|
-
document.onselectstart = null;
|
|
347
|
-
document.ondragstart = null;
|
|
348
|
-
_this$props7 = _this.props, left = _this$props7.left, top = _this$props7.top, width = _this$props7.width, leftIndex = _this$props7.leftIndex, rightIndex = _this$props7.rightIndex, schedulerData = _this$props7.schedulerData, eventItem = _this$props7.eventItem, updateEventEnd = _this$props7.updateEventEnd, conflictOccurred = _this$props7.conflictOccurred;
|
|
349
|
-
schedulerData._stopResizing();
|
|
350
|
-
stateWidth = _this.state.width;
|
|
351
|
-
if (!(stateWidth === width)) {
|
|
352
|
-
_context2.n = 1;
|
|
353
|
-
break;
|
|
354
|
-
}
|
|
355
|
-
return _context2.a(2);
|
|
356
|
-
case 1:
|
|
357
|
-
clientX = 0;
|
|
358
|
-
if (!_this.supportTouch) {
|
|
359
|
-
_context2.n = 3;
|
|
360
|
-
break;
|
|
361
|
-
}
|
|
362
|
-
if (!(ev.changedTouches.length === 0)) {
|
|
363
|
-
_context2.n = 2;
|
|
364
|
-
break;
|
|
365
|
-
}
|
|
366
|
-
_this.setState({
|
|
367
|
-
left: left,
|
|
368
|
-
top: top,
|
|
369
|
-
width: width
|
|
370
|
-
});
|
|
371
|
-
return _context2.a(2);
|
|
372
|
-
case 2:
|
|
373
|
-
touch = ev.changedTouches[0];
|
|
374
|
-
clientX = touch.pageX;
|
|
375
|
-
_context2.n = 4;
|
|
376
|
-
break;
|
|
377
|
-
case 3:
|
|
378
|
-
clientX = ev.clientX;
|
|
379
|
-
case 4:
|
|
380
|
-
headers = schedulerData.headers, cellUnit = schedulerData.cellUnit, events = schedulerData.events, config = schedulerData.config, localeDayjs = schedulerData.localeDayjs;
|
|
381
|
-
cellWidth = schedulerData.getContentCellWidth();
|
|
382
|
-
offset = leftIndex > 0 ? 5 : 6;
|
|
383
|
-
minWidth = cellWidth - offset;
|
|
384
|
-
maxWidth = (headers.length - leftIndex) * cellWidth - offset;
|
|
385
|
-
endX = _this.state.endX;
|
|
386
|
-
newWidth = width + clientX - endX;
|
|
387
|
-
deltaX = newWidth - width;
|
|
388
|
-
sign = 1;
|
|
389
|
-
if (deltaX < 0) {
|
|
390
|
-
sign = -1;
|
|
391
|
-
} else if (deltaX === 0) {
|
|
392
|
-
sign = 0;
|
|
393
|
-
}
|
|
394
|
-
count = (sign < 0 ? Math.floor(Math.abs(deltaX) / cellWidth) : Math.ceil(Math.abs(deltaX) / cellWidth)) * sign;
|
|
395
|
-
if (newWidth < minWidth) count = leftIndex - rightIndex + 1;else if (newWidth > maxWidth) count = headers.length - rightIndex;
|
|
396
|
-
newEnd = localeDayjs(new Date(eventItem.end)).add(cellUnit === _default2.CellUnit.Hour ? count * config.minuteStep : count, cellUnit === _default2.CellUnit.Hour ? 'minutes' : 'days').format(_default2.DATETIME_FORMAT);
|
|
397
|
-
_context2.n = 5;
|
|
398
|
-
return stopDragHelper({
|
|
399
|
-
dragType: 'end',
|
|
400
|
-
cellUnit: cellUnit,
|
|
401
|
-
config: config,
|
|
402
|
-
count: count,
|
|
403
|
-
value: newEnd,
|
|
404
|
-
eventItem: eventItem,
|
|
405
|
-
localeDayjs: localeDayjs
|
|
406
|
-
});
|
|
407
|
-
case 5:
|
|
408
|
-
newEnd = _context2.v;
|
|
409
|
-
hasConflict = false;
|
|
410
|
-
slotId = schedulerData._getEventSlotId(eventItem);
|
|
411
|
-
slot = schedulerData.getSlotById(slotId);
|
|
412
|
-
if (config.checkConflict) {
|
|
413
|
-
start = localeDayjs(new Date(eventItem.start));
|
|
414
|
-
end = localeDayjs(new Date(newEnd));
|
|
415
|
-
events.forEach(function (e) {
|
|
416
|
-
if (schedulerData._getEventSlotId(e) === slotId && e.id !== eventItem.id) {
|
|
417
|
-
var eStart = localeDayjs(new Date(e.start));
|
|
418
|
-
var eEnd = localeDayjs(new Date(e.end));
|
|
419
|
-
if (start >= eStart && start < eEnd || end > eStart && end <= eEnd || eStart >= start && eStart < end || eEnd > start && eEnd <= end) {
|
|
420
|
-
hasConflict = true;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
if (hasConflict) {
|
|
426
|
-
_this.setState({
|
|
427
|
-
left: left,
|
|
428
|
-
top: top,
|
|
429
|
-
width: width
|
|
430
|
-
});
|
|
431
|
-
if (conflictOccurred !== undefined) {
|
|
432
|
-
conflictOccurred(schedulerData, 'EndResize', eventItem, _default2.DnDTypes.EVENT, slotId, slot ? slot.name : null, eventItem.start, newEnd);
|
|
433
|
-
} else {
|
|
434
|
-
console.error('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
|
|
435
|
-
}
|
|
436
|
-
_this.subscribeResizeEvent(_this.props);
|
|
437
|
-
} else if (updateEventEnd !== undefined) {
|
|
438
|
-
updateEventEnd(schedulerData, eventItem, newEnd);
|
|
439
|
-
}
|
|
440
|
-
case 6:
|
|
441
|
-
return _context2.a(2);
|
|
442
|
-
}
|
|
443
|
-
}, _callee2);
|
|
444
|
-
}));
|
|
445
|
-
return function (_x2) {
|
|
446
|
-
return _ref5.apply(this, arguments);
|
|
447
|
-
};
|
|
448
|
-
}());
|
|
449
|
-
_defineProperty(_this, "cancelEndDrag", function (ev) {
|
|
450
|
-
ev.stopPropagation();
|
|
451
|
-
_this.endResizer.removeEventListener('touchmove', _this.doEndDrag, false);
|
|
452
|
-
_this.endResizer.removeEventListener('touchend', _this.stopEndDrag, false);
|
|
453
|
-
_this.endResizer.removeEventListener('touchcancel', _this.cancelEndDrag, false);
|
|
454
|
-
document.onselectstart = null;
|
|
455
|
-
document.ondragstart = null;
|
|
456
|
-
var _this$props8 = _this.props,
|
|
457
|
-
schedulerData = _this$props8.schedulerData,
|
|
458
|
-
left = _this$props8.left,
|
|
459
|
-
top = _this$props8.top,
|
|
460
|
-
width = _this$props8.width;
|
|
461
|
-
schedulerData._stopResizing();
|
|
462
|
-
_this.setState({
|
|
463
|
-
left: left,
|
|
464
|
-
top: top,
|
|
465
|
-
width: width
|
|
466
|
-
});
|
|
467
|
-
});
|
|
468
|
-
_defineProperty(_this, "handleMouseMove", function (event) {
|
|
469
|
-
var rect = _this.eventItemElement ? _this.eventItemElement.getBoundingClientRect() : {
|
|
470
|
-
left: 0,
|
|
471
|
-
right: 0
|
|
472
|
-
};
|
|
473
|
-
_this.setState({
|
|
474
|
-
contentMousePosX: event.clientX,
|
|
475
|
-
eventItemLeftRect: rect.left,
|
|
476
|
-
eventItemRightRect: rect.right
|
|
477
|
-
});
|
|
478
|
-
});
|
|
479
|
-
_defineProperty(_this, "subscribeResizeEvent", function (props) {
|
|
480
|
-
if (_this.startResizer !== undefined && _this.startResizer !== null) {
|
|
481
|
-
if (_this.supportTouch) {
|
|
482
|
-
// this.startResizer.removeEventListener('touchstart', this.initStartDrag, false);
|
|
483
|
-
// if (startResizable(props))
|
|
484
|
-
// this.startResizer.addEventListener('touchstart', this.initStartDrag, false);
|
|
485
|
-
} else {
|
|
486
|
-
_this.startResizer.removeEventListener('mousedown', _this.initStartDrag, false);
|
|
487
|
-
if (startResizable(props)) _this.startResizer.addEventListener('mousedown', _this.initStartDrag, false);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
if (_this.endResizer !== undefined && _this.endResizer !== null) {
|
|
491
|
-
if (_this.supportTouch) {
|
|
492
|
-
// this.endResizer.removeEventListener('touchstart', this.initEndDrag, false);
|
|
493
|
-
// if (endResizable(props))
|
|
494
|
-
// this.endResizer.addEventListener('touchstart', this.initEndDrag, false);
|
|
495
|
-
} else {
|
|
496
|
-
_this.endResizer.removeEventListener('mousedown', _this.initEndDrag, false);
|
|
497
|
-
if (endResizable(props)) _this.endResizer.addEventListener('mousedown', _this.initEndDrag, false);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
var _left = _props.left,
|
|
502
|
-
_top = _props.top,
|
|
503
|
-
_width = _props.width;
|
|
504
|
-
_this.state = {
|
|
505
|
-
left: _left,
|
|
506
|
-
top: _top,
|
|
507
|
-
width: _width,
|
|
508
|
-
contentMousePosX: 0,
|
|
509
|
-
eventItemLeftRect: 0,
|
|
510
|
-
eventItemRightRect: 0
|
|
511
|
-
};
|
|
512
|
-
_this.startResizer = undefined;
|
|
513
|
-
_this.endResizer = undefined;
|
|
514
|
-
_this.supportTouch = false; // 'ontouchstart' in window;
|
|
515
|
-
|
|
516
|
-
_this.eventItemElement = null;
|
|
517
|
-
_this._isMounted = false;
|
|
518
|
-
return _this;
|
|
519
|
-
}
|
|
520
|
-
_inherits(EventItem, _Component);
|
|
521
|
-
return _createClass(EventItem, [{
|
|
522
|
-
key: "componentDidMount",
|
|
523
|
-
value: function componentDidMount() {
|
|
524
|
-
this._isMounted = true;
|
|
525
|
-
this.supportTouch = 'ontouchstart' in window;
|
|
526
|
-
this.subscribeResizeEvent(this.props);
|
|
527
|
-
}
|
|
528
|
-
}, {
|
|
529
|
-
key: "componentDidUpdate",
|
|
530
|
-
value: function componentDidUpdate(prevProps) {
|
|
531
|
-
var _this$props9 = this.props,
|
|
532
|
-
left = _this$props9.left,
|
|
533
|
-
top = _this$props9.top,
|
|
534
|
-
width = _this$props9.width;
|
|
535
|
-
if (prevProps.left !== left || prevProps.top !== top || prevProps.width !== width) {
|
|
536
|
-
this.setState({
|
|
537
|
-
left: left,
|
|
538
|
-
top: top,
|
|
539
|
-
width: width
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
// Re-subscribe when resize-related props change or when position/size changes
|
|
544
|
-
// (size changes indicate a resize occurred and DOM elements may have been recreated)
|
|
545
|
-
if (prevProps.schedulerData !== this.props.schedulerData || prevProps.eventItem !== this.props.eventItem || prevProps.isInPopover !== this.props.isInPopover || prevProps.left !== left || prevProps.top !== top || prevProps.width !== width) {
|
|
546
|
-
this.subscribeResizeEvent(this.props);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
}, {
|
|
550
|
-
key: "render",
|
|
551
|
-
value: function render() {
|
|
552
|
-
var _this2 = this;
|
|
553
|
-
var _this$props0 = this.props,
|
|
554
|
-
eventItem = _this$props0.eventItem,
|
|
555
|
-
isStart = _this$props0.isStart,
|
|
556
|
-
isEnd = _this$props0.isEnd,
|
|
557
|
-
isInPopover = _this$props0.isInPopover,
|
|
558
|
-
eventItemClick = _this$props0.eventItemClick,
|
|
559
|
-
schedulerData = _this$props0.schedulerData,
|
|
560
|
-
isDragging = _this$props0.isDragging,
|
|
561
|
-
eventItemTemplateResolver = _this$props0.eventItemTemplateResolver;
|
|
562
|
-
var config = schedulerData.config,
|
|
563
|
-
localeDayjs = schedulerData.localeDayjs;
|
|
564
|
-
var _this$state = this.state,
|
|
565
|
-
left = _this$state.left,
|
|
566
|
-
width = _this$state.width,
|
|
567
|
-
top = _this$state.top;
|
|
568
|
-
var roundCls;
|
|
569
|
-
var popoverPlacement = config.eventItemPopoverPlacement;
|
|
570
|
-
var isPopoverPlacementMousePosition = /(top|bottom)(Right|Left)MousePosition/.test(popoverPlacement);
|
|
571
|
-
if (isStart) {
|
|
572
|
-
roundCls = isEnd ? 'round-all' : 'round-head';
|
|
573
|
-
} else {
|
|
574
|
-
roundCls = isEnd ? 'round-tail' : 'round-none';
|
|
575
|
-
}
|
|
576
|
-
var bgColor = config.defaultEventBgColor;
|
|
577
|
-
if (eventItem.bgColor) bgColor = eventItem.bgColor;
|
|
578
|
-
var titleText = schedulerData.behaviors.getEventTextFunc(schedulerData, eventItem);
|
|
579
|
-
var content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_EventItemPopover["default"], _objectSpread(_objectSpread({}, this.props), {}, {
|
|
580
|
-
eventItem: eventItem,
|
|
581
|
-
title: eventItem.title,
|
|
582
|
-
startTime: eventItem.start,
|
|
583
|
-
endTime: eventItem.end,
|
|
584
|
-
statusColor: bgColor
|
|
585
|
-
}));
|
|
586
|
-
var start = localeDayjs(new Date(eventItem.start));
|
|
587
|
-
var eventTitle = isInPopover ? "".concat(start.format('HH:mm'), " ").concat(titleText) : titleText;
|
|
588
|
-
var startResizeDiv = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
589
|
-
if (startResizable(this.props)) startResizeDiv = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
590
|
-
className: "event-resizer event-start-resizer",
|
|
591
|
-
ref: function ref(_ref6) {
|
|
592
|
-
return _this2.startResizer = _ref6;
|
|
593
|
-
}
|
|
594
|
-
});
|
|
595
|
-
var endResizeDiv = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
596
|
-
if (endResizable(this.props)) endResizeDiv = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
597
|
-
className: "event-resizer event-end-resizer",
|
|
598
|
-
ref: function ref(_ref7) {
|
|
599
|
-
return _this2.endResizer = _ref7;
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
var eventItemTemplate = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
603
|
-
className: "".concat(roundCls, " event-item"),
|
|
604
|
-
style: {
|
|
605
|
-
height: config.eventItemHeight,
|
|
606
|
-
backgroundColor: bgColor
|
|
607
|
-
},
|
|
608
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
609
|
-
style: {
|
|
610
|
-
marginLeft: '10px',
|
|
611
|
-
lineHeight: "".concat(config.eventItemHeight, "px")
|
|
612
|
-
},
|
|
613
|
-
children: eventTitle
|
|
614
|
-
})
|
|
615
|
-
}, eventItem.id);
|
|
616
|
-
if (eventItemTemplateResolver !== undefined) {
|
|
617
|
-
eventItemTemplate = eventItemTemplateResolver(schedulerData, eventItem, bgColor, isStart, isEnd, 'event-item', config.eventItemHeight, undefined);
|
|
618
|
-
}
|
|
619
|
-
var a = /*#__PURE__*/(0, _jsxRuntime.jsxs)("a", {
|
|
620
|
-
className: "timeline-event",
|
|
621
|
-
ref: this.eventItemRef,
|
|
622
|
-
onMouseMove: isPopoverPlacementMousePosition ? this.handleMouseMove : undefined,
|
|
623
|
-
style: {
|
|
624
|
-
left: left,
|
|
625
|
-
width: width,
|
|
626
|
-
top: top
|
|
627
|
-
},
|
|
628
|
-
onClick: function onClick() {
|
|
629
|
-
if (eventItemClick) eventItemClick(schedulerData, eventItem);
|
|
630
|
-
},
|
|
631
|
-
children: [eventItemTemplate, startResizeDiv, endResizeDiv]
|
|
632
|
-
});
|
|
633
|
-
var getMousePositionOptionsData = function getMousePositionOptionsData() {
|
|
634
|
-
var popoverOffsetX = 0;
|
|
635
|
-
var mousePositionPlacement = '';
|
|
636
|
-
if (isPopoverPlacementMousePosition) {
|
|
637
|
-
var isMousePositionPlacementLeft = popoverPlacement.includes('Left');
|
|
638
|
-
var contentMousePosX = _this2.state.contentMousePosX;
|
|
639
|
-
var popoverWidth = config.eventItemPopoverWidth;
|
|
640
|
-
var eventItemLeftRect = _this2.state.eventItemLeftRect;
|
|
641
|
-
var eventItemRightRect = _this2.state.eventItemRightRect;
|
|
642
|
-
var eventItemMousePosX = isMousePositionPlacementLeft ? eventItemLeftRect : eventItemRightRect;
|
|
643
|
-
var posAdjustControl = isMousePositionPlacementLeft ? 1 : -1;
|
|
644
|
-
mousePositionPlacement = popoverPlacement.replace('MousePosition', '');
|
|
645
|
-
var distance = 10;
|
|
646
|
-
if (isMousePositionPlacementLeft && _this2._isMounted) {
|
|
647
|
-
if (contentMousePosX + popoverWidth + distance > window.innerWidth) {
|
|
648
|
-
mousePositionPlacement = "".concat(popoverPlacement.replace(/(Right|Left).*/, ''), "Right");
|
|
649
|
-
eventItemMousePosX = eventItemRightRect;
|
|
650
|
-
posAdjustControl = -1;
|
|
651
|
-
}
|
|
652
|
-
} else if (contentMousePosX - popoverWidth - distance < 0) {
|
|
653
|
-
mousePositionPlacement = "".concat(popoverPlacement.replace(/(Right|Left).*/, ''), "Left");
|
|
654
|
-
eventItemMousePosX = eventItemLeftRect;
|
|
655
|
-
posAdjustControl = 1;
|
|
656
|
-
}
|
|
657
|
-
popoverOffsetX = contentMousePosX - eventItemMousePosX - 20 * posAdjustControl;
|
|
658
|
-
}
|
|
659
|
-
return {
|
|
660
|
-
popoverOffsetX: popoverOffsetX,
|
|
661
|
-
mousePositionPlacement: mousePositionPlacement
|
|
662
|
-
};
|
|
663
|
-
};
|
|
664
|
-
var _getMousePositionOpti = getMousePositionOptionsData(),
|
|
665
|
-
popoverOffsetX = _getMousePositionOpti.popoverOffsetX,
|
|
666
|
-
mousePositionPlacement = _getMousePositionOpti.mousePositionPlacement;
|
|
667
|
-
var aItem = a;
|
|
668
|
-
if (isDragging ? null : schedulerData._isResizing() || config.eventItemPopoverEnabled === false || eventItem.showPopover === false) {
|
|
669
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
670
|
-
children: aItem
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Popover, {
|
|
674
|
-
motion: isPopoverPlacementMousePosition ? '' : undefined,
|
|
675
|
-
align: isPopoverPlacementMousePosition ? {
|
|
676
|
-
offset: [popoverOffsetX, popoverPlacement.includes('top') ? -10 : 10],
|
|
677
|
-
overflow: {}
|
|
678
|
-
} : undefined,
|
|
679
|
-
placement: isPopoverPlacementMousePosition ? mousePositionPlacement : popoverPlacement,
|
|
680
|
-
content: content,
|
|
681
|
-
trigger: config.eventItemPopoverTrigger,
|
|
682
|
-
children: aItem
|
|
683
|
-
});
|
|
684
|
-
}
|
|
685
|
-
}]);
|
|
686
|
-
}(_react.Component); // Wrapper component to use useDrag hook
|
|
687
|
-
function EventItemWithDnD(props) {
|
|
688
|
-
var dndSource = props.dndSource;
|
|
689
|
-
|
|
690
|
-
// Always call useDrag unconditionally (Rules of Hooks)
|
|
691
|
-
// Disable functionality when dndSource is not provided
|
|
692
|
-
var _useDrag = (0, _reactDnd.useDrag)(function () {
|
|
693
|
-
// If dndSource is not provided, return a no-op spec
|
|
694
|
-
if (!dndSource) {
|
|
695
|
-
return {
|
|
696
|
-
type: '__NONE__',
|
|
697
|
-
canDrag: function canDrag() {
|
|
698
|
-
return false;
|
|
699
|
-
},
|
|
700
|
-
collect: function collect() {
|
|
701
|
-
return {
|
|
702
|
-
isDragging: false
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
// Get drag options from dndSource
|
|
709
|
-
return dndSource.getDragOptions(props);
|
|
710
|
-
}, [props, dndSource]),
|
|
711
|
-
_useDrag2 = _slicedToArray(_useDrag, 3),
|
|
712
|
-
isDragging = _useDrag2[0].isDragging,
|
|
713
|
-
dragRef = _useDrag2[1],
|
|
714
|
-
dragPreviewRef = _useDrag2[2];
|
|
715
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(EventItem, _objectSpread(_objectSpread({}, props), {}, {
|
|
716
|
-
isDragging: isDragging,
|
|
717
|
-
dragRef: dragRef,
|
|
718
|
-
dragPreviewRef: dragPreviewRef
|
|
719
|
-
}));
|
|
720
|
-
}
|
|
721
|
-
EventItemWithDnD.propTypes = {
|
|
722
|
-
schedulerData: _propTypes.PropTypes.object.isRequired,
|
|
723
|
-
dndSource: _propTypes.PropTypes.object
|
|
724
|
-
};
|
|
725
|
-
EventItemWithDnD.defaultProps = {
|
|
726
|
-
dndSource: undefined
|
|
727
|
-
};
|
|
728
|
-
EventItemWithDnD.displayName = 'EventItemWithDnD';
|
|
729
|
-
var _default = exports["default"] = EventItemWithDnD;
|
|
730
|
-
EventItem.propTypes = {
|
|
731
|
-
schedulerData: _propTypes.PropTypes.object.isRequired,
|
|
732
|
-
eventItem: _propTypes.PropTypes.object.isRequired,
|
|
733
|
-
isStart: _propTypes.PropTypes.bool.isRequired,
|
|
734
|
-
isEnd: _propTypes.PropTypes.bool.isRequired,
|
|
735
|
-
left: _propTypes.PropTypes.number.isRequired,
|
|
736
|
-
width: _propTypes.PropTypes.number.isRequired,
|
|
737
|
-
top: _propTypes.PropTypes.number.isRequired,
|
|
738
|
-
isInPopover: _propTypes.PropTypes.bool.isRequired,
|
|
739
|
-
leftIndex: _propTypes.PropTypes.number.isRequired,
|
|
740
|
-
rightIndex: _propTypes.PropTypes.number.isRequired,
|
|
741
|
-
isDragging: _propTypes.PropTypes.bool,
|
|
742
|
-
dragRef: _propTypes.PropTypes.func,
|
|
743
|
-
dragPreviewRef: _propTypes.PropTypes.func,
|
|
744
|
-
updateEventStart: _propTypes.PropTypes.func,
|
|
745
|
-
updateEventEnd: _propTypes.PropTypes.func,
|
|
746
|
-
moveEvent: _propTypes.PropTypes.func,
|
|
747
|
-
subtitleGetter: _propTypes.PropTypes.func,
|
|
748
|
-
eventItemClick: _propTypes.PropTypes.func,
|
|
749
|
-
viewEventClick: _propTypes.PropTypes.func,
|
|
750
|
-
viewEventText: _propTypes.PropTypes.string,
|
|
751
|
-
viewEvent2Click: _propTypes.PropTypes.func,
|
|
752
|
-
viewEvent2Text: _propTypes.PropTypes.string,
|
|
753
|
-
conflictOccurred: _propTypes.PropTypes.func,
|
|
754
|
-
eventItemTemplateResolver: _propTypes.PropTypes.func
|
|
755
|
-
};
|
|
756
|
-
EventItem.defaultProps = {
|
|
757
|
-
isDragging: undefined,
|
|
758
|
-
dragRef: undefined,
|
|
759
|
-
dragPreviewRef: undefined,
|
|
760
|
-
updateEventStart: undefined,
|
|
761
|
-
updateEventEnd: undefined,
|
|
762
|
-
moveEvent: undefined,
|
|
763
|
-
subtitleGetter: undefined,
|
|
764
|
-
eventItemClick: undefined,
|
|
765
|
-
viewEventClick: undefined,
|
|
766
|
-
viewEventText: undefined,
|
|
767
|
-
viewEvent2Click: undefined,
|
|
768
|
-
viewEvent2Text: undefined,
|
|
769
|
-
conflictOccurred: undefined,
|
|
770
|
-
eventItemTemplateResolver: undefined
|
|
771
|
-
};
|