@narrative.io/jsonforms-provider-protocols 2.10.0 → 3.0.0-beta.2
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 +166 -30
- package/dist/core/projection.d.ts +32 -0
- package/dist/core/projection.d.ts.map +1 -0
- package/dist/core/projection.js +74 -0
- package/dist/core/projection.js.map +1 -0
- package/dist/core/resolveScope.d.ts +11 -0
- package/dist/core/resolveScope.d.ts.map +1 -0
- package/dist/core/resolveScope.js +22 -0
- package/dist/core/resolveScope.js.map +1 -0
- package/dist/core/transforms.d.ts +8 -10
- package/dist/core/transforms.d.ts.map +1 -1
- package/dist/core/transforms.js +56 -13
- package/dist/core/transforms.js.map +1 -1
- package/dist/core/types.d.ts +7 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonforms-provider-protocols.css +2 -2
- package/dist/vue/components/ProviderAutocomplete.vue.d.ts.map +1 -1
- package/dist/vue/components/ProviderAutocomplete.vue.js +4 -2
- package/dist/vue/components/ProviderAutocomplete.vue.js.map +1 -1
- package/dist/vue/components/ProviderMultiSelect.vue.d.ts.map +1 -1
- package/dist/vue/components/ProviderMultiSelect.vue.js +1 -1
- package/dist/vue/components/ProviderMultiSelect.vue2.js +6 -4
- package/dist/vue/components/ProviderMultiSelect.vue2.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 +5 -3
- package/dist/vue/components/ProviderSelect.vue2.js.map +1 -1
- package/dist/vue/composables/useDataLayer.d.ts +9 -0
- package/dist/vue/composables/useDataLayer.d.ts.map +1 -0
- package/dist/vue/composables/useDataLayer.js +25 -0
- package/dist/vue/composables/useDataLayer.js.map +1 -0
- package/dist/vue/composables/useDerive.d.ts +5 -2
- package/dist/vue/composables/useDerive.d.ts.map +1 -1
- package/dist/vue/composables/useDerive.js +12 -12
- package/dist/vue/composables/useDerive.js.map +1 -1
- package/dist/vue/composables/useDirtyValidation.d.ts +9 -0
- package/dist/vue/composables/useDirtyValidation.d.ts.map +1 -0
- package/dist/vue/composables/useDirtyValidation.js +15 -0
- package/dist/vue/composables/useDirtyValidation.js.map +1 -0
- package/dist/vue/composables/useProjection.d.ts +35 -0
- package/dist/vue/composables/useProjection.d.ts.map +1 -0
- package/dist/vue/composables/useProjection.js +33 -0
- package/dist/vue/composables/useProjection.js.map +1 -0
- package/dist/vue/index.d.ts +5 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +17 -29
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/primevue/JfBoolean.vue.d.ts +9 -0
- package/dist/vue/primevue/JfBoolean.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfBoolean.vue.js +21 -10
- package/dist/vue/primevue/JfBoolean.vue.js.map +1 -1
- package/dist/vue/primevue/JfEnum.vue.d.ts +9 -0
- package/dist/vue/primevue/JfEnum.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfEnum.vue.js +20 -18
- package/dist/vue/primevue/JfEnum.vue.js.map +1 -1
- package/dist/vue/primevue/JfEnumArray.vue.d.ts +9 -0
- package/dist/vue/primevue/JfEnumArray.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfEnumArray.vue.js +24 -14
- package/dist/vue/primevue/JfEnumArray.vue.js.map +1 -1
- package/dist/vue/primevue/JfNumber.vue.d.ts +9 -0
- package/dist/vue/primevue/JfNumber.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfNumber.vue.js +20 -18
- package/dist/vue/primevue/JfNumber.vue.js.map +1 -1
- package/dist/vue/primevue/JfText.vue.d.ts +9 -0
- package/dist/vue/primevue/JfText.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfText.vue.js +29 -28
- package/dist/vue/primevue/JfText.vue.js.map +1 -1
- package/dist/vue/primevue/JfTextArea.vue.d.ts +9 -0
- package/dist/vue/primevue/JfTextArea.vue.d.ts.map +1 -1
- package/dist/vue/primevue/JfTextArea.vue.js +23 -14
- package/dist/vue/primevue/JfTextArea.vue.js.map +1 -1
- package/dist/vue/primevue/index.d.ts.map +1 -1
- package/dist/vue/primevue/index.js +22 -7
- package/dist/vue/primevue/index.js.map +1 -1
- package/package.json +7 -3
- package/src/core/projection.ts +136 -0
- package/src/core/resolveScope.ts +39 -0
- package/src/core/transforms.ts +91 -26
- package/src/core/types.ts +8 -0
- package/src/index.ts +7 -0
- package/src/vue/components/ProviderAutocomplete.vue +4 -2
- package/src/vue/components/ProviderMultiSelect.vue +6 -4
- package/src/vue/components/ProviderSelect.vue +5 -3
- package/src/vue/composables/useDataLayer.ts +43 -0
- package/src/vue/composables/useDerive.ts +19 -16
- package/src/vue/composables/useDirtyValidation.ts +15 -0
- package/src/vue/composables/useProjection.ts +74 -0
- package/src/vue/index.ts +21 -46
- package/src/vue/primevue/JfBoolean.vue +18 -5
- package/src/vue/primevue/JfEnum.vue +16 -16
- package/src/vue/primevue/JfEnumArray.vue +21 -9
- package/src/vue/primevue/JfNumber.vue +16 -16
- package/src/vue/primevue/JfText.vue +22 -22
- package/src/vue/primevue/JfTextArea.vue +20 -11
- package/src/vue/primevue/index.ts +32 -7
package/dist/vue/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { rankWith, and, or, isStringControl, isNumberControl, isControl } from "@jsonforms/core";
|
|
2
|
+
import { resolveScopeSchema } from "../core/resolveScope.js";
|
|
2
3
|
import _sfc_main from "./components/ProviderAutocomplete.vue.js";
|
|
3
4
|
import ProviderSelect from "./components/ProviderSelect.vue.js";
|
|
4
5
|
import ProviderMultiSelect from "./components/ProviderMultiSelect.vue.js";
|
|
5
6
|
import { primevueRenderers, registerPrimevueRenderers } from "./primevue/index.js";
|
|
6
7
|
import { useProvider } from "./composables/useProvider.js";
|
|
8
|
+
import { useProjection } from "./composables/useProjection.js";
|
|
9
|
+
import { createDataLayer, useDataLayer } from "./composables/useDataLayer.js";
|
|
10
|
+
import { useDirtyValidation } from "./composables/useDirtyValidation.js";
|
|
7
11
|
import { providerTester } from "./testers.js";
|
|
8
12
|
import { default as default2 } from "./primevue/JfText.vue.js";
|
|
9
13
|
import { default as default3 } from "./primevue/JfTextArea.vue.js";
|
|
@@ -14,23 +18,17 @@ import { default as default7 } from "./primevue/JfBoolean.vue.js";
|
|
|
14
18
|
const hasProvider = (uischema) => {
|
|
15
19
|
return uischema?.options?.provider !== void 0;
|
|
16
20
|
};
|
|
21
|
+
const isIntegerScope = (uischema, schema) => {
|
|
22
|
+
const ui = uischema;
|
|
23
|
+
if (ui?.type !== "Control" || !ui?.scope) return false;
|
|
24
|
+
const propertySchema = resolveScopeSchema(ui.scope, schema);
|
|
25
|
+
return propertySchema?.type === "integer";
|
|
26
|
+
};
|
|
17
27
|
const providerSelectTester = rankWith(
|
|
18
28
|
106,
|
|
19
29
|
// Higher than PrimeVue base (100) to ensure providers take precedence
|
|
20
30
|
and(
|
|
21
|
-
or(
|
|
22
|
-
isStringControl,
|
|
23
|
-
isNumberControl,
|
|
24
|
-
and(isControl, (uischema, schema) => {
|
|
25
|
-
const ui = uischema;
|
|
26
|
-
const rootSchema = schema;
|
|
27
|
-
if (ui?.type !== "Control" || !ui?.scope || !rootSchema?.properties)
|
|
28
|
-
return false;
|
|
29
|
-
const propertyName = ui.scope.replace("#/properties/", "");
|
|
30
|
-
const propertySchema = rootSchema.properties[propertyName];
|
|
31
|
-
return propertySchema?.type === "integer";
|
|
32
|
-
})
|
|
33
|
-
),
|
|
31
|
+
or(isStringControl, isNumberControl, and(isControl, isIntegerScope)),
|
|
34
32
|
hasProvider,
|
|
35
33
|
(uischema) => !uischema?.options?.autocomplete
|
|
36
34
|
)
|
|
@@ -39,19 +37,7 @@ const providerAutocompleteTester = rankWith(
|
|
|
39
37
|
107,
|
|
40
38
|
// Higher than PrimeVue base (100) to ensure providers take precedence
|
|
41
39
|
and(
|
|
42
|
-
or(
|
|
43
|
-
isStringControl,
|
|
44
|
-
isNumberControl,
|
|
45
|
-
and(isControl, (uischema, schema) => {
|
|
46
|
-
const ui = uischema;
|
|
47
|
-
const rootSchema = schema;
|
|
48
|
-
if (ui?.type !== "Control" || !ui?.scope || !rootSchema?.properties)
|
|
49
|
-
return false;
|
|
50
|
-
const propertyName = ui.scope.replace("#/properties/", "");
|
|
51
|
-
const propertySchema = rootSchema.properties[propertyName];
|
|
52
|
-
return propertySchema?.type === "integer";
|
|
53
|
-
})
|
|
54
|
-
),
|
|
40
|
+
or(isStringControl, isNumberControl, and(isControl, isIntegerScope)),
|
|
55
41
|
hasProvider,
|
|
56
42
|
(uischema) => uischema?.options?.autocomplete === true
|
|
57
43
|
)
|
|
@@ -61,9 +47,7 @@ const isArrayControl = (uischema, schema) => {
|
|
|
61
47
|
if (controlSchema.type !== "Control" || !controlSchema.scope) {
|
|
62
48
|
return false;
|
|
63
49
|
}
|
|
64
|
-
const
|
|
65
|
-
const propertyPath = controlSchema.scope.replace("#/properties/", "");
|
|
66
|
-
const propertySchema = rootSchema?.properties?.[propertyPath];
|
|
50
|
+
const propertySchema = resolveScopeSchema(controlSchema.scope, schema);
|
|
67
51
|
return propertySchema?.type === "array";
|
|
68
52
|
};
|
|
69
53
|
const providerMultiSelectTester = rankWith(
|
|
@@ -86,10 +70,14 @@ export {
|
|
|
86
70
|
_sfc_main as ProviderAutocomplete,
|
|
87
71
|
ProviderMultiSelect,
|
|
88
72
|
ProviderSelect,
|
|
73
|
+
createDataLayer,
|
|
89
74
|
primevueRenderers,
|
|
90
75
|
providerRenderers,
|
|
91
76
|
providerTester,
|
|
92
77
|
registerPrimevueRenderers,
|
|
78
|
+
useDataLayer,
|
|
79
|
+
useDirtyValidation,
|
|
80
|
+
useProjection,
|
|
93
81
|
useProvider
|
|
94
82
|
};
|
|
95
83
|
//# sourceMappingURL=index.js.map
|
package/dist/vue/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/vue/index.ts"],"sourcesContent":["import type { UISchemaElement } from \"@jsonforms/core\";\nimport {\n and,\n isNumberControl,\n isStringControl,\n or,\n rankWith,\n isControl,\n} from \"@jsonforms/core\";\nimport ProviderAutocomplete from \"./components/ProviderAutocomplete.vue\";\nimport ProviderSelect from \"./components/ProviderSelect.vue\";\nimport ProviderMultiSelect from \"./components/ProviderMultiSelect.vue\";\n\n// Custom tester that checks if provider option exists (as object or boolean)\nconst hasProvider = (uischema: UISchemaElement) => {\n return uischema?.options?.provider !== undefined;\n};\n\n//
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/vue/index.ts"],"sourcesContent":["import type { UISchemaElement } from \"@jsonforms/core\";\nimport {\n and,\n isNumberControl,\n isStringControl,\n or,\n rankWith,\n isControl,\n} from \"@jsonforms/core\";\nimport { resolveScopeSchema } from \"../core/resolveScope\";\nimport ProviderAutocomplete from \"./components/ProviderAutocomplete.vue\";\nimport ProviderSelect from \"./components/ProviderSelect.vue\";\nimport ProviderMultiSelect from \"./components/ProviderMultiSelect.vue\";\n\n// Custom tester that checks if provider option exists (as object or boolean)\nconst hasProvider = (uischema: UISchemaElement) => {\n return uischema?.options?.provider !== undefined;\n};\n\n// Integer fallback tester — handles nested scopes like #/properties/parent/properties/child\nconst isIntegerScope = (uischema: unknown, schema: unknown) => {\n const ui = uischema as { type?: string; scope?: string };\n if (ui?.type !== \"Control\" || !ui?.scope) return false;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const propertySchema = resolveScopeSchema(ui.scope, schema as Record<string, any>);\n return propertySchema?.type === \"integer\";\n};\n\n// Create specific testers for each component type\nconst providerSelectTester = rankWith(\n 106, // Higher than PrimeVue base (100) to ensure providers take precedence\n and(\n or(isStringControl, isNumberControl, and(isControl, isIntegerScope)),\n hasProvider,\n (uischema) => !uischema?.options?.autocomplete,\n ),\n);\n\nconst providerAutocompleteTester = rankWith(\n 107, // Higher than PrimeVue base (100) to ensure providers take precedence\n and(\n or(isStringControl, isNumberControl, and(isControl, isIntegerScope)),\n hasProvider,\n (uischema) => uischema?.options?.autocomplete === true,\n ),\n);\n\n// Custom array tester - supports nested scope paths\nconst isArrayControl = (uischema: UISchemaElement, schema: unknown) => {\n const controlSchema = uischema as { type: string; scope?: string };\n if (controlSchema.type !== \"Control\" || !controlSchema.scope) {\n return false;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const propertySchema = resolveScopeSchema(controlSchema.scope, schema as Record<string, any>);\n return propertySchema?.type === \"array\";\n};\n\nconst providerMultiSelectTester = rankWith(\n 108, // Highest priority for array controls with providers\n and(isArrayControl, hasProvider),\n);\n\nexport const providerRenderers = [\n { tester: providerMultiSelectTester, renderer: ProviderMultiSelect },\n { tester: providerAutocompleteTester, renderer: ProviderAutocomplete },\n { tester: providerSelectTester, renderer: ProviderSelect },\n];\n\n// Export PrimeVue renderers (styles are auto-injected)\nexport { primevueRenderers, registerPrimevueRenderers } from \"./primevue\";\n\n// Export individual components\nexport { ProviderAutocomplete, ProviderSelect, ProviderMultiSelect };\nexport { useProvider } from \"./composables/useProvider\";\nexport { useProjection } from \"./composables/useProjection\";\nexport type { ProjectionResult } from \"./composables/useProjection\";\nexport { createDataLayer, useDataLayer } from \"./composables/useDataLayer\";\nexport type { DataLayer } from \"./composables/useDataLayer\";\nexport { useDirtyValidation } from \"./composables/useDirtyValidation\";\nexport * from \"./testers\";\n\n// Export individual PrimeVue components using lazy evaluation to avoid circular deps\nexport {\n JfText,\n JfTextArea,\n JfNumber,\n JfEnum,\n JfEnumArray,\n JfBoolean,\n} from \"./primevue\";\n"],"names":["ProviderAutocomplete"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAM,cAAc,CAAC,aAA8B;AACjD,SAAO,UAAU,SAAS,aAAa;AACzC;AAGA,MAAM,iBAAiB,CAAC,UAAmB,WAAoB;AAC7D,QAAM,KAAK;AACX,MAAI,IAAI,SAAS,aAAa,CAAC,IAAI,MAAO,QAAO;AAGjD,QAAM,iBAAiB,mBAAmB,GAAG,OAAO,MAA6B;AACjF,SAAO,gBAAgB,SAAS;AAClC;AAGA,MAAM,uBAAuB;AAAA,EAC3B;AAAA;AAAA,EACA;AAAA,IACE,GAAG,iBAAiB,iBAAiB,IAAI,WAAW,cAAc,CAAC;AAAA,IACnE;AAAA,IACA,CAAC,aAAa,CAAC,UAAU,SAAS;AAAA,EAAA;AAEtC;AAEA,MAAM,6BAA6B;AAAA,EACjC;AAAA;AAAA,EACA;AAAA,IACE,GAAG,iBAAiB,iBAAiB,IAAI,WAAW,cAAc,CAAC;AAAA,IACnE;AAAA,IACA,CAAC,aAAa,UAAU,SAAS,iBAAiB;AAAA,EAAA;AAEtD;AAGA,MAAM,iBAAiB,CAAC,UAA2B,WAAoB;AACrE,QAAM,gBAAgB;AACtB,MAAI,cAAc,SAAS,aAAa,CAAC,cAAc,OAAO;AAC5D,WAAO;AAAA,EACT;AAGA,QAAM,iBAAiB,mBAAmB,cAAc,OAAO,MAA6B;AAC5F,SAAO,gBAAgB,SAAS;AAClC;AAEA,MAAM,4BAA4B;AAAA,EAChC;AAAA;AAAA,EACA,IAAI,gBAAgB,WAAW;AACjC;AAEO,MAAM,oBAAoB;AAAA,EAC/B,EAAE,QAAQ,2BAA2B,UAAU,oBAAA;AAAA,EAC/C,EAAE,QAAQ,4BAA4B,UAAUA,UAAA;AAAA,EAChD,EAAE,QAAQ,sBAAsB,UAAU,eAAA;AAC5C;"}
|
|
@@ -18,14 +18,17 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
18
18
|
renderers: {
|
|
19
19
|
type: ArrayConstructor;
|
|
20
20
|
required: false;
|
|
21
|
+
default: undefined;
|
|
21
22
|
};
|
|
22
23
|
cells: {
|
|
23
24
|
type: ArrayConstructor;
|
|
24
25
|
required: false;
|
|
26
|
+
default: undefined;
|
|
25
27
|
};
|
|
26
28
|
config: {
|
|
27
29
|
type: ObjectConstructor;
|
|
28
30
|
required: false;
|
|
31
|
+
default: undefined;
|
|
29
32
|
};
|
|
30
33
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
34
|
uischema: {
|
|
@@ -47,17 +50,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
47
50
|
renderers: {
|
|
48
51
|
type: ArrayConstructor;
|
|
49
52
|
required: false;
|
|
53
|
+
default: undefined;
|
|
50
54
|
};
|
|
51
55
|
cells: {
|
|
52
56
|
type: ArrayConstructor;
|
|
53
57
|
required: false;
|
|
58
|
+
default: undefined;
|
|
54
59
|
};
|
|
55
60
|
config: {
|
|
56
61
|
type: ObjectConstructor;
|
|
57
62
|
required: false;
|
|
63
|
+
default: undefined;
|
|
58
64
|
};
|
|
59
65
|
}>> & Readonly<{}>, {
|
|
66
|
+
config: Record<string, any>;
|
|
60
67
|
enabled: boolean;
|
|
68
|
+
renderers: unknown[];
|
|
69
|
+
cells: unknown[];
|
|
61
70
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
62
71
|
export default _default;
|
|
63
72
|
//# sourceMappingURL=JfBoolean.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfBoolean.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfBoolean.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JfBoolean.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfBoolean.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,wBA4KK"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, createElementBlock, openBlock, createVNode, createCommentVNode, unref, toDisplayString } from "vue";
|
|
1
|
+
import { defineComponent, getCurrentInstance, createElementBlock, openBlock, createVNode, createCommentVNode, unref, normalizeClass, toDisplayString } from "vue";
|
|
2
2
|
import { useJsonFormsControl } from "@jsonforms/vue";
|
|
3
|
+
import { useProjection } from "../composables/useProjection.js";
|
|
4
|
+
import { useDirtyValidation } from "../composables/useDirtyValidation.js";
|
|
3
5
|
import Checkbox from "primevue/checkbox";
|
|
4
6
|
const _hoisted_1 = { class: "flex items-center gap-2" };
|
|
5
7
|
const _hoisted_2 = { key: 0 };
|
|
@@ -28,15 +30,18 @@ const __default__ = {
|
|
|
28
30
|
},
|
|
29
31
|
renderers: {
|
|
30
32
|
type: Array,
|
|
31
|
-
required: false
|
|
33
|
+
required: false,
|
|
34
|
+
default: void 0
|
|
32
35
|
},
|
|
33
36
|
cells: {
|
|
34
37
|
type: Array,
|
|
35
|
-
required: false
|
|
38
|
+
required: false,
|
|
39
|
+
default: void 0
|
|
36
40
|
},
|
|
37
41
|
config: {
|
|
38
42
|
type: Object,
|
|
39
|
-
required: false
|
|
43
|
+
required: false,
|
|
44
|
+
default: void 0
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
};
|
|
@@ -45,19 +50,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
45
50
|
setup(__props) {
|
|
46
51
|
const instance = getCurrentInstance();
|
|
47
52
|
const props = instance.props;
|
|
48
|
-
const { control, handleChange } = useJsonFormsControl(props);
|
|
49
|
-
const
|
|
53
|
+
const { control, handleChange: rawHandleChange } = useJsonFormsControl(props);
|
|
54
|
+
const { projectedData, handleProjectedChange: handleChange } = useProjection(control, rawHandleChange);
|
|
55
|
+
const { showErrors, markDirty } = useDirtyValidation(control);
|
|
56
|
+
const onToggle = (val) => {
|
|
57
|
+
markDirty();
|
|
58
|
+
handleChange(control.value.path, val);
|
|
59
|
+
};
|
|
50
60
|
return (_ctx, _cache) => {
|
|
51
61
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
52
62
|
createVNode(unref(Checkbox), {
|
|
53
63
|
binary: true,
|
|
54
|
-
"model-value": !!unref(
|
|
64
|
+
"model-value": !!unref(projectedData),
|
|
55
65
|
disabled: !unref(control).enabled,
|
|
56
|
-
"
|
|
66
|
+
class: normalizeClass({ "p-invalid": unref(showErrors) }),
|
|
67
|
+
"aria-invalid": unref(showErrors) || void 0,
|
|
57
68
|
"onUpdate:modelValue": onToggle
|
|
58
|
-
}, null, 8, ["model-value", "disabled", "aria-invalid"]),
|
|
69
|
+
}, null, 8, ["model-value", "disabled", "class", "aria-invalid"]),
|
|
59
70
|
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
60
|
-
unref(
|
|
71
|
+
unref(showErrors) ? (openBlock(), createElementBlock("small", _hoisted_3, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
61
72
|
]);
|
|
62
73
|
};
|
|
63
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfBoolean.vue.js","sources":["../../../src/vue/primevue/JfBoolean.vue"],"sourcesContent":["<script lang=\"ts\">\nexport default {\n name: \"JfBoolean\",\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 { getCurrentInstance } from \"vue\";\nimport Checkbox from \"primevue/checkbox\";\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 onToggle = (val: boolean) => handleChange(control.value.path, val);\n</script>\n\n<template>\n <div class=\"flex items-center gap-2\">\n <Checkbox\n :binary=\"true\"\n :model-value=\"!!
|
|
1
|
+
{"version":3,"file":"JfBoolean.vue.js","sources":["../../../src/vue/primevue/JfBoolean.vue"],"sourcesContent":["<script lang=\"ts\">\nexport default {\n name: \"JfBoolean\",\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 default: undefined,\n },\n cells: {\n type: Array,\n required: false,\n default: undefined,\n },\n config: {\n type: Object,\n required: false,\n default: undefined,\n },\n },\n};\n</script>\n\n<script setup lang=\"ts\">\nimport type { ControlProps } from \"@jsonforms/vue\";\nimport { useJsonFormsControl } from \"@jsonforms/vue\";\nimport { getCurrentInstance } from \"vue\";\nimport { useProjection } from \"../composables/useProjection\";\nimport { useDirtyValidation } from \"../composables/useDirtyValidation\";\nimport Checkbox from \"primevue/checkbox\";\n\n// Access props from the component instance\nconst instance = getCurrentInstance()!;\nconst props = instance.props as unknown as ControlProps;\nconst { control, handleChange: rawHandleChange } = useJsonFormsControl(props);\nconst { projectedData, handleProjectedChange: handleChange } = useProjection(control, rawHandleChange);\n\n// Track user interaction — errors only show after first toggle\nconst { showErrors, markDirty } = useDirtyValidation(control);\n\nconst onToggle = (val: boolean) => {\n markDirty();\n handleChange(control.value.path, val);\n};\n</script>\n\n<template>\n <div class=\"flex items-center gap-2\">\n <Checkbox\n :binary=\"true\"\n :model-value=\"!!projectedData\"\n :disabled=\"!control.enabled\"\n :class=\"{ 'p-invalid': showErrors }\"\n :aria-invalid=\"showErrors || undefined\"\n @update:model-value=\"onToggle\"\n />\n <label v-if=\"control.label\">{{ control.label }}</label>\n <small v-if=\"showErrors\" class=\"p-error\">{{ control.errors }}</small>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_createVNode","_unref","_toDisplayString"],"mappings":";;;;;;;;;;;AACA,MAA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D,MAAA,OAAA,EAAQ,KAAK,GAAA,CAAA;QAC/BA,MAAA,UAAA,KAAbH,aAAAC,mBAAqE,SAArE,YAAqEG,gBAAzBD,MAAA,OAAA,EAAQ,MAAM,GAAA,CAAA;;;;;"}
|
|
@@ -18,14 +18,17 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
18
18
|
renderers: {
|
|
19
19
|
type: ArrayConstructor;
|
|
20
20
|
required: false;
|
|
21
|
+
default: undefined;
|
|
21
22
|
};
|
|
22
23
|
cells: {
|
|
23
24
|
type: ArrayConstructor;
|
|
24
25
|
required: false;
|
|
26
|
+
default: undefined;
|
|
25
27
|
};
|
|
26
28
|
config: {
|
|
27
29
|
type: ObjectConstructor;
|
|
28
30
|
required: false;
|
|
31
|
+
default: undefined;
|
|
29
32
|
};
|
|
30
33
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
34
|
uischema: {
|
|
@@ -47,17 +50,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
47
50
|
renderers: {
|
|
48
51
|
type: ArrayConstructor;
|
|
49
52
|
required: false;
|
|
53
|
+
default: undefined;
|
|
50
54
|
};
|
|
51
55
|
cells: {
|
|
52
56
|
type: ArrayConstructor;
|
|
53
57
|
required: false;
|
|
58
|
+
default: undefined;
|
|
54
59
|
};
|
|
55
60
|
config: {
|
|
56
61
|
type: ObjectConstructor;
|
|
57
62
|
required: false;
|
|
63
|
+
default: undefined;
|
|
58
64
|
};
|
|
59
65
|
}>> & Readonly<{}>, {
|
|
66
|
+
config: Record<string, any>;
|
|
60
67
|
enabled: boolean;
|
|
68
|
+
renderers: unknown[];
|
|
69
|
+
cells: unknown[];
|
|
61
70
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
62
71
|
export default _default;
|
|
63
72
|
//# sourceMappingURL=JfEnum.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfEnum.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnum.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JfEnum.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnum.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqNA,wBAoUK"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, computed, inject, watch,
|
|
1
|
+
import { defineComponent, getCurrentInstance, computed, inject, watch, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString, normalizeClass } from "vue";
|
|
2
2
|
import { useJsonFormsControl } from "@jsonforms/vue";
|
|
3
3
|
import { useProvider } from "../composables/useProvider.js";
|
|
4
4
|
import { useDerive } from "../composables/useDerive.js";
|
|
5
|
+
import { useProjection } from "../composables/useProjection.js";
|
|
6
|
+
import { useDirtyValidation } from "../composables/useDirtyValidation.js";
|
|
5
7
|
import { shouldAutoSelect } from "../utils/autoSelect.js";
|
|
6
8
|
import Dropdown from "primevue/dropdown";
|
|
7
9
|
const _hoisted_1 = { class: "flex flex-column gap-2" };
|
|
@@ -43,15 +45,18 @@ const __default__ = {
|
|
|
43
45
|
},
|
|
44
46
|
renderers: {
|
|
45
47
|
type: Array,
|
|
46
|
-
required: false
|
|
48
|
+
required: false,
|
|
49
|
+
default: void 0
|
|
47
50
|
},
|
|
48
51
|
cells: {
|
|
49
52
|
type: Array,
|
|
50
|
-
required: false
|
|
53
|
+
required: false,
|
|
54
|
+
default: void 0
|
|
51
55
|
},
|
|
52
56
|
config: {
|
|
53
57
|
type: Object,
|
|
54
|
-
required: false
|
|
58
|
+
required: false,
|
|
59
|
+
default: void 0
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
};
|
|
@@ -60,7 +65,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
60
65
|
setup(__props) {
|
|
61
66
|
const instance = getCurrentInstance();
|
|
62
67
|
const props = instance.props;
|
|
63
|
-
const { control, handleChange } = useJsonFormsControl(props);
|
|
68
|
+
const { control, handleChange: rawHandleChange } = useJsonFormsControl(props);
|
|
69
|
+
const { projectedData, handleProjectedChange: handleChange } = useProjection(control, rawHandleChange);
|
|
64
70
|
const toOptions = (schema) => {
|
|
65
71
|
if (!schema) return [];
|
|
66
72
|
const s = schema;
|
|
@@ -119,7 +125,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
119
125
|
}
|
|
120
126
|
return toOptions(control.value.schema);
|
|
121
127
|
});
|
|
122
|
-
useDerive({ control, handleChange });
|
|
128
|
+
useDerive({ control, handleChange, data: projectedData });
|
|
123
129
|
watch(
|
|
124
130
|
[providerItems, loading],
|
|
125
131
|
([items, isLoading]) => {
|
|
@@ -127,7 +133,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
127
133
|
autoSelectSingle: control.value.uischema?.options?.autoSelectSingle !== false,
|
|
128
134
|
isLoading,
|
|
129
135
|
items,
|
|
130
|
-
currentValue:
|
|
136
|
+
currentValue: projectedData.value
|
|
131
137
|
});
|
|
132
138
|
if (valueToSelect !== null) {
|
|
133
139
|
handleChange(control.value.path, valueToSelect);
|
|
@@ -135,32 +141,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
135
141
|
},
|
|
136
142
|
{ immediate: true }
|
|
137
143
|
);
|
|
138
|
-
const
|
|
139
|
-
const showErrors = computed(() => hasInteracted.value && control.value.errors);
|
|
144
|
+
const { showErrors, markDirty } = useDirtyValidation(control);
|
|
140
145
|
const onSelect = (val) => {
|
|
141
146
|
handleChange(control.value.path, val);
|
|
142
147
|
};
|
|
143
|
-
const onBlur = () => {
|
|
144
|
-
hasInteracted.value = true;
|
|
145
|
-
};
|
|
146
148
|
return (_ctx, _cache) => {
|
|
147
149
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
148
150
|
unref(control).label ? (openBlock(), createElementBlock("label", _hoisted_2, toDisplayString(unref(control).label), 1)) : createCommentVNode("", true),
|
|
149
151
|
unref(control).description ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(control).description), 1)) : createCommentVNode("", true),
|
|
150
152
|
createVNode(unref(Dropdown), {
|
|
151
|
-
class: "w-full",
|
|
153
|
+
class: normalizeClass(["w-full", { "p-invalid": unref(showErrors) }]),
|
|
152
154
|
options: options.value,
|
|
153
155
|
"option-label": "label",
|
|
154
156
|
"option-value": "value",
|
|
155
|
-
"model-value": unref(
|
|
157
|
+
"model-value": unref(projectedData) ?? null,
|
|
156
158
|
placeholder: placeholder.value,
|
|
157
159
|
disabled: !unref(control).enabled || unref(loading),
|
|
158
|
-
"aria-invalid":
|
|
160
|
+
"aria-invalid": unref(showErrors) || void 0,
|
|
159
161
|
"show-clear": true,
|
|
160
162
|
"onUpdate:modelValue": onSelect,
|
|
161
|
-
onBlur
|
|
162
|
-
}, null, 8, ["options", "model-value", "placeholder", "disabled", "aria-invalid"]),
|
|
163
|
-
unref(error) ? (openBlock(), createElementBlock("small", _hoisted_4, "Failed to load: " + toDisplayString(unref(error)), 1)) : showErrors
|
|
163
|
+
onBlur: unref(markDirty)
|
|
164
|
+
}, null, 8, ["class", "options", "model-value", "placeholder", "disabled", "aria-invalid", "onBlur"]),
|
|
165
|
+
unref(error) ? (openBlock(), createElementBlock("small", _hoisted_4, "Failed to load: " + toDisplayString(unref(error)), 1)) : unref(showErrors) ? (openBlock(), createElementBlock("small", _hoisted_5, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
164
166
|
]);
|
|
165
167
|
};
|
|
166
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfEnum.vue.js","sources":["../../../src/vue/primevue/JfEnum.vue"],"sourcesContent":["<script lang=\"ts\">\n// Define props manually to avoid any potential circular dependency issues\nexport default {\n name: \"JfEnum\",\n props: {\n uischema: {\n type: Object,\n required: true,\n },\n schema: {\n type: Object,\n required: true,\n },\n path: {\n type: String,\n required: true,\n },\n enabled: {\n type: Boolean,\n default: undefined,\n },\n renderers: {\n type: Array,\n required: false,\n },\n cells: {\n type: Array,\n required: false,\n },\n config: {\n type: Object,\n required: false,\n },\n },\n};\n</script>\n\n<script setup lang=\"ts\">\nimport type { JsonSchema } from \"@jsonforms/core\";\nimport type { ControlProps } from \"@jsonforms/vue\";\nimport { useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed,
|
|
1
|
+
{"version":3,"file":"JfEnum.vue.js","sources":["../../../src/vue/primevue/JfEnum.vue"],"sourcesContent":["<script lang=\"ts\">\n// Define props manually to avoid any potential circular dependency issues\nexport default {\n name: \"JfEnum\",\n props: {\n uischema: {\n type: Object,\n required: true,\n },\n schema: {\n type: Object,\n required: true,\n },\n path: {\n type: String,\n required: true,\n },\n enabled: {\n type: Boolean,\n default: undefined,\n },\n renderers: {\n type: Array,\n required: false,\n default: undefined,\n },\n cells: {\n type: Array,\n required: false,\n default: undefined,\n },\n config: {\n type: Object,\n required: false,\n default: undefined,\n },\n },\n};\n</script>\n\n<script setup lang=\"ts\">\nimport type { JsonSchema } from \"@jsonforms/core\";\nimport type { ControlProps } from \"@jsonforms/vue\";\nimport { useJsonFormsControl } from \"@jsonforms/vue\";\nimport { computed, inject, getCurrentInstance, watch } from \"vue\";\nimport { useProvider } from \"../composables/useProvider\";\nimport { useDerive } from \"../composables/useDerive\";\nimport { useProjection } from \"../composables/useProjection\";\nimport { useDirtyValidation } from \"../composables/useDirtyValidation\";\nimport { shouldAutoSelect } from \"../utils/autoSelect\";\nimport Dropdown from \"primevue/dropdown\";\n\n// Access props from the component instance\nconst instance = getCurrentInstance()!;\nconst props = instance.props as unknown as ControlProps;\nconst { control, handleChange: rawHandleChange } = useJsonFormsControl(props);\nconst { projectedData, handleProjectedChange: handleChange } = useProjection(control, rawHandleChange);\n\ntype Opt = { label: string; value: unknown };\nconst toOptions = (schema?: JsonSchema): Opt[] => {\n if (!schema) return [];\n const s = schema as {\n enum?: unknown[];\n oneOf?: Array<{ title?: string; const: unknown }>;\n };\n if (Array.isArray(s.enum))\n return s.enum.map((v: unknown) => ({ label: String(v), value: v }));\n if (Array.isArray(s.oneOf))\n return s.oneOf.map((o) => ({\n label: o.title ?? String(o.const),\n value: o.const,\n }));\n return [];\n};\n\n// Provider support\nconst binding = computed(() => {\n const provider = control.value.uischema?.options?.provider;\n // Ensure load property is set to 'mount' by default\n if (provider && typeof provider === \"object\" && !provider.load) {\n return { ...provider, load: \"mount\" };\n }\n return provider;\n});\n\nconst deps = computed(\n () =>\n ((\n (control.value.schema as Record<string, unknown>)?.[\n \"x-provider\"\n ] as Record<string, unknown>\n )?.dependsOn as string[]) ?? [],\n);\nconst depValues = computed(() => {\n return deps.value.map((dep) => {\n // Resolve dependency value from form data using JSON pointer-like path\n const path = dep.startsWith(\"#/\") ? dep.slice(2) : dep;\n const keys = path.replace(/\\//g, \".\").split(\".\");\n let value: unknown = rootData.value;\n for (const key of keys) {\n if (value && typeof value === \"object\" && key in value) {\n value = (value as Record<string, unknown>)[key];\n } else {\n return null;\n }\n }\n return value;\n });\n});\n\n// Get the root form data from JSONForms context for template URL resolution\nconst injectedFormData = inject<{ value: unknown }>(\"formData\", { value: {} });\nconst rootData = computed(() => injectedFormData.value || {});\n\n// Use provider if available, otherwise fall back to schema enum/oneOf\nconst {\n items: providerItems,\n loading,\n error,\n} = useProvider(binding, {\n data: rootData,\n path: control.value.path,\n dependsOnValues: depValues.value,\n});\n\nconst placeholder = computed<string | undefined>(() => {\n if (loading.value) return \"Loading…\";\n return (\n (control.value.uischema as { options?: { placeholder?: string } })?.options\n ?.placeholder ?? control.value.description\n );\n});\n\nconst options = computed(() => {\n // Use provider items if available, otherwise fall back to schema enum/oneOf\n if (binding.value && providerItems.value.length > 0) {\n return providerItems.value;\n }\n return toOptions(control.value.schema);\n});\n\n// Add derive functionality\nuseDerive({ control, handleChange, data: projectedData });\n\n// Auto-select when provider returns only one item (enabled by default)\nwatch(\n [providerItems, loading],\n ([items, isLoading]) => {\n const valueToSelect = shouldAutoSelect({\n autoSelectSingle:\n control.value.uischema?.options?.autoSelectSingle !== false,\n isLoading,\n items,\n currentValue: projectedData.value,\n });\n\n if (valueToSelect !== null) {\n handleChange(control.value.path, valueToSelect);\n }\n },\n { immediate: true }\n);\n\n// Track user interaction — errors only show after blur\nconst { showErrors, markDirty } = useDirtyValidation(control);\n\nconst onSelect = (val: unknown) => {\n handleChange(control.value.path, val);\n};\n</script>\n\n<template>\n <div class=\"flex flex-column gap-2\">\n <label v-if=\"control.label\" class=\"text-color text-left\">{{\n control.label\n }}</label>\n <div v-if=\"control.description\" class=\"text-color-secondary text-left\">\n {{ control.description }}\n </div>\n <Dropdown\n :class=\"['w-full', { 'p-invalid': showErrors }]\"\n :options=\"options\"\n option-label=\"label\"\n option-value=\"value\"\n :model-value=\"projectedData ?? null\"\n :placeholder=\"placeholder\"\n :disabled=\"!control.enabled || loading\"\n :aria-invalid=\"showErrors || undefined\"\n :show-clear=\"true\"\n @update:model-value=\"onSelect\"\n @blur=\"markDirty\"\n />\n <small v-if=\"error\" class=\"p-error\" role=\"alert\"\n >Failed to load: {{ error }}</small\n >\n <small v-else-if=\"showErrors\" class=\"p-error\">{{ control.errors }}</small>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_unref","_toDisplayString","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAA,cAAe;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,IACL,UAAU;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,IAEZ,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,IAEZ,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,IAEZ,SAAS;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|
18
18
|
renderers: {
|
|
19
19
|
type: ArrayConstructor;
|
|
20
20
|
required: false;
|
|
21
|
+
default: undefined;
|
|
21
22
|
};
|
|
22
23
|
cells: {
|
|
23
24
|
type: ArrayConstructor;
|
|
24
25
|
required: false;
|
|
26
|
+
default: undefined;
|
|
25
27
|
};
|
|
26
28
|
config: {
|
|
27
29
|
type: ObjectConstructor;
|
|
28
30
|
required: false;
|
|
31
|
+
default: undefined;
|
|
29
32
|
};
|
|
30
33
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
34
|
uischema: {
|
|
@@ -47,17 +50,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
47
50
|
renderers: {
|
|
48
51
|
type: ArrayConstructor;
|
|
49
52
|
required: false;
|
|
53
|
+
default: undefined;
|
|
50
54
|
};
|
|
51
55
|
cells: {
|
|
52
56
|
type: ArrayConstructor;
|
|
53
57
|
required: false;
|
|
58
|
+
default: undefined;
|
|
54
59
|
};
|
|
55
60
|
config: {
|
|
56
61
|
type: ObjectConstructor;
|
|
57
62
|
required: false;
|
|
63
|
+
default: undefined;
|
|
58
64
|
};
|
|
59
65
|
}>> & Readonly<{}>, {
|
|
66
|
+
config: Record<string, any>;
|
|
60
67
|
enabled: boolean;
|
|
68
|
+
renderers: unknown[];
|
|
69
|
+
cells: unknown[];
|
|
61
70
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
62
71
|
export default _default;
|
|
63
72
|
//# sourceMappingURL=JfEnumArray.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JfEnumArray.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnumArray.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JfEnumArray.vue.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/JfEnumArray.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2OA,wBA8UK"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, computed, inject, watch, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString } from "vue";
|
|
1
|
+
import { defineComponent, getCurrentInstance, computed, inject, watch, createElementBlock, openBlock, createCommentVNode, createVNode, unref, toDisplayString, normalizeClass } from "vue";
|
|
2
2
|
import { useJsonFormsControl } from "@jsonforms/vue";
|
|
3
3
|
import { useProvider } from "../composables/useProvider.js";
|
|
4
4
|
import { useDerive } from "../composables/useDerive.js";
|
|
5
|
+
import { useProjection } from "../composables/useProjection.js";
|
|
6
|
+
import { useDirtyValidation } from "../composables/useDirtyValidation.js";
|
|
5
7
|
import { shouldAutoSelectMulti } from "../utils/autoSelect.js";
|
|
6
8
|
import MultiSelect from "primevue/multiselect";
|
|
7
9
|
const _hoisted_1 = { class: "flex flex-column gap-2" };
|
|
@@ -43,15 +45,18 @@ const __default__ = {
|
|
|
43
45
|
},
|
|
44
46
|
renderers: {
|
|
45
47
|
type: Array,
|
|
46
|
-
required: false
|
|
48
|
+
required: false,
|
|
49
|
+
default: void 0
|
|
47
50
|
},
|
|
48
51
|
cells: {
|
|
49
52
|
type: Array,
|
|
50
|
-
required: false
|
|
53
|
+
required: false,
|
|
54
|
+
default: void 0
|
|
51
55
|
},
|
|
52
56
|
config: {
|
|
53
57
|
type: Object,
|
|
54
|
-
required: false
|
|
58
|
+
required: false,
|
|
59
|
+
default: void 0
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
};
|
|
@@ -60,7 +65,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
60
65
|
setup(__props) {
|
|
61
66
|
const instance = getCurrentInstance();
|
|
62
67
|
const props = instance.props;
|
|
63
|
-
const { control, handleChange } = useJsonFormsControl(props);
|
|
68
|
+
const { control, handleChange: rawHandleChange } = useJsonFormsControl(props);
|
|
69
|
+
const { projectedData, handleProjectedChange: handleChange } = useProjection(control, rawHandleChange);
|
|
64
70
|
const toOptions = (schema) => {
|
|
65
71
|
if (!schema) return [];
|
|
66
72
|
const s = schema;
|
|
@@ -115,7 +121,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
115
121
|
}
|
|
116
122
|
return toOptions(control.value.schema?.items);
|
|
117
123
|
});
|
|
118
|
-
useDerive({ control, handleChange });
|
|
124
|
+
useDerive({ control, handleChange, data: projectedData });
|
|
125
|
+
const { showErrors, markDirty } = useDirtyValidation(control);
|
|
119
126
|
watch(
|
|
120
127
|
[providerItems, loading],
|
|
121
128
|
([items, isLoading]) => {
|
|
@@ -123,7 +130,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
123
130
|
autoSelectSingle: control.value.uischema?.options?.autoSelectSingle === true,
|
|
124
131
|
isLoading,
|
|
125
132
|
items,
|
|
126
|
-
currentValue: Array.isArray(
|
|
133
|
+
currentValue: Array.isArray(projectedData.value) ? projectedData.value : []
|
|
127
134
|
});
|
|
128
135
|
if (valueToSelect !== null) {
|
|
129
136
|
handleChange(control.value.path, valueToSelect);
|
|
@@ -143,13 +150,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
143
150
|
};
|
|
144
151
|
const model = computed({
|
|
145
152
|
get() {
|
|
146
|
-
const curr = Array.isArray(
|
|
153
|
+
const curr = Array.isArray(projectedData.value) ? projectedData.value : [];
|
|
147
154
|
return [...curr];
|
|
148
155
|
},
|
|
149
156
|
set(val) {
|
|
150
157
|
const next = Array.isArray(val) ? [...val] : [];
|
|
151
|
-
const curr = Array.isArray(
|
|
152
|
-
if (!sameSet(curr, next))
|
|
158
|
+
const curr = Array.isArray(projectedData.value) ? projectedData.value : [];
|
|
159
|
+
if (!sameSet(curr, next)) {
|
|
160
|
+
markDirty();
|
|
161
|
+
handleChange(control.value.path, next);
|
|
162
|
+
}
|
|
153
163
|
}
|
|
154
164
|
});
|
|
155
165
|
return (_ctx, _cache) => {
|
|
@@ -159,17 +169,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
159
169
|
createVNode(unref(MultiSelect), {
|
|
160
170
|
modelValue: model.value,
|
|
161
171
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
162
|
-
class: "w-full",
|
|
172
|
+
class: normalizeClass(["w-full", { "p-invalid": unref(showErrors) }]),
|
|
163
173
|
options: options.value,
|
|
164
174
|
"option-label": "label",
|
|
165
175
|
"option-value": "value",
|
|
166
176
|
"data-key": "value",
|
|
167
177
|
display: "chip",
|
|
168
178
|
disabled: !unref(control).enabled || unref(loading),
|
|
169
|
-
"aria-invalid":
|
|
179
|
+
"aria-invalid": unref(showErrors) || void 0,
|
|
170
180
|
placeholder: placeholder.value
|
|
171
|
-
}, null, 8, ["modelValue", "options", "disabled", "aria-invalid", "placeholder"]),
|
|
172
|
-
unref(error) ? (openBlock(), createElementBlock("small", _hoisted_4, "Failed to load: " + toDisplayString(unref(error)), 1)) : unref(
|
|
181
|
+
}, null, 8, ["modelValue", "class", "options", "disabled", "aria-invalid", "placeholder"]),
|
|
182
|
+
unref(error) ? (openBlock(), createElementBlock("small", _hoisted_4, "Failed to load: " + toDisplayString(unref(error)), 1)) : unref(showErrors) ? (openBlock(), createElementBlock("small", _hoisted_5, toDisplayString(unref(control).errors), 1)) : createCommentVNode("", true)
|
|
173
183
|
]);
|
|
174
184
|
};
|
|
175
185
|
}
|