munza-x-data-grid 3.0.9 → 3.1.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/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -57,4 +57,4 @@
|
|
|
57
57
|
mun:[&::-webkit-scrollbar-track]:bg-stone-100\r
|
|
58
58
|
mun:[&::-webkit-scrollbar-thumb]:bg-stone-300\r
|
|
59
59
|
mun:dark:[&::-webkit-scrollbar-track]:bg-neutral-700\r
|
|
60
|
-
mun:dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500`,children:e.getHeaderGroups().map(e=>(0,u.jsx)(l.default.Fragment,{children:e.headers.filter(e=>![`rowNumber`].includes(e.column.id)).map(e=>(0,u.jsx)(r_,{column:e.column},e.id))},e.id))}),(0,u.jsx)(`div`,{className:`mun:px-1.5`,children:(0,u.jsxs)(Z,{onClick:()=>e.setColumnFilters([]),variant:`outline`,size:`xs`,children:[(0,u.jsx)(Tf,{}),`Reset Filters`]})})]})},a_=()=>{let{table:e,density:t}=H();return(0,u.jsxs)(`div`,{className:`mun:flex mun:flex-col mun:gap-1.5 mun:h-full mun:py-1.5`,children:[(0,u.jsx)(`div`,{className:`mun:flex mun:items-center mun:justify-between mun:px-1.5 mun:pb-2.5 mun:border-b mun:border-border`,children:(0,u.jsx)(`h1`,{className:`mun:text-sm mun:font-bold`,children:`Rows`})}),(0,u.jsxs)(`div`,{className:`mun:space-y-2 mun:px-1.5 mun:flex-1`,children:[(0,u.jsx)(Ip,{children:`Row Density`}),(0,u.jsxs)(`div`,{className:`mun:flex mun:items-center mun:gap-1.5 mun:flex-wrap`,children:[(0,u.jsx)(Z,{variant:t===`sm`?`default`:`outline`,onClick:()=>e.setDensity(`sm`),size:`sm`,children:`Small`}),(0,u.jsx)(Z,{variant:t===`md`?`default`:`outline`,onClick:()=>e.setDensity(`md`),size:`sm`,children:`Default`}),(0,u.jsx)(Z,{variant:t===`lg`?`default`:`outline`,onClick:()=>e.setDensity(`lg`),size:`sm`,children:`Large`})]})]}),(0,u.jsx)(`div`,{className:`mun:px-1.5`,children:(0,u.jsx)(Z,{onClick:()=>e.resetRowPinning(),variant:`outline`,size:`xs`,children:`Reset Row Pining`})})]})},o_=()=>{let{table:e,setIsSplit:t,gridWrapperRef:n,isFetching:r,refetch:i}=H(),[a,o]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=()=>{o(document.fullscreenElement===n.current)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[n]),(0,u.jsxs)(`div`,{className:`mun:flex mun:flex-col mun:gap-1.5 mun:h-full mun:py-1.5`,children:[(0,u.jsx)(`div`,{className:`mun:flex mun:items-center mun:justify-between mun:px-1.5 mun:pb-2.5 mun:border-b mun:border-border`,children:(0,u.jsx)(`h1`,{className:`mun:text-sm mun:font-bold`,children:`Settings`})}),(0,u.jsxs)(`div`,{className:`mun:px-1.5 mun:flex mun:flex-col mun:gap-2`,children:[(0,u.jsx)(Z,{onClick:()=>{n.current&&(document.fullscreenElement?document.exitFullscreen():n.current.requestFullscreen())},children:a?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Of,{className:`mun:mr-2 mun:h-4 mun:w-4`}),`Exit Fullscreen`]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Df,{className:`mun:mr-2 mun:h-4 mun:w-4`}),`Fullscreen`]})}),(0,u.jsxs)(Z,{onClick:()=>i?.(),disabled:r,children:[(0,u.jsx)(jf,{className:X(r&&`mun:animate-spin`)}),r?`Refreshing...`:`Refresh Data`]}),(0,u.jsx)(Z,{onClick:()=>{window.confirm(`Are you sure you want to reset all settings to default?`)&&(e.setColumnPinning({}),e.resetRowPinning(),e.setColumnVisibility({}),e.setColumnOrder(e.getAllLeafColumns().map(e=>e.id)),e.setColumnSizing({}),e.setDensity(`md`),t(!1),window.alert(`Settings have been reset to default.`))},children:`Reset to Default`})]})]})},s_=({height:e})=>{let[t,n]=(0,l.useState)(null),r=e=>{n(t===e?null:e)};return(0,u.jsxs)(`div`,{className:`mun:bg-muted mun:overflow-hidden mun:flex`,style:{height:e},children:[t===`columns`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)(Lp,{})}),t===`rows`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)(a_,{})}),t===`filter`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)(i_,{})}),t===`dnd`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)($g,{})}),t===`settings`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)(o_,{})}),(0,u.jsx)(`div`,{className:`mun:w-7 mun:border-l mun:border-border`,children:[{value:`columns`,label:`Columns`,icon:yf},{value:`rows`,label:`Rows`,icon:Mf},{value:`filter`,label:`Filter`,icon:Cf},{value:`dnd`,label:`Dnd`,icon:wf},{value:`settings`,label:`Settings`,icon:Pf}].map(({value:e,label:n,icon:i})=>(0,u.jsxs)(Z,{variant:`ghost`,size:`sm`,className:X(`mun:[writing-mode:vertical-rl] mun:rounded-none mun:h-auto mun:w-full mun:hover:bg-background! mun:cursor-pointer`,t===e&&`bg-background`),onClick:()=>r(e),children:[(0,u.jsx)(i,{}),n]},e))})]})},c_=({columns:e,payload:t,state:n,onColumnFiltersChange:r,onPaginationChange:i,onSortingChange:a,onRowSelectionChange:o,isLoading:s,isError:c,setGlobalFilter:l,getRowCanExpand:d,renderSubComponent:f,manualPagination:p,enableRowSelection:m,isFetching:h,refetch:g,height:_=`65vh`,isToolbar:v
|
|
60
|
+
mun:dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500`,children:e.getHeaderGroups().map(e=>(0,u.jsx)(l.default.Fragment,{children:e.headers.filter(e=>![`rowNumber`].includes(e.column.id)).map(e=>(0,u.jsx)(r_,{column:e.column},e.id))},e.id))}),(0,u.jsx)(`div`,{className:`mun:px-1.5`,children:(0,u.jsxs)(Z,{onClick:()=>e.setColumnFilters([]),variant:`outline`,size:`xs`,children:[(0,u.jsx)(Tf,{}),`Reset Filters`]})})]})},a_=()=>{let{table:e,density:t}=H();return(0,u.jsxs)(`div`,{className:`mun:flex mun:flex-col mun:gap-1.5 mun:h-full mun:py-1.5`,children:[(0,u.jsx)(`div`,{className:`mun:flex mun:items-center mun:justify-between mun:px-1.5 mun:pb-2.5 mun:border-b mun:border-border`,children:(0,u.jsx)(`h1`,{className:`mun:text-sm mun:font-bold`,children:`Rows`})}),(0,u.jsxs)(`div`,{className:`mun:space-y-2 mun:px-1.5 mun:flex-1`,children:[(0,u.jsx)(Ip,{children:`Row Density`}),(0,u.jsxs)(`div`,{className:`mun:flex mun:items-center mun:gap-1.5 mun:flex-wrap`,children:[(0,u.jsx)(Z,{variant:t===`sm`?`default`:`outline`,onClick:()=>e.setDensity(`sm`),size:`sm`,children:`Small`}),(0,u.jsx)(Z,{variant:t===`md`?`default`:`outline`,onClick:()=>e.setDensity(`md`),size:`sm`,children:`Default`}),(0,u.jsx)(Z,{variant:t===`lg`?`default`:`outline`,onClick:()=>e.setDensity(`lg`),size:`sm`,children:`Large`})]})]}),(0,u.jsx)(`div`,{className:`mun:px-1.5`,children:(0,u.jsx)(Z,{onClick:()=>e.resetRowPinning(),variant:`outline`,size:`xs`,children:`Reset Row Pining`})})]})},o_=()=>{let{table:e,setIsSplit:t,gridWrapperRef:n,isFetching:r,refetch:i}=H(),[a,o]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=()=>{o(document.fullscreenElement===n.current)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[n]),(0,u.jsxs)(`div`,{className:`mun:flex mun:flex-col mun:gap-1.5 mun:h-full mun:py-1.5`,children:[(0,u.jsx)(`div`,{className:`mun:flex mun:items-center mun:justify-between mun:px-1.5 mun:pb-2.5 mun:border-b mun:border-border`,children:(0,u.jsx)(`h1`,{className:`mun:text-sm mun:font-bold`,children:`Settings`})}),(0,u.jsxs)(`div`,{className:`mun:px-1.5 mun:flex mun:flex-col mun:gap-2`,children:[(0,u.jsx)(Z,{onClick:()=>{n.current&&(document.fullscreenElement?document.exitFullscreen():n.current.requestFullscreen())},children:a?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Of,{className:`mun:mr-2 mun:h-4 mun:w-4`}),`Exit Fullscreen`]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Df,{className:`mun:mr-2 mun:h-4 mun:w-4`}),`Fullscreen`]})}),(0,u.jsxs)(Z,{onClick:()=>i?.(),disabled:r,children:[(0,u.jsx)(jf,{className:X(r&&`mun:animate-spin`)}),r?`Refreshing...`:`Refresh Data`]}),(0,u.jsx)(Z,{onClick:()=>{window.confirm(`Are you sure you want to reset all settings to default?`)&&(e.setColumnPinning({}),e.resetRowPinning(),e.setColumnVisibility({}),e.setColumnOrder(e.getAllLeafColumns().map(e=>e.id)),e.setColumnSizing({}),e.setDensity(`md`),t(!1),window.alert(`Settings have been reset to default.`))},children:`Reset to Default`})]})]})},s_=({height:e})=>{let[t,n]=(0,l.useState)(null),r=e=>{n(t===e?null:e)};return(0,u.jsxs)(`div`,{className:`mun:bg-muted mun:overflow-hidden mun:flex`,style:{height:e},children:[t===`columns`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)(Lp,{})}),t===`rows`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)(a_,{})}),t===`filter`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)(i_,{})}),t===`dnd`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)($g,{})}),t===`settings`&&(0,u.jsx)(`div`,{className:`mun:w-52 mun:border-l mun:border-border mun:transition-all mun:h-full`,children:(0,u.jsx)(o_,{})}),(0,u.jsx)(`div`,{className:`mun:w-7 mun:border-l mun:border-border`,children:[{value:`columns`,label:`Columns`,icon:yf},{value:`rows`,label:`Rows`,icon:Mf},{value:`filter`,label:`Filter`,icon:Cf},{value:`dnd`,label:`Dnd`,icon:wf},{value:`settings`,label:`Settings`,icon:Pf}].map(({value:e,label:n,icon:i})=>(0,u.jsxs)(Z,{variant:`ghost`,size:`sm`,className:X(`mun:[writing-mode:vertical-rl] mun:rounded-none mun:h-auto mun:w-full mun:hover:bg-background! mun:cursor-pointer`,t===e&&`bg-background`),onClick:()=>r(e),children:[(0,u.jsx)(i,{}),n]},e))})]})},c_=({columns:e,payload:t,state:n,onColumnFiltersChange:r,onPaginationChange:i,onSortingChange:a,onRowSelectionChange:o,isLoading:s,isError:c,setGlobalFilter:l,getRowCanExpand:d,renderSubComponent:f,manualPagination:p,enableRowSelection:m,isFetching:h,refetch:g,height:_=`65vh`,isToolbar:v,isPagination:y,children:b,name:x})=>(0,u.jsx)(wt,{payload:t,columns:e,state:n,onColumnFiltersChange:r,onRowSelectionChange:o,onPaginationChange:i,onSortingChange:a,isLoading:s,isError:c,setGlobalFilter:l,getRowCanExpand:d,renderSubComponent:f,manualPagination:p,enableRowSelection:m,isFetching:h,refetch:g,name:x,height:_,children:(0,u.jsx)(l_,{isToolbar:v,isPagination:y,children:b})}),l_=({children:e,isToolbar:t=!0,isPagination:n=!0})=>{let{gridWrapperRef:r}=H(),i=(0,l.useRef)(null),[a,o]=(0,l.useState)(0);return(0,l.useLayoutEffect)(()=>{i.current&&o(i.current.getBoundingClientRect().height)},[]),(0,l.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>{o(e.getBoundingClientRect().height)},n=new ResizeObserver(t);return n.observe(e),document.addEventListener(`fullscreenchange`,t),window.addEventListener(`resize`,t),()=>{n.disconnect(),document.removeEventListener(`fullscreenchange`,t),window.removeEventListener(`resize`,t)}},[]),(0,u.jsxs)(`div`,{ref:r,children:[e,(0,u.jsx)(`div`,{className:`mun:relative`,children:(0,u.jsxs)(`div`,{className:`mun:space-y-2`,children:[(0,u.jsxs)(`div`,{className:`mun:flex mun:items-start mun:bg-muted mun:rounded-md mun:overflow-hidden mun:border mun:border-border mun:w-full`,children:[(0,u.jsx)(bp,{}),(0,u.jsx)(`div`,{className:`mun:overflow-hidden mun:flex-1`,ref:i,children:(0,u.jsx)(Pp,{})}),(0,u.jsx)(Ep,{}),t&&(0,u.jsx)(s_,{height:a})]}),n&&(0,u.jsx)(Lf,{pagination:[20,30,40,50,60,70,80,90,100]})]})})]})},u_=()=>{let[e,t]=l.default.useState([]),[n,r]=l.default.useState({pageIndex:0,pageSize:20}),[i,a]=l.default.useState([]),[o,s]=l.default.useState({}),[c,u]=l.default.useState(``);return{state:{columnFilters:e,globalFilter:c,pagination:n,sorting:i,rowSelection:o},handlers:{onColumnFiltersChange:t,onPaginationChange:r,onSortingChange:a,setGlobalFilter:u,onRowSelectionChange:s},rowSelection:o}},d_=e=>new URLSearchParams(e.flatMap(({id:e,value:t})=>{let n=e.replace(/_/g,`.`);return Array.isArray(t)&&t.length===2?[...t[0]!=null&&t[0]!==``?[[`${n}[gte]`,String(t[0])]]:[],...t[1]!=null&&t[1]!==``?[[`${n}[lte]`,String(t[1])]]:[]]:typeof t==`object`&&t?Object.entries(t).flatMap(([e,t])=>`eq.ne.gt.gte.lt.lte.in.nin.regex.exists.all.size.elemMatch.type.mod.not.and.or.nor.text.where.geoWithin.geoIntersects.near.nearSphere.expr.jsonSchema.bitsAllClear.bitsAllSet.bitsAnyClear.bitsAnySet.rand`.split(`.`).includes(e)&&t!=null&&t!==``?[[`${n}[${e}]`,String(t)]]:[]):t!=null&&t!==``?[[n,String(t)]]:[]})).toString();function f_(e){if(!e||e.length===0)return``;let t=e.filter(e=>e.id!=null&&e.id.trim()!==``).map(e=>e.desc?e.id:`-${e.id}`);return t.length===0?``:`sort=${t.join(`,`)}`}var p_=e=>(0,l.useMemo)(()=>({pagination:e.pagination,queryParams:d_(e.columnFilters),sort:f_(e.sorting),globalFilter:e.globalFilter}),[e]),m_=`eq.ne.gt.gte.lt.lte.in.nin.regex.exists.all.size.elemMatch.type.mod.not.and.or.nor.text.where.geoWithin.geoIntersects.near.nearSphere.expr.jsonSchema.bitsAllClear.bitsAllSet.bitsAnyClear.bitsAnySet.rand`.split(`.`);function h_(e,t){let{id:n,value:r}=t,i=n.replace(/_/g,`.`);if(Array.isArray(r)&&r.length===2){r[0]!=null&&r[0]!==``&&e.set(`${i}[gte]`,String(r[0])),r[1]!=null&&r[1]!==``&&e.set(`${i}[lte]`,String(r[1]));return}if(typeof r==`object`&&r){Object.entries(r).forEach(([t,n])=>{m_.includes(t)&&n!=null&&n!==``&&e.set(`${i}[${t}]`,String(n))});return}r!=null&&r!==``&&e.set(i,String(r))}function g_(e){let t=new URLSearchParams;if(t.set(`page`,String(e.pagination.pageIndex+1)),t.set(`limit`,String(e.pagination.pageSize)),e.columnFilters.forEach(e=>{h_(t,e)}),e.sorting.length>0){let n=e.sorting.map(e=>e.desc?`-${e.id}`:e.id).join(`,`);t.set(`sort`,n)}return e.globalFilter&&t.set(`q`,e.globalFilter),`?${t.toString()}`}exports.Grid=c_,exports.URLSearch=g_,exports.useGrid=H,exports.useGridState=u_,exports.useQueryArgs=p_;
|
package/dist/index.js
CHANGED
|
@@ -11049,7 +11049,7 @@ var u_ = ({ column: e }) => {
|
|
|
11049
11049
|
})
|
|
11050
11050
|
]
|
|
11051
11051
|
});
|
|
11052
|
-
}, h_ = ({ columns: e, payload: t, state: n, onColumnFiltersChange: r, onPaginationChange: i, onSortingChange: a, onRowSelectionChange: o, isLoading: s, isError: c, setGlobalFilter: l, getRowCanExpand: u, renderSubComponent: d, manualPagination: f, enableRowSelection: p, isFetching: m, refetch: g, height: _ = "65vh", isToolbar: v
|
|
11052
|
+
}, h_ = ({ columns: e, payload: t, state: n, onColumnFiltersChange: r, onPaginationChange: i, onSortingChange: a, onRowSelectionChange: o, isLoading: s, isError: c, setGlobalFilter: l, getRowCanExpand: u, renderSubComponent: d, manualPagination: f, enableRowSelection: p, isFetching: m, refetch: g, height: _ = "65vh", isToolbar: v, isPagination: y, children: b, name: x }) => /* @__PURE__ */ h(Mt, {
|
|
11053
11053
|
payload: t,
|
|
11054
11054
|
columns: e,
|
|
11055
11055
|
state: n,
|
|
@@ -11073,7 +11073,7 @@ var u_ = ({ column: e }) => {
|
|
|
11073
11073
|
isPagination: y,
|
|
11074
11074
|
children: b
|
|
11075
11075
|
})
|
|
11076
|
-
}), g_ = ({ children: e, isToolbar: t, isPagination: n }) => {
|
|
11076
|
+
}), g_ = ({ children: e, isToolbar: t = !0, isPagination: n = !0 }) => {
|
|
11077
11077
|
let { gridWrapperRef: r } = H(), i = f(null), [a, o] = p(0);
|
|
11078
11078
|
return l(() => {
|
|
11079
11079
|
i.current && o(i.current.getBoundingClientRect().height);
|