@opentiny/vue-renderless 3.6.6 → 3.6.8

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.
@@ -93,36 +93,36 @@ const isScrollElement = (el) => {
93
93
  return scrollTypes.includes(getStyleComputedProperty(el, "overflow")) || scrollTypes.includes(getStyleComputedProperty(el, "overflow-x")) || scrollTypes.includes(getStyleComputedProperty(el, "overflow-y"));
94
94
  };
95
95
  const getScrollParent = (el) => {
96
- let parent2 = el.parentNode;
97
- if (!parent2) {
96
+ let parent = el.parentNode;
97
+ if (!parent) {
98
98
  return el;
99
99
  }
100
- if (parent2 === win.document) {
100
+ if (parent === win.document) {
101
101
  if (win.document.body.scrollTop || win.document.body.scrollLeft) {
102
102
  return win.document.body;
103
103
  }
104
104
  return win.document.documentElement;
105
105
  }
106
- if (isScrollElement(parent2)) {
107
- return parent2;
106
+ if (isScrollElement(parent)) {
107
+ return parent;
108
108
  }
109
109
  return getScrollParent(el.parentNode);
110
110
  };
111
- const getOffsetRectRelativeToCustomPopper = (el, popper, fixed) => {
111
+ const getOffsetRectRelativeToCustomParent = (el, parent, fixed) => {
112
112
  let { top, left, width, height } = getBoundingClientRect(el);
113
- let popperRect = getBoundingClientRect(popper);
113
+ let parentRect = getBoundingClientRect(parent);
114
114
  if (fixed) {
115
115
  let { scrollTop, scrollLeft } = getScrollParent(parent);
116
- popperRect.top += scrollTop;
117
- popperRect.bottom += scrollTop;
118
- popperRect.left += scrollLeft;
119
- popperRect.right += scrollLeft;
116
+ parentRect.top += scrollTop;
117
+ parentRect.bottom += scrollTop;
118
+ parentRect.left += scrollLeft;
119
+ parentRect.right += scrollLeft;
120
120
  }
121
121
  let rect = {
122
- top: top - popperRect.top,
123
- left: left - popperRect.left,
124
- bottom: top - popperRect.top + height,
125
- right: left - popperRect.left + width,
122
+ top: top - parentRect.top,
123
+ left: left - parentRect.left,
124
+ bottom: top - parentRect.top + height,
125
+ right: left - parentRect.left + width,
126
126
  width,
127
127
  height
128
128
  };
@@ -180,10 +180,10 @@ const getArrayKeyIndex = (arr, keyToFind) => {
180
180
  return null;
181
181
  };
182
182
  const getAllScrollParents = (el, parents = []) => {
183
- const parent2 = el.parentNode;
184
- if (parent2) {
185
- isScrollElement(parent2) && parents.push(parent2);
186
- return getAllScrollParents(parent2, parents);
183
+ const parent = el.parentNode;
184
+ if (parent) {
185
+ isScrollElement(parent) && parents.push(parent);
186
+ return getAllScrollParents(parent, parents);
187
187
  }
188
188
  return parents;
189
189
  };
@@ -286,19 +286,19 @@ Popper.prototype.parse = function(config) {
286
286
  addAttributes(arrow, config.arrowAttributes);
287
287
  popper.appendChild(arrow);
288
288
  }
289
- let parent2 = getRealElement(config.parent);
290
- if (typeof parent2 === "string") {
291
- parent2 = docEl.querySelectorAll(config.parent);
292
- if (parent2 && parent2.length) {
293
- parent2 = parent2[0];
289
+ let parent = getRealElement(config.parent);
290
+ if (typeof parent === "string") {
291
+ parent = docEl.querySelectorAll(config.parent);
292
+ if (parent && parent.length) {
293
+ parent = parent[0];
294
294
  } else {
295
295
  throw new Error("ERROR: the given `parent` does not exists!");
296
296
  }
297
297
  }
298
- if (parent2.length > 1 && parent2 instanceof Element === false) {
299
- parent2 = parent2[0];
298
+ if (parent.length > 1 && parent instanceof Element === false) {
299
+ parent = parent[0];
300
300
  }
301
- parent2.appendChild(popper);
301
+ parent.appendChild(popper);
302
302
  return popper;
303
303
  };
304
304
  Popper.prototype._getPosition = function(popper, reference) {
@@ -311,21 +311,10 @@ Popper.prototype._getPosition = function(popper, reference) {
311
311
  };
312
312
  Popper.prototype._getOffsets = function(popper, reference, placement) {
313
313
  placement = placement.split("-")[0];
314
- let popperOffsets = {
315
- position: this.state.position,
316
- left: 0,
317
- top: 0,
318
- width: 0,
319
- height: 0
320
- };
314
+ let popperOffsets = {};
321
315
  popperOffsets.position = this.state.position;
322
316
  let isParentFixed = popperOffsets.position === "fixed";
323
- popper.style.left = "0";
324
- popper.style.top = "0";
325
- const originMargin = popper.style.margin;
326
- popper.style.margin = "0";
327
- let referenceOffsets = getOffsetRectRelativeToCustomPopper(reference, popper, isParentFixed);
328
- popper.style.margin = originMargin;
317
+ let referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
329
318
  let { width, height } = this.popperOuterSize ? this.popperOuterSize : this.popperOuterSize = getOuterSizes(popper);
330
319
  if (~["right", "left"].indexOf(placement)) {
331
320
  popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - height / 2;
@@ -14,12 +14,12 @@ const computedStyle = ({ props, state }) => () => {
14
14
  top = computedAddUnit(top);
15
15
  if (!state.isFull) {
16
16
  style.width = width;
17
- style.top = top;
17
+ style.top = state.top || top;
18
18
  if (rightSlide) {
19
19
  style.right = 0;
20
20
  style.height = "calc(100vh - " + style.top + ")";
21
21
  } else {
22
- style.left = "calc((100vw - " + width + ") / 2)";
22
+ style.left = state.left || "calc((100vw - " + width + ") / 2)";
23
23
  }
24
24
  }
25
25
  return style;
@@ -171,6 +171,8 @@ const handleDrag = ({ parent, props, state, emit }) => (event) => {
171
171
  top = top < 0 ? 0 : top > maxY ? maxY : top;
172
172
  modalBoxElem.style.left = `${left}px`;
173
173
  modalBoxElem.style.top = `${top}px`;
174
+ state.left = `${left}px`;
175
+ state.top = `${top}px`;
174
176
  state.emitter.emit("boxdrag");
175
177
  emit("drag-move", event2);
176
178
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.6.6",
3
+ "version": "3.6.8",
4
4
  "description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
5
5
  "homepage": "https://opentiny.design/tiny-vue",
6
6
  "keywords": [
package/upload/index.js CHANGED
@@ -239,7 +239,6 @@ const mounted = ({ state, props, api }) => () => {
239
239
  state.updateInput = Object.freeze(updateInput);
240
240
  };
241
241
  const onBeforeDestroy = (state) => () => {
242
- state.updateInput.onchange = null;
243
242
  state.updateInput = null;
244
243
  };
245
244
  export {