@progress/kendo-react-dialogs 14.3.2 → 14.3.3-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Window.js +1 -1
- package/Window.mjs +199 -196
- package/dist/cdn/js/kendo-react-dialogs.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +5 -5
package/Window.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 dt=require("react"),lt=require("react-dom"),i=require("prop-types"),ut=require("./WindowTitlebar.js"),a=require("@progress/kendo-react-common"),ft=require("./WindowResizeHandlers.js"),gt=require("./MiddleLayerOptimization.js"),o=require("./StageEnum.js"),Ze=require("./WindowActionsBar.js"),p=require("./constants.js"),Ke=require("./utils.js");function Pe(e){const S=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const A in e)if(A!=="default"){const k=Object.getOwnPropertyDescriptor(e,A);Object.defineProperty(S,A,k.get?k:{enumerable:!0,get:()=>e[A]})}}return S.default=e,Object.freeze(S)}const T=Pe(dt),ht=Pe(lt),{useState:H,useEffect:U,useCallback:u,useMemo:q,useRef:F,useImperativeHandle:st,useContext:wt,forwardRef:Et}=T,ee=300,te=300,se=120,we=100,b=5,x={minWidth:se,minHeight:we,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},Ee=Et((e,S)=>{var Me;const{minWidth:A=x.minWidth,minHeight:k=x.minHeight,resizable:ue=x.resizable,draggable:me=x.draggable,modal:fe=x.modal,doubleClickStageChange:je=x.doubleClickStageChange,autoFocus:Xe=x.autoFocus}=e,[Ge,j]=H(e.stage||o.windowStage.DEFAULT),[X,ne]=H(!1),[ie,I]=H(0),[oe,y]=H(0),[ae,N]=H(ee),[re,W]=H(te),[Ve,ge]=H(!0),[he,Se]=H(p.DEFAULT_DIALOGS_ZINDEX),c=(Me=e.stage)!=null?Me:Ge,B=wt(a.ZIndexContext),R=F(null),De=F(null),h=F({leftBeforeAction:0,topBeforeAction:0,widthBeforeAction:ee,heightBeforeAction:te}),O=F({x:0,y:0}),z=F(void 0),G=F(a.canUseDOM?document.activeElement:null),Ce=F("window-title-"+(e.id?e.id+"-accessibility-id":"")),_=F({left:0,top:0,width:ee,height:te,internalLeft:oe,internalTop:ie,internalWidth:ae,internalHeight:re,stage:c,draggable:me,props:e}),M=u(()=>{const t=a.canUseDOM?document:null;return e.appendTo?e.appendTo.ownerDocument:t},[e.appendTo]),w=u(()=>{const t=M();return t==null?void 0:t.defaultView},[M]),Z=q(()=>{var t;return c!==o.windowStage.FULLSCREEN?Math.max((t=e.top)!=null?t:ie,0):0},[c,e.top,ie]),K=q(()=>{var t;return c!==o.windowStage.FULLSCREEN?Math.max((t=e.left)!=null?t:oe,0):0},[c,e.left,oe]),D=q(()=>{var n;const t=(n=e.width)!=null?n:ae;if(c===o.windowStage.FULLSCREEN){if(e.appendTo)return e.appendTo.offsetWidth;const r=w();return r?r.innerWidth:0}return t},[c,e.width,e.appendTo,ae,w]),C=q(()=>{const t=e.height===void 0?re:e.height;if(c===o.windowStage.FULLSCREEN){if(e.appendTo)return e.appendTo.offsetHeight;const n=w();return n?n.innerHeight:0}else if(c===o.windowStage.MINIMIZED)return 0;return t},[c,e.height,e.appendTo,re,w]),ce=q(()=>e.id?e.id+"-accessibility-id":void 0,[e.id]);U(()=>{_.current={left:K,top:Z,width:D,height:C,internalLeft:oe,internalTop:ie,internalWidth:ae,internalHeight:re,stage:c,draggable:me,props:e}});const P=q(()=>{if(B===void 0)return B!=null?B:p.DEFAULT_DIALOGS_ZINDEX;const t=B?B+p.ZINDEX_DIALOGS_STEP:0;return he>t?he:B+p.ZINDEX_DIALOGS_STEP},[he,B]),Le=u(()=>{var r,l;if(e.top!==void 0)return e.top;if(e.initialTop!==void 0)return e.initialTop;let t=te;if(e.height!==void 0?t=e.height:e.initialHeight!==void 0&&(t=e.initialHeight),e.appendTo&&t)return e.appendTo.offsetHeight/2-t/2;const n=w();return n?n.innerHeight/2-((l=t!=null?t:(r=R.current)==null?void 0:r.clientHeight)!=null?l:0)/2:0},[e.top,e.initialTop,e.height,e.initialHeight,e.appendTo,w]),be=u(()=>{if(e.left!==void 0)return e.left;if(e.initialLeft!==void 0)return e.initialLeft;let t=ee;if(e.width!==void 0?t=e.width:e.initialWidth!==void 0&&(t=e.initialWidth),e.appendTo)return e.appendTo.offsetWidth/2-t/2;const n=w();return n?n.innerWidth/2-t/2:0},[e.left,e.initialLeft,e.width,e.initialWidth,e.appendTo,w]),Ie=u(()=>{let t=ee;return e.width!==void 0?t=e.width:e.initialWidth!==void 0&&(t=e.initialWidth),t},[e.width,e.initialWidth]),ye=u(()=>{let t=te;return e.height!==void 0?t=e.height:e.initialHeight!==void 0&&(t=e.initialHeight),t},[e.height,e.initialHeight]),Ye=u(t=>t.filter(n=>(n==null?void 0:n.type)===Ze.WindowActionsBar),[]),$e=u(t=>t.filter(n=>n&&n.type!==Ze.WindowActionsBar),[]),E=u(()=>typeof S=="object"&&S!==null&&"current"in S?S.current:null,[S]),v=u((t,n,r,l,d,f)=>{var Y,$,J;if(!t)return;const{internalLeft:m,internalTop:s,internalWidth:L,internalHeight:le}=_.current;t({nativeEvent:n.nativeEvent?n.nativeEvent:n.originalEvent,drag:r,end:l,target:E(),left:(Y=d==null?void 0:d.left)!=null?Y:m,top:($=d==null?void 0:d.top)!=null?$:s,width:(J=f==null?void 0:f.width)!=null?J:L,height:(f==null?void 0:f.height)===void 0?le:f==null?void 0:f.height})},[E]),Je=u(t=>{var f,m;if(fe&&a.keepFocusInContainer(t,R.current),t.target!==t.currentTarget)return;const n=A||se,r=k||we,l=t.metaKey||t.ctrlKey,d=(m=C!=null?C:(f=R.current)==null?void 0:f.clientHeight)!=null?m:0;if(l&&ue){switch(t.keyCode){case a.Keys.up:t.preventDefault(),r<=d-b&&W(d-b);break;case a.Keys.down:t.preventDefault(),W(d+b);break;case a.Keys.left:n<=D-b&&N(D-b);break;case a.Keys.right:N(D+b);break;default:return}v(e.onResize,t,!1,void 0);return}if(t.altKey){switch(t.keyCode){case a.Keys.up:c===o.windowStage.MINIMIZED?(V(t),a.dispatchEvent(e.onStageChange,t,E(),{state:o.windowStage.DEFAULT})):c===o.windowStage.DEFAULT&&(de(t),a.dispatchEvent(e.onStageChange,t,E(),{state:o.windowStage.FULLSCREEN}));break;case a.Keys.down:c===o.windowStage.FULLSCREEN?(V(t),a.dispatchEvent(e.onStageChange,t,E(),{state:o.windowStage.DEFAULT})):c===o.windowStage.DEFAULT&&(We(t),a.dispatchEvent(e.onStageChange,t,E(),{state:o.windowStage.MINIMIZED}));break}return}if(!t.ctrlKey)switch(t.keyCode){case a.Keys.esc:e.onClose&&ve(t);return;case a.Keys.up:I(s=>s-b);break;case a.Keys.down:I(s=>s+b);break;case a.Keys.left:y(s=>s-b);break;case a.Keys.right:y(s=>s+b);break;default:return}v(e.onMove,t,!1,void 0)},[fe,A,k,ue,e.onResize,e.onStageChange,e.onClose,e.onMove,C,D,c,v,E]),Qe=u(t=>{const n=t.event,{left:r,top:l}=_.current;h.current.differenceLeft=n.pageX-r,h.current.differenceTop=n.pageY-l},[]),pe=u(t=>{const n=t.event;n.originalEvent.preventDefault();const{stage:r,draggable:l,props:d,width:f,height:m}=_.current;if(r!==o.windowStage.FULLSCREEN&&l){const s=Math.max(n.pageY-(h.current.differenceTop||0),0),L=n.pageX-(h.current.differenceLeft||0);I(s),y(L),ne(!0),d.onMove&&v(d.onMove,n,!0,!1,{left:L,top:s},{width:f,height:m})}},[v]),et=u(t=>{const n=t.event,{stage:r,draggable:l,props:d,left:f,top:m,width:s,height:L}=_.current;r!==o.windowStage.FULLSCREEN&&l&&d.onMove&&v(d.onMove,n,!0,!0,{left:f,top:m},{width:s,height:L}),ne(!1)},[v]),tt=u(()=>{z.current?(clearTimeout(z.current),z.current=void 0):(ge(!0),Se(Ke.getMaxZIndex(P,M(),ce)))},[P,M,ce]),nt=u(()=>{clearTimeout(z.current);const t=w();t&&(z.current=t.setTimeout(()=>{ge(!1),z.current=void 0}))},[w]),We=u(t=>{t.preventDefault(),h.current.leftBeforeAction=K,h.current.topBeforeAction=Z,h.current.widthBeforeAction=D,h.current.heightBeforeAction=C,j(o.windowStage.MINIMIZED),W(0),a.dispatchEvent(e.onStageChange,t,E(),{state:o.windowStage.MINIMIZED})},[K,Z,D,C,e.onStageChange,E]),de=u(t=>{t.preventDefault(),h.current.leftBeforeAction=K,h.current.topBeforeAction=Z,h.current.widthBeforeAction=D,h.current.heightBeforeAction=C;const n=w(),r=n?n.innerWidth:0,l=n?n.innerHeight:0;y(0),I(0),N(e.appendTo?e.appendTo.offsetWidth:r),W(e.appendTo?e.appendTo.offsetHeight:l),j(o.windowStage.FULLSCREEN),a.dispatchEvent(e.onStageChange,t,E(),{state:o.windowStage.FULLSCREEN})},[K,Z,D,C,e.appendTo,e.onStageChange,w,E]),V=u(t=>{t.preventDefault(),c===o.windowStage.FULLSCREEN?(j(o.windowStage.DEFAULT),y(h.current.leftBeforeAction),I(h.current.topBeforeAction),N(h.current.widthBeforeAction),W(h.current.heightBeforeAction)):c===o.windowStage.MINIMIZED&&(j(o.windowStage.DEFAULT),W(h.current.heightBeforeAction)),a.dispatchEvent(e.onStageChange,t,E(),{state:o.windowStage.DEFAULT})},[c,e.onStageChange,E]),ve=u(t=>{t.preventDefault(),a.dispatchEvent(e.onClose,t,E(),{state:void 0})},[e.onClose,E]),it=u(t=>{c===o.windowStage.FULLSCREEN||c===o.windowStage.MINIMIZED?V(t):de(t)},[c,V,de]),ot=u((t,n)=>{var Ue,xe,ke,Oe,ze,_e;const{props:r,width:l,height:d,top:f,left:m}=_.current,s=r.appendTo?t.pageX-O.current.x:t.pageX,L=r.appendTo?t.pageY-O.current.y:t.pageY,le=(xe=d!=null?d:(Ue=R.current)==null?void 0:Ue.clientHeight)!=null?xe:0,Y=A||se,$=k||we,J=f-L,He=m-s,Fe=s-m,Ne=L-f;let Q=!1;const g={isDragging:!n.end};n.direction.indexOf("n")>=0&&$-(le+J)<0&&(f>0&&(g.height=le+J),g.top=L,Q=!0),n.direction.indexOf("s")>=0&&$-Ne<0&&(g.height=Ne,Q=!0),n.direction.indexOf("w")>=0&&Y-(l+He)<0&&(m>0&&(g.width=l+He),g.left=s,Q=!0),n.direction.indexOf("e")>=0&&Y-Fe<0&&(g.width=Fe,Q=!0),Q&&(g.height!==void 0&&W(g.height),g.top!==void 0&&I(g.top),g.width!==void 0&&N(g.width),g.left!==void 0&&y(g.left),g.isDragging!==void 0&&ne(g.isDragging)),v(r.onResize,t,!0,n.end,{left:(ke=g.left)!=null?ke:m,top:(Oe=g.top)!=null?Oe:f},{width:(ze=g.width)!=null?ze:l,height:(_e=g.height)!=null?_e:d})},[v]),Ae=u(()=>{if(c===o.windowStage.FULLSCREEN){const t=w(),n=t?t.innerWidth:0,r=t?t.innerHeight:0;N(e.appendTo?e.appendTo.offsetWidth:n),W(e.appendTo?e.appendTo.offsetHeight:r)}},[c,e.appendTo,w]);U(()=>{const t=R.current;t&&Xe&&t.focus({preventScroll:!0});const n=w();n&&n.addEventListener("resize",Ae),j(e.stage||o.windowStage.DEFAULT),ne(!1),I(Le()),y(be()),N(Ie()),W(ye()),ge(!0),Se(Ke.getMaxZIndex(P,M(),ce)),h.current={leftBeforeAction:be(),topBeforeAction:Le(),widthBeforeAction:Ie(),heightBeforeAction:ye()};const r=M();if(e.appendTo&&r){const l=e.appendTo.getBoundingClientRect(),d=r.body.getBoundingClientRect();O.current.x=l.left-d.left,O.current.y=l.top-d.top}return()=>{var d;const l=w();l&&l.removeEventListener("resize",Ae),G.current&&a.canUseDOM&&(document.contains(G.current)?G.current.focus({preventScroll:!0}):G.current.id&&((d=document.getElementById(G.current.id))==null||d.focus({preventScroll:!0})))}},[]),U(()=>{e.left!==void 0&&!X&&y(e.left)},[e.left,X]),U(()=>{e.top!==void 0&&!X&&I(e.top)},[e.top,X]),U(()=>{e.initialLeft!==void 0&&y(e.initialLeft)},[e.initialLeft]),U(()=>{e.initialTop!==void 0&&I(e.initialTop)},[e.initialTop]),U(()=>{const t=M();if(e.appendTo&&t){const n=e.appendTo.getBoundingClientRect(),r=t.body.getBoundingClientRect();O.current.x=n.left-r.left,O.current.y=n.top-r.top}},[e.appendTo,M]),st(S,()=>({get element(){return R.current},get windowElement(){return R.current},get draggable(){return De.current},props:e}),[e]);const Be=T.Children.toArray(e.children),at=$e(Be),rt=Ye(Be),ct=a.classNames("k-window",e.className,{[`k-window-${e.themeColor}`]:e.themeColor,"k-window-minimized":c==="MINIMIZED","k-focus":Ve}),Re=T.createElement(a.ZIndexContext.Provider,{value:P},T.createElement(T.Fragment,null,fe&&T.createElement("div",{className:"k-overlay",style:{zIndex:P,...e.overlayStyle}}),T.createElement("div",{id:e.id,[p.DATA_DIALOGS_ID]:ce,tabIndex:0,role:"dialog","aria-labelledby":Ce.current,onFocus:tt,onBlur:nt,onKeyDown:Je,ref:R,className:ct,style:{top:Z,left:K,width:D,height:C||"",zIndex:P,...e.style}},T.createElement(gt.MiddleLayerOptimization,{shouldUpdateOnDrag:e.shouldUpdateOnDrag||!1,isDragging:X},T.createElement(a.Draggable,{onPress:Qe,onDrag:pe,onRelease:et,autoScroll:!1,ref:De},T.createElement(ut.WindowTitleBar,{stage:c,onDoubleClick:je?it:void 0,onMinimizeButtonClick:We,onFullScreenButtonClick:de,onRestoreButtonClick:V,onCloseButtonClick:ve,closeButton:e.closeButton,minimizeButton:e.minimizeButton,maximizeButton:e.maximizeButton,restoreButton:e.restoreButton,id:Ce.current},e.title)),c===o.windowStage.MINIMIZED?null:T.createElement(T.Fragment,null,T.createElement("div",{className:"k-window-content"},at),rt),c===o.windowStage.DEFAULT&&ue?T.createElement(ft.ResizeHandlers,{onResize:ot}):null))));return a.canUseDOM?e.appendTo===null?Re:ht.createPortal(Re,e.appendTo||document.body):null});Ee.displayName="Window";const qe=a.createPropsContext(),Te=a.withIdHOC(a.withPropsContext(qe,Ee));Te.displayName="KendoReactWindow";const Tt={autoFocus:i.bool,title:i.any,className:i.string,closeButton:i.func,minimizeButton:i.func,maximizeButton:i.func,restoreButton:i.func,modal:i.bool,overlayStyle:i.object,width:i.number,height:i.number,minWidth:i.number,minHeight:i.number,left:i.number,top:i.number,initialLeft:i.number,initialTop:i.number,initialWidth:i.number,initialHeight:i.number,resizable:i.bool,draggable:i.bool,doubleClickStageChange:i.bool,stage:i.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),onClose:i.func,onMove:i.func,onResize:i.func,onStageChange:i.func,children:i.node,id:i.string,dir:i.string,style:i.object,appendTo:i.any,themeColor:i.oneOf(["primary","dark","light"]),shouldUpdateOnDrag:i.bool};Te.propTypes=Tt;exports.Window=Te;exports.WindowPropsContext=qe;exports.WindowWithoutContext=Ee;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const dt=require("react"),lt=require("react-dom"),i=require("prop-types"),ut=require("./WindowTitlebar.js"),a=require("@progress/kendo-react-common"),ft=require("./WindowResizeHandlers.js"),gt=require("./MiddleLayerOptimization.js"),o=require("./StageEnum.js"),Ze=require("./WindowActionsBar.js"),ee=require("./constants.js"),Ke=require("./utils.js");function Pe(e){const C=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const R in e)if(R!=="default"){const _=Object.getOwnPropertyDescriptor(e,R);Object.defineProperty(C,R,_.get?_:{enumerable:!0,get:()=>e[R]})}}return C.default=e,Object.freeze(C)}const m=Pe(dt),ht=Pe(lt),{useState:N,useEffect:O,useCallback:u,useMemo:X,useRef:U,useImperativeHandle:st,useContext:wt,forwardRef:Et}=m,te=300,ne=300,se=120,we=100,y=5,z={minWidth:se,minHeight:we,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},Ee=Et((e,C)=>{var Me;const{minWidth:R=z.minWidth,minHeight:_=z.minHeight,resizable:ue=z.resizable,draggable:me=z.draggable,modal:fe=z.modal,doubleClickStageChange:je=z.doubleClickStageChange,autoFocus:Xe=z.autoFocus}=e,[Ge,G]=N(e.stage||o.windowStage.DEFAULT),[V,ie]=N(!1),[oe,W]=N(0),[ae,v]=N(0),[re,x]=N(te),[ce,A]=N(ne),[Ve,ge]=N(!0),[he,Se]=N(ee.DEFAULT_DIALOGS_ZINDEX),c=(Me=e.stage)!=null?Me:Ge,M=wt(a.ZIndexContext),H=U(null),De=U(null),h=U({leftBeforeAction:0,topBeforeAction:0,widthBeforeAction:te,heightBeforeAction:ne}),Z=U({x:0,y:0}),K=U(void 0),Y=U(a.canUseDOM?document.activeElement:null),Ce=U("window-title-"+(e.id?e.id+"-accessibility-id":"")),k=U({left:0,top:0,width:te,height:ne,internalLeft:ae,internalTop:oe,internalWidth:re,internalHeight:ce,stage:c,draggable:me,props:e}),F=u(()=>{const t=a.canUseDOM?document:null;return e.appendTo?e.appendTo.ownerDocument:t},[e.appendTo]),s=u(()=>{const t=F();return t==null?void 0:t.defaultView},[F]),P=X(()=>{var t;return c!==o.windowStage.FULLSCREEN?Math.max((t=e.top)!=null?t:oe,0):0},[c,e.top,oe]),q=X(()=>{var t;return c!==o.windowStage.FULLSCREEN?Math.max((t=e.left)!=null?t:ae,0):0},[c,e.left,ae]),L=X(()=>{var n;const t=(n=e.width)!=null?n:re;if(c===o.windowStage.FULLSCREEN){if(e.appendTo)return e.appendTo.offsetWidth;const r=s();return r?r.innerWidth:0}return t},[c,e.width,e.appendTo,re,s]),b=X(()=>{const t=e.height===void 0?ce:e.height;if(c===o.windowStage.FULLSCREEN){if(e.appendTo)return e.appendTo.offsetHeight;const n=s();return n?n.innerHeight:0}else if(c===o.windowStage.MINIMIZED)return 0;return t},[c,e.height,e.appendTo,ce,s]),de=X(()=>e.id?e.id+"-accessibility-id":void 0,[e.id]);O(()=>{k.current={left:q,top:P,width:L,height:b,internalLeft:ae,internalTop:oe,internalWidth:re,internalHeight:ce,stage:c,draggable:me,props:e}});const j=X(()=>{if(M===void 0)return M!=null?M:ee.DEFAULT_DIALOGS_ZINDEX;const t=M?M+ee.ZINDEX_DIALOGS_STEP:0;return he>t?he:M+ee.ZINDEX_DIALOGS_STEP},[he,M]),Le=u(()=>{var r,l;if(e.top!==void 0)return e.top;if(e.initialTop!==void 0)return e.initialTop;let t=ne;if(e.height!==void 0?t=e.height:e.initialHeight!==void 0&&(t=e.initialHeight),e.appendTo&&t)return e.appendTo.offsetHeight/2-t/2;const n=s();return n?n.innerHeight/2-((l=t!=null?t:(r=H.current)==null?void 0:r.clientHeight)!=null?l:0)/2:0},[e.top,e.initialTop,e.height,e.initialHeight,e.appendTo,s]),be=u(()=>{if(e.left!==void 0)return e.left;if(e.initialLeft!==void 0)return e.initialLeft;let t=te;if(e.width!==void 0?t=e.width:e.initialWidth!==void 0&&(t=e.initialWidth),e.appendTo)return e.appendTo.offsetWidth/2-t/2;const n=s();return n?n.innerWidth/2-t/2:0},[e.left,e.initialLeft,e.width,e.initialWidth,e.appendTo,s]),Ie=u(()=>{let t=te;return e.width!==void 0?t=e.width:e.initialWidth!==void 0&&(t=e.initialWidth),t},[e.width,e.initialWidth]),ye=u(()=>{let t=ne;return e.height!==void 0?t=e.height:e.initialHeight!==void 0&&(t=e.initialHeight),t},[e.height,e.initialHeight]),Ye=u(t=>t.filter(n=>(n==null?void 0:n.type)===Ze.WindowActionsBar),[]),$e=u(t=>t.filter(n=>n&&n.type!==Ze.WindowActionsBar),[]),w=u(()=>typeof C=="object"&&C!==null&&"current"in C?C.current:null,[C]),B=u((t,n,r,l,d,f)=>{var D,J,Q;if(!t)return;const{internalLeft:S,internalTop:E,internalWidth:T,internalHeight:I}=k.current;t({nativeEvent:n.nativeEvent?n.nativeEvent:n.originalEvent,drag:r,end:l,target:w(),left:(D=d==null?void 0:d.left)!=null?D:S,top:(J=d==null?void 0:d.top)!=null?J:E,width:(Q=f==null?void 0:f.width)!=null?Q:T,height:(f==null?void 0:f.height)===void 0?I:f==null?void 0:f.height})},[w]),Je=u(t=>{var f,S;if(fe&&a.keepFocusInContainer(t,H.current),t.target!==t.currentTarget)return;const n=R||se,r=_||we,l=t.metaKey||t.ctrlKey,d=(S=b!=null?b:(f=H.current)==null?void 0:f.clientHeight)!=null?S:0;if(l&&ue){switch(t.keyCode){case a.Keys.up:t.preventDefault(),r<=d-y&&A(d-y);break;case a.Keys.down:t.preventDefault(),A(d+y);break;case a.Keys.left:n<=L-y&&x(L-y);break;case a.Keys.right:x(L+y);break;default:return}B(e.onResize,t,!1,void 0);return}if(t.altKey){switch(t.keyCode){case a.Keys.up:c===o.windowStage.MINIMIZED?($(t),a.dispatchEvent(e.onStageChange,t,w(),{state:o.windowStage.DEFAULT})):c===o.windowStage.DEFAULT&&(le(t),a.dispatchEvent(e.onStageChange,t,w(),{state:o.windowStage.FULLSCREEN}));break;case a.Keys.down:c===o.windowStage.FULLSCREEN?($(t),a.dispatchEvent(e.onStageChange,t,w(),{state:o.windowStage.DEFAULT})):c===o.windowStage.DEFAULT&&(We(t),a.dispatchEvent(e.onStageChange,t,w(),{state:o.windowStage.MINIMIZED}));break}return}if(!t.ctrlKey){const{internalLeft:E,internalTop:T}=k.current;let I=E,D=T;switch(t.keyCode){case a.Keys.esc:e.onClose&&ve(t);return;case a.Keys.up:D=T-y,W(D);break;case a.Keys.down:D=T+y,W(D);break;case a.Keys.left:I=E-y,v(I);break;case a.Keys.right:I=E+y,v(I);break;default:return}B(e.onMove,t,!1,void 0,{left:I,top:D})}},[fe,R,_,ue,e.onResize,e.onStageChange,e.onClose,e.onMove,b,L,c,B,w]),Qe=u(t=>{const n=t.event,{left:r,top:l}=k.current;h.current.differenceLeft=n.pageX-r,h.current.differenceTop=n.pageY-l},[]),pe=u(t=>{const n=t.event;n.originalEvent.preventDefault();const{stage:r,draggable:l,props:d,width:f,height:S}=k.current;if(r!==o.windowStage.FULLSCREEN&&l){const E=Math.max(n.pageY-(h.current.differenceTop||0),0),T=n.pageX-(h.current.differenceLeft||0);W(E),v(T),ie(!0),d.onMove&&B(d.onMove,n,!0,!1,{left:T,top:E},{width:f,height:S})}},[B]),et=u(t=>{const n=t.event,{stage:r,draggable:l,props:d,left:f,top:S,width:E,height:T}=k.current;r!==o.windowStage.FULLSCREEN&&l&&d.onMove&&B(d.onMove,n,!0,!0,{left:f,top:S},{width:E,height:T}),ie(!1)},[B]),tt=u(()=>{K.current?(clearTimeout(K.current),K.current=void 0):(ge(!0),Se(Ke.getMaxZIndex(j,F(),de)))},[j,F,de]),nt=u(()=>{clearTimeout(K.current);const t=s();t&&(K.current=t.setTimeout(()=>{ge(!1),K.current=void 0}))},[s]),We=u(t=>{t.preventDefault(),h.current.leftBeforeAction=q,h.current.topBeforeAction=P,h.current.widthBeforeAction=L,h.current.heightBeforeAction=b,G(o.windowStage.MINIMIZED),A(0),a.dispatchEvent(e.onStageChange,t,w(),{state:o.windowStage.MINIMIZED})},[q,P,L,b,e.onStageChange,w]),le=u(t=>{t.preventDefault(),h.current.leftBeforeAction=q,h.current.topBeforeAction=P,h.current.widthBeforeAction=L,h.current.heightBeforeAction=b;const n=s(),r=n?n.innerWidth:0,l=n?n.innerHeight:0;v(0),W(0),x(e.appendTo?e.appendTo.offsetWidth:r),A(e.appendTo?e.appendTo.offsetHeight:l),G(o.windowStage.FULLSCREEN),a.dispatchEvent(e.onStageChange,t,w(),{state:o.windowStage.FULLSCREEN})},[q,P,L,b,e.appendTo,e.onStageChange,s,w]),$=u(t=>{t.preventDefault(),c===o.windowStage.FULLSCREEN?(G(o.windowStage.DEFAULT),v(h.current.leftBeforeAction),W(h.current.topBeforeAction),x(h.current.widthBeforeAction),A(h.current.heightBeforeAction)):c===o.windowStage.MINIMIZED&&(G(o.windowStage.DEFAULT),A(h.current.heightBeforeAction)),a.dispatchEvent(e.onStageChange,t,w(),{state:o.windowStage.DEFAULT})},[c,e.onStageChange,w]),ve=u(t=>{t.preventDefault(),a.dispatchEvent(e.onClose,t,w(),{state:void 0})},[e.onClose,w]),it=u(t=>{c===o.windowStage.FULLSCREEN||c===o.windowStage.MINIMIZED?$(t):le(t)},[c,$,le]),ot=u((t,n)=>{var Ue,xe,ke,Oe,ze,_e;const{props:r,width:l,height:d,top:f,left:S}=k.current,E=r.appendTo?t.pageX-Z.current.x:t.pageX,T=r.appendTo?t.pageY-Z.current.y:t.pageY,I=(xe=d!=null?d:(Ue=H.current)==null?void 0:Ue.clientHeight)!=null?xe:0,D=R||se,J=_||we,Q=f-T,He=S-E,Fe=E-S,Ne=T-f;let p=!1;const g={isDragging:!n.end};n.direction.indexOf("n")>=0&&J-(I+Q)<0&&(f>0&&(g.height=I+Q),g.top=T,p=!0),n.direction.indexOf("s")>=0&&J-Ne<0&&(g.height=Ne,p=!0),n.direction.indexOf("w")>=0&&D-(l+He)<0&&(S>0&&(g.width=l+He),g.left=E,p=!0),n.direction.indexOf("e")>=0&&D-Fe<0&&(g.width=Fe,p=!0),p&&(g.height!==void 0&&A(g.height),g.top!==void 0&&W(g.top),g.width!==void 0&&x(g.width),g.left!==void 0&&v(g.left),g.isDragging!==void 0&&ie(g.isDragging)),B(r.onResize,t,!0,n.end,{left:(ke=g.left)!=null?ke:S,top:(Oe=g.top)!=null?Oe:f},{width:(ze=g.width)!=null?ze:l,height:(_e=g.height)!=null?_e:d})},[B]),Ae=u(()=>{if(c===o.windowStage.FULLSCREEN){const t=s(),n=t?t.innerWidth:0,r=t?t.innerHeight:0;x(e.appendTo?e.appendTo.offsetWidth:n),A(e.appendTo?e.appendTo.offsetHeight:r)}},[c,e.appendTo,s]);O(()=>{const t=H.current;t&&Xe&&t.focus({preventScroll:!0});const n=s();n&&n.addEventListener("resize",Ae),G(e.stage||o.windowStage.DEFAULT),ie(!1),W(Le()),v(be()),x(Ie()),A(ye()),ge(!0),Se(Ke.getMaxZIndex(j,F(),de)),h.current={leftBeforeAction:be(),topBeforeAction:Le(),widthBeforeAction:Ie(),heightBeforeAction:ye()};const r=F();if(e.appendTo&&r){const l=e.appendTo.getBoundingClientRect(),d=r.body.getBoundingClientRect();Z.current.x=l.left-d.left,Z.current.y=l.top-d.top}return()=>{var d;const l=s();l&&l.removeEventListener("resize",Ae),Y.current&&a.canUseDOM&&(document.contains(Y.current)?Y.current.focus({preventScroll:!0}):Y.current.id&&((d=document.getElementById(Y.current.id))==null||d.focus({preventScroll:!0})))}},[]),O(()=>{e.left!==void 0&&!V&&v(e.left)},[e.left,V]),O(()=>{e.top!==void 0&&!V&&W(e.top)},[e.top,V]),O(()=>{e.initialLeft!==void 0&&v(e.initialLeft)},[e.initialLeft]),O(()=>{e.initialTop!==void 0&&W(e.initialTop)},[e.initialTop]),O(()=>{const t=F();if(e.appendTo&&t){const n=e.appendTo.getBoundingClientRect(),r=t.body.getBoundingClientRect();Z.current.x=n.left-r.left,Z.current.y=n.top-r.top}},[e.appendTo,F]),st(C,()=>({get element(){return H.current},get windowElement(){return H.current},get draggable(){return De.current},props:e}),[e]);const Be=m.Children.toArray(e.children),at=$e(Be),rt=Ye(Be),ct=a.classNames("k-window",e.className,{[`k-window-${e.themeColor}`]:e.themeColor,"k-window-minimized":c==="MINIMIZED","k-focus":Ve}),Re=m.createElement(a.ZIndexContext.Provider,{value:j},m.createElement(m.Fragment,null,fe&&m.createElement("div",{className:"k-overlay",style:{zIndex:j,...e.overlayStyle}}),m.createElement("div",{id:e.id,[ee.DATA_DIALOGS_ID]:de,tabIndex:0,role:"dialog","aria-labelledby":Ce.current,onFocus:tt,onBlur:nt,onKeyDown:Je,ref:H,className:ct,style:{top:P,left:q,width:L,height:b||"",zIndex:j,...e.style}},m.createElement(gt.MiddleLayerOptimization,{shouldUpdateOnDrag:e.shouldUpdateOnDrag||!1,isDragging:V},m.createElement(a.Draggable,{onPress:Qe,onDrag:pe,onRelease:et,autoScroll:!1,ref:De},m.createElement(ut.WindowTitleBar,{stage:c,onDoubleClick:je?it:void 0,onMinimizeButtonClick:We,onFullScreenButtonClick:le,onRestoreButtonClick:$,onCloseButtonClick:ve,closeButton:e.closeButton,minimizeButton:e.minimizeButton,maximizeButton:e.maximizeButton,restoreButton:e.restoreButton,id:Ce.current},e.title)),c===o.windowStage.MINIMIZED?null:m.createElement(m.Fragment,null,m.createElement("div",{className:"k-window-content"},at),rt),c===o.windowStage.DEFAULT&&ue?m.createElement(ft.ResizeHandlers,{onResize:ot}):null))));return a.canUseDOM?e.appendTo===null?Re:ht.createPortal(Re,e.appendTo||document.body):null});Ee.displayName="Window";const qe=a.createPropsContext(),Te=a.withIdHOC(a.withPropsContext(qe,Ee));Te.displayName="KendoReactWindow";const Tt={autoFocus:i.bool,title:i.any,className:i.string,closeButton:i.func,minimizeButton:i.func,maximizeButton:i.func,restoreButton:i.func,modal:i.bool,overlayStyle:i.object,width:i.number,height:i.number,minWidth:i.number,minHeight:i.number,left:i.number,top:i.number,initialLeft:i.number,initialTop:i.number,initialWidth:i.number,initialHeight:i.number,resizable:i.bool,draggable:i.bool,doubleClickStageChange:i.bool,stage:i.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),onClose:i.func,onMove:i.func,onResize:i.func,onStageChange:i.func,children:i.node,id:i.string,dir:i.string,style:i.object,appendTo:i.any,themeColor:i.oneOf(["primary","dark","light"]),shouldUpdateOnDrag:i.bool};Te.propTypes=Tt;exports.Window=Te;exports.WindowPropsContext=qe;exports.WindowWithoutContext=Ee;
|
package/Window.mjs
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as T from "react";
|
|
9
9
|
import * as ut from "react-dom";
|
|
10
10
|
import i from "prop-types";
|
|
11
11
|
import { WindowTitleBar as ft } from "./WindowTitlebar.mjs";
|
|
12
|
-
import { withIdHOC as ht, withPropsContext as gt, createPropsContext as st, ZIndexContext as Ze, canUseDOM as le, keepFocusInContainer as mt, Keys as
|
|
12
|
+
import { withIdHOC as ht, withPropsContext as gt, createPropsContext as st, ZIndexContext as Ze, canUseDOM as le, keepFocusInContainer as mt, Keys as L, dispatchEvent as F, classNames as wt, Draggable as Tt } from "@progress/kendo-react-common";
|
|
13
13
|
import { ResizeHandlers as Et } from "./WindowResizeHandlers.mjs";
|
|
14
14
|
import { MiddleLayerOptimization as Ct } from "./MiddleLayerOptimization.mjs";
|
|
15
15
|
import { windowStage as o } from "./StageEnum.mjs";
|
|
16
16
|
import { WindowActionsBar as _e } from "./WindowActionsBar.mjs";
|
|
17
17
|
import { DEFAULT_DIALOGS_ZINDEX as Pe, ZINDEX_DIALOGS_STEP as Ke, DATA_DIALOGS_ID as Lt } from "./constants.mjs";
|
|
18
18
|
import { getMaxZIndex as Xe } from "./utils.mjs";
|
|
19
|
-
const { useState:
|
|
19
|
+
const { useState: M, useEffect: x, useCallback: d, useMemo: G, useRef: N, useImperativeHandle: Dt, useContext: It, forwardRef: bt } = T, p = 300, ee = 300, me = 120, we = 100, W = 5, z = {
|
|
20
20
|
minWidth: me,
|
|
21
21
|
minHeight: we,
|
|
22
22
|
resizable: !0,
|
|
@@ -24,204 +24,207 @@ const { useState: H, useEffect: N, useCallback: d, useMemo: K, useRef: F, useImp
|
|
|
24
24
|
modal: !1,
|
|
25
25
|
doubleClickStageChange: !0,
|
|
26
26
|
autoFocus: !0
|
|
27
|
-
}, Ge = bt((e,
|
|
27
|
+
}, Ge = bt((e, O) => {
|
|
28
28
|
var ve;
|
|
29
29
|
const {
|
|
30
|
-
minWidth: de =
|
|
31
|
-
minHeight: ue =
|
|
32
|
-
resizable: fe =
|
|
33
|
-
draggable: Te =
|
|
34
|
-
modal: he =
|
|
35
|
-
doubleClickStageChange: Ye =
|
|
36
|
-
autoFocus: je =
|
|
37
|
-
} = e, [$e,
|
|
30
|
+
minWidth: de = z.minWidth,
|
|
31
|
+
minHeight: ue = z.minHeight,
|
|
32
|
+
resizable: fe = z.resizable,
|
|
33
|
+
draggable: Te = z.draggable,
|
|
34
|
+
modal: he = z.modal,
|
|
35
|
+
doubleClickStageChange: Ye = z.doubleClickStageChange,
|
|
36
|
+
autoFocus: je = z.autoFocus
|
|
37
|
+
} = e, [$e, V] = M(e.stage || o.DEFAULT), [Y, te] = M(!1), [ne, S] = M(0), [ie, y] = M(0), [oe, U] = M(p), [re, A] = M(ee), [qe, ge] = M(!0), [se, Ee] = M(Pe), a = (ve = e.stage) != null ? ve : $e, R = It(Ze), v = N(null), Ce = N(null), h = N({
|
|
38
38
|
leftBeforeAction: 0,
|
|
39
39
|
topBeforeAction: 0,
|
|
40
|
-
widthBeforeAction:
|
|
41
|
-
heightBeforeAction:
|
|
42
|
-
}),
|
|
40
|
+
widthBeforeAction: p,
|
|
41
|
+
heightBeforeAction: ee
|
|
42
|
+
}), Z = N({ x: 0, y: 0 }), _ = N(void 0), j = N(
|
|
43
43
|
le ? document.activeElement : null
|
|
44
|
-
), Le =
|
|
44
|
+
), Le = N("window-title-" + (e.id ? e.id + "-accessibility-id" : "")), k = N({
|
|
45
45
|
left: 0,
|
|
46
46
|
top: 0,
|
|
47
|
-
width:
|
|
48
|
-
height:
|
|
49
|
-
internalLeft:
|
|
50
|
-
internalTop:
|
|
51
|
-
internalWidth:
|
|
52
|
-
internalHeight:
|
|
47
|
+
width: p,
|
|
48
|
+
height: ee,
|
|
49
|
+
internalLeft: ie,
|
|
50
|
+
internalTop: ne,
|
|
51
|
+
internalWidth: oe,
|
|
52
|
+
internalHeight: re,
|
|
53
53
|
stage: a,
|
|
54
54
|
draggable: Te,
|
|
55
55
|
props: e
|
|
56
|
-
}),
|
|
56
|
+
}), H = d(() => {
|
|
57
57
|
const t = le ? document : null;
|
|
58
58
|
return e.appendTo ? e.appendTo.ownerDocument : t;
|
|
59
|
-
}, [e.appendTo]),
|
|
60
|
-
const t =
|
|
59
|
+
}, [e.appendTo]), g = d(() => {
|
|
60
|
+
const t = H();
|
|
61
61
|
return t == null ? void 0 : t.defaultView;
|
|
62
|
-
}, [
|
|
62
|
+
}, [H]), P = G(() => {
|
|
63
63
|
var t;
|
|
64
|
-
return a !== o.FULLSCREEN ? Math.max((t = e.top) != null ? t :
|
|
65
|
-
}, [a, e.top,
|
|
64
|
+
return a !== o.FULLSCREEN ? Math.max((t = e.top) != null ? t : ne, 0) : 0;
|
|
65
|
+
}, [a, e.top, ne]), K = G(() => {
|
|
66
66
|
var t;
|
|
67
|
-
return a !== o.FULLSCREEN ? Math.max((t = e.left) != null ? t :
|
|
68
|
-
}, [a, e.left,
|
|
67
|
+
return a !== o.FULLSCREEN ? Math.max((t = e.left) != null ? t : ie, 0) : 0;
|
|
68
|
+
}, [a, e.left, ie]), D = G(() => {
|
|
69
69
|
var n;
|
|
70
|
-
const t = (n = e.width) != null ? n :
|
|
70
|
+
const t = (n = e.width) != null ? n : oe;
|
|
71
71
|
if (a === o.FULLSCREEN) {
|
|
72
72
|
if (e.appendTo)
|
|
73
73
|
return e.appendTo.offsetWidth;
|
|
74
|
-
const r =
|
|
74
|
+
const r = g();
|
|
75
75
|
return r ? r.innerWidth : 0;
|
|
76
76
|
}
|
|
77
77
|
return t;
|
|
78
|
-
}, [a, e.width, e.appendTo,
|
|
79
|
-
const t = e.height === void 0 ?
|
|
78
|
+
}, [a, e.width, e.appendTo, oe, g]), I = G(() => {
|
|
79
|
+
const t = e.height === void 0 ? re : e.height;
|
|
80
80
|
if (a === o.FULLSCREEN) {
|
|
81
81
|
if (e.appendTo)
|
|
82
82
|
return e.appendTo.offsetHeight;
|
|
83
|
-
const n =
|
|
83
|
+
const n = g();
|
|
84
84
|
return n ? n.innerHeight : 0;
|
|
85
85
|
} else if (a === o.MINIMIZED)
|
|
86
86
|
return 0;
|
|
87
87
|
return t;
|
|
88
|
-
}, [a, e.height, e.appendTo,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
left:
|
|
92
|
-
top:
|
|
93
|
-
width:
|
|
94
|
-
height:
|
|
95
|
-
internalLeft:
|
|
96
|
-
internalTop:
|
|
97
|
-
internalWidth:
|
|
98
|
-
internalHeight:
|
|
88
|
+
}, [a, e.height, e.appendTo, re, g]), ae = G(() => e.id ? e.id + "-accessibility-id" : void 0, [e.id]);
|
|
89
|
+
x(() => {
|
|
90
|
+
k.current = {
|
|
91
|
+
left: K,
|
|
92
|
+
top: P,
|
|
93
|
+
width: D,
|
|
94
|
+
height: I,
|
|
95
|
+
internalLeft: ie,
|
|
96
|
+
internalTop: ne,
|
|
97
|
+
internalWidth: oe,
|
|
98
|
+
internalHeight: re,
|
|
99
99
|
stage: a,
|
|
100
100
|
draggable: Te,
|
|
101
101
|
props: e
|
|
102
102
|
};
|
|
103
103
|
});
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
return
|
|
107
|
-
const t =
|
|
108
|
-
return se > t ? se :
|
|
109
|
-
}, [se,
|
|
104
|
+
const X = G(() => {
|
|
105
|
+
if (R === void 0)
|
|
106
|
+
return R != null ? R : Pe;
|
|
107
|
+
const t = R ? R + Ke : 0;
|
|
108
|
+
return se > t ? se : R + Ke;
|
|
109
|
+
}, [se, R]), De = d(() => {
|
|
110
110
|
var r, l;
|
|
111
111
|
if (e.top !== void 0)
|
|
112
112
|
return e.top;
|
|
113
113
|
if (e.initialTop !== void 0)
|
|
114
114
|
return e.initialTop;
|
|
115
|
-
let t =
|
|
115
|
+
let t = ee;
|
|
116
116
|
if (e.height !== void 0 ? t = e.height : e.initialHeight !== void 0 && (t = e.initialHeight), e.appendTo && t)
|
|
117
117
|
return e.appendTo.offsetHeight / 2 - t / 2;
|
|
118
|
-
const n =
|
|
119
|
-
return n ? n.innerHeight / 2 - ((l = t != null ? t : (r =
|
|
120
|
-
}, [e.top, e.initialTop, e.height, e.initialHeight, e.appendTo,
|
|
118
|
+
const n = g();
|
|
119
|
+
return n ? n.innerHeight / 2 - ((l = t != null ? t : (r = v.current) == null ? void 0 : r.clientHeight) != null ? l : 0) / 2 : 0;
|
|
120
|
+
}, [e.top, e.initialTop, e.height, e.initialHeight, e.appendTo, g]), Ie = d(() => {
|
|
121
121
|
if (e.left !== void 0)
|
|
122
122
|
return e.left;
|
|
123
123
|
if (e.initialLeft !== void 0)
|
|
124
124
|
return e.initialLeft;
|
|
125
|
-
let t =
|
|
125
|
+
let t = p;
|
|
126
126
|
if (e.width !== void 0 ? t = e.width : e.initialWidth !== void 0 && (t = e.initialWidth), e.appendTo)
|
|
127
127
|
return e.appendTo.offsetWidth / 2 - t / 2;
|
|
128
|
-
const n =
|
|
128
|
+
const n = g();
|
|
129
129
|
return n ? n.innerWidth / 2 - t / 2 : 0;
|
|
130
|
-
}, [e.left, e.initialLeft, e.width, e.initialWidth, e.appendTo,
|
|
131
|
-
let t =
|
|
130
|
+
}, [e.left, e.initialLeft, e.width, e.initialWidth, e.appendTo, g]), be = d(() => {
|
|
131
|
+
let t = p;
|
|
132
132
|
return e.width !== void 0 ? t = e.width : e.initialWidth !== void 0 && (t = e.initialWidth), t;
|
|
133
133
|
}, [e.width, e.initialWidth]), We = d(() => {
|
|
134
|
-
let t =
|
|
134
|
+
let t = ee;
|
|
135
135
|
return e.height !== void 0 ? t = e.height : e.initialHeight !== void 0 && (t = e.initialHeight), t;
|
|
136
|
-
}, [e.height, e.initialHeight]), Je = d((t) => t.filter((n) => (n == null ? void 0 : n.type) === _e), []), Qe = d((t) => t.filter((n) => n && n.type !== _e), []),
|
|
136
|
+
}, [e.height, e.initialHeight]), Je = d((t) => t.filter((n) => (n == null ? void 0 : n.type) === _e), []), Qe = d((t) => t.filter((n) => n && n.type !== _e), []), s = d(() => typeof O == "object" && O !== null && "current" in O ? O.current : null, [O]), B = d(
|
|
137
137
|
(t, n, r, l, c, u) => {
|
|
138
|
-
var
|
|
138
|
+
var C, q, J;
|
|
139
139
|
if (!t)
|
|
140
140
|
return;
|
|
141
141
|
const {
|
|
142
|
-
internalLeft:
|
|
143
|
-
internalTop:
|
|
144
|
-
internalWidth:
|
|
145
|
-
internalHeight:
|
|
146
|
-
} =
|
|
142
|
+
internalLeft: E,
|
|
143
|
+
internalTop: m,
|
|
144
|
+
internalWidth: w,
|
|
145
|
+
internalHeight: b
|
|
146
|
+
} = k.current;
|
|
147
147
|
t({
|
|
148
148
|
nativeEvent: n.nativeEvent ? n.nativeEvent : n.originalEvent,
|
|
149
149
|
drag: r,
|
|
150
150
|
end: l,
|
|
151
|
-
target:
|
|
152
|
-
left: (
|
|
153
|
-
top: (
|
|
154
|
-
width: (
|
|
155
|
-
height: (u == null ? void 0 : u.height) === void 0 ?
|
|
151
|
+
target: s(),
|
|
152
|
+
left: (C = c == null ? void 0 : c.left) != null ? C : E,
|
|
153
|
+
top: (q = c == null ? void 0 : c.top) != null ? q : m,
|
|
154
|
+
width: (J = u == null ? void 0 : u.width) != null ? J : w,
|
|
155
|
+
height: (u == null ? void 0 : u.height) === void 0 ? b : u == null ? void 0 : u.height
|
|
156
156
|
});
|
|
157
157
|
},
|
|
158
|
-
[
|
|
158
|
+
[s]
|
|
159
159
|
), pe = d(
|
|
160
160
|
(t) => {
|
|
161
|
-
var u,
|
|
162
|
-
if (he && mt(t,
|
|
161
|
+
var u, E;
|
|
162
|
+
if (he && mt(t, v.current), t.target !== t.currentTarget)
|
|
163
163
|
return;
|
|
164
|
-
const n = de || me, r = ue || we, l = t.metaKey || t.ctrlKey, c = (
|
|
164
|
+
const n = de || me, r = ue || we, l = t.metaKey || t.ctrlKey, c = (E = I != null ? I : (u = v.current) == null ? void 0 : u.clientHeight) != null ? E : 0;
|
|
165
165
|
if (l && fe) {
|
|
166
166
|
switch (t.keyCode) {
|
|
167
|
-
case
|
|
168
|
-
t.preventDefault(), r <= c -
|
|
167
|
+
case L.up:
|
|
168
|
+
t.preventDefault(), r <= c - W && A(c - W);
|
|
169
169
|
break;
|
|
170
|
-
case
|
|
171
|
-
t.preventDefault(),
|
|
170
|
+
case L.down:
|
|
171
|
+
t.preventDefault(), A(c + W);
|
|
172
172
|
break;
|
|
173
|
-
case
|
|
174
|
-
n <=
|
|
173
|
+
case L.left:
|
|
174
|
+
n <= D - W && U(D - W);
|
|
175
175
|
break;
|
|
176
|
-
case
|
|
177
|
-
|
|
176
|
+
case L.right:
|
|
177
|
+
U(D + W);
|
|
178
178
|
break;
|
|
179
179
|
default:
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
B(e.onResize, t, !1, void 0);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
if (t.altKey) {
|
|
186
186
|
switch (t.keyCode) {
|
|
187
|
-
case
|
|
188
|
-
a === o.MINIMIZED ? (
|
|
187
|
+
case L.up:
|
|
188
|
+
a === o.MINIMIZED ? ($(t), F(e.onStageChange, t, s(), {
|
|
189
189
|
state: o.DEFAULT
|
|
190
|
-
})) : a === o.DEFAULT && (
|
|
190
|
+
})) : a === o.DEFAULT && (ce(t), F(e.onStageChange, t, s(), {
|
|
191
191
|
state: o.FULLSCREEN
|
|
192
192
|
}));
|
|
193
193
|
break;
|
|
194
|
-
case
|
|
195
|
-
a === o.FULLSCREEN ? (
|
|
194
|
+
case L.down:
|
|
195
|
+
a === o.FULLSCREEN ? ($(t), F(e.onStageChange, t, s(), {
|
|
196
196
|
state: o.DEFAULT
|
|
197
|
-
})) : a === o.DEFAULT && (Se(t),
|
|
197
|
+
})) : a === o.DEFAULT && (Se(t), F(e.onStageChange, t, s(), {
|
|
198
198
|
state: o.MINIMIZED
|
|
199
199
|
}));
|
|
200
200
|
break;
|
|
201
201
|
}
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
|
-
if (!t.ctrlKey)
|
|
204
|
+
if (!t.ctrlKey) {
|
|
205
|
+
const { internalLeft: m, internalTop: w } = k.current;
|
|
206
|
+
let b = m, C = w;
|
|
205
207
|
switch (t.keyCode) {
|
|
206
|
-
case
|
|
208
|
+
case L.esc:
|
|
207
209
|
e.onClose && ye(t);
|
|
208
210
|
return;
|
|
209
|
-
case
|
|
210
|
-
|
|
211
|
+
case L.up:
|
|
212
|
+
C = w - W, S(C);
|
|
211
213
|
break;
|
|
212
|
-
case
|
|
213
|
-
|
|
214
|
+
case L.down:
|
|
215
|
+
C = w + W, S(C);
|
|
214
216
|
break;
|
|
215
|
-
case
|
|
216
|
-
|
|
217
|
+
case L.left:
|
|
218
|
+
b = m - W, y(b);
|
|
217
219
|
break;
|
|
218
|
-
case
|
|
219
|
-
|
|
220
|
+
case L.right:
|
|
221
|
+
b = m + W, y(b);
|
|
220
222
|
break;
|
|
221
223
|
default:
|
|
222
224
|
return;
|
|
223
225
|
}
|
|
224
|
-
|
|
226
|
+
B(e.onMove, t, !1, void 0, { left: b, top: C });
|
|
227
|
+
}
|
|
225
228
|
},
|
|
226
229
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
227
230
|
[
|
|
@@ -233,14 +236,14 @@ const { useState: H, useEffect: N, useCallback: d, useMemo: K, useRef: F, useImp
|
|
|
233
236
|
e.onStageChange,
|
|
234
237
|
e.onClose,
|
|
235
238
|
e.onMove,
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
I,
|
|
240
|
+
D,
|
|
238
241
|
a,
|
|
239
|
-
|
|
240
|
-
|
|
242
|
+
B,
|
|
243
|
+
s
|
|
241
244
|
]
|
|
242
245
|
), et = d((t) => {
|
|
243
|
-
const n = t.event, { left: r, top: l } =
|
|
246
|
+
const n = t.event, { left: r, top: l } = k.current;
|
|
244
247
|
h.current.differenceLeft = n.pageX - r, h.current.differenceTop = n.pageY - l;
|
|
245
248
|
}, []), tt = d(
|
|
246
249
|
(t) => {
|
|
@@ -251,21 +254,21 @@ const { useState: H, useEffect: N, useCallback: d, useMemo: K, useRef: F, useImp
|
|
|
251
254
|
draggable: l,
|
|
252
255
|
props: c,
|
|
253
256
|
width: u,
|
|
254
|
-
height:
|
|
255
|
-
} =
|
|
257
|
+
height: E
|
|
258
|
+
} = k.current;
|
|
256
259
|
if (r !== o.FULLSCREEN && l) {
|
|
257
|
-
const
|
|
258
|
-
|
|
260
|
+
const m = Math.max(n.pageY - (h.current.differenceTop || 0), 0), w = n.pageX - (h.current.differenceLeft || 0);
|
|
261
|
+
S(m), y(w), te(!0), c.onMove && B(
|
|
259
262
|
c.onMove,
|
|
260
263
|
n,
|
|
261
264
|
!0,
|
|
262
265
|
!1,
|
|
263
|
-
{ left:
|
|
264
|
-
{ width: u, height:
|
|
266
|
+
{ left: w, top: m },
|
|
267
|
+
{ width: u, height: E }
|
|
265
268
|
);
|
|
266
269
|
}
|
|
267
270
|
},
|
|
268
|
-
[
|
|
271
|
+
[B]
|
|
269
272
|
), nt = d(
|
|
270
273
|
(t) => {
|
|
271
274
|
const n = t.event, {
|
|
@@ -273,55 +276,55 @@ const { useState: H, useEffect: N, useCallback: d, useMemo: K, useRef: F, useImp
|
|
|
273
276
|
draggable: l,
|
|
274
277
|
props: c,
|
|
275
278
|
left: u,
|
|
276
|
-
top:
|
|
277
|
-
width:
|
|
278
|
-
height:
|
|
279
|
-
} =
|
|
280
|
-
r !== o.FULLSCREEN && l && c.onMove &&
|
|
279
|
+
top: E,
|
|
280
|
+
width: m,
|
|
281
|
+
height: w
|
|
282
|
+
} = k.current;
|
|
283
|
+
r !== o.FULLSCREEN && l && c.onMove && B(
|
|
281
284
|
c.onMove,
|
|
282
285
|
n,
|
|
283
286
|
!0,
|
|
284
287
|
!0,
|
|
285
|
-
{ left: u, top:
|
|
286
|
-
{ width:
|
|
287
|
-
),
|
|
288
|
+
{ left: u, top: E },
|
|
289
|
+
{ width: m, height: w }
|
|
290
|
+
), te(!1);
|
|
288
291
|
},
|
|
289
|
-
[
|
|
292
|
+
[B]
|
|
290
293
|
), it = d(() => {
|
|
291
|
-
|
|
292
|
-
}, [
|
|
293
|
-
clearTimeout(
|
|
294
|
-
const t =
|
|
295
|
-
t && (
|
|
296
|
-
ge(!1),
|
|
294
|
+
_.current ? (clearTimeout(_.current), _.current = void 0) : (ge(!0), Ee(Xe(X, H(), ae)));
|
|
295
|
+
}, [X, H, ae]), ot = d(() => {
|
|
296
|
+
clearTimeout(_.current);
|
|
297
|
+
const t = g();
|
|
298
|
+
t && (_.current = t.setTimeout(() => {
|
|
299
|
+
ge(!1), _.current = void 0;
|
|
297
300
|
}));
|
|
298
|
-
}, [
|
|
301
|
+
}, [g]), Se = d(
|
|
299
302
|
(t) => {
|
|
300
|
-
t.preventDefault(), h.current.leftBeforeAction =
|
|
303
|
+
t.preventDefault(), h.current.leftBeforeAction = K, h.current.topBeforeAction = P, h.current.widthBeforeAction = D, h.current.heightBeforeAction = I, V(o.MINIMIZED), A(0), F(e.onStageChange, t, s(), { state: o.MINIMIZED });
|
|
301
304
|
},
|
|
302
|
-
[
|
|
303
|
-
),
|
|
305
|
+
[K, P, D, I, e.onStageChange, s]
|
|
306
|
+
), ce = d(
|
|
304
307
|
(t) => {
|
|
305
|
-
t.preventDefault(), h.current.leftBeforeAction =
|
|
306
|
-
const n =
|
|
307
|
-
|
|
308
|
+
t.preventDefault(), h.current.leftBeforeAction = K, h.current.topBeforeAction = P, h.current.widthBeforeAction = D, h.current.heightBeforeAction = I;
|
|
309
|
+
const n = g(), r = n ? n.innerWidth : 0, l = n ? n.innerHeight : 0;
|
|
310
|
+
y(0), S(0), U(e.appendTo ? e.appendTo.offsetWidth : r), A(e.appendTo ? e.appendTo.offsetHeight : l), V(o.FULLSCREEN), F(e.onStageChange, t, s(), { state: o.FULLSCREEN });
|
|
308
311
|
},
|
|
309
|
-
[
|
|
310
|
-
),
|
|
312
|
+
[K, P, D, I, e.appendTo, e.onStageChange, g, s]
|
|
313
|
+
), $ = d(
|
|
311
314
|
(t) => {
|
|
312
|
-
t.preventDefault(), a === o.FULLSCREEN ? (
|
|
315
|
+
t.preventDefault(), a === o.FULLSCREEN ? (V(o.DEFAULT), y(h.current.leftBeforeAction), S(h.current.topBeforeAction), U(h.current.widthBeforeAction), A(h.current.heightBeforeAction)) : a === o.MINIMIZED && (V(o.DEFAULT), A(h.current.heightBeforeAction)), F(e.onStageChange, t, s(), { state: o.DEFAULT });
|
|
313
316
|
},
|
|
314
|
-
[a, e.onStageChange,
|
|
317
|
+
[a, e.onStageChange, s]
|
|
315
318
|
), ye = d(
|
|
316
319
|
(t) => {
|
|
317
|
-
t.preventDefault(),
|
|
320
|
+
t.preventDefault(), F(e.onClose, t, s(), { state: void 0 });
|
|
318
321
|
},
|
|
319
|
-
[e.onClose,
|
|
322
|
+
[e.onClose, s]
|
|
320
323
|
), rt = d(
|
|
321
324
|
(t) => {
|
|
322
|
-
a === o.FULLSCREEN || a === o.MINIMIZED ?
|
|
325
|
+
a === o.FULLSCREEN || a === o.MINIMIZED ? $(t) : ce(t);
|
|
323
326
|
},
|
|
324
|
-
[a,
|
|
327
|
+
[a, $, ce]
|
|
325
328
|
), at = d(
|
|
326
329
|
(t, n) => {
|
|
327
330
|
var Ne, Ue, ke, xe, ze, Oe;
|
|
@@ -330,70 +333,70 @@ const { useState: H, useEffect: N, useCallback: d, useMemo: K, useRef: F, useImp
|
|
|
330
333
|
width: l,
|
|
331
334
|
height: c,
|
|
332
335
|
top: u,
|
|
333
|
-
left:
|
|
334
|
-
} =
|
|
335
|
-
let
|
|
336
|
+
left: E
|
|
337
|
+
} = k.current, m = r.appendTo ? t.pageX - Z.current.x : t.pageX, w = r.appendTo ? t.pageY - Z.current.y : t.pageY, b = (Ue = c != null ? c : (Ne = v.current) == null ? void 0 : Ne.clientHeight) != null ? Ue : 0, C = de || me, q = ue || we, J = u - w, He = E - m, Fe = m - E, Me = w - u;
|
|
338
|
+
let Q = !1;
|
|
336
339
|
const f = {
|
|
337
340
|
isDragging: !n.end
|
|
338
341
|
};
|
|
339
|
-
n.direction.indexOf("n") >= 0 &&
|
|
342
|
+
n.direction.indexOf("n") >= 0 && q - (b + J) < 0 && (u > 0 && (f.height = b + J), f.top = w, Q = !0), n.direction.indexOf("s") >= 0 && q - Me < 0 && (f.height = Me, Q = !0), n.direction.indexOf("w") >= 0 && C - (l + He) < 0 && (E > 0 && (f.width = l + He), f.left = m, Q = !0), n.direction.indexOf("e") >= 0 && C - Fe < 0 && (f.width = Fe, Q = !0), Q && (f.height !== void 0 && A(f.height), f.top !== void 0 && S(f.top), f.width !== void 0 && U(f.width), f.left !== void 0 && y(f.left), f.isDragging !== void 0 && te(f.isDragging)), B(
|
|
340
343
|
r.onResize,
|
|
341
344
|
t,
|
|
342
345
|
!0,
|
|
343
346
|
n.end,
|
|
344
|
-
{ left: (ke = f.left) != null ? ke :
|
|
347
|
+
{ left: (ke = f.left) != null ? ke : E, top: (xe = f.top) != null ? xe : u },
|
|
345
348
|
{ width: (ze = f.width) != null ? ze : l, height: (Oe = f.height) != null ? Oe : c }
|
|
346
349
|
);
|
|
347
350
|
},
|
|
348
|
-
[
|
|
351
|
+
[B]
|
|
349
352
|
), Ae = d(() => {
|
|
350
353
|
if (a === o.FULLSCREEN) {
|
|
351
|
-
const t =
|
|
352
|
-
|
|
354
|
+
const t = g(), n = t ? t.innerWidth : 0, r = t ? t.innerHeight : 0;
|
|
355
|
+
U(e.appendTo ? e.appendTo.offsetWidth : n), A(e.appendTo ? e.appendTo.offsetHeight : r);
|
|
353
356
|
}
|
|
354
|
-
}, [a, e.appendTo,
|
|
355
|
-
|
|
356
|
-
const t =
|
|
357
|
+
}, [a, e.appendTo, g]);
|
|
358
|
+
x(() => {
|
|
359
|
+
const t = v.current;
|
|
357
360
|
t && je && t.focus({ preventScroll: !0 });
|
|
358
|
-
const n =
|
|
359
|
-
n && n.addEventListener("resize", Ae),
|
|
361
|
+
const n = g();
|
|
362
|
+
n && n.addEventListener("resize", Ae), V(e.stage || o.DEFAULT), te(!1), S(De()), y(Ie()), U(be()), A(We()), ge(!0), Ee(Xe(X, H(), ae)), h.current = {
|
|
360
363
|
leftBeforeAction: Ie(),
|
|
361
364
|
topBeforeAction: De(),
|
|
362
365
|
widthBeforeAction: be(),
|
|
363
366
|
heightBeforeAction: We()
|
|
364
367
|
};
|
|
365
|
-
const r =
|
|
368
|
+
const r = H();
|
|
366
369
|
if (e.appendTo && r) {
|
|
367
370
|
const l = e.appendTo.getBoundingClientRect(), c = r.body.getBoundingClientRect();
|
|
368
|
-
|
|
371
|
+
Z.current.x = l.left - c.left, Z.current.y = l.top - c.top;
|
|
369
372
|
}
|
|
370
373
|
return () => {
|
|
371
374
|
var c;
|
|
372
|
-
const l =
|
|
373
|
-
l && l.removeEventListener("resize", Ae),
|
|
375
|
+
const l = g();
|
|
376
|
+
l && l.removeEventListener("resize", Ae), j.current && le && (document.contains(j.current) ? j.current.focus({ preventScroll: !0 }) : j.current.id && ((c = document.getElementById(j.current.id)) == null || c.focus({ preventScroll: !0 })));
|
|
374
377
|
};
|
|
375
|
-
}, []),
|
|
376
|
-
e.left !== void 0 && !
|
|
377
|
-
}, [e.left,
|
|
378
|
-
e.top !== void 0 && !
|
|
379
|
-
}, [e.top,
|
|
380
|
-
e.initialLeft !== void 0 &&
|
|
381
|
-
}, [e.initialLeft]),
|
|
382
|
-
e.initialTop !== void 0 &&
|
|
383
|
-
}, [e.initialTop]),
|
|
384
|
-
const t =
|
|
378
|
+
}, []), x(() => {
|
|
379
|
+
e.left !== void 0 && !Y && y(e.left);
|
|
380
|
+
}, [e.left, Y]), x(() => {
|
|
381
|
+
e.top !== void 0 && !Y && S(e.top);
|
|
382
|
+
}, [e.top, Y]), x(() => {
|
|
383
|
+
e.initialLeft !== void 0 && y(e.initialLeft);
|
|
384
|
+
}, [e.initialLeft]), x(() => {
|
|
385
|
+
e.initialTop !== void 0 && S(e.initialTop);
|
|
386
|
+
}, [e.initialTop]), x(() => {
|
|
387
|
+
const t = H();
|
|
385
388
|
if (e.appendTo && t) {
|
|
386
389
|
const n = e.appendTo.getBoundingClientRect(), r = t.body.getBoundingClientRect();
|
|
387
|
-
|
|
390
|
+
Z.current.x = n.left - r.left, Z.current.y = n.top - r.top;
|
|
388
391
|
}
|
|
389
|
-
}, [e.appendTo,
|
|
390
|
-
|
|
392
|
+
}, [e.appendTo, H]), Dt(
|
|
393
|
+
O,
|
|
391
394
|
() => ({
|
|
392
395
|
get element() {
|
|
393
|
-
return
|
|
396
|
+
return v.current;
|
|
394
397
|
},
|
|
395
398
|
get windowElement() {
|
|
396
|
-
return
|
|
399
|
+
return v.current;
|
|
397
400
|
},
|
|
398
401
|
get draggable() {
|
|
399
402
|
return Ce.current;
|
|
@@ -402,48 +405,48 @@ const { useState: H, useEffect: N, useCallback: d, useMemo: K, useRef: F, useImp
|
|
|
402
405
|
}),
|
|
403
406
|
[e]
|
|
404
407
|
);
|
|
405
|
-
const Be =
|
|
408
|
+
const Be = T.Children.toArray(e.children), ct = Qe(Be), lt = Je(Be), dt = wt("k-window", e.className, {
|
|
406
409
|
[`k-window-${e.themeColor}`]: e.themeColor,
|
|
407
410
|
"k-window-minimized": a === "MINIMIZED",
|
|
408
411
|
"k-focus": qe
|
|
409
|
-
}), Re = /* @__PURE__ */
|
|
412
|
+
}), Re = /* @__PURE__ */ T.createElement(Ze.Provider, { value: X }, /* @__PURE__ */ T.createElement(T.Fragment, null, he && /* @__PURE__ */ T.createElement(
|
|
410
413
|
"div",
|
|
411
414
|
{
|
|
412
415
|
className: "k-overlay",
|
|
413
416
|
style: {
|
|
414
|
-
zIndex:
|
|
417
|
+
zIndex: X,
|
|
415
418
|
...e.overlayStyle
|
|
416
419
|
}
|
|
417
420
|
}
|
|
418
|
-
), /* @__PURE__ */
|
|
421
|
+
), /* @__PURE__ */ T.createElement(
|
|
419
422
|
"div",
|
|
420
423
|
{
|
|
421
424
|
id: e.id,
|
|
422
|
-
[Lt]:
|
|
425
|
+
[Lt]: ae,
|
|
423
426
|
tabIndex: 0,
|
|
424
427
|
role: "dialog",
|
|
425
428
|
"aria-labelledby": Le.current,
|
|
426
429
|
onFocus: it,
|
|
427
430
|
onBlur: ot,
|
|
428
431
|
onKeyDown: pe,
|
|
429
|
-
ref:
|
|
432
|
+
ref: v,
|
|
430
433
|
className: dt,
|
|
431
434
|
style: {
|
|
432
|
-
top:
|
|
433
|
-
left:
|
|
434
|
-
width:
|
|
435
|
-
height:
|
|
436
|
-
zIndex:
|
|
435
|
+
top: P,
|
|
436
|
+
left: K,
|
|
437
|
+
width: D,
|
|
438
|
+
height: I || "",
|
|
439
|
+
zIndex: X,
|
|
437
440
|
...e.style
|
|
438
441
|
}
|
|
439
442
|
},
|
|
440
|
-
/* @__PURE__ */
|
|
443
|
+
/* @__PURE__ */ T.createElement(
|
|
441
444
|
Ct,
|
|
442
445
|
{
|
|
443
446
|
shouldUpdateOnDrag: e.shouldUpdateOnDrag || !1,
|
|
444
|
-
isDragging:
|
|
447
|
+
isDragging: Y
|
|
445
448
|
},
|
|
446
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ T.createElement(
|
|
447
450
|
Tt,
|
|
448
451
|
{
|
|
449
452
|
onPress: et,
|
|
@@ -452,14 +455,14 @@ const { useState: H, useEffect: N, useCallback: d, useMemo: K, useRef: F, useImp
|
|
|
452
455
|
autoScroll: !1,
|
|
453
456
|
ref: Ce
|
|
454
457
|
},
|
|
455
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ T.createElement(
|
|
456
459
|
ft,
|
|
457
460
|
{
|
|
458
461
|
stage: a,
|
|
459
462
|
onDoubleClick: Ye ? rt : void 0,
|
|
460
463
|
onMinimizeButtonClick: Se,
|
|
461
|
-
onFullScreenButtonClick:
|
|
462
|
-
onRestoreButtonClick:
|
|
464
|
+
onFullScreenButtonClick: ce,
|
|
465
|
+
onRestoreButtonClick: $,
|
|
463
466
|
onCloseButtonClick: ye,
|
|
464
467
|
closeButton: e.closeButton,
|
|
465
468
|
minimizeButton: e.minimizeButton,
|
|
@@ -470,8 +473,8 @@ const { useState: H, useEffect: N, useCallback: d, useMemo: K, useRef: F, useImp
|
|
|
470
473
|
e.title
|
|
471
474
|
)
|
|
472
475
|
),
|
|
473
|
-
a === o.MINIMIZED ? null : /* @__PURE__ */
|
|
474
|
-
a === o.DEFAULT && fe ? /* @__PURE__ */
|
|
476
|
+
a === o.MINIMIZED ? null : /* @__PURE__ */ T.createElement(T.Fragment, null, /* @__PURE__ */ T.createElement("div", { className: "k-window-content" }, ct), lt),
|
|
477
|
+
a === o.DEFAULT && fe ? /* @__PURE__ */ T.createElement(Et, { onResize: at }) : null
|
|
475
478
|
)
|
|
476
479
|
)));
|
|
477
480
|
return le ? e.appendTo === null ? Re : ut.createPortal(Re, e.appendTo || document.body) : null;
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-common","@progress/kendo-react-intl"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactDialogs={},e.React,e.ReactDOM,e.PropTypes,e.KendoReactButtons,e.KendoSvgIcons,e.KendoReactCommon,e.KendoReactIntl)}(this,function(e,t,n,o,i,r,a,l){"use strict";function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var s=c(t),d=c(n);const u=({children:e,onCloseButtonClick:t,id:n,closeIcon:o})=>s.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:n},s.createElement("span",{className:"k-window-title k-dialog-title"},e),o&&s.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},s.createElement(i.Button,{role:"button","aria-label":"Close",onClick:t,icon:"x",svgIcon:r.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),p=e=>{const t={layout:"stretched",...e},{layout:n,children:o}=t,i=a.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${n}`]:n});return s.createElement("div",{className:i},o)};p.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const g="data-windowid",h=10002,f=a.createPropsContext(),m=s.forwardRef((e,t)=>{const n=a.useZIndexContext(),o=n?n+2:h,i=s.useRef(null),r=s.useRef(null),l=s.useRef(a.getActiveElement(document)),c=a.usePropsContext(f,e),m=s.useMemo(()=>({...v,...c}),[c]),{title:w,width:E,height:C,children:y,minWidth:b,dir:k,style:T,themeColor:I,contentStyle:B,autoFocusedElement:D,appendTo:L,className:N,overlayStyle:M,modal:S=v.modal,closeIcon:F=v.closeIcon,autoFocus:x=v.autoFocus}=m,R=s.useCallback(()=>({props:m,element:r.current}),[m]);s.useImperativeHandle(i,R),s.useImperativeHandle(t,()=>i.current);const A=s.useMemo(()=>s.Children.toArray(y).filter(e=>!s.isValidElement(e)||e.type!==p),[y]),z=s.useMemo(()=>s.Children.toArray(y).filter(e=>s.isValidElement(e)&&e.type===p),[y]),{_id:U,contentId:W,id:O}=s.useMemo(()=>{const e=m.id,t=`${null!=e?e:"accessibility"}-id`;return{_id:t,contentId:`dialog-content-${t}`,id:e||`dialog-title-${t}`}},[m.id]),H=s.useCallback(()=>{if(r.current)if(x&&!D)r.current.focus();else if(!x&&D&&r.current){const e=r.current.querySelector(D);null==e||e.focus()}else{const e=[...a.FOCUSABLE_ELEMENTS].map(e=>e+":not(.k-dialog-titlebar *)");a.focusFirstFocusableChild(r.current,e)}},[x,D]);s.useEffect(()=>(H(),()=>{setTimeout(()=>{var e;!r.current&&l.current&&a.canUseDOM&&(document.contains(l.current)?l.current.focus():l.current.id&&(null==(e=document.getElementById(l.current.id))||e.focus()))})}),[H]);const K=s.useCallback(e=>{e.preventDefault(),a.dispatchEvent(m.onClose,e,R(),void 0)},[m.onClose]),j=s.useCallback(e=>{e.keyCode===a.Keys.esc&&m.onClose&&(e.preventDefault(),K(e)),a.keepFocusInContainer(e,r.current)},[m.onClose,K]),Z=s.useMemo(()=>s.createElement(a.ZIndexContext.Provider,{value:o},s.createElement("div",{ref:r,[g]:U,className:"k-dialog-wrapper"+(N?" "+N:""),onKeyDown:j,tabIndex:0,dir:k,style:{zIndex:o,...T}},S&&s.createElement("div",{className:"k-overlay",style:M}),s.createElement("div",{className:a.classNames("k-window k-dialog",{[`k-window-${I}`]:I}),role:"dialog","aria-labelledby":O,"aria-modal":!0,"aria-describedby":W,style:{width:E,height:C,minWidth:b}},w&&s.createElement(u,{closeIcon:F,onCloseButtonClick:K,id:O},w),s.createElement("div",{className:"k-window-content k-dialog-content",style:B,id:W},A),z))),[o,U,N,j,T,k,M,I,O,W,E,C,b,F,K,B,w,A,z,S]);return a.canUseDOM?null!==L?d.createPortal(Z,L||document.body):Z:null}),v={autoFocus:!1,modal:!0,closeIcon:!0},w={autoFocus:o.bool,autoFocusedElement:o.string,title:o.any,className:o.string,closeIcon:o.bool,modal:o.bool,overlayStyle:o.object,width:o.oneOfType([o.number,o.string]),height:o.oneOfType([o.number,o.string]),minWidth:o.oneOfType([o.number,o.string]),onClose:o.func,children:o.node,id:o.string,dir:o.string,style:o.object,contentStyle:o.object,appendTo:o.any,themeColor:o.oneOf(["primary","dark","light"])};m.displayName="KendoReactDialog",m.propTypes=w;var E=(e=>(e.DEFAULT="DEFAULT",e.FULLSCREEN="FULLSCREEN",e.MINIMIZED="MINIMIZED",e))(E||{});const C="dialogs.windowMaximizeButton",y="dialogs.windowMinimizeButton",b="dialogs.windowRestoreButton",k="dialogs.windowCloseButton",T={[C]:"maximize",[y]:"minimize",[b]:"restore",[k]:"close"},I=e=>{const{children:t,onCloseButtonClick:n,onMinimizeButtonClick:o,onFullScreenButtonClick:a,onRestoreButtonClick:c,onDoubleClick:d,stage:u,forwardedRef:p,id:g}=e,h=l.useLocalization(),f=e.minimizeButton?s.createElement(e.minimizeButton,{onClick:o,stage:u}):s.createElement(i.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:r.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:o,"aria-label":h.toLanguageString(y,T[y])}),m=e.maximizeButton?s.createElement(e.maximizeButton,{onClick:a,stage:u}):s.createElement(i.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:r.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":h.toLanguageString(C,T[C])}),v=e.restoreButton?s.createElement(e.restoreButton,{onClick:c,stage:u}):s.createElement(i.Button,{fillMode:"flat",icon:"window-restore",svgIcon:r.windowRestoreIcon,className:"k-window-titlebar-action",onClick:c,"aria-label":h.toLanguageString(b,T[b])}),w=e.closeButton?s.createElement(e.closeButton,{onClick:n,stage:u}):s.createElement(i.Button,{fillMode:"flat",icon:"x",svgIcon:r.xIcon,className:"k-window-titlebar-action",onClick:n,"aria-label":h.toLanguageString(k,T[k])});return s.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:p,onDoubleClick:d},s.createElement("span",{className:"k-window-title",id:g},t||""),s.createElement("div",{className:"k-window-titlebar-actions"},u===E.DEFAULT&&f,u===E.DEFAULT&&m,u!==E.DEFAULT&&v,w))},B=s.forwardRef((e,t)=>s.createElement(I,{...e,forwardedRef:t})),D=["n","e","s","w","se","sw","ne","nw"];class L extends s.Component{render(){return s.createElement("div",{className:"k-resize-handles-wrapper"}," ",D.map((e,t)=>s.createElement(a.Draggable,{key:t,onDrag:t=>{const{event:n}=t;n.originalEvent.preventDefault(),this.props.onResize(n,{end:!1,direction:e})},onRelease:t=>{const{event:n}=t;n.originalEvent.preventDefault(),this.props.onResize(n,{end:!0,direction:e})}},s.createElement("div",{className:"k-resize-handle k-resize-"+e,style:{display:"block",touchAction:"none",userSelect:"none"}}))))}}class N extends s.Component{shouldComponentUpdate(e){return e.shouldUpdateOnDrag||!e.isDragging}render(){return this.props.children}}const M=e=>{const t={layout:"end",...e},{layout:n,children:o}=t,i=a.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":"start"===n,"k-justify-content-center":"center"===n,"k-justify-content-end":"end"===n,"k-justify-content-stretch":"stretched"===n});return s.createElement("div",{className:i},o)};M.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const S=(e,t,n)=>{let o=e;if(t&&t.defaultView){const e=t.querySelectorAll(".k-window:not(.k-dialog), .k-dialog-wrapper");let i=!1;return e.forEach(e=>{const r=t.defaultView.getComputedStyle(e,null);if(e.getAttribute(g)!==n&&null!==r.zIndex){const e=parseInt(r.zIndex,10);e>=o&&(o=e,i=!0)}}),i?o+2:o}return o},{useState:F,useEffect:x,useCallback:R,useMemo:A,useRef:z,useImperativeHandle:U,useContext:W,forwardRef:O}=s,H=300,K=300,j={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},Z=O((e,t)=>{var n;const{minWidth:o=j.minWidth,minHeight:i=j.minHeight,resizable:r=j.resizable,draggable:l=j.draggable,modal:c=j.modal,doubleClickStageChange:u=j.doubleClickStageChange,autoFocus:p=j.autoFocus}=e,[f,m]=F(e.stage||E.DEFAULT),[v,w]=F(!1),[C,y]=F(0),[b,k]=F(0),[T,I]=F(H),[D,O]=F(K),[Z,P]=F(!0),[q,$]=F(h),V=null!=(n=e.stage)?n:f,X=W(a.ZIndexContext),Y=z(null),_=z(null),G=z({leftBeforeAction:0,topBeforeAction:0,widthBeforeAction:H,heightBeforeAction:K}),J=z({x:0,y:0}),Q=z(void 0),ee=z(a.canUseDOM?document.activeElement:null),te=z("window-title-"+(e.id?e.id+"-accessibility-id":"")),ne=z({left:0,top:0,width:H,height:K,internalLeft:b,internalTop:C,internalWidth:T,internalHeight:D,stage:V,draggable:l,props:e}),oe=R(()=>{const t=a.canUseDOM?document:null;return e.appendTo?e.appendTo.ownerDocument:t},[e.appendTo]),ie=R(()=>{const e=oe();return null==e?void 0:e.defaultView},[oe]),re=A(()=>{var t;return V!==E.FULLSCREEN?Math.max(null!=(t=e.top)?t:C,0):0},[V,e.top,C]),ae=A(()=>{var t;return V!==E.FULLSCREEN?Math.max(null!=(t=e.left)?t:b,0):0},[V,e.left,b]),le=A(()=>{var t;const n=null!=(t=e.width)?t:T;if(V===E.FULLSCREEN){if(e.appendTo)return e.appendTo.offsetWidth;const t=ie();return t?t.innerWidth:0}return n},[V,e.width,e.appendTo,T,ie]),ce=A(()=>{const t=void 0===e.height?D:e.height;if(V===E.FULLSCREEN){if(e.appendTo)return e.appendTo.offsetHeight;const t=ie();return t?t.innerHeight:0}return V===E.MINIMIZED?0:t},[V,e.height,e.appendTo,D,ie]),se=A(()=>e.id?e.id+"-accessibility-id":void 0,[e.id]);x(()=>{ne.current={left:ae,top:re,width:le,height:ce,internalLeft:b,internalTop:C,internalWidth:T,internalHeight:D,stage:V,draggable:l,props:e}});const de=A(()=>{if(void 0===X)return null!=X?X:h;return q>(X?X+2:0)?q:X+2},[q,X]),ue=R(()=>{var t,n;if(void 0!==e.top)return e.top;if(void 0!==e.initialTop)return e.initialTop;let o=K;if(void 0!==e.height?o=e.height:void 0!==e.initialHeight&&(o=e.initialHeight),e.appendTo&&o)return e.appendTo.offsetHeight/2-o/2;const i=ie();return i?i.innerHeight/2-(null!=(n=null!=o?o:null==(t=Y.current)?void 0:t.clientHeight)?n:0)/2:0},[e.top,e.initialTop,e.height,e.initialHeight,e.appendTo,ie]),pe=R(()=>{if(void 0!==e.left)return e.left;if(void 0!==e.initialLeft)return e.initialLeft;let t=H;if(void 0!==e.width?t=e.width:void 0!==e.initialWidth&&(t=e.initialWidth),e.appendTo)return e.appendTo.offsetWidth/2-t/2;const n=ie();return n?n.innerWidth/2-t/2:0},[e.left,e.initialLeft,e.width,e.initialWidth,e.appendTo,ie]),ge=R(()=>{let t=H;return void 0!==e.width?t=e.width:void 0!==e.initialWidth&&(t=e.initialWidth),t},[e.width,e.initialWidth]),he=R(()=>{let t=K;return void 0!==e.height?t=e.height:void 0!==e.initialHeight&&(t=e.initialHeight),t},[e.height,e.initialHeight]),fe=R(e=>e.filter(e=>(null==e?void 0:e.type)===M),[]),me=R(e=>e.filter(e=>e&&e.type!==M),[]),ve=R(()=>"object"==typeof t&&null!==t&&"current"in t?t.current:null,[t]),we=R((e,t,n,o,i,r)=>{var a,l,c;if(!e)return;const{internalLeft:s,internalTop:d,internalWidth:u,internalHeight:p}=ne.current;e({nativeEvent:t.nativeEvent?t.nativeEvent:t.originalEvent,drag:n,end:o,target:ve(),left:null!=(a=null==i?void 0:i.left)?a:s,top:null!=(l=null==i?void 0:i.top)?l:d,width:null!=(c=null==r?void 0:r.width)?c:u,height:void 0===(null==r?void 0:r.height)?p:null==r?void 0:r.height})},[ve]),Ee=R(t=>{var n,l;if(c&&a.keepFocusInContainer(t,Y.current),t.target!==t.currentTarget)return;const s=o||120,d=i||100,u=t.metaKey||t.ctrlKey,p=null!=(l=null!=ce?ce:null==(n=Y.current)?void 0:n.clientHeight)?l:0;if(u&&r){switch(t.keyCode){case a.Keys.up:t.preventDefault(),d<=p-5&&O(p-5);break;case a.Keys.down:t.preventDefault(),O(p+5);break;case a.Keys.left:s<=le-5&&I(le-5);break;case a.Keys.right:I(le+5);break;default:return}we(e.onResize,t,!1,void 0)}else if(t.altKey)switch(t.keyCode){case a.Keys.up:V===E.MINIMIZED?(De(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.DEFAULT})):V===E.DEFAULT&&(Be(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.FULLSCREEN}));break;case a.Keys.down:V===E.FULLSCREEN?(De(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.DEFAULT})):V===E.DEFAULT&&(Ie(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.MINIMIZED}))}else{if(!t.ctrlKey)switch(t.keyCode){case a.Keys.esc:return void(e.onClose&&Le(t));case a.Keys.up:y(e=>e-5);break;case a.Keys.down:y(e=>e+5);break;case a.Keys.left:k(e=>e-5);break;case a.Keys.right:k(e=>e+5);break;default:return}we(e.onMove,t,!1,void 0)}},[c,o,i,r,e.onResize,e.onStageChange,e.onClose,e.onMove,ce,le,V,we,ve]),Ce=R(e=>{const t=e.event,{left:n,top:o}=ne.current;G.current.differenceLeft=t.pageX-n,G.current.differenceTop=t.pageY-o},[]),ye=R(e=>{const t=e.event;t.originalEvent.preventDefault();const{stage:n,draggable:o,props:i,width:r,height:a}=ne.current;if(n!==E.FULLSCREEN&&o){const e=Math.max(t.pageY-(G.current.differenceTop||0),0),n=t.pageX-(G.current.differenceLeft||0);y(e),k(n),w(!0),i.onMove&&we(i.onMove,t,!0,!1,{left:n,top:e},{width:r,height:a})}},[we]),be=R(e=>{const t=e.event,{stage:n,draggable:o,props:i,left:r,top:a,width:l,height:c}=ne.current;n!==E.FULLSCREEN&&o&&i.onMove&&we(i.onMove,t,!0,!0,{left:r,top:a},{width:l,height:c}),w(!1)},[we]),ke=R(()=>{Q.current?(clearTimeout(Q.current),Q.current=void 0):(P(!0),$(S(de,oe(),se)))},[de,oe,se]),Te=R(()=>{clearTimeout(Q.current);const e=ie();e&&(Q.current=e.setTimeout(()=>{P(!1),Q.current=void 0}))},[ie]),Ie=R(t=>{t.preventDefault(),G.current.leftBeforeAction=ae,G.current.topBeforeAction=re,G.current.widthBeforeAction=le,G.current.heightBeforeAction=ce,m(E.MINIMIZED),O(0),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.MINIMIZED})},[ae,re,le,ce,e.onStageChange,ve]),Be=R(t=>{t.preventDefault(),G.current.leftBeforeAction=ae,G.current.topBeforeAction=re,G.current.widthBeforeAction=le,G.current.heightBeforeAction=ce;const n=ie(),o=n?n.innerWidth:0,i=n?n.innerHeight:0;k(0),y(0),I(e.appendTo?e.appendTo.offsetWidth:o),O(e.appendTo?e.appendTo.offsetHeight:i),m(E.FULLSCREEN),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.FULLSCREEN})},[ae,re,le,ce,e.appendTo,e.onStageChange,ie,ve]),De=R(t=>{t.preventDefault(),V===E.FULLSCREEN?(m(E.DEFAULT),k(G.current.leftBeforeAction),y(G.current.topBeforeAction),I(G.current.widthBeforeAction),O(G.current.heightBeforeAction)):V===E.MINIMIZED&&(m(E.DEFAULT),O(G.current.heightBeforeAction)),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.DEFAULT})},[V,e.onStageChange,ve]),Le=R(t=>{t.preventDefault(),a.dispatchEvent(e.onClose,t,ve(),{state:void 0})},[e.onClose,ve]),Ne=R(e=>{V===E.FULLSCREEN||V===E.MINIMIZED?De(e):Be(e)},[V,De,Be]),Me=R((e,t)=>{var n,r,a,l,c,s;const{props:d,width:u,height:p,top:g,left:h}=ne.current,f=d.appendTo?e.pageX-J.current.x:e.pageX,m=d.appendTo?e.pageY-J.current.y:e.pageY,v=null!=(r=null!=p?p:null==(n=Y.current)?void 0:n.clientHeight)?r:0,E=o||120,C=i||100,b=g-m,T=h-f,B=f-h,D=m-g;let L=!1;const N={isDragging:!t.end};t.direction.indexOf("n")>=0&&C-(v+b)<0&&(g>0&&(N.height=v+b),N.top=m,L=!0),t.direction.indexOf("s")>=0&&C-D<0&&(N.height=D,L=!0),t.direction.indexOf("w")>=0&&E-(u+T)<0&&(h>0&&(N.width=u+T),N.left=f,L=!0),t.direction.indexOf("e")>=0&&E-B<0&&(N.width=B,L=!0),L&&(void 0!==N.height&&O(N.height),void 0!==N.top&&y(N.top),void 0!==N.width&&I(N.width),void 0!==N.left&&k(N.left),void 0!==N.isDragging&&w(N.isDragging)),we(d.onResize,e,!0,t.end,{left:null!=(a=N.left)?a:h,top:null!=(l=N.top)?l:g},{width:null!=(c=N.width)?c:u,height:null!=(s=N.height)?s:p})},[we]),Se=R(()=>{if(V===E.FULLSCREEN){const t=ie(),n=t?t.innerWidth:0,o=t?t.innerHeight:0;I(e.appendTo?e.appendTo.offsetWidth:n),O(e.appendTo?e.appendTo.offsetHeight:o)}},[V,e.appendTo,ie]);x(()=>{const t=Y.current;t&&p&&t.focus({preventScroll:!0});const n=ie();n&&n.addEventListener("resize",Se),m(e.stage||E.DEFAULT),w(!1),y(ue()),k(pe()),I(ge()),O(he()),P(!0),$(S(de,oe(),se)),G.current={leftBeforeAction:pe(),topBeforeAction:ue(),widthBeforeAction:ge(),heightBeforeAction:he()};const o=oe();if(e.appendTo&&o){const t=e.appendTo.getBoundingClientRect(),n=o.body.getBoundingClientRect();J.current.x=t.left-n.left,J.current.y=t.top-n.top}return()=>{var e;const t=ie();t&&t.removeEventListener("resize",Se),ee.current&&a.canUseDOM&&(document.contains(ee.current)?ee.current.focus({preventScroll:!0}):ee.current.id&&(null==(e=document.getElementById(ee.current.id))||e.focus({preventScroll:!0})))}},[]),x(()=>{void 0!==e.left&&!v&&k(e.left)},[e.left,v]),x(()=>{void 0!==e.top&&!v&&y(e.top)},[e.top,v]),x(()=>{void 0!==e.initialLeft&&k(e.initialLeft)},[e.initialLeft]),x(()=>{void 0!==e.initialTop&&y(e.initialTop)},[e.initialTop]),x(()=>{const t=oe();if(e.appendTo&&t){const n=e.appendTo.getBoundingClientRect(),o=t.body.getBoundingClientRect();J.current.x=n.left-o.left,J.current.y=n.top-o.top}},[e.appendTo,oe]),U(t,()=>({get element(){return Y.current},get windowElement(){return Y.current},get draggable(){return _.current},props:e}),[e]);const Fe=s.Children.toArray(e.children),xe=me(Fe),Re=fe(Fe),Ae=a.classNames("k-window",e.className,{[`k-window-${e.themeColor}`]:e.themeColor,"k-window-minimized":"MINIMIZED"===V,"k-focus":Z}),ze=s.createElement(a.ZIndexContext.Provider,{value:de},s.createElement(s.Fragment,null,c&&s.createElement("div",{className:"k-overlay",style:{zIndex:de,...e.overlayStyle}}),s.createElement("div",{id:e.id,[g]:se,tabIndex:0,role:"dialog","aria-labelledby":te.current,onFocus:ke,onBlur:Te,onKeyDown:Ee,ref:Y,className:Ae,style:{top:re,left:ae,width:le,height:ce||"",zIndex:de,...e.style}},s.createElement(N,{shouldUpdateOnDrag:e.shouldUpdateOnDrag||!1,isDragging:v},s.createElement(a.Draggable,{onPress:Ce,onDrag:ye,onRelease:be,autoScroll:!1,ref:_},s.createElement(B,{stage:V,onDoubleClick:u?Ne:void 0,onMinimizeButtonClick:Ie,onFullScreenButtonClick:Be,onRestoreButtonClick:De,onCloseButtonClick:Le,closeButton:e.closeButton,minimizeButton:e.minimizeButton,maximizeButton:e.maximizeButton,restoreButton:e.restoreButton,id:te.current},e.title)),V===E.MINIMIZED?null:s.createElement(s.Fragment,null,s.createElement("div",{className:"k-window-content"},xe),Re),V===E.DEFAULT&&r?s.createElement(L,{onResize:Me}):null))));return a.canUseDOM?null===e.appendTo?ze:d.createPortal(ze,e.appendTo||document.body):null});Z.displayName="Window";const P=a.createPropsContext(),q=a.withIdHOC(a.withPropsContext(P,Z));q.displayName="KendoReactWindow";const $={autoFocus:o.bool,title:o.any,className:o.string,closeButton:o.func,minimizeButton:o.func,maximizeButton:o.func,restoreButton:o.func,modal:o.bool,overlayStyle:o.object,width:o.number,height:o.number,minWidth:o.number,minHeight:o.number,left:o.number,top:o.number,initialLeft:o.number,initialTop:o.number,initialWidth:o.number,initialHeight:o.number,resizable:o.bool,draggable:o.bool,doubleClickStageChange:o.bool,stage:o.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),onClose:o.func,onMove:o.func,onResize:o.func,onStageChange:o.func,children:o.node,id:o.string,dir:o.string,style:o.object,appendTo:o.any,themeColor:o.oneOf(["primary","dark","light"]),shouldUpdateOnDrag:o.bool};q.propTypes=$,e.Dialog=m,e.DialogActionsBar=p,e.DialogPropsContext=f,e.Window=q,e.WindowActionsBar=M,e.WindowPropsContext=P,e.WindowWithoutContext=Z});
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-common","@progress/kendo-react-intl"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactDialogs={},e.React,e.ReactDOM,e.PropTypes,e.KendoReactButtons,e.KendoSvgIcons,e.KendoReactCommon,e.KendoReactIntl)}(this,function(e,t,n,o,i,r,a,l){"use strict";function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var s=c(t),d=c(n);const u=({children:e,onCloseButtonClick:t,id:n,closeIcon:o})=>s.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:n},s.createElement("span",{className:"k-window-title k-dialog-title"},e),o&&s.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},s.createElement(i.Button,{role:"button","aria-label":"Close",onClick:t,icon:"x",svgIcon:r.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),p=e=>{const t={layout:"stretched",...e},{layout:n,children:o}=t,i=a.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${n}`]:n});return s.createElement("div",{className:i},o)};p.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const g="data-windowid",h=10002,f=a.createPropsContext(),m=s.forwardRef((e,t)=>{const n=a.useZIndexContext(),o=n?n+2:h,i=s.useRef(null),r=s.useRef(null),l=s.useRef(a.getActiveElement(document)),c=a.usePropsContext(f,e),m=s.useMemo(()=>({...v,...c}),[c]),{title:w,width:E,height:C,children:y,minWidth:b,dir:k,style:T,themeColor:I,contentStyle:B,autoFocusedElement:D,appendTo:L,className:N,overlayStyle:M,modal:S=v.modal,closeIcon:F=v.closeIcon,autoFocus:x=v.autoFocus}=m,R=s.useCallback(()=>({props:m,element:r.current}),[m]);s.useImperativeHandle(i,R),s.useImperativeHandle(t,()=>i.current);const A=s.useMemo(()=>s.Children.toArray(y).filter(e=>!s.isValidElement(e)||e.type!==p),[y]),z=s.useMemo(()=>s.Children.toArray(y).filter(e=>s.isValidElement(e)&&e.type===p),[y]),{_id:U,contentId:W,id:O}=s.useMemo(()=>{const e=m.id,t=`${null!=e?e:"accessibility"}-id`;return{_id:t,contentId:`dialog-content-${t}`,id:e||`dialog-title-${t}`}},[m.id]),H=s.useCallback(()=>{if(r.current)if(x&&!D)r.current.focus();else if(!x&&D&&r.current){const e=r.current.querySelector(D);null==e||e.focus()}else{const e=[...a.FOCUSABLE_ELEMENTS].map(e=>e+":not(.k-dialog-titlebar *)");a.focusFirstFocusableChild(r.current,e)}},[x,D]);s.useEffect(()=>(H(),()=>{setTimeout(()=>{var e;!r.current&&l.current&&a.canUseDOM&&(document.contains(l.current)?l.current.focus():l.current.id&&(null==(e=document.getElementById(l.current.id))||e.focus()))})}),[H]);const K=s.useCallback(e=>{e.preventDefault(),a.dispatchEvent(m.onClose,e,R(),void 0)},[m.onClose]),j=s.useCallback(e=>{e.keyCode===a.Keys.esc&&m.onClose&&(e.preventDefault(),K(e)),a.keepFocusInContainer(e,r.current)},[m.onClose,K]),Z=s.useMemo(()=>s.createElement(a.ZIndexContext.Provider,{value:o},s.createElement("div",{ref:r,[g]:U,className:"k-dialog-wrapper"+(N?" "+N:""),onKeyDown:j,tabIndex:0,dir:k,style:{zIndex:o,...T}},S&&s.createElement("div",{className:"k-overlay",style:M}),s.createElement("div",{className:a.classNames("k-window k-dialog",{[`k-window-${I}`]:I}),role:"dialog","aria-labelledby":O,"aria-modal":!0,"aria-describedby":W,style:{width:E,height:C,minWidth:b}},w&&s.createElement(u,{closeIcon:F,onCloseButtonClick:K,id:O},w),s.createElement("div",{className:"k-window-content k-dialog-content",style:B,id:W},A),z))),[o,U,N,j,T,k,M,I,O,W,E,C,b,F,K,B,w,A,z,S]);return a.canUseDOM?null!==L?d.createPortal(Z,L||document.body):Z:null}),v={autoFocus:!1,modal:!0,closeIcon:!0},w={autoFocus:o.bool,autoFocusedElement:o.string,title:o.any,className:o.string,closeIcon:o.bool,modal:o.bool,overlayStyle:o.object,width:o.oneOfType([o.number,o.string]),height:o.oneOfType([o.number,o.string]),minWidth:o.oneOfType([o.number,o.string]),onClose:o.func,children:o.node,id:o.string,dir:o.string,style:o.object,contentStyle:o.object,appendTo:o.any,themeColor:o.oneOf(["primary","dark","light"])};m.displayName="KendoReactDialog",m.propTypes=w;var E=(e=>(e.DEFAULT="DEFAULT",e.FULLSCREEN="FULLSCREEN",e.MINIMIZED="MINIMIZED",e))(E||{});const C="dialogs.windowMaximizeButton",y="dialogs.windowMinimizeButton",b="dialogs.windowRestoreButton",k="dialogs.windowCloseButton",T={[C]:"maximize",[y]:"minimize",[b]:"restore",[k]:"close"},I=e=>{const{children:t,onCloseButtonClick:n,onMinimizeButtonClick:o,onFullScreenButtonClick:a,onRestoreButtonClick:c,onDoubleClick:d,stage:u,forwardedRef:p,id:g}=e,h=l.useLocalization(),f=e.minimizeButton?s.createElement(e.minimizeButton,{onClick:o,stage:u}):s.createElement(i.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:r.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:o,"aria-label":h.toLanguageString(y,T[y])}),m=e.maximizeButton?s.createElement(e.maximizeButton,{onClick:a,stage:u}):s.createElement(i.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:r.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":h.toLanguageString(C,T[C])}),v=e.restoreButton?s.createElement(e.restoreButton,{onClick:c,stage:u}):s.createElement(i.Button,{fillMode:"flat",icon:"window-restore",svgIcon:r.windowRestoreIcon,className:"k-window-titlebar-action",onClick:c,"aria-label":h.toLanguageString(b,T[b])}),w=e.closeButton?s.createElement(e.closeButton,{onClick:n,stage:u}):s.createElement(i.Button,{fillMode:"flat",icon:"x",svgIcon:r.xIcon,className:"k-window-titlebar-action",onClick:n,"aria-label":h.toLanguageString(k,T[k])});return s.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:p,onDoubleClick:d},s.createElement("span",{className:"k-window-title",id:g},t||""),s.createElement("div",{className:"k-window-titlebar-actions"},u===E.DEFAULT&&f,u===E.DEFAULT&&m,u!==E.DEFAULT&&v,w))},B=s.forwardRef((e,t)=>s.createElement(I,{...e,forwardedRef:t})),D=["n","e","s","w","se","sw","ne","nw"];class L extends s.Component{render(){return s.createElement("div",{className:"k-resize-handles-wrapper"}," ",D.map((e,t)=>s.createElement(a.Draggable,{key:t,onDrag:t=>{const{event:n}=t;n.originalEvent.preventDefault(),this.props.onResize(n,{end:!1,direction:e})},onRelease:t=>{const{event:n}=t;n.originalEvent.preventDefault(),this.props.onResize(n,{end:!0,direction:e})}},s.createElement("div",{className:"k-resize-handle k-resize-"+e,style:{display:"block",touchAction:"none",userSelect:"none"}}))))}}class N extends s.Component{shouldComponentUpdate(e){return e.shouldUpdateOnDrag||!e.isDragging}render(){return this.props.children}}const M=e=>{const t={layout:"end",...e},{layout:n,children:o}=t,i=a.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":"start"===n,"k-justify-content-center":"center"===n,"k-justify-content-end":"end"===n,"k-justify-content-stretch":"stretched"===n});return s.createElement("div",{className:i},o)};M.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const S=(e,t,n)=>{let o=e;if(t&&t.defaultView){const e=t.querySelectorAll(".k-window:not(.k-dialog), .k-dialog-wrapper");let i=!1;return e.forEach(e=>{const r=t.defaultView.getComputedStyle(e,null);if(e.getAttribute(g)!==n&&null!==r.zIndex){const e=parseInt(r.zIndex,10);e>=o&&(o=e,i=!0)}}),i?o+2:o}return o},{useState:F,useEffect:x,useCallback:R,useMemo:A,useRef:z,useImperativeHandle:U,useContext:W,forwardRef:O}=s,H=300,K=300,j={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},Z=O((e,t)=>{var n;const{minWidth:o=j.minWidth,minHeight:i=j.minHeight,resizable:r=j.resizable,draggable:l=j.draggable,modal:c=j.modal,doubleClickStageChange:u=j.doubleClickStageChange,autoFocus:p=j.autoFocus}=e,[f,m]=F(e.stage||E.DEFAULT),[v,w]=F(!1),[C,y]=F(0),[b,k]=F(0),[T,I]=F(H),[D,O]=F(K),[Z,P]=F(!0),[q,$]=F(h),V=null!=(n=e.stage)?n:f,X=W(a.ZIndexContext),Y=z(null),_=z(null),G=z({leftBeforeAction:0,topBeforeAction:0,widthBeforeAction:H,heightBeforeAction:K}),J=z({x:0,y:0}),Q=z(void 0),ee=z(a.canUseDOM?document.activeElement:null),te=z("window-title-"+(e.id?e.id+"-accessibility-id":"")),ne=z({left:0,top:0,width:H,height:K,internalLeft:b,internalTop:C,internalWidth:T,internalHeight:D,stage:V,draggable:l,props:e}),oe=R(()=>{const t=a.canUseDOM?document:null;return e.appendTo?e.appendTo.ownerDocument:t},[e.appendTo]),ie=R(()=>{const e=oe();return null==e?void 0:e.defaultView},[oe]),re=A(()=>{var t;return V!==E.FULLSCREEN?Math.max(null!=(t=e.top)?t:C,0):0},[V,e.top,C]),ae=A(()=>{var t;return V!==E.FULLSCREEN?Math.max(null!=(t=e.left)?t:b,0):0},[V,e.left,b]),le=A(()=>{var t;const n=null!=(t=e.width)?t:T;if(V===E.FULLSCREEN){if(e.appendTo)return e.appendTo.offsetWidth;const t=ie();return t?t.innerWidth:0}return n},[V,e.width,e.appendTo,T,ie]),ce=A(()=>{const t=void 0===e.height?D:e.height;if(V===E.FULLSCREEN){if(e.appendTo)return e.appendTo.offsetHeight;const t=ie();return t?t.innerHeight:0}return V===E.MINIMIZED?0:t},[V,e.height,e.appendTo,D,ie]),se=A(()=>e.id?e.id+"-accessibility-id":void 0,[e.id]);x(()=>{ne.current={left:ae,top:re,width:le,height:ce,internalLeft:b,internalTop:C,internalWidth:T,internalHeight:D,stage:V,draggable:l,props:e}});const de=A(()=>{if(void 0===X)return null!=X?X:h;return q>(X?X+2:0)?q:X+2},[q,X]),ue=R(()=>{var t,n;if(void 0!==e.top)return e.top;if(void 0!==e.initialTop)return e.initialTop;let o=K;if(void 0!==e.height?o=e.height:void 0!==e.initialHeight&&(o=e.initialHeight),e.appendTo&&o)return e.appendTo.offsetHeight/2-o/2;const i=ie();return i?i.innerHeight/2-(null!=(n=null!=o?o:null==(t=Y.current)?void 0:t.clientHeight)?n:0)/2:0},[e.top,e.initialTop,e.height,e.initialHeight,e.appendTo,ie]),pe=R(()=>{if(void 0!==e.left)return e.left;if(void 0!==e.initialLeft)return e.initialLeft;let t=H;if(void 0!==e.width?t=e.width:void 0!==e.initialWidth&&(t=e.initialWidth),e.appendTo)return e.appendTo.offsetWidth/2-t/2;const n=ie();return n?n.innerWidth/2-t/2:0},[e.left,e.initialLeft,e.width,e.initialWidth,e.appendTo,ie]),ge=R(()=>{let t=H;return void 0!==e.width?t=e.width:void 0!==e.initialWidth&&(t=e.initialWidth),t},[e.width,e.initialWidth]),he=R(()=>{let t=K;return void 0!==e.height?t=e.height:void 0!==e.initialHeight&&(t=e.initialHeight),t},[e.height,e.initialHeight]),fe=R(e=>e.filter(e=>(null==e?void 0:e.type)===M),[]),me=R(e=>e.filter(e=>e&&e.type!==M),[]),ve=R(()=>"object"==typeof t&&null!==t&&"current"in t?t.current:null,[t]),we=R((e,t,n,o,i,r)=>{var a,l,c;if(!e)return;const{internalLeft:s,internalTop:d,internalWidth:u,internalHeight:p}=ne.current;e({nativeEvent:t.nativeEvent?t.nativeEvent:t.originalEvent,drag:n,end:o,target:ve(),left:null!=(a=null==i?void 0:i.left)?a:s,top:null!=(l=null==i?void 0:i.top)?l:d,width:null!=(c=null==r?void 0:r.width)?c:u,height:void 0===(null==r?void 0:r.height)?p:null==r?void 0:r.height})},[ve]),Ee=R(t=>{var n,l;if(c&&a.keepFocusInContainer(t,Y.current),t.target!==t.currentTarget)return;const s=o||120,d=i||100,u=t.metaKey||t.ctrlKey,p=null!=(l=null!=ce?ce:null==(n=Y.current)?void 0:n.clientHeight)?l:0;if(u&&r){switch(t.keyCode){case a.Keys.up:t.preventDefault(),d<=p-5&&O(p-5);break;case a.Keys.down:t.preventDefault(),O(p+5);break;case a.Keys.left:s<=le-5&&I(le-5);break;case a.Keys.right:I(le+5);break;default:return}we(e.onResize,t,!1,void 0)}else if(t.altKey)switch(t.keyCode){case a.Keys.up:V===E.MINIMIZED?(De(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.DEFAULT})):V===E.DEFAULT&&(Be(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.FULLSCREEN}));break;case a.Keys.down:V===E.FULLSCREEN?(De(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.DEFAULT})):V===E.DEFAULT&&(Ie(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.MINIMIZED}))}else if(!t.ctrlKey){const{internalLeft:n,internalTop:o}=ne.current;let i=n,r=o;switch(t.keyCode){case a.Keys.esc:return void(e.onClose&&Le(t));case a.Keys.up:r=o-5,y(r);break;case a.Keys.down:r=o+5,y(r);break;case a.Keys.left:i=n-5,k(i);break;case a.Keys.right:i=n+5,k(i);break;default:return}we(e.onMove,t,!1,void 0,{left:i,top:r})}},[c,o,i,r,e.onResize,e.onStageChange,e.onClose,e.onMove,ce,le,V,we,ve]),Ce=R(e=>{const t=e.event,{left:n,top:o}=ne.current;G.current.differenceLeft=t.pageX-n,G.current.differenceTop=t.pageY-o},[]),ye=R(e=>{const t=e.event;t.originalEvent.preventDefault();const{stage:n,draggable:o,props:i,width:r,height:a}=ne.current;if(n!==E.FULLSCREEN&&o){const e=Math.max(t.pageY-(G.current.differenceTop||0),0),n=t.pageX-(G.current.differenceLeft||0);y(e),k(n),w(!0),i.onMove&&we(i.onMove,t,!0,!1,{left:n,top:e},{width:r,height:a})}},[we]),be=R(e=>{const t=e.event,{stage:n,draggable:o,props:i,left:r,top:a,width:l,height:c}=ne.current;n!==E.FULLSCREEN&&o&&i.onMove&&we(i.onMove,t,!0,!0,{left:r,top:a},{width:l,height:c}),w(!1)},[we]),ke=R(()=>{Q.current?(clearTimeout(Q.current),Q.current=void 0):(P(!0),$(S(de,oe(),se)))},[de,oe,se]),Te=R(()=>{clearTimeout(Q.current);const e=ie();e&&(Q.current=e.setTimeout(()=>{P(!1),Q.current=void 0}))},[ie]),Ie=R(t=>{t.preventDefault(),G.current.leftBeforeAction=ae,G.current.topBeforeAction=re,G.current.widthBeforeAction=le,G.current.heightBeforeAction=ce,m(E.MINIMIZED),O(0),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.MINIMIZED})},[ae,re,le,ce,e.onStageChange,ve]),Be=R(t=>{t.preventDefault(),G.current.leftBeforeAction=ae,G.current.topBeforeAction=re,G.current.widthBeforeAction=le,G.current.heightBeforeAction=ce;const n=ie(),o=n?n.innerWidth:0,i=n?n.innerHeight:0;k(0),y(0),I(e.appendTo?e.appendTo.offsetWidth:o),O(e.appendTo?e.appendTo.offsetHeight:i),m(E.FULLSCREEN),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.FULLSCREEN})},[ae,re,le,ce,e.appendTo,e.onStageChange,ie,ve]),De=R(t=>{t.preventDefault(),V===E.FULLSCREEN?(m(E.DEFAULT),k(G.current.leftBeforeAction),y(G.current.topBeforeAction),I(G.current.widthBeforeAction),O(G.current.heightBeforeAction)):V===E.MINIMIZED&&(m(E.DEFAULT),O(G.current.heightBeforeAction)),a.dispatchEvent(e.onStageChange,t,ve(),{state:E.DEFAULT})},[V,e.onStageChange,ve]),Le=R(t=>{t.preventDefault(),a.dispatchEvent(e.onClose,t,ve(),{state:void 0})},[e.onClose,ve]),Ne=R(e=>{V===E.FULLSCREEN||V===E.MINIMIZED?De(e):Be(e)},[V,De,Be]),Me=R((e,t)=>{var n,r,a,l,c,s;const{props:d,width:u,height:p,top:g,left:h}=ne.current,f=d.appendTo?e.pageX-J.current.x:e.pageX,m=d.appendTo?e.pageY-J.current.y:e.pageY,v=null!=(r=null!=p?p:null==(n=Y.current)?void 0:n.clientHeight)?r:0,E=o||120,C=i||100,b=g-m,T=h-f,B=f-h,D=m-g;let L=!1;const N={isDragging:!t.end};t.direction.indexOf("n")>=0&&C-(v+b)<0&&(g>0&&(N.height=v+b),N.top=m,L=!0),t.direction.indexOf("s")>=0&&C-D<0&&(N.height=D,L=!0),t.direction.indexOf("w")>=0&&E-(u+T)<0&&(h>0&&(N.width=u+T),N.left=f,L=!0),t.direction.indexOf("e")>=0&&E-B<0&&(N.width=B,L=!0),L&&(void 0!==N.height&&O(N.height),void 0!==N.top&&y(N.top),void 0!==N.width&&I(N.width),void 0!==N.left&&k(N.left),void 0!==N.isDragging&&w(N.isDragging)),we(d.onResize,e,!0,t.end,{left:null!=(a=N.left)?a:h,top:null!=(l=N.top)?l:g},{width:null!=(c=N.width)?c:u,height:null!=(s=N.height)?s:p})},[we]),Se=R(()=>{if(V===E.FULLSCREEN){const t=ie(),n=t?t.innerWidth:0,o=t?t.innerHeight:0;I(e.appendTo?e.appendTo.offsetWidth:n),O(e.appendTo?e.appendTo.offsetHeight:o)}},[V,e.appendTo,ie]);x(()=>{const t=Y.current;t&&p&&t.focus({preventScroll:!0});const n=ie();n&&n.addEventListener("resize",Se),m(e.stage||E.DEFAULT),w(!1),y(ue()),k(pe()),I(ge()),O(he()),P(!0),$(S(de,oe(),se)),G.current={leftBeforeAction:pe(),topBeforeAction:ue(),widthBeforeAction:ge(),heightBeforeAction:he()};const o=oe();if(e.appendTo&&o){const t=e.appendTo.getBoundingClientRect(),n=o.body.getBoundingClientRect();J.current.x=t.left-n.left,J.current.y=t.top-n.top}return()=>{var e;const t=ie();t&&t.removeEventListener("resize",Se),ee.current&&a.canUseDOM&&(document.contains(ee.current)?ee.current.focus({preventScroll:!0}):ee.current.id&&(null==(e=document.getElementById(ee.current.id))||e.focus({preventScroll:!0})))}},[]),x(()=>{void 0!==e.left&&!v&&k(e.left)},[e.left,v]),x(()=>{void 0!==e.top&&!v&&y(e.top)},[e.top,v]),x(()=>{void 0!==e.initialLeft&&k(e.initialLeft)},[e.initialLeft]),x(()=>{void 0!==e.initialTop&&y(e.initialTop)},[e.initialTop]),x(()=>{const t=oe();if(e.appendTo&&t){const n=e.appendTo.getBoundingClientRect(),o=t.body.getBoundingClientRect();J.current.x=n.left-o.left,J.current.y=n.top-o.top}},[e.appendTo,oe]),U(t,()=>({get element(){return Y.current},get windowElement(){return Y.current},get draggable(){return _.current},props:e}),[e]);const Fe=s.Children.toArray(e.children),xe=me(Fe),Re=fe(Fe),Ae=a.classNames("k-window",e.className,{[`k-window-${e.themeColor}`]:e.themeColor,"k-window-minimized":"MINIMIZED"===V,"k-focus":Z}),ze=s.createElement(a.ZIndexContext.Provider,{value:de},s.createElement(s.Fragment,null,c&&s.createElement("div",{className:"k-overlay",style:{zIndex:de,...e.overlayStyle}}),s.createElement("div",{id:e.id,[g]:se,tabIndex:0,role:"dialog","aria-labelledby":te.current,onFocus:ke,onBlur:Te,onKeyDown:Ee,ref:Y,className:Ae,style:{top:re,left:ae,width:le,height:ce||"",zIndex:de,...e.style}},s.createElement(N,{shouldUpdateOnDrag:e.shouldUpdateOnDrag||!1,isDragging:v},s.createElement(a.Draggable,{onPress:Ce,onDrag:ye,onRelease:be,autoScroll:!1,ref:_},s.createElement(B,{stage:V,onDoubleClick:u?Ne:void 0,onMinimizeButtonClick:Ie,onFullScreenButtonClick:Be,onRestoreButtonClick:De,onCloseButtonClick:Le,closeButton:e.closeButton,minimizeButton:e.minimizeButton,maximizeButton:e.maximizeButton,restoreButton:e.restoreButton,id:te.current},e.title)),V===E.MINIMIZED?null:s.createElement(s.Fragment,null,s.createElement("div",{className:"k-window-content"},xe),Re),V===E.DEFAULT&&r?s.createElement(L,{onResize:Me}):null))));return a.canUseDOM?null===e.appendTo?ze:d.createPortal(ze,e.appendTo||document.body):null});Z.displayName="Window";const P=a.createPropsContext(),q=a.withIdHOC(a.withPropsContext(P,Z));q.displayName="KendoReactWindow";const $={autoFocus:o.bool,title:o.any,className:o.string,closeButton:o.func,minimizeButton:o.func,maximizeButton:o.func,restoreButton:o.func,modal:o.bool,overlayStyle:o.object,width:o.number,height:o.number,minWidth:o.number,minHeight:o.number,left:o.number,top:o.number,initialLeft:o.number,initialTop:o.number,initialWidth:o.number,initialHeight:o.number,resizable:o.bool,draggable:o.bool,doubleClickStageChange:o.bool,stage:o.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),onClose:o.func,onMove:o.func,onResize:o.func,onStageChange:o.func,children:o.node,id:o.string,dir:o.string,style:o.object,appendTo:o.any,themeColor:o.oneOf(["primary","dark","light"]),shouldUpdateOnDrag:o.bool};q.propTypes=$,e.Dialog=m,e.DialogActionsBar=p,e.DialogPropsContext=f,e.Window=q,e.WindowActionsBar=M,e.WindowPropsContext=P,e.WindowWithoutContext=Z});
|
package/package-metadata.mjs
CHANGED
|
@@ -7,7 +7,7 @@ export const packageMetadata = Object.freeze({
|
|
|
7
7
|
productName: 'KendoReact',
|
|
8
8
|
productCode: 'KENDOUIREACT',
|
|
9
9
|
productCodes: ['KENDOUIREACT'],
|
|
10
|
-
publishDate:
|
|
11
|
-
version: '14.3.
|
|
10
|
+
publishDate: 1775723130,
|
|
11
|
+
version: '14.3.3-develop.1',
|
|
12
12
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/components/my-license/'
|
|
13
13
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-dialogs",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.3-develop.1",
|
|
4
4
|
"description": "React Dialogs provide modal and non-modal windows for showing additional information to the user. KendoReact Dialogs package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@progress/kendo-licensing": "^1.7.2",
|
|
29
|
-
"@progress/kendo-react-buttons": "14.3.
|
|
30
|
-
"@progress/kendo-react-common": "14.3.
|
|
31
|
-
"@progress/kendo-react-intl": "14.3.
|
|
29
|
+
"@progress/kendo-react-buttons": "14.3.3-develop.1",
|
|
30
|
+
"@progress/kendo-react-common": "14.3.3-develop.1",
|
|
31
|
+
"@progress/kendo-react-intl": "14.3.3-develop.1",
|
|
32
32
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
33
33
|
"react": "^18.0.0 || ^19.0.0",
|
|
34
34
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"package": {
|
|
73
73
|
"productName": "KendoReact",
|
|
74
74
|
"productCode": "KENDOUIREACT",
|
|
75
|
-
"publishDate":
|
|
75
|
+
"publishDate": 1775723130,
|
|
76
76
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
77
77
|
}
|
|
78
78
|
},
|