@caipira/tamandua 0.0.66 → 0.0.67

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/Button.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as r } from "./Button.vue_vue_type_script_setup_true_lang-CUPz7wT9.js";
2
- import { p } from "./plugin-Cr3oXX-8.js";
1
+ import { _ as r } from "./Button.vue_vue_type_script_setup_true_lang-DW0Q2Ut2.js";
2
+ import { p } from "./plugin-CV_fI920.js";
3
3
  export {
4
4
  r as Button,
5
5
  p as ButtonPlugin
@@ -1,8 +1,8 @@
1
- import { defineComponent as A, useSlots as U, ref as b, computed as c, resolveComponent as _, openBlock as p, createBlock as d, resolveDynamicComponent as z, normalizeClass as D, unref as a, withCtx as P, mergeProps as y, createCommentVNode as u, renderSlot as k, createElementBlock as h, Fragment as L, createTextVNode as F, toDisplayString as M } from "vue";
1
+ import { defineComponent as I, ref as y, computed as s, resolveComponent as A, openBlock as c, createBlock as d, resolveDynamicComponent as U, normalizeClass as _, unref as a, withCtx as z, mergeProps as b, createCommentVNode as u, renderSlot as D, createElementBlock as h, Fragment as P, createTextVNode as k, toDisplayString as L } from "vue";
2
2
  import { b as f, a as i, c as t, B as r } from "./ui-J-lhC9qd.js";
3
3
  import { g } from "./index-CVD_wAsU.js";
4
4
  import "./Icon.vue_vue_type_script_setup_true_lang-C2QvF2xM.js";
5
- const G = ["multiple"], K = /* @__PURE__ */ A({
5
+ const F = ["multiple"], V = /* @__PURE__ */ I({
6
6
  name: "TButton",
7
7
  __name: "Button",
8
8
  props: {
@@ -23,7 +23,7 @@ const G = ["multiple"], K = /* @__PURE__ */ A({
23
23
  },
24
24
  emits: ["upload"],
25
25
  setup(S, { expose: T, emit: E }) {
26
- const e = S, x = E, B = U(), m = b(), s = b(null), R = c(() => {
26
+ const e = S, x = E, m = y(), p = y(null), B = s(() => {
27
27
  switch (e.type) {
28
28
  case t.SUBMIT:
29
29
  return "submit";
@@ -32,7 +32,7 @@ const G = ["multiple"], K = /* @__PURE__ */ A({
32
32
  default:
33
33
  return "button";
34
34
  }
35
- }), w = c(() => e.type === t.SUBMIT ? e.label : void 0), N = c(() => {
35
+ }), R = s(() => e.type === t.SUBMIT ? e.label : void 0), w = s(() => {
36
36
  switch (e.type) {
37
37
  case t.SUBMIT:
38
38
  return "input";
@@ -41,10 +41,10 @@ const G = ["multiple"], K = /* @__PURE__ */ A({
41
41
  default:
42
42
  return "button";
43
43
  }
44
- }), C = (o) => {
44
+ }), N = (o) => {
45
45
  if (e.type === t.SUBMIT && o.preventDefault(), e.type === t.FILE && m.value?.click(), e.animate) {
46
46
  let n = null;
47
- e.animate.target === "icon" && (n = s.value?.reference), n && g.to(n, {
47
+ e.animate.target === "icon" && (n = p.value?.reference), n && g.to(n, {
48
48
  duration: 0.2,
49
49
  ...e.animate.animation,
50
50
  ease: "power3.easeInOut",
@@ -53,11 +53,11 @@ const G = ["multiple"], K = /* @__PURE__ */ A({
53
53
  }
54
54
  });
55
55
  }
56
- }, I = (o) => {
56
+ }, C = (o) => {
57
57
  o.stopPropagation();
58
58
  const l = o.target.files;
59
59
  !l || !l.length || x("upload", l);
60
- }, v = c(() => {
60
+ }, v = s(() => {
61
61
  switch (e.size) {
62
62
  case i.ExtraSmall:
63
63
  return 12;
@@ -73,13 +73,13 @@ const G = ["multiple"], K = /* @__PURE__ */ A({
73
73
  return 20;
74
74
  }
75
75
  });
76
- return c(() => !!e.label || !!B.default), T({ iconReference: s }), (o, n) => {
77
- const l = _("t-icon");
78
- return p(), d(z(N.value), {
79
- type: R.value,
80
- value: w.value,
76
+ return T({ iconReference: p }), (o, n) => {
77
+ const l = A("t-icon");
78
+ return c(), d(U(w.value), {
79
+ type: B.value,
80
+ value: R.value,
81
81
  disabled: e.disabled,
82
- class: D([{
82
+ class: _([{
83
83
  // Size
84
84
  "text-xs px-1 h-4": e.size === a(i).ExtraSmall,
85
85
  "text-sm px-2 h-7": e.size === a(i).Small,
@@ -119,40 +119,40 @@ const G = ["multiple"], K = /* @__PURE__ */ A({
119
119
  // Link
120
120
  "color-caipira-primary-inverted underline font-bold": e.variant === a(r).LINK,
121
121
  // Transparent
122
- "transparent-button": e.variant === a(r).TRANSPARENT,
122
+ "bg-transparent": e.variant === a(r).TRANSPARENT,
123
123
  "hover:bg-[var(--hover-color)]": e.variant === a(r).TRANSPARENT && e.hover
124
- }, "input-outline inline-flex gap-1 items-center select-none whitespace-nowrap"]),
124
+ }, "input-outline flex gap-1 items-center select-none whitespace-nowrap"]),
125
125
  role: "button",
126
- onClick: C
126
+ onClick: N
127
127
  }, {
128
- default: P(() => [
129
- e.icon && e.iconPosition === "left" ? (p(), d(l, y({
128
+ default: z(() => [
129
+ e.icon && e.iconPosition === "left" ? (c(), d(l, b({
130
130
  key: 0,
131
131
  ref_key: "iconReference",
132
- ref: s,
132
+ ref: p,
133
133
  size: v.value,
134
134
  icon: e.icon
135
135
  }, e.iconProps), null, 16, ["size", "icon"])) : u("", !0),
136
- k(o.$slots, "default"),
137
- e.label && e.type !== a(t).SUBMIT ? (p(), h(L, { key: 1 }, [
138
- F(M(e.label), 1)
136
+ D(o.$slots, "default"),
137
+ e.label && e.type !== a(t).SUBMIT ? (c(), h(P, { key: 1 }, [
138
+ k(L(e.label), 1)
139
139
  ], 64)) : u("", !0),
140
- e.icon && e.iconPosition === "right" ? (p(), d(l, y({
140
+ e.icon && e.iconPosition === "right" ? (c(), d(l, b({
141
141
  key: 2,
142
142
  ref_key: "iconReference",
143
- ref: s,
143
+ ref: p,
144
144
  size: v.value,
145
145
  icon: e.icon
146
146
  }, e.iconProps), null, 16, ["size", "icon"])) : u("", !0),
147
- e.type === "file" ? (p(), h("input", {
147
+ e.type === "file" ? (c(), h("input", {
148
148
  key: 3,
149
149
  multiple: e.multiple,
150
150
  type: "file",
151
151
  ref_key: "fileInput",
152
152
  ref: m,
153
153
  class: "hidden",
154
- onChange: I
155
- }, null, 40, G)) : u("", !0)
154
+ onChange: C
155
+ }, null, 40, F)) : u("", !0)
156
156
  ]),
157
157
  _: 3
158
158
  }, 8, ["type", "value", "disabled", "class"]);
@@ -160,5 +160,5 @@ const G = ["multiple"], K = /* @__PURE__ */ A({
160
160
  }
161
161
  });
162
162
  export {
163
- K as _
163
+ V as _
164
164
  };
package/dist/Dropdown.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as p } from "./Dropdown.vue_vue_type_script_setup_true_lang-DeY4vid5.js";
2
- import { p as a } from "./plugin-DrKx8l8j.js";
1
+ import { _ as p } from "./Dropdown.vue_vue_type_script_setup_true_lang-CUPNdEz7.js";
2
+ import { p as a } from "./plugin-x-Y35fqX.js";
3
3
  export {
4
4
  p as Dropdown,
5
5
  a as DropdownPlugin
@@ -92,7 +92,7 @@ const j = /* @__PURE__ */ U("span", null, "Loading...", -1), q = ["aria-selected
92
92
  }, [
93
93
  z(l, {
94
94
  size: "sm",
95
- class: "w-12 h-12 animate-spin mr-3",
95
+ class: "w-6 h-6 animate-spin mr-3",
96
96
  icon: "loading"
97
97
  }),
98
98
  j
@@ -1,5 +1,5 @@
1
- import { _ as p } from "./InputSelect.vue_vue_type_script_setup_true_lang-BuO105oW.js";
2
- import { p as r } from "./plugin-DPAnsB4s.js";
1
+ import { _ as p } from "./InputSelect.vue_vue_type_script_setup_true_lang-CGlaDHiJ.js";
2
+ import { p as r } from "./plugin-DxUJiAk-.js";
3
3
  export {
4
4
  p as InputSelect,
5
5
  r as InputSelectPlugin
@@ -0,0 +1,229 @@
1
+ import { defineComponent as ue, mergeModels as O, useModel as se, ref as p, computed as E, onBeforeMount as ie, watch as I, resolveComponent as g, openBlock as i, createBlock as D, normalizeClass as x, withCtx as R, createElementVNode as K, withDirectives as N, createElementBlock as d, vModelText as re, createCommentVNode as z, createVNode as U, renderSlot as k, normalizeProps as _, mergeProps as M, Fragment as V, renderList as q, guardReactiveProps as G, toDisplayString as H, vShow as ce, createSlots as pe, createTextVNode as de, nextTick as fe } from "vue";
2
+ import { a as ve, E as me } from "./ui-J-lhC9qd.js";
3
+ const ye = ["placeholder", "disabled", "readonly"], he = { key: 1 }, we = {
4
+ key: 0,
5
+ class: "inline-flex w-full justify-between items-center"
6
+ }, be = {
7
+ key: 1,
8
+ class: "inline-flex items-center"
9
+ }, _e = /* @__PURE__ */ ue({
10
+ name: "TInputSelect",
11
+ __name: "InputSelect",
12
+ props: /* @__PURE__ */ O({
13
+ size: { default: ve.Default },
14
+ options: { default: () => [] },
15
+ mapper: { type: Function, default: (f) => ({
16
+ value: f.id ?? f.uuid,
17
+ label: f
18
+ }) },
19
+ filter: { type: Function, default: (f, T) => T.label.toLowerCase().indexOf(f.toLowerCase()) >= 0 },
20
+ tooltip: { default: "" },
21
+ disabled: { type: Boolean },
22
+ resource: {},
23
+ multiple: { type: Boolean, default: !1 },
24
+ placeholder: { default: "" },
25
+ initialValue: {},
26
+ isSearchable: { type: Boolean, default: !1 },
27
+ dropdownPlacement: { default: me.BOTTOM_START },
28
+ widthClass: { default: "w-full" },
29
+ borderClass: { default: "border input-border" },
30
+ roundnessClass: { default: "input-roundness" }
31
+ }, {
32
+ modelValue: {},
33
+ modelModifiers: {}
34
+ }),
35
+ emits: /* @__PURE__ */ O(["update:model-value"], ["update:modelValue"]),
36
+ setup(f, { emit: T }) {
37
+ const l = f;
38
+ let B = !1, S, P = "";
39
+ const J = T, u = se(f, "modelValue"), o = p([]), c = p(""), j = p(null), F = p(), s = p(!1), L = p(null), a = p([]), $ = p(!1), v = p(null), h = E(() => a.value.length > 0), m = E(() => l.isSearchable && s.value), w = E(() => typeof l.resource == "function"), Q = (e) => !l.multiple || !u.value || !Array.isArray(u.value) ? !1 : u.value.includes(e.value), W = (e = u.value) => !(e === void 0 || e === "" || Array.isArray(e) && e.length === 0), X = (e) => {
40
+ J("update:model-value", e);
41
+ }, y = (e = u.value) => {
42
+ if (W(e))
43
+ if (l.multiple)
44
+ Array.isArray(e) && (a.value = e.map(
45
+ (t) => A(t)
46
+ ).filter((t) => t > -1));
47
+ else {
48
+ const t = A(e);
49
+ ~t && (a.value = [t]);
50
+ }
51
+ }, Y = async (e) => {
52
+ e.stopPropagation(), s.value = !s.value, s.value && m.value && fe(() => {
53
+ j.value?.focus();
54
+ });
55
+ }, A = (e) => o.value.findIndex(
56
+ (t) => t.value === e
57
+ ), C = async (e = !1) => {
58
+ if (!l.resource)
59
+ return;
60
+ $.value = !0;
61
+ const t = {
62
+ t: c.value,
63
+ r: "option"
64
+ };
65
+ e && v.value && v.value.pages > v.value.page ? t.page = v.value.page + 1 : e = !1, !c.value && u.value && (t.i = u.value);
66
+ const r = await l.resource(t);
67
+ e ? o.value.push(...r.items.map(l.mapper)) : o.value = r.items.map(l.mapper), v.value = r.pagination, !w.value && c.value && y(c.value), $.value = !1;
68
+ }, Z = () => {
69
+ !c.value || P === c.value || (S && (clearTimeout(S), S = null), S = setTimeout(() => {
70
+ P = c.value, w.value ? (s.value || (s.value = !0), C()) : l.isSearchable && (o.value = l.options.filter(
71
+ (e) => l.filter(c.value, e)
72
+ ));
73
+ }, 500));
74
+ }, ee = ({
75
+ index: e,
76
+ hold: t
77
+ }) => {
78
+ if (B = !0, l.multiple) {
79
+ const r = a.value.findIndex(
80
+ (b) => b === e
81
+ );
82
+ ~r ? a.value.splice(r, 1) : a.value.push(e);
83
+ } else
84
+ a.value = [e];
85
+ (!l.multiple || !t) && (s.value = !1);
86
+ }, le = () => {
87
+ w.value && v.value && v.value.pages > v.value.page && C(!0);
88
+ }, te = async (e) => {
89
+ switch (e.key) {
90
+ case "ArrowDown":
91
+ L.value?.move(e);
92
+ break;
93
+ case "Escape":
94
+ s.value = !1;
95
+ break;
96
+ }
97
+ };
98
+ return ie(async () => {
99
+ w.value ? (await C(), y()) : l.options.length > 0 && (o.value = l.options), !u.value && l.initialValue ? y(l.initialValue) : y(u.value);
100
+ }), I(
101
+ () => u.value,
102
+ async (e) => {
103
+ e && (A(e) < 0 && w.value && await C(), y(e));
104
+ }
105
+ ), I(
106
+ a,
107
+ (e) => {
108
+ const t = l.multiple ? o.value.filter(
109
+ (r, b) => a.value.includes(b)
110
+ ).map((r) => r.value) : o.value[a.value[0]].value;
111
+ B && (B = !1, X(t));
112
+ },
113
+ { deep: !0 }
114
+ ), I(
115
+ () => l.options,
116
+ (e) => {
117
+ e.length > 0 && (o.value = e, u.value && a.value.length === 0 && y(u.value));
118
+ }
119
+ ), (e, t) => {
120
+ const r = g("t-tag"), b = g("t-button"), ae = g("t-icon"), oe = g("t-dropdown"), ne = g("t-popover");
121
+ return i(), D(ne, {
122
+ open: s.value,
123
+ "onUpdate:open": t[1] || (t[1] = (n) => s.value = n),
124
+ placement: l.dropdownPlacement,
125
+ class: x([l.widthClass]),
126
+ ref_key: "popoverRef",
127
+ ref: F
128
+ }, {
129
+ default: R(() => [
130
+ K("div", {
131
+ class: x([{
132
+ "h-9": !l.multiple,
133
+ "h-full *:min-h-9": l.multiple,
134
+ [l.borderClass]: !0,
135
+ [l.roundnessClass]: !0
136
+ }, "flex justify-between items-center w-full max-w-96 input-text-color select-none input-bg-color"])
137
+ }, [
138
+ m.value ? N((i(), d("input", {
139
+ key: 0,
140
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => c.value = n),
141
+ type: "text",
142
+ ref_key: "inputRef",
143
+ ref: j,
144
+ placeholder: l.placeholder,
145
+ disabled: l.disabled,
146
+ readonly: !l.isSearchable,
147
+ class: "h-9 bg-transparent input-padding input-roundness input-outline w-full",
148
+ onInput: Z,
149
+ onKeydown: te
150
+ }, null, 40, ye)), [
151
+ [re, c.value]
152
+ ]) : z("", !0),
153
+ U(b, {
154
+ variant: "transparent",
155
+ size: "",
156
+ class: x(["h-full", {
157
+ "w-full justify-end pr-2": !m.value && !h.value,
158
+ "w-full justify-between pr-2": !m.value && h.value,
159
+ "w-10 justify-center": m.value
160
+ }]),
161
+ "aria-describedby": F.value?.name,
162
+ icon: s.value === !0 ? "chevron-up" : "chevron-down",
163
+ "icon-position": m.value ? "left" : "right",
164
+ onClick: Y
165
+ }, {
166
+ default: R(() => [
167
+ N(K("div", {
168
+ class: x(["inline-flex items-center ml-2 max-w-[calc(100%-2.5rem)]", {
169
+ "overflow-hidden whitespace-nowrap": !l.multiple,
170
+ "flex-wrap gap-2 py-1": l.multiple
171
+ }])
172
+ }, [
173
+ e.$slots.selection && h.value ? k(e.$slots, "selection", _(M({ key: 0 }, o.value[a.value[0]]))) : e.$slots.default && h.value ? (i(), d(V, { key: 1 }, [
174
+ l.multiple ? (i(!0), d(V, { key: 0 }, q(a.value, (n) => k(e.$slots, "default", _(G(o.value[n])))), 256)) : k(e.$slots, "default", _(M({ key: 1 }, o.value[a.value[0]])))
175
+ ], 64)) : h.value ? (i(), d(V, { key: 2 }, [
176
+ l.multiple ? (i(!0), d(V, { key: 0 }, q(a.value, (n) => (i(), D(r, {
177
+ key: n,
178
+ text: o.value[n]?.label,
179
+ color: "#6e6e6e"
180
+ }, null, 8, ["text"]))), 128)) : (i(), d("span", he, H(o.value[a.value[0]]?.label), 1))
181
+ ], 64)) : z("", !0)
182
+ ], 2), [
183
+ [ce, !m.value]
184
+ ])
185
+ ]),
186
+ _: 3
187
+ }, 8, ["aria-describedby", "class", "icon", "icon-position"])
188
+ ], 2)
189
+ ]),
190
+ content: R(() => [
191
+ U(oe, {
192
+ ref_key: "dropdownRef",
193
+ ref: L,
194
+ items: o.value,
195
+ "is-visible": s.value,
196
+ multiple: l.multiple,
197
+ loading: $.value,
198
+ onChange: ee,
199
+ onEndReached: le
200
+ }, pe({ _: 2 }, [
201
+ e.$slots.default || l.multiple ? {
202
+ name: "default",
203
+ fn: R((n) => [
204
+ l.multiple ? (i(), d("div", we, [
205
+ e.$slots.default ? k(e.$slots, "default", _(M({ key: 0 }, n))) : (i(), d(V, { key: 1 }, [
206
+ de(H(n.label), 1)
207
+ ], 64)),
208
+ Q(n) ? (i(), D(ae, {
209
+ key: 2,
210
+ icon: "check",
211
+ size: "sm",
212
+ class: "float-right ml-2"
213
+ })) : z("", !0)
214
+ ])) : (i(), d("div", be, [
215
+ k(e.$slots, "default", _(G(n)))
216
+ ]))
217
+ ]),
218
+ key: "0"
219
+ } : void 0
220
+ ]), 1032, ["items", "is-visible", "multiple", "loading"])
221
+ ]),
222
+ _: 3
223
+ }, 8, ["open", "placement", "class"]);
224
+ };
225
+ }
226
+ });
227
+ export {
228
+ _e as _
229
+ };
@@ -1,5 +1,5 @@
1
- import { _ as i } from "./Pagination.vue_vue_type_script_setup_true_lang-BB6dLKpi.js";
2
- import { p as r } from "./plugin-DxG6Hhao.js";
1
+ import { _ as i } from "./Pagination.vue_vue_type_script_setup_true_lang-BCQUrEVO.js";
2
+ import { p as r } from "./plugin-jyvJNavM.js";
3
3
  export {
4
4
  i as Pagination,
5
5
  r as PaginationPlugin
@@ -0,0 +1,110 @@
1
+ import { defineComponent as $, mergeModels as V, useModel as x, ref as B, computed as o, resolveComponent as m, openBlock as i, createElementBlock as d, normalizeClass as L, createElementVNode as v, toDisplayString as M, createCommentVNode as f, createVNode as h, Fragment as S, renderList as z, createBlock as b } from "vue";
2
+ const N = { key: 0 }, j = { class: "flex flex-wrap justify-end gap-6" }, D = { class: "h-9 flex" }, F = /* @__PURE__ */ $({
3
+ name: "TPagination",
4
+ __name: "Pagination",
5
+ props: /* @__PURE__ */ V({
6
+ disabled: { type: Boolean, default: !1 },
7
+ displayClass: { default: "flex gap-6 flex-col sm:flex-row items-end sm:items-center justify-end sm:justify-between" },
8
+ hasPageSize: { type: Boolean, default: !0 },
9
+ pageLengths: { default: () => [12, 18, 24, 30, 36, 42] },
10
+ showDescription: { type: Boolean, default: !1 }
11
+ }, {
12
+ modelValue: {
13
+ default: {
14
+ page: 1,
15
+ pages: 1,
16
+ perPage: 12
17
+ }
18
+ },
19
+ modelModifiers: {}
20
+ }),
21
+ emits: ["update:modelValue"],
22
+ setup(c) {
23
+ const u = c, e = x(c, "modelValue"), g = B(e.value.perPage ?? 12), P = o(() => e.value.page === 1), k = o(
24
+ () => e.value.page === e.value.pages
25
+ ), y = o(() => {
26
+ const a = e.value.pages || 1, t = e.value.page || 1, n = [], p = Math.max(2, t - 2), l = Math.min(a - 1, t + 2);
27
+ a > 1 && n.push(1);
28
+ for (let s = p; s <= l; s++)
29
+ s > 1 && s < a && n.push(s);
30
+ return a > 1 && n.push(a), n;
31
+ }), C = o(() => u.pageLengths.map((a) => ({
32
+ label: `${a} / page`,
33
+ value: a
34
+ }))), w = o(() => {
35
+ if ("items" in e.value && "skip" in e.value && "items" in e.value) {
36
+ const a = e.value.skip + 1, t = e.value.skip + e.value.items, n = e.value.totalItems;
37
+ return `Showing ${a} to ${t} of ${n} entries`;
38
+ }
39
+ return `Page ${e.value.page} of ${e.value.pages}`;
40
+ }), r = (a) => {
41
+ a === e.value.page || a < 1 || a > e.value.pages || (e.value = {
42
+ ...e.value,
43
+ page: a
44
+ });
45
+ }, _ = (a) => {
46
+ a !== e.value.perPage && (e.value = {
47
+ ...e.value,
48
+ perPage: a,
49
+ page: 1
50
+ });
51
+ };
52
+ return (a, t) => {
53
+ const n = m("t-button"), p = m("t-input-select");
54
+ return i(), d("div", {
55
+ class: L(["select-none", [u.displayClass]])
56
+ }, [
57
+ v("div", null, [
58
+ a.showDescription ? (i(), d("p", N, M(w.value), 1)) : f("", !0)
59
+ ]),
60
+ v("div", j, [
61
+ v("div", D, [
62
+ h(n, {
63
+ variant: "transparent",
64
+ label: "Previous",
65
+ icon: "chevron-left",
66
+ hover: !0,
67
+ "disable-style": !0,
68
+ disabled: P.value,
69
+ onClick: t[0] || (t[0] = (l) => r(e.value.page - 1))
70
+ }, null, 8, ["disabled"]),
71
+ (i(!0), d(S, null, z(y.value, (l) => (i(), b(n, {
72
+ variant: "transparent",
73
+ hover: !0,
74
+ label: `${l}`,
75
+ outline: l === e.value.page,
76
+ bold: l === e.value.page,
77
+ disabled: l === e.value.page,
78
+ onClick: (s) => r(l)
79
+ }, null, 8, ["label", "outline", "bold", "disabled", "onClick"]))), 256)),
80
+ h(n, {
81
+ variant: "transparent",
82
+ label: "Next",
83
+ icon: "chevron-right",
84
+ "icon-position": "right",
85
+ hover: !0,
86
+ disabled: k.value,
87
+ onClick: t[1] || (t[1] = (l) => r(e.value.page + 1))
88
+ }, null, 8, ["disabled"])
89
+ ]),
90
+ u.hasPageSize ? (i(), b(p, {
91
+ key: 0,
92
+ modelValue: g.value,
93
+ "onUpdate:modelValue": [
94
+ t[2] || (t[2] = (l) => g.value = l),
95
+ _
96
+ ],
97
+ "width-class": "",
98
+ class: "w-fit min-w-32",
99
+ "dropdown-placement": "top",
100
+ disabled: a.disabled,
101
+ options: C.value
102
+ }, null, 8, ["modelValue", "disabled", "options"])) : f("", !0)
103
+ ])
104
+ ], 2);
105
+ };
106
+ }
107
+ });
108
+ export {
109
+ F as _
110
+ };
@@ -1,10 +1,10 @@
1
1
  import { _ as e } from "./Avatar.vue_vue_type_script_setup_true_lang-D7NdR9hu.js";
2
2
  import { _ as a } from "./Backdrop.vue_vue_type_script_setup_true_lang-OaEBTmYK.js";
3
- import { _ as s } from "./Button.vue_vue_type_script_setup_true_lang-CUPz7wT9.js";
3
+ import { _ as s } from "./Button.vue_vue_type_script_setup_true_lang-DW0Q2Ut2.js";
4
4
  import { _ as f } from "./ChartLine.vue_vue_type_style_index_0_lang-DO_gKCe4.js";
5
5
  import { _ as n } from "./ChartTreemap.vue_vue_type_script_setup_true_lang-CLi_IXfP.js";
6
6
  import { D as u } from "./Drawer-Cl9_4uHA.js";
7
- import { _ as l } from "./Dropdown.vue_vue_type_script_setup_true_lang-DeY4vid5.js";
7
+ import { _ as l } from "./Dropdown.vue_vue_type_script_setup_true_lang-CUPNdEz7.js";
8
8
  import { _ as c } from "./FileDrop.vue_vue_type_script_setup_true_lang-BDzMbrCN.js";
9
9
  import { _ as T } from "./Form.vue_vue_type_script_setup_true_lang-CNGNCak7.js";
10
10
  import { _ as C } from "./FormItem.vue_vue_type_script_setup_true_lang-D7a8YCgS.js";
@@ -25,14 +25,14 @@ import { _ as W } from "./InputPhone.vue_vue_type_script_setup_true_lang-B4TULqL
25
25
  import { _ as Y } from "./InputPrice.vue_vue_type_script_setup_true_lang-R3kHhxN2.js";
26
26
  import { _ as $ } from "./InputRadio.vue_vue_type_style_index_0_lang-n0nJwz8x.js";
27
27
  import "vue";
28
- import { _ as or } from "./InputSelect.vue_vue_type_script_setup_true_lang-BuO105oW.js";
28
+ import { _ as or } from "./InputSelect.vue_vue_type_script_setup_true_lang-CGlaDHiJ.js";
29
29
  import { _ as er } from "./InputSwitch.vue_vue_type_script_setup_true_lang-CgE_12vY.js";
30
30
  import { _ as ar } from "./InputText.vue_vue_type_script_setup_true_lang-JLAlUE_2.js";
31
31
  import { _ as sr } from "./InputTextarea.vue_vue_type_script_setup_true_lang-q9T4fINI.js";
32
32
  import { _ as fr } from "./Link.vue_vue_type_script_setup_true_lang-BE-Gh_jJ.js";
33
33
  import { _ as nr } from "./Modal.vue_vue_type_script_setup_true_lang-DiUI27HX.js";
34
34
  import { _ as ur } from "./ModalForm.vue_vue_type_script_setup_true_lang-RfK0Mn81.js";
35
- import { _ as lr } from "./Pagination.vue_vue_type_script_setup_true_lang-BB6dLKpi.js";
35
+ import { _ as lr } from "./Pagination.vue_vue_type_script_setup_true_lang-BCQUrEVO.js";
36
36
  import { _ as cr } from "./Popconfirm.vue_vue_type_script_setup_true_lang-C37pLEUq.js";
37
37
  import { _ as Tr } from "./Popover.vue_vue_type_script_setup_true_lang-DoSN5ymu.js";
38
38
  import { P as Cr } from "./ProgressCircle-Cpmi2CpO.js";
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./Button.vue_vue_type_script_setup_true_lang-CUPz7wT9.js";
2
+ import { _ as s } from "./Button.vue_vue_type_script_setup_true_lang-DW0Q2Ut2.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./InputSelect.vue_vue_type_script_setup_true_lang-BuO105oW.js";
2
+ import { _ as s } from "./InputSelect.vue_vue_type_script_setup_true_lang-CGlaDHiJ.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./Pagination.vue_vue_type_script_setup_true_lang-BB6dLKpi.js";
2
+ import { _ as s } from "./Pagination.vue_vue_type_script_setup_true_lang-BCQUrEVO.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./Dropdown.vue_vue_type_script_setup_true_lang-DeY4vid5.js";
2
+ import { _ as s } from "./Dropdown.vue_vue_type_script_setup_true_lang-CUPNdEz7.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -2,15 +2,15 @@ import "./Avatar.vue_vue_type_script_setup_true_lang-D7NdR9hu.js";
2
2
  import { p } from "./plugin-DNwjBl_u.js";
3
3
  import "vue";
4
4
  import { p as i } from "./plugin-C-iGigb_.js";
5
- import "./Button.vue_vue_type_script_setup_true_lang-CUPz7wT9.js";
6
- import { p as r } from "./plugin-Cr3oXX-8.js";
5
+ import "./Button.vue_vue_type_script_setup_true_lang-DW0Q2Ut2.js";
6
+ import { p as r } from "./plugin-CV_fI920.js";
7
7
  import "./transform-DSaNEFMr.js";
8
8
  import "./ChartLine.vue_vue_type_style_index_0_lang-DO_gKCe4.js";
9
9
  import { p as o } from "./plugin-DDXOF4cU.js";
10
10
  import { p as n } from "./plugin-CyDnzy2n.js";
11
11
  import "./Drawer-Cl9_4uHA.js";
12
12
  import { p as m } from "./plugin-CNwzCYlr.js";
13
- import { p as u } from "./plugin-DrKx8l8j.js";
13
+ import { p as u } from "./plugin-x-Y35fqX.js";
14
14
  import { p as l } from "./plugin-CJ6sqqaI.js";
15
15
  import "./Form.vue_vue_type_script_setup_true_lang-CNGNCak7.js";
16
16
  import { p as t } from "./plugin-BuU0zOfE.js";
@@ -35,8 +35,8 @@ import { p as C } from "./plugin-CrHDShgh.js";
35
35
  import { p as S } from "./plugin-RM2wZuwL.js";
36
36
  import "./InputRadio.vue_vue_type_style_index_0_lang-n0nJwz8x.js";
37
37
  import { p as v } from "./plugin-Do2-cqMT.js";
38
- import "./InputSelect.vue_vue_type_script_setup_true_lang-BuO105oW.js";
39
- import { p as G } from "./plugin-DPAnsB4s.js";
38
+ import "./InputSelect.vue_vue_type_script_setup_true_lang-CGlaDHiJ.js";
39
+ import { p as G } from "./plugin-DxUJiAk-.js";
40
40
  import { p as k } from "./plugin-B63n9_uc.js";
41
41
  import { p as w } from "./plugin-lYDlOt8p.js";
42
42
  import { p as x } from "./plugin-C8Z-XgLn.js";
@@ -44,7 +44,7 @@ import "./Link.vue_vue_type_script_setup_true_lang-BE-Gh_jJ.js";
44
44
  import { p as D } from "./plugin-CEByTREY.js";
45
45
  import { p as F } from "./plugin-dX-bbpm5.js";
46
46
  import { p as L } from "./plugin-DNXazWwT.js";
47
- import { p as M } from "./plugin-DxG6Hhao.js";
47
+ import { p as M } from "./plugin-jyvJNavM.js";
48
48
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-C37pLEUq.js";
49
49
  import { p as _ } from "./plugin-2Cr_XUjp.js";
50
50
  import "./Popover.vue_vue_type_script_setup_true_lang-DoSN5ymu.js";
package/dist/plugins.js CHANGED
@@ -2,15 +2,15 @@ import "./Avatar.vue_vue_type_script_setup_true_lang-D7NdR9hu.js";
2
2
  import { p as C } from "./plugin-DNwjBl_u.js";
3
3
  import "vue";
4
4
  import { p as b } from "./plugin-C-iGigb_.js";
5
- import "./Button.vue_vue_type_script_setup_true_lang-CUPz7wT9.js";
6
- import { p as S } from "./plugin-Cr3oXX-8.js";
5
+ import "./Button.vue_vue_type_script_setup_true_lang-DW0Q2Ut2.js";
6
+ import { p as S } from "./plugin-CV_fI920.js";
7
7
  import "./transform-DSaNEFMr.js";
8
8
  import "./ChartLine.vue_vue_type_style_index_0_lang-DO_gKCe4.js";
9
9
  import { p as v } from "./plugin-DDXOF4cU.js";
10
10
  import { p as D } from "./plugin-CyDnzy2n.js";
11
11
  import "./Drawer-Cl9_4uHA.js";
12
12
  import { p as L } from "./plugin-CNwzCYlr.js";
13
- import { p as A } from "./plugin-DrKx8l8j.js";
13
+ import { p as A } from "./plugin-x-Y35fqX.js";
14
14
  import { p as E } from "./plugin-CJ6sqqaI.js";
15
15
  import "./Form.vue_vue_type_script_setup_true_lang-CNGNCak7.js";
16
16
  import { p as j } from "./plugin-BuU0zOfE.js";
@@ -35,8 +35,8 @@ import { p as gr } from "./plugin-CrHDShgh.js";
35
35
  import { p as fr } from "./plugin-RM2wZuwL.js";
36
36
  import "./InputRadio.vue_vue_type_style_index_0_lang-n0nJwz8x.js";
37
37
  import { p as cr } from "./plugin-Do2-cqMT.js";
38
- import "./InputSelect.vue_vue_type_script_setup_true_lang-BuO105oW.js";
39
- import { p as yr } from "./plugin-DPAnsB4s.js";
38
+ import "./InputSelect.vue_vue_type_script_setup_true_lang-CGlaDHiJ.js";
39
+ import { p as yr } from "./plugin-DxUJiAk-.js";
40
40
  import { p as Cr } from "./plugin-B63n9_uc.js";
41
41
  import { p as br } from "./plugin-lYDlOt8p.js";
42
42
  import { p as Sr } from "./plugin-C8Z-XgLn.js";
@@ -44,7 +44,7 @@ import "./Link.vue_vue_type_script_setup_true_lang-BE-Gh_jJ.js";
44
44
  import { p as vr } from "./plugin-CEByTREY.js";
45
45
  import { p as Dr } from "./plugin-dX-bbpm5.js";
46
46
  import { p as Lr } from "./plugin-DNXazWwT.js";
47
- import { p as Ar } from "./plugin-DxG6Hhao.js";
47
+ import { p as Ar } from "./plugin-jyvJNavM.js";
48
48
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-C37pLEUq.js";
49
49
  import { p as Er } from "./plugin-2Cr_XUjp.js";
50
50
  import "./Popover.vue_vue_type_script_setup_true_lang-DoSN5ymu.js";
package/dist/tamandua.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as n } from "./plugins-BFVTdy-_.js";
1
+ import { p as n } from "./plugins-3Yf4y3PS.js";
2
2
  const o = {
3
3
  install(s) {
4
4
  for (const i in n)
@@ -6,6 +6,10 @@ declare const _default: import('vue').DefineComponent<{
6
6
  type: import("vue").PropType<boolean>;
7
7
  default: boolean;
8
8
  };
9
+ displayClass: {
10
+ type: import("vue").PropType<string>;
11
+ default: string;
12
+ };
9
13
  hasPageSize: {
10
14
  type: import("vue").PropType<boolean>;
11
15
  default: boolean;
@@ -25,6 +29,10 @@ declare const _default: import('vue').DefineComponent<{
25
29
  type: import("vue").PropType<boolean>;
26
30
  default: boolean;
27
31
  };
32
+ displayClass: {
33
+ type: import("vue").PropType<string>;
34
+ default: string;
35
+ };
28
36
  hasPageSize: {
29
37
  type: import("vue").PropType<boolean>;
30
38
  default: boolean;
@@ -40,6 +48,7 @@ declare const _default: import('vue').DefineComponent<{
40
48
  };
41
49
  }>>, {
42
50
  disabled: boolean;
51
+ displayClass: string;
43
52
  hasPageSize: boolean;
44
53
  pageLengths: Array<number>;
45
54
  showDescription: boolean;
@@ -1,5 +1,6 @@
1
1
  export type PaginationProps = {
2
2
  disabled?: boolean;
3
+ displayClass?: string;
3
4
  hasPageSize?: boolean;
4
5
  pageLengths?: Array<number>;
5
6
  showDescription: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caipira/tamandua",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "private": false,
5
5
  "description": "UI library for the Caipira ecosystem",
6
6
  "license": "GPL-3.0-only",
@@ -1,227 +0,0 @@
1
- import { defineComponent as ue, mergeModels as O, useModel as ne, ref as d, computed as I, onBeforeMount as oe, watch as D, resolveComponent as k, openBlock as o, createBlock as z, normalizeClass as x, withCtx as R, createElementVNode as se, createVNode as K, createElementBlock as p, renderSlot as g, normalizeProps as _, mergeProps as M, Fragment as V, renderList as N, guardReactiveProps as U, toDisplayString as q, createCommentVNode as T, withDirectives as ie, vModelText as re, createSlots as ce, createTextVNode as pe, nextTick as de } from "vue";
2
- import { a as fe, E as ve } from "./ui-J-lhC9qd.js";
3
- const me = { key: 1 }, ye = ["placeholder", "disabled", "readonly"], he = {
4
- key: 0,
5
- class: "inline-flex w-full justify-between items-center"
6
- }, be = {
7
- key: 1,
8
- class: "inline-flex items-center"
9
- }, ge = /* @__PURE__ */ ue({
10
- name: "TInputSelect",
11
- __name: "InputSelect",
12
- props: /* @__PURE__ */ O({
13
- size: { default: fe.Default },
14
- options: { default: () => [] },
15
- mapper: { type: Function, default: (f) => ({
16
- value: f.id ?? f.uuid,
17
- label: f
18
- }) },
19
- filter: { type: Function, default: (f, B) => B.label.toLowerCase().indexOf(f.toLowerCase()) >= 0 },
20
- tooltip: { default: "" },
21
- disabled: { type: Boolean },
22
- resource: {},
23
- multiple: { type: Boolean, default: !1 },
24
- placeholder: { default: "" },
25
- initialValue: {},
26
- isSearchable: { type: Boolean, default: !1 },
27
- dropdownPlacement: { default: ve.BOTTOM_START },
28
- widthClass: { default: "w-full" },
29
- borderClass: { default: "border input-border" },
30
- roundnessClass: { default: "input-roundness" }
31
- }, {
32
- modelValue: {},
33
- modelModifiers: {}
34
- }),
35
- emits: /* @__PURE__ */ O(["update:model-value"], ["update:modelValue"]),
36
- setup(f, { emit: B }) {
37
- const l = f;
38
- let $ = !1, C, j = "";
39
- const G = B, s = ne(f, "modelValue"), u = d([]), c = d(""), P = d(null), F = d(), i = d(!1), L = d(null), a = d([]), A = d(!1), v = d(null), h = I(() => a.value.length > 0), m = I(() => l.isSearchable && i.value), b = I(() => typeof l.resource == "function"), H = (e) => !l.multiple || !s.value || !Array.isArray(s.value) ? !1 : s.value.includes(e.value), J = (e = s.value) => !(e === void 0 || e === "" || Array.isArray(e) && e.length === 0), Q = (e) => {
40
- G("update:model-value", e);
41
- }, y = (e = s.value) => {
42
- if (J(e))
43
- if (l.multiple)
44
- Array.isArray(e) && (a.value = e.map(
45
- (t) => E(t)
46
- ).filter((t) => t > -1));
47
- else {
48
- const t = E(e);
49
- ~t && (a.value = [t]);
50
- }
51
- }, W = (e) => {
52
- i.value = !i.value, i.value && m.value && de(() => {
53
- P.value?.focus();
54
- });
55
- }, E = (e) => u.value.findIndex(
56
- (t) => t.value === e
57
- ), S = async (e = !1) => {
58
- if (!l.resource)
59
- return;
60
- A.value = !0;
61
- const t = {
62
- t: c.value,
63
- r: "option"
64
- };
65
- e && v.value && v.value.pages > v.value.page ? t.page = v.value.page + 1 : e = !1, !c.value && s.value && (t.i = s.value);
66
- const r = await l.resource(t);
67
- e ? u.value.push(...r.items.map(l.mapper)) : u.value = r.items.map(l.mapper), v.value = r.pagination, !b.value && c.value && y(c.value), A.value = !1;
68
- }, X = () => {
69
- !c.value || j === c.value || (C && (clearTimeout(C), C = null), C = setTimeout(() => {
70
- j = c.value, b.value ? (i.value || (i.value = !0), S()) : l.isSearchable && (u.value = l.options.filter(
71
- (e) => l.filter(c.value, e)
72
- ));
73
- }, 500));
74
- }, Y = ({
75
- index: e,
76
- hold: t
77
- }) => {
78
- if ($ = !0, l.multiple) {
79
- const r = a.value.findIndex(
80
- (w) => w === e
81
- );
82
- ~r ? a.value.splice(r, 1) : a.value.push(e);
83
- } else
84
- a.value = [e];
85
- (!l.multiple || !t) && (i.value = !1);
86
- }, Z = () => {
87
- b.value && v.value && v.value.pages > v.value.page && S(!0);
88
- }, ee = async (e) => {
89
- switch (e.key) {
90
- case "ArrowDown":
91
- L.value?.move(e);
92
- break;
93
- case "Escape":
94
- i.value = !1;
95
- break;
96
- }
97
- };
98
- return oe(async () => {
99
- b.value ? (await S(), y()) : l.options.length > 0 && (u.value = l.options), !s.value && l.initialValue ? y(l.initialValue) : y(s.value);
100
- }), D(
101
- () => s.value,
102
- async (e) => {
103
- e && (E(e) < 0 && b.value && await S(), y(e));
104
- }
105
- ), D(
106
- a,
107
- (e) => {
108
- const t = l.multiple ? u.value.filter(
109
- (r, w) => a.value.includes(w)
110
- ).map((r) => r.value) : u.value[a.value[0]].value;
111
- $ && ($ = !1, Q(t));
112
- },
113
- { deep: !0 }
114
- ), D(
115
- () => l.options,
116
- (e) => {
117
- e.length > 0 && (u.value = e, s.value && a.value.length === 0 && y(s.value));
118
- }
119
- ), (e, t) => {
120
- const r = k("t-tag"), w = k("t-button"), le = k("t-icon"), te = k("t-dropdown"), ae = k("t-popover");
121
- return o(), z(ae, {
122
- open: i.value,
123
- "onUpdate:open": t[1] || (t[1] = (n) => i.value = n),
124
- placement: l.dropdownPlacement,
125
- class: x([l.widthClass]),
126
- ref_key: "popoverRef",
127
- ref: F
128
- }, {
129
- default: R(() => [
130
- se("div", {
131
- class: x([{
132
- "h-9": !l.multiple,
133
- "h-full *:min-h-9": l.multiple,
134
- [l.borderClass]: !0,
135
- [l.roundnessClass]: !0
136
- }, "flex justify-between items-center w-full max-w-96 input-text-color select-none input-bg-color"])
137
- }, [
138
- K(w, {
139
- variant: "transparent",
140
- size: "",
141
- class: x(["h-full", {
142
- "w-full justify-end pr-2": !m.value && !h.value,
143
- "w-full justify-between pr-2": !m.value && h.value,
144
- "w-10 justify-center": m.value
145
- }]),
146
- "aria-describedby": F.value?.name,
147
- icon: i.value === !0 ? "chevron-up" : "chevron-down",
148
- onClick: W
149
- }, {
150
- default: R(() => [
151
- m.value ? T("", !0) : (o(), p("div", {
152
- key: 0,
153
- class: x(["inline-flex items-center ml-2 max-w-[calc(100%-2.5rem)]", {
154
- "overflow-hidden whitespace-nowrap": !l.multiple,
155
- "flex-wrap gap-2 py-1": l.multiple
156
- }])
157
- }, [
158
- e.$slots.selection && h.value ? g(e.$slots, "selection", _(M({ key: 0 }, u.value[a.value[0]]))) : e.$slots.default && h.value ? (o(), p(V, { key: 1 }, [
159
- l.multiple ? (o(!0), p(V, { key: 0 }, N(a.value, (n) => g(e.$slots, "default", _(U(u.value[n])))), 256)) : g(e.$slots, "default", _(M({ key: 1 }, u.value[a.value[0]])))
160
- ], 64)) : h.value ? (o(), p(V, { key: 2 }, [
161
- l.multiple ? (o(!0), p(V, { key: 0 }, N(a.value, (n) => (o(), z(r, {
162
- key: n,
163
- text: u.value[n].label,
164
- color: "#6e6e6e"
165
- }, null, 8, ["text"]))), 128)) : (o(), p("span", me, q(u.value[a.value[0]]?.label), 1))
166
- ], 64)) : T("", !0)
167
- ], 2))
168
- ]),
169
- _: 3
170
- }, 8, ["aria-describedby", "class", "icon"]),
171
- m.value ? ie((o(), p("input", {
172
- key: 0,
173
- "onUpdate:modelValue": t[0] || (t[0] = (n) => c.value = n),
174
- type: "text",
175
- ref_key: "inputRef",
176
- ref: P,
177
- placeholder: l.placeholder,
178
- disabled: l.disabled,
179
- readonly: !l.isSearchable,
180
- class: "h-9 bg-transparent input-padding input-roundness input-outline w-full",
181
- onInput: X,
182
- onKeydown: ee
183
- }, null, 40, ye)), [
184
- [re, c.value]
185
- ]) : T("", !0)
186
- ], 2)
187
- ]),
188
- content: R(() => [
189
- K(te, {
190
- ref_key: "dropdownRef",
191
- ref: L,
192
- items: u.value,
193
- "is-visible": i.value,
194
- multiple: l.multiple,
195
- loading: A.value,
196
- onChange: Y,
197
- onEndReached: Z
198
- }, ce({ _: 2 }, [
199
- e.$slots.default || l.multiple ? {
200
- name: "default",
201
- fn: R((n) => [
202
- l.multiple ? (o(), p("div", he, [
203
- e.$slots.default ? g(e.$slots, "default", _(M({ key: 0 }, n))) : (o(), p(V, { key: 1 }, [
204
- pe(q(n.label), 1)
205
- ], 64)),
206
- H(n) ? (o(), z(le, {
207
- key: 2,
208
- icon: "check",
209
- size: "sm",
210
- class: "float-right ml-2"
211
- })) : T("", !0)
212
- ])) : (o(), p("div", be, [
213
- g(e.$slots, "default", _(U(n)))
214
- ]))
215
- ]),
216
- key: "0"
217
- } : void 0
218
- ]), 1032, ["items", "is-visible", "multiple", "loading"])
219
- ]),
220
- _: 3
221
- }, 8, ["open", "placement", "class"]);
222
- };
223
- }
224
- });
225
- export {
226
- ge as _
227
- };
@@ -1,106 +0,0 @@
1
- import { defineComponent as w, mergeModels as C, useModel as y, ref as B, computed as i, resolveComponent as g, openBlock as r, createElementBlock as p, toDisplayString as x, createCommentVNode as m, createBlock as f, createElementVNode as L, createVNode as h, Fragment as M, renderList as S } from "vue";
2
- const N = { class: "flex gap-6 items-center flex-wrap select-none" }, z = {
3
- key: 0,
4
- class: "md:block hidden"
5
- }, D = { class: "h-9 flex" }, F = /* @__PURE__ */ w({
6
- name: "TPagination",
7
- __name: "Pagination",
8
- props: /* @__PURE__ */ C({
9
- disabled: { type: Boolean, default: !1 },
10
- hasPageSize: { type: Boolean, default: !0 },
11
- pageLengths: { default: () => [12, 18, 24, 30, 36, 42] },
12
- showDescription: { type: Boolean, default: !1 }
13
- }, {
14
- modelValue: {
15
- default: {
16
- page: 1,
17
- pages: 1,
18
- perPage: 12
19
- }
20
- },
21
- modelModifiers: {}
22
- }),
23
- emits: ["update:modelValue"],
24
- setup(d) {
25
- const v = d, e = y(d, "modelValue"), c = B(e.value.perPage ?? 12), b = i(() => e.value.page === 1), P = i(
26
- () => e.value.page === e.value.pages
27
- ), k = i(() => {
28
- const a = e.value.pages || 1, t = e.value.page || 1, n = [], s = Math.max(2, t - 2), l = Math.min(a - 1, t + 2);
29
- a > 1 && n.push(1);
30
- for (let o = s; o <= l; o++)
31
- o > 1 && o < a && n.push(o);
32
- return a > 1 && n.push(a), n;
33
- }), _ = i(() => v.pageLengths.map((a) => ({
34
- label: `${a} / page`,
35
- value: a
36
- }))), $ = i(() => {
37
- if ("items" in e.value && "skip" in e.value && "items" in e.value) {
38
- const a = e.value.skip + 1, t = e.value.skip + e.value.items, n = e.value.totalItems;
39
- return `Showing ${a} to ${t} of ${n} entries`;
40
- }
41
- return `Page ${e.value.page} of ${e.value.pages}`;
42
- }), u = (a) => {
43
- a === e.value.page || a < 1 || a > e.value.pages || (e.value = {
44
- ...e.value,
45
- page: a
46
- });
47
- }, V = (a) => {
48
- a !== e.value.perPage && (e.value = {
49
- ...e.value,
50
- perPage: a,
51
- page: 1
52
- });
53
- };
54
- return (a, t) => {
55
- const n = g("t-input-select"), s = g("t-button");
56
- return r(), p("div", N, [
57
- a.showDescription ? (r(), p("div", z, x($.value), 1)) : m("", !0),
58
- v.hasPageSize ? (r(), f(n, {
59
- key: 1,
60
- modelValue: c.value,
61
- "onUpdate:modelValue": [
62
- t[0] || (t[0] = (l) => c.value = l),
63
- V
64
- ],
65
- "width-class": "",
66
- class: "w-fit min-w-32",
67
- "dropdown-placement": "top",
68
- disabled: a.disabled,
69
- options: _.value
70
- }, null, 8, ["modelValue", "disabled", "options"])) : m("", !0),
71
- L("div", D, [
72
- h(s, {
73
- variant: "transparent",
74
- label: "Prevous",
75
- icon: "chevron-left",
76
- hover: !0,
77
- "disable-style": !0,
78
- disabled: b.value,
79
- onClick: t[1] || (t[1] = (l) => u(e.value.page - 1))
80
- }, null, 8, ["disabled"]),
81
- (r(!0), p(M, null, S(k.value, (l) => (r(), f(s, {
82
- variant: "transparent",
83
- hover: !0,
84
- label: `${l}`,
85
- outline: l === e.value.page,
86
- bold: l === e.value.page,
87
- disabled: l === e.value.page,
88
- onClick: (o) => u(l)
89
- }, null, 8, ["label", "outline", "bold", "disabled", "onClick"]))), 256)),
90
- h(s, {
91
- variant: "transparent",
92
- label: "Next",
93
- icon: "chevron-right",
94
- "icon-position": "right",
95
- hover: !0,
96
- disabled: P.value,
97
- onClick: t[2] || (t[2] = (l) => u(e.value.page + 1))
98
- }, null, 8, ["disabled"])
99
- ])
100
- ]);
101
- };
102
- }
103
- });
104
- export {
105
- F as _
106
- };