makula-schedule 2.2.4 → 2.2.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.
|
@@ -62,6 +62,9 @@ var DnDContext = exports["default"] = /*#__PURE__*/_createClass(function DnDCont
|
|
|
62
62
|
if (cellUnit !== _default.CellUnit.Hour) {
|
|
63
63
|
endTime = localeDayjs(new Date(resourceEvents.headerItems[leftIndex].start)).hour(23).minute(59).second(59).format(_default.DATETIME_FORMAT);
|
|
64
64
|
}
|
|
65
|
+
if (component && component.clearShadowState) {
|
|
66
|
+
component.clearShadowState();
|
|
67
|
+
}
|
|
65
68
|
return {
|
|
66
69
|
slotId: resourceEvents.slotId,
|
|
67
70
|
slotName: resourceEvents.slotName,
|
|
@@ -126,6 +129,32 @@ var DnDContext = exports["default"] = /*#__PURE__*/_createClass(function DnDCont
|
|
|
126
129
|
if (movingEvent) {
|
|
127
130
|
movingEvent(schedulerData, slotId, slotName, newStart, newEnd, action, type, item);
|
|
128
131
|
}
|
|
132
|
+
|
|
133
|
+
// Compute and set drop shadow position
|
|
134
|
+
if (config.snapToGrid && component && component.setShadowState) {
|
|
135
|
+
var shadowStartDayjs = localeDayjs(newStart);
|
|
136
|
+
var shadowEndDayjs = localeDayjs(newEnd);
|
|
137
|
+
var shadowLeftIndex = -1;
|
|
138
|
+
var shadowSpan = 0;
|
|
139
|
+
resourceEvents.headerItems.forEach(function (header, idx) {
|
|
140
|
+
var headerStart = new Date(header.start);
|
|
141
|
+
var headerEnd = new Date(header.end);
|
|
142
|
+
if (headerEnd > shadowStartDayjs.toDate() && headerStart < shadowEndDayjs.toDate()) {
|
|
143
|
+
if (shadowLeftIndex === -1) shadowLeftIndex = idx;
|
|
144
|
+
shadowSpan += 1;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
if (shadowLeftIndex >= 0 && shadowSpan > 0) {
|
|
148
|
+
var shadowLeft = shadowLeftIndex * cellWidth + (shadowLeftIndex > 0 ? 2 : 3);
|
|
149
|
+
var shadowWidth = shadowSpan * cellWidth - (shadowLeftIndex > 0 ? 5 : 6) > 0 ? shadowSpan * cellWidth - (shadowLeftIndex > 0 ? 5 : 6) : 0;
|
|
150
|
+
component.setShadowState({
|
|
151
|
+
left: shadowLeft,
|
|
152
|
+
width: shadowWidth,
|
|
153
|
+
top: 1,
|
|
154
|
+
bgColor: isEvent ? item.bgColor : config.defaultEventBgColor
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
129
158
|
},
|
|
130
159
|
canDrop: function canDrop(props, monitor) {
|
|
131
160
|
var schedulerData = props.schedulerData,
|
|
@@ -631,11 +631,11 @@ var EventItem = /*#__PURE__*/function (_Component) {
|
|
|
631
631
|
};
|
|
632
632
|
var showLeftArrow = showOverflowArrows && !isStart;
|
|
633
633
|
var showRightArrow = showOverflowArrows && !isEnd;
|
|
634
|
-
var leftArrow = showLeftArrow ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
634
|
+
var leftArrow = showLeftArrow && !eventItemTemplateResolver ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
635
635
|
className: "event-overflow-arrow event-overflow-arrow-left",
|
|
636
636
|
style: arrowStyle
|
|
637
637
|
}, "\u2039") : null;
|
|
638
|
-
var rightArrow = showRightArrow ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
638
|
+
var rightArrow = showRightArrow && !eventItemTemplateResolver ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
639
639
|
className: "event-overflow-arrow event-overflow-arrow-right",
|
|
640
640
|
style: arrowStyle
|
|
641
641
|
}, "\u203A") : null;
|
|
@@ -252,6 +252,16 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
|
+
_defineProperty(_this, "setShadowState", function (shadow) {
|
|
256
|
+
_this.setState({
|
|
257
|
+
shadowState: shadow
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
_defineProperty(_this, "clearShadowState", function () {
|
|
261
|
+
_this.setState({
|
|
262
|
+
shadowState: null
|
|
263
|
+
});
|
|
264
|
+
});
|
|
255
265
|
_defineProperty(_this, "eventContainerRef", function (element) {
|
|
256
266
|
_this.eventContainer = element;
|
|
257
267
|
// Also set the drop ref if it exists
|
|
@@ -263,7 +273,8 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
263
273
|
_this.state = {
|
|
264
274
|
isSelecting: false,
|
|
265
275
|
left: 0,
|
|
266
|
-
width: 0
|
|
276
|
+
width: 0,
|
|
277
|
+
shadowState: null
|
|
267
278
|
};
|
|
268
279
|
_this.supportTouch = false; // 'ontouchstart' in window;
|
|
269
280
|
return _this;
|
|
@@ -306,7 +317,8 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
306
317
|
var _this$state2 = this.state,
|
|
307
318
|
isSelecting = _this$state2.isSelecting,
|
|
308
319
|
left = _this$state2.left,
|
|
309
|
-
width = _this$state2.width
|
|
320
|
+
width = _this$state2.width,
|
|
321
|
+
shadowState = _this$state2.shadowState;
|
|
310
322
|
var cellWidth = schedulerData.getContentCellWidth();
|
|
311
323
|
var cellMaxEvents = schedulerData.getCellMaxEvents();
|
|
312
324
|
var rowWidth = schedulerData.getContentTableWidth();
|
|
@@ -429,13 +441,23 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
429
441
|
}
|
|
430
442
|
}
|
|
431
443
|
});
|
|
444
|
+
var dropShadow = shadowState && config.snapToGrid ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
445
|
+
className: "event-drop-shadow",
|
|
446
|
+
style: {
|
|
447
|
+
left: shadowState.left,
|
|
448
|
+
width: shadowState.width,
|
|
449
|
+
top: shadowState.top,
|
|
450
|
+
height: config.eventItemHeight,
|
|
451
|
+
backgroundColor: shadowState.bgColor || config.defaultEventBgColor
|
|
452
|
+
}
|
|
453
|
+
}) : null;
|
|
432
454
|
var eventContainer = /*#__PURE__*/_react["default"].createElement("div", {
|
|
433
455
|
ref: this.eventContainerRef,
|
|
434
456
|
className: "event-container",
|
|
435
457
|
style: {
|
|
436
458
|
height: resourceEvents.rowHeight
|
|
437
459
|
}
|
|
438
|
-
}, selectedArea, eventList);
|
|
460
|
+
}, selectedArea, dropShadow, eventList);
|
|
439
461
|
return /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", {
|
|
440
462
|
style: {
|
|
441
463
|
width: rowWidth
|
|
@@ -509,6 +531,11 @@ var ResourceEventsWithDnD = function ResourceEventsWithDnD(props) {
|
|
|
509
531
|
isOver = _useDrop2$.isOver,
|
|
510
532
|
canDrop = _useDrop2$.canDrop,
|
|
511
533
|
dropRef = _useDrop2[1];
|
|
534
|
+
(0, _react.useEffect)(function () {
|
|
535
|
+
if (!isOver && componentRef.current) {
|
|
536
|
+
componentRef.current.clearShadowState();
|
|
537
|
+
}
|
|
538
|
+
}, [isOver]);
|
|
512
539
|
return /*#__PURE__*/_react["default"].createElement(ResourceEvents, _extends({
|
|
513
540
|
ref: componentRef
|
|
514
541
|
}, props, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "makula-schedule",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"description": "React Big Schedule is a powerful and intuitive scheduler and resource planning solution built with React. Seamlessly integrate this modern browser-compatible component into your applications to effectively manage time, appointments, and resources. With drag-and-drop functionality, interactive UI, and granular views, react-big-schedule empowers users to effortlessly schedule and allocate resources with precision. Enhance productivity and streamline your workflow with this React-based solution, designed to optimize time management and simplify calendar-based operations. Perfect for applications requiring advanced scheduling capabilities, react-big-schedule offers a seamless and intuitive experience for managing appointments, resource allocation, and time slots. Unlock the potential of your React projects with react-big-schedule and revolutionize the way you handle scheduling and resource planning. It is the updated version of react-big-scheduler",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-big-schedule",
|