najwer23morsels 1.10.7 → 1.10.9
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/lib/Table/index.js +1 -1
- package/package.json +1 -1
package/lib/Table/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as l}from"react/jsx-runtime";import{useState as a}from"react";import{B as t}from"../Button-QC014EKI.js";import{C as i}from"../Calendar-D7QM1Jwl.js";import{D as r}from"../Dialog-BSO4ohVZ.js";import{F as o}from"../Form-CgTuTB2Q.js";import{G as n}from"../Grid-DmI4tqqG.js";import{I as s}from"../Input-D8c36JF7.js";import{S as d}from"../Select-DSRwzuLg.js";import{T as c}from"../TextBox-__k4jPYK.js";import{T as m}from"../Typography-CZqNLAT7.js";import{s as p,g as b}from"../style-inject.es-CrVRO2OA.js";import"../Loader-ZYEBOkbx.js";import"../LoaderDots-BoEg_zlZ.js";import"../IconLocate-CQda7FAB.js";import"../index-uD0K440h.js";var u={n23mTable:"Table-module_n23mTable__kKVd9",table:"Table-module_table__hJFsY"};p("@layer n23mTable{.Table-module_n23mTable__kKVd9{background-attachment:local,local,scroll,scroll;background-color:#fff;background-image:linear-gradient(90deg,#fff 20px,hsla(0,0%,100%,0)),linear-gradient(270deg,#fff 20px,hsla(0,0%,100%,0)),radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.25),transparent),radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.25),transparent);background-position:0,100%,0,100%;background-repeat:no-repeat;background-size:40px 100%,40px 100%,14px 100%,14px 100%;overflow-x:auto}.Table-module_n23mTable__kKVd9:focus-visible{outline:2px solid currentcolor;outline-offset:2px}.Table-module_table__hJFsY{border-collapse:collapse;min-width:max-content;width:100%}.Table-module_table__hJFsY td,.Table-module_table__hJFsY th{border:1px solid grey;padding:10px 12px}.Table-module_table__hJFsY td[data-clickable=true]{cursor:pointer}}");const h=({className:p,jsonSchema:h,jsonData:g,handleCellEdit:f,handelCellDel:x,resetQueryCellEdit:T,isErrorCellEdit:k=!1,isPendingCellEdit:
|
|
1
|
+
import{jsxs as e,jsx as l}from"react/jsx-runtime";import{useState as a}from"react";import{B as t}from"../Button-QC014EKI.js";import{C as i}from"../Calendar-D7QM1Jwl.js";import{D as r}from"../Dialog-BSO4ohVZ.js";import{F as o}from"../Form-CgTuTB2Q.js";import{G as n}from"../Grid-DmI4tqqG.js";import{I as s}from"../Input-D8c36JF7.js";import{S as d}from"../Select-DSRwzuLg.js";import{T as c}from"../TextBox-__k4jPYK.js";import{T as m}from"../Typography-CZqNLAT7.js";import{s as p,g as b}from"../style-inject.es-CrVRO2OA.js";import"../Loader-ZYEBOkbx.js";import"../LoaderDots-BoEg_zlZ.js";import"../IconLocate-CQda7FAB.js";import"../index-uD0K440h.js";var u={n23mTable:"Table-module_n23mTable__kKVd9",table:"Table-module_table__hJFsY"};p("@layer n23mTable{.Table-module_n23mTable__kKVd9{background-attachment:local,local,scroll,scroll;background-color:#fff;background-image:linear-gradient(90deg,#fff 20px,hsla(0,0%,100%,0)),linear-gradient(270deg,#fff 20px,hsla(0,0%,100%,0)),radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.25),transparent),radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.25),transparent);background-position:0,100%,0,100%;background-repeat:no-repeat;background-size:40px 100%,40px 100%,14px 100%,14px 100%;overflow-x:auto}.Table-module_n23mTable__kKVd9:focus-visible{outline:2px solid currentcolor;outline-offset:2px}.Table-module_table__hJFsY{border-collapse:collapse;min-width:max-content;width:100%}.Table-module_table__hJFsY td,.Table-module_table__hJFsY th{border:1px solid grey;padding:10px 12px}.Table-module_table__hJFsY td[data-clickable=true]{cursor:pointer}}");const h=({className:p,jsonSchema:h,jsonData:g,handleCellEdit:f,handelCellDel:x,resetQueryCellEdit:T,isErrorCellEdit:k=!1,isPendingCellEdit:y=!1,isSuccessCellEdit:_=!1,errorMsgCellEdit:j,successMsgCellEdit:C,style:S,...N})=>{const[v,w]=a(!1),[E,z]=a(0),[D,V]=a(null),B=Boolean(f),F=h.cols.filter(e=>"id"!==e.cellName);return e("div",{className:[u.n23mTable,"n23mTable",p].filter(Boolean).join(" "),...N,style:{...b({}),...S},children:[B&&l(r,{open:v,onCancel:()=>{w(!1),T?.()},widthMax:"900px",children:e(n,{layout:"container",widthMin:"min(800px, calc(100vw - 25px))",padding:"0px 30px 30px 30px",margin:"auto",children:[l(m,{appearance:"light",variant:"subheading",style:{margin:"0 0 20px 0"},children:"Edit Cell"}),e(o,{onSubmit:e=>{if(!f)return;if(Object.values(e).some(({error:e})=>e))return;const l=Object.fromEntries(Object.entries(e).map(([e,{value:l}])=>[e,l]));f(l)},isError:k,isPending:y,isSuccess:_,errorMsg:j,successMsg:C,children:[l(n,{layout:"columns",col:{smallDesktop:2},gap:{col:"20px"},children:D&&h.cols.map(e=>{const a="id"===e.cellName,t=D[e.cellName];if("date"===e.cellType){const a=t||e.initialValue;return l(i,{label:e.cellText,name:e.cellName,initialValue:a,placeholder:e.cellText},e.cellName)}if("select"===e.cellType){const a=e.options.find(e=>e.value===String(t??""))??e.initialValue;return l(d,{name:e.cellName,options:e.options,initialValue:a},e.cellName)}return l(s,{label:e.cellText,name:e.cellName,type:e.cellType,step:"number"===e.cellType?.01:void 0,defaultValue:String(t??""),disabled:a,placeholder:e.cellText},e.cellName)})}),e(n,{layout:"flex",widthMax:"100%",padding:"0",justifyContent:x?"space-between":"flex-end",alignItems:"right",margin:"20px 0 0 0",children:[x&&l(t,{type:"button",height:"40px",width:"80px",padding:0,disabled:y,backgroundColor:"red",backgroundColorDisabled:"grey",onClick:()=>{x&&D&&(x(D.id),w(!1))},children:l(c,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"white",children:"Delete"})}),l(t,{type:"submit",height:"40px",width:"80px",padding:0,disabled:y,backgroundColor:"#4BB543",backgroundColorDisabled:"grey",children:l(c,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"white",children:"Save"})})]})]},E)]})}),e("table",{className:u.table,children:[l("thead",{children:l("tr",{children:F.map(e=>l("th",{scope:"col",children:l(c,{mobileSize:16,desktopSize:20,color:"black",textAlign:e.thAlign??"left",children:e.cellText})},e.cellName))})}),l("tbody",{children:g.rows.map(e=>l("tr",{children:F.map(a=>{const t=e[a.cellName];return l("td",{"data-clickable":B,onClick:B?()=>(e=>{V(e),w(!0),z(e=>e+1)})(e):void 0,children:l(c,{fontWeight:400,mobileSize:16,desktopSize:16,color:"black",textAlign:a.tdAlign??"left",children:void 0===t?"":String(t)})},a.cellName)})},e.id))})]})]})};h.displayName="Table";export{h as Table};
|