@progress/kendo-react-dialogs 13.4.0-develop.2 → 13.4.0-develop.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dialog.mjs +11 -11
- package/DialogActionsBar.mjs +4 -4
- package/Window.d.ts +15 -153
- package/Window.js +1 -1
- package/Window.mjs +478 -369
- package/dist/cdn/js/kendo-react-dialogs.js +1 -1
- package/events.d.ts +3 -3
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +5 -5
|
@@ -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(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(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"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactDialogs={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactButtons,t.KendoSvgIcons,t.KendoReactCommon,t.KendoReactIntl)}(this,function(t,e,i,o,s,n,a,r){"use strict";function l(t){var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}var h=l(e),d=l(i);const p=({children:t,onCloseButtonClick:e,id:i,closeIcon:o})=>h.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:i},h.createElement("span",{className:"k-window-title k-dialog-title"},t),o&&h.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},h.createElement(s.Button,{role:"button","aria-label":"Close",onClick:e,icon:"x",svgIcon:n.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),c=t=>{const e={layout:"stretched",...t},{layout:i,children:o}=e,s=a.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${i}`]:i});return h.createElement("div",{className:s},o)};c.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const u="data-windowid",g=10002,w=a.createPropsContext(),m=h.forwardRef((t,e)=>{const i=a.useZIndexContext(),o=i?i+2:g,s=h.useRef(null),n=h.useRef(null),r=h.useRef(a.getActiveElement(document)),l=a.usePropsContext(w,t),m=h.useMemo(()=>({...f,...l}),[l]),{title:E,width:C,height:v,children:S,minWidth:y,dir:b,style:k,themeColor:I,contentStyle:D,autoFocusedElement:T,appendTo:B,className:L,overlayStyle:x,modal:M=f.modal,closeIcon:N=f.closeIcon,autoFocus:R=f.autoFocus}=m,F=h.useCallback(()=>({props:m,element:n.current}),[m]);h.useImperativeHandle(s,F),h.useImperativeHandle(e,()=>s.current);const z=h.useMemo(()=>h.Children.toArray(S).filter(t=>!h.isValidElement(t)||t.type!==c),[S]),W=h.useMemo(()=>h.Children.toArray(S).filter(t=>h.isValidElement(t)&&t.type===c),[S]),{_id:A,contentId:U,id:O}=h.useMemo(()=>{const t=m.id,e=`${null!=t?t:"accessibility"}-id`;return{_id:e,contentId:`dialog-content-${e}`,id:t||`dialog-title-${e}`}},[m.id]),K=h.useCallback(()=>{if(n.current)if(R&&!T)n.current.focus();else if(!R&&T&&n.current){const t=n.current.querySelector(T);null==t||t.focus()}else{const t=[...a.FOCUSABLE_ELEMENTS].map(t=>t+":not(.k-dialog-titlebar *)");a.focusFirstFocusableChild(n.current,t)}},[R,T]);h.useEffect(()=>(K(),()=>{setTimeout(()=>{var t;!n.current&&r.current&&a.canUseDOM&&(document.contains(r.current)?r.current.focus():r.current.id&&(null==(t=document.getElementById(r.current.id))||t.focus()))})}),[K]);const H=h.useCallback(t=>{t.preventDefault(),a.dispatchEvent(m.onClose,t,F(),void 0)},[m.onClose]),Z=h.useCallback(t=>{t.keyCode===a.Keys.esc&&m.onClose&&(t.preventDefault(),H(t)),a.keepFocusInContainer(t,n.current)},[m.onClose,H]),P=h.useMemo(()=>h.createElement(a.ZIndexContext.Provider,{value:o},h.createElement("div",{ref:n,[u]:A,className:"k-dialog-wrapper"+(L?" "+L:""),onKeyDown:Z,tabIndex:0,dir:b,style:{zIndex:o,...k}},M&&h.createElement("div",{className:"k-overlay",style:x}),h.createElement("div",{className:a.classNames("k-window k-dialog",{[`k-window-${I}`]:I}),role:"dialog","aria-labelledby":O,"aria-modal":!0,"aria-describedby":U,style:{width:C,height:v,minWidth:y}},E&&h.createElement(p,{closeIcon:N,onCloseButtonClick:H,id:O},E),h.createElement("div",{className:"k-window-content k-dialog-content",style:D,id:U},z),W))),[o,A,L,Z,k,b,x,I,O,U,C,v,y,N,H,D,E,z,W,M]);return a.canUseDOM?null!==B?d.createPortal(P,B||document.body):P:null}),f={autoFocus:!1,modal:!0,closeIcon:!0},E={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=E;var C=(t=>(t.DEFAULT="DEFAULT",t.FULLSCREEN="FULLSCREEN",t.MINIMIZED="MINIMIZED",t))(C||{});const v="dialogs.windowMaximizeButton",S="dialogs.windowMinimizeButton",y="dialogs.windowRestoreButton",b="dialogs.windowCloseButton",k={[v]:"maximize",[S]:"minimize",[y]:"restore",[b]:"close"},I=t=>{const{children:e,onCloseButtonClick:i,onMinimizeButtonClick:o,onFullScreenButtonClick:a,onRestoreButtonClick:l,onDoubleClick:d,stage:p,forwardedRef:c,id:u}=t,g=r.useLocalization(),w=t.minimizeButton?h.createElement(t.minimizeButton,{onClick:o,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:n.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:o,"aria-label":g.toLanguageString(S,k[S])}),m=t.maximizeButton?h.createElement(t.maximizeButton,{onClick:a,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:n.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":g.toLanguageString(v,k[v])}),f=t.restoreButton?h.createElement(t.restoreButton,{onClick:l,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"window-restore",svgIcon:n.windowRestoreIcon,className:"k-window-titlebar-action",onClick:l,"aria-label":g.toLanguageString(y,k[y])}),E=t.closeButton?h.createElement(t.closeButton,{onClick:i,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"x",svgIcon:n.xIcon,className:"k-window-titlebar-action",onClick:i,"aria-label":g.toLanguageString(b,k[b])});return h.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:c,onDoubleClick:d},h.createElement("span",{className:"k-window-title",id:u},e||""),h.createElement("div",{className:"k-window-titlebar-actions"},p===C.DEFAULT&&w,p===C.DEFAULT&&m,p!==C.DEFAULT&&f,E))},D=h.forwardRef((t,e)=>h.createElement(I,{...t,forwardedRef:e})),T=["n","e","s","w","se","sw","ne","nw"];class B extends h.Component{render(){return h.createElement("div",{className:"k-resize-handles-wrapper"}," ",T.map((t,e)=>h.createElement(a.Draggable,{key:e,onDrag:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!1,direction:t})},onRelease:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!0,direction:t})}},h.createElement("div",{className:"k-resize-handle k-resize-"+t,style:{display:"block",touchAction:"none",userSelect:"none"}}))))}}class L extends h.Component{shouldComponentUpdate(t){return t.shouldUpdateOnDrag||!t.isDragging}render(){return this.props.children}}const x=t=>{const e={layout:"end",...t},{layout:i,children:o}=e,s=a.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":"start"===i,"k-justify-content-center":"center"===i,"k-justify-content-end":"end"===i,"k-justify-content-stretch":"stretched"===i});return h.createElement("div",{className:s},o)};x.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const M=(t,e,i)=>{let o=t;if(e&&e.defaultView){const t=e.querySelectorAll(".k-window:not(.k-dialog), .k-dialog-wrapper");let s=!1;return t.forEach(t=>{const n=e.defaultView.getComputedStyle(t,null);if(t.getAttribute(u)!==i&&null!==n.zIndex){const t=parseInt(n.zIndex,10);t>=o&&(o=t,s=!0)}}),s?o+2:o}return o},N=class extends h.Component{constructor(t){super(t),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.activeElement=null,this.onKeyDown=t=>{var e,i,o;if(this.props.modal&&a.keepFocusInContainer(t,this.element),t.target!==t.currentTarget)return;const s=this.props.minWidth||120,n=this.props.minHeight||100,r=t.metaKey||t.ctrlKey,l=null!=(o=null!=(i=this.height)?i:null==(e=this.windowElement)?void 0:e.clientHeight)?o:0;if(r&&this.props.resizable){switch(t.keyCode){case a.Keys.up:t.preventDefault(),n<=l-5&&this.setState({height:l-5});break;case a.Keys.down:t.preventDefault(),this.setState({height:l+5});break;case a.Keys.left:s<=this.width-5&&this.setState({width:this.width-5});break;case a.Keys.right:this.setState({width:this.width+5});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0)}else if(t.altKey)switch(t.keyCode){case a.Keys.up:this.windowStage===C.MINIMIZED?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.DEFAULT})):this.windowStage===C.DEFAULT&&(this.handleFullscreen(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.FULLSCREEN}));break;case a.Keys.down:this.windowStage===C.FULLSCREEN?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.DEFAULT})):this.windowStage===C.DEFAULT&&(this.handleMinimize(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.MINIMIZED}))}else{if(!t.ctrlKey)switch(t.keyCode){case a.Keys.esc:return void(this.props.onClose&&this.handleCloseWindow(t));case a.Keys.up:this.setState(t=>({top:t.top-5}));break;case a.Keys.down:this.setState(t=>({top:t.top+5}));break;case a.Keys.left:this.setState(t=>({left:t.left-5}));break;case a.Keys.right:this.setState(t=>({left:t.left+5}));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!==C.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!==C.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:M(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=()=>{var t,e;if(void 0!==this.props.top)return this.props.top;if(void 0!==this.props.initialTop)return this.props.initialTop;let i=300;if(void 0!==this.props.height?i=this.props.height:void 0!==this.props.initialHeight&&(i=this.props.initialHeight),this.props.appendTo&&i)return this.props.appendTo.offsetHeight/2-i/2;const o=this.getWindow();return o?o.innerHeight/2-(null!=(e=null!=i?i:null==(t=this.windowElement)?void 0:t.clientHeight)?e:0)/2:0},this.getInitialLeft=()=>{if(void 0!==this.props.left)return this.props.left;if(void 0!==this.props.initialLeft)return this.props.initialLeft;let t=300;if(void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(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=300;return void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=300;return void 0!==this.props.height?t=this.props.height:void 0!==this.props.initialHeight&&(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:C.MINIMIZED,height:0}),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.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(),i=e?e.innerWidth:0,o=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:i,height:this.props.appendTo?this.props.appendTo.offsetHeight:o,stage:C.FULLSCREEN}),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===C.FULLSCREEN?this.setState({stage:C.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===C.MINIMIZED&&this.setState({stage:C.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===C.FULLSCREEN||this.windowStage===C.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{var i,o,s;const n=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,a=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,r=this.width,l=null!=(s=null!=(o=this.height)?o:null==(i=this.windowElement)?void 0:i.clientHeight)?s:0,h=this.props.minWidth||120,d=this.props.minHeight||100,p=this.top-a,c=this.left-n,u=n-this.left,g=a-this.top,w=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&d-(l+p)<0&&(this.top>0&&(w.height=l+p),w.top=a),e.direction.indexOf("s")>=0&&d-g<0&&(w.height=g),e.direction.indexOf("w")>=0&&h-(r+c)<0&&(this.left>0&&(w.width=r+c),w.left=n),e.direction.indexOf("e")>=0&&h-u<0&&(w.width=u),this.setState(w),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,i,o)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:i,end:o,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===C.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,i=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:i})}},this.getCurrentZIndex=()=>this.state&&void 0!==this.context?this.state.zIndex>(this.context?this.context+2:0)?this.state.zIndex:this.context+2:this.context?this.context:g,this.getDocument=()=>{const t=a.canUseDOM?document:null;return this.props.appendTo?this.props.appendTo.ownerDocument:t},this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},this.state={stage:this.props.stage||C.DEFAULT,isDragging:!1,top:0,left:0,width:300,height:300,focused:!0,zIndex:g},a.canUseDOM&&(this.activeElement=document.activeElement)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&this.props.autoFocus&&this.element.focus({preventScroll:!0});const t=this.getWindow();t&&t.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||C.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:M(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const e=this.getDocument();if(this.props.appendTo&&e){const t=this.props.appendTo.getBoundingClientRect(),i=e.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-i.left,this.offSetCoordinates.y=t.top-i.top}this.mounted=!0}componentWillUnmount(){const t=this.getWindow();t&&t.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1,setTimeout(()=>{var t;!this.element&&this.activeElement&&a.canUseDOM&&(document.contains(this.activeElement)?this.activeElement.focus({preventScroll:!0}):this.activeElement.id&&(null==(t=document.getElementById(this.activeElement.id))||t.focus({preventScroll:!0})))})}componentDidUpdate(t){this.props.left&&t.left!==this.props.left&&this.setState({left:this.props.left}),this.props.top&&t.top!==this.props.top&&this.setState({top:this.props.top}),this.props.initialLeft&&t.initialLeft!==this.props.initialLeft&&this.setState({left:this.props.initialLeft}),this.props.initialTop&&t.initialTop!==this.props.initialTop&&this.setState({top:this.props.initialTop});const e=this.getDocument();if(this.props.appendTo&&e){const t=this.props.appendTo.getBoundingClientRect(),i=e.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-i.left,this.offSetCoordinates.y=t.top-i.top}this.mounted=!0}render(){const t=h.Children.toArray(this.props.children),e=this.getContent(t),i=this.getActionBar(t),o=this.getCurrentZIndex(),s=a.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":"MINIMIZED"===this.state.stage,"k-focus":this.state.focused}),n=h.createElement(a.ZIndexContext.Provider,{value:o},h.createElement(h.Fragment,null,this.props.modal&&h.createElement("div",{className:"k-overlay",style:{zIndex:o,...this.props.overlayStyle}}),h.createElement("div",{id:this.props.id,[u]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:t=>{this.windowElement=t,this.element=t},className:s,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:o,...this.props.style}},h.createElement(L,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},h.createElement(a.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,autoScroll:!1,ref:t=>{this.draggable=t}},h.createElement(D,{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!==C.MINIMIZED?h.createElement(h.Fragment,null,h.createElement("div",{className:"k-window-content"},e),i):null,this.windowStage===C.DEFAULT&&this.props.resizable?h.createElement(B,{onResize:this.handleResize}):null))));return a.canUseDOM?null!==this.props.appendTo?d.createPortal(n,this.props.appendTo||document.body):n:null}get top(){return this.windowStage!==C.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==C.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let t=this.props.width||this.state.width;if(this.windowStage===C.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetWidth,t;const e=this.getWindow();t=e?e.innerWidth:0}return t}get height(){let t=this.props.height||this.state.height;if(this.windowStage===C.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetHeight,t;const e=this.getWindow();t=e?e.innerHeight:0}else this.windowStage===C.MINIMIZED&&(t=0);return t}get windowStage(){return this.props.stage||this.state.stage}getActionBar(t){return t.filter(t=>t&&t.type===x)}getContent(t){return t.filter(t=>t&&t.type!==x)}generateTitleId(){return"window-title-"+this._id}};N.displayName="Window",N.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,autoFocus:o.bool},N.defaultProps={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},N.contextType=a.ZIndexContext;let R=N;const F=a.createPropsContext(),z=a.withIdHOC(a.withPropsContext(F,R));z.displayName="KendoReactWindow",t.Dialog=m,t.DialogActionsBar=c,t.DialogPropsContext=w,t.Window=z,t.WindowActionsBar=x,t.WindowPropsContext=F,t.WindowWithoutContext=R});
|
|
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),u=c(o);const p=({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"}))),g=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)};g.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const h="data-windowid",f=10002,m=a.createPropsContext(),v=s.forwardRef((e,t)=>{const n=a.useZIndexContext(),o=n?n+2:f,i=s.useRef(null),r=s.useRef(null),l=s.useRef(a.getActiveElement(document)),c=a.usePropsContext(m,e),u=s.useMemo(()=>({...w,...c}),[c]),{title:v,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=w.modal,closeIcon:F=w.closeIcon,autoFocus:x=w.autoFocus}=u,R=s.useCallback(()=>({props:u,element:r.current}),[u]);s.useImperativeHandle(i,R),s.useImperativeHandle(t,()=>i.current);const A=s.useMemo(()=>s.Children.toArray(y).filter(e=>!s.isValidElement(e)||e.type!==g),[y]),z=s.useMemo(()=>s.Children.toArray(y).filter(e=>s.isValidElement(e)&&e.type===g),[y]),{_id:U,contentId:W,id:O}=s.useMemo(()=>{const e=u.id,t=`${null!=e?e:"accessibility"}-id`;return{_id:t,contentId:`dialog-content-${t}`,id:e||`dialog-title-${t}`}},[u.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(u.onClose,e,R(),void 0)},[u.onClose]),j=s.useCallback(e=>{e.keyCode===a.Keys.esc&&u.onClose&&(e.preventDefault(),K(e)),a.keepFocusInContainer(e,r.current)},[u.onClose,K]),Z=s.useMemo(()=>s.createElement(a.ZIndexContext.Provider,{value:o},s.createElement("div",{ref:r,[h]: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}},v&&s.createElement(p,{closeIcon:F,onCloseButtonClick:K,id:O},v),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,v,A,z,S]);return a.canUseDOM?null!==L?d.createPortal(Z,L||document.body):Z:null}),w={autoFocus:!1,modal:!0,closeIcon:!0},E={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"])};v.displayName="KendoReactDialog",v.propTypes=E;var C=(e=>(e.DEFAULT="DEFAULT",e.FULLSCREEN="FULLSCREEN",e.MINIMIZED="MINIMIZED",e))(C||{});const y="dialogs.windowMaximizeButton",b="dialogs.windowMinimizeButton",k="dialogs.windowRestoreButton",T="dialogs.windowCloseButton",I={[y]:"maximize",[b]:"minimize",[k]:"restore",[T]:"close"},B=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(b,I[b])}),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(y,I[y])}),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(k,I[k])}),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(T,I[T])});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===C.DEFAULT&&f,u===C.DEFAULT&&m,u!==C.DEFAULT&&v,w))},D=s.forwardRef((e,t)=>s.createElement(B,{...e,forwardedRef:t})),L=["n","e","s","w","se","sw","ne","nw"];class N extends s.Component{render(){return s.createElement("div",{className:"k-resize-handles-wrapper"}," ",L.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 M extends s.Component{shouldComponentUpdate(e){return e.shouldUpdateOnDrag||!e.isDragging}render(){return this.props.children}}const S=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)};S.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const F=(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(h)!==n&&null!==r.zIndex){const e=parseInt(r.zIndex,10);e>=o&&(o=e,i=!0)}}),i?o+2:o}return o},{useState:x,useEffect:R,useCallback:A,useMemo:z,useRef:U,useImperativeHandle:W,useContext:O,forwardRef:H}=s,K=300,j=300,Z={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},P=H((e,t)=>{var n;const{minWidth:o=Z.minWidth,minHeight:i=Z.minHeight,resizable:r=Z.resizable,draggable:l=Z.draggable,modal:c=Z.modal,doubleClickStageChange:u=Z.doubleClickStageChange,autoFocus:p=Z.autoFocus}=e,[g,m]=x(e.stage||C.DEFAULT),[v,w]=x(!1),[E,y]=x(0),[b,k]=x(0),[T,I]=x(K),[B,L]=x(j),[H,P]=x(!0),[q,$]=x(f),V=null!=(n=e.stage)?n:g,X=O(a.ZIndexContext),Y=U(null),_=U(null),G=U({leftBeforeAction:0,topBeforeAction:0,widthBeforeAction:K,heightBeforeAction:j}),J=U({x:0,y:0}),Q=U(void 0),ee=U(a.canUseDOM?document.activeElement:null),te=U("window-title-"+(e.id?e.id+"-accessibility-id":"")),ne=U({left:0,top:0,width:K,height:j,internalLeft:b,internalTop:E,internalWidth:T,internalHeight:B,stage:V,draggable:l,props:e}),oe=A(()=>{const t=a.canUseDOM?document:null;return e.appendTo?e.appendTo.ownerDocument:t},[e.appendTo]),ie=A(()=>{const e=oe();return null==e?void 0:e.defaultView},[oe]),re=z(()=>{var t;return V!==C.FULLSCREEN?Math.max(null!=(t=e.top)?t:E,0):0},[V,e.top,E]),ae=z(()=>{var t;return V!==C.FULLSCREEN?Math.max(null!=(t=e.left)?t:b,0):0},[V,e.left,b]),le=z(()=>{var t;const n=null!=(t=e.width)?t:T;if(V===C.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=z(()=>{const t=void 0===e.height?B:e.height;if(V===C.FULLSCREEN){if(e.appendTo)return e.appendTo.offsetHeight;const t=ie();return t?t.innerHeight:0}return V===C.MINIMIZED?0:t},[V,e.height,e.appendTo,B,ie]),se=z(()=>e.id?e.id+"-accessibility-id":void 0,[e.id]);R(()=>{ne.current={left:ae,top:re,width:le,height:ce,internalLeft:b,internalTop:E,internalWidth:T,internalHeight:B,stage:V,draggable:l,props:e}});const de=z(()=>{if(void 0===X)return null!=X?X:f;return q>(X?X+2:0)?q:X+2},[q,X]),ue=A(()=>{var t,n;if(void 0!==e.top)return e.top;if(void 0!==e.initialTop)return e.initialTop;let o=j;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=A(()=>{if(void 0!==e.left)return e.left;if(void 0!==e.initialLeft)return e.initialLeft;let t=K;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=A(()=>{let t=K;return void 0!==e.width?t=e.width:void 0!==e.initialWidth&&(t=e.initialWidth),t},[e.width,e.initialWidth]),he=A(()=>{let t=j;return void 0!==e.height?t=e.height:void 0!==e.initialHeight&&(t=e.initialHeight),t},[e.height,e.initialHeight]),fe=A(e=>e.filter(e=>(null==e?void 0:e.type)===S),[]),me=A(e=>e.filter(e=>e&&e.type!==S),[]),ve=A(()=>"object"==typeof t&&null!==t&&"current"in t?t.current:null,[t]),we=A((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=A(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&&L(p-5);break;case a.Keys.down:t.preventDefault(),L(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===C.MINIMIZED?(De(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:C.DEFAULT})):V===C.DEFAULT&&(Be(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:C.FULLSCREEN}));break;case a.Keys.down:V===C.FULLSCREEN?(De(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:C.DEFAULT})):V===C.DEFAULT&&(Ie(t),a.dispatchEvent(e.onStageChange,t,ve(),{state:C.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=A(e=>{const t=e.event,{left:n,top:o}=ne.current;G.current.differenceLeft=t.pageX-n,G.current.differenceTop=t.pageY-o},[]),ye=A(e=>{const t=e.event;t.originalEvent.preventDefault();const{stage:n,draggable:o,props:i,width:r,height:a}=ne.current;if(n!==C.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=A(e=>{const t=e.event,{stage:n,draggable:o,props:i,left:r,top:a,width:l,height:c}=ne.current;n!==C.FULLSCREEN&&o&&i.onMove&&we(i.onMove,t,!0,!0,{left:r,top:a},{width:l,height:c}),w(!1)},[we]),ke=A(()=>{Q.current?(clearTimeout(Q.current),Q.current=void 0):(P(!0),$(F(de,oe(),se)))},[de,oe,se]),Te=A(()=>{clearTimeout(Q.current);const e=ie();e&&(Q.current=e.setTimeout(()=>{P(!1),Q.current=void 0}))},[ie]),Ie=A(t=>{t.preventDefault(),G.current.leftBeforeAction=ae,G.current.topBeforeAction=re,G.current.widthBeforeAction=le,G.current.heightBeforeAction=ce,m(C.MINIMIZED),L(0),a.dispatchEvent(e.onStageChange,t,ve(),{state:C.MINIMIZED})},[ae,re,le,ce,e.onStageChange,ve]),Be=A(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),L(e.appendTo?e.appendTo.offsetHeight:i),m(C.FULLSCREEN),a.dispatchEvent(e.onStageChange,t,ve(),{state:C.FULLSCREEN})},[ae,re,le,ce,e.appendTo,e.onStageChange,ie,ve]),De=A(t=>{t.preventDefault(),V===C.FULLSCREEN?(m(C.DEFAULT),k(G.current.leftBeforeAction),y(G.current.topBeforeAction),I(G.current.widthBeforeAction),L(G.current.heightBeforeAction)):V===C.MINIMIZED&&(m(C.DEFAULT),L(G.current.heightBeforeAction)),a.dispatchEvent(e.onStageChange,t,ve(),{state:C.DEFAULT})},[V,e.onStageChange,ve]),Le=A(t=>{t.preventDefault(),a.dispatchEvent(e.onClose,t,ve(),{state:void 0})},[e.onClose,ve]),Ne=A(e=>{V===C.FULLSCREEN||V===C.MINIMIZED?De(e):Be(e)},[V,De,Be]),Me=A((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 N=!1;const M={isDragging:!t.end};t.direction.indexOf("n")>=0&&C-(v+b)<0&&(g>0&&(M.height=v+b),M.top=m,N=!0),t.direction.indexOf("s")>=0&&C-D<0&&(M.height=D,N=!0),t.direction.indexOf("w")>=0&&E-(u+T)<0&&(h>0&&(M.width=u+T),M.left=f,N=!0),t.direction.indexOf("e")>=0&&E-B<0&&(M.width=B,N=!0),N&&(void 0!==M.height&&L(M.height),void 0!==M.top&&y(M.top),void 0!==M.width&&I(M.width),void 0!==M.left&&k(M.left),void 0!==M.isDragging&&w(M.isDragging)),we(d.onResize,e,!0,t.end,{left:null!=(a=M.left)?a:h,top:null!=(l=M.top)?l:g},{width:null!=(c=M.width)?c:u,height:null!=(s=M.height)?s:p})},[we]),Se=A(()=>{if(V===C.FULLSCREEN){const t=ie(),n=t?t.innerWidth:0,o=t?t.innerHeight:0;I(e.appendTo?e.appendTo.offsetWidth:n),L(e.appendTo?e.appendTo.offsetHeight:o)}},[V,e.appendTo,ie]);R(()=>{const t=Y.current;t&&p&&t.focus({preventScroll:!0});const n=ie();n&&n.addEventListener("resize",Se),m(e.stage||C.DEFAULT),w(!1),y(ue()),k(pe()),I(ge()),L(he()),P(!0),$(F(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})))}},[]),R(()=>{void 0!==e.left&&!v&&k(e.left)},[e.left,v]),R(()=>{void 0!==e.top&&!v&&y(e.top)},[e.top,v]),R(()=>{void 0!==e.initialLeft&&k(e.initialLeft)},[e.initialLeft]),R(()=>{void 0!==e.initialTop&&y(e.initialTop)},[e.initialTop]),R(()=>{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]),W(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":H}),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,[h]: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(M,{shouldUpdateOnDrag:e.shouldUpdateOnDrag||!1,isDragging:v},s.createElement(a.Draggable,{onPress:Ce,onDrag:ye,onRelease:be,autoScroll:!1,ref:_},s.createElement(D,{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===C.MINIMIZED?null:s.createElement(s.Fragment,null,s.createElement("div",{className:"k-window-content"},xe),Re),V===C.DEFAULT&&r?s.createElement(N,{onResize:Me}):null))));return a.canUseDOM?null===e.appendTo?ze:d.createPortal(ze,e.appendTo||document.body):null});P.displayName="Window";const q=a.createPropsContext(),$=a.withIdHOC(a.withPropsContext(q,P));$.displayName="KendoReactWindow";const V={autoFocus:u.bool,title:u.any,className:u.string,closeButton:u.func,minimizeButton:u.func,maximizeButton:u.func,restoreButton:u.func,modal:u.bool,overlayStyle:u.object,width:u.number,height:u.number,minWidth:u.number,minHeight:u.number,left:u.number,top:u.number,initialLeft:u.number,initialTop:u.number,initialWidth:u.number,initialHeight:u.number,resizable:u.bool,draggable:u.bool,doubleClickStageChange:u.bool,stage:u.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),onClose:u.func,onMove:u.func,onResize:u.func,onStageChange:u.func,children:u.node,id:u.string,dir:u.string,style:u.object,appendTo:u.any,themeColor:u.oneOf(["primary","dark","light"]),shouldUpdateOnDrag:u.bool};$.propTypes=V,e.Dialog=v,e.DialogActionsBar=g,e.DialogPropsContext=m,e.Window=$,e.WindowActionsBar=S,e.WindowPropsContext=q,e.WindowWithoutContext=P});
|
package/events.d.ts
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { DialogHandle } from './Dialog.js';
|
|
9
9
|
import { BaseEvent } from '@progress/kendo-react-common';
|
|
10
|
-
import {
|
|
10
|
+
import { WindowHandle } from './Window.js';
|
|
11
11
|
/**
|
|
12
12
|
* @hidden
|
|
13
13
|
*/
|
|
14
14
|
export interface DialogCloseEvent extends BaseEvent<DialogHandle> {
|
|
15
15
|
}
|
|
16
|
-
export interface WindowActionsEvent extends BaseEvent<
|
|
16
|
+
export interface WindowActionsEvent extends BaseEvent<WindowHandle> {
|
|
17
17
|
/**
|
|
18
18
|
* The current stage state of the Window.
|
|
19
19
|
*/
|
|
@@ -23,7 +23,7 @@ export interface WindowMoveEvent {
|
|
|
23
23
|
/**
|
|
24
24
|
* An event target.
|
|
25
25
|
*/
|
|
26
|
-
target:
|
|
26
|
+
target: WindowHandle;
|
|
27
27
|
/**
|
|
28
28
|
* A native DOM event.
|
|
29
29
|
*/
|
package/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Dialog, DialogHandle, DialogPropsContext } from './Dialog.js';
|
|
9
9
|
import { DialogActionsBar } from './DialogActionsBar.js';
|
|
10
|
-
import { Window,
|
|
10
|
+
import { Window, WindowPropsContext, WindowWithoutContext, WindowHandle } from './Window.js';
|
|
11
11
|
import { WindowProps } from './WindowProps.js';
|
|
12
12
|
import { WindowActionsBar } from './WindowActionsBar.js';
|
|
13
13
|
import { DialogCloseEvent, WindowActionsEvent, WindowMoveEvent } from './events.js';
|
package/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Dialog, DialogHandle, DialogPropsContext } from './Dialog.js';
|
|
9
9
|
import { DialogActionsBar } from './DialogActionsBar.js';
|
|
10
|
-
import { Window,
|
|
10
|
+
import { Window, WindowPropsContext, WindowWithoutContext, WindowHandle } from './Window.js';
|
|
11
11
|
import { WindowProps } from './WindowProps.js';
|
|
12
12
|
import { WindowActionsBar } from './WindowActionsBar.js';
|
|
13
13
|
import { DialogCloseEvent, WindowActionsEvent, WindowMoveEvent } from './events.js';
|
package/package-metadata.mjs
CHANGED
|
@@ -8,6 +8,6 @@ export const packageMetadata = Object.freeze({
|
|
|
8
8
|
productCode: 'KENDOUIREACT',
|
|
9
9
|
productCodes: ['KENDOUIREACT'],
|
|
10
10
|
publishDate: 0,
|
|
11
|
-
version: '13.4.0-develop.
|
|
11
|
+
version: '13.4.0-develop.3',
|
|
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": "13.4.0-develop.
|
|
3
|
+
"version": "13.4.0-develop.3",
|
|
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": "13.4.0-develop.
|
|
30
|
-
"@progress/kendo-react-common": "13.4.0-develop.
|
|
31
|
-
"@progress/kendo-react-intl": "13.4.0-develop.
|
|
29
|
+
"@progress/kendo-react-buttons": "13.4.0-develop.3",
|
|
30
|
+
"@progress/kendo-react-common": "13.4.0-develop.3",
|
|
31
|
+
"@progress/kendo-react-intl": "13.4.0-develop.3",
|
|
32
32
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
33
33
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
34
34
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"package": {
|
|
73
73
|
"productName": "KendoReact",
|
|
74
74
|
"productCode": "KENDOUIREACT",
|
|
75
|
-
"publishDate":
|
|
75
|
+
"publishDate": 1770312026,
|
|
76
76
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
77
77
|
}
|
|
78
78
|
},
|