@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
package/hooks/useSlotExpand.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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react"),p=require("../views/common/utils.js"),O=require("../constants/index.js"),S=require("@progress/kendo-react-common"),j=require("../context/SchedulerContext.js");function q(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const c in e)if(c!=="default"){const f=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(t,c,f.get?f:{enumerable:!0,get:()=>e[c]})}}return t.default=e,Object.freeze(t)}const i=q(E),H=(e,t)=>{const c=i.useRef(void 0),f=i.useRef(0),m=j.useSchedulerElementContext(),x=()=>{if(!e.current)return;const n=e.current.element;n&&(f.current=n.clientHeight)},d=i.useCallback(()=>{if(!t||!e.current)return;const n=e.current.element,g=e.current.props;if(!n)return;const a=p.getPadding(n),r=new Map,u=g.items.filter(o=>o._ref.current);u.forEach(o=>{var v,R,y,w;if(!o._ref.current)return;const{height:l}=p.getRect(o._ref.current.element),_=(y=(R=o.order)!=null?R:(v=o._ref.current)==null?void 0:v._order)!=null?y:-1;((w=r.get(_))!=null?w:0)<l&&r.set(_,l)});const s=Array.from(r.values()).reduce((o,l)=>o+l,0),b=u.length*O.BORDER_WIDTH*2+s-(a||0)+(typeof t=="object"&&t.offsetTop?t.offsetTop:0)+(typeof t=="object"&&t.offsetBottom?t.offsetBottom:0);u.length?b>f.current-a&&p.setRect(n,{height:b},!0):n&&(n.style.minHeight="")},[t,e]),h=i.useCallback(()=>{c.current!==void 0&&window.cancelAnimationFrame(c.current),c.current=window.requestAnimationFrame(()=>{d()})},[d]);S.useIsomorphicLayoutEffect(x,[]),i.useEffect(d,[e,e.current&&e.current.props,t]),i.useEffect(()=>{if(!e.current)return;const a=e.current.props.items.filter(r=>r._ref.current).map(r=>{if(!r._ref.current||!r._ref.current.element||!m.current)return;const u=window.ResizeObserver,s=u&&new u(h);return s&&s.observe(r._ref.current.element),()=>{s&&s.disconnect()}});return()=>{a.forEach(r=>r&&r())}},[h,m,e])};exports.useSlotExpand=H;
|
package/hooks/useSlotExpand.mjs
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as u from "react";
|
|
9
|
-
import { getPadding as
|
|
10
|
-
import { BORDER_WIDTH as
|
|
11
|
-
import { useIsomorphicLayoutEffect as
|
|
12
|
-
import { useSchedulerElementContext as
|
|
13
|
-
const
|
|
14
|
-
const m = u.useRef(void 0), p = u.useRef(0), l =
|
|
9
|
+
import { getPadding as x, getRect as H, setRect as y } from "../views/common/utils.mjs";
|
|
10
|
+
import { BORDER_WIDTH as k } from "../constants/index.mjs";
|
|
11
|
+
import { useIsomorphicLayoutEffect as z } from "@progress/kendo-react-common";
|
|
12
|
+
import { useSchedulerElementContext as A } from "../context/SchedulerContext.mjs";
|
|
13
|
+
const T = (e, t) => {
|
|
14
|
+
const m = u.useRef(void 0), p = u.useRef(0), l = A(), E = () => {
|
|
15
15
|
if (!e.current)
|
|
16
16
|
return;
|
|
17
17
|
const n = e.current.element;
|
|
@@ -22,22 +22,22 @@ const O = (e, t) => {
|
|
|
22
22
|
const n = e.current.element, h = e.current.props;
|
|
23
23
|
if (!n)
|
|
24
24
|
return;
|
|
25
|
-
const i =
|
|
25
|
+
const i = x(n), r = /* @__PURE__ */ new Map(), o = h.items.filter((c) => c._ref.current);
|
|
26
26
|
o.forEach((c) => {
|
|
27
|
-
var v, R, b;
|
|
27
|
+
var v, R, b, w;
|
|
28
28
|
if (!c._ref.current)
|
|
29
29
|
return;
|
|
30
|
-
const { height: f } =
|
|
31
|
-
((
|
|
30
|
+
const { height: f } = H(c._ref.current.element), _ = (b = (R = c.order) != null ? R : (v = c._ref.current) == null ? void 0 : v._order) != null ? b : -1;
|
|
31
|
+
((w = r.get(_)) != null ? w : 0) < f && r.set(_, f);
|
|
32
32
|
});
|
|
33
|
-
const s = Array.from(r.values()).reduce((c, f) => c + f, 0), g = o.length *
|
|
34
|
-
o.length ? g > p.current - i &&
|
|
33
|
+
const s = Array.from(r.values()).reduce((c, f) => c + f, 0), g = o.length * k * 2 + s - (i || 0) + (typeof t == "object" && t.offsetTop ? t.offsetTop : 0) + (typeof t == "object" && t.offsetBottom ? t.offsetBottom : 0);
|
|
34
|
+
o.length ? g > p.current - i && y(n, { height: g }, !0) : n && (n.style.minHeight = "");
|
|
35
35
|
}, [t, e]), d = u.useCallback(() => {
|
|
36
36
|
m.current !== void 0 && window.cancelAnimationFrame(m.current), m.current = window.requestAnimationFrame(() => {
|
|
37
37
|
a();
|
|
38
38
|
});
|
|
39
39
|
}, [a]);
|
|
40
|
-
|
|
40
|
+
z(E, []), u.useEffect(a, [e, e.current && e.current.props, t]), u.useEffect(() => {
|
|
41
41
|
if (!e.current)
|
|
42
42
|
return;
|
|
43
43
|
const i = e.current.props.items.filter((r) => r._ref.current).map((r) => {
|
|
@@ -54,5 +54,5 @@ const O = (e, t) => {
|
|
|
54
54
|
}, [d, l, e]);
|
|
55
55
|
};
|
|
56
56
|
export {
|
|
57
|
-
|
|
57
|
+
T as useSlotExpand
|
|
58
58
|
};
|
package/items/SchedulerItem.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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const be=require("react"),l=require("@progress/kendo-react-common"),G=require("@progress/kendo-react-intl"),K=require("@progress/kendo-svg-icons"),o=require("../messages/index.js"),fe=require("../utils/index.js"),ve=require("../hooks/useSchedulerItem.js"),he=require("../hooks/useEditable.js");function ze(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(s,r,c.get?c:{enumerable:!0,get:()=>e[r]})}}return s.default=e,Object.freeze(s)}const t=ze(be),J=t.forwardRef((e,s)=>{const{onFocus:r,onBlur:c,onMouseDown:b,onClick:f,onMouseUp:v,onMouseOut:h,onMouseOver:z,onMouseEnter:C,onMouseLeave:D,onDoubleClick:R,onRemoveClick:E,onKeyUp:M,onKeyDown:y,onKeyPress:S,onPress:I,onDrag:N,onRelease:P,onResizePress:x,onResizeEndDrag:H,onResizeRelease:q,onResizeStartDrag:O}=e,{item:a,element:F}=ve.useSchedulerItem(e,s),w=l.useDir(F),L=t.useRef(null),U=t.useRef(null),j=t.useRef(null),A=t.useRef(null),i=he.useEditable(e.editable),d=G.useInternationalization(),T=G.useLocalization(),B=T.toLanguageString(o.deleteTitle,o.messages[o.deleteTitle]),W=T.toLanguageString(o.allDay,o.messages[o.allDay]),g=e.group.resources.find(n=>!!(n.colorField&&n[n.colorField]!==""&&n[n.colorField]!==void 0)),u=g&&g.colorField&&g[g.colorField],Q=e.tabIndex!==void 0?e.tabIndex===null?void 0:e.tabIndex:e.selected?0:-1,V=t.useMemo(()=>l.classNames({"k-event":!e.resizeHint,"k-selected":e.selected&&i.select,"k-event-drag-hint":e.dragHint,"k-scheduler-marquee":e.resizeHint,"k-marquee":e.resizeHint,"k-first":e.resizeHint&&!e.tail,"k-last":e.resizeHint&&!e.head},e.className),[e.resizeHint,e.selected,e.dragHint,e.tail,e.head,e.className,i.select]),X=t.useMemo(()=>`${e.title}, ${fe.formatEventTime(d,e.zonedStart,e.zonedEnd,e.isAllDay,W)}`,[d,e.isAllDay,e.title,e.zonedEnd,e.zonedStart,W]),Y=t.useMemo(()=>({cursor:"pointer",userSelect:"none",borderColor:e.resizeHint?void 0:u,backgroundColor:e.resizeHint?void 0:u,touchAction:"none",...e.style}),[u,e.style,e.resizeHint]),Z=t.useCallback(n=>{r&&r.call(void 0,{syntheticEvent:n,target:a.current})},[r,a]),p=t.useCallback(n=>{c&&c.call(void 0,{syntheticEvent:n,target:a.current})},[c,a]),ee=t.useCallback(n=>{b&&b.call(void 0,{syntheticEvent:n,target:a.current})},[b,a]),te=t.useCallback(n=>{f&&f.call(void 0,{syntheticEvent:n,target:a.current})},[f,a]),ne=t.useCallback(n=>{v&&v.call(void 0,{syntheticEvent:n,target:a.current})},[v,a]),ae=t.useCallback(n=>{z&&z.call(void 0,{syntheticEvent:n,target:a.current})},[z,a]),le=t.useCallback(n=>{h&&h.call(void 0,{syntheticEvent:n,target:a.current})},[h,a]),re=t.useCallback(n=>{C&&C.call(void 0,{syntheticEvent:n,target:a.current})},[C,a]),ce=t.useCallback(n=>{D&&D.call(void 0,{syntheticEvent:n,target:a.current})},[D,a]),oe=t.useCallback(n=>{R&&R.call(void 0,{syntheticEvent:n,target:a.current})},[R,a]),se=t.useCallback(n=>{E&&E.call(void 0,{syntheticEvent:n,target:a.current})},[E,a]),ie=t.useCallback(n=>{y&&y.call(void 0,{syntheticEvent:n,target:a.current})},[y,a]),ue=t.useCallback(n=>{S&&S.call(void 0,{syntheticEvent:n,target:a.current})},[S,a]),de=t.useCallback(n=>{M&&M.call(void 0,{syntheticEvent:n,target:a.current})},[M,a]),ge=t.useCallback(n=>{I&&I.call(void 0,{dragEvent:n,target:a.current})},[I,a]),me=t.useCallback(n=>{N&&N.call(void 0,{dragEvent:n,target:a.current})},[N,a]),ke=t.useCallback(n=>{P&&P.call(void 0,{dragEvent:n,target:a.current})},[P,a]),m=t.useCallback(n=>{x&&x.call(void 0,{dragEvent:n,target:a.current})},[x,a]),_=t.useCallback(n=>{O&&O.call(void 0,{dragEvent:n,target:a.current})},[O,a]),$=t.useCallback(n=>{H&&H.call(void 0,{dragEvent:n,target:a.current})},[H,a]),k=t.useCallback(n=>{q&&q.call(void 0,{dragEvent:n,target:a.current})},[q,a]);return l.useDraggable(F,{onPress:ge,onDrag:me,onRelease:ke}),l.useDraggable(L,{onPress:m,onDrag:$,onRelease:k}),l.useDraggable(U,{onPress:m,onDrag:_,onRelease:k}),l.useDraggable(j,{onPress:m,onDrag:_,onRelease:k}),l.useDraggable(A,{onPress:m,onDrag:$,onRelease:k}),t.createElement("div",{ref:F,id:e.id,style:Y,tabIndex:Q,className:V,role:"button","aria-label":X,onFocus:Z,onBlur:p,onMouseUp:ne,onMouseDown:ee,onClick:te,onMouseOver:ae,onMouseOut:le,onMouseEnter:re,onMouseLeave:ce,onDoubleClick:oe,onKeyDown:ie,onKeyPress:ue,onKeyUp:de,"data-group-index":e.group.index,"data-range-index":e.range.index},e.children,!e.resizeHint&&t.createElement("span",{className:"k-event-actions"},i.remove&&t.createElement("a",{tabIndex:-1,"aria-hidden":"true",className:"k-link k-event-delete",title:B,"aria-label":B,onClick:se},t.createElement(l.IconWrap,{name:"x",icon:K.xIcon})),e.head&&t.createElement(l.IconWrap,{name:w==="rtl"?"caret-alt-left":"caret-alt-right",icon:w==="rtl"?K.caretAltLeftIcon:K.caretAltRightIcon})),i.resize&&e.vertical&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-resize-handle k-resize-n",ref:j}),t.createElement("span",{className:"k-resize-handle k-resize-s",ref:A})),i.resize&&!e.vertical&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-resize-handle k-resize-w",ref:U}),t.createElement("span",{className:"k-resize-handle k-resize-e",ref:L})),e.resizeHint&&t.createElement(t.Fragment,null,t.createElement("div",{className:"k-marquee-color",style:{borderColor:u,backgroundColor:u}}),t.createElement("div",{className:"k-marquee-text"},!e.tail&&t.createElement("div",{className:"k-label-top"},d.formatDate(e.zonedStart,e.format)),!e.head&&t.createElement("div",{className:"k-label-bottom"},d.formatDate(e.zonedEnd,e.format)))))});J.displayName="KendoReactSchedulerItem";exports.SchedulerItem=J;
|
package/items/SchedulerItem.mjs
CHANGED
|
@@ -6,32 +6,32 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import { useDir as
|
|
10
|
-
import { useInternationalization as
|
|
11
|
-
import { xIcon as
|
|
12
|
-
import { deleteTitle as
|
|
13
|
-
import { formatEventTime as
|
|
14
|
-
import { useSchedulerItem as
|
|
15
|
-
import { useEditable as
|
|
16
|
-
const
|
|
17
|
-
(e,
|
|
9
|
+
import { useDir as fe, classNames as ve, useDraggable as o, IconWrap as $ } from "@progress/kendo-react-common";
|
|
10
|
+
import { useInternationalization as be, useLocalization as ze } from "@progress/kendo-react-intl";
|
|
11
|
+
import { xIcon as he, caretAltLeftIcon as Ce, caretAltRightIcon as De } from "@progress/kendo-svg-icons";
|
|
12
|
+
import { deleteTitle as j, messages as G, allDay as J } from "../messages/index.mjs";
|
|
13
|
+
import { formatEventTime as Ee } from "../utils/index.mjs";
|
|
14
|
+
import { useSchedulerItem as Re } from "../hooks/useSchedulerItem.mjs";
|
|
15
|
+
import { useEditable as Me } from "../hooks/useEditable.mjs";
|
|
16
|
+
const ye = t.forwardRef(
|
|
17
|
+
(e, Q) => {
|
|
18
18
|
const {
|
|
19
19
|
// Focus
|
|
20
20
|
onFocus: d,
|
|
21
21
|
onBlur: m,
|
|
22
22
|
// Mouse
|
|
23
|
-
onMouseDown:
|
|
24
|
-
onClick:
|
|
23
|
+
onMouseDown: g,
|
|
24
|
+
onClick: k,
|
|
25
25
|
onMouseUp: f,
|
|
26
26
|
onMouseOut: v,
|
|
27
27
|
onMouseOver: b,
|
|
28
28
|
onMouseEnter: z,
|
|
29
29
|
onMouseLeave: h,
|
|
30
30
|
onDoubleClick: C,
|
|
31
|
-
onRemoveClick:
|
|
31
|
+
onRemoveClick: D,
|
|
32
32
|
// Keyboard
|
|
33
|
-
onKeyUp:
|
|
34
|
-
onKeyDown:
|
|
33
|
+
onKeyUp: E,
|
|
34
|
+
onKeyDown: R,
|
|
35
35
|
onKeyPress: M,
|
|
36
36
|
// Drag
|
|
37
37
|
onPress: y,
|
|
@@ -41,11 +41,11 @@ const Re = t.forwardRef(
|
|
|
41
41
|
onResizePress: H,
|
|
42
42
|
onResizeEndDrag: I,
|
|
43
43
|
onResizeRelease: P,
|
|
44
|
-
onResizeStartDrag:
|
|
45
|
-
} = e, { item: n, element:
|
|
44
|
+
onResizeStartDrag: S
|
|
45
|
+
} = e, { item: n, element: F } = Re(e, Q), K = fe(F), w = t.useRef(null), L = t.useRef(null), O = t.useRef(null), U = t.useRef(null), l = Me(e.editable), c = be(), A = ze(), q = A.toLanguageString(j, G[j]), B = A.toLanguageString(J, G[J]), s = e.group.resources.find(
|
|
46
46
|
(a) => !!(a.colorField && a[a.colorField] !== "" && a[a.colorField] !== void 0)
|
|
47
|
-
), r = s && s.colorField && s[s.colorField],
|
|
48
|
-
() =>
|
|
47
|
+
), r = s && s.colorField && s[s.colorField], V = e.tabIndex !== void 0 ? e.tabIndex === null ? void 0 : e.tabIndex : e.selected ? 0 : -1, X = t.useMemo(
|
|
48
|
+
() => ve(
|
|
49
49
|
{
|
|
50
50
|
"k-event": !e.resizeHint,
|
|
51
51
|
"k-selected": e.selected && l.select,
|
|
@@ -58,10 +58,16 @@ const Re = t.forwardRef(
|
|
|
58
58
|
e.className
|
|
59
59
|
),
|
|
60
60
|
[e.resizeHint, e.selected, e.dragHint, e.tail, e.head, e.className, l.select]
|
|
61
|
-
),
|
|
62
|
-
() => `${
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
), Y = t.useMemo(
|
|
62
|
+
() => `${e.title}, ${Ee(
|
|
63
|
+
c,
|
|
64
|
+
e.zonedStart,
|
|
65
|
+
e.zonedEnd,
|
|
66
|
+
e.isAllDay,
|
|
67
|
+
B
|
|
68
|
+
)}`,
|
|
69
|
+
[c, e.isAllDay, e.title, e.zonedEnd, e.zonedStart, B]
|
|
70
|
+
), Z = t.useMemo(
|
|
65
71
|
() => ({
|
|
66
72
|
cursor: "pointer",
|
|
67
73
|
userSelect: "none",
|
|
@@ -71,7 +77,7 @@ const Re = t.forwardRef(
|
|
|
71
77
|
...e.style
|
|
72
78
|
}),
|
|
73
79
|
[r, e.style, e.resizeHint]
|
|
74
|
-
),
|
|
80
|
+
), _ = t.useCallback(
|
|
75
81
|
(a) => {
|
|
76
82
|
d && d.call(void 0, {
|
|
77
83
|
syntheticEvent: a,
|
|
@@ -79,7 +85,7 @@ const Re = t.forwardRef(
|
|
|
79
85
|
});
|
|
80
86
|
},
|
|
81
87
|
[d, n]
|
|
82
|
-
),
|
|
88
|
+
), p = t.useCallback(
|
|
83
89
|
(a) => {
|
|
84
90
|
m && m.call(void 0, {
|
|
85
91
|
syntheticEvent: a,
|
|
@@ -87,23 +93,23 @@ const Re = t.forwardRef(
|
|
|
87
93
|
});
|
|
88
94
|
},
|
|
89
95
|
[m, n]
|
|
90
|
-
),
|
|
96
|
+
), ee = t.useCallback(
|
|
91
97
|
(a) => {
|
|
92
|
-
|
|
98
|
+
g && g.call(void 0, {
|
|
93
99
|
syntheticEvent: a,
|
|
94
100
|
target: n.current
|
|
95
101
|
});
|
|
96
102
|
},
|
|
97
|
-
[
|
|
98
|
-
),
|
|
103
|
+
[g, n]
|
|
104
|
+
), te = t.useCallback(
|
|
99
105
|
(a) => {
|
|
100
|
-
|
|
106
|
+
k && k.call(void 0, {
|
|
101
107
|
syntheticEvent: a,
|
|
102
108
|
target: n.current
|
|
103
109
|
});
|
|
104
110
|
},
|
|
105
|
-
[
|
|
106
|
-
),
|
|
111
|
+
[k, n]
|
|
112
|
+
), ae = t.useCallback(
|
|
107
113
|
(a) => {
|
|
108
114
|
f && f.call(void 0, {
|
|
109
115
|
syntheticEvent: a,
|
|
@@ -111,7 +117,7 @@ const Re = t.forwardRef(
|
|
|
111
117
|
});
|
|
112
118
|
},
|
|
113
119
|
[f, n]
|
|
114
|
-
),
|
|
120
|
+
), ne = t.useCallback(
|
|
115
121
|
(a) => {
|
|
116
122
|
b && b.call(void 0, {
|
|
117
123
|
syntheticEvent: a,
|
|
@@ -119,7 +125,7 @@ const Re = t.forwardRef(
|
|
|
119
125
|
});
|
|
120
126
|
},
|
|
121
127
|
[b, n]
|
|
122
|
-
),
|
|
128
|
+
), le = t.useCallback(
|
|
123
129
|
(a) => {
|
|
124
130
|
v && v.call(void 0, {
|
|
125
131
|
syntheticEvent: a,
|
|
@@ -127,7 +133,7 @@ const Re = t.forwardRef(
|
|
|
127
133
|
});
|
|
128
134
|
},
|
|
129
135
|
[v, n]
|
|
130
|
-
),
|
|
136
|
+
), re = t.useCallback(
|
|
131
137
|
(a) => {
|
|
132
138
|
z && z.call(void 0, {
|
|
133
139
|
syntheticEvent: a,
|
|
@@ -135,7 +141,7 @@ const Re = t.forwardRef(
|
|
|
135
141
|
});
|
|
136
142
|
},
|
|
137
143
|
[z, n]
|
|
138
|
-
),
|
|
144
|
+
), oe = t.useCallback(
|
|
139
145
|
(a) => {
|
|
140
146
|
h && h.call(void 0, {
|
|
141
147
|
syntheticEvent: a,
|
|
@@ -143,7 +149,7 @@ const Re = t.forwardRef(
|
|
|
143
149
|
});
|
|
144
150
|
},
|
|
145
151
|
[h, n]
|
|
146
|
-
),
|
|
152
|
+
), ce = t.useCallback(
|
|
147
153
|
(a) => {
|
|
148
154
|
C && C.call(void 0, {
|
|
149
155
|
syntheticEvent: a,
|
|
@@ -151,23 +157,23 @@ const Re = t.forwardRef(
|
|
|
151
157
|
});
|
|
152
158
|
},
|
|
153
159
|
[C, n]
|
|
154
|
-
),
|
|
160
|
+
), se = t.useCallback(
|
|
155
161
|
(a) => {
|
|
156
|
-
|
|
162
|
+
D && D.call(void 0, {
|
|
157
163
|
syntheticEvent: a,
|
|
158
164
|
target: n.current
|
|
159
165
|
});
|
|
160
166
|
},
|
|
161
|
-
[
|
|
162
|
-
),
|
|
167
|
+
[D, n]
|
|
168
|
+
), ie = t.useCallback(
|
|
163
169
|
(a) => {
|
|
164
|
-
|
|
170
|
+
R && R.call(void 0, {
|
|
165
171
|
syntheticEvent: a,
|
|
166
172
|
target: n.current
|
|
167
173
|
});
|
|
168
174
|
},
|
|
169
|
-
[
|
|
170
|
-
),
|
|
175
|
+
[R, n]
|
|
176
|
+
), ue = t.useCallback(
|
|
171
177
|
(a) => {
|
|
172
178
|
M && M.call(void 0, {
|
|
173
179
|
syntheticEvent: a,
|
|
@@ -175,15 +181,15 @@ const Re = t.forwardRef(
|
|
|
175
181
|
});
|
|
176
182
|
},
|
|
177
183
|
[M, n]
|
|
178
|
-
),
|
|
184
|
+
), de = t.useCallback(
|
|
179
185
|
(a) => {
|
|
180
|
-
|
|
186
|
+
E && E.call(void 0, {
|
|
181
187
|
syntheticEvent: a,
|
|
182
188
|
target: n.current
|
|
183
189
|
});
|
|
184
190
|
},
|
|
185
|
-
[
|
|
186
|
-
),
|
|
191
|
+
[E, n]
|
|
192
|
+
), me = t.useCallback(
|
|
187
193
|
(a) => {
|
|
188
194
|
y && y.call(void 0, {
|
|
189
195
|
dragEvent: a,
|
|
@@ -191,7 +197,7 @@ const Re = t.forwardRef(
|
|
|
191
197
|
});
|
|
192
198
|
},
|
|
193
199
|
[y, n]
|
|
194
|
-
),
|
|
200
|
+
), ge = t.useCallback(
|
|
195
201
|
(a) => {
|
|
196
202
|
N && N.call(void 0, {
|
|
197
203
|
dragEvent: a,
|
|
@@ -199,7 +205,7 @@ const Re = t.forwardRef(
|
|
|
199
205
|
});
|
|
200
206
|
},
|
|
201
207
|
[N, n]
|
|
202
|
-
),
|
|
208
|
+
), ke = t.useCallback(
|
|
203
209
|
(a) => {
|
|
204
210
|
x && x.call(void 0, {
|
|
205
211
|
dragEvent: a,
|
|
@@ -215,15 +221,15 @@ const Re = t.forwardRef(
|
|
|
215
221
|
});
|
|
216
222
|
},
|
|
217
223
|
[H, n]
|
|
218
|
-
),
|
|
224
|
+
), T = t.useCallback(
|
|
219
225
|
(a) => {
|
|
220
|
-
|
|
226
|
+
S && S.call(void 0, {
|
|
221
227
|
dragEvent: a,
|
|
222
228
|
target: n.current
|
|
223
229
|
});
|
|
224
230
|
},
|
|
225
|
-
[
|
|
226
|
-
),
|
|
231
|
+
[S, n]
|
|
232
|
+
), W = t.useCallback(
|
|
227
233
|
(a) => {
|
|
228
234
|
I && I.call(void 0, {
|
|
229
235
|
dragEvent: a,
|
|
@@ -240,49 +246,49 @@ const Re = t.forwardRef(
|
|
|
240
246
|
},
|
|
241
247
|
[P, n]
|
|
242
248
|
);
|
|
243
|
-
return o(
|
|
244
|
-
onPress:
|
|
245
|
-
onDrag:
|
|
246
|
-
onRelease:
|
|
249
|
+
return o(F, {
|
|
250
|
+
onPress: me,
|
|
251
|
+
onDrag: ge,
|
|
252
|
+
onRelease: ke
|
|
247
253
|
}), o(w, {
|
|
248
254
|
onPress: i,
|
|
249
|
-
onDrag:
|
|
255
|
+
onDrag: W,
|
|
250
256
|
onRelease: u
|
|
251
257
|
}), o(L, {
|
|
252
258
|
onPress: i,
|
|
253
|
-
onDrag:
|
|
259
|
+
onDrag: T,
|
|
254
260
|
onRelease: u
|
|
255
261
|
}), o(O, {
|
|
256
262
|
onPress: i,
|
|
257
|
-
onDrag:
|
|
263
|
+
onDrag: T,
|
|
258
264
|
onRelease: u
|
|
259
265
|
}), o(U, {
|
|
260
266
|
onPress: i,
|
|
261
|
-
onDrag:
|
|
267
|
+
onDrag: W,
|
|
262
268
|
onRelease: u
|
|
263
269
|
}), /* @__PURE__ */ t.createElement(
|
|
264
270
|
"div",
|
|
265
271
|
{
|
|
266
|
-
ref:
|
|
272
|
+
ref: F,
|
|
267
273
|
id: e.id,
|
|
268
|
-
style:
|
|
269
|
-
tabIndex:
|
|
270
|
-
className:
|
|
274
|
+
style: Z,
|
|
275
|
+
tabIndex: V,
|
|
276
|
+
className: X,
|
|
271
277
|
role: "button",
|
|
272
|
-
"aria-label":
|
|
273
|
-
onFocus:
|
|
274
|
-
onBlur:
|
|
275
|
-
onMouseUp:
|
|
276
|
-
onMouseDown:
|
|
277
|
-
onClick:
|
|
278
|
-
onMouseOver:
|
|
279
|
-
onMouseOut:
|
|
280
|
-
onMouseEnter:
|
|
281
|
-
onMouseLeave:
|
|
282
|
-
onDoubleClick:
|
|
283
|
-
onKeyDown:
|
|
284
|
-
onKeyPress:
|
|
285
|
-
onKeyUp:
|
|
278
|
+
"aria-label": Y,
|
|
279
|
+
onFocus: _,
|
|
280
|
+
onBlur: p,
|
|
281
|
+
onMouseUp: ae,
|
|
282
|
+
onMouseDown: ee,
|
|
283
|
+
onClick: te,
|
|
284
|
+
onMouseOver: ne,
|
|
285
|
+
onMouseOut: le,
|
|
286
|
+
onMouseEnter: re,
|
|
287
|
+
onMouseLeave: oe,
|
|
288
|
+
onDoubleClick: ce,
|
|
289
|
+
onKeyDown: ie,
|
|
290
|
+
onKeyPress: ue,
|
|
291
|
+
onKeyUp: de,
|
|
286
292
|
"data-group-index": e.group.index,
|
|
287
293
|
"data-range-index": e.range.index
|
|
288
294
|
},
|
|
@@ -293,16 +299,16 @@ const Re = t.forwardRef(
|
|
|
293
299
|
tabIndex: -1,
|
|
294
300
|
"aria-hidden": "true",
|
|
295
301
|
className: "k-link k-event-delete",
|
|
296
|
-
title:
|
|
297
|
-
"aria-label":
|
|
298
|
-
onClick:
|
|
302
|
+
title: q,
|
|
303
|
+
"aria-label": q,
|
|
304
|
+
onClick: se
|
|
299
305
|
},
|
|
300
|
-
/* @__PURE__ */ t.createElement(
|
|
306
|
+
/* @__PURE__ */ t.createElement($, { name: "x", icon: he })
|
|
301
307
|
), e.head && /* @__PURE__ */ t.createElement(
|
|
302
|
-
|
|
308
|
+
$,
|
|
303
309
|
{
|
|
304
310
|
name: K === "rtl" ? "caret-alt-left" : "caret-alt-right",
|
|
305
|
-
icon: K === "rtl" ?
|
|
311
|
+
icon: K === "rtl" ? Ce : De
|
|
306
312
|
}
|
|
307
313
|
)),
|
|
308
314
|
l.resize && e.vertical && /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("span", { className: "k-resize-handle k-resize-n", ref: O }), /* @__PURE__ */ t.createElement("span", { className: "k-resize-handle k-resize-s", ref: U })),
|
|
@@ -311,7 +317,7 @@ const Re = t.forwardRef(
|
|
|
311
317
|
);
|
|
312
318
|
}
|
|
313
319
|
);
|
|
314
|
-
|
|
320
|
+
ye.displayName = "KendoReactSchedulerItem";
|
|
315
321
|
export {
|
|
316
|
-
|
|
322
|
+
ye as SchedulerItem
|
|
317
323
|
};
|
|
@@ -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 fe=require("react"),he=require("./SchedulerItem.js"),m=require("../utils/index.js"),E=require("../views/common/utils.js"),I=require("../constants/index.js"),ge=require("@progress/kendo-react-intl"),Q=require("./SchedulerItemContent.js"),P=require("@progress/kendo-react-common"),H=require("@progress/kendo-svg-icons"),U=require("../context/SchedulerViewContext.js"),Se=require("../context/SchedulerContext.js"),Re=require("../hooks/useRowSync.js");function Ie(e){const w=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const S in e)if(S!=="default"){const x=Object.getOwnPropertyDescriptor(e,S);Object.defineProperty(w,S,x.get?x:{enumerable:!0,get:()=>e[S]})}}return w.default=e,Object.freeze(w)}const n=Ie(fe),we=1,X=25,Y=n.forwardRef((e,w)=>{const{item:S,_ref:x,itemRef:ee,...te}=e,M=n.useRef(void 0),o=n.useRef(null),q=n.useRef(null),C=n.useRef(null);n.useImperativeHandle(q,()=>({props:e,element:o.current&&o.current.element})),n.useImperativeHandle(w,()=>q.current),n.useImperativeHandle(x,()=>o.current),n.useImperativeHandle(ee,()=>o.current);const re=S||Z.item,p=ge.useInternationalization(),[ne]=U.useSchedulerViewItemsContext(),[ie]=U.useSchedulerViewSlotsContext(),D=Se.useSchedulerElementContext(),[ce,k]=n.useState(!0),[oe,se]=n.useState(!1),V=n.useRef(0),h=n.useRef(null),g=n.useRef([]),W=P.useDir(D),B=n.useMemo(()=>{var i,r;return e.isAllDay?(i=e.title)!=null?i:"":`(${p.format("{0:t} - {1:t}",e.zonedStart,e.zonedEnd)}): ${(r=e.title)!=null?r:""}`},[p,e.isAllDay,e.title,e.zonedEnd,e.zonedStart]),le=(i,r)=>{let c=0;return r.forEach(l=>{l._order!==void 0&&l._order!==null&&c<l._order&&(c=l._order)}),c+1},ae=(i,r,c)=>{const[l,f]=r,a=new Date(Math.min(f.props.end.getTime()-c,Math.max(e.start.getTime(),l.props.start.getTime()))),R=new Date(Math.max(a.getTime()+c,Math.min(e.end.getTime(),f.props.end.getTime())));return i.filter(u=>{const _=Math.max(Math.min(f.props.end.getTime()-c,u.props.start.getTime()),l.props.start.getTime()),v=Math.min(Math.max(_+c,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)&&m.intersects(new Date(_),new Date(v),a,R)&&m.intersects(l.props.start,f.props.end,u.props.start,u.props.end)})},ue=(i,r)=>i.group.index===r.group.index&&i.range.index===r.range.index&&(i.range.isAllDay===void 0||r.range.isAllDay===void 0||i.range.isAllDay===r.range.isAllDay)&&(e.ignoreIsAllDay||i.isAllDay===r.isAllDay),A=()=>{var $,G,L,K,J;const i=ie.filter(t=>t.current&&ue(t.current.props,e)).sort((t,T)=>t.current.props.start.getTime()-T.current.props.start.getTime()),r=i.filter(t=>m.intersects(t.current.props.start,t.current.props.end,e.start,e.end)),c=o.current&&o.current.element;if(!c||!r.length)return;const l=m.first(i),f=m.last(i),a=m.first(r),R=m.last(r);if(!a.current||!o.current||!R.current||!l.current||!f.current)return;if(!m.intersects(a.current.props.start,R.current.props.end,e.start,e.end)){k(!1);return}const b=[],u=[],_=[],v=E.getRect(a.current.element),O=(e.vertical?v.height:v.width)/(a.current.props.end.getTime()-a.current.props.start.getTime()),j=(e.vertical?X:8)/O,y=(Math.min(e.start.getTime(),R.current.props.end.getTime()-j)-a.current.props.start.getTime())*O,F=Math.floor(Math.min(e.end.getTime(),R.current.props.end.getTime())-Math.max(e.start.getTime(),a.current.props.start.getTime()))*O;(ne||[]).forEach(t=>{t.current&&(t.current.props.dragHint?u.push(t.current):t.current.props.resizeHint?_.push(t.current):b.push(t.current))}),g.current=ae(b,[l.current,f.current],j),h.current=e.resizeHint||e.dragHint?0:m.calculateProportionalOrder(o.current,g.current);let d=1;e.resizeHint||e.dragHint||(d=le(o.current,g.current),g.current.forEach(t=>{t._maxSiblingsPerSlot&&d<t._maxSiblingsPerSlot&&(d=t._maxSiblingsPerSlot)}),g.current.forEach(t=>{t._maxSiblingsPerSlot!==void 0&&t._maxSiblingsPerSlot!==null&&t._maxSiblingsPerSlot<d&&(t._maxSiblingsPerSlot=d)}));let z=0;const s=v;g.current.forEach(t=>{let T=0;t._order!==void 0&&t._order!==null&&t._order<h.current&&(T=E.getRect(t.element).top+E.getRect(t.element).height-s.top-I.BORDER_WIDTH*h.current+we),T>z&&(z=T)});const me=20;s.width=e.vertical?s.width/d-I.BORDER_WIDTH-me/d:F-I.BORDER_WIDTH,e.vertical?s.height=F-I.BORDER_WIDTH:(e.resizeHint||e.dragHint)&&d<=1||(s.height=(G=($=e.style)==null?void 0:$.height)!=null?G:X),s.left=e.vertical?s.left+((L=h.current)!=null?L:0)+I.BORDER_WIDTH*((K=h.current)!=null?K:0)*s.width:s.left+(y<0?0:y),s.top=e.vertical?s.top+(y<0?0:y):s.top+z+I.BORDER_WIDTH*((J=h.current)!=null?J:0),V.current=d,E.setRect(c,s),se(!0),k(!0)},N=n.useCallback(i=>{const r=i&&i[0],c=C.current;M.current!==void 0&&window.cancelAnimationFrame(M.current),c&&r&&(c.width!==r.contentRect.width||c.height!==r.contentRect.height)&&(M.current=window.requestAnimationFrame(()=>{A()})),C.current={width:r.contentRect.width,height:r.contentRect.height}},[A]);n.useEffect(A);const de=o.current&&o.current.element?o.current.element.closest(".k-scheduler-layout"):null;return Re.useRowSync({element:de,selector:".k-resource-row",horizontalAttribute:"data-depth-index",verticalAttribute:"data-resource-index",applyTo:".k-resource-cell",syncHeight:e.isLast}),n.useEffect(()=>{if(!D.current)return;const i=window.ResizeObserver,r=i&&new i(N);return r&&r.observe(D.current),()=>{r&&r.disconnect()}},[N,D]),n.createElement(re,{...te,_ref:o,_order:h,_maxSiblingsPerSlot:V,_siblings:g,itemRef:o,style:{visibility:oe?void 0:"hidden",display:ce?void 0:"none",...e.style}},!e.resizeHint&&n.createElement("span",{className:"k-event-actions"},e.tail&&n.createElement(P.IconWrap,{name:W==="rtl"?"caret-alt-right":"caret-alt-left",icon:W==="rtl"?H.caretAltRightIcon:H.caretAltLeftIcon}),e.isRecurring&&!e.isException&&n.createElement(P.IconWrap,{name:"reload",icon:H.arrowRotateCwIcon}),!e.isRecurring&&e.isException&&n.createElement(P.IconWrap,{name:"non-recurrence",icon:H.nonRecurrenceIcon})),!e.resizeHint&&n.createElement("div",{title:B},!e.isAllDay&&n.createElement(Q.SchedulerItemContent,{className:"k-event-time"},B),n.createElement(Q.SchedulerItemContent,null,e.title)))}),Z={item:he.SchedulerItem};Y.displayName="KendoReactSchedulerProportionalViewItem";exports.SchedulerProportionalViewItem=Y;exports.schedulerProportionalViewItemDefaultProps=Z;
|