@progress/kendo-react-scheduler 16.3.0 → 16.4.0-develop.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/Scheduler.d.ts +46 -0
- package/Scheduler.js +1 -1
- package/Scheduler.mjs +322 -297
- package/components/EventOverviewPopover.d.ts +36 -0
- package/components/EventOverviewPopover.js +8 -0
- package/components/EventOverviewPopover.mjs +137 -0
- package/components/MoreEventsPopover.js +1 -1
- package/components/MoreEventsPopover.mjs +42 -40
- package/components/SchedulerForm.js +1 -1
- package/components/SchedulerForm.mjs +137 -104
- package/components/SchedulerQuickCreateForm.d.ts +63 -0
- package/components/SchedulerQuickCreateForm.js +8 -0
- package/components/SchedulerQuickCreateForm.mjs +148 -0
- package/components/ShowMoreItemsButton.js +1 -1
- package/components/ShowMoreItemsButton.mjs +1 -1
- package/dist/cdn/js/kendo-react-scheduler.js +1 -1
- package/editors/DiscardChangesDialog.d.ts +17 -0
- package/editors/DiscardChangesDialog.js +8 -0
- package/editors/DiscardChangesDialog.mjs +34 -0
- package/editors/KeepResetCustomEventsDialog.d.ts +19 -0
- package/editors/KeepResetCustomEventsDialog.js +8 -0
- package/editors/KeepResetCustomEventsDialog.mjs +34 -0
- package/editors/SchedulerFormEditor.d.ts +18 -4
- package/editors/SchedulerFormEditor.js +1 -1
- package/editors/SchedulerFormEditor.mjs +273 -238
- package/editors/SchedulerRecurrenceDialog.js +1 -1
- package/editors/SchedulerRecurrenceDialog.mjs +142 -135
- package/editors/ZonedSplitDateTime.d.ts +30 -0
- package/editors/ZonedSplitDateTime.js +1 -1
- package/editors/ZonedSplitDateTime.mjs +58 -47
- package/hooks/index.d.ts +4 -0
- package/hooks/useCloseOnAnchorScrollOut.d.ts +18 -0
- package/hooks/useCloseOnAnchorScrollOut.js +8 -0
- package/hooks/useCloseOnAnchorScrollOut.mjs +51 -0
- package/hooks/useDeferredClick.d.ts +26 -0
- package/hooks/useDeferredClick.js +8 -0
- package/hooks/useDeferredClick.mjs +24 -0
- package/hooks/useEventOverviewPlacement.d.ts +23 -0
- package/hooks/useEventOverviewPlacement.js +8 -0
- package/hooks/useEventOverviewPlacement.mjs +14 -0
- package/hooks/useQuickCreatePlacement.d.ts +26 -0
- package/hooks/useQuickCreatePlacement.js +8 -0
- package/hooks/useQuickCreatePlacement.mjs +28 -0
- package/index.d.mts +4 -1
- package/index.d.ts +4 -1
- package/index.js +1 -1
- package/index.mjs +123 -116
- package/items/SchedulerEditItem.js +1 -1
- package/items/SchedulerEditItem.mjs +600 -509
- package/items/SchedulerItem.d.ts +2 -0
- package/items/SchedulerItem.js +1 -1
- package/items/SchedulerItem.mjs +137 -130
- package/items/SchedulerProportionalViewItem.js +1 -1
- package/items/SchedulerProportionalViewItem.mjs +95 -91
- package/items/SchedulerViewItem.js +1 -1
- package/items/SchedulerViewItem.mjs +168 -157
- package/items/hooks/use-drag-item.js +1 -1
- package/items/hooks/use-drag-item.mjs +46 -45
- package/items/hooks/use-resize-item.d.ts +1 -0
- package/items/hooks/use-resize-item.js +1 -1
- package/items/hooks/use-resize-item.mjs +84 -78
- package/messages/index.d.ts +45 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +174 -144
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +12 -12
- package/recurrence/RecurrenceEditor.js +1 -1
- package/recurrence/RecurrenceEditor.mjs +64 -64
- package/recurrence/common.d.ts +10 -0
- package/recurrence/common.js +1 -1
- package/recurrence/common.mjs +48 -44
- package/services/itemsService.d.ts +5 -2
- package/services/itemsService.js +1 -1
- package/services/itemsService.mjs +36 -36
- package/slots/SchedulerEditSlot.d.ts +15 -0
- package/slots/SchedulerEditSlot.js +1 -1
- package/slots/SchedulerEditSlot.mjs +162 -92
- package/utils/index.d.ts +2 -0
- package/utils/index.js +1 -1
- package/utils/index.mjs +103 -99
- package/views/common/SchedulerDrag.js +1 -1
- package/views/common/SchedulerDrag.mjs +26 -23
- package/views/common/SchedulerResize.js +1 -1
- package/views/common/SchedulerResize.mjs +29 -26
- package/views/day/MultiDayView.js +1 -1
- package/views/day/MultiDayView.mjs +160 -152
|
@@ -6,234 +6,245 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import { SchedulerItem as
|
|
10
|
-
import { first as
|
|
11
|
-
import { getRect as
|
|
12
|
-
import { BORDER_WIDTH as
|
|
13
|
-
import { useInternationalization as
|
|
14
|
-
import { SchedulerItemContent as
|
|
15
|
-
import { useDir as
|
|
16
|
-
import { chevronRightIcon as
|
|
17
|
-
import { useEditable as
|
|
18
|
-
import { useSchedulerViewItemsContext as
|
|
19
|
-
import { useSchedulerElementContext as
|
|
20
|
-
import { useRowSync as
|
|
21
|
-
const
|
|
22
|
-
(e,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
import { SchedulerItem as Me } from "./SchedulerItem.mjs";
|
|
10
|
+
import { first as Te, calculateOrder as Ne, intersects as W } from "../utils/index.mjs";
|
|
11
|
+
import { getRect as oe, setRect as xe } from "../views/common/utils.mjs";
|
|
12
|
+
import { BORDER_WIDTH as x } from "../constants/index.mjs";
|
|
13
|
+
import { useInternationalization as ke } from "@progress/kendo-react-intl";
|
|
14
|
+
import { SchedulerItemContent as ce } from "./SchedulerItemContent.mjs";
|
|
15
|
+
import { useDir as Oe, IconWrap as M } from "@progress/kendo-react-common";
|
|
16
|
+
import { chevronRightIcon as se, chevronLeftIcon as ue, chevronUpIcon as Pe, arrowRotateCwIcon as me, arrowsNoRepeatIcon as de, chevronDownIcon as Ce } from "@progress/kendo-svg-icons";
|
|
17
|
+
import { useEditable as _e } from "../hooks/useEditable.mjs";
|
|
18
|
+
import { useSchedulerViewItemsContext as Le, useSchedulerViewSlotsContext as Ve } from "../context/SchedulerViewContext.mjs";
|
|
19
|
+
import { useSchedulerElementContext as Ye } from "../context/SchedulerContext.mjs";
|
|
20
|
+
import { useRowSync as qe } from "../hooks/useRowSync.mjs";
|
|
21
|
+
const B = 1, Q = 25, We = t.forwardRef(
|
|
22
|
+
(e, fe) => {
|
|
23
|
+
var ie;
|
|
24
|
+
const { item: ge, _ref: he, itemRef: ve, ...we } = e, G = t.useRef(void 0), A = t.useRef(void 0), h = t.useRef(null), X = t.useRef(null), Z = t.useRef(null), ye = _e(e.editable);
|
|
25
|
+
t.useImperativeHandle(X, () => ({ props: e, element: h.current && h.current.element })), t.useImperativeHandle(fe, () => X.current), t.useImperativeHandle(he, () => h.current), t.useImperativeHandle(ve, () => h.current);
|
|
26
|
+
const De = ge || Be.item, T = ke(), [Ee] = Le(), [Ie] = Ve(), L = Ye(), [Re, U] = t.useState(!0), [Ae, p] = t.useState(!1), v = t.useRef(e.order), ee = t.useRef(0), te = t.useRef(!1), V = Oe(L), Se = t.useMemo(
|
|
26
27
|
() => {
|
|
27
|
-
var
|
|
28
|
-
return e.isAllDay ? (
|
|
28
|
+
var n, r;
|
|
29
|
+
return e.isAllDay ? (n = e.title) != null ? n : "" : `(${T.format("{0:t} - {1:t}", e.zonedStart, e.zonedEnd)}): ${(r = e.title) != null ? r : ""}`;
|
|
29
30
|
},
|
|
30
31
|
[T, e.isAllDay, e.title, e.zonedEnd, e.zonedStart]
|
|
31
32
|
);
|
|
32
|
-
let
|
|
33
|
-
e.isRecurring && !e.isException ?
|
|
34
|
-
const
|
|
33
|
+
let z;
|
|
34
|
+
e.isRecurring && !e.isException ? z = "recurring" : !e.isRecurring && e.isException && (z = "non-recurring");
|
|
35
|
+
const He = t.useMemo(
|
|
35
36
|
() => T.format("{0:t} – {1:t}", e.zonedStart, e.zonedEnd),
|
|
36
37
|
[T, e.zonedStart, e.zonedEnd]
|
|
37
|
-
),
|
|
38
|
-
let
|
|
39
|
-
return
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
}),
|
|
43
|
-
},
|
|
44
|
-
var
|
|
45
|
-
const
|
|
46
|
-
let l = i.props.start,
|
|
47
|
-
if (i.props.isAllDay ||
|
|
38
|
+
), $ = ((ie = e.range) == null ? void 0 : ie.isAllDay) === !0, ne = (n, r) => {
|
|
39
|
+
let s = 1;
|
|
40
|
+
return n.forEach((a) => {
|
|
41
|
+
const u = r.filter((S) => K(a.current.props, S.props));
|
|
42
|
+
u.length > s && (s = u.length);
|
|
43
|
+
}), s;
|
|
44
|
+
}, be = (n, r) => n.map((a) => r.filter((u) => K(a.current.props, u.props))), ze = (n, r, s, a = !1, u = !1) => {
|
|
45
|
+
var D;
|
|
46
|
+
const S = r.filter((i) => i.props.order !== null && i.props.order !== void 0).map((i) => {
|
|
47
|
+
let l = i.props.start, c = i.props.end;
|
|
48
|
+
if (i.props.isAllDay || a) {
|
|
48
49
|
l = new Date(l.getFullYear(), l.getMonth(), l.getDate());
|
|
49
|
-
const
|
|
50
|
-
|
|
50
|
+
const f = new Date(c.getFullYear(), c.getMonth(), c.getDate());
|
|
51
|
+
c = f.getTime() <= l.getTime() ? new Date(l.getFullYear(), l.getMonth(), l.getDate() + 1) : f;
|
|
52
|
+
} else if (u) {
|
|
53
|
+
const f = new Date(l.getFullYear(), l.getMonth(), l.getDate()), m = new Date(c.getFullYear(), c.getMonth(), c.getDate()), E = m.getTime() < c.getTime() ? new Date(m.getFullYear(), m.getMonth(), m.getDate() + 1) : m;
|
|
54
|
+
l = f, c = E.getTime() <= f.getTime() ? new Date(f.getFullYear(), f.getMonth(), f.getDate() + 1) : E;
|
|
51
55
|
}
|
|
52
|
-
return { order: i.props.order, start: l, end:
|
|
53
|
-
}),
|
|
54
|
-
for (const i of
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
for (const i of
|
|
58
|
-
const l =
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
if (
|
|
56
|
+
return { order: i.props.order, start: l, end: c };
|
|
57
|
+
}), k = Array.from(new Set(S.map((i) => i.order))).sort((i, l) => i - l), F = /* @__PURE__ */ new Map();
|
|
58
|
+
for (const i of S)
|
|
59
|
+
F.has(i.order) || F.set(i.order, []), F.get(i.order).push({ start: i.start, end: i.end });
|
|
60
|
+
const w = [], O = /* @__PURE__ */ new Map();
|
|
61
|
+
for (const i of k) {
|
|
62
|
+
const l = F.get(i);
|
|
63
|
+
let c = -1, f = 0;
|
|
64
|
+
O.forEach((m, E) => {
|
|
65
|
+
if (E >= i)
|
|
62
66
|
return;
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
67
|
+
const H = F.get(E);
|
|
68
|
+
if (!H)
|
|
65
69
|
return;
|
|
66
70
|
l.some(
|
|
67
|
-
(
|
|
68
|
-
(
|
|
71
|
+
(P) => H.some(
|
|
72
|
+
(C) => W(C.start, C.end, P.start, P.end, s)
|
|
69
73
|
)
|
|
70
|
-
) &&
|
|
74
|
+
) && m + 1 > f && (f = m + 1);
|
|
71
75
|
});
|
|
72
|
-
for (let
|
|
76
|
+
for (let m = f; m < w.length; m++)
|
|
73
77
|
if (l.every(
|
|
74
|
-
(
|
|
75
|
-
(N) => !
|
|
78
|
+
(H) => w[m].every(
|
|
79
|
+
(N) => !W(
|
|
76
80
|
N.start,
|
|
77
81
|
N.end,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
H.start,
|
|
83
|
+
H.end,
|
|
84
|
+
s
|
|
81
85
|
)
|
|
82
86
|
)
|
|
83
87
|
)) {
|
|
84
|
-
|
|
88
|
+
c = m;
|
|
85
89
|
break;
|
|
86
90
|
}
|
|
87
|
-
|
|
91
|
+
c === -1 && (c = w.length, w.push([])), w[c].push(...l), O.set(i, c);
|
|
88
92
|
}
|
|
89
|
-
return (
|
|
90
|
-
},
|
|
93
|
+
return (D = O.get(n)) != null ? D : n;
|
|
94
|
+
}, K = (n, r) => W(n.start, n.end, r.start, r.end) && n.group.index === r.group.index && n.range.index === r.range.index && // When slotDuration equals a full day, both daySlots and timeSlots have isAllDay=true,
|
|
91
95
|
// so we need to also check range.isAllDay to distinguish between them.
|
|
92
|
-
(
|
|
93
|
-
var
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
|
|
96
|
+
(n.range.isAllDay === void 0 || r.range.isAllDay === void 0 || n.range.isAllDay === r.range.isAllDay) && (e.ignoreIsAllDay || n.isAllDay === r.isAllDay), Y = () => {
|
|
97
|
+
var f, m, E, H, N, P, C, ae;
|
|
98
|
+
const n = (Ie || []).filter((o) => o.current && K(o.current.props, e)).sort((o, I) => o.current.props.start.getTime() - I.current.props.start.getTime()), r = h.current && h.current.element, s = Te(n);
|
|
99
|
+
if (n.length === 0) {
|
|
100
|
+
U(!1);
|
|
97
101
|
return;
|
|
98
102
|
}
|
|
99
|
-
if (!
|
|
103
|
+
if (!s.current || !r)
|
|
100
104
|
return;
|
|
101
|
-
const
|
|
102
|
-
(
|
|
103
|
-
|
|
105
|
+
const a = oe(s.current.element), u = [], S = [], k = [];
|
|
106
|
+
(Ee || []).forEach((o) => {
|
|
107
|
+
o.current && (o.current.props.dragHint ? S.push(o.current) : o.current.props.resizeHint ? k.push(o.current) : u.push(o.current));
|
|
104
108
|
});
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
e.dragHint ?
|
|
108
|
-
|
|
109
|
+
const F = e.dragHint || e.resizeHint ? Ne(
|
|
110
|
+
h.current,
|
|
111
|
+
e.dragHint ? S : k,
|
|
112
|
+
n,
|
|
109
113
|
e.ignoreIsAllDay
|
|
110
|
-
) : (
|
|
114
|
+
) : (f = e.order) != null ? f : 0;
|
|
111
115
|
if (!e.vertical && !(e.dragHint || e.resizeHint) && e.order !== null && e.order !== void 0) {
|
|
112
|
-
const
|
|
113
|
-
|
|
116
|
+
const R = (((m = e.range) == null ? void 0 : m.isAllDay) === !0 ? u.filter((b) => {
|
|
117
|
+
var le;
|
|
118
|
+
return ((le = b.props.range) == null ? void 0 : le.isAllDay) === !0;
|
|
119
|
+
}) : e.ignoreIsAllDay ? u : u.filter((b) => b.props.isAllDay)).filter((b) => b.props.group.index === e.group.index), y = (E = e.style) == null ? void 0 : E.height, j = typeof y == "number" ? y : parseFloat(y), _ = y != null && Number.isNaN(j), d = ((H = e.range) == null ? void 0 : H.isAllDay) === !0, g = !!e.ignoreIsAllDay && !d, J = d, q = g ? !0 : !_;
|
|
120
|
+
v.current = ze(
|
|
114
121
|
e.order,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
R,
|
|
123
|
+
q,
|
|
124
|
+
g,
|
|
125
|
+
J
|
|
118
126
|
);
|
|
119
127
|
} else
|
|
120
|
-
|
|
121
|
-
let
|
|
122
|
-
const
|
|
123
|
-
let
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
let
|
|
127
|
-
|
|
128
|
-
if (!
|
|
129
|
-
const
|
|
130
|
-
|
|
128
|
+
v.current = F;
|
|
129
|
+
let w = e.dragHint || e.resizeHint ? ne(n, e.dragHint ? S : k) : ne(n, u);
|
|
130
|
+
const O = be(n, u);
|
|
131
|
+
let D = 0;
|
|
132
|
+
const i = !e.vertical && v.current !== null;
|
|
133
|
+
if (O.forEach((o) => {
|
|
134
|
+
let I = 0;
|
|
135
|
+
o.forEach((R) => {
|
|
136
|
+
if (!i) {
|
|
137
|
+
const y = oe(R.element);
|
|
138
|
+
R.props.order !== null && R.props.order !== void 0 && R.props.order < v.current && (I = y.top + y.height - a.top - x * v.current + B);
|
|
131
139
|
}
|
|
132
|
-
}),
|
|
133
|
-
}),
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
else if (!Number.isNaN(
|
|
138
|
-
|
|
140
|
+
}), I > D && (D = I);
|
|
141
|
+
}), i) {
|
|
142
|
+
const o = (N = e.style) == null ? void 0 : N.height, I = typeof o == "number" ? o : parseFloat(o);
|
|
143
|
+
if (o == null)
|
|
144
|
+
D = v.current * (Q + B);
|
|
145
|
+
else if (!Number.isNaN(I))
|
|
146
|
+
D = v.current * (I + B);
|
|
139
147
|
else {
|
|
140
|
-
const
|
|
141
|
-
|
|
148
|
+
const R = ((P = e.range) == null ? void 0 : P.isAllDay) === !0, y = !!e.ignoreIsAllDay && !R, j = (R ? u.filter((d) => {
|
|
149
|
+
var g;
|
|
150
|
+
return ((g = d.props.range) == null ? void 0 : g.isAllDay) === !0;
|
|
151
|
+
}) : e.ignoreIsAllDay ? u : u.filter((d) => d.props.isAllDay)).filter(
|
|
152
|
+
(d) => d.props.group.index === e.group.index && d.element !== r && (!y || !s.current || W(
|
|
142
153
|
d.props.start,
|
|
143
154
|
d.props.end,
|
|
144
|
-
|
|
145
|
-
|
|
155
|
+
s.current.props.start,
|
|
156
|
+
s.current.props.end
|
|
146
157
|
))
|
|
147
|
-
),
|
|
148
|
-
|
|
149
|
-
var
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
158
|
+
), _ = /* @__PURE__ */ new Map();
|
|
159
|
+
j.forEach((d) => {
|
|
160
|
+
var q, b;
|
|
161
|
+
const g = d._order;
|
|
162
|
+
if (g == null || g >= v.current)
|
|
152
163
|
return;
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
}),
|
|
164
|
+
const J = ((q = d.element) == null ? void 0 : q.offsetHeight) || Q;
|
|
165
|
+
_.set(g, Math.max((b = _.get(g)) != null ? b : 0, J));
|
|
166
|
+
}), D = Array.from(_.values()).reduce((d, g) => d + g + B, 0);
|
|
156
167
|
}
|
|
157
168
|
}
|
|
158
|
-
if (
|
|
159
|
-
|
|
169
|
+
if (n.length === 0) {
|
|
170
|
+
U(!1);
|
|
160
171
|
return;
|
|
161
172
|
}
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
(
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
})),
|
|
173
|
+
const l = ye.add ? 20 : 0;
|
|
174
|
+
a.width = e.vertical ? a.width / w - x - l / w : a.width * n.length - x, e.vertical ? a.height = a.height * n.length - x : (e.resizeHint || e.dragHint) && w <= 1 || (a.height = (ae = (C = e.style) == null ? void 0 : C.height) != null ? ae : Q), a.left = e.vertical ? a.left + v.current * a.width + x * v.current : a.left;
|
|
175
|
+
const c = !e.vertical && e.slotHeaderOffset || 0;
|
|
176
|
+
a.top = e.vertical ? a.top : a.top + D + x * v.current + c, ee.current = w, xe(r, a), (te.current || e.dragHint || e.resizeHint) && p(!0), U(!0);
|
|
177
|
+
}, re = t.useCallback(
|
|
178
|
+
(n) => {
|
|
179
|
+
const r = n && n[0], s = Z.current;
|
|
180
|
+
G.current !== void 0 && window.cancelAnimationFrame(G.current), s && r && (s.width !== r.contentRect.width || s.height !== r.contentRect.height) && (G.current = window.requestAnimationFrame(() => {
|
|
181
|
+
Y();
|
|
182
|
+
})), Z.current = { width: r.contentRect.width, height: r.contentRect.height };
|
|
172
183
|
},
|
|
173
|
-
[
|
|
184
|
+
[Y]
|
|
174
185
|
);
|
|
175
|
-
t.useEffect(() => (
|
|
176
|
-
|
|
177
|
-
|
|
186
|
+
t.useEffect(() => (Y(), A.current !== void 0 && window.cancelAnimationFrame(A.current), A.current = window.requestAnimationFrame(() => {
|
|
187
|
+
A.current = window.requestAnimationFrame(() => {
|
|
188
|
+
A.current = void 0, Y(), te.current = !0, p(!0);
|
|
178
189
|
});
|
|
179
190
|
}), () => {
|
|
180
|
-
|
|
191
|
+
A.current !== void 0 && (window.cancelAnimationFrame(A.current), A.current = void 0);
|
|
181
192
|
}));
|
|
182
|
-
const
|
|
183
|
-
return
|
|
184
|
-
element:
|
|
193
|
+
const Fe = h.current && h.current.element ? h.current.element.closest(".k-scheduler-layout") : null;
|
|
194
|
+
return qe({
|
|
195
|
+
element: Fe,
|
|
185
196
|
selector: ".k-resource-row",
|
|
186
197
|
horizontalAttribute: "data-depth-index",
|
|
187
198
|
verticalAttribute: "data-resource-index",
|
|
188
199
|
applyTo: ".k-resource-cell",
|
|
189
200
|
syncHeight: e.isLast
|
|
190
201
|
}), t.useEffect(() => {
|
|
191
|
-
if (!
|
|
202
|
+
if (!L.current)
|
|
192
203
|
return;
|
|
193
|
-
const
|
|
194
|
-
return
|
|
195
|
-
|
|
204
|
+
const n = window.ResizeObserver, r = n && new n(re);
|
|
205
|
+
return r && r.observe(L.current), () => {
|
|
206
|
+
r && r.disconnect();
|
|
196
207
|
};
|
|
197
|
-
}, [
|
|
198
|
-
|
|
208
|
+
}, [re, L]), /* @__PURE__ */ t.createElement(
|
|
209
|
+
De,
|
|
199
210
|
{
|
|
200
|
-
...
|
|
201
|
-
_ref:
|
|
202
|
-
_maxSiblingsPerSlot:
|
|
203
|
-
_order:
|
|
204
|
-
itemRef:
|
|
211
|
+
...we,
|
|
212
|
+
_ref: h,
|
|
213
|
+
_maxSiblingsPerSlot: ee,
|
|
214
|
+
_order: v,
|
|
215
|
+
itemRef: h,
|
|
205
216
|
style: {
|
|
206
|
-
visibility:
|
|
207
|
-
display:
|
|
217
|
+
visibility: Ae ? void 0 : "hidden",
|
|
218
|
+
display: Re ? void 0 : "none",
|
|
208
219
|
...e.style
|
|
209
220
|
}
|
|
210
221
|
},
|
|
211
222
|
!e.resizeHint && /* @__PURE__ */ t.createElement(t.Fragment, null, e.tail && !e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(
|
|
212
|
-
|
|
223
|
+
M,
|
|
213
224
|
{
|
|
214
|
-
name:
|
|
215
|
-
icon:
|
|
225
|
+
name: V === "rtl" ? "chevron-right" : "chevron-left",
|
|
226
|
+
icon: V === "rtl" ? se : ue
|
|
216
227
|
}
|
|
217
|
-
)), /* @__PURE__ */ t.createElement("div", { title:
|
|
218
|
-
|
|
228
|
+
)), /* @__PURE__ */ t.createElement("div", { title: Se }, e.tail && e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(M, { name: "chevron-up", icon: Pe })), $ && !e.isAllDay && !e.tail && /* @__PURE__ */ t.createElement("span", { className: "k-event-all-day-time" }, T.formatDate(e.zonedStart, "t")), /* @__PURE__ */ t.createElement(ce, { className: "k-event-title" }, e.title), $ && !e.isAllDay && !e.head && /* @__PURE__ */ t.createElement("span", { className: "k-event-all-day-time" }, T.formatDate(e.zonedEnd, "t")), !$ && /* @__PURE__ */ t.createElement(ce, { className: "k-event-time" }, z === "recurring" && /* @__PURE__ */ t.createElement("span", { className: "k-event-recurrence-icon" }, /* @__PURE__ */ t.createElement(M, { name: "arrow-rotate-cw", icon: me })), z === "non-recurring" && /* @__PURE__ */ t.createElement("span", { className: "k-event-recurrence-icon" }, /* @__PURE__ */ t.createElement(M, { name: "arrows-no-repeat", icon: de })), He), e.head && e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(M, { name: "chevron-down", icon: Ce }))), z && /* @__PURE__ */ t.createElement("span", { className: "k-event-recurrence-icon" }, /* @__PURE__ */ t.createElement(
|
|
229
|
+
M,
|
|
219
230
|
{
|
|
220
|
-
name:
|
|
221
|
-
icon:
|
|
231
|
+
name: z === "recurring" ? "arrow-rotate-cw" : "arrows-no-repeat",
|
|
232
|
+
icon: z === "recurring" ? me : de
|
|
222
233
|
}
|
|
223
234
|
)), e.head && !e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(
|
|
224
|
-
|
|
235
|
+
M,
|
|
225
236
|
{
|
|
226
|
-
name:
|
|
227
|
-
icon:
|
|
237
|
+
name: V === "rtl" ? "chevron-left" : "chevron-right",
|
|
238
|
+
icon: V === "rtl" ? ue : se
|
|
228
239
|
}
|
|
229
240
|
)))
|
|
230
241
|
);
|
|
231
242
|
}
|
|
232
|
-
),
|
|
233
|
-
item:
|
|
243
|
+
), Be = {
|
|
244
|
+
item: Me
|
|
234
245
|
};
|
|
235
|
-
|
|
246
|
+
We.displayName = "KendoReactSchedulerViewItem";
|
|
236
247
|
export {
|
|
237
|
-
|
|
238
|
-
|
|
248
|
+
We as SchedulerViewItem,
|
|
249
|
+
Be as schedulerViewItemDefaultProps
|
|
239
250
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@progress/kendo-react-common"),h=require("react"),x=require("../../hooks/useControlledState.js"),a=require("../../utils/index.js"),g=require("../../constants/index.js"),O=require("../../context/SchedulerViewContext.js"),F=require("../../context/SchedulerContext.js");function k(e){const y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const u in e)if(u!=="default"){const m=Object.getOwnPropertyDescriptor(e,u);Object.defineProperty(y,u,m.get?m:{enumerable:!0,get:()=>e[u]})}}return y.default=e,Object.freeze(y)}const b=k(h);var G=(e=>(e.set="DRAG_ITEM_SET",e.start="DRAG_ITEM_START",e.drag="DRAG_ITEM_DRAG",e.complete="DRAG_ITEM_COMPLETE",e.completeOccurrence="DRAG_ITEM_COMPLETE_OCCURRENCE",e.completeSeries="DRAG_ITEM_COMPLETE_SERIES",e.reset="DRAG_ITEM_RESET",e.dragSelected="DRAG_ITEM_DRAG_SELECTED",e))(G||{});const v=(e,y)=>{const u=b.useRef(0),m=b.useRef(0),R=b.useRef(0),f=b.useRef(null),T=b.useRef(!1),[n,c]=x.useControlledState(...y),[w]=O.useSchedulerViewSelectedItemsContext(),s=F.useSchedulerFieldsContext(),M=F.useSchedulerGroupsContext();return[n,c,l=>{switch(l.type){case"DRAG_ITEM_SET":{c(l.payload);break}case"DRAG_ITEM_RESET":{c(null);break}case"DRAG_ITEM_DRAG_SELECTED":{if(Math.abs(m.current-l.payload.x)<10&&Math.abs(R.current-l.payload.y)<10)return;const t=a.slotDive(l.payload.x,l.payload.y,7);if(!t||t===f.current)return;const r=i.clone(e.dataItem),o=t.getAttribute("data-slot-start"),D=t.getAttribute("data-slot-allday")==="true";if(!e.ignoreIsAllDay&&D!==e.isAllDay||T.current&&!D)return;const d=new Date(a.getField(r,s.start)),E=Number(o)-Number(u.current)-d.getTime(),C=w.map(A=>{if(!A.current)return null;const I=i.clone(A.current.props.dataItem),_=new Date(A.current.props.start.getTime()+E),S=new Date(A.current.props.end.getTime()+E);return a.setField(I,s.start,_),a.setField(I,s.end,S),I}).filter(Boolean);f.current=t,c([...C]);break}case"DRAG_ITEM_START":{const t=l.payload.x,r=l.payload.y;m.current=t,R.current=r;const o=a.slotDive(t,r,7);if(!o)return;T.current=o.getAttribute("data-slot-allday")==="true";const D=i.clone(e.dataItem),d=o.getAttribute("data-slot-start"),E=a.getField(D,s.start);if(d===null)return;u.current=Number(d)-new Date(E).getTime();break}case"DRAG_ITEM_DRAG":{if(Math.abs(m.current-l.payload.x)<10&&Math.abs(R.current-l.payload.y)<10)return;const t=a.slotDive(l.payload.x,l.payload.y,7);if(!t||t===f.current)return;const r=i.clone(e.dataItem),o=t.getAttribute("data-slot-start"),D=t.getAttribute("data-slot-group"),d=t.getAttribute("data-slot-allday")==="true";if(!e.ignoreIsAllDay&&d!==e.isAllDay||T.current&&!d)return;const E=new Date(a.getField(r,s.start)),A=new Date(a.getField(r,s.end)).getTime()-E.getTime(),I=new Date(Number(o)-Number(u.current)),_=new Date(Number(o)-Number(u.current)+A),S=M.find(p=>p.index===Number(D));a.setField(r,s.start,I),a.setField(r,s.end,_),S&&M.length>1&&S.resources.forEach(p=>{p.multiple||a.setField(r,p.field,p[p.valueField])}),f.current=t,r&&c(r);break}case"DRAG_ITEM_COMPLETE":{c(null),e.onDataAction&&n&&e.onDataAction.call(void 0,{type:g.DATA_ACTION.update,series:!1,dataItem:n});break}case"DRAG_ITEM_COMPLETE_OCCURRENCE":{const t=Array.isArray(n)?n.slice():i.clone(n);c(null),e.onDataAction&&t&&e.onDataAction.call(void 0,{type:g.DATA_ACTION.update,series:!1,dataItem:t});break}case"DRAG_ITEM_COMPLETE_SERIES":{let t;if(Array.isArray(n))t=n.map(r=>{const o=i.clone(r);return a.setField(o,s.start,a.getField(r,s.start)),a.setField(o,s.end,a.getField(r,s.end)),o});else{const r=i.clone(n);a.setField(r,s.start,a.getField(n,s.start)),a.setField(r,s.end,a.getField(n,s.end)),t=r}c(null),e.onDataAction&&t&&e.onDataAction.call(void 0,{type:g.DATA_ACTION.update,series:!0,dataItem:t});break}default:c(n);break}}]};exports.DRAG_ITEM_ACTION=G;exports.useDragItem=v;
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { clone as
|
|
9
|
-
import * as
|
|
10
|
-
import { useControlledState as
|
|
11
|
-
import { setField as u, getField as
|
|
12
|
-
import { DATA_ACTION as
|
|
13
|
-
import { useSchedulerViewSelectedItemsContext as
|
|
14
|
-
import { useSchedulerFieldsContext as
|
|
15
|
-
var
|
|
16
|
-
const
|
|
17
|
-
const f =
|
|
8
|
+
import { clone as i } from "@progress/kendo-react-common";
|
|
9
|
+
import * as y from "react";
|
|
10
|
+
import { useControlledState as x } from "../../hooks/useControlledState.mjs";
|
|
11
|
+
import { setField as u, getField as c, slotDive as M } from "../../utils/index.mjs";
|
|
12
|
+
import { DATA_ACTION as g } from "../../constants/index.mjs";
|
|
13
|
+
import { useSchedulerViewSelectedItemsContext as k } from "../../context/SchedulerViewContext.mjs";
|
|
14
|
+
import { useSchedulerFieldsContext as L, useSchedulerGroupsContext as v } from "../../context/SchedulerContext.mjs";
|
|
15
|
+
var P = /* @__PURE__ */ ((t) => (t.set = "DRAG_ITEM_SET", t.start = "DRAG_ITEM_START", t.drag = "DRAG_ITEM_DRAG", t.complete = "DRAG_ITEM_COMPLETE", t.completeOccurrence = "DRAG_ITEM_COMPLETE_OCCURRENCE", t.completeSeries = "DRAG_ITEM_COMPLETE_SERIES", t.reset = "DRAG_ITEM_RESET", t.dragSelected = "DRAG_ITEM_DRAG_SELECTED", t))(P || {});
|
|
16
|
+
const V = (t, h) => {
|
|
17
|
+
const f = y.useRef(0), b = y.useRef(0), S = y.useRef(0), I = y.useRef(null), T = y.useRef(!1), [s, o] = x(...h), [C] = k(), a = L(), G = v();
|
|
18
18
|
return [s, o, (n) => {
|
|
19
19
|
switch (n.type) {
|
|
20
20
|
case "DRAG_ITEM_SET": {
|
|
@@ -26,62 +26,63 @@ const B = (t, w) => {
|
|
|
26
26
|
break;
|
|
27
27
|
}
|
|
28
28
|
case "DRAG_ITEM_DRAG_SELECTED": {
|
|
29
|
-
if (Math.abs(
|
|
29
|
+
if (Math.abs(b.current - n.payload.x) < 10 && Math.abs(S.current - n.payload.y) < 10)
|
|
30
30
|
return;
|
|
31
|
-
const e =
|
|
32
|
-
if (!e || e ===
|
|
31
|
+
const e = M(n.payload.x, n.payload.y, 7);
|
|
32
|
+
if (!e || e === I.current)
|
|
33
33
|
return;
|
|
34
|
-
const
|
|
35
|
-
if (!t.ignoreIsAllDay &&
|
|
34
|
+
const r = i(t.dataItem), l = e.getAttribute("data-slot-start"), m = e.getAttribute("data-slot-allday") === "true";
|
|
35
|
+
if (!t.ignoreIsAllDay && m !== t.isAllDay || T.current && !m)
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
37
|
+
const d = new Date(c(r, a.start)), D = Number(l) - Number(f.current) - d.getTime(), w = C.map((p) => {
|
|
38
38
|
if (!p.current)
|
|
39
39
|
return null;
|
|
40
|
-
const A =
|
|
41
|
-
return u(A,
|
|
40
|
+
const A = i(p.current.props.dataItem), _ = new Date(p.current.props.start.getTime() + D), R = new Date(p.current.props.end.getTime() + D);
|
|
41
|
+
return u(A, a.start, _), u(A, a.end, R), A;
|
|
42
42
|
}).filter(Boolean);
|
|
43
|
-
|
|
43
|
+
I.current = e, o([...w]);
|
|
44
44
|
break;
|
|
45
45
|
}
|
|
46
46
|
case "DRAG_ITEM_START": {
|
|
47
|
-
const e = n.payload.x,
|
|
48
|
-
|
|
49
|
-
const l =
|
|
47
|
+
const e = n.payload.x, r = n.payload.y;
|
|
48
|
+
b.current = e, S.current = r;
|
|
49
|
+
const l = M(e, r, 7);
|
|
50
50
|
if (!l)
|
|
51
51
|
return;
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
T.current = l.getAttribute("data-slot-allday") === "true";
|
|
53
|
+
const m = i(t.dataItem), d = l.getAttribute("data-slot-start"), D = c(m, a.start);
|
|
54
|
+
if (d === null)
|
|
54
55
|
return;
|
|
55
|
-
f.current = Number(
|
|
56
|
+
f.current = Number(d) - new Date(D).getTime();
|
|
56
57
|
break;
|
|
57
58
|
}
|
|
58
59
|
case "DRAG_ITEM_DRAG": {
|
|
59
|
-
if (Math.abs(
|
|
60
|
+
if (Math.abs(b.current - n.payload.x) < 10 && Math.abs(S.current - n.payload.y) < 10)
|
|
60
61
|
return;
|
|
61
|
-
const e =
|
|
62
|
-
if (!e || e ===
|
|
62
|
+
const e = M(n.payload.x, n.payload.y, 7);
|
|
63
|
+
if (!e || e === I.current)
|
|
63
64
|
return;
|
|
64
|
-
const
|
|
65
|
-
if (!t.ignoreIsAllDay &&
|
|
65
|
+
const r = i(t.dataItem), l = e.getAttribute("data-slot-start"), m = e.getAttribute("data-slot-group"), d = e.getAttribute("data-slot-allday") === "true";
|
|
66
|
+
if (!t.ignoreIsAllDay && d !== t.isAllDay || T.current && !d)
|
|
66
67
|
return;
|
|
67
|
-
const
|
|
68
|
-
u(
|
|
69
|
-
|
|
70
|
-
}),
|
|
68
|
+
const D = new Date(c(r, a.start)), p = new Date(c(r, a.end)).getTime() - D.getTime(), A = new Date(Number(l) - Number(f.current)), _ = new Date(Number(l) - Number(f.current) + p), R = G.find((E) => E.index === Number(m));
|
|
69
|
+
u(r, a.start, A), u(r, a.end, _), R && G.length > 1 && R.resources.forEach((E) => {
|
|
70
|
+
E.multiple || u(r, E.field, E[E.valueField]);
|
|
71
|
+
}), I.current = e, r && o(r);
|
|
71
72
|
break;
|
|
72
73
|
}
|
|
73
74
|
case "DRAG_ITEM_COMPLETE": {
|
|
74
75
|
o(null), t.onDataAction && s && t.onDataAction.call(void 0, {
|
|
75
|
-
type:
|
|
76
|
+
type: g.update,
|
|
76
77
|
series: !1,
|
|
77
78
|
dataItem: s
|
|
78
79
|
});
|
|
79
80
|
break;
|
|
80
81
|
}
|
|
81
82
|
case "DRAG_ITEM_COMPLETE_OCCURRENCE": {
|
|
82
|
-
const e = Array.isArray(s) ? s.slice() :
|
|
83
|
+
const e = Array.isArray(s) ? s.slice() : i(s);
|
|
83
84
|
o(null), t.onDataAction && e && t.onDataAction.call(void 0, {
|
|
84
|
-
type:
|
|
85
|
+
type: g.update,
|
|
85
86
|
series: !1,
|
|
86
87
|
dataItem: e
|
|
87
88
|
});
|
|
@@ -90,16 +91,16 @@ const B = (t, w) => {
|
|
|
90
91
|
case "DRAG_ITEM_COMPLETE_SERIES": {
|
|
91
92
|
let e;
|
|
92
93
|
if (Array.isArray(s))
|
|
93
|
-
e = s.map((
|
|
94
|
-
const l =
|
|
95
|
-
return u(l,
|
|
94
|
+
e = s.map((r) => {
|
|
95
|
+
const l = i(r);
|
|
96
|
+
return u(l, a.start, c(r, a.start)), u(l, a.end, c(r, a.end)), l;
|
|
96
97
|
});
|
|
97
98
|
else {
|
|
98
|
-
const
|
|
99
|
-
u(
|
|
99
|
+
const r = i(s);
|
|
100
|
+
u(r, a.start, c(s, a.start)), u(r, a.end, c(s, a.end)), e = r;
|
|
100
101
|
}
|
|
101
102
|
o(null), t.onDataAction && e && t.onDataAction.call(void 0, {
|
|
102
|
-
type:
|
|
103
|
+
type: g.update,
|
|
103
104
|
series: !0,
|
|
104
105
|
dataItem: e
|
|
105
106
|
});
|
|
@@ -112,6 +113,6 @@ const B = (t, w) => {
|
|
|
112
113
|
}];
|
|
113
114
|
};
|
|
114
115
|
export {
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
P as DRAG_ITEM_ACTION,
|
|
117
|
+
V as useDragItem
|
|
117
118
|
};
|