@bikdotai/bik-component-library 0.0.792 → 0.0.793
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/cjs/components/TablePagination/TablePagination.d.ts +7 -1
- package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
- package/dist/esm/components/TablePagination/TablePagination.d.ts +7 -1
- package/dist/esm/components/TablePagination/TablePagination.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../dropdown/type";
|
|
3
3
|
export type TablePaginationProps = {
|
|
4
|
-
pageSize:
|
|
4
|
+
pageSize: number;
|
|
5
5
|
pageNumber: number;
|
|
6
6
|
totalRows: number;
|
|
7
7
|
hidePageSizeOptions?: boolean;
|
|
@@ -11,5 +11,11 @@ export type TablePaginationProps = {
|
|
|
11
11
|
totalTextAlignment?: 'left' | 'right';
|
|
12
12
|
removeBorder?: boolean;
|
|
13
13
|
containerStyle?: React.CSSProperties;
|
|
14
|
+
/**
|
|
15
|
+
* Optional override for the rows-per-page dropdown options. Defaults to
|
|
16
|
+
* [5, 10, 20] to preserve existing behaviour. Pass e.g. [10, 50, 100] to
|
|
17
|
+
* widen the page size choices for large tables.
|
|
18
|
+
*/
|
|
19
|
+
pageSizeOptions?: number[];
|
|
14
20
|
};
|
|
15
21
|
export declare const TablePagination: React.FC<TablePaginationProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronLeft.svg.js"),o=require("../../assets/icons/chevronRight.svg.js");require("../dropdown/DropdownPopover/index.js");var n=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("react"),require("../zeroState/ZeroState.js");var r=require("../../constants/Theme.js");require("../../_virtual/_tslib.js"),require("lodash/debounce");var s=require("../TypographyStyle.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var i=require("./TablePagination.styled.js");const a=t=>{let{pageStart:o,pageEnd:n,totalRows:i,shouldShow:a}=t;if(!a)return null;const d=r.DEFAULT_THEME.colorsV2;return e.jsxs(s.BodySecondary,Object.assign({style:{color:d.content.placeholder}},{children:["Showing ",o,"-",n>i?i:n," of"," ",i," results"]}))};exports.TablePagination=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronLeft.svg.js"),o=require("../../assets/icons/chevronRight.svg.js");require("../dropdown/DropdownPopover/index.js");var n=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("react"),require("../zeroState/ZeroState.js");var r=require("../../constants/Theme.js");require("../../_virtual/_tslib.js"),require("lodash/debounce");var s=require("../TypographyStyle.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var i=require("./TablePagination.styled.js");const a=t=>{let{pageStart:o,pageEnd:n,totalRows:i,shouldShow:a}=t;if(!a)return null;const d=r.DEFAULT_THEME.colorsV2;return e.jsxs(s.BodySecondary,Object.assign({style:{color:d.content.placeholder}},{children:["Showing ",o,"-",n>i?i:n," of"," ",i," results"]}))},d=[5,10,20];exports.TablePagination=l=>{let{pageNumber:c,pageSize:p,totalRows:u,updatePageNumber:j,updatePageSize:g,hidePageSizeOptions:h,showTotalText:w,totalTextAlignment:m="right",containerStyle:y={},pageSizeOptions:q=d}=l;const x=r.DEFAULT_THEME.colorsV2,S=(c-1)*p+1,b=(c-1)*p+p,v=Math.ceil(u/p),O=1==v;let D=[];D=v>=5?c===v?[c-4,c-3,c-2,c-1,c]:1===c?[c,c+1,c+2,c+3,c+4]:2===c?[c-1,c,c+1,c+2,c+3]:c===v-1?[c-3,c-2,c-1,c,c+1]:[c-2,c-1,c,c+1,c+2]:Array.from({length:v},((e,t)=>t+1));const M=q.map((e=>({label:`${e} rows per page`,value:String(e),selected:p===e})));return e.jsxs(i.StyledTablePaginationContainer,Object.assign({style:y},{children:[!h&&e.jsx("div",{children:e.jsx(n.Dropdown,{size:"small",options:M,onSelect:g,width:"162px"})}),e.jsxs("div",Object.assign({className:"paging__container"},{children:[e.jsx(a,{pageStart:S,pageEnd:b,totalRows:u,shouldShow:!!(!h&&u>0||h&&u>0&&w&&"left"===m)}),e.jsxs("div",Object.assign({className:"pages__buttons-container"},{children:[!O&&e.jsx(i.StyledPagingContainer,Object.assign({active:!1,onClick:()=>{1!==c&&j(Math.max(c-1,1))},disabled:1===c},{children:e.jsx(t.default,{color:x.content.secondary,height:14,width:14})})),D.map((t=>e.jsx(i.StyledPagingContainer,Object.assign({active:t==c,onClick:()=>j(t),style:{display:1==t&&u<=p?"none":"flex"}},{children:e.jsx(s.BodySecondary,Object.assign({style:{color:t==c?x.content.primaryInverse:x.content.secondary}},{children:t}))}),t))),!O&&e.jsx(i.StyledPagingContainer,Object.assign({isLast:!0,active:!1,onClick:()=>{c!==v&&j(Math.min(c+1,v))},disabled:c===v},{children:e.jsx(o.default,{color:x.content.secondary,height:14,width:14})}))]})),e.jsx(a,{pageStart:S,pageEnd:b,totalRows:u,shouldShow:!!(h&&u>0&&w&&"right"===m)})]}))]}))};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../dropdown/type";
|
|
3
3
|
export type TablePaginationProps = {
|
|
4
|
-
pageSize:
|
|
4
|
+
pageSize: number;
|
|
5
5
|
pageNumber: number;
|
|
6
6
|
totalRows: number;
|
|
7
7
|
hidePageSizeOptions?: boolean;
|
|
@@ -11,5 +11,11 @@ export type TablePaginationProps = {
|
|
|
11
11
|
totalTextAlignment?: 'left' | 'right';
|
|
12
12
|
removeBorder?: boolean;
|
|
13
13
|
containerStyle?: React.CSSProperties;
|
|
14
|
+
/**
|
|
15
|
+
* Optional override for the rows-per-page dropdown options. Defaults to
|
|
16
|
+
* [5, 10, 20] to preserve existing behaviour. Pass e.g. [10, 50, 100] to
|
|
17
|
+
* widen the page size choices for large tables.
|
|
18
|
+
*/
|
|
19
|
+
pageSizeOptions?: number[];
|
|
14
20
|
};
|
|
15
21
|
export declare const TablePagination: React.FC<TablePaginationProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as o,jsx as t}from"react/jsx-runtime";import e from"../../assets/icons/chevronLeft.svg.js";import n from"../../assets/icons/chevronRight.svg.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as r}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"react";import"../zeroState/ZeroState.js";import{DEFAULT_THEME as s}from"../../constants/Theme.js";import"../../_virtual/_tslib.js";import"lodash/debounce";import{BodySecondary as i}from"../TypographyStyle.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledTablePaginationContainer as p,StyledPagingContainer as d}from"./TablePagination.styled.js";const a=t=>{let{pageStart:e,pageEnd:n,totalRows:r,shouldShow:p}=t;if(!p)return null;const d=s.colorsV2;return o(i,Object.assign({style:{color:d.content.placeholder}},{children:["Showing ",e,"-",n>r?r:n," of"," ",r," results"]}))},l=[5,10,20],c=c=>{let{pageNumber:m,pageSize:h,totalRows:g,updatePageNumber:w,updatePageSize:u,hidePageSizeOptions:j,showTotalText:y,totalTextAlignment:b="right",containerStyle:S={},pageSizeOptions:O=l}=c;const v=s.colorsV2,f=(m-1)*h+1,D=(m-1)*h+h,x=Math.ceil(g/h),M=1==x;let I=[];I=x>=5?m===x?[m-4,m-3,m-2,m-1,m]:1===m?[m,m+1,m+2,m+3,m+4]:2===m?[m-1,m,m+1,m+2,m+3]:m===x-1?[m-3,m-2,m-1,m,m+1]:[m-2,m-1,m,m+1,m+2]:Array.from({length:x},((o,t)=>t+1));const z=O.map((o=>({label:`${o} rows per page`,value:String(o),selected:h===o})));return o(p,Object.assign({style:S},{children:[!j&&t("div",{children:t(r,{size:"small",options:z,onSelect:u,width:"162px"})}),o("div",Object.assign({className:"paging__container"},{children:[t(a,{pageStart:f,pageEnd:D,totalRows:g,shouldShow:!!(!j&&g>0||j&&g>0&&y&&"left"===b)}),o("div",Object.assign({className:"pages__buttons-container"},{children:[!M&&t(d,Object.assign({active:!1,onClick:()=>{1!==m&&w(Math.max(m-1,1))},disabled:1===m},{children:t(e,{color:v.content.secondary,height:14,width:14})})),I.map((o=>t(d,Object.assign({active:o==m,onClick:()=>w(o),style:{display:1==o&&g<=h?"none":"flex"}},{children:t(i,Object.assign({style:{color:o==m?v.content.primaryInverse:v.content.secondary}},{children:o}))}),o))),!M&&t(d,Object.assign({isLast:!0,active:!1,onClick:()=>{m!==x&&w(Math.min(m+1,x))},disabled:m===x},{children:t(n,{color:v.content.secondary,height:14,width:14})}))]})),t(a,{pageStart:f,pageEnd:D,totalRows:g,shouldShow:!!(j&&g>0&&y&&"right"===b)})]}))]}))};export{c as TablePagination};
|