@humandialog/forms.svelte 1.7.11 → 1.7.12

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.
@@ -348,7 +348,7 @@ async function onDownloadFile(e) {
348
348
  </a>
349
349
  {/if}
350
350
  </p>
351
- {:else}
351
+ {:else if definition.onOpen}
352
352
  <p class=" text-base font-semibold
353
353
 
354
354
  whitespace-nowrap overflow-clip w-full sm:flex-none sm:{name_w}"
@@ -372,6 +372,19 @@ async function onDownloadFile(e) {
372
372
  {/if}
373
373
  -->
374
374
  </p>
375
+ {:else}
376
+ <p class=" text-base font-semibold
377
+ whitespace-nowrap overflow-clip w-full sm:flex-none sm:{name_w}"
378
+ id="__hd_list_ctrl_{getItemKey(item)}_Title"
379
+ use:editable={{
380
+ action: (text) => {change_name(text)},
381
+ active: true,
382
+ readonly: definition.title_readonly,
383
+ }}>
384
+ <span>
385
+ {element_title}
386
+ </span>
387
+ </p>
375
388
  {/if}
376
389
  {/key}
377
390
  {:else}
package/operations.svelte CHANGED
@@ -110,8 +110,11 @@ function update(...args) {
110
110
  ...op,
111
111
  group: group.caption
112
112
  };
113
- if (op.hideToolbarCaption)
113
+ if (op.hideToolbarCaption) {
114
+ if (!tbrOperation.tooltip)
115
+ tbrOperation.tooltip = tbrOperation.caption;
114
116
  tbrOperation.caption = "";
117
+ }
115
118
  const shouldAddSeparator = (list, groupName) => {
116
119
  if (!groupName)
117
120
  return false;
@@ -197,6 +200,14 @@ function isOperationDisabled(operation) {
197
200
  else
198
201
  return operation.disabled ?? false;
199
202
  }
203
+ function operationTooltip(operation) {
204
+ if (!operation)
205
+ return "";
206
+ else if (operation.tooltip)
207
+ return operation.tooltip;
208
+ else
209
+ return "";
210
+ }
200
211
  </script>
201
212
 
202
213
  {#if hasOperations}
@@ -221,6 +232,7 @@ function isOperationDisabled(operation) {
221
232
  inline-flex items-center"
222
233
  class:bg-stone-700={isActive}
223
234
  class:dark:bg-stone-800={isActive}
235
+ title={operationTooltip(operation)}
224
236
  on:mousedown={(e) => mousedown(e, operation)}
225
237
  on:click={(e) => {on_click(e, operation, isDisabled)}}>
226
238
  {#if operation.icon}
@@ -251,6 +263,7 @@ function isOperationDisabled(operation) {
251
263
  class:bg-stone-200={isActive}
252
264
  class:dark:bg-stone-800={isActive}
253
265
  disabled={isDisabled}
266
+ title={operationTooltip(operation)}
254
267
  on:mousedown={(e) => mousedown(e, operation)}
255
268
  on:click={(e) => {on_click(e, operation, isDisabled)}}>
256
269
  {#if operation.icon}
@@ -293,6 +306,7 @@ function isOperationDisabled(operation) {
293
306
  class:bg-stone-200={isActive}
294
307
  class:dark:bg-stone-800={isActive}
295
308
  disabled={isDisabled}
309
+ title={operationTooltip(operation)}
296
310
  on:mousedown={(e) => mousedown(e, operation)}
297
311
  on:click={(e) => {on_click(e, operation, isDisabled)}}>
298
312
  {#if operation.icon}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.7.11",
3
+ "version": "1.7.12",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
@@ -5,7 +5,7 @@
5
5
  FaInfoCircle,
6
6
  FaUserSlash,
7
7
  FaChevronDown,
8
- FaInfo} from 'svelte-icons/fa'
8
+ FaInfo, FaLink} from 'svelte-icons/fa'
9
9
 
10
10
  import Page from './page.svelte'
11
11
  import List from './components/list/list.svelte'
@@ -189,7 +189,8 @@
189
189
  auth_group: 0,
190
190
  files_group: 0,
191
191
  acc_role: '',
192
- silently: false
192
+ silently: false,
193
+ accepted: false
193
194
  }
194
195
 
195
196
  let name_input;
@@ -367,7 +368,8 @@
367
368
  caption: i18n({en: 'Fetch info', es: 'Obtener información', pl: 'Pobierz informacje'}),
368
369
  icon: FaInfo,
369
370
  action: (f) => fetch_user_details(user),
370
- tbr: 'A'
371
+ tbr: 'A',
372
+ fab: 'S00'
371
373
  }
372
374
  ];
373
375
 
@@ -375,11 +377,11 @@
375
377
  {
376
378
  operations = [ ...operations,
377
379
  {
378
- icon: FaUserPlus,
380
+ //icon: FaUserPlus,
379
381
  caption: i18n({en: 'Revert removing', es: 'Revertir eliminación', pl: 'Cofnij usunięcie'}),
380
382
  action: (f) => askToAddAgain(user),
381
383
  // fab: 'M10',
382
- tbr: 'A'
384
+ // tbr: 'A'
383
385
  }
384
386
  ];
385
387
  }
@@ -391,16 +393,24 @@
391
393
  icon: FaPen,
392
394
  caption: i18n({en: 'Change', es: 'Cambiar', pl: 'Zmień'}),
393
395
  menu: edit_operations,
394
- //fab: 'M20',
396
+ fab: 'M20',
395
397
  tbr: 'A'
396
398
  });
397
399
 
398
400
  operations.push({
399
401
  caption: i18n({en: 'Remove user', es: 'Eliminar usuario', pl: 'Usuń użytkownika'}),
400
- icon: FaUserMinus,
402
+ // icon: FaUserMinus,
401
403
  action: (focused) => askToRemove(user),
402
404
  // fab: 'M30',
403
- tbr: 'A'
405
+ // tbr: 'A'
406
+ });
407
+
408
+ operations.push({
409
+ caption: i18n({en: 'Copy the invitation link', es: 'Copie el enlace de invitación', pl: 'Skopuj link zapraszający'}),
410
+ //icon: FaLink,
411
+ action: (focused) => regenerateAndCopyInvitationLink(user),
412
+ // fab: 'M30',
413
+ //tbr: 'A'
404
414
  });
405
415
  }
406
416
 
@@ -408,6 +418,7 @@
408
418
  return {
409
419
  opver: 2,
410
420
  fab: 'M00',
421
+ tbr: 'D',
411
422
  operations: [
412
423
  {
413
424
  caption: i18n({en: 'User', es: 'Usuario', pl: 'Użytkownik'}),
@@ -418,7 +429,37 @@
418
429
  }
419
430
  }
420
431
 
421
-
432
+ async function regenerateAndCopyInvitationLink(user)
433
+ {
434
+ try {
435
+ let params = `username=${user[emailAttrib]}`
436
+ params += `&client_id=${$session.configuration.client_id}`
437
+ params += `&redirect_uri=${encodeURIComponent(window.location.origin+'/#/auth/cb')}`
438
+ params += `&state=${encodeURIComponent(window.location.origin+'/#/auth/signin')}`
439
+ params += `&tenant=${$session.tid}`
440
+ params += `&scope=${$session.appId}`
441
+
442
+ console.log(params)
443
+
444
+ const res = await reef.fetch(`/auth/regenerate_invitation_link?${params}`)
445
+
446
+ if(res.ok)
447
+ {
448
+ const result = await res.json();
449
+ console.log(result.invitation_link)
450
+ navigator.clipboard.writeText(result.invitation_link)
451
+ }
452
+ else
453
+ {
454
+ const err_msg = await res.text();
455
+ onErrorShowAlert(err_msg);
456
+ }
457
+ }
458
+ catch (err)
459
+ {
460
+ onErrorShowAlert(err);
461
+ }
462
+ }
422
463
 
423
464
  let data_item =
424
465
  {
@@ -541,6 +582,7 @@
541
582
  state: `${window.location.origin}/#/auth/signin`,
542
583
  idempotency_token: inviteUserIdempotencyToken,
543
584
  silently: new_user.silently ?? false,
585
+ accepted: new_user.accepted ?? false,
544
586
  set:
545
587
  {
546
588
  [nameAttrib]: new_user.name,
@@ -593,6 +635,7 @@
593
635
  new_user.files_group = 0;
594
636
  new_user.acc_role = ''
595
637
  new_user.silently = false;
638
+ new_user.accepted = false;
596
639
 
597
640
  create_new_user_enabled = false;
598
641
  }
@@ -605,6 +648,7 @@
605
648
  new_user.files_group = 0;
606
649
  new_user.acc_role = ''
607
650
  new_user.silently = false;
651
+ new_user.accepted = false;
608
652
 
609
653
  create_new_user_enabled = false;
610
654
  }
@@ -693,6 +737,7 @@
693
737
  new_user.email = user[emailAttrib];
694
738
  new_user.name = user[nameAttrib];
695
739
  new_user.silently = true;
740
+ new_user.accepted = true;
696
741
 
697
742
  //name_input?.setReadonly(true)
698
743
  //email_input?.setReadonly(true)
@@ -725,7 +770,8 @@
725
770
  title='Members'
726
771
  toolbarOperations={user_operations}
727
772
  bind:this={list}>
728
- <ListTitle a={nameAttrib} onChange={on_name_changed} hrefFunc={getHRefFunc()}/>
773
+ <!-- hrefFunc={getHRefFunc()}-->
774
+ <ListTitle a={nameAttrib} onChange={on_name_changed} />
729
775
  <ListSummary a={emailAttrib} readonly/>
730
776
 
731
777
  <ListStaticProperty name="Membership" a="membership_tag"/>
@@ -770,14 +816,14 @@
770
816
  a="email"
771
817
  validation={is_valid_email_address}
772
818
  bind:this={email_input}
773
- readonly={new_user.silently}/>
819
+ readonly={new_user.accepted}/>
774
820
 
775
821
  <Input label={i18n({en: 'Name', es: 'Nombre', pl: 'Imię'})}
776
822
  placeholder='Optional'
777
823
  self={new_user}
778
824
  a="name"
779
825
  bind:this={name_input}
780
- readonly={new_user.silently}/>
826
+ readonly={new_user.accepted}/>
781
827
 
782
828
  <!--Checkbox class="mt-2 text-xs font-normal" self={new_user} a="maintainer">
783
829
  <div class="flex flex-row items-center">
@@ -789,6 +835,10 @@
789
835
  </div>
790
836
  </Checkbox-->
791
837
 
838
+ <Checkbox class="mt-2 text-xs font-normal" self={new_user} a="silently">
839
+ {i18n({en: 'Add user without sending an email', es: 'Añadir usuario sin enviar correo electrónico', pl: 'Dodaj użytkownika bez wysyłania e-maila'})}
840
+ </Checkbox>
841
+
792
842
  <!-- There is problem with dropdown/combo on dialogs (nested fixed stacks) -->
793
843
  <!--Combo class="mt-2" label='Privileges' a='auth_group' self={new_user} >
794
844
  <ComboItem name='No auth access' key={0} />