@progress/kendo-react-dialogs 13.3.0-develop.9 → 13.4.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.d.ts +45 -0
- package/Dialog.mjs +3 -3
- package/DialogActionsBar.d.ts +28 -0
- package/DialogProps.d.ts +184 -0
- package/DialogTitleBar.d.ts +33 -0
- package/MiddleLayerOptimization.d.ts +24 -0
- package/StageEnum.d.ts +12 -0
- package/Window.d.ts +189 -0
- package/Window.mjs +6 -6
- package/WindowActionsBar.d.ts +28 -0
- package/WindowProps.d.ts +332 -0
- package/WindowResizeHandlers.d.ts +23 -0
- package/WindowTitlebar.d.ts +70 -0
- package/codemods/utils.js +1 -8
- package/codemods/v11/dialog-handle.js +1 -8
- package/constants.d.ts +15 -0
- package/dist/cdn/js/kendo-react-dialogs.js +1 -1
- package/events.d.ts +55 -0
- package/index.d.mts +9 -825
- package/index.d.ts +9 -825
- package/messages/index.d.ts +32 -0
- package/models/actions-layout.d.ts +11 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.mjs +13 -0
- package/package.json +10 -4
- package/utils.d.ts +9 -0
package/WindowProps.d.ts
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { WindowActionsEvent, WindowMoveEvent } from './events.js';
|
|
9
|
+
import { windowStage } from './StageEnum.js';
|
|
10
|
+
/**
|
|
11
|
+
* Represents the props of the [KendoReact Window component](https://www.telerik.com/kendo-react-ui/components/dialogs/window).
|
|
12
|
+
*/
|
|
13
|
+
export interface WindowProps {
|
|
14
|
+
/**
|
|
15
|
+
* Defines the container to which the Window will be appended. If set to `null`, the Window will be rendered without React Portal.
|
|
16
|
+
*
|
|
17
|
+
* @default parent element
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx
|
|
21
|
+
* <Window appendTo={document.body} />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
appendTo?: HTMLElement | null;
|
|
25
|
+
/**
|
|
26
|
+
* Focus the Window container automatically when mounted.
|
|
27
|
+
*
|
|
28
|
+
* @default true
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```jsx
|
|
32
|
+
* <Window autoFocus={false} />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
autoFocus?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Specifies if the Window will render the close button.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```jsx
|
|
45
|
+
* <Window closeButton={CustomCloseButton} />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
closeButton?: React.ComponentType<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Specifies if the Window stage will change on title double click.
|
|
51
|
+
*
|
|
52
|
+
* @default true
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```jsx
|
|
56
|
+
* <Window doubleClickStageChange={false} />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
doubleClickStageChange?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Specifies if the Window will be draggable ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/positioning-dragging#toc-dragging)).
|
|
62
|
+
*
|
|
63
|
+
* @default true
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```jsx
|
|
67
|
+
* <Window draggable={true} />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
draggable?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Specifies the height of the Window ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/dimensions-resizing#toc-dimensions)). When set to `null`, the window is automatically sized to fit its content.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```jsx
|
|
76
|
+
* <Window height={500} />
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
height?: number | null;
|
|
80
|
+
/**
|
|
81
|
+
* Specifies the initial `left` value ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/positioning-dragging#toc-positioning)). The Window will be in an uncontrolled mode.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```jsx
|
|
85
|
+
* <Window initialLeft={100} />
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
initialLeft?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Specifies the initial `top` value ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/positioning-dragging#toc-positioning)). The component will be in an uncontrolled mode.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```jsx
|
|
94
|
+
* <Window initialTop={50} />
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
initialTop?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Specifies the initial width of the Window ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/dimensions-resizing#toc-dimensions)). The component will be in an uncontrolled mode.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```jsx
|
|
103
|
+
* <Window initialWidth={300} />
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
initialWidth?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Specifies the initial height of the Window ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/dimensions-resizing#toc-dimensions)). The component will be in an uncontrolled mode.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```jsx
|
|
112
|
+
* <Window initialHeight={200} />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
initialHeight?: number | null;
|
|
116
|
+
/**
|
|
117
|
+
* Specifies the left coordinates of the Window.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```jsx
|
|
121
|
+
* <Window left={150} />
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
left?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Specifies if the Window will render the maximize button.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```jsx
|
|
130
|
+
* <Window maximizeButton={CustomMaximizeButton} />
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
maximizeButton?: React.ComponentType<any>;
|
|
134
|
+
/**
|
|
135
|
+
* Specifies the minimum height of the Window ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/dimensions-resizing#toc-resizing)).
|
|
136
|
+
*
|
|
137
|
+
* @default 100
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```jsx
|
|
141
|
+
* <Window minHeight={100} />
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
minHeight?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Specifies the minimum width of the Window ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/dimensions-resizing#toc-resizing)).
|
|
147
|
+
*
|
|
148
|
+
* @default 120
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```jsx
|
|
152
|
+
* <Window minWidth={100} />
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
minWidth?: number;
|
|
156
|
+
/**
|
|
157
|
+
* Specifies if the Window will render the minimize button.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```jsx
|
|
161
|
+
* <Window minimizeButton={CustomMinimizeButton} />
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
minimizeButton?: React.ComponentType<any>;
|
|
165
|
+
/**
|
|
166
|
+
* Specifies if the Window will be modal by rendering an overlay under the component.
|
|
167
|
+
*
|
|
168
|
+
* @default false
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```jsx
|
|
172
|
+
* <Window modal={true} />
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
modal?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Specifies if the Window will be resizable ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/dimensions-resizing#toc-resizing)).
|
|
178
|
+
*
|
|
179
|
+
* @default true
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```jsx
|
|
183
|
+
* <Window resizable={true} />
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
resizable?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Specifies if the Window will render the restore button.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```jsx
|
|
192
|
+
* <Window restoreButton={CustomRestoreButton} />
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
restoreButton?: React.ComponentType<any>;
|
|
196
|
+
/**
|
|
197
|
+
* Specifies if the Window content will update during resizing.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```jsx
|
|
201
|
+
* <Window shouldUpdateOnDrag={true} />
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
shouldUpdateOnDrag?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Specifies the title of the Window ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/title)).
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```jsx
|
|
210
|
+
* <Window title="My Window" />
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
title?: React.ReactNode | string;
|
|
214
|
+
/**
|
|
215
|
+
* Specifies the top coordinates of the Window.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```jsx
|
|
219
|
+
* <Window top={100} />
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
top?: number;
|
|
223
|
+
/**
|
|
224
|
+
* Specifies the width of the Window.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```jsx
|
|
228
|
+
* <Window width={400} />
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
width?: number;
|
|
232
|
+
/**
|
|
233
|
+
* Controls the state of the Window ([see example](https://www.telerik.com/kendo-react-ui/components/dialogs/window/minimizing-fullscreen)).
|
|
234
|
+
*
|
|
235
|
+
* The supported values are:
|
|
236
|
+
* * `DEFAULT`
|
|
237
|
+
* * `MINIMIZED`
|
|
238
|
+
* * `FULLSCREEN`
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```jsx
|
|
242
|
+
* <Window stage="DEFAULT" />
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
stage?: windowStage | string;
|
|
246
|
+
/**
|
|
247
|
+
* Set styles to the Window element.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```jsx
|
|
251
|
+
* <Window style={{ backgroundColor: 'red' }} />
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
style?: React.CSSProperties;
|
|
255
|
+
/**
|
|
256
|
+
* Set styles to the Window overlay element rendered when the `modal` prop is enabled.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```jsx
|
|
260
|
+
* <Window overlayStyle={{ opacity: 0.5 }} />
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
overlayStyle?: React.CSSProperties;
|
|
264
|
+
/**
|
|
265
|
+
* Sets a class of the Window DOM element.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```jsx
|
|
269
|
+
* <Window className="custom-class" />
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
className?: string;
|
|
273
|
+
/**
|
|
274
|
+
* Configures the `themeColor` of the Window.
|
|
275
|
+
*
|
|
276
|
+
* The available options are:
|
|
277
|
+
* - primary
|
|
278
|
+
* - dark
|
|
279
|
+
* - light
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```jsx
|
|
283
|
+
* <Window themeColor="dark" />
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
themeColor?: 'primary' | 'dark' | 'light';
|
|
287
|
+
/**
|
|
288
|
+
* Fires when the **Close** button in the title is clicked or when the `Esc` button is pressed.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```jsx
|
|
292
|
+
* <Window onClose={(event) => console.log('Window closed', event)} />
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
onClose?: (event: WindowActionsEvent) => void;
|
|
296
|
+
/**
|
|
297
|
+
* Fires when the Window is dragged.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```jsx
|
|
301
|
+
* <Window onMove={(event) => console.log('Window moved', event)} />
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
onMove?: (event: WindowMoveEvent) => void;
|
|
305
|
+
/**
|
|
306
|
+
* Fires when the `DEFAULT`, `FULLSCREEN`, or `MINIMIZED` state of the Window is changed.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```jsx
|
|
310
|
+
* <Window onStageChange={(event) => console.log('Stage changed', event)} />
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
onStageChange?: (event: WindowActionsEvent) => void;
|
|
314
|
+
/**
|
|
315
|
+
* Fires when the Window resizes.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```jsx
|
|
319
|
+
* <Window onResize={(event) => console.log('Window resized', event)} />
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
onResize?: (event: WindowMoveEvent) => void;
|
|
323
|
+
/**
|
|
324
|
+
* Sets the `id` attribute value of the wrapper element of the Window.
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```jsx
|
|
328
|
+
* <Window id="my-window" />
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
id?: string;
|
|
332
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export interface ResizeHandlersProps {
|
|
13
|
+
onResize: (e: any, args: {
|
|
14
|
+
end: boolean;
|
|
15
|
+
direction: any;
|
|
16
|
+
}) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export declare class ResizeHandlers extends React.Component<ResizeHandlersProps, {}> {
|
|
22
|
+
render(): React.JSX.Element;
|
|
23
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { windowStage } from './StageEnum.js';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export interface WindowTitleBarProps {
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
onCloseButtonClick?: (event: React.SyntheticEvent<any>) => void;
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
onDoubleClick?: (event: React.SyntheticEvent<any>) => void;
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
onMinimizeButtonClick?: (event: React.SyntheticEvent<any>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
*/
|
|
29
|
+
onFullScreenButtonClick?: (event: React.SyntheticEvent<any>) => void;
|
|
30
|
+
/**
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
onRestoreButtonClick?: (event: React.SyntheticEvent<any>) => void;
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
id?: string;
|
|
38
|
+
/**
|
|
39
|
+
* @hidden
|
|
40
|
+
*/
|
|
41
|
+
stage?: windowStage | string;
|
|
42
|
+
/**
|
|
43
|
+
* @hidden
|
|
44
|
+
*/
|
|
45
|
+
children?: any;
|
|
46
|
+
/**
|
|
47
|
+
* @hidden
|
|
48
|
+
*/
|
|
49
|
+
closeButton?: React.ComponentType<any>;
|
|
50
|
+
/**
|
|
51
|
+
* @hidden
|
|
52
|
+
*/
|
|
53
|
+
minimizeButton?: React.ComponentType<any>;
|
|
54
|
+
/**
|
|
55
|
+
* @hidden
|
|
56
|
+
*/
|
|
57
|
+
maximizeButton?: React.ComponentType<any>;
|
|
58
|
+
/**
|
|
59
|
+
* @hidden
|
|
60
|
+
*/
|
|
61
|
+
restoreButton?: React.ComponentType<any>;
|
|
62
|
+
/**
|
|
63
|
+
* @hidden
|
|
64
|
+
*/
|
|
65
|
+
forwardedRef?: any;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @hidden
|
|
69
|
+
*/
|
|
70
|
+
export declare const WindowTitleBar: React.ForwardRefExoticComponent<WindowTitleBarProps & React.RefAttributes<unknown>>;
|
package/codemods/utils.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
*-------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
-
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
-
*-------------------------------------------------------------------------------------------
|
|
7
|
-
*/
|
|
8
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=(e,r,i,o)=>{const s=r.find(e.ImportDeclaration,{source:{value:o}});if(s.size()>0){const t=s.get(0).node.specifiers;t.some(n=>n.type==="ImportSpecifier"&&n.imported.name===i)||t.push(e.importSpecifier(e.identifier(i)))}else{const t=e.importDeclaration([e.importSpecifier(e.identifier(i))],e.literal(o));r.get().node.program.body.unshift(t)}};exports.ensureImportExists=p;
|
|
9
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL2RpYWxvZ3MvY29kZW1vZHMvdXRpbHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSlNDb2Rlc2hpZnQgfSBmcm9tICdqc2NvZGVzaGlmdCc7XG5cbmV4cG9ydCBjb25zdCBlbnN1cmVJbXBvcnRFeGlzdHMgPSAoajogSlNDb2Rlc2hpZnQsIHJvb3Q6IGFueSwgaW1wb3J0TmFtZTogc3RyaW5nLCBzb3VyY2U6IHN0cmluZykgPT4ge1xuICAgIGNvbnN0IGltcG9ydERlY2xhcmF0aW9uID0gcm9vdC5maW5kKGouSW1wb3J0RGVjbGFyYXRpb24sIHtcbiAgICAgICAgc291cmNlOiB7IHZhbHVlOiBzb3VyY2UgfVxuICAgIH0pO1xuXG4gICAgaWYgKGltcG9ydERlY2xhcmF0aW9uLnNpemUoKSA+
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL2RpYWxvZ3MvY29kZW1vZHMvdXRpbHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSlNDb2Rlc2hpZnQgfSBmcm9tICdqc2NvZGVzaGlmdCc7XG5cbmV4cG9ydCBjb25zdCBlbnN1cmVJbXBvcnRFeGlzdHMgPSAoajogSlNDb2Rlc2hpZnQsIHJvb3Q6IGFueSwgaW1wb3J0TmFtZTogc3RyaW5nLCBzb3VyY2U6IHN0cmluZykgPT4ge1xuICAgIGNvbnN0IGltcG9ydERlY2xhcmF0aW9uID0gcm9vdC5maW5kKGouSW1wb3J0RGVjbGFyYXRpb24sIHtcbiAgICAgICAgc291cmNlOiB7IHZhbHVlOiBzb3VyY2UgfVxuICAgIH0pO1xuXG4gICAgaWYgKGltcG9ydERlY2xhcmF0aW9uLnNpemUoKSA+IDApIHtcbiAgICAgICAgY29uc3Qgc3BlY2lmaWVycyA9IGltcG9ydERlY2xhcmF0aW9uLmdldCgwKS5ub2RlLnNwZWNpZmllcnM7XG4gICAgICAgIGNvbnN0IGFscmVhZHlJbXBvcnRlZCA9IHNwZWNpZmllcnMuc29tZShcbiAgICAgICAgICAgIChzcGVjaWZpZXI6IGFueSkgPT4gc3BlY2lmaWVyLnR5cGUgPT09ICdJbXBvcnRTcGVjaWZpZXInICYmIHNwZWNpZmllci5pbXBvcnRlZC5uYW1lID09PSBpbXBvcnROYW1lXG4gICAgICAgICk7XG5cbiAgICAgICAgaWYgKCFhbHJlYWR5SW1wb3J0ZWQpIHtcbiAgICAgICAgICAgIHNwZWNpZmllcnMucHVzaChqLmltcG9ydFNwZWNpZmllcihqLmlkZW50aWZpZXIoaW1wb3J0TmFtZSkpKTtcbiAgICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICAgIGNvbnN0IG5ld0ltcG9ydCA9IGouaW1wb3J0RGVjbGFyYXRpb24oW2ouaW1wb3J0U3BlY2lmaWVyKGouaWRlbnRpZmllcihpbXBvcnROYW1lKSldLCBqLmxpdGVyYWwoc291cmNlKSk7XG4gICAgICAgIHJvb3QuZ2V0KCkubm9kZS5wcm9ncmFtLmJvZHkudW5zaGlmdChuZXdJbXBvcnQpO1xuICAgIH1cbn07XG4iXSwibmFtZXMiOlsiZW5zdXJlSW1wb3J0RXhpc3RzIiwiaiIsInJvb3QiLCJpbXBvcnROYW1lIiwic291cmNlIiwiaW1wb3J0RGVjbGFyYXRpb24iLCJzcGVjaWZpZXJzIiwic3BlY2lmaWVyIiwibmV3SW1wb3J0Il0sIm1hcHBpbmdzIjoiZ0ZBRU8sTUFBTUEsRUFBcUIsQ0FBQ0MsRUFBZ0JDLEVBQVdDLEVBQW9CQyxJQUFtQixDQUNqRyxNQUFNQyxFQUFvQkgsRUFBSyxLQUFLRCxFQUFFLGtCQUFtQixDQUNyRCxPQUFRLENBQUUsTUFBT0csQ0FBQSxDQUFPLENBQzNCLEVBRUQsR0FBSUMsRUFBa0IsS0FBQSxFQUFTLEVBQUcsQ0FDOUIsTUFBTUMsRUFBYUQsRUFBa0IsSUFBSSxDQUFDLEVBQUUsS0FBSyxXQUN6QkMsRUFBVyxLQUM5QkMsR0FBbUJBLEVBQVUsT0FBUyxtQkFBcUJBLEVBQVUsU0FBUyxPQUFTSixDQUFBLEdBSXhGRyxFQUFXLEtBQUtMLEVBQUUsZ0JBQWdCQSxFQUFFLFdBQVdFLENBQVUsQ0FBQyxDQUFDLENBRW5FLEtBQU8sQ0FDSCxNQUFNSyxFQUFZUCxFQUFFLGtCQUFrQixDQUFDQSxFQUFFLGdCQUFnQkEsRUFBRSxXQUFXRSxDQUFVLENBQUMsQ0FBQyxFQUFHRixFQUFFLFFBQVFHLENBQU0sQ0FBQyxFQUN0R0YsRUFBSyxNQUFNLEtBQUssUUFBUSxLQUFLLFFBQVFNLENBQVMsQ0FDbEQsQ0FDSiJ9
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
*-------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
-
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
-
*-------------------------------------------------------------------------------------------
|
|
7
|
-
*/
|
|
8
1
|
"use strict";const a=require("../utils.js");function p(o,c){const n=c.jscodeshift,t=n(o.source);if(!(o.path.endsWith(".ts")||o.path.endsWith(".tsx")))return t.toSource();let r=!1;const i=e=>{e&&e.type==="Identifier"&&e.name==="Dialog"&&(e.name="DialogHandle",r=!0)};return t.find(n.TSTypeReference).forEach(e=>{const{typeName:s}=e.node;i(s)}),t.find(n.TSAsExpression).forEach(e=>{const{typeAnnotation:s}=e.node;s&&s.type==="TSTypeReference"&&i(s.typeName)}),r&&a.ensureImportExists(n,t,"DialogHandle","@progress/kendo-react-dialogs"),t.toSource()}module.exports=p;
|
|
9
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLWhhbmRsZS5qcyIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvZGlhbG9ncy9jb2RlbW9kcy92MTEvZGlhbG9nLWhhbmRsZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBUEksIEZpbGVJbmZvLCBKU0NvZGVzaGlmdCB9IGZyb20gJ2pzY29kZXNoaWZ0JztcbmltcG9ydCB7IGVuc3VyZUltcG9ydEV4aXN0cyB9IGZyb20gJy4uL3V0aWxzJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gKGZpbGVJbmZvOiBGaWxlSW5mbywgYXBpOiBBUEkpIHtcbiAgICBjb25zdCBqOiBKU0NvZGVzaGlmdCA9IGFwaS5qc2NvZGVzaGlmdDtcbiAgICBjb25zdCByb290ID0gaihmaWxlSW5mby5zb3VyY2UpO1xuXG4gICAgY29uc3QgaXNUeXBlU2NyaXB0ID0gZmlsZUluZm8ucGF0aC5lbmRzV2l0aCgnLnRzJykgfHwgZmlsZUluZm8ucGF0aC5lbmRzV2l0aCgnLnRzeCcpO1xuICAgIGlmICghaXNUeXBlU2NyaXB0KSB7XG4gICAgICAgIHJldHVybiByb290LnRvU291cmNlKCk7XG4gICAgfVxuXG4gICAgbGV0IGhhc0NoYW5nZXMgPSBmYWxzZTtcblxuICAgIGNvbnN0IHJlcGxhY2VUeXBlTmFtZSA9ICh0eXBlTmFtZTogYW55KSA9PiB7XG4gICAgICAgIGlmICh0eXBlTmFtZSAmJiB0eXBlTmFtZS50eXBlID09PSAnSWRlbnRpZmllcicgJiYgdHlwZU5hbWUubmFtZSA9PT0gJ0RpYWxvZycpIHtcbiAgICAgICAgICAgIHR5cGVOYW1lLm5hbWUgPSAnRGlhbG9nSGFuZGxlJztcbiAgICAgICAgICAgIGhhc0NoYW5nZXMgPSB0cnVlO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIHJvb3QuZmluZChqLlRTVHlwZVJlZmVyZW5jZSkuZm9yRWFjaCgocGF0aCkgPT4ge1xuICAgICAgICBjb25zdCB7IHR5cGVOYW1lIH0gPSBwYXRoLm5vZGU7XG4gICAgICAgIHJlcGxhY2VUeXBlTmFtZSh0eXBlTmFtZSk7XG4gICAgfSk7XG5cbiAgICByb290LmZpbmQoai5UU0FzRXhwcmVzc2lvbikuZm9yRWFjaCgocGF0aCkgPT4ge1xuICAgICAgICBjb25zdCB7IHR5cGVBbm5vdGF0aW9uIH0gPSBwYXRoLm5vZGU7XG4gICAgICAgIGlmICh0eXBlQW5ub3RhdGlvbiAmJiB0eXBlQW5ub3RhdGlvbi50eXBlID09PSAnVFNUeXBlUmVmZXJlbmNlJykge1xuICAgICAgICAgICAgcmVwbGFjZVR5cGVOYW1lKHR5cGVBbm5vdGF0aW9uLnR5cGVOYW1lKTtcbiAgICAgICAgfVxuICAgIH0pO1xuXG4gICAgaWYgKGhhc0NoYW5nZXMpIHtcbiAgICAgICAgZW5zdXJlSW1wb3J0RXhpc3RzKGosIHJvb3QsICdEaWFsb2dIYW5kbGUnLCAnQHByb2dyZXNzL2tlbmRvLXJlYWN0LWRpYWxvZ3MnKTtcbiAgICB9XG5cbiAgICByZXR1cm4gcm9vdC50b1NvdXJjZSgpO1xufVxuIl0sIm5hbWVzIjpbImRpYWxvZ0hhbmRsZSIsImZpbGVJbmZvIiwiYXBpIiwiaiIsInJvb3QiLCJoYXNDaGFuZ2VzIiwicmVwbGFjZVR5cGVOYW1lIiwidHlwZU5hbWUiLCJwYXRoIiwidHlwZUFubm90YXRpb24iLCJlbnN1cmVJbXBvcnRFeGlzdHMiXSwibWFwcGluZ3MiOiI0Q0FHQSxTQUFBQSxFQUF5QkMsRUFBb0JDLEVBQVUsQ0FDbkQsTUFBTUMsRUFBaUJELEVBQUksWUFDckJFLEVBQU9ELEVBQUVGLEVBQVMsTUFBTSxFQUc5QixHQUFJLEVBRGlCQSxFQUFTLEtBQUssU0FBUyxLQUFLLEdBQUtBLEVBQVMsS0FBSyxTQUFTLE1BQU0sR0FFL0UsT0FBT0csRUFBSyxTQUFBLEVBR2hCLElBQUlDLEVBQWEsR0FFakIsTUFBTUMsRUFBbUJDLEdBQWtCLENBQ25DQSxHQUFZQSxFQUFTLE9BQVMsY0FBZ0JBLEVBQVMsT0FBUyxXQUNoRUEsRUFBUyxLQUFPLGVBQ2hCRixFQUFhLEdBRXJCLEVBRUEsT0FBQUQsRUFBSyxLQUFLRCxFQUFFLGVBQWUsRUFBRSxRQUFTSyxHQUFTLENBQzNDLEtBQU0sQ0FBRSxTQUFBRCxHQUFhQyxFQUFLLEtBQzFCRixFQUFnQkMsQ0FBUSxDQUM1QixDQUFDLEVBRURILEVBQUssS0FBS0QsRUFBRSxjQUFjLEVBQUUsUUFBU0ssR0FBUyxDQUMxQyxLQUFNLENBQUUsZUFBQUMsR0FBbUJELEVBQUssS0FDNUJDLEdBQWtCQSxFQUFlLE9BQVMsbUJBQzFDSCxFQUFnQkcsRUFBZSxRQUFRLENBRS9DLENBQUMsRUFFR0osR0FDQUssRUFBQUEsbUJBQW1CUCxFQUFHQyxFQUFNLGVBQWdCLCtCQUErQixFQUd4RUEsRUFBSyxTQUFBLENBQ2hCIn0=
|
package/constants.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
/** @hidden */
|
|
9
|
+
export declare const DATA_DIALOGS_ID = "data-windowid";
|
|
10
|
+
/** @hidden */
|
|
11
|
+
export declare const DEFAULT_DIALOGS_ZINDEX = 10002;
|
|
12
|
+
/** @hidden */
|
|
13
|
+
export declare const ZINDEX_DIALOGS_STEP = 2;
|
|
14
|
+
/** @hidden */
|
|
15
|
+
export declare const DIALOGS_SELECTOR = ".k-window:not(.k-dialog), .k-dialog-wrapper";
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-common","@progress/kendo-react-intl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactDialogs={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactButtons,t.KendoSvgIcons,t.KendoReactCommon,t.KendoReactIntl)}(this,(function(t,e,i,o,s,n,a,r){"use strict";function l(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var h=l(e),d=l(i);const p=({children:t,onCloseButtonClick:e,id:i,closeIcon:o})=>h.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:i},h.createElement("span",{className:"k-window-title k-dialog-title"},t),o&&h.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},h.createElement(s.Button,{role:"button","aria-label":"Close",onClick:e,icon:"x",svgIcon:n.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),c=t=>{const e={layout:"stretched",...t},{layout:i,children:o}=e,s=a.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${i}`]:i});return h.createElement("div",{className:s},o)};c.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const u="data-windowid",g=10002,w=a.createPropsContext(),m=h.forwardRef(((t,e)=>{const i=a.useZIndexContext(),o=i?i+2:g,s=h.useRef(null),n=h.useRef(null),r=h.useRef(a.getActiveElement(document)),l=a.usePropsContext(w,t),m=h.useMemo((()=>({...f,...l})),[l]),{title:E,width:C,height:v,children:S,minWidth:y,dir:b,style:k,themeColor:I,contentStyle:D,autoFocusedElement:T,appendTo:B,className:L,overlayStyle:x,modal:M=f.modal,closeIcon:N=f.closeIcon,autoFocus:R=f.autoFocus}=m,F=h.useCallback((()=>({props:m,element:n.current})),[m]);h.useImperativeHandle(s,F),h.useImperativeHandle(e,(()=>s.current));const z=h.useMemo((()=>h.Children.toArray(S).filter((t=>!h.isValidElement(t)||t.type!==c))),[S]),W=h.useMemo((()=>h.Children.toArray(S).filter((t=>h.isValidElement(t)&&t.type===c))),[S]),{_id:A,contentId:U,id:O}=h.useMemo((()=>{const t=m.id,e=`${null!=t?t:"accessibility"}-id`;return{_id:e,contentId:`dialog-content-${e}`,id:t||`dialog-title-${e}`}}),[m.id]),K=h.useCallback((()=>{if(n.current)if(R&&!T)n.current.focus();else if(!R&&T&&n.current){const t=n.current.querySelector(T);null==t||t.focus()}else{const t=[...a.FOCUSABLE_ELEMENTS].map((t=>t+":not(.k-dialog-titlebar *)"));a.focusFirstFocusableChild(n.current,t)}}),[R,T]);h.useEffect((()=>(K(),()=>{setTimeout((()=>{var t;!n.current&&r.current&&a.canUseDOM&&(document.contains(r.current)?r.current.focus():r.current.id&&(null==(t=document.getElementById(r.current.id))||t.focus()))}))})),[K]);const H=h.useCallback((t=>{t.preventDefault(),a.dispatchEvent(m.onClose,t,F(),void 0)}),[m.onClose]),Z=h.useCallback((t=>{t.keyCode===a.Keys.esc&&m.onClose&&(t.preventDefault(),H(t)),a.keepFocusInContainer(t,n.current)}),[m.onClose,H]),P=h.useMemo((()=>h.createElement(a.ZIndexContext.Provider,{value:o},h.createElement("div",{ref:n,[u]:A,className:"k-dialog-wrapper"+(L?" "+L:""),onKeyDown:Z,tabIndex:0,dir:b,style:{zIndex:o,...k}},M&&h.createElement("div",{className:"k-overlay",style:x}),h.createElement("div",{className:a.classNames("k-window k-dialog",{[`k-window-${I}`]:I}),role:"dialog","aria-labelledby":O,"aria-modal":!0,"aria-describedby":U,style:{width:C,height:v,minWidth:y}},E&&h.createElement(p,{closeIcon:N,onCloseButtonClick:H,id:O},E),h.createElement("div",{className:"k-window-content k-dialog-content",style:D,id:U},z),W)))),[o,A,L,Z,k,b,x,I,O,U,C,v,y,N,H,D,E,z,W,M]);return a.canUseDOM?null!==B?d.createPortal(P,B||document.body):P:null})),f={autoFocus:!1,modal:!0,closeIcon:!0},E={autoFocus:o.bool,autoFocusedElement:o.string,title:o.any,className:o.string,closeIcon:o.bool,modal:o.bool,overlayStyle:o.object,width:o.oneOfType([o.number,o.string]),height:o.oneOfType([o.number,o.string]),minWidth:o.oneOfType([o.number,o.string]),onClose:o.func,children:o.node,id:o.string,dir:o.string,style:o.object,contentStyle:o.object,appendTo:o.any,themeColor:o.oneOf(["primary","dark","light"])};m.displayName="KendoReactDialog",m.propTypes=E;var C=(t=>(t.DEFAULT="DEFAULT",t.FULLSCREEN="FULLSCREEN",t.MINIMIZED="MINIMIZED",t))(C||{});const v="dialogs.windowMaximizeButton",S="dialogs.windowMinimizeButton",y="dialogs.windowRestoreButton",b="dialogs.windowCloseButton",k={[v]:"maximize",[S]:"minimize",[y]:"restore",[b]:"close"},I=t=>{const{children:e,onCloseButtonClick:i,onMinimizeButtonClick:o,onFullScreenButtonClick:a,onRestoreButtonClick:l,onDoubleClick:d,stage:p,forwardedRef:c,id:u}=t,g=r.useLocalization(),w=t.minimizeButton?h.createElement(t.minimizeButton,{onClick:o,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:n.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:o,"aria-label":g.toLanguageString(S,k[S])}),m=t.maximizeButton?h.createElement(t.maximizeButton,{onClick:a,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:n.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":g.toLanguageString(v,k[v])}),f=t.restoreButton?h.createElement(t.restoreButton,{onClick:l,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"window-restore",svgIcon:n.windowRestoreIcon,className:"k-window-titlebar-action",onClick:l,"aria-label":g.toLanguageString(y,k[y])}),E=t.closeButton?h.createElement(t.closeButton,{onClick:i,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"x",svgIcon:n.xIcon,className:"k-window-titlebar-action",onClick:i,"aria-label":g.toLanguageString(b,k[b])});return h.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:c,onDoubleClick:d},h.createElement("span",{className:"k-window-title",id:u},e||""),h.createElement("div",{className:"k-window-titlebar-actions"},p===C.DEFAULT&&w,p===C.DEFAULT&&m,p!==C.DEFAULT&&f,E))},D=h.forwardRef(((t,e)=>h.createElement(I,{...t,forwardedRef:e}))),T=["n","e","s","w","se","sw","ne","nw"];class B extends h.Component{render(){return h.createElement("div",{className:"k-resize-handles-wrapper"}," ",T.map(((t,e)=>h.createElement(a.Draggable,{key:e,onDrag:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!1,direction:t})},onRelease:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!0,direction:t})}},h.createElement("div",{className:"k-resize-handle k-resize-"+t,style:{display:"block",touchAction:"none",userSelect:"none"}})))))}}class L extends h.Component{shouldComponentUpdate(t){return t.shouldUpdateOnDrag||!t.isDragging}render(){return this.props.children}}const x=t=>{const e={layout:"end",...t},{layout:i,children:o}=e,s=a.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":"start"===i,"k-justify-content-center":"center"===i,"k-justify-content-end":"end"===i,"k-justify-content-stretch":"stretched"===i});return h.createElement("div",{className:s},o)};x.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const M=(t,e,i)=>{let o=t;if(e&&e.defaultView){const t=e.querySelectorAll(".k-window:not(.k-dialog), .k-dialog-wrapper");let s=!1;return t.forEach((t=>{const n=e.defaultView.getComputedStyle(t,null);if(t.getAttribute(u)!==i&&null!==n.zIndex){const t=parseInt(n.zIndex,10);t>=o&&(o=t,s=!0)}})),s?o+2:o}return o},N=class extends h.Component{constructor(t){super(t),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.activeElement=null,this.onKeyDown=t=>{var e,i,o;if(this.props.modal&&a.keepFocusInContainer(t,this.element),t.target!==t.currentTarget)return;const s=this.props.minWidth||120,n=this.props.minHeight||100,r=t.metaKey||t.ctrlKey,l=null!=(o=null!=(i=this.height)?i:null==(e=this.windowElement)?void 0:e.clientHeight)?o:0;if(r&&this.props.resizable){switch(t.keyCode){case a.Keys.up:t.preventDefault(),n<=l-5&&this.setState({height:l-5});break;case a.Keys.down:t.preventDefault(),this.setState({height:l+5});break;case a.Keys.left:s<=this.width-5&&this.setState({width:this.width-5});break;case a.Keys.right:this.setState({width:this.width+5});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0)}else if(t.altKey)switch(t.keyCode){case a.Keys.up:this.windowStage===C.MINIMIZED?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.DEFAULT})):this.windowStage===C.DEFAULT&&(this.handleFullscreen(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.FULLSCREEN}));break;case a.Keys.down:this.windowStage===C.FULLSCREEN?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.DEFAULT})):this.windowStage===C.DEFAULT&&(this.handleMinimize(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.MINIMIZED}))}else{if(!t.ctrlKey)switch(t.keyCode){case a.Keys.esc:return void(this.props.onClose&&this.handleCloseWindow(t));case a.Keys.up:this.setState((t=>({top:t.top-5})));break;case a.Keys.down:this.setState((t=>({top:t.top+5})));break;case a.Keys.left:this.setState((t=>({left:t.left-5})));break;case a.Keys.right:this.setState((t=>({left:t.left+5})));break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)}},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==C.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==C.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:M(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout((()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0})))},this.getInitialTop=()=>{var t,e;if(void 0!==this.props.top)return this.props.top;if(void 0!==this.props.initialTop)return this.props.initialTop;let i=300;if(void 0!==this.props.height?i=this.props.height:void 0!==this.props.initialHeight&&(i=this.props.initialHeight),this.props.appendTo&&i)return this.props.appendTo.offsetHeight/2-i/2;const o=this.getWindow();return o?o.innerHeight/2-(null!=(e=null!=i?i:null==(t=this.windowElement)?void 0:t.clientHeight)?e:0)/2:0},this.getInitialLeft=()=>{if(void 0!==this.props.left)return this.props.left;if(void 0!==this.props.initialLeft)return this.props.initialLeft;let t=300;if(void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=300;return void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=300;return void 0!==this.props.height?t=this.props.height:void 0!==this.props.initialHeight&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:C.MINIMIZED,height:0}),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),i=e?e.innerWidth:0,o=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:i,height:this.props.appendTo?this.props.appendTo.offsetHeight:o,stage:C.FULLSCREEN}),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===C.FULLSCREEN?this.setState({stage:C.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===C.MINIMIZED&&this.setState({stage:C.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===C.FULLSCREEN||this.windowStage===C.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{var i,o,s;const n=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,a=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,r=this.width,l=null!=(s=null!=(o=this.height)?o:null==(i=this.windowElement)?void 0:i.clientHeight)?s:0,h=this.props.minWidth||120,d=this.props.minHeight||100,p=this.top-a,c=this.left-n,u=n-this.left,g=a-this.top,w=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&d-(l+p)<0&&(this.top>0&&(w.height=l+p),w.top=a),e.direction.indexOf("s")>=0&&d-g<0&&(w.height=g),e.direction.indexOf("w")>=0&&h-(r+c)<0&&(this.left>0&&(w.width=r+c),w.left=n),e.direction.indexOf("e")>=0&&h-u<0&&(w.width=u),this.setState(w),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,i,o)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:i,end:o,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===C.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,i=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:i})}},this.getCurrentZIndex=()=>this.state&&void 0!==this.context?this.state.zIndex>(this.context?this.context+2:0)?this.state.zIndex:this.context+2:this.context?this.context:g,this.getDocument=()=>{const t=a.canUseDOM?document:null;return this.props.appendTo?this.props.appendTo.ownerDocument:t},this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},this.state={stage:this.props.stage||C.DEFAULT,isDragging:!1,top:0,left:0,width:300,height:300,focused:!0,zIndex:g},a.canUseDOM&&(this.activeElement=document.activeElement)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&this.props.autoFocus&&this.element.focus({preventScroll:!0});const t=this.getWindow();t&&t.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||C.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:M(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const e=this.getDocument();if(this.props.appendTo&&e){const t=this.props.appendTo.getBoundingClientRect(),i=e.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-i.left,this.offSetCoordinates.y=t.top-i.top}this.mounted=!0}componentWillUnmount(){const t=this.getWindow();t&&t.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1,setTimeout((()=>{var t;!this.element&&this.activeElement&&a.canUseDOM&&(document.contains(this.activeElement)?this.activeElement.focus({preventScroll:!0}):this.activeElement.id&&(null==(t=document.getElementById(this.activeElement.id))||t.focus({preventScroll:!0})))}))}componentDidUpdate(t){this.props.left&&t.left!==this.props.left&&this.setState({left:this.props.left}),this.props.top&&t.top!==this.props.top&&this.setState({top:this.props.top}),this.props.initialLeft&&t.initialLeft!==this.props.initialLeft&&this.setState({left:this.props.initialLeft}),this.props.initialTop&&t.initialTop!==this.props.initialTop&&this.setState({top:this.props.initialTop});const e=this.getDocument();if(this.props.appendTo&&e){const t=this.props.appendTo.getBoundingClientRect(),i=e.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-i.left,this.offSetCoordinates.y=t.top-i.top}this.mounted=!0}render(){const t=h.Children.toArray(this.props.children),e=this.getContent(t),i=this.getActionBar(t),o=this.getCurrentZIndex(),s=a.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":"MINIMIZED"===this.state.stage,"k-focus":this.state.focused}),n=h.createElement(a.ZIndexContext.Provider,{value:o},h.createElement(h.Fragment,null,this.props.modal&&h.createElement("div",{className:"k-overlay",style:{zIndex:o,...this.props.overlayStyle}}),h.createElement("div",{id:this.props.id,[u]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:t=>{this.windowElement=t,this.element=t},className:s,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:o,...this.props.style}},h.createElement(L,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},h.createElement(a.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,autoScroll:!1,ref:t=>{this.draggable=t}},h.createElement(D,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==C.MINIMIZED?h.createElement(h.Fragment,null,h.createElement("div",{className:"k-window-content"},e),i):null,this.windowStage===C.DEFAULT&&this.props.resizable?h.createElement(B,{onResize:this.handleResize}):null))));return a.canUseDOM?null!==this.props.appendTo?d.createPortal(n,this.props.appendTo||document.body):n:null}get top(){return this.windowStage!==C.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==C.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let t=this.props.width||this.state.width;if(this.windowStage===C.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetWidth,t;const e=this.getWindow();t=e?e.innerWidth:0}return t}get height(){let t=this.props.height||this.state.height;if(this.windowStage===C.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetHeight,t;const e=this.getWindow();t=e?e.innerHeight:0}else this.windowStage===C.MINIMIZED&&(t=0);return t}get windowStage(){return this.props.stage||this.state.stage}getActionBar(t){return t.filter((t=>t&&t.type===x))}getContent(t){return t.filter((t=>t&&t.type!==x))}generateTitleId(){return"window-title-"+this._id}};N.displayName="Window",N.propTypes={width:o.number,height:o.number,left:o.number,top:o.number,initialWidth:o.number,initialHeight:o.number,initialLeft:o.number,initialTop:o.number,minWidth:o.number,minHeight:o.number,resizable:o.bool,draggable:o.bool,title:o.any,shouldUpdateOnDrag:o.bool,stage:o.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:o.string,id:o.string,style:o.object,overlayStyle:o.object,autoFocus:o.bool},N.defaultProps={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},N.contextType=a.ZIndexContext;let R=N;const F=a.createPropsContext(),z=a.withIdHOC(a.withPropsContext(F,R));z.displayName="KendoReactWindow",t.Dialog=m,t.DialogActionsBar=c,t.DialogPropsContext=w,t.Window=z,t.WindowActionsBar=x,t.WindowPropsContext=F,t.WindowWithoutContext=R}));
|
|
15
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-common","@progress/kendo-react-intl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactDialogs={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactButtons,t.KendoSvgIcons,t.KendoReactCommon,t.KendoReactIntl)}(this,function(t,e,i,o,s,n,a,r){"use strict";function l(t){var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}var h=l(e),d=l(i);const p=({children:t,onCloseButtonClick:e,id:i,closeIcon:o})=>h.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:i},h.createElement("span",{className:"k-window-title k-dialog-title"},t),o&&h.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},h.createElement(s.Button,{role:"button","aria-label":"Close",onClick:e,icon:"x",svgIcon:n.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),c=t=>{const e={layout:"stretched",...t},{layout:i,children:o}=e,s=a.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${i}`]:i});return h.createElement("div",{className:s},o)};c.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const u="data-windowid",g=10002,w=a.createPropsContext(),m=h.forwardRef((t,e)=>{const i=a.useZIndexContext(),o=i?i+2:g,s=h.useRef(null),n=h.useRef(null),r=h.useRef(a.getActiveElement(document)),l=a.usePropsContext(w,t),m=h.useMemo(()=>({...f,...l}),[l]),{title:E,width:C,height:v,children:S,minWidth:y,dir:b,style:k,themeColor:I,contentStyle:D,autoFocusedElement:T,appendTo:B,className:L,overlayStyle:x,modal:M=f.modal,closeIcon:N=f.closeIcon,autoFocus:R=f.autoFocus}=m,F=h.useCallback(()=>({props:m,element:n.current}),[m]);h.useImperativeHandle(s,F),h.useImperativeHandle(e,()=>s.current);const z=h.useMemo(()=>h.Children.toArray(S).filter(t=>!h.isValidElement(t)||t.type!==c),[S]),W=h.useMemo(()=>h.Children.toArray(S).filter(t=>h.isValidElement(t)&&t.type===c),[S]),{_id:A,contentId:U,id:O}=h.useMemo(()=>{const t=m.id,e=`${null!=t?t:"accessibility"}-id`;return{_id:e,contentId:`dialog-content-${e}`,id:t||`dialog-title-${e}`}},[m.id]),K=h.useCallback(()=>{if(n.current)if(R&&!T)n.current.focus();else if(!R&&T&&n.current){const t=n.current.querySelector(T);null==t||t.focus()}else{const t=[...a.FOCUSABLE_ELEMENTS].map(t=>t+":not(.k-dialog-titlebar *)");a.focusFirstFocusableChild(n.current,t)}},[R,T]);h.useEffect(()=>(K(),()=>{setTimeout(()=>{var t;!n.current&&r.current&&a.canUseDOM&&(document.contains(r.current)?r.current.focus():r.current.id&&(null==(t=document.getElementById(r.current.id))||t.focus()))})}),[K]);const H=h.useCallback(t=>{t.preventDefault(),a.dispatchEvent(m.onClose,t,F(),void 0)},[m.onClose]),Z=h.useCallback(t=>{t.keyCode===a.Keys.esc&&m.onClose&&(t.preventDefault(),H(t)),a.keepFocusInContainer(t,n.current)},[m.onClose,H]),P=h.useMemo(()=>h.createElement(a.ZIndexContext.Provider,{value:o},h.createElement("div",{ref:n,[u]:A,className:"k-dialog-wrapper"+(L?" "+L:""),onKeyDown:Z,tabIndex:0,dir:b,style:{zIndex:o,...k}},M&&h.createElement("div",{className:"k-overlay",style:x}),h.createElement("div",{className:a.classNames("k-window k-dialog",{[`k-window-${I}`]:I}),role:"dialog","aria-labelledby":O,"aria-modal":!0,"aria-describedby":U,style:{width:C,height:v,minWidth:y}},E&&h.createElement(p,{closeIcon:N,onCloseButtonClick:H,id:O},E),h.createElement("div",{className:"k-window-content k-dialog-content",style:D,id:U},z),W))),[o,A,L,Z,k,b,x,I,O,U,C,v,y,N,H,D,E,z,W,M]);return a.canUseDOM?null!==B?d.createPortal(P,B||document.body):P:null}),f={autoFocus:!1,modal:!0,closeIcon:!0},E={autoFocus:o.bool,autoFocusedElement:o.string,title:o.any,className:o.string,closeIcon:o.bool,modal:o.bool,overlayStyle:o.object,width:o.oneOfType([o.number,o.string]),height:o.oneOfType([o.number,o.string]),minWidth:o.oneOfType([o.number,o.string]),onClose:o.func,children:o.node,id:o.string,dir:o.string,style:o.object,contentStyle:o.object,appendTo:o.any,themeColor:o.oneOf(["primary","dark","light"])};m.displayName="KendoReactDialog",m.propTypes=E;var C=(t=>(t.DEFAULT="DEFAULT",t.FULLSCREEN="FULLSCREEN",t.MINIMIZED="MINIMIZED",t))(C||{});const v="dialogs.windowMaximizeButton",S="dialogs.windowMinimizeButton",y="dialogs.windowRestoreButton",b="dialogs.windowCloseButton",k={[v]:"maximize",[S]:"minimize",[y]:"restore",[b]:"close"},I=t=>{const{children:e,onCloseButtonClick:i,onMinimizeButtonClick:o,onFullScreenButtonClick:a,onRestoreButtonClick:l,onDoubleClick:d,stage:p,forwardedRef:c,id:u}=t,g=r.useLocalization(),w=t.minimizeButton?h.createElement(t.minimizeButton,{onClick:o,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:n.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:o,"aria-label":g.toLanguageString(S,k[S])}),m=t.maximizeButton?h.createElement(t.maximizeButton,{onClick:a,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:n.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":g.toLanguageString(v,k[v])}),f=t.restoreButton?h.createElement(t.restoreButton,{onClick:l,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"window-restore",svgIcon:n.windowRestoreIcon,className:"k-window-titlebar-action",onClick:l,"aria-label":g.toLanguageString(y,k[y])}),E=t.closeButton?h.createElement(t.closeButton,{onClick:i,stage:p}):h.createElement(s.Button,{fillMode:"flat",icon:"x",svgIcon:n.xIcon,className:"k-window-titlebar-action",onClick:i,"aria-label":g.toLanguageString(b,k[b])});return h.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:c,onDoubleClick:d},h.createElement("span",{className:"k-window-title",id:u},e||""),h.createElement("div",{className:"k-window-titlebar-actions"},p===C.DEFAULT&&w,p===C.DEFAULT&&m,p!==C.DEFAULT&&f,E))},D=h.forwardRef((t,e)=>h.createElement(I,{...t,forwardedRef:e})),T=["n","e","s","w","se","sw","ne","nw"];class B extends h.Component{render(){return h.createElement("div",{className:"k-resize-handles-wrapper"}," ",T.map((t,e)=>h.createElement(a.Draggable,{key:e,onDrag:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!1,direction:t})},onRelease:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!0,direction:t})}},h.createElement("div",{className:"k-resize-handle k-resize-"+t,style:{display:"block",touchAction:"none",userSelect:"none"}}))))}}class L extends h.Component{shouldComponentUpdate(t){return t.shouldUpdateOnDrag||!t.isDragging}render(){return this.props.children}}const x=t=>{const e={layout:"end",...t},{layout:i,children:o}=e,s=a.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":"start"===i,"k-justify-content-center":"center"===i,"k-justify-content-end":"end"===i,"k-justify-content-stretch":"stretched"===i});return h.createElement("div",{className:s},o)};x.propTypes={children:o.any,layout:o.oneOf(["start","center","end","stretched"])};const M=(t,e,i)=>{let o=t;if(e&&e.defaultView){const t=e.querySelectorAll(".k-window:not(.k-dialog), .k-dialog-wrapper");let s=!1;return t.forEach(t=>{const n=e.defaultView.getComputedStyle(t,null);if(t.getAttribute(u)!==i&&null!==n.zIndex){const t=parseInt(n.zIndex,10);t>=o&&(o=t,s=!0)}}),s?o+2:o}return o},N=class extends h.Component{constructor(t){super(t),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.activeElement=null,this.onKeyDown=t=>{var e,i,o;if(this.props.modal&&a.keepFocusInContainer(t,this.element),t.target!==t.currentTarget)return;const s=this.props.minWidth||120,n=this.props.minHeight||100,r=t.metaKey||t.ctrlKey,l=null!=(o=null!=(i=this.height)?i:null==(e=this.windowElement)?void 0:e.clientHeight)?o:0;if(r&&this.props.resizable){switch(t.keyCode){case a.Keys.up:t.preventDefault(),n<=l-5&&this.setState({height:l-5});break;case a.Keys.down:t.preventDefault(),this.setState({height:l+5});break;case a.Keys.left:s<=this.width-5&&this.setState({width:this.width-5});break;case a.Keys.right:this.setState({width:this.width+5});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0)}else if(t.altKey)switch(t.keyCode){case a.Keys.up:this.windowStage===C.MINIMIZED?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.DEFAULT})):this.windowStage===C.DEFAULT&&(this.handleFullscreen(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.FULLSCREEN}));break;case a.Keys.down:this.windowStage===C.FULLSCREEN?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.DEFAULT})):this.windowStage===C.DEFAULT&&(this.handleMinimize(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.MINIMIZED}))}else{if(!t.ctrlKey)switch(t.keyCode){case a.Keys.esc:return void(this.props.onClose&&this.handleCloseWindow(t));case a.Keys.up:this.setState(t=>({top:t.top-5}));break;case a.Keys.down:this.setState(t=>({top:t.top+5}));break;case a.Keys.left:this.setState(t=>({left:t.left-5}));break;case a.Keys.right:this.setState(t=>({left:t.left+5}));break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)}},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==C.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==C.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:M(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout(()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0}))},this.getInitialTop=()=>{var t,e;if(void 0!==this.props.top)return this.props.top;if(void 0!==this.props.initialTop)return this.props.initialTop;let i=300;if(void 0!==this.props.height?i=this.props.height:void 0!==this.props.initialHeight&&(i=this.props.initialHeight),this.props.appendTo&&i)return this.props.appendTo.offsetHeight/2-i/2;const o=this.getWindow();return o?o.innerHeight/2-(null!=(e=null!=i?i:null==(t=this.windowElement)?void 0:t.clientHeight)?e:0)/2:0},this.getInitialLeft=()=>{if(void 0!==this.props.left)return this.props.left;if(void 0!==this.props.initialLeft)return this.props.initialLeft;let t=300;if(void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=300;return void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=300;return void 0!==this.props.height?t=this.props.height:void 0!==this.props.initialHeight&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:C.MINIMIZED,height:0}),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),i=e?e.innerWidth:0,o=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:i,height:this.props.appendTo?this.props.appendTo.offsetHeight:o,stage:C.FULLSCREEN}),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===C.FULLSCREEN?this.setState({stage:C.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===C.MINIMIZED&&this.setState({stage:C.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),a.dispatchEvent(this.props.onStageChange,t,this,{state:C.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===C.FULLSCREEN||this.windowStage===C.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{var i,o,s;const n=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,a=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,r=this.width,l=null!=(s=null!=(o=this.height)?o:null==(i=this.windowElement)?void 0:i.clientHeight)?s:0,h=this.props.minWidth||120,d=this.props.minHeight||100,p=this.top-a,c=this.left-n,u=n-this.left,g=a-this.top,w=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&d-(l+p)<0&&(this.top>0&&(w.height=l+p),w.top=a),e.direction.indexOf("s")>=0&&d-g<0&&(w.height=g),e.direction.indexOf("w")>=0&&h-(r+c)<0&&(this.left>0&&(w.width=r+c),w.left=n),e.direction.indexOf("e")>=0&&h-u<0&&(w.width=u),this.setState(w),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,i,o)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:i,end:o,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===C.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,i=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:i})}},this.getCurrentZIndex=()=>this.state&&void 0!==this.context?this.state.zIndex>(this.context?this.context+2:0)?this.state.zIndex:this.context+2:this.context?this.context:g,this.getDocument=()=>{const t=a.canUseDOM?document:null;return this.props.appendTo?this.props.appendTo.ownerDocument:t},this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},this.state={stage:this.props.stage||C.DEFAULT,isDragging:!1,top:0,left:0,width:300,height:300,focused:!0,zIndex:g},a.canUseDOM&&(this.activeElement=document.activeElement)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&this.props.autoFocus&&this.element.focus({preventScroll:!0});const t=this.getWindow();t&&t.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||C.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:M(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const e=this.getDocument();if(this.props.appendTo&&e){const t=this.props.appendTo.getBoundingClientRect(),i=e.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-i.left,this.offSetCoordinates.y=t.top-i.top}this.mounted=!0}componentWillUnmount(){const t=this.getWindow();t&&t.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1,setTimeout(()=>{var t;!this.element&&this.activeElement&&a.canUseDOM&&(document.contains(this.activeElement)?this.activeElement.focus({preventScroll:!0}):this.activeElement.id&&(null==(t=document.getElementById(this.activeElement.id))||t.focus({preventScroll:!0})))})}componentDidUpdate(t){this.props.left&&t.left!==this.props.left&&this.setState({left:this.props.left}),this.props.top&&t.top!==this.props.top&&this.setState({top:this.props.top}),this.props.initialLeft&&t.initialLeft!==this.props.initialLeft&&this.setState({left:this.props.initialLeft}),this.props.initialTop&&t.initialTop!==this.props.initialTop&&this.setState({top:this.props.initialTop});const e=this.getDocument();if(this.props.appendTo&&e){const t=this.props.appendTo.getBoundingClientRect(),i=e.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-i.left,this.offSetCoordinates.y=t.top-i.top}this.mounted=!0}render(){const t=h.Children.toArray(this.props.children),e=this.getContent(t),i=this.getActionBar(t),o=this.getCurrentZIndex(),s=a.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":"MINIMIZED"===this.state.stage,"k-focus":this.state.focused}),n=h.createElement(a.ZIndexContext.Provider,{value:o},h.createElement(h.Fragment,null,this.props.modal&&h.createElement("div",{className:"k-overlay",style:{zIndex:o,...this.props.overlayStyle}}),h.createElement("div",{id:this.props.id,[u]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:t=>{this.windowElement=t,this.element=t},className:s,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:o,...this.props.style}},h.createElement(L,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},h.createElement(a.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,autoScroll:!1,ref:t=>{this.draggable=t}},h.createElement(D,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==C.MINIMIZED?h.createElement(h.Fragment,null,h.createElement("div",{className:"k-window-content"},e),i):null,this.windowStage===C.DEFAULT&&this.props.resizable?h.createElement(B,{onResize:this.handleResize}):null))));return a.canUseDOM?null!==this.props.appendTo?d.createPortal(n,this.props.appendTo||document.body):n:null}get top(){return this.windowStage!==C.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==C.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let t=this.props.width||this.state.width;if(this.windowStage===C.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetWidth,t;const e=this.getWindow();t=e?e.innerWidth:0}return t}get height(){let t=this.props.height||this.state.height;if(this.windowStage===C.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetHeight,t;const e=this.getWindow();t=e?e.innerHeight:0}else this.windowStage===C.MINIMIZED&&(t=0);return t}get windowStage(){return this.props.stage||this.state.stage}getActionBar(t){return t.filter(t=>t&&t.type===x)}getContent(t){return t.filter(t=>t&&t.type!==x)}generateTitleId(){return"window-title-"+this._id}};N.displayName="Window",N.propTypes={width:o.number,height:o.number,left:o.number,top:o.number,initialWidth:o.number,initialHeight:o.number,initialLeft:o.number,initialTop:o.number,minWidth:o.number,minHeight:o.number,resizable:o.bool,draggable:o.bool,title:o.any,shouldUpdateOnDrag:o.bool,stage:o.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:o.string,id:o.string,style:o.object,overlayStyle:o.object,autoFocus:o.bool},N.defaultProps={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0,autoFocus:!0},N.contextType=a.ZIndexContext;let R=N;const F=a.createPropsContext(),z=a.withIdHOC(a.withPropsContext(F,R));z.displayName="KendoReactWindow",t.Dialog=m,t.DialogActionsBar=c,t.DialogPropsContext=w,t.Window=z,t.WindowActionsBar=x,t.WindowPropsContext=F,t.WindowWithoutContext=R});
|
package/events.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { DialogHandle } from './Dialog.js';
|
|
9
|
+
import { BaseEvent } from '@progress/kendo-react-common';
|
|
10
|
+
import { Window } from './Window.js';
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export interface DialogCloseEvent extends BaseEvent<DialogHandle> {
|
|
15
|
+
}
|
|
16
|
+
export interface WindowActionsEvent extends BaseEvent<Window> {
|
|
17
|
+
/**
|
|
18
|
+
* The current stage state of the Window.
|
|
19
|
+
*/
|
|
20
|
+
state?: 'DEFAULT' | 'FULLSCREEN' | 'MINIMIZED';
|
|
21
|
+
}
|
|
22
|
+
export interface WindowMoveEvent {
|
|
23
|
+
/**
|
|
24
|
+
* An event target.
|
|
25
|
+
*/
|
|
26
|
+
target: Window;
|
|
27
|
+
/**
|
|
28
|
+
* A native DOM event.
|
|
29
|
+
*/
|
|
30
|
+
nativeEvent: any;
|
|
31
|
+
/**
|
|
32
|
+
* Indicates that dragging is completed and that the user dropped the resize handler.
|
|
33
|
+
*/
|
|
34
|
+
end: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Indicates that the move operation was initialized through dragging. If the Window is moved through the keyboard, the value will be `false`.
|
|
37
|
+
*/
|
|
38
|
+
drag: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The new top value of the Window.
|
|
41
|
+
*/
|
|
42
|
+
top: number;
|
|
43
|
+
/**
|
|
44
|
+
* The new left value of the Window.
|
|
45
|
+
*/
|
|
46
|
+
left: number;
|
|
47
|
+
/**
|
|
48
|
+
* The new width value of the Window.
|
|
49
|
+
*/
|
|
50
|
+
width: number;
|
|
51
|
+
/**
|
|
52
|
+
* The new height value of the Window.
|
|
53
|
+
*/
|
|
54
|
+
height: number;
|
|
55
|
+
}
|