@progress/kendo-react-dialogs 7.0.1 → 7.0.2-develop.2
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/Dialog.d.ts +1 -1
- package/Window.d.ts +1 -1
- package/dist/cdn/js/kendo-react-dialogs.js +1 -1
- package/index.d.mts +5 -0
- package/index.js +1 -1
- package/index.mjs +2 -2
- package/package.json +12 -6
package/Dialog.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
7
|
import { ZIndexContext } from '@progress/kendo-react-common';
|
|
8
8
|
import { DialogProps } from './DialogProps';
|
|
9
9
|
interface DialogState {
|
package/Window.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
7
|
import { WindowProps } from './WindowProps';
|
|
8
8
|
import { ZIndexContext } from '@progress/kendo-react-common';
|
|
9
9
|
import { Draggable } from '@progress/kendo-react-common';
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
(function(c,y){typeof exports=="object"&&typeof module<"u"?y(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")):typeof define=="function"&&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"],y):(c=typeof globalThis<"u"?globalThis:c||self,y(c.KendoReactDialogs={},c.React,c.ReactDOM,c.PropTypes,c.KendoReactButtons,c.KendoSvgIcons,c.KendoReactCommon,c.KendoReactIntl))})(this,function(c,y,Y,$,S,b,n,J){"use strict";"use client";function N(h){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(i,t,e.get?e:{enumerable:!0,get:()=>h[t]})}}return i.default=h,Object.freeze(i)}const s=N(y),P=N(Y),o=N($),Q=({children:h,onCloseButtonClick:i,id:t,closeIcon:e})=>s.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:t},s.createElement("span",{className:"k-window-title k-dialog-title"},h),s.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},e&&s.createElement(S.Button,{role:"button","aria-label":"Close",onClick:i,icon:"x",svgIcon:b.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),W=h=>{const i={layout:"stretched",...h},{layout:t,children:e}=i,r=n.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${t}`]:t});return s.createElement("div",{className:r},e)};W.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const L={name:"@progress/kendo-react-dialogs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},M="data-windowid",z=10002,C=2,tt=".k-window:not(.k-dialog), .k-dialog-wrapper",A=(h,i,t)=>{let e=h;if(i&&i.defaultView){let r=i.querySelectorAll(tt),d=!1;return r.forEach(p=>{let l=i.defaultView.getComputedStyle(p,null);if(p.getAttribute(M)!==t&&l.zIndex!==null){let u=parseInt(l.zIndex,10);u>=e&&(e=u,d=!0)}}),d?e+C:e}return e};class T extends s.Component{constructor(i){super(i),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.onCloseDialog=t=>{t.preventDefault(),n.dispatchEvent(this.props.onClose,t,this,void 0)},this.onKeyDown=t=>{t.keyCode===n.Keys.esc&&this.props.onClose&&(t.preventDefault(),this.onCloseDialog(t));const e=this.element;if(e&&t.keyCode===n.Keys.tab){const r='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',d=e.querySelectorAll(r),p=d[0],l=d[d.length-1],g=this.getDocument(),u=n.getActiveElement(g);t.shiftKey?(g&&u===p||g&&u===this.element)&&(l.focus(),t.preventDefault()):g&&u===l&&(p.focus(),t.preventDefault())}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:z:this.state.zIndex>(this.context?this.context+C:0)?this.state.zIndex:this.context+C,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,n.validatePackage(L),this.showLicenseWatermark=n.shouldShowValidationUI(L)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&(this.props.autoFocus&&this.element.focus(),this.setState({zIndex:A(this.getCurrentZIndex(),this.getDocument(),this._id)}))}render(){const i=this.props.id!==void 0?this.props.id:this.titleId,{title:t,width:e,height:r,children:d,minWidth:p,dir:l,style:g,contentStyle:u}=this.props,m=s.Children.toArray(d),E=this.getContent(m),D=this.getActionBar(m),I=t?{"aria-labelledby":i}:null,f=this.props.closeIcon!==void 0?this.props.closeIcon:!0,V=this.getCurrentZIndex(),X=s.createElement(n.ZIndexContext.Provider,{value:V},s.createElement("div",{[M]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:l,style:{zIndex:V,...g},ref:rt=>this.element=rt},s.createElement("div",{className:"k-overlay"}),s.createElement("div",{...I,className:n.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":i,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:e,height:r,minWidth:p}},this.props.title&&s.createElement(Q,{closeIcon:f,onCloseButtonClick:this.onCloseDialog,id:i},t),s.createElement("div",{className:"k-window-content k-dialog-content",style:u,id:this.contentId},E),D,this.showLicenseWatermark&&s.createElement(n.WatermarkOverlay,null))));return n.canUseDOM?this.props.appendTo!==null?P.createPortal(X,this.props.appendTo||document.body):X:null}getActionBar(i){return i.filter(t=>t&&t.type===W)}getContent(i){return i.filter(t=>t&&t.type!==W)}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}}T.displayName="Dialog",T.propTypes={title:o.any,id:o.string,dir:o.string,style:o.object,closeIcon:o.bool,width:o.oneOfType([o.number,o.string]),height:o.oneOfType([o.number,o.string]),minWidth:o.oneOfType([o.number,o.string]),autoFocus:o.bool},T.defaultProps={autoFocus:!1},T.contextType=n.ZIndexContext;const R=n.createPropsContext(),j=n.withIdHOC(n.withPropsContext(R,T));j.displayName="KendoReactDialog";var a=(h=>(h.DEFAULT="DEFAULT",h.FULLSCREEN="FULLSCREEN",h.MINIMIZED="MINIMIZED",h))(a||{});const k="dialogs.windowMaximizeButton",F="dialogs.windowMinimizeButton",U="dialogs.windowRestoreButton",O="dialogs.windowCloseButton",v={[k]:"maximize",[F]:"minimize",[U]:"restore",[O]:"close"},et=h=>{const{children:i,onCloseButtonClick:t,onMinimizeButtonClick:e,onFullScreenButtonClick:r,onRestoreButtonClick:d,onDoubleClick:p,stage:l,forwardedRef:g,id:u}=h,m=J.useLocalization(),E=h.minimizeButton?s.createElement(h.minimizeButton,{onClick:e,stage:l}):s.createElement(S.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:b.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:e,"aria-label":m.toLanguageString(F,v[F])}),D=h.maximizeButton?s.createElement(h.maximizeButton,{onClick:r,stage:l}):s.createElement(S.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:b.windowIcon,className:"k-window-titlebar-action",onClick:r,"aria-label":m.toLanguageString(k,v[k])}),I=h.restoreButton?s.createElement(h.restoreButton,{onClick:d,stage:l}):s.createElement(S.Button,{fillMode:"flat",icon:"window-restore",svgIcon:b.windowRestoreIcon,className:"k-window-titlebar-action",onClick:d,"aria-label":m.toLanguageString(U,v[U])}),f=h.closeButton?s.createElement(h.closeButton,{onClick:t,stage:l}):s.createElement(S.Button,{fillMode:"flat",icon:"x",svgIcon:b.xIcon,className:"k-window-titlebar-action",onClick:t,"aria-label":m.toLanguageString(O,v[O])});return s.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:g,onDoubleClick:p},s.createElement("span",{className:"k-window-title",id:u},i||""),s.createElement("div",{className:"k-window-titlebar-actions"},l===a.DEFAULT&&E,l===a.DEFAULT&&D,l!==a.DEFAULT&&I,f))},it=s.forwardRef((h,i)=>s.createElement(et,{...h,forwardedRef:i})),st=["n","e","s","w","se","sw","ne","nw"];class nt extends s.Component{render(){return s.createElement("div",{className:"k-resize-handles-wrapper"}," ",st.map((i,t)=>s.createElement(n.Draggable,{key:t,onDrag:e=>{const{event:r}=e;r.originalEvent.preventDefault(),this.props.onResize(r,{end:!1,direction:i})},onRelease:e=>{const{event:r}=e;r.originalEvent.preventDefault(),this.props.onResize(r,{end:!0,direction:i})}},s.createElement("div",{className:"k-resize-handle k-resize-"+i,style:{display:"block",touchAction:"none"}}))))}}class ot extends s.Component{shouldComponentUpdate(i){return i.shouldUpdateOnDrag||!i.isDragging}render(){return this.props.children}}const B=h=>{const i={layout:"end",...h},{layout:t,children:e}=i,r=n.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":t==="start","k-justify-content-center":t==="center","k-justify-content-end":t==="end","k-justify-content-stretch":t==="stretched"});return s.createElement("div",{className:r},e)};B.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const _=300,H=300,K=120,Z=100,w=5;class x extends s.Component{constructor(i){super(i),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.showLicenseWatermark=!1,this.onKeyDown=t=>{if(t.target!==t.currentTarget)return;const e=this.props.minWidth||K,r=this.props.minHeight||Z;if(t.ctrlKey&&this.props.resizable){switch(t.keyCode){case n.Keys.up:t.preventDefault(),r<=this.height-w&&this.setState({height:this.height-w});break;case n.Keys.down:t.preventDefault(),this.setState({height:this.height+w});break;case n.Keys.left:e<=this.width-w&&this.setState({width:this.width-w});break;case n.Keys.right:this.setState({width:this.width+w});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0);return}if(t.altKey){switch(t.keyCode){case n.Keys.up:this.windowStage===a.MINIMIZED?(this.handleRestore(t),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.DEFAULT})):this.windowStage===a.DEFAULT&&(this.handleFullscreen(t),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.FULLSCREEN}));break;case n.Keys.down:this.windowStage===a.FULLSCREEN?(this.handleRestore(t),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.DEFAULT})):this.windowStage===a.DEFAULT&&(this.handleMinimize(t),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.MINIMIZED}));break}return}if(!t.ctrlKey)switch(t.keyCode){case n.Keys.esc:this.props.onClose&&this.handleCloseWindow(t);return;case n.Keys.up:this.setState({top:this.state.top-w});break;case n.Keys.down:this.setState({top:this.state.top+w});break;case n.Keys.left:this.setState({left:this.state.left-w});break;case n.Keys.right:this.setState({left:this.state.left+w});break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==a.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==a.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:A(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout(()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0}))},this.getInitialTop=()=>{if(this.props.top!==void 0)return this.props.top;if(this.props.initialTop!==void 0)return this.props.initialTop;let t=H;if(this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),this.props.appendTo)return this.props.appendTo.offsetHeight/2-t/2;const e=this.getWindow();return e?e.innerHeight/2-t/2:0},this.getInitialLeft=()=>{if(this.props.left!==void 0)return this.props.left;if(this.props.initialLeft!==void 0)return this.props.initialLeft;let t=_;if(this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=_;return this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=H;return this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:a.MINIMIZED,height:0}),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),r=e?e.innerWidth:0,d=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:r,height:this.props.appendTo?this.props.appendTo.offsetHeight:d,stage:a.FULLSCREEN}),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===a.FULLSCREEN?this.setState({stage:a.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===a.MINIMIZED&&this.setState({stage:a.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),n.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===a.FULLSCREEN||this.windowStage===a.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const r=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,d=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,p=this.width,l=this.height,g=this.props.minWidth||K,u=this.props.minHeight||Z,m=this.top-d,E=this.left-r;let D=r-this.left,I=d-this.top;const f=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&u-(l+m)<0&&(this.top>0&&(f.height=l+m),f.top=d),e.direction.indexOf("s")>=0&&u-I<0&&(f.height=I),e.direction.indexOf("w")>=0&&g-(p+E)<0&&(this.left>0&&(f.width=p+E),f.left=r),e.direction.indexOf("e")>=0&&g-D<0&&(f.width=D),this.setState(f),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,r,d)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:r,end:d,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===a.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,r=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:r})}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:z:this.state.zIndex>(this.context?this.context+C:0)?this.state.zIndex:this.context+C,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},n.validatePackage(L),this.showLicenseWatermark=n.shouldShowValidationUI(L),this.state={stage:this.props.stage||a.DEFAULT,isDragging:!1,top:0,left:0,width:_,height:H,focused:!0,zIndex:z}}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){const i=this.getWindow();i&&i.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||a.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:A(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const t=this.getDocument();if(this.props.appendTo&&t){let e=this.props.appendTo.getBoundingClientRect(),r=t.body.getBoundingClientRect();this.offSetCoordinates.x=e.left-r.left,this.offSetCoordinates.y=e.top-r.top}this.mounted=!0}componentWillUnmount(){const i=this.getWindow();i&&i.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1}componentDidUpdate(){const i=this.getDocument();if(this.props.appendTo&&i){let t=this.props.appendTo.getBoundingClientRect(),e=i.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-e.left,this.offSetCoordinates.y=t.top-e.top}this.mounted=!0}render(){const i=s.Children.toArray(this.props.children),t=this.getContent(i),e=this.getActionBar(i),r=this.getCurrentZIndex(),d=n.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":this.state.stage==="MINIMIZED","k-window-focused":this.state.focused}),p=s.createElement(n.ZIndexContext.Provider,{value:r},s.createElement(s.Fragment,null,this.props.modal&&s.createElement("div",{className:"k-overlay",style:{zIndex:r,...this.props.overlayStyle}}),s.createElement("div",{id:this.props.id,[M]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:l=>{this.windowElement=l,this.element=l},className:d,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:r,...this.props.style}},s.createElement(ot,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},s.createElement(n.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,ref:l=>this.draggable=l},s.createElement(it,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==a.MINIMIZED?s.createElement(s.Fragment,null,s.createElement("div",{className:"k-window-content"},t),e):null,this.windowStage===a.DEFAULT&&this.props.resizable?s.createElement(nt,{onResize:this.handleResize}):null),this.showLicenseWatermark&&s.createElement(n.WatermarkOverlay,null))));return n.canUseDOM?this.props.appendTo!==null?P.createPortal(p,this.props.appendTo||document.body):p:null}get top(){return this.windowStage!==a.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==a.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let i=this.props.width||this.state.width;if(this.windowStage===a.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetWidth,i;const t=this.getWindow();i=t?t.innerWidth:0}return i}get height(){let i=this.props.height||this.state.height;if(this.windowStage===a.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetHeight,i;const t=this.getWindow();i=t?t.innerHeight:0}else this.windowStage===a.MINIMIZED&&(i=0);return i}get windowStage(){return this.props.stage||this.state.stage}getActionBar(i){return i.filter(t=>t&&t.type===B)}getContent(i){return i.filter(t=>t&&t.type!==B)}generateTitleId(){return"window-title-"+this._id}}x.displayName="Window",x.propTypes={width:o.number,height:o.number,left:o.number,top:o.number,initialWidth:o.number,initialHeight:o.number,initialLeft:o.number,initialTop:o.number,minWidth:o.number,minHeight:o.number,resizable:o.bool,draggable:o.bool,title:o.any,shouldUpdateOnDrag:o.bool,stage:o.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:o.string,id:o.string,style:o.object,overlayStyle:o.object},x.defaultProps={minWidth:K,minHeight:Z,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0},x.contextType=n.ZIndexContext;const q=n.createPropsContext(),G=n.withIdHOC(n.withPropsContext(q,x));G.displayName="KendoReactWindow",c.Dialog=j,c.DialogActionsBar=W,c.DialogPropsContext=R,c.Window=G,c.WindowActionsBar=B,c.WindowPropsContext=q,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
5
|
+
(function(c,S){typeof exports=="object"&&typeof module<"u"?S(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")):typeof define=="function"&&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"],S):(c=typeof globalThis<"u"?globalThis:c||self,S(c.KendoReactDialogs={},c.React,c.ReactDOM,c.PropTypes,c.KendoReactButtons,c.KendoSvgIcons,c.KendoReactCommon,c.KendoReactIntl))})(this,function(c,S,$,o,b,C,n,J){"use strict";"use client";function Z(h){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(i,t,e.get?e:{enumerable:!0,get:()=>h[t]})}}return i.default=h,Object.freeze(i)}const s=Z(S),R=Z($),Q=({children:h,onCloseButtonClick:i,id:t,closeIcon:e})=>s.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:t},s.createElement("span",{className:"k-window-title k-dialog-title"},h),s.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},e&&s.createElement(b.Button,{role:"button","aria-label":"Close",onClick:i,icon:"x",svgIcon:C.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),v=h=>{const i={layout:"stretched",...h},{layout:t,children:e}=i,r=n.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${t}`]:t});return s.createElement("div",{className:r},e)};v.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const y={name:"@progress/kendo-react-dialogs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},M="data-windowid",z=10002,x=2,P=".k-window:not(.k-dialog), .k-dialog-wrapper",A=(h,i,t)=>{let e=h;if(i&&i.defaultView){let r=i.querySelectorAll(P),d=!1;return r.forEach(p=>{let l=i.defaultView.getComputedStyle(p,null);if(p.getAttribute(M)!==t&&l.zIndex!==null){let u=parseInt(l.zIndex,10);u>=e&&(e=u,d=!0)}}),d?e+x:e}return e};class W extends s.Component{constructor(i){super(i),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.onCloseDialog=t=>{t.preventDefault(),n.dispatchEvent(this.props.onClose,t,this,void 0)},this.onKeyDown=t=>{t.keyCode===n.Keys.esc&&this.props.onClose&&(t.preventDefault(),this.onCloseDialog(t));const e=this.element;if(e&&t.keyCode===n.Keys.tab){const r='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',d=e.querySelectorAll(r),p=d[0],l=d[d.length-1],g=this.getDocument(),u=n.getActiveElement(g);t.shiftKey?(g&&u===p||g&&u===this.element)&&(l.focus(),t.preventDefault()):g&&u===l&&(p.focus(),t.preventDefault())}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:z:this.state.zIndex>(this.context?this.context+x:0)?this.state.zIndex:this.context+x,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,n.validatePackage(y),this.showLicenseWatermark=n.shouldShowValidationUI(y)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&(this.props.autoFocus&&this.element.focus(),this.setState({zIndex:A(this.getCurrentZIndex(),this.getDocument(),this._id)}))}render(){const i=this.props.id!==void 0?this.props.id:this.titleId,{title:t,width:e,height:r,children:d,minWidth:p,dir:l,style:g,contentStyle:u}=this.props,m=s.Children.toArray(d),E=this.getContent(m),D=this.getActionBar(m),I=t?{"aria-labelledby":i}:null,f=this.props.closeIcon!==void 0?this.props.closeIcon:!0,X=this.getCurrentZIndex(),Y=s.createElement(n.ZIndexContext.Provider,{value:X},s.createElement("div",{[M]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:l,style:{zIndex:X,...g},ref:ot=>this.element=ot},s.createElement("div",{className:"k-overlay"}),s.createElement("div",{...I,className:n.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":i,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:e,height:r,minWidth:p}},this.props.title&&s.createElement(Q,{closeIcon:f,onCloseButtonClick:this.onCloseDialog,id:i},t),s.createElement("div",{className:"k-window-content k-dialog-content",style:u,id:this.contentId},E),D,this.showLicenseWatermark&&s.createElement(n.WatermarkOverlay,null))));return n.canUseDOM?this.props.appendTo!==null?R.createPortal(Y,this.props.appendTo||document.body):Y:null}getActionBar(i){return i.filter(t=>t&&t.type===v)}getContent(i){return i.filter(t=>t&&t.type!==v)}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}}W.displayName="Dialog",W.propTypes={title:o.any,id:o.string,dir:o.string,style:o.object,closeIcon:o.bool,width:o.oneOfType([o.number,o.string]),height:o.oneOfType([o.number,o.string]),minWidth:o.oneOfType([o.number,o.string]),autoFocus:o.bool},W.defaultProps={autoFocus:!1},W.contextType=n.ZIndexContext;const j=n.createPropsContext(),q=n.withIdHOC(n.withPropsContext(j,W));q.displayName="KendoReactDialog";var a=(h=>(h.DEFAULT="DEFAULT",h.FULLSCREEN="FULLSCREEN",h.MINIMIZED="MINIMIZED",h))(a||{});const T="dialogs.windowMaximizeButton",k="dialogs.windowMinimizeButton",F="dialogs.windowRestoreButton",U="dialogs.windowCloseButton",B={[T]:"maximize",[k]:"minimize",[F]:"restore",[U]:"close"},tt=h=>{const{children:i,onCloseButtonClick:t,onMinimizeButtonClick:e,onFullScreenButtonClick:r,onRestoreButtonClick:d,onDoubleClick:p,stage:l,forwardedRef:g,id:u}=h,m=J.useLocalization(),E=h.minimizeButton?s.createElement(h.minimizeButton,{onClick:e,stage:l}):s.createElement(b.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:C.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:e,"aria-label":m.toLanguageString(k,B[k])}),D=h.maximizeButton?s.createElement(h.maximizeButton,{onClick:r,stage:l}):s.createElement(b.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:C.windowIcon,className:"k-window-titlebar-action",onClick:r,"aria-label":m.toLanguageString(T,B[T])}),I=h.restoreButton?s.createElement(h.restoreButton,{onClick:d,stage:l}):s.createElement(b.Button,{fillMode:"flat",icon:"window-restore",svgIcon:C.windowRestoreIcon,className:"k-window-titlebar-action",onClick:d,"aria-label":m.toLanguageString(F,B[F])}),f=h.closeButton?s.createElement(h.closeButton,{onClick:t,stage:l}):s.createElement(b.Button,{fillMode:"flat",icon:"x",svgIcon:C.xIcon,className:"k-window-titlebar-action",onClick:t,"aria-label":m.toLanguageString(U,B[U])});return s.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:g,onDoubleClick:p},s.createElement("span",{className:"k-window-title",id:u},i||""),s.createElement("div",{className:"k-window-titlebar-actions"},l===a.DEFAULT&&E,l===a.DEFAULT&&D,l!==a.DEFAULT&&I,f))},et=s.forwardRef((h,i)=>s.createElement(tt,{...h,forwardedRef:i})),it=["n","e","s","w","se","sw","ne","nw"];class st extends s.Component{render(){return s.createElement("div",{className:"k-resize-handles-wrapper"}," ",it.map((i,t)=>s.createElement(n.Draggable,{key:t,onDrag:e=>{const{event:r}=e;r.originalEvent.preventDefault(),this.props.onResize(r,{end:!1,direction:i})},onRelease:e=>{const{event:r}=e;r.originalEvent.preventDefault(),this.props.onResize(r,{end:!0,direction:i})}},s.createElement("div",{className:"k-resize-handle k-resize-"+i,style:{display:"block",touchAction:"none"}}))))}}class nt extends s.Component{shouldComponentUpdate(i){return i.shouldUpdateOnDrag||!i.isDragging}render(){return this.props.children}}const N=h=>{const i={layout:"end",...h},{layout:t,children:e}=i,r=n.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":t==="start","k-justify-content-center":t==="center","k-justify-content-end":t==="end","k-justify-content-stretch":t==="stretched"});return s.createElement("div",{className:r},e)};N.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const O=300,H=300,_=120,K=100,w=5;class L extends s.Component{constructor(i){super(i),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.showLicenseWatermark=!1,this.onKeyDown=t=>{if(t.target!==t.currentTarget)return;const e=this.props.minWidth||_,r=this.props.minHeight||K;if(t.ctrlKey&&this.props.resizable){switch(t.keyCode){case n.Keys.up:t.preventDefault(),r<=this.height-w&&this.setState({height:this.height-w});break;case n.Keys.down:t.preventDefault(),this.setState({height:this.height+w});break;case n.Keys.left:e<=this.width-w&&this.setState({width:this.width-w});break;case n.Keys.right:this.setState({width:this.width+w});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0);return}if(t.altKey){switch(t.keyCode){case n.Keys.up:this.windowStage===a.MINIMIZED?(this.handleRestore(t),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.DEFAULT})):this.windowStage===a.DEFAULT&&(this.handleFullscreen(t),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.FULLSCREEN}));break;case n.Keys.down:this.windowStage===a.FULLSCREEN?(this.handleRestore(t),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.DEFAULT})):this.windowStage===a.DEFAULT&&(this.handleMinimize(t),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.MINIMIZED}));break}return}if(!t.ctrlKey)switch(t.keyCode){case n.Keys.esc:this.props.onClose&&this.handleCloseWindow(t);return;case n.Keys.up:this.setState({top:this.state.top-w});break;case n.Keys.down:this.setState({top:this.state.top+w});break;case n.Keys.left:this.setState({left:this.state.left-w});break;case n.Keys.right:this.setState({left:this.state.left+w});break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==a.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==a.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:A(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout(()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0}))},this.getInitialTop=()=>{if(this.props.top!==void 0)return this.props.top;if(this.props.initialTop!==void 0)return this.props.initialTop;let t=H;if(this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),this.props.appendTo)return this.props.appendTo.offsetHeight/2-t/2;const e=this.getWindow();return e?e.innerHeight/2-t/2:0},this.getInitialLeft=()=>{if(this.props.left!==void 0)return this.props.left;if(this.props.initialLeft!==void 0)return this.props.initialLeft;let t=O;if(this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=O;return this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=H;return this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:a.MINIMIZED,height:0}),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),r=e?e.innerWidth:0,d=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:r,height:this.props.appendTo?this.props.appendTo.offsetHeight:d,stage:a.FULLSCREEN}),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===a.FULLSCREEN?this.setState({stage:a.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===a.MINIMIZED&&this.setState({stage:a.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),n.dispatchEvent(this.props.onStageChange,t,this,{state:a.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),n.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===a.FULLSCREEN||this.windowStage===a.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const r=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,d=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,p=this.width,l=this.height,g=this.props.minWidth||_,u=this.props.minHeight||K,m=this.top-d,E=this.left-r;let D=r-this.left,I=d-this.top;const f=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&u-(l+m)<0&&(this.top>0&&(f.height=l+m),f.top=d),e.direction.indexOf("s")>=0&&u-I<0&&(f.height=I),e.direction.indexOf("w")>=0&&g-(p+E)<0&&(this.left>0&&(f.width=p+E),f.left=r),e.direction.indexOf("e")>=0&&g-D<0&&(f.width=D),this.setState(f),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,r,d)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:r,end:d,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===a.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,r=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:r})}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:z:this.state.zIndex>(this.context?this.context+x:0)?this.state.zIndex:this.context+x,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},n.validatePackage(y),this.showLicenseWatermark=n.shouldShowValidationUI(y),this.state={stage:this.props.stage||a.DEFAULT,isDragging:!1,top:0,left:0,width:O,height:H,focused:!0,zIndex:z}}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){const i=this.getWindow();i&&i.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||a.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:A(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const t=this.getDocument();if(this.props.appendTo&&t){let e=this.props.appendTo.getBoundingClientRect(),r=t.body.getBoundingClientRect();this.offSetCoordinates.x=e.left-r.left,this.offSetCoordinates.y=e.top-r.top}this.mounted=!0}componentWillUnmount(){const i=this.getWindow();i&&i.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1}componentDidUpdate(){const i=this.getDocument();if(this.props.appendTo&&i){let t=this.props.appendTo.getBoundingClientRect(),e=i.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-e.left,this.offSetCoordinates.y=t.top-e.top}this.mounted=!0}render(){const i=s.Children.toArray(this.props.children),t=this.getContent(i),e=this.getActionBar(i),r=this.getCurrentZIndex(),d=n.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":this.state.stage==="MINIMIZED","k-window-focused":this.state.focused}),p=s.createElement(n.ZIndexContext.Provider,{value:r},s.createElement(s.Fragment,null,this.props.modal&&s.createElement("div",{className:"k-overlay",style:{zIndex:r,...this.props.overlayStyle}}),s.createElement("div",{id:this.props.id,[M]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:l=>{this.windowElement=l,this.element=l},className:d,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:r,...this.props.style}},s.createElement(nt,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},s.createElement(n.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,ref:l=>this.draggable=l},s.createElement(et,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==a.MINIMIZED?s.createElement(s.Fragment,null,s.createElement("div",{className:"k-window-content"},t),e):null,this.windowStage===a.DEFAULT&&this.props.resizable?s.createElement(st,{onResize:this.handleResize}):null),this.showLicenseWatermark&&s.createElement(n.WatermarkOverlay,null))));return n.canUseDOM?this.props.appendTo!==null?R.createPortal(p,this.props.appendTo||document.body):p:null}get top(){return this.windowStage!==a.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==a.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let i=this.props.width||this.state.width;if(this.windowStage===a.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetWidth,i;const t=this.getWindow();i=t?t.innerWidth:0}return i}get height(){let i=this.props.height||this.state.height;if(this.windowStage===a.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetHeight,i;const t=this.getWindow();i=t?t.innerHeight:0}else this.windowStage===a.MINIMIZED&&(i=0);return i}get windowStage(){return this.props.stage||this.state.stage}getActionBar(i){return i.filter(t=>t&&t.type===N)}getContent(i){return i.filter(t=>t&&t.type!==N)}generateTitleId(){return"window-title-"+this._id}}L.displayName="Window",L.propTypes={width:o.number,height:o.number,left:o.number,top:o.number,initialWidth:o.number,initialHeight:o.number,initialLeft:o.number,initialTop:o.number,minWidth:o.number,minHeight:o.number,resizable:o.bool,draggable:o.bool,title:o.any,shouldUpdateOnDrag:o.bool,stage:o.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:o.string,id:o.string,style:o.object,overlayStyle:o.object},L.defaultProps={minWidth:_,minHeight:K,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0},L.contextType=n.ZIndexContext;const G=n.createPropsContext(),V=n.withIdHOC(n.withPropsContext(G,L));V.displayName="KendoReactWindow",c.Dialog=q,c.DialogActionsBar=v,c.DialogPropsContext=j,c.Window=V,c.WindowActionsBar=N,c.WindowPropsContext=G,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
package/index.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export * from './index';
|
package/index.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),Y=require("react-dom"),$=require("prop-types"),I=require("@progress/kendo-react-buttons"),D=require("@progress/kendo-svg-icons"),o=require("@progress/kendo-react-common"),J=require("@progress/kendo-react-intl");function O(h){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(i,t,e.get?e:{enumerable:!0,get:()=>h[t]})}}return i.default=h,Object.freeze(i)}const s=O(X),P=O(Y),n=O($),Q=({children:h,onCloseButtonClick:i,id:t,closeIcon:e})=>s.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:t},s.createElement("span",{className:"k-window-title k-dialog-title"},h),s.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},e&&s.createElement(I.Button,{role:"button","aria-label":"Close",onClick:i,icon:"x",svgIcon:D.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),T=h=>{const i={layout:"stretched",...h},{layout:t,children:e}=i,a=o.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${t}`]:t});return s.createElement("div",{className:a},e)};T.propTypes={children:n.any,layout:n.oneOf(["start","center","end","stretched"])};const x={name:"@progress/kendo-react-dialogs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},_="data-windowid",B=10002,S=2,tt=".k-window:not(.k-dialog), .k-dialog-wrapper",N=(h,i,t)=>{let e=h;if(i&&i.defaultView){let a=i.querySelectorAll(tt),d=!1;return a.forEach(c=>{let l=i.defaultView.getComputedStyle(c,null);if(c.getAttribute(_)!==t&&l.zIndex!==null){let p=parseInt(l.zIndex,10);p>=e&&(e=p,d=!0)}}),d?e+S:e}return e};class y extends s.Component{constructor(i){super(i),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.onCloseDialog=t=>{t.preventDefault(),o.dispatchEvent(this.props.onClose,t,this,void 0)},this.onKeyDown=t=>{t.keyCode===o.Keys.esc&&this.props.onClose&&(t.preventDefault(),this.onCloseDialog(t));const e=this.element;if(e&&t.keyCode===o.Keys.tab){const a='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',d=e.querySelectorAll(a),c=d[0],l=d[d.length-1],g=this.getDocument(),p=o.getActiveElement(g);t.shiftKey?(g&&p===c||g&&p===this.element)&&(l.focus(),t.preventDefault()):g&&p===l&&(c.focus(),t.preventDefault())}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:B:this.state.zIndex>(this.context?this.context+S:0)?this.state.zIndex:this.context+S,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,o.validatePackage(x),this.showLicenseWatermark=o.shouldShowValidationUI(x)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&(this.props.autoFocus&&this.element.focus(),this.setState({zIndex:N(this.getCurrentZIndex(),this.getDocument(),this._id)}))}render(){const i=this.props.id!==void 0?this.props.id:this.titleId,{title:t,width:e,height:a,children:d,minWidth:c,dir:l,style:g,contentStyle:p}=this.props,w=s.Children.toArray(d),m=this.getContent(w),C=this.getActionBar(w),E=t?{"aria-labelledby":i}:null,u=this.props.closeIcon!==void 0?this.props.closeIcon:!0,H=this.getCurrentZIndex(),Z=s.createElement(o.ZIndexContext.Provider,{value:H},s.createElement("div",{[_]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:l,style:{zIndex:H,...g},ref:V=>this.element=V},s.createElement("div",{className:"k-overlay"}),s.createElement("div",{...E,className:o.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":i,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:e,height:a,minWidth:c}},this.props.title&&s.createElement(Q,{closeIcon:u,onCloseButtonClick:this.onCloseDialog,id:i},t),s.createElement("div",{className:"k-window-content k-dialog-content",style:p,id:this.contentId},m),C,this.showLicenseWatermark&&s.createElement(o.WatermarkOverlay,null))));return o.canUseDOM?this.props.appendTo!==null?P.createPortal(Z,this.props.appendTo||document.body):Z:null}getActionBar(i){return i.filter(t=>t&&t.type===T)}getContent(i){return i.filter(t=>t&&t.type!==T)}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}}y.displayName="Dialog";y.propTypes={title:n.any,id:n.string,dir:n.string,style:n.object,closeIcon:n.bool,width:n.oneOfType([n.number,n.string]),height:n.oneOfType([n.number,n.string]),minWidth:n.oneOfType([n.number,n.string]),autoFocus:n.bool};y.defaultProps={autoFocus:!1};y.contextType=o.ZIndexContext;const K=o.createPropsContext(),j=o.withIdHOC(o.withPropsContext(K,y));j.displayName="KendoReactDialog";var r=(h=>(h.DEFAULT="DEFAULT",h.FULLSCREEN="FULLSCREEN",h.MINIMIZED="MINIMIZED",h))(r||{});const M="dialogs.windowMaximizeButton",z="dialogs.windowMinimizeButton",R="dialogs.windowRestoreButton",A="dialogs.windowCloseButton",k={[M]:"maximize",[z]:"minimize",[R]:"restore",[A]:"close"},et=h=>{const{children:i,onCloseButtonClick:t,onMinimizeButtonClick:e,onFullScreenButtonClick:a,onRestoreButtonClick:d,onDoubleClick:c,stage:l,forwardedRef:g,id:p}=h,w=J.useLocalization(),m=h.minimizeButton?s.createElement(h.minimizeButton,{onClick:e,stage:l}):s.createElement(I.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:D.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:e,"aria-label":w.toLanguageString(z,k[z])}),C=h.maximizeButton?s.createElement(h.maximizeButton,{onClick:a,stage:l}):s.createElement(I.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:D.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":w.toLanguageString(M,k[M])}),E=h.restoreButton?s.createElement(h.restoreButton,{onClick:d,stage:l}):s.createElement(I.Button,{fillMode:"flat",icon:"window-restore",svgIcon:D.windowRestoreIcon,className:"k-window-titlebar-action",onClick:d,"aria-label":w.toLanguageString(R,k[R])}),u=h.closeButton?s.createElement(h.closeButton,{onClick:t,stage:l}):s.createElement(I.Button,{fillMode:"flat",icon:"x",svgIcon:D.xIcon,className:"k-window-titlebar-action",onClick:t,"aria-label":w.toLanguageString(A,k[A])});return s.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:g,onDoubleClick:c},s.createElement("span",{className:"k-window-title",id:p},i||""),s.createElement("div",{className:"k-window-titlebar-actions"},l===r.DEFAULT&&m,l===r.DEFAULT&&C,l!==r.DEFAULT&&E,u))},it=s.forwardRef((h,i)=>s.createElement(et,{...h,forwardedRef:i})),st=["n","e","s","w","se","sw","ne","nw"];class ot extends s.Component{render(){return s.createElement("div",{className:"k-resize-handles-wrapper"}," ",st.map((i,t)=>s.createElement(o.Draggable,{key:t,onDrag:e=>{const{event:a}=e;a.originalEvent.preventDefault(),this.props.onResize(a,{end:!1,direction:i})},onRelease:e=>{const{event:a}=e;a.originalEvent.preventDefault(),this.props.onResize(a,{end:!0,direction:i})}},s.createElement("div",{className:"k-resize-handle k-resize-"+i,style:{display:"block",touchAction:"none"}}))))}}class nt extends s.Component{shouldComponentUpdate(i){return i.shouldUpdateOnDrag||!i.isDragging}render(){return this.props.children}}const v=h=>{const i={layout:"end",...h},{layout:t,children:e}=i,a=o.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":t==="start","k-justify-content-center":t==="center","k-justify-content-end":t==="end","k-justify-content-stretch":t==="stretched"});return s.createElement("div",{className:a},e)};v.propTypes={children:n.any,layout:n.oneOf(["start","center","end","stretched"])};const W=300,L=300,F=120,U=100,f=5;class b extends s.Component{constructor(i){super(i),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.showLicenseWatermark=!1,this.onKeyDown=t=>{if(t.target!==t.currentTarget)return;const e=this.props.minWidth||F,a=this.props.minHeight||U;if(t.ctrlKey&&this.props.resizable){switch(t.keyCode){case o.Keys.up:t.preventDefault(),a<=this.height-f&&this.setState({height:this.height-f});break;case o.Keys.down:t.preventDefault(),this.setState({height:this.height+f});break;case o.Keys.left:e<=this.width-f&&this.setState({width:this.width-f});break;case o.Keys.right:this.setState({width:this.width+f});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0);return}if(t.altKey){switch(t.keyCode){case o.Keys.up:this.windowStage===r.MINIMIZED?(this.handleRestore(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.DEFAULT})):this.windowStage===r.DEFAULT&&(this.handleFullscreen(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.FULLSCREEN}));break;case o.Keys.down:this.windowStage===r.FULLSCREEN?(this.handleRestore(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.DEFAULT})):this.windowStage===r.DEFAULT&&(this.handleMinimize(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.MINIMIZED}));break}return}if(!t.ctrlKey)switch(t.keyCode){case o.Keys.esc:this.props.onClose&&this.handleCloseWindow(t);return;case o.Keys.up:this.setState({top:this.state.top-f});break;case o.Keys.down:this.setState({top:this.state.top+f});break;case o.Keys.left:this.setState({left:this.state.left-f});break;case o.Keys.right:this.setState({left:this.state.left+f});break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==r.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==r.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:N(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout(()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0}))},this.getInitialTop=()=>{if(this.props.top!==void 0)return this.props.top;if(this.props.initialTop!==void 0)return this.props.initialTop;let t=L;if(this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),this.props.appendTo)return this.props.appendTo.offsetHeight/2-t/2;const e=this.getWindow();return e?e.innerHeight/2-t/2:0},this.getInitialLeft=()=>{if(this.props.left!==void 0)return this.props.left;if(this.props.initialLeft!==void 0)return this.props.initialLeft;let t=W;if(this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=W;return this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=L;return this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:r.MINIMIZED,height:0}),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),a=e?e.innerWidth:0,d=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:a,height:this.props.appendTo?this.props.appendTo.offsetHeight:d,stage:r.FULLSCREEN}),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===r.FULLSCREEN?this.setState({stage:r.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===r.MINIMIZED&&this.setState({stage:r.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),o.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===r.FULLSCREEN||this.windowStage===r.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const a=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,d=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,c=this.width,l=this.height,g=this.props.minWidth||F,p=this.props.minHeight||U,w=this.top-d,m=this.left-a;let C=a-this.left,E=d-this.top;const u=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&p-(l+w)<0&&(this.top>0&&(u.height=l+w),u.top=d),e.direction.indexOf("s")>=0&&p-E<0&&(u.height=E),e.direction.indexOf("w")>=0&&g-(c+m)<0&&(this.left>0&&(u.width=c+m),u.left=a),e.direction.indexOf("e")>=0&&g-C<0&&(u.width=C),this.setState(u),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,a,d)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:a,end:d,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===r.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,a=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:a})}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:B:this.state.zIndex>(this.context?this.context+S:0)?this.state.zIndex:this.context+S,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},o.validatePackage(x),this.showLicenseWatermark=o.shouldShowValidationUI(x),this.state={stage:this.props.stage||r.DEFAULT,isDragging:!1,top:0,left:0,width:W,height:L,focused:!0,zIndex:B}}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){const i=this.getWindow();i&&i.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||r.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:N(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const t=this.getDocument();if(this.props.appendTo&&t){let e=this.props.appendTo.getBoundingClientRect(),a=t.body.getBoundingClientRect();this.offSetCoordinates.x=e.left-a.left,this.offSetCoordinates.y=e.top-a.top}this.mounted=!0}componentWillUnmount(){const i=this.getWindow();i&&i.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1}componentDidUpdate(){const i=this.getDocument();if(this.props.appendTo&&i){let t=this.props.appendTo.getBoundingClientRect(),e=i.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-e.left,this.offSetCoordinates.y=t.top-e.top}this.mounted=!0}render(){const i=s.Children.toArray(this.props.children),t=this.getContent(i),e=this.getActionBar(i),a=this.getCurrentZIndex(),d=o.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":this.state.stage==="MINIMIZED","k-window-focused":this.state.focused}),c=s.createElement(o.ZIndexContext.Provider,{value:a},s.createElement(s.Fragment,null,this.props.modal&&s.createElement("div",{className:"k-overlay",style:{zIndex:a,...this.props.overlayStyle}}),s.createElement("div",{id:this.props.id,[_]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:l=>{this.windowElement=l,this.element=l},className:d,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:a,...this.props.style}},s.createElement(nt,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},s.createElement(o.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,ref:l=>this.draggable=l},s.createElement(it,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==r.MINIMIZED?s.createElement(s.Fragment,null,s.createElement("div",{className:"k-window-content"},t),e):null,this.windowStage===r.DEFAULT&&this.props.resizable?s.createElement(ot,{onResize:this.handleResize}):null),this.showLicenseWatermark&&s.createElement(o.WatermarkOverlay,null))));return o.canUseDOM?this.props.appendTo!==null?P.createPortal(c,this.props.appendTo||document.body):c:null}get top(){return this.windowStage!==r.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==r.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let i=this.props.width||this.state.width;if(this.windowStage===r.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetWidth,i;const t=this.getWindow();i=t?t.innerWidth:0}return i}get height(){let i=this.props.height||this.state.height;if(this.windowStage===r.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetHeight,i;const t=this.getWindow();i=t?t.innerHeight:0}else this.windowStage===r.MINIMIZED&&(i=0);return i}get windowStage(){return this.props.stage||this.state.stage}getActionBar(i){return i.filter(t=>t&&t.type===v)}getContent(i){return i.filter(t=>t&&t.type!==v)}generateTitleId(){return"window-title-"+this._id}}b.displayName="Window";b.propTypes={width:n.number,height:n.number,left:n.number,top:n.number,initialWidth:n.number,initialHeight:n.number,initialLeft:n.number,initialTop:n.number,minWidth:n.number,minHeight:n.number,resizable:n.bool,draggable:n.bool,title:n.any,shouldUpdateOnDrag:n.bool,stage:n.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:n.string,id:n.string,style:n.object,overlayStyle:n.object};b.defaultProps={minWidth:F,minHeight:U,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0};b.contextType=o.ZIndexContext;const q=o.createPropsContext(),G=o.withIdHOC(o.withPropsContext(q,b));G.displayName="KendoReactWindow";exports.Dialog=j;exports.DialogActionsBar=T;exports.DialogPropsContext=K;exports.Window=G;exports.WindowActionsBar=v;exports.WindowPropsContext=q;
|
|
5
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),Y=require("react-dom"),n=require("prop-types"),I=require("@progress/kendo-react-buttons"),D=require("@progress/kendo-svg-icons"),o=require("@progress/kendo-react-common"),$=require("@progress/kendo-react-intl");function Z(h){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(i,t,e.get?e:{enumerable:!0,get:()=>h[t]})}}return i.default=h,Object.freeze(i)}const s=Z(X),K=Z(Y),J=({children:h,onCloseButtonClick:i,id:t,closeIcon:e})=>s.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:t},s.createElement("span",{className:"k-window-title k-dialog-title"},h),s.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},e&&s.createElement(I.Button,{role:"button","aria-label":"Close",onClick:i,icon:"x",svgIcon:D.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),T=h=>{const i={layout:"stretched",...h},{layout:t,children:e}=i,a=o.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${t}`]:t});return s.createElement("div",{className:a},e)};T.propTypes={children:n.any,layout:n.oneOf(["start","center","end","stretched"])};const x={name:"@progress/kendo-react-dialogs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},O="data-windowid",B=10002,S=2,Q=".k-window:not(.k-dialog), .k-dialog-wrapper",N=(h,i,t)=>{let e=h;if(i&&i.defaultView){let a=i.querySelectorAll(Q),d=!1;return a.forEach(c=>{let l=i.defaultView.getComputedStyle(c,null);if(c.getAttribute(O)!==t&&l.zIndex!==null){let p=parseInt(l.zIndex,10);p>=e&&(e=p,d=!0)}}),d?e+S:e}return e};class y extends s.Component{constructor(i){super(i),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.onCloseDialog=t=>{t.preventDefault(),o.dispatchEvent(this.props.onClose,t,this,void 0)},this.onKeyDown=t=>{t.keyCode===o.Keys.esc&&this.props.onClose&&(t.preventDefault(),this.onCloseDialog(t));const e=this.element;if(e&&t.keyCode===o.Keys.tab){const a='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',d=e.querySelectorAll(a),c=d[0],l=d[d.length-1],g=this.getDocument(),p=o.getActiveElement(g);t.shiftKey?(g&&p===c||g&&p===this.element)&&(l.focus(),t.preventDefault()):g&&p===l&&(c.focus(),t.preventDefault())}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:B:this.state.zIndex>(this.context?this.context+S:0)?this.state.zIndex:this.context+S,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,o.validatePackage(x),this.showLicenseWatermark=o.shouldShowValidationUI(x)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&(this.props.autoFocus&&this.element.focus(),this.setState({zIndex:N(this.getCurrentZIndex(),this.getDocument(),this._id)}))}render(){const i=this.props.id!==void 0?this.props.id:this.titleId,{title:t,width:e,height:a,children:d,minWidth:c,dir:l,style:g,contentStyle:p}=this.props,w=s.Children.toArray(d),m=this.getContent(w),C=this.getActionBar(w),E=t?{"aria-labelledby":i}:null,u=this.props.closeIcon!==void 0?this.props.closeIcon:!0,H=this.getCurrentZIndex(),_=s.createElement(o.ZIndexContext.Provider,{value:H},s.createElement("div",{[O]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:l,style:{zIndex:H,...g},ref:V=>this.element=V},s.createElement("div",{className:"k-overlay"}),s.createElement("div",{...E,className:o.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":i,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:e,height:a,minWidth:c}},this.props.title&&s.createElement(J,{closeIcon:u,onCloseButtonClick:this.onCloseDialog,id:i},t),s.createElement("div",{className:"k-window-content k-dialog-content",style:p,id:this.contentId},m),C,this.showLicenseWatermark&&s.createElement(o.WatermarkOverlay,null))));return o.canUseDOM?this.props.appendTo!==null?K.createPortal(_,this.props.appendTo||document.body):_:null}getActionBar(i){return i.filter(t=>t&&t.type===T)}getContent(i){return i.filter(t=>t&&t.type!==T)}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}}y.displayName="Dialog";y.propTypes={title:n.any,id:n.string,dir:n.string,style:n.object,closeIcon:n.bool,width:n.oneOfType([n.number,n.string]),height:n.oneOfType([n.number,n.string]),minWidth:n.oneOfType([n.number,n.string]),autoFocus:n.bool};y.defaultProps={autoFocus:!1};y.contextType=o.ZIndexContext;const P=o.createPropsContext(),j=o.withIdHOC(o.withPropsContext(P,y));j.displayName="KendoReactDialog";var r=(h=>(h.DEFAULT="DEFAULT",h.FULLSCREEN="FULLSCREEN",h.MINIMIZED="MINIMIZED",h))(r||{});const M="dialogs.windowMaximizeButton",z="dialogs.windowMinimizeButton",R="dialogs.windowRestoreButton",A="dialogs.windowCloseButton",k={[M]:"maximize",[z]:"minimize",[R]:"restore",[A]:"close"},tt=h=>{const{children:i,onCloseButtonClick:t,onMinimizeButtonClick:e,onFullScreenButtonClick:a,onRestoreButtonClick:d,onDoubleClick:c,stage:l,forwardedRef:g,id:p}=h,w=$.useLocalization(),m=h.minimizeButton?s.createElement(h.minimizeButton,{onClick:e,stage:l}):s.createElement(I.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:D.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:e,"aria-label":w.toLanguageString(z,k[z])}),C=h.maximizeButton?s.createElement(h.maximizeButton,{onClick:a,stage:l}):s.createElement(I.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:D.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":w.toLanguageString(M,k[M])}),E=h.restoreButton?s.createElement(h.restoreButton,{onClick:d,stage:l}):s.createElement(I.Button,{fillMode:"flat",icon:"window-restore",svgIcon:D.windowRestoreIcon,className:"k-window-titlebar-action",onClick:d,"aria-label":w.toLanguageString(R,k[R])}),u=h.closeButton?s.createElement(h.closeButton,{onClick:t,stage:l}):s.createElement(I.Button,{fillMode:"flat",icon:"x",svgIcon:D.xIcon,className:"k-window-titlebar-action",onClick:t,"aria-label":w.toLanguageString(A,k[A])});return s.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:g,onDoubleClick:c},s.createElement("span",{className:"k-window-title",id:p},i||""),s.createElement("div",{className:"k-window-titlebar-actions"},l===r.DEFAULT&&m,l===r.DEFAULT&&C,l!==r.DEFAULT&&E,u))},et=s.forwardRef((h,i)=>s.createElement(tt,{...h,forwardedRef:i})),it=["n","e","s","w","se","sw","ne","nw"];class st extends s.Component{render(){return s.createElement("div",{className:"k-resize-handles-wrapper"}," ",it.map((i,t)=>s.createElement(o.Draggable,{key:t,onDrag:e=>{const{event:a}=e;a.originalEvent.preventDefault(),this.props.onResize(a,{end:!1,direction:i})},onRelease:e=>{const{event:a}=e;a.originalEvent.preventDefault(),this.props.onResize(a,{end:!0,direction:i})}},s.createElement("div",{className:"k-resize-handle k-resize-"+i,style:{display:"block",touchAction:"none"}}))))}}class ot extends s.Component{shouldComponentUpdate(i){return i.shouldUpdateOnDrag||!i.isDragging}render(){return this.props.children}}const v=h=>{const i={layout:"end",...h},{layout:t,children:e}=i,a=o.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":t==="start","k-justify-content-center":t==="center","k-justify-content-end":t==="end","k-justify-content-stretch":t==="stretched"});return s.createElement("div",{className:a},e)};v.propTypes={children:n.any,layout:n.oneOf(["start","center","end","stretched"])};const W=300,L=300,F=120,U=100,f=5;class b extends s.Component{constructor(i){super(i),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.showLicenseWatermark=!1,this.onKeyDown=t=>{if(t.target!==t.currentTarget)return;const e=this.props.minWidth||F,a=this.props.minHeight||U;if(t.ctrlKey&&this.props.resizable){switch(t.keyCode){case o.Keys.up:t.preventDefault(),a<=this.height-f&&this.setState({height:this.height-f});break;case o.Keys.down:t.preventDefault(),this.setState({height:this.height+f});break;case o.Keys.left:e<=this.width-f&&this.setState({width:this.width-f});break;case o.Keys.right:this.setState({width:this.width+f});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0);return}if(t.altKey){switch(t.keyCode){case o.Keys.up:this.windowStage===r.MINIMIZED?(this.handleRestore(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.DEFAULT})):this.windowStage===r.DEFAULT&&(this.handleFullscreen(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.FULLSCREEN}));break;case o.Keys.down:this.windowStage===r.FULLSCREEN?(this.handleRestore(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.DEFAULT})):this.windowStage===r.DEFAULT&&(this.handleMinimize(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.MINIMIZED}));break}return}if(!t.ctrlKey)switch(t.keyCode){case o.Keys.esc:this.props.onClose&&this.handleCloseWindow(t);return;case o.Keys.up:this.setState({top:this.state.top-f});break;case o.Keys.down:this.setState({top:this.state.top+f});break;case o.Keys.left:this.setState({left:this.state.left-f});break;case o.Keys.right:this.setState({left:this.state.left+f});break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==r.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==r.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:N(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout(()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0}))},this.getInitialTop=()=>{if(this.props.top!==void 0)return this.props.top;if(this.props.initialTop!==void 0)return this.props.initialTop;let t=L;if(this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),this.props.appendTo)return this.props.appendTo.offsetHeight/2-t/2;const e=this.getWindow();return e?e.innerHeight/2-t/2:0},this.getInitialLeft=()=>{if(this.props.left!==void 0)return this.props.left;if(this.props.initialLeft!==void 0)return this.props.initialLeft;let t=W;if(this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=W;return this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=L;return this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:r.MINIMIZED,height:0}),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),a=e?e.innerWidth:0,d=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:a,height:this.props.appendTo?this.props.appendTo.offsetHeight:d,stage:r.FULLSCREEN}),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===r.FULLSCREEN?this.setState({stage:r.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===r.MINIMIZED&&this.setState({stage:r.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),o.dispatchEvent(this.props.onStageChange,t,this,{state:r.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),o.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===r.FULLSCREEN||this.windowStage===r.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const a=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,d=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,c=this.width,l=this.height,g=this.props.minWidth||F,p=this.props.minHeight||U,w=this.top-d,m=this.left-a;let C=a-this.left,E=d-this.top;const u=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&p-(l+w)<0&&(this.top>0&&(u.height=l+w),u.top=d),e.direction.indexOf("s")>=0&&p-E<0&&(u.height=E),e.direction.indexOf("w")>=0&&g-(c+m)<0&&(this.left>0&&(u.width=c+m),u.left=a),e.direction.indexOf("e")>=0&&g-C<0&&(u.width=C),this.setState(u),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,a,d)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:a,end:d,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===r.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,a=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:a})}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:B:this.state.zIndex>(this.context?this.context+S:0)?this.state.zIndex:this.context+S,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},o.validatePackage(x),this.showLicenseWatermark=o.shouldShowValidationUI(x),this.state={stage:this.props.stage||r.DEFAULT,isDragging:!1,top:0,left:0,width:W,height:L,focused:!0,zIndex:B}}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){const i=this.getWindow();i&&i.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||r.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:N(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const t=this.getDocument();if(this.props.appendTo&&t){let e=this.props.appendTo.getBoundingClientRect(),a=t.body.getBoundingClientRect();this.offSetCoordinates.x=e.left-a.left,this.offSetCoordinates.y=e.top-a.top}this.mounted=!0}componentWillUnmount(){const i=this.getWindow();i&&i.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1}componentDidUpdate(){const i=this.getDocument();if(this.props.appendTo&&i){let t=this.props.appendTo.getBoundingClientRect(),e=i.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-e.left,this.offSetCoordinates.y=t.top-e.top}this.mounted=!0}render(){const i=s.Children.toArray(this.props.children),t=this.getContent(i),e=this.getActionBar(i),a=this.getCurrentZIndex(),d=o.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":this.state.stage==="MINIMIZED","k-window-focused":this.state.focused}),c=s.createElement(o.ZIndexContext.Provider,{value:a},s.createElement(s.Fragment,null,this.props.modal&&s.createElement("div",{className:"k-overlay",style:{zIndex:a,...this.props.overlayStyle}}),s.createElement("div",{id:this.props.id,[O]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:l=>{this.windowElement=l,this.element=l},className:d,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:a,...this.props.style}},s.createElement(ot,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},s.createElement(o.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,ref:l=>this.draggable=l},s.createElement(et,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==r.MINIMIZED?s.createElement(s.Fragment,null,s.createElement("div",{className:"k-window-content"},t),e):null,this.windowStage===r.DEFAULT&&this.props.resizable?s.createElement(st,{onResize:this.handleResize}):null),this.showLicenseWatermark&&s.createElement(o.WatermarkOverlay,null))));return o.canUseDOM?this.props.appendTo!==null?K.createPortal(c,this.props.appendTo||document.body):c:null}get top(){return this.windowStage!==r.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==r.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let i=this.props.width||this.state.width;if(this.windowStage===r.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetWidth,i;const t=this.getWindow();i=t?t.innerWidth:0}return i}get height(){let i=this.props.height||this.state.height;if(this.windowStage===r.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetHeight,i;const t=this.getWindow();i=t?t.innerHeight:0}else this.windowStage===r.MINIMIZED&&(i=0);return i}get windowStage(){return this.props.stage||this.state.stage}getActionBar(i){return i.filter(t=>t&&t.type===v)}getContent(i){return i.filter(t=>t&&t.type!==v)}generateTitleId(){return"window-title-"+this._id}}b.displayName="Window";b.propTypes={width:n.number,height:n.number,left:n.number,top:n.number,initialWidth:n.number,initialHeight:n.number,initialLeft:n.number,initialTop:n.number,minWidth:n.number,minHeight:n.number,resizable:n.bool,draggable:n.bool,title:n.any,shouldUpdateOnDrag:n.bool,stage:n.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:n.string,id:n.string,style:n.object,overlayStyle:n.object};b.defaultProps={minWidth:F,minHeight:U,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0};b.contextType=o.ZIndexContext;const q=o.createPropsContext(),G=o.withIdHOC(o.withPropsContext(q,b));G.displayName="KendoReactWindow";exports.Dialog=j;exports.DialogActionsBar=T;exports.DialogPropsContext=P;exports.Window=G;exports.WindowActionsBar=v;exports.WindowPropsContext=q;
|
package/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"use client";
|
|
6
6
|
import * as s from "react";
|
|
7
7
|
import * as K from "react-dom";
|
|
8
|
-
import
|
|
8
|
+
import o from "prop-types";
|
|
9
9
|
import { Button as D } from "@progress/kendo-react-buttons";
|
|
10
10
|
import { xIcon as j, windowMinimizeIcon as et, windowIcon as it, windowRestoreIcon as st } from "@progress/kendo-svg-icons";
|
|
11
11
|
import { classNames as x, ZIndexContext as L, createPropsContext as G, withIdHOC as X, withPropsContext as V, dispatchEvent as m, Keys as p, getActiveElement as ot, validatePackage as Y, shouldShowValidationUI as $, WatermarkOverlay as q, canUseDOM as J, Draggable as Q } from "@progress/kendo-react-common";
|
|
@@ -43,7 +43,7 @@ const y = {
|
|
|
43
43
|
name: "@progress/kendo-react-dialogs",
|
|
44
44
|
productName: "KendoReact",
|
|
45
45
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
46
|
-
publishDate:
|
|
46
|
+
publishDate: 1702631379,
|
|
47
47
|
version: "",
|
|
48
48
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
49
49
|
}, O = "data-windowid", N = 10002, S = 2, rt = ".k-window:not(.k-dialog), .k-dialog-wrapper", z = (r, i, t) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-dialogs",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2-develop.2",
|
|
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",
|
|
@@ -10,15 +10,21 @@
|
|
|
10
10
|
"types": "./index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"import":
|
|
14
|
-
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./index.d.mts",
|
|
15
|
+
"default": "./index.mjs"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
|
+
"default": "./index.js"
|
|
20
|
+
}
|
|
15
21
|
}
|
|
16
22
|
},
|
|
17
23
|
"sideEffects": false,
|
|
18
24
|
"peerDependencies": {
|
|
19
|
-
"@progress/kendo-licensing": "^1.3.
|
|
20
|
-
"@progress/kendo-react-buttons": "7.0.
|
|
21
|
-
"@progress/kendo-react-common": "7.0.
|
|
25
|
+
"@progress/kendo-licensing": "^1.3.4",
|
|
26
|
+
"@progress/kendo-react-buttons": "7.0.2-develop.2",
|
|
27
|
+
"@progress/kendo-react-common": "7.0.2-develop.2",
|
|
22
28
|
"@progress/kendo-svg-icons": "^2.0.0",
|
|
23
29
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
24
30
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|