react-big-schedule 4.4.2 → 4.4.4-beta.2
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/dist/components/AddMore.js +12 -19
- package/dist/components/AddMorePopover.js +31 -41
- package/dist/components/AgendaEventItem.js +22 -29
- package/dist/components/AgendaResourceEvents.js +21 -28
- package/dist/components/AgendaView.js +18 -25
- package/dist/components/BodyView.js +8 -15
- package/dist/components/DnDContext.js +23 -28
- package/dist/components/DnDSource.js +12 -17
- package/dist/components/EventItem.js +52 -59
- package/dist/components/EventItemPopover.js +38 -45
- package/dist/components/HeaderView.js +15 -23
- package/dist/components/ResourceEvents.js +41 -50
- package/dist/components/ResourceView.js +22 -29
- package/dist/components/SchedulerData.js +74 -80
- package/dist/components/SchedulerHeader.js +35 -45
- package/dist/components/SelectedArea.js +7 -14
- package/dist/components/Summary.js +13 -20
- package/dist/components/WrapperFun.js +7 -15
- package/dist/components/index.js +99 -167
- package/dist/config/default.js +6 -12
- package/dist/config/scheduler.js +8 -14
- package/dist/helper/behaviors.js +20 -25
- package/dist/helper/utility.js +2 -8
- package/dist/index.js +1 -78
- package/dist/sample-data/sample1.js +1 -7
- package/package.json +25 -24
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _propTypes = require("prop-types");
|
|
9
|
-
var _AddMore = _interopRequireDefault(require("./AddMore"));
|
|
10
|
-
var _Summary = _interopRequireDefault(require("./Summary"));
|
|
11
|
-
var _SelectedArea = _interopRequireDefault(require("./SelectedArea"));
|
|
12
|
-
var _default2 = require("../config/default");
|
|
13
|
-
var _utility = require("../helper/utility");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
17
1
|
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); }
|
|
18
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
3
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -35,6 +19,13 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
|
|
|
35
19
|
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; }
|
|
36
20
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
37
21
|
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); }
|
|
22
|
+
import React, { Component } from 'react';
|
|
23
|
+
import { PropTypes } from 'prop-types';
|
|
24
|
+
import { CellUnit, DATETIME_FORMAT, SummaryPos, DnDTypes } from '../config/default';
|
|
25
|
+
import { getPos } from '../helper/utility.js';
|
|
26
|
+
import AddMore from './AddMore.jsx';
|
|
27
|
+
import Summary from './Summary.jsx';
|
|
28
|
+
import SelectedArea from './SelectedArea.jsx';
|
|
38
29
|
var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
39
30
|
function ResourceEvents(props) {
|
|
40
31
|
var _this;
|
|
@@ -65,7 +56,7 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
65
56
|
}
|
|
66
57
|
var schedulerData = _this.props.schedulerData;
|
|
67
58
|
var cellWidth = schedulerData.getContentCellWidth();
|
|
68
|
-
var pos =
|
|
59
|
+
var pos = getPos(_this.eventContainer);
|
|
69
60
|
var startX = clientX - pos.x;
|
|
70
61
|
var leftIndex = Math.floor(startX / cellWidth);
|
|
71
62
|
var left = leftIndex * cellWidth;
|
|
@@ -107,7 +98,7 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
107
98
|
var schedulerData = _this.props.schedulerData;
|
|
108
99
|
var headers = schedulerData.headers;
|
|
109
100
|
var cellWidth = schedulerData.getContentCellWidth();
|
|
110
|
-
var pos =
|
|
101
|
+
var pos = getPos(_this.eventContainer);
|
|
111
102
|
var currentX = clientX - pos.x;
|
|
112
103
|
var leftIndex = Math.floor(Math.min(startX, currentX) / cellWidth);
|
|
113
104
|
leftIndex = leftIndex < 0 ? 0 : leftIndex;
|
|
@@ -163,8 +154,8 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
163
154
|
document.ondragstart = null;
|
|
164
155
|
var startTime = headers[leftIndex].time;
|
|
165
156
|
var endTime = resourceEvents.headerItems[rightIndex - 1].end;
|
|
166
|
-
if (cellUnit !==
|
|
167
|
-
endTime = localeDayjs(new Date(resourceEvents.headerItems[rightIndex - 1].start)).hour(23).minute(59).second(59).format(
|
|
157
|
+
if (cellUnit !== CellUnit.Hour) {
|
|
158
|
+
endTime = localeDayjs(new Date(resourceEvents.headerItems[rightIndex - 1].start)).hour(23).minute(59).second(59).format(DATETIME_FORMAT);
|
|
168
159
|
}
|
|
169
160
|
var slotId = resourceEvents.slotId;
|
|
170
161
|
var slotName = resourceEvents.slotName;
|
|
@@ -198,7 +189,7 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
198
189
|
slotId: slotId,
|
|
199
190
|
slotName: slotName,
|
|
200
191
|
title: undefined
|
|
201
|
-
},
|
|
192
|
+
}, DnDTypes.EVENT, slotId, slotName, startTime, endTime);
|
|
202
193
|
} else {
|
|
203
194
|
console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
|
|
204
195
|
}
|
|
@@ -234,7 +225,7 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
234
225
|
var index = resourceEvents.headerItems.indexOf(headerItem);
|
|
235
226
|
if (index !== -1) {
|
|
236
227
|
var left = index * (cellWidth - 1);
|
|
237
|
-
var pos =
|
|
228
|
+
var pos = getPos(_this.eventContainer);
|
|
238
229
|
left += pos.x;
|
|
239
230
|
var top = pos.y;
|
|
240
231
|
var height = (headerItem.count + 1) * config.eventItemLineHeight + 20;
|
|
@@ -301,21 +292,21 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
301
292
|
var cellMaxEvents = schedulerData.getCellMaxEvents();
|
|
302
293
|
var rowWidth = schedulerData.getContentTableWidth();
|
|
303
294
|
var DnDEventItem = dndSource.getDragSource();
|
|
304
|
-
var selectedArea = isSelecting ? /*#__PURE__*/
|
|
295
|
+
var selectedArea = isSelecting ? /*#__PURE__*/React.createElement(SelectedArea, _extends({}, this.props, {
|
|
305
296
|
left: left,
|
|
306
297
|
width: width
|
|
307
|
-
})) : /*#__PURE__*/
|
|
298
|
+
})) : /*#__PURE__*/React.createElement("div", null);
|
|
308
299
|
var eventList = [];
|
|
309
300
|
resourceEvents.headerItems.forEach(function (headerItem, index) {
|
|
310
301
|
if (headerItem.count > 0 || headerItem.summary !== undefined) {
|
|
311
|
-
var isTop = config.summaryPos ===
|
|
302
|
+
var isTop = config.summaryPos === SummaryPos.TopRight || config.summaryPos === SummaryPos.Top || config.summaryPos === SummaryPos.TopLeft;
|
|
312
303
|
var marginTop = resourceEvents.hasSummary && isTop ? 1 + config.eventItemLineHeight : 1;
|
|
313
304
|
var renderEventsMaxIndex = headerItem.addMore === 0 ? cellMaxEvents : headerItem.addMoreIndex;
|
|
314
305
|
headerItem.events.forEach(function (evt, idx) {
|
|
315
306
|
if (idx < renderEventsMaxIndex && evt !== undefined && evt.render) {
|
|
316
307
|
var durationStart = localeDayjs(new Date(startDate));
|
|
317
308
|
var durationEnd = localeDayjs(endDate);
|
|
318
|
-
if (cellUnit ===
|
|
309
|
+
if (cellUnit === CellUnit.Hour) {
|
|
319
310
|
durationStart = localeDayjs(new Date(startDate)).add(config.dayStartFrom, 'hours');
|
|
320
311
|
durationEnd = localeDayjs(endDate).add(config.dayStopTo + 1, 'hours');
|
|
321
312
|
}
|
|
@@ -326,7 +317,7 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
326
317
|
var _left = index * cellWidth + (index > 0 ? 2 : 3);
|
|
327
318
|
var _width = evt.span * cellWidth - (index > 0 ? 5 : 6) > 0 ? evt.span * cellWidth - (index > 0 ? 5 : 6) : 0;
|
|
328
319
|
var top = marginTop + idx * config.eventItemLineHeight;
|
|
329
|
-
var eventItem = /*#__PURE__*/
|
|
320
|
+
var eventItem = /*#__PURE__*/React.createElement(DnDEventItem, _extends({}, _this2.props, {
|
|
330
321
|
key: evt.eventItem.id,
|
|
331
322
|
eventItem: evt.eventItem,
|
|
332
323
|
isStart: isStart,
|
|
@@ -345,7 +336,7 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
345
336
|
var _left2 = index * cellWidth + (index > 0 ? 2 : 3);
|
|
346
337
|
var _width2 = cellWidth - (index > 0 ? 5 : 6);
|
|
347
338
|
var top = marginTop + headerItem.addMoreIndex * config.eventItemLineHeight;
|
|
348
|
-
var addMoreItem = /*#__PURE__*/
|
|
339
|
+
var addMoreItem = /*#__PURE__*/React.createElement(AddMore, _extends({}, _this2.props, {
|
|
349
340
|
key: headerItem.time,
|
|
350
341
|
headerItem: headerItem,
|
|
351
342
|
number: headerItem.addMore,
|
|
@@ -361,7 +352,7 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
361
352
|
var _left3 = index * cellWidth + (index > 0 ? 2 : 3);
|
|
362
353
|
var _width3 = cellWidth - (index > 0 ? 5 : 6);
|
|
363
354
|
var key = "".concat(resourceEvents.slotId, "_").concat(headerItem.time);
|
|
364
|
-
var summary = /*#__PURE__*/
|
|
355
|
+
var summary = /*#__PURE__*/React.createElement(Summary, {
|
|
365
356
|
key: key,
|
|
366
357
|
schedulerData: schedulerData,
|
|
367
358
|
summary: headerItem.summary,
|
|
@@ -373,38 +364,38 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
|
373
364
|
}
|
|
374
365
|
}
|
|
375
366
|
});
|
|
376
|
-
var eventContainer = /*#__PURE__*/
|
|
367
|
+
var eventContainer = /*#__PURE__*/React.createElement("div", {
|
|
377
368
|
ref: this.eventContainerRef,
|
|
378
369
|
className: "event-container",
|
|
379
370
|
style: {
|
|
380
371
|
height: resourceEvents.rowHeight
|
|
381
372
|
}
|
|
382
373
|
}, selectedArea, eventList);
|
|
383
|
-
return /*#__PURE__*/
|
|
374
|
+
return /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
384
375
|
style: {
|
|
385
376
|
width: rowWidth
|
|
386
377
|
}
|
|
387
378
|
}, config.dragAndDropEnabled ? connectDropTarget(eventContainer) : eventContainer));
|
|
388
379
|
}
|
|
389
380
|
}]);
|
|
390
|
-
}(
|
|
381
|
+
}(Component);
|
|
391
382
|
_defineProperty(ResourceEvents, "propTypes", {
|
|
392
|
-
resourceEvents:
|
|
393
|
-
schedulerData:
|
|
394
|
-
dndSource:
|
|
395
|
-
onSetAddMoreState:
|
|
396
|
-
updateEventStart:
|
|
397
|
-
updateEventEnd:
|
|
398
|
-
moveEvent:
|
|
399
|
-
movingEvent:
|
|
400
|
-
conflictOccurred:
|
|
401
|
-
subtitleGetter:
|
|
402
|
-
eventItemClick:
|
|
403
|
-
viewEventClick:
|
|
404
|
-
viewEventText:
|
|
405
|
-
viewEvent2Click:
|
|
406
|
-
viewEvent2Text:
|
|
407
|
-
newEvent:
|
|
408
|
-
eventItemTemplateResolver:
|
|
383
|
+
resourceEvents: PropTypes.object.isRequired,
|
|
384
|
+
schedulerData: PropTypes.object.isRequired,
|
|
385
|
+
dndSource: PropTypes.object.isRequired,
|
|
386
|
+
onSetAddMoreState: PropTypes.func,
|
|
387
|
+
updateEventStart: PropTypes.func,
|
|
388
|
+
updateEventEnd: PropTypes.func,
|
|
389
|
+
moveEvent: PropTypes.func,
|
|
390
|
+
movingEvent: PropTypes.func,
|
|
391
|
+
conflictOccurred: PropTypes.func,
|
|
392
|
+
subtitleGetter: PropTypes.func,
|
|
393
|
+
eventItemClick: PropTypes.func,
|
|
394
|
+
viewEventClick: PropTypes.func,
|
|
395
|
+
viewEventText: PropTypes.string,
|
|
396
|
+
viewEvent2Click: PropTypes.func,
|
|
397
|
+
viewEvent2Text: PropTypes.string,
|
|
398
|
+
newEvent: PropTypes.func,
|
|
399
|
+
eventItemTemplateResolver: PropTypes.func
|
|
409
400
|
});
|
|
410
|
-
|
|
401
|
+
export default ResourceEvents;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _icons = require("@ant-design/icons");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { MinusSquareOutlined, PlusSquareOutlined } from '@ant-design/icons';
|
|
11
4
|
function ResourceView(_ref) {
|
|
12
5
|
var schedulerData = _ref.schedulerData,
|
|
13
6
|
contentScrollbarHeight = _ref.contentScrollbarHeight,
|
|
@@ -26,7 +19,7 @@ function ResourceView(_ref) {
|
|
|
26
19
|
}
|
|
27
20
|
};
|
|
28
21
|
var renderSlotItem = function renderSlotItem(item, indents) {
|
|
29
|
-
var indent = /*#__PURE__*/
|
|
22
|
+
var indent = /*#__PURE__*/React.createElement("span", {
|
|
30
23
|
key: "es".concat(item.indent),
|
|
31
24
|
className: "expander-space"
|
|
32
25
|
});
|
|
@@ -37,12 +30,12 @@ function ResourceView(_ref) {
|
|
|
37
30
|
}
|
|
38
31
|
};
|
|
39
32
|
if (item.hasChildren) {
|
|
40
|
-
indent = item.expanded ? /*#__PURE__*/
|
|
33
|
+
indent = item.expanded ? /*#__PURE__*/React.createElement(MinusSquareOutlined, iconProps) : /*#__PURE__*/React.createElement(PlusSquareOutlined, iconProps);
|
|
41
34
|
}
|
|
42
35
|
indents.push(indent);
|
|
43
|
-
var slotCell = slotClickedFunc ? /*#__PURE__*/
|
|
36
|
+
var slotCell = slotClickedFunc ? /*#__PURE__*/React.createElement("span", {
|
|
44
37
|
className: "slot-cell"
|
|
45
|
-
}, indents, /*#__PURE__*/
|
|
38
|
+
}, indents, /*#__PURE__*/React.createElement("button", {
|
|
46
39
|
type: "button",
|
|
47
40
|
style: {
|
|
48
41
|
cursor: 'pointer'
|
|
@@ -51,16 +44,16 @@ function ResourceView(_ref) {
|
|
|
51
44
|
onClick: function onClick() {
|
|
52
45
|
return slotClickedFunc(schedulerData, item);
|
|
53
46
|
}
|
|
54
|
-
}, item.slotName)) : /*#__PURE__*/
|
|
47
|
+
}, item.slotName)) : /*#__PURE__*/React.createElement("span", {
|
|
55
48
|
className: "slot-cell"
|
|
56
|
-
}, indents, /*#__PURE__*/
|
|
49
|
+
}, indents, /*#__PURE__*/React.createElement("button", {
|
|
57
50
|
type: "button",
|
|
58
51
|
className: "slot-text txt-btn-dis",
|
|
59
52
|
style: {
|
|
60
53
|
cursor: slotClickedFunc === undefined ? undefined : 'pointer'
|
|
61
54
|
}
|
|
62
55
|
}, item.slotName));
|
|
63
|
-
var slotItem = /*#__PURE__*/
|
|
56
|
+
var slotItem = /*#__PURE__*/React.createElement("div", {
|
|
64
57
|
title: item.slotTitle || item.slotName,
|
|
65
58
|
className: "overflow-text header2-text",
|
|
66
59
|
style: {
|
|
@@ -77,9 +70,9 @@ function ResourceView(_ref) {
|
|
|
77
70
|
height: item.rowHeight,
|
|
78
71
|
backgroundColor: item.groupOnly ? schedulerData.config.groupOnlySlotColor : undefined
|
|
79
72
|
};
|
|
80
|
-
return /*#__PURE__*/
|
|
73
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
81
74
|
key: item.slotId
|
|
82
|
-
}, /*#__PURE__*/
|
|
75
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
83
76
|
"data-resource-id": item.slotId,
|
|
84
77
|
style: tdStyle
|
|
85
78
|
}, slotItem));
|
|
@@ -87,26 +80,26 @@ function ResourceView(_ref) {
|
|
|
87
80
|
var resourceList = displayRenderData.map(function (item) {
|
|
88
81
|
var indents = [];
|
|
89
82
|
for (var i = 0; i < item.indent; i += 1) {
|
|
90
|
-
indents.push(/*#__PURE__*/
|
|
83
|
+
indents.push(/*#__PURE__*/React.createElement("span", {
|
|
91
84
|
key: "es".concat(i),
|
|
92
85
|
className: "expander-space"
|
|
93
86
|
}));
|
|
94
87
|
}
|
|
95
88
|
return renderSlotItem(item, indents);
|
|
96
89
|
});
|
|
97
|
-
return /*#__PURE__*/
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
98
91
|
style: {
|
|
99
92
|
paddingBottom: paddingBottom
|
|
100
93
|
}
|
|
101
|
-
}, /*#__PURE__*/
|
|
94
|
+
}, /*#__PURE__*/React.createElement("table", {
|
|
102
95
|
className: "resource-table"
|
|
103
|
-
}, /*#__PURE__*/
|
|
96
|
+
}, /*#__PURE__*/React.createElement("tbody", null, resourceList)));
|
|
104
97
|
}
|
|
105
98
|
ResourceView.propTypes = {
|
|
106
|
-
schedulerData:
|
|
107
|
-
contentScrollbarHeight:
|
|
108
|
-
slotClickedFunc:
|
|
109
|
-
slotItemTemplateResolver:
|
|
110
|
-
toggleExpandFunc:
|
|
99
|
+
schedulerData: PropTypes.object.isRequired,
|
|
100
|
+
contentScrollbarHeight: PropTypes.number.isRequired,
|
|
101
|
+
slotClickedFunc: PropTypes.func,
|
|
102
|
+
slotItemTemplateResolver: PropTypes.func,
|
|
103
|
+
toggleExpandFunc: PropTypes.func
|
|
111
104
|
};
|
|
112
|
-
|
|
105
|
+
export default ResourceView;
|