@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/utils/index.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"});require("@progress/kendo-date-math");const f=require("../views/common/utils.js"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@progress/kendo-date-math");const f=require("../views/common/utils.js"),D=require("@progress/kendo-react-common"),I=require("@progress/kendo-data-query"),x=e=>e[0],F=e=>e[e.length-1],A=e=>{const r=new Set;return e.forEach(n=>{r.add(n.field)}),r.size===e.length};function S(e,r,n,o,t="all day"){const s={skeleton:"yMMMMEEEEdhm"},i={skeleton:"yMMMMEEEEd"},l="t",u=r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()&&r.getDate()===n.getDate();if(o){const c=n.getHours()===0&&n.getMinutes()===0&&n.getSeconds()===0&&n.getTime()-r.getTime()===864e5;return u||c?`${e.formatDate(r,i)} (${t})`:`${e.formatDate(r,i)} to ${e.formatDate(n,i)} (${t})`}return u?`${e.formatDate(r,s)}–${e.formatDate(n,l)}`:`${e.formatDate(r,s)}-${e.formatDate(n,s)}`}const M=(e,r,n,o=0)=>{if(o===n)return null;let t=null;const s=document.elementFromPoint(e,r);if(!s)return t;if(s.getAttribute("data-slot")==="true")return s;const l=s.style.pointerEvents;return s.style.pointerEvents="none",t=M(e,r,n,o+1),s.style.pointerEvents=l,t},d=(e,r)=>D.getter(r)(e),v=(e,r,n)=>{if(r)return D.setter(r)(e,n)},R=e=>e!=null;function H(e){return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))}const $=(e,r,n)=>{const o=h(e,r)?d(e,r.id):d(e,r.recurrenceId);return n.find(t=>d(t,r.id)===o)},h=(e,r)=>{const n=d(e,r.id),o=d(e,r.recurrenceId),t=d(e,r.recurrenceRule);return!!(n&&t&&o==null)},m=(e,r)=>Math.max(e.getTime(),r.getTime()),y=(e,r)=>Math.min(e.getTime(),r.getTime()),p=(e,r,n,o,t=!1)=>t?m(r,o)-y(e,n)<=r.getTime()-e.getTime()+(o.getTime()-n.getTime()):m(r,o)-y(e,n)<r.getTime()-e.getTime()+(o.getTime()-n.getTime()),T={id:"id",start:"start",startTimezone:"startTimezone",originalStart:"originalStart",end:"end",endTimezone:"endTimezone",isAllDay:"isAllDay",title:"title",description:"description",recurrenceRule:"recurrenceRule",recurrenceId:"recurrenceId",recurrenceExceptions:"recurrenceExceptions"},N=e=>({fields:{...T,...e}}),O=(e,r,n)=>(r.getHours()<e.getHours()||r.getHours()===e.getHours()&&r.getMinutes()<=e.getMinutes())&&(e.getHours()<n.getHours()||n.getHours()===e.getHours()&&e.getMinutes()<n.getMinutes()),P=(e,r,n)=>r<n?r<=e&&e<=n:e<=n||r<=e,k=(e,r)=>{const n=f.toGroupResources(e,r),o=f.toFlatGroupResources(n);return o.length===1?[{index:0,resources:(r||[]).reduce((t,s)=>[...t,...s.data.map(i=>({...i,field:s.field,valueField:s.valueField,colorField:s.colorField,multiple:s.multiple}))],[])}]:o.map((t,s)=>({index:s,resources:t}))},E=e=>e==null,G=e=>E(e)||e.trim&&e.trim().length===0,g=e=>{let r=0;const n=e.slice();return n.sort((o,t)=>o-t).forEach((o,t)=>{n[t]===t&&(r=t+1)}),r},_=(e,r,n,o=!1)=>{let t;return n.forEach(s=>{const i=[];r.sort((u,c)=>u.props.start.getTime()-c.props.start.getTime()).forEach(u=>{if((o||u.props.isAllDay===s.current.props.isAllDay)&&u.props.range.index===s.current.props.range.index&&u.props.group.index===s.current.props.group.index&&p(u.props.start,u.props.end,s.current.props.start,s.current.props.end)){const a=g(i);u===e&&t===void 0&&(t=a),i.splice(a,0,a)}})}),t},b=(e,r)=>{const n=new Set;return r.forEach(t=>{t._order!==void 0&&t._order!==null&&n.add(t._order)}),g(Array.from(n))},z=(e,r,n=!1)=>{e.forEach(t=>{t.order=null}),r.forEach(t=>t.items.splice(0,t.items.length));const o=[...e].sort((t,s)=>t.start.getTime()-s.start.getTime());r.forEach(t=>{const s=[];o.forEach(i=>{if((n||i.isAllDay===t.isAllDay)&&i.range.index===t.range.index&&(i.range.isAllDay===void 0||t.range.isAllDay===void 0||i.range.isAllDay===t.range.isAllDay)&&i.group.index===t.group.index&&p(i.start,i.end,t.start,t.end)){if(i.order!==null&&i.order!==void 0)s.includes(i.order)||(s.push(i.order),s.sort((u,c)=>u-c));else{const u=g(s);i.order=u,s.push(u),s.sort((c,a)=>c-a)}t.items.push(i)}})})},q=(e,r,n=!1)=>{e.forEach(o=>o.slots.splice(0,o.slots.length)),e.forEach(o=>{r.forEach(t=>{(n||o.isAllDay===t.isAllDay)&&o.range.index===t.range.index&&(o.range.isAllDay===void 0||t.range.isAllDay===void 0||o.range.isAllDay===t.range.isAllDay)&&o.group.index===t.group.index&&p(o.start,o.end,t.start,t.end)&&o.slots.push(t)})})},B=(...e)=>{},C=e=>{const r=e.props.items.find(n=>n.order===0)||e.props.items[0];return r&&r._ref.current},w=(e,r,n=!1,o=!1)=>{const t=e.current;if(!t||!r)return null;const s=r.filter(c=>c.current!==null&&c.current.element!==null),i=I.orderBy(s,[{field:"current.props.group.index",dir:"asc"},{field:"current.props.range.index",dir:"asc"},n?{field:""}:{field:"current.props.isAllDay",dir:"desc"},{field:"current.props.start",dir:"asc"}]),l=i.findIndex(c=>c.current!==null&&!!(c.current.props.uid===t.props.uid&&(c.current.props.occurrenceId===void 0||c.current.props.occurrenceId===t.props.occurrenceId)&&c.current.props.group.index===t.props.group.index&&c.current.props.range.index===t.props.range.index&&(n||c.current.props.isAllDay===t.props.isAllDay)));return i[l+(o?-1:1)]},U=(e,r)=>(e.order||0)-(r.order||0);exports.calculateOrder=_;exports.calculateProportionalOrder=b;exports.defaultModelFields=T;exports.findFirstItem=C;exports.findMaster=$;exports.findMissing=g;exports.findNextItem=w;exports.first=x;exports.formatEventTime=S;exports.getField=d;exports.getModelFields=N;exports.intersects=p;exports.isBlank=E;exports.isGroupped=A;exports.isInDaysRange=P;exports.isInTimeRange=O;exports.isMaster=h;exports.isNullOrEmptyString=G;exports.isPresent=R;exports.last=F;exports.mapItemsToSlots=q;exports.mapSlotsToItems=z;exports.noop=B;exports.orderSort=U;exports.setField=v;exports.slotDive=M;exports.toSchedulerGroups=k;exports.toUTCDateTime=H;
|
package/utils/index.mjs
CHANGED
|
@@ -6,21 +6,25 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import "@progress/kendo-date-math";
|
|
9
|
-
import { toGroupResources as h, toFlatGroupResources as
|
|
10
|
-
import { setter as
|
|
11
|
-
import { orderBy as
|
|
12
|
-
const
|
|
9
|
+
import { toGroupResources as h, toFlatGroupResources as D } from "../views/common/utils.mjs";
|
|
10
|
+
import { setter as y, getter as M } from "@progress/kendo-react-common";
|
|
11
|
+
import { orderBy as E } from "@progress/kendo-data-query";
|
|
12
|
+
const R = (r) => r[0], $ = (r) => r[r.length - 1], N = (r) => {
|
|
13
13
|
const e = /* @__PURE__ */ new Set();
|
|
14
|
-
return r.forEach((
|
|
15
|
-
e.add(
|
|
14
|
+
return r.forEach((n) => {
|
|
15
|
+
e.add(n.field);
|
|
16
16
|
}), e.size === r.length;
|
|
17
17
|
};
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
|
|
18
|
+
function _(r, e, n, o, t = "all day") {
|
|
19
|
+
const s = { skeleton: "yMMMMEEEEdhm" }, c = { skeleton: "yMMMMEEEEd" }, d = "t", i = e.getFullYear() === n.getFullYear() && e.getMonth() === n.getMonth() && e.getDate() === n.getDate();
|
|
20
|
+
if (o) {
|
|
21
|
+
const u = n.getHours() === 0 && n.getMinutes() === 0 && n.getSeconds() === 0 && n.getTime() - e.getTime() === 864e5;
|
|
22
|
+
return i || u ? `${r.formatDate(e, c)} (${t})` : `${r.formatDate(e, c)} to ${r.formatDate(n, c)} (${t})`;
|
|
23
|
+
}
|
|
24
|
+
return i ? `${r.formatDate(e, s)}–${r.formatDate(n, d)}` : `${r.formatDate(e, s)}-${r.formatDate(n, s)}`;
|
|
21
25
|
}
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
26
|
+
const T = (r, e, n, o = 0) => {
|
|
27
|
+
if (o === n)
|
|
24
28
|
return null;
|
|
25
29
|
let t = null;
|
|
26
30
|
const s = document.elementFromPoint(r, e);
|
|
@@ -29,12 +33,12 @@ const y = (r, e, o, n = 0) => {
|
|
|
29
33
|
if (s.getAttribute("data-slot") === "true")
|
|
30
34
|
return s;
|
|
31
35
|
const d = s.style.pointerEvents;
|
|
32
|
-
return s.style.pointerEvents = "none", t =
|
|
33
|
-
},
|
|
36
|
+
return s.style.pointerEvents = "none", t = T(r, e, n, o + 1), s.style.pointerEvents = d, t;
|
|
37
|
+
}, l = (r, e) => M(e)(r), z = (r, e, n) => {
|
|
34
38
|
if (e)
|
|
35
|
-
return
|
|
36
|
-
},
|
|
37
|
-
function
|
|
39
|
+
return y(e)(r, n);
|
|
40
|
+
}, G = (r) => r != null;
|
|
41
|
+
function P(r) {
|
|
38
42
|
return new Date(
|
|
39
43
|
Date.UTC(
|
|
40
44
|
r.getFullYear(),
|
|
@@ -47,13 +51,13 @@ function b(r) {
|
|
|
47
51
|
)
|
|
48
52
|
);
|
|
49
53
|
}
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
},
|
|
54
|
-
const
|
|
55
|
-
return !!(
|
|
56
|
-
}, f = (r, e) => Math.max(r.getTime(), e.getTime()), m = (r, e) => Math.min(r.getTime(), e.getTime()),
|
|
54
|
+
const b = (r, e, n) => {
|
|
55
|
+
const o = x(r, e) ? l(r, e.id) : l(r, e.recurrenceId);
|
|
56
|
+
return n.find((t) => l(t, e.id) === o);
|
|
57
|
+
}, x = (r, e) => {
|
|
58
|
+
const n = l(r, e.id), o = l(r, e.recurrenceId), t = l(r, e.recurrenceRule);
|
|
59
|
+
return !!(n && t && o == null);
|
|
60
|
+
}, f = (r, e) => Math.max(r.getTime(), e.getTime()), m = (r, e) => Math.min(r.getTime(), e.getTime()), p = (r, e, n, o, t = !1) => t ? f(e, o) - m(r, n) <= e.getTime() - r.getTime() + (o.getTime() - n.getTime()) : f(e, o) - m(r, n) < e.getTime() - r.getTime() + (o.getTime() - n.getTime()), A = {
|
|
57
61
|
id: "id",
|
|
58
62
|
start: "start",
|
|
59
63
|
startTimezone: "startTimezone",
|
|
@@ -66,17 +70,17 @@ const k = (r, e, o) => {
|
|
|
66
70
|
recurrenceRule: "recurrenceRule",
|
|
67
71
|
recurrenceId: "recurrenceId",
|
|
68
72
|
recurrenceExceptions: "recurrenceExceptions"
|
|
69
|
-
},
|
|
70
|
-
const
|
|
71
|
-
return
|
|
73
|
+
}, k = (r) => ({ fields: { ...A, ...r } }), w = (r, e, n) => (e.getHours() < r.getHours() || e.getHours() === r.getHours() && e.getMinutes() <= r.getMinutes()) && (r.getHours() < n.getHours() || n.getHours() === r.getHours() && r.getMinutes() < n.getMinutes()), B = (r, e, n) => e < n ? e <= r && r <= n : r <= n || e <= r, O = (r, e) => {
|
|
74
|
+
const n = h(r, e), o = D(n);
|
|
75
|
+
return o.length === 1 ? [
|
|
72
76
|
{
|
|
73
77
|
index: 0,
|
|
74
78
|
// resources: []
|
|
75
79
|
resources: (e || []).reduce(
|
|
76
80
|
(t, s) => [
|
|
77
81
|
...t,
|
|
78
|
-
...s.data.map((
|
|
79
|
-
...
|
|
82
|
+
...s.data.map((c) => ({
|
|
83
|
+
...c,
|
|
80
84
|
field: s.field,
|
|
81
85
|
valueField: s.valueField,
|
|
82
86
|
colorField: s.colorField,
|
|
@@ -86,93 +90,106 @@ const k = (r, e, o) => {
|
|
|
86
90
|
[]
|
|
87
91
|
)
|
|
88
92
|
}
|
|
89
|
-
] :
|
|
93
|
+
] : o.map((t, s) => ({
|
|
90
94
|
index: s,
|
|
91
95
|
resources: t
|
|
92
96
|
}));
|
|
93
|
-
},
|
|
97
|
+
}, F = (r) => r == null, Y = (r) => F(r) || r.trim && r.trim().length === 0, g = (r) => {
|
|
94
98
|
let e = 0;
|
|
95
|
-
const
|
|
96
|
-
return
|
|
97
|
-
|
|
99
|
+
const n = r.slice();
|
|
100
|
+
return n.sort((o, t) => o - t).forEach((o, t) => {
|
|
101
|
+
n[t] === t && (e = t + 1);
|
|
98
102
|
}), e;
|
|
99
|
-
},
|
|
103
|
+
}, C = (r, e, n, o = !1) => {
|
|
100
104
|
let t;
|
|
101
|
-
return
|
|
102
|
-
const
|
|
103
|
-
e.sort((i,
|
|
104
|
-
if ((
|
|
105
|
-
const
|
|
106
|
-
i === r && t === void 0 && (t =
|
|
105
|
+
return n.forEach((s) => {
|
|
106
|
+
const c = [];
|
|
107
|
+
e.sort((i, u) => i.props.start.getTime() - u.props.start.getTime()).forEach((i) => {
|
|
108
|
+
if ((o || i.props.isAllDay === s.current.props.isAllDay) && i.props.range.index === s.current.props.range.index && i.props.group.index === s.current.props.group.index && p(i.props.start, i.props.end, s.current.props.start, s.current.props.end)) {
|
|
109
|
+
const a = g(c);
|
|
110
|
+
i === r && t === void 0 && (t = a), c.splice(a, 0, a);
|
|
107
111
|
}
|
|
108
112
|
});
|
|
109
113
|
}), t;
|
|
110
|
-
},
|
|
111
|
-
const
|
|
114
|
+
}, U = (r, e) => {
|
|
115
|
+
const n = /* @__PURE__ */ new Set();
|
|
112
116
|
return e.forEach((t) => {
|
|
113
|
-
t._order !== void 0 && t._order !== null &&
|
|
114
|
-
}), g(Array.from(
|
|
115
|
-
}, j = (r, e,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
t._order !== void 0 && t._order !== null && n.add(t._order);
|
|
118
|
+
}), g(Array.from(n));
|
|
119
|
+
}, j = (r, e, n = !1) => {
|
|
120
|
+
r.forEach((t) => {
|
|
121
|
+
t.order = null;
|
|
122
|
+
}), e.forEach((t) => t.items.splice(0, t.items.length));
|
|
123
|
+
const o = [...r].sort((t, s) => t.start.getTime() - s.start.getTime());
|
|
124
|
+
e.forEach((t) => {
|
|
125
|
+
const s = [];
|
|
126
|
+
o.forEach((c) => {
|
|
127
|
+
if ((n || c.isAllDay === t.isAllDay) && c.range.index === t.range.index && // When slotDuration equals a full day, both daySlots and timeSlots have isAllDay=true,
|
|
128
|
+
// so we need to also check range.isAllDay to distinguish between them.
|
|
129
|
+
(c.range.isAllDay === void 0 || t.range.isAllDay === void 0 || c.range.isAllDay === t.range.isAllDay) && c.group.index === t.group.index && p(c.start, c.end, t.start, t.end)) {
|
|
130
|
+
if (c.order !== null && c.order !== void 0)
|
|
131
|
+
s.includes(c.order) || (s.push(c.order), s.sort((i, u) => i - u));
|
|
132
|
+
else {
|
|
133
|
+
const i = g(s);
|
|
134
|
+
c.order = i, s.push(i), s.sort((u, a) => u - a);
|
|
135
|
+
}
|
|
136
|
+
t.items.push(c);
|
|
122
137
|
}
|
|
123
138
|
});
|
|
124
139
|
});
|
|
125
|
-
}, q = (r, e,
|
|
126
|
-
r.forEach((
|
|
140
|
+
}, q = (r, e, n = !1) => {
|
|
141
|
+
r.forEach((o) => o.slots.splice(0, o.slots.length)), r.forEach((o) => {
|
|
127
142
|
e.forEach((t) => {
|
|
128
|
-
(
|
|
143
|
+
(n || o.isAllDay === t.isAllDay) && o.range.index === t.range.index && // When slotDuration equals a full day, both daySlots and timeSlots have isAllDay=true,
|
|
144
|
+
// so we need to also check range.isAllDay to distinguish between them.
|
|
145
|
+
(o.range.isAllDay === void 0 || t.range.isAllDay === void 0 || o.range.isAllDay === t.range.isAllDay) && o.group.index === t.group.index && p(o.start, o.end, t.start, t.end) && o.slots.push(t);
|
|
129
146
|
});
|
|
130
147
|
});
|
|
131
148
|
}, J = (...r) => {
|
|
132
149
|
}, K = (r) => {
|
|
133
|
-
const e = r.props.items.find((
|
|
150
|
+
const e = r.props.items.find((n) => n.order === 0) || r.props.items[0];
|
|
134
151
|
return e && e._ref.current;
|
|
135
|
-
}, L = (r, e,
|
|
152
|
+
}, L = (r, e, n = !1, o = !1) => {
|
|
136
153
|
const t = r.current;
|
|
137
154
|
if (!t || !e)
|
|
138
155
|
return null;
|
|
139
|
-
const s = e.filter((
|
|
156
|
+
const s = e.filter((u) => u.current !== null && u.current.element !== null), c = E(s, [
|
|
140
157
|
{ field: "current.props.group.index", dir: "asc" },
|
|
141
158
|
{ field: "current.props.range.index", dir: "asc" },
|
|
142
|
-
|
|
159
|
+
n ? { field: "" } : { field: "current.props.isAllDay", dir: "desc" },
|
|
143
160
|
{ field: "current.props.start", dir: "asc" }
|
|
144
|
-
]), d =
|
|
145
|
-
(
|
|
161
|
+
]), d = c.findIndex(
|
|
162
|
+
(u) => u.current !== null && !!(u.current.props.uid === t.props.uid && (u.current.props.occurrenceId === void 0 || u.current.props.occurrenceId === t.props.occurrenceId) && u.current.props.group.index === t.props.group.index && u.current.props.range.index === t.props.range.index && (n || u.current.props.isAllDay === t.props.isAllDay))
|
|
146
163
|
);
|
|
147
|
-
return
|
|
164
|
+
return c[d + (o ? -1 : 1)];
|
|
148
165
|
}, Q = (r, e) => (r.order || 0) - (e.order || 0);
|
|
149
166
|
export {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
167
|
+
C as calculateOrder,
|
|
168
|
+
U as calculateProportionalOrder,
|
|
169
|
+
A as defaultModelFields,
|
|
153
170
|
K as findFirstItem,
|
|
154
|
-
|
|
171
|
+
b as findMaster,
|
|
155
172
|
g as findMissing,
|
|
156
173
|
L as findNextItem,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
R as first,
|
|
175
|
+
_ as formatEventTime,
|
|
176
|
+
l as getField,
|
|
177
|
+
k as getModelFields,
|
|
178
|
+
p as intersects,
|
|
179
|
+
F as isBlank,
|
|
180
|
+
N as isGroupped,
|
|
181
|
+
B as isInDaysRange,
|
|
182
|
+
w as isInTimeRange,
|
|
183
|
+
x as isMaster,
|
|
184
|
+
Y as isNullOrEmptyString,
|
|
185
|
+
G as isPresent,
|
|
186
|
+
$ as last,
|
|
170
187
|
q as mapItemsToSlots,
|
|
171
188
|
j as mapSlotsToItems,
|
|
172
189
|
J as noop,
|
|
173
190
|
Q as orderSort,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
191
|
+
z as setField,
|
|
192
|
+
T as slotDive,
|
|
193
|
+
O as toSchedulerGroups,
|
|
194
|
+
P as toUTCDateTime
|
|
178
195
|
};
|