react-big-schedule 5.5.2-beta.5 → 6.1.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.
@@ -1,58 +1,55 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
8
- var _AgendaResourceEvents = _interopRequireDefault(require("./AgendaResourceEvents"));
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
1
+ import PropTypes from 'prop-types';
2
+ import AgendaResourceEvents from './AgendaResourceEvents';
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
4
  function AgendaView(props) {
12
- var schedulerData = props.schedulerData;
13
- var config = schedulerData.config,
14
- renderData = schedulerData.renderData;
15
- var agendaResourceTableWidth = schedulerData.getResourceTableWidth();
16
- var tableHeaderHeight = schedulerData.getTableHeaderHeight();
17
- var resourceName = schedulerData.isEventPerspective ? config.taskName : config.resourceName;
18
- var agendaViewHeader = config.agendaViewHeader;
19
- var resourceEventsList = renderData.map(function (item) {
20
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AgendaResourceEvents["default"], {
21
- resourceEvents: item,
22
- schedulerData: schedulerData,
23
- subtitleGetter: props.subtitleGetter,
24
- eventItemClick: props.eventItemClick,
25
- viewEventClick: props.viewEventClick,
26
- viewEventText: props.viewEventText,
27
- viewEvent2Click: props.viewEvent2Click,
28
- viewEvent2Text: props.viewEvent2Text,
29
- slotClickedFunc: props.slotClickedFunc,
30
- slotItemTemplateResolver: props.slotItemTemplateResolver,
31
- eventItemTemplateResolver: props.eventItemTemplateResolver,
32
- eventItemPopoverTemplateResolver: props.eventItemPopoverTemplateResolver
33
- }, item.slotId);
34
- });
35
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("tr", {
36
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
37
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("table", {
5
+ const {
6
+ schedulerData
7
+ } = props;
8
+ const {
9
+ config,
10
+ renderData
11
+ } = schedulerData;
12
+ const agendaResourceTableWidth = schedulerData.getResourceTableWidth();
13
+ const tableHeaderHeight = schedulerData.getTableHeaderHeight();
14
+ const resourceName = schedulerData.isEventPerspective ? config.taskName : config.resourceName;
15
+ const {
16
+ agendaViewHeader
17
+ } = config;
18
+ const resourceEventsList = renderData.map(item => /*#__PURE__*/_jsx(AgendaResourceEvents, {
19
+ resourceEvents: item,
20
+ schedulerData: schedulerData,
21
+ subtitleGetter: props.subtitleGetter,
22
+ eventItemClick: props.eventItemClick,
23
+ viewEventClick: props.viewEventClick,
24
+ viewEventText: props.viewEventText,
25
+ viewEvent2Click: props.viewEvent2Click,
26
+ viewEvent2Text: props.viewEvent2Text,
27
+ slotClickedFunc: props.slotClickedFunc,
28
+ slotItemTemplateResolver: props.slotItemTemplateResolver,
29
+ eventItemTemplateResolver: props.eventItemTemplateResolver,
30
+ eventItemPopoverTemplateResolver: props.eventItemPopoverTemplateResolver
31
+ }, item.slotId));
32
+ return /*#__PURE__*/_jsx("tr", {
33
+ children: /*#__PURE__*/_jsx("td", {
34
+ children: /*#__PURE__*/_jsxs("table", {
38
35
  className: "scheduler-table",
39
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
40
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("tr", {
36
+ children: [/*#__PURE__*/_jsx("thead", {
37
+ children: /*#__PURE__*/_jsxs("tr", {
41
38
  style: {
42
39
  height: tableHeaderHeight
43
40
  },
44
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
41
+ children: [/*#__PURE__*/_jsx("th", {
45
42
  style: {
46
43
  width: agendaResourceTableWidth
47
44
  },
48
45
  className: "header3-text",
49
46
  children: resourceName
50
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
47
+ }), /*#__PURE__*/_jsx("th", {
51
48
  className: "header3-text",
52
49
  children: agendaViewHeader
53
50
  })]
54
51
  })
55
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
52
+ }), /*#__PURE__*/_jsx("tbody", {
56
53
  children: resourceEventsList
57
54
  })]
58
55
  })
@@ -60,16 +57,16 @@ function AgendaView(props) {
60
57
  });
61
58
  }
62
59
  AgendaView.propTypes = {
63
- schedulerData: _propTypes["default"].object.isRequired,
64
- subtitleGetter: _propTypes["default"].func,
65
- eventItemClick: _propTypes["default"].func,
66
- viewEventClick: _propTypes["default"].func,
67
- viewEventText: _propTypes["default"].string,
68
- viewEvent2Click: _propTypes["default"].func,
69
- viewEvent2Text: _propTypes["default"].string,
70
- slotClickedFunc: _propTypes["default"].func,
71
- slotItemTemplateResolver: _propTypes["default"].func,
72
- eventItemTemplateResolver: _propTypes["default"].func,
73
- eventItemPopoverTemplateResolver: _propTypes["default"].func
60
+ schedulerData: PropTypes.object.isRequired,
61
+ subtitleGetter: PropTypes.func,
62
+ eventItemClick: PropTypes.func,
63
+ viewEventClick: PropTypes.func,
64
+ viewEventText: PropTypes.string,
65
+ viewEvent2Click: PropTypes.func,
66
+ viewEvent2Text: PropTypes.string,
67
+ slotClickedFunc: PropTypes.func,
68
+ slotItemTemplateResolver: PropTypes.func,
69
+ eventItemTemplateResolver: PropTypes.func,
70
+ eventItemPopoverTemplateResolver: PropTypes.func
74
71
  };
75
- var _default = exports["default"] = AgendaView;
72
+ export default AgendaView;
@@ -1,30 +1,25 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
8
- var _react = _interopRequireDefault(require("react"));
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
- function BodyView(_ref) {
12
- var schedulerData = _ref.schedulerData;
13
- var renderData = schedulerData.renderData,
14
- headers = schedulerData.headers,
15
- config = schedulerData.config,
16
- behaviors = schedulerData.behaviors;
17
- var width = schedulerData.getContentCellWidth();
18
- var tableRows = renderData.filter(function (o) {
19
- return o.render;
20
- }).map(function (_ref2) {
21
- var slotId = _ref2.slotId,
22
- groupOnly = _ref2.groupOnly,
23
- rowHeight = _ref2.rowHeight;
24
- var rowCells = headers.map(function (header, index) {
25
- var key = "".concat(slotId, "_").concat(header.time);
26
- var style = index === headers.length - 1 ? {} : {
27
- width: width
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ function BodyView({
5
+ schedulerData
6
+ }) {
7
+ const {
8
+ renderData,
9
+ headers,
10
+ config,
11
+ behaviors
12
+ } = schedulerData;
13
+ const width = schedulerData.getContentCellWidth();
14
+ const tableRows = renderData.filter(o => o.render).map(({
15
+ slotId,
16
+ groupOnly,
17
+ rowHeight
18
+ }) => {
19
+ const rowCells = headers.map((header, index) => {
20
+ const key = `${slotId}_${header.time}`;
21
+ const style = index === headers.length - 1 ? {} : {
22
+ width
28
23
  };
29
24
  if (header.nonWorkingTime) {
30
25
  style.backgroundColor = config.nonWorkingTimeBodyBgColor;
@@ -33,29 +28,29 @@ function BodyView(_ref) {
33
28
  style.backgroundColor = config.groupOnlySlotColor;
34
29
  }
35
30
  if (behaviors.getNonAgendaViewBodyCellBgColorFunc) {
36
- var cellBgColor = behaviors.getNonAgendaViewBodyCellBgColorFunc(schedulerData, slotId, header);
31
+ const cellBgColor = behaviors.getNonAgendaViewBodyCellBgColorFunc(schedulerData, slotId, header);
37
32
  if (cellBgColor) {
38
33
  style.backgroundColor = cellBgColor;
39
34
  }
40
35
  }
41
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
36
+ return /*#__PURE__*/_jsx("td", {
42
37
  style: style,
43
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {})
38
+ children: /*#__PURE__*/_jsx("div", {})
44
39
  }, key);
45
40
  });
46
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("tr", {
41
+ return /*#__PURE__*/_jsx("tr", {
47
42
  style: {
48
43
  height: rowHeight
49
44
  },
50
45
  children: rowCells
51
46
  }, slotId);
52
47
  });
53
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
48
+ return /*#__PURE__*/_jsx("tbody", {
54
49
  children: tableRows
55
50
  });
56
51
  }
57
52
  BodyView.propTypes = {
58
- schedulerData: _propTypes["default"].object.isRequired,
59
- schedulerDataVersion: _propTypes["default"].number
53
+ schedulerData: PropTypes.object.isRequired,
54
+ schedulerDataVersion: PropTypes.number
60
55
  };
61
- var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(BodyView);
56
+ export default /*#__PURE__*/React.memo(BodyView);
@@ -1,171 +1,156 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _default = require("../config/default");
8
- var _utility = require("../helper/utility");
9
- 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); }
10
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
11
- 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."); }
12
- 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; } }
13
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
14
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
15
- 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; }
16
- 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); } }
17
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
18
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
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; }
20
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
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
- var DnDContext = exports["default"] = /*#__PURE__*/_createClass(function DnDContext(sources) {
23
- var _this = this;
24
- _classCallCheck(this, DnDContext);
25
- _defineProperty(this, "extractInitialTimes", function (monitor, pos, cellWidth, resourceEvents, cellUnit, localeDayjs) {
26
- var initialPoint = monitor.getInitialClientOffset();
27
- var initialLeftIndex = Math.floor((initialPoint.x - pos.x) / cellWidth);
28
- var initialStart = resourceEvents.headerItems[initialLeftIndex].start;
29
- var initialEnd = resourceEvents.headerItems[initialLeftIndex].end;
30
- if (cellUnit !== _default.CellUnit.Hour) {
31
- var end = localeDayjs(new Date(initialStart)).hour(23).minute(59).second(59);
32
- initialEnd = end.format(_default.DATETIME_FORMAT);
1
+ import { CellUnit, DATETIME_FORMAT, DnDTypes, ViewType } from '../config/default';
2
+ import { getPos } from '../helper/utility';
3
+ export default class DnDContext {
4
+ constructor(sources) {
5
+ this.sourceMap = new Map();
6
+ sources.forEach(item => {
7
+ this.sourceMap.set(item.dndType, item);
8
+ });
9
+ }
10
+ extractInitialTimes = (monitor, pos, cellWidth, resourceEvents, cellUnit, localeDayjs) => {
11
+ const initialPoint = monitor.getInitialClientOffset();
12
+ const initialLeftIndex = Math.floor((initialPoint.x - pos.x) / cellWidth);
13
+ const initialStart = resourceEvents.headerItems[initialLeftIndex].start;
14
+ let initialEnd = resourceEvents.headerItems[initialLeftIndex].end;
15
+ if (cellUnit !== CellUnit.Hour) {
16
+ const end = localeDayjs(new Date(initialStart)).hour(23).minute(59).second(59);
17
+ initialEnd = end.format(DATETIME_FORMAT);
33
18
  }
34
19
  return {
35
- initialStart: initialStart,
36
- initialEnd: initialEnd
20
+ initialStart,
21
+ initialEnd
37
22
  };
38
- });
39
- _defineProperty(this, "getDropSpec", function () {
40
- return {
41
- drop: function drop(props, monitor, component) {
42
- var schedulerData = props.schedulerData,
43
- resourceEvents = props.resourceEvents;
44
- var cellUnit = schedulerData.cellUnit,
45
- localeDayjs = schedulerData.localeDayjs;
46
- var type = monitor.getItemType();
47
- var pos = (0, _utility.getPos)(component.eventContainer);
48
- var cellWidth = schedulerData.getContentCellWidth();
49
- var initialStartTime = null;
50
- var initialEndTime = null;
51
- if (type === _default.DnDTypes.EVENT) {
52
- var _this$extractInitialT = _this.extractInitialTimes(monitor, pos, cellWidth, resourceEvents, cellUnit, localeDayjs),
53
- initialStart = _this$extractInitialT.initialStart,
54
- initialEnd = _this$extractInitialT.initialEnd;
55
- initialStartTime = initialStart;
56
- initialEndTime = initialEnd;
57
- }
58
- var point = monitor.getClientOffset();
59
- var leftIndex = Math.floor((point.x - pos.x) / cellWidth);
60
- var startTime = resourceEvents.headerItems[leftIndex].start;
61
- var endTime = resourceEvents.headerItems[leftIndex].end;
62
- if (cellUnit !== _default.CellUnit.Hour) {
63
- endTime = localeDayjs(new Date(resourceEvents.headerItems[leftIndex].start)).hour(23).minute(59).second(59).format(_default.DATETIME_FORMAT);
64
- }
65
- return {
66
- slotId: resourceEvents.slotId,
67
- slotName: resourceEvents.slotName,
68
- start: startTime,
69
- end: endTime,
70
- initialStart: initialStartTime,
71
- initialEnd: initialEndTime
72
- };
73
- },
74
- hover: function hover(props, monitor, component) {
75
- var schedulerData = props.schedulerData,
76
- resourceEvents = props.resourceEvents,
77
- movingEvent = props.movingEvent;
78
- var cellUnit = schedulerData.cellUnit,
79
- config = schedulerData.config,
80
- viewType = schedulerData.viewType,
81
- localeDayjs = schedulerData.localeDayjs;
82
- _this.config = config;
83
- var item = monitor.getItem();
84
- var type = monitor.getItemType();
85
- var pos = (0, _utility.getPos)(component.eventContainer);
86
- var cellWidth = schedulerData.getContentCellWidth();
87
- var initialStart = null;
88
- if (type === _default.DnDTypes.EVENT) {
89
- var _this$extractInitialT2 = _this.extractInitialTimes(monitor, pos, cellWidth, resourceEvents, cellUnit, localeDayjs),
90
- iStart = _this$extractInitialT2.initialStart;
91
- initialStart = iStart;
92
- }
93
- var point = monitor.getClientOffset();
94
- var leftIndex = Math.floor((point.x - pos.x) / cellWidth);
95
- if (!resourceEvents.headerItems[leftIndex]) {
96
- return;
97
- }
98
- var newStart = resourceEvents.headerItems[leftIndex].start;
99
- var newEnd = resourceEvents.headerItems[leftIndex].end;
100
- if (cellUnit !== _default.CellUnit.Hour) {
101
- newEnd = localeDayjs(new Date(resourceEvents.headerItems[leftIndex].start)).hour(23).minute(59).second(59).format(_default.DATETIME_FORMAT);
23
+ };
24
+ getDropSpec = () => ({
25
+ drop: (props, monitor, component) => {
26
+ const {
27
+ schedulerData,
28
+ resourceEvents
29
+ } = props;
30
+ const {
31
+ cellUnit,
32
+ localeDayjs
33
+ } = schedulerData;
34
+ const type = monitor.getItemType();
35
+ const pos = getPos(component.eventContainer);
36
+ const cellWidth = schedulerData.getContentCellWidth();
37
+ let initialStartTime = null;
38
+ let initialEndTime = null;
39
+ if (type === DnDTypes.EVENT) {
40
+ const {
41
+ initialStart,
42
+ initialEnd
43
+ } = this.extractInitialTimes(monitor, pos, cellWidth, resourceEvents, cellUnit, localeDayjs);
44
+ initialStartTime = initialStart;
45
+ initialEndTime = initialEnd;
46
+ }
47
+ const point = monitor.getClientOffset();
48
+ const leftIndex = Math.floor((point.x - pos.x) / cellWidth);
49
+ const startTime = resourceEvents.headerItems[leftIndex].start;
50
+ let endTime = resourceEvents.headerItems[leftIndex].end;
51
+ if (cellUnit !== CellUnit.Hour) {
52
+ endTime = localeDayjs(new Date(resourceEvents.headerItems[leftIndex].start)).hour(23).minute(59).second(59).format(DATETIME_FORMAT);
53
+ }
54
+ return {
55
+ slotId: resourceEvents.slotId,
56
+ slotName: resourceEvents.slotName,
57
+ start: startTime,
58
+ end: endTime,
59
+ initialStart: initialStartTime,
60
+ initialEnd: initialEndTime
61
+ };
62
+ },
63
+ hover: (props, monitor, component) => {
64
+ const {
65
+ schedulerData,
66
+ resourceEvents,
67
+ movingEvent
68
+ } = props;
69
+ const {
70
+ cellUnit,
71
+ config,
72
+ viewType,
73
+ localeDayjs
74
+ } = schedulerData;
75
+ this.config = config;
76
+ const item = monitor.getItem();
77
+ const type = monitor.getItemType();
78
+ const pos = getPos(component.eventContainer);
79
+ const cellWidth = schedulerData.getContentCellWidth();
80
+ let initialStart = null;
81
+ if (type === DnDTypes.EVENT) {
82
+ const {
83
+ initialStart: iStart
84
+ } = this.extractInitialTimes(monitor, pos, cellWidth, resourceEvents, cellUnit, localeDayjs);
85
+ initialStart = iStart;
86
+ }
87
+ const point = monitor.getClientOffset();
88
+ const leftIndex = Math.floor((point.x - pos.x) / cellWidth);
89
+ if (!resourceEvents.headerItems[leftIndex]) {
90
+ return;
91
+ }
92
+ let newStart = resourceEvents.headerItems[leftIndex].start;
93
+ let newEnd = resourceEvents.headerItems[leftIndex].end;
94
+ if (cellUnit !== CellUnit.Hour) {
95
+ newEnd = localeDayjs(new Date(resourceEvents.headerItems[leftIndex].start)).hour(23).minute(59).second(59).format(DATETIME_FORMAT);
96
+ }
97
+ let {
98
+ slotId,
99
+ slotName
100
+ } = resourceEvents;
101
+ let action = 'New';
102
+ const isEvent = type === DnDTypes.EVENT;
103
+ if (isEvent) {
104
+ const event = item;
105
+ if (config.relativeMove) {
106
+ newStart = localeDayjs(event.start).add(localeDayjs(newStart).diff(localeDayjs(new Date(initialStart))), 'ms').format(DATETIME_FORMAT);
107
+ } else if (viewType !== ViewType.Day) {
108
+ const tmpDayjs = localeDayjs(newStart);
109
+ newStart = localeDayjs(event.start).year(tmpDayjs.year()).month(tmpDayjs.month()).date(tmpDayjs.date()).format(DATETIME_FORMAT);
102
110
  }
103
- var slotId = resourceEvents.slotId,
104
- slotName = resourceEvents.slotName;
105
- var action = 'New';
106
- var isEvent = type === _default.DnDTypes.EVENT;
107
- if (isEvent) {
108
- var event = item;
109
- if (config.relativeMove) {
110
- newStart = localeDayjs(event.start).add(localeDayjs(newStart).diff(localeDayjs(new Date(initialStart))), 'ms').format(_default.DATETIME_FORMAT);
111
- } else if (viewType !== _default.ViewType.Day) {
112
- var tmpDayjs = localeDayjs(newStart);
113
- newStart = localeDayjs(event.start).year(tmpDayjs.year()).month(tmpDayjs.month()).date(tmpDayjs.date()).format(_default.DATETIME_FORMAT);
114
- }
115
- newEnd = localeDayjs(newStart).add(localeDayjs(event.end).diff(localeDayjs(event.start)), 'ms').format(_default.DATETIME_FORMAT);
111
+ newEnd = localeDayjs(newStart).add(localeDayjs(event.end).diff(localeDayjs(event.start)), 'ms').format(DATETIME_FORMAT);
116
112
 
117
- // if crossResourceMove disabled, slot returns old value
118
- if (config.crossResourceMove === false) {
119
- slotId = schedulerData._getEventSlotId(item);
120
- slotName = undefined;
121
- var slot = schedulerData.getSlotById(slotId);
122
- if (slot) slotName = slot.name;
123
- }
124
- action = 'Move';
125
- }
126
- if (movingEvent) {
127
- movingEvent(schedulerData, slotId, slotName, newStart, newEnd, action, type, item);
113
+ // if crossResourceMove disabled, slot returns old value
114
+ if (config.crossResourceMove === false) {
115
+ slotId = schedulerData._getEventSlotId(item);
116
+ slotName = undefined;
117
+ const slot = schedulerData.getSlotById(slotId);
118
+ if (slot) slotName = slot.name;
128
119
  }
129
- },
130
- canDrop: function canDrop(props, monitor) {
131
- var schedulerData = props.schedulerData,
132
- resourceEvents = props.resourceEvents;
133
- var item = monitor.getItem();
134
- if (schedulerData._isResizing()) return false;
135
- var config = schedulerData.config;
136
- return config.movable && !resourceEvents.groupOnly && (item.movable === undefined || item.movable !== false);
120
+ action = 'Move';
137
121
  }
138
- };
122
+ if (movingEvent) {
123
+ movingEvent(schedulerData, slotId, slotName, newStart, newEnd, action, type, item);
124
+ }
125
+ },
126
+ canDrop: (props, monitor) => {
127
+ const {
128
+ schedulerData,
129
+ resourceEvents
130
+ } = props;
131
+ const item = monitor.getItem();
132
+ if (schedulerData._isResizing()) return false;
133
+ const {
134
+ config
135
+ } = schedulerData;
136
+ return config.movable && !resourceEvents.groupOnly && (item.movable === undefined || item.movable !== false);
137
+ }
139
138
  });
139
+
140
140
  // Returns the drop specification for use with useDrop hook
141
141
  // This should be called with props from the component using the hook
142
- _defineProperty(this, "getDropOptions", function (props, component) {
143
- var spec = _this.getDropSpec();
142
+ getDropOptions = (props, component) => {
143
+ const spec = this.getDropSpec();
144
144
  return {
145
- accept: _toConsumableArray(_this.sourceMap.keys()),
146
- drop: function drop(_item, monitor) {
147
- return spec.drop(props, monitor, component);
148
- },
149
- hover: function hover(_item, monitor) {
150
- return spec.hover(props, monitor, component);
151
- },
152
- canDrop: function canDrop(_item, monitor) {
153
- return spec.canDrop(props, monitor);
154
- },
155
- collect: function collect(monitor) {
156
- return {
157
- isOver: monitor.isOver(),
158
- canDrop: monitor.canDrop()
159
- };
160
- }
145
+ accept: [...this.sourceMap.keys()],
146
+ drop: (_item, monitor) => spec.drop(props, monitor, component),
147
+ hover: (_item, monitor) => spec.hover(props, monitor, component),
148
+ canDrop: (_item, monitor) => spec.canDrop(props, monitor),
149
+ collect: monitor => ({
150
+ isOver: monitor.isOver(),
151
+ canDrop: monitor.canDrop()
152
+ })
161
153
  };
162
- });
163
- _defineProperty(this, "getDndSource", function () {
164
- var dndType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _default.DnDTypes.EVENT;
165
- return _this.sourceMap.get(dndType);
166
- });
167
- this.sourceMap = new Map();
168
- sources.forEach(function (item) {
169
- _this.sourceMap.set(item.dndType, item);
170
- });
171
- });
154
+ };
155
+ getDndSource = (dndType = DnDTypes.EVENT) => this.sourceMap.get(dndType);
156
+ }