jsonforms-nuxt-ui-renderers 0.1.7 → 0.2.0
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/README.md +23 -0
- package/dist/index.cjs +545 -490
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.js +542 -490
- package/dist/index.js.map +1 -1
- package/dist/styles.css +138 -0
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.cts +2 -0
- package/dist/styles.d.ts +2 -0
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -36,197 +36,196 @@ function trimmedOrUndefined(input) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// src/renderers/complex/NuxtUiArrayListRenderer.ts
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
function createNuxtUiArrayListRenderer(theme) {
|
|
40
|
+
return defineComponent({
|
|
41
|
+
name: "NuxtUiArrayListRenderer",
|
|
42
|
+
components: { DispatchRenderer },
|
|
43
|
+
props: rendererProps(),
|
|
44
|
+
setup(props) {
|
|
45
|
+
const { control, addItem, removeItems, moveUp, moveDown } = useJsonFormsArrayControl(
|
|
46
|
+
props
|
|
47
|
+
);
|
|
48
|
+
const errorMessage = computed2(() => trimmedOrUndefined(control.value.errors));
|
|
49
|
+
const items = computed2(
|
|
50
|
+
() => Array.isArray(control.value.data) ? control.value.data : []
|
|
51
|
+
);
|
|
52
|
+
const arraySchema = computed2(() => {
|
|
53
|
+
try {
|
|
54
|
+
return Resolve.schema(
|
|
55
|
+
props.schema,
|
|
56
|
+
control.value.uischema.scope,
|
|
57
|
+
control.value.rootSchema
|
|
58
|
+
);
|
|
59
|
+
} catch {
|
|
60
|
+
return void 0;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const maxItemsReached = computed2(() => {
|
|
64
|
+
const max = arraySchema.value?.maxItems;
|
|
65
|
+
return typeof max === "number" ? items.value.length >= max : false;
|
|
66
|
+
});
|
|
67
|
+
const minItemsReached = computed2(() => {
|
|
68
|
+
const min = arraySchema.value?.minItems;
|
|
69
|
+
return typeof min === "number" ? items.value.length <= min : false;
|
|
70
|
+
});
|
|
71
|
+
const childUiSchema = computed2(
|
|
72
|
+
() => findUISchema(
|
|
73
|
+
control.value.uischemas,
|
|
74
|
+
control.value.schema,
|
|
55
75
|
control.value.uischema.scope,
|
|
76
|
+
control.value.path,
|
|
77
|
+
void 0,
|
|
78
|
+
control.value.uischema,
|
|
56
79
|
control.value.rootSchema
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
function childLabelForIndex(index) {
|
|
83
|
+
const childLabelProp = getChildLabelPropFromUiSchemaOptions(control.value.uischema.options) ?? getFirstPrimitiveProp(control.value.schema);
|
|
84
|
+
if (!childLabelProp) return `${index}`;
|
|
85
|
+
const labelValue = Resolve.data(
|
|
86
|
+
control.value.data,
|
|
87
|
+
composePaths(`${index}`, childLabelProp)
|
|
57
88
|
);
|
|
58
|
-
|
|
59
|
-
|
|
89
|
+
if (labelValue === void 0 || labelValue === null || Number.isNaN(labelValue)) {
|
|
90
|
+
return "";
|
|
91
|
+
}
|
|
92
|
+
return String(labelValue);
|
|
60
93
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
const minItemsReached = computed2(() => {
|
|
67
|
-
const min = arraySchema.value?.minItems;
|
|
68
|
-
return typeof min === "number" ? items.value.length <= min : false;
|
|
69
|
-
});
|
|
70
|
-
const childUiSchema = computed2(
|
|
71
|
-
() => findUISchema(
|
|
72
|
-
control.value.uischemas,
|
|
73
|
-
control.value.schema,
|
|
74
|
-
control.value.uischema.scope,
|
|
75
|
-
control.value.path,
|
|
76
|
-
void 0,
|
|
77
|
-
control.value.uischema,
|
|
78
|
-
control.value.rootSchema
|
|
79
|
-
)
|
|
80
|
-
);
|
|
81
|
-
function childLabelForIndex(index) {
|
|
82
|
-
const childLabelProp = getChildLabelPropFromUiSchemaOptions(control.value.uischema.options) ?? getFirstPrimitiveProp(control.value.schema);
|
|
83
|
-
if (!childLabelProp) return `${index}`;
|
|
84
|
-
const labelValue = Resolve.data(
|
|
85
|
-
control.value.data,
|
|
86
|
-
composePaths(`${index}`, childLabelProp)
|
|
87
|
-
);
|
|
88
|
-
if (labelValue === void 0 || labelValue === null || Number.isNaN(labelValue)) {
|
|
89
|
-
return "";
|
|
94
|
+
function getChildLabelPropFromUiSchemaOptions(options) {
|
|
95
|
+
if (!options || typeof options !== "object") return void 0;
|
|
96
|
+
const value = options.childLabelProp;
|
|
97
|
+
return typeof value === "string" ? value : void 0;
|
|
90
98
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
h(DispatchRenderer, {
|
|
213
|
-
schema: control.value.schema,
|
|
214
|
-
uischema: childUiSchema.value,
|
|
215
|
-
path: composePaths(control.value.path, `${index}`),
|
|
216
|
-
enabled: control.value.enabled,
|
|
217
|
-
renderers: control.value.renderers,
|
|
218
|
-
cells: control.value.cells
|
|
219
|
-
})
|
|
220
|
-
]
|
|
99
|
+
function addButtonClick() {
|
|
100
|
+
addItem(
|
|
101
|
+
control.value.path,
|
|
102
|
+
createDefaultValue(control.value.schema, control.value.rootSchema)
|
|
103
|
+
)();
|
|
104
|
+
}
|
|
105
|
+
return () => {
|
|
106
|
+
if (!control.value.visible) return null;
|
|
107
|
+
const UFormField = resolveComponent("UFormField");
|
|
108
|
+
const UButton = resolveComponent("UButton");
|
|
109
|
+
return h(
|
|
110
|
+
"div",
|
|
111
|
+
{},
|
|
112
|
+
h(
|
|
113
|
+
UFormField,
|
|
114
|
+
{
|
|
115
|
+
label: control.value.label,
|
|
116
|
+
description: control.value.description,
|
|
117
|
+
required: control.value.required,
|
|
118
|
+
error: errorMessage.value
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
default: () => h("div", { class: theme.layoutVertical }, [
|
|
122
|
+
h("div", { class: theme.flexBetween }, [
|
|
123
|
+
h(
|
|
124
|
+
"div",
|
|
125
|
+
{ class: theme.textMutedXs },
|
|
126
|
+
`${items.value.length} items`
|
|
127
|
+
),
|
|
128
|
+
h(
|
|
129
|
+
UButton,
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
size: "xs",
|
|
133
|
+
variant: "soft",
|
|
134
|
+
color: "neutral",
|
|
135
|
+
disabled: !control.value.enabled || maxItemsReached.value,
|
|
136
|
+
onClick: addButtonClick
|
|
137
|
+
},
|
|
138
|
+
{ default: () => "Add" }
|
|
139
|
+
)
|
|
140
|
+
]),
|
|
141
|
+
items.value.length === 0 ? h("div", { class: theme.textMuted }, "No items.") : null,
|
|
142
|
+
...items.value.map(
|
|
143
|
+
(_item, index) => h(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
key: `${control.value.path}-${index}`,
|
|
147
|
+
class: theme.panel
|
|
148
|
+
},
|
|
149
|
+
[
|
|
150
|
+
h(
|
|
151
|
+
"div",
|
|
152
|
+
{ class: theme.arrayItemToolbar },
|
|
153
|
+
[
|
|
154
|
+
h("div", { class: "jf-min-w-0" }, [
|
|
155
|
+
h(
|
|
156
|
+
"div",
|
|
157
|
+
{ class: theme.textItemTitle },
|
|
158
|
+
[
|
|
159
|
+
`Item ${index + 1}`,
|
|
160
|
+
childLabelForIndex(index) ? h(
|
|
161
|
+
"span",
|
|
162
|
+
{ class: theme.textItemSuffix },
|
|
163
|
+
` \u2014 ${childLabelForIndex(index)}`
|
|
164
|
+
) : null
|
|
165
|
+
]
|
|
166
|
+
)
|
|
167
|
+
]),
|
|
168
|
+
h("div", { class: theme.flexActions }, [
|
|
169
|
+
h(
|
|
170
|
+
UButton,
|
|
171
|
+
{
|
|
172
|
+
type: "button",
|
|
173
|
+
size: "xs",
|
|
174
|
+
variant: "ghost",
|
|
175
|
+
color: "neutral",
|
|
176
|
+
disabled: !control.value.enabled || index === 0,
|
|
177
|
+
onClick: () => moveUp?.(control.value.path, index)()
|
|
178
|
+
},
|
|
179
|
+
{ default: () => "Up" }
|
|
180
|
+
),
|
|
181
|
+
h(
|
|
182
|
+
UButton,
|
|
183
|
+
{
|
|
184
|
+
type: "button",
|
|
185
|
+
size: "xs",
|
|
186
|
+
variant: "ghost",
|
|
187
|
+
color: "neutral",
|
|
188
|
+
disabled: !control.value.enabled || index >= items.value.length - 1,
|
|
189
|
+
onClick: () => moveDown?.(control.value.path, index)()
|
|
190
|
+
},
|
|
191
|
+
{ default: () => "Down" }
|
|
192
|
+
),
|
|
193
|
+
h(
|
|
194
|
+
UButton,
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
size: "xs",
|
|
198
|
+
variant: "ghost",
|
|
199
|
+
color: "error",
|
|
200
|
+
disabled: !control.value.enabled || minItemsReached.value,
|
|
201
|
+
onClick: () => removeItems?.(control.value.path, [
|
|
202
|
+
index
|
|
203
|
+
])()
|
|
204
|
+
},
|
|
205
|
+
{ default: () => "Remove" }
|
|
206
|
+
)
|
|
207
|
+
])
|
|
208
|
+
]
|
|
209
|
+
),
|
|
210
|
+
h(DispatchRenderer, {
|
|
211
|
+
schema: control.value.schema,
|
|
212
|
+
uischema: childUiSchema.value,
|
|
213
|
+
path: composePaths(control.value.path, `${index}`),
|
|
214
|
+
enabled: control.value.enabled,
|
|
215
|
+
renderers: control.value.renderers,
|
|
216
|
+
cells: control.value.cells
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
)
|
|
221
220
|
)
|
|
222
|
-
)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
221
|
+
])
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
);
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
230
229
|
|
|
231
230
|
// src/renderers/complex/NuxtUiObjectRenderer.ts
|
|
232
231
|
import { Generate, findUISchema as findUISchema2 } from "@jsonforms/core";
|
|
@@ -288,52 +287,54 @@ var NuxtUiObjectRenderer = defineComponent2({
|
|
|
288
287
|
// src/renderers/controls/NuxtUiBooleanControl.ts
|
|
289
288
|
import { rendererProps as rendererProps3, useJsonFormsControl } from "@jsonforms/vue";
|
|
290
289
|
import { computed as computed4, defineComponent as defineComponent3, h as h3, resolveComponent as resolveComponent2 } from "vue";
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
const errorMessage = computed4(() => trimmedOrUndefined(control.value.errors));
|
|
299
|
-
const modelValue = computed4({
|
|
300
|
-
get: () => Boolean(control.value.data),
|
|
301
|
-
set: (v) => handleChange(control.value.path, v)
|
|
302
|
-
});
|
|
303
|
-
return () => {
|
|
304
|
-
if (!control.value.visible) return null;
|
|
305
|
-
const UFormField = resolveComponent2("UFormField");
|
|
306
|
-
const USwitch = resolveComponent2("USwitch");
|
|
307
|
-
return h3(
|
|
308
|
-
"div",
|
|
309
|
-
{},
|
|
310
|
-
h3(
|
|
311
|
-
UFormField,
|
|
312
|
-
{
|
|
313
|
-
label: control.value.label,
|
|
314
|
-
description: control.value.description,
|
|
315
|
-
required: control.value.required,
|
|
316
|
-
error: errorMessage.value
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
default: () => h3(
|
|
320
|
-
"div",
|
|
321
|
-
{ class: "flex items-center justify-between gap-3" },
|
|
322
|
-
h3(USwitch, {
|
|
323
|
-
modelValue: modelValue.value,
|
|
324
|
-
disabled: !control.value.enabled,
|
|
325
|
-
"aria-invalid": Boolean(errorMessage.value),
|
|
326
|
-
"onUpdate:modelValue": (v) => {
|
|
327
|
-
modelValue.value = v;
|
|
328
|
-
}
|
|
329
|
-
})
|
|
330
|
-
)
|
|
331
|
-
}
|
|
332
|
-
)
|
|
290
|
+
function createNuxtUiBooleanControl(theme) {
|
|
291
|
+
return defineComponent3({
|
|
292
|
+
name: "NuxtUiBooleanControl",
|
|
293
|
+
props: rendererProps3(),
|
|
294
|
+
setup(props) {
|
|
295
|
+
const { control, handleChange } = useJsonFormsControl(
|
|
296
|
+
props
|
|
333
297
|
);
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
298
|
+
const errorMessage = computed4(() => trimmedOrUndefined(control.value.errors));
|
|
299
|
+
const modelValue = computed4({
|
|
300
|
+
get: () => Boolean(control.value.data),
|
|
301
|
+
set: (v) => handleChange(control.value.path, v)
|
|
302
|
+
});
|
|
303
|
+
return () => {
|
|
304
|
+
if (!control.value.visible) return null;
|
|
305
|
+
const UFormField = resolveComponent2("UFormField");
|
|
306
|
+
const USwitch = resolveComponent2("USwitch");
|
|
307
|
+
return h3(
|
|
308
|
+
"div",
|
|
309
|
+
{},
|
|
310
|
+
h3(
|
|
311
|
+
UFormField,
|
|
312
|
+
{
|
|
313
|
+
label: control.value.label,
|
|
314
|
+
description: control.value.description,
|
|
315
|
+
required: control.value.required,
|
|
316
|
+
error: errorMessage.value
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
default: () => h3(
|
|
320
|
+
"div",
|
|
321
|
+
{ class: theme.flexBetween },
|
|
322
|
+
h3(USwitch, {
|
|
323
|
+
modelValue: modelValue.value,
|
|
324
|
+
disabled: !control.value.enabled,
|
|
325
|
+
"aria-invalid": Boolean(errorMessage.value),
|
|
326
|
+
"onUpdate:modelValue": (v) => {
|
|
327
|
+
modelValue.value = v;
|
|
328
|
+
}
|
|
329
|
+
})
|
|
330
|
+
)
|
|
331
|
+
}
|
|
332
|
+
)
|
|
333
|
+
);
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
337
338
|
|
|
338
339
|
// src/renderers/controls/NuxtUiEnumControl.ts
|
|
339
340
|
import { rendererProps as rendererProps4, useJsonFormsControl as useJsonFormsControl2 } from "@jsonforms/vue";
|
|
@@ -757,116 +758,172 @@ var NuxtUiTextareaControl = defineComponent10({
|
|
|
757
758
|
// src/renderers/layouts/NuxtUiCategorizationRenderer.ts
|
|
758
759
|
import { DispatchRenderer as DispatchRenderer3, rendererProps as rendererProps11, useJsonFormsCategorization } from "@jsonforms/vue";
|
|
759
760
|
import { defineComponent as defineComponent11, h as h11 } from "vue";
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
761
|
+
function createNuxtUiCategorizationRenderer(theme) {
|
|
762
|
+
return defineComponent11({
|
|
763
|
+
name: "NuxtUiCategorizationRenderer",
|
|
764
|
+
components: { DispatchRenderer: DispatchRenderer3 },
|
|
765
|
+
props: rendererProps11(),
|
|
766
|
+
setup(props) {
|
|
767
|
+
const { layout, categories } = useJsonFormsCategorization(
|
|
768
|
+
props
|
|
769
|
+
);
|
|
770
|
+
return () => {
|
|
771
|
+
if (!layout.value.visible) return null;
|
|
772
|
+
return h11(
|
|
773
|
+
"div",
|
|
774
|
+
{ class: theme.layoutVerticalWide },
|
|
775
|
+
categories.map((categoryRef, catIndex) => {
|
|
776
|
+
const category = categoryRef.value;
|
|
777
|
+
const elements = category.uischema.elements ?? [];
|
|
778
|
+
return h11(
|
|
779
|
+
"div",
|
|
780
|
+
{
|
|
781
|
+
key: `${layout.value.path}-cat-${catIndex}`,
|
|
782
|
+
class: theme.layoutVertical
|
|
783
|
+
},
|
|
784
|
+
[
|
|
785
|
+
category.label ? h11("div", { class: theme.labelSection }, category.label) : null,
|
|
786
|
+
h11(
|
|
787
|
+
"div",
|
|
788
|
+
{ class: theme.layoutVertical },
|
|
789
|
+
elements.map(
|
|
790
|
+
(element, index) => h11(
|
|
791
|
+
"div",
|
|
792
|
+
{ key: `${category.path}-${index}` },
|
|
793
|
+
h11(DispatchRenderer3, {
|
|
794
|
+
schema: category.schema,
|
|
795
|
+
uischema: element,
|
|
796
|
+
path: category.path,
|
|
797
|
+
enabled: category.enabled,
|
|
798
|
+
renderers: category.renderers,
|
|
799
|
+
cells: category.cells
|
|
800
|
+
})
|
|
801
|
+
)
|
|
796
802
|
)
|
|
797
803
|
)
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
)
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
804
|
+
]
|
|
805
|
+
);
|
|
806
|
+
})
|
|
807
|
+
);
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
}
|
|
806
812
|
|
|
807
813
|
// src/renderers/layouts/NuxtUiCategoryRenderer.ts
|
|
808
814
|
import { DispatchRenderer as DispatchRenderer4, rendererProps as rendererProps12, useJsonFormsLayout } from "@jsonforms/vue";
|
|
809
815
|
import { defineComponent as defineComponent12, h as h12 } from "vue";
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
(
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
816
|
+
function createNuxtUiCategoryRenderer(theme) {
|
|
817
|
+
return defineComponent12({
|
|
818
|
+
name: "NuxtUiCategoryRenderer",
|
|
819
|
+
components: { DispatchRenderer: DispatchRenderer4 },
|
|
820
|
+
props: rendererProps12(),
|
|
821
|
+
setup(props) {
|
|
822
|
+
const { layout } = useJsonFormsLayout(
|
|
823
|
+
props
|
|
824
|
+
);
|
|
825
|
+
return () => {
|
|
826
|
+
if (!layout.value.visible) return null;
|
|
827
|
+
const elements = layout.value.uischema.elements ?? [];
|
|
828
|
+
return h12("div", { class: theme.layoutVertical }, [
|
|
829
|
+
layout.value.label ? h12("div", { class: theme.labelSection }, layout.value.label) : null,
|
|
830
|
+
h12(
|
|
831
|
+
"div",
|
|
832
|
+
{ class: theme.layoutVertical },
|
|
833
|
+
elements.map(
|
|
834
|
+
(element, index) => h12(
|
|
835
|
+
"div",
|
|
836
|
+
{ key: `${layout.value.path}-${index}` },
|
|
837
|
+
h12(DispatchRenderer4, {
|
|
838
|
+
schema: layout.value.schema,
|
|
839
|
+
uischema: element,
|
|
840
|
+
path: layout.value.path,
|
|
841
|
+
enabled: layout.value.enabled,
|
|
842
|
+
renderers: layout.value.renderers,
|
|
843
|
+
cells: layout.value.cells
|
|
844
|
+
})
|
|
845
|
+
)
|
|
838
846
|
)
|
|
839
847
|
)
|
|
840
|
-
)
|
|
841
|
-
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
}
|
|
848
|
+
]);
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
}
|
|
845
853
|
|
|
846
854
|
// src/renderers/layouts/NuxtUiGroupRenderer.ts
|
|
847
855
|
import { DispatchRenderer as DispatchRenderer5, rendererProps as rendererProps13, useJsonFormsLayout as useJsonFormsLayout2 } from "@jsonforms/vue";
|
|
848
856
|
import { defineComponent as defineComponent13, h as h13 } from "vue";
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
layout.value.
|
|
862
|
-
|
|
857
|
+
function createNuxtUiGroupRenderer(theme) {
|
|
858
|
+
return defineComponent13({
|
|
859
|
+
name: "NuxtUiGroupRenderer",
|
|
860
|
+
components: { DispatchRenderer: DispatchRenderer5 },
|
|
861
|
+
props: rendererProps13(),
|
|
862
|
+
setup(props) {
|
|
863
|
+
const { layout } = useJsonFormsLayout2(
|
|
864
|
+
props
|
|
865
|
+
);
|
|
866
|
+
return () => {
|
|
867
|
+
if (!layout.value.visible) return null;
|
|
868
|
+
const elements = layout.value.uischema.elements ?? [];
|
|
869
|
+
const isNested = layout.value.path?.includes(".") ?? false;
|
|
870
|
+
const containerClass = isNested ? theme.groupNested : theme.panel;
|
|
871
|
+
return h13(
|
|
863
872
|
"div",
|
|
864
|
-
{ class:
|
|
873
|
+
{ class: containerClass },
|
|
874
|
+
[
|
|
875
|
+
layout.value.label ? h13("div", { class: theme.labelSectionSpaced }, layout.value.label) : null,
|
|
876
|
+
h13(
|
|
877
|
+
"div",
|
|
878
|
+
{ class: theme.layoutVertical },
|
|
879
|
+
elements.map(
|
|
880
|
+
(element, index) => h13(
|
|
881
|
+
"div",
|
|
882
|
+
{ key: `${layout.value.path}-${index}` },
|
|
883
|
+
h13(DispatchRenderer5, {
|
|
884
|
+
schema: layout.value.schema,
|
|
885
|
+
uischema: element,
|
|
886
|
+
path: layout.value.path,
|
|
887
|
+
enabled: layout.value.enabled,
|
|
888
|
+
renderers: layout.value.renderers,
|
|
889
|
+
cells: layout.value.cells
|
|
890
|
+
})
|
|
891
|
+
)
|
|
892
|
+
)
|
|
893
|
+
)
|
|
894
|
+
]
|
|
895
|
+
);
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// src/renderers/layouts/NuxtUiHorizontalLayoutRenderer.ts
|
|
902
|
+
import { DispatchRenderer as DispatchRenderer6, rendererProps as rendererProps14, useJsonFormsLayout as useJsonFormsLayout3 } from "@jsonforms/vue";
|
|
903
|
+
import { defineComponent as defineComponent14, h as h14 } from "vue";
|
|
904
|
+
function createNuxtUiHorizontalLayoutRenderer(theme) {
|
|
905
|
+
return defineComponent14({
|
|
906
|
+
name: "NuxtUiHorizontalLayoutRenderer",
|
|
907
|
+
components: { DispatchRenderer: DispatchRenderer6 },
|
|
908
|
+
props: rendererProps14(),
|
|
909
|
+
setup(props) {
|
|
910
|
+
const { layout } = useJsonFormsLayout3(
|
|
911
|
+
props
|
|
912
|
+
);
|
|
913
|
+
return () => {
|
|
914
|
+
if (!layout.value.visible) return null;
|
|
915
|
+
const elements = layout.value.uischema.elements ?? [];
|
|
916
|
+
return h14(
|
|
917
|
+
"div",
|
|
918
|
+
{ class: theme.layoutHorizontal },
|
|
865
919
|
elements.map(
|
|
866
|
-
(element, index) =>
|
|
920
|
+
(element, index) => h14(
|
|
867
921
|
"div",
|
|
868
|
-
{
|
|
869
|
-
|
|
922
|
+
{
|
|
923
|
+
key: `${layout.value.path}-${index}`,
|
|
924
|
+
class: theme.layoutHorizontalItem
|
|
925
|
+
},
|
|
926
|
+
h14(DispatchRenderer6, {
|
|
870
927
|
schema: layout.value.schema,
|
|
871
928
|
uischema: element,
|
|
872
929
|
path: layout.value.path,
|
|
@@ -876,104 +933,92 @@ var NuxtUiGroupRenderer = defineComponent13({
|
|
|
876
933
|
})
|
|
877
934
|
)
|
|
878
935
|
)
|
|
879
|
-
)
|
|
880
|
-
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
// src/renderers/layouts/NuxtUiHorizontalLayoutRenderer.ts
|
|
886
|
-
import { DispatchRenderer as DispatchRenderer6, rendererProps as rendererProps14, useJsonFormsLayout as useJsonFormsLayout3 } from "@jsonforms/vue";
|
|
887
|
-
import { defineComponent as defineComponent14, h as h14 } from "vue";
|
|
888
|
-
var NuxtUiHorizontalLayoutRenderer = defineComponent14({
|
|
889
|
-
name: "NuxtUiHorizontalLayoutRenderer",
|
|
890
|
-
components: { DispatchRenderer: DispatchRenderer6 },
|
|
891
|
-
props: rendererProps14(),
|
|
892
|
-
setup(props) {
|
|
893
|
-
const { layout } = useJsonFormsLayout3(
|
|
894
|
-
props
|
|
895
|
-
);
|
|
896
|
-
return () => {
|
|
897
|
-
if (!layout.value.visible) return null;
|
|
898
|
-
const elements = layout.value.uischema.elements ?? [];
|
|
899
|
-
return h14(
|
|
900
|
-
"div",
|
|
901
|
-
{ class: "flex flex-col gap-3 md:flex-row md:flex-wrap" },
|
|
902
|
-
elements.map(
|
|
903
|
-
(element, index) => h14(
|
|
904
|
-
"div",
|
|
905
|
-
{ key: `${layout.value.path}-${index}`, class: "min-w-0 flex-1" },
|
|
906
|
-
h14(DispatchRenderer6, {
|
|
907
|
-
schema: layout.value.schema,
|
|
908
|
-
uischema: element,
|
|
909
|
-
path: layout.value.path,
|
|
910
|
-
enabled: layout.value.enabled,
|
|
911
|
-
renderers: layout.value.renderers,
|
|
912
|
-
cells: layout.value.cells
|
|
913
|
-
})
|
|
914
|
-
)
|
|
915
|
-
)
|
|
916
|
-
);
|
|
917
|
-
};
|
|
918
|
-
}
|
|
919
|
-
});
|
|
936
|
+
);
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
}
|
|
920
941
|
|
|
921
942
|
// src/renderers/layouts/NuxtUiLabelRenderer.ts
|
|
922
943
|
import { rendererProps as rendererProps15, useJsonFormsLabel } from "@jsonforms/vue";
|
|
923
944
|
import { defineComponent as defineComponent15, h as h15 } from "vue";
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
return () => {
|
|
932
|
-
if (!label.value.visible) return null;
|
|
933
|
-
return h15(
|
|
934
|
-
"div",
|
|
935
|
-
{ class: "text-sm text-gray-600 dark:text-gray-300" },
|
|
936
|
-
label.value.text
|
|
945
|
+
function createNuxtUiLabelRenderer(theme) {
|
|
946
|
+
return defineComponent15({
|
|
947
|
+
name: "NuxtUiLabelRenderer",
|
|
948
|
+
props: rendererProps15(),
|
|
949
|
+
setup(props) {
|
|
950
|
+
const { label } = useJsonFormsLabel(
|
|
951
|
+
props
|
|
937
952
|
);
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
});
|
|
953
|
+
return () => {
|
|
954
|
+
if (!label.value.visible) return null;
|
|
955
|
+
return h15("div", { class: theme.textLabel }, label.value.text);
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
});
|
|
959
|
+
}
|
|
941
960
|
|
|
942
961
|
// src/renderers/layouts/NuxtUiVerticalLayoutRenderer.ts
|
|
943
962
|
import { DispatchRenderer as DispatchRenderer7, rendererProps as rendererProps16, useJsonFormsLayout as useJsonFormsLayout4 } from "@jsonforms/vue";
|
|
944
963
|
import { defineComponent as defineComponent16, h as h16 } from "vue";
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
return () => {
|
|
954
|
-
if (!layout.value.visible) return null;
|
|
955
|
-
const elements = layout.value.uischema.elements ?? [];
|
|
956
|
-
return h16(
|
|
957
|
-
"div",
|
|
958
|
-
{ class: "flex flex-col gap-3" },
|
|
959
|
-
elements.map(
|
|
960
|
-
(element, index) => h16(
|
|
961
|
-
"div",
|
|
962
|
-
{ key: `${layout.value.path}-${index}` },
|
|
963
|
-
h16(DispatchRenderer7, {
|
|
964
|
-
schema: layout.value.schema,
|
|
965
|
-
uischema: element,
|
|
966
|
-
path: layout.value.path,
|
|
967
|
-
enabled: layout.value.enabled,
|
|
968
|
-
renderers: layout.value.renderers,
|
|
969
|
-
cells: layout.value.cells
|
|
970
|
-
})
|
|
971
|
-
)
|
|
972
|
-
)
|
|
964
|
+
function createNuxtUiVerticalLayoutRenderer(theme) {
|
|
965
|
+
return defineComponent16({
|
|
966
|
+
name: "NuxtUiVerticalLayoutRenderer",
|
|
967
|
+
components: { DispatchRenderer: DispatchRenderer7 },
|
|
968
|
+
props: rendererProps16(),
|
|
969
|
+
setup(props) {
|
|
970
|
+
const { layout } = useJsonFormsLayout4(
|
|
971
|
+
props
|
|
973
972
|
);
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
973
|
+
return () => {
|
|
974
|
+
if (!layout.value.visible) return null;
|
|
975
|
+
const elements = layout.value.uischema.elements ?? [];
|
|
976
|
+
return h16(
|
|
977
|
+
"div",
|
|
978
|
+
{ class: theme.layoutVertical },
|
|
979
|
+
elements.map(
|
|
980
|
+
(element, index) => h16(
|
|
981
|
+
"div",
|
|
982
|
+
{ key: `${layout.value.path}-${index}` },
|
|
983
|
+
h16(DispatchRenderer7, {
|
|
984
|
+
schema: layout.value.schema,
|
|
985
|
+
uischema: element,
|
|
986
|
+
path: layout.value.path,
|
|
987
|
+
enabled: layout.value.enabled,
|
|
988
|
+
renderers: layout.value.renderers,
|
|
989
|
+
cells: layout.value.cells
|
|
990
|
+
})
|
|
991
|
+
)
|
|
992
|
+
)
|
|
993
|
+
);
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
// src/renderers/theme.ts
|
|
1000
|
+
var defaultTheme = {
|
|
1001
|
+
panel: "jf-panel",
|
|
1002
|
+
groupNested: "jf-group",
|
|
1003
|
+
layoutVertical: "jf-layout-vertical",
|
|
1004
|
+
layoutVerticalWide: "jf-layout-vertical-wide",
|
|
1005
|
+
layoutHorizontal: "jf-layout-horizontal",
|
|
1006
|
+
layoutHorizontalItem: "jf-layout-horizontal-item",
|
|
1007
|
+
arrayItemToolbar: "jf-array-item-toolbar",
|
|
1008
|
+
labelSection: "jf-label-section",
|
|
1009
|
+
labelSectionSpaced: "jf-label-section-spaced",
|
|
1010
|
+
textMuted: "jf-text-muted",
|
|
1011
|
+
textMutedXs: "jf-text-muted-xs",
|
|
1012
|
+
textItemTitle: "jf-text-item-title",
|
|
1013
|
+
textItemSuffix: "jf-text-item-suffix",
|
|
1014
|
+
textLabel: "jf-text-label",
|
|
1015
|
+
flexBetween: "jf-flex-between",
|
|
1016
|
+
flexBetweenStart: "jf-flex-between-start",
|
|
1017
|
+
flexActions: "jf-flex-actions"
|
|
1018
|
+
};
|
|
1019
|
+
function mergeTheme(overrides) {
|
|
1020
|
+
return overrides ? { ...defaultTheme, ...overrides } : { ...defaultTheme };
|
|
1021
|
+
}
|
|
977
1022
|
|
|
978
1023
|
// src/nuxtUiRenderers.ts
|
|
979
1024
|
var RANK = 10;
|
|
@@ -1021,84 +1066,91 @@ var isOneOfEnumControl = (uischema, schema, context) => {
|
|
|
1021
1066
|
}
|
|
1022
1067
|
return true;
|
|
1023
1068
|
};
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1069
|
+
function createNuxtUiRenderers(options) {
|
|
1070
|
+
const theme = mergeTheme(options?.theme);
|
|
1071
|
+
return [
|
|
1072
|
+
// Layouts
|
|
1073
|
+
{
|
|
1074
|
+
tester: rankWith(RANK, uiTypeIs("VerticalLayout")),
|
|
1075
|
+
renderer: markRaw(createNuxtUiVerticalLayoutRenderer(theme))
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
tester: rankWith(RANK, uiTypeIs("HorizontalLayout")),
|
|
1079
|
+
renderer: markRaw(createNuxtUiHorizontalLayoutRenderer(theme))
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
tester: rankWith(RANK, uiTypeIs("Group")),
|
|
1083
|
+
renderer: markRaw(createNuxtUiGroupRenderer(theme))
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
tester: rankWith(RANK, uiTypeIs("Categorization")),
|
|
1087
|
+
renderer: markRaw(createNuxtUiCategorizationRenderer(theme))
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
tester: rankWith(RANK, uiTypeIs("Category")),
|
|
1091
|
+
renderer: markRaw(createNuxtUiCategoryRenderer(theme))
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
tester: rankWith(RANK, uiTypeIs("Label")),
|
|
1095
|
+
renderer: markRaw(createNuxtUiLabelRenderer(theme))
|
|
1096
|
+
},
|
|
1097
|
+
// Complex schemas
|
|
1098
|
+
{
|
|
1099
|
+
tester: rankWith(RANK, schemaTypeIs("array")),
|
|
1100
|
+
renderer: markRaw(createNuxtUiArrayListRenderer(theme))
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
tester: rankWith(RANK, isObjectControl),
|
|
1104
|
+
renderer: markRaw(NuxtUiObjectRenderer)
|
|
1105
|
+
},
|
|
1106
|
+
// Primitive controls
|
|
1107
|
+
{
|
|
1108
|
+
tester: rankWith(RANK, isMultiLineControl),
|
|
1109
|
+
renderer: markRaw(NuxtUiTextareaControl)
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
tester: rankWith(RANK, isNumberControl),
|
|
1113
|
+
renderer: markRaw(NuxtUiNumberControl)
|
|
1114
|
+
},
|
|
1115
|
+
{
|
|
1116
|
+
tester: rankWith(RANK, isIntegerControl),
|
|
1117
|
+
renderer: markRaw(NuxtUiIntegerControl)
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
tester: rankWith(RANK, isBooleanControl),
|
|
1121
|
+
renderer: markRaw(createNuxtUiBooleanControl(theme))
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
// Multi-enum must outrank generic array renderer and string renderer.
|
|
1125
|
+
tester: rankWith(ENUM_RANK, isMultiEnumControl),
|
|
1126
|
+
renderer: markRaw(NuxtUiMultiEnumControl)
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
// oneOf with const+title (display labels) - same as enum for rendering.
|
|
1130
|
+
tester: rankWith(ENUM_RANK, isOneOfEnumControl),
|
|
1131
|
+
renderer: markRaw(NuxtUiEnumControl)
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
// Enum must outrank the generic string control, otherwise enums render
|
|
1135
|
+
// as freeform text inputs.
|
|
1136
|
+
tester: rankWith(ENUM_RANK, isEnumControl),
|
|
1137
|
+
renderer: markRaw(NuxtUiEnumControl)
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
tester: rankWith(PASSWORD_RANK, and(isStringControl, formatIs("password"))),
|
|
1141
|
+
renderer: markRaw(NuxtUiPasswordControl)
|
|
1142
|
+
},
|
|
1143
|
+
{
|
|
1144
|
+
tester: rankWith(RANK, isStringControl),
|
|
1145
|
+
renderer: markRaw(NuxtUiStringControl)
|
|
1146
|
+
}
|
|
1147
|
+
];
|
|
1148
|
+
}
|
|
1149
|
+
var nuxtUiRenderers = createNuxtUiRenderers();
|
|
1101
1150
|
export {
|
|
1151
|
+
createNuxtUiRenderers,
|
|
1152
|
+
defaultTheme,
|
|
1153
|
+
mergeTheme,
|
|
1102
1154
|
nuxtUiRenderers
|
|
1103
1155
|
};
|
|
1104
1156
|
//# sourceMappingURL=index.js.map
|