vue3-extended-multiselect 1.1.6 → 1.1.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Patch notes
|
|
2
2
|
|
|
3
|
-
Current `vue3-extended-multiselect` version: **1.1.
|
|
3
|
+
Current `vue3-extended-multiselect` version: **1.1.8**
|
|
4
4
|
|
|
5
5
|
***
|
|
6
6
|
|
|
@@ -112,14 +112,20 @@ Adding descriptive comments for some types in typings.
|
|
|
112
112
|
* Adding "searchByField" optional prop.
|
|
113
113
|
* Adding unit-test for new optional prop.
|
|
114
114
|
|
|
115
|
-
### 1.1.4 (2022-13
|
|
115
|
+
### 1.1.4 (2022-12-13)
|
|
116
116
|
* Adding "optionCreateLabel" to expose as utility.
|
|
117
117
|
* Fix bug with wrong name of label field
|
|
118
118
|
|
|
119
|
-
### 1.1.5 (2022-
|
|
119
|
+
### 1.1.5 (2022-12-14)
|
|
120
120
|
* Fix bug with empty raw options list when using async loader.
|
|
121
121
|
|
|
122
|
-
### 1.1.6 (2022-
|
|
122
|
+
### 1.1.6 (2022-12-14)
|
|
123
123
|
* Fix bug with extra call of async loader by changing value of search field.
|
|
124
124
|
* Adding new internal prop "externalOptionsLoader" to ExtendedMultiselectInput.
|
|
125
|
-
* Searching for options by async loader is moved to in separate method.
|
|
125
|
+
* Searching for options by async loader is moved to in separate method.
|
|
126
|
+
|
|
127
|
+
### 1.1.7 (2022-12-15)
|
|
128
|
+
* Adding "disableByField" prop for determination of field in options of type "object" which value will be used to disable such options.
|
|
129
|
+
|
|
130
|
+
### 1.1.8 (2022-12-18)
|
|
131
|
+
* Changing default value of "toggleIcon" prop to "base-arrow".
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# vue3-extended-multiselect v1.1.
|
|
1
|
+
# vue3-extended-multiselect v1.1.8
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -60,6 +60,7 @@ Prop name | Prop type | Prop appointment | Prop default value | Prop values
|
|
|
60
60
|
**wrongCurrent<br/>Value**|Boolean|Determines whether to define special class for extended multiselect if value is wrong or if irregularity of value is defined by user.|false|—|
|
|
61
61
|
**createOption<br/>Placeholder**|String|Placeholder for the search field to be used if user is allowed to create new options.|"Select or create features"|—|
|
|
62
62
|
**createOption<br/>Type**|String|Defines kind for all options which will be created by user.|"primitive"| "primitive", "array", "object"|
|
|
63
|
+
**disableByField**|String|Determines a field in options of type "object" which value will be used to disable such options.|"disabled"|—|
|
|
63
64
|
**emptyObjects<br/>Placeholder**|String|Placeholder for options of type "object" or Array instances which length/keys length equals 0.|"Empty Object/<br/>Array"|—|
|
|
64
65
|
**errorBorder<br/>Color**|String|Defines "border-color" css-property for extended multiselect with wrong value.|"#FF0000"|—|
|
|
65
66
|
**iconFilter**|String|Defines svg-filter with color settings for all icons except loader.|"basic"|"basic", "black", "green"|
|
|
@@ -70,7 +71,7 @@ Prop name | Prop type | Prop appointment | Prop default value | Prop values
|
|
|
70
71
|
**searchByField**|String|Determines field in options of type "object" to use in internal search.|""|—|
|
|
71
72
|
**themeType**|String|Defines overall color theme for extended multiselect.|"basic"|"basic", "slate-grey", "slate-blue", "teal",<br/> "strict"|
|
|
72
73
|
**toggle<br/>Appearance<br/>Side**|String|Defines which side options list will be displayed on.|"auto"|"auto", "atop", "under"|
|
|
73
|
-
**toggleIcon**|String|Defines kind of toggle icon from icons collection.|"
|
|
74
|
+
**toggleIcon**|String|Defines kind of toggle icon from icons collection.|"base-arrow"|"base-arrow", "double-arrow", "wide-arrow", "circle-arrow", "inner-arrow", "triangle-arrow", "triangle-circle-arrow"|
|
|
74
75
|
**anyOption<br/>Wrapper<br/>BlockHeight**|Number|Defines "height" css-property for each option in options list.|30|—|
|
|
75
76
|
**increase<br/>Display<br/>By**|Number|Defines gap which increases limit of displayed elements with selected options.|5|—|
|
|
76
77
|
**maxOptions<br/>Count**|Number|Maximal limit of selected options.|null|—|
|
package/package.json
CHANGED
|
@@ -207,6 +207,16 @@ const props = defineProps({
|
|
|
207
207
|
required: true,
|
|
208
208
|
},
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Determines a field in options of type "object"
|
|
212
|
+
* which value will be used to disable such options.
|
|
213
|
+
* @property {string} disableByField
|
|
214
|
+
*/
|
|
215
|
+
disableByField: {
|
|
216
|
+
type: String,
|
|
217
|
+
required: true,
|
|
218
|
+
},
|
|
219
|
+
|
|
210
220
|
/**
|
|
211
221
|
* Sets labels for options of type "object"
|
|
212
222
|
* or Array instances which length/keys length equals 0
|
|
@@ -412,6 +422,7 @@ const {
|
|
|
412
422
|
createCustomOptionLabel,
|
|
413
423
|
createOptionFields,
|
|
414
424
|
createOptionType,
|
|
425
|
+
disableByField,
|
|
415
426
|
disabledPrimitiveOptionsConverted,
|
|
416
427
|
emptyObjectsPlaceholder,
|
|
417
428
|
highlightOptions,
|
|
@@ -904,7 +915,7 @@ const optionCreateRole = (option) => {
|
|
|
904
915
|
* @returns {boolean} blocking
|
|
905
916
|
*/
|
|
906
917
|
const optionIsDisabled = (option) => {
|
|
907
|
-
if (option.
|
|
918
|
+
if (option[disableByField.value] || defineDisabledOption(option)) return true;
|
|
908
919
|
|
|
909
920
|
return false;
|
|
910
921
|
}
|
|
@@ -944,7 +955,7 @@ const optionHighlightClasses = (option) => {
|
|
|
944
955
|
theme.push("extended__multiselect-options_option--marker");
|
|
945
956
|
}
|
|
946
957
|
|
|
947
|
-
if (option && option.
|
|
958
|
+
if (option && option[disableByField.value]) {
|
|
948
959
|
theme.push("extended__multiselect-options_option--disabled");
|
|
949
960
|
}
|
|
950
961
|
|
|
@@ -968,7 +979,7 @@ const selectOption = (option, clickEvent) => {
|
|
|
968
979
|
if (!clickEvent) return;
|
|
969
980
|
if (keyBlocker(clickEvent)) return;
|
|
970
981
|
if (maxOptionsWereSelected.value) return;
|
|
971
|
-
if (option.
|
|
982
|
+
if (option[disableByField.value] || defineDisabledOption(option)) return;
|
|
972
983
|
if (
|
|
973
984
|
clickEvent.target.id === "extended__multiselect-toggle"
|
|
974
985
|
|| clickEvent.target.id === "extended__multiselect-cancel"
|
|
@@ -136,6 +136,7 @@
|
|
|
136
136
|
:show-marker="showMarker"
|
|
137
137
|
:chosen-toggle-appearance-side="chosenToggleAppearanceSide"
|
|
138
138
|
:create-option-type="createOptionType"
|
|
139
|
+
:disable-by-field="disableByField"
|
|
139
140
|
:empty-objects-placeholder="emptyObjectsPlaceholder"
|
|
140
141
|
:label="label"
|
|
141
142
|
:search-by-field="searchByField"
|
|
@@ -492,6 +493,17 @@ const props = defineProps({
|
|
|
492
493
|
},
|
|
493
494
|
},
|
|
494
495
|
|
|
496
|
+
/**
|
|
497
|
+
* Determines a field in options of type "object"
|
|
498
|
+
* which value will be used to disable such options.
|
|
499
|
+
* @default "disabled"
|
|
500
|
+
* @property {string} disableByField
|
|
501
|
+
*/
|
|
502
|
+
disableByField: {
|
|
503
|
+
type: String,
|
|
504
|
+
default: "disabled",
|
|
505
|
+
},
|
|
506
|
+
|
|
495
507
|
/**
|
|
496
508
|
* Placeholder for options of type "object"
|
|
497
509
|
* or Array instances which length/keys length equals 0
|
|
@@ -615,12 +627,12 @@ const props = defineProps({
|
|
|
615
627
|
|
|
616
628
|
/**
|
|
617
629
|
* Defines kind of toggle icon from icons collection
|
|
618
|
-
* @default "
|
|
630
|
+
* @default "base-arrow"
|
|
619
631
|
* @property {string} toggleIcon
|
|
620
632
|
*/
|
|
621
633
|
toggleIcon: {
|
|
622
634
|
type: String,
|
|
623
|
-
default: "
|
|
635
|
+
default: "base-arrow",
|
|
624
636
|
validator(value) {
|
|
625
637
|
return toggleIcons.includes(value);
|
|
626
638
|
},
|
package/tests/unit/props.spec.js
CHANGED
|
@@ -485,6 +485,25 @@ describe("props", () => {
|
|
|
485
485
|
});
|
|
486
486
|
|
|
487
487
|
|
|
488
|
+
it("correctly handles 'disableByField' prop value", async () => {
|
|
489
|
+
const propsData = {
|
|
490
|
+
defaultExpanded: true,
|
|
491
|
+
disableByField: "searchByField",
|
|
492
|
+
options: globalThis.OPTIONS,
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
496
|
+
|
|
497
|
+
const optionsWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
|
|
498
|
+
const selectedOptionWrapper = wrapper.find(".extended__multiselect-block");
|
|
499
|
+
const optionElement = optionsWrapper.findAll(".extended__multiselect-options_option").at(2);
|
|
500
|
+
|
|
501
|
+
await fireEvent.click(optionElement.element);
|
|
502
|
+
|
|
503
|
+
expect(selectedOptionWrapper.text()).toHaveLength(0);
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
|
|
488
507
|
it("correctly handles 'emptyObjectsPlaceholder' prop value", async () => {
|
|
489
508
|
const propsData = {
|
|
490
509
|
defaultExpanded: true,
|
|
@@ -655,7 +674,7 @@ describe("props", () => {
|
|
|
655
674
|
const toggleWrapper = wrapper.findComponent(ExtendedMultiselectToggle);
|
|
656
675
|
const icon = toggleWrapper.find("img");
|
|
657
676
|
|
|
658
|
-
expect(toggleWrapper.props("toggleIcon")).toEqual("
|
|
677
|
+
expect(toggleWrapper.props("toggleIcon")).toEqual("base-arrow");
|
|
659
678
|
expect(icon.exists()).toBeTruthy();
|
|
660
679
|
expect(icon.isVisible()).toBeTruthy();
|
|
661
680
|
});
|