@proteinjs/user-ui 1.8.1 → 1.9.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/CHANGELOG.md +20 -0
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +3 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/src/form/UserRecordFormCustomization.d.ts +22 -0
- package/dist/src/form/UserRecordFormCustomization.d.ts.map +1 -0
- package/dist/src/form/UserRecordFormCustomization.js +73 -0
- package/dist/src/form/UserRecordFormCustomization.js.map +1 -0
- package/dist/src/form/UserRolesField.d.ts +16 -0
- package/dist/src/form/UserRolesField.d.ts.map +1 -0
- package/dist/src/form/UserRolesField.js +114 -0
- package/dist/src/form/UserRolesField.js.map +1 -0
- package/dist/src/form/UserStatusField.d.ts +11 -0
- package/dist/src/form/UserStatusField.d.ts.map +1 -0
- package/dist/src/form/UserStatusField.js +24 -0
- package/dist/src/form/UserStatusField.js.map +1 -0
- package/dist/test/UserRecordFormCustomization.test.d.ts +5 -0
- package/dist/test/UserRecordFormCustomization.test.d.ts.map +1 -0
- package/dist/test/UserRecordFormCustomization.test.js +363 -0
- package/dist/test/UserRecordFormCustomization.test.js.map +1 -0
- package/generated/index.ts +3 -1
- package/package.json +3 -3
- package/src/form/UserRecordFormCustomization.tsx +54 -0
- package/src/form/UserRolesField.tsx +96 -0
- package/src/form/UserStatusField.tsx +30 -0
- package/test/UserRecordFormCustomization.test.tsx +242 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.9.1](https://github.com/proteinjs/user/compare/@proteinjs/user-ui@1.9.0...@proteinjs/user-ui@1.9.1) (2026-08-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @proteinjs/user-ui
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.9.0](https://github.com/proteinjs/user/compare/@proteinjs/user-ui@1.8.1...@proteinjs/user-ui@1.9.0) (2026-08-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* export the auth-surface building blocks from user-ui + multiline/helper support on AuthTextField ([657c016](https://github.com/proteinjs/user/commit/657c01682f73418b21959809a8d53b966c35f140))
|
|
20
|
+
* user record form shows roles (grant/revoke through the Roles service) and read-only status ([89c25f5](https://github.com/proteinjs/user/commit/89c25f56eba793a5b2976d1bfa5ebee7d321a8cb))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [1.8.1](https://github.com/proteinjs/user/compare/@proteinjs/user-ui@1.8.0...@proteinjs/user-ui@1.8.1) (2026-08-29)
|
|
7
27
|
|
|
8
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;AAiCzB,cAAc,UAAU,CAAC"}
|
package/dist/generated/index.js
CHANGED
|
@@ -21,15 +21,17 @@ require("@proteinjs/server-api");
|
|
|
21
21
|
require("@proteinjs/ui");
|
|
22
22
|
require("@proteinjs/user");
|
|
23
23
|
/** Generate Source Graph */
|
|
24
|
-
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"/Omit\"},{\"v\":\"@proteinjs/user-ui/InviteRecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"InviteRecordFormCustomization\",\"filePath\":\"src/form/InviteRecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/InviteRecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFieldLayout\",\"returnType\":{\"packageName\":\"\",\"name\":\"string[] | string[][]\",\"filePath\":null,\"qualifiedName\":\"/string[] | string[][]\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"invite\",\"type\":{\"packageName\":\"\",\"name\":\"Invite | undefined\",\"filePath\":null,\"qualifiedName\":\"/Invite | undefined\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFieldLayout\",\"type\":{\"packageName\":\"\",\"name\":\"string[] | string[][]\",\"filePath\":null,\"qualifiedName\":\"/string[] | string[][]\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"invite\",\"type\":{\"packageName\":\"\",\"name\":\"Invite | undefined\",\"filePath\":null,\"qualifiedName\":\"/Invite | undefined\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"sendButton\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButton<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButton<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"invite\",\"type\":{\"packageName\":\"\",\"name\":\"Invite | undefined\",\"filePath\":null,\"qualifiedName\":\"/Invite | undefined\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"revokeButton\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButton<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButton<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"invite\",\"type\":{\"packageName\":\"\",\"name\":\"Invite | undefined\",\"filePath\":null,\"qualifiedName\":\"/Invite | undefined\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"canManageUsers\",\"returnType\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\"},{\"v\":\"@proteinjs/user-ui/forgotPasswordPage\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"forgotPasswordPage\",\"filePath\":\"src/pages/ForgotPassword.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/forgotPasswordPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/ui/Page\"},{\"v\":\"@proteinjs/user-ui/loginPage\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"loginPage\",\"filePath\":\"src/pages/Login.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/loginPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/user-ui/passwordResetPage\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"passwordResetPage\",\"filePath\":\"src/pages/PasswordReset.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/passwordResetPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/user-ui/signupPage\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"signupPage\",\"filePath\":\"src/pages/Signup.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/signupPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}}],\"edges\":[{\"v\":\"@proteinjs/user-ui/InviteRecordFormCustomization\",\"w\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user-ui/forgotPasswordPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-ui/loginPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-ui/passwordResetPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-ui/signupPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"}]}";
|
|
24
|
+
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"/Omit\"},{\"v\":\"@proteinjs/user-ui/InviteRecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"InviteRecordFormCustomization\",\"filePath\":\"src/form/InviteRecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/InviteRecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFieldLayout\",\"returnType\":{\"packageName\":\"\",\"name\":\"string[] | string[][]\",\"filePath\":null,\"qualifiedName\":\"/string[] | string[][]\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"invite\",\"type\":{\"packageName\":\"\",\"name\":\"Invite | undefined\",\"filePath\":null,\"qualifiedName\":\"/Invite | undefined\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFieldLayout\",\"type\":{\"packageName\":\"\",\"name\":\"string[] | string[][]\",\"filePath\":null,\"qualifiedName\":\"/string[] | string[][]\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"invite\",\"type\":{\"packageName\":\"\",\"name\":\"Invite | undefined\",\"filePath\":null,\"qualifiedName\":\"/Invite | undefined\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"sendButton\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButton<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButton<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"invite\",\"type\":{\"packageName\":\"\",\"name\":\"Invite | undefined\",\"filePath\":null,\"qualifiedName\":\"/Invite | undefined\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"revokeButton\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButton<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButton<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"invite\",\"type\":{\"packageName\":\"\",\"name\":\"Invite | undefined\",\"filePath\":null,\"qualifiedName\":\"/Invite | undefined\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"canManageUsers\",\"returnType\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\"},{\"v\":\"@proteinjs/user-ui/UserRecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"UserRecordFormCustomization\",\"filePath\":\"src/form/UserRecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/UserRecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFieldRenderer\",\"returnType\":{\"packageName\":\"\",\"name\":\"RecordFormFieldRenderer<User> | undefined\",\"filePath\":null,\"qualifiedName\":\"/RecordFormFieldRenderer<User> | undefined\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fieldName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"user\",\"type\":{\"packageName\":\"@proteinjs/user\",\"name\":\"User\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/User\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFieldLayout\",\"returnType\":{\"packageName\":\"\",\"name\":\"string[] | string[][]\",\"filePath\":null,\"qualifiedName\":\"/string[] | string[][]\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"user\",\"type\":{\"packageName\":\"\",\"name\":\"User | undefined\",\"filePath\":null,\"qualifiedName\":\"/User | undefined\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFieldLayout\",\"type\":{\"packageName\":\"\",\"name\":\"string[] | string[][]\",\"filePath\":null,\"qualifiedName\":\"/string[] | string[][]\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"asRows\",\"returnType\":{\"packageName\":\"\",\"name\":\"string[][]\",\"filePath\":null,\"qualifiedName\":\"/string[][]\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"layout\",\"type\":{\"packageName\":\"\",\"name\":\"string[] | string[][]\",\"filePath\":null,\"qualifiedName\":\"/string[] | string[][]\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/user-ui/forgotPasswordPage\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"forgotPasswordPage\",\"filePath\":\"src/pages/ForgotPassword.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/forgotPasswordPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/ui/Page\"},{\"v\":\"@proteinjs/user-ui/loginPage\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"loginPage\",\"filePath\":\"src/pages/Login.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/loginPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/user-ui/passwordResetPage\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"passwordResetPage\",\"filePath\":\"src/pages/PasswordReset.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/passwordResetPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/user-ui/signupPage\",\"value\":{\"packageName\":\"@proteinjs/user-ui\",\"name\":\"signupPage\",\"filePath\":\"src/pages/Signup.tsx\",\"qualifiedName\":\"@proteinjs/user-ui/signupPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}}],\"edges\":[{\"v\":\"@proteinjs/user-ui/InviteRecordFormCustomization\",\"w\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user-ui/UserRecordFormCustomization\",\"w\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user-ui/forgotPasswordPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-ui/loginPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-ui/passwordResetPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-ui/signupPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"}]}";
|
|
25
25
|
/** Generate Source Links */
|
|
26
26
|
var InviteRecordFormCustomization_1 = require("../src/form/InviteRecordFormCustomization");
|
|
27
|
+
var UserRecordFormCustomization_1 = require("../src/form/UserRecordFormCustomization");
|
|
27
28
|
var ForgotPassword_1 = require("../src/pages/ForgotPassword");
|
|
28
29
|
var Login_1 = require("../src/pages/Login");
|
|
29
30
|
var PasswordReset_1 = require("../src/pages/PasswordReset");
|
|
30
31
|
var Signup_1 = require("../src/pages/Signup");
|
|
31
32
|
var sourceLinks = {
|
|
32
33
|
'@proteinjs/user-ui/InviteRecordFormCustomization': InviteRecordFormCustomization_1.InviteRecordFormCustomization,
|
|
34
|
+
'@proteinjs/user-ui/UserRecordFormCustomization': UserRecordFormCustomization_1.UserRecordFormCustomization,
|
|
33
35
|
'@proteinjs/user-ui/forgotPasswordPage': ForgotPassword_1.forgotPasswordPage,
|
|
34
36
|
'@proteinjs/user-ui/loginPage': Login_1.loginPage,
|
|
35
37
|
'@proteinjs/user-ui/passwordResetPage': PasswordReset_1.passwordResetPage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,4BAA0B;AAC1B,iCAA+B;AAC/B,yBAAuB;AACvB,2BAAyB;AAGzB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,4BAA0B;AAC1B,iCAA+B;AAC/B,yBAAuB;AACvB,2BAAyB;AAGzB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,sqTAAsqT,CAAC;AAG3rT,4BAA4B;AAE5B,2FAA0F;AAC1F,uFAAsF;AACtF,8DAAiE;AACjE,4CAA+C;AAC/C,4DAA+D;AAC/D,8CAAiD;AAEjD,IAAM,WAAW,GAAG;IACnB,kDAAkD,EAAE,6DAA6B;IACjF,gDAAgD,EAAE,yDAA2B;IAC7E,uCAAuC,EAAE,mCAAkB;IAC3D,8BAA8B,EAAE,iBAAS;IACzC,sCAAsC,EAAE,iCAAiB;IACzD,+BAA+B,EAAE,mBAAU;CAC3C,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RecordFormCustomization, RecordFormFieldRenderer } from '@proteinjs/db-ui';
|
|
2
|
+
import { User } from '@proteinjs/user';
|
|
3
|
+
/**
|
|
4
|
+
* Makes the user record form tell the truth about its two service-owned columns:
|
|
5
|
+
* - `roles` is an ArrayColumn the default form hides; it renders as chips of the held roles with
|
|
6
|
+
* grant/revoke through `RolesService` (the one audited write path) for holders of the 'roles'
|
|
7
|
+
* permission — see `UserRolesField`;
|
|
8
|
+
* - `status` is written only by SetUserStatus; it renders read-only instead of as an editable box
|
|
9
|
+
* whose edits the form's save would silently drop — see `UserStatusField`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class UserRecordFormCustomization extends RecordFormCustomization {
|
|
12
|
+
table: import("@proteinjs/db").Table<User>;
|
|
13
|
+
getFieldRenderer(fieldName: string, user: User): RecordFormFieldRenderer<User> | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Roles get their own full-width row right after the identity row: chips plus a grant control
|
|
16
|
+
* need the width, and managing access is the main reason to open a user record. The rest of the
|
|
17
|
+
* fields re-pair so no row is left with an orphan.
|
|
18
|
+
*/
|
|
19
|
+
getFieldLayout(user: User | undefined, defaultFieldLayout: string[] | string[][]): string[] | string[][];
|
|
20
|
+
private asRows;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=UserRecordFormCustomization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserRecordFormCustomization.d.ts","sourceRoot":"","sources":["../../../src/form/UserRecordFormCustomization.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAU,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI/C;;;;;;;GAOG;AACH,qBAAa,2BAA4B,SAAQ,uBAAuB;IAC/D,KAAK,sCAAe;IAE3B,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,uBAAuB,CAAC,IAAI,CAAC,GAAG,SAAS;IAY1F;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE;IAiBxG,OAAO,CAAC,MAAM;CAGf"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.UserRecordFormCustomization = void 0;
|
|
19
|
+
var db_ui_1 = require("@proteinjs/db-ui");
|
|
20
|
+
var user_1 = require("@proteinjs/user");
|
|
21
|
+
var UserRolesField_1 = require("./UserRolesField");
|
|
22
|
+
var UserStatusField_1 = require("./UserStatusField");
|
|
23
|
+
/**
|
|
24
|
+
* Makes the user record form tell the truth about its two service-owned columns:
|
|
25
|
+
* - `roles` is an ArrayColumn the default form hides; it renders as chips of the held roles with
|
|
26
|
+
* grant/revoke through `RolesService` (the one audited write path) for holders of the 'roles'
|
|
27
|
+
* permission — see `UserRolesField`;
|
|
28
|
+
* - `status` is written only by SetUserStatus; it renders read-only instead of as an editable box
|
|
29
|
+
* whose edits the form's save would silently drop — see `UserStatusField`.
|
|
30
|
+
*/
|
|
31
|
+
var UserRecordFormCustomization = /** @class */ (function (_super) {
|
|
32
|
+
__extends(UserRecordFormCustomization, _super);
|
|
33
|
+
function UserRecordFormCustomization() {
|
|
34
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
35
|
+
_this.table = user_1.tables.User;
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
UserRecordFormCustomization.prototype.getFieldRenderer = function (fieldName, user) {
|
|
39
|
+
if (fieldName === 'roles') {
|
|
40
|
+
return UserRolesField_1.UserRolesField;
|
|
41
|
+
}
|
|
42
|
+
if (fieldName === 'status') {
|
|
43
|
+
return UserStatusField_1.UserStatusField;
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Roles get their own full-width row right after the identity row: chips plus a grant control
|
|
49
|
+
* need the width, and managing access is the main reason to open a user record. The rest of the
|
|
50
|
+
* fields re-pair so no row is left with an orphan.
|
|
51
|
+
*/
|
|
52
|
+
UserRecordFormCustomization.prototype.getFieldLayout = function (user, defaultFieldLayout) {
|
|
53
|
+
var _a;
|
|
54
|
+
if (!user) {
|
|
55
|
+
return defaultFieldLayout;
|
|
56
|
+
}
|
|
57
|
+
var rows = this.asRows(defaultFieldLayout);
|
|
58
|
+
var rowWidth = Math.max.apply(Math, rows.map(function (row) { return row.length; }));
|
|
59
|
+
var fields = (_a = []).concat.apply(_a, rows).filter(function (field) { return field !== 'roles'; });
|
|
60
|
+
var identityRow = fields.splice(0, Math.min(rowWidth, fields.length));
|
|
61
|
+
var layout = [identityRow, ['roles']];
|
|
62
|
+
for (var i = 0; i < fields.length; i += rowWidth) {
|
|
63
|
+
layout.push(fields.slice(i, i + rowWidth));
|
|
64
|
+
}
|
|
65
|
+
return layout;
|
|
66
|
+
};
|
|
67
|
+
UserRecordFormCustomization.prototype.asRows = function (layout) {
|
|
68
|
+
return layout.map(function (row) { return (Array.isArray(row) ? row : [row]); });
|
|
69
|
+
};
|
|
70
|
+
return UserRecordFormCustomization;
|
|
71
|
+
}(db_ui_1.RecordFormCustomization));
|
|
72
|
+
exports.UserRecordFormCustomization = UserRecordFormCustomization;
|
|
73
|
+
//# sourceMappingURL=UserRecordFormCustomization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserRecordFormCustomization.js","sourceRoot":"","sources":["../../../src/form/UserRecordFormCustomization.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0CAAoF;AACpF,wCAA+C;AAC/C,mDAAkD;AAClD,qDAAoD;AAEpD;;;;;;;GAOG;AACH;IAAiD,+CAAuB;IAAxE;QAAA,qEAwCC;QAvCQ,WAAK,GAAG,aAAM,CAAC,IAAI,CAAC;;IAuC7B,CAAC;IArCC,sDAAgB,GAAhB,UAAiB,SAAiB,EAAE,IAAU;QAC5C,IAAI,SAAS,KAAK,OAAO,EAAE;YACzB,OAAO,+BAAc,CAAC;SACvB;QAED,IAAI,SAAS,KAAK,QAAQ,EAAE;YAC1B,OAAO,iCAAe,CAAC;SACxB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,oDAAc,GAAd,UAAe,IAAsB,EAAE,kBAAyC;;QAC9E,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,kBAAkB,CAAC;SAC3B;QAED,IAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC7C,IAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,MAAM,EAAV,CAAU,CAAC,CAAC,CAAC;QAC5D,IAAM,MAAM,GAAG,CAAA,KAAC,EAAe,CAAA,CAAC,MAAM,WAAI,IAAI,EAAE,MAAM,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,KAAK,OAAO,EAAjB,CAAiB,CAAC,CAAC;QACrF,IAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACxE,IAAM,MAAM,GAAe,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,QAAQ,EAAE;YAChD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;SAC5C;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,4CAAM,GAAd,UAAe,MAA6B;QAC1C,OAAO,MAAM,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAlC,CAAkC,CAAC,CAAC;IACjE,CAAC;IACH,kCAAC;AAAD,CAAC,AAxCD,CAAiD,+BAAuB,GAwCvE;AAxCY,kEAA2B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RecordFormFieldProps } from '@proteinjs/db-ui';
|
|
3
|
+
import { User } from '@proteinjs/user';
|
|
4
|
+
/**
|
|
5
|
+
* The `user.roles` slot on the user record form: chips of the held roles, and — for a holder of
|
|
6
|
+
* the 'roles' permission — a grant control fed by the roles catalog plus a revoke on each chip.
|
|
7
|
+
* Every change goes through `RolesService` (the one write path, audited per change) and then
|
|
8
|
+
* reloads the record, so the chips show what is stored rather than what was asked.
|
|
9
|
+
*
|
|
10
|
+
* Read-only for everyone else, and for machine accounts regardless of permission: their roles
|
|
11
|
+
* are declared in code and reverted to the declaration on every boot (the service refuses the
|
|
12
|
+
* write too; the control just doesn't offer what can only fail). The break-glass role is never
|
|
13
|
+
* in the pick-list — it is held by nobody day-to-day and is granted by bootstrap, not from here.
|
|
14
|
+
*/
|
|
15
|
+
export declare function UserRolesField({ record: user, value, label, reload }: RecordFormFieldProps<User, string[] | null>): React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=UserRolesField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserRolesField.d.ts","sourceRoot":"","sources":["../../../src/form/UserRolesField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAmD,IAAI,EAA8B,MAAM,iBAAiB,CAAC;AAEpH;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,qBA8EjH"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.UserRolesField = void 0;
|
|
43
|
+
var react_1 = __importDefault(require("react"));
|
|
44
|
+
var material_1 = require("@mui/material");
|
|
45
|
+
var Add_1 = __importDefault(require("@mui/icons-material/Add"));
|
|
46
|
+
var user_1 = require("@proteinjs/user");
|
|
47
|
+
/**
|
|
48
|
+
* The `user.roles` slot on the user record form: chips of the held roles, and — for a holder of
|
|
49
|
+
* the 'roles' permission — a grant control fed by the roles catalog plus a revoke on each chip.
|
|
50
|
+
* Every change goes through `RolesService` (the one write path, audited per change) and then
|
|
51
|
+
* reloads the record, so the chips show what is stored rather than what was asked.
|
|
52
|
+
*
|
|
53
|
+
* Read-only for everyone else, and for machine accounts regardless of permission: their roles
|
|
54
|
+
* are declared in code and reverted to the declaration on every boot (the service refuses the
|
|
55
|
+
* write too; the control just doesn't offer what can only fail). The break-glass role is never
|
|
56
|
+
* in the pick-list — it is held by nobody day-to-day and is granted by bootstrap, not from here.
|
|
57
|
+
*/
|
|
58
|
+
function UserRolesField(_a) {
|
|
59
|
+
var _this = this;
|
|
60
|
+
var user = _a.record, value = _a.value, label = _a.label, reload = _a.reload;
|
|
61
|
+
var heldRoles = value !== null && value !== void 0 ? value : [];
|
|
62
|
+
var isMachineAccount = user.isLoadedFromSource === true;
|
|
63
|
+
var canManage = user_1.UserAuth.hasPermission(user_1.USER_PERMISSIONS.roles) && !isMachineAccount;
|
|
64
|
+
var grantable = user_1.RolesCatalog.getEntries().filter(function (entry) { return !entry.breakGlass && !heldRoles.includes(entry.role); });
|
|
65
|
+
var _b = react_1.default.useState(null), menuAnchor = _b[0], setMenuAnchor = _b[1];
|
|
66
|
+
var _c = react_1.default.useState(false), inFlight = _c[0], setInFlight = _c[1];
|
|
67
|
+
var _d = react_1.default.useState(), error = _d[0], setError = _d[1];
|
|
68
|
+
var change = function (write) { return __awaiter(_this, void 0, void 0, function () {
|
|
69
|
+
var e_1;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
setMenuAnchor(null);
|
|
74
|
+
setInFlight(true);
|
|
75
|
+
setError(undefined);
|
|
76
|
+
_a.label = 1;
|
|
77
|
+
case 1:
|
|
78
|
+
_a.trys.push([1, 4, 5, 6]);
|
|
79
|
+
return [4 /*yield*/, write()];
|
|
80
|
+
case 2:
|
|
81
|
+
_a.sent();
|
|
82
|
+
return [4 /*yield*/, reload()];
|
|
83
|
+
case 3:
|
|
84
|
+
_a.sent();
|
|
85
|
+
return [3 /*break*/, 6];
|
|
86
|
+
case 4:
|
|
87
|
+
e_1 = _a.sent();
|
|
88
|
+
setError(e_1.message);
|
|
89
|
+
return [3 /*break*/, 6];
|
|
90
|
+
case 5:
|
|
91
|
+
setInFlight(false);
|
|
92
|
+
return [7 /*endfinally*/];
|
|
93
|
+
case 6: return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}); };
|
|
97
|
+
var grant = function (entry) { return change(function () { return (0, user_1.getRolesService)().grantRole(user.id, entry.role); }); };
|
|
98
|
+
var revoke = function (role) { return change(function () { return (0, user_1.getRolesService)().revokeRole(user.id, role); }); };
|
|
99
|
+
return (react_1.default.createElement(material_1.Stack, { spacing: 0.5, "data-user-roles": true },
|
|
100
|
+
react_1.default.createElement(material_1.Typography, { variant: 'caption', color: 'text.secondary' }, label),
|
|
101
|
+
react_1.default.createElement(material_1.Stack, { direction: 'row', sx: { flexWrap: 'wrap', gap: 1, alignItems: 'center', minHeight: 32 } },
|
|
102
|
+
heldRoles.map(function (role) {
|
|
103
|
+
var _a;
|
|
104
|
+
return (react_1.default.createElement(material_1.Chip, { key: role, label: role, title: (_a = user_1.RolesCatalog.getEntry(role)) === null || _a === void 0 ? void 0 : _a.description, "data-role-chip": true, disabled: inFlight, onDelete: canManage ? function () { return revoke(role); } : undefined }));
|
|
105
|
+
}),
|
|
106
|
+
heldRoles.length === 0 && !canManage && (react_1.default.createElement(material_1.Typography, { variant: 'body2', color: 'text.secondary' }, "None")),
|
|
107
|
+
canManage && grantable.length > 0 && (react_1.default.createElement(material_1.Chip, { label: 'Grant role', icon: react_1.default.createElement(Add_1.default, null), variant: 'outlined', clickable: true, "data-grant-role": true, disabled: inFlight, onClick: function (event) { return setMenuAnchor(event.currentTarget); } }))),
|
|
108
|
+
react_1.default.createElement(material_1.Menu, { open: !!menuAnchor, anchorEl: menuAnchor, onClose: function () { return setMenuAnchor(null); }, PaperProps: { sx: { maxWidth: 360 } } }, grantable.map(function (entry) { return (react_1.default.createElement(material_1.MenuItem, { key: entry.role, onClick: function () { return grant(entry); }, sx: { whiteSpace: 'normal' } },
|
|
109
|
+
react_1.default.createElement(material_1.ListItemText, { primary: entry.role, secondary: entry.description }))); })),
|
|
110
|
+
isMachineAccount && (react_1.default.createElement(material_1.FormHelperText, null, "Declared in code \u2014 a machine account's roles change with its declaration.")),
|
|
111
|
+
error && react_1.default.createElement(material_1.FormHelperText, { error: true }, error)));
|
|
112
|
+
}
|
|
113
|
+
exports.UserRolesField = UserRolesField;
|
|
114
|
+
//# sourceMappingURL=UserRolesField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserRolesField.js","sourceRoot":"","sources":["../../../src/form/UserRolesField.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,0CAAsG;AACtG,gEAA8C;AAE9C,wCAAoH;AAEpH;;;;;;;;;;GAUG;AACH,SAAgB,cAAc,CAAC,EAAmF;IAAlH,iBA8EC;QA9EwC,IAAI,YAAA,EAAE,KAAK,WAAA,EAAE,KAAK,WAAA,EAAE,MAAM,YAAA;IACjE,IAAM,SAAS,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;IAC9B,IAAM,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC;IAC1D,IAAM,SAAS,GAAG,eAAQ,CAAC,aAAa,CAAC,uBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC;IACtF,IAAM,SAAS,GAAG,mBAAY,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAApD,CAAoD,CAAC,CAAC;IAC9G,IAAA,KAA8B,eAAK,CAAC,QAAQ,CAAqB,IAAI,CAAC,EAArE,UAAU,QAAA,EAAE,aAAa,QAA4C,CAAC;IACvE,IAAA,KAA0B,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAA9C,QAAQ,QAAA,EAAE,WAAW,QAAyB,CAAC;IAChD,IAAA,KAAoB,eAAK,CAAC,QAAQ,EAAU,EAA3C,KAAK,QAAA,EAAE,QAAQ,QAA4B,CAAC;IAEnD,IAAM,MAAM,GAAG,UAAO,KAA0B;;;;;oBAC9C,aAAa,CAAC,IAAI,CAAC,CAAC;oBACpB,WAAW,CAAC,IAAI,CAAC,CAAC;oBAClB,QAAQ,CAAC,SAAS,CAAC,CAAC;;;;oBAElB,qBAAM,KAAK,EAAE,EAAA;;oBAAb,SAAa,CAAC;oBACd,qBAAM,MAAM,EAAE,EAAA;;oBAAd,SAAc,CAAC;;;;oBAEf,QAAQ,CAAC,GAAC,CAAC,OAAO,CAAC,CAAC;;;oBAEpB,WAAW,CAAC,KAAK,CAAC,CAAC;;;;;SAEtB,CAAC;IAEF,IAAM,KAAK,GAAG,UAAC,KAAuB,IAAK,OAAA,MAAM,CAAC,cAAM,OAAA,IAAA,sBAAe,GAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,EAAhD,CAAgD,CAAC,EAA9D,CAA8D,CAAC;IAC1G,IAAM,MAAM,GAAG,UAAC,IAAY,IAAK,OAAA,MAAM,CAAC,cAAM,OAAA,IAAA,sBAAe,GAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAA3C,CAA2C,CAAC,EAAzD,CAAyD,CAAC;IAE3F,OAAO,CACL,8BAAC,gBAAK,IAAC,OAAO,EAAE,GAAG;QACjB,8BAAC,qBAAU,IAAC,OAAO,EAAC,SAAS,EAAC,KAAK,EAAC,gBAAgB,IACjD,KAAK,CACK;QACb,8BAAC,gBAAK,IAAC,SAAS,EAAC,KAAK,EAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;YACzF,SAAS,CAAC,GAAG,CAAC,UAAC,IAAI;;gBAAK,OAAA,CACvB,8BAAC,eAAI,IACH,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,IAAI,EACX,KAAK,EAAE,MAAA,mBAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,0CAAE,WAAW,0BAE/C,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,cAAM,OAAA,MAAM,CAAC,IAAI,CAAC,EAAZ,CAAY,CAAC,CAAC,CAAC,SAAS,GACpD,CACH,CAAA;aAAA,CAAC;YACD,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,CACvC,8BAAC,qBAAU,IAAC,OAAO,EAAC,OAAO,EAAC,KAAK,EAAC,gBAAgB,WAErC,CACd;YACA,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CACpC,8BAAC,eAAI,IACH,KAAK,EAAC,YAAY,EAClB,IAAI,EAAE,8BAAC,aAAO,OAAG,EACjB,OAAO,EAAC,UAAU,EAClB,SAAS,iCAET,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,UAAC,KAAK,IAAK,OAAA,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,EAAlC,CAAkC,GACtD,CACH,CACK;QAER,8BAAC,eAAI,IACH,IAAI,EAAE,CAAC,CAAC,UAAU,EAClB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,cAAM,OAAA,aAAa,CAAC,IAAI,CAAC,EAAnB,CAAmB,EAClC,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,IAEpC,SAAS,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,CACxB,8BAAC,mBAAQ,IAAC,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,cAAM,OAAA,KAAK,CAAC,KAAK,CAAC,EAAZ,CAAY,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;YAClF,8BAAC,uBAAY,IAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,WAAW,GAAI,CAC1D,CACZ,EAJyB,CAIzB,CAAC,CACG;QACN,gBAAgB,IAAI,CACnB,8BAAC,yBAAc,yFAA2F,CAC3G;QACA,KAAK,IAAI,8BAAC,yBAAc,IAAC,KAAK,UAAE,KAAK,CAAkB,CAClD,CACT,CAAC;AACJ,CAAC;AA9ED,wCA8EC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RecordFormFieldProps } from '@proteinjs/db-ui';
|
|
3
|
+
import { User, UserStatus } from '@proteinjs/user';
|
|
4
|
+
/**
|
|
5
|
+
* The `user.status` slot on the user record form: the account's standing, read-only. Its only
|
|
6
|
+
* writer is the SetUserStatus service (audited per change); an editable box here would take edits
|
|
7
|
+
* the form's save silently drops. A null status (rows predating the column) reads as active —
|
|
8
|
+
* the same reading every gate applies.
|
|
9
|
+
*/
|
|
10
|
+
export declare function UserStatusField({ value, label }: RecordFormFieldProps<User, UserStatus | null | undefined>): React.JSX.Element;
|
|
11
|
+
//# sourceMappingURL=UserStatusField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserStatusField.d.ts","sourceRoot":"","sources":["../../../src/form/UserStatusField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC,qBAkB1G"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UserStatusField = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var material_1 = require("@mui/material");
|
|
9
|
+
/**
|
|
10
|
+
* The `user.status` slot on the user record form: the account's standing, read-only. Its only
|
|
11
|
+
* writer is the SetUserStatus service (audited per change); an editable box here would take edits
|
|
12
|
+
* the form's save silently drops. A null status (rows predating the column) reads as active —
|
|
13
|
+
* the same reading every gate applies.
|
|
14
|
+
*/
|
|
15
|
+
function UserStatusField(_a) {
|
|
16
|
+
var value = _a.value, label = _a.label;
|
|
17
|
+
var status = value !== null && value !== void 0 ? value : 'active';
|
|
18
|
+
return (react_1.default.createElement(material_1.Stack, { spacing: 0.5, "data-user-status": true },
|
|
19
|
+
react_1.default.createElement(material_1.Typography, { variant: 'caption', color: 'text.secondary' }, label),
|
|
20
|
+
react_1.default.createElement(material_1.Stack, { direction: 'row', sx: { alignItems: 'center', minHeight: 32 } },
|
|
21
|
+
react_1.default.createElement(material_1.Chip, { label: status === 'deactivated' ? 'Deactivated' : 'Active', variant: 'outlined', color: status === 'deactivated' ? 'default' : 'success', size: 'small' }))));
|
|
22
|
+
}
|
|
23
|
+
exports.UserStatusField = UserStatusField;
|
|
24
|
+
//# sourceMappingURL=UserStatusField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserStatusField.js","sourceRoot":"","sources":["../../../src/form/UserStatusField.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAC1B,0CAAwD;AAIxD;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,EAA2E;QAAzE,KAAK,WAAA,EAAE,KAAK,WAAA;IAC5C,IAAM,MAAM,GAAe,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,QAAQ,CAAC;IAE7C,OAAO,CACL,8BAAC,gBAAK,IAAC,OAAO,EAAE,GAAG;QACjB,8BAAC,qBAAU,IAAC,OAAO,EAAC,SAAS,EAAC,KAAK,EAAC,gBAAgB,IACjD,KAAK,CACK;QACb,8BAAC,gBAAK,IAAC,SAAS,EAAC,KAAK,EAAC,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;YAChE,8BAAC,eAAI,IACH,KAAK,EAAE,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,EAC1D,OAAO,EAAC,UAAU,EAClB,KAAK,EAAE,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACvD,IAAI,EAAC,OAAO,GACZ,CACI,CACF,CACT,CAAC;AACJ,CAAC;AAlBD,0CAkBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserRecordFormCustomization.test.d.ts","sourceRoot":"","sources":["../../test/UserRecordFormCustomization.test.tsx"],"names":[],"mappings":"AAwBA,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,wBAAwB,EAAE,OAAO,CAAC;CACvC"}
|