@lotte-innovate/ui-component-test 0.0.127 → 0.0.128
Sign up to get free protection for your applications and to get access to all the features.
@@ -76,7 +76,7 @@ export var useGrid = function (_a) {
|
|
76
76
|
},
|
77
77
|
});
|
78
78
|
}
|
79
|
-
}, [props.enableRowSelection
|
79
|
+
}, [props.enableRowSelection]);
|
80
80
|
var reactTableProps = __assign(__assign({ state: { sorting: sorting, rowSelection: rowSelection, expanded: expanded } }, props), { data: props.data, columns: columnsData, color: (_c = props.color) !== null && _c !== void 0 ? _c : theme.themeColor, paginateExpandedRows: true, enableExpanding: !!props.enableExpanding, getSubRows: function (row) { return row.subRows; }, onExpandedChange: setExpanded, onSortingChange: setSorting, onRowSelectionChange: setRowSelection, getSortedRowModel: getSortedRowModel(), getCoreRowModel: getCoreRowModel(), getExpandedRowModel: getExpandedRowModel() });
|
81
81
|
if (props.enableRowPagination) {
|
82
82
|
reactTableProps['getPaginationRowModel'] = getPaginationRowModel();
|
@@ -1,3 +1,3 @@
|
|
1
1
|
"use client";
|
2
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createColumnHelper as o,getSortedRowModel as r,getCoreRowModel as a,getExpandedRowModel as l,getPaginationRowModel as c,useReactTable as i}from"@tanstack/react-table";import d,{useEffect as s,useRef as g}from"react";import{IconButton as u}from"../IconButton/index.mjs";import{ChevronDownIcon as p,ChevronRightIcon as m}from"@radix-ui/react-icons";import{Checkbox as f}from"../Checkbox/index.mjs";import{useTheme as h}from"../../theme/ThemeProvider.mjs";var b=function(){return b=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},b.apply(this,arguments)},w=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};function S(e){var n=e.indeterminate,o=e.checked,r=e.disabled,a=e.onChange,l=g();return d.useEffect((function(){"boolean"==typeof n&&(l.current.indeterminate=o&&n)}),[l,n]),t(f,{ref:l,id:"checkbox",checked:o,disabled:r,onCheckedChange:function(e){return a&&a({target:{value:e}})},indeterminate:n})}var v=function(g){var f,v,x=w(g,[]),R=h().theme,y=d.useState([]),C=y[0],E=y[1],O=d.useState({}),I=O[0],j=O[1],k=d.useState({}),P=k[0],A=k[1],M=o(),N=null===(f=null==x?void 0:x.columns)||void 0===f?void 0:f.map((function(e){return M.accessor(e.id,b({},e))}));s((function(){if(x.enableExpanding){var o=N[0].cell;N[0]=b(b({},N[0]),{cell:function(r){var a;return e("div",{className:"flex",style:{paddingLeft:"".concat(10*r.row.depth,"px")},children:[r.row.getCanExpand()?t(u,{onClick:r.row.getToggleExpandedHandler(),appearance:"ghost",className:"h-3 w-3",color:null!==(a=r.color)&&void 0!==a?a:R.themeColor,children:r.row.getIsExpanded()?t(p,{}):t(m,{})}):t(n,{}),t("div",{children:o?o(r):r.getValue()})]})}})}}),[x.enableExpanding]),s((function(){x.enableRowSelection&&(null==N||N.unshift({id:"select",header:function(e){var n=e.table;return t("div",{className:"header-checkbox",children:t(S,{checked:n.getIsAllRowsSelected()||n.getIsSomeRowsSelected(),indeterminate:n.getIsSomeRowsSelected(),onChange:n.getToggleAllRowsSelectedHandler()})})},cell:function(e){var n=e.row;return t("div",{className:"px-1",style:{paddingLeft:"".concat(10*n.depth,"px")},children:t(S,{checked:n.getIsSelected()||n.getIsSomeSelected()||n.getIsAllSubRowsSelected(),indeterminate:n.getIsSomeSelected()&&!n.getIsAllSubRowsSelected(),onChange:n.getToggleSelectedHandler()})})}}))}),[x.enableRowSelection
|
2
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createColumnHelper as o,getSortedRowModel as r,getCoreRowModel as a,getExpandedRowModel as l,getPaginationRowModel as c,useReactTable as i}from"@tanstack/react-table";import d,{useEffect as s,useRef as g}from"react";import{IconButton as u}from"../IconButton/index.mjs";import{ChevronDownIcon as p,ChevronRightIcon as m}from"@radix-ui/react-icons";import{Checkbox as f}from"../Checkbox/index.mjs";import{useTheme as h}from"../../theme/ThemeProvider.mjs";var b=function(){return b=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},b.apply(this,arguments)},w=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};function S(e){var n=e.indeterminate,o=e.checked,r=e.disabled,a=e.onChange,l=g();return d.useEffect((function(){"boolean"==typeof n&&(l.current.indeterminate=o&&n)}),[l,n]),t(f,{ref:l,id:"checkbox",checked:o,disabled:r,onCheckedChange:function(e){return a&&a({target:{value:e}})},indeterminate:n})}var v=function(g){var f,v,x=w(g,[]),R=h().theme,y=d.useState([]),C=y[0],E=y[1],O=d.useState({}),I=O[0],j=O[1],k=d.useState({}),P=k[0],A=k[1],M=o(),N=null===(f=null==x?void 0:x.columns)||void 0===f?void 0:f.map((function(e){return M.accessor(e.id,b({},e))}));s((function(){if(x.enableExpanding){var o=N[0].cell;N[0]=b(b({},N[0]),{cell:function(r){var a;return e("div",{className:"flex",style:{paddingLeft:"".concat(10*r.row.depth,"px")},children:[r.row.getCanExpand()?t(u,{onClick:r.row.getToggleExpandedHandler(),appearance:"ghost",className:"h-3 w-3",color:null!==(a=r.color)&&void 0!==a?a:R.themeColor,children:r.row.getIsExpanded()?t(p,{}):t(m,{})}):t(n,{}),t("div",{children:o?o(r):r.getValue()})]})}})}}),[x.enableExpanding]),s((function(){x.enableRowSelection&&(null==N||N.unshift({id:"select",header:function(e){var n=e.table;return t("div",{className:"header-checkbox",children:t(S,{checked:n.getIsAllRowsSelected()||n.getIsSomeRowsSelected(),indeterminate:n.getIsSomeRowsSelected(),onChange:n.getToggleAllRowsSelectedHandler()})})},cell:function(e){var n=e.row;return t("div",{className:"px-1",style:{paddingLeft:"".concat(10*n.depth,"px")},children:t(S,{checked:n.getIsSelected()||n.getIsSomeSelected()||n.getIsAllSubRowsSelected(),indeterminate:n.getIsSomeSelected()&&!n.getIsAllSubRowsSelected(),onChange:n.getToggleSelectedHandler()})})}}))}),[x.enableRowSelection]);var T=b(b({state:{sorting:C,rowSelection:P,expanded:I}},x),{data:x.data,columns:N,color:null!==(v=x.color)&&void 0!==v?v:R.themeColor,paginateExpandedRows:!0,enableExpanding:!!x.enableExpanding,getSubRows:function(e){return e.subRows},onExpandedChange:j,onSortingChange:E,onRowSelectionChange:A,getSortedRowModel:r(),getCoreRowModel:a(),getExpandedRowModel:l()});return x.enableRowPagination&&(T.getPaginationRowModel=c()),i(T)};export{v as useGrid};
|
3
3
|
//# sourceMappingURL=useGrid.mjs.map
|