@falcondev-oss/nuxt-layers-base 0.25.0 → 0.26.0
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.
|
@@ -244,21 +244,21 @@ const columns = useTableColumns<typeof data>(
|
|
|
244
244
|
class="flex flex-col gap-4"
|
|
245
245
|
>
|
|
246
246
|
{{ form.data }}
|
|
247
|
-
<UField v-slot="{
|
|
248
|
-
<UInput class="w-full" v-bind="
|
|
247
|
+
<UField v-slot="{ bind }" :field="form.fields.text.$use()">
|
|
248
|
+
<UInput class="w-full" v-bind="bind" />
|
|
249
249
|
</UField>
|
|
250
250
|
<UField
|
|
251
|
-
v-slot="{
|
|
251
|
+
v-slot="{ bind }"
|
|
252
252
|
:field="
|
|
253
253
|
form.fields.dateIso.$use({
|
|
254
254
|
translate: dateValueIsoTranslator(),
|
|
255
255
|
})
|
|
256
256
|
"
|
|
257
257
|
>
|
|
258
|
-
<UInputDatePicker class="w-full" v-bind="
|
|
258
|
+
<UInputDatePicker class="w-full" v-bind="bind" />
|
|
259
259
|
</UField>
|
|
260
|
-
<UField v-slot="{
|
|
261
|
-
<UInputDurationMinutes class="w-full" v-bind="
|
|
260
|
+
<UField v-slot="{ bind }" :field="form.fields.duration.$use()">
|
|
261
|
+
<UInputDurationMinutes class="w-full" v-bind="bind" />
|
|
262
262
|
</UField>
|
|
263
263
|
</UForm>
|
|
264
264
|
</UCard>
|
|
@@ -6,15 +6,5 @@ export default defineNuxtConfig({
|
|
|
6
6
|
projectId: 'my-project',
|
|
7
7
|
},
|
|
8
8
|
},
|
|
9
|
-
typescript: {
|
|
10
|
-
tsConfig: {
|
|
11
|
-
vueCompilerOptions: {
|
|
12
|
-
strictTemplates: true,
|
|
13
|
-
strictVModel: false,
|
|
14
|
-
htmlAttributes: ['aria-*'],
|
|
15
|
-
dataAttributes: ['data-*'],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
9
|
css: ['~/assets/test.css'],
|
|
20
10
|
})
|
|
@@ -1,27 +1,32 @@
|
|
|
1
|
-
<script setup lang="ts" generic="T
|
|
1
|
+
<script setup lang="ts" generic="T">
|
|
2
2
|
import type { FormField } from '@falcondev-oss/form-core'
|
|
3
3
|
import type { FormFieldProps, FormFieldSlots } from '@nuxt/ui'
|
|
4
4
|
import { useForwardProps } from 'reka-ui'
|
|
5
5
|
import * as R from 'remeda'
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
type InputProps<T> = {
|
|
8
8
|
'modelValue': T
|
|
9
9
|
'onUpdate:modelValue': (value: T) => void
|
|
10
10
|
'onBlur': () => void
|
|
11
11
|
'disabled': boolean
|
|
12
12
|
'loading': boolean
|
|
13
|
-
'modelModifiers':
|
|
13
|
+
'modelModifiers': { nullable: true }
|
|
14
14
|
'placeholder'?: string
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const props = defineProps<
|
|
18
18
|
FormFieldProps & {
|
|
19
19
|
field: FormField<T>
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
>()
|
|
22
|
+
|
|
22
23
|
const slots = defineSlots<
|
|
23
24
|
{
|
|
24
|
-
default: (slot: {
|
|
25
|
+
default: (slot: {
|
|
26
|
+
bind: InputProps<T>
|
|
27
|
+
model: WritableComputedRef<T>
|
|
28
|
+
field: FormField<T>
|
|
29
|
+
}) => any
|
|
25
30
|
} & Omit<FormFieldSlots, 'default'>
|
|
26
31
|
>()
|
|
27
32
|
|
|
@@ -52,7 +57,7 @@ const formFieldProps = computed<FormFieldProps>(() => {
|
|
|
52
57
|
}
|
|
53
58
|
})
|
|
54
59
|
|
|
55
|
-
const
|
|
60
|
+
const bind = computed(() => {
|
|
56
61
|
const field = forwardedProps.value.field
|
|
57
62
|
|
|
58
63
|
const placeholder = field.errors && field.errors.join('\n')
|
|
@@ -63,12 +68,21 @@ const inputProps = computed(() => {
|
|
|
63
68
|
'onBlur': () => field.handleBlur(),
|
|
64
69
|
'disabled': field.disabled,
|
|
65
70
|
'loading': field.isPending,
|
|
66
|
-
'modelModifiers': (props.nullable === true
|
|
67
|
-
? { nullable: true }
|
|
68
|
-
: undefined) as true extends Nullable ? { nullable: true } : undefined,
|
|
69
71
|
placeholder,
|
|
70
|
-
|
|
72
|
+
'modelModifiers': { nullable: true },
|
|
73
|
+
} satisfies InputProps<T>
|
|
71
74
|
})
|
|
75
|
+
|
|
76
|
+
const model = computed({
|
|
77
|
+
get() {
|
|
78
|
+
return forwardedProps.value.field.value
|
|
79
|
+
},
|
|
80
|
+
set(value: T) {
|
|
81
|
+
forwardedProps.value.field.handleChange(value)
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const model_ = { model }
|
|
72
86
|
</script>
|
|
73
87
|
|
|
74
88
|
<template>
|
|
@@ -101,7 +115,7 @@ const inputProps = computed(() => {
|
|
|
101
115
|
</span>
|
|
102
116
|
</template>
|
|
103
117
|
|
|
104
|
-
<slot v-bind="{
|
|
118
|
+
<slot v-bind="{ bind, model: model_.model, field: forwardedProps.field }">
|
|
105
119
|
<DevOnly>
|
|
106
120
|
<p class="font-black text-red-500">UField missing slot</p>
|
|
107
121
|
</DevOnly>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@falcondev-oss/nuxt-layers-base",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.0",
|
|
5
5
|
"description": "Nuxt layer with lots of useful helpers and @nuxt/ui components",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "github:falcondev-oss/nuxt-layers",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"@iconify-json/lucide": "^1.2.94",
|
|
25
25
|
"@internationalized/date": "^3.11.0",
|
|
26
26
|
"@nuxt/icon": "^2.2.1",
|
|
27
|
-
"@nuxt/ui": "~4.5.0",
|
|
28
27
|
"@nuxtjs/color-mode": "^4.0.0",
|
|
29
28
|
"@tanstack/vue-query": "^5.92.9",
|
|
30
29
|
"@trpc/client": "^11.10.0",
|