v-page 3.2.0 → 3.2.1
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/v-page.js +153 -138
- package/dist/v-page.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/v-page.js
CHANGED
|
@@ -1,175 +1,190 @@
|
|
|
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
|
|
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 { toRefs as H, ref as A, computed as b, watch as w, onMounted as J, createVNode as t, isVNode as q, defineComponent as K } from "vue";
|
|
3
3
|
const [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
] = ["cn", "en", "de", "jp", "pt"],
|
|
10
|
-
[
|
|
4
|
+
Q,
|
|
5
|
+
h,
|
|
6
|
+
W,
|
|
7
|
+
X,
|
|
8
|
+
Y
|
|
9
|
+
] = ["cn", "en", "de", "jp", "pt"], V = {
|
|
10
|
+
[Q]: {
|
|
11
11
|
pageLength: "每页记录数",
|
|
12
12
|
pageInfo: "第 #pageNumber#/#totalPage# 页(共#totalRow#条记录)",
|
|
13
13
|
first: "首页",
|
|
14
14
|
last: "尾页",
|
|
15
15
|
all: "全部"
|
|
16
16
|
},
|
|
17
|
-
[
|
|
17
|
+
[h]: {
|
|
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
|
+
[W]: {
|
|
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
|
+
[X]: {
|
|
32
32
|
pageLength: "ページごとの記録数",
|
|
33
33
|
pageInfo: "現在の第 #pageNumber#/#totalPage# ページ(全部で #totalRow# 条の記録)",
|
|
34
34
|
first: "トップページ",
|
|
35
35
|
last: "尾のページ",
|
|
36
36
|
all: "すべて"
|
|
37
37
|
},
|
|
38
|
-
[
|
|
38
|
+
[Y]: {
|
|
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 (u <= l) return
|
|
48
|
-
const
|
|
49
|
-
return
|
|
45
|
+
}, f = 1, $ = 5, R = 10, F = [R, 20, 50, 100], z = 0, [ie, oe, ee] = ["left", "center", "right"];
|
|
46
|
+
function ae(e, u, l) {
|
|
47
|
+
if (u <= l) return f;
|
|
48
|
+
const d = Math.floor(l / 2), r = u - l + 1, s = e - d;
|
|
49
|
+
return s < f ? f : s > r ? r : s;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
const
|
|
53
|
-
return Array.from({ length: l }).map((
|
|
51
|
+
function te(e, u, l) {
|
|
52
|
+
const d = ae(e, u, l);
|
|
53
|
+
return Array.from({ length: l }).map((r, s) => d + s).filter((r) => r >= f && r <= u);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function le(e = h) {
|
|
56
56
|
const u = String(e).toLowerCase();
|
|
57
|
-
return
|
|
57
|
+
return V[Object.hasOwn(V, u) ? u : h];
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function E(e) {
|
|
60
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !q(e);
|
|
61
|
+
}
|
|
62
|
+
function ne(e, u, l) {
|
|
60
63
|
const {
|
|
61
|
-
pageSizeOptions:
|
|
62
|
-
pageSizeMenu:
|
|
63
|
-
totalRow:
|
|
64
|
-
} =
|
|
65
|
-
if (!
|
|
66
|
-
const
|
|
67
|
-
return
|
|
68
|
-
}),
|
|
64
|
+
pageSizeOptions: d,
|
|
65
|
+
pageSizeMenu: r,
|
|
66
|
+
totalRow: s
|
|
67
|
+
} = H(e), n = A(0), v = A($), i = A(e.pageSize ?? R), p = le(e.language), m = b(() => {
|
|
68
|
+
if (!d.value) return [];
|
|
69
|
+
const a = Array.from(Array.isArray(r.value) && r.value.length > 0 ? r.value : F);
|
|
70
|
+
return i.value !== 0 && !a.includes(i.value) && a.push(i.value), a.sort((o, g) => o - g);
|
|
71
|
+
}), c = b(() => i.value === z ? f : Math.ceil(s.value / i.value)), y = b(() => te(n.value, c.value, v.value)), C = b(() => ({
|
|
69
72
|
"v-pagination": !0,
|
|
70
73
|
"v-pagination--right": e.align === "right",
|
|
71
74
|
"v-pagination--center": e.align === "center",
|
|
72
75
|
"v-pagination--disabled": e.disabled,
|
|
73
76
|
"v-pagination--border": e.border,
|
|
74
77
|
"v-pagination--circle": !e.border && e.circle
|
|
75
|
-
})), I = b(() => n.value ===
|
|
76
|
-
w(() => e.modelValue,
|
|
77
|
-
function
|
|
78
|
-
if (e.disabled || typeof
|
|
79
|
-
let
|
|
80
|
-
|
|
78
|
+
})), I = b(() => n.value === f), L = b(() => n.value === c.value);
|
|
79
|
+
w(() => e.modelValue, N), w(() => e.pageSize, B);
|
|
80
|
+
function N(a = f) {
|
|
81
|
+
if (e.disabled || typeof a != "number") return;
|
|
82
|
+
let o = a < f ? f : a;
|
|
83
|
+
a > c.value && c.value > 0 && (o = c.value), o !== n.value && (n.value = o, u("update:modelValue", n.value), O());
|
|
81
84
|
}
|
|
82
|
-
function
|
|
83
|
-
if (!(
|
|
84
|
-
if (
|
|
85
|
-
return
|
|
86
|
-
|
|
85
|
+
function B(a) {
|
|
86
|
+
if (typeof a == "number" && !(a < 0) && a !== i.value) {
|
|
87
|
+
if (i.value = a, u("update:pageSize", i.value), n.value === f)
|
|
88
|
+
return O();
|
|
89
|
+
N(f);
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
|
-
function
|
|
92
|
+
function O() {
|
|
90
93
|
u("change", {
|
|
91
94
|
pageNumber: n.value,
|
|
92
|
-
pageSize: Number(
|
|
93
|
-
totalPage:
|
|
95
|
+
pageSize: Number(i.value),
|
|
96
|
+
totalPage: c.value
|
|
94
97
|
});
|
|
95
98
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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", {
|
|
99
|
+
function S(a, {
|
|
100
|
+
slots: o
|
|
101
|
+
}) {
|
|
102
|
+
var g;
|
|
103
|
+
return t("a", {
|
|
108
104
|
href: "javascript:void(0)"
|
|
109
|
-
}, [
|
|
110
|
-
disabled: e.disabled,
|
|
111
|
-
onChange: (p) => R(Number(p.target.value))
|
|
112
|
-
}, [a(t, null, null), a(d, null, null)])])]);
|
|
105
|
+
}, [(g = o == null ? void 0 : o.default) == null ? void 0 : g.call(o)]);
|
|
113
106
|
}
|
|
114
107
|
function M() {
|
|
108
|
+
if (!d.value) return null;
|
|
109
|
+
const a = () => m.value.map((g) => t("option", {
|
|
110
|
+
key: g,
|
|
111
|
+
value: g,
|
|
112
|
+
selected: i.value === g
|
|
113
|
+
}, [g])), o = () => e.displayAll ? t("option", {
|
|
114
|
+
value: z,
|
|
115
|
+
selected: i.value === z
|
|
116
|
+
}, [p.all]) : null;
|
|
117
|
+
return t("li", {
|
|
118
|
+
class: "v-pagination__list"
|
|
119
|
+
}, [t(S, null, {
|
|
120
|
+
default: () => [t("span", null, [p.pageLength]), t("select", {
|
|
121
|
+
disabled: e.disabled,
|
|
122
|
+
onChange: (g) => B(Number(g.target.value))
|
|
123
|
+
}, [t(a, null, null), t(o, null, null)])]
|
|
124
|
+
})]);
|
|
125
|
+
}
|
|
126
|
+
function T() {
|
|
115
127
|
if (!e.info) return null;
|
|
116
|
-
const
|
|
117
|
-
return
|
|
128
|
+
const a = p.pageInfo.replace("#pageNumber#", n.value).replace("#totalPage#", c.value).replace("#totalRow#", s.value);
|
|
129
|
+
return t("li", {
|
|
118
130
|
class: "v-pagination__info"
|
|
119
|
-
}, [
|
|
120
|
-
|
|
121
|
-
}
|
|
131
|
+
}, [t(S, null, E(a) ? a : {
|
|
132
|
+
default: () => [a]
|
|
133
|
+
})]);
|
|
122
134
|
}
|
|
123
|
-
function
|
|
135
|
+
function j() {
|
|
136
|
+
let a;
|
|
124
137
|
if (!Object.hasOwn(l, "default")) return null;
|
|
125
|
-
const
|
|
138
|
+
const o = {
|
|
126
139
|
pageNumber: n.value,
|
|
127
|
-
pageSize:
|
|
128
|
-
totalPage:
|
|
129
|
-
totalRow:
|
|
140
|
+
pageSize: i.value,
|
|
141
|
+
totalPage: c.value,
|
|
142
|
+
totalRow: s.value,
|
|
130
143
|
isFirst: I.value,
|
|
131
|
-
isLast:
|
|
144
|
+
isLast: L.value
|
|
132
145
|
};
|
|
133
|
-
return
|
|
146
|
+
return t("li", {
|
|
134
147
|
class: "v-pagination__slot"
|
|
135
|
-
}, [a(
|
|
136
|
-
|
|
137
|
-
}
|
|
148
|
+
}, [t(S, null, E(a = l.default(o)) ? a : {
|
|
149
|
+
default: () => [a]
|
|
150
|
+
})]);
|
|
138
151
|
}
|
|
139
152
|
function P({
|
|
140
|
-
classes:
|
|
141
|
-
pageNumberValue:
|
|
142
|
-
name:
|
|
143
|
-
hasItem:
|
|
153
|
+
classes: a,
|
|
154
|
+
pageNumberValue: o,
|
|
155
|
+
name: g,
|
|
156
|
+
hasItem: Z = !0
|
|
144
157
|
}) {
|
|
145
|
-
return
|
|
146
|
-
class: ["v-pagination__item", ...
|
|
147
|
-
}, [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
158
|
+
return Z ? t("li", {
|
|
159
|
+
class: ["v-pagination__item", ...a]
|
|
160
|
+
}, [t(S, {
|
|
161
|
+
onClick: () => N(o)
|
|
162
|
+
}, E(g) ? g : {
|
|
163
|
+
default: () => [g]
|
|
164
|
+
})]) : null;
|
|
151
165
|
}
|
|
152
|
-
function
|
|
153
|
-
return e.pageNumber ?
|
|
166
|
+
function G() {
|
|
167
|
+
return e.pageNumber ? y.value.map((a) => t(P, {
|
|
168
|
+
key: a,
|
|
154
169
|
classes: [{
|
|
155
|
-
active:
|
|
170
|
+
active: a === n.value
|
|
156
171
|
}],
|
|
157
|
-
pageNumberValue:
|
|
158
|
-
name:
|
|
172
|
+
pageNumberValue: a,
|
|
173
|
+
name: a
|
|
159
174
|
}, null)) : null;
|
|
160
175
|
}
|
|
161
|
-
function
|
|
162
|
-
return
|
|
176
|
+
function k() {
|
|
177
|
+
return t(P, {
|
|
163
178
|
classes: ["v-pagination__first", {
|
|
164
179
|
disabled: I.value
|
|
165
180
|
}],
|
|
166
|
-
pageNumberValue:
|
|
167
|
-
name:
|
|
181
|
+
pageNumberValue: f,
|
|
182
|
+
name: p.first,
|
|
168
183
|
hasItem: e.first
|
|
169
184
|
}, null);
|
|
170
185
|
}
|
|
171
186
|
function D() {
|
|
172
|
-
return
|
|
187
|
+
return t(P, {
|
|
173
188
|
classes: ["v-pagination__previous", {
|
|
174
189
|
disabled: I.value
|
|
175
190
|
}],
|
|
@@ -178,40 +193,40 @@ function ae(e, u, l) {
|
|
|
178
193
|
}, null);
|
|
179
194
|
}
|
|
180
195
|
function x() {
|
|
181
|
-
return
|
|
196
|
+
return t(P, {
|
|
182
197
|
classes: ["v-pagination__next", {
|
|
183
|
-
disabled:
|
|
198
|
+
disabled: L.value
|
|
184
199
|
}],
|
|
185
200
|
pageNumberValue: n.value + 1,
|
|
186
201
|
name: "»"
|
|
187
202
|
}, null);
|
|
188
203
|
}
|
|
189
204
|
function U() {
|
|
190
|
-
return
|
|
205
|
+
return t(P, {
|
|
191
206
|
classes: ["v-pagination__last", {
|
|
192
|
-
disabled:
|
|
207
|
+
disabled: L.value
|
|
193
208
|
}],
|
|
194
|
-
pageNumberValue:
|
|
195
|
-
name:
|
|
209
|
+
pageNumberValue: c.value,
|
|
210
|
+
name: p.last,
|
|
196
211
|
hasItem: e.last
|
|
197
212
|
}, null);
|
|
198
213
|
}
|
|
199
|
-
return
|
|
200
|
-
containerClasses:
|
|
201
|
-
totalPage:
|
|
214
|
+
return J(() => N(e.modelValue || f)), {
|
|
215
|
+
containerClasses: C,
|
|
216
|
+
totalPage: c,
|
|
202
217
|
current: n,
|
|
203
|
-
pageNumbers:
|
|
204
|
-
PageSizeOptions:
|
|
205
|
-
PageInformation:
|
|
206
|
-
PageSlot:
|
|
207
|
-
PageNumberItems:
|
|
208
|
-
FirstPageItem:
|
|
218
|
+
pageNumbers: y,
|
|
219
|
+
PageSizeOptions: M,
|
|
220
|
+
PageInformation: T,
|
|
221
|
+
PageSlot: j,
|
|
222
|
+
PageNumberItems: G,
|
|
223
|
+
FirstPageItem: k,
|
|
209
224
|
PreviousPageItem: D,
|
|
210
225
|
NextPageItem: x,
|
|
211
226
|
LastPageItem: U
|
|
212
227
|
};
|
|
213
228
|
}
|
|
214
|
-
const
|
|
229
|
+
const _ = /* @__PURE__ */ K({
|
|
215
230
|
name: "PaginationBar",
|
|
216
231
|
props: {
|
|
217
232
|
modelValue: {
|
|
@@ -220,7 +235,7 @@ const S = /* @__PURE__ */ H({
|
|
|
220
235
|
},
|
|
221
236
|
pageSize: {
|
|
222
237
|
type: Number,
|
|
223
|
-
default:
|
|
238
|
+
default: R
|
|
224
239
|
},
|
|
225
240
|
totalRow: {
|
|
226
241
|
type: Number,
|
|
@@ -228,7 +243,7 @@ const S = /* @__PURE__ */ H({
|
|
|
228
243
|
},
|
|
229
244
|
language: {
|
|
230
245
|
type: String,
|
|
231
|
-
default:
|
|
246
|
+
default: h
|
|
232
247
|
},
|
|
233
248
|
/**
|
|
234
249
|
* Pagination alignment direction
|
|
@@ -236,7 +251,7 @@ const S = /* @__PURE__ */ H({
|
|
|
236
251
|
*/
|
|
237
252
|
align: {
|
|
238
253
|
type: String,
|
|
239
|
-
default:
|
|
254
|
+
default: ee
|
|
240
255
|
},
|
|
241
256
|
/** Page size list */
|
|
242
257
|
pageSizeMenu: {
|
|
@@ -301,39 +316,39 @@ const S = /* @__PURE__ */ H({
|
|
|
301
316
|
slots: l
|
|
302
317
|
}) {
|
|
303
318
|
const {
|
|
304
|
-
containerClasses:
|
|
305
|
-
totalPage:
|
|
306
|
-
PageSizeOptions:
|
|
319
|
+
containerClasses: d,
|
|
320
|
+
totalPage: r,
|
|
321
|
+
PageSizeOptions: s,
|
|
307
322
|
PageInformation: n,
|
|
308
323
|
PageSlot: v,
|
|
309
|
-
PageNumberItems:
|
|
310
|
-
FirstPageItem:
|
|
324
|
+
PageNumberItems: i,
|
|
325
|
+
FirstPageItem: p,
|
|
311
326
|
PreviousPageItem: m,
|
|
312
|
-
NextPageItem:
|
|
313
|
-
LastPageItem:
|
|
314
|
-
} =
|
|
315
|
-
return () => e.hideOnSinglePage &&
|
|
316
|
-
class:
|
|
317
|
-
}, [
|
|
327
|
+
NextPageItem: c,
|
|
328
|
+
LastPageItem: y
|
|
329
|
+
} = ne(e, u, l);
|
|
330
|
+
return () => e.hideOnSinglePage && r.value <= 1 ? null : t("div", {
|
|
331
|
+
class: d.value
|
|
332
|
+
}, [t("ul", null, [t(s, null, null), t(n, null, null), t(v, null, null), t(p, null, null), t(m, null, null), t(i, null, null), t(c, null, null), t(y, null, null)])]);
|
|
318
333
|
}
|
|
319
334
|
});
|
|
320
|
-
|
|
335
|
+
_.install = (e, u = {}) => {
|
|
321
336
|
if (Object.keys(u).length) {
|
|
322
|
-
const { props: l } =
|
|
323
|
-
language:
|
|
324
|
-
align:
|
|
325
|
-
info:
|
|
337
|
+
const { props: l } = _, {
|
|
338
|
+
language: d,
|
|
339
|
+
align: r,
|
|
340
|
+
info: s,
|
|
326
341
|
border: n,
|
|
327
342
|
pageNumber: v,
|
|
328
|
-
first:
|
|
329
|
-
last:
|
|
343
|
+
first: i,
|
|
344
|
+
last: p,
|
|
330
345
|
pageSizeMenu: m
|
|
331
346
|
} = u;
|
|
332
|
-
|
|
347
|
+
d && (l.language.default = d), r && (l.align.default = r), typeof s == "boolean" && (l.info.default = s), typeof n == "boolean" && (l.border.default = n), typeof v == "boolean" && (l.pageNumber.default = v), typeof i == "boolean" && (l.first.default = i), typeof p == "boolean" && (l.last.default = p), typeof m < "u" && (l.pageSizeMenu.default = m);
|
|
333
348
|
}
|
|
334
|
-
e.component(
|
|
349
|
+
e.component(_.name, _);
|
|
335
350
|
};
|
|
336
351
|
export {
|
|
337
|
-
|
|
338
|
-
|
|
352
|
+
_ as PaginationBar,
|
|
353
|
+
_ as default
|
|
339
354
|
};
|
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(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m.VPage={},m.Vue))})(this,function(m,e){"use strict";const[w,
|
|
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(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m.VPage={},m.Vue))})(this,function(m,e){"use strict";const[w,y,T,F,M]=["cn","en","de","jp","pt"],E={[w]:{pageLength:"每页记录数",pageInfo:"第 #pageNumber#/#totalPage# 页(共#totalRow#条记录)",first:"首页",last:"尾页",all:"全部"},[y]:{pageLength:"Per page",pageInfo:"Page #pageNumber#/#totalPage# (total #totalRow# records)",first:"First",last:"Last",all:"All"},[T]:{pageLength:"Seitenlänge",pageInfo:"Aktuell #pageNumber#/#totalPage# (gesamt #totalRow# Aufzeichnungen)",first:"Zuerst",last:"Letzte",all:"Alle"},[F]:{pageLength:"ページごとの記録数",pageInfo:"現在の第 #pageNumber#/#totalPage# ページ(全部で #totalRow# 条の記録)",first:"トップページ",last:"尾のページ",all:"すべて"},[M]:{pageLength:"Resultados por página",pageInfo:"#pageNumber#/#totalPage# (total de #totalRow#)",first:"Início",last:"Fim",all:"Todos"}},f=1,j=5,I=10,R=[I,20,50,100],v=0,[$,ee,C]=["left","center","right"];function G(t,o,n){if(o<=n)return f;const d=Math.floor(n/2),i=o-n+1,c=t-d;return c<f?f:c>i?i:c}function k(t,o,n){const d=G(t,o,n);return Array.from({length:n}).map((i,c)=>d+c).filter(i=>i>=f&&i<=o)}function D(t=y){const o=String(t).toLowerCase();return E[Object.hasOwn(E,o)?o:y]}function L(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}function x(t,o,n){const{pageSizeOptions:d,pageSizeMenu:i,totalRow:c}=e.toRefs(t),l=e.ref(0),b=e.ref(j),u=e.ref(t.pageSize??I),p=D(t.language),P=e.computed(()=>{if(!d.value)return[];const a=Array.from(Array.isArray(i.value)&&i.value.length>0?i.value:R);return u.value!==0&&!a.includes(u.value)&&a.push(u.value),a.sort((r,g)=>r-g)}),s=e.computed(()=>u.value===v?f:Math.ceil(c.value/u.value)),h=e.computed(()=>k(l.value,s.value,b.value)),U=e.computed(()=>({"v-pagination":!0,"v-pagination--right":t.align==="right","v-pagination--center":t.align==="center","v-pagination--disabled":t.disabled,"v-pagination--border":t.border,"v-pagination--circle":!t.border&&t.circle})),A=e.computed(()=>l.value===f),z=e.computed(()=>l.value===s.value);e.watch(()=>t.modelValue,S),e.watch(()=>t.pageSize,B);function S(a=f){if(t.disabled||typeof a!="number")return;let r=a<f?f:a;a>s.value&&s.value>0&&(r=s.value),r!==l.value&&(l.value=r,o("update:modelValue",l.value),O())}function B(a){if(typeof a=="number"&&!(a<0)&&a!==u.value){if(u.value=a,o("update:pageSize",u.value),l.value===f)return O();S(f)}}function O(){o("change",{pageNumber:l.value,pageSize:Number(u.value),totalPage:s.value})}function _(a,{slots:r}){var g;return e.createVNode("a",{href:"javascript:void(0)"},[(g=r==null?void 0:r.default)==null?void 0:g.call(r)])}function Z(){if(!d.value)return null;const a=()=>P.value.map(g=>e.createVNode("option",{key:g,value:g,selected:u.value===g},[g])),r=()=>t.displayAll?e.createVNode("option",{value:v,selected:u.value===v},[p.all]):null;return e.createVNode("li",{class:"v-pagination__list"},[e.createVNode(_,null,{default:()=>[e.createVNode("span",null,[p.pageLength]),e.createVNode("select",{disabled:t.disabled,onChange:g=>B(Number(g.target.value))},[e.createVNode(a,null,null),e.createVNode(r,null,null)])]})])}function q(){if(!t.info)return null;const a=p.pageInfo.replace("#pageNumber#",l.value).replace("#totalPage#",s.value).replace("#totalRow#",c.value);return e.createVNode("li",{class:"v-pagination__info"},[e.createVNode(_,null,L(a)?a:{default:()=>[a]})])}function H(){let a;if(!Object.hasOwn(n,"default"))return null;const r={pageNumber:l.value,pageSize:u.value,totalPage:s.value,totalRow:c.value,isFirst:A.value,isLast:z.value};return e.createVNode("li",{class:"v-pagination__slot"},[e.createVNode(_,null,L(a=n.default(r))?a:{default:()=>[a]})])}function V({classes:a,pageNumberValue:r,name:g,hasItem:Y=!0}){return Y?e.createVNode("li",{class:["v-pagination__item",...a]},[e.createVNode(_,{onClick:()=>S(r)},L(g)?g:{default:()=>[g]})]):null}function J(){return t.pageNumber?h.value.map(a=>e.createVNode(V,{key:a,classes:[{active:a===l.value}],pageNumberValue:a,name:a},null)):null}function K(){return e.createVNode(V,{classes:["v-pagination__first",{disabled:A.value}],pageNumberValue:f,name:p.first,hasItem:t.first},null)}function Q(){return e.createVNode(V,{classes:["v-pagination__previous",{disabled:A.value}],pageNumberValue:l.value-1,name:"«"},null)}function W(){return e.createVNode(V,{classes:["v-pagination__next",{disabled:z.value}],pageNumberValue:l.value+1,name:"»"},null)}function X(){return e.createVNode(V,{classes:["v-pagination__last",{disabled:z.value}],pageNumberValue:s.value,name:p.last,hasItem:t.last},null)}return e.onMounted(()=>S(t.modelValue||f)),{containerClasses:U,totalPage:s,current:l,pageNumbers:h,PageSizeOptions:Z,PageInformation:q,PageSlot:H,PageNumberItems:J,FirstPageItem:K,PreviousPageItem:Q,NextPageItem:W,LastPageItem:X}}const N=e.defineComponent({name:"PaginationBar",props:{modelValue:{type:Number,default:0},pageSize:{type:Number,default:I},totalRow:{type:Number,default:0},language:{type:String,default:y},align:{type:String,default:C},pageSizeMenu:{type:[Array],default:()=>R},pageSizeOptions:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},border:{type:Boolean,default:!1},info:{type:Boolean,default:!0},pageNumber:{type:Boolean,default:!0},first:{type:Boolean,default:!0},last:{type:Boolean,default:!0},displayAll:{type:Boolean,default:!1},hideOnSinglePage:{type:Boolean,default:!1}},emits:["update:modelValue","update:pageSize","change"],setup(t,{emit:o,slots:n}){const{containerClasses:d,totalPage:i,PageSizeOptions:c,PageInformation:l,PageSlot:b,PageNumberItems:u,FirstPageItem:p,PreviousPageItem:P,NextPageItem:s,LastPageItem:h}=x(t,o,n);return()=>t.hideOnSinglePage&&i.value<=1?null:e.createVNode("div",{class:d.value},[e.createVNode("ul",null,[e.createVNode(c,null,null),e.createVNode(l,null,null),e.createVNode(b,null,null),e.createVNode(p,null,null),e.createVNode(P,null,null),e.createVNode(u,null,null),e.createVNode(s,null,null),e.createVNode(h,null,null)])])}});N.install=(t,o={})=>{if(Object.keys(o).length){const{props:n}=N,{language:d,align:i,info:c,border:l,pageNumber:b,first:u,last:p,pageSizeMenu:P}=o;d&&(n.language.default=d),i&&(n.align.default=i),typeof c=="boolean"&&(n.info.default=c),typeof l=="boolean"&&(n.border.default=l),typeof b=="boolean"&&(n.pageNumber.default=b),typeof u=="boolean"&&(n.first.default=u),typeof p=="boolean"&&(n.last.default=p),typeof P<"u"&&(n.pageSizeMenu.default=P)}t.component(N.name,N)},m.PaginationBar=N,m.default=N,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|