@narrative.io/jsonforms-provider-protocols 1.1.0-beta.0 → 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 +1 -1
- 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/components/ProviderMultiSelect.vue.d.ts +9 -0
- package/dist/vue/components/ProviderMultiSelect.vue.d.ts.map +1 -0
- package/dist/vue/components/ProviderMultiSelect.vue.js +8 -0
- package/dist/vue/components/ProviderMultiSelect.vue.js.map +1 -0
- package/dist/vue/components/ProviderMultiSelect.vue2.js +95 -0
- package/dist/vue/components/ProviderMultiSelect.vue2.js.map +1 -0
- 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 +3 -2
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +26 -8
- 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/components/ProviderMultiSelect.vue +108 -0
- package/src/vue/composables/useDerive.ts +105 -0
- package/src/vue/index.ts +36 -3
- 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,6 +1,9 @@
|
|
|
1
|
-
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode,
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, getCurrentInstance, computed, inject, ref, watch, createElementBlock, openBlock, createCommentVNode, createBlock, 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 InputText from "primevue/inputtext";
|
|
6
|
+
import AutoComplete from "primevue/autocomplete";
|
|
4
7
|
const _hoisted_1 = { class: "flex flex-column gap-2" };
|
|
5
8
|
const _hoisted_2 = {
|
|
6
9
|
key: 0,
|
|
@@ -11,41 +14,153 @@ const _hoisted_3 = {
|
|
|
11
14
|
class: "text-color-secondary text-left"
|
|
12
15
|
};
|
|
13
16
|
const _hoisted_4 = {
|
|
14
|
-
key:
|
|
17
|
+
key: 4,
|
|
18
|
+
class: "p-error",
|
|
19
|
+
role: "alert"
|
|
20
|
+
};
|
|
21
|
+
const _hoisted_5 = {
|
|
22
|
+
key: 5,
|
|
15
23
|
class: "p-error"
|
|
16
24
|
};
|
|
25
|
+
const __default__ = {
|
|
26
|
+
name: "JfText",
|
|
27
|
+
props: {
|
|
28
|
+
uischema: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
schema: {
|
|
33
|
+
type: Object,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
path: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
enabled: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: void 0
|
|
43
|
+
},
|
|
44
|
+
renderers: {
|
|
45
|
+
type: Array,
|
|
46
|
+
required: false
|
|
47
|
+
},
|
|
48
|
+
cells: {
|
|
49
|
+
type: Array,
|
|
50
|
+
required: false
|
|
51
|
+
},
|
|
52
|
+
config: {
|
|
53
|
+
type: Object,
|
|
54
|
+
required: false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
17
58
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
-
...
|
|
19
|
-
__name: "JfText",
|
|
20
|
-
props: rendererProps(),
|
|
59
|
+
...__default__,
|
|
21
60
|
setup(__props) {
|
|
22
|
-
const
|
|
61
|
+
const instance = getCurrentInstance();
|
|
62
|
+
const props = instance.props;
|
|
23
63
|
const { control, handleChange } = useJsonFormsControl(props);
|
|
24
|
-
const
|
|
25
|
-
|
|
64
|
+
const binding = computed(() => {
|
|
65
|
+
const provider = control.value.uischema?.options?.provider;
|
|
66
|
+
if (provider && typeof provider === "object" && !provider.load) {
|
|
67
|
+
return { ...provider, load: "query" };
|
|
68
|
+
}
|
|
69
|
+
return provider;
|
|
70
|
+
});
|
|
71
|
+
const deps = computed(
|
|
72
|
+
() => control.value.schema?.["x-provider"]?.dependsOn ?? []
|
|
26
73
|
);
|
|
74
|
+
const depValues = computed(() => {
|
|
75
|
+
return deps.value.map((dep) => {
|
|
76
|
+
const path = dep.startsWith("#/") ? dep.slice(2) : dep;
|
|
77
|
+
const keys = path.replace(/\//g, ".").split(".");
|
|
78
|
+
let value = rootData.value;
|
|
79
|
+
for (const key of keys) {
|
|
80
|
+
if (value && typeof value === "object" && key in value) {
|
|
81
|
+
value = value[key];
|
|
82
|
+
} else {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
const injectedFormData = inject("formData", { value: {} });
|
|
90
|
+
const rootData = computed(() => injectedFormData.value || {});
|
|
91
|
+
const query = ref("");
|
|
92
|
+
const { items, loading, error, reload } = useProvider(binding, {
|
|
93
|
+
data: rootData,
|
|
94
|
+
path: control.value.path,
|
|
95
|
+
uiQuery: query.value,
|
|
96
|
+
dependsOnValues: depValues.value
|
|
97
|
+
});
|
|
98
|
+
watch(query, () => {
|
|
99
|
+
if (binding.value?.load === "query") reload();
|
|
100
|
+
});
|
|
101
|
+
const placeholder = computed(() => {
|
|
102
|
+
if (loading.value) return "Loading…";
|
|
103
|
+
return control.value.uischema?.options?.placeholder ?? control.value.description;
|
|
104
|
+
});
|
|
105
|
+
const isAutocomplete = computed(() => !!binding.value);
|
|
106
|
+
useDerive({ control, handleChange });
|
|
107
|
+
const hasInteracted = ref(false);
|
|
108
|
+
const hasFocused = ref(false);
|
|
109
|
+
const showErrors = computed(() => hasInteracted.value && control.value.errors);
|
|
27
110
|
function onInput(val) {
|
|
28
|
-
const newValue = val
|
|
29
|
-
if (
|
|
111
|
+
const newValue = val && val.trim() !== "" ? val : void 0;
|
|
112
|
+
if (control.value.data !== newValue) {
|
|
30
113
|
handleChange(control.value.path, newValue);
|
|
31
114
|
}
|
|
32
115
|
}
|
|
116
|
+
function onBlur() {
|
|
117
|
+
if (hasFocused.value) {
|
|
118
|
+
hasInteracted.value = true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function onFocus() {
|
|
122
|
+
hasFocused.value = true;
|
|
123
|
+
}
|
|
124
|
+
const onComplete = (event) => {
|
|
125
|
+
query.value = event.query;
|
|
126
|
+
};
|
|
127
|
+
const onSelect = (event) => {
|
|
128
|
+
const newValue = event.value?.value ?? event.value;
|
|
129
|
+
handleChange(control.value.path, newValue);
|
|
130
|
+
};
|
|
33
131
|
return (_ctx, _cache) => {
|
|
34
132
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
35
133
|
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
36
134
|
unref(control).description ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(control).description), 1)) : createCommentVNode("", true),
|
|
37
|
-
|
|
135
|
+
isAutocomplete.value ? (openBlock(), createBlock(unref(AutoComplete), {
|
|
136
|
+
key: 2,
|
|
137
|
+
class: "w-full",
|
|
138
|
+
"model-value": unref(control).data ?? "",
|
|
139
|
+
suggestions: unref(items),
|
|
140
|
+
"option-label": "label",
|
|
141
|
+
placeholder: placeholder.value,
|
|
142
|
+
disabled: !unref(control).enabled,
|
|
143
|
+
"aria-invalid": !!showErrors.value || void 0,
|
|
144
|
+
onComplete,
|
|
145
|
+
onItemSelect: onSelect,
|
|
146
|
+
"onUpdate:modelValue": onInput,
|
|
147
|
+
onBlur,
|
|
148
|
+
onFocus
|
|
149
|
+
}, null, 8, ["model-value", "suggestions", "placeholder", "disabled", "aria-invalid"])) : (openBlock(), createBlock(unref(InputText), {
|
|
150
|
+
key: 3,
|
|
38
151
|
class: "w-full",
|
|
39
152
|
"model-value": unref(control).data ?? "",
|
|
40
153
|
disabled: !unref(control).enabled,
|
|
41
|
-
"aria-invalid": !!
|
|
154
|
+
"aria-invalid": !!showErrors.value || void 0,
|
|
42
155
|
placeholder: placeholder.value,
|
|
43
156
|
autocapitalize: "off",
|
|
44
157
|
autocomplete: "off",
|
|
45
158
|
spellcheck: "false",
|
|
46
|
-
"onUpdate:modelValue": onInput
|
|
47
|
-
|
|
48
|
-
|
|
159
|
+
"onUpdate:modelValue": onInput,
|
|
160
|
+
onBlur,
|
|
161
|
+
onFocus
|
|
162
|
+
}, null, 8, ["model-value", "disabled", "aria-invalid", "placeholder"])),
|
|
163
|
+
unref(error) ? (openBlock(), createElementBlock("small", _hoisted_4, "Failed: " + toDisplayString(unref(error)), 1)) : showErrors.value ? (openBlock(), createElementBlock("small", _hoisted_5, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
49
164
|
]);
|
|
50
165
|
};
|
|
51
166
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfText.vue.js","sources":["../../../src/vue/primevue/JfText.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {
|
|
1
|
+
{"version":3,"file":"JfText.vue.js","sources":["../../../src/vue/primevue/JfText.vue"],"sourcesContent":["<script lang=\"ts\">\nexport default {\n name: \"JfText\",\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, inject, watch, getCurrentInstance } from \"vue\";\nimport { useProvider } from \"../composables/useProvider\";\nimport { useDerive } from \"../composables/useDerive\";\nimport InputText from \"primevue/inputtext\";\nimport AutoComplete from \"primevue/autocomplete\";\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\n// Provider support for autocomplete functionality\nconst binding = computed(() => {\n const provider = control.value.uischema?.options?.provider;\n // Ensure load property is set to 'query' by default for autocomplete\n if (provider && typeof provider === \"object\" && !provider.load) {\n return { ...provider, load: \"query\" };\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\nconst query = ref(\"\");\nconst { items, loading, error, reload } = useProvider(binding, {\n data: rootData,\n path: control.value.path,\n uiQuery: query.value,\n dependsOnValues: depValues.value,\n});\n\nwatch(query, () => {\n if (binding.value?.load === \"query\") reload();\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 isAutocomplete = computed(() => !!binding.value);\n\n// Add derive functionality\nuseDerive({ control, handleChange });\n\n// Track user interaction\nconst hasInteracted = ref(false);\nconst hasFocused = 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 if (hasFocused.value) {\n hasInteracted.value = true;\n }\n}\n\nfunction onFocus() {\n hasFocused.value = true;\n}\n\n// Autocomplete specific handlers\nconst onComplete = (event: { query: string }) => {\n query.value = event.query;\n};\n\nconst onSelect = (event: { value?: { value?: unknown } | unknown }) => {\n const newValue = (event.value as { value?: unknown })?.value ?? event.value;\n handleChange(control.value.path, newValue);\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 <AutoComplete\n v-if=\"isAutocomplete\"\n class=\"w-full\"\n :model-value=\"control.data ?? ''\"\n :suggestions=\"items\"\n option-label=\"label\"\n :placeholder=\"placeholder\"\n :disabled=\"!control.enabled\"\n :aria-invalid=\"!!showErrors || undefined\"\n @complete=\"onComplete\"\n @item-select=\"onSelect\"\n @update:model-value=\"onInput\"\n @blur=\"onBlur\"\n @focus=\"onFocus\"\n />\n <InputText\n v-else\n class=\"w-full\"\n :model-value=\"control.data ?? ''\"\n :disabled=\"!control.enabled\"\n :aria-invalid=\"!!showErrors || undefined\"\n :placeholder=\"placeholder\"\n autocapitalize=\"off\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n @update:model-value=\"onInput\"\n @blur=\"onBlur\"\n @focus=\"onFocus\"\n />\n <small v-if=\"error\" class=\"p-error\" role=\"alert\">Failed: {{ error }}</small>\n <small v-else-if=\"showErrors\" class=\"p-error\">{{ control.errors }}</small>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_unref","_toDisplayString","_createBlock"],"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;;;;AAaA,UAAM,WAAW,mBAAA;AACjB,UAAM,QAAQ,SAAS;AACvB,UAAM,EAAE,SAAS,iBAAiB,oBAAoB,KAAK;AAG3D,UAAM,UAAU,SAAS,MAAM;AAC7B,YAAM,WAAW,QAAQ,MAAM,UAAU,SAAS;AAElD,UAAI,YAAY,OAAO,aAAa,YAAY,CAAC,SAAS,MAAM;AAC9D,eAAO,EAAE,GAAG,UAAU,MAAM,QAAA;AAAA,MAC9B;AACA,aAAO;AAAA,IACT,CAAC;AAED,UAAM,OAAO;AAAA,MACX,MAEK,QAAQ,MAAM,SACb,YACF,GACC,aAA0B,CAAA;AAAA,IAAC;AAElC,UAAM,YAAY,SAAS,MAAM;AAC/B,aAAO,KAAK,MAAM,IAAI,CAAC,QAAQ;AAE7B,c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;AAAA,UACd,gBAAe;AAAA,UACf,cAAa;AAAA,UACb,YAAW;AAAA,UACV,uBAAoB;AAAA,UACpB;AAAA,UACA;AAAA,QAAA;QAEUA,MAAA,KAAA,KAAbF,UAAA,GAAAC,mBAA4E,SAA5E,YAAiD,6BAAWC,MAAA,KAAA,CAAK,GAAA,CAAA,KAC/C,WAAA,SAAlBF,UAAA,GAAAC,mBAA0E,SAA1E,YAA0EE,gBAAzBD,MAAA,OAAA,EAAQ,MAAM,GAAA,CAAA;;;;;"}
|
|
@@ -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;AA8CtE,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,51 @@ 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 {
|
|
43
|
+
rankWith,
|
|
44
|
+
isStringControl,
|
|
45
|
+
or,
|
|
46
|
+
isNumberControl,
|
|
47
|
+
isIntegerControl,
|
|
48
|
+
and,
|
|
49
|
+
isControl,
|
|
50
|
+
schemaMatches,
|
|
51
|
+
isBooleanControl
|
|
52
|
+
} = await import("@jsonforms/core");
|
|
53
|
+
const isMultilineString = (uischema, schema) => {
|
|
54
|
+
const controlUischema = uischema;
|
|
55
|
+
return and(isStringControl, () => controlUischema?.options?.multi === true)(
|
|
56
|
+
uischema,
|
|
57
|
+
schema,
|
|
58
|
+
{}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
primevueRenderers.push(
|
|
62
|
+
// Multiline text has higher priority than regular text
|
|
63
|
+
{ tester: rankWith(PRIME + 4, isMultilineString), renderer: _sfc_main },
|
|
64
|
+
{ tester: rankWith(PRIME + 3, isStringControl), renderer: _sfc_main$1 },
|
|
65
|
+
{
|
|
66
|
+
tester: rankWith(PRIME + 4, or(isNumberControl, isIntegerControl)),
|
|
67
|
+
renderer: _sfc_main$2
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
tester: rankWith(PRIME + 5, and(isControl, schemaMatches(isScalarEnum))),
|
|
71
|
+
renderer: _sfc_main$3
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
tester: rankWith(PRIME + 6, and(isControl, schemaMatches(isEnumArray))),
|
|
75
|
+
renderer: _sfc_main$4
|
|
76
|
+
},
|
|
77
|
+
{ tester: rankWith(PRIME + 3, isBooleanControl), renderer: _sfc_main$5 }
|
|
78
|
+
);
|
|
79
|
+
});
|
|
62
80
|
export {
|
|
63
|
-
_sfc_main$
|
|
64
|
-
JfEnum,
|
|
65
|
-
_sfc_main$
|
|
81
|
+
_sfc_main$5 as JfBoolean,
|
|
82
|
+
_sfc_main$3 as JfEnum,
|
|
83
|
+
_sfc_main$4 as JfEnumArray,
|
|
66
84
|
_sfc_main$2 as JfNumber,
|
|
67
85
|
_sfc_main$1 as JfText,
|
|
68
86
|
_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 {\n rankWith,\n isStringControl,\n or,\n isNumberControl,\n isIntegerControl,\n and,\n isControl,\n schemaMatches,\n isBooleanControl,\n } = await import(\"@jsonforms/core\");\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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