16 lines
18 KiB
JavaScript
16 lines
18 KiB
JavaScript
|
"use strict";exports.id=8613,exports.ids=[8613],exports.modules={64417:(e,t,a)=>{a.d(t,{A:()=>u});var l=a(8732),s=a(82015),n=a.n(s),i=a(65388),r=a(84896),d=a(27825),o=a.n(d);function u({targetField:e,fieldIndex:t,tableFields:s,setTableFields:d,refreshFieldsListRef:u,setActiveEdit:c,database:m,currentTable:x,user:p}){let h=e?.dataType?e.dataType.replace(/\d|\(|\)/g,""):null,f=e?.dataType?e.dataType.replace(/[^\d]/g,""):"200",g=a(94327),v=n().useRef(o().cloneDeep(e)),y=n().useRef(),[N,j]=n().useState(e),[b,w]=n().useState(e?.fieldName),[T,_]=n().useState(h),[V,S]=n().useState(f),[F,I]=n().useState("Varchar is simply letters and numbers within the range 0 - 255"),[C,A]=n().useState(e?.richText&&!e?.encrypted?"Yes":"No"),k=!!T?.match(/uuid/i);return(0,l.jsx)("div",{className:"w-full -mt-3 bg-white dark:bg-slate-800 flex-wrap",ref:y,children:(0,l.jsxs)("form",{className:"flex flex-col xl:flex-row items-start gap-4 w-full justify-between border border-solid p-4 border-slate-200 dark:border-slate-600 rounded rounded-t-none focus:shadow-lg shadow-slate-700 dark:shadow-black relative flex-wrap",onSubmit:e=>{e.preventDefault(),d(e=>(e[t]=N,e)),u.current(e=>e+1);let a=e.target;a.closest(".table-field-wrapper")?.querySelector(".edit-table-field-section")?.classList.toggle("hidden")},children:[(0,l.jsxs)("div",{className:"gap-4 flex-wrap w-full md:w-auto flex-col xl:flex-row items-stretch",children:[(0,l.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,l.jsx)("label",{htmlFor:"new_field_name",children:"Field Name"}),(0,l.jsx)("input",{type:"text",name:"new_field_name",id:"new_field_name",placeholder:"Eg. post_title",onInput:async e=>{let t=e.target;t.value=t.value.toLowerCase().replace(/ /g,"_"),j(e=>(e.fieldName=t.value,e.updatedField=!0,e.originName||(e.originName=b),e))},required:!0,defaultValue:b})]}),(0,l.jsxs)("div",{className:"flex flex-col items-start gap-4 xl:gap-0.5",children:[(0,l.jsxs)("div",{className:"flex-wrap xl:flex-nowrap w-full md:w-auto",children:[(0,l.jsx)("label",{htmlFor:"new_field_data_type",children:"Data Type"}),(0,l.jsxs)("div",{className:"dropdown-wrapper reversed text-sm items-start",children:[(0,l.jsx)("span",{className:"px-2 bg-slate-200 dark:bg-slate-700 rounded-full hover:bg-slate-100 dark:hover:bg-slate-600 hidden xl:flex",children:"Info"}),(0,l.jsx)("div",{className:"dropdown mt-0 xl:-mt-2",children:(0,l.jsx)("span",{children:F})})]})]}),(0,l.jsxs)("div",{className:"w-auto",children:[(0,l.jsx)("select",{name:"new_field_data_type",id:"new_field_data_type",className:"w-full xl-w-auto",onChange:t=>{let a=t.target;_(a.value),a.childNodes.forEach(e=>{e.value===a.value&&e.dataset.desc&&I(e.dataset.desc),e.value===a.value&&e.dataset.literal?(N.defaultValueLiteral=e.dataset.literal,N.nullValue=!1):delete N.defaultValueLiteral}),e.dataType=a.value+(a.value.match(/VARCHAR/)?`(${V||200})`:"")},defaultValue:T||void 0,children:g.map((e,t)=>e.name.match(/VARCHAR/)?(0,l.jsx)("option",{value:e.name,"data-desc":e.description,children:e.title+"("+(V||200)+")"},t+1):(0,l.jsx)("option",{value:e.name,"data-desc":e.description,"data-literal":e.valueLiteral||void 0,children:e.title},t+1))}),T?.match(/VARCHAR/)&&(0,l.jsx)("input",{type:"number",defaultValue:V||200,className:"px-2",style:{maxWidth:"60px"},max:255,min:5,onChange:t=>{S(t.target.value),e.dataType=T+`(${t.target.value})`}})]})]}),T?.match(/text/i)&&(0,l.jsx)(n().Fragment,{children:(0,l.jsx)(r.A,{targetField:e})}),!e.dataType?.match(/text/i)&&!k&&(0,l.jsxs)("div",{className:"flex flex-col items-start gap-0.5",style:{minWidth:"70px"},children:[(0,l.jsx)("label",{htmlFor:"new_field_required",children:"Required?"}),(0,l.jsxs)("select",{name:"new_field_required",id:"new_field_required",className:"px-2",defaultValue:e?.notNullValue?"Yes":"No",onChange:t=>{console.log(e),"Yes"===t.target.value?e.notNullValue=!0:(e.notNullValue=!1,delete e.notNullValue)},children:[(0,l.jsx)("option",{value:"No",children:"No"}),(0,l.jsx)("option",{value:"Yes",children:"Yes"})]})]}),!k&&(0,l.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,l
|
||
|
Error Message: ${t}
|
||
|
Component: ${a}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
|
||
|
User Id: ${e?.id}
|
||
|
User Name: ${e?.first_name} ${e?.last_name}
|
||
|
User Email: ${e?.email}`),n?.url&&(s+=`
|
||
|
URL: ${n.url}`),n?.body&&(s+=`
|
||
|
Request Body: ${JSON.stringify(n.body,null,4)}`),r&&(s+=`
|
||
|
IP: ${r}`),s+=`
|
||
|
Date: ${i.toDateString()}
|
||
|
========================================`,l.existsSync("./.tmp/error.log")||l.writeFileSync("./.tmp/error.log","","utf-8");let d=l.readFileSync("./.tmp/error.log","utf-8");l.writeFileSync("./.tmp/error.log",s),l.appendFileSync("./.tmp/error.log",`
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
${d}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},94327:e=>{e.exports=JSON.parse('[{"title":"VARCHAR","name":"VARCHAR","value":"0-255","argument":true,"description":"Varchar is simply letters and numbers within the range 0 - 255","maxValue":255},{"title":"TINYINT","name":"TINYINT","value":"0-100","description":"TINYINT means Integers: 0 to 100","maxValue":127},{"title":"SMALLINT","name":"SMALLINT","value":"0-255","description":"SMALLINT means Integers: 0 to 240933","maxValue":32767},{"title":"MEDIUMINT","name":"MEDIUMINT","value":"0-255","description":"MEDIUMINT means Integers: 0 to 1245568545560","maxValue":8388607},{"title":"INT","name":"INT","value":"0-255","description":"INT means Integers: 0 to 12560","maxValue":2147483647},{"title":"BIGINT","name":"BIGINT","value":"0-255","description":"BIGINT means Integers: 0 to 1245569056767568545560","maxValue":2e+63},{"title":"TINYTEXT","name":"TINYTEXT","value":"0-255","description":"Text with 255 max characters","maxValue":127},{"title":"TEXT","name":"TEXT","value":"0-100","description":"MEDIUMTEXT is just text with max length 16,777,215","maxValue":127},{"title":"MEDIUMTEXT","name":"MEDIUMTEXT","value":"0-255","description":"MEDIUMTEXT is just text with max length 16,777,215","maxValue":127},{"title":"LONGTEXT","name":"LONGTEXT","value":"0-255","description":"LONGTEXT is just text with max length 4,294,967,295","maxValue":127},{"title":"UUID","name":"UUID","valueLiteral":"UUID()","description":"A Unique ID"}]')}};
|