@nocobase/plugin-acl 0.20.0-alpha.15 → 0.20.0-alpha.17
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/dist/client/hooks/load-more-observer.d.ts +7 -0
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +2 -2
- package/dist/client/locale.d.ts +1 -1
- package/dist/externalVersion.js +8 -8
- package/dist/locale/zh-CN.json +6 -1
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +5 -5
- package/package.json +2 -2
package/dist/client/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Plugin } from '@nocobase/client';
|
|
2
2
|
import { RolesManager } from './roles-manager';
|
|
3
|
-
declare class
|
|
3
|
+
export declare class PluginACLClient extends Plugin {
|
|
4
4
|
rolesManager: RolesManager;
|
|
5
5
|
load(): Promise<void>;
|
|
6
6
|
}
|
|
7
|
-
export default ACLPlugin;
|
|
8
7
|
export { RolesManagerContext } from './RolesManagerProvider';
|
|
8
|
+
export default PluginACLClient;
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(d,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("react"),require("antd"),require("@formily/react"),require("@ant-design/icons"),require("react-i18next"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("ahooks"),require("lodash"),require("antd-style")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","react","antd","@formily/react","@ant-design/icons","react-i18next","@formily/shared","@nocobase/utils/client","@formily/core","ahooks","lodash","antd-style"],u):(d=typeof globalThis!="undefined"?globalThis:d||self,u(d["@nocobase/plugin-acl"]={},d["@nocobase/client"],d.jsxRuntime,d.react,d.antd,d["@formily/react"],d["@ant-design/icons"],d["react-i18next"],d["@formily/shared"],d["@nocobase/utils"],d["@formily/core"],d.ahooks,d.lodash,d["antd-style"]))})(this,function(d,u,s,g,p,I,G,S,x,k,de,Qe,Z,Re){"use strict";var Si=Object.defineProperty,wi=Object.defineProperties;var Ai=Object.getOwnPropertyDescriptors;var Ze=Object.getOwnPropertySymbols;var Pi=Object.prototype.hasOwnProperty,Ii=Object.prototype.propertyIsEnumerable;var ue=(d,u,s)=>u in d?Si(d,u,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[u]=s,w=(d,u)=>{for(var s in u||(u={}))Pi.call(u,s)&&ue(d,s,u[s]);if(Ze)for(var s of Ze(u))Ii.call(u,s)&&ue(d,s,u[s]);return d},T=(d,u)=>wi(d,Ai(u));var pe=(d,u,s)=>(ue(d,typeof u!="symbol"?u+"":u,s),s);var A=(d,u,s)=>new Promise((g,p)=>{var I=x=>{try{S(s.next(x))}catch(k){p(k)}},G=x=>{try{S(s.throw(x))}catch(k){p(k)}},S=x=>x.done?g(x.value):Promise.resolve(x.value).then(I,G);S((s=s.apply(d,u)).next())});function O(){return S.useTranslation(["acl","client"],{nsMode:"fallback"})}const P=g.createContext({role:null});P.displayName="RolesManagerContext";var U=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function he(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var et=Array.isArray,q=et,tt=typeof U=="object"&&U&&U.Object===Object&&U,rt=tt,nt=rt,at=typeof self=="object"&&self&&self.Object===Object&&self,st=nt||at||Function("return this")(),K=st,ot=K,it=ot.Symbol,z=it,fe=z,ve=Object.prototype,ct=ve.hasOwnProperty,lt=ve.toString,j=fe?fe.toStringTag:void 0;function ut(e){var t=ct.call(e,j),r=e[j];try{e[j]=void 0;var n=!0}catch(i){}var a=lt.call(e);return n&&(t?e[j]=r:delete e[j]),a}var pt=ut,dt=Object.prototype,ht=dt.toString;function ft(e){return ht.call(e)}var vt=ft,ge=z,gt=pt,mt=vt,yt="[object Null]",_t="[object Undefined]",me=ge?ge.toStringTag:void 0;function bt(e){return e==null?e===void 0?_t:yt:me&&me in Object(e)?gt(e):mt(e)}var Q=bt;function $t(e){return e!=null&&typeof e=="object"}var R=$t,Ct=Q,xt=R,St="[object Symbol]";function wt(e){return typeof e=="symbol"||xt(e)&&Ct(e)==St}var ee=wt,At=q,Pt=ee,It=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tt=/^\w*$/;function Ot(e,t){if(At(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Pt(e)?!0:Tt.test(e)||!It.test(e)||t!=null&&e in Object(t)}var Mt=Ot;function Ft(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var te=Ft,Dt=Q,Nt=te,Et="[object AsyncFunction]",kt="[object Function]",qt="[object GeneratorFunction]",jt="[object Proxy]";function Ht(e){if(!Nt(e))return!1;var t=Dt(e);return t==kt||t==qt||t==Et||t==jt}var Gt=Ht,Ut=K,Kt=Ut["__core-js_shared__"],zt=Kt,re=zt,ye=function(){var e=/[^.]+$/.exec(re&&re.keys&&re.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Lt(e){return!!ye&&ye in e}var Vt=Lt,Wt=Function.prototype,Bt=Wt.toString;function Yt(e){if(e!=null){try{return Bt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Xt=Yt,Jt=Gt,Zt=Vt,Qt=te,Rt=Xt,er=/[\\^$.*+?()[\]{}|]/g,tr=/^\[object .+?Constructor\]$/,rr=Function.prototype,nr=Object.prototype,ar=rr.toString,sr=nr.hasOwnProperty,or=RegExp("^"+ar.call(sr).replace(er,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ir(e){if(!Qt(e)||Zt(e))return!1;var t=Jt(e)?or:tr;return t.test(Rt(e))}var cr=ir;function lr(e,t){return e==null?void 0:e[t]}var ur=lr,pr=cr,dr=ur;function hr(e,t){var r=dr(e,t);return pr(r)?r:void 0}var L=hr,fr=L,vr=fr(Object,"create"),V=vr,_e=V;function gr(){this.__data__=_e?_e(null):{},this.size=0}var mr=gr;function yr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var _r=yr,br=V,$r="__lodash_hash_undefined__",Cr=Object.prototype,xr=Cr.hasOwnProperty;function Sr(e){var t=this.__data__;if(br){var r=t[e];return r===$r?void 0:r}return xr.call(t,e)?t[e]:void 0}var wr=Sr,Ar=V,Pr=Object.prototype,Ir=Pr.hasOwnProperty;function Tr(e){var t=this.__data__;return Ar?t[e]!==void 0:Ir.call(t,e)}var Or=Tr,Mr=V,Fr="__lodash_hash_undefined__";function Dr(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Mr&&t===void 0?Fr:t,this}var Nr=Dr,Er=mr,kr=_r,qr=wr,jr=Or,Hr=Nr;function M(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}M.prototype.clear=Er,M.prototype.delete=kr,M.prototype.get=qr,M.prototype.has=jr,M.prototype.set=Hr;var Gr=M;function Ur(){this.__data__=[],this.size=0}var Kr=Ur;function zr(e,t){return e===t||e!==e&&t!==t}var be=zr,Lr=be;function Vr(e,t){for(var r=e.length;r--;)if(Lr(e[r][0],t))return r;return-1}var W=Vr,Wr=W,Br=Array.prototype,Yr=Br.splice;function Xr(e){var t=this.__data__,r=Wr(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Yr.call(t,r,1),--this.size,!0}var Jr=Xr,Zr=W;function Qr(e){var t=this.__data__,r=Zr(t,e);return r<0?void 0:t[r][1]}var Rr=Qr,en=W;function tn(e){return en(this.__data__,e)>-1}var rn=tn,nn=W;function an(e,t){var r=this.__data__,n=nn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var sn=an,on=Kr,cn=Jr,ln=Rr,un=rn,pn=sn;function F(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}F.prototype.clear=on,F.prototype.delete=cn,F.prototype.get=ln,F.prototype.has=un,F.prototype.set=pn;var dn=F,hn=L,fn=K,vn=hn(fn,"Map"),gn=vn,$e=Gr,mn=dn,yn=gn;function _n(){this.size=0,this.__data__={hash:new $e,map:new(yn||mn),string:new $e}}var bn=_n;function $n(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Cn=$n,xn=Cn;function Sn(e,t){var r=e.__data__;return xn(t)?r[typeof t=="string"?"string":"hash"]:r.map}var B=Sn,wn=B;function An(e){var t=wn(this,e).delete(e);return this.size-=t?1:0,t}var Pn=An,In=B;function Tn(e){return In(this,e).get(e)}var On=Tn,Mn=B;function Fn(e){return Mn(this,e).has(e)}var Dn=Fn,Nn=B;function En(e,t){var r=Nn(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var kn=En,qn=bn,jn=Pn,Hn=On,Gn=Dn,Un=kn;function D(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}D.prototype.clear=qn,D.prototype.delete=jn,D.prototype.get=Hn,D.prototype.has=Gn,D.prototype.set=Un;var Ce=D,xe=Ce,Kn="Expected a function";function ne(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Kn);var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(ne.Cache||xe),r}ne.Cache=xe;var zn=ne,Ln=zn,Vn=500;function Wn(e){var t=Ln(e,function(n){return r.size===Vn&&r.clear(),n}),r=t.cache;return t}var Bn=Wn,Yn=Bn,Xn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Jn=/\\(\\)?/g,Zn=Yn(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Xn,function(r,n,a,i){t.push(a?i.replace(Jn,"$1"):n||r)}),t}),Qn=Zn;function Rn(e,t){for(var r=-1,n=e==null?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a}var ea=Rn,Se=z,ta=ea,ra=q,na=ee,aa=1/0,we=Se?Se.prototype:void 0,Ae=we?we.toString:void 0;function Pe(e){if(typeof e=="string")return e;if(ra(e))return ta(e,Pe)+"";if(na(e))return Ae?Ae.call(e):"";var t=e+"";return t=="0"&&1/e==-aa?"-0":t}var sa=Pe,oa=sa;function ia(e){return e==null?"":oa(e)}var ca=ia,la=q,ua=Mt,pa=Qn,da=ca;function ha(e,t){return la(e)?e:ua(e,t)?[e]:pa(da(e))}var Y=ha,fa=ee,va=1/0;function ga(e){if(typeof e=="string"||fa(e))return e;var t=e+"";return t=="0"&&1/e==-va?"-0":t}var ae=ga,ma=Y,ya=ae;function _a(e,t){t=ma(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[ya(t[r++])];return r&&r==n?e:void 0}var ba=_a,$a=L,Ca=function(){try{var e=$a(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Ie=Ca,Te=Ie;function xa(e,t,r){t=="__proto__"&&Te?Te(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Sa=xa,wa=Sa,Aa=be,Pa=Object.prototype,Ia=Pa.hasOwnProperty;function Ta(e,t,r){var n=e[t];(!(Ia.call(e,t)&&Aa(n,r))||r===void 0&&!(t in e))&&wa(e,t,r)}var Oa=Ta,Ma=9007199254740991,Fa=/^(?:0|[1-9]\d*)$/;function Da(e,t){var r=typeof e;return t=t==null?Ma:t,!!t&&(r=="number"||r!="symbol"&&Fa.test(e))&&e>-1&&e%1==0&&e<t}var Oe=Da,Na=Oa,Ea=Y,ka=Oe,Me=te,qa=ae;function ja(e,t,r,n){if(!Me(e))return e;t=Ea(t,e);for(var a=-1,i=t.length,o=i-1,c=e;c!=null&&++a<i;){var l=qa(t[a]),f=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(a!=o){var v=c[l];f=n?n(v,l,c):void 0,f===void 0&&(f=Me(v)?v:ka(t[a+1])?[]:{})}Na(c,l,f),c=c[l]}return e}var Ha=ja,Ga=ba,Ua=Ha,Ka=Y;function za(e,t,r){for(var n=-1,a=t.length,i={};++n<a;){var o=t[n],c=Ga(e,o);r(c,o)&&Ua(i,Ka(o,e),c)}return i}var La=za;function Va(e,t){return e!=null&&t in Object(e)}var Wa=Va,Ba=Q,Ya=R,Xa="[object Arguments]";function Ja(e){return Ya(e)&&Ba(e)==Xa}var Za=Ja,Fe=Za,Qa=R,De=Object.prototype,Ra=De.hasOwnProperty,es=De.propertyIsEnumerable,ts=Fe(function(){return arguments}())?Fe:function(e){return Qa(e)&&Ra.call(e,"callee")&&!es.call(e,"callee")},Ne=ts,rs=9007199254740991;function ns(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=rs}var as=ns,ss=Y,os=Ne,is=q,cs=Oe,ls=as,us=ae;function ps(e,t,r){t=ss(t,e);for(var n=-1,a=t.length,i=!1;++n<a;){var o=us(t[n]);if(!(i=e!=null&&r(e,o)))break;e=e[o]}return i||++n!=a?i:(a=e==null?0:e.length,!!a&&ls(a)&&cs(o,a)&&(is(e)||os(e)))}var ds=ps,hs=Wa,fs=ds;function vs(e,t){return e!=null&&fs(e,t,hs)}var gs=vs,ms=La,ys=gs;function _s(e,t){return ms(e,t,function(r,n){return ys(e,n)})}var bs=_s;function $s(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}var Cs=$s,Ee=z,xs=Ne,Ss=q,ke=Ee?Ee.isConcatSpreadable:void 0;function ws(e){return Ss(e)||xs(e)||!!(ke&&e&&e[ke])}var As=ws,Ps=Cs,Is=As;function qe(e,t,r,n,a){var i=-1,o=e.length;for(r||(r=Is),a||(a=[]);++i<o;){var c=e[i];t>0&&r(c)?t>1?qe(c,t-1,r,n,a):Ps(a,c):n||(a[a.length]=c)}return a}var Ts=qe,Os=Ts;function Ms(e){var t=e==null?0:e.length;return t?Os(e,1):[]}var Fs=Ms;function Ds(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Ns=Ds,Es=Ns,je=Math.max;function ks(e,t,r){return t=je(t===void 0?e.length-1:t,0),function(){for(var n=arguments,a=-1,i=je(n.length-t,0),o=Array(i);++a<i;)o[a]=n[t+a];a=-1;for(var c=Array(t+1);++a<t;)c[a]=n[a];return c[t]=r(o),Es(e,this,c)}}var qs=ks;function js(e){return function(){return e}}var Hs=js;function Gs(e){return e}var Us=Gs,Ks=Hs,He=Ie,zs=Us,Ls=He?function(e,t){return He(e,"toString",{configurable:!0,enumerable:!1,value:Ks(t),writable:!0})}:zs,Vs=Ls,Ws=800,Bs=16,Ys=Date.now;function Xs(e){var t=0,r=0;return function(){var n=Ys(),a=Bs-(n-r);if(r=n,a>0){if(++t>=Ws)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Js=Xs,Zs=Vs,Qs=Js,Rs=Qs(Zs),eo=Rs,to=Fs,ro=qs,no=eo;function ao(e){return no(ro(e,void 0,to),e+"")}var so=ao,oo=bs,io=so,co=io(function(e,t){return e==null?{}:oo(e,t)}),lo=co;const uo=he(lo),po={type:"object",properties:{[x.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:e=>{const t=u.useRecord(),r=u.useRequest(()=>Promise.resolve({data:uo(t,["title","name","default"])}),T(w({},e),{manual:!0})),n=u.useActionContext();return g.useEffect(()=>{n.visible&&r.run()},[n.visible]),r}},title:'{{t("Edit role")}}',properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},default:{title:"","x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default role")}}'},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},se=()=>{const{t:e}=O(),{data:t}=u.useResourceActionContext(),[r,n]=g.useState(!1),[a,i]=g.useState(null),{role:o,setRole:c}=g.useContext(P),l=((t==null?void 0:t.data)||[]).map(v=>({key:v.name,label:s.jsx(se.Item,{item:v,onEdit:()=>{n(!0),i(v)}})})),f=({key:v})=>{c(((t==null?void 0:t.data)||[]).find(m=>m.name===v))};return g.useEffect(()=>{t!=null&&t.data.length&&c(t==null?void 0:t.data[0])},[t,c]),s.jsxs(s.Fragment,{children:[l.length?s.jsx(p.Menu,{style:{border:"none",maxHeight:"65vh",overflowY:"auto"},items:l,selectedKeys:[o==null?void 0:o.name],onSelect:f}):s.jsx(p.Empty,{image:p.Empty.PRESENTED_IMAGE_SIMPLE}),s.jsx(u.ActionContextProvider,{value:{visible:r,setVisible:n},children:s.jsx(u.RecordProvider,{record:a,collectionName:"departments",children:s.jsx(u.SchemaComponent,{scope:{t:e},schema:po})})})]})};se.Item=function({item:t,onEdit:r}){const{t:n}=O(),{refreshAsync:a}=u.useResourceActionContext(),{modal:i,message:o}=p.App.useApp(),c=u.useAPIClient(),l=()=>{i.confirm({title:n("Delete"),content:n("Are you sure you want to delete it?"),onOk:()=>A(this,null,function*(){yield c.resource("roles").destroy({filterByTk:t.name}),o.success(n("Deleted successfully")),yield a()})})},f=({key:v,domEvent:m})=>{switch(m.stopPropagation(),v){case"edit":r();break;case"delete":l()}};return s.jsxs(p.Row,{children:[s.jsx(p.Col,{flex:3,style:{display:"inline-flex",alignItems:"center"},children:s.jsxs("span",{style:{whiteSpace:"nowrap",width:"120px",overflow:"hidden",textOverflow:"ellipsis"},children:[s.jsx(G.TagOutlined,{}),s.jsx("span",{style:{marginLeft:"10px"},children:I.Schema.compile(t.title,{t:n})})]})}),s.jsxs(p.Col,{children:[t.default?s.jsx(p.Tag,{color:"success",bordered:!1,children:n("Default")}):null,s.jsx(p.Dropdown,{menu:{items:[{label:n("Edit"),key:"edit"},{label:n("Delete"),key:"delete"}],onClick:f},children:s.jsx(G.MoreOutlined,{})})]})]})};const oe=g.createContext([]);oe.displayName="AvailableActionsContext";const ho=e=>{const{data:t,loading:r}=u.useRequest({resource:"availableActions",action:"list"});return r?s.jsx(p.Spin,{}):s.jsx(oe.Provider,{value:t==null?void 0:t.data,children:e.children})},fo=()=>g.useContext(oe);var vo="__lodash_hash_undefined__";function go(e){return this.__data__.set(e,vo),this}var mo=go;function yo(e){return this.__data__.has(e)}var _o=yo,bo=Ce,$o=mo,Co=_o;function X(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new bo;++t<r;)this.add(e[t])}X.prototype.add=X.prototype.push=$o,X.prototype.has=Co;var xo=X;function So(e,t,r,n){for(var a=e.length,i=r+(n?1:-1);n?i--:++i<a;)if(t(e[i],i,e))return i;return-1}var wo=So;function Ao(e){return e!==e}var Po=Ao;function Io(e,t,r){for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}var To=Io,Oo=wo,Mo=Po,Fo=To;function Do(e,t,r){return t===t?Fo(e,t,r):Oo(e,Mo,r)}var No=Do,Eo=No;function ko(e,t){var r=e==null?0:e.length;return!!r&&Eo(e,t,0)>-1}var qo=ko;function jo(e,t,r){for(var n=-1,a=e==null?0:e.length;++n<a;)if(r(t,e[n]))return!0;return!1}var Ho=jo;function Go(e,t){return e.has(t)}var Uo=Go,Ko=L,zo=K,Lo=Ko(zo,"Set"),Vo=Lo;function Wo(){}var Bo=Wo;function Yo(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Ge=Yo,ie=Vo,Xo=Bo,Jo=Ge,Zo=1/0,Qo=ie&&1/Jo(new ie([,-0]))[1]==Zo?function(e){return new ie(e)}:Xo,Ro=Qo,ei=xo,ti=qo,ri=Ho,ni=Uo,ai=Ro,si=Ge,oi=200;function ii(e,t,r){var n=-1,a=ti,i=e.length,o=!0,c=[],l=c;if(r)o=!1,a=ri;else if(i>=oi){var f=t?null:ai(e);if(f)return si(f);o=!1,a=ni,l=new ei}else l=t?[]:c;e:for(;++n<i;){var v=e[n],m=t?t(v):v;if(v=r||v!==0?v:0,o&&m===m){for(var C=l.length;C--;)if(l[C]===m)continue e;t&&l.push(m),c.push(v)}else a(l,m,r)||(l!==c&&l.push(m),c.push(v))}return c}var ci=ii,li=ci;function ui(e){return e&&e.length?li(e):[]}var pi=ui;const di=he(pi),hi=e=>{var r;if(!e)return{};const t={};return(r=e==null?void 0:e.forEach)==null||r.call(e,n=>{const[a,i]=n.split(":");t[a]=i||"all"}),t},Ue=e=>{const t=[];for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];n==="all"?t.push(r):t.push(`${r}:${n}`)}return t},fi=I.connect(e=>{const{onChange:t}=e,r=fo(),n=u.useCompile(),{t:a}=S.useTranslation(),i=I.useField(),o=hi(i.value);return s.jsx("div",{children:s.jsx(p.Table,{rowKey:"name",size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:a("Action display name"),render:c=>n(c)},{dataIndex:"onNewRecord",title:a("Action type"),render:c=>c?s.jsx(p.Tag,{color:"green",children:a("Action on new records")}):s.jsx(p.Tag,{color:"geekblue",children:a("Action on existing records")})},{dataIndex:"enabled",title:a("Allow"),render:(c,l)=>s.jsx(p.Checkbox,{checked:c,"aria-label":`${l.name}_checkbox`,onChange:f=>{c?delete o[l.name]:o[l.name]="all",t(Ue(o))}})},{dataIndex:"scope",title:a("Data scope"),render:(c,l)=>!l.onNewRecord&&s.jsx(p.Select,{"data-testid":"select-data-scope",popupMatchSelectWidth:!1,size:"small",value:c,options:[{label:a("All records"),value:"all"},{label:a("Own records"),value:"own"}],onChange:f=>{o[l.name]=f,t(Ue(o))}})}],dataSource:r==null?void 0:r.map(c=>{let l="all",f=!1;return o[c.name]&&(f=!0,l=o[c.name]),T(w({},c),{enabled:f,scope:l})})})})}),vi=I.connect(e=>{const{t}=S.useTranslation();return s.jsxs(p.Checkbox.Group,{style:{width:"100%",display:"block"},value:e.value,onChange:r=>{const n=["ui.*","pm","pm.*","app"],a=n.map(o=>`!${o}`),i=di([...e.value||[],...r]).filter(o=>o&&!a.includes(o)).map(o=>!n.includes(o)||r!=null&&r.includes(o)?o:`!${o}`);for(const o of n)!i.includes(o)&&!i.includes(`!${o}`)&&i.push(`!${o}`);e.onChange(i)},children:[s.jsx("div",{style:{marginTop:16},children:s.jsx(p.Checkbox,{value:"ui.*",children:t("Allows to configure interface")})}),s.jsx("div",{style:{marginTop:8},children:s.jsx(p.Checkbox,{value:"pm",children:t("Allows to install, activate, disable plugins")})}),s.jsx("div",{style:{marginTop:8},children:s.jsx(p.Checkbox,{value:"pm.*",children:t("Allows to configure plugins")})}),s.jsx("div",{style:{marginTop:8},children:s.jsx(p.Checkbox,{value:"app",children:t("Allows to clear cache, reboot application")})})]})}),gi=({active:e})=>{const{role:t,setRole:r}=g.useContext(P),{t:n}=O(),a=u.useAPIClient(),{data:i}=u.useRequest(()=>a.resource("roles").get({filterByTk:t==null?void 0:t.name}).then(l=>{var v,m;const f=(v=l==null?void 0:l.data)==null?void 0:v.data;return(m=f.snippets)==null||m.forEach(C=>{f[C]=!0}),f}),{ready:e,refreshDeps:[t==null?void 0:t.name]}),o=Qe.useMemoizedFn(l=>A(this,null,function*(){yield a.resource("roles").update({filterByTk:t.name,values:l.values}),r(w(w({},t),l.values)),p.message.success(n("Saved successfully"))})),c=g.useMemo(()=>de.createForm({values:i,effects(){de.onFormValuesChange(l=>A(this,null,function*(){yield o(l)}))}}),[i,o]);return s.jsx(u.SchemaComponent,{components:{SnippetCheckboxGroup:vi,StrategyActions:fi},schema:{type:"void",name:x.uid(),"x-component":"FormV2","x-component-props":{form:c},properties:{snippets:{title:n("Configure permissions"),type:"boolean","x-decorator":"FormItem","x-component":"SnippetCheckboxGroup"},allowNewMenu:{title:n("Menu permissions"),"x-decorator":"FormItem","x-component":"Checkbox","x-content":n("New menu items are allowed to be accessed by default.")}}}})},ce=g.createContext(null);ce.displayName="MenuItemsContext";const Ke=(e={})=>{const t=[];for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r],a={title:n.title,uid:n["x-uid"]};n.properties&&(a.children=Ke(n.properties)),t.push(a)}return t},mi=()=>g.useContext(ce),ze=e=>{var i,o;const r={url:`uiSchemas:getProperties/${u.useAdminSchemaUid()}`},n=u.useRequest(r);if(n.loading)return s.jsx(p.Spin,{});const a=Ke((o=(i=n.data)==null?void 0:i.data)==null?void 0:o.properties);return s.jsx(ce.Provider,{value:{service:n,items:a},children:e.children})},Le=Re.createStyles(({css:e})=>e`
|
|
1
|
+
(function(v,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("react"),require("antd"),require("@formily/react"),require("@ant-design/icons"),require("react-i18next"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("ahooks"),require("lodash"),require("antd-style")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","react","antd","@formily/react","@ant-design/icons","react-i18next","@formily/shared","@nocobase/utils/client","@formily/core","ahooks","lodash","antd-style"],u):(v=typeof globalThis!="undefined"?globalThis:v||self,u(v["@nocobase/plugin-acl"]={},v["@nocobase/client"],v.jsxRuntime,v.react,v.antd,v["@formily/react"],v["@ant-design/icons"],v["react-i18next"],v["@formily/shared"],v["@nocobase/utils"],v["@formily/core"],v.ahooks,v.lodash,v["antd-style"]))})(this,function(v,u,s,h,d,M,U,A,S,q,he,Qe,R,Re){"use strict";var Ai=Object.defineProperty,Pi=Object.defineProperties;var Ii=Object.getOwnPropertyDescriptors;var Ze=Object.getOwnPropertySymbols;var Ti=Object.prototype.hasOwnProperty,Oi=Object.prototype.propertyIsEnumerable;var de=(v,u,s)=>u in v?Ai(v,u,{enumerable:!0,configurable:!0,writable:!0,value:s}):v[u]=s,P=(v,u)=>{for(var s in u||(u={}))Ti.call(u,s)&&de(v,s,u[s]);if(Ze)for(var s of Ze(u))Oi.call(u,s)&&de(v,s,u[s]);return v},F=(v,u)=>Pi(v,Ii(u));var pe=(v,u,s)=>(de(v,typeof u!="symbol"?u+"":u,s),s);var w=(v,u,s)=>new Promise((h,d)=>{var M=S=>{try{A(s.next(S))}catch(q){d(q)}},U=S=>{try{A(s.throw(S))}catch(q){d(q)}},A=S=>S.done?h(S.value):Promise.resolve(S.value).then(M,U);A((s=s.apply(v,u)).next())});function E(){return A.useTranslation(["@nocobase/plugin-acl","client"],{nsMode:"fallback"})}const I=h.createContext({role:null});I.displayName="RolesManagerContext";var z=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function fe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var et=Array.isArray,j=et,tt=typeof z=="object"&&z&&z.Object===Object&&z,rt=tt,nt=rt,at=typeof self=="object"&&self&&self.Object===Object&&self,st=nt||at||Function("return this")(),K=st,ot=K,it=ot.Symbol,L=it,ve=L,ge=Object.prototype,ct=ge.hasOwnProperty,lt=ge.toString,H=ve?ve.toStringTag:void 0;function ut(e){var t=ct.call(e,H),r=e[H];try{e[H]=void 0;var n=!0}catch(o){}var a=lt.call(e);return n&&(t?e[H]=r:delete e[H]),a}var dt=ut,pt=Object.prototype,ht=pt.toString;function ft(e){return ht.call(e)}var vt=ft,me=L,gt=dt,mt=vt,yt="[object Null]",_t="[object Undefined]",ye=me?me.toStringTag:void 0;function bt(e){return e==null?e===void 0?_t:yt:ye&&ye in Object(e)?gt(e):mt(e)}var ee=bt;function Ct(e){return e!=null&&typeof e=="object"}var te=Ct,$t=ee,xt=te,St="[object Symbol]";function wt(e){return typeof e=="symbol"||xt(e)&&$t(e)==St}var re=wt,At=j,Pt=re,It=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tt=/^\w*$/;function Ot(e,t){if(At(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Pt(e)?!0:Tt.test(e)||!It.test(e)||t!=null&&e in Object(t)}var Mt=Ot;function Ft(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ne=Ft,Et=ee,Dt=ne,Nt="[object AsyncFunction]",kt="[object Function]",qt="[object GeneratorFunction]",jt="[object Proxy]";function Ht(e){if(!Dt(e))return!1;var t=Et(e);return t==kt||t==qt||t==Nt||t==jt}var Gt=Ht,Ut=K,zt=Ut["__core-js_shared__"],Kt=zt,ae=Kt,_e=function(){var e=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Lt(e){return!!_e&&_e in e}var Vt=Lt,Wt=Function.prototype,Bt=Wt.toString;function Yt(e){if(e!=null){try{return Bt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Xt=Yt,Jt=Gt,Zt=Vt,Qt=ne,Rt=Xt,er=/[\\^$.*+?()[\]{}|]/g,tr=/^\[object .+?Constructor\]$/,rr=Function.prototype,nr=Object.prototype,ar=rr.toString,sr=nr.hasOwnProperty,or=RegExp("^"+ar.call(sr).replace(er,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ir(e){if(!Qt(e)||Zt(e))return!1;var t=Jt(e)?or:tr;return t.test(Rt(e))}var cr=ir;function lr(e,t){return e==null?void 0:e[t]}var ur=lr,dr=cr,pr=ur;function hr(e,t){var r=pr(e,t);return dr(r)?r:void 0}var V=hr,fr=V,vr=fr(Object,"create"),W=vr,be=W;function gr(){this.__data__=be?be(null):{},this.size=0}var mr=gr;function yr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var _r=yr,br=W,Cr="__lodash_hash_undefined__",$r=Object.prototype,xr=$r.hasOwnProperty;function Sr(e){var t=this.__data__;if(br){var r=t[e];return r===Cr?void 0:r}return xr.call(t,e)?t[e]:void 0}var wr=Sr,Ar=W,Pr=Object.prototype,Ir=Pr.hasOwnProperty;function Tr(e){var t=this.__data__;return Ar?t[e]!==void 0:Ir.call(t,e)}var Or=Tr,Mr=W,Fr="__lodash_hash_undefined__";function Er(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Mr&&t===void 0?Fr:t,this}var Dr=Er,Nr=mr,kr=_r,qr=wr,jr=Or,Hr=Dr;function D(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}D.prototype.clear=Nr,D.prototype.delete=kr,D.prototype.get=qr,D.prototype.has=jr,D.prototype.set=Hr;var Gr=D;function Ur(){this.__data__=[],this.size=0}var zr=Ur;function Kr(e,t){return e===t||e!==e&&t!==t}var Ce=Kr,Lr=Ce;function Vr(e,t){for(var r=e.length;r--;)if(Lr(e[r][0],t))return r;return-1}var B=Vr,Wr=B,Br=Array.prototype,Yr=Br.splice;function Xr(e){var t=this.__data__,r=Wr(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Yr.call(t,r,1),--this.size,!0}var Jr=Xr,Zr=B;function Qr(e){var t=this.__data__,r=Zr(t,e);return r<0?void 0:t[r][1]}var Rr=Qr,en=B;function tn(e){return en(this.__data__,e)>-1}var rn=tn,nn=B;function an(e,t){var r=this.__data__,n=nn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var sn=an,on=zr,cn=Jr,ln=Rr,un=rn,dn=sn;function N(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}N.prototype.clear=on,N.prototype.delete=cn,N.prototype.get=ln,N.prototype.has=un,N.prototype.set=dn;var pn=N,hn=V,fn=K,vn=hn(fn,"Map"),gn=vn,$e=Gr,mn=pn,yn=gn;function _n(){this.size=0,this.__data__={hash:new $e,map:new(yn||mn),string:new $e}}var bn=_n;function Cn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var $n=Cn,xn=$n;function Sn(e,t){var r=e.__data__;return xn(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Y=Sn,wn=Y;function An(e){var t=wn(this,e).delete(e);return this.size-=t?1:0,t}var Pn=An,In=Y;function Tn(e){return In(this,e).get(e)}var On=Tn,Mn=Y;function Fn(e){return Mn(this,e).has(e)}var En=Fn,Dn=Y;function Nn(e,t){var r=Dn(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var kn=Nn,qn=bn,jn=Pn,Hn=On,Gn=En,Un=kn;function k(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}k.prototype.clear=qn,k.prototype.delete=jn,k.prototype.get=Hn,k.prototype.has=Gn,k.prototype.set=Un;var xe=k,Se=xe,zn="Expected a function";function se(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(zn);var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=r.cache;if(o.has(a))return o.get(a);var i=e.apply(this,n);return r.cache=o.set(a,i)||o,i};return r.cache=new(se.Cache||Se),r}se.Cache=Se;var Kn=se,Ln=Kn,Vn=500;function Wn(e){var t=Ln(e,function(n){return r.size===Vn&&r.clear(),n}),r=t.cache;return t}var Bn=Wn,Yn=Bn,Xn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Jn=/\\(\\)?/g,Zn=Yn(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Xn,function(r,n,a,o){t.push(a?o.replace(Jn,"$1"):n||r)}),t}),Qn=Zn;function Rn(e,t){for(var r=-1,n=e==null?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a}var ea=Rn,we=L,ta=ea,ra=j,na=re,aa=1/0,Ae=we?we.prototype:void 0,Pe=Ae?Ae.toString:void 0;function Ie(e){if(typeof e=="string")return e;if(ra(e))return ta(e,Ie)+"";if(na(e))return Pe?Pe.call(e):"";var t=e+"";return t=="0"&&1/e==-aa?"-0":t}var sa=Ie,oa=sa;function ia(e){return e==null?"":oa(e)}var ca=ia,la=j,ua=Mt,da=Qn,pa=ca;function ha(e,t){return la(e)?e:ua(e,t)?[e]:da(pa(e))}var X=ha,fa=re,va=1/0;function ga(e){if(typeof e=="string"||fa(e))return e;var t=e+"";return t=="0"&&1/e==-va?"-0":t}var oe=ga,ma=X,ya=oe;function _a(e,t){t=ma(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[ya(t[r++])];return r&&r==n?e:void 0}var ba=_a,Ca=V,$a=function(){try{var e=Ca(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Te=$a,Oe=Te;function xa(e,t,r){t=="__proto__"&&Oe?Oe(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Sa=xa,wa=Sa,Aa=Ce,Pa=Object.prototype,Ia=Pa.hasOwnProperty;function Ta(e,t,r){var n=e[t];(!(Ia.call(e,t)&&Aa(n,r))||r===void 0&&!(t in e))&&wa(e,t,r)}var Oa=Ta,Ma=9007199254740991,Fa=/^(?:0|[1-9]\d*)$/;function Ea(e,t){var r=typeof e;return t=t==null?Ma:t,!!t&&(r=="number"||r!="symbol"&&Fa.test(e))&&e>-1&&e%1==0&&e<t}var Me=Ea,Da=Oa,Na=X,ka=Me,Fe=ne,qa=oe;function ja(e,t,r,n){if(!Fe(e))return e;t=Na(t,e);for(var a=-1,o=t.length,i=o-1,c=e;c!=null&&++a<o;){var l=qa(t[a]),p=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(a!=i){var m=c[l];p=n?n(m,l,c):void 0,p===void 0&&(p=Fe(m)?m:ka(t[a+1])?[]:{})}Da(c,l,p),c=c[l]}return e}var Ha=ja,Ga=ba,Ua=Ha,za=X;function Ka(e,t,r){for(var n=-1,a=t.length,o={};++n<a;){var i=t[n],c=Ga(e,i);r(c,i)&&Ua(o,za(i,e),c)}return o}var La=Ka;function Va(e,t){return e!=null&&t in Object(e)}var Wa=Va,Ba=ee,Ya=te,Xa="[object Arguments]";function Ja(e){return Ya(e)&&Ba(e)==Xa}var Za=Ja,Ee=Za,Qa=te,De=Object.prototype,Ra=De.hasOwnProperty,es=De.propertyIsEnumerable,ts=Ee(function(){return arguments}())?Ee:function(e){return Qa(e)&&Ra.call(e,"callee")&&!es.call(e,"callee")},Ne=ts,rs=9007199254740991;function ns(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=rs}var as=ns,ss=X,os=Ne,is=j,cs=Me,ls=as,us=oe;function ds(e,t,r){t=ss(t,e);for(var n=-1,a=t.length,o=!1;++n<a;){var i=us(t[n]);if(!(o=e!=null&&r(e,i)))break;e=e[i]}return o||++n!=a?o:(a=e==null?0:e.length,!!a&&ls(a)&&cs(i,a)&&(is(e)||os(e)))}var ps=ds,hs=Wa,fs=ps;function vs(e,t){return e!=null&&fs(e,t,hs)}var gs=vs,ms=La,ys=gs;function _s(e,t){return ms(e,t,function(r,n){return ys(e,n)})}var bs=_s;function Cs(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}var $s=Cs,ke=L,xs=Ne,Ss=j,qe=ke?ke.isConcatSpreadable:void 0;function ws(e){return Ss(e)||xs(e)||!!(qe&&e&&e[qe])}var As=ws,Ps=$s,Is=As;function je(e,t,r,n,a){var o=-1,i=e.length;for(r||(r=Is),a||(a=[]);++o<i;){var c=e[o];t>0&&r(c)?t>1?je(c,t-1,r,n,a):Ps(a,c):n||(a[a.length]=c)}return a}var Ts=je,Os=Ts;function Ms(e){var t=e==null?0:e.length;return t?Os(e,1):[]}var Fs=Ms;function Es(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Ds=Es,Ns=Ds,He=Math.max;function ks(e,t,r){return t=He(t===void 0?e.length-1:t,0),function(){for(var n=arguments,a=-1,o=He(n.length-t,0),i=Array(o);++a<o;)i[a]=n[t+a];a=-1;for(var c=Array(t+1);++a<t;)c[a]=n[a];return c[t]=r(i),Ns(e,this,c)}}var qs=ks;function js(e){return function(){return e}}var Hs=js;function Gs(e){return e}var Us=Gs,zs=Hs,Ge=Te,Ks=Us,Ls=Ge?function(e,t){return Ge(e,"toString",{configurable:!0,enumerable:!1,value:zs(t),writable:!0})}:Ks,Vs=Ls,Ws=800,Bs=16,Ys=Date.now;function Xs(e){var t=0,r=0;return function(){var n=Ys(),a=Bs-(n-r);if(r=n,a>0){if(++t>=Ws)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Js=Xs,Zs=Vs,Qs=Js,Rs=Qs(Zs),eo=Rs,to=Fs,ro=qs,no=eo;function ao(e){return no(ro(e,void 0,to),e+"")}var so=ao,oo=bs,io=so,co=io(function(e,t){return e==null?{}:oo(e,t)}),lo=co;const uo=fe(lo),po={type:"object",properties:{[S.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:e=>{const t=u.useRecord(),r=u.useRequest(()=>Promise.resolve({data:uo(t,["title","name","default"])}),F(P({},e),{manual:!0})),n=u.useActionContext();return h.useEffect(()=>{n.visible&&r.run()},[n.visible]),r}},title:'{{t("Edit role")}}',properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},default:{title:"","x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default role")}}'},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},ho=({loadMore:e})=>{const[t,r]=h.useState(null),n=h.useRef(null),a=h.useCallback(o=>{o&&(n.current&&n.current.disconnect(),n.current=new IntersectionObserver(i=>{i.forEach(c=>{c.target===o.current&&c.isIntersecting&&(n.current&&n.current.unobserve(o.current),e())})}),o.current&&n.current&&n.current.observe(o.current))},[e]);return h.useEffect(()=>(a(t),()=>{n.current&&n.current.disconnect()}),[t,a]),{lastItem:t,setLastItem:r}},J=()=>{const{t:e}=E(),{data:t,mutate:r}=u.useResourceActionContext(),[n,a]=h.useState(!1),[o,i]=h.useState(null),{role:c,setRole:l}=h.useContext(I),[p,m]=h.useState([]),[_,b]=h.useState(!1),G=u.useAPIClient(),T=h.useCallback(()=>w(this,null,function*(){const g=t==null?void 0:t.meta;if(!g||g.page>=g.totalPage)return;b(!0);const x=yield G.resource("roles").list({page:g.page+1,pageSize:g.pageSize,filter:{"name.$ne":"root"},showAnonymous:!0,sort:["createdAt"],appends:[]});r((x==null?void 0:x.data)||{}),b(!1)}),[t]),{lastItem:C,setLastItem:y}=ho({loadMore:T}),f=({key:g})=>{l(p.find(x=>x.name===g))};h.useEffect(()=>{p[0]&&l(p[0])},[p,l]),h.useEffect(()=>{var x,O;if(!((x=t==null?void 0:t.data)!=null&&x.length))return;const g=h.createRef();y(g),((O=t.meta)==null?void 0:O.page)>1?m(wi=>wi.concat(t.data)):m(t.data)},[t,y]);const $=h.useMemo(()=>p.map((g,x)=>({key:g.name,label:x===p.length-1?s.jsx("div",{ref:C,children:s.jsx(J.Item,{item:g,onEdit:()=>{a(!0),i(g)}})}):s.jsx(J.Item,{item:g,onEdit:()=>{a(!0),i(g)}})})),[p,C]);return s.jsxs(s.Fragment,{children:[p.length?s.jsx(d.Menu,{style:{border:"none",maxHeight:"65vh",overflowY:"auto"},items:[...$,..._?[{key:"loading",label:s.jsx(d.Spin,{})}]:[]],selectedKeys:[c==null?void 0:c.name],onSelect:f}):s.jsx(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE}),s.jsx(u.ActionContextProvider,{value:{visible:n,setVisible:a},children:s.jsx(u.RecordProvider,{record:o,collectionName:"departments",children:s.jsx(u.SchemaComponent,{scope:{t:e},schema:po})})})]})};J.Item=function({item:t,onEdit:r}){const{t:n}=E(),{refreshAsync:a}=u.useResourceActionContext(),{modal:o,message:i}=d.App.useApp(),c=u.useAPIClient(),l=()=>{o.confirm({title:n("Delete"),content:n("Are you sure you want to delete it?"),onOk:()=>w(this,null,function*(){yield c.resource("roles").destroy({filterByTk:t.name}),i.success(n("Deleted successfully")),yield a()})})},p=({key:_,domEvent:b})=>{switch(b.stopPropagation(),_){case"edit":r();break;case"delete":l()}},m=M.Schema.compile(t.title,{t:n});return s.jsxs(d.Row,{children:[s.jsx(d.Col,{flex:3,style:{display:"inline-flex",alignItems:"center"},children:s.jsxs("span",{style:{whiteSpace:"nowrap",width:"120px",overflow:"hidden",textOverflow:"ellipsis"},children:[s.jsx(U.TagOutlined,{}),s.jsx("span",{style:{marginLeft:"10px"},title:m,children:m})]})}),s.jsxs(d.Col,{children:[t.default?s.jsx(d.Tag,{color:"success",bordered:!1,children:n("Default")}):null,s.jsx(d.Dropdown,{menu:{items:[{label:n("Edit"),key:"edit"},{label:n("Delete"),key:"delete"}],onClick:p},children:s.jsx(U.MoreOutlined,{})})]})]})};const ie=h.createContext([]);ie.displayName="AvailableActionsContext";const fo=e=>{const{data:t,loading:r}=u.useRequest({resource:"availableActions",action:"list"});return r?s.jsx(d.Spin,{}):s.jsx(ie.Provider,{value:t==null?void 0:t.data,children:e.children})},vo=()=>h.useContext(ie);var go="__lodash_hash_undefined__";function mo(e){return this.__data__.set(e,go),this}var yo=mo;function _o(e){return this.__data__.has(e)}var bo=_o,Co=xe,$o=yo,xo=bo;function Z(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Co;++t<r;)this.add(e[t])}Z.prototype.add=Z.prototype.push=$o,Z.prototype.has=xo;var So=Z;function wo(e,t,r,n){for(var a=e.length,o=r+(n?1:-1);n?o--:++o<a;)if(t(e[o],o,e))return o;return-1}var Ao=wo;function Po(e){return e!==e}var Io=Po;function To(e,t,r){for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}var Oo=To,Mo=Ao,Fo=Io,Eo=Oo;function Do(e,t,r){return t===t?Eo(e,t,r):Mo(e,Fo,r)}var No=Do,ko=No;function qo(e,t){var r=e==null?0:e.length;return!!r&&ko(e,t,0)>-1}var jo=qo;function Ho(e,t,r){for(var n=-1,a=e==null?0:e.length;++n<a;)if(r(t,e[n]))return!0;return!1}var Go=Ho;function Uo(e,t){return e.has(t)}var zo=Uo,Ko=V,Lo=K,Vo=Ko(Lo,"Set"),Wo=Vo;function Bo(){}var Yo=Bo;function Xo(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Ue=Xo,ce=Wo,Jo=Yo,Zo=Ue,Qo=1/0,Ro=ce&&1/Zo(new ce([,-0]))[1]==Qo?function(e){return new ce(e)}:Jo,ei=Ro,ti=So,ri=jo,ni=Go,ai=zo,si=ei,oi=Ue,ii=200;function ci(e,t,r){var n=-1,a=ri,o=e.length,i=!0,c=[],l=c;if(r)i=!1,a=ni;else if(o>=ii){var p=t?null:si(e);if(p)return oi(p);i=!1,a=ai,l=new ti}else l=t?[]:c;e:for(;++n<o;){var m=e[n],_=t?t(m):m;if(m=r||m!==0?m:0,i&&_===_){for(var b=l.length;b--;)if(l[b]===_)continue e;t&&l.push(_),c.push(m)}else a(l,_,r)||(l!==c&&l.push(_),c.push(m))}return c}var li=ci,ui=li;function di(e){return e&&e.length?ui(e):[]}var pi=di;const hi=fe(pi),fi=e=>{var r;if(!e)return{};const t={};return(r=e==null?void 0:e.forEach)==null||r.call(e,n=>{const[a,o]=n.split(":");t[a]=o||"all"}),t},ze=e=>{const t=[];for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];n==="all"?t.push(r):t.push(`${r}:${n}`)}return t},vi=M.connect(e=>{const{onChange:t}=e,r=vo(),n=u.useCompile(),{t:a}=A.useTranslation(),o=M.useField(),i=fi(o.value);return s.jsx("div",{children:s.jsx(d.Table,{rowKey:"name",size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:a("Action display name"),render:c=>n(c)},{dataIndex:"onNewRecord",title:a("Action type"),render:c=>c?s.jsx(d.Tag,{color:"green",children:a("Action on new records")}):s.jsx(d.Tag,{color:"geekblue",children:a("Action on existing records")})},{dataIndex:"enabled",title:a("Allow"),render:(c,l)=>s.jsx(d.Checkbox,{checked:c,"aria-label":`${l.name}_checkbox`,onChange:p=>{c?delete i[l.name]:i[l.name]="all",t(ze(i))}})},{dataIndex:"scope",title:a("Data scope"),render:(c,l)=>!l.onNewRecord&&s.jsx(d.Select,{"data-testid":"select-data-scope",popupMatchSelectWidth:!1,size:"small",value:c,options:[{label:a("All records"),value:"all"},{label:a("Own records"),value:"own"}],onChange:p=>{i[l.name]=p,t(ze(i))}})}],dataSource:r==null?void 0:r.map(c=>{let l="all",p=!1;return i[c.name]&&(p=!0,l=i[c.name]),F(P({},c),{enabled:p,scope:l})})})})}),gi=M.connect(e=>{const{t}=A.useTranslation();return s.jsxs(d.Checkbox.Group,{style:{width:"100%",display:"block"},value:e.value,onChange:r=>{const n=["ui.*","pm","pm.*","app"],a=n.map(i=>`!${i}`),o=hi([...e.value||[],...r]).filter(i=>i&&!a.includes(i)).map(i=>!n.includes(i)||r!=null&&r.includes(i)?i:`!${i}`);for(const i of n)!o.includes(i)&&!o.includes(`!${i}`)&&o.push(`!${i}`);e.onChange(o)},children:[s.jsx("div",{style:{marginTop:16},children:s.jsx(d.Checkbox,{value:"ui.*",children:t("Allows to configure interface")})}),s.jsx("div",{style:{marginTop:8},children:s.jsx(d.Checkbox,{value:"pm",children:t("Allows to install, activate, disable plugins")})}),s.jsx("div",{style:{marginTop:8},children:s.jsx(d.Checkbox,{value:"pm.*",children:t("Allows to configure plugins")})}),s.jsx("div",{style:{marginTop:8},children:s.jsx(d.Checkbox,{value:"app",children:t("Allows to clear cache, reboot application")})})]})}),mi=({active:e})=>{const{role:t,setRole:r}=h.useContext(I),{t:n}=E(),a=u.useAPIClient(),{data:o}=u.useRequest(()=>a.resource("roles").get({filterByTk:t==null?void 0:t.name}).then(l=>{var m,_;const p=(m=l==null?void 0:l.data)==null?void 0:m.data;return(_=p.snippets)==null||_.forEach(b=>{p[b]=!0}),p}),{ready:e,refreshDeps:[t==null?void 0:t.name]}),i=Qe.useMemoizedFn(l=>w(this,null,function*(){yield a.resource("roles").update({filterByTk:t.name,values:l.values}),r(P(P({},t),l.values)),d.message.success(n("Saved successfully"))})),c=h.useMemo(()=>he.createForm({values:o,effects(){he.onFormValuesChange(l=>w(this,null,function*(){yield i(l)}))}}),[o,i]);return s.jsx(u.SchemaComponent,{components:{SnippetCheckboxGroup:gi,StrategyActions:vi},schema:{type:"void",name:S.uid(),"x-component":"FormV2","x-component-props":{form:c},properties:{snippets:{title:n("Configure permissions"),type:"boolean","x-decorator":"FormItem","x-component":"SnippetCheckboxGroup"},allowNewMenu:{title:n("Menu permissions"),"x-decorator":"FormItem","x-component":"Checkbox","x-content":n("New menu items are allowed to be accessed by default.")}}}})},le=h.createContext(null);le.displayName="MenuItemsContext";const Ke=(e={})=>{const t=[];for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r],a={title:n.title,uid:n["x-uid"]};n.properties&&(a.children=Ke(n.properties)),t.push(a)}return t},yi=()=>h.useContext(le),Le=e=>{var o,i;const r={url:`uiSchemas:getProperties/${u.useAdminSchemaUid()}`},n=u.useRequest(r);if(n.loading)return s.jsx(d.Spin,{});const a=Ke((i=(o=n.data)==null?void 0:o.data)==null?void 0:i.properties);return s.jsx(le.Provider,{value:{service:n,items:a},children:e.children})},Ve=Re.createStyles(({css:e})=>e`
|
|
2
2
|
.ant-table-cell {
|
|
3
3
|
> .ant-space-horizontal {
|
|
4
4
|
.ant-space-item-split:has(+ .ant-space-item:empty) {
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
`),
|
|
9
|
+
`),We=e=>{if(!Array.isArray(e))return[];const t=[];for(const r of e)t.push(r.uid),t.push(...We(r.children));return t},Be=(e,t,r=[])=>{if(!e)return[];for(const n of e){if(r.push(n.uid),t(n))return r;if(n.children){const a=Be(n.children,t,r);if(a.length)return a}r.pop()}return[]},Ye=(e=[],t=[])=>{for(const r of e)t.push(r.uid),r.children&&r.children.length&&Ye(r.children,t);return t},_i=({active:e})=>{const{styles:t}=Ve(),{role:r}=h.useContext(I),n=u.useAPIClient(),{items:a}=yi(),{t:o}=A.useTranslation(),i=We(a),[c,l]=h.useState([]),{loading:p,refresh:m}=u.useRequest({resource:"roles.menuUiSchemas",resourceOf:r.name,action:"list",params:{paginate:!1}},{ready:!!r&&e,refreshDeps:[r==null?void 0:r.name],onSuccess(C){var y;l(((y=C==null?void 0:C.data)==null?void 0:y.map(f=>f["x-uid"]))||[])}}),_=n.resource("roles.menuUiSchemas",r.name),b=i.length===c.length,G=(C,y)=>w(this,null,function*(){const f=Be(a,g=>g.uid===y.uid),$=Ye(y==null?void 0:y.children,[]);if(C){const g=$.concat(y.uid),x=c.filter(O=>!g.includes(O));l([...x]),yield _.remove({values:g})}else{const g=$.concat(f);l(x=>R.uniq([...x,...g])),yield _.add({values:g})}d.message.success(o("Saved successfully"))}),T=C=>C.map(y=>{const f=o(y.title);return y.children?F(P({},y),{title:f,children:T(y.children)}):F(P({},y),{title:f})});return s.jsx(d.Table,{className:t,loading:p,rowKey:"uid",pagination:!1,expandable:{defaultExpandAllRows:!0},columns:[{dataIndex:"title",title:o("Menu item title")},{dataIndex:"accessible",title:s.jsxs(s.Fragment,{children:[s.jsx(d.Checkbox,{checked:b,onChange:C=>w(this,null,function*(){b?yield _.set({values:[]}):yield _.set({values:i}),m(),d.message.success(o("Saved successfully"))})})," ",o("Accessible")]}),render:(C,y)=>{const f=c.includes(y.uid);return s.jsx(d.Checkbox,{checked:f,onChange:()=>G(f,y)})}}],dataSource:T(a)})},Xe=(e=[],t=[])=>{for(const r of e)t.push(r.aclSnippet),r.children&&r.children.length&&Xe(r.children,t);return t},bi=({active:e})=>{const t=u.useApp(),{styles:r}=Ve(),{role:n}=h.useContext(I),a=u.useAPIClient(),o=u.useCompile(),i=t.pluginSettingsManager.getList(!1),c=t.pluginSettingsManager.getAclSnippets(),[l,p]=h.useState([]),m=h.useMemo(()=>R.flatMap(i,f=>f.children?[f,...f.children]:f),[i]),_=h.useMemo(()=>l.includes("pm.*")&&l.every(f=>!f.startsWith("!pm.")),[l]),{t:b}=A.useTranslation(),{loading:G,refresh:T}=u.useRequest({resource:"roles.snippets",resourceOf:n.name,action:"list",params:{paginate:!1}},{ready:!!n&&e,refreshDeps:[n==null?void 0:n.name],onSuccess(f){p((f==null?void 0:f.data.filter($=>m.find(g=>$.includes(`!${g.aclSnippet}`)||!$.startsWith("!pm."))))||[])}}),C=a.resource("roles.snippets",n.name),y=(f,$)=>w(this,null,function*(){const x=Xe($==null?void 0:$.children,[]).concat($.aclSnippet);f?(yield C.add({values:x.map(O=>"!"+O)}),T()):(yield C.remove({values:x.map(O=>"!"+O)}),T()),d.message.success(b("Saved successfully"))});return s.jsx(d.Table,{className:r,loading:G,rowKey:"key",pagination:!1,expandable:{defaultExpandAllRows:!0},columns:[{dataIndex:"title",title:b("Plugin name"),render:f=>o(f)},{dataIndex:"accessible",title:s.jsxs(s.Fragment,{children:[s.jsx(d.Checkbox,{checked:_,onChange:()=>w(this,null,function*(){const f=c.map($=>"!"+$);_?yield C.add({values:f}):yield C.remove({values:f}),T(),d.message.success(b("Saved successfully"))})})," ",b("Accessible")]}),render:(f,$)=>{const g=!l.includes("!"+$.aclSnippet);return s.jsx(d.Checkbox,{checked:g,onChange:()=>y(g,$)})}}],dataSource:i.filter(f=>f.isTopLevel!==!1).map(f=>f.showTabs!==!1?f:R.omit(f,"children"))})},Q=e=>s.jsx("div",{style:{maxHeight:"60vh",overflowY:"auto"},children:e.children}),Ci=({active:e})=>{var p;const{t}=E(),[r,n]=h.useState("general"),{role:a}=h.useContext(I),o=(p=a==null?void 0:a.snippets)==null?void 0:p.includes("pm.*"),c=u.useApp().getComponent("DataSourcePermissionManager"),l=h.useMemo(()=>[{key:"general",label:t("General"),children:s.jsx(Q,{children:s.jsx(mi,{active:r==="general"&&e})})},{key:"menu",label:t("Menu"),children:s.jsx(Q,{children:s.jsx(Le,{children:s.jsx(_i,{active:r==="menu"&&e})})})},...o?[{key:"plugin",label:t("Plugin settings"),children:s.jsx(Q,{children:s.jsx(bi,{active:r==="plugin"&&e})})}]:[],...c?[{key:"dataSource",label:t("Data sources"),children:s.jsx(Q,{children:s.jsx(Le,{children:s.jsx(c,{role:a,active:r==="dataSource"&&e})})})}]:[]],[o,r,e,t]);return h.useEffect(()=>{n("general")},[a==null?void 0:a.name]),s.jsx(fo,{children:s.jsx(d.Tabs,{type:"card",activeKey:r,onChange:m=>n(m),items:l})})},$i=()=>{const{t:e}=E();return s.jsx(u.SchemaComponent,{scope:{t:e},schema:{type:"void",properties:{newRole:{type:"void",title:e("New role"),"x-component":"Action","x-component-props":{type:"text",icon:"PlusOutlined",style:{width:"100%",textAlign:"left"}},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(t){const r=u.useActionContext();return u.useRequest(()=>Promise.resolve({data:{name:`r_${S.uid()}`,snippets:["!ui.*","!pm","!pm.*"]}}),F(P({},t),{refreshDeps:[r.visible]}))}},title:e("New role"),properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'},default:{"x-component":"CollectionField","x-decorator":"FormItem",title:"","x-content":'{{t("Default role")}}'},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}}})},Je={name:"roles",filterTargetKey:"name",targetKey:"name",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Role display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Role UID")}}',type:"string","x-component":"Input"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{title:'{{t("Default role")}}',type:"boolean","x-component":"Checkbox"}}]},xi=()=>{const{t:e}=E(),t=u.usePlugin(ue),[r,n]=h.useState("permissions"),a=Array.from(t.rolesManager.list()).map(([l,p])=>({key:l,label:M.Schema.compile(p.title,{t:e}),children:p.Component?h.createElement(p.Component,{active:r===l}):null})),[o,i]=h.useState(null),c=u.useSchemaComponentContext();return s.jsx(u.SchemaComponentContext.Provider,{value:F(P({},c),{designable:!1}),children:s.jsx(I.Provider,{value:{role:o,setRole:i},children:s.jsx(d.Card,{children:s.jsxs(d.Row,{gutter:24,style:{flexWrap:"nowrap"},children:[s.jsx(d.Col,{flex:"280px",style:{borderRight:"1px solid #eee",minWidth:"250px"},children:s.jsx(u.ResourceActionProvider,{collection:Je,request:{resource:"roles",action:"list",params:{filter:{"name.$ne":"root"},showAnonymous:!0,sort:["createdAt"],appends:[]}},children:s.jsxs(u.CollectionProvider_deprecated,{collection:Je,children:[s.jsx(d.Row,{children:s.jsx($i,{})}),s.jsx(d.Divider,{style:{margin:"12px 0"}}),s.jsx(J,{})]})})}),s.jsx(d.Col,{flex:"auto",style:{overflow:"hidden"},children:s.jsx(d.Tabs,{activeKey:r,onChange:l=>n(l),items:[{key:"permissions",label:e("Permissions"),children:s.jsx(Ci,{active:r==="permissions"})},...a]})})]})})})})};class Si{constructor(){pe(this,"rolesManager",new q.Registry)}add(t,r){this.rolesManager.register(t,r)}list(){return this.rolesManager.getEntities()}}class ue extends u.Plugin{constructor(){super(...arguments);pe(this,"rolesManager",new Si)}load(){return w(this,null,function*(){this.pluginSettingsManager.add("users-permissions.roles",{title:this.t("Roles & Permissions"),icon:"LockOutlined",Component:xi,aclSnippet:"pm.acl.roles",sort:3})})}}v.PluginACLClient=ue,v.RolesManagerContext=I,v.default=ue,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/client/locale.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useACLTranslation(): import("react-i18next").UseTranslationResponse<("acl" | "client")[], undefined>;
|
|
1
|
+
export declare function useACLTranslation(): import("react-i18next").UseTranslationResponse<("@nocobase/plugin-acl" | "client")[], undefined>;
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.20.0-alpha.
|
|
2
|
+
"@nocobase/client": "0.20.0-alpha.17",
|
|
3
3
|
"react": "18.2.0",
|
|
4
4
|
"@formily/shared": "2.3.0",
|
|
5
5
|
"antd": "5.12.8",
|
|
6
6
|
"@formily/react": "2.3.0",
|
|
7
7
|
"@ant-design/icons": "5.2.6",
|
|
8
8
|
"react-i18next": "11.18.6",
|
|
9
|
-
"@nocobase/utils": "0.20.0-alpha.
|
|
10
|
-
"@nocobase/actions": "0.20.0-alpha.
|
|
11
|
-
"@nocobase/cache": "0.20.0-alpha.
|
|
12
|
-
"@nocobase/database": "0.20.0-alpha.
|
|
13
|
-
"@nocobase/server": "0.20.0-alpha.
|
|
9
|
+
"@nocobase/utils": "0.20.0-alpha.17",
|
|
10
|
+
"@nocobase/actions": "0.20.0-alpha.17",
|
|
11
|
+
"@nocobase/cache": "0.20.0-alpha.17",
|
|
12
|
+
"@nocobase/database": "0.20.0-alpha.17",
|
|
13
|
+
"@nocobase/server": "0.20.0-alpha.17",
|
|
14
14
|
"async-mutex": "0.3.2",
|
|
15
15
|
"lodash": "4.17.21",
|
|
16
|
-
"@nocobase/test": "0.20.0-alpha.
|
|
16
|
+
"@nocobase/test": "0.20.0-alpha.17",
|
|
17
17
|
"@formily/core": "2.3.0",
|
|
18
18
|
"ahooks": "3.7.8",
|
|
19
19
|
"@formily/antd-v5": "1.1.9",
|
|
20
20
|
"antd-style": "3.4.5",
|
|
21
|
-
"@nocobase/acl": "0.20.0-alpha.
|
|
21
|
+
"@nocobase/acl": "0.20.0-alpha.17"
|
|
22
22
|
};
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
"The current user has no roles. Please try another account.": "当前用户没有角色,请使用其他账号。",
|
|
3
3
|
"The user role does not exist. Please try signing in again": "用户角色不存在,请尝试重新登录。",
|
|
4
4
|
"New role": "新建角色",
|
|
5
|
-
"Permissions": "权限"
|
|
5
|
+
"Permissions": "权限",
|
|
6
|
+
"Roles & Permissions": "角色和权限",
|
|
7
|
+
"General": "通用",
|
|
8
|
+
"Menu": "菜单",
|
|
9
|
+
"Plugin settings": "插件设置",
|
|
10
|
+
"Data sources": "数据源"
|
|
6
11
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './middlewares/setCurrentRole';
|
|
2
|
+
export * from './middlewares/with-acl-meta';
|
|
2
3
|
export { RoleResourceActionModel } from './model/RoleResourceActionModel';
|
|
3
4
|
export { RoleResourceModel } from './model/RoleResourceModel';
|
|
4
|
-
export
|
|
5
|
-
export * from './middlewares/setCurrentRole';
|
|
5
|
+
export { default } from './server';
|
package/dist/server/index.js
CHANGED
|
@@ -33,15 +33,15 @@ __export(server_exports, {
|
|
|
33
33
|
default: () => import_server.default
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(server_exports);
|
|
36
|
-
|
|
36
|
+
__reExport(server_exports, require("./middlewares/setCurrentRole"), module.exports);
|
|
37
|
+
__reExport(server_exports, require("./middlewares/with-acl-meta"), module.exports);
|
|
37
38
|
var import_RoleResourceActionModel = require("./model/RoleResourceActionModel");
|
|
38
39
|
var import_RoleResourceModel = require("./model/RoleResourceModel");
|
|
39
|
-
|
|
40
|
-
__reExport(server_exports, require("./middlewares/setCurrentRole"), module.exports);
|
|
40
|
+
var import_server = __toESM(require("./server"));
|
|
41
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
42
|
0 && (module.exports = {
|
|
43
43
|
RoleResourceActionModel,
|
|
44
44
|
RoleResourceModel,
|
|
45
|
-
...require("./middlewares/
|
|
46
|
-
...require("./middlewares/
|
|
45
|
+
...require("./middlewares/setCurrentRole"),
|
|
46
|
+
...require("./middlewares/with-acl-meta")
|
|
47
47
|
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "权限控制",
|
|
5
5
|
"description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.",
|
|
6
6
|
"description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
|
|
7
|
-
"version": "0.20.0-alpha.
|
|
7
|
+
"version": "0.20.0-alpha.17",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/acl",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
35
35
|
"directory": "packages/plugins/acl"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "a2460c222bc0b8a3bcb783b5c856499d756efa82"
|
|
38
38
|
}
|