@hairy/vue-lib 1.51.0 → 1.52.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/dist/index.cjs +27 -27
- package/dist/index.d.cts +11 -11
- package/dist/index.d.mts +10 -10
- package/dist/index.mjs +27 -27
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -26,9 +26,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
}) : target, mod));
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
-
let vue_demi = require("vue-demi");
|
|
30
29
|
let css_render = require("css-render");
|
|
31
30
|
css_render = __toESM(css_render);
|
|
31
|
+
let vue_demi = require("vue-demi");
|
|
32
32
|
let _vueuse_core = require("@vueuse/core");
|
|
33
33
|
let lodash_debounce = require("lodash/debounce");
|
|
34
34
|
lodash_debounce = __toESM(lodash_debounce);
|
|
@@ -37,26 +37,6 @@ lodash_throttle = __toESM(lodash_throttle);
|
|
|
37
37
|
let vue = require("vue");
|
|
38
38
|
let _hairy_utils = require("@hairy/utils");
|
|
39
39
|
|
|
40
|
-
//#region src/components/c-field.ts
|
|
41
|
-
const Field = (0, vue_demi.defineComponent)({
|
|
42
|
-
name: "Field",
|
|
43
|
-
props: { is: {
|
|
44
|
-
type: [
|
|
45
|
-
String,
|
|
46
|
-
Number,
|
|
47
|
-
Object
|
|
48
|
-
],
|
|
49
|
-
default: ""
|
|
50
|
-
} },
|
|
51
|
-
setup(props) {
|
|
52
|
-
return () => {
|
|
53
|
-
if (typeof props.is === "string" || typeof props.is === "number") return props.is;
|
|
54
|
-
return props.is ? (0, vue_demi.h)(props.is) : null;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
//#endregion
|
|
60
40
|
//#region src/components/collapse-transition.ts
|
|
61
41
|
const CollapseTransition = (0, vue_demi.defineComponent)({
|
|
62
42
|
name: "CollapseTransition",
|
|
@@ -122,7 +102,27 @@ const CollapseTransition = (0, vue_demi.defineComponent)({
|
|
|
122
102
|
});
|
|
123
103
|
|
|
124
104
|
//#endregion
|
|
125
|
-
//#region src/
|
|
105
|
+
//#region src/components/field.ts
|
|
106
|
+
const Field = (0, vue_demi.defineComponent)({
|
|
107
|
+
name: "Field",
|
|
108
|
+
props: { is: {
|
|
109
|
+
type: [
|
|
110
|
+
String,
|
|
111
|
+
Number,
|
|
112
|
+
Object
|
|
113
|
+
],
|
|
114
|
+
default: ""
|
|
115
|
+
} },
|
|
116
|
+
setup(props) {
|
|
117
|
+
return () => {
|
|
118
|
+
if (typeof props.is === "string" || typeof props.is === "number") return props.is;
|
|
119
|
+
return props.is ? (0, vue_demi.h)(props.is) : null;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/hooks/sync-element-scroll.ts
|
|
126
126
|
/**
|
|
127
127
|
* Synchronize scrolling between two DOM with the same scrollbar
|
|
128
128
|
* @param fromTarget DOM-A
|
|
@@ -189,7 +189,7 @@ function syncElementSyncScroll(fromTarget, toTarget, options = {}) {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
//#endregion
|
|
192
|
-
//#region src/hooks/
|
|
192
|
+
//#region src/hooks/sync-element-size.ts
|
|
193
193
|
/**
|
|
194
194
|
* Synchronize the width or height of from DOM to the specified to DOM
|
|
195
195
|
* @param fromTarget width and height source element
|
|
@@ -241,7 +241,7 @@ function syncElementSize(fromTarget, toTarget, options = {}) {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
//#endregion
|
|
244
|
-
//#region src/hooks/
|
|
244
|
+
//#region src/hooks/use-checked.ts
|
|
245
245
|
/**
|
|
246
246
|
* Get the status of checked and customize the value of checked | unchecked
|
|
247
247
|
* @param target
|
|
@@ -258,7 +258,7 @@ function useChecked(target, checked = true, unchecked = false) {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
//#endregion
|
|
261
|
-
//#region src/hooks/
|
|
261
|
+
//#region src/hooks/use-pagination-server.ts
|
|
262
262
|
function useServerPagination(options) {
|
|
263
263
|
const total = (0, vue.ref)(Infinity);
|
|
264
264
|
const pagination = (0, _vueuse_core.useOffsetPagination)({
|
|
@@ -315,7 +315,7 @@ function extendSelected(array, fieldName) {
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
//#endregion
|
|
318
|
-
//#region src/hooks/
|
|
318
|
+
//#region src/hooks/use-selected-multiple.ts
|
|
319
319
|
function useSelectedMultiple(array, options = {}) {
|
|
320
320
|
const { fieldName = "select", disabled } = options;
|
|
321
321
|
extendSelected(array, fieldName);
|
|
@@ -338,7 +338,7 @@ function useSelectedMultiple(array, options = {}) {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
//#endregion
|
|
341
|
-
//#region src/hooks/
|
|
341
|
+
//#region src/hooks/use-selected-single.ts
|
|
342
342
|
function useSelectedSingle(array, options = {}) {
|
|
343
343
|
const fieldName = options.fieldName ?? "select";
|
|
344
344
|
const required = options.required ?? false;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { Component, DefineComponent, FunctionalComponent, PropType, VNode } from "vue-demi";
|
|
1
2
|
import * as vue from "vue";
|
|
2
3
|
import { ComputedRef, Ref, UnwrapRef, WatchOptions } from "vue";
|
|
3
|
-
import { Component, DefineComponent, FunctionalComponent, PropType, VNode } from "vue-demi";
|
|
4
4
|
import { MaybeElementRef, MaybeRef, UseOffsetPaginationOptions, UseOffsetPaginationReturn } from "@vueuse/core";
|
|
5
5
|
import { Noop } from "@hairy/utils";
|
|
6
6
|
import { DebouncedFunc } from "lodash";
|
|
7
7
|
|
|
8
|
-
//#region src/components/
|
|
8
|
+
//#region src/components/collapse-transition.d.ts
|
|
9
|
+
declare const CollapseTransition: DefineComponent;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/components/field.d.ts
|
|
9
12
|
declare const Field: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
10
13
|
is: {
|
|
11
14
|
type: PropType<string | number | VNode | Component>;
|
|
@@ -24,10 +27,7 @@ declare const Field: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
24
27
|
}> | Component;
|
|
25
28
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
26
29
|
//#endregion
|
|
27
|
-
//#region src/
|
|
28
|
-
declare const CollapseTransition: DefineComponent;
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/hooks/syncElementScroll/index.d.ts
|
|
30
|
+
//#region src/hooks/sync-element-scroll.d.ts
|
|
31
31
|
interface SyncElementSyncScrollOptions {
|
|
32
32
|
left?: boolean;
|
|
33
33
|
top?: boolean;
|
|
@@ -49,7 +49,7 @@ declare function syncElementSyncScroll(fromTarget: MaybeRef<EventTarget | null |
|
|
|
49
49
|
syncToFrom: () => void;
|
|
50
50
|
};
|
|
51
51
|
//#endregion
|
|
52
|
-
//#region src/hooks/
|
|
52
|
+
//#region src/hooks/sync-element-size.d.ts
|
|
53
53
|
interface SyncElementSizeOptions extends WatchOptions {
|
|
54
54
|
/** Is the width enabled @default true */
|
|
55
55
|
width?: boolean;
|
|
@@ -68,7 +68,7 @@ interface SyncElementSizeReturn {
|
|
|
68
68
|
*/
|
|
69
69
|
declare function syncElementSize(fromTarget: MaybeElementRef, toTarget: MaybeElementRef, options?: SyncElementSizeOptions): SyncElementSizeReturn;
|
|
70
70
|
//#endregion
|
|
71
|
-
//#region src/hooks/
|
|
71
|
+
//#region src/hooks/use-checked.d.ts
|
|
72
72
|
type CheckedState = string | boolean | number | symbol;
|
|
73
73
|
/**
|
|
74
74
|
* Get the status of checked and customize the value of checked | unchecked
|
|
@@ -78,7 +78,7 @@ type CheckedState = string | boolean | number | symbol;
|
|
|
78
78
|
*/
|
|
79
79
|
declare function useChecked(target: Ref<any>, checked?: MaybeRef<CheckedState>, unchecked?: MaybeRef<CheckedState>): vue.WritableComputedRef<boolean, boolean>;
|
|
80
80
|
//#endregion
|
|
81
|
-
//#region src/hooks/
|
|
81
|
+
//#region src/hooks/use-pagination-server.d.ts
|
|
82
82
|
type UseServerPaginationResolve = UnwrapRef<Pick<UseOffsetPaginationReturn, 'currentPage' | 'currentPageSize'> & {
|
|
83
83
|
total: number;
|
|
84
84
|
}>;
|
|
@@ -101,7 +101,7 @@ interface UseServerPaginationReturn<T> {
|
|
|
101
101
|
}
|
|
102
102
|
declare function useServerPagination<T extends any[]>(options: UseServerPaginationOptions<T>): UseServerPaginationReturn<T>;
|
|
103
103
|
//#endregion
|
|
104
|
-
//#region src/hooks/
|
|
104
|
+
//#region src/hooks/use-selected-multiple.d.ts
|
|
105
105
|
type SelectedMultipleArray = MaybeRef<{
|
|
106
106
|
[key: string]: any;
|
|
107
107
|
}[]>;
|
|
@@ -137,7 +137,7 @@ interface SelectedMultipleResult<T extends SelectedMultipleArray> {
|
|
|
137
137
|
}
|
|
138
138
|
declare function useSelectedMultiple<T extends SelectedMultipleArray>(array: T, options?: SelectedMultipleOptions<T>): SelectedMultipleResult<T>;
|
|
139
139
|
//#endregion
|
|
140
|
-
//#region src/hooks/
|
|
140
|
+
//#region src/hooks/use-selected-single.d.ts
|
|
141
141
|
type SelectedSingleArray = MaybeRef<{
|
|
142
142
|
[key: string]: any;
|
|
143
143
|
}[]>;
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,10 @@ import { ComputedRef, Ref, UnwrapRef, WatchOptions } from "vue";
|
|
|
5
5
|
import { Noop } from "@hairy/utils";
|
|
6
6
|
import { DebouncedFunc } from "lodash";
|
|
7
7
|
|
|
8
|
-
//#region src/components/
|
|
8
|
+
//#region src/components/collapse-transition.d.ts
|
|
9
|
+
declare const CollapseTransition: DefineComponent;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/components/field.d.ts
|
|
9
12
|
declare const Field: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
10
13
|
is: {
|
|
11
14
|
type: PropType<string | number | VNode | Component>;
|
|
@@ -24,10 +27,7 @@ declare const Field: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
24
27
|
}> | Component;
|
|
25
28
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
26
29
|
//#endregion
|
|
27
|
-
//#region src/
|
|
28
|
-
declare const CollapseTransition: DefineComponent;
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/hooks/syncElementScroll/index.d.ts
|
|
30
|
+
//#region src/hooks/sync-element-scroll.d.ts
|
|
31
31
|
interface SyncElementSyncScrollOptions {
|
|
32
32
|
left?: boolean;
|
|
33
33
|
top?: boolean;
|
|
@@ -49,7 +49,7 @@ declare function syncElementSyncScroll(fromTarget: MaybeRef<EventTarget | null |
|
|
|
49
49
|
syncToFrom: () => void;
|
|
50
50
|
};
|
|
51
51
|
//#endregion
|
|
52
|
-
//#region src/hooks/
|
|
52
|
+
//#region src/hooks/sync-element-size.d.ts
|
|
53
53
|
interface SyncElementSizeOptions extends WatchOptions {
|
|
54
54
|
/** Is the width enabled @default true */
|
|
55
55
|
width?: boolean;
|
|
@@ -68,7 +68,7 @@ interface SyncElementSizeReturn {
|
|
|
68
68
|
*/
|
|
69
69
|
declare function syncElementSize(fromTarget: MaybeElementRef, toTarget: MaybeElementRef, options?: SyncElementSizeOptions): SyncElementSizeReturn;
|
|
70
70
|
//#endregion
|
|
71
|
-
//#region src/hooks/
|
|
71
|
+
//#region src/hooks/use-checked.d.ts
|
|
72
72
|
type CheckedState = string | boolean | number | symbol;
|
|
73
73
|
/**
|
|
74
74
|
* Get the status of checked and customize the value of checked | unchecked
|
|
@@ -78,7 +78,7 @@ type CheckedState = string | boolean | number | symbol;
|
|
|
78
78
|
*/
|
|
79
79
|
declare function useChecked(target: Ref<any>, checked?: MaybeRef<CheckedState>, unchecked?: MaybeRef<CheckedState>): vue.WritableComputedRef<boolean, boolean>;
|
|
80
80
|
//#endregion
|
|
81
|
-
//#region src/hooks/
|
|
81
|
+
//#region src/hooks/use-pagination-server.d.ts
|
|
82
82
|
type UseServerPaginationResolve = UnwrapRef<Pick<UseOffsetPaginationReturn, 'currentPage' | 'currentPageSize'> & {
|
|
83
83
|
total: number;
|
|
84
84
|
}>;
|
|
@@ -101,7 +101,7 @@ interface UseServerPaginationReturn<T> {
|
|
|
101
101
|
}
|
|
102
102
|
declare function useServerPagination<T extends any[]>(options: UseServerPaginationOptions<T>): UseServerPaginationReturn<T>;
|
|
103
103
|
//#endregion
|
|
104
|
-
//#region src/hooks/
|
|
104
|
+
//#region src/hooks/use-selected-multiple.d.ts
|
|
105
105
|
type SelectedMultipleArray = MaybeRef<{
|
|
106
106
|
[key: string]: any;
|
|
107
107
|
}[]>;
|
|
@@ -137,7 +137,7 @@ interface SelectedMultipleResult<T extends SelectedMultipleArray> {
|
|
|
137
137
|
}
|
|
138
138
|
declare function useSelectedMultiple<T extends SelectedMultipleArray>(array: T, options?: SelectedMultipleOptions<T>): SelectedMultipleResult<T>;
|
|
139
139
|
//#endregion
|
|
140
|
-
//#region src/hooks/
|
|
140
|
+
//#region src/hooks/use-selected-single.d.ts
|
|
141
141
|
type SelectedSingleArray = MaybeRef<{
|
|
142
142
|
[key: string]: any;
|
|
143
143
|
}[]>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,31 +1,11 @@
|
|
|
1
|
-
import { Transition, computed, defineComponent, h, render } from "vue-demi";
|
|
2
1
|
import CssRender from "css-render";
|
|
2
|
+
import { Transition, computed, defineComponent, h, render } from "vue-demi";
|
|
3
3
|
import { extendRef, unrefElement, useAsyncState, useElementSize, useEventListener, useOffsetPagination } from "@vueuse/core";
|
|
4
4
|
import debounce from "lodash/debounce";
|
|
5
5
|
import throttle from "lodash/throttle";
|
|
6
6
|
import { computed as computed$1, nextTick, reactive, ref, unref, watch } from "vue";
|
|
7
7
|
import { unit } from "@hairy/utils";
|
|
8
8
|
|
|
9
|
-
//#region src/components/c-field.ts
|
|
10
|
-
const Field = defineComponent({
|
|
11
|
-
name: "Field",
|
|
12
|
-
props: { is: {
|
|
13
|
-
type: [
|
|
14
|
-
String,
|
|
15
|
-
Number,
|
|
16
|
-
Object
|
|
17
|
-
],
|
|
18
|
-
default: ""
|
|
19
|
-
} },
|
|
20
|
-
setup(props) {
|
|
21
|
-
return () => {
|
|
22
|
-
if (typeof props.is === "string" || typeof props.is === "number") return props.is;
|
|
23
|
-
return props.is ? h(props.is) : null;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
9
|
//#region src/components/collapse-transition.ts
|
|
30
10
|
const CollapseTransition = defineComponent({
|
|
31
11
|
name: "CollapseTransition",
|
|
@@ -91,7 +71,27 @@ const CollapseTransition = defineComponent({
|
|
|
91
71
|
});
|
|
92
72
|
|
|
93
73
|
//#endregion
|
|
94
|
-
//#region src/
|
|
74
|
+
//#region src/components/field.ts
|
|
75
|
+
const Field = defineComponent({
|
|
76
|
+
name: "Field",
|
|
77
|
+
props: { is: {
|
|
78
|
+
type: [
|
|
79
|
+
String,
|
|
80
|
+
Number,
|
|
81
|
+
Object
|
|
82
|
+
],
|
|
83
|
+
default: ""
|
|
84
|
+
} },
|
|
85
|
+
setup(props) {
|
|
86
|
+
return () => {
|
|
87
|
+
if (typeof props.is === "string" || typeof props.is === "number") return props.is;
|
|
88
|
+
return props.is ? h(props.is) : null;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/hooks/sync-element-scroll.ts
|
|
95
95
|
/**
|
|
96
96
|
* Synchronize scrolling between two DOM with the same scrollbar
|
|
97
97
|
* @param fromTarget DOM-A
|
|
@@ -158,7 +158,7 @@ function syncElementSyncScroll(fromTarget, toTarget, options = {}) {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
//#endregion
|
|
161
|
-
//#region src/hooks/
|
|
161
|
+
//#region src/hooks/sync-element-size.ts
|
|
162
162
|
/**
|
|
163
163
|
* Synchronize the width or height of from DOM to the specified to DOM
|
|
164
164
|
* @param fromTarget width and height source element
|
|
@@ -210,7 +210,7 @@ function syncElementSize(fromTarget, toTarget, options = {}) {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
//#endregion
|
|
213
|
-
//#region src/hooks/
|
|
213
|
+
//#region src/hooks/use-checked.ts
|
|
214
214
|
/**
|
|
215
215
|
* Get the status of checked and customize the value of checked | unchecked
|
|
216
216
|
* @param target
|
|
@@ -227,7 +227,7 @@ function useChecked(target, checked = true, unchecked = false) {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
//#endregion
|
|
230
|
-
//#region src/hooks/
|
|
230
|
+
//#region src/hooks/use-pagination-server.ts
|
|
231
231
|
function useServerPagination(options) {
|
|
232
232
|
const total = ref(Infinity);
|
|
233
233
|
const pagination = useOffsetPagination({
|
|
@@ -284,7 +284,7 @@ function extendSelected(array, fieldName) {
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
//#endregion
|
|
287
|
-
//#region src/hooks/
|
|
287
|
+
//#region src/hooks/use-selected-multiple.ts
|
|
288
288
|
function useSelectedMultiple(array, options = {}) {
|
|
289
289
|
const { fieldName = "select", disabled } = options;
|
|
290
290
|
extendSelected(array, fieldName);
|
|
@@ -307,7 +307,7 @@ function useSelectedMultiple(array, options = {}) {
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
//#endregion
|
|
310
|
-
//#region src/hooks/
|
|
310
|
+
//#region src/hooks/use-selected-single.ts
|
|
311
311
|
function useSelectedSingle(array, options = {}) {
|
|
312
312
|
const fieldName = options.fieldName ?? "select";
|
|
313
313
|
const required = options.required ?? false;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hairy/vue-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.52.0",
|
|
5
5
|
"description": "Library for vue",
|
|
6
6
|
"author": "Hairyf <wwu710632@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"css-render": "^0.15.14",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
46
46
|
"vue-demi": "latest",
|
|
47
|
-
"@hairy/utils": "1.
|
|
47
|
+
"@hairy/utils": "1.52.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/lodash": "^4.17.16",
|