vueless 0.0.240 → 0.0.242

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.240",
3
+ "version": "0.0.242",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -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
+ }
@@ -619,7 +619,7 @@ const isVariant = computed(() => ({
619
619
 
620
620
  const clickOutsideOptions = computed(() => {
621
621
  if (isVariant.value.input) {
622
- return { ignore: [inputRef.value.input] };
622
+ return { ignore: [inputRef.value.inputRef] };
623
623
  }
624
624
 
625
625
  return {
@@ -234,7 +234,7 @@ const localLabel = computed(() => {
234
234
  });
235
235
 
236
236
  const input = computed(() => {
237
- return moneyInputRef.value.input;
237
+ return moneyInputRef.value.inputRef;
238
238
  });
239
239
 
240
240
  watch(
@@ -15,6 +15,7 @@ export default /*tw*/ {
15
15
  defaultVariants: {
16
16
  size: "md",
17
17
  labelAlign: "topInside",
18
+ debounce: 300,
18
19
  disabled: false,
19
20
  searchButton: false,
20
21
  },
@@ -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.240",
4
+ "version": "0.0.242",
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.",