@teppen/react-ui 1.5.2 → 1.5.3

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("react/jsx-runtime"),t=require("../../hook.js"),l=require("./edit-button.js"),i=require("./string-input.js"),n=require("./number-input.js"),o=require("./select-input.js"),r=require("react"),s=require("../../libs/id-generator.js"),a=require("../provider.js"),c=require("../../sheet/providers.js"),u=r.memo((function(t){return e.jsx(e.Fragment,{children:"component"===t.type?t.component:e.jsx("div",{onDoubleClick:t.onDoubleClick,children:e.jsx("p",{className:"cell-data text-left whitespace-nowrap",children:t.component})})})})),d=r.memo((function(t){var r=a.useCellContext();return e.jsx("td",{id:t.id,onPaste:function(e){e.preventDefault(),t.isExistOnUpdateRow?t.pasteData(e.clipboardData.getData("text")):alert("ペースト機能が有効化されていません。")},className:"".concat(t.cellFormatClassName),children:e.jsxs("div",{className:"relative",onClick:t.isExistOnClickRow?void 0:function(e){e.preventDefault(),t.focusAtCell()},onDoubleClick:t.isExistOnClickRow?void 0:t.onDoubleClickCellToEdit,children:[e.jsx("div",{id:"".concat(t.id,"-display"),children:e.jsxs("div",{className:"flex items-center gap-3 w-fit p-2 cursor-default",onClick:function(e){e.preventDefault(),e.stopPropagation(),t.focusAtCell()},children:[e.jsx(u,{type:r.type,component:r.component,onDoubleClick:t.onDoubleClickCellToEdit}),t.editable&&e.jsx(l.EditButton,{})]})}),t.editable&&e.jsxs("div",{id:"".concat(t.id,"-editor"),className:"absolute top-0 left-0 w-full h-full grid place-items-center z-10 pr-2",onClick:t.preventPropagation,style:{opacity:0,pointerEvents:"none"},children:["string"===r.type&&e.jsx(i.StringCellInput,{}),"number"===r.type&&e.jsx(n.NumberCellInput,{}),"select"===r.type&&e.jsx(o.SelectCellInput,{})]})]})})}));exports.TableCell=function(l){var i,n=t.useCell(l.rowIndex,l.colIndex),o=n.focusAtCell,r=n.onDoubleClickCellToEdit,u=n.preventPropagation,p=n.pasteData,C=c.useColumnContext(l.columnKey);return e.jsx(a.CellProvider,{columnKey:l.columnKey,children:e.jsx(d,{id:s.IdGenerator.getTableCellId(l.rowIndex,l.colIndex),editable:null!==(i=C.editable)&&void 0!==i&&i,cellFormatClassName:l.cellFormatClassName,focusAtCell:o,onDoubleClickCellToEdit:r,preventPropagation:u,pasteData:p,isExistOnClickRow:l.isExistOnClickRow,isExistOnUpdateRow:!!l.onUpdateRow})})};
2
+ "use strict";var e=require("react/jsx-runtime"),t=require("../../hook.js"),l=require("./edit-button.js"),n=require("./string-input.js"),i=require("./number-input.js"),o=require("./select-input.js"),r=require("react"),s=require("../../libs/id-generator.js"),a=require("../provider.js"),c=require("../../sheet/providers.js"),u=r.memo((function(t){return e.jsx(e.Fragment,{children:"component"===t.type?t.component:e.jsx("div",{onDoubleClick:t.onDoubleClick,children:e.jsx("p",{className:"cell-data text-left whitespace-nowrap",children:t.component})})})})),d=r.memo((function(t){var s=a.useCellContext(),c=r.useRef(null);return e.jsx("td",{id:t.id,onPaste:function(e){null!==c.current&&(c.current.contains(document.activeElement)||(e.preventDefault(),t.isExistOnUpdateRow?t.pasteData(e.clipboardData.getData("text")):alert("ペースト機能が有効化されていません。")))},className:"".concat(t.cellFormatClassName),children:e.jsxs("div",{className:"relative",onClick:t.isExistOnClickRow?void 0:function(e){e.preventDefault(),t.focusAtCell()},onDoubleClick:t.isExistOnClickRow?void 0:t.onDoubleClickCellToEdit,children:[e.jsx("div",{id:"".concat(t.id,"-display"),children:e.jsxs("div",{className:"flex items-center gap-3 w-fit p-2 cursor-default",onClick:function(e){e.preventDefault(),e.stopPropagation(),t.focusAtCell()},children:[e.jsx(u,{type:s.type,component:s.component,onDoubleClick:t.onDoubleClickCellToEdit}),t.editable&&e.jsx(l.EditButton,{})]})}),t.editable&&e.jsxs("div",{id:"".concat(t.id,"-editor"),ref:c,className:"absolute top-0 left-0 w-full h-full grid place-items-center z-10 pr-2",onClick:t.preventPropagation,style:{opacity:0,pointerEvents:"none"},children:["string"===s.type&&e.jsx(n.StringCellInput,{}),"number"===s.type&&e.jsx(i.NumberCellInput,{}),"select"===s.type&&e.jsx(o.SelectCellInput,{})]})]})})}));exports.TableCell=function(l){var n,i=t.useCell(l.rowIndex,l.colIndex),o=i.focusAtCell,r=i.onDoubleClickCellToEdit,u=i.preventPropagation,p=i.pasteData,C=c.useColumnContext(l.columnKey);return e.jsx(a.CellProvider,{columnKey:l.columnKey,children:e.jsx(d,{id:s.IdGenerator.getTableCellId(l.rowIndex,l.colIndex),editable:null!==(n=C.editable)&&void 0!==n&&n,cellFormatClassName:l.cellFormatClassName,focusAtCell:o,onDoubleClickCellToEdit:r,preventPropagation:u,pasteData:p,isExistOnClickRow:l.isExistOnClickRow,isExistOnUpdateRow:!!l.onUpdateRow})})};
3
3
  //# sourceMappingURL=cell.js.map
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import{useCell as i}from"../../hook.js";import{EditButton as l}from"./edit-button.js";import{StringCellInput as n}from"./string-input.js";import{NumberCellInput as r}from"./number-input.js";import{SelectCellInput as a}from"./select-input.js";import{memo as c}from"react";import{IdGenerator as s}from"../../libs/id-generator.js";import{useCellContext as p,CellProvider as d}from"../provider.js";import{useColumnContext as m}from"../../sheet/providers.js";var u=c((function(o){return e(t,{children:"component"===o.type?o.component:e("div",{onDoubleClick:o.onDoubleClick,children:e("p",{className:"cell-data text-left whitespace-nowrap",children:o.component})})})})),f=c((function(t){var i=p();return e("td",{id:t.id,onPaste:function(e){e.preventDefault(),t.isExistOnUpdateRow?t.pasteData(e.clipboardData.getData("text")):alert("ペースト機能が有効化されていません。")},className:"".concat(t.cellFormatClassName),children:o("div",{className:"relative",onClick:t.isExistOnClickRow?void 0:function(e){e.preventDefault(),t.focusAtCell()},onDoubleClick:t.isExistOnClickRow?void 0:t.onDoubleClickCellToEdit,children:[e("div",{id:"".concat(t.id,"-display"),children:o("div",{className:"flex items-center gap-3 w-fit p-2 cursor-default",onClick:function(e){e.preventDefault(),e.stopPropagation(),t.focusAtCell()},children:[e(u,{type:i.type,component:i.component,onDoubleClick:t.onDoubleClickCellToEdit}),t.editable&&e(l,{})]})}),t.editable&&o("div",{id:"".concat(t.id,"-editor"),className:"absolute top-0 left-0 w-full h-full grid place-items-center z-10 pr-2",onClick:t.preventPropagation,style:{opacity:0,pointerEvents:"none"},children:["string"===i.type&&e(n,{}),"number"===i.type&&e(r,{}),"select"===i.type&&e(a,{})]})]})})}));function C(t){var o,l=i(t.rowIndex,t.colIndex),n=l.focusAtCell,r=l.onDoubleClickCellToEdit,a=l.preventPropagation,c=l.pasteData,p=m(t.columnKey);return e(d,{columnKey:t.columnKey,children:e(f,{id:s.getTableCellId(t.rowIndex,t.colIndex),editable:null!==(o=p.editable)&&void 0!==o&&o,cellFormatClassName:t.cellFormatClassName,focusAtCell:n,onDoubleClickCellToEdit:r,preventPropagation:a,pasteData:c,isExistOnClickRow:t.isExistOnClickRow,isExistOnUpdateRow:!!t.onUpdateRow})})}export{C as TableCell};
2
+ import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import{useCell as l}from"../../hook.js";import{EditButton as i}from"./edit-button.js";import{StringCellInput as n}from"./string-input.js";import{NumberCellInput as r}from"./number-input.js";import{SelectCellInput as a}from"./select-input.js";import{memo as c,useRef as s}from"react";import{IdGenerator as p}from"../../libs/id-generator.js";import{useCellContext as d,CellProvider as m}from"../provider.js";import{useColumnContext as u}from"../../sheet/providers.js";var f=c((function(o){return e(t,{children:"component"===o.type?o.component:e("div",{onDoubleClick:o.onDoubleClick,children:e("p",{className:"cell-data text-left whitespace-nowrap",children:o.component})})})})),C=c((function(t){var l=d(),c=s(null);return e("td",{id:t.id,onPaste:function(e){null!==c.current&&(c.current.contains(document.activeElement)||(e.preventDefault(),t.isExistOnUpdateRow?t.pasteData(e.clipboardData.getData("text")):alert("ペースト機能が有効化されていません。")))},className:"".concat(t.cellFormatClassName),children:o("div",{className:"relative",onClick:t.isExistOnClickRow?void 0:function(e){e.preventDefault(),t.focusAtCell()},onDoubleClick:t.isExistOnClickRow?void 0:t.onDoubleClickCellToEdit,children:[e("div",{id:"".concat(t.id,"-display"),children:o("div",{className:"flex items-center gap-3 w-fit p-2 cursor-default",onClick:function(e){e.preventDefault(),e.stopPropagation(),t.focusAtCell()},children:[e(f,{type:l.type,component:l.component,onDoubleClick:t.onDoubleClickCellToEdit}),t.editable&&e(i,{})]})}),t.editable&&o("div",{id:"".concat(t.id,"-editor"),ref:c,className:"absolute top-0 left-0 w-full h-full grid place-items-center z-10 pr-2",onClick:t.preventPropagation,style:{opacity:0,pointerEvents:"none"},children:["string"===l.type&&e(n,{}),"number"===l.type&&e(r,{}),"select"===l.type&&e(a,{})]})]})})}));function v(t){var o,i=l(t.rowIndex,t.colIndex),n=i.focusAtCell,r=i.onDoubleClickCellToEdit,a=i.preventPropagation,c=i.pasteData,s=u(t.columnKey);return e(m,{columnKey:t.columnKey,children:e(C,{id:p.getTableCellId(t.rowIndex,t.colIndex),editable:null!==(o=s.editable)&&void 0!==o&&o,cellFormatClassName:t.cellFormatClassName,focusAtCell:n,onDoubleClickCellToEdit:r,preventPropagation:a,pasteData:c,isExistOnClickRow:t.isExistOnClickRow,isExistOnUpdateRow:!!t.onUpdateRow})})}export{v as TableCell};
3
3
  //# sourceMappingURL=cell.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teppen/react-ui",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "React UI Component",
5
5
  "main": "dist/cjs/src/index.js",
6
6
  "module": "dist/esm/src/index.js",