vue3-extended-multiselect 1.5.10 → 1.6.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Patch notes
2
2
 
3
- Current `vue3-extended-multiselect` version: **1.5.10**
3
+ Current `vue3-extended-multiselect` version: **1.6.1**
4
4
 
5
5
  ***
6
6
 
@@ -235,4 +235,14 @@ Adding descriptive comments for some types in typings.
235
235
  ### 1.5.10 (2023-02-01)
236
236
 
237
237
  * Fixing bug with field focus when selecting an option.
238
- * Removal of validator from "emptyObjectsPlaceholder" prop.
238
+ * Removal of validator from "emptyObjectsPlaceholder" prop.
239
+
240
+ ### 1.6.0 (2023-02-02)
241
+
242
+ * Adding "showDeselectIconLoader" optional prop.
243
+ * Adding loader icon to deselect button of multiple option blocks depending on "showDeselectIconLoader" optional prop.
244
+ * Changing styles of multiple option blocks.
245
+
246
+ ### 1.6.1 (2023-02-02)
247
+
248
+ * Fixing bug with not clotting options list when single option was selected.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # vue3-extended-multiselect v1.5.10
1
+ # vue3-extended-multiselect v1.6.1
2
2
 
3
3
  ***
4
4
 
@@ -52,6 +52,7 @@ Prop name | Prop type | Prop appointment | Prop default value | Prop values
52
52
  **simpleEvents**|Boolean|Switches full payload of extended multiselect events.|true|—|
53
53
  **selected<br/>Options<br/>Shown**|Boolean|Determines whether to show selected options in options list.|false|&mdash;|
54
54
  **showClearIcon**|Boolean|Allows user to deselect all options by special icon.|false|&mdash;|
55
+ **showDeselect<br/>IconLoader**|Boolean|Determines whether to show loader icon in multiple options block if "loading" prop equals true|true|&mdash;|
55
56
  **showInsert<br/>Warnings**|Boolean|Determines whether to show useful internal warnings in console.|false|&mdash;|
56
57
  **showMarker**|Boolean|Determines whether to show slot with special marker beside option in options list.|false|&mdash;|
57
58
  **showSearch<br/>Field**|Boolean|Determines whether to show search field which allows user to search for options with internal search.|true|&mdash;|
package/jest.config.js CHANGED
@@ -5,7 +5,7 @@ module.exports = {
5
5
  },
6
6
  expand: true,
7
7
  displayName: {
8
- name: "vue3-extended-multiselect 1.5.10",
8
+ name: "vue3-extended-multiselect 1.6.1",
9
9
  color: "bgGreen",
10
10
  },
11
11
  extraGlobals: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue3-extended-multiselect",
3
- "version": "1.5.10",
3
+ "version": "1.6.1",
4
4
  "description": "Extended multiselect component for applications based on Vue 3 framework",
5
5
  "keywords": [
6
6
  "multiselect",
@@ -36,6 +36,8 @@
36
36
  :style="multipleBlocksMargin"
37
37
  :disabled="disabled"
38
38
  :loading="loading"
39
+ :icon-filter="iconFilter"
40
+ :show-deselect-icon-loader="showDeselectIconLoader"
39
41
  :toggle-multiple-blocks-limit="toggleMultipleBlocksLimit"
40
42
  :empty-objects-placeholder="emptyObjectsPlaceholder"
41
43
  :label="label"
@@ -75,6 +77,8 @@
75
77
  <extended-multiselect-multiple
76
78
  :disabled="disabled"
77
79
  :loading="loading"
80
+ :icon-filter="iconFilter"
81
+ :show-deselect-icon-loader="showDeselectIconLoader"
78
82
  :toggle-multiple-blocks-limit="toggleMultipleBlocksLimit"
79
83
  :empty-objects-placeholder="emptyObjectsPlaceholder"
80
84
  :label="label"
@@ -229,6 +233,17 @@ const props = defineProps({
229
233
  required: true,
230
234
  },
231
235
 
236
+ /**
237
+ * Determines whether to show loader icon in multiple
238
+ * options block if "loading" prop equals true
239
+ * @default true
240
+ * @property {boolean} showDeselectIconLoader
241
+ */
242
+ showDeselectIconLoader: {
243
+ type: Boolean,
244
+ default: true,
245
+ },
246
+
232
247
  /**
233
248
  * Determines whether to allow user to increase limit of shown
234
249
  * elements with selected options by special icon
@@ -279,11 +294,20 @@ const props = defineProps({
279
294
  required: true,
280
295
  },
281
296
 
297
+ /**
298
+ * Defines a svg-filter for icons
299
+ * @property {string} iconFilter
300
+ */
301
+ iconFilter: {
302
+ type: String,
303
+ required: true,
304
+ },
305
+
282
306
  /**
283
307
  * Determines field of option which will be displayed as label
284
308
  * @property {string} label
285
309
  */
286
- label: {
310
+ label: {
287
311
  type: String,
288
312
  required: true,
289
313
  },
@@ -317,7 +341,7 @@ const props = defineProps({
317
341
  },
318
342
 
319
343
  /**
320
- * Provides limit of option blocks amount
344
+ * Provides limit of multiple option blocks amount
321
345
  * to ExtendedMultiselectMultiple child component
322
346
  * @default null
323
347
  * @property {number} multipleBlocksLimit
@@ -447,7 +471,7 @@ const appropriatePlaceholder = computed(() => {
447
471
  });
448
472
 
449
473
  /**
450
- * Sets "margin-top" css property to multiple options block
474
+ * Sets "margin-top" css property to multiple option blocks
451
475
  * if search field is shown
452
476
  * @function
453
477
  * @returns {Object|null} margin-top
@@ -546,7 +570,7 @@ const multipleBlur = () => {
546
570
  return;
547
571
  }
548
572
 
549
- if (!blurSkipByBlock.value) {
573
+ if (blurSkipByBlock.value < 1) {
550
574
  searchFieldFocused.value = false;
551
575
  }
552
576
  };
@@ -10,21 +10,21 @@
10
10
  :index="index"
11
11
  :deselect-block="deselectBlock"
12
12
  >
13
- <div
14
- :class="classes"
15
- :style="styles"
16
- >
13
+ <div :class="classes">
17
14
  <span>{{ optionCreateLabel(option) }}</span>
18
- <div
19
- class="extended__multiselect-block_cancel-wrapper"
20
- v-if="!loading"
21
- >
15
+ <div :class="deselectClasses">
22
16
  <img
23
17
  alt=""
24
18
  class="extended__multiselect_deselect-block-icon"
19
+ v-if="!showLoaderIcon"
25
20
  :src="deselectImage"
26
21
  @click.stop="deselectBlock(index)"
27
22
  />
23
+ <extended-multiselect-loader
24
+ v-else
25
+ :icon-filter="iconFilter"
26
+ icon-size="deselect"
27
+ />
28
28
  </div>
29
29
  </div>
30
30
  </slot>
@@ -63,6 +63,8 @@ import {
63
63
  import useImagePath from "../composition/image-path";
64
64
  import useLabels from "../composition/labels";
65
65
 
66
+ import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
67
+
66
68
  const props = defineProps({
67
69
  /**
68
70
  * Function that creates custom label for
@@ -129,6 +131,17 @@ const props = defineProps({
129
131
  default: null,
130
132
  },
131
133
 
134
+ /**
135
+ * Determines whether to show loader icon in multiple
136
+ * options block if "loading" prop equals true
137
+ * @default true
138
+ * @property {boolean} showDeselectIconLoader
139
+ */
140
+ showDeselectIconLoader: {
141
+ type: Boolean,
142
+ default: true,
143
+ },
144
+
132
145
  /**
133
146
  * Allows to increase limit of displayed selected option blocks
134
147
  * @property {boolean} toggleMultipleBlocksLimit
@@ -138,6 +151,15 @@ const props = defineProps({
138
151
  required: true,
139
152
  },
140
153
 
154
+ /**
155
+ * Defines a svg-filter for icons
156
+ * @property {string} iconFilter
157
+ */
158
+ iconFilter: {
159
+ type: String,
160
+ required: true,
161
+ },
162
+
141
163
  /**
142
164
  * Function that creates limit message for maximal of selected options
143
165
  * @property {Function} multipleBlocksLimitMessage
@@ -184,6 +206,7 @@ const {
184
206
  label,
185
207
  increaseDisplayBy,
186
208
  loading,
209
+ showDeselectIconLoader,
187
210
  multipleBlocksLimit,
188
211
  selectedOptions,
189
212
  themeType,
@@ -227,6 +250,18 @@ const classes = computed(() => {
227
250
  }
228
251
  });
229
252
 
253
+ /**
254
+ * Defines class for every deselect/loader icon in multiple
255
+ * option blocks depends on "loading" prop
256
+ * @function
257
+ * @returns {string} class
258
+ */
259
+ const deselectClasses = computed(() => {
260
+ return loading.value
261
+ ? "extended__multiselect-block_cancel-wrapper--loading"
262
+ : "extended__multiselect-block_cancel-wrapper";
263
+ });
264
+
230
265
  /**
231
266
  * Defines current limited amount of displayed option blocks
232
267
  * @function
@@ -276,13 +311,13 @@ const overLimitOptionsCount = computed(() => {
276
311
  });
277
312
 
278
313
  /**
279
- * Defines styles for "padding-right" css-property
280
- * of every option block
314
+ * Determines whether to show loader icon if "loading" prop equals true
315
+ * or show multiple option blocks as usual
281
316
  * @function
282
- * @returns {Object|null} styles
317
+ * @returns {boolean} restriction
283
318
  */
284
- const styles = computed(() => {
285
- return loading.value ? { paddingRight: "7px" } : null;
319
+ const showLoaderIcon = computed(() => {
320
+ return showDeselectIconLoader.value ? loading.value : false;
286
321
  });
287
322
 
288
323
  /**
@@ -32,8 +32,10 @@
32
32
  :disabled="disabled"
33
33
  :dropdown-active="dropdownActive"
34
34
  :loading="internalLoading"
35
+ :icon-filter="iconFilter"
35
36
  :multiple="multiple"
36
37
  :search-filter-active="searchFilterActive"
38
+ :show-deselect-icon-loader="showDeselectIconLoader"
37
39
  :toggling-saves-search-value="togglingSavesSearchValue"
38
40
  :toggle-options-by-select="toggleOptionsBySelect"
39
41
  :placeholder="placeholder"
@@ -254,7 +256,7 @@ import ExtendedMultiselectToggle from "./ExtendedMultiselectToggle.vue";
254
256
 
255
257
  /**
256
258
  * @author Ridiger Daniil Dmitrievich, 2022
257
- * @version 1.5.10
259
+ * @version 1.6.1
258
260
  */
259
261
 
260
262
  const props = defineProps({
@@ -410,6 +412,17 @@ const props = defineProps({
410
412
  default: false,
411
413
  },
412
414
 
415
+ /**
416
+ * Determines whether to show loader icon in multiple
417
+ * options block if "loading" prop equals true
418
+ * @default true
419
+ * @property {boolean} showDeselectIconLoader
420
+ */
421
+ showDeselectIconLoader: {
422
+ type: Boolean,
423
+ default: true,
424
+ },
425
+
413
426
  /**
414
427
  * Determines whether to show useful internal warnings in console
415
428
  * @default false
@@ -1422,13 +1435,13 @@ const toggleAppearanceRestrictorActivate = () => {
1422
1435
  * @param {MouseEvent} mouseEvent - MouseEvent instance
1423
1436
  * @returns {boolean} toggling
1424
1437
  */
1425
- const toggleBlockRestrictor = (mouseEvent) => {
1438
+ const toggleBlockRestrictor = (mouseEvent) => {
1426
1439
  let generalRestriction;
1427
1440
  let filteredCustomSelf;
1428
1441
  const filteredHasBlock = toggleDetector(mouseEvent, /^extended__multiselect-block/i, true);
1429
1442
  const filteredHasSlot = toggleDetector(mouseEvent, /^extended__multiselect-options(?!_option)/i, true)
1430
1443
  const filteredSelf = toggleDetector(mouseEvent, /^extended__multiselect-clear/i);
1431
-
1444
+
1432
1445
  if (filteredSelf.length || filteredHasBlock.length || filteredHasSlot.length) {
1433
1446
  filteredCustomSelf = true;
1434
1447
  } else {
@@ -1486,6 +1499,7 @@ const toggleCustomRestrictor = (mouseEvent, blockType) => {
1486
1499
  */
1487
1500
  const toggleDetector = (mouseEvent, pattern, mode) => {
1488
1501
  let target = mouseEvent.target;
1502
+ const optionPattern = /^extended__multiselect-options_option/i;
1489
1503
 
1490
1504
  let filteredHasToggle = Array.prototype.filter.call(target.classList, (className) => {
1491
1505
  return pattern.test(className) === true;
@@ -1504,6 +1518,10 @@ const toggleDetector = (mouseEvent, pattern, mode) => {
1504
1518
  return pattern.test(className) === true;
1505
1519
  });
1506
1520
 
1521
+ if (Array.prototype.some.call(target.classList, (className) => {
1522
+ return optionPattern.test(className);
1523
+ })) return [];
1524
+
1507
1525
  if (target.classList.contains("extended__multiselect-options_container")) {
1508
1526
  filteredHasToggle.push("extended__multiselect-options_container");
1509
1527
  return filteredHasToggle;
@@ -34,6 +34,8 @@ export default function useSizes(iconSize) {
34
34
  return `${basicIconSize}-medium`;
35
35
  case "small":
36
36
  return `${basicIconSize}-small`;
37
+ case "deselect":
38
+ return `${basicIconSize}-deselect`;
37
39
  default:
38
40
  return `${basicIconSize}-large`;
39
41
  }
@@ -260,6 +260,15 @@
260
260
  height: var(--icon-size-small);
261
261
  }
262
262
 
263
+ .extended__multiselect-toggle_icon-deselect,
264
+ .extended__multiselect-toggle--disabled_icon-deselect,
265
+ .extended__multiselect-cancel_icon-deselect,
266
+ .extended__multiselect-cancel--disabled_icon-deselect,
267
+ .extended__multiselect-loader_icon-deselect {
268
+ width: var(--icon-size-block);
269
+ height: var(--icon-size-block);
270
+ }
271
+
263
272
  .extended__multiselect-cancel,
264
273
  .extended__multiselect-cancel--disabled {
265
274
  border: var(--border);
@@ -423,7 +432,8 @@
423
432
  gap: var(--outer-gap);
424
433
  }
425
434
 
426
- .extended__multiselect-block_cancel-wrapper {
435
+ .extended__multiselect-block_cancel-wrapper,
436
+ .extended__multiselect-block_cancel-wrapper--loading {
427
437
  border: var(--border);
428
438
  border-color: transparent;
429
439
  display: flex;