@narrative.io/jsonforms-provider-protocols 1.1.0-beta.1 → 1.1.0-beta.10
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 +46 -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 +48 -37
- package/src/vue/styles.css +5 -0
|
@@ -1,75 +1,63 @@
|
|
|
1
|
-
import type { ControlElement, JsonSchema } 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<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<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=JfEnum.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfEnum.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnum.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JfEnum.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnum.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8LA,wBA8SK"}
|
|
@@ -1,8 +1,155 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { defineComponent, getCurrentInstance, computed, inject, ref, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
2
|
+
import { useJsonFormsControl } from "@jsonforms/vue";
|
|
3
|
+
import { useProvider } from "../composables/useProvider.js";
|
|
4
|
+
import { useDerive } from "../composables/useDerive.js";
|
|
5
|
+
import Dropdown from "primevue/dropdown";
|
|
6
|
+
const _hoisted_1 = { class: "flex flex-column gap-2" };
|
|
7
|
+
const _hoisted_2 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "text-color text-left"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_3 = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "text-color-secondary text-left"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_4 = {
|
|
16
|
+
key: 2,
|
|
17
|
+
class: "p-error",
|
|
18
|
+
role: "alert"
|
|
19
|
+
};
|
|
20
|
+
const _hoisted_5 = {
|
|
21
|
+
key: 3,
|
|
22
|
+
class: "p-error"
|
|
23
|
+
};
|
|
24
|
+
const __default__ = {
|
|
25
|
+
name: "JfEnum",
|
|
26
|
+
props: {
|
|
27
|
+
uischema: {
|
|
28
|
+
type: Object,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
schema: {
|
|
32
|
+
type: Object,
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
path: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: true
|
|
38
|
+
},
|
|
39
|
+
enabled: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: void 0
|
|
42
|
+
},
|
|
43
|
+
renderers: {
|
|
44
|
+
type: Array,
|
|
45
|
+
required: false
|
|
46
|
+
},
|
|
47
|
+
cells: {
|
|
48
|
+
type: Array,
|
|
49
|
+
required: false
|
|
50
|
+
},
|
|
51
|
+
config: {
|
|
52
|
+
type: Object,
|
|
53
|
+
required: false
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
58
|
+
...__default__,
|
|
59
|
+
setup(__props) {
|
|
60
|
+
const instance = getCurrentInstance();
|
|
61
|
+
const props = instance.props;
|
|
62
|
+
const { control, handleChange } = useJsonFormsControl(props);
|
|
63
|
+
const toOptions = (schema) => {
|
|
64
|
+
if (!schema) return [];
|
|
65
|
+
const s = schema;
|
|
66
|
+
if (Array.isArray(s.enum))
|
|
67
|
+
return s.enum.map((v) => ({ label: String(v), value: v }));
|
|
68
|
+
if (Array.isArray(s.oneOf))
|
|
69
|
+
return s.oneOf.map((o) => ({
|
|
70
|
+
label: o.title ?? String(o.const),
|
|
71
|
+
value: o.const
|
|
72
|
+
}));
|
|
73
|
+
return [];
|
|
74
|
+
};
|
|
75
|
+
const binding = computed(() => {
|
|
76
|
+
const provider = control.value.uischema?.options?.provider;
|
|
77
|
+
if (provider && typeof provider === "object" && !provider.load) {
|
|
78
|
+
return { ...provider, load: "mount" };
|
|
79
|
+
}
|
|
80
|
+
return provider;
|
|
81
|
+
});
|
|
82
|
+
const deps = computed(
|
|
83
|
+
() => control.value.schema?.["x-provider"]?.dependsOn ?? []
|
|
84
|
+
);
|
|
85
|
+
const depValues = computed(() => {
|
|
86
|
+
return deps.value.map((dep) => {
|
|
87
|
+
const path = dep.startsWith("#/") ? dep.slice(2) : dep;
|
|
88
|
+
const keys = path.replace(/\//g, ".").split(".");
|
|
89
|
+
let value = rootData.value;
|
|
90
|
+
for (const key of keys) {
|
|
91
|
+
if (value && typeof value === "object" && key in value) {
|
|
92
|
+
value = value[key];
|
|
93
|
+
} else {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return value;
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
const injectedFormData = inject("formData", { value: {} });
|
|
101
|
+
const rootData = computed(() => injectedFormData.value || {});
|
|
102
|
+
const {
|
|
103
|
+
items: providerItems,
|
|
104
|
+
loading,
|
|
105
|
+
error
|
|
106
|
+
} = useProvider(binding, {
|
|
107
|
+
data: rootData,
|
|
108
|
+
path: control.value.path,
|
|
109
|
+
dependsOnValues: depValues.value
|
|
110
|
+
});
|
|
111
|
+
const placeholder = computed(() => {
|
|
112
|
+
if (loading.value) return "Loading…";
|
|
113
|
+
return control.value.uischema?.options?.placeholder ?? control.value.description;
|
|
114
|
+
});
|
|
115
|
+
const options = computed(() => {
|
|
116
|
+
if (binding.value && providerItems.value.length > 0) {
|
|
117
|
+
return providerItems.value;
|
|
118
|
+
}
|
|
119
|
+
return toOptions(control.value.schema);
|
|
120
|
+
});
|
|
121
|
+
useDerive({ control, handleChange });
|
|
122
|
+
const hasInteracted = ref(false);
|
|
123
|
+
const showErrors = computed(() => hasInteracted.value && control.value.errors);
|
|
124
|
+
const onSelect = (val) => {
|
|
125
|
+
handleChange(control.value.path, val);
|
|
126
|
+
};
|
|
127
|
+
const onBlur = () => {
|
|
128
|
+
hasInteracted.value = true;
|
|
129
|
+
};
|
|
130
|
+
return (_ctx, _cache) => {
|
|
131
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
132
|
+
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
133
|
+
unref(control).description ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(control).description), 1)) : createCommentVNode("", true),
|
|
134
|
+
createVNode(unref(Dropdown), {
|
|
135
|
+
class: "w-full",
|
|
136
|
+
options: options.value,
|
|
137
|
+
"option-label": "label",
|
|
138
|
+
"option-value": "value",
|
|
139
|
+
"model-value": unref(control).data ?? null,
|
|
140
|
+
placeholder: placeholder.value,
|
|
141
|
+
disabled: !unref(control).enabled || unref(loading),
|
|
142
|
+
"aria-invalid": !!showErrors.value || void 0,
|
|
143
|
+
"show-clear": true,
|
|
144
|
+
"onUpdate:modelValue": onSelect,
|
|
145
|
+
onBlur
|
|
146
|
+
}, null, 8, ["options", "model-value", "placeholder", "disabled", "aria-invalid"]),
|
|
147
|
+
unref(error) ? (openBlock(), createElementBlock("small", _hoisted_4, "Failed to load: " + toDisplayString(unref(error)), 1)) : showErrors.value ? (openBlock(), createElementBlock("small", _hoisted_5, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
148
|
+
]);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
5
152
|
export {
|
|
6
|
-
|
|
153
|
+
_sfc_main as default
|
|
7
154
|
};
|
|
8
155
|
//# sourceMappingURL=JfEnum.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfEnum.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
1
|
+
{"version":3,"file":"JfEnum.vue.js","sources":["../../../src/vue/primevue/JfEnum.vue"],"sourcesContent":["<script lang=\"ts\">\n// Define props manually to avoid any potential circular dependency issues\nexport default {\n name: \"JfEnum\",\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 { JsonSchema } from \"@jsonforms/core\";\nimport type { ControlProps } from \"@jsonforms/vue\";\nimport { useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed, ref, inject, getCurrentInstance } from \"vue\";\nimport { useProvider } from \"../composables/useProvider\";\nimport { useDerive } from \"../composables/useDerive\";\nimport Dropdown from \"primevue/dropdown\";\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\ntype Opt = { label: string; value: unknown };\nconst toOptions = (schema?: JsonSchema): Opt[] => {\n if (!schema) return [];\n const s = schema as {\n enum?: unknown[];\n oneOf?: Array<{ title?: string; const: unknown }>;\n };\n if (Array.isArray(s.enum))\n return s.enum.map((v: unknown) => ({ label: String(v), value: v }));\n if (Array.isArray(s.oneOf))\n return s.oneOf.map((o) => ({\n label: o.title ?? String(o.const),\n value: o.const,\n }));\n return [];\n};\n\n// Provider support\nconst binding = computed(() => {\n const provider = control.value.uischema?.options?.provider;\n // Ensure load property is set to 'mount' by default\n if (provider && typeof provider === \"object\" && !provider.load) {\n return { ...provider, load: \"mount\" };\n }\n return provider;\n});\n\nconst deps = computed(\n () =>\n ((\n (control.value.schema as Record<string, unknown>)?.[\n \"x-provider\"\n ] as Record<string, unknown>\n )?.dependsOn as string[]) ?? [],\n);\nconst depValues = computed(() => {\n return deps.value.map((dep) => {\n // Resolve dependency value from form data using JSON pointer-like path\n const path = dep.startsWith(\"#/\") ? dep.slice(2) : dep;\n const keys = path.replace(/\\//g, \".\").split(\".\");\n let value: unknown = rootData.value;\n for (const key of keys) {\n if (value && typeof value === \"object\" && key in value) {\n value = (value as Record<string, unknown>)[key];\n } else {\n return null;\n }\n }\n return value;\n });\n});\n\n// Get the root form data from JSONForms context for template URL resolution\nconst injectedFormData = inject<{ value: unknown }>(\"formData\", { value: {} });\nconst rootData = computed(() => injectedFormData.value || {});\n\n// Use provider if available, otherwise fall back to schema enum/oneOf\nconst {\n items: providerItems,\n loading,\n error,\n} = useProvider(binding, {\n data: rootData,\n path: control.value.path,\n dependsOnValues: depValues.value,\n});\n\nconst placeholder = computed<string | undefined>(() => {\n if (loading.value) return \"Loading…\";\n return (\n (control.value.uischema as { options?: { placeholder?: string } })?.options\n ?.placeholder ?? control.value.description\n );\n});\n\nconst options = computed(() => {\n // Use provider items if available, otherwise fall back to schema enum/oneOf\n if (binding.value && providerItems.value.length > 0) {\n return providerItems.value;\n }\n return toOptions(control.value.schema);\n});\n\n// Add derive functionality\nuseDerive({ control, handleChange });\n\n// Track user interaction\nconst hasInteracted = ref(false);\n\nconst showErrors = computed(() => hasInteracted.value && control.value.errors);\n\nconst onSelect = (val: unknown) => {\n handleChange(control.value.path, val);\n};\n\nconst 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 <Dropdown\n class=\"w-full\"\n :options=\"options\"\n option-label=\"label\"\n option-value=\"value\"\n :model-value=\"control.data ?? null\"\n :placeholder=\"placeholder\"\n :disabled=\"!control.enabled || loading\"\n :aria-invalid=\"!!showErrors || undefined\"\n :show-clear=\"true\"\n @update:model-value=\"onSelect\"\n @blur=\"onBlur\"\n />\n <small v-if=\"error\" class=\"p-error\" role=\"alert\"\n >Failed to load: {{ error }}</small\n >\n <small v-else-if=\"showErrors\" class=\"p-error\">{{ control.errors }}</small>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_unref","_toDisplayString","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,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;;;;AAaA,UAAM,WAAW,mBAAA;AACjB,UAAM,QAAQ,SAAS;AACvB,UAAM,EAAE,SAAS,iBAAiB,oBAAoB,KAAK;AAG3D,UAAM,YAAY,CAAC,WAA+B;AAChD,UAAI,CAAC,OAAQ,QAAO,CAAA;AACpB,YAAM,IAAI;AAIV,UAAI,MAAM,QAAQ,EAAE,IAAI;AACtB,eAAO,EAAE,KAAK,IAAI,CAAC,OAAgB,EAAE,OAAO,OAAO,CAAC,GAAG,OAAO,EAAA,EAAI;AACpE,UAAI,MAAM,QAAQ,EAAE,KAAK;AACvB,eAAO,EAAE,MAAM,IAAI,CAAC,OAAO;AAAA,UACzB,OAAO,EAAE,SA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AAzBD,MAAA,OAAA,EAAQ,MAAM,GAAA,CAAA;;;;;"}
|
|
@@ -1,64 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { rendererProps, useJsonFormsControl } from "@jsonforms/vue";
|
|
3
|
-
import Dropdown from "primevue/dropdown";
|
|
4
|
-
const _hoisted_1 = { class: "flex flex-column gap-2" };
|
|
5
|
-
const _hoisted_2 = {
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "text-color text-left"
|
|
8
|
-
};
|
|
9
|
-
const _hoisted_3 = {
|
|
10
|
-
key: 1,
|
|
11
|
-
class: "text-color-secondary text-left"
|
|
12
|
-
};
|
|
13
|
-
const _hoisted_4 = {
|
|
14
|
-
key: 2,
|
|
15
|
-
class: "p-error"
|
|
16
|
-
};
|
|
17
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
-
...{ name: "JfEnum" },
|
|
19
|
-
__name: "JfEnum",
|
|
20
|
-
props: rendererProps(),
|
|
21
|
-
setup(__props) {
|
|
22
|
-
const props = __props;
|
|
23
|
-
const { control, handleChange } = useJsonFormsControl(props);
|
|
24
|
-
const toOptions = (schema) => {
|
|
25
|
-
if (!schema) return [];
|
|
26
|
-
const s = schema;
|
|
27
|
-
if (Array.isArray(s.enum))
|
|
28
|
-
return s.enum.map((v) => ({ label: String(v), value: v }));
|
|
29
|
-
if (Array.isArray(s.oneOf))
|
|
30
|
-
return s.oneOf.map((o) => ({
|
|
31
|
-
label: o.title ?? String(o.const),
|
|
32
|
-
value: o.const
|
|
33
|
-
}));
|
|
34
|
-
return [];
|
|
35
|
-
};
|
|
36
|
-
const placeholder = computed(
|
|
37
|
-
() => control.value.uischema?.options?.placeholder ?? control.value.description
|
|
38
|
-
);
|
|
39
|
-
const options = computed(() => toOptions(control.value.schema));
|
|
40
|
-
const onSelect = (val) => handleChange(control.value.path, val);
|
|
41
|
-
return (_ctx, _cache) => {
|
|
42
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
43
|
-
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
44
|
-
unref(control).description ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(control).description), 1)) : createCommentVNode("", true),
|
|
45
|
-
createVNode(unref(Dropdown), {
|
|
46
|
-
class: "w-full",
|
|
47
|
-
options: options.value,
|
|
48
|
-
"option-label": "label",
|
|
49
|
-
"option-value": "value",
|
|
50
|
-
"model-value": unref(control).data ?? null,
|
|
51
|
-
placeholder: placeholder.value,
|
|
52
|
-
disabled: !unref(control).enabled,
|
|
53
|
-
"aria-invalid": !!unref(control).errors || void 0,
|
|
54
|
-
"show-clear": true,
|
|
55
|
-
"onUpdate:modelValue": onSelect
|
|
56
|
-
}, null, 8, ["options", "model-value", "placeholder", "disabled", "aria-invalid"]),
|
|
57
|
-
unref(control).errors ? (openBlock(), createElementBlock("small", _hoisted_4, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
58
|
-
]);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
});
|
|
1
|
+
import _sfc_main from "./JfEnum.vue.js";
|
|
62
2
|
export {
|
|
63
3
|
_sfc_main as default
|
|
64
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfEnum.vue2.js","sources":[
|
|
1
|
+
{"version":3,"file":"JfEnum.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,75 +1,63 @@
|
|
|
1
|
-
import type { ControlElement, JsonSchema } 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<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<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=JfEnumArray.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfEnumArray.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnumArray.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JfEnumArray.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnumArray.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwMA,wBA4SK"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, getCurrentInstance, computed, inject, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
2
|
+
import { useJsonFormsControl } from "@jsonforms/vue";
|
|
3
|
+
import { useProvider } from "../composables/useProvider.js";
|
|
4
|
+
import { useDerive } from "../composables/useDerive.js";
|
|
3
5
|
import MultiSelect from "primevue/multiselect";
|
|
4
6
|
const _hoisted_1 = { class: "flex flex-column gap-2" };
|
|
5
7
|
const _hoisted_2 = {
|
|
@@ -12,14 +14,51 @@ const _hoisted_3 = {
|
|
|
12
14
|
};
|
|
13
15
|
const _hoisted_4 = {
|
|
14
16
|
key: 2,
|
|
17
|
+
class: "p-error",
|
|
18
|
+
role: "alert"
|
|
19
|
+
};
|
|
20
|
+
const _hoisted_5 = {
|
|
21
|
+
key: 3,
|
|
15
22
|
class: "p-error"
|
|
16
23
|
};
|
|
24
|
+
const __default__ = {
|
|
25
|
+
name: "JfEnumArray",
|
|
26
|
+
props: {
|
|
27
|
+
uischema: {
|
|
28
|
+
type: Object,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
schema: {
|
|
32
|
+
type: Object,
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
path: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: true
|
|
38
|
+
},
|
|
39
|
+
enabled: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: void 0
|
|
42
|
+
},
|
|
43
|
+
renderers: {
|
|
44
|
+
type: Array,
|
|
45
|
+
required: false
|
|
46
|
+
},
|
|
47
|
+
cells: {
|
|
48
|
+
type: Array,
|
|
49
|
+
required: false
|
|
50
|
+
},
|
|
51
|
+
config: {
|
|
52
|
+
type: Object,
|
|
53
|
+
required: false
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
17
57
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
-
...
|
|
19
|
-
__name: "JfEnumArray",
|
|
20
|
-
props: rendererProps(),
|
|
58
|
+
...__default__,
|
|
21
59
|
setup(__props) {
|
|
22
|
-
const
|
|
60
|
+
const instance = getCurrentInstance();
|
|
61
|
+
const props = instance.props;
|
|
23
62
|
const { control, handleChange } = useJsonFormsControl(props);
|
|
24
63
|
const toOptions = (schema) => {
|
|
25
64
|
if (!schema) return [];
|
|
@@ -33,12 +72,53 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
33
72
|
}));
|
|
34
73
|
return [];
|
|
35
74
|
};
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
75
|
+
const binding = computed(() => {
|
|
76
|
+
const provider = control.value.uischema?.options?.provider;
|
|
77
|
+
if (provider && typeof provider === "object" && !provider.load) {
|
|
78
|
+
return { ...provider, load: "mount" };
|
|
79
|
+
}
|
|
80
|
+
return provider;
|
|
81
|
+
});
|
|
82
|
+
const deps = computed(
|
|
83
|
+
() => control.value.schema?.["x-provider"]?.dependsOn ?? []
|
|
41
84
|
);
|
|
85
|
+
const depValues = computed(() => {
|
|
86
|
+
return deps.value.map((dep) => {
|
|
87
|
+
const path = dep.startsWith("#/") ? dep.slice(2) : dep;
|
|
88
|
+
const keys = path.replace(/\//g, ".").split(".");
|
|
89
|
+
let value = rootData.value;
|
|
90
|
+
for (const key of keys) {
|
|
91
|
+
if (value && typeof value === "object" && key in value) {
|
|
92
|
+
value = value[key];
|
|
93
|
+
} else {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return value;
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
const injectedFormData = inject("formData", { value: {} });
|
|
101
|
+
const rootData = computed(() => injectedFormData.value || {});
|
|
102
|
+
const {
|
|
103
|
+
items: providerItems,
|
|
104
|
+
loading,
|
|
105
|
+
error
|
|
106
|
+
} = useProvider(binding, {
|
|
107
|
+
data: rootData,
|
|
108
|
+
path: control.value.path,
|
|
109
|
+
dependsOnValues: depValues.value
|
|
110
|
+
});
|
|
111
|
+
const options = computed(() => {
|
|
112
|
+
if (binding.value && providerItems.value.length > 0) {
|
|
113
|
+
return providerItems.value;
|
|
114
|
+
}
|
|
115
|
+
return toOptions(control.value.schema?.items);
|
|
116
|
+
});
|
|
117
|
+
useDerive({ control, handleChange });
|
|
118
|
+
const placeholder = computed(() => {
|
|
119
|
+
if (loading.value) return "Loading…";
|
|
120
|
+
return control.value.uischema?.options?.placeholder ?? control.value.description;
|
|
121
|
+
});
|
|
42
122
|
const sameSet = (a, b) => {
|
|
43
123
|
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length)
|
|
44
124
|
return false;
|
|
@@ -69,11 +149,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
69
149
|
"option-value": "value",
|
|
70
150
|
"data-key": "value",
|
|
71
151
|
display: "chip",
|
|
72
|
-
disabled: !unref(control).enabled,
|
|
152
|
+
disabled: !unref(control).enabled || unref(loading),
|
|
73
153
|
"aria-invalid": !!unref(control).errors || void 0,
|
|
74
154
|
placeholder: placeholder.value
|
|
75
155
|
}, null, 8, ["modelValue", "options", "disabled", "aria-invalid", "placeholder"]),
|
|
76
|
-
unref(control).errors ? (openBlock(), createElementBlock("small",
|
|
156
|
+
unref(error) ? (openBlock(), createElementBlock("small", _hoisted_4, "Failed to load: " + toDisplayString(unref(error)), 1)) : unref(control).errors ? (openBlock(), createElementBlock("small", _hoisted_5, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
77
157
|
]);
|
|
78
158
|
};
|
|
79
159
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfEnumArray.vue.js","sources":["../../../src/vue/primevue/JfEnumArray.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {
|
|
1
|
+
{"version":3,"file":"JfEnumArray.vue.js","sources":["../../../src/vue/primevue/JfEnumArray.vue"],"sourcesContent":["<script lang=\"ts\">\nexport default {\n name: \"JfEnumArray\",\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 { JsonSchema } from \"@jsonforms/core\";\nimport type { ControlProps } from \"@jsonforms/vue\";\nimport { useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed, inject, getCurrentInstance } from \"vue\";\nimport { useProvider } from \"../composables/useProvider\";\nimport { useDerive } from \"../composables/useDerive\";\nimport MultiSelect from \"primevue/multiselect\";\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\ntype Opt = { label: string; value: unknown };\nconst toOptions = (schema?: JsonSchema): Opt[] => {\n if (!schema) return [];\n const s = schema as {\n enum?: unknown[];\n oneOf?: Array<{ title?: string; const: unknown }>;\n };\n if (Array.isArray(s.enum))\n return s.enum.map((v: unknown) => ({ label: String(v), value: v }));\n if (Array.isArray(s.oneOf))\n return s.oneOf.map((o) => ({\n label: o.title ?? String(o.const),\n value: o.const,\n }));\n return [];\n};\n\n// Provider support\nconst binding = computed(() => {\n const provider = control.value.uischema?.options?.provider;\n // Ensure load property is set to 'mount' by default\n if (provider && typeof provider === \"object\" && !provider.load) {\n return { ...provider, load: \"mount\" };\n }\n return provider;\n});\n\nconst deps = computed(\n () =>\n ((\n (control.value.schema as Record<string, unknown>)?.[\n \"x-provider\"\n ] as Record<string, unknown>\n )?.dependsOn as string[]) ?? [],\n);\nconst depValues = computed(() => {\n return deps.value.map((dep) => {\n // Resolve dependency value from form data using JSON pointer-like path\n const path = dep.startsWith(\"#/\") ? dep.slice(2) : dep;\n const keys = path.replace(/\\//g, \".\").split(\".\");\n let value: unknown = rootData.value;\n for (const key of keys) {\n if (value && typeof value === \"object\" && key in value) {\n value = (value as Record<string, unknown>)[key];\n } else {\n return null;\n }\n }\n return value;\n });\n});\n\n// Get the root form data from JSONForms context for template URL resolution\nconst injectedFormData = inject<{ value: unknown }>(\"formData\", { value: {} });\nconst rootData = computed(() => injectedFormData.value || {});\n\n// Use provider if available, otherwise fall back to schema enum/oneOf\nconst {\n items: providerItems,\n loading,\n error,\n} = useProvider(binding, {\n data: rootData,\n path: control.value.path,\n dependsOnValues: depValues.value,\n});\n\nconst options = computed(() => {\n // Use provider items if available, otherwise fall back to schema enum/oneOf\n if (binding.value && providerItems.value.length > 0) {\n return providerItems.value;\n }\n return toOptions((control.value.schema as { items?: JsonSchema })?.items);\n});\n\n// Add derive functionality\nuseDerive({ control, handleChange });\n\nconst placeholder = computed<string | undefined>(() => {\n if (loading.value) return \"Loading…\";\n return (\n (control.value.uischema as { options?: { placeholder?: string } })?.options\n ?.placeholder ?? control.value.description\n );\n});\n\n// order-insensitive shallow equality for primitive enums\nconst sameSet = (a: unknown[], b: unknown[]) => {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length)\n return false;\n const s = new Set(b);\n return a.every((v) => s.has(v));\n};\n\n// v-model with guard to avoid recursive updates\nconst model = computed<unknown[]>({\n get() {\n const curr = Array.isArray(control.value.data) ? control.value.data : [];\n // return a fresh copy so PrimeMultiSelect can't mutate JSONForms' array in place\n return [...curr];\n },\n set(val) {\n const next = Array.isArray(val) ? [...val] : [];\n const curr = Array.isArray(control.value.data) ? control.value.data : [];\n if (!sameSet(curr, next)) handleChange(control.value.path, next);\n },\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\n <MultiSelect\n v-model=\"model\"\n class=\"w-full\"\n :options=\"options\"\n option-label=\"label\"\n option-value=\"value\"\n data-key=\"value\"\n display=\"chip\"\n :disabled=\"!control.enabled || loading\"\n :aria-invalid=\"!!control.errors || undefined\"\n :placeholder=\"placeholder\"\n />\n\n <small v-if=\"error\" class=\"p-error\" role=\"alert\"\n >Failed to load: {{ error }}</small\n >\n <small v-else-if=\"control.errors\" class=\"p-error\">{{\n control.errors\n }}</small>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_unref","_toD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