jsonforms-nuxt-ui-renderers 0.2.1 → 0.2.3
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/dist/index.cjs +370 -280
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +210 -120
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,10 +26,40 @@ import {
|
|
|
26
26
|
getFirstPrimitiveProp
|
|
27
27
|
} from "@jsonforms/core";
|
|
28
28
|
import { DispatchRenderer, rendererProps, useJsonFormsArrayControl } from "@jsonforms/vue";
|
|
29
|
-
import { computed as computed2, defineComponent, h, resolveComponent } from "vue";
|
|
29
|
+
import { computed as computed2, defineComponent, h as h2, resolveComponent } from "vue";
|
|
30
30
|
|
|
31
31
|
// src/renderers/util.ts
|
|
32
|
+
import { hasEnableRule } from "@jsonforms/core";
|
|
33
|
+
import { h } from "vue";
|
|
32
34
|
import { computed } from "vue";
|
|
35
|
+
function getDocsPathFromSchema(schema) {
|
|
36
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema))
|
|
37
|
+
return null;
|
|
38
|
+
const s = schema;
|
|
39
|
+
const path = s["x-docs-path"];
|
|
40
|
+
if (typeof path === "string" && path.startsWith("/")) return path;
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function renderDocsHintSlot(schema, label, docsUrl, resolveComponent10) {
|
|
44
|
+
const path = getDocsPathFromSchema(schema);
|
|
45
|
+
if (!path || !docsUrl) return void 0;
|
|
46
|
+
const ULink = resolveComponent10("ULink");
|
|
47
|
+
const UIcon = resolveComponent10("UIcon");
|
|
48
|
+
if (!ULink || !UIcon) return void 0;
|
|
49
|
+
const href = docsUrl(path);
|
|
50
|
+
return () => h(
|
|
51
|
+
ULink,
|
|
52
|
+
{
|
|
53
|
+
href,
|
|
54
|
+
target: "_blank",
|
|
55
|
+
rel: "noopener noreferrer",
|
|
56
|
+
class: "inline-flex items-center text-muted hover:text-primary",
|
|
57
|
+
"aria-label": `${label} docs`,
|
|
58
|
+
title: `${label} docs`
|
|
59
|
+
},
|
|
60
|
+
() => h(UIcon, { name: "i-heroicons-information-circle" })
|
|
61
|
+
);
|
|
62
|
+
}
|
|
33
63
|
function trimmedOrUndefined(input) {
|
|
34
64
|
const v = input?.trim();
|
|
35
65
|
return v ? v : void 0;
|
|
@@ -40,6 +70,37 @@ function controlDescription(control) {
|
|
|
40
70
|
const sd = control.schema?.description;
|
|
41
71
|
return typeof sd === "string" && sd.trim() ? sd.trim() : void 0;
|
|
42
72
|
}
|
|
73
|
+
function isSchemaReadOnly(schema) {
|
|
74
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return false;
|
|
75
|
+
return schema.readOnly === true;
|
|
76
|
+
}
|
|
77
|
+
function controlTextInputAttrs(control, jsonforms) {
|
|
78
|
+
const schemaRO = isSchemaReadOnly(control.schema);
|
|
79
|
+
if (!schemaRO) {
|
|
80
|
+
return { readonly: false, disabled: !control.enabled };
|
|
81
|
+
}
|
|
82
|
+
if (jsonforms?.readonly === true) {
|
|
83
|
+
return { readonly: false, disabled: !control.enabled };
|
|
84
|
+
}
|
|
85
|
+
const ui = control.uischema;
|
|
86
|
+
if (typeof ui?.options?.readonly === "boolean" && ui.options.readonly) {
|
|
87
|
+
return { readonly: false, disabled: !control.enabled };
|
|
88
|
+
}
|
|
89
|
+
if (typeof ui?.options?.readOnly === "boolean" && ui.options.readOnly) {
|
|
90
|
+
return { readonly: false, disabled: !control.enabled };
|
|
91
|
+
}
|
|
92
|
+
const cfg = control.config;
|
|
93
|
+
if (typeof cfg?.readonly === "boolean" && cfg.readonly) {
|
|
94
|
+
return { readonly: false, disabled: !control.enabled };
|
|
95
|
+
}
|
|
96
|
+
if (typeof cfg?.readOnly === "boolean" && cfg.readOnly) {
|
|
97
|
+
return { readonly: false, disabled: !control.enabled };
|
|
98
|
+
}
|
|
99
|
+
if (ui && hasEnableRule(ui) && !control.enabled) {
|
|
100
|
+
return { readonly: false, disabled: true };
|
|
101
|
+
}
|
|
102
|
+
return { readonly: true, disabled: false };
|
|
103
|
+
}
|
|
43
104
|
|
|
44
105
|
// src/renderers/complex/NuxtUiArrayListRenderer.ts
|
|
45
106
|
function createNuxtUiArrayListRenderer(theme) {
|
|
@@ -112,10 +173,10 @@ function createNuxtUiArrayListRenderer(theme) {
|
|
|
112
173
|
if (!control.value.visible) return null;
|
|
113
174
|
const UFormField = resolveComponent("UFormField");
|
|
114
175
|
const UButton = resolveComponent("UButton");
|
|
115
|
-
return
|
|
176
|
+
return h2(
|
|
116
177
|
"div",
|
|
117
178
|
{},
|
|
118
|
-
|
|
179
|
+
h2(
|
|
119
180
|
UFormField,
|
|
120
181
|
{
|
|
121
182
|
label: control.value.label,
|
|
@@ -124,14 +185,14 @@ function createNuxtUiArrayListRenderer(theme) {
|
|
|
124
185
|
error: errorMessage.value
|
|
125
186
|
},
|
|
126
187
|
{
|
|
127
|
-
default: () =>
|
|
128
|
-
|
|
129
|
-
|
|
188
|
+
default: () => h2("div", { class: theme.layoutVertical }, [
|
|
189
|
+
h2("div", { class: theme.flexBetween }, [
|
|
190
|
+
h2(
|
|
130
191
|
"div",
|
|
131
192
|
{ class: theme.textMutedXs },
|
|
132
193
|
`${items.value.length} items`
|
|
133
194
|
),
|
|
134
|
-
|
|
195
|
+
h2(
|
|
135
196
|
UButton,
|
|
136
197
|
{
|
|
137
198
|
type: "button",
|
|
@@ -144,26 +205,26 @@ function createNuxtUiArrayListRenderer(theme) {
|
|
|
144
205
|
{ default: () => "Add" }
|
|
145
206
|
)
|
|
146
207
|
]),
|
|
147
|
-
items.value.length === 0 ?
|
|
208
|
+
items.value.length === 0 ? h2("div", { class: theme.textMuted }, "No items.") : null,
|
|
148
209
|
...items.value.map(
|
|
149
|
-
(_item, index) =>
|
|
210
|
+
(_item, index) => h2(
|
|
150
211
|
"div",
|
|
151
212
|
{
|
|
152
213
|
key: `${control.value.path}-${index}`,
|
|
153
214
|
class: theme.panel
|
|
154
215
|
},
|
|
155
216
|
[
|
|
156
|
-
|
|
217
|
+
h2(
|
|
157
218
|
"div",
|
|
158
219
|
{ class: theme.arrayItemToolbar },
|
|
159
220
|
[
|
|
160
|
-
|
|
161
|
-
|
|
221
|
+
h2("div", { class: "jf-min-w-0" }, [
|
|
222
|
+
h2(
|
|
162
223
|
"div",
|
|
163
224
|
{ class: theme.textItemTitle },
|
|
164
225
|
[
|
|
165
226
|
`Item ${index + 1}`,
|
|
166
|
-
childLabelForIndex(index) ?
|
|
227
|
+
childLabelForIndex(index) ? h2(
|
|
167
228
|
"span",
|
|
168
229
|
{ class: theme.textItemSuffix },
|
|
169
230
|
` \u2014 ${childLabelForIndex(index)}`
|
|
@@ -171,8 +232,8 @@ function createNuxtUiArrayListRenderer(theme) {
|
|
|
171
232
|
]
|
|
172
233
|
)
|
|
173
234
|
]),
|
|
174
|
-
|
|
175
|
-
|
|
235
|
+
h2("div", { class: theme.flexActions }, [
|
|
236
|
+
h2(
|
|
176
237
|
UButton,
|
|
177
238
|
{
|
|
178
239
|
type: "button",
|
|
@@ -184,7 +245,7 @@ function createNuxtUiArrayListRenderer(theme) {
|
|
|
184
245
|
},
|
|
185
246
|
{ default: () => "Up" }
|
|
186
247
|
),
|
|
187
|
-
|
|
248
|
+
h2(
|
|
188
249
|
UButton,
|
|
189
250
|
{
|
|
190
251
|
type: "button",
|
|
@@ -196,7 +257,7 @@ function createNuxtUiArrayListRenderer(theme) {
|
|
|
196
257
|
},
|
|
197
258
|
{ default: () => "Down" }
|
|
198
259
|
),
|
|
199
|
-
|
|
260
|
+
h2(
|
|
200
261
|
UButton,
|
|
201
262
|
{
|
|
202
263
|
type: "button",
|
|
@@ -213,7 +274,7 @@ function createNuxtUiArrayListRenderer(theme) {
|
|
|
213
274
|
])
|
|
214
275
|
]
|
|
215
276
|
),
|
|
216
|
-
|
|
277
|
+
h2(DispatchRenderer, {
|
|
217
278
|
schema: control.value.schema,
|
|
218
279
|
uischema: childUiSchema.value,
|
|
219
280
|
path: composePaths(control.value.path, `${index}`),
|
|
@@ -240,7 +301,7 @@ import {
|
|
|
240
301
|
rendererProps as rendererProps2,
|
|
241
302
|
useJsonFormsControlWithDetail
|
|
242
303
|
} from "@jsonforms/vue";
|
|
243
|
-
import { computed as computed3, defineComponent as defineComponent2, h as
|
|
304
|
+
import { computed as computed3, defineComponent as defineComponent2, h as h3 } from "vue";
|
|
244
305
|
var NuxtUiObjectRenderer = defineComponent2({
|
|
245
306
|
name: "NuxtUiObjectRenderer",
|
|
246
307
|
components: { DispatchRenderer: DispatchRenderer2 },
|
|
@@ -277,7 +338,7 @@ var NuxtUiObjectRenderer = defineComponent2({
|
|
|
277
338
|
});
|
|
278
339
|
return () => {
|
|
279
340
|
if (!control.value.visible) return null;
|
|
280
|
-
return
|
|
341
|
+
return h3(DispatchRenderer2, {
|
|
281
342
|
visible: control.value.visible,
|
|
282
343
|
enabled: control.value.enabled,
|
|
283
344
|
schema: control.value.schema,
|
|
@@ -292,7 +353,7 @@ var NuxtUiObjectRenderer = defineComponent2({
|
|
|
292
353
|
|
|
293
354
|
// src/renderers/controls/NuxtUiBooleanControl.ts
|
|
294
355
|
import { rendererProps as rendererProps3, useJsonFormsControl } from "@jsonforms/vue";
|
|
295
|
-
import { computed as computed4, defineComponent as defineComponent3, h as
|
|
356
|
+
import { computed as computed4, defineComponent as defineComponent3, h as h4, resolveComponent as resolveComponent2 } from "vue";
|
|
296
357
|
function createNuxtUiBooleanControl(theme) {
|
|
297
358
|
return defineComponent3({
|
|
298
359
|
name: "NuxtUiBooleanControl",
|
|
@@ -310,10 +371,10 @@ function createNuxtUiBooleanControl(theme) {
|
|
|
310
371
|
if (!control.value.visible) return null;
|
|
311
372
|
const UFormField = resolveComponent2("UFormField");
|
|
312
373
|
const USwitch = resolveComponent2("USwitch");
|
|
313
|
-
return
|
|
374
|
+
return h4(
|
|
314
375
|
"div",
|
|
315
376
|
{},
|
|
316
|
-
|
|
377
|
+
h4(
|
|
317
378
|
UFormField,
|
|
318
379
|
{
|
|
319
380
|
label: control.value.label,
|
|
@@ -322,10 +383,10 @@ function createNuxtUiBooleanControl(theme) {
|
|
|
322
383
|
error: errorMessage.value
|
|
323
384
|
},
|
|
324
385
|
{
|
|
325
|
-
default: () =>
|
|
386
|
+
default: () => h4(
|
|
326
387
|
"div",
|
|
327
388
|
{ class: theme.flexBetween },
|
|
328
|
-
|
|
389
|
+
h4(USwitch, {
|
|
329
390
|
modelValue: modelValue.value,
|
|
330
391
|
disabled: !control.value.enabled,
|
|
331
392
|
"aria-invalid": Boolean(errorMessage.value),
|
|
@@ -344,7 +405,7 @@ function createNuxtUiBooleanControl(theme) {
|
|
|
344
405
|
|
|
345
406
|
// src/renderers/controls/NuxtUiEnumControl.ts
|
|
346
407
|
import { rendererProps as rendererProps4, useJsonFormsControl as useJsonFormsControl2 } from "@jsonforms/vue";
|
|
347
|
-
import { computed as computed5, defineComponent as defineComponent4, h as
|
|
408
|
+
import { computed as computed5, defineComponent as defineComponent4, h as h5, resolveComponent as resolveComponent3 } from "vue";
|
|
348
409
|
function schemaEnumOptions(schema) {
|
|
349
410
|
if (!schema) return [];
|
|
350
411
|
if (Array.isArray(schema.enum)) {
|
|
@@ -381,10 +442,10 @@ var NuxtUiEnumControl = defineComponent4({
|
|
|
381
442
|
if (!control.value.visible) return null;
|
|
382
443
|
const UFormField = resolveComponent3("UFormField");
|
|
383
444
|
const USelectMenu = resolveComponent3("USelectMenu");
|
|
384
|
-
return
|
|
445
|
+
return h5(
|
|
385
446
|
"div",
|
|
386
447
|
{},
|
|
387
|
-
|
|
448
|
+
h5(
|
|
388
449
|
UFormField,
|
|
389
450
|
{
|
|
390
451
|
label: control.value.label,
|
|
@@ -393,7 +454,7 @@ var NuxtUiEnumControl = defineComponent4({
|
|
|
393
454
|
error: errorMessage.value
|
|
394
455
|
},
|
|
395
456
|
{
|
|
396
|
-
default: () =>
|
|
457
|
+
default: () => h5(USelectMenu, {
|
|
397
458
|
modelValue: selectedValue.value,
|
|
398
459
|
items: options.value,
|
|
399
460
|
valueKey: "value",
|
|
@@ -415,7 +476,7 @@ var NuxtUiEnumControl = defineComponent4({
|
|
|
415
476
|
|
|
416
477
|
// src/renderers/controls/NuxtUiIntegerControl.ts
|
|
417
478
|
import { rendererProps as rendererProps5, useJsonFormsControl as useJsonFormsControl3 } from "@jsonforms/vue";
|
|
418
|
-
import { computed as computed6, defineComponent as defineComponent5, h as
|
|
479
|
+
import { computed as computed6, defineComponent as defineComponent5, h as h6, inject, resolveComponent as resolveComponent4 } from "vue";
|
|
419
480
|
var NuxtUiIntegerControl = defineComponent5({
|
|
420
481
|
name: "NuxtUiIntegerControl",
|
|
421
482
|
props: rendererProps5(),
|
|
@@ -423,6 +484,7 @@ var NuxtUiIntegerControl = defineComponent5({
|
|
|
423
484
|
const { control, handleChange } = useJsonFormsControl3(
|
|
424
485
|
props
|
|
425
486
|
);
|
|
487
|
+
const jsonforms = inject("jsonforms");
|
|
426
488
|
const errorMessage = computed6(() => trimmedOrUndefined(control.value.errors));
|
|
427
489
|
const modelValue = computed6(() => {
|
|
428
490
|
const v = control.value.data;
|
|
@@ -441,10 +503,11 @@ var NuxtUiIntegerControl = defineComponent5({
|
|
|
441
503
|
if (!control.value.visible) return null;
|
|
442
504
|
const UFormField = resolveComponent4("UFormField");
|
|
443
505
|
const UInput = resolveComponent4("UInput");
|
|
444
|
-
|
|
506
|
+
const { readonly, disabled } = controlTextInputAttrs(control.value, jsonforms);
|
|
507
|
+
return h6(
|
|
445
508
|
"div",
|
|
446
509
|
{},
|
|
447
|
-
|
|
510
|
+
h6(
|
|
448
511
|
UFormField,
|
|
449
512
|
{
|
|
450
513
|
label: control.value.label,
|
|
@@ -453,12 +516,13 @@ var NuxtUiIntegerControl = defineComponent5({
|
|
|
453
516
|
error: errorMessage.value
|
|
454
517
|
},
|
|
455
518
|
{
|
|
456
|
-
default: () =>
|
|
519
|
+
default: () => h6(UInput, {
|
|
457
520
|
type: "number",
|
|
458
521
|
inputmode: "numeric",
|
|
459
522
|
step: "1",
|
|
460
523
|
modelValue: modelValue.value,
|
|
461
|
-
|
|
524
|
+
readonly,
|
|
525
|
+
disabled,
|
|
462
526
|
color: errorMessage.value ? "error" : void 0,
|
|
463
527
|
"aria-invalid": Boolean(errorMessage.value),
|
|
464
528
|
"onUpdate:modelValue": onUpdate
|
|
@@ -472,7 +536,7 @@ var NuxtUiIntegerControl = defineComponent5({
|
|
|
472
536
|
|
|
473
537
|
// src/renderers/controls/NuxtUiMultiEnumControl.ts
|
|
474
538
|
import { rendererProps as rendererProps6, useJsonFormsControl as useJsonFormsControl4 } from "@jsonforms/vue";
|
|
475
|
-
import { computed as computed7, defineComponent as defineComponent6, h as
|
|
539
|
+
import { computed as computed7, defineComponent as defineComponent6, h as h7, resolveComponent as resolveComponent5 } from "vue";
|
|
476
540
|
function schemaEnumOptions2(schema) {
|
|
477
541
|
if (!schema) return [];
|
|
478
542
|
if (Array.isArray(schema.enum)) {
|
|
@@ -517,10 +581,10 @@ var NuxtUiMultiEnumControl = defineComponent6({
|
|
|
517
581
|
if (!control.value.visible) return null;
|
|
518
582
|
const UFormField = resolveComponent5("UFormField");
|
|
519
583
|
const USelectMenu = resolveComponent5("USelectMenu");
|
|
520
|
-
return
|
|
584
|
+
return h7(
|
|
521
585
|
"div",
|
|
522
586
|
{},
|
|
523
|
-
|
|
587
|
+
h7(
|
|
524
588
|
UFormField,
|
|
525
589
|
{
|
|
526
590
|
label: control.value.label,
|
|
@@ -529,7 +593,7 @@ var NuxtUiMultiEnumControl = defineComponent6({
|
|
|
529
593
|
error: errorMessage.value
|
|
530
594
|
},
|
|
531
595
|
{
|
|
532
|
-
default: () =>
|
|
596
|
+
default: () => h7(USelectMenu, {
|
|
533
597
|
multiple: true,
|
|
534
598
|
modelValue: selectedValues.value,
|
|
535
599
|
items: options.value,
|
|
@@ -552,7 +616,7 @@ var NuxtUiMultiEnumControl = defineComponent6({
|
|
|
552
616
|
|
|
553
617
|
// src/renderers/controls/NuxtUiNumberControl.ts
|
|
554
618
|
import { rendererProps as rendererProps7, useJsonFormsControl as useJsonFormsControl5 } from "@jsonforms/vue";
|
|
555
|
-
import { computed as computed8, defineComponent as defineComponent7, h as
|
|
619
|
+
import { computed as computed8, defineComponent as defineComponent7, h as h8, inject as inject2, resolveComponent as resolveComponent6 } from "vue";
|
|
556
620
|
var NuxtUiNumberControl = defineComponent7({
|
|
557
621
|
name: "NuxtUiNumberControl",
|
|
558
622
|
props: rendererProps7(),
|
|
@@ -560,6 +624,7 @@ var NuxtUiNumberControl = defineComponent7({
|
|
|
560
624
|
const { control, handleChange } = useJsonFormsControl5(
|
|
561
625
|
props
|
|
562
626
|
);
|
|
627
|
+
const jsonforms = inject2("jsonforms");
|
|
563
628
|
const errorMessage = computed8(() => trimmedOrUndefined(control.value.errors));
|
|
564
629
|
const modelValue = computed8(() => {
|
|
565
630
|
const v = control.value.data;
|
|
@@ -578,10 +643,11 @@ var NuxtUiNumberControl = defineComponent7({
|
|
|
578
643
|
if (!control.value.visible) return null;
|
|
579
644
|
const UFormField = resolveComponent6("UFormField");
|
|
580
645
|
const UInput = resolveComponent6("UInput");
|
|
581
|
-
|
|
646
|
+
const { readonly, disabled } = controlTextInputAttrs(control.value, jsonforms);
|
|
647
|
+
return h8(
|
|
582
648
|
"div",
|
|
583
649
|
{},
|
|
584
|
-
|
|
650
|
+
h8(
|
|
585
651
|
UFormField,
|
|
586
652
|
{
|
|
587
653
|
label: control.value.label,
|
|
@@ -590,11 +656,12 @@ var NuxtUiNumberControl = defineComponent7({
|
|
|
590
656
|
error: errorMessage.value
|
|
591
657
|
},
|
|
592
658
|
{
|
|
593
|
-
default: () =>
|
|
659
|
+
default: () => h8(UInput, {
|
|
594
660
|
type: "number",
|
|
595
661
|
inputmode: "decimal",
|
|
596
662
|
modelValue: modelValue.value,
|
|
597
|
-
|
|
663
|
+
readonly,
|
|
664
|
+
disabled,
|
|
598
665
|
color: errorMessage.value ? "error" : void 0,
|
|
599
666
|
"aria-invalid": Boolean(errorMessage.value),
|
|
600
667
|
"onUpdate:modelValue": onUpdate
|
|
@@ -608,7 +675,7 @@ var NuxtUiNumberControl = defineComponent7({
|
|
|
608
675
|
|
|
609
676
|
// src/renderers/controls/NuxtUiPasswordControl.ts
|
|
610
677
|
import { rendererProps as rendererProps8, useJsonFormsControl as useJsonFormsControl6 } from "@jsonforms/vue";
|
|
611
|
-
import { computed as computed9, defineComponent as defineComponent8, h as
|
|
678
|
+
import { computed as computed9, defineComponent as defineComponent8, h as h9, inject as inject3, ref, resolveComponent as resolveComponent7 } from "vue";
|
|
612
679
|
var NuxtUiPasswordControl = defineComponent8({
|
|
613
680
|
name: "NuxtUiPasswordControl",
|
|
614
681
|
props: rendererProps8(),
|
|
@@ -616,6 +683,7 @@ var NuxtUiPasswordControl = defineComponent8({
|
|
|
616
683
|
const { control, handleChange } = useJsonFormsControl6(
|
|
617
684
|
props
|
|
618
685
|
);
|
|
686
|
+
const jsonforms = inject3("jsonforms");
|
|
619
687
|
const errorMessage = computed9(() => trimmedOrUndefined(control.value.errors));
|
|
620
688
|
const showPassword = ref(false);
|
|
621
689
|
const inputType = computed9(() => showPassword.value ? "text" : "password");
|
|
@@ -624,10 +692,11 @@ var NuxtUiPasswordControl = defineComponent8({
|
|
|
624
692
|
const UFormField = resolveComponent7("UFormField");
|
|
625
693
|
const UInput = resolveComponent7("UInput");
|
|
626
694
|
const UButton = resolveComponent7("UButton");
|
|
627
|
-
|
|
695
|
+
const { readonly, disabled } = controlTextInputAttrs(control.value, jsonforms);
|
|
696
|
+
return h9(
|
|
628
697
|
"div",
|
|
629
698
|
{},
|
|
630
|
-
|
|
699
|
+
h9(
|
|
631
700
|
UFormField,
|
|
632
701
|
{
|
|
633
702
|
label: control.value.label,
|
|
@@ -636,20 +705,21 @@ var NuxtUiPasswordControl = defineComponent8({
|
|
|
636
705
|
error: errorMessage.value
|
|
637
706
|
},
|
|
638
707
|
{
|
|
639
|
-
default: () =>
|
|
708
|
+
default: () => h9(
|
|
640
709
|
UInput,
|
|
641
710
|
{
|
|
642
711
|
modelValue: control.value.data ?? "",
|
|
643
712
|
class: "w-full",
|
|
644
713
|
type: inputType.value,
|
|
645
714
|
autocomplete: "current-password",
|
|
646
|
-
|
|
715
|
+
readonly,
|
|
716
|
+
disabled,
|
|
647
717
|
color: errorMessage.value ? "error" : void 0,
|
|
648
718
|
"aria-invalid": Boolean(errorMessage.value),
|
|
649
719
|
"onUpdate:modelValue": (v) => handleChange(control.value.path, v)
|
|
650
720
|
},
|
|
651
721
|
{
|
|
652
|
-
trailing: () =>
|
|
722
|
+
trailing: () => h9(UButton, {
|
|
653
723
|
type: "button",
|
|
654
724
|
color: "neutral",
|
|
655
725
|
variant: "ghost",
|
|
@@ -657,7 +727,7 @@ var NuxtUiPasswordControl = defineComponent8({
|
|
|
657
727
|
icon: showPassword.value ? "i-heroicons-eye-slash" : "i-heroicons-eye",
|
|
658
728
|
"aria-pressed": showPassword.value,
|
|
659
729
|
"aria-label": showPassword.value ? "Hide password" : "Show password",
|
|
660
|
-
disabled
|
|
730
|
+
disabled,
|
|
661
731
|
onClick: () => {
|
|
662
732
|
showPassword.value = !showPassword.value;
|
|
663
733
|
}
|
|
@@ -676,51 +746,66 @@ import { rendererProps as rendererProps9, useJsonFormsControl as useJsonFormsCon
|
|
|
676
746
|
import {
|
|
677
747
|
computed as computed10,
|
|
678
748
|
defineComponent as defineComponent9,
|
|
679
|
-
h as
|
|
749
|
+
h as h10,
|
|
750
|
+
inject as inject4,
|
|
680
751
|
resolveComponent as resolveComponent8
|
|
681
752
|
} from "vue";
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
return
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
753
|
+
function createNuxtUiStringControl(docsUrl) {
|
|
754
|
+
return defineComponent9({
|
|
755
|
+
name: "NuxtUiStringControl",
|
|
756
|
+
props: rendererProps9(),
|
|
757
|
+
setup(props) {
|
|
758
|
+
const { control, handleChange } = useJsonFormsControl7(
|
|
759
|
+
props
|
|
760
|
+
);
|
|
761
|
+
const jsonforms = inject4("jsonforms");
|
|
762
|
+
const errorMessage = computed10(
|
|
763
|
+
() => trimmedOrUndefined(control.value.errors)
|
|
764
|
+
);
|
|
765
|
+
return () => {
|
|
766
|
+
if (!control.value.visible) return null;
|
|
767
|
+
const UFormField = resolveComponent8("UFormField");
|
|
768
|
+
const UInput = resolveComponent8("UInput");
|
|
769
|
+
const { readonly, disabled } = controlTextInputAttrs(
|
|
770
|
+
control.value,
|
|
771
|
+
jsonforms
|
|
772
|
+
);
|
|
773
|
+
const slots = {
|
|
774
|
+
default: () => h10(UInput, {
|
|
775
|
+
modelValue: control.value.data ?? "",
|
|
776
|
+
class: "w-full",
|
|
777
|
+
readonly,
|
|
778
|
+
disabled,
|
|
779
|
+
color: errorMessage.value ? "error" : void 0,
|
|
780
|
+
"aria-invalid": Boolean(errorMessage.value),
|
|
781
|
+
"onUpdate:modelValue": (v) => handleChange(control.value.path, v)
|
|
782
|
+
})
|
|
783
|
+
};
|
|
784
|
+
const hintSlot = renderDocsHintSlot(
|
|
785
|
+
control.value.schema,
|
|
786
|
+
control.value.label ?? "",
|
|
787
|
+
docsUrl,
|
|
788
|
+
resolveComponent8
|
|
789
|
+
);
|
|
790
|
+
if (hintSlot) slots.hint = hintSlot;
|
|
791
|
+
return h10(
|
|
792
|
+
"div",
|
|
793
|
+
{},
|
|
794
|
+
h10(UFormField, {
|
|
700
795
|
label: control.value.label,
|
|
701
796
|
description: controlDescription(control.value),
|
|
702
797
|
required: control.value.required,
|
|
703
798
|
error: errorMessage.value
|
|
704
|
-
},
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
color: errorMessage.value ? "error" : void 0,
|
|
711
|
-
"aria-invalid": Boolean(errorMessage.value),
|
|
712
|
-
"onUpdate:modelValue": (v) => handleChange(control.value.path, v)
|
|
713
|
-
})
|
|
714
|
-
}
|
|
715
|
-
)
|
|
716
|
-
);
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
});
|
|
799
|
+
}, slots)
|
|
800
|
+
);
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
}
|
|
720
805
|
|
|
721
806
|
// src/renderers/controls/NuxtUiTextareaControl.ts
|
|
722
807
|
import { rendererProps as rendererProps10, useJsonFormsControl as useJsonFormsControl8 } from "@jsonforms/vue";
|
|
723
|
-
import { computed as computed11, defineComponent as defineComponent10, h as
|
|
808
|
+
import { computed as computed11, defineComponent as defineComponent10, h as h11, inject as inject5, resolveComponent as resolveComponent9 } from "vue";
|
|
724
809
|
var NuxtUiTextareaControl = defineComponent10({
|
|
725
810
|
name: "NuxtUiTextareaControl",
|
|
726
811
|
props: rendererProps10(),
|
|
@@ -728,15 +813,17 @@ var NuxtUiTextareaControl = defineComponent10({
|
|
|
728
813
|
const { control, handleChange } = useJsonFormsControl8(
|
|
729
814
|
props
|
|
730
815
|
);
|
|
816
|
+
const jsonforms = inject5("jsonforms");
|
|
731
817
|
const errorMessage = computed11(() => trimmedOrUndefined(control.value.errors));
|
|
732
818
|
return () => {
|
|
733
819
|
if (!control.value.visible) return null;
|
|
734
820
|
const UFormField = resolveComponent9("UFormField");
|
|
735
821
|
const UTextarea = resolveComponent9("UTextarea");
|
|
736
|
-
|
|
822
|
+
const { readonly, disabled } = controlTextInputAttrs(control.value, jsonforms);
|
|
823
|
+
return h11(
|
|
737
824
|
"div",
|
|
738
825
|
{},
|
|
739
|
-
|
|
826
|
+
h11(
|
|
740
827
|
UFormField,
|
|
741
828
|
{
|
|
742
829
|
label: control.value.label,
|
|
@@ -745,10 +832,11 @@ var NuxtUiTextareaControl = defineComponent10({
|
|
|
745
832
|
error: errorMessage.value
|
|
746
833
|
},
|
|
747
834
|
{
|
|
748
|
-
default: () =>
|
|
835
|
+
default: () => h11(UTextarea, {
|
|
749
836
|
modelValue: control.value.data ?? "",
|
|
750
837
|
class: "w-full",
|
|
751
|
-
|
|
838
|
+
readonly,
|
|
839
|
+
disabled,
|
|
752
840
|
color: errorMessage.value ? "error" : void 0,
|
|
753
841
|
"aria-invalid": Boolean(errorMessage.value),
|
|
754
842
|
rows: 5,
|
|
@@ -763,7 +851,7 @@ var NuxtUiTextareaControl = defineComponent10({
|
|
|
763
851
|
|
|
764
852
|
// src/renderers/layouts/NuxtUiCategorizationRenderer.ts
|
|
765
853
|
import { DispatchRenderer as DispatchRenderer3, rendererProps as rendererProps11, useJsonFormsCategorization } from "@jsonforms/vue";
|
|
766
|
-
import { defineComponent as defineComponent11, h as
|
|
854
|
+
import { defineComponent as defineComponent11, h as h12 } from "vue";
|
|
767
855
|
function createNuxtUiCategorizationRenderer(theme) {
|
|
768
856
|
return defineComponent11({
|
|
769
857
|
name: "NuxtUiCategorizationRenderer",
|
|
@@ -775,28 +863,28 @@ function createNuxtUiCategorizationRenderer(theme) {
|
|
|
775
863
|
);
|
|
776
864
|
return () => {
|
|
777
865
|
if (!layout.value.visible) return null;
|
|
778
|
-
return
|
|
866
|
+
return h12(
|
|
779
867
|
"div",
|
|
780
868
|
{ class: theme.layoutVerticalWide },
|
|
781
869
|
categories.map((categoryRef, catIndex) => {
|
|
782
870
|
const category = categoryRef.value;
|
|
783
871
|
const elements = category.uischema.elements ?? [];
|
|
784
|
-
return
|
|
872
|
+
return h12(
|
|
785
873
|
"div",
|
|
786
874
|
{
|
|
787
875
|
key: `${layout.value.path}-cat-${catIndex}`,
|
|
788
876
|
class: theme.layoutVertical
|
|
789
877
|
},
|
|
790
878
|
[
|
|
791
|
-
category.label ?
|
|
792
|
-
|
|
879
|
+
category.label ? h12("div", { class: theme.labelSection }, category.label) : null,
|
|
880
|
+
h12(
|
|
793
881
|
"div",
|
|
794
882
|
{ class: theme.layoutVertical },
|
|
795
883
|
elements.map(
|
|
796
|
-
(element, index) =>
|
|
884
|
+
(element, index) => h12(
|
|
797
885
|
"div",
|
|
798
886
|
{ key: `${category.path}-${index}` },
|
|
799
|
-
|
|
887
|
+
h12(DispatchRenderer3, {
|
|
800
888
|
schema: category.schema,
|
|
801
889
|
uischema: element,
|
|
802
890
|
path: category.path,
|
|
@@ -818,7 +906,7 @@ function createNuxtUiCategorizationRenderer(theme) {
|
|
|
818
906
|
|
|
819
907
|
// src/renderers/layouts/NuxtUiCategoryRenderer.ts
|
|
820
908
|
import { DispatchRenderer as DispatchRenderer4, rendererProps as rendererProps12, useJsonFormsLayout } from "@jsonforms/vue";
|
|
821
|
-
import { defineComponent as defineComponent12, h as
|
|
909
|
+
import { defineComponent as defineComponent12, h as h13 } from "vue";
|
|
822
910
|
function createNuxtUiCategoryRenderer(theme) {
|
|
823
911
|
return defineComponent12({
|
|
824
912
|
name: "NuxtUiCategoryRenderer",
|
|
@@ -831,16 +919,16 @@ function createNuxtUiCategoryRenderer(theme) {
|
|
|
831
919
|
return () => {
|
|
832
920
|
if (!layout.value.visible) return null;
|
|
833
921
|
const elements = layout.value.uischema.elements ?? [];
|
|
834
|
-
return
|
|
835
|
-
layout.value.label ?
|
|
836
|
-
|
|
922
|
+
return h13("div", { class: theme.layoutVertical }, [
|
|
923
|
+
layout.value.label ? h13("div", { class: theme.labelSection }, layout.value.label) : null,
|
|
924
|
+
h13(
|
|
837
925
|
"div",
|
|
838
926
|
{ class: theme.layoutVertical },
|
|
839
927
|
elements.map(
|
|
840
|
-
(element, index) =>
|
|
928
|
+
(element, index) => h13(
|
|
841
929
|
"div",
|
|
842
930
|
{ key: `${layout.value.path}-${index}` },
|
|
843
|
-
|
|
931
|
+
h13(DispatchRenderer4, {
|
|
844
932
|
schema: layout.value.schema,
|
|
845
933
|
uischema: element,
|
|
846
934
|
path: layout.value.path,
|
|
@@ -859,7 +947,7 @@ function createNuxtUiCategoryRenderer(theme) {
|
|
|
859
947
|
|
|
860
948
|
// src/renderers/layouts/NuxtUiGroupRenderer.ts
|
|
861
949
|
import { DispatchRenderer as DispatchRenderer5, rendererProps as rendererProps13, useJsonFormsLayout as useJsonFormsLayout2 } from "@jsonforms/vue";
|
|
862
|
-
import { defineComponent as defineComponent13, h as
|
|
950
|
+
import { defineComponent as defineComponent13, h as h14 } from "vue";
|
|
863
951
|
function createNuxtUiGroupRenderer(theme) {
|
|
864
952
|
return defineComponent13({
|
|
865
953
|
name: "NuxtUiGroupRenderer",
|
|
@@ -874,19 +962,19 @@ function createNuxtUiGroupRenderer(theme) {
|
|
|
874
962
|
const elements = layout.value.uischema.elements ?? [];
|
|
875
963
|
const isNested = layout.value.path?.includes(".") ?? false;
|
|
876
964
|
const containerClass = isNested ? theme.groupNested : theme.panel;
|
|
877
|
-
return
|
|
965
|
+
return h14(
|
|
878
966
|
"div",
|
|
879
967
|
{ class: containerClass },
|
|
880
968
|
[
|
|
881
|
-
layout.value.label ?
|
|
882
|
-
|
|
969
|
+
layout.value.label ? h14("div", { class: theme.labelSectionSpaced }, layout.value.label) : null,
|
|
970
|
+
h14(
|
|
883
971
|
"div",
|
|
884
972
|
{ class: theme.layoutVertical },
|
|
885
973
|
elements.map(
|
|
886
|
-
(element, index) =>
|
|
974
|
+
(element, index) => h14(
|
|
887
975
|
"div",
|
|
888
976
|
{ key: `${layout.value.path}-${index}` },
|
|
889
|
-
|
|
977
|
+
h14(DispatchRenderer5, {
|
|
890
978
|
schema: layout.value.schema,
|
|
891
979
|
uischema: element,
|
|
892
980
|
path: layout.value.path,
|
|
@@ -906,7 +994,7 @@ function createNuxtUiGroupRenderer(theme) {
|
|
|
906
994
|
|
|
907
995
|
// src/renderers/layouts/NuxtUiHorizontalLayoutRenderer.ts
|
|
908
996
|
import { DispatchRenderer as DispatchRenderer6, rendererProps as rendererProps14, useJsonFormsLayout as useJsonFormsLayout3 } from "@jsonforms/vue";
|
|
909
|
-
import { defineComponent as defineComponent14, h as
|
|
997
|
+
import { defineComponent as defineComponent14, h as h15 } from "vue";
|
|
910
998
|
function createNuxtUiHorizontalLayoutRenderer(theme) {
|
|
911
999
|
return defineComponent14({
|
|
912
1000
|
name: "NuxtUiHorizontalLayoutRenderer",
|
|
@@ -919,17 +1007,17 @@ function createNuxtUiHorizontalLayoutRenderer(theme) {
|
|
|
919
1007
|
return () => {
|
|
920
1008
|
if (!layout.value.visible) return null;
|
|
921
1009
|
const elements = layout.value.uischema.elements ?? [];
|
|
922
|
-
return
|
|
1010
|
+
return h15(
|
|
923
1011
|
"div",
|
|
924
1012
|
{ class: theme.layoutHorizontal },
|
|
925
1013
|
elements.map(
|
|
926
|
-
(element, index) =>
|
|
1014
|
+
(element, index) => h15(
|
|
927
1015
|
"div",
|
|
928
1016
|
{
|
|
929
1017
|
key: `${layout.value.path}-${index}`,
|
|
930
1018
|
class: theme.layoutHorizontalItem
|
|
931
1019
|
},
|
|
932
|
-
|
|
1020
|
+
h15(DispatchRenderer6, {
|
|
933
1021
|
schema: layout.value.schema,
|
|
934
1022
|
uischema: element,
|
|
935
1023
|
path: layout.value.path,
|
|
@@ -947,7 +1035,7 @@ function createNuxtUiHorizontalLayoutRenderer(theme) {
|
|
|
947
1035
|
|
|
948
1036
|
// src/renderers/layouts/NuxtUiLabelRenderer.ts
|
|
949
1037
|
import { rendererProps as rendererProps15, useJsonFormsLabel } from "@jsonforms/vue";
|
|
950
|
-
import { defineComponent as defineComponent15, h as
|
|
1038
|
+
import { defineComponent as defineComponent15, h as h16 } from "vue";
|
|
951
1039
|
function createNuxtUiLabelRenderer(theme) {
|
|
952
1040
|
return defineComponent15({
|
|
953
1041
|
name: "NuxtUiLabelRenderer",
|
|
@@ -958,7 +1046,7 @@ function createNuxtUiLabelRenderer(theme) {
|
|
|
958
1046
|
);
|
|
959
1047
|
return () => {
|
|
960
1048
|
if (!label.value.visible) return null;
|
|
961
|
-
return
|
|
1049
|
+
return h16("div", { class: theme.textLabel }, label.value.text);
|
|
962
1050
|
};
|
|
963
1051
|
}
|
|
964
1052
|
});
|
|
@@ -966,7 +1054,7 @@ function createNuxtUiLabelRenderer(theme) {
|
|
|
966
1054
|
|
|
967
1055
|
// src/renderers/layouts/NuxtUiVerticalLayoutRenderer.ts
|
|
968
1056
|
import { DispatchRenderer as DispatchRenderer7, rendererProps as rendererProps16, useJsonFormsLayout as useJsonFormsLayout4 } from "@jsonforms/vue";
|
|
969
|
-
import { defineComponent as defineComponent16, h as
|
|
1057
|
+
import { defineComponent as defineComponent16, h as h17 } from "vue";
|
|
970
1058
|
function createNuxtUiVerticalLayoutRenderer(theme) {
|
|
971
1059
|
return defineComponent16({
|
|
972
1060
|
name: "NuxtUiVerticalLayoutRenderer",
|
|
@@ -979,14 +1067,14 @@ function createNuxtUiVerticalLayoutRenderer(theme) {
|
|
|
979
1067
|
return () => {
|
|
980
1068
|
if (!layout.value.visible) return null;
|
|
981
1069
|
const elements = layout.value.uischema.elements ?? [];
|
|
982
|
-
return
|
|
1070
|
+
return h17(
|
|
983
1071
|
"div",
|
|
984
1072
|
{ class: theme.layoutVertical },
|
|
985
1073
|
elements.map(
|
|
986
|
-
(element, index) =>
|
|
1074
|
+
(element, index) => h17(
|
|
987
1075
|
"div",
|
|
988
1076
|
{ key: `${layout.value.path}-${index}` },
|
|
989
|
-
|
|
1077
|
+
h17(DispatchRenderer7, {
|
|
990
1078
|
schema: layout.value.schema,
|
|
991
1079
|
uischema: element,
|
|
992
1080
|
path: layout.value.path,
|
|
@@ -1074,6 +1162,7 @@ var isOneOfEnumControl = (uischema, schema, context) => {
|
|
|
1074
1162
|
};
|
|
1075
1163
|
function createNuxtUiRenderers(options) {
|
|
1076
1164
|
const theme = mergeTheme(options?.theme);
|
|
1165
|
+
const docsUrl = options?.docsUrl;
|
|
1077
1166
|
return [
|
|
1078
1167
|
// Layouts
|
|
1079
1168
|
{
|
|
@@ -1148,7 +1237,7 @@ function createNuxtUiRenderers(options) {
|
|
|
1148
1237
|
},
|
|
1149
1238
|
{
|
|
1150
1239
|
tester: rankWith(RANK, isStringControl),
|
|
1151
|
-
renderer: markRaw(
|
|
1240
|
+
renderer: markRaw(createNuxtUiStringControl(docsUrl))
|
|
1152
1241
|
}
|
|
1153
1242
|
];
|
|
1154
1243
|
}
|
|
@@ -1157,6 +1246,7 @@ export {
|
|
|
1157
1246
|
controlDescription,
|
|
1158
1247
|
createNuxtUiRenderers,
|
|
1159
1248
|
defaultTheme,
|
|
1249
|
+
getDocsPathFromSchema,
|
|
1160
1250
|
mergeTheme,
|
|
1161
1251
|
nuxtUiRenderers
|
|
1162
1252
|
};
|