@appmax_npm/ds-prime 1.0.0-alpha.104 → 1.0.0-alpha.106

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/amfield/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { defineComponent as m, createPropsRestProxy as d, useAttrs as i, openBlock as o, createBlock as s, unref as b, withCtx as t, createVNode as c, resolveDynamicComponent as u, mergeProps as f } from "vue";
2
- import { _ } from "../AmFieldWrapper.vue_vue_type_script_setup_true_lang-DO4K4-35.js";
3
- import h from "primevue/inputtext";
4
- import { FormField as y } from "@primevue/forms";
5
- const P = { name: "AmField" }, A = /* @__PURE__ */ m({
6
- ...P,
1
+ import { defineComponent as m, createPropsRestProxy as p, openBlock as o, createBlock as s, unref as d, withCtx as t, createVNode as i, resolveDynamicComponent as b, mergeProps as u } from "vue";
2
+ import { _ as c } from "../AmFieldWrapper.vue_vue_type_script_setup_true_lang-DO4K4-35.js";
3
+ import f from "primevue/inputtext";
4
+ import { FormField as _ } from "@primevue/forms";
5
+ const h = { name: "AmField" }, g = /* @__PURE__ */ m({
6
+ ...h,
7
7
  props: {
8
- as: { default: () => h },
8
+ as: { default: () => f },
9
9
  name: {},
10
10
  class: {},
11
11
  style: {},
@@ -14,21 +14,21 @@ const P = { name: "AmField" }, A = /* @__PURE__ */ m({
14
14
  disabled: { type: Boolean }
15
15
  },
16
16
  setup(n) {
17
- const a = d(n, ["as", "help", "label"]), p = { ...i(), ...a };
18
- return (e, B) => (o(), s(b(y), {
17
+ const a = p(n, ["as", "help", "label"]);
18
+ return (e, y) => (o(), s(d(_), {
19
19
  name: a.name
20
20
  }, {
21
21
  default: t((r) => {
22
22
  var l;
23
23
  return [
24
- c(_, {
24
+ i(c, {
25
25
  help: e.help,
26
26
  label: e.label,
27
27
  error: (l = r == null ? void 0 : r.error) == null ? void 0 : l.message,
28
28
  disabled: a.disabled
29
29
  }, {
30
30
  default: t(() => [
31
- (o(), s(u(e.as), f(p, { disabled: e.disabled }), null, 16, ["disabled"]))
31
+ (o(), s(b(e.as), u({ ...e.$attrs, ...a }, { disabled: e.disabled }), null, 16, ["disabled"]))
32
32
  ]),
33
33
  _: 2
34
34
  }, 1032, ["help", "label", "error", "disabled"])
@@ -39,5 +39,5 @@ const P = { name: "AmField" }, A = /* @__PURE__ */ m({
39
39
  }
40
40
  });
41
41
  export {
42
- A as default
42
+ g as default
43
43
  };
package/amform/index.d.ts CHANGED
@@ -1,15 +1,47 @@
1
- import { AllowedComponentProps, Component, DefineComponent, VNode } from 'vue';
1
+ import type { FormFieldState, FormSubmitEvent } from '@primevue/forms';
2
+ import type { DefineComponent, VNode } from 'vue';
2
3
  import type { ZodObject } from 'zod';
3
4
 
4
5
  export interface AmFormProps {
5
6
  schema: ZodObject;
7
+ modelValue?: Record<string, unknown>;
6
8
  }
7
9
 
8
10
  export interface AmFormSlots {
9
- default: () => VNode[];
11
+ default: (
12
+ scope: {
13
+ /**
14
+ * Registers a form field for validation and tracking.
15
+ * @param field - The name of the form field to register.
16
+ * @param options - Configuration options for the field, such as validation rules.
17
+ * @returns - Returns an object or value representing the registered field.
18
+ */
19
+ register: (field: string, options: any) => any;
20
+ /**
21
+ * Resets the entire form state, clearing values and validation statuses.
22
+ */
23
+ reset: () => void;
24
+ /**
25
+ * Indicates whether the form is valid, returning `true` if all fields pass validation.
26
+ */
27
+ valid: boolean;
28
+ /**
29
+ * Each value from the form fields.
30
+ */
31
+ values: Record<string, unknown>;
32
+ } & {
33
+ /**
34
+ * Stores the state of each form field, with the field name as the key and its state as the value.
35
+ */
36
+ [key: string]: FormFieldState;
37
+ }
38
+ ) => VNode[];
10
39
  }
11
40
 
12
- export interface AmFormEmits {}
41
+ export interface AmFormEmits {
42
+ submit: (event: FormSubmitEvent) => void;
43
+ 'update:modelValue': (value: Record<string, unknown>) => void;
44
+ }
13
45
 
14
46
  /**
15
47
  * **DS Prime - AmForm**
package/amform/index.js CHANGED
@@ -1,40 +1,41 @@
1
- import { defineComponent as v, mergeModels as p, ref as n, useModel as _, computed as h, watch as f, nextTick as m, openBlock as k, createBlock as w, unref as c, withCtx as y, renderSlot as R, normalizeProps as V, guardReactiveProps as g } from "vue";
2
- import { Form as x } from "@primevue/forms";
3
- import { zodResolver as M } from "@primevue/forms/resolvers/zod";
4
- const b = { name: "AmForm" }, C = /* @__PURE__ */ v({
5
- ...b,
6
- props: /* @__PURE__ */ p({
7
- schema: {}
1
+ import { defineComponent as v, mergeModels as i, ref as m, useModel as p, computed as _, watch as n, openBlock as h, createBlock as V, unref as d, withCtx as R, renderSlot as g, normalizeProps as k, guardReactiveProps as M } from "vue";
2
+ import { Form as b } from "@primevue/forms";
3
+ import { zodResolver as j } from "@primevue/forms/resolvers/zod";
4
+ const w = { name: "AmForm" }, B = /* @__PURE__ */ v({
5
+ ...w,
6
+ props: /* @__PURE__ */ i({
7
+ schema: {},
8
+ modelValue: {}
8
9
  }, {
9
10
  modelValue: { type: Object, default: () => ({}) },
10
11
  modelModifiers: {}
11
12
  }),
12
13
  emits: ["update:modelValue"],
13
- setup(s) {
14
- const d = M(s.schema), r = n(), l = _(s, "modelValue"), t = n(!1), i = h(() => {
15
- var o;
16
- const e = (o = r.value) == null ? void 0 : o.states;
17
- return e ? Object.keys(e).reduce((a, u) => (a[u] = e[u].value, a), {}) : {};
14
+ setup(l) {
15
+ const f = j(l.schema), t = m(), o = p(l, "modelValue"), s = m(!1), c = _(() => {
16
+ var a;
17
+ const e = (a = t.value) == null ? void 0 : a.states;
18
+ return e ? Object.keys(e).reduce((r, u) => (r[u] = e[u].value, r), {}) : {};
18
19
  });
19
- return f(
20
- () => l.value,
21
- async (e) => {
22
- !r.value || t.value || (t.value = !0, r.value.setValues(e), await m(), t.value = !1);
20
+ return n(
21
+ () => o.value,
22
+ (e) => {
23
+ t.value && (s.value = !0, t.value.setValues(e));
23
24
  }
24
- ), f(i, async (e) => {
25
- t.value || (t.value = !0, l.value = e, await m(), t.value = !1);
26
- }), (e, o) => (k(), w(c(x), {
25
+ ), n(c, (e) => {
26
+ s.value = !0, o.value = e;
27
+ }), (e, a) => (h(), V(d(b), {
27
28
  ref_key: "formRef",
28
- ref: r,
29
- resolver: c(d)
29
+ ref: t,
30
+ resolver: d(f)
30
31
  }, {
31
- default: y((a) => [
32
- R(e.$slots, "default", V(g(a)))
32
+ default: R((r) => [
33
+ g(e.$slots, "default", k(M({ ...r, values: o.value })))
33
34
  ]),
34
35
  _: 3
35
36
  }, 8, ["resolver"]));
36
37
  }
37
38
  });
38
39
  export {
39
- C as default
40
+ B as default
40
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appmax_npm/ds-prime",
3
- "version": "1.0.0-alpha.104",
3
+ "version": "1.0.0-alpha.106",
4
4
  "description": "Design System da Appmax baseado no Primevue",
5
5
  "author": "Appmax",
6
6
  "exports": {