react-big-schedule 5.4.6 → 5.4.7
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 +50 -0
- package/dist/components/AddMorePopover.js +117 -0
- package/dist/components/AgendaEventItem.js +94 -0
- package/dist/components/AgendaResourceEvents.js +102 -0
- package/dist/components/AgendaView.js +69 -0
- package/dist/components/BodyView.js +59 -0
- package/dist/components/DnDContext.js +171 -0
- package/dist/components/DnDSource.js +125 -0
- package/dist/components/EventItem.js +771 -0
- package/dist/components/EventItemPopover.js +153 -0
- package/dist/components/HeaderView.js +183 -0
- package/dist/components/ResourceEvents.js +515 -0
- package/dist/components/ResourceView.js +158 -0
- package/dist/components/SchedulerData.js +1257 -0
- package/dist/components/SchedulerHeader.js +188 -0
- package/dist/components/SelectedArea.js +32 -0
- package/dist/components/Summary.js +61 -0
- package/dist/components/WrapperFun.js +23 -0
- package/dist/components/index.js +697 -0
- package/dist/config/default.js +36 -0
- package/dist/config/i18n.js +80 -0
- package/dist/config/scheduler.js +122 -0
- package/dist/css/style.css +256 -0
- package/dist/helper/behaviors.js +94 -0
- package/dist/helper/utility.js +20 -0
- package/dist/index.d.ts +457 -0
- package/dist/index.js +103 -0
- package/dist/sample-data/sample1.js +337 -0
- package/package.json +2 -2
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _propTypes = require("prop-types");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactDnd = require("react-dnd");
|
|
10
|
+
var _default2 = require("../config/default");
|
|
11
|
+
var _utility = require("../helper/utility");
|
|
12
|
+
var _AddMore = _interopRequireDefault(require("./AddMore"));
|
|
13
|
+
var _EventItem = _interopRequireDefault(require("./EventItem"));
|
|
14
|
+
var _SelectedArea = _interopRequireDefault(require("./SelectedArea"));
|
|
15
|
+
var _Summary = _interopRequireDefault(require("./Summary"));
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
+
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); }
|
|
20
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
21
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
23
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
24
|
+
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; }
|
|
25
|
+
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; }
|
|
26
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
27
|
+
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."); }
|
|
28
|
+
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; } }
|
|
29
|
+
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; }
|
|
30
|
+
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; } }
|
|
31
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
32
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
33
|
+
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); } }
|
|
34
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
35
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
36
|
+
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); }
|
|
37
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
38
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
39
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
40
|
+
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); }
|
|
41
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
42
|
+
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; }
|
|
43
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
44
|
+
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); }
|
|
45
|
+
var ResourceEvents = /*#__PURE__*/function (_Component) {
|
|
46
|
+
function ResourceEvents(props) {
|
|
47
|
+
var _this;
|
|
48
|
+
_classCallCheck(this, ResourceEvents);
|
|
49
|
+
_this = _callSuper(this, ResourceEvents, [props]);
|
|
50
|
+
_defineProperty(_this, "supportTouchHelper", function () {
|
|
51
|
+
var evType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'add';
|
|
52
|
+
var ev = evType === 'add' ? _this.eventContainer.addEventListener : _this.eventContainer.removeEventListener;
|
|
53
|
+
if (_this.supportTouch) {
|
|
54
|
+
// ev('touchstart', this.initDrag, false);
|
|
55
|
+
} else {
|
|
56
|
+
ev('mousedown', _this.initDrag, false);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
_defineProperty(_this, "initDrag", function (ev) {
|
|
60
|
+
var isSelecting = _this.state.isSelecting;
|
|
61
|
+
if (isSelecting) return;
|
|
62
|
+
if ((ev.srcElement || ev.target) !== _this.eventContainer) return;
|
|
63
|
+
ev.stopPropagation();
|
|
64
|
+
var resourceEvents = _this.props.resourceEvents;
|
|
65
|
+
if (resourceEvents.groupOnly) return;
|
|
66
|
+
var _this$dragHelper = _this.dragHelper(ev, 'init'),
|
|
67
|
+
_this$dragHelper2 = _slicedToArray(_this$dragHelper, 2),
|
|
68
|
+
clientX = _this$dragHelper2[0],
|
|
69
|
+
toReturn = _this$dragHelper2[1];
|
|
70
|
+
if (toReturn) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
var schedulerData = _this.props.schedulerData;
|
|
74
|
+
var cellWidth = schedulerData.getContentCellWidth();
|
|
75
|
+
var pos = (0, _utility.getPos)(_this.eventContainer);
|
|
76
|
+
var startX = clientX - pos.x;
|
|
77
|
+
var leftIndex = Math.floor(startX / cellWidth);
|
|
78
|
+
var left = leftIndex * cellWidth;
|
|
79
|
+
var rightIndex = Math.ceil(startX / cellWidth);
|
|
80
|
+
var width = (rightIndex - leftIndex) * cellWidth;
|
|
81
|
+
_this.setState({
|
|
82
|
+
startX: startX,
|
|
83
|
+
left: left,
|
|
84
|
+
leftIndex: leftIndex,
|
|
85
|
+
width: width,
|
|
86
|
+
rightIndex: rightIndex,
|
|
87
|
+
isSelecting: true
|
|
88
|
+
});
|
|
89
|
+
if (_this.supportTouch) {
|
|
90
|
+
document.documentElement.addEventListener('touchmove', _this.doDrag, false);
|
|
91
|
+
document.documentElement.addEventListener('touchend', _this.stopDrag, false);
|
|
92
|
+
document.documentElement.addEventListener('touchcancel', _this.cancelDrag, false);
|
|
93
|
+
} else {
|
|
94
|
+
document.documentElement.addEventListener('mousemove', _this.doDrag, false);
|
|
95
|
+
document.documentElement.addEventListener('mouseup', _this.stopDrag, false);
|
|
96
|
+
}
|
|
97
|
+
document.onselectstart = function () {
|
|
98
|
+
return false;
|
|
99
|
+
};
|
|
100
|
+
document.ondragstart = function () {
|
|
101
|
+
return false;
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
_defineProperty(_this, "doDrag", function (ev) {
|
|
105
|
+
ev.stopPropagation();
|
|
106
|
+
var _this$dragHelper3 = _this.dragHelper(ev, 'do'),
|
|
107
|
+
_this$dragHelper4 = _slicedToArray(_this$dragHelper3, 2),
|
|
108
|
+
clientX = _this$dragHelper4[0],
|
|
109
|
+
toReturn = _this$dragHelper4[1];
|
|
110
|
+
if (toReturn) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
var startX = _this.state.startX;
|
|
114
|
+
var schedulerData = _this.props.schedulerData;
|
|
115
|
+
var headers = schedulerData.headers;
|
|
116
|
+
var cellWidth = schedulerData.getContentCellWidth();
|
|
117
|
+
var pos = (0, _utility.getPos)(_this.eventContainer);
|
|
118
|
+
var currentX = clientX - pos.x;
|
|
119
|
+
var leftIndex = Math.floor(Math.min(startX, currentX) / cellWidth);
|
|
120
|
+
leftIndex = leftIndex < 0 ? 0 : leftIndex;
|
|
121
|
+
var left = leftIndex * cellWidth;
|
|
122
|
+
var rightIndex = Math.ceil(Math.max(startX, currentX) / cellWidth);
|
|
123
|
+
rightIndex = rightIndex > headers.length ? headers.length : rightIndex;
|
|
124
|
+
var width = (rightIndex - leftIndex) * cellWidth;
|
|
125
|
+
_this.setState({
|
|
126
|
+
leftIndex: leftIndex,
|
|
127
|
+
left: left,
|
|
128
|
+
rightIndex: rightIndex,
|
|
129
|
+
width: width,
|
|
130
|
+
isSelecting: true
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
_defineProperty(_this, "dragHelper", function (ev, dragType) {
|
|
134
|
+
var clientX = 0;
|
|
135
|
+
if (_this.supportTouch) {
|
|
136
|
+
if (ev.changedTouches.length === 0) return [clientX, true];
|
|
137
|
+
var touch = ev.changedTouches[0];
|
|
138
|
+
clientX = touch.pageX;
|
|
139
|
+
} else if (dragType === 'init') {
|
|
140
|
+
if (ev.buttons !== undefined && ev.buttons !== 1) return [clientX, true];
|
|
141
|
+
clientX = ev.clientX;
|
|
142
|
+
} else {
|
|
143
|
+
clientX = ev.clientX;
|
|
144
|
+
}
|
|
145
|
+
return [clientX, false];
|
|
146
|
+
});
|
|
147
|
+
_defineProperty(_this, "stopDrag", function (ev) {
|
|
148
|
+
ev.stopPropagation();
|
|
149
|
+
var _this$props = _this.props,
|
|
150
|
+
schedulerData = _this$props.schedulerData,
|
|
151
|
+
newEvent = _this$props.newEvent,
|
|
152
|
+
resourceEvents = _this$props.resourceEvents;
|
|
153
|
+
var headers = schedulerData.headers,
|
|
154
|
+
events = schedulerData.events,
|
|
155
|
+
config = schedulerData.config,
|
|
156
|
+
cellUnit = schedulerData.cellUnit,
|
|
157
|
+
localeDayjs = schedulerData.localeDayjs;
|
|
158
|
+
var _this$state = _this.state,
|
|
159
|
+
leftIndex = _this$state.leftIndex,
|
|
160
|
+
rightIndex = _this$state.rightIndex;
|
|
161
|
+
if (_this.supportTouch) {
|
|
162
|
+
document.documentElement.removeEventListener('touchmove', _this.doDrag, false);
|
|
163
|
+
document.documentElement.removeEventListener('touchend', _this.stopDrag, false);
|
|
164
|
+
document.documentElement.removeEventListener('touchcancel', _this.cancelDrag, false);
|
|
165
|
+
} else {
|
|
166
|
+
document.documentElement.removeEventListener('mousemove', _this.doDrag, false);
|
|
167
|
+
document.documentElement.removeEventListener('mouseup', _this.stopDrag, false);
|
|
168
|
+
}
|
|
169
|
+
document.onselectstart = null;
|
|
170
|
+
document.ondragstart = null;
|
|
171
|
+
var startTime = headers[leftIndex].time;
|
|
172
|
+
var endTime = resourceEvents.headerItems[rightIndex - 1].end;
|
|
173
|
+
if (cellUnit !== _default2.CellUnit.Hour) {
|
|
174
|
+
endTime = localeDayjs(new Date(resourceEvents.headerItems[rightIndex - 1].start)).hour(23).minute(59).second(59).format(_default2.DATETIME_FORMAT);
|
|
175
|
+
}
|
|
176
|
+
var slotId = resourceEvents.slotId;
|
|
177
|
+
var slotName = resourceEvents.slotName;
|
|
178
|
+
_this.setState({
|
|
179
|
+
startX: 0,
|
|
180
|
+
leftIndex: 0,
|
|
181
|
+
left: 0,
|
|
182
|
+
rightIndex: 0,
|
|
183
|
+
width: 0,
|
|
184
|
+
isSelecting: false
|
|
185
|
+
});
|
|
186
|
+
var hasConflict = false;
|
|
187
|
+
if (config.checkConflict) {
|
|
188
|
+
var start = localeDayjs(new Date(startTime));
|
|
189
|
+
var end = localeDayjs(endTime);
|
|
190
|
+
events.forEach(function (e) {
|
|
191
|
+
if (schedulerData._getEventSlotId(e) === slotId) {
|
|
192
|
+
var eStart = localeDayjs(e.start);
|
|
193
|
+
var eEnd = localeDayjs(e.end);
|
|
194
|
+
if (start >= eStart && start < eEnd || end > eStart && end <= eEnd || eStart >= start && eStart < end || eEnd > start && eEnd <= end) hasConflict = true;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if (hasConflict) {
|
|
199
|
+
var conflictOccurred = _this.props.conflictOccurred;
|
|
200
|
+
if (conflictOccurred !== undefined) {
|
|
201
|
+
conflictOccurred(schedulerData, 'New', {
|
|
202
|
+
id: undefined,
|
|
203
|
+
start: startTime,
|
|
204
|
+
end: endTime,
|
|
205
|
+
slotId: slotId,
|
|
206
|
+
slotName: slotName,
|
|
207
|
+
title: undefined
|
|
208
|
+
}, _default2.DnDTypes.EVENT, slotId, slotName, startTime, endTime);
|
|
209
|
+
} else {
|
|
210
|
+
console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
|
|
211
|
+
}
|
|
212
|
+
} else if (newEvent !== undefined) newEvent(schedulerData, slotId, slotName, startTime, endTime);
|
|
213
|
+
});
|
|
214
|
+
_defineProperty(_this, "cancelDrag", function (ev) {
|
|
215
|
+
ev.stopPropagation();
|
|
216
|
+
var isSelecting = _this.state.isSelecting;
|
|
217
|
+
if (isSelecting) {
|
|
218
|
+
document.documentElement.removeEventListener('touchmove', _this.doDrag, false);
|
|
219
|
+
document.documentElement.removeEventListener('touchend', _this.stopDrag, false);
|
|
220
|
+
document.documentElement.removeEventListener('touchcancel', _this.cancelDrag, false);
|
|
221
|
+
document.onselectstart = null;
|
|
222
|
+
document.ondragstart = null;
|
|
223
|
+
_this.setState({
|
|
224
|
+
startX: 0,
|
|
225
|
+
leftIndex: 0,
|
|
226
|
+
left: 0,
|
|
227
|
+
rightIndex: 0,
|
|
228
|
+
width: 0,
|
|
229
|
+
isSelecting: false
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
_defineProperty(_this, "onAddMoreClick", function (headerItem) {
|
|
234
|
+
var _this$props2 = _this.props,
|
|
235
|
+
onSetAddMoreState = _this$props2.onSetAddMoreState,
|
|
236
|
+
resourceEvents = _this$props2.resourceEvents,
|
|
237
|
+
schedulerData = _this$props2.schedulerData;
|
|
238
|
+
if (onSetAddMoreState) {
|
|
239
|
+
var config = schedulerData.config;
|
|
240
|
+
var cellWidth = schedulerData.getContentCellWidth();
|
|
241
|
+
var index = resourceEvents.headerItems.indexOf(headerItem);
|
|
242
|
+
if (index !== -1) {
|
|
243
|
+
var left = index * (cellWidth - 1);
|
|
244
|
+
var pos = (0, _utility.getPos)(_this.eventContainer);
|
|
245
|
+
left += pos.x;
|
|
246
|
+
var top = pos.y;
|
|
247
|
+
var height = (headerItem.count + 1) * config.eventItemLineHeight + 20;
|
|
248
|
+
onSetAddMoreState({
|
|
249
|
+
headerItem: headerItem,
|
|
250
|
+
left: left,
|
|
251
|
+
top: top,
|
|
252
|
+
height: height
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
_defineProperty(_this, "eventContainerRef", function (element) {
|
|
258
|
+
_this.eventContainer = element;
|
|
259
|
+
// Also set the drop ref if it exists
|
|
260
|
+
var dropRef = _this.props.dropRef;
|
|
261
|
+
if (dropRef) {
|
|
262
|
+
dropRef(element);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
_this.state = {
|
|
266
|
+
isSelecting: false,
|
|
267
|
+
left: 0,
|
|
268
|
+
width: 0
|
|
269
|
+
};
|
|
270
|
+
_this.supportTouch = false; // 'ontouchstart' in window;
|
|
271
|
+
return _this;
|
|
272
|
+
}
|
|
273
|
+
_inherits(ResourceEvents, _Component);
|
|
274
|
+
return _createClass(ResourceEvents, [{
|
|
275
|
+
key: "componentDidMount",
|
|
276
|
+
value: function componentDidMount() {
|
|
277
|
+
var schedulerData = this.props.schedulerData;
|
|
278
|
+
var config = schedulerData.config;
|
|
279
|
+
this.supportTouch = 'ontouchstart' in window;
|
|
280
|
+
if (config.creatable === true) {
|
|
281
|
+
this.supportTouchHelper();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}, {
|
|
285
|
+
key: "componentDidUpdate",
|
|
286
|
+
value: function componentDidUpdate(prevProps) {
|
|
287
|
+
if (prevProps !== this.props) {
|
|
288
|
+
var schedulerData = this.props.schedulerData;
|
|
289
|
+
this.supportTouchHelper('remove');
|
|
290
|
+
if (schedulerData.config.creatable) {
|
|
291
|
+
this.supportTouchHelper();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
key: "render",
|
|
297
|
+
value: function render() {
|
|
298
|
+
var _this2 = this;
|
|
299
|
+
var _this$props3 = this.props,
|
|
300
|
+
resourceEvents = _this$props3.resourceEvents,
|
|
301
|
+
schedulerData = _this$props3.schedulerData,
|
|
302
|
+
dndSource = _this$props3.dndSource;
|
|
303
|
+
var cellUnit = schedulerData.cellUnit,
|
|
304
|
+
startDate = schedulerData.startDate,
|
|
305
|
+
endDate = schedulerData.endDate,
|
|
306
|
+
config = schedulerData.config,
|
|
307
|
+
localeDayjs = schedulerData.localeDayjs;
|
|
308
|
+
var _this$state2 = this.state,
|
|
309
|
+
isSelecting = _this$state2.isSelecting,
|
|
310
|
+
left = _this$state2.left,
|
|
311
|
+
width = _this$state2.width;
|
|
312
|
+
var cellWidth = schedulerData.getContentCellWidth();
|
|
313
|
+
var cellMaxEvents = schedulerData.getCellMaxEvents();
|
|
314
|
+
var rowWidth = schedulerData.getContentTableWidth();
|
|
315
|
+
var selectedArea = isSelecting ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectedArea["default"], _objectSpread(_objectSpread({}, this.props), {}, {
|
|
316
|
+
left: left,
|
|
317
|
+
width: width
|
|
318
|
+
})) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
319
|
+
var eventList = [];
|
|
320
|
+
resourceEvents.headerItems.forEach(function (headerItem, index) {
|
|
321
|
+
if (headerItem.count > 0 || headerItem.summary !== undefined) {
|
|
322
|
+
var isTop = config.summaryPos === _default2.SummaryPos.TopRight || config.summaryPos === _default2.SummaryPos.Top || config.summaryPos === _default2.SummaryPos.TopLeft;
|
|
323
|
+
var marginTop = resourceEvents.hasSummary && isTop ? 1 + config.eventItemLineHeight : 1;
|
|
324
|
+
var renderEventsMaxIndex = headerItem.addMore === 0 ? cellMaxEvents : headerItem.addMoreIndex;
|
|
325
|
+
headerItem.events.forEach(function (evt, idx) {
|
|
326
|
+
if (idx < renderEventsMaxIndex && evt !== undefined && evt.render) {
|
|
327
|
+
var durationStart = localeDayjs(new Date(startDate));
|
|
328
|
+
var durationEnd = localeDayjs(endDate);
|
|
329
|
+
if (cellUnit === _default2.CellUnit.Hour) {
|
|
330
|
+
durationStart = localeDayjs(new Date(startDate)).add(config.dayStartFrom, 'hours');
|
|
331
|
+
durationEnd = localeDayjs(endDate).add(config.dayStopTo + 1, 'hours');
|
|
332
|
+
}
|
|
333
|
+
var eventStart = localeDayjs(evt.eventItem.start);
|
|
334
|
+
var eventEnd = localeDayjs(evt.eventItem.end);
|
|
335
|
+
var isStart = eventStart >= durationStart;
|
|
336
|
+
var isEnd = eventEnd <= durationEnd;
|
|
337
|
+
var _left = index * cellWidth + (index > 0 ? 2 : 3);
|
|
338
|
+
var _width = evt.span * cellWidth - (index > 0 ? 5 : 6) > 0 ? evt.span * cellWidth - (index > 0 ? 5 : 6) : 0;
|
|
339
|
+
var dayStart = localeDayjs(new Date(headerItem.start)).startOf('day');
|
|
340
|
+
var dayDurationMinutes = 1440;
|
|
341
|
+
var baseCellWidth = cellWidth - (index > 0 ? 5 : 6);
|
|
342
|
+
if (cellUnit === _default2.CellUnit.Day) {
|
|
343
|
+
if (evt.span === 1) {
|
|
344
|
+
var startOffsetMinutes = eventStart.diff(dayStart, 'minute');
|
|
345
|
+
var eventDurationMinutes = eventEnd.diff(eventStart, 'minute');
|
|
346
|
+
var startPercentage = startOffsetMinutes / dayDurationMinutes;
|
|
347
|
+
var durationPercentage = eventDurationMinutes / dayDurationMinutes;
|
|
348
|
+
var leftOffset = baseCellWidth * startPercentage;
|
|
349
|
+
var eventWidth = baseCellWidth * durationPercentage;
|
|
350
|
+
_left = index * cellWidth + (index > 0 ? 2 : 3) + leftOffset;
|
|
351
|
+
_width = Math.max(1, eventWidth); // ensure minimum width of 1px
|
|
352
|
+
} else {
|
|
353
|
+
var headerStart = localeDayjs(new Date(headerItem.start));
|
|
354
|
+
var headerEnd = localeDayjs(new Date(headerItem.end));
|
|
355
|
+
var isFirstDay = eventStart >= headerStart && eventStart < headerEnd;
|
|
356
|
+
if (isFirstDay) {
|
|
357
|
+
var eventStartDayStart = eventStart.startOf('day');
|
|
358
|
+
var eventEndDayEnd = eventEnd.endOf('day');
|
|
359
|
+
var totalSpanMinutes = eventEndDayEnd.diff(eventStartDayStart, 'minute');
|
|
360
|
+
var eventStartOffsetMinutes = eventStart.diff(eventStartDayStart, 'minute');
|
|
361
|
+
var _eventDurationMinutes = eventEnd.diff(eventStart, 'minute');
|
|
362
|
+
var _startPercentage = eventStartOffsetMinutes / dayDurationMinutes;
|
|
363
|
+
var _durationPercentage = totalSpanMinutes > 0 ? _eventDurationMinutes / totalSpanMinutes : 1;
|
|
364
|
+
var totalWidth = evt.span * cellWidth - (index > 0 ? 5 : 6);
|
|
365
|
+
var _leftOffset = cellWidth * _startPercentage;
|
|
366
|
+
var _eventWidth = totalWidth * _durationPercentage;
|
|
367
|
+
_left = index * cellWidth + (index > 0 ? 2 : 3) + _leftOffset;
|
|
368
|
+
_width = Math.max(1, _eventWidth);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
} else {
|
|
372
|
+
_width = evt.span * cellWidth - (index > 0 ? 5 : 6) > 0 ? evt.span * cellWidth - (index > 0 ? 5 : 6) : 0;
|
|
373
|
+
}
|
|
374
|
+
var top = marginTop + idx * config.eventItemLineHeight;
|
|
375
|
+
var eventItem = /*#__PURE__*/(0, _react.createElement)(_EventItem["default"], _objectSpread(_objectSpread({}, _this2.props), {}, {
|
|
376
|
+
key: "".concat(evt.eventItem.id, "_").concat(headerItem.time),
|
|
377
|
+
eventItem: evt.eventItem,
|
|
378
|
+
dndSource: dndSource,
|
|
379
|
+
isStart: isStart,
|
|
380
|
+
isEnd: isEnd,
|
|
381
|
+
isInPopover: false,
|
|
382
|
+
left: _left,
|
|
383
|
+
width: _width,
|
|
384
|
+
top: top,
|
|
385
|
+
leftIndex: index,
|
|
386
|
+
rightIndex: index + evt.span
|
|
387
|
+
}));
|
|
388
|
+
eventList.push(eventItem);
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
if (headerItem.addMore > 0) {
|
|
392
|
+
var _left2 = index * cellWidth + (index > 0 ? 2 : 3);
|
|
393
|
+
var _width2 = cellWidth - (index > 0 ? 5 : 6);
|
|
394
|
+
var top = marginTop + headerItem.addMoreIndex * config.eventItemLineHeight;
|
|
395
|
+
var addMoreItem = /*#__PURE__*/(0, _react.createElement)(_AddMore["default"], _objectSpread(_objectSpread({}, _this2.props), {}, {
|
|
396
|
+
key: headerItem.time,
|
|
397
|
+
headerItem: headerItem,
|
|
398
|
+
number: headerItem.addMore,
|
|
399
|
+
left: _left2,
|
|
400
|
+
width: _width2,
|
|
401
|
+
top: top,
|
|
402
|
+
clickAction: _this2.onAddMoreClick
|
|
403
|
+
}));
|
|
404
|
+
eventList.push(addMoreItem);
|
|
405
|
+
}
|
|
406
|
+
if (headerItem.summary !== undefined) {
|
|
407
|
+
var _top = isTop ? 1 : resourceEvents.rowHeight - config.eventItemLineHeight + 1;
|
|
408
|
+
var _left3 = index * cellWidth + (index > 0 ? 2 : 3);
|
|
409
|
+
var _width3 = cellWidth - (index > 0 ? 5 : 6);
|
|
410
|
+
var key = "".concat(resourceEvents.slotId, "_").concat(headerItem.time);
|
|
411
|
+
var summary = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Summary["default"], {
|
|
412
|
+
schedulerData: schedulerData,
|
|
413
|
+
summary: headerItem.summary,
|
|
414
|
+
left: _left3,
|
|
415
|
+
width: _width3,
|
|
416
|
+
top: _top
|
|
417
|
+
}, key);
|
|
418
|
+
eventList.push(summary);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
var eventContainer = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
423
|
+
ref: this.eventContainerRef,
|
|
424
|
+
className: "event-container",
|
|
425
|
+
style: {
|
|
426
|
+
height: resourceEvents.rowHeight
|
|
427
|
+
},
|
|
428
|
+
children: [selectedArea, eventList]
|
|
429
|
+
});
|
|
430
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("tr", {
|
|
431
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
432
|
+
style: {
|
|
433
|
+
width: rowWidth
|
|
434
|
+
},
|
|
435
|
+
children: eventContainer
|
|
436
|
+
})
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}]);
|
|
440
|
+
}(_react.Component); // Wrapper component to use useDrop hook
|
|
441
|
+
_defineProperty(ResourceEvents, "propTypes", {
|
|
442
|
+
resourceEvents: _propTypes.PropTypes.object.isRequired,
|
|
443
|
+
schedulerData: _propTypes.PropTypes.object.isRequired,
|
|
444
|
+
dndSource: _propTypes.PropTypes.object.isRequired,
|
|
445
|
+
onSetAddMoreState: _propTypes.PropTypes.func,
|
|
446
|
+
updateEventStart: _propTypes.PropTypes.func,
|
|
447
|
+
updateEventEnd: _propTypes.PropTypes.func,
|
|
448
|
+
moveEvent: _propTypes.PropTypes.func,
|
|
449
|
+
movingEvent: _propTypes.PropTypes.func,
|
|
450
|
+
conflictOccurred: _propTypes.PropTypes.func,
|
|
451
|
+
subtitleGetter: _propTypes.PropTypes.func,
|
|
452
|
+
eventItemClick: _propTypes.PropTypes.func,
|
|
453
|
+
viewEventClick: _propTypes.PropTypes.func,
|
|
454
|
+
viewEventText: _propTypes.PropTypes.string,
|
|
455
|
+
viewEvent2Click: _propTypes.PropTypes.func,
|
|
456
|
+
viewEvent2Text: _propTypes.PropTypes.string,
|
|
457
|
+
newEvent: _propTypes.PropTypes.func,
|
|
458
|
+
eventItemTemplateResolver: _propTypes.PropTypes.func
|
|
459
|
+
});
|
|
460
|
+
var ResourceEventsWithDnD = function ResourceEventsWithDnD(props) {
|
|
461
|
+
var schedulerData = props.schedulerData,
|
|
462
|
+
dndContext = props.dndContext;
|
|
463
|
+
var config = schedulerData.config;
|
|
464
|
+
var componentRef = _react["default"].useRef(null);
|
|
465
|
+
|
|
466
|
+
// Always call useDrop unconditionally (Rules of Hooks)
|
|
467
|
+
// Disable functionality when drag and drop is not enabled
|
|
468
|
+
var _useDrop = (0, _reactDnd.useDrop)(function () {
|
|
469
|
+
// If drag and drop is disabled, return a no-op spec
|
|
470
|
+
if (!config.dragAndDropEnabled || !dndContext) {
|
|
471
|
+
return {
|
|
472
|
+
accept: [],
|
|
473
|
+
collect: function collect() {
|
|
474
|
+
return {
|
|
475
|
+
isOver: false,
|
|
476
|
+
canDrop: false
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
var spec = dndContext.getDropSpec();
|
|
482
|
+
return {
|
|
483
|
+
accept: _toConsumableArray(dndContext.sourceMap.keys()),
|
|
484
|
+
drop: function drop(item, monitor) {
|
|
485
|
+
return spec.drop(props, monitor, componentRef.current);
|
|
486
|
+
},
|
|
487
|
+
hover: function hover(item, monitor) {
|
|
488
|
+
return spec.hover(props, monitor, componentRef.current);
|
|
489
|
+
},
|
|
490
|
+
canDrop: function canDrop(item, monitor) {
|
|
491
|
+
return spec.canDrop(props, monitor);
|
|
492
|
+
},
|
|
493
|
+
collect: function collect(monitor) {
|
|
494
|
+
return {
|
|
495
|
+
isOver: monitor.isOver(),
|
|
496
|
+
canDrop: monitor.canDrop()
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
}, [props, dndContext, config.dragAndDropEnabled]),
|
|
501
|
+
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
502
|
+
_useDrop2$ = _useDrop2[0],
|
|
503
|
+
isOver = _useDrop2$.isOver,
|
|
504
|
+
canDrop = _useDrop2$.canDrop,
|
|
505
|
+
dropRef = _useDrop2[1];
|
|
506
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ResourceEvents, _objectSpread(_objectSpread({
|
|
507
|
+
ref: componentRef
|
|
508
|
+
}, props), {}, {
|
|
509
|
+
dropRef: dropRef,
|
|
510
|
+
isOver: isOver,
|
|
511
|
+
canDrop: canDrop
|
|
512
|
+
}));
|
|
513
|
+
};
|
|
514
|
+
ResourceEventsWithDnD.displayName = 'ResourceEventsWithDnD';
|
|
515
|
+
var _default = exports["default"] = ResourceEventsWithDnD;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _icons = require("@ant-design/icons");
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
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); } /**
|
|
17
|
+
* Render the scheduler's resource table with hierarchical indentation, optional expand/collapse controls,
|
|
18
|
+
* clickable slot names, and support for custom slot templates or an injected resource-cell renderer.
|
|
19
|
+
*
|
|
20
|
+
* @param {object} schedulerData - Scheduler state and helpers; must include `renderData`,
|
|
21
|
+
* `getResourceTableWidth`, and `config`.
|
|
22
|
+
* @param {number} contentScrollbarHeight - Height used to set the container's bottom padding.
|
|
23
|
+
* @param {Function} [slotClickedFunc] - Called as `slotClickedFunc(schedulerData, item)` when a slot name is clicked.
|
|
24
|
+
* @param {Function} [slotItemTemplateResolver] - Called as `slotItemTemplateResolver
|
|
25
|
+
* (schedulerData, item, slotClickedFunc, width, className)` to provide a custom slot cell element;
|
|
26
|
+
* if a value is returned it replaces the default slot cell.
|
|
27
|
+
* @param {Function} [toggleExpandFunc] - Called as `toggleExpandFunc(schedulerData, slotId)`
|
|
28
|
+
* to toggle expansion for items with children.
|
|
29
|
+
* @param {Function} [CustomResourceCell] - Optional React component rendered inside the resource
|
|
30
|
+
* `<td>` when provided; receives props `{ schedulerData, item, indents, slotClickedFunc, handleToggleExpand }`.
|
|
31
|
+
* @returns {JSX.Element} The rendered resource table element.
|
|
32
|
+
*/
|
|
33
|
+
function ResourceView(_ref) {
|
|
34
|
+
var schedulerData = _ref.schedulerData,
|
|
35
|
+
contentScrollbarHeight = _ref.contentScrollbarHeight,
|
|
36
|
+
slotClickedFunc = _ref.slotClickedFunc,
|
|
37
|
+
slotItemTemplateResolver = _ref.slotItemTemplateResolver,
|
|
38
|
+
toggleExpandFunc = _ref.toggleExpandFunc,
|
|
39
|
+
CustomResourceCell = _ref.CustomResourceCell;
|
|
40
|
+
var renderData = schedulerData.renderData;
|
|
41
|
+
var width = schedulerData.getResourceTableWidth() - 2;
|
|
42
|
+
var paddingBottom = contentScrollbarHeight;
|
|
43
|
+
var displayRenderData = renderData.filter(function (o) {
|
|
44
|
+
return o.render;
|
|
45
|
+
});
|
|
46
|
+
var handleToggleExpand = function handleToggleExpand(item) {
|
|
47
|
+
if (toggleExpandFunc) {
|
|
48
|
+
toggleExpandFunc(schedulerData, item.slotId);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var renderSlotItem = function renderSlotItem(item, indents) {
|
|
52
|
+
var indent = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
53
|
+
className: "expander-space"
|
|
54
|
+
}, "es".concat(item.indent));
|
|
55
|
+
var iconProps = {
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
return handleToggleExpand(item);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
if (item.hasChildren) {
|
|
61
|
+
indent = item.expanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.MinusSquareOutlined, _objectSpread({}, iconProps), "es".concat(item.indent)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.PlusSquareOutlined, _objectSpread({}, iconProps), "es".concat(item.indent));
|
|
62
|
+
}
|
|
63
|
+
indents.push(indent);
|
|
64
|
+
var tdStyle = {
|
|
65
|
+
height: item.rowHeight,
|
|
66
|
+
backgroundColor: item.groupOnly ? schedulerData.config.groupOnlySlotColor : undefined
|
|
67
|
+
};
|
|
68
|
+
if (CustomResourceCell) {
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("tr", {
|
|
70
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
71
|
+
"data-resource-id": item.slotId,
|
|
72
|
+
style: tdStyle,
|
|
73
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomResourceCell, {
|
|
74
|
+
schedulerData: schedulerData,
|
|
75
|
+
item: item,
|
|
76
|
+
indents: indents,
|
|
77
|
+
slotClickedFunc: slotClickedFunc,
|
|
78
|
+
handleToggleExpand: handleToggleExpand
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
}, item.slotId);
|
|
82
|
+
}
|
|
83
|
+
var slotCell = slotClickedFunc ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
84
|
+
className: "slot-cell",
|
|
85
|
+
children: [indents, /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
86
|
+
type: "button",
|
|
87
|
+
style: {
|
|
88
|
+
cursor: 'pointer'
|
|
89
|
+
},
|
|
90
|
+
className: "slot-text rbs-txt-btn-dis",
|
|
91
|
+
onClick: function onClick() {
|
|
92
|
+
return slotClickedFunc(schedulerData, item);
|
|
93
|
+
},
|
|
94
|
+
children: item.slotName
|
|
95
|
+
})]
|
|
96
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
97
|
+
className: "slot-cell",
|
|
98
|
+
children: [indents, /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
99
|
+
type: "button",
|
|
100
|
+
className: "slot-text rbs-txt-btn-dis",
|
|
101
|
+
style: {
|
|
102
|
+
cursor: slotClickedFunc === undefined ? undefined : 'pointer'
|
|
103
|
+
},
|
|
104
|
+
children: item.slotName
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
var slotItem = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
108
|
+
title: item.slotTitle || item.slotName,
|
|
109
|
+
className: "overflow-text header2-text",
|
|
110
|
+
style: {
|
|
111
|
+
textAlign: 'left'
|
|
112
|
+
},
|
|
113
|
+
children: slotCell
|
|
114
|
+
});
|
|
115
|
+
if (slotItemTemplateResolver) {
|
|
116
|
+
var resolvedTemplate = slotItemTemplateResolver(schedulerData, item, slotClickedFunc, width, 'overflow-text header2-text');
|
|
117
|
+
if (resolvedTemplate) {
|
|
118
|
+
slotItem = resolvedTemplate;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("tr", {
|
|
122
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
123
|
+
"data-resource-id": item.slotId,
|
|
124
|
+
style: tdStyle,
|
|
125
|
+
children: slotItem
|
|
126
|
+
})
|
|
127
|
+
}, item.slotId);
|
|
128
|
+
};
|
|
129
|
+
var resourceList = displayRenderData.map(function (item) {
|
|
130
|
+
var indents = [];
|
|
131
|
+
for (var i = 0; i < item.indent; i += 1) {
|
|
132
|
+
indents.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
133
|
+
className: "expander-space"
|
|
134
|
+
}, "es".concat(i)));
|
|
135
|
+
}
|
|
136
|
+
return renderSlotItem(item, indents);
|
|
137
|
+
});
|
|
138
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
139
|
+
style: {
|
|
140
|
+
paddingBottom: paddingBottom
|
|
141
|
+
},
|
|
142
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("table", {
|
|
143
|
+
className: "resource-table",
|
|
144
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
|
|
145
|
+
children: resourceList
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
ResourceView.propTypes = {
|
|
151
|
+
schedulerData: _propTypes["default"].object.isRequired,
|
|
152
|
+
contentScrollbarHeight: _propTypes["default"].number.isRequired,
|
|
153
|
+
slotClickedFunc: _propTypes["default"].func,
|
|
154
|
+
slotItemTemplateResolver: _propTypes["default"].func,
|
|
155
|
+
toggleExpandFunc: _propTypes["default"].func,
|
|
156
|
+
CustomResourceCell: _propTypes["default"].func
|
|
157
|
+
};
|
|
158
|
+
var _default = exports["default"] = ResourceView;
|