@caipira/tamandua 0.0.37 → 0.0.38

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/ModalForm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as a } from "./ModalForm.vue_vue_type_script_setup_true_lang-Da80UtoI.js";
2
- import { p as l } from "./plugin-BqzDqLcd.js";
1
+ import { _ as a } from "./ModalForm.vue_vue_type_script_setup_true_lang-CwaPQhNa.js";
2
+ import { p as l } from "./plugin-COZFGFVQ.js";
3
3
  export {
4
4
  a as ModalForm,
5
5
  l as ModalFormPlugin
@@ -0,0 +1,113 @@
1
+ import { defineComponent as K, ref as u, computed as L, resolveComponent as o, openBlock as l, createBlock as i, withCtx as s, createCommentVNode as d, renderSlot as M, createElementBlock as N, createVNode as m, normalizeClass as R, resolveDynamicComponent as I, mergeProps as O } from "vue";
2
+ import { C as P } from "./crud-n73o4CzO.js";
3
+ const T = {
4
+ key: 0,
5
+ class: "inline-flex"
6
+ }, q = /* @__PURE__ */ K({
7
+ name: "TModalForm",
8
+ __name: "ModalForm",
9
+ props: {
10
+ forms: {},
11
+ options: { default: () => [] },
12
+ formClass: { default: "" }
13
+ },
14
+ emits: ["saved", "deleted", "closed"],
15
+ setup(k, { expose: y, emit: g }) {
16
+ const r = k, v = g, e = u(), p = u(!1), f = u(""), c = u(), n = L(() => r.forms.find((a) => a.key === f.value)), w = (a, t) => {
17
+ f.value = a, e.value = new P(n.value?.title, c), t ? e.value?.edit(t) : e.value?.show();
18
+ }, h = () => {
19
+ e.value?.onSave(!p.value), v("saved");
20
+ }, S = () => {
21
+ v("deleted"), e.value?.onDelete();
22
+ }, b = () => {
23
+ e.value?.delete();
24
+ }, x = async () => await c.value?.submit(), D = () => {
25
+ c.value?.reset();
26
+ }, V = () => {
27
+ e.value?.close(), v("closed");
28
+ };
29
+ return y({ open: w, delete: b, submit: x, reset: D }), (a, t) => {
30
+ const E = o("t-input-switch"), B = o("t-icon"), $ = o("t-dropdown"), z = o("t-popover"), C = o("t-button"), A = o("t-popconfirm"), F = o("t-modal");
31
+ return e.value?.visible ? (l(), i(F, {
32
+ key: 0,
33
+ title: e.value?.title,
34
+ onClosed: V
35
+ }, {
36
+ header: s(() => [
37
+ n.value?.pinnable && !e.value?.isEditing ? (l(), i(E, {
38
+ key: 0,
39
+ modelValue: p.value,
40
+ "onUpdate:modelValue": t[0] || (t[0] = (_) => p.value = _),
41
+ label: "Keep open",
42
+ class: "mt-4"
43
+ }, null, 8, ["modelValue"])) : d("", !0),
44
+ M(a.$slots, "header")
45
+ ]),
46
+ footer: s(() => [
47
+ r.options.length ? (l(), N("div", T, [
48
+ m(z, { placement: "bottom-start" }, {
49
+ content: s(() => [
50
+ m($, {
51
+ items: r.options
52
+ }, null, 8, ["items"])
53
+ ]),
54
+ default: s(() => [
55
+ m(B, {
56
+ icon: "dots-vertical",
57
+ class: "text-lg mr-6",
58
+ size: "sm",
59
+ role: "button",
60
+ "aria-describedby": "tooltip"
61
+ })
62
+ ]),
63
+ _: 1
64
+ })
65
+ ])) : (l(), i(A, {
66
+ key: 1,
67
+ message: `Are you sure you want to delete this ${n.value?.title}?`,
68
+ onConfirm: b
69
+ }, {
70
+ default: s(({ onTogglePopover: _ }) => [
71
+ e.value?.isEditing ? (l(), i(C, {
72
+ key: 0,
73
+ variant: "danger",
74
+ icon: "trash-can-outline",
75
+ label: "Delete",
76
+ "aria-describedby": "tooltip",
77
+ "is-disabled": e.value?.isLoading,
78
+ onClick: _
79
+ }, null, 8, ["is-disabled", "onClick"])) : d("", !0)
80
+ ]),
81
+ _: 1
82
+ }, 8, ["message"])),
83
+ m(C, {
84
+ variant: "success",
85
+ icon: "save",
86
+ label: e.value.isCreating ? "Add" : "Save",
87
+ "is-disabled": e.value?.isLoading,
88
+ class: R({
89
+ "ml-auto": !e.value?.isEditing
90
+ }),
91
+ onClick: t[1] || (t[1] = () => e.value?.save())
92
+ }, null, 8, ["label", "is-disabled", "class"])
93
+ ]),
94
+ default: s(() => [
95
+ n.value ? (l(), i(I(n.value.component), O({
96
+ key: 0,
97
+ id: `${e.value?.id}`,
98
+ class: [r.formClass],
99
+ ref_key: "formReference",
100
+ ref: c
101
+ }, n.value?.events, {
102
+ onDeleted: S,
103
+ onSaved: h
104
+ }), null, 16, ["id", "class"])) : d("", !0)
105
+ ]),
106
+ _: 3
107
+ }, 8, ["title"])) : d("", !0);
108
+ };
109
+ }
110
+ });
111
+ export {
112
+ q as _
113
+ };
@@ -30,7 +30,7 @@ import { _ as er } from "./InputText.vue_vue_type_script_setup_true_lang-Dyvx9Ob
30
30
  import { _ as pr } from "./InputTextarea.vue_vue_type_script_setup_true_lang-DRo5eIw4.js";
31
31
  import { _ as sr } from "./Link.vue_vue_type_script_setup_true_lang-DeBJ2UGi.js";
32
32
  import { _ as fr } from "./Modal.vue_vue_type_script_setup_true_lang-DLl5shGS.js";
33
- import { _ as nr } from "./ModalForm.vue_vue_type_script_setup_true_lang-Da80UtoI.js";
33
+ import { _ as nr } from "./ModalForm.vue_vue_type_script_setup_true_lang-CwaPQhNa.js";
34
34
  import { _ as ur } from "./Pagination.vue_vue_type_script_setup_true_lang-PLZQJUd0.js";
35
35
  import { _ as lr } from "./Popconfirm.vue_vue_type_script_setup_true_lang-XyjBUx0p.js";
36
36
  import { _ as hr } from "./Popover.vue_vue_type_script_setup_true_lang-dnL75W40.js";
@@ -52,7 +52,7 @@ class h {
52
52
  this.formReference && (this.isLoading = !0, this.formReference.delete());
53
53
  }
54
54
  onDelete(e = !0) {
55
- e && this.close(), this.reset();
55
+ this.reset(), e && this.close();
56
56
  }
57
57
  }
58
58
  export {
package/dist/form2.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as i } from "./crud-TcRx_r8S.js";
1
+ import { C as i } from "./crud-n73o4CzO.js";
2
2
  const e = (r) => {
3
3
  const o = new FormData();
4
4
  if (r)
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./ModalForm.vue_vue_type_script_setup_true_lang-Da80UtoI.js";
2
+ import { _ as s } from "./ModalForm.vue_vue_type_script_setup_true_lang-CwaPQhNa.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -40,7 +40,7 @@ import { p as w } from "./plugin-BQFwx3d5.js";
40
40
  import "./Link.vue_vue_type_script_setup_true_lang-DeBJ2UGi.js";
41
41
  import { p as x } from "./plugin-dL6oP11N.js";
42
42
  import { p as D } from "./plugin-BZC231Oj.js";
43
- import { p as F } from "./plugin-BqzDqLcd.js";
43
+ import { p as F } from "./plugin-COZFGFVQ.js";
44
44
  import { p as L } from "./plugin-YUomn9tF.js";
45
45
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-XyjBUx0p.js";
46
46
  import { p as M } from "./plugin-Ee4Z5Rtp.js";
package/dist/plugins.js CHANGED
@@ -40,7 +40,7 @@ import { p as yr } from "./plugin-BQFwx3d5.js";
40
40
  import "./Link.vue_vue_type_script_setup_true_lang-DeBJ2UGi.js";
41
41
  import { p as Cr } from "./plugin-dL6oP11N.js";
42
42
  import { p as Sr } from "./plugin-BZC231Oj.js";
43
- import { p as vr } from "./plugin-BqzDqLcd.js";
43
+ import { p as vr } from "./plugin-COZFGFVQ.js";
44
44
  import { p as Dr } from "./plugin-YUomn9tF.js";
45
45
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-XyjBUx0p.js";
46
46
  import { p as Lr } from "./plugin-Ee4Z5Rtp.js";
package/dist/tamandua.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as n } from "./plugins-DLfHiPSG.js";
1
+ import { p as n } from "./plugins-B36hg2A7.js";
2
2
  const o = {
3
3
  install(s) {
4
4
  for (const i in n)
@@ -1,6 +1,6 @@
1
1
  import { ModalFormProps } from './types.js';
2
2
 
3
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ModalFormProps>, {
3
+ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ModalFormProps>, {
4
4
  options: () => never[];
5
5
  formClass: string;
6
6
  }>, {
@@ -13,6 +13,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
13
13
  reset: () => void;
14
14
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
15
  saved: () => void;
16
+ deleted: () => void;
16
17
  closed: () => void;
17
18
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ModalFormProps>, {
18
19
  options: () => never[];
@@ -20,10 +21,13 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
20
21
  }>>> & {
21
22
  onClosed?: (() => any) | undefined;
22
23
  onSaved?: (() => any) | undefined;
24
+ onDeleted?: (() => any) | undefined;
23
25
  }, {
24
26
  options: import("../types.js").InputSelectOption[];
25
27
  formClass: string;
26
- }, {}>;
28
+ }, {}>, {
29
+ header?(_: {}): any;
30
+ }>;
27
31
  export default _default;
28
32
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
29
33
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -42,3 +46,8 @@ type __VLS_WithDefaults<P, D> = {
42
46
  type __VLS_Prettify<T> = {
43
47
  [K in keyof T]: T[K];
44
48
  } & {};
49
+ type __VLS_WithTemplateSlots<T, S> = T & {
50
+ new (): {
51
+ $slots: S;
52
+ };
53
+ };
@@ -7,6 +7,7 @@ export type FormItem = {
7
7
  title: string;
8
8
  component: ComponentExposed<typeof Form>;
9
9
  pinnable?: boolean;
10
+ events?: Record<string, (e: any) => void>;
10
11
  };
11
12
  export type ModalFormProps = {
12
13
  forms: FormItem[];
@@ -15,5 +16,6 @@ export type ModalFormProps = {
15
16
  };
16
17
  export type ModalFormEvents = {
17
18
  (e: "saved"): void;
19
+ (e: "deleted"): void;
18
20
  (e: "closed"): void;
19
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caipira/tamandua",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "private": false,
5
5
  "description": "UI library for the Caipira ecosystem",
6
6
  "license": "GPL-3.0-only",
@@ -1,108 +0,0 @@
1
- import { defineComponent as M, ref as c, computed as N, resolveComponent as o, openBlock as n, createBlock as a, withCtx as l, createCommentVNode as d, createElementBlock as R, createVNode as m, normalizeClass as b, resolveDynamicComponent as $ } from "vue";
2
- import { C as A } from "./crud-TcRx_r8S.js";
3
- const I = {
4
- key: 0,
5
- class: "inline-flex"
6
- }, U = /* @__PURE__ */ M({
7
- name: "TModalForm",
8
- __name: "ModalForm",
9
- props: {
10
- forms: {},
11
- options: { default: () => [] },
12
- formClass: { default: "" }
13
- },
14
- emits: ["saved", "closed"],
15
- setup(y, { expose: C, emit: k }) {
16
- const i = y, v = k, e = c(), p = c(!1), f = c(""), r = c(), s = N(() => i.forms.find((u) => u.key === f.value)), g = (u, t) => {
17
- f.value = u, e.value = new A(s.value?.title, r), t ? e.value?.edit(t) : e.value?.show();
18
- }, w = () => {
19
- e.value?.onSave(!p.value), v("saved");
20
- }, x = () => {
21
- e.value?.delete();
22
- }, S = async () => await r.value?.submit(), V = () => {
23
- r.value?.reset();
24
- }, D = () => {
25
- e.value?.close(), v("closed");
26
- };
27
- return C({ open: g, delete: x, submit: S, reset: V }), (u, t) => {
28
- const E = o("t-input-switch"), B = o("t-icon"), h = o("t-dropdown"), z = o("t-popover"), _ = o("t-button"), F = o("t-popconfirm"), K = o("t-modal");
29
- return e.value?.visible ? (n(), a(K, {
30
- key: 0,
31
- title: e.value?.title,
32
- onClosed: D
33
- }, {
34
- header: l(() => [
35
- s.value?.pinnable && !e.value?.isEditing ? (n(), a(E, {
36
- key: 0,
37
- modelValue: p.value,
38
- "onUpdate:modelValue": t[0] || (t[0] = (L) => p.value = L),
39
- label: "Keep open",
40
- class: "mt-4"
41
- }, null, 8, ["modelValue"])) : d("", !0)
42
- ]),
43
- footer: l(() => [
44
- i.options.length ? (n(), R("div", I, [
45
- m(z, { placement: "bottom-start" }, {
46
- content: l(() => [
47
- m(h, {
48
- items: i.options
49
- }, null, 8, ["items"])
50
- ]),
51
- default: l(() => [
52
- m(B, {
53
- icon: "dots-vertical",
54
- class: "text-lg mr-6",
55
- size: "sm",
56
- role: "button",
57
- "aria-describedby": "tooltip"
58
- })
59
- ]),
60
- _: 1
61
- })
62
- ])) : (n(), a(F, {
63
- key: 1,
64
- message: `Are you sure you want to delete this ${s.value?.title}?`,
65
- onConfirm: t[2] || (t[2] = () => e.value?.delete())
66
- }, {
67
- default: l(() => [
68
- e.value?.isEditing ? (n(), a(_, {
69
- key: 0,
70
- variant: "danger",
71
- icon: "trash-can-outline",
72
- label: "Delete",
73
- "aria-describedby": "tooltip",
74
- "is-disabled": e.value?.isLoading
75
- }, null, 8, ["is-disabled"])) : d("", !0)
76
- ]),
77
- _: 1
78
- }, 8, ["message"])),
79
- m(_, {
80
- variant: "success",
81
- icon: "save",
82
- label: "Save",
83
- "is-disabled": e.value?.isLoading,
84
- class: b({
85
- "ml-auto": !e.value?.isEditing
86
- }),
87
- onClick: t[3] || (t[3] = () => e.value?.save())
88
- }, null, 8, ["is-disabled", "class"])
89
- ]),
90
- default: l(() => [
91
- s.value ? (n(), a($(s.value.component), {
92
- key: 0,
93
- id: `${e.value?.id}`,
94
- class: b([i.formClass]),
95
- ref_key: "formReference",
96
- ref: r,
97
- onDeleted: t[1] || (t[1] = () => e.value?.onDelete()),
98
- onSaved: w
99
- }, null, 40, ["id", "class"])) : d("", !0)
100
- ]),
101
- _: 1
102
- }, 8, ["title"])) : d("", !0);
103
- };
104
- }
105
- });
106
- export {
107
- U as _
108
- };