adminizer 4.1.0-build.13 → 4.1.0-build.15
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/{VanillaJSONEditor-BGC0iJ01.js → VanillaJSONEditor-D-Lx670g.js} +2 -2
- package/assets/add-BP_u3Tjl.js +1 -0
- package/assets/add-form-nffmiYTh.js +1 -0
- package/assets/add-group-D4vcHlm-.js +1 -0
- package/assets/{add-group-form-BUM07NJS.js → add-group-form-gNJW11-q.js} +1 -1
- package/assets/add-user-DWh3Nas0.js +1 -0
- package/assets/add-user-form-BJ0FsZYJ.js +1 -0
- package/assets/{app-BYldMVaW.css → app-C3OdwOHy.css} +1 -1
- package/assets/{app-layout-YPlKN2l5.js → app-layout-DYsRFUuP.js} +1 -1
- package/assets/{app-shell-D6Uf68EA.js → app-shell-Dd9Eknik.js} +1 -1
- package/assets/app-sidebar-BOmu6-Sl.js +1 -0
- package/assets/{app-sidebar-header-BTKq0Dr0.js → app-sidebar-header-CoXSzWxk.js} +1 -1
- package/assets/app.js +14 -14
- package/assets/{breadcrumbs-B4LOvzuL.js → breadcrumbs-BmAq4fHT.js} +1 -1
- package/assets/{button-CTOOfwvn.js → button-C9B_5Jf_.js} +1 -1
- package/assets/checkbox-Fg27sL_1.js +1 -0
- package/assets/{compiler-runtime-tM4jBQ-T.js → compiler-runtime-hB6dAw2d.js} +1 -1
- package/assets/dashboard-BOltB2Hq.css +1 -0
- package/assets/dashboard-Ddh74NBQ.js +3 -0
- package/assets/{date-picker-DdGpxs8q.js → date-picker-DI1cCO7K.js} +1 -1
- package/assets/{dropdown-menu-CsGmdVIn.js → dropdown-menu-Bhj17ENm.js} +1 -1
- package/assets/{field-renderer-Q3ajtfjk.js → field-renderer-DVHZF6HS.js} +3 -3
- package/assets/form-BgWdwvz1.js +1 -0
- package/assets/form-DgtErfln.js +1 -0
- package/assets/{geo-json-CFYMCghL.js → geo-json-BjiyTtMu.js} +1 -1
- package/assets/{handsontable-BCnjOpBr.js → handsontable-4mjU_b0n.js} +1 -1
- package/assets/home-CHntBHJa.js +2 -0
- package/assets/{icon-Bz9BMaD0.js → icon-Dt0vBgDO.js} +1 -1
- package/assets/index-B8BS9wMC.js +1 -0
- package/assets/{index-Mx04mBJl.js → index-BC0yfOHo.js} +1 -1
- package/assets/{index-m5itSoCR.js → index-BKCgnGj_.js} +1 -1
- package/assets/{index-C5OL14ES.js → index-BbXEMx9n.js} +1 -1
- package/assets/{index-DnbQEoxZ.js → index-BykbU6Ee.js} +1 -1
- package/assets/index-CaJgc5EZ.js +1 -0
- package/assets/{index-Cb_qrizV.js → index-Cgp8OfuI.js} +1 -1
- package/assets/{index-CGjCQBqR.js → index-Cw5o84pO.js} +1 -1
- package/assets/index-DrWfGwtf.js +1 -0
- package/assets/{init-user-CotD_o5_.js → init-user-JfCKJ5Ce.js} +1 -1
- package/assets/{input-DF7Ue23C.js → input-CvRbIbk4.js} +1 -1
- package/assets/{input-error-BBygona6.js → input-error-DMK7cAt7.js} +1 -1
- package/assets/{label-C2tlefOv.js → label-CSLFe9Bz.js} +1 -1
- package/assets/list-B2Oa5O_Q.js +1 -0
- package/assets/{list-table-Cz8Wgfsa.js → list-table-DA9MhywL.js} +2 -2
- package/assets/{login-B7br6gt5.js → login-DQwGtdis.js} +1 -1
- package/assets/manifest.json +588 -568
- package/assets/{material-icon-CItZiB53.js → material-icon-BJg8o_fs.js} +1 -1
- package/assets/module-DWXp59Vg.js +1 -0
- package/assets/{monaco-editor-DqAqwxw4.js → monaco-editor-CJs0_GlD.js} +1 -1
- package/assets/{multi-select-CDlcaNFy.js → multi-select-BvRpAW8r.js} +1 -1
- package/assets/{nav-footer-CXKG3O4K.js → nav-footer-Bs4dmN1d.js} +1 -1
- package/assets/{nav-main-ByHRr3yf.js → nav-main-Bq3IMk4C.js} +1 -1
- package/assets/{nav-user-BVRKiqm-.js → nav-user-CbB22J5O.js} +1 -1
- package/assets/{pagination-render-CihJ7J2u.js → pagination-render-DuXDDbC_.js} +1 -1
- package/assets/{popover-_WN_Lj46.js → popover-DtoGI2b1.js} +1 -1
- package/assets/{register-CpRFo88B.js → register-BSogVF0h.js} +1 -1
- package/assets/{select-DYffGc49.js → select-BWepUw-9.js} +1 -1
- package/assets/{sidebar-B9HagQ6H.js → sidebar-CAHsHdjM.js} +2 -2
- package/assets/skeleton-COOcAA8f.js +1 -0
- package/assets/{sonner-Dzckw3U3.js → sonner-BI0IFOQN.js} +1 -1
- package/assets/{toast-editor-ZLOtXFu5.js → toast-editor-CMK7QtF1.js} +82 -82
- package/assets/{tooltip-CWVAD5oF.js → tooltip-DHwpLKOI.js} +1 -1
- package/assets/{use-appearance-Co6mO0dV.js → use-appearance-DRfIqTgw.js} +1 -1
- package/assets/{use-window-size-B8l6Bpkf.js → use-window-size-h0Sh_NvX.js} +1 -1
- package/assets/{user-info-DA4KTAOF.js → user-info-DFrmpJ4y.js} +1 -1
- package/assets/{user-menu-content-Biwi4u9j.js → user-menu-content-DPXQdERj.js} +1 -1
- package/assets/welcome-B4WCIXKf.js +1 -0
- package/controllers/add.js +1 -1
- package/controllers/dashboard.js +15 -1
- package/controllers/edit.js +1 -1
- package/controllers/getAllWidgets.js +1 -1
- package/controllers/list.js +1 -1
- package/controllers/navigation/edit.js +1 -1
- package/controllers/remove.js +1 -1
- package/controllers/view.js +1 -1
- package/controllers/widgetsDB.js +2 -2
- package/helpers/accessRightsHelper.js +8 -2
- package/helpers/controllerHelper.js +1 -1
- package/helpers/fieldsHelper.js +1 -1
- package/helpers/inertiaAddHelper.js +1 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/interfaces/adminpanelConfig.d.ts +2 -19
- package/interfaces/global.d.ts +3 -0
- package/interfaces/types.d.ts +1 -1
- package/lib/Adminizer.js +9 -5
- package/lib/catalog/Navigation.js +0 -1
- package/lib/media-manager/Items.js +0 -3
- package/lib/v4/DataAccessor.d.ts +3 -1
- package/lib/v4/DataAccessor.js +23 -9
- package/lib/v4/I18n.js +2 -0
- package/lib/v4/model/adapter/sequelize.js +8 -1
- package/lib/v4/model/adapter/waterline.js +5 -2
- package/lib/widgets/abstractAction.d.ts +1 -1
- package/lib/widgets/abstractCustom.d.ts +27 -12
- package/lib/widgets/abstractCustom.js +8 -2
- package/lib/widgets/abstractInfo.d.ts +1 -1
- package/lib/widgets/abstractInfo.js +1 -1
- package/lib/widgets/abstractLink.d.ts +1 -0
- package/lib/widgets/abstractSwitch.d.ts +1 -1
- package/lib/widgets/abstractWidgetBase.d.ts +1 -1
- package/lib/widgets/widgetHandler.d.ts +26 -3
- package/lib/widgets/widgetHandler.js +25 -25
- package/models/UserAP.d.ts +5 -2
- package/package.json +14 -8
- package/system/Router.js +6 -14
- package/system/bindAccessRights.js +0 -4
- package/system/bindDev.js +1 -0
- package/system/bindMediaManager.js +0 -1
- package/system/bindModels.js +7 -2
- package/system/bindNavigation.js +0 -1
- package/translations/ru.json +17 -8
- package/assets/add-EOP63mij.js +0 -1
- package/assets/add-form-DofA75xF.js +0 -1
- package/assets/add-group-CbKcu8bN.js +0 -1
- package/assets/add-user-FQ_0_L3C.js +0 -1
- package/assets/add-user-form-D1f_2noB.js +0 -1
- package/assets/app-sidebar-mh83eSsH.js +0 -1
- package/assets/checkbox-D9ub-v0l.js +0 -1
- package/assets/dashboard-BiLSHuF2.js +0 -1
- package/assets/form-D2gvtdQt.js +0 -1
- package/assets/form-EPWwr8yD.js +0 -1
- package/assets/home-Co9WBSjN.js +0 -2
- package/assets/index-DEzdKGnS.js +0 -1
- package/assets/index-DUXJYtOc.js +0 -1
- package/assets/index-Dllsp4Rk.js +0 -1
- package/assets/list-BrJBbAVm.js +0 -1
- package/assets/module-BA_EenoK.js +0 -1
- package/assets/welcome-C1kRbbWq.js +0 -1
- package/controllers/processInstallFinalize.d.ts +0 -1
- package/controllers/processInstallFinalize.js +0 -16
- package/controllers/processInstallStep.d.ts +0 -0
- package/controllers/processInstallStep.js +0 -122
- package/lib/installStepper/InstallStepAbstract.d.ts +0 -52
- package/lib/installStepper/InstallStepAbstract.js +0 -69
- package/lib/installStepper/finalizeStep.d.ts +0 -21
- package/lib/installStepper/finalizeStep.js +0 -48
- package/lib/installStepper/installStepper.d.ts +0 -40
- package/lib/installStepper/installStepper.js +0 -195
- package/system/bindInstallStepper.d.ts +0 -2
- package/system/bindInstallStepper.js +0 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as u}from"./app.js";import{c as j}from"./compiler-runtime-
|
|
1
|
+
import{r as i,j as u}from"./app.js";import{c as j}from"./compiler-runtime-hB6dAw2d.js";import{d as S,A as K,c as C,b as W,u as J,e as Q,P as Z,D as ee,C as te,f as oe}from"./index-CaJgc5EZ.js";import{u as H,a as re}from"./index-DrWfGwtf.js";import{c as ne}from"./index-D5ir9iUV.js";import{P as $}from"./index-BC0yfOHo.js";import{P as se}from"./index-B8BS9wMC.js";import{R as ae}from"./index-Cgp8OfuI.js";import{c as ie}from"./utils-DjqsqOe8.js";var[D,$e]=ne("Tooltip",[S]),O=S(),G="TooltipProvider",le=700,A="tooltip.open",[ce,k]=D(G),F=o=>{const{__scopeTooltip:e,delayDuration:t=le,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:s}=o,l=i.useRef(!0),p=i.useRef(!1),a=i.useRef(0);return i.useEffect(()=>{const d=a.current;return()=>window.clearTimeout(d)},[]),u.jsx(ce,{scope:e,isOpenDelayedRef:l,delayDuration:t,onOpen:i.useCallback(()=>{window.clearTimeout(a.current),l.current=!1},[]),onClose:i.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:p,onPointerInTransitChange:i.useCallback(d=>{p.current=d},[]),disableHoverableContent:n,children:s})};F.displayName=G;var R="Tooltip",[ue,_]=D(R),z=o=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:p}=o,a=k(R,o.__scopeTooltip),d=O(e),[c,v]=i.useState(null),x=W(),f=i.useRef(0),m=l??a.disableHoverableContent,T=p??a.delayDuration,h=i.useRef(!1),[g,y]=J({prop:r,defaultProp:n??!1,onChange:I=>{I?(a.onOpen(),document.dispatchEvent(new CustomEvent(A))):a.onClose(),s==null||s(I)},caller:R}),w=i.useMemo(()=>g?h.current?"delayed-open":"instant-open":"closed",[g]),P=i.useCallback(()=>{window.clearTimeout(f.current),f.current=0,h.current=!1,y(!0)},[y]),E=i.useCallback(()=>{window.clearTimeout(f.current),f.current=0,y(!1)},[y]),N=i.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{h.current=!0,y(!0),f.current=0},T)},[T,y]);return i.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),u.jsx(Q,{...d,children:u.jsx(ue,{scope:e,contentId:x,open:g,stateAttribute:w,trigger:c,onTriggerChange:v,onTriggerEnter:i.useCallback(()=>{a.isOpenDelayedRef.current?N():P()},[a.isOpenDelayedRef,N,P]),onTriggerLeave:i.useCallback(()=>{m?E():(window.clearTimeout(f.current),f.current=0)},[E,m]),onOpen:P,onClose:E,disableHoverableContent:m,children:t})})};z.displayName=R;var L="TooltipTrigger",B=i.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=_(L,t),s=k(L,t),l=O(t),p=i.useRef(null),a=H(e,p,n.onTriggerChange),d=i.useRef(!1),c=i.useRef(!1),v=i.useCallback(()=>d.current=!1,[]);return i.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),u.jsx(K,{asChild:!0,...l,children:u.jsx(se.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:a,onPointerMove:C(o.onPointerMove,x=>{x.pointerType!=="touch"&&!c.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),c.current=!0)}),onPointerLeave:C(o.onPointerLeave,()=>{n.onTriggerLeave(),c.current=!1}),onPointerDown:C(o.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:C(o.onFocus,()=>{d.current||n.onOpen()}),onBlur:C(o.onBlur,n.onClose),onClick:C(o.onClick,n.onClose)})})});B.displayName=L;var M="TooltipPortal",[pe,de]=D(M,{forceMount:void 0}),U=o=>{const{__scopeTooltip:e,forceMount:t,children:r,container:n}=o,s=_(M,e);return u.jsx(pe,{scope:e,forceMount:t,children:u.jsx($,{present:t||s.open,children:u.jsx(Z,{asChild:!0,container:n,children:r})})})};U.displayName=M;var b="TooltipContent",V=i.forwardRef((o,e)=>{const t=de(b,o.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...s}=o,l=_(b,o.__scopeTooltip);return u.jsx($,{present:r||l.open,children:l.disableHoverableContent?u.jsx(Y,{side:n,...s,ref:e}):u.jsx(fe,{side:n,...s,ref:e})})}),fe=i.forwardRef((o,e)=>{const t=_(b,o.__scopeTooltip),r=k(b,o.__scopeTooltip),n=i.useRef(null),s=H(e,n),[l,p]=i.useState(null),{trigger:a,onClose:d}=t,c=n.current,{onPointerInTransitChange:v}=r,x=i.useCallback(()=>{p(null),v(!1)},[v]),f=i.useCallback((m,T)=>{const h=m.currentTarget,g={x:m.clientX,y:m.clientY},y=he(g,h.getBoundingClientRect()),w=Te(g,y),P=ye(T.getBoundingClientRect()),E=Ce([...w,...P]);p(E),v(!0)},[v]);return i.useEffect(()=>()=>x(),[x]),i.useEffect(()=>{if(a&&c){const m=h=>f(h,c),T=h=>f(h,a);return a.addEventListener("pointerleave",m),c.addEventListener("pointerleave",T),()=>{a.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",T)}}},[a,c,f,x]),i.useEffect(()=>{if(l){const m=T=>{const h=T.target,g={x:T.clientX,y:T.clientY},y=(a==null?void 0:a.contains(h))||(c==null?void 0:c.contains(h)),w=!ge(g,l);y?x():w&&(x(),d())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[a,c,l,d,x]),u.jsx(Y,{...o,ref:s})}),[ve,xe]=D(R,{isInside:!1}),me=re("TooltipContent"),Y=i.forwardRef((o,e)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...p}=o,a=_(b,t),d=O(t),{onClose:c}=a;return i.useEffect(()=>(document.addEventListener(A,c),()=>document.removeEventListener(A,c)),[c]),i.useEffect(()=>{if(a.trigger){const v=x=>{const f=x.target;f!=null&&f.contains(a.trigger)&&c()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[a.trigger,c]),u.jsx(ee,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:v=>v.preventDefault(),onDismiss:c,children:u.jsxs(te,{"data-state":a.stateAttribute,...d,...p,ref:e,style:{...p.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[u.jsx(me,{children:r}),u.jsx(ve,{scope:t,isInside:!0,children:u.jsx(ae,{id:a.contentId,role:"tooltip",children:n||r})})]})})});V.displayName=b;var q="TooltipArrow",X=i.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=O(t);return xe(q,t).isInside?null:u.jsx(oe,{...n,...r,ref:e})});X.displayName=q;function he(o,e){const t=Math.abs(e.top-o.y),r=Math.abs(e.bottom-o.y),n=Math.abs(e.right-o.x),s=Math.abs(e.left-o.x);switch(Math.min(t,r,n,s)){case s:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Te(o,e,t=5){const r=[];switch(e){case"top":r.push({x:o.x-t,y:o.y+t},{x:o.x+t,y:o.y+t});break;case"bottom":r.push({x:o.x-t,y:o.y-t},{x:o.x+t,y:o.y-t});break;case"left":r.push({x:o.x+t,y:o.y-t},{x:o.x+t,y:o.y+t});break;case"right":r.push({x:o.x-t,y:o.y-t},{x:o.x-t,y:o.y+t});break}return r}function ye(o){const{top:e,right:t,bottom:r,left:n}=o;return[{x:n,y:e},{x:t,y:e},{x:t,y:r},{x:n,y:r}]}function ge(o,e){const{x:t,y:r}=o;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const p=e[s],a=e[l],d=p.x,c=p.y,v=a.x,x=a.y;c>r!=x>r&&t<(v-d)*(r-c)/(x-c)+d&&(n=!n)}return n}function Ce(o){const e=o.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),be(e)}function be(o){if(o.length<=1)return o.slice();const e=[];for(let r=0;r<o.length;r++){const n=o[r];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const t=[];for(let r=o.length-1;r>=0;r--){const n=o[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var we=F,Pe=z,Ee=B,Re=U,_e=V,je=X;function De(o){const e=j.c(6);let t,r;e[0]!==o?({delayDuration:r,...t}=o,e[0]=o,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const n=r===void 0?0:r;let s;return e[3]!==n||e[4]!==t?(s=u.jsx(we,{"data-slot":"tooltip-provider",delayDuration:n,...t}),e[3]=n,e[4]=t,e[5]=s):s=e[5],s}function Ge(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=u.jsx(De,{children:u.jsx(Pe,{"data-slot":"tooltip",...t})}),e[2]=t,e[3]=r):r=e[3],r}function Fe(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=u.jsx(Ee,{"data-slot":"tooltip-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function ze(o){const e=j.c(13);let t,r,n,s;e[0]!==o?({className:r,sideOffset:s,children:t,...n}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=s):(t=e[1],r=e[2],n=e[3],s=e[4]);const l=s===void 0?0:s;let p;e[5]!==r?(p=ie("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",r),e[5]=r,e[6]=p):p=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(je,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),e[7]=a):a=e[7];let d;return e[8]!==t||e[9]!==n||e[10]!==l||e[11]!==p?(d=u.jsx(Re,{children:u.jsxs(_e,{"data-slot":"tooltip-content",sideOffset:l,className:p,...n,children:[t,a]})}),e[8]=t,e[9]=n,e[10]=l,e[11]=p,e[12]=d):d=e[12],d}export{De as T,Ge as a,Fe as b,ze as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as S}from"./compiler-runtime-
|
|
1
|
+
import{c as S}from"./compiler-runtime-hB6dAw2d.js";import{r as l}from"./app.js";const y=()=>typeof window>"u"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches,E=(e,a,r=365)=>{if(typeof document>"u")return;const o=r*24*60*60;document.cookie=`${e}=${a};path=/;max-age=${o};SameSite=Lax`},c=e=>{const a=e==="dark"||e==="system"&&y();document.documentElement.classList.toggle("dark",a)},w=()=>typeof window>"u"?null:window.matchMedia("(prefers-color-scheme: dark)"),v=()=>{const e=localStorage.getItem("appearance");c(e||"light")};function C(){var a;const e=localStorage.getItem("appearance")||"system";c(e),(a=w())==null||a.addEventListener("change",v)}function L(){const e=S.c(6),[a,r]=l.useState("system"),[o,g]=l.useState(!1);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n=>{g(!0),r(n),localStorage.setItem("appearance",n),E("appearance",n),c(n),setTimeout(()=>{g(!1),window.dispatchEvent(new Event("appearanceChanged"))},0)},e[0]=s):s=e[0];const d=s;let p,i;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{const n=localStorage.getItem("appearance");d(n||"light");const h=t=>{if(t.key==="appearance"){const f=t.newValue;r(f),c(f)}},u=()=>{const t=localStorage.getItem("appearance");r(t),c(t)};return window.addEventListener("storage",h),window.addEventListener("appearanceChanged",u),()=>{var t;window.removeEventListener("storage",h),window.removeEventListener("appearanceChanged",u),(t=w())==null||t.removeEventListener("change",v)}},i=[d],e[1]=p,e[2]=i):(p=e[1],i=e[2]),l.useEffect(p,i);let m;return e[3]!==a||e[4]!==o?(m={appearance:a,updateAppearance:d,isThemeChanging:o},e[3]=a,e[4]=o,e[5]=m):m=e[5],m}export{C as i,L as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as s}from"./compiler-runtime-
|
|
1
|
+
import{c as s}from"./compiler-runtime-hB6dAw2d.js";import{r}from"./app.js";const h=()=>{const e=s.c(3);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768},e[0]=i):i=e[0];const[d,w]=r.useState(i);let n,t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{if(typeof window>"u")return;const o=()=>{w({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},t=[],e[1]=n,e[2]=t):(n=e[1],t=e[2]),r.useEffect(n,t),d};export{h as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as F,r as g,j as c}from"./app.js";import{c as S}from"./compiler-runtime-hB6dAw2d.js";import{c as U,a as M,u as w}from"./index-D5ir9iUV.js";import{P as y}from"./index-B8BS9wMC.js";import{c as I}from"./utils-DjqsqOe8.js";import"./index-DrWfGwtf.js";var E={exports:{}},A={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,J as u}from"./app.js";import{c as f}from"./compiler-runtime-
|
|
1
|
+
import{j as t,J as u}from"./app.js";import{c as f}from"./compiler-runtime-hB6dAw2d.js";import{g as d,e as x,d as h}from"./dropdown-menu-Bhj17ENm.js";import{UserInfo as y}from"./user-info-DFrmpJ4y.js";import{c as g}from"./createLucideIcon-BFG25zNo.js";import"./index-CaJgc5EZ.js";import"./index-D5ir9iUV.js";import"./index-B8BS9wMC.js";import"./index-DrWfGwtf.js";import"./index-BKCgnGj_.js";import"./index-BbXEMx9n.js";import"./index-BykbU6Ee.js";import"./index-BC0yfOHo.js";import"./utils-DjqsqOe8.js";/**
|
|
2
2
|
* @license lucide-react v0.485.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as s,j as i}from"./app.js";import{c as l}from"./compiler-runtime-hB6dAw2d.js";import{A as x}from"./app-layout-DYsRFUuP.js";import"./sidebar-CAHsHdjM.js";import"./index-DrWfGwtf.js";import"./button-C9B_5Jf_.js";import"./utils-DjqsqOe8.js";import"./index-Cw5o84pO.js";import"./createLucideIcon-BFG25zNo.js";import"./index-CaJgc5EZ.js";import"./index-D5ir9iUV.js";import"./index-B8BS9wMC.js";import"./index-BykbU6Ee.js";import"./index-BC0yfOHo.js";import"./tooltip-DHwpLKOI.js";import"./index-Cgp8OfuI.js";import"./app-shell-Dd9Eknik.js";import"./app-sidebar-BOmu6-Sl.js";import"./nav-main-Bq3IMk4C.js";import"./material-icon-BJg8o_fs.js";import"./chevron-right-D5q8rF7h.js";import"./index-BbXEMx9n.js";import"./index-BKCgnGj_.js";import"./chevrons-up-down-kALltqHV.js";import"./app-sidebar-header-CoXSzWxk.js";import"./breadcrumbs-BmAq4fHT.js";import"./nav-user-CbB22J5O.js";import"./dropdown-menu-Bhj17ENm.js";import"./user-info-DFrmpJ4y.js";import"./user-menu-content-DPXQdERj.js";import"./icon-Dt0vBgDO.js";import"./use-appearance-DRfIqTgw.js";const a=[];function J(){const t=l.c(8),r=s();let o;t[0]!==r.props.title?(o=r.props.title&&i.jsx("div",{className:"text-3xl mb-8",children:r.props.title}),t[0]=r.props.title,t[1]=o):o=t[1];let e;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"text-3xl mb-8",children:"Adminizer"}),t[2]=e):e=t[2];let p;t[3]!==r.props.text?(p=r.props.text&&i.jsx("div",{dangerouslySetInnerHTML:{__html:r.props.text}}),t[3]=r.props.text,t[4]=p):p=t[4];let m;return t[5]!==o||t[6]!==p?(m=i.jsx(x,{breadcrumbs:a,children:i.jsxs("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:[o,e,p]})}),t[5]=o,t[6]=p,t[7]=m):m=t[7],m}export{J as default};
|
package/controllers/add.js
CHANGED
|
@@ -21,7 +21,7 @@ export default async function add(req, res) {
|
|
|
21
21
|
return res.sendStatus(403);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
let dataAccessor = new DataAccessor(req, entity, "add");
|
|
24
|
+
let dataAccessor = new DataAccessor(req.adminizer, req.user, entity, "add");
|
|
25
25
|
let fields = dataAccessor.getFieldsConfig();
|
|
26
26
|
// add deprecated 'records' to config
|
|
27
27
|
fields = await FieldsHelper.loadAssociations(req, fields, "add");
|
package/controllers/dashboard.js
CHANGED
|
@@ -4,7 +4,21 @@ export default function (req, res) {
|
|
|
4
4
|
}
|
|
5
5
|
return req.Inertia.render({
|
|
6
6
|
component: 'dashboard',
|
|
7
|
-
props:
|
|
7
|
+
props: {
|
|
8
|
+
title: req.i18n.__('Quick actions'),
|
|
9
|
+
tooltip: req.i18n.__('Toggle to change the grid. To save the grid, turn it off.'),
|
|
10
|
+
notWidgets: req.i18n.__('You don\'t have any widgets selected yet. You can add them by clicking on the plus sign at the top right.'),
|
|
11
|
+
notFound: req.i18n.__('No widgets found'),
|
|
12
|
+
actionsTitles: {
|
|
13
|
+
"All": req.i18n.__('All'),
|
|
14
|
+
'Custom': req.i18n.__('Custom'),
|
|
15
|
+
'Fast links': req.i18n.__('Fast links'),
|
|
16
|
+
'Actions': req.i18n.__('Actions'),
|
|
17
|
+
'Info': req.i18n.__('Info'),
|
|
18
|
+
'Switcher': req.i18n.__('Switcher')
|
|
19
|
+
},
|
|
20
|
+
searchPlaceholder: req.i18n.__('Search'),
|
|
21
|
+
}
|
|
8
22
|
});
|
|
9
23
|
}
|
|
10
24
|
;
|
package/controllers/edit.js
CHANGED
|
@@ -30,7 +30,7 @@ export default async function edit(req, res) {
|
|
|
30
30
|
let dataAccessor;
|
|
31
31
|
try {
|
|
32
32
|
const id = req.params.id;
|
|
33
|
-
dataAccessor = new DataAccessor(req, entity, "edit");
|
|
33
|
+
dataAccessor = new DataAccessor(req.adminizer, req.user, entity, "edit");
|
|
34
34
|
record = await entity.model.findOne({ id: id }, dataAccessor);
|
|
35
35
|
if (!record)
|
|
36
36
|
return res.status(404).send("Adminpanel > Record not found");
|
|
@@ -9,7 +9,7 @@ export default async function getAllWidgets(req, res) {
|
|
|
9
9
|
}
|
|
10
10
|
if (req.method.toUpperCase() === 'GET') {
|
|
11
11
|
try {
|
|
12
|
-
return res.json({ widgets: await req.adminizer.widgetHandler.getAll(req.user) });
|
|
12
|
+
return res.json({ widgets: await req.adminizer.widgetHandler.getAll(req.user, req.i18n) });
|
|
13
13
|
}
|
|
14
14
|
catch (e) {
|
|
15
15
|
return res.status(500).send({ error: e.message || 'Internal Server Error' });
|
package/controllers/list.js
CHANGED
|
@@ -16,7 +16,7 @@ export default async function list(req, res) {
|
|
|
16
16
|
return res.sendStatus(403);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
let dataAccessor = new DataAccessor(req, entity, "list");
|
|
19
|
+
let dataAccessor = new DataAccessor(req.adminizer, req.user, entity, "list");
|
|
20
20
|
let fields = dataAccessor.getFieldsConfig();
|
|
21
21
|
const header = inertiaListHelper(entity, req, fields);
|
|
22
22
|
let start = "0";
|
|
@@ -7,7 +7,7 @@ export default async function edit(req, res) {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
let entity = ControllerHelper.findEntityObject(req);
|
|
10
|
-
let dataAccessor = new DataAccessor(req, entity, "edit");
|
|
10
|
+
let dataAccessor = new DataAccessor(req.adminizer, req.user, entity, "edit");
|
|
11
11
|
let record = await entity.model.findOne({ id: req.params.id }, dataAccessor);
|
|
12
12
|
return res.redirect(`${req.adminizer.config.routePrefix}/catalog/navigation/${record.label}`);
|
|
13
13
|
}
|
package/controllers/remove.js
CHANGED
|
@@ -31,7 +31,7 @@ export default async function remove(req, res) {
|
|
|
31
31
|
let record;
|
|
32
32
|
let dataAccessor;
|
|
33
33
|
try {
|
|
34
|
-
dataAccessor = new DataAccessor(req, entity, "remove");
|
|
34
|
+
dataAccessor = new DataAccessor(req.adminizer, req.user, entity, "remove");
|
|
35
35
|
record = await entity.model.findOne({ id: req.params.id }, dataAccessor);
|
|
36
36
|
}
|
|
37
37
|
catch (e) {
|
package/controllers/view.js
CHANGED
|
@@ -25,7 +25,7 @@ export default async function view(req, res) {
|
|
|
25
25
|
return res.sendStatus(403);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
let dataAccessor = new DataAccessor(req, entity, "view");
|
|
28
|
+
let dataAccessor = new DataAccessor(req.adminizer, req.user, entity, "view");
|
|
29
29
|
let fields = dataAccessor.getFieldsConfig();
|
|
30
30
|
let record;
|
|
31
31
|
try {
|
package/controllers/widgetsDB.js
CHANGED
|
@@ -12,7 +12,7 @@ export default async function widgetsDB(req, res) {
|
|
|
12
12
|
}
|
|
13
13
|
if (req.method.toUpperCase() === 'GET') {
|
|
14
14
|
try {
|
|
15
|
-
let widgets = await req.adminizer.widgetHandler.getWidgetsDB(id, auth);
|
|
15
|
+
let widgets = await req.adminizer.widgetHandler.getWidgetsDB(id, auth, req.i18n);
|
|
16
16
|
return res.json({ widgetsDB: widgets });
|
|
17
17
|
}
|
|
18
18
|
catch (e) {
|
|
@@ -25,7 +25,7 @@ export default async function widgetsDB(req, res) {
|
|
|
25
25
|
}
|
|
26
26
|
try {
|
|
27
27
|
return res.json({
|
|
28
|
-
userID: await req.adminizer.widgetHandler.setWidgetsDB(id, req.body
|
|
28
|
+
userID: await req.adminizer.widgetHandler.setWidgetsDB(id, req.body, auth),
|
|
29
29
|
status: 'ok'
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -6,12 +6,13 @@ export class AccessRightsHelper {
|
|
|
6
6
|
this.adminizer = adminizer;
|
|
7
7
|
}
|
|
8
8
|
registerToken(accessRightsToken) {
|
|
9
|
+
accessRightsToken.id = accessRightsToken.id.toLowerCase();
|
|
9
10
|
if (!accessRightsToken.id || !accessRightsToken.name || !accessRightsToken.description || !accessRightsToken.department) {
|
|
10
11
|
throw new Error("Adminpanel > Can not register token: Missed one or more required parameters");
|
|
11
12
|
}
|
|
12
13
|
for (let token of this._tokens) {
|
|
13
14
|
if (token.id === accessRightsToken.id) {
|
|
14
|
-
throw new Error(
|
|
15
|
+
throw new Error(`Adminpanel > Can not register token: Token with this id ["${token.id}"] already registered`);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
this._tokens.push(accessRightsToken);
|
|
@@ -42,6 +43,11 @@ export class AccessRightsHelper {
|
|
|
42
43
|
return tokens.some((token) => this.hasPermission(token, user));
|
|
43
44
|
}
|
|
44
45
|
hasPermission(tokenId, user) {
|
|
46
|
+
if (!tokenId) {
|
|
47
|
+
Adminizer.log.error(`AccessRightsHelper > hasPermission no tokenId: ${tokenId}`);
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
tokenId = tokenId.toLowerCase();
|
|
45
51
|
if (!this.adminizer.config.auth.enable) {
|
|
46
52
|
return true;
|
|
47
53
|
}
|
|
@@ -50,7 +56,7 @@ export class AccessRightsHelper {
|
|
|
50
56
|
}
|
|
51
57
|
const tokenIsValid = this._tokens.some((token) => token.id === tokenId);
|
|
52
58
|
if (!tokenIsValid) {
|
|
53
|
-
Adminizer.log.error("Adminpanel > Token is not valid");
|
|
59
|
+
Adminizer.log.error("Adminpanel > Token is not valid", tokenId, user.login);
|
|
54
60
|
return false;
|
|
55
61
|
}
|
|
56
62
|
return user.groups.some((group) => group.tokens?.includes(tokenId));
|
|
@@ -84,7 +84,7 @@ export class ControllerHelper {
|
|
|
84
84
|
const entityType = req.params.entityType;
|
|
85
85
|
if (!entityType) {
|
|
86
86
|
const extractedEntityType = req.originalUrl.split('/')[2];
|
|
87
|
-
if (["form", "model"
|
|
87
|
+
if (["form", "model"].includes(extractedEntityType)) {
|
|
88
88
|
return extractedEntityType;
|
|
89
89
|
}
|
|
90
90
|
else {
|
package/helpers/fieldsHelper.js
CHANGED
|
@@ -42,7 +42,7 @@ export class FieldsHelper {
|
|
|
42
42
|
name: modelName, config: req.adminizer.config.models[modelName],
|
|
43
43
|
model: Model, uri: `${req.adminizer.config.routePrefix}/model/${modelName}`, type: "model"
|
|
44
44
|
};
|
|
45
|
-
let dataAccessor = new DataAccessor(req, entity, action);
|
|
45
|
+
let dataAccessor = new DataAccessor(req.adminizer, req.user, entity, action);
|
|
46
46
|
list = await Model.find({}, dataAccessor);
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
|
@@ -25,7 +25,7 @@ export default function inertiaAddHelper(req, entity, fields, record, view = fal
|
|
|
25
25
|
continue;
|
|
26
26
|
let field = fields[key];
|
|
27
27
|
let fieldConfig = field.config;
|
|
28
|
-
if (fieldConfig.visible === false)
|
|
28
|
+
if (!!fieldConfig.visible === false)
|
|
29
29
|
continue;
|
|
30
30
|
const type = (fieldConfig.type || fieldConfig.type).toLowerCase();
|
|
31
31
|
//@ts-ignore TODO: fix model validations
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from "./helpers/configHelper";
|
|
2
2
|
export * from "./helpers/accessRightsHelper";
|
|
3
|
-
export * from "./lib/installStepper/installStepper";
|
|
4
3
|
export * from "./lib/widgets/widgetHandler";
|
|
5
4
|
export * from "./lib/catalog/CatalogHandler";
|
|
6
5
|
export * from "./lib/media-manager/MediaManagerHandler";
|
package/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from "./helpers/configHelper";
|
|
2
2
|
export * from "./helpers/accessRightsHelper";
|
|
3
|
-
export * from "./lib/installStepper/installStepper";
|
|
4
3
|
export * from "./lib/widgets/widgetHandler";
|
|
5
4
|
export * from "./lib/catalog/CatalogHandler";
|
|
6
5
|
export * from "./lib/media-manager/MediaManagerHandler";
|
|
@@ -123,23 +123,6 @@ export interface AdminpanelConfig {
|
|
|
123
123
|
* */
|
|
124
124
|
set?: SetFunction;
|
|
125
125
|
};
|
|
126
|
-
/**
|
|
127
|
-
* Wizards
|
|
128
|
-
* */
|
|
129
|
-
installStepper?: {
|
|
130
|
-
path: string;
|
|
131
|
-
data: {
|
|
132
|
-
[key: string]: FieldsModels;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* Custom getter
|
|
136
|
-
* */
|
|
137
|
-
get?: GetFunction;
|
|
138
|
-
/**
|
|
139
|
-
* Custom setter
|
|
140
|
-
* */
|
|
141
|
-
set?: SetFunction;
|
|
142
|
-
};
|
|
143
126
|
/**
|
|
144
127
|
* Prime administrator login credentials
|
|
145
128
|
* */
|
|
@@ -266,7 +249,7 @@ export interface ModelConfig {
|
|
|
266
249
|
* May be association or association-many to UserAP or GroupAP */
|
|
267
250
|
userAccessRelation?: {
|
|
268
251
|
field: string;
|
|
269
|
-
via
|
|
252
|
+
via?: string;
|
|
270
253
|
} | string;
|
|
271
254
|
userAccessRelationCallback?: (userWithGroups: UserWithGroups, record: any) => boolean;
|
|
272
255
|
}
|
|
@@ -407,7 +390,7 @@ export interface HrefConfig {
|
|
|
407
390
|
/**
|
|
408
391
|
* Only for view, controller still uses his own access rights token
|
|
409
392
|
* */
|
|
410
|
-
accessRightsToken?: string;
|
|
393
|
+
accessRightsToken?: string | undefined;
|
|
411
394
|
/**
|
|
412
395
|
* For menu items only
|
|
413
396
|
* */
|
package/interfaces/global.d.ts
CHANGED
|
@@ -75,6 +75,9 @@ declare global {
|
|
|
75
75
|
i18n: I18n;
|
|
76
76
|
};
|
|
77
77
|
type ResType = Response & {
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated // TODO delete after finish catalog
|
|
80
|
+
*/
|
|
78
81
|
viewAdmin(specifiedPath: string, locals?: any, cb_view?: Function): void;
|
|
79
82
|
};
|
|
80
83
|
type MiddlewareType = (req: ReqType, res: ResType, next: NextFunction) => void;
|
package/interfaces/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractModel } from "../lib/v4/model/AbstractModel";
|
|
2
2
|
import { ModelConfig } from "./adminpanelConfig";
|
|
3
|
-
export type EntityType = "form" | "model"
|
|
3
|
+
export type EntityType = "form" | "model";
|
|
4
4
|
export interface Entity {
|
|
5
5
|
name: string;
|
|
6
6
|
config?: ModelConfig;
|
package/lib/Adminizer.js
CHANGED
|
@@ -45,7 +45,7 @@ export class Adminizer {
|
|
|
45
45
|
controlsHandler;
|
|
46
46
|
jwtSecret = process.env.JWT_SECRET ?? uuid();
|
|
47
47
|
static logger = winston.createLogger({
|
|
48
|
-
level: "
|
|
48
|
+
level: process.env.LOG_LEVEL ?? "debug",
|
|
49
49
|
format: winston.format.combine(winston.format.timestamp(), winston.format.printf(({ timestamp, level, message, ...meta }) => {
|
|
50
50
|
const metaString = Object.keys(meta).length ? JSON.stringify(meta) : "";
|
|
51
51
|
return `[${timestamp}] ${level.toUpperCase()}: ${message} ${metaString}`;
|
|
@@ -93,6 +93,9 @@ export class Adminizer {
|
|
|
93
93
|
async init(config) {
|
|
94
94
|
// set cookie parser
|
|
95
95
|
this.app.use(cookieParser());
|
|
96
|
+
if (!config || Object.keys(config).length === 0) {
|
|
97
|
+
Adminizer.log.warn(`Adminizer init > Adminizer config is emtpy`);
|
|
98
|
+
}
|
|
96
99
|
// Set vite middleware
|
|
97
100
|
const isViteDev = process.env.VITE_ENV === "dev";
|
|
98
101
|
if (isViteDev)
|
|
@@ -129,17 +132,18 @@ export class Adminizer {
|
|
|
129
132
|
this.policyManager = new PolicyManager(this);
|
|
130
133
|
await this.policyManager.loadPolicies();
|
|
131
134
|
this.accessRightsHelper = new AccessRightsHelper(this);
|
|
135
|
+
// Helpers go to construtor
|
|
132
136
|
this.configHelper = new ConfigHelper(this);
|
|
133
137
|
this.menuHelper = new MenuHelper(this.config);
|
|
134
138
|
this.widgetHandler = new WidgetHandler(this);
|
|
135
139
|
bindExpressUtils(this.app);
|
|
136
140
|
bindReqFunctions(this);
|
|
137
|
-
// add install stepper policy to check unfilled settings
|
|
138
|
-
// bindInstallStepper(this); // TODO It is necessary to provide an opportunity to be inserted by an intermediary after authorization, but before the admin panel, in order to block the user from managing the Installstepper's admin panel.
|
|
139
141
|
// Bind assets
|
|
140
142
|
bindAssets(this.app, this.config.routePrefix);
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
+
if (!process.env.VITEST) {
|
|
144
|
+
if ((process.env.DEV && process.env.NODE_ENV !== 'production') || process.env.ADMINPANEL_FORCE_BIND_DEV === "TRUE") {
|
|
145
|
+
bindDev(this);
|
|
146
|
+
}
|
|
143
147
|
}
|
|
144
148
|
await bindDashboardWidgets(this);
|
|
145
149
|
// bindNavigation(this);
|
|
@@ -324,12 +324,9 @@
|
|
|
324
324
|
// try {
|
|
325
325
|
// await fs.promises.access(file);
|
|
326
326
|
// await fs.promises.unlink(file);
|
|
327
|
-
// console.log('The file was successfully deleted');
|
|
328
327
|
// } catch (err) {
|
|
329
328
|
// if (err.code === 'ENOENT') {
|
|
330
|
-
// console.log('The file does not exist');
|
|
331
329
|
// } else if (err.code === 'EPERM') {
|
|
332
|
-
// console.log('You do not have permission to delete this file');
|
|
333
330
|
// } else {
|
|
334
331
|
// console.error(`An error occurred: ${err}`);
|
|
335
332
|
// }
|
package/lib/v4/DataAccessor.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Entity } from "../../interfaces/types";
|
|
5
5
|
import { ActionType } from "../../interfaces/adminpanelConfig";
|
|
6
6
|
import { Fields } from "../../helpers/fieldsHelper";
|
|
7
|
+
import { Adminizer } from "../Adminizer";
|
|
7
8
|
import { UserAP } from "models/UserAP";
|
|
8
9
|
export declare class DataAccessor {
|
|
9
10
|
private readonly adminizer;
|
|
@@ -11,7 +12,8 @@ export declare class DataAccessor {
|
|
|
11
12
|
entity: Entity;
|
|
12
13
|
action: ActionType;
|
|
13
14
|
private fields;
|
|
14
|
-
|
|
15
|
+
private actionVerb;
|
|
16
|
+
constructor(adminizer: Adminizer, user: UserAP, entity: Entity, action: ActionType);
|
|
15
17
|
/**
|
|
16
18
|
* Retrieves the fields for the given entity based on action type,
|
|
17
19
|
* taking into account access rights and configuration settings.
|
package/lib/v4/DataAccessor.js
CHANGED
|
@@ -6,11 +6,14 @@ export class DataAccessor {
|
|
|
6
6
|
entity;
|
|
7
7
|
action;
|
|
8
8
|
fields = null;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
actionVerb;
|
|
10
|
+
// TODO: change req to adminizr + user
|
|
11
|
+
constructor(adminizer, user, entity, action) {
|
|
12
|
+
this.adminizer = adminizer;
|
|
13
|
+
this.user = user;
|
|
12
14
|
this.entity = entity;
|
|
13
15
|
this.action = action;
|
|
16
|
+
this.actionVerb = getTokenAction(this.action);
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
19
|
* Retrieves the fields for the given entity based on action type,
|
|
@@ -28,6 +31,11 @@ export class DataAccessor {
|
|
|
28
31
|
const actionConfig = ControllerHelper.findActionConfig(this.entity, this.action);
|
|
29
32
|
const fieldsConfig = this.entity.config?.fields || {};
|
|
30
33
|
const modelAttributes = this.entity.model.attributes;
|
|
34
|
+
const tokenId = `${this.actionVerb}-${this.entity.model.modelname}-${this.entity.type}`;
|
|
35
|
+
if (!this.adminizer.accessRightsHelper.hasPermission(tokenId, this.user)) {
|
|
36
|
+
Adminizer.log.debug(`No access rights to ${this.entity.type}: ${this.entity.model.modelname}`);
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
31
39
|
const result = {};
|
|
32
40
|
Object.entries(modelAttributes).forEach(([key, modelField]) => {
|
|
33
41
|
// Checks for short type in Waterline: fieldName: 'string'
|
|
@@ -66,13 +74,19 @@ export class DataAccessor {
|
|
|
66
74
|
let populatedModelFieldsConfig = {};
|
|
67
75
|
if (modelField.type === "association" || modelField.type === "association-many") {
|
|
68
76
|
const modelName = modelField.model || modelField.collection;
|
|
77
|
+
// Todo: test > hide relation without model token
|
|
78
|
+
const tokenId = `${this.actionVerb}-${modelName}-${this.entity.type}`;
|
|
79
|
+
if (!this.adminizer.accessRightsHelper.hasPermission(tokenId, this.user)) {
|
|
80
|
+
Adminizer.log.silly(`No access rights to ${this.entity.type}: ${this.entity.model.modelname}`);
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
69
83
|
if (modelName) {
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
84
|
+
const model = this.adminizer.modelHandler.model.get(modelName);
|
|
85
|
+
if (model) {
|
|
72
86
|
populatedModelFieldsConfig = this.getAssociatedFieldsConfig(modelName);
|
|
73
87
|
}
|
|
74
88
|
else {
|
|
75
|
-
Adminizer.log.error(`Model not found: ${modelName}`);
|
|
89
|
+
Adminizer.log.error(`DataAccessor > getFieldsConfig > Model not found: ${modelName} when ${key}`);
|
|
76
90
|
}
|
|
77
91
|
}
|
|
78
92
|
}
|
|
@@ -86,6 +100,7 @@ export class DataAccessor {
|
|
|
86
100
|
result[key] = { config: fldConfig, model: modelField, populated: populatedModelFieldsConfig };
|
|
87
101
|
});
|
|
88
102
|
this.fields = result;
|
|
103
|
+
console.log(result);
|
|
89
104
|
return result;
|
|
90
105
|
}
|
|
91
106
|
getAssociatedFieldsConfig(modelName) {
|
|
@@ -94,10 +109,9 @@ export class DataAccessor {
|
|
|
94
109
|
return undefined;
|
|
95
110
|
}
|
|
96
111
|
// Check if user has access to the associated model
|
|
97
|
-
const
|
|
98
|
-
const tokenId = `${actionVerb}-${modelName}-${this.entity.type}`;
|
|
112
|
+
const tokenId = `${this.actionVerb}-${modelName}-${this.entity.type}`;
|
|
99
113
|
if (!this.adminizer.accessRightsHelper.hasPermission(tokenId, this.user)) {
|
|
100
|
-
Adminizer.log.
|
|
114
|
+
Adminizer.log.debug(`No access rights to ${this.entity.type}: ${modelName}`);
|
|
101
115
|
return undefined;
|
|
102
116
|
}
|
|
103
117
|
const associatedFields = {};
|
package/lib/v4/I18n.js
CHANGED
|
@@ -104,7 +104,9 @@ export class I18n {
|
|
|
104
104
|
return;
|
|
105
105
|
const file = this.locateFile(locale);
|
|
106
106
|
const tmpFile = `${file}.tmp`;
|
|
107
|
+
const dir = path.dirname(file);
|
|
107
108
|
try {
|
|
109
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
108
110
|
fs.writeFileSync(tmpFile, JSON.stringify(I18n.locales[locale], null, this.indent), "utf8");
|
|
109
111
|
fs.renameSync(tmpFile, file);
|
|
110
112
|
}
|
|
@@ -400,7 +400,14 @@ export class SequelizeAdapter extends AbstractAdapter {
|
|
|
400
400
|
/**Registration of system models*/
|
|
401
401
|
static async registerSystemModels(sequelize) {
|
|
402
402
|
const modelsDir = path.resolve(import.meta.dirname, "../../../../models");
|
|
403
|
-
|
|
403
|
+
let files = fs.readdirSync(modelsDir).filter(f => f.endsWith(".js"));
|
|
404
|
+
// Try with ts files (exclude .d.ts)
|
|
405
|
+
if (!files.length) {
|
|
406
|
+
files = fs.readdirSync(modelsDir).filter(f => f.endsWith(".ts") && !f.endsWith(".d.ts"));
|
|
407
|
+
}
|
|
408
|
+
if (!files.length) {
|
|
409
|
+
throw `Model files not found in dir ${modelsDir}`;
|
|
410
|
+
}
|
|
404
411
|
for (const file of files) {
|
|
405
412
|
const modelName = path.basename(file, path.extname(file));
|
|
406
413
|
const filePath = path.resolve(modelsDir, file);
|
|
@@ -90,10 +90,13 @@ export class WaterlineAdapter extends AbstractAdapter {
|
|
|
90
90
|
/** Method that processes custom waterline model creation. Is used for system models. Replaces beforeCreate method in waterline */
|
|
91
91
|
static async registerSystemModels(waterlineORM) {
|
|
92
92
|
const systemModelsDir = path.resolve(import.meta.dirname, "../../../../models");
|
|
93
|
-
|
|
93
|
+
let systemModelsFiles = fs.readdirSync(systemModelsDir).filter(file => file.endsWith(".js"));
|
|
94
|
+
if (!systemModelsFiles.length) {
|
|
95
|
+
systemModelsFiles = fs.readdirSync(systemModelsDir).filter(file => file.endsWith(".ts") && !file.endsWith(".d.ts"));
|
|
96
|
+
}
|
|
94
97
|
// Register adminizer system models
|
|
95
98
|
await Promise.all(systemModelsFiles.map(async (file) => {
|
|
96
|
-
const modelName = path.basename(file
|
|
99
|
+
const modelName = path.basename(file).replace(/\.(ts|js)$/, "");
|
|
97
100
|
const systemModelPath = path.resolve(systemModelsDir, file);
|
|
98
101
|
const adminizerModel = (await import(pathToFileURL(systemModelPath).href)).default;
|
|
99
102
|
const waterlineLikeModel = generateWaterlineModel(modelName, adminizerModel);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BaseWidget from "./abstractWidgetBase";
|
|
2
2
|
export default abstract class ActionBase extends BaseWidget {
|
|
3
3
|
readonly widgetType = "action";
|
|
4
|
-
/** Widget background css
|
|
4
|
+
/** Widget background css color */
|
|
5
5
|
abstract readonly backgroundCSS: string | null;
|
|
6
6
|
abstract action(): Promise<any>;
|
|
7
7
|
}
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default abstract class CustomBase
|
|
3
|
-
/** Widget
|
|
4
|
-
abstract readonly
|
|
5
|
-
/**
|
|
6
|
-
abstract readonly
|
|
7
|
-
/**
|
|
8
|
-
abstract readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { MaterialIcon } from "material-icons";
|
|
2
|
+
export default abstract class CustomBase {
|
|
3
|
+
/** Widget unique id */
|
|
4
|
+
abstract readonly id: string;
|
|
5
|
+
/** Widget Name */
|
|
6
|
+
abstract readonly name: string;
|
|
7
|
+
/** JS module file path */
|
|
8
|
+
abstract readonly jsPath: {
|
|
9
|
+
dev: string;
|
|
10
|
+
production: string;
|
|
11
|
+
};
|
|
12
|
+
/** For group access rights by department */
|
|
13
|
+
abstract readonly department: string;
|
|
14
|
+
/** Widget background css color */
|
|
15
|
+
readonly backgroundCSS: string;
|
|
16
|
+
/** Widget size */
|
|
17
|
+
abstract readonly size: {
|
|
18
|
+
h: number;
|
|
19
|
+
w: number;
|
|
20
|
+
} | null;
|
|
21
|
+
/** Widget description */
|
|
22
|
+
abstract readonly description: string;
|
|
23
|
+
/** Widget icon */
|
|
24
|
+
abstract readonly icon?: MaterialIcon | string;
|
|
25
|
+
readonly widgetType: 'custom';
|
|
26
|
+
routePrefix: string;
|
|
27
|
+
protected constructor(routePrefix: string);
|
|
13
28
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export default class CustomBase {
|
|
2
|
+
/** Widget background css color */
|
|
3
|
+
backgroundCSS;
|
|
4
|
+
widgetType = 'custom';
|
|
5
|
+
routePrefix;
|
|
6
|
+
constructor(routePrefix) {
|
|
7
|
+
this.routePrefix = routePrefix;
|
|
8
|
+
}
|
|
3
9
|
}
|