v-page 3.2.0 → 3.3.0
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/README.md +20 -2
- package/dist/v-page.js +259 -239
- package/dist/v-page.umd.cjs +2 -2
- package/package.json +14 -12
- package/types/index.d.ts +36 -28
package/README.md
CHANGED
|
@@ -67,12 +67,30 @@ import { PaginationBar } from 'v-page'
|
|
|
67
67
|
v-model="pageNumber"
|
|
68
68
|
:total-row="totalRow"
|
|
69
69
|
@change="paginationChange"
|
|
70
|
-
|
|
70
|
+
>
|
|
71
|
+
<PaginationPageSizeOptions />
|
|
72
|
+
<PaginationInfo />
|
|
73
|
+
<PaginationFirstPage />
|
|
74
|
+
<PaginationPreviousPage />
|
|
75
|
+
<PaginationPageNumbers />
|
|
76
|
+
<PaginationNextPage />
|
|
77
|
+
<PaginationLastPage />
|
|
78
|
+
</PaginationBar>
|
|
71
79
|
</template>
|
|
72
80
|
|
|
73
81
|
<script setup lang='ts'>
|
|
74
82
|
import { ref } from 'vue'
|
|
75
|
-
import {
|
|
83
|
+
import {
|
|
84
|
+
PaginationBar,
|
|
85
|
+
PaginationPageSizeOptions,
|
|
86
|
+
PaginationInfo,
|
|
87
|
+
PaginationPanel,
|
|
88
|
+
PaginationPageNumbers,
|
|
89
|
+
PaginationFirstPage,
|
|
90
|
+
PaginationPreviousPage,
|
|
91
|
+
PaginationNextPage,
|
|
92
|
+
PaginationLastPage
|
|
93
|
+
} from 'v-page'
|
|
76
94
|
import type { PageInfo } from 'v-page'
|
|
77
95
|
// set default page to 3
|
|
78
96
|
const pageNumber = ref<number>(3)
|
package/dist/v-page.js
CHANGED
|
@@ -1,217 +1,62 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(".v-pagination{display:flex;justify-content:flex-start;box-sizing:border-box}.v-pagination--right{justify-content:flex-end}.v-pagination--center{justify-content:center}.v-pagination.v-pagination--disabled a,.v-pagination.v-pagination--disabled select{color:#ddd!important}.v-pagination.v-pagination--disabled .v-pagination__item a{cursor:default!important}.v-pagination.v-pagination--disabled .v-pagination__item a:hover{background-color:transparent}.v-pagination.v-pagination--disabled.v-pagination--border ul{background-color:#fafafa}.v-pagination.v-pagination--circle .v-pagination__item a{border-radius:50rem;border:1px solid transparent}.v-pagination.v-pagination--circle .v-pagination__item a:hover{border:1px solid #f7f7f7}.v-pagination.v-pagination--circle .v-pagination__item.disabled a:hover{border:1px solid transparent}.v-pagination.v-pagination--circle .v-pagination__item.active a{border:1px solid #ddd!important;background-color:transparent!important;box-shadow:0 1px 3px #0000001a}.v-pagination ul{margin:0;padding:0;display:flex}.v-pagination ul li{list-style:none;display:flex}.v-pagination ul li a{padding:.3rem .6rem;text-decoration:none;line-height:1.3;font-size:14px;margin:0;outline:0;color:#333;border-radius:.5rem;display:inline-flex;align-items:center;cursor:default
|
|
2
|
-
import { toRefs as
|
|
3
|
-
const [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
] = ["cn", "en", "de", "jp", "pt"],
|
|
10
|
-
[
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(".v-pagination{display:flex;justify-content:flex-start;box-sizing:border-box}.v-pagination--right{justify-content:flex-end}.v-pagination--center{justify-content:center}.v-pagination.v-pagination--disabled a,.v-pagination.v-pagination--disabled select{color:#ddd!important}.v-pagination.v-pagination--disabled .v-pagination__item a{cursor:default!important}.v-pagination.v-pagination--disabled .v-pagination__item a:hover{background-color:transparent}.v-pagination.v-pagination--disabled.v-pagination--border ul{background-color:#fafafa}.v-pagination.v-pagination--circle .v-pagination__item a{border-radius:50rem;border:1px solid transparent;min-height:30px;min-width:30px;padding:0 .6rem;display:flex;align-items:center;justify-content:center}.v-pagination.v-pagination--circle .v-pagination__item a:hover{border:1px solid #f7f7f7}.v-pagination.v-pagination--circle .v-pagination__item.disabled a:hover{border:1px solid transparent}.v-pagination.v-pagination--circle .v-pagination__item.active a{border:1px solid #ddd!important;background-color:transparent!important;box-shadow:0 1px 3px #0000001a}.v-pagination ul{margin:0;padding:0;display:flex}.v-pagination ul li{list-style:none;display:flex}.v-pagination ul li a{padding:.3rem .6rem;text-decoration:none;line-height:1.3;font-size:14px;margin:0;outline:0;color:#333;border-radius:.5rem;display:inline-flex;align-items:center;cursor:default}.v-pagination ul li.v-pagination__list a,.v-pagination ul li.v-pagination__info a{color:#888}.v-pagination ul li.active a,.v-pagination ul li.disabled a{cursor:default!important}.v-pagination ul li.v-pagination__item a:hover{background-color:#f7f7f7;color:#000;cursor:pointer}.v-pagination ul li.active a{background-color:#eee!important;color:#aaa}.v-pagination ul li.active a:hover{color:#aaa}.v-pagination ul li.disabled a{color:#ddd!important}.v-pagination ul li.disabled a:hover{background-color:transparent}.v-pagination ul li select{width:auto!important;font-size:12px;padding:0;outline:0;margin:0 0 0 5px;border:1px solid #ccc;color:#333;border-radius:.3rem}.v-pagination.v-pagination--border ul{box-shadow:0 1px 2px #0000000d;border-radius:.5rem}.v-pagination.v-pagination--border ul li a{border:1px solid #DEE2E6;border-left:0;border-radius:0}.v-pagination.v-pagination--border ul li:first-child>a{border-bottom-left-radius:.5rem;border-top-left-radius:.5rem;border-left:1px solid #DEE2E6}.v-pagination.v-pagination--border ul li:last-child>a{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.v-pagination.v-pagination--border ul li.active a{color:#aaa;background-color:#eee}")),document.head.appendChild(i)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
|
|
2
|
+
import { defineComponent as T, toRefs as w, ref as h, computed as b, watch as F, onMounted as C, provide as G, createVNode as n, inject as d, isVNode as k } from "vue";
|
|
3
|
+
const g = 1, D = 5, L = 10, V = [L, 20, 50, 100], A = 0, [X, Y, x] = ["left", "center", "right"], s = Symbol("pagination"), [
|
|
4
|
+
U,
|
|
5
|
+
S,
|
|
6
|
+
Z,
|
|
7
|
+
H,
|
|
8
|
+
J
|
|
9
|
+
] = ["cn", "en", "de", "jp", "pt"], B = {
|
|
10
|
+
[U]: {
|
|
11
11
|
pageLength: "每页记录数",
|
|
12
12
|
pageInfo: "第 #pageNumber#/#totalPage# 页(共#totalRow#条记录)",
|
|
13
13
|
first: "首页",
|
|
14
14
|
last: "尾页",
|
|
15
15
|
all: "全部"
|
|
16
16
|
},
|
|
17
|
-
[
|
|
17
|
+
[S]: {
|
|
18
18
|
pageLength: "Per page",
|
|
19
19
|
pageInfo: "Page #pageNumber#/#totalPage# (total #totalRow# records)",
|
|
20
20
|
first: "First",
|
|
21
21
|
last: "Last",
|
|
22
22
|
all: "All"
|
|
23
23
|
},
|
|
24
|
-
[
|
|
24
|
+
[Z]: {
|
|
25
25
|
pageLength: "Seitenlänge",
|
|
26
26
|
pageInfo: "Aktuell #pageNumber#/#totalPage# (gesamt #totalRow# Aufzeichnungen)",
|
|
27
27
|
first: "Zuerst",
|
|
28
28
|
last: "Letzte",
|
|
29
29
|
all: "Alle"
|
|
30
30
|
},
|
|
31
|
-
[
|
|
31
|
+
[H]: {
|
|
32
32
|
pageLength: "ページごとの記録数",
|
|
33
33
|
pageInfo: "現在の第 #pageNumber#/#totalPage# ページ(全部で #totalRow# 条の記録)",
|
|
34
34
|
first: "トップページ",
|
|
35
35
|
last: "尾のページ",
|
|
36
36
|
all: "すべて"
|
|
37
37
|
},
|
|
38
|
-
[
|
|
38
|
+
[J]: {
|
|
39
39
|
pageLength: "Resultados por página",
|
|
40
40
|
pageInfo: "#pageNumber#/#totalPage# (total de #totalRow#)",
|
|
41
41
|
first: "Início",
|
|
42
42
|
last: "Fim",
|
|
43
43
|
all: "Todos"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
46
|
-
function
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
return
|
|
45
|
+
};
|
|
46
|
+
function q(e, a, t) {
|
|
47
|
+
if (a <= t) return g;
|
|
48
|
+
const i = Math.floor(t / 2), u = a - t + 1, l = e - i;
|
|
49
|
+
return l < g ? g : l > u ? u : l;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
const
|
|
53
|
-
return Array.from({ length:
|
|
51
|
+
function K(e, a, t) {
|
|
52
|
+
const i = q(e, a, t);
|
|
53
|
+
return Array.from({ length: t }).map((u, l) => i + l).filter((u) => u >= g && u <= a);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
return
|
|
55
|
+
function Q(e = S) {
|
|
56
|
+
const a = String(e).toLowerCase();
|
|
57
|
+
return B[Object.hasOwn(B, a) ? a : S];
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
const {
|
|
61
|
-
pageSizeOptions: f,
|
|
62
|
-
pageSizeMenu: i,
|
|
63
|
-
totalRow: r
|
|
64
|
-
} = Z(e), n = A(0), v = A(W), o = A(e.pageSize ?? E), c = ee(e.language), m = b(() => {
|
|
65
|
-
if (!f.value) return [];
|
|
66
|
-
const t = Array.isArray(i.value) && i.value.length > 0 ? i.value : F, d = new Set(t);
|
|
67
|
-
return d.add(o.value), [...d].sort((p, L) => p - L);
|
|
68
|
-
}), g = b(() => o.value === z ? s : Math.ceil(r.value / o.value)), N = b(() => $(n.value, g.value, v.value)), V = b(() => ({
|
|
69
|
-
"v-pagination": !0,
|
|
70
|
-
"v-pagination--right": e.align === "right",
|
|
71
|
-
"v-pagination--center": e.align === "center",
|
|
72
|
-
"v-pagination--disabled": e.disabled,
|
|
73
|
-
"v-pagination--border": e.border,
|
|
74
|
-
"v-pagination--circle": !e.border && e.circle
|
|
75
|
-
})), I = b(() => n.value === s), _ = b(() => n.value === g.value);
|
|
76
|
-
w(() => e.modelValue, h), w(() => e.pageSize, R);
|
|
77
|
-
function h(t = s) {
|
|
78
|
-
if (e.disabled || typeof t != "number") return;
|
|
79
|
-
let d = t < s ? s : t;
|
|
80
|
-
t > g.value && g.value > 0 && (d = g.value), d !== n.value && (n.value = d, u("update:modelValue", n.value), B());
|
|
81
|
-
}
|
|
82
|
-
function R(t) {
|
|
83
|
-
if (!(t < 0) && t !== o.value) {
|
|
84
|
-
if (o.value = t, u("update:pageSize", o.value), n.value === s)
|
|
85
|
-
return B();
|
|
86
|
-
h(s);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function B() {
|
|
90
|
-
u("change", {
|
|
91
|
-
pageNumber: n.value,
|
|
92
|
-
pageSize: Number(o.value),
|
|
93
|
-
totalPage: g.value
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
function C() {
|
|
97
|
-
if (!f.value) return null;
|
|
98
|
-
const t = () => m.value.map((p) => a("option", {
|
|
99
|
-
value: p,
|
|
100
|
-
selected: o.value === p
|
|
101
|
-
}, [p])), d = () => e.displayAll ? a("option", {
|
|
102
|
-
value: z,
|
|
103
|
-
selected: o.value === z
|
|
104
|
-
}, [c.all]) : null;
|
|
105
|
-
return a("li", {
|
|
106
|
-
class: "v-pagination__list"
|
|
107
|
-
}, [a("a", {
|
|
108
|
-
href: "javascript:void(0)"
|
|
109
|
-
}, [a("span", null, [c.pageLength]), a("select", {
|
|
110
|
-
disabled: e.disabled,
|
|
111
|
-
onChange: (p) => R(Number(p.target.value))
|
|
112
|
-
}, [a(t, null, null), a(d, null, null)])])]);
|
|
113
|
-
}
|
|
114
|
-
function M() {
|
|
115
|
-
if (!e.info) return null;
|
|
116
|
-
const t = c.pageInfo.replace("#pageNumber#", n.value).replace("#totalPage#", g.value).replace("#totalRow#", r.value);
|
|
117
|
-
return a("li", {
|
|
118
|
-
class: "v-pagination__info"
|
|
119
|
-
}, [a("a", {
|
|
120
|
-
href: "javascript:void(0)"
|
|
121
|
-
}, [t])]);
|
|
122
|
-
}
|
|
123
|
-
function T() {
|
|
124
|
-
if (!Object.hasOwn(l, "default")) return null;
|
|
125
|
-
const t = {
|
|
126
|
-
pageNumber: n.value,
|
|
127
|
-
pageSize: o.value,
|
|
128
|
-
totalPage: g.value,
|
|
129
|
-
totalRow: r.value,
|
|
130
|
-
isFirst: I.value,
|
|
131
|
-
isLast: _.value
|
|
132
|
-
};
|
|
133
|
-
return a("li", {
|
|
134
|
-
class: "v-pagination__slot"
|
|
135
|
-
}, [a("a", {
|
|
136
|
-
href: "javascript:void(0)"
|
|
137
|
-
}, [l.default(t)])]);
|
|
138
|
-
}
|
|
139
|
-
function P({
|
|
140
|
-
classes: t,
|
|
141
|
-
pageNumberValue: d,
|
|
142
|
-
name: p,
|
|
143
|
-
hasItem: L = !0
|
|
144
|
-
}) {
|
|
145
|
-
return L ? a("li", {
|
|
146
|
-
class: ["v-pagination__item", ...t]
|
|
147
|
-
}, [a("a", {
|
|
148
|
-
href: "javascript:void(0)",
|
|
149
|
-
onClick: () => h(d)
|
|
150
|
-
}, [p])]) : null;
|
|
151
|
-
}
|
|
152
|
-
function j() {
|
|
153
|
-
return e.pageNumber ? N.value.map((t) => a(P, {
|
|
154
|
-
classes: [{
|
|
155
|
-
active: t === n.value
|
|
156
|
-
}],
|
|
157
|
-
pageNumberValue: t,
|
|
158
|
-
name: t
|
|
159
|
-
}, null)) : null;
|
|
160
|
-
}
|
|
161
|
-
function G() {
|
|
162
|
-
return a(P, {
|
|
163
|
-
classes: ["v-pagination__first", {
|
|
164
|
-
disabled: I.value
|
|
165
|
-
}],
|
|
166
|
-
pageNumberValue: s,
|
|
167
|
-
name: c.first,
|
|
168
|
-
hasItem: e.first
|
|
169
|
-
}, null);
|
|
170
|
-
}
|
|
171
|
-
function D() {
|
|
172
|
-
return a(P, {
|
|
173
|
-
classes: ["v-pagination__previous", {
|
|
174
|
-
disabled: I.value
|
|
175
|
-
}],
|
|
176
|
-
pageNumberValue: n.value - 1,
|
|
177
|
-
name: "«"
|
|
178
|
-
}, null);
|
|
179
|
-
}
|
|
180
|
-
function x() {
|
|
181
|
-
return a(P, {
|
|
182
|
-
classes: ["v-pagination__next", {
|
|
183
|
-
disabled: _.value
|
|
184
|
-
}],
|
|
185
|
-
pageNumberValue: n.value + 1,
|
|
186
|
-
name: "»"
|
|
187
|
-
}, null);
|
|
188
|
-
}
|
|
189
|
-
function U() {
|
|
190
|
-
return a(P, {
|
|
191
|
-
classes: ["v-pagination__last", {
|
|
192
|
-
disabled: _.value
|
|
193
|
-
}],
|
|
194
|
-
pageNumberValue: g.value,
|
|
195
|
-
name: c.last,
|
|
196
|
-
hasItem: e.last
|
|
197
|
-
}, null);
|
|
198
|
-
}
|
|
199
|
-
return k(() => h(e.modelValue || s)), {
|
|
200
|
-
containerClasses: V,
|
|
201
|
-
totalPage: g,
|
|
202
|
-
current: n,
|
|
203
|
-
pageNumbers: N,
|
|
204
|
-
PageSizeOptions: C,
|
|
205
|
-
PageInformation: M,
|
|
206
|
-
PageSlot: T,
|
|
207
|
-
PageNumberItems: j,
|
|
208
|
-
FirstPageItem: G,
|
|
209
|
-
PreviousPageItem: D,
|
|
210
|
-
NextPageItem: x,
|
|
211
|
-
LastPageItem: U
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
const S = /* @__PURE__ */ H({
|
|
59
|
+
const N = /* @__PURE__ */ T({
|
|
215
60
|
name: "PaginationBar",
|
|
216
61
|
props: {
|
|
217
62
|
modelValue: {
|
|
@@ -220,7 +65,7 @@ const S = /* @__PURE__ */ H({
|
|
|
220
65
|
},
|
|
221
66
|
pageSize: {
|
|
222
67
|
type: Number,
|
|
223
|
-
default:
|
|
68
|
+
default: L
|
|
224
69
|
},
|
|
225
70
|
totalRow: {
|
|
226
71
|
type: Number,
|
|
@@ -228,7 +73,7 @@ const S = /* @__PURE__ */ H({
|
|
|
228
73
|
},
|
|
229
74
|
language: {
|
|
230
75
|
type: String,
|
|
231
|
-
default:
|
|
76
|
+
default: S
|
|
232
77
|
},
|
|
233
78
|
/**
|
|
234
79
|
* Pagination alignment direction
|
|
@@ -236,17 +81,12 @@ const S = /* @__PURE__ */ H({
|
|
|
236
81
|
*/
|
|
237
82
|
align: {
|
|
238
83
|
type: String,
|
|
239
|
-
default:
|
|
84
|
+
default: x
|
|
240
85
|
},
|
|
241
86
|
/** Page size list */
|
|
242
87
|
pageSizeMenu: {
|
|
243
88
|
type: [Array],
|
|
244
|
-
default: () =>
|
|
245
|
-
},
|
|
246
|
-
/** Display page size menu panel */
|
|
247
|
-
pageSizeOptions: {
|
|
248
|
-
type: Boolean,
|
|
249
|
-
default: !0
|
|
89
|
+
default: () => V
|
|
250
90
|
},
|
|
251
91
|
disabled: {
|
|
252
92
|
type: Boolean,
|
|
@@ -261,24 +101,6 @@ const S = /* @__PURE__ */ H({
|
|
|
261
101
|
type: Boolean,
|
|
262
102
|
default: !1
|
|
263
103
|
},
|
|
264
|
-
info: {
|
|
265
|
-
type: Boolean,
|
|
266
|
-
default: !0
|
|
267
|
-
},
|
|
268
|
-
pageNumber: {
|
|
269
|
-
type: Boolean,
|
|
270
|
-
default: !0
|
|
271
|
-
},
|
|
272
|
-
/** first page button */
|
|
273
|
-
first: {
|
|
274
|
-
type: Boolean,
|
|
275
|
-
default: !0
|
|
276
|
-
},
|
|
277
|
-
/** last page button */
|
|
278
|
-
last: {
|
|
279
|
-
type: Boolean,
|
|
280
|
-
default: !0
|
|
281
|
-
},
|
|
282
104
|
/**
|
|
283
105
|
* Display all records
|
|
284
106
|
*
|
|
@@ -297,43 +119,241 @@ const S = /* @__PURE__ */ H({
|
|
|
297
119
|
},
|
|
298
120
|
emits: ["update:modelValue", "update:pageSize", "change"],
|
|
299
121
|
setup(e, {
|
|
300
|
-
emit:
|
|
301
|
-
slots:
|
|
122
|
+
emit: a,
|
|
123
|
+
slots: t
|
|
302
124
|
}) {
|
|
303
125
|
const {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
126
|
+
pageSizeMenu: i,
|
|
127
|
+
totalRow: u
|
|
128
|
+
} = w(e), l = h(0), v = h(D), o = h(e.pageSize ?? L), f = b(() => {
|
|
129
|
+
const r = Array.from(Array.isArray(i.value) && i.value.length > 0 ? i.value : V);
|
|
130
|
+
return o.value !== 0 && !r.includes(o.value) && r.push(o.value), r.sort((p, M) => p - M);
|
|
131
|
+
}), c = b(() => o.value === A ? g : Math.ceil(u.value / o.value)), P = b(() => K(l.value, c.value, v.value)), j = b(() => ({
|
|
132
|
+
"v-pagination": !0,
|
|
133
|
+
"v-pagination--right": e.align === "right",
|
|
134
|
+
"v-pagination--center": e.align === "center",
|
|
135
|
+
"v-pagination--disabled": e.disabled,
|
|
136
|
+
"v-pagination--border": e.border,
|
|
137
|
+
"v-pagination--circle": !e.border && e.circle
|
|
138
|
+
})), z = b(() => l.value === g), E = b(() => l.value === c.value);
|
|
139
|
+
F(() => e.modelValue, y), F(() => e.pageSize, R);
|
|
140
|
+
function y(r = g) {
|
|
141
|
+
if (e.disabled || typeof r != "number") return;
|
|
142
|
+
let p = r < g ? g : r;
|
|
143
|
+
r > c.value && c.value > 0 && (p = c.value), p !== l.value && (l.value = p, a("update:modelValue", l.value), I());
|
|
144
|
+
}
|
|
145
|
+
function R(r) {
|
|
146
|
+
if (typeof r == "number" && !(r < 0) && r !== o.value) {
|
|
147
|
+
if (o.value = r, a("update:pageSize", o.value), l.value === g)
|
|
148
|
+
return I();
|
|
149
|
+
y(g);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function I() {
|
|
153
|
+
a("change", {
|
|
154
|
+
pageNumber: l.value,
|
|
155
|
+
pageSize: Number(o.value),
|
|
156
|
+
totalPage: c.value
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return C(() => y(e.modelValue || g)), G(s, {
|
|
160
|
+
lang: Q(e.language),
|
|
161
|
+
pageSize: o,
|
|
162
|
+
sizeList: f,
|
|
163
|
+
pageNumbers: P,
|
|
164
|
+
isFirst: z,
|
|
165
|
+
isLast: E,
|
|
166
|
+
current: l,
|
|
167
|
+
totalPage: c,
|
|
168
|
+
changePageNumber: y,
|
|
169
|
+
changePageSize: R,
|
|
170
|
+
...w(e)
|
|
171
|
+
}), () => {
|
|
172
|
+
var p;
|
|
173
|
+
if (e.hideOnSinglePage && c.value <= 1) return null;
|
|
174
|
+
const r = {
|
|
175
|
+
pageNumber: l.value,
|
|
176
|
+
pageSize: o.value,
|
|
177
|
+
totalPage: c.value,
|
|
178
|
+
totalRow: u.value,
|
|
179
|
+
isFirst: z.value,
|
|
180
|
+
isLast: E.value
|
|
181
|
+
};
|
|
182
|
+
return n("div", {
|
|
183
|
+
class: j.value
|
|
184
|
+
}, [n("ul", null, [(p = t == null ? void 0 : t.default) == null ? void 0 : p.call(t, r)])]);
|
|
185
|
+
};
|
|
318
186
|
}
|
|
319
187
|
});
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
188
|
+
function O(e) {
|
|
189
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !k(e);
|
|
190
|
+
}
|
|
191
|
+
function _(e, {
|
|
192
|
+
slots: a
|
|
193
|
+
}) {
|
|
194
|
+
var t;
|
|
195
|
+
return n("a", {
|
|
196
|
+
href: "javascript:void(0)"
|
|
197
|
+
}, [(t = a == null ? void 0 : a.default) == null ? void 0 : t.call(a)]);
|
|
198
|
+
}
|
|
199
|
+
function m({
|
|
200
|
+
classes: e,
|
|
201
|
+
pageNumberValue: a,
|
|
202
|
+
name: t
|
|
203
|
+
}) {
|
|
204
|
+
const {
|
|
205
|
+
changePageNumber: i
|
|
206
|
+
} = d(s);
|
|
207
|
+
return n("li", {
|
|
208
|
+
class: ["v-pagination__item", ...e]
|
|
209
|
+
}, [n(_, {
|
|
210
|
+
onClick: () => i(a)
|
|
211
|
+
}, O(t) ? t : {
|
|
212
|
+
default: () => [t]
|
|
213
|
+
})]);
|
|
214
|
+
}
|
|
215
|
+
function $() {
|
|
216
|
+
const {
|
|
217
|
+
lang: e,
|
|
218
|
+
sizeList: a,
|
|
219
|
+
pageSize: t,
|
|
220
|
+
disabled: i,
|
|
221
|
+
displayAll: u,
|
|
222
|
+
changePageSize: l
|
|
223
|
+
} = d(s), v = () => a.value.map((f) => n("option", {
|
|
224
|
+
key: f,
|
|
225
|
+
value: f,
|
|
226
|
+
selected: t.value === f
|
|
227
|
+
}, [f])), o = () => u.value ? n("option", {
|
|
228
|
+
value: A,
|
|
229
|
+
selected: t.value === A
|
|
230
|
+
}, [e.all]) : null;
|
|
231
|
+
return n("li", {
|
|
232
|
+
class: "v-pagination__list"
|
|
233
|
+
}, [n(_, null, {
|
|
234
|
+
default: () => [n("span", null, [e.pageLength]), n("select", {
|
|
235
|
+
disabled: i.value,
|
|
236
|
+
onChange: (f) => l(Number(f.target.value))
|
|
237
|
+
}, [n(v, null, null), n(o, null, null)])]
|
|
238
|
+
})]);
|
|
239
|
+
}
|
|
240
|
+
function ee() {
|
|
241
|
+
const {
|
|
242
|
+
lang: e,
|
|
243
|
+
current: a,
|
|
244
|
+
totalPage: t,
|
|
245
|
+
totalRow: i
|
|
246
|
+
} = d(s), u = e.pageInfo.replace("#pageNumber#", a.value).replace("#totalPage#", t.value).replace("#totalRow#", i.value);
|
|
247
|
+
return n("li", {
|
|
248
|
+
class: "v-pagination__info"
|
|
249
|
+
}, [n(_, null, O(u) ? u : {
|
|
250
|
+
default: () => [u]
|
|
251
|
+
})]);
|
|
252
|
+
}
|
|
253
|
+
function ae(e, {
|
|
254
|
+
slots: a
|
|
255
|
+
}) {
|
|
256
|
+
return n("li", {
|
|
257
|
+
class: "v-pagination__slot"
|
|
258
|
+
}, [n(_, null, {
|
|
259
|
+
default: () => {
|
|
260
|
+
var t;
|
|
261
|
+
return [(t = a == null ? void 0 : a.default) == null ? void 0 : t.call(a)];
|
|
262
|
+
}
|
|
263
|
+
})]);
|
|
264
|
+
}
|
|
265
|
+
function te() {
|
|
266
|
+
const {
|
|
267
|
+
pageNumbers: e,
|
|
268
|
+
current: a
|
|
269
|
+
} = d(s);
|
|
270
|
+
return e.value.map((t) => n(m, {
|
|
271
|
+
key: t,
|
|
272
|
+
classes: [{
|
|
273
|
+
active: t === a.value
|
|
274
|
+
}],
|
|
275
|
+
pageNumberValue: t,
|
|
276
|
+
name: t
|
|
277
|
+
}, null));
|
|
278
|
+
}
|
|
279
|
+
function ne() {
|
|
280
|
+
const {
|
|
281
|
+
isFirst: e,
|
|
282
|
+
lang: a
|
|
283
|
+
} = d(s);
|
|
284
|
+
return n(m, {
|
|
285
|
+
classes: ["v-pagination__first", {
|
|
286
|
+
disabled: e.value
|
|
287
|
+
}],
|
|
288
|
+
pageNumberValue: g,
|
|
289
|
+
name: a.first
|
|
290
|
+
}, null);
|
|
291
|
+
}
|
|
292
|
+
function le() {
|
|
293
|
+
const {
|
|
294
|
+
isFirst: e,
|
|
295
|
+
current: a
|
|
296
|
+
} = d(s);
|
|
297
|
+
return n(m, {
|
|
298
|
+
classes: ["v-pagination__previous", {
|
|
299
|
+
disabled: e.value
|
|
300
|
+
}],
|
|
301
|
+
pageNumberValue: a.value - 1,
|
|
302
|
+
name: "«"
|
|
303
|
+
}, null);
|
|
304
|
+
}
|
|
305
|
+
function ue() {
|
|
306
|
+
const {
|
|
307
|
+
isLast: e,
|
|
308
|
+
current: a
|
|
309
|
+
} = d(s);
|
|
310
|
+
return n(m, {
|
|
311
|
+
classes: ["v-pagination__next", {
|
|
312
|
+
disabled: e.value
|
|
313
|
+
}],
|
|
314
|
+
pageNumberValue: a.value + 1,
|
|
315
|
+
name: "»"
|
|
316
|
+
}, null);
|
|
317
|
+
}
|
|
318
|
+
function ie() {
|
|
319
|
+
const {
|
|
320
|
+
isLast: e,
|
|
321
|
+
totalPage: a,
|
|
322
|
+
lang: t
|
|
323
|
+
} = d(s);
|
|
324
|
+
return n(m, {
|
|
325
|
+
classes: ["v-pagination__last", {
|
|
326
|
+
disabled: e.value
|
|
327
|
+
}],
|
|
328
|
+
pageNumberValue: a.value,
|
|
329
|
+
name: t.last
|
|
330
|
+
}, null);
|
|
331
|
+
}
|
|
332
|
+
N.install = (e, a = {}) => {
|
|
333
|
+
if (Object.keys(a).length) {
|
|
334
|
+
const { props: t } = N, {
|
|
335
|
+
language: i,
|
|
336
|
+
align: u,
|
|
337
|
+
info: l,
|
|
338
|
+
border: v,
|
|
339
|
+
pageNumber: o,
|
|
340
|
+
first: f,
|
|
329
341
|
last: c,
|
|
330
|
-
pageSizeMenu:
|
|
331
|
-
} =
|
|
332
|
-
|
|
342
|
+
pageSizeMenu: P
|
|
343
|
+
} = a;
|
|
344
|
+
i && (t.language.default = i), u && (t.align.default = u), typeof l == "boolean" && (t.info.default = l), typeof v == "boolean" && (t.border.default = v), typeof o == "boolean" && (t.pageNumber.default = o), typeof f == "boolean" && (t.first.default = f), typeof c == "boolean" && (t.last.default = c), typeof P < "u" && (t.pageSizeMenu.default = P);
|
|
333
345
|
}
|
|
334
|
-
e.component(
|
|
346
|
+
e.component(N.name, N);
|
|
335
347
|
};
|
|
336
348
|
export {
|
|
337
|
-
|
|
338
|
-
|
|
349
|
+
N as PaginationBar,
|
|
350
|
+
ne as PaginationFirstPage,
|
|
351
|
+
ee as PaginationInfo,
|
|
352
|
+
ie as PaginationLastPage,
|
|
353
|
+
ue as PaginationNextPage,
|
|
354
|
+
te as PaginationPageNumbers,
|
|
355
|
+
$ as PaginationPageSizeOptions,
|
|
356
|
+
ae as PaginationPanel,
|
|
357
|
+
le as PaginationPreviousPage,
|
|
358
|
+
N as default
|
|
339
359
|
};
|
package/dist/v-page.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(".v-pagination{display:flex;justify-content:flex-start;box-sizing:border-box}.v-pagination--right{justify-content:flex-end}.v-pagination--center{justify-content:center}.v-pagination.v-pagination--disabled a,.v-pagination.v-pagination--disabled select{color:#ddd!important}.v-pagination.v-pagination--disabled .v-pagination__item a{cursor:default!important}.v-pagination.v-pagination--disabled .v-pagination__item a:hover{background-color:transparent}.v-pagination.v-pagination--disabled.v-pagination--border ul{background-color:#fafafa}.v-pagination.v-pagination--circle .v-pagination__item a{border-radius:50rem;border:1px solid transparent}.v-pagination.v-pagination--circle .v-pagination__item a:hover{border:1px solid #f7f7f7}.v-pagination.v-pagination--circle .v-pagination__item.disabled a:hover{border:1px solid transparent}.v-pagination.v-pagination--circle .v-pagination__item.active a{border:1px solid #ddd!important;background-color:transparent!important;box-shadow:0 1px 3px #0000001a}.v-pagination ul{margin:0;padding:0;display:flex}.v-pagination ul li{list-style:none;display:flex}.v-pagination ul li a{padding:.3rem .6rem;text-decoration:none;line-height:1.3;font-size:14px;margin:0;outline:0;color:#333;border-radius:.5rem;display:inline-flex;align-items:center;cursor:default
|
|
2
|
-
(function(
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(".v-pagination{display:flex;justify-content:flex-start;box-sizing:border-box}.v-pagination--right{justify-content:flex-end}.v-pagination--center{justify-content:center}.v-pagination.v-pagination--disabled a,.v-pagination.v-pagination--disabled select{color:#ddd!important}.v-pagination.v-pagination--disabled .v-pagination__item a{cursor:default!important}.v-pagination.v-pagination--disabled .v-pagination__item a:hover{background-color:transparent}.v-pagination.v-pagination--disabled.v-pagination--border ul{background-color:#fafafa}.v-pagination.v-pagination--circle .v-pagination__item a{border-radius:50rem;border:1px solid transparent;min-height:30px;min-width:30px;padding:0 .6rem;display:flex;align-items:center;justify-content:center}.v-pagination.v-pagination--circle .v-pagination__item a:hover{border:1px solid #f7f7f7}.v-pagination.v-pagination--circle .v-pagination__item.disabled a:hover{border:1px solid transparent}.v-pagination.v-pagination--circle .v-pagination__item.active a{border:1px solid #ddd!important;background-color:transparent!important;box-shadow:0 1px 3px #0000001a}.v-pagination ul{margin:0;padding:0;display:flex}.v-pagination ul li{list-style:none;display:flex}.v-pagination ul li a{padding:.3rem .6rem;text-decoration:none;line-height:1.3;font-size:14px;margin:0;outline:0;color:#333;border-radius:.5rem;display:inline-flex;align-items:center;cursor:default}.v-pagination ul li.v-pagination__list a,.v-pagination ul li.v-pagination__info a{color:#888}.v-pagination ul li.active a,.v-pagination ul li.disabled a{cursor:default!important}.v-pagination ul li.v-pagination__item a:hover{background-color:#f7f7f7;color:#000;cursor:pointer}.v-pagination ul li.active a{background-color:#eee!important;color:#aaa}.v-pagination ul li.active a:hover{color:#aaa}.v-pagination ul li.disabled a{color:#ddd!important}.v-pagination ul li.disabled a:hover{background-color:transparent}.v-pagination ul li select{width:auto!important;font-size:12px;padding:0;outline:0;margin:0 0 0 5px;border:1px solid #ccc;color:#333;border-radius:.3rem}.v-pagination.v-pagination--border ul{box-shadow:0 1px 2px #0000000d;border-radius:.5rem}.v-pagination.v-pagination--border ul li a{border:1px solid #DEE2E6;border-left:0;border-radius:0}.v-pagination.v-pagination--border ul li:first-child>a{border-bottom-left-radius:.5rem;border-top-left-radius:.5rem;border-left:1px solid #DEE2E6}.v-pagination.v-pagination--border ul li:last-child>a{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.v-pagination.v-pagination--border ul li.active a{color:#aaa;background-color:#eee}")),document.head.appendChild(i)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
|
|
2
|
+
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.VPage={},o.Vue))})(this,function(o,e){"use strict";const I=[10,20,50,100],y=0,[X,Y,F]=["left","center","right"],d=Symbol("pagination"),[T,m,v,z,j]=["cn","en","de","jp","pt"],V={[T]:{pageLength:"每页记录数",pageInfo:"第 #pageNumber#/#totalPage# 页(共#totalRow#条记录)",first:"首页",last:"尾页",all:"全部"},[m]:{pageLength:"Per page",pageInfo:"Page #pageNumber#/#totalPage# (total #totalRow# records)",first:"First",last:"Last",all:"All"},[v]:{pageLength:"Seitenlänge",pageInfo:"Aktuell #pageNumber#/#totalPage# (gesamt #totalRow# Aufzeichnungen)",first:"Zuerst",last:"Letzte",all:"Alle"},[z]:{pageLength:"ページごとの記録数",pageInfo:"現在の第 #pageNumber#/#totalPage# ページ(全部で #totalRow# 条の記録)",first:"トップページ",last:"尾のページ",all:"すべて"},[j]:{pageLength:"Resultados por página",pageInfo:"#pageNumber#/#totalPage# (total de #totalRow#)",first:"Início",last:"Fim",all:"Todos"}};function w(a,t,n){if(t<=n)return 1;const u=Math.floor(n/2),l=t-n+1,i=a-u;return i<1?1:i>l?l:i}function B(a,t,n){const u=w(a,t,n);return Array.from({length:n}).map((l,i)=>u+i).filter(l=>l>=1&&l<=t)}function O(a=m){const t=String(a).toLowerCase();return V[Object.hasOwn(V,t)?t:m]}const p=e.defineComponent({name:"PaginationBar",props:{modelValue:{type:Number,default:0},pageSize:{type:Number,default:10},totalRow:{type:Number,default:0},language:{type:String,default:m},align:{type:String,default:F},pageSizeMenu:{type:[Array],default:()=>I},disabled:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},border:{type:Boolean,default:!1},displayAll:{type:Boolean,default:!1},hideOnSinglePage:{type:Boolean,default:!1}},emits:["update:modelValue","update:pageSize","change"],setup(a,{emit:t,slots:n}){const{pageSizeMenu:u,totalRow:l}=e.toRefs(a),i=e.ref(0),P=e.ref(5),r=e.ref(a.pageSize??10),f=e.computed(()=>{const g=Array.from(Array.isArray(u.value)&&u.value.length>0?u.value:I);return r.value!==0&&!g.includes(r.value)&&g.push(r.value),g.sort((s,J)=>s-J)}),c=e.computed(()=>r.value===y?1:Math.ceil(l.value/r.value)),S=e.computed(()=>B(i.value,c.value,P.value)),H=e.computed(()=>({"v-pagination":!0,"v-pagination--right":a.align==="right","v-pagination--center":a.align==="center","v-pagination--disabled":a.disabled,"v-pagination--border":a.border,"v-pagination--circle":!a.border&&a.circle})),R=e.computed(()=>i.value===1),A=e.computed(()=>i.value===c.value);e.watch(()=>a.modelValue,_),e.watch(()=>a.pageSize,E);function _(g=1){if(a.disabled||typeof g!="number")return;let s=g<1?1:g;g>c.value&&c.value>0&&(s=c.value),s!==i.value&&(i.value=s,t("update:modelValue",i.value),L())}function E(g){if(typeof g=="number"&&!(g<0)&&g!==r.value){if(r.value=g,t("update:pageSize",r.value),i.value===1)return L();_(1)}}function L(){t("change",{pageNumber:i.value,pageSize:Number(r.value),totalPage:c.value})}return e.onMounted(()=>_(a.modelValue||1)),e.provide(d,{lang:O(a.language),pageSize:r,sizeList:f,pageNumbers:S,isFirst:R,isLast:A,current:i,totalPage:c,changePageNumber:_,changePageSize:E,...e.toRefs(a)}),()=>{var s;if(a.hideOnSinglePage&&c.value<=1)return null;const g={pageNumber:i.value,pageSize:r.value,totalPage:c.value,totalRow:l.value,isFirst:R.value,isLast:A.value};return e.createVNode("div",{class:H.value},[e.createVNode("ul",null,[(s=n==null?void 0:n.default)==null?void 0:s.call(n,g)])])}}});function h(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!e.isVNode(a)}function b(a,{slots:t}){var n;return e.createVNode("a",{href:"javascript:void(0)"},[(n=t==null?void 0:t.default)==null?void 0:n.call(t)])}function N({classes:a,pageNumberValue:t,name:n}){const{changePageNumber:u}=e.inject(d);return e.createVNode("li",{class:["v-pagination__item",...a]},[e.createVNode(b,{onClick:()=>u(t)},h(n)?n:{default:()=>[n]})])}function G(){const{lang:a,sizeList:t,pageSize:n,disabled:u,displayAll:l,changePageSize:i}=e.inject(d),P=()=>t.value.map(f=>e.createVNode("option",{key:f,value:f,selected:n.value===f},[f])),r=()=>l.value?e.createVNode("option",{value:y,selected:n.value===y},[a.all]):null;return e.createVNode("li",{class:"v-pagination__list"},[e.createVNode(b,null,{default:()=>[e.createVNode("span",null,[a.pageLength]),e.createVNode("select",{disabled:u.value,onChange:f=>i(Number(f.target.value))},[e.createVNode(P,null,null),e.createVNode(r,null,null)])]})])}function M(){const{lang:a,current:t,totalPage:n,totalRow:u}=e.inject(d),l=a.pageInfo.replace("#pageNumber#",t.value).replace("#totalPage#",n.value).replace("#totalRow#",u.value);return e.createVNode("li",{class:"v-pagination__info"},[e.createVNode(b,null,h(l)?l:{default:()=>[l]})])}function D(a,{slots:t}){return e.createVNode("li",{class:"v-pagination__slot"},[e.createVNode(b,null,{default:()=>{var n;return[(n=t==null?void 0:t.default)==null?void 0:n.call(t)]}})])}function U(){const{pageNumbers:a,current:t}=e.inject(d);return a.value.map(n=>e.createVNode(N,{key:n,classes:[{active:n===t.value}],pageNumberValue:n,name:n},null))}function Z(){const{isFirst:a,lang:t}=e.inject(d);return e.createVNode(N,{classes:["v-pagination__first",{disabled:a.value}],pageNumberValue:1,name:t.first},null)}function C(){const{isFirst:a,current:t}=e.inject(d);return e.createVNode(N,{classes:["v-pagination__previous",{disabled:a.value}],pageNumberValue:t.value-1,name:"«"},null)}function k(){const{isLast:a,current:t}=e.inject(d);return e.createVNode(N,{classes:["v-pagination__next",{disabled:a.value}],pageNumberValue:t.value+1,name:"»"},null)}function q(){const{isLast:a,totalPage:t,lang:n}=e.inject(d);return e.createVNode(N,{classes:["v-pagination__last",{disabled:a.value}],pageNumberValue:t.value,name:n.last},null)}p.install=(a,t={})=>{if(Object.keys(t).length){const{props:n}=p,{language:u,align:l,info:i,border:P,pageNumber:r,first:f,last:c,pageSizeMenu:S}=t;u&&(n.language.default=u),l&&(n.align.default=l),typeof i=="boolean"&&(n.info.default=i),typeof P=="boolean"&&(n.border.default=P),typeof r=="boolean"&&(n.pageNumber.default=r),typeof f=="boolean"&&(n.first.default=f),typeof c=="boolean"&&(n.last.default=c),typeof S<"u"&&(n.pageSizeMenu.default=S)}a.component(p.name,p)},o.PaginationBar=p,o.PaginationFirstPage=Z,o.PaginationInfo=M,o.PaginationLastPage=q,o.PaginationNextPage=k,o.PaginationPageNumbers=U,o.PaginationPageSizeOptions=G,o.PaginationPanel=D,o.PaginationPreviousPage=C,o.default=p,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "v-page",
|
|
3
3
|
"description": "A simple pagination bar",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"author": "TerryZ <terry5@foxmail.com>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "https://github.com/TerryZ/v-page.git"
|
|
39
|
+
"url": "git+https://github.com/TerryZ/v-page.git"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
42
|
"front-end",
|
|
@@ -50,23 +50,25 @@
|
|
|
50
50
|
"vue": "^3.4.0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"vue": "^3.5.
|
|
53
|
+
"vue": "^3.5.13"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@rushstack/eslint-patch": "^1.10.4",
|
|
57
|
-
"@vitejs/plugin-vue": "^5.1
|
|
58
|
-
"@vitejs/plugin-vue-jsx": "^4.
|
|
59
|
-
"@vitest/coverage-v8": "^2.1.
|
|
57
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
58
|
+
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
|
59
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
60
60
|
"@vue/eslint-config-standard": "^8.0.1",
|
|
61
61
|
"@vue/test-utils": "^2.4.6",
|
|
62
62
|
"bootstrap": "^5.3.3",
|
|
63
|
-
"eslint": "^8.
|
|
64
|
-
"eslint-plugin-vue": "^9.
|
|
63
|
+
"eslint": "^8.50.0",
|
|
64
|
+
"eslint-plugin-vue": "^9.32.0",
|
|
65
|
+
"postcss": "^8.4.49",
|
|
66
|
+
"autoprefixer": "^10.4.20",
|
|
65
67
|
"jsdom": "^25.0.1",
|
|
66
|
-
"sass": "^1.
|
|
67
|
-
"typescript": "^5.
|
|
68
|
-
"vite": "^
|
|
68
|
+
"sass": "^1.83.0",
|
|
69
|
+
"typescript": "^5.7.2",
|
|
70
|
+
"vite": "^6.0.5",
|
|
69
71
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
70
|
-
"vitest": "^2.1.
|
|
72
|
+
"vitest": "^2.1.8"
|
|
71
73
|
}
|
|
72
74
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare interface PageSlotData {
|
|
|
23
23
|
/**
|
|
24
24
|
* Pagination plugin for Vue
|
|
25
25
|
*/
|
|
26
|
-
declare interface
|
|
26
|
+
declare interface PaginationProps {
|
|
27
27
|
/**
|
|
28
28
|
* The number of current page
|
|
29
29
|
*/
|
|
@@ -47,11 +47,6 @@ declare interface Props {
|
|
|
47
47
|
* @default [10, 20, 50, 100]
|
|
48
48
|
*/
|
|
49
49
|
pageSizeMenu?: number[]
|
|
50
|
-
/**
|
|
51
|
-
* Whether to display page size list panel
|
|
52
|
-
* @default true
|
|
53
|
-
*/
|
|
54
|
-
pageSizeOptions?: boolean
|
|
55
50
|
/**
|
|
56
51
|
* Alignment direction
|
|
57
52
|
* @default `right`
|
|
@@ -72,26 +67,6 @@ declare interface Props {
|
|
|
72
67
|
* @default false
|
|
73
68
|
*/
|
|
74
69
|
circle?: boolean
|
|
75
|
-
/**
|
|
76
|
-
* Whether to display page information panel
|
|
77
|
-
* @default true
|
|
78
|
-
*/
|
|
79
|
-
info?: boolean
|
|
80
|
-
/**
|
|
81
|
-
* Whether to display page number buttons
|
|
82
|
-
* @default true
|
|
83
|
-
*/
|
|
84
|
-
pageNumber?: boolean
|
|
85
|
-
/**
|
|
86
|
-
* Whether to display first page button
|
|
87
|
-
* @default true
|
|
88
|
-
*/
|
|
89
|
-
first?: boolean
|
|
90
|
-
/**
|
|
91
|
-
* Whether to display last page button
|
|
92
|
-
* @default true
|
|
93
|
-
*/
|
|
94
|
-
last?: boolean
|
|
95
70
|
/**
|
|
96
71
|
* Whether add `All` item in page length list
|
|
97
72
|
* @default false
|
|
@@ -111,17 +86,50 @@ type EmitUpdatePageSize = (event: "update:pageSize", value: number) => void
|
|
|
111
86
|
/** The event respond pageNumber or pageSize change */
|
|
112
87
|
type EmitChange = (event: "change", value: PageInfo) => void
|
|
113
88
|
|
|
89
|
+
type ComponentProps = AllowedComponentProps & ComponentCustomProps & VNodeProps
|
|
90
|
+
|
|
114
91
|
declare interface PaginationBar {
|
|
115
92
|
new (): {
|
|
116
|
-
$props:
|
|
93
|
+
$props: ComponentProps & PaginationProps
|
|
117
94
|
$emit: EmitUpdateModelValue & EmitUpdatePageSize & EmitChange
|
|
118
95
|
$slots: {
|
|
119
96
|
default?: (defaultSlotData: PageSlotData) => VNode[]
|
|
120
97
|
}
|
|
121
98
|
}
|
|
122
99
|
}
|
|
100
|
+
declare interface PaginationComponent {
|
|
101
|
+
new (): {
|
|
102
|
+
$props: ComponentProps
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
declare interface PaginationPanel {
|
|
106
|
+
new (): {
|
|
107
|
+
$props: ComponentProps
|
|
108
|
+
$slots: {
|
|
109
|
+
default?: () => VNode[]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
123
113
|
declare const PaginationBar: PaginationBar
|
|
114
|
+
declare const PaginationPageSizeOptions: PaginationComponent
|
|
115
|
+
declare const PaginationInfo: PaginationComponent
|
|
116
|
+
declare const PaginationPageNumbers: PaginationComponent
|
|
117
|
+
declare const PaginationFirstPage: PaginationComponent
|
|
118
|
+
declare const PaginationPreviousPage: PaginationComponent
|
|
119
|
+
declare const PaginationNextPage: PaginationComponent
|
|
120
|
+
declare const PaginationLastPage: PaginationComponent
|
|
121
|
+
declare const PaginationPanel: PaginationPanel
|
|
124
122
|
|
|
125
|
-
export {
|
|
123
|
+
export {
|
|
124
|
+
PaginationBar,
|
|
125
|
+
PaginationPageSizeOptions,
|
|
126
|
+
PaginationInfo,
|
|
127
|
+
PaginationPageNumbers,
|
|
128
|
+
PaginationFirstPage,
|
|
129
|
+
PaginationPreviousPage,
|
|
130
|
+
PaginationNextPage,
|
|
131
|
+
PaginationLastPage,
|
|
132
|
+
PaginationPanel
|
|
133
|
+
}
|
|
126
134
|
|
|
127
135
|
export default PaginationBar
|