@ederzeel/nuxt-schema-form-nightly 0.1.0-29257619.56503a4 → 0.1.0-29323954.0b153f2

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.
Files changed (49) hide show
  1. package/dist/module.d.mts +2 -1
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/Array.d.vue.ts +23 -0
  4. package/dist/runtime/components/Array.vue +33 -42
  5. package/dist/runtime/components/Array.vue.d.ts +23 -0
  6. package/dist/runtime/components/Component.d.vue.ts +43 -0
  7. package/dist/runtime/components/Component.vue +85 -98
  8. package/dist/runtime/components/Component.vue.d.ts +43 -0
  9. package/dist/runtime/components/Date.d.vue.ts +17 -0
  10. package/dist/runtime/components/Date.vue +20 -24
  11. package/dist/runtime/components/Date.vue.d.ts +17 -0
  12. package/dist/runtime/components/Form.d.vue.ts +31 -0
  13. package/dist/runtime/components/Form.vue +32 -45
  14. package/dist/runtime/components/Form.vue.d.ts +31 -0
  15. package/dist/runtime/components/InputField.d.vue.ts +18 -0
  16. package/dist/runtime/components/InputField.vue +10 -11
  17. package/dist/runtime/components/InputField.vue.d.ts +18 -0
  18. package/dist/runtime/components/InputNumber.d.vue.ts +20 -0
  19. package/dist/runtime/components/InputNumber.vue +14 -15
  20. package/dist/runtime/components/InputNumber.vue.d.ts +20 -0
  21. package/dist/runtime/components/MultiSelect.d.vue.ts +29 -0
  22. package/dist/runtime/components/MultiSelect.vue +21 -28
  23. package/dist/runtime/components/MultiSelect.vue.d.ts +29 -0
  24. package/dist/runtime/components/Object.d.vue.ts +17 -0
  25. package/dist/runtime/components/Object.vue +18 -23
  26. package/dist/runtime/components/Object.vue.d.ts +17 -0
  27. package/dist/runtime/components/Row.d.vue.ts +16 -0
  28. package/dist/runtime/components/Row.vue +17 -22
  29. package/dist/runtime/components/Row.vue.d.ts +16 -0
  30. package/dist/runtime/components/Select.d.vue.ts +20 -0
  31. package/dist/runtime/components/Select.vue +14 -17
  32. package/dist/runtime/components/Select.vue.d.ts +20 -0
  33. package/dist/runtime/components/Slider.d.vue.ts +20 -0
  34. package/dist/runtime/components/Slider.vue +12 -13
  35. package/dist/runtime/components/Slider.vue.d.ts +20 -0
  36. package/dist/runtime/components/Textarea.d.vue.ts +17 -0
  37. package/dist/runtime/components/Textarea.vue +9 -10
  38. package/dist/runtime/components/Textarea.vue.d.ts +17 -0
  39. package/dist/runtime/components/Toggle.d.vue.ts +17 -0
  40. package/dist/runtime/components/Toggle.vue +9 -10
  41. package/dist/runtime/components/Toggle.vue.d.ts +17 -0
  42. package/dist/runtime/components/array/ArrayObject.d.vue.ts +21 -0
  43. package/dist/runtime/components/array/ArrayObject.vue +134 -170
  44. package/dist/runtime/components/array/ArrayObject.vue.d.ts +21 -0
  45. package/dist/types.d.mts +3 -1
  46. package/package.json +33 -33
  47. package/dist/module.cjs +0 -5
  48. package/dist/module.d.ts +0 -13
  49. package/dist/types.d.ts +0 -1
@@ -1,65 +1,52 @@
1
- <script lang="ts" setup>
2
- import SComponent from './Component.vue'
3
- import convertToYup from 'json-schema-yup-transformer'
4
- import type { JsonSchema } from 'json-schema-library'
5
- import { computed, ref } from 'vue'
6
- import type { Config } from 'json-schema-yup-transformer'
7
- import type { CustomValidation } from '#schema-form-types'
8
-
9
- const props = defineProps<{
10
- schema: JsonSchema
11
- options?: { customValidation?: CustomValidation[]; jsonSchemaYupTransfromer?: Config }
12
- }>()
13
-
14
- const value = defineModel<Record<string, unknown>>({ required: true })
15
- const formRef = ref()
16
-
17
- const emit = defineEmits(['submit'])
18
-
19
- async function onSubmit(_event: unknown) {
20
- emit('submit', value.value)
1
+ <script setup>
2
+ import SComponent from "./Component.vue";
3
+ import convertToYup from "json-schema-yup-transformer";
4
+ import { computed, ref } from "vue";
5
+ const props = defineProps({
6
+ schema: { type: Object, required: true },
7
+ options: { type: Object, required: false }
8
+ });
9
+ const value = defineModel({ type: Object, ...{ required: true } });
10
+ const formRef = ref();
11
+ const emit = defineEmits(["submit"]);
12
+ async function onSubmit(_event) {
13
+ emit("submit", value.value);
21
14
  }
22
-
23
15
  const formValidationSchema = computed(() => {
24
- return convertToYup(props.schema, props?.options?.jsonSchemaYupTransfromer ?? {})
25
- })
26
-
27
- const validateFields = async (fields: string[]) => {
28
- let allValid = true
16
+ return convertToYup(props.schema, props?.options?.jsonSchemaYupTransfromer ?? {});
17
+ });
18
+ const validateFields = async (fields) => {
19
+ let allValid = true;
29
20
  for (const field of fields) {
30
21
  try {
31
- if (!(await formRef.value.validate({ name: field, silent: true }))) {
32
- allValid = false
22
+ if (!await formRef.value.validate({ name: field, silent: true })) {
23
+ allValid = false;
33
24
  }
34
25
  } catch (err) {
35
- console.log(err)
36
- return false
26
+ console.log(err);
27
+ return false;
37
28
  }
38
29
  }
39
-
40
30
  if (props?.options?.customValidation) {
41
31
  for (const { field, message, validate } of props.options.customValidation) {
42
- if (!fields.includes(field)) continue
32
+ if (!fields.includes(field)) continue;
43
33
  if (!validate(value.value)) {
44
- const errors = [{ name: field, message }]
45
- formRef.value.setErrors(errors, field)
46
- allValid = false
34
+ const errors = [{ name: field, message }];
35
+ formRef.value.setErrors(errors, field);
36
+ allValid = false;
47
37
  }
48
38
  }
49
39
  }
50
-
51
- return allValid
52
- }
53
-
40
+ return allValid;
41
+ };
54
42
  const submit = () => {
55
- formRef.value.submit()
56
- }
57
-
43
+ formRef.value.submit();
44
+ };
58
45
  defineExpose({
59
46
  submit
60
- })
61
- const isHidden = ref(false)
62
- const setHidden = (value: boolean) => (isHidden.value = value)
47
+ });
48
+ const isHidden = ref(false);
49
+ const setHidden = (value2) => isHidden.value = value2;
63
50
  </script>
64
51
 
65
52
  <template>
@@ -0,0 +1,31 @@
1
+ import type { JsonSchema } from 'json-schema-library';
2
+ import type { Config } from 'json-schema-yup-transformer';
3
+ import type { CustomValidation } from '#schema-form-types';
4
+ type __VLS_Props = {
5
+ schema: JsonSchema;
6
+ options?: {
7
+ customValidation?: CustomValidation[];
8
+ jsonSchemaYupTransfromer?: Config;
9
+ };
10
+ };
11
+ type __VLS_ModelProps = {
12
+ modelValue: Record<string, unknown>;
13
+ };
14
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
15
+ declare var __VLS_18: {}, __VLS_20: {};
16
+ type __VLS_Slots = {} & {
17
+ default?: (props: typeof __VLS_18) => any;
18
+ } & {
19
+ submit?: (props: typeof __VLS_20) => any;
20
+ };
21
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
22
+ submit: () => void;
23
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
25
+ declare const _default: typeof __VLS_export;
26
+ export default _default;
27
+ type __VLS_WithSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -0,0 +1,18 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ type: string;
6
+ isRequired: boolean;
7
+ };
8
+ type __VLS_ModelProps = {
9
+ modelValue?: string;
10
+ };
11
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ "update:modelValue": (value: string) => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
15
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
16
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
@@ -1,20 +1,19 @@
1
- <script lang="ts" setup>
2
- const props = defineProps<{
3
- id: string
4
- title?: string
5
- description?: string
6
- type: string
7
- isRequired: boolean
8
- }>()
9
-
10
- const value = defineModel<string>({ default: '' })
1
+ <script setup>
2
+ const props = defineProps({
3
+ id: { type: String, required: true },
4
+ title: { type: String, required: false },
5
+ description: { type: String, required: false },
6
+ type: { type: String, required: true },
7
+ isRequired: { type: Boolean, required: true }
8
+ });
9
+ const value = defineModel({ type: String, ...{ default: "" } });
11
10
  </script>
12
11
 
13
12
  <template>
14
13
  <div>
15
14
  <UFormField
16
15
  :label="props.title || id"
17
- :hint="!props.isRequired ? 'optional' : undefined"
16
+ :hint="!props.isRequired ? 'optional' : void 0"
18
17
  :description="props.description"
19
18
  :name="props.id"
20
19
  >
@@ -0,0 +1,18 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ type: string;
6
+ isRequired: boolean;
7
+ };
8
+ type __VLS_ModelProps = {
9
+ modelValue?: string;
10
+ };
11
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ "update:modelValue": (value: string) => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
15
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
16
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ type: string;
6
+ minimum?: number;
7
+ maximum?: number;
8
+ isRequired: boolean;
9
+ };
10
+ type __VLS_ModelProps = {
11
+ modelValue: number;
12
+ };
13
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ "update:modelValue": (value: number) => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -1,22 +1,21 @@
1
- <script lang="ts" setup>
2
- const props = defineProps<{
3
- id: string
4
- title?: string
5
- description?: string
6
- type: string
7
- minimum?: number
8
- maximum?: number
9
- isRequired: boolean
10
- }>()
11
-
12
- const value = defineModel<number>({ required: true, default: 0 })
1
+ <script setup>
2
+ const props = defineProps({
3
+ id: { type: String, required: true },
4
+ title: { type: String, required: false },
5
+ description: { type: String, required: false },
6
+ type: { type: String, required: true },
7
+ minimum: { type: Number, required: false },
8
+ maximum: { type: Number, required: false },
9
+ isRequired: { type: Boolean, required: true }
10
+ });
11
+ const value = defineModel({ type: Number, ...{ required: true, default: 0 } });
13
12
  </script>
14
13
 
15
14
  <template>
16
15
  <div>
17
16
  <UFormField
18
17
  :label="props.title || id"
19
- :hint="!props.isRequired ? 'optional' : undefined"
18
+ :hint="!props.isRequired ? 'optional' : void 0"
20
19
  :description="props.description"
21
20
  :name="props.id"
22
21
  >
@@ -29,8 +28,8 @@ const value = defineModel<number>({ required: true, default: 0 })
29
28
  :step="0.01"
30
29
  :stepSnapping="props.type === 'integer'"
31
30
  :format-options="{
32
- minimumFractionDigits: props.type === 'number' ? 1 : undefined
33
- }"
31
+ minimumFractionDigits: props.type === 'number' ? 1 : void 0
32
+ }"
34
33
  />
35
34
  </UFormField>
36
35
  </div>
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ type: string;
6
+ minimum?: number;
7
+ maximum?: number;
8
+ isRequired: boolean;
9
+ };
10
+ type __VLS_ModelProps = {
11
+ modelValue: number;
12
+ };
13
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ "update:modelValue": (value: number) => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,29 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ placeholder?: string;
6
+ jsonSchemaPath: string;
7
+ items: {
8
+ id: string;
9
+ enum: string[];
10
+ enum_titles?: string[];
11
+ };
12
+ modelValue: string[];
13
+ isRequired: boolean;
14
+ minItems?: number;
15
+ maxItems?: number;
16
+ edit?: boolean;
17
+ editInline?: boolean;
18
+ };
19
+ type __VLS_ModelProps = {
20
+ modelValue: string[];
21
+ };
22
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
23
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ "update:modelValue": (value: string[]) => any;
25
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
26
+ "onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
@@ -1,37 +1,30 @@
1
- <script lang="ts" setup>
2
- import { computed } from 'vue'
3
-
4
- const props = defineProps<{
5
- id: string
6
- title?: string
7
- description?: string
8
- placeholder?: string
9
- jsonSchemaPath: string
10
- items: {
11
- id: string
12
- enum: string[]
13
- enum_titles?: string[]
14
- }
15
- modelValue: string[]
16
- isRequired: boolean
17
- minItems?: number
18
- maxItems?: number
19
- edit?: boolean
20
- editInline?: boolean
21
- }>()
22
-
23
- const options = computed(() =>
24
- props.items.enum.map((x, i) => ({ label: props?.items.enum_titles?.[i] ?? x, value: x }))
25
- )
26
-
27
- const value = defineModel<string[]>({ required: true })
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ const props = defineProps({
4
+ id: { type: String, required: true },
5
+ title: { type: String, required: false },
6
+ description: { type: String, required: false },
7
+ placeholder: { type: String, required: false },
8
+ jsonSchemaPath: { type: String, required: true },
9
+ items: { type: Object, required: true },
10
+ modelValue: { type: Array, required: true },
11
+ isRequired: { type: Boolean, required: true },
12
+ minItems: { type: Number, required: false },
13
+ maxItems: { type: Number, required: false },
14
+ edit: { type: Boolean, required: false },
15
+ editInline: { type: Boolean, required: false }
16
+ });
17
+ const options = computed(
18
+ () => props.items.enum.map((x, i) => ({ label: props?.items.enum_titles?.[i] ?? x, value: x }))
19
+ );
20
+ const value = defineModel({ type: Array, ...{ required: true } });
28
21
  </script>
29
22
 
30
23
  <template>
31
24
  <div>
32
25
  <UFormField
33
26
  :label="props.title || id"
34
- :hint="!props.isRequired ? 'optional' : undefined"
27
+ :hint="!props.isRequired ? 'optional' : void 0"
35
28
  :description="props.description"
36
29
  :name="props.id"
37
30
  >
@@ -0,0 +1,29 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ placeholder?: string;
6
+ jsonSchemaPath: string;
7
+ items: {
8
+ id: string;
9
+ enum: string[];
10
+ enum_titles?: string[];
11
+ };
12
+ modelValue: string[];
13
+ isRequired: boolean;
14
+ minItems?: number;
15
+ maxItems?: number;
16
+ edit?: boolean;
17
+ editInline?: boolean;
18
+ };
19
+ type __VLS_ModelProps = {
20
+ modelValue: string[];
21
+ };
22
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
23
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ "update:modelValue": (value: string[]) => any;
25
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
26
+ "onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ jsonSchemaPath: string;
6
+ properties: PropertiesType;
7
+ modelValue: Record<string, unknown>;
8
+ required?: string[];
9
+ isRequired: boolean;
10
+ setHidden?: (value: boolean) => void;
11
+ };
12
+ type PropertiesType = {
13
+ [key: string]: Record<string, unknown>;
14
+ };
15
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
@@ -1,25 +1,20 @@
1
- <script lang="ts" setup>
2
- import SComponent from './Component.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
- required?: string[]
12
- isRequired: boolean
13
- setHidden?: (value: boolean) => void
14
- }>()
15
-
16
- type PropertiesType = {
17
- [key: string]: Record<string, unknown>
18
- }
19
- const emit = defineEmits(['update:modelValue', 'submit'])
20
- const onInput = (value: unknown, key: string) => {
21
- emit('update:modelValue', { ...props.modelValue, [key]: value })
22
- }
1
+ <script setup>
2
+ import SComponent from "./Component.vue";
3
+ const props = defineProps({
4
+ id: { type: String, required: true },
5
+ title: { type: String, required: false },
6
+ description: { type: String, required: false },
7
+ jsonSchemaPath: { type: String, required: true },
8
+ properties: { type: Object, required: true },
9
+ modelValue: { type: Object, required: true },
10
+ required: { type: Array, required: false },
11
+ isRequired: { type: Boolean, required: true },
12
+ setHidden: { type: Function, required: false }
13
+ });
14
+ const emit = defineEmits(["update:modelValue", "submit"]);
15
+ const onInput = (value, key) => {
16
+ emit("update:modelValue", { ...props.modelValue, [key]: value });
17
+ };
23
18
  </script>
24
19
 
25
20
  <template>
@@ -37,7 +32,7 @@ const onInput = (value: unknown, key: string) => {
37
32
  :isRequired="required ? required.includes(key) : false"
38
33
  :setHidden="setHidden"
39
34
  class="mt-4"
40
- @update:model-value="(event: unknown) => onInput(event, key)"
35
+ @update:model-value="(event) => onInput(event, key)"
41
36
  @submit="() => emit('submit')"
42
37
  />
43
38
  </div>
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ jsonSchemaPath: string;
6
+ properties: PropertiesType;
7
+ modelValue: Record<string, unknown>;
8
+ required?: string[];
9
+ isRequired: boolean;
10
+ setHidden?: (value: boolean) => void;
11
+ };
12
+ type PropertiesType = {
13
+ [key: string]: Record<string, unknown>;
14
+ };
15
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
@@ -0,0 +1,16 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ jsonSchemaPath: string;
6
+ properties: PropertiesType;
7
+ modelValue: Record<string, unknown>;
8
+ required: string[];
9
+ isRequired: boolean;
10
+ };
11
+ type PropertiesType = {
12
+ [key: string]: Record<string, unknown>;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
@@ -1,24 +1,19 @@
1
- <script lang="ts" setup>
2
- import SComponent from './Component.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
- required: string[]
12
- isRequired: boolean
13
- }>()
14
-
15
- type PropertiesType = {
16
- [key: string]: Record<string, unknown>
17
- }
18
- const emit = defineEmits(['update:modelValue'])
19
- const onInput = (value: unknown, key: string) => {
20
- emit('update:modelValue', { ...props.modelValue, [key]: value })
21
- }
1
+ <script setup>
2
+ import SComponent from "./Component.vue";
3
+ const props = defineProps({
4
+ id: { type: String, required: true },
5
+ title: { type: String, required: false },
6
+ description: { type: String, required: false },
7
+ jsonSchemaPath: { type: String, required: true },
8
+ properties: { type: Object, required: true },
9
+ modelValue: { type: Object, required: true },
10
+ required: { type: Array, required: true },
11
+ isRequired: { type: Boolean, required: true }
12
+ });
13
+ const emit = defineEmits(["update:modelValue"]);
14
+ const onInput = (value, key) => {
15
+ emit("update:modelValue", { ...props.modelValue, [key]: value });
16
+ };
22
17
  </script>
23
18
 
24
19
  <template>
@@ -30,6 +25,6 @@ const onInput = (value: unknown, key: string) => {
30
25
  :key="key" :model-value="modelValue[key]"
31
26
  :json-schema-path="jsonSchemaPath?.length <= 0 ? `properties.${key}` : `${jsonSchemaPath}.properties.${key}`"
32
27
  v-bind="options" :isRequired="required.includes(key)" class="flex flex-col flex-1"
33
- @update:model-value="(event: unknown) => onInput(event, key)" />
28
+ @update:model-value="(event) => onInput(event, key)" />
34
29
  </div>
35
30
  </template>
@@ -0,0 +1,16 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ jsonSchemaPath: string;
6
+ properties: PropertiesType;
7
+ modelValue: Record<string, unknown>;
8
+ required: string[];
9
+ isRequired: boolean;
10
+ };
11
+ type PropertiesType = {
12
+ [key: string]: Record<string, unknown>;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ placeholder?: string;
6
+ enum: string[];
7
+ enum_titles?: string[];
8
+ isRequired: boolean;
9
+ };
10
+ type __VLS_ModelProps = {
11
+ modelValue?: string;
12
+ };
13
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ "update:modelValue": (value: string) => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -1,26 +1,23 @@
1
- <script lang="ts" setup>
2
- import { computed } from 'vue'
3
-
4
- const props = defineProps<{
5
- id: string
6
- title?: string
7
- description?: string
8
- placeholder?: string
9
- enum: string[]
10
- enum_titles?: string[]
11
- isRequired: boolean
12
- }>()
13
-
14
- const options = computed(() => props.enum.map((x, i) => ({ label: props?.enum_titles?.[i] ?? x, value: x })))
15
-
16
- const value = defineModel<string>({ default: '' })
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ const props = defineProps({
4
+ id: { type: String, required: true },
5
+ title: { type: String, required: false },
6
+ description: { type: String, required: false },
7
+ placeholder: { type: String, required: false },
8
+ enum: { type: Array, required: true },
9
+ enum_titles: { type: Array, required: false },
10
+ isRequired: { type: Boolean, required: true }
11
+ });
12
+ const options = computed(() => props.enum.map((x, i) => ({ label: props?.enum_titles?.[i] ?? x, value: x })));
13
+ const value = defineModel({ type: String, ...{ default: "" } });
17
14
  </script>
18
15
 
19
16
  <template>
20
17
  <div>
21
18
  <UFormField
22
19
  :label="props.title || id"
23
- :hint="!props.isRequired ? 'optional' : undefined"
20
+ :hint="!props.isRequired ? 'optional' : void 0"
24
21
  :description="props.description"
25
22
  :name="props.id"
26
23
  >