vueless 0.0.357 → 0.0.359
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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<UInput
|
|
3
3
|
:id="elementId"
|
|
4
4
|
ref="searchInput"
|
|
5
|
-
|
|
5
|
+
:model-value="localValue"
|
|
6
6
|
:size="size"
|
|
7
7
|
:disabled="disabled"
|
|
8
8
|
:readonly="readonly"
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
:description="description"
|
|
13
13
|
:placeholder="placeholder"
|
|
14
14
|
inputmode="search"
|
|
15
|
-
:data-test="dataTest"
|
|
16
15
|
:left-icon="leftIcon"
|
|
17
16
|
v-bind="inputAttrs"
|
|
18
|
-
|
|
17
|
+
:data-test="dataTest"
|
|
18
|
+
@update:model-value="onUpdateModelValue"
|
|
19
|
+
@keyup.enter="onKeyupEnter"
|
|
19
20
|
>
|
|
20
21
|
<template #left>
|
|
21
22
|
<!-- @slot Use it to add something before the text. -->
|
|
@@ -29,14 +30,14 @@
|
|
|
29
30
|
|
|
30
31
|
<template #right-icon>
|
|
31
32
|
<UIcon
|
|
32
|
-
v-if="
|
|
33
|
+
v-if="localValue"
|
|
33
34
|
internal
|
|
34
35
|
interactive
|
|
35
36
|
color="gray"
|
|
36
37
|
:name="config.defaults.clearIcon"
|
|
37
|
-
:data-test="`${dataTest}-close`"
|
|
38
38
|
:size="iconSize"
|
|
39
39
|
v-bind="clearIconAttrs"
|
|
40
|
+
:data-test="`${dataTest}-clear`"
|
|
40
41
|
@click="onClickClear"
|
|
41
42
|
/>
|
|
42
43
|
|
|
@@ -53,8 +54,8 @@
|
|
|
53
54
|
interactive
|
|
54
55
|
:size="iconSize"
|
|
55
56
|
:name="rightIcon || config.defaults.searchIcon"
|
|
56
|
-
:data-test="`${dataTest}-search`"
|
|
57
57
|
v-bind="searchIconAttrs"
|
|
58
|
+
:data-test="`${dataTest}-search-icon`"
|
|
58
59
|
@click="onClickSearch"
|
|
59
60
|
/>
|
|
60
61
|
</slot>
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
:size="buttonSize"
|
|
70
71
|
no-ring
|
|
71
72
|
v-bind="buttonAttrs"
|
|
72
|
-
:data-test="`${dataTest}-
|
|
73
|
+
:data-test="`${dataTest}-search-button`"
|
|
73
74
|
@click="onClickSearch"
|
|
74
75
|
/>
|
|
75
76
|
</slot>
|
|
@@ -84,7 +85,7 @@ import UIcon from "../ui.image-icon/UIcon.vue";
|
|
|
84
85
|
import UInput from "../ui.form-input/UInput.vue";
|
|
85
86
|
import UButton from "../ui.button/UButton.vue";
|
|
86
87
|
import { getDefault } from "../utils/utilUI.js";
|
|
87
|
-
import { debounce as
|
|
88
|
+
import { debounce as setDebounce } from "../utils/utilHelper.js";
|
|
88
89
|
|
|
89
90
|
import { UInputSearch } from "./constants.js";
|
|
90
91
|
import defaultConfig from "./config.js";
|
|
@@ -208,7 +209,7 @@ const props = defineProps({
|
|
|
208
209
|
},
|
|
209
210
|
|
|
210
211
|
debounce: {
|
|
211
|
-
type: Number,
|
|
212
|
+
type: [String, Number],
|
|
212
213
|
default: getDefault(defaultConfig, UInputSearch).debounce,
|
|
213
214
|
},
|
|
214
215
|
|
|
@@ -254,17 +255,6 @@ const elementId = props.id || useId();
|
|
|
254
255
|
|
|
255
256
|
const { config, inputAttrs, searchIconAttrs, clearIconAttrs, buttonAttrs } = useAttrs(props);
|
|
256
257
|
|
|
257
|
-
const search = computed({
|
|
258
|
-
get: () => props.modelValue,
|
|
259
|
-
set: debounceMethod((value) => {
|
|
260
|
-
localValue.value = value;
|
|
261
|
-
|
|
262
|
-
if (localValue.value.length >= Number(props.minLength)) {
|
|
263
|
-
emit("update:modelValue", value);
|
|
264
|
-
}
|
|
265
|
-
}, props.debounce),
|
|
266
|
-
});
|
|
267
|
-
|
|
268
258
|
const iconSize = computed(() => {
|
|
269
259
|
const sizes = {
|
|
270
260
|
sm: "xs",
|
|
@@ -285,13 +275,36 @@ const buttonSize = computed(() => {
|
|
|
285
275
|
return sizes[props.size];
|
|
286
276
|
});
|
|
287
277
|
|
|
288
|
-
function
|
|
289
|
-
|
|
290
|
-
|
|
278
|
+
function onUpdateModelValue(value) {
|
|
279
|
+
localValue.value = value;
|
|
280
|
+
|
|
281
|
+
if (!value) {
|
|
282
|
+
emit("update:modelValue", localValue.value);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (value.length >= Number(props.minLength)) {
|
|
286
|
+
Number(props.minLength)
|
|
287
|
+
? setDebounce(() => emit("update:modelValue", localValue.value), Number(props.debounce))()
|
|
288
|
+
: value && emit("update:modelValue", localValue.value);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function search() {
|
|
293
|
+
if (localValue.value && localValue.value.length >= Number(props.minLength)) {
|
|
294
|
+
emit("search", localValue.value);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function onKeyupEnter() {
|
|
299
|
+
search();
|
|
291
300
|
}
|
|
292
301
|
|
|
293
302
|
function onClickSearch() {
|
|
294
|
-
|
|
295
|
-
|
|
303
|
+
search();
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function onClickClear() {
|
|
307
|
+
localValue.value = "";
|
|
308
|
+
emit("clear");
|
|
296
309
|
}
|
|
297
310
|
</script>
|
package/ui.text-header/config.js
CHANGED
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.359",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -5560,7 +5560,7 @@
|
|
|
5560
5560
|
"name": "debounce",
|
|
5561
5561
|
"value": {
|
|
5562
5562
|
"kind": "expression",
|
|
5563
|
-
"type": "number"
|
|
5563
|
+
"type": "string|number"
|
|
5564
5564
|
},
|
|
5565
5565
|
"default": "300"
|
|
5566
5566
|
},
|