@narrative.io/jsonforms-provider-protocols 1.0.3 → 1.1.0-beta.0
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 +6 -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/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 +2 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +18 -2
- 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/ProviderSelect.vue +40 -21
- package/src/vue/composables/useProvider.ts +3 -2
- package/src/vue/index.ts +7 -2
- 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,75 @@
|
|
|
1
|
+
import type { ControlElement, JsonSchema } from "@jsonforms/core";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
schema: {
|
|
4
|
+
required: true;
|
|
5
|
+
type: import("vue").PropType<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<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=JfEnum.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfEnum.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnum.vue"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuJlE,wBAEG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./JfEnum.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const JfEnum = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ea538214"]]);
|
|
5
|
+
export {
|
|
6
|
+
JfEnum as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=JfEnum.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfEnum.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
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
|
+
});
|
|
62
|
+
export {
|
|
63
|
+
_sfc_main as default
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=JfEnum.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfEnum.vue2.js","sources":["../../../src/vue/primevue/JfEnum.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ControlElement, JsonSchema } from \"@jsonforms/core\";\nimport { rendererProps, useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed } from \"vue\";\nimport Dropdown from \"primevue/dropdown\";\n\ndefineOptions({ name: \"JfEnum\" });\n\nconst props = defineProps(rendererProps<ControlElement>());\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\nconst placeholder = computed<string | undefined>(\n () =>\n (control.value.uischema as { options?: { placeholder?: string } })?.options\n ?.placeholder ?? control.value.description,\n);\n\nconst options = computed(() => toOptions(control.value.schema));\nconst onSelect = (val: unknown) => handleChange(control.value.path, val);\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\"\n :aria-invalid=\"!!control.errors || undefined\"\n :show-clear=\"true\"\n @update:model-value=\"onSelect\"\n />\n <small v-if=\"control.errors\" class=\"p-error\">{{ control.errors }}</small>\n </div>\n</template>\n\n<style scoped>\n:deep(.p-dropdown-label) {\n text-align: left;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_unref","_toDisplayString","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,UAAM,QAAQ;AACd,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,SAAS,OAAO,EAAE,KAAK;AAAA,UAChC,OAAO,EAAE;AAAA,QAAA,EACT;AACJ,aAAO,CAAA;AAAA,IACT;AAEA,UAAM,cAAc;AAAA,MAClB,MACG,QAAQ,MAAM,UAAqD,SAChE,eAAe,QAAQ,MAAM;AAAA,IAAA;AAGrC,UAAM,UAAU,SAAS,MAAM,UAAU,QAAQ,MAAM,MAAM,CAAC;AAC9D,UAAM,WAAW,CAAC,QAAiB,aAAa,QAAQ,MAAM,MAAM,GAAG;;AAIrE,aAAAA,UAAA,GAAAC,mBAoBM,OApBN,YAoBM;AAAA,QAnBSC,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,YAWEF,MAAA,QAAA,GAAA;AAAA,UAVA,OAAM;AAAA,UACL,SAAS,QAAA;AAAA,UACV,gBAAa;AAAA,UACb,gBAAa;AAAA,UACZ,eAAaA,MAAA,OAAA,EAAQ,QAAI;AAAA,UACzB,aAAa,YAAA;AAAA,UACb,UAAQ,CAAGA,MAAA,OAAA,EAAQ;AAAA,UACnB,gBAAY,CAAA,CAAIA,MAAA,OAAA,EAAQ,UAAU;AAAA,UAClC,cAAY;AAAA,UACZ,uBAAoB;AAAA,QAAA;QAEVA,MAAA,OAAA,EAAQ,UAArBF,UAAA,GAAAC,mBAAyE,SAAzE,YAAyEE,gBAAzBD,MAAA,OAAA,EAAQ,MAAM,GAAA,CAAA;;;;;"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ControlElement, JsonSchema } from "@jsonforms/core";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
schema: {
|
|
4
|
+
required: true;
|
|
5
|
+
type: import("vue").PropType<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<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=JfEnumArray.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfEnumArray.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnumArray.vue"],"names":[],"mappings":"AAuFA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmKlE,wBAEG"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
2
|
+
import { rendererProps, useJsonFormsControl } from "@jsonforms/vue";
|
|
3
|
+
import MultiSelect from "primevue/multiselect";
|
|
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: "JfEnumArray" },
|
|
19
|
+
__name: "JfEnumArray",
|
|
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 options = computed(
|
|
37
|
+
() => toOptions(control.value.schema?.items)
|
|
38
|
+
);
|
|
39
|
+
const placeholder = computed(
|
|
40
|
+
() => control.value.uischema?.options?.placeholder ?? control.value.description
|
|
41
|
+
);
|
|
42
|
+
const sameSet = (a, b) => {
|
|
43
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length)
|
|
44
|
+
return false;
|
|
45
|
+
const s = new Set(b);
|
|
46
|
+
return a.every((v) => s.has(v));
|
|
47
|
+
};
|
|
48
|
+
const model = computed({
|
|
49
|
+
get() {
|
|
50
|
+
const curr = Array.isArray(control.value.data) ? control.value.data : [];
|
|
51
|
+
return [...curr];
|
|
52
|
+
},
|
|
53
|
+
set(val) {
|
|
54
|
+
const next = Array.isArray(val) ? [...val] : [];
|
|
55
|
+
const curr = Array.isArray(control.value.data) ? control.value.data : [];
|
|
56
|
+
if (!sameSet(curr, next)) handleChange(control.value.path, next);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return (_ctx, _cache) => {
|
|
60
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
61
|
+
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
62
|
+
unref(control).description ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(control).description), 1)) : createCommentVNode("", true),
|
|
63
|
+
createVNode(unref(MultiSelect), {
|
|
64
|
+
modelValue: model.value,
|
|
65
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
66
|
+
class: "w-full",
|
|
67
|
+
options: options.value,
|
|
68
|
+
"option-label": "label",
|
|
69
|
+
"option-value": "value",
|
|
70
|
+
"data-key": "value",
|
|
71
|
+
display: "chip",
|
|
72
|
+
disabled: !unref(control).enabled,
|
|
73
|
+
"aria-invalid": !!unref(control).errors || void 0,
|
|
74
|
+
placeholder: placeholder.value
|
|
75
|
+
}, null, 8, ["modelValue", "options", "disabled", "aria-invalid", "placeholder"]),
|
|
76
|
+
unref(control).errors ? (openBlock(), createElementBlock("small", _hoisted_4, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
77
|
+
]);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
export {
|
|
82
|
+
_sfc_main as default
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=JfEnumArray.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfEnumArray.vue.js","sources":["../../../src/vue/primevue/JfEnumArray.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ControlElement, JsonSchema } from \"@jsonforms/core\";\nimport { rendererProps, useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed } from \"vue\";\nimport MultiSelect from \"primevue/multiselect\";\n\ndefineOptions({ name: \"JfEnumArray\" });\n\nconst props = defineProps(rendererProps<ControlElement>());\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\nconst options = computed(() =>\n toOptions((control.value.schema as { items?: JsonSchema })?.items),\n);\nconst placeholder = computed<string | undefined>(\n () =>\n (control.value.uischema as { options?: { placeholder?: string } })?.options\n ?.placeholder ?? control.value.description,\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\"\n :aria-invalid=\"!!control.errors || undefined\"\n :placeholder=\"placeholder\"\n />\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;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,SAAS,OAAO,EAAE,KAAK;AAAA,UAChC,OAAO,EAAE;AAAA,QAAA,EACT;AACJ,aAAO,CAAA;AAAA,IACT;AAEA,UAAM,UAAU;AAAA,MAAS,MACvB,UAAW,QAAQ,MAAM,QAAmC,KAAK;AAAA,IAAA;AAEnE,UAAM,cAAc;AAAA,MAClB,MACG,QAAQ,MAAM,UAAqD,SAChE,eAAe,QAAQ,MAAM;AAAA,IAAA;AAIrC,UAAM,UAAU,CAAC,GAAc,MAAiB;AAC9C,UAAI,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE;AAC3D,eAAO;AACT,YAAM,IAAI,IAAI,IAAI,CAAC;AACnB,aAAO,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAAA,IAChC;AAGA,UAAM,QAAQ,SAAoB;AAAA,MAChC,MAAM;AACJ,cAAM,OAAO,MAAM,QAAQ,QAAQ,MAAM,IAAI,IAAI,QAAQ,MAAM,OAAO,CAAA;AAEtE,eAAO,CAAC,GAAG,IAAI;AAAA,MACjB;AAAA,MACA,IAAI,KAAK;AACP,cAAM,OAAO,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAA;AAC7C,cAAM,OAAO,MAAM,QAAQ,QAAQ,MAAM,IAAI,IAAI,QAAQ,MAAM,OAAO,CAAA;AACtE,YAAI,CAAC,QAAQ,MAAM,IAAI,EAAG,cAAa,QAAQ,MAAM,MAAM,IAAI;AAAA,MACjE;AAAA,IAAA,CACD;;AAIC,aAAAA,UAAA,GAAAC,mBAsBM,OAtBN,YAsBM;AAAA,QArBSC,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;QAGxBE,YAWEF,MAAA,WAAA,GAAA;AAAA,sBAVS,MAAA;AAAA,uEAAA,MAAK,QAAA;AAAA,UACd,OAAM;AAAA,UACL,SAAS,QAAA;AAAA,UACV,gBAAa;AAAA,UACb,gBAAa;AAAA,UACb,YAAS;AAAA,UACT,SAAQ;AAAA,UACP,UAAQ,CAAGA,MAAA,OAAA,EAAQ;AAAA,UACnB,gBAAY,CAAA,CAAIA,MAAA,OAAA,EAAQ,UAAU;AAAA,UAClC,aAAa,YAAA;AAAA,QAAA;QAGHA,MAAA,OAAA,EAAQ,UAArBF,UAAA,GAAAC,mBAAyE,SAAzE,YAAyEE,gBAAzBD,MAAA,OAAA,EAAQ,MAAM,GAAA,CAAA;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfEnumArray.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=JfNumber.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JfNumber.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfNumber.vue"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HtD,wBAEG"}
|
|
@@ -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":";"}
|