@caipira/tamandua 0.0.52 → 0.0.54

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,5 +1,5 @@
1
- import { _ as i } from "./Pagination.vue_vue_type_script_setup_true_lang-BJO_aOJk.js";
2
- import { p as r } from "./plugin-Da5BWlyX.js";
1
+ import { _ as i } from "./Pagination.vue_vue_type_script_setup_true_lang-Bgc3FPMU.js";
2
+ import { p as r } from "./plugin-KCYRmKkj.js";
3
3
  export {
4
4
  i as Pagination,
5
5
  r as PaginationPlugin
@@ -0,0 +1,108 @@
1
+ import { defineComponent as C, mergeModels as V, useModel as x, ref as z, computed as o, resolveComponent as h, openBlock as i, createElementBlock as d, toDisplayString as B, createCommentVNode as b, createElementVNode as L, createVNode as y, normalizeClass as p, Fragment as M, renderList as S, createBlock as P } from "vue";
2
+ const D = { class: "flex gap-2 items-center flex-wrap" }, N = {
3
+ key: 0,
4
+ class: "md:block hidden"
5
+ }, E = { class: "h-9 flex" }, T = /* @__PURE__ */ C({
6
+ name: "TPagination",
7
+ __name: "Pagination",
8
+ props: /* @__PURE__ */ V({
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(c) {
25
+ const v = c, e = x(c, "modelValue"), m = z(e.value.perPage ?? 12), g = o(() => e.value.page === 1), f = o(
26
+ () => e.value.page === e.value.pages
27
+ ), k = o(() => {
28
+ const a = e.value.pages || 1, t = e.value.page || 1, l = [], u = Math.max(2, t - 2), s = Math.min(a - 1, t + 2);
29
+ a > 1 && l.push(1);
30
+ for (let n = u; n <= s; n++)
31
+ n > 1 && n < a && l.push(n);
32
+ return a > 1 && l.push(a), l;
33
+ }), w = o(() => v.pageLengths.map((a) => ({
34
+ label: `${a} / page`,
35
+ value: a
36
+ }))), _ = o(() => {
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, l = e.value.totalItems;
39
+ return `Showing ${a} to ${t} of ${l} entries`;
40
+ }
41
+ return `Page ${e.value.page} of ${e.value.pages}`;
42
+ }), r = (a) => {
43
+ a === e.value.page || a < 1 || a > e.value.pages || (e.value = {
44
+ ...e.value,
45
+ page: a
46
+ });
47
+ }, $ = (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 l = h("t-button"), u = h("t-input-select");
56
+ return i(), d("div", D, [
57
+ a.showDescription ? (i(), d("div", N, B(_.value), 1)) : b("", !0),
58
+ L("div", E, [
59
+ y(l, {
60
+ size: "sm",
61
+ variant: "primary",
62
+ "disable-style": !0,
63
+ class: p(["h-9 px-2 input-roundness rounded-r-none", { "opacity-50 cursor-not-allowed": g.value }]),
64
+ icon: "chevron-left",
65
+ disabled: g.value,
66
+ onClick: t[0] || (t[0] = (s) => r(e.value.page - 1))
67
+ }, null, 8, ["class", "disabled"]),
68
+ (i(!0), d(M, null, S(k.value, (s) => (i(), P(l, {
69
+ "disable-style": !0,
70
+ label: `${s}`,
71
+ disabled: s === e.value.page,
72
+ class: p([{
73
+ "opacity-50 cursor-not-allowed": s === e.value.page
74
+ }, "h-9 px-2 rounded-none"]),
75
+ size: "sm",
76
+ variant: "primary",
77
+ onClick: (n) => r(s)
78
+ }, null, 8, ["label", "disabled", "class", "onClick"]))), 256)),
79
+ y(l, {
80
+ size: "sm",
81
+ variant: "primary",
82
+ "disable-style": !0,
83
+ class: p(["h-9 px-2 input-roundness rounded-l-none", { "opacity-50 cursor-not-allowed": f.value }]),
84
+ icon: "chevron-right",
85
+ disabled: f.value,
86
+ onClick: t[1] || (t[1] = (s) => r(e.value.page + 1))
87
+ }, null, 8, ["class", "disabled"])
88
+ ]),
89
+ v.hasPageSize ? (i(), P(u, {
90
+ key: 1,
91
+ modelValue: m.value,
92
+ "onUpdate:modelValue": [
93
+ t[2] || (t[2] = (s) => m.value = s),
94
+ $
95
+ ],
96
+ "width-class": "",
97
+ class: "w-fit min-w-32",
98
+ "dropdown-placement": "top",
99
+ disabled: a.disabled,
100
+ options: w.value
101
+ }, null, 8, ["modelValue", "disabled", "options"])) : b("", !0)
102
+ ]);
103
+ };
104
+ }
105
+ });
106
+ export {
107
+ T as _
108
+ };
@@ -32,7 +32,7 @@ import { _ as sr } from "./InputTextarea.vue_vue_type_script_setup_true_lang-DRo
32
32
  import { _ as fr } from "./Link.vue_vue_type_script_setup_true_lang-Gvmff9-3.js";
33
33
  import { _ as nr } from "./Modal.vue_vue_type_script_setup_true_lang-CEaX1svl.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-BJO_aOJk.js";
35
+ import { _ as lr } from "./Pagination.vue_vue_type_script_setup_true_lang-Bgc3FPMU.js";
36
36
  import { _ as cr } from "./Popconfirm.vue_vue_type_script_setup_true_lang-C811ZrE7.js";
37
37
  import { _ as Tr } from "./Popover.vue_vue_type_script_setup_true_lang-D1oZrofv.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 "./Pagination.vue_vue_type_script_setup_true_lang-BJO_aOJk.js";
2
+ import { _ as s } from "./Pagination.vue_vue_type_script_setup_true_lang-Bgc3FPMU.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -44,7 +44,7 @@ import "./Link.vue_vue_type_script_setup_true_lang-Gvmff9-3.js";
44
44
  import { p as D } from "./plugin-tCWn1gjD.js";
45
45
  import { p as F } from "./plugin-DKjcKBPg.js";
46
46
  import { p as L } from "./plugin-DNXazWwT.js";
47
- import { p as M } from "./plugin-Da5BWlyX.js";
47
+ import { p as M } from "./plugin-KCYRmKkj.js";
48
48
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-C811ZrE7.js";
49
49
  import { p as _ } from "./plugin-OLiFUzUI.js";
50
50
  import "./Popover.vue_vue_type_script_setup_true_lang-D1oZrofv.js";
package/dist/plugins.js CHANGED
@@ -44,7 +44,7 @@ import "./Link.vue_vue_type_script_setup_true_lang-Gvmff9-3.js";
44
44
  import { p as vr } from "./plugin-tCWn1gjD.js";
45
45
  import { p as Dr } from "./plugin-DKjcKBPg.js";
46
46
  import { p as Lr } from "./plugin-DNXazWwT.js";
47
- import { p as Ar } from "./plugin-Da5BWlyX.js";
47
+ import { p as Ar } from "./plugin-KCYRmKkj.js";
48
48
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-C811ZrE7.js";
49
49
  import { p as Er } from "./plugin-OLiFUzUI.js";
50
50
  import "./Popover.vue_vue_type_script_setup_true_lang-D1oZrofv.js";
package/dist/tamandua.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as n } from "./plugins-D7QPM9Ae.js";
1
+ import { p as n } from "./plugins-Cu7QCqK7.js";
2
2
  const o = {
3
3
  install(s) {
4
4
  for (const i in n)
@@ -1,12 +1,11 @@
1
+ import { Pagination as TPagination } from '../../types/ui.js';
2
+
1
3
  declare const _default: {
2
4
  title: string;
3
5
  args: {
6
+ modelValue: TPagination;
4
7
  hasPageSize: boolean;
5
8
  showDescription: boolean;
6
- pagination: {
7
- page: number;
8
- pages: number;
9
- };
10
9
  };
11
10
  };
12
11
  export default _default;
@@ -1,44 +1,47 @@
1
- import { PaginationProps } from './types.js';
2
1
  import { Pagination } from '../../types/ui.js';
3
2
 
4
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PaginationProps>, {
5
- disabled: boolean;
6
- pagination: () => Pagination;
7
- hasPageSize: boolean;
8
- pageLengths: () => number[];
9
- showDescription: boolean;
10
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
- updated: (val: Pagination) => void;
12
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PaginationProps>, {
13
- disabled: boolean;
14
- pagination: () => Pagination;
15
- hasPageSize: boolean;
16
- pageLengths: () => number[];
17
- showDescription: boolean;
18
- }>>> & {
19
- onUpdated?: ((val: Pagination) => any) | undefined;
20
- }, {
3
+ declare const _default: import('vue').DefineComponent<{
4
+ modelValue: import("vue").PropType<Pagination>;
5
+ disabled: {
6
+ type: import("vue").PropType<boolean>;
7
+ default: boolean;
8
+ };
9
+ hasPageSize: {
10
+ type: import("vue").PropType<boolean>;
11
+ default: boolean;
12
+ };
13
+ pageLengths: {
14
+ type: import("vue").PropType<number[]>;
15
+ default: () => number[];
16
+ };
17
+ showDescription: {
18
+ type: import("vue").PropType<boolean>;
19
+ required: true;
20
+ default: boolean;
21
+ };
22
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ modelValue: import("vue").PropType<Pagination>;
24
+ disabled: {
25
+ type: import("vue").PropType<boolean>;
26
+ default: boolean;
27
+ };
28
+ hasPageSize: {
29
+ type: import("vue").PropType<boolean>;
30
+ default: boolean;
31
+ };
32
+ pageLengths: {
33
+ type: import("vue").PropType<number[]>;
34
+ default: () => number[];
35
+ };
36
+ showDescription: {
37
+ type: import("vue").PropType<boolean>;
38
+ required: true;
39
+ default: boolean;
40
+ };
41
+ }>>, {
21
42
  disabled: boolean;
22
- pagination: Pagination;
23
43
  hasPageSize: boolean;
24
44
  pageLengths: number[];
25
45
  showDescription: boolean;
26
46
  }, {}>;
27
47
  export default _default;
28
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
29
- type __VLS_TypePropsToRuntimeProps<T> = {
30
- [K in keyof T]-?: {} extends Pick<T, K> ? {
31
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
32
- } : {
33
- type: import('vue').PropType<T[K]>;
34
- required: true;
35
- };
36
- };
37
- type __VLS_WithDefaults<P, D> = {
38
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
39
- default: D[K];
40
- }> : P[K];
41
- };
42
- type __VLS_Prettify<T> = {
43
- [K in keyof T]: T[K];
44
- } & {};
@@ -2,4 +2,4 @@ import { default as PaginationPlugin } from './plugin.js';
2
2
  import { default as Pagination } from './Pagination.vue';
3
3
 
4
4
  export { Pagination, PaginationPlugin };
5
- export type { PaginationProps, PaginationEvents } from './types.js';
5
+ export type { PaginationProps } from './types.js';
@@ -1,12 +1,6 @@
1
- import { Pagination } from '../../types/ui.js';
2
-
3
1
  export type PaginationProps = {
4
2
  disabled?: boolean;
5
- pagination?: Pagination;
6
3
  hasPageSize?: boolean;
7
4
  pageLengths?: Array<number>;
8
5
  showDescription: boolean;
9
6
  };
10
- export type PaginationEvents = {
11
- (e: "updated", val: Pagination): void;
12
- };
@@ -8,7 +8,7 @@ import { ProgressLineProps } from './ProgressLine/index.js';
8
8
  import { ProgressCircleProps } from './ProgressCircle/index.js';
9
9
  import { PopoverProps } from './Popover/index.js';
10
10
  import { PopconfirmProps, PopconfirmEvents } from './Popconfirm/index.js';
11
- import { PaginationProps, PaginationEvents } from './Pagination/index.js';
11
+ import { PaginationProps } from './Pagination/index.js';
12
12
  import { ModalFormProps, ModalFormEvents } from './ModalForm/index.js';
13
13
  import { ModalProps, ModalEvents } from './Modal/index.js';
14
14
  import { LinkProps, LinkEvents } from './Link/index.js';
@@ -42,4 +42,4 @@ import { ButtonProps, ButtonEvents } from './Button/index.js';
42
42
  import { BackdropProps, BackdropEvents } from './Backdrop/index.js';
43
43
  import { AvatarProps } from './Avatar/index.js';
44
44
 
45
- export type { AvatarProps, BackdropProps, BackdropEvents, ButtonProps, ButtonEvents, ChartLineProps, ChartTreemapProps, DrawerProps, DrawerEvents, DropdownProps, DropdownEvents, FileDropProps, FileDropEvents, FormProps, FormEvents, FormItemProps, GraphyEmptyProps, GraphyLabelProps, GraphyPriceProps, GraphySubtitleProps, GraphyTitleProps, IconProps, InputAvatarProps, InputAvatarEvents, InputCheckboxProps, InputCheckboxEvents, InputColorProps, InputColorEvents, InputDateProps, InputDateEvents, InputMultiplierEvents, InputPasswordModel, InputPasswordProps, InputPasswordEvents, InputPhoneProps, InputPhoneEvents, InputPriceModel, InputPriceProps, InputPriceEvents, InputRadioProps, InputRadioGroupProps, InputRadioGroupEvents, InputSelectValue, InputSelectProps, InputSelectOption, InputSelectEvents, InputSwitchProps, InputSwitchEvents, InputMultiplierProps, InputTextProps, InputTextEvents, InputTextareaProps, InputTextareaEvents, LinkProps, LinkEvents, ModalProps, ModalEvents, ModalFormProps, ModalFormEvents, PaginationProps, PaginationEvents, PopconfirmProps, PopconfirmEvents, PopoverProps, ProgressCircleProps, ProgressLineProps, SensitiveInfoProps, SkeletonProps, TabProps, TableProps, TableEvents, TagEvents, TagProps, ToastProps, ToastEvents, };
45
+ export type { AvatarProps, BackdropProps, BackdropEvents, ButtonProps, ButtonEvents, ChartLineProps, ChartTreemapProps, DrawerProps, DrawerEvents, DropdownProps, DropdownEvents, FileDropProps, FileDropEvents, FormProps, FormEvents, FormItemProps, GraphyEmptyProps, GraphyLabelProps, GraphyPriceProps, GraphySubtitleProps, GraphyTitleProps, IconProps, InputAvatarProps, InputAvatarEvents, InputCheckboxProps, InputCheckboxEvents, InputColorProps, InputColorEvents, InputDateProps, InputDateEvents, InputMultiplierEvents, InputPasswordModel, InputPasswordProps, InputPasswordEvents, InputPhoneProps, InputPhoneEvents, InputPriceModel, InputPriceProps, InputPriceEvents, InputRadioProps, InputRadioGroupProps, InputRadioGroupEvents, InputSelectValue, InputSelectProps, InputSelectOption, InputSelectEvents, InputSwitchProps, InputSwitchEvents, InputMultiplierProps, InputTextProps, InputTextEvents, InputTextareaProps, InputTextareaEvents, LinkProps, LinkEvents, ModalProps, ModalEvents, ModalFormProps, ModalFormEvents, PaginationProps, PopconfirmProps, PopconfirmEvents, PopoverProps, ProgressCircleProps, ProgressLineProps, SensitiveInfoProps, SkeletonProps, TabProps, TableProps, TableEvents, TagEvents, TagProps, ToastProps, ToastEvents, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caipira/tamandua",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "private": false,
5
5
  "description": "UI library for the Caipira ecosystem",
6
6
  "license": "GPL-3.0-only",
@@ -1,107 +0,0 @@
1
- import { defineComponent as B, computed as s, watch as S, resolveComponent as h, openBlock as p, createElementBlock as g, toDisplayString as V, createCommentVNode as v, createElementVNode as _, createVNode as b, normalizeClass as d, Fragment as L, renderList as N, createBlock as y } from "vue";
2
- const O = { class: "flex gap-2 items-center flex-wrap" }, D = {
3
- key: 0,
4
- class: "md:block hidden"
5
- }, I = { class: "h-9 flex" }, E = /* @__PURE__ */ B({
6
- name: "TPagination",
7
- __name: "Pagination",
8
- props: {
9
- disabled: { type: Boolean, default: !1 },
10
- pagination: { default: () => ({}) },
11
- hasPageSize: { type: Boolean, default: !0 },
12
- pageLengths: { default: () => [12, 18, 24, 30, 36, 42] },
13
- showDescription: { type: Boolean, default: !1 }
14
- },
15
- emits: ["updated"],
16
- setup(P, { emit: k }) {
17
- const e = P, u = k, c = s(() => e.pagination.page === 1), m = s(
18
- () => e.pagination.page === e.pagination.pages
19
- ), w = s(() => {
20
- const a = e.pagination.pages || 1, n = e.pagination.page || 1, t = [], r = Math.max(2, n - 2), i = Math.min(a - 1, n + 2);
21
- a > 1 && t.push(1);
22
- for (let o = r; o <= i; o++)
23
- o > 1 && o < a && t.push(o);
24
- return a > 1 && t.push(a), t;
25
- }), $ = s(() => e.pageLengths.map((a) => ({
26
- label: `${a} / page`,
27
- value: a
28
- }))), C = s(() => {
29
- if (e.pagination.items && e.pagination.skip && e.pagination.items) {
30
- const a = e.pagination.skip + 1, n = e.pagination.skip + e.pagination.items, t = e.pagination.totalItems;
31
- return `Showing ${a} to ${n} of ${t} entries`;
32
- }
33
- return `Page ${e.pagination.page} of ${e.pagination.pages}`;
34
- }), f = (a = e.pagination.page) => {
35
- const n = {
36
- ...e.pagination,
37
- page: a
38
- };
39
- "perPage" in e.pagination && "skip" in e.pagination && "totalItems" in e.pagination && (n.skip = a > 1 ? (a - 1) * e.pagination.perPage : 0, n.items = e.pagination.perPage ? e.pagination.perPage : e.pagination.totalItems - n.skip), JSON.stringify(e.pagination) !== JSON.stringify(n) && (Object.assign(e.pagination, n), u("updated", e.pagination));
40
- }, l = (a) => {
41
- a === e.pagination.page || a < 1 || a > e.pagination.pages || f(a);
42
- }, z = (a) => {
43
- Object.assign(e.pagination, {
44
- ...e.pagination,
45
- perPage: a,
46
- page: 1
47
- }), u("updated", e.pagination);
48
- };
49
- return S(
50
- () => e.pagination,
51
- () => f(),
52
- { deep: !0, immediate: !0 }
53
- ), (a, n) => {
54
- const t = h("t-button"), r = h("t-input-select");
55
- return p(), g("div", O, [
56
- a.showDescription ? (p(), g("div", D, V(C.value), 1)) : v("", !0),
57
- _("div", I, [
58
- b(t, {
59
- size: "sm",
60
- variant: "primary",
61
- "disable-style": !0,
62
- class: d(["h-9 px-2 input-roundness rounded-r-none", { "opacity-50 cursor-not-allowed": c.value }]),
63
- icon: "chevron-left",
64
- disabled: c.value,
65
- onClick: n[0] || (n[0] = (i) => l(a.pagination.page - 1))
66
- }, null, 8, ["class", "disabled"]),
67
- (p(!0), g(L, null, N(w.value, (i) => (p(), y(t, {
68
- "disable-style": !0,
69
- label: `${i}`,
70
- disabled: i === a.pagination.page,
71
- class: d([{
72
- "opacity-50 cursor-not-allowed": i === a.pagination.page
73
- }, "h-9 px-2 rounded-none"]),
74
- size: "sm",
75
- variant: "primary",
76
- onClick: (o) => l(i)
77
- }, null, 8, ["label", "disabled", "class", "onClick"]))), 256)),
78
- b(t, {
79
- size: "sm",
80
- variant: "primary",
81
- "disable-style": !0,
82
- class: d(["h-9 px-2 input-roundness rounded-l-none", { "opacity-50 cursor-not-allowed": m.value }]),
83
- icon: "chevron-right",
84
- disabled: m.value,
85
- onClick: n[1] || (n[1] = (i) => l(a.pagination.page + 1))
86
- }, null, 8, ["class", "disabled"])
87
- ]),
88
- e.hasPageSize ? (p(), y(r, {
89
- key: 1,
90
- modelValue: a.pagination.perPage,
91
- "onUpdate:modelValue": [
92
- n[2] || (n[2] = (i) => a.pagination.perPage = i),
93
- z
94
- ],
95
- "width-class": "",
96
- class: "w-fit min-w-32",
97
- "dropdown-placement": "top",
98
- disabled: a.disabled,
99
- options: $.value
100
- }, null, 8, ["modelValue", "disabled", "options"])) : v("", !0)
101
- ]);
102
- };
103
- }
104
- });
105
- export {
106
- E as _
107
- };