vue3-extended-multiselect 1.5.7 → 1.5.9

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/.browserslistrc CHANGED
@@ -1,3 +1,3 @@
1
1
  > 1%
2
2
  last 2 versions
3
- not dead
3
+ not dead
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Patch notes
2
2
 
3
- Current `vue3-extended-multiselect` version: **1.5.7**
3
+ Current `vue3-extended-multiselect` version: **1.5.9**
4
4
 
5
5
  ***
6
6
 
@@ -221,4 +221,13 @@ Adding descriptive comments for some types in typings.
221
221
 
222
222
  ### 1.5.7 (2023-01-26)
223
223
 
224
- * Removal of internal loading state because of using "lodash.debounce".
224
+ * Removal of internal loading state because of using "lodash.debounce".
225
+
226
+ ### 1.5.8 (2023-02-01)
227
+
228
+ * Adding CONTRIBUTING.md file.
229
+
230
+ ### 1.5.9 (2023-02-01)
231
+
232
+ * "loading" prop no longer disables search field.
233
+ * Changing value of css-variable "--min-block-height" from 25px to 26px.
@@ -0,0 +1,57 @@
1
+ # Contributing to vue3-extended-multiselect
2
+
3
+ First off, thanks for taking the time to contribute! ❤️
4
+
5
+ All types of contributions are encouraged and valued. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉
6
+
7
+ > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which i would also be very happy about:
8
+ > - Star the project
9
+ > - Start watching this project
10
+ > - Refer this project in your project's readme
11
+ > - Mention the project at local meetups and tell your friends/colleagues
12
+
13
+ ## You Have a Question
14
+
15
+ > If you want to ask a question, i assume that you have read the available [Documentation](https://github.com/danyaridiger/vue3-extended-multiselect/blob/master/README.md).
16
+
17
+ Before you ask a question, it is best to search for existing [Issues](https://github.com/danyaridiger/vue3-extended-multiselect/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
18
+
19
+ If you then still feel the need to ask a question and need clarification, i recommend the following:
20
+
21
+ - Open an [Issue](https://github.com/danyaridiger/vue3-extended-multiselect/issues/new).
22
+ - Provide as much context as you can about what you're running into.
23
+ - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
24
+
25
+ I will then take care of the issue as soon as possible.
26
+
27
+
28
+ ## You Want To Contribute
29
+
30
+ > ### Legal Notice
31
+ > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
32
+
33
+
34
+ ### Suggesting Enhancements
35
+
36
+ This section guides you through submitting an enhancement suggestion for **vue3-extended-multiselect**, including completely new features and minor improvements to existing functionality. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
37
+
38
+
39
+ #### Before Submitting an Enhancement
40
+
41
+ - Make sure that you are using the latest version.
42
+ - Read the [documentation](https://github.com/danyaridiger/vue3-extended-multiselect/blob/master/README.md) carefully and find out if the functionality is already covered, maybe by an individual configuration.
43
+ - Perform a [search](https://github.com/danyaridiger/vue3-extended-multiselect/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
44
+ - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that i want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.
45
+
46
+
47
+ #### How Do You Submit a Good Enhancement Suggestion?
48
+
49
+ Enhancement suggestions are tracked as [GitHub issues](https://github.com/danyaridiger/vue3-extended-multiselect/issues).
50
+
51
+ - Use a **clear and descriptive title** for the issue to identify the suggestion.
52
+ - Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
53
+ - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
54
+ - You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to.
55
+ - **Explain why this enhancement would be useful** to most **vue3-extended-multiselect** users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
56
+
57
+
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # vue3-extended-multiselect v1.5.7
1
+ # vue3-extended-multiselect v1.5.9
2
2
 
3
3
  ***
4
4
 
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.7",
8
+ name: "vue3-extended-multiselect 1.5.9",
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.7",
3
+ "version": "1.5.9",
4
4
  "description": "Extended multiselect component for applications based on Vue 3 framework",
5
5
  "keywords": [
6
6
  "multiselect",
@@ -10,7 +10,10 @@
10
10
  :index="index"
11
11
  :deselect-block="deselectBlock"
12
12
  >
13
- <div :class="classes">
13
+ <div
14
+ :class="classes"
15
+ :style="styles"
16
+ >
14
17
  <span>{{ optionCreateLabel(option) }}</span>
15
18
  <div
16
19
  class="extended__multiselect-block_cancel-wrapper"
@@ -272,6 +275,16 @@ const overLimitOptionsCount = computed(() => {
272
275
  return selectedOptions.value.length - multipleBlocksLimit.value;
273
276
  });
274
277
 
278
+ /**
279
+ * Defines styles for "padding-right" css-property
280
+ * of every option block
281
+ * @function
282
+ * @returns {Object|null} styles
283
+ */
284
+ const styles = computed(() => {
285
+ return loading.value ? { paddingRight: "7px" } : null;
286
+ });
287
+
275
288
  /**
276
289
  * If limit of selected options was achieved restricts further
277
290
  * extension of options container if "multiple" prop equals true
@@ -149,6 +149,16 @@ const props = defineProps({
149
149
  required: true,
150
150
  },
151
151
 
152
+ /**
153
+ * Determines "loading" state of component
154
+ * that disables option selection
155
+ * @property {boolean} loading
156
+ */
157
+ loading: {
158
+ type: Boolean,
159
+ required: true,
160
+ },
161
+
152
162
  /**
153
163
  * Determines whether to use functionality of
154
164
  * multiple select
@@ -435,6 +445,7 @@ const {
435
445
  emitter,
436
446
  emptyObjectsPlaceholder,
437
447
  highlightOptions,
448
+ loading,
438
449
  label,
439
450
  searchByField,
440
451
  maxOptionsCount,
@@ -702,6 +713,8 @@ const compareWithSelected = (calculatedOptionLabel) => {
702
713
  * @emits extended:create-option
703
714
  */
704
715
  const createNewOption = () => {
716
+ if (loading.value) return;
717
+
705
718
  let newOption;
706
719
 
707
720
  switch(createOptionType.value) {
@@ -983,10 +996,12 @@ const optionHighlightClasses = (option) => {
983
996
  * @param {MouseEvent|KeyboardEvent} clickEvent - MouseEvent or KeyboardEvent instance
984
997
  */
985
998
  const selectOption = (option, clickEvent) => {
999
+
986
1000
  emitter.value.emit("extended:trigger-selection", false);
987
1001
 
988
1002
  if (!clickEvent) return;
989
1003
  if (keyBlocker(clickEvent)) return;
1004
+ if (loading.value) return;
990
1005
  if (maxOptionsWereSelected.value) return;
991
1006
  if (option[disableByField.value] || defineDisabledOption(option)) return;
992
1007
  if (
@@ -29,7 +29,7 @@
29
29
  :translate="attrs.translate"
30
30
  :auto-select-search-value="autoSelectSearchValue"
31
31
  :create-on-the-go="createOnTheGo"
32
- :disabled="inputDisabled"
32
+ :disabled="disabled"
33
33
  :dropdown-active="dropdownActive"
34
34
  :loading="internalLoading"
35
35
  :multiple="multiple"
@@ -96,7 +96,7 @@
96
96
  <extended-multiselect-toggle
97
97
  ref="extendedMultiselectToggle"
98
98
  :tabindex="attrs.tabindex"
99
- :disabled="inputDisabled"
99
+ :disabled="disabled"
100
100
  :dropdown-active="dropdownActive"
101
101
  :loading="internalLoading"
102
102
  :icon-filter="iconFilter"
@@ -112,7 +112,7 @@
112
112
  <extended-multiselect-cancel
113
113
  v-if="showClearIcon"
114
114
  :tabindex="attrs.tabindex"
115
- :disabled="inputDisabled"
115
+ :disabled="disabled"
116
116
  :show-search-field="showSearchField"
117
117
  :loading="internalLoading"
118
118
  :icon-filter="iconFilter"
@@ -133,6 +133,7 @@
133
133
  :create-on-the-go="createOnTheGo"
134
134
  :disabled-primitive-options-converted="disabledPrimitiveOptionsConverted"
135
135
  :highlight-options="highlightOptions"
136
+ :loading="internalLoading"
136
137
  :multiple="multiple"
137
138
  :selected-options-shown="selectedOptionsShown"
138
139
  :show-insert-warnings="showInsertWarnings"
@@ -252,8 +253,8 @@ import ExtendedMultiselectOptions from "./ExtendedMultiselectOptions.vue";
252
253
  import ExtendedMultiselectToggle from "./ExtendedMultiselectToggle.vue";
253
254
 
254
255
  /**
255
- * @author Ridiger Daniil Dmitrievich
256
- * @version 1.5.7
256
+ * @author Ridiger Daniil Dmitrievich, 2022
257
+ * @version 1.5.9
257
258
  */
258
259
 
259
260
  const props = defineProps({
@@ -885,7 +886,6 @@ const emit = defineEmits([
885
886
  ]);
886
887
 
887
888
  const dropdownActive = ref(false);
888
- const inputDisabled = ref(false);
889
889
  const externalOptionsLoader = ref(null);
890
890
  const chosenToggleAppearanceSide = ref(null);
891
891
  const rawOptions = ref([]);
@@ -1114,20 +1114,11 @@ const tabindexIfSearch = computed(() => {
1114
1114
  * @returns {string} class
1115
1115
  */
1116
1116
  const wrapperClasses = computed(() => {
1117
- return inputDisabled.value && !internalLoading.value
1117
+ return disabled.value && !internalLoading.value
1118
1118
  ? "extended__multiselect-wrapper--disabled"
1119
1119
  : "extended__multiselect-wrapper";
1120
1120
  });
1121
1121
 
1122
- /**
1123
- * Disables search field if "disabled" prop equals true
1124
- * @function
1125
- * @param {boolean} value - "disabled" prop
1126
- */
1127
- watch(disabled, (value) => {
1128
- inputDisabled.value = value;
1129
- }, { immediate: true });
1130
-
1131
1122
  /**
1132
1123
  * Forcibly rolls up dropdown options list by changing "dropdownActive" flag
1133
1124
  * @function
@@ -1140,17 +1131,6 @@ watch(dropdownActive, (value) => {
1140
1131
  }
1141
1132
  });
1142
1133
 
1143
- /**
1144
- * Disables search field if "loading" prop equals true
1145
- * @function
1146
- * @param {boolean} value - "loading" prop
1147
- */
1148
- watch(internalLoading, (value) => {
1149
- if (disabled.value) return;
1150
-
1151
- inputDisabled.value = value;
1152
- }, { immediate: true });
1153
-
1154
1134
  /**
1155
1135
  * Clears value of search field after changing selected option/options
1156
1136
  * if "resetSearchByValue" prop equals true
@@ -1242,7 +1222,7 @@ const createEventFields = (field, fieldName) => {
1242
1222
  * @param {MouseEvent} mouseEvent - MouseEvent instance
1243
1223
  */
1244
1224
  const fieldFocus = (mouseEvent) => {
1245
- if (internalLoading.value || disabled.value) return;
1225
+ if (disabled.value) return;
1246
1226
 
1247
1227
  if (!toggleOptionsBySelect.value) {
1248
1228
  const customFilteredOptions = toggleOptionsRestrictor(mouseEvent);
@@ -1745,9 +1725,8 @@ onMounted(() => {
1745
1725
  setPreselectedOptionsByModelValue();
1746
1726
 
1747
1727
  if (
1748
- defaultExpanded.value
1749
- && !inputDisabled.value
1750
- && !internalLoading.value
1728
+ defaultExpanded.value
1729
+ && !disabled.value
1751
1730
  && typeof options.value !== "function"
1752
1731
  ) {
1753
1732
  dropdownActive.value = true;
@@ -347,6 +347,7 @@
347
347
  border-radius: var(--block-border-radius);
348
348
  padding: var(--block-padding);
349
349
  gap: var(--block-gap);
350
+ min-height: var(--min-block-height);
350
351
  }
351
352
 
352
353
  .extended__multiselect-options_option:hover,
@@ -32,7 +32,7 @@
32
32
  --icon-size-small: 12px;
33
33
  --increaser-padding: 3px 7px;
34
34
  --max-size: 100%;
35
- --min-block-height: 25px;
35
+ --min-block-height: 26px;
36
36
  --options-padding: 6px 0;
37
37
  --outer-gap: 10px;
38
38
  --root-padding: 6px 10px;
@@ -164,7 +164,9 @@ describe("props", () => {
164
164
 
165
165
  it("correctly handles 'loading' prop value", async () => {
166
166
  const propsData = {
167
+ defaultExpanded: true,
167
168
  loading: true,
169
+ options: globalThis.OPTIONS,
168
170
  };
169
171
 
170
172
  wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
@@ -173,6 +175,13 @@ describe("props", () => {
173
175
 
174
176
  expect(loaderWrapper.exists()).toBeTruthy();
175
177
  expect(loaderWrapper.isVisible()).toBeTruthy();
178
+
179
+ await mockOptionSelection(wrapper);
180
+
181
+ const inputWrapper = wrapper.findComponent(ExtendedMultiselectInput);
182
+ const selectedOptionWrapper = inputWrapper.find(".extended__multiselect-block");
183
+
184
+ expect(selectedOptionWrapper.text()).toHaveLength(0);
176
185
  });
177
186
 
178
187