vueless 0.0.240 → 0.0.241
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
package/service.helper/index.js
CHANGED
|
@@ -42,3 +42,14 @@ export function cloneDeep(entity, cache = new WeakMap()) {
|
|
|
42
42
|
...Object.keys(entity).map((prop) => ({ [prop]: cloneDeep(entity[prop], cache) })),
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
export function debounce(func, wait) {
|
|
47
|
+
let timeout;
|
|
48
|
+
|
|
49
|
+
return function (...args) {
|
|
50
|
+
const context = this;
|
|
51
|
+
|
|
52
|
+
clearTimeout(timeout);
|
|
53
|
+
timeout = setTimeout(() => func.apply(context, args), wait);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -81,6 +81,7 @@ import UIcon from "../ui.image-icon";
|
|
|
81
81
|
import UInput from "../ui.form-input";
|
|
82
82
|
import UButton from "../ui.button";
|
|
83
83
|
import UIService, { getRandomId } from "../service.ui";
|
|
84
|
+
import { debounce as debounceMethod } from "../service.helper";
|
|
84
85
|
|
|
85
86
|
import { UInputSearch } from "./constants";
|
|
86
87
|
import defaultConfig from "./configs/default.config";
|
|
@@ -173,6 +174,11 @@ const props = defineProps({
|
|
|
173
174
|
default: () => getRandomId(),
|
|
174
175
|
},
|
|
175
176
|
|
|
177
|
+
debounce: {
|
|
178
|
+
type: Number,
|
|
179
|
+
default: UIService.get(defaultConfig, UInputSearch).default.debounce,
|
|
180
|
+
},
|
|
181
|
+
|
|
176
182
|
/**
|
|
177
183
|
* Component ui config object.
|
|
178
184
|
*/
|
|
@@ -215,10 +221,10 @@ const { config, inputAttrs, searchIconAttrs, clearIconAttrs, buttonAttrs } = use
|
|
|
215
221
|
|
|
216
222
|
const search = computed({
|
|
217
223
|
get: () => props.modelValue,
|
|
218
|
-
set: (value) => {
|
|
224
|
+
set: debounceMethod((value) => {
|
|
219
225
|
localValue.value = value;
|
|
220
226
|
emit("update:modelValue", value);
|
|
221
|
-
},
|
|
227
|
+
}, props.debounce),
|
|
222
228
|
});
|
|
223
229
|
|
|
224
230
|
const iconSize = computed(() => {
|
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.241",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -4982,6 +4982,14 @@
|
|
|
4982
4982
|
},
|
|
4983
4983
|
"default": "() => getRandomId()"
|
|
4984
4984
|
},
|
|
4985
|
+
{
|
|
4986
|
+
"name": "debounce",
|
|
4987
|
+
"value": {
|
|
4988
|
+
"kind": "expression",
|
|
4989
|
+
"type": "number"
|
|
4990
|
+
},
|
|
4991
|
+
"default": "300"
|
|
4992
|
+
},
|
|
4985
4993
|
{
|
|
4986
4994
|
"name": "config",
|
|
4987
4995
|
"description": "Component ui config object.",
|