@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.
@@ -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: 1795102655,version:"17.1.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui"});exports.packageMetadata=e;
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;
@@ -6,7 +6,7 @@ export const packageMetadata = Object.freeze({
6
6
  productName: 'KendoReact',
7
7
  productCode: 'KENDOUIREACT',
8
8
  productCodes: ['KENDOUIREACT'],
9
- publishDate: 1795102655,
10
- version: '17.1.0-develop.6',
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.6",
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.6",
33
- "@progress/kendo-react-common": "17.1.0-develop.6",
34
- "@progress/kendo-react-dateinputs": "17.1.0-develop.6",
35
- "@progress/kendo-react-dialogs": "17.1.0-develop.6",
36
- "@progress/kendo-react-dropdowns": "17.1.0-develop.6",
37
- "@progress/kendo-react-form": "17.1.0-develop.6",
38
- "@progress/kendo-react-inputs": "17.1.0-develop.6",
39
- "@progress/kendo-react-intl": "17.1.0-develop.6",
40
- "@progress/kendo-react-popup": "17.1.0-develop.6",
41
- "@progress/kendo-react-tooltip": "17.1.0-develop.6",
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": 1795102655,
139
+ "publishDate": 1795614704,
140
140
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui"
141
141
  }
142
142
  },
@@ -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[];
@@ -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 s=require("../utils/index.js"),D=require("@progress/kendo-recurrence"),c=require("@progress/kendo-date-math"),r=e=>e.charAt(0).toUpperCase()+e.slice(1),d=["first","second","third","fourth","last"],i=["never","daily","weekly","monthly","yearly"],u=[{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}],l=[{day:0,offset:0},{day:6,offset:0}],b=e=>{switch(e){case"day":return u;case"weekday":return f;case"weekend":return l}},m=e=>D.parseRule({recurrenceRule:e})||{},h=e=>i.map(t=>({value:t,text:e("Frequencies"+r(t))})),p=e=>s.isPresent(e)&&!s.isNullOrEmptyString(e.freq)?e.freq:"never",R=e=>s.isPresent(e.until)?c.toLocalDate(e.until):null,w=e=>e.dateFormatNames({type:"months",nameType:"wide",standAlone:!0}).map((t,n)=>({text:t,value:n+1})),W=e=>{const t=e.firstDay(),n=e.dateFormatNames({type:"days",nameType:"abbreviated"}).map((a,y)=>({text:a,value:y}));return n.slice(t).concat(n.slice(0,t))},v=(e,t,n)=>{var y;let a;if(s.isPresent(t.byWeekDay))switch(t.byWeekDay.length){case 7:a="day";break;case 5:a="weekday";break;case 2:a="weekend";break;case 1:a=t.byWeekDay[0].day;break;default:a=n.getDay();break}else a=n.getDay();return(y=e.find(o=>a===o.value))!=null?y:e[0]},F=(e,t)=>{const n=e.firstDay(),a=e.dateFormatNames({type:"days",nameType:"wide"}).map((k,g)=>({text:k,value:g})),y=a.slice(n).concat(a.slice(0,n));return[{text:t("WeekdaysDay"),value:"day"},{text:t("WeekdaysWeekday"),value:"weekday"},{text:t("WeekdaysWeekendday"),value:"weekend"}].concat(y)},O=(e,t)=>e.find(n=>n.value===(t.bySetPosition?t.bySetPosition[0]:t.byWeekDay&&t.byWeekDay[0]?t.byWeekDay[0].offset:1))||e[0],E=e=>{const t=[1,2,3,4,-1];return d.map((n,a)=>({text:e("OffsetPositions"+r(n)),value:t[a]}))},S=e=>s.isPresent(e.count)?"count":s.isPresent(e.until)?"until":"never",P=e=>{if(s.isPresent(e.byWeekDay))return"weekday";if(s.isPresent(e.byMonthDay))return"monthday"},M=(e,t)=>e.find(n=>(t.byMonth?t.byMonth[0]:null)===n.value)||e[0],x=(e,t)=>s.isPresent(e.byMonthDay)&&e.byMonthDay.length>0?e.byMonthDay[0]:t.getDate(),N=(e,t)=>c.ZonedDate.fromUTCDate(new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59)),t);exports.FREQUENCIES=i;exports.OFFSET_POSITIONS=d;exports.capitalize=r;exports.dayRule=u;exports.getEndRule=S;exports.getExtendedWeekDays=F;exports.getFrequencies=h;exports.getFrequency=p;exports.getMonth=M;exports.getMonthDay=x;exports.getMonths=w;exports.getOffset=O;exports.getOffsets=E;exports.getRepeatOnRule=P;exports.getRule=m;exports.getUntil=R;exports.getWeekDay=v;exports.getWeekDays=W;exports.toUntilEndOfDay=N;exports.weekDayRuleFromString=b;exports.weekdayRule=f;exports.weekendRule=l;
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;
@@ -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 s, isNullOrEmptyString as d } from "../utils/index.mjs";
9
- import { parseRule as i } from "@progress/kendo-recurrence";
10
- import { ZonedDate as u, toLocalDate as l } from "@progress/kendo-date-math";
11
- const r = (e) => e.charAt(0).toUpperCase() + e.slice(1), k = ["first", "second", "third", "fourth", "last"], D = ["never", "daily", "weekly", "monthly", "yearly"], m = [
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
- ], b = [
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
- ], p = [
25
+ ], N = [
26
26
  { day: 0, offset: 0 },
27
27
  { day: 6, offset: 0 }
28
- ], v = (e) => {
28
+ ], B = (e) => {
29
29
  switch (e) {
30
30
  case "day":
31
- return m;
31
+ return F;
32
32
  case "weekday":
33
- return b;
33
+ return q;
34
34
  case "weekend":
35
- return p;
35
+ return N;
36
36
  }
37
- }, W = (e) => i({ recurrenceRule: e }) || {}, R = (e) => D.map((t) => ({
37
+ }, K = (e) => b({ recurrenceRule: e }) || {}, Q = (e) => x.map((t) => ({
38
38
  value: t,
39
- text: e("Frequencies" + r(t))
40
- })), F = (e) => s(e) && !d(e.freq) ? e.freq : "never", x = (e) => s(e.until) ? l(e.until) : null, N = (e) => e.dateFormatNames({
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, a) => ({
45
+ (t, n) => ({
46
46
  text: t,
47
- value: a + 1
47
+ value: n + 1
48
48
  })
49
- ), O = (e) => {
50
- const t = e.firstDay(), a = e.dateFormatNames({
49
+ ), G = (e) => {
50
+ const t = e.firstDay(), n = e.dateFormatNames({
51
51
  type: "days",
52
52
  nameType: "abbreviated"
53
53
  }).map(
54
- (n, o) => ({
55
- text: n,
56
- value: o
54
+ (o, a) => ({
55
+ text: o,
56
+ value: a
57
57
  })
58
58
  );
59
- return a.slice(t).concat(a.slice(0, t));
60
- }, E = (e, t, a) => {
61
- var o;
62
- let n;
63
- if (s(t.byWeekDay))
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
- n = "day";
66
+ o = "day";
67
67
  break;
68
68
  case 5:
69
- n = "weekday";
69
+ o = "weekday";
70
70
  break;
71
71
  case 2:
72
- n = "weekend";
72
+ o = "weekend";
73
73
  break;
74
74
  case 1:
75
- n = t.byWeekDay[0].day;
75
+ o = t.byWeekDay[0].day;
76
76
  break;
77
77
  default:
78
- n = a.getDay();
78
+ o = n.getDay();
79
79
  break;
80
80
  }
81
81
  else
82
- n = a.getDay();
83
- return (o = e.find((y) => n === y.value)) != null ? o : e[0];
84
- }, M = (e, t) => {
85
- const a = e.firstDay(), n = e.dateFormatNames({
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
- (c, f) => ({
90
- text: c,
91
- value: f
89
+ (s, y) => ({
90
+ text: s,
91
+ value: y
92
92
  })
93
- ), o = n.slice(a).concat(n.slice(0, a));
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(o);
99
- }, S = (e, t) => e.find(
100
- (a) => a.value === (t.bySetPosition ? t.bySetPosition[0] : t.byWeekDay && t.byWeekDay[0] ? t.byWeekDay[0].offset : 1)
101
- ) || e[0], T = (e) => {
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 k.map(
104
- (a, n) => ({
105
- text: e("OffsetPositions" + r(a)),
106
- value: t[n]
103
+ return P.map(
104
+ (n, o) => ({
105
+ text: e("OffsetPositions" + O(n)),
106
+ value: t[o]
107
107
  })
108
108
  );
109
- }, C = (e) => s(e.count) ? "count" : s(e.until) ? "until" : "never", U = (e) => {
110
- if (s(e.byWeekDay))
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 (s(e.byMonthDay))
112
+ if (d(e.byMonthDay))
113
113
  return "monthday";
114
- }, P = (e, t) => e.find((a) => (t.byMonth ? t.byMonth[0] : null) === a.value) || e[0], q = (e, t) => s(e.byMonthDay) && e.byMonthDay.length > 0 ? e.byMonthDay[0] : t.getDate(), I = (e, t) => u.fromUTCDate(
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
- D as FREQUENCIES,
120
- k as OFFSET_POSITIONS,
121
- r as capitalize,
122
- m as dayRule,
123
- C as getEndRule,
124
- M as getExtendedWeekDays,
125
- R as getFrequencies,
126
- F as getFrequency,
127
- P as getMonth,
128
- q as getMonthDay,
129
- N as getMonths,
130
- S as getOffset,
131
- T as getOffsets,
132
- U as getRepeatOnRule,
133
- W as getRule,
134
- x as getUntil,
135
- E as getWeekDay,
136
- O as getWeekDays,
137
- I as toUntilEndOfDay,
138
- v as weekDayRuleFromString,
139
- b as weekdayRule,
140
- p as weekendRule
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 n=require("@progress/kendo-react-common"),I=require("@progress/kendo-recurrence"),S=require("@progress/kendo-date-math"),i=require("../utils/index.js"),L=(e,{dateRange:r,fields:c,timezone:o})=>{const a=n.getter(c.recurrenceId||"recurrenceId"),t=n.getter(c.recurrenceRule||"recurrenceRule"),l=new Set(e.filter(d=>{const p=a(d);return p!=null&&!!t(d)}).map(a));return e.map(E(c)).reduce(y(r,o,c,l),[]).filter(d=>!i.isMaster(d.dataItem,c))},E=e=>r=>{const c=n.getter(e.start||"start")(r),o=n.getter(e.originalStart||"originalStart")(r),a=n.getter(e.recurrenceId||"recurrenceId")(r),t=n.getter(e.recurrenceRule||"recurrenceRule")(r),l=a!=null&&!!t&&o==null,D=n.clone(r);return l&&i.setField(D,e.originalStart||"originalStart",c),{uid:n.getter(e.id||"id")(r),start:c,startTimezone:n.getter(e.startTimezone||"startTimezone")(r),originalStart:l?c:o,end:n.getter(e.end||"end")(r),endTimezone:n.getter(e.endTimezone||"endTimezone")(r),isAllDay:n.getter(e.isAllDay||"isAllDay")(r),title:n.getter(e.title||"title")(r),description:n.getter(e.description||"description")(r),occurrenceId:n.getter("occurrenceId")(r),recurrenceRule:t,recurrenceExceptions:n.getter(e.recurrenceExceptions||"recurrenceExceptions")(r),recurrenceId:a,readonly:n.getter(e.readonly||"readonly")(r),dataItem:D}},y=(e,r,c,o)=>(a,t)=>[...a,...t.recurrenceRule&&(t.recurrenceId===null||t.recurrenceId===void 0)&&i.isMaster(t.dataItem,c)&&!o.has(t.uid)?[...m(t,{dateRange:e,timezone:r,fields:c})]:[t]],m=(e,{dateRange:r,timezone:c,fields:o})=>{const a=e.recurrenceRule,t=I.parseRule({recurrenceRule:a});if(!t)return[];t.start||(t.start=S.ZonedDate.fromLocalDate(e.start,c)),t.end||(t.end=S.ZonedDate.fromLocalDate(e.end,c));const l=e.recurrenceExceptions;l&&(t.exceptionDates=l.map(u=>S.ZonedDate.fromLocalDate(u,c)));const D=t.end.getTime()-t.start.getTime(),d=S.ZonedDate.fromLocalDate(new Date(r.zonedStart.toLocalDate().getTime()-D),c),p=r.zonedEnd,R=I.expand(t,{rangeStart:d,rangeEnd:p});if(!R.events.length)return[];const v=t.until,T=v&&t.bySetPosition?R.events.filter(u=>u.start.getTime()<=v.getTime()):R.events;return T.length?T.map((u,x)=>{const s=n.clone(e),g=n.clone(e.dataItem);return s.recurrenceId=s.uid,i.setField(g,o.recurrenceId,e.uid),s.originalStart=u.start.toLocalDate(),i.setField(g,o.originalStart,u.start.toLocalDate()),s.start=u.start.toLocalDate(),i.setField(g,o.start,u.start.toLocalDate()),s.end=u.end.toLocalDate(),i.setField(g,o.end,u.end.toLocalDate()),s.occurrenceId=String(x),i.setField(g,"occurrenceId",String(x)),s.dataItem=g,s}):[]};exports.toOccurrences=L;
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 c, clone as m } from "@progress/kendo-react-common";
9
- import { parseRule as T, expand as E } from "@progress/kendo-recurrence";
10
- import { ZonedDate as S } from "@progress/kendo-date-math";
11
- import { isMaster as L, setField as p } from "../utils/index.mjs";
12
- const b = (e, { dateRange: t, fields: n, timezone: o }) => {
13
- const a = c(n.recurrenceId || "recurrenceId"), r = c(n.recurrenceRule || "recurrenceRule"), i = new Set(
14
- e.filter((l) => {
15
- const D = a(l);
16
- return D != null && !!r(l);
17
- }).map(a)
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(y(n)).reduce(z(t, o, n, i), []).filter((l) => !L(l.dataItem, n));
20
- }, y = (e) => (t) => {
21
- const n = c(e.start || "start")(t), o = c(e.originalStart || "originalStart")(t), a = c(e.recurrenceId || "recurrenceId")(t), r = c(e.recurrenceRule || "recurrenceRule")(t), i = a != null && !!r && o == null, g = m(t);
22
- return i && p(g, e.originalStart || "originalStart", n), {
23
- uid: c(e.id || "id")(t),
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: c(e.startTimezone || "startTimezone")(t),
26
- originalStart: i ? n : o,
27
- end: c(e.end || "end")(t),
28
- endTimezone: c(e.endTimezone || "endTimezone")(t),
29
- isAllDay: c(e.isAllDay || "isAllDay")(t),
30
- title: c(e.title || "title")(t),
31
- description: c(e.description || "description")(t),
32
- occurrenceId: c("occurrenceId")(t),
33
- recurrenceRule: r,
34
- recurrenceExceptions: c(e.recurrenceExceptions || "recurrenceExceptions")(t),
35
- recurrenceId: a,
36
- readonly: c(e.readonly || "readonly")(t),
37
- dataItem: g
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
- }, z = (e, t, n, o) => (a, r) => [
40
- ...a,
41
- ...r.recurrenceRule && (r.recurrenceId === null || r.recurrenceId === void 0) && L(r.dataItem, n) && !o.has(r.uid) ? [...h(r, { dateRange: e, timezone: t, fields: n })] : [r]
42
- ], h = (e, { dateRange: t, timezone: n, fields: o }) => {
43
- const a = e.recurrenceRule, r = T({ recurrenceRule: a });
44
- if (!r)
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
- r.start || (r.start = S.fromLocalDate(e.start, n)), r.end || (r.end = S.fromLocalDate(e.end, n));
47
- const i = e.recurrenceExceptions;
48
- i && (r.exceptionDates = i.map((u) => S.fromLocalDate(u, n)));
49
- const g = r.end.getTime() - r.start.getTime(), l = S.fromLocalDate(
50
- new Date(t.zonedStart.toLocalDate().getTime() - g),
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
- ), D = t.zonedEnd, R = E(r, {
53
- rangeStart: l,
54
- rangeEnd: D
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 v = r.until, x = v && r.bySetPosition ? R.events.filter((u) => u.start.getTime() <= v.getTime()) : R.events;
59
- return x.length ? x.map((u, I) => {
60
- const s = m(e), d = m(e.dataItem);
61
- return s.recurrenceId = s.uid, p(d, o.recurrenceId, e.uid), s.originalStart = u.start.toLocalDate(), p(d, o.originalStart, u.start.toLocalDate()), s.start = u.start.toLocalDate(), p(d, o.start, u.start.toLocalDate()), s.end = u.end.toLocalDate(), p(d, o.end, u.end.toLocalDate()), s.occurrenceId = String(I), p(d, "occurrenceId", String(I)), s.dataItem = d, s;
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
- b as toOccurrences
78
+ B as toOccurrences
66
79
  };