@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
package/dist/module.d.mts CHANGED
@@ -10,4 +10,5 @@ interface ModuleOptions {
10
10
  }
11
11
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
12
12
 
13
- export { type ModuleOptions, _default as default };
13
+ export { _default as default };
14
+ export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "docs": "https://ui3.nuxt.dev/getting-started/installation/nuxt",
8
8
  "version": "0.1.0",
9
9
  "builder": {
10
- "@nuxt/module-builder": "0.8.4",
10
+ "@nuxt/module-builder": "1.0.2",
11
11
  "unbuild": "unknown"
12
12
  }
13
13
  }
@@ -0,0 +1,23 @@
1
+ import type { TableColumn } from '@nuxt/ui';
2
+ import type { PropertiesType } from '../types/index.js';
3
+ type __VLS_Props = {
4
+ id: string;
5
+ title?: string;
6
+ description?: string;
7
+ jsonSchemaPath: string;
8
+ items: PropertiesType & {
9
+ required?: string[];
10
+ };
11
+ isRequired: boolean;
12
+ minItems?: number;
13
+ maxItems?: number;
14
+ edit?: boolean;
15
+ columns?: TableColumn<{}>[];
16
+ editInline?: boolean;
17
+ modelValue: unknown[];
18
+ required?: string[];
19
+ setHidden?: (value: boolean) => void;
20
+ };
21
+ 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>;
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
@@ -1,56 +1,47 @@
1
- <script lang="ts" setup>
2
- import { h } from 'vue'
3
- import type { TableColumn } from '@nuxt/ui'
4
- import type { PropertiesType } from '../types'
5
- import SObject from './array/ArrayObject.vue'
6
- import SMultiSelect from './MultiSelect.vue'
7
-
8
- const props = defineProps<{
9
- id: string
10
- title?: string
11
- description?: string
12
- jsonSchemaPath: string
13
- items: PropertiesType & { required?: string[] }
14
- isRequired: boolean
15
- minItems?: number
16
- maxItems?: number
17
- edit?: boolean
18
- columns?: TableColumn<{}>[]
19
- editInline?: boolean
20
- modelValue: unknown[]
21
- required?: string[]
22
- setHidden?: (value: boolean) => void
23
- }>()
24
-
25
- const emit = defineEmits(['update:modelValue', 'submit'])
26
-
1
+ <script setup>
2
+ import { h } from "vue";
3
+ import SObject from "./array/ArrayObject.vue";
4
+ import SMultiSelect from "./MultiSelect.vue";
5
+ const props = defineProps({
6
+ id: { type: String, required: true },
7
+ title: { type: String, required: false },
8
+ description: { type: String, required: false },
9
+ jsonSchemaPath: { type: String, required: true },
10
+ items: { type: Object, 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
+ columns: { type: Array, required: false },
16
+ editInline: { type: Boolean, required: false },
17
+ modelValue: { type: Array, required: true },
18
+ required: { type: Array, required: false },
19
+ setHidden: { type: Function, required: false }
20
+ });
21
+ const emit = defineEmits(["update:modelValue", "submit"]);
27
22
  const Renderer = () => {
28
- if (props.items.type === 'object') {
23
+ if (props.items.type === "object") {
29
24
  return h(SObject, {
30
25
  ...props,
31
26
  required: props.items.required,
32
27
  isRequired: props.isRequired,
33
- modelValue: props.modelValue as Record<string, unknown>[],
34
- 'onUpdate:modelValue': (v: Record<string, unknown>[]) => {
35
- emit('update:modelValue', v)
28
+ modelValue: props.modelValue,
29
+ "onUpdate:modelValue": (v) => {
30
+ emit("update:modelValue", v);
36
31
  }
37
- })
38
- } else if (props.items.type === 'string' && props.items.enum) {
32
+ });
33
+ } else if (props.items.type === "string" && props.items.enum) {
39
34
  return h(SMultiSelect, {
40
35
  ...props,
41
- items: props.items as unknown as {
42
- id: string
43
- enum: string[]
44
- enum_titles?: string[]
45
- },
36
+ items: props.items,
46
37
  isRequired: props.isRequired,
47
- modelValue: props.modelValue as string[],
48
- 'onUpdate:modelValue': (v: string[]) => {
49
- emit('update:modelValue', v)
38
+ modelValue: props.modelValue,
39
+ "onUpdate:modelValue": (v) => {
40
+ emit("update:modelValue", v);
50
41
  }
51
- })
42
+ });
52
43
  }
53
- }
44
+ };
54
45
  </script>
55
46
 
56
47
  <template>
@@ -0,0 +1,23 @@
1
+ import type { TableColumn } from '@nuxt/ui';
2
+ import type { PropertiesType } from '../types/index.js';
3
+ type __VLS_Props = {
4
+ id: string;
5
+ title?: string;
6
+ description?: string;
7
+ jsonSchemaPath: string;
8
+ items: PropertiesType & {
9
+ required?: string[];
10
+ };
11
+ isRequired: boolean;
12
+ minItems?: number;
13
+ maxItems?: number;
14
+ edit?: boolean;
15
+ columns?: TableColumn<{}>[];
16
+ editInline?: boolean;
17
+ modelValue: unknown[];
18
+ required?: string[];
19
+ setHidden?: (value: boolean) => void;
20
+ };
21
+ 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>;
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
@@ -0,0 +1,43 @@
1
+ import type { PropertiesType } from '../types/index.js';
2
+ import type { TableColumn } from '@nuxt/ui';
3
+ type Properties = {
4
+ properties?: {
5
+ [key: string]: unknown;
6
+ };
7
+ };
8
+ export type SComponentProps = {
9
+ id?: string;
10
+ title?: string;
11
+ renderer?: string;
12
+ type?: string | unknown[];
13
+ properties?: Properties;
14
+ enum?: string[];
15
+ enum_titles?: string[];
16
+ format?: string;
17
+ description?: string;
18
+ placeholder?: string;
19
+ jsonSchemaPath?: string;
20
+ required?: string[];
21
+ isRequired: boolean;
22
+ items?: PropertiesType;
23
+ edit?: boolean;
24
+ minItems?: number;
25
+ maxItems?: number;
26
+ minimum?: number;
27
+ maximum?: number;
28
+ editInline?: boolean;
29
+ columns?: TableColumn<{}>[];
30
+ validateFields?: (fields: string[]) => Promise<boolean>;
31
+ setHidden?: (value: boolean) => void;
32
+ };
33
+ type __VLS_Props = SComponentProps;
34
+ type __VLS_ModelProps = {
35
+ modelValue: unknown;
36
+ };
37
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
38
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {
39
+ id: string;
40
+ jsonSchemaPath: string;
41
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
+ declare const _default: typeof __VLS_export;
43
+ export default _default;
@@ -1,58 +1,47 @@
1
- <script lang="ts" setup>
2
- import { h, resolveComponent } from 'vue'
3
- import SObject from './Object.vue'
4
- import SDate from './Date.vue'
5
- import SToggle from './Toggle.vue'
6
- import SArray from './Array.vue'
7
- import SInputNumber from './InputNumber.vue'
8
- import SInputField from './InputField.vue'
9
- import SSelect from './Select.vue'
10
- import type { PropertiesType } from '../types'
11
- import type { TableColumn } from '@nuxt/ui'
12
-
13
- type Properties = {
14
- properties?: { [key: string]: unknown }
15
- }
16
-
17
- export type SComponentProps = {
18
- id?: string
19
- title?: string
20
- renderer?: string
21
- type?: string | unknown[]
22
- properties?: Properties
23
- enum?: string[]
24
- enum_titles?: string[]
25
- format?: string
26
- description?: string
27
- placeholder?: string
28
- jsonSchemaPath?: string
29
- required?: string[]
30
- isRequired: boolean
31
- items?: PropertiesType
32
- edit?: boolean
33
- minItems?: number
34
- maxItems?: number
35
- minimum?: number
36
- maximum?: number
37
- editInline?: boolean
38
- columns?: TableColumn<{}>[]
39
- validateFields?: (fields: string[]) => Promise<boolean>
40
- setHidden?: (value: boolean) => void
41
- }
42
-
43
- const props = withDefaults(defineProps<SComponentProps>(), { id: '', jsonSchemaPath: '' })
44
- const value = defineModel<unknown>({ required: true })
45
- const emit = defineEmits(['submit'])
46
-
1
+ <script setup>
2
+ import { h, resolveComponent } from "vue";
3
+ import SObject from "./Object.vue";
4
+ import SDate from "./Date.vue";
5
+ import SToggle from "./Toggle.vue";
6
+ import SArray from "./Array.vue";
7
+ import SInputNumber from "./InputNumber.vue";
8
+ import SInputField from "./InputField.vue";
9
+ import SSelect from "./Select.vue";
10
+ const props = defineProps({
11
+ id: { type: String, required: false, default: "" },
12
+ title: { type: String, required: false },
13
+ renderer: { type: String, required: false },
14
+ type: { type: [String, Array], required: false },
15
+ properties: { type: Object, required: false },
16
+ enum: { type: Array, required: false },
17
+ enum_titles: { type: Array, required: false },
18
+ format: { type: String, required: false },
19
+ description: { type: String, required: false },
20
+ placeholder: { type: String, required: false },
21
+ jsonSchemaPath: { type: String, required: false, default: "" },
22
+ required: { type: Array, required: false },
23
+ isRequired: { type: Boolean, required: true },
24
+ items: { type: Object, required: false },
25
+ edit: { type: Boolean, required: false },
26
+ minItems: { type: Number, required: false },
27
+ maxItems: { type: Number, required: false },
28
+ minimum: { type: Number, required: false },
29
+ maximum: { type: Number, required: false },
30
+ editInline: { type: Boolean, required: false },
31
+ columns: { type: Array, required: false },
32
+ validateFields: { type: Function, required: false },
33
+ setHidden: { type: Function, required: false }
34
+ });
35
+ const value = defineModel({ type: null, ...{ required: true } });
36
+ const emit = defineEmits(["submit"]);
47
37
  const onSubmit = () => {
48
- emit('submit')
49
- }
50
-
38
+ emit("submit");
39
+ };
51
40
  const Render = () => {
52
- const { type: t, renderer, format } = props
53
- const type = Array.isArray(t) ? t[0] : t
54
- if (type == null || (renderer != null && renderer === 'none')) {
55
- return undefined
41
+ const { type: t, renderer, format } = props;
42
+ const type = Array.isArray(t) ? t[0] : t;
43
+ if (type == null || renderer != null && renderer === "none") {
44
+ return void 0;
56
45
  } else if (renderer) {
57
46
  return h(resolveComponent(renderer), {
58
47
  ...props,
@@ -60,13 +49,13 @@ const Render = () => {
60
49
  onSubmit,
61
50
  // is: typeof renderer === 'string' ? renderer : undefined,
62
51
  modelValue: value.value,
63
- 'onUpdate:modelValue': (v: unknown) => {
64
- value.value = v
52
+ "onUpdate:modelValue": (v) => {
53
+ value.value = v;
65
54
  }
66
- })
67
- } else if (type === 'string') {
68
- const { enum: eenum } = props
69
- if (format === 'full-date') {
55
+ });
56
+ } else if (type === "string") {
57
+ const { enum: eenum } = props;
58
+ if (format === "full-date") {
70
59
  return h(SDate, {
71
60
  id: props.id,
72
61
  title: props.title,
@@ -74,11 +63,11 @@ const Render = () => {
74
63
  type: props.type,
75
64
  isRequired: props.isRequired,
76
65
  jsonSchemaPath: `${props.jsonSchemaPath}.${props.id}`,
77
- modelValue: value.value as string,
78
- 'onUpdate:modelValue': (v: string) => {
79
- value.value = v
66
+ modelValue: value.value,
67
+ "onUpdate:modelValue": (v) => {
68
+ value.value = v;
80
69
  }
81
- })
70
+ });
82
71
  } else if (eenum) {
83
72
  return h(SSelect, {
84
73
  id: props.id,
@@ -88,11 +77,11 @@ const Render = () => {
88
77
  enum_titles: props.enum_titles,
89
78
  isRequired: props.isRequired,
90
79
  jsonSchemaPath: `${props.jsonSchemaPath}.${props.id}`,
91
- modelValue: value.value as string,
92
- 'onUpdate:modelValue': (v: string) => {
93
- value.value = v
80
+ modelValue: value.value,
81
+ "onUpdate:modelValue": (v) => {
82
+ value.value = v;
94
83
  }
95
- })
84
+ });
96
85
  } else {
97
86
  return h(SInputField, {
98
87
  id: props.id,
@@ -101,13 +90,13 @@ const Render = () => {
101
90
  isRequired: props.isRequired,
102
91
  type,
103
92
  jsonSchemaPath: `${props.jsonSchemaPath}.${props.id}`,
104
- modelValue: value.value as string,
105
- 'onUpdate:modelValue': (v: string) => {
106
- value.value = v
93
+ modelValue: value.value,
94
+ "onUpdate:modelValue": (v) => {
95
+ value.value = v;
107
96
  }
108
- })
97
+ });
109
98
  }
110
- } else if (type === 'number' || type === 'integer') {
99
+ } else if (type === "number" || type === "integer") {
111
100
  return h(SInputNumber, {
112
101
  id: props.id,
113
102
  title: props.title,
@@ -115,27 +104,26 @@ const Render = () => {
115
104
  type,
116
105
  isRequired: props.isRequired,
117
106
  jsonSchemaPath: `${props.jsonSchemaPath}.${props.id}`,
118
- modelValue: value.value as number,
119
- 'onUpdate:modelValue': (v: number) => {
120
- value.value = v
107
+ modelValue: value.value,
108
+ "onUpdate:modelValue": (v) => {
109
+ value.value = v;
121
110
  }
122
- })
123
- } else if (type === 'boolean') {
111
+ });
112
+ } else if (type === "boolean") {
124
113
  return h(SToggle, {
125
114
  id: props.id,
126
115
  title: props.title,
127
116
  description: props.description,
128
117
  isRequired: props.isRequired,
129
118
  jsonSchemaPath: `${props.jsonSchemaPath}.${props.id}`,
130
- modelValue: value.value as boolean,
131
- 'onUpdate:modelValue': (v: boolean) => {
132
- value.value = v
119
+ modelValue: value.value,
120
+ "onUpdate:modelValue": (v) => {
121
+ value.value = v;
133
122
  }
134
- })
135
- } else if (type === 'object') {
136
- if (!props.properties) throw new Error('object is missing properties')
137
- if (!props.required) throw new Error('object is missing required')
138
-
123
+ });
124
+ } else if (type === "object") {
125
+ if (!props.properties) throw new Error("object is missing properties");
126
+ if (!props.required) throw new Error("object is missing required");
139
127
  return h(SObject, {
140
128
  id: props.id,
141
129
  title: props.title,
@@ -146,14 +134,13 @@ const Render = () => {
146
134
  jsonSchemaPath: `${props.jsonSchemaPath}.${props.id}`,
147
135
  onSubmit,
148
136
  setHidden: props.setHidden,
149
- modelValue: value.value as Record<string, unknown>,
150
- 'onUpdate:modelValue': (v: Record<string, unknown>) => {
151
- value.value = v
137
+ modelValue: value.value,
138
+ "onUpdate:modelValue": (v) => {
139
+ value.value = v;
152
140
  }
153
- })
154
- } else if (type === 'array') {
155
- if (!props.items) throw new Error('array has no items')
156
-
141
+ });
142
+ } else if (type === "array") {
143
+ if (!props.items) throw new Error("array has no items");
157
144
  return h(SArray, {
158
145
  id: props.id,
159
146
  title: props.title,
@@ -168,14 +155,14 @@ const Render = () => {
168
155
  jsonSchemaPath: `${props.jsonSchemaPath}.${props.id}`,
169
156
  onSubmit,
170
157
  setHidden: props.setHidden,
171
- modelValue: value.value as unknown[],
172
- 'onUpdate:modelValue': (v: unknown) => {
173
- value.value = v as unknown[]
158
+ modelValue: value.value,
159
+ "onUpdate:modelValue": (v) => {
160
+ value.value = v;
174
161
  }
175
- })
162
+ });
176
163
  }
177
- return undefined
178
- }
164
+ return void 0;
165
+ };
179
166
  </script>
180
167
 
181
168
  <template>
@@ -0,0 +1,43 @@
1
+ import type { PropertiesType } from '../types/index.js';
2
+ import type { TableColumn } from '@nuxt/ui';
3
+ type Properties = {
4
+ properties?: {
5
+ [key: string]: unknown;
6
+ };
7
+ };
8
+ export type SComponentProps = {
9
+ id?: string;
10
+ title?: string;
11
+ renderer?: string;
12
+ type?: string | unknown[];
13
+ properties?: Properties;
14
+ enum?: string[];
15
+ enum_titles?: string[];
16
+ format?: string;
17
+ description?: string;
18
+ placeholder?: string;
19
+ jsonSchemaPath?: string;
20
+ required?: string[];
21
+ isRequired: boolean;
22
+ items?: PropertiesType;
23
+ edit?: boolean;
24
+ minItems?: number;
25
+ maxItems?: number;
26
+ minimum?: number;
27
+ maximum?: number;
28
+ editInline?: boolean;
29
+ columns?: TableColumn<{}>[];
30
+ validateFields?: (fields: string[]) => Promise<boolean>;
31
+ setHidden?: (value: boolean) => void;
32
+ };
33
+ type __VLS_Props = SComponentProps;
34
+ type __VLS_ModelProps = {
35
+ modelValue: unknown;
36
+ };
37
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
38
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {
39
+ id: string;
40
+ jsonSchemaPath: string;
41
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
+ declare const _default: typeof __VLS_export;
43
+ export default _default;
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ isRequired: boolean;
6
+ };
7
+ type __VLS_ModelProps = {
8
+ modelValue: string;
9
+ };
10
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:modelValue": (value: string) => any;
13
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
@@ -1,41 +1,37 @@
1
- <script lang="ts" setup>
2
- import { ref, watch } from 'vue'
3
- import { CalendarDate, DateFormatter, getLocalTimeZone } from '@internationalized/date'
4
-
5
- const props = defineProps<{
6
- id: string
7
- title?: string
8
- description?: string
9
- isRequired: boolean
10
- }>()
11
-
12
- const df = new DateFormatter('nl-NL', { dateStyle: 'medium' })
13
-
14
- const value = defineModel<string>({ required: true, default: new Date().toISOString() })
15
- const valueDate = new Date(value.value)
16
- const date = ref(new CalendarDate(valueDate.getFullYear(), valueDate.getMonth() + 1, valueDate.getDate()))
17
-
1
+ <script setup>
2
+ import { ref, watch } from "vue";
3
+ import { CalendarDate, DateFormatter, getLocalTimeZone } from "@internationalized/date";
4
+ const props = defineProps({
5
+ id: { type: String, required: true },
6
+ title: { type: String, required: false },
7
+ description: { type: String, required: false },
8
+ isRequired: { type: Boolean, required: true }
9
+ });
10
+ const df = new DateFormatter("nl-NL", { dateStyle: "medium" });
11
+ const value = defineModel({ type: String, ...{ required: true, default: (/* @__PURE__ */ new Date()).toISOString() } });
12
+ const valueDate = new Date(value.value);
13
+ const date = ref(new CalendarDate(valueDate.getFullYear(), valueDate.getMonth() + 1, valueDate.getDate()));
18
14
  watch(date, () => {
19
- value.value = date.value.toDate(getLocalTimeZone()).toISOString()
20
- })
21
- const open = ref(false)
15
+ value.value = date.value.toDate(getLocalTimeZone()).toISOString();
16
+ });
17
+ const open = ref(false);
22
18
  </script>
23
19
 
24
20
  <template>
25
21
  <div>
26
22
  <UFormField
27
23
  :label="props.title || id"
28
- :hint="!props.isRequired ? 'optional' : undefined"
24
+ :hint="!props.isRequired ? 'optional' : void 0"
29
25
  :description="props.description"
30
26
  :name="props.id"
31
27
  >
32
28
  <UPopover v-model:open="open">
33
- <UButton color="neutral" variant="subtle" icon="i-lucide-calendar" class="w-full" @click="() => (open = true)">
34
- {{ value ? df.format(date.toDate(getLocalTimeZone())) : 'Select a date' }}
29
+ <UButton color="neutral" variant="subtle" icon="i-lucide-calendar" class="w-full" @click="() => open = true">
30
+ {{ value ? df.format(date.toDate(getLocalTimeZone())) : "Select a date" }}
35
31
  </UButton>
36
32
 
37
33
  <template #content>
38
- <UCalendar v-model="date" class="p-2" @update:modelValue="() => (open = false)" />
34
+ <UCalendar v-model="date" class="p-2" @update:modelValue="() => open = false" />
39
35
  </template>
40
36
  </UPopover>
41
37
  </UFormField>
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ title?: string;
4
+ description?: string;
5
+ isRequired: boolean;
6
+ };
7
+ type __VLS_ModelProps = {
8
+ modelValue: string;
9
+ };
10
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:modelValue": (value: string) => any;
13
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
@@ -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
+ };