@nocobase/plugin-users 2.1.0-alpha.4 → 2.1.0-alpha.45
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/LICENSE +201 -661
- package/README.md +79 -10
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client/49.919f2c983a959288.js +10 -0
- package/dist/client/772.61c09631dd20ae13.js +10 -0
- package/dist/client/821.8ca2f675db381516.js +10 -0
- package/dist/client/825.5b87f2d207f047ef.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/index.d.ts +11 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +10 -0
- package/dist/client-v2/plugin.d.ts +26 -0
- package/dist/client-v2/user-center/ChangePasswordItemModel.d.ts +23 -0
- package/dist/externalVersion.js +12 -9
- package/package.json +4 -3
- package/dist/client/5f46e5d0a78be798.js +0 -10
- package/dist/client/647e00de2fe53b8c.js +0 -10
- package/dist/client/70d86bd07da0d9fd.js +0 -10
- package/dist/client/75baa413a3784860.js +0 -10
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# NocoBase
|
|
2
2
|
|
|
3
3
|
<video width="100%" controls>
|
|
4
|
-
|
|
4
|
+
<source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
|
|
5
5
|
</video>
|
|
6
6
|
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
9
|
+
<a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability-first, open-source no-code platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
|
10
|
+
</p>
|
|
7
11
|
|
|
8
12
|
## What is NocoBase
|
|
9
13
|
|
|
10
|
-
NocoBase is
|
|
11
|
-
|
|
14
|
+
NocoBase is the most extensible AI-powered no-code platform.
|
|
15
|
+
Total control. Infinite extensibility. AI collaboration.
|
|
16
|
+
Enable your team to adapt quickly and cut costs dramatically.
|
|
17
|
+
No years of development. No millions wasted.
|
|
18
|
+
Deploy NocoBase in minutes — and take control of everything.
|
|
12
19
|
|
|
13
20
|
Homepage:
|
|
14
|
-
https://www.nocobase.com/
|
|
21
|
+
https://www.nocobase.com/
|
|
15
22
|
|
|
16
23
|
Online Demo:
|
|
17
24
|
https://demo.nocobase.com/new
|
|
@@ -19,12 +26,74 @@ https://demo.nocobase.com/new
|
|
|
19
26
|
Documents:
|
|
20
27
|
https://docs.nocobase.com/
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
https://
|
|
29
|
+
Forum:
|
|
30
|
+
https://forum.nocobase.com/
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
https://www.nocobase.com/en/
|
|
32
|
+
Use Cases:
|
|
33
|
+
https://www.nocobase.com/en/blog/tags/customer-stories
|
|
27
34
|
|
|
35
|
+
## Release Notes
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
|
|
38
|
+
|
|
39
|
+
## Distinctive features
|
|
40
|
+
|
|
41
|
+
### 1. Data model-driven, not form/table–driven
|
|
42
|
+
|
|
43
|
+
Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
|
|
44
|
+
|
|
45
|
+
- UI and data structure are fully decoupled
|
|
46
|
+
- Multiple blocks and actions can be created for the same table or record in any quantity or form
|
|
47
|
+
- Supports the main database, external databases, and third-party APIs as data sources
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
### 2. AI employees, integrated into your business systems
|
|
52
|
+
Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
|
|
53
|
+
|
|
54
|
+
- Define AI employees for roles such as translator, analyst, researcher, or assistant
|
|
55
|
+
- Seamless AI–human collaboration in interfaces and workflows
|
|
56
|
+
- Ensure AI usage is secure, transparent, and customizable for your business needs
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
### 3. What you see is what you get, incredibly easy to use
|
|
61
|
+
|
|
62
|
+
While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
|
|
63
|
+
|
|
64
|
+
- One-click switch between usage mode and configuration mode
|
|
65
|
+
- Pages serve as a canvas to arrange blocks and actions, similar to Notion
|
|
66
|
+
- Configuration mode is designed for ordinary users, not just programmers
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
### 4. Everything is a plugin, designed for extension
|
|
71
|
+
Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
|
|
72
|
+
|
|
73
|
+
- All functionalities are plugins, similar to WordPress
|
|
74
|
+
- Plugins are ready to use upon installation
|
|
75
|
+
- Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
NocoBase supports three installation methods:
|
|
82
|
+
|
|
83
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
|
|
84
|
+
|
|
85
|
+
Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
|
|
86
|
+
|
|
87
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
|
|
88
|
+
|
|
89
|
+
The business code of the project is completely independent and supports low-code development.
|
|
90
|
+
|
|
91
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
|
|
92
|
+
|
|
93
|
+
If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
|
|
94
|
+
|
|
95
|
+
## How NocoBase works
|
|
96
|
+
|
|
97
|
+
<video width="100%" controls>
|
|
98
|
+
<source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
|
|
99
|
+
</video>
|
package/client-v2.d.ts
ADDED
package/client-v2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client-v2/index.js');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_users=self.webpackChunk_nocobase_plugin_users||[]).push([["49"],{460:function(e,o,t){t.d(o,{n:function(){return r}});var n=t(953);function r(){return(0,n.useTranslation)(["users","client"],{nsMode:"fallback"})}},54:function(e,o,t){t.d(o,{Oo:function(){return i},Wz:function(){return p},fj:function(){return c},qn:function(){return s}});var n=t(166);function r(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}var p={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",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"}}}}]},i={type:"object",properties:{block1:{type:"void","x-component":"CardItem","x-component-props":{heightMode:"fullHeight"},"x-decorator":"TableBlockProvider","x-decorator-props":{dataSource:"main",rowKey:"id",collection:"users",action:"list",params:{pageSize:20}},"x-use-decorator-props":"useTableBlockDecoratorProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--nb-spacing)"}},properties:{filter:{type:"void","x-component":"FilterAction","x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{confirm:{title:"{{t('Delete users')}}",content:"{{t('Are you sure you want to delete it?')}}"},icon:"DeleteOutlined"},"x-use-component-props":"useBulkDestroyActionProps"},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2",title:'{{t("Add user")}}',properties:{form:{type:"void","x-component":"ProfileCreateForm"}}}}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},"x-use-component-props":"useTableBlockProps",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:{"x-component":"CollectionField","x-component-props":{mode:"Tag",enableLink:!1,ellipsis:!0},"x-read-pretty":!0,"x-collection-field":"users.roles"}}},column5:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column","x-decorator":"TableV2.Column.ActionBar",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit profile")}}',"x-decorator":"ACLActionProvider","x-acl-action":"users:update","x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer",title:'{{t("Edit profile")}}',properties:{form:{type:"void","x-component":"ProfileEditForm"}}}}},changePassword:{type:"void",title:'{{t("Change password")}}',"x-decorator":"ACLActionProvider","x-acl-action":"users:update","x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormProps",title:'{{t("Change password")}}',properties:{username:{"x-component":"CollectionField","x-component-props":{hidden:!0}},password:{"x-component":"CollectionField","x-component-props":{component:"PasswordField"},"x-decorator":"FormItem",required:!0},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":"useSubmitActionProps"}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-acl-action":"users:destroy","x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-use-component-props":"useDestroyActionProps"}}}}}}}}}}},c={type:"object","x-decorator":"UsersSettingsProvider",properties:{usersSettings:{type:"void","x-component":"CardItem","x-decorator":"UsersSettingsProvider",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{enableEditProfile:{type:"string","x-component":"Checkbox","x-decorator":"FormItem",default:!0,"x-content":'{{t("Allow edit profile")}}'},enableChangePassword:{type:"string","x-component":"Checkbox","x-decorator":"FormItem",default:!0,"x-content":'{{t("Allow change password")}}'},submit:{title:'{{t("Save")}}',"x-component":"Action","x-use-component-props":"useSubmitActionProps"}}}}}}},s=function(){var e;return{name:"roleUsers",type:"void",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:(r(e={},(0,n.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"}),r(e,"actions",{type:"void","x-component":"Space",properties:{remove:{type:"void",title:'{{t("Remove")}}',"x-component":"Action","x-component-props":{icon:"MinusOutlined",confirm:{title:"{{t('Remove')}}",content:"{{t('Are you sure you want to remove these users?')}}"},style:{marginRight:8},useAction:"{{ useBulkRemoveUsers }}"}},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":"FormItem","x-component":"RoleUsersProvider",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"}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox",onChange:"{{ handleSelectRoleUsers }}"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{username:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{nickname:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},phone:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{phone:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},email:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}}}}}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useAddRoleUsers }}"}}}}}}}}}}),e)},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{username:{type:"void",title:'{{t("Username")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void",title:'{{t("Nickname")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.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-component-props":{confirm:{title:"{{t('Remove user')}}",content:"{{t('Are you sure you want to remove it?')}}"},useAction:"{{ useRemoveUser }}"}}}}}}}}}}}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_users=self.webpackChunk_nocobase_plugin_users||[]).push([["772"],{687:function(e,r,t){t.r(r),t.d(r,{RoleUsersManager:function(){return m}});var n=t(155),o=t.n(n),u=t(59),s=t(342),l=t(79),c=t(460),a=t(54),i=function(){var e,r,t=(0,n.useContext)(s.CollectionContext),o=(0,s.useFilterFieldOptions)(t.fields),u=(0,s.useResourceActionContext)();return(0,s.useFilterFieldProps)({options:o,params:(null==(r=u.state)||null==(e=r.params)?void 0:e[0])||u.params,service:u})};function f(e,r,t,n,o,u,s){try{var l=e[u](s),c=l.value}catch(e){t(e);return}l.done?r(c):Promise.resolve(c).then(n,o)}function v(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var u=e.apply(r,t);function s(e){f(u,n,o,s,l,"next",e)}function l(e){f(u,n,o,s,l,"throw",e)}s(void 0)})}}function p(e,r){var t,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(s,"next",{value:c(0)}),l(s,"throw",{value:c(1)}),l(s,"return",{value:c(2)}),"function"==typeof Symbol&&l(s,Symbol.iterator,{value:function(){return this}}),s;function c(l){return function(c){var a=[l,c];if(t)throw TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(u=0)),u;)try{if(t=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=r.call(e,u)}catch(e){a=[6,e],n=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var d=function(){var e=(0,s.useAPIClient)(),r=(0,n.useContext)(l.RolesManagerContext).role,t=(0,s.useRecord)(),o=(0,s.useResourceActionContext)().refresh;return{run:function(){return v(function(){return p(this,function(n){switch(n.label){case 0:return[4,e.resource("roles.users",null==r?void 0:r.name).remove({values:[t.id]})];case 1:return n.sent(),o(),[2]}})})()}}},b=function(){var e=(0,c.n)().t,r=u.App.useApp().message,t=(0,s.useAPIClient)(),o=(0,s.useResourceActionContext)(),a=o.state,i=o.setState,f=o.refresh,d=(0,n.useContext)(l.RolesManagerContext).role;return{run:function(){return v(function(){var n;return p(this,function(o){switch(o.label){case 0:if(!(null==(n=null==a?void 0:a.selectedRowKeys)?void 0:n.length))return r.warning(e("Please select users")),[2];return[4,t.resource("roles.users",null==d?void 0:d.name).remove({values:n})];case 1:return o.sent(),null==i||i({selectedRowKeys:[]}),f(),[2]}})})()}}},h=function(e){var r=(0,n.useContext)(l.RolesManagerContext).role;return o().createElement(s.ResourceActionProvider,{collection:a.Wz,request:{resource:"users",action:"listExcludeRole",params:{roleName:null==r?void 0:r.name}}},e.children)},m=function(){var e=(0,c.n)().t,r=(0,n.useContext)(l.RolesManagerContext).role,t=(0,s.useRequest)({resource:"roles.users",resourceOf:null==r?void 0:r.name,action:"list"},{ready:!!r});(0,n.useEffect)(function(){t.run()},[r]);var u=(0,n.useRef)([]),f=(0,n.useMemo)(function(){return(0,a.qn)()},[r]);return o().createElement(s.ResourceActionContext.Provider,{value:function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){var n;n=t[r],r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n})}return e}({},t)},o().createElement(s.CollectionProvider_deprecated,{collection:a.Wz},o().createElement(s.SchemaComponent,{schema:f,components:{RoleUsersProvider:h},scope:{useBulkRemoveUsers:b,useRemoveUser:d,handleSelectRoleUsers:function(e,r){u.current=r},useAddRoleUsers:function(){var e=(0,n.useContext)(l.RolesManagerContext).role,r=(0,s.useAPIClient)(),t=(0,s.useActionContext)().setVisible,o=(0,s.useResourceActionContext)().refresh;return{run:function(){return v(function(){return p(this,function(n){switch(n.label){case 0:return[4,r.resource("roles.users",null==e?void 0:e.name).add({values:u.current.map(function(e){return e.id})})];case 1:return n.sent(),u.current=[],t(!1),o(),[2]}})})()}}},useFilterActionProps:i,t:e}})))}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_users=self.webpackChunk_nocobase_plugin_users||[]).push([["821"],{404:function(e,t,r){r.r(t),r.d(t,{UsersProvider:function(){return m},useEditProfile:function(){return y}});var n=r(342),o=r(155),i=r.n(o),u=r(460),a=r(166),l=r(230);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t,r,n,o,i,u){try{var a=e[i](u),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(n,o)}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){f(e,t,r[t])})}return e}var d=function(){var e=(0,n.useCurrentUserContext)(),t=(0,n.useActionContext)().setVisible,r=(0,l.useForm)(),o=(0,n.useAPIClient)(),i=(0,l.useFieldSchema)(),u=(0,l.useField)(),a=(0,n.useCollectValuesToSubmit)();return{type:"primary",htmlType:"submit",onClick:function(){var n;return(n=function(){var n,l,c,s,f;return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:l(0)}),a(u,"throw",{value:l(1)}),a(u,"return",{value:l(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function l(a){return function(l){var c=[a,l];if(r)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(d){switch(d.label){case 0:if(c=(l=null!=(n=null==i?void 0:i["x-action-settings"])?n:{}).triggerWorkflows,l.skipValidator)return[3,2];return[4,r.submit()];case 1:d.sent(),d.label=2;case 2:return[4,a()];case 3:s=d.sent(),u.data=u.data||{},u.data.loading=!0,d.label=4;case 4:return d.trys.push([4,7,,8]),[4,o.resource("users").updateProfile({values:s,triggerWorkflows:(null==c?void 0:c.length)?c.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 5:return d.sent(),e.mutate({data:p({},null==e||null==(f=e.data)?void 0:f.data,s)}),[4,r.reset()];case 6:return d.sent(),u.data.loading=!1,t(!1),[3,8];case 7:return d.sent(),u.data.loading=!1,[3,8];case 8:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function u(e){s(i,r,o,u,a,"next",e)}function a(e){s(i,r,o,u,a,"throw",e)}u(void 0)})})()}}},b=function(){var e,t=(0,n.useCollectionManager)().getCollection("users"),r=(0,n.useCurrentUserContext)().data,u=(0,o.useMemo)(function(){var e,r;return e=p({},t),r=r={name:"users",fields:t.fields.filter(function(e){return!["password","roles"].includes(e.name)})},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e},[t]);return i().createElement(n.ExtendCollectionsProvider,{collections:[u]},i().createElement(n.RemoteSchemaComponent,{uid:"nocobase-user-profile-edit-form",noForm:!0,scope:{useUpdateProfileActionProps:d,currentUserId:null==(e=r.data)?void 0:e.id}}))},y=function(){var e,t=(0,o.useContext)(n.DropdownVisibleContext),r=function(e){if(Array.isArray(e))return e}(e=(0,o.useState)(!1))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,u=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){u=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(u)throw r}}return o}}(e)||function(e){if(e){if("string"==typeof e)return c(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return c(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=r[0],s=r[1],p=(0,u.n)().t,d=((0,n.useSystemSettings)()||{}).data,y=((null==d?void 0:d.data)||{}).enableEditProfile,m=(0,o.useMemo)(function(){return{key:"profile",eventKey:"EditProfile",onClick:function(){s(!0),null==t||t.setVisible(!1)},label:i().createElement("div",null,p("Edit profile"),i().createElement(n.ActionContextProvider,{value:{visible:l,setVisible:s}},i().createElement("div",{onClick:function(e){return e.stopPropagation()}},i().createElement(n.SchemaComponent,{components:{ProfileEditForm:b},schema:{type:"object",properties:f({},(0,a.uid)(),{"x-component":"Action.Drawer","x-component-props":{},type:"void",title:'{{t("Edit profile")}}',properties:{form:{type:"void","x-component":"ProfileEditForm"}}})}}))))}},[l]);return!1===y?null:m},m=function(e){var t=(0,n.useCurrentUserSettingsMenu)().addMenuItem,r=y(),u=(0,n.useSystemSettings)().data,a=((null==u?void 0:u.data)||{}).enableEditProfile;return(0,o.useEffect)(function(){!1!==a&&t(r,{after:"divider_1"})},[t,r,a]),i().createElement(i().Fragment,null,e.children)}},460:function(e,t,r){r.d(t,{n:function(){return o}});var n=r(953);function o(){return(0,n.useTranslation)(["users","client"],{nsMode:"fallback"})}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_users=self.webpackChunk_nocobase_plugin_users||[]).push([["825"],{616:function(e,t,r){r.r(t),r.d(t,{UsersManagement:function(){return M}});var n=r(477),o=r(452),a=r(230),u=r(342),i=r(59),c=r(155),l=r.n(c),s=r(460),f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r="abcdefghijklmnopqrstuvwxyz",n="0123456789",o="!#$%^&*-_+=",a=t+r+n+o,u=new Uint32Array(e);crypto.getRandomValues(u);var i="";i+=t.charAt(u[0]%t.length),i+=r.charAt(u[1]%r.length),i+=n.charAt(u[2]%n.length),i+=o.charAt(u[3]%o.length);for(var c=4;c<e;c++){var l=u[c]%a.length;i+=a.charAt(l)}return i[0]+i.slice(1).split("").sort(function(){return Math.random()-.5}).join("")};function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var m=function(){var e,t=(0,s.n)().t,r=(0,a.useField)(),n=function(e){if(Array.isArray(e))return e}(e=l().useState(!1))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw r}}return o}}(e)||function(e){if(e){if("string"==typeof e)return p(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[0],m=n[1],b=(0,u.useActionContext)();return(0,c.useEffect)(function(){b.visible||r.reset()},[r,b.visible]),(0,c.useEffect)(function(){r.value&&r.validate()},[r.value]),l().createElement(i.Row,{gutter:10},l().createElement(i.Col,{span:18},l().createElement(u.Password,{checkStrength:!0,visibilityToggle:{visible:o,onVisibleChange:m},value:r.value,onChange:function(e){return r.setValue(e.target.value)},autoComplete:"new-password"})),l().createElement(i.Col,{span:4},l().createElement(i.Button,{onClick:function(){r.setValue(f()),m(!0)}},t("Random password"))))},b=r(54);function v(e,t,r,n,o,a,u){try{var i=e[a](u),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function u(e){v(a,n,o,u,i,"next",e)}function i(e){v(a,n,o,u,i,"throw",e)}u(void 0)})}}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function g(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(u,"next",{value:c(0)}),i(u,"throw",{value:c(1)}),i(u,"return",{value:c(2)}),"function"==typeof Symbol&&i(u,Symbol.iterator,{value:function(){return this}}),u;function c(i){return function(c){var l=[i,c];if(r)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function C(){var e,t,r=(e=["\n .ant-tabs-nav {\n margin-bottom: 0px;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return C=function(){return r},r}var w=function(){var e=(0,u.useActionContext)().setVisible,t=(0,a.useForm)();return{type:"default",onClick:function(){e(!1),t.reset()}}},P=function(){var e=(0,u.useActionContext)().setVisible,t=i.App.useApp().message,r=(0,a.useForm)(),n=(0,u.useDataBlockResource)(),o=(0,u.useDataBlockRequest)().refresh,c=(0,s.n)().t,l=(0,u.useCollection)();return{htmlType:"submit",type:"primary",onClick:function(){return d(function(){var a;return g(this,function(u){switch(u.label){case 0:return[4,r.submit()];case 1:if(u.sent(),!(a=r.values)[l.filterTargetKey])return[3,3];return[4,n.update({values:a,filterByTk:a[l.filterTargetKey]})];case 2:return u.sent(),[3,5];case 3:return[4,n.create({values:a})];case 4:u.sent(),u.label=5;case 5:return o(),t.success(c("Saved successfully")),e(!1),r.reset(),[2]}})})()}}},O=function(){var e=(0,u.useCollectionRecordData)();return{form:(0,c.useMemo)(function(){return(0,o.createForm)({initialValues:e})},[e])}},S=function(){return l().createElement(u.RemoteSchemaComponent,{uid:"nocobase-admin-profile-create-form",noForm:!0})},E=function(){var e=(0,u.useCollectionManager)().getCollection("users"),t=h(y({},e),{name:"users",fields:e.fields.filter(function(e){return"password"!==e.name})});return l().createElement(u.ExtendCollectionsProvider,{collections:[t]},l().createElement(u.RemoteSchemaComponent,{uid:"nocobase-admin-profile-edit-form",noForm:!0,scope:{useCancelActionProps:w}}))},A=function(){var e=(0,u.useSchemaComponentContext)();return l().createElement(u.SchemaComponentContext.Provider,{value:h(y({},e),{designable:!1})},l().createElement(u.SchemaComponent,{schema:{type:"void",properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"}}}}}))},j=function(){var e=(0,s.n)().t,t=(0,u.useCollectionManager)();return(0,c.useMemo)(function(){return null==t?void 0:t.getCollection("users")},[t])?l().createElement(u.SchemaComponent,{schema:b.Oo,scope:{t:e,useCancelActionProps:w,useSubmitActionProps:P,useEditFormProps:O},components:{PasswordField:m,ProfileEditForm:E,ProfileCreateForm:S,FilterAction:A}}):l().createElement(i.Spin,null)},k=(0,c.createContext)({}),x=function(e){var t=(0,u.useRequest)({url:"users:getSystemSettings"});return l().createElement(k.Provider,{value:t},e.children)},F=function(){var e=(0,s.n)().t,t=(0,a.useForm)();return l().createElement(u.SchemaComponent,{schema:b.fj,scope:{t:e,useFormBlockProps:function(){var e,r=(0,c.useContext)(k),n=(null==r||null==(e=r.data)?void 0:e.data)||{},o=n.enableChangePassword,a=n.enableEditProfile;return(0,c.useEffect)(function(){null==t||t.setValues({enableChangePassword:!1!==o,enableEditProfile:!1!==a})},[r]),{form:t}},useSubmitActionProps:function(){var t=(0,u.useAPIClient)(),r=(0,a.useForm)();return{type:"primary",onClick:function(){return d(function(){var n;return g(this,function(o){switch(o.label){case 0:return[4,r.submit()];case 1:return o.sent(),n=r.values,[4,t.request({url:"users:updateSystemSettings",data:n,method:"POST"})];case 2:return o.sent(),i.message.success(e("Saved successfully")),window.location.reload(),[2]}})})()}}}},components:{UsersSettingsProvider:x}})},M=function(){var e=(0,s.n)().t;return l().createElement(i.Tabs,{defaultActiveKey:"usersManager",type:"card",className:(0,n.css)(C()),items:[{label:e("Users manager"),key:"usersManager",children:l().createElement(j,null)},{label:e("Settings"),key:"usersSettings",children:l().createElement(F,null)}]})}}}]);
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/plugin-acl/client"),require("@formily/core"),require("@formily/shared"),require("@nocobase/client"),require("react-router-dom"),require("react"),require("@emotion/css"),require("@formily/react"),require("@nocobase/utils/client"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-users",["@nocobase/plugin-acl/client","@formily/core","@formily/shared","@nocobase/client","react-router-dom","react","@emotion/css","@formily/react","@nocobase/utils/client","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-users"]=t(require("@nocobase/plugin-acl/client"),require("@formily/core"),require("@formily/shared"),require("@nocobase/client"),require("react-router-dom"),require("react"),require("@emotion/css"),require("@formily/react"),require("@nocobase/utils/client"),require("antd"),require("react-i18next")):e["@nocobase/plugin-users"]=t(e["@nocobase/plugin-acl/client"],e["@formily/core"],e["@formily/shared"],e["@nocobase/client"],e["react-router-dom"],e.react,e["@emotion/css"],e["@formily/react"],e["@nocobase/utils/client"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i,a,u,s,l,c){return function(){var f,p,d,m,b,y,v={581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},964:function(e){"use strict";e.exports=a},563:function(e){"use strict";e.exports=t},505:function(e){"use strict";e.exports=u},875:function(e){"use strict";e.exports=n},772:function(e){"use strict";e.exports=r},465:function(t){"use strict";t.exports=e},584:function(e){"use strict";e.exports=s},721:function(e){"use strict";e.exports=l},156:function(e){"use strict";e.exports=i},238:function(e){"use strict";e.exports=c},128:function(e){"use strict";e.exports=o}},h={};function g(e){var t=h[e];if(void 0!==t)return t.exports;var n=h[e]={exports:{}};return v[e](n,n.exports,g),n.exports}g.m=v,g.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return g.d(t,{a:t}),t},g.d=function(e,t){for(var n in t)g.o(t,n)&&!g.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},g.f={},g.e=function(e){return Promise.all(Object.keys(g.f).reduce(function(t,n){return g.f[n](e,t),t},[]))},g.u=function(e){return""+({138:"70d86bd07da0d9fd",386:"75baa413a3784860",74:"5f46e5d0a78be798",836:"647e00de2fe53b8c"})[e]+".js"},g.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),g.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f={},p="@nocobase/plugin-users:",g.l=function(e,t,n,r){if(f[e])return void f[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var s=a[u];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==p+n){o=s;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,g.nc&&o.setAttribute("nonce",g.nc),o.setAttribute("data-webpack",p+n),o.src=e),f[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(c);var r=f[e];if(delete f[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},c=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},g.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(d=window.__webpack_public_path__||"/").endsWith("/")||(d+="/"),g.p=d+"static/plugins/@nocobase/plugin-users/dist/client/",m={909:0},g.f.j=function(e,t){var n=g.o(m,e)?m[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=m[e]=[t,r]});t.push(n[2]=r);var o=g.p+g.u(e),i=Error();g.l(o,function(t){if(g.o(m,e)&&(0!==(n=m[e])&&(m[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},b=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],u=0;if(o.some(function(e){return 0!==m[e]})){for(n in i)g.o(i,n)&&(g.m[n]=i[n]);a&&a(g)}for(e&&e(t);u<o.length;u++)r=o[u],g.o(m,r)&&m[r]&&m[r][0](),m[r]=0},(y=self.webpackChunk_nocobase_plugin_users=self.webpackChunk_nocobase_plugin_users||[]).forEach(b.bind(null,0)),y.push=b.bind(null,y.push.bind(y));var w={};return!function(){"use strict";g.r(w),g.d(w,{default:function(){return K}});var e,t,n,r=g(772),o=g(584),i=g(465),a=g.n(i),u=g(505),s=g(875),l=g(238),c=g(128),f=g(156),p=g.n(f);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,o)}function b(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){m(i,r,o,a,u,"next",e)}function u(e){m(i,r,o,a,u,"throw",e)}a(void 0)})}}function y(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var s=[i,u];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var v=function(){var e=(0,r.useActionContext)().setVisible,t=(0,u.useForm)();return{run:function(){return b(function(){return y(this,function(n){switch(n.label){case 0:return e(!1),[4,t.reset()];case 1:return n.sent(),[2]}})})()}}},h=function(){var e=(0,c.useNavigate)(),t=(0,r.useActionContext)().setVisible,n=(0,u.useForm)(),o=(0,r.useAPIClient)();return{run:function(){return b(function(){return y(this,function(r){switch(r.label){case 0:return[4,n.submit()];case 1:return r.sent(),[4,o.resource("auth").changePassword({values:n.values})];case 2:return r.sent(),[4,n.reset()];case 3:return r.sent(),t(!1),e("/signin"),[2]}})})()}}},x={type:"object",properties:(e={},t=(0,s.uid)(),n={"x-decorator":"Form","x-component":"Action.Drawer","x-component-props":{zIndex:2e3},type:"void",title:'{{t("Change password")}}',properties:{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-validator":{password:!0},"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") : ""}}'}}}]},footer:{"x-component":"Action.Drawer.Footer",type:"void",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ useCloseAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSaveCurrentUserValues }}"}}}}}},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},P=function(){var e,t=(0,f.useContext)(r.DropdownVisibleContext),n=(e=(0,f.useState)(!1),function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return d(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],i=n[1],a=(0,l.useTranslation)().t,u=((0,r.useSystemSettings)()||{}).data,s=((null==u?void 0:u.data)||{}).enableChangePassword,c=(0,r.useZIndexContext)()+10,m=(0,f.useCallback)(function(e){var n;e.stopPropagation(),null==t||null==(n=t.setVisible)||n.call(t,!1),i(function(e){return!e||e})},[t]),b=(0,f.useMemo)(function(){return p().createElement(r.SchemaComponentContext.Provider,{value:{designable:!1}},p().createElement(r.SchemaComponent,{scope:{useCloseAction:v,useSaveCurrentUserValues:h},schema:x}))},[c]);return!1===s?null:p().createElement(r.zIndexContext.Provider,{value:c},p().createElement(r.SchemaSettingsItem,{eventKey:"changePassword",title:"changePassword"},p().createElement("div",{onClick:m},a("Change password"))),p().createElement(r.ActionContextProvider,{value:{visible:o,setVisible:i}},o&&p().createElement("div",{onClick:function(e){return e.stopPropagation()}},b)))};function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function S(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,o)}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){k(e,t,n[t])})}return e}var E=function(){var e=(0,r.useCurrentUserContext)(),t=(0,r.useActionContext)().setVisible,n=(0,u.useForm)(),o=(0,r.useAPIClient)(),i=(0,u.useFieldSchema)(),a=(0,u.useField)(),s=(0,r.useCollectValuesToSubmit)();return{type:"primary",htmlType:"submit",onClick:function(){var r;return(r=function(){var r,u,l,c,f;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var s=[i,u];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(p){switch(p.label){case 0:if(l=(u=null!=(r=null==i?void 0:i["x-action-settings"])?r:{}).triggerWorkflows,u.skipValidator)return[3,2];return[4,n.submit()];case 1:p.sent(),p.label=2;case 2:return[4,s()];case 3:c=p.sent(),a.data=a.data||{},a.data.loading=!0,p.label=4;case 4:return p.trys.push([4,7,,8]),[4,o.resource("users").updateProfile({values:c,triggerWorkflows:(null==l?void 0:l.length)?l.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 5:return p.sent(),e.mutate({data:O({},null==e||null==(f=e.data)?void 0:f.data,c)}),[4,n.reset()];case 6:return p.sent(),a.data.loading=!1,t(!1),[3,8];case 7:return p.sent(),a.data.loading=!1,[3,8];case 8:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){S(i,n,o,a,u,"next",e)}function u(e){S(i,n,o,a,u,"throw",e)}a(void 0)})})()}}},j=function(){var e=((0,r.useCurrentUserContext)()||{}).data;return{record:null==e?void 0:e.data}},_=function(){var e=(0,r.useActionContext)().setVisible;return{type:"default",onClick:function(){e(!1)}}},A=function(){var e=(0,f.useContext)(r.DropdownVisibleContext),t=(0,r.useCollectionManager)().getCollection("users"),n=(0,f.useMemo)(function(){var e,n;return e=O({},t),n=n={name:"users",fields:t.fields.filter(function(e){return!["password","roles"].includes(e.name)})},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e},[t]);return(0,f.useEffect)(function(){null==e||e.setVisible(!1)},[e]),p().createElement(r.ExtendCollectionsProvider,{collections:[n]},p().createElement(r.RemoteSchemaComponent,{uid:"nocobase-user-profile-edit-form",noForm:!0,scope:{useUpdateProfileActionProps:E,useEditFormBlockDecoratorProps:j,useCancelActionProps:_}}))},I=function(){var e,t,n=(0,f.useContext)(r.DropdownVisibleContext),o=(e=(0,f.useState)(!1),function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return C(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],a=o[1],u=(0,l.useTranslation)().t,c=((0,r.useSystemSettings)()||{}).data,d=(null!=(t=null==c?void 0:c.data)?t:{}).enableEditProfile,m=(0,r.useZIndexContext)()+10,b=(0,f.useCallback)(function(e){var t;e.stopPropagation(),null==n||null==(t=n.setVisible)||t.call(n,!1),a(function(e){return!e||e})},[n]),y=(0,f.useMemo)(function(){return p().createElement(r.SchemaComponent,{components:{ProfileEditForm:A},schema:{type:"object",properties:k({},(0,s.uid)(),{"x-component":"Action.Drawer","x-component-props":{zIndex:m},type:"void",title:'{{t("Edit profile")}}',properties:{form:{type:"void","x-component":"ProfileEditForm"}}})}})},[m]);return!1===d?null:p().createElement(r.zIndexContext.Provider,{value:m},p().createElement(r.SchemaSettingsItem,{eventKey:"EditProfile",title:"EditProfile"},p().createElement("div",{onClick:b},u("Edit profile"))),p().createElement(r.ActionContextProvider,{value:{visible:i,setVisible:a}},i&&p().createElement("div",{onClick:function(e){return e.stopPropagation()}},y)))},U=function(){var e,t,n,o=(0,r.useCurrentUserContext)().data,i=(0,r.useToken)().token;return p().createElement(r.SchemaSettingsItem,{disabled:!0,eventKey:"nickname",title:"nickname"},p().createElement("span",{"aria-disabled":"false",style:{cursor:"text",color:i.colorTextDescription}},(null==o||null==(e=o.data)?void 0:e.nickname)||(null==o||null==(t=o.data)?void 0:t.username)||(null==o||null==(n=o.data)?void 0:n.email)))};function q(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,o)}var T=function(){var e,t=(0,l.useTranslation)().t,n=(0,r.useNavigateNoUpdate)(),o=(0,r.useAPIClient)(),i=(0,r.useCurrentUserContext)();return p().createElement(r.SchemaSettingsItem,{title:"signOut",eventKey:"signOut",onClick:(e=function(){var e,t;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var s=[i,u];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:return[4,o.auth.signOut()];case 1:return(null==(t=r.sent().data)||null==(e=t.data)?void 0:e.redirect)?window.location.href=t.data.redirect:n("/signin?redirect=".concat(encodeURIComponent(""))),i.mutate(null),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){q(i,r,o,a,u,"next",e)}function u(e){q(i,r,o,a,u,"throw",e)}a(void 0)})})},t("Sign out"))},M=g(581);function F(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,o)}function V(e,t,n){return(V=N()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&$(o,n.prototype),o}).apply(null,arguments)}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(e){var t="function"==typeof Map?new Map:void 0;return(z=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return V(e,arguments,D(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),$(n,e)})(e)}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}(0,r.lazy)(function(){return M("imported_eeob5k_component",g.e("138").then(g.bind(g,71)))},"UsersProvider").UsersProvider;var R=(0,r.lazy)(function(){return M("imported_-193g1io_component",Promise.all([g.e("836"),g.e("74")]).then(g.bind(g,281)))},"UsersManagement").UsersManagement,B=(0,r.lazy)(function(){return M("imported_-121r5eb_component",Promise.all([g.e("836"),g.e("386")]).then(g.bind(g,7)))},"RoleUsersManager").RoleUsersManager,K=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=D(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,N()?Reflect.construct(e,t||[],D(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&$(n,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var s=[i,u];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(e){return t.app.pluginSettingsManager.add("users-permissions",{title:(0,o.tval)("Users & Permissions",{ns:"users"}),isPinned:!0,sort:200,icon:"TeamOutlined"}),t.app.pluginSettingsManager.add("users-permissions.users",{title:(0,o.tval)("Users"),icon:"UserOutlined",Component:R,aclSnippet:"pm.users"}),t.app.pm.get(a()).rolesManager.add("users",{title:(0,o.tval)("Users"),Component:B}),t.app.addUserCenterSettingsItem({name:"nickName",Component:U,sort:0}),t.app.addUserCenterSettingsItem({name:"divider1",type:"divider",sort:10}),t.app.addUserCenterSettingsItem({name:"editProfile",Component:I,sort:50}),t.app.addUserCenterSettingsItem({name:"changePassword",Component:P,sort:100}),t.app.addUserCenterSettingsItem({name:"divider_signOut",type:"divider",sort:900}),t.app.addUserCenterSettingsItem({name:"signOut",Component:T,sort:1e3}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){F(i,r,o,a,u,"next",e)}function u(e){F(i,r,o,a,u,"throw",e)}a(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(z(r.Plugin))}(),w}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/core"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-users",["react-i18next","@emotion/css","react-router-dom","@formily/core","@formily/shared","react","antd","@nocobase/client","@formily/react","@nocobase/plugin-acl/client","@nocobase/utils/client"],t):"object"==typeof exports?exports["@nocobase/plugin-users"]=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/core"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client")):e["@nocobase/plugin-users"]=t(e["react-i18next"],e["@emotion/css"],e["react-router-dom"],e["@formily/core"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@nocobase/plugin-acl/client"],e["@nocobase/utils/client"])}(self,function(e,t,r,n,o,i,a,u,c,l,s){return function(){"use strict";var f,p,d,b={477:function(e){e.exports=t},452:function(e){e.exports=n},230:function(e){e.exports=c},166:function(e){e.exports=o},342:function(e){e.exports=u},79:function(e){e.exports=l},768:function(e){e.exports=s},59:function(e){e.exports=a},155:function(e){e.exports=i},953:function(t){t.exports=e},442:function(e){e.exports=r}},m={};function y(e){var t=m[e];if(void 0!==t)return t.exports;var r=m[e]={exports:{}};return b[e](r,r.exports,y),r.exports}y.m=b,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var r in t)y.o(t,r)&&!y.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,r){return y.f[r](e,t),t},[]))},y.u=function(e){return""+e+"."+({49:"919f2c983a959288",772:"61c09631dd20ae13",821:"8ca2f675db381516",825:"5b87f2d207f047ef"})[e]+".js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v={},y.l=function(e,t,r,n){if(v[e])return void v[e].push(t);if(void 0!==r)for(var o,i,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var c=a[u];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-users:"+r){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-users:"+r),o.src=e),v[e]=[t];var l=function(t,r){o.onerror=o.onload=null,clearTimeout(s);var n=v[e];if(delete v[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(e){return e(r)}),t)return t(r)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(h=y.g.location+"");var v,h,g=y.g.document;if(!h&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(h=g.currentScript.src),!h)){var w=g.getElementsByTagName("script");if(w.length)for(var x=w.length-1;x>-1&&(!h||!/^http(s?):/.test(h));)h=w[x--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");y.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},y.f.j=function(e,t){var r=y.o(f,e)?f[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=f[e]=[t,n]});t.push(r[2]=n);var o=y.p+y.u(e),i=Error();y.l(o,function(t){if(y.o(f,e)&&(0!==(r=f[e])&&(f[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",i.name="ChunkLoadError",i.type=n,i.request=o,r[1](i)}},"chunk-"+e,e)}},p=function(e,t){var r,n,o=t[0],i=t[1],a=t[2],u=0;if(o.some(function(e){return 0!==f[e]})){for(r in i)y.o(i,r)&&(y.m[r]=i[r]);a&&a(y)}for(e&&e(t);u<o.length;u++)n=o[u],y.o(f,n)&&f[n]&&f[n][0](),f[n]=0},(d=self.webpackChunk_nocobase_plugin_users=self.webpackChunk_nocobase_plugin_users||[]).forEach(p.bind(null,0)),d.push=p.bind(null,d.push.bind(d));var P={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-users/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var n=window.location.pathname||"/",o=n.indexOf("/v2/");e=o>=0?n.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-users/dist/client/"}y.p=e}(),!function(){y.r(P),y.d(P,{default:function(){return B}});var e,t,r,n=y(342),o=y(768),i=y(79),a=y.n(i),u=y(230),c=y(166),l=y(953),s=y(442),f=y(155),p=y.n(f);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function b(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){b(i,n,o,a,u,"next",e)}function u(e){b(i,n,o,a,u,"throw",e)}a(void 0)})}}function v(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var h=function(){var e=(0,n.useActionContext)().setVisible,t=(0,u.useForm)();return{run:function(){return m(function(){return v(this,function(r){switch(r.label){case 0:return e(!1),[4,t.reset()];case 1:return r.sent(),[2]}})})()}}},g=function(){var e=(0,s.useNavigate)(),t=(0,n.useActionContext)().setVisible,r=(0,u.useForm)(),o=(0,n.useAPIClient)();return{run:function(){return m(function(){return v(this,function(n){switch(n.label){case 0:return[4,r.submit()];case 1:return n.sent(),[4,o.resource("auth").changePassword({values:r.values})];case 2:return n.sent(),[4,r.reset()];case 3:return n.sent(),t(!1),e("/signin"),[2]}})})()}}},w={type:"object",properties:(e={},t=(0,c.uid)(),r={"x-decorator":"Form","x-component":"Action.Drawer","x-component-props":{zIndex:2e3},type:"void",title:'{{t("Change password")}}',properties:{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-validator":{password:!0},"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") : ""}}'}}}]},footer:{"x-component":"Action.Drawer.Footer",type:"void",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ useCloseAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSaveCurrentUserValues }}"}}}}}},t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e)},x=function(){var e,t=(0,f.useContext)(n.DropdownVisibleContext),r=function(e){if(Array.isArray(e))return e}(e=(0,f.useState)(!1))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,a=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(a)throw r}}return o}}(e)||function(e){if(e){if("string"==typeof e)return d(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return d(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=r[0],i=r[1],a=(0,l.useTranslation)().t,u=((0,n.useSystemSettings)()||{}).data,c=((null==u?void 0:u.data)||{}).enableChangePassword,s=(0,n.useZIndexContext)()+10,b=(0,f.useCallback)(function(e){var r;e.stopPropagation(),null==t||null==(r=t.setVisible)||r.call(t,!1),i(function(e){return!e||e})},[t]),m=(0,f.useMemo)(function(){return p().createElement(n.SchemaComponentContext.Provider,{value:{designable:!1}},p().createElement(n.SchemaComponent,{scope:{useCloseAction:h,useSaveCurrentUserValues:g},schema:w}))},[s]);return!1===c?null:p().createElement(n.zIndexContext.Provider,{value:s},p().createElement(n.SchemaSettingsItem,{eventKey:"changePassword",title:"changePassword"},p().createElement("div",{onClick:b},a("Change password"))),p().createElement(n.ActionContextProvider,{value:{visible:o,setVisible:i}},o&&p().createElement("div",{onClick:function(e){return e.stopPropagation()}},m)))};function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function S(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){O(e,t,r[t])})}return e}var k=function(){var e=(0,n.useCurrentUserContext)(),t=(0,n.useActionContext)().setVisible,r=(0,u.useForm)(),o=(0,n.useAPIClient)(),i=(0,u.useFieldSchema)(),a=(0,u.useField)(),c=(0,n.useCollectValuesToSubmit)();return{type:"primary",htmlType:"submit",onClick:function(){var n;return(n=function(){var n,u,l,s,f;return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(p){switch(p.label){case 0:if(l=(u=null!=(n=null==i?void 0:i["x-action-settings"])?n:{}).triggerWorkflows,u.skipValidator)return[3,2];return[4,r.submit()];case 1:p.sent(),p.label=2;case 2:return[4,c()];case 3:s=p.sent(),a.data=a.data||{},a.data.loading=!0,p.label=4;case 4:return p.trys.push([4,7,,8]),[4,o.resource("users").updateProfile({values:s,triggerWorkflows:(null==l?void 0:l.length)?l.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 5:return p.sent(),e.mutate({data:j({},null==e||null==(f=e.data)?void 0:f.data,s)}),[4,r.reset()];case 6:return p.sent(),a.data.loading=!1,t(!1),[3,8];case 7:return p.sent(),a.data.loading=!1,[3,8];case 8:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){S(i,r,o,a,u,"next",e)}function u(e){S(i,r,o,a,u,"throw",e)}a(void 0)})})()}}},E=function(){var e,t=((0,n.useCurrentUserContext)()||{}).data;return{params:{filterByTk:null==t||null==(e=t.data)?void 0:e.id}}},A=function(){var e=(0,n.useActionContext)().setVisible;return{type:"default",onClick:function(){e(!1)}}},I=function(){var e=(0,f.useContext)(n.DropdownVisibleContext),t=(0,n.useCollectionManager)().getCollection("users"),r=(0,f.useMemo)(function(){var e,r;return e=j({},t),r=r={name:"users",fields:t.fields.filter(function(e){return!["password","roles"].includes(e.name)})},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e},[t]);return(0,f.useEffect)(function(){null==e||e.setVisible(!1)},[e]),p().createElement(n.ExtendCollectionsProvider,{collections:[r]},p().createElement(n.RemoteSchemaComponent,{uid:"nocobase-user-profile-edit-form",noForm:!0,scope:{useUpdateProfileActionProps:k,useEditFormBlockDecoratorProps:E,useCancelActionProps:A}}))},_=function(){var e,t,r=(0,f.useContext)(n.DropdownVisibleContext),o=function(e){if(Array.isArray(e))return e}(e=(0,f.useState)(!1))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,a=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(a)throw r}}return o}}(e)||function(e){if(e){if("string"==typeof e)return C(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return C(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=o[0],a=o[1],u=(0,l.useTranslation)().t,s=((0,n.useSystemSettings)()||{}).data,d=(null!=(t=null==s?void 0:s.data)?t:{}).enableEditProfile,b=(0,n.useZIndexContext)()+10,m=(0,f.useCallback)(function(e){var t;e.stopPropagation(),null==r||null==(t=r.setVisible)||t.call(r,!1),a(function(e){return!e||e})},[r]),y=(0,f.useMemo)(function(){return p().createElement(n.SchemaComponent,{components:{ProfileEditForm:I},schema:{type:"object",properties:O({},(0,c.uid)(),{"x-component":"Action.Drawer","x-component-props":{zIndex:b},type:"void",title:'{{t("Edit profile")}}',properties:{form:{type:"void","x-component":"ProfileEditForm"}}})}})},[b]);return!1===d?null:p().createElement(n.zIndexContext.Provider,{value:b},p().createElement(n.SchemaSettingsItem,{eventKey:"EditProfile",title:"EditProfile"},p().createElement("div",{onClick:m},u("Edit profile"))),p().createElement(n.ActionContextProvider,{value:{visible:i,setVisible:a}},i&&p().createElement("div",{onClick:function(e){return e.stopPropagation()}},y)))},T=function(){var e,t,r,o=(0,n.useCurrentUserContext)().data,i=(0,n.useToken)().token;return p().createElement(n.SchemaSettingsItem,{disabled:!0,eventKey:"nickname",title:"nickname"},p().createElement("span",{"aria-disabled":"false",style:{cursor:"text",color:i.colorTextDescription}},(null==o||null==(e=o.data)?void 0:e.nickname)||(null==o||null==(t=o.data)?void 0:t.username)||(null==o||null==(r=o.data)?void 0:r.email)))};function U(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}var q=function(){var e=(0,l.useTranslation)().t,t=(0,n.useNavigateNoUpdate)(),r=(0,n.useAPIClient)();return p().createElement(n.SchemaSettingsItem,{title:"signOut",eventKey:"signOut",onClick:function(){var e;return(e=function(){var e,n;return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:return[4,r.auth.signOut()];case 1:return(null==(n=o.sent().data)||null==(e=n.data)?void 0:e.redirect)?window.location.href=n.data.redirect:t("/signin?redirect=".concat(encodeURIComponent("")),{replace:!0}),[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){U(i,n,o,a,u,"next",e)}function u(e){U(i,n,o,a,u,"throw",e)}a(void 0)})})()}},e("Sign out"))};function M(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}function F(e,t,r){return(F=N()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&V(o,r.prototype),o}).apply(null,arguments)}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function V(e,t){return(V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(e){var t="function"==typeof Map?new Map:void 0;return(D=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return F(e,arguments,$(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),V(r,e)})(e)}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}(0,n.lazy)(function(){return y.e("821").then(y.bind(y,404))},"UsersProvider").UsersProvider;var R=(0,n.lazy)(function(){return Promise.all([y.e("49"),y.e("825")]).then(y.bind(y,616))},"UsersManagement").UsersManagement,z=(0,n.lazy)(function(){return Promise.all([y.e("49"),y.e("772")]).then(y.bind(y,687))},"RoleUsersManager").RoleUsersManager,B=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=$(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,N()?Reflect.construct(e,t||[],$(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&V(r,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.pluginSettingsManager.add("users-permissions",{title:(0,o.tval)("Users & Permissions",{ns:"users"}),isPinned:!0,sort:200,icon:"TeamOutlined"}),this.app.pluginSettingsManager.add("users-permissions.users",{title:(0,o.tval)("Users"),icon:"UserOutlined",Component:R,aclSnippet:"pm.users"}),this.app.pm.get(a()).rolesManager.add("users",{title:(0,o.tval)("Users"),Component:z}),this.app.addUserCenterSettingsItem({name:"nickName",Component:T,sort:0}),this.app.addUserCenterSettingsItem({name:"divider1",type:"divider",sort:10}),this.app.addUserCenterSettingsItem({name:"editProfile",Component:_,sort:50}),this.app.addUserCenterSettingsItem({name:"changePassword",Component:x,sort:100}),this.app.addUserCenterSettingsItem({name:"divider_signOut",type:"divider",sort:900}),this.app.addUserCenterSettingsItem({name:"signOut",Component:q,sort:1e3}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){M(i,n,o,a,u,"next",e)}function u(e){M(i,n,o,a,u,"throw",e)}a(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(D(n.Plugin))}(),P}()});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { default } from './plugin';
|
|
10
|
+
export * from './plugin';
|
|
11
|
+
export * from './locale';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("react-i18next"),require("@nocobase/client-v2"),require("react-router-dom"),require("react"),require("antd"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-users/client-v2",["ahooks","react-i18next","@nocobase/client-v2","react-router-dom","react","antd","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-users/client-v2"]=t(require("ahooks"),require("react-i18next"),require("@nocobase/client-v2"),require("react-router-dom"),require("react"),require("antd"),require("@nocobase/flow-engine")):e["@nocobase/plugin-users/client-v2"]=t(e.ahooks,e["react-i18next"],e["@nocobase/client-v2"],e["react-router-dom"],e.react,e.antd,e["@nocobase/flow-engine"])}(self,function(e,t,r,n,o,a,i){return function(){"use strict";var u={485:function(e){e.exports=r},694:function(e){e.exports=i},625:function(t){t.exports=e},59:function(e){e.exports=a},155:function(e){e.exports=o},953:function(e){e.exports=t},442:function(e){e.exports=n}},c={};function l(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={exports:{}};return u[e](r,r.exports,l),r.exports}l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,{a:t}),t},l.d=function(e,t){for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.g.importScripts&&(s=l.g.location+"");var s,f=l.g.document;if(!s&&f&&(f.currentScript&&"SCRIPT"===f.currentScript.tagName.toUpperCase()&&(s=f.currentScript.src),!s)){var p=f.getElementsByTagName("script");if(p.length)for(var d=p.length-1;d>-1&&(!s||!/^http(s?):/.test(s));)s=p[d--].src}if(!s)throw Error("Automatic publicPath is not supported in this browser");l.p=s.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var b={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-users/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var n=window.location.pathname||"/",o=n.indexOf("/v2/");e=o>=0?n.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-users/dist/client-v2/"}l.p=e}(),!function(){l.r(b),l.d(b,{PluginUsersClientV2:function(){return $},NAMESPACE:function(){return c},default:function(){return B},useUsersTranslation:function(){return s}});var e=l(485),t=l(694),r=l(625),n=l(59),o=l(155),a=l.n(o),i=l(442),u=l(953),c="users";function s(){return(0,u.useTranslation)([c,"client"],{nsMode:"fallback"})}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){p(a,n,o,i,u,"next",e)}function u(e){p(a,n,o,i,u,"throw",e)}i(void 0)})}}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,u=!1;try{for(o=o.call(e);!(i=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){u=!0,n=e}finally{try{i||null==o.return||o.return()}finally{if(u)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(w=function(){return!!e})()}function g(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){var l=[u,c];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function P(){var u=s().t,c=(0,t.useFlowContext)(),l=(0,i.useNavigate)(),f=m(n.Form.useForm(),1)[0],p=m((0,o.useState)(!1),2),b=p[0],h=p[1],y=m((0,o.useState)(""),2),v=y[0],w=y[1],P=(0,r.useMemoizedFn)(function(e,t){return d(function(){var e,r,n,o,a,i,u,l,s,f,p,d,b;return g(this,function(h){switch(h.label){case 0:if("string"!=typeof t||!t)return[2];i=(null==(a=null==(n=c.app)||null==(r=n.pm)||null==(e=r.get)?void 0:e.call(r,$))||null==(o=a.getPasswordValidators)?void 0:o.call(a))||[],u=!0,l=!1,s=void 0,h.label=1;case 1:h.trys.push([1,6,7,8]),f=i[Symbol.iterator](),h.label=2;case 2:if(u=(p=f.next()).done)return[3,5];return[4,(0,p.value)(t,{username:void 0})];case 3:if(d=h.sent())throw Error(d);h.label=4;case 4:return u=!0,[3,2];case 5:return[3,8];case 6:return b=h.sent(),l=!0,s=b,[3,8];case 7:try{u||null==f.return||f.return()}finally{if(l)throw s}return[7];case 8:return[2]}})})()}),x=(0,r.useMemoizedFn)(function(){return d(function(){var e,t,r,n,o,a;return g(this,function(i){switch(i.label){case 0:return[4,f.validateFields()];case 1:e=i.sent(),w(""),h(!0),i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,c.api.resource("auth").changePassword({values:e})];case 3:return i.sent(),f.resetFields(),l("/signin"),[3,6];case 4:throw w((null==(t=i.sent())||null==(a=t.response)||null==(o=a.data)||null==(n=o.errors)||null==(r=n[0])?void 0:r.message)||(null==t?void 0:t.message)||String(t)),t;case 5:return h(!1),[7];case 6:return[2]}})})()});return a().createElement(e.DrawerFormLayout,{title:u("Change password"),onSubmit:x,submitting:b,submitText:u("Submit"),cancelText:u("Cancel")},a().createElement(n.Form,{form:f,layout:"vertical"},v?a().createElement(n.Alert,{type:"error",showIcon:!0,message:v,style:{marginBottom:16}}):null,a().createElement(n.Form.Item,{name:"oldPassword",label:u("Old password"),rules:[{required:!0,message:u("Please enter the old password")}]},a().createElement(e.PasswordInput,{autoComplete:"current-password"})),a().createElement(n.Form.Item,{name:"newPassword",label:u("New password"),rules:[{required:!0,message:u("Please enter the new password")},{validator:P}]},a().createElement(e.PasswordInput,{autoComplete:"new-password",checkStrength:!0})),a().createElement(n.Form.Item,{name:"confirmPassword",label:u("Confirm password"),dependencies:["newPassword"],rules:[{required:!0,message:u("Please confirm the new password")},function(e){var t=e.getFieldValue;return{validator:function(e,r){return r&&t("newPassword")!==r?Promise.reject(Error(u("Password mismatch"))):Promise.resolve()}}}]},a().createElement(e.PasswordInput,{autoComplete:"new-password",checkStrength:!0}))))}var x=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=y(t),h(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,w()?Reflect.construct(t,n||[],y(this).constructor):t.apply(this,n)),"section","profile"),h(e,"sort",100),h(e,"label","Change password"),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&v(r,e),t=[{key:"prepare",value:function(){return d(function(){var e,t,r;return g(this,function(n){switch(n.label){case 0:return[4,this.context.systemSettings.load()];case 1:return r=null==(t=n.sent())||null==(e=t.data)?void 0:e.enableChangePassword,this.ready=!1!==r,[2]}})}).call(this)}},{key:"onClick",value:function(){return d(function(){return g(this,function(e){return this.context.viewer.drawer({width:"50%",closable:!0,content:function(){return a().createElement(P,null)}}),[2]})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(e.UserCenterActionItemModel);function O(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}function S(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){O(a,n,o,i,u,"next",e)}function u(e){O(a,n,o,i,u,"throw",e)}i(void 0)})}}function j(e,t,r){return t=T(t),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,A()?Reflect.construct(t,r||[],T(e).constructor):t.apply(e,r))}function _(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function k(e,t,r){return(k=A()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&q(o,r.prototype),o}).apply(null,arguments)}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t&&E(e.prototype,t),r&&E(e,r),e}function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&q(e,t)}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e){var t="function"==typeof Map?new Map:void 0;return(F=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return k(e,arguments,T(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),q(r,e)})(e)}function A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(A=function(){return!!e})()}function V(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){var l=[u,c];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}h(x,"itemId","change-password");var R=function(e){function t(){var e;return _(this,t),e=j(this,t,arguments),I(e,"section","profile"),I(e,"sort",0),e}return M(t,e),C(t,[{key:"prepare",value:function(){return S(function(){var e;return V(this,function(t){return e=this.context.user||{},this.label=e.nickname||e.username||e.email||"",this.value=void 0,this.description=void 0,this.ready=!!this.label,[2]})}).call(this)}}]),t}(e.UserCenterTextItemModel);I(R,"itemId","current-user-summary");var U=function(t){function r(){var e;return _(this,r),e=j(this,r,arguments),I(e,"section","danger"),I(e,"sort",1e3),I(e,"label","Sign out"),e}return M(r,t),C(r,[{key:"onClick",value:function(){return S(function(){var t,r,n,o;return V(this,function(a){switch(a.label){case 0:return[4,this.context.api.auth.signOut()];case 1:if(n=a.sent(),o=(0,e.resolveV2SigninRedirect)(null==n||null==(r=n.data)||null==(t=r.data)?void 0:t.redirect,this.context.app))return window.location.replace(o),[2];return(0,e.redirectToV2Signin)(this.context.app,(0,e.getCurrentV2RedirectPath)(this.context.app,window.location),{replace:!0}),[2]}})}).call(this)}}]),r}(e.UserCenterActionItemModel);I(U,"itemId","sign-out");var $=function(e){function t(){var e;return _(this,t),e=j(this,t,arguments),I(e,"passwordValidators",new Map),e}return M(t,e),C(t,[{key:"registerPasswordValidator",value:function(e,t){this.passwordValidators.set(e,t)}},{key:"unregisterPasswordValidator",value:function(e){this.passwordValidators.delete(e)}},{key:"getPasswordValidators",value:function(){return Array.from(this.passwordValidators.values())}},{key:"load",value:function(){return S(function(){return V(this,function(e){return this.app.flowEngine.registerModels({ChangePasswordItemModel:x,CurrentUserSummaryItemModel:R,SignOutItemModel:U}),[2]})}).call(this)}}]),t}(F(e.Plugin)),B=$}(),b}()});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const NAMESPACE = "users";
|
|
10
|
+
export declare function useUsersTranslation(): import("react-i18next").UseTranslationResponse<("users" | "client")[], undefined>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from '@nocobase/client-v2';
|
|
10
|
+
/**
|
|
11
|
+
* Async password validator contributed by another plugin (typically `@nocobase/plugin-password-policy`). Receives the candidate password and an optional `username` (matching v1's `verifyPasswordRules` third argument). Resolve with `null` / `undefined` for valid input, or with the already-translated error message for invalid input — the validator owns its own i18n namespace so consumers don't need to know how to interpolate the policy plugin's `{{n}}` placeholders.
|
|
12
|
+
*/
|
|
13
|
+
export type PasswordValidator = (value: string, ctx: {
|
|
14
|
+
username?: string;
|
|
15
|
+
}) => Promise<string | null | undefined>;
|
|
16
|
+
export declare class PluginUsersClientV2 extends Plugin {
|
|
17
|
+
private passwordValidators;
|
|
18
|
+
/**
|
|
19
|
+
* Register a password validator under a stable name. Re-registering the same name overwrites — useful for HMR and for tests that swap in a stub. Downstream plugins should register in their `load()` after `app.pm.get(PluginUsersClientV2)` resolves.
|
|
20
|
+
*/
|
|
21
|
+
registerPasswordValidator(name: string, validator: PasswordValidator): void;
|
|
22
|
+
unregisterPasswordValidator(name: string): void;
|
|
23
|
+
getPasswordValidators(): PasswordValidator[];
|
|
24
|
+
load(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export default PluginUsersClientV2;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { UserCenterActionItemModel } from '@nocobase/client-v2';
|
|
10
|
+
/**
|
|
11
|
+
* "Change password" entry in the User Center dropdown. Section `profile` with sort 100 puts it between `CurrentUserSummaryItemModel` (sort 0) and `SignOutItemModel` (sort 1000) — same neighborhood as v1.
|
|
12
|
+
*
|
|
13
|
+
* `prepare()` reads `systemSettings.enableChangePassword`; when the admin has explicitly disabled it, `ready = false` removes the entry from the dropdown. Undefined / true both leave the entry visible (matches v1: only an explicit `=== false` hides it).
|
|
14
|
+
*/
|
|
15
|
+
export declare class ChangePasswordItemModel extends UserCenterActionItemModel {
|
|
16
|
+
static itemId: string;
|
|
17
|
+
section: "profile";
|
|
18
|
+
sort: number;
|
|
19
|
+
label: string;
|
|
20
|
+
prepare(): Promise<void>;
|
|
21
|
+
onClick(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export default ChangePasswordItemModel;
|
package/dist/externalVersion.js
CHANGED
|
@@ -13,17 +13,20 @@ module.exports = {
|
|
|
13
13
|
"react-i18next": "11.18.6",
|
|
14
14
|
"react-router-dom": "6.30.1",
|
|
15
15
|
"react": "18.2.0",
|
|
16
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
16
|
+
"@nocobase/client": "2.1.0-alpha.45",
|
|
17
17
|
"antd": "5.24.2",
|
|
18
18
|
"@formily/core": "2.3.7",
|
|
19
|
-
"@nocobase/plugin-acl": "2.1.0-alpha.
|
|
19
|
+
"@nocobase/plugin-acl": "2.1.0-alpha.45",
|
|
20
20
|
"@emotion/css": "11.13.0",
|
|
21
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
22
|
-
"@nocobase/
|
|
23
|
-
"@nocobase/
|
|
24
|
-
"@nocobase/
|
|
25
|
-
"@nocobase/plugin-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
21
|
+
"@nocobase/utils": "2.1.0-alpha.45",
|
|
22
|
+
"@nocobase/client-v2": "2.1.0-alpha.45",
|
|
23
|
+
"@nocobase/database": "2.1.0-alpha.45",
|
|
24
|
+
"@nocobase/server": "2.1.0-alpha.45",
|
|
25
|
+
"@nocobase/plugin-user-data-sync": "2.1.0-alpha.45",
|
|
26
|
+
"@nocobase/plugin-ui-schema-storage": "2.1.0-alpha.45",
|
|
27
|
+
"lodash": "4.18.1",
|
|
28
|
+
"@nocobase/flow-engine": "2.1.0-alpha.45",
|
|
29
|
+
"ahooks": "3.7.8",
|
|
30
|
+
"@nocobase/actions": "2.1.0-alpha.45",
|
|
28
31
|
"sequelize": "6.35.2"
|
|
29
32
|
};
|
package/package.json
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"description": "Provides basic user model, as well as created by and updated by fields.",
|
|
7
7
|
"description.ru-RU": "Предоставляет базовую модель пользователя, а также поля кем, когда «создано» и «обновлено».",
|
|
8
8
|
"description.zh-CN": "提供了基础的用户模型,以及创建人和最后更新人字段。",
|
|
9
|
-
"version": "2.1.0-alpha.
|
|
10
|
-
"license": "
|
|
9
|
+
"version": "2.1.0-alpha.45",
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/users",
|
|
13
13
|
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/users",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@nocobase/actions": "2.x",
|
|
21
21
|
"@nocobase/client": "2.x",
|
|
22
|
+
"@nocobase/client-v2": "2.x",
|
|
22
23
|
"@nocobase/database": "2.x",
|
|
23
24
|
"@nocobase/plugin-acl": "2.x",
|
|
24
25
|
"@nocobase/plugin-auth": "2.x",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"@nocobase/test": "2.x",
|
|
31
32
|
"@nocobase/utils": "2.x"
|
|
32
33
|
},
|
|
33
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "e9e24987e12d0ad10a5db8815b1e1b7b447f1938",
|
|
34
35
|
"keywords": [
|
|
35
36
|
"Users & permissions"
|
|
36
37
|
]
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_users=self.webpackChunk_nocobase_plugin_users||[]).push([["74"],{281:function(e,t,n){n.r(t),n.d(t,{UsersManagement:function(){return B}});var r=n(964),o=n(563),a=n(505),u=n(772),i=n(721),s=n(156),l=n.n(s),c=n(990),f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n="abcdefghijklmnopqrstuvwxyz",r="0123456789",o="!#$%^&*-_+=",a=t+n+r+o,u=new Uint32Array(e);crypto.getRandomValues(u);var i="";i+=t.charAt(u[0]%t.length),i+=n.charAt(u[1]%n.length),i+=r.charAt(u[2]%r.length),i+=o.charAt(u[3]%o.length);for(var s=4;s<e;s++){var l=u[s]%a.length;i+=a.charAt(l)}return i[0]+i.slice(1).split("").sort(function(){return Math.random()-.5}).join("")};function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var m=function(){var e,t=(0,c.B)().t,n=(0,a.useField)(),r=(e=l().useState(!1),function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],u=!0,i=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){i=!0,r=e}finally{try{u||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,2)||function(e,t){if(e){if("string"==typeof e)return p(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],m=r[1],b=(0,u.useActionContext)();return(0,s.useEffect)(function(){b.visible||n.reset()},[n,b.visible]),(0,s.useEffect)(function(){n.value&&n.validate()},[n.value]),l().createElement(i.Row,{gutter:10},l().createElement(i.Col,{span:18},l().createElement(u.Password,{checkStrength:!0,visibilityToggle:{visible:o,onVisibleChange:m},value:n.value,onChange:function(e){return n.setValue(e.target.value)},autoComplete:"new-password"})),l().createElement(i.Col,{span:4},l().createElement(i.Button,{onClick:function(){n.setValue(f()),m(!0)}},t("Random password"))))},b=n(752);function v(e,t,n,r,o,a,u){try{var i=e[a](u),s=i.value}catch(e){n(e);return}i.done?t(s):Promise.resolve(s).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){v(a,r,o,u,i,"next",e)}function i(e){v(a,r,o,u,i,"throw",e)}u(void 0)})}}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function g(e,t){var n,r,o,a,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var s=[a,i];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return u.label++,{value:s[1],done:!1};case 5:u.label++,r=s[1],s=[0];continue;case 7:s=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){u=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){u.label=s[1];break}if(6===s[0]&&u.label<o[1]){u.label=o[1],o=s;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(s);break}o[2]&&u.ops.pop(),u.trys.pop();continue}s=t.call(e,u)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}function C(){var e,t,n=(e=["\n .ant-tabs-nav {\n margin-bottom: 0px;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return C=function(){return n},n}var w=function(){var e=(0,u.useActionContext)().setVisible,t=(0,a.useForm)();return{type:"default",onClick:function(){e(!1),t.reset()}}},P=function(){var e=(0,u.useActionContext)().setVisible,t=i.App.useApp().message,n=(0,a.useForm)(),r=(0,u.useDataBlockResource)(),o=(0,u.useDataBlockRequest)().refresh,s=(0,c.B)().t,l=(0,u.useCollection)();return{htmlType:"submit",type:"primary",onClick:function(){return d(function(){var a;return g(this,function(u){switch(u.label){case 0:return[4,n.submit()];case 1:if(u.sent(),!(a=n.values)[l.filterTargetKey])return[3,3];return[4,r.update({values:a,filterByTk:a[l.filterTargetKey]})];case 2:return u.sent(),[3,5];case 3:return[4,r.create({values:a})];case 4:u.sent(),u.label=5;case 5:return o(),t.success(s("Saved successfully")),e(!1),n.reset(),[2]}})})()}}},S=function(){var e=(0,u.useCollectionRecordData)();return{form:(0,s.useMemo)(function(){return(0,o.createForm)({initialValues:e})},[e])}},E=function(){return l().createElement(u.RemoteSchemaComponent,{uid:"nocobase-admin-profile-create-form",noForm:!0})},O=function(){var e=(0,u.useCollectionManager)().getCollection("users"),t=h(y({},e),{name:"users",fields:e.fields.filter(function(e){return"password"!==e.name})});return l().createElement(u.ExtendCollectionsProvider,{collections:[t]},l().createElement(u.RemoteSchemaComponent,{uid:"nocobase-admin-profile-edit-form",noForm:!0,scope:{useCancelActionProps:w}}))},A=function(){var e=(0,u.useSchemaComponentContext)();return l().createElement(u.SchemaComponentContext.Provider,{value:h(y({},e),{designable:!1})},l().createElement(u.SchemaComponent,{schema:{type:"void",properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"}}}}}))},j=function(){var e=(0,c.B)().t,t=(0,u.useCollectionManager)();return(0,s.useMemo)(function(){return null==t?void 0:t.getCollection("users")},[t])?l().createElement(u.SchemaComponent,{schema:b.SN,scope:{t:e,useCancelActionProps:w,useSubmitActionProps:P,useEditFormProps:S},components:{PasswordField:m,ProfileEditForm:O,ProfileCreateForm:E,FilterAction:A}}):l().createElement(i.Spin,null)},k=(0,s.createContext)({}),F=function(e){var t=(0,u.useRequest)({url:"users:getSystemSettings"});return l().createElement(k.Provider,{value:t},e.children)},x=function(){var e=(0,c.B)().t,t=(0,a.useForm)();return l().createElement(u.SchemaComponent,{schema:b.eF,scope:{t:e,useFormBlockProps:function(){var e,n=(0,s.useContext)(k),r=(null==n||null==(e=n.data)?void 0:e.data)||{},o=r.enableChangePassword,a=r.enableEditProfile;return(0,s.useEffect)(function(){null==t||t.setValues({enableChangePassword:!1!==o,enableEditProfile:!1!==a})},[n]),{form:t}},useSubmitActionProps:function(){var t=(0,u.useAPIClient)(),n=(0,a.useForm)();return{type:"primary",onClick:function(){return d(function(){var r;return g(this,function(o){switch(o.label){case 0:return[4,n.submit()];case 1:return o.sent(),r=n.values,[4,t.request({url:"users:updateSystemSettings",data:r,method:"POST"})];case 2:return o.sent(),i.message.success(e("Saved successfully")),window.location.reload(),[2]}})})()}}}},components:{UsersSettingsProvider:F}})},B=function(){var e=(0,c.B)().t;return l().createElement(i.Tabs,{defaultActiveKey:"usersManager",type:"card",className:(0,r.css)(C()),items:[{label:e("Users manager"),key:"usersManager",children:l().createElement(j,null)},{label:e("Settings"),key:"usersSettings",children:l().createElement(x,null)}]})}}}]);
|