@nocobase/plugin-acl 2.0.0-beta.7 → 2.0.0-beta.8
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/index.js +1 -1
- package/dist/externalVersion.js +8 -8
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("lodash"),require("ahooks"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("antd-style"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-acl",["@formily/core","@formily/antd-v5","react","lodash","ahooks","@formily/shared","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/utils/client","antd-style","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-acl"]=t(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("lodash"),require("ahooks"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("antd-style"),require("antd"),require("react-i18next")):e["@nocobase/plugin-acl"]=t(e["@formily/core"],e["@formily/antd-v5"],e.react,e.lodash,e.ahooks,e["@formily/shared"],e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/utils/client"],e["antd-style"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i,a,c,u,l,s,p,f){return function(){var d,m,y,b,v,h,g={400:function(e,t,n){"use strict";n.d(t,{T:function(){return r}});var r=(0,n(156).createContext)({role:null});r.displayName="RolesManagerContext"},898:function(e,t,n){"use strict";n.d(t,{U:function(){return u},r:function(){return l}});var r=n(772),o=n(721),i=n(156),a=n.n(i),c=(0,i.createContext)([]);c.displayName="AvailableActionsContext";var u=function(e){var t=(0,r.useRequest)({resource:"availableActions",action:"list"}),n=t.data;return t.loading?a().createElement(o.Spin,null):a().createElement(c.Provider,{value:null==n?void 0:n.data},e.children)},l=function(){return(0,i.useContext)(c)}},720:function(e,t,n){"use strict";n.r(t),n.d(t,{DesktopAllRoutesProvider:function(){return A},MenuPermissions:function(){return E}});var r=n(563),o=n(875),i=n(772),a=n(749),c=n(721),u=n(467),l=n(156),s=n.n(l),p=n(238),f=n(400);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){m(i,r,o,a,c,"next",e)}function c(e){m(i,r,o,a,c,"throw",e)}a(void 0)})}}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function h(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}function x(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function w(){var e,t,n=(e=["\n .ant-table-cell {\n > .ant-space-horizontal {\n .ant-space-item-split:has(+ .ant-space-item:empty) {\n display: none;\n }\n }\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return w=function(){return n},n}var S=function(e,t){return Array.isArray(e)?e.map(function(e){var n,r=S(e.children,e),o=0===r.length;return{title:e.title,id:e.id,children:o?null:r,hideChildren:o,firstTabId:null==(n=r[0])?void 0:n.id,parent:t}}):[]},O=function(e){if(!Array.isArray(e))return[];var t=[],n=!0,r=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var c=i.value;t.push(c.id),t.push.apply(t,h(O(c.children)))}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return t},C=(0,i.css)(w()),P=function(e,t,n){return e.map(function(e){var r,o=((null==(r=e.title)?void 0:r.match(/^\s*\{\{\s*.+?\s*\}\}\s*$/))?n(e.title):t(e.title))||t("Unnamed");return e.children?v(b({},e),{title:o,children:P(e.children,t,n)}):v(b({},e),{title:o})})},k=(0,l.createContext)({routeList:[]}),j=function(e){var t=e.children,n=e.refreshRef,r=(0,i.useAPIClient)(),o=(0,l.useMemo)(function(){return r.resource("desktopRoutes")},[r]),a=(0,i.useRequest)(function(){return o.list({tree:!0,sort:"sort",paginate:!1,filter:{hidden:{$ne:!0}}}).then(function(e){return e.data})},{manual:!0}),c=a.data,u=a.runAsync;n&&(n.current=u);var p=(0,l.useMemo)(function(){return(null==c?void 0:c.data)||[]},[c]),f=(0,l.useMemo)(function(){return{routeList:p}},[p]);return s().createElement(k.Provider,{value:f},t)},A=function(e){var t=e.children,n=e.active,r=s().useRef(function(){});return(0,l.useEffect)(function(){if(n){var e;null==(e=r.current)||e.call(r)}},[n]),s().createElement(j,{refreshRef:r},t)},E=function(e){var t,n,d,m,v=e.active,w=S((0,l.useContext)(k).routeList),j=(0,l.useContext)(f.T),A=j.role,E=j.setRole,R=(0,i.useAPIClient)(),T=(0,p.useTranslation)().t,_=O(w),F=(t=(0,l.useState)([]),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(c)throw r}}return i}}(t,2)||g(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),I=F[0],q=F[1],M=(0,i.useRequest)({resource:"roles.desktopRoutes",resourceOf:A.name,action:"list",params:{paginate:!1,filter:{hidden:{$ne:!0}}}},{ready:!!A&&v,refreshDeps:[null==A?void 0:A.name],onSuccess:function(e){var t;q((null==e||null==(t=e.data)?void 0:t.map(function(e){return e.id}))||[])}}),N=M.loading,D=M.refresh,B=R.resource("roles.desktopRoutes",A.name),z=_.length===I.length,L=(0,i.useAllAccessDesktopRoutes)().refresh,V=(n=y(function(e,t){var n,r,o,i,a,l,s,p;return x(this,function(f){switch(f.label){case 0:if(!e)return[3,2];return n=I.filter(function(e){return e!==t.id}),r=[t.id],t.parent&&0===t.parent.children.filter(function(e){return n.includes(e.id)}).length&&(n=n.filter(function(e){return e!==t.parent.id}),r.push(t.parent.id)),t.children&&(n=n.filter(function(e){return!O(t.children).includes(e)}),(o=r).push.apply(o,h(O(t.children)))),q(n),[4,B.remove({values:r})];case 1:return f.sent(),[3,4];case 2:return i=h(I).concat([t.id]),a=[t.id],t.parent&&!i.includes(t.parent.id)&&(i.push(t.parent.id),a.push(t.parent.id)),t.children&&(p=O(t.children),(l=i).push.apply(l,h(p)),(s=a).push.apply(s,h(p))),q((0,u.uniq)(i)),[4,B.add({values:a})];case 3:f.sent(),f.label=4;case 4:return L(),c.message.success(T("Saved successfully")),[2]}})}),function(e,t){return n.apply(this,arguments)}),U=(0,a.useMemoizedFn)((d=y(function(e){return x(this,function(t){switch(t.label){case 0:return[4,R.resource("roles").update({filterByTk:A.name,values:e.values})];case 1:return t.sent(),E(b({},A,e.values)),c.message.success(T("Saved successfully")),[2]}})}),function(e){return d.apply(this,arguments)})),K=(0,l.useMemo)(function(){return(0,r.createForm)({values:A,effects:function(){var e;(0,r.onFormValuesChange)((e=y(function(e){return x(this,function(t){switch(t.label){case 0:return[4,U(e)];case 1:return t.sent(),[2]}})}),function(t){return e.apply(this,arguments)}))}})},[A,U]),$=(0,i.useCompile)();return s().createElement(s().Fragment,null,s().createElement(i.SchemaComponent,{schema:{type:"void",name:(0,o.uid)(),"x-component":"FormV2","x-component-props":{form:K},properties:{allowNewMenu:{title:T("Route permissions"),"x-decorator":"FormItem","x-component":"Checkbox","x-content":T("New routes are allowed to be accessed by default")}}}}),s().createElement(c.Table,{className:C,loading:N,rowKey:"id",pagination:!1,expandable:{defaultExpandAllRows:!1},columns:[{dataIndex:"title",title:T("Route name")},{dataIndex:"accessible",title:s().createElement(s().Fragment,null,s().createElement(c.Checkbox,{checked:z,onChange:(m=y(function(e){return x(this,function(e){switch(e.label){case 0:if(!z)return[3,2];return[4,B.set({values:[]})];case 1:return e.sent(),[3,4];case 2:return[4,B.set({values:_})];case 3:e.sent(),e.label=4;case 4:return D(),L(),c.message.success(T("Saved successfully")),[2]}})}),function(e){return m.apply(this,arguments)})})," ",T("Accessible")),render:function(e,t){var n=I.includes(t.id);return s().createElement(c.Checkbox,{checked:n,onChange:function(){return V(n,t)}})}}],dataSource:P(w,T,$)}))}},77:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginACLClient:function(){return $},RolesManagerContext:function(){return q.T},default:function(){return G},RoleResourceCollectionContext:function(){return I}});var r=n(772),o=n(156),i=n.n(o),a=n(720),c=n(581),u=(0,r.lazy)(function(){return c("imported_-1r1jup3_component",n.e("86").then(n.bind(n,229)))},"GeneralPermissions").GeneralPermissions,l=(0,r.lazy)(function(){return c("imported_1qalbop_component",Promise.resolve().then(n.bind(n,720)))},"MenuPermissions").MenuPermissions,s=function(){var e;function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");e="permissionsTabs",n=[function(e){var t=e.t,n=e.TabLayout;return{key:"general",label:t("System"),sort:10,children:i().createElement(n,null,i().createElement(u,null))}},function(e){var t=e.activeKey,n=e.t,r=e.TabLayout;return{key:"menu",label:n("Desktop routes"),sort:20,children:i().createElement(r,null,i().createElement(a.DesktopAllRoutesProvider,{active:"menu"===t},i().createElement(l,{active:"menu"===t})))}}],e in this?Object.defineProperty(this,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):this[e]=n}return e=[{key:"addPermissionsTab",value:function(e){this.permissionsTabs.push(e)}},{key:"getPermissionsTabs",value:function(e){return this.permissionsTabs.map(function(t){return"function"==typeof t?t(e):t}).sort(function(e,t){var n,r;return(null!=(n=null==e?void 0:e.sort)?n:100)-(null!=(r=null==t?void 0:t.sort)?r:100)})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}(),p=n(584),f=function(){var e;function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");e="rolesManager",n=new p.Registry,e in this?Object.defineProperty(this,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):this[e]=n}return e=[{key:"add",value:function(e,t){this.rolesManager.register(e,t)}},{key:"list",value:function(){return this.rolesManager.getEntities()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}(),d=n(238),m=n(721),y=n(467),b=n.n(y);function v(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}var h=function(){var e,t,n,o=(0,d.useTranslation)().t,a=(0,r.useAPIClient)(),c=b().cloneDeep((0,r.useCurrentRoles)()),u=(0,r.useCurrentRoleMode)(),l=null==(n=c.find(function(e){return e.name===a.auth.role}))?void 0:n.name;return("allow-use-union"===u&&c.unshift({name:"__union__",title:o("Full permissions",{ns:"acl"})}),c.length<=1||"only-use-union"===u)?null:i().createElement(r.SchemaSettingsItem,{eventKey:"SwitchRole",title:"SwitchRole"},i().createElement(r.SelectWithTitle,{title:o("Switch role"),fieldNames:{label:"title",value:"name"},options:c.reduce(function(e,t){return e.push(t),"__union__"===t.name&&e.push({name:"divider",title:i().createElement(m.Divider,{style:{margin:"2px 1px"}}),disabled:!0,style:{minHeight:0,height:"auto",padding:0}}),e},[]),defaultValue:l||c[0].name,onChange:(e=function(e){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:return a.auth.setRole(e),[4,a.resource("users").setDefaultRole({values:{roleName:e}})];case 1:return t.sent(),location.reload(),window.location.reload(),[2]}})},t=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){v(i,r,o,a,c,"next",e)}function c(e){v(i,r,o,a,c,"throw",e)}a(void 0)})},function(e){return t.apply(this,arguments)})}))},g=n(632),x=n(505),w=n(898),S=n(563),O={name:"rolesResourcesScopes",fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Scope name")}}',type:"string","x-component":"Input",required:!0}}]},C={type:"object",properties:{scope:{"x-component":"RecordPicker","x-component-props":{size:"small",fieldNames:{label:"name",value:"id"},multiple:!1,association:{target:"rolesResourcesScopes"},onChange:"{{ onChange }}"},properties:{selector:{type:"void",title:'{{ t("Select record") }}',"x-component":"RecordPicker.Selector","x-component-props":{className:"nb-record-picker-selector"},properties:{tableBlock:{type:"void","x-decorator":"TableSelectorProvider","x-decorator-props":{collection:O,resource:"rolesResourcesScopes",action:"list",params:{pageSize:20},useParams:function(){return{filter:{$or:[{resourceName:(0,o.useContext)(I).name},{resourceName:null}]}}},rowKey:"id"},"x-component":"BlockItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void",title:'{{ t("Add new") }}',"x-action":"create","x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:"rolesResourcesScopes",collection:O},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":function(){var e=(0,o.useContext)(I).name,t=(0,r.useFormBlockContext)();return(0,o.useEffect)(function(){t.form.setInitialValues({resourceName:e})},[e]),{form:t.form}},properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":"Filter","x-use-component-props":function(){var e=(0,o.useContext)(I);return{options:(0,r.useFilterOptions)(e.name)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}}},value:{type:"array","x-component":"TableV2.Selector","x-use-component-props":"useTableSelectorProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-component":"TableV2.Column",properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{edit:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:"rolesResourcesScopes",collection:O,action:"get",useParams:"{{ useParamsFromRecord }}"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":"Filter","x-use-component-props":function(){var e=(0,o.useContext)(I);return{options:(0,r.useFilterOptions)(e.name)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{update:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}},destroy:{title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}};function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var k=(0,o.createContext)(null);k.displayName="RolesResourcesScopesSelectedRowKeysContext";var j=function(e){var t,n=(t=(0,o.useState)([]),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(c)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return P(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=n[0],a=n[1];return i().createElement(k.Provider,{value:[r,a]},e.children)},A=function(e){var t=(0,o.useMemo)(function(){return(0,S.createForm)({values:{scope:e.value}})},[]);return i().createElement(r.FormProvider,{form:t},i().createElement(r.SchemaComponent,{components:{RolesResourcesScopesSelectedRowKeysProvider:j},scope:{onChange:function(t){var n;null==e||null==(n=e.onChange)||n.call(e,t)}},schema:C}))},E=n(438);function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function _(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var F=function(e){var t,n={};return null==e||null==(t=e.forEach)||t.call(e,function(e){e.name&&(n[e.name]=e,n[e.name].scope=(0,y.isEmpty)(e.scope)?null:e.scope)}),n},I=(0,o.createContext)({});I.displayName="RoleResourceCollectionContext",(0,x.connect)(function(e){var t,n=(0,E.y)().styles,o=function(t){var n=t.map(function(e){return _(T({},e),{scope:(0,y.isEmpty)(e.scope)?null:e.scope})});e.onChange(n)};(0,x.useForm)();var a=(0,r.useRecord)(),c=(0,w.r)(),u=(0,r.useCollectionManager_deprecated)(),l=u.getCollection,s=u.getCollectionFields,p=l(a.collectionName),f=s(a.collectionName),b=(0,r.useCompile)(),v=(0,d.useTranslation)().t,h=F((0,x.useField)().value||[]),S=function(e,t){var n,r=null==h?void 0:h[e];return!!r&&(null==r||null==(n=r.fields)?void 0:n.includes(t))},O=c.filter(function(e){return e.allowConfigureFields}),C=null==f||null==(D=f.filter(function(e){return e.interface}))?void 0:D.map(function(e){var t=T({},e),n=!0,r=!1,o=void 0;try{for(var i,a=O[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var c=i.value;t[c.name]=S(c.name,e.name)}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return t}),P=function(e){if(h[e])delete h[e];else{var t,n;h[e]={name:e,fields:null==f||null==(n=f.filter(function(e){return e.interface}))||null==(t=n.map)?void 0:t.call(n,function(e){return e.name})}}o(Object.values(h))},k=function(e,t){h[e]?(h[e].scope=t,o(Object.values(h))):(P(e),h[e].scope=t)},j={},q=!0,M=!1,N=void 0;try{for(var D,B,z=O[Symbol.iterator]();!(q=(B=z.next()).done);q=!0){var L,V,U,K=B.value;j[K.name]=(null==f||null==(L=f.filter(function(e){return e.interface}))?void 0:L.length)===(null==h||null==(U=h[K.name])||null==(V=U.fields)?void 0:V.length)}}catch(e){M=!0,N=e}finally{try{q||null==z.return||z.return()}finally{if(M)throw N}}return i().createElement("div",null,i().createElement(I.Provider,{value:p},i().createElement(g.FormLayout,{layout:"vertical"},i().createElement(g.FormItem,{label:v("Action permission")},i().createElement(m.Table,{className:n,size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:v("Action display name"),render:function(e){return b(e)}},{dataIndex:"onNewRecord",title:v("Action type"),render:function(e){return e?i().createElement(m.Tag,{color:"green"},v("Action on new records")):i().createElement(m.Tag,{color:"geekblue"},v("Action on existing records"))}},{dataIndex:"enabled",title:v("Allow"),render:function(e,t){return i().createElement(m.Checkbox,{checked:e,onChange:function(){P(t.name)}})}},{dataIndex:"scope",title:v("Data scope"),render:function(e,t){return!t.onNewRecord&&i().createElement(A,{value:e,onChange:function(e){k(t.name,e)}})}}],dataSource:null==c?void 0:c.map(function(e){var t=!1,n=null;return h[e.name]&&(t=!0,e.onNewRecord||(n=h[e.name].scope)),_(T({},e),{enabled:t,scope:n})})})),i().createElement(g.FormItem,{label:v("Field permission")},i().createElement(m.Table,{className:n,pagination:!1,dataSource:C,columns:[{dataIndex:["uiSchema","title"],title:v("Field display name"),render:function(e){return b(e)}}].concat(function(e){if(Array.isArray(e))return R(e)}(t=O.map(function(e){var t=null==j?void 0:j[e.name];return{dataIndex:e.name,title:i().createElement(i().Fragment,null,i().createElement(m.Checkbox,{checked:t,onChange:function(){var n,r=h[e.name]||{name:e.name};t?r.fields=[]:r.fields=null==f||null==(n=f.map)?void 0:n.call(f,function(e){return e.name}),h[e.name]=r,o(Object.values(h))}})," ",b(e.displayName)),render:function(t,n){return i().createElement(m.Checkbox,{checked:t,"aria-label":"".concat(e.name,"_checkbox"),onChange:function(){var r=h[e.name]||{name:e.name},i=r.fields||[];if(t){var a=i.indexOf(n.name);i.splice(a,1)}else i.push(n.name);r.fields=i,h[e.name]=r,o(Object.values(h))}})}}}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return R(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R(e,t)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())})))))});var q=n(400),M=n(581);function N(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function D(e,t,n){return(D=U()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&L(o,n.prototype),o}).apply(null,arguments)}function B(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(e){var t="function"==typeof Map?new Map:void 0;return(V=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return D(e,arguments,z(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),L(n,e)})(e)}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(U=function(){return!!e})()}var K=(0,r.lazy)(function(){return M("imported_-1obaqk_component",n.e("646").then(n.bind(n,176)))},"RolesManagement").RolesManagement,$=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=z(t),B(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,U()?Reflect.construct(t,r||[],z(this).constructor):t.apply(this,r)),"rolesManager",new f),B(e,"settingsUI",new s),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&L(n,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return t.pluginSettingsManager.add("users-permissions.roles",{title:t.t("Roles & Permissions"),icon:"LockOutlined",Component:K,aclSnippet:"pm.acl.roles",sort:3}),t.app.addUserCenterSettingsItem({name:"divider_switchRole",type:"divider",sort:200}),t.app.addUserCenterSettingsItem({name:"switchRole",Component:h,sort:300}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){N(i,r,o,a,c,"next",e)}function c(e){N(i,r,o,a,c,"throw",e)}a(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(V(r.Plugin)),G=$},438:function(e,t,n){"use strict";function r(){var e,t,n=(e=["\n .ant-table-cell {\n > .ant-space-horizontal {\n .ant-space-item-split:has(+ .ant-space-item:empty) {\n display: none;\n }\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return r=function(){return n},n}n.d(t,{y:function(){return o}});var o=(0,n(202).createStyles)(function(e){return(0,e.css)(r())})},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=u},632:function(e){"use strict";e.exports=t},563:function(t){"use strict";t.exports=e},505:function(e){"use strict";e.exports=c},875:function(e){"use strict";e.exports=i},772:function(e){"use strict";e.exports=a},584:function(e){"use strict";e.exports=l},749:function(e){"use strict";e.exports=o},721:function(e){"use strict";e.exports=p},202:function(e){"use strict";e.exports=s},467:function(e){"use strict";e.exports=r},156:function(e){"use strict";e.exports=n},238:function(e){"use strict";e.exports=f}},x={};function w(e){var t=x[e];if(void 0!==t)return t.exports;var n=x[e]={exports:{}};return g[e](n,n.exports,w),n.exports}return w.m=g,w.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return w.d(t,{a:t}),t},w.d=function(e,t){for(var n in t)w.o(t,n)&&!w.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},w.f={},w.e=function(e){return Promise.all(Object.keys(w.f).reduce(function(t,n){return w.f[n](e,t),t},[]))},w.u=function(e){return""+({646:"0655d5ded9f45bb1",86:"50204a14518b3a0d"})[e]+".js"},w.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),w.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},m="@nocobase/plugin-acl:",w.l=function(e,t,n,r){if(d[e])return void d[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var u=a[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==m+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,w.nc&&o.setAttribute("nonce",w.nc),o.setAttribute("data-webpack",m+n),o.src=e),d[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=d[e];if(delete d[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},w.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(y=window.__nocobase_public_path__||"/").endsWith("/")||(y+="/"),w.p=y+"static/plugins/@nocobase/plugin-acl/dist/client/",b={909:0},w.f.j=function(e,t){var n=w.o(b,e)?b[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=b[e]=[t,r]});t.push(n[2]=r);var o=w.p+w.u(e),i=Error();w.l(o,function(t){if(w.o(b,e)&&(0!==(n=b[e])&&(b[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},v=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],c=0;if(o.some(function(e){return 0!==b[e]})){for(n in i)w.o(i,n)&&(w.m[n]=i[n]);a&&a(w)}for(e&&e(t);c<o.length;c++)r=o[c],w.o(b,r)&&b[r]&&b[r][0](),b[r]=0},(h=self.webpackChunk_nocobase_plugin_acl=self.webpackChunk_nocobase_plugin_acl||[]).forEach(v.bind(null,0)),h.push=v.bind(null,h.push.bind(h)),w(77)}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("lodash"),require("ahooks"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("antd-style"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-acl",["@formily/core","@formily/antd-v5","react","lodash","ahooks","@formily/shared","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/utils/client","antd-style","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-acl"]=t(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("lodash"),require("ahooks"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("antd-style"),require("antd"),require("react-i18next")):e["@nocobase/plugin-acl"]=t(e["@formily/core"],e["@formily/antd-v5"],e.react,e.lodash,e.ahooks,e["@formily/shared"],e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/utils/client"],e["antd-style"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i,a,c,u,l,s,p,f){return function(){var d,m,y,b,v,h,g={400:function(e,t,n){"use strict";n.d(t,{T:function(){return r}});var r=(0,n(156).createContext)({role:null});r.displayName="RolesManagerContext"},898:function(e,t,n){"use strict";n.d(t,{U:function(){return u},r:function(){return l}});var r=n(772),o=n(721),i=n(156),a=n.n(i),c=(0,i.createContext)([]);c.displayName="AvailableActionsContext";var u=function(e){var t=(0,r.useRequest)({resource:"availableActions",action:"list"}),n=t.data;return t.loading?a().createElement(o.Spin,null):a().createElement(c.Provider,{value:null==n?void 0:n.data},e.children)},l=function(){return(0,i.useContext)(c)}},720:function(e,t,n){"use strict";n.r(t),n.d(t,{DesktopAllRoutesProvider:function(){return A},MenuPermissions:function(){return E}});var r=n(563),o=n(875),i=n(772),a=n(749),c=n(721),u=n(467),l=n(156),s=n.n(l),p=n(238),f=n(400);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){m(i,r,o,a,c,"next",e)}function c(e){m(i,r,o,a,c,"throw",e)}a(void 0)})}}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function h(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}function x(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function w(){var e,t,n=(e=["\n .ant-table-cell {\n > .ant-space-horizontal {\n .ant-space-item-split:has(+ .ant-space-item:empty) {\n display: none;\n }\n }\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return w=function(){return n},n}var S=function(e,t){return Array.isArray(e)?e.map(function(e){var n,r=S(e.children,e),o=0===r.length;return{title:e.title,id:e.id,children:o?null:r,hideChildren:o,firstTabId:null==(n=r[0])?void 0:n.id,parent:t}}):[]},O=function(e){if(!Array.isArray(e))return[];var t=[],n=!0,r=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var c=i.value;t.push(c.id),t.push.apply(t,h(O(c.children)))}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return t},C=(0,i.css)(w()),P=function(e,t,n){return e.map(function(e){var r,o=((null==(r=e.title)?void 0:r.match(/^\s*\{\{\s*.+?\s*\}\}\s*$/))?n(e.title):t(e.title))||t("Unnamed");return e.children?v(b({},e),{title:o,children:P(e.children,t,n)}):v(b({},e),{title:o})})},k=(0,l.createContext)({routeList:[]}),j=function(e){var t=e.children,n=e.refreshRef,r=(0,i.useAPIClient)(),o=(0,l.useMemo)(function(){return r.resource("desktopRoutes")},[r]),a=(0,i.useRequest)(function(){return o.list({tree:!0,sort:"sort",paginate:!1,filter:{hidden:{$ne:!0}}}).then(function(e){return e.data})},{manual:!0}),c=a.data,u=a.runAsync;n&&(n.current=u);var p=(0,l.useMemo)(function(){return(null==c?void 0:c.data)||[]},[c]),f=(0,l.useMemo)(function(){return{routeList:p}},[p]);return s().createElement(k.Provider,{value:f},t)},A=function(e){var t=e.children,n=e.active,r=s().useRef(function(){});return(0,l.useEffect)(function(){if(n){var e;null==(e=r.current)||e.call(r)}},[n]),s().createElement(j,{refreshRef:r},t)},E=function(e){var t,n,d,m,v=e.active,w=S((0,l.useContext)(k).routeList),j=(0,l.useContext)(f.T),A=j.role,E=j.setRole,R=(0,i.useAPIClient)(),T=(0,p.useTranslation)().t,_=O(w),F=(t=(0,l.useState)([]),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(c)throw r}}return i}}(t,2)||g(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),I=F[0],q=F[1],M=(0,i.useRequest)({resource:"roles.desktopRoutes",resourceOf:A.name,action:"list",params:{paginate:!1,filter:{hidden:{$ne:!0}}}},{ready:!!A&&v,refreshDeps:[null==A?void 0:A.name],onSuccess:function(e){var t;q((null==e||null==(t=e.data)?void 0:t.map(function(e){return e.id}))||[])}}),N=M.loading,D=M.refresh,B=R.resource("roles.desktopRoutes",A.name),z=_.length===I.length,L=(0,i.useAllAccessDesktopRoutes)().refresh,V=(n=y(function(e,t){var n,r,o,i,a,l,s,p;return x(this,function(f){switch(f.label){case 0:if(!e)return[3,2];return n=I.filter(function(e){return e!==t.id}),r=[t.id],t.parent&&0===t.parent.children.filter(function(e){return n.includes(e.id)}).length&&(n=n.filter(function(e){return e!==t.parent.id}),r.push(t.parent.id)),t.children&&(n=n.filter(function(e){return!O(t.children).includes(e)}),(o=r).push.apply(o,h(O(t.children)))),q(n),[4,B.remove({values:r})];case 1:return f.sent(),[3,4];case 2:return i=h(I).concat([t.id]),a=[t.id],t.parent&&!i.includes(t.parent.id)&&(i.push(t.parent.id),a.push(t.parent.id)),t.children&&(p=O(t.children),(l=i).push.apply(l,h(p)),(s=a).push.apply(s,h(p))),q((0,u.uniq)(i)),[4,B.add({values:a})];case 3:f.sent(),f.label=4;case 4:return L(),c.message.success(T("Saved successfully")),[2]}})}),function(e,t){return n.apply(this,arguments)}),U=(0,a.useMemoizedFn)((d=y(function(e){return x(this,function(t){switch(t.label){case 0:return[4,R.resource("roles").update({filterByTk:A.name,values:e.values})];case 1:return t.sent(),E(b({},A,e.values)),c.message.success(T("Saved successfully")),[2]}})}),function(e){return d.apply(this,arguments)})),K=(0,l.useMemo)(function(){return(0,r.createForm)({values:A,effects:function(){var e;(0,r.onFormValuesChange)((e=y(function(e){return x(this,function(t){switch(t.label){case 0:return[4,U(e)];case 1:return t.sent(),[2]}})}),function(t){return e.apply(this,arguments)}))}})},[A,U]),$=(0,i.useCompile)();return s().createElement(s().Fragment,null,s().createElement(i.SchemaComponent,{schema:{type:"void",name:(0,o.uid)(),"x-component":"FormV2","x-component-props":{form:K},properties:{allowNewMenu:{title:T("Route permissions"),"x-decorator":"FormItem","x-component":"Checkbox","x-content":T("New routes are allowed to be accessed by default")}}}}),s().createElement(c.Table,{className:C,loading:N,rowKey:"id",pagination:!1,expandable:{defaultExpandAllRows:!1},columns:[{dataIndex:"title",title:T("Route name")},{dataIndex:"accessible",title:s().createElement(s().Fragment,null,s().createElement(c.Checkbox,{checked:z,onChange:(m=y(function(e){return x(this,function(e){switch(e.label){case 0:if(!z)return[3,2];return[4,B.set({values:[]})];case 1:return e.sent(),[3,4];case 2:return[4,B.set({values:_})];case 3:e.sent(),e.label=4;case 4:return D(),L(),c.message.success(T("Saved successfully")),[2]}})}),function(e){return m.apply(this,arguments)})})," ",T("Accessible")),render:function(e,t){var n=I.includes(t.id);return s().createElement(c.Checkbox,{checked:n,onChange:function(){return V(n,t)}})}}],dataSource:P(w,T,$)}))}},77:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginACLClient:function(){return $},RolesManagerContext:function(){return q.T},default:function(){return G},RoleResourceCollectionContext:function(){return I}});var r=n(772),o=n(156),i=n.n(o),a=n(720),c=n(581),u=(0,r.lazy)(function(){return c("imported_-1r1jup3_component",n.e("86").then(n.bind(n,229)))},"GeneralPermissions").GeneralPermissions,l=(0,r.lazy)(function(){return c("imported_1qalbop_component",Promise.resolve().then(n.bind(n,720)))},"MenuPermissions").MenuPermissions,s=function(){var e;function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");e="permissionsTabs",n=[function(e){var t=e.t,n=e.TabLayout;return{key:"general",label:t("System"),sort:10,children:i().createElement(n,null,i().createElement(u,null))}},function(e){var t=e.activeKey,n=e.t,r=e.TabLayout;return{key:"menu",label:n("Desktop routes"),sort:20,children:i().createElement(r,null,i().createElement(a.DesktopAllRoutesProvider,{active:"menu"===t},i().createElement(l,{active:"menu"===t})))}}],e in this?Object.defineProperty(this,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):this[e]=n}return e=[{key:"addPermissionsTab",value:function(e){this.permissionsTabs.push(e)}},{key:"getPermissionsTabs",value:function(e){return this.permissionsTabs.map(function(t){return"function"==typeof t?t(e):t}).sort(function(e,t){var n,r;return(null!=(n=null==e?void 0:e.sort)?n:100)-(null!=(r=null==t?void 0:t.sort)?r:100)})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}(),p=n(584),f=function(){var e;function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");e="rolesManager",n=new p.Registry,e in this?Object.defineProperty(this,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):this[e]=n}return e=[{key:"add",value:function(e,t){this.rolesManager.register(e,t)}},{key:"list",value:function(){return this.rolesManager.getEntities()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}(),d=n(238),m=n(721),y=n(467),b=n.n(y);function v(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}var h=function(){var e,t,n,o=(0,d.useTranslation)().t,a=(0,r.useAPIClient)(),c=b().cloneDeep((0,r.useCurrentRoles)()),u=(0,r.useCurrentRoleMode)(),l=null==(n=c.find(function(e){return e.name===a.auth.role}))?void 0:n.name;return("allow-use-union"===u&&c.unshift({name:"__union__",title:o("Full permissions",{ns:"acl"})}),c.length<=1||"only-use-union"===u)?null:i().createElement(r.SchemaSettingsItem,{eventKey:"SwitchRole",title:"SwitchRole"},i().createElement(r.SelectWithTitle,{title:o("Switch role"),fieldNames:{label:"title",value:"name"},options:c.reduce(function(e,t){return e.push(t),"__union__"===t.name&&e.push({name:"divider",title:i().createElement(m.Divider,{style:{margin:"2px 1px"}}),disabled:!0,style:{minHeight:0,height:"auto",padding:0}}),e},[]),defaultValue:l||c[0].name,onChange:(e=function(e){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:return a.auth.setRole(e),[4,a.resource("users").setDefaultRole({values:{roleName:e}})];case 1:return t.sent(),location.reload(),window.location.reload(),[2]}})},t=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){v(i,r,o,a,c,"next",e)}function c(e){v(i,r,o,a,c,"throw",e)}a(void 0)})},function(e){return t.apply(this,arguments)})}))},g=n(632),x=n(505),w=n(898),S=n(563),O={name:"rolesResourcesScopes",fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Scope name")}}',type:"string","x-component":"Input",required:!0}}]},C={type:"object",properties:{scope:{"x-component":"RecordPicker","x-component-props":{size:"small",fieldNames:{label:"name",value:"id"},multiple:!1,association:{target:"rolesResourcesScopes"},onChange:"{{ onChange }}"},properties:{selector:{type:"void",title:'{{ t("Select record") }}',"x-component":"RecordPicker.Selector","x-component-props":{className:"nb-record-picker-selector"},properties:{tableBlock:{type:"void","x-decorator":"TableSelectorProvider","x-decorator-props":{collection:O,resource:"rolesResourcesScopes",action:"list",params:{pageSize:20},useParams:function(){return{filter:{$or:[{resourceName:(0,o.useContext)(I).name},{resourceName:null}]}}},rowKey:"id"},"x-component":"BlockItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void",title:'{{ t("Add new") }}',"x-action":"create","x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:"rolesResourcesScopes",collection:O},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":function(){var e=(0,o.useContext)(I).name,t=(0,r.useFormBlockContext)();return(0,o.useEffect)(function(){t.form.setInitialValues({resourceName:e})},[e]),{form:t.form}},properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":"Filter","x-use-component-props":function(){var e=(0,o.useContext)(I);return{options:(0,r.useFilterOptions)(e.name)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}}},value:{type:"array","x-component":"TableV2.Selector","x-use-component-props":"useTableSelectorProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-component":"TableV2.Column",properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{edit:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:"rolesResourcesScopes",collection:O,action:"get",useParams:"{{ useParamsFromRecord }}"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":"Filter","x-use-component-props":function(){var e=(0,o.useContext)(I);return{options:(0,r.useFilterOptions)(e.name)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{update:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}},destroy:{title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}};function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var k=(0,o.createContext)(null);k.displayName="RolesResourcesScopesSelectedRowKeysContext";var j=function(e){var t,n=(t=(0,o.useState)([]),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(c)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return P(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=n[0],a=n[1];return i().createElement(k.Provider,{value:[r,a]},e.children)},A=function(e){var t=(0,o.useMemo)(function(){return(0,S.createForm)({values:{scope:e.value}})},[]);return i().createElement(r.FormProvider,{form:t},i().createElement(r.SchemaComponent,{components:{RolesResourcesScopesSelectedRowKeysProvider:j},scope:{onChange:function(t){var n;null==e||null==(n=e.onChange)||n.call(e,t)}},schema:C}))},E=n(438);function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function _(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var F=function(e){var t,n={};return null==e||null==(t=e.forEach)||t.call(e,function(e){e.name&&(n[e.name]=e,n[e.name].scope=(0,y.isEmpty)(e.scope)?null:e.scope)}),n},I=(0,o.createContext)({});I.displayName="RoleResourceCollectionContext",(0,x.connect)(function(e){var t,n=(0,E.y)().styles,o=function(t){var n=t.map(function(e){return _(T({},e),{scope:(0,y.isEmpty)(e.scope)?null:e.scope})});e.onChange(n)};(0,x.useForm)();var a=(0,r.useRecord)(),c=(0,w.r)(),u=(0,r.useCollectionManager_deprecated)(),l=u.getCollection,s=u.getCollectionFields,p=l(a.collectionName),f=s(a.collectionName),b=(0,r.useCompile)(),v=(0,d.useTranslation)().t,h=F((0,x.useField)().value||[]),S=function(e,t){var n,r=null==h?void 0:h[e];return!!r&&(null==r||null==(n=r.fields)?void 0:n.includes(t))},O=c.filter(function(e){return e.allowConfigureFields}),C=null==f||null==(D=f.filter(function(e){return e.interface}))?void 0:D.map(function(e){var t=T({},e),n=!0,r=!1,o=void 0;try{for(var i,a=O[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var c=i.value;t[c.name]=S(c.name,e.name)}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return t}),P=function(e){if(h[e])delete h[e];else{var t,n;h[e]={name:e,fields:null==f||null==(n=f.filter(function(e){return e.interface}))||null==(t=n.map)?void 0:t.call(n,function(e){return e.name})}}o(Object.values(h))},k=function(e,t){h[e]?(h[e].scope=t,o(Object.values(h))):(P(e),h[e].scope=t)},j={},q=!0,M=!1,N=void 0;try{for(var D,B,z=O[Symbol.iterator]();!(q=(B=z.next()).done);q=!0){var L,V,U,K=B.value;j[K.name]=(null==f||null==(L=f.filter(function(e){return e.interface}))?void 0:L.length)===(null==h||null==(U=h[K.name])||null==(V=U.fields)?void 0:V.length)}}catch(e){M=!0,N=e}finally{try{q||null==z.return||z.return()}finally{if(M)throw N}}return i().createElement("div",null,i().createElement(I.Provider,{value:p},i().createElement(g.FormLayout,{layout:"vertical"},i().createElement(g.FormItem,{label:v("Action permission")},i().createElement(m.Table,{className:n,size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:v("Action display name"),render:function(e){return b(e)}},{dataIndex:"onNewRecord",title:v("Action type"),render:function(e){return e?i().createElement(m.Tag,{color:"green"},v("Action on new records")):i().createElement(m.Tag,{color:"geekblue"},v("Action on existing records"))}},{dataIndex:"enabled",title:v("Allow"),render:function(e,t){return i().createElement(m.Checkbox,{checked:e,onChange:function(){P(t.name)}})}},{dataIndex:"scope",title:v("Data scope"),render:function(e,t){return!t.onNewRecord&&i().createElement(A,{value:e,onChange:function(e){k(t.name,e)}})}}],dataSource:null==c?void 0:c.map(function(e){var t=!1,n=null;return h[e.name]&&(t=!0,e.onNewRecord||(n=h[e.name].scope)),_(T({},e),{enabled:t,scope:n})})})),i().createElement(g.FormItem,{label:v("Field permission")},i().createElement(m.Table,{className:n,pagination:!1,dataSource:C,columns:[{dataIndex:["uiSchema","title"],title:v("Field display name"),render:function(e){return b(e)}}].concat(function(e){if(Array.isArray(e))return R(e)}(t=O.map(function(e){var t=null==j?void 0:j[e.name];return{dataIndex:e.name,title:i().createElement(i().Fragment,null,i().createElement(m.Checkbox,{checked:t,onChange:function(){var n,r=h[e.name]||{name:e.name};t?r.fields=[]:r.fields=null==f||null==(n=f.map)?void 0:n.call(f,function(e){return e.name}),h[e.name]=r,o(Object.values(h))}})," ",b(e.displayName)),render:function(t,n){return i().createElement(m.Checkbox,{checked:t,"aria-label":"".concat(e.name,"_checkbox"),onChange:function(){var r=h[e.name]||{name:e.name},i=r.fields||[];if(t){var a=i.indexOf(n.name);i.splice(a,1)}else i.push(n.name);r.fields=i,h[e.name]=r,o(Object.values(h))}})}}}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return R(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R(e,t)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())})))))});var q=n(400),M=n(581);function N(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function D(e,t,n){return(D=U()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&L(o,n.prototype),o}).apply(null,arguments)}function B(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(e){var t="function"==typeof Map?new Map:void 0;return(V=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return D(e,arguments,z(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),L(n,e)})(e)}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(U=function(){return!!e})()}var K=(0,r.lazy)(function(){return M("imported_-1obaqk_component",n.e("646").then(n.bind(n,176)))},"RolesManagement").RolesManagement,$=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=z(t),B(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,U()?Reflect.construct(t,r||[],z(this).constructor):t.apply(this,r)),"rolesManager",new f),B(e,"settingsUI",new s),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&L(n,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return t.pluginSettingsManager.add("users-permissions.roles",{title:t.t("Roles & Permissions"),icon:"LockOutlined",Component:K,aclSnippet:"pm.acl.roles",sort:3}),t.app.addUserCenterSettingsItem({name:"divider_switchRole",type:"divider",sort:200}),t.app.addUserCenterSettingsItem({name:"switchRole",Component:h,sort:300}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){N(i,r,o,a,c,"next",e)}function c(e){N(i,r,o,a,c,"throw",e)}a(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(V(r.Plugin)),G=$},438:function(e,t,n){"use strict";function r(){var e,t,n=(e=["\n .ant-table-cell {\n > .ant-space-horizontal {\n .ant-space-item-split:has(+ .ant-space-item:empty) {\n display: none;\n }\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return r=function(){return n},n}n.d(t,{y:function(){return o}});var o=(0,n(202).createStyles)(function(e){return(0,e.css)(r())})},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=u},632:function(e){"use strict";e.exports=t},563:function(t){"use strict";t.exports=e},505:function(e){"use strict";e.exports=c},875:function(e){"use strict";e.exports=i},772:function(e){"use strict";e.exports=a},584:function(e){"use strict";e.exports=l},749:function(e){"use strict";e.exports=o},721:function(e){"use strict";e.exports=p},202:function(e){"use strict";e.exports=s},467:function(e){"use strict";e.exports=r},156:function(e){"use strict";e.exports=n},238:function(e){"use strict";e.exports=f}},x={};function w(e){var t=x[e];if(void 0!==t)return t.exports;var n=x[e]={exports:{}};return g[e](n,n.exports,w),n.exports}return w.m=g,w.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return w.d(t,{a:t}),t},w.d=function(e,t){for(var n in t)w.o(t,n)&&!w.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},w.f={},w.e=function(e){return Promise.all(Object.keys(w.f).reduce(function(t,n){return w.f[n](e,t),t},[]))},w.u=function(e){return""+({646:"0655d5ded9f45bb1",86:"50204a14518b3a0d"})[e]+".js"},w.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),w.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},m="@nocobase/plugin-acl:",w.l=function(e,t,n,r){if(d[e])return void d[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var u=a[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==m+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,w.nc&&o.setAttribute("nonce",w.nc),o.setAttribute("data-webpack",m+n),o.src=e),d[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=d[e];if(delete d[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},w.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(y=window.__webpack_public_path__||"/").endsWith("/")||(y+="/"),w.p=y+"static/plugins/@nocobase/plugin-acl/dist/client/",b={909:0},w.f.j=function(e,t){var n=w.o(b,e)?b[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=b[e]=[t,r]});t.push(n[2]=r);var o=w.p+w.u(e),i=Error();w.l(o,function(t){if(w.o(b,e)&&(0!==(n=b[e])&&(b[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},v=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],c=0;if(o.some(function(e){return 0!==b[e]})){for(n in i)w.o(i,n)&&(w.m[n]=i[n]);a&&a(w)}for(e&&e(t);c<o.length;c++)r=o[c],w.o(b,r)&&b[r]&&b[r][0](),b[r]=0},(h=self.webpackChunk_nocobase_plugin_acl=self.webpackChunk_nocobase_plugin_acl||[]).forEach(v.bind(null,0)),h.push=v.bind(null,h.push.bind(h)),w(77)}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.0.0-beta.
|
|
11
|
+
"@nocobase/client": "2.0.0-beta.8",
|
|
12
12
|
"antd": "5.24.2",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"react-i18next": "11.18.6",
|
|
@@ -17,14 +17,14 @@ module.exports = {
|
|
|
17
17
|
"@formily/react": "2.3.7",
|
|
18
18
|
"@ant-design/icons": "5.6.1",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
|
-
"@nocobase/utils": "2.0.0-beta.
|
|
21
|
-
"@nocobase/actions": "2.0.0-beta.
|
|
22
|
-
"@nocobase/cache": "2.0.0-beta.
|
|
23
|
-
"@nocobase/database": "2.0.0-beta.
|
|
24
|
-
"@nocobase/server": "2.0.0-beta.
|
|
25
|
-
"@nocobase/test": "2.0.0-beta.
|
|
20
|
+
"@nocobase/utils": "2.0.0-beta.8",
|
|
21
|
+
"@nocobase/actions": "2.0.0-beta.8",
|
|
22
|
+
"@nocobase/cache": "2.0.0-beta.8",
|
|
23
|
+
"@nocobase/database": "2.0.0-beta.8",
|
|
24
|
+
"@nocobase/server": "2.0.0-beta.8",
|
|
25
|
+
"@nocobase/test": "2.0.0-beta.8",
|
|
26
26
|
"@formily/core": "2.3.7",
|
|
27
27
|
"@formily/antd-v5": "1.2.3",
|
|
28
28
|
"antd-style": "3.7.1",
|
|
29
|
-
"@nocobase/acl": "2.0.0-beta.
|
|
29
|
+
"@nocobase/acl": "2.0.0-beta.8"
|
|
30
30
|
};
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.",
|
|
7
7
|
"description.ru-RU": "На основе ролей, ресурсов и действий система контроля доступа может точно управлять разрешениями на изменение интерфейса, работу с данными, доступ к меню и разрешениями для подключаемых модулей.",
|
|
8
8
|
"description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
|
|
9
|
-
"version": "2.0.0-beta.
|
|
9
|
+
"version": "2.0.0-beta.8",
|
|
10
10
|
"license": "AGPL-3.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/acl",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
40
40
|
"directory": "packages/plugins/acl"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "6bd912b1028eb8bc09a823d35e4d37b3000861b1"
|
|
43
43
|
}
|