@hairy/vue-lib 1.3.16 → 1.5.0
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/{LICENSE → LICENSE.md} +1 -3
- package/README.md +36 -0
- package/dist/index.cjs +28 -32
- package/dist/index.d.ts +155 -161
- package/dist/index.global.js +1168 -0
- package/dist/{index.mjs → index.js} +23 -27
- package/package.json +37 -14
package/{LICENSE → LICENSE.md}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025-PRESENT Hairyf <https://github.com/antfu>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -19,5 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
-
|
|
23
|
-
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @hairy/vue-lib
|
|
2
|
+
|
|
3
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![bundle][bundle-src]][bundle-href]
|
|
6
|
+
[![JSDocs][jsdocs-src]][jsdocs-href]
|
|
7
|
+
[![License][license-src]][license-href]
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
ni @hairy/vue-lib
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## CDN
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<script src="https://unpkg.com/@hairy/vue-lib"></script>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
[MIT](./LICENSE) License © [Hairyf](https://github.com/hairyf)
|
|
24
|
+
|
|
25
|
+
<!-- Badges -->
|
|
26
|
+
|
|
27
|
+
[npm-version-src]: https://img.shields.io/npm/v/@hairy/vue-lib?style=flat&colorA=080f12&colorB=1fa669
|
|
28
|
+
[npm-version-href]: https://npmjs.com/package/@hairy/vue-lib
|
|
29
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@hairy/vue-lib?style=flat&colorA=080f12&colorB=1fa669
|
|
30
|
+
[npm-downloads-href]: https://npmjs.com/package/@hairy/vue-lib
|
|
31
|
+
[bundle-src]: https://img.shields.io/bundlephobia/minzip/@hairy/vue-lib?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
|
32
|
+
[bundle-href]: https://bundlephobia.com/result?p=@hairy/vue-lib
|
|
33
|
+
[license-src]: https://img.shields.io/github/license/hairyf/hairylib.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
34
|
+
[license-href]: https://github.com/hairyf/hairylib/blob/main/LICENSE
|
|
35
|
+
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
|
|
36
|
+
[jsdocs-href]: https://www.jsdocs.io/package/@hairy/vue-lib
|
package/dist/index.cjs
CHANGED
|
@@ -28,24 +28,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
CollapseTransition: () => CollapseTransition,
|
|
34
34
|
Field: () => Field,
|
|
35
35
|
ehr: () => ehr,
|
|
36
36
|
propertyToRef: () => propertyToRef,
|
|
37
37
|
syncElementSize: () => syncElementSize,
|
|
38
38
|
syncElementSyncScroll: () => syncElementSyncScroll,
|
|
39
|
-
|
|
39
|
+
useChecked: () => useChecked,
|
|
40
40
|
useSelectedMultiple: () => useSelectedMultiple,
|
|
41
41
|
useSelectedSingle: () => useSelectedSingle,
|
|
42
42
|
useServerPagination: () => useServerPagination
|
|
43
43
|
});
|
|
44
|
-
module.exports = __toCommonJS(
|
|
44
|
+
module.exports = __toCommonJS(index_exports);
|
|
45
45
|
|
|
46
46
|
// src/components/CollapseTransition.ts
|
|
47
|
+
var import_css_render = __toESM(require("css-render"), 1);
|
|
47
48
|
var import_vue_demi = require("vue-demi");
|
|
48
|
-
var import_css_render = __toESM(require("css-render"));
|
|
49
49
|
var { c } = (0, import_css_render.default)();
|
|
50
50
|
var CollapseTransition = (0, import_vue_demi.defineComponent)({
|
|
51
51
|
name: "CollapseTransition",
|
|
@@ -132,10 +132,10 @@ var Field = (0, import_vue_demi2.defineComponent)({
|
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
-
// src/
|
|
135
|
+
// src/hooks/syncElementScroll/index.ts
|
|
136
136
|
var import_core = require("@vueuse/core");
|
|
137
|
-
var
|
|
138
|
-
var
|
|
137
|
+
var import_debounce = __toESM(require("lodash/debounce"), 1);
|
|
138
|
+
var import_throttle = __toESM(require("lodash/throttle"), 1);
|
|
139
139
|
var import_vue = require("vue");
|
|
140
140
|
function syncElementSyncScroll(fromTarget, toTarget, options = {}) {
|
|
141
141
|
const { left = true, top = true, wait, immediate = true } = options;
|
|
@@ -173,7 +173,7 @@ function syncElementSyncScroll(fromTarget, toTarget, options = {}) {
|
|
|
173
173
|
options2.top = aElement.scrollTop;
|
|
174
174
|
if (!aElement || !bElement)
|
|
175
175
|
return;
|
|
176
|
-
bElement
|
|
176
|
+
bElement?.scroll(options2);
|
|
177
177
|
offChangeLockScrollListener(opposite);
|
|
178
178
|
};
|
|
179
179
|
const syncFromTo = () => syncScroll("from");
|
|
@@ -181,8 +181,8 @@ function syncElementSyncScroll(fromTarget, toTarget, options = {}) {
|
|
|
181
181
|
let toStopHandle;
|
|
182
182
|
let formStopHandle;
|
|
183
183
|
const stop = () => {
|
|
184
|
-
toStopHandle
|
|
185
|
-
formStopHandle
|
|
184
|
+
toStopHandle?.();
|
|
185
|
+
formStopHandle?.();
|
|
186
186
|
};
|
|
187
187
|
const start = () => {
|
|
188
188
|
toStopHandle = (0, import_core.useEventListener)(fromTarget, "scroll", (0, import_throttle.default)(syncFromTo, wait));
|
|
@@ -193,7 +193,7 @@ function syncElementSyncScroll(fromTarget, toTarget, options = {}) {
|
|
|
193
193
|
return { stop, start, syncFromTo, syncToFrom };
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
// src/
|
|
196
|
+
// src/hooks/syncElementSize/index.ts
|
|
197
197
|
var import_utils = require("@hairy/utils");
|
|
198
198
|
var import_core2 = require("@vueuse/core");
|
|
199
199
|
var import_vue2 = require("vue");
|
|
@@ -214,8 +214,8 @@ function syncElementSize(fromTarget, toTarget, options = {}) {
|
|
|
214
214
|
return (0, import_vue2.watch)(sources, callback, { immediate: true, ...options });
|
|
215
215
|
};
|
|
216
216
|
const stop = () => {
|
|
217
|
-
widthStopHandle
|
|
218
|
-
heightStopHandle
|
|
217
|
+
widthStopHandle?.();
|
|
218
|
+
heightStopHandle?.();
|
|
219
219
|
const element = (0, import_core2.unrefElement)(toTarget);
|
|
220
220
|
element.style.width = defaultSize.width;
|
|
221
221
|
element.style.height = defaultSize.height;
|
|
@@ -238,9 +238,9 @@ function syncElementSize(fromTarget, toTarget, options = {}) {
|
|
|
238
238
|
return { start, stop };
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
// src/
|
|
241
|
+
// src/hooks/useChecked/index.ts
|
|
242
242
|
var import_vue3 = require("vue");
|
|
243
|
-
function
|
|
243
|
+
function useChecked(target, checked = true, unchecked = false) {
|
|
244
244
|
return (0, import_vue3.computed)({
|
|
245
245
|
get: () => target.value === (0, import_vue3.unref)(checked),
|
|
246
246
|
set: (_value) => {
|
|
@@ -249,10 +249,10 @@ function useCheckedState(target, checked = true, unchecked = false) {
|
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
// src/
|
|
252
|
+
// src/hooks/usePaginationServer/index.ts
|
|
253
253
|
var import_core3 = require("@vueuse/core");
|
|
254
|
+
var import_debounce2 = __toESM(require("lodash/debounce"), 1);
|
|
254
255
|
var import_vue4 = require("vue");
|
|
255
|
-
var import_debounce2 = __toESM(require("lodash/debounce"));
|
|
256
256
|
function useServerPagination(options) {
|
|
257
257
|
const total = (0, import_vue4.ref)(Infinity);
|
|
258
258
|
const pagination = (0, import_core3.useOffsetPagination)({ total, ...options });
|
|
@@ -296,12 +296,12 @@ function useServerPagination(options) {
|
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
// src/
|
|
299
|
+
// src/hooks/useSelectedMultiple/index.ts
|
|
300
300
|
var import_vue6 = require("vue");
|
|
301
301
|
|
|
302
|
-
// src/
|
|
303
|
-
var import_vue5 = require("vue");
|
|
302
|
+
// src/hooks/utils/extendSelected.ts
|
|
304
303
|
var import_core4 = require("@vueuse/core");
|
|
304
|
+
var import_vue5 = require("vue");
|
|
305
305
|
function extendSelected(array, fieldName) {
|
|
306
306
|
(0, import_vue5.watch)(
|
|
307
307
|
array,
|
|
@@ -315,18 +315,15 @@ function extendSelected(array, fieldName) {
|
|
|
315
315
|
);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
// src/
|
|
318
|
+
// src/hooks/useSelectedMultiple/index.ts
|
|
319
319
|
function useSelectedMultiple(array, options = {}) {
|
|
320
320
|
const { fieldName = "select", disabled } = options;
|
|
321
321
|
extendSelected(array, fieldName);
|
|
322
322
|
const selected = (0, import_vue6.computed)(() => (0, import_vue6.unref)(array).filter((item) => item[fieldName]));
|
|
323
323
|
const isSelectedAll = (0, import_vue6.computed)({
|
|
324
|
-
get: () =>
|
|
325
|
-
var _a;
|
|
326
|
-
return !((_a = selected.value) == null ? void 0 : _a.length) && !(0, import_vue6.unref)(array).some((item) => !item[fieldName]);
|
|
327
|
-
},
|
|
324
|
+
get: () => !selected.value?.length && !(0, import_vue6.unref)(array).some((item) => !item[fieldName]),
|
|
328
325
|
set: (value) => (0, import_vue6.unref)(array).forEach((item, index) => {
|
|
329
|
-
if (!
|
|
326
|
+
if (!disabled?.(item, index))
|
|
330
327
|
item[fieldName] = value;
|
|
331
328
|
})
|
|
332
329
|
});
|
|
@@ -338,12 +335,11 @@ function useSelectedMultiple(array, options = {}) {
|
|
|
338
335
|
return { selected, isSelectedAll, isSelected, isIndeterminate };
|
|
339
336
|
}
|
|
340
337
|
|
|
341
|
-
// src/
|
|
338
|
+
// src/hooks/useSelectedSingle/index.ts
|
|
342
339
|
var import_vue7 = require("vue");
|
|
343
340
|
function useSelectedSingle(array, options = {}) {
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
const required = (_b = options.required) != null ? _b : false;
|
|
341
|
+
const fieldName = options.fieldName ?? "select";
|
|
342
|
+
const required = options.required ?? false;
|
|
347
343
|
extendSelected(array, fieldName);
|
|
348
344
|
const SELECTED_SINGLE_KEY = "selected_single_key";
|
|
349
345
|
const isLocked = (0, import_vue7.ref)(false);
|
|
@@ -419,7 +415,7 @@ function propertyToRef(data, prop) {
|
|
|
419
415
|
propertyToRef,
|
|
420
416
|
syncElementSize,
|
|
421
417
|
syncElementSyncScroll,
|
|
422
|
-
|
|
418
|
+
useChecked,
|
|
423
419
|
useSelectedMultiple,
|
|
424
420
|
useSelectedSingle,
|
|
425
421
|
useServerPagination
|
package/dist/index.d.ts
CHANGED
|
@@ -1,181 +1,175 @@
|
|
|
1
|
-
import * as vue_demi from 'vue-demi';
|
|
2
1
|
import { DefineComponent, PropType, VNode, Component, FunctionalComponent } from 'vue-demi';
|
|
3
|
-
import { MaybeRef, MaybeElementRef, UseOffsetPaginationReturn, UseOffsetPaginationOptions } from '@vueuse/core';
|
|
4
2
|
import * as vue from 'vue';
|
|
5
3
|
import { WatchOptions, Ref, UnwrapRef, ComputedRef } from 'vue';
|
|
4
|
+
import { MaybeRef, MaybeElementRef, UseOffsetPaginationReturn, UseOffsetPaginationOptions } from '@vueuse/core';
|
|
5
|
+
import { Noop } from '@hairy/utils';
|
|
6
6
|
import { DebouncedFunc } from 'lodash';
|
|
7
7
|
|
|
8
8
|
declare const CollapseTransition: DefineComponent;
|
|
9
9
|
|
|
10
|
-
declare const Field:
|
|
11
|
-
is: {
|
|
12
|
-
type: PropType<string | number | VNode
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
is: string | number | VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}> | Component<any, any, any, vue_demi.ComputedOptions, vue_demi.MethodOptions, {}, any>;
|
|
30
|
-
}, {}, {}, {}, string, vue_demi.ComponentProvideOptions, true, {}, any>;
|
|
10
|
+
declare const Field: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
11
|
+
is: {
|
|
12
|
+
type: PropType<string | number | VNode | Component>;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
}>, () => string | number | VNode<vue.RendererNode, vue.RendererElement, {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}> | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
18
|
+
is: {
|
|
19
|
+
type: PropType<string | number | VNode | Component>;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
}>> & Readonly<{}>, {
|
|
23
|
+
is: string | number | VNode<vue.RendererNode, vue.RendererElement, {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}> | Component;
|
|
26
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
31
27
|
|
|
32
|
-
interface SyncElementSyncScrollOptions {
|
|
33
|
-
left?: boolean;
|
|
34
|
-
top?: boolean;
|
|
35
|
-
wait?: number;
|
|
36
|
-
immediate?: boolean;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* @param fromTarget DOM-A
|
|
41
|
-
* @param toTarget DOM-B
|
|
42
|
-
* @param options
|
|
43
|
-
* @todo
|
|
44
|
-
* @todo
|
|
45
|
-
*/
|
|
46
|
-
declare function syncElementSyncScroll(fromTarget: MaybeRef<EventTarget | null | undefined>, toTarget: MaybeRef<EventTarget | null | undefined>, options?: SyncElementSyncScrollOptions): {
|
|
47
|
-
stop: () => void;
|
|
48
|
-
start: () => void;
|
|
49
|
-
syncFromTo: () => void;
|
|
50
|
-
syncToFrom: () => void;
|
|
28
|
+
interface SyncElementSyncScrollOptions {
|
|
29
|
+
left?: boolean;
|
|
30
|
+
top?: boolean;
|
|
31
|
+
wait?: number;
|
|
32
|
+
immediate?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Synchronize scrolling between two DOM with the same scrollbar
|
|
36
|
+
* @param fromTarget DOM-A
|
|
37
|
+
* @param toTarget DOM-B
|
|
38
|
+
* @param options
|
|
39
|
+
* @todo optimizes the reuse of useEventListener
|
|
40
|
+
* @todo may have bugs when using wait
|
|
41
|
+
*/
|
|
42
|
+
declare function syncElementSyncScroll(fromTarget: MaybeRef<EventTarget | null | undefined>, toTarget: MaybeRef<EventTarget | null | undefined>, options?: SyncElementSyncScrollOptions): {
|
|
43
|
+
stop: () => void;
|
|
44
|
+
start: () => void;
|
|
45
|
+
syncFromTo: () => void;
|
|
46
|
+
syncToFrom: () => void;
|
|
51
47
|
};
|
|
52
48
|
|
|
53
|
-
interface SyncElementSizeOptions extends WatchOptions {
|
|
54
|
-
/**
|
|
55
|
-
width?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
height?: boolean;
|
|
58
|
-
}
|
|
59
|
-
interface SyncElementSizeReturn {
|
|
60
|
-
start?:
|
|
61
|
-
stop?:
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @param fromTarget
|
|
66
|
-
* @param toTarget
|
|
67
|
-
* @param options
|
|
68
|
-
*/
|
|
49
|
+
interface SyncElementSizeOptions extends WatchOptions {
|
|
50
|
+
/** Is the width enabled @default true */
|
|
51
|
+
width?: boolean;
|
|
52
|
+
/** Is the height enabled @default true */
|
|
53
|
+
height?: boolean;
|
|
54
|
+
}
|
|
55
|
+
interface SyncElementSizeReturn {
|
|
56
|
+
start?: Noop;
|
|
57
|
+
stop?: Noop;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Synchronize the width or height of from DOM to the specified to DOM
|
|
61
|
+
* @param fromTarget width and height source element
|
|
62
|
+
* @param toTarget width and height setting elements
|
|
63
|
+
* @param options
|
|
64
|
+
*/
|
|
69
65
|
declare function syncElementSize(fromTarget: MaybeElementRef, toTarget: MaybeElementRef, options?: SyncElementSizeOptions): SyncElementSizeReturn;
|
|
70
66
|
|
|
71
|
-
type CheckedState = string | boolean | number | symbol;
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* @param target
|
|
75
|
-
* @param checked
|
|
76
|
-
* @param unchecked
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
declare function useCheckedState(target: Ref<any>, checked?: MaybeRef<CheckedState>, unchecked?: MaybeRef<CheckedState>): vue.WritableComputedRef<boolean, boolean>;
|
|
67
|
+
type CheckedState = string | boolean | number | symbol;
|
|
68
|
+
/**
|
|
69
|
+
* Get the status of checked and customize the value of checked | unchecked
|
|
70
|
+
* @param target
|
|
71
|
+
* @param checked
|
|
72
|
+
* @param unchecked
|
|
73
|
+
*/
|
|
74
|
+
declare function useChecked(target: Ref<any>, checked?: MaybeRef<CheckedState>, unchecked?: MaybeRef<CheckedState>): vue.WritableComputedRef<boolean, boolean>;
|
|
80
75
|
|
|
81
|
-
type UseServerPaginationResolve = UnwrapRef<Pick<UseOffsetPaginationReturn, 'currentPage' | 'currentPageSize'> & {
|
|
82
|
-
total: number;
|
|
83
|
-
}>;
|
|
84
|
-
type UseServerPagination = UnwrapRef<Omit<UseOffsetPaginationReturn, 'next' | 'prev'> & {
|
|
85
|
-
total: Ref<number>;
|
|
86
|
-
}>;
|
|
87
|
-
interface UseServerPaginationOptions<T> extends UseOffsetPaginationOptions, WatchOptions {
|
|
88
|
-
resolve: (pagination: UseServerPaginationResolve) => T | Promise<T>;
|
|
89
|
-
/**
|
|
90
|
-
sources?: any[];
|
|
91
|
-
}
|
|
92
|
-
interface UseServerPaginationReturn<T> {
|
|
93
|
-
state: Ref<T>;
|
|
94
|
-
loading: Ref<boolean>;
|
|
95
|
-
error: Ref<any>;
|
|
96
|
-
pagination: UseServerPagination;
|
|
97
|
-
next: () => void;
|
|
98
|
-
prev: () => void;
|
|
99
|
-
execute: DebouncedFunc<() => Promise<void>>;
|
|
100
|
-
}
|
|
76
|
+
type UseServerPaginationResolve = UnwrapRef<Pick<UseOffsetPaginationReturn, 'currentPage' | 'currentPageSize'> & {
|
|
77
|
+
total: number;
|
|
78
|
+
}>;
|
|
79
|
+
type UseServerPagination = UnwrapRef<Omit<UseOffsetPaginationReturn, 'next' | 'prev'> & {
|
|
80
|
+
total: Ref<number>;
|
|
81
|
+
}>;
|
|
82
|
+
interface UseServerPaginationOptions<T> extends UseOffsetPaginationOptions, WatchOptions {
|
|
83
|
+
resolve: (pagination: UseServerPaginationResolve) => T | Promise<T>;
|
|
84
|
+
/** Monitor the source, trigger reset when the source data changes, default to monitoring page generation */
|
|
85
|
+
sources?: any[];
|
|
86
|
+
}
|
|
87
|
+
interface UseServerPaginationReturn<T> {
|
|
88
|
+
state: Ref<T>;
|
|
89
|
+
loading: Ref<boolean>;
|
|
90
|
+
error: Ref<any>;
|
|
91
|
+
pagination: UseServerPagination;
|
|
92
|
+
next: () => void;
|
|
93
|
+
prev: () => void;
|
|
94
|
+
execute: DebouncedFunc<() => Promise<void>>;
|
|
95
|
+
}
|
|
101
96
|
declare function useServerPagination<T extends any[]>(options: UseServerPaginationOptions<T>): UseServerPaginationReturn<T>;
|
|
102
97
|
|
|
103
|
-
type SelectedMultipleArray = MaybeRef<{
|
|
104
|
-
[key: string]: any;
|
|
105
|
-
}[]>;
|
|
106
|
-
interface SelectedMultipleOptions<T extends SelectedMultipleArray> {
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* @default 'select'
|
|
111
|
-
*/
|
|
112
|
-
fieldName?: string;
|
|
113
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
*/
|
|
116
|
-
disabled?: (item: UnwrapRef<T>[number], index: number) => boolean | void;
|
|
117
|
-
}
|
|
118
|
-
interface SelectedMultipleResult<T extends SelectedMultipleArray> {
|
|
119
|
-
/**
|
|
120
|
-
*
|
|
121
|
-
*/
|
|
122
|
-
selected: ComputedRef<UnwrapRef<T>>;
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
125
|
-
*/
|
|
126
|
-
isSelectedAll: Ref<boolean>;
|
|
127
|
-
/**
|
|
128
|
-
*
|
|
129
|
-
*/
|
|
130
|
-
isSelected: ComputedRef<boolean>;
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
133
|
-
*/
|
|
134
|
-
isIndeterminate: ComputedRef<boolean>;
|
|
135
|
-
}
|
|
98
|
+
type SelectedMultipleArray = MaybeRef<{
|
|
99
|
+
[key: string]: any;
|
|
100
|
+
}[]>;
|
|
101
|
+
interface SelectedMultipleOptions<T extends SelectedMultipleArray> {
|
|
102
|
+
/**
|
|
103
|
+
* Select Field
|
|
104
|
+
*
|
|
105
|
+
* @default 'select'
|
|
106
|
+
*/
|
|
107
|
+
fieldName?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Processing disabled, takes effect when isSelectAll is changed
|
|
110
|
+
*/
|
|
111
|
+
disabled?: (item: UnwrapRef<T>[number], index: number) => boolean | void;
|
|
112
|
+
}
|
|
113
|
+
interface SelectedMultipleResult<T extends SelectedMultipleArray> {
|
|
114
|
+
/**
|
|
115
|
+
* All currently selected items
|
|
116
|
+
*/
|
|
117
|
+
selected: ComputedRef<UnwrapRef<T>>;
|
|
118
|
+
/**
|
|
119
|
+
* Is it currently all selected, Changing it will affect the selection of the list
|
|
120
|
+
*/
|
|
121
|
+
isSelectedAll: Ref<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* Whether to choose
|
|
124
|
+
*/
|
|
125
|
+
isSelected: ComputedRef<boolean>;
|
|
126
|
+
/**
|
|
127
|
+
* Selected, but not fully selected (usually used for checkbox components)
|
|
128
|
+
*/
|
|
129
|
+
isIndeterminate: ComputedRef<boolean>;
|
|
130
|
+
}
|
|
136
131
|
declare function useSelectedMultiple<T extends SelectedMultipleArray>(array: T, options?: SelectedMultipleOptions<T>): SelectedMultipleResult<T>;
|
|
137
132
|
|
|
138
|
-
type SelectedSingleArray = MaybeRef<{
|
|
139
|
-
[key: string]: any;
|
|
140
|
-
}[]>;
|
|
141
|
-
interface SelectedSingleOptions {
|
|
142
|
-
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* @default 'select'
|
|
146
|
-
*/
|
|
147
|
-
fieldName?: string;
|
|
148
|
-
/**
|
|
149
|
-
*
|
|
150
|
-
* @default false
|
|
151
|
-
*
|
|
152
|
-
*/
|
|
153
|
-
required?: true | number;
|
|
154
|
-
}
|
|
155
|
-
interface SelectedSingleResult<T extends SelectedSingleArray> {
|
|
156
|
-
/**
|
|
157
|
-
* 当前选中项
|
|
158
|
-
*/
|
|
159
|
-
selected: ComputedRef<UnwrapRef<T>[number] | undefined>;
|
|
160
|
-
/**
|
|
161
|
-
* 是否已经选择
|
|
162
|
-
*/
|
|
163
|
-
isSelected: ComputedRef<boolean>;
|
|
164
|
-
}
|
|
133
|
+
type SelectedSingleArray = MaybeRef<{
|
|
134
|
+
[key: string]: any;
|
|
135
|
+
}[]>;
|
|
136
|
+
interface SelectedSingleOptions {
|
|
137
|
+
/**
|
|
138
|
+
* Select Field
|
|
139
|
+
*
|
|
140
|
+
* @default 'select'
|
|
141
|
+
*/
|
|
142
|
+
fieldName?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Is it mandatory, What is the mandatory option
|
|
145
|
+
* @default false
|
|
146
|
+
*
|
|
147
|
+
*/
|
|
148
|
+
required?: true | number;
|
|
149
|
+
}
|
|
150
|
+
interface SelectedSingleResult<T extends SelectedSingleArray> {
|
|
151
|
+
/**
|
|
152
|
+
* 当前选中项
|
|
153
|
+
*/
|
|
154
|
+
selected: ComputedRef<UnwrapRef<T>[number] | undefined>;
|
|
155
|
+
/**
|
|
156
|
+
* 是否已经选择
|
|
157
|
+
*/
|
|
158
|
+
isSelected: ComputedRef<boolean>;
|
|
159
|
+
}
|
|
165
160
|
declare function useSelectedSingle<T extends SelectedSingleArray>(array: T, options?: SelectedSingleOptions): SelectedSingleResult<T>;
|
|
166
161
|
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
* @param component
|
|
170
|
-
* @param tag
|
|
171
|
-
*/
|
|
172
|
-
declare function ehr<K extends keyof HTMLElementTagNameMap = 'div'>(component: FunctionalComponent, tag?: K): HTMLElementTagNameMap[K];
|
|
173
|
-
/**
|
|
174
|
-
*
|
|
175
|
-
* @param data
|
|
176
|
-
* @param prop
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
declare function propertyToRef<T>(data: T, prop: keyof T): vue_demi.WritableComputedRef<T[keyof T], T[keyof T]>;
|
|
162
|
+
/**
|
|
163
|
+
* Directly render the incoming function components
|
|
164
|
+
* @param component
|
|
165
|
+
* @param tag Rendering container (default div)
|
|
166
|
+
*/
|
|
167
|
+
declare function ehr<K extends keyof HTMLElementTagNameMap = 'div'>(component: FunctionalComponent, tag?: K): HTMLElementTagNameMap[K];
|
|
168
|
+
/**
|
|
169
|
+
* Convert the properties of an object to ref
|
|
170
|
+
* @param data
|
|
171
|
+
* @param prop
|
|
172
|
+
*/
|
|
173
|
+
declare function propertyToRef<T>(data: T, prop: keyof T): vue.WritableComputedRef<T[keyof T], T[keyof T]>;
|
|
180
174
|
|
|
181
|
-
export { CheckedState, CollapseTransition, Field, SelectedMultipleArray, SelectedMultipleOptions, SelectedMultipleResult, SelectedSingleArray, SelectedSingleOptions, SelectedSingleResult, SyncElementSizeOptions, SyncElementSizeReturn, UseServerPagination, UseServerPaginationOptions, UseServerPaginationResolve, UseServerPaginationReturn, ehr, propertyToRef, syncElementSize, syncElementSyncScroll,
|
|
175
|
+
export { type CheckedState, CollapseTransition, Field, type SelectedMultipleArray, type SelectedMultipleOptions, type SelectedMultipleResult, type SelectedSingleArray, type SelectedSingleOptions, type SelectedSingleResult, type SyncElementSizeOptions, type SyncElementSizeReturn, type UseServerPagination, type UseServerPaginationOptions, type UseServerPaginationResolve, type UseServerPaginationReturn, ehr, propertyToRef, syncElementSize, syncElementSyncScroll, useChecked, useSelectedMultiple, useSelectedSingle, useServerPagination };
|