@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/Window.mjs
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
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
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as h from "react";
|
|
10
|
+
import * as R from "react-dom";
|
|
11
|
+
import o from "prop-types";
|
|
12
|
+
import { WindowTitleBar as v } from "./WindowTitlebar.mjs";
|
|
13
|
+
import { Keys as r, dispatchEvent as p, validatePackage as x, shouldShowValidationUI as U, ZIndexContext as W, classNames as N, Draggable as H, WatermarkOverlay as k, canUseDOM as z, createPropsContext as _, withIdHOC as Z, withPropsContext as O } from "@progress/kendo-react-common";
|
|
14
|
+
import { ResizeHandlers as P } from "./WindowResizeHandlers.mjs";
|
|
15
|
+
import { MiddleLayerOptimization as K } from "./MiddleLayerOptimization.mjs";
|
|
16
|
+
import { windowStage as i } from "./StageEnum.mjs";
|
|
17
|
+
import { packageMetadata as M } from "./package-metadata.mjs";
|
|
18
|
+
import { WindowActionsBar as A } from "./WindowActionsBar.mjs";
|
|
19
|
+
import { DEFAULT_DIALOGS_ZINDEX as y, ZINDEX_DIALOGS_STEP as B, DATA_DIALOGS_ID as X } from "./constants.mjs";
|
|
20
|
+
import { getMaxZIndex as F } from "./utils.mjs";
|
|
21
|
+
const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component {
|
|
22
|
+
constructor(s) {
|
|
23
|
+
super(s), 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) => {
|
|
24
|
+
if (t.target !== t.currentTarget)
|
|
25
|
+
return;
|
|
26
|
+
const e = this.props.minWidth || m, n = this.props.minHeight || S;
|
|
27
|
+
if (t.ctrlKey && this.props.resizable) {
|
|
28
|
+
switch (t.keyCode) {
|
|
29
|
+
case r.up:
|
|
30
|
+
t.preventDefault(), n <= this.height - a && this.setState({ height: this.height - a });
|
|
31
|
+
break;
|
|
32
|
+
case r.down:
|
|
33
|
+
t.preventDefault(), this.setState({ height: this.height + a });
|
|
34
|
+
break;
|
|
35
|
+
case r.left:
|
|
36
|
+
e <= this.width - a && this.setState({ width: this.width - a });
|
|
37
|
+
break;
|
|
38
|
+
case r.right:
|
|
39
|
+
this.setState({ width: this.width + a });
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.dispatchMoveEvent(this.props.onResize, t, !1, void 0);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (t.altKey) {
|
|
48
|
+
switch (t.keyCode) {
|
|
49
|
+
case r.up:
|
|
50
|
+
this.windowStage === i.MINIMIZED ? (this.handleRestore(t), p(this.props.onStageChange, t, this, { state: i.DEFAULT })) : this.windowStage === i.DEFAULT && (this.handleFullscreen(t), p(this.props.onStageChange, t, this, { state: i.FULLSCREEN }));
|
|
51
|
+
break;
|
|
52
|
+
case r.down:
|
|
53
|
+
this.windowStage === i.FULLSCREEN ? (this.handleRestore(t), p(this.props.onStageChange, t, this, { state: i.DEFAULT })) : this.windowStage === i.DEFAULT && (this.handleMinimize(t), p(this.props.onStageChange, t, this, { state: i.MINIMIZED }));
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!t.ctrlKey)
|
|
59
|
+
switch (t.keyCode) {
|
|
60
|
+
case r.esc:
|
|
61
|
+
this.props.onClose && this.handleCloseWindow(t);
|
|
62
|
+
return;
|
|
63
|
+
case r.up:
|
|
64
|
+
this.setState({ top: this.state.top - a });
|
|
65
|
+
break;
|
|
66
|
+
case r.down:
|
|
67
|
+
this.setState({ top: this.state.top + a });
|
|
68
|
+
break;
|
|
69
|
+
case r.left:
|
|
70
|
+
this.setState({ left: this.state.left - a });
|
|
71
|
+
break;
|
|
72
|
+
case r.right:
|
|
73
|
+
this.setState({ left: this.state.left + a });
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.dispatchMoveEvent(this.props.onMove, t, !1, void 0);
|
|
79
|
+
}, this.onPress = (t) => {
|
|
80
|
+
const e = t.event;
|
|
81
|
+
this.windowCoordinatesState.differenceLeft = e.pageX - this.left, this.windowCoordinatesState.differenceTop = e.pageY - this.top;
|
|
82
|
+
}, this.onDrag = (t) => {
|
|
83
|
+
const e = t.event;
|
|
84
|
+
e.originalEvent.preventDefault(), this.windowStage !== i.FULLSCREEN && this.props.draggable && (this.setState({
|
|
85
|
+
top: Math.max(e.pageY - this.windowCoordinatesState.differenceTop, 0),
|
|
86
|
+
left: e.pageX - this.windowCoordinatesState.differenceLeft,
|
|
87
|
+
isDragging: !0
|
|
88
|
+
}), this.props.onMove && this.dispatchMoveEvent(this.props.onMove, e, !0, !1));
|
|
89
|
+
}, this.onRelease = (t) => {
|
|
90
|
+
const e = t.event;
|
|
91
|
+
this.windowStage !== i.FULLSCREEN && this.props.draggable && this.props.onMove && this.dispatchMoveEvent(this.props.onMove, e, !0, !0), this.setState({
|
|
92
|
+
isDragging: !1
|
|
93
|
+
});
|
|
94
|
+
}, this.onFocus = () => {
|
|
95
|
+
this._blurTimeout ? (clearTimeout(this._blurTimeout), this._blurTimeout = void 0) : this.setState({
|
|
96
|
+
focused: !0,
|
|
97
|
+
zIndex: F(this.getCurrentZIndex(), this.getDocument(), this._id)
|
|
98
|
+
});
|
|
99
|
+
}, this.onBlur = () => {
|
|
100
|
+
clearTimeout(this._blurTimeout);
|
|
101
|
+
const t = this.getWindow();
|
|
102
|
+
t && (this._blurTimeout = t.setTimeout(() => {
|
|
103
|
+
this.mounted && this.setState({ focused: !1 }), this._blurTimeout = void 0;
|
|
104
|
+
}));
|
|
105
|
+
}, this.getInitialTop = () => {
|
|
106
|
+
if (this.props.top !== void 0)
|
|
107
|
+
return this.props.top;
|
|
108
|
+
if (this.props.initialTop !== void 0)
|
|
109
|
+
return this.props.initialTop;
|
|
110
|
+
let t = u;
|
|
111
|
+
if (this.props.height !== void 0 ? t = this.props.height : this.props.initialHeight !== void 0 && (t = this.props.initialHeight), this.props.appendTo)
|
|
112
|
+
return this.props.appendTo.offsetHeight / 2 - t / 2;
|
|
113
|
+
const e = this.getWindow();
|
|
114
|
+
return e ? e.innerHeight / 2 - t / 2 : 0;
|
|
115
|
+
}, this.getInitialLeft = () => {
|
|
116
|
+
if (this.props.left !== void 0)
|
|
117
|
+
return this.props.left;
|
|
118
|
+
if (this.props.initialLeft !== void 0)
|
|
119
|
+
return this.props.initialLeft;
|
|
120
|
+
let t = w;
|
|
121
|
+
if (this.props.width !== void 0 ? t = this.props.width : this.props.initialWidth !== void 0 && (t = this.props.initialWidth), this.props.appendTo)
|
|
122
|
+
return this.props.appendTo.offsetWidth / 2 - t / 2;
|
|
123
|
+
const e = this.getWindow();
|
|
124
|
+
return e ? e.innerWidth / 2 - t / 2 : 0;
|
|
125
|
+
}, this.getInitialWidth = () => {
|
|
126
|
+
let t = w;
|
|
127
|
+
return this.props.width !== void 0 ? t = this.props.width : this.props.initialWidth !== void 0 && (t = this.props.initialWidth), t;
|
|
128
|
+
}, this.getInitialHeight = () => {
|
|
129
|
+
let t = u;
|
|
130
|
+
return this.props.height !== void 0 ? t = this.props.height : this.props.initialHeight !== void 0 && (t = this.props.initialHeight), t;
|
|
131
|
+
}, this.handleMinimize = (t) => {
|
|
132
|
+
t.preventDefault(), this.windowCoordinatesState.leftBeforeAction = this.left, this.windowCoordinatesState.topBeforeAction = this.top, this.windowCoordinatesState.widthBeforeAction = this.width, this.windowCoordinatesState.heightBeforeAction = this.height, this.setState({
|
|
133
|
+
stage: i.MINIMIZED,
|
|
134
|
+
height: 0
|
|
135
|
+
}), p(this.props.onStageChange, t, this, { state: i.MINIMIZED });
|
|
136
|
+
}, this.handleFullscreen = (t) => {
|
|
137
|
+
t.preventDefault(), this.windowCoordinatesState.leftBeforeAction = this.left, this.windowCoordinatesState.topBeforeAction = this.top, this.windowCoordinatesState.widthBeforeAction = this.width, this.windowCoordinatesState.heightBeforeAction = this.height;
|
|
138
|
+
const e = this.getWindow(), n = e ? e.innerWidth : 0, d = e ? e.innerHeight : 0;
|
|
139
|
+
this.setState({
|
|
140
|
+
left: 0,
|
|
141
|
+
top: 0,
|
|
142
|
+
width: this.props.appendTo ? this.props.appendTo.offsetWidth : n,
|
|
143
|
+
height: this.props.appendTo ? this.props.appendTo.offsetHeight : d,
|
|
144
|
+
stage: i.FULLSCREEN
|
|
145
|
+
}), p(this.props.onStageChange, t, this, { state: i.FULLSCREEN });
|
|
146
|
+
}, this.handleRestore = (t) => {
|
|
147
|
+
t.preventDefault(), this.windowStage === i.FULLSCREEN ? this.setState({
|
|
148
|
+
stage: i.DEFAULT,
|
|
149
|
+
left: this.windowCoordinatesState.leftBeforeAction,
|
|
150
|
+
top: this.windowCoordinatesState.topBeforeAction,
|
|
151
|
+
width: this.windowCoordinatesState.widthBeforeAction,
|
|
152
|
+
height: this.windowCoordinatesState.heightBeforeAction
|
|
153
|
+
}) : this.windowStage === i.MINIMIZED && this.setState({
|
|
154
|
+
stage: i.DEFAULT,
|
|
155
|
+
height: this.windowCoordinatesState.heightBeforeAction
|
|
156
|
+
}), p(this.props.onStageChange, t, this, { state: i.DEFAULT });
|
|
157
|
+
}, this.handleCloseWindow = (t) => {
|
|
158
|
+
t.preventDefault(), p(this.props.onClose, t, this, { state: void 0 });
|
|
159
|
+
}, this.handleDoubleClick = (t) => {
|
|
160
|
+
this.windowStage === i.FULLSCREEN || this.windowStage === i.MINIMIZED ? this.handleRestore(t) : this.handleFullscreen(t);
|
|
161
|
+
}, this.handleResize = (t, e) => {
|
|
162
|
+
const n = this.props.appendTo ? t.pageX - this.offSetCoordinates.x : t.pageX, d = this.props.appendTo ? t.pageY - this.offSetCoordinates.y : t.pageY, f = this.width, l = this.height, C = this.props.minWidth || m, D = this.props.minHeight || S, I = this.top - d, T = this.left - n;
|
|
163
|
+
let L = n - this.left, b = d - this.top;
|
|
164
|
+
const g = Object.assign({}, this.state, { isDragging: !e.end });
|
|
165
|
+
e.direction.indexOf("n") >= 0 && D - (l + I) < 0 && (this.top > 0 && (g.height = l + I), g.top = d), e.direction.indexOf("s") >= 0 && D - b < 0 && (g.height = b), e.direction.indexOf("w") >= 0 && C - (f + T) < 0 && (this.left > 0 && (g.width = f + T), g.left = n), e.direction.indexOf("e") >= 0 && C - L < 0 && (g.width = L), this.setState(g), this.dispatchMoveEvent(this.props.onResize, t, !0, e.end);
|
|
166
|
+
}, this.dispatchMoveEvent = (t, e, n, d) => {
|
|
167
|
+
t && t.call(void 0, {
|
|
168
|
+
nativeEvent: e.nativeEvent ? e.nativeEvent : e.originalEvent,
|
|
169
|
+
drag: n,
|
|
170
|
+
end: d,
|
|
171
|
+
target: this,
|
|
172
|
+
left: this.state.left,
|
|
173
|
+
top: this.state.top,
|
|
174
|
+
width: this.state.width,
|
|
175
|
+
hight: this.state.height,
|
|
176
|
+
height: this.state.height
|
|
177
|
+
});
|
|
178
|
+
}, this.handleBrowserWindowResize = () => {
|
|
179
|
+
if (this.windowStage === i.FULLSCREEN) {
|
|
180
|
+
const t = this.getWindow(), e = t ? t.innerWidth : 0, n = t ? t.innerHeight : 0;
|
|
181
|
+
this.setState({
|
|
182
|
+
width: this.props.appendTo ? this.props.appendTo.offsetWidth : e,
|
|
183
|
+
height: this.props.appendTo ? this.props.appendTo.offsetHeight : n
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}, this.getCurrentZIndex = () => !this.state || this.context === void 0 ? this.context ? this.context : y : this.state.zIndex > (this.context ? this.context + B : 0) ? this.state.zIndex : this.context + B, this.getDocument = () => this.props.appendTo ? this.props.appendTo.ownerDocument : document, this.getWindow = () => {
|
|
187
|
+
const t = this.getDocument();
|
|
188
|
+
return t && t.defaultView;
|
|
189
|
+
}, x(M), this.showLicenseWatermark = U(M), this.state = {
|
|
190
|
+
stage: this.props.stage || i.DEFAULT,
|
|
191
|
+
isDragging: !1,
|
|
192
|
+
top: 0,
|
|
193
|
+
left: 0,
|
|
194
|
+
width: w,
|
|
195
|
+
height: u,
|
|
196
|
+
focused: !0,
|
|
197
|
+
zIndex: y
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
get _id() {
|
|
201
|
+
return this.props.id + "-accessibility-id";
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @hidden
|
|
205
|
+
*/
|
|
206
|
+
componentDidMount() {
|
|
207
|
+
const s = this.getWindow();
|
|
208
|
+
s && s.addEventListener("resize", this.handleBrowserWindowResize), this.setState({
|
|
209
|
+
stage: this.props.stage || i.DEFAULT,
|
|
210
|
+
isDragging: !1,
|
|
211
|
+
top: this.getInitialTop(),
|
|
212
|
+
left: this.getInitialLeft(),
|
|
213
|
+
width: this.getInitialWidth(),
|
|
214
|
+
height: this.getInitialHeight(),
|
|
215
|
+
focused: !0,
|
|
216
|
+
zIndex: F(this.getCurrentZIndex(), this.getDocument(), this._id)
|
|
217
|
+
}), this.windowCoordinatesState = {
|
|
218
|
+
leftBeforeAction: this.getInitialLeft(),
|
|
219
|
+
topBeforeAction: this.getInitialTop(),
|
|
220
|
+
widthBeforeAction: this.getInitialWidth(),
|
|
221
|
+
heightBeforeAction: this.getInitialHeight()
|
|
222
|
+
};
|
|
223
|
+
const t = this.getDocument();
|
|
224
|
+
if (this.props.appendTo && t) {
|
|
225
|
+
let e = this.props.appendTo.getBoundingClientRect(), n = t.body.getBoundingClientRect();
|
|
226
|
+
this.offSetCoordinates.x = e.left - n.left, this.offSetCoordinates.y = e.top - n.top;
|
|
227
|
+
}
|
|
228
|
+
this.mounted = !0;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* @hidden
|
|
232
|
+
*/
|
|
233
|
+
componentWillUnmount() {
|
|
234
|
+
const s = this.getWindow();
|
|
235
|
+
s && s.removeEventListener("resize", this.handleBrowserWindowResize), this.mounted = !1;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* @hidden
|
|
239
|
+
*/
|
|
240
|
+
componentDidUpdate() {
|
|
241
|
+
const s = this.getDocument();
|
|
242
|
+
if (this.props.appendTo && s) {
|
|
243
|
+
let t = this.props.appendTo.getBoundingClientRect(), e = s.body.getBoundingClientRect();
|
|
244
|
+
this.offSetCoordinates.x = t.left - e.left, this.offSetCoordinates.y = t.top - e.top;
|
|
245
|
+
}
|
|
246
|
+
this.mounted = !0;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @hidden
|
|
250
|
+
*/
|
|
251
|
+
render() {
|
|
252
|
+
const s = h.Children.toArray(this.props.children), t = this.getContent(s), e = this.getActionBar(s), n = this.getCurrentZIndex(), d = N(
|
|
253
|
+
"k-window",
|
|
254
|
+
this.props.className,
|
|
255
|
+
{
|
|
256
|
+
[`k-window-${this.props.themeColor}`]: this.props.themeColor,
|
|
257
|
+
"k-window-minimized": this.state.stage === "MINIMIZED",
|
|
258
|
+
"k-window-focused": this.state.focused
|
|
259
|
+
}
|
|
260
|
+
), f = /* @__PURE__ */ h.createElement(W.Provider, { value: n }, /* @__PURE__ */ h.createElement(h.Fragment, null, this.props.modal && /* @__PURE__ */ h.createElement(
|
|
261
|
+
"div",
|
|
262
|
+
{
|
|
263
|
+
className: "k-overlay",
|
|
264
|
+
style: {
|
|
265
|
+
zIndex: n,
|
|
266
|
+
...this.props.overlayStyle
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
), /* @__PURE__ */ h.createElement(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
id: this.props.id,
|
|
273
|
+
[X]: this._id,
|
|
274
|
+
tabIndex: 0,
|
|
275
|
+
role: "dialog",
|
|
276
|
+
"aria-labelledby": this.titleId,
|
|
277
|
+
onFocus: this.onFocus,
|
|
278
|
+
onBlur: this.onBlur,
|
|
279
|
+
onKeyDown: this.onKeyDown,
|
|
280
|
+
ref: (l) => {
|
|
281
|
+
this.windowElement = l, this.element = l;
|
|
282
|
+
},
|
|
283
|
+
className: d,
|
|
284
|
+
style: {
|
|
285
|
+
top: this.top,
|
|
286
|
+
left: this.left,
|
|
287
|
+
width: this.width,
|
|
288
|
+
height: this.height || "",
|
|
289
|
+
zIndex: n,
|
|
290
|
+
...this.props.style
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
/* @__PURE__ */ h.createElement(
|
|
294
|
+
K,
|
|
295
|
+
{
|
|
296
|
+
shouldUpdateOnDrag: this.props.shouldUpdateOnDrag || !1,
|
|
297
|
+
isDragging: this.state.isDragging
|
|
298
|
+
},
|
|
299
|
+
/* @__PURE__ */ h.createElement(
|
|
300
|
+
H,
|
|
301
|
+
{
|
|
302
|
+
onPress: this.onPress,
|
|
303
|
+
onDrag: this.onDrag,
|
|
304
|
+
onRelease: this.onRelease,
|
|
305
|
+
ref: (l) => this.draggable = l
|
|
306
|
+
},
|
|
307
|
+
/* @__PURE__ */ h.createElement(
|
|
308
|
+
v,
|
|
309
|
+
{
|
|
310
|
+
stage: this.windowStage,
|
|
311
|
+
onDoubleClick: this.props.doubleClickStageChange ? this.handleDoubleClick : void 0,
|
|
312
|
+
onMinimizeButtonClick: this.handleMinimize,
|
|
313
|
+
onFullScreenButtonClick: this.handleFullscreen,
|
|
314
|
+
onRestoreButtonClick: this.handleRestore,
|
|
315
|
+
onCloseButtonClick: this.handleCloseWindow,
|
|
316
|
+
closeButton: this.props.closeButton,
|
|
317
|
+
minimizeButton: this.props.minimizeButton,
|
|
318
|
+
maximizeButton: this.props.maximizeButton,
|
|
319
|
+
restoreButton: this.props.restoreButton,
|
|
320
|
+
id: this.titleId
|
|
321
|
+
},
|
|
322
|
+
this.props.title
|
|
323
|
+
)
|
|
324
|
+
),
|
|
325
|
+
this.windowStage !== i.MINIMIZED ? /* @__PURE__ */ h.createElement(h.Fragment, null, /* @__PURE__ */ h.createElement("div", { className: "k-window-content" }, t), e) : null,
|
|
326
|
+
this.windowStage === i.DEFAULT && this.props.resizable ? /* @__PURE__ */ h.createElement(P, { onResize: this.handleResize }) : null
|
|
327
|
+
),
|
|
328
|
+
this.showLicenseWatermark && /* @__PURE__ */ h.createElement(k, null)
|
|
329
|
+
)));
|
|
330
|
+
return z ? this.props.appendTo !== null ? R.createPortal(f, this.props.appendTo || document.body) : f : null;
|
|
331
|
+
}
|
|
332
|
+
// Getters
|
|
333
|
+
get top() {
|
|
334
|
+
return this.windowStage !== i.FULLSCREEN ? Math.max(this.props.top || this.state.top, 0) : 0;
|
|
335
|
+
}
|
|
336
|
+
get left() {
|
|
337
|
+
return this.windowStage !== i.FULLSCREEN ? Math.max(this.props.left || this.state.left, 0) : 0;
|
|
338
|
+
}
|
|
339
|
+
get width() {
|
|
340
|
+
let s = this.props.width || this.state.width;
|
|
341
|
+
if (this.windowStage === i.FULLSCREEN) {
|
|
342
|
+
if (this.props.appendTo)
|
|
343
|
+
return s = this.props.appendTo.offsetWidth, s;
|
|
344
|
+
const t = this.getWindow();
|
|
345
|
+
s = t ? t.innerWidth : 0;
|
|
346
|
+
}
|
|
347
|
+
return s;
|
|
348
|
+
}
|
|
349
|
+
get height() {
|
|
350
|
+
let s = this.props.height || this.state.height;
|
|
351
|
+
if (this.windowStage === i.FULLSCREEN) {
|
|
352
|
+
if (this.props.appendTo)
|
|
353
|
+
return s = this.props.appendTo.offsetHeight, s;
|
|
354
|
+
const t = this.getWindow();
|
|
355
|
+
s = t ? t.innerHeight : 0;
|
|
356
|
+
} else
|
|
357
|
+
this.windowStage === i.MINIMIZED && (s = 0);
|
|
358
|
+
return s;
|
|
359
|
+
}
|
|
360
|
+
get windowStage() {
|
|
361
|
+
return this.props.stage || this.state.stage;
|
|
362
|
+
}
|
|
363
|
+
getActionBar(s) {
|
|
364
|
+
return s.filter((t) => t && t.type === A);
|
|
365
|
+
}
|
|
366
|
+
getContent(s) {
|
|
367
|
+
return s.filter((t) => t && t.type !== A);
|
|
368
|
+
}
|
|
369
|
+
generateTitleId() {
|
|
370
|
+
return "window-title-" + this._id;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
c.displayName = "Window", c.propTypes = {
|
|
374
|
+
width: o.number,
|
|
375
|
+
height: o.number,
|
|
376
|
+
left: o.number,
|
|
377
|
+
top: o.number,
|
|
378
|
+
initialWidth: o.number,
|
|
379
|
+
initialHeight: o.number,
|
|
380
|
+
initialLeft: o.number,
|
|
381
|
+
initialTop: o.number,
|
|
382
|
+
minWidth: o.number,
|
|
383
|
+
minHeight: o.number,
|
|
384
|
+
resizable: o.bool,
|
|
385
|
+
draggable: o.bool,
|
|
386
|
+
title: o.any,
|
|
387
|
+
shouldUpdateOnDrag: o.bool,
|
|
388
|
+
stage: o.oneOf(["DEFAULT", "MINIMIZED", "FULLSCREEN"]),
|
|
389
|
+
className: o.string,
|
|
390
|
+
id: o.string,
|
|
391
|
+
style: o.object,
|
|
392
|
+
overlayStyle: o.object
|
|
393
|
+
}, c.defaultProps = {
|
|
394
|
+
minWidth: m,
|
|
395
|
+
minHeight: S,
|
|
396
|
+
resizable: !0,
|
|
397
|
+
draggable: !0,
|
|
398
|
+
modal: !1,
|
|
399
|
+
doubleClickStageChange: !0
|
|
400
|
+
}, c.contextType = W;
|
|
401
|
+
let E = c;
|
|
402
|
+
const G = _(), Y = Z(O(G, E));
|
|
403
|
+
Y.displayName = "KendoReactWindow";
|
|
404
|
+
export {
|
|
405
|
+
Y as Window,
|
|
406
|
+
G as WindowPropsContext
|
|
407
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),c=require("prop-types"),i=require("@progress/kendo-react-common");function u(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,o.get?o:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const l=u(a),r=t=>{const n={layout:"end",...t},{layout:e,children:o}=n,s=i.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":e==="start","k-justify-content-center":e==="center","k-justify-content-end":e==="end","k-justify-content-stretch":e==="stretched"});return l.createElement("div",{className:s},o)};r.propTypes={children:c.any,layout:c.oneOf(["start","center","end","stretched"])};exports.WindowActionsBar=r;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as c from "react";
|
|
10
|
+
import e from "prop-types";
|
|
11
|
+
import { classNames as a } from "@progress/kendo-react-common";
|
|
12
|
+
const i = (n) => {
|
|
13
|
+
const s = {
|
|
14
|
+
layout: "end",
|
|
15
|
+
...n
|
|
16
|
+
}, { layout: t, children: o } = s, r = a(
|
|
17
|
+
"k-actions",
|
|
18
|
+
"k-window-actions",
|
|
19
|
+
"k-actions-horizontal",
|
|
20
|
+
"k-hstack",
|
|
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
|
+
);
|
|
28
|
+
return /* @__PURE__ */ c.createElement("div", { className: r }, o);
|
|
29
|
+
};
|
|
30
|
+
i.propTypes = {
|
|
31
|
+
children: e.any,
|
|
32
|
+
layout: e.oneOf(["start", "center", "end", "stretched"])
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
i as WindowActionsBar
|
|
36
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),c=require("@progress/kendo-react-common");function i(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const o=i(a),l=["n","e","s","w","se","sw","ne","nw"];class d extends o.Component{render(){return o.createElement("div",{className:"k-resize-handles-wrapper"}," ",l.map((e,n)=>o.createElement(c.Draggable,{key:n,onDrag:r=>{const{event:s}=r;s.originalEvent.preventDefault(),this.props.onResize(s,{end:!1,direction:e})},onRelease:r=>{const{event:s}=r;s.originalEvent.preventDefault(),this.props.onResize(s,{end:!0,direction:e})}},o.createElement("div",{className:"k-resize-handle k-resize-"+e,style:{display:"block",touchAction:"none"}}))))}}exports.ResizeHandlers=d;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as n from "react";
|
|
10
|
+
import { Draggable as a } from "@progress/kendo-react-common";
|
|
11
|
+
const o = ["n", "e", "s", "w", "se", "sw", "ne", "nw"];
|
|
12
|
+
class c extends n.Component {
|
|
13
|
+
render() {
|
|
14
|
+
return /* @__PURE__ */ n.createElement("div", { className: "k-resize-handles-wrapper" }, " ", o.map((t, r) => /* @__PURE__ */ n.createElement(
|
|
15
|
+
a,
|
|
16
|
+
{
|
|
17
|
+
key: r,
|
|
18
|
+
onDrag: (s) => {
|
|
19
|
+
const { event: e } = s;
|
|
20
|
+
e.originalEvent.preventDefault(), this.props.onResize(e, { end: !1, direction: t });
|
|
21
|
+
},
|
|
22
|
+
onRelease: (s) => {
|
|
23
|
+
const { event: e } = s;
|
|
24
|
+
e.originalEvent.preventDefault(), this.props.onResize(e, { end: !0, direction: t });
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
/* @__PURE__ */ n.createElement(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: "k-resize-handle k-resize-" + t,
|
|
31
|
+
style: { display: "block", touchAction: "none" }
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
)));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
c as ResizeHandlers
|
|
39
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),d=require("./StageEnum.js"),r=require("@progress/kendo-react-buttons"),E=require("@progress/kendo-react-intl"),s=require("@progress/kendo-svg-icons"),n=require("./messages/index.js");function R(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(o,i,l.get?l:{enumerable:!0,get:()=>e[i]})}}return o.default=e,Object.freeze(o)}const t=R(C),S=e=>{const{children:o,onCloseButtonClick:i,onMinimizeButtonClick:l,onFullScreenButtonClick:u,onRestoreButtonClick:m,onDoubleClick:w,stage:a,forwardedRef:g,id:B}=e,c=E.useLocalization(),f=e.minimizeButton?t.createElement(e.minimizeButton,{onClick:l,stage:a}):t.createElement(r.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:s.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:l,"aria-label":c.toLanguageString(n.dialogsWindowMinimizeButton,n.messages[n.dialogsWindowMinimizeButton])}),k=e.maximizeButton?t.createElement(e.maximizeButton,{onClick:u,stage:a}):t.createElement(r.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:s.windowIcon,className:"k-window-titlebar-action",onClick:u,"aria-label":c.toLanguageString(n.dialogsWindowMaximizeButton,n.messages[n.dialogsWindowMaximizeButton])}),b=e.restoreButton?t.createElement(e.restoreButton,{onClick:m,stage:a}):t.createElement(r.Button,{fillMode:"flat",icon:"window-restore",svgIcon:s.windowRestoreIcon,className:"k-window-titlebar-action",onClick:m,"aria-label":c.toLanguageString(n.dialogsWindowRestoreButton,n.messages[n.dialogsWindowRestoreButton])}),z=e.closeButton?t.createElement(e.closeButton,{onClick:i,stage:a}):t.createElement(r.Button,{fillMode:"flat",icon:"x",svgIcon:s.xIcon,className:"k-window-titlebar-action",onClick:i,"aria-label":c.toLanguageString(n.dialogsWindowCloseButton,n.messages[n.dialogsWindowCloseButton])});return t.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:g,onDoubleClick:w},t.createElement("span",{className:"k-window-title",id:B},o||""),t.createElement("div",{className:"k-window-titlebar-actions"},a===d.windowStage.DEFAULT&&f,a===d.windowStage.DEFAULT&&k,a!==d.windowStage.DEFAULT&&b,z))},M=t.forwardRef((e,o)=>t.createElement(S,{...e,forwardedRef:o}));exports.WindowTitleBar=M;
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as e from "react";
|
|
10
|
+
import { windowStage as c } from "./StageEnum.mjs";
|
|
11
|
+
import { Button as a } from "@progress/kendo-react-buttons";
|
|
12
|
+
import { useLocalization as x } from "@progress/kendo-react-intl";
|
|
13
|
+
import { windowMinimizeIcon as I, windowIcon as L, windowRestoreIcon as M, xIcon as N } from "@progress/kendo-svg-icons";
|
|
14
|
+
import { dialogsWindowMinimizeButton as w, messages as l, dialogsWindowMaximizeButton as u, dialogsWindowRestoreButton as g, dialogsWindowCloseButton as B } from "./messages/index.mjs";
|
|
15
|
+
const v = (t) => {
|
|
16
|
+
const {
|
|
17
|
+
children: o,
|
|
18
|
+
onCloseButtonClick: r,
|
|
19
|
+
onMinimizeButtonClick: m,
|
|
20
|
+
onFullScreenButtonClick: s,
|
|
21
|
+
onRestoreButtonClick: d,
|
|
22
|
+
onDoubleClick: f,
|
|
23
|
+
stage: n,
|
|
24
|
+
forwardedRef: k,
|
|
25
|
+
id: C
|
|
26
|
+
} = t, i = x(), E = t.minimizeButton ? /* @__PURE__ */ e.createElement(t.minimizeButton, { onClick: m, stage: n }) : /* @__PURE__ */ e.createElement(
|
|
27
|
+
a,
|
|
28
|
+
{
|
|
29
|
+
fillMode: "flat",
|
|
30
|
+
icon: "window-minimize",
|
|
31
|
+
svgIcon: I,
|
|
32
|
+
className: "k-window-titlebar-action",
|
|
33
|
+
onClick: m,
|
|
34
|
+
"aria-label": i.toLanguageString(w, l[w])
|
|
35
|
+
}
|
|
36
|
+
), z = t.maximizeButton ? /* @__PURE__ */ e.createElement(t.maximizeButton, { onClick: s, stage: n }) : /* @__PURE__ */ e.createElement(
|
|
37
|
+
a,
|
|
38
|
+
{
|
|
39
|
+
fillMode: "flat",
|
|
40
|
+
icon: "window-maximize",
|
|
41
|
+
svgIcon: L,
|
|
42
|
+
className: "k-window-titlebar-action",
|
|
43
|
+
onClick: s,
|
|
44
|
+
"aria-label": i.toLanguageString(u, l[u])
|
|
45
|
+
}
|
|
46
|
+
), b = t.restoreButton ? /* @__PURE__ */ e.createElement(t.restoreButton, { onClick: d, stage: n }) : /* @__PURE__ */ e.createElement(
|
|
47
|
+
a,
|
|
48
|
+
{
|
|
49
|
+
fillMode: "flat",
|
|
50
|
+
icon: "window-restore",
|
|
51
|
+
svgIcon: M,
|
|
52
|
+
className: "k-window-titlebar-action",
|
|
53
|
+
onClick: d,
|
|
54
|
+
"aria-label": i.toLanguageString(g, l[g])
|
|
55
|
+
}
|
|
56
|
+
), R = t.closeButton ? /* @__PURE__ */ e.createElement(t.closeButton, { onClick: r, stage: n }) : /* @__PURE__ */ e.createElement(
|
|
57
|
+
a,
|
|
58
|
+
{
|
|
59
|
+
fillMode: "flat",
|
|
60
|
+
icon: "x",
|
|
61
|
+
svgIcon: N,
|
|
62
|
+
className: "k-window-titlebar-action",
|
|
63
|
+
onClick: r,
|
|
64
|
+
"aria-label": i.toLanguageString(B, l[B])
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
return /* @__PURE__ */ e.createElement(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: "k-window-titlebar",
|
|
71
|
+
style: { touchAction: "none" },
|
|
72
|
+
ref: k,
|
|
73
|
+
onDoubleClick: f
|
|
74
|
+
},
|
|
75
|
+
/* @__PURE__ */ e.createElement("span", { className: "k-window-title", id: C }, o || ""),
|
|
76
|
+
/* @__PURE__ */ e.createElement("div", { className: "k-window-titlebar-actions" }, n === c.DEFAULT && E, n === c.DEFAULT && z, n !== c.DEFAULT && b, R)
|
|
77
|
+
);
|
|
78
|
+
}, F = e.forwardRef((t, o) => /* @__PURE__ */ e.createElement(
|
|
79
|
+
v,
|
|
80
|
+
{
|
|
81
|
+
...t,
|
|
82
|
+
forwardedRef: o
|
|
83
|
+
}
|
|
84
|
+
));
|
|
85
|
+
export {
|
|
86
|
+
F as WindowTitleBar
|
|
87
|
+
};
|
package/constants.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D="data-windowid",A=10002,I=2,S=".k-window:not(.k-dialog), .k-dialog-wrapper";exports.DATA_DIALOGS_ID=D;exports.DEFAULT_DIALOGS_ZINDEX=A;exports.DIALOGS_SELECTOR=S;exports.ZINDEX_DIALOGS_STEP=I;
|
package/constants.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
const o = "data-windowid", D = 10002, n = 2, t = ".k-window:not(.k-dialog), .k-dialog-wrapper";
|
|
10
|
+
export {
|
|
11
|
+
o as DATA_DIALOGS_ID,
|
|
12
|
+
D as DEFAULT_DIALOGS_ZINDEX,
|
|
13
|
+
t as DIALOGS_SELECTOR,
|
|
14
|
+
n as ZINDEX_DIALOGS_STEP
|
|
15
|
+
};
|