@sfxcode/nuxt-ui-formkit 1.2.2 → 1.2.4
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 +7 -0
- package/dist/module.json +1 -1
- 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 +10 -0
- package/dist/runtime/components/FUDataEdit.vue +15 -3
- package/dist/runtime/components/FUDataEdit.vue.d.ts +10 -0
- 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/inputs/FUCalendar.vue +3 -0
- package/dist/runtime/components/inputs/FUCheckbox.vue +2 -1
- package/dist/runtime/components/inputs/FUCheckboxGroup.vue +3 -0
- package/dist/runtime/components/inputs/FUEditor.vue +58 -54
- package/dist/runtime/components/inputs/FUFileUpload.vue +2 -1
- package/dist/runtime/components/inputs/FUInput.vue +2 -1
- package/dist/runtime/components/inputs/FUInputDate.vue +5 -1
- package/dist/runtime/components/inputs/FUInputMenu.vue +2 -1
- package/dist/runtime/components/inputs/FUInputNumber.vue +2 -1
- package/dist/runtime/components/inputs/FUInputTags.vue +2 -1
- package/dist/runtime/components/inputs/FUInputTime.vue +5 -1
- package/dist/runtime/components/inputs/FUListbox.vue +4 -0
- package/dist/runtime/components/inputs/FUPinInput.vue +8 -1
- package/dist/runtime/components/inputs/FURadioGroup.vue +3 -0
- package/dist/runtime/components/inputs/FUSwitch.vue +2 -1
- package/dist/runtime/components/inputs/FUTextarea.vue +2 -1
- package/dist/runtime/composables/useFormKitForm.d.ts +5 -1
- package/dist/runtime/composables/useFormKitForm.js +9 -3
- package/dist/runtime/composables/useFormKitOverlay.d.ts +20 -0
- package/dist/runtime/composables/useFormKitOverlay.js +42 -0
- package/dist/runtime/composables/useFormKitStandardSchema.d.ts +20 -0
- package/dist/runtime/composables/useFormKitStandardSchema.js +68 -0
- package/dist/runtime/utils/standardSchemaErrors.d.ts +14 -0
- package/dist/runtime/utils/standardSchemaErrors.js +15 -0
- package/dist/runtime/utils/useFormKitContainerBlur.d.ts +37 -0
- package/dist/runtime/utils/useFormKitContainerBlur.js +9 -0
- package/dist/runtime/utils/useOverlayCloseResolution.d.ts +20 -0
- package/dist/runtime/utils/useOverlayCloseResolution.js +17 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -61,6 +61,9 @@ FormKit Nuxt UI bridges the gap between [FormKit](https://formkit.com/)'s powerf
|
|
|
61
61
|
- `FUDataDebug` - Development tool for form debugging
|
|
62
62
|
- `FUAutoForm` - Schema-free forms: inputs inferred from your data's value shapes, or a Valibot/Zod schema, with an override map for fine-tuning
|
|
63
63
|
|
|
64
|
+
🛡️ **Standard Schema Validation** - Validate against Zod/Valibot/ArkType instead of hand-written validation strings
|
|
65
|
+
- `FUDataEdit`'s `standardSchema` prop, or `useFormKitForm`'s `standardSchema` option - errors land on the exact field (including inside a repeater row), respecting each field's own validation-visibility timing
|
|
66
|
+
|
|
64
67
|
⚙️ **Config Helper** - One-line `formkit.config.ts` setup
|
|
65
68
|
- `createNuxtUiFormkitConfig` - Assembles all `nuxtUIXxx` inputs/outputs and this module's plugins into `{ inputs, plugins }` you spread into your own config
|
|
66
69
|
|
|
@@ -72,6 +75,7 @@ FormKit Nuxt UI bridges the gap between [FormKit](https://formkit.com/)'s powerf
|
|
|
72
75
|
- `useFormKitMultiStep` - Multi-step tab-item mapping and navigation bridging
|
|
73
76
|
- `useFormKitForm` - Submit/reset/error-management wrapper for a form's imperative APIs, callable from outside the form
|
|
74
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
|
|
75
79
|
- `colorConverter` - Color format conversion utilities
|
|
76
80
|
- `durationConverter` - Duration format conversion utilities
|
|
77
81
|
|
|
@@ -339,6 +343,9 @@ The playground includes comprehensive examples for all components:
|
|
|
339
343
|
### Form Composable
|
|
340
344
|
- [useFormKitForm](./playground/app/pages/form/form-composable.vue)
|
|
341
345
|
|
|
346
|
+
### Standard Schema Validation
|
|
347
|
+
- [Standard Schema Validation](./playground/app/pages/form/standard-schema.vue)
|
|
348
|
+
|
|
342
349
|
## Development
|
|
343
350
|
|
|
344
351
|
<details>
|
package/dist/module.json
CHANGED
|
@@ -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
|
+
overrides: AutoFormOverrides;
|
|
77
|
+
valibotSchema: ValibotLikeSchema;
|
|
78
|
+
zodSchema: ZodLikeSchema;
|
|
79
|
+
as: "modal" | "slideover";
|
|
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
|
+
overrides: AutoFormOverrides;
|
|
77
|
+
valibotSchema: ValibotLikeSchema;
|
|
78
|
+
zodSchema: ZodLikeSchema;
|
|
79
|
+
as: "modal" | "slideover";
|
|
80
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
81
|
+
declare const _default: typeof __VLS_export;
|
|
82
|
+
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
2
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
3
|
import type { PropType } from 'vue';
|
|
3
4
|
declare var __VLS_15: {}, __VLS_18: {}, __VLS_26: {};
|
|
4
5
|
type __VLS_Slots = {} & {
|
|
@@ -21,6 +22,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
21
22
|
type: PropType<FormKitSchemaDefinition>;
|
|
22
23
|
default: null;
|
|
23
24
|
};
|
|
25
|
+
standardSchema: {
|
|
26
|
+
type: PropType<StandardSchemaV1>;
|
|
27
|
+
default: null;
|
|
28
|
+
};
|
|
24
29
|
formClass: {
|
|
25
30
|
type: StringConstructor;
|
|
26
31
|
default: string;
|
|
@@ -91,6 +96,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
91
96
|
type: PropType<FormKitSchemaDefinition>;
|
|
92
97
|
default: null;
|
|
93
98
|
};
|
|
99
|
+
standardSchema: {
|
|
100
|
+
type: PropType<StandardSchemaV1>;
|
|
101
|
+
default: null;
|
|
102
|
+
};
|
|
94
103
|
formClass: {
|
|
95
104
|
type: StringConstructor;
|
|
96
105
|
default: string;
|
|
@@ -152,6 +161,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
152
161
|
schema: FormKitSchemaDefinition;
|
|
153
162
|
data: Record<string, any>;
|
|
154
163
|
id: string;
|
|
164
|
+
standardSchema: StandardSchemaV1<unknown, unknown>;
|
|
155
165
|
formClass: string;
|
|
156
166
|
actionsClass: string;
|
|
157
167
|
submitSeverity: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { reset } from "@formkit/core";
|
|
3
|
-
import { FormKit, FormKitMessages, FormKitSchema } from "@formkit/vue";
|
|
4
|
-
import { ref, watch } from "vue";
|
|
3
|
+
import { FormKit, FormKitMessages, FormKitSchema, useFormKitContextById } from "@formkit/vue";
|
|
4
|
+
import { onScopeDispose, ref, watch } from "vue";
|
|
5
|
+
import { attachStandardSchema } from "../composables/useFormKitStandardSchema";
|
|
5
6
|
import FUDataDebug from "./FUDataDebug.vue";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
id: {
|
|
@@ -16,6 +17,10 @@ const props = defineProps({
|
|
|
16
17
|
type: Object,
|
|
17
18
|
default: null
|
|
18
19
|
},
|
|
20
|
+
standardSchema: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: null
|
|
23
|
+
},
|
|
19
24
|
formClass: {
|
|
20
25
|
type: String,
|
|
21
26
|
default: ""
|
|
@@ -70,6 +75,12 @@ const props = defineProps({
|
|
|
70
75
|
}
|
|
71
76
|
});
|
|
72
77
|
const emit = defineEmits(["dataSaved", "onReset"]);
|
|
78
|
+
let detachStandardSchema;
|
|
79
|
+
useFormKitContextById(props.id, (context) => {
|
|
80
|
+
if (props.standardSchema)
|
|
81
|
+
detachStandardSchema = attachStandardSchema(context.node, props.standardSchema);
|
|
82
|
+
});
|
|
83
|
+
onScopeDispose(() => detachStandardSchema?.());
|
|
73
84
|
const formSchema = ref(props.schema);
|
|
74
85
|
const formData = defineModel({ type: [Object, String, Array] });
|
|
75
86
|
watch(() => props.schema, (newSchema) => {
|
|
@@ -84,7 +95,8 @@ if (props.data) {
|
|
|
84
95
|
formData.value = props.data;
|
|
85
96
|
}
|
|
86
97
|
function handleSave() {
|
|
87
|
-
|
|
98
|
+
const { slots: _slots, ...data } = formData.value ?? {};
|
|
99
|
+
emit("dataSaved", data);
|
|
88
100
|
}
|
|
89
101
|
function handleReset() {
|
|
90
102
|
reset(props.id);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
2
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
3
|
import type { PropType } from 'vue';
|
|
3
4
|
declare var __VLS_15: {}, __VLS_18: {}, __VLS_26: {};
|
|
4
5
|
type __VLS_Slots = {} & {
|
|
@@ -21,6 +22,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
21
22
|
type: PropType<FormKitSchemaDefinition>;
|
|
22
23
|
default: null;
|
|
23
24
|
};
|
|
25
|
+
standardSchema: {
|
|
26
|
+
type: PropType<StandardSchemaV1>;
|
|
27
|
+
default: null;
|
|
28
|
+
};
|
|
24
29
|
formClass: {
|
|
25
30
|
type: StringConstructor;
|
|
26
31
|
default: string;
|
|
@@ -91,6 +96,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
91
96
|
type: PropType<FormKitSchemaDefinition>;
|
|
92
97
|
default: null;
|
|
93
98
|
};
|
|
99
|
+
standardSchema: {
|
|
100
|
+
type: PropType<StandardSchemaV1>;
|
|
101
|
+
default: null;
|
|
102
|
+
};
|
|
94
103
|
formClass: {
|
|
95
104
|
type: StringConstructor;
|
|
96
105
|
default: string;
|
|
@@ -152,6 +161,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
152
161
|
schema: FormKitSchemaDefinition;
|
|
153
162
|
data: Record<string, any>;
|
|
154
163
|
id: string;
|
|
164
|
+
standardSchema: StandardSchemaV1<unknown, unknown>;
|
|
155
165
|
formClass: string;
|
|
156
166
|
actionsClass: string;
|
|
157
167
|
submitSeverity: 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>
|
|
@@ -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;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { useFormKitInput } from "../../utils/useFormKitInput";
|
|
4
|
+
import { createContainerBlurHandler } from "../../utils/useFormKitContainerBlur";
|
|
4
5
|
import { toDateValue, toDateValueOrRangeOrArray, fromDateValueOrRangeOrArray } from "../../utils/dateValueConversion";
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
context: {
|
|
@@ -9,6 +10,7 @@ const props = defineProps({
|
|
|
9
10
|
}
|
|
10
11
|
});
|
|
11
12
|
const { handleInput, styleClass, color, validSlotNames } = useFormKitInput(props.context);
|
|
13
|
+
const handleContainerBlur = createContainerBlurHandler(props.context);
|
|
12
14
|
const conversionOptions = computed(() => ({ timeZone: props.context.timeZone }));
|
|
13
15
|
const modelValue = computed({
|
|
14
16
|
get: () => toDateValueOrRangeOrArray(props.context._value, conversionOptions.value),
|
|
@@ -46,6 +48,7 @@ const maxValue = computed(() => toDateValue(props.context.maxValue, conversionOp
|
|
|
46
48
|
:is-date-unavailable="context.isDateUnavailable"
|
|
47
49
|
:ui="context.ui"
|
|
48
50
|
@update:model-value="handleInput"
|
|
51
|
+
@focusout="handleContainerBlur"
|
|
49
52
|
>
|
|
50
53
|
<template
|
|
51
54
|
v-for="slotName in validSlotNames"
|
|
@@ -6,7 +6,7 @@ const props = defineProps({
|
|
|
6
6
|
required: true
|
|
7
7
|
}
|
|
8
8
|
});
|
|
9
|
-
const { handleInput, handleChange, styleClass, modelValue, color, validSlotNames } = useFormKitInput(props.context);
|
|
9
|
+
const { handleInput, handleChange, handleBlur, styleClass, modelValue, color, validSlotNames } = useFormKitInput(props.context);
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<template>
|
|
@@ -31,6 +31,7 @@ const { handleInput, handleChange, styleClass, modelValue, color, validSlotNames
|
|
|
31
31
|
:ui="context.ui"
|
|
32
32
|
@change="handleChange"
|
|
33
33
|
@update:model-value="handleInput"
|
|
34
|
+
@blur="handleBlur"
|
|
34
35
|
>
|
|
35
36
|
<template
|
|
36
37
|
v-for="slotName in validSlotNames"
|