@sfxcode/nuxt-ui-formkit 1.2.3 → 1.2.5
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 +1 -0
- package/dist/module.json +1 -1
- package/dist/runtime/components/FUAutoForm.d.vue.ts +7 -8
- package/dist/runtime/components/FUAutoForm.vue +1 -1
- package/dist/runtime/components/FUAutoForm.vue.d.ts +7 -8
- package/dist/runtime/components/FUAutoFormOverlay.d.vue.ts +82 -0
- package/dist/runtime/components/FUAutoFormOverlay.vue +106 -0
- package/dist/runtime/components/FUAutoFormOverlay.vue.d.ts +82 -0
- package/dist/runtime/components/FUDataEdit.d.vue.ts +7 -7
- package/dist/runtime/components/FUDataEdit.vue +3 -2
- package/dist/runtime/components/FUDataEdit.vue.d.ts +7 -7
- package/dist/runtime/components/FUDataEditOverlay.d.vue.ts +64 -0
- package/dist/runtime/components/FUDataEditOverlay.vue +94 -0
- package/dist/runtime/components/FUDataEditOverlay.vue.d.ts +64 -0
- package/dist/runtime/components/FUDataView.d.vue.ts +7 -7
- package/dist/runtime/components/FUDataView.vue +1 -1
- package/dist/runtime/components/FUDataView.vue.d.ts +7 -7
- package/dist/runtime/components/inputs/FUCalendar.vue +5 -2
- package/dist/runtime/components/inputs/FUCheckbox.vue +3 -2
- package/dist/runtime/components/inputs/FUCheckboxGroup.vue +5 -1
- package/dist/runtime/components/inputs/FUColorPicker.vue +2 -2
- package/dist/runtime/components/inputs/FUEditor.vue +59 -55
- package/dist/runtime/components/inputs/FUFileUpload.vue +3 -2
- package/dist/runtime/components/inputs/FUInput.vue +3 -2
- package/dist/runtime/components/inputs/FUInputDate.vue +6 -2
- package/dist/runtime/components/inputs/FUInputMenu.vue +3 -2
- package/dist/runtime/components/inputs/FUInputNumber.vue +3 -2
- package/dist/runtime/components/inputs/FUInputTags.vue +3 -2
- package/dist/runtime/components/inputs/FUInputTime.vue +6 -2
- package/dist/runtime/components/inputs/FUListbox.vue +11 -6
- package/dist/runtime/components/inputs/FUPinInput.vue +9 -2
- package/dist/runtime/components/inputs/FURadioGroup.vue +5 -2
- package/dist/runtime/components/inputs/FUSelect.vue +2 -2
- package/dist/runtime/components/inputs/FUSelectMenu.vue +2 -2
- package/dist/runtime/components/inputs/FUSlider.vue +2 -2
- package/dist/runtime/components/inputs/FUSwitch.vue +3 -2
- package/dist/runtime/components/inputs/FUTextarea.vue +3 -2
- package/dist/runtime/components/output/FUOutputBoolean.d.vue.ts +2 -0
- package/dist/runtime/components/output/FUOutputBoolean.vue.d.ts +2 -0
- package/dist/runtime/components/output/FUOutputDate.d.vue.ts +2 -0
- package/dist/runtime/components/output/FUOutputDate.vue.d.ts +2 -0
- package/dist/runtime/components/output/FUOutputLink.d.vue.ts +2 -0
- package/dist/runtime/components/output/FUOutputLink.vue.d.ts +2 -0
- package/dist/runtime/components/output/FUOutputList.d.vue.ts +2 -0
- package/dist/runtime/components/output/FUOutputList.vue +2 -1
- package/dist/runtime/components/output/FUOutputList.vue.d.ts +2 -0
- package/dist/runtime/components/output/FUOutputNumber.d.vue.ts +2 -0
- package/dist/runtime/components/output/FUOutputNumber.vue.d.ts +2 -0
- package/dist/runtime/components/output/FUOutputText.d.vue.ts +2 -0
- package/dist/runtime/components/output/FUOutputText.vue.d.ts +2 -0
- package/dist/runtime/composables/useFormKitOverlay.d.ts +20 -0
- package/dist/runtime/composables/useFormKitOverlay.js +42 -0
- package/dist/runtime/composables/useFormKitRepeater.js +5 -5
- package/dist/runtime/composables/useFormKitSchema.d.ts +7 -24
- package/dist/runtime/formkit/definitions/output.js +6 -6
- package/dist/runtime/formkit/definitions/output.mjs +6 -6
- package/dist/runtime/formkit/definitions/repeater.js +4 -0
- package/dist/runtime/formkit/definitions/repeater.mjs +4 -0
- package/dist/runtime/formkit/index.d.ts +6 -1
- package/dist/runtime/utils/useFormKitContainerBlur.d.ts +37 -0
- package/dist/runtime/utils/useFormKitContainerBlur.js +9 -0
- package/dist/runtime/utils/useFormKitInput.d.ts +1 -0
- package/dist/runtime/utils/useFormKitInput.js +10 -2
- package/dist/runtime/utils/useFormKitOutput.d.ts +25 -0
- package/dist/runtime/utils/useFormKitOutput.js +21 -5
- package/dist/runtime/utils/useOverlayCloseResolution.d.ts +20 -0
- package/dist/runtime/utils/useOverlayCloseResolution.js +17 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -75,6 +75,7 @@ FormKit Nuxt UI bridges the gap between [FormKit](https://formkit.com/)'s powerf
|
|
|
75
75
|
- `useFormKitMultiStep` - Multi-step tab-item mapping and navigation bridging
|
|
76
76
|
- `useFormKitForm` - Submit/reset/error-management wrapper for a form's imperative APIs, callable from outside the form
|
|
77
77
|
- `useFormKitAutoForm` - Schema inference from data value shapes, Valibot, or Zod schemas (`inferFormSchema`/`inferFormSchemaFromValibot`/`inferFormSchemaFromZod`)
|
|
78
|
+
- `useFormKitOverlay` - Promise-based modal/slideover forms: `await overlay.edit({ data, schema, title })` (or `.auto(...)` for a schema-free version), resolving to the saved data or `null` on cancel
|
|
78
79
|
- `colorConverter` - Color format conversion utilities
|
|
79
80
|
- `durationConverter` - Duration format conversion utilities
|
|
80
81
|
|
package/dist/module.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
2
1
|
import type { PropType } from 'vue';
|
|
3
2
|
import type { AutoFormOverrides, ValibotLikeSchema, ZodLikeSchema } from '../composables/useFormKitAutoForm.js';
|
|
4
3
|
declare var __VLS_10: string, __VLS_11: any;
|
|
@@ -7,7 +6,7 @@ type __VLS_Slots = {} & {
|
|
|
7
6
|
};
|
|
8
7
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
8
|
data: {
|
|
10
|
-
type:
|
|
9
|
+
type: PropType<Record<string, unknown>>;
|
|
11
10
|
default: null;
|
|
12
11
|
};
|
|
13
12
|
overrides: {
|
|
@@ -23,13 +22,13 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
23
22
|
default: undefined;
|
|
24
23
|
};
|
|
25
24
|
modelValue: {
|
|
26
|
-
type: PropType<
|
|
25
|
+
type: PropType<Record<string, unknown>>;
|
|
27
26
|
};
|
|
28
27
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
|
-
"update:modelValue": (value:
|
|
28
|
+
"update:modelValue": (value: Record<string, unknown> | undefined) => any;
|
|
30
29
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
30
|
data: {
|
|
32
|
-
type:
|
|
31
|
+
type: PropType<Record<string, unknown>>;
|
|
33
32
|
default: null;
|
|
34
33
|
};
|
|
35
34
|
overrides: {
|
|
@@ -45,12 +44,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
45
44
|
default: undefined;
|
|
46
45
|
};
|
|
47
46
|
modelValue: {
|
|
48
|
-
type: PropType<
|
|
47
|
+
type: PropType<Record<string, unknown>>;
|
|
49
48
|
};
|
|
50
49
|
}>> & Readonly<{
|
|
51
|
-
"onUpdate:modelValue"?: ((value:
|
|
50
|
+
"onUpdate:modelValue"?: ((value: Record<string, unknown> | undefined) => any) | undefined;
|
|
52
51
|
}>, {
|
|
53
|
-
data: Record<string,
|
|
52
|
+
data: Record<string, unknown>;
|
|
54
53
|
overrides: AutoFormOverrides;
|
|
55
54
|
valibotSchema: ValibotLikeSchema;
|
|
56
55
|
zodSchema: ZodLikeSchema;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
2
1
|
import type { PropType } from 'vue';
|
|
3
2
|
import type { AutoFormOverrides, ValibotLikeSchema, ZodLikeSchema } from '../composables/useFormKitAutoForm.js';
|
|
4
3
|
declare var __VLS_10: string, __VLS_11: any;
|
|
@@ -7,7 +6,7 @@ type __VLS_Slots = {} & {
|
|
|
7
6
|
};
|
|
8
7
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
8
|
data: {
|
|
10
|
-
type:
|
|
9
|
+
type: PropType<Record<string, unknown>>;
|
|
11
10
|
default: null;
|
|
12
11
|
};
|
|
13
12
|
overrides: {
|
|
@@ -23,13 +22,13 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
23
22
|
default: undefined;
|
|
24
23
|
};
|
|
25
24
|
modelValue: {
|
|
26
|
-
type: PropType<
|
|
25
|
+
type: PropType<Record<string, unknown>>;
|
|
27
26
|
};
|
|
28
27
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
|
-
"update:modelValue": (value:
|
|
28
|
+
"update:modelValue": (value: Record<string, unknown> | undefined) => any;
|
|
30
29
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
30
|
data: {
|
|
32
|
-
type:
|
|
31
|
+
type: PropType<Record<string, unknown>>;
|
|
33
32
|
default: null;
|
|
34
33
|
};
|
|
35
34
|
overrides: {
|
|
@@ -45,12 +44,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
45
44
|
default: undefined;
|
|
46
45
|
};
|
|
47
46
|
modelValue: {
|
|
48
|
-
type: PropType<
|
|
47
|
+
type: PropType<Record<string, unknown>>;
|
|
49
48
|
};
|
|
50
49
|
}>> & Readonly<{
|
|
51
|
-
"onUpdate:modelValue"?: ((value:
|
|
50
|
+
"onUpdate:modelValue"?: ((value: Record<string, unknown> | undefined) => any) | undefined;
|
|
52
51
|
}>, {
|
|
53
|
-
data: Record<string,
|
|
52
|
+
data: Record<string, unknown>;
|
|
54
53
|
overrides: AutoFormOverrides;
|
|
55
54
|
valibotSchema: ValibotLikeSchema;
|
|
56
55
|
zodSchema: ZodLikeSchema;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { AutoFormOverrides, ValibotLikeSchema, ZodLikeSchema } from '../composables/useFormKitAutoForm.js';
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
id: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
data: {
|
|
9
|
+
type: ObjectConstructor;
|
|
10
|
+
default: null;
|
|
11
|
+
};
|
|
12
|
+
valibotSchema: {
|
|
13
|
+
type: PropType<ValibotLikeSchema>;
|
|
14
|
+
default: undefined;
|
|
15
|
+
};
|
|
16
|
+
zodSchema: {
|
|
17
|
+
type: PropType<ZodLikeSchema>;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
overrides: {
|
|
21
|
+
type: PropType<AutoFormOverrides>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
title: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
28
|
+
as: {
|
|
29
|
+
type: PropType<"modal" | "slideover">;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
open: {
|
|
33
|
+
type: PropType<boolean>;
|
|
34
|
+
};
|
|
35
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
close: (value: unknown) => any;
|
|
37
|
+
"update:open": (value: boolean) => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
39
|
+
id: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
required: true;
|
|
42
|
+
};
|
|
43
|
+
data: {
|
|
44
|
+
type: ObjectConstructor;
|
|
45
|
+
default: null;
|
|
46
|
+
};
|
|
47
|
+
valibotSchema: {
|
|
48
|
+
type: PropType<ValibotLikeSchema>;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
zodSchema: {
|
|
52
|
+
type: PropType<ZodLikeSchema>;
|
|
53
|
+
default: undefined;
|
|
54
|
+
};
|
|
55
|
+
overrides: {
|
|
56
|
+
type: PropType<AutoFormOverrides>;
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
title: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
as: {
|
|
64
|
+
type: PropType<"modal" | "slideover">;
|
|
65
|
+
default: string;
|
|
66
|
+
};
|
|
67
|
+
open: {
|
|
68
|
+
type: PropType<boolean>;
|
|
69
|
+
};
|
|
70
|
+
}>> & Readonly<{
|
|
71
|
+
onClose?: ((value: unknown) => any) | undefined;
|
|
72
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
73
|
+
}>, {
|
|
74
|
+
data: Record<string, any>;
|
|
75
|
+
title: string;
|
|
76
|
+
as: "modal" | "slideover";
|
|
77
|
+
overrides: AutoFormOverrides;
|
|
78
|
+
valibotSchema: ValibotLikeSchema;
|
|
79
|
+
zodSchema: ZodLikeSchema;
|
|
80
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
81
|
+
declare const _default: typeof __VLS_export;
|
|
82
|
+
export default _default;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useOverlayCloseResolution } from "../utils/useOverlayCloseResolution";
|
|
3
|
+
import FUAutoForm from "./FUAutoForm.vue";
|
|
4
|
+
defineProps({
|
|
5
|
+
id: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
data: {
|
|
10
|
+
type: Object,
|
|
11
|
+
default: null
|
|
12
|
+
},
|
|
13
|
+
valibotSchema: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: void 0
|
|
16
|
+
},
|
|
17
|
+
zodSchema: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: void 0
|
|
20
|
+
},
|
|
21
|
+
overrides: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: void 0
|
|
24
|
+
},
|
|
25
|
+
title: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: void 0
|
|
28
|
+
},
|
|
29
|
+
as: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "modal"
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const emit = defineEmits(["close"]);
|
|
35
|
+
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
36
|
+
const { resolveOnce } = useOverlayCloseResolution(open, emit);
|
|
37
|
+
function handleSaved(savedData) {
|
|
38
|
+
resolveOnce(savedData);
|
|
39
|
+
}
|
|
40
|
+
function handleCancel() {
|
|
41
|
+
resolveOnce(null);
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<UModal
|
|
47
|
+
v-if="as === 'modal'"
|
|
48
|
+
v-model:open="open"
|
|
49
|
+
:title="title"
|
|
50
|
+
>
|
|
51
|
+
<template #body>
|
|
52
|
+
<FUAutoForm
|
|
53
|
+
:id="id"
|
|
54
|
+
:data="data"
|
|
55
|
+
:valibot-schema="valibotSchema"
|
|
56
|
+
:zod-schema="zodSchema"
|
|
57
|
+
:overrides="overrides"
|
|
58
|
+
@data-saved="handleSaved"
|
|
59
|
+
>
|
|
60
|
+
<template #submit>
|
|
61
|
+
<UButton
|
|
62
|
+
type="submit"
|
|
63
|
+
label="Save"
|
|
64
|
+
/>
|
|
65
|
+
<UButton
|
|
66
|
+
type="button"
|
|
67
|
+
label="Cancel"
|
|
68
|
+
color="neutral"
|
|
69
|
+
variant="outline"
|
|
70
|
+
@click="handleCancel"
|
|
71
|
+
/>
|
|
72
|
+
</template>
|
|
73
|
+
</FUAutoForm>
|
|
74
|
+
</template>
|
|
75
|
+
</UModal>
|
|
76
|
+
<USlideover
|
|
77
|
+
v-else
|
|
78
|
+
v-model:open="open"
|
|
79
|
+
:title="title"
|
|
80
|
+
>
|
|
81
|
+
<template #body>
|
|
82
|
+
<FUAutoForm
|
|
83
|
+
:id="id"
|
|
84
|
+
:data="data"
|
|
85
|
+
:valibot-schema="valibotSchema"
|
|
86
|
+
:zod-schema="zodSchema"
|
|
87
|
+
:overrides="overrides"
|
|
88
|
+
@data-saved="handleSaved"
|
|
89
|
+
>
|
|
90
|
+
<template #submit>
|
|
91
|
+
<UButton
|
|
92
|
+
type="submit"
|
|
93
|
+
label="Save"
|
|
94
|
+
/>
|
|
95
|
+
<UButton
|
|
96
|
+
type="button"
|
|
97
|
+
label="Cancel"
|
|
98
|
+
color="neutral"
|
|
99
|
+
variant="outline"
|
|
100
|
+
@click="handleCancel"
|
|
101
|
+
/>
|
|
102
|
+
</template>
|
|
103
|
+
</FUAutoForm>
|
|
104
|
+
</template>
|
|
105
|
+
</USlideover>
|
|
106
|
+
</template>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { AutoFormOverrides, ValibotLikeSchema, ZodLikeSchema } from '../composables/useFormKitAutoForm.js';
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
id: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
data: {
|
|
9
|
+
type: ObjectConstructor;
|
|
10
|
+
default: null;
|
|
11
|
+
};
|
|
12
|
+
valibotSchema: {
|
|
13
|
+
type: PropType<ValibotLikeSchema>;
|
|
14
|
+
default: undefined;
|
|
15
|
+
};
|
|
16
|
+
zodSchema: {
|
|
17
|
+
type: PropType<ZodLikeSchema>;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
overrides: {
|
|
21
|
+
type: PropType<AutoFormOverrides>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
title: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
28
|
+
as: {
|
|
29
|
+
type: PropType<"modal" | "slideover">;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
open: {
|
|
33
|
+
type: PropType<boolean>;
|
|
34
|
+
};
|
|
35
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
close: (value: unknown) => any;
|
|
37
|
+
"update:open": (value: boolean) => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
39
|
+
id: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
required: true;
|
|
42
|
+
};
|
|
43
|
+
data: {
|
|
44
|
+
type: ObjectConstructor;
|
|
45
|
+
default: null;
|
|
46
|
+
};
|
|
47
|
+
valibotSchema: {
|
|
48
|
+
type: PropType<ValibotLikeSchema>;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
zodSchema: {
|
|
52
|
+
type: PropType<ZodLikeSchema>;
|
|
53
|
+
default: undefined;
|
|
54
|
+
};
|
|
55
|
+
overrides: {
|
|
56
|
+
type: PropType<AutoFormOverrides>;
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
title: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
as: {
|
|
64
|
+
type: PropType<"modal" | "slideover">;
|
|
65
|
+
default: string;
|
|
66
|
+
};
|
|
67
|
+
open: {
|
|
68
|
+
type: PropType<boolean>;
|
|
69
|
+
};
|
|
70
|
+
}>> & Readonly<{
|
|
71
|
+
onClose?: ((value: unknown) => any) | undefined;
|
|
72
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
73
|
+
}>, {
|
|
74
|
+
data: Record<string, any>;
|
|
75
|
+
title: string;
|
|
76
|
+
as: "modal" | "slideover";
|
|
77
|
+
overrides: AutoFormOverrides;
|
|
78
|
+
valibotSchema: ValibotLikeSchema;
|
|
79
|
+
zodSchema: ZodLikeSchema;
|
|
80
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
81
|
+
declare const _default: typeof __VLS_export;
|
|
82
|
+
export default _default;
|
|
@@ -15,7 +15,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
15
15
|
default: string;
|
|
16
16
|
};
|
|
17
17
|
data: {
|
|
18
|
-
type:
|
|
18
|
+
type: PropType<Record<string, unknown>>;
|
|
19
19
|
default: null;
|
|
20
20
|
};
|
|
21
21
|
schema: {
|
|
@@ -79,17 +79,17 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
79
79
|
default: boolean;
|
|
80
80
|
};
|
|
81
81
|
modelValue: {
|
|
82
|
-
type: PropType<
|
|
82
|
+
type: PropType<Record<string, unknown>>;
|
|
83
83
|
};
|
|
84
84
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
85
|
-
"update:modelValue": (value:
|
|
85
|
+
"update:modelValue": (value: Record<string, unknown> | undefined) => any;
|
|
86
86
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
87
87
|
id: {
|
|
88
88
|
type: StringConstructor;
|
|
89
89
|
default: string;
|
|
90
90
|
};
|
|
91
91
|
data: {
|
|
92
|
-
type:
|
|
92
|
+
type: PropType<Record<string, unknown>>;
|
|
93
93
|
default: null;
|
|
94
94
|
};
|
|
95
95
|
schema: {
|
|
@@ -153,13 +153,13 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
153
153
|
default: boolean;
|
|
154
154
|
};
|
|
155
155
|
modelValue: {
|
|
156
|
-
type: PropType<
|
|
156
|
+
type: PropType<Record<string, unknown>>;
|
|
157
157
|
};
|
|
158
158
|
}>> & Readonly<{
|
|
159
|
-
"onUpdate:modelValue"?: ((value:
|
|
159
|
+
"onUpdate:modelValue"?: ((value: Record<string, unknown> | undefined) => any) | undefined;
|
|
160
160
|
}>, {
|
|
161
161
|
schema: FormKitSchemaDefinition;
|
|
162
|
-
data: Record<string,
|
|
162
|
+
data: Record<string, unknown>;
|
|
163
163
|
id: string;
|
|
164
164
|
standardSchema: StandardSchemaV1<unknown, unknown>;
|
|
165
165
|
formClass: string;
|
|
@@ -82,7 +82,7 @@ useFormKitContextById(props.id, (context) => {
|
|
|
82
82
|
});
|
|
83
83
|
onScopeDispose(() => detachStandardSchema?.());
|
|
84
84
|
const formSchema = ref(props.schema);
|
|
85
|
-
const formData = defineModel({ type:
|
|
85
|
+
const formData = defineModel({ type: Object });
|
|
86
86
|
watch(() => props.schema, (newSchema) => {
|
|
87
87
|
formSchema.value = newSchema;
|
|
88
88
|
}, { deep: true });
|
|
@@ -95,7 +95,8 @@ if (props.data) {
|
|
|
95
95
|
formData.value = props.data;
|
|
96
96
|
}
|
|
97
97
|
function handleSave() {
|
|
98
|
-
|
|
98
|
+
const { slots: _slots, ...data } = formData.value ?? {};
|
|
99
|
+
emit("dataSaved", data);
|
|
99
100
|
}
|
|
100
101
|
function handleReset() {
|
|
101
102
|
reset(props.id);
|
|
@@ -15,7 +15,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
15
15
|
default: string;
|
|
16
16
|
};
|
|
17
17
|
data: {
|
|
18
|
-
type:
|
|
18
|
+
type: PropType<Record<string, unknown>>;
|
|
19
19
|
default: null;
|
|
20
20
|
};
|
|
21
21
|
schema: {
|
|
@@ -79,17 +79,17 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
79
79
|
default: boolean;
|
|
80
80
|
};
|
|
81
81
|
modelValue: {
|
|
82
|
-
type: PropType<
|
|
82
|
+
type: PropType<Record<string, unknown>>;
|
|
83
83
|
};
|
|
84
84
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
85
|
-
"update:modelValue": (value:
|
|
85
|
+
"update:modelValue": (value: Record<string, unknown> | undefined) => any;
|
|
86
86
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
87
87
|
id: {
|
|
88
88
|
type: StringConstructor;
|
|
89
89
|
default: string;
|
|
90
90
|
};
|
|
91
91
|
data: {
|
|
92
|
-
type:
|
|
92
|
+
type: PropType<Record<string, unknown>>;
|
|
93
93
|
default: null;
|
|
94
94
|
};
|
|
95
95
|
schema: {
|
|
@@ -153,13 +153,13 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
153
153
|
default: boolean;
|
|
154
154
|
};
|
|
155
155
|
modelValue: {
|
|
156
|
-
type: PropType<
|
|
156
|
+
type: PropType<Record<string, unknown>>;
|
|
157
157
|
};
|
|
158
158
|
}>> & Readonly<{
|
|
159
|
-
"onUpdate:modelValue"?: ((value:
|
|
159
|
+
"onUpdate:modelValue"?: ((value: Record<string, unknown> | undefined) => any) | undefined;
|
|
160
160
|
}>, {
|
|
161
161
|
schema: FormKitSchemaDefinition;
|
|
162
|
-
data: Record<string,
|
|
162
|
+
data: Record<string, unknown>;
|
|
163
163
|
id: string;
|
|
164
164
|
standardSchema: StandardSchemaV1<unknown, unknown>;
|
|
165
165
|
formClass: string;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
id: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
data: {
|
|
9
|
+
type: ObjectConstructor;
|
|
10
|
+
default: null;
|
|
11
|
+
};
|
|
12
|
+
schema: {
|
|
13
|
+
type: PropType<FormKitSchemaDefinition>;
|
|
14
|
+
default: null;
|
|
15
|
+
};
|
|
16
|
+
title: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
as: {
|
|
21
|
+
type: PropType<"modal" | "slideover">;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
open: {
|
|
25
|
+
type: PropType<boolean>;
|
|
26
|
+
};
|
|
27
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
+
close: (value: unknown) => any;
|
|
29
|
+
"update:open": (value: boolean) => any;
|
|
30
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
|
+
id: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
data: {
|
|
36
|
+
type: ObjectConstructor;
|
|
37
|
+
default: null;
|
|
38
|
+
};
|
|
39
|
+
schema: {
|
|
40
|
+
type: PropType<FormKitSchemaDefinition>;
|
|
41
|
+
default: null;
|
|
42
|
+
};
|
|
43
|
+
title: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
as: {
|
|
48
|
+
type: PropType<"modal" | "slideover">;
|
|
49
|
+
default: string;
|
|
50
|
+
};
|
|
51
|
+
open: {
|
|
52
|
+
type: PropType<boolean>;
|
|
53
|
+
};
|
|
54
|
+
}>> & Readonly<{
|
|
55
|
+
onClose?: ((value: unknown) => any) | undefined;
|
|
56
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
57
|
+
}>, {
|
|
58
|
+
schema: FormKitSchemaDefinition;
|
|
59
|
+
data: Record<string, any>;
|
|
60
|
+
title: string;
|
|
61
|
+
as: "modal" | "slideover";
|
|
62
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
63
|
+
declare const _default: typeof __VLS_export;
|
|
64
|
+
export default _default;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useOverlayCloseResolution } from "../utils/useOverlayCloseResolution";
|
|
3
|
+
import FUDataEdit from "./FUDataEdit.vue";
|
|
4
|
+
defineProps({
|
|
5
|
+
id: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
data: {
|
|
10
|
+
type: Object,
|
|
11
|
+
default: null
|
|
12
|
+
},
|
|
13
|
+
schema: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: null
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: void 0
|
|
20
|
+
},
|
|
21
|
+
as: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "modal"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const emit = defineEmits(["close"]);
|
|
27
|
+
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
28
|
+
const { resolveOnce } = useOverlayCloseResolution(open, emit);
|
|
29
|
+
function handleSaved(savedData) {
|
|
30
|
+
resolveOnce(savedData);
|
|
31
|
+
}
|
|
32
|
+
function handleCancel() {
|
|
33
|
+
resolveOnce(null);
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<UModal
|
|
39
|
+
v-if="as === 'modal'"
|
|
40
|
+
v-model:open="open"
|
|
41
|
+
:title="title"
|
|
42
|
+
>
|
|
43
|
+
<template #body>
|
|
44
|
+
<FUDataEdit
|
|
45
|
+
:id="id"
|
|
46
|
+
:data="data"
|
|
47
|
+
:schema="schema"
|
|
48
|
+
@data-saved="handleSaved"
|
|
49
|
+
>
|
|
50
|
+
<template #submit>
|
|
51
|
+
<UButton
|
|
52
|
+
type="submit"
|
|
53
|
+
label="Save"
|
|
54
|
+
/>
|
|
55
|
+
<UButton
|
|
56
|
+
type="button"
|
|
57
|
+
label="Cancel"
|
|
58
|
+
color="neutral"
|
|
59
|
+
variant="outline"
|
|
60
|
+
@click="handleCancel"
|
|
61
|
+
/>
|
|
62
|
+
</template>
|
|
63
|
+
</FUDataEdit>
|
|
64
|
+
</template>
|
|
65
|
+
</UModal>
|
|
66
|
+
<USlideover
|
|
67
|
+
v-else
|
|
68
|
+
v-model:open="open"
|
|
69
|
+
:title="title"
|
|
70
|
+
>
|
|
71
|
+
<template #body>
|
|
72
|
+
<FUDataEdit
|
|
73
|
+
:id="id"
|
|
74
|
+
:data="data"
|
|
75
|
+
:schema="schema"
|
|
76
|
+
@data-saved="handleSaved"
|
|
77
|
+
>
|
|
78
|
+
<template #submit>
|
|
79
|
+
<UButton
|
|
80
|
+
type="submit"
|
|
81
|
+
label="Save"
|
|
82
|
+
/>
|
|
83
|
+
<UButton
|
|
84
|
+
type="button"
|
|
85
|
+
label="Cancel"
|
|
86
|
+
color="neutral"
|
|
87
|
+
variant="outline"
|
|
88
|
+
@click="handleCancel"
|
|
89
|
+
/>
|
|
90
|
+
</template>
|
|
91
|
+
</FUDataEdit>
|
|
92
|
+
</template>
|
|
93
|
+
</USlideover>
|
|
94
|
+
</template>
|