@progress/kendo-vue-dialogs 3.5.0 → 3.5.1-dev.202208150613
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/dist/cdn/js/kendo-vue-dialogs.js +1 -1
- package/dist/es/WindowProps.js +1 -1
- package/dist/es/events.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/esm/Dialog.d.ts +99 -0
- package/dist/esm/Dialog.js +177 -0
- package/dist/esm/DialogActionsBar.d.ts +33 -0
- package/dist/esm/DialogActionsBar.js +58 -0
- package/dist/esm/DialogTitleBar.d.ts +46 -0
- package/dist/esm/DialogTitleBar.js +82 -0
- package/dist/esm/StageEnum.d.ts +5 -0
- package/dist/esm/StageEnum.js +6 -0
- package/dist/esm/Window.d.ts +75 -0
- package/dist/esm/Window.js +664 -0
- package/dist/esm/WindowProps.d.ts +130 -0
- package/dist/esm/WindowProps.js +1 -0
- package/dist/esm/WindowResizeHandlers.d.ts +30 -0
- package/dist/esm/WindowResizeHandlers.js +92 -0
- package/dist/esm/WindowTitlebar.d.ts +82 -0
- package/dist/esm/WindowTitlebar.js +165 -0
- package/dist/esm/additionalTypes.ts +21 -0
- package/dist/esm/constants.d.ts +2 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/events.d.ts +34 -0
- package/dist/esm/events.js +2 -0
- package/dist/esm/main.d.ts +6 -0
- package/dist/esm/main.js +4 -0
- package/dist/esm/package-metadata.d.ts +5 -0
- package/dist/esm/package-metadata.js +11 -0
- package/dist/esm/package.json +3 -0
- package/dist/npm/Dialog.js +3 -3
- package/dist/npm/DialogActionsBar.js +1 -1
- package/dist/npm/Window.js +3 -3
- package/dist/npm/package-metadata.js +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
}; // @ts-ignore
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import * as Vue from 'vue';
|
|
19
|
+
var allVue = Vue;
|
|
20
|
+
var gh = allVue.h;
|
|
21
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
22
|
+
import { WindowTitleBar } from './WindowTitlebar.js';
|
|
23
|
+
import { Keys, classNames, Draggable, templateDefinition, getDefaultSlots, templateRendering, getListeners, validatePackage } from '@progress/kendo-vue-common';
|
|
24
|
+
import { ResizeHandlers } from './WindowResizeHandlers.js';
|
|
25
|
+
import { windowStage } from './StageEnum.js';
|
|
26
|
+
import { packageMetadata } from './package-metadata.js';
|
|
27
|
+
import { DEFAULT_DIALOGS_ZINDEX } from './constants.js';
|
|
28
|
+
var DEFAULT_WIDTH = 300;
|
|
29
|
+
var DEFAULT_HEIGHT = 300;
|
|
30
|
+
var DEFAULT_MIN_WIDTH = 120;
|
|
31
|
+
var DEFAULT_MIN_HEIGHT = 100;
|
|
32
|
+
var DEFAULT_STEP = 5;
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
var WindowVue2 = {
|
|
38
|
+
name: 'KendoWindow',
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
emits: {
|
|
41
|
+
'resize': null,
|
|
42
|
+
'move': null,
|
|
43
|
+
'close': null,
|
|
44
|
+
'stagechange': null
|
|
45
|
+
},
|
|
46
|
+
provide: function provide() {
|
|
47
|
+
return {
|
|
48
|
+
kCurrentZIndex: DEFAULT_DIALOGS_ZINDEX
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
props: {
|
|
52
|
+
id: String,
|
|
53
|
+
appendTo: String,
|
|
54
|
+
width: {
|
|
55
|
+
type: [Number],
|
|
56
|
+
default: undefined
|
|
57
|
+
},
|
|
58
|
+
height: {
|
|
59
|
+
type: [Number],
|
|
60
|
+
default: undefined
|
|
61
|
+
},
|
|
62
|
+
left: {
|
|
63
|
+
type: [Number],
|
|
64
|
+
default: undefined
|
|
65
|
+
},
|
|
66
|
+
windowStyle: Object,
|
|
67
|
+
windowClass: String,
|
|
68
|
+
top: {
|
|
69
|
+
type: [Number],
|
|
70
|
+
default: undefined
|
|
71
|
+
},
|
|
72
|
+
initialWidth: [Number],
|
|
73
|
+
initialHeight: [Number],
|
|
74
|
+
initialLeft: [Number],
|
|
75
|
+
initialTop: [Number],
|
|
76
|
+
minWidth: {
|
|
77
|
+
type: [Number],
|
|
78
|
+
default: DEFAULT_MIN_WIDTH
|
|
79
|
+
},
|
|
80
|
+
minHeight: {
|
|
81
|
+
type: [Number],
|
|
82
|
+
default: DEFAULT_MIN_HEIGHT
|
|
83
|
+
},
|
|
84
|
+
resizable: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: true
|
|
87
|
+
},
|
|
88
|
+
draggable: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: true
|
|
91
|
+
},
|
|
92
|
+
modal: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: false
|
|
95
|
+
},
|
|
96
|
+
doubleClickStageChange: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: true
|
|
99
|
+
},
|
|
100
|
+
title: String,
|
|
101
|
+
titleRender: templateDefinition,
|
|
102
|
+
closeButton: templateDefinition,
|
|
103
|
+
minimizeButton: templateDefinition,
|
|
104
|
+
maximizeButton: templateDefinition,
|
|
105
|
+
restoreButton: templateDefinition,
|
|
106
|
+
shouldUpdateOnDrag: Boolean,
|
|
107
|
+
stage: {
|
|
108
|
+
type: String,
|
|
109
|
+
validator: function validator(value) {
|
|
110
|
+
return ['DEFAULT', 'MINIMIZED', 'FULLSCREEN'].indexOf(value) !== -1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
setup: !isV3 ? undefined : function () {
|
|
116
|
+
var v3 = !!isV3;
|
|
117
|
+
return {
|
|
118
|
+
v3: v3
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
created: function created() {
|
|
122
|
+
validatePackage(packageMetadata);
|
|
123
|
+
this.windowCoordinatesState = {
|
|
124
|
+
leftBeforeAction: this.getInitialLeft(),
|
|
125
|
+
topBeforeAction: this.getInitialTop(),
|
|
126
|
+
widthBeforeAction: this.getInitialWidth(),
|
|
127
|
+
heightBeforeAction: this.getInitialHeight()
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
beforeDestroy: !!isV3 ? undefined : function () {
|
|
131
|
+
if (this.$props.appendTo) {
|
|
132
|
+
this.windowWrapper.remove();
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
beforeUnmount: function beforeUnmount() {
|
|
136
|
+
if (this.$props.appendTo) {
|
|
137
|
+
this.windowWrapper.remove();
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
data: function data() {
|
|
141
|
+
return {
|
|
142
|
+
currentStage: this.$props.stage || windowStage.DEFAULT,
|
|
143
|
+
isDragging: false,
|
|
144
|
+
currentTop: this.getInitialTop(),
|
|
145
|
+
currentLeft: this.getInitialLeft(),
|
|
146
|
+
currentWidth: this.getInitialWidth(),
|
|
147
|
+
currentHeight: this.getInitialHeight()
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
mounted: function mounted() {
|
|
151
|
+
if (window) {
|
|
152
|
+
window.addEventListener('resize', this.handleBrowserWindowResize);
|
|
153
|
+
|
|
154
|
+
if (this.$props.appendTo) {
|
|
155
|
+
var body = document.querySelector(this.$props.appendTo);
|
|
156
|
+
this.windowWrapper = this.$refs.wrapper;
|
|
157
|
+
body.append(this.windowWrapper);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (this.$el) {
|
|
162
|
+
// this.draggable = this.$refs.draggable;
|
|
163
|
+
this.windowElement = this.$refs.windowElement;
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
destroyed: !!isV3 ? undefined : function () {
|
|
167
|
+
if (window) {
|
|
168
|
+
window.removeEventListener('resize', this.handleBrowserWindowResize);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
unmounted: function unmounted() {
|
|
173
|
+
if (window) {
|
|
174
|
+
window.removeEventListener('resize', this.handleBrowserWindowResize);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
computed: {
|
|
178
|
+
computedTop: function computedTop() {
|
|
179
|
+
if (this.windowStage !== windowStage.FULLSCREEN) {
|
|
180
|
+
return Math.max(this.$props.top || this.currentTop, 0);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return 0;
|
|
184
|
+
},
|
|
185
|
+
computedLeft: function computedLeft() {
|
|
186
|
+
if (this.windowStage !== windowStage.FULLSCREEN) {
|
|
187
|
+
return Math.max(this.$props.left || this.currentLeft, 0);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return 0;
|
|
191
|
+
},
|
|
192
|
+
computedWidth: function computedWidth() {
|
|
193
|
+
var width = this.$props.width || this.currentWidth;
|
|
194
|
+
|
|
195
|
+
if (this.windowStage === windowStage.FULLSCREEN) {
|
|
196
|
+
width = window.innerWidth;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return width;
|
|
200
|
+
},
|
|
201
|
+
computedHeight: function computedHeight() {
|
|
202
|
+
var height = this.$props.height || this.currentHeight;
|
|
203
|
+
|
|
204
|
+
if (this.windowStage === windowStage.FULLSCREEN) {
|
|
205
|
+
height = window.innerHeight;
|
|
206
|
+
} else if (this.windowStage === windowStage.MINIMIZED) {
|
|
207
|
+
height = 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return height;
|
|
211
|
+
},
|
|
212
|
+
windowStage: function windowStage() {
|
|
213
|
+
return this.$props.stage || this.currentStage;
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
methods: {
|
|
217
|
+
onPress: function onPress(event) {
|
|
218
|
+
var e = event;
|
|
219
|
+
this.windowCoordinatesState.differenceLeft = e.pageX - this.computedLeft;
|
|
220
|
+
this.windowCoordinatesState.differenceTop = e.pageY - this.computedTop;
|
|
221
|
+
},
|
|
222
|
+
onDrag: function onDrag(event) {
|
|
223
|
+
var e = event;
|
|
224
|
+
e.originalEvent.preventDefault();
|
|
225
|
+
|
|
226
|
+
if (this.windowStage !== windowStage.FULLSCREEN && this.$props.draggable) {
|
|
227
|
+
this.currentTop = Math.max(e.pageY - this.windowCoordinatesState.differenceTop, 0);
|
|
228
|
+
this.currentLeft = e.pageX - this.windowCoordinatesState.differenceLeft;
|
|
229
|
+
this.isDragging = true;
|
|
230
|
+
this.dispatchMoveEvent('move', e, true, false);
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
onRelease: function onRelease(event) {
|
|
234
|
+
var e = event;
|
|
235
|
+
|
|
236
|
+
if (this.windowStage !== windowStage.FULLSCREEN && this.$props.draggable) {
|
|
237
|
+
this.dispatchMoveEvent('move', e, true, true);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
this.isDragging = false;
|
|
241
|
+
},
|
|
242
|
+
handleKeyDown: function handleKeyDown(event) {
|
|
243
|
+
if (event.target !== event.currentTarget) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
var minWidth = this.$props.minWidth || DEFAULT_MIN_WIDTH;
|
|
248
|
+
var minHeight = this.$props.minHeight || DEFAULT_MIN_HEIGHT;
|
|
249
|
+
|
|
250
|
+
if (event.ctrlKey && this.$props.resizable) {
|
|
251
|
+
switch (event.keyCode) {
|
|
252
|
+
case Keys.up:
|
|
253
|
+
event.preventDefault();
|
|
254
|
+
|
|
255
|
+
if (minHeight <= this.computedHeight - DEFAULT_STEP) {
|
|
256
|
+
this.currentHeight = this.currentHeight - DEFAULT_STEP;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
break;
|
|
260
|
+
|
|
261
|
+
case Keys.down:
|
|
262
|
+
event.preventDefault();
|
|
263
|
+
this.currentHeight = this.currentHeight + DEFAULT_STEP;
|
|
264
|
+
break;
|
|
265
|
+
|
|
266
|
+
case Keys.left:
|
|
267
|
+
if (minWidth <= this.computedWidth - DEFAULT_STEP) {
|
|
268
|
+
this.currentWidth = this.currentWidth - DEFAULT_STEP;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
break;
|
|
272
|
+
|
|
273
|
+
case Keys.right:
|
|
274
|
+
this.currentWidth = this.currentWidth + DEFAULT_STEP;
|
|
275
|
+
break;
|
|
276
|
+
|
|
277
|
+
default:
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
this.dispatchMoveEvent('resize', event, false, undefined);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (event.altKey) {
|
|
286
|
+
switch (event.keyCode) {
|
|
287
|
+
case Keys.up:
|
|
288
|
+
if (this.windowStage === windowStage.MINIMIZED) {
|
|
289
|
+
this.handleRestore(event);
|
|
290
|
+
this.$emit('stagechange', event, this, {
|
|
291
|
+
state: windowStage.DEFAULT
|
|
292
|
+
});
|
|
293
|
+
} else if (this.windowStage === windowStage.DEFAULT) {
|
|
294
|
+
this.handleFullscreen(event);
|
|
295
|
+
this.$emit('stagechange', event, this, {
|
|
296
|
+
state: windowStage.FULLSCREEN
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
break;
|
|
301
|
+
|
|
302
|
+
case Keys.down:
|
|
303
|
+
if (this.windowStage === windowStage.FULLSCREEN) {
|
|
304
|
+
this.handleRestore(event);
|
|
305
|
+
this.$emit('stagechange', event, this, {
|
|
306
|
+
state: windowStage.DEFAULT
|
|
307
|
+
});
|
|
308
|
+
} else if (this.windowStage === windowStage.DEFAULT) {
|
|
309
|
+
this.handleMinimize(event);
|
|
310
|
+
this.$emit('stagechange', event, this, {
|
|
311
|
+
state: windowStage.MINIMIZED
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
break;
|
|
316
|
+
|
|
317
|
+
default:
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (!event.ctrlKey) {
|
|
324
|
+
switch (event.keyCode) {
|
|
325
|
+
case Keys.esc:
|
|
326
|
+
this.handleCloseWindow(event);
|
|
327
|
+
return;
|
|
328
|
+
|
|
329
|
+
case Keys.up:
|
|
330
|
+
event.preventDefault();
|
|
331
|
+
this.currentTop = this.currentTop - DEFAULT_STEP;
|
|
332
|
+
break;
|
|
333
|
+
|
|
334
|
+
case Keys.down:
|
|
335
|
+
event.preventDefault();
|
|
336
|
+
this.currentTop = this.currentTop + DEFAULT_STEP;
|
|
337
|
+
break;
|
|
338
|
+
|
|
339
|
+
case Keys.left:
|
|
340
|
+
event.preventDefault();
|
|
341
|
+
this.currentLeft = this.currentLeft - DEFAULT_STEP;
|
|
342
|
+
break;
|
|
343
|
+
|
|
344
|
+
case Keys.right:
|
|
345
|
+
event.preventDefault();
|
|
346
|
+
this.currentLeft = this.currentLeft + DEFAULT_STEP;
|
|
347
|
+
break;
|
|
348
|
+
|
|
349
|
+
default:
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
this.dispatchMoveEvent('move', event, false, undefined);
|
|
355
|
+
},
|
|
356
|
+
getInitialTop: function getInitialTop() {
|
|
357
|
+
if (this.$props.top !== undefined) {
|
|
358
|
+
return this.$props.top;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (this.$props.initialTop !== undefined) {
|
|
362
|
+
return this.$props.initialTop;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
var height = DEFAULT_HEIGHT;
|
|
366
|
+
|
|
367
|
+
if (this.$props.height !== undefined) {
|
|
368
|
+
height = this.$props.height;
|
|
369
|
+
} else if (this.$props.initialHeight !== undefined) {
|
|
370
|
+
height = this.$props.initialHeight;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return window.innerHeight / 2 - height / 2;
|
|
374
|
+
},
|
|
375
|
+
getInitialLeft: function getInitialLeft() {
|
|
376
|
+
if (this.$props.left !== undefined) {
|
|
377
|
+
return this.$props.left;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (this.$props.initialLeft !== undefined) {
|
|
381
|
+
return this.$props.initialLeft;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
var width = DEFAULT_WIDTH;
|
|
385
|
+
|
|
386
|
+
if (this.$props.width !== undefined) {
|
|
387
|
+
width = this.$props.width;
|
|
388
|
+
} else if (this.$props.initialWidth !== undefined) {
|
|
389
|
+
width = this.$props.initialWidth;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return window.innerWidth / 2 - width / 2;
|
|
393
|
+
},
|
|
394
|
+
getInitialWidth: function getInitialWidth() {
|
|
395
|
+
var width = DEFAULT_WIDTH;
|
|
396
|
+
|
|
397
|
+
if (this.$props.width !== undefined) {
|
|
398
|
+
width = this.$props.width;
|
|
399
|
+
} else if (this.$props.initialWidth !== undefined) {
|
|
400
|
+
width = this.$props.initialWidth;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return width;
|
|
404
|
+
},
|
|
405
|
+
getInitialHeight: function getInitialHeight() {
|
|
406
|
+
var height = DEFAULT_HEIGHT;
|
|
407
|
+
|
|
408
|
+
if (this.$props.height !== undefined) {
|
|
409
|
+
height = this.$props.height;
|
|
410
|
+
} else if (this.$props.initialHeight !== undefined) {
|
|
411
|
+
height = this.$props.initialHeight;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
return height;
|
|
415
|
+
},
|
|
416
|
+
handleMinimize: function handleMinimize(event) {
|
|
417
|
+
event.preventDefault();
|
|
418
|
+
this.windowCoordinatesState.leftBeforeAction = this.computedLeft;
|
|
419
|
+
this.windowCoordinatesState.topBeforeAction = this.computedTop;
|
|
420
|
+
this.windowCoordinatesState.widthBeforeAction = this.computedWidth;
|
|
421
|
+
this.windowCoordinatesState.heightBeforeAction = this.computedHeight;
|
|
422
|
+
this.currentStage = windowStage.MINIMIZED;
|
|
423
|
+
this.currentHeight = 0;
|
|
424
|
+
this.$emit('stagechange', event, this, {
|
|
425
|
+
state: windowStage.MINIMIZED
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
handleFullscreen: function handleFullscreen(event) {
|
|
429
|
+
event.preventDefault();
|
|
430
|
+
this.windowCoordinatesState.leftBeforeAction = this.computedLeft;
|
|
431
|
+
this.windowCoordinatesState.topBeforeAction = this.computedTop;
|
|
432
|
+
this.windowCoordinatesState.widthBeforeAction = this.computedWidth;
|
|
433
|
+
this.windowCoordinatesState.heightBeforeAction = this.computedHeight;
|
|
434
|
+
this.currentLeft = 0;
|
|
435
|
+
this.currentTop = 0;
|
|
436
|
+
this.currentWidth = window.innerWidth;
|
|
437
|
+
this.currentHeight = window.innerHeight;
|
|
438
|
+
this.currentStage = windowStage.FULLSCREEN;
|
|
439
|
+
this.$emit('stagechange', event, this, {
|
|
440
|
+
state: windowStage.FULLSCREEN
|
|
441
|
+
});
|
|
442
|
+
},
|
|
443
|
+
handleRestore: function handleRestore(event) {
|
|
444
|
+
event.preventDefault();
|
|
445
|
+
|
|
446
|
+
if (this.windowStage === windowStage.FULLSCREEN) {
|
|
447
|
+
this.currentStage = windowStage.DEFAULT;
|
|
448
|
+
this.currentLeft = this.windowCoordinatesState.leftBeforeAction;
|
|
449
|
+
this.currentTop = this.windowCoordinatesState.topBeforeAction;
|
|
450
|
+
this.currentWidth = this.windowCoordinatesState.widthBeforeAction;
|
|
451
|
+
this.currentHeight = this.windowCoordinatesState.heightBeforeAction;
|
|
452
|
+
} else if (this.windowStage === windowStage.MINIMIZED) {
|
|
453
|
+
this.currentStage = windowStage.DEFAULT;
|
|
454
|
+
this.currentHeight = this.windowCoordinatesState.heightBeforeAction;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
this.$emit('stagechange', event, this, {
|
|
458
|
+
state: windowStage.DEFAULT
|
|
459
|
+
});
|
|
460
|
+
},
|
|
461
|
+
handleCloseWindow: function handleCloseWindow(event) {
|
|
462
|
+
event.preventDefault();
|
|
463
|
+
this.$emit('close', event, this, {
|
|
464
|
+
state: undefined
|
|
465
|
+
});
|
|
466
|
+
},
|
|
467
|
+
handleDoubleClick: function handleDoubleClick(e) {
|
|
468
|
+
if (!this.$props.doubleClickStageChange) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (this.windowStage === windowStage.FULLSCREEN || this.windowStage === windowStage.MINIMIZED) {
|
|
473
|
+
this.handleRestore(e);
|
|
474
|
+
} else {
|
|
475
|
+
this.handleFullscreen(e);
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
handleResize: function handleResize(event, props) {
|
|
479
|
+
var currentWidth = this.computedWidth;
|
|
480
|
+
var currentHeight = this.computedHeight;
|
|
481
|
+
var minWidth = this.$props.minWidth || DEFAULT_MIN_WIDTH;
|
|
482
|
+
var minHeight = this.$props.minHeight || DEFAULT_MIN_HEIGHT;
|
|
483
|
+
var heightDifference = this.computedTop - event.pageY;
|
|
484
|
+
var widthDifference = this.computedLeft - event.pageX;
|
|
485
|
+
var newWidth = event.pageX - this.computedLeft;
|
|
486
|
+
var newHeight = event.pageY - this.computedTop;
|
|
487
|
+
this.isDragging = !props.end;
|
|
488
|
+
|
|
489
|
+
if (props.direction.indexOf('n') >= 0 && minHeight - (currentHeight + heightDifference) < 0) {
|
|
490
|
+
this.currentTop = event.pageY;
|
|
491
|
+
this.currentHeight = currentHeight + heightDifference;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (props.direction.indexOf('s') >= 0 && minHeight - newHeight < 0) {
|
|
495
|
+
this.currentHeight = newHeight;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (props.direction.indexOf('w') >= 0 && minWidth - (currentWidth + widthDifference) < 0) {
|
|
499
|
+
this.currentLeft = event.pageX;
|
|
500
|
+
this.currentWidth = currentWidth + widthDifference;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if (props.direction.indexOf('e') >= 0 && minWidth - newWidth < 0) {
|
|
504
|
+
this.currentWidth = newWidth;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
this.dispatchMoveEvent('resize', event, true, props.end);
|
|
508
|
+
},
|
|
509
|
+
dispatchMoveEvent: function dispatchMoveEvent(eventName, event, drag, end) {
|
|
510
|
+
this.$emit(eventName, {
|
|
511
|
+
event: event.event,
|
|
512
|
+
drag: drag,
|
|
513
|
+
end: end,
|
|
514
|
+
target: this,
|
|
515
|
+
left: this.currentLeft,
|
|
516
|
+
top: this.currentTop,
|
|
517
|
+
width: this.currentWidth,
|
|
518
|
+
height: this.currentHeight
|
|
519
|
+
});
|
|
520
|
+
},
|
|
521
|
+
handleBrowserWindowResize: function handleBrowserWindowResize() {
|
|
522
|
+
if (this.windowStage === windowStage.FULLSCREEN) {
|
|
523
|
+
this.currentWidth = window.innerWidth;
|
|
524
|
+
this.currentHeight = window.innerHeight;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
// @ts-ignore
|
|
529
|
+
render: function render(createElement) {
|
|
530
|
+
var _this = this;
|
|
531
|
+
|
|
532
|
+
var h = gh || createElement;
|
|
533
|
+
var classNamesWindow = classNames('k-widget', 'k-window', this.$props.windowClass, {
|
|
534
|
+
'k-window-minimized': this.currentStage === 'MINIMIZED'
|
|
535
|
+
});
|
|
536
|
+
var titleRender = templateRendering.call(this, this.$props.titleRender, getListeners.call(this));
|
|
537
|
+
var closeButton = templateRendering.call(this, this.$props.closeButton, getListeners.call(this));
|
|
538
|
+
var minimizeButton = templateRendering.call(this, this.$props.minimizeButton, getListeners.call(this));
|
|
539
|
+
var maximizeButton = templateRendering.call(this, this.$props.maximizeButton, getListeners.call(this));
|
|
540
|
+
var restoreButton = templateRendering.call(this, this.$props.restoreButton, getListeners.call(this));
|
|
541
|
+
var defaultSlot = getDefaultSlots(this);
|
|
542
|
+
var windowElement = h("div", {
|
|
543
|
+
ref: 'wrapper'
|
|
544
|
+
}, [this.$props.modal && h("div", {
|
|
545
|
+
"class": "k-overlay"
|
|
546
|
+
}), h("div", {
|
|
547
|
+
tabindex: 0,
|
|
548
|
+
attrs: this.v3 ? undefined : {
|
|
549
|
+
tabindex: 0
|
|
550
|
+
},
|
|
551
|
+
onFocus: function onFocus(e) {
|
|
552
|
+
return e.target.classList.add('k-focus');
|
|
553
|
+
},
|
|
554
|
+
on: this.v3 ? undefined : {
|
|
555
|
+
"focus": function onFocus(e) {
|
|
556
|
+
return e.target.classList.add('k-focus');
|
|
557
|
+
},
|
|
558
|
+
"blur": function blur(e) {
|
|
559
|
+
return e.target.classList.remove('k-focus');
|
|
560
|
+
},
|
|
561
|
+
"keydown": this.handleKeyDown
|
|
562
|
+
},
|
|
563
|
+
onBlur: function blur(e) {
|
|
564
|
+
return e.target.classList.remove('k-focus');
|
|
565
|
+
},
|
|
566
|
+
onKeydown: this.handleKeyDown,
|
|
567
|
+
ref: 'windowElement',
|
|
568
|
+
"class": classNamesWindow,
|
|
569
|
+
style: __assign({
|
|
570
|
+
top: this.computedTop + 'px',
|
|
571
|
+
left: this.computedLeft + 'px',
|
|
572
|
+
width: this.computedWidth + 'px',
|
|
573
|
+
height: this.computedHeight + 'px' || ''
|
|
574
|
+
}, this.$props.windowStyle)
|
|
575
|
+
}, [// @ts-ignore function children
|
|
576
|
+
h(Draggable, {
|
|
577
|
+
onPress: this.onPress,
|
|
578
|
+
on: this.v3 ? undefined : {
|
|
579
|
+
"press": this.onPress,
|
|
580
|
+
"drag": this.onDrag,
|
|
581
|
+
"release": this.onRelease
|
|
582
|
+
},
|
|
583
|
+
onDrag: this.onDrag,
|
|
584
|
+
onRelease: this.onRelease,
|
|
585
|
+
ref: 'draggable'
|
|
586
|
+
}, this.v3 ? function () {
|
|
587
|
+
return [// @ts-ignore function children
|
|
588
|
+
h(WindowTitleBar, {
|
|
589
|
+
stage: _this.windowStage,
|
|
590
|
+
attrs: _this.v3 ? undefined : {
|
|
591
|
+
stage: _this.windowStage,
|
|
592
|
+
title: _this.$props.title,
|
|
593
|
+
titleRender: titleRender,
|
|
594
|
+
closeButton: closeButton,
|
|
595
|
+
minimizeButton: minimizeButton,
|
|
596
|
+
maximizeButton: maximizeButton,
|
|
597
|
+
restoreButton: restoreButton
|
|
598
|
+
},
|
|
599
|
+
title: _this.$props.title,
|
|
600
|
+
titleRender: titleRender,
|
|
601
|
+
onDoubleclick: _this.handleDoubleClick,
|
|
602
|
+
on: _this.v3 ? undefined : {
|
|
603
|
+
"doubleclick": _this.handleDoubleClick,
|
|
604
|
+
"minimizeclick": _this.handleMinimize,
|
|
605
|
+
"fullscreenclick": _this.handleFullscreen,
|
|
606
|
+
"restoreclick": _this.handleRestore,
|
|
607
|
+
"closeclick": _this.handleCloseWindow
|
|
608
|
+
},
|
|
609
|
+
onMinimizeclick: _this.handleMinimize,
|
|
610
|
+
onFullscreenclick: _this.handleFullscreen,
|
|
611
|
+
onRestoreclick: _this.handleRestore,
|
|
612
|
+
onCloseclick: _this.handleCloseWindow,
|
|
613
|
+
closeButton: closeButton,
|
|
614
|
+
minimizeButton: minimizeButton,
|
|
615
|
+
maximizeButton: maximizeButton,
|
|
616
|
+
restoreButton: restoreButton
|
|
617
|
+
})];
|
|
618
|
+
} : [h(WindowTitleBar, {
|
|
619
|
+
stage: _this.windowStage,
|
|
620
|
+
attrs: _this.v3 ? undefined : {
|
|
621
|
+
stage: _this.windowStage,
|
|
622
|
+
title: _this.$props.title,
|
|
623
|
+
titleRender: titleRender,
|
|
624
|
+
closeButton: closeButton,
|
|
625
|
+
minimizeButton: minimizeButton,
|
|
626
|
+
maximizeButton: maximizeButton,
|
|
627
|
+
restoreButton: restoreButton
|
|
628
|
+
},
|
|
629
|
+
title: _this.$props.title,
|
|
630
|
+
titleRender: titleRender,
|
|
631
|
+
onDoubleclick: _this.handleDoubleClick,
|
|
632
|
+
on: _this.v3 ? undefined : {
|
|
633
|
+
"doubleclick": _this.handleDoubleClick,
|
|
634
|
+
"minimizeclick": _this.handleMinimize,
|
|
635
|
+
"fullscreenclick": _this.handleFullscreen,
|
|
636
|
+
"restoreclick": _this.handleRestore,
|
|
637
|
+
"closeclick": _this.handleCloseWindow
|
|
638
|
+
},
|
|
639
|
+
onMinimizeclick: _this.handleMinimize,
|
|
640
|
+
onFullscreenclick: _this.handleFullscreen,
|
|
641
|
+
onRestoreclick: _this.handleRestore,
|
|
642
|
+
onCloseclick: _this.handleCloseWindow,
|
|
643
|
+
closeButton: closeButton,
|
|
644
|
+
minimizeButton: minimizeButton,
|
|
645
|
+
maximizeButton: maximizeButton,
|
|
646
|
+
restoreButton: restoreButton
|
|
647
|
+
})]), this.windowStage !== windowStage.MINIMIZED ? h("div", {
|
|
648
|
+
"class": "k-content k-window-content"
|
|
649
|
+
}, [defaultSlot]) : null, this.windowStage === windowStage.DEFAULT && this.$props.resizable // @ts-ignore function children
|
|
650
|
+
? h(ResizeHandlers, {
|
|
651
|
+
onResize: this.handleResize,
|
|
652
|
+
on: this.v3 ? undefined : {
|
|
653
|
+
"resize": this.handleResize
|
|
654
|
+
}
|
|
655
|
+
}) : null])]);
|
|
656
|
+
return this.$props.appendTo ? h("div", [windowElement]) : windowElement;
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
/**
|
|
660
|
+
* @hidden
|
|
661
|
+
*/
|
|
662
|
+
|
|
663
|
+
var Window = WindowVue2;
|
|
664
|
+
export { Window, WindowVue2 };
|