@vueuse/integrations 10.3.0 → 10.4.1
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/index.cjs +40 -162
- package/index.d.cts +8 -18
- package/index.d.mts +8 -18
- package/index.d.ts +8 -18
- package/index.iife.js +40 -162
- package/index.iife.min.js +1 -1
- package/index.mjs +42 -164
- package/package.json +36 -36
- package/useAsyncValidator/component.cjs +5 -29
- package/useAsyncValidator/component.mjs +5 -29
- package/useAsyncValidator.cjs +3 -21
- package/useAsyncValidator.d.cts +1 -1
- package/useAsyncValidator.d.mts +1 -1
- package/useAsyncValidator.d.ts +1 -1
- package/useAsyncValidator.iife.js +3 -21
- package/useAsyncValidator.iife.min.js +1 -1
- package/useAsyncValidator.mjs +3 -21
- package/useAxios.cjs +5 -21
- package/useAxios.d.cts +1 -1
- package/useAxios.d.mts +1 -1
- package/useAxios.d.ts +1 -1
- package/useAxios.iife.js +5 -21
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +5 -21
- package/useChangeCase.d.cts +2 -14
- package/useChangeCase.d.mts +2 -14
- package/useChangeCase.d.ts +2 -14
- package/useCookies.cjs +2 -18
- package/useCookies.iife.js +2 -18
- package/useCookies.iife.min.js +1 -1
- package/useCookies.mjs +2 -18
- package/useDrauu.cjs +1 -17
- package/useDrauu.d.cts +1 -1
- package/useDrauu.d.mts +1 -1
- package/useDrauu.d.ts +1 -1
- package/useDrauu.iife.js +1 -17
- package/useDrauu.iife.min.js +1 -1
- package/useDrauu.mjs +1 -17
- package/useFocusTrap/component.d.cts +1 -1
- package/useFocusTrap/component.d.mts +1 -1
- package/useFocusTrap/component.d.ts +1 -1
- package/useFocusTrap.cjs +4 -34
- package/useFocusTrap.d.cts +1 -1
- package/useFocusTrap.d.mts +1 -1
- package/useFocusTrap.d.ts +1 -1
- package/useFocusTrap.iife.js +4 -34
- package/useFocusTrap.iife.min.js +1 -1
- package/useFocusTrap.mjs +4 -34
- package/useFuse.d.cts +1 -1
- package/useFuse.d.mts +1 -1
- package/useFuse.d.ts +1 -1
- package/useIDBKeyval.cjs +17 -19
- package/useIDBKeyval.d.cts +8 -6
- package/useIDBKeyval.d.mts +8 -6
- package/useIDBKeyval.d.ts +8 -6
- package/useIDBKeyval.iife.js +18 -21
- package/useIDBKeyval.iife.min.js +1 -1
- package/useIDBKeyval.mjs +18 -20
- package/useJwt.d.cts +1 -1
- package/useJwt.d.mts +1 -1
- package/useJwt.d.ts +1 -1
- package/useNProgress.d.cts +1 -1
- package/useNProgress.d.mts +1 -1
- package/useNProgress.d.ts +1 -1
- package/useSortable/component.cjs +13 -36
- package/useSortable/component.mjs +14 -37
- package/useSortable.cjs +9 -32
- package/useSortable.d.cts +1 -1
- package/useSortable.d.mts +1 -1
- package/useSortable.d.ts +1 -1
- package/useSortable.iife.js +9 -32
- package/useSortable.iife.min.js +1 -1
- package/useSortable.mjs +10 -33
package/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { toRef, toValue, until, noop, tryOnScopeDispose, isClient } from '@vueuse/shared';
|
|
2
2
|
import Schema from 'async-validator';
|
|
3
|
-
import { shallowRef, ref, computed, watch, watchEffect, nextTick } from 'vue-demi';
|
|
3
|
+
import { shallowRef, ref, computed, watch, watchEffect, isRef, nextTick } from 'vue-demi';
|
|
4
4
|
import axios, { AxiosError } from 'axios';
|
|
5
5
|
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase } from 'change-case';
|
|
6
6
|
import Cookie from 'universal-cookie';
|
|
7
7
|
import { createDrauu } from 'drauu';
|
|
8
|
-
import { createEventHook, unrefElement, tryOnScopeDispose as tryOnScopeDispose$1, tryOnMounted, toValue as toValue$1, defaultDocument } from '@vueuse/core';
|
|
8
|
+
import { createEventHook, unrefElement, tryOnScopeDispose as tryOnScopeDispose$1, watchPausable, tryOnMounted, toValue as toValue$1, defaultDocument } from '@vueuse/core';
|
|
9
9
|
import { createFocusTrap } from 'focus-trap';
|
|
10
10
|
import Fuse from 'fuse.js';
|
|
11
11
|
import { get, set, del, update } from 'idb-keyval';
|
|
@@ -14,25 +14,6 @@ import nprogress from 'nprogress';
|
|
|
14
14
|
import QRCode from 'qrcode';
|
|
15
15
|
import Sortable from 'sortablejs';
|
|
16
16
|
|
|
17
|
-
var __defProp$6 = Object.defineProperty;
|
|
18
|
-
var __defProps$2 = Object.defineProperties;
|
|
19
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
20
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
21
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
22
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
23
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
24
|
-
var __spreadValues$6 = (a, b) => {
|
|
25
|
-
for (var prop in b || (b = {}))
|
|
26
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
27
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
28
|
-
if (__getOwnPropSymbols$6)
|
|
29
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
30
|
-
if (__propIsEnum$6.call(b, prop))
|
|
31
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
32
|
-
}
|
|
33
|
-
return a;
|
|
34
|
-
};
|
|
35
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
36
17
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
37
18
|
function useAsyncValidator(value, rules, options = {}) {
|
|
38
19
|
const {
|
|
@@ -92,32 +73,14 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
92
73
|
until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
|
93
74
|
});
|
|
94
75
|
}
|
|
95
|
-
return
|
|
76
|
+
return {
|
|
77
|
+
...shell,
|
|
96
78
|
then(onFulfilled, onRejected) {
|
|
97
79
|
return waitUntilFinished().then(onFulfilled, onRejected);
|
|
98
80
|
}
|
|
99
|
-
}
|
|
81
|
+
};
|
|
100
82
|
}
|
|
101
83
|
|
|
102
|
-
var __defProp$5 = Object.defineProperty;
|
|
103
|
-
var __defProps$1 = Object.defineProperties;
|
|
104
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
105
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
106
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
107
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
108
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
109
|
-
var __spreadValues$5 = (a, b) => {
|
|
110
|
-
for (var prop in b || (b = {}))
|
|
111
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
112
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
113
|
-
if (__getOwnPropSymbols$5)
|
|
114
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
115
|
-
if (__propIsEnum$5.call(b, prop))
|
|
116
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
117
|
-
}
|
|
118
|
-
return a;
|
|
119
|
-
};
|
|
120
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
121
84
|
function useAxios(...args) {
|
|
122
85
|
const url = typeof args[0] === "string" ? args[0] : void 0;
|
|
123
86
|
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
|
@@ -194,7 +157,7 @@ function useAxios(...args) {
|
|
|
194
157
|
loading(true);
|
|
195
158
|
executeCounter += 1;
|
|
196
159
|
const currentExecuteCounter = executeCounter;
|
|
197
|
-
instance(_url,
|
|
160
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
198
161
|
response.value = r;
|
|
199
162
|
const result2 = r.data;
|
|
200
163
|
data.value = result2;
|
|
@@ -224,7 +187,10 @@ function useAxios(...args) {
|
|
|
224
187
|
abort,
|
|
225
188
|
execute
|
|
226
189
|
};
|
|
227
|
-
return
|
|
190
|
+
return {
|
|
191
|
+
...result,
|
|
192
|
+
...promise
|
|
193
|
+
};
|
|
228
194
|
}
|
|
229
195
|
|
|
230
196
|
var changeCase = /*#__PURE__*/Object.freeze({
|
|
@@ -256,22 +222,6 @@ function useChangeCase(input, type, options) {
|
|
|
256
222
|
});
|
|
257
223
|
}
|
|
258
224
|
|
|
259
|
-
var __defProp$4 = Object.defineProperty;
|
|
260
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
261
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
262
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
263
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
264
|
-
var __spreadValues$4 = (a, b) => {
|
|
265
|
-
for (var prop in b || (b = {}))
|
|
266
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
267
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
268
|
-
if (__getOwnPropSymbols$4)
|
|
269
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
270
|
-
if (__propIsEnum$4.call(b, prop))
|
|
271
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
272
|
-
}
|
|
273
|
-
return a;
|
|
274
|
-
};
|
|
275
225
|
function createCookies(req) {
|
|
276
226
|
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
|
277
227
|
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
|
@@ -302,14 +252,14 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
|
|
|
302
252
|
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
303
253
|
watchingDependencies.push(args[0]);
|
|
304
254
|
touches.value;
|
|
305
|
-
return cookies.get(args[0],
|
|
255
|
+
return cookies.get(args[0], { doNotParse, ...args[1] });
|
|
306
256
|
},
|
|
307
257
|
/**
|
|
308
258
|
* Reactive get all cookies
|
|
309
259
|
*/
|
|
310
260
|
getAll: (...args) => {
|
|
311
261
|
touches.value;
|
|
312
|
-
return cookies.getAll(
|
|
262
|
+
return cookies.getAll({ doNotParse, ...args[0] });
|
|
313
263
|
},
|
|
314
264
|
set: (...args) => cookies.set(...args),
|
|
315
265
|
remove: (...args) => cookies.remove(...args),
|
|
@@ -327,22 +277,6 @@ function shouldUpdate(dependencies, newCookies, oldCookies) {
|
|
|
327
277
|
return false;
|
|
328
278
|
}
|
|
329
279
|
|
|
330
|
-
var __defProp$3 = Object.defineProperty;
|
|
331
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
332
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
333
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
334
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
335
|
-
var __spreadValues$3 = (a, b) => {
|
|
336
|
-
for (var prop in b || (b = {}))
|
|
337
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
338
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
339
|
-
if (__getOwnPropSymbols$3)
|
|
340
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
341
|
-
if (__propIsEnum$3.call(b, prop))
|
|
342
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
343
|
-
}
|
|
344
|
-
return a;
|
|
345
|
-
};
|
|
346
280
|
function useDrauu(target, options) {
|
|
347
281
|
const drauuInstance = ref();
|
|
348
282
|
let disposables = [];
|
|
@@ -415,7 +349,7 @@ function useDrauu(target, options) {
|
|
|
415
349
|
return;
|
|
416
350
|
if (drauuInstance.value)
|
|
417
351
|
cleanup();
|
|
418
|
-
drauuInstance.value = createDrauu(
|
|
352
|
+
drauuInstance.value = createDrauu({ el, ...options });
|
|
419
353
|
syncStatus();
|
|
420
354
|
disposables = [
|
|
421
355
|
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
|
|
@@ -450,40 +384,9 @@ function useDrauu(target, options) {
|
|
|
450
384
|
};
|
|
451
385
|
}
|
|
452
386
|
|
|
453
|
-
var __defProp$2 = Object.defineProperty;
|
|
454
|
-
var __defProps = Object.defineProperties;
|
|
455
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
456
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
457
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
458
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
459
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
460
|
-
var __spreadValues$2 = (a, b) => {
|
|
461
|
-
for (var prop in b || (b = {}))
|
|
462
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
463
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
464
|
-
if (__getOwnPropSymbols$2)
|
|
465
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
466
|
-
if (__propIsEnum$2.call(b, prop))
|
|
467
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
468
|
-
}
|
|
469
|
-
return a;
|
|
470
|
-
};
|
|
471
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
472
|
-
var __objRest$1 = (source, exclude) => {
|
|
473
|
-
var target = {};
|
|
474
|
-
for (var prop in source)
|
|
475
|
-
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
476
|
-
target[prop] = source[prop];
|
|
477
|
-
if (source != null && __getOwnPropSymbols$2)
|
|
478
|
-
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
479
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
480
|
-
target[prop] = source[prop];
|
|
481
|
-
}
|
|
482
|
-
return target;
|
|
483
|
-
};
|
|
484
387
|
function useFocusTrap(target, options = {}) {
|
|
485
388
|
let trap;
|
|
486
|
-
const
|
|
389
|
+
const { immediate, ...focusTrapOptions } = options;
|
|
487
390
|
const hasFocus = ref(false);
|
|
488
391
|
const isPaused = ref(false);
|
|
489
392
|
const activate = (opts) => trap && trap.activate(opts);
|
|
@@ -505,7 +408,8 @@ function useFocusTrap(target, options = {}) {
|
|
|
505
408
|
(el) => {
|
|
506
409
|
if (!el)
|
|
507
410
|
return;
|
|
508
|
-
trap = createFocusTrap(el,
|
|
411
|
+
trap = createFocusTrap(el, {
|
|
412
|
+
...focusTrapOptions,
|
|
509
413
|
onActivate() {
|
|
510
414
|
hasFocus.value = true;
|
|
511
415
|
if (options.onActivate)
|
|
@@ -516,7 +420,7 @@ function useFocusTrap(target, options = {}) {
|
|
|
516
420
|
if (options.onDeactivate)
|
|
517
421
|
options.onDeactivate();
|
|
518
422
|
}
|
|
519
|
-
})
|
|
423
|
+
});
|
|
520
424
|
if (immediate)
|
|
521
425
|
activate();
|
|
522
426
|
},
|
|
@@ -572,22 +476,6 @@ function useFuse(search, data, options) {
|
|
|
572
476
|
};
|
|
573
477
|
}
|
|
574
478
|
|
|
575
|
-
var __defProp$1 = Object.defineProperty;
|
|
576
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
577
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
578
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
579
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
580
|
-
var __spreadValues$1 = (a, b) => {
|
|
581
|
-
for (var prop in b || (b = {}))
|
|
582
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
583
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
584
|
-
if (__getOwnPropSymbols$1)
|
|
585
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
586
|
-
if (__propIsEnum$1.call(b, prop))
|
|
587
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
588
|
-
}
|
|
589
|
-
return a;
|
|
590
|
-
};
|
|
591
479
|
function useIDBKeyval(key, initialValue, options = {}) {
|
|
592
480
|
const {
|
|
593
481
|
flush = "pre",
|
|
@@ -624,7 +512,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
|
|
|
624
512
|
if (Array.isArray(data.value))
|
|
625
513
|
await update(key, () => JSON.parse(JSON.stringify(data.value)));
|
|
626
514
|
else if (typeof data.value === "object")
|
|
627
|
-
await update(key, () =>
|
|
515
|
+
await update(key, () => ({ ...data.value }));
|
|
628
516
|
else
|
|
629
517
|
await update(key, () => data.value);
|
|
630
518
|
}
|
|
@@ -632,8 +520,21 @@ function useIDBKeyval(key, initialValue, options = {}) {
|
|
|
632
520
|
onError(e);
|
|
633
521
|
}
|
|
634
522
|
}
|
|
635
|
-
|
|
636
|
-
|
|
523
|
+
const {
|
|
524
|
+
pause: pauseWatch,
|
|
525
|
+
resume: resumeWatch
|
|
526
|
+
} = watchPausable(data, () => write(), { flush, deep });
|
|
527
|
+
async function setData(value) {
|
|
528
|
+
pauseWatch();
|
|
529
|
+
data.value = value;
|
|
530
|
+
await write();
|
|
531
|
+
resumeWatch();
|
|
532
|
+
}
|
|
533
|
+
return {
|
|
534
|
+
set: setData,
|
|
535
|
+
isFinished,
|
|
536
|
+
data
|
|
537
|
+
};
|
|
637
538
|
}
|
|
638
539
|
|
|
639
540
|
function useJwt(encodedJwt, options = {}) {
|
|
@@ -701,37 +602,9 @@ function useQRCode(text, options) {
|
|
|
701
602
|
return result;
|
|
702
603
|
}
|
|
703
604
|
|
|
704
|
-
var __defProp = Object.defineProperty;
|
|
705
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
706
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
707
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
708
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
709
|
-
var __spreadValues = (a, b) => {
|
|
710
|
-
for (var prop in b || (b = {}))
|
|
711
|
-
if (__hasOwnProp.call(b, prop))
|
|
712
|
-
__defNormalProp(a, prop, b[prop]);
|
|
713
|
-
if (__getOwnPropSymbols)
|
|
714
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
715
|
-
if (__propIsEnum.call(b, prop))
|
|
716
|
-
__defNormalProp(a, prop, b[prop]);
|
|
717
|
-
}
|
|
718
|
-
return a;
|
|
719
|
-
};
|
|
720
|
-
var __objRest = (source, exclude) => {
|
|
721
|
-
var target = {};
|
|
722
|
-
for (var prop in source)
|
|
723
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
724
|
-
target[prop] = source[prop];
|
|
725
|
-
if (source != null && __getOwnPropSymbols)
|
|
726
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
727
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
728
|
-
target[prop] = source[prop];
|
|
729
|
-
}
|
|
730
|
-
return target;
|
|
731
|
-
};
|
|
732
605
|
function useSortable(el, list, options = {}) {
|
|
733
606
|
let sortable;
|
|
734
|
-
const
|
|
607
|
+
const { document = defaultDocument, ...resetOptions } = options;
|
|
735
608
|
const defaultOptions = {
|
|
736
609
|
onUpdate: (e) => {
|
|
737
610
|
moveArrayElement(list, e.oldIndex, e.newIndex);
|
|
@@ -741,7 +614,7 @@ function useSortable(el, list, options = {}) {
|
|
|
741
614
|
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : unrefElement(el);
|
|
742
615
|
if (!target)
|
|
743
616
|
return;
|
|
744
|
-
sortable = new Sortable(target,
|
|
617
|
+
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
|
745
618
|
};
|
|
746
619
|
const stop = () => sortable == null ? void 0 : sortable.destroy();
|
|
747
620
|
const option = (name, value) => {
|
|
@@ -755,10 +628,15 @@ function useSortable(el, list, options = {}) {
|
|
|
755
628
|
return { stop, start, option };
|
|
756
629
|
}
|
|
757
630
|
function moveArrayElement(list, from, to) {
|
|
758
|
-
const
|
|
631
|
+
const _valueIsRef = isRef(list);
|
|
632
|
+
const array = _valueIsRef ? [...toValue$1(list)] : toValue$1(list);
|
|
759
633
|
if (to >= 0 && to < array.length) {
|
|
760
634
|
const element = array.splice(from, 1)[0];
|
|
761
|
-
nextTick(() =>
|
|
635
|
+
nextTick(() => {
|
|
636
|
+
array.splice(to, 0, element);
|
|
637
|
+
if (_valueIsRef)
|
|
638
|
+
list.value = array;
|
|
639
|
+
});
|
|
762
640
|
}
|
|
763
641
|
}
|
|
764
642
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/integrations",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.1",
|
|
4
4
|
"description": "Integration wrappers for utility libraries",
|
|
5
5
|
"author": "Anthony Fu <https://github.com/antfu>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,69 +22,69 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"import": "./index.mjs",
|
|
26
|
+
"require": "./index.cjs"
|
|
27
27
|
},
|
|
28
28
|
"./*": "./*",
|
|
29
29
|
"./useAsyncValidator": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"import": "./useAsyncValidator.mjs",
|
|
31
|
+
"require": "./useAsyncValidator.cjs"
|
|
32
32
|
},
|
|
33
33
|
"./useAxios": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"import": "./useAxios.mjs",
|
|
35
|
+
"require": "./useAxios.cjs"
|
|
36
36
|
},
|
|
37
37
|
"./useCookies": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"import": "./useCookies.mjs",
|
|
39
|
+
"require": "./useCookies.cjs"
|
|
40
40
|
},
|
|
41
41
|
"./useDrauu": {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
42
|
+
"import": "./useDrauu.mjs",
|
|
43
|
+
"require": "./useDrauu.cjs"
|
|
44
44
|
},
|
|
45
45
|
"./useFocusTrap": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"import": "./useFocusTrap.mjs",
|
|
47
|
+
"require": "./useFocusTrap.cjs"
|
|
48
48
|
},
|
|
49
49
|
"./useFocusTrap/component": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"import": "./useFocusTrap/component.mjs",
|
|
51
|
+
"require": "./useFocusTrap/component.cjs"
|
|
52
52
|
},
|
|
53
53
|
"./useFuse": {
|
|
54
|
-
"
|
|
55
|
-
"
|
|
54
|
+
"import": "./useFuse.mjs",
|
|
55
|
+
"require": "./useFuse.cjs"
|
|
56
56
|
},
|
|
57
57
|
"./useJwt": {
|
|
58
|
-
"
|
|
59
|
-
"
|
|
58
|
+
"import": "./useJwt.mjs",
|
|
59
|
+
"require": "./useJwt.cjs"
|
|
60
60
|
},
|
|
61
61
|
"./useNProgress": {
|
|
62
|
-
"
|
|
63
|
-
"
|
|
62
|
+
"import": "./useNProgress.mjs",
|
|
63
|
+
"require": "./useNProgress.cjs"
|
|
64
64
|
},
|
|
65
65
|
"./useQRCode": {
|
|
66
|
-
"
|
|
67
|
-
"
|
|
66
|
+
"import": "./useQRCode.mjs",
|
|
67
|
+
"require": "./useQRCode.cjs"
|
|
68
68
|
},
|
|
69
69
|
"./useChangeCase": {
|
|
70
|
-
"
|
|
71
|
-
"
|
|
70
|
+
"import": "./useChangeCase.mjs",
|
|
71
|
+
"require": "./useChangeCase.cjs"
|
|
72
72
|
},
|
|
73
73
|
"./useAsyncValidator/component": {
|
|
74
|
-
"
|
|
75
|
-
"
|
|
74
|
+
"import": "./useAsyncValidator/component.mjs",
|
|
75
|
+
"require": "./useAsyncValidator/component.cjs"
|
|
76
76
|
},
|
|
77
77
|
"./useIDBKeyval": {
|
|
78
|
-
"
|
|
79
|
-
"
|
|
78
|
+
"import": "./useIDBKeyval.mjs",
|
|
79
|
+
"require": "./useIDBKeyval.cjs"
|
|
80
80
|
},
|
|
81
81
|
"./useSortable": {
|
|
82
|
-
"
|
|
83
|
-
"
|
|
82
|
+
"import": "./useSortable.mjs",
|
|
83
|
+
"require": "./useSortable.cjs"
|
|
84
84
|
},
|
|
85
85
|
"./useSortable/component": {
|
|
86
|
-
"
|
|
87
|
-
"
|
|
86
|
+
"import": "./useSortable/component.mjs",
|
|
87
|
+
"require": "./useSortable/component.cjs"
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"main": "./index.cjs",
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
"dependencies": {
|
|
148
|
-
"@vueuse/core": "10.
|
|
149
|
-
"@vueuse/shared": "10.
|
|
148
|
+
"@vueuse/core": "10.4.1",
|
|
149
|
+
"@vueuse/shared": "10.4.1",
|
|
150
150
|
"vue-demi": ">=0.14.5"
|
|
151
151
|
},
|
|
152
152
|
"devDependencies": {
|
|
@@ -164,6 +164,6 @@
|
|
|
164
164
|
"nprogress": "^0.2.0",
|
|
165
165
|
"qrcode": "^1.5.3",
|
|
166
166
|
"sortablejs": "^1.15.0",
|
|
167
|
-
"universal-cookie": "^
|
|
167
|
+
"universal-cookie": "^6.1.0"
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -4,25 +4,6 @@ var vueDemi = require('vue-demi');
|
|
|
4
4
|
var shared = require('@vueuse/shared');
|
|
5
5
|
var Schema = require('async-validator');
|
|
6
6
|
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __defProps = Object.defineProperties;
|
|
9
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
10
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
-
var __spreadValues = (a, b) => {
|
|
15
|
-
for (var prop in b || (b = {}))
|
|
16
|
-
if (__hasOwnProp.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
if (__getOwnPropSymbols)
|
|
19
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
-
if (__propIsEnum.call(b, prop))
|
|
21
|
-
__defNormalProp(a, prop, b[prop]);
|
|
22
|
-
}
|
|
23
|
-
return a;
|
|
24
|
-
};
|
|
25
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
7
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
27
8
|
function useAsyncValidator(value, rules, options = {}) {
|
|
28
9
|
const {
|
|
@@ -34,14 +15,8 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
34
15
|
const errorInfo = vueDemi.shallowRef(null);
|
|
35
16
|
const isFinished = vueDemi.ref(true);
|
|
36
17
|
const pass = vueDemi.ref(!immediate || manual);
|
|
37
|
-
const errors = vueDemi.computed(() =>
|
|
38
|
-
|
|
39
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
40
|
-
});
|
|
41
|
-
const errorFields = vueDemi.computed(() => {
|
|
42
|
-
var _a;
|
|
43
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
44
|
-
});
|
|
18
|
+
const errors = vueDemi.computed(() => errorInfo.value?.errors || []);
|
|
19
|
+
const errorFields = vueDemi.computed(() => errorInfo.value?.fields || {});
|
|
45
20
|
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
46
21
|
const execute = async () => {
|
|
47
22
|
isFinished.value = false;
|
|
@@ -82,11 +57,12 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
82
57
|
shared.until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
|
83
58
|
});
|
|
84
59
|
}
|
|
85
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
...shell,
|
|
86
62
|
then(onFulfilled, onRejected) {
|
|
87
63
|
return waitUntilFinished().then(onFulfilled, onRejected);
|
|
88
64
|
}
|
|
89
|
-
}
|
|
65
|
+
};
|
|
90
66
|
}
|
|
91
67
|
|
|
92
68
|
const UseAsyncValidator = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
@@ -2,25 +2,6 @@ import { shallowRef, ref, computed, watch, defineComponent, reactive } from 'vue
|
|
|
2
2
|
import { toRef, toValue, until } from '@vueuse/shared';
|
|
3
3
|
import Schema from 'async-validator';
|
|
4
4
|
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __defProps = Object.defineProperties;
|
|
7
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
5
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
25
6
|
function useAsyncValidator(value, rules, options = {}) {
|
|
26
7
|
const {
|
|
@@ -32,14 +13,8 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
32
13
|
const errorInfo = shallowRef(null);
|
|
33
14
|
const isFinished = ref(true);
|
|
34
15
|
const pass = ref(!immediate || manual);
|
|
35
|
-
const errors = computed(() =>
|
|
36
|
-
|
|
37
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
38
|
-
});
|
|
39
|
-
const errorFields = computed(() => {
|
|
40
|
-
var _a;
|
|
41
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
42
|
-
});
|
|
16
|
+
const errors = computed(() => errorInfo.value?.errors || []);
|
|
17
|
+
const errorFields = computed(() => errorInfo.value?.fields || {});
|
|
43
18
|
const validator = computed(() => new AsyncValidatorSchema(toValue(rules)));
|
|
44
19
|
const execute = async () => {
|
|
45
20
|
isFinished.value = false;
|
|
@@ -80,11 +55,12 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
80
55
|
until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
|
81
56
|
});
|
|
82
57
|
}
|
|
83
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
...shell,
|
|
84
60
|
then(onFulfilled, onRejected) {
|
|
85
61
|
return waitUntilFinished().then(onFulfilled, onRejected);
|
|
86
62
|
}
|
|
87
|
-
}
|
|
63
|
+
};
|
|
88
64
|
}
|
|
89
65
|
|
|
90
66
|
const UseAsyncValidator = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
package/useAsyncValidator.cjs
CHANGED
|
@@ -4,25 +4,6 @@ var shared = require('@vueuse/shared');
|
|
|
4
4
|
var Schema = require('async-validator');
|
|
5
5
|
var vueDemi = require('vue-demi');
|
|
6
6
|
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __defProps = Object.defineProperties;
|
|
9
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
10
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
-
var __spreadValues = (a, b) => {
|
|
15
|
-
for (var prop in b || (b = {}))
|
|
16
|
-
if (__hasOwnProp.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
if (__getOwnPropSymbols)
|
|
19
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
-
if (__propIsEnum.call(b, prop))
|
|
21
|
-
__defNormalProp(a, prop, b[prop]);
|
|
22
|
-
}
|
|
23
|
-
return a;
|
|
24
|
-
};
|
|
25
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
7
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
27
8
|
function useAsyncValidator(value, rules, options = {}) {
|
|
28
9
|
const {
|
|
@@ -82,11 +63,12 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
82
63
|
shared.until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
|
83
64
|
});
|
|
84
65
|
}
|
|
85
|
-
return
|
|
66
|
+
return {
|
|
67
|
+
...shell,
|
|
86
68
|
then(onFulfilled, onRejected) {
|
|
87
69
|
return waitUntilFinished().then(onFulfilled, onRejected);
|
|
88
70
|
}
|
|
89
|
-
}
|
|
71
|
+
};
|
|
90
72
|
}
|
|
91
73
|
|
|
92
74
|
exports.useAsyncValidator = useAsyncValidator;
|
package/useAsyncValidator.d.cts
CHANGED
|
@@ -45,4 +45,4 @@ interface UseAsyncValidatorOptions {
|
|
|
45
45
|
*/
|
|
46
46
|
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
|
|
47
47
|
|
|
48
|
-
export { AsyncValidatorError, UseAsyncValidatorExecuteReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, useAsyncValidator };
|
|
48
|
+
export { type AsyncValidatorError, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, useAsyncValidator };
|
package/useAsyncValidator.d.mts
CHANGED
|
@@ -45,4 +45,4 @@ interface UseAsyncValidatorOptions {
|
|
|
45
45
|
*/
|
|
46
46
|
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
|
|
47
47
|
|
|
48
|
-
export { AsyncValidatorError, UseAsyncValidatorExecuteReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, useAsyncValidator };
|
|
48
|
+
export { type AsyncValidatorError, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, useAsyncValidator };
|
package/useAsyncValidator.d.ts
CHANGED
|
@@ -45,4 +45,4 @@ interface UseAsyncValidatorOptions {
|
|
|
45
45
|
*/
|
|
46
46
|
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
|
|
47
47
|
|
|
48
|
-
export { AsyncValidatorError, UseAsyncValidatorExecuteReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, useAsyncValidator };
|
|
48
|
+
export { type AsyncValidatorError, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, useAsyncValidator };
|