@progress/kendo-react-scheduler 16.4.0-develop.1 → 16.4.0-develop.3

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.
@@ -6,149 +6,181 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as e from "react";
9
- import * as Y from "react-dom";
10
- import { canUseDOM as Z } from "@progress/kendo-react-common";
11
- import { Button as S } from "@progress/kendo-react-buttons";
12
- import { Form as _ } from "@progress/kendo-react-form";
13
- import { Dialog as $, DialogActionsBar as G } from "@progress/kendo-react-dialogs";
14
- import { useLocalization as ee } from "@progress/kendo-react-intl";
15
- import { SchedulerFormEditor as te } from "../editors/SchedulerFormEditor.mjs";
16
- import { trashIcon as ae } from "@progress/kendo-svg-icons";
17
- import { editorValidationRequired as I, messages as i, editorValidationEnd as L, editorSave as F, editorCancel as R, editorDelete as w, editorValidationStart as y, editorNewEvent as B, editorEditEvent as T } from "../messages/index.mjs";
18
- import { useSchedulerFieldsContext as oe } from "../context/SchedulerContext.mjs";
19
- const ne = e.forwardRef((r, V) => {
9
+ import * as ae from "react-dom";
10
+ import { canUseDOM as oe } from "@progress/kendo-react-common";
11
+ import { Button as h } from "@progress/kendo-react-buttons";
12
+ import { Form as ne } from "@progress/kendo-react-form";
13
+ import { Dialog as ie, DialogActionsBar as le } from "@progress/kendo-react-dialogs";
14
+ import { useLocalization as re } from "@progress/kendo-react-intl";
15
+ import { SchedulerFormEditor as se } from "../editors/SchedulerFormEditor.mjs";
16
+ import { DiscardChangesDialog as ce } from "../editors/DiscardChangesDialog.mjs";
17
+ import { trashIcon as de } from "@progress/kendo-svg-icons";
18
+ import { editorValidationRequired as F, messages as i, editorValidationEnd as w, editorSave as B, editorCancel as T, editorDelete as V, editorValidationStart as q, editorNewEvent as A, editorEditEvent as x } from "../messages/index.mjs";
19
+ import { useSchedulerFieldsContext as ue } from "../context/SchedulerContext.mjs";
20
+ const me = e.forwardRef((l, H) => {
20
21
  const {
21
- onCancel: d,
22
- onClose: c,
23
- onSubmit: m,
22
+ onCancel: g,
23
+ onClose: f,
24
+ onSubmit: C,
24
25
  onDelete: s,
25
- editor: q,
26
- dialog: A = p.dialog,
27
- validator: M = p.validator,
28
- ...x
29
- } = r, l = e.useRef(null);
30
- e.useImperativeHandle(l, () => ({ props: r })), e.useImperativeHandle(V, () => l.current);
31
- const a = ee(), o = oe(), v = !!(r.dataItem && r.dataItem[o.id]), E = e.useMemo(
32
- () => a.toLanguageString(I, i[I]),
33
- [a]
34
- ), b = e.useMemo(
35
- () => a.toLanguageString(L, i[L]),
36
- [a]
37
- ), z = e.useMemo(
38
- () => a.toLanguageString(F, i[F]),
39
- [a]
40
- ), H = e.useMemo(
41
- () => a.toLanguageString(R, i[R]),
42
- [a]
43
- ), N = e.useMemo(
44
- () => a.toLanguageString(w, i[w]),
45
- [a]
46
- ), h = e.useMemo(
47
- () => a.toLanguageString(y, i[y]),
48
- [a]
49
- ), O = e.useMemo(
50
- () => a.toLanguageString(B, i[B]),
51
- [a]
52
- ), K = e.useMemo(
53
- () => a.toLanguageString(T, i[T]),
54
- [a]
55
- ), U = v ? K : O, j = e.useCallback(
26
+ editor: N,
27
+ dialog: O = z.dialog,
28
+ validator: D = z.validator,
29
+ ...K
30
+ } = l, r = e.useRef(null);
31
+ e.useImperativeHandle(r, () => ({ props: l })), e.useImperativeHandle(H, () => r.current);
32
+ const o = re(), n = ue(), k = !!(l.dataItem && l.dataItem[n.id]), I = e.useMemo(
33
+ () => o.toLanguageString(F, i[F]),
34
+ [o]
35
+ ), L = e.useMemo(
36
+ () => o.toLanguageString(w, i[w]),
37
+ [o]
38
+ ), P = e.useMemo(
39
+ () => o.toLanguageString(B, i[B]),
40
+ [o]
41
+ ), U = e.useMemo(
42
+ () => o.toLanguageString(T, i[T]),
43
+ [o]
44
+ ), j = e.useMemo(
45
+ () => o.toLanguageString(V, i[V]),
46
+ [o]
47
+ ), R = e.useMemo(
48
+ () => o.toLanguageString(q, i[q]),
49
+ [o]
50
+ ), J = e.useMemo(
51
+ () => o.toLanguageString(A, i[A]),
52
+ [o]
53
+ ), Q = e.useMemo(
54
+ () => o.toLanguageString(x, i[x]),
55
+ [o]
56
+ ), W = k ? Q : J, S = e.useRef(!1), [c, d] = e.useState(null), u = e.useCallback(
56
57
  (t) => {
57
- d && d({
58
+ g && g({
58
59
  value: null,
59
60
  syntheticEvent: t,
60
- target: l.current
61
+ target: r.current
61
62
  });
62
63
  },
63
- [d]
64
- ), J = e.useCallback(
65
- ({ syntheticEvent: t }) => {
66
- c && c({
64
+ [g]
65
+ ), m = e.useCallback(
66
+ (t) => {
67
+ f && f({
67
68
  value: null,
68
69
  syntheticEvent: t,
69
- target: l.current
70
+ target: r.current
70
71
  });
71
72
  },
72
- [c]
73
- ), P = e.useCallback(
74
- (t, n) => {
75
- m && m({
73
+ [f]
74
+ ), X = e.useCallback(
75
+ (t) => {
76
+ if (S.current) {
77
+ d({ type: "cancel", syntheticEvent: t });
78
+ return;
79
+ }
80
+ u(t);
81
+ },
82
+ [u]
83
+ ), Y = e.useCallback(
84
+ ({ syntheticEvent: t }) => {
85
+ if (S.current) {
86
+ d({ type: "close", syntheticEvent: t });
87
+ return;
88
+ }
89
+ m(t);
90
+ },
91
+ [m]
92
+ ), Z = e.useCallback(() => {
93
+ if (c) {
94
+ const { type: t, syntheticEvent: a } = c;
95
+ d(null), t === "cancel" ? u(a) : m(a);
96
+ }
97
+ }, [c, u, m]), _ = e.useCallback(() => {
98
+ d(null);
99
+ }, []), $ = e.useCallback(
100
+ (t, a) => {
101
+ C && C({
76
102
  value: t,
77
- syntheticEvent: n,
78
- target: l.current
103
+ syntheticEvent: a,
104
+ target: r.current
79
105
  });
80
106
  },
81
- [m]
82
- ), Q = e.useCallback(
107
+ [C]
108
+ ), G = e.useCallback(
83
109
  (t) => {
84
110
  s && s({
85
- value: r.dataItem,
111
+ value: l.dataItem,
86
112
  syntheticEvent: t,
87
- target: l.current
113
+ target: r.current
88
114
  });
89
115
  },
90
- [s, r.dataItem]
91
- ), k = e.useCallback(
92
- (t, n) => t && n(o.end) && t.getTime() > n(o.end).getTime() ? h : void 0,
93
- [o, h]
94
- ), D = e.useCallback(
95
- (t, n) => t && n(o.start) && t.getTime() < n(o.start).getTime() ? b : void 0,
96
- [o, b]
97
- ), u = e.useCallback(
98
- (t) => t ? void 0 : E,
99
- [E]
100
- ), W = e.useCallback(
101
- (t, n) => {
102
- const g = {};
103
- g[o.start] = [
104
- u(n(o.start)),
105
- k(n(o.start), n)
106
- ].filter(Boolean).reduce((f, C) => f || C, ""), g[o.end] = [
107
- u(n(o.start)),
108
- D(n(o.start), n)
109
- ].filter(Boolean).reduce((f, C) => f || C, "");
110
- const X = M(t, n);
111
- return { ...g, ...X };
116
+ [s, l.dataItem]
117
+ ), p = e.useCallback(
118
+ (t, a) => t && a(n.end) && t.getTime() > a(n.end).getTime() ? R : void 0,
119
+ [n, R]
120
+ ), y = e.useCallback(
121
+ (t, a) => t && a(n.start) && t.getTime() < a(n.start).getTime() ? L : void 0,
122
+ [n, L]
123
+ ), M = e.useCallback(
124
+ (t) => t ? void 0 : I,
125
+ [I]
126
+ ), ee = e.useCallback(
127
+ (t, a) => {
128
+ const b = {};
129
+ b[n.start] = [
130
+ M(a(n.start)),
131
+ p(a(n.start), a)
132
+ ].filter(Boolean).reduce((E, v) => E || v, ""), b[n.end] = [
133
+ M(a(n.start)),
134
+ y(a(n.start), a)
135
+ ].filter(Boolean).reduce((E, v) => E || v, "");
136
+ const te = D(t, a);
137
+ return { ...b, ...te };
112
138
  },
113
- [D, o.end, o.start, u, k, M]
139
+ [y, n.end, n.start, M, p, D]
114
140
  );
115
- return Z ? Y.createPortal(
141
+ return oe ? ae.createPortal(
116
142
  /* @__PURE__ */ e.createElement(
117
- _,
143
+ ne,
118
144
  {
119
145
  ignoreModified: !0,
120
- initialValues: r.dataItem,
121
- onSubmit: P,
122
- validator: W,
123
- render: (t) => /* @__PURE__ */ e.createElement(A, { title: U, width: 650, onClose: J }, /* @__PURE__ */ e.createElement(te, { ...t, as: q }), /* @__PURE__ */ e.createElement(G, { layout: "end" }, v && s && /* @__PURE__ */ e.createElement(
124
- S,
146
+ initialValues: l.dataItem,
147
+ onSubmit: $,
148
+ validator: ee,
149
+ render: (t) => (S.current = t.modified, /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(O, { title: W, width: 650, onClose: Y }, /* @__PURE__ */ e.createElement(se, { ...t, as: N }), /* @__PURE__ */ e.createElement(le, { layout: "end" }, k && s && /* @__PURE__ */ e.createElement(
150
+ h,
125
151
  {
126
152
  fillMode: "flat",
127
153
  themeColor: "primary",
128
- svgIcon: ae,
129
- onClick: Q
154
+ svgIcon: de,
155
+ onClick: G
130
156
  },
131
- N
132
- ), /* @__PURE__ */ e.createElement(S, { onClick: j }, H), /* @__PURE__ */ e.createElement(
133
- S,
157
+ j
158
+ ), /* @__PURE__ */ e.createElement(h, { onClick: X }, U), /* @__PURE__ */ e.createElement(
159
+ h,
134
160
  {
135
161
  themeColor: "primary",
136
162
  disabled: !t.allowSubmit,
137
163
  onClick: t.onSubmit
138
164
  },
139
- z
165
+ P
166
+ ))), c && /* @__PURE__ */ e.createElement(
167
+ ce,
168
+ {
169
+ onDiscard: Z,
170
+ onCancel: _
171
+ }
140
172
  ))),
141
- ...x
173
+ ...K
142
174
  }
143
175
  ),
144
176
  document && document.body
145
177
  ) : null;
146
- }), p = {
147
- dialog: $,
178
+ }), z = {
179
+ dialog: ie,
148
180
  validator: () => ({})
149
181
  };
150
- ne.displayName = "KendoReactSchedulerForm";
182
+ me.displayName = "KendoReactSchedulerForm";
151
183
  export {
152
- ne as SchedulerForm,
153
- p as schedulerFormDefaultProps
184
+ me as SchedulerForm,
185
+ z as schedulerFormDefaultProps
154
186
  };
@@ -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 J=require("react"),L=require("@progress/kendo-react-tooltip"),M=require("@progress/kendo-react-common"),h=require("@progress/kendo-react-buttons"),U=require("@progress/kendo-react-inputs"),d=require("@progress/kendo-react-form"),w=require("@progress/kendo-react-labels"),x=require("@progress/kendo-react-intl"),P=require("@progress/kendo-date-math"),R=require("@progress/kendo-svg-icons"),v=require("../utils/index.js"),X=require("../hooks/useQuickCreatePlacement.js"),Y=require("../hooks/useCloseOnAnchorScrollOut.js"),t=require("../messages/index.js"),I=require("../context/SchedulerContext.js");function ee(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const c in s)if(c!=="default"){const r=Object.getOwnPropertyDescriptor(s,c);Object.defineProperty(a,c,r.get?r:{enumerable:!0,get:()=>s[c]})}}return a.default=s,Object.freeze(a)}const e=ee(J),N={skeleton:"MMMMd"},z="t",te=360,oe=s=>{const{value:a,onChange:c,onKeyDown:r,valid:E,placeholder:p,ariaLabel:m}=s;return e.createElement(U.TextBox,{"aria-label":m,placeholder:p,autoComplete:"off",value:a!=null?a:"",onChange:c,onKeyDown:r,valid:E})},A=s=>{const{show:a,anchor:c,dataItem:r,validator:E,onSubmit:p,onMoreOptions:m,onCancel:n}=s,g=x.useInternationalization(),u=x.useLocalization(),i=I.useSchedulerFieldsContext(),{timezone:b}=I.useSchedulerPropsContext(),S=X.useQuickCreatePlacement(),y=e.useRef(null),Q=e.useCallback(()=>{n==null||n({value:null,syntheticEvent:void 0})},[n]);Y.useCloseOnAnchorScrollOut(a,c,Q),e.useEffect(()=>{if(!a)return;const o=l=>{var F,T;const f=l.target,O=(T=(F=y.current)==null?void 0:F.element)==null?void 0:T.closest(".k-popover");(O?O.contains(f):!1)||n==null||n({value:null,syntheticEvent:void 0})};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[a,c,n]);const k=v.getField(r,i.start),C=v.getField(r,i.end),B=!!v.getField(r,i.isAllDay),_=u.toLanguageString(t.allDay,t.messages[t.allDay]);let D="";if(k&&C){const o=P.ZonedDate.fromLocalDate(k,b),l=P.ZonedDate.fromLocalDate(C,b);D=B?`${g.formatDate(o,N)}, ${_}`:`${g.formatDate(o,N)}, ${g.formatDate(o,z)} - ${g.formatDate(l,z)}`}const q=u.toLanguageString(t.editorNewEvent,t.messages[t.editorNewEvent]),$=u.toLanguageString(t.editorEventTitle,t.messages[t.editorEventTitle]),j=u.toLanguageString(t.quickCreateSave,t.messages[t.quickCreateSave]),K=u.toLanguageString(t.quickCreateMoreOptions,t.messages[t.quickCreateMoreOptions]),W=u.toLanguageString(t.quickCreateCancel,t.messages[t.quickCreateCancel]),V=e.useCallback((o,l)=>{p({value:o,syntheticEvent:l})},[p]),Z=e.useCallback(o=>l=>{if(!m)return;const f={...r};v.setField(f,i.title,o.valueGetter(i.title)),m({value:f,syntheticEvent:l})},[m,r,i.title]),G=e.useCallback(o=>{n&&n({value:null,syntheticEvent:o})},[n]),H=e.useCallback(()=>{n==null||n({value:null,syntheticEvent:void 0})},[n]);return e.createElement(d.Form,{key:k?k.getTime():void 0,initialValues:r,validator:E,ignoreModified:!0,onSubmit:V,render:o=>e.createElement(L.Popover,{anchor:c,show:a,position:S.position,collision:S.collision,callout:!1,title:q,style:{width:te},onKeyDown:H,animate:{openDuration:1,closeDuration:1}},e.createElement(d.FormElement,{ref:y,horizontal:!0,className:"k-scheduler-edit-form"},e.createElement(d.FieldWrapper,null,e.createElement(w.Label,{className:"k-form-label"},e.createElement(M.SvgIcon,{icon:R.rightDoubleQuotesIcon,size:"xlarge"})),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(d.Field,{name:i.title,component:oe,ariaLabel:$,placeholder:q,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),o.onSubmit(l))}}))),e.createElement(d.FieldWrapper,null,e.createElement(w.Label,{className:"k-form-label"},e.createElement(M.SvgIcon,{icon:R.clockIcon,size:"xlarge"})),e.createElement("div",{className:"k-form-field-wrap"},e.createElement("div",{className:"k-scheduler-edit-form-row k-color-subtle"},D)))),e.createElement(L.PopoverActionsBar,null,e.createElement(h.Button,{type:"button",fillMode:"flat",themeColor:"primary",onClick:Z(o)},K),e.createElement("span",{className:"k-spacer"}),e.createElement(h.Button,{type:"button",onClick:G},W),e.createElement(h.Button,{type:"button",themeColor:"primary",disabled:!o.allowSubmit,onClick:o.onSubmit},j)))})};A.displayName="KendoReactSchedulerQuickCreateForm";const ne={};exports.SchedulerQuickCreateForm=A;exports.schedulerQuickCreateFormDefaultProps=ne;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react"),L=require("@progress/kendo-react-tooltip"),w=require("@progress/kendo-react-common"),b=require("@progress/kendo-react-buttons"),ee=require("@progress/kendo-react-inputs"),d=require("@progress/kendo-react-form"),P=require("@progress/kendo-react-labels"),x=require("@progress/kendo-react-intl"),R=require("@progress/kendo-date-math"),z=require("@progress/kendo-svg-icons"),E=require("../utils/index.js"),te=require("../hooks/useQuickCreatePlacement.js"),oe=require("../hooks/useCloseOnAnchorScrollOut.js"),t=require("../messages/index.js"),I=require("../context/SchedulerContext.js");function ne(i){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const c in i)if(c!=="default"){const r=Object.getOwnPropertyDescriptor(i,c);Object.defineProperty(a,c,r.get?r:{enumerable:!0,get:()=>i[c]})}}return a.default=i,Object.freeze(a)}const e=ne(Y),N={skeleton:"MMMMd"},A="t",ae=360,Q=6,re=i=>{const{value:a,onChange:c,onKeyDown:r,valid:h,placeholder:p,ariaLabel:m}=i;return e.createElement(ee.TextBox,{"aria-label":m,placeholder:p,autoComplete:"off",value:a!=null?a:"",onChange:c,onKeyDown:r,valid:h})},B=i=>{const{show:a,anchor:c,dataItem:r,validator:h,onSubmit:p,onMoreOptions:m,onCancel:n}=i,g=x.useInternationalization(),u=x.useLocalization(),s=I.useSchedulerFieldsContext(),{timezone:S}=I.useSchedulerPropsContext(),k=te.useQuickCreatePlacement(),y=e.useRef(null),_=e.useCallback(()=>{n==null||n({value:null,syntheticEvent:void 0})},[n]);oe.useCloseOnAnchorScrollOut(a,c,_),e.useEffect(()=>{if(!a)return;const o=l=>{var M,T;const f=l.target,F=(T=(M=y.current)==null?void 0:M.element)==null?void 0:T.closest(".k-popover");(F?F.contains(f):!1)||n==null||n({value:null,syntheticEvent:void 0})};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[a,c,n]);const v=E.getField(r,s.start),C=E.getField(r,s.end),$=!!E.getField(r,s.isAllDay),j=u.toLanguageString(t.allDay,t.messages[t.allDay]);let D="";if(v&&C){const o=R.ZonedDate.fromLocalDate(v,S),l=R.ZonedDate.fromLocalDate(C,S);D=$?`${g.formatDate(o,N)}, ${j}`:`${g.formatDate(o,N)}, ${g.formatDate(o,A)} - ${g.formatDate(l,A)}`}const O=u.toLanguageString(t.editorNewEvent,t.messages[t.editorNewEvent]),K=u.toLanguageString(t.editorEventTitle,t.messages[t.editorEventTitle]),V=u.toLanguageString(t.quickCreateSave,t.messages[t.quickCreateSave]),W=u.toLanguageString(t.quickCreateMoreOptions,t.messages[t.quickCreateMoreOptions]),G=u.toLanguageString(t.quickCreateCancel,t.messages[t.quickCreateCancel]),Z=e.useCallback((o,l)=>{p({value:o,syntheticEvent:l})},[p]),H=e.useCallback(o=>l=>{if(!m)return;const f={...r};E.setField(f,s.title,o.valueGetter(s.title)),m({value:f,syntheticEvent:l})},[m,r,s.title]),J=e.useCallback(o=>{n&&n({value:null,syntheticEvent:o})},[n]),U=e.useCallback(()=>{n==null||n({value:null,syntheticEvent:void 0})},[n]),q=k.position==="top"||k.position==="bottom",X={vertical:q?Q:0,horizontal:q?0:Q};return e.createElement(d.Form,{key:v?v.getTime():void 0,initialValues:r,validator:h,ignoreModified:!0,onSubmit:Z,render:o=>e.createElement(L.Popover,{anchor:c,show:a,position:k.position,collision:k.collision,callout:!1,title:O,style:{width:ae},onKeyDown:U,animate:{openDuration:1,closeDuration:1},margin:X},e.createElement(d.FormElement,{ref:y,horizontal:!0,className:"k-scheduler-edit-form"},e.createElement(d.FieldWrapper,null,e.createElement(P.Label,{className:"k-form-label"},e.createElement(w.SvgIcon,{icon:z.rightDoubleQuotesIcon,size:"xlarge"})),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(d.Field,{name:s.title,component:re,ariaLabel:K,placeholder:O,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),o.onSubmit(l))}}))),e.createElement(d.FieldWrapper,null,e.createElement(P.Label,{className:"k-form-label"},e.createElement(w.SvgIcon,{icon:z.clockIcon,size:"xlarge"})),e.createElement("div",{className:"k-form-field-wrap"},e.createElement("div",{className:"k-scheduler-edit-form-row k-color-subtle"},D)))),e.createElement(L.PopoverActionsBar,null,e.createElement(b.Button,{type:"button",fillMode:"flat",themeColor:"primary",onClick:H(o)},W),e.createElement("span",{className:"k-spacer"}),e.createElement(b.Button,{type:"button",onClick:J},G),e.createElement(b.Button,{type:"button",themeColor:"primary",disabled:!o.allowSubmit,onClick:o.onSubmit},V)))})};B.displayName="KendoReactSchedulerQuickCreateForm";const le={};exports.SchedulerQuickCreateForm=B;exports.schedulerQuickCreateFormDefaultProps=le;
@@ -6,24 +6,24 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as e from "react";
9
- import { Popover as U, PopoverActionsBar as X } from "@progress/kendo-react-tooltip";
9
+ import { Popover as ee, PopoverActionsBar as te } from "@progress/kendo-react-tooltip";
10
10
  import { SvgIcon as F } from "@progress/kendo-react-common";
11
- import { Button as h } from "@progress/kendo-react-buttons";
12
- import { TextBox as Y } from "@progress/kendo-react-inputs";
13
- import { Form as ee, FormElement as te, FieldWrapper as M, Field as oe } from "@progress/kendo-react-form";
11
+ import { Button as g } from "@progress/kendo-react-buttons";
12
+ import { TextBox as oe } from "@progress/kendo-react-inputs";
13
+ import { Form as ne, FormElement as ae, FieldWrapper as O, Field as le } from "@progress/kendo-react-form";
14
14
  import { Label as x } from "@progress/kendo-react-labels";
15
- import { useInternationalization as ne, useLocalization as ae } from "@progress/kendo-react-intl";
16
- import { ZonedDate as O } from "@progress/kendo-date-math";
17
- import { rightDoubleQuotesIcon as le, clockIcon as re } from "@progress/kendo-svg-icons";
18
- import { getField as g, setField as ie } from "../utils/index.mjs";
19
- import { useQuickCreatePlacement as ce } from "../hooks/useQuickCreatePlacement.mjs";
20
- import { useCloseOnAnchorScrollOut as se } from "../hooks/useCloseOnAnchorScrollOut.mjs";
21
- import { allDay as z, messages as c, editorNewEvent as N, editorEventTitle as A, quickCreateSave as I, quickCreateMoreOptions as P, quickCreateCancel as Q } from "../messages/index.mjs";
22
- import { useSchedulerFieldsContext as me, useSchedulerPropsContext as ue } from "../context/SchedulerContext.mjs";
23
- const K = { skeleton: "MMMMd" }, $ = "t", de = 360, pe = (E) => {
24
- const { value: a, onChange: s, onKeyDown: l, valid: v, placeholder: u, ariaLabel: m } = E;
15
+ import { useInternationalization as re, useLocalization as ie } from "@progress/kendo-react-intl";
16
+ import { ZonedDate as P } from "@progress/kendo-date-math";
17
+ import { rightDoubleQuotesIcon as ce, clockIcon as se } from "@progress/kendo-svg-icons";
18
+ import { getField as k, setField as me } from "../utils/index.mjs";
19
+ import { useQuickCreatePlacement as ue } from "../hooks/useQuickCreatePlacement.mjs";
20
+ import { useCloseOnAnchorScrollOut as de } from "../hooks/useCloseOnAnchorScrollOut.mjs";
21
+ import { allDay as z, messages as c, editorNewEvent as A, editorEventTitle as N, quickCreateSave as I, quickCreateMoreOptions as Q, quickCreateCancel as K } from "../messages/index.mjs";
22
+ import { useSchedulerFieldsContext as pe, useSchedulerPropsContext as fe } from "../context/SchedulerContext.mjs";
23
+ const R = { skeleton: "MMMMd" }, $ = "t", Ee = 360, B = 6, ve = (v) => {
24
+ const { value: a, onChange: s, onKeyDown: l, valid: h, placeholder: u, ariaLabel: m } = v;
25
25
  return /* @__PURE__ */ e.createElement(
26
- Y,
26
+ oe,
27
27
  {
28
28
  "aria-label": m,
29
29
  placeholder: u,
@@ -31,114 +31,118 @@ const K = { skeleton: "MMMMd" }, $ = "t", de = 360, pe = (E) => {
31
31
  value: a != null ? a : "",
32
32
  onChange: s,
33
33
  onKeyDown: l,
34
- valid: v
34
+ valid: h
35
35
  }
36
36
  );
37
- }, fe = (E) => {
38
- const { show: a, anchor: s, dataItem: l, validator: v, onSubmit: u, onMoreOptions: m, onCancel: o } = E, d = ne(), i = ae(), r = me(), { timezone: k } = ue(), b = ce(), y = e.useRef(null), B = e.useCallback(() => {
37
+ }, he = (v) => {
38
+ const { show: a, anchor: s, dataItem: l, validator: h, onSubmit: u, onMoreOptions: m, onCancel: o } = v, d = re(), i = ie(), r = pe(), { timezone: b } = fe(), p = ue(), y = e.useRef(null), V = e.useCallback(() => {
39
39
  o == null || o({ value: null, syntheticEvent: void 0 });
40
40
  }, [o]);
41
- se(a, s, B), e.useEffect(() => {
41
+ de(a, s, V), e.useEffect(() => {
42
42
  if (!a)
43
43
  return;
44
44
  const t = (n) => {
45
- var w, T;
46
- const f = n.target, L = (T = (w = y.current) == null ? void 0 : w.element) == null ? void 0 : T.closest(".k-popover");
47
- (L ? L.contains(f) : !1) || o == null || o({ value: null, syntheticEvent: void 0 });
45
+ var M, T;
46
+ const E = n.target, w = (T = (M = y.current) == null ? void 0 : M.element) == null ? void 0 : T.closest(".k-popover");
47
+ (w ? w.contains(E) : !1) || o == null || o({ value: null, syntheticEvent: void 0 });
48
48
  };
49
49
  return document.addEventListener("mousedown", t), () => {
50
50
  document.removeEventListener("mousedown", t);
51
51
  };
52
52
  }, [a, s, o]);
53
- const p = g(l, r.start), D = g(l, r.end), R = !!g(l, r.isAllDay), q = i.toLanguageString(z, c[z]);
53
+ const f = k(l, r.start), D = k(l, r.end), _ = !!k(l, r.isAllDay), q = i.toLanguageString(z, c[z]);
54
54
  let S = "";
55
- if (p && D) {
56
- const t = O.fromLocalDate(p, k), n = O.fromLocalDate(D, k);
57
- S = R ? `${d.formatDate(t, K)}, ${q}` : `${d.formatDate(t, K)}, ${d.formatDate(
55
+ if (f && D) {
56
+ const t = P.fromLocalDate(f, b), n = P.fromLocalDate(D, b);
57
+ S = _ ? `${d.formatDate(t, R)}, ${q}` : `${d.formatDate(t, R)}, ${d.formatDate(
58
58
  t,
59
59
  $
60
60
  )} - ${d.formatDate(n, $)}`;
61
61
  }
62
- const C = i.toLanguageString(N, c[N]), _ = i.toLanguageString(A, c[A]), V = i.toLanguageString(I, c[I]), W = i.toLanguageString(P, c[P]), G = i.toLanguageString(Q, c[Q]), H = e.useCallback(
62
+ const C = i.toLanguageString(A, c[A]), G = i.toLanguageString(N, c[N]), W = i.toLanguageString(I, c[I]), H = i.toLanguageString(Q, c[Q]), Z = i.toLanguageString(K, c[K]), j = e.useCallback(
63
63
  (t, n) => {
64
64
  u({ value: t, syntheticEvent: n });
65
65
  },
66
66
  [u]
67
- ), Z = e.useCallback(
67
+ ), J = e.useCallback(
68
68
  (t) => (n) => {
69
69
  if (!m)
70
70
  return;
71
- const f = { ...l };
72
- ie(f, r.title, t.valueGetter(r.title)), m({ value: f, syntheticEvent: n });
71
+ const E = { ...l };
72
+ me(E, r.title, t.valueGetter(r.title)), m({ value: E, syntheticEvent: n });
73
73
  },
74
74
  [m, l, r.title]
75
- ), j = e.useCallback(
75
+ ), U = e.useCallback(
76
76
  (t) => {
77
77
  o && o({ value: null, syntheticEvent: t });
78
78
  },
79
79
  [o]
80
- ), J = e.useCallback(() => {
80
+ ), X = e.useCallback(() => {
81
81
  o == null || o({ value: null, syntheticEvent: void 0 });
82
- }, [o]);
82
+ }, [o]), L = p.position === "top" || p.position === "bottom", Y = {
83
+ vertical: L ? B : 0,
84
+ horizontal: L ? 0 : B
85
+ };
83
86
  return /* @__PURE__ */ e.createElement(
84
- ee,
87
+ ne,
85
88
  {
86
- key: p ? p.getTime() : void 0,
89
+ key: f ? f.getTime() : void 0,
87
90
  initialValues: l,
88
- validator: v,
91
+ validator: h,
89
92
  ignoreModified: !0,
90
- onSubmit: H,
93
+ onSubmit: j,
91
94
  render: (t) => /* @__PURE__ */ e.createElement(
92
- U,
95
+ ee,
93
96
  {
94
97
  anchor: s,
95
98
  show: a,
96
- position: b.position,
97
- collision: b.collision,
99
+ position: p.position,
100
+ collision: p.collision,
98
101
  callout: !1,
99
102
  title: C,
100
- style: { width: de },
101
- onKeyDown: J,
102
- animate: { openDuration: 1, closeDuration: 1 }
103
+ style: { width: Ee },
104
+ onKeyDown: X,
105
+ animate: { openDuration: 1, closeDuration: 1 },
106
+ margin: Y
103
107
  },
104
- /* @__PURE__ */ e.createElement(te, { ref: y, horizontal: !0, className: "k-scheduler-edit-form" }, /* @__PURE__ */ e.createElement(M, null, /* @__PURE__ */ e.createElement(x, { className: "k-form-label" }, /* @__PURE__ */ e.createElement(F, { icon: le, size: "xlarge" })), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
105
- oe,
108
+ /* @__PURE__ */ e.createElement(ae, { ref: y, horizontal: !0, className: "k-scheduler-edit-form" }, /* @__PURE__ */ e.createElement(O, null, /* @__PURE__ */ e.createElement(x, { className: "k-form-label" }, /* @__PURE__ */ e.createElement(F, { icon: ce, size: "xlarge" })), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
109
+ le,
106
110
  {
107
111
  name: r.title,
108
- component: pe,
109
- ariaLabel: _,
112
+ component: ve,
113
+ ariaLabel: G,
110
114
  placeholder: C,
111
115
  onKeyDown: (n) => {
112
116
  n.key === "Enter" && (n.preventDefault(), t.onSubmit(n));
113
117
  }
114
118
  }
115
- ))), /* @__PURE__ */ e.createElement(M, null, /* @__PURE__ */ e.createElement(x, { className: "k-form-label" }, /* @__PURE__ */ e.createElement(F, { icon: re, size: "xlarge" })), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement("div", { className: "k-scheduler-edit-form-row k-color-subtle" }, S)))),
116
- /* @__PURE__ */ e.createElement(X, null, /* @__PURE__ */ e.createElement(
117
- h,
119
+ ))), /* @__PURE__ */ e.createElement(O, null, /* @__PURE__ */ e.createElement(x, { className: "k-form-label" }, /* @__PURE__ */ e.createElement(F, { icon: se, size: "xlarge" })), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement("div", { className: "k-scheduler-edit-form-row k-color-subtle" }, S)))),
120
+ /* @__PURE__ */ e.createElement(te, null, /* @__PURE__ */ e.createElement(
121
+ g,
118
122
  {
119
123
  type: "button",
120
124
  fillMode: "flat",
121
125
  themeColor: "primary",
122
- onClick: Z(t)
126
+ onClick: J(t)
123
127
  },
124
- W
125
- ), /* @__PURE__ */ e.createElement("span", { className: "k-spacer" }), /* @__PURE__ */ e.createElement(h, { type: "button", onClick: j }, G), /* @__PURE__ */ e.createElement(
126
- h,
128
+ H
129
+ ), /* @__PURE__ */ e.createElement("span", { className: "k-spacer" }), /* @__PURE__ */ e.createElement(g, { type: "button", onClick: U }, Z), /* @__PURE__ */ e.createElement(
130
+ g,
127
131
  {
128
132
  type: "button",
129
133
  themeColor: "primary",
130
134
  disabled: !t.allowSubmit,
131
135
  onClick: t.onSubmit
132
136
  },
133
- V
137
+ W
134
138
  ))
135
139
  )
136
140
  }
137
141
  );
138
142
  };
139
- fe.displayName = "KendoReactSchedulerQuickCreateForm";
140
- const xe = {};
143
+ he.displayName = "KendoReactSchedulerQuickCreateForm";
144
+ const ze = {};
141
145
  export {
142
- fe as SchedulerQuickCreateForm,
143
- xe as schedulerQuickCreateFormDefaultProps
146
+ he as SchedulerQuickCreateForm,
147
+ ze as schedulerQuickCreateFormDefaultProps
144
148
  };