@prolibu-suite/cobalt-form-vue 0.1.1 → 0.1.3
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/components/CoFieldRenderer.vue.d.ts.map +1 -1
- package/dist/components/CoFormRenderer.vue.d.ts +8 -0
- package/dist/components/CoFormRenderer.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldBoolean.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldDate.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldNumber.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldRef.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldSelect.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldText.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldTextArea.vue.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +299 -311
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoFieldRenderer.vue.d.ts","sourceRoot":"","sources":["../../src/components/CoFieldRenderer.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoFieldRenderer.vue.d.ts","sourceRoot":"","sources":["../../src/components/CoFieldRenderer.vue"],"names":[],"mappings":"AA+EA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,iCAAiC,CAAC;AAOlF,OAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAwBhE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAC7C,CAAC;;;;;;;;;;;;;;AAoGF,wBAOG"}
|
|
@@ -34,11 +34,19 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
|
|
|
34
34
|
values: Record<string, any>;
|
|
35
35
|
}) => any;
|
|
36
36
|
invalid: (errors: Record<string, string[]>) => any;
|
|
37
|
+
change: (payload: {
|
|
38
|
+
name: string;
|
|
39
|
+
value: any;
|
|
40
|
+
}) => any;
|
|
37
41
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
38
42
|
onSubmit?: ((payload: {
|
|
39
43
|
values: Record<string, any>;
|
|
40
44
|
}) => any) | undefined;
|
|
41
45
|
onInvalid?: ((errors: Record<string, string[]>) => any) | undefined;
|
|
46
|
+
onChange?: ((payload: {
|
|
47
|
+
name: string;
|
|
48
|
+
value: any;
|
|
49
|
+
}) => any) | undefined;
|
|
42
50
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
43
51
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
44
52
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoFormRenderer.vue.d.ts","sourceRoot":"","sources":["../../src/components/CoFormRenderer.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoFormRenderer.vue.d.ts","sourceRoot":"","sources":["../../src/components/CoFormRenderer.vue"],"names":[],"mappings":"AAiRA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAE3E,OAAO,EAEL,KAAK,eAAe,EAEpB,KAAK,WAAW,EAEjB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAI5D,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAmDF,iBAAe,QAAQ,kBAYtB;AAuOD,QAAA,IAAI,OAAO;;CAAU,EAAE,OAAO,mBAAU,EAAE,OAAO;;;;kBA3ElC,GAAG;;CA2EyC,EAAE,QAAQ;;;CAAY,CAAE;AACnF,KAAK,WAAW,GAAG,EAAE,GACnB;KAAG,CAAC,IAAI,WAAW,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG;CAAE,GACvE;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC3C;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAgC/C,QAAA,MAAM,eAAe;;gBAtUS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;cAErB,MAAM;eAAS,GAAG;;;;gBAFhB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;cAErB,MAAM;eAAS,GAAG;;kFA2U5C,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldBoolean.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldBoolean.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldBoolean.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldBoolean.vue"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;AAqEF,wBAOG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDate.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldDate.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldDate.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldDate.vue"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;;;AAkFF,wBAOG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldNumber.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldNumber.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldNumber.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldNumber.vue"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;;;AA2FF,wBAOG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldRef.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldRef.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldRef.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldRef.vue"],"names":[],"mappings":"AAuFA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEvF,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;;;;;;;;;;;;AA+IF,wBAOG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldSelect.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldSelect.vue"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;;;AAyFF,wBAOG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldText.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldText.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldText.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldText.vue"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;;;AA6FF,wBAOG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldTextArea.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/FieldTextArea.vue"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;;;AAkFF,wBAOG"}
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.co-form-layout[data-v-
|
|
1
|
+
.co-form-layout[data-v-5700cb3a]{display:grid;gap:var(--co-spacing-lg, 16px)}.co-form-layout--grid[data-v-5700cb3a]{grid-template-columns:repeat(2,minmax(0,1fr))}.co-form-layout--stack[data-v-5700cb3a]{grid-template-columns:1fr}.co-form-field--full[data-v-5700cb3a]{grid-column:1 / -1}@media(max-width:640px){.co-form-layout--grid[data-v-5700cb3a]{grid-template-columns:1fr}}.co-form-footer[data-v-5700cb3a]{margin-top:var(--co-spacing-2xl, 24px)}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { createForm as
|
|
2
|
-
import { createForm as
|
|
3
|
-
import { shallowRef as
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { createForm as W, normalizeForValidation as H } from "@prolibu-suite/cobalt-form-core";
|
|
2
|
+
import { createForm as xe } from "@prolibu-suite/cobalt-form-core";
|
|
3
|
+
import { shallowRef as M, watch as U, toValue as G, onBeforeUnmount as K, computed as f, defineComponent as C, openBlock as g, createBlock as A, unref as $, resolveDynamicComponent as Z, reactive as Q, onMounted as X, createElementBlock as T, withModifiers as Y, renderSlot as V, createElementVNode as O, normalizeClass as N, Fragment as _, renderList as ee, createVNode as I } from "vue";
|
|
4
|
+
import { CoInput as k, CoNumberField as te, CoSwitch as le, CoSelect as re, CoRefField as ae, CoButton as oe } from "@prolibu-suite/cobalt-vue";
|
|
5
|
+
function he(e) {
|
|
6
|
+
const c = M(null), t = M({
|
|
6
7
|
values: {},
|
|
7
8
|
errors: {},
|
|
8
9
|
touched: {},
|
|
@@ -11,66 +12,66 @@ function ue(e) {
|
|
|
11
12
|
isSubmitting: !1
|
|
12
13
|
});
|
|
13
14
|
let r = null;
|
|
14
|
-
function
|
|
15
|
+
function v(n) {
|
|
15
16
|
r == null || r();
|
|
16
|
-
const s =
|
|
17
|
-
c.value = s, t.value = s.state, r = s.subscribe((
|
|
18
|
-
t.value =
|
|
17
|
+
const s = W(n);
|
|
18
|
+
c.value = s, t.value = s.state, r = s.subscribe((a) => {
|
|
19
|
+
t.value = a;
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
|
-
return
|
|
22
|
-
() =>
|
|
23
|
-
(
|
|
22
|
+
return U(
|
|
23
|
+
() => G(e),
|
|
24
|
+
(n) => v(n),
|
|
24
25
|
{ immediate: !0, deep: !1 }
|
|
25
|
-
),
|
|
26
|
+
), K(() => {
|
|
26
27
|
r == null || r(), r = null;
|
|
27
28
|
}), {
|
|
28
29
|
controller: c,
|
|
29
|
-
values:
|
|
30
|
-
errors:
|
|
31
|
-
touched:
|
|
32
|
-
isValid:
|
|
33
|
-
isDirty:
|
|
34
|
-
isSubmitting:
|
|
35
|
-
fields:
|
|
36
|
-
var
|
|
37
|
-
return ((
|
|
30
|
+
values: f(() => t.value.values),
|
|
31
|
+
errors: f(() => t.value.errors),
|
|
32
|
+
touched: f(() => t.value.touched),
|
|
33
|
+
isValid: f(() => t.value.isValid),
|
|
34
|
+
isDirty: f(() => t.value.isDirty),
|
|
35
|
+
isSubmitting: f(() => t.value.isSubmitting),
|
|
36
|
+
fields: f(() => {
|
|
37
|
+
var n;
|
|
38
|
+
return ((n = c.value) == null ? void 0 : n.fields) ?? [];
|
|
38
39
|
}),
|
|
39
|
-
setValue: (
|
|
40
|
-
var
|
|
41
|
-
return (
|
|
40
|
+
setValue: (n, s) => {
|
|
41
|
+
var a;
|
|
42
|
+
return (a = c.value) == null ? void 0 : a.setValue(n, s);
|
|
42
43
|
},
|
|
43
|
-
setValues: (
|
|
44
|
+
setValues: (n) => {
|
|
44
45
|
var s;
|
|
45
|
-
return (s = c.value) == null ? void 0 : s.setValues(
|
|
46
|
+
return (s = c.value) == null ? void 0 : s.setValues(n);
|
|
46
47
|
},
|
|
47
|
-
touch: (
|
|
48
|
+
touch: (n) => {
|
|
48
49
|
var s;
|
|
49
|
-
return (s = c.value) == null ? void 0 : s.touch(
|
|
50
|
+
return (s = c.value) == null ? void 0 : s.touch(n);
|
|
50
51
|
},
|
|
51
52
|
touchAll: () => {
|
|
52
|
-
var
|
|
53
|
-
return (
|
|
53
|
+
var n;
|
|
54
|
+
return (n = c.value) == null ? void 0 : n.touchAll();
|
|
54
55
|
},
|
|
55
|
-
setSchema: (
|
|
56
|
+
setSchema: (n) => {
|
|
56
57
|
var s;
|
|
57
|
-
return (s = c.value) == null ? void 0 : s.setSchema(
|
|
58
|
+
return (s = c.value) == null ? void 0 : s.setSchema(n);
|
|
58
59
|
},
|
|
59
60
|
validate: () => {
|
|
60
|
-
var
|
|
61
|
-
return ((
|
|
61
|
+
var n;
|
|
62
|
+
return ((n = c.value) == null ? void 0 : n.validate()) ?? !0;
|
|
62
63
|
},
|
|
63
64
|
submit: () => {
|
|
64
|
-
var
|
|
65
|
-
return ((
|
|
65
|
+
var n;
|
|
66
|
+
return ((n = c.value) == null ? void 0 : n.submit()) ?? Promise.resolve({ values: {}, isValid: !0, errors: {} });
|
|
66
67
|
},
|
|
67
|
-
reset: (
|
|
68
|
+
reset: (n) => {
|
|
68
69
|
var s;
|
|
69
|
-
return (s = c.value) == null ? void 0 : s.reset(
|
|
70
|
+
return (s = c.value) == null ? void 0 : s.reset(n);
|
|
70
71
|
}
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
|
-
const
|
|
74
|
+
const D = /* @__PURE__ */ C({
|
|
74
75
|
__name: "FieldText",
|
|
75
76
|
props: {
|
|
76
77
|
field: {},
|
|
@@ -80,27 +81,24 @@ const X = /* @__PURE__ */ C({
|
|
|
80
81
|
},
|
|
81
82
|
emits: ["update:value", "blur"],
|
|
82
83
|
setup(e, { emit: c }) {
|
|
83
|
-
const t = e, r = c,
|
|
84
|
-
const
|
|
85
|
-
return
|
|
84
|
+
const t = e, r = c, v = f(() => t.errors.length > 0 ? "error" : "default"), n = f(() => t.errors[0] || t.field.helperText), s = f(() => {
|
|
85
|
+
const a = t.field.originalAttrs, o = a.format || a.uiCom;
|
|
86
|
+
return o === "email" || t.field.name === "email" ? "email" : o === "password" || o === "Password" ? "password" : o === "tel" || o === "phone" ? "tel" : o === "url" ? "url" : "text";
|
|
86
87
|
});
|
|
87
|
-
return (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
onBlur: n[1] || (n[1] = (f) => r("blur"))
|
|
100
|
-
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "type", "value"]);
|
|
101
|
-
};
|
|
88
|
+
return (a, o) => (g(), A($(k), {
|
|
89
|
+
label: e.field.label,
|
|
90
|
+
placeholder: e.field.placeholder,
|
|
91
|
+
required: e.field.required,
|
|
92
|
+
disabled: e.disabled,
|
|
93
|
+
status: v.value,
|
|
94
|
+
"helper-text": n.value,
|
|
95
|
+
type: s.value,
|
|
96
|
+
value: String(e.value ?? ""),
|
|
97
|
+
onCoInput: o[0] || (o[0] = (y) => r("update:value", y.detail)),
|
|
98
|
+
onBlur: o[1] || (o[1] = (y) => r("blur"))
|
|
99
|
+
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "type", "value"]));
|
|
102
100
|
}
|
|
103
|
-
}),
|
|
101
|
+
}), J = /* @__PURE__ */ C({
|
|
104
102
|
__name: "FieldTextArea",
|
|
105
103
|
props: {
|
|
106
104
|
field: {},
|
|
@@ -110,24 +108,21 @@ const X = /* @__PURE__ */ C({
|
|
|
110
108
|
},
|
|
111
109
|
emits: ["update:value", "blur"],
|
|
112
110
|
setup(e, { emit: c }) {
|
|
113
|
-
const t = e, r = c,
|
|
114
|
-
return (s,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
onBlur: o[1] || (o[1] = (h) => r("blur"))
|
|
127
|
-
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "value"]);
|
|
128
|
-
};
|
|
111
|
+
const t = e, r = c, v = f(() => t.errors.length > 0 ? "error" : "default"), n = f(() => t.errors[0] || t.field.helperText);
|
|
112
|
+
return (s, a) => (g(), A($(k), {
|
|
113
|
+
label: e.field.label,
|
|
114
|
+
placeholder: e.field.placeholder,
|
|
115
|
+
required: e.field.required,
|
|
116
|
+
disabled: e.disabled,
|
|
117
|
+
status: v.value,
|
|
118
|
+
"helper-text": n.value,
|
|
119
|
+
multiline: "",
|
|
120
|
+
value: String(e.value ?? ""),
|
|
121
|
+
onCoInput: a[0] || (a[0] = (o) => r("update:value", o.detail)),
|
|
122
|
+
onBlur: a[1] || (a[1] = (o) => r("blur"))
|
|
123
|
+
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "value"]));
|
|
129
124
|
}
|
|
130
|
-
}),
|
|
125
|
+
}), w = /* @__PURE__ */ C({
|
|
131
126
|
__name: "FieldNumber",
|
|
132
127
|
props: {
|
|
133
128
|
field: {},
|
|
@@ -137,25 +132,22 @@ const X = /* @__PURE__ */ C({
|
|
|
137
132
|
},
|
|
138
133
|
emits: ["update:value", "blur"],
|
|
139
134
|
setup(e, { emit: c }) {
|
|
140
|
-
const t = e, r = c,
|
|
141
|
-
return (
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
onBlur: f[1] || (f[1] = (y) => r("blur"))
|
|
155
|
-
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "min", "max", "value"]);
|
|
156
|
-
};
|
|
135
|
+
const t = e, r = c, v = f(() => t.errors.length > 0 ? "error" : "default"), n = f(() => t.errors[0] || t.field.helperText), s = f(() => t.field.originalAttrs.min), a = f(() => t.field.originalAttrs.max), o = f(() => typeof t.value == "number" ? t.value : void 0);
|
|
136
|
+
return (y, x) => (g(), A($(te), {
|
|
137
|
+
label: e.field.label,
|
|
138
|
+
placeholder: e.field.placeholder,
|
|
139
|
+
required: e.field.required,
|
|
140
|
+
disabled: e.disabled,
|
|
141
|
+
status: v.value,
|
|
142
|
+
"helper-text": n.value,
|
|
143
|
+
min: s.value,
|
|
144
|
+
max: a.value,
|
|
145
|
+
value: o.value,
|
|
146
|
+
onCoChange: x[0] || (x[0] = (i) => r("update:value", i.detail)),
|
|
147
|
+
onBlur: x[1] || (x[1] = (i) => r("blur"))
|
|
148
|
+
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "min", "max", "value"]));
|
|
157
149
|
}
|
|
158
|
-
}),
|
|
150
|
+
}), ne = /* @__PURE__ */ C({
|
|
159
151
|
__name: "FieldDate",
|
|
160
152
|
props: {
|
|
161
153
|
field: {},
|
|
@@ -165,24 +157,21 @@ const X = /* @__PURE__ */ C({
|
|
|
165
157
|
},
|
|
166
158
|
emits: ["update:value", "blur"],
|
|
167
159
|
setup(e, { emit: c }) {
|
|
168
|
-
const t = e, r = c,
|
|
169
|
-
return (s,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
onBlur: o[1] || (o[1] = (h) => r("blur"))
|
|
182
|
-
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "value"]);
|
|
183
|
-
};
|
|
160
|
+
const t = e, r = c, v = f(() => t.errors.length > 0 ? "error" : "default"), n = f(() => t.errors[0] || t.field.helperText);
|
|
161
|
+
return (s, a) => (g(), A($(k), {
|
|
162
|
+
label: e.field.label,
|
|
163
|
+
placeholder: e.field.placeholder,
|
|
164
|
+
required: e.field.required,
|
|
165
|
+
disabled: e.disabled,
|
|
166
|
+
status: v.value,
|
|
167
|
+
"helper-text": n.value,
|
|
168
|
+
type: "date",
|
|
169
|
+
value: String(e.value ?? ""),
|
|
170
|
+
onCoInput: a[0] || (a[0] = (o) => r("update:value", o.detail)),
|
|
171
|
+
onBlur: a[1] || (a[1] = (o) => r("blur"))
|
|
172
|
+
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "value"]));
|
|
184
173
|
}
|
|
185
|
-
}),
|
|
174
|
+
}), ie = /* @__PURE__ */ C({
|
|
186
175
|
__name: "FieldBoolean",
|
|
187
176
|
props: {
|
|
188
177
|
field: {},
|
|
@@ -192,20 +181,17 @@ const X = /* @__PURE__ */ C({
|
|
|
192
181
|
},
|
|
193
182
|
emits: ["update:value"],
|
|
194
183
|
setup(e, { emit: c }) {
|
|
195
|
-
const t = e, r = c,
|
|
196
|
-
return (s,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
onCoChange: o[0] || (o[0] = (h) => r("update:value", h.detail))
|
|
205
|
-
}, null, 8, ["label", "disabled", "status", "helper-text", "checked"]);
|
|
206
|
-
};
|
|
184
|
+
const t = e, r = c, v = f(() => t.errors.length > 0 ? "error" : "default"), n = f(() => t.errors[0] || t.field.helperText);
|
|
185
|
+
return (s, a) => (g(), A($(le), {
|
|
186
|
+
label: e.field.label,
|
|
187
|
+
disabled: e.disabled,
|
|
188
|
+
status: v.value,
|
|
189
|
+
"helper-text": n.value,
|
|
190
|
+
checked: !!e.value,
|
|
191
|
+
onCoChange: a[0] || (a[0] = (o) => r("update:value", o.detail))
|
|
192
|
+
}, null, 8, ["label", "disabled", "status", "helper-text", "checked"]));
|
|
207
193
|
}
|
|
208
|
-
}),
|
|
194
|
+
}), se = /* @__PURE__ */ C({
|
|
209
195
|
__name: "FieldSelect",
|
|
210
196
|
props: {
|
|
211
197
|
field: {},
|
|
@@ -215,27 +201,24 @@ const X = /* @__PURE__ */ C({
|
|
|
215
201
|
},
|
|
216
202
|
emits: ["update:value", "blur"],
|
|
217
203
|
setup(e, { emit: c }) {
|
|
218
|
-
const t = e, r = c,
|
|
219
|
-
const
|
|
220
|
-
return Array.isArray(
|
|
204
|
+
const t = e, r = c, v = f(() => t.errors.length > 0 ? "error" : "default"), n = f(() => t.errors[0] || t.field.helperText), s = f(() => {
|
|
205
|
+
const a = t.field.originalAttrs.enum;
|
|
206
|
+
return Array.isArray(a) ? JSON.stringify(a.map((o) => ({ label: String(o), value: String(o) }))) : "[]";
|
|
221
207
|
});
|
|
222
|
-
return (
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
onBlur: n[1] || (n[1] = (f) => r("blur"))
|
|
235
|
-
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "options", "value"]);
|
|
236
|
-
};
|
|
208
|
+
return (a, o) => (g(), A($(re), {
|
|
209
|
+
label: e.field.label,
|
|
210
|
+
placeholder: e.field.placeholder,
|
|
211
|
+
required: e.field.required,
|
|
212
|
+
disabled: e.disabled,
|
|
213
|
+
status: v.value,
|
|
214
|
+
"helper-text": n.value,
|
|
215
|
+
options: s.value,
|
|
216
|
+
value: String(e.value ?? ""),
|
|
217
|
+
onCoChange: o[0] || (o[0] = (y) => r("update:value", y.detail)),
|
|
218
|
+
onBlur: o[1] || (o[1] = (y) => r("blur"))
|
|
219
|
+
}, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "options", "value"]));
|
|
237
220
|
}
|
|
238
|
-
}),
|
|
221
|
+
}), ue = /* @__PURE__ */ C({
|
|
239
222
|
__name: "FieldRef",
|
|
240
223
|
props: {
|
|
241
224
|
field: {},
|
|
@@ -246,54 +229,53 @@ const X = /* @__PURE__ */ C({
|
|
|
246
229
|
},
|
|
247
230
|
emits: ["update:value", "search", "load-more", "open"],
|
|
248
231
|
setup(e, { emit: c }) {
|
|
249
|
-
const t = e, r = c,
|
|
232
|
+
const t = e, r = c, v = f(() => t.errors.length > 0 ? "error" : "default"), n = f(() => t.errors[0] || t.field.helperText), s = f(
|
|
250
233
|
() => !!t.field.originalAttrs.multiple || t.field.originalAttrs.type === "array"
|
|
251
|
-
),
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
if (Array.isArray(
|
|
255
|
-
const
|
|
256
|
-
return JSON.stringify(
|
|
234
|
+
), a = f(() => {
|
|
235
|
+
const i = t.value;
|
|
236
|
+
if (i == null) return "";
|
|
237
|
+
if (Array.isArray(i)) {
|
|
238
|
+
const p = i.map((S) => typeof S == "string" ? S : (S == null ? void 0 : S._id) || "");
|
|
239
|
+
return JSON.stringify(p);
|
|
257
240
|
}
|
|
258
|
-
return typeof
|
|
259
|
-
}),
|
|
260
|
-
var
|
|
261
|
-
return JSON.stringify(((
|
|
262
|
-
}),
|
|
263
|
-
var
|
|
264
|
-
return JSON.stringify(((
|
|
241
|
+
return typeof i == "string" ? s.value ? JSON.stringify([i]) : i : typeof i == "object" && i._id ? s.value ? JSON.stringify([i._id]) : String(i._id) : "";
|
|
242
|
+
}), o = f(() => {
|
|
243
|
+
var i;
|
|
244
|
+
return JSON.stringify(((i = t.refState) == null ? void 0 : i.options) || []);
|
|
245
|
+
}), y = f(() => {
|
|
246
|
+
var i;
|
|
247
|
+
return JSON.stringify(((i = t.refState) == null ? void 0 : i.selectedDisplay) || []);
|
|
265
248
|
});
|
|
266
|
-
function
|
|
267
|
-
const
|
|
268
|
-
r("update:value",
|
|
249
|
+
function x(i) {
|
|
250
|
+
const p = i.detail ?? {};
|
|
251
|
+
r("update:value", p.value);
|
|
269
252
|
}
|
|
270
|
-
return (
|
|
271
|
-
var
|
|
272
|
-
|
|
273
|
-
return S(), $(x, {
|
|
253
|
+
return (i, p) => {
|
|
254
|
+
var S, q;
|
|
255
|
+
return g(), A($(ae), {
|
|
274
256
|
label: e.field.label,
|
|
275
257
|
placeholder: e.field.placeholder,
|
|
276
258
|
required: e.field.required,
|
|
277
259
|
disabled: e.disabled,
|
|
278
260
|
clearable: !e.field.required,
|
|
279
261
|
multiple: s.value,
|
|
280
|
-
status:
|
|
281
|
-
"helper-text":
|
|
262
|
+
status: v.value,
|
|
263
|
+
"helper-text": n.value,
|
|
282
264
|
model: e.field.originalAttrs.ref,
|
|
283
|
-
value:
|
|
284
|
-
options:
|
|
285
|
-
"selected-display":
|
|
286
|
-
loading: ((
|
|
287
|
-
total: ((
|
|
288
|
-
onCoOpen:
|
|
289
|
-
onCoSearch:
|
|
290
|
-
onCoLoadMore:
|
|
291
|
-
onCoChange:
|
|
292
|
-
onCoClear:
|
|
265
|
+
value: a.value,
|
|
266
|
+
options: o.value,
|
|
267
|
+
"selected-display": y.value,
|
|
268
|
+
loading: ((S = e.refState) == null ? void 0 : S.loading) || !1,
|
|
269
|
+
total: ((q = e.refState) == null ? void 0 : q.total) || 0,
|
|
270
|
+
onCoOpen: p[0] || (p[0] = (B) => r("open")),
|
|
271
|
+
onCoSearch: p[1] || (p[1] = (B) => r("search", B.detail)),
|
|
272
|
+
onCoLoadMore: p[2] || (p[2] = (B) => r("load-more")),
|
|
273
|
+
onCoChange: x,
|
|
274
|
+
onCoClear: p[3] || (p[3] = (B) => r("update:value", s.value ? [] : null))
|
|
293
275
|
}, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "multiple", "status", "helper-text", "model", "value", "options", "selected-display", "loading", "total"]);
|
|
294
276
|
};
|
|
295
277
|
}
|
|
296
|
-
}),
|
|
278
|
+
}), de = /* @__PURE__ */ C({
|
|
297
279
|
__name: "CoFieldRenderer",
|
|
298
280
|
props: {
|
|
299
281
|
field: {},
|
|
@@ -306,34 +288,40 @@ const X = /* @__PURE__ */ C({
|
|
|
306
288
|
emits: ["update:value", "blur", "search", "load-more", "open"],
|
|
307
289
|
setup(e, { emit: c }) {
|
|
308
290
|
const t = {
|
|
309
|
-
text:
|
|
310
|
-
textarea:
|
|
311
|
-
html:
|
|
312
|
-
number:
|
|
313
|
-
date:
|
|
314
|
-
boolean:
|
|
315
|
-
select:
|
|
316
|
-
ref:
|
|
291
|
+
text: D,
|
|
292
|
+
textarea: J,
|
|
293
|
+
html: J,
|
|
294
|
+
number: w,
|
|
295
|
+
date: ne,
|
|
296
|
+
boolean: ie,
|
|
297
|
+
select: se,
|
|
298
|
+
ref: ue,
|
|
299
|
+
rating: w,
|
|
300
|
+
slider: w,
|
|
301
|
+
color: D,
|
|
302
|
+
section: null,
|
|
303
|
+
file: D,
|
|
304
|
+
array: null,
|
|
317
305
|
custom: null
|
|
318
|
-
}, r = e,
|
|
319
|
-
var
|
|
306
|
+
}, r = e, v = c, n = f(() => {
|
|
307
|
+
var a, o;
|
|
320
308
|
const s = r.field.originalAttrs.uiCom;
|
|
321
|
-
return s && ((
|
|
309
|
+
return s && ((a = r.fieldComponents) != null && a[s]) ? r.fieldComponents[s] : (o = r.fieldComponents) != null && o[r.field.kind] ? r.fieldComponents[r.field.kind] : t[r.field.kind] ?? null;
|
|
322
310
|
});
|
|
323
|
-
return (s,
|
|
311
|
+
return (s, a) => (g(), A(Z(n.value), {
|
|
324
312
|
field: e.field,
|
|
325
313
|
value: e.value,
|
|
326
314
|
errors: e.errors,
|
|
327
315
|
disabled: e.disabled,
|
|
328
316
|
"ref-state": e.refState,
|
|
329
|
-
"onUpdate:value":
|
|
330
|
-
onBlur:
|
|
331
|
-
onSearch:
|
|
332
|
-
onLoadMore:
|
|
333
|
-
onOpen:
|
|
317
|
+
"onUpdate:value": a[0] || (a[0] = (o) => v("update:value", o)),
|
|
318
|
+
onBlur: a[1] || (a[1] = (o) => v("blur")),
|
|
319
|
+
onSearch: a[2] || (a[2] = (o) => v("search", o)),
|
|
320
|
+
onLoadMore: a[3] || (a[3] = (o) => v("load-more")),
|
|
321
|
+
onOpen: a[4] || (a[4] = (o) => v("open"))
|
|
334
322
|
}, null, 40, ["field", "value", "errors", "disabled", "ref-state"]));
|
|
335
323
|
}
|
|
336
|
-
}),
|
|
324
|
+
}), fe = { class: "co-form-footer" }, L = 20, me = /* @__PURE__ */ C({
|
|
337
325
|
__name: "CoFormRenderer",
|
|
338
326
|
props: {
|
|
339
327
|
form: {},
|
|
@@ -343,9 +331,9 @@ const X = /* @__PURE__ */ C({
|
|
|
343
331
|
fieldComponents: {},
|
|
344
332
|
refResolver: { type: Function }
|
|
345
333
|
},
|
|
346
|
-
emits: ["submit", "invalid"],
|
|
334
|
+
emits: ["submit", "invalid", "change"],
|
|
347
335
|
setup(e, { emit: c }) {
|
|
348
|
-
const t = e, r = c,
|
|
336
|
+
const t = e, r = c, v = f(() => t.layout ?? "grid"), n = f(() => {
|
|
349
337
|
const l = new Set(t.excludeFields ?? []);
|
|
350
338
|
return t.form.fields.value.filter((u) => !u.hidden && !l.has(u.name));
|
|
351
339
|
}), s = /* @__PURE__ */ new Set([
|
|
@@ -357,26 +345,29 @@ const X = /* @__PURE__ */ C({
|
|
|
357
345
|
"objectEditor",
|
|
358
346
|
"langEditor"
|
|
359
347
|
]);
|
|
360
|
-
function
|
|
361
|
-
var
|
|
348
|
+
function a(l) {
|
|
349
|
+
var d;
|
|
362
350
|
if (l.fullWidth) return !0;
|
|
363
|
-
const u = (
|
|
351
|
+
const u = (d = l.originalAttrs) == null ? void 0 : d.uiCom;
|
|
364
352
|
return typeof u == "string" && s.has(u);
|
|
365
353
|
}
|
|
366
|
-
function
|
|
354
|
+
function o(l) {
|
|
367
355
|
return t.form.touched.value[l.name] ? t.form.errors.value[l.name] || [] : [];
|
|
368
356
|
}
|
|
369
|
-
|
|
357
|
+
function y(l, u) {
|
|
358
|
+
t.form.setValue(l, u), r("change", { name: l, value: u });
|
|
359
|
+
}
|
|
360
|
+
async function x() {
|
|
370
361
|
const l = await t.form.submit();
|
|
371
362
|
if (!l.isValid) {
|
|
372
363
|
t.form.touchAll(), r("invalid", l.errors);
|
|
373
364
|
return;
|
|
374
365
|
}
|
|
375
|
-
const u = t.form.fields.value.reduce((
|
|
376
|
-
r("submit", { values:
|
|
366
|
+
const u = t.form.fields.value.reduce((d, m) => (d[m.name] = m.ajvProperty, d), {});
|
|
367
|
+
r("submit", { values: H(l.values, u) });
|
|
377
368
|
}
|
|
378
|
-
const
|
|
379
|
-
function
|
|
369
|
+
const i = Q({});
|
|
370
|
+
function p() {
|
|
380
371
|
return {
|
|
381
372
|
options: [],
|
|
382
373
|
selectedDisplay: [],
|
|
@@ -387,140 +378,137 @@ const X = /* @__PURE__ */ C({
|
|
|
387
378
|
query: ""
|
|
388
379
|
};
|
|
389
380
|
}
|
|
390
|
-
function
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
value:
|
|
394
|
-
label: String(
|
|
395
|
-
meta:
|
|
381
|
+
function S(l, u) {
|
|
382
|
+
const d = l.originalAttrs.displayName || "name", m = [], h = [], F = (b) => {
|
|
383
|
+
b && (typeof b == "string" ? m.push(b) : typeof b == "object" && b._id && (m.push(b._id), h.push({
|
|
384
|
+
value: b._id,
|
|
385
|
+
label: String(b[d] ?? b.name ?? b._id),
|
|
386
|
+
meta: b
|
|
396
387
|
})));
|
|
397
388
|
};
|
|
398
|
-
return Array.isArray(u) ? u.forEach(F) : F(u), { ids:
|
|
389
|
+
return Array.isArray(u) ? u.forEach(F) : F(u), { ids: m, display: h };
|
|
399
390
|
}
|
|
400
|
-
async function
|
|
391
|
+
async function q(l, u) {
|
|
401
392
|
if (!t.refResolver) return;
|
|
402
|
-
const
|
|
403
|
-
|
|
393
|
+
const d = i[l.name] || p();
|
|
394
|
+
d.loading = !0, i[l.name] = { ...d };
|
|
404
395
|
try {
|
|
405
|
-
const
|
|
396
|
+
const m = await t.refResolver({
|
|
406
397
|
model: l.originalAttrs.ref,
|
|
407
|
-
pageSize:
|
|
398
|
+
pageSize: L,
|
|
408
399
|
...u
|
|
409
|
-
}),
|
|
410
|
-
|
|
411
|
-
...
|
|
412
|
-
options: F ? [...
|
|
413
|
-
total:
|
|
414
|
-
hasMore:
|
|
400
|
+
}), h = i[l.name], F = (u.page ?? 1) > 1;
|
|
401
|
+
i[l.name] = {
|
|
402
|
+
...h,
|
|
403
|
+
options: F ? [...h.options, ...m.options] : m.options,
|
|
404
|
+
total: m.total ?? m.options.length,
|
|
405
|
+
hasMore: m.hasMore ?? (u.page ?? 1) * L < (m.total ?? m.options.length),
|
|
415
406
|
page: u.page ?? 1,
|
|
416
|
-
query: u.query ??
|
|
407
|
+
query: u.query ?? h.query,
|
|
417
408
|
loading: !1
|
|
418
409
|
};
|
|
419
|
-
} catch (
|
|
420
|
-
console.error("[CoFormRenderer] refResolver failed:",
|
|
410
|
+
} catch (m) {
|
|
411
|
+
console.error("[CoFormRenderer] refResolver failed:", m), i[l.name] = { ...i[l.name], loading: !1 };
|
|
421
412
|
}
|
|
422
413
|
}
|
|
423
|
-
async function
|
|
414
|
+
async function B(l, u) {
|
|
424
415
|
if (!t.refResolver) return;
|
|
425
|
-
const
|
|
426
|
-
|
|
416
|
+
const d = i[l.name] || p();
|
|
417
|
+
d.loading = !0, i[l.name] = { ...d };
|
|
427
418
|
try {
|
|
428
|
-
const
|
|
429
|
-
for (const
|
|
430
|
-
F.has(
|
|
431
|
-
|
|
432
|
-
} catch (
|
|
433
|
-
console.error("[CoFormRenderer] hydrateRef failed:",
|
|
419
|
+
const m = await t.refResolver({ model: l.originalAttrs.ref, ids: u }), h = i[l.name], F = new Set(h.selectedDisplay.map((R) => R.value)), b = [...h.selectedDisplay];
|
|
420
|
+
for (const R of m.options)
|
|
421
|
+
F.has(R.value) || b.push(R);
|
|
422
|
+
i[l.name] = { ...h, selectedDisplay: b, loading: !1 };
|
|
423
|
+
} catch (m) {
|
|
424
|
+
console.error("[CoFormRenderer] hydrateRef failed:", m), i[l.name] = { ...i[l.name], loading: !1 };
|
|
434
425
|
}
|
|
435
426
|
}
|
|
436
|
-
function
|
|
427
|
+
function E() {
|
|
437
428
|
for (const l of t.form.fields.value) {
|
|
438
429
|
if (l.kind !== "ref") continue;
|
|
439
|
-
const { ids: u, display:
|
|
440
|
-
|
|
441
|
-
const
|
|
442
|
-
|
|
430
|
+
const { ids: u, display: d } = S(l, t.form.values.value[l.name]);
|
|
431
|
+
i[l.name] = { ...p(), selectedDisplay: d };
|
|
432
|
+
const m = u.filter((h) => !d.some((F) => F.value === h));
|
|
433
|
+
m.length > 0 && B(l, m);
|
|
443
434
|
}
|
|
444
435
|
}
|
|
445
|
-
|
|
446
|
-
function
|
|
447
|
-
const u =
|
|
448
|
-
u && u.options.length === 0 && !u.loading &&
|
|
436
|
+
X(E), U(() => t.form.fields.value, E, { flush: "post" });
|
|
437
|
+
function j(l) {
|
|
438
|
+
const u = i[l.name];
|
|
439
|
+
u && u.options.length === 0 && !u.loading && q(l, { query: "", page: 1 });
|
|
449
440
|
}
|
|
450
|
-
function
|
|
451
|
-
|
|
441
|
+
function z(l, u) {
|
|
442
|
+
q(l, { query: u, page: 1 });
|
|
452
443
|
}
|
|
453
|
-
function
|
|
454
|
-
const u =
|
|
455
|
-
!u || u.loading || !u.hasMore ||
|
|
444
|
+
function P(l) {
|
|
445
|
+
const u = i[l.name];
|
|
446
|
+
!u || u.loading || !u.hasMore || q(l, { query: u.query, page: u.page + 1 });
|
|
456
447
|
}
|
|
457
|
-
return (l, u) => {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
448
|
+
return (l, u) => (g(), T("form", {
|
|
449
|
+
onSubmit: Y(x, ["prevent"])
|
|
450
|
+
}, [
|
|
451
|
+
V(l.$slots, "header", { form: e.form }, void 0, !0),
|
|
452
|
+
O("div", {
|
|
453
|
+
class: N(["co-form-layout", `co-form-layout--${v.value}`])
|
|
461
454
|
}, [
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
class:
|
|
455
|
+
(g(!0), T(_, null, ee(n.value, (d) => (g(), T("div", {
|
|
456
|
+
key: d.name,
|
|
457
|
+
class: N(["co-form-field", { "co-form-field--full": a(d) }])
|
|
465
458
|
}, [
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
value: e.form.values.value[i.name],
|
|
473
|
-
errors: n(i),
|
|
474
|
-
setValue: (p) => e.form.setValue(i.name, p),
|
|
475
|
-
touch: () => e.form.touch(i.name)
|
|
476
|
-
}, () => [
|
|
477
|
-
M(re, {
|
|
478
|
-
field: i,
|
|
479
|
-
value: e.form.values.value[i.name],
|
|
480
|
-
errors: n(i),
|
|
481
|
-
disabled: e.disabled || i.disabled,
|
|
482
|
-
"ref-state": f[i.name],
|
|
483
|
-
"field-components": e.fieldComponents,
|
|
484
|
-
"onUpdate:value": (p) => e.form.setValue(i.name, p),
|
|
485
|
-
onBlur: (p) => e.form.touch(i.name),
|
|
486
|
-
onSearch: (p) => L(i, p),
|
|
487
|
-
onLoadMore: (p) => I(i),
|
|
488
|
-
onOpen: (p) => q(i)
|
|
489
|
-
}, null, 8, ["field", "value", "errors", "disabled", "ref-state", "field-components", "onUpdate:value", "onBlur", "onSearch", "onLoadMore", "onOpen"])
|
|
490
|
-
], !0)
|
|
491
|
-
], 2))), 128))
|
|
492
|
-
], 2),
|
|
493
|
-
k("div", oe, [
|
|
494
|
-
w(l.$slots, "footer", {
|
|
495
|
-
form: e.form,
|
|
496
|
-
submit: h
|
|
459
|
+
V(l.$slots, `field:${d.name}`, {
|
|
460
|
+
field: d,
|
|
461
|
+
value: e.form.values.value[d.name],
|
|
462
|
+
errors: o(d),
|
|
463
|
+
setValue: (m) => e.form.setValue(d.name, m),
|
|
464
|
+
touch: () => e.form.touch(d.name)
|
|
497
465
|
}, () => [
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
466
|
+
I(de, {
|
|
467
|
+
field: d,
|
|
468
|
+
value: e.form.values.value[d.name],
|
|
469
|
+
errors: o(d),
|
|
470
|
+
disabled: e.disabled || d.disabled,
|
|
471
|
+
"ref-state": i[d.name],
|
|
472
|
+
"field-components": e.fieldComponents,
|
|
473
|
+
"onUpdate:value": (m) => y(d.name, m),
|
|
474
|
+
onBlur: (m) => e.form.touch(d.name),
|
|
475
|
+
onSearch: (m) => z(d, m),
|
|
476
|
+
onLoadMore: (m) => P(d),
|
|
477
|
+
onOpen: (m) => j(d)
|
|
478
|
+
}, null, 8, ["field", "value", "errors", "disabled", "ref-state", "field-components", "onUpdate:value", "onBlur", "onSearch", "onLoadMore", "onOpen"])
|
|
503
479
|
], !0)
|
|
504
|
-
])
|
|
505
|
-
],
|
|
506
|
-
|
|
480
|
+
], 2))), 128))
|
|
481
|
+
], 2),
|
|
482
|
+
O("div", fe, [
|
|
483
|
+
V(l.$slots, "footer", {
|
|
484
|
+
form: e.form,
|
|
485
|
+
submit: x
|
|
486
|
+
}, () => [
|
|
487
|
+
I($(oe), {
|
|
488
|
+
type: "submit",
|
|
489
|
+
label: "Enviar",
|
|
490
|
+
variant: "primary"
|
|
491
|
+
})
|
|
492
|
+
], !0)
|
|
493
|
+
])
|
|
494
|
+
], 32));
|
|
507
495
|
}
|
|
508
|
-
}),
|
|
496
|
+
}), ce = (e, c) => {
|
|
509
497
|
const t = e.__vccOpts || e;
|
|
510
|
-
for (const [r,
|
|
511
|
-
t[r] =
|
|
498
|
+
for (const [r, v] of c)
|
|
499
|
+
t[r] = v;
|
|
512
500
|
return t;
|
|
513
|
-
},
|
|
501
|
+
}, ge = /* @__PURE__ */ ce(me, [["__scopeId", "data-v-5700cb3a"]]);
|
|
514
502
|
export {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
503
|
+
de as CoFieldRenderer,
|
|
504
|
+
ge as CoFormRenderer,
|
|
505
|
+
ie as FieldBoolean,
|
|
506
|
+
ne as FieldDate,
|
|
507
|
+
w as FieldNumber,
|
|
508
|
+
ue as FieldRef,
|
|
509
|
+
se as FieldSelect,
|
|
510
|
+
D as FieldText,
|
|
511
|
+
J as FieldTextArea,
|
|
512
|
+
xe as createForm,
|
|
513
|
+
he as useForm
|
|
526
514
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prolibu-suite/cobalt-form-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Cobalt Form — Vue 3 adapter. useForm() composable + CoFormRenderer component.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,10 +27,11 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"vue": "^3.0.0",
|
|
30
|
-
"@prolibu-suite/cobalt-core": "0.1.
|
|
30
|
+
"@prolibu-suite/cobalt-core": "0.1.2",
|
|
31
|
+
"@prolibu-suite/cobalt-vue": "0.1.2"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@prolibu-suite/cobalt-form-core": "0.
|
|
34
|
+
"@prolibu-suite/cobalt-form-core": "0.2.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@vitejs/plugin-vue": "^5.2.1",
|