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