@progress/kendo-vue-popup 3.6.4 → 3.7.0-dev.202210250731

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/esm/util.js CHANGED
@@ -2,7 +2,6 @@ import { parents, siblingContainer } from '@progress/kendo-popup-common';
2
2
  /**
3
3
  * @hidden
4
4
  */
5
-
6
5
  export var eitherRect = function eitherRect(rect, offset) {
7
6
  if (!rect) {
8
7
  return {
@@ -12,18 +11,15 @@ export var eitherRect = function eitherRect(rect, offset) {
12
11
  width: 0
13
12
  };
14
13
  }
15
-
16
14
  return rect;
17
15
  };
18
16
  /**
19
17
  * @hidden
20
18
  */
21
-
22
19
  export var replaceOffset = function replaceOffset(rect, offset) {
23
20
  if (!offset) {
24
21
  return rect;
25
22
  }
26
-
27
23
  var result = {
28
24
  height: rect.height,
29
25
  left: offset.left,
@@ -35,12 +31,10 @@ export var replaceOffset = function replaceOffset(rect, offset) {
35
31
  /**
36
32
  * @hidden
37
33
  */
38
-
39
34
  export var removeStackingOffset = function removeStackingOffset(rect, stackingOffset) {
40
35
  if (!stackingOffset) {
41
36
  return rect;
42
37
  }
43
-
44
38
  var result = {
45
39
  height: rect.height,
46
40
  left: rect.left - stackingOffset.left,
@@ -52,44 +46,38 @@ export var removeStackingOffset = function removeStackingOffset(rect, stackingOf
52
46
  /**
53
47
  * @hidden
54
48
  */
55
-
56
49
  export var isDifferentOffset = function isDifferentOffset(oldOffset, newOffset) {
57
50
  var oldLeft = oldOffset.left,
58
- oldTop = oldOffset.top;
51
+ oldTop = oldOffset.top;
59
52
  var newLeft = newOffset.left,
60
- newTop = newOffset.top;
53
+ newTop = newOffset.top;
61
54
  return Math.abs(oldLeft - newLeft) >= 1 || Math.abs(oldTop - newTop) >= 1;
62
55
  };
63
56
  /**
64
57
  * @hidden
65
58
  */
66
-
67
59
  export var isDocumentAvailable = function isDocumentAvailable() {
68
60
  return typeof document !== 'undefined' && !!document.body;
69
61
  };
70
62
  /**
71
63
  * @hidden
72
64
  */
73
-
74
65
  export var isWindowAvailable = function isWindowAvailable() {
75
66
  return typeof window !== 'undefined';
76
67
  };
77
68
  /**
78
69
  * @hidden
79
70
  */
80
-
81
71
  export var hasBoundingRect = function hasBoundingRect(elem) {
82
72
  return !!elem.getBoundingClientRect;
83
73
  };
84
74
  /**
85
75
  * @hidden
86
76
  */
87
-
88
77
  export var OVERFLOW_REGEXP = /auto|scroll/;
89
78
  /**
90
79
  * @hidden
91
80
  */
92
-
93
81
  var overflowStyle = function overflowStyle(element) {
94
82
  var styles = window.getComputedStyle(element);
95
83
  return "".concat(styles.overflow).concat(styles.overflowX).concat(styles.overflowY);
@@ -97,55 +85,42 @@ var overflowStyle = function overflowStyle(element) {
97
85
  /**
98
86
  * @hidden
99
87
  */
100
-
101
-
102
88
  export var scrollableParents = function scrollableParents(element) {
103
89
  var parentElements = [];
104
-
105
90
  if (!isDocumentAvailable() || !isWindowAvailable()) {
106
91
  return parentElements;
107
92
  }
108
-
109
93
  var parent = element.parentElement;
110
-
111
94
  while (parent) {
112
95
  if (OVERFLOW_REGEXP.test(overflowStyle(parent))) {
113
96
  parentElements.push(parent);
114
97
  }
115
-
116
98
  parent = parent.parentElement;
117
99
  }
118
-
119
100
  parentElements.push(window);
120
101
  return parentElements;
121
102
  };
122
103
  /**
123
104
  * @hidden
124
105
  */
125
-
126
106
  export var FRAME_DURATION = 1000 / 60; // 1000ms divided by 60fps
127
-
128
107
  /**
129
108
  * @hidden
130
109
  */
131
-
132
110
  export var hasRelativeStackingContext = function hasRelativeStackingContext() {
133
111
  if (!isDocumentAvailable()) {
134
112
  return false;
135
113
  }
136
-
137
114
  var top = 10;
138
115
  var parent = document.createElement('div');
139
116
  parent.style.transform = 'matrix(10, 0, 0, 10, 0, 0)';
140
117
  parent.innerHTML = "<div>child</div>";
141
118
  document.body.appendChild(parent);
142
-
143
119
  if (parent && parent.firstChild) {
144
120
  var firstChild = parent.firstChild;
145
121
  firstChild.style.position = 'fixed';
146
122
  firstChild.style.top = "".concat(top, "px");
147
123
  }
148
-
149
124
  var isDifferent = parent.children[0].getBoundingClientRect().top !== top;
150
125
  document.body.removeChild(parent);
151
126
  return isDifferent;
@@ -153,23 +128,18 @@ export var hasRelativeStackingContext = function hasRelativeStackingContext() {
153
128
  /**
154
129
  * @hidden
155
130
  */
156
-
157
131
  export var HAS_RELATIVE_STACKING_CONTEXT = hasRelativeStackingContext();
158
132
  /**
159
133
  * @hidden
160
134
  */
161
-
162
135
  export var zIndex = function zIndex(anchor, container) {
163
136
  if (!anchor || !isDocumentAvailable() || !isWindowAvailable()) {
164
137
  return null;
165
138
  }
166
-
167
139
  var sibling = siblingContainer(anchor, container);
168
-
169
140
  if (!sibling) {
170
141
  return null;
171
142
  }
172
-
173
143
  var result = [anchor].concat(parents(anchor, sibling)).reduce(function (index, p) {
174
144
  var zIndexStyle = p.style.zIndex || window.getComputedStyle(p).zIndex;
175
145
  var current = parseInt(zIndexStyle, 10);
@@ -180,7 +150,6 @@ export var zIndex = function zIndex(anchor, container) {
180
150
  /**
181
151
  * @hidden
182
152
  */
183
-
184
153
  export var CollisionType = {
185
154
  fit: 'fit',
186
155
  flip: 'flip'
@@ -188,7 +157,6 @@ export var CollisionType = {
188
157
  /**
189
158
  * @hidden
190
159
  */
191
-
192
160
  export var AlignPoint = {
193
161
  left: 'left',
194
162
  center: 'center',
@@ -199,56 +167,44 @@ export var AlignPoint = {
199
167
  /**
200
168
  * @hidden
201
169
  */
202
-
203
170
  export var throttle = function throttle(func, wait, options) {
204
171
  if (options === void 0) {
205
172
  options = {};
206
173
  }
207
-
208
174
  var timeout, context, args, result;
209
175
  var previous = 0;
210
176
  options = options || {};
211
-
212
177
  var later = function later() {
213
178
  previous = options.leading === false ? 0 : new Date().getTime();
214
179
  timeout = null;
215
180
  result = func.apply(context, args);
216
-
217
181
  if (!timeout) {
218
182
  context = args = null;
219
183
  }
220
184
  };
221
-
222
185
  var throttled = function throttled() {
223
186
  var now = new Date().getTime();
224
-
225
187
  if (!previous && options.leading === false) {
226
188
  previous = now;
227
189
  }
228
-
229
- var remaining = wait - (now - previous); // @ts-ignore
230
-
190
+ var remaining = wait - (now - previous);
191
+ // @ts-ignore
231
192
  context = this;
232
193
  args = arguments;
233
-
234
194
  if (remaining <= 0 || remaining > wait) {
235
195
  if (timeout) {
236
196
  clearTimeout(timeout);
237
197
  timeout = null;
238
198
  }
239
-
240
199
  previous = now;
241
200
  result = func.apply(context, args);
242
-
243
201
  if (!timeout) {
244
202
  context = args = null;
245
203
  }
246
204
  } else if (!timeout && options.trailing !== false) {
247
205
  timeout = setTimeout(later, remaining);
248
206
  }
249
-
250
207
  return result;
251
208
  };
252
-
253
209
  return throttled;
254
210
  };
package/dist/npm/Popup.js CHANGED
@@ -3,28 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PopupVue2 = exports.Popup = void 0; // @ts-ignore
7
-
6
+ exports.PopupVue2 = exports.Popup = void 0;
7
+ // @ts-ignore
8
8
  var Vue = require("vue");
9
-
10
9
  var allVue = Vue;
11
10
  var gh = allVue.h;
12
11
  var isV3 = allVue.version && allVue.version[0] === '3';
13
-
14
12
  var kendo_vue_animation_1 = require("@progress/kendo-vue-animation");
15
-
16
13
  var util_1 = require("./util");
17
-
18
14
  var alignService_1 = require("./services/alignService");
19
-
20
15
  var domService_1 = require("./services/domService");
21
-
22
16
  var positionService_1 = require("./services/positionService");
23
-
24
17
  var kendo_vue_common_1 = require("@progress/kendo-vue-common");
25
-
26
18
  var package_metadata_1 = require("./package-metadata");
27
-
28
19
  var DEFAULT_POPUP_ZINDEX = 100;
29
20
  var ZINDEX_POPUP_STEP = 1;
30
21
  var DEFAULT_OFFSET = {
@@ -37,7 +28,6 @@ var K_POPUP = 'k-popup';
37
28
  /**
38
29
  * @hidden
39
30
  */
40
-
41
31
  var PopupVue2 = {
42
32
  name: 'Popup',
43
33
  props: {
@@ -142,7 +132,6 @@ var PopupVue2 = {
142
132
  this.mountedAppendTo = this.appendTo ? this.getParentRef(this.appendTo) : document.body;
143
133
  this.mountedAnchor = this.anchor ? this.getParentRef(this.anchor, true) : document.body;
144
134
  }
145
-
146
135
  this._parentElement = this.$el.parentElement;
147
136
  this._clonedElement = this.$el.cloneNode(true);
148
137
  this.hasMounted = true;
@@ -172,11 +161,9 @@ var PopupVue2 = {
172
161
  methods: {
173
162
  onOpened: function onOpened() {
174
163
  var element = this.$el;
175
-
176
164
  if (this.$props.show) {
177
165
  element.classList.add(ANIMATION_CONTAINER_SHOWN);
178
166
  }
179
-
180
167
  this.attachRepositionHandlers(element);
181
168
  this.$emit('open', {
182
169
  target: this
@@ -187,7 +174,6 @@ var PopupVue2 = {
187
174
  var element = this.$el;
188
175
  element.classList.remove(ANIMATION_CONTAINER_SHOWN);
189
176
  }
190
-
191
177
  this.detachRepositionHandlers();
192
178
  },
193
179
  onClosed: function onClosed() {
@@ -195,7 +181,6 @@ var PopupVue2 = {
195
181
  this._exitingAnimation = false;
196
182
  this.$forceUpdate();
197
183
  }
198
-
199
184
  this.$emit('close', {
200
185
  target: this
201
186
  });
@@ -204,7 +189,6 @@ var PopupVue2 = {
204
189
  var animate = this.$props.animate;
205
190
  var transitionEnterDuration = 0;
206
191
  var transitionExitDuration = 0;
207
-
208
192
  if (animate) {
209
193
  if (animate === true) {
210
194
  // Inherit the default duration of the Animation component.
@@ -214,7 +198,6 @@ var PopupVue2 = {
214
198
  transitionExitDuration = animate.closeDuration;
215
199
  }
216
200
  }
217
-
218
201
  return {
219
202
  transitionEnterDuration: transitionEnterDuration,
220
203
  transitionExitDuration: transitionExitDuration
@@ -223,32 +206,27 @@ var PopupVue2 = {
223
206
  getParentRef: function getParentRef(anchor, isAnchor) {
224
207
  // @ts-ignore
225
208
  var parent = this.$parent;
226
-
227
209
  while (!parent.$refs[anchor]) {
228
210
  // @ts-ignore
229
211
  if (parent && parent.kendoAnchorRef && isAnchor) {
230
212
  // @ts-ignore
231
213
  return parent.kendoAnchorRef;
232
- } // @ts-ignore
233
-
234
-
214
+ }
215
+ // @ts-ignore
235
216
  parent = parent.$parent;
236
-
237
217
  if (!parent && kendo_vue_common_1.canUseDOM) {
238
218
  return document.getElementById(anchor) || document.body;
239
219
  }
240
- } // @ts-ignore
241
-
242
-
220
+ }
221
+ // @ts-ignore
243
222
  return parent.$refs[anchor].$el || parent.$refs[anchor];
244
223
  },
245
224
  position: function position(settings, element, anchor) {
246
225
  var anchorAlign = settings.anchorAlign,
247
- popupAlign = settings.popupAlign,
248
- collision = settings.collision,
249
- offset = settings.offset;
226
+ popupAlign = settings.popupAlign,
227
+ collision = settings.collision,
228
+ offset = settings.offset;
250
229
  var anchorElement = anchor ? this.v3 ? this.mountedAnchor : this.getParentRef(anchor, true) : document.body;
251
-
252
230
  var alignedOffset = this._alignService.alignElement({
253
231
  anchor: anchor ? anchorElement : undefined,
254
232
  element: element,
@@ -256,7 +234,6 @@ var PopupVue2 = {
256
234
  anchorAlign: anchorAlign,
257
235
  offset: offset
258
236
  });
259
-
260
237
  var result = this._positionService.positionElement({
261
238
  anchor: anchorElement,
262
239
  anchorAlign: anchorAlign,
@@ -265,7 +242,6 @@ var PopupVue2 = {
265
242
  currentLocation: alignedOffset,
266
243
  elementAlign: popupAlign
267
244
  });
268
-
269
245
  return result;
270
246
  },
271
247
  calculatePosition: function calculatePosition($props, appendToElement) {
@@ -275,24 +251,20 @@ var PopupVue2 = {
275
251
  offset: $props.offset
276
252
  };
277
253
  }
278
-
279
254
  var defaultSlot = (0, kendo_vue_common_1.getDefaultSlots)(this);
280
255
  var root = document.createElement('div');
281
256
  var contentElement = this.$el && this.$el.firstChild ? this.$el.firstChild.firstChild ? this.$el.firstChild.firstChild.cloneNode(true) : null : null;
282
257
  var divWrapper = contentElement && contentElement.getBoundingClientRect ? contentElement : this._clonedElement;
283
-
284
258
  if (divWrapper) {
285
259
  root.appendChild(divWrapper);
286
260
  } else {
287
261
  // @ts-ignore
288
- var internalClass = this.v3 ? defaultSlot && defaultSlot[0].props ? defaultSlot[0].props.class : '' : defaultSlot && defaultSlot[0].data ? defaultSlot[0].data.staticClass : ''; // @ts-ignore
289
-
262
+ var internalClass = this.v3 ? defaultSlot && defaultSlot[0].props ? defaultSlot[0].props.class : '' : defaultSlot && defaultSlot[0].data ? defaultSlot[0].data.staticClass : '';
263
+ // @ts-ignore
290
264
  var domClass = this.v3 ? this.$props.popupClass ? this.$props.popupClass : '' : defaultSlot && defaultSlot[0].data ? defaultSlot[0].data.class : '';
291
265
  root.innerHTML = "<div class=\"k-animation-container k-animation-container-relative\">\t\n <div class=\"k-popup k-animation-container k-animation-container-relative\">\n <div class=\"".concat(internalClass, " ").concat(domClass, "\" >\n </div>\t\n </div>\t\n </div>");
292
266
  }
293
-
294
267
  appendToElement.appendChild(root);
295
-
296
268
  if (root && root.firstChild) {
297
269
  var firstChild = root.firstChild;
298
270
  firstChild.style.position = 'absolute';
@@ -301,44 +273,36 @@ var PopupVue2 = {
301
273
  firstChild.style.left = '-1000';
302
274
  firstChild.style.top = '0';
303
275
  var inlineStyles = this.v3 ? defaultSlot && defaultSlot[0].props ? defaultSlot[0].props.style : {} : defaultSlot[0].data ? defaultSlot[0].data.style : {};
304
-
305
276
  if (inlineStyles) {
306
277
  for (var _i = 0, _a = Object.entries(inlineStyles); _i < _a.length; _i++) {
307
278
  var _b = _a[_i],
308
- key = _b[0],
309
- value = _b[1];
279
+ key = _b[0],
280
+ value = _b[1];
310
281
  firstChild.style[key] = value;
311
282
  }
312
283
  }
313
284
  }
314
-
315
285
  var newPosition = this.position($props, root.firstChild, this.$props.anchor);
316
286
  root.parentNode.removeChild(root);
317
287
  return newPosition;
318
288
  },
319
289
  attachRepositionHandlers: function attachRepositionHandlers(element) {
320
290
  var _this = this;
321
-
322
291
  this.detachRepositionHandlers();
323
292
  this._scrollableParents = this._domService.scrollableParents(this.$props.anchor ? this.mountedAnchor : element);
324
-
325
293
  this._scrollableParents.map(function (p) {
326
294
  return p.addEventListener('scroll', _this.reposition);
327
295
  });
328
-
329
296
  window.addEventListener('resize', this.reposition);
330
297
  },
331
298
  detachRepositionHandlers: function detachRepositionHandlers() {
332
299
  var _this = this;
333
-
334
300
  if (this._scrollableParents) {
335
301
  this._scrollableParents.map(function (p) {
336
302
  return p.removeEventListener('scroll', _this.reposition);
337
303
  });
338
-
339
304
  this._scrollableParents = undefined;
340
305
  }
341
-
342
306
  window.removeEventListener('resize', this.reposition);
343
307
  },
344
308
  reposition: function reposition() {
@@ -353,30 +317,25 @@ var PopupVue2 = {
353
317
  render: function render(createElement) {
354
318
  var h = gh || createElement;
355
319
  var _a = this.$props,
356
- className = _a.className,
357
- popupClass = _a.popupClass,
358
- show = _a.show,
359
- id = _a.id;
320
+ className = _a.className,
321
+ popupClass = _a.popupClass,
322
+ show = _a.show,
323
+ id = _a.id;
360
324
  var defaultSlots = (0, kendo_vue_common_1.getDefaultSlots)(this);
361
325
  var defaultSlot = this.v3 ? defaultSlots : show ? defaultSlots : null;
362
326
  var defaultAppentTo = (0, util_1.isWindowAvailable)() ? this.$props.appendTo ? this.mountedAppendTo || this.getParentRef(this.$props.appendTo) : document.body : undefined;
363
-
364
327
  if (this.$props.show) {
365
328
  var newPosition = this.calculatePosition(this.$props, defaultAppentTo);
366
329
  this._offsetLeft = newPosition.offset.left;
367
330
  this._offsetTop = newPosition.offset.top;
368
331
  this._flipped = !!newPosition.flipped;
369
332
  }
370
-
371
333
  var direction = this._flipped ? 'up' : 'down';
372
-
373
334
  var _b = this.transitionDuration(),
374
- transitionEnterDuration = _b.transitionEnterDuration,
375
- transitionExitDuration = _b.transitionExitDuration;
376
-
335
+ transitionEnterDuration = _b.transitionEnterDuration,
336
+ transitionExitDuration = _b.transitionExitDuration;
377
337
  var currentZIndex = this.getCurrentZIndex();
378
338
  this._exitingAnimation = this._exitingAnimation || this._prevShow && !show;
379
-
380
339
  if (!this.hasMounted) {
381
340
  return h("div", {
382
341
  style: {
@@ -387,9 +346,9 @@ var PopupVue2 = {
387
346
  "class": [popupClass, K_POPUP]
388
347
  }, [defaultSlots])]);
389
348
  }
390
-
391
349
  if (show || this._exitingAnimation && defaultAppentTo) {
392
- var popup = // @ts-ignore function children
350
+ var popup =
351
+ // @ts-ignore function children
393
352
  h(kendo_vue_animation_1.Slide, {
394
353
  id: id,
395
354
  attrs: this.v3 ? undefined : {
@@ -428,7 +387,6 @@ var PopupVue2 = {
428
387
  } : [defaultSlot]);
429
388
  return popup;
430
389
  }
431
-
432
390
  return null;
433
391
  }
434
392
  };
@@ -436,6 +394,5 @@ exports.PopupVue2 = PopupVue2;
436
394
  /**
437
395
  * @hidden
438
396
  */
439
-
440
397
  var Popup = PopupVue2;
441
398
  exports.Popup = Popup;
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-vue-popup',
9
9
  productName: 'Kendo UI for Vue',
10
10
  productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
11
- publishDate: 1665151053,
11
+ publishDate: 1666682064,
12
12
  version: '',
13
13
  licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
14
14
  };