@humandialog/forms.svelte 1.7.21 → 1.7.23
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.
|
@@ -6,11 +6,13 @@ export default class Paginator extends SvelteComponentTyped<{
|
|
|
6
6
|
allPagesNo: any;
|
|
7
7
|
onPage: any;
|
|
8
8
|
visiblePagesNo?: number | undefined;
|
|
9
|
+
updateParams?: ((p: any, allP: any) => void) | undefined;
|
|
9
10
|
updatePageNo?: ((p: any) => void) | undefined;
|
|
10
11
|
updateAllPagesNo?: ((allP: any) => void) | undefined;
|
|
11
12
|
}, {
|
|
12
13
|
[evt: string]: CustomEvent<any>;
|
|
13
14
|
}, {}> {
|
|
15
|
+
get updateParams(): (p: any, allP: any) => void;
|
|
14
16
|
get updatePageNo(): (p: any) => void;
|
|
15
17
|
get updateAllPagesNo(): (allP: any) => void;
|
|
16
18
|
}
|
|
@@ -24,6 +26,7 @@ declare const __propDef: {
|
|
|
24
26
|
allPagesNo: any;
|
|
25
27
|
onPage: any;
|
|
26
28
|
visiblePagesNo?: number | undefined;
|
|
29
|
+
updateParams?: ((p: any, allP: any) => void) | undefined;
|
|
27
30
|
updatePageNo?: ((p: any) => void) | undefined;
|
|
28
31
|
updateAllPagesNo?: ((allP: any) => void) | undefined;
|
|
29
32
|
};
|
package/desk.svelte
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import HorizontalToolbar from './horizontal.toolbar.svelte'
|
|
3
3
|
import VerticalToolbar from './vertical.toolbar.svelte'
|
|
4
|
+
import HorizontalNavigatorTabs from './horizontal.nav.tabs.svelte'
|
|
4
5
|
import Configurable from './internal/configurable.content.svelte'
|
|
5
6
|
import Operations from './operations.svelte'
|
|
6
7
|
import Fab from './components/Fab.svelte'
|
|
@@ -109,6 +110,7 @@
|
|
|
109
110
|
let vertical_toolbar_visibility = "hidden sm:block"
|
|
110
111
|
let content_left = "left-0 sm:left-[40px]";
|
|
111
112
|
let content_width = "w-screen sm:w-[calc(100vw-40px)] ";
|
|
113
|
+
let horizontal_nav_tabs_visibility = "hidden"
|
|
112
114
|
|
|
113
115
|
let content_top = ""
|
|
114
116
|
let content_height = ""
|
|
@@ -198,18 +200,25 @@
|
|
|
198
200
|
vertical_toolbar_visibility = "hidden sm:block"
|
|
199
201
|
content_left = "left-0 sm:left-[40px]";
|
|
200
202
|
content_width = "w-screen sm:w-[calc(100vw-40px)]";
|
|
203
|
+
|
|
204
|
+
horizontal_nav_tabs_visibility = "hidden"
|
|
201
205
|
return false;
|
|
202
206
|
}
|
|
203
207
|
else
|
|
204
208
|
{
|
|
205
209
|
if(navIsVisible())
|
|
206
|
-
|
|
207
|
-
vertical_toolbar_visibility = "block"
|
|
208
|
-
content_left = "left-[50px]";
|
|
209
|
-
content_width = "w-[calc(100vw-50px)] ";
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
210
|
+
horizontal_nav_tabs_visibility = "block"
|
|
212
211
|
else
|
|
212
|
+
horizontal_nav_tabs_visibility = "hidden"
|
|
213
|
+
|
|
214
|
+
//if(navIsVisible())
|
|
215
|
+
//{
|
|
216
|
+
// vertical_toolbar_visibility = "block"
|
|
217
|
+
// content_left = "left-[50px]";
|
|
218
|
+
// content_width = "w-[calc(100vw-50px)] ";
|
|
219
|
+
// return true;
|
|
220
|
+
//}
|
|
221
|
+
//else
|
|
213
222
|
{
|
|
214
223
|
vertical_toolbar_visibility = "hidden sm:block"
|
|
215
224
|
content_left = "left-0 sm:left-[40px]";
|
|
@@ -384,6 +393,12 @@
|
|
|
384
393
|
</div>
|
|
385
394
|
</div>
|
|
386
395
|
|
|
396
|
+
<header class="{horizontal_nav_tabs_visibility} fixed w-screen bottom-0 h-[50px] sm:h-[40px] z-20 shadow shadow-stone-900/5 dark:shadow-none overflow-auto" >
|
|
397
|
+
<div class=" flex flex-row justify-between h-full bg-stone-950 text-stone-100 ">
|
|
398
|
+
<HorizontalNavigatorTabs appConfig={layout}/>
|
|
399
|
+
<div>
|
|
400
|
+
</header>
|
|
401
|
+
|
|
387
402
|
<!--VerticalToolbar /-->
|
|
388
403
|
|
|
389
404
|
<!--#######################################################-->
|
|
@@ -557,5 +572,5 @@
|
|
|
557
572
|
|
|
558
573
|
:global(body.dark) {
|
|
559
574
|
--tw-bg-opacity: 1;
|
|
560
|
-
background-color: rgb(
|
|
575
|
+
background-color: rgb(12 10 9/var(--tw-bg-opacity));
|
|
561
576
|
}</style>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import {contextItemsStore,
|
|
3
|
+
context_info_store,
|
|
4
|
+
contextToolbarOperations,
|
|
5
|
+
data_tick_store,
|
|
6
|
+
navKey
|
|
7
|
+
} from "./stores.js";
|
|
8
|
+
import Icon from './components/icon.svelte';
|
|
9
|
+
import {session, signInHRef, signOutHRef} from '@humandialog/auth.svelte'
|
|
10
|
+
import { navGetKey, navHide, navIsVisible, navShow, navToggle } from './utils';
|
|
11
|
+
|
|
12
|
+
export let appConfig = undefined;
|
|
13
|
+
export let clearsContext = 'sel props'
|
|
14
|
+
|
|
15
|
+
export let definedTabs = undefined
|
|
16
|
+
export let mainToolbarConfig = undefined
|
|
17
|
+
|
|
18
|
+
let tabs = new Array();
|
|
19
|
+
let config = null;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
let is_logged_in = false;
|
|
23
|
+
|
|
24
|
+
$: {
|
|
25
|
+
if(appConfig)
|
|
26
|
+
{
|
|
27
|
+
config = appConfig.mainToolbar;
|
|
28
|
+
}
|
|
29
|
+
else
|
|
30
|
+
{
|
|
31
|
+
config = mainToolbarConfig;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
is_logged_in = $session.isActive;
|
|
35
|
+
|
|
36
|
+
tabs = new Array();
|
|
37
|
+
|
|
38
|
+
if(definedTabs && Array.isArray(definedTabs) && definedTabs.length > 0)
|
|
39
|
+
{
|
|
40
|
+
tabs = [...definedTabs]
|
|
41
|
+
}
|
|
42
|
+
else
|
|
43
|
+
{
|
|
44
|
+
Object.keys(appConfig.sidebar).forEach( (key) =>
|
|
45
|
+
{
|
|
46
|
+
const ctab = appConfig.sidebar[key];
|
|
47
|
+
const can_show = (ctab.authorized && is_logged_in) || (!ctab.authorized)
|
|
48
|
+
if(can_show)
|
|
49
|
+
{
|
|
50
|
+
const tab = {
|
|
51
|
+
key: key,
|
|
52
|
+
icon: ctab.icon,
|
|
53
|
+
onclick: (e) => on_navigator_tab_clicked(e, key),
|
|
54
|
+
mountObserver: ctab.mountObserver,
|
|
55
|
+
badgeObtainerAsync: ctab.badgeObtainerAsync,
|
|
56
|
+
badgeObtainer: ctab.badgeObtainer
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
tabs.push(tab);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// there is no current visible sidebar
|
|
64
|
+
if(navIsVisible())
|
|
65
|
+
{
|
|
66
|
+
const selectedNav = navGetKey()
|
|
67
|
+
if(tabs.every( (e) => e.key != selectedNav))
|
|
68
|
+
{
|
|
69
|
+
if(tabs.length)
|
|
70
|
+
navShow(tabs[0].key);
|
|
71
|
+
else
|
|
72
|
+
navHide();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function on_navigator_tab_clicked(e, key)
|
|
79
|
+
{
|
|
80
|
+
e.stopPropagation();
|
|
81
|
+
navToggle(key);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
function clearSelection()
|
|
86
|
+
{
|
|
87
|
+
if (!clearsContext) return;
|
|
88
|
+
|
|
89
|
+
let contexts = clearsContext.split(' ');
|
|
90
|
+
contexts.forEach((c) => {
|
|
91
|
+
$contextItemsStore[c] = null;
|
|
92
|
+
$context_info_store[c] = '';
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
//e.stopPropagation();
|
|
96
|
+
|
|
97
|
+
$contextToolbarOperations = [];
|
|
98
|
+
$data_tick_store = $data_tick_store + 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function mountNavigator(node, tab)
|
|
102
|
+
{
|
|
103
|
+
if(!tab.mountObserver)
|
|
104
|
+
return;
|
|
105
|
+
|
|
106
|
+
const onDestroy = tab.mountObserver(rerenderTabs)
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
destroy() {
|
|
110
|
+
if(onDestroy)
|
|
111
|
+
onDestroy()
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function rerenderTabs()
|
|
117
|
+
{
|
|
118
|
+
tabs = [...tabs]
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
124
|
+
|
|
125
|
+
<section class="no-print w-full" on:click={clearSelection}>
|
|
126
|
+
<div class="left-0 flex justify-around h-12">
|
|
127
|
+
{#each tabs as tab}
|
|
128
|
+
{@const isSelected = $navKey == tab.key}
|
|
129
|
+
<button
|
|
130
|
+
class="w-16 h-full flex justify-center items-center text-stone-300 hover:text-stone-100 relative"
|
|
131
|
+
class:bg-orange-500={isSelected}
|
|
132
|
+
on:click={tab.onclick}
|
|
133
|
+
use:mountNavigator={tab}>
|
|
134
|
+
|
|
135
|
+
<Icon s="xl" component={tab.icon}/>
|
|
136
|
+
|
|
137
|
+
{#if !isSelected}
|
|
138
|
+
{#if tab.badgeObtainer}
|
|
139
|
+
{@const badge=tab.badgeObtainer()}
|
|
140
|
+
{#if badge > 0}
|
|
141
|
+
{#if badge > 9}
|
|
142
|
+
9+
|
|
143
|
+
{:else}
|
|
144
|
+
{badge}
|
|
145
|
+
{/if}
|
|
146
|
+
{/if}
|
|
147
|
+
{:else if tab.badgeObtainerAsync}
|
|
148
|
+
{#await tab.badgeObtainerAsync() then badge}
|
|
149
|
+
{#if badge > 0}
|
|
150
|
+
<div class="absolute
|
|
151
|
+
inline-flex items-center justify-center
|
|
152
|
+
w-5 h-5
|
|
153
|
+
text-[10px] font-bold text-white bg-red-500 border-2 border-white rounded-full bottom-2 end-0 dark:border-gray-900">
|
|
154
|
+
{#if badge > 9}
|
|
155
|
+
9+
|
|
156
|
+
{:else}
|
|
157
|
+
{badge}
|
|
158
|
+
{/if}
|
|
159
|
+
</div>
|
|
160
|
+
{/if}
|
|
161
|
+
{/await}
|
|
162
|
+
{/if}
|
|
163
|
+
{/if}
|
|
164
|
+
|
|
165
|
+
</button>
|
|
166
|
+
{/each}
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
</section>
|
|
171
|
+
|
|
172
|
+
<!--Menu bind:this={menu}/-->
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<style>
|
|
177
|
+
@media print
|
|
178
|
+
{
|
|
179
|
+
.no-print, .no-print *{
|
|
180
|
+
display: none !important;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} HorizontalProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} HorizontalEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} HorizontalSlots */
|
|
4
|
+
export default class Horizontal extends SvelteComponentTyped<{
|
|
5
|
+
appConfig?: any;
|
|
6
|
+
clearsContext?: string | undefined;
|
|
7
|
+
definedTabs?: any;
|
|
8
|
+
mainToolbarConfig?: any;
|
|
9
|
+
}, {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
}, {}> {
|
|
12
|
+
}
|
|
13
|
+
export type HorizontalProps = typeof __propDef.props;
|
|
14
|
+
export type HorizontalEvents = typeof __propDef.events;
|
|
15
|
+
export type HorizontalSlots = typeof __propDef.slots;
|
|
16
|
+
import { SvelteComponentTyped } from "svelte";
|
|
17
|
+
declare const __propDef: {
|
|
18
|
+
props: {
|
|
19
|
+
appConfig?: any;
|
|
20
|
+
clearsContext?: string | undefined;
|
|
21
|
+
definedTabs?: any;
|
|
22
|
+
mainToolbarConfig?: any;
|
|
23
|
+
};
|
|
24
|
+
events: {
|
|
25
|
+
[evt: string]: CustomEvent<any>;
|
|
26
|
+
};
|
|
27
|
+
slots: {};
|
|
28
|
+
};
|
|
29
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@humandialog/forms.svelte",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.23",
|
|
4
4
|
"description": "Basic Svelte UI components for Object Reef applications",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@playwright/test": "^1.28.1",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"type": "module",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@humandialog/auth.svelte": "^1.8.
|
|
30
|
+
"@humandialog/auth.svelte": "^1.8.19",
|
|
31
31
|
"@tiptap/core": "^2.11.0",
|
|
32
32
|
"@tiptap/extension-bullet-list": "^2.11.5",
|
|
33
33
|
"@tiptap/extension-code-block": "^2.11.5",
|
|
@@ -166,6 +166,7 @@
|
|
|
166
166
|
"./desk.svelte": "./desk.svelte",
|
|
167
167
|
"./dialog.svelte": "./dialog.svelte",
|
|
168
168
|
"./form.box.svelte": "./form.box.svelte",
|
|
169
|
+
"./horizontal.nav.tabs.svelte": "./horizontal.nav.tabs.svelte",
|
|
169
170
|
"./horizontal.toolbar.svelte": "./horizontal.toolbar.svelte",
|
|
170
171
|
"./i18n-preprocess": "./i18n-preprocess.js",
|
|
171
172
|
"./i18n": "./i18n.js",
|