@v-c/pagination 0.0.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/LICENSE +21 -0
- package/dist/Options.cjs +162 -0
- package/dist/Options.d.ts +17 -0
- package/dist/Options.js +155 -0
- package/dist/Pager.cjs +80 -0
- package/dist/Pager.d.ts +14 -0
- package/dist/Pager.js +74 -0
- package/dist/Pagination.cjs +592 -0
- package/dist/Pagination.d.ts +3 -0
- package/dist/Pagination.js +582 -0
- package/dist/_virtual/rolldown_runtime.cjs +21 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/interface.cjs +30 -0
- package/dist/interface.d.ts +108 -0
- package/dist/interface.js +29 -0
- package/dist/locale/am.cjs +19 -0
- package/dist/locale/am.d.ts +3 -0
- package/dist/locale/am.js +14 -0
- package/dist/locale/ar_EG.cjs +19 -0
- package/dist/locale/ar_EG.d.ts +3 -0
- package/dist/locale/ar_EG.js +14 -0
- package/dist/locale/az_AZ.cjs +19 -0
- package/dist/locale/az_AZ.d.ts +3 -0
- package/dist/locale/az_AZ.js +14 -0
- package/dist/locale/bg_BG.cjs +19 -0
- package/dist/locale/bg_BG.d.ts +3 -0
- package/dist/locale/bg_BG.js +14 -0
- package/dist/locale/bn_BD.cjs +19 -0
- package/dist/locale/bn_BD.d.ts +3 -0
- package/dist/locale/bn_BD.js +14 -0
- package/dist/locale/by_BY.cjs +19 -0
- package/dist/locale/by_BY.d.ts +3 -0
- package/dist/locale/by_BY.js +14 -0
- package/dist/locale/ca_ES.cjs +19 -0
- package/dist/locale/ca_ES.d.ts +3 -0
- package/dist/locale/ca_ES.js +14 -0
- package/dist/locale/cs_CZ.cjs +19 -0
- package/dist/locale/cs_CZ.d.ts +3 -0
- package/dist/locale/cs_CZ.js +14 -0
- package/dist/locale/da_DK.cjs +19 -0
- package/dist/locale/da_DK.d.ts +3 -0
- package/dist/locale/da_DK.js +14 -0
- package/dist/locale/de_DE.cjs +19 -0
- package/dist/locale/de_DE.d.ts +3 -0
- package/dist/locale/de_DE.js +14 -0
- package/dist/locale/el_GR.cjs +19 -0
- package/dist/locale/el_GR.d.ts +3 -0
- package/dist/locale/el_GR.js +14 -0
- package/dist/locale/en_GB.cjs +19 -0
- package/dist/locale/en_GB.d.ts +3 -0
- package/dist/locale/en_GB.js +14 -0
- package/dist/locale/en_US.cjs +19 -0
- package/dist/locale/en_US.d.ts +3 -0
- package/dist/locale/en_US.js +14 -0
- package/dist/locale/es_ES.cjs +19 -0
- package/dist/locale/es_ES.d.ts +3 -0
- package/dist/locale/es_ES.js +14 -0
- package/dist/locale/et_EE.cjs +19 -0
- package/dist/locale/et_EE.d.ts +3 -0
- package/dist/locale/et_EE.js +14 -0
- package/dist/locale/eu_ES.cjs +19 -0
- package/dist/locale/eu_ES.d.ts +3 -0
- package/dist/locale/eu_ES.js +14 -0
- package/dist/locale/fa_IR.cjs +19 -0
- package/dist/locale/fa_IR.d.ts +3 -0
- package/dist/locale/fa_IR.js +14 -0
- package/dist/locale/fi_FI.cjs +19 -0
- package/dist/locale/fi_FI.d.ts +3 -0
- package/dist/locale/fi_FI.js +14 -0
- package/dist/locale/fr_BE.cjs +19 -0
- package/dist/locale/fr_BE.d.ts +3 -0
- package/dist/locale/fr_BE.js +14 -0
- package/dist/locale/fr_CA.cjs +19 -0
- package/dist/locale/fr_CA.d.ts +3 -0
- package/dist/locale/fr_CA.js +14 -0
- package/dist/locale/fr_FR.cjs +19 -0
- package/dist/locale/fr_FR.d.ts +3 -0
- package/dist/locale/fr_FR.js +14 -0
- package/dist/locale/ga_IE.cjs +19 -0
- package/dist/locale/ga_IE.d.ts +3 -0
- package/dist/locale/ga_IE.js +14 -0
- package/dist/locale/gl_ES.cjs +19 -0
- package/dist/locale/gl_ES.d.ts +3 -0
- package/dist/locale/gl_ES.js +14 -0
- package/dist/locale/he_IL.cjs +19 -0
- package/dist/locale/he_IL.d.ts +3 -0
- package/dist/locale/he_IL.js +14 -0
- package/dist/locale/hi_IN.cjs +19 -0
- package/dist/locale/hi_IN.d.ts +3 -0
- package/dist/locale/hi_IN.js +14 -0
- package/dist/locale/hr_HR.cjs +19 -0
- package/dist/locale/hr_HR.d.ts +3 -0
- package/dist/locale/hr_HR.js +14 -0
- package/dist/locale/hu_HU.cjs +19 -0
- package/dist/locale/hu_HU.d.ts +3 -0
- package/dist/locale/hu_HU.js +14 -0
- package/dist/locale/id_ID.cjs +19 -0
- package/dist/locale/id_ID.d.ts +3 -0
- package/dist/locale/id_ID.js +14 -0
- package/dist/locale/is_IS.cjs +19 -0
- package/dist/locale/is_IS.d.ts +3 -0
- package/dist/locale/is_IS.js +14 -0
- package/dist/locale/it_IT.cjs +19 -0
- package/dist/locale/it_IT.d.ts +3 -0
- package/dist/locale/it_IT.js +14 -0
- package/dist/locale/ja_JP.cjs +19 -0
- package/dist/locale/ja_JP.d.ts +3 -0
- package/dist/locale/ja_JP.js +14 -0
- package/dist/locale/ka_GE.cjs +19 -0
- package/dist/locale/ka_GE.d.ts +3 -0
- package/dist/locale/ka_GE.js +14 -0
- package/dist/locale/kk_KZ.cjs +19 -0
- package/dist/locale/kk_KZ.d.ts +3 -0
- package/dist/locale/kk_KZ.js +14 -0
- package/dist/locale/km_KH.cjs +19 -0
- package/dist/locale/km_KH.d.ts +3 -0
- package/dist/locale/km_KH.js +14 -0
- package/dist/locale/kmr_IQ.cjs +19 -0
- package/dist/locale/kmr_IQ.d.ts +3 -0
- package/dist/locale/kmr_IQ.js +14 -0
- package/dist/locale/kn_IN.cjs +19 -0
- package/dist/locale/kn_IN.d.ts +3 -0
- package/dist/locale/kn_IN.js +14 -0
- package/dist/locale/ko_KR.cjs +19 -0
- package/dist/locale/ko_KR.d.ts +3 -0
- package/dist/locale/ko_KR.js +14 -0
- package/dist/locale/lt_LT.cjs +19 -0
- package/dist/locale/lt_LT.d.ts +3 -0
- package/dist/locale/lt_LT.js +14 -0
- package/dist/locale/lv_LV.cjs +19 -0
- package/dist/locale/lv_LV.d.ts +3 -0
- package/dist/locale/lv_LV.js +14 -0
- package/dist/locale/mk_MK.cjs +19 -0
- package/dist/locale/mk_MK.d.ts +3 -0
- package/dist/locale/mk_MK.js +14 -0
- package/dist/locale/ml_IN.cjs +19 -0
- package/dist/locale/ml_IN.d.ts +3 -0
- package/dist/locale/ml_IN.js +14 -0
- package/dist/locale/mn_MN.cjs +19 -0
- package/dist/locale/mn_MN.d.ts +3 -0
- package/dist/locale/mn_MN.js +14 -0
- package/dist/locale/mr_IN.cjs +19 -0
- package/dist/locale/mr_IN.d.ts +3 -0
- package/dist/locale/mr_IN.js +14 -0
- package/dist/locale/ms_MY.cjs +19 -0
- package/dist/locale/ms_MY.d.ts +3 -0
- package/dist/locale/ms_MY.js +14 -0
- package/dist/locale/my_MM.cjs +19 -0
- package/dist/locale/my_MM.d.ts +3 -0
- package/dist/locale/my_MM.js +14 -0
- package/dist/locale/nb_NO.cjs +18 -0
- package/dist/locale/nb_NO.d.ts +3 -0
- package/dist/locale/nb_NO.js +13 -0
- package/dist/locale/ne_NP.cjs +19 -0
- package/dist/locale/ne_NP.d.ts +3 -0
- package/dist/locale/ne_NP.js +14 -0
- package/dist/locale/nl_BE.cjs +19 -0
- package/dist/locale/nl_BE.d.ts +3 -0
- package/dist/locale/nl_BE.js +14 -0
- package/dist/locale/nl_NL.cjs +19 -0
- package/dist/locale/nl_NL.d.ts +3 -0
- package/dist/locale/nl_NL.js +14 -0
- package/dist/locale/pa_IN.cjs +19 -0
- package/dist/locale/pa_IN.d.ts +3 -0
- package/dist/locale/pa_IN.js +14 -0
- package/dist/locale/pb_IN.cjs +19 -0
- package/dist/locale/pb_IN.d.ts +3 -0
- package/dist/locale/pb_IN.js +14 -0
- package/dist/locale/pl_PL.cjs +19 -0
- package/dist/locale/pl_PL.d.ts +3 -0
- package/dist/locale/pl_PL.js +14 -0
- package/dist/locale/pt_BR.cjs +19 -0
- package/dist/locale/pt_BR.d.ts +3 -0
- package/dist/locale/pt_BR.js +14 -0
- package/dist/locale/pt_PT.cjs +19 -0
- package/dist/locale/pt_PT.d.ts +3 -0
- package/dist/locale/pt_PT.js +14 -0
- package/dist/locale/ro_RO.cjs +19 -0
- package/dist/locale/ro_RO.d.ts +3 -0
- package/dist/locale/ro_RO.js +14 -0
- package/dist/locale/ru_RU.cjs +19 -0
- package/dist/locale/ru_RU.d.ts +3 -0
- package/dist/locale/ru_RU.js +14 -0
- package/dist/locale/si_LK.cjs +19 -0
- package/dist/locale/si_LK.d.ts +3 -0
- package/dist/locale/si_LK.js +14 -0
- package/dist/locale/sk_SK.cjs +19 -0
- package/dist/locale/sk_SK.d.ts +3 -0
- package/dist/locale/sk_SK.js +14 -0
- package/dist/locale/sl_SI.cjs +19 -0
- package/dist/locale/sl_SI.d.ts +3 -0
- package/dist/locale/sl_SI.js +14 -0
- package/dist/locale/sr_Cyrl_RS.cjs +18 -0
- package/dist/locale/sr_Cyrl_RS.d.ts +3 -0
- package/dist/locale/sr_Cyrl_RS.js +13 -0
- package/dist/locale/sr_RS.cjs +18 -0
- package/dist/locale/sr_RS.d.ts +3 -0
- package/dist/locale/sr_RS.js +13 -0
- package/dist/locale/sv_SE.cjs +19 -0
- package/dist/locale/sv_SE.d.ts +3 -0
- package/dist/locale/sv_SE.js +14 -0
- package/dist/locale/ta_IN.cjs +19 -0
- package/dist/locale/ta_IN.d.ts +3 -0
- package/dist/locale/ta_IN.js +14 -0
- package/dist/locale/te_IN.cjs +19 -0
- package/dist/locale/te_IN.d.ts +3 -0
- package/dist/locale/te_IN.js +14 -0
- package/dist/locale/th_TH.cjs +19 -0
- package/dist/locale/th_TH.d.ts +3 -0
- package/dist/locale/th_TH.js +14 -0
- package/dist/locale/tk_TK.cjs +19 -0
- package/dist/locale/tk_TK.d.ts +3 -0
- package/dist/locale/tk_TK.js +14 -0
- package/dist/locale/tr_TR.cjs +19 -0
- package/dist/locale/tr_TR.d.ts +3 -0
- package/dist/locale/tr_TR.js +14 -0
- package/dist/locale/ug_CN.cjs +19 -0
- package/dist/locale/ug_CN.d.ts +3 -0
- package/dist/locale/ug_CN.js +14 -0
- package/dist/locale/uk_UA.cjs +19 -0
- package/dist/locale/uk_UA.d.ts +3 -0
- package/dist/locale/uk_UA.js +14 -0
- package/dist/locale/ur_PK.cjs +19 -0
- package/dist/locale/ur_PK.d.ts +3 -0
- package/dist/locale/ur_PK.js +14 -0
- package/dist/locale/uz_UZ.cjs +19 -0
- package/dist/locale/uz_UZ.d.ts +3 -0
- package/dist/locale/uz_UZ.js +14 -0
- package/dist/locale/vi_VN.cjs +19 -0
- package/dist/locale/vi_VN.d.ts +3 -0
- package/dist/locale/vi_VN.js +14 -0
- package/dist/locale/zh_CN.cjs +19 -0
- package/dist/locale/zh_CN.d.ts +3 -0
- package/dist/locale/zh_CN.js +14 -0
- package/dist/locale/zh_TW.cjs +19 -0
- package/dist/locale/zh_TW.d.ts +3 -0
- package/dist/locale/zh_TW.js +14 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 antdv-community
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/Options.cjs
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
6
|
+
let vue = require("vue");
|
|
7
|
+
let _v_c_util_dist_KeyCode = require("@v-c/util/dist/KeyCode");
|
|
8
|
+
_v_c_util_dist_KeyCode = require_rolldown_runtime.__toESM(_v_c_util_dist_KeyCode);
|
|
9
|
+
var Options = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
10
|
+
const defaultPageSizeOptions = [
|
|
11
|
+
10,
|
|
12
|
+
20,
|
|
13
|
+
50,
|
|
14
|
+
100
|
|
15
|
+
];
|
|
16
|
+
const goInputText = (0, vue.ref)("");
|
|
17
|
+
const getValidValue = (0, vue.computed)(() => {
|
|
18
|
+
return !goInputText.value || Number.isNaN(goInputText.value) ? void 0 : Number(goInputText.value);
|
|
19
|
+
});
|
|
20
|
+
const handleChange = (e) => {
|
|
21
|
+
const value = e.target.value;
|
|
22
|
+
if (/^\d*$/.test(value)) goInputText.value = value;
|
|
23
|
+
};
|
|
24
|
+
const handleBlur = (e) => {
|
|
25
|
+
if (props.goButton || goInputText.value === "") return;
|
|
26
|
+
(0, vue.nextTick)(() => {
|
|
27
|
+
goInputText.value = "";
|
|
28
|
+
});
|
|
29
|
+
const relTarget = e.relatedTarget;
|
|
30
|
+
if (relTarget && relTarget.className.includes(`${props.rootPrefixCls}-item-link`) || relTarget?.className.includes(`${props.rootPrefixCls}-item`)) return;
|
|
31
|
+
props.quickGo?.(getValidValue.value);
|
|
32
|
+
};
|
|
33
|
+
const getterPageSizeOptions = (0, vue.computed)(() => props.pageSizeOptions || defaultPageSizeOptions);
|
|
34
|
+
const go = (e) => {
|
|
35
|
+
if (goInputText.value === "") return;
|
|
36
|
+
if (e.keyCode === _v_c_util_dist_KeyCode.default.ENTER || e.type === "click") {
|
|
37
|
+
(0, vue.nextTick)(() => {
|
|
38
|
+
goInputText.value = "";
|
|
39
|
+
});
|
|
40
|
+
props.quickGo?.(getValidValue.value);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const getPageSizeOptions = () => {
|
|
44
|
+
if (getterPageSizeOptions.value.some((option) => option.toString() === props.pageSize.toString())) return getterPageSizeOptions.value;
|
|
45
|
+
return getterPageSizeOptions.value.concat([props.pageSize]).sort((a, b) => {
|
|
46
|
+
return (Number.isNaN(Number(a)) ? 0 : Number(a)) - (Number.isNaN(Number(b)) ? 0 : Number(b));
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return () => {
|
|
50
|
+
const { rootPrefixCls, locale, showSizeChanger, disabled, pageSize, quickGo, goButton, buildOptionText, sizeChangerRender, changeSize } = props;
|
|
51
|
+
const mergeBuildOptionText = typeof buildOptionText === "function" ? buildOptionText : (value) => `${value} ${locale.items_per_page}`;
|
|
52
|
+
const prefixCls = `${rootPrefixCls}-options`;
|
|
53
|
+
if (!showSizeChanger && !quickGo) return null;
|
|
54
|
+
let changeSelect = null;
|
|
55
|
+
let goInput = null;
|
|
56
|
+
let gotoButton = null;
|
|
57
|
+
if (showSizeChanger && sizeChangerRender) changeSelect = sizeChangerRender({
|
|
58
|
+
"disabled": disabled,
|
|
59
|
+
"size": pageSize,
|
|
60
|
+
"onSizeChange": (nextValue) => {
|
|
61
|
+
changeSize?.(Number(nextValue));
|
|
62
|
+
},
|
|
63
|
+
"aria-label": locale.page_size,
|
|
64
|
+
"className": `${prefixCls}-size-changer`,
|
|
65
|
+
"options": getPageSizeOptions().map((opt) => ({
|
|
66
|
+
label: mergeBuildOptionText(opt),
|
|
67
|
+
value: opt
|
|
68
|
+
}))
|
|
69
|
+
});
|
|
70
|
+
if (quickGo) {
|
|
71
|
+
if (goButton) gotoButton = typeof goButton === "boolean" ? (0, vue.createVNode)("button", {
|
|
72
|
+
"type": "button",
|
|
73
|
+
"onClick": go,
|
|
74
|
+
"onKeyup": go,
|
|
75
|
+
"disabled": disabled,
|
|
76
|
+
"class": `${prefixCls}-quick-jumper-button`
|
|
77
|
+
}, [locale.jump_to_confirm]) : (0, vue.createVNode)("span", {
|
|
78
|
+
"onClick": go,
|
|
79
|
+
"onKeyup": go
|
|
80
|
+
}, [goButton]);
|
|
81
|
+
goInput = (0, vue.createVNode)("div", { "class": `${prefixCls}-quick-jumper` }, [
|
|
82
|
+
locale.jump_to,
|
|
83
|
+
(0, vue.createVNode)("input", {
|
|
84
|
+
"disabled": disabled,
|
|
85
|
+
"type": "text",
|
|
86
|
+
"value": goInputText.value,
|
|
87
|
+
"onInput": handleChange,
|
|
88
|
+
"onKeyup": go,
|
|
89
|
+
"onBlur": handleBlur,
|
|
90
|
+
"aria-label": locale.page
|
|
91
|
+
}, null),
|
|
92
|
+
locale.page,
|
|
93
|
+
gotoButton
|
|
94
|
+
]);
|
|
95
|
+
}
|
|
96
|
+
return (0, vue.createVNode)("li", { "class": prefixCls }, [changeSelect, goInput]);
|
|
97
|
+
};
|
|
98
|
+
}, { props: {
|
|
99
|
+
disabled: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
required: false,
|
|
102
|
+
default: void 0
|
|
103
|
+
},
|
|
104
|
+
locale: {
|
|
105
|
+
type: Object,
|
|
106
|
+
required: true,
|
|
107
|
+
default: void 0
|
|
108
|
+
},
|
|
109
|
+
rootPrefixCls: {
|
|
110
|
+
type: String,
|
|
111
|
+
required: true,
|
|
112
|
+
default: void 0
|
|
113
|
+
},
|
|
114
|
+
selectPrefixCls: {
|
|
115
|
+
type: String,
|
|
116
|
+
required: false,
|
|
117
|
+
default: void 0
|
|
118
|
+
},
|
|
119
|
+
pageSize: {
|
|
120
|
+
type: Number,
|
|
121
|
+
required: true,
|
|
122
|
+
default: void 0
|
|
123
|
+
},
|
|
124
|
+
pageSizeOptions: {
|
|
125
|
+
type: Array,
|
|
126
|
+
required: false,
|
|
127
|
+
default: void 0
|
|
128
|
+
},
|
|
129
|
+
goButton: {
|
|
130
|
+
type: [Boolean, String],
|
|
131
|
+
required: false,
|
|
132
|
+
skipCheck: true,
|
|
133
|
+
default: void 0
|
|
134
|
+
},
|
|
135
|
+
changeSize: {
|
|
136
|
+
type: Function,
|
|
137
|
+
required: false,
|
|
138
|
+
default: void 0
|
|
139
|
+
},
|
|
140
|
+
quickGo: {
|
|
141
|
+
type: Function,
|
|
142
|
+
required: false,
|
|
143
|
+
default: void 0
|
|
144
|
+
},
|
|
145
|
+
buildOptionText: {
|
|
146
|
+
type: Function,
|
|
147
|
+
required: false,
|
|
148
|
+
default: void 0
|
|
149
|
+
},
|
|
150
|
+
showSizeChanger: {
|
|
151
|
+
type: Boolean,
|
|
152
|
+
required: true,
|
|
153
|
+
default: void 0
|
|
154
|
+
},
|
|
155
|
+
sizeChangerRender: {
|
|
156
|
+
type: Function,
|
|
157
|
+
required: false,
|
|
158
|
+
default: void 0
|
|
159
|
+
}
|
|
160
|
+
} });
|
|
161
|
+
var Options_default = Options;
|
|
162
|
+
exports.default = Options_default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PaginationLocale, SizeChangerRender } from './interface';
|
|
2
|
+
interface OptionsProps {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
locale: PaginationLocale;
|
|
5
|
+
rootPrefixCls: string;
|
|
6
|
+
selectPrefixCls?: string;
|
|
7
|
+
pageSize: number;
|
|
8
|
+
pageSizeOptions?: number[];
|
|
9
|
+
goButton?: boolean | string | any;
|
|
10
|
+
changeSize?: (size: number) => void;
|
|
11
|
+
quickGo?: (value: number | undefined) => void;
|
|
12
|
+
buildOptionText?: (value: number | string) => string;
|
|
13
|
+
showSizeChanger: boolean;
|
|
14
|
+
sizeChangerRender?: SizeChangerRender;
|
|
15
|
+
}
|
|
16
|
+
declare const Options: import('vue').DefineSetupFnComponent<OptionsProps, {}, {}, OptionsProps & {}, import('vue').PublicProps>;
|
|
17
|
+
export default Options;
|
package/dist/Options.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { computed, createVNode, defineComponent, nextTick, ref } from "vue";
|
|
2
|
+
import KeyCode from "@v-c/util/dist/KeyCode";
|
|
3
|
+
var Options_default = /* @__PURE__ */ defineComponent((props) => {
|
|
4
|
+
const defaultPageSizeOptions = [
|
|
5
|
+
10,
|
|
6
|
+
20,
|
|
7
|
+
50,
|
|
8
|
+
100
|
|
9
|
+
];
|
|
10
|
+
const goInputText = ref("");
|
|
11
|
+
const getValidValue = computed(() => {
|
|
12
|
+
return !goInputText.value || Number.isNaN(goInputText.value) ? void 0 : Number(goInputText.value);
|
|
13
|
+
});
|
|
14
|
+
const handleChange = (e) => {
|
|
15
|
+
const value = e.target.value;
|
|
16
|
+
if (/^\d*$/.test(value)) goInputText.value = value;
|
|
17
|
+
};
|
|
18
|
+
const handleBlur = (e) => {
|
|
19
|
+
if (props.goButton || goInputText.value === "") return;
|
|
20
|
+
nextTick(() => {
|
|
21
|
+
goInputText.value = "";
|
|
22
|
+
});
|
|
23
|
+
const relTarget = e.relatedTarget;
|
|
24
|
+
if (relTarget && relTarget.className.includes(`${props.rootPrefixCls}-item-link`) || relTarget?.className.includes(`${props.rootPrefixCls}-item`)) return;
|
|
25
|
+
props.quickGo?.(getValidValue.value);
|
|
26
|
+
};
|
|
27
|
+
const getterPageSizeOptions = computed(() => props.pageSizeOptions || defaultPageSizeOptions);
|
|
28
|
+
const go = (e) => {
|
|
29
|
+
if (goInputText.value === "") return;
|
|
30
|
+
if (e.keyCode === KeyCode.ENTER || e.type === "click") {
|
|
31
|
+
nextTick(() => {
|
|
32
|
+
goInputText.value = "";
|
|
33
|
+
});
|
|
34
|
+
props.quickGo?.(getValidValue.value);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const getPageSizeOptions = () => {
|
|
38
|
+
if (getterPageSizeOptions.value.some((option) => option.toString() === props.pageSize.toString())) return getterPageSizeOptions.value;
|
|
39
|
+
return getterPageSizeOptions.value.concat([props.pageSize]).sort((a, b) => {
|
|
40
|
+
return (Number.isNaN(Number(a)) ? 0 : Number(a)) - (Number.isNaN(Number(b)) ? 0 : Number(b));
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
return () => {
|
|
44
|
+
const { rootPrefixCls, locale, showSizeChanger, disabled, pageSize, quickGo, goButton, buildOptionText, sizeChangerRender, changeSize } = props;
|
|
45
|
+
const mergeBuildOptionText = typeof buildOptionText === "function" ? buildOptionText : (value) => `${value} ${locale.items_per_page}`;
|
|
46
|
+
const prefixCls = `${rootPrefixCls}-options`;
|
|
47
|
+
if (!showSizeChanger && !quickGo) return null;
|
|
48
|
+
let changeSelect = null;
|
|
49
|
+
let goInput = null;
|
|
50
|
+
let gotoButton = null;
|
|
51
|
+
if (showSizeChanger && sizeChangerRender) changeSelect = sizeChangerRender({
|
|
52
|
+
"disabled": disabled,
|
|
53
|
+
"size": pageSize,
|
|
54
|
+
"onSizeChange": (nextValue) => {
|
|
55
|
+
changeSize?.(Number(nextValue));
|
|
56
|
+
},
|
|
57
|
+
"aria-label": locale.page_size,
|
|
58
|
+
"className": `${prefixCls}-size-changer`,
|
|
59
|
+
"options": getPageSizeOptions().map((opt) => ({
|
|
60
|
+
label: mergeBuildOptionText(opt),
|
|
61
|
+
value: opt
|
|
62
|
+
}))
|
|
63
|
+
});
|
|
64
|
+
if (quickGo) {
|
|
65
|
+
if (goButton) gotoButton = typeof goButton === "boolean" ? createVNode("button", {
|
|
66
|
+
"type": "button",
|
|
67
|
+
"onClick": go,
|
|
68
|
+
"onKeyup": go,
|
|
69
|
+
"disabled": disabled,
|
|
70
|
+
"class": `${prefixCls}-quick-jumper-button`
|
|
71
|
+
}, [locale.jump_to_confirm]) : createVNode("span", {
|
|
72
|
+
"onClick": go,
|
|
73
|
+
"onKeyup": go
|
|
74
|
+
}, [goButton]);
|
|
75
|
+
goInput = createVNode("div", { "class": `${prefixCls}-quick-jumper` }, [
|
|
76
|
+
locale.jump_to,
|
|
77
|
+
createVNode("input", {
|
|
78
|
+
"disabled": disabled,
|
|
79
|
+
"type": "text",
|
|
80
|
+
"value": goInputText.value,
|
|
81
|
+
"onInput": handleChange,
|
|
82
|
+
"onKeyup": go,
|
|
83
|
+
"onBlur": handleBlur,
|
|
84
|
+
"aria-label": locale.page
|
|
85
|
+
}, null),
|
|
86
|
+
locale.page,
|
|
87
|
+
gotoButton
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
return createVNode("li", { "class": prefixCls }, [changeSelect, goInput]);
|
|
91
|
+
};
|
|
92
|
+
}, { props: {
|
|
93
|
+
disabled: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
required: false,
|
|
96
|
+
default: void 0
|
|
97
|
+
},
|
|
98
|
+
locale: {
|
|
99
|
+
type: Object,
|
|
100
|
+
required: true,
|
|
101
|
+
default: void 0
|
|
102
|
+
},
|
|
103
|
+
rootPrefixCls: {
|
|
104
|
+
type: String,
|
|
105
|
+
required: true,
|
|
106
|
+
default: void 0
|
|
107
|
+
},
|
|
108
|
+
selectPrefixCls: {
|
|
109
|
+
type: String,
|
|
110
|
+
required: false,
|
|
111
|
+
default: void 0
|
|
112
|
+
},
|
|
113
|
+
pageSize: {
|
|
114
|
+
type: Number,
|
|
115
|
+
required: true,
|
|
116
|
+
default: void 0
|
|
117
|
+
},
|
|
118
|
+
pageSizeOptions: {
|
|
119
|
+
type: Array,
|
|
120
|
+
required: false,
|
|
121
|
+
default: void 0
|
|
122
|
+
},
|
|
123
|
+
goButton: {
|
|
124
|
+
type: [Boolean, String],
|
|
125
|
+
required: false,
|
|
126
|
+
skipCheck: true,
|
|
127
|
+
default: void 0
|
|
128
|
+
},
|
|
129
|
+
changeSize: {
|
|
130
|
+
type: Function,
|
|
131
|
+
required: false,
|
|
132
|
+
default: void 0
|
|
133
|
+
},
|
|
134
|
+
quickGo: {
|
|
135
|
+
type: Function,
|
|
136
|
+
required: false,
|
|
137
|
+
default: void 0
|
|
138
|
+
},
|
|
139
|
+
buildOptionText: {
|
|
140
|
+
type: Function,
|
|
141
|
+
required: false,
|
|
142
|
+
default: void 0
|
|
143
|
+
},
|
|
144
|
+
showSizeChanger: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
required: true,
|
|
147
|
+
default: void 0
|
|
148
|
+
},
|
|
149
|
+
sizeChangerRender: {
|
|
150
|
+
type: Function,
|
|
151
|
+
required: false,
|
|
152
|
+
default: void 0
|
|
153
|
+
}
|
|
154
|
+
} });
|
|
155
|
+
export { Options_default as default };
|
package/dist/Pager.cjs
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
6
|
+
let vue = require("vue");
|
|
7
|
+
let _v_c_util = require("@v-c/util");
|
|
8
|
+
var Pager = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
9
|
+
const handleClick = () => {
|
|
10
|
+
props.onClick?.(props.page);
|
|
11
|
+
};
|
|
12
|
+
const handleKeyPress = (e) => {
|
|
13
|
+
props.onKeyPress?.(e, props.onClick, props.page);
|
|
14
|
+
};
|
|
15
|
+
return () => {
|
|
16
|
+
const { rootPrefixCls, page, active, className, showTitle, itemRender, style } = props;
|
|
17
|
+
const prefixCls = `${rootPrefixCls}-item`;
|
|
18
|
+
const cls = (0, _v_c_util.classNames)(prefixCls, `${prefixCls}-${page}`, {
|
|
19
|
+
[`${prefixCls}-active`]: active,
|
|
20
|
+
[`${prefixCls}-disabled`]: !page
|
|
21
|
+
}, className);
|
|
22
|
+
const pager = itemRender?.(page, "page", (0, vue.createVNode)("a", { "rel": "nofollow" }, [page]));
|
|
23
|
+
return pager ? (0, vue.createVNode)("li", {
|
|
24
|
+
"title": showTitle ? String(page) : void 0,
|
|
25
|
+
"class": cls,
|
|
26
|
+
"style": style,
|
|
27
|
+
"onClick": handleClick,
|
|
28
|
+
"onKeydown": handleKeyPress,
|
|
29
|
+
"tabindex": 0
|
|
30
|
+
}, [pager]) : null;
|
|
31
|
+
};
|
|
32
|
+
}, { props: {
|
|
33
|
+
rootPrefixCls: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true,
|
|
36
|
+
default: void 0
|
|
37
|
+
},
|
|
38
|
+
page: {
|
|
39
|
+
type: Number,
|
|
40
|
+
required: true,
|
|
41
|
+
default: void 0
|
|
42
|
+
},
|
|
43
|
+
active: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
required: false,
|
|
46
|
+
default: void 0
|
|
47
|
+
},
|
|
48
|
+
className: {
|
|
49
|
+
type: String,
|
|
50
|
+
required: false,
|
|
51
|
+
default: void 0
|
|
52
|
+
},
|
|
53
|
+
style: {
|
|
54
|
+
type: Object,
|
|
55
|
+
required: false,
|
|
56
|
+
default: void 0
|
|
57
|
+
},
|
|
58
|
+
showTitle: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
required: true,
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
63
|
+
onClick: {
|
|
64
|
+
type: Function,
|
|
65
|
+
required: false,
|
|
66
|
+
default: void 0
|
|
67
|
+
},
|
|
68
|
+
onKeyPress: {
|
|
69
|
+
type: Function,
|
|
70
|
+
required: false,
|
|
71
|
+
default: void 0
|
|
72
|
+
},
|
|
73
|
+
itemRender: {
|
|
74
|
+
type: Function,
|
|
75
|
+
required: false,
|
|
76
|
+
default: void 0
|
|
77
|
+
}
|
|
78
|
+
} });
|
|
79
|
+
var Pager_default = Pager;
|
|
80
|
+
exports.default = Pager_default;
|
package/dist/Pager.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue';
|
|
2
|
+
import { PaginationProps } from './interface';
|
|
3
|
+
export interface PagerProps extends Pick<PaginationProps, 'itemRender'> {
|
|
4
|
+
rootPrefixCls: string;
|
|
5
|
+
page: number;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
showTitle: boolean;
|
|
10
|
+
onClick?: (page: number) => void;
|
|
11
|
+
onKeyPress?: (e: KeyboardEvent, onClick: PagerProps['onClick'], page: PagerProps['page']) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const Pager: import('vue').DefineSetupFnComponent<PagerProps, {}, {}, PagerProps & {}, import('vue').PublicProps>;
|
|
14
|
+
export default Pager;
|
package/dist/Pager.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createVNode, defineComponent } from "vue";
|
|
2
|
+
import { classNames } from "@v-c/util";
|
|
3
|
+
var Pager_default = /* @__PURE__ */ defineComponent((props) => {
|
|
4
|
+
const handleClick = () => {
|
|
5
|
+
props.onClick?.(props.page);
|
|
6
|
+
};
|
|
7
|
+
const handleKeyPress = (e) => {
|
|
8
|
+
props.onKeyPress?.(e, props.onClick, props.page);
|
|
9
|
+
};
|
|
10
|
+
return () => {
|
|
11
|
+
const { rootPrefixCls, page, active, className, showTitle, itemRender, style } = props;
|
|
12
|
+
const prefixCls = `${rootPrefixCls}-item`;
|
|
13
|
+
const cls = classNames(prefixCls, `${prefixCls}-${page}`, {
|
|
14
|
+
[`${prefixCls}-active`]: active,
|
|
15
|
+
[`${prefixCls}-disabled`]: !page
|
|
16
|
+
}, className);
|
|
17
|
+
const pager = itemRender?.(page, "page", createVNode("a", { "rel": "nofollow" }, [page]));
|
|
18
|
+
return pager ? createVNode("li", {
|
|
19
|
+
"title": showTitle ? String(page) : void 0,
|
|
20
|
+
"class": cls,
|
|
21
|
+
"style": style,
|
|
22
|
+
"onClick": handleClick,
|
|
23
|
+
"onKeydown": handleKeyPress,
|
|
24
|
+
"tabindex": 0
|
|
25
|
+
}, [pager]) : null;
|
|
26
|
+
};
|
|
27
|
+
}, { props: {
|
|
28
|
+
rootPrefixCls: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true,
|
|
31
|
+
default: void 0
|
|
32
|
+
},
|
|
33
|
+
page: {
|
|
34
|
+
type: Number,
|
|
35
|
+
required: true,
|
|
36
|
+
default: void 0
|
|
37
|
+
},
|
|
38
|
+
active: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
required: false,
|
|
41
|
+
default: void 0
|
|
42
|
+
},
|
|
43
|
+
className: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: false,
|
|
46
|
+
default: void 0
|
|
47
|
+
},
|
|
48
|
+
style: {
|
|
49
|
+
type: Object,
|
|
50
|
+
required: false,
|
|
51
|
+
default: void 0
|
|
52
|
+
},
|
|
53
|
+
showTitle: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
required: true,
|
|
56
|
+
default: void 0
|
|
57
|
+
},
|
|
58
|
+
onClick: {
|
|
59
|
+
type: Function,
|
|
60
|
+
required: false,
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
63
|
+
onKeyPress: {
|
|
64
|
+
type: Function,
|
|
65
|
+
required: false,
|
|
66
|
+
default: void 0
|
|
67
|
+
},
|
|
68
|
+
itemRender: {
|
|
69
|
+
type: Function,
|
|
70
|
+
required: false,
|
|
71
|
+
default: void 0
|
|
72
|
+
}
|
|
73
|
+
} });
|
|
74
|
+
export { Pager_default as default };
|