@oiij/naive-ui 0.0.75 → 0.0.77
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/README.md +3 -3
- package/dist/components/config-providers/ConfigProviders.vue.d.ts +2 -2
- package/dist/components/config-providers/index.d.ts +16 -7
- package/dist/components/copy-button/CopyButton.js +3 -3
- package/dist/components/copy-button/CopyButton.vue.d.ts +4 -4
- package/dist/components/copy-button/index.d.ts +6 -3
- package/dist/components/data-table-plus/DataTablePlus.js +74 -125
- package/dist/components/data-table-plus/DataTablePlus.vue.d.ts +16 -81
- package/dist/components/data-table-plus/index.d.ts +52 -32
- package/dist/components/index.d.ts +2 -4
- package/dist/components/loading-provider/LoadingProvider.js +2 -2
- package/dist/components/loading-provider/LoadingProvider.vue.d.ts +2 -2
- package/dist/components/loading-provider/index.d.ts +19 -10
- package/dist/components/loading-provider/index.js +5 -2
- package/dist/components/preset-form/PresetForm.js +42 -21
- package/dist/components/preset-form/PresetForm.vue.d.ts +17 -17
- package/dist/components/preset-form/_utils.js +23 -8
- package/dist/components/preset-form/index.d.ts +32 -13
- package/dist/components/preset-input/PresetInput.vue.d.ts +3 -3
- package/dist/components/preset-input/index.d.ts +30 -20
- package/dist/components/preset-picker/PresetPicker.js +31 -34
- package/dist/components/preset-picker/PresetPicker.vue.d.ts +5 -10
- package/dist/components/preset-picker/index.d.ts +45 -31
- package/dist/components/preset-select/PresetSelect.js +23 -59
- package/dist/components/preset-select/PresetSelect.vue.d.ts +34 -38
- package/dist/components/preset-select/index.d.ts +56 -22
- package/dist/components/remote-request/RemoteRequest.js +7 -7
- package/dist/components/remote-request/RemoteRequest.vue.d.ts +7 -7
- package/dist/components/remote-request/index.d.ts +30 -8
- package/dist/components/search-input/SearchInput.js +1 -1
- package/dist/components/search-input/SearchInput.vue.d.ts +4 -4
- package/dist/components/search-input/index.d.ts +10 -7
- package/dist/components/toggle-input/ToggleInput.vue.d.ts +4 -4
- package/dist/components/tooltip-button/TooltipButton.vue.d.ts +4 -4
- package/dist/components/tooltip-button/index.d.ts +5 -2
- package/dist/components/transition/index.d.ts +4 -1
- package/dist/components.d.ts +2 -4
- package/dist/components.js +2 -3
- package/dist/composables/_helper.d.ts +7 -4
- package/dist/composables/_helper.js +47 -0
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/use-data-request.d.ts +27 -20
- package/dist/composables/use-data-request.js +23 -4
- package/dist/composables/use-loading.d.ts +6 -0
- package/dist/composables/use-loading.js +8 -2
- package/dist/composables/use-naive-form.d.ts +23 -15
- package/dist/composables/use-naive-form.js +49 -40
- package/dist/composables/use-naive-menu.d.ts +104 -0
- package/dist/composables/use-naive-menu.js +133 -0
- package/dist/composables/use-naive-theme.d.ts +27 -14
- package/dist/composables/use-naive-theme.js +22 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +5 -7
- package/dist/components/_utils/prismjs.js +0 -16
- package/dist/components/icons/MageArrowUp.js +0 -29
- package/dist/components/type-writer/TypeWriter.js +0 -75
- package/dist/components/type-writer/TypeWriter.vue.d.ts +0 -22
- package/dist/components/type-writer/index.d.ts +0 -13
- package/dist/components/type-writer/type-writer.cssr.js +0 -27
- package/dist/composables/use-auto-menu.d.ts +0 -74
- package/dist/composables/use-auto-menu.js +0 -129
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useDataRequest } from "../../composables/use-data-request.js";
|
|
2
|
-
import { computed, createBlock, createCommentVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, reactive, ref, renderSlot, toRaw, toValue, unref, useTemplateRef, withCtx } from "vue";
|
|
3
2
|
import { useDebounceFn } from "@vueuse/core";
|
|
3
|
+
import { computed, createBlock, createCommentVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, reactive, ref, renderSlot, toRaw, unref, useTemplateRef, withCtx } from "vue";
|
|
4
4
|
import { NFlex, NPagination, NSelect } from "naive-ui";
|
|
5
5
|
|
|
6
6
|
//#region src/components/preset-select/PresetSelect.vue
|
|
@@ -37,12 +37,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
37
|
"success",
|
|
38
38
|
"error",
|
|
39
39
|
"finally",
|
|
40
|
-
"blur",
|
|
41
|
-
"clear",
|
|
42
|
-
"create",
|
|
43
|
-
"focus",
|
|
44
|
-
"scroll",
|
|
45
40
|
"search",
|
|
41
|
+
"update:show",
|
|
46
42
|
"update:value",
|
|
47
43
|
"update:page",
|
|
48
44
|
"update:pageSize"
|
|
@@ -63,7 +59,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
63
59
|
...__props.fields
|
|
64
60
|
};
|
|
65
61
|
const paginationProps = reactive({ ...__props.pagination && typeof __props.pagination === "boolean" ? {} : __props.pagination });
|
|
66
|
-
const _dataCache = [];
|
|
67
62
|
const { loading, data, error, params, list, pagination: paginationRef, run, runAsync, refresh, refreshAsync, cancel, mutate, setParams, runParams, runParamsAsync, onBefore, onSuccess, onError, onFinally } = useDataRequest(__props.api, {
|
|
68
63
|
defaultParams: {
|
|
69
64
|
[_fields.search]: null,
|
|
@@ -79,9 +74,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
79
74
|
});
|
|
80
75
|
onSuccess((data, params) => {
|
|
81
76
|
emit("success", data, params);
|
|
82
|
-
data?.[_fields.list]?.forEach((f) => {
|
|
83
|
-
if (!_dataCache.some((s) => s?.[_fields.rowKey] === f?.[_fields.rowKey])) _dataCache.push(f);
|
|
84
|
-
});
|
|
85
77
|
});
|
|
86
78
|
onError((err, params) => {
|
|
87
79
|
emit("error", err, params);
|
|
@@ -90,7 +82,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
90
82
|
emit("finally", params, data, err);
|
|
91
83
|
});
|
|
92
84
|
const optionsReactive = computed(() => {
|
|
93
|
-
|
|
85
|
+
if (typeof __props.optionFormat === "function") return list.value.map((m) => __props.optionFormat(m)).filter(Boolean);
|
|
86
|
+
return list.value.map((m) => {
|
|
94
87
|
return {
|
|
95
88
|
[_fields.label]: m?.[_fields.label],
|
|
96
89
|
[_fields.value]: m?.[_fields.value],
|
|
@@ -106,55 +99,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
106
99
|
});
|
|
107
100
|
}, typeof __props.debounce === "number" ? __props.debounce : 500);
|
|
108
101
|
const vOnSelect = {
|
|
109
|
-
onBlur: (ev) => {
|
|
110
|
-
emit("blur", ev);
|
|
111
|
-
},
|
|
112
|
-
onClear: () => {
|
|
113
|
-
emit("clear");
|
|
114
|
-
},
|
|
115
|
-
onCreate: (label) => {
|
|
116
|
-
return emit("create", label);
|
|
117
|
-
},
|
|
118
|
-
onFocus: (ev) => {
|
|
119
|
-
emit("focus", ev);
|
|
120
|
-
},
|
|
121
|
-
onScroll: (ev) => {
|
|
122
|
-
emit("scroll", ev);
|
|
123
|
-
},
|
|
124
102
|
onUpdateValue: (val, option) => {
|
|
125
|
-
emit("update:value", val, option, toRaw(
|
|
103
|
+
emit("update:value", val, option, toRaw(Array.isArray(val) ? list.value.filter((f) => val.includes(f?.[_fields.value])) : list.value.find((f) => f?.[_fields.value] === val) ?? null));
|
|
126
104
|
},
|
|
127
105
|
onSearch: (val) => {
|
|
106
|
+
emit("search", val);
|
|
128
107
|
searchValue.value = val;
|
|
129
108
|
if (loading.value) return;
|
|
130
109
|
__props.debounce ? debounceSearch() : runParams({
|
|
131
110
|
[_fields.page]: 1,
|
|
132
|
-
[_fields.search]:
|
|
111
|
+
[_fields.search]: val
|
|
133
112
|
});
|
|
134
113
|
},
|
|
135
114
|
onUpdateShow: (show) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
115
|
+
emit("update:show", show);
|
|
116
|
+
if (show && !data.value && __props.manual) runParams({
|
|
117
|
+
[_fields.page]: 1,
|
|
118
|
+
[_fields.pageSize]: 10,
|
|
119
|
+
[_fields.search]: null,
|
|
120
|
+
...__props.defaultParams ?? {}
|
|
121
|
+
});
|
|
146
122
|
}
|
|
147
123
|
};
|
|
148
124
|
const vOnPagination = {
|
|
149
125
|
onUpdatePage: (page) => {
|
|
150
126
|
emit("update:page", page);
|
|
151
|
-
if (loading.value)
|
|
152
|
-
runParams({ [_fields.page]: page });
|
|
127
|
+
if (!loading.value) runParams({ [_fields.page]: page });
|
|
153
128
|
},
|
|
154
129
|
onUpdatePageSize: (pageSize) => {
|
|
155
130
|
emit("update:pageSize", pageSize);
|
|
156
|
-
if (loading.value)
|
|
157
|
-
runParams({ [_fields.pageSize]: pageSize });
|
|
131
|
+
if (!loading.value) runParams({ [_fields.pageSize]: pageSize });
|
|
158
132
|
}
|
|
159
133
|
};
|
|
160
134
|
function fallbackOption(val) {
|
|
@@ -188,13 +162,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
188
162
|
const templateBind = computed(() => {
|
|
189
163
|
return {
|
|
190
164
|
...expose,
|
|
191
|
-
loading:
|
|
192
|
-
data:
|
|
193
|
-
error:
|
|
194
|
-
params:
|
|
195
|
-
list:
|
|
196
|
-
pagination:
|
|
197
|
-
selectInst:
|
|
165
|
+
loading: loading.value,
|
|
166
|
+
data: data.value,
|
|
167
|
+
error: error.value,
|
|
168
|
+
params: params.value,
|
|
169
|
+
list: list.value,
|
|
170
|
+
pagination: paginationRef.value,
|
|
171
|
+
selectInst: selectInstRef.value
|
|
198
172
|
};
|
|
199
173
|
});
|
|
200
174
|
__expose(expose);
|
|
@@ -214,11 +188,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
214
188
|
"fallback-option": fallbackOption,
|
|
215
189
|
loading: unref(loading)
|
|
216
190
|
}, __props.selectProps, {
|
|
217
|
-
onBlur: vOnSelect.onBlur,
|
|
218
|
-
onClear: vOnSelect.onClear,
|
|
219
|
-
onCreate: vOnSelect.onCreate,
|
|
220
|
-
onFocus: vOnSelect.onFocus,
|
|
221
|
-
onScroll: vOnSelect.onScroll,
|
|
222
191
|
onSearch: vOnSelect.onSearch,
|
|
223
192
|
"onUpdate:show": vOnSelect.onUpdateShow,
|
|
224
193
|
"onUpdate:value": vOnSelect.onUpdateValue
|
|
@@ -256,11 +225,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
256
225
|
"children-field",
|
|
257
226
|
"value",
|
|
258
227
|
"loading",
|
|
259
|
-
"onBlur",
|
|
260
|
-
"onClear",
|
|
261
|
-
"onCreate",
|
|
262
|
-
"onFocus",
|
|
263
|
-
"onScroll",
|
|
264
228
|
"onSearch",
|
|
265
229
|
"onUpdate:show",
|
|
266
230
|
"onUpdate:value"
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import { DataObject
|
|
1
|
+
import { DataObject } from "../../composables/use-data-request.js";
|
|
2
2
|
import { PresetSelectEmits, PresetSelectExpose, PresetSelectProps, PresetSelectValue } from "./index.js";
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
3
|
+
import * as _vueuse_core8 from "@vueuse/core";
|
|
4
|
+
import * as vue43 from "vue";
|
|
5
5
|
import { SelectInst, SelectOption } from "naive-ui";
|
|
6
6
|
|
|
7
7
|
//#region src/components/preset-select/PresetSelect.vue.d.ts
|
|
8
8
|
declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject, D extends DataObject, R extends DataObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
9
|
-
props:
|
|
10
|
-
onSuccess?: ((data: D, params: P[]) => any) | undefined;
|
|
9
|
+
props: vue43.PublicProps & __VLS_PrettifyLocal<PresetSelectProps<V, P, D, R> & {
|
|
11
10
|
onError?: ((err: Error, params: P[]) => any) | undefined;
|
|
12
|
-
|
|
13
|
-
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
14
|
-
onFocus?: ((ev: FocusEvent) => any) | undefined;
|
|
15
|
-
onScroll?: ((ev: Event) => any) | undefined;
|
|
11
|
+
onSuccess?: ((data: D, params: P[]) => any) | undefined;
|
|
16
12
|
"onUpdate:value"?: ((val: V | null, option: SelectOption | SelectOption[] | null, raw: R | R[] | null) => any) | undefined;
|
|
17
|
-
onSearch?: ((
|
|
13
|
+
onSearch?: ((val: string) => any) | undefined;
|
|
18
14
|
onFinally?: ((params: P[], data?: D | undefined, err?: Error | undefined) => any) | undefined;
|
|
19
15
|
onBefore?: ((params: P[]) => any) | undefined;
|
|
20
|
-
|
|
16
|
+
"onUpdate:show"?: ((show: boolean) => any) | undefined;
|
|
21
17
|
"onUpdate:page"?: ((page: number) => any) | undefined;
|
|
22
18
|
"onUpdate:pageSize"?: ((pageSize: number) => any) | undefined;
|
|
23
19
|
}> & (typeof globalThis extends {
|
|
24
20
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
25
21
|
} ? P_1 : {});
|
|
26
|
-
expose: (exposed:
|
|
22
|
+
expose: (exposed: vue43.ShallowUnwrapRef<PresetSelectExpose<P, D, R>>) => void;
|
|
27
23
|
attrs: any;
|
|
28
24
|
slots: {
|
|
29
25
|
header?: (props: {
|
|
@@ -32,7 +28,7 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
32
28
|
error: Error | undefined;
|
|
33
29
|
params: [] | P[];
|
|
34
30
|
list: R[];
|
|
35
|
-
pagination:
|
|
31
|
+
pagination: {
|
|
36
32
|
page: number;
|
|
37
33
|
pageSize: number;
|
|
38
34
|
itemCount: number;
|
|
@@ -47,10 +43,10 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
47
43
|
setParams: (_params: Partial<P>) => void;
|
|
48
44
|
runParams: (_params: Partial<P>) => void;
|
|
49
45
|
runParamsAsync: (_params: Partial<P>) => Promise<D>;
|
|
50
|
-
onBefore:
|
|
51
|
-
onSuccess:
|
|
52
|
-
onError:
|
|
53
|
-
onFinally:
|
|
46
|
+
onBefore: _vueuse_core8.EventHookOn<[P[]]>;
|
|
47
|
+
onSuccess: _vueuse_core8.EventHookOn<[D, P[]]>;
|
|
48
|
+
onError: _vueuse_core8.EventHookOn<[Error, P[]]>;
|
|
49
|
+
onFinally: _vueuse_core8.EventHookOn<[P[], D | undefined, Error | undefined]>;
|
|
54
50
|
}) => any;
|
|
55
51
|
} & {
|
|
56
52
|
footer?: (props: {
|
|
@@ -59,7 +55,7 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
59
55
|
error: Error | undefined;
|
|
60
56
|
params: [] | P[];
|
|
61
57
|
list: R[];
|
|
62
|
-
pagination:
|
|
58
|
+
pagination: {
|
|
63
59
|
page: number;
|
|
64
60
|
pageSize: number;
|
|
65
61
|
itemCount: number;
|
|
@@ -74,10 +70,10 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
74
70
|
setParams: (_params: Partial<P>) => void;
|
|
75
71
|
runParams: (_params: Partial<P>) => void;
|
|
76
72
|
runParamsAsync: (_params: Partial<P>) => Promise<D>;
|
|
77
|
-
onBefore:
|
|
78
|
-
onSuccess:
|
|
79
|
-
onError:
|
|
80
|
-
onFinally:
|
|
73
|
+
onBefore: _vueuse_core8.EventHookOn<[P[]]>;
|
|
74
|
+
onSuccess: _vueuse_core8.EventHookOn<[D, P[]]>;
|
|
75
|
+
onError: _vueuse_core8.EventHookOn<[Error, P[]]>;
|
|
76
|
+
onFinally: _vueuse_core8.EventHookOn<[P[], D | undefined, Error | undefined]>;
|
|
81
77
|
}) => any;
|
|
82
78
|
} & {
|
|
83
79
|
'footer-extra'?: (props: {
|
|
@@ -86,7 +82,7 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
86
82
|
error: Error | undefined;
|
|
87
83
|
params: [] | P[];
|
|
88
84
|
list: R[];
|
|
89
|
-
pagination:
|
|
85
|
+
pagination: {
|
|
90
86
|
page: number;
|
|
91
87
|
pageSize: number;
|
|
92
88
|
itemCount: number;
|
|
@@ -101,10 +97,10 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
101
97
|
setParams: (_params: Partial<P>) => void;
|
|
102
98
|
runParams: (_params: Partial<P>) => void;
|
|
103
99
|
runParamsAsync: (_params: Partial<P>) => Promise<D>;
|
|
104
|
-
onBefore:
|
|
105
|
-
onSuccess:
|
|
106
|
-
onError:
|
|
107
|
-
onFinally:
|
|
100
|
+
onBefore: _vueuse_core8.EventHookOn<[P[]]>;
|
|
101
|
+
onSuccess: _vueuse_core8.EventHookOn<[D, P[]]>;
|
|
102
|
+
onError: _vueuse_core8.EventHookOn<[Error, P[]]>;
|
|
103
|
+
onFinally: _vueuse_core8.EventHookOn<[P[], D | undefined, Error | undefined]>;
|
|
108
104
|
}) => any;
|
|
109
105
|
} & {
|
|
110
106
|
empty?: (props: {
|
|
@@ -113,7 +109,7 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
113
109
|
error: Error | undefined;
|
|
114
110
|
params: [] | P[];
|
|
115
111
|
list: R[];
|
|
116
|
-
pagination:
|
|
112
|
+
pagination: {
|
|
117
113
|
page: number;
|
|
118
114
|
pageSize: number;
|
|
119
115
|
itemCount: number;
|
|
@@ -128,10 +124,10 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
128
124
|
setParams: (_params: Partial<P>) => void;
|
|
129
125
|
runParams: (_params: Partial<P>) => void;
|
|
130
126
|
runParamsAsync: (_params: Partial<P>) => Promise<D>;
|
|
131
|
-
onBefore:
|
|
132
|
-
onSuccess:
|
|
133
|
-
onError:
|
|
134
|
-
onFinally:
|
|
127
|
+
onBefore: _vueuse_core8.EventHookOn<[P[]]>;
|
|
128
|
+
onSuccess: _vueuse_core8.EventHookOn<[D, P[]]>;
|
|
129
|
+
onError: _vueuse_core8.EventHookOn<[Error, P[]]>;
|
|
130
|
+
onFinally: _vueuse_core8.EventHookOn<[P[], D | undefined, Error | undefined]>;
|
|
135
131
|
}) => any;
|
|
136
132
|
} & {
|
|
137
133
|
arrow?: (props: {
|
|
@@ -140,7 +136,7 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
140
136
|
error: Error | undefined;
|
|
141
137
|
params: [] | P[];
|
|
142
138
|
list: R[];
|
|
143
|
-
pagination:
|
|
139
|
+
pagination: {
|
|
144
140
|
page: number;
|
|
145
141
|
pageSize: number;
|
|
146
142
|
itemCount: number;
|
|
@@ -155,14 +151,14 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
|
|
|
155
151
|
setParams: (_params: Partial<P>) => void;
|
|
156
152
|
runParams: (_params: Partial<P>) => void;
|
|
157
153
|
runParamsAsync: (_params: Partial<P>) => Promise<D>;
|
|
158
|
-
onBefore:
|
|
159
|
-
onSuccess:
|
|
160
|
-
onError:
|
|
161
|
-
onFinally:
|
|
154
|
+
onBefore: _vueuse_core8.EventHookOn<[P[]]>;
|
|
155
|
+
onSuccess: _vueuse_core8.EventHookOn<[D, P[]]>;
|
|
156
|
+
onError: _vueuse_core8.EventHookOn<[Error, P[]]>;
|
|
157
|
+
onFinally: _vueuse_core8.EventHookOn<[P[], D | undefined, Error | undefined]>;
|
|
162
158
|
}) => any;
|
|
163
159
|
};
|
|
164
160
|
emit: PresetSelectEmits<V, P, D, R>;
|
|
165
|
-
}>) =>
|
|
161
|
+
}>) => vue43.VNode & {
|
|
166
162
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
167
163
|
};
|
|
168
164
|
declare const _default: typeof __VLS_export;
|
|
@@ -7,42 +7,76 @@ import { PaginationProps, SelectGroupOption, SelectInst, SelectOption, SelectPro
|
|
|
7
7
|
import { ComponentExposed } from "vue-component-type-helpers";
|
|
8
8
|
|
|
9
9
|
//#region src/components/preset-select/index.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* 数组感知类型
|
|
12
|
+
* @template V 值类型
|
|
13
|
+
* @template T 目标类型
|
|
14
|
+
*/
|
|
10
15
|
type ArrayAwareType<V, T> = V extends null ? null : (V extends any[] ? T[] : T) | null;
|
|
16
|
+
/**
|
|
17
|
+
* 选项格式化函数
|
|
18
|
+
* @template R 列表项类型
|
|
19
|
+
*/
|
|
11
20
|
type OptionFormat<R extends DataObject = DataObject> = (row: R) => SelectOption | SelectGroupOption | false | undefined | null;
|
|
21
|
+
/**
|
|
22
|
+
* 预设选择器值类型
|
|
23
|
+
*/
|
|
12
24
|
type PresetSelectValue = string | number | (string | number)[] | null;
|
|
25
|
+
/**
|
|
26
|
+
* 预设选择器字段配置
|
|
27
|
+
*/
|
|
13
28
|
type PresetSelectFields = DataRequestFields & {
|
|
14
|
-
label?: string;
|
|
15
|
-
value?: string;
|
|
16
|
-
rowKey?: string;
|
|
17
|
-
search?: string;
|
|
29
|
+
/** 标签字段名 */label?: string; /** 值字段名 */
|
|
30
|
+
value?: string; /** 行键字段名 */
|
|
31
|
+
rowKey?: string; /** 搜索字段名 */
|
|
32
|
+
search?: string; /** 子节点字段名 */
|
|
18
33
|
children?: string;
|
|
19
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* 预设选择器暴露的方法
|
|
37
|
+
* @template P 请求参数类型
|
|
38
|
+
* @template D 响应数据类型
|
|
39
|
+
* @template R 列表项类型
|
|
40
|
+
*/
|
|
20
41
|
type PresetSelectExpose<P extends DataObject = DataObject, D extends DataObject = DataObject, R extends DataObject = DataObject> = UseDataRequestReturns<P, D, R> & {
|
|
21
|
-
selectInst: Readonly<ShallowRef<SelectInst | null>>;
|
|
42
|
+
/** 选择器实例 */selectInst: Readonly<ShallowRef<SelectInst | null>>;
|
|
22
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* 预设选择器属性
|
|
46
|
+
* @template V 值类型
|
|
47
|
+
* @template P 请求参数类型
|
|
48
|
+
* @template D 响应数据类型
|
|
49
|
+
* @template R 列表项类型
|
|
50
|
+
*/
|
|
23
51
|
type PresetSelectProps<V extends PresetSelectValue, P extends DataObject = DataObject, D extends DataObject = DataObject, R extends DataObject = DataObject> = RemoteRequestProps<P, D> & {
|
|
24
|
-
value?: V;
|
|
25
|
-
fallbackLabel?: string | ((val: string | number) => SelectOption);
|
|
26
|
-
multiple?: boolean;
|
|
27
|
-
disabled?: boolean;
|
|
28
|
-
clearable?: boolean;
|
|
29
|
-
debounce?: boolean | number;
|
|
30
|
-
optionFormat?: OptionFormat<R>;
|
|
31
|
-
fields?: PresetSelectFields;
|
|
32
|
-
selectProps?: SelectProps & ClassStyle;
|
|
52
|
+
/** 值 */value?: V; /** 回退标签 */
|
|
53
|
+
fallbackLabel?: string | ((val: string | number) => SelectOption); /** 是否多选 */
|
|
54
|
+
multiple?: boolean; /** 是否禁用 */
|
|
55
|
+
disabled?: boolean; /** 是否可清空 */
|
|
56
|
+
clearable?: boolean; /** 防抖配置 */
|
|
57
|
+
debounce?: boolean | number; /** 选项格式化函数 */
|
|
58
|
+
optionFormat?: OptionFormat<R>; /** 字段配置 */
|
|
59
|
+
fields?: PresetSelectFields; /** 选择器属性 */
|
|
60
|
+
selectProps?: SelectProps & ClassStyle; /** 分页配置 */
|
|
33
61
|
pagination?: Omit<PaginationProps, 'page' | 'pageSize'> & ClassStyle | boolean;
|
|
34
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* 预设选择器事件
|
|
65
|
+
* @template V 值类型
|
|
66
|
+
* @template P 请求参数类型
|
|
67
|
+
* @template D 响应数据类型
|
|
68
|
+
* @template R 列表项类型
|
|
69
|
+
*/
|
|
35
70
|
type PresetSelectEmits<V extends PresetSelectValue, P extends DataObject = DataObject, D extends DataObject = DataObject, R extends DataObject = DataObject> = RemoteRequestEmits<P, D> & {
|
|
36
|
-
(e: '
|
|
37
|
-
(e: '
|
|
38
|
-
(e: '
|
|
39
|
-
(e: '
|
|
40
|
-
(e: 'scroll', ev: Event): void;
|
|
41
|
-
(e: 'search', value: string): void;
|
|
42
|
-
(e: 'update:value', val: V | null, option: SelectOption | SelectOption[] | null, raw: R | R[] | null): void;
|
|
43
|
-
(e: 'update:page', page: number): void;
|
|
71
|
+
/** 搜索事件 */(e: 'search', val: string): void; /** 更新显示事件 */
|
|
72
|
+
(e: 'update:show', show: boolean): void; /** 更新值事件 */
|
|
73
|
+
(e: 'update:value', val: V | null, option: SelectOption | SelectOption[] | null, raw: R | R[] | null): void; /** 更新页码事件 */
|
|
74
|
+
(e: 'update:page', page: number): void; /** 更新每页大小事件 */
|
|
44
75
|
(e: 'update:pageSize', pageSize: number): void;
|
|
45
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* 预设选择器实例类型
|
|
79
|
+
*/
|
|
46
80
|
type PresetSelectInst = ComponentExposed<typeof _default>;
|
|
47
81
|
//#endregion
|
|
48
82
|
export { ArrayAwareType, OptionFormat, PresetSelectEmits, PresetSelectExpose, PresetSelectFields, PresetSelectInst, PresetSelectProps, PresetSelectValue };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useDataRequest } from "../../composables/use-data-request.js";
|
|
2
|
-
import { computed, defineComponent, guardReactiveProps, normalizeProps, renderSlot
|
|
2
|
+
import { computed, defineComponent, guardReactiveProps, normalizeProps, renderSlot } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/remote-request/RemoteRequest.vue
|
|
5
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -70,12 +70,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
70
70
|
const templateBind = computed(() => {
|
|
71
71
|
return {
|
|
72
72
|
...expose,
|
|
73
|
-
loading:
|
|
74
|
-
data:
|
|
75
|
-
error:
|
|
76
|
-
params:
|
|
77
|
-
list:
|
|
78
|
-
pagination:
|
|
73
|
+
loading: loading.value,
|
|
74
|
+
data: data.value,
|
|
75
|
+
error: error.value,
|
|
76
|
+
params: params.value,
|
|
77
|
+
list: list.value,
|
|
78
|
+
pagination: pagination.value
|
|
79
79
|
};
|
|
80
80
|
});
|
|
81
81
|
__expose(expose);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { DataObject
|
|
1
|
+
import { DataObject } from "../../composables/use-data-request.js";
|
|
2
2
|
import { RemoteRequestEmits, RemoteRequestExpose, RemoteRequestProps } from "./index.js";
|
|
3
|
-
import * as vue22 from "vue";
|
|
4
3
|
import * as _vueuse_core4 from "@vueuse/core";
|
|
4
|
+
import * as vue20 from "vue";
|
|
5
5
|
|
|
6
6
|
//#region src/components/remote-request/RemoteRequest.vue.d.ts
|
|
7
7
|
declare const __VLS_export: <P extends DataObject, D extends DataObject, R extends DataObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
-
props:
|
|
9
|
-
onSuccess?: ((data: D, params: P[]) => any) | undefined;
|
|
8
|
+
props: vue20.PublicProps & __VLS_PrettifyLocal<RemoteRequestProps<P, D> & {
|
|
10
9
|
onError?: ((err: Error, params: P[]) => any) | undefined;
|
|
10
|
+
onSuccess?: ((data: D, params: P[]) => any) | undefined;
|
|
11
11
|
onFinally?: ((params: P[], data?: D | undefined, err?: Error | undefined) => any) | undefined;
|
|
12
12
|
onBefore?: ((params: P[]) => any) | undefined;
|
|
13
13
|
}> & (typeof globalThis extends {
|
|
14
14
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
15
15
|
} ? P_1 : {});
|
|
16
|
-
expose: (exposed:
|
|
16
|
+
expose: (exposed: vue20.ShallowUnwrapRef<RemoteRequestExpose<P, D, R>>) => void;
|
|
17
17
|
attrs: any;
|
|
18
18
|
slots: {
|
|
19
19
|
default?: (props: {
|
|
@@ -22,7 +22,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
22
22
|
error: Error | undefined;
|
|
23
23
|
params: [] | P[];
|
|
24
24
|
list: R[];
|
|
25
|
-
pagination:
|
|
25
|
+
pagination: {
|
|
26
26
|
page: number;
|
|
27
27
|
pageSize: number;
|
|
28
28
|
itemCount: number;
|
|
@@ -43,7 +43,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
43
43
|
}) => any;
|
|
44
44
|
};
|
|
45
45
|
emit: RemoteRequestEmits<P, D>;
|
|
46
|
-
}>) =>
|
|
46
|
+
}>) => vue20.VNode & {
|
|
47
47
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
48
48
|
};
|
|
49
49
|
declare const _default: typeof __VLS_export;
|
|
@@ -4,22 +4,44 @@ import { ComponentExposed } from "vue-component-type-helpers";
|
|
|
4
4
|
import { UseRequestOptions, UseRequestPlugin } from "vue-hooks-plus/es/useRequest/types";
|
|
5
5
|
|
|
6
6
|
//#region src/components/remote-request/index.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* 远程请求字段配置
|
|
9
|
+
*/
|
|
7
10
|
type RemoteRequestFields = DataRequestFields & {};
|
|
11
|
+
/**
|
|
12
|
+
* 远程请求暴露的方法
|
|
13
|
+
* @template P 请求参数类型
|
|
14
|
+
* @template D 响应数据类型
|
|
15
|
+
* @template R 列表项类型
|
|
16
|
+
*/
|
|
8
17
|
type RemoteRequestExpose<P extends DataObject = DataObject, D extends DataObject = DataObject, R extends DataObject = DataObject> = UseDataRequestReturns<P, D, R>;
|
|
18
|
+
/**
|
|
19
|
+
* 远程请求属性
|
|
20
|
+
* @template P 请求参数类型
|
|
21
|
+
* @template D 响应数据类型
|
|
22
|
+
*/
|
|
9
23
|
type RemoteRequestProps<P extends DataObject = DataObject, D extends DataObject = DataObject> = {
|
|
10
|
-
api: (...args: P[]) => Promise<D>;
|
|
11
|
-
defaultParams?: Partial<P>;
|
|
12
|
-
manual?: boolean;
|
|
13
|
-
fields?: RemoteRequestFields;
|
|
14
|
-
requestOptions?: UseRequestOptions<D, P[]>;
|
|
24
|
+
/** API 函数 */api: (...args: P[]) => Promise<D>; /** 默认请求参数 */
|
|
25
|
+
defaultParams?: Partial<P>; /** 是否手动触发 */
|
|
26
|
+
manual?: boolean; /** 字段配置 */
|
|
27
|
+
fields?: RemoteRequestFields; /** 请求选项 */
|
|
28
|
+
requestOptions?: UseRequestOptions<D, P[]>; /** 请求插件 */
|
|
15
29
|
requestPlugins?: UseRequestPlugin<D, P[]>[];
|
|
16
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* 远程请求事件
|
|
33
|
+
* @template P 请求参数类型
|
|
34
|
+
* @template D 响应数据类型
|
|
35
|
+
*/
|
|
17
36
|
type RemoteRequestEmits<P extends DataObject = DataObject, D extends DataObject = DataObject> = {
|
|
18
|
-
(e: 'before', params: P[]): void;
|
|
19
|
-
(e: 'success', data: D, params: P[]): void;
|
|
20
|
-
(e: 'error', err: Error, params: P[]): void;
|
|
37
|
+
/** 请求前事件 */(e: 'before', params: P[]): void; /** 请求成功事件 */
|
|
38
|
+
(e: 'success', data: D, params: P[]): void; /** 请求错误事件 */
|
|
39
|
+
(e: 'error', err: Error, params: P[]): void; /** 请求完成事件 */
|
|
21
40
|
(e: 'finally', params: P[], data?: D, err?: Error): void;
|
|
22
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* 远程请求实例类型
|
|
44
|
+
*/
|
|
23
45
|
type RemoteRequestInst = ComponentExposed<typeof _default>;
|
|
24
46
|
//#endregion
|
|
25
47
|
export { RemoteRequestEmits, RemoteRequestExpose, RemoteRequestFields, RemoteRequestInst, RemoteRequestProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MageSearch_default from "../icons/MageSearch.js";
|
|
2
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createSlots, createTextVNode, createVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, unref, useTemplateRef, watch, watchEffect, withCtx } from "vue";
|
|
3
2
|
import { useDebounceFn, useTimeoutFn } from "@vueuse/core";
|
|
3
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createSlots, createTextVNode, createVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, unref, useTemplateRef, watch, watchEffect, withCtx } from "vue";
|
|
4
4
|
import { NButton, NInput, NInputGroup } from "naive-ui";
|
|
5
5
|
|
|
6
6
|
//#region src/components/search-input/SearchInput.vue
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SearchInputProps } from "./index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue55 from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/search-input/SearchInput.vue.d.ts
|
|
5
5
|
declare var __VLS_19: {}, __VLS_21: {}, __VLS_28: {
|
|
@@ -15,11 +15,11 @@ type __VLS_Slots = {} & {
|
|
|
15
15
|
} & {
|
|
16
16
|
'button-icon'?: (props: typeof __VLS_39) => any;
|
|
17
17
|
};
|
|
18
|
-
declare const __VLS_base:
|
|
18
|
+
declare const __VLS_base: vue55.DefineComponent<SearchInputProps, {}, {}, {}, {}, vue55.ComponentOptionsMixin, vue55.ComponentOptionsMixin, {} & {
|
|
19
19
|
"update:value": (v: string | null | undefined) => any;
|
|
20
|
-
}, string,
|
|
20
|
+
}, string, vue55.PublicProps, Readonly<SearchInputProps> & Readonly<{
|
|
21
21
|
"onUpdate:value"?: ((v: string | null | undefined) => any) | undefined;
|
|
22
|
-
}>, {}, {}, {}, {}, string,
|
|
22
|
+
}>, {}, {}, {}, {}, string, vue55.ComponentProvideOptions, false, {}, any>;
|
|
23
23
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
24
|
declare const _default: typeof __VLS_export;
|
|
25
25
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -3,14 +3,17 @@ import { ClassStyle } from "../data-table-plus/index.js";
|
|
|
3
3
|
import { ButtonProps, InputProps } from "naive-ui";
|
|
4
4
|
|
|
5
5
|
//#region src/components/search-input/index.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 搜索输入框属性
|
|
8
|
+
*/
|
|
6
9
|
type SearchInputProps = {
|
|
7
|
-
value?: string | null;
|
|
8
|
-
type?: ButtonProps['type'];
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
autoTrigger?: boolean | number;
|
|
12
|
-
searchButton?: 'text' | 'icon' | boolean;
|
|
13
|
-
inputProps?: InputProps & ClassStyle;
|
|
10
|
+
/** 值 */value?: string | null; /** 按钮类型 */
|
|
11
|
+
type?: ButtonProps['type']; /** 占位符 */
|
|
12
|
+
placeholder?: string; /** 是否加载中 */
|
|
13
|
+
loading?: boolean; /** 是否自动触发 */
|
|
14
|
+
autoTrigger?: boolean | number; /** 搜索按钮类型 */
|
|
15
|
+
searchButton?: 'text' | 'icon' | boolean; /** 输入框属性 */
|
|
16
|
+
inputProps?: InputProps & ClassStyle; /** 按钮属性 */
|
|
14
17
|
buttonProps?: ButtonProps & ClassStyle;
|
|
15
18
|
};
|
|
16
19
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassStyle } from "../data-table-plus/index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue10 from "vue";
|
|
3
3
|
import { InputProps } from "naive-ui";
|
|
4
4
|
|
|
5
5
|
//#region src/components/toggle-input/ToggleInput.vue.d.ts
|
|
@@ -27,14 +27,14 @@ type __VLS_Slots = {} & {
|
|
|
27
27
|
} & {
|
|
28
28
|
default?: (props: typeof __VLS_13) => any;
|
|
29
29
|
};
|
|
30
|
-
declare const __VLS_base:
|
|
30
|
+
declare const __VLS_base: vue10.DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, vue10.ComponentOptionsMixin, vue10.ComponentOptionsMixin, {
|
|
31
31
|
"update:value": (value: string | number | undefined) => any;
|
|
32
32
|
} & {
|
|
33
33
|
trigger: () => any;
|
|
34
|
-
}, string,
|
|
34
|
+
}, string, vue10.PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
35
35
|
"onUpdate:value"?: ((value: string | number | undefined) => any) | undefined;
|
|
36
36
|
onTrigger?: (() => any) | undefined;
|
|
37
|
-
}>, {}, {}, {}, {}, string,
|
|
37
|
+
}>, {}, {}, {}, {}, string, vue10.ComponentProvideOptions, false, {}, any>;
|
|
38
38
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
39
39
|
declare const _default: typeof __VLS_export;
|
|
40
40
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TooltipButtonProps } from "./index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue15 from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/tooltip-button/TooltipButton.vue.d.ts
|
|
5
5
|
declare var __VLS_17: {}, __VLS_20: {}, __VLS_22: {};
|
|
@@ -10,11 +10,11 @@ type __VLS_Slots = {} & {
|
|
|
10
10
|
} & {
|
|
11
11
|
tooltip?: (props: typeof __VLS_22) => any;
|
|
12
12
|
};
|
|
13
|
-
declare const __VLS_base:
|
|
13
|
+
declare const __VLS_base: vue15.DefineComponent<TooltipButtonProps, {}, {}, {}, {}, vue15.ComponentOptionsMixin, vue15.ComponentOptionsMixin, {} & {
|
|
14
14
|
click: (ev: MouseEvent) => any;
|
|
15
|
-
}, string,
|
|
15
|
+
}, string, vue15.PublicProps, Readonly<TooltipButtonProps> & Readonly<{
|
|
16
16
|
onClick?: ((ev: MouseEvent) => any) | undefined;
|
|
17
|
-
}>, {}, {}, {}, {}, string,
|
|
17
|
+
}>, {}, {}, {}, {}, string, vue15.ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
19
|
declare const _default: typeof __VLS_export;
|
|
20
20
|
type __VLS_WithSlots<T, S> = T & {
|