@oiij/naive-ui 0.0.76 → 0.0.78
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/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 +2 -2
- 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 +46 -111
- 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 +21 -21
- 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 +35 -39
- 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 +13 -13
- package/dist/components/remote-request/index.d.ts +30 -8
- 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/BaseTransition.vue.d.ts +2 -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 +25 -18
- package/dist/composables/use-data-request.js +22 -3
- 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 +21 -13
- package/dist/composables/use-naive-form.js +48 -39
- package/dist/composables/use-naive-menu.d.ts +20 -5
- package/dist/composables/use-naive-menu.js +19 -61
- 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
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import { DataObject } from "../../composables/use-data-request.js";
|
|
2
2
|
import { PresetPickerEmits, PresetPickerExpose, PresetPickerProps, PresetPickerValue } from "./index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as vue46 from "vue";
|
|
4
4
|
import { DataTableColumns } from "naive-ui";
|
|
5
5
|
|
|
6
6
|
//#region src/components/preset-picker/PresetPicker.vue.d.ts
|
|
7
7
|
declare const __VLS_export: <V extends PresetPickerValue, 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
|
-
onClose?: (() => any) | undefined;
|
|
8
|
+
props: vue46.PublicProps & __VLS_PrettifyLocal<PresetPickerProps<V, R> & {
|
|
10
9
|
"onUpdate:value"?: ((val: V | null, raw: R | R[] | null) => any) | undefined;
|
|
11
|
-
onAfterEnter?: (() => any) | undefined;
|
|
12
|
-
onAfterLeave?: (() => any) | undefined;
|
|
13
|
-
onEsc?: (() => any) | undefined;
|
|
14
|
-
onMaskClick?: (() => any) | undefined;
|
|
15
10
|
onNegativeClick?: (() => any) | undefined;
|
|
16
11
|
onPositiveClick?: (() => any) | undefined;
|
|
17
|
-
"onUpdate:show"?: ((value: boolean) => any) | undefined;
|
|
18
12
|
}> & (typeof globalThis extends {
|
|
19
13
|
__VLS_PROPS_FALLBACK: infer P;
|
|
20
14
|
} ? P : {});
|
|
21
|
-
expose: (exposed:
|
|
15
|
+
expose: (exposed: vue46.ShallowUnwrapRef<PresetPickerExpose<R>>) => void;
|
|
22
16
|
attrs: any;
|
|
23
17
|
slots: {
|
|
24
18
|
'button-icon'?: (props: {}) => any;
|
|
@@ -43,6 +37,7 @@ declare const __VLS_export: <V extends PresetPickerValue, R extends DataObject>(
|
|
|
43
37
|
clearValue: () => void;
|
|
44
38
|
setCheckedRowKeys: (keys: (string | number)[]) => void;
|
|
45
39
|
setCheckedRows: (rows: R[]) => void;
|
|
40
|
+
onLoadedRows: (rows: R[]) => void;
|
|
46
41
|
}) => any;
|
|
47
42
|
} & {
|
|
48
43
|
'modal-action'?: (props: {}) => any;
|
|
@@ -54,7 +49,7 @@ declare const __VLS_export: <V extends PresetPickerValue, R extends DataObject>(
|
|
|
54
49
|
'modal-close'?: (props: {}) => any;
|
|
55
50
|
};
|
|
56
51
|
emit: PresetPickerEmits<V, R>;
|
|
57
|
-
}>) =>
|
|
52
|
+
}>) => vue46.VNode & {
|
|
58
53
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
59
54
|
};
|
|
60
55
|
declare const _default: typeof __VLS_export;
|
|
@@ -7,53 +7,67 @@ import { ComponentExposed } from "vue-component-type-helpers";
|
|
|
7
7
|
import { TableSelectionColumn } from "naive-ui/es/data-table/src/interface";
|
|
8
8
|
|
|
9
9
|
//#region src/components/preset-picker/index.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* 预设选择器值类型
|
|
12
|
+
*/
|
|
10
13
|
type PresetPickerValue = string | number | (string | number)[] | null;
|
|
14
|
+
/**
|
|
15
|
+
* 预设选择器暴露的方法
|
|
16
|
+
* @template R 列表项类型
|
|
17
|
+
*/
|
|
11
18
|
type PresetPickerExpose<R extends DataObject = DataObject> = {
|
|
12
|
-
showModalFlag: Ref<boolean, boolean>;
|
|
13
|
-
checkedRowKeys: Ref<(string | number)[], (string | number)[]>;
|
|
14
|
-
checkedRows: Ref<R[], R[]>;
|
|
15
|
-
columns: DataTableColumns<any>;
|
|
16
|
-
showModal: () => void;
|
|
19
|
+
/** 显示模态框标志 */showModalFlag: Ref<boolean, boolean>; /** 选中行键 */
|
|
20
|
+
checkedRowKeys: Ref<(string | number)[], (string | number)[]>; /** 选中行数据 */
|
|
21
|
+
checkedRows: Ref<R[], R[]>; /** 表格列配置 */
|
|
22
|
+
columns: DataTableColumns<any>; /** 显示模态框 */
|
|
23
|
+
showModal: () => void; /** 更新选中行键效果 */
|
|
17
24
|
updateCheckedRowKeysEffect: (keys: (string | number)[], rows: (R | undefined)[], meta: {
|
|
18
25
|
row: R | undefined;
|
|
19
26
|
action: 'check' | 'uncheck' | 'checkAll' | 'uncheckAll';
|
|
20
|
-
}, currentData: R[]) => void;
|
|
21
|
-
clickRowEffect: (row: R) => void;
|
|
22
|
-
clearValue: () => void;
|
|
23
|
-
setCheckedRowKeys: (keys: (string | number)[]) => void;
|
|
27
|
+
}, currentData: R[]) => void; /** 点击行效果 */
|
|
28
|
+
clickRowEffect: (row: R) => void; /** 清空值 */
|
|
29
|
+
clearValue: () => void; /** 设置选中行键 */
|
|
30
|
+
setCheckedRowKeys: (keys: (string | number)[]) => void; /** 设置选中行数据 */
|
|
24
31
|
setCheckedRows: (rows: R[]) => void;
|
|
25
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* 预设选择器属性
|
|
35
|
+
* @template V 值类型
|
|
36
|
+
* @template R 列表项类型
|
|
37
|
+
*/
|
|
26
38
|
type PresetPickerProps<V extends PresetPickerValue, R extends DataObject = DataObject> = {
|
|
27
|
-
value?: V;
|
|
28
|
-
fallbackLabel?: string | ((val: string | number) => string);
|
|
29
|
-
multiple?: boolean;
|
|
30
|
-
disabled?: boolean;
|
|
31
|
-
clearable?: boolean;
|
|
32
|
-
tooltip?: boolean;
|
|
33
|
-
placeholder?: string;
|
|
34
|
-
type?: ButtonProps['type'];
|
|
35
|
-
columns?: DataTableColumns<R>;
|
|
36
|
-
selectionOptions?: TableSelectionColumn;
|
|
39
|
+
/** 值 */value?: V; /** 回退标签 */
|
|
40
|
+
fallbackLabel?: string | ((val: string | number) => string); /** 是否多选 */
|
|
41
|
+
multiple?: boolean; /** 是否禁用 */
|
|
42
|
+
disabled?: boolean; /** 是否可清空 */
|
|
43
|
+
clearable?: boolean; /** 是否显示提示 */
|
|
44
|
+
tooltip?: boolean; /** 占位符 */
|
|
45
|
+
placeholder?: string; /** 按钮类型 */
|
|
46
|
+
type?: ButtonProps['type']; /** 表格列配置 */
|
|
47
|
+
columns?: DataTableColumns<R>; /** 选择列选项 */
|
|
48
|
+
selectionOptions?: TableSelectionColumn; /** 字段映射 */
|
|
37
49
|
fields?: {
|
|
38
50
|
label?: string;
|
|
39
51
|
value?: string;
|
|
40
|
-
};
|
|
41
|
-
buttonProps?: ButtonProps & ClassStyle;
|
|
42
|
-
clearButtonProps?: ButtonProps & ClassStyle;
|
|
43
|
-
badgeProps?: BadgeProps & ClassStyle;
|
|
52
|
+
}; /** 按钮属性 */
|
|
53
|
+
buttonProps?: ButtonProps & ClassStyle; /** 清空按钮属性 */
|
|
54
|
+
clearButtonProps?: ButtonProps & ClassStyle; /** 徽标属性 */
|
|
55
|
+
badgeProps?: BadgeProps & ClassStyle; /** 模态框属性 */
|
|
44
56
|
modalProps?: ModalProps & ClassStyle;
|
|
45
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* 预设选择器事件
|
|
60
|
+
* @template V 值类型
|
|
61
|
+
* @template R 列表项类型
|
|
62
|
+
*/
|
|
46
63
|
type PresetPickerEmits<V extends PresetPickerValue, R extends DataObject = DataObject> = {
|
|
47
|
-
(e: 'update:value', val: V | null, raw: R | R[] | null): void;
|
|
48
|
-
(e: '
|
|
49
|
-
(e: 'afterLeave'): void;
|
|
50
|
-
(e: 'esc'): void;
|
|
51
|
-
(e: 'maskClick'): void;
|
|
52
|
-
(e: 'update:show', value: boolean): void;
|
|
53
|
-
(e: 'close'): void;
|
|
54
|
-
(e: 'negativeClick'): void;
|
|
64
|
+
/** 更新值事件 */(e: 'update:value', val: V | null, raw: R | R[] | null): void; /** 点击取消按钮事件 */
|
|
65
|
+
(e: 'negativeClick'): void; /** 点击确认按钮事件 */
|
|
55
66
|
(e: 'positiveClick'): void;
|
|
56
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* 预设选择器实例类型
|
|
70
|
+
*/
|
|
57
71
|
type PresetPickerInst = ComponentExposed<typeof _default>;
|
|
58
72
|
//#endregion
|
|
59
73
|
export { PresetPickerEmits, PresetPickerExpose, PresetPickerInst, PresetPickerProps, PresetPickerValue };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useDataRequest } from "../../composables/use-data-request.js";
|
|
2
2
|
import { useDebounceFn } from "@vueuse/core";
|
|
3
|
-
import { computed, createBlock, createCommentVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, reactive, ref, renderSlot, toRaw,
|
|
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_core4 from "@vueuse/core";
|
|
4
|
+
import * as vue30 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
|
-
onError?: ((err: Error, params: P[]) => any) | undefined;
|
|
9
|
+
props: vue30.PublicProps & __VLS_PrettifyLocal<PresetSelectProps<V, P, D, R> & {
|
|
11
10
|
onSuccess?: ((data: D, params: P[]) => any) | undefined;
|
|
12
|
-
|
|
13
|
-
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
14
|
-
onFocus?: ((ev: FocusEvent) => any) | undefined;
|
|
15
|
-
onScroll?: ((ev: Event) => any) | undefined;
|
|
11
|
+
onError?: ((err: Error, params: P[]) => any) | undefined;
|
|
16
12
|
"onUpdate:value"?: ((val: V | null, option: SelectOption | SelectOption[] | null, raw: R | R[] | null) => any) | undefined;
|
|
17
|
-
onSearch?: ((
|
|
18
|
-
onFinally?: ((params: P[], data?: D | undefined, err?: Error | undefined) => any) | undefined;
|
|
13
|
+
onSearch?: ((val: string) => any) | undefined;
|
|
19
14
|
onBefore?: ((params: P[]) => any) | undefined;
|
|
20
|
-
|
|
15
|
+
"onUpdate:show"?: ((show: boolean) => any) | undefined;
|
|
21
16
|
"onUpdate:page"?: ((page: number) => any) | undefined;
|
|
22
17
|
"onUpdate:pageSize"?: ((pageSize: number) => any) | undefined;
|
|
18
|
+
onFinally?: ((params: P[], data?: D | undefined, err?: Error | undefined) => 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: vue30.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_core4.EventHookOn<[P[]]>;
|
|
47
|
+
onSuccess: _vueuse_core4.EventHookOn<[D, P[]]>;
|
|
48
|
+
onError: _vueuse_core4.EventHookOn<[Error, P[]]>;
|
|
49
|
+
onFinally: _vueuse_core4.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_core4.EventHookOn<[P[]]>;
|
|
74
|
+
onSuccess: _vueuse_core4.EventHookOn<[D, P[]]>;
|
|
75
|
+
onError: _vueuse_core4.EventHookOn<[Error, P[]]>;
|
|
76
|
+
onFinally: _vueuse_core4.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_core4.EventHookOn<[P[]]>;
|
|
101
|
+
onSuccess: _vueuse_core4.EventHookOn<[D, P[]]>;
|
|
102
|
+
onError: _vueuse_core4.EventHookOn<[Error, P[]]>;
|
|
103
|
+
onFinally: _vueuse_core4.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_core4.EventHookOn<[P[]]>;
|
|
128
|
+
onSuccess: _vueuse_core4.EventHookOn<[D, P[]]>;
|
|
129
|
+
onError: _vueuse_core4.EventHookOn<[Error, P[]]>;
|
|
130
|
+
onFinally: _vueuse_core4.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_core4.EventHookOn<[P[]]>;
|
|
155
|
+
onSuccess: _vueuse_core4.EventHookOn<[D, P[]]>;
|
|
156
|
+
onError: _vueuse_core4.EventHookOn<[Error, P[]]>;
|
|
157
|
+
onFinally: _vueuse_core4.EventHookOn<[P[], D | undefined, Error | undefined]>;
|
|
162
158
|
}) => any;
|
|
163
159
|
};
|
|
164
160
|
emit: PresetSelectEmits<V, P, D, R>;
|
|
165
|
-
}>) =>
|
|
161
|
+
}>) => vue30.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
|
|
4
|
-
import * as
|
|
3
|
+
import * as _vueuse_core52 from "@vueuse/core";
|
|
4
|
+
import * as vue41 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
|
-
onError?: ((err: Error, params: P[]) => any) | undefined;
|
|
8
|
+
props: vue41.PublicProps & __VLS_PrettifyLocal<RemoteRequestProps<P, D> & {
|
|
10
9
|
onSuccess?: ((data: D, params: P[]) => any) | undefined;
|
|
11
|
-
|
|
10
|
+
onError?: ((err: Error, params: P[]) => any) | undefined;
|
|
12
11
|
onBefore?: ((params: P[]) => any) | undefined;
|
|
12
|
+
onFinally?: ((params: P[], data?: D | undefined, err?: Error | undefined) => 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: vue41.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;
|
|
@@ -36,14 +36,14 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
36
36
|
setParams: (_params: Partial<P>) => void;
|
|
37
37
|
runParams: (_params: Partial<P>) => void;
|
|
38
38
|
runParamsAsync: (_params: Partial<P>) => Promise<D>;
|
|
39
|
-
onBefore:
|
|
40
|
-
onSuccess:
|
|
41
|
-
onError:
|
|
42
|
-
onFinally:
|
|
39
|
+
onBefore: _vueuse_core52.EventHookOn<[P[]]>;
|
|
40
|
+
onSuccess: _vueuse_core52.EventHookOn<[D, P[]]>;
|
|
41
|
+
onError: _vueuse_core52.EventHookOn<[Error, P[]]>;
|
|
42
|
+
onFinally: _vueuse_core52.EventHookOn<[P[], D | undefined, Error | undefined]>;
|
|
43
43
|
}) => any;
|
|
44
44
|
};
|
|
45
45
|
emit: RemoteRequestEmits<P, D>;
|
|
46
|
-
}>) =>
|
|
46
|
+
}>) => vue41.VNode & {
|
|
47
47
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
48
48
|
};
|
|
49
49
|
declare const _default: typeof __VLS_export;
|