@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.
@@ -1 +1 @@
1
- {"version":3,"file":"CoFieldRenderer.vue.d.ts","sourceRoot":"","sources":["../../src/components/CoFieldRenderer.vue"],"names":[],"mappings":"AAqEA,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;AAchE,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"}
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":"AAuQA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3E,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;AA0CF,iBAAe,QAAQ,kBAYtB;AAyOD,QAAA,IAAI,OAAO;;CAAU,EAAE,OAAO,mBAAU,EAAE,OAAO;;;;kBA7ElC,GAAG;;CA6EyC,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;AA8B/C,QAAA,MAAM,eAAe;;gBA7TS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;gBAAnB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;kFAoU/C,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
+ {"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":"AAgCA,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;;;;;;AAsEF,wBAOG"}
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":"AAqCA,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;;;;;;;;AAmFF,wBAOG"}
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":"AA0CA,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;;;;;;;;AA4FF,wBAOG"}
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":"AAqFA,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;;;;;;;;;;;;AAgJF,wBAOG"}
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":"AA2CA,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;;;;;;;;AA0FF,wBAOG"}
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":"AA+CA,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;;;;;;;;AA8FF,wBAOG"}
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":"AAqCA,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;;;;;;;;AAmFF,wBAOG"}
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-a8eb8e10]{display:grid;gap:var(--co-spacing-lg, 16px)}.co-form-layout--grid[data-v-a8eb8e10]{grid-template-columns:repeat(2,minmax(0,1fr))}.co-form-layout--stack[data-v-a8eb8e10]{grid-template-columns:1fr}.co-form-field--full[data-v-a8eb8e10]{grid-column:1 / -1}@media(max-width:640px){.co-form-layout--grid[data-v-a8eb8e10]{grid-template-columns:1fr}}.co-form-footer[data-v-a8eb8e10]{margin-top:var(--co-spacing-2xl, 24px)}
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 U, normalizeForValidation as j } from "@prolibu-suite/cobalt-form-core";
2
- import { createForm as me } from "@prolibu-suite/cobalt-form-core";
3
- import { shallowRef as D, watch as J, toValue as z, onBeforeUnmount as P, computed as d, defineComponent as C, resolveComponent as A, openBlock as S, createBlock as $, resolveDynamicComponent as W, reactive as H, onMounted as G, createElementBlock as V, withModifiers as K, renderSlot as w, createElementVNode as k, normalizeClass as E, Fragment as Z, renderList as Q, createVNode as M } from "vue";
4
- function ue(e) {
5
- const c = D(null), t = D({
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 m(a) {
15
+ function v(n) {
15
16
  r == null || r();
16
- const s = U(a);
17
- c.value = s, t.value = s.state, r = s.subscribe((o) => {
18
- t.value = o;
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 J(
22
- () => z(e),
23
- (a) => m(a),
22
+ return U(
23
+ () => G(e),
24
+ (n) => v(n),
24
25
  { immediate: !0, deep: !1 }
25
- ), P(() => {
26
+ ), K(() => {
26
27
  r == null || r(), r = null;
27
28
  }), {
28
29
  controller: c,
29
- values: d(() => t.value.values),
30
- errors: d(() => t.value.errors),
31
- touched: d(() => t.value.touched),
32
- isValid: d(() => t.value.isValid),
33
- isDirty: d(() => t.value.isDirty),
34
- isSubmitting: d(() => t.value.isSubmitting),
35
- fields: d(() => {
36
- var a;
37
- return ((a = c.value) == null ? void 0 : a.fields) ?? [];
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: (a, s) => {
40
- var o;
41
- return (o = c.value) == null ? void 0 : o.setValue(a, s);
40
+ setValue: (n, s) => {
41
+ var a;
42
+ return (a = c.value) == null ? void 0 : a.setValue(n, s);
42
43
  },
43
- setValues: (a) => {
44
+ setValues: (n) => {
44
45
  var s;
45
- return (s = c.value) == null ? void 0 : s.setValues(a);
46
+ return (s = c.value) == null ? void 0 : s.setValues(n);
46
47
  },
47
- touch: (a) => {
48
+ touch: (n) => {
48
49
  var s;
49
- return (s = c.value) == null ? void 0 : s.touch(a);
50
+ return (s = c.value) == null ? void 0 : s.touch(n);
50
51
  },
51
52
  touchAll: () => {
52
- var a;
53
- return (a = c.value) == null ? void 0 : a.touchAll();
53
+ var n;
54
+ return (n = c.value) == null ? void 0 : n.touchAll();
54
55
  },
55
- setSchema: (a) => {
56
+ setSchema: (n) => {
56
57
  var s;
57
- return (s = c.value) == null ? void 0 : s.setSchema(a);
58
+ return (s = c.value) == null ? void 0 : s.setSchema(n);
58
59
  },
59
60
  validate: () => {
60
- var a;
61
- return ((a = c.value) == null ? void 0 : a.validate()) ?? !0;
61
+ var n;
62
+ return ((n = c.value) == null ? void 0 : n.validate()) ?? !0;
62
63
  },
63
64
  submit: () => {
64
- var a;
65
- return ((a = c.value) == null ? void 0 : a.submit()) ?? Promise.resolve({ values: {}, isValid: !0, errors: {} });
65
+ var n;
66
+ return ((n = c.value) == null ? void 0 : n.submit()) ?? Promise.resolve({ values: {}, isValid: !0, errors: {} });
66
67
  },
67
- reset: (a) => {
68
+ reset: (n) => {
68
69
  var s;
69
- return (s = c.value) == null ? void 0 : s.reset(a);
70
+ return (s = c.value) == null ? void 0 : s.reset(n);
70
71
  }
71
72
  };
72
73
  }
73
- const X = /* @__PURE__ */ C({
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, m = d(() => t.errors.length > 0 ? "error" : "default"), a = d(() => t.errors[0] || t.field.helperText), s = d(() => {
84
- const o = t.field.originalAttrs, n = o.format || o.uiCom;
85
- return n === "email" || t.field.name === "email" ? "email" : n === "password" || n === "Password" ? "password" : n === "tel" || n === "phone" ? "tel" : n === "url" ? "url" : "text";
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 (o, n) => {
88
- const h = A("co-input");
89
- return S(), $(h, {
90
- label: e.field.label,
91
- placeholder: e.field.placeholder,
92
- required: e.field.required,
93
- disabled: e.disabled,
94
- status: m.value,
95
- "helper-text": a.value,
96
- type: s.value,
97
- value: String(e.value ?? ""),
98
- onCoInput: n[0] || (n[0] = (f) => r("update:value", f.detail)),
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
- }), O = /* @__PURE__ */ C({
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, m = d(() => t.errors.length > 0 ? "error" : "default"), a = d(() => t.errors[0] || t.field.helperText);
114
- return (s, o) => {
115
- const n = A("co-input");
116
- return S(), $(n, {
117
- label: e.field.label,
118
- placeholder: e.field.placeholder,
119
- required: e.field.required,
120
- disabled: e.disabled,
121
- status: m.value,
122
- "helper-text": a.value,
123
- multiline: "",
124
- value: String(e.value ?? ""),
125
- onCoInput: o[0] || (o[0] = (h) => r("update:value", h.detail)),
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
- }), Y = /* @__PURE__ */ C({
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, m = d(() => t.errors.length > 0 ? "error" : "default"), a = d(() => t.errors[0] || t.field.helperText), s = d(() => t.field.originalAttrs.min), o = d(() => t.field.originalAttrs.max), n = d(() => typeof t.value == "number" ? t.value : void 0);
141
- return (h, f) => {
142
- const v = A("co-number-field");
143
- return S(), $(v, {
144
- label: e.field.label,
145
- placeholder: e.field.placeholder,
146
- required: e.field.required,
147
- disabled: e.disabled,
148
- status: m.value,
149
- "helper-text": a.value,
150
- min: s.value,
151
- max: o.value,
152
- value: n.value,
153
- onCoChange: f[0] || (f[0] = (y) => r("update:value", y.detail)),
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
- }), _ = /* @__PURE__ */ C({
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, m = d(() => t.errors.length > 0 ? "error" : "default"), a = d(() => t.errors[0] || t.field.helperText);
169
- return (s, o) => {
170
- const n = A("co-input");
171
- return S(), $(n, {
172
- label: e.field.label,
173
- placeholder: e.field.placeholder,
174
- required: e.field.required,
175
- disabled: e.disabled,
176
- status: m.value,
177
- "helper-text": a.value,
178
- type: "date",
179
- value: String(e.value ?? ""),
180
- onCoInput: o[0] || (o[0] = (h) => r("update:value", h.detail)),
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
- }), ee = /* @__PURE__ */ C({
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, m = d(() => t.errors.length > 0 ? "error" : "default"), a = d(() => t.errors[0] || t.field.helperText);
196
- return (s, o) => {
197
- const n = A("co-switch");
198
- return S(), $(n, {
199
- label: e.field.label,
200
- disabled: e.disabled,
201
- status: m.value,
202
- "helper-text": a.value,
203
- checked: !!e.value,
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
- }), te = /* @__PURE__ */ C({
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, m = d(() => t.errors.length > 0 ? "error" : "default"), a = d(() => t.errors[0] || t.field.helperText), s = d(() => {
219
- const o = t.field.originalAttrs.enum;
220
- return Array.isArray(o) ? JSON.stringify(o.map((n) => ({ label: String(n), value: String(n) }))) : "[]";
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 (o, n) => {
223
- const h = A("co-select");
224
- return S(), $(h, {
225
- label: e.field.label,
226
- placeholder: e.field.placeholder,
227
- required: e.field.required,
228
- disabled: e.disabled,
229
- status: m.value,
230
- "helper-text": a.value,
231
- options: s.value,
232
- value: String(e.value ?? ""),
233
- onCoChange: n[0] || (n[0] = (f) => r("update:value", f.detail)),
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
- }), le = /* @__PURE__ */ C({
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, m = d(() => t.errors.length > 0 ? "error" : "default"), a = d(() => t.errors[0] || t.field.helperText), s = d(
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
- ), o = d(() => {
252
- const v = t.value;
253
- if (v == null) return "";
254
- if (Array.isArray(v)) {
255
- const y = v.map((x) => typeof x == "string" ? x : (x == null ? void 0 : x._id) || "");
256
- return JSON.stringify(y);
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 v == "string" ? s.value ? JSON.stringify([v]) : v : typeof v == "object" && v._id ? s.value ? JSON.stringify([v._id]) : String(v._id) : "";
259
- }), n = d(() => {
260
- var v;
261
- return JSON.stringify(((v = t.refState) == null ? void 0 : v.options) || []);
262
- }), h = d(() => {
263
- var v;
264
- return JSON.stringify(((v = t.refState) == null ? void 0 : v.selectedDisplay) || []);
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 f(v) {
267
- const y = v.detail ?? {};
268
- r("update:value", y.value);
249
+ function x(i) {
250
+ const p = i.detail ?? {};
251
+ r("update:value", p.value);
269
252
  }
270
- return (v, y) => {
271
- var R, B;
272
- const x = A("co-ref-field");
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: m.value,
281
- "helper-text": a.value,
262
+ status: v.value,
263
+ "helper-text": n.value,
282
264
  model: e.field.originalAttrs.ref,
283
- value: o.value,
284
- options: n.value,
285
- "selected-display": h.value,
286
- loading: ((R = e.refState) == null ? void 0 : R.loading) || !1,
287
- total: ((B = e.refState) == null ? void 0 : B.total) || 0,
288
- onCoOpen: y[0] || (y[0] = (q) => r("open")),
289
- onCoSearch: y[1] || (y[1] = (q) => r("search", q.detail)),
290
- onCoLoadMore: y[2] || (y[2] = (q) => r("load-more")),
291
- onCoChange: f,
292
- onCoClear: y[3] || (y[3] = (q) => r("update:value", s.value ? [] : null))
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
- }), re = /* @__PURE__ */ C({
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: X,
310
- textarea: O,
311
- html: O,
312
- number: Y,
313
- date: _,
314
- boolean: ee,
315
- select: te,
316
- ref: le,
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, m = c, a = d(() => {
319
- var o, n;
306
+ }, r = e, v = c, n = f(() => {
307
+ var a, o;
320
308
  const s = r.field.originalAttrs.uiCom;
321
- return s && ((o = r.fieldComponents) != null && o[s]) ? r.fieldComponents[s] : (n = r.fieldComponents) != null && n[r.field.kind] ? r.fieldComponents[r.field.kind] : t[r.field.kind] ?? null;
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, o) => (S(), $(W(a.value), {
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": o[0] || (o[0] = (n) => m("update:value", n)),
330
- onBlur: o[1] || (o[1] = (n) => m("blur")),
331
- onSearch: o[2] || (o[2] = (n) => m("search", n)),
332
- onLoadMore: o[3] || (o[3] = (n) => m("load-more")),
333
- onOpen: o[4] || (o[4] = (n) => m("open"))
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
- }), oe = { class: "co-form-footer" }, N = 20, ae = /* @__PURE__ */ C({
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, m = d(() => t.layout ?? "grid"), a = d(() => {
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 o(l) {
361
- var b;
348
+ function a(l) {
349
+ var d;
362
350
  if (l.fullWidth) return !0;
363
- const u = (b = l.originalAttrs) == null ? void 0 : b.uiCom;
351
+ const u = (d = l.originalAttrs) == null ? void 0 : d.uiCom;
364
352
  return typeof u == "string" && s.has(u);
365
353
  }
366
- function n(l) {
354
+ function o(l) {
367
355
  return t.form.touched.value[l.name] ? t.form.errors.value[l.name] || [] : [];
368
356
  }
369
- async function h() {
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((b, i) => (b[i.name] = i.ajvProperty, b), {});
376
- r("submit", { values: j(l.values, u) });
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 f = H({});
379
- function v() {
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 y(l, u) {
391
- const b = l.originalAttrs.displayName || "name", i = [], p = [], F = (g) => {
392
- g && (typeof g == "string" ? i.push(g) : typeof g == "object" && g._id && (i.push(g._id), p.push({
393
- value: g._id,
394
- label: String(g[b] ?? g.name ?? g._id),
395
- meta: g
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: i, display: p };
389
+ return Array.isArray(u) ? u.forEach(F) : F(u), { ids: m, display: h };
399
390
  }
400
- async function x(l, u) {
391
+ async function q(l, u) {
401
392
  if (!t.refResolver) return;
402
- const b = f[l.name] || v();
403
- b.loading = !0, f[l.name] = { ...b };
393
+ const d = i[l.name] || p();
394
+ d.loading = !0, i[l.name] = { ...d };
404
395
  try {
405
- const i = await t.refResolver({
396
+ const m = await t.refResolver({
406
397
  model: l.originalAttrs.ref,
407
- pageSize: N,
398
+ pageSize: L,
408
399
  ...u
409
- }), p = f[l.name], F = (u.page ?? 1) > 1;
410
- f[l.name] = {
411
- ...p,
412
- options: F ? [...p.options, ...i.options] : i.options,
413
- total: i.total ?? i.options.length,
414
- hasMore: i.hasMore ?? (u.page ?? 1) * N < (i.total ?? i.options.length),
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 ?? p.query,
407
+ query: u.query ?? h.query,
417
408
  loading: !1
418
409
  };
419
- } catch (i) {
420
- console.error("[CoFormRenderer] refResolver failed:", i), f[l.name] = { ...f[l.name], loading: !1 };
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 R(l, u) {
414
+ async function B(l, u) {
424
415
  if (!t.refResolver) return;
425
- const b = f[l.name] || v();
426
- b.loading = !0, f[l.name] = { ...b };
416
+ const d = i[l.name] || p();
417
+ d.loading = !0, i[l.name] = { ...d };
427
418
  try {
428
- const i = await t.refResolver({ model: l.originalAttrs.ref, ids: u }), p = f[l.name], F = new Set(p.selectedDisplay.map((T) => T.value)), g = [...p.selectedDisplay];
429
- for (const T of i.options)
430
- F.has(T.value) || g.push(T);
431
- f[l.name] = { ...p, selectedDisplay: g, loading: !1 };
432
- } catch (i) {
433
- console.error("[CoFormRenderer] hydrateRef failed:", i), f[l.name] = { ...f[l.name], loading: !1 };
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 B() {
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: b } = y(l, t.form.values.value[l.name]);
440
- f[l.name] = { ...v(), selectedDisplay: b };
441
- const i = u.filter((p) => !b.some((F) => F.value === p));
442
- i.length > 0 && R(l, i);
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
- G(B), J(() => t.form.fields.value, B, { flush: "post" });
446
- function q(l) {
447
- const u = f[l.name];
448
- u && u.options.length === 0 && !u.loading && x(l, { query: "", page: 1 });
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 L(l, u) {
451
- x(l, { query: u, page: 1 });
441
+ function z(l, u) {
442
+ q(l, { query: u, page: 1 });
452
443
  }
453
- function I(l) {
454
- const u = f[l.name];
455
- !u || u.loading || !u.hasMore || x(l, { query: u.query, page: u.page + 1 });
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
- const b = A("co-button");
459
- return S(), V("form", {
460
- onSubmit: K(h, ["prevent"])
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
- w(l.$slots, "header", { form: e.form }, void 0, !0),
463
- k("div", {
464
- class: E(["co-form-layout", `co-form-layout--${m.value}`])
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
- (S(!0), V(Z, null, Q(a.value, (i) => (S(), V("div", {
467
- key: i.name,
468
- class: E(["co-form-field", { "co-form-field--full": o(i) }])
469
- }, [
470
- w(l.$slots, `field:${i.name}`, {
471
- field: i,
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
- M(b, {
499
- type: "submit",
500
- label: "Enviar",
501
- variant: "primary"
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
- ], 32);
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
- }), ne = (e, c) => {
496
+ }), ce = (e, c) => {
509
497
  const t = e.__vccOpts || e;
510
- for (const [r, m] of c)
511
- t[r] = m;
498
+ for (const [r, v] of c)
499
+ t[r] = v;
512
500
  return t;
513
- }, de = /* @__PURE__ */ ne(ae, [["__scopeId", "data-v-a8eb8e10"]]);
501
+ }, ge = /* @__PURE__ */ ce(me, [["__scopeId", "data-v-5700cb3a"]]);
514
502
  export {
515
- re as CoFieldRenderer,
516
- de as CoFormRenderer,
517
- ee as FieldBoolean,
518
- _ as FieldDate,
519
- Y as FieldNumber,
520
- le as FieldRef,
521
- te as FieldSelect,
522
- X as FieldText,
523
- O as FieldTextArea,
524
- me as createForm,
525
- ue as useForm
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.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.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.1.1"
34
+ "@prolibu-suite/cobalt-form-core": "0.2.0"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@vitejs/plugin-vue": "^5.2.1",