adminizer 4.3.0-build.105 → 4.3.0-build.107
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/assets/{add-GU2aUgZb.js → add-BbpbOeEO.js} +1 -1
- package/assets/add-form-COkaRNRA.js +1 -0
- package/assets/{app-D8oqdt8J.css → app-CH4xeI4n.css} +1 -1
- package/assets/app.js +2 -2
- package/assets/{catalog-CZ_wUlq2.js → catalog-BkwvblLc.js} +1 -1
- package/assets/field-renderer-BhrQ1BlC.js +1 -1
- package/assets/{form-CbwqHa8P.js → form-BK-psxud.js} +1 -1
- package/assets/{form-DMebrwNT.js → form-BgmYGTpi.js} +1 -1
- package/assets/{home-GaTaODxj.js → home-DtQs7vmj.js} +2 -2
- package/assets/{list-CdfSnSN1.js → list-DCZIbKAJ.js} +1 -1
- package/assets/{list-table-Byzv346I.js → list-table-CQDHdLv5.js} +1 -1
- package/assets/manifest.json +9 -9
- package/controllers/edit.js +9 -2
- package/lib/media-manager/DefaultMediaManager.js +2 -2
- package/package.json +1 -1
- package/assets/add-form-eJEMdv04.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as v,V as y,bw as m,j as e,B as p,bx as i,L as l,by as c}from"./app.js";import{r as d}from"./monaco-ICtx6xoc.js";import{LabelRenderer as x,LazyField as F}from"./add-form-
|
|
1
|
+
import{u as v,V as y,bw as m,j as e,B as p,bx as i,L as l,by as c}from"./app.js";import{r as d}from"./monaco-ICtx6xoc.js";import{LabelRenderer as x,LazyField as F}from"./add-form-COkaRNRA.js";import g from"./input-error--IOnWghB.js";import{F as w}from"./field-renderer-BhrQ1BlC.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";import"./icon-DM49pZW3.js";import"./dynamic-controls-BOYmRX_z.js";const B=()=>{const r=v(),{fields:t}=r.props,{data:o,setData:u,post:h,processing:a}=y(Object.fromEntries(t.map(s=>[s.name,s.value??void 0])));d.useEffect(()=>(m(),()=>{m()}),[]);const n=d.useCallback((s,b)=>{u(s,b)},[]),j=s=>{s.preventDefault(),h(r.props.postLink,{preserveState:!1})};return e.jsxs("div",{className:"p-4 w-full",children:[e.jsx("div",{className:"w-full sticky z-[1001] py-4 pb-8 top-0 h-fit bg-background flex gap-4 lg:hidden",children:e.jsxs(p,{variant:"green",type:"submit",className:"w-fit",form:"addUserForm",disabled:a||i(),children:[a&&e.jsx(l,{className:"h-4 w-4 animate-spin"}),r.props.btnSave.title]})}),e.jsx("form",{className:`mt-8 ${a?"invisible":""}`,id:"addUserForm",onSubmit:j,children:e.jsxs("div",{className:"grid lg:grid-cols-[1fr_150px] gap-4 max-w-[1144px] pb-8",children:[e.jsx("div",{className:"flex flex-col gap-10",children:t.map(s=>e.jsx("div",{className:"grid gap-4 w-full",children:s.type==="markdown"||s.type==="table"||s.type==="jsonEditor"||s.type==="codeEditor"||s.type==="geoJson"?e.jsxs(e.Fragment,{children:[e.jsx(x,{field:s}),e.jsx(g,{message:c(`${s.type}-${s.name}`)}),e.jsx(F,{field:s,value:o[s.name],onChange:n,processing:a})]}):e.jsxs(e.Fragment,{children:[e.jsx(x,{field:s}),e.jsx(g,{message:c(`${s.type}-${s.name}`)}),e.jsx(w,{field:s,value:o[s.name],onChange:n,processing:a})]})},s.name))}),e.jsx("div",{className:"p-4 rounded-md h-fit sticky top-[84px] shadow hidden lg:block",children:e.jsxs(p,{variant:"green",type:"submit",className:"w-fit",disabled:a||i(),children:[a&&e.jsx(l,{className:"h-4 w-4 animate-spin"}),r.props.btnSave.title]})})]})})]})};export{B as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./app.js","./jsoneditor-D95dIAP2.js","./vendor-wzZzN_Jv.js","./monaco-ICtx6xoc.js","./handsontable-PVakPtJV.js","./app-
|
|
2
|
-
import{_ as t}from"./jsoneditor-D95dIAP2.js";import{u as x,j as o,R as v,U as P}from"./app.js";import{r as l}from"./monaco-ICtx6xoc.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";const L=(i,n,_)=>{const r=i[n];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((p,m)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(m.bind(null,new Error("Unknown variable dynamic import: "+n+(n.split("/").length!==_?". Note that variables only represent file names one level deep.":""))))})};function V(){const i=x(),[n,_]=l.useState(null),[r,p]=l.useState(null),m=i.props.controls,c=async()=>{const{component:s,props:a}=m[0],E=(await L(Object.assign({"../components/VanillaJSONEditor.tsx":()=>t(()=>import("./app.js").then(e=>e.bM),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"../components/add-form.tsx":()=>t(()=>import("./add-form-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./app.js","./jsoneditor-D95dIAP2.js","./vendor-wzZzN_Jv.js","./monaco-ICtx6xoc.js","./handsontable-PVakPtJV.js","./app-CH4xeI4n.css","./add-form-COkaRNRA.js","./icon-DM49pZW3.js","./field-renderer-BhrQ1BlC.js","./dynamic-controls-BOYmRX_z.js","./field-renderer-CRNLShJD.css","./input-error--IOnWghB.js","./add-group-form-BNmpvW8K.js","./add-user-form-DrclnTOd.js","./material-icon-BedgD2NE.js","./app-shell-CHEYhVco.js","./app-sidebar-header-DdM1EOrb.js","./breadcrumbs-C439DWrC.js","./nav-user-CRAfyE-x.js","./user-info-CcYdmjMZ.js","./user-menu-content-DbUk8ZeY.js","./theme-switcher-CKiJbMkh.js","./app-sidebar-DeF8WNmW.js","./nav-main-9Eb_A0rf.js","./date-picker-DbJ8nHp5.js","./form-BgmYGTpi.js","./geo-json-CadjdhwW.js","./list-table-CQDHdLv5.js","./del-modal-_b3CSNHb.js","./pagination-render-xsEktzA8.js","./nav-footer-BwkQkwow.js","./toast-editor-BZM5RHph.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as t}from"./jsoneditor-D95dIAP2.js";import{u as x,j as o,R as v,U as P}from"./app.js";import{r as l}from"./monaco-ICtx6xoc.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";const L=(i,n,_)=>{const r=i[n];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((p,m)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(m.bind(null,new Error("Unknown variable dynamic import: "+n+(n.split("/").length!==_?". Note that variables only represent file names one level deep.":""))))})};function V(){const i=x(),[n,_]=l.useState(null),[r,p]=l.useState(null),m=i.props.controls,c=async()=>{const{component:s,props:a}=m[0],E=(await L(Object.assign({"../components/VanillaJSONEditor.tsx":()=>t(()=>import("./app.js").then(e=>e.bM),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"../components/add-form.tsx":()=>t(()=>import("./add-form-COkaRNRA.js"),__vite__mapDeps([6,0,1,2,3,4,5,7,8,9,10,11]),import.meta.url),"../components/add-group-form.tsx":()=>t(()=>import("./add-group-form-BNmpvW8K.js"),__vite__mapDeps([12,0,1,2,3,4,5,7]),import.meta.url),"../components/add-user-form.tsx":()=>t(()=>import("./add-user-form-DrclnTOd.js"),__vite__mapDeps([13,0,1,2,3,4,5,7,11,14]),import.meta.url),"../components/app-shell.tsx":()=>t(()=>import("./app-shell-CHEYhVco.js"),__vite__mapDeps([15,0,1,2,3,4,5]),import.meta.url),"../components/app-sidebar-header.tsx":()=>t(()=>import("./app-sidebar-header-DdM1EOrb.js").then(e=>e.a),__vite__mapDeps([16,0,1,2,3,4,5,17,18,19,20,21,7,14]),import.meta.url),"../components/app-sidebar.tsx":()=>t(()=>import("./app-sidebar-DeF8WNmW.js"),__vite__mapDeps([22,0,1,2,3,4,5,23,14]),import.meta.url),"../components/breadcrumbs.tsx":()=>t(()=>import("./breadcrumbs-C439DWrC.js"),__vite__mapDeps([17,0,1,2,3,4,5]),import.meta.url),"../components/date-picker.tsx":()=>t(()=>import("./date-picker-DbJ8nHp5.js"),__vite__mapDeps([24,0,1,2,3,4,5]),import.meta.url),"../components/dynamic-controls.tsx":()=>t(()=>import("./dynamic-controls-BOYmRX_z.js"),__vite__mapDeps([9,0,1,2,3,4,5]),import.meta.url),"../components/field-renderer.tsx":()=>t(()=>import("./field-renderer-BhrQ1BlC.js").then(e=>e.f),__vite__mapDeps([8,1,2,0,3,4,5,9,10]),import.meta.url),"../components/form.tsx":()=>t(()=>import("./form-BgmYGTpi.js"),__vite__mapDeps([25,0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url),"../components/geo-json.tsx":()=>t(()=>import("./geo-json-CadjdhwW.js"),__vite__mapDeps([26,0,1,2,3,4,5]),import.meta.url),"../components/handsontable.tsx":()=>t(()=>import("./app.js").then(e=>e.bN),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"../components/icon.tsx":()=>t(()=>import("./icon-DM49pZW3.js"),__vite__mapDeps([7,0,1,2,3,4,5]),import.meta.url),"../components/input-error.tsx":()=>t(()=>import("./input-error--IOnWghB.js"),__vite__mapDeps([11,0,1,2,3,4,5]),import.meta.url),"../components/list-table.tsx":()=>t(()=>import("./list-table-CQDHdLv5.js"),__vite__mapDeps([27,0,1,2,3,4,5,7,14,28,29]),import.meta.url),"../components/material-icon.tsx":()=>t(()=>import("./material-icon-BedgD2NE.js"),__vite__mapDeps([14,0,1,2,3,4,5]),import.meta.url),"../components/monaco-editor.tsx":()=>t(()=>import("./app.js").then(e=>e.bO),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"../components/multi-select.tsx":()=>t(()=>import("./app.js").then(e=>e.bP),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"../components/nav-footer.tsx":()=>t(()=>import("./nav-footer-BwkQkwow.js"),__vite__mapDeps([30,0,1,2,3,4,5,7]),import.meta.url),"../components/nav-main.tsx":()=>t(()=>import("./nav-main-9Eb_A0rf.js"),__vite__mapDeps([23,0,1,2,3,4,5,14]),import.meta.url),"../components/nav-user.tsx":()=>t(()=>import("./nav-user-CRAfyE-x.js"),__vite__mapDeps([18,0,1,2,3,4,5,19,20]),import.meta.url),"../components/pagination-render.tsx":()=>t(()=>import("./pagination-render-xsEktzA8.js"),__vite__mapDeps([29,0,1,2,3,4,5]),import.meta.url),"../components/theme-switcher.tsx":()=>t(()=>import("./theme-switcher-CKiJbMkh.js"),__vite__mapDeps([21,0,1,2,3,4,5,7]),import.meta.url),"../components/toast-editor.tsx":()=>t(()=>import("./toast-editor-BZM5RHph.js"),__vite__mapDeps([31,0,1,2,3,4,5]),import.meta.url),"../components/user-info.tsx":()=>t(()=>import("./user-info-CcYdmjMZ.js"),__vite__mapDeps([19,0,1,2,3,4,5]),import.meta.url),"../components/user-menu-content.tsx":()=>t(()=>import("./user-menu-content-DbUk8ZeY.js"),__vite__mapDeps([20,0,1,2,3,4,5,19]),import.meta.url)}),`../components/${s}.tsx`,3)).default;_(o.jsx(E,{...a}))},d=async()=>{const{component:s}=m[1],u=(await import(s)).default;p(o.jsx(u,{message:"Hello from Component B"}))};return o.jsxs(o.Fragment,{children:[o.jsx(v,{title:"Home"}),o.jsx("div",{children:o.jsx(P,{href:"/page",children:"Page"})}),o.jsx("div",{children:o.jsx("h1",{children:"Is Home"})}),o.jsxs("div",{children:[o.jsx("button",{onClick:c,children:"Загрузить компонент"}),o.jsx("p",{}),n||o.jsx("p",{children:"Нажмите кнопку, чтобы загрузить компонент"})]}),o.jsx("p",{}),o.jsxs("div",{children:[o.jsx("button",{onClick:d,children:"Загрузить компонент"}),o.jsx("p",{}),r||o.jsx("p",{children:"Нажмите кнопку, чтобы загрузить компонент"})]})]})}export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o}from"./app.js";import{A as r}from"./app-layout-i2zN9Rn-.js";import t from"./list-table-
|
|
1
|
+
import{j as o}from"./app.js";import{A as r}from"./app-layout-i2zN9Rn-.js";import t from"./list-table-CQDHdLv5.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";import"./app-shell-CHEYhVco.js";import"./app-sidebar-DeF8WNmW.js";import"./nav-main-9Eb_A0rf.js";import"./material-icon-BedgD2NE.js";import"./app-sidebar-header-DdM1EOrb.js";import"./breadcrumbs-C439DWrC.js";import"./nav-user-CRAfyE-x.js";import"./user-info-CcYdmjMZ.js";import"./user-menu-content-DbUk8ZeY.js";import"./theme-switcher-CKiJbMkh.js";import"./icon-DM49pZW3.js";import"./del-modal-_b3CSNHb.js";import"./pagination-render-xsEktzA8.js";const m=[],E=()=>o.jsx(r,{breadcrumbs:m,className:"overflow-auto h-[calc(100svh-16px)]",children:o.jsx(t,{})});export{E as default};
|
|
@@ -19,4 +19,4 @@ import{j as f,B as G,ao as Ue,ap as Ke,bC as Xe,I as Je,bD as De,a1 as Qe,a2 as
|
|
|
19
19
|
* LICENSE.md file in the root directory of this source tree.
|
|
20
20
|
*
|
|
21
21
|
* @license MIT
|
|
22
|
-
*/function ye(e,o){return e?rn(e)?_.createElement(e,o):e:null}function rn(e){return sn(e)||typeof e=="function"||ln(e)}function sn(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function ln(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function un(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=_.useState(()=>({current:bt(o)})),[n,r]=_.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...n,...e.state},onStateChange:s=>{r(s),e.onStateChange==null||e.onStateChange(s)}})),t.current}function an({columns:e,data:o,notFoundContent:t,globalSearch:n=!1,onGlobalSearch:r,searchValue:i,handleSearch:s,searchTxt:l}){var d;const u=_.useRef(null);_.useEffect(()=>{n&&u.current&&u.current.focus()});const a=un({data:o,columns:e,getCoreRowModel:en(),getPaginationRowModel:nn(),getSortedRowModel:on(),enableSorting:!1,manualPagination:!0});return f.jsxs("div",{className:"rounded-md border",children:[n&&r&&f.jsxs("div",{className:"flex gap-2 p-2",children:[f.jsx(Je,{ref:u,type:"text",value:i,placeholder:l,className:"w-full max-w-[200px] p-2 border rounded",onChange:p=>{r(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&s&&s()}}),f.jsx(G,{variant:"outline",size:"icon",onClick:s,children:f.jsx(O,{iconNode:De,className:"size-5"})})]}),f.jsxs(Qe,{wrapperHeight:"max-h-[65vh]",children:[f.jsx(Ze,{className:"sticky top-0 z-10 bg-background shadow",children:a.getHeaderGroups().map(p=>f.jsx(ne,{children:p.headers.map(c=>f.jsx(We,{children:c.isPlaceholder?null:ye(c.column.columnDef.header,c.getContext())},c.id))},p.id))}),f.jsx(Ye,{children:(d=a.getRowModel().rows)!=null&&d.length?a.getRowModel().rows.map(p=>f.jsx(ne,{"data-state":p.getIsSelected()&&"selected",children:p.getVisibleCells().map(c=>f.jsx(Re,{className:c.column.getIndex()===0?"sticky left-0 bg-background":"",children:ye(c.column.columnDef.cell,c.getContext())},c.id))},p.id)):f.jsx(ne,{children:f.jsx(Re,{colSpan:e.length,className:"h-24 text-center",children:t})})})]})]})}function gn(e,o,t,n){const r=Math.ceil(e/o),i=(t-1)*o+1,s=Math.min(t*o,e),l=[];l.push({label:"Previous",active:!1});let u=Math.max(1,t-Math.floor(n/2)),a=Math.min(r,u+n-1);a-u+1<n&&(u=Math.max(1,a-n+1));for(let d=u;d<=a;d++)l.push({label:d.toString(),active:d===t});return l.push({label:"Next",active:!1}),{total:e,per_page:o,current_page:t,last_page:r,next_page_url:t<r?!0:null,prev_page_url:t>1?!0:null,from:i,to:s,links:l,showPages:n}}const wn=()=>{var Ce;const e=be(),o=e.props.data,[t,n]=_.useState(!1),[r,i]=_.useState(""),[s,l]=_.useState(!1),[u,a]=_.useState(1),[d,p]=_.useState("5"),[c,g]=_.useState("1"),[m,h]=_.useState("desc"),R=_.useRef([]);_.useEffect(()=>{const v=new URLSearchParams(window.location.search);i(v.get("globalSearch")||""),l(!!v.get("globalSearch")),a(parseInt(v.get("page")||"1")),p(v.get("count")||"5"),g(v.get("column")||"1"),h(v.get("direction")||"desc");const F=v.getAll("searchColumn"),E=v.getAll("searchColumnValue");R.current=F.map((A,N)=>({key:A,value:E[N]}))},[]),_.useEffect(()=>{document.body.removeAttribute("style")},[o]);const w=_.useMemo(()=>gn(o.recordsFiltered,parseInt(d),u,5),[o.recordsFiltered,d,u,r]);_.useEffect(()=>{e.props.flash&&(e.props.flash.success&&xe.success(e.props.flash.success),e.props.flash.error&&xe.error(e.props.flash.error))},[e.props.flash]);const $=_.useCallback(v=>{p(v),a(1),n(!0),k.visit(`${e.props.header.entity.uri}?count=${v}&page=1`,{preserveState:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},[o]),x=_.useCallback((v,F,E,A)=>{const N=v!==void 0?v:u,y=F!==void 0?F:m,Te=E!==void 0?E:c,ve=A!==void 0?A:r,ke=`count=${d}&page=${N}&column=${Te}&direction=${y}`,Be=ve?`&globalSearch=${ve}`:"",qe=R.current.map(we=>`&searchColumn=${we.key}&searchColumnValue=${we.value}`).join("");return`${ke}${Be}${qe}`},[o,d,u,c,m,r]),I=_.useCallback(v=>{a(v),n(!0),k.visit(`${e.props.header.entity.uri}?${x(v)}`,{preserveState:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},[x,e.props.header.entity.uri]),V=_.useCallback((v,F)=>{g(v),h(F),n(!0),k.visit(`${e.props.header.entity.uri}?${x(void 0,F,v)}`,{preserveState:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},[d,u,r]),H=_.useCallback(v=>{i(v),a(1)},[]),T=_.useCallback(()=>{n(!0),k.visit(`${e.props.header.entity.uri}?${x(1)}`,{preserveState:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},[e.props.header.entity.uri,x]),X=_.useCallback((v,F)=>{a(1);const E=R.current.findIndex(A=>A.key===v);E>=0&&R.current.splice(E,1),F&&R.current.push({key:v,value:F})},[o]),te=()=>{l(!1),i(""),R.current=[],a(1),g("1"),h("desc"),k.visit(`${e.props.header.entity.uri}?count=${d}&page=1`,{preserveState:!0,preserveScroll:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},J=ft(e.props.columns,V,X,T,s),Q=_.useMemo(()=>[...[{accessorKey:"actions",header:()=>f.jsx("div",{className:"text-center",children:e.props.header.thActionsTitle}),cell:({row:F})=>{var E,A,N;return f.jsx("div",{className:"text-center",children:f.jsxs(_e,{children:[f.jsx($e,{asChild:!0,className:"cursor-pointer",children:f.jsx(G,{variant:"outline",size:"icon",children:f.jsx(Fe,{})})}),f.jsxs(Me,{className:"w-46",side:"right",align:"start",children:[f.jsxs(Ve,{children:[((E=e.props.header.crudActions)==null?void 0:E.editTitle)&&f.jsx(Z,{asChild:!0,className:"cursor-pointer",children:f.jsxs(B,{href:`${e.props.header.entity.uri}/edit/${F.original.id}`,children:[f.jsx(O,{iconNode:ut}),e.props.header.crudActions.editTitle]})}),((A=e.props.header.crudActions)==null?void 0:A.viewsTitle)&&f.jsx(Z,{asChild:!0,className:"cursor-pointer",children:f.jsxs(B,{href:`${e.props.header.entity.uri}/view/${F.original.id}`,children:[f.jsx(O,{iconNode:at}),e.props.header.crudActions.viewsTitle]})}),((N=e.props.header.crudActions)==null?void 0:N.deleteTitle)&&f.jsx(Z,{asChild:!0,className:"cursor-pointer",children:f.jsx(dt,{btnTitle:e.props.header.crudActions.deleteTitle,delModal:e.props.header.delModal,btnCLass:"font-normal text-destructive hover:text-destructive w-full cursor-pointer justify-start",link:`${e.props.header.entity.uri}/remove/${F.original.id}?referTo=${encodeURIComponent(window.location.search)}`})})]}),e.props.header.inlineActions&&e.props.header.inlineActions.length>0&&f.jsxs(f.Fragment,{children:[f.jsx(gt,{}),e.props.header.inlineActions.map(y=>f.jsx(Z,{asChild:!0,className:"cursor-pointer",children:y.type==="blank"?f.jsxs("a",{target:"_blank",href:y.link,children:[y.icon&&f.jsx(q,{name:y.icon,className:"!text-[18px] mr-2"}),f.jsx("span",{children:y.title})]}):f.jsxs(B,{href:`${y.link}/${F.original.id}?id=${F.original.id}&entity=${e.props.header.entity.name}`,children:[y.icon&&f.jsx(q,{name:y.icon,className:"!text-[18px] mr-2"}),f.jsx("span",{children:y.title})]})},y.id))]})]})]})})}}],...J],[e.props.header.thActionsTitle,e.props.header.crudActions,e.props.header.inlineActions,e.props.header.entity.uri,e.props.header.entity.name,e.props.header.delModal,J]);return f.jsxs(f.Fragment,{children:[f.jsx(et,{position:"top-center",richColors:!0,closeButton:!0}),f.jsxs("div",{className:`flex h-auto flex-1 flex-col gap-4 rounded-xl p-4 ${t?"opacity-50":""}`,children:[f.jsxs("div",{className:"flex gap-2 sticky top-0 z-10 bg-background py-3",children:[((Ce=e.props.header.crudActions)==null?void 0:Ce.createTitle)&&f.jsx(G,{asChild:!0,children:f.jsxs(B,{href:`${e.props.header.entity.uri}/add`,children:[f.jsx(O,{iconNode:tt}),e.props.header.crudActions.createTitle]})}),f.jsxs(G,{className:"transition-none cursor-pointer",variant:s?"destructive":"outline",onClick:()=>{s?te():l(!0)},children:[f.jsx(O,{iconNode:s?nt:De}),s?e.props.header.resetBtn:e.props.header.searchBtn]}),e.props.header.actions.length>0&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"gap-2 ml-6 hidden lg:flex",children:e.props.header.actions.map(v=>f.jsx(G,{asChild:!0,variant:"outline",children:v.type==="blank"?f.jsxs("a",{href:v.link,target:"_blank",children:[v.icon&&f.jsx(q,{name:v.icon,className:"!text-[18px]"}),v.title]}):f.jsxs(B,{href:v.link,children:[v.icon&&f.jsx(q,{name:v.icon,className:"!text-[18px]"}),v.title]})},v.id))||null}),f.jsx("div",{className:"block lg:hidden ml-6",children:f.jsxs(_e,{children:[f.jsx($e,{asChild:!0,children:f.jsx(G,{variant:"outline",size:"icon",children:f.jsx(Fe,{})})}),f.jsx(Me,{className:"w-fit",side:"right",align:"start",children:f.jsx(Ve,{className:"grid gap-2",children:e.props.header.actions.map(v=>f.jsx(G,{asChild:!0,variant:"outline",children:f.jsxs("a",{href:v.link,target:"_blank",children:[f.jsx(q,{name:v.icon,className:"!text-[18px]"}),v.title]})},v.id))||null})})]})})]})]}),f.jsx(an,{columns:Q,data:o.data,searchValue:r,searchTxt:e.props.header.searchBtn,notFoundContent:e.props.header.notFoundContent,globalSearch:s,onGlobalSearch:H,handleSearch:T}),f.jsxs("div",{className:"mt-4 flex flex-wrap justify-center md:justify-between gap-4 items-end",children:[f.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-1 gap-4 items-center justify-items-center md:justify-items-normal",children:[f.jsxs("p",{className:"text-sm text-foreground/70",children:["Show ",w.from," - ",w.to," of ",w.total]}),f.jsx("div",{className:"max-w-fit",children:f.jsxs(ot,{onValueChange:v=>$(v),value:d,children:[f.jsx(rt,{className:"w-full cursor-pointer",children:f.jsx(it,{placeholder:d})}),f.jsx(st,{children:["5","10","50"].map(v=>f.jsx(lt,{value:v,children:v},v))})]})})]}),f.jsx("div",{children:o.data.length>0&&f.jsx(ct,{pagination:w,pageChange:I,currentPage:u})})]})]})]})};export{wn as default};
|
|
22
|
+
*/function ye(e,o){return e?rn(e)?_.createElement(e,o):e:null}function rn(e){return sn(e)||typeof e=="function"||ln(e)}function sn(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function ln(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function un(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=_.useState(()=>({current:bt(o)})),[n,r]=_.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...n,...e.state},onStateChange:s=>{r(s),e.onStateChange==null||e.onStateChange(s)}})),t.current}function an({columns:e,data:o,notFoundContent:t,globalSearch:n=!1,onGlobalSearch:r,searchValue:i,handleSearch:s,searchTxt:l}){var d;const u=_.useRef(null);_.useEffect(()=>{n&&u.current&&u.current.focus()});const a=un({data:o,columns:e,getCoreRowModel:en(),getPaginationRowModel:nn(),getSortedRowModel:on(),enableSorting:!1,manualPagination:!0});return f.jsxs("div",{className:"rounded-md border",children:[n&&r&&f.jsxs("div",{className:"flex gap-2 p-2",children:[f.jsx(Je,{ref:u,type:"text",value:i,placeholder:l,className:"w-full max-w-[200px] p-2 border rounded",onChange:p=>{r(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&s&&s()}}),f.jsx(G,{variant:"outline",size:"icon",onClick:s,children:f.jsx(O,{iconNode:De,className:"size-5"})})]}),f.jsxs(Qe,{wrapperHeight:"max-h-[65vh]",children:[f.jsx(Ze,{className:"sticky top-0 z-10 bg-background shadow",children:a.getHeaderGroups().map(p=>f.jsx(ne,{children:p.headers.map(c=>f.jsx(We,{children:c.isPlaceholder?null:ye(c.column.columnDef.header,c.getContext())},c.id))},p.id))}),f.jsx(Ye,{children:(d=a.getRowModel().rows)!=null&&d.length?a.getRowModel().rows.map(p=>f.jsx(ne,{"data-state":p.getIsSelected()&&"selected",children:p.getVisibleCells().map(c=>f.jsx(Re,{className:c.column.getIndex()===0?"sticky left-0 bg-background":"",children:ye(c.column.columnDef.cell,c.getContext())},c.id))},p.id)):f.jsx(ne,{children:f.jsx(Re,{colSpan:e.length,className:"h-24 text-center",children:t})})})]})]})}function gn(e,o,t,n){const r=Math.ceil(e/o),i=(t-1)*o+1,s=Math.min(t*o,e),l=[];l.push({label:"Previous",active:!1});let u=Math.max(1,t-Math.floor(n/2)),a=Math.min(r,u+n-1);a-u+1<n&&(u=Math.max(1,a-n+1));for(let d=u;d<=a;d++)l.push({label:d.toString(),active:d===t});return l.push({label:"Next",active:!1}),{total:e,per_page:o,current_page:t,last_page:r,next_page_url:t<r?!0:null,prev_page_url:t>1?!0:null,from:i,to:s,links:l,showPages:n}}const wn=()=>{var Ce;const e=be(),o=e.props.data,[t,n]=_.useState(!1),[r,i]=_.useState(""),[s,l]=_.useState(!1),[u,a]=_.useState(1),[d,p]=_.useState("5"),[c,g]=_.useState("1"),[m,h]=_.useState("desc"),R=_.useRef([]);_.useEffect(()=>{const v=new URLSearchParams(window.location.search);i(v.get("globalSearch")||""),l(!!v.get("globalSearch")),a(parseInt(v.get("page")||"1")),p(v.get("count")||"5"),g(v.get("column")||"1"),h(v.get("direction")||"desc");const F=v.getAll("searchColumn"),E=v.getAll("searchColumnValue");R.current=F.map((A,N)=>({key:A,value:E[N]}))},[]),_.useEffect(()=>{document.body.removeAttribute("style")},[o]);const w=_.useMemo(()=>gn(o.recordsFiltered,parseInt(d),u,5),[o.recordsFiltered,d,u,r]);_.useEffect(()=>{e.props.flash&&(e.props.flash.success&&xe.success(e.props.flash.success),e.props.flash.error&&xe.error(e.props.flash.error))},[e.props.flash]);const $=_.useCallback(v=>{p(v),a(1),n(!0),k.visit(`${e.props.header.entity.uri}?count=${v}&page=1`,{preserveState:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},[o]),x=_.useCallback((v,F,E,A)=>{const N=v!==void 0?v:u,y=F!==void 0?F:m,Te=E!==void 0?E:c,ve=A!==void 0?A:r,ke=`count=${d}&page=${N}&column=${Te}&direction=${y}`,Be=ve?`&globalSearch=${ve}`:"",qe=R.current.map(we=>`&searchColumn=${we.key}&searchColumnValue=${we.value}`).join("");return`${ke}${Be}${qe}`},[o,d,u,c,m,r]),I=_.useCallback(v=>{a(v),n(!0),k.visit(`${e.props.header.entity.uri}?${x(v)}`,{preserveState:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},[x,e.props.header.entity.uri]),V=_.useCallback((v,F)=>{g(v),h(F),n(!0),k.visit(`${e.props.header.entity.uri}?${x(void 0,F,v)}`,{preserveState:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},[d,u,r]),H=_.useCallback(v=>{i(v),a(1)},[]),T=_.useCallback(()=>{n(!0),k.visit(`${e.props.header.entity.uri}?${x(1)}`,{preserveState:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},[e.props.header.entity.uri,x]),X=_.useCallback((v,F)=>{a(1);const E=R.current.findIndex(A=>A.key===v);E>=0&&R.current.splice(E,1),F&&R.current.push({key:v,value:F})},[o]),te=()=>{l(!1),i(""),R.current=[],a(1),g("1"),h("desc"),k.visit(`${e.props.header.entity.uri}?count=${d}&page=1`,{preserveState:!0,preserveScroll:!0,only:["data","columns","header"],onSuccess:()=>n(!1)})},J=ft(e.props.columns,V,X,T,s),Q=_.useMemo(()=>[...[{accessorKey:"actions",header:()=>f.jsx("div",{className:"text-center",children:e.props.header.thActionsTitle}),cell:({row:F})=>{var E,A,N;return f.jsx("div",{className:"text-center",children:f.jsxs(_e,{children:[f.jsx($e,{asChild:!0,className:"cursor-pointer",children:f.jsx(G,{variant:"outline",size:"icon",children:f.jsx(Fe,{})})}),f.jsxs(Me,{className:"w-46",side:"right",align:"start",children:[f.jsxs(Ve,{children:[((E=e.props.header.crudActions)==null?void 0:E.editTitle)&&f.jsx(Z,{asChild:!0,className:"cursor-pointer",children:f.jsxs(B,{href:`${e.props.header.entity.uri}/edit/${F.original.id}`,onClick:()=>{localStorage.setItem("backUrl",window.location.pathname+window.location.search)},children:[f.jsx(O,{iconNode:ut}),e.props.header.crudActions.editTitle]})}),((A=e.props.header.crudActions)==null?void 0:A.viewsTitle)&&f.jsx(Z,{asChild:!0,className:"cursor-pointer",children:f.jsxs(B,{href:`${e.props.header.entity.uri}/view/${F.original.id}`,children:[f.jsx(O,{iconNode:at}),e.props.header.crudActions.viewsTitle]})}),((N=e.props.header.crudActions)==null?void 0:N.deleteTitle)&&f.jsx(Z,{asChild:!0,className:"cursor-pointer",children:f.jsx(dt,{btnTitle:e.props.header.crudActions.deleteTitle,delModal:e.props.header.delModal,btnCLass:"font-normal text-destructive hover:text-destructive w-full cursor-pointer justify-start",link:`${e.props.header.entity.uri}/remove/${F.original.id}?referTo=${encodeURIComponent(window.location.search)}`})})]}),e.props.header.inlineActions&&e.props.header.inlineActions.length>0&&f.jsxs(f.Fragment,{children:[f.jsx(gt,{}),e.props.header.inlineActions.map(y=>f.jsx(Z,{asChild:!0,className:"cursor-pointer",children:y.type==="blank"?f.jsxs("a",{target:"_blank",href:y.link,children:[y.icon&&f.jsx(q,{name:y.icon,className:"!text-[18px] mr-2"}),f.jsx("span",{children:y.title})]}):f.jsxs(B,{href:`${y.link}/${F.original.id}?id=${F.original.id}&entity=${e.props.header.entity.name}`,children:[y.icon&&f.jsx(q,{name:y.icon,className:"!text-[18px] mr-2"}),f.jsx("span",{children:y.title})]})},y.id))]})]})]})})}}],...J],[e.props.header.thActionsTitle,e.props.header.crudActions,e.props.header.inlineActions,e.props.header.entity.uri,e.props.header.entity.name,e.props.header.delModal,J]);return f.jsxs(f.Fragment,{children:[f.jsx(et,{position:"top-center",richColors:!0,closeButton:!0}),f.jsxs("div",{className:`flex h-auto flex-1 flex-col gap-4 rounded-xl p-4 ${t?"opacity-50":""}`,children:[f.jsxs("div",{className:"flex gap-2 sticky top-0 z-10 bg-background py-3",children:[((Ce=e.props.header.crudActions)==null?void 0:Ce.createTitle)&&f.jsx(G,{asChild:!0,children:f.jsxs(B,{href:`${e.props.header.entity.uri}/add`,children:[f.jsx(O,{iconNode:tt}),e.props.header.crudActions.createTitle]})}),f.jsxs(G,{className:"transition-none cursor-pointer",variant:s?"destructive":"outline",onClick:()=>{s?te():l(!0)},children:[f.jsx(O,{iconNode:s?nt:De}),s?e.props.header.resetBtn:e.props.header.searchBtn]}),e.props.header.actions.length>0&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"gap-2 ml-6 hidden lg:flex",children:e.props.header.actions.map(v=>f.jsx(G,{asChild:!0,variant:"outline",children:v.type==="blank"?f.jsxs("a",{href:v.link,target:"_blank",children:[v.icon&&f.jsx(q,{name:v.icon,className:"!text-[18px]"}),v.title]}):f.jsxs(B,{href:v.link,children:[v.icon&&f.jsx(q,{name:v.icon,className:"!text-[18px]"}),v.title]})},v.id))||null}),f.jsx("div",{className:"block lg:hidden ml-6",children:f.jsxs(_e,{children:[f.jsx($e,{asChild:!0,children:f.jsx(G,{variant:"outline",size:"icon",children:f.jsx(Fe,{})})}),f.jsx(Me,{className:"w-fit",side:"right",align:"start",children:f.jsx(Ve,{className:"grid gap-2",children:e.props.header.actions.map(v=>f.jsx(G,{asChild:!0,variant:"outline",children:f.jsxs("a",{href:v.link,target:"_blank",children:[f.jsx(q,{name:v.icon,className:"!text-[18px]"}),v.title]})},v.id))||null})})]})})]})]}),f.jsx(an,{columns:Q,data:o.data,searchValue:r,searchTxt:e.props.header.searchBtn,notFoundContent:e.props.header.notFoundContent,globalSearch:s,onGlobalSearch:H,handleSearch:T}),f.jsxs("div",{className:"mt-4 flex flex-wrap justify-center md:justify-between gap-4 items-end",children:[f.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-1 gap-4 items-center justify-items-center md:justify-items-normal",children:[f.jsxs("p",{className:"text-sm text-foreground/70",children:["Show ",w.from," - ",w.to," of ",w.total]}),f.jsx("div",{className:"max-w-fit",children:f.jsxs(ot,{onValueChange:v=>$(v),value:d,children:[f.jsx(rt,{className:"w-full cursor-pointer",children:f.jsx(it,{placeholder:d})}),f.jsx(st,{children:["5","10","50"].map(v=>f.jsx(lt,{value:v,children:v},v))})]})})]}),f.jsx("div",{children:o.data.length>0&&f.jsx(ct,{pagination:w,pageChange:I,currentPage:u})})]})]})]})};export{wn as default};
|
package/assets/manifest.json
CHANGED
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"src/assets/js/pages/welcome.tsx"
|
|
172
172
|
],
|
|
173
173
|
"css": [
|
|
174
|
-
"app-
|
|
174
|
+
"app-CH4xeI4n.css"
|
|
175
175
|
],
|
|
176
176
|
"assets": [
|
|
177
177
|
"material-icons-kAwBdRge.woff2",
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
]
|
|
188
188
|
},
|
|
189
189
|
"src/assets/js/components/add-form.tsx": {
|
|
190
|
-
"file": "add-form-
|
|
190
|
+
"file": "add-form-COkaRNRA.js",
|
|
191
191
|
"name": "add-form",
|
|
192
192
|
"src": "src/assets/js/components/add-form.tsx",
|
|
193
193
|
"isDynamicEntry": true,
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
]
|
|
302
302
|
},
|
|
303
303
|
"src/assets/js/components/form.tsx": {
|
|
304
|
-
"file": "form-
|
|
304
|
+
"file": "form-BgmYGTpi.js",
|
|
305
305
|
"name": "form",
|
|
306
306
|
"src": "src/assets/js/components/form.tsx",
|
|
307
307
|
"isDynamicEntry": true,
|
|
@@ -358,7 +358,7 @@
|
|
|
358
358
|
]
|
|
359
359
|
},
|
|
360
360
|
"src/assets/js/components/list-table.tsx": {
|
|
361
|
-
"file": "list-table-
|
|
361
|
+
"file": "list-table-CQDHdLv5.js",
|
|
362
362
|
"name": "list-table",
|
|
363
363
|
"src": "src/assets/js/components/list-table.tsx",
|
|
364
364
|
"isDynamicEntry": true,
|
|
@@ -570,7 +570,7 @@
|
|
|
570
570
|
]
|
|
571
571
|
},
|
|
572
572
|
"src/assets/js/pages/add.tsx": {
|
|
573
|
-
"file": "add-
|
|
573
|
+
"file": "add-BbpbOeEO.js",
|
|
574
574
|
"name": "add",
|
|
575
575
|
"src": "src/assets/js/pages/add.tsx",
|
|
576
576
|
"isDynamicEntry": true,
|
|
@@ -599,7 +599,7 @@
|
|
|
599
599
|
]
|
|
600
600
|
},
|
|
601
601
|
"src/assets/js/pages/catalog.tsx": {
|
|
602
|
-
"file": "catalog-
|
|
602
|
+
"file": "catalog-BkwvblLc.js",
|
|
603
603
|
"name": "catalog",
|
|
604
604
|
"src": "src/assets/js/pages/catalog.tsx",
|
|
605
605
|
"isDynamicEntry": true,
|
|
@@ -660,7 +660,7 @@
|
|
|
660
660
|
]
|
|
661
661
|
},
|
|
662
662
|
"src/assets/js/pages/form.tsx": {
|
|
663
|
-
"file": "form-
|
|
663
|
+
"file": "form-BK-psxud.js",
|
|
664
664
|
"name": "form",
|
|
665
665
|
"src": "src/assets/js/pages/form.tsx",
|
|
666
666
|
"isDynamicEntry": true,
|
|
@@ -690,7 +690,7 @@
|
|
|
690
690
|
]
|
|
691
691
|
},
|
|
692
692
|
"src/assets/js/pages/home.tsx": {
|
|
693
|
-
"file": "home-
|
|
693
|
+
"file": "home-DtQs7vmj.js",
|
|
694
694
|
"name": "home",
|
|
695
695
|
"src": "src/assets/js/pages/home.tsx",
|
|
696
696
|
"isDynamicEntry": true,
|
|
@@ -747,7 +747,7 @@
|
|
|
747
747
|
]
|
|
748
748
|
},
|
|
749
749
|
"src/assets/js/pages/list.tsx": {
|
|
750
|
-
"file": "list-
|
|
750
|
+
"file": "list-DCZIbKAJ.js",
|
|
751
751
|
"name": "list",
|
|
752
752
|
"src": "src/assets/js/pages/list.tsx",
|
|
753
753
|
"isDynamicEntry": true,
|
package/controllers/edit.js
CHANGED
|
@@ -44,6 +44,8 @@ export default async function edit(req, res) {
|
|
|
44
44
|
fields = await FieldsHelper.loadAssociations(req, fields, "edit");
|
|
45
45
|
// Save
|
|
46
46
|
if (req.method.toUpperCase() === 'POST') {
|
|
47
|
+
const backUrl = req.body.redirectUrl;
|
|
48
|
+
delete req.body.redirectUrl;
|
|
47
49
|
let reqData = RequestProcessor.processRequest(req, fields);
|
|
48
50
|
let params = {};
|
|
49
51
|
params[entity.config.identifierField || req.adminizer.config.identifierField] = req.params.id;
|
|
@@ -112,7 +114,7 @@ export default async function edit(req, res) {
|
|
|
112
114
|
}
|
|
113
115
|
try {
|
|
114
116
|
let newRecord = await entity.model.update(params, reqData, dataAccessor);
|
|
115
|
-
await saveRelationsMediaManager(req.adminizer, fields, rawReqData, entity.model.
|
|
117
|
+
await saveRelationsMediaManager(req.adminizer, fields, rawReqData, entity.model.modelname, newRecord[0].id);
|
|
116
118
|
Adminizer.log.debug(`Record was updated: `, newRecord);
|
|
117
119
|
if (req.body.jsonPopupCatalog) {
|
|
118
120
|
return res.json({ record: newRecord });
|
|
@@ -130,7 +132,12 @@ export default async function edit(req, res) {
|
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
134
|
req.flash.setFlashMessage('success', req.i18n.__('Record was updated'));
|
|
133
|
-
|
|
135
|
+
if (backUrl) {
|
|
136
|
+
return req.Inertia.redirect(backUrl);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
return req.Inertia.redirect(`${req.adminizer.config.routePrefix}/model/${entity.name}`);
|
|
140
|
+
}
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
143
|
catch (e) {
|
|
@@ -57,7 +57,7 @@ export class DefaultMediaManager extends AbstractMediaManager {
|
|
|
57
57
|
}
|
|
58
58
|
async setRelations(data, model, modelId, widgetName) {
|
|
59
59
|
let modelAssociations = await this.adminizer.modelHandler.model.get(this.modelAssoc)["_find"]({
|
|
60
|
-
where: { modelId: modelId, model: model.toLowerCase(), widgetName: widgetName },
|
|
60
|
+
where: { modelId: +modelId, model: model.toLowerCase(), widgetName: widgetName },
|
|
61
61
|
});
|
|
62
62
|
for (const modelAssociation of modelAssociations) {
|
|
63
63
|
const q = {};
|
|
@@ -70,7 +70,7 @@ export class DefaultMediaManager extends AbstractMediaManager {
|
|
|
70
70
|
await this.adminizer.modelHandler.model.get(this.modelAssoc)["_create"]({
|
|
71
71
|
mediaManagerId: this.id,
|
|
72
72
|
model: model.toLowerCase(),
|
|
73
|
-
modelId: modelId,
|
|
73
|
+
modelId: +modelId,
|
|
74
74
|
[fieldName]: widgetItem.id,
|
|
75
75
|
widgetName: widgetName,
|
|
76
76
|
sortOrder: key + 1,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{V as O,bw as k,j as s,B as F,U as V,aD as z,bx as R,L as S,by as $,f as A,a as L,l as P,H as D,J as U,K as J,aE as H,M as K,g as q}from"./app.js";import{r as u}from"./monaco-ICtx6xoc.js";import{Icon as _}from"./icon-DM49pZW3.js";import{F as M}from"./field-renderer-BhrQ1BlC.js";import T from"./input-error--IOnWghB.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";import"./dynamic-controls-BOYmRX_z.js";var C=new Map,N=new WeakMap,B=0,G=void 0;function Q(e){return e?(N.has(e)||(B+=1,N.set(e,B.toString())),N.get(e)):"0"}function X(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?Q(e.root):e[t]}`).toString()}function Y(e){const t=X(e);let a=C.get(t);if(!a){const i=new Map;let d;const c=new IntersectionObserver(o=>{o.forEach(n=>{var l;const v=n.isIntersecting&&d.some(p=>n.intersectionRatio>=p);e.trackVisibility&&typeof n.isVisible>"u"&&(n.isVisible=v),(l=i.get(n.target))==null||l.forEach(p=>{p(v,n)})})},e);d=c.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),a={id:t,observer:c,elements:i},C.set(t,a)}return a}function Z(e,t,a={},i=G){if(typeof window.IntersectionObserver>"u"&&i!==void 0){const l=e.getBoundingClientRect();return t(i,{isIntersecting:i,target:e,intersectionRatio:typeof a.threshold=="number"?a.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:d,observer:c,elements:o}=Y(a),n=o.get(e)||[];return o.has(e)||o.set(e,n),n.push(t),c.observe(e),function(){n.splice(n.indexOf(t),1),n.length===0&&(o.delete(e),c.unobserve(e)),o.size===0&&(c.disconnect(),C.delete(d))}}function W({threshold:e,delay:t,trackVisibility:a,rootMargin:i,root:d,triggerOnce:c,skip:o,initialInView:n,fallbackInView:l,onChange:v}={}){var p;const[j,E]=u.useState(null),m=u.useRef(v),[h,y]=u.useState({inView:!!n,entry:void 0});m.current=v,u.useEffect(()=>{if(o||!j)return;let g;return g=Z(j,(r,f)=>{y({inView:r,entry:f}),m.current&&m.current(r,f),f.isIntersecting&&c&&g&&(g(),g=void 0)},{root:d,rootMargin:i,threshold:e,trackVisibility:a,delay:t},l),()=>{g&&g()}},[Array.isArray(e)?e.toString():e,j,d,i,c,o,a,l,t]);const b=(p=h.entry)==null?void 0:p.target,w=u.useRef(void 0);!j&&b&&!c&&!o&&w.current!==b&&(w.current=b,y({inView:!!n,entry:void 0}));const x=[E,h.inView,h.entry];return x.ref=x[0],x.inView=x[1],x.entry=x[2],x}const I=u.memo(({field:e})=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx(L,{htmlFor:`${e.type}-${e.name}`,children:e.label}),e.tooltip&&s.jsx(D,{children:s.jsxs(U,{children:[s.jsx(J,{onClick:t=>t.preventDefault(),children:s.jsx(_,{iconNode:H,className:"text-primary w-5 h-5 cursor-pointer"})}),s.jsx(K,{align:"center",side:"top",className:"z-[1002]",children:s.jsx("p",{children:e.tooltip})})]})})]})),ee=u.memo(({field:e,value:t,onChange:a,processing:i,notFound:d,search:c})=>{const[o,n]=W({triggerOnce:!0,rootMargin:"100px 0px"});return s.jsx("div",{ref:o,className:"grid gap-4 w-full",children:n?s.jsx(M,{field:e,value:t,onChange:a,notFound:d,search:c,processing:i}):s.jsx(P,{className:"w-full h-[250px] rounded-sm"})})}),de=({page:e,catalog:t,callback:a,openNewWindow:i,openNewWindowLabel:d,isNavigation:c})=>{const{fields:o,btnBack:n,view:l,notFound:v}=e.props,{data:p,setData:j,post:E,processing:m}=O({...Object.fromEntries(o.map(r=>[r.name,r.value??void 0])),jsonPopupCatalog:t}),[h,y]=u.useState(!1),[b,w]=u.useState(i??!1);u.useEffect(()=>(w(i??!1),k(),j({...Object.fromEntries(o.map(r=>[r.name,r.value??void 0])),jsonPopupCatalog:t}),()=>k()),[o,t,i]);const x=u.useCallback((r,f)=>{j(r,f)},[]),g=async r=>{if(r.preventDefault(),t){y(!0);const f=await q.post(e.props.postLink,p);f.status===200&&a&&(c?a(f.data.record,b):a(f.data.record))}else E(e.props.postLink)};return s.jsxs("div",{className:"p-4 w-full",children:[!t&&s.jsxs("div",{className:"w-full sticky z-[1001] py-4 pb-8 top-0 h-fit bg-background flex gap-4",children:[s.jsx(F,{className:"w-fit",asChild:!0,children:s.jsxs(V,{href:n.link,preserveScroll:!0,children:[s.jsx(_,{iconNode:z}),n.title]})}),s.jsxs(F,{variant:"green",type:"submit",className:"w-fit lg:hidden",form:"addUserForm",disabled:h||m||e.props.view||R(),children:[h||m&&s.jsx(S,{className:"h-4 w-4 animate-spin"}),e.props.btnSave.title]})]}),s.jsx("form",{id:"addUserForm",onSubmit:g,className:l?"cursor-not-allowed":"",children:s.jsxs("div",{className:`grid lg:grid-cols-[1fr_150px] gap-4 max-w-[1144px] pb-8 ${t?"lg:grid-cols-[1fr_200px]":"lg:grid-cols-[1fr_150px]"}`,children:[s.jsx("div",{className:"flex flex-col gap-10",children:o.map(r=>s.jsx("div",{className:`grid gap-4 w-full ${l?"pointer-events-none":""}`,children:r.type==="markdown"||r.type==="table"||r.type==="jsonEditor"||r.type==="codeEditor"||r.type==="geoJson"?s.jsxs(s.Fragment,{children:[s.jsx(I,{field:r}),s.jsx(T,{message:$(`${r.type}-${r.name}`)}),s.jsx(ee,{field:r,value:p[r.name],onChange:x,processing:h||m||l,notFound:v,search:e.props.search})]}):s.jsxs(s.Fragment,{children:[s.jsx(I,{field:r}),s.jsx(T,{message:$(`${r.type}-${r.name}`)}),s.jsx(M,{field:r,value:p[r.name],onChange:x,processing:h||m||l,notFound:v,search:e.props.search})]})},r.name))}),s.jsxs("div",{className:`p-4 rounded-md h-fit sticky shadow ${t?"top-0 grid gap-4":"top-[84px] hidden lg:block"}`,children:[c&&s.jsxs("div",{className:"flex gap-4 items-center",children:[s.jsx(A,{id:"targetBlank",checked:b,onCheckedChange:r=>w(!!r),className:"cursor-pointer size-5"}),s.jsx(L,{htmlFor:"targetBlank",children:d})]}),s.jsxs(F,{variant:"green",type:"submit",className:"w-fit",disabled:h||m||e.props.view||R(),children:[(h||m)&&s.jsx(S,{className:"h-4 w-4 animate-spin"}),e.props.btnSave.title]})]})]})})]})};export{I as LabelRenderer,ee as LazyField,de as default};
|