@progress/kendo-react-dialogs 7.2.4-develop.3 → 7.2.4-develop.4
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.js +8 -0
- package/Dialog.mjs +122 -0
- package/DialogActionsBar.js +8 -0
- package/DialogActionsBar.mjs +32 -0
- package/DialogTitleBar.js +8 -0
- package/DialogTitleBar.mjs +26 -0
- package/MiddleLayerOptimization.js +8 -0
- package/MiddleLayerOptimization.mjs +20 -0
- package/StageEnum.js +8 -0
- package/StageEnum.mjs +12 -0
- package/Window.js +8 -0
- package/Window.mjs +407 -0
- package/WindowActionsBar.js +8 -0
- package/WindowActionsBar.mjs +36 -0
- package/WindowResizeHandlers.js +8 -0
- package/WindowResizeHandlers.mjs +39 -0
- package/WindowTitlebar.js +8 -0
- package/WindowTitlebar.mjs +87 -0
- package/constants.js +8 -0
- package/constants.mjs +15 -0
- package/dist/cdn/js/kendo-react-dialogs.js +8 -5
- package/index.d.mts +599 -5
- package/index.d.ts +599 -13
- package/index.js +8 -5
- package/index.mjs +17 -687
- package/messages/index.js +8 -0
- package/messages/index.mjs +21 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +3 -3
- package/utils.js +8 -0
- package/utils.mjs +26 -0
- package/Dialog.d.ts +0 -94
- package/DialogActionsBar.d.ts +0 -25
- package/DialogProps.d.ts +0 -77
- package/DialogTitleBar.d.ts +0 -30
- package/MiddleLayerOptimization.d.ts +0 -21
- package/StageEnum.d.ts +0 -9
- package/Window.d.ts +0 -179
- package/WindowActionsBar.d.ts +0 -25
- package/WindowProps.d.ts +0 -151
- package/WindowResizeHandlers.d.ts +0 -20
- package/WindowTitlebar.d.ts +0 -67
- package/constants.d.ts +0 -12
- package/events.d.ts +0 -49
- package/messages/index.d.ts +0 -29
- package/models/actions-layout.d.ts +0 -8
- package/package-metadata.d.ts +0 -9
- package/utils.d.ts +0 -6
package/index.mjs
CHANGED
|
@@ -1,690 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
5
8
|
"use client";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { xIcon as j, windowMinimizeIcon as et, windowIcon as it, windowRestoreIcon as st } from "@progress/kendo-svg-icons";
|
|
11
|
-
import { classNames as x, ZIndexContext as L, createPropsContext as G, withIdHOC as X, withPropsContext as V, dispatchEvent as f, Keys as c, keepFocusInContainer as ot, validatePackage as Y, shouldShowValidationUI as $, WatermarkOverlay as q, canUseDOM as J, Draggable as Q } from "@progress/kendo-react-common";
|
|
12
|
-
import { useLocalization as nt } from "@progress/kendo-react-intl";
|
|
13
|
-
const at = ({ children: r, onCloseButtonClick: i, id: t, closeIcon: e }) => /* @__PURE__ */ s.createElement("div", { className: "k-window-titlebar k-dialog-titlebar", id: t }, /* @__PURE__ */ s.createElement("span", { className: "k-window-title k-dialog-title" }, r), /* @__PURE__ */ s.createElement("div", { className: "k-window-titlebar-actions k-dialog-titlebar-actions" }, e && /* @__PURE__ */ s.createElement(
|
|
14
|
-
D,
|
|
15
|
-
{
|
|
16
|
-
role: "button",
|
|
17
|
-
"aria-label": "Close",
|
|
18
|
-
onClick: i,
|
|
19
|
-
icon: "x",
|
|
20
|
-
svgIcon: j,
|
|
21
|
-
fillMode: "flat",
|
|
22
|
-
className: "k-window-titlebar-action k-dialog-titlebar-action"
|
|
23
|
-
}
|
|
24
|
-
))), v = (r) => {
|
|
25
|
-
const i = {
|
|
26
|
-
layout: "stretched",
|
|
27
|
-
...r
|
|
28
|
-
}, { layout: t, children: e } = i, n = x(
|
|
29
|
-
"k-actions",
|
|
30
|
-
"k-actions-horizontal",
|
|
31
|
-
"k-window-actions k-dialog-actions",
|
|
32
|
-
{
|
|
33
|
-
[`k-actions-${t}`]: t
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
return /* @__PURE__ */ s.createElement("div", { className: n }, e);
|
|
37
|
-
};
|
|
38
|
-
v.propTypes = {
|
|
39
|
-
children: o.any,
|
|
40
|
-
layout: o.oneOf(["start", "center", "end", "stretched"])
|
|
41
|
-
};
|
|
42
|
-
const y = {
|
|
43
|
-
name: "@progress/kendo-react-dialogs",
|
|
44
|
-
productName: "KendoReact",
|
|
45
|
-
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
46
|
-
publishDate: 1709631786,
|
|
47
|
-
version: "",
|
|
48
|
-
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
49
|
-
}, O = "data-windowid", N = 10002, S = 2, rt = ".k-window:not(.k-dialog), .k-dialog-wrapper", z = (r, i, t) => {
|
|
50
|
-
let e = r;
|
|
51
|
-
if (i && i.defaultView) {
|
|
52
|
-
let n = i.querySelectorAll(rt), l = !1;
|
|
53
|
-
return n.forEach((d) => {
|
|
54
|
-
let h = i.defaultView.getComputedStyle(d, null);
|
|
55
|
-
if (d.getAttribute(O) !== t && h.zIndex !== null) {
|
|
56
|
-
let w = parseInt(h.zIndex, 10);
|
|
57
|
-
w >= e && (e = w, l = !0);
|
|
58
|
-
}
|
|
59
|
-
}), l ? e + S : e;
|
|
60
|
-
}
|
|
61
|
-
return e;
|
|
62
|
-
};
|
|
63
|
-
class k extends s.Component {
|
|
64
|
-
constructor(i) {
|
|
65
|
-
super(i), this.context = 0, this.titleId = this.generateTitleId(), this.contentId = this.generateContentId(), this.showLicenseWatermark = !1, this.onCloseDialog = (t) => {
|
|
66
|
-
t.preventDefault(), f(this.props.onClose, t, this, void 0);
|
|
67
|
-
}, this.onKeyDown = (t) => {
|
|
68
|
-
t.keyCode === c.esc && this.props.onClose && (t.preventDefault(), this.onCloseDialog(t)), ot(t, this.element);
|
|
69
|
-
}, this.getCurrentZIndex = () => !this.state || this.context === void 0 ? this.context ? this.context : N : this.state.zIndex > (this.context ? this.context + S : 0) ? this.state.zIndex : this.context + S, this.getDocument = () => this.props.appendTo ? this.props.appendTo.ownerDocument : document, Y(y), this.showLicenseWatermark = $(y);
|
|
70
|
-
}
|
|
71
|
-
get _id() {
|
|
72
|
-
return this.props.id + "-accessibility-id";
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @hidden
|
|
76
|
-
*/
|
|
77
|
-
componentDidMount() {
|
|
78
|
-
this.element && (this.props.autoFocus && this.element.focus(), this.setState({
|
|
79
|
-
zIndex: z(this.getCurrentZIndex(), this.getDocument(), this._id)
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* @hidden
|
|
84
|
-
*/
|
|
85
|
-
render() {
|
|
86
|
-
const i = this.props.id !== void 0 ? this.props.id : this.titleId, { title: t, width: e, height: n, children: l, minWidth: d, dir: h, style: m, contentStyle: w } = this.props, g = s.Children.toArray(l), C = this.getContent(g), E = this.getActionBar(g), I = t ? {
|
|
87
|
-
"aria-labelledby": i
|
|
88
|
-
} : null, p = this.props.closeIcon !== void 0 ? this.props.closeIcon : !0, Z = this.getCurrentZIndex(), P = /* @__PURE__ */ s.createElement(L.Provider, { value: Z }, /* @__PURE__ */ s.createElement(
|
|
89
|
-
"div",
|
|
90
|
-
{
|
|
91
|
-
[O]: this._id,
|
|
92
|
-
className: "k-dialog-wrapper" + (this.props.className ? " " + this.props.className : ""),
|
|
93
|
-
onKeyDown: this.onKeyDown,
|
|
94
|
-
tabIndex: 0,
|
|
95
|
-
dir: h,
|
|
96
|
-
style: {
|
|
97
|
-
zIndex: Z,
|
|
98
|
-
...m
|
|
99
|
-
},
|
|
100
|
-
ref: (tt) => this.element = tt
|
|
101
|
-
},
|
|
102
|
-
/* @__PURE__ */ s.createElement("div", { className: "k-overlay" }),
|
|
103
|
-
/* @__PURE__ */ s.createElement(
|
|
104
|
-
"div",
|
|
105
|
-
{
|
|
106
|
-
...I,
|
|
107
|
-
className: x(
|
|
108
|
-
"k-window k-dialog",
|
|
109
|
-
{
|
|
110
|
-
[`k-window-${this.props.themeColor}`]: this.props.themeColor
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
role: "dialog",
|
|
114
|
-
"aria-labelledby": i,
|
|
115
|
-
"aria-modal": !0,
|
|
116
|
-
"aria-describedby": this.contentId,
|
|
117
|
-
style: { width: e, height: n, minWidth: d }
|
|
118
|
-
},
|
|
119
|
-
this.props.title && /* @__PURE__ */ s.createElement(
|
|
120
|
-
at,
|
|
121
|
-
{
|
|
122
|
-
closeIcon: p,
|
|
123
|
-
onCloseButtonClick: this.onCloseDialog,
|
|
124
|
-
id: i
|
|
125
|
-
},
|
|
126
|
-
t
|
|
127
|
-
),
|
|
128
|
-
/* @__PURE__ */ s.createElement("div", { className: "k-window-content k-dialog-content", style: w, id: this.contentId }, C),
|
|
129
|
-
E,
|
|
130
|
-
this.showLicenseWatermark && /* @__PURE__ */ s.createElement(q, null)
|
|
131
|
-
)
|
|
132
|
-
));
|
|
133
|
-
return J ? this.props.appendTo !== null ? K.createPortal(P, this.props.appendTo || document.body) : P : null;
|
|
134
|
-
}
|
|
135
|
-
getActionBar(i) {
|
|
136
|
-
return i.filter((t) => t && t.type === v);
|
|
137
|
-
}
|
|
138
|
-
getContent(i) {
|
|
139
|
-
return i.filter((t) => t && t.type !== v);
|
|
140
|
-
}
|
|
141
|
-
generateTitleId() {
|
|
142
|
-
return "dialog-title-" + this._id;
|
|
143
|
-
}
|
|
144
|
-
generateContentId() {
|
|
145
|
-
return "dialog-content-" + this._id;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
k.displayName = "Dialog";
|
|
149
|
-
k.propTypes = {
|
|
150
|
-
title: o.any,
|
|
151
|
-
id: o.string,
|
|
152
|
-
dir: o.string,
|
|
153
|
-
style: o.object,
|
|
154
|
-
closeIcon: o.bool,
|
|
155
|
-
width: o.oneOfType([o.number, o.string]),
|
|
156
|
-
height: o.oneOfType([o.number, o.string]),
|
|
157
|
-
minWidth: o.oneOfType([o.number, o.string]),
|
|
158
|
-
autoFocus: o.bool
|
|
159
|
-
};
|
|
160
|
-
k.defaultProps = {
|
|
161
|
-
autoFocus: !1
|
|
162
|
-
};
|
|
163
|
-
k.contextType = L;
|
|
164
|
-
const ht = G(), lt = X(V(ht, k));
|
|
165
|
-
lt.displayName = "KendoReactDialog";
|
|
166
|
-
var a = /* @__PURE__ */ ((r) => (r.DEFAULT = "DEFAULT", r.FULLSCREEN = "FULLSCREEN", r.MINIMIZED = "MINIMIZED", r))(a || {});
|
|
167
|
-
const M = "dialogs.windowMaximizeButton", A = "dialogs.windowMinimizeButton", R = "dialogs.windowRestoreButton", F = "dialogs.windowCloseButton", b = {
|
|
168
|
-
[M]: "maximize",
|
|
169
|
-
[A]: "minimize",
|
|
170
|
-
[R]: "restore",
|
|
171
|
-
[F]: "close"
|
|
172
|
-
}, dt = (r) => {
|
|
173
|
-
const {
|
|
174
|
-
children: i,
|
|
175
|
-
onCloseButtonClick: t,
|
|
176
|
-
onMinimizeButtonClick: e,
|
|
177
|
-
onFullScreenButtonClick: n,
|
|
178
|
-
onRestoreButtonClick: l,
|
|
179
|
-
onDoubleClick: d,
|
|
180
|
-
stage: h,
|
|
181
|
-
forwardedRef: m,
|
|
182
|
-
id: w
|
|
183
|
-
} = r, g = nt(), C = r.minimizeButton ? /* @__PURE__ */ s.createElement(r.minimizeButton, { onClick: e, stage: h }) : /* @__PURE__ */ s.createElement(
|
|
184
|
-
D,
|
|
185
|
-
{
|
|
186
|
-
fillMode: "flat",
|
|
187
|
-
icon: "window-minimize",
|
|
188
|
-
svgIcon: et,
|
|
189
|
-
className: "k-window-titlebar-action",
|
|
190
|
-
onClick: e,
|
|
191
|
-
"aria-label": g.toLanguageString(A, b[A])
|
|
192
|
-
}
|
|
193
|
-
), E = r.maximizeButton ? /* @__PURE__ */ s.createElement(r.maximizeButton, { onClick: n, stage: h }) : /* @__PURE__ */ s.createElement(
|
|
194
|
-
D,
|
|
195
|
-
{
|
|
196
|
-
fillMode: "flat",
|
|
197
|
-
icon: "window-maximize",
|
|
198
|
-
svgIcon: it,
|
|
199
|
-
className: "k-window-titlebar-action",
|
|
200
|
-
onClick: n,
|
|
201
|
-
"aria-label": g.toLanguageString(M, b[M])
|
|
202
|
-
}
|
|
203
|
-
), I = r.restoreButton ? /* @__PURE__ */ s.createElement(r.restoreButton, { onClick: l, stage: h }) : /* @__PURE__ */ s.createElement(
|
|
204
|
-
D,
|
|
205
|
-
{
|
|
206
|
-
fillMode: "flat",
|
|
207
|
-
icon: "window-restore",
|
|
208
|
-
svgIcon: st,
|
|
209
|
-
className: "k-window-titlebar-action",
|
|
210
|
-
onClick: l,
|
|
211
|
-
"aria-label": g.toLanguageString(R, b[R])
|
|
212
|
-
}
|
|
213
|
-
), p = r.closeButton ? /* @__PURE__ */ s.createElement(r.closeButton, { onClick: t, stage: h }) : /* @__PURE__ */ s.createElement(
|
|
214
|
-
D,
|
|
215
|
-
{
|
|
216
|
-
fillMode: "flat",
|
|
217
|
-
icon: "x",
|
|
218
|
-
svgIcon: j,
|
|
219
|
-
className: "k-window-titlebar-action",
|
|
220
|
-
onClick: t,
|
|
221
|
-
"aria-label": g.toLanguageString(F, b[F])
|
|
222
|
-
}
|
|
223
|
-
);
|
|
224
|
-
return /* @__PURE__ */ s.createElement(
|
|
225
|
-
"div",
|
|
226
|
-
{
|
|
227
|
-
className: "k-window-titlebar",
|
|
228
|
-
style: { touchAction: "none" },
|
|
229
|
-
ref: m,
|
|
230
|
-
onDoubleClick: d
|
|
231
|
-
},
|
|
232
|
-
/* @__PURE__ */ s.createElement("span", { className: "k-window-title", id: w }, i || ""),
|
|
233
|
-
/* @__PURE__ */ s.createElement("div", { className: "k-window-titlebar-actions" }, h === a.DEFAULT && C, h === a.DEFAULT && E, h !== a.DEFAULT && I, p)
|
|
234
|
-
);
|
|
235
|
-
}, ct = s.forwardRef((r, i) => /* @__PURE__ */ s.createElement(
|
|
236
|
-
dt,
|
|
237
|
-
{
|
|
238
|
-
...r,
|
|
239
|
-
forwardedRef: i
|
|
240
|
-
}
|
|
241
|
-
)), pt = ["n", "e", "s", "w", "se", "sw", "ne", "nw"];
|
|
242
|
-
class gt extends s.Component {
|
|
243
|
-
render() {
|
|
244
|
-
return /* @__PURE__ */ s.createElement("div", { className: "k-resize-handles-wrapper" }, " ", pt.map((i, t) => /* @__PURE__ */ s.createElement(
|
|
245
|
-
Q,
|
|
246
|
-
{
|
|
247
|
-
key: t,
|
|
248
|
-
onDrag: (e) => {
|
|
249
|
-
const { event: n } = e;
|
|
250
|
-
n.originalEvent.preventDefault(), this.props.onResize(n, { end: !1, direction: i });
|
|
251
|
-
},
|
|
252
|
-
onRelease: (e) => {
|
|
253
|
-
const { event: n } = e;
|
|
254
|
-
n.originalEvent.preventDefault(), this.props.onResize(n, { end: !0, direction: i });
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
/* @__PURE__ */ s.createElement(
|
|
258
|
-
"div",
|
|
259
|
-
{
|
|
260
|
-
className: "k-resize-handle k-resize-" + i,
|
|
261
|
-
style: { display: "block", touchAction: "none" }
|
|
262
|
-
}
|
|
263
|
-
)
|
|
264
|
-
)));
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
class ut extends s.Component {
|
|
268
|
-
shouldComponentUpdate(i) {
|
|
269
|
-
return i.shouldUpdateOnDrag || !i.isDragging;
|
|
270
|
-
}
|
|
271
|
-
render() {
|
|
272
|
-
return this.props.children;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
const U = (r) => {
|
|
276
|
-
const i = {
|
|
277
|
-
layout: "end",
|
|
278
|
-
...r
|
|
279
|
-
}, { layout: t, children: e } = i, n = x(
|
|
280
|
-
"k-actions",
|
|
281
|
-
"k-window-actions",
|
|
282
|
-
"k-actions-horizontal",
|
|
283
|
-
"k-hstack",
|
|
284
|
-
{
|
|
285
|
-
"k-justify-content-start": t === "start",
|
|
286
|
-
"k-justify-content-center": t === "center",
|
|
287
|
-
"k-justify-content-end": t === "end",
|
|
288
|
-
"k-justify-content-stretch": t === "stretched"
|
|
289
|
-
}
|
|
290
|
-
);
|
|
291
|
-
return /* @__PURE__ */ s.createElement("div", { className: n }, e);
|
|
292
|
-
};
|
|
293
|
-
U.propTypes = {
|
|
294
|
-
children: o.any,
|
|
295
|
-
layout: o.oneOf(["start", "center", "end", "stretched"])
|
|
296
|
-
};
|
|
297
|
-
const W = 300, B = 300, H = 120, _ = 100, u = 5;
|
|
298
|
-
class T extends s.Component {
|
|
299
|
-
constructor(i) {
|
|
300
|
-
super(i), this.context = 0, this.draggable = null, this.offSetCoordinates = { x: 0, y: 0 }, this.titleId = this.generateTitleId(), this.mounted = !1, this.showLicenseWatermark = !1, this.onKeyDown = (t) => {
|
|
301
|
-
if (t.target !== t.currentTarget)
|
|
302
|
-
return;
|
|
303
|
-
const e = this.props.minWidth || H, n = this.props.minHeight || _;
|
|
304
|
-
if (t.ctrlKey && this.props.resizable) {
|
|
305
|
-
switch (t.keyCode) {
|
|
306
|
-
case c.up:
|
|
307
|
-
t.preventDefault(), n <= this.height - u && this.setState({ height: this.height - u });
|
|
308
|
-
break;
|
|
309
|
-
case c.down:
|
|
310
|
-
t.preventDefault(), this.setState({ height: this.height + u });
|
|
311
|
-
break;
|
|
312
|
-
case c.left:
|
|
313
|
-
e <= this.width - u && this.setState({ width: this.width - u });
|
|
314
|
-
break;
|
|
315
|
-
case c.right:
|
|
316
|
-
this.setState({ width: this.width + u });
|
|
317
|
-
break;
|
|
318
|
-
default:
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
this.dispatchMoveEvent(this.props.onResize, t, !1, void 0);
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
if (t.altKey) {
|
|
325
|
-
switch (t.keyCode) {
|
|
326
|
-
case c.up:
|
|
327
|
-
this.windowStage === a.MINIMIZED ? (this.handleRestore(t), f(this.props.onStageChange, t, this, { state: a.DEFAULT })) : this.windowStage === a.DEFAULT && (this.handleFullscreen(t), f(this.props.onStageChange, t, this, { state: a.FULLSCREEN }));
|
|
328
|
-
break;
|
|
329
|
-
case c.down:
|
|
330
|
-
this.windowStage === a.FULLSCREEN ? (this.handleRestore(t), f(this.props.onStageChange, t, this, { state: a.DEFAULT })) : this.windowStage === a.DEFAULT && (this.handleMinimize(t), f(this.props.onStageChange, t, this, { state: a.MINIMIZED }));
|
|
331
|
-
break;
|
|
332
|
-
}
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
if (!t.ctrlKey)
|
|
336
|
-
switch (t.keyCode) {
|
|
337
|
-
case c.esc:
|
|
338
|
-
this.props.onClose && this.handleCloseWindow(t);
|
|
339
|
-
return;
|
|
340
|
-
case c.up:
|
|
341
|
-
this.setState({ top: this.state.top - u });
|
|
342
|
-
break;
|
|
343
|
-
case c.down:
|
|
344
|
-
this.setState({ top: this.state.top + u });
|
|
345
|
-
break;
|
|
346
|
-
case c.left:
|
|
347
|
-
this.setState({ left: this.state.left - u });
|
|
348
|
-
break;
|
|
349
|
-
case c.right:
|
|
350
|
-
this.setState({ left: this.state.left + u });
|
|
351
|
-
break;
|
|
352
|
-
default:
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
this.dispatchMoveEvent(this.props.onMove, t, !1, void 0);
|
|
356
|
-
}, this.onPress = (t) => {
|
|
357
|
-
const e = t.event;
|
|
358
|
-
this.windowCoordinatesState.differenceLeft = e.pageX - this.left, this.windowCoordinatesState.differenceTop = e.pageY - this.top;
|
|
359
|
-
}, this.onDrag = (t) => {
|
|
360
|
-
const e = t.event;
|
|
361
|
-
e.originalEvent.preventDefault(), this.windowStage !== a.FULLSCREEN && this.props.draggable && (this.setState({
|
|
362
|
-
top: Math.max(e.pageY - this.windowCoordinatesState.differenceTop, 0),
|
|
363
|
-
left: e.pageX - this.windowCoordinatesState.differenceLeft,
|
|
364
|
-
isDragging: !0
|
|
365
|
-
}), this.props.onMove && this.dispatchMoveEvent(this.props.onMove, e, !0, !1));
|
|
366
|
-
}, this.onRelease = (t) => {
|
|
367
|
-
const e = t.event;
|
|
368
|
-
this.windowStage !== a.FULLSCREEN && this.props.draggable && this.props.onMove && this.dispatchMoveEvent(this.props.onMove, e, !0, !0), this.setState({
|
|
369
|
-
isDragging: !1
|
|
370
|
-
});
|
|
371
|
-
}, this.onFocus = () => {
|
|
372
|
-
this._blurTimeout ? (clearTimeout(this._blurTimeout), this._blurTimeout = void 0) : this.setState({
|
|
373
|
-
focused: !0,
|
|
374
|
-
zIndex: z(this.getCurrentZIndex(), this.getDocument(), this._id)
|
|
375
|
-
});
|
|
376
|
-
}, this.onBlur = () => {
|
|
377
|
-
clearTimeout(this._blurTimeout);
|
|
378
|
-
const t = this.getWindow();
|
|
379
|
-
t && (this._blurTimeout = t.setTimeout(() => {
|
|
380
|
-
this.mounted && this.setState({ focused: !1 }), this._blurTimeout = void 0;
|
|
381
|
-
}));
|
|
382
|
-
}, this.getInitialTop = () => {
|
|
383
|
-
if (this.props.top !== void 0)
|
|
384
|
-
return this.props.top;
|
|
385
|
-
if (this.props.initialTop !== void 0)
|
|
386
|
-
return this.props.initialTop;
|
|
387
|
-
let t = B;
|
|
388
|
-
if (this.props.height !== void 0 ? t = this.props.height : this.props.initialHeight !== void 0 && (t = this.props.initialHeight), this.props.appendTo)
|
|
389
|
-
return this.props.appendTo.offsetHeight / 2 - t / 2;
|
|
390
|
-
const e = this.getWindow();
|
|
391
|
-
return e ? e.innerHeight / 2 - t / 2 : 0;
|
|
392
|
-
}, this.getInitialLeft = () => {
|
|
393
|
-
if (this.props.left !== void 0)
|
|
394
|
-
return this.props.left;
|
|
395
|
-
if (this.props.initialLeft !== void 0)
|
|
396
|
-
return this.props.initialLeft;
|
|
397
|
-
let t = W;
|
|
398
|
-
if (this.props.width !== void 0 ? t = this.props.width : this.props.initialWidth !== void 0 && (t = this.props.initialWidth), this.props.appendTo)
|
|
399
|
-
return this.props.appendTo.offsetWidth / 2 - t / 2;
|
|
400
|
-
const e = this.getWindow();
|
|
401
|
-
return e ? e.innerWidth / 2 - t / 2 : 0;
|
|
402
|
-
}, this.getInitialWidth = () => {
|
|
403
|
-
let t = W;
|
|
404
|
-
return this.props.width !== void 0 ? t = this.props.width : this.props.initialWidth !== void 0 && (t = this.props.initialWidth), t;
|
|
405
|
-
}, this.getInitialHeight = () => {
|
|
406
|
-
let t = B;
|
|
407
|
-
return this.props.height !== void 0 ? t = this.props.height : this.props.initialHeight !== void 0 && (t = this.props.initialHeight), t;
|
|
408
|
-
}, this.handleMinimize = (t) => {
|
|
409
|
-
t.preventDefault(), this.windowCoordinatesState.leftBeforeAction = this.left, this.windowCoordinatesState.topBeforeAction = this.top, this.windowCoordinatesState.widthBeforeAction = this.width, this.windowCoordinatesState.heightBeforeAction = this.height, this.setState({
|
|
410
|
-
stage: a.MINIMIZED,
|
|
411
|
-
height: 0
|
|
412
|
-
}), f(this.props.onStageChange, t, this, { state: a.MINIMIZED });
|
|
413
|
-
}, this.handleFullscreen = (t) => {
|
|
414
|
-
t.preventDefault(), this.windowCoordinatesState.leftBeforeAction = this.left, this.windowCoordinatesState.topBeforeAction = this.top, this.windowCoordinatesState.widthBeforeAction = this.width, this.windowCoordinatesState.heightBeforeAction = this.height;
|
|
415
|
-
const e = this.getWindow(), n = e ? e.innerWidth : 0, l = e ? e.innerHeight : 0;
|
|
416
|
-
this.setState({
|
|
417
|
-
left: 0,
|
|
418
|
-
top: 0,
|
|
419
|
-
width: this.props.appendTo ? this.props.appendTo.offsetWidth : n,
|
|
420
|
-
height: this.props.appendTo ? this.props.appendTo.offsetHeight : l,
|
|
421
|
-
stage: a.FULLSCREEN
|
|
422
|
-
}), f(this.props.onStageChange, t, this, { state: a.FULLSCREEN });
|
|
423
|
-
}, this.handleRestore = (t) => {
|
|
424
|
-
t.preventDefault(), this.windowStage === a.FULLSCREEN ? this.setState({
|
|
425
|
-
stage: a.DEFAULT,
|
|
426
|
-
left: this.windowCoordinatesState.leftBeforeAction,
|
|
427
|
-
top: this.windowCoordinatesState.topBeforeAction,
|
|
428
|
-
width: this.windowCoordinatesState.widthBeforeAction,
|
|
429
|
-
height: this.windowCoordinatesState.heightBeforeAction
|
|
430
|
-
}) : this.windowStage === a.MINIMIZED && this.setState({
|
|
431
|
-
stage: a.DEFAULT,
|
|
432
|
-
height: this.windowCoordinatesState.heightBeforeAction
|
|
433
|
-
}), f(this.props.onStageChange, t, this, { state: a.DEFAULT });
|
|
434
|
-
}, this.handleCloseWindow = (t) => {
|
|
435
|
-
t.preventDefault(), f(this.props.onClose, t, this, { state: void 0 });
|
|
436
|
-
}, this.handleDoubleClick = (t) => {
|
|
437
|
-
this.windowStage === a.FULLSCREEN || this.windowStage === a.MINIMIZED ? this.handleRestore(t) : this.handleFullscreen(t);
|
|
438
|
-
}, this.handleResize = (t, e) => {
|
|
439
|
-
const n = this.props.appendTo ? t.pageX - this.offSetCoordinates.x : t.pageX, l = this.props.appendTo ? t.pageY - this.offSetCoordinates.y : t.pageY, d = this.width, h = this.height, m = this.props.minWidth || H, w = this.props.minHeight || _, g = this.top - l, C = this.left - n;
|
|
440
|
-
let E = n - this.left, I = l - this.top;
|
|
441
|
-
const p = Object.assign({}, this.state, { isDragging: !e.end });
|
|
442
|
-
e.direction.indexOf("n") >= 0 && w - (h + g) < 0 && (this.top > 0 && (p.height = h + g), p.top = l), e.direction.indexOf("s") >= 0 && w - I < 0 && (p.height = I), e.direction.indexOf("w") >= 0 && m - (d + C) < 0 && (this.left > 0 && (p.width = d + C), p.left = n), e.direction.indexOf("e") >= 0 && m - E < 0 && (p.width = E), this.setState(p), this.dispatchMoveEvent(this.props.onResize, t, !0, e.end);
|
|
443
|
-
}, this.dispatchMoveEvent = (t, e, n, l) => {
|
|
444
|
-
t && t.call(void 0, {
|
|
445
|
-
nativeEvent: e.nativeEvent ? e.nativeEvent : e.originalEvent,
|
|
446
|
-
drag: n,
|
|
447
|
-
end: l,
|
|
448
|
-
target: this,
|
|
449
|
-
left: this.state.left,
|
|
450
|
-
top: this.state.top,
|
|
451
|
-
width: this.state.width,
|
|
452
|
-
hight: this.state.height,
|
|
453
|
-
height: this.state.height
|
|
454
|
-
});
|
|
455
|
-
}, this.handleBrowserWindowResize = () => {
|
|
456
|
-
if (this.windowStage === a.FULLSCREEN) {
|
|
457
|
-
const t = this.getWindow(), e = t ? t.innerWidth : 0, n = t ? t.innerHeight : 0;
|
|
458
|
-
this.setState({
|
|
459
|
-
width: this.props.appendTo ? this.props.appendTo.offsetWidth : e,
|
|
460
|
-
height: this.props.appendTo ? this.props.appendTo.offsetHeight : n
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
}, this.getCurrentZIndex = () => !this.state || this.context === void 0 ? this.context ? this.context : N : this.state.zIndex > (this.context ? this.context + S : 0) ? this.state.zIndex : this.context + S, this.getDocument = () => this.props.appendTo ? this.props.appendTo.ownerDocument : document, this.getWindow = () => {
|
|
464
|
-
const t = this.getDocument();
|
|
465
|
-
return t && t.defaultView;
|
|
466
|
-
}, Y(y), this.showLicenseWatermark = $(y), this.state = {
|
|
467
|
-
stage: this.props.stage || a.DEFAULT,
|
|
468
|
-
isDragging: !1,
|
|
469
|
-
top: 0,
|
|
470
|
-
left: 0,
|
|
471
|
-
width: W,
|
|
472
|
-
height: B,
|
|
473
|
-
focused: !0,
|
|
474
|
-
zIndex: N
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
get _id() {
|
|
478
|
-
return this.props.id + "-accessibility-id";
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* @hidden
|
|
482
|
-
*/
|
|
483
|
-
componentDidMount() {
|
|
484
|
-
const i = this.getWindow();
|
|
485
|
-
i && i.addEventListener("resize", this.handleBrowserWindowResize), this.setState({
|
|
486
|
-
stage: this.props.stage || a.DEFAULT,
|
|
487
|
-
isDragging: !1,
|
|
488
|
-
top: this.getInitialTop(),
|
|
489
|
-
left: this.getInitialLeft(),
|
|
490
|
-
width: this.getInitialWidth(),
|
|
491
|
-
height: this.getInitialHeight(),
|
|
492
|
-
focused: !0,
|
|
493
|
-
zIndex: z(this.getCurrentZIndex(), this.getDocument(), this._id)
|
|
494
|
-
}), this.windowCoordinatesState = {
|
|
495
|
-
leftBeforeAction: this.getInitialLeft(),
|
|
496
|
-
topBeforeAction: this.getInitialTop(),
|
|
497
|
-
widthBeforeAction: this.getInitialWidth(),
|
|
498
|
-
heightBeforeAction: this.getInitialHeight()
|
|
499
|
-
};
|
|
500
|
-
const t = this.getDocument();
|
|
501
|
-
if (this.props.appendTo && t) {
|
|
502
|
-
let e = this.props.appendTo.getBoundingClientRect(), n = t.body.getBoundingClientRect();
|
|
503
|
-
this.offSetCoordinates.x = e.left - n.left, this.offSetCoordinates.y = e.top - n.top;
|
|
504
|
-
}
|
|
505
|
-
this.mounted = !0;
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* @hidden
|
|
509
|
-
*/
|
|
510
|
-
componentWillUnmount() {
|
|
511
|
-
const i = this.getWindow();
|
|
512
|
-
i && i.removeEventListener("resize", this.handleBrowserWindowResize), this.mounted = !1;
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* @hidden
|
|
516
|
-
*/
|
|
517
|
-
componentDidUpdate() {
|
|
518
|
-
const i = this.getDocument();
|
|
519
|
-
if (this.props.appendTo && i) {
|
|
520
|
-
let t = this.props.appendTo.getBoundingClientRect(), e = i.body.getBoundingClientRect();
|
|
521
|
-
this.offSetCoordinates.x = t.left - e.left, this.offSetCoordinates.y = t.top - e.top;
|
|
522
|
-
}
|
|
523
|
-
this.mounted = !0;
|
|
524
|
-
}
|
|
525
|
-
/**
|
|
526
|
-
* @hidden
|
|
527
|
-
*/
|
|
528
|
-
render() {
|
|
529
|
-
const i = s.Children.toArray(this.props.children), t = this.getContent(i), e = this.getActionBar(i), n = this.getCurrentZIndex(), l = x(
|
|
530
|
-
"k-window",
|
|
531
|
-
this.props.className,
|
|
532
|
-
{
|
|
533
|
-
[`k-window-${this.props.themeColor}`]: this.props.themeColor,
|
|
534
|
-
"k-window-minimized": this.state.stage === "MINIMIZED",
|
|
535
|
-
"k-window-focused": this.state.focused
|
|
536
|
-
}
|
|
537
|
-
), d = /* @__PURE__ */ s.createElement(L.Provider, { value: n }, /* @__PURE__ */ s.createElement(s.Fragment, null, this.props.modal && /* @__PURE__ */ s.createElement(
|
|
538
|
-
"div",
|
|
539
|
-
{
|
|
540
|
-
className: "k-overlay",
|
|
541
|
-
style: {
|
|
542
|
-
zIndex: n,
|
|
543
|
-
...this.props.overlayStyle
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
), /* @__PURE__ */ s.createElement(
|
|
547
|
-
"div",
|
|
548
|
-
{
|
|
549
|
-
id: this.props.id,
|
|
550
|
-
[O]: this._id,
|
|
551
|
-
tabIndex: 0,
|
|
552
|
-
role: "dialog",
|
|
553
|
-
"aria-labelledby": this.titleId,
|
|
554
|
-
onFocus: this.onFocus,
|
|
555
|
-
onBlur: this.onBlur,
|
|
556
|
-
onKeyDown: this.onKeyDown,
|
|
557
|
-
ref: (h) => {
|
|
558
|
-
this.windowElement = h, this.element = h;
|
|
559
|
-
},
|
|
560
|
-
className: l,
|
|
561
|
-
style: {
|
|
562
|
-
top: this.top,
|
|
563
|
-
left: this.left,
|
|
564
|
-
width: this.width,
|
|
565
|
-
height: this.height || "",
|
|
566
|
-
zIndex: n,
|
|
567
|
-
...this.props.style
|
|
568
|
-
}
|
|
569
|
-
},
|
|
570
|
-
/* @__PURE__ */ s.createElement(
|
|
571
|
-
ut,
|
|
572
|
-
{
|
|
573
|
-
shouldUpdateOnDrag: this.props.shouldUpdateOnDrag || !1,
|
|
574
|
-
isDragging: this.state.isDragging
|
|
575
|
-
},
|
|
576
|
-
/* @__PURE__ */ s.createElement(
|
|
577
|
-
Q,
|
|
578
|
-
{
|
|
579
|
-
onPress: this.onPress,
|
|
580
|
-
onDrag: this.onDrag,
|
|
581
|
-
onRelease: this.onRelease,
|
|
582
|
-
ref: (h) => this.draggable = h
|
|
583
|
-
},
|
|
584
|
-
/* @__PURE__ */ s.createElement(
|
|
585
|
-
ct,
|
|
586
|
-
{
|
|
587
|
-
stage: this.windowStage,
|
|
588
|
-
onDoubleClick: this.props.doubleClickStageChange ? this.handleDoubleClick : void 0,
|
|
589
|
-
onMinimizeButtonClick: this.handleMinimize,
|
|
590
|
-
onFullScreenButtonClick: this.handleFullscreen,
|
|
591
|
-
onRestoreButtonClick: this.handleRestore,
|
|
592
|
-
onCloseButtonClick: this.handleCloseWindow,
|
|
593
|
-
closeButton: this.props.closeButton,
|
|
594
|
-
minimizeButton: this.props.minimizeButton,
|
|
595
|
-
maximizeButton: this.props.maximizeButton,
|
|
596
|
-
restoreButton: this.props.restoreButton,
|
|
597
|
-
id: this.titleId
|
|
598
|
-
},
|
|
599
|
-
this.props.title
|
|
600
|
-
)
|
|
601
|
-
),
|
|
602
|
-
this.windowStage !== a.MINIMIZED ? /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("div", { className: "k-window-content" }, t), e) : null,
|
|
603
|
-
this.windowStage === a.DEFAULT && this.props.resizable ? /* @__PURE__ */ s.createElement(gt, { onResize: this.handleResize }) : null
|
|
604
|
-
),
|
|
605
|
-
this.showLicenseWatermark && /* @__PURE__ */ s.createElement(q, null)
|
|
606
|
-
)));
|
|
607
|
-
return J ? this.props.appendTo !== null ? K.createPortal(d, this.props.appendTo || document.body) : d : null;
|
|
608
|
-
}
|
|
609
|
-
// Getters
|
|
610
|
-
get top() {
|
|
611
|
-
return this.windowStage !== a.FULLSCREEN ? Math.max(this.props.top || this.state.top, 0) : 0;
|
|
612
|
-
}
|
|
613
|
-
get left() {
|
|
614
|
-
return this.windowStage !== a.FULLSCREEN ? Math.max(this.props.left || this.state.left, 0) : 0;
|
|
615
|
-
}
|
|
616
|
-
get width() {
|
|
617
|
-
let i = this.props.width || this.state.width;
|
|
618
|
-
if (this.windowStage === a.FULLSCREEN) {
|
|
619
|
-
if (this.props.appendTo)
|
|
620
|
-
return i = this.props.appendTo.offsetWidth, i;
|
|
621
|
-
const t = this.getWindow();
|
|
622
|
-
i = t ? t.innerWidth : 0;
|
|
623
|
-
}
|
|
624
|
-
return i;
|
|
625
|
-
}
|
|
626
|
-
get height() {
|
|
627
|
-
let i = this.props.height || this.state.height;
|
|
628
|
-
if (this.windowStage === a.FULLSCREEN) {
|
|
629
|
-
if (this.props.appendTo)
|
|
630
|
-
return i = this.props.appendTo.offsetHeight, i;
|
|
631
|
-
const t = this.getWindow();
|
|
632
|
-
i = t ? t.innerHeight : 0;
|
|
633
|
-
} else
|
|
634
|
-
this.windowStage === a.MINIMIZED && (i = 0);
|
|
635
|
-
return i;
|
|
636
|
-
}
|
|
637
|
-
get windowStage() {
|
|
638
|
-
return this.props.stage || this.state.stage;
|
|
639
|
-
}
|
|
640
|
-
getActionBar(i) {
|
|
641
|
-
return i.filter((t) => t && t.type === U);
|
|
642
|
-
}
|
|
643
|
-
getContent(i) {
|
|
644
|
-
return i.filter((t) => t && t.type !== U);
|
|
645
|
-
}
|
|
646
|
-
generateTitleId() {
|
|
647
|
-
return "window-title-" + this._id;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
T.displayName = "Window";
|
|
651
|
-
T.propTypes = {
|
|
652
|
-
width: o.number,
|
|
653
|
-
height: o.number,
|
|
654
|
-
left: o.number,
|
|
655
|
-
top: o.number,
|
|
656
|
-
initialWidth: o.number,
|
|
657
|
-
initialHeight: o.number,
|
|
658
|
-
initialLeft: o.number,
|
|
659
|
-
initialTop: o.number,
|
|
660
|
-
minWidth: o.number,
|
|
661
|
-
minHeight: o.number,
|
|
662
|
-
resizable: o.bool,
|
|
663
|
-
draggable: o.bool,
|
|
664
|
-
title: o.any,
|
|
665
|
-
shouldUpdateOnDrag: o.bool,
|
|
666
|
-
stage: o.oneOf(["DEFAULT", "MINIMIZED", "FULLSCREEN"]),
|
|
667
|
-
className: o.string,
|
|
668
|
-
id: o.string,
|
|
669
|
-
style: o.object,
|
|
670
|
-
overlayStyle: o.object
|
|
671
|
-
};
|
|
672
|
-
T.defaultProps = {
|
|
673
|
-
minWidth: H,
|
|
674
|
-
minHeight: _,
|
|
675
|
-
resizable: !0,
|
|
676
|
-
draggable: !0,
|
|
677
|
-
modal: !1,
|
|
678
|
-
doubleClickStageChange: !0
|
|
679
|
-
};
|
|
680
|
-
T.contextType = L;
|
|
681
|
-
const wt = G(), ft = X(V(wt, T));
|
|
682
|
-
ft.displayName = "KendoReactWindow";
|
|
9
|
+
import { Dialog as t, DialogPropsContext as i } from "./Dialog.mjs";
|
|
10
|
+
import { DialogActionsBar as n } from "./DialogActionsBar.mjs";
|
|
11
|
+
import { Window as x, WindowPropsContext as a } from "./Window.mjs";
|
|
12
|
+
import { WindowActionsBar as f } from "./WindowActionsBar.mjs";
|
|
683
13
|
export {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
14
|
+
t as Dialog,
|
|
15
|
+
n as DialogActionsBar,
|
|
16
|
+
i as DialogPropsContext,
|
|
17
|
+
x as Window,
|
|
18
|
+
f as WindowActionsBar,
|
|
19
|
+
a as WindowPropsContext
|
|
690
20
|
};
|