una-nuxt-module 2.1.4 → 2.1.6
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/module.mjs +8 -1
- package/dist/runtime/components/shared/AppBreadcumbs.vue +33 -0
- package/dist/runtime/components/shared/AppBreadcumbs.vue.d.ts +2 -0
- package/dist/runtime/components/shared/ColorModeSelect.vue +64 -0
- package/dist/runtime/components/shared/ColorModeSelect.vue.d.ts +2 -0
- package/dist/runtime/components/ui/alert-dialog/AlertDialogAction.vue +1 -1
- package/dist/runtime/components/ui/alert-dialog/AlertDialogCancel.vue +1 -1
- package/dist/runtime/components/ui/auto-form/AutoForm.vue +8 -6
- package/dist/runtime/components/ui/auto-form/AutoForm.vue.d.ts +4 -4
- package/dist/runtime/components/ui/auto-form/AutoFormFieldArray.vue +21 -8
- package/dist/runtime/components/ui/auto-form/AutoFormFieldBoolean.vue +18 -6
- package/dist/runtime/components/ui/auto-form/AutoFormFieldBoolean.vue.d.ts +1 -1
- package/dist/runtime/components/ui/auto-form/AutoFormFieldDate.vue +4 -8
- package/dist/runtime/components/ui/auto-form/AutoFormFieldEnum.vue +44 -9
- package/dist/runtime/components/ui/auto-form/AutoFormFieldEnum.vue.d.ts +1 -1
- package/dist/runtime/components/ui/auto-form/AutoFormFieldFile.vue +27 -14
- package/dist/runtime/components/ui/auto-form/AutoFormFieldFile.vue.d.ts +1 -1
- package/dist/runtime/components/ui/auto-form/AutoFormFieldInput.vue +12 -4
- package/dist/runtime/components/ui/auto-form/AutoFormFieldInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/auto-form/AutoFormFieldNumber.vue +13 -3
- package/dist/runtime/components/ui/auto-form/AutoFormFieldNumber.vue.d.ts +1 -1
- package/dist/runtime/components/ui/auto-form/AutoFormFieldObject.vue +22 -8
- package/dist/runtime/components/ui/auto-form/AutoFormLabel.vue +1 -1
- package/dist/runtime/components/ui/button/index.d.ts +1 -1
- package/dist/runtime/components/ui/calendar/CalendarCellTrigger.vue +1 -1
- package/dist/runtime/components/ui/calendar/CalendarNextButton.vue +1 -1
- package/dist/runtime/components/ui/calendar/CalendarPrevButton.vue +1 -1
- package/dist/runtime/components/ui/carousel/CarouselNext.vue +1 -3
- package/dist/runtime/components/ui/carousel/CarouselNext.vue.d.ts +2 -2
- package/dist/runtime/components/ui/carousel/CarouselPrevious.vue +1 -3
- package/dist/runtime/components/ui/carousel/CarouselPrevious.vue.d.ts +2 -2
- package/dist/runtime/components/ui/command/CommandDialog.vue +8 -2
- package/dist/runtime/components/ui/command/CommandDialog.vue.d.ts +2 -2
- package/dist/runtime/components/ui/form/FormLabel.vue +1 -1
- package/dist/runtime/components/ui/pagination/PaginationFirst.vue +1 -3
- package/dist/runtime/components/ui/pagination/PaginationFirst.vue.d.ts +1 -1
- package/dist/runtime/components/ui/pagination/PaginationItem.vue +1 -3
- package/dist/runtime/components/ui/pagination/PaginationItem.vue.d.ts +1 -1
- package/dist/runtime/components/ui/pagination/PaginationLast.vue +1 -3
- package/dist/runtime/components/ui/pagination/PaginationLast.vue.d.ts +1 -1
- package/dist/runtime/components/ui/pagination/PaginationNext.vue +1 -3
- package/dist/runtime/components/ui/pagination/PaginationNext.vue.d.ts +1 -1
- package/dist/runtime/components/ui/pagination/PaginationPrevious.vue +1 -3
- package/dist/runtime/components/ui/pagination/PaginationPrevious.vue.d.ts +1 -1
- package/dist/runtime/components/ui/range-calendar/RangeCalendarCellTrigger.vue +1 -1
- package/dist/runtime/components/ui/range-calendar/RangeCalendarNextButton.vue +1 -1
- package/dist/runtime/components/ui/range-calendar/RangeCalendarPrevButton.vue +1 -1
- package/dist/runtime/components/ui/sidebar/Sidebar.vue +4 -4
- package/dist/runtime/components/ui/sidebar/Sidebar.vue.d.ts +1 -1
- package/dist/runtime/components/ui/sidebar/SidebarInput.vue +1 -1
- package/dist/runtime/components/ui/sidebar/SidebarMenuButton.vue +7 -3
- package/dist/runtime/components/ui/sidebar/SidebarMenuButton.vue.d.ts +2 -2
- package/dist/runtime/components/ui/sidebar/SidebarMenuSkeleton.vue +1 -1
- package/dist/runtime/components/ui/sidebar/SidebarProvider.vue.d.ts +1 -1
- package/dist/runtime/components/ui/sidebar/SidebarSeparator.vue +1 -1
- package/dist/runtime/components/ui/sidebar/SidebarTrigger.vue +1 -1
- package/dist/runtime/components/ui/toggle/Toggle.vue.d.ts +1 -1
- package/dist/runtime/components/ui/toggle-group/ToggleGroup.vue.d.ts +1 -1
- package/dist/runtime/components/ui/toggle-group/ToggleGroupItem.vue +1 -1
- package/dist/runtime/components/ui/toggle-group/ToggleGroupItem.vue.d.ts +1 -1
- package/dist/runtime/composables/useBreadcumbs.d.ts +5 -0
- package/dist/runtime/composables/useBreadcumbs.js +11 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/middleware/authentication.js +4 -2
- package/dist/runtime/middleware/authorization.js +5 -4
- package/package.json +3 -3
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -112,7 +112,7 @@ function addTemplates() {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
const name = "una-nuxt-module";
|
|
115
|
-
const version = "2.1.
|
|
115
|
+
const version = "2.1.6";
|
|
116
116
|
|
|
117
117
|
const module = defineNuxtModule({
|
|
118
118
|
meta: {
|
|
@@ -186,6 +186,13 @@ const module = defineNuxtModule({
|
|
|
186
186
|
prepend: true
|
|
187
187
|
}
|
|
188
188
|
);
|
|
189
|
+
logger.success("Shadcn components added");
|
|
190
|
+
addComponentsDir({
|
|
191
|
+
path: resolve("./runtime/components/shared"),
|
|
192
|
+
prefix: "",
|
|
193
|
+
pathPrefix: false,
|
|
194
|
+
global: true
|
|
195
|
+
});
|
|
189
196
|
logger.success("Global components added");
|
|
190
197
|
}
|
|
191
198
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import {
|
|
3
|
+
Breadcrumb,
|
|
4
|
+
BreadcrumbItem,
|
|
5
|
+
BreadcrumbLink,
|
|
6
|
+
BreadcrumbList,
|
|
7
|
+
BreadcrumbPage,
|
|
8
|
+
BreadcrumbSeparator
|
|
9
|
+
} from "../ui/breadcrumb";
|
|
10
|
+
import { useBreadcumbs } from "../../composables/useBreadcumbs";
|
|
11
|
+
const { breadcrumbs } = useBreadcumbs();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<Breadcrumb>
|
|
16
|
+
<BreadcrumbList>
|
|
17
|
+
<template v-for="(breadcumb, index) in breadcrumbs" :key="index">
|
|
18
|
+
<BreadcrumbItem>
|
|
19
|
+
<BreadcrumbLink v-if="breadcumb.type === 'link'" as-child>
|
|
20
|
+
<NuxtLink :to="breadcumb.to"> {{ breadcumb.text }} </NuxtLink>
|
|
21
|
+
</BreadcrumbLink>
|
|
22
|
+
<BreadcrumbPage v-if="breadcumb.type === 'page'">
|
|
23
|
+
{{ breadcumb.text }}
|
|
24
|
+
</BreadcrumbPage>
|
|
25
|
+
</BreadcrumbItem>
|
|
26
|
+
<BreadcrumbSeparator
|
|
27
|
+
v-if="index < breadcrumbs.length - 1"
|
|
28
|
+
class="hidden md:block"
|
|
29
|
+
/>
|
|
30
|
+
</template>
|
|
31
|
+
</BreadcrumbList>
|
|
32
|
+
</Breadcrumb>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { onMounted, useColorMode } from "#imports";
|
|
3
|
+
import { Button } from "../ui/button";
|
|
4
|
+
import {
|
|
5
|
+
DropdownMenu,
|
|
6
|
+
DropdownMenuContent,
|
|
7
|
+
DropdownMenuItem,
|
|
8
|
+
DropdownMenuTrigger
|
|
9
|
+
} from "../ui/dropdown-menu";
|
|
10
|
+
import {
|
|
11
|
+
Tooltip,
|
|
12
|
+
TooltipContent,
|
|
13
|
+
TooltipProvider,
|
|
14
|
+
TooltipTrigger
|
|
15
|
+
} from "../ui/tooltip";
|
|
16
|
+
import { Check } from "lucide-vue-next";
|
|
17
|
+
const colorMode = useColorMode();
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
console.log("colorMode", colorMode.value);
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<TooltipProvider>
|
|
25
|
+
<Tooltip>
|
|
26
|
+
<TooltipTrigger>
|
|
27
|
+
<DropdownMenu>
|
|
28
|
+
<DropdownMenuTrigger as-child>
|
|
29
|
+
<Button variant="outline" size="icon">
|
|
30
|
+
<Icon
|
|
31
|
+
name="radix-icons:moon"
|
|
32
|
+
class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"
|
|
33
|
+
/>
|
|
34
|
+
<Icon
|
|
35
|
+
name="radix-icons:sun"
|
|
36
|
+
class="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"
|
|
37
|
+
/>
|
|
38
|
+
<span class="sr-only">Toggle theme</span>
|
|
39
|
+
</Button>
|
|
40
|
+
</DropdownMenuTrigger>
|
|
41
|
+
<DropdownMenuContent align="end">
|
|
42
|
+
<DropdownMenuItem @click="colorMode.preference = 'light'">
|
|
43
|
+
<Icon name="radix-icons:moon" />
|
|
44
|
+
Light
|
|
45
|
+
<Check v-if="colorMode.preference === 'light'" class="ml-auto" />
|
|
46
|
+
</DropdownMenuItem>
|
|
47
|
+
<DropdownMenuItem @click="colorMode.preference = 'dark'">
|
|
48
|
+
<Icon name="radix-icons:sun" />
|
|
49
|
+
Dark
|
|
50
|
+
<Check v-if="colorMode.preference === 'dark'" class="ml-auto" />
|
|
51
|
+
</DropdownMenuItem>
|
|
52
|
+
<DropdownMenuSeparator />
|
|
53
|
+
<DropdownMenuItem @click="colorMode.preference = 'system'">
|
|
54
|
+
<Icon name="radix-icons:desktop" />
|
|
55
|
+
System
|
|
56
|
+
<Check v-if="colorMode.preference === 'system'" class="ml-auto" />
|
|
57
|
+
</DropdownMenuItem>
|
|
58
|
+
</DropdownMenuContent>
|
|
59
|
+
</DropdownMenu>
|
|
60
|
+
</TooltipTrigger>
|
|
61
|
+
<TooltipContent>Theme</TooltipContent>
|
|
62
|
+
</Tooltip>
|
|
63
|
+
</TooltipProvider>
|
|
64
|
+
</template>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { reactiveOmit } from "@vueuse/core";
|
|
3
3
|
import { AlertDialogAction } from "reka-ui";
|
|
4
4
|
import { cn } from "../../../lib/utils";
|
|
5
|
-
import { buttonVariants } from "
|
|
5
|
+
import { buttonVariants } from "../button";
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
asChild: { type: Boolean, required: false },
|
|
8
8
|
as: { type: [String, Object, Function], required: false },
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { reactiveOmit } from "@vueuse/core";
|
|
3
3
|
import { AlertDialogCancel } from "reka-ui";
|
|
4
4
|
import { cn } from "../../../lib/utils";
|
|
5
|
-
import { buttonVariants } from "
|
|
5
|
+
import { buttonVariants } from "../button";
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
asChild: { type: Boolean, required: false },
|
|
8
8
|
as: { type: [String, Object, Function], required: false },
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { Form } from "
|
|
2
|
+
import { Form } from "../form";
|
|
3
3
|
import { toTypedSchema } from "@vee-validate/zod";
|
|
4
4
|
import { computed, toRefs } from "vue";
|
|
5
5
|
import AutoFormField from "./AutoFormField.vue";
|
|
6
6
|
import { provideDependencies } from "./dependencies";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
getBaseSchema,
|
|
9
|
+
getBaseType,
|
|
10
|
+
getDefaultValueInZodStack,
|
|
11
|
+
getObjectFormSchema
|
|
12
|
+
} from "./utils";
|
|
8
13
|
const props = defineProps({
|
|
9
14
|
schema: { type: null, required: true },
|
|
10
15
|
form: { type: Object, required: false },
|
|
@@ -64,10 +69,7 @@ const formComponentProps = computed(() => {
|
|
|
64
69
|
</script>
|
|
65
70
|
|
|
66
71
|
<template>
|
|
67
|
-
<component
|
|
68
|
-
:is="formComponent"
|
|
69
|
-
v-bind="formComponentProps"
|
|
70
|
-
>
|
|
72
|
+
<component :is="formComponent" v-bind="formComponentProps">
|
|
71
73
|
<slot name="customAutoForm" :fields="fields">
|
|
72
74
|
<template v-for="(shape, key) of shapes" :key="key">
|
|
73
75
|
<slot
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { FormContext, GenericObject } from
|
|
2
|
-
import type { z } from
|
|
3
|
-
import type { Config, ConfigItem, Dependency } from
|
|
4
|
-
import { type ZodObjectOrWrapped } from
|
|
1
|
+
import type { FormContext, GenericObject } from "vee-validate";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { Config, ConfigItem, Dependency } from "./interface.js";
|
|
4
|
+
import { type ZodObjectOrWrapped } from "./utils.js";
|
|
5
5
|
declare const _default: <T extends ZodObjectOrWrapped>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
6
6
|
props: __VLS_PrettifyLocal<any & {
|
|
7
7
|
schema: T;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import {
|
|
3
|
+
Accordion,
|
|
4
|
+
AccordionContent,
|
|
5
|
+
AccordionItem,
|
|
6
|
+
AccordionTrigger
|
|
7
|
+
} from "../accordion";
|
|
8
|
+
import { Button } from "../button";
|
|
9
|
+
import { FormItem, FormMessage } from "../form";
|
|
10
|
+
import { Separator } from "../separator";
|
|
6
11
|
import { PlusIcon, TrashIcon } from "lucide-vue-next";
|
|
7
12
|
import { FieldArray, FieldContextKey, useField } from "vee-validate";
|
|
8
13
|
import { computed, provide } from "vue";
|
|
@@ -24,9 +29,11 @@ function isZodDefault(item) {
|
|
|
24
29
|
return item instanceof z.ZodDefault;
|
|
25
30
|
}
|
|
26
31
|
const itemShape = computed(() => {
|
|
27
|
-
if (!props.schema)
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
if (!props.schema) return;
|
|
33
|
+
const schema = isZodArray(props.schema) ? props.schema._def.type : isZodDefault(props.schema) ? (
|
|
34
|
+
// @ts-expect-error missing schema
|
|
35
|
+
props.schema._def.innerType._def.type
|
|
36
|
+
) : null;
|
|
30
37
|
return {
|
|
31
38
|
type: getBaseType(schema),
|
|
32
39
|
schema
|
|
@@ -39,7 +46,13 @@ provide(FieldContextKey, fieldContext);
|
|
|
39
46
|
<template>
|
|
40
47
|
<FieldArray v-slot="{ fields, remove, push }" as="section" :name="fieldName">
|
|
41
48
|
<slot v-bind="props">
|
|
42
|
-
<Accordion
|
|
49
|
+
<Accordion
|
|
50
|
+
type="multiple"
|
|
51
|
+
class="w-full"
|
|
52
|
+
collapsible
|
|
53
|
+
:disabled="disabled"
|
|
54
|
+
as-child
|
|
55
|
+
>
|
|
43
56
|
<FormItem>
|
|
44
57
|
<AccordionItem :value="fieldName" class="border-none">
|
|
45
58
|
<AccordionTrigger>
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { Checkbox } from "
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { Checkbox } from "../checkbox";
|
|
3
|
+
import {
|
|
4
|
+
FormControl,
|
|
5
|
+
FormDescription,
|
|
6
|
+
FormField,
|
|
7
|
+
FormItem,
|
|
8
|
+
FormMessage
|
|
9
|
+
} from "../form";
|
|
10
|
+
import { Switch } from "../switch";
|
|
5
11
|
import { computed } from "vue";
|
|
6
12
|
import AutoFormLabel from "./AutoFormLabel.vue";
|
|
7
13
|
import { beautifyObjectName, maybeBooleanishToBoolean } from "./utils";
|
|
@@ -12,7 +18,9 @@ const props = defineProps({
|
|
|
12
18
|
config: { type: Object, required: false },
|
|
13
19
|
disabled: { type: Boolean, required: false }
|
|
14
20
|
});
|
|
15
|
-
const booleanComponent = computed(
|
|
21
|
+
const booleanComponent = computed(
|
|
22
|
+
() => props.config?.component === "switch" ? Switch : Checkbox
|
|
23
|
+
);
|
|
16
24
|
</script>
|
|
17
25
|
|
|
18
26
|
<template>
|
|
@@ -23,10 +31,14 @@ const booleanComponent = computed(() => props.config?.component === "switch" ? S
|
|
|
23
31
|
<slot v-bind="slotProps">
|
|
24
32
|
<component
|
|
25
33
|
:is="booleanComponent"
|
|
26
|
-
:disabled="
|
|
34
|
+
:disabled="
|
|
35
|
+
maybeBooleanishToBoolean(config?.inputProps?.disabled) ?? disabled
|
|
36
|
+
"
|
|
27
37
|
:name="slotProps.componentField.name"
|
|
28
38
|
:model-value="slotProps.componentField.modelValue"
|
|
29
|
-
@update:model-value="
|
|
39
|
+
@update:model-value="
|
|
40
|
+
slotProps.componentField['onUpdate:modelValue']
|
|
41
|
+
"
|
|
30
42
|
/>
|
|
31
43
|
</slot>
|
|
32
44
|
</FormControl>
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { cn } from "../../../lib/utils";
|
|
3
|
-
import { Button } from "
|
|
4
|
-
import { Calendar } from "
|
|
3
|
+
import { Button } from "../button";
|
|
4
|
+
import { Calendar } from "../calendar";
|
|
5
5
|
import {
|
|
6
6
|
FormControl,
|
|
7
7
|
FormDescription,
|
|
8
8
|
FormField,
|
|
9
9
|
FormItem,
|
|
10
10
|
FormMessage
|
|
11
|
-
} from "
|
|
12
|
-
import {
|
|
13
|
-
Popover,
|
|
14
|
-
PopoverContent,
|
|
15
|
-
PopoverTrigger
|
|
16
|
-
} from "~/src/runtime/components/ui/popover";
|
|
11
|
+
} from "../form";
|
|
12
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../popover";
|
|
17
13
|
import { DateFormatter, getLocalTimeZone } from "@internationalized/date";
|
|
18
14
|
import { CalendarIcon } from "lucide-vue-next";
|
|
19
15
|
import AutoFormLabel from "./AutoFormLabel.vue";
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import {
|
|
3
|
+
FormControl,
|
|
4
|
+
FormDescription,
|
|
5
|
+
FormField,
|
|
6
|
+
FormItem,
|
|
7
|
+
FormMessage
|
|
8
|
+
} from "../form";
|
|
9
|
+
import { Label } from "../label";
|
|
10
|
+
import { RadioGroup, RadioGroupItem } from "../radio-group";
|
|
11
|
+
import {
|
|
12
|
+
Select,
|
|
13
|
+
SelectContent,
|
|
14
|
+
SelectItem,
|
|
15
|
+
SelectTrigger,
|
|
16
|
+
SelectValue
|
|
17
|
+
} from "../select";
|
|
6
18
|
import AutoFormLabel from "./AutoFormLabel.vue";
|
|
7
19
|
import { beautifyObjectName, maybeBooleanishToBoolean } from "./utils";
|
|
8
20
|
defineProps({
|
|
@@ -23,19 +35,42 @@ defineProps({
|
|
|
23
35
|
</AutoFormLabel>
|
|
24
36
|
<FormControl>
|
|
25
37
|
<slot v-bind="slotProps">
|
|
26
|
-
<RadioGroup
|
|
27
|
-
|
|
38
|
+
<RadioGroup
|
|
39
|
+
v-if="config?.component === 'radio'"
|
|
40
|
+
:disabled="
|
|
41
|
+
maybeBooleanishToBoolean(config?.inputProps?.disabled) ?? disabled
|
|
42
|
+
"
|
|
43
|
+
:orientation="'vertical'"
|
|
44
|
+
v-bind="{ ...slotProps.componentField }"
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
v-for="(option, index) in options"
|
|
48
|
+
:key="option"
|
|
49
|
+
class="mb-2 flex items-center gap-3 space-y-0"
|
|
50
|
+
>
|
|
28
51
|
<RadioGroupItem :id="`${option}-${index}`" :value="option" />
|
|
29
|
-
<Label :for="`${option}-${index}`">{{
|
|
52
|
+
<Label :for="`${option}-${index}`">{{
|
|
53
|
+
beautifyObjectName(option)
|
|
54
|
+
}}</Label>
|
|
30
55
|
</div>
|
|
31
56
|
</RadioGroup>
|
|
32
57
|
|
|
33
|
-
<Select
|
|
58
|
+
<Select
|
|
59
|
+
v-else
|
|
60
|
+
:disabled="
|
|
61
|
+
maybeBooleanishToBoolean(config?.inputProps?.disabled) ?? disabled
|
|
62
|
+
"
|
|
63
|
+
v-bind="{ ...slotProps.componentField }"
|
|
64
|
+
>
|
|
34
65
|
<SelectTrigger class="w-full">
|
|
35
66
|
<SelectValue :placeholder="config?.inputProps?.placeholder" />
|
|
36
67
|
</SelectTrigger>
|
|
37
68
|
<SelectContent>
|
|
38
|
-
<SelectItem
|
|
69
|
+
<SelectItem
|
|
70
|
+
v-for="option in options"
|
|
71
|
+
:key="option"
|
|
72
|
+
:value="option"
|
|
73
|
+
>
|
|
39
74
|
{{ beautifyObjectName(option) }}
|
|
40
75
|
</SelectItem>
|
|
41
76
|
</SelectContent>
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { Button } from "
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { Button } from "../button";
|
|
3
|
+
import {
|
|
4
|
+
FormControl,
|
|
5
|
+
FormDescription,
|
|
6
|
+
FormField,
|
|
7
|
+
FormItem,
|
|
8
|
+
FormMessage
|
|
9
|
+
} from "../form";
|
|
10
|
+
import { Input } from "../input";
|
|
5
11
|
import { Trash } from "lucide-vue-next";
|
|
6
12
|
import { ref } from "vue";
|
|
7
13
|
import AutoFormLabel from "./AutoFormLabel.vue";
|
|
@@ -43,14 +49,19 @@ async function parseFileAsString(file) {
|
|
|
43
49
|
type="file"
|
|
44
50
|
v-bind="{ ...config?.inputProps }"
|
|
45
51
|
:disabled="config?.inputProps?.disabled ?? disabled"
|
|
46
|
-
@change="
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
@change="
|
|
53
|
+
async (ev) => {
|
|
54
|
+
const file = ev.target.files?.[0];
|
|
55
|
+
inputFile = file;
|
|
56
|
+
const parsed = await parseFileAsString(file);
|
|
57
|
+
slotProps.componentField.onInput(parsed);
|
|
58
|
+
}
|
|
59
|
+
"
|
|
52
60
|
/>
|
|
53
|
-
<div
|
|
61
|
+
<div
|
|
62
|
+
v-else
|
|
63
|
+
class="flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent pl-3 pr-1 py-1 text-sm shadow-sm transition-colors"
|
|
64
|
+
>
|
|
54
65
|
<p>{{ inputFile?.name }}</p>
|
|
55
66
|
<Button
|
|
56
67
|
:size="'icon'"
|
|
@@ -58,10 +69,12 @@ async function parseFileAsString(file) {
|
|
|
58
69
|
class="h-[26px] w-[26px]"
|
|
59
70
|
aria-label="Remove file"
|
|
60
71
|
type="button"
|
|
61
|
-
@click="
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
@click="
|
|
73
|
+
() => {
|
|
74
|
+
inputFile = void 0;
|
|
75
|
+
slotProps.componentField.onInput(void 0);
|
|
76
|
+
}
|
|
77
|
+
"
|
|
65
78
|
>
|
|
66
79
|
<Trash />
|
|
67
80
|
</Button>
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
FormControl,
|
|
4
|
+
FormDescription,
|
|
5
|
+
FormField,
|
|
6
|
+
FormItem,
|
|
7
|
+
FormMessage
|
|
8
|
+
} from "../form";
|
|
9
|
+
import { Input } from "../input";
|
|
10
|
+
import { Textarea } from "../textarea";
|
|
5
11
|
import { computed } from "vue";
|
|
6
12
|
import AutoFormLabel from "./AutoFormLabel.vue";
|
|
7
13
|
import { beautifyObjectName } from "./utils";
|
|
@@ -12,7 +18,9 @@ const props = defineProps({
|
|
|
12
18
|
config: { type: Object, required: false },
|
|
13
19
|
disabled: { type: Boolean, required: false }
|
|
14
20
|
});
|
|
15
|
-
const inputComponent = computed(
|
|
21
|
+
const inputComponent = computed(
|
|
22
|
+
() => props.config?.component === "textarea" ? Textarea : Input
|
|
23
|
+
);
|
|
16
24
|
</script>
|
|
17
25
|
|
|
18
26
|
<template>
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
FormControl,
|
|
4
|
+
FormDescription,
|
|
5
|
+
FormField,
|
|
6
|
+
FormItem,
|
|
7
|
+
FormMessage
|
|
8
|
+
} from "../form";
|
|
9
|
+
import { Input } from "../input";
|
|
4
10
|
import AutoFormLabel from "./AutoFormLabel.vue";
|
|
5
11
|
import { beautifyObjectName } from "./utils";
|
|
6
12
|
defineOptions({
|
|
@@ -23,7 +29,11 @@ defineProps({
|
|
|
23
29
|
</AutoFormLabel>
|
|
24
30
|
<FormControl>
|
|
25
31
|
<slot v-bind="slotProps">
|
|
26
|
-
<Input
|
|
32
|
+
<Input
|
|
33
|
+
type="number"
|
|
34
|
+
v-bind="{ ...slotProps.componentField, ...config?.inputProps }"
|
|
35
|
+
:disabled="config?.inputProps?.disabled ?? disabled"
|
|
36
|
+
/>
|
|
27
37
|
</slot>
|
|
28
38
|
</FormControl>
|
|
29
39
|
<FormDescription v-if="config?.description">
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
Accordion,
|
|
4
|
+
AccordionContent,
|
|
5
|
+
AccordionItem,
|
|
6
|
+
AccordionTrigger
|
|
7
|
+
} from "../accordion";
|
|
8
|
+
import { FormItem } from "../form";
|
|
4
9
|
import { FieldContextKey, useField } from "vee-validate";
|
|
5
10
|
import { computed, provide } from "vue";
|
|
6
11
|
import AutoFormField from "./AutoFormField.vue";
|
|
7
12
|
import AutoFormLabel from "./AutoFormLabel.vue";
|
|
8
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
beautifyObjectName,
|
|
15
|
+
getBaseSchema,
|
|
16
|
+
getBaseType,
|
|
17
|
+
getDefaultValueInZodStack
|
|
18
|
+
} from "./utils";
|
|
9
19
|
const props = defineProps({
|
|
10
20
|
fieldName: { type: String, required: true },
|
|
11
21
|
required: { type: Boolean, required: false },
|
|
@@ -15,11 +25,9 @@ const props = defineProps({
|
|
|
15
25
|
});
|
|
16
26
|
const shapes = computed(() => {
|
|
17
27
|
const val = {};
|
|
18
|
-
if (!props.schema)
|
|
19
|
-
return;
|
|
28
|
+
if (!props.schema) return;
|
|
20
29
|
const shape = getBaseSchema(props.schema)?.shape;
|
|
21
|
-
if (!shape)
|
|
22
|
-
return;
|
|
30
|
+
if (!shape) return;
|
|
23
31
|
Object.keys(shape).forEach((name) => {
|
|
24
32
|
const item = shape[name];
|
|
25
33
|
const baseItem = getBaseSchema(item);
|
|
@@ -43,7 +51,13 @@ provide(FieldContextKey, fieldContext);
|
|
|
43
51
|
<template>
|
|
44
52
|
<section>
|
|
45
53
|
<slot v-bind="props">
|
|
46
|
-
<Accordion
|
|
54
|
+
<Accordion
|
|
55
|
+
type="single"
|
|
56
|
+
as-child
|
|
57
|
+
class="w-full"
|
|
58
|
+
collapsible
|
|
59
|
+
:disabled="disabled"
|
|
60
|
+
>
|
|
47
61
|
<FormItem>
|
|
48
62
|
<AccordionItem :value="fieldName" class="border-none">
|
|
49
63
|
<AccordionTrigger>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export { default as Button } from './Button.vue.js';
|
|
3
3
|
export declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "
|
|
4
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
5
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export type ButtonVariants = VariantProps<typeof buttonVariants>;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useForwardProps
|
|
6
6
|
} from "reka-ui";
|
|
7
7
|
import { cn } from "../../../lib/utils";
|
|
8
|
-
import { buttonVariants } from "
|
|
8
|
+
import { buttonVariants } from "../button";
|
|
9
9
|
const props = defineProps({
|
|
10
10
|
day: { type: null, required: true },
|
|
11
11
|
month: { type: null, required: true },
|
|
@@ -3,7 +3,7 @@ import { reactiveOmit } from "@vueuse/core";
|
|
|
3
3
|
import { ChevronRight } from "lucide-vue-next";
|
|
4
4
|
import { CalendarNext, useForwardProps } from "reka-ui";
|
|
5
5
|
import { cn } from "../../../lib/utils";
|
|
6
|
-
import { buttonVariants } from "
|
|
6
|
+
import { buttonVariants } from "../button";
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
nextPage: { type: Function, required: false },
|
|
9
9
|
asChild: { type: Boolean, required: false },
|