@humandialog/forms.svelte 1.3.7 → 1.3.9
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.
|
@@ -184,6 +184,7 @@ const suggestion = {
|
|
|
184
184
|
lockNextBlurCallbacks++;
|
|
185
185
|
suggestionRange = props.range;
|
|
186
186
|
editor.commands.blur();
|
|
187
|
+
palette.set_current_editor_range(props.range);
|
|
187
188
|
const cursorRect = props.clientRect();
|
|
188
189
|
setTimeout(() => show_command_palette(cursorRect), 100);
|
|
189
190
|
} else {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
export let pushChangesImmediately = true;
|
|
22
22
|
|
|
23
23
|
export let required = false;
|
|
24
|
+
export let readonly = false;
|
|
24
25
|
|
|
25
26
|
export let s = 'sm'
|
|
26
27
|
export let c = ''
|
|
@@ -45,6 +46,12 @@
|
|
|
45
46
|
return !invalid;
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
export function setReadonly(val)
|
|
50
|
+
{
|
|
51
|
+
readonly = val;
|
|
52
|
+
itype = itype;
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
|
|
49
56
|
let item = null
|
|
50
57
|
|
|
@@ -128,6 +135,7 @@
|
|
|
128
135
|
on:change={()=> (value_changed())}
|
|
129
136
|
on:blur={() => { accept_change();} }
|
|
130
137
|
on:keydown={(e)=>{check_validity();}}
|
|
138
|
+
{readonly}
|
|
131
139
|
|
|
132
140
|
class=" bg-stone-50 dark:bg-stone-700
|
|
133
141
|
border {border_style} rounded-lg
|
|
@@ -16,12 +16,15 @@ export default class Inputbox extends SvelteComponentTyped<{
|
|
|
16
16
|
itype?: string | undefined;
|
|
17
17
|
val?: string | undefined;
|
|
18
18
|
required?: boolean | undefined;
|
|
19
|
+
readonly?: boolean | undefined;
|
|
19
20
|
validation?: any;
|
|
20
21
|
validate?: (() => boolean) | undefined;
|
|
22
|
+
setReadonly?: ((val: any) => void) | undefined;
|
|
21
23
|
}, {
|
|
22
24
|
[evt: string]: CustomEvent<any>;
|
|
23
25
|
}, {}> {
|
|
24
26
|
get validate(): () => boolean;
|
|
27
|
+
get setReadonly(): (val: any) => void;
|
|
25
28
|
}
|
|
26
29
|
export type InputboxProps = typeof __propDef.props;
|
|
27
30
|
export type InputboxEvents = typeof __propDef.events;
|
|
@@ -43,8 +46,10 @@ declare const __propDef: {
|
|
|
43
46
|
itype?: string | undefined;
|
|
44
47
|
val?: string | undefined;
|
|
45
48
|
required?: boolean | undefined;
|
|
49
|
+
readonly?: boolean | undefined;
|
|
46
50
|
validation?: any;
|
|
47
51
|
validate?: (() => boolean) | undefined;
|
|
52
|
+
setReadonly?: ((val: any) => void) | undefined;
|
|
48
53
|
};
|
|
49
54
|
events: {
|
|
50
55
|
[evt: string]: CustomEvent<any>;
|
package/package.json
CHANGED
package/tenant.members.svelte
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
import { ComboSource } from './';
|
|
24
24
|
import {showMenu} from './components/menu'
|
|
25
25
|
import {onErrorShowAlert} from './stores'
|
|
26
|
+
import {randomString} from './utils'
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
// ==============================================================================
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
const authAccessKinds = [
|
|
55
56
|
{ name: 'No auth access', key: 0 },
|
|
56
57
|
{ name: 'Read auth access', key: 1 },
|
|
57
|
-
{ name: 'Can invite others', key: 3 },
|
|
58
|
+
//{ name: 'Can invite others', key: 3 },
|
|
58
59
|
{ name: 'Full auth access', key: 7 },
|
|
59
60
|
]
|
|
60
61
|
|
|
@@ -169,7 +170,8 @@
|
|
|
169
170
|
email: '',
|
|
170
171
|
auth_group: 0,
|
|
171
172
|
files_group: 0,
|
|
172
|
-
acc_role: ''
|
|
173
|
+
acc_role: '',
|
|
174
|
+
silently: false
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
let name_input;
|
|
@@ -271,12 +273,14 @@
|
|
|
271
273
|
return false;
|
|
272
274
|
}
|
|
273
275
|
|
|
276
|
+
let inviteUserIdempotencyToken = ''
|
|
274
277
|
function create_new_user()
|
|
275
278
|
{
|
|
276
279
|
if(showAccessRoles && access_roles.length > 0)
|
|
277
280
|
new_user.acc_role = access_roles[0].name ?? ""
|
|
278
281
|
|
|
279
282
|
create_new_user_enabled = true;
|
|
283
|
+
inviteUserIdempotencyToken = randomString(8);
|
|
280
284
|
|
|
281
285
|
}
|
|
282
286
|
|
|
@@ -336,7 +340,13 @@
|
|
|
336
340
|
let operations = [];
|
|
337
341
|
|
|
338
342
|
if(user.removed)
|
|
339
|
-
return [
|
|
343
|
+
return [
|
|
344
|
+
{
|
|
345
|
+
icon: FaUserPlus,
|
|
346
|
+
caption: '',
|
|
347
|
+
action: (f) => askToAddAgain(user),
|
|
348
|
+
}
|
|
349
|
+
];
|
|
340
350
|
|
|
341
351
|
let edit_operations = get_edit_operations(user)
|
|
342
352
|
if(edit_operations.length == 1)
|
|
@@ -494,6 +504,8 @@
|
|
|
494
504
|
client_id: $session.configuration.client_id,
|
|
495
505
|
redirect_uri: `${window.location.origin}/#/auth/cb`,
|
|
496
506
|
state: `${window.location.origin}/#/auth/signin`,
|
|
507
|
+
idempotency_token: inviteUserIdempotencyToken,
|
|
508
|
+
silently: new_user.silently ?? false,
|
|
497
509
|
set:
|
|
498
510
|
{
|
|
499
511
|
[nameAttrib]: new_user.name,
|
|
@@ -545,6 +557,7 @@
|
|
|
545
557
|
new_user.auth_group = 0;
|
|
546
558
|
new_user.files_group = 0;
|
|
547
559
|
new_user.acc_role = ''
|
|
560
|
+
new_user.silently = false;
|
|
548
561
|
|
|
549
562
|
create_new_user_enabled = false;
|
|
550
563
|
}
|
|
@@ -556,15 +569,18 @@
|
|
|
556
569
|
new_user.auth_group = 0;
|
|
557
570
|
new_user.files_group = 0;
|
|
558
571
|
new_user.acc_role = ''
|
|
572
|
+
new_user.silently = false;
|
|
559
573
|
|
|
560
574
|
create_new_user_enabled = false;
|
|
561
575
|
}
|
|
562
576
|
|
|
563
577
|
let removeModal;
|
|
564
578
|
let userToRemove;
|
|
579
|
+
let removeUserIdempotencyToken = ''
|
|
565
580
|
function askToRemove(user)
|
|
566
581
|
{
|
|
567
582
|
userToRemove = user;
|
|
583
|
+
removeUserIdempotencyToken = randomString(8);
|
|
568
584
|
removeModal.show()
|
|
569
585
|
}
|
|
570
586
|
|
|
@@ -576,7 +592,7 @@
|
|
|
576
592
|
let email = userToRemove[emailAttrib];
|
|
577
593
|
try{
|
|
578
594
|
|
|
579
|
-
const res = await reef.fetch(
|
|
595
|
+
const res = await reef.fetch(`/json/anyv/sys/kick_out_user?email=${email}&idempotency_token=${removeUserIdempotencyToken}`)
|
|
580
596
|
removeModal.hide();
|
|
581
597
|
|
|
582
598
|
if(res.ok)
|
|
@@ -599,9 +615,11 @@
|
|
|
599
615
|
}
|
|
600
616
|
|
|
601
617
|
let deleteAccountModal;
|
|
618
|
+
let deleteAccountIdempotencyToken = ''
|
|
602
619
|
function askToDeleteApplicationAccount()
|
|
603
620
|
{
|
|
604
621
|
deleteAccountModal.show()
|
|
622
|
+
deleteAccountIdempotencyToken = randomString(8)
|
|
605
623
|
}
|
|
606
624
|
|
|
607
625
|
async function deleteApplicationAccount()
|
|
@@ -612,7 +630,7 @@
|
|
|
612
630
|
|
|
613
631
|
try{
|
|
614
632
|
|
|
615
|
-
const res = await reef.fetch(`json/anyv/sys/unregister_user?email=${my_email}`)
|
|
633
|
+
const res = await reef.fetch(`json/anyv/sys/unregister_user?email=${my_email}&idempotency_token=${deleteAccountIdempotencyToken}`)
|
|
616
634
|
deleteAccountModal.hide();
|
|
617
635
|
|
|
618
636
|
if(res.ok)
|
|
@@ -634,6 +652,20 @@
|
|
|
634
652
|
onErrorShowAlert(err);
|
|
635
653
|
}
|
|
636
654
|
}
|
|
655
|
+
|
|
656
|
+
function askToAddAgain(user)
|
|
657
|
+
{
|
|
658
|
+
new_user.email = user[emailAttrib];
|
|
659
|
+
new_user.name = user[nameAttrib];
|
|
660
|
+
new_user.silently = true;
|
|
661
|
+
|
|
662
|
+
//name_input?.setReadonly(true)
|
|
663
|
+
//email_input?.setReadonly(true)
|
|
664
|
+
|
|
665
|
+
create_new_user();
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
|
|
637
669
|
|
|
638
670
|
</script>
|
|
639
671
|
|
|
@@ -697,13 +729,15 @@
|
|
|
697
729
|
self={new_user}
|
|
698
730
|
a="email"
|
|
699
731
|
validation={is_valid_email_address}
|
|
700
|
-
bind:this={email_input}
|
|
732
|
+
bind:this={email_input}
|
|
733
|
+
readonly={new_user.silently}/>
|
|
701
734
|
|
|
702
735
|
<Input label='Name'
|
|
703
736
|
placeholder='Optional'
|
|
704
737
|
self={new_user}
|
|
705
738
|
a="name"
|
|
706
|
-
bind:this={name_input}
|
|
739
|
+
bind:this={name_input}
|
|
740
|
+
readonly={new_user.silently}/>
|
|
707
741
|
|
|
708
742
|
<!--Checkbox class="mt-2 text-xs font-normal" self={new_user} a="maintainer">
|
|
709
743
|
<div class="flex flex-row items-center">
|