vlite3 0.3.4 → 0.3.6

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.
@@ -20,22 +20,24 @@ declare function __VLS_template(): {
20
20
  };
21
21
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
22
22
  declare const __VLS_component: import('vue').DefineComponent<DataListProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
23
- "update:itemsPerPage": (limit: number) => any;
24
- "page-change": (page: number) => any;
23
+ change: (payload: {
24
+ page: number;
25
+ limit: number;
26
+ }) => any;
25
27
  }, string, import('vue').PublicProps, Readonly<DataListProps> & Readonly<{
26
- "onUpdate:itemsPerPage"?: (limit: number) => any;
27
- "onPage-change"?: (page: number) => any;
28
+ onChange?: (payload: {
29
+ page: number;
30
+ limit: number;
31
+ }) => any;
28
32
  }>, {
29
33
  data: any[];
30
34
  loading: boolean;
31
35
  className: string;
32
- paginationPosition: "start" | "center" | "end" | "between";
33
- showItemsPerPage: boolean;
34
- itemsPerPageOptions: number[];
35
36
  emptyTitle: string;
36
37
  emptyDescription: string;
37
38
  emptyIcon: string;
38
39
  showPagination: boolean;
40
+ paginationProps: import('./types').DataListMetaInfo;
39
41
  itemProps: Record<string, any>;
40
42
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
41
43
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
@@ -1,16 +1,16 @@
1
- import { defineComponent as b, computed as r, openBlock as t, createElementBlock as n, normalizeClass as c, Fragment as u, renderList as f, renderSlot as l, createBlock as y, resolveDynamicComponent as P, createElementVNode as i, createVNode as h, toDisplayString as k, mergeProps as C, createCommentVNode as p, unref as N } from "vue";
2
- import B from "../Pagination/Pagination.vue.js";
3
- import $ from "../Icon.vue.js";
4
- const D = { class: "flex flex-col w-full" }, V = {
1
+ import { defineComponent as B, ref as D, watch as u, computed as f, openBlock as a, createElementBlock as n, normalizeClass as y, Fragment as P, renderList as h, renderSlot as i, createBlock as k, resolveDynamicComponent as v, createElementVNode as d, createVNode as I, toDisplayString as p, mergeProps as x, createCommentVNode as b, unref as L } from "vue";
2
+ import j from "../Pagination/Pagination.vue.js";
3
+ import E from "../Icon.vue.js";
4
+ const S = { class: "flex flex-col w-full" }, z = {
5
5
  key: 1,
6
6
  class: "h-48 rounded-lg bg-gray-200 animate-pulse w-full"
7
- }, j = {
7
+ }, F = {
8
8
  key: 1,
9
9
  class: "flex flex-col items-center justify-center p-12 text-center bg-gray-50 border border-gray-200 rounded-lg"
10
- }, E = { class: "flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 mb-4" }, L = { class: "text-lg font-semibold text-gray-900" }, O = { class: "mt-2 text-sm text-gray-500" }, S = {
10
+ }, O = { class: "flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 mb-4" }, U = { class: "text-lg font-semibold text-gray-900" }, V = { class: "mt-2 text-sm text-gray-500" }, W = {
11
11
  key: 3,
12
- class: "mt-8"
13
- }, W = /* @__PURE__ */ b({
12
+ class: "mt-8 w-full"
13
+ }, H = /* @__PURE__ */ B({
14
14
  __name: "DataList",
15
15
  props: {
16
16
  data: { default: () => [] },
@@ -25,74 +25,96 @@ const D = { class: "flex flex-col w-full" }, V = {
25
25
  emptyDescription: { default: "We could not find any items to display here." },
26
26
  emptyIcon: { default: "lucide:inbox" },
27
27
  showPagination: { type: Boolean, default: !0 },
28
- paginationPosition: { default: "between" },
29
- itemsPerPageOptions: { default: () => [10, 25, 50, 100] },
30
- showItemsPerPage: { type: Boolean, default: !1 }
28
+ paginationProps: { default: () => ({
29
+ alignment: "end",
30
+ navType: "icon",
31
+ showItemsPerPage: !1,
32
+ itemsPerPageOptions: [10, 25, 50, 100],
33
+ showPageInfo: !1
34
+ }) }
31
35
  },
32
- emits: ["page-change", "update:itemsPerPage"],
33
- setup(e, { emit: v }) {
34
- const d = e, m = v, w = (a) => {
35
- m("page-change", a);
36
- }, x = (a) => {
37
- m("update:itemsPerPage", a);
38
- }, I = r(() => d.pageInfo?.currentPage || 1), g = r(() => d.pageInfo?.totalPages || 1);
39
- return (a, T) => (t(), n("div", D, [
40
- e.loading ? (t(), n("div", {
36
+ emits: ["change"],
37
+ setup(e, { emit: w }) {
38
+ const o = e, C = w, s = D(o.pageInfo?.itemsPerPage || o.paginationProps?.itemsPerPage || 10);
39
+ u(
40
+ () => o.pageInfo?.itemsPerPage,
41
+ (t) => {
42
+ t !== void 0 && (s.value = t);
43
+ }
44
+ ), u(
45
+ () => o.paginationProps?.itemsPerPage,
46
+ (t) => {
47
+ t !== void 0 && (s.value = t);
48
+ }
49
+ );
50
+ let r = null;
51
+ const g = (t, m) => {
52
+ r && clearTimeout(r), r = setTimeout(() => {
53
+ C("change", { page: t, limit: m });
54
+ }, 10);
55
+ }, N = (t) => {
56
+ g(t, s.value);
57
+ }, T = (t) => {
58
+ s.value = t, g(o.pageInfo?.currentPage || 1, t);
59
+ };
60
+ f(() => o.pageInfo?.currentPage || 1);
61
+ const $ = f(() => o.pageInfo?.totalPages || 1);
62
+ return (t, m) => (a(), n("div", S, [
63
+ e.loading ? (a(), n("div", {
41
64
  key: 0,
42
- class: c(e.className)
65
+ class: y(e.className)
43
66
  }, [
44
- (t(), n(u, null, f(8, (s) => l(a.$slots, "skeleton", {
45
- key: "skeleton-" + s,
46
- index: s
67
+ (a(), n(P, null, h(8, (l) => i(t.$slots, "skeleton", {
68
+ key: "skeleton-" + l,
69
+ index: l
47
70
  }, () => [
48
- l(a.$slots, "skelton", { index: s }, () => [
49
- e.skeleton || e.skelton ? (t(), y(P(e.skeleton || e.skelton), { key: 0 })) : (t(), n("div", V))
71
+ i(t.$slots, "skelton", { index: l }, () => [
72
+ e.skeleton || e.skelton ? (a(), k(v(e.skeleton || e.skelton), { key: 0 })) : (a(), n("div", z))
50
73
  ])
51
74
  ])), 64))
52
- ], 2)) : !e.data || e.data.length === 0 ? (t(), n("div", j, [
53
- l(a.$slots, "empty", {}, () => [
54
- i("div", E, [
55
- h($, {
75
+ ], 2)) : !e.data || e.data.length === 0 ? (a(), n("div", F, [
76
+ i(t.$slots, "empty", {}, () => [
77
+ d("div", O, [
78
+ I(E, {
56
79
  icon: e.emptyIcon,
57
80
  class: "h-6 w-6 text-gray-500"
58
81
  }, null, 8, ["icon"])
59
82
  ]),
60
- i("h3", L, k(e.emptyTitle), 1),
61
- i("p", O, k(e.emptyDescription), 1)
83
+ d("h3", U, p(e.emptyTitle), 1),
84
+ d("p", V, p(e.emptyDescription), 1)
62
85
  ])
63
- ])) : (t(), n("div", {
86
+ ])) : (a(), n("div", {
64
87
  key: 2,
65
- class: c(e.className)
88
+ class: y(e.className)
66
89
  }, [
67
- (t(!0), n(u, null, f(e.data, (s, o) => l(a.$slots, "item", {
68
- key: o,
69
- item: s,
90
+ (a(!0), n(P, null, h(e.data, (l, c) => i(t.$slots, "item", {
91
+ key: c,
92
+ item: l,
70
93
  data: e.data,
71
- index: o
94
+ index: c
72
95
  }, () => [
73
- e.item ? (t(), y(P(e.item), C({
96
+ e.item ? (a(), k(v(e.item), x({
74
97
  key: 0,
75
- item: s,
98
+ item: l,
76
99
  data: e.data,
77
- index: o
78
- }, { ref_for: !0 }, e.itemProps), null, 16, ["item", "data", "index"])) : p("", !0)
100
+ index: c
101
+ }, { ref_for: !0 }, e.itemProps), null, 16, ["item", "data", "index"])) : b("", !0)
79
102
  ])), 128))
80
103
  ], 2)),
81
- e.showPagination && e.pageInfo && g.value > 1 ? (t(), n("div", S, [
82
- h(N(B), {
83
- "current-page": I.value,
84
- "total-pages": g.value,
85
- alignment: e.paginationPosition,
86
- "show-items-per-page": e.showItemsPerPage,
87
- "items-per-page": e.pageInfo?.itemsPerPage,
88
- "items-per-page-options": e.itemsPerPageOptions,
89
- onChange: w,
90
- "onUpdate:itemsPerPage": x
91
- }, null, 8, ["current-page", "total-pages", "alignment", "show-items-per-page", "items-per-page", "items-per-page-options"])
92
- ])) : p("", !0)
104
+ e.showPagination && e.pageInfo && $.value > 1 ? (a(), n("div", W, [
105
+ I(L(j), x({
106
+ "current-page": e.pageInfo?.currentPage,
107
+ "total-pages": e.pageInfo?.totalPages,
108
+ "total-items": e.pageInfo?.totalItems,
109
+ navType: "icon"
110
+ }, e.paginationProps, {
111
+ onChange: N,
112
+ "onUpdate:itemsPerPage": T
113
+ }), null, 16, ["current-page", "total-pages", "total-items"])
114
+ ])) : b("", !0)
93
115
  ]));
94
116
  }
95
117
  });
96
118
  export {
97
- W as default
119
+ H as default
98
120
  };
@@ -1,13 +1,9 @@
1
- export interface DataListPageInfo {
2
- currentPage: number;
3
- totalPages: number;
4
- totalItems?: number;
5
- itemsPerPage?: number;
6
- }
1
+ import { PageInfo, PaginationProps } from '../Pagination';
2
+ export type DataListMetaInfo = Omit<PaginationProps, 'currentPage' | 'totalPages'>;
7
3
  export interface DataListProps {
8
4
  data?: any[];
9
5
  loading?: boolean;
10
- pageInfo?: DataListPageInfo;
6
+ pageInfo?: PageInfo;
11
7
  className?: string;
12
8
  item?: any;
13
9
  skeleton?: any;
@@ -17,7 +13,5 @@ export interface DataListProps {
17
13
  emptyDescription?: string;
18
14
  emptyIcon?: string;
19
15
  showPagination?: boolean;
20
- paginationPosition?: 'start' | 'center' | 'end' | 'between';
21
- itemsPerPageOptions?: number[];
22
- showItemsPerPage?: boolean;
16
+ paginationProps?: DataListMetaInfo;
23
17
  }
@@ -37,9 +37,6 @@ declare const __VLS_component: import('vue').DefineComponent<DataTableProps, {},
37
37
  rows: any[];
38
38
  selectable: boolean;
39
39
  showSearch: boolean;
40
- showItemsPerPage: boolean;
41
- itemsPerPage: number;
42
- itemsPerPageOptions: number[];
43
40
  compact: boolean;
44
41
  headers: import('./types').TableHeader[];
45
42
  keyField: string;
@@ -53,6 +50,7 @@ declare const __VLS_component: import('vue').DefineComponent<DataTableProps, {},
53
50
  emptyDescription: string;
54
51
  emptyIcon: string;
55
52
  showPagination: boolean;
53
+ paginationProps: import('./types').DataTablePaginationProps;
56
54
  bordered: boolean;
57
55
  sortable: boolean;
58
56
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;