@humandialog/forms.svelte 1.1.1 → 1.1.3

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/desk.svelte CHANGED
@@ -70,17 +70,16 @@
70
70
  set_dark_mode_default(layout.dark.default)
71
71
  }
72
72
 
73
-
74
- if(layout.operations != undefined)
73
+ if(layout.operations !== undefined)
75
74
  {
76
75
  if(layout.operations.optional)
77
76
  layout.mainToolbar.operations = true;
78
77
 
79
- if(layout.operations.default != undefined)
80
- set_default_tools_visible(layout.operations.default)
78
+ if(layout.operations.default !== undefined)
79
+ set_default_tools_visible(layout.operations.default, !layout.operations.optional)
81
80
  }
82
81
  else
83
- set_default_tools_visible(false)
82
+ set_default_tools_visible(false, true)
84
83
 
85
84
  //let autoRedirectToSignIn = layout.autoRedirectToSignIn ?? true
86
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
package/stores.d.ts CHANGED
@@ -4,7 +4,7 @@ export function hasDataItem(): boolean;
4
4
  export function reloadMainContentPage(): void;
5
5
  export function reloadWholeApp(): void;
6
6
  export function set_dark_mode_default(value: any): void;
7
- export function set_default_tools_visible(value: any): void;
7
+ export function set_default_tools_visible(value: any, force: any): void;
8
8
  export function restore_defults(): void;
9
9
  export function toggle_sidebar(index: any): void;
10
10
  export function auto_hide_sidebar(): void;
package/stores.js CHANGED
@@ -76,7 +76,7 @@ export let sidebar_left_pos = writable(0)
76
76
  let has_saved_tools_visible = false;
77
77
  function create_tools_visible_store()
78
78
  {
79
- if(localStorage.tools_visible_store != undefined)
79
+ if(localStorage.tools_visible_store !== undefined)
80
80
  has_saved_tools_visible = true;
81
81
  else
82
82
  has_saved_tools_visible = false;
@@ -87,9 +87,9 @@ function create_tools_visible_store()
87
87
  export const tools_visible_store = create_tools_visible_store();
88
88
  tools_visible_store.subscribe( (value) => { localStorage.tools_visible_store = (value ? 'true' : '') } );
89
89
 
90
- export function set_default_tools_visible(value)
90
+ export function set_default_tools_visible(value, force)
91
91
  {
92
- if(!has_saved_tools_visible)
92
+ if((!has_saved_tools_visible) || force)
93
93
  tools_visible_store.set(value)
94
94
  }
95
95
 
@@ -3,6 +3,7 @@
3
3
  FaUserMinus,
4
4
  FaPen,
5
5
  FaInfoCircle,
6
+ FaUserSlash,
6
7
  FaChevronDown} from 'svelte-icons/fa'
7
8
 
8
9
  import Page from './page.svelte'
@@ -267,8 +268,8 @@
267
268
 
268
269
  function create_new_user()
269
270
  {
270
- if(showAccessRoles)
271
- new_user.acc_role = access_roles[0].name
271
+ if(showAccessRoles && access_roles.length > 0)
272
+ new_user.acc_role = access_roles[0].name ?? ""
272
273
 
273
274
  create_new_user_enabled = true;
274
275
 
@@ -279,6 +280,14 @@
279
280
  icon: FaUserPlus,
280
281
  caption: '',
281
282
  action: (focused) => { create_new_user(); }
283
+ },
284
+ {
285
+ separator: true
286
+ },
287
+ {
288
+ icon: FaUserSlash,
289
+ caption: '',
290
+ action: (f) => {askToDeleteApplicationAccount();}
282
291
  }
283
292
  ]
284
293
 
@@ -586,6 +595,42 @@
586
595
  }
587
596
  }
588
597
 
598
+ let deleteAccountModal;
599
+ function askToDeleteApplicationAccount()
600
+ {
601
+ deleteAccountModal.show()
602
+ }
603
+
604
+ async function deleteApplicationAccount()
605
+ {
606
+ let my_email = $session.user.email ?? ""
607
+ if(!my_email)
608
+ return;
609
+
610
+ try{
611
+
612
+ const res = await reef.fetch(`json/anyv/sys/unregister_user?email=${my_email}`)
613
+ deleteAccountModal.hide();
614
+
615
+ if(res.ok)
616
+ {
617
+ $session.signout();
618
+ window.location.href = $signInHRef;
619
+ }
620
+ else
621
+ {
622
+ const err = await res.text()
623
+ alerts = [err, ...alerts];
624
+ }
625
+ }
626
+ catch(err)
627
+ {
628
+ deleteAccountModal.hide();
629
+
630
+ console.error(err)
631
+ alerts = [err, ...alerts];
632
+ }
633
+ }
589
634
 
590
635
  </script>
591
636
 
@@ -646,6 +691,7 @@
646
691
 
647
692
  </List>
648
693
  {/if}
694
+
649
695
 
650
696
  </Page>
651
697
 
@@ -805,4 +851,12 @@
805
851
  okCaption='Remove'
806
852
  onOkCallback={removeUser}
807
853
  bind:this={removeModal}
854
+ />
855
+
856
+ <Modal title="Delete app account"
857
+ content="Are you sure you want to delete your application account?"
858
+ icon={FaUserSlash}
859
+ okCaption='Delete'
860
+ onOkCallback={deleteApplicationAccount}
861
+ bind:this={deleteAccountModal}
808
862
  />