@tachybase/module-user 1.3.16 → 1.3.18
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/dist/index.js +4 -4
- package/package.json +12 -12
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("@tachybase/module-acl/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("antd"),require("react-i18next"),require("@tachybase/utils/client")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-acl/client","react/jsx-runtime","react","@tachybase/schema","antd","react-i18next","@tachybase/utils/client"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r["@tachybase/module-user"]={},r["@tachybase/client"],r["@tachybase/module-acl"],r.jsxRuntime,r.react,r["@tachybase/schema"],r.antd,r["react-i18next"],r["@tachybase/utils"]))})(this,function(r,e,s,n,l,x,y,w,C){"use strict";var ae=Object.defineProperty,ce=Object.defineProperties;var ie=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var U=(r,e,s)=>e in r?ae(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,v=(r,e)=>{for(var s in e||(e={}))q.call(e,s)&&U(r,s,e[s]);if(P)for(var s of P(e))D.call(e,s)&&U(r,s,e[s]);return r},A=(r,e)=>ce(r,ie(e));var M=(r,e)=>{var s={};for(var n in r)q.call(r,n)&&e.indexOf(n)<0&&(s[n]=r[n]);if(r!=null&&P)for(var n of P(r))e.indexOf(n)<0&&D.call(r,n)&&(s[n]=r[n]);return s};var f=(r,e,s)=>new Promise((n,l)=>{var x=C=>{try{w(s.next(C))}catch(h){l(h)}},y=C=>{try{w(s.throw(C))}catch(h){l(h)}},w=C=>C.done?n(C.value):Promise.resolve(C.value).then(x,y);w((s=s.apply(r,e)).next())});function h(){return w.useTranslation(["user","core"],{nsMode:"fallback"})}const g={name:"users",fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0},interface:"id"},{interface:"input",type:"string",name:"nickname",uiSchema:{type:"string",title:'{{t("Nickname")}}',"x-component":"Input"}},{interface:"input",type:"string",name:"username",unique:!0,uiSchema:{type:"string",title:'{{t("Username")}}',"x-component":"Input","x-validator":{username:!0},required:!0}},{interface:"email",type:"string",name:"email",unique:!0,uiSchema:{type:"string",title:'{{t("Email")}}',"x-component":"Input","x-validator":"email",required:!0}},{interface:"phone",type:"string",name:"phone",unique:!0,uiSchema:{type:"string",title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone",required:!0}},{interface:"password",type:"password",name:"password",hidden:!0,uiSchema:{type:"string",title:'{{t("Password")}}',"x-component":"Password"}},{interface:"m2m",type:"belongsToMany",name:"roles",target:"roles",foreignKey:"userId",otherKey:"roleName",onDelete:"CASCADE",sourceKey:"id",targetKey:"name",through:"rolesUsers",uiSchema:{type:"array",title:'{{t("Roles")}}',"x-component":"AssociationField","x-component-props":{multiple:!0,fieldNames:{label:"title",value:"name"}}}}]},E={type:"void",properties:{block1:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:g,action:"list",params:{pageSize:50,appends:["roles"]}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-use-component-props":"useBulkDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete users')}}",content:"{{t('Are you sure you want to delete it?')}}"},icon:"DeleteOutlined"}},create:{type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add user") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{body:{type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"users:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:g},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{assignedValues:{},triggerWorkflows:[],pageMode:!1}}}},nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-component-props":{autocomplete:"off"},required:!1},password:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{autocomplete:"new-password"},required:!0},roles:{"x-component":"CollectionField","x-collection-field":"users.roles","x-decorator":"FormItem"}}}}}}}}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("Roles")}}',properties:{roles:{type:"array","x-component":"UserRolesField"}}},column5:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space",properties:{update:{type:"void",title:'{{t("Edit profile")}}',"x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"users:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:"users"},"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormBlockProps",title:'{{t("Edit profile")}}',properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary"}}}},nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem",required:!1},roles:{"x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"users.roles"}}}}},changePassword:{type:"void",title:'{{ t("Change password") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Change password") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"users:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:g,params:{append:["password"]}},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary"}}}},password:{"x-component":"CollectionField","x-component-props":{component:"PasswordField"},"x-decorator":"FormItem",required:!0}}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-acl-action":"users:destroy","x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}}},O=()=>({type:"void",properties:{[x.uid()]:{type:"void","x-decorator":"RoleUsersTableBlockProvider","x-component":"CardItem","x-use-decorator-props":"useRoleUsersServiceProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{[x.uid()]:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},actions:{type:"void","x-component":"Space",properties:{remove:{type:"void",title:'{{t("Remove")}}',"x-component":"Action","x-use-component-props":"useBulkRemoveUsers","x-component-props":{icon:"MinusOutlined",confirm:{title:"{{t('Remove')}}",content:"{{t('Are you sure you want to remove these users?')}}"},style:{marginRight:8}}},create:{type:"void",title:'{{t("Add users")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2",title:'{{t("Add users")}}',properties:{resource:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-use-decorator-props":"useRoleUsersProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{username:{$includes:""}},{nickname:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useAddRoleUsers","x-component-props":{type:"primary",htmlType:"submit"}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{username:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},phone:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{phone:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},email:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}}}}}}}}}}}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{username:{type:"void",title:'{{t("Username")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void",title:'{{t("Nickname")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{remove:{type:"void",title:'{{ t("Remove") }}',"x-component":"Action.Link","x-use-component-props":"useRemoveUser","x-component-props":{confirm:{title:"{{t('Remove user')}}",content:"{{t('Are you sure you want to remove it?')}}"}}}}}}}}}}}}}),R=()=>{var a,c;const t=l.useContext(e.CollectionContext),o=e.useFilterFieldOptions(t.fields),{service:p}=e.useTableBlockContext();return e.useFilterFieldProps({options:o,params:((c=(a=p.state)==null?void 0:a.params)==null?void 0:c[0])||p.params,service:p})},K=()=>{const t=e.useAPIClient(),{role:o}=l.useContext(s.RolesManagerContext),p=e.useCollectionRecordData(),{service:a}=e.useTableBlockContext();return{onClick(){return f(this,null,function*(){yield t.resource("roles.users",o==null?void 0:o.name).remove({values:[p.id]}),a==null||a.refresh()})}}},N=()=>{const{t}=h(),{message:o}=y.App.useApp(),p=e.useAPIClient(),{service:a,field:c}=e.useTableBlockContext(),{role:i}=l.useContext(s.RolesManagerContext);return{onClick(){return f(this,null,function*(){var d;const m=(d=c==null?void 0:c.data)==null?void 0:d.selectedRowKeys;if(!(m!=null&&m.length)){o.warning(t("Please select users"));return}yield p.resource("roles.users",i==null?void 0:i.name).remove({values:m}),c.data.selectedRowKeys=[],a==null||a.refresh()})}}},j=()=>{const{t}=h(),{role:o}=l.useContext(s.RolesManagerContext),{message:p}=y.App.useApp(),a=e.useAPIClient(),{setVisible:c}=e.useActionContext(),{field:i}=e.useTableBlockContext(),{__parent:u}=e.useBlockRequestContext();return{onClick(){return f(this,null,function*(){var b,F;const d=(b=i==null?void 0:i.data)==null?void 0:b.selectedRowKeys;if(!(d!=null&&d.length)){p.warning(t("Please select users"));return}yield a.resource("roles.users",o==null?void 0:o.name).add({values:d}),i.data.selectedRowKeys=[],c(!1),(F=u==null?void 0:u.props)==null||F.service.refresh()})}}},W=t=>{const{role:o}=l.useContext(s.RolesManagerContext);return A(v({},t),{collection:g,action:"listExcludeRole",params:{roleName:o==null?void 0:o.name}})},L=t=>{const{role:o}=l.useContext(s.RolesManagerContext),p=e.useRequest({resource:"roles.users",resourceOf:o==null?void 0:o.name,action:"list"},{ready:!!o});return A(v({},t),{service:p,collection:g,params:{pageSize:50}})},z=e.withDynamicSchemaProps(t=>{const B=t,{showIndex:o,dragSort:p,rowKey:a,fieldNames:c,collection:i,service:u}=B,m=M(B,["showIndex","dragSort","rowKey","fieldNames","collection","service"]),d=x.useField(),{role:b}=l.useContext(s.RolesManagerContext),F=e.useTableBlockParams(t);l.useEffect(()=>{u.run()},[b]);const k=x.useFieldSchema(),{treeTable:S}=(k==null?void 0:k["x-decorator-props"])||{},[T,ne]=l.useState(!!c);let I="children";if(i!=null&&i.tree&&S!==!1){const V=i.fields.find(pe=>pe.treeChildren);V&&(I=V.name),F.tree=!0}const se=l.useMemo(()=>x.createForm(),[S]);return n.jsx(e.SchemaComponentOptions,{scope:{treeTable:S},children:n.jsx(x.FormContext.Provider,{value:se,children:n.jsx(e.BlockProvider,A(v({name:t.name||"table"},t),{params:F,runWhenParamsChanged:!0,children:n.jsx(e.FixedBlockWrapper,{children:n.jsx(e.TableBlockContext.Provider,{value:A(v({},m),{field:d,service:u,params:F,showIndex:o,dragSort:p,rowKey:a,expandFlag:T,childrenColumnName:I,setExpandFlag:()=>ne(!T)}),children:n.jsx(e.RenderChildrenWithAssociationFilter,v({},t))})})}))})})}),$=()=>{const{t}=h(),{role:o}=l.useContext(s.RolesManagerContext),p=l.useMemo(()=>O(),[o]);return n.jsx(e.ExtendCollectionsProvider,{collections:[g],children:n.jsx(e.SchemaComponent,{schema:p,components:{RoleUsersTableBlockProvider:z},scope:{useBulkRemoveUsers:N,useRemoveUser:K,useAddRoleUsers:j,useRoleUsersProps:W,useFilterActionProps:R,useRoleUsersServiceProps:L,t}})})},G=()=>n.jsx(e.SchemaComponent,{schema:J,scope:{useSaveCurrentUserValues:H}}),H=()=>{const t=x.useForm(),o=e.useAPIClient(),{message:p}=y.App.useApp(),{t:a}=e.useTranslation();return{run(){return f(this,null,function*(){yield t.submit(),(yield o.resource("auth").changePassword({values:t.values})).status===200&&p.success(a("Edited successfully")),yield t.reset()})}}},J={type:"object",properties:{[C.uid()]:{type:"void","x-component":"CardItem","x-decorator":"Form",title:'{{t("Change password")}}',properties:{action:{type:"void",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",style:{left:"96%"},useAction:"{{ useSaveCurrentUserValues }}"}}}},oldPassword:{type:"string",title:'{{t("Old password")}}',required:!0,"x-component":"Password","x-decorator":"FormItem"},newPassword:{type:"string",title:'{{t("New password")}}',required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirmPassword"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirmPassword:{type:"string",required:!0,title:'{{t("Confirm password")}}',"x-component":"Password","x-decorator":"FormItem","x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".newPassword"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]}}}}},Q=()=>n.jsx(e.SchemaComponent,{schema:Z,scope:{useCurrentUserValues:X,useSaveCurrentUserValues:Y}}),X=t=>{const o=e.useCurrentUserContext();return e.useRequest(()=>Promise.resolve(o.data),t)},Y=()=>{const t=e.useCurrentUserContext(),o=x.useForm(),p=e.useAPIClient(),{message:a}=y.App.useApp(),{t:c}=e.useTranslation();return{run(){return f(this,null,function*(){var d;const u=yield o.submit();(yield p.resource("users").updateProfile({values:u})).status===200&&a.success(c("Edited successfully")),t.mutate({data:v(v({},(d=t==null?void 0:t.data)==null?void 0:d.data),u)})})}}},Z={type:"object",properties:{[C.uid()]:{type:"void","x-component":"CardItem","x-decorator":"Form","x-decorator-props":{useValues:"{{useCurrentUserValues}}"},title:'{{t("Edit profile")}}',properties:{action:{type:"void",properties:{submit:{title:"Submit","x-component":"Action","x-component-props":{type:"primary",style:{left:"96%"},useAction:"{{ useSaveCurrentUserValues }}"}}}},nickname:{type:"string",title:"{{t('Nickname')}}","x-decorator":"FormItem","x-component":"Input"},username:{type:"string",title:'{{t("Username")}}',"x-decorator":"FormItem","x-component":"Input","x-validator":{username:!0},required:!0},email:{type:"string",title:'{{t("Email")}}',"x-decorator":"FormItem","x-component":"Input","x-validator":"email"},phone:{type:"string",title:'{{t("Phone")}}',"x-decorator":"FormItem","x-component":"Input","x-validator":"phone"}}}}},_=(t=10)=>{const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ",p="abcdefghijklmnopqrstuvwxyz",a="0123456789",c="!#$%^&*-_+=",i=o+p+a+c,u=new Uint32Array(t);crypto.getRandomValues(u);let m="";m+=o.charAt(u[0]%o.length),m+=p.charAt(u[1]%p.length),m+=a.charAt(u[2]%a.length),m+=c.charAt(u[3]%c.length);for(let d=4;d<t;d++){const b=u[d]%i.length;m+=i.charAt(b)}return m=m[0]+m.slice(1).split("").sort(()=>Math.random()-.5).join(""),m},ee=()=>{const{t}=h(),o=x.useField(),[p,a]=l.useState(!1),c=e.useActionContext();return l.useEffect(()=>{c.visible||o.reset()},[o,c.visible]),n.jsxs(y.Row,{gutter:10,children:[n.jsx(y.Col,{span:18,children:n.jsx(e.Password,{checkStrength:!0,visibilityToggle:{visible:p,onVisibleChange:a},value:o.value,onChange:i=>o.setValue(i.target.value),autoComplete:"off"})}),n.jsx(y.Col,{span:4,children:n.jsx(y.Button,{onClick:()=>{o.setValue(_()),a(!0)},children:t("Random password")})})]})},oe=()=>{const{t}=h();return(x.useField().value||[]).map(p=>n.jsx(y.Tag,{children:x.Schema.compile(p.title,{t})},p.name))},te=()=>{const{t}=h(),o=e.useSchemaComponentContext();return n.jsx(e.SchemaComponentContext.Provider,{value:A(v({},o),{designable:!1}),children:n.jsx(e.SchemaComponent,{schema:E,scope:{t},components:{UserRolesField:oe,PasswordField:ee}})})};class re extends e.Plugin{load(){return f(this,null,function*(){this.app.systemSettingsManager.add("id-auth.users",{title:e.tval("Users"),icon:"UserOutlined",Component:te,aclSnippet:"pm.users"}),this.userSettingsManager.add("user-change-password",{icon:"LockOutlined",title:e.tval("Change password"),Component:G}),this.userSettingsManager.add("user-profile",{icon:"UserOutlined",title:e.tval("Edit profile"),Component:Q}),this.app.pm.get(s).rolesManager.add("users",{title:e.tval("Users"),Component:$})})}}r.default=re,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("@tachybase/module-acl/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("antd"),require("react-i18next"),require("@tachybase/utils/client")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-acl/client","react/jsx-runtime","react","@tachybase/schema","antd","react-i18next","@tachybase/utils/client"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r["@tachybase/module-user"]={},r["@tachybase/client"],r["@tachybase/module-acl"],r.jsxRuntime,r.react,r["@tachybase/schema"],r.antd,r["react-i18next"],r["@tachybase/utils"]))})(this,function(r,e,a,s,m,x,y,F,C){"use strict";var ie=Object.defineProperty,le=Object.defineProperties;var ue=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var D=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var U=(r,e,a)=>e in r?ie(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,v=(r,e)=>{for(var a in e||(e={}))D.call(e,a)&&U(r,a,e[a]);if(P)for(var a of P(e))M.call(e,a)&&U(r,a,e[a]);return r},g=(r,e)=>le(r,ue(e));var q=(r,e)=>{var a={};for(var s in r)D.call(r,s)&&e.indexOf(s)<0&&(a[s]=r[s]);if(r!=null&&P)for(var s of P(r))e.indexOf(s)<0&&M.call(r,s)&&(a[s]=r[s]);return a};var b=(r,e,a)=>new Promise((s,m)=>{var x=C=>{try{F(a.next(C))}catch(h){m(h)}},y=C=>{try{F(a.throw(C))}catch(h){m(h)}},F=C=>C.done?s(C.value):Promise.resolve(C.value).then(x,y);F((a=a.apply(r,e)).next())});function h(){return F.useTranslation(["user","core"],{nsMode:"fallback"})}const w={name:"users",fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0},interface:"id"},{interface:"input",type:"string",name:"nickname",uiSchema:{type:"string",title:'{{t("Nickname")}}',"x-component":"Input"}},{interface:"input",type:"string",name:"username",unique:!0,uiSchema:{type:"string",title:'{{t("Username")}}',"x-component":"Input","x-validator":{username:!0},required:!0}},{interface:"email",type:"string",name:"email",unique:!0,uiSchema:{type:"string",title:'{{t("Email")}}',"x-component":"Input","x-validator":"email",required:!0}},{interface:"phone",type:"string",name:"phone",unique:!0,uiSchema:{type:"string",title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone",required:!0}},{interface:"password",type:"password",name:"password",hidden:!0,uiSchema:{type:"string",title:'{{t("Password")}}',"x-component":"Password"}},{interface:"m2m",type:"belongsToMany",name:"roles",target:"roles",foreignKey:"userId",otherKey:"roleName",onDelete:"CASCADE",sourceKey:"id",targetKey:"name",through:"rolesUsers",uiSchema:{type:"array",title:'{{t("Roles")}}',"x-component":"AssociationField","x-component-props":{multiple:!0,fieldNames:{label:"title",value:"name"}}}}]},E={type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:e.OpenMode.DRAWER_MODE,type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add user") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{body:{type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"users:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:w},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{assignedValues:{},triggerWorkflows:[],pageMode:!1}}}},nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-component-props":{autocomplete:"off"},required:!1},password:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{autocomplete:"new-password"},required:!0},roles:{"x-component":"CollectionField","x-collection-field":"users.roles","x-decorator":"FormItem"}}}}}}}}},O={type:"void",title:'{{ t("Change password") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:e.OpenMode.DRAWER_MODE},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Change password") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"users:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:w,params:{append:["password"]}},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary"}}}},password:{"x-component":"CollectionField","x-component-props":{component:"PasswordField"},"x-decorator":"FormItem",required:!0}}}}}}}}},R={type:"void",properties:{block1:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:w,action:"list",params:{pageSize:50,appends:["roles"]}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-use-component-props":"useBulkDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete users')}}",content:"{{t('Are you sure you want to delete it?')}}"},icon:"DeleteOutlined"}},create:E}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("Roles")}}',properties:{roles:{type:"array","x-component":"UserRolesField"}}},column5:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space",properties:{update:{type:"void",title:'{{t("Edit profile")}}',"x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"users:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:"users"},"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormBlockProps",title:'{{t("Edit profile")}}',properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary"}}}},nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem",required:!1},roles:{"x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"users.roles"}}}}},changePassword:O,delete:{type:"void",title:'{{ t("Delete") }}',"x-acl-action":"users:destroy","x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}}},K=()=>({type:"void",properties:{[x.uid()]:{type:"void","x-decorator":"RoleUsersTableBlockProvider","x-component":"CardItem","x-use-decorator-props":"useRoleUsersServiceProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{[x.uid()]:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},actions:{type:"void","x-component":"Space",properties:{remove:{type:"void",title:'{{t("Remove")}}',"x-component":"Action","x-use-component-props":"useBulkRemoveUsers","x-component-props":{icon:"MinusOutlined",confirm:{title:"{{t('Remove')}}",content:"{{t('Are you sure you want to remove these users?')}}"},style:{marginRight:8}}},create:{type:"void",title:'{{t("Add users")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2",title:'{{t("Add users")}}',properties:{resource:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-use-decorator-props":"useRoleUsersProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{username:{$includes:""}},{nickname:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useAddRoleUsers","x-component-props":{type:"primary",htmlType:"submit"}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{username:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},phone:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{phone:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},email:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}}}}}}}}}}}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{username:{type:"void",title:'{{t("Username")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void",title:'{{t("Nickname")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{remove:{type:"void",title:'{{ t("Remove") }}',"x-component":"Action.Link","x-use-component-props":"useRemoveUser","x-component-props":{confirm:{title:"{{t('Remove user')}}",content:"{{t('Are you sure you want to remove it?')}}"}}}}}}}}}}}}}),N=()=>{var p,c;const t=m.useContext(e.CollectionContext),o=e.useFilterFieldOptions(t.fields),{service:n}=e.useTableBlockContext();return e.useFilterFieldProps({options:o,params:((c=(p=n.state)==null?void 0:p.params)==null?void 0:c[0])||n.params,service:n})},j=()=>{const t=e.useAPIClient(),{role:o}=m.useContext(a.RolesManagerContext),n=e.useCollectionRecordData(),{service:p}=e.useTableBlockContext();return{onClick(){return b(this,null,function*(){yield t.resource("roles.users",o==null?void 0:o.name).remove({values:[n.id]}),p==null||p.refresh()})}}},W=()=>{const{t}=h(),{message:o}=y.App.useApp(),n=e.useAPIClient(),{service:p,field:c}=e.useTableBlockContext(),{role:i}=m.useContext(a.RolesManagerContext);return{onClick(){return b(this,null,function*(){var d;const l=(d=c==null?void 0:c.data)==null?void 0:d.selectedRowKeys;if(!(l!=null&&l.length)){o.warning(t("Please select users"));return}yield n.resource("roles.users",i==null?void 0:i.name).remove({values:l}),c.data.selectedRowKeys=[],p==null||p.refresh()})}}},L=()=>{const{t}=h(),{role:o}=m.useContext(a.RolesManagerContext),{message:n}=y.App.useApp(),p=e.useAPIClient(),{setVisible:c}=e.useActionContext(),{field:i}=e.useTableBlockContext(),{__parent:u}=e.useBlockRequestContext();return{onClick(){return b(this,null,function*(){var f,A;const d=(f=i==null?void 0:i.data)==null?void 0:f.selectedRowKeys;if(!(d!=null&&d.length)){n.warning(t("Please select users"));return}yield p.resource("roles.users",o==null?void 0:o.name).add({values:d}),i.data.selectedRowKeys=[],c(!1),(A=u==null?void 0:u.props)==null||A.service.refresh()})}}},z=t=>{const{role:o}=m.useContext(a.RolesManagerContext);return g(v({},t),{collection:w,action:"listExcludeRole",params:{roleName:o==null?void 0:o.name}})},_=t=>{const{role:o}=m.useContext(a.RolesManagerContext),n=e.useRequest({resource:"roles.users",resourceOf:o==null?void 0:o.name,action:"list"},{ready:!!o});return g(v({},t),{service:n,collection:w,params:{pageSize:50}})},$=e.withDynamicSchemaProps(t=>{const B=t,{showIndex:o,dragSort:n,rowKey:p,fieldNames:c,collection:i,service:u}=B,l=q(B,["showIndex","dragSort","rowKey","fieldNames","collection","service"]),d=x.useField(),{role:f}=m.useContext(a.RolesManagerContext),A=e.useTableBlockParams(t);m.useEffect(()=>{u.run()},[f]);const k=x.useFieldSchema(),{treeTable:S}=(k==null?void 0:k["x-decorator-props"])||{},[T,ae]=m.useState(!!c);let I="children";if(i!=null&&i.tree&&S!==!1){const V=i.fields.find(ce=>ce.treeChildren);V&&(I=V.name),A.tree=!0}const pe=m.useMemo(()=>x.createForm(),[S]);return s.jsx(e.SchemaComponentOptions,{scope:{treeTable:S},children:s.jsx(x.FormContext.Provider,{value:pe,children:s.jsx(e.BlockProvider,g(v({name:t.name||"table"},t),{params:A,runWhenParamsChanged:!0,children:s.jsx(e.FixedBlockWrapper,{children:s.jsx(e.TableBlockContext.Provider,{value:g(v({},l),{field:d,service:u,params:A,showIndex:o,dragSort:n,rowKey:p,expandFlag:T,childrenColumnName:I,setExpandFlag:()=>ae(!T)}),children:s.jsx(e.RenderChildrenWithAssociationFilter,v({},t))})})}))})})}),G=()=>{const{t}=h(),{role:o}=m.useContext(a.RolesManagerContext),n=m.useMemo(()=>K(),[o]);return s.jsx(e.ExtendCollectionsProvider,{collections:[w],children:s.jsx(e.SchemaComponent,{schema:n,components:{RoleUsersTableBlockProvider:$},scope:{useBulkRemoveUsers:W,useRemoveUser:j,useAddRoleUsers:L,useRoleUsersProps:z,useFilterActionProps:N,useRoleUsersServiceProps:_,t}})})},H=()=>{var n,p;const t=e.useCurrentUserContext(),o=((p=(n=t==null?void 0:t.data)==null?void 0:n.data)==null?void 0:p.password)===null;return s.jsx(e.SchemaComponent,{schema:Q,scope:{useSaveCurrentUserValues:J,hideOldPassword:o}})},J=()=>{var u,l;const t=x.useForm(),o=e.useAPIClient(),{message:n}=y.App.useApp(),{t:p}=e.useTranslation(),c=e.useCurrentUserContext(),i=((l=(u=c==null?void 0:c.data)==null?void 0:u.data)==null?void 0:l.password)===null;return{run(){return b(this,null,function*(){yield t.submit(),(yield o.resource("auth").changePassword({values:t.values})).status===200&&(n.success(p("Edited successfully")),i&&c.mutate({data:g(v({},c.data.data),{password:""})})),yield t.reset()})}}},Q={type:"object",properties:{[C.uid()]:{type:"void","x-component":"CardItem","x-decorator":"Form",title:'{{t("Change password")}}',properties:{action:{type:"void",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",style:{left:"96%"},useAction:"{{ useSaveCurrentUserValues }}"}}}},oldPassword:{type:"string",title:'{{t("Old password")}}',required:!0,"x-component":"Password","x-decorator":"FormItem","x-hidden":"{{ hideOldPassword }}"},newPassword:{type:"string",title:'{{t("New password")}}',required:!0,"x-component":"Password","x-decorator":"FormItem","x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirmPassword"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirmPassword:{type:"string",required:!0,title:'{{t("Confirm password")}}',"x-component":"Password","x-decorator":"FormItem","x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".newPassword"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]}}}}},X=()=>s.jsx(e.SchemaComponent,{schema:ee,scope:{useCurrentUserValues:Y,useSaveCurrentUserValues:Z}}),Y=t=>{const o=e.useCurrentUserContext();return e.useRequest(()=>Promise.resolve(o.data),t)},Z=()=>{const t=e.useCurrentUserContext(),o=x.useForm(),n=e.useAPIClient(),{message:p}=y.App.useApp(),{t:c}=e.useTranslation();return{run(){return b(this,null,function*(){var d;const u=yield o.submit();(yield n.resource("users").updateProfile({values:u})).status===200&&p.success(c("Edited successfully")),t.mutate({data:v(v({},(d=t==null?void 0:t.data)==null?void 0:d.data),u)})})}}},ee={type:"object",properties:{[C.uid()]:{type:"void","x-component":"CardItem","x-decorator":"Form","x-decorator-props":{useValues:"{{useCurrentUserValues}}"},title:'{{t("Edit profile")}}',properties:{action:{type:"void",properties:{submit:{title:"Submit","x-component":"Action","x-component-props":{type:"primary",style:{left:"96%"},useAction:"{{ useSaveCurrentUserValues }}"}}}},nickname:{type:"string",title:"{{t('Nickname')}}","x-decorator":"FormItem","x-component":"Input"},username:{type:"string",title:'{{t("Username")}}',"x-decorator":"FormItem","x-component":"Input","x-validator":{username:!0},required:!0},email:{type:"string",title:'{{t("Email")}}',"x-decorator":"FormItem","x-component":"Input","x-validator":"email"},phone:{type:"string",title:'{{t("Phone")}}',"x-decorator":"FormItem","x-component":"Input","x-validator":"phone"}}}}},oe=(t=10)=>{const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n="abcdefghijklmnopqrstuvwxyz",p="0123456789",c="!#$%^&*-_+=",i=o+n+p+c,u=new Uint32Array(t);crypto.getRandomValues(u);let l="";l+=o.charAt(u[0]%o.length),l+=n.charAt(u[1]%n.length),l+=p.charAt(u[2]%p.length),l+=c.charAt(u[3]%c.length);for(let d=4;d<t;d++){const f=u[d]%i.length;l+=i.charAt(f)}return l=l[0]+l.slice(1).split("").sort(()=>Math.random()-.5).join(""),l},te=()=>{const{t}=h(),o=x.useField(),[n,p]=m.useState(!1),c=e.useActionContext();return m.useEffect(()=>{c.visible||o.reset()},[o,c.visible]),s.jsxs(y.Row,{gutter:10,children:[s.jsx(y.Col,{span:18,children:s.jsx(e.Password,{checkStrength:!0,visibilityToggle:{visible:n,onVisibleChange:p},value:o.value,onChange:i=>o.setValue(i.target.value),autoComplete:"off"})}),s.jsx(y.Col,{span:4,children:s.jsx(y.Button,{onClick:()=>{o.setValue(oe()),p(!0)},children:t("Random password")})})]})},re=()=>{const{t}=h();return(x.useField().value||[]).map(n=>s.jsx(y.Tag,{children:x.Schema.compile(n.title,{t})},n.name))},ne=()=>{const{t}=h(),o=e.useSchemaComponentContext();return s.jsx(e.SchemaComponentContext.Provider,{value:g(v({},o),{designable:!1}),children:s.jsx(e.SchemaComponent,{schema:R,scope:{t},components:{UserRolesField:re,PasswordField:te}})})};class se extends e.Plugin{load(){return b(this,null,function*(){this.app.systemSettingsManager.add("id-auth.users",{title:e.tval("Users"),icon:"UserOutlined",Component:ne,aclSnippet:"pm.users"}),this.userSettingsManager.add("user-change-password",{icon:"LockOutlined",title:e.tval("Change password"),Component:H}),this.userSettingsManager.add("user-profile",{icon:"UserOutlined",title:e.tval("Edit profile"),Component:X}),this.app.pm.get(a).rolesManager.add("users",{title:e.tval("Users"),Component:G})})}}r.default=se,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.3.
|
|
4
|
-
"@tachybase/schema": "1.3.
|
|
3
|
+
"@tachybase/client": "1.3.18",
|
|
4
|
+
"@tachybase/schema": "1.3.18",
|
|
5
5
|
"antd": "5.22.5",
|
|
6
|
-
"@tachybase/module-acl": "1.3.
|
|
7
|
-
"@tachybase/utils": "1.3.
|
|
6
|
+
"@tachybase/module-acl": "1.3.18",
|
|
7
|
+
"@tachybase/utils": "1.3.18",
|
|
8
8
|
"react-i18next": "15.2.0",
|
|
9
|
-
"@tachybase/cache": "1.3.
|
|
10
|
-
"@tachybase/database": "1.3.
|
|
11
|
-
"@tachybase/server": "1.3.
|
|
12
|
-
"@tachybase/actions": "1.3.
|
|
9
|
+
"@tachybase/cache": "1.3.18",
|
|
10
|
+
"@tachybase/database": "1.3.18",
|
|
11
|
+
"@tachybase/server": "1.3.18",
|
|
12
|
+
"@tachybase/actions": "1.3.18"
|
|
13
13
|
};
|
package/dist/index.js
CHANGED
|
@@ -26,12 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
31
|
default: () => import_server.default
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
__reExport(
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
__reExport(index_exports, require("./server"), module.exports);
|
|
35
35
|
var import_server = __toESM(require("./server"));
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-user",
|
|
3
3
|
"displayName": "Users",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.18",
|
|
5
5
|
"description": "Provides basic user model, as well as created by and updated by fields.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Users & permissions"
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
"antd": "5.22.5",
|
|
15
15
|
"jsonwebtoken": "^8.5.1",
|
|
16
16
|
"react-i18next": "^15.2.0",
|
|
17
|
-
"@tachybase/schema": "1.3.
|
|
17
|
+
"@tachybase/schema": "1.3.18"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@tachybase/actions": "1.3.
|
|
21
|
-
"@tachybase/cache": "1.3.
|
|
22
|
-
"@tachybase/client": "1.3.
|
|
23
|
-
"@tachybase/
|
|
24
|
-
"@tachybase/
|
|
25
|
-
"@tachybase/module-auth": "1.3.
|
|
26
|
-
"@tachybase/resourcer": "1.3.
|
|
27
|
-
"@tachybase/server": "1.3.
|
|
28
|
-
"@tachybase/test": "1.3.
|
|
29
|
-
"@tachybase/utils": "1.3.
|
|
20
|
+
"@tachybase/actions": "1.3.18",
|
|
21
|
+
"@tachybase/cache": "1.3.18",
|
|
22
|
+
"@tachybase/client": "1.3.18",
|
|
23
|
+
"@tachybase/database": "1.3.18",
|
|
24
|
+
"@tachybase/module-acl": "1.3.18",
|
|
25
|
+
"@tachybase/module-auth": "1.3.18",
|
|
26
|
+
"@tachybase/resourcer": "1.3.18",
|
|
27
|
+
"@tachybase/server": "1.3.18",
|
|
28
|
+
"@tachybase/test": "1.3.18",
|
|
29
|
+
"@tachybase/utils": "1.3.18"
|
|
30
30
|
},
|
|
31
31
|
"description.zh-CN": "提供了基础的用户模型,以及创建人和最后更新人字段。",
|
|
32
32
|
"displayName.zh-CN": "用户",
|