@itera-web/react-ui-pagination-push 1.26.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/LICENSE.md +0 -0
- package/README.md +1 -0
- package/es/Components/ChevronLeft.d.ts +4 -0
- package/es/Components/ChevronRight.d.ts +4 -0
- package/es/Pagination.d.ts +18 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/package.json +31 -0
package/LICENSE.md
ADDED
|
File without changes
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
### [使用文档](http://iterative.keyboardecho.com/)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IPaginationProps {
|
|
3
|
+
onChange?: (a: any, b: any) => void;
|
|
4
|
+
onShowSizeChange?: (a: any, b: any) => void;
|
|
5
|
+
size?: 'default' | 'small' | 'large';
|
|
6
|
+
total?: number;
|
|
7
|
+
current?: number;
|
|
8
|
+
pageSize?: number;
|
|
9
|
+
pageSizeOptions?: number[];
|
|
10
|
+
showQuickJumper?: boolean;
|
|
11
|
+
showSizeChanger?: boolean;
|
|
12
|
+
simple?: boolean;
|
|
13
|
+
showTotalTxt?: boolean;
|
|
14
|
+
className?: any;
|
|
15
|
+
flex?: 'justify-start' | 'justify-end' | 'justify-center' | 'justify-between';
|
|
16
|
+
simpleInputMode?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const Pagination: React.NamedExoticComponent<IPaginationProps>;
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Pagination, type IPaginationProps } from './Pagination';
|
package/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import*as t from"@itera-web/react-ui-button";import*as n from"@itera-web/react-ui-conditionalrender";import*as a from"@itera-web/react-ui-input";import*as r from"@itera-web/react-ui-select";import*as l from"@itera-web/utils-cn";import*as o from"@itera-web/utils-locale-toggle";var u={d:(e,t)=>{for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},i={};u.d(i,{t:()=>x});const c=(e=>{var t={};return u.d(t,e),t})({createElement:()=>e.createElement,default:()=>e.default,memo:()=>e.memo});const s=(e=>{var t={};return u.d(t,e),t})({Button:()=>t.Button});const m=(e=>{var t={};return u.d(t,e),t})({ConditionalRender:()=>n.ConditionalRender});const d=(e=>{var t={};return u.d(t,e),t})({Input:()=>a.Input});const f=(e=>{var t={};return u.d(t,e),t})({Select:()=>r.Select});const p=(e=>{var t={};return u.d(t,e),t})({cn:()=>l.cn});const v=(e=>{var t={};return u.d(t,e),t})({Intl:()=>o.Intl});var g=function(e){var t=e.className;return c.createElement("svg",{className:t,fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg"},c.createElement("path",{d:"m15 18-6-6 6-6"}))},h=function(e){var t=e.className;return c.createElement("svg",{className:t,fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg"},c.createElement("path",{d:"m9 6 6 6-6 6"}))},E=function(e){var t=e.onChange,n=void 0===t?function(){}:t,a=e.onShowSizeChange,r=void 0===a?function(){}:a,l=e.size,o=void 0===l?"small":l,u=e.total,i=void 0===u?0:u,E=e.simple,x=void 0!==E&&E,N=e.current,w=void 0===N?1:N,y=e.pageSize,b=void 0===y?10:y,k=e.flex,C=void 0===k?"justify-start":k,S=e.pageSizeOptions,z=void 0===S?[10,25,50,100,150,200,500,1e3,1e6]:S,I=e.showQuickJumper,B=void 0===I||I,j=e.showSizeChanger,q=void 0===j||j,L=e.showTotalTxt,O=void 0===L||L,D=e.simpleInputMode,M=void 0!==D&&D,P=e.className,R=Math.ceil(i/b),F=function(e){var t=Number(e.target.value);t&&K(t)},K=function(e){e>=1&&e<=R&&n(e,b)},T=function(e){var t=e.target,n=Number(t.value);K(n),t.value=""},W=function(){return"large"===o||"default"===o?"sm":"zero"},J=function(){return"large"===o?36:"default"===o?28:22};return c.default.createElement(m.ConditionalRender,{conditional:i>0},function(){return c.default.createElement("div",{className:(0,p.cn)("flex items-center gap-4 text-font ".concat(C),P)},c.default.createElement("div",{className:"flex items-center gap-2"},O&&c.default.createElement("div",{className:"text-font text-sm w-fit"},v.Intl.v("当前 {page}-{pageSize}/共 {total}条",{page:(w-1)*b+1,pageSize:Math.min(w*b,i),total:i})),q&&c.default.createElement("div",{className:"w-[120px]"},c.default.createElement(f.Select,{height:J()+2,onChange:function(e){var t,n;e&&(t=String(e.value),n=parseInt(t,10),r(w,n))},options:z.map(function(e){return{label:"".concat(e," 条/页"),value:e}}),style:{height:J()+2},value:z.map(function(e){return{label:"".concat(e," 条/页"),value:e}}).find(function(e){return e.value===b})||null}))),c.default.createElement("div",{className:"flex items-center justify-center gap-2"},c.default.createElement(s.Button,{disabled:1===w,onClick:function(){return K(w-1)},size:W()},c.default.createElement(g,{className:"w-4 h-4"})),x?c.default.createElement(c.default.Fragment,null,M?c.default.createElement("div",{className:"flex items-center gap-2 text-sm"},c.default.createElement(d.Input.Number,{InputClassName:"p-0",className:"w-14 text-center",hiddenSvg:!0,max:R,min:1,onBlur:F,onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),e.target.blur())},style:{height:J()},value:w}),c.default.createElement("span",null,"/"),c.default.createElement("span",null,R)):c.default.createElement("div",{className:"text-sm flex items-center gap-2"},c.default.createElement("span",null,w),c.default.createElement("span",null,"/"),c.default.createElement("span",null,R))):c.default.createElement(c.default.Fragment,null,function(){var e=[];if(R<=7)for(var t=1;t<=R;t++)e.push(t);else w<=4?e.push(1,2,3,4,5,"...",R):w>=R-3?e.push(1,"...",R-4,R-3,R-2,R-1,R):e.push(1,"...",w-1,w,w+1,"...",R);return e.map(function(e,t){return"..."===e?c.default.createElement("span",{className:"px-2 text-gray-500 select-none",key:"ellipsis-".concat(t)},"..."):c.default.createElement(s.Button,{className:(0,p.cn)(e===w?"border border-primary text-primary rounded-[4px]":"border border-transparent"),key:e,onClick:function(){return K(e)},size:W(),style:{height:J(),width:J()}},e)})}()),c.default.createElement(s.Button,{disabled:w===R,onClick:function(){return K(w+1)},size:W()},c.default.createElement(h,{className:"w-4 h-4"}))),B&&c.default.createElement("div",{className:"flex items-center gap-2"},c.default.createElement("span",{className:"text-sm text-font"},"跳至"),c.default.createElement(d.Input.Number,{InputClassName:"p-0",className:"w-14 h-auto text-font",hiddenSvg:!0,max:R,min:1,onBlur:T,onKeyDown:function(e){"Enter"===e.key&&T(e)},style:{height:J()}}),c.default.createElement("span",{className:"text-sm text-font"},"页")))})},x=(0,c.memo)(E),N=i.t;export{N as Pagination};
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@itera-web/react-ui-pagination-push",
|
|
3
|
+
"description": "分页二次封装",
|
|
4
|
+
"version": "1.26.0",
|
|
5
|
+
"main": "es/index.js",
|
|
6
|
+
"types": "es/index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "itera-cli package",
|
|
13
|
+
"up": "npm publish"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@itera-web/react-ui-button": "^1.26.0",
|
|
17
|
+
"@itera-web/react-ui-conditionalrender": "^1.21.0",
|
|
18
|
+
"@itera-web/react-ui-input": "^1.25.0",
|
|
19
|
+
"@itera-web/react-ui-select": "^1.30.0",
|
|
20
|
+
"@itera-web/utils-cn": "^1.20.0",
|
|
21
|
+
"@itera-web/utils-locale-toggle": "^1.20.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": ">=17.0.0",
|
|
25
|
+
"react-dom": ">=17.0.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@itera-web/cli": "^1.1.45"
|
|
29
|
+
},
|
|
30
|
+
"gitHead": "03be639f55ed0f62801e6b0f109070a45fe5a661"
|
|
31
|
+
}
|