yc-design-vue 1.1.3 → 1.1.5

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.
Files changed (77) hide show
  1. package/es/Alert/index.vue2.js +2 -2
  2. package/es/Calendar/Calendar.vue2.js +2 -2
  3. package/es/Carousel/Carousel.vue.js +1 -1
  4. package/es/Carousel/Carousel.vue2.js +15 -14
  5. package/es/Carousel/hooks/useContext.js +4 -3
  6. package/es/Cascader/CascaderIcon.vue2.js +2 -2
  7. package/es/Checkbox/Checkbox.vue2.js +2 -2
  8. package/es/Collapse/CollapseItem.vue2.js +2 -2
  9. package/es/Drawer/Drawer.vue2.js +2 -2
  10. package/es/Image/ImagePreview.vue.js +1 -1
  11. package/es/Image/ImagePreview.vue2.js +8 -5
  12. package/es/Input/Input.vue2.js +2 -2
  13. package/es/Input/InputSuffix.vue2.js +2 -2
  14. package/es/InputTag/index.vue2.js +2 -2
  15. package/es/Menu/SubMenu.vue2.js +2 -2
  16. package/es/Message/Message.vue2.js +2 -2
  17. package/es/Modal/Modal.vue2.js +2 -2
  18. package/es/Notification/Notification.vue2.js +2 -2
  19. package/es/PageHeader/index.vue2.js +2 -2
  20. package/es/Radio/Radio.vue2.js +2 -2
  21. package/es/Select/SelectIcon.vue2.js +2 -2
  22. package/es/Tabs/TabButton.vue2.js +2 -2
  23. package/es/Tag/index.vue2.js +2 -2
  24. package/es/Textarea/index.vue2.js +2 -2
  25. package/es/TimePicker/TimePicker.vue2.js +2 -2
  26. package/es/Transfer/TransferPanel.vue2.js +4 -4
  27. package/es/Trigger/index.vue2.js +2 -2
  28. package/es/_shared/components/{ExpandTransition.vue.js → ExpandTransition.vue2.js} +1 -1
  29. package/es/_shared/components/{IconButton.vue2.js → IconButton.vue.js} +1 -1
  30. package/es/_shared/icons/IconDelete.vue.js +1 -16
  31. package/es/_shared/icons/IconDelete.vue2.js +16 -1
  32. package/es/_shared/icons/IconSearch.vue.js +1 -16
  33. package/es/_shared/icons/IconSearch.vue2.js +16 -1
  34. package/es/_shared/utils/dom.js +6 -6
  35. package/es/node_modules/@vueuse/core/index.js +3 -1
  36. package/es/node_modules/@vueuse/shared/index.js +76 -1
  37. package/es/style.css +1 -1
  38. package/lib/Alert/index.vue2.js +1 -1
  39. package/lib/Calendar/Calendar.vue2.js +1 -1
  40. package/lib/Carousel/Carousel.vue.js +1 -1
  41. package/lib/Carousel/Carousel.vue2.js +1 -1
  42. package/lib/Carousel/hooks/useContext.js +1 -1
  43. package/lib/Cascader/CascaderIcon.vue2.js +1 -1
  44. package/lib/Checkbox/Checkbox.vue2.js +1 -1
  45. package/lib/Collapse/CollapseItem.vue2.js +1 -1
  46. package/lib/Drawer/Drawer.vue2.js +1 -1
  47. package/lib/Image/ImagePreview.vue.js +1 -1
  48. package/lib/Image/ImagePreview.vue2.js +1 -1
  49. package/lib/Input/Input.vue2.js +1 -1
  50. package/lib/Input/InputSuffix.vue2.js +1 -1
  51. package/lib/InputTag/index.vue2.js +1 -1
  52. package/lib/Menu/SubMenu.vue2.js +1 -1
  53. package/lib/Message/Message.vue2.js +1 -1
  54. package/lib/Modal/Modal.vue2.js +1 -1
  55. package/lib/Notification/Notification.vue2.js +1 -1
  56. package/lib/PageHeader/index.vue2.js +1 -1
  57. package/lib/Radio/Radio.vue2.js +1 -1
  58. package/lib/Select/SelectIcon.vue2.js +1 -1
  59. package/lib/Tabs/TabButton.vue2.js +1 -1
  60. package/lib/Tag/index.vue2.js +1 -1
  61. package/lib/Textarea/index.vue2.js +1 -1
  62. package/lib/TimePicker/TimePicker.vue2.js +1 -1
  63. package/lib/Transfer/TransferPanel.vue2.js +1 -1
  64. package/lib/Trigger/index.vue2.js +1 -1
  65. package/lib/_shared/components/ExpandTransition.vue2.js +1 -0
  66. package/lib/_shared/components/IconButton.vue.js +1 -0
  67. package/lib/_shared/icons/IconDelete.vue.js +1 -1
  68. package/lib/_shared/icons/IconDelete.vue2.js +1 -1
  69. package/lib/_shared/icons/IconSearch.vue.js +1 -1
  70. package/lib/_shared/icons/IconSearch.vue2.js +1 -1
  71. package/lib/_shared/utils/dom.js +1 -1
  72. package/lib/node_modules/@vueuse/core/index.js +1 -1
  73. package/lib/node_modules/@vueuse/shared/index.js +1 -1
  74. package/lib/style.css +1 -1
  75. package/package.json +1 -1
  76. package/lib/_shared/components/ExpandTransition.vue.js +0 -1
  77. package/lib/_shared/components/IconButton.vue2.js +0 -1
@@ -1,4 +1,4 @@
1
- import { getCurrentScope, onScopeDispose, watch, onMounted, nextTick, isRef, toRefs as toRefs$1, customRef, toValue, getCurrentInstance, hasInjectionContext, inject, shallowRef, readonly } from "vue";
1
+ import { getCurrentScope, onScopeDispose, watch, onMounted, nextTick, isRef, toRefs as toRefs$1, customRef, toValue, getCurrentInstance, shallowRef, hasInjectionContext, inject, readonly } from "vue";
2
2
  function tryOnScopeDispose(fn) {
3
3
  if (getCurrentScope()) {
4
4
  onScopeDispose(fn);
@@ -240,6 +240,79 @@ function tryOnMounted(fn, sync = true, target) {
240
240
  else
241
241
  nextTick(fn);
242
242
  }
243
+ function useIntervalFn(cb, interval = 1e3, options = {}) {
244
+ const {
245
+ immediate = true,
246
+ immediateCallback = false
247
+ } = options;
248
+ let timer = null;
249
+ const isActive = shallowRef(false);
250
+ function clean() {
251
+ if (timer) {
252
+ clearInterval(timer);
253
+ timer = null;
254
+ }
255
+ }
256
+ function pause() {
257
+ isActive.value = false;
258
+ clean();
259
+ }
260
+ function resume() {
261
+ const intervalValue = toValue(interval);
262
+ if (intervalValue <= 0)
263
+ return;
264
+ isActive.value = true;
265
+ if (immediateCallback)
266
+ cb();
267
+ clean();
268
+ if (isActive.value)
269
+ timer = setInterval(cb, intervalValue);
270
+ }
271
+ if (immediate && isClient)
272
+ resume();
273
+ if (isRef(interval) || typeof interval === "function") {
274
+ const stopWatch = watch(interval, () => {
275
+ if (isActive.value && isClient)
276
+ resume();
277
+ });
278
+ tryOnScopeDispose(stopWatch);
279
+ }
280
+ tryOnScopeDispose(pause);
281
+ return {
282
+ isActive,
283
+ pause,
284
+ resume
285
+ };
286
+ }
287
+ function useInterval(interval = 1e3, options = {}) {
288
+ const {
289
+ controls: exposeControls = false,
290
+ immediate = true,
291
+ callback
292
+ } = options;
293
+ const counter = shallowRef(0);
294
+ const update = () => counter.value += 1;
295
+ const reset = () => {
296
+ counter.value = 0;
297
+ };
298
+ const controls = useIntervalFn(
299
+ callback ? () => {
300
+ update();
301
+ callback(counter.value);
302
+ } : update,
303
+ interval,
304
+ { immediate }
305
+ );
306
+ if (exposeControls) {
307
+ return {
308
+ counter,
309
+ reset,
310
+ ...controls
311
+ };
312
+ } else {
313
+ return counter;
314
+ }
315
+ }
243
316
  function useTimeoutFn(cb, interval, options = {}) {
244
317
  const {
245
318
  immediate = true,
@@ -310,6 +383,8 @@ export {
310
383
  tryOnMounted,
311
384
  tryOnScopeDispose,
312
385
  useDebounceFn,
386
+ useInterval,
387
+ useIntervalFn,
313
388
  useThrottleFn,
314
389
  useTimeoutFn,
315
390
  watchImmediate