@ederzeel/nuxt-schema-form-nightly 0.1.0-29020128.b61d8e4 → 0.1.0-29021155.86a2d08
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.
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import SComponent from './SComponent.vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
id: string
|
|
6
|
+
title?: string
|
|
7
|
+
description?: string
|
|
8
|
+
jsonSchemaPath: string
|
|
9
|
+
properties: PropertiesType
|
|
10
|
+
modelValue: Record<string, unknown>
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
type PropertiesType = {
|
|
14
|
+
[key: string]: unknown
|
|
15
|
+
}
|
|
16
|
+
const emit = defineEmits(['update:modelValue'])
|
|
17
|
+
const onInput = (value: unknown, key: string) => {
|
|
18
|
+
emit('update:modelValue', { ...props.modelValue, [key]: value })
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<div class="flex flex-row gap-4 justify-stretch">
|
|
24
|
+
<h2 v-if="props.title" class="mb-4 text-2xl leading-none tracking-tight">{{ props.title }}</h2>
|
|
25
|
+
<p v-if="props.description" class="mb-4">{{ props.description }}</p>
|
|
26
|
+
|
|
27
|
+
<SComponent
|
|
28
|
+
v-for="[key, options] of Object.entries(properties)"
|
|
29
|
+
:id="id.length <= 0 ? `${key}` : `${id}.${key}`"
|
|
30
|
+
:key="key"
|
|
31
|
+
:model-value="modelValue[key]"
|
|
32
|
+
:json-schema-path="jsonSchemaPath?.length <= 0 ? `properties.${key}` : `${jsonSchemaPath}.properties.${key}`"
|
|
33
|
+
v-bind="options"
|
|
34
|
+
class="flex flex-col flex-1"
|
|
35
|
+
@update:model-value="event => onInput(event, key)"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|