@progress/kendo-react-dialogs 9.0.0-develop.1 → 9.0.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/DialogActionsBar.mjs +3 -8
- package/DialogTitleBar.mjs +6 -1
- package/README.md +32 -30
- package/WindowActionsBar.mjs +6 -12
- package/WindowTitlebar.mjs +9 -9
- package/dist/cdn/js/kendo-react-dialogs.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +3 -3
- package/utils.js +1 -1
- package/utils.mjs +11 -10
package/DialogActionsBar.mjs
CHANGED
|
@@ -13,14 +13,9 @@ const i = (e) => {
|
|
|
13
13
|
const s = {
|
|
14
14
|
layout: "stretched",
|
|
15
15
|
...e
|
|
16
|
-
}, { layout: o, children: a } = s, r = c(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"k-window-actions k-dialog-actions",
|
|
20
|
-
{
|
|
21
|
-
[`k-actions-${o}`]: o
|
|
22
|
-
}
|
|
23
|
-
);
|
|
16
|
+
}, { layout: o, children: a } = s, r = c("k-actions", "k-actions-horizontal", "k-window-actions k-dialog-actions", {
|
|
17
|
+
[`k-actions-${o}`]: o
|
|
18
|
+
});
|
|
24
19
|
return /* @__PURE__ */ n.createElement("div", { className: r }, a);
|
|
25
20
|
};
|
|
26
21
|
i.propTypes = {
|
package/DialogTitleBar.mjs
CHANGED
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
import * as t from "react";
|
|
10
10
|
import { Button as o } from "@progress/kendo-react-buttons";
|
|
11
11
|
import { xIcon as n } from "@progress/kendo-svg-icons";
|
|
12
|
-
const s = ({
|
|
12
|
+
const s = ({
|
|
13
|
+
children: e,
|
|
14
|
+
onCloseButtonClick: a,
|
|
15
|
+
id: i,
|
|
16
|
+
closeIcon: l
|
|
17
|
+
}) => /* @__PURE__ */ t.createElement("div", { className: "k-window-titlebar k-dialog-titlebar", id: i }, /* @__PURE__ */ t.createElement("span", { className: "k-window-title k-dialog-title" }, e), l && /* @__PURE__ */ t.createElement("div", { className: "k-window-titlebar-actions k-dialog-titlebar-actions" }, /* @__PURE__ */ t.createElement(
|
|
13
18
|
o,
|
|
14
19
|
{
|
|
15
20
|
role: "button",
|
package/README.md
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
# KendoReact Dialogs Library for React
|
|
6
6
|
|
|
7
7
|
> **Important**
|
|
8
|
-
>
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
>
|
|
8
|
+
>
|
|
9
|
+
> - This package is а part of [KendoReact](https://www.telerik.com/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)—a commercial UI library.
|
|
10
|
+
> - You will need to install a license key when adding the package to your project. For more information, please refer to the [KendoReact My License page](https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs).
|
|
11
|
+
> - To receive a license key, you need to either [purchase a license](https://www.telerik.com/kendo-react-ui/pricing?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs) or register for a [free trial](https://www.telerik.com/try/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs). Doing so indicates that you [accept the KendoReact License Agreement](https://www.telerik.com/purchase/license-agreement/progress-kendoreact?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs).
|
|
12
|
+
> - The 30-day free trial gives you access to all the KendoReact components and their full functionality. Additionally, for the period of your license, you get access to our legendary technical support provided directly by the KendoReact dev team!
|
|
12
13
|
>
|
|
13
14
|
> [Start using KendoReact](https://www.telerik.com/try/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs) and speed up your development process!
|
|
14
15
|
|
|
@@ -16,11 +17,11 @@ The React Dialogs, part of KendoReact, are UI components for prompting user inte
|
|
|
16
17
|
|
|
17
18
|
What's in this package (ToC):
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
- [React Dialog component](#react-dialog-component)
|
|
21
|
+
- [React Window component](#react-window-component)
|
|
22
|
+
- [React Dialogs Library Shared Features](#react-dialogs-library-shared-features)
|
|
23
|
+
- [Support Options](#support-options)
|
|
24
|
+
- [Resources](#resources)
|
|
24
25
|
|
|
25
26
|
## React Dialog Component
|
|
26
27
|
|
|
@@ -29,41 +30,42 @@ What's in this package (ToC):
|
|
|
29
30
|
## React Window Component
|
|
30
31
|
|
|
31
32
|
[The KendoReact Window component](https://www.telerik.com/kendo-react-ui/components/dialogs/window/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs) displays content in a non-modal fashion and allows for the window to be moved throughout the page as well as resized based on user requirements.Each React Window has built-in action items for minimizing, maximizing and closing the window. By default, the React Window is in an uncontrolled state and can be resized or moved depending on its internal logic. For scenarios that require a controlled component, every aspect of the window can be maintained by controlling the state of the component.
|
|
33
|
+
|
|
32
34
|
## React Dialogs Library Shared Features
|
|
33
35
|
|
|
34
36
|
Among the many features which the KendoReact Dialogs deliver are:
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
- **Modal**—The dialogs can be shown as modal on the page to prevent the user from interacting with other elements on the page.
|
|
39
|
+
- **Resizing**—You can resize the window to change its dimensions to better view a large content.
|
|
40
|
+
- **Dragging**—The window can be dragged across the page, to position it at a specific part of the page.
|
|
41
|
+
- **Keyboard navigation**—The Dialogs can be controlled by the keyboard.
|
|
42
|
+
- **Title and content**—You have full control over what is rendered in the dialogs title and content.
|
|
43
|
+
- [**Theme support**](https://www.telerik.com/kendo-react-ui/components/styling/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)—The KendoReact Dialogs, as well as all 100+ components in the KendoReact suite, are styled in three polished themes (Bootstrap, Material, and Default) and can be further customized to match your specific design guidelines.
|
|
42
44
|
|
|
43
45
|
## Support Options
|
|
44
46
|
|
|
45
47
|
For any issues you might encounter while working with the KendoReact Dialogs, use any of the available support channels:
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
- Industry-leading technical support—KendoReact paid license holders and users with an active (free) trial license can take advantage of our outstanding customer support. To submit a ticket, use [the dedicated KendoReact support system](https://www.telerik.com/account/support-tickets?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs).
|
|
50
|
+
- Product forums—The [KendoReact forums](https://www.telerik.com/forums/kendo-ui-react?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs) are part of the free support you can get from the community and from the KendoReact team.
|
|
51
|
+
- Feedback portal—The [KendoReact feedback portal](https://feedback.telerik.com/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs) is where you can request and vote for new features to be added.
|
|
50
52
|
|
|
51
53
|
## Resources
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
- [Getting Started with KendoReact](https://www.telerik.com/kendo-react-ui/components/getting-started/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)
|
|
56
|
+
- [Getting Started with the KendoReact Dialogs](https://www.telerik.com/kendo-react-ui/components/dialogs/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)
|
|
57
|
+
- [API Reference of the KendoReact Dialogs](https://www.telerik.com/kendo-react-ui/components/dialogs/api/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)
|
|
58
|
+
- [KendoReact Roadmap](https://www.telerik.com/support/whats-new/kendo-react-ui/roadmap?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)
|
|
59
|
+
- [Blogs](https://www.telerik.com/blogs/tag/kendoreact?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)
|
|
60
|
+
- [Demos, documentation, and component reference](https://www.telerik.com/kendo-react-ui/components/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)
|
|
61
|
+
- [KendoReact pricing and licensing](https://www.telerik.com/kendo-react-ui/pricing?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)
|
|
62
|
+
- [Changelog](https://www.telerik.com/kendo-react-ui/components/changelogs/ui-for-react/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-dialogs)
|
|
61
63
|
|
|
62
64
|
High-level component overview pages
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
- [React Dialog Component](https://www.telerik.com/kendo-react-ui/dialog)
|
|
67
|
+
- [React Window Component](https://www.telerik.com/kendo-react-ui/window)
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
_Copyright © 2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved._
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
_Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries._
|
package/WindowActionsBar.mjs
CHANGED
|
@@ -13,18 +13,12 @@ const i = (n) => {
|
|
|
13
13
|
const s = {
|
|
14
14
|
layout: "end",
|
|
15
15
|
...n
|
|
16
|
-
}, { layout: t, children: o } = s, r = a(
|
|
17
|
-
"k-
|
|
18
|
-
"k-
|
|
19
|
-
"k-
|
|
20
|
-
"k-
|
|
21
|
-
|
|
22
|
-
"k-justify-content-start": t === "start",
|
|
23
|
-
"k-justify-content-center": t === "center",
|
|
24
|
-
"k-justify-content-end": t === "end",
|
|
25
|
-
"k-justify-content-stretch": t === "stretched"
|
|
26
|
-
}
|
|
27
|
-
);
|
|
16
|
+
}, { layout: t, children: o } = s, r = a("k-actions", "k-window-actions", "k-actions-horizontal", "k-hstack", {
|
|
17
|
+
"k-justify-content-start": t === "start",
|
|
18
|
+
"k-justify-content-center": t === "center",
|
|
19
|
+
"k-justify-content-end": t === "end",
|
|
20
|
+
"k-justify-content-stretch": t === "stretched"
|
|
21
|
+
});
|
|
28
22
|
return /* @__PURE__ */ c.createElement("div", { className: r }, o);
|
|
29
23
|
};
|
|
30
24
|
i.propTypes = {
|
package/WindowTitlebar.mjs
CHANGED
|
@@ -31,7 +31,10 @@ const v = (t) => {
|
|
|
31
31
|
svgIcon: I,
|
|
32
32
|
className: "k-window-titlebar-action",
|
|
33
33
|
onClick: m,
|
|
34
|
-
"aria-label": i.toLanguageString(
|
|
34
|
+
"aria-label": i.toLanguageString(
|
|
35
|
+
w,
|
|
36
|
+
l[w]
|
|
37
|
+
)
|
|
35
38
|
}
|
|
36
39
|
), z = t.maximizeButton ? /* @__PURE__ */ e.createElement(t.maximizeButton, { onClick: s, stage: n }) : /* @__PURE__ */ e.createElement(
|
|
37
40
|
a,
|
|
@@ -41,7 +44,10 @@ const v = (t) => {
|
|
|
41
44
|
svgIcon: L,
|
|
42
45
|
className: "k-window-titlebar-action",
|
|
43
46
|
onClick: s,
|
|
44
|
-
"aria-label": i.toLanguageString(
|
|
47
|
+
"aria-label": i.toLanguageString(
|
|
48
|
+
u,
|
|
49
|
+
l[u]
|
|
50
|
+
)
|
|
45
51
|
}
|
|
46
52
|
), b = t.restoreButton ? /* @__PURE__ */ e.createElement(t.restoreButton, { onClick: d, stage: n }) : /* @__PURE__ */ e.createElement(
|
|
47
53
|
a,
|
|
@@ -75,13 +81,7 @@ const v = (t) => {
|
|
|
75
81
|
/* @__PURE__ */ e.createElement("span", { className: "k-window-title", id: C }, o || ""),
|
|
76
82
|
/* @__PURE__ */ e.createElement("div", { className: "k-window-titlebar-actions" }, n === c.DEFAULT && E, n === c.DEFAULT && z, n !== c.DEFAULT && b, R)
|
|
77
83
|
);
|
|
78
|
-
}, F = e.forwardRef((t, o) => /* @__PURE__ */ e.createElement(
|
|
79
|
-
v,
|
|
80
|
-
{
|
|
81
|
-
...t,
|
|
82
|
-
forwardedRef: o
|
|
83
|
-
}
|
|
84
|
-
));
|
|
84
|
+
}, F = e.forwardRef((t, o) => /* @__PURE__ */ e.createElement(v, { ...t, forwardedRef: o }));
|
|
85
85
|
export {
|
|
86
86
|
F as WindowTitleBar
|
|
87
87
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
!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,s,o,n,a,r){"use strict";function h(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var l=h(e),d=h(i);const p=({children:t,onCloseButtonClick:e,id:i,closeIcon:s})=>l.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:i},l.createElement("span",{className:"k-window-title k-dialog-title"},t),s&&l.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},l.createElement(o.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:s}=e,o=a.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${i}`]:i});return l.createElement("div",{className:o},s)};c.propTypes={children:s.any,layout:s.oneOf(["start","center","end","stretched"])};const g={name:"@progress/kendo-react-dialogs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},u="data-windowid",m=10002,w=(t,e,i)=>{let s=t;if(e&&e.defaultView){let t=e.querySelectorAll(".k-window:not(.k-dialog), .k-dialog-wrapper"),o=!1;return t.forEach((t=>{let n=e.defaultView.getComputedStyle(t,null);if(t.getAttribute(u)!==i&&null!==n.zIndex){let t=parseInt(n.zIndex,10);t>=s&&(s=t,o=!0)}})),o?s+2:s}return s},f=class extends l.Component{constructor(t){super(t),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.activeElement=null,this.onCloseDialog=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,void 0)},this.onKeyDown=t=>{t.keyCode===a.Keys.esc&&this.props.onClose&&(t.preventDefault(),this.onCloseDialog(t)),a.keepFocusInContainer(t,this.element)},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:m,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,a.validatePackage(g),this.showLicenseWatermark=a.shouldShowValidationUI(g),this.activeElement=a.getActiveElement(document)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){if(this.element){if(this.props.autoFocus&&!this.props.autoFocusedElement)this.element.focus();else if(this.props.autoFocus&&this.props.autoFocusedElement)this.element.focus();else if(!this.props.autoFocus&&this.props.autoFocusedElement){const t=this.element.querySelector(this.props.autoFocusedElement);t&&t.focus()}else{const t=[...a.FOCUSABLE_ELEMENTS].map((t=>t+":not(.k-dialog-titlebar *)"));a.focusFirstFocusableChild(this.element,t)}this.setState({zIndex:w(this.getCurrentZIndex(),this.getDocument(),this._id)})}}componentWillUnmount(){setTimeout((()=>{var t;!this.element&&this.activeElement&&document&&(document.contains(this.activeElement)?this.activeElement.focus():this.activeElement.id&&(null==(t=document.getElementById(this.activeElement.id))||t.focus()))}))}render(){const t=void 0!==this.props.id?this.props.id:this.titleId,{title:e,width:i,height:s,children:o,minWidth:n,dir:r,style:h,contentStyle:c,modal:g=!0}=this.props,m=l.Children.toArray(o),w=this.getContent(m),f=this.getActionBar(m),E=e?{"aria-labelledby":t}:null,C=void 0===this.props.closeIcon||this.props.closeIcon,v=this.getCurrentZIndex(),I=l.createElement(a.ZIndexContext.Provider,{value:v},l.createElement("div",{[u]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:r,style:{zIndex:v,...h},ref:t=>this.element=t},g&&l.createElement("div",{className:"k-overlay",style:this.props.overlayStyle}),l.createElement("div",{...E,className:a.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":t,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:i,height:s,minWidth:n}},this.props.title&&l.createElement(p,{closeIcon:C,onCloseButtonClick:this.onCloseDialog,id:t},e),l.createElement("div",{className:"k-window-content k-dialog-content",style:c,id:this.contentId},w),f,this.showLicenseWatermark&&l.createElement(a.WatermarkOverlay,null))));return a.canUseDOM?null!==this.props.appendTo?d.createPortal(I,this.props.appendTo||document.body):I:null}getActionBar(t){return t.filter((t=>t&&t.type===c))}getContent(t){return t.filter((t=>t&&t.type!==c))}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}};f.displayName="Dialog",f.propTypes={title:s.any,id:s.string,dir:s.string,style:s.object,closeIcon:s.bool,width:s.oneOfType([s.number,s.string]),height:s.oneOfType([s.number,s.string]),minWidth:s.oneOfType([s.number,s.string]),autoFocus:s.bool},f.defaultProps={autoFocus:!1},f.contextType=a.ZIndexContext;let E=f;const C=a.createPropsContext(),v=a.withIdHOC(a.withPropsContext(C,E));v.displayName="KendoReactDialog";var I=(t=>(t.DEFAULT="DEFAULT",t.FULLSCREEN="FULLSCREEN",t.MINIMIZED="MINIMIZED",t))(I||{});const S="dialogs.windowMaximizeButton",k="dialogs.windowMinimizeButton",y="dialogs.windowRestoreButton",b="dialogs.windowCloseButton",D={[S]:"maximize",[k]:"minimize",[y]:"restore",[b]:"close"},T=t=>{const{children:e,onCloseButtonClick:i,onMinimizeButtonClick:s,onFullScreenButtonClick:a,onRestoreButtonClick:h,onDoubleClick:d,stage:p,forwardedRef:c,id:g}=t,u=r.useLocalization(),m=t.minimizeButton?l.createElement(t.minimizeButton,{onClick:s,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:n.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:s,"aria-label":u.toLanguageString(k,D[k])}),w=t.maximizeButton?l.createElement(t.maximizeButton,{onClick:a,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:n.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":u.toLanguageString(S,D[S])}),f=t.restoreButton?l.createElement(t.restoreButton,{onClick:h,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"window-restore",svgIcon:n.windowRestoreIcon,className:"k-window-titlebar-action",onClick:h,"aria-label":u.toLanguageString(y,D[y])}),E=t.closeButton?l.createElement(t.closeButton,{onClick:i,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"x",svgIcon:n.xIcon,className:"k-window-titlebar-action",onClick:i,"aria-label":u.toLanguageString(b,D[b])});return l.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:c,onDoubleClick:d},l.createElement("span",{className:"k-window-title",id:g},e||""),l.createElement("div",{className:"k-window-titlebar-actions"},p===I.DEFAULT&&m,p===I.DEFAULT&&w,p!==I.DEFAULT&&f,E))},x=l.forwardRef(((t,e)=>l.createElement(T,{...t,forwardedRef:e}))),B=["n","e","s","w","se","sw","ne","nw"];class L extends l.Component{render(){return l.createElement("div",{className:"k-resize-handles-wrapper"}," ",B.map(((t,e)=>l.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})}},l.createElement("div",{className:"k-resize-handle k-resize-"+t,style:{display:"block",touchAction:"none",userSelect:"none"}})))))}}class N extends l.Component{shouldComponentUpdate(t){return t.shouldUpdateOnDrag||!t.isDragging}render(){return this.props.children}}const F=t=>{const e={layout:"end",...t},{layout:i,children:s}=e,o=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 l.createElement("div",{className:o},s)};F.propTypes={children:s.any,layout:s.oneOf(["start","center","end","stretched"])};const M=class extends l.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.showLicenseWatermark=!1,this.activeElement=null,this.onKeyDown=t=>{if(this.props.modal&&a.keepFocusInContainer(t,this.element),t.target!==t.currentTarget)return;const e=this.props.minWidth||120,i=this.props.minHeight||100;if((t.metaKey||t.ctrlKey)&&this.props.resizable){switch(t.keyCode){case a.Keys.up:t.preventDefault(),i<=this.height-5&&this.setState({height:this.height-5});break;case a.Keys.down:t.preventDefault(),this.setState({height:this.height+5});break;case a.Keys.left:e<=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===I.MINIMIZED?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})):this.windowStage===I.DEFAULT&&(this.handleFullscreen(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.FULLSCREEN}));break;case a.Keys.down:this.windowStage===I.FULLSCREEN?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})):this.windowStage===I.DEFAULT&&(this.handleMinimize(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.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!==I.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!==I.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:w(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(void 0!==this.props.top)return this.props.top;if(void 0!==this.props.initialTop)return this.props.initialTop;let t=300;if(void 0!==this.props.height?t=this.props.height:void 0!==this.props.initialHeight&&(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(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:I.MINIMIZED,height:0}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.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,s=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:s,stage:I.FULLSCREEN}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===I.FULLSCREEN?this.setState({stage:I.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===I.MINIMIZED&&this.setState({stage:I.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===I.FULLSCREEN||this.windowStage===I.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const i=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,s=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,o=this.width,n=this.height,a=this.props.minWidth||120,r=this.props.minHeight||100,h=this.top-s,l=this.left-i,d=i-this.left,p=s-this.top,c=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&r-(n+h)<0&&(this.top>0&&(c.height=n+h),c.top=s),e.direction.indexOf("s")>=0&&r-p<0&&(c.height=p),e.direction.indexOf("w")>=0&&a-(o+l)<0&&(this.left>0&&(c.width=o+l),c.left=i),e.direction.indexOf("e")>=0&&a-d<0&&(c.width=d),this.setState(c),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,i,s)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:i,end:s,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===I.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:m,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},a.validatePackage(g),this.showLicenseWatermark=a.shouldShowValidationUI(g),this.state={stage:this.props.stage||I.DEFAULT,isDragging:!1,top:0,left:0,width:300,height:300,focused:!0,zIndex:m},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||I.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:w(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&&document&&(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});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=l.Children.toArray(this.props.children),e=this.getContent(t),i=this.getActionBar(t),s=this.getCurrentZIndex(),o=a.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":"MINIMIZED"===this.state.stage,"k-window-focused":this.state.focused}),n=l.createElement(a.ZIndexContext.Provider,{value:s},l.createElement(l.Fragment,null,this.props.modal&&l.createElement("div",{className:"k-overlay",style:{zIndex:s,...this.props.overlayStyle}}),l.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:o,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:s,...this.props.style}},l.createElement(N,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},l.createElement(a.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,autoScroll:!1,ref:t=>this.draggable=t},l.createElement(x,{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!==I.MINIMIZED?l.createElement(l.Fragment,null,l.createElement("div",{className:"k-window-content"},e),i):null,this.windowStage===I.DEFAULT&&this.props.resizable?l.createElement(L,{onResize:this.handleResize}):null),this.showLicenseWatermark&&l.createElement(a.WatermarkOverlay,null))));return a.canUseDOM?null!==this.props.appendTo?d.createPortal(n,this.props.appendTo||document.body):n:null}get top(){return this.windowStage!==I.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==I.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let t=this.props.width||this.state.width;if(this.windowStage===I.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===I.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetHeight,t;const e=this.getWindow();t=e?e.innerHeight:0}else this.windowStage===I.MINIMIZED&&(t=0);return t}get windowStage(){return this.props.stage||this.state.stage}getActionBar(t){return t.filter((t=>t&&t.type===F))}getContent(t){return t.filter((t=>t&&t.type!==F))}generateTitleId(){return"window-title-"+this._id}};M.displayName="Window",M.propTypes={width:s.number,height:s.number,left:s.number,top:s.number,initialWidth:s.number,initialHeight:s.number,initialLeft:s.number,initialTop:s.number,minWidth:s.number,minHeight:s.number,resizable:s.bool,draggable:s.bool,title:s.any,shouldUpdateOnDrag:s.bool,stage:s.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:s.string,id:s.string,style:s.object,overlayStyle:s.object,autoFocus:s.bool},M.defaultProps={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},M.contextType=a.ZIndexContext;let z=M;const R=a.createPropsContext(),W=a.withIdHOC(a.withPropsContext(R,z));W.displayName="KendoReactWindow",t.Dialog=v,t.DialogActionsBar=c,t.DialogPropsContext=C,t.Window=W,t.WindowActionsBar=F,t.WindowPropsContext=R,t.WindowWithoutContext=z}));
|
|
8
|
+
!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,s,o,n,a,r){"use strict";function h(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var l=h(e),d=h(i);const p=({children:t,onCloseButtonClick:e,id:i,closeIcon:s})=>l.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:i},l.createElement("span",{className:"k-window-title k-dialog-title"},t),s&&l.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},l.createElement(o.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:s}=e,o=a.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${i}`]:i});return l.createElement("div",{className:o},s)};c.propTypes={children:s.any,layout:s.oneOf(["start","center","end","stretched"])};const g={name:"@progress/kendo-react-dialogs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},u="data-windowid",m=10002,w=(t,e,i)=>{let s=t;if(e&&e.defaultView){const t=e.querySelectorAll(".k-window:not(.k-dialog), .k-dialog-wrapper");let o=!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>=s&&(s=t,o=!0)}})),o?s+2:s}return s},f=class extends l.Component{constructor(t){super(t),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.activeElement=null,this.onCloseDialog=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,void 0)},this.onKeyDown=t=>{t.keyCode===a.Keys.esc&&this.props.onClose&&(t.preventDefault(),this.onCloseDialog(t)),a.keepFocusInContainer(t,this.element)},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:m,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,a.validatePackage(g),this.showLicenseWatermark=a.shouldShowValidationUI(g),this.activeElement=a.getActiveElement(document)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){if(this.element){if(this.props.autoFocus&&!this.props.autoFocusedElement)this.element.focus();else if(this.props.autoFocus&&this.props.autoFocusedElement)this.element.focus();else if(!this.props.autoFocus&&this.props.autoFocusedElement){const t=this.element.querySelector(this.props.autoFocusedElement);t&&t.focus()}else{const t=[...a.FOCUSABLE_ELEMENTS].map((t=>t+":not(.k-dialog-titlebar *)"));a.focusFirstFocusableChild(this.element,t)}this.setState({zIndex:w(this.getCurrentZIndex(),this.getDocument(),this._id)})}}componentWillUnmount(){setTimeout((()=>{var t;!this.element&&this.activeElement&&document&&(document.contains(this.activeElement)?this.activeElement.focus():this.activeElement.id&&(null==(t=document.getElementById(this.activeElement.id))||t.focus()))}))}render(){const t=void 0!==this.props.id?this.props.id:this.titleId,{title:e,width:i,height:s,children:o,minWidth:n,dir:r,style:h,contentStyle:c,modal:g=!0}=this.props,m=l.Children.toArray(o),w=this.getContent(m),f=this.getActionBar(m),E=e?{"aria-labelledby":t}:null,C=void 0===this.props.closeIcon||this.props.closeIcon,v=this.getCurrentZIndex(),I=l.createElement(a.ZIndexContext.Provider,{value:v},l.createElement("div",{[u]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:r,style:{zIndex:v,...h},ref:t=>this.element=t},g&&l.createElement("div",{className:"k-overlay",style:this.props.overlayStyle}),l.createElement("div",{...E,className:a.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":t,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:i,height:s,minWidth:n}},this.props.title&&l.createElement(p,{closeIcon:C,onCloseButtonClick:this.onCloseDialog,id:t},e),l.createElement("div",{className:"k-window-content k-dialog-content",style:c,id:this.contentId},w),f,this.showLicenseWatermark&&l.createElement(a.WatermarkOverlay,null))));return a.canUseDOM?null!==this.props.appendTo?d.createPortal(I,this.props.appendTo||document.body):I:null}getActionBar(t){return t.filter((t=>t&&t.type===c))}getContent(t){return t.filter((t=>t&&t.type!==c))}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}};f.displayName="Dialog",f.propTypes={title:s.any,id:s.string,dir:s.string,style:s.object,closeIcon:s.bool,width:s.oneOfType([s.number,s.string]),height:s.oneOfType([s.number,s.string]),minWidth:s.oneOfType([s.number,s.string]),autoFocus:s.bool},f.defaultProps={autoFocus:!1},f.contextType=a.ZIndexContext;let E=f;const C=a.createPropsContext(),v=a.withIdHOC(a.withPropsContext(C,E));v.displayName="KendoReactDialog";var I=(t=>(t.DEFAULT="DEFAULT",t.FULLSCREEN="FULLSCREEN",t.MINIMIZED="MINIMIZED",t))(I||{});const S="dialogs.windowMaximizeButton",k="dialogs.windowMinimizeButton",y="dialogs.windowRestoreButton",b="dialogs.windowCloseButton",D={[S]:"maximize",[k]:"minimize",[y]:"restore",[b]:"close"},T=t=>{const{children:e,onCloseButtonClick:i,onMinimizeButtonClick:s,onFullScreenButtonClick:a,onRestoreButtonClick:h,onDoubleClick:d,stage:p,forwardedRef:c,id:g}=t,u=r.useLocalization(),m=t.minimizeButton?l.createElement(t.minimizeButton,{onClick:s,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:n.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:s,"aria-label":u.toLanguageString(k,D[k])}),w=t.maximizeButton?l.createElement(t.maximizeButton,{onClick:a,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:n.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":u.toLanguageString(S,D[S])}),f=t.restoreButton?l.createElement(t.restoreButton,{onClick:h,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"window-restore",svgIcon:n.windowRestoreIcon,className:"k-window-titlebar-action",onClick:h,"aria-label":u.toLanguageString(y,D[y])}),E=t.closeButton?l.createElement(t.closeButton,{onClick:i,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"x",svgIcon:n.xIcon,className:"k-window-titlebar-action",onClick:i,"aria-label":u.toLanguageString(b,D[b])});return l.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:c,onDoubleClick:d},l.createElement("span",{className:"k-window-title",id:g},e||""),l.createElement("div",{className:"k-window-titlebar-actions"},p===I.DEFAULT&&m,p===I.DEFAULT&&w,p!==I.DEFAULT&&f,E))},x=l.forwardRef(((t,e)=>l.createElement(T,{...t,forwardedRef:e}))),B=["n","e","s","w","se","sw","ne","nw"];class L extends l.Component{render(){return l.createElement("div",{className:"k-resize-handles-wrapper"}," ",B.map(((t,e)=>l.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})}},l.createElement("div",{className:"k-resize-handle k-resize-"+t,style:{display:"block",touchAction:"none",userSelect:"none"}})))))}}class N extends l.Component{shouldComponentUpdate(t){return t.shouldUpdateOnDrag||!t.isDragging}render(){return this.props.children}}const F=t=>{const e={layout:"end",...t},{layout:i,children:s}=e,o=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 l.createElement("div",{className:o},s)};F.propTypes={children:s.any,layout:s.oneOf(["start","center","end","stretched"])};const M=class extends l.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.showLicenseWatermark=!1,this.activeElement=null,this.onKeyDown=t=>{if(this.props.modal&&a.keepFocusInContainer(t,this.element),t.target!==t.currentTarget)return;const e=this.props.minWidth||120,i=this.props.minHeight||100;if((t.metaKey||t.ctrlKey)&&this.props.resizable){switch(t.keyCode){case a.Keys.up:t.preventDefault(),i<=this.height-5&&this.setState({height:this.height-5});break;case a.Keys.down:t.preventDefault(),this.setState({height:this.height+5});break;case a.Keys.left:e<=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===I.MINIMIZED?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})):this.windowStage===I.DEFAULT&&(this.handleFullscreen(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.FULLSCREEN}));break;case a.Keys.down:this.windowStage===I.FULLSCREEN?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})):this.windowStage===I.DEFAULT&&(this.handleMinimize(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.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!==I.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!==I.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:w(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(void 0!==this.props.top)return this.props.top;if(void 0!==this.props.initialTop)return this.props.initialTop;let t=300;if(void 0!==this.props.height?t=this.props.height:void 0!==this.props.initialHeight&&(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(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:I.MINIMIZED,height:0}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.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,s=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:s,stage:I.FULLSCREEN}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===I.FULLSCREEN?this.setState({stage:I.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===I.MINIMIZED&&this.setState({stage:I.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===I.FULLSCREEN||this.windowStage===I.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const i=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,s=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,o=this.width,n=this.height,a=this.props.minWidth||120,r=this.props.minHeight||100,h=this.top-s,l=this.left-i,d=i-this.left,p=s-this.top,c=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&r-(n+h)<0&&(this.top>0&&(c.height=n+h),c.top=s),e.direction.indexOf("s")>=0&&r-p<0&&(c.height=p),e.direction.indexOf("w")>=0&&a-(o+l)<0&&(this.left>0&&(c.width=o+l),c.left=i),e.direction.indexOf("e")>=0&&a-d<0&&(c.width=d),this.setState(c),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,i,s)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:i,end:s,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===I.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:m,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},a.validatePackage(g),this.showLicenseWatermark=a.shouldShowValidationUI(g),this.state={stage:this.props.stage||I.DEFAULT,isDragging:!1,top:0,left:0,width:300,height:300,focused:!0,zIndex:m},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||I.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:w(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&&document&&(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});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=l.Children.toArray(this.props.children),e=this.getContent(t),i=this.getActionBar(t),s=this.getCurrentZIndex(),o=a.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":"MINIMIZED"===this.state.stage,"k-window-focused":this.state.focused}),n=l.createElement(a.ZIndexContext.Provider,{value:s},l.createElement(l.Fragment,null,this.props.modal&&l.createElement("div",{className:"k-overlay",style:{zIndex:s,...this.props.overlayStyle}}),l.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:o,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:s,...this.props.style}},l.createElement(N,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},l.createElement(a.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,autoScroll:!1,ref:t=>this.draggable=t},l.createElement(x,{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!==I.MINIMIZED?l.createElement(l.Fragment,null,l.createElement("div",{className:"k-window-content"},e),i):null,this.windowStage===I.DEFAULT&&this.props.resizable?l.createElement(L,{onResize:this.handleResize}):null),this.showLicenseWatermark&&l.createElement(a.WatermarkOverlay,null))));return a.canUseDOM?null!==this.props.appendTo?d.createPortal(n,this.props.appendTo||document.body):n:null}get top(){return this.windowStage!==I.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==I.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let t=this.props.width||this.state.width;if(this.windowStage===I.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===I.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetHeight,t;const e=this.getWindow();t=e?e.innerHeight:0}else this.windowStage===I.MINIMIZED&&(t=0);return t}get windowStage(){return this.props.stage||this.state.stage}getActionBar(t){return t.filter((t=>t&&t.type===F))}getContent(t){return t.filter((t=>t&&t.type!==F))}generateTitleId(){return"window-title-"+this._id}};M.displayName="Window",M.propTypes={width:s.number,height:s.number,left:s.number,top:s.number,initialWidth:s.number,initialHeight:s.number,initialLeft:s.number,initialTop:s.number,minWidth:s.number,minHeight:s.number,resizable:s.bool,draggable:s.bool,title:s.any,shouldUpdateOnDrag:s.bool,stage:s.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:s.string,id:s.string,style:s.object,overlayStyle:s.object,autoFocus:s.bool},M.defaultProps={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},M.contextType=a.ZIndexContext;let z=M;const R=a.createPropsContext(),W=a.withIdHOC(a.withPropsContext(R,z));W.displayName="KendoReactWindow",t.Dialog=v,t.DialogActionsBar=c,t.DialogPropsContext=C,t.Window=W,t.WindowActionsBar=F,t.WindowPropsContext=R,t.WindowWithoutContext=z}));
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-dialogs",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1729494537,
|
|
14
14
|
version: "",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-dialogs",
|
|
3
|
-
"version": "9.0.0-develop.
|
|
3
|
+
"version": "9.0.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",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-licensing": "^1.3.4",
|
|
26
|
-
"@progress/kendo-react-buttons": "9.0.0-develop.
|
|
27
|
-
"@progress/kendo-react-common": "9.0.0-develop.
|
|
26
|
+
"@progress/kendo-react-buttons": "9.0.0-develop.3",
|
|
27
|
+
"@progress/kendo-react-common": "9.0.0-develop.3",
|
|
28
28
|
"@progress/kendo-svg-icons": "^3.0.0",
|
|
29
29
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
30
30
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
package/utils.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./constants.js"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./constants.js"),u=(I,t,i)=>{let e=I;if(t&&t.defaultView){const o=t.querySelectorAll(l.DIALOGS_SELECTOR);let a=!1;return o.forEach(d=>{const n=t.defaultView.getComputedStyle(d,null);if(d.getAttribute(l.DATA_DIALOGS_ID)!==i&&n.zIndex!==null){const s=parseInt(n.zIndex,10);s>=e&&(e=s,a=!0)}}),a?e+l.ZINDEX_DIALOGS_STEP:e}return e};exports.getMaxZIndex=u;
|
package/utils.mjs
CHANGED
|
@@ -6,21 +6,22 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import { DIALOGS_SELECTOR as
|
|
10
|
-
const
|
|
11
|
-
let e =
|
|
9
|
+
import { DIALOGS_SELECTOR as s, DATA_DIALOGS_ID as x, ZINDEX_DIALOGS_STEP as f } from "./constants.mjs";
|
|
10
|
+
const u = (n, t, i) => {
|
|
11
|
+
let e = n;
|
|
12
12
|
if (t && t.defaultView) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const o = t.querySelectorAll(s);
|
|
14
|
+
let l = !1;
|
|
15
|
+
return o.forEach((d) => {
|
|
16
|
+
const a = t.defaultView.getComputedStyle(d, null);
|
|
17
|
+
if (d.getAttribute(x) !== i && a.zIndex !== null) {
|
|
18
|
+
const I = parseInt(a.zIndex, 10);
|
|
18
19
|
I >= e && (e = I, l = !0);
|
|
19
20
|
}
|
|
20
|
-
}), l ? e +
|
|
21
|
+
}), l ? e + f : e;
|
|
21
22
|
}
|
|
22
23
|
return e;
|
|
23
24
|
};
|
|
24
25
|
export {
|
|
25
|
-
|
|
26
|
+
u as getMaxZIndex
|
|
26
27
|
};
|