@progress/kendo-react-scheduler 16.1.0-develop.3 → 16.1.0-develop.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Scheduler.js +1 -1
- package/Scheduler.mjs +141 -138
- package/components/CurrentTimeMarket.js +1 -1
- package/components/CurrentTimeMarket.mjs +26 -26
- package/components/MoreEventsPopover.js +1 -1
- package/components/MoreEventsPopover.mjs +45 -29
- package/dist/cdn/js/kendo-react-scheduler.js +1 -1
- package/hooks/index.d.ts +2 -2
- package/hooks/usePropOrState.d.ts +2 -1
- package/hooks/usePropOrState.js +8 -0
- package/hooks/usePropOrState.mjs +16 -0
- package/hooks/useWorkHours.d.ts +1 -1
- package/hooks/useWorkHours.js +8 -0
- package/hooks/useWorkHours.mjs +18 -0
- package/models/Group.d.ts +2 -0
- package/models/SchedulerView.d.ts +4 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +12 -12
- package/services/itemsService.js +1 -1
- package/services/itemsService.mjs +34 -34
- package/services/occurrenceService.js +1 -1
- package/services/occurrenceService.mjs +27 -24
- package/utils/index.js +1 -1
- package/utils/index.mjs +2 -2
- package/views/day/MultiDayView.js +1 -1
- package/views/day/MultiDayView.mjs +97 -93
- package/views/time/MultiDayTimelineView.js +1 -1
- package/views/time/MultiDayTimelineView.mjs +93 -88
|
@@ -10,66 +10,66 @@ import * as T from "react-dom";
|
|
|
10
10
|
import { cloneDate as M } from "@progress/kendo-date-math";
|
|
11
11
|
import { useDir as C, classNames as z } from "@progress/kendo-react-common";
|
|
12
12
|
import { intersects as P, isInTimeRange as $, first as A } from "../utils/index.mjs";
|
|
13
|
-
import { getRect as
|
|
13
|
+
import { getRect as h } from "../views/common/utils.mjs";
|
|
14
14
|
import { useSchedulerElementContext as H, useSchedulerPropsContext as N } from "../context/SchedulerContext.mjs";
|
|
15
15
|
import { useSchedulerViewSlotsContext as O } from "../context/SchedulerViewContext.mjs";
|
|
16
16
|
const X = (e) => {
|
|
17
17
|
let r = 0;
|
|
18
18
|
return e.forEach((c) => {
|
|
19
19
|
if (c.current) {
|
|
20
|
-
const
|
|
21
|
-
r +=
|
|
20
|
+
const o = h(c.current.element);
|
|
21
|
+
r += o.width;
|
|
22
22
|
}
|
|
23
23
|
}), r;
|
|
24
24
|
}, F = (e) => {
|
|
25
25
|
let r = 0;
|
|
26
26
|
return e.forEach((c) => {
|
|
27
27
|
if (c.current) {
|
|
28
|
-
const
|
|
29
|
-
r +=
|
|
28
|
+
const o = h(c.current.element);
|
|
29
|
+
r += o.height;
|
|
30
30
|
}
|
|
31
31
|
}), r;
|
|
32
32
|
}, Y = (e, r) => {
|
|
33
33
|
const c = M(e);
|
|
34
34
|
return c.setHours(r.getHours(), r.getMinutes(), r.getSeconds(), r.getMilliseconds()), c;
|
|
35
35
|
}, K = (e) => {
|
|
36
|
-
const [r, c] = n.useState(!1),
|
|
36
|
+
const [r, c] = n.useState(!1), o = H(), b = N(), d = n.useRef(void 0), l = n.useRef(null), s = n.useRef(null), g = e.updateInterval || V.updateInterval, [, R] = n.useState(!1), a = C(s, b.rtl === !0 ? "rtl" : void 0), [v] = O(), f = n.useCallback(() => {
|
|
37
37
|
if (!v)
|
|
38
38
|
return;
|
|
39
|
-
const
|
|
39
|
+
const i = v.filter(
|
|
40
40
|
(t) => t.current && (e.groupIndex === void 0 || e.groupIndex === null || t.current.props.group.index === e.groupIndex) && (e.vertical ? P(/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date(), t.current.props.start, t.current.props.end, !0) : $(/* @__PURE__ */ new Date(), t.current.props.start, t.current.props.end)) && !t.current.props.isAllDay
|
|
41
41
|
);
|
|
42
|
-
if (
|
|
43
|
-
const t = A(
|
|
42
|
+
if (i && i.length && l.current && s.current) {
|
|
43
|
+
const t = A(i);
|
|
44
44
|
if (!t.current)
|
|
45
45
|
return;
|
|
46
|
-
const S = e.vertical ? F(
|
|
47
|
-
e.vertical ?
|
|
46
|
+
const S = e.vertical ? F(i) : X(i), u = h(t.current.element), y = h(l.current), k = (e.vertical ? u.width : u.height) / (t.current.props.end.getTime() - t.current.props.start.getTime()), p = (Date.now() - Y(/* @__PURE__ */ new Date(), t.current.props.start).getTime()) * k, E = a === "rtl", I = e.vertical ? u.top : u.top + p - y.height / 2, m = E ? "right" : "left", D = e.vertical ? u[m] + p - y.width / 2 : u[m];
|
|
47
|
+
e.vertical ? l.current.style[m] = `${D}px` : l.current.style.top = `${I}px`, s.current.style[m] = `${D}px`, s.current.style.top = `${I}px`, s.current.style[e.vertical ? "height" : "width"] = `${S - 1}px`, c(!0);
|
|
48
48
|
} else
|
|
49
|
-
c(!1);
|
|
50
|
-
}, [v, e.groupIndex, e.vertical,
|
|
51
|
-
|
|
52
|
-
}, [
|
|
49
|
+
l.current && (l.current.style.top = "", l.current.style.left = "", l.current.style.right = ""), s.current && (s.current.style.top = "", s.current.style.left = "", s.current.style.right = ""), c(!1);
|
|
50
|
+
}, [v, e.groupIndex, e.vertical, a]), w = n.useCallback(() => {
|
|
51
|
+
f(), R((i) => !i);
|
|
52
|
+
}, [f]);
|
|
53
53
|
n.useEffect(() => {
|
|
54
|
-
if (!
|
|
54
|
+
if (!o.current || !window)
|
|
55
55
|
return;
|
|
56
|
-
clearInterval(
|
|
57
|
-
const
|
|
58
|
-
return t && t.observe(
|
|
59
|
-
clearInterval(
|
|
56
|
+
clearInterval(d.current), d.current = window.setInterval(w, g);
|
|
57
|
+
const i = window.ResizeObserver, t = i && new i(w);
|
|
58
|
+
return t && t.observe(o.current), () => {
|
|
59
|
+
clearInterval(d.current), t && t.disconnect();
|
|
60
60
|
};
|
|
61
|
-
}, [
|
|
61
|
+
}, [f, w, o, g]), n.useEffect(f);
|
|
62
62
|
const x = /* @__PURE__ */ n.createElement(
|
|
63
63
|
"div",
|
|
64
64
|
{
|
|
65
|
-
ref:
|
|
65
|
+
ref: l,
|
|
66
66
|
className: z("k-current-time", {
|
|
67
|
-
"k-current-time-arrow-right": !e.vertical &&
|
|
68
|
-
"k-current-time-arrow-left": !e.vertical &&
|
|
67
|
+
"k-current-time-arrow-right": !e.vertical && a !== "rtl",
|
|
68
|
+
"k-current-time-arrow-left": !e.vertical && a === "rtl",
|
|
69
69
|
"k-current-time-arrow-down": e.vertical
|
|
70
70
|
}),
|
|
71
71
|
style: {
|
|
72
|
-
transform: e.vertical ?
|
|
72
|
+
transform: e.vertical ? a === "rtl" ? "translateX(50%)" : "translateX(-50%)" : "translateY(-50%)",
|
|
73
73
|
visibility: r ? void 0 : "hidden"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -78,7 +78,7 @@ const X = (e) => {
|
|
|
78
78
|
"div",
|
|
79
79
|
{
|
|
80
80
|
className: "k-current-time",
|
|
81
|
-
ref:
|
|
81
|
+
ref: s,
|
|
82
82
|
style: {
|
|
83
83
|
transform: e.vertical ? "translateX(-50%)" : "translateY(-50%)",
|
|
84
84
|
[e.vertical ? "width" : "height"]: "1px",
|
|
@@ -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 w=require("react"),P=require("@progress/kendo-react-tooltip"),h=require("@progress/kendo-react-intl"),i=require("../messages/index.js");function R(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const n in l)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(l,n);Object.defineProperty(s,n,t.get?t:{enumerable:!0,get:()=>l[n]})}}return s.default=l,Object.freeze(s)}const e=R(w),C={skeleton:"MMM"},L={skeleton:"dd"},_="t",b=l=>{const{show:s,anchor:n,slot:t,itemsPerSlot:v,onDayClick:m,onClose:r}=l,p=h.useInternationalization(),g=h.useLocalization(),k=e.useMemo(()=>t?t.items.filter((o,d)=>d>=v):[],[t,v]),D=e.useCallback(o=>{t&&m&&m(t)},[t,m]);e.useEffect(()=>{if(!s)return;const o=d=>{const a=d.target,c=document.querySelector(".k-scheduler-popover");c&&!c.contains(a)&&n&&!n.contains(a)&&(r==null||r())};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[s,n,r]);const M=e.useCallback(o=>{o.key==="Escape"&&(r==null||r())},[r]);if(!t)return null;const f=new Date(t.zonedEnd.getTime()-(t.zonedEnd.getTime()-t.zonedStart.getTime())/2),T=p.formatDate(f,C),S=p.formatDate(f,L),N=g.toLanguageString(i.noEvents,i.messages[i.noEvents]),O=g.toLanguageString(i.popoverEvents,i.messages[i.popoverEvents]),z=e.createElement(e.Fragment,null,e.createElement("div",{className:"k-month"},T),e.createElement("div",{className:"k-link k-day",onClick:D},S));return e.createElement(P.Popover,{anchor:n,show:s,popoverClass:"k-scheduler-popover",position:"right",collision:{horizontal:"flip",vertical:"flip"},callout:!0,title:z,style:{width:220},onKeyDown:M,animate:{type:"slide",direction:"right",openDuration:500,closeDuration:500}},k.length>0?e.createElement("div",{className:"k-popover-events",role:"list","aria-label":O},k.map((o,d)=>{var E,y;const a=(y=(E=o.group)==null?void 0:E.resources)==null?void 0:y.find(u=>!!(u.colorField&&u[u.colorField]!==""&&u[u.colorField]!==void 0)),c=(a==null?void 0:a.colorField)&&a[a.colorField],F=c?{backgroundColor:c,borderColor:c}:void 0;return e.createElement("div",{key:o.uid||d,className:"k-popover-event k-event",role:"listitem",style:F},e.createElement("div",{className:"k-event-title"},o.title||""),e.createElement("span",{className:"k-event-time"},p.formatDate(o.zonedStart,_)))})):e.createElement("span",{className:"k-no-data"},N))};b.displayName="KendoReactSchedulerMoreEventsPopover";exports.MoreEventsPopover=b;
|
|
@@ -6,54 +6,70 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as e from "react";
|
|
9
|
-
import { Popover as
|
|
10
|
-
import { useInternationalization as
|
|
11
|
-
import { noEvents as
|
|
12
|
-
const
|
|
13
|
-
const { show:
|
|
14
|
-
(
|
|
15
|
-
|
|
9
|
+
import { Popover as L } from "@progress/kendo-react-tooltip";
|
|
10
|
+
import { useInternationalization as S, useLocalization as R } from "@progress/kendo-react-intl";
|
|
11
|
+
import { noEvents as g, messages as h, popoverEvents as y } from "../messages/index.mjs";
|
|
12
|
+
const A = { skeleton: "MMM" }, O = { skeleton: "dd" }, P = "t", _ = (D) => {
|
|
13
|
+
const { show: c, anchor: i, slot: o, itemsPerSlot: u, onDayClick: d, onClose: n } = D, m = S(), p = R(), v = e.useMemo(() => o ? o.items.filter((t, r) => r >= u) : [], [o, u]), M = e.useCallback(
|
|
14
|
+
(t) => {
|
|
15
|
+
o && d && d(o);
|
|
16
16
|
},
|
|
17
|
-
[
|
|
17
|
+
[o, d]
|
|
18
18
|
);
|
|
19
19
|
e.useEffect(() => {
|
|
20
|
-
if (!
|
|
20
|
+
if (!c)
|
|
21
21
|
return;
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
22
|
+
const t = (r) => {
|
|
23
|
+
const a = r.target, l = document.querySelector(".k-scheduler-popover");
|
|
24
|
+
l && !l.contains(a) && i && !i.contains(a) && (n == null || n());
|
|
25
25
|
};
|
|
26
|
-
return document.addEventListener("mousedown",
|
|
27
|
-
document.removeEventListener("mousedown",
|
|
26
|
+
return document.addEventListener("mousedown", t), () => {
|
|
27
|
+
document.removeEventListener("mousedown", t);
|
|
28
28
|
};
|
|
29
|
-
}, [
|
|
30
|
-
const
|
|
31
|
-
(
|
|
32
|
-
|
|
29
|
+
}, [c, i, n]);
|
|
30
|
+
const T = e.useCallback(
|
|
31
|
+
(t) => {
|
|
32
|
+
t.key === "Escape" && (n == null || n());
|
|
33
33
|
},
|
|
34
|
-
[
|
|
34
|
+
[n]
|
|
35
35
|
);
|
|
36
|
-
if (!
|
|
36
|
+
if (!o)
|
|
37
37
|
return null;
|
|
38
|
-
const
|
|
38
|
+
const k = new Date(o.zonedEnd.getTime() - (o.zonedEnd.getTime() - o.zonedStart.getTime()) / 2), F = m.formatDate(k, A), N = m.formatDate(k, O), z = p.toLanguageString(g, h[g]), b = p.toLanguageString(y, h[y]), w = /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "k-month" }, F), /* @__PURE__ */ e.createElement("div", { className: "k-link k-day", onClick: M }, N));
|
|
39
39
|
return /* @__PURE__ */ e.createElement(
|
|
40
|
-
|
|
40
|
+
L,
|
|
41
41
|
{
|
|
42
|
-
anchor:
|
|
43
|
-
show:
|
|
42
|
+
anchor: i,
|
|
43
|
+
show: c,
|
|
44
44
|
popoverClass: "k-scheduler-popover",
|
|
45
45
|
position: "right",
|
|
46
46
|
collision: { horizontal: "flip", vertical: "flip" },
|
|
47
47
|
callout: !0,
|
|
48
|
-
title:
|
|
48
|
+
title: w,
|
|
49
49
|
style: { width: 220 },
|
|
50
|
-
onKeyDown:
|
|
50
|
+
onKeyDown: T,
|
|
51
51
|
animate: { type: "slide", direction: "right", openDuration: 500, closeDuration: 500 }
|
|
52
52
|
},
|
|
53
|
-
|
|
53
|
+
v.length > 0 ? /* @__PURE__ */ e.createElement("div", { className: "k-popover-events", role: "list", "aria-label": b }, v.map((t, r) => {
|
|
54
|
+
var E, f;
|
|
55
|
+
const a = (f = (E = t.group) == null ? void 0 : E.resources) == null ? void 0 : f.find(
|
|
56
|
+
(s) => !!(s.colorField && s[s.colorField] !== "" && s[s.colorField] !== void 0)
|
|
57
|
+
), l = (a == null ? void 0 : a.colorField) && a[a.colorField], C = l ? { backgroundColor: l, borderColor: l } : void 0;
|
|
58
|
+
return /* @__PURE__ */ e.createElement(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
key: t.uid || r,
|
|
62
|
+
className: "k-popover-event k-event",
|
|
63
|
+
role: "listitem",
|
|
64
|
+
style: C
|
|
65
|
+
},
|
|
66
|
+
/* @__PURE__ */ e.createElement("div", { className: "k-event-title" }, t.title || ""),
|
|
67
|
+
/* @__PURE__ */ e.createElement("span", { className: "k-event-time" }, m.formatDate(t.zonedStart, P))
|
|
68
|
+
);
|
|
69
|
+
})) : /* @__PURE__ */ e.createElement("span", { className: "k-no-data" }, z)
|
|
54
70
|
);
|
|
55
71
|
};
|
|
56
|
-
|
|
72
|
+
_.displayName = "KendoReactSchedulerMoreEventsPopover";
|
|
57
73
|
export {
|
|
58
|
-
|
|
74
|
+
_ as MoreEventsPopover
|
|
59
75
|
};
|