v-nuxt-ui 0.1.28 → 0.1.29
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/module.json +1 -1
- package/dist/runtime/components/form/field/AsyncObjectSelect.vue +4 -1
- package/dist/runtime/components/form/field/AsyncSelect.d.vue.ts +4 -0
- package/dist/runtime/components/form/field/AsyncSelect.vue +3 -0
- package/dist/runtime/components/form/field/AsyncSelect.vue.d.ts +4 -0
- package/dist/runtime/components/form/field/AsyncTreeSelect.vue +3 -0
- package/dist/runtime/components/form/field/index.vue +3 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue +4 -1
- package/dist/runtime/composables/table/useTableRowActions.js +33 -21
- package/dist/runtime/types/components/form/field.d.ts +4 -1
- package/dist/runtime/types/components/table/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -15,7 +15,10 @@ const props = defineProps({
|
|
|
15
15
|
disableOprSelector: { type: Boolean, required: false },
|
|
16
16
|
multiple: { type: Boolean, required: false },
|
|
17
17
|
placeholder: { type: String, required: false },
|
|
18
|
-
size: { type: null, required: false }
|
|
18
|
+
size: { type: null, required: false },
|
|
19
|
+
canCreate: { type: Boolean, required: false },
|
|
20
|
+
createModalComponent: { type: null, required: false },
|
|
21
|
+
createModalOpenProps: { type: Object, required: false }
|
|
19
22
|
});
|
|
20
23
|
const modelValue = defineModel("modelValue", { type: null, ...{ required: true } });
|
|
21
24
|
const initModelValue = ref(modelValue.value);
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
1
2
|
import type { VFormFieldAsyncSelectProps } from '#v/types';
|
|
2
3
|
declare const __VLS_export: <T>(__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<{
|
|
3
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(VFormFieldAsyncSelectProps<T> & {
|
|
4
5
|
icon?: string;
|
|
5
6
|
disabled?: boolean;
|
|
7
|
+
canCreate?: boolean;
|
|
8
|
+
createModalComponent?: Component;
|
|
9
|
+
createModalOpenProps?: Record<string, any>;
|
|
6
10
|
} & {
|
|
7
11
|
modelValue: string[] | number[] | number | string | null | undefined;
|
|
8
12
|
}) & {
|
|
@@ -25,6 +25,9 @@ const props = defineProps({
|
|
|
25
25
|
multiple: { type: Boolean, required: false },
|
|
26
26
|
placeholder: { type: String, required: false },
|
|
27
27
|
size: { type: null, required: false },
|
|
28
|
+
canCreate: { type: Boolean, required: false },
|
|
29
|
+
createModalComponent: { type: void 0, required: false },
|
|
30
|
+
createModalOpenProps: { type: Object, required: false },
|
|
28
31
|
icon: { type: String, required: false },
|
|
29
32
|
disabled: { type: Boolean, required: false }
|
|
30
33
|
});
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
1
2
|
import type { VFormFieldAsyncSelectProps } from '#v/types';
|
|
2
3
|
declare const __VLS_export: <T>(__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<{
|
|
3
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(VFormFieldAsyncSelectProps<T> & {
|
|
4
5
|
icon?: string;
|
|
5
6
|
disabled?: boolean;
|
|
7
|
+
canCreate?: boolean;
|
|
8
|
+
createModalComponent?: Component;
|
|
9
|
+
createModalOpenProps?: Record<string, any>;
|
|
6
10
|
} & {
|
|
7
11
|
modelValue: string[] | number[] | number | string | null | undefined;
|
|
8
12
|
}) & {
|
|
@@ -23,6 +23,9 @@ const props = defineProps({
|
|
|
23
23
|
multiple: { type: Boolean, required: false },
|
|
24
24
|
placeholder: { type: String, required: false },
|
|
25
25
|
size: { type: null, required: false },
|
|
26
|
+
canCreate: { type: Boolean, required: false },
|
|
27
|
+
createModalComponent: { type: null, required: false },
|
|
28
|
+
createModalOpenProps: { type: Object, required: false },
|
|
26
29
|
icon: { type: String, required: false },
|
|
27
30
|
disabled: { type: Boolean, required: false }
|
|
28
31
|
});
|
|
@@ -147,6 +147,9 @@ const fieldModelValue = computed({
|
|
|
147
147
|
:disabled="field.disabled"
|
|
148
148
|
:enable-empty-option="field.enableEmptyOption"
|
|
149
149
|
:extra-search-field-fn="field.extraSearchFieldFn"
|
|
150
|
+
:can-create="field.canCreate"
|
|
151
|
+
:create-modal-component="field.createModalComponent"
|
|
152
|
+
:create-modal-open-props="field.createModalOpenProps"
|
|
150
153
|
@update-init-model-values="field.onUpdateInitModelValues"
|
|
151
154
|
/>
|
|
152
155
|
<FormFieldAsyncObjectSelect
|
|
@@ -22,7 +22,10 @@ const props = defineProps({
|
|
|
22
22
|
disableOprSelector: { type: Boolean, required: false },
|
|
23
23
|
multiple: { type: Boolean, required: false },
|
|
24
24
|
placeholder: { type: String, required: false },
|
|
25
|
-
size: { type: null, required: false, default: "sm" }
|
|
25
|
+
size: { type: null, required: false, default: "sm" },
|
|
26
|
+
canCreate: { type: Boolean, required: false },
|
|
27
|
+
createModalComponent: { type: null, required: false },
|
|
28
|
+
createModalOpenProps: { type: Object, required: false }
|
|
26
29
|
});
|
|
27
30
|
const whereQueryItem = defineModel("whereQueryItem", { type: Object, ...{ required: true } });
|
|
28
31
|
const { fetching, startFetching, endFetching } = useFetching();
|
|
@@ -47,35 +47,47 @@ export function useTableRowActions(props) {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const buildActionItem = (action) => {
|
|
51
|
+
const item = {
|
|
52
52
|
label: action.label,
|
|
53
53
|
icon: action.icon,
|
|
54
54
|
type: action.type,
|
|
55
|
-
color: action.color
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
color: action.color
|
|
56
|
+
};
|
|
57
|
+
if (action.children && action.children.length > 0) {
|
|
58
|
+
item.children = action.children.map(buildActionItem);
|
|
59
|
+
return item;
|
|
60
|
+
}
|
|
61
|
+
item.onClick = async () => {
|
|
62
|
+
if (action.fn) {
|
|
63
|
+
try {
|
|
58
64
|
action.fn(row.original);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
65
|
+
} catch (e) {
|
|
66
|
+
console.error("Error in row action fn:", e);
|
|
62
67
|
}
|
|
63
|
-
if (action.
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
await action.asyncFn(row.original);
|
|
67
|
-
} finally {
|
|
68
|
-
actionLoadingRowIdxSet.value.delete(row.index);
|
|
69
|
-
}
|
|
68
|
+
if (action.refetchAfterFn) {
|
|
69
|
+
await fetchList();
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
}
|
|
72
|
+
if (action.asyncFn) {
|
|
73
|
+
actionLoadingRowIdxSet.value.add(row.index);
|
|
74
|
+
try {
|
|
75
|
+
await action.asyncFn(row.original);
|
|
76
|
+
} finally {
|
|
77
|
+
actionLoadingRowIdxSet.value.delete(row.index);
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
|
|
80
|
+
if (action.fnWithModal) {
|
|
81
|
+
const result = await action.fnWithModal(row.original);
|
|
82
|
+
if (result) {
|
|
83
|
+
await fetchList();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return item;
|
|
88
|
+
};
|
|
89
|
+
extraRowActions?.forEach((action) => {
|
|
90
|
+
actionItems.push(buildActionItem(action));
|
|
79
91
|
});
|
|
80
92
|
if (!disableRowDeletion) {
|
|
81
93
|
if (actionItems.length > 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VNode, Ref } from 'vue';
|
|
1
|
+
import type { VNode, Ref, Component } from 'vue';
|
|
2
2
|
import type { ButtonProps, FormFieldProps, InputProps, RadioGroupProps, SelectMenuItem, SelectProps, TreeItem } from '@nuxt/ui';
|
|
3
3
|
import type { ZodType } from 'zod';
|
|
4
4
|
import type { PageResult, RequestResult } from '../../request.js';
|
|
@@ -20,6 +20,9 @@ export type VFormFieldAsyncSelectProps<T> = {
|
|
|
20
20
|
multiple?: boolean;
|
|
21
21
|
placeholder?: string;
|
|
22
22
|
size?: SelectProps['size'];
|
|
23
|
+
canCreate?: boolean;
|
|
24
|
+
createModalComponent?: Component;
|
|
25
|
+
createModalOpenProps?: Record<string, any>;
|
|
23
26
|
};
|
|
24
27
|
export type VFormFieldAsyncTreeSelectProps<T> = {
|
|
25
28
|
fetchAll?: boolean;
|
package/package.json
CHANGED