react-big-schedule 5.5.2-beta.4 → 6.0.0
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/README.md +6 -0
- package/dist/components/AddMore.js +29 -35
- package/dist/components/AddMorePopover.js +65 -83
- package/dist/components/AgendaEventItem.js +44 -54
- package/dist/components/AgendaResourceEvents.js +55 -65
- package/dist/components/AgendaView.js +50 -53
- package/dist/components/BodyView.js +30 -35
- package/dist/components/DnDContext.js +144 -159
- package/dist/components/DnDSource.js +107 -116
- package/dist/components/EventItem.js +659 -704
- package/dist/components/EventItemPopover.js +74 -83
- package/dist/components/HeaderView.js +81 -91
- package/dist/components/ResourceEvents.js +613 -675
- package/dist/components/ResourceView.js +71 -81
- package/dist/components/SchedulerData.js +1031 -1258
- package/dist/components/SchedulerHeader.js +83 -116
- package/dist/components/SelectedArea.js +18 -22
- package/dist/components/Summary.js +36 -45
- package/dist/components/WrapperFun.js +9 -19
- package/dist/components/index.js +317 -463
- package/dist/config/default.js +6 -12
- package/dist/config/i18n.js +13 -27
- package/dist/config/scheduler.js +8 -13
- package/dist/helper/behaviors.js +53 -61
- package/dist/helper/utility.js +40 -26
- package/dist/index.js +2 -103
- package/dist/sample-data/sample1.js +44 -8
- package/package.json +18 -18
package/README.md
CHANGED
|
@@ -318,6 +318,12 @@ See the demo `events` in the [sample1.js](https://github.com/ansulagrawal/react-
|
|
|
318
318
|
If we use the task view, we'd better add the `groupId` and the `groupName` property to each event object, see the
|
|
319
319
|
`eventsForTaskView` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js) for details.
|
|
320
320
|
|
|
321
|
+
## Event Date Formats
|
|
322
|
+
|
|
323
|
+
Events support both `YYYY-MM-DD HH:mm:ss` datetime strings and `YYYY-MM-DD` date-only strings for `start` and `end`.
|
|
324
|
+
Date-only events are treated as spanning the full calendar day. Month view and the other scheduler views handle both
|
|
325
|
+
formats consistently.
|
|
326
|
+
|
|
321
327
|
#### prev
|
|
322
328
|
|
|
323
329
|
```js
|
|
@@ -1,34 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
headerItem = _ref.headerItem;
|
|
18
|
-
var config = schedulerData.config;
|
|
19
|
-
var content = "+".concat(number, " more");
|
|
20
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
function AddMore({
|
|
4
|
+
schedulerData,
|
|
5
|
+
number,
|
|
6
|
+
left,
|
|
7
|
+
width,
|
|
8
|
+
top,
|
|
9
|
+
clickAction,
|
|
10
|
+
headerItem
|
|
11
|
+
}) {
|
|
12
|
+
const {
|
|
13
|
+
config
|
|
14
|
+
} = schedulerData;
|
|
15
|
+
const content = `+${number} more`;
|
|
16
|
+
return /*#__PURE__*/_jsx("button", {
|
|
21
17
|
type: "button",
|
|
22
18
|
className: "timeline-event",
|
|
23
19
|
style: {
|
|
24
|
-
left
|
|
25
|
-
width
|
|
26
|
-
top
|
|
20
|
+
left,
|
|
21
|
+
width,
|
|
22
|
+
top
|
|
27
23
|
},
|
|
28
|
-
onClick:
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
24
|
+
onClick: () => clickAction(headerItem),
|
|
25
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
32
26
|
style: {
|
|
33
27
|
height: config.eventItemHeight,
|
|
34
28
|
color: '#999',
|
|
@@ -39,12 +33,12 @@ function AddMore(_ref) {
|
|
|
39
33
|
});
|
|
40
34
|
}
|
|
41
35
|
AddMore.propTypes = {
|
|
42
|
-
schedulerData:
|
|
43
|
-
number:
|
|
44
|
-
left:
|
|
45
|
-
width:
|
|
46
|
-
top:
|
|
47
|
-
clickAction:
|
|
48
|
-
headerItem:
|
|
36
|
+
schedulerData: PropTypes.object.isRequired,
|
|
37
|
+
number: PropTypes.number.isRequired,
|
|
38
|
+
left: PropTypes.number.isRequired,
|
|
39
|
+
width: PropTypes.number.isRequired,
|
|
40
|
+
top: PropTypes.number.isRequired,
|
|
41
|
+
clickAction: PropTypes.func.isRequired,
|
|
42
|
+
headerItem: PropTypes.object.isRequired
|
|
49
43
|
};
|
|
50
|
-
|
|
44
|
+
export default AddMore;
|
|
@@ -1,58 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _icons = require("@ant-design/icons");
|
|
9
|
-
var _antd = require("antd");
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _react = require("react");
|
|
12
|
-
var _DnDSource = _interopRequireDefault(require("./DnDSource"));
|
|
13
|
-
var _EventItem = _interopRequireDefault(require("./EventItem"));
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
|
-
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; }
|
|
17
|
-
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; }
|
|
18
|
-
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; }
|
|
19
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
20
|
-
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); }
|
|
21
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
22
|
-
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."); }
|
|
23
|
-
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; } }
|
|
24
|
-
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; }
|
|
25
|
-
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; } }
|
|
26
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
1
|
+
import { CloseOutlined } from '@ant-design/icons';
|
|
2
|
+
import { Col, Row } from 'antd';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { useState, createElement as _createElement } from 'react';
|
|
5
|
+
import DnDSource from './DnDSource';
|
|
6
|
+
import EventItem from './EventItem';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
8
|
function AddMorePopover(props) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
9
|
+
const {
|
|
10
|
+
schedulerData,
|
|
11
|
+
headerItem,
|
|
12
|
+
left,
|
|
13
|
+
top,
|
|
14
|
+
height,
|
|
15
|
+
closeAction
|
|
16
|
+
} = props;
|
|
17
|
+
const {
|
|
18
|
+
config,
|
|
19
|
+
localeDayjs
|
|
20
|
+
} = schedulerData;
|
|
21
|
+
const {
|
|
22
|
+
time,
|
|
23
|
+
start,
|
|
24
|
+
end,
|
|
25
|
+
events
|
|
26
|
+
} = headerItem;
|
|
27
|
+
const [dndSource] = useState(new DnDSource(p => p.eventItem, schedulerData.config.dragAndDropEnabled));
|
|
28
|
+
const header = localeDayjs(new Date(time)).format(config.addMorePopoverHeaderFormat);
|
|
29
|
+
const durationStart = localeDayjs(new Date(start));
|
|
30
|
+
const durationEnd = localeDayjs(end);
|
|
31
|
+
const eventList = events.map((evt, i) => {
|
|
49
32
|
if (evt !== undefined) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return /*#__PURE__*/(
|
|
33
|
+
const eventStart = localeDayjs(evt.eventItem.start);
|
|
34
|
+
const eventEnd = localeDayjs(evt.eventItem.end);
|
|
35
|
+
const isStart = eventStart >= durationStart;
|
|
36
|
+
const isEnd = eventEnd < durationEnd;
|
|
37
|
+
const eventItemTop = 12 + (i + 1) * config.eventItemLineHeight;
|
|
38
|
+
return /*#__PURE__*/_createElement(EventItem, {
|
|
39
|
+
...props,
|
|
56
40
|
key: evt.eventItem.id,
|
|
57
41
|
eventItem: evt.eventItem,
|
|
58
42
|
dndSource: dndSource,
|
|
@@ -64,54 +48,52 @@ function AddMorePopover(props) {
|
|
|
64
48
|
left: 10,
|
|
65
49
|
width: 138,
|
|
66
50
|
top: eventItemTop
|
|
67
|
-
})
|
|
51
|
+
});
|
|
68
52
|
}
|
|
69
53
|
return null;
|
|
70
54
|
});
|
|
71
|
-
return /*#__PURE__*/(
|
|
55
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
72
56
|
className: "rbs-add-more-popover-overlay",
|
|
73
57
|
style: {
|
|
74
|
-
left
|
|
75
|
-
top
|
|
76
|
-
height
|
|
58
|
+
left,
|
|
59
|
+
top,
|
|
60
|
+
height,
|
|
77
61
|
minWidth: '170px'
|
|
78
62
|
},
|
|
79
|
-
children: [/*#__PURE__*/(
|
|
63
|
+
children: [/*#__PURE__*/_jsxs(Row, {
|
|
80
64
|
justify: "space-between",
|
|
81
65
|
align: "middle",
|
|
82
|
-
children: [/*#__PURE__*/(
|
|
66
|
+
children: [/*#__PURE__*/_jsx(Col, {
|
|
83
67
|
span: 22,
|
|
84
|
-
children: /*#__PURE__*/(
|
|
68
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
85
69
|
className: "base-text",
|
|
86
70
|
children: header
|
|
87
71
|
})
|
|
88
|
-
}), /*#__PURE__*/(
|
|
72
|
+
}), /*#__PURE__*/_jsx(Col, {
|
|
89
73
|
span: 2,
|
|
90
|
-
children: /*#__PURE__*/(
|
|
74
|
+
children: /*#__PURE__*/_jsx("button", {
|
|
91
75
|
type: "button",
|
|
92
|
-
onClick:
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.CloseOutlined, {})
|
|
76
|
+
onClick: () => closeAction(undefined),
|
|
77
|
+
children: /*#__PURE__*/_jsx(CloseOutlined, {})
|
|
96
78
|
})
|
|
97
79
|
})]
|
|
98
|
-
}), eventList
|
|
80
|
+
}), eventList?.filter(Boolean)]
|
|
99
81
|
});
|
|
100
82
|
}
|
|
101
83
|
AddMorePopover.propTypes = {
|
|
102
|
-
schedulerData:
|
|
103
|
-
headerItem:
|
|
104
|
-
left:
|
|
105
|
-
top:
|
|
106
|
-
height:
|
|
107
|
-
closeAction:
|
|
108
|
-
subtitleGetter:
|
|
109
|
-
moveEvent:
|
|
110
|
-
eventItemClick:
|
|
111
|
-
viewEventClick:
|
|
112
|
-
viewEventText:
|
|
113
|
-
viewEvent2Click:
|
|
114
|
-
viewEvent2Text:
|
|
115
|
-
eventItemTemplateResolver:
|
|
84
|
+
schedulerData: PropTypes.object.isRequired,
|
|
85
|
+
headerItem: PropTypes.object.isRequired,
|
|
86
|
+
left: PropTypes.number.isRequired,
|
|
87
|
+
top: PropTypes.number.isRequired,
|
|
88
|
+
height: PropTypes.number.isRequired,
|
|
89
|
+
closeAction: PropTypes.func.isRequired,
|
|
90
|
+
subtitleGetter: PropTypes.func,
|
|
91
|
+
moveEvent: PropTypes.func,
|
|
92
|
+
eventItemClick: PropTypes.func,
|
|
93
|
+
viewEventClick: PropTypes.func,
|
|
94
|
+
viewEventText: PropTypes.string,
|
|
95
|
+
viewEvent2Click: PropTypes.func,
|
|
96
|
+
viewEvent2Text: PropTypes.string,
|
|
97
|
+
eventItemTemplateResolver: PropTypes.func
|
|
116
98
|
};
|
|
117
|
-
|
|
99
|
+
export default AddMorePopover;
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _antd = require("antd");
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _EventItemPopover = _interopRequireDefault(require("./EventItemPopover"));
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
|
-
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; }
|
|
16
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
-
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); }
|
|
1
|
+
import { Popover } from 'antd';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import EventItemPopover from './EventItemPopover';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
5
|
function AgendaEventItem(props) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
const {
|
|
7
|
+
eventItem,
|
|
8
|
+
isStart,
|
|
9
|
+
isEnd,
|
|
10
|
+
eventItemClick,
|
|
11
|
+
schedulerData,
|
|
12
|
+
eventItemTemplateResolver
|
|
13
|
+
} = props;
|
|
14
|
+
const {
|
|
15
|
+
config,
|
|
16
|
+
behaviors
|
|
17
|
+
} = schedulerData;
|
|
18
|
+
let roundCls = 'round-none';
|
|
28
19
|
if (isStart && isEnd) {
|
|
29
20
|
roundCls = 'round-all';
|
|
30
21
|
} else if (isStart) {
|
|
@@ -32,20 +23,20 @@ function AgendaEventItem(props) {
|
|
|
32
23
|
} else if (isEnd) {
|
|
33
24
|
roundCls = 'round-tail';
|
|
34
25
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
const backgroundColor = eventItem.bgColor || config.defaultEventBgColor;
|
|
27
|
+
const titleText = behaviors.getEventTextFunc(schedulerData, eventItem);
|
|
28
|
+
const eventItemStyle = {
|
|
38
29
|
height: config.eventItemHeight,
|
|
39
30
|
maxWidth: config.agendaMaxEventWidth,
|
|
40
|
-
backgroundColor
|
|
31
|
+
backgroundColor
|
|
41
32
|
};
|
|
42
|
-
|
|
43
|
-
className:
|
|
33
|
+
let eventItemTemplate = /*#__PURE__*/_jsx("div", {
|
|
34
|
+
className: `${roundCls} event-item`,
|
|
44
35
|
style: eventItemStyle,
|
|
45
|
-
children: /*#__PURE__*/(
|
|
36
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
46
37
|
style: {
|
|
47
38
|
marginLeft: '10px',
|
|
48
|
-
lineHeight:
|
|
39
|
+
lineHeight: `${config.eventItemHeight}px`
|
|
49
40
|
},
|
|
50
41
|
children: titleText
|
|
51
42
|
})
|
|
@@ -53,42 +44,41 @@ function AgendaEventItem(props) {
|
|
|
53
44
|
if (eventItemTemplateResolver) {
|
|
54
45
|
eventItemTemplate = eventItemTemplateResolver(schedulerData, eventItem, backgroundColor, isStart, isEnd, 'event-item', config.eventItemHeight, config.agendaMaxEventWidth);
|
|
55
46
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
var eventLink = /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
47
|
+
const handleClick = () => eventItemClick?.(schedulerData, eventItem);
|
|
48
|
+
const eventLink = /*#__PURE__*/_jsx("button", {
|
|
60
49
|
type: "button",
|
|
61
50
|
className: "day-event rbs-txt-btn-dis",
|
|
62
51
|
onClick: handleClick,
|
|
63
52
|
children: eventItemTemplate
|
|
64
53
|
});
|
|
65
|
-
|
|
54
|
+
const content = /*#__PURE__*/_jsx(EventItemPopover, {
|
|
55
|
+
...props,
|
|
66
56
|
title: eventItem.title,
|
|
67
57
|
startTime: eventItem.start,
|
|
68
58
|
endTime: eventItem.end,
|
|
69
59
|
statusColor: backgroundColor
|
|
70
|
-
})
|
|
71
|
-
return config.eventItemPopoverEnabled ? /*#__PURE__*/(
|
|
60
|
+
});
|
|
61
|
+
return config.eventItemPopoverEnabled ? /*#__PURE__*/_jsx(Popover, {
|
|
72
62
|
placement: "bottomLeft",
|
|
73
63
|
content: content,
|
|
74
64
|
trigger: "hover",
|
|
75
65
|
overlayClassName: "scheduler-agenda-event-popover",
|
|
76
66
|
children: eventLink
|
|
77
|
-
}) : /*#__PURE__*/(
|
|
67
|
+
}) : /*#__PURE__*/_jsx("span", {
|
|
78
68
|
children: eventLink
|
|
79
69
|
});
|
|
80
70
|
}
|
|
81
71
|
AgendaEventItem.propTypes = {
|
|
82
|
-
schedulerData:
|
|
83
|
-
eventItem:
|
|
84
|
-
isStart:
|
|
85
|
-
isEnd:
|
|
86
|
-
subtitleGetter:
|
|
87
|
-
eventItemClick:
|
|
88
|
-
viewEventClick:
|
|
89
|
-
viewEventText:
|
|
90
|
-
viewEvent2Click:
|
|
91
|
-
viewEvent2Text:
|
|
92
|
-
eventItemTemplateResolver:
|
|
72
|
+
schedulerData: PropTypes.object.isRequired,
|
|
73
|
+
eventItem: PropTypes.object.isRequired,
|
|
74
|
+
isStart: PropTypes.bool.isRequired,
|
|
75
|
+
isEnd: PropTypes.bool.isRequired,
|
|
76
|
+
subtitleGetter: PropTypes.func,
|
|
77
|
+
eventItemClick: PropTypes.func,
|
|
78
|
+
viewEventClick: PropTypes.func,
|
|
79
|
+
viewEventText: PropTypes.string,
|
|
80
|
+
viewEvent2Click: PropTypes.func,
|
|
81
|
+
viewEvent2Text: PropTypes.string,
|
|
82
|
+
eventItemTemplateResolver: PropTypes.func
|
|
93
83
|
};
|
|
94
|
-
|
|
84
|
+
export default AgendaEventItem;
|
|
@@ -1,86 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
var _AgendaEventItem = _interopRequireDefault(require("./AgendaEventItem"));
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
|
-
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; }
|
|
16
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
-
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); }
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import AgendaEventItem from './AgendaEventItem';
|
|
3
|
+
import { createElement as _createElement } from "react";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
5
|
function AgendaResourceEvents(props) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
6
|
+
const {
|
|
7
|
+
schedulerData,
|
|
8
|
+
resourceEvents,
|
|
9
|
+
slotClickedFunc,
|
|
10
|
+
slotItemTemplateResolver
|
|
11
|
+
} = props;
|
|
12
|
+
const {
|
|
13
|
+
startDate,
|
|
14
|
+
endDate,
|
|
15
|
+
config,
|
|
16
|
+
localeDayjs
|
|
17
|
+
} = schedulerData;
|
|
18
|
+
const width = schedulerData.getResourceTableWidth() - 2;
|
|
19
|
+
const events = resourceEvents.headerItems.flatMap(item => {
|
|
20
|
+
const start = localeDayjs(new Date(startDate));
|
|
21
|
+
const end = localeDayjs(endDate).add(1, 'days');
|
|
22
|
+
const headerStart = localeDayjs(new Date(item.start));
|
|
23
|
+
const headerEnd = localeDayjs(new Date(item.end));
|
|
33
24
|
if (start === headerStart && end === headerEnd) {
|
|
34
|
-
return item.events.map(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return /*#__PURE__*/(
|
|
25
|
+
return item.events.map(evt => {
|
|
26
|
+
const durationStart = localeDayjs(new Date(startDate));
|
|
27
|
+
const durationEnd = localeDayjs(endDate).add(1, 'days');
|
|
28
|
+
const eventStart = localeDayjs(evt.eventItem.start);
|
|
29
|
+
const eventEnd = localeDayjs(evt.eventItem.end);
|
|
30
|
+
const isStart = eventStart >= durationStart;
|
|
31
|
+
const isEnd = eventEnd < durationEnd;
|
|
32
|
+
return /*#__PURE__*/_createElement(AgendaEventItem, {
|
|
33
|
+
...props,
|
|
42
34
|
key: evt.eventItem.id,
|
|
43
35
|
eventItem: evt.eventItem,
|
|
44
36
|
isStart: isStart,
|
|
45
37
|
isEnd: isEnd
|
|
46
|
-
})
|
|
38
|
+
});
|
|
47
39
|
});
|
|
48
40
|
}
|
|
49
41
|
return [];
|
|
50
42
|
});
|
|
51
|
-
|
|
43
|
+
const slotItemContent = slotClickedFunc ? /*#__PURE__*/_jsx("button", {
|
|
52
44
|
className: "rbs-txt-btn-dis",
|
|
53
45
|
type: "button",
|
|
54
|
-
onClick:
|
|
55
|
-
return slotClickedFunc(schedulerData, resourceEvents);
|
|
56
|
-
},
|
|
46
|
+
onClick: () => slotClickedFunc(schedulerData, resourceEvents),
|
|
57
47
|
children: resourceEvents.slotName
|
|
58
|
-
}) : /*#__PURE__*/(
|
|
48
|
+
}) : /*#__PURE__*/_jsx("span", {
|
|
59
49
|
children: resourceEvents.slotName
|
|
60
50
|
});
|
|
61
|
-
|
|
51
|
+
let slotItem = /*#__PURE__*/_jsx("div", {
|
|
62
52
|
style: {
|
|
63
|
-
width
|
|
53
|
+
width
|
|
64
54
|
},
|
|
65
55
|
title: resourceEvents.slotTitle || resourceEvents.slotName,
|
|
66
56
|
className: "overflow-text header2-text",
|
|
67
57
|
children: slotItemContent
|
|
68
58
|
});
|
|
69
59
|
if (slotItemTemplateResolver) {
|
|
70
|
-
|
|
60
|
+
const temp = slotItemTemplateResolver(schedulerData, resourceEvents, slotClickedFunc, width, 'overflow-text header2-text');
|
|
71
61
|
if (temp) {
|
|
72
62
|
slotItem = temp;
|
|
73
63
|
}
|
|
74
64
|
}
|
|
75
|
-
return /*#__PURE__*/(
|
|
65
|
+
return /*#__PURE__*/_jsxs("tr", {
|
|
76
66
|
style: {
|
|
77
67
|
minHeight: config.eventItemLineHeight + 2
|
|
78
68
|
},
|
|
79
|
-
children: [/*#__PURE__*/(
|
|
69
|
+
children: [/*#__PURE__*/_jsx("td", {
|
|
80
70
|
"data-resource-id": resourceEvents.slotId,
|
|
81
71
|
children: slotItem
|
|
82
|
-
}), /*#__PURE__*/(
|
|
83
|
-
children: /*#__PURE__*/(
|
|
72
|
+
}), /*#__PURE__*/_jsx("td", {
|
|
73
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
84
74
|
className: "day-event-container",
|
|
85
75
|
children: events
|
|
86
76
|
})
|
|
@@ -88,17 +78,17 @@ function AgendaResourceEvents(props) {
|
|
|
88
78
|
});
|
|
89
79
|
}
|
|
90
80
|
AgendaResourceEvents.propTypes = {
|
|
91
|
-
schedulerData:
|
|
92
|
-
resourceEvents:
|
|
93
|
-
subtitleGetter:
|
|
94
|
-
eventItemClick:
|
|
95
|
-
viewEventClick:
|
|
96
|
-
viewEventText:
|
|
97
|
-
viewEvent2Click:
|
|
98
|
-
viewEvent2Text:
|
|
99
|
-
slotClickedFunc:
|
|
100
|
-
slotItemTemplateResolver:
|
|
101
|
-
eventItemTemplateResolver:
|
|
102
|
-
eventItemPopoverTemplateResolver:
|
|
81
|
+
schedulerData: PropTypes.object.isRequired,
|
|
82
|
+
resourceEvents: PropTypes.object.isRequired,
|
|
83
|
+
subtitleGetter: PropTypes.func,
|
|
84
|
+
eventItemClick: PropTypes.func,
|
|
85
|
+
viewEventClick: PropTypes.func,
|
|
86
|
+
viewEventText: PropTypes.string,
|
|
87
|
+
viewEvent2Click: PropTypes.func,
|
|
88
|
+
viewEvent2Text: PropTypes.string,
|
|
89
|
+
slotClickedFunc: PropTypes.func,
|
|
90
|
+
slotItemTemplateResolver: PropTypes.func,
|
|
91
|
+
eventItemTemplateResolver: PropTypes.func,
|
|
92
|
+
eventItemPopoverTemplateResolver: PropTypes.func
|
|
103
93
|
};
|
|
104
|
-
|
|
94
|
+
export default AgendaResourceEvents;
|