evui 3.4.59 → 3.4.60

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.
@@ -11139,7 +11139,7 @@ $({ target: 'Number', stat: true }, {
11139
11139
  /***/ "9224":
11140
11140
  /***/ (function(module) {
11141
11141
 
11142
- module.exports = JSON.parse("{\"a\":\"3.4.59\"}");
11142
+ module.exports = JSON.parse("{\"a\":\"3.4.60\"}");
11143
11143
 
11144
11144
  /***/ }),
11145
11145
 
@@ -18285,7 +18285,7 @@ var uses_useDropdown = function useDropdown(param) {
18285
18285
 
18286
18286
  var calculateDropboxWidth = /*#__PURE__*/function () {
18287
18287
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
18288
- var items, maxWidth, windowWidth, dropboxRect, dropboxLeft, rightMargin, maxAllowedWidth, finalWidth;
18288
+ var items, maxWidth, itemPadding, windowWidth, dropboxRect, dropboxLeft, maxAllowedWidth, finalWidth;
18289
18289
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
18290
18290
  while (1) {
18291
18291
  switch (_context4.prev = _context4.next) {
@@ -18299,26 +18299,35 @@ var uses_useDropdown = function useDropdown(param) {
18299
18299
  return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["nextTick"])();
18300
18300
 
18301
18301
  case 3:
18302
- if (initialDropboxWidth.value === null) {
18303
- initialDropboxWidth.value = dropbox.value.offsetWidth;
18302
+ if (initialDropboxWidth.value === null || initialDropboxWidth.value !== selectWrapper.value.offsetWidth) {
18303
+ initialDropboxWidth.value = selectWrapper.value.offsetWidth;
18304
18304
  }
18305
18305
 
18306
18306
  items = itemWrapper.value.querySelectorAll('.ev-select-dropbox-item');
18307
18307
  maxWidth = 0;
18308
+ itemPadding = 0;
18308
18309
  items.forEach(function (item) {
18309
18310
  var itemWidth = item.scrollWidth;
18310
18311
 
18311
18312
  if (itemWidth > maxWidth) {
18312
18313
  maxWidth = itemWidth;
18313
18314
  }
18315
+
18316
+ if (itemPadding === 0) {
18317
+ var style = window.getComputedStyle(item);
18318
+ itemPadding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
18319
+ }
18314
18320
  });
18315
18321
  windowWidth = window.innerWidth;
18316
18322
  dropboxRect = dropbox.value.getBoundingClientRect();
18317
18323
  dropboxLeft = dropboxRect.left;
18318
- rightMargin = Math.max(windowWidth - (dropboxLeft + maxWidth), 10);
18319
- maxAllowedWidth = windowWidth - dropboxLeft - rightMargin - 10;
18324
+ maxAllowedWidth = windowWidth - dropboxLeft - itemPadding - 10;
18320
18325
  finalWidth = Math.max(Math.min(maxWidth, maxAllowedWidth), initialDropboxWidth.value);
18321
- dropboxWidth.value = "".concat(Math.max(finalWidth, 100), "px");
18326
+
18327
+ if (initialDropboxWidth.value < maxWidth) {
18328
+ dropboxWidth.value = "".concat(Math.max(finalWidth + itemPadding - 10, 100), "px");
18329
+ }
18330
+
18322
18331
  _context4.next = 17;
18323
18332
  break;
18324
18333
 
@@ -18537,11 +18546,19 @@ var uses_useDropdown = function useDropdown(param) {
18537
18546
  changeDropboxPosition();
18538
18547
  }
18539
18548
  });
18549
+
18550
+ var handleResize = function handleResize() {
18551
+ if (isDropbox.value) {
18552
+ calculateDropboxWidth();
18553
+ changeDropboxPosition();
18554
+ }
18555
+ };
18556
+
18540
18557
  Object(external_commonjs_vue_commonjs2_vue_root_Vue_["onMounted"])(function () {
18541
- window.addEventListener('resize', calculateDropboxWidth);
18558
+ window.addEventListener('resize', handleResize);
18542
18559
  });
18543
18560
  Object(external_commonjs_vue_commonjs2_vue_root_Vue_["onUnmounted"])(function () {
18544
- window.removeEventListener('resize', calculateDropboxWidth);
18561
+ window.removeEventListener('resize', handleResize);
18545
18562
  });
18546
18563
  return {
18547
18564
  select: select,