@nocobase/plugin-users 2.1.0-beta.8 → 2.2.0-alpha.1
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/client-v2-api.md +193 -0
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client/49.919f2c983a959288.js +10 -0
- package/dist/client/70.a415ef0ddba902d8.js +10 -0
- package/dist/client/772.61c09631dd20ae13.js +10 -0
- package/dist/client/821.8ca2f675db381516.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client/utils.d.ts +1 -1
- package/dist/client-v2/143.8fc4573e64ec8c3f.js +10 -0
- package/dist/client-v2/521.2dfe166044cc9992.js +10 -0
- package/dist/client-v2/564.fd2267ba191f2206.js +10 -0
- package/dist/client-v2/569.07f16da700ba0ba6.js +10 -0
- package/dist/client-v2/587.a15f1f5b0dbbf4d5.js +10 -0
- package/dist/client-v2/784.25ee62a1613da5a6.js +10 -0
- package/dist/client-v2/786.ca0dea7bc67662c3.js +10 -0
- package/dist/client-v2/862.2aac0dea47472edf.js +10 -0
- package/dist/client-v2/917.2202b84c00ddfbdc.js +10 -0
- package/dist/client-v2/components/resource/ResourceFormDrawer.d.ts +33 -0
- package/dist/client-v2/components/resource/ResourcePickerView.d.ts +46 -0
- package/dist/client-v2/components/resource/ResourceTablePage.d.ts +50 -0
- package/dist/client-v2/components/resource/SettingsActionCell.d.ts +39 -0
- package/dist/client-v2/components/resource/index.d.ts +12 -0
- package/dist/client-v2/index.d.ts +11 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +14 -0
- package/dist/client-v2/models/UserPasswordFieldModel.d.ts +16 -0
- package/dist/client-v2/models/UserProfileFormModels.d.ts +19 -0
- package/dist/client-v2/models/UserRolesSelectFieldModel.d.ts +14 -0
- package/dist/client-v2/pages/ChangeUserPasswordDrawer.d.ts +15 -0
- package/dist/client-v2/pages/RoleUsersManager.d.ts +11 -0
- package/dist/client-v2/pages/UserFormDrawer.d.ts +15 -0
- package/dist/client-v2/pages/UsersManagementPage.d.ts +10 -0
- package/dist/client-v2/pages/UsersSettingsForm.d.ts +10 -0
- package/dist/client-v2/pages/types.d.ts +30 -0
- package/dist/client-v2/plugin.d.ts +26 -0
- package/dist/client-v2/shared/adminProfileFormModels.d.ts +15 -0
- package/dist/client-v2/shared/generatePassword.d.ts +9 -0
- package/dist/client-v2/user-center/ChangePasswordItemModel.d.ts +23 -0
- package/dist/client-v2/user-center/CurrentUserSummaryItemModel.d.ts +16 -0
- package/dist/client-v2/user-center/EditProfileItemModel.d.ts +18 -0
- package/dist/client-v2/user-center/SignOutItemModel.d.ts +17 -0
- package/dist/externalVersion.js +14 -9
- package/dist/locale/en-US.json +12 -1
- package/dist/locale/zh-CN.json +12 -1
- package/dist/server/collections/users.js +1 -0
- package/dist/server/user-data-sync-resource.d.ts +5 -1
- package/dist/server/user-data-sync-resource.js +3 -0
- package/package.json +3 -2
- 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
|
@@ -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_client_v2=self.webpackChunk_nocobase_plugin_users_client_v2||[]).push([["784"],{467:function(e,t,r){r.r(t),r.d(t,{EditProfileItemModel:function(){return E}});var n=r(485),o=r(694),u=r(625),l=r(59),a=r(155),i=r.n(a),c=r(488);function s(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 f(e,t,r,n,o,u,l){try{var a=e[u](l),i=a.value}catch(e){r(e);return}a.done?t(i):Promise.resolve(i).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var u=e.apply(t,r);function l(e){f(u,n,o,l,a,"next",e)}function a(e){f(u,n,o,l,a,"throw",e)}l(void 0)})}}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(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 u=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(u.push(r.value),!t||u.length!==t);l=!0);}catch(e){a=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw n}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(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 s(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 v(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function g(e,t){var r,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:i(0)}),a(l,"throw",{value:i(1)}),a(l,"return",{value:i(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function i(a){return function(i){var c=[a,i];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(u=0)),u;)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 u.label++,{value:c[1],done:!1};case 5:u.label++,n=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=t.call(e,u)}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}}}}function w(){var e,t,r,s,f=(0,o.useFlowContext)(),p=(0,c.kj)(),b=l.theme.useToken().token,y=h(l.Form.useForm(),1)[0],d=h((0,a.useState)(!1),2),w=d[0],E=d[1],k=h((0,a.useState)(""),2),_=k[0],O=k[1],j=(0,a.useMemo)(function(){var e,t,r,n;return{nickname:null==(e=f.user)?void 0:e.nickname,username:null==(t=f.user)?void 0:t.username,email:null==(r=f.user)?void 0:r.email,phone:null==(n=f.user)?void 0:n.phone}},[null==(e=f.user)?void 0:e.email,null==(t=f.user)?void 0:t.nickname,null==(r=f.user)?void 0:r.phone,null==(s=f.user)?void 0:s.username]);(0,a.useEffect)(function(){y.setFieldsValue(j)},[y,j]);var I=(0,u.useMemoizedFn)(function(){return m(function(){var e,t,r,n,o,u,l;return g(this,function(a){switch(a.label){case 0:return[4,y.validateFields()];case 1:e=a.sent(),O(""),E(!0),a.label=2;case 2:return a.trys.push([2,4,5,6]),[4,f.api.resource("users").updateProfile({values:e})];case 3:return a.sent(),f.user&&"object"===v(f.user)&&Object.assign(f.user,e),y.resetFields(),[3,6];case 4:throw O((null==(l=t=a.sent())||null==(u=l.response)||null==(o=u.data)||null==(n=o.errors)||null==(r=n[0])?void 0:r.message)||(null==l?void 0:l.message)||String(t)),t;case 5:return E(!1),[7];case 6:return[2]}})})()});return i().createElement(n.DrawerFormLayout,{title:p("Edit profile"),onSubmit:I,submitting:w,submitText:p("Submit"),cancelText:p("Cancel")},i().createElement(l.Form,{form:y,layout:"vertical"},_?i().createElement(l.Alert,{type:"error",showIcon:!0,message:_,style:{marginBottom:b.marginMD}}):null,i().createElement(l.Form.Item,{name:"nickname",label:p("Nickname")},i().createElement(l.Input,{autoComplete:"name"})),i().createElement(l.Form.Item,{name:"username",label:p("Username"),rules:[{required:!0,message:p("Username is required")},{validator:function(e,t){return m(function(){return g(this,function(e){if(!t||"string"==typeof t&&/^[^@<>"'/]{1,50}$/.test(t))return[2];throw Error(p("Must be 1-50 characters in length (excluding @.<>\"'/)"))})})()}}]},i().createElement(l.Input,{autoComplete:"username"})),i().createElement(l.Form.Item,{name:"email",label:p("Email"),rules:[{type:"email",message:p("Please enter a valid email address")}]},i().createElement(l.Input,{autoComplete:"email"})),i().createElement(l.Form.Item,{name:"phone",label:p("Phone")},i().createElement(l.Input,{autoComplete:"tel"}))))}var E=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=b(t),p(e=function(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,d()?Reflect.construct(t,n||[],b(this).constructor):t.apply(this,n)),"section","profile"),p(e,"sort",50),p(e,"label","Edit profile"),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&y(r,e),t=[{key:"prepare",value:function(){return m(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.enableEditProfile,this.ready=!1!==r,[2]}})}).call(this)}},{key:"onClick",value:function(){return m(function(){return g(this,function(e){return this.context.viewer.open({type:"drawer",width:"50%",closable:!0,content:function(){return i().createElement(w,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}(n.UserCenterActionItemModel);p(E,"itemId","edit-profile"),t.default=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_client_v2=self.webpackChunk_nocobase_plugin_users_client_v2||[]).push([["786"],{241:function(e,t,n){n.r(t),n.d(t,{SignOutItemModel:function(){return l}});var r=n(485);function o(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var l=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=u(t),i(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">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,a()?Reflect.construct(t,r||[],u(this).constructor):t.apply(this,r)),"section","danger"),i(e,"sort",1e3),i(e,"label","Sign out"),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&c(n,e),t=[{key:"onClick",value:function(){var e;return(e=function(){var e,t,n,o;return function(e,t){var n,r,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),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:return[4,this.context.api.auth.signOut()];case 1:if(n=i.sent(),o=(0,r.resolveV2SigninRedirect)(null==n||null==(t=n.data)||null==(e=t.data)?void 0:e.redirect,this.context.app))return window.location.replace(o),[2];return(0,r.redirectToV2Signin)(this.context.app,(0,r.getCurrentV2RedirectPath)(this.context.app,window.location),{replace:!0}),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var u=e.apply(t,n);function c(e){o(u,r,i,c,a,"next",e)}function a(e){o(u,r,i,c,a,"throw",e)}c(void 0)})}).call(this)}}],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}(r.UserCenterActionItemModel);i(l,"itemId","sign-out"),t.default=l}}]);
|
|
@@ -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_client_v2=self.webpackChunk_nocobase_plugin_users_client_v2||[]).push([["862"],{381:function(e,t,r){r.r(t),r.d(t,{ChangePasswordItemModel:function(){return P}});var n=r(485),o=r(694),a=r(625),l=r(59),u=r(155),s=r.n(u),i=r(488),c=r(667);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,l){try{var u=e[a](l),s=u.value}catch(e){r(e);return}u.done?t(s):Promise.resolve(s).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 l(e){p(a,n,o,l,u,"next",e)}function u(e){p(a,n,o,l,u,"throw",e)}l(void 0)})}}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(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=[],l=!0,u=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{l||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 v(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:s(0)}),u(l,"throw",{value:s(1)}),u(l,"return",{value:s(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function s(u){return function(s){var i=[u,s];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}function g(){var e=(0,i.nK)().t,t=(0,o.useFlowContext)(),r=l.theme.useToken().token,f=y(l.Form.useForm(),1)[0],p=y((0,u.useState)(!1),2),m=p[0],h=p[1],b=y((0,u.useState)(""),2),w=b[0],g=b[1],P=(0,a.useMemoizedFn)(function(e,r){return d(function(){var e,n,o,a,l,u,s,i,f,p,d,m,h;return v(this,function(b){switch(b.label){case 0:if("string"!=typeof r||!r)return[2];u=(null==(l=null==(o=t.app)||null==(n=o.pm)||null==(e=n.get)?void 0:e.call(n,c.X))||null==(a=l.getPasswordValidators)?void 0:a.call(l))||[],s=!0,i=!1,f=void 0,b.label=1;case 1:b.trys.push([1,6,7,8]),p=u[Symbol.iterator](),b.label=2;case 2:if(s=(d=p.next()).done)return[3,5];return[4,(0,d.value)(r,{username:void 0})];case 3:if(m=b.sent())throw Error(m);b.label=4;case 4:return s=!0,[3,2];case 5:return[3,8];case 6:return h=b.sent(),i=!0,f=h,[3,8];case 7:try{s||null==p.return||p.return()}finally{if(i)throw f}return[7];case 8:return[2]}})})()}),S=(0,a.useMemoizedFn)(function(){return d(function(){var e,r,o,a,l,u,s;return v(this,function(i){switch(i.label){case 0:return[4,f.validateFields()];case 1:e=i.sent(),g(""),h(!0),i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,t.api.resource("auth").changePassword({values:e})];case 3:return i.sent(),f.resetFields(),(0,n.redirectToV2Signin)(t.app,(0,n.getCurrentV2RedirectPath)(t.app,window.location),{replace:!0}),[3,6];case 4:throw g((null==(s=r=i.sent())||null==(u=s.response)||null==(l=u.data)||null==(a=l.errors)||null==(o=a[0])?void 0:o.message)||(null==s?void 0:s.message)||String(r)),r;case 5:return h(!1),[7];case 6:return[2]}})})()});return s().createElement(n.DrawerFormLayout,{title:e("Change password"),onSubmit:S,submitting:m,submitText:e("Submit"),cancelText:e("Cancel")},s().createElement(l.Form,{form:f,layout:"vertical"},w?s().createElement(l.Alert,{type:"error",showIcon:!0,message:w,style:{marginBottom:r.marginMD}}):null,s().createElement(l.Form.Item,{name:"oldPassword",label:e("Old password"),rules:[{required:!0,message:e("Please enter the old password")}]},s().createElement(n.PasswordInput,{autoComplete:"current-password"})),s().createElement(l.Form.Item,{name:"newPassword",label:e("New password"),rules:[{required:!0,message:e("Please enter the new password")},{validator:P}]},s().createElement(n.PasswordInput,{autoComplete:"new-password",checkStrength:!0})),s().createElement(l.Form.Item,{name:"confirmPassword",label:e("Confirm password"),dependencies:["newPassword"],rules:[{required:!0,message:e("Please confirm the new password")},function(t){var r=t.getFieldValue;return{validator:function(t,n){return n&&r("newPassword")!==n?Promise.reject(Error(e("Password mismatch"))):Promise.resolve()}}}]},s().createElement(n.PasswordInput,{autoComplete:"new-password",checkStrength:!0}))))}var P=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=h(t),m(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||[],h(this).constructor):t.apply(this,n)),"section","profile"),m(e,"sort",100),m(e,"label","Change password"),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&b(r,e),t=[{key:"prepare",value:function(){return d(function(){var e,t,r;return v(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 v(this,function(e){return this.context.viewer.open({type:"drawer",width:"50%",closable:!0,content:function(){return s().createElement(g,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}(n.UserCenterActionItemModel);m(P,"itemId","change-password"),t.default=P}}]);
|
|
@@ -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_client_v2=self.webpackChunk_nocobase_plugin_users_client_v2||[]).push([["917"],{924:function(e,t,r){r.r(t),r.d(t,{default:function(){return ep}});var n,o=r(477),a=r(375),l=r(485),i=r(694),u=r(625),c=r(59),s=r(155),f=r.n(s),d=r(712),p=r(488),b=r(667),h=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,l=new Uint32Array(e);crypto.getRandomValues(l);var i="";i+=t.charAt(l[0]%t.length),i+=r.charAt(l[1]%r.length),i+=n.charAt(l[2]%n.length),i+=o.charAt(l[3]%o.length);for(var u=4;u<e;u++){var c=l[u]%a.length;i+=a.charAt(c)}return i[0]+i.slice(1).split("").sort(function(){return Math.random()-.5}).join("")};function m(e,t,r,n,o,a,l){try{var i=e[a](l),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,o)}function y(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){m(a,n,o,l,i,"next",e)}function i(e){m(a,n,o,l,i,"throw",e)}l(void 0)})}}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:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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}}}}function g(e){var t=(0,i.useFlowContext)(),r=(0,p.kj)(),n=(0,u.useMemoizedFn)(function(r,n){return y(function(){var r,o,a,l,i,u,c,s,f,d,p;return v(this,function(h){switch(h.label){case 0:if("string"!=typeof n||!n)return[2];l=null!=(r=null==(a=t.app.pm.get(b.X))||null==(o=a.getPasswordValidators)?void 0:o.call(a))?r:[],i=!0,u=!1,c=void 0,h.label=1;case 1:h.trys.push([1,6,7,8]),s=l[Symbol.iterator](),h.label=2;case 2:if(i=(f=s.next()).done)return[3,5];return[4,(0,f.value)(n,{username:e.user.username})];case 3:if(d=h.sent())throw Error(d);h.label=4;case 4:return i=!0,[3,2];case 5:return[3,8];case 6:return p=h.sent(),u=!0,c=p,[3,8];case 7:try{i||null==s.return||s.return()}finally{if(u)throw c}return[7];case 8:return[2]}})})()});return f().createElement(d.Yi,{title:r("Change password"),submitText:r("Submit"),cancelText:r("Cancel"),onSubmit:function(r){return y(function(){return v(this,function(n){switch(n.label){case 0:return[4,t.api.resource("users").update({filterByTk:e.user.id,values:r})];case 1:return n.sent(),[2]}})})()},onSubmitted:function(){return y(function(){return v(this,function(n){switch(n.label){case 0:return t.message.success(r("Saved successfully")),[4,e.onSubmitted()];case 1:return n.sent(),[2]}})})()}},function(e){var t=e.form;return f().createElement(c.Form.Item,{label:r("Password"),required:!0},f().createElement(c.Row,{gutter:8},f().createElement(c.Col,{span:18},f().createElement(c.Form.Item,{name:"password",noStyle:!0,rules:[{required:!0,message:r("Password is required")},{validator:n}]},f().createElement(l.PasswordInput,{autoComplete:"new-password",checkStrength:!0}))),f().createElement(c.Col,{span:6},f().createElement(c.Button,{onClick:function(){t.setFieldsValue({password:h()})}},r("Random password")))))})}function w(e,t,r,n,o,a,l){try{var i=e[a](l),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,o)}function S(e,t,r){return t=E(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,M()?Reflect.construct(t,r||[],E(e).constructor):t.apply(e,r))}function O(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function k(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 P(e,t,r){return t&&k(e.prototype,t),r&&k(e,r),e}function j(e,t,r){return(j="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=E(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r||e):o.value}})(e,t,r||e)}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(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&&A(e,t)}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}function C(){var e,t,r=(e=["\n &.ant-card {\n box-shadow: none !important;\n background: transparent !important;\n }\n\n > .ant-card-body {\n background: transparent !important;\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return C=function(){return r},r}var F=(0,o.css)(C()),I=function(e){function t(){return O(this,t),S(this,t,arguments)}return x(t,e),P(t,[{key:"onInit",value:function(e){j(E(t.prototype),"onInit",this).call(this,e),this.setDecoratorProps({bordered:!1,className:F})}},{key:"renderComponent",value:function(){var e=this.props,t=e.colon,r=e.labelAlign,n=e.labelWidth,o=e.labelWrap,a=e.layout,u=this.decoratorProps,c=u.heightMode,s=u.height;return f().createElement(l.FormBlockContent,{model:this,gridModel:this.subModels.grid,layoutProps:{colon:t,labelAlign:r,labelWidth:n,labelWrap:o,layout:a},heightMode:c,height:s,grid:f().createElement(i.FlowModelRenderer,{model:this.subModels.grid,showFlowSettings:!1})})}}]),t}(l.CreateFormModel),T=function(e){function t(){var e,r,n;return O(this,t),e=S(this,t,arguments),r="handlePageChange",n=function(t){var r;return(r=function(){var r;return function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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(n){switch(n.label){case 0:var o,a;if(o=e.resource,null!=(a=i.MultiRecordResource)&&"u">typeof Symbol&&a[Symbol.hasInstance]?!a[Symbol.hasInstance](o):!(o instanceof a))return[3,3];return(r=e.resource).setPage(t),r.loading=!0,[4,r.refresh()];case 1:return n.sent(),[4,(0,l.dispatchEventDeep)(e,"paginationChange")];case 2:n.sent(),n.label=3;case 3:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var a=r.apply(e,t);function l(e){w(a,n,o,l,i,"next",e)}function i(e){w(a,n,o,l,i,"throw",e)}l(void 0)})})()},r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}return x(t,e),P(t,[{key:"onInit",value:function(e){j(E(t.prototype),"onInit",this).call(this,e),this.setDecoratorProps({bordered:!1,className:F})}},{key:"renderComponent",value:function(){var e,t,r=this.props,n=r.colon,o=r.labelAlign,a=r.labelWidth,u=r.labelWrap,s=r.layout,d=this.decoratorProps,p=d.heightMode,b=d.height,h=this.hasAvailableData(),m=this.resource.loading||h?this.isMultiRecordResource()&&this.resource.getMeta("count")>1?f().createElement("div",{style:{textAlign:"center",marginTop:16}},f().createElement(c.Pagination,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:this.resource.getPage(),total:this.resource.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})):null:f().createElement("div",{style:{textAlign:"center",marginTop:16,color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription}},this.translate("No available data currently"));return f().createElement(l.FormBlockContent,{model:this,gridModel:this.subModels.grid,layoutProps:{colon:n,labelAlign:o,labelWidth:a,labelWrap:u,layout:s},heightMode:p,height:b,grid:f().createElement(i.FlowModelRenderer,{model:this.subModels.grid,showFlowSettings:!1}),footer:m})}}]),t}(l.EditFormModel);function R(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}var D="nocobase-admin-profile-create-form-2",z="nocobase-admin-profile-edit-form-2";function _(e){return{dataSourceKey:"main",collectionName:"users",fieldPath:e}}function B(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=R({use:"FormItemModel"},n.disabled?{props:{disabled:!0}}:{}),r=r={stepParams:R({fieldSettings:{init:_(e)}},n.required?{editItemSettings:{required:{required:!0}}}:{}),subModels:{field:{use:"InputFieldModel"}}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,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(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t}function q(){return{use:"FormItemModel",stepParams:{fieldSettings:{init:_("roles")}},subModels:{field:{use:"UserRolesSelectFieldModel",stepParams:{selectSettings:{dataScope:{filter:{logic:"$and",items:[{path:"name",operator:"$ne",value:"root"}]}}}}}}}}function N(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 G(e,t,r,n,o,a,l){try{var i=e[a](l),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,o)}function U(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){G(a,n,o,l,i,"next",e)}function i(e){G(a,n,o,l,i,"throw",e)}l(void 0)})}}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function W(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){V(e,t,r[t])})}return e}function K(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 L(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=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return N(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 N(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 $(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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}}}}function H(){var e,t,r=(e=["\n width: 100%;\n border: none !important;\n box-shadow: none !important;\n background: transparent !important;\n\n > div {\n border: none !important;\n box-shadow: none !important;\n background: transparent !important;\n }\n\n .nb-toolbar-container {\n border: none !important;\n box-shadow: none !important;\n background: transparent !important;\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return H=function(){return r},r}var Q=(0,o.css)(H()),X=(V(n={},D,I),V(n,z,T),n);function Y(e){return"string"==typeof e&&e?e:e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"?"string"==typeof e.name&&e.name?e.name:"string"==typeof e.value&&e.value?e.value:null:null}function J(e){var t=e.onSubmitted,r=e.user,n=(0,i.useFlowContext)(),o=(0,i.useFlowEngine)(),a=(0,i.useFlowViewContext)(),c=(0,p.kj)(),s=!!r,d=L(f().useState(!1),2),b=d[0],h=d[1],m=L(f().useState(null),2),y=m[0],v=m[1],g=s?c("Edit profile"):c("Add user"),w=s?z:D,S=f().useMemo(function(){return s?{uid:z,use:"UserEditFormModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:"users",filterByTk:"{{ctx.view.inputArgs.filterByTk}}"}}},subModels:{grid:{use:"FormGridModel",subModels:{items:[B("nickname"),B("username",{required:!0}),B("email"),B("phone"),q()]}}}}:{uid:D,use:"UserCreateFormModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:"users"}}},subModels:{grid:{use:"FormGridModel",subModels:{items:[B("nickname"),B("username",{required:!0}),B("email"),B("phone"),{use:"FormItemModel",stepParams:{fieldSettings:{init:_("password")},editItemSettings:{required:{required:!0},initialValue:{defaultValue:"admin123"}}},subModels:{field:{use:"UserPasswordFieldModel",props:{autoComplete:"new-password",checkStrength:!1,initialValue:"admin123"}}}},q()]}}}}},[s]);(0,u.useRequest)(function(){return U(function(){var e;return $(this,function(t){switch(t.label){case 0:var r;return[4,(r={flowEngine:o,api:n.api,uid:w,fallbackTree:S},U(function(){var e,t,n,o,a,l,i;return $(this,function(u){switch(u.label){case 0:return t=r.flowEngine,n=r.api,o=r.uid,a=r.fallbackTree,l=n.resource("flowModels"),[4,null==(e=t.modelRepository)?void 0:e.findOne({uid:o})];case 1:if(i=u.sent())return[3,3];return[4,l.save({values:a})];case 2:u.sent(),i=a,u.label=3;case 3:var c,s;return[4,t.createModelAsync((c=i,(s=X[o])?K(W({},c),{use:s}):c))];case 4:return[2,u.sent()]}})})())];case 1:return e=t.sent(),a&&e.context.addDelegate(a),v(e),[2,e]}})})()},{refreshDeps:[o,a,w,S,null==r?void 0:r.id]});var O=f().useCallback(function(){return U(function(){return $(this,function(e){switch(e.label){case 0:if(!y)return[2];h(!0),e.label=1;case 1:return e.trys.push([1,,4,5]),[4,y.submit({},function(e){return U(function(){var t;return $(this,function(o){switch(o.label){case 0:var a,l;if(l=Array.isArray((a=e||{}).roles)?a.roles.map(Y).filter(function(e){return!!e}).map(function(e){return{name:e}}):a.roles,t=K(W({},a),{roles:l}),!(s&&(null==r?void 0:r.id)!=null))return[3,2];return[4,n.api.resource("users").update({filterByTk:r.id,values:t})];case 1:case 3:return o.sent(),[2];case 2:return[4,n.api.resource("users").create({values:t})]}})})()})];case 2:return e.sent(),n.message.success(c("Saved successfully")),[4,t()];case 3:return e.sent(),[3,5];case 4:return h(!1),[7];case 5:return[2]}})})()},[n,s,y,t,c,null==r?void 0:r.id]);return f().createElement(l.DrawerFormLayout,{title:g,onSubmit:O,submitting:b,submitText:c("Submit"),cancelText:c("Cancel")},f().createElement("div",{className:Q},y?f().createElement(i.FlowModelRenderer,{model:y,showFlowSettings:!!n.flowSettingsEnabled&&{showBackground:!1,showBorder:!1}}):f().createElement(l.SkeletonFallback,{style:{margin:0}})))}function Z(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 ee(e,t,r,n,o,a,l){try{var i=e[a](l),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,o)}function et(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){ee(a,n,o,l,i,"next",e)}function i(e){ee(a,n,o,l,i,"throw",e)}l(void 0)})}}function er(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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}}}}function en(){var e,t=(0,i.useFlowContext)(),r=(0,p.kj)(),n=(function(e){if(Array.isArray(e))return e}(e=c.Form.useForm())||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(o.push(t.value),1!==o.length);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw r}}return o}}(e)||function(e){if(e){if("string"==typeof e)return Z(e,1);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 Z(e,1)}}(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.")}())[0],o=(0,u.useRequest)(function(){return et(function(){var e,r;return er(this,function(n){switch(n.label){case 0:return[4,t.api.resource("users").getSystemSettings()];case 1:var o;return[2,null!=(e=(!(o=null==(r=n.sent())?void 0:r.data)||(void 0===o?"undefined":o&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)!="object"?{}:o).data)?e:{}]}})})()}),a=(0,u.useRequest)(function(e){return et(function(){return er(this,function(r){switch(r.label){case 0:return[4,t.api.resource("users").updateSystemSettings({values:e})];case 1:return r.sent(),[2]}})})()},{manual:!0,onSuccess:function(){t.message.success(r("Saved successfully")),window.location.reload()}});return((0,s.useEffect)(function(){o.data&&n.setFieldsValue({enableChangePassword:!1!==o.data.enableChangePassword,enableEditProfile:!1!==o.data.enableEditProfile})},[n,o.data]),o.loading)?f().createElement(c.Spin,null):f().createElement(c.Form,{form:n,layout:"vertical",onFinish:function(e){a.run(e)}},f().createElement(c.Space,{direction:"vertical"},f().createElement(c.Form.Item,{name:"enableEditProfile",valuePropName:"checked"},f().createElement(c.Checkbox,null,r("Allow edit profile"))),f().createElement(c.Form.Item,{name:"enableChangePassword",valuePropName:"checked"},f().createElement(c.Checkbox,null,r("Allow change password"))),f().createElement(c.Button,{type:"primary",htmlType:"submit",loading:a.loading},r("Save"))))}var eo=r(158);function ea(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 el(e,t,r,n,o,a,l){try{var i=e[a](l),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,o)}function ei(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){el(a,n,o,l,i,"next",e)}function i(e){el(a,n,o,l,i,"throw",e)}l(void 0)})}}function eu(e,t){if(e){if("string"==typeof e)return ea(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 ea(e,t)}}function ec(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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}}}}function es(){var e,t,r=(e=["\n height: calc(100vh - 160px);\n min-height: 0;\n display: flex;\n flex-direction: column;\n\n .ant-tabs-nav {\n flex: 0 0 auto;\n margin-bottom: 0;\n }\n\n .ant-tabs-content {\n height: 100%;\n min-height: 0;\n }\n\n .ant-tabs-content-holder,\n .ant-tabs-tabpane {\n background: ",";\n min-height: 0;\n }\n\n .ant-tabs-content-holder {\n flex: 1;\n border-radius: ","px;\n overflow: hidden;\n }\n\n .ant-tabs-tabpane {\n height: 100%;\n overflow: hidden;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return es=function(){return r},r}function ef(e){var t,r;return null!=(t=null==(r=e.roles)?void 0:r.some(function(e){return"root"===e.name}))&&t}function ed(){var e,t,r,n=(0,i.useFlowContext)(),o=(0,p.kj)(),b=null==(r=n.dataSourceManager)||null==(t=r.getDataSource("main"))?void 0:t.getCollection("users"),h=(0,l.useACLRoleContext)(),m=(0,s.useRef)(),y=function(e){if(Array.isArray(e))return e}(e=(0,s.useState)([]))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw r}}return o}}(e)||eu(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.")}(),v=y[0],w=y[1],S=null!==h.parseAction("users:create"),O=null!==h.parseAction("users:update"),k=null!==h.parseAction("users:destroy"),P=(0,u.useMemoizedFn)(function(){return ei(function(){var e;return ec(this,function(t){switch(t.label){case 0:return[4,null==(e=m.current)?void 0:e.call(m)];case 1:return t.sent(),[2]}})})()}),j=(0,u.useMemoizedFn)(function(e){n.viewer.open({type:"drawer",width:"50%",closable:!0,styles:{body:{padding:0}},inputArgs:{dataSourceKey:"main",collectionName:"users",filterByTk:null==e?void 0:e.id},content:function(){return f().createElement(J,{user:e,onSubmitted:P})}})}),E=(0,u.useMemoizedFn)(function(e){n.viewer.open({type:"drawer",width:"50%",closable:!0,content:function(){return f().createElement(g,{user:e,onSubmitted:P})}})}),x=(0,u.useMemoizedFn)(function(e){return ei(function(){return ec(this,function(t){switch(t.label){case 0:return[4,n.api.resource("users").destroy({filterByTk:e})];case 1:return t.sent(),w([]),n.message.success(o("Deleted successfully")),[4,P()];case 2:return t.sent(),[2]}})})()}),A=(0,s.useMemo)(function(){return[{title:o("Nickname"),dataIndex:"nickname"},{title:o("Username"),dataIndex:"username"},{title:o("Email"),dataIndex:"email"},{title:o("Roles"),dataIndex:"roles",render:function(e){return f().createElement(c.Space,{wrap:!0},null==e?void 0:e.map(function(e){return f().createElement(c.Tag,{key:e.name},o(e.title))}))}},{title:o("Actions"),key:"actions",render:function(e,t){return f().createElement(d.AQ,{record:t,showIcons:!1,split:null,actions:[{key:"edit",label:o("Edit profile"),hidden:!O,onClick:j},{key:"change-password",label:o("Change password"),hidden:!O,onClick:E},{key:"delete",label:o("Delete"),hidden:!k||ef(t),confirm:{title:o("Delete"),description:o("Are you sure you want to delete it?")},onClick:function(e){return x(e.id)}}]})}}]},[k,O,x,E,j,o]),M=(0,u.useMemoizedFn)(function(e){return m.current=e.refreshAsync,f().createElement(f().Fragment,null,f().createElement(c.Button,{icon:f().createElement(a.ReloadOutlined,null),onClick:e.refresh},o("Refresh")),k?f().createElement(c.Popconfirm,{title:o("Delete users"),description:o("Are you sure you want to delete it?"),onConfirm:function(){return x(v)}},f().createElement(c.Button,{icon:f().createElement(a.DeleteOutlined,null),disabled:!v.length},o("Delete"))):null,S?f().createElement(c.Button,{type:"primary",icon:f().createElement(a.PlusOutlined,null),onClick:function(){return j()}},o("Add new")):null)});return f().createElement(d.g5,{fillHeight:!0,collection:b,rowKey:"id",columns:A,t:o,toolbar:M,toolbarLayout:"split",showRefresh:!1,defaultPageSize:20,request:function(e){var t=e.filter,r=e.page,o=e.pageSize;return ei(function(){var e,a,l,i,u,c,s,f;return ec(this,function(d){switch(d.label){case 0:return[4,n.api.resource("users").list({page:r,pageSize:o,filter:function(e){if(e)return e}(t),appends:["roles"],sort:["id"]})];case 1:return s=d.sent(),[2,{data:null!=(e=(f=(0,eo.G)(null==s?void 0:s.data)).data)?e:[],page:null==(l=f.meta)?void 0:l.page,pageSize:null==(i=f.meta)?void 0:i.pageSize,total:null!=(a=null==(u=f.meta)?void 0:u.total)?a:null==(c=f.meta)?void 0:c.count}]}})})()},tableProps:{rowSelection:k?{type:"checkbox",selectedRowKeys:v,getCheckboxProps:function(e){return{disabled:ef(e)}},onChange:function(e){w(function(e){if(Array.isArray(e))return ea(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eu(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}:void 0}})}function ep(){var e=(0,p.kj)(),t=c.theme.useToken().token,r=(0,o.css)(es(),t.colorBgContainer,t.borderRadiusLG);return f().createElement(c.Tabs,{type:"card",className:r,items:[{key:"usersManager",label:e("Users"),children:f().createElement("div",{style:{height:"100%",minHeight:0,overflow:"hidden"}},f().createElement(ed,null))},{key:"usersSettings",label:e("Settings"),children:f().createElement("div",{style:{height:"100%",minHeight:0,overflow:"auto",padding:t.paddingLG}},f().createElement(en,null))}]})}}}]);
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { type FormInstance, type FormProps } from 'antd';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export interface ResourceFormDrawerRenderArgs<Values extends object> {
|
|
12
|
+
form: FormInstance<Values>;
|
|
13
|
+
submitting: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ResourceFormDrawerProps<Values extends object = Record<string, unknown>> {
|
|
16
|
+
title: React.ReactNode;
|
|
17
|
+
initialValues?: Partial<Values>;
|
|
18
|
+
form?: FormInstance<Values>;
|
|
19
|
+
formProps?: Omit<FormProps<Values>, 'form' | 'initialValues' | 'children'>;
|
|
20
|
+
children: React.ReactNode | ((args: ResourceFormDrawerRenderArgs<Values>) => React.ReactNode);
|
|
21
|
+
onSubmit: (values: Values, form: FormInstance<Values>) => Promise<void> | void;
|
|
22
|
+
onSubmitted?: (values: Values) => Promise<void> | void;
|
|
23
|
+
submitText?: React.ReactNode;
|
|
24
|
+
cancelText?: React.ReactNode;
|
|
25
|
+
footer?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Drawer-hosted antd form for settings CRUD pages. The caller owns the API
|
|
29
|
+
* branch (create/update/etc.); this component only handles form lifecycle,
|
|
30
|
+
* validation, loading state, and the shared drawer chrome.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ResourceFormDrawer<Values extends object = Record<string, unknown>>(props: ResourceFormDrawerProps<Values>): React.JSX.Element;
|
|
33
|
+
export default ResourceFormDrawer;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 type { Collection } from '@nocobase/flow-engine';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { type CompiledFilter, type TableProps } from '@nocobase/client-v2';
|
|
12
|
+
export interface ResourcePickerRequestParams {
|
|
13
|
+
filter?: CompiledFilter;
|
|
14
|
+
page: number;
|
|
15
|
+
pageSize: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ResourcePickerLoadResult<RecordType extends object> {
|
|
18
|
+
data: RecordType[];
|
|
19
|
+
total?: number;
|
|
20
|
+
page?: number;
|
|
21
|
+
pageSize?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ResourcePickerViewProps<RecordType extends object = Record<string, unknown>> {
|
|
24
|
+
title: React.ReactNode;
|
|
25
|
+
collection?: Collection;
|
|
26
|
+
columns: TableProps<RecordType>['columns'];
|
|
27
|
+
rowKey: TableProps<RecordType>['rowKey'];
|
|
28
|
+
request: (params: ResourcePickerRequestParams) => Promise<ResourcePickerLoadResult<RecordType>>;
|
|
29
|
+
onSubmit: (selectedRows: RecordType[], selectedRowKeys: React.Key[]) => Promise<void> | void;
|
|
30
|
+
t?: (key: string, options?: Record<string, unknown>) => string;
|
|
31
|
+
selectionType?: 'checkbox' | 'radio';
|
|
32
|
+
submitText?: React.ReactNode;
|
|
33
|
+
cancelText?: React.ReactNode;
|
|
34
|
+
filterableFieldNames?: string[];
|
|
35
|
+
noIgnore?: boolean;
|
|
36
|
+
requireSelection?: boolean;
|
|
37
|
+
defaultPageSize?: number;
|
|
38
|
+
tableProps?: Omit<TableProps<RecordType>, 'columns' | 'dataSource' | 'loading' | 'onChange' | 'pagination' | 'rowKey' | 'rowSelection'>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Viewer-hosted record picker for settings pages and secondary selection
|
|
42
|
+
* flows. Open it with `ctx.viewer.open(...)` and pass resource loading logic
|
|
43
|
+
* through `request`; the component owns filter, pagination, and selection UI.
|
|
44
|
+
*/
|
|
45
|
+
export declare function ResourcePickerView<RecordType extends object = Record<string, unknown>>(props: ResourcePickerViewProps<RecordType>): React.JSX.Element;
|
|
46
|
+
export default ResourcePickerView;
|
|
@@ -0,0 +1,50 @@
|
|
|
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 type { Collection } from '@nocobase/flow-engine';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { type CompiledFilter, type TableProps } from '@nocobase/client-v2';
|
|
12
|
+
export interface ResourceTableRequestParams {
|
|
13
|
+
filter?: CompiledFilter;
|
|
14
|
+
page: number;
|
|
15
|
+
pageSize: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ResourceTableLoadResult<RecordType extends object> {
|
|
18
|
+
data: RecordType[];
|
|
19
|
+
total?: number;
|
|
20
|
+
page?: number;
|
|
21
|
+
pageSize?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ResourceTablePageToolbarArgs {
|
|
24
|
+
loading: boolean;
|
|
25
|
+
refresh: () => void;
|
|
26
|
+
refreshAsync: () => Promise<unknown>;
|
|
27
|
+
}
|
|
28
|
+
export interface ResourceTablePageProps<RecordType extends object = Record<string, unknown>> {
|
|
29
|
+
collection?: Collection;
|
|
30
|
+
columns: TableProps<RecordType>['columns'];
|
|
31
|
+
rowKey: TableProps<RecordType>['rowKey'];
|
|
32
|
+
request: (params: ResourceTableRequestParams) => Promise<ResourceTableLoadResult<RecordType>>;
|
|
33
|
+
t?: (key: string, options?: Record<string, unknown>) => string;
|
|
34
|
+
filterableFieldNames?: string[];
|
|
35
|
+
noIgnore?: boolean;
|
|
36
|
+
toolbar?: React.ReactNode | ((args: ResourceTablePageToolbarArgs) => React.ReactNode);
|
|
37
|
+
toolbarLayout?: 'inline' | 'split';
|
|
38
|
+
showRefresh?: boolean;
|
|
39
|
+
padding?: boolean;
|
|
40
|
+
defaultPageSize?: number;
|
|
41
|
+
fillHeight?: boolean;
|
|
42
|
+
tableProps?: Omit<TableProps<RecordType>, 'columns' | 'dataSource' | 'loading' | 'onChange' | 'pagination' | 'rowKey'>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Settings-page table shell for resource-backed lists. It owns the common
|
|
46
|
+
* filter + pagination + refresh lifecycle while callers provide business
|
|
47
|
+
* actions, columns, and request mapping.
|
|
48
|
+
*/
|
|
49
|
+
export declare function ResourceTablePage<RecordType extends object = Record<string, unknown>>(props: ResourceTablePageProps<RecordType>): React.JSX.Element;
|
|
50
|
+
export default ResourceTablePage;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { type ButtonProps } from 'antd';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export interface SettingsActionConfirm {
|
|
12
|
+
title: React.ReactNode;
|
|
13
|
+
description?: React.ReactNode;
|
|
14
|
+
okText?: React.ReactNode;
|
|
15
|
+
cancelText?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export interface SettingsActionItem<RecordType extends object = Record<string, unknown>> {
|
|
18
|
+
key: React.Key;
|
|
19
|
+
label: React.ReactNode;
|
|
20
|
+
icon?: React.ReactNode;
|
|
21
|
+
danger?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
hidden?: boolean;
|
|
24
|
+
confirm?: SettingsActionConfirm;
|
|
25
|
+
buttonProps?: Omit<ButtonProps, 'children' | 'danger' | 'disabled' | 'icon' | 'onClick' | 'type'>;
|
|
26
|
+
onClick?: (record: RecordType) => Promise<void> | void;
|
|
27
|
+
}
|
|
28
|
+
export interface SettingsActionCellProps<RecordType extends object = Record<string, unknown>> {
|
|
29
|
+
record: RecordType;
|
|
30
|
+
actions: SettingsActionItem<RecordType>[];
|
|
31
|
+
showIcons?: boolean;
|
|
32
|
+
split?: React.ReactNode | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Compact row-action renderer for settings tables. It keeps edit/delete style
|
|
36
|
+
* actions visually consistent while leaving business behavior to the caller.
|
|
37
|
+
*/
|
|
38
|
+
export declare function SettingsActionCell<RecordType extends object = Record<string, unknown>>(props: SettingsActionCellProps<RecordType>): React.JSX.Element;
|
|
39
|
+
export default SettingsActionCell;
|
|
@@ -0,0 +1,12 @@
|
|
|
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 * from './ResourceFormDrawer';
|
|
10
|
+
export * from './ResourcePickerView';
|
|
11
|
+
export * from './ResourceTablePage';
|
|
12
|
+
export * from './SettingsActionCell';
|
|
@@ -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("@emotion/css"),require("@nocobase/plugin-acl/client-v2"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-users/client-v2",["ahooks","@emotion/css","@nocobase/plugin-acl/client-v2","@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-users/client-v2"]=t(require("ahooks"),require("@emotion/css"),require("@nocobase/plugin-acl/client-v2"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-users/client-v2"]=t(e.ahooks,e["@emotion/css"],e["@nocobase/plugin-acl/client-v2"],e["@nocobase/client-v2"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,u,a){return function(){"use strict";var c,s,l,f,p,d={667:function(e,t,n){n.d(t,{X:function(){return p}});var r=n(485),o=n(762),i=n.n(o);function u(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function a(e,t,n){return(a=f()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o}).apply(null,arguments)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=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 a(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)})(e)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var p=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,o,i,u;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=c(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">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,f()?Reflect.construct(t,n||[],c(this).constructor):t.apply(this,n)),i="passwordValidators",u=new Map,i in o?Object.defineProperty(o,i,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[i]=u,e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&s(r,e),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(){var e;return(e=function(){var e;return function(e,t){var n,r,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:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){var s=[a,c];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(i=0)),i;)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 i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}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(t){return this.pluginSettingsManager.has("users-permissions")||this.pluginSettingsManager.addMenuItem({key:"users-permissions",title:this.t("Users & Permissions"),isPinned:!0,sort:200,icon:"TeamOutlined",showTabs:!0}),this.pluginSettingsManager.addPageTabItem({menuKey:"users-permissions",key:"users",title:this.t("Users"),icon:"UserOutlined",aclSnippet:"pm.users",sort:2,componentLoader:function(){return Promise.all([n.e("564"),n.e("917")]).then(n.bind(n,924))}}),null==(e=this.app.pm.get(i()))||e.rolesManager.add("users",{title:String(this.t("Users")),sort:10,componentLoader:function(){return Promise.all([n.e("564"),n.e("521")]).then(n.bind(n,240))}}),this.app.flowEngine.registerModelLoaders({EditProfileItemModel:{extends:"UserCenterItemModel",loader:function(){return n.e("784").then(n.bind(n,467))}},UserPasswordFieldModel:{extends:"PasswordFieldModel",loader:function(){return n.e("569").then(n.bind(n,552))}},UserRolesSelectFieldModel:{extends:"RecordSelectFieldModel",loader:function(){return n.e("143").then(n.bind(n,466))}},ChangePasswordItemModel:{extends:"UserCenterItemModel",loader:function(){return n.e("862").then(n.bind(n,381))}},CurrentUserSummaryItemModel:{extends:"UserCenterItemModel",loader:function(){return n.e("587").then(n.bind(n,638))}},SignOutItemModel:{extends:"UserCenterItemModel",loader:function(){return n.e("786").then(n.bind(n,241))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,c,"next",e)}function c(e){u(i,r,o,a,c,"throw",e)}a(void 0)})}).call(this)}}],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)}}(r.prototype,t),r}(l(r.Plugin));t.A=p},488:function(e,t,n){n.d(t,{CU:function(){return i},MZ:function(){return c},kj:function(){return a},nK:function(){return u}});var r=n(694);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){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}var i="@nocobase/plugin-users";function u(){return{t:a()}}function a(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"users","client"]},n))}}function c(e,t){return(0,r.tExpr)(e,o({ns:[i,"users","client"]},t))}},375:function(e){e.exports=u},477:function(e){e.exports=t},485:function(e){e.exports=r},694:function(e){e.exports=a},762:function(e){e.exports=n},625:function(t){t.exports=e},59:function(e){e.exports=i},155:function(e){e.exports=o}},b={};function h(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return d[e](n,n.exports,h),n.exports}h.m=d,h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return""+e+"."+({143:"8fc4573e64ec8c3f",521:"2dfe166044cc9992",564:"fd2267ba191f2206",569:"07f16da700ba0ba6",587:"a15f1f5b0dbbf4d5",784:"25ee62a1613da5a6",786:"ca0dea7bc67662c3",862:"2aac0dea47472edf",917:"2202b84c00ddfbdc"})[e]+".js"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v={},h.l=function(e,t,n,r){if(v[e])return void v[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var c=u[a];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-users/client-v2:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,h.nc&&o.setAttribute("nonce",h.nc),o.setAttribute("data-rspack","@nocobase/plugin-users/client-v2:"+n),o.src=e),v[e]=[t];var s=function(t,n){o.onerror=o.onload=null,clearTimeout(l);var r=v[e];if(delete v[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},l=setTimeout(s.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=s.bind(null,o.onerror),o.onload=s.bind(null,o.onload),i&&document.head.appendChild(o)},h.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.g.importScripts&&(g=h.g.location+"");var v,g,y=h.g.document;if(!g&&y&&(y.currentScript&&"SCRIPT"===y.currentScript.tagName.toUpperCase()&&(g=y.currentScript.src),!g)){var m=y.getElementsByTagName("script");if(m.length)for(var w=m.length-1;w>-1&&(!g||!/^http(s?):/.test(g));)g=m[w--].src}if(!g)throw Error("Automatic publicPath is not supported in this browser");h.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c={889:0},h.f.j=function(e,t){var n=h.o(c,e)?c[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=c[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),i=Error();h.l(o,function(t){if(h.o(c,e)&&(0!==(n=c[e])&&(c[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)}},s=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==c[e]})){for(n in i)h.o(i,n)&&(h.m[n]=i[n]);u&&u(h)}for(e&&e(t);a<o.length;a++)r=o[a],h.o(c,r)&&c[r]&&c[r][0](),c[r]=0},(l=self.webpackChunk_nocobase_plugin_users_client_v2=self.webpackChunk_nocobase_plugin_users_client_v2||[]).forEach(s.bind(null,0)),l.push=s.bind(null,l.push.bind(l));var _={};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 n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-users/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",u=i.indexOf(o);e=u>=0?i.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-users/dist/client-v2/"}h.p=e}(),h.r(_),h.d(_,{NAMESPACE:function(){return p.CU},PluginUsersClientV2:function(){return f.X},default:function(){return f.A},tExpr:function(){return p.MZ},useT:function(){return p.kj},useUsersTranslation:function(){return p.nK}}),f=h(667),p=h(488),_}()});
|
|
@@ -0,0 +1,14 @@
|
|
|
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 = "@nocobase/plugin-users";
|
|
10
|
+
export declare function useUsersTranslation(): {
|
|
11
|
+
t: (key: string, options?: Record<string, unknown>) => string;
|
|
12
|
+
};
|
|
13
|
+
export declare function useT(): (key: string, options?: Record<string, unknown>) => string;
|
|
14
|
+
export declare function tExpr(key: string, options?: Record<string, unknown>): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { PasswordFieldModel } from '@nocobase/client-v2';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export declare class UserPasswordFieldModel extends PasswordFieldModel {
|
|
12
|
+
private readonly validatePassword;
|
|
13
|
+
private getUsernameForValidation;
|
|
14
|
+
private ensurePasswordValidationRule;
|
|
15
|
+
render(): React.JSX.Element;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { CreateFormModel, EditFormModel } from '@nocobase/client-v2';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export declare class UserCreateFormModel extends CreateFormModel {
|
|
12
|
+
onInit(options: any): void;
|
|
13
|
+
renderComponent(): React.JSX.Element;
|
|
14
|
+
}
|
|
15
|
+
export declare class UserEditFormModel extends EditFormModel {
|
|
16
|
+
onInit(options: any): void;
|
|
17
|
+
handlePageChange: (page: number) => Promise<void>;
|
|
18
|
+
renderComponent(): React.JSX.Element;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
10
|
+
import { RecordSelectFieldModel } from '@nocobase/client-v2';
|
|
11
|
+
export declare class UserRolesSelectFieldModel extends RecordSelectFieldModel {
|
|
12
|
+
private ensureResourceRequestDefaults;
|
|
13
|
+
render(): import("react").JSX.Element;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 React from 'react';
|
|
10
|
+
import type { User } from './types';
|
|
11
|
+
export interface ChangeUserPasswordDrawerProps {
|
|
12
|
+
user: User;
|
|
13
|
+
onSubmitted: () => Promise<void> | void;
|
|
14
|
+
}
|
|
15
|
+
export default function ChangeUserPasswordDrawer(props: ChangeUserPasswordDrawerProps): React.JSX.Element;
|
|
@@ -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
|
+
import type { RoleTabProps } from '@nocobase/plugin-acl/client-v2';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export default function RoleUsersManager(props: RoleTabProps): React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 React from 'react';
|
|
10
|
+
import type { User } from './types';
|
|
11
|
+
export interface UserFormDrawerProps {
|
|
12
|
+
user?: User;
|
|
13
|
+
onSubmitted: () => Promise<void> | void;
|
|
14
|
+
}
|
|
15
|
+
export default function UserFormDrawer(props: UserFormDrawerProps): React.JSX.Element;
|
|
@@ -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
|
+
import React from 'react';
|
|
10
|
+
export default function UsersManagementPage(): React.JSX.Element;
|
|
@@ -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
|
+
import React from 'react';
|
|
10
|
+
export default function UsersSettingsForm(): React.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 interface Role {
|
|
10
|
+
name: string;
|
|
11
|
+
title: string;
|
|
12
|
+
}
|
|
13
|
+
export interface User {
|
|
14
|
+
id: number;
|
|
15
|
+
nickname?: string;
|
|
16
|
+
username?: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
phone?: string;
|
|
19
|
+
roles?: Role[];
|
|
20
|
+
}
|
|
21
|
+
export interface ListPayload<RecordType extends object> {
|
|
22
|
+
data?: RecordType[];
|
|
23
|
+
meta?: {
|
|
24
|
+
page?: number;
|
|
25
|
+
pageSize?: number;
|
|
26
|
+
total?: number;
|
|
27
|
+
count?: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare function toListPayload<RecordType extends object>(responseData: unknown): ListPayload<RecordType>;
|
|
@@ -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,15 @@
|
|
|
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 type { CreateModelOptions } from '@nocobase/flow-engine';
|
|
10
|
+
export declare const ADMIN_PROFILE_CREATE_FORM_MODEL_UID = "nocobase-admin-profile-create-form-2";
|
|
11
|
+
export declare const ADMIN_PROFILE_EDIT_FORM_MODEL_UID = "nocobase-admin-profile-edit-form-2";
|
|
12
|
+
type FlowModelTree = CreateModelOptions & Record<string, unknown>;
|
|
13
|
+
export declare function buildAdminProfileCreateFormModel(): FlowModelTree;
|
|
14
|
+
export declare function buildAdminProfileEditFormModel(): FlowModelTree;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
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 generatePassword: (length?: number) => string;
|