vue3-extended-multiselect 2.3.0 → 2.3.2

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # vue3-extended-multiselect v2.3.0
1
+ # vue3-extended-multiselect v2.3.2
2
2
 
3
3
  ***
4
4
 
@@ -345,12 +345,12 @@ const _hoisted_2$e = /*#__PURE__*/vue.createElementVNode("g", null, [
345
345
  /*#__PURE__*/vue.createElementVNode("path", { d: "M96.1,103.6c-10.4,8.4-23.5,12.4-36.8,11.1c-10.5-1-20.3-5.1-28.2-11.8H44v-8H18v26h8v-11.9c9.1,7.7,20.4,12.5,32.6,13.6 c1.9,0.2,3.7,0.3,5.5,0.3c13.5,0,26.5-4.6,37-13.2c19.1-15.4,26.6-40.5,19.1-63.9l-7.6,2.4C119,68.6,112.6,90.3,96.1,103.6z" }),
346
346
  /*#__PURE__*/vue.createElementVNode("path", { d: "M103,19.7c-21.2-18.7-53.5-20-76.1-1.6C7.9,33.5,0.4,58.4,7.7,81.7l7.6-2.4C9,59.2,15.5,37.6,31.9,24.4 C51.6,8.4,79.7,9.6,98,26H85v8h26V8h-8V19.7z" })
347
347
  ], -1 /* HOISTED */);
348
- const _hoisted_3$7 = [
348
+ const _hoisted_3$8 = [
349
349
  _hoisted_2$e
350
350
  ];
351
351
 
352
352
  function render$8(_ctx, _cache) {
353
- return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$f, [..._hoisted_3$7]))
353
+ return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$f, [..._hoisted_3$8]))
354
354
  }
355
355
 
356
356
  const script$f = {};
@@ -766,6 +766,7 @@ const _hoisted_2$b = {
766
766
  key: 0,
767
767
  class: "extended__multiselect-placeholder"
768
768
  };
769
+ const _hoisted_3$7 = ["onClick"];
769
770
 
770
771
 
771
772
  var script$b = {
@@ -1111,20 +1112,20 @@ return (_ctx, _cache) => {
1111
1112
  }, [
1112
1113
  vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(optionCreateLabel)(option)), 1 /* TEXT */),
1113
1114
  vue.createElementVNode("div", {
1114
- class: vue.normalizeClass(deselectClasses.value)
1115
+ class: vue.normalizeClass(deselectClasses.value),
1116
+ onClick: vue.withModifiers($event => (deselectBlock(index)), ["stop"])
1115
1117
  }, [
1116
1118
  (!showLoaderIcon.value)
1117
1119
  ? (vue.openBlock(), vue.createBlock(script$d, {
1118
1120
  key: 0,
1119
- class: "extended__multiselect_deselect-block-icon",
1120
- onClick: vue.withModifiers($event => (deselectBlock(index)), ["stop"])
1121
- }, null, 8 /* PROPS */, ["onClick"]))
1121
+ class: "extended__multiselect_deselect-block-icon"
1122
+ }))
1122
1123
  : (vue.openBlock(), vue.createBlock(script$e, {
1123
1124
  key: 1,
1124
1125
  "icon-filter": __props.iconFilter,
1125
1126
  "icon-size": "deselect"
1126
1127
  }, null, 8 /* PROPS */, ["icon-filter"]))
1127
- ], 2 /* CLASS */)
1128
+ ], 10 /* CLASS, PROPS */, _hoisted_3$7)
1128
1129
  ], 2 /* CLASS */)
1129
1130
  ])
1130
1131
  ]))
@@ -1484,6 +1485,18 @@ const appropriatePlaceholder = vue.computed(() => {
1484
1485
  return createOnTheGo.value ? createOptionPlaceholder.value : placeholder.value;
1485
1486
  });
1486
1487
 
1488
+ /**
1489
+ * Determines whether to show placeholder block
1490
+ * if search field is hidden
1491
+ * @function
1492
+ * @returns {boolean} display
1493
+ */
1494
+ const hintBlockShown = vue.computed(() => {
1495
+ if (selectedOptions.value.length) return false;
1496
+
1497
+ return true;
1498
+ });
1499
+
1487
1500
  /**
1488
1501
  * Sets "margin-top" css property to multiple option blocks
1489
1502
  * if search field is shown
@@ -1500,7 +1513,7 @@ const multipleBlocksMargin = vue.computed(() => {
1500
1513
  * @returns {boolean} display
1501
1514
  */
1502
1515
  const placeholderBlockShown = vue.computed(() => {
1503
- if (selectedOptions.value.length) return false;
1516
+ if (selectedOptions.value.length || searchFieldForwarding.value) return false;
1504
1517
 
1505
1518
  return true;
1506
1519
  });
@@ -1577,7 +1590,7 @@ vue.watch(searchValue, (value) => {
1577
1590
  * @function
1578
1591
  * @emits extended:expand-options
1579
1592
  */
1580
- const expand = () => {
1593
+ const expand = (event) => {
1581
1594
  if (disabled.value) return;
1582
1595
 
1583
1596
  searchFieldFocused.value = true;
@@ -1884,7 +1897,7 @@ return (_ctx, _cache) => {
1884
1897
  }, null, 544 /* NEED_HYDRATION, NEED_PATCH */)
1885
1898
  ]))
1886
1899
  : (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$3, [
1887
- (placeholderBlockShown.value)
1900
+ (hintBlockShown.value)
1888
1901
  ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$3, vue.toDisplayString(appropriatePlaceholder.value), 1 /* TEXT */))
1889
1902
  : vue.createCommentVNode("v-if", true),
1890
1903
  vue.renderSlot(_ctx.$slots, "labelBlock", { labelBlockValue: singleLabel.value }, () => [
@@ -3632,7 +3645,7 @@ const _hoisted_3 = { class: "extended__multiselect-cancel_wrapper" };
3632
3645
 
3633
3646
  /**
3634
3647
  * @author Ridiger Daniil Dmitrievich, 2022
3635
- * @version 2.3.0
3648
+ * @version 2.3.2
3636
3649
  */
3637
3650
 
3638
3651
  var script = {
@@ -4303,6 +4316,7 @@ const togglePattern = /^extended__multiselect-toggle_wrapper/i;
4303
4316
  const extendedMultiselect = vue.ref(null);
4304
4317
  const extendedMultiselectToggle = vue.ref(null);
4305
4318
  const extendedMultiselectWrapper = vue.ref(null);
4319
+ const extendedMultiselectOptions = vue.ref(null);
4306
4320
 
4307
4321
  const {
4308
4322
  defaultExpanded,
@@ -4852,15 +4866,17 @@ const setPreselectedOptionsByConditions = () => {
4852
4866
  * @returns {string} position
4853
4867
  */
4854
4868
  const toggleAppearanceRestrictor = () => {
4855
- if (!window) return "under";
4869
+ if (!window || !extendedMultiselectOptions.value.$el) return "under";
4856
4870
 
4857
4871
  const innerHeight = window.innerHeight;
4872
+ const offsetHeight = extendedMultiselectOptions.value.$el.offsetHeight
4873
+ + extendedMultiselect.value.offsetHeight;
4858
4874
  const offsetTop = extendedMultiselect.value
4859
4875
  ? extendedMultiselect.value.getBoundingClientRect().y
4860
4876
  : 0;
4861
4877
  const difference = innerHeight - offsetTop;
4862
4878
 
4863
- if (difference > toggleMaxHeight.value) {
4879
+ if (difference > offsetHeight) {
4864
4880
  return "under";
4865
4881
  } else {
4866
4882
  return "atop";
@@ -4872,7 +4888,7 @@ const toggleAppearanceRestrictor = () => {
4872
4888
  * @function
4873
4889
  */
4874
4890
  const toggleAppearanceRestrictorActivate = () => {
4875
- if (!dropdownActive.value) {
4891
+ if (dropdownActive.value) {
4876
4892
  chosenToggleAppearanceSide.value = toggleAppearanceSide.value !== "auto"
4877
4893
  ? toggleAppearanceSide.value
4878
4894
  : toggleAppearanceRestrictor();
@@ -4992,15 +5008,17 @@ const toggleDetector = (mouseEvent, pattern, mode) => {
4992
5008
  const toggleOptions = () => {
4993
5009
  if (internalLoading.value || disabled.value || dropdownDisabled.value) return;
4994
5010
 
4995
- toggleAppearanceRestrictorActivate();
5011
+ dropdownActive.value = !dropdownActive.value;
5012
+
5013
+ vue.nextTick(() => {
5014
+ toggleAppearanceRestrictorActivate();
5015
+ });
4996
5016
 
4997
5017
  if (!dropdownActive.value) {
4998
5018
  activeEmitter();
4999
5019
  } else {
5000
5020
  closeEmitter();
5001
5021
  }
5002
-
5003
- dropdownActive.value = !dropdownActive.value;
5004
5022
  };
5005
5023
 
5006
5024
  /**
@@ -5267,15 +5285,21 @@ vue.onMounted(() => {
5267
5285
  && typeof options.value !== "function"
5268
5286
  ) {
5269
5287
  dropdownActive.value = true;
5288
+
5289
+ vue.nextTick(() => {
5290
+ toggleAppearanceRestrictorActivate();
5291
+ });
5270
5292
  }
5271
5293
 
5272
5294
  emitter.value.on("extended:expand-options", () => {
5273
5295
  if (dropdownActive.value || dropdownDisabled.value) return;
5274
-
5275
- toggleAppearanceRestrictorActivate();
5276
- activeEmitter();
5277
-
5296
+
5278
5297
  dropdownActive.value = true;
5298
+
5299
+ vue.nextTick(() => {
5300
+ toggleAppearanceRestrictorActivate();
5301
+ });
5302
+ activeEmitter();
5279
5303
  });
5280
5304
 
5281
5305
  emitter.value.on("extended:loader-pattern-changed", async (pattern) => {
@@ -5455,6 +5479,8 @@ return (_ctx, _cache) => {
5455
5479
  (dropdownActive.value)
5456
5480
  ? (vue.openBlock(), vue.createBlock(script$9, {
5457
5481
  key: 0,
5482
+ ref_key: "extendedMultiselectOptions",
5483
+ ref: extendedMultiselectOptions,
5458
5484
  "auto-select-created-option": __props.autoSelectCreatedOption,
5459
5485
  "clear-by-select-when-multiple": __props.clearBySelectWhenMultiple,
5460
5486
  "create-on-the-go": __props.createOnTheGo,