@narrative.io/jsonforms-provider-protocols 1.1.0-beta.1 → 1.1.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonforms-provider-protocols.css +0 -4
- package/dist/protocols/rest_api.d.ts +1 -0
- package/dist/protocols/rest_api.d.ts.map +1 -1
- package/dist/protocols/rest_api.js +6 -1
- package/dist/protocols/rest_api.js.map +1 -1
- package/dist/vue/composables/useDerive.d.ts +13 -0
- package/dist/vue/composables/useDerive.d.ts.map +1 -0
- package/dist/vue/composables/useDerive.js +71 -0
- package/dist/vue/composables/useDerive.js.map +1 -0
- package/dist/vue/index.d.ts +1 -1
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +6 -6
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/primevue/JfBoolean.vue.d.ts +20 -32
- package/dist/vue/primevue/JfBoolean.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfBoolean.vue.js +38 -6
- package/dist/vue/primevue/JfBoolean.vue.js.map +1 -1
- package/dist/vue/primevue/JfEnum.vue.d.ts +20 -32
- package/dist/vue/primevue/JfEnum.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfEnum.vue.js +152 -5
- package/dist/vue/primevue/JfEnum.vue.js.map +1 -1
- package/dist/vue/primevue/JfEnum.vue2.js +1 -61
- package/dist/vue/primevue/JfEnum.vue2.js.map +1 -1
- package/dist/vue/primevue/JfEnumArray.vue.d.ts +20 -32
- package/dist/vue/primevue/JfEnumArray.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfEnumArray.vue.js +93 -13
- package/dist/vue/primevue/JfEnumArray.vue.js.map +1 -1
- package/dist/vue/primevue/JfNumber.vue.d.ts +20 -32
- package/dist/vue/primevue/JfNumber.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfNumber.vue.js +87 -13
- package/dist/vue/primevue/JfNumber.vue.js.map +1 -1
- package/dist/vue/primevue/JfText.vue.d.ts +20 -32
- package/dist/vue/primevue/JfText.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfText.vue.js +131 -16
- package/dist/vue/primevue/JfText.vue.js.map +1 -1
- package/dist/vue/primevue/JfTextArea.vue.d.ts +20 -32
- package/dist/vue/primevue/JfTextArea.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfTextArea.vue.js +49 -11
- package/dist/vue/primevue/JfTextArea.vue.js.map +1 -1
- package/dist/vue/primevue/index.d.ts +2 -75
- package/dist/vue/primevue/index.d.ts.map +1 -1
- package/dist/vue/primevue/index.js +47 -28
- package/dist/vue/primevue/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +15 -2
- package/src/protocols/rest_api.ts +8 -1
- package/src/vue/composables/useDerive.ts +105 -0
- package/src/vue/index.ts +10 -1
- package/src/vue/primevue/JfBoolean.vue +42 -5
- package/src/vue/primevue/JfEnum.vue +131 -20
- package/src/vue/primevue/JfEnumArray.vue +118 -14
- package/src/vue/primevue/JfNumber.vue +104 -13
- package/src/vue/primevue/JfText.vue +156 -13
- package/src/vue/primevue/JfTextArea.vue +57 -10
- package/src/vue/primevue/index.ts +49 -37
- package/src/vue/styles.css +5 -0
|
@@ -1,75 +1,63 @@
|
|
|
1
|
-
import type { ControlElement } from "@jsonforms/core";
|
|
2
1
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
-
|
|
2
|
+
uischema: {
|
|
3
|
+
type: ObjectConstructor;
|
|
4
4
|
required: true;
|
|
5
|
-
type: import("vue").PropType<import("@jsonforms/core").JsonSchema>;
|
|
6
5
|
};
|
|
7
|
-
|
|
6
|
+
schema: {
|
|
7
|
+
type: ObjectConstructor;
|
|
8
8
|
required: true;
|
|
9
|
-
type: import("vue").PropType<ControlElement>;
|
|
10
9
|
};
|
|
11
10
|
path: {
|
|
12
|
-
required: true;
|
|
13
11
|
type: StringConstructor;
|
|
12
|
+
required: true;
|
|
14
13
|
};
|
|
15
14
|
enabled: {
|
|
16
|
-
required: false;
|
|
17
15
|
type: BooleanConstructor;
|
|
18
16
|
default: undefined;
|
|
19
17
|
};
|
|
20
18
|
renderers: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
default: undefined;
|
|
19
|
+
type: ArrayConstructor;
|
|
20
|
+
required: false;
|
|
24
21
|
};
|
|
25
22
|
cells: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
default: undefined;
|
|
23
|
+
type: ArrayConstructor;
|
|
24
|
+
required: false;
|
|
29
25
|
};
|
|
30
26
|
config: {
|
|
31
|
-
required: boolean;
|
|
32
27
|
type: ObjectConstructor;
|
|
33
|
-
|
|
28
|
+
required: false;
|
|
34
29
|
};
|
|
35
30
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
36
|
-
|
|
31
|
+
uischema: {
|
|
32
|
+
type: ObjectConstructor;
|
|
37
33
|
required: true;
|
|
38
|
-
type: import("vue").PropType<import("@jsonforms/core").JsonSchema>;
|
|
39
34
|
};
|
|
40
|
-
|
|
35
|
+
schema: {
|
|
36
|
+
type: ObjectConstructor;
|
|
41
37
|
required: true;
|
|
42
|
-
type: import("vue").PropType<ControlElement>;
|
|
43
38
|
};
|
|
44
39
|
path: {
|
|
45
|
-
required: true;
|
|
46
40
|
type: StringConstructor;
|
|
41
|
+
required: true;
|
|
47
42
|
};
|
|
48
43
|
enabled: {
|
|
49
|
-
required: false;
|
|
50
44
|
type: BooleanConstructor;
|
|
51
45
|
default: undefined;
|
|
52
46
|
};
|
|
53
47
|
renderers: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
default: undefined;
|
|
48
|
+
type: ArrayConstructor;
|
|
49
|
+
required: false;
|
|
57
50
|
};
|
|
58
51
|
cells: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
default: undefined;
|
|
52
|
+
type: ArrayConstructor;
|
|
53
|
+
required: false;
|
|
62
54
|
};
|
|
63
55
|
config: {
|
|
64
|
-
required: boolean;
|
|
65
56
|
type: ObjectConstructor;
|
|
66
|
-
|
|
57
|
+
required: false;
|
|
67
58
|
};
|
|
68
59
|
}>> & Readonly<{}>, {
|
|
69
60
|
enabled: boolean;
|
|
70
|
-
renderers: import("@jsonforms/core").JsonFormsRendererRegistryEntry[];
|
|
71
|
-
cells: import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[];
|
|
72
|
-
config: Record<string, any>;
|
|
73
61
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
62
|
export default _default;
|
|
75
63
|
//# sourceMappingURL=JfTextArea.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfTextArea.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JfTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfTextArea.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA,wBA+MK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, getCurrentInstance, computed, ref, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
2
|
+
import { useJsonFormsControl } from "@jsonforms/vue";
|
|
3
3
|
import Textarea from "primevue/textarea";
|
|
4
4
|
const _hoisted_1 = { class: "flex flex-column gap-2" };
|
|
5
5
|
const _hoisted_2 = {
|
|
@@ -14,22 +14,59 @@ const _hoisted_4 = {
|
|
|
14
14
|
key: 2,
|
|
15
15
|
class: "p-error"
|
|
16
16
|
};
|
|
17
|
+
const __default__ = {
|
|
18
|
+
name: "JfTextArea",
|
|
19
|
+
props: {
|
|
20
|
+
uischema: {
|
|
21
|
+
type: Object,
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
schema: {
|
|
25
|
+
type: Object,
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
path: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
enabled: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: void 0
|
|
35
|
+
},
|
|
36
|
+
renderers: {
|
|
37
|
+
type: Array,
|
|
38
|
+
required: false
|
|
39
|
+
},
|
|
40
|
+
cells: {
|
|
41
|
+
type: Array,
|
|
42
|
+
required: false
|
|
43
|
+
},
|
|
44
|
+
config: {
|
|
45
|
+
type: Object,
|
|
46
|
+
required: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
17
50
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
-
...
|
|
19
|
-
__name: "JfTextArea",
|
|
20
|
-
props: rendererProps(),
|
|
51
|
+
...__default__,
|
|
21
52
|
setup(__props) {
|
|
22
|
-
const
|
|
53
|
+
const instance = getCurrentInstance();
|
|
54
|
+
const props = instance.props;
|
|
23
55
|
const { control, handleChange } = useJsonFormsControl(props);
|
|
24
56
|
const placeholder = computed(
|
|
25
57
|
() => control.value.uischema?.options?.placeholder ?? control.value.description
|
|
26
58
|
);
|
|
59
|
+
const hasInteracted = ref(false);
|
|
60
|
+
const showErrors = computed(() => hasInteracted.value && control.value.errors);
|
|
27
61
|
function onInput(val) {
|
|
28
|
-
const newValue = val
|
|
29
|
-
if (
|
|
62
|
+
const newValue = val && val.trim() !== "" ? val : void 0;
|
|
63
|
+
if (control.value.data !== newValue) {
|
|
30
64
|
handleChange(control.value.path, newValue);
|
|
31
65
|
}
|
|
32
66
|
}
|
|
67
|
+
function onBlur() {
|
|
68
|
+
hasInteracted.value = true;
|
|
69
|
+
}
|
|
33
70
|
return (_ctx, _cache) => {
|
|
34
71
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
35
72
|
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
@@ -38,13 +75,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
38
75
|
class: "w-full",
|
|
39
76
|
"model-value": unref(control).data ?? "",
|
|
40
77
|
disabled: !unref(control).enabled,
|
|
41
|
-
"aria-invalid": !!
|
|
78
|
+
"aria-invalid": !!showErrors.value || void 0,
|
|
42
79
|
placeholder: placeholder.value,
|
|
43
80
|
rows: 4,
|
|
44
81
|
"auto-resize": true,
|
|
45
|
-
"onUpdate:modelValue": onInput
|
|
82
|
+
"onUpdate:modelValue": onInput,
|
|
83
|
+
onBlur
|
|
46
84
|
}, null, 8, ["model-value", "disabled", "aria-invalid", "placeholder"]),
|
|
47
|
-
|
|
85
|
+
showErrors.value ? (openBlock(), createElementBlock("small", _hoisted_4, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
48
86
|
]);
|
|
49
87
|
};
|
|
50
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfTextArea.vue.js","sources":["../../../src/vue/primevue/JfTextArea.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {
|
|
1
|
+
{"version":3,"file":"JfTextArea.vue.js","sources":["../../../src/vue/primevue/JfTextArea.vue"],"sourcesContent":["<script lang=\"ts\">\nexport default {\n name: \"JfTextArea\",\n props: {\n uischema: {\n type: Object,\n required: true,\n },\n schema: {\n type: Object,\n required: true,\n },\n path: {\n type: String,\n required: true,\n },\n enabled: {\n type: Boolean,\n default: undefined,\n },\n renderers: {\n type: Array,\n required: false,\n },\n cells: {\n type: Array,\n required: false,\n },\n config: {\n type: Object,\n required: false,\n },\n },\n};\n</script>\n\n<script setup lang=\"ts\">\nimport type { ControlProps } from \"@jsonforms/vue\";\nimport { useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed, ref, getCurrentInstance } from \"vue\";\nimport Textarea from \"primevue/textarea\";\n\n// Access props from the component instance\nconst instance = getCurrentInstance()!;\nconst props = instance.props as unknown as ControlProps;\nconst { control, handleChange } = useJsonFormsControl(props);\n\nconst placeholder = computed<string | undefined>(\n () =>\n (control.value.uischema as { options?: { placeholder?: string } })?.options\n ?.placeholder ?? control.value.description,\n);\n\n// Track user interaction\nconst hasInteracted = ref(false);\n\nconst showErrors = computed(() => hasInteracted.value && control.value.errors);\n\nfunction onInput(val: string | undefined) {\n // Convert empty strings to undefined for proper required field validation\n const newValue = val && val.trim() !== \"\" ? val : undefined;\n if (control.value.data !== newValue) {\n handleChange(control.value.path, newValue);\n }\n}\n\nfunction onBlur() {\n hasInteracted.value = true;\n}\n</script>\n\n<template>\n <div class=\"flex flex-column gap-2\">\n <label v-if=\"control.label\" class=\"text-color text-left\">{{\n control.label\n }}</label>\n <div v-if=\"control.description\" class=\"text-color-secondary text-left\">\n {{ control.description }}\n </div>\n <Textarea\n class=\"w-full\"\n :model-value=\"control.data ?? ''\"\n :disabled=\"!control.enabled\"\n :aria-invalid=\"!!showErrors || undefined\"\n :placeholder=\"placeholder\"\n :rows=\"4\"\n :auto-resize=\"true\"\n @update:model-value=\"onInput\"\n @blur=\"onBlur\"\n />\n <small v-if=\"showErrors\" class=\"p-error\">{{ control.errors }}</small>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_unref","_toDisplayString","_createVNode"],"mappings":";;;;;;;;;;;;;;;;AACA,MAAA,cAAe;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,IACL,UAAU;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,IAEZ,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,IAEZ,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,IAEZ,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,IAEX,WAAW;AAAA,MACT,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,IAEZ,OAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,IAEZ,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,EACZ;AAEJ;;;;AAUA,UAAM,WAAW,mBAAA;AACjB,UAAM,QAAQ,SAAS;AACvB,UAAM,EAAE,SAAS,iBAAiB,oBAAoB,KAAK;AAE3D,UAAM,cAAc;AAAA,MAClB,MACG,QAAQ,MAAM,UAAqD,SAChE,eAAe,QAAQ,MAAM;AAAA,IAAA;AAIrC,UAAM,gBAAgB,IAAI,KAAK;AAE/B,UAAM,aAAa,SAAS,MAAM,cAAc,SAAS,QAAQ,MAAM,MAAM;AAE7E,aAAS,QAAQ,KAAyB;AAExC,YAAM,WAAW,OAAO,IAAI,KAAA,MAAW,KAAK,MAAM;AAClD,UAAI,QAAQ,MAAM,SAAS,UAAU;AACnC,qBAAa,QAAQ,MAAM,MAAM,QAAQ;AAAA,MAC3C;AAAA,IACF;AAEA,aAAS,SAAS;AAChB,oBAAc,QAAQ;AAAA,IACxB;;AAIE,aAAAA,UAAA,GAAAC,mBAmBM,OAnBN,YAmBM;AAAA,QAlBSC,MAAA,OAAA,EAAQ,SAArBF,UAAA,GAAAC,mBAEU,SAFV,YAEUE,gBADRD,MAAA,OAAA,EAAQ,KAAK,GAAA,CAAA;QAEJA,MAAA,OAAA,EAAQ,eAAnBF,UAAA,GAAAC,mBAEM,OAFN,YAEME,gBADDD,MAAA,OAAA,EAAQ,WAAW,GAAA,CAAA;QAExBE,YAUEF,MAAA,QAAA,GAAA;AAAA,UATA,OAAM;AAAA,UACL,eAAaA,MAAA,OAAA,EAAQ,QAAI;AAAA,UACzB,UAAQ,CAAGA,MAAA,OAAA,EAAQ;AAAA,UACnB,gBAAY,CAAA,CAAI,WAAA,SAAc;AAAA,UAC9B,aAAa,YAAA;AAAA,UACb,MAAM;AAAA,UACN,eAAa;AAAA,UACb,uBAAoB;AAAA,UACpB;AAAA,QAAA;QAEU,WAAA,SAAbF,UAAA,GAAAC,mBAAqE,SAArE,YAAqEE,gBAAzBD,MAAA,OAAA,EAAQ,MAAM,GAAA,CAAA;;;;;"}
|
|
@@ -4,80 +4,7 @@ import JfNumber from "./JfNumber.vue";
|
|
|
4
4
|
import JfEnum from "./JfEnum.vue";
|
|
5
5
|
import JfEnumArray from "./JfEnumArray.vue";
|
|
6
6
|
import JfBoolean from "./JfBoolean.vue";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
renderer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
10
|
-
schema: {
|
|
11
|
-
required: true;
|
|
12
|
-
type: import("vue").PropType<import("@jsonforms/core").JsonSchema>;
|
|
13
|
-
};
|
|
14
|
-
uischema: {
|
|
15
|
-
required: true;
|
|
16
|
-
type: import("vue").PropType<import("@jsonforms/core").ControlElement>;
|
|
17
|
-
};
|
|
18
|
-
path: {
|
|
19
|
-
required: true;
|
|
20
|
-
type: StringConstructor;
|
|
21
|
-
};
|
|
22
|
-
enabled: {
|
|
23
|
-
required: false;
|
|
24
|
-
type: BooleanConstructor;
|
|
25
|
-
default: undefined;
|
|
26
|
-
};
|
|
27
|
-
renderers: {
|
|
28
|
-
required: boolean;
|
|
29
|
-
type: import("vue").PropType<import("@jsonforms/core").JsonFormsRendererRegistryEntry[]>;
|
|
30
|
-
default: undefined;
|
|
31
|
-
};
|
|
32
|
-
cells: {
|
|
33
|
-
required: boolean;
|
|
34
|
-
type: import("vue").PropType<import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[]>;
|
|
35
|
-
default: undefined;
|
|
36
|
-
};
|
|
37
|
-
config: {
|
|
38
|
-
required: boolean;
|
|
39
|
-
type: ObjectConstructor;
|
|
40
|
-
default: undefined;
|
|
41
|
-
};
|
|
42
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
43
|
-
schema: {
|
|
44
|
-
required: true;
|
|
45
|
-
type: import("vue").PropType<import("@jsonforms/core").JsonSchema>;
|
|
46
|
-
};
|
|
47
|
-
uischema: {
|
|
48
|
-
required: true;
|
|
49
|
-
type: import("vue").PropType<import("@jsonforms/core").ControlElement>;
|
|
50
|
-
};
|
|
51
|
-
path: {
|
|
52
|
-
required: true;
|
|
53
|
-
type: StringConstructor;
|
|
54
|
-
};
|
|
55
|
-
enabled: {
|
|
56
|
-
required: false;
|
|
57
|
-
type: BooleanConstructor;
|
|
58
|
-
default: undefined;
|
|
59
|
-
};
|
|
60
|
-
renderers: {
|
|
61
|
-
required: boolean;
|
|
62
|
-
type: import("vue").PropType<import("@jsonforms/core").JsonFormsRendererRegistryEntry[]>;
|
|
63
|
-
default: undefined;
|
|
64
|
-
};
|
|
65
|
-
cells: {
|
|
66
|
-
required: boolean;
|
|
67
|
-
type: import("vue").PropType<import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[]>;
|
|
68
|
-
default: undefined;
|
|
69
|
-
};
|
|
70
|
-
config: {
|
|
71
|
-
required: boolean;
|
|
72
|
-
type: ObjectConstructor;
|
|
73
|
-
default: undefined;
|
|
74
|
-
};
|
|
75
|
-
}>> & Readonly<{}>, {
|
|
76
|
-
enabled: boolean;
|
|
77
|
-
renderers: import("@jsonforms/core").JsonFormsRendererRegistryEntry[];
|
|
78
|
-
cells: import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[];
|
|
79
|
-
config: Record<string, any>;
|
|
80
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
81
|
-
}[];
|
|
7
|
+
import type { JsonFormsRendererRegistryEntry } from "@jsonforms/core";
|
|
8
|
+
export declare const primevueRenderers: JsonFormsRendererRegistryEntry[];
|
|
82
9
|
export { JfText, JfTextArea, JfNumber, JfEnum, JfEnumArray, JfBoolean };
|
|
83
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,SAAS,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,SAAS,MAAM,iBAAiB,CAAC;AA+BxC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AA2BtE,eAAO,MAAM,iBAAiB,EAAE,8BAA8B,EAAO,CAAC;AA+CtE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _sfc_main$1 from "./JfText.vue.js";
|
|
2
2
|
import _sfc_main from "./JfTextArea.vue.js";
|
|
3
3
|
import _sfc_main$2 from "./JfNumber.vue.js";
|
|
4
|
-
import
|
|
5
|
-
import _sfc_main$
|
|
6
|
-
import _sfc_main$
|
|
7
|
-
import { rankWith, isStringControl, or, isNumberControl, isIntegerControl, and, isControl, schemaMatches, isBooleanControl } from "@jsonforms/core";
|
|
4
|
+
import _sfc_main$3 from "./JfEnum.vue.js";
|
|
5
|
+
import _sfc_main$4 from "./JfEnumArray.vue.js";
|
|
6
|
+
import _sfc_main$5 from "./JfBoolean.vue.js";
|
|
8
7
|
const injectLayoutStyles = () => {
|
|
9
8
|
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
10
9
|
if (!document.getElementById("jsonforms-primevue-styles")) {
|
|
@@ -37,32 +36,52 @@ const isEnumArray = (s) => {
|
|
|
37
36
|
const schema = s;
|
|
38
37
|
return schema?.type === "array" && (Array.isArray(schema.items?.enum) || Array.isArray(schema.items?.oneOf));
|
|
39
38
|
};
|
|
40
|
-
const isMultilineString = (uischema, schema) => {
|
|
41
|
-
return isStringControl(uischema, schema, {}) && uischema?.options?.multi === true;
|
|
42
|
-
};
|
|
43
39
|
const PRIME = 100;
|
|
44
|
-
const primevueRenderers = [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
40
|
+
const primevueRenderers = [];
|
|
41
|
+
Promise.resolve().then(async () => {
|
|
42
|
+
const jsonformsCore = await import("@jsonforms/core");
|
|
43
|
+
const {
|
|
44
|
+
rankWith,
|
|
45
|
+
isStringControl,
|
|
46
|
+
or,
|
|
47
|
+
isNumberControl,
|
|
48
|
+
isIntegerControl,
|
|
49
|
+
and,
|
|
50
|
+
isControl,
|
|
51
|
+
schemaMatches,
|
|
52
|
+
isBooleanControl
|
|
53
|
+
} = jsonformsCore;
|
|
54
|
+
const isMultilineString = (uischema, schema) => {
|
|
55
|
+
const controlUischema = uischema;
|
|
56
|
+
return and(isStringControl, () => controlUischema?.options?.multi === true)(
|
|
57
|
+
uischema,
|
|
58
|
+
schema,
|
|
59
|
+
{}
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
primevueRenderers.push(
|
|
63
|
+
// Multiline text has higher priority than regular text
|
|
64
|
+
{ tester: rankWith(PRIME + 4, isMultilineString), renderer: _sfc_main },
|
|
65
|
+
{ tester: rankWith(PRIME + 3, isStringControl), renderer: _sfc_main$1 },
|
|
66
|
+
{
|
|
67
|
+
tester: rankWith(PRIME + 4, or(isNumberControl, isIntegerControl)),
|
|
68
|
+
renderer: _sfc_main$2
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
tester: rankWith(PRIME + 5, and(isControl, schemaMatches(isScalarEnum))),
|
|
72
|
+
renderer: _sfc_main$3
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
tester: rankWith(PRIME + 6, and(isControl, schemaMatches(isEnumArray))),
|
|
76
|
+
renderer: _sfc_main$4
|
|
77
|
+
},
|
|
78
|
+
{ tester: rankWith(PRIME + 3, isBooleanControl), renderer: _sfc_main$5 }
|
|
79
|
+
);
|
|
80
|
+
});
|
|
62
81
|
export {
|
|
63
|
-
_sfc_main$
|
|
64
|
-
JfEnum,
|
|
65
|
-
_sfc_main$
|
|
82
|
+
_sfc_main$5 as JfBoolean,
|
|
83
|
+
_sfc_main$3 as JfEnum,
|
|
84
|
+
_sfc_main$4 as JfEnumArray,
|
|
66
85
|
_sfc_main$2 as JfNumber,
|
|
67
86
|
_sfc_main$1 as JfText,
|
|
68
87
|
_sfc_main as JfTextArea,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/vue/primevue/index.ts"],"sourcesContent":["import JfText from \"./JfText.vue\";\nimport JfTextArea from \"./JfTextArea.vue\";\nimport JfNumber from \"./JfNumber.vue\";\nimport JfEnum from \"./JfEnum.vue\";\nimport JfEnumArray from \"./JfEnumArray.vue\";\nimport JfBoolean from \"./JfBoolean.vue\";\n\n// Auto-inject layout styles\nconst injectLayoutStyles = () => {\n if (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n if (!document.getElementById(\"jsonforms-primevue-styles\")) {\n const style = document.createElement(\"style\");\n style.id = \"jsonforms-primevue-styles\";\n style.textContent = `\n/* JSONForms PrimeVue Provider Protocols Layout Styles */\n.vertical-layout {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 1rem;\n width: 100%;\n}\n\n.vertical-layout-item {\n width: 100%;\n}\n `;\n document.head.appendChild(style);\n }\n }\n};\n\n// Inject styles when this module is imported\ninjectLayoutStyles();\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/vue/primevue/index.ts"],"sourcesContent":["import JfText from \"./JfText.vue\";\nimport JfTextArea from \"./JfTextArea.vue\";\nimport JfNumber from \"./JfNumber.vue\";\nimport JfEnum from \"./JfEnum.vue\";\nimport JfEnumArray from \"./JfEnumArray.vue\";\nimport JfBoolean from \"./JfBoolean.vue\";\n\n// Auto-inject layout styles\nconst injectLayoutStyles = () => {\n if (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n if (!document.getElementById(\"jsonforms-primevue-styles\")) {\n const style = document.createElement(\"style\");\n style.id = \"jsonforms-primevue-styles\";\n style.textContent = `\n/* JSONForms PrimeVue Provider Protocols Layout Styles */\n.vertical-layout {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 1rem;\n width: 100%;\n}\n\n.vertical-layout-item {\n width: 100%;\n}\n `;\n document.head.appendChild(style);\n }\n }\n};\n\n// Inject styles when this module is imported\ninjectLayoutStyles();\n\n// Import types only to avoid circular dependencies\nimport type { JsonFormsRendererRegistryEntry } from \"@jsonforms/core\";\n\n// helpers for enum detection\nconst isScalarEnum = (s?: object) => {\n const schema = s as { type?: string; enum?: unknown[]; oneOf?: unknown[] };\n return (\n schema &&\n schema.type !== \"array\" &&\n (Array.isArray(schema.enum) || Array.isArray(schema.oneOf))\n );\n};\n\nconst isEnumArray = (s?: object) => {\n const schema = s as {\n type?: string;\n items?: { enum?: unknown[]; oneOf?: unknown[] };\n };\n return (\n schema?.type === \"array\" &&\n (Array.isArray(schema.items?.enum) || Array.isArray(schema.items?.oneOf))\n );\n};\n\n// Give PrimeVue renderers a high base rank; vanilla commonly uses small ranks (2–5)\nconst PRIME = 100;\n\n// Create empty array first, populate it after module initialization to avoid circular deps\nexport const primevueRenderers: JsonFormsRendererRegistryEntry[] = [];\n\n// Populate the renderers array after a microtask delay to avoid circular dependency\nPromise.resolve().then(async () => {\n const jsonformsCore = await import(\"@jsonforms/core\");\n const {\n rankWith,\n isStringControl,\n or,\n isNumberControl,\n isIntegerControl,\n and,\n isControl,\n schemaMatches,\n isBooleanControl,\n } = jsonformsCore;\n\n // helper for multiline detection moved inside async block\n const isMultilineString = (uischema: unknown, schema: unknown) => {\n const controlUischema = uischema as { options?: { multi?: boolean } };\n return and(isStringControl, () => controlUischema?.options?.multi === true)(\n uischema as Parameters<typeof isStringControl>[0],\n schema as Parameters<typeof isStringControl>[1],\n {} as Parameters<typeof isStringControl>[2],\n );\n };\n\n primevueRenderers.push(\n // Multiline text has higher priority than regular text\n { tester: rankWith(PRIME + 4, isMultilineString), renderer: JfTextArea },\n { tester: rankWith(PRIME + 3, isStringControl), renderer: JfText },\n {\n tester: rankWith(PRIME + 4, or(isNumberControl, isIntegerControl)),\n renderer: JfNumber,\n },\n {\n tester: rankWith(PRIME + 5, and(isControl, schemaMatches(isScalarEnum))),\n renderer: JfEnum,\n },\n {\n tester: rankWith(PRIME + 6, and(isControl, schemaMatches(isEnumArray))),\n renderer: JfEnumArray,\n },\n { tester: rankWith(PRIME + 3, isBooleanControl), renderer: JfBoolean },\n );\n});\n\nexport { JfText, JfTextArea, JfNumber, JfEnum, JfEnumArray, JfBoolean };\n"],"names":["JfTextArea","JfText","JfNumber","JfEnum","JfEnumArray","JfBoolean"],"mappings":";;;;;;AAQA,MAAM,qBAAqB,MAAM;AAC/B,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,aAAa;AACpE,QAAI,CAAC,SAAS,eAAe,2BAA2B,GAAG;AACzD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcpB,eAAS,KAAK,YAAY,KAAK;AAAA,IACjC;AAAA,EACF;AACF;AAGA,mBAAA;AAMA,MAAM,eAAe,CAAC,MAAe;AACnC,QAAM,SAAS;AACf,SACE,UACA,OAAO,SAAS,YACf,MAAM,QAAQ,OAAO,IAAI,KAAK,MAAM,QAAQ,OAAO,KAAK;AAE7D;AAEA,MAAM,cAAc,CAAC,MAAe;AAClC,QAAM,SAAS;AAIf,SACE,QAAQ,SAAS,YAChB,MAAM,QAAQ,OAAO,OAAO,IAAI,KAAK,MAAM,QAAQ,OAAO,OAAO,KAAK;AAE3E;AAGA,MAAM,QAAQ;AAGP,MAAM,oBAAsD,CAAA;AAGnE,QAAQ,QAAA,EAAU,KAAK,YAAY;AACjC,QAAM,gBAAgB,MAAM,OAAO,iBAAiB;AACpD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAGJ,QAAM,oBAAoB,CAAC,UAAmB,WAAoB;AAChE,UAAM,kBAAkB;AACxB,WAAO,IAAI,iBAAiB,MAAM,iBAAiB,SAAS,UAAU,IAAI;AAAA,MACxE;AAAA,MACA;AAAA,MACA,CAAA;AAAA,IAAC;AAAA,EAEL;AAEA,oBAAkB;AAAA;AAAA,IAEhB,EAAE,QAAQ,SAAS,QAAQ,GAAG,iBAAiB,GAAG,UAAUA,UAAA;AAAA,IAC5D,EAAE,QAAQ,SAAS,QAAQ,GAAG,eAAe,GAAG,UAAUC,YAAA;AAAA,IAC1D;AAAA,MACE,QAAQ,SAAS,QAAQ,GAAG,GAAG,iBAAiB,gBAAgB,CAAC;AAAA,MACjE,UAAUC;AAAAA,IAAA;AAAA,IAEZ;AAAA,MACE,QAAQ,SAAS,QAAQ,GAAG,IAAI,WAAW,cAAc,YAAY,CAAC,CAAC;AAAA,MACvE,UAAUC;AAAAA,IAAA;AAAA,IAEZ;AAAA,MACE,QAAQ,SAAS,QAAQ,GAAG,IAAI,WAAW,cAAc,WAAW,CAAC,CAAC;AAAA,MACtE,UAAUC;AAAAA,IAAA;AAAA,IAEZ,EAAE,QAAQ,SAAS,QAAQ,GAAG,gBAAgB,GAAG,UAAUC,YAAA;AAAA,EAAU;AAEzE,CAAC;"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -13,8 +13,21 @@ export * from "./core/types";
|
|
|
13
13
|
// Protocol exports
|
|
14
14
|
export { RestApiProtocol } from "./protocols/rest_api";
|
|
15
15
|
|
|
16
|
-
// Vue exports
|
|
17
|
-
export
|
|
16
|
+
// Vue exports - using named imports to avoid potential bundling issues
|
|
17
|
+
export {
|
|
18
|
+
providerRenderers,
|
|
19
|
+
primevueRenderers,
|
|
20
|
+
ProviderAutocomplete,
|
|
21
|
+
ProviderSelect,
|
|
22
|
+
ProviderMultiSelect,
|
|
23
|
+
useProvider,
|
|
24
|
+
JfText,
|
|
25
|
+
JfTextArea,
|
|
26
|
+
JfNumber,
|
|
27
|
+
JfEnum,
|
|
28
|
+
JfEnumArray,
|
|
29
|
+
JfBoolean,
|
|
30
|
+
} from "./vue";
|
|
18
31
|
|
|
19
32
|
export interface ProviderConfig {
|
|
20
33
|
protocols?: Protocol[];
|
|
@@ -17,6 +17,7 @@ export type RestApiCfg = {
|
|
|
17
17
|
map: { label: string; value: string; meta?: Record<string, string> }; // relative to each item
|
|
18
18
|
paginate?: { cursorPath: string; param: string; maxPages?: number };
|
|
19
19
|
auth?: AuthConfig;
|
|
20
|
+
showError?: boolean; // Whether to show error messages, defaults to true
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
function buildAuthHeaders(
|
|
@@ -122,7 +123,13 @@ export const RestApiProtocol = (): Protocol<RestApiCfg> => ({
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
const res = await fetch(url.toString(), requestInit);
|
|
125
|
-
if (!res.ok)
|
|
126
|
+
if (!res.ok) {
|
|
127
|
+
if (cfg.showError !== false) {
|
|
128
|
+
throw new Error(`REST ${res.status}`);
|
|
129
|
+
}
|
|
130
|
+
// If showError is false, return empty items instead of throwing
|
|
131
|
+
return { items: [], ttl: 0 };
|
|
132
|
+
}
|
|
126
133
|
const json = await res.json();
|
|
127
134
|
const items = jp(json, cfg.items);
|
|
128
135
|
for (const it of items) {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { computed, watch, inject, type Ref } from "vue";
|
|
2
|
+
import { type ControlElement } from "@jsonforms/core";
|
|
3
|
+
|
|
4
|
+
interface DeriveOptions {
|
|
5
|
+
control: Ref<{
|
|
6
|
+
uischema: ControlElement;
|
|
7
|
+
path: string;
|
|
8
|
+
data: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
handleChange: (path: string, value: unknown) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function useDerive({ control, handleChange }: DeriveOptions) {
|
|
14
|
+
// Get the root form data from JSONForms context
|
|
15
|
+
const injectedFormData = inject<{ value: unknown }>("formData", {
|
|
16
|
+
value: {},
|
|
17
|
+
});
|
|
18
|
+
const rootData = computed(() => injectedFormData.value || {});
|
|
19
|
+
|
|
20
|
+
// Get external data from context if available
|
|
21
|
+
const injectedExternalData = inject<{ value: unknown }>("externalData", {
|
|
22
|
+
value: {},
|
|
23
|
+
});
|
|
24
|
+
const externalData = computed(() => injectedExternalData.value || {});
|
|
25
|
+
|
|
26
|
+
// Extract derive configuration from uischema options
|
|
27
|
+
const deriveConfig = computed(() => {
|
|
28
|
+
const options = control.value.uischema?.options as
|
|
29
|
+
| { derive?: string; mode?: string }
|
|
30
|
+
| undefined;
|
|
31
|
+
return {
|
|
32
|
+
expression: options?.derive,
|
|
33
|
+
mode: options?.mode || "follow", // 'follow' = auto-update, 'manual' = user controlled
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Watch for changes in form data and external data and update derived field
|
|
38
|
+
watch(
|
|
39
|
+
[rootData, externalData, deriveConfig],
|
|
40
|
+
([data, extData, config]) => {
|
|
41
|
+
if (!config.expression || config.mode !== "follow") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const derivedValue = resolveDeriveExpression(
|
|
47
|
+
config.expression,
|
|
48
|
+
data,
|
|
49
|
+
extData,
|
|
50
|
+
);
|
|
51
|
+
if (derivedValue !== control.value.data) {
|
|
52
|
+
handleChange(control.value.path, derivedValue);
|
|
53
|
+
}
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.warn(
|
|
56
|
+
`Failed to derive value for ${control.value.path}:`,
|
|
57
|
+
error,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{ deep: true, immediate: true },
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function resolveDeriveExpression(
|
|
66
|
+
expression: string,
|
|
67
|
+
data: unknown,
|
|
68
|
+
externalData?: unknown,
|
|
69
|
+
): unknown {
|
|
70
|
+
// Handle externalData() syntax
|
|
71
|
+
if (expression.startsWith("externalData(") && expression.endsWith(")")) {
|
|
72
|
+
const propertyPath = expression.slice(13, -1); // Remove "externalData(" and ")"
|
|
73
|
+
return resolvePropertyPath(propertyPath, externalData);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Handle simple property paths like "country.name"
|
|
77
|
+
if (
|
|
78
|
+
!expression.includes("(") &&
|
|
79
|
+
!expression.includes("+") &&
|
|
80
|
+
!expression.includes("?")
|
|
81
|
+
) {
|
|
82
|
+
return resolvePropertyPath(expression, data);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// For now, we'll only support simple property paths and externalData() calls
|
|
86
|
+
// Complex expressions would require a safe expression evaluator
|
|
87
|
+
return resolvePropertyPath(expression, data);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function resolvePropertyPath(path: string, data: unknown): unknown {
|
|
91
|
+
if (!path || !data) return "";
|
|
92
|
+
|
|
93
|
+
const keys = path.split(".");
|
|
94
|
+
let value: unknown = data;
|
|
95
|
+
|
|
96
|
+
for (const key of keys) {
|
|
97
|
+
if (value && typeof value === "object" && key in value) {
|
|
98
|
+
value = (value as Record<string, unknown>)[key];
|
|
99
|
+
} else {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return value;
|
|
105
|
+
}
|
package/src/vue/index.ts
CHANGED
|
@@ -70,4 +70,13 @@ export { primevueRenderers } from "./primevue";
|
|
|
70
70
|
export { ProviderAutocomplete, ProviderSelect, ProviderMultiSelect };
|
|
71
71
|
export { useProvider } from "./composables/useProvider";
|
|
72
72
|
export * from "./testers";
|
|
73
|
-
|
|
73
|
+
|
|
74
|
+
// Export individual PrimeVue components using lazy evaluation to avoid circular deps
|
|
75
|
+
export {
|
|
76
|
+
JfText,
|
|
77
|
+
JfTextArea,
|
|
78
|
+
JfNumber,
|
|
79
|
+
JfEnum,
|
|
80
|
+
JfEnumArray,
|
|
81
|
+
JfBoolean,
|
|
82
|
+
} from "./primevue";
|
|
@@ -1,11 +1,48 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: "JfBoolean",
|
|
4
|
+
props: {
|
|
5
|
+
uischema: {
|
|
6
|
+
type: Object,
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
schema: {
|
|
10
|
+
type: Object,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
path: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
enabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: undefined,
|
|
20
|
+
},
|
|
21
|
+
renderers: {
|
|
22
|
+
type: Array,
|
|
23
|
+
required: false,
|
|
24
|
+
},
|
|
25
|
+
cells: {
|
|
26
|
+
type: Array,
|
|
27
|
+
required: false,
|
|
28
|
+
},
|
|
29
|
+
config: {
|
|
30
|
+
type: Object,
|
|
31
|
+
required: false,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
36
|
+
|
|
1
37
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
38
|
+
import type { ControlProps } from "@jsonforms/vue";
|
|
39
|
+
import { useJsonFormsControl } from "@jsonforms/vue";
|
|
40
|
+
import { getCurrentInstance } from "vue";
|
|
4
41
|
import Checkbox from "primevue/checkbox";
|
|
5
42
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const props =
|
|
43
|
+
// Access props from the component instance
|
|
44
|
+
const instance = getCurrentInstance()!;
|
|
45
|
+
const props = instance.props as unknown as ControlProps;
|
|
9
46
|
const { control, handleChange } = useJsonFormsControl(props);
|
|
10
47
|
|
|
11
48
|
const onToggle = (val: boolean) => handleChange(control.value.path, val);
|