adminizer 4.3.0-build.113 → 4.3.0-build.115
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-DbQJd7Bm.js → add-CR18s1fq.js} +1 -1
- package/assets/add-form-BA-MI8Fw.js +1 -0
- package/assets/app.js +2 -2
- package/assets/{catalog-CpDHgq8b.js → catalog-_IS5QK1i.js} +4 -4
- package/assets/{form-pf6uriQX.js → form-CD-aoFGD.js} +1 -1
- package/assets/{form-J27uSTUj.js → form-DMAgS9Z2.js} +1 -1
- package/assets/{home-CO-50-T_.js → home-BbLn2iuZ.js} +2 -2
- package/assets/manifest.json +6 -6
- package/controllers/catalog/FrontentCatalogAdapter.js +1 -0
- package/lib/catalog/Navigation.d.ts +1 -0
- package/lib/catalog/Navigation.js +7 -3
- package/package.json +1 -1
- package/assets/add-form-tDZGN7FP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as v,X as y,bx as m,j as e,B as p,by as i,L as l,bz 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,X as y,bx as m,j as e,B as p,by as i,L as l,bz as c}from"./app.js";import{r as d}from"./monaco-ICtx6xoc.js";import{LabelRenderer as x,LazyField as F}from"./add-form-BA-MI8Fw.js";import g from"./input-error-CmXZF6xy.js";import{F as N}from"./field-renderer-DBKkDhBG.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";import"./icon-DpkedrXG.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(N,{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 +1 @@
|
|
|
1
|
-
import{j as r}from"./app.js";import{A as o}from"./app-layout-BmMzULcJ.js";import t from"./form-
|
|
1
|
+
import{j as r}from"./app.js";import{A as o}from"./app-layout-BmMzULcJ.js";import t from"./form-CD-aoFGD.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";import"./app-shell-C8Cnr5Hy.js";import"./app-sidebar-HwvXNZzk.js";import"./nav-main-BqKm87JZ.js";import"./material-icon-DwkE6wKL.js";import"./app-sidebar-header-RRnKZeeU.js";import"./breadcrumbs-DSMzNYiS.js";import"./nav-user-DuCZNsZX.js";import"./user-info-BGQvqBmO.js";import"./user-menu-content-BDm88xaM.js";import"./theme-switcher-cgyA7_cO.js";import"./icon-DpkedrXG.js";import"./add-form-BA-MI8Fw.js";import"./field-renderer-DBKkDhBG.js";import"./dynamic-controls-BOYmRX_z.js";import"./input-error-CmXZF6xy.js";const m=[];function g(){return r.jsx(o,{breadcrumbs:m,children:r.jsx(t,{})})}export{g 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-DYA_YmVb.css","./add-form-
|
|
2
|
-
import{_ as t}from"./jsoneditor-D95dIAP2.js";import{u as x,j as o,V as v,W 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 T(){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.bN),__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-DYA_YmVb.css","./add-form-BA-MI8Fw.js","./icon-DpkedrXG.js","./field-renderer-DBKkDhBG.js","./dynamic-controls-BOYmRX_z.js","./field-renderer-CRNLShJD.css","./input-error-CmXZF6xy.js","./add-group-form-DMz0_Oo9.js","./add-user-form-izlXhv2-.js","./material-icon-DwkE6wKL.js","./app-shell-C8Cnr5Hy.js","./app-sidebar-header-RRnKZeeU.js","./breadcrumbs-DSMzNYiS.js","./nav-user-DuCZNsZX.js","./user-info-BGQvqBmO.js","./user-menu-content-BDm88xaM.js","./theme-switcher-cgyA7_cO.js","./app-sidebar-HwvXNZzk.js","./nav-main-BqKm87JZ.js","./date-picker-kW3wZQr_.js","./form-CD-aoFGD.js","./geo-json-YeWQOYnT.js","./list-table-Bc_4C3bv.js","./del-modal-DyIWFflP.js","./pagination-render-D9ogYx-T.js","./nav-footer-B85HLj-j.js","./toast-editor-DwRk6WqT.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as t}from"./jsoneditor-D95dIAP2.js";import{u as x,j as o,V as v,W 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 T(){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.bN),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"../components/add-form.tsx":()=>t(()=>import("./add-form-BA-MI8Fw.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-DMz0_Oo9.js"),__vite__mapDeps([12,0,1,2,3,4,5,7]),import.meta.url),"../components/add-user-form.tsx":()=>t(()=>import("./add-user-form-izlXhv2-.js"),__vite__mapDeps([13,0,1,2,3,4,5,7,11,14]),import.meta.url),"../components/app-shell.tsx":()=>t(()=>import("./app-shell-C8Cnr5Hy.js"),__vite__mapDeps([15,0,1,2,3,4,5]),import.meta.url),"../components/app-sidebar-header.tsx":()=>t(()=>import("./app-sidebar-header-RRnKZeeU.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-HwvXNZzk.js"),__vite__mapDeps([22,0,1,2,3,4,5,23,14]),import.meta.url),"../components/breadcrumbs.tsx":()=>t(()=>import("./breadcrumbs-DSMzNYiS.js"),__vite__mapDeps([17,0,1,2,3,4,5]),import.meta.url),"../components/date-picker.tsx":()=>t(()=>import("./date-picker-kW3wZQr_.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-DBKkDhBG.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-CD-aoFGD.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-YeWQOYnT.js"),__vite__mapDeps([26,0,1,2,3,4,5]),import.meta.url),"../components/handsontable.tsx":()=>t(()=>import("./app.js").then(e=>e.bO),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"../components/icon.tsx":()=>t(()=>import("./icon-DpkedrXG.js"),__vite__mapDeps([7,0,1,2,3,4,5]),import.meta.url),"../components/input-error.tsx":()=>t(()=>import("./input-error-CmXZF6xy.js"),__vite__mapDeps([11,0,1,2,3,4,5]),import.meta.url),"../components/list-table.tsx":()=>t(()=>import("./list-table-Bc_4C3bv.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-DwkE6wKL.js"),__vite__mapDeps([14,0,1,2,3,4,5]),import.meta.url),"../components/monaco-editor.tsx":()=>t(()=>import("./app.js").then(e=>e.bP),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"../components/multi-select.tsx":()=>t(()=>import("./app.js").then(e=>e.bQ),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"../components/nav-footer.tsx":()=>t(()=>import("./nav-footer-B85HLj-j.js"),__vite__mapDeps([30,0,1,2,3,4,5,7]),import.meta.url),"../components/nav-main.tsx":()=>t(()=>import("./nav-main-BqKm87JZ.js"),__vite__mapDeps([23,0,1,2,3,4,5,14]),import.meta.url),"../components/nav-user.tsx":()=>t(()=>import("./nav-user-DuCZNsZX.js"),__vite__mapDeps([18,0,1,2,3,4,5,19,20]),import.meta.url),"../components/pagination-render.tsx":()=>t(()=>import("./pagination-render-D9ogYx-T.js"),__vite__mapDeps([29,0,1,2,3,4,5]),import.meta.url),"../components/theme-switcher.tsx":()=>t(()=>import("./theme-switcher-cgyA7_cO.js"),__vite__mapDeps([21,0,1,2,3,4,5,7]),import.meta.url),"../components/toast-editor.tsx":()=>t(()=>import("./toast-editor-DwRk6WqT.js"),__vite__mapDeps([31,0,1,2,3,4,5]),import.meta.url),"../components/user-info.tsx":()=>t(()=>import("./user-info-BGQvqBmO.js"),__vite__mapDeps([19,0,1,2,3,4,5]),import.meta.url),"../components/user-menu-content.tsx":()=>t(()=>import("./user-menu-content-BDm88xaM.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{T as default};
|
package/assets/manifest.json
CHANGED
|
@@ -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-BA-MI8Fw.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-CD-aoFGD.js",
|
|
305
305
|
"name": "form",
|
|
306
306
|
"src": "src/assets/js/components/form.tsx",
|
|
307
307
|
"isDynamicEntry": true,
|
|
@@ -570,7 +570,7 @@
|
|
|
570
570
|
]
|
|
571
571
|
},
|
|
572
572
|
"src/assets/js/pages/add.tsx": {
|
|
573
|
-
"file": "add-
|
|
573
|
+
"file": "add-CR18s1fq.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-_IS5QK1i.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-DMAgS9Z2.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-BbLn2iuZ.js",
|
|
694
694
|
"name": "home",
|
|
695
695
|
"src": "src/assets/js/pages/home.tsx",
|
|
696
696
|
"isDynamicEntry": true,
|
|
@@ -203,7 +203,8 @@ class NavigationItem extends AbstractItem {
|
|
|
203
203
|
storageData = await this.dataPreparation({
|
|
204
204
|
record: record,
|
|
205
205
|
parentId: data.parentId,
|
|
206
|
-
targetBlank: data.targetBlank
|
|
206
|
+
targetBlank: data.targetBlank,
|
|
207
|
+
visible: data.visible
|
|
207
208
|
}, catalogId);
|
|
208
209
|
}
|
|
209
210
|
else {
|
|
@@ -219,6 +220,8 @@ class NavigationItem extends AbstractItem {
|
|
|
219
220
|
id: uuid(),
|
|
220
221
|
modelId: data.record.id,
|
|
221
222
|
targetBlank: data.targetBlank ?? data.record.targetBlank,
|
|
223
|
+
visible: data.visible ?? data.record.visible,
|
|
224
|
+
isNavigation: true,
|
|
222
225
|
name: data.record.name ?? data.record.title ?? data.record.id,
|
|
223
226
|
parentId: parentId,
|
|
224
227
|
sortOrder: sortOrder ?? (await storage.findElementsByParentId(parentId, null)).length,
|
|
@@ -237,6 +240,7 @@ class NavigationItem extends AbstractItem {
|
|
|
237
240
|
item.urlPath = urlPath;
|
|
238
241
|
if (item.id === data.record.treeId) {
|
|
239
242
|
item.targetBlank = data.record.targetBlank;
|
|
243
|
+
item.visible = data.record.visible;
|
|
240
244
|
}
|
|
241
245
|
response.push(await storage.setElement(item.id, item));
|
|
242
246
|
}
|
|
@@ -278,6 +282,7 @@ class NavigationItem extends AbstractItem {
|
|
|
278
282
|
createTitle: `${req.i18n.__('create new')} ${req.i18n.__(this.name + 's')}`,
|
|
279
283
|
OR: req.i18n.__('OR'),
|
|
280
284
|
openInNewWindow: req.i18n.__('Open in a new window'),
|
|
285
|
+
visible: req.i18n.__('Visible')
|
|
281
286
|
}
|
|
282
287
|
}
|
|
283
288
|
};
|
|
@@ -312,7 +317,6 @@ class NavigationGroup extends AbstractGroup {
|
|
|
312
317
|
async create(data, catalogId) {
|
|
313
318
|
let storage = StorageServices.get(catalogId);
|
|
314
319
|
let storageData = await this.dataPreparation(data, catalogId);
|
|
315
|
-
console.log(storageData);
|
|
316
320
|
delete data.name;
|
|
317
321
|
delete data.parentId;
|
|
318
322
|
storageData = { ...storageData, ...data };
|
|
@@ -326,8 +330,8 @@ class NavigationGroup extends AbstractGroup {
|
|
|
326
330
|
name: data.name,
|
|
327
331
|
targetBlank: data.targetBlank,
|
|
328
332
|
visible: data.visible,
|
|
329
|
-
parentId: parentId,
|
|
330
333
|
isNavigation: true,
|
|
334
|
+
parentId: parentId,
|
|
331
335
|
sortOrder: sortOrder ?? (await storage.findElementsByParentId(parentId, null)).length,
|
|
332
336
|
icon: this.icon,
|
|
333
337
|
type: this.type
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{X as U,bx as C,j as s,B as E,W as A,aE as P,by as R,L as I,bz as $,g as V,b as O,m as D,K as J,M as K,N as X,aF as q,O as G,h as H}from"./app.js";import{r as u}from"./monaco-ICtx6xoc.js";import{Icon as _}from"./icon-DpkedrXG.js";import{F as z}from"./field-renderer-DBKkDhBG.js";import T from"./input-error-CmXZF6xy.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";import"./dynamic-controls-BOYmRX_z.js";var S=new Map,F=new WeakMap,B=0,Q=void 0;function W(e){return e?(F.has(e)||(B+=1,F.set(e,B.toString())),F.get(e)):"0"}function Y(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?W(e.root):e[t]}`).toString()}function Z(e){const t=Y(e);let a=S.get(t);if(!a){const i=new Map;let d;const c=new IntersectionObserver(o=>{o.forEach(n=>{var l;const f=n.isIntersecting&&d.some(p=>n.intersectionRatio>=p);e.trackVisibility&&typeof n.isVisible>"u"&&(n.isVisible=f),(l=i.get(n.target))==null||l.forEach(p=>{p(f,n)})})},e);d=c.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),a={id:t,observer:c,elements:i},S.set(t,a)}return a}function ee(e,t,a={},i=Q){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}=Z(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(),S.delete(d))}}function se({threshold:e,delay:t,trackVisibility:a,rootMargin:i,root:d,triggerOnce:c,skip:o,initialInView:n,fallbackInView:l,onChange:f}={}){var p;const[v,k]=u.useState(null),m=u.useRef(f),[b,x]=u.useState({inView:!!n,entry:void 0});m.current=f,u.useEffect(()=>{if(o||!v)return;let g;return g=ee(v,(N,r)=>{x({inView:N,entry:r}),m.current&&m.current(N,r),r.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,v,d,i,c,o,a,l,t]);const w=(p=b.entry)==null?void 0:p.target,y=u.useRef(void 0);!v&&w&&!c&&!o&&y.current!==w&&(y.current=w,x({inView:!!n,entry:void 0}));const h=[k,b.inView,b.entry];return h.ref=h[0],h.inView=h[1],h.entry=h[2],h}const L=u.memo(({field:e})=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx(O,{htmlFor:`${e.type}-${e.name}`,children:e.label}),e.tooltip&&s.jsx(J,{children:s.jsxs(K,{children:[s.jsx(X,{onClick:t=>t.preventDefault(),children:s.jsx(_,{iconNode:q,className:"text-primary w-5 h-5 cursor-pointer"})}),s.jsx(G,{align:"center",side:"top",className:"z-[1002]",children:s.jsx("p",{children:e.tooltip})})]})})]})),re=u.memo(({field:e,value:t,onChange:a,processing:i,notFound:d,search:c})=>{const[o,n]=se({triggerOnce:!0,rootMargin:"100px 0px"});return s.jsx("div",{ref:o,className:"grid gap-4 w-full",children:n?s.jsx(z,{field:e,value:t,onChange:a,notFound:d,search:c,processing:i}):s.jsx(D,{className:"w-full h-[250px] rounded-sm"})})}),pe=({page:e,catalog:t,callback:a,openNewWindow:i,openNewWindowLabel:d,isNavigation:c})=>{const{fields:o,btnBack:n,view:l,notFound:f}=e.props,{data:p,setData:v,post:k,processing:m,transform:b}=U({...Object.fromEntries(o.map(r=>[r.name,r.value??void 0])),jsonPopupCatalog:t}),[x,w]=u.useState(!1),[y,h]=u.useState(i??!1);u.useEffect(()=>(h(i??!1),C(),v({...Object.fromEntries(o.map(r=>[r.name,r.value??void 0])),jsonPopupCatalog:t}),()=>C()),[o,t,i]);const g=u.useCallback((r,j)=>{v(r,j)},[]),N=async r=>{if(r.preventDefault(),t){w(!0);const j=await H.post(e.props.postLink,p);j.status===200&&a&&(c?a(j.data.record,y):a(j.data.record))}else{const j=localStorage.getItem("backUrl");b(M=>({...M,redirectUrl:j??""})),k(e.props.postLink,{onSuccess:()=>{localStorage.setItem("backUrl","")}})}};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(E,{className:"w-fit",asChild:!0,children:s.jsxs(A,{href:n.link,preserveScroll:!0,children:[s.jsx(_,{iconNode:P}),n.title]})}),s.jsxs(E,{variant:"green",type:"submit",className:"w-fit lg:hidden",form:"addUserForm",disabled:x||m||e.props.view||R(),children:[x||m&&s.jsx(I,{className:"h-4 w-4 animate-spin"}),e.props.btnSave.title]})]}),s.jsx("form",{id:"addUserForm",onSubmit:N,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(L,{field:r}),s.jsx(T,{message:$(`${r.type}-${r.name}`)}),s.jsx(re,{field:r,value:p[r.name],onChange:g,processing:x||m||l,notFound:f,search:e.props.search})]}):s.jsxs(s.Fragment,{children:[s.jsx(L,{field:r}),s.jsx(T,{message:$(`${r.type}-${r.name}`)}),s.jsx(z,{field:r,value:p[r.name],onChange:g,processing:x||m||l,notFound:f,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(V,{id:"targetBlank",checked:y,onCheckedChange:r=>h(!!r),className:"cursor-pointer size-5"}),s.jsx(O,{htmlFor:"targetBlank",children:d})]}),s.jsxs(E,{variant:"green",type:"submit",className:"w-fit",disabled:x||m||e.props.view||R(),children:[(x||m)&&s.jsx(I,{className:"h-4 w-4 animate-spin"}),e.props.btnSave.title]})]})]})})]})};export{L as LabelRenderer,re as LazyField,pe as default};
|