vueless 1.2.3-beta.2 → 1.2.3-beta.3
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/package.json
CHANGED
|
@@ -39,6 +39,22 @@ const emit = defineEmits([
|
|
|
39
39
|
* @property {number} value
|
|
40
40
|
*/
|
|
41
41
|
"update:modelValue",
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Triggers when a dropdown list is opened.
|
|
45
|
+
*/
|
|
46
|
+
"open",
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Triggers when a dropdown list is closed.
|
|
50
|
+
*/
|
|
51
|
+
"close",
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Triggers when the search value is changed.
|
|
55
|
+
* @property {string} query
|
|
56
|
+
*/
|
|
57
|
+
"searchChange",
|
|
42
58
|
]);
|
|
43
59
|
|
|
44
60
|
type UListboxRef = InstanceType<typeof UListbox>;
|
|
@@ -80,7 +96,7 @@ const selectedOptions = computed(() => {
|
|
|
80
96
|
});
|
|
81
97
|
|
|
82
98
|
const badgeLabel = computed(() => {
|
|
83
|
-
if (!selectedOptions.value.length) {
|
|
99
|
+
if (!props.labelDisplayCount || !selectedOptions.value.length) {
|
|
84
100
|
return props.label;
|
|
85
101
|
}
|
|
86
102
|
|
|
@@ -114,22 +130,30 @@ function getFullOptionLabels(value: Option | Option[]) {
|
|
|
114
130
|
return "";
|
|
115
131
|
}
|
|
116
132
|
|
|
133
|
+
function onSearchChange(query: string) {
|
|
134
|
+
emit("searchChange", query);
|
|
135
|
+
}
|
|
136
|
+
|
|
117
137
|
function onClickBadge() {
|
|
118
138
|
isShownOptions.value = !isShownOptions.value;
|
|
119
139
|
|
|
120
140
|
if (isShownOptions.value) {
|
|
121
141
|
nextTick(() => listboxRef.value?.wrapperRef?.focus());
|
|
142
|
+
|
|
143
|
+
emit("open");
|
|
122
144
|
}
|
|
123
145
|
}
|
|
124
146
|
|
|
125
147
|
function hideOptions() {
|
|
126
148
|
isShownOptions.value = false;
|
|
149
|
+
|
|
150
|
+
emit("close");
|
|
127
151
|
}
|
|
128
152
|
|
|
129
153
|
function onClickOption(option: Option) {
|
|
130
154
|
emit("clickOption", option);
|
|
131
155
|
|
|
132
|
-
hideOptions();
|
|
156
|
+
if (!props.multiple) hideOptions();
|
|
133
157
|
}
|
|
134
158
|
|
|
135
159
|
defineExpose({
|
|
@@ -229,6 +253,7 @@ const { getDataTest, config, wrapperAttrs, dropdownBadgeAttrs, listboxAttrs, tog
|
|
|
229
253
|
v-bind="listboxAttrs"
|
|
230
254
|
:data-test="getDataTest('list')"
|
|
231
255
|
@click-option="onClickOption"
|
|
256
|
+
@search-change="onSearchChange"
|
|
232
257
|
/>
|
|
233
258
|
</div>
|
|
234
259
|
</template>
|
|
@@ -39,6 +39,22 @@ const emit = defineEmits([
|
|
|
39
39
|
* @property {number} value
|
|
40
40
|
*/
|
|
41
41
|
"update:modelValue",
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Triggers when a dropdown list is opened.
|
|
45
|
+
*/
|
|
46
|
+
"open",
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Triggers when a dropdown list is closed.
|
|
50
|
+
*/
|
|
51
|
+
"close",
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Triggers when the search value is changed.
|
|
55
|
+
* @property {string} query
|
|
56
|
+
*/
|
|
57
|
+
"searchChange",
|
|
42
58
|
]);
|
|
43
59
|
|
|
44
60
|
provide("hideDropdownOptions", hideOptions);
|
|
@@ -82,7 +98,7 @@ const selectedOptions = computed(() => {
|
|
|
82
98
|
});
|
|
83
99
|
|
|
84
100
|
const buttonLabel = computed(() => {
|
|
85
|
-
if (!selectedOptions.value.length) {
|
|
101
|
+
if (!props.labelDisplayCount || !selectedOptions.value.length) {
|
|
86
102
|
return props.label;
|
|
87
103
|
}
|
|
88
104
|
|
|
@@ -106,6 +122,10 @@ const toggleIconName = computed(() => {
|
|
|
106
122
|
return props.toggleIcon ? config.value.defaults.toggleIcon : "";
|
|
107
123
|
});
|
|
108
124
|
|
|
125
|
+
function onSearchChange(query: string) {
|
|
126
|
+
emit("searchChange", query);
|
|
127
|
+
}
|
|
128
|
+
|
|
109
129
|
function getFullOptionLabels(value: Option | Option[]) {
|
|
110
130
|
const labelKey = props.labelKey;
|
|
111
131
|
|
|
@@ -119,7 +139,7 @@ function getFullOptionLabels(value: Option | Option[]) {
|
|
|
119
139
|
function onClickOption(option: Option) {
|
|
120
140
|
emit("clickOption", option);
|
|
121
141
|
|
|
122
|
-
hideOptions();
|
|
142
|
+
if (!props.multiple) hideOptions();
|
|
123
143
|
}
|
|
124
144
|
|
|
125
145
|
function onClickButton() {
|
|
@@ -127,11 +147,15 @@ function onClickButton() {
|
|
|
127
147
|
|
|
128
148
|
if (isShownOptions.value) {
|
|
129
149
|
nextTick(() => listboxRef.value?.wrapperRef?.focus());
|
|
150
|
+
|
|
151
|
+
emit("open");
|
|
130
152
|
}
|
|
131
153
|
}
|
|
132
154
|
|
|
133
155
|
function hideOptions() {
|
|
134
156
|
isShownOptions.value = false;
|
|
157
|
+
|
|
158
|
+
emit("close");
|
|
135
159
|
}
|
|
136
160
|
|
|
137
161
|
defineExpose({
|
|
@@ -230,6 +254,7 @@ const { getDataTest, config, dropdownButtonAttrs, listboxAttrs, toggleIconAttrs,
|
|
|
230
254
|
v-bind="listboxAttrs"
|
|
231
255
|
:data-test="getDataTest('list')"
|
|
232
256
|
@click-option="onClickOption"
|
|
257
|
+
@search-change="onSearchChange"
|
|
233
258
|
/>
|
|
234
259
|
</div>
|
|
235
260
|
</template>
|
|
@@ -39,6 +39,22 @@ const emit = defineEmits([
|
|
|
39
39
|
* @property {number} value
|
|
40
40
|
*/
|
|
41
41
|
"update:modelValue",
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Triggers when a dropdown list is opened.
|
|
45
|
+
*/
|
|
46
|
+
"open",
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Triggers when a dropdown list is closed.
|
|
50
|
+
*/
|
|
51
|
+
"close",
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Triggers when the search value is changed.
|
|
55
|
+
* @property {string} query
|
|
56
|
+
*/
|
|
57
|
+
"searchChange",
|
|
42
58
|
]);
|
|
43
59
|
|
|
44
60
|
provide("hideDropdownOptions", hideOptions);
|
|
@@ -82,7 +98,7 @@ const selectedOptions = computed(() => {
|
|
|
82
98
|
});
|
|
83
99
|
|
|
84
100
|
const linkLabel = computed(() => {
|
|
85
|
-
if (!selectedOptions.value.length) {
|
|
101
|
+
if (!props.labelDisplayCount || !selectedOptions.value.length) {
|
|
86
102
|
return props.label;
|
|
87
103
|
}
|
|
88
104
|
|
|
@@ -116,6 +132,10 @@ function getFullOptionLabels(value: Option | Option[]) {
|
|
|
116
132
|
return "";
|
|
117
133
|
}
|
|
118
134
|
|
|
135
|
+
function onSearchChange(query: string) {
|
|
136
|
+
emit("searchChange", query);
|
|
137
|
+
}
|
|
138
|
+
|
|
119
139
|
function onClickLink() {
|
|
120
140
|
if (props.disabled) return;
|
|
121
141
|
|
|
@@ -123,17 +143,21 @@ function onClickLink() {
|
|
|
123
143
|
|
|
124
144
|
if (isShownOptions.value) {
|
|
125
145
|
nextTick(() => listboxRef.value?.wrapperRef?.focus());
|
|
146
|
+
|
|
147
|
+
emit("open");
|
|
126
148
|
}
|
|
127
149
|
}
|
|
128
150
|
|
|
129
151
|
function hideOptions() {
|
|
130
152
|
isShownOptions.value = false;
|
|
153
|
+
|
|
154
|
+
emit("close");
|
|
131
155
|
}
|
|
132
156
|
|
|
133
157
|
function onClickOption(option: Option) {
|
|
134
158
|
emit("clickOption", option);
|
|
135
159
|
|
|
136
|
-
hideOptions();
|
|
160
|
+
if (!props.multiple) hideOptions();
|
|
137
161
|
}
|
|
138
162
|
|
|
139
163
|
defineExpose({
|
|
@@ -235,6 +259,7 @@ const { config, getDataTest, wrapperAttrs, dropdownLinkAttrs, listboxAttrs, togg
|
|
|
235
259
|
v-bind="listboxAttrs"
|
|
236
260
|
:data-test="getDataTest('list')"
|
|
237
261
|
@click-option="onClickOption"
|
|
262
|
+
@search-change="onSearchChange"
|
|
238
263
|
/>
|
|
239
264
|
</div>
|
|
240
265
|
</template>
|