@progress/kendo-react-scheduler 16.1.0-develop.5 → 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.
@@ -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"),b=require("../views/common/utils.js"),E=require("../constants/index.js"),Se=require("@progress/kendo-react-intl"),J=require("./SchedulerItemContent.js"),g=require("@progress/kendo-react-common"),m=require("@progress/kendo-svg-icons"),Q=require("../context/SchedulerViewContext.js"),Ie=require("../context/SchedulerContext.js"),we=require("../hooks/useRowSync.js");function Re(e){const T=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const w in e)if(w!=="default"){const _=Object.getOwnPropertyDescriptor(e,w);Object.defineProperty(T,w,_.get?_:{enumerable:!0,get:()=>e[w]})}}return T.default=e,Object.freeze(T)}const t=Re(ge),Ee=1,X=12,Y=t.forwardRef((e,T)=>{const{item:w,_ref:_,itemRef:ee,...te}=e,A=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(T,()=>C.current),t.useImperativeHandle(_,()=>o.current),t.useImperativeHandle(ee,()=>o.current);const re=w||Z.item,y=Se.useInternationalization(),[ne]=Q.useSchedulerViewItemsContext(),[ce]=Q.useSchedulerViewSlotsContext(),P=Ie.useSchedulerElementContext(),[ie,V]=t.useState(!0),[oe,ae]=t.useState(!1),p=t.useRef(0),v=t.useRef(null),S=t.useRef([]),M=g.useDir(P),se=t.useMemo(()=>{var c,n;return e.isAllDay?(c=e.title)!=null?c:"":`(${y.format("{0:t} - {1:t}",e.zonedStart,e.zonedEnd)}): ${(n=e.title)!=null?n:""}`},[y,e.isAllDay,e.title,e.zonedEnd,e.zonedStart]);let I;e.isRecurring&&!e.isException?I="recurring":!e.isRecurring&&e.isException&&(I="non-recurring");const le=t.useMemo(()=>y.format("{0:t} – {1:t}",e.zonedStart,e.zonedEnd),[y,e.zonedStart,e.zonedEnd]),ue=(c,n)=>{let i=0;return n.forEach(s=>{s._order!==void 0&&s._order!==null&&i<s._order&&(i=s._order)}),i+1},me=(c,n,i)=>{const[s,f]=n,l=new Date(Math.min(f.props.end.getTime()-i,Math.max(e.start.getTime(),s.props.start.getTime()))),R=new Date(Math.max(l.getTime()+i,Math.min(e.end.getTime(),f.props.end.getTime())));return c.filter(u=>{const H=Math.max(Math.min(f.props.end.getTime()-i,u.props.start.getTime()),s.props.start.getTime()),x=Math.min(Math.max(H+i,u.props.end.getTime()),f.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(H),new Date(x),l,R)&&h.intersects(s.props.start,f.props.end,u.props.start,u.props.end)})},de=(c,n)=>c.group.index===n.group.index&&c.range.index===n.range.index&&(c.range.isAllDay===void 0||n.range.isAllDay===void 0||c.range.isAllDay===n.range.isAllDay)&&(e.ignoreIsAllDay||c.isAllDay===n.isAllDay),O=()=>{var L,$,G,K,U;const c=ce.filter(r=>r.current&&de(r.current.props,e)).sort((r,D)=>r.current.props.start.getTime()-D.current.props.start.getTime()),n=c.filter(r=>h.intersects(r.current.props.start,r.current.props.end,e.start,e.end)),i=o.current&&o.current.element;if(!i||!n.length)return;const s=h.first(c),f=h.last(c),l=h.first(n),R=h.last(n);if(!l.current||!o.current||!R.current||!s.current||!f.current)return;if(!h.intersects(l.current.props.start,R.current.props.end,e.start,e.end)){V(!1);return}const k=[],u=[],H=[],x=b.getRect(l.current.element),N=(e.vertical?x.height:x.width)/(l.current.props.end.getTime()-l.current.props.start.getTime()),j=(e.vertical?X:8)/N,z=(Math.min(e.start.getTime(),R.current.props.end.getTime()-j)-l.current.props.start.getTime())*N,F=Math.floor(Math.min(e.end.getTime(),R.current.props.end.getTime())-Math.max(e.start.getTime(),l.current.props.start.getTime()))*N;(ne||[]).forEach(r=>{r.current&&(r.current.props.dragHint?u.push(r.current):r.current.props.resizeHint?H.push(r.current):k.push(r.current))}),S.current=me(k,[s.current,f.current],j),v.current=e.resizeHint||e.dragHint?0:h.calculateProportionalOrder(o.current,S.current);let d=1;e.resizeHint||e.dragHint||(d=ue(o.current,S.current),S.current.forEach(r=>{r._maxSiblingsPerSlot&&d<r._maxSiblingsPerSlot&&(d=r._maxSiblingsPerSlot)}),S.current.forEach(r=>{r._maxSiblingsPerSlot!==void 0&&r._maxSiblingsPerSlot!==null&&r._maxSiblingsPerSlot<d&&(r._maxSiblingsPerSlot=d)}));let q=0;const a=x;S.current.forEach(r=>{let D=0;r._order!==void 0&&r._order!==null&&r._order<v.current&&(D=b.getRect(r.element).top+b.getRect(r.element).height-a.top-E.BORDER_WIDTH*v.current+Ee),D>q&&(q=D)});const fe=20;a.width=e.vertical?a.width/d-E.BORDER_WIDTH-fe/d:F-E.BORDER_WIDTH,e.vertical?a.height=F-E.BORDER_WIDTH:(e.resizeHint||e.dragHint)&&d<=1||(a.height=($=(L=e.style)==null?void 0:L.height)!=null?$:X),a.left=e.vertical?a.left+((G=v.current)!=null?G:0)+E.BORDER_WIDTH*((K=v.current)!=null?K:0)*a.width:a.left+(z<0?0:z),a.top=e.vertical?a.top+(z<0?0:z):a.top+q+E.BORDER_WIDTH*((U=v.current)!=null?U:0),p.current=d,b.setRect(i,a),ae(!0),V(!0)},B=t.useCallback(c=>{const n=c&&c[0],i=W.current;A.current!==void 0&&window.cancelAnimationFrame(A.current),i&&n&&(i.width!==n.contentRect.width||i.height!==n.contentRect.height)&&(A.current=window.requestAnimationFrame(()=>{O()})),W.current={width:n.contentRect.width,height:n.contentRect.height}},[O]);t.useEffect(O);const he=o.current&&o.current.element?o.current.element.closest(".k-scheduler-layout"):null;return we.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(!P.current)return;const c=window.ResizeObserver,n=c&&new c(B);return n&&n.observe(P.current),()=>{n&&n.disconnect()}},[B,P]),t.createElement(re,{...te,_ref:o,_order:v,_maxSiblingsPerSlot:p,_siblings:S,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(g.IconWrap,{name:M==="rtl"?"chevron-right":"chevron-left",icon:M==="rtl"?m.chevronRightIcon:m.chevronLeftIcon})),t.createElement("div",{title:se},e.tail&&e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(g.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"},I==="recurring"&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(g.IconWrap,{name:"arrow-rotate-cw",icon:m.arrowRotateCwIcon})),I==="non-recurring"&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(g.IconWrap,{name:"arrows-no-repeat",icon:m.arrowsNoRepeatIcon})),le),e.head&&e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(g.IconWrap,{name:"chevron-down",icon:m.chevronDownIcon}))),I&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(g.IconWrap,{name:I==="recurring"?"arrow-rotate-cw":"arrows-no-repeat",icon:I==="recurring"?m.arrowRotateCwIcon:m.arrowsNoRepeatIcon})),e.head&&!e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(g.IconWrap,{name:M==="rtl"?"chevron-left":"chevron-right",icon:M==="rtl"?m.chevronLeftIcon:m.chevronRightIcon}))))}),Z={item:ve.SchedulerItem};Y.displayName="KendoReactSchedulerProportionalViewItem";exports.SchedulerProportionalViewItem=Y;exports.schedulerProportionalViewItemDefaultProps=Z;
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 Se } from "./SchedulerItem.mjs";
10
- import { intersects as D, first as B, last as K, calculateProportionalOrder as we } from "../utils/index.mjs";
11
- import { getRect as k, setRect as Ee } from "../views/common/utils.mjs";
12
- import { BORDER_WIDTH as w } from "../constants/index.mjs";
13
- import { useInternationalization as xe } from "@progress/kendo-react-intl";
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 Ie, IconWrap as v } from "@progress/kendo-react-common";
16
- import { chevronRightIcon as j, chevronLeftIcon as J, chevronUpIcon as Re, arrowRotateCwIcon as Q, arrowsNoRepeatIcon as X, chevronDownIcon as Te } from "@progress/kendo-svg-icons";
17
- import { useSchedulerViewItemsContext as ye, useSchedulerViewSlotsContext as _e } from "../context/SchedulerViewContext.mjs";
18
- import { useSchedulerElementContext as De } from "../context/SchedulerContext.mjs";
19
- import { useRowSync as Me } from "../hooks/useRowSync.mjs";
20
- const ze = 1, Y = 12, Ae = t.forwardRef(
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, M = t.useRef(void 0), a = t.useRef(null), N = t.useRef(null), b = t.useRef(null);
23
- t.useImperativeHandle(N, () => ({ props: e, element: a.current && a.current.element })), t.useImperativeHandle(Z, () => N.current), t.useImperativeHandle(te, () => a.current), t.useImperativeHandle(re, () => a.current);
24
- const ie = ee || Pe.item, I = xe(), [ce] = ye(), [ae] = _e(), R = De(), [oe, C] = t.useState(!0), [le, se] = t.useState(!1), O = t.useRef(0), f = t.useRef(null), h = t.useRef([]), T = Ie(R), me = t.useMemo(
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 i, n;
27
- return e.isAllDay ? (i = e.title) != null ? i : "" : `(${I.format("{0:t} - {1:t}", e.zonedStart, e.zonedEnd)}): ${(n = e.title) != null ? n : ""}`;
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
- [I, e.isAllDay, e.title, e.zonedEnd, e.zonedStart]
29
+ [R, e.isAllDay, e.title, e.zonedEnd, e.zonedStart]
30
30
  );
31
- let g;
32
- e.isRecurring && !e.isException ? g = "recurring" : !e.isRecurring && e.isException && (g = "non-recurring");
33
- const ue = t.useMemo(
34
- () => I.format("{0:t} – {1:t}", e.zonedStart, e.zonedEnd),
35
- [I, e.zonedStart, e.zonedEnd]
36
- ), de = (i, n) => {
37
- let c = 0;
38
- return n.forEach((l) => {
39
- l._order !== void 0 && l._order !== null && c < l._order && (c = l._order);
40
- }), c + 1;
41
- }, fe = (i, n, c) => {
42
- const [l, d] = n, s = new Date(
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
- d.props.end.getTime() - c,
45
- Math.max(e.start.getTime(), l.props.start.getTime())
45
+ o.props.end.getTime() - i,
46
+ Math.max(e.start.getTime(), m.props.start.getTime())
46
47
  )
47
- ), S = new Date(
48
- Math.max(s.getTime() + c, Math.min(e.end.getTime(), d.props.end.getTime()))
48
+ ), g = new Date(
49
+ Math.max(l.getTime() + i, Math.min(e.end.getTime(), o.props.end.getTime()))
49
50
  );
50
- return i.filter((m) => {
51
- const y = Math.max(
52
- Math.min(d.props.end.getTime() - c, m.props.start.getTime()),
53
- l.props.start.getTime()
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(y + c, m.props.end.getTime()),
56
- d.props.end.getTime()
56
+ Math.max(x + i, u.props.end.getTime()),
57
+ o.props.end.getTime()
57
58
  );
58
- return m.props.id !== e.id && m.props.group.index === e.group.index && m.props.range.index === e.range.index && (e.ignoreIsAllDay || m.props.isAllDay === e.isAllDay) && D(new Date(y), new Date(E), s, S) && D(l.props.start, d.props.end, m.props.start, m.props.end);
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
- }, he = (i, n) => i.group.index === n.group.index && i.range.index === n.range.index && // When slotDuration equals a full day, both daySlots and timeSlots have isAllDay=true,
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
- (i.range.isAllDay === void 0 || n.range.isAllDay === void 0 || i.range.isAllDay === n.range.isAllDay) && (e.ignoreIsAllDay || i.isAllDay === n.isAllDay), z = () => {
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 i = ae.filter((r) => r.current && he(r.current.props, e)).sort((r, x) => r.current.props.start.getTime() - x.current.props.start.getTime()), n = i.filter(
65
- (r) => D(r.current.props.start, r.current.props.end, e.start, e.end)
66
- ), c = a.current && a.current.element;
67
- if (!c || !n.length)
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 l = B(i), d = K(i), s = B(n), S = K(n);
70
- if (!s.current || !a.current || !S.current || !l.current || !d.current)
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 (!D(s.current.props.start, S.current.props.end, e.start, e.end)) {
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 = [], m = [], y = [], E = k(s.current.element), P = (e.vertical ? E.height : E.width) / (s.current.props.end.getTime() - s.current.props.start.getTime()), F = (e.vertical ? Y : 8) / P, _ = (Math.min(e.start.getTime(), S.current.props.end.getTime() - F) - s.current.props.start.getTime()) * P, p = Math.floor(
77
- Math.min(e.end.getTime(), S.current.props.end.getTime()) - Math.max(e.start.getTime(), s.current.props.start.getTime())
78
- ) * P;
79
- (ce || []).forEach((r) => {
80
- r.current && (r.current.props.dragHint ? m.push(r.current) : r.current.props.resizeHint ? y.push(r.current) : A.push(r.current));
81
- }), h.current = fe(A, [l.current, d.current], F), f.current = e.resizeHint || e.dragHint ? 0 : we(a.current, h.current);
82
- let u = 1;
83
- e.resizeHint || e.dragHint || (u = de(a.current, h.current), h.current.forEach((r) => {
84
- r._maxSiblingsPerSlot && u < r._maxSiblingsPerSlot && (u = r._maxSiblingsPerSlot);
85
- }), h.current.forEach((r) => {
86
- r._maxSiblingsPerSlot !== void 0 && r._maxSiblingsPerSlot !== null && r._maxSiblingsPerSlot < u && (r._maxSiblingsPerSlot = u);
87
- }));
88
- let H = 0;
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
- o.width = e.vertical ? o.width / u - w - ve / u : p - w, e.vertical ? o.height = p - w : (e.resizeHint || e.dragHint) && u <= 1 || (o.height = (L = (G = e.style) == null ? void 0 : G.height) != null ? L : Y), o.left = e.vertical ? o.left + ((W = f.current) != null ? W : 0) + w * (($ = f.current) != null ? $ : 0) * o.width : o.left + (_ < 0 ? 0 : _), o.top = e.vertical ? o.top + (_ < 0 ? 0 : _) : o.top + H + w * ((q = f.current) != null ? q : 0), O.current = u, Ee(c, o), se(!0), C(!0);
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
- (i) => {
98
- const n = i && i[0], c = b.current;
99
- M.current !== void 0 && window.cancelAnimationFrame(M.current), c && n && (c.width !== n.contentRect.width || c.height !== n.contentRect.height) && (M.current = window.requestAnimationFrame(() => {
100
- z();
101
- })), b.current = { width: n.contentRect.width, height: n.contentRect.height };
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
- [z]
100
+ [_]
104
101
  );
105
- t.useEffect(z);
102
+ t.useEffect(_);
106
103
  const ge = a.current && a.current.element ? a.current.element.closest(".k-scheduler-layout") : null;
107
- return Me({
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 (!R.current)
112
+ if (!T.current)
116
113
  return;
117
- const i = window.ResizeObserver, n = i && new i(V);
118
- return n && n.observe(R.current), () => {
119
- n && n.disconnect();
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, R]), /* @__PURE__ */ t.createElement(
122
- ie,
118
+ }, [V, T]), /* @__PURE__ */ t.createElement(
119
+ ce,
123
120
  {
124
121
  ...ne,
125
122
  _ref: a,
126
- _order: f,
123
+ _order: d,
127
124
  _maxSiblingsPerSlot: O,
128
- _siblings: h,
125
+ _siblings: w,
129
126
  itemRef: a,
130
127
  style: {
131
- visibility: le ? void 0 : "hidden",
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
- v,
134
+ f,
138
135
  {
139
- name: T === "rtl" ? "chevron-right" : "chevron-left",
140
- icon: T === "rtl" ? j : J
136
+ name: y === "rtl" ? "chevron-right" : "chevron-left",
137
+ icon: y === "rtl" ? j : J
141
138
  }
142
- )), /* @__PURE__ */ t.createElement("div", { title: me }, e.tail && e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(v, { name: "chevron-up", icon: Re })), /* @__PURE__ */ t.createElement(U, { className: "k-event-title" }, e.title), !e.isAllDay && /* @__PURE__ */ t.createElement(U, { className: "k-event-time" }, g === "recurring" && /* @__PURE__ */ t.createElement("span", { className: "k-event-recurrence-icon" }, /* @__PURE__ */ t.createElement(v, { name: "arrow-rotate-cw", icon: Q })), g === "non-recurring" && /* @__PURE__ */ t.createElement("span", { className: "k-event-recurrence-icon" }, /* @__PURE__ */ t.createElement(v, { name: "arrows-no-repeat", icon: X })), ue), e.head && e.vertical && /* @__PURE__ */ t.createElement("span", { className: "k-event-continuation" }, /* @__PURE__ */ t.createElement(v, { name: "chevron-down", icon: Te }))), g && /* @__PURE__ */ t.createElement("span", { className: "k-event-recurrence-icon" }, /* @__PURE__ */ t.createElement(
143
- v,
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: g === "recurring" ? "arrow-rotate-cw" : "arrows-no-repeat",
146
- icon: g === "recurring" ? Q : X
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
- v,
146
+ f,
150
147
  {
151
- name: T === "rtl" ? "chevron-left" : "chevron-right",
152
- icon: T === "rtl" ? J : j
148
+ name: y === "rtl" ? "chevron-left" : "chevron-right",
149
+ icon: y === "rtl" ? J : j
153
150
  }
154
151
  )))
155
152
  );
156
153
  }
157
- ), Pe = {
158
- item: Se
154
+ ), He = {
155
+ item: we
159
156
  };
160
157
  Ae.displayName = "KendoReactSchedulerProportionalViewItem";
161
158
  export {
162
159
  Ae as SchedulerProportionalViewItem,
163
- Pe as schedulerProportionalViewItemDefaultProps
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"),Se=require("./SchedulerItem.js"),O=require("../utils/index.js"),U=require("../views/common/utils.js"),q=require("../constants/index.js"),ye=require("@progress/kendo-react-intl"),te=require("./SchedulerItemContent.js"),H=require("@progress/kendo-react-common"),R=require("@progress/kendo-svg-icons"),Ee=require("../hooks/useEditable.js"),ne=require("../context/SchedulerViewContext.js"),De=require("../context/SchedulerContext.js"),be=require("../hooks/useRowSync.js");function He(e){const F=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const N in e)if(N!=="default"){const P=Object.getOwnPropertyDescriptor(e,N);Object.defineProperty(F,N,P.get?P:{enumerable:!0,get:()=>e[N]})}}return F.default=e,Object.freeze(F)}const t=He(Re),j=1,K=25,re=t.forwardRef((e,F)=>{const{item:N,_ref:P,itemRef:ce,...oe}=e,L=t.useRef(void 0),E=t.useRef(void 0),f=t.useRef(null),J=t.useRef(null),Q=t.useRef(null),le=Ee.useEditable(e.editable);t.useImperativeHandle(J,()=>({props:e,element:f.current&&f.current.element})),t.useImperativeHandle(F,()=>J.current),t.useImperativeHandle(P,()=>f.current),t.useImperativeHandle(ce,()=>f.current);const ae=N||ie.item,M=ye.useInternationalization(),[se]=ne.useSchedulerViewItemsContext(),[ue]=ne.useSchedulerViewSlotsContext(),W=De.useSchedulerElementContext(),[de,Y]=t.useState(!0),[me,fe]=t.useState(!1),h=t.useRef(e.order),X=t.useRef(0),C=H.useDir(W),he=t.useMemo(()=>{var n,r;return e.isAllDay?(n=e.title)!=null?n:"":`(${M.format("{0:t} - {1:t}",e.zonedStart,e.zonedEnd)}): ${(r=e.title)!=null?r:""}`},[M,e.isAllDay,e.title,e.zonedEnd,e.zonedStart]);let A;e.isRecurring&&!e.isException?A="recurring":!e.isRecurring&&e.isException&&(A="non-recurring");const ge=t.useMemo(()=>M.format("{0:t} – {1:t}",e.zonedStart,e.zonedEnd),[M,e.zonedStart,e.zonedEnd]),Z=(n,r)=>{let s=1;return n.forEach(c=>{const u=r.filter(x=>$(c.current.props,x.props));u.length>s&&(s=u.length)}),s},ve=(n,r)=>n.map(c=>r.filter(u=>$(c.current.props,u.props))),we=(n,r,s,c=!1)=>{var B;const u=r.filter(i=>i.props.order!==null&&i.props.order!==void 0).map(i=>{let l=i.props.start,d=i.props.end;if(i.props.isAllDay||c){l=new Date(l.getFullYear(),l.getMonth(),l.getDate());const y=new Date(d.getFullYear(),d.getMonth(),d.getDate());d=y.getTime()<=l.getTime()?new Date(l.getFullYear(),l.getMonth(),l.getDate()+1):y}return{order:i.props.order,start:l,end:d}}),x=Array.from(new Set(u.map(i=>i.order))).sort((i,l)=>i-l),S=new Map;for(const i of u)S.has(i.order)||S.set(i.order,[]),S.get(i.order).push({start:i.start,end:i.end});const z=[],v=new Map;for(const i of x){const l=S.get(i);let d=-1,y=0;v.forEach((w,T)=>{if(T>=i)return;const D=S.get(T);if(!D)return;l.some(o=>D.some(g=>O.intersects(g.start,g.end,o.start,o.end,s)))&&w+1>y&&(y=w+1)});for(let w=y;w<z.length;w++)if(l.every(D=>z[w].every(_=>!O.intersects(_.start,_.end,D.start,D.end,s)))){d=w;break}d===-1&&(d=z.length,z.push([])),z[d].push(...l),v.set(i,d)}return(B=v.get(n))!=null?B:n},$=(n,r)=>O.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,w,T,D,_;const n=(ue||[]).filter(o=>o.current&&$(o.current.props,e)),r=f.current&&f.current.element,s=O.first(n);if(n.length===0){Y(!1);return}if(!s.current||!r)return;const c=U.getRect(s.current.element),u=[],x=[],S=[];(se||[]).forEach(o=>{o.current&&(o.current.props.dragHint?x.push(o.current):o.current.props.resizeHint?S.push(o.current):u.push(o.current))});const z=e.dragHint||e.resizeHint?O.calculateOrder(f.current,e.dragHint?x:S,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?u:u.filter(k=>k.props.isAllDay)).filter(k=>k.props.group.index===e.group.index),a=(w=e.style)==null?void 0:w.height,b=typeof a=="number"?a:parseFloat(a),m=a!=null&&Number.isNaN(b),I=!!e.ignoreIsAllDay,G=I?!0:!m;h.current=we(e.order,g,G,I)}else h.current=z;let v=e.dragHint||e.resizeHint?Z(n,e.dragHint?x:S):Z(n,u);const B=ve(n,u);let i=0;const l=!e.vertical&&h.current!==null;if(B.forEach(o=>{let g=0;o.forEach(a=>{if(O.intersects(a.props.start,a.props.end,e.start,e.end)&&!(e.dragHint||e.resizeHint)&&a._maxSiblingsPerSlot&&a._maxSiblingsPerSlot>v&&a.element!==r&&(v=a._maxSiblingsPerSlot),!l){const b=U.getRect(a.element);a.props.order!==null&&a.props.order!==void 0&&a.props.order<h.current&&(g=b.top+b.height-c.top-q.BORDER_WIDTH*h.current+j)}}),g>i&&(i=g)}),l){const o=(T=e.style)==null?void 0:T.height,g=typeof o=="number"?o:parseFloat(o);if(o==null)i=h.current*(K+j);else if(!Number.isNaN(g))i=h.current*(g+j);else{const a=(e.ignoreIsAllDay?u:u.filter(m=>m.props.isAllDay)).filter(m=>m.props.group.index===e.group.index&&m.element!==r&&(!e.ignoreIsAllDay||!s.current||O.intersects(m.props.start,m.props.end,s.current.props.start,s.current.props.end))),b=new Map;a.forEach(m=>{var k,ee;const I=m._order;if(I==null||I>=h.current)return;const G=((k=m.element)==null?void 0:k.offsetHeight)||K;b.set(I,Math.max((ee=b.get(I))!=null?ee:0,G))}),i=Array.from(b.values()).reduce((m,I)=>m+I+j,0)}}if(n.length===0){Y(!1);return}const d=le.add?20:0;c.width=e.vertical?c.width/v-q.BORDER_WIDTH-d/v:c.width*n.length-q.BORDER_WIDTH,e.vertical?c.height=c.height*n.length-q.BORDER_WIDTH:(e.resizeHint||e.dragHint)&&v<=1||(c.height=(_=(D=e.style)==null?void 0:D.height)!=null?_:K),c.left=e.vertical?c.left+h.current*c.width+q.BORDER_WIDTH*h.current:c.left,c.top=e.vertical?c.top:c.top+i+q.BORDER_WIDTH*h.current,X.current=v,U.setRect(r,c),fe(!0),Y(!0)},p=t.useCallback(n=>{const r=n&&n[0],s=Q.current;L.current!==void 0&&window.cancelAnimationFrame(L.current),s&&r&&(s.width!==r.contentRect.width||s.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=f.current&&f.current.element?f.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(!W.current)return;const n=window.ResizeObserver,r=n&&new n(p);return r&&r.observe(W.current),()=>{r&&r.disconnect()}},[p,W]),t.createElement(ae,{...oe,_ref:f,_maxSiblingsPerSlot:X,_order:h,itemRef:f,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(H.IconWrap,{name:C==="rtl"?"chevron-right":"chevron-left",icon:C==="rtl"?R.chevronRightIcon:R.chevronLeftIcon})),t.createElement("div",{title:he},e.tail&&e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(H.IconWrap,{name:"chevron-up",icon:R.chevronUpIcon})),t.createElement(te.SchedulerItemContent,{className:"k-event-title"},e.title),!e.isAllDay&&t.createElement(te.SchedulerItemContent,{className:"k-event-time"},A==="recurring"&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(H.IconWrap,{name:"arrow-rotate-cw",icon:R.arrowRotateCwIcon})),A==="non-recurring"&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(H.IconWrap,{name:"arrows-no-repeat",icon:R.arrowsNoRepeatIcon})),ge),e.head&&e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(H.IconWrap,{name:"chevron-down",icon:R.chevronDownIcon}))),A&&t.createElement("span",{className:"k-event-recurrence-icon"},t.createElement(H.IconWrap,{name:A==="recurring"?"arrow-rotate-cw":"arrows-no-repeat",icon:A==="recurring"?R.arrowRotateCwIcon:R.arrowsNoRepeatIcon})),e.head&&!e.vertical&&t.createElement("span",{className:"k-event-continuation"},t.createElement(H.IconWrap,{name:C==="rtl"?"chevron-left":"chevron-right",icon:C==="rtl"?R.chevronLeftIcon:R.chevronRightIcon}))))}),ie={item:Se.SchedulerItem};re.displayName="KendoReactSchedulerViewItem";exports.SchedulerViewItem=re;exports.schedulerViewItemDefaultProps=ie;
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;