@progress/kendo-react-dialogs 6.1.1 → 7.0.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/{dist/es/Dialog.d.ts → Dialog.d.ts} +6 -2
  2. package/{dist/npm/DialogActionsBar.d.ts → DialogActionsBar.d.ts} +4 -0
  3. package/{dist/es/DialogProps.d.ts → DialogProps.d.ts} +4 -1
  4. package/{dist/es/DialogTitleBar.d.ts → DialogTitleBar.d.ts} +4 -0
  5. package/LICENSE.md +1 -1
  6. package/{dist/es/MiddleLayerOptimization.d.ts → MiddleLayerOptimization.d.ts} +4 -0
  7. package/StageEnum.d.ts +9 -0
  8. package/{dist/es/Window.d.ts → Window.d.ts} +6 -2
  9. package/{dist/npm/WindowActionsBar.d.ts → WindowActionsBar.d.ts} +4 -0
  10. package/{dist/npm/WindowProps.d.ts → WindowProps.d.ts} +4 -1
  11. package/WindowResizeHandlers.d.ts +20 -0
  12. package/{dist/npm/WindowTitlebar.d.ts → WindowTitlebar.d.ts} +4 -0
  13. package/constants.d.ts +12 -0
  14. package/dist/cdn/js/kendo-react-dialogs.js +5 -1
  15. package/{dist/npm/events.d.ts → events.d.ts} +4 -0
  16. package/index.d.ts +13 -0
  17. package/index.js +5 -0
  18. package/index.mjs +677 -0
  19. package/{dist/npm/messages → messages}/index.d.ts +4 -0
  20. package/models/actions-layout.d.ts +8 -0
  21. package/package-metadata.d.ts +9 -0
  22. package/package.json +28 -36
  23. package/utils.d.ts +6 -0
  24. package/about.md +0 -3
  25. package/dist/es/Dialog.js +0 -203
  26. package/dist/es/DialogActionsBar.d.ts +0 -21
  27. package/dist/es/DialogActionsBar.js +0 -32
  28. package/dist/es/DialogProps.js +0 -3
  29. package/dist/es/DialogTitleBar.js +0 -13
  30. package/dist/es/MiddleLayerOptimization.js +0 -33
  31. package/dist/es/StageEnum.d.ts +0 -5
  32. package/dist/es/StageEnum.js +0 -6
  33. package/dist/es/Window.js +0 -643
  34. package/dist/es/WindowActionsBar.d.ts +0 -21
  35. package/dist/es/WindowActionsBar.js +0 -34
  36. package/dist/es/WindowProps.d.ts +0 -144
  37. package/dist/es/WindowProps.js +0 -2
  38. package/dist/es/WindowResizeHandlers.d.ts +0 -16
  39. package/dist/es/WindowResizeHandlers.js +0 -49
  40. package/dist/es/WindowTitlebar.d.ts +0 -63
  41. package/dist/es/WindowTitlebar.js +0 -47
  42. package/dist/es/constants.d.ts +0 -8
  43. package/dist/es/constants.js +0 -8
  44. package/dist/es/events.d.ts +0 -45
  45. package/dist/es/events.js +0 -2
  46. package/dist/es/main.d.ts +0 -9
  47. package/dist/es/main.js +0 -5
  48. package/dist/es/messages/index.d.ts +0 -25
  49. package/dist/es/messages/index.js +0 -26
  50. package/dist/es/models/actions-layout.d.ts +0 -4
  51. package/dist/es/models/actions-layout.js +0 -1
  52. package/dist/es/package-metadata.d.ts +0 -5
  53. package/dist/es/package-metadata.js +0 -11
  54. package/dist/es/utils.d.ts +0 -2
  55. package/dist/es/utils.js +0 -22
  56. package/dist/npm/Dialog.d.ts +0 -90
  57. package/dist/npm/Dialog.js +0 -206
  58. package/dist/npm/DialogActionsBar.js +0 -36
  59. package/dist/npm/DialogProps.d.ts +0 -74
  60. package/dist/npm/DialogProps.js +0 -4
  61. package/dist/npm/DialogTitleBar.d.ts +0 -26
  62. package/dist/npm/DialogTitleBar.js +0 -17
  63. package/dist/npm/MiddleLayerOptimization.d.ts +0 -17
  64. package/dist/npm/MiddleLayerOptimization.js +0 -36
  65. package/dist/npm/StageEnum.d.ts +0 -5
  66. package/dist/npm/StageEnum.js +0 -9
  67. package/dist/npm/Window.d.ts +0 -174
  68. package/dist/npm/Window.js +0 -646
  69. package/dist/npm/WindowActionsBar.js +0 -38
  70. package/dist/npm/WindowProps.js +0 -3
  71. package/dist/npm/WindowResizeHandlers.d.ts +0 -16
  72. package/dist/npm/WindowResizeHandlers.js +0 -52
  73. package/dist/npm/WindowTitlebar.js +0 -50
  74. package/dist/npm/constants.d.ts +0 -8
  75. package/dist/npm/constants.js +0 -11
  76. package/dist/npm/events.js +0 -3
  77. package/dist/npm/main.d.ts +0 -9
  78. package/dist/npm/main.js +0 -13
  79. package/dist/npm/messages/index.js +0 -29
  80. package/dist/npm/models/actions-layout.d.ts +0 -4
  81. package/dist/npm/models/actions-layout.js +0 -2
  82. package/dist/npm/package-metadata.d.ts +0 -5
  83. package/dist/npm/package-metadata.js +0 -14
  84. package/dist/npm/utils.d.ts +0 -2
  85. package/dist/npm/utils.js +0 -26
  86. package/dist/systemjs/kendo-react-dialogs.js +0 -1
  87. package/e2e-next/dialog.basic.tests.ts +0 -24
  88. package/e2e-next/window.basic.tests.ts +0 -24
@@ -1,646 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Window = exports.WindowPropsContext = void 0;
30
- var React = require("react");
31
- var ReactDOM = require("react-dom");
32
- var PropTypes = require("prop-types");
33
- var WindowTitlebar_1 = require("./WindowTitlebar");
34
- var kendo_react_common_1 = require("@progress/kendo-react-common");
35
- var kendo_react_common_2 = require("@progress/kendo-react-common");
36
- var WindowResizeHandlers_1 = require("./WindowResizeHandlers");
37
- var MiddleLayerOptimization_1 = require("./MiddleLayerOptimization");
38
- var StageEnum_1 = require("./StageEnum");
39
- var kendo_react_common_3 = require("@progress/kendo-react-common");
40
- var package_metadata_1 = require("./package-metadata");
41
- var WindowActionsBar_1 = require("./WindowActionsBar");
42
- var constants_1 = require("./constants");
43
- var utils_1 = require("./utils");
44
- var DEFAULT_WIDTH = 300;
45
- var DEFAULT_HEIGHT = 300;
46
- var DEFAULT_MIN_WIDTH = 120;
47
- var DEFAULT_MIN_HEIGHT = 100;
48
- var DEFAULT_STEP = 5;
49
- /** @hidden */
50
- var WindowWithoutContext = /** @class */ (function (_super) {
51
- __extends(WindowWithoutContext, _super);
52
- function WindowWithoutContext(props) {
53
- var _this = _super.call(this, props) || this;
54
- /**
55
- * @hidden
56
- */
57
- _this.context = 0;
58
- _this.draggable = null;
59
- _this.offSetCoordinates = { x: 0, y: 0 };
60
- _this._id = (0, kendo_react_common_1.guid)();
61
- _this.titleId = _this.generateTitleId();
62
- _this.mounted = false;
63
- _this.showLicenseWatermark = false;
64
- /**
65
- * @hidden
66
- */
67
- _this.onKeyDown = function (event) {
68
- if (event.target !== event.currentTarget) {
69
- return;
70
- }
71
- var minWidth = _this.props.minWidth || DEFAULT_MIN_WIDTH;
72
- var minHeight = _this.props.minHeight || DEFAULT_MIN_HEIGHT;
73
- if (event.ctrlKey && _this.props.resizable) {
74
- switch (event.keyCode) {
75
- case kendo_react_common_1.Keys.up:
76
- event.preventDefault();
77
- if (minHeight <= (_this.height - DEFAULT_STEP)) {
78
- _this.setState({ height: _this.height - DEFAULT_STEP });
79
- }
80
- break;
81
- case kendo_react_common_1.Keys.down:
82
- event.preventDefault();
83
- _this.setState({ height: _this.height + DEFAULT_STEP });
84
- break;
85
- case kendo_react_common_1.Keys.left:
86
- if (minWidth <= (_this.width - DEFAULT_STEP)) {
87
- _this.setState({ width: _this.width - DEFAULT_STEP });
88
- }
89
- break;
90
- case kendo_react_common_1.Keys.right:
91
- _this.setState({ width: _this.width + DEFAULT_STEP });
92
- break;
93
- default: return;
94
- }
95
- _this.dispatchMoveEvent(_this.props.onResize, event, false, undefined);
96
- return;
97
- }
98
- if (event.altKey) {
99
- switch (event.keyCode) {
100
- case kendo_react_common_1.Keys.up:
101
- if (_this.windowStage === StageEnum_1.windowStage.MINIMIZED) {
102
- _this.handleRestore(event);
103
- (0, kendo_react_common_1.dispatchEvent)(_this.props.onStageChange, event, _this, { state: StageEnum_1.windowStage.DEFAULT });
104
- }
105
- else if (_this.windowStage === StageEnum_1.windowStage.DEFAULT) {
106
- _this.handleFullscreen(event);
107
- (0, kendo_react_common_1.dispatchEvent)(_this.props.onStageChange, event, _this, { state: StageEnum_1.windowStage.FULLSCREEN });
108
- }
109
- break;
110
- case kendo_react_common_1.Keys.down:
111
- if (_this.windowStage === StageEnum_1.windowStage.FULLSCREEN) {
112
- _this.handleRestore(event);
113
- (0, kendo_react_common_1.dispatchEvent)(_this.props.onStageChange, event, _this, { state: StageEnum_1.windowStage.DEFAULT });
114
- }
115
- else if (_this.windowStage === StageEnum_1.windowStage.DEFAULT) {
116
- _this.handleMinimize(event);
117
- (0, kendo_react_common_1.dispatchEvent)(_this.props.onStageChange, event, _this, { state: StageEnum_1.windowStage.MINIMIZED });
118
- }
119
- break;
120
- default:
121
- }
122
- return;
123
- }
124
- if (!event.ctrlKey) {
125
- switch (event.keyCode) {
126
- case kendo_react_common_1.Keys.esc:
127
- if (_this.props.onClose) {
128
- _this.handleCloseWindow(event);
129
- }
130
- return;
131
- case kendo_react_common_1.Keys.up:
132
- _this.setState({ top: _this.state.top - DEFAULT_STEP });
133
- break;
134
- case kendo_react_common_1.Keys.down:
135
- _this.setState({ top: _this.state.top + DEFAULT_STEP });
136
- break;
137
- case kendo_react_common_1.Keys.left:
138
- _this.setState({ left: _this.state.left - DEFAULT_STEP });
139
- break;
140
- case kendo_react_common_1.Keys.right:
141
- _this.setState({ left: _this.state.left + DEFAULT_STEP });
142
- break;
143
- default: return;
144
- }
145
- }
146
- _this.dispatchMoveEvent(_this.props.onMove, event, false, undefined);
147
- };
148
- /**
149
- * @hidden
150
- */
151
- _this.onPress = function (data) {
152
- var e = data.event;
153
- _this.windowCoordinatesState.differenceLeft = e.pageX - _this.left;
154
- _this.windowCoordinatesState.differenceTop = e.pageY - _this.top;
155
- };
156
- /**
157
- * @hidden
158
- */
159
- _this.onDrag = function (data) {
160
- var e = data.event;
161
- e.originalEvent.preventDefault();
162
- if (_this.windowStage !== StageEnum_1.windowStage.FULLSCREEN && _this.props.draggable) {
163
- _this.setState({
164
- top: Math.max(e.pageY - _this.windowCoordinatesState.differenceTop, 0),
165
- left: e.pageX - _this.windowCoordinatesState.differenceLeft,
166
- isDragging: true
167
- });
168
- if (_this.props.onMove) {
169
- // eslint-disable-next-line max-len
170
- _this.dispatchMoveEvent(_this.props.onMove, e, true, false);
171
- }
172
- }
173
- };
174
- /**
175
- * @hidden
176
- */
177
- _this.onRelease = function (data) {
178
- var e = data.event;
179
- if (_this.windowStage !== StageEnum_1.windowStage.FULLSCREEN && _this.props.draggable) {
180
- if (_this.props.onMove) {
181
- _this.dispatchMoveEvent(_this.props.onMove, e, true, true);
182
- }
183
- }
184
- _this.setState({
185
- isDragging: false
186
- });
187
- };
188
- /**
189
- * @hidden
190
- */
191
- _this.onFocus = function () {
192
- if (_this._blurTimeout) {
193
- clearTimeout(_this._blurTimeout);
194
- _this._blurTimeout = undefined;
195
- }
196
- else {
197
- _this.setState({
198
- focused: true,
199
- zIndex: (0, utils_1.getMaxZIndex)(_this.getCurrentZIndex(), _this.getDocument(), _this._id)
200
- });
201
- }
202
- };
203
- /**
204
- * @hidden
205
- */
206
- _this.onBlur = function () {
207
- clearTimeout(_this._blurTimeout);
208
- var currentWindow = _this.getWindow();
209
- if (currentWindow) {
210
- _this._blurTimeout = currentWindow.setTimeout(function () {
211
- if (_this.mounted) {
212
- _this.setState({ focused: false });
213
- }
214
- _this._blurTimeout = undefined;
215
- });
216
- }
217
- };
218
- // Get initial coordinates of the Window
219
- _this.getInitialTop = function () {
220
- if (_this.props.top !== undefined) {
221
- return _this.props.top;
222
- }
223
- if (_this.props.initialTop !== undefined) {
224
- return _this.props.initialTop;
225
- }
226
- var height = DEFAULT_HEIGHT;
227
- if (_this.props.height !== undefined) {
228
- height = _this.props.height;
229
- }
230
- else if (_this.props.initialHeight !== undefined) {
231
- height = _this.props.initialHeight;
232
- }
233
- if (_this.props.appendTo) {
234
- return (_this.props.appendTo.offsetHeight / 2) - (height / 2);
235
- }
236
- var currentWindow = _this.getWindow();
237
- return currentWindow ? (currentWindow.innerHeight / 2) - (height / 2) : 0;
238
- };
239
- _this.getInitialLeft = function () {
240
- if (_this.props.left !== undefined) {
241
- return _this.props.left;
242
- }
243
- if (_this.props.initialLeft !== undefined) {
244
- return _this.props.initialLeft;
245
- }
246
- var width = DEFAULT_WIDTH;
247
- if (_this.props.width !== undefined) {
248
- width = _this.props.width;
249
- }
250
- else if (_this.props.initialWidth !== undefined) {
251
- width = _this.props.initialWidth;
252
- }
253
- if (_this.props.appendTo) {
254
- return (_this.props.appendTo.offsetWidth / 2) - (width / 2);
255
- }
256
- var currentWindow = _this.getWindow();
257
- return currentWindow ? (currentWindow.innerWidth / 2) - (width / 2) : 0;
258
- };
259
- _this.getInitialWidth = function () {
260
- var width = DEFAULT_WIDTH;
261
- if (_this.props.width !== undefined) {
262
- width = _this.props.width;
263
- }
264
- else if (_this.props.initialWidth !== undefined) {
265
- width = _this.props.initialWidth;
266
- }
267
- return width;
268
- };
269
- _this.getInitialHeight = function () {
270
- var height = DEFAULT_HEIGHT;
271
- if (_this.props.height !== undefined) {
272
- height = _this.props.height;
273
- }
274
- else if (_this.props.initialHeight !== undefined) {
275
- height = _this.props.initialHeight;
276
- }
277
- return height;
278
- };
279
- // Handle actions
280
- _this.handleMinimize = function (event) {
281
- event.preventDefault();
282
- _this.windowCoordinatesState.leftBeforeAction = _this.left;
283
- _this.windowCoordinatesState.topBeforeAction = _this.top;
284
- _this.windowCoordinatesState.widthBeforeAction = _this.width;
285
- _this.windowCoordinatesState.heightBeforeAction = _this.height;
286
- _this.setState({
287
- stage: StageEnum_1.windowStage.MINIMIZED,
288
- height: 0
289
- });
290
- (0, kendo_react_common_1.dispatchEvent)(_this.props.onStageChange, event, _this, { state: StageEnum_1.windowStage.MINIMIZED });
291
- };
292
- _this.handleFullscreen = function (event) {
293
- event.preventDefault();
294
- _this.windowCoordinatesState.leftBeforeAction = _this.left;
295
- _this.windowCoordinatesState.topBeforeAction = _this.top;
296
- _this.windowCoordinatesState.widthBeforeAction = _this.width;
297
- _this.windowCoordinatesState.heightBeforeAction = _this.height;
298
- var currentWindow = _this.getWindow();
299
- var innerWidth = currentWindow ? currentWindow.innerWidth : 0;
300
- var innerHeight = currentWindow ? currentWindow.innerHeight : 0;
301
- _this.setState({
302
- left: 0,
303
- top: 0,
304
- width: _this.props.appendTo ? _this.props.appendTo.offsetWidth : innerWidth,
305
- height: _this.props.appendTo ? _this.props.appendTo.offsetHeight : innerHeight,
306
- stage: StageEnum_1.windowStage.FULLSCREEN
307
- });
308
- (0, kendo_react_common_1.dispatchEvent)(_this.props.onStageChange, event, _this, { state: StageEnum_1.windowStage.FULLSCREEN });
309
- };
310
- _this.handleRestore = function (event) {
311
- event.preventDefault();
312
- if (_this.windowStage === StageEnum_1.windowStage.FULLSCREEN) {
313
- _this.setState({
314
- stage: StageEnum_1.windowStage.DEFAULT,
315
- left: _this.windowCoordinatesState.leftBeforeAction,
316
- top: _this.windowCoordinatesState.topBeforeAction,
317
- width: _this.windowCoordinatesState.widthBeforeAction,
318
- height: _this.windowCoordinatesState.heightBeforeAction
319
- });
320
- }
321
- else if (_this.windowStage === StageEnum_1.windowStage.MINIMIZED) {
322
- _this.setState({
323
- stage: StageEnum_1.windowStage.DEFAULT,
324
- height: _this.windowCoordinatesState.heightBeforeAction
325
- });
326
- }
327
- (0, kendo_react_common_1.dispatchEvent)(_this.props.onStageChange, event, _this, { state: StageEnum_1.windowStage.DEFAULT });
328
- };
329
- _this.handleCloseWindow = function (event) {
330
- event.preventDefault();
331
- (0, kendo_react_common_1.dispatchEvent)(_this.props.onClose, event, _this, { state: undefined });
332
- };
333
- _this.handleDoubleClick = function (e) {
334
- if (_this.windowStage === StageEnum_1.windowStage.FULLSCREEN || _this.windowStage === StageEnum_1.windowStage.MINIMIZED) {
335
- _this.handleRestore(e);
336
- }
337
- else {
338
- _this.handleFullscreen(e);
339
- }
340
- };
341
- // Handle resizing
342
- _this.handleResize = function (event, props) {
343
- var x = _this.props.appendTo ? event.pageX - _this.offSetCoordinates.x : event.pageX;
344
- var y = _this.props.appendTo ? event.pageY - _this.offSetCoordinates.y : event.pageY;
345
- var currentWidth = _this.width;
346
- var currentHeight = _this.height;
347
- var minWidth = _this.props.minWidth || DEFAULT_MIN_WIDTH;
348
- var minHeight = _this.props.minHeight || DEFAULT_MIN_HEIGHT;
349
- var heightDifference = _this.top - y;
350
- var widthDifference = _this.left - x;
351
- var newWidth = x - _this.left;
352
- var newHeight = y - _this.top;
353
- var newState = Object.assign({}, _this.state, { isDragging: !props.end });
354
- if (props.direction.indexOf('n') >= 0 && minHeight - (currentHeight + heightDifference) < 0) {
355
- if (_this.top > 0) {
356
- newState.height = currentHeight + heightDifference;
357
- }
358
- newState.top = y;
359
- }
360
- if (props.direction.indexOf('s') >= 0 && (minHeight - newHeight < 0)) {
361
- newState.height = newHeight;
362
- }
363
- if (props.direction.indexOf('w') >= 0 && minWidth - (currentWidth + widthDifference) < 0) {
364
- if (_this.left > 0) {
365
- newState.width = currentWidth + widthDifference;
366
- }
367
- newState.left = x;
368
- }
369
- if (props.direction.indexOf('e') >= 0 && (minWidth - newWidth < 0)) {
370
- newState.width = newWidth;
371
- }
372
- _this.setState(newState);
373
- _this.dispatchMoveEvent(_this.props.onResize, event, true, props.end);
374
- };
375
- // Dispatcher for the resize and move events
376
- _this.dispatchMoveEvent = function (callback, event, drag, end) {
377
- if (!callback) {
378
- return;
379
- }
380
- callback.call(undefined, {
381
- nativeEvent: event.nativeEvent ? event.nativeEvent : event.originalEvent,
382
- drag: drag,
383
- end: end,
384
- target: _this,
385
- left: _this.state.left,
386
- top: _this.state.top,
387
- width: _this.state.width,
388
- hight: _this.state.height,
389
- height: _this.state.height
390
- });
391
- };
392
- _this.handleBrowserWindowResize = function () {
393
- if (_this.windowStage === StageEnum_1.windowStage.FULLSCREEN) {
394
- var currentWindow = _this.getWindow();
395
- var innerWidth_1 = currentWindow ? currentWindow.innerWidth : 0;
396
- var innerHeight_1 = currentWindow ? currentWindow.innerHeight : 0;
397
- _this.setState({
398
- width: _this.props.appendTo ? _this.props.appendTo.offsetWidth : innerWidth_1,
399
- height: _this.props.appendTo ? _this.props.appendTo.offsetHeight : innerHeight_1
400
- });
401
- }
402
- };
403
- _this.getCurrentZIndex = function () {
404
- if (!_this.state || _this.context === undefined) {
405
- return _this.context ? _this.context : constants_1.DEFAULT_DIALOGS_ZINDEX;
406
- }
407
- return _this.state.zIndex > (_this.context ? _this.context + constants_1.ZINDEX_DIALOGS_STEP : 0) ? _this.state.zIndex : _this.context + constants_1.ZINDEX_DIALOGS_STEP;
408
- };
409
- _this.getDocument = function () {
410
- return _this.props.appendTo ? _this.props.appendTo.ownerDocument : document;
411
- };
412
- _this.getWindow = function () {
413
- var currentDocument = _this.getDocument();
414
- return currentDocument && currentDocument.defaultView;
415
- };
416
- (0, kendo_react_common_3.validatePackage)(package_metadata_1.packageMetadata);
417
- _this.showLicenseWatermark = (0, kendo_react_common_3.shouldShowValidationUI)(package_metadata_1.packageMetadata);
418
- _this.state = {
419
- stage: _this.props.stage || StageEnum_1.windowStage.DEFAULT,
420
- isDragging: false,
421
- top: _this.getInitialTop(),
422
- left: _this.getInitialLeft(),
423
- width: _this.getInitialWidth(),
424
- height: _this.getInitialHeight(),
425
- focused: true,
426
- zIndex: (0, utils_1.getMaxZIndex)(_this.getCurrentZIndex(), _this.getDocument(), _this._id)
427
- };
428
- _this.windowCoordinatesState = {
429
- leftBeforeAction: _this.getInitialLeft(),
430
- topBeforeAction: _this.getInitialTop(),
431
- widthBeforeAction: _this.getInitialWidth(),
432
- heightBeforeAction: _this.getInitialHeight()
433
- };
434
- return _this;
435
- }
436
- /**
437
- * @hidden
438
- */
439
- WindowWithoutContext.prototype.componentDidMount = function () {
440
- var currentWindow = this.getWindow();
441
- if (currentWindow) {
442
- currentWindow.addEventListener('resize', this.handleBrowserWindowResize);
443
- }
444
- var currentDocument = this.getDocument();
445
- if (this.props.appendTo && currentDocument) {
446
- var containerCoordinates = this.props.appendTo.getBoundingClientRect();
447
- var bodyRect = currentDocument.body.getBoundingClientRect();
448
- this.offSetCoordinates.x = containerCoordinates.left - bodyRect.left;
449
- this.offSetCoordinates.y = containerCoordinates.top - bodyRect.top;
450
- }
451
- this.mounted = true;
452
- };
453
- /**
454
- * @hidden
455
- */
456
- WindowWithoutContext.prototype.componentWillUnmount = function () {
457
- var currentWindow = this.getWindow();
458
- if (currentWindow) {
459
- currentWindow.removeEventListener('resize', this.handleBrowserWindowResize);
460
- }
461
- this.mounted = false;
462
- };
463
- /**
464
- * @hidden
465
- */
466
- WindowWithoutContext.prototype.componentDidUpdate = function () {
467
- var currentDocument = this.getDocument();
468
- if (this.props.appendTo && currentDocument) {
469
- var containerCoordinates = this.props.appendTo.getBoundingClientRect();
470
- var bodyRect = currentDocument.body.getBoundingClientRect();
471
- this.offSetCoordinates.x = containerCoordinates.left - bodyRect.left;
472
- this.offSetCoordinates.y = containerCoordinates.top - bodyRect.top;
473
- }
474
- this.mounted = true;
475
- };
476
- /**
477
- * @hidden
478
- */
479
- WindowWithoutContext.prototype.render = function () {
480
- var _a, _b;
481
- var _this = this;
482
- var elementsArray = React.Children.toArray(this.props.children);
483
- var content = this.getContent(elementsArray);
484
- var actions = this.getActionBar(elementsArray);
485
- var currentZIndex = this.getCurrentZIndex();
486
- var classNamesWindow = (0, kendo_react_common_1.classNames)('k-window', this.props.className, (_a = {},
487
- _a["k-window-".concat(this.props.themeColor)] = this.props.themeColor,
488
- _a['k-window-minimized'] = this.state.stage === 'MINIMIZED',
489
- _a['k-window-focused'] = this.state.focused,
490
- _a));
491
- var windowElement = (React.createElement(kendo_react_common_1.ZIndexContext.Provider, { value: currentZIndex },
492
- React.createElement(React.Fragment, null,
493
- this.props.modal && (React.createElement("div", { className: "k-overlay", style: __assign({ zIndex: currentZIndex }, this.props.overlayStyle) })),
494
- React.createElement("div", __assign({}, (_b = {}, _b[constants_1.DATA_DIALOGS_ID] = this._id, _b), { tabIndex: 0, role: 'dialog', "aria-labelledby": this.titleId, onFocus: this.onFocus, onBlur: this.onBlur, onKeyDown: this.onKeyDown, ref: function (el) {
495
- _this.windowElement = el;
496
- _this.element = el;
497
- }, className: classNamesWindow, style: __assign({ top: this.top, left: this.left, width: this.width, height: this.height || '', zIndex: currentZIndex }, this.props.style) }),
498
- React.createElement(MiddleLayerOptimization_1.MiddleLayerOptimization, { shouldUpdateOnDrag: this.props.shouldUpdateOnDrag || false, isDragging: this.state.isDragging },
499
- React.createElement(kendo_react_common_2.Draggable, { onPress: this.onPress, onDrag: this.onDrag, onRelease: this.onRelease, ref: function (component) { return _this.draggable = component; } },
500
- React.createElement(WindowTitlebar_1.WindowTitleBar, { stage: this.windowStage, onDoubleClick: this.props.doubleClickStageChange ? this.handleDoubleClick : undefined, 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)),
501
- this.windowStage !== StageEnum_1.windowStage.MINIMIZED
502
- ? (React.createElement(React.Fragment, null,
503
- React.createElement("div", { className: "k-window-content" }, content),
504
- actions))
505
- : null,
506
- this.windowStage === StageEnum_1.windowStage.DEFAULT &&
507
- this.props.resizable
508
- ? React.createElement(WindowResizeHandlers_1.ResizeHandlers, { onResize: this.handleResize })
509
- : null),
510
- this.showLicenseWatermark && React.createElement(kendo_react_common_3.WatermarkOverlay, null)))));
511
- if (kendo_react_common_1.canUseDOM) {
512
- return this.props.appendTo !== null ?
513
- ReactDOM.createPortal(windowElement, this.props.appendTo || document.body) :
514
- windowElement;
515
- }
516
- return null;
517
- };
518
- Object.defineProperty(WindowWithoutContext.prototype, "top", {
519
- // Getters
520
- get: function () {
521
- if (this.windowStage !== StageEnum_1.windowStage.FULLSCREEN) {
522
- return Math.max(this.props.top || this.state.top, 0);
523
- }
524
- return 0;
525
- },
526
- enumerable: false,
527
- configurable: true
528
- });
529
- Object.defineProperty(WindowWithoutContext.prototype, "left", {
530
- get: function () {
531
- if (this.windowStage !== StageEnum_1.windowStage.FULLSCREEN) {
532
- return Math.max(this.props.left || this.state.left, 0);
533
- }
534
- return 0;
535
- },
536
- enumerable: false,
537
- configurable: true
538
- });
539
- Object.defineProperty(WindowWithoutContext.prototype, "width", {
540
- get: function () {
541
- var width = this.props.width || this.state.width;
542
- if (this.windowStage === StageEnum_1.windowStage.FULLSCREEN) {
543
- if (this.props.appendTo) {
544
- width = this.props.appendTo.offsetWidth;
545
- return width;
546
- }
547
- var currentWindow = this.getWindow();
548
- width = currentWindow ? currentWindow.innerWidth : 0;
549
- }
550
- return width;
551
- },
552
- enumerable: false,
553
- configurable: true
554
- });
555
- Object.defineProperty(WindowWithoutContext.prototype, "height", {
556
- get: function () {
557
- var height = this.props.height || this.state.height;
558
- if (this.windowStage === StageEnum_1.windowStage.FULLSCREEN) {
559
- if (this.props.appendTo) {
560
- height = this.props.appendTo.offsetHeight;
561
- return height;
562
- }
563
- var currentWindow = this.getWindow();
564
- height = currentWindow ? currentWindow.innerHeight : 0;
565
- }
566
- else if (this.windowStage === StageEnum_1.windowStage.MINIMIZED) {
567
- height = 0;
568
- }
569
- return height;
570
- },
571
- enumerable: false,
572
- configurable: true
573
- });
574
- Object.defineProperty(WindowWithoutContext.prototype, "windowStage", {
575
- get: function () {
576
- return this.props.stage || this.state.stage;
577
- },
578
- enumerable: false,
579
- configurable: true
580
- });
581
- WindowWithoutContext.prototype.getActionBar = function (children) {
582
- return children.filter(function (child) { return child && child.type === WindowActionsBar_1.WindowActionsBar; });
583
- };
584
- WindowWithoutContext.prototype.getContent = function (children) {
585
- return children.filter(function (child) {
586
- return child && child.type !== WindowActionsBar_1.WindowActionsBar;
587
- });
588
- };
589
- WindowWithoutContext.prototype.generateTitleId = function () {
590
- return 'window-title-' + this._id;
591
- };
592
- WindowWithoutContext.displayName = 'Window';
593
- /**
594
- * @hidden
595
- */
596
- WindowWithoutContext.propTypes = {
597
- width: PropTypes.number,
598
- height: PropTypes.number,
599
- left: PropTypes.number,
600
- top: PropTypes.number,
601
- initialWidth: PropTypes.number,
602
- initialHeight: PropTypes.number,
603
- initialLeft: PropTypes.number,
604
- initialTop: PropTypes.number,
605
- minWidth: PropTypes.number,
606
- minHeight: PropTypes.number,
607
- resizable: PropTypes.bool,
608
- draggable: PropTypes.bool,
609
- title: PropTypes.any,
610
- shouldUpdateOnDrag: PropTypes.bool,
611
- stage: PropTypes.oneOf(['DEFAULT', 'MINIMIZED', 'FULLSCREEN']),
612
- className: PropTypes.string,
613
- style: PropTypes.object,
614
- overlayStyle: PropTypes.object
615
- };
616
- /**
617
- * @hidden
618
- */
619
- WindowWithoutContext.defaultProps = {
620
- minWidth: DEFAULT_MIN_WIDTH,
621
- minHeight: DEFAULT_MIN_HEIGHT,
622
- resizable: true,
623
- draggable: true,
624
- modal: false,
625
- doubleClickStageChange: true
626
- };
627
- /**
628
- * @hidden
629
- */
630
- WindowWithoutContext.contextType = kendo_react_common_1.ZIndexContext;
631
- return WindowWithoutContext;
632
- }(React.Component));
633
- /**
634
- * Represents the PropsContext of the `Window` component.
635
- * Used for global configuration of all `Window` instances.
636
- */
637
- exports.WindowPropsContext = (0, kendo_react_common_2.createPropsContext)();
638
- /* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
639
- /**
640
- * Represents the [KendoReact Window component]({% slug overview_window %}).
641
- *
642
- * Accepts properties of type [WindowProps]({% slug api_dialogs_windowprops %}).
643
- * Obtaining the `ref` returns an object of type [WindowHandle]({% slug api_dialogs_windowhandle %}).
644
- */
645
- exports.Window = (0, kendo_react_common_2.withPropsContext)(exports.WindowPropsContext, WindowWithoutContext);
646
- exports.Window.displayName = 'KendoReactWindow';
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.WindowActionsBar = void 0;
15
- var React = require("react");
16
- var PropTypes = require("prop-types");
17
- var kendo_react_common_1 = require("@progress/kendo-react-common");
18
- /**
19
- * Returns the action bar of the Window.
20
- *
21
- * @returns React.ReactElement
22
- */
23
- var WindowActionsBar = function (props) {
24
- var combinedProps = __assign({ layout: 'end' }, props);
25
- var layout = combinedProps.layout, children = combinedProps.children;
26
- var wrapperClasses = (0, kendo_react_common_1.classNames)('k-actions', 'k-window-actions', 'k-actions-horizontal', 'k-hstack', {
27
- 'k-justify-content-start': layout === 'start',
28
- 'k-justify-content-center': layout === 'center',
29
- 'k-justify-content-end': layout === 'end',
30
- 'k-justify-content-stretch': layout === 'stretched'
31
- });
32
- return (React.createElement("div", { className: wrapperClasses }, children));
33
- };
34
- exports.WindowActionsBar = WindowActionsBar;
35
- exports.WindowActionsBar.propTypes = {
36
- children: PropTypes.any,
37
- layout: PropTypes.oneOf(['start', 'center', 'end', 'stretched'])
38
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // tslint:enable:max-line-length