freemium-ui 1.0.191 → 1.0.192
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/lib/index.cjs.js +19 -19
- package/lib/index.esm.js +1 -1
- package/lib/types/components/Table/Table.d.ts +3 -1
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -1251,7 +1251,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
1251
1251
|
width: calc(100% + 12px);
|
|
1252
1252
|
opacity: ${e=>e.disabled?.7:1};
|
|
1253
1253
|
cursor: ${e=>e.disabled?"not-allowed":"pointer"};
|
|
1254
|
-
`;var Iv=Dt((t=>{const[n,r]=l(t.defaultSelectedValue);return h((()=>{r(t.defaultSelectedValue)}),[t.defaultSelectedValue]),e.createElement(_v.Provider,{value:{groupValue:n,groupDisabled:t.disabled,updateGroupValue:e=>{t.disabled||(r(e),t.onChange&&t.onChange(e))}}},e.createElement(Ov,{disabled:t.disabled,className:t.className},t.children))}),{disabled:!1,defaultSelectedValue:null,onChange:e=>{}});Dv.Group=Iv;const Nv=t=>{const{columns:n=[],data:r=[],count:a=0,perPage:o=10,pageNumber:c=1,indeterminateCount:i=!1,next:s=!1,previous:l=!1,showTopPagination:h=!0,showBottomPagination:p=!0,showSelectAllInTable:d=!1,showActions:u=!0,showSelections:m=!0,hideTableHeaderOnEmpty:v=!0,showFilters:f=!0,showOptions:g=!0,rowMenuOptions:b=(()=>[]),
|
|
1254
|
+
`;var Iv=Dt((t=>{const[n,r]=l(t.defaultSelectedValue);return h((()=>{r(t.defaultSelectedValue)}),[t.defaultSelectedValue]),e.createElement(_v.Provider,{value:{groupValue:n,groupDisabled:t.disabled,updateGroupValue:e=>{t.disabled||(r(e),t.onChange&&t.onChange(e))}}},e.createElement(Ov,{disabled:t.disabled,className:t.className},t.children))}),{disabled:!1,defaultSelectedValue:null,onChange:e=>{}});Dv.Group=Iv;const Nv=t=>{const{columns:n=[],data:r=[],count:a=0,perPage:o=10,pageNumber:c=1,indeterminateCount:i=!1,next:s=!1,previous:l=!1,showTopPagination:h=!0,showBottomPagination:p=!0,showSelectAllInTable:d=!1,showActions:u=!0,showSelections:m=!0,hideTableHeaderOnEmpty:v=!0,showFilters:f=!0,showOptions:g=!0,rowMenuOptions:b=(()=>[]),cellPropGetter:z,rowPropGetter:y,onRowSelect:M,onRowClick:x,emptyComponent:w,loadingComponent:H,onPrevious:V,onFirstClick:C,onLastClick:k,onPageClick:L,onSelectAll:E,onNext:S,onMenuOptionSelect:_,headerComponent:A,initialState:D={},filterComponent:O}=t,[I,N]=e.useState(f),[P,T]=e.useState(null),{getTableProps:R,getTableBodyProps:$,headerGroups:W,rows:U,setColumnOrder:K,setHiddenColumns:G,flatRows:q,prepareRow:Z,getToggleAllRowsSelectedProps:X}=F({columns:n,data:r,initialState:D,useControlledState:t=>e.useMemo((()=>({...t,selectedRowIds:D.selectedRowIds||{}})),[D.selectedRowIds,t])},j,Y,(t=>{t.visibleColumns.push((t=>m?[{id:"selection",disableResizing:!0,width:50,Header:({getToggleAllRowsSelectedProps:t,toggleAllRowsSelected:n})=>d?e.createElement("div",{className:"table-checkbox"},e.createElement(Bo,Object.assign({id:"selectAll",name:"selectAll"},t(),{onChange:(e,t)=>{if(t){const e={};U&&U.length>0&&U.forEach((t=>{e[t.id]=!0})),M&&M(e,q)}else M&&M({},q);E&&E(t),n(t)}}))):e.createElement("div",null),Cell:t=>{const{row:n}=t;return e.createElement("div",{className:"table-checkbox"},e.createElement(Bo,Object.assign({id:"selectRow",name:"selectRow"},n.getToggleRowSelectedProps(),{onChange:(e,t)=>{n.toggleRowSelected(t),M&&M({...D.selectedRowIds,[n.id]:t},q)}})))}},...t]:[...t]))})),J=[];for(let e=0;e<Math.ceil(a/o);e++)J.push(e+1);return B((()=>{D&&D.columnOrder&&K(D.columnOrder)}),[D.columnOrder]),B((()=>{D&&D.hiddenColumns&&G(D.hiddenColumns)}),[D.hiddenColumns]),e.createElement(Pv,{className:"fui-table"},u&&e.createElement(Rv,{className:"table-actions"},e.createElement("div",{className:"action"},!d&&m&&e.createElement(Bo,Object.assign({id:"selectAll",name:"selectAll"},X()),"Select All")),A||void 0,e.createElement("div",{className:"pagination-actions"},h&&e.createElement(e.Fragment,null,e.createElement("div",{className:"pagination-text"},H?e.createElement(Pl,{size:"small"}):e.createElement(e.Fragment,null,a>0?`${(c-1)*o+(r.length>0?1:0)} - ${(c-1)*o+r.length} of ${i?""+(r.length>0?"Many":"-"):a}`:null)),e.createElement(Fo,{type:"secondary",disabled:!l||Boolean(H),onClick:()=>V&&V(c-1)},e.createElement(er,{glyph:"chevron-left",size:12,viewBox:"0 0 6 8"})),e.createElement(Fo,{type:"secondary",disabled:!s||Boolean(H),onClick:()=>S&&S(c+1)},e.createElement(er,{glyph:"chevron-right",size:12,viewBox:"0 0 6 8"}))),f&&e.createElement(Fo,{type:"secondary",className:"filter-toggle",onClick:()=>N(!I)},e.createElement(er,{glyph:I?"collapse":"expand",size:12,viewBox:"0 0 14 14"}))))," ",e.createElement(Gv,{className:"table-content"},e.createElement(Tv,{showFilters:f&&I,className:"table-wrapper"},H?e.createElement(e.Fragment,null,H):e.createElement(e.Fragment,null,v&&0===U.length?e.createElement(e.Fragment,null,w):e.createElement(Fv,Object.assign({},R()),e.createElement(Bv,null,W.map((t=>{const{getHeaderGroupProps:n,headers:r}=t;return e.createElement(jv,Object.assign({},n(),{className:"header-row"}),r.map((t=>{const{getHeaderProps:n,render:r}=t;return e.createElement(Uv,Object.assign({},n()),r("Header"))})),g&&e.createElement(Uv,null))}))),e.createElement(Wv,Object.assign({},$()),U.length>0?U.map((t=>{Z(t);const{getRowProps:n,cells:r}=t;return e.createElement(jv,Object.assign({},n(y?y(t):{}),{className:t.isSelected?"selected":""}),r.map((t=>{const{getCellProps:n,render:r}=t;return e.createElement(Kv,Object.assign({},n(z?z(t):{}),{onClick:()=>{"selection"!==t.column.id&&x&&x(t.row,t.column)}}),r("Cell"))})),g&&e.createElement(Kv,null,b&&b(t.original).length>0&&e.createElement(e.Fragment,null,e.createElement(Zv,{"aria-describedby":`row-popover-${t.id}`,onClick:e=>T(e.currentTarget)},e.createElement(er,{glyph:"more-vertical",size:12,viewBox:"0 0 4 16"})),e.createElement($c,{id:`row-popover-${t.id}`,anchorEl:P,onClose:()=>T(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"right"}},e.createElement(sl,{options:b(t.original)||[],onSelect:e=>{_&&_(e.id,t.original),T(null)},closeMenuCallback:()=>T(null)})))))})):e.createElement(e.Fragment,null,w)),p&&e.createElement($v,null,e.createElement("tr",null,e.createElement("td",{colSpan:n.length-(D&&D.hiddenColumns&&D.hiddenColumns.length||0)+(m?1:0)+(b&&b().length>0?1:0)},e.createElement(Yv,{className:"table-pagination"},Math.ceil(a/o)>10&&e.createElement(Fo,{type:"secondary",disabled:1===c,onClick:()=>C&&C(1)},e.createElement(er,{glyph:"chevron-left",size:12,viewBox:"0 0 6 8"}),e.createElement(er,{glyph:"chevron-left",size:12,viewBox:"0 0 6 8"})),e.createElement(Fo,{type:"secondary",disabled:1===c,onClick:()=>V&&V(c-1)},e.createElement(er,{glyph:"chevron-left",size:12,viewBox:"0 0 6 8"})),c>3&&e.createElement(e.Fragment,null,e.createElement(Fo,{type:"secondary",onClick:()=>L&&L(1)},"1"),c-3!=1&&e.createElement(Fo,{type:"secondary",disabled:!0},"...")),J.map((t=>[t-2,t-1,t,t+1,t+2].includes(c)&&e.createElement(Fo,{type:"secondary",className:c===t?"active":"",onClick:()=>L&&L(t)},t))),c<Math.ceil(a/o)-2&&e.createElement(e.Fragment,null,c+3!==Math.ceil(a/o)&&e.createElement(Fo,{type:"secondary",disabled:!0},"..."),e.createElement(Fo,{type:"secondary",onClick:()=>L&&L(Math.ceil(a/o))},Math.ceil(a/o))),e.createElement(Fo,{type:"secondary",disabled:c===Math.ceil(a/o),onClick:()=>S&&S(c+1)},e.createElement(er,{glyph:"chevron-right",size:12,viewBox:"0 0 6 8"})),Math.ceil(a/o)>10&&e.createElement(Fo,{type:"secondary",disabled:c===Math.ceil(a/o),onClick:()=>k&&k(Math.ceil(a/o))},e.createElement(er,{glyph:"chevron-right",size:12,viewBox:"0 0 6 8"}),e.createElement(er,{glyph:"chevron-right",size:12,viewBox:"0 0 6 8"}))))))))),f&&I&&O&&e.createElement(qv,{className:"table-filters"},O)))},Pv=Et.div`
|
|
1255
1255
|
flex: 1;
|
|
1256
1256
|
overflow: auto;
|
|
1257
1257
|
`,Tv=Et.div`
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Column, TableState, Row, ColumnInstance, IdType } from 'react-table';
|
|
2
|
+
import { Column, TableState, Row, ColumnInstance, Cell, IdType, TableCommonProps } from 'react-table';
|
|
3
3
|
import FreemiumUIThemes from '../../theme';
|
|
4
4
|
declare type TableProps = {
|
|
5
|
+
cellPropGetter?: (cell: Cell) => TableCommonProps;
|
|
6
|
+
rowPropGetter?: (row: Row) => TableCommonProps;
|
|
5
7
|
onSelectAll?: (checked: boolean) => void;
|
|
6
8
|
onMenuOptionSelect?: (optionId: string, row: any) => void;
|
|
7
9
|
onPageClick?: (pageNumber: number) => void;
|