@humandialog/forms.svelte 1.5.1 → 1.6.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/components/contextmenu.svelte +125 -28
- package/components/contextmenu.svelte.d.ts +2 -2
- package/components/document/editor.svelte +46 -36
- package/components/document/editor.svelte.d.ts +6 -6
- package/components/menu.d.ts +5 -1
- package/components/menu.js +7 -3
- package/components/sidebar/sidebar.item.svelte +5 -5
- package/desk.svelte +10 -9
- package/horizontal.toolbar.svelte +57 -65
- package/i18n-preprocess.d.ts +39 -0
- package/i18n-preprocess.js +100 -0
- package/i18n.d.ts +30 -0
- package/i18n.js +162 -0
- package/index.d.ts +5 -3
- package/index.js +5 -3
- package/modal.svelte +2 -1
- package/package.json +3 -1
- package/stores.d.ts +1 -0
- package/stores.js +4 -3
- package/tenant.members.svelte +46 -40
- package/utils.d.ts +14 -4
- package/utils.js +178 -18
- package/vertical.toolbar.svelte +65 -42
package/stores.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import {writable, get} from 'svelte/store';
|
|
2
|
+
import {writable, get, derived} from 'svelte/store';
|
|
3
3
|
import {SCREEN_SIZES, randomString} from './utils.js'
|
|
4
|
+
import {navGetKey} from './utils.js'
|
|
5
|
+
import { location } from 'svelte-spa-router';
|
|
4
6
|
|
|
5
7
|
export const data_tick_store = writable(1);
|
|
6
8
|
export const contextItemsStore = writable({focused:'', data: null, sel: null})
|
|
@@ -222,5 +224,4 @@ export function show_sidebar(index)
|
|
|
222
224
|
main_sidebar_visible_store.set(index)
|
|
223
225
|
}
|
|
224
226
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
+
export const navKey = derived([main_sidebar_visible_store, location], ([$main_sidebar_visible_store, $location]) => navGetKey() )
|
package/tenant.members.svelte
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import Checkbox from './components/checkbox.svelte';
|
|
22
22
|
|
|
23
23
|
import { reef, session, signInHRef } from '@humandialog/auth.svelte';
|
|
24
|
-
import { ComboSource } from './';
|
|
24
|
+
import { ComboSource, i18n } from './';
|
|
25
25
|
import {showMenu} from './components/menu'
|
|
26
26
|
import {onErrorShowAlert} from './stores'
|
|
27
27
|
import {randomString} from './utils'
|
|
@@ -54,17 +54,23 @@
|
|
|
54
54
|
|
|
55
55
|
let fake_users;
|
|
56
56
|
|
|
57
|
-
const authAccessKinds = [
|
|
58
|
-
{
|
|
59
|
-
|
|
57
|
+
const authAccessKinds = () => [
|
|
58
|
+
{ name: i18n({en: 'Cannot change permissions', es: 'No puede cambiar los permisos', pl: 'Nie może zmieniać uprawnień'}),
|
|
59
|
+
key: 0 },
|
|
60
|
+
{ name: i18n({en: 'Can only read permissions', es: 'Solo puede leer permisos', pl: 'Może tylko czytać uprawnienia'}),
|
|
61
|
+
key: 1 },
|
|
60
62
|
//{ name: 'Can invite others', key: 3 },
|
|
61
|
-
{
|
|
63
|
+
{ name: i18n({en: 'Full access to permissions', es: 'Acceso completo a los permisos', pl: 'Pełny dostęp do uprawnień'}),
|
|
64
|
+
key: 7 },
|
|
62
65
|
]
|
|
63
66
|
|
|
64
|
-
const filesAccessKinds = [
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
{
|
|
67
|
+
const filesAccessKinds = () => [
|
|
68
|
+
{ name: i18n({en: 'Can read files', es: 'Puede leer archivos', pl: 'Może odczytywać pliki'}),
|
|
69
|
+
key: 0 },
|
|
70
|
+
{ name: i18n({en: 'Can write files', es: 'Puede escribir archivos', pl: 'Może zapisywać pliki'}),
|
|
71
|
+
key: 1 },
|
|
72
|
+
{ name: i18n({en: 'Full files access', es: 'Acceso completo a los archivos', pl: 'Pełny dostęp do plików'}),
|
|
73
|
+
key: 3 },
|
|
68
74
|
]
|
|
69
75
|
|
|
70
76
|
async function init()
|
|
@@ -160,9 +166,9 @@
|
|
|
160
166
|
//console.log(info)
|
|
161
167
|
|
|
162
168
|
if(user.removed)
|
|
163
|
-
user.membership_tag =
|
|
169
|
+
user.membership_tag = i18n({en: 'Removed', es: 'Eliminado', pl: 'Usunięto'});
|
|
164
170
|
else if(user.invitation_not_accepted)
|
|
165
|
-
user.membership_tag =
|
|
171
|
+
user.membership_tag = i18n({en: 'Invited', es: 'Invitado', pl: 'Zaproszono'});
|
|
166
172
|
else
|
|
167
173
|
user.membership_tag = "";
|
|
168
174
|
|
|
@@ -301,11 +307,11 @@
|
|
|
301
307
|
fab: 'M00',
|
|
302
308
|
operations: [
|
|
303
309
|
{
|
|
304
|
-
caption: 'View',
|
|
310
|
+
caption: i18n({en: 'View', es: 'Ver', pl: 'Widok'}),
|
|
305
311
|
operations: [
|
|
306
312
|
{
|
|
307
313
|
icon: FaUserPlus,
|
|
308
|
-
caption: 'Add user',
|
|
314
|
+
caption: i18n({en: 'Add user', es: 'Añadir usuario', pl: 'Dodaj użytkownika'}),
|
|
309
315
|
action: (focused) => { create_new_user(); },
|
|
310
316
|
// fab: 'M10',
|
|
311
317
|
tbr: 'A'
|
|
@@ -331,14 +337,14 @@
|
|
|
331
337
|
action: (focused) => { list.edit(user, nameAttrib) }
|
|
332
338
|
},
|
|
333
339
|
{
|
|
334
|
-
caption: 'Users management
|
|
340
|
+
caption: i18n({en: 'Users management', es: 'Gestión de usuarios', pl: 'Zarządzanie użytkownikami'}),
|
|
335
341
|
action: (focused) => { list.edit(user, 'Privileges') }
|
|
336
342
|
}];
|
|
337
343
|
|
|
338
344
|
if(showAccessRoles)
|
|
339
345
|
{
|
|
340
346
|
operations.push({
|
|
341
|
-
caption: '
|
|
347
|
+
caption: i18n({en: 'Role in the application', es: 'Papel en la aplicación', pl: 'Rola w aplikacji'}),
|
|
342
348
|
action: (focused) => { list.edit(user, 'Access') }
|
|
343
349
|
});
|
|
344
350
|
}
|
|
@@ -346,7 +352,7 @@
|
|
|
346
352
|
if(showFiles)
|
|
347
353
|
{
|
|
348
354
|
operations.push({
|
|
349
|
-
caption: 'External files
|
|
355
|
+
caption: i18n({en: 'External files', es: 'Archivos externos', pl: 'Pliki zewnętrzne'}),
|
|
350
356
|
action: (focused) => { list.edit(user, 'Files') }
|
|
351
357
|
});
|
|
352
358
|
}
|
|
@@ -358,7 +364,7 @@
|
|
|
358
364
|
|
|
359
365
|
let operations = [
|
|
360
366
|
{
|
|
361
|
-
caption: 'Fetch info',
|
|
367
|
+
caption: i18n({en: 'Fetch info', es: 'Obtener información', pl: 'Pobierz informacje'}),
|
|
362
368
|
icon: FaInfo,
|
|
363
369
|
action: (f) => fetch_user_details(user),
|
|
364
370
|
tbr: 'A'
|
|
@@ -370,7 +376,7 @@
|
|
|
370
376
|
operations = [ ...operations,
|
|
371
377
|
{
|
|
372
378
|
icon: FaUserPlus,
|
|
373
|
-
caption: 'Revert removing',
|
|
379
|
+
caption: i18n({en: 'Revert removing', es: 'Revertir eliminación', pl: 'Cofnij usunięcie'}),
|
|
374
380
|
action: (f) => askToAddAgain(user),
|
|
375
381
|
// fab: 'M10',
|
|
376
382
|
tbr: 'A'
|
|
@@ -383,14 +389,14 @@
|
|
|
383
389
|
|
|
384
390
|
operations.push({
|
|
385
391
|
icon: FaPen,
|
|
386
|
-
caption: 'Change',
|
|
392
|
+
caption: i18n({en: 'Change', es: 'Cambiar', pl: 'Zmień'}),
|
|
387
393
|
menu: edit_operations,
|
|
388
394
|
//fab: 'M20',
|
|
389
395
|
tbr: 'A'
|
|
390
396
|
});
|
|
391
397
|
|
|
392
398
|
operations.push({
|
|
393
|
-
caption: 'Remove user',
|
|
399
|
+
caption: i18n({en: 'Remove user', es: 'Eliminar usuario', pl: 'Usuń użytkownika'}),
|
|
394
400
|
icon: FaUserMinus,
|
|
395
401
|
action: (focused) => askToRemove(user),
|
|
396
402
|
// fab: 'M30',
|
|
@@ -404,7 +410,7 @@
|
|
|
404
410
|
fab: 'M00',
|
|
405
411
|
operations: [
|
|
406
412
|
{
|
|
407
|
-
caption: 'User',
|
|
413
|
+
caption: i18n({en: 'User', es: 'Usuario', pl: 'Użytkownik'}),
|
|
408
414
|
// tbr: 'B',
|
|
409
415
|
operations: operations
|
|
410
416
|
}
|
|
@@ -725,7 +731,7 @@
|
|
|
725
731
|
<ListStaticProperty name="Membership" a="membership_tag"/>
|
|
726
732
|
|
|
727
733
|
<ListComboProperty name='Privileges' a='auth_group' onSelect={on_change_privileges}>
|
|
728
|
-
{#each authAccessKinds as kind}
|
|
734
|
+
{#each authAccessKinds() as kind}
|
|
729
735
|
<ComboItem name={kind.name} key={kind.key} />
|
|
730
736
|
{/each}
|
|
731
737
|
</ListComboProperty>
|
|
@@ -738,7 +744,7 @@
|
|
|
738
744
|
|
|
739
745
|
{#if showFiles}
|
|
740
746
|
<ListComboProperty name='Files' a='files_group' onSelect={on_change_files_access}>
|
|
741
|
-
{#each filesAccessKinds as kind}
|
|
747
|
+
{#each filesAccessKinds() as kind}
|
|
742
748
|
<ComboItem name={kind.name} key={kind.key} />
|
|
743
749
|
{/each}
|
|
744
750
|
</ListComboProperty>
|
|
@@ -752,8 +758,8 @@
|
|
|
752
758
|
</Page>
|
|
753
759
|
|
|
754
760
|
<Modal bind:open={create_new_user_enabled}
|
|
755
|
-
title='Invite someone'
|
|
756
|
-
okCaption='Invite'
|
|
761
|
+
title={i18n({en: 'Invite someone', es: 'Invitar a alguien', pl: 'Zaproś kogoś'})}
|
|
762
|
+
okCaption={i18n({en: 'Invite', es: 'Invitar', pl: 'Zaproś'})}
|
|
757
763
|
onOkCallback={on_new_user_requested}
|
|
758
764
|
onCancelCallback={on_new_user_canceled}
|
|
759
765
|
icon={FaUserPlus}>
|
|
@@ -766,7 +772,7 @@
|
|
|
766
772
|
bind:this={email_input}
|
|
767
773
|
readonly={new_user.silently}/>
|
|
768
774
|
|
|
769
|
-
<Input label='Name'
|
|
775
|
+
<Input label={i18n({en: 'Name', es: 'Nombre', pl: 'Imię'})}
|
|
770
776
|
placeholder='Optional'
|
|
771
777
|
self={new_user}
|
|
772
778
|
a="name"
|
|
@@ -795,7 +801,7 @@
|
|
|
795
801
|
<div class="flex flex-col">
|
|
796
802
|
<label for="new_user_auth_group"
|
|
797
803
|
class="text-xs">
|
|
798
|
-
|
|
804
|
+
{i18n({en: 'Permissions management', es: 'Gestión de permisos', pl: 'Zarządzanie uprawnieniami'})}
|
|
799
805
|
</label>
|
|
800
806
|
<button id="new_user_auth_group"
|
|
801
807
|
class=" w-full mt-0.5
|
|
@@ -811,7 +817,7 @@
|
|
|
811
817
|
return;
|
|
812
818
|
|
|
813
819
|
let options = [];
|
|
814
|
-
authAccessKinds.forEach(k => options.push({
|
|
820
|
+
authAccessKinds().forEach(k => options.push({
|
|
815
821
|
caption: k.name,
|
|
816
822
|
action: (f) => { new_user.auth_group=k.key}
|
|
817
823
|
}));
|
|
@@ -820,7 +826,7 @@
|
|
|
820
826
|
let pt = new DOMPoint(rect.left, rect.bottom)
|
|
821
827
|
showMenu(pt, options);
|
|
822
828
|
}}>
|
|
823
|
-
{authAccessKinds.find(k => k.key == new_user.auth_group)?.name}
|
|
829
|
+
{authAccessKinds().find(k => k.key == new_user.auth_group)?.name}
|
|
824
830
|
<span class="w-3 h-3 inline-block text-stone-700 dark:text-stone-300 ml-2 mt-2 sm:mt-1">
|
|
825
831
|
<FaChevronDown/>
|
|
826
832
|
</span>
|
|
@@ -831,7 +837,7 @@
|
|
|
831
837
|
<div class="flex flex-col">
|
|
832
838
|
<label for="new_user_auth_group"
|
|
833
839
|
class="text-xs">
|
|
834
|
-
|
|
840
|
+
{i18n({en: 'File access', es: 'Acceso a los archivos', pl: 'Dostęp do plików'})}
|
|
835
841
|
</label>
|
|
836
842
|
<button
|
|
837
843
|
class=" mt-0.5 w-full
|
|
@@ -847,7 +853,7 @@
|
|
|
847
853
|
return;
|
|
848
854
|
|
|
849
855
|
let options = [];
|
|
850
|
-
filesAccessKinds.forEach(k => options.push({
|
|
856
|
+
filesAccessKinds().forEach(k => options.push({
|
|
851
857
|
caption: k.name,
|
|
852
858
|
action: (f) => { new_user.files_group=k.key}
|
|
853
859
|
}));
|
|
@@ -856,7 +862,7 @@
|
|
|
856
862
|
let pt = new DOMPoint(rect.left, rect.bottom)
|
|
857
863
|
showMenu(pt, options);
|
|
858
864
|
}}>
|
|
859
|
-
{filesAccessKinds.find(k => k.key == new_user.files_group)?.name}
|
|
865
|
+
{filesAccessKinds().find(k => k.key == new_user.files_group)?.name}
|
|
860
866
|
<span class="w-3 h-3 inline-block text-stone-700 dark:text-stone-300 ml-2 mt-2 sm:mt-1">
|
|
861
867
|
<FaChevronDown/>
|
|
862
868
|
</span>
|
|
@@ -868,7 +874,7 @@
|
|
|
868
874
|
<div class="flex flex-col">
|
|
869
875
|
<label for="new_user_auth_group"
|
|
870
876
|
class="text-xs">
|
|
871
|
-
|
|
877
|
+
{i18n({en: 'Role in the application', es: 'Papel en la aplicación', pl: 'Rola w aplikacji'})}
|
|
872
878
|
</label>
|
|
873
879
|
<button
|
|
874
880
|
class=" mt-0.5 w-full
|
|
@@ -896,7 +902,7 @@
|
|
|
896
902
|
{#if new_user.acc_role}
|
|
897
903
|
{access_roles.find(r => r.name==new_user.acc_role).summary}
|
|
898
904
|
{:else}
|
|
899
|
-
{"<none>
|
|
905
|
+
{i18n({en: '"<none>', es: '<ningún>', pl: '<żadna>'})}
|
|
900
906
|
{/if}
|
|
901
907
|
|
|
902
908
|
<span class="w-3 h-3 inline-block text-stone-700 dark:text-stone-300 ml-2 mt-2 sm:mt-1">
|
|
@@ -908,18 +914,18 @@
|
|
|
908
914
|
</section>
|
|
909
915
|
</Modal>
|
|
910
916
|
|
|
911
|
-
<Modal title=
|
|
912
|
-
content=
|
|
917
|
+
<Modal title={i18n({en: 'User removal', es: 'Eliminar usuario', pl: 'Usuwanie użytkownika'})}
|
|
918
|
+
content={i18n({en: `Are you sure you want to remove ${userToRemove ? userToRemove[nameAttrib] : 'user'}?`, es: `¿Estás seguro de que deseas eliminar al ${userToRemove ? userToRemove[nameAttrib] : 'usuario'}?`, pl: `Czy na pewno chcesz usunąć ${userToRemove ? userToRemove[nameAttrib] : 'użytkownika'}?`})}
|
|
913
919
|
icon={FaUserMinus}
|
|
914
|
-
okCaption='Remove'
|
|
920
|
+
okCaption={i18n({en: 'Remove', es: 'Eliminar', pl: 'Usuń'})}
|
|
915
921
|
onOkCallback={removeUser}
|
|
916
922
|
bind:this={removeModal}
|
|
917
923
|
/>
|
|
918
924
|
|
|
919
|
-
<Modal title=
|
|
920
|
-
content=
|
|
925
|
+
<Modal title={i18n({en: 'Delete app account', es: 'Eliminar cuenta de la aplicación', pl: 'Usuń konto aplikacji'})}
|
|
926
|
+
content={i18n({en: 'Are you sure you want to delete your application account?', es: '¿Estás seguro de que deseas eliminar tu cuenta de la aplicación?', pl: 'Czy na pewno chcesz usunąć swoje konto aplikacji?'})}
|
|
921
927
|
icon={FaUserSlash}
|
|
922
|
-
okCaption='Delete'
|
|
928
|
+
okCaption={i18n({en: 'Delete', es: 'Eliminar', pl: 'Usuń'})}
|
|
923
929
|
onOkCallback={deleteApplicationAccount}
|
|
924
930
|
bind:this={deleteAccountModal}
|
|
925
931
|
/>
|
package/utils.d.ts
CHANGED
|
@@ -28,11 +28,19 @@ export function remove(array: any, element: any): any;
|
|
|
28
28
|
export function swapElements(array: any, e1: any, e2: any): any;
|
|
29
29
|
export function resizeImage(file: any, maxWidth?: number, maxHeight?: number, contentType?: string, quality?: number): Promise<any>;
|
|
30
30
|
export function isOnScreenKeyboardVisible(): boolean;
|
|
31
|
-
export function isOnNavigationPage(): boolean;
|
|
32
|
-
export function pushNavigationPage(): void;
|
|
33
|
-
export function popNavigationPage(): void;
|
|
34
31
|
export function dec2hex(dec: any): any;
|
|
35
32
|
export function randomString(len: any): string;
|
|
33
|
+
export function isOnNavigationPage(navKind: any): boolean;
|
|
34
|
+
export function pushNavigationPage(navKind: any): void;
|
|
35
|
+
export function popNavigationPage(): void;
|
|
36
|
+
export function navGetMode(): number;
|
|
37
|
+
export function navIsVisible(): boolean | undefined;
|
|
38
|
+
export function navGetKey(): any;
|
|
39
|
+
export function navShow(key: any): void;
|
|
40
|
+
export function navHide(): void;
|
|
41
|
+
export function navToggle(key: any): void;
|
|
42
|
+
export function navPrevVisibleKey(): string | undefined;
|
|
43
|
+
export function navAutoHide(): void;
|
|
36
44
|
export namespace icons {
|
|
37
45
|
const symbols: null;
|
|
38
46
|
}
|
|
@@ -48,4 +56,6 @@ export namespace UI {
|
|
|
48
56
|
const fab: null;
|
|
49
57
|
const navigator: null;
|
|
50
58
|
}
|
|
51
|
-
export const NAVIGATION_PAGE_PATH: "/";
|
|
59
|
+
export const NAVIGATION_PAGE_PATH: "/nav";
|
|
60
|
+
export const NAV_MODE_SIDEBAR: 0;
|
|
61
|
+
export const NAV_MODE_FULL_PAGE: 1;
|
package/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getContext, tick } from "svelte";
|
|
2
|
-
import {get} from 'svelte/store'
|
|
3
|
-
import { contextItemsStore, contextToolbarOperations, pageToolbarOperations, data_tick_store } from "./stores";
|
|
2
|
+
import {derived, get} from 'svelte/store'
|
|
3
|
+
import { contextItemsStore, contextToolbarOperations, pageToolbarOperations, data_tick_store, main_sidebar_visible_store, show_sidebar, hide_sidebar, previously_visible_sidebar, auto_hide_sidebar} from "./stores";
|
|
4
4
|
import {location, push, pop} from 'svelte-spa-router'
|
|
5
5
|
|
|
6
6
|
export let icons = {symbols :null}
|
|
@@ -675,36 +675,196 @@ export const UI = {
|
|
|
675
675
|
navigator: null
|
|
676
676
|
}
|
|
677
677
|
|
|
678
|
-
export
|
|
679
|
-
|
|
678
|
+
export function dec2hex (dec)
|
|
679
|
+
{
|
|
680
|
+
return dec.toString(16).padStart(2, "0")
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
export function randomString(len)
|
|
685
|
+
{
|
|
686
|
+
var arr = new Uint8Array((len || 16) / 2)
|
|
687
|
+
window.crypto.getRandomValues(arr)
|
|
688
|
+
return Array.from(arr, dec2hex).join('')
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
export const NAVIGATION_PAGE_PATH = '/nav'
|
|
693
|
+
let savedAppPage = ''
|
|
694
|
+
let lastNavPage = ''
|
|
695
|
+
|
|
696
|
+
export function isOnNavigationPage(navKind)
|
|
680
697
|
{
|
|
681
698
|
const loc = get(location)
|
|
682
|
-
|
|
683
|
-
|
|
699
|
+
|
|
700
|
+
if(!navKind)
|
|
701
|
+
{
|
|
702
|
+
if(loc.startsWith(NAVIGATION_PAGE_PATH))
|
|
703
|
+
return true;
|
|
704
|
+
else
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
684
707
|
else
|
|
685
|
-
|
|
708
|
+
{
|
|
709
|
+
if(loc.startsWith(`${NAVIGATION_PAGE_PATH}/${navKind}`))
|
|
710
|
+
return true;
|
|
711
|
+
else
|
|
712
|
+
return false;
|
|
713
|
+
}
|
|
714
|
+
|
|
686
715
|
}
|
|
687
716
|
|
|
688
|
-
|
|
717
|
+
|
|
718
|
+
export function pushNavigationPage(navKind)
|
|
689
719
|
{
|
|
690
|
-
|
|
720
|
+
if(!isOnNavigationPage())
|
|
721
|
+
savedAppPage = get(location)
|
|
722
|
+
|
|
723
|
+
if(!navKind)
|
|
724
|
+
{
|
|
725
|
+
navKind = navPrevVisibleKey()
|
|
726
|
+
if(!navKind)
|
|
727
|
+
lastNavPage = `${NAVIGATION_PAGE_PATH}/`
|
|
728
|
+
else
|
|
729
|
+
lastNavPage = `${NAVIGATION_PAGE_PATH}/${navKind}`
|
|
730
|
+
}
|
|
731
|
+
else
|
|
732
|
+
lastNavPage = `${NAVIGATION_PAGE_PATH}/${navKind}`
|
|
733
|
+
|
|
734
|
+
push(lastNavPage)
|
|
691
735
|
}
|
|
692
736
|
|
|
693
737
|
export function popNavigationPage()
|
|
694
738
|
{
|
|
695
739
|
if(isOnNavigationPage())
|
|
696
|
-
|
|
740
|
+
{
|
|
741
|
+
if(savedAppPage)
|
|
742
|
+
push(savedAppPage)
|
|
743
|
+
else
|
|
744
|
+
pop()
|
|
745
|
+
|
|
746
|
+
savedAppPage = ''
|
|
747
|
+
}
|
|
697
748
|
}
|
|
698
749
|
|
|
699
|
-
export
|
|
750
|
+
export const NAV_MODE_SIDEBAR = 0
|
|
751
|
+
export const NAV_MODE_FULL_PAGE = 1
|
|
752
|
+
|
|
753
|
+
let navMode = isDeviceSmallerThan("sm") ? NAV_MODE_FULL_PAGE : NAV_MODE_SIDEBAR
|
|
754
|
+
|
|
755
|
+
export function navGetMode()
|
|
700
756
|
{
|
|
701
|
-
return
|
|
757
|
+
return navMode;
|
|
702
758
|
}
|
|
703
|
-
|
|
704
759
|
|
|
705
|
-
export function
|
|
760
|
+
export function navIsVisible()
|
|
706
761
|
{
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
762
|
+
switch(navMode)
|
|
763
|
+
{
|
|
764
|
+
case NAV_MODE_SIDEBAR:
|
|
765
|
+
return get(main_sidebar_visible_store) != '*'
|
|
766
|
+
|
|
767
|
+
case NAV_MODE_FULL_PAGE:
|
|
768
|
+
return isOnNavigationPage();
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
export function navGetKey()
|
|
773
|
+
{
|
|
774
|
+
switch(navMode)
|
|
775
|
+
{
|
|
776
|
+
case NAV_MODE_SIDEBAR:
|
|
777
|
+
return get(main_sidebar_visible_store)
|
|
778
|
+
|
|
779
|
+
case NAV_MODE_FULL_PAGE:
|
|
780
|
+
{
|
|
781
|
+
const segments = get(location).split('/')
|
|
782
|
+
if(segments.length > 1)
|
|
783
|
+
return segments[2]
|
|
784
|
+
else
|
|
785
|
+
return ""
|
|
786
|
+
}
|
|
787
|
+
return ""
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
export function navShow(key)
|
|
792
|
+
{
|
|
793
|
+
switch(navMode)
|
|
794
|
+
{
|
|
795
|
+
case NAV_MODE_SIDEBAR:
|
|
796
|
+
show_sidebar(key)
|
|
797
|
+
break;
|
|
798
|
+
|
|
799
|
+
case NAV_MODE_FULL_PAGE:
|
|
800
|
+
pushNavigationPage(key)
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
export function navHide()
|
|
806
|
+
{
|
|
807
|
+
switch(navMode)
|
|
808
|
+
{
|
|
809
|
+
case NAV_MODE_SIDEBAR:
|
|
810
|
+
hide_sidebar()
|
|
811
|
+
break;
|
|
812
|
+
|
|
813
|
+
case NAV_MODE_FULL_PAGE:
|
|
814
|
+
popNavigationPage()
|
|
815
|
+
break;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
export function navToggle(key)
|
|
821
|
+
{
|
|
822
|
+
if(navIsVisible())
|
|
823
|
+
{
|
|
824
|
+
if(navGetKey() == key)
|
|
825
|
+
navHide()
|
|
826
|
+
else
|
|
827
|
+
navShow(key)
|
|
828
|
+
}
|
|
829
|
+
else
|
|
830
|
+
navShow(key)
|
|
831
|
+
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
export function navPrevVisibleKey()
|
|
835
|
+
{
|
|
836
|
+
switch(navMode)
|
|
837
|
+
{
|
|
838
|
+
case NAV_MODE_SIDEBAR:
|
|
839
|
+
if(!previously_visible_sidebar)
|
|
840
|
+
return ''
|
|
841
|
+
else if(previously_visible_sidebar == '*')
|
|
842
|
+
return ''
|
|
843
|
+
else
|
|
844
|
+
return previously_visible_sidebar
|
|
845
|
+
|
|
846
|
+
case NAV_MODE_FULL_PAGE:
|
|
847
|
+
{
|
|
848
|
+
const segs = lastNavPage.split('/')
|
|
849
|
+
if(segs.length > 1)
|
|
850
|
+
return segs[2]
|
|
851
|
+
else
|
|
852
|
+
return ''
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
export function navAutoHide()
|
|
858
|
+
{
|
|
859
|
+
switch(navMode)
|
|
860
|
+
{
|
|
861
|
+
case NAV_MODE_SIDEBAR:
|
|
862
|
+
auto_hide_sidebar()
|
|
863
|
+
break;
|
|
864
|
+
|
|
865
|
+
case NAV_MODE_FULL_PAGE:
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
|