@ghentcdh/json-forms-vue 0.6.7 → 0.6.9
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/form-with-actions.component.vue.d.ts +17 -2
- package/form.component.vue.d.ts +2 -0
- package/form.store.d.ts +1 -1
- package/index.js +436 -331
- package/index.mjs +442 -337
- package/package.json +4 -4
- package/renderes/array/ArrayRenderer.vue.d.ts +72 -184
- package/renderes/array/index.d.ts +75 -2
- package/renderes/controls/{autocomplete/AutocompleteControlRenderer.vue.d.ts → AutocompleteControlRenderer.vue.d.ts} +2 -2
- package/renderes/controls/BooleanControlRenderer.vue.d.ts +1 -1
- package/renderes/controls/IntegerControlRenderer.vue.d.ts +1 -1
- package/renderes/controls/MarkdownControlRenderer.vue.d.ts +1 -1
- package/renderes/controls/MultiSelectControlRender.vue.d.ts +74 -0
- package/renderes/controls/NumberControlRenderer.vue.d.ts +1 -1
- package/renderes/controls/SelectControlRender.vue.d.ts +74 -0
- package/renderes/controls/StringControlRenderer.vue.d.ts +1 -1
- package/renderes/controls/TextAreaControlRenderer.vue.d.ts +1 -1
- package/renderes/controls/index.d.ts +157 -7
- package/renderes/index.d.ts +302 -6
- package/renderes/layouts/CollapseLayout.vue.d.ts +73 -0
- package/renderes/layouts/HorizontalLayout.vue.d.ts +73 -0
- package/renderes/layouts/VerticalLayout.vue.d.ts +73 -0
- package/renderes/layouts/index.d.ts +75 -1
- package/renderes/tester.d.ts +2 -1
- package/utils/style.d.ts +3 -1
- package/utils/vanillaControl.d.ts +6 -4
- package/renderes/array/FixedArrayRenderer.vue.d.ts +0 -127
package/index.js
CHANGED
|
@@ -5,11 +5,12 @@ const ui = require("@ghentcdh/ui");
|
|
|
5
5
|
const core = require("@jsonforms/core");
|
|
6
6
|
const vue = require("vue");
|
|
7
7
|
const vue$1 = require("@jsonforms/vue");
|
|
8
|
+
const axios = require("axios");
|
|
8
9
|
const vueVanilla = require("@jsonforms/vue-vanilla");
|
|
10
|
+
const lodashEs = require("lodash-es");
|
|
9
11
|
const testers = require("@jsonforms/core/src/testers/testers");
|
|
10
12
|
const jsonFormsCore = require("@ghentcdh/json-forms-core");
|
|
11
13
|
const vueRouter = require("vue-router");
|
|
12
|
-
const lodashEs = require("lodash-es");
|
|
13
14
|
const core$1 = require("@vueuse/core");
|
|
14
15
|
class FormStore {
|
|
15
16
|
constructor(schema) {
|
|
@@ -51,12 +52,15 @@ const useVanillaControlCustom = (input, adaptTarget = (v) => v.value) => {
|
|
|
51
52
|
const controlWrapper = vue.computed(() => {
|
|
52
53
|
return {
|
|
53
54
|
...vanillaControl.controlWrapper.value,
|
|
55
|
+
...lodashEs.omit(vanillaControl.appliedOptions.value, "styles"),
|
|
56
|
+
...lodashEs.pick(vanillaControl.appliedOptions.value.styles, ["width"]),
|
|
54
57
|
isFocused: isFocused.value,
|
|
55
58
|
isTouched: isTouched.value
|
|
56
59
|
};
|
|
57
60
|
});
|
|
58
61
|
return {
|
|
59
62
|
...vanillaControl,
|
|
63
|
+
appliedOptions: vanillaControl.appliedOptions,
|
|
60
64
|
controlWrapper,
|
|
61
65
|
isFocused,
|
|
62
66
|
isTouched,
|
|
@@ -65,7 +69,49 @@ const useVanillaControlCustom = (input, adaptTarget = (v) => v.value) => {
|
|
|
65
69
|
// handleChange,
|
|
66
70
|
};
|
|
67
71
|
};
|
|
68
|
-
const _sfc_main$
|
|
72
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
73
|
+
__name: "AutocompleteControlRenderer",
|
|
74
|
+
props: { ...vue$1.rendererProps() },
|
|
75
|
+
setup(__props) {
|
|
76
|
+
const props = __props;
|
|
77
|
+
const {
|
|
78
|
+
control,
|
|
79
|
+
handleChange: _handleChange,
|
|
80
|
+
appliedOptions,
|
|
81
|
+
onFocus,
|
|
82
|
+
onBlur,
|
|
83
|
+
controlWrapper
|
|
84
|
+
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
85
|
+
const bindProperties = vue.computed(() => ({
|
|
86
|
+
...controlWrapper.value,
|
|
87
|
+
...appliedOptions.value
|
|
88
|
+
}));
|
|
89
|
+
const fetchOptions = vue.computed(() => {
|
|
90
|
+
const options = appliedOptions.value;
|
|
91
|
+
if (!options.uri) return null;
|
|
92
|
+
return () => {
|
|
93
|
+
const fetch = options.skipAuth ? axios : toolsVue.useApi();
|
|
94
|
+
return fetch.get(options.uri).then((data) => data.data[options.dataField ?? "data"]);
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
const handleChange = (result) => {
|
|
98
|
+
const { path } = control.value;
|
|
99
|
+
_handleChange(path, result);
|
|
100
|
+
};
|
|
101
|
+
return (_ctx, _cache) => {
|
|
102
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.Autocomplete), vue.mergeProps(bindProperties.value, {
|
|
103
|
+
modelValue: vue.unref(control).data,
|
|
104
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
|
|
105
|
+
enabled: vue.unref(control).enabled,
|
|
106
|
+
"fetch-options": fetchOptions.value,
|
|
107
|
+
onChange: handleChange,
|
|
108
|
+
onFocus: vue.unref(onFocus),
|
|
109
|
+
onBlur: vue.unref(onBlur)
|
|
110
|
+
}), null, 16, ["modelValue", "enabled", "fetch-options", "onFocus", "onBlur"]);
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
69
115
|
__name: "BooleanControlRenderer",
|
|
70
116
|
props: { ...vue$1.rendererProps() },
|
|
71
117
|
setup(__props) {
|
|
@@ -86,7 +132,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
|
86
132
|
};
|
|
87
133
|
}
|
|
88
134
|
});
|
|
89
|
-
const _sfc_main$
|
|
135
|
+
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
90
136
|
__name: "IntegerControlRenderer",
|
|
91
137
|
props: { ...vue$1.rendererProps() },
|
|
92
138
|
setup(__props) {
|
|
@@ -110,28 +156,64 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
|
110
156
|
};
|
|
111
157
|
}
|
|
112
158
|
});
|
|
113
|
-
const _sfc_main$
|
|
159
|
+
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
114
160
|
__name: "MarkdownControlRenderer",
|
|
115
161
|
props: { ...vue$1.rendererProps() },
|
|
116
162
|
setup(__props) {
|
|
117
163
|
const props = __props;
|
|
118
|
-
const {
|
|
119
|
-
|
|
120
|
-
|
|
164
|
+
const {
|
|
165
|
+
control,
|
|
166
|
+
handleChange,
|
|
167
|
+
appliedOptions,
|
|
168
|
+
onFocus,
|
|
169
|
+
onBlur,
|
|
170
|
+
controlWrapper
|
|
171
|
+
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
172
|
+
const changeValue = (value) => {
|
|
173
|
+
handleChange(control.value.path, value);
|
|
174
|
+
};
|
|
121
175
|
return (_ctx, _cache) => {
|
|
122
176
|
return vue.openBlock(), vue.createBlock(vue.unref(ui.Markdown), vue.mergeProps(vue.unref(controlWrapper), {
|
|
123
177
|
modelValue: vue.unref(control).data,
|
|
124
178
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
|
|
125
179
|
enabled: vue.unref(control).enabled,
|
|
126
180
|
config: vue.unref(appliedOptions),
|
|
127
|
-
onChange:
|
|
181
|
+
onChange: changeValue,
|
|
128
182
|
onFocus: vue.unref(onFocus),
|
|
129
183
|
onBlur: vue.unref(onBlur)
|
|
130
|
-
}), null, 16, ["modelValue", "enabled", "config", "
|
|
184
|
+
}), null, 16, ["modelValue", "enabled", "config", "onFocus", "onBlur"]);
|
|
131
185
|
};
|
|
132
186
|
}
|
|
133
187
|
});
|
|
134
|
-
const _sfc_main$
|
|
188
|
+
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
189
|
+
__name: "MultiSelectControlRender",
|
|
190
|
+
props: { ...vue$1.rendererProps() },
|
|
191
|
+
setup(__props) {
|
|
192
|
+
const props = __props;
|
|
193
|
+
const {
|
|
194
|
+
control,
|
|
195
|
+
handleChange: _handleChange,
|
|
196
|
+
onFocus,
|
|
197
|
+
onBlur,
|
|
198
|
+
controlWrapper
|
|
199
|
+
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
200
|
+
const handleChange = (result) => {
|
|
201
|
+
const { path } = control.value;
|
|
202
|
+
_handleChange(path, result);
|
|
203
|
+
};
|
|
204
|
+
return (_ctx, _cache) => {
|
|
205
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.MultiSelect), vue.mergeProps(vue.unref(controlWrapper), {
|
|
206
|
+
modelValue: vue.unref(control).data,
|
|
207
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
|
|
208
|
+
enabled: vue.unref(control).enabled,
|
|
209
|
+
onChange: handleChange,
|
|
210
|
+
onFocus: vue.unref(onFocus),
|
|
211
|
+
onBlur: vue.unref(onBlur)
|
|
212
|
+
}), null, 16, ["modelValue", "enabled", "onFocus", "onBlur"]);
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
135
217
|
__name: "NumberControlRenderer",
|
|
136
218
|
props: { ...vue$1.rendererProps() },
|
|
137
219
|
setup(__props) {
|
|
@@ -155,26 +237,65 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
|
155
237
|
};
|
|
156
238
|
}
|
|
157
239
|
});
|
|
158
|
-
const _sfc_main$
|
|
240
|
+
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
241
|
+
__name: "SelectControlRender",
|
|
242
|
+
props: { ...vue$1.rendererProps() },
|
|
243
|
+
setup(__props) {
|
|
244
|
+
const props = __props;
|
|
245
|
+
const {
|
|
246
|
+
control,
|
|
247
|
+
handleChange: _handleChange,
|
|
248
|
+
appliedOptions,
|
|
249
|
+
onFocus,
|
|
250
|
+
onBlur,
|
|
251
|
+
controlWrapper
|
|
252
|
+
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
253
|
+
const handleChange = (result) => {
|
|
254
|
+
const { path } = control.value;
|
|
255
|
+
_handleChange(path, result);
|
|
256
|
+
};
|
|
257
|
+
return (_ctx, _cache) => {
|
|
258
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.SelectComponent), vue.mergeProps(vue.unref(controlWrapper), {
|
|
259
|
+
modelValue: vue.unref(control).data,
|
|
260
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
|
|
261
|
+
enabled: vue.unref(control).enabled,
|
|
262
|
+
options: vue.unref(appliedOptions)?.options,
|
|
263
|
+
onChange: handleChange,
|
|
264
|
+
onFocus: vue.unref(onFocus),
|
|
265
|
+
onBlur: vue.unref(onBlur)
|
|
266
|
+
}), null, 16, ["modelValue", "enabled", "options", "onFocus", "onBlur"]);
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
159
271
|
__name: "StringControlRenderer",
|
|
160
272
|
props: { ...vue$1.rendererProps() },
|
|
161
273
|
setup(__props) {
|
|
162
274
|
const props = __props;
|
|
163
|
-
const {
|
|
275
|
+
const {
|
|
276
|
+
control,
|
|
277
|
+
onChange,
|
|
278
|
+
appliedOptions,
|
|
279
|
+
onFocus,
|
|
280
|
+
onBlur,
|
|
281
|
+
controlWrapper,
|
|
282
|
+
styles
|
|
283
|
+
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
164
284
|
return (_ctx, _cache) => {
|
|
165
285
|
return vue.openBlock(), vue.createBlock(vue.unref(ui.Input), vue.mergeProps(vue.unref(controlWrapper), {
|
|
166
286
|
modelValue: vue.unref(control).data,
|
|
167
287
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
|
|
168
288
|
enabled: vue.unref(control).enabled,
|
|
169
289
|
config: vue.unref(appliedOptions),
|
|
290
|
+
styles: vue.unref(styles),
|
|
170
291
|
onChange: vue.unref(onChange),
|
|
171
292
|
onFocus: vue.unref(onFocus),
|
|
172
293
|
onBlur: vue.unref(onBlur)
|
|
173
|
-
}), null, 16, ["modelValue", "enabled", "config", "onChange", "onFocus", "onBlur"]);
|
|
294
|
+
}), null, 16, ["modelValue", "enabled", "config", "styles", "onChange", "onFocus", "onBlur"]);
|
|
174
295
|
};
|
|
175
296
|
}
|
|
176
297
|
});
|
|
177
|
-
const _sfc_main$
|
|
298
|
+
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
178
299
|
__name: "TextAreaControlRenderer",
|
|
179
300
|
props: { ...vue$1.rendererProps() },
|
|
180
301
|
setup(__props) {
|
|
@@ -209,10 +330,6 @@ const isMarkdownControl = testers.and(
|
|
|
209
330
|
core.uiTypeIs("Control"),
|
|
210
331
|
testers.optionIs("format", jsonFormsCore.ControlType.markdown)
|
|
211
332
|
);
|
|
212
|
-
const isFixedArray = testers.and(
|
|
213
|
-
testers.schemaTypeIs("array"),
|
|
214
|
-
testers.optionIs("format", jsonFormsCore.ControlType.fixedArray)
|
|
215
|
-
);
|
|
216
333
|
const isArrayRenderer = testers.and(
|
|
217
334
|
testers.schemaTypeIs("array")
|
|
218
335
|
// optionIs('format', ControlType.array),
|
|
@@ -223,52 +340,41 @@ const isCustomControl = (customType) => {
|
|
|
223
340
|
testers.optionIs("type", customType)
|
|
224
341
|
);
|
|
225
342
|
};
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const field = vue.computed(() => appliedOptions.value.field);
|
|
235
|
-
return (_ctx, _cache) => {
|
|
236
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.Autocomplete), vue.mergeProps(vue.unref(controlWrapper), {
|
|
237
|
-
modelValue: vue.unref(control).data,
|
|
238
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
|
|
239
|
-
enabled: vue.unref(control).enabled,
|
|
240
|
-
config: vue.unref(appliedOptions),
|
|
241
|
-
"label-key": field.value?.label,
|
|
242
|
-
"value-key": field.value?.id,
|
|
243
|
-
onChange: vue.unref(onChange),
|
|
244
|
-
onFocus: vue.unref(onFocus),
|
|
245
|
-
onBlur: vue.unref(onBlur)
|
|
246
|
-
}), null, 16, ["modelValue", "enabled", "config", "label-key", "value-key", "onChange", "onFocus", "onBlur"]);
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
});
|
|
343
|
+
const isMultiselectControl = testers.and(
|
|
344
|
+
core.uiTypeIs("Control"),
|
|
345
|
+
testers.optionIs("format", jsonFormsCore.ControlType.mutliSelect)
|
|
346
|
+
);
|
|
347
|
+
const isSelectControl = testers.and(
|
|
348
|
+
core.uiTypeIs("Control"),
|
|
349
|
+
testers.optionIs("format", jsonFormsCore.ControlType.select)
|
|
350
|
+
);
|
|
250
351
|
const controlRenderers = [
|
|
251
352
|
// First custom renderers on format
|
|
252
353
|
{
|
|
253
354
|
tester: core.rankWith(10, isMarkdownControl),
|
|
254
|
-
renderer: _sfc_main$
|
|
355
|
+
renderer: _sfc_main$f
|
|
255
356
|
},
|
|
256
357
|
{
|
|
257
358
|
tester: core.rankWith(10, isAutoCompleteControl),
|
|
258
|
-
renderer: _sfc_main$
|
|
359
|
+
renderer: _sfc_main$i
|
|
259
360
|
},
|
|
260
361
|
{
|
|
261
362
|
tester: core.rankWith(10, isTextAreaControl),
|
|
262
|
-
renderer: _sfc_main$
|
|
363
|
+
renderer: _sfc_main$a
|
|
263
364
|
},
|
|
264
365
|
// Renderers based on type if no format is provided
|
|
265
|
-
{ tester: core.rankWith(10, isStringFormat), renderer: _sfc_main$
|
|
266
|
-
{ tester: core.rankWith(10,
|
|
366
|
+
{ tester: core.rankWith(10, isStringFormat), renderer: _sfc_main$b },
|
|
367
|
+
{ tester: core.rankWith(10, isSelectControl), renderer: _sfc_main$c },
|
|
368
|
+
{
|
|
369
|
+
tester: core.rankWith(10, isMultiselectControl),
|
|
370
|
+
renderer: _sfc_main$e
|
|
371
|
+
},
|
|
372
|
+
{ tester: core.rankWith(10, core.isNumberControl), renderer: _sfc_main$d },
|
|
267
373
|
{
|
|
268
374
|
tester: core.rankWith(10, core.isIntegerControl),
|
|
269
|
-
renderer: _sfc_main$
|
|
375
|
+
renderer: _sfc_main$g
|
|
270
376
|
},
|
|
271
|
-
{ tester: core.rankWith(10, core.isBooleanControl), renderer: _sfc_main$
|
|
377
|
+
{ tester: core.rankWith(10, core.isBooleanControl), renderer: _sfc_main$h }
|
|
272
378
|
];
|
|
273
379
|
const actionMap = {
|
|
274
380
|
edit: (router, action) => ({
|
|
@@ -303,262 +409,233 @@ class FormState {
|
|
|
303
409
|
const useFormState = (form) => {
|
|
304
410
|
return FormState.getInstance();
|
|
305
411
|
};
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
},
|
|
315
|
-
setup(
|
|
412
|
+
const _hoisted_1$8 = ["title"];
|
|
413
|
+
const _hoisted_2$2 = { key: 0 };
|
|
414
|
+
const _hoisted_3$1 = {
|
|
415
|
+
key: 1,
|
|
416
|
+
class: "list-row"
|
|
417
|
+
};
|
|
418
|
+
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
419
|
+
__name: "ArrayRenderer",
|
|
420
|
+
props: { ...vue$1.rendererProps() },
|
|
421
|
+
setup(__props) {
|
|
422
|
+
const props = __props;
|
|
316
423
|
const vanillaArrayControl = vueVanilla.useVanillaArrayControl(
|
|
317
424
|
vue$1.useJsonFormsArrayControl(props)
|
|
318
425
|
);
|
|
319
|
-
const control = vanillaArrayControl
|
|
320
|
-
if (!control.data || control.data.length < 1) {
|
|
426
|
+
const { styles, childUiSchema, control, appliedOptions } = vanillaArrayControl;
|
|
427
|
+
if (!control.value.data || control.value.data.length < 1) {
|
|
321
428
|
vanillaArrayControl.addItem(
|
|
322
|
-
control.path,
|
|
323
|
-
core.createDefaultValue(control.schema, control.rootSchema)
|
|
429
|
+
control.value.path,
|
|
430
|
+
core.createDefaultValue(control.value.schema, control.value.rootSchema)
|
|
324
431
|
)();
|
|
325
432
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
const actions = this.uischema.options?.actions ?? [];
|
|
337
|
-
return mapArrayActions(vueRouter.useRouter(), actions);
|
|
338
|
-
},
|
|
339
|
-
showDelete() {
|
|
340
|
-
return this.control.data?.length > 1;
|
|
341
|
-
},
|
|
342
|
-
translations() {
|
|
343
|
-
const jsonforms = vue.inject("jsonforms");
|
|
344
|
-
return core.getArrayTranslations(
|
|
345
|
-
jsonforms?.i18n?.translate ?? core.defaultJsonFormsI18nState.translate,
|
|
346
|
-
core.arrayDefaultTranslations,
|
|
347
|
-
this.control.i18nKeyPrefix,
|
|
348
|
-
this.control.label
|
|
349
|
-
);
|
|
350
|
-
},
|
|
351
|
-
labelKey() {
|
|
352
|
-
const key = this.uischema?.options?.labelKey;
|
|
433
|
+
const noData = vue.computed(
|
|
434
|
+
() => !control.value.data || control.value.data.length === 0
|
|
435
|
+
);
|
|
436
|
+
const actions = vue.computed(() => {
|
|
437
|
+
const actions2 = props.uischema.options?.actions ?? [];
|
|
438
|
+
return mapArrayActions(vueRouter.useRouter(), actions2);
|
|
439
|
+
});
|
|
440
|
+
const showDelete = vue.computed(() => control.value.data?.length > 1);
|
|
441
|
+
vue.computed(() => {
|
|
442
|
+
const key = control.value.uischema?.options?.labelKey;
|
|
353
443
|
if (!key) return null;
|
|
354
444
|
return key;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
deleteButtonClick(index) {
|
|
361
|
-
this.removeItems(this.control.path, [index])();
|
|
362
|
-
},
|
|
363
|
-
dispatchEvent: (event, data) => {
|
|
445
|
+
});
|
|
446
|
+
const deleteButtonClick = (index) => {
|
|
447
|
+
vanillaArrayControl.removeItems(control.value.path, [index])();
|
|
448
|
+
};
|
|
449
|
+
const dispatchEvent = (event, data) => {
|
|
364
450
|
const form_id = "";
|
|
365
451
|
useFormState().dispatchEvent(form_id, event, data);
|
|
366
|
-
}
|
|
367
|
-
addButtonClick() {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
core.createDefaultValue(
|
|
452
|
+
};
|
|
453
|
+
const addButtonClick = () => {
|
|
454
|
+
vanillaArrayControl.addItem(
|
|
455
|
+
control.value.path,
|
|
456
|
+
core.createDefaultValue(control.value.schema, control.value.rootSchema)
|
|
371
457
|
)();
|
|
372
|
-
}
|
|
458
|
+
};
|
|
459
|
+
const showActions = vue.computed(() => {
|
|
460
|
+
return !appliedOptions.value.hideActions;
|
|
461
|
+
});
|
|
462
|
+
return (_ctx, _cache) => {
|
|
463
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
464
|
+
title: vue.unref(control).label
|
|
465
|
+
}, [
|
|
466
|
+
vue.createElementVNode("div", {
|
|
467
|
+
class: vue.normalizeClass([
|
|
468
|
+
"flex gap-2",
|
|
469
|
+
vue.unref(appliedOptions)?.layout === "row" ? "flex-row items-center" : "flex-col"
|
|
470
|
+
])
|
|
471
|
+
}, [
|
|
472
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(control).data, (element, index) => {
|
|
473
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
474
|
+
key: `${vue.unref(control).path}-${index}`,
|
|
475
|
+
class: "flex-1"
|
|
476
|
+
}, [
|
|
477
|
+
vue.createElementVNode("div", {
|
|
478
|
+
class: vue.normalizeClass([
|
|
479
|
+
"flex gap-2",
|
|
480
|
+
vue.unref(appliedOptions)?.layout === "row" ? "flex-col" : "flex-row items-center"
|
|
481
|
+
])
|
|
482
|
+
}, [
|
|
483
|
+
vue.createElementVNode("div", null, [
|
|
484
|
+
vue.createVNode(vue.unref(vue$1.DispatchRenderer), {
|
|
485
|
+
schema: vue.unref(control).schema,
|
|
486
|
+
uischema: vue.unref(childUiSchema),
|
|
487
|
+
path: vue.unref(core.composePaths)(vue.unref(control).path, `${index}`),
|
|
488
|
+
enabled: vue.unref(control).enabled,
|
|
489
|
+
renderers: vue.unref(control).renderers,
|
|
490
|
+
cells: vue.unref(control).cells
|
|
491
|
+
}, null, 8, ["schema", "uischema", "path", "enabled", "renderers", "cells"])
|
|
492
|
+
]),
|
|
493
|
+
showActions.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
|
|
494
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(actions.value, (action) => {
|
|
495
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
496
|
+
action.show(element) ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
497
|
+
key: action.label,
|
|
498
|
+
icon: action.icon,
|
|
499
|
+
outline: true,
|
|
500
|
+
onClick: ($event) => dispatchEvent(action.label, element)
|
|
501
|
+
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
502
|
+
], 64);
|
|
503
|
+
}), 256)),
|
|
504
|
+
showDelete.value ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
505
|
+
key: 0,
|
|
506
|
+
icon: vue.unref(ui.IconEnum).Delete,
|
|
507
|
+
outline: true,
|
|
508
|
+
onClick: ($event) => deleteButtonClick(index)
|
|
509
|
+
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
510
|
+
])) : vue.createCommentVNode("", true)
|
|
511
|
+
], 2)
|
|
512
|
+
]);
|
|
513
|
+
}), 128)),
|
|
514
|
+
noData.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
515
|
+
key: 0,
|
|
516
|
+
class: vue.normalizeClass(["list-row", vue.unref(styles).arrayList.noData])
|
|
517
|
+
}, " No data ", 2)) : vue.createCommentVNode("", true),
|
|
518
|
+
showActions.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
|
|
519
|
+
vue.createVNode(vue.unref(ui.Btn), {
|
|
520
|
+
icon: vue.unref(ui.IconEnum).Plus,
|
|
521
|
+
outline: true,
|
|
522
|
+
onClick: addButtonClick
|
|
523
|
+
}, {
|
|
524
|
+
default: vue.withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
525
|
+
vue.createTextVNode(" Add ", -1)
|
|
526
|
+
])]),
|
|
527
|
+
_: 1
|
|
528
|
+
}, 8, ["icon"])
|
|
529
|
+
])) : vue.createCommentVNode("", true)
|
|
530
|
+
], 2)
|
|
531
|
+
], 8, _hoisted_1$8);
|
|
532
|
+
};
|
|
373
533
|
}
|
|
374
534
|
});
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
const _export_sfc = (sfc, props) => {
|
|
380
|
-
const target = sfc.__vccOpts || sfc;
|
|
381
|
-
for (const [key, val] of props) {
|
|
382
|
-
target[key] = val;
|
|
535
|
+
const arrayRenderers = [
|
|
536
|
+
{
|
|
537
|
+
tester: core.rankWith(12, isArrayRenderer),
|
|
538
|
+
renderer: _sfc_main$9
|
|
383
539
|
}
|
|
384
|
-
|
|
385
|
-
};
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
class: vue.normalizeClass(_ctx.styles.arrayList.legend)
|
|
414
|
-
}, vue.toDisplayString(element[_ctx.labelKey]?.toLowerCase()), 3)) : vue.createCommentVNode("", true),
|
|
415
|
-
vue.createElementVNode("div", _hoisted_2$2, [
|
|
416
|
-
vue.createVNode(_component_dispatch_renderer, {
|
|
417
|
-
schema: _ctx.control.schema,
|
|
418
|
-
uischema: _ctx.childUiSchema,
|
|
419
|
-
path: _ctx.composePaths(_ctx.control.path, `${index}`),
|
|
420
|
-
enabled: _ctx.control.enabled,
|
|
421
|
-
renderers: _ctx.control.renderers,
|
|
422
|
-
cells: _ctx.control.cells
|
|
423
|
-
}, null, 8, ["schema", "uischema", "path", "enabled", "renderers", "cells"]),
|
|
424
|
-
vue.createElementVNode("div", _hoisted_3$2, [
|
|
425
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.actions, (action) => {
|
|
426
|
-
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
427
|
-
action.show(element) ? (vue.openBlock(), vue.createBlock(_component_Btn, {
|
|
428
|
-
key: action.label,
|
|
429
|
-
icon: action.icon,
|
|
430
|
-
outline: true,
|
|
431
|
-
onClick: ($event) => _ctx.dispatchEvent(action.label, element)
|
|
432
|
-
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
433
|
-
], 64);
|
|
434
|
-
}), 256)),
|
|
435
|
-
_ctx.showDelete ? (vue.openBlock(), vue.createBlock(_component_Btn, {
|
|
436
|
-
key: 0,
|
|
437
|
-
icon: _ctx.IconEnum.Delete,
|
|
438
|
-
outline: true,
|
|
439
|
-
onClick: ($event) => _ctx.deleteButtonClick(index)
|
|
440
|
-
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
441
|
-
])
|
|
442
|
-
])
|
|
540
|
+
];
|
|
541
|
+
const _hoisted_1$7 = { class: "flex flex-col gap-4" };
|
|
542
|
+
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
543
|
+
__name: "CollapseLayout",
|
|
544
|
+
props: { ...vue$1.rendererProps() },
|
|
545
|
+
setup(__props) {
|
|
546
|
+
const props = __props;
|
|
547
|
+
const jsonLayout = vue$1.useJsonFormsLayout(props);
|
|
548
|
+
const { layout, renderers, cells } = jsonLayout;
|
|
549
|
+
const title = vue.computed(() => {
|
|
550
|
+
const { titleKey, title: title2 } = layout?.value.uischema?.options ?? {};
|
|
551
|
+
if (title2) return title2;
|
|
552
|
+
if (titleKey) return layout?.value.data[titleKey];
|
|
553
|
+
return layout?.value.uischema?.options?.titleKey;
|
|
554
|
+
});
|
|
555
|
+
return (_ctx, _cache) => {
|
|
556
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.Collapse), { title: title.value }, {
|
|
557
|
+
default: vue.withCtx(() => [
|
|
558
|
+
vue.createElementVNode("div", _hoisted_1$7, [
|
|
559
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(layout).uischema.elements, (element, index) => {
|
|
560
|
+
return vue.openBlock(), vue.createBlock(vue.unref(vue$1.DispatchRenderer), {
|
|
561
|
+
key: index,
|
|
562
|
+
schema: vue.unref(layout).schema,
|
|
563
|
+
uischema: element,
|
|
564
|
+
path: vue.unref(layout).path,
|
|
565
|
+
renderers: vue.unref(renderers),
|
|
566
|
+
cells: vue.unref(cells)
|
|
567
|
+
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"]);
|
|
568
|
+
}), 128))
|
|
443
569
|
])
|
|
444
|
-
])
|
|
445
|
-
}), 128))
|
|
446
|
-
]),
|
|
447
|
-
vue.createElementVNode("div", _hoisted_4$1, [
|
|
448
|
-
vue.createVNode(_component_Btn, {
|
|
449
|
-
icon: _ctx.IconEnum.Plus,
|
|
450
|
-
outline: true,
|
|
451
|
-
onClick: _ctx.addButtonClick
|
|
452
|
-
}, {
|
|
453
|
-
default: vue.withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
454
|
-
vue.createTextVNode(" Add ", -1)
|
|
455
|
-
])]),
|
|
570
|
+
]),
|
|
456
571
|
_: 1
|
|
457
|
-
}, 8, ["
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
572
|
+
}, 8, ["title"]);
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
const _hoisted_1$6 = { class: "flex flex-row gap-4 items-center" };
|
|
577
|
+
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
578
|
+
__name: "HorizontalLayout",
|
|
579
|
+
props: { ...vue$1.rendererProps() },
|
|
580
|
+
setup(__props) {
|
|
581
|
+
const props = __props;
|
|
582
|
+
const { layout, renderers, cells } = vue$1.useJsonFormsLayout(props);
|
|
583
|
+
return (_ctx, _cache) => {
|
|
584
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
|
|
585
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(layout).uischema.elements, (element, index) => {
|
|
586
|
+
return vue.openBlock(), vue.createBlock(vue.unref(vue$1.DispatchRenderer), {
|
|
587
|
+
key: index,
|
|
588
|
+
schema: vue.unref(layout).schema,
|
|
589
|
+
uischema: element,
|
|
590
|
+
path: vue.unref(layout).path,
|
|
591
|
+
renderers: vue.unref(renderers),
|
|
592
|
+
cells: vue.unref(cells)
|
|
593
|
+
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"]);
|
|
594
|
+
}), 128))
|
|
595
|
+
]);
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
const _hoisted_1$5 = { class: "flex flex-col gap-4" };
|
|
600
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
601
|
+
__name: "VerticalLayout",
|
|
602
|
+
props: { ...vue$1.rendererProps() },
|
|
603
|
+
setup(__props) {
|
|
604
|
+
const props = __props;
|
|
605
|
+
const { layout, renderers, cells } = vue$1.useJsonFormsLayout(props);
|
|
606
|
+
return (_ctx, _cache) => {
|
|
607
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
|
|
608
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(layout).uischema.elements, (element, index) => {
|
|
609
|
+
return vue.openBlock(), vue.createBlock(vue.unref(vue$1.DispatchRenderer), {
|
|
610
|
+
key: index,
|
|
611
|
+
schema: vue.unref(layout).schema,
|
|
612
|
+
uischema: element,
|
|
613
|
+
path: vue.unref(layout).path,
|
|
614
|
+
renderers: vue.unref(renderers),
|
|
615
|
+
cells: vue.unref(cells)
|
|
616
|
+
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"]);
|
|
617
|
+
}), 128))
|
|
618
|
+
]);
|
|
619
|
+
};
|
|
499
620
|
}
|
|
500
621
|
});
|
|
501
|
-
const entry = {
|
|
502
|
-
renderer: controlRenderer,
|
|
503
|
-
tester: core.rankWith(2, isFixedArray)
|
|
504
|
-
};
|
|
505
|
-
const _hoisted_1$5 = { class: "fieldset" };
|
|
506
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
507
|
-
const _component_dispatch_renderer = vue.resolveComponent("dispatch-renderer");
|
|
508
|
-
return _ctx.control.visible ? (vue.openBlock(), vue.createElementBlock("fieldset", {
|
|
509
|
-
key: 0,
|
|
510
|
-
class: vue.normalizeClass(_ctx.styles.arrayList.root)
|
|
511
|
-
}, [
|
|
512
|
-
!_ctx.labelKey ? (vue.openBlock(), vue.createElementBlock("legend", {
|
|
513
|
-
key: 0,
|
|
514
|
-
class: vue.normalizeClass(_ctx.styles.arrayList.legend)
|
|
515
|
-
}, [
|
|
516
|
-
vue.createElementVNode("label", {
|
|
517
|
-
class: vue.normalizeClass(_ctx.styles.arrayList.label)
|
|
518
|
-
}, vue.toDisplayString(_ctx.control.label), 3)
|
|
519
|
-
], 2)) : vue.createCommentVNode("", true),
|
|
520
|
-
vue.createElementVNode("div", {
|
|
521
|
-
class: vue.normalizeClass(_ctx.styles.fixedArrayList.root)
|
|
522
|
-
}, [
|
|
523
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.control.data, (element, index) => {
|
|
524
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
525
|
-
key: `${_ctx.control.path}-${index}`,
|
|
526
|
-
class: vue.normalizeClass(_ctx.styles.fixedArrayList.item)
|
|
527
|
-
}, [
|
|
528
|
-
vue.createElementVNode("fieldset", _hoisted_1$5, [
|
|
529
|
-
_ctx.labelKey ? (vue.openBlock(), vue.createElementBlock("legend", {
|
|
530
|
-
key: 0,
|
|
531
|
-
class: vue.normalizeClass(_ctx.styles.arrayList.legend)
|
|
532
|
-
}, vue.toDisplayString(element[_ctx.labelKey]?.toLowerCase()), 3)) : vue.createCommentVNode("", true),
|
|
533
|
-
vue.createVNode(_component_dispatch_renderer, {
|
|
534
|
-
schema: _ctx.control.schema,
|
|
535
|
-
uischema: _ctx.childUiSchema,
|
|
536
|
-
path: _ctx.composePaths(_ctx.control.path, `${index}`),
|
|
537
|
-
enabled: _ctx.control.enabled,
|
|
538
|
-
renderers: _ctx.control.renderers,
|
|
539
|
-
cells: _ctx.control.cells
|
|
540
|
-
}, null, 8, ["schema", "uischema", "path", "enabled", "renderers", "cells"])
|
|
541
|
-
])
|
|
542
|
-
], 2);
|
|
543
|
-
}), 128))
|
|
544
|
-
], 2),
|
|
545
|
-
_ctx.noData ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
546
|
-
key: 1,
|
|
547
|
-
class: vue.normalizeClass(_ctx.styles.arrayList.noData)
|
|
548
|
-
}, vue.toDisplayString(_ctx.translations.noDataMessage), 3)) : vue.createCommentVNode("", true)
|
|
549
|
-
], 2)) : vue.createCommentVNode("", true);
|
|
550
|
-
}
|
|
551
|
-
const FixedArrayRenderer = /* @__PURE__ */ _export_sfc(controlRenderer, [["render", _sfc_render]]);
|
|
552
|
-
const arrayRenderers = [
|
|
553
|
-
entry,
|
|
554
|
-
entry$1
|
|
555
|
-
];
|
|
556
622
|
const layoutRenderers = [
|
|
557
|
-
|
|
623
|
+
{
|
|
624
|
+
tester: core.rankWith(10, core.uiTypeIs(jsonFormsCore.LayoutTypes.VerticalLayout)),
|
|
625
|
+
renderer: _sfc_main$6
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
tester: core.rankWith(10, core.uiTypeIs(jsonFormsCore.LayoutTypes.HorizontalLayout)),
|
|
629
|
+
renderer: _sfc_main$7
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
tester: core.rankWith(10, core.uiTypeIs(jsonFormsCore.LayoutTypes.CollapseLayout)),
|
|
633
|
+
renderer: _sfc_main$8
|
|
634
|
+
}
|
|
558
635
|
];
|
|
559
636
|
const _hoisted_1$4 = { class: "" };
|
|
560
637
|
const _hoisted_2$1 = { class: "flex gap-2 items-center mb-2" };
|
|
561
|
-
const _hoisted_3
|
|
638
|
+
const _hoisted_3 = { class: "flex gap-2" };
|
|
562
639
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
563
640
|
__name: "table-filter",
|
|
564
641
|
props: {
|
|
@@ -602,7 +679,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
602
679
|
_: 1
|
|
603
680
|
})) : vue.createCommentVNode("", true)
|
|
604
681
|
]),
|
|
605
|
-
vue.createElementVNode("div", _hoisted_3
|
|
682
|
+
vue.createElementVNode("div", _hoisted_3, [
|
|
606
683
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.filters, (filter) => {
|
|
607
684
|
return vue.openBlock(), vue.createBlock(vue.unref(ui.BtnBadge), {
|
|
608
685
|
key: filter.key,
|
|
@@ -932,12 +1009,12 @@ const customRenderers = [
|
|
|
932
1009
|
const customRenderesName = customRenderers.map((c) => {
|
|
933
1010
|
return c.renderer.name;
|
|
934
1011
|
});
|
|
935
|
-
|
|
1012
|
+
vueVanilla.vanillaRenderers.filter(
|
|
936
1013
|
(v) => !customRenderesName.includes(v.renderer.name)
|
|
937
1014
|
);
|
|
938
1015
|
const tailwindRenderers = [
|
|
939
|
-
...
|
|
940
|
-
...
|
|
1016
|
+
...vueVanilla.vanillaRenderers,
|
|
1017
|
+
...customRenderers
|
|
941
1018
|
];
|
|
942
1019
|
const _hoisted_1$1 = ["id"];
|
|
943
1020
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -953,7 +1030,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
953
1030
|
"modelValue": {},
|
|
954
1031
|
"modelModifiers": {}
|
|
955
1032
|
}),
|
|
956
|
-
emits: /* @__PURE__ */ vue.mergeModels(["valid", "change", "submit"], ["update:modelValue"]),
|
|
1033
|
+
emits: /* @__PURE__ */ vue.mergeModels(["valid", "change", "submit", "errors"], ["update:modelValue"]),
|
|
957
1034
|
setup(__props, { emit: __emit }) {
|
|
958
1035
|
const properties = __props;
|
|
959
1036
|
const _JSON_FORM_ID = `json-form-${Date.now()}`;
|
|
@@ -966,6 +1043,8 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
966
1043
|
valid.value = event.errors.length === 0;
|
|
967
1044
|
emits("valid", valid.value);
|
|
968
1045
|
emits("change", event.data);
|
|
1046
|
+
emits("errors", event.errors);
|
|
1047
|
+
toolsVue.Debugger.debug(event.errors);
|
|
969
1048
|
};
|
|
970
1049
|
const onSubmit = (event) => {
|
|
971
1050
|
event.preventDefault();
|
|
@@ -1006,10 +1085,8 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1006
1085
|
};
|
|
1007
1086
|
}
|
|
1008
1087
|
});
|
|
1009
|
-
const _hoisted_1 = { class: "card
|
|
1010
|
-
const _hoisted_2 = { class: "
|
|
1011
|
-
const _hoisted_3 = { class: "card-title" };
|
|
1012
|
-
const _hoisted_4 = { class: "card-actions flex justify-end" };
|
|
1088
|
+
const _hoisted_1 = { class: "card-actions flex justify-between" };
|
|
1089
|
+
const _hoisted_2 = { class: "flex justify-end gap-2" };
|
|
1013
1090
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
1014
1091
|
__name: "form-with-actions.component",
|
|
1015
1092
|
props: /* @__PURE__ */ vue.mergeModels({
|
|
@@ -1026,25 +1103,35 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1026
1103
|
const properties = __props;
|
|
1027
1104
|
const valid = vue.ref(false);
|
|
1028
1105
|
const formData = vue.useModel(__props, "modelValue");
|
|
1106
|
+
const submitted = vue.ref(false);
|
|
1029
1107
|
const store = new FormStore(properties.formSchema);
|
|
1030
1108
|
const emits = __emit;
|
|
1031
1109
|
const save = () => {
|
|
1110
|
+
submitted.value = true;
|
|
1111
|
+
if (!valid.value) {
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1032
1114
|
store.save(formData.value.id, formData.value).then(() => {
|
|
1033
1115
|
emits("success");
|
|
1034
1116
|
});
|
|
1035
1117
|
};
|
|
1036
1118
|
const clear = () => {
|
|
1037
1119
|
formData.value = { id: null };
|
|
1120
|
+
submitted.value = false;
|
|
1038
1121
|
};
|
|
1039
1122
|
const onValid = (v) => {
|
|
1123
|
+
submitted.value = false;
|
|
1040
1124
|
valid.value = v;
|
|
1041
1125
|
};
|
|
1126
|
+
const title = vue.computed(() => {
|
|
1127
|
+
if (!properties.updateTitle) return properties.createTitle;
|
|
1128
|
+
return formData.value?.id ? properties.updateTitle : properties.createTitle;
|
|
1129
|
+
});
|
|
1042
1130
|
return (_ctx, _cache) => {
|
|
1043
|
-
return vue.openBlock(), vue.
|
|
1044
|
-
vue.
|
|
1045
|
-
vue.createElementVNode("h1", _hoisted_3, vue.toDisplayString(formData.value?.id ? __props.updateTitle : __props.createTitle), 1),
|
|
1131
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.Collapse), { title: title.value }, {
|
|
1132
|
+
default: vue.withCtx(() => [
|
|
1046
1133
|
vue.createVNode(_sfc_main$2, {
|
|
1047
|
-
id: `form_${
|
|
1134
|
+
id: `form_${__props.id}`,
|
|
1048
1135
|
modelValue: formData.value,
|
|
1049
1136
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.value = $event),
|
|
1050
1137
|
schema: __props.formSchema.form.schema,
|
|
@@ -1052,29 +1139,41 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1052
1139
|
onValid: _cache[1] || (_cache[1] = ($event) => onValid($event)),
|
|
1053
1140
|
onSubmit: save
|
|
1054
1141
|
}, null, 8, ["id", "modelValue", "schema", "uischema"]),
|
|
1055
|
-
vue.createElementVNode("div",
|
|
1056
|
-
vue.
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1142
|
+
vue.createElementVNode("div", _hoisted_1, [
|
|
1143
|
+
vue.createElementVNode("div", null, [
|
|
1144
|
+
!valid.value && submitted.value ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Alert), {
|
|
1145
|
+
key: 0,
|
|
1146
|
+
message: "The form is not valid",
|
|
1147
|
+
type: "error"
|
|
1148
|
+
})) : vue.createCommentVNode("", true)
|
|
1149
|
+
]),
|
|
1150
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
1151
|
+
vue.renderSlot(_ctx.$slots, "actions"),
|
|
1152
|
+
!formData.value.id ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
1153
|
+
key: 0,
|
|
1154
|
+
outline: true,
|
|
1155
|
+
onClick: clear
|
|
1156
|
+
}, {
|
|
1157
|
+
default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
1158
|
+
vue.createTextVNode(" Clear ", -1)
|
|
1159
|
+
])]),
|
|
1160
|
+
_: 1
|
|
1161
|
+
})) : vue.createCommentVNode("", true),
|
|
1162
|
+
vue.createVNode(vue.unref(ui.Btn), {
|
|
1163
|
+
color: vue.unref(ui.Color).primary,
|
|
1164
|
+
disabled: submitted.value,
|
|
1165
|
+
onClick: save
|
|
1166
|
+
}, {
|
|
1167
|
+
default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
1168
|
+
vue.createTextVNode(" Save ", -1)
|
|
1169
|
+
])]),
|
|
1170
|
+
_: 1
|
|
1171
|
+
}, 8, ["color", "disabled"])
|
|
1172
|
+
])
|
|
1075
1173
|
])
|
|
1076
|
-
])
|
|
1077
|
-
|
|
1174
|
+
]),
|
|
1175
|
+
_: 3
|
|
1176
|
+
}, 8, ["title"]);
|
|
1078
1177
|
};
|
|
1079
1178
|
}
|
|
1080
1179
|
});
|
|
@@ -1199,7 +1298,7 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
|
1199
1298
|
const create = (object, options2) => {
|
|
1200
1299
|
return httpRequest.post(getDataUri(), object, options2).then((response) => {
|
|
1201
1300
|
handleSuccess(`Created ${notificationEntity}`);
|
|
1202
|
-
return response;
|
|
1301
|
+
return response.data;
|
|
1203
1302
|
}).catch((response) => {
|
|
1204
1303
|
handleError(response, `Failed to create ${notificationEntity}`);
|
|
1205
1304
|
});
|
|
@@ -1207,13 +1306,17 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
|
1207
1306
|
const patch = (id, object, options2) => {
|
|
1208
1307
|
return httpRequest.patch(getDataUri(id), object, options2).then((response) => {
|
|
1209
1308
|
handleSuccess(`Saved ${notificationEntity}`);
|
|
1210
|
-
return response;
|
|
1309
|
+
return response.data;
|
|
1211
1310
|
}).catch((response) => {
|
|
1212
1311
|
handleError(response, `Failed to save ${notificationEntity}`);
|
|
1213
1312
|
});
|
|
1214
1313
|
};
|
|
1215
1314
|
const get = (id, options2) => {
|
|
1216
|
-
return httpRequest.get(getDataUri(id), options2)
|
|
1315
|
+
return httpRequest.get(getDataUri(id), options2).then((response) => {
|
|
1316
|
+
return response.data;
|
|
1317
|
+
}).catch((response) => {
|
|
1318
|
+
handleError(response, `Failed to load data`);
|
|
1319
|
+
});
|
|
1217
1320
|
};
|
|
1218
1321
|
const _delete = (id, options2) => {
|
|
1219
1322
|
return httpRequest.delete(getDataUri(id), options2).then((response) => {
|
|
@@ -1228,26 +1331,27 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
|
1228
1331
|
objects.map((object) => httpRequest.post(getDataUri(), object, options2))
|
|
1229
1332
|
).then((response) => {
|
|
1230
1333
|
handleSuccess(`Created ${notificationEntity}`);
|
|
1231
|
-
return response;
|
|
1334
|
+
return response.data;
|
|
1232
1335
|
}).catch((response) => {
|
|
1233
1336
|
handleError(response, `Failed to save ${notificationEntity}`);
|
|
1234
1337
|
});
|
|
1235
1338
|
};
|
|
1236
1339
|
return { create, patch, createMulti, delete: _delete, get };
|
|
1237
1340
|
};
|
|
1238
|
-
exports.ArrayRenderer =
|
|
1239
|
-
exports.AutocompleteControlRenderer = _sfc_main$
|
|
1240
|
-
exports.BooleanControlRenderer = _sfc_main$
|
|
1241
|
-
exports.FixedArrayRenderer = FixedArrayRenderer;
|
|
1341
|
+
exports.ArrayRenderer = _sfc_main$9;
|
|
1342
|
+
exports.AutocompleteControlRenderer = _sfc_main$i;
|
|
1343
|
+
exports.BooleanControlRenderer = _sfc_main$h;
|
|
1242
1344
|
exports.FormComponent = _sfc_main$2;
|
|
1243
1345
|
exports.FormModal = _sfc_main;
|
|
1244
1346
|
exports.FormModalService = FormModalService;
|
|
1245
1347
|
exports.FormStore = FormStore;
|
|
1246
1348
|
exports.FormWithActions = _sfc_main$1;
|
|
1247
1349
|
exports.FormWithTableComponent = _sfc_main$3;
|
|
1248
|
-
exports.IntegerControlRenderer = _sfc_main$
|
|
1249
|
-
exports.
|
|
1250
|
-
exports.
|
|
1350
|
+
exports.IntegerControlRenderer = _sfc_main$g;
|
|
1351
|
+
exports.MultiSelectControlRender = _sfc_main$e;
|
|
1352
|
+
exports.NumberControlRenderer = _sfc_main$d;
|
|
1353
|
+
exports.SelectControlRender = _sfc_main$c;
|
|
1354
|
+
exports.StringControlRenderer = _sfc_main$b;
|
|
1251
1355
|
exports.TableComponent = _sfc_main$4;
|
|
1252
1356
|
exports.arrayRenderers = arrayRenderers;
|
|
1253
1357
|
exports.controlRenderers = controlRenderers;
|
|
@@ -1255,10 +1359,11 @@ exports.createRepository = createRepository;
|
|
|
1255
1359
|
exports.isArrayRenderer = isArrayRenderer;
|
|
1256
1360
|
exports.isAutoCompleteControl = isAutoCompleteControl;
|
|
1257
1361
|
exports.isCustomControl = isCustomControl;
|
|
1258
|
-
exports.isFixedArray = isFixedArray;
|
|
1259
1362
|
exports.isMarkdownControl = isMarkdownControl;
|
|
1363
|
+
exports.isMultiselectControl = isMultiselectControl;
|
|
1364
|
+
exports.isSelectControl = isSelectControl;
|
|
1260
1365
|
exports.isStringFormat = isStringFormat;
|
|
1261
1366
|
exports.isTextAreaControl = isTextAreaControl;
|
|
1262
1367
|
exports.layoutRenderers = layoutRenderers;
|
|
1263
|
-
exports.markdownControlRenderer = _sfc_main$
|
|
1368
|
+
exports.markdownControlRenderer = _sfc_main$f;
|
|
1264
1369
|
exports.useFormState = useFormState;
|