@isoftdata/svelte-user-configuration 1.0.13 → 1.0.15

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.
@@ -30,9 +30,10 @@ const { t: translate } = getContext("i18next") || { t: (_key, fallback) => fallb
30
30
  >
31
31
  <form
32
32
  id="deactivateUserModalForm"
33
- on:submit={e => {
33
+ on:submit={async e => {
34
34
  e.preventDefault()
35
- userAccount && deactivateUser ? deactivateUser({ id: userAccount.id, lockNotes }) : undefined
35
+ userAccount ? await deactivateUser?.({ id: userAccount.id, lockNotes }) : undefined
36
+ show = false
36
37
  }}
37
38
  >
38
39
  <TextArea
@@ -138,13 +138,19 @@ $: computedPermissions = getComputedPermissions(permissions, permissionValueMap,
138
138
  property="groupValue"
139
139
  class="px-4"
140
140
  >
141
- <span class="badge badge-pill badge-{permissionValueList[permission.groupValue ?? 'NONE'].color}">{permissionValueList[permission.groupValue ?? 'NONE'].label}</span>
141
+ <span
142
+ style="width: 5em;"
143
+ class="badge badge-pill badge-{permissionValueList[permission.groupValue ?? 'NONE'].color}">{permissionValueList[permission.groupValue ?? 'NONE'].label}</span
144
+ >
142
145
  </Td>
143
146
  <Td
144
147
  property="computedValue"
145
148
  class="px-4"
146
149
  >
147
- <span class="badge badge-pill badge-{permissionValueList[permission.computedValue ?? 'NONE'].color}">{permissionValueList[permission.computedValue ?? 'NONE'].label}</span>
150
+ <span
151
+ style="width: 5em;"
152
+ class="badge badge-pill badge-{permissionValueList[permission.computedValue ?? 'NONE'].color}">{permissionValueList[permission.computedValue ?? 'NONE'].label}</span
153
+ >
148
154
  </Td>
149
155
  {/if}
150
156
  <Td property="category">{permission.category}</Td>
@@ -20,6 +20,7 @@ export let error = void 0;
20
20
  export let success = void 0;
21
21
  export let sendPasswordRecoveryToken = void 0;
22
22
  export let generateNewActivationPIN = () => Promise.resolve();
23
+ export let usernameInput = void 0;
23
24
  let isLoading = false;
24
25
  let passwordSetModal;
25
26
  let deactivateUserModal;
@@ -61,11 +62,6 @@ async function reactivateUserAccount() {
61
62
  await accountInfoChanged?.();
62
63
  }
63
64
  }
64
- async function deactivateUserAccount(lockNotes) {
65
- userAccount.status = "DEACTIVATED";
66
- userAccount.lockNotes = lockNotes;
67
- await accountInfoChanged?.();
68
- }
69
65
  $: workEmail = userAccount.workEmail;
70
66
  $: status = userAccount.status;
71
67
  $: activationPIN = userAccount.userActivationData?.activationPIN;
@@ -98,7 +94,7 @@ $: activationPIN = userAccount.userActivationData?.activationPIN;
98
94
  </Button>
99
95
  {:else if status === 'DEACTIVATED' || status === 'LOCKED'}
100
96
  <Button
101
- size="sm"
97
+ size="xs"
102
98
  outline
103
99
  color="success"
104
100
  iconClass="check"
@@ -189,7 +185,6 @@ $: activationPIN = userAccount.userActivationData?.activationPIN;
189
185
  {/if}
190
186
  <div class="col-12">
191
187
  <Input
192
- id="usernameInput"
193
188
  label={translate('configuration.user.accountInfo.username', 'Username')}
194
189
  bind:value={userAccount.name}
195
190
  maxlength={320}
@@ -199,6 +194,7 @@ $: activationPIN = userAccount.userActivationData?.activationPIN;
199
194
  return value.length > 320 ? 'Username must be less than 320 characters.' : true
200
195
  },
201
196
  }}
197
+ bind:input={usernameInput}
202
198
  />
203
199
  </div>
204
200
  <div class="col-6">
@@ -266,7 +262,19 @@ $: activationPIN = userAccount.userActivationData?.activationPIN;
266
262
 
267
263
  <DeactivateUserModal
268
264
  bind:this={deactivateUserModal}
269
- {deactivateUser}
265
+ deactivateUser={async ({ lockNotes }) => {
266
+ userAccount.status = 'DEACTIVATED'
267
+ userAccount.lockNotes = lockNotes
268
+ try {
269
+ await deactivateUser?.({ id: userAccount.id, lockNotes })
270
+ await accountInfoChanged?.()
271
+ } catch (err) {
272
+ console.error(err)
273
+ if (err instanceof Error) {
274
+ await error?.({ heading: translate('configuration.user.messageHeading.failedToDeactivateUser', 'Failed To Deactivate User'), message: err.message })
275
+ }
276
+ }
277
+ }}
270
278
  />
271
279
 
272
280
  <PasswordSetModal
@@ -21,6 +21,7 @@ declare const __propDef: {
21
21
  accountInfoChanged?: (() => void | Promise<void>) | undefined;
22
22
  sendPasswordRecoveryToken?: ((email: string | undefined) => void | Promise<void>) | undefined;
23
23
  icon?: IconName;
24
+ usernameInput?: HTMLInputElement | undefined;
24
25
  };
25
26
  events: {
26
27
  [evt: string]: CustomEvent<any>;
@@ -9,6 +9,7 @@ export let permissionListIcon = "user-lock";
9
9
  export let userSiteAccessIcon = "industry-windows";
10
10
  export let permissionListCardHeaderTitle = "Permissions";
11
11
  export let cardDeckHeight = "500px";
12
+ export let usernameInput = void 0;
12
13
  export let userAccount;
13
14
  export let canToggleActive = true;
14
15
  export let isCreatingNewUser = false;
@@ -37,6 +38,7 @@ export let permissionValueChange = void 0;
37
38
  <div class="col-12 col-lg-4 mb-2">
38
39
  <UserAccountInfo
39
40
  bind:userAccount
41
+ bind:usernameInput
40
42
  {canToggleActive}
41
43
  {canEditAccountInfo}
42
44
  {isCreatingNewUser}
@@ -9,6 +9,7 @@ declare const __propDef: {
9
9
  userSiteAccessIcon?: IconName;
10
10
  permissionListCardHeaderTitle?: PermissionListCardHeaderTitle;
11
11
  /** The height of the cards in the first row. */ cardDeckHeight?: string;
12
+ usernameInput?: HTMLInputElement | undefined;
12
13
  userAccount: UserAccount;
13
14
  canToggleActive?: CanToggleActive;
14
15
  isCreatingNewUser?: IsCreatingNewUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoftdata/svelte-user-configuration",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",