@progress/kendo-react-scheduler 14.1.2-develop.1 → 14.2.0-develop.1
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/cdn/js/kendo-react-scheduler.js +1 -1
- package/hooks/useSlotExpand.js +1 -1
- package/hooks/useSlotExpand.mjs +14 -14
- package/items/SchedulerItem.js +1 -1
- package/items/SchedulerItem.mjs +93 -87
- package/items/SchedulerProportionalViewItem.js +1 -1
- package/items/SchedulerProportionalViewItem.mjs +72 -67
- package/items/SchedulerViewItem.js +1 -1
- package/items/SchedulerViewItem.mjs +124 -84
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +11 -11
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -1
- package/utils/index.mjs +99 -82
|
@@ -5,32 +5,35 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { SchedulerItem as
|
|
10
|
-
import { intersects as T, first as
|
|
11
|
-
import { getRect as
|
|
8
|
+
import * as n from "react";
|
|
9
|
+
import { SchedulerItem as me } from "./SchedulerItem.mjs";
|
|
10
|
+
import { intersects as T, first as B, last as K, calculateProportionalOrder as de } from "../utils/index.mjs";
|
|
11
|
+
import { getRect as M, setRect as fe } from "../views/common/utils.mjs";
|
|
12
12
|
import { BORDER_WIDTH as S } from "../constants/index.mjs";
|
|
13
|
-
import { useInternationalization as
|
|
14
|
-
import { SchedulerItemContent as
|
|
15
|
-
import { useDir as
|
|
16
|
-
import { caretAltRightIcon as
|
|
17
|
-
import { useSchedulerViewItemsContext as
|
|
18
|
-
import { useSchedulerElementContext as
|
|
19
|
-
import { useRowSync as
|
|
20
|
-
const
|
|
21
|
-
(e,
|
|
22
|
-
const { item:
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
() =>
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
import { useInternationalization as he } from "@progress/kendo-react-intl";
|
|
14
|
+
import { SchedulerItemContent as j } from "./SchedulerItemContent.mjs";
|
|
15
|
+
import { useDir as ge, IconWrap as H } from "@progress/kendo-react-common";
|
|
16
|
+
import { caretAltRightIcon as Se, caretAltLeftIcon as ve, arrowRotateCwIcon as we, nonRecurrenceIcon as xe } from "@progress/kendo-svg-icons";
|
|
17
|
+
import { useSchedulerViewItemsContext as Re, useSchedulerViewSlotsContext as Ie } from "../context/SchedulerViewContext.mjs";
|
|
18
|
+
import { useSchedulerElementContext as Te } from "../context/SchedulerContext.mjs";
|
|
19
|
+
import { useRowSync as Ee } from "../hooks/useRowSync.mjs";
|
|
20
|
+
const ye = 1, J = 25, _e = n.forwardRef(
|
|
21
|
+
(e, Q) => {
|
|
22
|
+
const { item: U, _ref: X, itemRef: Y, ...Z } = e, E = n.useRef(void 0), o = n.useRef(null), P = n.useRef(null), z = n.useRef(null);
|
|
23
|
+
n.useImperativeHandle(P, () => ({ props: e, element: o.current && o.current.element })), n.useImperativeHandle(Q, () => P.current), n.useImperativeHandle(X, () => o.current), n.useImperativeHandle(Y, () => o.current);
|
|
24
|
+
const ee = U || Ae.item, p = he(), [te] = Re(), [re] = Ie(), x = Te(), [ne, b] = n.useState(!0), [ie, ce] = n.useState(!1), C = n.useRef(0), f = n.useRef(null), h = n.useRef([]), O = ge(x), k = n.useMemo(
|
|
25
|
+
() => {
|
|
26
|
+
var i, r;
|
|
27
|
+
return e.isAllDay ? (i = e.title) != null ? i : "" : `(${p.format("{0:t} - {1:t}", e.zonedStart, e.zonedEnd)}): ${(r = e.title) != null ? r : ""}`;
|
|
28
|
+
},
|
|
29
|
+
[p, e.isAllDay, e.title, e.zonedEnd, e.zonedStart]
|
|
30
|
+
), oe = (i, r) => {
|
|
28
31
|
let c = 0;
|
|
29
|
-
return
|
|
32
|
+
return r.forEach((l) => {
|
|
30
33
|
l._order !== void 0 && l._order !== null && c < l._order && (c = l._order);
|
|
31
34
|
}), c + 1;
|
|
32
|
-
},
|
|
33
|
-
const [l, d] =
|
|
35
|
+
}, se = (i, r, c) => {
|
|
36
|
+
const [l, d] = r, a = new Date(
|
|
34
37
|
Math.min(
|
|
35
38
|
d.props.end.getTime() - c,
|
|
36
39
|
Math.max(e.start.getTime(), l.props.start.getTime())
|
|
@@ -42,101 +45,103 @@ const Ee = 1, j = 25, _e = r.forwardRef(
|
|
|
42
45
|
const R = Math.max(
|
|
43
46
|
Math.min(d.props.end.getTime() - c, u.props.start.getTime()),
|
|
44
47
|
l.props.start.getTime()
|
|
45
|
-
),
|
|
48
|
+
), v = Math.min(
|
|
46
49
|
Math.max(R + c, u.props.end.getTime()),
|
|
47
50
|
d.props.end.getTime()
|
|
48
51
|
);
|
|
49
|
-
return u.props.id !== e.id && u.props.group.index === e.group.index && u.props.range.index === e.range.index && (e.ignoreIsAllDay || u.props.isAllDay === e.isAllDay) && T(new Date(R), new Date(
|
|
52
|
+
return u.props.id !== e.id && u.props.group.index === e.group.index && u.props.range.index === e.range.index && (e.ignoreIsAllDay || u.props.isAllDay === e.isAllDay) && T(new Date(R), new Date(v), a, g) && T(l.props.start, d.props.end, u.props.start, u.props.end);
|
|
50
53
|
});
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
}, le = (i, r) => i.group.index === r.group.index && i.range.index === r.range.index && // When slotDuration equals a full day, both daySlots and timeSlots have isAllDay=true,
|
|
55
|
+
// so we need to also check range.isAllDay to distinguish between them.
|
|
56
|
+
(i.range.isAllDay === void 0 || r.range.isAllDay === void 0 || i.range.isAllDay === r.range.isAllDay) && (e.ignoreIsAllDay || i.isAllDay === r.isAllDay), y = () => {
|
|
57
|
+
var G, L, W, $, q;
|
|
58
|
+
const i = re.filter((t) => t.current && le(t.current.props, e)).sort((t, w) => t.current.props.start.getTime() - w.current.props.start.getTime()), r = i.filter(
|
|
54
59
|
(t) => T(t.current.props.start, t.current.props.end, e.start, e.end)
|
|
55
60
|
), c = o.current && o.current.element;
|
|
56
|
-
if (!c || !
|
|
61
|
+
if (!c || !r.length)
|
|
57
62
|
return;
|
|
58
|
-
const l =
|
|
63
|
+
const l = B(i), d = K(i), a = B(r), g = K(r);
|
|
59
64
|
if (!a.current || !o.current || !g.current || !l.current || !d.current)
|
|
60
65
|
return;
|
|
61
66
|
if (!T(a.current.props.start, g.current.props.end, e.start, e.end)) {
|
|
62
|
-
|
|
67
|
+
b(!1);
|
|
63
68
|
return;
|
|
64
69
|
}
|
|
65
|
-
const
|
|
70
|
+
const _ = [], u = [], R = [], v = M(a.current.element), A = (e.vertical ? v.height : v.width) / (a.current.props.end.getTime() - a.current.props.start.getTime()), N = (e.vertical ? J : 8) / A, I = (Math.min(e.start.getTime(), g.current.props.end.getTime() - N) - a.current.props.start.getTime()) * A, F = Math.floor(
|
|
66
71
|
Math.min(e.end.getTime(), g.current.props.end.getTime()) - Math.max(e.start.getTime(), a.current.props.start.getTime())
|
|
67
|
-
) *
|
|
68
|
-
(
|
|
69
|
-
t.current && (t.current.props.dragHint ? u.push(t.current) : t.current.props.resizeHint ? R.push(t.current) :
|
|
70
|
-
}), h.current =
|
|
72
|
+
) * A;
|
|
73
|
+
(te || []).forEach((t) => {
|
|
74
|
+
t.current && (t.current.props.dragHint ? u.push(t.current) : t.current.props.resizeHint ? R.push(t.current) : _.push(t.current));
|
|
75
|
+
}), h.current = se(_, [l.current, d.current], N), f.current = e.resizeHint || e.dragHint ? 0 : de(o.current, h.current);
|
|
71
76
|
let m = 1;
|
|
72
|
-
e.resizeHint || e.dragHint || (m =
|
|
77
|
+
e.resizeHint || e.dragHint || (m = oe(o.current, h.current), h.current.forEach((t) => {
|
|
73
78
|
t._maxSiblingsPerSlot && m < t._maxSiblingsPerSlot && (m = t._maxSiblingsPerSlot);
|
|
74
79
|
}), h.current.forEach((t) => {
|
|
75
80
|
t._maxSiblingsPerSlot !== void 0 && t._maxSiblingsPerSlot !== null && t._maxSiblingsPerSlot < m && (t._maxSiblingsPerSlot = m);
|
|
76
81
|
}));
|
|
77
|
-
let
|
|
78
|
-
const s =
|
|
82
|
+
let D = 0;
|
|
83
|
+
const s = v;
|
|
79
84
|
h.current.forEach((t) => {
|
|
80
|
-
let
|
|
81
|
-
t._order !== void 0 && t._order !== null && t._order < f.current && (
|
|
85
|
+
let w = 0;
|
|
86
|
+
t._order !== void 0 && t._order !== null && t._order < f.current && (w = M(t.element).top + M(t.element).height - s.top - S * f.current + ye), w > D && (D = w);
|
|
82
87
|
});
|
|
83
|
-
const
|
|
84
|
-
s.width = e.vertical ? s.width / m - S -
|
|
85
|
-
},
|
|
88
|
+
const ue = 20;
|
|
89
|
+
s.width = e.vertical ? s.width / m - S - ue / m : F - S, e.vertical ? s.height = F - S : (e.resizeHint || e.dragHint) && m <= 1 || (s.height = (L = (G = e.style) == null ? void 0 : G.height) != null ? L : J), s.left = e.vertical ? s.left + ((W = f.current) != null ? W : 0) + S * (($ = f.current) != null ? $ : 0) * s.width : s.left + (I < 0 ? 0 : I), s.top = e.vertical ? s.top + (I < 0 ? 0 : I) : s.top + D + S * ((q = f.current) != null ? q : 0), C.current = m, fe(c, s), ce(!0), b(!0);
|
|
90
|
+
}, V = n.useCallback(
|
|
86
91
|
(i) => {
|
|
87
|
-
const
|
|
88
|
-
E.current !== void 0 && window.cancelAnimationFrame(E.current), c &&
|
|
92
|
+
const r = i && i[0], c = z.current;
|
|
93
|
+
E.current !== void 0 && window.cancelAnimationFrame(E.current), c && r && (c.width !== r.contentRect.width || c.height !== r.contentRect.height) && (E.current = window.requestAnimationFrame(() => {
|
|
89
94
|
y();
|
|
90
|
-
})),
|
|
95
|
+
})), z.current = { width: r.contentRect.width, height: r.contentRect.height };
|
|
91
96
|
},
|
|
92
97
|
[y]
|
|
93
98
|
);
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
return
|
|
97
|
-
element:
|
|
99
|
+
n.useEffect(y);
|
|
100
|
+
const ae = o.current && o.current.element ? o.current.element.closest(".k-scheduler-layout") : null;
|
|
101
|
+
return Ee({
|
|
102
|
+
element: ae,
|
|
98
103
|
selector: ".k-resource-row",
|
|
99
104
|
horizontalAttribute: "data-depth-index",
|
|
100
105
|
verticalAttribute: "data-resource-index",
|
|
101
106
|
applyTo: ".k-resource-cell",
|
|
102
107
|
syncHeight: e.isLast
|
|
103
|
-
}),
|
|
108
|
+
}), n.useEffect(() => {
|
|
104
109
|
if (!x.current)
|
|
105
110
|
return;
|
|
106
|
-
const i = window.ResizeObserver,
|
|
107
|
-
return
|
|
108
|
-
|
|
111
|
+
const i = window.ResizeObserver, r = i && new i(V);
|
|
112
|
+
return r && r.observe(x.current), () => {
|
|
113
|
+
r && r.disconnect();
|
|
109
114
|
};
|
|
110
|
-
}, [
|
|
111
|
-
|
|
115
|
+
}, [V, x]), /* @__PURE__ */ n.createElement(
|
|
116
|
+
ee,
|
|
112
117
|
{
|
|
113
|
-
...
|
|
118
|
+
...Z,
|
|
114
119
|
_ref: o,
|
|
115
120
|
_order: f,
|
|
116
121
|
_maxSiblingsPerSlot: C,
|
|
117
122
|
_siblings: h,
|
|
118
123
|
itemRef: o,
|
|
119
124
|
style: {
|
|
120
|
-
visibility:
|
|
121
|
-
display:
|
|
125
|
+
visibility: ie ? void 0 : "hidden",
|
|
126
|
+
display: ne ? void 0 : "none",
|
|
122
127
|
...e.style
|
|
123
128
|
}
|
|
124
129
|
},
|
|
125
|
-
!e.resizeHint && /* @__PURE__ */
|
|
126
|
-
|
|
130
|
+
!e.resizeHint && /* @__PURE__ */ n.createElement("span", { className: "k-event-actions" }, e.tail && /* @__PURE__ */ n.createElement(
|
|
131
|
+
H,
|
|
127
132
|
{
|
|
128
133
|
name: O === "rtl" ? "caret-alt-right" : "caret-alt-left",
|
|
129
|
-
icon: O === "rtl" ?
|
|
134
|
+
icon: O === "rtl" ? Se : ve
|
|
130
135
|
}
|
|
131
|
-
), e.isRecurring && !e.isException && /* @__PURE__ */
|
|
132
|
-
!e.resizeHint && /* @__PURE__ */
|
|
136
|
+
), e.isRecurring && !e.isException && /* @__PURE__ */ n.createElement(H, { name: "reload", icon: we }), !e.isRecurring && e.isException && /* @__PURE__ */ n.createElement(H, { name: "non-recurrence", icon: xe })),
|
|
137
|
+
!e.resizeHint && /* @__PURE__ */ n.createElement("div", { title: k }, !e.isAllDay && /* @__PURE__ */ n.createElement(j, { className: "k-event-time" }, k), /* @__PURE__ */ n.createElement(j, null, e.title))
|
|
133
138
|
);
|
|
134
139
|
}
|
|
135
|
-
),
|
|
136
|
-
item:
|
|
140
|
+
), Ae = {
|
|
141
|
+
item: me
|
|
137
142
|
};
|
|
138
143
|
_e.displayName = "KendoReactSchedulerProportionalViewItem";
|
|
139
144
|
export {
|
|
140
145
|
_e as SchedulerProportionalViewItem,
|
|
141
|
-
|
|
146
|
+
Ae as schedulerProportionalViewItemDefaultProps
|
|
142
147
|
};
|
|
@@ -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 de=require("react"),me=require("./SchedulerItem.js"),b=require("../utils/index.js"),P=require("../views/common/utils.js"),R=require("../constants/index.js"),fe=require("@progress/kendo-react-intl"),K=require("./SchedulerItemContent.js"),O=require("@progress/kendo-react-common"),z=require("@progress/kendo-svg-icons"),he=require("../hooks/useRowSync.js"),ge=require("../hooks/useEditable.js"),U=require("../context/SchedulerViewContext.js"),Se=require("../context/SchedulerContext.js");function Ie(e){const w=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const S in e)if(S!=="default"){const E=Object.getOwnPropertyDescriptor(e,S);Object.defineProperty(w,S,E.get?E:{enumerable:!0,get:()=>e[S]})}}return w.default=e,Object.freeze(w)}const i=Ie(de),J=1,Q=25,X=i.forwardRef((e,w)=>{const{item:S,_ref:E,itemRef:p,...ee}=e,x=i.useRef(void 0),u=i.useRef(null),C=i.useRef(null),k=i.useRef(null),te=ge.useEditable(e.editable);i.useImperativeHandle(C,()=>({props:e,element:u.current&&u.current.element})),i.useImperativeHandle(w,()=>C.current),i.useImperativeHandle(E,()=>u.current),i.useImperativeHandle(p,()=>u.current);const re=S||Z.item,M=fe.useInternationalization(),[ne]=U.useSchedulerViewItemsContext(),[ie]=U.useSchedulerViewSlotsContext(),H=Se.useSchedulerElementContext(),[ce,_]=i.useState(!0),[le,se]=i.useState(!1),f=i.useRef(e.order),V=i.useRef(0),F=O.useDir(H),W=i.useMemo(()=>{var t,r;return e.isAllDay?(t=e.title)!=null?t:"":`(${M.format("{0:t} - {1:t}",e.zonedStart,e.zonedEnd)}): ${(r=e.title)!=null?r:""}`},[M,e.isAllDay,e.title,e.zonedEnd,e.zonedStart]),B=(t,r)=>{let o=1;return t.forEach(c=>{const a=r.filter(m=>T(c.current.props,m.props));a.length>o&&(o=a.length)}),o},oe=(t,r)=>t.map(c=>r.filter(a=>T(c.current.props,a.props))),ae=(t,r)=>{var A;const o=r.filter(n=>n.props.order!==null&&n.props.order!==void 0).map(n=>{let d=n.props.start,l=n.props.end;return n.props.isAllDay&&(d=new Date(d.getFullYear(),d.getMonth(),d.getDate()),l=new Date(l.getFullYear(),l.getMonth(),l.getDate())),{order:n.props.order,start:d,end:l}}),c=Array.from(new Set(o.map(n=>n.order))).sort((n,d)=>n-d),a=new Map;for(const n of o)a.has(n.order)||a.set(n.order,[]),a.get(n.order).push({start:n.start,end:n.end});const m=[],I=new Map;for(const n of c){const d=a.get(n);let l=-1;for(let g=0;g<m.length;g++)if(d.every(v=>m[g].every(y=>!b.intersects(y.start,y.end,v.start,v.end,!0)))){l=g;break}l===-1&&(l=m.length,m.push([])),m[l].push(...d),I.set(n,l)}return(A=I.get(t))!=null?A:t},T=(t,r)=>b.intersects(t.start,t.end,r.start,r.end)&&t.group.index===r.group.index&&t.range.index===r.range.index&&(t.range.isAllDay===void 0||r.range.isAllDay===void 0||t.range.isAllDay===r.range.isAllDay)&&(e.ignoreIsAllDay||t.isAllDay===r.isAllDay),q=()=>{var v,y,L,$,G;const t=(ie||[]).filter(s=>s.current&&T(s.current.props,e)),r=u.current&&u.current.element,o=b.first(t);if(t.length===0){_(!1);return}if(!o.current||!r)return;const c=P.getRect(o.current.element),a=[],m=[],I=[];(ne||[]).forEach(s=>{s.current&&(s.current.props.dragHint?m.push(s.current):s.current.props.resizeHint?I.push(s.current):a.push(s.current))});const A=e.dragHint||e.resizeHint?b.calculateOrder(u.current,e.dragHint?m:I,t,e.ignoreIsAllDay):(v=e.order)!=null?v:0;if(!e.vertical&&!(e.dragHint||e.resizeHint)&&e.order!==null&&e.order!==void 0){const s=a.filter(D=>D.props.isAllDay);f.current=ae(e.order,s)}else f.current=A;let n=e.dragHint||e.resizeHint?B(t,e.dragHint?m:I):B(t,a);const d=oe(t,a);let l=0;const g=!e.vertical&&f.current!==null;if(d.forEach(s=>{let D=0;s.forEach(h=>{if(b.intersects(h.props.start,h.props.end,e.start,e.end)&&!(e.dragHint||e.resizeHint)&&h._maxSiblingsPerSlot&&h._maxSiblingsPerSlot>n&&h.element!==r&&(n=h._maxSiblingsPerSlot),!g){const Y=P.getRect(h.element);h.props.order!==null&&h.props.order!==void 0&&h.props.order<f.current&&(D=Y.top+Y.height-c.top-R.BORDER_WIDTH*f.current+J)}}),D>l&&(l=D)}),g){const s=(L=(y=e.style)==null?void 0:y.height)!=null?L:Q;l=f.current*(s+J)}if(t.length===0){_(!1);return}const j=te.add?20:0;c.width=e.vertical?c.width/n-R.BORDER_WIDTH-j/n:c.width*t.length-R.BORDER_WIDTH,e.vertical?c.height=c.height*t.length-R.BORDER_WIDTH:(e.resizeHint||e.dragHint)&&n<=1||(c.height=(G=($=e.style)==null?void 0:$.height)!=null?G:Q),c.left=e.vertical?c.left+f.current*c.width+R.BORDER_WIDTH*f.current:c.left,c.top=e.vertical?c.top:c.top+l+R.BORDER_WIDTH*f.current,V.current=n,P.setRect(r,c),se(!0),_(!0)},N=i.useCallback(t=>{const r=t&&t[0],o=k.current;x.current!==void 0&&window.cancelAnimationFrame(x.current),o&&r&&(o.width!==r.contentRect.width||o.height!==r.contentRect.height)&&(x.current=window.requestAnimationFrame(()=>{q()})),k.current={width:r.contentRect.width,height:r.contentRect.height}},[q]);i.useEffect(q);const ue=u.current&&u.current.element?u.current.element.closest(".k-scheduler-layout"):null;return he.useRowSync({element:ue,selector:".k-resource-row",horizontalAttribute:"data-depth-index",verticalAttribute:"data-resource-index",applyTo:".k-resource-cell",syncHeight:e.isLast}),i.useEffect(()=>{if(!H.current)return;const t=window.ResizeObserver,r=t&&new t(N);return r&&r.observe(H.current),()=>{r&&r.disconnect()}},[N,H]),i.createElement(re,{...ee,_ref:u,_maxSiblingsPerSlot:V,_order:f,itemRef:u,style:{visibility:le?void 0:"hidden",display:ce?void 0:"none",...e.style}},!e.resizeHint&&i.createElement("span",{className:"k-event-actions"},e.tail&&i.createElement(O.IconWrap,{name:F==="rtl"?"caret-alt-right":"caret-alt-left",icon:F==="rtl"?z.caretAltRightIcon:z.caretAltLeftIcon}),e.isRecurring&&!e.isException&&i.createElement(O.IconWrap,{name:"arrow-rotate-cw",icon:z.arrowRotateCwIcon}),!e.isRecurring&&e.isException&&i.createElement(O.IconWrap,{name:"arrows-no-repeat",icon:z.arrowsNoRepeatIcon})),!e.resizeHint&&i.createElement("div",{title:W},!e.isAllDay&&i.createElement(K.SchedulerItemContent,{className:"k-event-time"},W),i.createElement(K.SchedulerItemContent,null,e.title)))}),Z={item:me.SchedulerItem};X.displayName="KendoReactSchedulerViewItem";exports.SchedulerViewItem=X;exports.schedulerViewItemDefaultProps=Z;
|
|
@@ -5,119 +5,159 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
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 { caretAltRightIcon as
|
|
17
|
-
import { useRowSync as
|
|
18
|
-
import { useEditable as
|
|
19
|
-
import { useSchedulerViewItemsContext as
|
|
20
|
-
import { useSchedulerElementContext as
|
|
21
|
-
const
|
|
22
|
-
(e,
|
|
23
|
-
const { item:
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
() =>
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
import * as i from "react";
|
|
9
|
+
import { SchedulerItem as oe } from "./SchedulerItem.mjs";
|
|
10
|
+
import { first as ce, calculateOrder as ae, intersects as z } from "../utils/index.mjs";
|
|
11
|
+
import { getRect as G, setRect as de } from "../views/common/utils.mjs";
|
|
12
|
+
import { BORDER_WIDTH as S } from "../constants/index.mjs";
|
|
13
|
+
import { useInternationalization as ue } from "@progress/kendo-react-intl";
|
|
14
|
+
import { SchedulerItemContent as W } from "./SchedulerItemContent.mjs";
|
|
15
|
+
import { useDir as me, IconWrap as x } from "@progress/kendo-react-common";
|
|
16
|
+
import { caretAltRightIcon as fe, caretAltLeftIcon as he, arrowRotateCwIcon as ge, arrowsNoRepeatIcon as we } from "@progress/kendo-svg-icons";
|
|
17
|
+
import { useRowSync as Se } from "../hooks/useRowSync.mjs";
|
|
18
|
+
import { useEditable as ve } from "../hooks/useEditable.mjs";
|
|
19
|
+
import { useSchedulerViewItemsContext as Ie, useSchedulerViewSlotsContext as Re } from "../context/SchedulerViewContext.mjs";
|
|
20
|
+
import { useSchedulerElementContext as ye } from "../context/SchedulerContext.mjs";
|
|
21
|
+
const Y = 1, $ = 25, Ee = i.forwardRef(
|
|
22
|
+
(e, K) => {
|
|
23
|
+
const { item: U, _ref: j, itemRef: J, ...Q } = e, b = i.useRef(void 0), d = i.useRef(null), O = i.useRef(null), _ = i.useRef(null), X = ve(e.editable);
|
|
24
|
+
i.useImperativeHandle(O, () => ({ props: e, element: d.current && d.current.element })), i.useImperativeHandle(K, () => O.current), i.useImperativeHandle(j, () => d.current), i.useImperativeHandle(J, () => d.current);
|
|
25
|
+
const Z = U || be.item, P = ue(), [p] = Ie(), [ee] = Re(), y = ye(), [te, H] = i.useState(!0), [re, ne] = i.useState(!1), f = i.useRef(e.order), F = i.useRef(0), T = me(y), M = i.useMemo(
|
|
26
|
+
() => {
|
|
27
|
+
var t, r;
|
|
28
|
+
return e.isAllDay ? (t = e.title) != null ? t : "" : `(${P.format("{0:t} - {1:t}", e.zonedStart, e.zonedEnd)}): ${(r = e.title) != null ? r : ""}`;
|
|
29
|
+
},
|
|
30
|
+
[P, e.isAllDay, e.title, e.zonedEnd, e.zonedStart]
|
|
31
|
+
), k = (t, r) => {
|
|
29
32
|
let c = 1;
|
|
30
|
-
return
|
|
31
|
-
const a = r.filter((
|
|
33
|
+
return t.forEach((l) => {
|
|
34
|
+
const a = r.filter((m) => D(l.current.props, m.props));
|
|
32
35
|
a.length > c && (c = a.length);
|
|
33
36
|
}), c;
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
}, ie = (t, r) => t.map((l) => r.filter((a) => D(l.current.props, a.props))), le = (t, r) => {
|
|
38
|
+
var E;
|
|
39
|
+
const c = r.filter((n) => n.props.order !== null && n.props.order !== void 0).map((n) => {
|
|
40
|
+
let u = n.props.start, s = n.props.end;
|
|
41
|
+
return n.props.isAllDay && (u = new Date(u.getFullYear(), u.getMonth(), u.getDate()), s = new Date(s.getFullYear(), s.getMonth(), s.getDate())), { order: n.props.order, start: u, end: s };
|
|
42
|
+
}), l = Array.from(new Set(c.map((n) => n.order))).sort((n, u) => n - u), a = /* @__PURE__ */ new Map();
|
|
43
|
+
for (const n of c)
|
|
44
|
+
a.has(n.order) || a.set(n.order, []), a.get(n.order).push({ start: n.start, end: n.end });
|
|
45
|
+
const m = [], w = /* @__PURE__ */ new Map();
|
|
46
|
+
for (const n of l) {
|
|
47
|
+
const u = a.get(n);
|
|
48
|
+
let s = -1;
|
|
49
|
+
for (let g = 0; g < m.length; g++)
|
|
50
|
+
if (u.every(
|
|
51
|
+
(v) => m[g].every((I) => !z(I.start, I.end, v.start, v.end, !0))
|
|
52
|
+
)) {
|
|
53
|
+
s = g;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
s === -1 && (s = m.length, m.push([])), m[s].push(...u), w.set(n, s);
|
|
57
|
+
}
|
|
58
|
+
return (E = w.get(t)) != null ? E : t;
|
|
59
|
+
}, D = (t, r) => z(t.start, t.end, r.start, r.end) && t.group.index === r.group.index && t.range.index === r.range.index && // When slotDuration equals a full day, both daySlots and timeSlots have isAllDay=true,
|
|
60
|
+
// so we need to also check range.isAllDay to distinguish between them.
|
|
61
|
+
(t.range.isAllDay === void 0 || r.range.isAllDay === void 0 || t.range.isAllDay === r.range.isAllDay) && (e.ignoreIsAllDay || t.isAllDay === r.isAllDay), A = () => {
|
|
62
|
+
var v, I, N, L, q;
|
|
63
|
+
const t = (ee || []).filter((o) => o.current && D(o.current.props, e)), r = d.current && d.current.element, c = ce(t);
|
|
64
|
+
if (t.length === 0) {
|
|
65
|
+
H(!1);
|
|
38
66
|
return;
|
|
39
67
|
}
|
|
40
68
|
if (!c.current || !r)
|
|
41
69
|
return;
|
|
42
|
-
const
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
const l = G(c.current.element), a = [], m = [], w = [];
|
|
71
|
+
(p || []).forEach((o) => {
|
|
72
|
+
o.current && (o.current.props.dragHint ? m.push(o.current) : o.current.props.resizeHint ? w.push(o.current) : a.push(o.current));
|
|
73
|
+
});
|
|
74
|
+
const E = e.dragHint || e.resizeHint ? ae(
|
|
75
|
+
d.current,
|
|
76
|
+
e.dragHint ? m : w,
|
|
77
|
+
t,
|
|
49
78
|
e.ignoreIsAllDay
|
|
50
|
-
) : e.order
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
79
|
+
) : (v = e.order) != null ? v : 0;
|
|
80
|
+
if (!e.vertical && !(e.dragHint || e.resizeHint) && e.order !== null && e.order !== void 0) {
|
|
81
|
+
const o = a.filter((R) => R.props.isAllDay);
|
|
82
|
+
f.current = le(e.order, o);
|
|
83
|
+
} else
|
|
84
|
+
f.current = E;
|
|
85
|
+
let n = e.dragHint || e.resizeHint ? k(t, e.dragHint ? m : w) : k(t, a);
|
|
86
|
+
const u = ie(t, a);
|
|
87
|
+
let s = 0;
|
|
88
|
+
const g = !e.vertical && f.current !== null;
|
|
89
|
+
if (u.forEach((o) => {
|
|
90
|
+
let R = 0;
|
|
91
|
+
o.forEach((h) => {
|
|
92
|
+
if (z(h.props.start, h.props.end, e.start, e.end) && !(e.dragHint || e.resizeHint) && h._maxSiblingsPerSlot && h._maxSiblingsPerSlot > n && h.element !== r && (n = h._maxSiblingsPerSlot), !g) {
|
|
93
|
+
const B = G(h.element);
|
|
94
|
+
h.props.order !== null && h.props.order !== void 0 && h.props.order < f.current && (R = B.top + B.height - l.top - S * f.current + Y);
|
|
95
|
+
}
|
|
96
|
+
}), R > s && (s = R);
|
|
97
|
+
}), g) {
|
|
98
|
+
const o = (N = (I = e.style) == null ? void 0 : I.height) != null ? N : $;
|
|
99
|
+
s = f.current * (o + Y);
|
|
100
|
+
}
|
|
101
|
+
if (t.length === 0) {
|
|
102
|
+
H(!1);
|
|
63
103
|
return;
|
|
64
104
|
}
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
}, C =
|
|
68
|
-
(
|
|
69
|
-
const r =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})),
|
|
105
|
+
const V = X.add ? 20 : 0;
|
|
106
|
+
l.width = e.vertical ? l.width / n - S - V / n : l.width * t.length - S, e.vertical ? l.height = l.height * t.length - S : (e.resizeHint || e.dragHint) && n <= 1 || (l.height = (q = (L = e.style) == null ? void 0 : L.height) != null ? q : $), l.left = e.vertical ? l.left + f.current * l.width + S * f.current : l.left, l.top = e.vertical ? l.top : l.top + s + S * f.current, F.current = n, de(r, l), ne(!0), H(!0);
|
|
107
|
+
}, C = i.useCallback(
|
|
108
|
+
(t) => {
|
|
109
|
+
const r = t && t[0], c = _.current;
|
|
110
|
+
b.current !== void 0 && window.cancelAnimationFrame(b.current), c && r && (c.width !== r.contentRect.width || c.height !== r.contentRect.height) && (b.current = window.requestAnimationFrame(() => {
|
|
111
|
+
A();
|
|
112
|
+
})), _.current = { width: r.contentRect.width, height: r.contentRect.height };
|
|
73
113
|
},
|
|
74
|
-
[
|
|
114
|
+
[A]
|
|
75
115
|
);
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
return
|
|
79
|
-
element:
|
|
116
|
+
i.useEffect(A);
|
|
117
|
+
const se = d.current && d.current.element ? d.current.element.closest(".k-scheduler-layout") : null;
|
|
118
|
+
return Se({
|
|
119
|
+
element: se,
|
|
80
120
|
selector: ".k-resource-row",
|
|
81
121
|
horizontalAttribute: "data-depth-index",
|
|
82
122
|
verticalAttribute: "data-resource-index",
|
|
83
123
|
applyTo: ".k-resource-cell",
|
|
84
124
|
syncHeight: e.isLast
|
|
85
|
-
}),
|
|
86
|
-
if (!
|
|
125
|
+
}), i.useEffect(() => {
|
|
126
|
+
if (!y.current)
|
|
87
127
|
return;
|
|
88
|
-
const
|
|
89
|
-
return r && r.observe(
|
|
128
|
+
const t = window.ResizeObserver, r = t && new t(C);
|
|
129
|
+
return r && r.observe(y.current), () => {
|
|
90
130
|
r && r.disconnect();
|
|
91
131
|
};
|
|
92
|
-
}, [C,
|
|
93
|
-
|
|
132
|
+
}, [C, y]), /* @__PURE__ */ i.createElement(
|
|
133
|
+
Z,
|
|
94
134
|
{
|
|
95
|
-
...
|
|
96
|
-
_ref:
|
|
97
|
-
_maxSiblingsPerSlot:
|
|
98
|
-
_order:
|
|
99
|
-
itemRef:
|
|
135
|
+
...Q,
|
|
136
|
+
_ref: d,
|
|
137
|
+
_maxSiblingsPerSlot: F,
|
|
138
|
+
_order: f,
|
|
139
|
+
itemRef: d,
|
|
100
140
|
style: {
|
|
101
|
-
visibility:
|
|
102
|
-
display:
|
|
141
|
+
visibility: re ? void 0 : "hidden",
|
|
142
|
+
display: te ? void 0 : "none",
|
|
103
143
|
...e.style
|
|
104
144
|
}
|
|
105
145
|
},
|
|
106
|
-
!e.resizeHint && /* @__PURE__ */
|
|
107
|
-
|
|
146
|
+
!e.resizeHint && /* @__PURE__ */ i.createElement("span", { className: "k-event-actions" }, e.tail && /* @__PURE__ */ i.createElement(
|
|
147
|
+
x,
|
|
108
148
|
{
|
|
109
|
-
name:
|
|
110
|
-
icon:
|
|
149
|
+
name: T === "rtl" ? "caret-alt-right" : "caret-alt-left",
|
|
150
|
+
icon: T === "rtl" ? fe : he
|
|
111
151
|
}
|
|
112
|
-
), e.isRecurring && !e.isException && /* @__PURE__ */
|
|
113
|
-
!e.resizeHint && /* @__PURE__ */
|
|
152
|
+
), e.isRecurring && !e.isException && /* @__PURE__ */ i.createElement(x, { name: "arrow-rotate-cw", icon: ge }), !e.isRecurring && e.isException && /* @__PURE__ */ i.createElement(x, { name: "arrows-no-repeat", icon: we })),
|
|
153
|
+
!e.resizeHint && /* @__PURE__ */ i.createElement("div", { title: M }, !e.isAllDay && /* @__PURE__ */ i.createElement(W, { className: "k-event-time" }, M), /* @__PURE__ */ i.createElement(W, null, e.title))
|
|
114
154
|
);
|
|
115
155
|
}
|
|
116
|
-
),
|
|
117
|
-
item:
|
|
156
|
+
), be = {
|
|
157
|
+
item: oe
|
|
118
158
|
};
|
|
119
|
-
|
|
159
|
+
Ee.displayName = "KendoReactSchedulerViewItem";
|
|
120
160
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
161
|
+
Ee as SchedulerViewItem,
|
|
162
|
+
be as schedulerViewItemDefaultProps
|
|
123
163
|
};
|
package/package-metadata.js
CHANGED
|
@@ -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 e=Object.freeze({name:"@progress/kendo-react-scheduler",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-scheduler",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1771496371,version:"14.2.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui"});exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -7,6 +7,6 @@ export const packageMetadata = Object.freeze({
|
|
|
7
7
|
productCode: 'KENDOUIREACT',
|
|
8
8
|
productCodes: ['KENDOUIREACT'],
|
|
9
9
|
publishDate: 1607496606,
|
|
10
|
-
version: '14.
|
|
10
|
+
version: '14.2.0-develop.1',
|
|
11
11
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui'
|
|
12
12
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-scheduler",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.2.0-develop.1",
|
|
4
4
|
"description": "React Scheduler brings the functionality of Outlook's Calendar to a single UI component. KendoReact Scheduler package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"@progress/kendo-date-math": "^1.4.1",
|
|
30
30
|
"@progress/kendo-drawing": "^1.21.2",
|
|
31
31
|
"@progress/kendo-licensing": "^1.7.2",
|
|
32
|
-
"@progress/kendo-react-buttons": "14.
|
|
33
|
-
"@progress/kendo-react-common": "14.
|
|
34
|
-
"@progress/kendo-react-dateinputs": "14.
|
|
35
|
-
"@progress/kendo-react-dialogs": "14.
|
|
36
|
-
"@progress/kendo-react-dropdowns": "14.
|
|
37
|
-
"@progress/kendo-react-form": "14.
|
|
38
|
-
"@progress/kendo-react-inputs": "14.
|
|
39
|
-
"@progress/kendo-react-intl": "14.
|
|
40
|
-
"@progress/kendo-react-popup": "14.
|
|
32
|
+
"@progress/kendo-react-buttons": "14.2.0-develop.1",
|
|
33
|
+
"@progress/kendo-react-common": "14.2.0-develop.1",
|
|
34
|
+
"@progress/kendo-react-dateinputs": "14.2.0-develop.1",
|
|
35
|
+
"@progress/kendo-react-dialogs": "14.2.0-develop.1",
|
|
36
|
+
"@progress/kendo-react-dropdowns": "14.2.0-develop.1",
|
|
37
|
+
"@progress/kendo-react-form": "14.2.0-develop.1",
|
|
38
|
+
"@progress/kendo-react-inputs": "14.2.0-develop.1",
|
|
39
|
+
"@progress/kendo-react-intl": "14.2.0-develop.1",
|
|
40
|
+
"@progress/kendo-react-popup": "14.2.0-develop.1",
|
|
41
41
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
42
42
|
"react": "^18.0.0 || ^19.0.0",
|
|
43
43
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"package": {
|
|
68
68
|
"productName": "KendoReact",
|
|
69
69
|
"productCode": "KENDOUIREACT",
|
|
70
|
-
"publishDate":
|
|
70
|
+
"publishDate": 1771496371,
|
|
71
71
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui"
|
|
72
72
|
}
|
|
73
73
|
},
|
package/utils/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare const isGroupped: (resources: any) => boolean;
|
|
|
24
24
|
/**
|
|
25
25
|
* @hidden
|
|
26
26
|
*/
|
|
27
|
-
export declare function formatEventTime(intl: IntlService, start: Date, end: Date, isAllDay: boolean): string;
|
|
27
|
+
export declare function formatEventTime(intl: IntlService, start: Date, end: Date, isAllDay: boolean, allDayText?: string): string;
|
|
28
28
|
/**
|
|
29
29
|
* @hidden
|
|
30
30
|
* TODO Move to date-math
|