@tachybase/module-user 1.3.25 → 1.5.0

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.
@@ -0,0 +1 @@
1
+ export declare const UserNicknameField: import("react").MemoExoticComponent<import("@tachybase/schema").ReactFC<unknown>>;
@@ -0,0 +1 @@
1
+ export declare const UserStatusField: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const UserStatusHistories: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const UserStatusManagement: () => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,8 @@
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("@tego/client")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-acl/client","react/jsx-runtime","react","@tachybase/schema","antd","react-i18next","@tego/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["@tego/client"]))})(this,function(r,e,p,s,m,x,y,k,h){"use strict";var pe=Object.defineProperty,ie=Object.defineProperties;var ce=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var U=(r,e,p)=>e in r?pe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:p}):r[e]=p,v=(r,e)=>{for(var p in e||(e={}))E.call(e,p)&&U(r,p,e[p]);if(S)for(var p of S(e))q.call(e,p)&&U(r,p,e[p]);return r},b=(r,e)=>ie(r,ce(e));var M=(r,e)=>{var p={};for(var s in r)E.call(r,s)&&e.indexOf(s)<0&&(p[s]=r[s]);if(r!=null&&S)for(var s of S(r))e.indexOf(s)<0&&q.call(r,s)&&(p[s]=r[s]);return p};var w=(r,e,p)=>new Promise((s,m)=>{var x=h=>{try{k(p.next(h))}catch(C){m(C)}},y=h=>{try{k(p.throw(h))}catch(C){m(C)}},k=h=>h.done?s(h.value):Promise.resolve(h.value).then(x,y);k((p=p.apply(r,e)).next())});function C(){return k.useTranslation(["user","core"],{nsMode:"fallback"})}const F={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"}}}}]},D={type:"void",properties:{block1:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:F,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:F},"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:F,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?')}}"}}}}}}}}}}}}},N=()=>({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?')}}"}}}}}}}}}}}}}),O=()=>{var a,i;const o=m.useContext(e.CollectionContext),t=e.useFilterFieldOptions(o.fields),{service:n}=e.useTableBlockContext();return e.useFilterFieldProps({options:t,params:((i=(a=n.state)==null?void 0:a.params)==null?void 0:i[0])||n.params,service:n})},R=()=>{const o=e.useAPIClient(),{role:t}=m.useContext(p.RolesManagerContext),n=e.useCollectionRecordData(),{service:a}=e.useTableBlockContext();return{onClick(){return w(this,null,function*(){yield o.resource("roles.users",t==null?void 0:t.name).remove({values:[n.id]}),a==null||a.refresh()})}}},K=()=>{const{t:o}=C(),{message:t}=y.App.useApp(),n=e.useAPIClient(),{service:a,field:i}=e.useTableBlockContext(),{role:d}=m.useContext(p.RolesManagerContext);return{onClick(){return w(this,null,function*(){var u;const l=(u=i==null?void 0:i.data)==null?void 0:u.selectedRowKeys;if(!(l!=null&&l.length)){t.warning(o("Please select users"));return}yield n.resource("roles.users",d==null?void 0:d.name).remove({values:l}),i.data.selectedRowKeys=[],a==null||a.refresh()})}}},$=()=>{const{t:o}=C(),{role:t}=m.useContext(p.RolesManagerContext),{message:n}=y.App.useApp(),a=e.useAPIClient(),{setVisible:i}=e.useActionContext(),{field:d}=e.useTableBlockContext(),{__parent:c}=e.useBlockRequestContext();return{onClick(){return w(this,null,function*(){var f,g;const u=(f=d==null?void 0:d.data)==null?void 0:f.selectedRowKeys;if(!(u!=null&&u.length)){n.warning(o("Please select users"));return}yield a.resource("roles.users",t==null?void 0:t.name).add({values:u}),d.data.selectedRowKeys=[],i(!1),(g=c==null?void 0:c.props)==null||g.service.refresh()})}}},j=o=>{const{role:t}=m.useContext(p.RolesManagerContext);return b(v({},o),{collection:F,action:"listExcludeRole",params:{roleName:t==null?void 0:t.name}})},W=o=>{const{role:t}=m.useContext(p.RolesManagerContext),n=e.useRequest({resource:"roles.users",resourceOf:t==null?void 0:t.name,action:"list"},{ready:!!t});return b(v({},o),{service:n,collection:F,params:{pageSize:50}})},L=e.withDynamicSchemaProps(o=>{const T=o,{showIndex:t,dragSort:n,rowKey:a,fieldNames:i,collection:d,service:c}=T,l=M(T,["showIndex","dragSort","rowKey","fieldNames","collection","service"]),u=x.useField(),{role:f}=m.useContext(p.RolesManagerContext),g=e.useTableBlockParams(o);m.useEffect(()=>{c.run()},[f]);const P=x.useFieldSchema(),{treeTable:A}=(P==null?void 0:P["x-decorator-props"])||{},[V,ne]=m.useState(!!i);let I="children";if(d!=null&&d.tree&&A!==!1){const B=d.fields.find(ae=>ae.treeChildren);B&&(I=B.name),g.tree=!0}const se=m.useMemo(()=>x.createForm(),[A]);return s.jsx(e.SchemaComponentOptions,{scope:{treeTable:A},children:s.jsx(x.FormContext.Provider,{value:se,children:s.jsx(e.BlockProvider,b(v({name:o.name||"table"},o),{params:g,runWhenParamsChanged:!0,children:s.jsx(e.FixedBlockWrapper,{children:s.jsx(e.TableBlockContext.Provider,{value:b(v({},l),{field:u,service:c,params:g,showIndex:t,dragSort:n,rowKey:a,expandFlag:V,childrenColumnName:I,setExpandFlag:()=>ne(!V)}),children:s.jsx(e.RenderChildrenWithAssociationFilter,v({},o))})})}))})})}),z=()=>{const{t:o}=C(),{role:t}=m.useContext(p.RolesManagerContext),n=m.useMemo(()=>N(),[t]);return s.jsx(e.ExtendCollectionsProvider,{collections:[F],children:s.jsx(e.SchemaComponent,{schema:n,components:{RoleUsersTableBlockProvider:L},scope:{useBulkRemoveUsers:K,useRemoveUser:R,useAddRoleUsers:$,useRoleUsersProps:j,useFilterActionProps:O,useRoleUsersServiceProps:W,t:o}})})},G=()=>{var f,g,P,A;const o=e.useCurrentUserContext(),t=e.useApp().pluginManager,n=t.get("@tachybase/plugin-otp"),a=t.get("@tachybase/plugin-auth-sms"),i=!!n&&!!a,d=((g=(f=o==null?void 0:o.data)==null?void 0:f.data)==null?void 0:g.password)!==null,c=(A=(P=o==null?void 0:o.data)==null?void 0:P.data)==null?void 0:A.phone,{t:l}=e.useTranslation(),u=c?l("Send verification code to phone: {{phoneNumber}}",{phoneNumber:c}):l("Please fill in your mobile phone number in your personal information first");return s.jsx(e.SchemaComponent,{schema:J,scope:{useSaveCurrentUserValues:H,oldPassword:d,codeDescription:u,phoneNumber:c,smsVerifyEnabled:i},components:{VerificationCode:e.VerificationCode}})},H=()=>{var c,l;const o=x.useForm(),t=e.useAPIClient(),{message:n}=y.App.useApp(),{t:a}=e.useTranslation(),i=e.useCurrentUserContext(),d=((l=(c=i==null?void 0:i.data)==null?void 0:c.data)==null?void 0:l.password)===null;return{run(){return w(this,null,function*(){yield o.submit(),(yield t.resource("auth").changePassword({values:o.values})).status===200&&(n.success(a("Edited successfully")),d&&i.mutate({data:b(v({},i.data.data),{password:""})})),yield o.reset()})}}},J={type:"object",properties:{[h.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 }}"}}}},verifyMethod:{type:"string",required:!0,title:'{{t("Verify method")}}',enum:[{label:'{{t("Use old password")}}',value:"password"},{label:'{{t("Use verification code")}}',value:"code"}],"x-component":"Radio.Group","x-decorator":"FormItem","x-reactions":[{dependencies:[".phoneExist",".oldPasswordExist"],fulfill:{state:{hidden:"{{ !($deps[0] && $deps[1] && smsVerifyEnabled) }}",value:"{{ undefined }}"}}}]},phoneExist:{type:"boolean",default:"{{ !!phoneNumber }}","x-hidden":!0},phone:{type:"string",title:'{{t("Phone")}}',default:"{{ phoneNumber }}","x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-hidden":!0},code:{type:"string",title:'{{t("Verification code")}}',description:"{{codeDescription}}","x-component":"VerificationCode","x-component-props":{actionType:"auth:changePassword",targetFieldName:"phone"},required:!0,"x-decorator":"FormItem","x-reactions":[{dependencies:[".verifyMethod",".phoneExist"],fulfill:{state:{hidden:`{{
1
+ (function(a,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("@tego/client")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-acl/client","react/jsx-runtime","react","@tachybase/schema","antd","react-i18next","@tego/client"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a["@tachybase/module-user"]={},a["@tachybase/client"],a["@tachybase/module-acl"],a.jsxRuntime,a.react,a["@tachybase/schema"],a.antd,a["react-i18next"],a["@tego/client"]))})(this,function(a,e,i,r,d,x,y,w,h){"use strict";var xe=Object.defineProperty,ye=Object.defineProperties;var Ce=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var E=(a,e,i)=>e in a?xe(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i,f=(a,e)=>{for(var i in e||(e={}))M.call(e,i)&&E(a,i,e[i]);if(P)for(var i of P(e))q.call(e,i)&&E(a,i,e[i]);return a},b=(a,e)=>ye(a,Ce(e));var N=(a,e)=>{var i={};for(var r in a)M.call(a,r)&&e.indexOf(r)<0&&(i[r]=a[r]);if(a!=null&&P)for(var r of P(a))e.indexOf(r)<0&&q.call(a,r)&&(i[r]=a[r]);return i};var F=(a,e,i)=>new Promise((r,d)=>{var x=h=>{try{w(i.next(h))}catch(C){d(C)}},y=h=>{try{w(i.throw(h))}catch(C){d(C)}},w=h=>h.done?r(h.value):Promise.resolve(h.value).then(x,y);w((i=i.apply(a,e)).next())});function C(){return w.useTranslation(["user","core"],{nsMode:"fallback"})}const S={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"}}}},{interface:"m2o",type:"belongsTo",name:"statusInfo",target:"userStatuses",foreignKey:"status",targetKey:"key",uiSchema:{type:"object",title:'{{t("Status")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"title",value:"key"}}}},{interface:"m2o",type:"belongsTo",name:"previousStatusInfo",target:"userStatuses",foreignKey:"previousStatus",targetKey:"key",uiSchema:{type:"object",title:'{{t("Previous Status")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"title",value:"key"}}}},{interface:"datetime",type:"date",name:"statusExpireAt",uiSchema:{type:"datetime",title:'{{t("Status Expire At")}}',"x-component":"DatePicker","x-component-props":{showTime:!0}}},{interface:"select",type:"string",name:"previousStatus",uiSchema:{type:"string",title:'{{t("Previous Status")}}',"x-component":"Select","x-component-props":{fieldNames:{label:"title",value:"key"}}}},{interface:"textarea",type:"text",name:"statusReason",uiSchema:{type:"string",title:'{{t("Status Reason")}}',"x-component":"Input.TextArea"}}]},K={type:"void",properties:{block1:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:S,action:"list",params:{pageSize:50,appends:["roles","statusInfo","previousStatusInfo"]}},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:S},"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"},statusInfo:{"x-component":"CollectionField","x-collection-field":"users.statusInfo","x-decorator":"FormItem",required:!0},statusExpireAt:{"x-component":"CollectionField","x-collection-field":"users.statusExpireAt","x-decorator":"FormItem"},statusReason:{"x-component":"CollectionField","x-collection-field":"users.statusReason","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"}}},column4_5:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("Status")}}',properties:{statusInfo:{type:"object","x-component":"UserStatusField"}}},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",params:{appends:["statusInfo","previousStatusInfo"]}},"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"},statusInfo:{"x-component":"CollectionField","x-collection-field":"users.statusInfo","x-decorator":"FormItem",required:!0},statusExpireAt:{"x-component":"CollectionField","x-collection-field":"users.statusExpireAt","x-decorator":"FormItem"},previousStatusInfo:{"x-component":"CollectionField","x-collection-field":"users.previousStatusInfo","x-decorator":"FormItem","x-disabled":!0},statusReason:{"x-component":"CollectionField","x-collection-field":"users.statusReason","x-decorator":"FormItem"}}}}},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:S,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?')}}"}}}}}}}}}}}}}),j=()=>{var s,p;const o=d.useContext(e.CollectionContext),t=e.useFilterFieldOptions(o.fields),{service:n}=e.useTableBlockContext();return e.useFilterFieldProps({options:t,params:((p=(s=n.state)==null?void 0:s.params)==null?void 0:p[0])||n.params,service:n})},R=()=>{const o=e.useAPIClient(),{role:t}=d.useContext(i.RolesManagerContext),n=e.useCollectionRecordData(),{service:s}=e.useTableBlockContext();return{onClick(){return F(this,null,function*(){yield o.resource("roles.users",t==null?void 0:t.name).remove({values:[n.id]}),s==null||s.refresh()})}}},L=()=>{const{t:o}=C(),{message:t}=y.App.useApp(),n=e.useAPIClient(),{service:s,field:p}=e.useTableBlockContext(),{role:m}=d.useContext(i.RolesManagerContext);return{onClick(){return F(this,null,function*(){var u;const l=(u=p==null?void 0:p.data)==null?void 0:u.selectedRowKeys;if(!(l!=null&&l.length)){t.warning(o("Please select users"));return}yield n.resource("roles.users",m==null?void 0:m.name).remove({values:l}),p.data.selectedRowKeys=[],s==null||s.refresh()})}}},$=()=>{const{t:o}=C(),{role:t}=d.useContext(i.RolesManagerContext),{message:n}=y.App.useApp(),s=e.useAPIClient(),{setVisible:p}=e.useActionContext(),{field:m}=e.useTableBlockContext(),{__parent:c}=e.useBlockRequestContext();return{onClick(){return F(this,null,function*(){var g,v;const u=(g=m==null?void 0:m.data)==null?void 0:g.selectedRowKeys;if(!(u!=null&&u.length)){n.warning(o("Please select users"));return}yield s.resource("roles.users",t==null?void 0:t.name).add({values:u}),m.data.selectedRowKeys=[],p(!1),(v=c==null?void 0:c.props)==null||v.service.refresh()})}}},H=o=>{const{role:t}=d.useContext(i.RolesManagerContext);return b(f({},o),{collection:S,action:"listExcludeRole",params:{roleName:t==null?void 0:t.name}})},W=o=>{const{role:t}=d.useContext(i.RolesManagerContext),n=e.useRequest({resource:"roles.users",resourceOf:t==null?void 0:t.name,action:"list"},{ready:!!t});return b(f({},o),{service:n,collection:S,params:{pageSize:50}})},z=e.withDynamicSchemaProps(o=>{const D=o,{showIndex:t,dragSort:n,rowKey:s,fieldNames:p,collection:m,service:c}=D,l=N(D,["showIndex","dragSort","rowKey","fieldNames","collection","service"]),u=x.useField(),{role:g}=d.useContext(i.RolesManagerContext),v=e.useTableBlockParams(o);d.useEffect(()=>{c.run()},[g]);const A=x.useFieldSchema(),{treeTable:k}=(A==null?void 0:A["x-decorator-props"])||{},[V,me]=d.useState(!!p);let B="children";if(m!=null&&m.tree&&k!==!1){const U=m.fields.find(de=>de.treeChildren);U&&(B=U.name),v.tree=!0}const ue=d.useMemo(()=>x.createForm(),[k]);return r.jsx(e.SchemaComponentOptions,{scope:{treeTable:k},children:r.jsx(x.FormContext.Provider,{value:ue,children:r.jsx(e.BlockProvider,b(f({name:o.name||"table"},o),{params:v,runWhenParamsChanged:!0,children:r.jsx(e.FixedBlockWrapper,{children:r.jsx(e.TableBlockContext.Provider,{value:b(f({},l),{field:u,service:c,params:v,showIndex:t,dragSort:n,rowKey:s,expandFlag:V,childrenColumnName:B,setExpandFlag:()=>me(!V)}),children:r.jsx(e.RenderChildrenWithAssociationFilter,f({},o))})})}))})})}),G=()=>{const{t:o}=C(),{role:t}=d.useContext(i.RolesManagerContext),n=d.useMemo(()=>O(),[t]);return r.jsx(e.ExtendCollectionsProvider,{collections:[S],children:r.jsx(e.SchemaComponent,{schema:n,components:{RoleUsersTableBlockProvider:z},scope:{useBulkRemoveUsers:L,useRemoveUser:R,useAddRoleUsers:$,useRoleUsersProps:H,useFilterActionProps:j,useRoleUsersServiceProps:W,t:o}})})},_=()=>{var g,v,A,k;const o=e.useCurrentUserContext(),t=e.useApp().pluginManager,n=t.get("@tachybase/plugin-otp"),s=t.get("@tachybase/plugin-auth-sms"),p=!!n&&!!s,m=((v=(g=o==null?void 0:o.data)==null?void 0:g.data)==null?void 0:v.password)!==null,c=(k=(A=o==null?void 0:o.data)==null?void 0:A.data)==null?void 0:k.phone,{t:l}=e.useTranslation(),u=c?l("Send verification code to phone: {{phoneNumber}}",{phoneNumber:c}):l("Please fill in your mobile phone number in your personal information first");return r.jsx(e.SchemaComponent,{schema:Q,scope:{useSaveCurrentUserValues:J,oldPassword:m,codeDescription:u,phoneNumber:c,smsVerifyEnabled:p},components:{VerificationCode:e.VerificationCode}})},J=()=>{var c,l;const o=x.useForm(),t=e.useAPIClient(),{message:n}=y.App.useApp(),{t:s}=e.useTranslation(),p=e.useCurrentUserContext(),m=((l=(c=p==null?void 0:p.data)==null?void 0:c.data)==null?void 0:l.password)===null;return{run(){return F(this,null,function*(){yield o.submit(),(yield t.resource("auth").changePassword({values:o.values})).status===200&&(n.success(s("Edited successfully")),m&&p.mutate({data:b(f({},p.data.data),{password:""})})),yield o.reset()})}}},Q={type:"object",properties:{[h.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 }}"}}}},verifyMethod:{type:"string",required:!0,title:'{{t("Verify method")}}',enum:[{label:'{{t("Use old password")}}',value:"password"},{label:'{{t("Use verification code")}}',value:"code"}],"x-component":"Radio.Group","x-decorator":"FormItem","x-reactions":[{dependencies:[".phoneExist",".oldPasswordExist"],fulfill:{state:{hidden:"{{ !($deps[0] && $deps[1] && smsVerifyEnabled) }}",value:"{{ undefined }}"}}}]},phoneExist:{type:"boolean",default:"{{ !!phoneNumber }}","x-hidden":!0},phone:{type:"string",title:'{{t("Phone")}}',default:"{{ phoneNumber }}","x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-hidden":!0},code:{type:"string",title:'{{t("Verification code")}}',description:"{{codeDescription}}","x-component":"VerificationCode","x-component-props":{actionType:"auth:changePassword",targetFieldName:"phone"},required:!0,"x-decorator":"FormItem","x-reactions":[{dependencies:[".verifyMethod",".phoneExist"],fulfill:{state:{hidden:`{{
2
2
  !$deps[1] ||
3
3
  !smsVerifyEnabled ||
4
4
  ($deps[0] !== 'code' && $deps[0] !== undefined) // 有 verifyMethod 但未选 code
5
5
  }}`}}}]},oldPasswordExist:{type:"boolean",default:"{{ oldPassword }}","x-hidden":!0},oldPassword:{type:"string",title:'{{t("Old password")}}',required:!0,"x-component":"Password","x-decorator":"FormItem","x-reactions":[{dependencies:[".verifyMethod",".oldPasswordExist"],fulfill:{state:{hidden:`{{
6
6
  !$deps[1] ||
7
7
  (smsVerifyEnabled && $deps[0] !== 'password' && $deps[0] !== undefined)
8
- }}`}}}]},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=()=>{const o=e.useApp().pluginManager,t=o.get("@tachybase/plugin-otp"),n=o.get("@tachybase/plugin-auth-sms"),a=!!t&&!!n;return s.jsx(e.SchemaComponent,{schema:Z,scope:{useCurrentUserValues:X,useSaveCurrentUserValues:Y,smsVerifyEnabled:a},components:{VerificationCode:e.VerificationCode}})},X=o=>{const t=e.useCurrentUserContext();return e.useRequest(()=>Promise.resolve(t.data),o)},Y=()=>{const o=e.useCurrentUserContext(),t=x.useForm(),n=e.useAPIClient(),{message:a}=y.App.useApp(),{t:i}=e.useTranslation();return{run(){return w(this,null,function*(){var u;const c=yield t.submit();(yield n.resource("users").updateProfile({values:c})).status===200&&a.success(i("Edited successfully")),o.mutate({data:v(v({},(u=o==null?void 0:o.data)==null?void 0:u.data),c)})})}}},Z={type:"object",properties:{[h.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"},code:{type:"string",title:'{{t("Verification code")}}',"x-component":"VerificationCode","x-component-props":{actionType:"users:updateProfile",targetFieldName:"phone"},required:!0,"x-decorator":"FormItem","x-reactions":[{dependencies:[".phone"],fulfill:{state:{hidden:"{{ $deps[0] === $form.initialValues?.phone || !smsVerifyEnabled}}"}}}]}}}}},_=(o=10)=>{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n="abcdefghijklmnopqrstuvwxyz",a="0123456789",i="!#$%^&*-_+=",d=t+n+a+i,c=new Uint32Array(o);crypto.getRandomValues(c);let l="";l+=t.charAt(c[0]%t.length),l+=n.charAt(c[1]%n.length),l+=a.charAt(c[2]%a.length),l+=i.charAt(c[3]%i.length);for(let u=4;u<o;u++){const f=c[u]%d.length;l+=d.charAt(f)}return l=l[0]+l.slice(1).split("").sort(()=>Math.random()-.5).join(""),l},ee=()=>{const{t:o}=C(),t=x.useField(),[n,a]=m.useState(!1),i=e.useActionContext();return m.useEffect(()=>{i.visible||t.reset()},[t,i.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:a},value:t.value,onChange:d=>t.setValue(d.target.value),autoComplete:"off"})}),s.jsx(y.Col,{span:4,children:s.jsx(y.Button,{onClick:()=>{t.setValue(_()),a(!0)},children:o("Random password")})})]})},oe=()=>{const{t:o}=C();return(x.useField().value||[]).map(n=>s.jsx(y.Tag,{children:x.Schema.compile(n.title,{t:o})},n.name))},te=()=>{const{t:o}=C(),t=e.useSchemaComponentContext();return s.jsx(e.SchemaComponentContext.Provider,{value:b(v({},t),{designable:!1}),children:s.jsx(e.SchemaComponent,{schema:D,scope:{t:o},components:{UserRolesField:oe,PasswordField:ee}})})};class re extends e.Plugin{load(){return w(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(p).rolesManager.add("users",{title:e.tval("Users"),Component:z})})}}r.default=re,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
8
+ }}`}}}]},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=()=>{const o=e.useApp().pluginManager,t=o.get("@tachybase/plugin-otp"),n=o.get("@tachybase/plugin-auth-sms"),s=!!t&&!!n;return r.jsx(e.SchemaComponent,{schema:ee,scope:{useCurrentUserValues:Y,useSaveCurrentUserValues:Z,smsVerifyEnabled:s},components:{VerificationCode:e.VerificationCode}})},Y=o=>{const t=e.useCurrentUserContext();return e.useRequest(()=>Promise.resolve(t.data),o)},Z=()=>{const o=e.useCurrentUserContext(),t=x.useForm(),n=e.useAPIClient(),{message:s}=y.App.useApp(),{t:p}=e.useTranslation();return{run(){return F(this,null,function*(){var u;const c=yield t.submit();(yield n.resource("users").updateProfile({values:c})).status===200&&s.success(p("Edited successfully")),o.mutate({data:f(f({},(u=o==null?void 0:o.data)==null?void 0:u.data),c)})})}}},ee={type:"object",properties:{[h.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"},code:{type:"string",title:'{{t("Verification code")}}',"x-component":"VerificationCode","x-component-props":{actionType:"users:updateProfile",targetFieldName:"phone"},required:!0,"x-decorator":"FormItem","x-reactions":[{dependencies:[".phone"],fulfill:{state:{hidden:"{{ $deps[0] === $form.initialValues?.phone || !smsVerifyEnabled}}"}}}]}}}}},te=(o=10)=>{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n="abcdefghijklmnopqrstuvwxyz",s="0123456789",p="!#$%^&*-_+=",m=t+n+s+p,c=new Uint32Array(o);crypto.getRandomValues(c);let l="";l+=t.charAt(c[0]%t.length),l+=n.charAt(c[1]%n.length),l+=s.charAt(c[2]%s.length),l+=p.charAt(c[3]%p.length);for(let u=4;u<o;u++){const g=c[u]%m.length;l+=m.charAt(g)}return l=l[0]+l.slice(1).split("").sort(()=>Math.random()-.5).join(""),l},oe=()=>{const{t:o}=C(),t=x.useField(),[n,s]=d.useState(!1),p=e.useActionContext();return d.useEffect(()=>{p.visible||t.reset()},[t,p.visible]),r.jsxs(y.Row,{gutter:10,children:[r.jsx(y.Col,{span:18,children:r.jsx(e.Password,{checkStrength:!0,visibilityToggle:{visible:n,onVisibleChange:s},value:t.value,onChange:m=>t.setValue(m.target.value),autoComplete:"off"})}),r.jsx(y.Col,{span:4,children:r.jsx(y.Button,{onClick:()=>{t.setValue(te()),s(!0)},children:o("Random password")})})]})},re=()=>{const{t:o}=C();return(x.useField().value||[]).map(n=>r.jsx(y.Tag,{children:x.Schema.compile(n.title,{t:o})},n.name))},T=()=>{const o=e.useRecord();e.useCollectionField();const t=e.useCompile(),n=x.useFieldSchema();let s=o==null?void 0:o.statusInfo;if(!s&&(n!=null&&n.name)&&(s=o==null?void 0:o[n.name]),!s)return r.jsx("span",{children:"-"});const p=t(s.title||s.key);return r.jsx(y.Tag,{color:s.color||"default",children:p})},ne=()=>{const{t:o}=C(),t=e.useSchemaComponentContext();return r.jsx(e.SchemaComponentContext.Provider,{value:b(f({},t),{designable:!1}),children:r.jsx(e.SchemaComponent,{schema:K,scope:{t:o},components:{UserRolesField:re,PasswordField:oe,UserStatusField:T}})})},se={type:"void",properties:{userStatusHistoriesBlock:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:{name:"userStatusHistories",fields:[{name:"id",type:"bigInt",primaryKey:!0,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"user",target:"users",foreignKey:"userId",uiSchema:{type:"object",title:'{{t("User")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"nickname",value:"id"}}}},{interface:"m2o",type:"belongsTo",name:"fromStatusInfo",target:"userStatuses",foreignKey:"fromStatus",targetKey:"key",uiSchema:{type:"object",title:'{{t("From Status")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"title",value:"key"}}}},{interface:"m2o",type:"belongsTo",name:"toStatusInfo",target:"userStatuses",foreignKey:"toStatus",targetKey:"key",uiSchema:{type:"object",title:'{{t("To Status")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"title",value:"key"}}}},{interface:"input",type:"string",name:"fromStatus",uiSchema:{type:"string",title:'{{t("From Status")}}',"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"toStatus",uiSchema:{type:"string",title:'{{t("To Status")}}',"x-component":"Input","x-read-pretty":!0}},{interface:"textarea",type:"text",name:"reason",uiSchema:{type:"string",title:'{{t("Reason")}}',"x-component":"Input.TextArea","x-read-pretty":!0}},{interface:"select",type:"string",name:"operationType",uiSchema:{type:"string",title:'{{t("Operation Type")}}',"x-component":"Select",enum:[{label:'{{t("Manual")}}',value:"manual"},{label:'{{t("Auto")}}',value:"auto"},{label:'{{t("System")}}',value:"system"}],"x-read-pretty":!0}},{interface:"datetime",type:"date",name:"expireAt",uiSchema:{type:"string",title:'{{t("Expire At")}}',"x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"createdBy",target:"users",foreignKey:"createdById",uiSchema:{type:"object",title:'{{t("Created By")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"nickname",value:"id"}}}},{interface:"createdAt",type:"date",name:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created At")}}',"x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0}}]},action:"list",params:{pageSize:50,sort:["-createdAt"],appends:["user","createdBy","fromStatusInfo","toStatusInfo"]}},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"}}},table:{type:"array","x-uid":"userStatusHistoriesTable","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id"},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("User")}}',properties:{user:{type:"object","x-component":"UserNicknameField"}}},column2:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("From Status")}}',properties:{fromStatusInfo:{type:"object","x-component":"UserStatusField"}}},column3:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("To Status")}}',properties:{toStatusInfo:{type:"object","x-component":"UserStatusField"}}},column4:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{reason:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column5:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{operationType:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column6:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{expireAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column7:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("Created By")}}',properties:{createdBy:{type:"object","x-component":"UserNicknameField"}}},column8:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{createdAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}}}}}}}},ae=x.observer(()=>{const o=x.useField(),t=o==null?void 0:o.value;return t!=null&&t.nickname?r.jsx("span",{children:t.nickname}):t!=null&&t.username?r.jsx("span",{children:t.username}):(t==null?void 0:t.id)!==void 0?r.jsx("span",{children:t.id}):r.jsx("span",{children:"-"})},{displayName:"UserNicknameField"}),pe=()=>{const{t:o}=C(),t=e.useSchemaComponentContext();return r.jsx(e.SchemaComponentContext.Provider,{value:b(f({},t),{designable:!1}),children:r.jsx(e.SchemaComponent,{schema:se,scope:{t:o},components:{UserStatusField:T,UserNicknameField:ae}})})},I={name:"userStatuses",fields:[{name:"key",type:"string",primaryKey:!0,allowNull:!1,unique:!0,uiSchema:{type:"string",title:'{{t("Status Key")}}',"x-component":"Input",required:!0}},{name:"title",type:"string",allowNull:!1,uiSchema:{type:"string",title:'{{t("Status Title")}}',"x-component":"Input",required:!0}},{name:"color",type:"string",uiSchema:{type:"string",title:'{{t("Color")}}',"x-component":"ColorPicker"}},{name:"allowLogin",type:"boolean",defaultValue:!0,uiSchema:{type:"boolean",title:'{{t("Allow Login")}}',"x-component":"Checkbox"}},{name:"loginErrorMessage",type:"text",uiSchema:{type:"string",title:'{{t("Login Error Message")}}',"x-component":"Input.TextArea"}},{name:"isSystemDefined",type:"boolean",defaultValue:!1,uiSchema:{type:"boolean",title:'{{t("System Defined")}}',"x-component":"Checkbox","x-read-pretty":!0}},{name:"sort",type:"integer",defaultValue:0,uiSchema:{type:"number",title:'{{t("Sort")}}',"x-component":"InputNumber"}},{name:"packageName",type:"string",uiSchema:{type:"string",title:'{{t("Package Name")}}',"x-component":"Input","x-read-pretty":!0}},{name:"description",type:"text",uiSchema:{type:"string",title:'{{t("Description")}}',"x-component":"Input.TextArea"}}]},ie={type:"void",properties:{userStatusesBlock:{type:"void","x-decorator":"TableBlockProvider","x-component":"CardItem","x-decorator-props":{collection:I,action:"list",params:{pageSize:50,sort:["sort"]}},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 statuses')}}",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 status") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{body:{type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"userStatuses:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:I},"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}}}},key:{"x-component":"CollectionField","x-decorator":"FormItem",required:!0},title:{"x-component":"CollectionField","x-decorator":"FormItem",required:!0},color:{"x-component":"CollectionField","x-decorator":"FormItem"},allowLogin:{"x-component":"CollectionField","x-decorator":"FormItem"},loginErrorMessage:{"x-component":"CollectionField","x-decorator":"FormItem"},sort:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"}}}}}}}}}}},table:{type:"array","x-uid":"userStatusesTable","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"key",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{color:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{allowLogin:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},column5:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{isSystemDefined:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},column6:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{sort:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column7:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space",properties:{update:{type:"void",title:'{{t("Edit")}}',"x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"userStatuses:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:"userStatuses"},"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 status")}}',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"}}}},key:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},title:{"x-component":"CollectionField","x-decorator":"FormItem",required:!0},color:{"x-component":"CollectionField","x-decorator":"FormItem"},allowLogin:{"x-component":"CollectionField","x-decorator":"FormItem"},loginErrorMessage:{"x-component":"CollectionField","x-decorator":"FormItem"},sort:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-acl-action":"userStatuses: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?')}}"}}}}}}}}}}}}},ce=()=>{const{t:o}=C(),t=e.useSchemaComponentContext();return r.jsx(e.SchemaComponentContext.Provider,{value:b(f({},t),{designable:!1}),children:r.jsx(e.SchemaComponent,{schema:ie,scope:{t:o}})})};class le extends e.Plugin{load(){return F(this,null,function*(){this.app.systemSettingsManager.add("id-auth.users",{title:e.tval("Users"),icon:"UserOutlined",Component:ne,aclSnippet:"pm.users"}),this.app.systemSettingsManager.add("id-auth.user-statuses",{title:e.tval("User Statuses"),icon:"TagOutlined",Component:ce,aclSnippet:"pm.users.statuses",sort:8}),this.app.systemSettingsManager.add("id-auth.user-status-histories",{title:e.tval("User Status Histories"),icon:"HistoryOutlined",Component:pe,aclSnippet:"pm.users.statuses",sort:9}),this.userSettingsManager.add("user-change-password",{icon:"LockOutlined",title:e.tval("Change password"),Component:_}),this.userSettingsManager.add("user-profile",{icon:"UserOutlined",title:e.tval("Edit profile"),Component:X}),this.app.pm.get(i).rolesManager.add("users",{title:e.tval("Users"),Component:G})})}}a.default=le,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1 +1 @@
1
- export declare function useUsersTranslation(): import("react-i18next").UseTranslationResponse<[string, string], undefined>;
1
+ export declare function useUsersTranslation(): import("react-i18next").UseTranslationResponse<readonly ["user", "core"], undefined>;
@@ -0,0 +1,120 @@
1
+ import { ISchema } from '@tachybase/schema';
2
+ export declare const userStatusHistoriesCollection: {
3
+ name: string;
4
+ fields: ({
5
+ name: string;
6
+ type: string;
7
+ primaryKey: boolean;
8
+ uiSchema: {
9
+ type: string;
10
+ title: string;
11
+ 'x-component': string;
12
+ 'x-read-pretty': boolean;
13
+ 'x-component-props'?: undefined;
14
+ enum?: undefined;
15
+ };
16
+ interface?: undefined;
17
+ target?: undefined;
18
+ foreignKey?: undefined;
19
+ targetKey?: undefined;
20
+ } | {
21
+ interface: string;
22
+ type: string;
23
+ name: string;
24
+ target: string;
25
+ foreignKey: string;
26
+ uiSchema: {
27
+ type: string;
28
+ title: string;
29
+ 'x-component': string;
30
+ 'x-component-props': {
31
+ fieldNames: {
32
+ label: string;
33
+ value: string;
34
+ };
35
+ showTime?: undefined;
36
+ };
37
+ 'x-read-pretty'?: undefined;
38
+ enum?: undefined;
39
+ };
40
+ primaryKey?: undefined;
41
+ targetKey?: undefined;
42
+ } | {
43
+ interface: string;
44
+ type: string;
45
+ name: string;
46
+ target: string;
47
+ foreignKey: string;
48
+ targetKey: string;
49
+ uiSchema: {
50
+ type: string;
51
+ title: string;
52
+ 'x-component': string;
53
+ 'x-component-props': {
54
+ fieldNames: {
55
+ label: string;
56
+ value: string;
57
+ };
58
+ showTime?: undefined;
59
+ };
60
+ 'x-read-pretty'?: undefined;
61
+ enum?: undefined;
62
+ };
63
+ primaryKey?: undefined;
64
+ } | {
65
+ interface: string;
66
+ type: string;
67
+ name: string;
68
+ uiSchema: {
69
+ type: string;
70
+ title: string;
71
+ 'x-component': string;
72
+ 'x-read-pretty': boolean;
73
+ 'x-component-props'?: undefined;
74
+ enum?: undefined;
75
+ };
76
+ primaryKey?: undefined;
77
+ target?: undefined;
78
+ foreignKey?: undefined;
79
+ targetKey?: undefined;
80
+ } | {
81
+ interface: string;
82
+ type: string;
83
+ name: string;
84
+ uiSchema: {
85
+ type: string;
86
+ title: string;
87
+ 'x-component': string;
88
+ enum: {
89
+ label: string;
90
+ value: string;
91
+ }[];
92
+ 'x-read-pretty': boolean;
93
+ 'x-component-props'?: undefined;
94
+ };
95
+ primaryKey?: undefined;
96
+ target?: undefined;
97
+ foreignKey?: undefined;
98
+ targetKey?: undefined;
99
+ } | {
100
+ interface: string;
101
+ type: string;
102
+ name: string;
103
+ uiSchema: {
104
+ type: string;
105
+ title: string;
106
+ 'x-component': string;
107
+ 'x-component-props': {
108
+ showTime: boolean;
109
+ fieldNames?: undefined;
110
+ };
111
+ 'x-read-pretty': boolean;
112
+ enum?: undefined;
113
+ };
114
+ primaryKey?: undefined;
115
+ target?: undefined;
116
+ foreignKey?: undefined;
117
+ targetKey?: undefined;
118
+ })[];
119
+ };
120
+ export declare const userStatusHistoriesSchema: ISchema;
@@ -0,0 +1,104 @@
1
+ import { ISchema } from '@tachybase/schema';
2
+ export declare const userStatusCollection: {
3
+ name: string;
4
+ fields: ({
5
+ name: string;
6
+ type: string;
7
+ primaryKey: boolean;
8
+ allowNull: boolean;
9
+ unique: boolean;
10
+ uiSchema: {
11
+ type: string;
12
+ title: string;
13
+ 'x-component': string;
14
+ required: boolean;
15
+ 'x-read-pretty'?: undefined;
16
+ };
17
+ defaultValue?: undefined;
18
+ } | {
19
+ name: string;
20
+ type: string;
21
+ allowNull: boolean;
22
+ uiSchema: {
23
+ type: string;
24
+ title: string;
25
+ 'x-component': string;
26
+ required: boolean;
27
+ 'x-read-pretty'?: undefined;
28
+ };
29
+ primaryKey?: undefined;
30
+ unique?: undefined;
31
+ defaultValue?: undefined;
32
+ } | {
33
+ name: string;
34
+ type: string;
35
+ uiSchema: {
36
+ type: string;
37
+ title: string;
38
+ 'x-component': string;
39
+ required?: undefined;
40
+ 'x-read-pretty'?: undefined;
41
+ };
42
+ primaryKey?: undefined;
43
+ allowNull?: undefined;
44
+ unique?: undefined;
45
+ defaultValue?: undefined;
46
+ } | {
47
+ name: string;
48
+ type: string;
49
+ defaultValue: boolean;
50
+ uiSchema: {
51
+ type: string;
52
+ title: string;
53
+ 'x-component': string;
54
+ required?: undefined;
55
+ 'x-read-pretty'?: undefined;
56
+ };
57
+ primaryKey?: undefined;
58
+ allowNull?: undefined;
59
+ unique?: undefined;
60
+ } | {
61
+ name: string;
62
+ type: string;
63
+ defaultValue: boolean;
64
+ uiSchema: {
65
+ type: string;
66
+ title: string;
67
+ 'x-component': string;
68
+ 'x-read-pretty': boolean;
69
+ required?: undefined;
70
+ };
71
+ primaryKey?: undefined;
72
+ allowNull?: undefined;
73
+ unique?: undefined;
74
+ } | {
75
+ name: string;
76
+ type: string;
77
+ defaultValue: number;
78
+ uiSchema: {
79
+ type: string;
80
+ title: string;
81
+ 'x-component': string;
82
+ required?: undefined;
83
+ 'x-read-pretty'?: undefined;
84
+ };
85
+ primaryKey?: undefined;
86
+ allowNull?: undefined;
87
+ unique?: undefined;
88
+ } | {
89
+ name: string;
90
+ type: string;
91
+ uiSchema: {
92
+ type: string;
93
+ title: string;
94
+ 'x-component': string;
95
+ 'x-read-pretty': boolean;
96
+ required?: undefined;
97
+ };
98
+ primaryKey?: undefined;
99
+ allowNull?: undefined;
100
+ unique?: undefined;
101
+ defaultValue?: undefined;
102
+ })[];
103
+ };
104
+ export declare const userStatusesSchema: ISchema;
@@ -149,6 +149,7 @@ export declare const userCollection: {
149
149
  label: string;
150
150
  value: string;
151
151
  };
152
+ showTime?: undefined;
152
153
  };
153
154
  'x-read-pretty'?: undefined;
154
155
  'x-validator'?: undefined;
@@ -159,6 +160,99 @@ export declare const userCollection: {
159
160
  allowNull?: undefined;
160
161
  unique?: undefined;
161
162
  hidden?: undefined;
163
+ } | {
164
+ interface: string;
165
+ type: string;
166
+ name: string;
167
+ target: string;
168
+ foreignKey: string;
169
+ targetKey: string;
170
+ uiSchema: {
171
+ type: string;
172
+ title: string;
173
+ 'x-component': string;
174
+ 'x-component-props': {
175
+ fieldNames: {
176
+ label: string;
177
+ value: string;
178
+ };
179
+ multiple?: undefined;
180
+ showTime?: undefined;
181
+ };
182
+ 'x-read-pretty'?: undefined;
183
+ 'x-validator'?: undefined;
184
+ required?: undefined;
185
+ };
186
+ autoIncrement?: undefined;
187
+ primaryKey?: undefined;
188
+ allowNull?: undefined;
189
+ unique?: undefined;
190
+ hidden?: undefined;
191
+ otherKey?: undefined;
192
+ onDelete?: undefined;
193
+ sourceKey?: undefined;
194
+ through?: undefined;
195
+ } | {
196
+ interface: string;
197
+ type: string;
198
+ name: string;
199
+ uiSchema: {
200
+ type: string;
201
+ title: string;
202
+ 'x-component': string;
203
+ 'x-component-props': {
204
+ showTime: boolean;
205
+ multiple?: undefined;
206
+ fieldNames?: undefined;
207
+ };
208
+ 'x-read-pretty'?: undefined;
209
+ 'x-validator'?: undefined;
210
+ required?: undefined;
211
+ };
212
+ autoIncrement?: undefined;
213
+ primaryKey?: undefined;
214
+ allowNull?: undefined;
215
+ unique?: undefined;
216
+ hidden?: undefined;
217
+ target?: undefined;
218
+ foreignKey?: undefined;
219
+ otherKey?: undefined;
220
+ onDelete?: undefined;
221
+ sourceKey?: undefined;
222
+ targetKey?: undefined;
223
+ through?: undefined;
224
+ } | {
225
+ interface: string;
226
+ type: string;
227
+ name: string;
228
+ uiSchema: {
229
+ type: string;
230
+ title: string;
231
+ 'x-component': string;
232
+ 'x-component-props': {
233
+ fieldNames: {
234
+ label: string;
235
+ value: string;
236
+ };
237
+ multiple?: undefined;
238
+ showTime?: undefined;
239
+ };
240
+ 'x-read-pretty'?: undefined;
241
+ 'x-validator'?: undefined;
242
+ required?: undefined;
243
+ };
244
+ autoIncrement?: undefined;
245
+ primaryKey?: undefined;
246
+ allowNull?: undefined;
247
+ unique?: undefined;
248
+ hidden?: undefined;
249
+ target?: undefined;
250
+ foreignKey?: undefined;
251
+ otherKey?: undefined;
252
+ onDelete?: undefined;
253
+ sourceKey?: undefined;
254
+ targetKey?: undefined;
255
+ through?: undefined;
162
256
  })[];
163
257
  };
164
258
  export declare const changePassword: ISchema;
@@ -1,10 +1,10 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "1.3.25",
3
+ "@tachybase/client": "1.5.0",
4
4
  "@tachybase/schema": "1.3.52",
5
5
  "antd": "5.22.5",
6
- "@tachybase/module-acl": "1.3.25",
6
+ "@tachybase/module-acl": "1.5.0",
7
7
  "@tego/client": "1.3.52",
8
- "react-i18next": "15.2.0",
8
+ "react-i18next": "16.2.1",
9
9
  "@tego/server": "1.3.52"
10
10
  };
@@ -1,9 +1,46 @@
1
1
  {
2
+ "Active": "Active",
3
+ "Add status": "Add status",
2
4
  "Add users": "Add users",
5
+ "Allow Login": "Allow Login",
3
6
  "Are you sure you want to remove it?": "Are you sure you want to remove it?",
7
+ "Auto": "Auto",
8
+ "Color": "Color",
9
+ "Created At": "Created At",
10
+ "Created By": "Created By",
11
+ "Delete statuses": "Delete statuses",
12
+ "Description": "Description",
13
+ "Edit status": "Edit status",
4
14
  "Edited successfully": "Edited successfully",
15
+ "Expire At": "Expire At",
16
+ "From Status": "From Status",
17
+ "Login Error Message": "Login Error Message",
18
+ "Manual": "Manual",
19
+ "Manually disabled by administrator": "Manually disabled by administrator",
20
+ "Normal active user": "Normal active user",
21
+ "Operation Type": "Operation Type",
22
+ "Package Name": "Package Name",
23
+ "Pending": "Pending",
24
+ "Previous Status": "Previous Status",
5
25
  "Random password": "Random password",
26
+ "Reason": "Reason",
6
27
  "Remove user": "Remove user",
28
+ "Sort": "Sort",
29
+ "Status": "Status",
30
+ "Status Expire At": "Status Expire At",
31
+ "Status Key": "Status Key",
32
+ "Status Reason": "Status Reason",
33
+ "Status Title": "Status Title",
34
+ "System": "System",
35
+ "System Defined": "System Defined",
36
+ "To Status": "To Status",
37
+ "User": "User",
38
+ "User ID": "User ID",
39
+ "User Status Histories": "User Status Histories",
40
+ "User Statuses": "User Statuses",
41
+ "User waiting for approval": "User waiting for approval",
7
42
  "Users & Permissions": "Users & Permissions",
8
- "Users Settings": "Users Settings"
43
+ "Users Settings": "Users Settings",
44
+ "Your account has been disabled, please contact administrator if you have any questions": "Your account has been disabled, please contact administrator if you have any questions",
45
+ "Your account is under review, please wait for administrator approval": "Your account is under review, please wait for administrator approval"
9
46
  }