1 line
9.9 KiB
JavaScript
1 line
9.9 KiB
JavaScript
|
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6830],{8032:(e,t,a)=>{a.d(t,{A:()=>v});var l=a(4848),i=a(6540),d=a(2675),s=a(9020),n=a(65),r=a(1342),o=a(1710),c=a(1580),u=a(2543),p=a.n(u),m=a(8845),f=a(3238),h=a(5143);function b(e){let{user:t,table:a,entry:d,url:s,query:n}=e,[r,o]=i.useState(!1),c=i.useRef(null);return(0,l.jsx)("div",{className:"relative z-[1000]",children:(0,l.jsx)(h.Popover,{isOpen:r,onClickOutside:()=>o(!1),containerClassName:"z-[1000]",positions:["bottom"],align:"end",content:(0,l.jsx)("div",{className:"bg-white dark:bg-slate-900 rounded shadow-md cancel-link",children:(0,l.jsxs)("div",{className:"flex-col min-w-[200px] items-stretch gap-0",children:[(0,l.jsx)("button",{className:"plain-text justify-start py-3",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(d)).then(()=>{window.alert("Post Copied"),o(!1)})},children:"Copy Object"}),(0,l.jsx)("hr",{className:"m-0"}),(0,l.jsx)("button",{className:"plain-text justify-start py-3",onClick:()=>{let e=(0,m.A)({paradigm:"JavaScript",table:a,query:n,user:t});navigator.clipboard.writeText(e||"").then(()=>{window.alert("JavaScript Type Definition Copied"),o(!1)})},children:"Copy JS Type Definition"}),(0,l.jsx)("hr",{className:"m-0"}),(0,l.jsx)("button",{className:"plain-text justify-start py-3",onClick:()=>{let e=(0,m.A)({paradigm:"TypeScript",table:a,query:n,user:t});navigator.clipboard.writeText(e||"").then(()=>{window.alert("TypeScript Type Definition Copied"),o(!1)})},children:"Copy TS Type Definition"}),(0,l.jsx)("hr",{className:"m-0"}),(0,l.jsx)("a",{href:s,className:"button plain-text justify-start py-3",children:(0,l.jsx)("span",{children:"View Entry"})})]})}),children:(0,l.jsx)("button",{onClick:()=>{o(!r)},ref:c,className:"ghost p-2",children:(0,l.jsx)(f.A,{})})})})}function v(e){var t,a,u,m,f;let{user:h,database:v,table:x,dbSchemaData:N,richTextEditors:y,jsonTextEditors:g,dataTypes:w,entry:j,entryPage:T,confirmedDelegetedUser:_,query:E}=e,C=x.fields.filter(e=>e.fieldName&&!e.fieldName.match(d.A)),S=x.fields.find(e=>"uuid"===e.fieldName),k=null==_?void 0:_.delegated;null==_||null===(t=_.priviledges)||void 0===t||t.match(/Edit Tables/i),null==_||null===(a=_.priviledges)||void 0===a||a.match(/Delete Tables/i),null==_||null===(u=_.priviledges)||void 0===u||u.match(/Create Tables/i),null==_||null===(m=_.priviledges)||void 0===m||m.match(/Edit Entries/i);let A=null==_?void 0:null===(f=_.priviledges)||void 0===f?void 0:f.match(/Delete Entries/i);S&&C.unshift({dataType:"UUID",fieldName:"uuid",defaultField:!0}),C.unshift({dataType:"BIGINT",fieldName:"id",defaultField:!0}),C.push({dataType:"VARCHAR(250)",fieldName:"date_created",defaultField:!0}),C.push({dataType:"BIGINT",fieldName:"date_created_code",defaultField:!0}),C.push({dataType:"TIMESTAMP",fieldName:"date_created_timestamp",defaultField:!0}),C.push({dataType:"VARCHAR(250)",fieldName:"date_updated",defaultField:!0}),C.push({dataType:"BIGINT",fieldName:"date_updated_code",defaultField:!0}),C.push({dataType:"TIMESTAMP",fieldName:"date_updated_timestamp",defaultField:!0});let[I,F]=i.useState(!1),[D,R]=i.useState(!0),[L,O]=i.useState(j),[M,P]=i.useState(!1);i.useRef(null);let U=i.useRef([]),[B,J]=i.useState("/admin/".concat(null==h?void 0:h.id,"/databases/").concat(v.db_slug,"/tables/").concat(x.tableName,"/entries/").concat(L.id));i.useEffect(()=>{(null==_?void 0:_.dbUserId)&&Number(h.id)!==Number(_.dbUserId)&&J("/admin/".concat(null==h?void 0:h.id,"/databases/").concat(v.db_slug,"/tables/").concat(x.tableName,"/entries/").concat(L.id)+window.location.search)},[]);let z="".concat(v.db_slug,"-").concat(x.tableName,"-").concat(L.id,"-submit-button");return(0,l.jsxs)("div",{className:"card col w-full overflow-hidden",children:[(0,l.jsx)("a",{href:B,onClick:e=>{let t=e.target;(t.closest(".cancel-link")||t.closest(".MuiPopover-root"))&&e.preventDefault()},className:"w-full",children:(0,l.jsxs)("div",{className:"w-full bg-slate-700 text-white py-2 px-4 rounded justify-between flex-wrap hover:bg-slate-800 cursor-pointer relative z-[1000] ",onClick:e=>{let t=e.target;t.closest(".c
|