@teppen/react-ui 1.3.1 → 1.3.2
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("../../node_modules/tslib/tslib.es6.js"),r=require("react/jsx-runtime"),t=require("react"),o=require("./hook.js"),n=require("./cell.js"),s=require("./header/header.js"),i=require("./pagenation/providers.js"),l=require("./pagenation/components.js"),c=require("./filter/provider.js"),a=require("./filter/components.js");require("./sort/icon.js");var d=require("./sort/provider.js"),u=require("./sheet/providers.js"),x=require("./edit/provider.js"),h=require("./checkbox/provider.js"),j=require("./checkbox/components.js");function v(e){var i=o.useTable(e),d=i.cols,h=i.rows,v=x.useFocusContext(),f=v.isFocus,m=v.isEditing,p=v.edit,b=v.moveLeft,g=v.moveRight,y=v.moveUp,k=v.moveDown,w=v.unfocus,C=v.setMaxRowNumber,q=c.useFilterContext().selectedFilterKey;return t.useEffect((function(){var e=function(e){f&&!m&&("Enter"===e.key?(e.preventDefault(),k()):"Escape"===e.key?(e.preventDefault(),w()):"ArrowRight"===e.key?(e.preventDefault(),g()):"ArrowLeft"===e.key?(e.preventDefault(),b()):"ArrowUp"===e.key?(e.preventDefault(),y()):"ArrowDown"===e.key?(e.preventDefault(),k()):"F2"===e.key&&p())};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[m,f]),t.useEffect((function(){C(h.length-1)}),[h.length]),r.jsxs("div",{className:"w-full",children:[r.jsx("div",{className:"flex justify-end mb-1 mr-3",children:r.jsx(a.TableFilterRemoveButton,{children:r.jsx("p",{className:"text-xs underline text-gray-500 hover:text-gray-700",children:"全てのフィルタリング条件を解除する"})})}),r.jsx("div",{id:"table-frame",className:"relative
|
|
2
|
+
"use strict";var e=require("../../node_modules/tslib/tslib.es6.js"),r=require("react/jsx-runtime"),t=require("react"),o=require("./hook.js"),n=require("./cell.js"),s=require("./header/header.js"),i=require("./pagenation/providers.js"),l=require("./pagenation/components.js"),c=require("./filter/provider.js"),a=require("./filter/components.js");require("./sort/icon.js");var d=require("./sort/provider.js"),u=require("./sheet/providers.js"),x=require("./edit/provider.js"),h=require("./checkbox/provider.js"),j=require("./checkbox/components.js");function v(e){var i=o.useTable(e),d=i.cols,h=i.rows,v=x.useFocusContext(),f=v.isFocus,m=v.isEditing,p=v.edit,b=v.moveLeft,g=v.moveRight,y=v.moveUp,k=v.moveDown,w=v.unfocus,C=v.setMaxRowNumber,q=c.useFilterContext().selectedFilterKey;return t.useEffect((function(){var e=function(e){f&&!m&&("Enter"===e.key?(e.preventDefault(),k()):"Escape"===e.key?(e.preventDefault(),w()):"ArrowRight"===e.key?(e.preventDefault(),g()):"ArrowLeft"===e.key?(e.preventDefault(),b()):"ArrowUp"===e.key?(e.preventDefault(),y()):"ArrowDown"===e.key?(e.preventDefault(),k()):"F2"===e.key&&p())};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[m,f]),t.useEffect((function(){C(h.length-1)}),[h.length]),r.jsxs("div",{className:"w-full",children:[r.jsx("div",{className:"flex justify-end mb-1 mr-3",children:r.jsx(a.TableFilterRemoveButton,{children:r.jsx("p",{className:"text-xs underline text-gray-500 hover:text-gray-700",children:"全てのフィルタリング条件を解除する"})})}),r.jsx("div",{id:"table-frame",className:"relative h-full max-w-full max-h-[80vh] border border-gray-200 rounded-md overflow-auto",children:r.jsxs("table",{className:"table",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"sticky top-0 border-gray-200 z-20 bg-gray-200 text-gray-600 h-[32px]",children:[e.checkbox&&r.jsx("th",{children:r.jsx(j.AllCheckbox,{rows:e.rows})}),d.map((function(e){return r.jsx(s.TableHeaderElement,{columnKey:e.key},e.key)}))]})}),r.jsxs("tbody",{children:[!!q&&r.jsx("tr",{children:r.jsx("td",{colSpan:d.length,className:"sticky top-8 left-0 bg-gray-300 w-full shadow-lg rounded-b-2xl z-20 p-0 overflow-hidden",children:r.jsx(a.TableFilterForm,{})})}),0===h.length&&r.jsx("tr",{children:r.jsx("td",{colSpan:d.length,className:"py-5",children:r.jsx("p",{className:"text-center font-bold text-lg",children:"NO DATA"})})}),h.map((function(t,o){return r.jsx(u.RowProvider,{row:t,children:r.jsxs("tr",{className:"relative border border-gray-200 after:absolute after:w-full after:h-full after:top-0 after:left-0 after:pointer-events-none after:hover:bg-gray-500/10 ".concat(e.onClickRow?"hover:cursor-pointer":""," ").concat(e.applyRowFormatting?e.applyRowFormatting(t):""),onClick:function(r){r.preventDefault(),e.onClickRow&&e.onClickRow(t)},"data-testid":t.id,children:[e.checkbox&&r.jsx("td",{children:r.jsx(j.Checkbox,{})}),d.map((function(e,t){return r.jsx(u.CellProvider,{columnKey:e.key,rowIndex:o,colIndex:t,children:r.jsx(n.TableCell,{})},e.key)}))]})},t.id)}))]})]})}),r.jsxs("div",{className:"mt-1",children:[r.jsx(l.DisplayRange,{}),r.jsx("div",{className:"mt-2",children:r.jsx(l.Pagenation,{})})]})]})}module.exports=function(t){var o;return r.jsx(c.FilterProvider,{children:r.jsx(d.SortProvider,{initialCondition:null===(o=t.initialCondition)||void 0===o?void 0:o.sort,children:r.jsx(i.PagenationProvider,{rowCount:t.rows.length,children:r.jsx(h.CheckboxProvider,{checkbox:t.checkbox,children:r.jsx(h.CheckboxStatusProvider,{checkboxCount:t.rows.length,children:r.jsx(u.ColumnsProvider,{cols:t.cols,children:r.jsx(x.FocusProvider,{columnCount:t.cols.length,children:r.jsx(v,e.__assign({},t))})})})})})})})};
|
|
3
3
|
//# sourceMappingURL=base.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{__assign as e}from"../../node_modules/tslib/tslib.es6.js";import{jsx as r,jsxs as
|
|
2
|
+
import{__assign as e}from"../../node_modules/tslib/tslib.es6.js";import{jsx as r,jsxs as o}from"react/jsx-runtime";import{useEffect as t}from"react";import{useTable as n}from"./hook.js";import{TableCell as i}from"./cell.js";import{TableHeaderElement as l}from"./header/header.js";import{PagenationProvider as c}from"./pagenation/providers.js";import{DisplayRange as a,Pagenation as d}from"./pagenation/components.js";import{FilterProvider as s,useFilterContext as m}from"./filter/provider.js";import{TableFilterRemoveButton as h,TableFilterForm as f}from"./filter/components.js";import"./sort/icon.js";import{SortProvider as p}from"./sort/provider.js";import{ColumnsProvider as u,RowProvider as v,CellProvider as y}from"./sheet/providers.js";import{FocusProvider as g,useFocusContext as w}from"./edit/provider.js";import{CheckboxProvider as k,CheckboxStatusProvider as b}from"./checkbox/provider.js";import{AllCheckbox as x,Checkbox as j}from"./checkbox/components.js";function N(o){var t;return r(s,{children:r(p,{initialCondition:null===(t=o.initialCondition)||void 0===t?void 0:t.sort,children:r(c,{rowCount:o.rows.length,children:r(k,{checkbox:o.checkbox,children:r(b,{checkboxCount:o.rows.length,children:r(u,{cols:o.cols,children:r(g,{columnCount:o.cols.length,children:r(D,e({},o))})})})})})})})}function D(e){var c=n(e),s=c.cols,p=c.rows,u=w(),g=u.isFocus,k=u.isEditing,b=u.edit,N=u.moveLeft,D=u.moveRight,C=u.moveUp,R=u.moveDown,A=u.unfocus,E=u.setMaxRowNumber,F=m().selectedFilterKey;return t((function(){var e=function(e){g&&!k&&("Enter"===e.key?(e.preventDefault(),R()):"Escape"===e.key?(e.preventDefault(),A()):"ArrowRight"===e.key?(e.preventDefault(),D()):"ArrowLeft"===e.key?(e.preventDefault(),N()):"ArrowUp"===e.key?(e.preventDefault(),C()):"ArrowDown"===e.key?(e.preventDefault(),R()):"F2"===e.key&&b())};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[k,g]),t((function(){E(p.length-1)}),[p.length]),o("div",{className:"w-full",children:[r("div",{className:"flex justify-end mb-1 mr-3",children:r(h,{children:r("p",{className:"text-xs underline text-gray-500 hover:text-gray-700",children:"全てのフィルタリング条件を解除する"})})}),r("div",{id:"table-frame",className:"relative h-full max-w-full max-h-[80vh] border border-gray-200 rounded-md overflow-auto",children:o("table",{className:"table",children:[r("thead",{children:o("tr",{className:"sticky top-0 border-gray-200 z-20 bg-gray-200 text-gray-600 h-[32px]",children:[e.checkbox&&r("th",{children:r(x,{rows:e.rows})}),s.map((function(e){return r(l,{columnKey:e.key},e.key)}))]})}),o("tbody",{children:[!!F&&r("tr",{children:r("td",{colSpan:s.length,className:"sticky top-8 left-0 bg-gray-300 w-full shadow-lg rounded-b-2xl z-20 p-0 overflow-hidden",children:r(f,{})})}),0===p.length&&r("tr",{children:r("td",{colSpan:s.length,className:"py-5",children:r("p",{className:"text-center font-bold text-lg",children:"NO DATA"})})}),p.map((function(t,n){return r(v,{row:t,children:o("tr",{className:"relative border border-gray-200 after:absolute after:w-full after:h-full after:top-0 after:left-0 after:pointer-events-none after:hover:bg-gray-500/10 ".concat(e.onClickRow?"hover:cursor-pointer":""," ").concat(e.applyRowFormatting?e.applyRowFormatting(t):""),onClick:function(r){r.preventDefault(),e.onClickRow&&e.onClickRow(t)},"data-testid":t.id,children:[e.checkbox&&r("td",{children:r(j,{})}),s.map((function(e,o){return r(y,{columnKey:e.key,rowIndex:n,colIndex:o,children:r(i,{})},e.key)}))]})},t.id)}))]})]})}),o("div",{className:"mt-1",children:[r(a,{}),r("div",{className:"mt-2",children:r(d,{})})]})]})}export{N as default};
|
|
3
3
|
//# sourceMappingURL=base.js.map
|