@isoftdata/svelte-user-configuration 2.0.5 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/UserAccountInfo.svelte +4 -4
- package/dist/UserAccountInfo.svelte.d.ts +1 -1
- package/dist/UserConfiguration.svelte +33 -25
- package/dist/UserConfiguration.svelte.d.ts +7 -4
- package/dist/UserGroupMembership.svelte +2 -2
- package/dist/UserGroupMembership.svelte.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ pnpm i @isoftdata/svelte-user-configuration
|
|
|
29
29
|
| `doSendPasswordRecoveryToken` | boolean | ❌ | `false` | Whether to allow sending password recovery tokens. |
|
|
30
30
|
| `hasPermissionToChangePassword` | boolean | ❌ | `false` | Whether the user has permission to change passwords. |
|
|
31
31
|
| `myAccountMode` | boolean | ❌ | `false` | When `true`, admin controls will be hidden/disabled. This is designed to be used when using the user account info component standalone so the current session user can edit their own account info, including first & last name, password recovery email, & password. |
|
|
32
|
-
| `passwordValidationRules` | `validationRules` of the [PasswordFields](<https://github.com/ISoft-Data-Systems/svelte-component-password-fields>) component | ❌ | `undefined` | Passwords rules to be enforced during password change. |
|
|
32
|
+
| `passwordValidationRules` | `validationRules` of the [PasswordFields](<https://github.com/ISoft-Data-Systems/svelte-component-password-fields>) component | ❌ | `undefined` | Passwords rules to be enforced during password change. |
|
|
33
33
|
|
|
34
34
|
> The `passwordValidationRules` prop will be used during password setting when `hasPermissionToChangePassword` or `myAccountMode` are `true` .
|
|
35
35
|
|
|
@@ -60,6 +60,7 @@ pnpm i @isoftdata/svelte-user-configuration
|
|
|
60
60
|
| Prop | Type | Required | Default | Description |
|
|
61
61
|
|------|------|----------|---------|-------------|
|
|
62
62
|
| `siteLabel` | `SiteLabel` | ❌ | `"Site"` | Label for the site. |
|
|
63
|
+
| `showSiteAccess` | boolean | ❌ | `true` | Whether the site access section is shown. |
|
|
63
64
|
| `userAccountInfoIcon` | `IconName` | ❌ | `"user"` | Icon for the user account section. |
|
|
64
65
|
| `groupMembershipIcon` | `IconName` | ❌ | `"users"` | Icon for the group membership section. |
|
|
65
66
|
| `permissionListIcon` | `IconName` | ❌ | `"user-lock"` | Icon for the permission list section. |
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
deactivateUser?: DeactivateUserFn
|
|
27
27
|
success?: ((info: { heading: string; message: string }) => void | Promise<void>) | undefined
|
|
28
28
|
error?: ((info: { heading: string; message: string }) => void | Promise<void>) | undefined
|
|
29
|
-
accountInfoChanged?: (() => void | Promise<void>) | undefined
|
|
29
|
+
accountInfoChanged?: ((userAccount: UserAccount) => void | Promise<void>) | undefined
|
|
30
30
|
sendPasswordRecoveryToken?: ComponentProps<typeof PasswordRecoveryModal>['sendPasswordRecoveryToken']
|
|
31
31
|
doSendPasswordRecoveryToken?: boolean
|
|
32
32
|
icon?: IconName
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
await success?.({ heading: successHeading, message: successMessage })
|
|
103
103
|
|
|
104
104
|
isLoading = false
|
|
105
|
-
await accountInfoChanged?.()
|
|
105
|
+
await accountInfoChanged?.(userAccount)
|
|
106
106
|
} catch (err) {
|
|
107
107
|
console.error(err)
|
|
108
108
|
await error?.({
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
) {
|
|
139
139
|
userAccount.status = 'ACTIVE'
|
|
140
140
|
userAccount.lockNotes = null
|
|
141
|
-
await accountInfoChanged?.()
|
|
141
|
+
await accountInfoChanged?.(userAccount)
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -396,7 +396,7 @@
|
|
|
396
396
|
userAccount.lockNotes = lockNotes
|
|
397
397
|
try {
|
|
398
398
|
await deactivateUser?.({ id: userAccount.id, lockNotes })
|
|
399
|
-
await accountInfoChanged?.()
|
|
399
|
+
await accountInfoChanged?.(userAccount)
|
|
400
400
|
} catch (err) {
|
|
401
401
|
console.error(err)
|
|
402
402
|
await error?.({
|
|
@@ -18,7 +18,7 @@ interface Props extends HTMLDivAttributes {
|
|
|
18
18
|
heading: string;
|
|
19
19
|
message: string;
|
|
20
20
|
}) => void | Promise<void>) | undefined;
|
|
21
|
-
accountInfoChanged?: (() => void | Promise<void>) | undefined;
|
|
21
|
+
accountInfoChanged?: ((userAccount: UserAccount) => void | Promise<void>) | undefined;
|
|
22
22
|
sendPasswordRecoveryToken?: ComponentProps<typeof PasswordRecoveryModal>['sendPasswordRecoveryToken'];
|
|
23
23
|
doSendPasswordRecoveryToken?: boolean;
|
|
24
24
|
icon?: IconName;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { type Snippet } from 'svelte'
|
|
2
3
|
import type {
|
|
3
4
|
ErrorFn,
|
|
4
5
|
IconName,
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
generateNewActivationPIN?: GenerateNewActivationPINFn
|
|
57
58
|
userSites: UserSites
|
|
58
59
|
canEditSiteAccess?: CanEditSiteAccess
|
|
60
|
+
showSiteAccess?: boolean
|
|
59
61
|
siteAccessChange?: SiteAccessChangeFn
|
|
60
62
|
groupMembership: GroupMembership
|
|
61
63
|
canEditGroupMembership?: CanEditGroupMembership
|
|
@@ -64,10 +66,11 @@
|
|
|
64
66
|
permissionValueMap?: PermissionValueMap
|
|
65
67
|
groupPermissionValueMap?: GroupPermissionValueMap
|
|
66
68
|
permissionValueChange?: PermissionValueChangeFn
|
|
67
|
-
userAccountInfo?:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
userAccountInfo?: Snippet
|
|
70
|
+
userAccountFormFields?: Snippet
|
|
71
|
+
siteAccess?: Snippet
|
|
72
|
+
userGroupMembership?: Snippet
|
|
73
|
+
permissionList?: Snippet
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
let {
|
|
@@ -91,8 +94,9 @@
|
|
|
91
94
|
accountInfoChanged = undefined,
|
|
92
95
|
sendPasswordRecoveryToken = undefined,
|
|
93
96
|
generateNewActivationPIN = () => Promise.resolve(),
|
|
94
|
-
userSites,
|
|
97
|
+
userSites = [],
|
|
95
98
|
canEditSiteAccess = true,
|
|
99
|
+
showSiteAccess = true,
|
|
96
100
|
siteAccessChange = undefined,
|
|
97
101
|
groupMembership,
|
|
98
102
|
canEditGroupMembership = true,
|
|
@@ -102,6 +106,7 @@
|
|
|
102
106
|
groupPermissionValueMap = undefined,
|
|
103
107
|
permissionValueChange = undefined,
|
|
104
108
|
userAccountInfo,
|
|
109
|
+
userAccountFormFields,
|
|
105
110
|
siteAccess,
|
|
106
111
|
userGroupMembership,
|
|
107
112
|
permissionList,
|
|
@@ -113,14 +118,15 @@
|
|
|
113
118
|
<div class="row">
|
|
114
119
|
<div class="col-12 col-lg-4 mb-2">
|
|
115
120
|
<UserAccountInfo
|
|
116
|
-
bind:userAccount
|
|
117
|
-
bind:usernameInput
|
|
118
|
-
bind:doSendPasswordRecoveryToken
|
|
119
|
-
bind:cardHeight
|
|
120
121
|
{canToggleActive}
|
|
121
122
|
{canEditAccountInfo}
|
|
122
123
|
{passwordValidationRules}
|
|
123
124
|
{hasPermissionToChangePassword}
|
|
125
|
+
icon={userAccountInfoIcon}
|
|
126
|
+
bind:userAccount
|
|
127
|
+
bind:usernameInput
|
|
128
|
+
bind:doSendPasswordRecoveryToken
|
|
129
|
+
bind:cardHeight
|
|
124
130
|
{error}
|
|
125
131
|
{success}
|
|
126
132
|
{deactivateUser}
|
|
@@ -128,30 +134,32 @@
|
|
|
128
134
|
{confirmPasswordSet}
|
|
129
135
|
{generateNewActivationPIN}
|
|
130
136
|
{sendPasswordRecoveryToken}
|
|
131
|
-
|
|
137
|
+
formFields={userAccountFormFields}
|
|
132
138
|
>
|
|
133
139
|
{@render userAccountInfo?.()}
|
|
134
140
|
</UserAccountInfo>
|
|
135
141
|
</div>
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
{#if showSiteAccess}
|
|
143
|
+
<div class="col-12 col-lg-4 mb-2">
|
|
144
|
+
<UserSiteAccess
|
|
145
|
+
{siteLabel}
|
|
146
|
+
{userSites}
|
|
147
|
+
{canEditSiteAccess}
|
|
148
|
+
style="height: {cardHeight}px;"
|
|
149
|
+
icon={userSiteAccessIcon}
|
|
150
|
+
{siteAccessChange}
|
|
151
|
+
>
|
|
152
|
+
{@render siteAccess?.()}
|
|
153
|
+
</UserSiteAccess>
|
|
154
|
+
</div>
|
|
155
|
+
{/if}
|
|
148
156
|
<div class="col-12 col-lg-4 mb-2">
|
|
149
157
|
<UserGroupMembership
|
|
150
158
|
{groupMembership}
|
|
151
159
|
{canEditGroupMembership}
|
|
152
|
-
{groupMembershipChange}
|
|
153
|
-
icon={groupMembershipIcon}
|
|
154
160
|
style="height: {cardHeight}px;"
|
|
161
|
+
icon={groupMembershipIcon}
|
|
162
|
+
{groupMembershipChange}
|
|
155
163
|
>
|
|
156
164
|
{@render userGroupMembership?.()}
|
|
157
165
|
</UserGroupMembership>
|
|
@@ -164,9 +172,9 @@
|
|
|
164
172
|
{permissions}
|
|
165
173
|
{permissionValueMap}
|
|
166
174
|
{groupPermissionValueMap}
|
|
167
|
-
{permissionValueChange}
|
|
168
175
|
icon={permissionListIcon}
|
|
169
176
|
cardHeaderTitle={permissionListCardHeaderTitle}
|
|
177
|
+
{permissionValueChange}
|
|
170
178
|
>
|
|
171
179
|
{@render permissionList?.()}
|
|
172
180
|
</PermissionList>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
1
2
|
import type { ErrorFn, IconName, UserSites, SuccessFn, SiteLabel, UserAccount, Permissions, GroupMembership, CanToggleActive, DeactivateUserFn, CanEditSiteAccess, SiteAccessChangeFn, PermissionValueMap, CanEditAccountInfo, ConfirmPasswordSetFn, AccountInfoChangedFn, CanEditGroupMembership, PasswordValidationRules, GroupMembershipChangeFn, PermissionValueChangeFn, GroupPermissionValueMap, GenerateNewActivationPINFn, DoSendPasswordRecoveryToken, SendPasswordRecoveryTokenFn, HasPermissionToChangePassword, PermissionListCardHeaderTitle } from './util';
|
|
2
3
|
interface Props {
|
|
3
4
|
siteLabel?: SiteLabel;
|
|
@@ -22,6 +23,7 @@ interface Props {
|
|
|
22
23
|
generateNewActivationPIN?: GenerateNewActivationPINFn;
|
|
23
24
|
userSites: UserSites;
|
|
24
25
|
canEditSiteAccess?: CanEditSiteAccess;
|
|
26
|
+
showSiteAccess?: boolean;
|
|
25
27
|
siteAccessChange?: SiteAccessChangeFn;
|
|
26
28
|
groupMembership: GroupMembership;
|
|
27
29
|
canEditGroupMembership?: CanEditGroupMembership;
|
|
@@ -30,10 +32,11 @@ interface Props {
|
|
|
30
32
|
permissionValueMap?: PermissionValueMap;
|
|
31
33
|
groupPermissionValueMap?: GroupPermissionValueMap;
|
|
32
34
|
permissionValueChange?: PermissionValueChangeFn;
|
|
33
|
-
userAccountInfo?:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
userAccountInfo?: Snippet;
|
|
36
|
+
userAccountFormFields?: Snippet;
|
|
37
|
+
siteAccess?: Snippet;
|
|
38
|
+
userGroupMembership?: Snippet;
|
|
39
|
+
permissionList?: Snippet;
|
|
37
40
|
}
|
|
38
41
|
declare const UserConfiguration: import("svelte").Component<Props, {}, "doSendPasswordRecoveryToken" | "userAccount" | "usernameInput">;
|
|
39
42
|
type UserConfiguration = ReturnType<typeof UserConfiguration>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { i18n } from 'i18next'
|
|
3
3
|
import type { IconName, HTMLDivAttributes } from './'
|
|
4
4
|
|
|
5
|
-
import { getContext } from 'svelte'
|
|
5
|
+
import { getContext, type Snippet } from 'svelte'
|
|
6
6
|
import Icon from '@isoftdata/svelte-icon'
|
|
7
7
|
import Checkbox from '@isoftdata/svelte-checkbox'
|
|
8
8
|
import { translate as defaultTranslate } from '@isoftdata/utility-string'
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
canEditGroupMembership?: boolean
|
|
21
21
|
groupMembershipChange?: ((groupMembership: GroupMembership) => void | Promise<void>) | undefined
|
|
22
22
|
icon?: IconName
|
|
23
|
-
children?:
|
|
23
|
+
children?: Snippet
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
let {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IconName, HTMLDivAttributes } from './';
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
2
3
|
interface GroupMembership {
|
|
3
4
|
id: number;
|
|
4
5
|
name: string;
|
|
@@ -9,7 +10,7 @@ interface Props extends HTMLDivAttributes {
|
|
|
9
10
|
canEditGroupMembership?: boolean;
|
|
10
11
|
groupMembershipChange?: ((groupMembership: GroupMembership) => void | Promise<void>) | undefined;
|
|
11
12
|
icon?: IconName;
|
|
12
|
-
children?:
|
|
13
|
+
children?: Snippet;
|
|
13
14
|
}
|
|
14
15
|
declare const UserGroupMembership: import("svelte").Component<Props, {}, "">;
|
|
15
16
|
type UserGroupMembership = ReturnType<typeof UserGroupMembership>;
|