@narrative.io/jsonforms-provider-protocols 1.0.3 → 1.1.0-beta.1
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/dist/jsonforms-provider-protocols.css +10 -2
- package/dist/protocols/rest_api.d.ts.map +1 -1
- package/dist/protocols/rest_api.js +5 -1
- package/dist/protocols/rest_api.js.map +1 -1
- package/dist/vue/components/ProviderAutocomplete.vue.d.ts.map +1 -1
- package/dist/vue/components/ProviderAutocomplete.vue.js +36 -23
- package/dist/vue/components/ProviderAutocomplete.vue.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/components/ProviderSelect.vue.d.ts.map +1 -1
- package/dist/vue/components/ProviderSelect.vue.js +1 -1
- package/dist/vue/components/ProviderSelect.vue2.js +34 -28
- package/dist/vue/components/ProviderSelect.vue2.js.map +1 -1
- package/dist/vue/composables/useProvider.d.ts +10 -2
- package/dist/vue/composables/useProvider.d.ts.map +1 -1
- package/dist/vue/composables/useProvider.js +4 -2
- package/dist/vue/composables/useProvider.js.map +1 -1
- package/dist/vue/index.d.ts +4 -1
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +38 -4
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/primevue/JfBoolean.vue.d.ts +75 -0
- package/dist/vue/primevue/JfBoolean.vue.d.ts.map +1 -0
- package/dist/vue/primevue/JfBoolean.vue.js +36 -0
- package/dist/vue/primevue/JfBoolean.vue.js.map +1 -0
- package/dist/vue/primevue/JfBoolean.vue2.js +5 -0
- package/dist/vue/primevue/JfBoolean.vue2.js.map +1 -0
- package/dist/vue/primevue/JfEnum.vue.d.ts +75 -0
- package/dist/vue/primevue/JfEnum.vue.d.ts.map +1 -0
- package/dist/vue/primevue/JfEnum.vue.js +8 -0
- package/dist/vue/primevue/JfEnum.vue.js.map +1 -0
- package/dist/vue/primevue/JfEnum.vue2.js +65 -0
- package/dist/vue/primevue/JfEnum.vue2.js.map +1 -0
- package/dist/vue/primevue/JfEnumArray.vue.d.ts +75 -0
- package/dist/vue/primevue/JfEnumArray.vue.d.ts.map +1 -0
- package/dist/vue/primevue/JfEnumArray.vue.js +84 -0
- package/dist/vue/primevue/JfEnumArray.vue.js.map +1 -0
- package/dist/vue/primevue/JfEnumArray.vue2.js +5 -0
- package/dist/vue/primevue/JfEnumArray.vue2.js.map +1 -0
- package/dist/vue/primevue/JfNumber.vue.d.ts +75 -0
- package/dist/vue/primevue/JfNumber.vue.d.ts.map +1 -0
- package/dist/vue/primevue/JfNumber.vue.js +50 -0
- package/dist/vue/primevue/JfNumber.vue.js.map +1 -0
- package/dist/vue/primevue/JfNumber.vue2.js +5 -0
- package/dist/vue/primevue/JfNumber.vue2.js.map +1 -0
- package/dist/vue/primevue/JfText.vue.d.ts +75 -0
- package/dist/vue/primevue/JfText.vue.d.ts.map +1 -0
- package/dist/vue/primevue/JfText.vue.js +56 -0
- package/dist/vue/primevue/JfText.vue.js.map +1 -0
- package/dist/vue/primevue/JfText.vue2.js +5 -0
- package/dist/vue/primevue/JfText.vue2.js.map +1 -0
- package/dist/vue/primevue/JfTextArea.vue.d.ts +75 -0
- package/dist/vue/primevue/JfTextArea.vue.d.ts.map +1 -0
- package/dist/vue/primevue/JfTextArea.vue.js +55 -0
- package/dist/vue/primevue/JfTextArea.vue.js.map +1 -0
- package/dist/vue/primevue/JfTextArea.vue2.js +5 -0
- package/dist/vue/primevue/JfTextArea.vue2.js.map +1 -0
- package/dist/vue/primevue/index.d.ts +83 -0
- package/dist/vue/primevue/index.d.ts.map +1 -0
- package/dist/vue/primevue/index.js +71 -0
- package/dist/vue/primevue/index.js.map +1 -0
- package/package.json +7 -2
- package/src/protocols/rest_api.ts +8 -1
- package/src/vue/components/ProviderAutocomplete.vue +31 -12
- package/src/vue/components/ProviderMultiSelect.vue +108 -0
- package/src/vue/components/ProviderSelect.vue +40 -21
- package/src/vue/composables/useProvider.ts +3 -2
- package/src/vue/index.ts +33 -4
- package/src/vue/primevue/JfBoolean.vue +26 -0
- package/src/vue/primevue/JfEnum.vue +67 -0
- package/src/vue/primevue/JfEnumArray.vue +85 -0
- package/src/vue/primevue/JfNumber.vue +42 -0
- package/src/vue/primevue/JfText.vue +47 -0
- package/src/vue/primevue/JfTextArea.vue +46 -0
- package/src/vue/primevue/index.ts +99 -0
- package/src/vue/styles.css +15 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
2
|
+
import { rendererProps, useJsonFormsControl } from "@jsonforms/vue";
|
|
3
|
+
import InputNumber from "primevue/inputnumber";
|
|
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: "JfNumber" },
|
|
19
|
+
__name: "JfNumber",
|
|
20
|
+
props: rendererProps(),
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const { control, handleChange } = useJsonFormsControl(props);
|
|
24
|
+
const placeholder = computed(
|
|
25
|
+
() => control.value.uischema?.options?.placeholder ?? control.value.description
|
|
26
|
+
);
|
|
27
|
+
const onNumber = (val) => handleChange(control.value.path, val ?? void 0);
|
|
28
|
+
return (_ctx, _cache) => {
|
|
29
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
30
|
+
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
31
|
+
unref(control).description ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(control).description), 1)) : createCommentVNode("", true),
|
|
32
|
+
createVNode(unref(InputNumber), {
|
|
33
|
+
class: "w-full",
|
|
34
|
+
"input-class": "w-full",
|
|
35
|
+
"use-grouping": false,
|
|
36
|
+
"model-value": typeof unref(control).data === "number" ? unref(control).data : null,
|
|
37
|
+
placeholder: placeholder.value,
|
|
38
|
+
disabled: !unref(control).enabled,
|
|
39
|
+
"aria-invalid": !!unref(control).errors || void 0,
|
|
40
|
+
"onUpdate:modelValue": onNumber
|
|
41
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "aria-invalid"]),
|
|
42
|
+
unref(control).errors ? (openBlock(), createElementBlock("small", _hoisted_4, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
43
|
+
]);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
_sfc_main as default
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=JfNumber.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfNumber.vue.js","sources":["../../../src/vue/primevue/JfNumber.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ControlElement } from \"@jsonforms/core\";\nimport { rendererProps, useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed } from \"vue\";\nimport InputNumber from \"primevue/inputnumber\";\n\ndefineOptions({ name: \"JfNumber\" });\n\nconst props = defineProps(rendererProps<ControlElement>());\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\nconst onNumber = (val: number | null) =>\n handleChange(control.value.path, val ?? undefined);\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 <InputNumber\n class=\"w-full\"\n input-class=\"w-full\"\n :use-grouping=\"false\"\n :model-value=\"typeof control.data === 'number' ? control.data : null\"\n :placeholder=\"placeholder\"\n :disabled=\"!control.enabled\"\n :aria-invalid=\"!!control.errors || undefined\"\n @update:model-value=\"onNumber\"\n />\n <small v-if=\"control.errors\" class=\"p-error\">{{ control.errors }}</small>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_unref","_toDisplayString","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,UAAM,QAAQ;AACd,UAAM,EAAE,SAAS,iBAAiB,oBAAoB,KAAK;AAE3D,UAAM,cAAc;AAAA,MAClB,MACG,QAAQ,MAAM,UAAqD,SAChE,eAAe,QAAQ,MAAM;AAAA,IAAA;AAGrC,UAAM,WAAW,CAAC,QAChB,aAAa,QAAQ,MAAM,MAAM,OAAO,MAAS;;AAIjD,aAAAA,UAAA,GAAAC,mBAkBM,OAlBN,YAkBM;AAAA,QAjBSC,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,YASEF,MAAA,WAAA,GAAA;AAAA,UARA,OAAM;AAAA,UACN,eAAY;AAAA,UACX,gBAAc;AAAA,UACd,sBAAoBA,MAAA,OAAA,EAAQ,SAAI,WAAgBA,MAAA,OAAA,EAAQ,OAAI;AAAA,UAC5D,aAAa,YAAA;AAAA,UACb,UAAQ,CAAGA,MAAA,OAAA,EAAQ;AAAA,UACnB,gBAAY,CAAA,CAAIA,MAAA,OAAA,EAAQ,UAAU;AAAA,UAClC,uBAAoB;AAAA,QAAA;QAEVA,MAAA,OAAA,EAAQ,UAArBF,UAAA,GAAAC,mBAAyE,SAAzE,YAAyEE,gBAAzBD,MAAA,OAAA,EAAQ,MAAM,GAAA,CAAA;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfNumber.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ControlElement } from "@jsonforms/core";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
schema: {
|
|
4
|
+
required: true;
|
|
5
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonSchema>;
|
|
6
|
+
};
|
|
7
|
+
uischema: {
|
|
8
|
+
required: true;
|
|
9
|
+
type: import("vue").PropType<ControlElement>;
|
|
10
|
+
};
|
|
11
|
+
path: {
|
|
12
|
+
required: true;
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
};
|
|
15
|
+
enabled: {
|
|
16
|
+
required: false;
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
renderers: {
|
|
21
|
+
required: boolean;
|
|
22
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonFormsRendererRegistryEntry[]>;
|
|
23
|
+
default: undefined;
|
|
24
|
+
};
|
|
25
|
+
cells: {
|
|
26
|
+
required: boolean;
|
|
27
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[]>;
|
|
28
|
+
default: undefined;
|
|
29
|
+
};
|
|
30
|
+
config: {
|
|
31
|
+
required: boolean;
|
|
32
|
+
type: ObjectConstructor;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
36
|
+
schema: {
|
|
37
|
+
required: true;
|
|
38
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonSchema>;
|
|
39
|
+
};
|
|
40
|
+
uischema: {
|
|
41
|
+
required: true;
|
|
42
|
+
type: import("vue").PropType<ControlElement>;
|
|
43
|
+
};
|
|
44
|
+
path: {
|
|
45
|
+
required: true;
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
};
|
|
48
|
+
enabled: {
|
|
49
|
+
required: false;
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
default: undefined;
|
|
52
|
+
};
|
|
53
|
+
renderers: {
|
|
54
|
+
required: boolean;
|
|
55
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonFormsRendererRegistryEntry[]>;
|
|
56
|
+
default: undefined;
|
|
57
|
+
};
|
|
58
|
+
cells: {
|
|
59
|
+
required: boolean;
|
|
60
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[]>;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
config: {
|
|
64
|
+
required: boolean;
|
|
65
|
+
type: ObjectConstructor;
|
|
66
|
+
default: undefined;
|
|
67
|
+
};
|
|
68
|
+
}>> & Readonly<{}>, {
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
renderers: import("@jsonforms/core").JsonFormsRendererRegistryEntry[];
|
|
71
|
+
cells: import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[];
|
|
72
|
+
config: Record<string, any>;
|
|
73
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
|
+
export default _default;
|
|
75
|
+
//# sourceMappingURL=JfText.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfText.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfText.vue"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmItD,wBAEG"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
2
|
+
import { rendererProps, useJsonFormsControl } from "@jsonforms/vue";
|
|
3
|
+
import InputText from "primevue/inputtext";
|
|
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: "JfText" },
|
|
19
|
+
__name: "JfText",
|
|
20
|
+
props: rendererProps(),
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const { control, handleChange } = useJsonFormsControl(props);
|
|
24
|
+
const placeholder = computed(
|
|
25
|
+
() => control.value.uischema?.options?.placeholder ?? control.value.description
|
|
26
|
+
);
|
|
27
|
+
function onInput(val) {
|
|
28
|
+
const newValue = val ?? "";
|
|
29
|
+
if ((control.value.data ?? "") !== newValue) {
|
|
30
|
+
handleChange(control.value.path, newValue);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
35
|
+
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
36
|
+
unref(control).description ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(control).description), 1)) : createCommentVNode("", true),
|
|
37
|
+
createVNode(unref(InputText), {
|
|
38
|
+
class: "w-full",
|
|
39
|
+
"model-value": unref(control).data ?? "",
|
|
40
|
+
disabled: !unref(control).enabled,
|
|
41
|
+
"aria-invalid": !!unref(control).errors || void 0,
|
|
42
|
+
placeholder: placeholder.value,
|
|
43
|
+
autocapitalize: "off",
|
|
44
|
+
autocomplete: "off",
|
|
45
|
+
spellcheck: "false",
|
|
46
|
+
"onUpdate:modelValue": onInput
|
|
47
|
+
}, null, 8, ["model-value", "disabled", "aria-invalid", "placeholder"]),
|
|
48
|
+
unref(control).errors ? (openBlock(), createElementBlock("small", _hoisted_4, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
49
|
+
]);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
_sfc_main as default
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=JfText.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfText.vue.js","sources":["../../../src/vue/primevue/JfText.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ControlElement } from \"@jsonforms/core\";\nimport { rendererProps, useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed } from \"vue\";\nimport InputText from \"primevue/inputtext\";\n\ndefineOptions({ name: \"JfText\" });\n\nconst props = defineProps(rendererProps<ControlElement>());\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\nfunction onInput(val: string | undefined) {\n const newValue = val ?? \"\";\n if ((control.value.data ?? \"\") !== newValue) {\n handleChange(control.value.path, newValue);\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 <InputText\n class=\"w-full\"\n :model-value=\"control.data ?? ''\"\n :disabled=\"!control.enabled\"\n :aria-invalid=\"!!control.errors || undefined\"\n :placeholder=\"placeholder\"\n autocapitalize=\"off\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n @update:model-value=\"onInput\"\n />\n <small v-if=\"control.errors\" class=\"p-error\">{{ control.errors }}</small>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_unref","_toDisplayString","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,UAAM,QAAQ;AACd,UAAM,EAAE,SAAS,iBAAiB,oBAAoB,KAAK;AAE3D,UAAM,cAAc;AAAA,MAClB,MACG,QAAQ,MAAM,UAAqD,SAChE,eAAe,QAAQ,MAAM;AAAA,IAAA;AAGrC,aAAS,QAAQ,KAAyB;AACxC,YAAM,WAAW,OAAO;AACxB,WAAK,QAAQ,MAAM,QAAQ,QAAQ,UAAU;AAC3C,qBAAa,QAAQ,MAAM,MAAM,QAAQ;AAAA,MAC3C;AAAA,IACF;;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,SAAA,GAAA;AAAA,UATA,OAAM;AAAA,UACL,eAAaA,MAAA,OAAA,EAAQ,QAAI;AAAA,UACzB,UAAQ,CAAGA,MAAA,OAAA,EAAQ;AAAA,UACnB,gBAAY,CAAA,CAAIA,MAAA,OAAA,EAAQ,UAAU;AAAA,UAClC,aAAa,YAAA;AAAA,UACd,gBAAe;AAAA,UACf,cAAa;AAAA,UACb,YAAW;AAAA,UACV,uBAAoB;AAAA,QAAA;QAEVA,MAAA,OAAA,EAAQ,UAArBF,UAAA,GAAAC,mBAAyE,SAAzE,YAAyEE,gBAAzBD,MAAA,OAAA,EAAQ,MAAM,GAAA,CAAA;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfText.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ControlElement } from "@jsonforms/core";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
schema: {
|
|
4
|
+
required: true;
|
|
5
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonSchema>;
|
|
6
|
+
};
|
|
7
|
+
uischema: {
|
|
8
|
+
required: true;
|
|
9
|
+
type: import("vue").PropType<ControlElement>;
|
|
10
|
+
};
|
|
11
|
+
path: {
|
|
12
|
+
required: true;
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
};
|
|
15
|
+
enabled: {
|
|
16
|
+
required: false;
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
renderers: {
|
|
21
|
+
required: boolean;
|
|
22
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonFormsRendererRegistryEntry[]>;
|
|
23
|
+
default: undefined;
|
|
24
|
+
};
|
|
25
|
+
cells: {
|
|
26
|
+
required: boolean;
|
|
27
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[]>;
|
|
28
|
+
default: undefined;
|
|
29
|
+
};
|
|
30
|
+
config: {
|
|
31
|
+
required: boolean;
|
|
32
|
+
type: ObjectConstructor;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
36
|
+
schema: {
|
|
37
|
+
required: true;
|
|
38
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonSchema>;
|
|
39
|
+
};
|
|
40
|
+
uischema: {
|
|
41
|
+
required: true;
|
|
42
|
+
type: import("vue").PropType<ControlElement>;
|
|
43
|
+
};
|
|
44
|
+
path: {
|
|
45
|
+
required: true;
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
};
|
|
48
|
+
enabled: {
|
|
49
|
+
required: false;
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
default: undefined;
|
|
52
|
+
};
|
|
53
|
+
renderers: {
|
|
54
|
+
required: boolean;
|
|
55
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonFormsRendererRegistryEntry[]>;
|
|
56
|
+
default: undefined;
|
|
57
|
+
};
|
|
58
|
+
cells: {
|
|
59
|
+
required: boolean;
|
|
60
|
+
type: import("vue").PropType<import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[]>;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
config: {
|
|
64
|
+
required: boolean;
|
|
65
|
+
type: ObjectConstructor;
|
|
66
|
+
default: undefined;
|
|
67
|
+
};
|
|
68
|
+
}>> & Readonly<{}>, {
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
renderers: import("@jsonforms/core").JsonFormsRendererRegistryEntry[];
|
|
71
|
+
cells: import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[];
|
|
72
|
+
config: Record<string, any>;
|
|
73
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
|
+
export default _default;
|
|
75
|
+
//# sourceMappingURL=JfTextArea.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfTextArea.vue"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiItD,wBAEG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
2
|
+
import { rendererProps, useJsonFormsControl } from "@jsonforms/vue";
|
|
3
|
+
import Textarea from "primevue/textarea";
|
|
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: "JfTextArea" },
|
|
19
|
+
__name: "JfTextArea",
|
|
20
|
+
props: rendererProps(),
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const { control, handleChange } = useJsonFormsControl(props);
|
|
24
|
+
const placeholder = computed(
|
|
25
|
+
() => control.value.uischema?.options?.placeholder ?? control.value.description
|
|
26
|
+
);
|
|
27
|
+
function onInput(val) {
|
|
28
|
+
const newValue = val ?? "";
|
|
29
|
+
if ((control.value.data ?? "") !== newValue) {
|
|
30
|
+
handleChange(control.value.path, newValue);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
35
|
+
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
36
|
+
unref(control).description ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(control).description), 1)) : createCommentVNode("", true),
|
|
37
|
+
createVNode(unref(Textarea), {
|
|
38
|
+
class: "w-full",
|
|
39
|
+
"model-value": unref(control).data ?? "",
|
|
40
|
+
disabled: !unref(control).enabled,
|
|
41
|
+
"aria-invalid": !!unref(control).errors || void 0,
|
|
42
|
+
placeholder: placeholder.value,
|
|
43
|
+
rows: 4,
|
|
44
|
+
"auto-resize": true,
|
|
45
|
+
"onUpdate:modelValue": onInput
|
|
46
|
+
}, null, 8, ["model-value", "disabled", "aria-invalid", "placeholder"]),
|
|
47
|
+
unref(control).errors ? (openBlock(), createElementBlock("small", _hoisted_4, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
48
|
+
]);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
_sfc_main as default
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=JfTextArea.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfTextArea.vue.js","sources":["../../../src/vue/primevue/JfTextArea.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ControlElement } from \"@jsonforms/core\";\nimport { rendererProps, useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed } from \"vue\";\nimport Textarea from \"primevue/textarea\";\n\ndefineOptions({ name: \"JfTextArea\" });\n\nconst props = defineProps(rendererProps<ControlElement>());\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\nfunction onInput(val: string | undefined) {\n const newValue = val ?? \"\";\n if ((control.value.data ?? \"\") !== newValue) {\n handleChange(control.value.path, newValue);\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 <Textarea\n class=\"w-full\"\n :model-value=\"control.data ?? ''\"\n :disabled=\"!control.enabled\"\n :aria-invalid=\"!!control.errors || undefined\"\n :placeholder=\"placeholder\"\n :rows=\"4\"\n :auto-resize=\"true\"\n @update:model-value=\"onInput\"\n />\n <small v-if=\"control.errors\" class=\"p-error\">{{ control.errors }}</small>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_unref","_toDisplayString","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,UAAM,QAAQ;AACd,UAAM,EAAE,SAAS,iBAAiB,oBAAoB,KAAK;AAE3D,UAAM,cAAc;AAAA,MAClB,MACG,QAAQ,MAAM,UAAqD,SAChE,eAAe,QAAQ,MAAM;AAAA,IAAA;AAGrC,aAAS,QAAQ,KAAyB;AACxC,YAAM,WAAW,OAAO;AACxB,WAAK,QAAQ,MAAM,QAAQ,QAAQ,UAAU;AAC3C,qBAAa,QAAQ,MAAM,MAAM,QAAQ;AAAA,MAC3C;AAAA,IACF;;AAIE,aAAAA,UAAA,GAAAC,mBAkBM,OAlBN,YAkBM;AAAA,QAjBSC,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,YASEF,MAAA,QAAA,GAAA;AAAA,UARA,OAAM;AAAA,UACL,eAAaA,MAAA,OAAA,EAAQ,QAAI;AAAA,UACzB,UAAQ,CAAGA,MAAA,OAAA,EAAQ;AAAA,UACnB,gBAAY,CAAA,CAAIA,MAAA,OAAA,EAAQ,UAAU;AAAA,UAClC,aAAa,YAAA;AAAA,UACb,MAAM;AAAA,UACN,eAAa;AAAA,UACb,uBAAoB;AAAA,QAAA;QAEVA,MAAA,OAAA,EAAQ,UAArBF,UAAA,GAAAC,mBAAyE,SAAzE,YAAyEE,gBAAzBD,MAAA,OAAA,EAAQ,MAAM,GAAA,CAAA;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfTextArea.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import JfText from "./JfText.vue";
|
|
2
|
+
import JfTextArea from "./JfTextArea.vue";
|
|
3
|
+
import JfNumber from "./JfNumber.vue";
|
|
4
|
+
import JfEnum from "./JfEnum.vue";
|
|
5
|
+
import JfEnumArray from "./JfEnumArray.vue";
|
|
6
|
+
import JfBoolean from "./JfBoolean.vue";
|
|
7
|
+
export declare const primevueRenderers: {
|
|
8
|
+
tester: (uischema: import("@jsonforms/core").UISchemaElement, schema: import("@jsonforms/core").JsonSchema, context: import("@jsonforms/core").TesterContext) => number;
|
|
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
|
+
}[];
|
|
82
|
+
export { JfText, JfTextArea, JfNumber, JfEnum, JfEnumArray, JfBoolean };
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AA0ExC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiB7B,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _sfc_main$1 from "./JfText.vue.js";
|
|
2
|
+
import _sfc_main from "./JfTextArea.vue.js";
|
|
3
|
+
import _sfc_main$2 from "./JfNumber.vue.js";
|
|
4
|
+
import JfEnum from "./JfEnum.vue.js";
|
|
5
|
+
import _sfc_main$3 from "./JfEnumArray.vue.js";
|
|
6
|
+
import _sfc_main$4 from "./JfBoolean.vue.js";
|
|
7
|
+
import { rankWith, isStringControl, or, isNumberControl, isIntegerControl, and, isControl, schemaMatches, isBooleanControl } from "@jsonforms/core";
|
|
8
|
+
const injectLayoutStyles = () => {
|
|
9
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
10
|
+
if (!document.getElementById("jsonforms-primevue-styles")) {
|
|
11
|
+
const style = document.createElement("style");
|
|
12
|
+
style.id = "jsonforms-primevue-styles";
|
|
13
|
+
style.textContent = `
|
|
14
|
+
/* JSONForms PrimeVue Provider Protocols Layout Styles */
|
|
15
|
+
.vertical-layout {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: flex-start;
|
|
19
|
+
gap: 1rem;
|
|
20
|
+
width: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.vertical-layout-item {
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
document.head.appendChild(style);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
injectLayoutStyles();
|
|
32
|
+
const isScalarEnum = (s) => {
|
|
33
|
+
const schema = s;
|
|
34
|
+
return schema && schema.type !== "array" && (Array.isArray(schema.enum) || Array.isArray(schema.oneOf));
|
|
35
|
+
};
|
|
36
|
+
const isEnumArray = (s) => {
|
|
37
|
+
const schema = s;
|
|
38
|
+
return schema?.type === "array" && (Array.isArray(schema.items?.enum) || Array.isArray(schema.items?.oneOf));
|
|
39
|
+
};
|
|
40
|
+
const isMultilineString = (uischema, schema) => {
|
|
41
|
+
return isStringControl(uischema, schema, {}) && uischema?.options?.multi === true;
|
|
42
|
+
};
|
|
43
|
+
const PRIME = 100;
|
|
44
|
+
const primevueRenderers = [
|
|
45
|
+
// Multiline text has higher priority than regular text
|
|
46
|
+
{ tester: rankWith(PRIME + 4, isMultilineString), renderer: _sfc_main },
|
|
47
|
+
{ tester: rankWith(PRIME + 3, isStringControl), renderer: _sfc_main$1 },
|
|
48
|
+
{
|
|
49
|
+
tester: rankWith(PRIME + 4, or(isNumberControl, isIntegerControl)),
|
|
50
|
+
renderer: _sfc_main$2
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
tester: rankWith(PRIME + 5, and(isControl, schemaMatches(isScalarEnum))),
|
|
54
|
+
renderer: JfEnum
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
tester: rankWith(PRIME + 6, and(isControl, schemaMatches(isEnumArray))),
|
|
58
|
+
renderer: _sfc_main$3
|
|
59
|
+
},
|
|
60
|
+
{ tester: rankWith(PRIME + 3, isBooleanControl), renderer: _sfc_main$4 }
|
|
61
|
+
];
|
|
62
|
+
export {
|
|
63
|
+
_sfc_main$4 as JfBoolean,
|
|
64
|
+
JfEnum,
|
|
65
|
+
_sfc_main$3 as JfEnumArray,
|
|
66
|
+
_sfc_main$2 as JfNumber,
|
|
67
|
+
_sfc_main$1 as JfText,
|
|
68
|
+
_sfc_main as JfTextArea,
|
|
69
|
+
primevueRenderers
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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 {\n rankWith,\n isStringControl,\n or,\n isNumberControl,\n isIntegerControl,\n and,\n isControl,\n schemaMatches,\n isBooleanControl,\n} 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// helper for multiline detection\nconst isMultilineString = (uischema: unknown, schema: unknown) => {\n return (\n isStringControl(uischema as never, schema as never, {} as never) &&\n (uischema as { options?: { multi?: boolean } })?.options?.multi === true\n );\n};\n\n// Give PrimeVue renderers a high base rank; vanilla commonly uses small ranks (2–5)\nconst PRIME = 100;\n\nexport const primevueRenderers = [\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\nexport { JfText, JfTextArea, JfNumber, JfEnum, JfEnumArray, JfBoolean };\n"],"names":["JfTextArea","JfText","JfNumber","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;AAeA,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,oBAAoB,CAAC,UAAmB,WAAoB;AAChE,SACE,gBAAgB,UAAmB,QAAiB,CAAA,CAAW,KAC9D,UAAgD,SAAS,UAAU;AAExE;AAGA,MAAM,QAAQ;AAEP,MAAM,oBAAoB;AAAA;AAAA,EAE/B,EAAE,QAAQ,SAAS,QAAQ,GAAG,iBAAiB,GAAG,UAAUA,UAAA;AAAA,EAC5D,EAAE,QAAQ,SAAS,QAAQ,GAAG,eAAe,GAAG,UAAUC,YAAA;AAAA,EAC1D;AAAA,IACE,QAAQ,SAAS,QAAQ,GAAG,GAAG,iBAAiB,gBAAgB,CAAC;AAAA,IACjE,UAAUC;AAAAA,EAAA;AAAA,EAEZ;AAAA,IACE,QAAQ,SAAS,QAAQ,GAAG,IAAI,WAAW,cAAc,YAAY,CAAC,CAAC;AAAA,IACvE,UAAU;AAAA,EAAA;AAAA,EAEZ;AAAA,IACE,QAAQ,SAAS,QAAQ,GAAG,IAAI,WAAW,cAAc,WAAW,CAAC,CAAC;AAAA,IACtE,UAAUC;AAAAA,EAAA;AAAA,EAEZ,EAAE,QAAQ,SAAS,QAAQ,GAAG,gBAAgB,GAAG,UAAUC,YAAA;AAC7D;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narrative.io/jsonforms-provider-protocols",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-beta.1",
|
|
4
4
|
"description": "Dynamic data provider capabilities for JSONForms with Vue 3 integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Narrative I/O",
|
|
@@ -64,7 +64,11 @@
|
|
|
64
64
|
"test:watch": "bun test --watch",
|
|
65
65
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
|
|
66
66
|
"lint:check": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts",
|
|
67
|
-
"format": "prettier --write src/"
|
|
67
|
+
"format": "prettier --write src/",
|
|
68
|
+
"demo": "cd demo && npm start",
|
|
69
|
+
"demo:install": "cd demo && npm install",
|
|
70
|
+
"demo:dev": "cd demo && npm run dev",
|
|
71
|
+
"demo:api": "cd demo && npm run api"
|
|
68
72
|
},
|
|
69
73
|
"devDependencies": {
|
|
70
74
|
"@commitlint/config-conventional": "^19.8.1",
|
|
@@ -83,6 +87,7 @@
|
|
|
83
87
|
"eslint-plugin-vue": "^10.4.0",
|
|
84
88
|
"globals": "^16.3.0",
|
|
85
89
|
"prettier": "^3.6.2",
|
|
90
|
+
"primevue": "^4.3.8",
|
|
86
91
|
"typescript": "^5.9.2",
|
|
87
92
|
"typescript-eslint": "^8.41.0",
|
|
88
93
|
"vite": "^7.1.3",
|
|
@@ -83,7 +83,14 @@ export const RestApiProtocol = (): Protocol<RestApiCfg> => ({
|
|
|
83
83
|
let cursor: unknown = null;
|
|
84
84
|
let page = 0;
|
|
85
85
|
do {
|
|
86
|
-
const
|
|
86
|
+
const renderedUrl = renderTpl(cfg.url, { data: ctx.data, ui: ctx.ui });
|
|
87
|
+
|
|
88
|
+
// Check if URL has unresolved template variables (empty string after template rendering)
|
|
89
|
+
if (cfg.url.includes("{{") && renderedUrl.endsWith("/")) {
|
|
90
|
+
return { items: [], ttl: 0 };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const url = new URL(renderedUrl);
|
|
87
94
|
const q = renderObj(cfg.query ?? {}, {
|
|
88
95
|
data: ctx.data,
|
|
89
96
|
ui: ctx.ui,
|