@progress/kendo-react-dialogs 14.5.0-develop.8 → 15.0.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dialog.js +1 -1
- package/Dialog.mjs +75 -80
- package/DialogProps.d.ts +4 -12
- package/DialogTitleBar.js +1 -1
- package/DialogTitleBar.mjs +27 -19
- package/README.md +4 -4
- package/Window.js +1 -1
- package/Window.mjs +237 -236
- package/WindowProps.d.ts +8 -14
- package/WindowTitlebar.js +1 -1
- package/WindowTitlebar.mjs +12 -8
- package/dist/cdn/js/kendo-react-dialogs.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -6
package/Window.mjs
CHANGED
|
@@ -6,195 +6,195 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as T from "react";
|
|
9
|
-
import * as
|
|
9
|
+
import * as ft from "react-dom";
|
|
10
10
|
import i from "prop-types";
|
|
11
|
-
import { WindowTitleBar as
|
|
12
|
-
import { withIdHOC as
|
|
13
|
-
import { ResizeHandlers as
|
|
14
|
-
import { MiddleLayerOptimization as
|
|
11
|
+
import { WindowTitleBar as ht } from "./WindowTitlebar.mjs";
|
|
12
|
+
import { withIdHOC as gt, withPropsContext as st, createPropsContext as mt, ZIndexContext as Oe, canUseDOM as de, keepFocusInContainer as wt, Keys as C, dispatchEvent as M, useWebMcpRegister as Tt, classNames as Et, Draggable as Lt } from "@progress/kendo-react-common";
|
|
13
|
+
import { ResizeHandlers as Ct } from "./WindowResizeHandlers.mjs";
|
|
14
|
+
import { MiddleLayerOptimization as Dt } from "./MiddleLayerOptimization.mjs";
|
|
15
15
|
import { windowStage as o } from "./StageEnum.mjs";
|
|
16
|
-
import { WindowActionsBar as
|
|
17
|
-
import { DEFAULT_DIALOGS_ZINDEX as
|
|
18
|
-
import { getMaxZIndex as
|
|
19
|
-
const { useState:
|
|
20
|
-
minWidth:
|
|
21
|
-
minHeight:
|
|
16
|
+
import { WindowActionsBar as Ze } from "./WindowActionsBar.mjs";
|
|
17
|
+
import { DEFAULT_DIALOGS_ZINDEX as _e, ZINDEX_DIALOGS_STEP as Pe, DATA_DIALOGS_ID as bt } from "./constants.mjs";
|
|
18
|
+
import { getMaxZIndex as Ke } from "./utils.mjs";
|
|
19
|
+
const { useState: N, useEffect: z, useCallback: u, useMemo: G, useRef: v, useImperativeHandle: It, useContext: Wt, forwardRef: St } = T, $ = 300, p = 300, se = 120, me = 100, W = 5, O = {
|
|
20
|
+
minWidth: se,
|
|
21
|
+
minHeight: me,
|
|
22
22
|
resizable: !0,
|
|
23
23
|
draggable: !0,
|
|
24
24
|
modal: !1,
|
|
25
25
|
doubleClickStageChange: !0,
|
|
26
26
|
autoFocus: !0
|
|
27
|
-
},
|
|
28
|
-
var
|
|
27
|
+
}, Xe = St((e, U) => {
|
|
28
|
+
var ye;
|
|
29
29
|
const {
|
|
30
|
-
minWidth:
|
|
31
|
-
minHeight:
|
|
32
|
-
resizable:
|
|
33
|
-
draggable:
|
|
34
|
-
modal:
|
|
35
|
-
doubleClickStageChange:
|
|
36
|
-
autoFocus:
|
|
37
|
-
} = e, [
|
|
30
|
+
minWidth: ee = O.minWidth,
|
|
31
|
+
minHeight: te = O.minHeight,
|
|
32
|
+
resizable: ue = O.resizable,
|
|
33
|
+
draggable: we = O.draggable,
|
|
34
|
+
modal: fe = O.modal,
|
|
35
|
+
doubleClickStageChange: Ve = O.doubleClickStageChange,
|
|
36
|
+
autoFocus: Ye = O.autoFocus
|
|
37
|
+
} = e, [je, V] = N(e.stage || o.DEFAULT), [Y, ne] = N(!1), [ie, S] = N(0), [oe, A] = N(0), [ae, x] = N($), [re, B] = N(p), [qe, he] = N(!0), [ge, Te] = N(_e), r = (ye = e.stage) != null ? ye : je, H = Wt(Oe), R = v(null), Ee = v(null), h = v({
|
|
38
38
|
leftBeforeAction: 0,
|
|
39
39
|
topBeforeAction: 0,
|
|
40
|
-
widthBeforeAction:
|
|
41
|
-
heightBeforeAction:
|
|
42
|
-
}), Z =
|
|
43
|
-
|
|
44
|
-
), Le =
|
|
40
|
+
widthBeforeAction: $,
|
|
41
|
+
heightBeforeAction: p
|
|
42
|
+
}), Z = v({ x: 0, y: 0 }), _ = v(void 0), Je = v(
|
|
43
|
+
de ? document.activeElement : null
|
|
44
|
+
), Le = v("window-title-" + (e.id ? e.id + "-accessibility-id" : "")), k = v({
|
|
45
45
|
left: 0,
|
|
46
46
|
top: 0,
|
|
47
|
-
width:
|
|
48
|
-
height:
|
|
49
|
-
internalLeft:
|
|
50
|
-
internalTop:
|
|
51
|
-
internalWidth:
|
|
47
|
+
width: $,
|
|
48
|
+
height: p,
|
|
49
|
+
internalLeft: oe,
|
|
50
|
+
internalTop: ie,
|
|
51
|
+
internalWidth: ae,
|
|
52
52
|
internalHeight: re,
|
|
53
|
-
stage:
|
|
54
|
-
draggable:
|
|
53
|
+
stage: r,
|
|
54
|
+
draggable: we,
|
|
55
55
|
props: e
|
|
56
|
-
}),
|
|
57
|
-
const t =
|
|
56
|
+
}), F = u(() => {
|
|
57
|
+
const t = de ? document : null;
|
|
58
58
|
return e.appendTo ? e.appendTo.ownerDocument : t;
|
|
59
|
-
}, [e.appendTo]), g =
|
|
60
|
-
const t =
|
|
59
|
+
}, [e.appendTo]), g = u(() => {
|
|
60
|
+
const t = F();
|
|
61
61
|
return t == null ? void 0 : t.defaultView;
|
|
62
|
-
}, [
|
|
62
|
+
}, [F]), P = G(() => {
|
|
63
63
|
var t;
|
|
64
|
-
return
|
|
65
|
-
}, [
|
|
64
|
+
return r !== o.FULLSCREEN ? Math.max((t = e.top) != null ? t : ie, 0) : 0;
|
|
65
|
+
}, [r, e.top, ie]), K = G(() => {
|
|
66
66
|
var t;
|
|
67
|
-
return
|
|
68
|
-
}, [
|
|
67
|
+
return r !== o.FULLSCREEN ? Math.max((t = e.left) != null ? t : oe, 0) : 0;
|
|
68
|
+
}, [r, e.left, oe]), D = G(() => {
|
|
69
69
|
var n;
|
|
70
|
-
const t = (n = e.width) != null ? n :
|
|
71
|
-
if (
|
|
70
|
+
const t = (n = e.width) != null ? n : ae;
|
|
71
|
+
if (r === o.FULLSCREEN) {
|
|
72
72
|
if (e.appendTo)
|
|
73
73
|
return e.appendTo.offsetWidth;
|
|
74
|
-
const
|
|
75
|
-
return
|
|
74
|
+
const a = g();
|
|
75
|
+
return a ? a.innerWidth : 0;
|
|
76
76
|
}
|
|
77
77
|
return t;
|
|
78
|
-
}, [
|
|
78
|
+
}, [r, e.width, e.appendTo, ae, g]), b = G(() => {
|
|
79
79
|
const t = e.height === void 0 ? re : e.height;
|
|
80
|
-
if (
|
|
80
|
+
if (r === o.FULLSCREEN) {
|
|
81
81
|
if (e.appendTo)
|
|
82
82
|
return e.appendTo.offsetHeight;
|
|
83
83
|
const n = g();
|
|
84
84
|
return n ? n.innerHeight : 0;
|
|
85
|
-
} else if (
|
|
85
|
+
} else if (r === o.MINIMIZED)
|
|
86
86
|
return 0;
|
|
87
87
|
return t;
|
|
88
|
-
}, [
|
|
89
|
-
|
|
88
|
+
}, [r, e.height, e.appendTo, re, g]), ce = G(() => e.id ? e.id + "-accessibility-id" : void 0, [e.id]);
|
|
89
|
+
z(() => {
|
|
90
90
|
k.current = {
|
|
91
91
|
left: K,
|
|
92
92
|
top: P,
|
|
93
93
|
width: D,
|
|
94
|
-
height:
|
|
95
|
-
internalLeft:
|
|
96
|
-
internalTop:
|
|
97
|
-
internalWidth:
|
|
94
|
+
height: b,
|
|
95
|
+
internalLeft: oe,
|
|
96
|
+
internalTop: ie,
|
|
97
|
+
internalWidth: ae,
|
|
98
98
|
internalHeight: re,
|
|
99
|
-
stage:
|
|
100
|
-
draggable:
|
|
99
|
+
stage: r,
|
|
100
|
+
draggable: we,
|
|
101
101
|
props: e
|
|
102
102
|
};
|
|
103
103
|
});
|
|
104
104
|
const X = G(() => {
|
|
105
|
-
if (
|
|
106
|
-
return
|
|
107
|
-
const t =
|
|
108
|
-
return
|
|
109
|
-
}, [
|
|
110
|
-
var
|
|
105
|
+
if (H === void 0)
|
|
106
|
+
return H != null ? H : _e;
|
|
107
|
+
const t = H ? H + Pe : 0;
|
|
108
|
+
return ge > t ? ge : H + Pe;
|
|
109
|
+
}, [ge, H]), Ce = u(() => {
|
|
110
|
+
var a, d;
|
|
111
111
|
if (e.top !== void 0)
|
|
112
112
|
return e.top;
|
|
113
113
|
if (e.initialTop !== void 0)
|
|
114
114
|
return e.initialTop;
|
|
115
|
-
let t =
|
|
115
|
+
let t = p;
|
|
116
116
|
if (e.height !== void 0 ? t = e.height : e.initialHeight !== void 0 && (t = e.initialHeight), e.appendTo && t)
|
|
117
117
|
return e.appendTo.offsetHeight / 2 - t / 2;
|
|
118
118
|
const n = g();
|
|
119
|
-
return n ? n.innerHeight / 2 - ((
|
|
120
|
-
}, [e.top, e.initialTop, e.height, e.initialHeight, e.appendTo, g]),
|
|
119
|
+
return n ? n.innerHeight / 2 - ((d = t != null ? t : (a = R.current) == null ? void 0 : a.clientHeight) != null ? d : 0) / 2 : 0;
|
|
120
|
+
}, [e.top, e.initialTop, e.height, e.initialHeight, e.appendTo, g]), De = u(() => {
|
|
121
121
|
if (e.left !== void 0)
|
|
122
122
|
return e.left;
|
|
123
123
|
if (e.initialLeft !== void 0)
|
|
124
124
|
return e.initialLeft;
|
|
125
|
-
let t =
|
|
125
|
+
let t = $;
|
|
126
126
|
if (e.width !== void 0 ? t = e.width : e.initialWidth !== void 0 && (t = e.initialWidth), e.appendTo)
|
|
127
127
|
return e.appendTo.offsetWidth / 2 - t / 2;
|
|
128
128
|
const n = g();
|
|
129
129
|
return n ? n.innerWidth / 2 - t / 2 : 0;
|
|
130
|
-
}, [e.left, e.initialLeft, e.width, e.initialWidth, e.appendTo, g]), be =
|
|
131
|
-
let t =
|
|
130
|
+
}, [e.left, e.initialLeft, e.width, e.initialWidth, e.appendTo, g]), be = u(() => {
|
|
131
|
+
let t = $;
|
|
132
132
|
return e.width !== void 0 ? t = e.width : e.initialWidth !== void 0 && (t = e.initialWidth), t;
|
|
133
|
-
}, [e.width, e.initialWidth]),
|
|
134
|
-
let t =
|
|
133
|
+
}, [e.width, e.initialWidth]), Ie = u(() => {
|
|
134
|
+
let t = p;
|
|
135
135
|
return e.height !== void 0 ? t = e.height : e.initialHeight !== void 0 && (t = e.initialHeight), t;
|
|
136
|
-
}, [e.height, e.initialHeight]),
|
|
137
|
-
(t, n,
|
|
138
|
-
var
|
|
136
|
+
}, [e.height, e.initialHeight]), Qe = u((t) => t.filter((n) => (n == null ? void 0 : n.type) === Ze), []), $e = u((t) => t.filter((n) => n && n.type !== Ze), []), s = u(() => typeof U == "object" && U !== null && "current" in U ? U.current : null, [U]), y = u(
|
|
137
|
+
(t, n, a, d, c, l) => {
|
|
138
|
+
var L, q, J;
|
|
139
139
|
if (!t)
|
|
140
140
|
return;
|
|
141
141
|
const {
|
|
142
142
|
internalLeft: E,
|
|
143
143
|
internalTop: m,
|
|
144
144
|
internalWidth: w,
|
|
145
|
-
internalHeight:
|
|
145
|
+
internalHeight: I
|
|
146
146
|
} = k.current;
|
|
147
147
|
t({
|
|
148
148
|
nativeEvent: n.nativeEvent ? n.nativeEvent : n.originalEvent,
|
|
149
|
-
drag:
|
|
150
|
-
end:
|
|
149
|
+
drag: a,
|
|
150
|
+
end: d,
|
|
151
151
|
target: s(),
|
|
152
|
-
left: (
|
|
152
|
+
left: (L = c == null ? void 0 : c.left) != null ? L : E,
|
|
153
153
|
top: (q = c == null ? void 0 : c.top) != null ? q : m,
|
|
154
|
-
width: (J =
|
|
155
|
-
height: (
|
|
154
|
+
width: (J = l == null ? void 0 : l.width) != null ? J : w,
|
|
155
|
+
height: (l == null ? void 0 : l.height) === void 0 ? I : l == null ? void 0 : l.height
|
|
156
156
|
});
|
|
157
157
|
},
|
|
158
158
|
[s]
|
|
159
|
-
), pe =
|
|
159
|
+
), pe = u(
|
|
160
160
|
(t) => {
|
|
161
|
-
var
|
|
162
|
-
if (
|
|
161
|
+
var l, E;
|
|
162
|
+
if (fe && wt(t, R.current), t.target !== t.currentTarget)
|
|
163
163
|
return;
|
|
164
|
-
const n =
|
|
165
|
-
if (
|
|
164
|
+
const n = ee || se, a = te || me, d = t.metaKey || t.ctrlKey, c = (E = b != null ? b : (l = R.current) == null ? void 0 : l.clientHeight) != null ? E : 0;
|
|
165
|
+
if (d && ue) {
|
|
166
166
|
switch (t.keyCode) {
|
|
167
|
-
case
|
|
168
|
-
t.preventDefault(),
|
|
167
|
+
case C.up:
|
|
168
|
+
t.preventDefault(), a <= c - W && B(c - W);
|
|
169
169
|
break;
|
|
170
|
-
case
|
|
171
|
-
t.preventDefault(),
|
|
170
|
+
case C.down:
|
|
171
|
+
t.preventDefault(), B(c + W);
|
|
172
172
|
break;
|
|
173
|
-
case
|
|
174
|
-
n <= D - W &&
|
|
173
|
+
case C.left:
|
|
174
|
+
n <= D - W && x(D - W);
|
|
175
175
|
break;
|
|
176
|
-
case
|
|
177
|
-
|
|
176
|
+
case C.right:
|
|
177
|
+
x(D + W);
|
|
178
178
|
break;
|
|
179
179
|
default:
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
y(e.onResize, t, !1, void 0);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
if (t.altKey) {
|
|
186
186
|
switch (t.keyCode) {
|
|
187
|
-
case
|
|
188
|
-
|
|
187
|
+
case C.up:
|
|
188
|
+
r === o.MINIMIZED ? (j(t), M(e.onStageChange, t, s(), {
|
|
189
189
|
state: o.DEFAULT
|
|
190
|
-
})) :
|
|
190
|
+
})) : r === o.DEFAULT && (le(t), M(e.onStageChange, t, s(), {
|
|
191
191
|
state: o.FULLSCREEN
|
|
192
192
|
}));
|
|
193
193
|
break;
|
|
194
|
-
case
|
|
195
|
-
|
|
194
|
+
case C.down:
|
|
195
|
+
r === o.FULLSCREEN ? (j(t), M(e.onStageChange, t, s(), {
|
|
196
196
|
state: o.DEFAULT
|
|
197
|
-
})) :
|
|
197
|
+
})) : r === o.DEFAULT && (We(t), M(e.onStageChange, t, s(), {
|
|
198
198
|
state: o.MINIMIZED
|
|
199
199
|
}));
|
|
200
200
|
break;
|
|
@@ -203,213 +203,215 @@ const { useState: M, useEffect: x, useCallback: d, useMemo: G, useRef: N, useImp
|
|
|
203
203
|
}
|
|
204
204
|
if (!t.ctrlKey) {
|
|
205
205
|
const { internalLeft: m, internalTop: w } = k.current;
|
|
206
|
-
let
|
|
206
|
+
let I = m, L = w;
|
|
207
207
|
switch (t.keyCode) {
|
|
208
|
-
case
|
|
209
|
-
e.onClose &&
|
|
208
|
+
case C.esc:
|
|
209
|
+
e.onClose && Se(t);
|
|
210
210
|
return;
|
|
211
|
-
case
|
|
212
|
-
|
|
211
|
+
case C.up:
|
|
212
|
+
L = w - W, S(L);
|
|
213
213
|
break;
|
|
214
|
-
case
|
|
215
|
-
|
|
214
|
+
case C.down:
|
|
215
|
+
L = w + W, S(L);
|
|
216
216
|
break;
|
|
217
|
-
case
|
|
218
|
-
|
|
217
|
+
case C.left:
|
|
218
|
+
I = m - W, A(I);
|
|
219
219
|
break;
|
|
220
|
-
case
|
|
221
|
-
|
|
220
|
+
case C.right:
|
|
221
|
+
I = m + W, A(I);
|
|
222
222
|
break;
|
|
223
223
|
default:
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
y(e.onMove, t, !1, void 0, { left: I, top: L });
|
|
227
227
|
}
|
|
228
228
|
},
|
|
229
229
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
230
230
|
[
|
|
231
|
-
he,
|
|
232
|
-
de,
|
|
233
|
-
ue,
|
|
234
231
|
fe,
|
|
232
|
+
ee,
|
|
233
|
+
te,
|
|
234
|
+
ue,
|
|
235
235
|
e.onResize,
|
|
236
236
|
e.onStageChange,
|
|
237
237
|
e.onClose,
|
|
238
238
|
e.onMove,
|
|
239
|
-
|
|
239
|
+
b,
|
|
240
240
|
D,
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
r,
|
|
242
|
+
y,
|
|
243
243
|
s
|
|
244
244
|
]
|
|
245
|
-
), et =
|
|
246
|
-
const n = t.event, { left:
|
|
247
|
-
h.current.differenceLeft = n.pageX -
|
|
248
|
-
}, []), tt =
|
|
245
|
+
), et = u((t) => {
|
|
246
|
+
const n = t.event, { left: a, top: d } = k.current;
|
|
247
|
+
h.current.differenceLeft = n.pageX - a, h.current.differenceTop = n.pageY - d;
|
|
248
|
+
}, []), tt = u(
|
|
249
249
|
(t) => {
|
|
250
250
|
const n = t.event;
|
|
251
251
|
n.originalEvent.preventDefault();
|
|
252
252
|
const {
|
|
253
|
-
stage:
|
|
254
|
-
draggable:
|
|
253
|
+
stage: a,
|
|
254
|
+
draggable: d,
|
|
255
255
|
props: c,
|
|
256
|
-
width:
|
|
256
|
+
width: l,
|
|
257
257
|
height: E
|
|
258
258
|
} = k.current;
|
|
259
|
-
if (
|
|
259
|
+
if (a !== o.FULLSCREEN && d) {
|
|
260
260
|
const m = Math.max(n.pageY - (h.current.differenceTop || 0), 0), w = n.pageX - (h.current.differenceLeft || 0);
|
|
261
|
-
S(m),
|
|
261
|
+
S(m), A(w), ne(!0), c.onMove && y(
|
|
262
262
|
c.onMove,
|
|
263
263
|
n,
|
|
264
264
|
!0,
|
|
265
265
|
!1,
|
|
266
266
|
{ left: w, top: m },
|
|
267
|
-
{ width:
|
|
267
|
+
{ width: l, height: E }
|
|
268
268
|
);
|
|
269
269
|
}
|
|
270
270
|
},
|
|
271
|
-
[
|
|
272
|
-
), nt =
|
|
271
|
+
[y]
|
|
272
|
+
), nt = u(
|
|
273
273
|
(t) => {
|
|
274
274
|
const n = t.event, {
|
|
275
|
-
stage:
|
|
276
|
-
draggable:
|
|
275
|
+
stage: a,
|
|
276
|
+
draggable: d,
|
|
277
277
|
props: c,
|
|
278
|
-
left:
|
|
278
|
+
left: l,
|
|
279
279
|
top: E,
|
|
280
280
|
width: m,
|
|
281
281
|
height: w
|
|
282
282
|
} = k.current;
|
|
283
|
-
|
|
283
|
+
a !== o.FULLSCREEN && d && c.onMove && y(
|
|
284
284
|
c.onMove,
|
|
285
285
|
n,
|
|
286
286
|
!0,
|
|
287
287
|
!0,
|
|
288
|
-
{ left:
|
|
288
|
+
{ left: l, top: E },
|
|
289
289
|
{ width: m, height: w }
|
|
290
|
-
),
|
|
290
|
+
), ne(!1);
|
|
291
291
|
},
|
|
292
|
-
[
|
|
293
|
-
), it =
|
|
294
|
-
_.current ? (clearTimeout(_.current), _.current = void 0) : (
|
|
295
|
-
}, [X,
|
|
292
|
+
[y]
|
|
293
|
+
), it = u(() => {
|
|
294
|
+
_.current ? (clearTimeout(_.current), _.current = void 0) : (he(!0), Te(Ke(X, F(), ce)));
|
|
295
|
+
}, [X, F, ce]), ot = u(() => {
|
|
296
296
|
clearTimeout(_.current);
|
|
297
297
|
const t = g();
|
|
298
298
|
t && (_.current = t.setTimeout(() => {
|
|
299
|
-
|
|
299
|
+
he(!1), _.current = void 0;
|
|
300
300
|
}));
|
|
301
|
-
}, [g]),
|
|
301
|
+
}, [g]), We = u(
|
|
302
302
|
(t) => {
|
|
303
|
-
t.preventDefault(), h.current.leftBeforeAction = K, h.current.topBeforeAction = P, h.current.widthBeforeAction = D, h.current.heightBeforeAction =
|
|
303
|
+
t.preventDefault(), h.current.leftBeforeAction = K, h.current.topBeforeAction = P, h.current.widthBeforeAction = D, h.current.heightBeforeAction = b, V(o.MINIMIZED), B(0), M(e.onStageChange, t, s(), { state: o.MINIMIZED });
|
|
304
304
|
},
|
|
305
|
-
[K, P, D,
|
|
306
|
-
),
|
|
305
|
+
[K, P, D, b, e.onStageChange, s]
|
|
306
|
+
), le = u(
|
|
307
307
|
(t) => {
|
|
308
|
-
t.preventDefault(), h.current.leftBeforeAction = K, h.current.topBeforeAction = P, h.current.widthBeforeAction = D, h.current.heightBeforeAction =
|
|
309
|
-
const n = g(),
|
|
310
|
-
|
|
308
|
+
t.preventDefault(), h.current.leftBeforeAction = K, h.current.topBeforeAction = P, h.current.widthBeforeAction = D, h.current.heightBeforeAction = b;
|
|
309
|
+
const n = g(), a = n ? n.innerWidth : 0, d = n ? n.innerHeight : 0;
|
|
310
|
+
A(0), S(0), x(e.appendTo ? e.appendTo.offsetWidth : a), B(e.appendTo ? e.appendTo.offsetHeight : d), V(o.FULLSCREEN), M(e.onStageChange, t, s(), { state: o.FULLSCREEN });
|
|
311
311
|
},
|
|
312
|
-
[K, P, D,
|
|
313
|
-
),
|
|
312
|
+
[K, P, D, b, e.appendTo, e.onStageChange, g, s]
|
|
313
|
+
), j = u(
|
|
314
314
|
(t) => {
|
|
315
|
-
t.preventDefault(),
|
|
315
|
+
t.preventDefault(), r === o.FULLSCREEN ? (V(o.DEFAULT), A(h.current.leftBeforeAction), S(h.current.topBeforeAction), x(h.current.widthBeforeAction), B(h.current.heightBeforeAction)) : r === o.MINIMIZED && (V(o.DEFAULT), B(h.current.heightBeforeAction)), M(e.onStageChange, t, s(), { state: o.DEFAULT });
|
|
316
316
|
},
|
|
317
|
-
[
|
|
318
|
-
),
|
|
317
|
+
[r, e.onStageChange, s]
|
|
318
|
+
), Se = u(
|
|
319
319
|
(t) => {
|
|
320
|
-
t.preventDefault(),
|
|
320
|
+
t.preventDefault(), M(e.onClose, t, s(), { state: void 0 });
|
|
321
321
|
},
|
|
322
322
|
[e.onClose, s]
|
|
323
|
-
),
|
|
323
|
+
), at = u(
|
|
324
324
|
(t) => {
|
|
325
|
-
|
|
325
|
+
r === o.FULLSCREEN || r === o.MINIMIZED ? j(t) : le(t);
|
|
326
326
|
},
|
|
327
|
-
[
|
|
328
|
-
),
|
|
327
|
+
[r, j, le]
|
|
328
|
+
), rt = u(
|
|
329
329
|
(t, n) => {
|
|
330
|
-
var Ne, Ue,
|
|
330
|
+
var Me, Ne, Ue, xe, ke, ze;
|
|
331
331
|
const {
|
|
332
|
-
props:
|
|
333
|
-
width:
|
|
332
|
+
props: a,
|
|
333
|
+
width: d,
|
|
334
334
|
height: c,
|
|
335
|
-
top:
|
|
335
|
+
top: l,
|
|
336
336
|
left: E
|
|
337
|
-
} = k.current, m =
|
|
337
|
+
} = k.current, m = a.appendTo ? t.pageX - Z.current.x : t.pageX, w = a.appendTo ? t.pageY - Z.current.y : t.pageY, I = (Ne = c != null ? c : (Me = R.current) == null ? void 0 : Me.clientHeight) != null ? Ne : 0, L = ee || se, q = te || me, J = l - w, ve = E - m, He = m - E, Fe = w - l;
|
|
338
338
|
let Q = !1;
|
|
339
339
|
const f = {
|
|
340
340
|
isDragging: !n.end
|
|
341
341
|
};
|
|
342
|
-
n.direction.indexOf("n") >= 0 && q - (
|
|
343
|
-
|
|
342
|
+
n.direction.indexOf("n") >= 0 && q - (I + J) < 0 && (l > 0 && (f.height = I + J), f.top = w, Q = !0), n.direction.indexOf("s") >= 0 && q - Fe < 0 && (f.height = Fe, Q = !0), n.direction.indexOf("w") >= 0 && L - (d + ve) < 0 && (E > 0 && (f.width = d + ve), f.left = m, Q = !0), n.direction.indexOf("e") >= 0 && L - He < 0 && (f.width = He, Q = !0), Q && (f.height !== void 0 && B(f.height), f.top !== void 0 && S(f.top), f.width !== void 0 && x(f.width), f.left !== void 0 && A(f.left), f.isDragging !== void 0 && ne(f.isDragging)), y(
|
|
343
|
+
a.onResize,
|
|
344
344
|
t,
|
|
345
345
|
!0,
|
|
346
346
|
n.end,
|
|
347
|
-
{ left: (
|
|
348
|
-
{ width: (
|
|
347
|
+
{ left: (Ue = f.left) != null ? Ue : E, top: (xe = f.top) != null ? xe : l },
|
|
348
|
+
{ width: (ke = f.width) != null ? ke : d, height: (ze = f.height) != null ? ze : c }
|
|
349
349
|
);
|
|
350
350
|
},
|
|
351
|
-
[
|
|
352
|
-
), Ae =
|
|
353
|
-
if (
|
|
354
|
-
const t = g(), n = t ? t.innerWidth : 0,
|
|
355
|
-
|
|
351
|
+
[y, te, ee]
|
|
352
|
+
), Ae = u(() => {
|
|
353
|
+
if (r === o.FULLSCREEN) {
|
|
354
|
+
const t = g(), n = t ? t.innerWidth : 0, a = t ? t.innerHeight : 0;
|
|
355
|
+
x(e.appendTo ? e.appendTo.offsetWidth : n), B(e.appendTo ? e.appendTo.offsetHeight : a);
|
|
356
356
|
}
|
|
357
|
-
}, [
|
|
358
|
-
|
|
359
|
-
const t =
|
|
360
|
-
t &&
|
|
357
|
+
}, [r, e.appendTo, g]);
|
|
358
|
+
z(() => {
|
|
359
|
+
const t = R.current;
|
|
360
|
+
t && Ye && t.focus({ preventScroll: !0 });
|
|
361
361
|
const n = g();
|
|
362
|
-
n && n.addEventListener("resize", Ae), V(e.stage || o.DEFAULT),
|
|
363
|
-
leftBeforeAction:
|
|
364
|
-
topBeforeAction:
|
|
362
|
+
n && n.addEventListener("resize", Ae), V(e.stage || o.DEFAULT), ne(!1), S(Ce()), A(De()), x(be()), B(Ie()), he(!0), Te(Ke(X, F(), ce)), h.current = {
|
|
363
|
+
leftBeforeAction: De(),
|
|
364
|
+
topBeforeAction: Ce(),
|
|
365
365
|
widthBeforeAction: be(),
|
|
366
|
-
heightBeforeAction:
|
|
366
|
+
heightBeforeAction: Ie()
|
|
367
367
|
};
|
|
368
|
-
const
|
|
369
|
-
if (e.appendTo &&
|
|
370
|
-
const
|
|
371
|
-
Z.current.x =
|
|
368
|
+
const a = F();
|
|
369
|
+
if (e.appendTo && a) {
|
|
370
|
+
const c = e.appendTo.getBoundingClientRect(), l = a.body.getBoundingClientRect();
|
|
371
|
+
Z.current.x = c.left - l.left, Z.current.y = c.top - l.top;
|
|
372
372
|
}
|
|
373
|
+
const d = Je.current;
|
|
373
374
|
return () => {
|
|
374
|
-
var
|
|
375
|
-
const
|
|
376
|
-
|
|
375
|
+
var l;
|
|
376
|
+
const c = g();
|
|
377
|
+
c && c.removeEventListener("resize", Ae), d && de && (document.contains(d) ? d.focus({ preventScroll: !0 }) : d.id && ((l = document.getElementById(d.id)) == null || l.focus({ preventScroll: !0 })));
|
|
377
378
|
};
|
|
378
|
-
}, []),
|
|
379
|
-
e.left !== void 0 && !Y &&
|
|
380
|
-
}, [e.left, Y]),
|
|
379
|
+
}, []), z(() => {
|
|
380
|
+
e.left !== void 0 && !Y && A(e.left);
|
|
381
|
+
}, [e.left, Y]), z(() => {
|
|
381
382
|
e.top !== void 0 && !Y && S(e.top);
|
|
382
|
-
}, [e.top, Y]),
|
|
383
|
-
e.initialLeft !== void 0 &&
|
|
384
|
-
}, [e.initialLeft]),
|
|
383
|
+
}, [e.top, Y]), z(() => {
|
|
384
|
+
e.initialLeft !== void 0 && A(e.initialLeft);
|
|
385
|
+
}, [e.initialLeft]), z(() => {
|
|
385
386
|
e.initialTop !== void 0 && S(e.initialTop);
|
|
386
|
-
}, [e.initialTop]),
|
|
387
|
-
const t =
|
|
387
|
+
}, [e.initialTop]), z(() => {
|
|
388
|
+
const t = F();
|
|
388
389
|
if (e.appendTo && t) {
|
|
389
|
-
const n = e.appendTo.getBoundingClientRect(),
|
|
390
|
-
Z.current.x = n.left -
|
|
390
|
+
const n = e.appendTo.getBoundingClientRect(), a = t.body.getBoundingClientRect();
|
|
391
|
+
Z.current.x = n.left - a.left, Z.current.y = n.top - a.top;
|
|
391
392
|
}
|
|
392
|
-
}, [e.appendTo,
|
|
393
|
-
|
|
393
|
+
}, [e.appendTo, F]);
|
|
394
|
+
const ct = v(null);
|
|
395
|
+
It(
|
|
396
|
+
U,
|
|
394
397
|
() => ({
|
|
395
398
|
get element() {
|
|
396
|
-
return
|
|
399
|
+
return R.current;
|
|
397
400
|
},
|
|
398
401
|
get windowElement() {
|
|
399
|
-
return
|
|
402
|
+
return R.current;
|
|
400
403
|
},
|
|
401
404
|
get draggable() {
|
|
402
|
-
return
|
|
405
|
+
return Ee.current;
|
|
403
406
|
},
|
|
404
407
|
props: e
|
|
405
408
|
}),
|
|
406
409
|
[e]
|
|
407
|
-
);
|
|
408
|
-
const Be = T.Children.toArray(e.children),
|
|
409
|
-
|
|
410
|
-
"k-window-minimized": a === "MINIMIZED",
|
|
410
|
+
), ct.current = R.current, Tt("window", U, e, e.webMcp);
|
|
411
|
+
const Be = T.Children.toArray(e.children), lt = $e(Be), dt = Qe(Be), ut = Et("k-window", e.className, {
|
|
412
|
+
"k-window-minimized": r === "MINIMIZED",
|
|
411
413
|
"k-focus": qe
|
|
412
|
-
}), Re = /* @__PURE__ */ T.createElement(
|
|
414
|
+
}), Re = /* @__PURE__ */ T.createElement(Oe.Provider, { value: X }, /* @__PURE__ */ T.createElement(T.Fragment, null, fe && /* @__PURE__ */ T.createElement(
|
|
413
415
|
"div",
|
|
414
416
|
{
|
|
415
417
|
className: "k-overlay",
|
|
@@ -422,48 +424,48 @@ const { useState: M, useEffect: x, useCallback: d, useMemo: G, useRef: N, useImp
|
|
|
422
424
|
"div",
|
|
423
425
|
{
|
|
424
426
|
id: e.id,
|
|
425
|
-
[
|
|
427
|
+
[bt]: ce,
|
|
426
428
|
tabIndex: 0,
|
|
427
429
|
role: "dialog",
|
|
428
430
|
"aria-labelledby": Le.current,
|
|
429
431
|
onFocus: it,
|
|
430
432
|
onBlur: ot,
|
|
431
433
|
onKeyDown: pe,
|
|
432
|
-
ref:
|
|
433
|
-
className:
|
|
434
|
+
ref: R,
|
|
435
|
+
className: ut,
|
|
434
436
|
style: {
|
|
435
437
|
top: P,
|
|
436
438
|
left: K,
|
|
437
439
|
width: D,
|
|
438
|
-
height:
|
|
440
|
+
height: b || "",
|
|
439
441
|
zIndex: X,
|
|
440
442
|
...e.style
|
|
441
443
|
}
|
|
442
444
|
},
|
|
443
445
|
/* @__PURE__ */ T.createElement(
|
|
444
|
-
|
|
446
|
+
Dt,
|
|
445
447
|
{
|
|
446
448
|
shouldUpdateOnDrag: e.shouldUpdateOnDrag || !1,
|
|
447
449
|
isDragging: Y
|
|
448
450
|
},
|
|
449
451
|
/* @__PURE__ */ T.createElement(
|
|
450
|
-
|
|
452
|
+
Lt,
|
|
451
453
|
{
|
|
452
454
|
onPress: et,
|
|
453
455
|
onDrag: tt,
|
|
454
456
|
onRelease: nt,
|
|
455
457
|
autoScroll: !1,
|
|
456
|
-
ref:
|
|
458
|
+
ref: Ee
|
|
457
459
|
},
|
|
458
460
|
/* @__PURE__ */ T.createElement(
|
|
459
|
-
|
|
461
|
+
ht,
|
|
460
462
|
{
|
|
461
|
-
stage:
|
|
462
|
-
onDoubleClick:
|
|
463
|
-
onMinimizeButtonClick:
|
|
464
|
-
onFullScreenButtonClick:
|
|
465
|
-
onRestoreButtonClick:
|
|
466
|
-
onCloseButtonClick:
|
|
463
|
+
stage: r,
|
|
464
|
+
onDoubleClick: Ve ? at : void 0,
|
|
465
|
+
onMinimizeButtonClick: We,
|
|
466
|
+
onFullScreenButtonClick: le,
|
|
467
|
+
onRestoreButtonClick: j,
|
|
468
|
+
onCloseButtonClick: Se,
|
|
467
469
|
closeButton: e.closeButton,
|
|
468
470
|
minimizeButton: e.minimizeButton,
|
|
469
471
|
maximizeButton: e.maximizeButton,
|
|
@@ -473,21 +475,21 @@ const { useState: M, useEffect: x, useCallback: d, useMemo: G, useRef: N, useImp
|
|
|
473
475
|
e.title
|
|
474
476
|
)
|
|
475
477
|
),
|
|
476
|
-
|
|
477
|
-
|
|
478
|
+
r === o.MINIMIZED ? null : /* @__PURE__ */ T.createElement(T.Fragment, null, /* @__PURE__ */ T.createElement("div", { className: "k-window-content" }, lt), dt),
|
|
479
|
+
r === o.DEFAULT && ue ? /* @__PURE__ */ T.createElement(Ct, { onResize: rt }) : null
|
|
478
480
|
)
|
|
479
481
|
)));
|
|
480
|
-
return
|
|
482
|
+
return de ? e.appendTo === null ? Re : ft.createPortal(Re, e.appendTo || document.body) : null;
|
|
481
483
|
});
|
|
482
|
-
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
484
|
+
Xe.displayName = "Window";
|
|
485
|
+
const At = mt(), Ge = gt(
|
|
486
|
+
st(
|
|
487
|
+
At,
|
|
488
|
+
Xe
|
|
487
489
|
)
|
|
488
490
|
);
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
+
Ge.displayName = "KendoReactWindow";
|
|
492
|
+
const Bt = {
|
|
491
493
|
autoFocus: i.bool,
|
|
492
494
|
title: i.any,
|
|
493
495
|
className: i.string,
|
|
@@ -520,12 +522,11 @@ const St = {
|
|
|
520
522
|
dir: i.string,
|
|
521
523
|
style: i.object,
|
|
522
524
|
appendTo: i.any,
|
|
523
|
-
themeColor: i.oneOf(["primary", "dark", "light"]),
|
|
524
525
|
shouldUpdateOnDrag: i.bool
|
|
525
526
|
};
|
|
526
|
-
|
|
527
|
+
Ge.propTypes = Bt;
|
|
527
528
|
export {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
529
|
+
Ge as Window,
|
|
530
|
+
At as WindowPropsContext,
|
|
531
|
+
Xe as WindowWithoutContext
|
|
531
532
|
};
|