@verikit/vue 0.23.1
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/LICENSE.md +9 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +1 -0
- package/dist/client/use-verikit-client.d.ts +42 -0
- package/dist/client/use-verikit-client.d.ts.map +1 -0
- package/dist/client/use-verikit-client.js +39 -0
- package/dist/components/button.d.ts +36 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +53 -0
- package/dist/components/checkbox.d.ts +45 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +44 -0
- package/dist/components/dialog.d.ts +86 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +157 -0
- package/dist/components/input.d.ts +5 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +17 -0
- package/dist/components/label.d.ts +5 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +17 -0
- package/dist/components/select.d.ts +164 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +219 -0
- package/dist/components/textarea.d.ts +5 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +17 -0
- package/dist/fields/field-shell.d.ts +64 -0
- package/dist/fields/field-shell.d.ts.map +1 -0
- package/dist/fields/field-shell.js +61 -0
- package/dist/fields/index.d.ts +7 -0
- package/dist/fields/index.d.ts.map +1 -0
- package/dist/fields/index.js +3 -0
- package/dist/fields/inputs.d.ts +372 -0
- package/dist/fields/inputs.d.ts.map +1 -0
- package/dist/fields/inputs.js +306 -0
- package/dist/fields/registry.d.ts +382 -0
- package/dist/fields/registry.d.ts.map +1 -0
- package/dist/fields/registry.js +31 -0
- package/dist/fields/types.d.ts +36 -0
- package/dist/fields/types.d.ts.map +1 -0
- package/dist/fields/types.js +1 -0
- package/dist/form/index.d.ts +11 -0
- package/dist/form/index.d.ts.map +1 -0
- package/dist/form/index.js +5 -0
- package/dist/form/use-verikit-form.d.ts +40 -0
- package/dist/form/use-verikit-form.d.ts.map +1 -0
- package/dist/form/use-verikit-form.js +72 -0
- package/dist/form/use-verikit-schema-tree-form.d.ts +47 -0
- package/dist/form/use-verikit-schema-tree-form.d.ts.map +1 -0
- package/dist/form/use-verikit-schema-tree-form.js +96 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/layout/index.d.ts +5 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +2 -0
- package/dist/layout/render-schema-node.d.ts +9 -0
- package/dist/layout/render-schema-node.d.ts.map +1 -0
- package/dist/layout/render-schema-node.js +265 -0
- package/dist/layout/types.d.ts +68 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/layout/types.js +1 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +6 -0
- package/dist/query/index.d.ts +13 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +6 -0
- package/dist/query/use-resource-form.d.ts +39 -0
- package/dist/query/use-resource-form.d.ts.map +1 -0
- package/dist/query/use-resource-form.js +32 -0
- package/dist/query/use-resource-mutations.d.ts +40 -0
- package/dist/query/use-resource-mutations.d.ts.map +1 -0
- package/dist/query/use-resource-mutations.js +104 -0
- package/dist/query/use-resource-queries.d.ts +15 -0
- package/dist/query/use-resource-queries.d.ts.map +1 -0
- package/dist/query/use-resource-queries.js +35 -0
- package/dist/query/use-resource-schema-tree-form.d.ts +36 -0
- package/dist/query/use-resource-schema-tree-form.d.ts.map +1 -0
- package/dist/query/use-resource-schema-tree-form.js +42 -0
- package/dist/query/use-resource-table.d.ts +48 -0
- package/dist/query/use-resource-table.d.ts.map +1 -0
- package/dist/query/use-resource-table.js +104 -0
- package/dist/relationships/belongs-to-field.d.ts +91 -0
- package/dist/relationships/belongs-to-field.d.ts.map +1 -0
- package/dist/relationships/belongs-to-field.js +107 -0
- package/dist/relationships/index.d.ts +2 -0
- package/dist/relationships/index.d.ts.map +1 -0
- package/dist/relationships/index.js +1 -0
- package/dist/resource/index.d.ts +5 -0
- package/dist/resource/index.d.ts.map +1 -0
- package/dist/resource/index.js +2 -0
- package/dist/resource/resource-form.d.ts +122 -0
- package/dist/resource/resource-form.d.ts.map +1 -0
- package/dist/resource/resource-form.js +83 -0
- package/dist/resource/resource-table-filters.d.ts +54 -0
- package/dist/resource/resource-table-filters.d.ts.map +1 -0
- package/dist/resource/resource-table-filters.js +283 -0
- package/dist/resource/resource-table.d.ts +93 -0
- package/dist/resource/resource-table.d.ts.map +1 -0
- package/dist/resource/resource-table.js +562 -0
- package/package.json +86 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import type { FieldSchema } from "@verikit/core";
|
|
2
|
+
/** Renders a text input field. */
|
|
3
|
+
export declare const TextField: import("vue").DefineComponent<{
|
|
4
|
+
field: FieldSchema;
|
|
5
|
+
id?: string | undefined;
|
|
6
|
+
name?: string | undefined;
|
|
7
|
+
value?: unknown;
|
|
8
|
+
error?: import("vue").VNodeChild;
|
|
9
|
+
disabled?: boolean | undefined;
|
|
10
|
+
readOnly?: boolean | undefined;
|
|
11
|
+
className?: string | undefined;
|
|
12
|
+
inputClassName?: string | undefined;
|
|
13
|
+
onBlur?: (() => void) | undefined;
|
|
14
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
15
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
18
|
+
field: FieldSchema;
|
|
19
|
+
id?: string | undefined;
|
|
20
|
+
name?: string | undefined;
|
|
21
|
+
value?: unknown;
|
|
22
|
+
error?: import("vue").VNodeChild;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
readOnly?: boolean | undefined;
|
|
25
|
+
className?: string | undefined;
|
|
26
|
+
inputClassName?: string | undefined;
|
|
27
|
+
onBlur?: (() => void) | undefined;
|
|
28
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
29
|
+
}> & Readonly<{}>, {
|
|
30
|
+
name: string | undefined;
|
|
31
|
+
onBlur: (() => void) | undefined;
|
|
32
|
+
id: string | undefined;
|
|
33
|
+
className: string | undefined;
|
|
34
|
+
disabled: boolean | undefined;
|
|
35
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
36
|
+
readOnly: boolean | undefined;
|
|
37
|
+
inputClassName: string | undefined;
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
39
|
+
/** Renders an email input field. */
|
|
40
|
+
export declare const EmailField: import("vue").DefineComponent<{
|
|
41
|
+
field: FieldSchema;
|
|
42
|
+
id?: string | undefined;
|
|
43
|
+
name?: string | undefined;
|
|
44
|
+
value?: unknown;
|
|
45
|
+
error?: import("vue").VNodeChild;
|
|
46
|
+
disabled?: boolean | undefined;
|
|
47
|
+
readOnly?: boolean | undefined;
|
|
48
|
+
className?: string | undefined;
|
|
49
|
+
inputClassName?: string | undefined;
|
|
50
|
+
onBlur?: (() => void) | undefined;
|
|
51
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
52
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
55
|
+
field: FieldSchema;
|
|
56
|
+
id?: string | undefined;
|
|
57
|
+
name?: string | undefined;
|
|
58
|
+
value?: unknown;
|
|
59
|
+
error?: import("vue").VNodeChild;
|
|
60
|
+
disabled?: boolean | undefined;
|
|
61
|
+
readOnly?: boolean | undefined;
|
|
62
|
+
className?: string | undefined;
|
|
63
|
+
inputClassName?: string | undefined;
|
|
64
|
+
onBlur?: (() => void) | undefined;
|
|
65
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
66
|
+
}> & Readonly<{}>, {
|
|
67
|
+
name: string | undefined;
|
|
68
|
+
onBlur: (() => void) | undefined;
|
|
69
|
+
id: string | undefined;
|
|
70
|
+
className: string | undefined;
|
|
71
|
+
disabled: boolean | undefined;
|
|
72
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
73
|
+
readOnly: boolean | undefined;
|
|
74
|
+
inputClassName: string | undefined;
|
|
75
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
76
|
+
/** Renders a numeric input field. */
|
|
77
|
+
export declare const NumberField: import("vue").DefineComponent<{
|
|
78
|
+
field: FieldSchema;
|
|
79
|
+
id?: string | undefined;
|
|
80
|
+
name?: string | undefined;
|
|
81
|
+
value?: unknown;
|
|
82
|
+
error?: import("vue").VNodeChild;
|
|
83
|
+
disabled?: boolean | undefined;
|
|
84
|
+
readOnly?: boolean | undefined;
|
|
85
|
+
className?: string | undefined;
|
|
86
|
+
inputClassName?: string | undefined;
|
|
87
|
+
onBlur?: (() => void) | undefined;
|
|
88
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
89
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
92
|
+
field: FieldSchema;
|
|
93
|
+
id?: string | undefined;
|
|
94
|
+
name?: string | undefined;
|
|
95
|
+
value?: unknown;
|
|
96
|
+
error?: import("vue").VNodeChild;
|
|
97
|
+
disabled?: boolean | undefined;
|
|
98
|
+
readOnly?: boolean | undefined;
|
|
99
|
+
className?: string | undefined;
|
|
100
|
+
inputClassName?: string | undefined;
|
|
101
|
+
onBlur?: (() => void) | undefined;
|
|
102
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
103
|
+
}> & Readonly<{}>, {
|
|
104
|
+
name: string | undefined;
|
|
105
|
+
onBlur: (() => void) | undefined;
|
|
106
|
+
id: string | undefined;
|
|
107
|
+
className: string | undefined;
|
|
108
|
+
disabled: boolean | undefined;
|
|
109
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
110
|
+
readOnly: boolean | undefined;
|
|
111
|
+
inputClassName: string | undefined;
|
|
112
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
113
|
+
/** Renders a date input field. */
|
|
114
|
+
export declare const DateField: import("vue").DefineComponent<{
|
|
115
|
+
field: FieldSchema;
|
|
116
|
+
id?: string | undefined;
|
|
117
|
+
name?: string | undefined;
|
|
118
|
+
value?: unknown;
|
|
119
|
+
error?: import("vue").VNodeChild;
|
|
120
|
+
disabled?: boolean | undefined;
|
|
121
|
+
readOnly?: boolean | undefined;
|
|
122
|
+
className?: string | undefined;
|
|
123
|
+
inputClassName?: string | undefined;
|
|
124
|
+
onBlur?: (() => void) | undefined;
|
|
125
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
126
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
127
|
+
[key: string]: any;
|
|
128
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
129
|
+
field: FieldSchema;
|
|
130
|
+
id?: string | undefined;
|
|
131
|
+
name?: string | undefined;
|
|
132
|
+
value?: unknown;
|
|
133
|
+
error?: import("vue").VNodeChild;
|
|
134
|
+
disabled?: boolean | undefined;
|
|
135
|
+
readOnly?: boolean | undefined;
|
|
136
|
+
className?: string | undefined;
|
|
137
|
+
inputClassName?: string | undefined;
|
|
138
|
+
onBlur?: (() => void) | undefined;
|
|
139
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
140
|
+
}> & Readonly<{}>, {
|
|
141
|
+
name: string | undefined;
|
|
142
|
+
onBlur: (() => void) | undefined;
|
|
143
|
+
id: string | undefined;
|
|
144
|
+
className: string | undefined;
|
|
145
|
+
disabled: boolean | undefined;
|
|
146
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
147
|
+
readOnly: boolean | undefined;
|
|
148
|
+
inputClassName: string | undefined;
|
|
149
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
150
|
+
/** Renders a date-time input field. */
|
|
151
|
+
export declare const DateTimeField: import("vue").DefineComponent<{
|
|
152
|
+
field: FieldSchema;
|
|
153
|
+
id?: string | undefined;
|
|
154
|
+
name?: string | undefined;
|
|
155
|
+
value?: unknown;
|
|
156
|
+
error?: import("vue").VNodeChild;
|
|
157
|
+
disabled?: boolean | undefined;
|
|
158
|
+
readOnly?: boolean | undefined;
|
|
159
|
+
className?: string | undefined;
|
|
160
|
+
inputClassName?: string | undefined;
|
|
161
|
+
onBlur?: (() => void) | undefined;
|
|
162
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
163
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
164
|
+
[key: string]: any;
|
|
165
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
166
|
+
field: FieldSchema;
|
|
167
|
+
id?: string | undefined;
|
|
168
|
+
name?: string | undefined;
|
|
169
|
+
value?: unknown;
|
|
170
|
+
error?: import("vue").VNodeChild;
|
|
171
|
+
disabled?: boolean | undefined;
|
|
172
|
+
readOnly?: boolean | undefined;
|
|
173
|
+
className?: string | undefined;
|
|
174
|
+
inputClassName?: string | undefined;
|
|
175
|
+
onBlur?: (() => void) | undefined;
|
|
176
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
177
|
+
}> & Readonly<{}>, {
|
|
178
|
+
name: string | undefined;
|
|
179
|
+
onBlur: (() => void) | undefined;
|
|
180
|
+
id: string | undefined;
|
|
181
|
+
className: string | undefined;
|
|
182
|
+
disabled: boolean | undefined;
|
|
183
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
184
|
+
readOnly: boolean | undefined;
|
|
185
|
+
inputClassName: string | undefined;
|
|
186
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
187
|
+
/** Renders a textarea field. */
|
|
188
|
+
export declare const TextareaField: import("vue").DefineComponent<{
|
|
189
|
+
field: FieldSchema;
|
|
190
|
+
id?: string | undefined;
|
|
191
|
+
name?: string | undefined;
|
|
192
|
+
value?: unknown;
|
|
193
|
+
error?: import("vue").VNodeChild;
|
|
194
|
+
disabled?: boolean | undefined;
|
|
195
|
+
readOnly?: boolean | undefined;
|
|
196
|
+
className?: string | undefined;
|
|
197
|
+
inputClassName?: string | undefined;
|
|
198
|
+
onBlur?: (() => void) | undefined;
|
|
199
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
200
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
201
|
+
[key: string]: any;
|
|
202
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
203
|
+
field: FieldSchema;
|
|
204
|
+
id?: string | undefined;
|
|
205
|
+
name?: string | undefined;
|
|
206
|
+
value?: unknown;
|
|
207
|
+
error?: import("vue").VNodeChild;
|
|
208
|
+
disabled?: boolean | undefined;
|
|
209
|
+
readOnly?: boolean | undefined;
|
|
210
|
+
className?: string | undefined;
|
|
211
|
+
inputClassName?: string | undefined;
|
|
212
|
+
onBlur?: (() => void) | undefined;
|
|
213
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
214
|
+
}> & Readonly<{}>, {
|
|
215
|
+
name: string | undefined;
|
|
216
|
+
onBlur: (() => void) | undefined;
|
|
217
|
+
id: string | undefined;
|
|
218
|
+
className: string | undefined;
|
|
219
|
+
disabled: boolean | undefined;
|
|
220
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
221
|
+
readOnly: boolean | undefined;
|
|
222
|
+
inputClassName: string | undefined;
|
|
223
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
224
|
+
/** Renders a select field from schema options. */
|
|
225
|
+
export declare const SelectField: import("vue").DefineComponent<{
|
|
226
|
+
field: FieldSchema;
|
|
227
|
+
id?: string | undefined;
|
|
228
|
+
name?: string | undefined;
|
|
229
|
+
value?: unknown;
|
|
230
|
+
error?: import("vue").VNodeChild;
|
|
231
|
+
disabled?: boolean | undefined;
|
|
232
|
+
readOnly?: boolean | undefined;
|
|
233
|
+
className?: string | undefined;
|
|
234
|
+
inputClassName?: string | undefined;
|
|
235
|
+
onBlur?: (() => void) | undefined;
|
|
236
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
237
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
238
|
+
[key: string]: any;
|
|
239
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
240
|
+
field: FieldSchema;
|
|
241
|
+
id?: string | undefined;
|
|
242
|
+
name?: string | undefined;
|
|
243
|
+
value?: unknown;
|
|
244
|
+
error?: import("vue").VNodeChild;
|
|
245
|
+
disabled?: boolean | undefined;
|
|
246
|
+
readOnly?: boolean | undefined;
|
|
247
|
+
className?: string | undefined;
|
|
248
|
+
inputClassName?: string | undefined;
|
|
249
|
+
onBlur?: (() => void) | undefined;
|
|
250
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
251
|
+
}> & Readonly<{}>, {
|
|
252
|
+
name: string | undefined;
|
|
253
|
+
onBlur: (() => void) | undefined;
|
|
254
|
+
id: string | undefined;
|
|
255
|
+
className: string | undefined;
|
|
256
|
+
disabled: boolean | undefined;
|
|
257
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
258
|
+
readOnly: boolean | undefined;
|
|
259
|
+
inputClassName: string | undefined;
|
|
260
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
261
|
+
/** Renders a boolean field as a checkbox. */
|
|
262
|
+
export declare const BooleanField: import("vue").DefineComponent<{
|
|
263
|
+
field: FieldSchema;
|
|
264
|
+
id?: string | undefined;
|
|
265
|
+
name?: string | undefined;
|
|
266
|
+
value?: unknown;
|
|
267
|
+
error?: import("vue").VNodeChild;
|
|
268
|
+
disabled?: boolean | undefined;
|
|
269
|
+
readOnly?: boolean | undefined;
|
|
270
|
+
className?: string | undefined;
|
|
271
|
+
inputClassName?: string | undefined;
|
|
272
|
+
onBlur?: (() => void) | undefined;
|
|
273
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
274
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
275
|
+
[key: string]: any;
|
|
276
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
277
|
+
field: FieldSchema;
|
|
278
|
+
id?: string | undefined;
|
|
279
|
+
name?: string | undefined;
|
|
280
|
+
value?: unknown;
|
|
281
|
+
error?: import("vue").VNodeChild;
|
|
282
|
+
disabled?: boolean | undefined;
|
|
283
|
+
readOnly?: boolean | undefined;
|
|
284
|
+
className?: string | undefined;
|
|
285
|
+
inputClassName?: string | undefined;
|
|
286
|
+
onBlur?: (() => void) | undefined;
|
|
287
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
288
|
+
}> & Readonly<{}>, {
|
|
289
|
+
name: string | undefined;
|
|
290
|
+
onBlur: (() => void) | undefined;
|
|
291
|
+
id: string | undefined;
|
|
292
|
+
className: string | undefined;
|
|
293
|
+
disabled: boolean | undefined;
|
|
294
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
295
|
+
readOnly: boolean | undefined;
|
|
296
|
+
inputClassName: string | undefined;
|
|
297
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
298
|
+
/** Renders a file upload field. */
|
|
299
|
+
export declare const FileField: import("vue").DefineComponent<{
|
|
300
|
+
field: FieldSchema;
|
|
301
|
+
id?: string | undefined;
|
|
302
|
+
name?: string | undefined;
|
|
303
|
+
value?: unknown;
|
|
304
|
+
error?: import("vue").VNodeChild;
|
|
305
|
+
disabled?: boolean | undefined;
|
|
306
|
+
readOnly?: boolean | undefined;
|
|
307
|
+
className?: string | undefined;
|
|
308
|
+
inputClassName?: string | undefined;
|
|
309
|
+
onBlur?: (() => void) | undefined;
|
|
310
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
311
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
312
|
+
[key: string]: any;
|
|
313
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
314
|
+
field: FieldSchema;
|
|
315
|
+
id?: string | undefined;
|
|
316
|
+
name?: string | undefined;
|
|
317
|
+
value?: unknown;
|
|
318
|
+
error?: import("vue").VNodeChild;
|
|
319
|
+
disabled?: boolean | undefined;
|
|
320
|
+
readOnly?: boolean | undefined;
|
|
321
|
+
className?: string | undefined;
|
|
322
|
+
inputClassName?: string | undefined;
|
|
323
|
+
onBlur?: (() => void) | undefined;
|
|
324
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
325
|
+
}> & Readonly<{}>, {
|
|
326
|
+
name: string | undefined;
|
|
327
|
+
onBlur: (() => void) | undefined;
|
|
328
|
+
id: string | undefined;
|
|
329
|
+
className: string | undefined;
|
|
330
|
+
disabled: boolean | undefined;
|
|
331
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
332
|
+
readOnly: boolean | undefined;
|
|
333
|
+
inputClassName: string | undefined;
|
|
334
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
335
|
+
/** Renders an image upload field. */
|
|
336
|
+
export declare const ImageField: import("vue").DefineComponent<{
|
|
337
|
+
field: FieldSchema;
|
|
338
|
+
id?: string | undefined;
|
|
339
|
+
name?: string | undefined;
|
|
340
|
+
value?: unknown;
|
|
341
|
+
error?: import("vue").VNodeChild;
|
|
342
|
+
disabled?: boolean | undefined;
|
|
343
|
+
readOnly?: boolean | undefined;
|
|
344
|
+
className?: string | undefined;
|
|
345
|
+
inputClassName?: string | undefined;
|
|
346
|
+
onBlur?: (() => void) | undefined;
|
|
347
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
348
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
349
|
+
[key: string]: any;
|
|
350
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
351
|
+
field: FieldSchema;
|
|
352
|
+
id?: string | undefined;
|
|
353
|
+
name?: string | undefined;
|
|
354
|
+
value?: unknown;
|
|
355
|
+
error?: import("vue").VNodeChild;
|
|
356
|
+
disabled?: boolean | undefined;
|
|
357
|
+
readOnly?: boolean | undefined;
|
|
358
|
+
className?: string | undefined;
|
|
359
|
+
inputClassName?: string | undefined;
|
|
360
|
+
onBlur?: (() => void) | undefined;
|
|
361
|
+
onValueChange?: ((value: unknown) => void) | undefined;
|
|
362
|
+
}> & Readonly<{}>, {
|
|
363
|
+
name: string | undefined;
|
|
364
|
+
onBlur: (() => void) | undefined;
|
|
365
|
+
id: string | undefined;
|
|
366
|
+
className: string | undefined;
|
|
367
|
+
disabled: boolean | undefined;
|
|
368
|
+
onValueChange: ((value: unknown) => void) | undefined;
|
|
369
|
+
readOnly: boolean | undefined;
|
|
370
|
+
inputClassName: string | undefined;
|
|
371
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
372
|
+
//# sourceMappingURL=inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/fields/inputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAoLjD,kCAAkC;AAClC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA7DkB,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EAyDX,CAAC;AAChD,oCAAoC;AACpC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA/DiB,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EA2DT,CAAC;AAClD,qCAAqC;AACrC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAjEgB,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EA6DP,CAAC;AACpD,kCAAkC;AAClC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAnEkB,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EA+DX,CAAC;AAChD,uCAAuC;AACvC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBArEc,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EAiEG,CAAC;AAE9D,gCAAgC;AAChC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAxEc,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EAwGxD,CAAC;AAEH,kDAAkD;AAClD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA/GgB,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EA0LxD,CAAC;AAEH,6CAA6C;AAC7C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAjMe,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EAiOxD,CAAC;AA0DH,mCAAmC;AACnC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAhSkB,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EA4RP,CAAC;AACpD,qCAAqC;AACrC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAlSiB,IAAI;;;;4BAIF,OAAO,KAAK,IAAI;;;4EA8RN,CAAC"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { defineComponent, h } from "vue";
|
|
2
|
+
import { Button } from "#components/button";
|
|
3
|
+
import { Checkbox } from "#components/checkbox";
|
|
4
|
+
import { Input } from "#components/input";
|
|
5
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "#components/select";
|
|
6
|
+
import { Textarea } from "#components/textarea";
|
|
7
|
+
import { cn } from "#lib/utils";
|
|
8
|
+
import { FieldShell, fieldAriaProps, fieldId } from "./field-shell.js";
|
|
9
|
+
function textValue(value) {
|
|
10
|
+
if (value === null || value === undefined) {
|
|
11
|
+
return "";
|
|
12
|
+
}
|
|
13
|
+
if (value instanceof Date) {
|
|
14
|
+
return value.toISOString();
|
|
15
|
+
}
|
|
16
|
+
return String(value);
|
|
17
|
+
}
|
|
18
|
+
function dateValue(value, type) {
|
|
19
|
+
if (value === null || value === undefined || value === "") {
|
|
20
|
+
return "";
|
|
21
|
+
}
|
|
22
|
+
const date = value instanceof Date ? value : new Date(String(value));
|
|
23
|
+
if (Number.isNaN(date.getTime())) {
|
|
24
|
+
return String(value);
|
|
25
|
+
}
|
|
26
|
+
return type === "date"
|
|
27
|
+
? date.toISOString().slice(0, 10)
|
|
28
|
+
: date.toISOString().slice(0, 16);
|
|
29
|
+
}
|
|
30
|
+
function stringList(value) {
|
|
31
|
+
if (!Array.isArray(value)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
return value.filter((item) => typeof item === "string");
|
|
35
|
+
}
|
|
36
|
+
function fieldProperty(field, key) {
|
|
37
|
+
return field[key];
|
|
38
|
+
}
|
|
39
|
+
function inputConstraints(field) {
|
|
40
|
+
const minLength = fieldProperty(field, "minLength");
|
|
41
|
+
const maxLength = fieldProperty(field, "maxLength");
|
|
42
|
+
const min = fieldProperty(field, "min");
|
|
43
|
+
const max = fieldProperty(field, "max");
|
|
44
|
+
const step = fieldProperty(field, "step");
|
|
45
|
+
const accept = fieldProperty(field, "accept");
|
|
46
|
+
const multiple = fieldProperty(field, "multiple");
|
|
47
|
+
return {
|
|
48
|
+
minLength: typeof minLength === "number" ? minLength : undefined,
|
|
49
|
+
maxLength: typeof maxLength === "number" ? maxLength : undefined,
|
|
50
|
+
min: typeof min === "number" ? min : undefined,
|
|
51
|
+
max: typeof max === "number" ? max : undefined,
|
|
52
|
+
step: typeof step === "number" ? step : undefined,
|
|
53
|
+
accept: stringList(accept)?.join(","),
|
|
54
|
+
multiple: multiple === true ? true : undefined,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function commonDisabled(field, disabled) {
|
|
58
|
+
return disabled === true || field.hidden === true;
|
|
59
|
+
}
|
|
60
|
+
function commonReadOnly(field, readOnly) {
|
|
61
|
+
return readOnly === true || field.readOnly === true;
|
|
62
|
+
}
|
|
63
|
+
function inputElement(event) {
|
|
64
|
+
return event.target;
|
|
65
|
+
}
|
|
66
|
+
function fieldProps() {
|
|
67
|
+
return {
|
|
68
|
+
field: { type: Object, required: true },
|
|
69
|
+
id: { type: String, default: undefined },
|
|
70
|
+
name: { type: String, default: undefined },
|
|
71
|
+
value: { type: null, required: false },
|
|
72
|
+
error: { type: null, required: false },
|
|
73
|
+
disabled: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: undefined,
|
|
76
|
+
},
|
|
77
|
+
readOnly: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: undefined,
|
|
80
|
+
},
|
|
81
|
+
className: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: undefined,
|
|
84
|
+
},
|
|
85
|
+
inputClassName: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: undefined,
|
|
88
|
+
},
|
|
89
|
+
onBlur: {
|
|
90
|
+
type: Function,
|
|
91
|
+
default: undefined,
|
|
92
|
+
},
|
|
93
|
+
onValueChange: {
|
|
94
|
+
type: Function,
|
|
95
|
+
default: undefined,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function makeInputField(type) {
|
|
100
|
+
return defineComponent({
|
|
101
|
+
props: fieldProps(),
|
|
102
|
+
setup(props) {
|
|
103
|
+
return () => {
|
|
104
|
+
const inputId = fieldId(props.field, props.id);
|
|
105
|
+
const renderedValue = type === "date" || type === "datetime-local"
|
|
106
|
+
? dateValue(props.value, type)
|
|
107
|
+
: textValue(props.value);
|
|
108
|
+
return h(FieldShell, {
|
|
109
|
+
field: props.field,
|
|
110
|
+
id: inputId,
|
|
111
|
+
error: props.error,
|
|
112
|
+
className: props.className,
|
|
113
|
+
}, {
|
|
114
|
+
default: () => h(Input, {
|
|
115
|
+
id: inputId,
|
|
116
|
+
name: props.name ?? props.field.name,
|
|
117
|
+
type,
|
|
118
|
+
value: renderedValue,
|
|
119
|
+
placeholder: props.field.placeholder,
|
|
120
|
+
required: props.field.required,
|
|
121
|
+
disabled: commonDisabled(props.field, props.disabled),
|
|
122
|
+
readonly: commonReadOnly(props.field, props.readOnly),
|
|
123
|
+
class: props.inputClassName,
|
|
124
|
+
onBlur: props.onBlur,
|
|
125
|
+
onInput: (event) => {
|
|
126
|
+
const target = inputElement(event);
|
|
127
|
+
const nextValue = type === "number" ? target.valueAsNumber : target.value;
|
|
128
|
+
props.onValueChange?.(nextValue);
|
|
129
|
+
},
|
|
130
|
+
...fieldAriaProps(props.field, inputId, props.error),
|
|
131
|
+
...inputConstraints(props.field),
|
|
132
|
+
}),
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/** Renders a text input field. */
|
|
139
|
+
export const TextField = makeInputField("text");
|
|
140
|
+
/** Renders an email input field. */
|
|
141
|
+
export const EmailField = makeInputField("email");
|
|
142
|
+
/** Renders a numeric input field. */
|
|
143
|
+
export const NumberField = makeInputField("number");
|
|
144
|
+
/** Renders a date input field. */
|
|
145
|
+
export const DateField = makeInputField("date");
|
|
146
|
+
/** Renders a date-time input field. */
|
|
147
|
+
export const DateTimeField = makeInputField("datetime-local");
|
|
148
|
+
/** Renders a textarea field. */
|
|
149
|
+
export const TextareaField = defineComponent({
|
|
150
|
+
name: "TextareaField",
|
|
151
|
+
props: fieldProps(),
|
|
152
|
+
setup(props) {
|
|
153
|
+
return () => {
|
|
154
|
+
const inputId = fieldId(props.field, props.id);
|
|
155
|
+
return h(FieldShell, {
|
|
156
|
+
field: props.field,
|
|
157
|
+
id: inputId,
|
|
158
|
+
error: props.error,
|
|
159
|
+
className: props.className,
|
|
160
|
+
}, {
|
|
161
|
+
default: () => h(Textarea, {
|
|
162
|
+
id: inputId,
|
|
163
|
+
name: props.name ?? props.field.name,
|
|
164
|
+
value: textValue(props.value),
|
|
165
|
+
placeholder: props.field.placeholder,
|
|
166
|
+
required: props.field.required,
|
|
167
|
+
disabled: commonDisabled(props.field, props.disabled),
|
|
168
|
+
readonly: commonReadOnly(props.field, props.readOnly),
|
|
169
|
+
class: props.inputClassName,
|
|
170
|
+
onBlur: props.onBlur,
|
|
171
|
+
onInput: (event) => props.onValueChange?.(inputElement(event).value),
|
|
172
|
+
...fieldAriaProps(props.field, inputId, props.error),
|
|
173
|
+
...inputConstraints(props.field),
|
|
174
|
+
}),
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
/** Renders a select field from schema options. */
|
|
180
|
+
export const SelectField = defineComponent({
|
|
181
|
+
name: "SelectField",
|
|
182
|
+
props: fieldProps(),
|
|
183
|
+
setup(props) {
|
|
184
|
+
return () => {
|
|
185
|
+
const inputId = fieldId(props.field, props.id);
|
|
186
|
+
const options = props.field.options ?? [];
|
|
187
|
+
const valuesByKey = new Map(options.map((option) => [String(option.value), option.value]));
|
|
188
|
+
return h(FieldShell, {
|
|
189
|
+
field: props.field,
|
|
190
|
+
id: inputId,
|
|
191
|
+
error: props.error,
|
|
192
|
+
className: props.className,
|
|
193
|
+
}, {
|
|
194
|
+
default: () => h(Select, {
|
|
195
|
+
name: props.name ?? props.field.name,
|
|
196
|
+
value: textValue(props.value),
|
|
197
|
+
disabled: commonDisabled(props.field, props.disabled),
|
|
198
|
+
onValueChange: (nextValue) => {
|
|
199
|
+
if (nextValue === null) {
|
|
200
|
+
props.onValueChange?.(null);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
props.onValueChange?.(valuesByKey.get(nextValue) ?? nextValue);
|
|
204
|
+
},
|
|
205
|
+
}, {
|
|
206
|
+
default: () => [
|
|
207
|
+
h(SelectTrigger, {
|
|
208
|
+
id: inputId,
|
|
209
|
+
class: cn("w-full", props.inputClassName),
|
|
210
|
+
onBlur: props.onBlur,
|
|
211
|
+
...fieldAriaProps(props.field, inputId, props.error),
|
|
212
|
+
}, {
|
|
213
|
+
default: () => h(SelectValue, {
|
|
214
|
+
placeholder: props.field.placeholder ?? "Select...",
|
|
215
|
+
}),
|
|
216
|
+
}),
|
|
217
|
+
h(SelectContent, {}, {
|
|
218
|
+
default: () => options.map((option) => h(SelectItem, {
|
|
219
|
+
key: String(option.value),
|
|
220
|
+
value: String(option.value),
|
|
221
|
+
}, { default: () => option.label })),
|
|
222
|
+
}),
|
|
223
|
+
],
|
|
224
|
+
}),
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
/** Renders a boolean field as a checkbox. */
|
|
230
|
+
export const BooleanField = defineComponent({
|
|
231
|
+
name: "BooleanField",
|
|
232
|
+
props: fieldProps(),
|
|
233
|
+
setup(props) {
|
|
234
|
+
return () => {
|
|
235
|
+
const inputId = fieldId(props.field, props.id);
|
|
236
|
+
const isDisabled = commonDisabled(props.field, props.disabled) ||
|
|
237
|
+
commonReadOnly(props.field, props.readOnly);
|
|
238
|
+
return h(FieldShell, {
|
|
239
|
+
field: props.field,
|
|
240
|
+
id: inputId,
|
|
241
|
+
error: props.error,
|
|
242
|
+
className: props.className,
|
|
243
|
+
}, {
|
|
244
|
+
default: () => h("div", { class: "flex items-center gap-2" }, [
|
|
245
|
+
h(Checkbox, {
|
|
246
|
+
id: inputId,
|
|
247
|
+
name: props.name ?? props.field.name,
|
|
248
|
+
checked: props.value === true,
|
|
249
|
+
disabled: isDisabled,
|
|
250
|
+
class: props.inputClassName,
|
|
251
|
+
onCheckedChange: (nextValue) => props.onValueChange?.(nextValue === true),
|
|
252
|
+
...fieldAriaProps(props.field, inputId, props.error),
|
|
253
|
+
}),
|
|
254
|
+
]),
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
function makeUploadField(accept) {
|
|
260
|
+
return defineComponent({
|
|
261
|
+
props: fieldProps(),
|
|
262
|
+
setup(props) {
|
|
263
|
+
return () => {
|
|
264
|
+
const inputId = fieldId(props.field, props.id);
|
|
265
|
+
const constraints = inputConstraints(props.field);
|
|
266
|
+
return h(FieldShell, {
|
|
267
|
+
field: props.field,
|
|
268
|
+
id: inputId,
|
|
269
|
+
error: props.error,
|
|
270
|
+
className: props.className,
|
|
271
|
+
}, {
|
|
272
|
+
default: () => h("div", { class: "flex gap-2" }, [
|
|
273
|
+
h(Input, {
|
|
274
|
+
id: inputId,
|
|
275
|
+
name: props.name ?? props.field.name,
|
|
276
|
+
type: "file",
|
|
277
|
+
disabled: commonDisabled(props.field, props.disabled) ||
|
|
278
|
+
commonReadOnly(props.field, props.readOnly),
|
|
279
|
+
class: props.inputClassName,
|
|
280
|
+
onBlur: props.onBlur,
|
|
281
|
+
onChange: (event) => {
|
|
282
|
+
const files = inputElement(event).files;
|
|
283
|
+
if (files) {
|
|
284
|
+
props.onValueChange?.(files);
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
...fieldAriaProps(props.field, inputId, props.error),
|
|
288
|
+
...constraints,
|
|
289
|
+
accept: constraints.accept ?? accept,
|
|
290
|
+
}),
|
|
291
|
+
h(Button, {
|
|
292
|
+
type: "button",
|
|
293
|
+
variant: "outline",
|
|
294
|
+
disabled: true,
|
|
295
|
+
class: "hidden shrink-0 sm:inline-flex",
|
|
296
|
+
}, { default: () => "Browse" }),
|
|
297
|
+
]),
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
},
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/** Renders a file upload field. */
|
|
304
|
+
export const FileField = makeUploadField(undefined);
|
|
305
|
+
/** Renders an image upload field. */
|
|
306
|
+
export const ImageField = makeUploadField("image/*");
|