@humandialog/forms.svelte 1.5.1 → 1.6.1

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/i18n.js ADDED
@@ -0,0 +1,188 @@
1
+
2
+ // https://flagdownload.com/
3
+
4
+ let languages = [
5
+ {
6
+ key: "en",
7
+ name: 'English',
8
+ flag: '/landing/lang/GB_64.png',
9
+ default: true
10
+ },
11
+ {
12
+ key: 'es',
13
+ name: "Español",
14
+ flag: '/landing/lang/ES_64.png'
15
+ },
16
+ {
17
+ key: 'pl',
18
+ name: 'Polski',
19
+ flag: '/landing/lang/PL_64.png'
20
+ }
21
+ ]
22
+
23
+ function fetchCurrentLangIndex()
24
+ {
25
+ const stored = localStorage.getItem("__hd_svelte_lang")
26
+ if(!stored)
27
+ {
28
+ if(languages.length == 0)
29
+ return 0;
30
+
31
+ if(!navigator.language)
32
+ return 0;
33
+
34
+ const browserLang = navigator.language.substring(0, 2)
35
+ const idx = languages.findIndex(l => l.key == browserLang)
36
+ if(idx >=0)
37
+ return idx;
38
+ else
39
+ return 0;
40
+ }
41
+ else
42
+ {
43
+ try{
44
+ return JSON.parse(stored)
45
+ }
46
+ catch(err)
47
+ {
48
+ return 0;
49
+ }
50
+ }
51
+ }
52
+
53
+ let currentLangIndex = 0// fetchCurrentLangIndex()
54
+ let defaultLangIndex = 0;
55
+
56
+ export function setLanguages(langs)
57
+ {
58
+ languages = langs
59
+ defaultLangIndex = languages.findIndex(l => l.default == true)
60
+ if(defaultLangIndex < 0)
61
+ defaultLangIndex = 0
62
+
63
+ currentLangIndex = fetchCurrentLangIndex()
64
+ }
65
+
66
+ export function getLanguages()
67
+ {
68
+ return languages
69
+ }
70
+
71
+ export function setCurrentLanguage(sel)
72
+ {
73
+ if(typeof sel === 'number')
74
+ currentLangIndex = sel
75
+ else if (typeof sel === 'string' || sel instanceof String)
76
+ {
77
+ currentLangIndex = languages.findIndex(l => l.key == sel)
78
+ if(currentLangIndex < 0)
79
+ {
80
+ console.error(`language ${sel} doesn't exist`)
81
+ currentLangIndex = defaultLangIndex
82
+ }
83
+ }
84
+ else
85
+ {
86
+ currentLangIndex = languages.findIndex(l => l.key == sel.key)
87
+ if(currentLangIndex < 0)
88
+ {
89
+ console.error(`language ${sel.key} doesn't exist`)
90
+ currentLangIndex = defaultLangIndex
91
+ }
92
+ }
93
+
94
+ localStorage.setItem("__hd_svelte_lang", JSON.stringify(currentLangIndex))
95
+
96
+ }
97
+
98
+ export function getCurrentLanguage()
99
+ {
100
+ return languages[currentLangIndex]
101
+ }
102
+
103
+ export function getCurrentLanguageIdx()
104
+ {
105
+ return currentLangIndex
106
+ }
107
+
108
+ export function getCurrentLanguageKey()
109
+ {
110
+ return languages[currentLangIndex].key
111
+ }
112
+
113
+
114
+ /**
115
+ * i18n("EN; ES; PL") => "EN" albo "ES" albo "PL"
116
+ */
117
+
118
+ export function i18n(list)
119
+ {
120
+ if (typeof list === 'string' || list instanceof String)
121
+ {
122
+ const parts = list.split(/\s*;\s*/);
123
+
124
+ if(parts.length == 0)
125
+ return "";
126
+
127
+ if(currentLangIndex < parts.length)
128
+ return parts[currentLangIndex]
129
+ else if(defaultLangIndex < parts.length)
130
+ return parts[defaultLangIndex]
131
+ else
132
+ return parts[0]
133
+ }
134
+ else if (Array.isArray(list))
135
+ {
136
+ if(list.length == 0)
137
+ return "";
138
+
139
+ if(currentLangIndex < list.length)
140
+ return list[currentLangIndex]
141
+ else if(defaultLangIndex < list.length)
142
+ return list[defaultLangIndex]
143
+ else
144
+ return list[0]
145
+ }
146
+ else
147
+ {
148
+ let langKey = languages[currentLangIndex].key
149
+ if (Object.keys(list).includes(langKey))
150
+ return list[langKey]
151
+ else
152
+ {
153
+ langKey = languages[defaultLangIndex].key
154
+ const keys = Object.keys(list)
155
+ if (keys.includes(langKey))
156
+ return list[langKey]
157
+ else
158
+ return list[keys[0]]
159
+ }
160
+ }
161
+ }
162
+
163
+ export function extractTranslated(str)
164
+ {
165
+ if(str.startsWith('_;'))
166
+ {
167
+ const body = str.replace(/^_;\s*/, ''); // cut prefix "_; "
168
+ return i18n(body);
169
+ }
170
+ else if(str.startsWith('__;'))
171
+ {
172
+ const body = str.replace(/^__;\s*/, ''); // cut prefix "__; "
173
+ const PAIRS = /([A-Za-z]{2})\s*:\s*([^;]*)/g;
174
+ const dict = {};
175
+
176
+ for (const [, code, text] of body.matchAll(PAIRS))
177
+ dict[code.toLowerCase()] = text.trim();
178
+
179
+ return i18n(dict)
180
+ }
181
+ else
182
+ return str
183
+ }
184
+
185
+ export function ext(str)
186
+ {
187
+ return extractTranslated(str)
188
+ }
package/index.d.ts CHANGED
@@ -26,7 +26,7 @@ export { default as ComboItem } from './components/combo/combo.item.svelte';
26
26
  export { default as RichEdit } from './components/document/rich.edit.svelte';
27
27
  export { default as Editor } from './components/document/editor.svelte';
28
28
  export { default as Spinner } from './components/delayed.spinner.svelte';
29
- export { showMenu, showGridMenu, showFloatingToolbar } from './components/menu';
29
+ export { showMenu, showGridMenu, showFloatingToolbar, SHOW_MENU_BELOW, SHOW_MENU_ABOVE, SHOW_MENU_RIGHT, SHOW_MENU_LEFT } from './components/menu';
30
30
  export { default as Fab } from './components/Fab.svelte';
31
31
  export { default as Sidebar } from './components/sidebar/sidebar.svelte';
32
32
  export { default as SidebarBrand } from './components/sidebar/sidebar.brand.svelte';
@@ -60,9 +60,9 @@ export { KanbanColumnTop, KanbanColumnBottom } from './components/kanban/Kanban'
60
60
  export { default as Paginator } from './components/paginator.svelte';
61
61
  export { default as Breadcrumb } from './components/breadcrumb.svelte';
62
62
  export { breadcrumbAdd, breadcrumbParse, breadcrumbStringify, breadcrumbClipName } from './components/breadcrumb_utils';
63
- export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, } from './utils';
63
+ export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, NAV_MODE_SIDEBAR, NAV_MODE_FULL_PAGE, navGetMode, navIsVisible, navGetKey, navShow, navHide, navToggle, navPrevVisibleKey, navAutoHide, } from './utils';
64
64
  export { getNiceStringDateTime, getFormattedStringDate, getNiceStringDate, dayName, monthName } from './components/date_utils';
65
- export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, tagsReloader, reloadVisibleTags, dark_mode_store, showFABAlways } from './stores.js';
65
+ export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, wholeAppReloader, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, navKey, tagsReloader, reloadVisibleTags, dark_mode_store, showFABAlways } from './stores.js';
66
66
  export { data_tick_store, // tmp
67
67
  hasSelectedItem, hasDataItem, setNavigatorTitle } from "./stores";
68
68
  export { contextToolbarOperations, pageToolbarOperations, contextItemsStore, contextTypesStore } from './stores';
@@ -72,3 +72,5 @@ export { default as IcH2 } from './components/document/internal/h2.icon.svelte';
72
72
  export { default as IcH3 } from './components/document/internal/h3.icon.svelte';
73
73
  export { default as IcH4 } from './components/document/internal/h4.icon.svelte';
74
74
  export { registerKicksObserver, unregisterKicksObserver, forceKicksChecking } from './kicks.js';
75
+ export { i18n, extractTranslated, ext, setLanguages, getLanguages, setCurrentLanguage, getCurrentLanguage, getCurrentLanguageIdx, getCurrentLanguageKey } from './i18n.js';
76
+ export { i18nPreprocess } from './i18n-preprocess.js';
package/index.js CHANGED
@@ -32,7 +32,7 @@ export { default as RichEdit } from './components/document/rich.edit.svelte';
32
32
  export { default as Editor } from './components/document/editor.svelte';
33
33
  export { default as Spinner } from './components/delayed.spinner.svelte';
34
34
  //export { default as Menu } from './components/contextmenu.svelte'
35
- export { showMenu, showGridMenu, showFloatingToolbar } from './components/menu';
35
+ export { showMenu, showGridMenu, showFloatingToolbar, SHOW_MENU_BELOW, SHOW_MENU_ABOVE, SHOW_MENU_RIGHT, SHOW_MENU_LEFT } from './components/menu';
36
36
  export { default as Fab } from './components/Fab.svelte';
37
37
  export { default as Sidebar } from './components/sidebar/sidebar.svelte';
38
38
  export { default as SidebarBrand } from './components/sidebar/sidebar.brand.svelte';
@@ -66,9 +66,9 @@ export { KanbanColumnTop, KanbanColumnBottom } from './components/kanban/Kanban'
66
66
  export { default as Paginator } from './components/paginator.svelte';
67
67
  export { default as Breadcrumb } from './components/breadcrumb.svelte';
68
68
  export { breadcrumbAdd, breadcrumbParse, breadcrumbStringify, breadcrumbClipName } from './components/breadcrumb_utils';
69
- export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, } from './utils';
69
+ export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, NAV_MODE_SIDEBAR, NAV_MODE_FULL_PAGE, navGetMode, navIsVisible, navGetKey, navShow, navHide, navToggle, navPrevVisibleKey, navAutoHide, } from './utils';
70
70
  export { getNiceStringDateTime, getFormattedStringDate, getNiceStringDate, dayName, monthName } from './components/date_utils';
71
- export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, tagsReloader, reloadVisibleTags, dark_mode_store, showFABAlways } from './stores.js';
71
+ export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, wholeAppReloader, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, navKey, tagsReloader, reloadVisibleTags, dark_mode_store, showFABAlways } from './stores.js';
72
72
  export { data_tick_store, // tmp
73
73
  hasSelectedItem, hasDataItem, setNavigatorTitle } from "./stores";
74
74
  export { contextToolbarOperations, pageToolbarOperations, contextItemsStore, contextTypesStore } from './stores'; // tmp
@@ -78,3 +78,5 @@ export { default as IcH2 } from './components/document/internal/h2.icon.svelte';
78
78
  export { default as IcH3 } from './components/document/internal/h3.icon.svelte';
79
79
  export { default as IcH4 } from './components/document/internal/h4.icon.svelte';
80
80
  export { registerKicksObserver, unregisterKicksObserver, forceKicksChecking } from './kicks.js';
81
+ export { i18n, extractTranslated, ext, setLanguages, getLanguages, setCurrentLanguage, getCurrentLanguage, getCurrentLanguageIdx, getCurrentLanguageKey } from './i18n.js';
82
+ export { i18nPreprocess } from './i18n-preprocess.js';
package/modal.svelte CHANGED
@@ -3,6 +3,7 @@ import Icon from "./components/icon.svelte";
3
3
  import { pushToolsActionsOperations, popToolsActionsOperations } from "./stores.js";
4
4
  import { isDeviceSmallerThan } from "./utils";
5
5
  import { FaTimes } from "svelte-icons/fa";
6
+ import { i18n } from "./i18n.js";
6
7
  export let title = "";
7
8
  export let open = false;
8
9
  export let content = "";
@@ -13,7 +14,7 @@ export const Cancel = 2;
13
14
  export const Custom = 3;
14
15
  export let mode = OKCancel;
15
16
  export let okCaption = "OK";
16
- export let cancelCaption = "Cancel";
17
+ export let cancelCaption = i18n({ en: "Cancel", es: "Cancelar", pl: "Anuluj" });
17
18
  export let onOkCallback = void 0;
18
19
  export let onCancelCallback = void 0;
19
20
  export function show(on_close_callback = void 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
@@ -156,6 +156,8 @@
156
156
  "./desk.svelte": "./desk.svelte",
157
157
  "./form.box.svelte": "./form.box.svelte",
158
158
  "./horizontal.toolbar.svelte": "./horizontal.toolbar.svelte",
159
+ "./i18n-preprocess": "./i18n-preprocess.js",
160
+ "./i18n": "./i18n.js",
159
161
  ".": "./index.js",
160
162
  "./internal/configurable.content.svelte": "./internal/configurable.content.svelte",
161
163
  "./internal/loading.svelte": "./internal/loading.svelte",
package/stores.d.ts CHANGED
@@ -51,3 +51,4 @@ export const visible_property_tab_store: import("svelte/store").Writable<string>
51
51
  export const fabCollapsed: import("svelte/store").Writable<any>;
52
52
  export const showFABAlways: import("svelte/store").Writable<any>;
53
53
  export const leftHandedFAB: import("svelte/store").Writable<any>;
54
+ export const navKey: import("svelte/store").Readable<any>;
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() )
@@ -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
- { name: 'No auth access', key: 0 },
59
- { name: 'Read auth access', key: 1 },
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
- { name: 'Full auth access', key: 7 },
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
- { name: 'Can read files', key: 0 },
66
- { name: 'Can write files', key: 1 },
67
- { name: 'Full files access', key: 3 },
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 = "Removed";
169
+ user.membership_tag = i18n({en: 'Removed', es: 'Eliminado', pl: 'Usunięto'});
164
170
  else if(user.invitation_not_accepted)
165
- user.membership_tag = "Invited";
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 (auth role)',
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: 'Access role (app role)',
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 (files role)',
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
- Auth access
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
- Files access
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
- App role
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="User removal"
912
- content="Are you sure you want to remove {userToRemove ? userToRemove[nameAttrib] : 'user'} from the group?"
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="Delete app account"
920
- content="Are you sure you want to delete your application account?"
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;