@vitorlans/react-table-ui
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -1,2 +0,2 @@ | ||
import{createElement as oe,useImperativeHandle as Sa,useRef as ha}from"react";import{useMemo as oo}from"react";import{useTable as ao,useSortBy as no,useFilters as ro,usePagination as so,useRowSelect as io,useExpanded as lo,useColumnOrder as co,useResizeColumns as po,useGlobalFilter as mo,useRowState as uo,useFlexLayout as go}from"react-table";import{useSticky as fo}from"react-table-sticky";import{createElement as Pt}from"react";var xe=({column:{filterValue:e,setFilter:t,render:o}})=>{let a=o("Header"),n=typeof a=="string"?a:"";return Pt("input",{type:"search",value:e||"",onChange:r=>t(r.target.value||void 0),placeholder:`Filter ${n}`})};var Ot={id:"selection",order:-2},vt={id:"expander",order:-1},It={id:"action",order:1},ne={selection:Ot,expander:vt,action:It},Ce=Object.values(ne).map(e=>e.id),kt=Object.values(ne).filter(({order:e})=>e<0).sort((e,t)=>e.order-t.order).map(({id:e})=>e),Ut=Object.values(ne).filter(({order:e})=>e>0).sort((e,t)=>e.order-t.order).map(({id:e})=>e),ee=e=>Ce.includes(typeof e=="string"?e:e.placeholderOf?.id||e.id),Te=(e=[],t)=>{let o=e.filter(n=>!Ce.includes(n)),a=t.filter(({id:n,accessor:r})=>!o.some(s=>s===n||s===r)).map(({id:n,accessor:r})=>n||r);return[...kt,...o,...a,...Ut]},z=ne;var U=()=>{};import{createElement as Se}from"react";var $t=e=>{let{collapsedIndicator:t="\u2192",expandedIndicator:o="\u2193"}=e.expandedOptions||{},a=!e.data.some(i=>i.subRows?.length||i.subComponent),n=({getToggleAllRowsExpandedProps:i,isAllRowsExpanded:l})=>Se("span",{...i()},l?o:t),r=({row:i})=>i.canExpand||i.original.subComponent?Se("span",{...i.getToggleRowExpandedProps({style:{paddingLeft:`${i.depth}rem`}})},i.isExpanded?o:t):null,s={id:z.expander.id,sticky:z.expander.order<0?"left":"right",minWidth:50,maxWidth:50,Header:n,Cell:r,disableResizing:!0};return{useExpandedColumn:i=>{i.visibleColumns.push(l=>[s,...l])},disableExpander:a}},he=$t;import{createElement as re,forwardRef as Et,useEffect as Bt,useRef as Ht}from"react";var Nt=Et(({indeterminate:e=!1,...t},o)=>{let a=Ht(null),n=o||a;return Bt(()=>{typeof n!="function"&&n?.current&&(n.current.indeterminate=e)},[n,e]),re("div",{className:"RowSelectCheckbox"},re("input",{className:"checkbox",type:"checkbox",ref:n,...t}))}),At=e=>{let{Component:t=Nt,selectSubRows:o=!1}=e.rowSelectOptions||{},a=({getToggleAllRowsSelectedProps:r})=>re(t,{...r()}),n=({row:r})=>r.depth>0&&!o?null:re(t,{...r.getToggleRowSelectedProps()});return r=>{r.visibleColumns.push(s=>[{id:z.selection.id,sticky:z.selection.order<0?"left":"right",minWidth:48,maxWidth:48,Header:a,Cell:n,disableResizing:!0,disableFilters:!0,disableGlobalFilter:!0,disableGroupBy:!0,disableSortBy:!0},...s])}},De=At;import{createElement as Y}from"react";import{useState as Mt,useEffect as Gt}from"react";var Lt=e=>{let[t,o]=Mt(null);switch(Gt(()=>{let a=!0,n=r=>a&&o(r);switch(e){case"menu":import("@reach/menu-button").then(n).catch(console.error);break}return()=>{a=!1}},[e]),e){case"menu":return t;default:return null}},se=Lt;var zt=({actions:e,row:t})=>{let o=se("menu");if(!o)return null;let{Menu:a,MenuButton:n,MenuList:r,MenuItem:s}=o;return Y(a,null,Y(n,{className:"Button RowAction",title:"Action"},Y("div",{className:"button-content"},"\u2022\u2022\u2022")),Y(r,null,e.map(i=>Y(s,{key:i.id,onSelect:()=>i.onClick(t.original,t),about:i.tooltip},i.children))))},Vt=e=>{let{singleRowActions:t=[]}=e.actionOptions||{},o=({row:a})=>Y(zt,{actions:t,row:a});return a=>{t.length>0&&a.visibleColumns.push(n=>[...n,{id:z.action.id,sticky:z.action.order<0?"left":"right",minWidth:48,maxWidth:48,Header:"",Cell:o,disableResizing:!0,disableFilters:!0,disableGlobalFilter:!0,disableGroupBy:!0,disableSortBy:!0}])}},Re=Vt;import{useEffect as jt}from"react";var Xt=({tableInstance:{state:{pageSize:e,pageIndex:t}},tableProps:{paginationOptions:o={}}})=>{let{disablePagination:a,manualPagination:n,fetchData:r}=o;o.manualPagination,jt(()=>{!a&&n&&r&&r({pageIndex:t,pageSize:e})},[r,t,e,a,n])},we=Xt;import{useEffect as $}from"react";var Jt=({tableInstance:{state:e},tableProps:{tableOptions:t,sortByOptions:o,filtersOptions:a,expandedOptions:n,rowSelectOptions:r,paginationOptions:s,columnOptions:i,globalFilterOptions:l}})=>{let{expanded:d,selectedRowIds:m,sortBy:f,filters:C,pageIndex:T,pageSize:R,rowState:O,columnOrder:S,globalFilter:v,groupBy:w,columnResizing:I,hiddenColumns:F=[],filtersVisible:H}=e,P={onStateChange:j=>{}},L={onStateChange:j=>{}};$(()=>{t?.onStateChange?.(e)},[t?.onStateChange,e]),$(()=>{o?.onStateChange&&o?.onStateChange({sortBy:f})},[o?.onStateChange,f]),$(()=>{a?.onStateChange?.({filters:C,filtersVisible:H})},[a?.onStateChange,C,H]),$(()=>{l?.onStateChange?.({globalFilter:v})},[l?.onStateChange,v]),$(()=>{n?.onStateChange?.({expanded:d})},[n?.onStateChange,d]),$(()=>{r?.onStateChange?.({selectedRowIds:m})},[r?.onStateChange,m]),$(()=>{P?.onStateChange?.({rowState:O})},[P?.onStateChange,O]),$(()=>{L?.onStateChange?.({groupBy:w})},[L?.onStateChange,w]),$(()=>{s?.onStateChange?.({pageIndex:T,pageSize:R})},[s?.onStateChange,T,R]),$(()=>{i?.onStateChange?.({columnOrder:S,columnResizing:I,hiddenColumns:F})},[i?.onStateChange,S,I,F]),$(()=>{i?.onOrderStateChange?.(S)},[i?.onOrderStateChange,S]),$(()=>{i?.onResizeStateChange?.(I)},[i?.onResizeStateChange,I]),$(()=>{i?.onVisibilityStateChange?.(F)},[i?.onVisibilityStateChange,F])},Fe=Jt;import{useMemo as Wt}from"react";var Kt=e=>e.slice(0,1).toUpperCase()+e.slice(1),Yt=e=>Wt(()=>Object.keys(Object.assign({},...e)).filter(o=>!["subRows","subComponent"].includes(o)).map(o=>({accessor:o,Header:Kt(o)})),[e]),Pe=Yt;import{useCallback as pe}from"react";import{ensurePluginOrder as _t}from"react-table";var Oe="useFiltersVisible",J={init:"init",setFiltersVisible:"setFiltersVisible",resetFiltersVisible:"resetFiltersVisible",toggleFiltersVisible:"toggleFiltersVisible"},qt=(e,t,o,a)=>{if(a?.disableFilters)return{...e,filtersVisible:!1};if(a?.alwaysShowFilters)return{...e,filtersVisible:!0};switch(t.type){case J.init:case J.resetFiltersVisible:return{filtersVisible:a?.initialState?.filtersVisible||!1,...e};case J.setFiltersVisible:return{...e,filtersVisible:!!t.filtersVisible};case J.toggleFiltersVisible:return{...e,filtersVisible:!o?.filtersVisible};default:return e}},Qt=e=>{let{dispatch:t,plugins:o}=e;_t(o,["useFilters"],Oe);let a=pe(s=>{t({type:J.setFiltersVisible,filtersVisible:s}),t({type:"resetFilters"})},[t]),n=pe(()=>{t({type:J.resetFiltersVisible}),t({type:"resetFilters"})},[t]),r=pe(()=>{t({type:J.toggleFiltersVisible}),t({type:"resetFilters"})},[t]);Object.assign(e,{setFiltersVisible:a,resetFiltersVisible:n,toggleFiltersVisible:r})};function ve(e){e.stateReducers.push(qt),e.useInstance.push(Qt)}ve.pluginName=Oe;var Ie=ve;import{useCallback as ke}from"react";import{ensurePluginOrder as Zt}from"react-table";var Ue="useModal",te={init:"init",setModal:"setModal",resetModal:"resetModal"},eo=(e,t,o,a)=>{switch(t.type){case te.init:return{modal:a?.initialState?.modal,...e};case te.resetModal:return{...e,modal:void 0};case te.setModal:return{...e,modal:t.modal};default:return e}},to=e=>{let{dispatch:t,plugins:o}=e;Zt(o,["useFilters"],Ue);let a=ke(r=>{t({type:te.setModal,modal:r})},[t]),n=ke(()=>{t({type:te.resetModal})},[t]);Object.assign(e,{setModal:a,resetModal:n})};function $e(e){e.stateReducers.push(eo),e.useInstance.push(to)}$e.pluginName=Ue;var Ee=$e;var bo=(e,t)=>{let{data:o=[],columns:a=Pe(o),tableOptions:n={},filtersOptions:r={},globalFilterOptions:s={},sortByOptions:i={},paginationOptions:l={},expandedOptions:d={},rowSelectOptions:m={},columnOptions:f={},rowStateOptions:C={},freezeOptions:{columns:T=!0}={}}=e,{initialState:R,DefaultComponent:O,...S}=r,{initialState:v,...w}=s,{initialState:I,...F}=i,{initialState:H,...P}=d,{initialState:L,...j}=m,{initialState:Q,...Z}=l,{initialState:ae,...Tt}=f,{initialState:St,...ht}=C,Dt=oo(()=>({Filter:O||xe}),[]),Rt=De(e),wt=Re(e),{useExpandedColumn:Ft,disableExpander:ye}=he(e),ce={tableInstance:ao({data:o,columns:a,defaultColumn:Dt,...n,...S,...w,...F,autoResetPage:!Z.manualPagination,...Z,...P,...j,...Tt,...ht,initialState:{...n?.initialState||{},...I,...R,...v,...H,...L,...St,pageSize:50,pageIndex:0,...Q,...ae,columnOrder:Te(ae?.columnOrder,a)}},r.disableFilters?U:ro,s.disableGlobalFilter?U:mo,i.disableSortBy?U:no,ye?U:lo,ye?U:Ft,l.disablePagination?U:so,m.disableRowSelect?U:io,m.disableRowSelect?U:Rt,C.disableRowState?U:uo,f.disableOrdering?U:co,f.disableResizing?U:po,wt,go,Ie,Ee,T?fo:U),tableProps:e,tableRef:t};return we(ce),Fe(ce),ce},Be=bo;import{useEffect as Fo}from"react";var k="RTUI",de=(...e)=>[...e].join(" "),g=de;var W=e=>(t,...o)=>{let a="";for(let r=0;r<o.length;r++)a+=t[r],a+=o[r];a+=t[t.length-1];let n=[k,e].filter(r=>!!r).map(r=>`.${r}`).join(" ");return a.replaceAll("&",n)};W.div=W("");W.rtui=W("RTUI");W.table=W("Table");var b=W;import Ae from"react";var me=e=>["primary","secondary","disabled","inverse","selected","none"].reduce((t,o)=>({...t,[o]:`var(--${k}-color-${e}-${o})`}),{}),He=e=>["none","xs","sm","md","lg","xl"].reduce((t,o)=>({...t,[o]:`var(--${k}-${e}-${o})`}),{}),y=e=>e/16+"em",c={text:me("text"),background:me("background"),border:me("border"),accent:{default:`var(--${k}-color-accent-default)`,lighter:`var(--${k}-color-accent-lighter)`,darker:`var(--${k}-color-accent-darker)`}},u=He("spacing"),E=He("radius"),ue={mobile:"@media (max-width: 600px)"},N={default:`1px solid ${c.border.primary}`},Ne=` | ||
import{createElement as oe,useImperativeHandle as Sa,useRef as ha}from"react";import{useMemo as oo}from"react";import{useTable as ao,useSortBy as no,useFilters as ro,usePagination as so,useRowSelect as io,useExpanded as lo,useColumnOrder as co,useResizeColumns as po,useGlobalFilter as mo,useRowState as uo,useFlexLayout as go}from"react-table";import{useSticky as fo}from"react-table-sticky";import{createElement as Pt}from"react";var Ce=({column:{filterValue:e,setFilter:t,render:o}})=>{let a=o("Header"),n=typeof a=="string"?a:"";return Pt("input",{type:"search",value:e||"",onChange:r=>t(r.target.value||void 0),placeholder:`Filter ${n}`})};var Ot={id:"selection",order:-2},vt={id:"expander",order:-1},It={id:"action",order:1},ne={selection:Ot,expander:vt,action:It},Te=Object.values(ne).map(e=>e.id),kt=Object.values(ne).filter(({order:e})=>e<0).sort((e,t)=>e.order-t.order).map(({id:e})=>e),Ut=Object.values(ne).filter(({order:e})=>e>0).sort((e,t)=>e.order-t.order).map(({id:e})=>e),ee=e=>Te.includes(typeof e=="string"?e:e.placeholderOf?.id||e.id),Se=(e=[],t)=>{let o=e.filter(n=>!Te.includes(n)),a=t.filter(({id:n,accessor:r})=>!o.some(s=>s===n||s===r)).map(({id:n,accessor:r})=>n||r);return[...kt,...o,...a,...Ut]},z=ne;var U=()=>{};import{createElement as he}from"react";var $t=e=>{let{collapsedIndicator:t="\u2192",expandedIndicator:o="\u2193"}=e.expandedOptions||{},a=!e.data.some(i=>i.subRows?.length||i.subComponent),n=({getToggleAllRowsExpandedProps:i,isAllRowsExpanded:l})=>he("span",{...i()},l?o:t),r=({row:i})=>i.canExpand||i.original.subComponent?he("span",{...i.getToggleRowExpandedProps({style:{paddingLeft:`${i.depth}rem`}})},i.isExpanded?o:t):null,s={id:z.expander.id,sticky:z.expander.order<0?"left":"right",minWidth:50,maxWidth:50,Header:n,Cell:r,disableResizing:!0};return{useExpandedColumn:i=>{i.visibleColumns.push(l=>[s,...l])},disableExpander:a}},De=$t;import{createElement as re,forwardRef as Et,useEffect as Bt,useRef as Ht}from"react";var Nt=Et(({indeterminate:e=!1,...t},o)=>{let a=Ht(null),n=o||a;return Bt(()=>{typeof n!="function"&&n?.current&&(n.current.indeterminate=e)},[n,e]),re("div",{className:"RowSelectCheckbox"},re("input",{className:"checkbox",type:"checkbox",ref:n,...t}))}),At=e=>{let{Component:t=Nt,selectSubRows:o=!1}=e.rowSelectOptions||{},a=({getToggleAllRowsSelectedProps:r})=>re(t,{...r()}),n=({row:r})=>r.depth>0&&!o?null:re(t,{...r.getToggleRowSelectedProps()});return r=>{r.visibleColumns.push(s=>[{id:z.selection.id,sticky:z.selection.order<0?"left":"right",minWidth:48,maxWidth:48,Header:a,Cell:n,disableResizing:!0,disableFilters:!0,disableGlobalFilter:!0,disableGroupBy:!0,disableSortBy:!0},...s])}},Re=At;import{createElement as _}from"react";import{useState as Mt,useEffect as Gt}from"react";var Lt=e=>{let[t,o]=Mt(null);switch(Gt(()=>{let a=!0,n=r=>a&&o(r);switch(e){case"menu":import("@reach/menu-button").then(n).catch(console.error);break}return()=>{a=!1}},[e]),e){case"menu":return t;default:return null}},se=Lt;var zt=({actions:e,row:t})=>{let o=se("menu");if(!o)return null;let{Menu:a,MenuButton:n,MenuList:r,MenuItem:s}=o;return _(a,null,_(n,{className:"Button RowAction",title:"Action"},_("div",{className:"button-content"},"\u2022\u2022\u2022")),_(r,null,e.map(i=>_(s,{key:i.id,onSelect:()=>i.onClick(t.original,t),about:i.tooltip},i.children))))},Vt=e=>{let{singleRowActions:t=[]}=e.actionOptions||{},o=({row:a})=>_(zt,{actions:t,row:a});return a=>{t.length>0&&a.visibleColumns.push(n=>[...n,{id:z.action.id,sticky:z.action.order<0?"left":"right",minWidth:48,maxWidth:48,Header:"",Cell:o,disableResizing:!0,disableFilters:!0,disableGlobalFilter:!0,disableGroupBy:!0,disableSortBy:!0}])}},we=Vt;import{useEffect as jt}from"react";var Xt=({tableInstance:{state:{pageSize:e,pageIndex:t}},tableProps:{paginationOptions:o={}}})=>{let{disablePagination:a,manualPagination:n,fetchData:r}=o;o.manualPagination,jt(()=>{!a&&n&&r&&r({pageIndex:t,pageSize:e})},[r,t,e,a,n])},Fe=Xt;import{useEffect as $}from"react";var Jt=({tableInstance:{state:e},tableProps:{tableOptions:t,sortByOptions:o,filtersOptions:a,expandedOptions:n,rowSelectOptions:r,paginationOptions:s,columnOptions:i,globalFilterOptions:l}})=>{let{expanded:d,selectedRowIds:m,sortBy:f,filters:C,pageIndex:S,pageSize:R,rowState:O,columnOrder:T,globalFilter:v,groupBy:w,columnResizing:I,hiddenColumns:F=[],filtersVisible:H}=e,P={onStateChange:j=>{}},L={onStateChange:j=>{}};$(()=>{t?.onStateChange?.(e)},[t?.onStateChange,e]),$(()=>{o?.onStateChange&&o?.onStateChange({sortBy:f})},[o?.onStateChange,f]),$(()=>{a?.onStateChange?.({filters:C,filtersVisible:H})},[a?.onStateChange,C,H]),$(()=>{l?.onStateChange?.({globalFilter:v})},[l?.onStateChange,v]),$(()=>{n?.onStateChange?.({expanded:d})},[n?.onStateChange,d]),$(()=>{r?.onStateChange?.({selectedRowIds:m})},[r?.onStateChange,m]),$(()=>{P?.onStateChange?.({rowState:O})},[P?.onStateChange,O]),$(()=>{L?.onStateChange?.({groupBy:w})},[L?.onStateChange,w]),$(()=>{s?.onStateChange?.({pageIndex:S,pageSize:R})},[s?.onStateChange,S,R]),$(()=>{i?.onStateChange?.({columnOrder:T,columnResizing:I,hiddenColumns:F})},[i?.onStateChange,T,I,F]),$(()=>{i?.onOrderStateChange?.(T)},[i?.onOrderStateChange,T]),$(()=>{i?.onResizeStateChange?.(I)},[i?.onResizeStateChange,I]),$(()=>{i?.onVisibilityStateChange?.(F)},[i?.onVisibilityStateChange,F])},Pe=Jt;import{useMemo as Wt}from"react";var Kt=e=>e.slice(0,1).toUpperCase()+e.slice(1),Yt=e=>Wt(()=>Object.keys(Object.assign({},...e)).filter(o=>!["subRows","subComponent"].includes(o)).map(o=>({accessor:o,Header:Kt(o)})),[e]),Oe=Yt;import{useCallback as de}from"react";import{ensurePluginOrder as _t}from"react-table";var ve="useFiltersVisible",J={init:"init",setFiltersVisible:"setFiltersVisible",resetFiltersVisible:"resetFiltersVisible",toggleFiltersVisible:"toggleFiltersVisible"},qt=(e,t,o,a)=>{if(a?.disableFilters)return{...e,filtersVisible:!1};if(a?.alwaysShowFilters)return{...e,filtersVisible:!0};switch(t.type){case J.init:case J.resetFiltersVisible:return{filtersVisible:a?.initialState?.filtersVisible||!1,...e};case J.setFiltersVisible:return{...e,filtersVisible:!!t.filtersVisible};case J.toggleFiltersVisible:return{...e,filtersVisible:!o?.filtersVisible};default:return e}},Qt=e=>{let{dispatch:t,plugins:o}=e;_t(o,["useFilters"],ve);let a=de(s=>{t({type:J.setFiltersVisible,filtersVisible:s}),t({type:"resetFilters"})},[t]),n=de(()=>{t({type:J.resetFiltersVisible}),t({type:"resetFilters"})},[t]),r=de(()=>{t({type:J.toggleFiltersVisible}),t({type:"resetFilters"})},[t]);Object.assign(e,{setFiltersVisible:a,resetFiltersVisible:n,toggleFiltersVisible:r})};function Ie(e){e.stateReducers.push(qt),e.useInstance.push(Qt)}Ie.pluginName=ve;var ke=Ie;import{useCallback as Ue}from"react";import{ensurePluginOrder as Zt}from"react-table";var $e="useModal",te={init:"init",setModal:"setModal",resetModal:"resetModal"},eo=(e,t,o,a)=>{switch(t.type){case te.init:return{modal:a?.initialState?.modal,...e};case te.resetModal:return{...e,modal:void 0};case te.setModal:return{...e,modal:t.modal};default:return e}},to=e=>{let{dispatch:t,plugins:o}=e;Zt(o,["useFilters"],$e);let a=Ue(r=>{t({type:te.setModal,modal:r})},[t]),n=Ue(()=>{t({type:te.resetModal})},[t]);Object.assign(e,{setModal:a,resetModal:n})};function Ee(e){e.stateReducers.push(eo),e.useInstance.push(to)}Ee.pluginName=$e;var Be=Ee;var bo=(e,t)=>{let{data:o=[],columns:a=Oe(o),tableOptions:n={},filtersOptions:r={},globalFilterOptions:s={},sortByOptions:i={},paginationOptions:l={},expandedOptions:d={},rowSelectOptions:m={},columnOptions:f={},rowStateOptions:C={},freezeOptions:{columns:S=!0}={}}=e,{initialState:R,DefaultComponent:O,...T}=r,{initialState:v,...w}=s,{initialState:I,...F}=i,{initialState:H,...P}=d,{initialState:L,...j}=m,{initialState:Y,...ae}=l,{initialState:Z,...ce}=f,{initialState:St,...ht}=C,Dt=oo(()=>({Filter:O||Ce}),[]),Rt=Re(e),wt=we(e),{useExpandedColumn:Ft,disableExpander:xe}=De(e),pe={tableInstance:ao({data:o,columns:a,defaultColumn:Dt,...n,...T,...w,...F,autoResetPage:!ae.manualPagination,...ae,...P,...j,...ce,...ht,initialState:{...n?.initialState||{},...I,...R,...v,...H,...L,...St,pageSize:50,pageIndex:0,...Y,...Z,columnOrder:Se(Z?.columnOrder,a)}},r.disableFilters?U:ro,s.disableGlobalFilter?U:mo,i.disableSortBy?U:no,xe?U:lo,xe?U:Ft,l.disablePagination?U:so,m.disableRowSelect?U:io,m.disableRowSelect?U:Rt,C.disableRowState?U:uo,f.disableOrdering?U:co,f.disableResizing?U:po,wt,go,ke,Be,S?fo:U),tableProps:e,tableRef:t};return Fe(pe),Pe(pe),pe},He=bo;import{useEffect as Fo}from"react";var k="RTUI",me=(...e)=>[...e].join(" "),g=me;var W=e=>(t,...o)=>{let a="";for(let r=0;r<o.length;r++)a+=t[r],a+=o[r];a+=t[t.length-1];let n=[k,e].filter(r=>!!r).map(r=>`.${r}`).join(" ");return a.replaceAll("&",n)};W.div=W("");W.rtui=W("RTUI");W.table=W("Table");var b=W;import Me from"react";var ue=e=>["primary","secondary","disabled","inverse","selected","none"].reduce((t,o)=>({...t,[o]:`var(--${k}-color-${e}-${o})`}),{}),Ne=e=>["none","xs","sm","md","lg","xl"].reduce((t,o)=>({...t,[o]:`var(--${k}-${e}-${o})`}),{}),y=e=>e/16+"em",c={text:ue("text"),background:ue("background"),border:ue("border"),accent:{default:`var(--${k}-color-accent-default)`,lighter:`var(--${k}-color-accent-lighter)`,darker:`var(--${k}-color-accent-darker)`}},u=Ne("spacing"),E=Ne("radius"),ge={mobile:"@media (max-width: 600px)"},N={default:`1px solid ${c.border.primary}`},Ae=` | ||
width: 100%; | ||
@@ -7,3 +7,3 @@ height: 100%; | ||
justify-content: center; | ||
`;var Me=b("Button")` | ||
`;var Ge=b("Button")` | ||
& { | ||
@@ -49,3 +49,3 @@ background: none; | ||
} | ||
`,yo=({children:e,className:t="",...o})=>Ae.createElement("button",{...o,className:g("Button",t)},Ae.createElement("div",{className:"button-content"},e)),D=yo;import{createElement as xo,forwardRef as Co}from"react";var Ge=b("td")` | ||
`,yo=({children:e,className:t="",...o})=>Me.createElement("button",{...o,className:g("Button",t)},Me.createElement("div",{className:"button-content"},e)),D=yo;import{createElement as xo,forwardRef as Co}from"react";var Le=b("td")` | ||
&, | ||
@@ -89,3 +89,3 @@ .th { | ||
} | ||
`,Le=b.div` | ||
`,ze=b.div` | ||
& input[type='search'], | ||
@@ -116,3 +116,3 @@ & input[type='text'], | ||
${So} | ||
`;var ze=b("StatusBar")` | ||
`;var Ve=b("StatusBar")` | ||
& { | ||
@@ -186,3 +186,3 @@ display: flex; | ||
} | ||
`,Ve=b.div` | ||
`,je=b.div` | ||
&, | ||
@@ -227,3 +227,3 @@ & * { | ||
${ze} | ||
${Ve} | ||
${ho} | ||
@@ -347,3 +347,3 @@ `;var Do=b("THead")` | ||
} | ||
`,je=b.table` | ||
`,Xe=b.table` | ||
& { | ||
@@ -366,3 +366,3 @@ position: relative; | ||
& .RowSelectCheckbox { | ||
${Ne} | ||
${Ae} | ||
} | ||
@@ -407,3 +407,3 @@ | ||
} | ||
`;var Xe=b("TitleBar")` | ||
`;var Je=b("TitleBar")` | ||
& { | ||
@@ -423,3 +423,3 @@ width: 100%; | ||
${ue.mobile} { | ||
${ge.mobile} { | ||
& { | ||
@@ -474,3 +474,3 @@ height: auto; | ||
${ue.mobile} { | ||
${ge.mobile} { | ||
& .TableActions { | ||
@@ -507,3 +507,3 @@ position: initial; | ||
} | ||
`;var Je=b.div` | ||
`;var We=b.div` | ||
:root { | ||
@@ -572,10 +572,10 @@ --reach-menu-button: 1; | ||
`;var wo=b.rtui` | ||
${Ve} | ||
${Le} | ||
${je} | ||
${ze} | ||
${We} | ||
${Ge} | ||
${Je} | ||
${Me} | ||
${Xe} | ||
${je} | ||
${Ge} | ||
`,We=wo;var Po=(e="")=>{Fo(()=>{let t=de("styles"),o=document.getElementById(t),a=document.createElement("style");a.id=t;let n=o||a;return n.innerHTML=e+" "+We,o||document.head.insertAdjacentElement("afterbegin",n),()=>{n&&document.head.removeChild(n)}},[])},Ke=Po;var Ye=(...e)=>{let t={},o=a=>{for(let n in a)a.hasOwnProperty(n)&&(Object.prototype.toString.call(a[n])==="[object Object]"?t[n]=Ye(t[n],a[n]):t[n]=a[n])};for(let a=0;a<e.length;a++)o(e[a]);return t},_e=Ye;var ie={default:"#096ED1",lighter:"#F2F9FF",darker:""},Oo={colors:{accent:ie,text:{primary:"#1a1a1a",secondary:"#404040",disabled:"#808080",inverse:"#ffffff",selected:ie.default,none:"transparent"},background:{primary:"#ffffff",secondary:"#f7f7f7",disabled:"#eeeeee",selected:ie.lighter,inverse:"#000000",none:"transparent"},border:{primary:"#bfbfbf",selected:ie.default,inverse:"#1a1a1a",none:"transparent"}},spacing:{none:0,xs:2,sm:4,md:8,lg:12,xl:16}},vo=({styleOptions:{roundedCorners:e=!0,theme:t={}}={}})=>{let o=_e(Oo,t),a="";Object.entries(o.colors||{}).forEach(([i,l])=>{Object.entries(l||{}).forEach(([d,m])=>{m&&(a+=`--${k}-color-${i}-${d}: ${m}; | ||
${Le} | ||
`,Ke=wo;var Po=(e="")=>{Fo(()=>{let t=me("styles"),o=document.getElementById(t),a=document.createElement("style");a.id=t;let n=o||a;return n.innerHTML=e+" "+Ke,o||document.head.insertAdjacentElement("afterbegin",n),()=>{n&&document.head.removeChild(n)}},[])},Ye=Po;var _e=(...e)=>{let t={},o=a=>{for(let n in a)a.hasOwnProperty(n)&&(Object.prototype.toString.call(a[n])==="[object Object]"?t[n]=_e(t[n],a[n]):t[n]=a[n])};for(let a=0;a<e.length;a++)o(e[a]);return t},qe=_e;var ie={default:"#096ED1",lighter:"#F2F9FF",darker:""},Oo={colors:{accent:ie,text:{primary:"#1a1a1a",secondary:"#404040",disabled:"#808080",inverse:"#ffffff",selected:ie.default,none:"transparent"},background:{primary:"#ffffff",secondary:"#f7f7f7",disabled:"#eeeeee",selected:ie.lighter,inverse:"#000000",none:"transparent"},border:{primary:"#bfbfbf",selected:ie.default,inverse:"#1a1a1a",none:"transparent"}},spacing:{none:0,xs:2,sm:4,md:8,lg:12,xl:16}},vo=({styleOptions:{roundedCorners:e=!0,theme:t={}}={}})=>{let o=qe(Oo,t),a="";Object.entries(o.colors||{}).forEach(([i,l])=>{Object.entries(l||{}).forEach(([d,m])=>{m&&(a+=`--${k}-color-${i}-${d}: ${m}; | ||
`)})});let n="",r=!e;Object.entries(o.spacing||{}).forEach(([i,l])=>{l&&(n+=`--${k}-spacing-${i}: ${y(l)}; | ||
@@ -586,2 +586,2 @@ `,n+=`--${k}-radius-${i}: ${r?0:y(l)}; | ||
${n} | ||
}`;Ke(s)},qe=vo;import{createElement as V}from"react";import{Fragment as Qe,createElement as M,useCallback as Ze,useState as et}from"react";import{useAsyncDebounce as Uo}from"react-table";import p from"react";var Io=e=>{switch(e){case"maximize":case"maximise":return p.createElement("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"});case"minimize":case"minimise":return p.createElement("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"});case"filter":return p.createElement("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"});case"search":return p.createElement(p.Fragment,null,p.createElement("circle",{cx:"11",cy:"11",r:"8"}),p.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}));case"x":case"close":case"cancel":return p.createElement(p.Fragment,null,p.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}));case"chevron-right":return p.createElement("polyline",{points:"9 18 15 12 9 6"});case"chevron-left":return p.createElement("polyline",{points:"15 18 9 12 15 6"});case"chevrons-right":return p.createElement(p.Fragment,null,p.createElement("polyline",{points:"13 17 18 12 13 7"}),p.createElement("polyline",{points:"6 17 11 12 6 7"}));case"chevrons-left":return p.createElement(p.Fragment,null,p.createElement("polyline",{points:"11 17 6 12 11 7"}),p.createElement("polyline",{points:"18 17 13 12 18 7"}));case"sliders":return p.createElement(p.Fragment,null,p.createElement("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),p.createElement("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),p.createElement("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),p.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),p.createElement("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),p.createElement("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),p.createElement("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),p.createElement("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),p.createElement("line",{x1:"17",y1:"16",x2:"23",y2:"16"}));case"save":return p.createElement(p.Fragment,null,p.createElement("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),p.createElement("polyline",{points:"17 21 17 13 7 13 7 21"}),p.createElement("polyline",{points:"7 3 7 8 15 8"}));default:return null}},ko=({name:e})=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather-icon"},Io(e)),x=ko;var $o=({globalFilterValue:e,setGlobalFilter:t,placeholder:o})=>{let[a,n]=et(e),r=Uo(s=>{t(s||void 0)},200);return M("input",{type:"search",value:a||"",autoFocus:!0,onChange:s=>{n(s.target.value),r(s.target.value)},placeholder:o})},Eo=e=>{let{globalFilterOptions:t={},title:o="Table",localeOptions:{text:a}={}}=e.tableProps,{rows:n,state:{globalFilter:r},setGlobalFilter:s,flatRows:i,globalFilteredFlatRows:l,globalFilteredRows:d,globalFilteredRowsById:m,preGlobalFilteredFlatRows:f,preGlobalFilteredRows:C,preGlobalFilteredRowsById:T,rowsById:R}=e.tableInstance,{Component:O=$o,disableGlobalFilter:S=!1,defaultVisibleGlobalFilter:v=!1}=t,[w,I]=et(v),F=Ze(()=>I(!0),[]),H=Ze(()=>{s(void 0),I(!1)},[]),P=`${a?.search||"Search"} ${typeof o=="string"?o:""}`;return M("div",{className:"titleSearch"},w?M(Qe,null,M(O,{...{globalFilterValue:r,flatRows:i,globalFilteredFlatRows:l,globalFilteredRows:d,globalFilteredRowsById:m,preGlobalFilteredFlatRows:f,preGlobalFilteredRows:C,preGlobalFilteredRowsById:T,rows:n,rowsById:R,setGlobalFilter:s,placeholder:P}}),M(D,{title:a?.closeSearch||"Close search",onClick:H},M(x,{name:"x"}))):M(Qe,null,M("div",{className:"title"},o),!S&&M(D,{title:P,onClick:F},M(x,{name:"search"}))),M("div",{className:"separator"}))},tt=Eo;import{createElement as ge}from"react";var Bo=({tableInstance:e,tableProps:t})=>{let{state:{filtersVisible:o},toggleFiltersVisible:a}=e,{alwaysShowFilters:n,disableFilters:r,showFiltersActionIndicator:s,hideFiltersActionIndicator:i}=t.filtersOptions||{},l=t.localeOptions?.text;return r||n?null:ge(D,{onClick:a,title:l?.toggleColumnFilters||(o?l?.hideColumnFilters||"Hide column filters":l?.showColumnFilters||"Show column filters")},o?i||ge(x,{name:"x"}):s||ge(x,{name:"filter"}))},ot=Bo;import{createElement as _}from"react";var at=e=>{let{actionOptions:{tableActions:t=[]}={}}=e.tableProps;return t.length===0?null:_("div",{className:"TableActions"},t.map(o=>_(D,{key:o.id,onClick:()=>o.onClick(e),title:o.tooltip},o.children)),_("div",{className:"separator"}))},nt=e=>{let{actionOptions:{multiRowActions:t=[]}={}}=e.tableProps,{selectedFlatRows:o}=e.tableInstance;if(t.length===0)return null;let a=o.map(r=>r.original),n=o.length===0;return _("div",{className:g("MultiRowActions",n?"disabled":"")},t.map(r=>_(D,{disabled:n,key:r.id,onClick:()=>r.onClick(a,o),title:r.tooltip},r.children)),_("div",{className:"separator"}))};import{createElement as A}from"react";import{createElement as rt,useCallback as st,useState as Ho}from"react";var No=rt(x,{name:"maximise"}),Ao=rt(x,{name:"minimise"}),Mo=({tableRef:e,tableProps:t})=>{let{actionOptions:{fullscreenAction:o=!0}={},localeOptions:{text:a}={}}=t,[n,r]=Ho(!1),s=st(()=>{e?.current?.requestFullscreen(),r(!0)},[e]),i=st(()=>{window.document.fullscreenElement&&window.document.exitFullscreen(),r(!1)},[]),l=typeof o!="boolean"&&o.enterFullscreenIndicator||No,d=typeof o!="boolean"&&o.exitFullscreenIndicator||Ao;return o?{title:a?.toggleFullscreen||"Toggle fullscreen",onClick:n?i:s,children:n?d:l}:null},it=Mo;var Go=A(x,{name:"sliders"}),Lo=({tableInstance:e,tableProps:t})=>{let{state:{pageSize:o},setPageSize:a}=e,{locale:n,text:r}=t.localeOptions||{};return A("div",null,r?.pageSize||"Page size",A("select",{name:"pageSize",defaultValue:o,onChange:s=>a(parseInt(s.target.value,10))},[10,20,50,75,100,150].map(s=>A("option",{key:s,value:s},s.toLocaleString(n)))))},zo=e=>{let{setModal:t}=e.tableInstance,o=e.tableProps.localeOptions?.text,a=it(e),n=se("menu");if(!n)return null;let{Menu:r,MenuButton:s,MenuList:i,MenuItem:l}=n,d=()=>t({title:o?.tablePreferences||"Table preferences",children:A("div",null,A(Lo,{...e}))});return A(r,null,A(s,{className:"Button RowAction",title:"Table preferences"},A("div",{className:"button-content"},"\u2022\u2022\u2022")),A(i,{portal:!0},a&&A(l,{onSelect:()=>a.onClick()},a.children,a.title),A(l,{onSelect:d},Go,o?.tablePreferences||"Table preferences")))},lt=zo;var Vo=e=>V("div",{className:"systemActions"},V(ot,{...e}),V(lt,{...e})),jo=e=>{let{titleBar:t=!0}=e.tableProps.styleOptions||{};return t?V("div",{className:g("TitleBar")},V(tt,{...e}),V(nt,{...e}),V(at,{...e}),V(Vo,{...e})):V("div",null)},ct=jo;import{Fragment as la,createElement as q,useMemo as ca}from"react";import{createElement as B}from"react";var Xo=({tableProps:e})=>{let{Component:t,descendingIndicator:o="\u2191",ascendingIndicator:a="\u2193",defaultIndicator:n="\u21C5"}=e.sortByOptions||{};return t||(({canSort:s,isSorted:i,isSortedDesc:l,onClick:d,title:m})=>s?B("div",{className:"Sort",style:{marginLeft:"8px",cursor:"pointer"},onClick:d,title:m},i?l?o:a:n):null)},Jo=e=>{let{column:t}=e,o=t.render("Header"),a=typeof o=="string"?o:o?.toString()||"",n=t.getHeaderProps(t.getSortByToggleProps()),r=ee(t);return B(K,{...{...n,onClick:void 0,className:g("th",r?"noSpacing":""),title:a},style:{...n.style,cursor:"initial"}},t.canFilter?B("div",{className:"Filter"},t.render("Filter")):null)},Wo=e=>{let{column:t,tableProps:o}=e,{disableResizing:a=!1}=o.columnOptions||{},n=Xo(e),r=t.render("Header"),s=typeof r=="string"?r:r?.toString()||"",i=t.getHeaderProps(t.getSortByToggleProps()),l=ee(t);return B(K,{...{...i,onClick:void 0,className:g("th",l?"noSpacing":""),title:s},style:{...i.style,cursor:"initial"}},r,B(n,{...t,onClick:t.getSortByToggleProps().onClick,column:t,title:`Sort ${s}`}),!a&&!t.disableResizing&&!l&&B("div",{...t?.getResizerProps?.(),title:`Resize ${s}`,className:g("resizer",t.isResizing?"isResizing":"")}))},Ko=e=>{let{headerGroup:t,...o}=e,{getHeaderGroupProps:a,headers:n}=t;return B("div",{...a(),className:g("tr","Row")},n.map(r=>B(Wo,{key:r.getHeaderProps().key||"",...{column:r,...o}})))},Yo=e=>{let{headerGroup:t,...o}=e,{getHeaderGroupProps:a,headers:n}=t;return B("div",{...a(),className:g("tr","Row","FilterRow")},n.map(r=>B(Jo,{key:r.getHeaderProps().key||"",...{column:r,...o}})))},_o=e=>{let{tableInstance:t,tableProps:o}=e,{headerGroups:a,state:n}=t,{freezeOptions:r}=o,s=r?.header!==!1,i=a[a.length-1],{filtersVisible:l}=n;return B("div",{className:g("THead","header",s?"sticky":""),role:"rowgroup"},a.map((d,m)=>B(Ko,{key:m,headerGroup:d,...e})),l&&B(Yo,{key:"filterRow",headerGroup:i,...e}))},pt=_o;import{Fragment as qo,createElement as X}from"react";var Qo=({row:e,totalColumnsWidth:t})=>{let o=e.original.subComponent,a=e.getRowProps();return o?X("div",{key:a.key+"_subComponent",className:g("tr subComponent"),style:{minWidth:t+"px",maxWidth:"100%"}},X("div",{className:"content"},o)):null},Zo=({row:e})=>{let t=e.getRowProps(),o=e.isSelected;return X("div",{...t,tabIndex:-1,className:g("tr","Row",o?"selected":"")},e.cells.map(a=>{let n=ee(a.column.id);return X(K,{...a.getCellProps(),className:n?"systemColumn noSpacing":""},a.render("Cell"))}))},ea=e=>{let{rows:t,page:o,getTableBodyProps:a,prepareRow:n,totalColumnsWidth:r}=e.tableInstance;return X("div",{className:g("TBody body"),...a()},(o||t).map(s=>(n(s),X(qo,{key:s.id},X(Zo,{row:s}),s.isExpanded&&X(Qo,{row:s,totalColumnsWidth:r})))))},dt=ea;import{createElement as fe}from"react";var ta=e=>{try{return e.render("Footer")}catch{return null}},oa=e=>{let{tableInstance:t,tableProps:{freezeOptions:o,columns:a}}=e,n=a?.some(function l(d){return!!d.Footer||!!d.columns?.some(m=>l(m))}),{headerGroups:r}=t,s=r.slice().reverse(),i=o?.footer!==!1;return fe("div",{className:g("TFoot","footer",i?"sticky":""),role:"rowgroup"},n&&s.map(l=>l.headers.some(({Footer:m})=>typeof m=="function"?m.name!=="emptyRenderer":!!m)?fe("div",{...l.getHeaderGroupProps(),className:g("tr")},l.headers.map(m=>fe(K,{...m.getHeaderProps()},ta(m)))):null))},mt=oa;import{useCallback as aa,useEffect as na,useRef as ra,useState as sa}from"react";var ia=()=>{let e=ra(null),[t,o]=sa({y:0,x:0}),a=aa(()=>{let n=e.current,r={y:n?.scrollTop||0,x:n?.scrollLeft||0};o(r)},[]);return na(()=>(e.current?.addEventListener("scroll",a),()=>e.current?.removeEventListener("scroll",a)),[a]),[e,{scrollPosY:t.y,scrollPosX:t.x}]},ut=ia;var pa=e=>{let{tableInstance:t,tableProps:o,tableRef:a,className:n="",...r}=e,{getTableProps:s,rows:i}=t,{loadingOptions:l={},data:d=[],localeOptions:{text:m}={}}=o,f=()=>q("div",{className:"loader"},m?.loading||"Loading","..."),{loading:C=!1,Component:T=f,backgroundLoading:R=!0}=l,O=ca(()=>R?d.length===0?C:!1:C,[d,C,R]),[S,{scrollPosX:v,scrollPosY:w}]=ut();return q("div",{...s(),...r,"aria-rowcount":i.length,className:g("Table","sticky",n,v>0?"scrollX":"",w>0?"scrollY":""),ref:S},O?T:q(la,null,q(pt,{...{tableProps:o,tableInstance:t}}),q(dt,{...{tableProps:o,tableInstance:t}}),q(mt,{...{tableProps:o,tableInstance:t}})))},gt=pa;import{createElement as h}from"react";var da=({tableProps:e,tableInstance:t})=>{let{loading:o=!1,showLoadingStatus:a=!0}=e.loadingOptions||{},{disablePagination:n=!1,manualPagination:r=!1,recordCount:s}=e.paginationOptions||{},{page:i,rows:l,pageCount:d,selectedFlatRows:m,state:{pageSize:f,pageIndex:C}}=t,T=e.localeOptions?.locale,{loading:R="Loading",noRecords:O="No records",total:S="Total",records:v="records",showing:w="Showing",of:I="of"}=e.localeOptions?.text||{},F=0;if(m&&(F=Object.keys(m).length),a&&o)return R+"...";let H=[],P="";if(l.length===0)P=O;else if(n)P=`${S} ${l.length.toLocaleString(T)} ${v}`;else{let L=r?s?.toLocaleString(T)||`~${(d*f).toLocaleString(T)}`:l.length.toLocaleString(T),j=(C*f+1).toLocaleString(T),Q=(r?(C+1)*f:C*f+i.length).toLocaleString(T);P=`${w} ${j}-${Q} ${I} ${L} ${v}`}return H.push(P),F>0&&H.push(`${F} selected`),H.join(" \u2022 ")},ft=da;var ma=e=>{let{styleOptions:t,paginationOptions:o,localeOptions:a}=e.tableProps,{statusBar:n=!0}=t||{},{Component:r,firstPageIndicator:s=h(x,{name:"chevrons-left"}),previousPageIndicator:i=h(x,{name:"chevron-left"}),nextPageIndicator:l=h(x,{name:"chevron-right"}),lastPageIndicator:d=h(x,{name:"chevrons-right"})}=o||{},{locale:m,text:f={}}=a||{},C=ft(e),{page:T,canPreviousPage:R,canNextPage:O,pageOptions:S,pageCount:v,gotoPage:w,nextPage:I,previousPage:F,setPageSize:H,state:{pageIndex:P,pageSize:L}}=e.tableInstance,j=!!e.tableProps.loadingOptions?.loading,Q=S.length>1;return n?h("div",{className:g("StatusBar",j?"loading":"")},C&&h("div",{className:"Status"},C),h("div",{className:"spacer"}),Q?r?h(r,{...{page:T,canPreviousPage:R,canNextPage:O,pageOptions:S,pageCount:v,gotoPage:w,nextPage:I,previousPage:F,setPageSize:H,pageIndex:P,pageSize:L,loading:j}}):h("div",{className:"Pagination"},h(D,{onClick:()=>w(0),disabled:!R,title:f.firstPage||"First page"},s),h(D,{onClick:F,disabled:!R,title:f.previousPage||"Previous page"},i),h("div",null,h("span",null,f.page||"Page"),h("input",{type:"number",value:(P+1).toLocaleString(m),onChange:Z=>{let ae=Z.target.value?Number(Z.target.value)-1:0;w(ae)},style:{width:"60px"},disabled:S.length<=1}),h("span",null,f.of||"of"," ",S.length.toLocaleString(m))),h(D,{onClick:I,disabled:!O,title:f.nextPage||"Next page"},l),h(D,{onClick:()=>w(v-1),disabled:!O,title:f.lastPage||"Last page"},d)):null):null},bt=ma;import{createElement as G}from"react";import{createElement as ua,useCallback as ga,useEffect as le,useRef as be,useState as fa}from"react";var ba=["button","[href]","input","select","textarea",'[tabindex]:not([tabindex="-1"])'],xa=(e,t,o=!0)=>{let a=e.current,n=t.current,r=ya(e,{}),s=ga(i=>{let l=i.key==="Tab",d=i.shiftKey;if(!a){console.warn("No element found with firstElementRef.");return}if(!n){console.warn("No element found with lastElementRef");return}l&&d&&document.activeElement===a&&(i.preventDefault(),n?.focus()),l&&!d&&document.activeElement===n&&(i.preventDefault(),a?.focus())},[a,n]);le(()=>(document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)),[s]),le(()=>{o&&r&&a?.focus()},[o,r])},Ca=({element:e="div",selectors:t=[],autoFocusFirstElement:o,children:a,...n})=>{let r=be(null),s=be(),i=be();return le(()=>{let d=r.current?.querySelectorAll([...ba,...t].join(", "));s.current=d?.item(0),i.current=d?.item(d.length-1)},[r.current,a,t]),xa(s,i,o),ua(e,{...n,ref:r},a)},yt=Ca;function ya(e,t,o=960){let[a,n]=fa(!1);return le(()=>{if(window.innerWidth>=o){let r=new IntersectionObserver(([s])=>{n(s.isIntersecting)},t);return e.current&&r.observe(e.current),()=>{e.current&&r.unobserve(e.current)}}},[e,t]),a}var Ta=e=>{let{state:{modal:t},resetModal:o}=e.tableInstance,a=e.tableProps.localeOptions?.text,n=()=>{t?.onSave?.(),o()};return t?G("div",{className:"Modal-Wrapper",onClick:o},G(yt,{className:"Modal",onClick:r=>r.stopPropagation()},G("div",{className:"TitleBar"},t.title,G("div",null,t.onSave&&G(D,{onClick:n},G("div",{className:"iconWithLabel"},G(x,{name:"save"}),G("div",null,a?.save||"Save"))),G(D,{onClick:o},G(x,{name:"x"})))),G("div",{className:"Modal-Content"},t.children))):null},xt=Ta;var Da=({tableInstanceRef:e,...t})=>{let o=ha(null);qe(t);let a=Be(t,o);Sa(e,()=>a.tableInstance);let{borderless:n=!1}=a.tableProps.styleOptions||{};return oe("div",{ref:o,className:g(k,n?"":"withBorder")},oe(ct,{...a}),oe(gt,{...a}),oe(bt,{...a}),oe(xt,{...a}))},Ct=Da;var ti=Ct;export{ti as default}; | ||
}`;Ye(s)},Qe=vo;import{createElement as V}from"react";import{Fragment as Ze,createElement as M,useCallback as et,useState as tt}from"react";import{useAsyncDebounce as Uo}from"react-table";import p from"react";var Io=e=>{switch(e){case"maximize":case"maximise":return p.createElement("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"});case"minimize":case"minimise":return p.createElement("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"});case"filter":return p.createElement("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"});case"search":return p.createElement(p.Fragment,null,p.createElement("circle",{cx:"11",cy:"11",r:"8"}),p.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}));case"x":case"close":case"cancel":return p.createElement(p.Fragment,null,p.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}));case"chevron-right":return p.createElement("polyline",{points:"9 18 15 12 9 6"});case"chevron-left":return p.createElement("polyline",{points:"15 18 9 12 15 6"});case"chevrons-right":return p.createElement(p.Fragment,null,p.createElement("polyline",{points:"13 17 18 12 13 7"}),p.createElement("polyline",{points:"6 17 11 12 6 7"}));case"chevrons-left":return p.createElement(p.Fragment,null,p.createElement("polyline",{points:"11 17 6 12 11 7"}),p.createElement("polyline",{points:"18 17 13 12 18 7"}));case"sliders":return p.createElement(p.Fragment,null,p.createElement("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),p.createElement("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),p.createElement("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),p.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),p.createElement("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),p.createElement("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),p.createElement("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),p.createElement("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),p.createElement("line",{x1:"17",y1:"16",x2:"23",y2:"16"}));case"save":return p.createElement(p.Fragment,null,p.createElement("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),p.createElement("polyline",{points:"17 21 17 13 7 13 7 21"}),p.createElement("polyline",{points:"7 3 7 8 15 8"}));default:return null}},ko=({name:e})=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather-icon"},Io(e)),x=ko;var $o=({globalFilterValue:e,setGlobalFilter:t,placeholder:o})=>{let[a,n]=tt(e),r=Uo(s=>{t(s||void 0)},200);return M("input",{type:"search",value:a||"",autoFocus:!0,onChange:s=>{n(s.target.value),r(s.target.value)},placeholder:o})},Eo=e=>{let{globalFilterOptions:t={},title:o="Table",localeOptions:{text:a}={}}=e.tableProps,{rows:n,state:{globalFilter:r},setGlobalFilter:s,flatRows:i,globalFilteredFlatRows:l,globalFilteredRows:d,globalFilteredRowsById:m,preGlobalFilteredFlatRows:f,preGlobalFilteredRows:C,preGlobalFilteredRowsById:S,rowsById:R}=e.tableInstance,{Component:O=$o,disableGlobalFilter:T=!1,defaultVisibleGlobalFilter:v=!1}=t,[w,I]=tt(v),F=et(()=>I(!0),[]),H=et(()=>{s(void 0),I(!1)},[]),P=`${a?.search||"Search"} ${typeof o=="string"?o:""}`;return M("div",{className:"titleSearch"},w?M(Ze,null,M(O,{...{globalFilterValue:r,flatRows:i,globalFilteredFlatRows:l,globalFilteredRows:d,globalFilteredRowsById:m,preGlobalFilteredFlatRows:f,preGlobalFilteredRows:C,preGlobalFilteredRowsById:S,rows:n,rowsById:R,setGlobalFilter:s,placeholder:P}}),M(D,{title:a?.closeSearch||"Close search",onClick:H},M(x,{name:"x"}))):M(Ze,null,M("div",{className:"title"},o),!T&&M(D,{title:P,onClick:F},M(x,{name:"search"}))),M("div",{className:"separator"}))},ot=Eo;import{createElement as fe}from"react";var Bo=({tableInstance:e,tableProps:t})=>{let{state:{filtersVisible:o},toggleFiltersVisible:a}=e,{alwaysShowFilters:n,disableFilters:r,showFiltersActionIndicator:s,hideFiltersActionIndicator:i}=t.filtersOptions||{},l=t.localeOptions?.text;return r||n?null:fe(D,{onClick:a,title:l?.toggleColumnFilters||(o?l?.hideColumnFilters||"Hide column filters":l?.showColumnFilters||"Show column filters")},o?i||fe(x,{name:"x"}):s||fe(x,{name:"filter"}))},at=Bo;import{createElement as q}from"react";var nt=e=>{let{actionOptions:{tableActions:t=[]}={}}=e.tableProps;return t.length===0?null:q("div",{className:"TableActions"},t.map(o=>q(D,{key:o.id,onClick:()=>o.onClick(e),title:o.tooltip},o.children)),q("div",{className:"separator"}))},rt=e=>{let{actionOptions:{multiRowActions:t=[]}={}}=e.tableProps,{selectedFlatRows:o}=e.tableInstance;if(t.length===0)return null;let a=o.map(r=>r.original),n=o.length===0;return q("div",{className:g("MultiRowActions",n?"disabled":"")},t.map(r=>q(D,{disabled:n,key:r.id,onClick:()=>r.onClick(a,o),title:r.tooltip},r.children)),q("div",{className:"separator"}))};import{createElement as A}from"react";import{createElement as st,useCallback as it,useState as Ho}from"react";var No=st(x,{name:"maximise"}),Ao=st(x,{name:"minimise"}),Mo=({tableRef:e,tableProps:t})=>{let{actionOptions:{fullscreenAction:o=!0}={},localeOptions:{text:a}={}}=t,[n,r]=Ho(!1),s=it(()=>{e?.current?.requestFullscreen(),r(!0)},[e]),i=it(()=>{window.document.fullscreenElement&&window.document.exitFullscreen(),r(!1)},[]),l=typeof o!="boolean"&&o.enterFullscreenIndicator||No,d=typeof o!="boolean"&&o.exitFullscreenIndicator||Ao;return o?{title:a?.toggleFullscreen||"Toggle fullscreen",onClick:n?i:s,children:n?d:l}:null},lt=Mo;var Go=A(x,{name:"sliders"}),Lo=({tableInstance:e,tableProps:t})=>{let{state:{pageSize:o},setPageSize:a}=e,{locale:n,text:r}=t.localeOptions||{};return A("div",null,r?.pageSize||"Page size",A("select",{name:"pageSize",defaultValue:o,onChange:s=>a(parseInt(s.target.value,10))},[10,20,50,75,100,150].map(s=>A("option",{key:s,value:s},s.toLocaleString(n)))))},zo=e=>{let{setModal:t}=e.tableInstance,o=e.tableProps.localeOptions?.text,a=lt(e),n=se("menu");if(!n)return null;let{Menu:r,MenuButton:s,MenuList:i,MenuItem:l}=n,d=()=>t({title:o?.tablePreferences||"Table preferences",children:A("div",null,A(Lo,{...e}))});return A(r,null,A(s,{className:"Button RowAction",title:"Table preferences"},A("div",{className:"button-content"},"\u2022\u2022\u2022")),A(i,{portal:!0},a&&A(l,{onSelect:()=>a.onClick()},a.children,a.title),A(l,{onSelect:d},Go,o?.tablePreferences||"Table preferences")))},ct=zo;var Vo=e=>V("div",{className:"systemActions"},V(at,{...e}),V(ct,{...e})),jo=e=>{let{titleBar:t=!0}=e.tableProps.styleOptions||{};return t?V("div",{className:g("TitleBar")},V(ot,{...e}),V(rt,{...e}),V(nt,{...e}),V(Vo,{...e})):V("div",null)},pt=jo;import{Fragment as la,createElement as Q,useMemo as ca}from"react";import{createElement as B}from"react";var Xo=({tableProps:e})=>{let{Component:t,descendingIndicator:o="\u2191",ascendingIndicator:a="\u2193",defaultIndicator:n="\u21C5"}=e.sortByOptions||{};return t||(({canSort:s,isSorted:i,isSortedDesc:l,onClick:d,title:m})=>s?B("div",{className:"Sort",style:{marginLeft:"8px",cursor:"pointer"},onClick:d,title:m},i?l?o:a:n):null)},Jo=e=>{let{column:t}=e,o=t.render("Header"),a=typeof o=="string"?o:o?.toString()||"",n=t.getHeaderProps(t.getSortByToggleProps()),r=ee(t);return B(K,{...{...n,onClick:void 0,className:g("th",r?"noSpacing":""),title:a},style:{...n.style,cursor:"initial"}},t.canFilter?B("div",{className:"Filter"},t.render("Filter")):null)},Wo=e=>{let{column:t,tableProps:o}=e,{disableResizing:a=!1}=o.columnOptions||{},n=Xo(e),r=t.render("Header"),s=typeof r=="string"?r:r?.toString()||"",i=t.getHeaderProps(t.getSortByToggleProps()),l=ee(t);return B(K,{...{...i,onClick:void 0,className:g("th",l?"noSpacing":""),title:s},style:{...i.style,cursor:"initial"}},r,B(n,{...t,onClick:t.getSortByToggleProps().onClick,column:t,title:`Sort ${s}`}),!a&&!t.disableResizing&&!l&&B("div",{...t?.getResizerProps?.(),title:`Resize ${s}`,className:g("resizer",t.isResizing?"isResizing":"")}))},Ko=e=>{let{headerGroup:t,...o}=e,{getHeaderGroupProps:a,headers:n}=t;return B("div",{...a(),className:g("tr","Row")},n.map(r=>B(Wo,{key:r.getHeaderProps().key||"",...{column:r,...o}})))},Yo=e=>{let{headerGroup:t,...o}=e,{getHeaderGroupProps:a,headers:n}=t;return B("div",{...a(),className:g("tr","Row","FilterRow")},n.map(r=>B(Jo,{key:r.getHeaderProps().key||"",...{column:r,...o}})))},_o=e=>{let{tableInstance:t,tableProps:o}=e,{headerGroups:a,state:n}=t,{freezeOptions:r}=o,s=r?.header!==!1,i=a[a.length-1],{filtersVisible:l}=n;return B("div",{className:g("THead","header",s?"sticky":""),role:"rowgroup"},a.map((d,m)=>B(Ko,{key:m,headerGroup:d,...e})),l&&B(Yo,{key:"filterRow",headerGroup:i,...e}))},dt=_o;import{Fragment as qo,createElement as X}from"react";var Qo=({row:e,totalColumnsWidth:t})=>{let o=e.original.subComponent,a=e.getRowProps();return o?X("div",{key:a.key+"_subComponent",className:g("tr subComponent"),style:{minWidth:t+"px",maxWidth:"100%"}},X("div",{className:"content"},o)):null},Zo=({row:e})=>{let t=e.getRowProps(),o=e.isSelected;return X("div",{...t,tabIndex:-1,className:g("tr","Row",o?"selected":"")},e.cells.map(a=>{let n=ee(a.column.id);return X(K,{...a.getCellProps(),className:n?"systemColumn noSpacing":""},a.render("Cell"))}))},ea=e=>{let{rows:t,page:o,getTableBodyProps:a,prepareRow:n,totalColumnsWidth:r}=e.tableInstance;return X("div",{className:g("TBody body"),...a()},(o||t).map(s=>(n(s),X(qo,{key:s.id},X(Zo,{row:s}),s.isExpanded&&X(Qo,{row:s,totalColumnsWidth:r})))))},mt=ea;import{createElement as be}from"react";var ta=e=>{try{return e.render("Footer")}catch{return null}},oa=e=>{let{tableInstance:t,tableProps:{freezeOptions:o,columns:a}}=e,n=a?.some(function l(d){return!!d.Footer||!!d.columns?.some(m=>l(m))}),{headerGroups:r}=t,s=r.slice().reverse(),i=o?.footer!==!1;return be("div",{className:g("TFoot","footer",i?"sticky":""),role:"rowgroup"},n&&s.map(l=>l.headers.some(({Footer:m})=>typeof m=="function"?m.name!=="emptyRenderer":!!m)?be("div",{...l.getHeaderGroupProps(),className:g("tr")},l.headers.map(m=>be(K,{...m.getHeaderProps()},ta(m)))):null))},ut=oa;import{useCallback as aa,useEffect as na,useRef as ra,useState as sa}from"react";var ia=()=>{let e=ra(null),[t,o]=sa({y:0,x:0}),a=aa(()=>{let n=e.current,r={y:n?.scrollTop||0,x:n?.scrollLeft||0};o(r)},[]);return na(()=>(e.current?.addEventListener("scroll",a),()=>e.current?.removeEventListener("scroll",a)),[a]),[e,{scrollPosY:t.y,scrollPosX:t.x}]},gt=ia;var pa=e=>{let{tableInstance:t,tableProps:o,tableRef:a,className:n="",...r}=e,{getTableProps:s,rows:i}=t,{loadingOptions:l={},data:d=[],localeOptions:{text:m}={}}=o,f=()=>Q("div",{className:"loader"},m?.loading||"Loading","..."),{loading:C=!1,Component:S=f,backgroundLoading:R=!0}=l,O=ca(()=>R?d.length===0?C:!1:C,[d,C,R]),[T,{scrollPosX:v,scrollPosY:w}]=gt();return Q("div",{...s(),...r,"aria-rowcount":i.length,className:g("Table","sticky",n,v>0?"scrollX":"",w>0?"scrollY":""),ref:T},O?S:Q(la,null,Q(dt,{...{tableProps:o,tableInstance:t}}),Q(mt,{...{tableProps:o,tableInstance:t}}),Q(ut,{...{tableProps:o,tableInstance:t}})))},ft=pa;import{createElement as h}from"react";var da=({tableProps:e,tableInstance:t})=>{let{loading:o=!1,showLoadingStatus:a=!0}=e.loadingOptions||{},{disablePagination:n=!1,manualPagination:r=!1,recordCount:s}=e.paginationOptions||{},{page:i,rows:l,pageCount:d,selectedFlatRows:m,state:{pageSize:f,pageIndex:C}}=t,S=e.localeOptions?.locale,{loading:R="Loading",noRecords:O="No records",total:T="Total",records:v="records",showing:w="Showing",of:I="of"}=e.localeOptions?.text||{},F=0;if(m&&(F=Object.keys(m).length),a&&o)return R+"...";let H=[],P="";if(l.length===0)P=O;else if(n)P=`${T} ${l.length.toLocaleString(S)} ${v}`;else{let L=r?s?.toLocaleString(S)||`~${(d*f).toLocaleString(S)}`:l.length.toLocaleString(S),j=(C*f+1).toLocaleString(S),Y=(r?(C+1)*f:C*f+i.length).toLocaleString(S);P=`${w} ${j}-${Y} ${I} ${L} ${v}`}return H.push(P),F>0&&H.push(`${F} selected`),H.join(" \u2022 ")},bt=da;var ma=e=>{let{styleOptions:t,paginationOptions:o,localeOptions:a}=e.tableProps,{statusBar:n=!0}=t||{},{Component:r,firstPageIndicator:s=h(x,{name:"chevrons-left"}),previousPageIndicator:i=h(x,{name:"chevron-left"}),nextPageIndicator:l=h(x,{name:"chevron-right"}),lastPageIndicator:d=h(x,{name:"chevrons-right"})}=o||{},{locale:m,text:f={}}=a||{},C=bt(e),{page:S,canPreviousPage:R,canNextPage:O,pageOptions:T,pageCount:v,gotoPage:w,nextPage:I,previousPage:F,setPageSize:H,state:{pageIndex:P,pageSize:L}}=e.tableInstance,j=!!e.tableProps.loadingOptions?.loading,Y=[];T&&(Y=T);let ae=Y.length>1;return n?h("div",{className:g("StatusBar",j?"loading":"")},C&&h("div",{className:"Status"},C),h("div",{className:"spacer"}),ae?r?h(r,{...{page:S,canPreviousPage:R,canNextPage:O,pageOptions:T,pageCount:v,gotoPage:w,nextPage:I,previousPage:F,setPageSize:H,pageIndex:P,pageSize:L,loading:j}}):h("div",{className:"Pagination"},h(D,{onClick:()=>w(0),disabled:!R,title:f.firstPage||"First page"},s),h(D,{onClick:F,disabled:!R,title:f.previousPage||"Previous page"},i),h("div",null,h("span",null,f.page||"Page"),h("input",{type:"number",value:(P+1).toLocaleString(m),onChange:Z=>{let ce=Z.target.value?Number(Z.target.value)-1:0;w(ce)},style:{width:"60px"},disabled:T.length<=1}),h("span",null,f.of||"of"," ",T.length.toLocaleString(m))),h(D,{onClick:I,disabled:!O,title:f.nextPage||"Next page"},l),h(D,{onClick:()=>w(v-1),disabled:!O,title:f.lastPage||"Last page"},d)):null):null},yt=ma;import{createElement as G}from"react";import{createElement as ua,useCallback as ga,useEffect as le,useRef as ye,useState as fa}from"react";var ba=["button","[href]","input","select","textarea",'[tabindex]:not([tabindex="-1"])'],xa=(e,t,o=!0)=>{let a=e.current,n=t.current,r=ya(e,{}),s=ga(i=>{let l=i.key==="Tab",d=i.shiftKey;if(!a){console.warn("No element found with firstElementRef.");return}if(!n){console.warn("No element found with lastElementRef");return}l&&d&&document.activeElement===a&&(i.preventDefault(),n?.focus()),l&&!d&&document.activeElement===n&&(i.preventDefault(),a?.focus())},[a,n]);le(()=>(document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)),[s]),le(()=>{o&&r&&a?.focus()},[o,r])},Ca=({element:e="div",selectors:t=[],autoFocusFirstElement:o,children:a,...n})=>{let r=ye(null),s=ye(),i=ye();return le(()=>{let d=r.current?.querySelectorAll([...ba,...t].join(", "));s.current=d?.item(0),i.current=d?.item(d.length-1)},[r.current,a,t]),xa(s,i,o),ua(e,{...n,ref:r},a)},xt=Ca;function ya(e,t,o=960){let[a,n]=fa(!1);return le(()=>{if(window.innerWidth>=o){let r=new IntersectionObserver(([s])=>{n(s.isIntersecting)},t);return e.current&&r.observe(e.current),()=>{e.current&&r.unobserve(e.current)}}},[e,t]),a}var Ta=e=>{let{state:{modal:t},resetModal:o}=e.tableInstance,a=e.tableProps.localeOptions?.text,n=()=>{t?.onSave?.(),o()};return t?G("div",{className:"Modal-Wrapper",onClick:o},G(xt,{className:"Modal",onClick:r=>r.stopPropagation()},G("div",{className:"TitleBar"},t.title,G("div",null,t.onSave&&G(D,{onClick:n},G("div",{className:"iconWithLabel"},G(x,{name:"save"}),G("div",null,a?.save||"Save"))),G(D,{onClick:o},G(x,{name:"x"})))),G("div",{className:"Modal-Content"},t.children))):null},Ct=Ta;var Da=({tableInstanceRef:e,...t})=>{let o=ha(null);Qe(t);let a=He(t,o);Sa(e,()=>a.tableInstance);let{borderless:n=!1}=a.tableProps.styleOptions||{};return oe("div",{ref:o,className:g(k,n?"":"withBorder")},oe(pt,{...a}),oe(ft,{...a}),oe(yt,{...a}),oe(Ct,{...a}))},Tt=Da;var ti=Tt;export{ti as default}; |
{ | ||
"name": "@vitorlans/react-table-ui", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Out-of-the-box UI for React-Table 7", | ||
@@ -5,0 +5,0 @@ "author": "Siddhant Gupta <me@guptasiddhant.com> (https://guptsiddhant.com)", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
214075