@ghentcdh/json-forms-vue 0.6.6 → 0.6.8
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 +465 -623
- package/index.mjs +470 -628
- package/package.json +4 -4
- package/renderes/array/ArrayRenderer.vue.d.ts +71 -183
- package/renderes/array/index.d.ts +75 -2
- package/renderes/controls/BooleanControlRenderer.vue.d.ts +71 -109
- package/renderes/controls/IntegerControlRenderer.vue.d.ts +71 -110
- package/renderes/controls/MarkdownControlRenderer.vue.d.ts +71 -81
- package/renderes/controls/NumberControlRenderer.vue.d.ts +71 -110
- package/renderes/controls/StringControlRenderer.vue.d.ts +71 -109
- package/renderes/controls/TextAreaControlRenderer.vue.d.ts +71 -107
- package/renderes/controls/autocomplete/AutocompleteControlRenderer.vue.d.ts +71 -96
- package/renderes/controls/index.d.ts +519 -1
- package/renderes/index.d.ts +667 -1
- 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 +0 -1
- package/renderes/array/FixedArrayRenderer.vue.d.ts +0 -127
package/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useApi } from "@ghentcdh/tools-vue";
|
|
2
|
-
import { NotificationService,
|
|
3
|
-
import { rankWith,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { useApi, Debugger } from "@ghentcdh/tools-vue";
|
|
2
|
+
import { NotificationService, Checkbox, InputNumber, Markdown, Input, Textarea, Autocomplete, IconEnum, Btn, Collapse, BtnBadge, TextCell, Table, hasCustomEventListener, Card, ModalService, myStyles, Alert, Color, Modal } from "@ghentcdh/ui";
|
|
3
|
+
import { uiTypeIs, rankWith, isNumberControl, isIntegerControl, isBooleanControl, createDefaultValue, composePaths } from "@jsonforms/core";
|
|
4
|
+
import { ref, computed, defineComponent, openBlock, createBlock, unref, mergeProps, createElementBlock, createElementVNode, normalizeClass, Fragment, renderList, createVNode, createCommentVNode, withCtx, createTextVNode, watch, toDisplayString, useModel, provide, mergeModels, renderSlot } from "vue";
|
|
5
|
+
import { useJsonFormsControl, rendererProps, useJsonFormsArrayControl, DispatchRenderer, useJsonFormsLayout, JsonForms } from "@jsonforms/vue";
|
|
6
6
|
import { useVanillaControl, useVanillaArrayControl, vanillaRenderers } from "@jsonforms/vue-vanilla";
|
|
7
|
+
import { omit, isArray } from "lodash-es";
|
|
7
8
|
import { and, optionIs, or, schemaTypeIs } from "@jsonforms/core/src/testers/testers";
|
|
8
|
-
import { ControlType, RequestSchema, extractFilters, findColumnDef } from "@ghentcdh/json-forms-core";
|
|
9
|
+
import { ControlType, LayoutTypes, RequestSchema, extractFilters, findColumnDef } from "@ghentcdh/json-forms-core";
|
|
9
10
|
import { useRouter, useRoute } from "vue-router";
|
|
10
|
-
import { isArray } from "lodash-es";
|
|
11
11
|
import { computedAsync } from "@vueuse/core";
|
|
12
12
|
class FormStore {
|
|
13
13
|
constructor(schema) {
|
|
@@ -46,158 +46,169 @@ const useVanillaControlCustom = (input, adaptTarget = (v) => v.value) => {
|
|
|
46
46
|
isTouched.value = true;
|
|
47
47
|
isFocused.value = false;
|
|
48
48
|
};
|
|
49
|
-
const
|
|
49
|
+
const controlWrapper = computed(() => {
|
|
50
50
|
return {
|
|
51
51
|
...vanillaControl.controlWrapper.value,
|
|
52
|
+
...omit(vanillaControl.appliedOptions.value, "styles"),
|
|
52
53
|
isFocused: isFocused.value,
|
|
53
54
|
isTouched: isTouched.value
|
|
54
55
|
};
|
|
55
56
|
});
|
|
56
57
|
return {
|
|
57
58
|
...vanillaControl,
|
|
58
|
-
controlWrapper
|
|
59
|
+
controlWrapper,
|
|
59
60
|
isFocused,
|
|
60
61
|
isTouched,
|
|
61
62
|
onFocus,
|
|
62
63
|
onBlur
|
|
64
|
+
// handleChange,
|
|
63
65
|
};
|
|
64
66
|
};
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
68
|
+
__name: "BooleanControlRenderer",
|
|
69
|
+
props: { ...rendererProps() },
|
|
70
|
+
setup(__props) {
|
|
71
|
+
const props = __props;
|
|
72
|
+
const { control, onChange, appliedOptions, onFocus, onBlur, controlWrapper } = useVanillaControlCustom(useJsonFormsControl(props), (target) => {
|
|
73
|
+
return Boolean(target.value) ?? false;
|
|
74
|
+
});
|
|
75
|
+
return (_ctx, _cache) => {
|
|
76
|
+
return openBlock(), createBlock(unref(Checkbox), mergeProps(unref(controlWrapper), {
|
|
77
|
+
modelValue: unref(control).data,
|
|
78
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
|
|
79
|
+
enabled: unref(control).enabled,
|
|
80
|
+
config: unref(appliedOptions),
|
|
81
|
+
onChange: unref(onChange),
|
|
82
|
+
onFocus: unref(onFocus),
|
|
83
|
+
onBlur: unref(onBlur)
|
|
84
|
+
}), null, 16, ["modelValue", "enabled", "config", "onChange", "onFocus", "onBlur"]);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
89
|
+
__name: "IntegerControlRenderer",
|
|
90
|
+
props: { ...rendererProps() },
|
|
91
|
+
setup(__props) {
|
|
92
|
+
const props = __props;
|
|
93
|
+
const { control, onChange, appliedOptions, onFocus, onBlur, controlWrapper } = useVanillaControlCustom(
|
|
75
94
|
useJsonFormsControl(props),
|
|
76
|
-
(target) =>
|
|
77
|
-
return Boolean(target.value) ?? false;
|
|
78
|
-
}
|
|
95
|
+
(target) => target.value === "" ? void 0 : Number(target.value)
|
|
79
96
|
);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
const steps = computed(() => appliedOptions.value.steps ?? 1);
|
|
98
|
+
return (_ctx, _cache) => {
|
|
99
|
+
return openBlock(), createBlock(unref(InputNumber), mergeProps(unref(controlWrapper), {
|
|
100
|
+
modelValue: unref(control).data,
|
|
101
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
|
|
102
|
+
enabled: unref(control).enabled,
|
|
103
|
+
config: unref(appliedOptions),
|
|
104
|
+
steps: steps.value,
|
|
105
|
+
onChange: unref(onChange),
|
|
106
|
+
onFocus: unref(onFocus),
|
|
107
|
+
onBlur: unref(onBlur)
|
|
108
|
+
}), null, 16, ["modelValue", "enabled", "config", "steps", "onChange", "onFocus", "onBlur"]);
|
|
109
|
+
};
|
|
89
110
|
}
|
|
90
111
|
});
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
112
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
113
|
+
__name: "MarkdownControlRenderer",
|
|
114
|
+
props: { ...rendererProps() },
|
|
115
|
+
setup(__props) {
|
|
116
|
+
const props = __props;
|
|
117
|
+
const {
|
|
118
|
+
control,
|
|
119
|
+
handleChange,
|
|
120
|
+
appliedOptions,
|
|
121
|
+
onFocus,
|
|
122
|
+
onBlur,
|
|
123
|
+
controlWrapper
|
|
124
|
+
} = useVanillaControlCustom(useJsonFormsControl(props));
|
|
125
|
+
const changeValue = (value) => {
|
|
126
|
+
handleChange(control.value.path, value);
|
|
127
|
+
};
|
|
128
|
+
return (_ctx, _cache) => {
|
|
129
|
+
return openBlock(), createBlock(unref(Markdown), mergeProps(unref(controlWrapper), {
|
|
130
|
+
modelValue: unref(control).data,
|
|
131
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
|
|
132
|
+
enabled: unref(control).enabled,
|
|
133
|
+
config: unref(appliedOptions),
|
|
134
|
+
onChange: changeValue,
|
|
135
|
+
onFocus: unref(onFocus),
|
|
136
|
+
onBlur: unref(onBlur)
|
|
137
|
+
}), null, 16, ["modelValue", "enabled", "config", "onFocus", "onBlur"]);
|
|
138
|
+
};
|
|
99
139
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const _component_control_wrapper = resolveComponent("control-wrapper");
|
|
108
|
-
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
109
|
-
createVNode(_component_control_wrapper, mergeProps(_ctx.controlWrapper, {
|
|
110
|
-
styles: _ctx.styles,
|
|
111
|
-
"hide-label": true
|
|
112
|
-
}), {
|
|
113
|
-
default: withCtx(() => [
|
|
114
|
-
createElementVNode("label", _hoisted_2$3, [
|
|
115
|
-
createElementVNode("input", {
|
|
116
|
-
id: _ctx.control.id + "-input",
|
|
117
|
-
type: "checkbox",
|
|
118
|
-
class: normalizeClass(["checkbox"]),
|
|
119
|
-
checked: _ctx.control.data,
|
|
120
|
-
disabled: !_ctx.control.enabled,
|
|
121
|
-
autofocus: _ctx.appliedOptions.focus,
|
|
122
|
-
placeholder: _ctx.appliedOptions.placeholder,
|
|
123
|
-
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
124
|
-
onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
125
|
-
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
|
|
126
|
-
}, null, 40, _hoisted_3$3),
|
|
127
|
-
createElementVNode("span", _hoisted_4$2, toDisplayString(_ctx.control.label), 1)
|
|
128
|
-
])
|
|
129
|
-
]),
|
|
130
|
-
_: 1
|
|
131
|
-
}, 16, ["styles"])
|
|
132
|
-
]);
|
|
133
|
-
}
|
|
134
|
-
const BooleanControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$8, [["render", _sfc_render$7]]);
|
|
135
|
-
const showErrors = (isTouched, isFocused, errors) => {
|
|
136
|
-
return !!(isTouched && errors);
|
|
137
|
-
};
|
|
138
|
-
const inputClasses = (styles, isFocused, isTouched, errors) => {
|
|
139
|
-
return [
|
|
140
|
-
styles?.control.input,
|
|
141
|
-
{ "input-error": showErrors(isTouched, isFocused, errors) }
|
|
142
|
-
];
|
|
143
|
-
};
|
|
144
|
-
const controlRenderer$7 = defineComponent({
|
|
145
|
-
name: "IntegerControlRenderer",
|
|
146
|
-
components: {
|
|
147
|
-
ControlWrapper
|
|
148
|
-
},
|
|
149
|
-
props: {
|
|
150
|
-
...rendererProps()
|
|
151
|
-
},
|
|
152
|
-
setup(props) {
|
|
153
|
-
return useVanillaControlCustom(
|
|
140
|
+
});
|
|
141
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
142
|
+
__name: "NumberControlRenderer",
|
|
143
|
+
props: { ...rendererProps() },
|
|
144
|
+
setup(__props) {
|
|
145
|
+
const props = __props;
|
|
146
|
+
const { control, onChange, appliedOptions, onFocus, onBlur, controlWrapper } = useVanillaControlCustom(
|
|
154
147
|
useJsonFormsControl(props),
|
|
155
148
|
(target) => target.value === "" ? void 0 : Number(target.value)
|
|
156
149
|
);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
150
|
+
const steps = computed(() => appliedOptions.value.steps ?? 0.01);
|
|
151
|
+
return (_ctx, _cache) => {
|
|
152
|
+
return openBlock(), createBlock(unref(InputNumber), mergeProps(unref(controlWrapper), {
|
|
153
|
+
modelValue: unref(control).data,
|
|
154
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
|
|
155
|
+
enabled: unref(control).enabled,
|
|
156
|
+
config: unref(appliedOptions),
|
|
157
|
+
steps: steps.value,
|
|
158
|
+
onChange: unref(onChange),
|
|
159
|
+
onFocus: unref(onFocus),
|
|
160
|
+
onBlur: unref(onBlur)
|
|
161
|
+
}), null, 16, ["modelValue", "enabled", "config", "steps", "onChange", "onFocus", "onBlur"]);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
166
|
+
__name: "StringControlRenderer",
|
|
167
|
+
props: { ...rendererProps() },
|
|
168
|
+
setup(__props) {
|
|
169
|
+
const props = __props;
|
|
170
|
+
const {
|
|
171
|
+
control,
|
|
172
|
+
onChange,
|
|
173
|
+
appliedOptions,
|
|
174
|
+
onFocus,
|
|
175
|
+
onBlur,
|
|
176
|
+
controlWrapper,
|
|
177
|
+
styles
|
|
178
|
+
} = useVanillaControlCustom(useJsonFormsControl(props));
|
|
179
|
+
return (_ctx, _cache) => {
|
|
180
|
+
return openBlock(), createBlock(unref(Input), mergeProps(unref(controlWrapper), {
|
|
181
|
+
modelValue: unref(control).data,
|
|
182
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
|
|
183
|
+
enabled: unref(control).enabled,
|
|
184
|
+
config: unref(appliedOptions),
|
|
185
|
+
styles: unref(styles),
|
|
186
|
+
onChange: unref(onChange),
|
|
187
|
+
onFocus: unref(onFocus),
|
|
188
|
+
onBlur: unref(onBlur)
|
|
189
|
+
}), null, 16, ["modelValue", "enabled", "config", "styles", "onChange", "onFocus", "onBlur"]);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
194
|
+
__name: "TextAreaControlRenderer",
|
|
195
|
+
props: { ...rendererProps() },
|
|
196
|
+
setup(__props) {
|
|
197
|
+
const props = __props;
|
|
198
|
+
const { control, onChange, appliedOptions, onFocus, onBlur, controlWrapper } = useVanillaControlCustom(useJsonFormsControl(props));
|
|
199
|
+
return (_ctx, _cache) => {
|
|
200
|
+
return openBlock(), createBlock(unref(Textarea), mergeProps(unref(controlWrapper), {
|
|
201
|
+
modelValue: unref(control).data,
|
|
202
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
|
|
203
|
+
enabled: unref(control).enabled,
|
|
204
|
+
config: unref(appliedOptions),
|
|
205
|
+
onChange: unref(onChange),
|
|
206
|
+
onFocus: unref(onFocus),
|
|
207
|
+
onBlur: unref(onBlur)
|
|
208
|
+
}), null, 16, ["modelValue", "enabled", "config", "onChange", "onFocus", "onBlur"]);
|
|
209
|
+
};
|
|
171
210
|
}
|
|
172
211
|
});
|
|
173
|
-
const entry$7 = {
|
|
174
|
-
renderer: controlRenderer$7,
|
|
175
|
-
tester: rankWith(1, isIntegerControl)
|
|
176
|
-
};
|
|
177
|
-
const _hoisted_1$9 = ["id", "step", "value", "disabled", "autofocus", "placeholder"];
|
|
178
|
-
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
179
|
-
const _component_control_wrapper = resolveComponent("control-wrapper");
|
|
180
|
-
return openBlock(), createBlock(_component_control_wrapper, mergeProps(_ctx.controlWrapper, { styles: _ctx.styles }), {
|
|
181
|
-
default: withCtx(() => [
|
|
182
|
-
createElementVNode("input", {
|
|
183
|
-
id: _ctx.control.id + "-input",
|
|
184
|
-
autocomplete: "off",
|
|
185
|
-
type: "number",
|
|
186
|
-
step: _ctx.step,
|
|
187
|
-
class: normalizeClass(_ctx.inputClass),
|
|
188
|
-
value: _ctx.control.data,
|
|
189
|
-
disabled: !_ctx.control.enabled,
|
|
190
|
-
autofocus: _ctx.appliedOptions.focus,
|
|
191
|
-
placeholder: _ctx.appliedOptions.placeholder,
|
|
192
|
-
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
193
|
-
onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
194
|
-
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
|
|
195
|
-
}, null, 42, _hoisted_1$9)
|
|
196
|
-
]),
|
|
197
|
-
_: 1
|
|
198
|
-
}, 16, ["styles"]);
|
|
199
|
-
}
|
|
200
|
-
const IntegerControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$7, [["render", _sfc_render$6]]);
|
|
201
212
|
const isAutoCompleteControl = and(
|
|
202
213
|
// uiTypeIs('Control'),
|
|
203
214
|
optionIs("format", ControlType.autocomplete)
|
|
@@ -214,10 +225,6 @@ const isMarkdownControl = and(
|
|
|
214
225
|
uiTypeIs("Control"),
|
|
215
226
|
optionIs("format", ControlType.markdown)
|
|
216
227
|
);
|
|
217
|
-
const isFixedArray = and(
|
|
218
|
-
schemaTypeIs("array"),
|
|
219
|
-
optionIs("format", ControlType.fixedArray)
|
|
220
|
-
);
|
|
221
228
|
const isArrayRenderer = and(
|
|
222
229
|
schemaTypeIs("array")
|
|
223
230
|
// optionIs('format', ControlType.array),
|
|
@@ -228,228 +235,61 @@ const isCustomControl = (customType) => {
|
|
|
228
235
|
optionIs("type", customType)
|
|
229
236
|
);
|
|
230
237
|
};
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
);
|
|
244
|
-
const field =
|
|
238
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
239
|
+
__name: "AutocompleteControlRenderer",
|
|
240
|
+
props: { ...rendererProps() },
|
|
241
|
+
setup(__props) {
|
|
242
|
+
const props = __props;
|
|
243
|
+
const {
|
|
244
|
+
control,
|
|
245
|
+
handleChange: _handleChange,
|
|
246
|
+
appliedOptions,
|
|
247
|
+
onFocus,
|
|
248
|
+
onBlur,
|
|
249
|
+
controlWrapper
|
|
250
|
+
} = useVanillaControlCustom(useJsonFormsControl(props));
|
|
251
|
+
const field = computed(() => appliedOptions.value.field);
|
|
245
252
|
const handleChange = (result) => {
|
|
246
|
-
const { path } = control.
|
|
247
|
-
|
|
253
|
+
const { path } = control.value;
|
|
254
|
+
_handleChange(path, result);
|
|
248
255
|
};
|
|
249
|
-
return
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
enabled: _ctx.control.enabled,
|
|
262
|
-
config: _ctx.appliedOptions,
|
|
263
|
-
onChange: _ctx.handleChange,
|
|
264
|
-
onFocus: _ctx.onFocus,
|
|
265
|
-
onBlur: _ctx.onBlur
|
|
266
|
-
}), null, 16, ["modelValue", "enabled", "config", "onChange", "onFocus", "onBlur"]);
|
|
267
|
-
}
|
|
268
|
-
const MarkdownControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$6, [["render", _sfc_render$5]]);
|
|
269
|
-
const controlRenderer$5 = defineComponent({
|
|
270
|
-
name: "NumberControlRenderer",
|
|
271
|
-
components: {
|
|
272
|
-
ControlWrapper
|
|
273
|
-
},
|
|
274
|
-
props: {
|
|
275
|
-
...rendererProps()
|
|
276
|
-
},
|
|
277
|
-
setup(props) {
|
|
278
|
-
return useVanillaControlCustom(
|
|
279
|
-
useJsonFormsControl(props),
|
|
280
|
-
(target) => target.value === "" ? void 0 : Number(target.value)
|
|
281
|
-
);
|
|
282
|
-
},
|
|
283
|
-
computed: {
|
|
284
|
-
step() {
|
|
285
|
-
const options = this.appliedOptions;
|
|
286
|
-
return options.step ?? 0.1;
|
|
287
|
-
},
|
|
288
|
-
inputClass() {
|
|
289
|
-
return inputClasses(
|
|
290
|
-
this.styles,
|
|
291
|
-
this.isFocused,
|
|
292
|
-
this.isTouched,
|
|
293
|
-
this.controlWrapper?.errors
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
const entry$5 = {
|
|
299
|
-
renderer: controlRenderer$5,
|
|
300
|
-
tester: rankWith(1, isNumberControl)
|
|
301
|
-
};
|
|
302
|
-
const _hoisted_1$8 = ["id", "step", "value", "disabled", "autofocus", "placeholder"];
|
|
303
|
-
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
304
|
-
const _component_control_wrapper = resolveComponent("control-wrapper");
|
|
305
|
-
return openBlock(), createBlock(_component_control_wrapper, mergeProps(_ctx.controlWrapper, { styles: _ctx.styles }), {
|
|
306
|
-
default: withCtx(() => [
|
|
307
|
-
createElementVNode("input", {
|
|
308
|
-
id: _ctx.control.id + "-input",
|
|
309
|
-
autocomplete: "off",
|
|
310
|
-
type: "number",
|
|
311
|
-
step: _ctx.step,
|
|
312
|
-
class: normalizeClass(_ctx.inputClass),
|
|
313
|
-
value: _ctx.control.data,
|
|
314
|
-
disabled: !_ctx.control.enabled,
|
|
315
|
-
autofocus: _ctx.appliedOptions.focus,
|
|
316
|
-
placeholder: _ctx.appliedOptions.placeholder,
|
|
317
|
-
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
318
|
-
onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
319
|
-
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
|
|
320
|
-
}, null, 42, _hoisted_1$8)
|
|
321
|
-
]),
|
|
322
|
-
_: 1
|
|
323
|
-
}, 16, ["styles"]);
|
|
324
|
-
}
|
|
325
|
-
const NumberControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$5, [["render", _sfc_render$4]]);
|
|
326
|
-
const controlRenderer$4 = defineComponent({
|
|
327
|
-
name: "StringControlRenderer",
|
|
328
|
-
components: {
|
|
329
|
-
ControlWrapper
|
|
330
|
-
},
|
|
331
|
-
props: {
|
|
332
|
-
...rendererProps()
|
|
333
|
-
},
|
|
334
|
-
setup(props) {
|
|
335
|
-
return useVanillaControlCustom(
|
|
336
|
-
useJsonFormsControl(props),
|
|
337
|
-
(target) => target.value ?? void 0
|
|
338
|
-
);
|
|
339
|
-
},
|
|
340
|
-
computed: {
|
|
341
|
-
inputClass() {
|
|
342
|
-
return inputClasses(
|
|
343
|
-
this.styles,
|
|
344
|
-
this.isFocused,
|
|
345
|
-
this.isTouched,
|
|
346
|
-
this.controlWrapper?.errors
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
const entry$4 = {
|
|
352
|
-
renderer: controlRenderer$4,
|
|
353
|
-
tester: rankWith(1, isStringFormat)
|
|
354
|
-
};
|
|
355
|
-
const _hoisted_1$7 = ["id", "value", "disabled", "autofocus", "placeholder"];
|
|
356
|
-
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
357
|
-
const _component_ControlWrapper = resolveComponent("ControlWrapper");
|
|
358
|
-
return openBlock(), createBlock(_component_ControlWrapper, mergeProps(_ctx.controlWrapper, { styles: _ctx.styles }), {
|
|
359
|
-
default: withCtx(() => [
|
|
360
|
-
createElementVNode("input", {
|
|
361
|
-
id: _ctx.control.id + "-input",
|
|
362
|
-
type: "text",
|
|
363
|
-
class: normalizeClass(_ctx.inputClass),
|
|
364
|
-
value: _ctx.control.data,
|
|
365
|
-
disabled: !_ctx.control.enabled,
|
|
366
|
-
autofocus: _ctx.appliedOptions.focus,
|
|
367
|
-
placeholder: _ctx.appliedOptions.placeholder,
|
|
368
|
-
autocomplete: "off",
|
|
369
|
-
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
370
|
-
onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
371
|
-
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
|
|
372
|
-
}, null, 42, _hoisted_1$7)
|
|
373
|
-
]),
|
|
374
|
-
_: 1
|
|
375
|
-
}, 16, ["styles"]);
|
|
376
|
-
}
|
|
377
|
-
const StringControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$4, [["render", _sfc_render$3]]);
|
|
378
|
-
const controlRenderer$3 = defineComponent({
|
|
379
|
-
name: "TextAreaControlRenderer",
|
|
380
|
-
components: {
|
|
381
|
-
ControlWrapper
|
|
382
|
-
},
|
|
383
|
-
props: {
|
|
384
|
-
...rendererProps()
|
|
385
|
-
},
|
|
386
|
-
setup(props) {
|
|
387
|
-
return useVanillaControlCustom(
|
|
388
|
-
useJsonFormsControl(props),
|
|
389
|
-
(target) => target.value ?? void 0
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
});
|
|
393
|
-
const entry$3 = {
|
|
394
|
-
renderer: controlRenderer$3,
|
|
395
|
-
tester: rankWith(1, isTextAreaControl)
|
|
396
|
-
};
|
|
397
|
-
const controlRenderer$2 = defineComponent({
|
|
398
|
-
name: "AutocompleteControlRenderer",
|
|
399
|
-
components: {
|
|
400
|
-
Autocomplete
|
|
401
|
-
},
|
|
402
|
-
props: {
|
|
403
|
-
...rendererProps()
|
|
404
|
-
},
|
|
405
|
-
setup(props) {
|
|
406
|
-
const control = useVanillaControlCustom(
|
|
407
|
-
useJsonFormsControl(props),
|
|
408
|
-
(target) => target.value ?? void 0
|
|
409
|
-
);
|
|
410
|
-
const field = control.appliedOptions.value.field;
|
|
411
|
-
const handleChange = (result) => {
|
|
412
|
-
const { path } = control.control.value;
|
|
413
|
-
control.handleChange(path, result);
|
|
256
|
+
return (_ctx, _cache) => {
|
|
257
|
+
return openBlock(), createBlock(unref(Autocomplete), mergeProps(unref(controlWrapper), {
|
|
258
|
+
modelValue: unref(control).data,
|
|
259
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
|
|
260
|
+
enabled: unref(control).enabled,
|
|
261
|
+
config: unref(appliedOptions),
|
|
262
|
+
"label-key": field.value?.label,
|
|
263
|
+
"value-key": field.value?.id,
|
|
264
|
+
onChange: handleChange,
|
|
265
|
+
onFocus: unref(onFocus),
|
|
266
|
+
onBlur: unref(onBlur)
|
|
267
|
+
}), null, 16, ["modelValue", "enabled", "config", "label-key", "value-key", "onFocus", "onBlur"]);
|
|
414
268
|
};
|
|
415
|
-
return { ...control, field, handleChange };
|
|
416
269
|
}
|
|
417
270
|
});
|
|
418
|
-
const entry$2 = {
|
|
419
|
-
renderer: controlRenderer$2,
|
|
420
|
-
tester: rankWith(1, isAutoCompleteControl)
|
|
421
|
-
};
|
|
422
|
-
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
423
|
-
const _component_Autocomplete = resolveComponent("Autocomplete");
|
|
424
|
-
return openBlock(), createBlock(_component_Autocomplete, mergeProps(_ctx.controlWrapper, {
|
|
425
|
-
modelValue: _ctx.control.data,
|
|
426
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.control.data = $event),
|
|
427
|
-
enabled: _ctx.control.enabled,
|
|
428
|
-
config: _ctx.appliedOptions,
|
|
429
|
-
"label-key": _ctx.field?.label,
|
|
430
|
-
"value-key": _ctx.field?.id,
|
|
431
|
-
onChange: _ctx.handleChange,
|
|
432
|
-
onFocus: _ctx.onFocus,
|
|
433
|
-
onBlur: _ctx.onBlur
|
|
434
|
-
}), null, 16, ["modelValue", "enabled", "config", "label-key", "value-key", "onChange", "onFocus", "onBlur"]);
|
|
435
|
-
}
|
|
436
|
-
const AutocompleteControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$2, [["render", _sfc_render$2]]);
|
|
437
271
|
const controlRenderers = [
|
|
438
272
|
// First custom renderers on format
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
273
|
+
{
|
|
274
|
+
tester: rankWith(10, isMarkdownControl),
|
|
275
|
+
renderer: _sfc_main$e
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
tester: rankWith(10, isAutoCompleteControl),
|
|
279
|
+
renderer: _sfc_main$a
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
tester: rankWith(10, isTextAreaControl),
|
|
283
|
+
renderer: _sfc_main$b
|
|
284
|
+
},
|
|
449
285
|
// Renderers based on type if no format is provided
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
286
|
+
{ tester: rankWith(10, isStringFormat), renderer: _sfc_main$c },
|
|
287
|
+
{ tester: rankWith(10, isNumberControl), renderer: _sfc_main$d },
|
|
288
|
+
{
|
|
289
|
+
tester: rankWith(10, isIntegerControl),
|
|
290
|
+
renderer: _sfc_main$f
|
|
291
|
+
},
|
|
292
|
+
{ tester: rankWith(10, isBooleanControl), renderer: _sfc_main$g }
|
|
453
293
|
];
|
|
454
294
|
const actionMap = {
|
|
455
295
|
edit: (router, action) => ({
|
|
@@ -484,255 +324,233 @@ class FormState {
|
|
|
484
324
|
const useFormState = (form) => {
|
|
485
325
|
return FormState.getInstance();
|
|
486
326
|
};
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
},
|
|
496
|
-
setup(
|
|
327
|
+
const _hoisted_1$8 = ["title"];
|
|
328
|
+
const _hoisted_2$2 = { key: 0 };
|
|
329
|
+
const _hoisted_3$1 = {
|
|
330
|
+
key: 1,
|
|
331
|
+
class: "list-row"
|
|
332
|
+
};
|
|
333
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
334
|
+
__name: "ArrayRenderer",
|
|
335
|
+
props: { ...rendererProps() },
|
|
336
|
+
setup(__props) {
|
|
337
|
+
const props = __props;
|
|
497
338
|
const vanillaArrayControl = useVanillaArrayControl(
|
|
498
339
|
useJsonFormsArrayControl(props)
|
|
499
340
|
);
|
|
500
|
-
const control = vanillaArrayControl
|
|
501
|
-
if (!control.data || control.data.length < 1) {
|
|
341
|
+
const { styles, childUiSchema, control, appliedOptions } = vanillaArrayControl;
|
|
342
|
+
if (!control.value.data || control.value.data.length < 1) {
|
|
502
343
|
vanillaArrayControl.addItem(
|
|
503
|
-
control.path,
|
|
504
|
-
createDefaultValue(control.schema, control.rootSchema)
|
|
344
|
+
control.value.path,
|
|
345
|
+
createDefaultValue(control.value.schema, control.value.rootSchema)
|
|
505
346
|
)();
|
|
506
347
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
const actions = this.uischema.options?.actions ?? [];
|
|
518
|
-
return mapArrayActions(useRouter(), actions);
|
|
519
|
-
},
|
|
520
|
-
showDelete() {
|
|
521
|
-
return this.control.data?.length > 1;
|
|
522
|
-
},
|
|
523
|
-
translations() {
|
|
524
|
-
const jsonforms = inject("jsonforms");
|
|
525
|
-
return getArrayTranslations(
|
|
526
|
-
jsonforms?.i18n?.translate ?? defaultJsonFormsI18nState.translate,
|
|
527
|
-
arrayDefaultTranslations,
|
|
528
|
-
this.control.i18nKeyPrefix,
|
|
529
|
-
this.control.label
|
|
530
|
-
);
|
|
531
|
-
},
|
|
532
|
-
labelKey() {
|
|
533
|
-
const key = this.uischema?.options?.labelKey;
|
|
348
|
+
const noData = computed(
|
|
349
|
+
() => !control.value.data || control.value.data.length === 0
|
|
350
|
+
);
|
|
351
|
+
const actions = computed(() => {
|
|
352
|
+
const actions2 = props.uischema.options?.actions ?? [];
|
|
353
|
+
return mapArrayActions(useRouter(), actions2);
|
|
354
|
+
});
|
|
355
|
+
const showDelete = computed(() => control.value.data?.length > 1);
|
|
356
|
+
computed(() => {
|
|
357
|
+
const key = control.value.uischema?.options?.labelKey;
|
|
534
358
|
if (!key) return null;
|
|
535
359
|
return key;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
deleteButtonClick(index) {
|
|
542
|
-
this.removeItems(this.control.path, [index])();
|
|
543
|
-
},
|
|
544
|
-
dispatchEvent: (event, data) => {
|
|
360
|
+
});
|
|
361
|
+
const deleteButtonClick = (index) => {
|
|
362
|
+
vanillaArrayControl.removeItems(control.value.path, [index])();
|
|
363
|
+
};
|
|
364
|
+
const dispatchEvent = (event, data) => {
|
|
545
365
|
const form_id = "";
|
|
546
366
|
useFormState().dispatchEvent(form_id, event, data);
|
|
547
|
-
}
|
|
548
|
-
addButtonClick() {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
createDefaultValue(
|
|
367
|
+
};
|
|
368
|
+
const addButtonClick = () => {
|
|
369
|
+
vanillaArrayControl.addItem(
|
|
370
|
+
control.value.path,
|
|
371
|
+
createDefaultValue(control.value.schema, control.value.rootSchema)
|
|
552
372
|
)();
|
|
553
|
-
}
|
|
373
|
+
};
|
|
374
|
+
const showActions = computed(() => {
|
|
375
|
+
return !appliedOptions.value.hideActions;
|
|
376
|
+
});
|
|
377
|
+
return (_ctx, _cache) => {
|
|
378
|
+
return openBlock(), createElementBlock("div", {
|
|
379
|
+
title: unref(control).label
|
|
380
|
+
}, [
|
|
381
|
+
createElementVNode("div", {
|
|
382
|
+
class: normalizeClass([
|
|
383
|
+
"flex gap-2",
|
|
384
|
+
unref(appliedOptions)?.layout === "row" ? "flex-row items-center" : "flex-col"
|
|
385
|
+
])
|
|
386
|
+
}, [
|
|
387
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(control).data, (element, index) => {
|
|
388
|
+
return openBlock(), createElementBlock("div", {
|
|
389
|
+
key: `${unref(control).path}-${index}`,
|
|
390
|
+
class: "flex-1"
|
|
391
|
+
}, [
|
|
392
|
+
createElementVNode("div", {
|
|
393
|
+
class: normalizeClass([
|
|
394
|
+
"flex gap-2",
|
|
395
|
+
unref(appliedOptions)?.layout === "row" ? "flex-col" : "flex-row items-center"
|
|
396
|
+
])
|
|
397
|
+
}, [
|
|
398
|
+
createElementVNode("div", null, [
|
|
399
|
+
createVNode(unref(DispatchRenderer), {
|
|
400
|
+
schema: unref(control).schema,
|
|
401
|
+
uischema: unref(childUiSchema),
|
|
402
|
+
path: unref(composePaths)(unref(control).path, `${index}`),
|
|
403
|
+
enabled: unref(control).enabled,
|
|
404
|
+
renderers: unref(control).renderers,
|
|
405
|
+
cells: unref(control).cells
|
|
406
|
+
}, null, 8, ["schema", "uischema", "path", "enabled", "renderers", "cells"])
|
|
407
|
+
]),
|
|
408
|
+
showActions.value ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
409
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(actions.value, (action) => {
|
|
410
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
411
|
+
action.show(element) ? (openBlock(), createBlock(unref(Btn), {
|
|
412
|
+
key: action.label,
|
|
413
|
+
icon: action.icon,
|
|
414
|
+
outline: true,
|
|
415
|
+
onClick: ($event) => dispatchEvent(action.label, element)
|
|
416
|
+
}, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
|
|
417
|
+
], 64);
|
|
418
|
+
}), 256)),
|
|
419
|
+
showDelete.value ? (openBlock(), createBlock(unref(Btn), {
|
|
420
|
+
key: 0,
|
|
421
|
+
icon: unref(IconEnum).Delete,
|
|
422
|
+
outline: true,
|
|
423
|
+
onClick: ($event) => deleteButtonClick(index)
|
|
424
|
+
}, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
|
|
425
|
+
])) : createCommentVNode("", true)
|
|
426
|
+
], 2)
|
|
427
|
+
]);
|
|
428
|
+
}), 128)),
|
|
429
|
+
noData.value ? (openBlock(), createElementBlock("div", {
|
|
430
|
+
key: 0,
|
|
431
|
+
class: normalizeClass(["list-row", unref(styles).arrayList.noData])
|
|
432
|
+
}, " No data ", 2)) : createCommentVNode("", true),
|
|
433
|
+
showActions.value ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
434
|
+
createVNode(unref(Btn), {
|
|
435
|
+
icon: unref(IconEnum).Plus,
|
|
436
|
+
outline: true,
|
|
437
|
+
onClick: addButtonClick
|
|
438
|
+
}, {
|
|
439
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
440
|
+
createTextVNode(" Add ", -1)
|
|
441
|
+
])]),
|
|
442
|
+
_: 1
|
|
443
|
+
}, 8, ["icon"])
|
|
444
|
+
])) : createCommentVNode("", true)
|
|
445
|
+
], 2)
|
|
446
|
+
], 8, _hoisted_1$8);
|
|
447
|
+
};
|
|
554
448
|
}
|
|
555
449
|
});
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
const
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
createVNode(_component_dispatch_renderer, {
|
|
591
|
-
schema: _ctx.control.schema,
|
|
592
|
-
uischema: _ctx.childUiSchema,
|
|
593
|
-
path: _ctx.composePaths(_ctx.control.path, `${index}`),
|
|
594
|
-
enabled: _ctx.control.enabled,
|
|
595
|
-
renderers: _ctx.control.renderers,
|
|
596
|
-
cells: _ctx.control.cells
|
|
597
|
-
}, null, 8, ["schema", "uischema", "path", "enabled", "renderers", "cells"]),
|
|
598
|
-
createElementVNode("div", _hoisted_3$2, [
|
|
599
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.actions, (action) => {
|
|
600
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
601
|
-
action.show(element) ? (openBlock(), createBlock(_component_Btn, {
|
|
602
|
-
key: action.label,
|
|
603
|
-
icon: action.icon,
|
|
604
|
-
outline: true,
|
|
605
|
-
onClick: ($event) => _ctx.dispatchEvent(action.label, element)
|
|
606
|
-
}, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
|
|
607
|
-
], 64);
|
|
608
|
-
}), 256)),
|
|
609
|
-
_ctx.showDelete ? (openBlock(), createBlock(_component_Btn, {
|
|
610
|
-
key: 0,
|
|
611
|
-
icon: _ctx.IconEnum.Delete,
|
|
612
|
-
outline: true,
|
|
613
|
-
onClick: ($event) => _ctx.deleteButtonClick(index)
|
|
614
|
-
}, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
|
|
615
|
-
])
|
|
616
|
-
])
|
|
450
|
+
const arrayRenderers = [
|
|
451
|
+
{
|
|
452
|
+
tester: rankWith(12, isArrayRenderer),
|
|
453
|
+
renderer: _sfc_main$9
|
|
454
|
+
}
|
|
455
|
+
];
|
|
456
|
+
const _hoisted_1$7 = { class: "flex flex-col gap-4" };
|
|
457
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
458
|
+
__name: "CollapseLayout",
|
|
459
|
+
props: { ...rendererProps() },
|
|
460
|
+
setup(__props) {
|
|
461
|
+
const props = __props;
|
|
462
|
+
const jsonLayout = useJsonFormsLayout(props);
|
|
463
|
+
const { layout, renderers, cells } = jsonLayout;
|
|
464
|
+
const title = computed(() => {
|
|
465
|
+
const { titleKey, title: title2 } = layout?.value.uischema?.options ?? {};
|
|
466
|
+
if (title2) return title2;
|
|
467
|
+
if (titleKey) return layout?.value.data[titleKey];
|
|
468
|
+
return layout?.value.uischema?.options?.titleKey;
|
|
469
|
+
});
|
|
470
|
+
return (_ctx, _cache) => {
|
|
471
|
+
return openBlock(), createBlock(unref(Collapse), { title: title.value }, {
|
|
472
|
+
default: withCtx(() => [
|
|
473
|
+
createElementVNode("div", _hoisted_1$7, [
|
|
474
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(layout).uischema.elements, (element, index) => {
|
|
475
|
+
return openBlock(), createBlock(unref(DispatchRenderer), {
|
|
476
|
+
key: index,
|
|
477
|
+
schema: unref(layout).schema,
|
|
478
|
+
uischema: element,
|
|
479
|
+
path: unref(layout).path,
|
|
480
|
+
renderers: unref(renderers),
|
|
481
|
+
cells: unref(cells)
|
|
482
|
+
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"]);
|
|
483
|
+
}), 128))
|
|
617
484
|
])
|
|
618
|
-
])
|
|
619
|
-
}), 128))
|
|
620
|
-
]),
|
|
621
|
-
createElementVNode("div", _hoisted_4$1, [
|
|
622
|
-
createVNode(_component_Btn, {
|
|
623
|
-
icon: _ctx.IconEnum.Plus,
|
|
624
|
-
outline: true,
|
|
625
|
-
onClick: _ctx.addButtonClick
|
|
626
|
-
}, {
|
|
627
|
-
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
628
|
-
createTextVNode(" Add ", -1)
|
|
629
|
-
])]),
|
|
485
|
+
]),
|
|
630
486
|
_: 1
|
|
631
|
-
}, 8, ["
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
487
|
+
}, 8, ["title"]);
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
const _hoisted_1$6 = { class: "flex flex-row gap-4 items-center" };
|
|
492
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
493
|
+
__name: "HorizontalLayout",
|
|
494
|
+
props: { ...rendererProps() },
|
|
495
|
+
setup(__props) {
|
|
496
|
+
const props = __props;
|
|
497
|
+
const { layout, renderers, cells } = useJsonFormsLayout(props);
|
|
498
|
+
return (_ctx, _cache) => {
|
|
499
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
500
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(layout).uischema.elements, (element, index) => {
|
|
501
|
+
return openBlock(), createBlock(unref(DispatchRenderer), {
|
|
502
|
+
key: index,
|
|
503
|
+
schema: unref(layout).schema,
|
|
504
|
+
uischema: element,
|
|
505
|
+
path: unref(layout).path,
|
|
506
|
+
renderers: unref(renderers),
|
|
507
|
+
cells: unref(cells)
|
|
508
|
+
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"]);
|
|
509
|
+
}), 128))
|
|
510
|
+
]);
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
const _hoisted_1$5 = { class: "flex flex-col gap-4" };
|
|
515
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
516
|
+
__name: "VerticalLayout",
|
|
517
|
+
props: { ...rendererProps() },
|
|
518
|
+
setup(__props) {
|
|
519
|
+
const props = __props;
|
|
520
|
+
const { layout, renderers, cells } = useJsonFormsLayout(props);
|
|
521
|
+
return (_ctx, _cache) => {
|
|
522
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
523
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(layout).uischema.elements, (element, index) => {
|
|
524
|
+
return openBlock(), createBlock(unref(DispatchRenderer), {
|
|
525
|
+
key: index,
|
|
526
|
+
schema: unref(layout).schema,
|
|
527
|
+
uischema: element,
|
|
528
|
+
path: unref(layout).path,
|
|
529
|
+
renderers: unref(renderers),
|
|
530
|
+
cells: unref(cells)
|
|
531
|
+
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"]);
|
|
532
|
+
}), 128))
|
|
533
|
+
]);
|
|
534
|
+
};
|
|
673
535
|
}
|
|
674
536
|
});
|
|
675
|
-
const entry = {
|
|
676
|
-
renderer: controlRenderer,
|
|
677
|
-
tester: rankWith(2, isFixedArray)
|
|
678
|
-
};
|
|
679
|
-
const _hoisted_1$5 = { class: "fieldset" };
|
|
680
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
681
|
-
const _component_dispatch_renderer = resolveComponent("dispatch-renderer");
|
|
682
|
-
return _ctx.control.visible ? (openBlock(), createElementBlock("fieldset", {
|
|
683
|
-
key: 0,
|
|
684
|
-
class: normalizeClass(_ctx.styles.arrayList.root)
|
|
685
|
-
}, [
|
|
686
|
-
!_ctx.labelKey ? (openBlock(), createElementBlock("legend", {
|
|
687
|
-
key: 0,
|
|
688
|
-
class: normalizeClass(_ctx.styles.arrayList.legend)
|
|
689
|
-
}, [
|
|
690
|
-
createElementVNode("label", {
|
|
691
|
-
class: normalizeClass(_ctx.styles.arrayList.label)
|
|
692
|
-
}, toDisplayString(_ctx.control.label), 3)
|
|
693
|
-
], 2)) : createCommentVNode("", true),
|
|
694
|
-
createElementVNode("div", {
|
|
695
|
-
class: normalizeClass(_ctx.styles.fixedArrayList.root)
|
|
696
|
-
}, [
|
|
697
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.control.data, (element, index) => {
|
|
698
|
-
return openBlock(), createElementBlock("div", {
|
|
699
|
-
key: `${_ctx.control.path}-${index}`,
|
|
700
|
-
class: normalizeClass(_ctx.styles.fixedArrayList.item)
|
|
701
|
-
}, [
|
|
702
|
-
createElementVNode("fieldset", _hoisted_1$5, [
|
|
703
|
-
_ctx.labelKey ? (openBlock(), createElementBlock("legend", {
|
|
704
|
-
key: 0,
|
|
705
|
-
class: normalizeClass(_ctx.styles.arrayList.legend)
|
|
706
|
-
}, toDisplayString(element[_ctx.labelKey]?.toLowerCase()), 3)) : createCommentVNode("", true),
|
|
707
|
-
createVNode(_component_dispatch_renderer, {
|
|
708
|
-
schema: _ctx.control.schema,
|
|
709
|
-
uischema: _ctx.childUiSchema,
|
|
710
|
-
path: _ctx.composePaths(_ctx.control.path, `${index}`),
|
|
711
|
-
enabled: _ctx.control.enabled,
|
|
712
|
-
renderers: _ctx.control.renderers,
|
|
713
|
-
cells: _ctx.control.cells
|
|
714
|
-
}, null, 8, ["schema", "uischema", "path", "enabled", "renderers", "cells"])
|
|
715
|
-
])
|
|
716
|
-
], 2);
|
|
717
|
-
}), 128))
|
|
718
|
-
], 2),
|
|
719
|
-
_ctx.noData ? (openBlock(), createElementBlock("div", {
|
|
720
|
-
key: 1,
|
|
721
|
-
class: normalizeClass(_ctx.styles.arrayList.noData)
|
|
722
|
-
}, toDisplayString(_ctx.translations.noDataMessage), 3)) : createCommentVNode("", true)
|
|
723
|
-
], 2)) : createCommentVNode("", true);
|
|
724
|
-
}
|
|
725
|
-
const FixedArrayRenderer = /* @__PURE__ */ _export_sfc(controlRenderer, [["render", _sfc_render]]);
|
|
726
|
-
const arrayRenderers = [
|
|
727
|
-
entry,
|
|
728
|
-
entry$1
|
|
729
|
-
];
|
|
730
537
|
const layoutRenderers = [
|
|
731
|
-
|
|
538
|
+
{
|
|
539
|
+
tester: rankWith(10, uiTypeIs(LayoutTypes.VerticalLayout)),
|
|
540
|
+
renderer: _sfc_main$6
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
tester: rankWith(10, uiTypeIs(LayoutTypes.HorizontalLayout)),
|
|
544
|
+
renderer: _sfc_main$7
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
tester: rankWith(10, uiTypeIs(LayoutTypes.CollapseLayout)),
|
|
548
|
+
renderer: _sfc_main$8
|
|
549
|
+
}
|
|
732
550
|
];
|
|
733
551
|
const _hoisted_1$4 = { class: "" };
|
|
734
552
|
const _hoisted_2$1 = { class: "flex gap-2 items-center mb-2" };
|
|
735
|
-
const _hoisted_3
|
|
553
|
+
const _hoisted_3 = { class: "flex gap-2" };
|
|
736
554
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
737
555
|
__name: "table-filter",
|
|
738
556
|
props: {
|
|
@@ -776,7 +594,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
776
594
|
_: 1
|
|
777
595
|
})) : createCommentVNode("", true)
|
|
778
596
|
]),
|
|
779
|
-
createElementVNode("div", _hoisted_3
|
|
597
|
+
createElementVNode("div", _hoisted_3, [
|
|
780
598
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.filters, (filter) => {
|
|
781
599
|
return openBlock(), createBlock(unref(BtnBadge), {
|
|
782
600
|
key: filter.key,
|
|
@@ -1106,12 +924,12 @@ const customRenderers = [
|
|
|
1106
924
|
const customRenderesName = customRenderers.map((c) => {
|
|
1107
925
|
return c.renderer.name;
|
|
1108
926
|
});
|
|
1109
|
-
|
|
927
|
+
vanillaRenderers.filter(
|
|
1110
928
|
(v) => !customRenderesName.includes(v.renderer.name)
|
|
1111
929
|
);
|
|
1112
930
|
const tailwindRenderers = [
|
|
1113
|
-
...
|
|
1114
|
-
...
|
|
931
|
+
...vanillaRenderers,
|
|
932
|
+
...customRenderers
|
|
1115
933
|
];
|
|
1116
934
|
const _hoisted_1$1 = ["id"];
|
|
1117
935
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
@@ -1127,7 +945,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1127
945
|
"modelValue": {},
|
|
1128
946
|
"modelModifiers": {}
|
|
1129
947
|
}),
|
|
1130
|
-
emits: /* @__PURE__ */ mergeModels(["valid", "change", "submit"], ["update:modelValue"]),
|
|
948
|
+
emits: /* @__PURE__ */ mergeModels(["valid", "change", "submit", "errors"], ["update:modelValue"]),
|
|
1131
949
|
setup(__props, { emit: __emit }) {
|
|
1132
950
|
const properties = __props;
|
|
1133
951
|
const _JSON_FORM_ID = `json-form-${Date.now()}`;
|
|
@@ -1140,6 +958,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1140
958
|
valid.value = event.errors.length === 0;
|
|
1141
959
|
emits("valid", valid.value);
|
|
1142
960
|
emits("change", event.data);
|
|
961
|
+
emits("errors", event.errors);
|
|
962
|
+
Debugger.debug(event.errors);
|
|
1143
963
|
};
|
|
1144
964
|
const onSubmit = (event) => {
|
|
1145
965
|
event.preventDefault();
|
|
@@ -1180,10 +1000,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1180
1000
|
};
|
|
1181
1001
|
}
|
|
1182
1002
|
});
|
|
1183
|
-
const _hoisted_1 = { class: "card
|
|
1184
|
-
const _hoisted_2 = { class: "
|
|
1185
|
-
const _hoisted_3 = { class: "card-title" };
|
|
1186
|
-
const _hoisted_4 = { class: "card-actions flex justify-end" };
|
|
1003
|
+
const _hoisted_1 = { class: "card-actions flex justify-between" };
|
|
1004
|
+
const _hoisted_2 = { class: "flex justify-end gap-2" };
|
|
1187
1005
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1188
1006
|
__name: "form-with-actions.component",
|
|
1189
1007
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -1200,23 +1018,33 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1200
1018
|
const properties = __props;
|
|
1201
1019
|
const valid = ref(false);
|
|
1202
1020
|
const formData = useModel(__props, "modelValue");
|
|
1021
|
+
const submitted = ref(false);
|
|
1203
1022
|
const store = new FormStore(properties.formSchema);
|
|
1204
1023
|
const emits = __emit;
|
|
1205
1024
|
const save = () => {
|
|
1025
|
+
submitted.value = true;
|
|
1026
|
+
if (!valid.value) {
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1206
1029
|
store.save(formData.value.id, formData.value).then(() => {
|
|
1207
1030
|
emits("success");
|
|
1208
1031
|
});
|
|
1209
1032
|
};
|
|
1210
1033
|
const clear = () => {
|
|
1211
1034
|
formData.value = { id: null };
|
|
1035
|
+
submitted.value = false;
|
|
1212
1036
|
};
|
|
1213
1037
|
const onValid = (v) => {
|
|
1038
|
+
submitted.value = false;
|
|
1214
1039
|
valid.value = v;
|
|
1215
1040
|
};
|
|
1041
|
+
const title = computed(() => {
|
|
1042
|
+
if (!properties.updateTitle) return properties.createTitle;
|
|
1043
|
+
return formData.value?.id ? properties.updateTitle : properties.createTitle;
|
|
1044
|
+
});
|
|
1216
1045
|
return (_ctx, _cache) => {
|
|
1217
|
-
return openBlock(),
|
|
1218
|
-
|
|
1219
|
-
createElementVNode("h1", _hoisted_3, toDisplayString(formData.value?.id ? __props.updateTitle : __props.createTitle), 1),
|
|
1046
|
+
return openBlock(), createBlock(unref(Collapse), { title: title.value }, {
|
|
1047
|
+
default: withCtx(() => [
|
|
1220
1048
|
createVNode(_sfc_main$2, {
|
|
1221
1049
|
id: `form_${properties.id}`,
|
|
1222
1050
|
modelValue: formData.value,
|
|
@@ -1226,29 +1054,41 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1226
1054
|
onValid: _cache[1] || (_cache[1] = ($event) => onValid($event)),
|
|
1227
1055
|
onSubmit: save
|
|
1228
1056
|
}, null, 8, ["id", "modelValue", "schema", "uischema"]),
|
|
1229
|
-
createElementVNode("div",
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1057
|
+
createElementVNode("div", _hoisted_1, [
|
|
1058
|
+
createElementVNode("div", null, [
|
|
1059
|
+
!valid.value && submitted.value ? (openBlock(), createBlock(unref(Alert), {
|
|
1060
|
+
key: 0,
|
|
1061
|
+
message: "The form is not valid",
|
|
1062
|
+
type: "error"
|
|
1063
|
+
})) : createCommentVNode("", true)
|
|
1064
|
+
]),
|
|
1065
|
+
createElementVNode("div", _hoisted_2, [
|
|
1066
|
+
renderSlot(_ctx.$slots, "actions"),
|
|
1067
|
+
!formData.value.id ? (openBlock(), createBlock(unref(Btn), {
|
|
1068
|
+
key: 0,
|
|
1069
|
+
outline: true,
|
|
1070
|
+
onClick: clear
|
|
1071
|
+
}, {
|
|
1072
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
1073
|
+
createTextVNode(" Clear ", -1)
|
|
1074
|
+
])]),
|
|
1075
|
+
_: 1
|
|
1076
|
+
})) : createCommentVNode("", true),
|
|
1077
|
+
createVNode(unref(Btn), {
|
|
1078
|
+
color: unref(Color).primary,
|
|
1079
|
+
disabled: submitted.value,
|
|
1080
|
+
onClick: save
|
|
1081
|
+
}, {
|
|
1082
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
1083
|
+
createTextVNode(" Save ", -1)
|
|
1084
|
+
])]),
|
|
1085
|
+
_: 1
|
|
1086
|
+
}, 8, ["color", "disabled"])
|
|
1087
|
+
])
|
|
1249
1088
|
])
|
|
1250
|
-
])
|
|
1251
|
-
|
|
1089
|
+
]),
|
|
1090
|
+
_: 3
|
|
1091
|
+
}, 8, ["title"]);
|
|
1252
1092
|
};
|
|
1253
1093
|
}
|
|
1254
1094
|
});
|
|
@@ -1373,7 +1213,7 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
|
1373
1213
|
const create = (object, options2) => {
|
|
1374
1214
|
return httpRequest.post(getDataUri(), object, options2).then((response) => {
|
|
1375
1215
|
handleSuccess(`Created ${notificationEntity}`);
|
|
1376
|
-
return response;
|
|
1216
|
+
return response.data;
|
|
1377
1217
|
}).catch((response) => {
|
|
1378
1218
|
handleError(response, `Failed to create ${notificationEntity}`);
|
|
1379
1219
|
});
|
|
@@ -1381,13 +1221,17 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
|
1381
1221
|
const patch = (id, object, options2) => {
|
|
1382
1222
|
return httpRequest.patch(getDataUri(id), object, options2).then((response) => {
|
|
1383
1223
|
handleSuccess(`Saved ${notificationEntity}`);
|
|
1384
|
-
return response;
|
|
1224
|
+
return response.data;
|
|
1385
1225
|
}).catch((response) => {
|
|
1386
1226
|
handleError(response, `Failed to save ${notificationEntity}`);
|
|
1387
1227
|
});
|
|
1388
1228
|
};
|
|
1389
1229
|
const get = (id, options2) => {
|
|
1390
|
-
return httpRequest.get(getDataUri(id), options2)
|
|
1230
|
+
return httpRequest.get(getDataUri(id), options2).then((response) => {
|
|
1231
|
+
return response.data;
|
|
1232
|
+
}).catch((response) => {
|
|
1233
|
+
handleError(response, `Failed to load data`);
|
|
1234
|
+
});
|
|
1391
1235
|
};
|
|
1392
1236
|
const _delete = (id, options2) => {
|
|
1393
1237
|
return httpRequest.delete(getDataUri(id), options2).then((response) => {
|
|
@@ -1402,7 +1246,7 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
|
1402
1246
|
objects.map((object) => httpRequest.post(getDataUri(), object, options2))
|
|
1403
1247
|
).then((response) => {
|
|
1404
1248
|
handleSuccess(`Created ${notificationEntity}`);
|
|
1405
|
-
return response;
|
|
1249
|
+
return response.data;
|
|
1406
1250
|
}).catch((response) => {
|
|
1407
1251
|
handleError(response, `Failed to save ${notificationEntity}`);
|
|
1408
1252
|
});
|
|
@@ -1410,19 +1254,18 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
|
1410
1254
|
return { create, patch, createMulti, delete: _delete, get };
|
|
1411
1255
|
};
|
|
1412
1256
|
export {
|
|
1413
|
-
ArrayRenderer,
|
|
1414
|
-
AutocompleteControlRenderer,
|
|
1415
|
-
BooleanControlRenderer,
|
|
1416
|
-
FixedArrayRenderer,
|
|
1257
|
+
_sfc_main$9 as ArrayRenderer,
|
|
1258
|
+
_sfc_main$a as AutocompleteControlRenderer,
|
|
1259
|
+
_sfc_main$g as BooleanControlRenderer,
|
|
1417
1260
|
_sfc_main$2 as FormComponent,
|
|
1418
1261
|
_sfc_main as FormModal,
|
|
1419
1262
|
FormModalService,
|
|
1420
1263
|
FormStore,
|
|
1421
1264
|
_sfc_main$1 as FormWithActions,
|
|
1422
1265
|
_sfc_main$3 as FormWithTableComponent,
|
|
1423
|
-
IntegerControlRenderer,
|
|
1424
|
-
NumberControlRenderer,
|
|
1425
|
-
StringControlRenderer,
|
|
1266
|
+
_sfc_main$f as IntegerControlRenderer,
|
|
1267
|
+
_sfc_main$d as NumberControlRenderer,
|
|
1268
|
+
_sfc_main$c as StringControlRenderer,
|
|
1426
1269
|
_sfc_main$4 as TableComponent,
|
|
1427
1270
|
arrayRenderers,
|
|
1428
1271
|
controlRenderers,
|
|
@@ -1430,11 +1273,10 @@ export {
|
|
|
1430
1273
|
isArrayRenderer,
|
|
1431
1274
|
isAutoCompleteControl,
|
|
1432
1275
|
isCustomControl,
|
|
1433
|
-
isFixedArray,
|
|
1434
1276
|
isMarkdownControl,
|
|
1435
1277
|
isStringFormat,
|
|
1436
1278
|
isTextAreaControl,
|
|
1437
1279
|
layoutRenderers,
|
|
1438
|
-
|
|
1280
|
+
_sfc_main$e as markdownControlRenderer,
|
|
1439
1281
|
useFormState
|
|
1440
1282
|
};
|