@progress/kendo-react-scheduler 16.1.0-develop.6 → 16.1.0-develop.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-react-scheduler.js +1 -1
- package/items/SchedulerProportionalViewItem.js +1 -1
- package/items/SchedulerProportionalViewItem.mjs +94 -97
- package/items/SchedulerViewItem.js +1 -1
- package/items/SchedulerViewItem.mjs +124 -124
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +12 -12
|
@@ -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 ge=require("react"),ve=require("./SchedulerItem.js"),h=require("../utils/index.js"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ge=require("react"),ve=require("./SchedulerItem.js"),h=require("../utils/index.js"),O=require("../views/common/utils.js"),R=require("../constants/index.js"),Ie=require("@progress/kendo-react-intl"),J=require("./SchedulerItemContent.js"),f=require("@progress/kendo-react-common"),m=require("@progress/kendo-svg-icons"),Q=require("../context/SchedulerViewContext.js"),we=require("../context/SchedulerContext.js"),Re=require("../hooks/useRowSync.js");function Se(e){const S=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const I in e)if(I!=="default"){const x=Object.getOwnPropertyDescriptor(e,I);Object.defineProperty(S,I,x.get?x:{enumerable:!0,get:()=>e[I]})}}return S.default=e,Object.freeze(S)}const t=Se(ge),Ee=1,X=12,Y=t.forwardRef((e,S)=>{const{item:I,_ref:x,itemRef:ee,...te}=e,k=t.useRef(void 0),o=t.useRef(null),C=t.useRef(null),W=t.useRef(null);t.useImperativeHandle(C,()=>({props:e,element:o.current&&o.current.element})),t.useImperativeHandle(S,()=>C.current),t.useImperativeHandle(x,()=>o.current),t.useImperativeHandle(ee,()=>o.current);const ne=I||Z.item,_=Ie.useInternationalization(),[re]=Q.useSchedulerViewItemsContext(),[ce]=Q.useSchedulerViewSlotsContext(),M=we.useSchedulerElementContext(),[ie,V]=t.useState(!0),[oe,ae]=t.useState(!1),p=t.useRef(0),g=t.useRef(null),E=t.useRef([]),H=f.useDir(M),se=t.useMemo(()=>{var r,n;return e.isAllDay?(r=e.title)!=null?r:"":`(${_.format("{0:t} - {1:t}",e.zonedStart,e.zonedEnd)}): ${(n=e.title)!=null?n:""}`},[_,e.isAllDay,e.title,e.zonedEnd,e.zonedStart]);let v;e.isRecurring&&!e.isException?v="recurring":!e.isRecurring&&e.isException&&(v="non-recurring");const le=t.useMemo(()=>_.format("{0:t} – {1:t}",e.zonedStart,e.zonedEnd),[_,e.zonedStart,e.zonedEnd]),ue=(r,n)=>{var d;let i=(d=r._order)!=null?d:0;return n.forEach(a=>{a._order!==void 0&&a._order!==null&&i<a._order&&(i=a._order)}),i+1},me=(r,n,i)=>{const[d,a]=n,l=new Date(Math.min(a.props.end.getTime()-i,Math.max(e.start.getTime(),d.props.start.getTime()))),w=new Date(Math.max(l.getTime()+i,Math.min(e.end.getTime(),a.props.end.getTime())));return r.filter(u=>{const z=Math.max(Math.min(a.props.end.getTime()-i,u.props.start.getTime()),d.props.start.getTime()),T=Math.min(Math.max(z+i,u.props.end.getTime()),a.props.end.getTime());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)&&h.intersects(new Date(z),new Date(T),l,w)&&h.intersects(d.props.start,a.props.end,u.props.start,u.props.end)})},de=(r,n)=>r.group.index===n.group.index&&r.range.index===n.range.index&&(r.range.isAllDay===void 0||n.range.isAllDay===void 0||r.range.isAllDay===n.range.isAllDay)&&(e.ignoreIsAllDay||r.isAllDay===n.isAllDay),P=()=>{var L,$,G,K,U;const r=ce.filter(c=>c.current&&de(c.current.props,e)).sort((c,y)=>c.current.props.start.getTime()-y.current.props.start.getTime()),n=r.filter(c=>h.intersects(c.current.props.start,c.current.props.end,e.start,e.end)),i=o.current&&o.current.element;if(!i||!n.length)return;const d=h.first(r),a=h.last(r),l=h.first(n),w=h.last(n);if(!l.current||!o.current||!w.current||!d.current||!a.current)return;if(!h.intersects(l.current.props.start,w.current.props.end,e.start,e.end)){V(!1);return}const b=[],u=[],z=[],T=O.getRect(l.current.element),N=(e.vertical?T.height:T.width)/(l.current.props.end.getTime()-l.current.props.start.getTime()),j=(e.vertical?X:8)/N,A=(Math.min(e.start.getTime(),w.current.props.end.getTime()-j)-l.current.props.start.getTime())*N,F=Math.floor(Math.min(e.end.getTime(),w.current.props.end.getTime())-Math.max(e.start.getTime(),l.current.props.start.getTime()))*N;(re||[]).forEach(c=>{c.current&&(c.current.props.dragHint?u.push(c.current):c.current.props.resizeHint?z.push(c.current):b.push(c.current))}),E.current=me(b,[d.current,a.current],j),g.current=e.resizeHint||e.dragHint?0:h.calculateProportionalOrder(o.current,E.current);let D=1;e.resizeHint||e.dragHint||(D=ue(o.current,E.current));let q=0;const s=T;E.current.forEach(c=>{let y=0;c._order!==void 0&&c._order!==null&&c._order<g.current&&(y=O.getRect(c.element).top+O.getRect(c.element).height-s.top-R.BORDER_WIDTH*g.current+Ee),y>q&&(q=y)});const fe=20;s.width=e.vertical?s.width/D-R.BORDER_WIDTH-fe/D:F-R.BORDER_WIDTH,e.vertical?s.height=F-R.BORDER_WIDTH:(e.resizeHint||e.dragHint)&&D<=1||(s.height=($=(L=e.style)==null?void 0:L.height)!=null?$:X),s.left=e.vertical?s.left+((G=g.current)!=null?G:0)+R.BORDER_WIDTH*((K=g.current)!=null?K:0)*s.width:s.left+(A<0?0:A),s.top=e.vertical?s.top+(A<0?0:A):s.top+q+R.BORDER_WIDTH*((U=g.current)!=null?U:0),p.current=D,O.setRect(i,s),ae(!0),V(!0)},B=t.useCallback(r=>{const n=r&&r[0],i=W.current;k.current!==void 0&&window.cancelAnimationFrame(k.current),i&&n&&(i.width!==n.contentRect.width||i.height!==n.contentRect.height)&&(k.current=window.requestAnimationFrame(()=>{P()})),W.current={width:n.contentRect.width,height:n.contentRect.height}},[P]);t.useEffect(P);const he=o.current&&o.current.element?o.current.element.closest(".k-scheduler-layout"):null;return Re.useRowSync({element:he,selector:".k-resource-row",horizontalAttribute:"data-depth-index",verticalAttribute:"data-resource-index",applyTo:".k-resource-cell",syncHeight:e.isLast}),t.useEffect(()=>{if(!M.current)return;const r=window.ResizeObserver,n=r&&new r(B);return n&&n.observe(M.current),()=>{n&&n.disconnect()}},[B,M]),t.createElement(ne,{...te,_ref:o,_order:g,_maxSiblingsPerSlot:p,_siblings:E,itemRef:o,style:{visibility:oe?void 0:"hidden",display:ie?void 0:"none",...e.style}},!e.resizeHint&&t.createElement(t.Fragment,null,e.tail&&!e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(f.IconWrap,{name:H==="rtl"?"chevron-right":"chevron-left",icon:H==="rtl"?m.chevronRightIcon:m.chevronLeftIcon})),t.createElement("div",{title:se},e.tail&&e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(f.IconWrap,{name:"chevron-up",icon:m.chevronUpIcon})),t.createElement(J.SchedulerItemContent,{className:"k-event-title"},e.title),!e.isAllDay&&t.createElement(J.SchedulerItemContent,{className:"k-event-time"},v==="recurring"&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(f.IconWrap,{name:"arrow-rotate-cw",icon:m.arrowRotateCwIcon})),v==="non-recurring"&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(f.IconWrap,{name:"arrows-no-repeat",icon:m.arrowsNoRepeatIcon})),le),e.head&&e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(f.IconWrap,{name:"chevron-down",icon:m.chevronDownIcon}))),v&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(f.IconWrap,{name:v==="recurring"?"arrow-rotate-cw":"arrows-no-repeat",icon:v==="recurring"?m.arrowRotateCwIcon:m.arrowsNoRepeatIcon})),e.head&&!e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(f.IconWrap,{name:H==="rtl"?"chevron-left":"chevron-right",icon:H==="rtl"?m.chevronLeftIcon:m.chevronRightIcon}))))}),Z={item:ve.SchedulerItem};Y.displayName="KendoReactSchedulerProportionalViewItem";exports.SchedulerProportionalViewItem=Y;exports.schedulerProportionalViewItemDefaultProps=Z;
|
|
@@ -6,105 +6,102 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import { SchedulerItem as
|
|
10
|
-
import { intersects as
|
|
11
|
-
import { getRect as
|
|
12
|
-
import { BORDER_WIDTH as
|
|
13
|
-
import { useInternationalization as
|
|
9
|
+
import { SchedulerItem as we } from "./SchedulerItem.mjs";
|
|
10
|
+
import { intersects as M, first as B, last as K, calculateProportionalOrder as Ee } from "../utils/index.mjs";
|
|
11
|
+
import { getRect as N, setRect as Se } from "../views/common/utils.mjs";
|
|
12
|
+
import { BORDER_WIDTH as v } from "../constants/index.mjs";
|
|
13
|
+
import { useInternationalization as Ie } from "@progress/kendo-react-intl";
|
|
14
14
|
import { SchedulerItemContent as U } from "./SchedulerItemContent.mjs";
|
|
15
|
-
import { useDir as
|
|
16
|
-
import { chevronRightIcon as j, chevronLeftIcon as J, chevronUpIcon as
|
|
17
|
-
import { useSchedulerViewItemsContext as
|
|
18
|
-
import { useSchedulerElementContext as
|
|
19
|
-
import { useRowSync as
|
|
20
|
-
const
|
|
15
|
+
import { useDir as Re, IconWrap as f } from "@progress/kendo-react-common";
|
|
16
|
+
import { chevronRightIcon as j, chevronLeftIcon as J, chevronUpIcon as Te, arrowRotateCwIcon as Q, arrowsNoRepeatIcon as X, chevronDownIcon as ye } from "@progress/kendo-svg-icons";
|
|
17
|
+
import { useSchedulerViewItemsContext as xe, useSchedulerViewSlotsContext as De } from "../context/SchedulerViewContext.mjs";
|
|
18
|
+
import { useSchedulerElementContext as Me } from "../context/SchedulerContext.mjs";
|
|
19
|
+
import { useRowSync as ze } from "../hooks/useRowSync.mjs";
|
|
20
|
+
const _e = 1, Y = 12, Ae = t.forwardRef(
|
|
21
21
|
(e, Z) => {
|
|
22
|
-
const { item: ee, _ref: te, itemRef: re, ...ne } = e,
|
|
23
|
-
t.useImperativeHandle(
|
|
24
|
-
const
|
|
22
|
+
const { item: ee, _ref: te, itemRef: re, ...ne } = e, z = t.useRef(void 0), a = t.useRef(null), P = t.useRef(null), b = t.useRef(null);
|
|
23
|
+
t.useImperativeHandle(P, () => ({ props: e, element: a.current && a.current.element })), t.useImperativeHandle(Z, () => P.current), t.useImperativeHandle(te, () => a.current), t.useImperativeHandle(re, () => a.current);
|
|
24
|
+
const ce = ee || He.item, R = Ie(), [ie] = xe(), [ae] = De(), T = Me(), [oe, C] = t.useState(!0), [se, le] = t.useState(!1), O = t.useRef(0), d = t.useRef(null), w = t.useRef([]), y = Re(T), ue = t.useMemo(
|
|
25
25
|
() => {
|
|
26
|
-
var
|
|
27
|
-
return e.isAllDay ? (
|
|
26
|
+
var n, r;
|
|
27
|
+
return e.isAllDay ? (n = e.title) != null ? n : "" : `(${R.format("{0:t} - {1:t}", e.zonedStart, e.zonedEnd)}): ${(r = e.title) != null ? r : ""}`;
|
|
28
28
|
},
|
|
29
|
-
[
|
|
29
|
+
[R, e.isAllDay, e.title, e.zonedEnd, e.zonedStart]
|
|
30
30
|
);
|
|
31
|
-
let
|
|
32
|
-
e.isRecurring && !e.isException ?
|
|
33
|
-
const
|
|
34
|
-
() =>
|
|
35
|
-
[
|
|
36
|
-
), de = (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
let h;
|
|
32
|
+
e.isRecurring && !e.isException ? h = "recurring" : !e.isRecurring && e.isException && (h = "non-recurring");
|
|
33
|
+
const me = t.useMemo(
|
|
34
|
+
() => R.format("{0:t} – {1:t}", e.zonedStart, e.zonedEnd),
|
|
35
|
+
[R, e.zonedStart, e.zonedEnd]
|
|
36
|
+
), de = (n, r) => {
|
|
37
|
+
var m;
|
|
38
|
+
let i = (m = n._order) != null ? m : 0;
|
|
39
|
+
return r.forEach((o) => {
|
|
40
|
+
o._order !== void 0 && o._order !== null && i < o._order && (i = o._order);
|
|
41
|
+
}), i + 1;
|
|
42
|
+
}, he = (n, r, i) => {
|
|
43
|
+
const [m, o] = r, l = new Date(
|
|
43
44
|
Math.min(
|
|
44
|
-
|
|
45
|
-
Math.max(e.start.getTime(),
|
|
45
|
+
o.props.end.getTime() - i,
|
|
46
|
+
Math.max(e.start.getTime(), m.props.start.getTime())
|
|
46
47
|
)
|
|
47
|
-
),
|
|
48
|
-
Math.max(
|
|
48
|
+
), g = new Date(
|
|
49
|
+
Math.max(l.getTime() + i, Math.min(e.end.getTime(), o.props.end.getTime()))
|
|
49
50
|
);
|
|
50
|
-
return
|
|
51
|
-
const
|
|
52
|
-
Math.min(
|
|
53
|
-
|
|
51
|
+
return n.filter((u) => {
|
|
52
|
+
const x = Math.max(
|
|
53
|
+
Math.min(o.props.end.getTime() - i, u.props.start.getTime()),
|
|
54
|
+
m.props.start.getTime()
|
|
54
55
|
), E = Math.min(
|
|
55
|
-
Math.max(
|
|
56
|
-
|
|
56
|
+
Math.max(x + i, u.props.end.getTime()),
|
|
57
|
+
o.props.end.getTime()
|
|
57
58
|
);
|
|
58
|
-
return
|
|
59
|
+
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) && M(new Date(x), new Date(E), l, g) && M(m.props.start, o.props.end, u.props.start, u.props.end);
|
|
59
60
|
});
|
|
60
|
-
},
|
|
61
|
+
}, fe = (n, r) => 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,
|
|
61
62
|
// so we need to also check range.isAllDay to distinguish between them.
|
|
62
|
-
(
|
|
63
|
+
(n.range.isAllDay === void 0 || r.range.isAllDay === void 0 || n.range.isAllDay === r.range.isAllDay) && (e.ignoreIsAllDay || n.isAllDay === r.isAllDay), _ = () => {
|
|
63
64
|
var G, L, W, $, q;
|
|
64
|
-
const
|
|
65
|
-
(
|
|
66
|
-
),
|
|
67
|
-
if (!
|
|
65
|
+
const n = ae.filter((c) => c.current && fe(c.current.props, e)).sort((c, I) => c.current.props.start.getTime() - I.current.props.start.getTime()), r = n.filter(
|
|
66
|
+
(c) => M(c.current.props.start, c.current.props.end, e.start, e.end)
|
|
67
|
+
), i = a.current && a.current.element;
|
|
68
|
+
if (!i || !r.length)
|
|
68
69
|
return;
|
|
69
|
-
const
|
|
70
|
-
if (!
|
|
70
|
+
const m = B(n), o = K(n), l = B(r), g = K(r);
|
|
71
|
+
if (!l.current || !a.current || !g.current || !m.current || !o.current)
|
|
71
72
|
return;
|
|
72
|
-
if (!
|
|
73
|
+
if (!M(l.current.props.start, g.current.props.end, e.start, e.end)) {
|
|
73
74
|
C(!1);
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
const A = [],
|
|
77
|
-
Math.min(e.end.getTime(),
|
|
78
|
-
) *
|
|
79
|
-
(
|
|
80
|
-
|
|
81
|
-
}),
|
|
82
|
-
let
|
|
83
|
-
e.resizeHint || e.dragHint || (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const o = E;
|
|
90
|
-
h.current.forEach((r) => {
|
|
91
|
-
let x = 0;
|
|
92
|
-
r._order !== void 0 && r._order !== null && r._order < f.current && (x = k(r.element).top + k(r.element).height - o.top - w * f.current + ze), x > H && (H = x);
|
|
77
|
+
const A = [], u = [], x = [], E = N(l.current.element), H = (e.vertical ? E.height : E.width) / (l.current.props.end.getTime() - l.current.props.start.getTime()), F = (e.vertical ? Y : 8) / H, D = (Math.min(e.start.getTime(), g.current.props.end.getTime() - F) - l.current.props.start.getTime()) * H, p = Math.floor(
|
|
78
|
+
Math.min(e.end.getTime(), g.current.props.end.getTime()) - Math.max(e.start.getTime(), l.current.props.start.getTime())
|
|
79
|
+
) * H;
|
|
80
|
+
(ie || []).forEach((c) => {
|
|
81
|
+
c.current && (c.current.props.dragHint ? u.push(c.current) : c.current.props.resizeHint ? x.push(c.current) : A.push(c.current));
|
|
82
|
+
}), w.current = he(A, [m.current, o.current], F), d.current = e.resizeHint || e.dragHint ? 0 : Ee(a.current, w.current);
|
|
83
|
+
let S = 1;
|
|
84
|
+
e.resizeHint || e.dragHint || (S = de(a.current, w.current));
|
|
85
|
+
let k = 0;
|
|
86
|
+
const s = E;
|
|
87
|
+
w.current.forEach((c) => {
|
|
88
|
+
let I = 0;
|
|
89
|
+
c._order !== void 0 && c._order !== null && c._order < d.current && (I = N(c.element).top + N(c.element).height - s.top - v * d.current + _e), I > k && (k = I);
|
|
93
90
|
});
|
|
94
91
|
const ve = 20;
|
|
95
|
-
|
|
92
|
+
s.width = e.vertical ? s.width / S - v - ve / S : p - v, e.vertical ? s.height = p - v : (e.resizeHint || e.dragHint) && S <= 1 || (s.height = (L = (G = e.style) == null ? void 0 : G.height) != null ? L : Y), s.left = e.vertical ? s.left + ((W = d.current) != null ? W : 0) + v * (($ = d.current) != null ? $ : 0) * s.width : s.left + (D < 0 ? 0 : D), s.top = e.vertical ? s.top + (D < 0 ? 0 : D) : s.top + k + v * ((q = d.current) != null ? q : 0), O.current = S, Se(i, s), le(!0), C(!0);
|
|
96
93
|
}, V = t.useCallback(
|
|
97
|
-
(
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
})), b.current = { width:
|
|
94
|
+
(n) => {
|
|
95
|
+
const r = n && n[0], i = b.current;
|
|
96
|
+
z.current !== void 0 && window.cancelAnimationFrame(z.current), i && r && (i.width !== r.contentRect.width || i.height !== r.contentRect.height) && (z.current = window.requestAnimationFrame(() => {
|
|
97
|
+
_();
|
|
98
|
+
})), b.current = { width: r.contentRect.width, height: r.contentRect.height };
|
|
102
99
|
},
|
|
103
|
-
[
|
|
100
|
+
[_]
|
|
104
101
|
);
|
|
105
|
-
t.useEffect(
|
|
102
|
+
t.useEffect(_);
|
|
106
103
|
const ge = a.current && a.current.element ? a.current.element.closest(".k-scheduler-layout") : null;
|
|
107
|
-
return
|
|
104
|
+
return ze({
|
|
108
105
|
element: ge,
|
|
109
106
|
selector: ".k-resource-row",
|
|
110
107
|
horizontalAttribute: "data-depth-index",
|
|
@@ -112,53 +109,53 @@ const ze = 1, Y = 12, Ae = t.forwardRef(
|
|
|
112
109
|
applyTo: ".k-resource-cell",
|
|
113
110
|
syncHeight: e.isLast
|
|
114
111
|
}), t.useEffect(() => {
|
|
115
|
-
if (!
|
|
112
|
+
if (!T.current)
|
|
116
113
|
return;
|
|
117
|
-
const
|
|
118
|
-
return
|
|
119
|
-
|
|
114
|
+
const n = window.ResizeObserver, r = n && new n(V);
|
|
115
|
+
return r && r.observe(T.current), () => {
|
|
116
|
+
r && r.disconnect();
|
|
120
117
|
};
|
|
121
|
-
}, [V,
|
|
122
|
-
|
|
118
|
+
}, [V, T]), /* @__PURE__ */ t.createElement(
|
|
119
|
+
ce,
|
|
123
120
|
{
|
|
124
121
|
...ne,
|
|
125
122
|
_ref: a,
|
|
126
|
-
_order:
|
|
123
|
+
_order: d,
|
|
127
124
|
_maxSiblingsPerSlot: O,
|
|
128
|
-
_siblings:
|
|
125
|
+
_siblings: w,
|
|
129
126
|
itemRef: a,
|
|
130
127
|
style: {
|
|
131
|
-
visibility:
|
|
128
|
+
visibility: se ? void 0 : "hidden",
|
|
132
129
|
display: oe ? void 0 : "none",
|
|
133
130
|
...e.style
|
|
134
131
|
}
|
|
135
132
|
},
|
|
136
133
|
!e.resizeHint && /* @__PURE__ */ t.createElement(t.Fragment, null, e.tail && !e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(
|
|
137
|
-
|
|
134
|
+
f,
|
|
138
135
|
{
|
|
139
|
-
name:
|
|
140
|
-
icon:
|
|
136
|
+
name: y === "rtl" ? "chevron-right" : "chevron-left",
|
|
137
|
+
icon: y === "rtl" ? j : J
|
|
141
138
|
}
|
|
142
|
-
)), /* @__PURE__ */ t.createElement("div", { title:
|
|
143
|
-
|
|
139
|
+
)), /* @__PURE__ */ t.createElement("div", { title: ue }, e.tail && e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(f, { name: "chevron-up", icon: Te })), /* @__PURE__ */ t.createElement(U, { className: "k-event-title" }, e.title), !e.isAllDay && /* @__PURE__ */ t.createElement(U, { className: "k-event-time" }, h === "recurring" && /* @__PURE__ */ t.createElement("span", { className: "k-event-recurrence-icon" }, /* @__PURE__ */ t.createElement(f, { name: "arrow-rotate-cw", icon: Q })), h === "non-recurring" && /* @__PURE__ */ t.createElement("span", { className: "k-event-recurrence-icon" }, /* @__PURE__ */ t.createElement(f, { name: "arrows-no-repeat", icon: X })), me), e.head && e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(f, { name: "chevron-down", icon: ye }))), h && /* @__PURE__ */ t.createElement("span", { className: "k-event-recurrence-icon" }, /* @__PURE__ */ t.createElement(
|
|
140
|
+
f,
|
|
144
141
|
{
|
|
145
|
-
name:
|
|
146
|
-
icon:
|
|
142
|
+
name: h === "recurring" ? "arrow-rotate-cw" : "arrows-no-repeat",
|
|
143
|
+
icon: h === "recurring" ? Q : X
|
|
147
144
|
}
|
|
148
145
|
)), e.head && !e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(
|
|
149
|
-
|
|
146
|
+
f,
|
|
150
147
|
{
|
|
151
|
-
name:
|
|
152
|
-
icon:
|
|
148
|
+
name: y === "rtl" ? "chevron-left" : "chevron-right",
|
|
149
|
+
icon: y === "rtl" ? J : j
|
|
153
150
|
}
|
|
154
151
|
)))
|
|
155
152
|
);
|
|
156
153
|
}
|
|
157
|
-
),
|
|
158
|
-
item:
|
|
154
|
+
), He = {
|
|
155
|
+
item: we
|
|
159
156
|
};
|
|
160
157
|
Ae.displayName = "KendoReactSchedulerProportionalViewItem";
|
|
161
158
|
export {
|
|
162
159
|
Ae as SchedulerProportionalViewItem,
|
|
163
|
-
|
|
160
|
+
He as schedulerProportionalViewItemDefaultProps
|
|
164
161
|
};
|
|
@@ -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 Re=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Re=require("react"),ye=require("./SchedulerItem.js"),q=require("../utils/index.js"),U=require("../views/common/utils.js"),F=require("../constants/index.js"),Ee=require("@progress/kendo-react-intl"),te=require("./SchedulerItemContent.js"),A=require("@progress/kendo-react-common"),I=require("@progress/kendo-svg-icons"),De=require("../hooks/useEditable.js"),ne=require("../context/SchedulerViewContext.js"),Se=require("../context/SchedulerContext.js"),be=require("../hooks/useRowSync.js");function Ae(e){const _=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const O in e)if(O!=="default"){const M=Object.getOwnPropertyDescriptor(e,O);Object.defineProperty(_,O,M.get?M:{enumerable:!0,get:()=>e[O]})}}return _.default=e,Object.freeze(_)}const t=Ae(Re),j=1,K=25,re=t.forwardRef((e,_)=>{const{item:O,_ref:M,itemRef:ce,...oe}=e,L=t.useRef(void 0),E=t.useRef(void 0),m=t.useRef(null),J=t.useRef(null),Q=t.useRef(null),le=De.useEditable(e.editable);t.useImperativeHandle(J,()=>({props:e,element:m.current&&m.current.element})),t.useImperativeHandle(_,()=>J.current),t.useImperativeHandle(M,()=>m.current),t.useImperativeHandle(ce,()=>m.current);const ae=O||ie.item,W=Ee.useInternationalization(),[se]=ne.useSchedulerViewItemsContext(),[ue]=ne.useSchedulerViewSlotsContext(),P=Se.useSchedulerElementContext(),[de,Y]=t.useState(!0),[me,fe]=t.useState(!1),f=t.useRef(e.order),X=t.useRef(0),C=A.useDir(P),he=t.useMemo(()=>{var n,r;return e.isAllDay?(n=e.title)!=null?n:"":`(${W.format("{0:t} - {1:t}",e.zonedStart,e.zonedEnd)}): ${(r=e.title)!=null?r:""}`},[W,e.isAllDay,e.title,e.zonedEnd,e.zonedStart]);let H;e.isRecurring&&!e.isException?H="recurring":!e.isRecurring&&e.isException&&(H="non-recurring");const ge=t.useMemo(()=>W.format("{0:t} – {1:t}",e.zonedStart,e.zonedEnd),[W,e.zonedStart,e.zonedEnd]),Z=(n,r)=>{let a=1;return n.forEach(c=>{const s=r.filter(z=>$(c.current.props,z.props));s.length>a&&(a=s.length)}),a},ve=(n,r)=>n.map(c=>r.filter(s=>$(c.current.props,s.props))),we=(n,r,a,c=!1)=>{var B;const s=r.filter(i=>i.props.order!==null&&i.props.order!==void 0).map(i=>{let l=i.props.start,u=i.props.end;if(i.props.isAllDay||c){l=new Date(l.getFullYear(),l.getMonth(),l.getDate());const y=new Date(u.getFullYear(),u.getMonth(),u.getDate());u=y.getTime()<=l.getTime()?new Date(l.getFullYear(),l.getMonth(),l.getDate()+1):y}return{order:i.props.order,start:l,end:u}}),z=Array.from(new Set(s.map(i=>i.order))).sort((i,l)=>i-l),R=new Map;for(const i of s)R.has(i.order)||R.set(i.order,[]),R.get(i.order).push({start:i.start,end:i.end});const x=[],D=new Map;for(const i of z){const l=R.get(i);let u=-1,y=0;D.forEach((v,N)=>{if(N>=i)return;const S=R.get(N);if(!S)return;l.some(o=>S.some(g=>q.intersects(g.start,g.end,o.start,o.end,a)))&&v+1>y&&(y=v+1)});for(let v=y;v<x.length;v++)if(l.every(S=>x[v].every(T=>!q.intersects(T.start,T.end,S.start,S.end,a)))){u=v;break}u===-1&&(u=x.length,x.push([])),x[u].push(...l),D.set(i,u)}return(B=D.get(n))!=null?B:n},$=(n,r)=>q.intersects(n.start,n.end,r.start,r.end)&&n.group.index===r.group.index&&n.range.index===r.range.index&&(n.range.isAllDay===void 0||r.range.isAllDay===void 0||n.range.isAllDay===r.range.isAllDay)&&(e.ignoreIsAllDay||n.isAllDay===r.isAllDay),V=()=>{var y,v,N,S,T;const n=(ue||[]).filter(o=>o.current&&$(o.current.props,e)),r=m.current&&m.current.element,a=q.first(n);if(n.length===0){Y(!1);return}if(!a.current||!r)return;const c=U.getRect(a.current.element),s=[],z=[],R=[];(se||[]).forEach(o=>{o.current&&(o.current.props.dragHint?z.push(o.current):o.current.props.resizeHint?R.push(o.current):s.push(o.current))});const x=e.dragHint||e.resizeHint?q.calculateOrder(m.current,e.dragHint?z:R,n,e.ignoreIsAllDay):(y=e.order)!=null?y:0;if(!e.vertical&&!(e.dragHint||e.resizeHint)&&e.order!==null&&e.order!==void 0){const g=(e.ignoreIsAllDay?s:s.filter(k=>k.props.isAllDay)).filter(k=>k.props.group.index===e.group.index),h=(v=e.style)==null?void 0:v.height,b=typeof h=="number"?h:parseFloat(h),d=h!=null&&Number.isNaN(b),w=!!e.ignoreIsAllDay,G=w?!0:!d;f.current=we(e.order,g,G,w)}else f.current=x;let D=e.dragHint||e.resizeHint?Z(n,e.dragHint?z:R):Z(n,s);const B=ve(n,s);let i=0;const l=!e.vertical&&f.current!==null;if(B.forEach(o=>{let g=0;o.forEach(h=>{if(!l){const b=U.getRect(h.element);h.props.order!==null&&h.props.order!==void 0&&h.props.order<f.current&&(g=b.top+b.height-c.top-F.BORDER_WIDTH*f.current+j)}}),g>i&&(i=g)}),l){const o=(N=e.style)==null?void 0:N.height,g=typeof o=="number"?o:parseFloat(o);if(o==null)i=f.current*(K+j);else if(!Number.isNaN(g))i=f.current*(g+j);else{const h=(e.ignoreIsAllDay?s:s.filter(d=>d.props.isAllDay)).filter(d=>d.props.group.index===e.group.index&&d.element!==r&&(!e.ignoreIsAllDay||!a.current||q.intersects(d.props.start,d.props.end,a.current.props.start,a.current.props.end))),b=new Map;h.forEach(d=>{var k,ee;const w=d._order;if(w==null||w>=f.current)return;const G=((k=d.element)==null?void 0:k.offsetHeight)||K;b.set(w,Math.max((ee=b.get(w))!=null?ee:0,G))}),i=Array.from(b.values()).reduce((d,w)=>d+w+j,0)}}if(n.length===0){Y(!1);return}const u=le.add?20:0;c.width=e.vertical?c.width/D-F.BORDER_WIDTH-u/D:c.width*n.length-F.BORDER_WIDTH,e.vertical?c.height=c.height*n.length-F.BORDER_WIDTH:(e.resizeHint||e.dragHint)&&D<=1||(c.height=(T=(S=e.style)==null?void 0:S.height)!=null?T:K),c.left=e.vertical?c.left+f.current*c.width+F.BORDER_WIDTH*f.current:c.left,c.top=e.vertical?c.top:c.top+i+F.BORDER_WIDTH*f.current,X.current=D,U.setRect(r,c),fe(!0),Y(!0)},p=t.useCallback(n=>{const r=n&&n[0],a=Q.current;L.current!==void 0&&window.cancelAnimationFrame(L.current),a&&r&&(a.width!==r.contentRect.width||a.height!==r.contentRect.height)&&(L.current=window.requestAnimationFrame(()=>{V()})),Q.current={width:r.contentRect.width,height:r.contentRect.height}},[V]);t.useEffect(()=>(V(),E.current!==void 0&&window.cancelAnimationFrame(E.current),E.current=window.requestAnimationFrame(()=>{E.current=window.requestAnimationFrame(()=>{E.current=void 0,V()})}),()=>{E.current!==void 0&&(window.cancelAnimationFrame(E.current),E.current=void 0)}));const Ie=m.current&&m.current.element?m.current.element.closest(".k-scheduler-layout"):null;return be.useRowSync({element:Ie,selector:".k-resource-row",horizontalAttribute:"data-depth-index",verticalAttribute:"data-resource-index",applyTo:".k-resource-cell",syncHeight:e.isLast}),t.useEffect(()=>{if(!P.current)return;const n=window.ResizeObserver,r=n&&new n(p);return r&&r.observe(P.current),()=>{r&&r.disconnect()}},[p,P]),t.createElement(ae,{...oe,_ref:m,_maxSiblingsPerSlot:X,_order:f,itemRef:m,style:{visibility:me?void 0:"hidden",display:de?void 0:"none",...e.style}},!e.resizeHint&&t.createElement(t.Fragment,null,e.tail&&!e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(A.IconWrap,{name:C==="rtl"?"chevron-right":"chevron-left",icon:C==="rtl"?I.chevronRightIcon:I.chevronLeftIcon})),t.createElement("div",{title:he},e.tail&&e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(A.IconWrap,{name:"chevron-up",icon:I.chevronUpIcon})),t.createElement(te.SchedulerItemContent,{className:"k-event-title"},e.title),!e.isAllDay&&t.createElement(te.SchedulerItemContent,{className:"k-event-time"},H==="recurring"&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(A.IconWrap,{name:"arrow-rotate-cw",icon:I.arrowRotateCwIcon})),H==="non-recurring"&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(A.IconWrap,{name:"arrows-no-repeat",icon:I.arrowsNoRepeatIcon})),ge),e.head&&e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(A.IconWrap,{name:"chevron-down",icon:I.chevronDownIcon}))),H&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(A.IconWrap,{name:H==="recurring"?"arrow-rotate-cw":"arrows-no-repeat",icon:H==="recurring"?I.arrowRotateCwIcon:I.arrowsNoRepeatIcon})),e.head&&!e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(A.IconWrap,{name:C==="rtl"?"chevron-left":"chevron-right",icon:C==="rtl"?I.chevronLeftIcon:I.chevronRightIcon}))))}),ie={item:ye.SchedulerItem};re.displayName="KendoReactSchedulerViewItem";exports.SchedulerViewItem=re;exports.schedulerViewItemDefaultProps=ie;
|