@ghentcdh/json-forms-vue 0.8.3 → 0.8.6
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.component.properties.d.ts +4 -0
- package/form.component.vue.d.ts +9 -0
- package/index.js +24 -3
- package/index.mjs +24 -3
- package/package.json +1 -1
|
@@ -17,6 +17,10 @@ export declare const FormComponentProperties: {
|
|
|
17
17
|
type: StringConstructor;
|
|
18
18
|
required: boolean;
|
|
19
19
|
};
|
|
20
|
+
name: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
20
24
|
/** JSON schema describing the shape of the form data. */
|
|
21
25
|
schema: {
|
|
22
26
|
type: PropType<any>;
|
package/form.component.vue.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
4
4
|
type: StringConstructor;
|
|
5
5
|
required: boolean;
|
|
6
6
|
};
|
|
7
|
+
name: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
7
11
|
schema: {
|
|
8
12
|
type: import('vue').PropType<any>;
|
|
9
13
|
required: boolean;
|
|
@@ -29,6 +33,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
29
33
|
type: StringConstructor;
|
|
30
34
|
required: boolean;
|
|
31
35
|
};
|
|
36
|
+
name: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
32
40
|
schema: {
|
|
33
41
|
type: import('vue').PropType<any>;
|
|
34
42
|
required: boolean;
|
|
@@ -51,6 +59,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
51
59
|
};
|
|
52
60
|
}>> & Readonly<{}>, {
|
|
53
61
|
disabled: boolean;
|
|
62
|
+
name: string;
|
|
54
63
|
renderers: import('@jsonforms/core').JsonFormsRendererRegistryEntry[];
|
|
55
64
|
formData: Data;
|
|
56
65
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLFormElement>;
|
package/index.js
CHANGED
|
@@ -38,6 +38,7 @@ class FormStore {
|
|
|
38
38
|
const FormComponentProperties = {
|
|
39
39
|
/** Unique id applied to the `<form>` element and used as `<json-forms>` key. */
|
|
40
40
|
id: { type: String, required: true },
|
|
41
|
+
name: { type: String, default: "form" },
|
|
41
42
|
/** JSON schema describing the shape of the form data. */
|
|
42
43
|
schema: { type: Object, required: true },
|
|
43
44
|
/** UI schema describing the layout and controls. */
|
|
@@ -214,6 +215,7 @@ const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
|
214
215
|
formEvents.dispatch({
|
|
215
216
|
event: "create",
|
|
216
217
|
type: control.value.path,
|
|
218
|
+
data: control.value.data,
|
|
217
219
|
onSuccess: (result) => {
|
|
218
220
|
handleChange(result);
|
|
219
221
|
}
|
|
@@ -237,18 +239,32 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
|
237
239
|
props: { ...vue$1.rendererProps() },
|
|
238
240
|
setup(__props) {
|
|
239
241
|
const props = __props;
|
|
240
|
-
const {
|
|
242
|
+
const {
|
|
243
|
+
control,
|
|
244
|
+
handleChange: _handleChange,
|
|
245
|
+
appliedOptions,
|
|
246
|
+
onFocus,
|
|
247
|
+
onBlur,
|
|
248
|
+
controlWrapper
|
|
249
|
+
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props), (target) => {
|
|
250
|
+
if (!target.value) {
|
|
251
|
+
handleChange(false);
|
|
252
|
+
}
|
|
241
253
|
return Boolean(target.value) ?? false;
|
|
242
254
|
});
|
|
255
|
+
const handleChange = (result) => {
|
|
256
|
+
const { path } = control.value;
|
|
257
|
+
_handleChange(path, result);
|
|
258
|
+
};
|
|
243
259
|
return (_ctx, _cache) => {
|
|
244
260
|
return vue.openBlock(), vue.createBlock(vue.unref(ui.Checkbox), vue.mergeProps(vue.unref(controlWrapper), {
|
|
245
261
|
"model-value": vue.unref(control).data,
|
|
246
262
|
enabled: vue.unref(control).enabled,
|
|
247
263
|
config: vue.unref(appliedOptions),
|
|
248
|
-
onChange:
|
|
264
|
+
onChange: handleChange,
|
|
249
265
|
onFocus: vue.unref(onFocus),
|
|
250
266
|
onBlur: vue.unref(onBlur)
|
|
251
|
-
}), null, 16, ["model-value", "enabled", "config", "
|
|
267
|
+
}), null, 16, ["model-value", "enabled", "config", "onFocus", "onBlur"]);
|
|
252
268
|
};
|
|
253
269
|
}
|
|
254
270
|
});
|
|
@@ -8256,6 +8272,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8256
8272
|
vue.renderSlot(_ctx.$slots, "actions"),
|
|
8257
8273
|
recordId.value ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
8258
8274
|
key: 0,
|
|
8275
|
+
"aria-label": "Cancel",
|
|
8259
8276
|
outline: true,
|
|
8260
8277
|
onClick: cancel
|
|
8261
8278
|
}, {
|
|
@@ -8265,6 +8282,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8265
8282
|
_: 1
|
|
8266
8283
|
})) : (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
8267
8284
|
key: 1,
|
|
8285
|
+
"aria-label": "Clear",
|
|
8268
8286
|
outline: true,
|
|
8269
8287
|
onClick: clear
|
|
8270
8288
|
}, {
|
|
@@ -8274,6 +8292,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8274
8292
|
_: 1
|
|
8275
8293
|
})),
|
|
8276
8294
|
vue.createVNode(vue.unref(ui.Btn), {
|
|
8295
|
+
"aria-label": "Save",
|
|
8277
8296
|
color: vue.unref(ui.Color).primary,
|
|
8278
8297
|
disabled: submitted.value,
|
|
8279
8298
|
onClick: save
|
|
@@ -8359,6 +8378,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
8359
8378
|
vue.createVNode(vue.unref(ui.Btn), {
|
|
8360
8379
|
color: vue.unref(ui.Color).secondary,
|
|
8361
8380
|
outline: true,
|
|
8381
|
+
"aria-label": "Cancel",
|
|
8362
8382
|
onClick: onCancel
|
|
8363
8383
|
}, {
|
|
8364
8384
|
default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
@@ -8368,6 +8388,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
8368
8388
|
}, 8, ["color"]),
|
|
8369
8389
|
vue.createVNode(vue.unref(ui.Btn), {
|
|
8370
8390
|
disabled: !hasBeenValid.value,
|
|
8391
|
+
"aria-label": "Save",
|
|
8371
8392
|
onClick: onSubmit
|
|
8372
8393
|
}, {
|
|
8373
8394
|
default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
|
package/index.mjs
CHANGED
|
@@ -36,6 +36,7 @@ class FormStore {
|
|
|
36
36
|
const FormComponentProperties = {
|
|
37
37
|
/** Unique id applied to the `<form>` element and used as `<json-forms>` key. */
|
|
38
38
|
id: { type: String, required: true },
|
|
39
|
+
name: { type: String, default: "form" },
|
|
39
40
|
/** JSON schema describing the shape of the form data. */
|
|
40
41
|
schema: { type: Object, required: true },
|
|
41
42
|
/** UI schema describing the layout and controls. */
|
|
@@ -212,6 +213,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
212
213
|
formEvents.dispatch({
|
|
213
214
|
event: "create",
|
|
214
215
|
type: control.value.path,
|
|
216
|
+
data: control.value.data,
|
|
215
217
|
onSuccess: (result) => {
|
|
216
218
|
handleChange(result);
|
|
217
219
|
}
|
|
@@ -235,18 +237,32 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
235
237
|
props: { ...rendererProps() },
|
|
236
238
|
setup(__props) {
|
|
237
239
|
const props = __props;
|
|
238
|
-
const {
|
|
240
|
+
const {
|
|
241
|
+
control,
|
|
242
|
+
handleChange: _handleChange,
|
|
243
|
+
appliedOptions,
|
|
244
|
+
onFocus,
|
|
245
|
+
onBlur,
|
|
246
|
+
controlWrapper
|
|
247
|
+
} = useVanillaControlCustom(useJsonFormsControl(props), (target) => {
|
|
248
|
+
if (!target.value) {
|
|
249
|
+
handleChange(false);
|
|
250
|
+
}
|
|
239
251
|
return Boolean(target.value) ?? false;
|
|
240
252
|
});
|
|
253
|
+
const handleChange = (result) => {
|
|
254
|
+
const { path } = control.value;
|
|
255
|
+
_handleChange(path, result);
|
|
256
|
+
};
|
|
241
257
|
return (_ctx, _cache) => {
|
|
242
258
|
return openBlock(), createBlock(unref(Checkbox), mergeProps(unref(controlWrapper), {
|
|
243
259
|
"model-value": unref(control).data,
|
|
244
260
|
enabled: unref(control).enabled,
|
|
245
261
|
config: unref(appliedOptions),
|
|
246
|
-
onChange:
|
|
262
|
+
onChange: handleChange,
|
|
247
263
|
onFocus: unref(onFocus),
|
|
248
264
|
onBlur: unref(onBlur)
|
|
249
|
-
}), null, 16, ["model-value", "enabled", "config", "
|
|
265
|
+
}), null, 16, ["model-value", "enabled", "config", "onFocus", "onBlur"]);
|
|
250
266
|
};
|
|
251
267
|
}
|
|
252
268
|
});
|
|
@@ -8254,6 +8270,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
8254
8270
|
renderSlot(_ctx.$slots, "actions"),
|
|
8255
8271
|
recordId.value ? (openBlock(), createBlock(unref(Btn), {
|
|
8256
8272
|
key: 0,
|
|
8273
|
+
"aria-label": "Cancel",
|
|
8257
8274
|
outline: true,
|
|
8258
8275
|
onClick: cancel
|
|
8259
8276
|
}, {
|
|
@@ -8263,6 +8280,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
8263
8280
|
_: 1
|
|
8264
8281
|
})) : (openBlock(), createBlock(unref(Btn), {
|
|
8265
8282
|
key: 1,
|
|
8283
|
+
"aria-label": "Clear",
|
|
8266
8284
|
outline: true,
|
|
8267
8285
|
onClick: clear
|
|
8268
8286
|
}, {
|
|
@@ -8272,6 +8290,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
8272
8290
|
_: 1
|
|
8273
8291
|
})),
|
|
8274
8292
|
createVNode(unref(Btn), {
|
|
8293
|
+
"aria-label": "Save",
|
|
8275
8294
|
color: unref(Color).primary,
|
|
8276
8295
|
disabled: submitted.value,
|
|
8277
8296
|
onClick: save
|
|
@@ -8357,6 +8376,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
8357
8376
|
createVNode(unref(Btn), {
|
|
8358
8377
|
color: unref(Color).secondary,
|
|
8359
8378
|
outline: true,
|
|
8379
|
+
"aria-label": "Cancel",
|
|
8360
8380
|
onClick: onCancel
|
|
8361
8381
|
}, {
|
|
8362
8382
|
default: withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
@@ -8366,6 +8386,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
8366
8386
|
}, 8, ["color"]),
|
|
8367
8387
|
createVNode(unref(Btn), {
|
|
8368
8388
|
disabled: !hasBeenValid.value,
|
|
8389
|
+
"aria-label": "Save",
|
|
8369
8390
|
onClick: onSubmit
|
|
8370
8391
|
}, {
|
|
8371
8392
|
default: withCtx(() => [..._cache[4] || (_cache[4] = [
|