@progress/kendo-react-scheduler 17.1.0-develop.6 → 17.1.0-develop.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Scheduler.js +1 -1
- package/Scheduler.mjs +323 -307
- package/constants/index.js +1 -1
- package/constants/index.mjs +16 -15
- package/dist/cdn/js/kendo-react-scheduler.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +12 -12
- package/recurrence/common.d.ts +23 -0
- package/recurrence/common.js +1 -1
- package/recurrence/common.mjs +131 -73
- package/services/occurrenceService.js +1 -1
- package/services/occurrenceService.mjs +60 -47
package/package-metadata.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 e=Object.freeze({name:"@progress/kendo-react-scheduler",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-scheduler",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1795614704,version:"17.1.0-develop.7",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui"});exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export const packageMetadata = Object.freeze({
|
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCode: 'KENDOUIREACT',
|
|
8
8
|
productCodes: ['KENDOUIREACT'],
|
|
9
|
-
publishDate:
|
|
10
|
-
version: '17.1.0-develop.
|
|
9
|
+
publishDate: 1795614704,
|
|
10
|
+
version: '17.1.0-develop.7',
|
|
11
11
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui'
|
|
12
12
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-scheduler",
|
|
3
|
-
"version": "17.1.0-develop.
|
|
3
|
+
"version": "17.1.0-develop.7",
|
|
4
4
|
"description": "React Scheduler brings the functionality of Outlook's Calendar to a single UI component. KendoReact Scheduler package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"@progress/kendo-date-math": "^1.4.1",
|
|
30
30
|
"@progress/kendo-drawing": "^1.25.5",
|
|
31
31
|
"@progress/kendo-licensing": "^1.13.1",
|
|
32
|
-
"@progress/kendo-react-buttons": "17.1.0-develop.
|
|
33
|
-
"@progress/kendo-react-common": "17.1.0-develop.
|
|
34
|
-
"@progress/kendo-react-dateinputs": "17.1.0-develop.
|
|
35
|
-
"@progress/kendo-react-dialogs": "17.1.0-develop.
|
|
36
|
-
"@progress/kendo-react-dropdowns": "17.1.0-develop.
|
|
37
|
-
"@progress/kendo-react-form": "17.1.0-develop.
|
|
38
|
-
"@progress/kendo-react-inputs": "17.1.0-develop.
|
|
39
|
-
"@progress/kendo-react-intl": "17.1.0-develop.
|
|
40
|
-
"@progress/kendo-react-popup": "17.1.0-develop.
|
|
41
|
-
"@progress/kendo-react-tooltip": "17.1.0-develop.
|
|
32
|
+
"@progress/kendo-react-buttons": "17.1.0-develop.7",
|
|
33
|
+
"@progress/kendo-react-common": "17.1.0-develop.7",
|
|
34
|
+
"@progress/kendo-react-dateinputs": "17.1.0-develop.7",
|
|
35
|
+
"@progress/kendo-react-dialogs": "17.1.0-develop.7",
|
|
36
|
+
"@progress/kendo-react-dropdowns": "17.1.0-develop.7",
|
|
37
|
+
"@progress/kendo-react-form": "17.1.0-develop.7",
|
|
38
|
+
"@progress/kendo-react-inputs": "17.1.0-develop.7",
|
|
39
|
+
"@progress/kendo-react-intl": "17.1.0-develop.7",
|
|
40
|
+
"@progress/kendo-react-popup": "17.1.0-develop.7",
|
|
41
|
+
"@progress/kendo-react-tooltip": "17.1.0-develop.7",
|
|
42
42
|
"@progress/kendo-svg-icons": "^4.9.0 || ^5.0.0",
|
|
43
43
|
"react": "^18.0.0 || ^19.0.0",
|
|
44
44
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"package": {
|
|
137
137
|
"productName": "KendoReact",
|
|
138
138
|
"productCode": "KENDOUIREACT",
|
|
139
|
-
"publishDate":
|
|
139
|
+
"publishDate": 1795614704,
|
|
140
140
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui"
|
|
141
141
|
}
|
|
142
142
|
},
|
package/recurrence/common.d.ts
CHANGED
|
@@ -72,3 +72,26 @@ export declare const toUntilEndOfDay: (date: Date, timezone: string) => ZonedDat
|
|
|
72
72
|
export declare const getUntilEnd: (start: Date, until: Date | null) => Date;
|
|
73
73
|
/** @hidden */
|
|
74
74
|
export declare const getUntilMin: (start: Date, until: Date | null) => Date;
|
|
75
|
+
/**
|
|
76
|
+
* @hidden
|
|
77
|
+
*
|
|
78
|
+
* Checks if two recurrence rule strings describe the same recurrence, regardless of how they are serialized
|
|
79
|
+
* (e.g. an explicit default `WKST`).
|
|
80
|
+
*/
|
|
81
|
+
export declare const isSameRecurrence: (first: string, second: string, timezone?: string) => boolean;
|
|
82
|
+
/**
|
|
83
|
+
* @hidden
|
|
84
|
+
*
|
|
85
|
+
* Realigns the recurrence rule of a series with a new series start date, so the rule keeps describing
|
|
86
|
+
* the date the series was moved to (e.g. "third Saturday" becomes "third Friday" when the series is
|
|
87
|
+
* moved to a Friday). Returns the original rule when the calendar day has not changed.
|
|
88
|
+
*/
|
|
89
|
+
export declare const alignRecurrenceRuleToStart: (recurrenceRule: string, oldStart: Date, newStart: Date, timezone?: string) => string;
|
|
90
|
+
/**
|
|
91
|
+
* @hidden
|
|
92
|
+
*
|
|
93
|
+
* Maps the exception dates of a series to the occurrences of its realigned rule. A date is moved by the
|
|
94
|
+
* series `offset` when that lands on an occurrence of the new rule, otherwise it snaps to the occurrence of the
|
|
95
|
+
* new rule closest to the moved date. Dates with no occurrence nearby are only moved by the `offset`.
|
|
96
|
+
*/
|
|
97
|
+
export declare const remapRecurrenceExceptions: (exceptions: Date[], recurrenceRule: string, start: Date, end: Date, offset: number, timezone?: string) => Date[];
|
package/recurrence/common.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 u=require("../utils/index.js"),k=require("@progress/kendo-recurrence"),D=require("@progress/kendo-date-math"),R=e=>e.charAt(0).toUpperCase()+e.slice(1),P=["first","second","third","fourth","last"],E=["never","daily","weekly","monthly","yearly"],W=[{day:0,offset:0},{day:1,offset:0},{day:2,offset:0},{day:3,offset:0},{day:4,offset:0},{day:5,offset:0},{day:6,offset:0}],F=[{day:1,offset:0},{day:2,offset:0},{day:3,offset:0},{day:4,offset:0},{day:5,offset:0}],T=[{day:0,offset:0},{day:6,offset:0}],v=e=>{switch(e){case"day":return W;case"weekday":return F;case"weekend":return T}},q=e=>k.parseRule({recurrenceRule:e})||{},x=e=>E.map(t=>({value:t,text:e("Frequencies"+R(t))})),N=e=>u.isPresent(e)&&!u.isNullOrEmptyString(e.freq)?e.freq:"never",I=e=>u.isPresent(e.until)?D.toLocalDate(e.until):null,L=e=>e.dateFormatNames({type:"months",nameType:"wide",standAlone:!0}).map((t,a)=>({text:t,value:a+1})),U=e=>{const t=e.firstDay(),a=e.dateFormatNames({type:"days",nameType:"abbreviated"}).map((s,n)=>({text:s,value:n}));return a.slice(t).concat(a.slice(0,t))},_=(e,t,a)=>{var n;let s;if(u.isPresent(t.byWeekDay))switch(t.byWeekDay.length){case 7:s="day";break;case 5:s="weekday";break;case 2:s="weekend";break;case 1:s=t.byWeekDay[0].day;break;default:s=a.getDay();break}else s=a.getDay();return(n=e.find(y=>s===y.value))!=null?n:e[0]},C=(e,t)=>{const a=e.firstDay(),s=e.dateFormatNames({type:"days",nameType:"wide"}).map((o,r)=>({text:o,value:r})),n=s.slice(a).concat(s.slice(0,a));return[{text:t("WeekdaysDay"),value:"day"},{text:t("WeekdaysWeekday"),value:"weekday"},{text:t("WeekdaysWeekendday"),value:"weekend"}].concat(n)},A=(e,t)=>e.find(a=>a.value===(t.bySetPosition?t.bySetPosition[0]:t.byWeekDay&&t.byWeekDay[0]?t.byWeekDay[0].offset:1))||e[0],Y=e=>{const t=[1,2,3,4,-1];return P.map((a,s)=>({text:e("OffsetPositions"+R(a)),value:t[s]}))},Z=e=>u.isPresent(e.count)?"count":u.isPresent(e.until)?"until":"never",B=e=>{if(u.isPresent(e.byWeekDay))return"weekday";if(u.isPresent(e.byMonthDay))return"monthday"},Q=(e,t)=>e.find(a=>(t.byMonth?t.byMonth[0]:null)===a.value)||e[0],j=(e,t)=>u.isPresent(e.byMonthDay)&&e.byMonthDay.length>0?e.byMonthDay[0]:t.getDate(),K=(e,t)=>D.ZonedDate.fromUTCDate(new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59)),t),h=7,p=-1,X=[1,2,3,4,p],G=1440*60*1e3,H=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),M=(e,t,a)=>{if(t.indexOf(e.getDay())===-1)return null;const s=e.getDate(),n=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();let y=0,o=0;for(let i=1;i<=n;i++){const l=((e.getDay()-(s-i))%h+h)%h;t.indexOf(l)!==-1&&(o++,i<=s&&y++)}return y===o&&(a===p||t.length===1&&y>4)?p:y},O=(e,t)=>{const a=k.parseRule({recurrenceRule:e});return a?k.serializeRule(a,t):e},J=(e,t,a)=>e===t||O(e,a)===O(t,a),V=(e,t,a,s)=>{const n=k.parseRule({recurrenceRule:e}),y=D.ZonedDate.fromLocalDate(t,s),o=D.ZonedDate.fromLocalDate(a,s);if(!n||!n.freq||H(y,o))return e;const r=n.byWeekDay;let i=!1;if(n.freq==="weekly"&&r&&r.length){const l=(o.getDay()-y.getDay()+h)%h;l!==0&&(n.byWeekDay=r.map(d=>({...d,day:(d.day+l)%h})),(n.interval||1)>1&&(n.weekStart=((n.weekStart||0)+l)%h),i=!0)}if((n.freq==="monthly"||n.freq==="yearly")&&r&&r.length){const l=!!(n.bySetPosition&&n.bySetPosition.length),d=r.length===1&&!!r[0].offset;if(l||d){const c=l?n.bySetPosition[0]:r[0].offset;let f=r.map(b=>b.day),g=r.length===1?null:M(o,f,c);(g===null||X.indexOf(g)===-1)&&(f=[o.getDay()],g=M(o,f,c),n.byWeekDay=[{...r[0],day:f[0]}]),l?n.bySetPosition=[g]:n.byWeekDay=[{day:f[0],offset:g}],i=!0}else r.length===1&&(n.byWeekDay=[{...r[0],day:o.getDay()}],i=!0)}return(n.freq==="monthly"||n.freq==="yearly")&&n.byMonthDay&&n.byMonthDay.length&&(n.byMonthDay=[o.getDate()],i=!0),n.freq==="yearly"&&n.byMonth&&n.byMonth.length&&(n.byMonth=[o.getMonth()+1],i=!0),i?k.serializeRule(n,s):e},$={daily:1,weekly:4,monthly:15,yearly:183},z=(e,t,a,s,n,y)=>{const o=k.parseRule({recurrenceRule:t}),r=o&&o.freq?$[o.freq]:void 0;if(!o||!r)return e.map(d=>new Date(new Date(d).getTime()+n));const i=r*(o.interval||1)*G,l=s.getTime()-a.getTime();return e.map(d=>{const c=new Date(d).getTime()+n,f={...o};f.start=D.ZonedDate.fromLocalDate(a,y),f.end=D.ZonedDate.fromLocalDate(s,y),f.exceptionDates=[];const{events:g}=k.expand(f,{rangeStart:D.ZonedDate.fromLocalDate(new Date(c-i-l),y),rangeEnd:D.ZonedDate.fromLocalDate(new Date(c+i),y)}),b=g.map(m=>m.start.toLocalDate().getTime());if(b.indexOf(c)!==-1)return new Date(c);const w=b.reduce((m,S)=>Math.abs(S-c)<=i&&(m===null||Math.abs(S-c)<Math.abs(m-c))?S:m,null);return new Date(w===null?c:w)})};exports.FREQUENCIES=E;exports.OFFSET_POSITIONS=P;exports.alignRecurrenceRuleToStart=V;exports.capitalize=R;exports.dayRule=W;exports.getEndRule=Z;exports.getExtendedWeekDays=C;exports.getFrequencies=x;exports.getFrequency=N;exports.getMonth=Q;exports.getMonthDay=j;exports.getMonths=L;exports.getOffset=A;exports.getOffsets=Y;exports.getRepeatOnRule=B;exports.getRule=q;exports.getUntil=I;exports.getWeekDay=_;exports.getWeekDays=U;exports.isSameRecurrence=J;exports.remapRecurrenceExceptions=z;exports.toUntilEndOfDay=K;exports.weekDayRuleFromString=v;exports.weekdayRule=F;exports.weekendRule=T;
|
package/recurrence/common.mjs
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { isPresent as
|
|
9
|
-
import { parseRule as
|
|
10
|
-
import { ZonedDate as
|
|
11
|
-
const
|
|
8
|
+
import { isPresent as d, isNullOrEmptyString as R } from "../utils/index.mjs";
|
|
9
|
+
import { parseRule as b, serializeRule as v, expand as T } from "@progress/kendo-recurrence";
|
|
10
|
+
import { ZonedDate as g, toLocalDate as E } from "@progress/kendo-date-math";
|
|
11
|
+
const O = (e) => e.charAt(0).toUpperCase() + e.slice(1), P = ["first", "second", "third", "fourth", "last"], x = ["never", "daily", "weekly", "monthly", "yearly"], F = [
|
|
12
12
|
{ day: 0, offset: 0 },
|
|
13
13
|
{ day: 1, offset: 0 },
|
|
14
14
|
{ day: 2, offset: 0 },
|
|
@@ -16,126 +16,184 @@ const r = (e) => e.charAt(0).toUpperCase() + e.slice(1), k = ["first", "second",
|
|
|
16
16
|
{ day: 4, offset: 0 },
|
|
17
17
|
{ day: 5, offset: 0 },
|
|
18
18
|
{ day: 6, offset: 0 }
|
|
19
|
-
],
|
|
19
|
+
], q = [
|
|
20
20
|
{ day: 1, offset: 0 },
|
|
21
21
|
{ day: 2, offset: 0 },
|
|
22
22
|
{ day: 3, offset: 0 },
|
|
23
23
|
{ day: 4, offset: 0 },
|
|
24
24
|
{ day: 5, offset: 0 }
|
|
25
|
-
],
|
|
25
|
+
], N = [
|
|
26
26
|
{ day: 0, offset: 0 },
|
|
27
27
|
{ day: 6, offset: 0 }
|
|
28
|
-
],
|
|
28
|
+
], B = (e) => {
|
|
29
29
|
switch (e) {
|
|
30
30
|
case "day":
|
|
31
|
-
return
|
|
31
|
+
return F;
|
|
32
32
|
case "weekday":
|
|
33
|
-
return
|
|
33
|
+
return q;
|
|
34
34
|
case "weekend":
|
|
35
|
-
return
|
|
35
|
+
return N;
|
|
36
36
|
}
|
|
37
|
-
},
|
|
37
|
+
}, K = (e) => b({ recurrenceRule: e }) || {}, Q = (e) => x.map((t) => ({
|
|
38
38
|
value: t,
|
|
39
|
-
text: e("Frequencies" +
|
|
40
|
-
})),
|
|
39
|
+
text: e("Frequencies" + O(t))
|
|
40
|
+
})), X = (e) => d(e) && !R(e.freq) ? e.freq : "never", Z = (e) => d(e.until) ? E(e.until) : null, j = (e) => e.dateFormatNames({
|
|
41
41
|
type: "months",
|
|
42
42
|
nameType: "wide",
|
|
43
43
|
standAlone: !0
|
|
44
44
|
}).map(
|
|
45
|
-
(t,
|
|
45
|
+
(t, n) => ({
|
|
46
46
|
text: t,
|
|
47
|
-
value:
|
|
47
|
+
value: n + 1
|
|
48
48
|
})
|
|
49
|
-
),
|
|
50
|
-
const t = e.firstDay(),
|
|
49
|
+
), G = (e) => {
|
|
50
|
+
const t = e.firstDay(), n = e.dateFormatNames({
|
|
51
51
|
type: "days",
|
|
52
52
|
nameType: "abbreviated"
|
|
53
53
|
}).map(
|
|
54
|
-
(
|
|
55
|
-
text:
|
|
56
|
-
value:
|
|
54
|
+
(o, a) => ({
|
|
55
|
+
text: o,
|
|
56
|
+
value: a
|
|
57
57
|
})
|
|
58
58
|
);
|
|
59
|
-
return
|
|
60
|
-
},
|
|
61
|
-
var
|
|
62
|
-
let
|
|
63
|
-
if (
|
|
59
|
+
return n.slice(t).concat(n.slice(0, t));
|
|
60
|
+
}, H = (e, t, n) => {
|
|
61
|
+
var a;
|
|
62
|
+
let o;
|
|
63
|
+
if (d(t.byWeekDay))
|
|
64
64
|
switch (t.byWeekDay.length) {
|
|
65
65
|
case 7:
|
|
66
|
-
|
|
66
|
+
o = "day";
|
|
67
67
|
break;
|
|
68
68
|
case 5:
|
|
69
|
-
|
|
69
|
+
o = "weekday";
|
|
70
70
|
break;
|
|
71
71
|
case 2:
|
|
72
|
-
|
|
72
|
+
o = "weekend";
|
|
73
73
|
break;
|
|
74
74
|
case 1:
|
|
75
|
-
|
|
75
|
+
o = t.byWeekDay[0].day;
|
|
76
76
|
break;
|
|
77
77
|
default:
|
|
78
|
-
|
|
78
|
+
o = n.getDay();
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
81
|
else
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
},
|
|
85
|
-
const
|
|
82
|
+
o = n.getDay();
|
|
83
|
+
return (a = e.find((r) => o === r.value)) != null ? a : e[0];
|
|
84
|
+
}, J = (e, t) => {
|
|
85
|
+
const n = e.firstDay(), o = e.dateFormatNames({
|
|
86
86
|
type: "days",
|
|
87
87
|
nameType: "wide"
|
|
88
88
|
}).map(
|
|
89
|
-
(
|
|
90
|
-
text:
|
|
91
|
-
value:
|
|
89
|
+
(s, y) => ({
|
|
90
|
+
text: s,
|
|
91
|
+
value: y
|
|
92
92
|
})
|
|
93
|
-
),
|
|
93
|
+
), a = o.slice(n).concat(o.slice(0, n));
|
|
94
94
|
return [
|
|
95
95
|
{ text: t("WeekdaysDay"), value: "day" },
|
|
96
96
|
{ text: t("WeekdaysWeekday"), value: "weekday" },
|
|
97
97
|
{ text: t("WeekdaysWeekendday"), value: "weekend" }
|
|
98
|
-
].concat(
|
|
99
|
-
},
|
|
100
|
-
(
|
|
101
|
-
) || e[0],
|
|
98
|
+
].concat(a);
|
|
99
|
+
}, V = (e, t) => e.find(
|
|
100
|
+
(n) => n.value === (t.bySetPosition ? t.bySetPosition[0] : t.byWeekDay && t.byWeekDay[0] ? t.byWeekDay[0].offset : 1)
|
|
101
|
+
) || e[0], $ = (e) => {
|
|
102
102
|
const t = [1, 2, 3, 4, -1];
|
|
103
|
-
return
|
|
104
|
-
(
|
|
105
|
-
text: e("OffsetPositions" +
|
|
106
|
-
value: t[
|
|
103
|
+
return P.map(
|
|
104
|
+
(n, o) => ({
|
|
105
|
+
text: e("OffsetPositions" + O(n)),
|
|
106
|
+
value: t[o]
|
|
107
107
|
})
|
|
108
108
|
);
|
|
109
|
-
},
|
|
110
|
-
if (
|
|
109
|
+
}, z = (e) => d(e.count) ? "count" : d(e.until) ? "until" : "never", ee = (e) => {
|
|
110
|
+
if (d(e.byWeekDay))
|
|
111
111
|
return "weekday";
|
|
112
|
-
if (
|
|
112
|
+
if (d(e.byMonthDay))
|
|
113
113
|
return "monthday";
|
|
114
|
-
},
|
|
114
|
+
}, te = (e, t) => e.find((n) => (t.byMonth ? t.byMonth[0] : null) === n.value) || e[0], ae = (e, t) => d(e.byMonthDay) && e.byMonthDay.length > 0 ? e.byMonthDay[0] : t.getDate(), ne = (e, t) => g.fromUTCDate(
|
|
115
115
|
new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), 23, 59, 59)),
|
|
116
116
|
t
|
|
117
|
-
)
|
|
117
|
+
), h = 7, w = -1, L = [1, 2, 3, 4, w], I = 1440 * 60 * 1e3, _ = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), M = (e, t, n) => {
|
|
118
|
+
if (t.indexOf(e.getDay()) === -1)
|
|
119
|
+
return null;
|
|
120
|
+
const o = e.getDate(), a = new Date(e.getFullYear(), e.getMonth() + 1, 0).getDate();
|
|
121
|
+
let r = 0, s = 0;
|
|
122
|
+
for (let f = 1; f <= a; f++) {
|
|
123
|
+
const i = ((e.getDay() - (o - f)) % h + h) % h;
|
|
124
|
+
t.indexOf(i) !== -1 && (s++, f <= o && r++);
|
|
125
|
+
}
|
|
126
|
+
return r === s && (n === w || t.length === 1 && r > 4) ? w : r;
|
|
127
|
+
}, W = (e, t) => {
|
|
128
|
+
const n = b({ recurrenceRule: e });
|
|
129
|
+
return n ? v(n, t) : e;
|
|
130
|
+
}, oe = (e, t, n) => e === t || W(e, n) === W(t, n), se = (e, t, n, o) => {
|
|
131
|
+
const a = b({ recurrenceRule: e }), r = g.fromLocalDate(t, o), s = g.fromLocalDate(n, o);
|
|
132
|
+
if (!a || !a.freq || _(r, s))
|
|
133
|
+
return e;
|
|
134
|
+
const y = a.byWeekDay;
|
|
135
|
+
let f = !1;
|
|
136
|
+
if (a.freq === "weekly" && y && y.length) {
|
|
137
|
+
const i = (s.getDay() - r.getDay() + h) % h;
|
|
138
|
+
i !== 0 && (a.byWeekDay = y.map((u) => ({
|
|
139
|
+
...u,
|
|
140
|
+
day: (u.day + i) % h
|
|
141
|
+
})), (a.interval || 1) > 1 && (a.weekStart = ((a.weekStart || 0) + i) % h), f = !0);
|
|
142
|
+
}
|
|
143
|
+
if ((a.freq === "monthly" || a.freq === "yearly") && y && y.length) {
|
|
144
|
+
const i = !!(a.bySetPosition && a.bySetPosition.length), u = y.length === 1 && !!y[0].offset;
|
|
145
|
+
if (i || u) {
|
|
146
|
+
const l = i ? a.bySetPosition[0] : y[0].offset;
|
|
147
|
+
let c = y.map((k) => k.day), D = y.length === 1 ? null : M(s, c, l);
|
|
148
|
+
(D === null || L.indexOf(D) === -1) && (c = [s.getDay()], D = M(s, c, l), a.byWeekDay = [{ ...y[0], day: c[0] }]), i ? a.bySetPosition = [D] : a.byWeekDay = [{ day: c[0], offset: D }], f = !0;
|
|
149
|
+
} else y.length === 1 && (a.byWeekDay = [{ ...y[0], day: s.getDay() }], f = !0);
|
|
150
|
+
}
|
|
151
|
+
return (a.freq === "monthly" || a.freq === "yearly") && a.byMonthDay && a.byMonthDay.length && (a.byMonthDay = [s.getDate()], f = !0), a.freq === "yearly" && a.byMonth && a.byMonth.length && (a.byMonth = [s.getMonth() + 1], f = !0), f ? v(a, o) : e;
|
|
152
|
+
}, U = { daily: 1, weekly: 4, monthly: 15, yearly: 183 }, ye = (e, t, n, o, a, r) => {
|
|
153
|
+
const s = b({ recurrenceRule: t }), y = s && s.freq ? U[s.freq] : void 0;
|
|
154
|
+
if (!s || !y)
|
|
155
|
+
return e.map((u) => new Date(new Date(u).getTime() + a));
|
|
156
|
+
const f = y * (s.interval || 1) * I, i = o.getTime() - n.getTime();
|
|
157
|
+
return e.map((u) => {
|
|
158
|
+
const l = new Date(u).getTime() + a, c = { ...s };
|
|
159
|
+
c.start = g.fromLocalDate(n, r), c.end = g.fromLocalDate(o, r), c.exceptionDates = [];
|
|
160
|
+
const { events: D } = T(c, {
|
|
161
|
+
rangeStart: g.fromLocalDate(new Date(l - f - i), r),
|
|
162
|
+
rangeEnd: g.fromLocalDate(new Date(l + f), r)
|
|
163
|
+
}), k = D.map((m) => m.start.toLocalDate().getTime());
|
|
164
|
+
if (k.indexOf(l) !== -1)
|
|
165
|
+
return new Date(l);
|
|
166
|
+
const S = k.reduce(
|
|
167
|
+
(m, p) => Math.abs(p - l) <= f && (m === null || Math.abs(p - l) < Math.abs(m - l)) ? p : m,
|
|
168
|
+
null
|
|
169
|
+
);
|
|
170
|
+
return new Date(S === null ? l : S);
|
|
171
|
+
});
|
|
172
|
+
};
|
|
118
173
|
export {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
174
|
+
x as FREQUENCIES,
|
|
175
|
+
P as OFFSET_POSITIONS,
|
|
176
|
+
se as alignRecurrenceRuleToStart,
|
|
177
|
+
O as capitalize,
|
|
178
|
+
F as dayRule,
|
|
179
|
+
z as getEndRule,
|
|
180
|
+
J as getExtendedWeekDays,
|
|
181
|
+
Q as getFrequencies,
|
|
182
|
+
X as getFrequency,
|
|
183
|
+
te as getMonth,
|
|
184
|
+
ae as getMonthDay,
|
|
185
|
+
j as getMonths,
|
|
186
|
+
V as getOffset,
|
|
187
|
+
$ as getOffsets,
|
|
188
|
+
ee as getRepeatOnRule,
|
|
189
|
+
K as getRule,
|
|
190
|
+
Z as getUntil,
|
|
191
|
+
H as getWeekDay,
|
|
192
|
+
G as getWeekDays,
|
|
193
|
+
oe as isSameRecurrence,
|
|
194
|
+
ye as remapRecurrenceExceptions,
|
|
195
|
+
ne as toUntilEndOfDay,
|
|
196
|
+
B as weekDayRuleFromString,
|
|
197
|
+
q as weekdayRule,
|
|
198
|
+
N as weekendRule
|
|
141
199
|
};
|
|
@@ -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 c=require("@progress/kendo-react-common"),v=require("@progress/kendo-recurrence"),D=require("@progress/kendo-date-math"),g=require("../utils/index.js"),x=require("../constants/index.js"),E=2e3,M=(e,{dateRange:r,fields:n,timezone:o})=>{const a=c.getter(n.recurrenceId||"recurrenceId"),t=c.getter(n.recurrenceRule||"recurrenceRule"),s=new Set(e.filter(d=>{const S=a(d);return S!=null&&!!t(d)}).map(a));return e.map(I(n)).reduce(L(r,o,n,s),[]).filter(d=>!g.isMaster(d.dataItem,n))},I=e=>r=>{const n=c.getter(e.start||"start")(r),o=c.getter(e.originalStart||"originalStart")(r),a=c.getter(e.recurrenceId||"recurrenceId")(r),t=c.getter(e.recurrenceRule||"recurrenceRule")(r),s=a!=null&&!!t&&o==null,u=c.clone(r);return s&&g.setField(u,e.originalStart||"originalStart",n),{uid:c.getter(e.id||"id")(r),start:n,startTimezone:c.getter(e.startTimezone||"startTimezone")(r),originalStart:s?n:o,end:c.getter(e.end||"end")(r),endTimezone:c.getter(e.endTimezone||"endTimezone")(r),isAllDay:c.getter(e.isAllDay||"isAllDay")(r),title:c.getter(e.title||"title")(r),description:c.getter(e.description||"description")(r),occurrenceId:c.getter("occurrenceId")(r),recurrenceRule:t,recurrenceExceptions:c.getter(e.recurrenceExceptions||"recurrenceExceptions")(r),recurrenceId:a,readonly:c.getter(e.readonly||"readonly")(r),dataItem:u}},L=(e,r,n,o)=>(a,t)=>[...a,...t.recurrenceRule&&(t.recurrenceId===null||t.recurrenceId===void 0)&&g.isMaster(t.dataItem,n)&&!o.has(t.uid)?[...q(t,{dateRange:e,timezone:r,fields:n})]:[t]],q=(e,{dateRange:r,timezone:n,fields:o})=>{const a=e.recurrenceRule,t=v.parseRule({recurrenceRule:a});if(!t)return[];t.start||(t.start=D.ZonedDate.fromLocalDate(e.start,n)),t.end||(t.end=D.ZonedDate.fromLocalDate(e.end,n));const s=e.recurrenceExceptions;s&&(t.exceptionDates=s.map(i=>D.ZonedDate.fromLocalDate(i,n)));const u=t.end.getTime()-t.start.getTime(),d=D.ZonedDate.fromLocalDate(new Date(r.zonedStart.toLocalDate().getTime()-u),n);O(t,d);const S=d.getTime()+(E-1)*b(t),h=r.zonedEnd.getTime()>S?D.ZonedDate.fromUTCDate(new Date(S),n):r.zonedEnd,p=v.expand(t,{rangeStart:d,rangeEnd:h});if(!p.events.length)return[];const y=t.until,T=y&&t.bySetPosition?p.events.filter(i=>i.start.getTime()<=y.getTime()):p.events;return T.length?T.slice(0,E).map((i,m)=>{const l=c.clone(e),R=c.clone(e.dataItem);return l.recurrenceId=l.uid,g.setField(R,o.recurrenceId,e.uid),l.originalStart=i.start.toLocalDate(),g.setField(R,o.originalStart,i.start.toLocalDate()),l.start=i.start.toLocalDate(),g.setField(R,o.start,i.start.toLocalDate()),l.end=i.end.toLocalDate(),g.setField(R,o.end,i.end.toLocalDate()),l.occurrenceId=String(m),g.setField(R,"occurrenceId",String(m)),l.dataItem=R,l}):[]},b=e=>{var a,t,s,u;const r=e.freq==="hourly"?Math.min(((a=e.byHour)==null?void 0:a.length)||24,24/(e.interval||1)):((t=e.byHour)==null?void 0:t.length)||1,n=((s=e.byMinute)==null?void 0:s.length)||1,o=((u=e.bySecond)==null?void 0:u.length)||1;return D.MS_PER_DAY/(r*n*o)},O=(e,r)=>{const n=e.interval||1,o=(e.freq==="daily"?1:e.freq==="weekly"?7:0)*n,a=e.freq==="hourly"?x.MS_PER_HOUR*n:o*D.MS_PER_DAY;if(e.count||!a||!e.start||!e.end)return;const t=Math.floor((r.getTime()-e.start.getTime())/a)-1;t<=0||(e.freq==="hourly"?(e.start=e.start.addTime(t*a),e.end=e.end.addTime(t*a)):(e.start=e.start.addDays(t*o),e.end=e.end.addDays(t*o)))};exports.toOccurrences=M;
|
|
@@ -5,62 +5,75 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { getter as
|
|
9
|
-
import { parseRule as
|
|
10
|
-
import { ZonedDate as
|
|
11
|
-
import { isMaster as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
import { getter as a, clone as S } from "@progress/kendo-react-common";
|
|
9
|
+
import { parseRule as L, expand as f } from "@progress/kendo-recurrence";
|
|
10
|
+
import { ZonedDate as m, MS_PER_DAY as h } from "@progress/kendo-date-math";
|
|
11
|
+
import { isMaster as x, setField as p } from "../utils/index.mjs";
|
|
12
|
+
import { MS_PER_HOUR as M } from "../constants/index.mjs";
|
|
13
|
+
const E = 2e3, B = (e, { dateRange: r, fields: n, timezone: o }) => {
|
|
14
|
+
const c = a(n.recurrenceId || "recurrenceId"), t = a(n.recurrenceRule || "recurrenceRule"), s = new Set(
|
|
15
|
+
e.filter((u) => {
|
|
16
|
+
const D = c(u);
|
|
17
|
+
return D != null && !!t(u);
|
|
18
|
+
}).map(c)
|
|
18
19
|
);
|
|
19
|
-
return e.map(
|
|
20
|
-
},
|
|
21
|
-
const n =
|
|
22
|
-
return
|
|
23
|
-
uid:
|
|
20
|
+
return e.map(b(n)).reduce(q(r, o, n, s), []).filter((u) => !x(u.dataItem, n));
|
|
21
|
+
}, b = (e) => (r) => {
|
|
22
|
+
const n = a(e.start || "start")(r), o = a(e.originalStart || "originalStart")(r), c = a(e.recurrenceId || "recurrenceId")(r), t = a(e.recurrenceRule || "recurrenceRule")(r), s = c != null && !!t && o == null, d = S(r);
|
|
23
|
+
return s && p(d, e.originalStart || "originalStart", n), {
|
|
24
|
+
uid: a(e.id || "id")(r),
|
|
24
25
|
start: n,
|
|
25
|
-
startTimezone:
|
|
26
|
-
originalStart:
|
|
27
|
-
end:
|
|
28
|
-
endTimezone:
|
|
29
|
-
isAllDay:
|
|
30
|
-
title:
|
|
31
|
-
description:
|
|
32
|
-
occurrenceId:
|
|
33
|
-
recurrenceRule:
|
|
34
|
-
recurrenceExceptions:
|
|
35
|
-
recurrenceId:
|
|
36
|
-
readonly:
|
|
37
|
-
dataItem:
|
|
26
|
+
startTimezone: a(e.startTimezone || "startTimezone")(r),
|
|
27
|
+
originalStart: s ? n : o,
|
|
28
|
+
end: a(e.end || "end")(r),
|
|
29
|
+
endTimezone: a(e.endTimezone || "endTimezone")(r),
|
|
30
|
+
isAllDay: a(e.isAllDay || "isAllDay")(r),
|
|
31
|
+
title: a(e.title || "title")(r),
|
|
32
|
+
description: a(e.description || "description")(r),
|
|
33
|
+
occurrenceId: a("occurrenceId")(r),
|
|
34
|
+
recurrenceRule: t,
|
|
35
|
+
recurrenceExceptions: a(e.recurrenceExceptions || "recurrenceExceptions")(r),
|
|
36
|
+
recurrenceId: c,
|
|
37
|
+
readonly: a(e.readonly || "readonly")(r),
|
|
38
|
+
dataItem: d
|
|
38
39
|
};
|
|
39
|
-
},
|
|
40
|
-
...
|
|
41
|
-
...
|
|
42
|
-
],
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
40
|
+
}, q = (e, r, n, o) => (c, t) => [
|
|
41
|
+
...c,
|
|
42
|
+
...t.recurrenceRule && (t.recurrenceId === null || t.recurrenceId === void 0) && x(t.dataItem, n) && !o.has(t.uid) ? [...z(t, { dateRange: e, timezone: r, fields: n })] : [t]
|
|
43
|
+
], z = (e, { dateRange: r, timezone: n, fields: o }) => {
|
|
44
|
+
const c = e.recurrenceRule, t = L({ recurrenceRule: c });
|
|
45
|
+
if (!t)
|
|
45
46
|
return [];
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
new Date(
|
|
47
|
+
t.start || (t.start = m.fromLocalDate(e.start, n)), t.end || (t.end = m.fromLocalDate(e.end, n));
|
|
48
|
+
const s = e.recurrenceExceptions;
|
|
49
|
+
s && (t.exceptionDates = s.map((i) => m.fromLocalDate(i, n)));
|
|
50
|
+
const d = t.end.getTime() - t.start.getTime(), u = m.fromLocalDate(
|
|
51
|
+
new Date(r.zonedStart.toLocalDate().getTime() - d),
|
|
51
52
|
n
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
);
|
|
54
|
+
C(t, u);
|
|
55
|
+
const D = u.getTime() + (E - 1) * A(t), I = r.zonedEnd.getTime() > D ? m.fromUTCDate(new Date(D), n) : r.zonedEnd, R = f(t, {
|
|
56
|
+
rangeStart: u,
|
|
57
|
+
rangeEnd: I
|
|
55
58
|
});
|
|
56
59
|
if (!R.events.length)
|
|
57
60
|
return [];
|
|
58
|
-
const
|
|
59
|
-
return
|
|
60
|
-
const
|
|
61
|
-
return
|
|
61
|
+
const y = t.until, T = y && t.bySetPosition ? R.events.filter((i) => i.start.getTime() <= y.getTime()) : R.events;
|
|
62
|
+
return T.length ? T.slice(0, E).map((i, v) => {
|
|
63
|
+
const l = S(e), g = S(e.dataItem);
|
|
64
|
+
return l.recurrenceId = l.uid, p(g, o.recurrenceId, e.uid), l.originalStart = i.start.toLocalDate(), p(g, o.originalStart, i.start.toLocalDate()), l.start = i.start.toLocalDate(), p(g, o.start, i.start.toLocalDate()), l.end = i.end.toLocalDate(), p(g, o.end, i.end.toLocalDate()), l.occurrenceId = String(v), p(g, "occurrenceId", String(v)), l.dataItem = g, l;
|
|
62
65
|
}) : [];
|
|
66
|
+
}, A = (e) => {
|
|
67
|
+
var c, t, s, d;
|
|
68
|
+
const r = e.freq === "hourly" ? Math.min(((c = e.byHour) == null ? void 0 : c.length) || 24, 24 / (e.interval || 1)) : ((t = e.byHour) == null ? void 0 : t.length) || 1, n = ((s = e.byMinute) == null ? void 0 : s.length) || 1, o = ((d = e.bySecond) == null ? void 0 : d.length) || 1;
|
|
69
|
+
return h / (r * n * o);
|
|
70
|
+
}, C = (e, r) => {
|
|
71
|
+
const n = e.interval || 1, o = (e.freq === "daily" ? 1 : e.freq === "weekly" ? 7 : 0) * n, c = e.freq === "hourly" ? M * n : o * h;
|
|
72
|
+
if (e.count || !c || !e.start || !e.end)
|
|
73
|
+
return;
|
|
74
|
+
const t = Math.floor((r.getTime() - e.start.getTime()) / c) - 1;
|
|
75
|
+
t <= 0 || (e.freq === "hourly" ? (e.start = e.start.addTime(t * c), e.end = e.end.addTime(t * c)) : (e.start = e.start.addDays(t * o), e.end = e.end.addDays(t * o)));
|
|
63
76
|
};
|
|
64
77
|
export {
|
|
65
|
-
|
|
78
|
+
B as toOccurrences
|
|
66
79
|
};
|