@humandialog/forms.svelte 0.6.1 → 1.1.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/checkbox.svelte +9 -2
- package/components/combo/combo.svelte +19 -7
- package/components/combo/combo.svelte.d.ts +1 -0
- package/components/contextmenu.svelte +13 -4
- package/components/input.text.svelte.d.ts +2 -2
- package/components/inputbox.ltop.svelte +18 -8
- package/components/inputbox.ltop.svelte.d.ts +12 -10
- package/components/list/internal/list.element.svelte +22 -4
- package/components/list/list.svelte +28 -26
- package/components/sidebar/sidebar.brand.svelte +5 -2
- package/components/sidebar/sidebar.brand.svelte.d.ts +2 -0
- package/components/simple.table.svelte.d.ts +2 -2
- package/components/table/_template.table.svelte.d.ts +2 -2
- package/components/textarea.ltop.svelte.d.ts +2 -2
- package/components/tile.title.svelte.d.ts +2 -2
- package/desk.svelte +113 -106
- package/horizontal.toolbar.svelte +44 -17
- package/package.json +2 -2
- package/page.svelte.d.ts +6 -6
- package/stores.d.ts +2 -0
- package/stores.js +8 -0
- package/tenant.members.svelte +391 -81
- package/tenant.members.svelte.d.ts +2 -2
- package/vertical.toolbar.svelte +148 -11
package/vertical.toolbar.svelte
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import FaToggleOn from 'svelte-icons/fa/
|
|
3
|
-
import
|
|
4
|
-
import FaEllipsisH from 'svelte-icons/fa/FaEllipsisH.svelte'
|
|
5
|
-
import FaCog from 'svelte-icons/fa/FaCog.svelte'
|
|
6
|
-
import FaTools from 'svelte-icons/fa/FaTools.svelte'
|
|
7
|
-
import GoPrimitiveDot from 'svelte-icons/go/GoPrimitiveDot.svelte'
|
|
8
|
-
import FaSignInAlt from 'svelte-icons/fa/FaSignInAlt.svelte'
|
|
9
|
-
import FaSignOutAlt from 'svelte-icons/fa/FaSignOutAlt.svelte'
|
|
2
|
+
import {FaUsers, FaCog, FaToggleOn, FaToggleOff, FaSignInAlt, FaSignOutAlt, FaPlus} from 'svelte-icons/fa/'
|
|
3
|
+
//import GoPrimitiveDot from 'svelte-icons/go/GoPrimitiveDot.svelte'
|
|
10
4
|
import {showMenu} from './components/menu'
|
|
5
|
+
import {reef} from '@humandialog/auth.svelte'
|
|
6
|
+
import Modal from './modal.svelte'
|
|
7
|
+
import Input from './components/inputbox.ltop.svelte'
|
|
11
8
|
//import Menu from './components/contextmenu.svelte'
|
|
12
9
|
|
|
13
10
|
import {dark_mode_store,
|
|
@@ -21,11 +18,13 @@
|
|
|
21
18
|
contextItemsStore,
|
|
22
19
|
context_info_store,
|
|
23
20
|
contextToolbarOperations,
|
|
24
|
-
data_tick_store
|
|
21
|
+
data_tick_store,
|
|
22
|
+
reloadWholeApp
|
|
25
23
|
} from "./stores.js";
|
|
26
24
|
import Icon from './components/icon.svelte';
|
|
27
25
|
import {session, signInHRef, signOutHRef} from '@humandialog/auth.svelte'
|
|
28
26
|
import { push } from 'svelte-spa-router';
|
|
27
|
+
import { tick } from 'svelte';
|
|
29
28
|
|
|
30
29
|
|
|
31
30
|
export let appConfig;
|
|
@@ -42,8 +41,10 @@
|
|
|
42
41
|
let is_logged_in = false;
|
|
43
42
|
let sign_in_href = '';
|
|
44
43
|
let sign_out_href = '';
|
|
44
|
+
let show_groups_switch_menu = false;
|
|
45
|
+
let can_add_new_group = false;
|
|
45
46
|
|
|
46
|
-
$:{
|
|
47
|
+
$: {
|
|
47
48
|
config = appConfig.mainToolbar;
|
|
48
49
|
has_selection_details = appConfig.selectionDetails;
|
|
49
50
|
if(has_selection_details)
|
|
@@ -74,6 +75,20 @@
|
|
|
74
75
|
hide_sidebar();
|
|
75
76
|
}
|
|
76
77
|
}
|
|
78
|
+
|
|
79
|
+
show_groups_switch_menu = $session.tenants.length > 1
|
|
80
|
+
|
|
81
|
+
if($session.configuration.tenant)
|
|
82
|
+
{
|
|
83
|
+
reef.getAppInstanceInfo().then( (instanceInfo =>{
|
|
84
|
+
if(instanceInfo?.is_public)
|
|
85
|
+
{
|
|
86
|
+
show_groups_switch_menu = true;
|
|
87
|
+
can_add_new_group = true;
|
|
88
|
+
}
|
|
89
|
+
}))
|
|
90
|
+
|
|
91
|
+
}
|
|
77
92
|
|
|
78
93
|
}
|
|
79
94
|
|
|
@@ -181,6 +196,49 @@
|
|
|
181
196
|
showMenu(pt, options);
|
|
182
197
|
}
|
|
183
198
|
|
|
199
|
+
function show_groups(e)
|
|
200
|
+
{
|
|
201
|
+
let owner = e.target;
|
|
202
|
+
while(owner && owner.tagName != 'BUTTON')
|
|
203
|
+
owner = owner.parentElement
|
|
204
|
+
|
|
205
|
+
if(!owner)
|
|
206
|
+
return;
|
|
207
|
+
|
|
208
|
+
let rect = owner.getBoundingClientRect();
|
|
209
|
+
let options = [];
|
|
210
|
+
|
|
211
|
+
$session.tenants.forEach(tInfo =>
|
|
212
|
+
options.push({
|
|
213
|
+
caption: tInfo.name,
|
|
214
|
+
icon: FaUsers,
|
|
215
|
+
disabled: tInfo.id == $session.tid,
|
|
216
|
+
action: (f) => {
|
|
217
|
+
$session.setCurrentTenantAPI(tInfo.url, tInfo.id)
|
|
218
|
+
|
|
219
|
+
push('/')
|
|
220
|
+
reloadWholeApp();
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
if(can_add_new_group)
|
|
226
|
+
{
|
|
227
|
+
options.push({
|
|
228
|
+
separator: true
|
|
229
|
+
})
|
|
230
|
+
options.push({
|
|
231
|
+
caption: 'Add group',
|
|
232
|
+
icon: FaPlus,
|
|
233
|
+
action: (f) => launchNewGroupWizzard()
|
|
234
|
+
})
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
let pt = new DOMPoint(rect.right, rect.top)
|
|
239
|
+
showMenu(pt, options);
|
|
240
|
+
}
|
|
241
|
+
|
|
184
242
|
function clearSelection()
|
|
185
243
|
{
|
|
186
244
|
if (!clearsContext) return;
|
|
@@ -196,6 +254,64 @@
|
|
|
196
254
|
$contextToolbarOperations = [];
|
|
197
255
|
$data_tick_store = $data_tick_store + 1;
|
|
198
256
|
}
|
|
257
|
+
|
|
258
|
+
let newGroupParams = {
|
|
259
|
+
name: ''
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
let newGroupModalVisible = false;
|
|
263
|
+
function launchNewGroupWizzard()
|
|
264
|
+
{
|
|
265
|
+
newGroupParams.name = '';
|
|
266
|
+
newGroupModalVisible = true;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
async function onNewGroupOK()
|
|
270
|
+
{
|
|
271
|
+
const appId = $session.appId
|
|
272
|
+
if(!appId)
|
|
273
|
+
{
|
|
274
|
+
return onNewGroupCancel()
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const appInstanceId = $session.configuration.tenant
|
|
278
|
+
if(!appInstanceId)
|
|
279
|
+
{
|
|
280
|
+
return onNewGroupCancel()
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const body = {
|
|
284
|
+
app_id: $session.appId,
|
|
285
|
+
tenant: $session.configuration.tenant,
|
|
286
|
+
org_name: newGroupParams.name
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const res = await reef.fetch( "/dev/create-group-for-me",
|
|
290
|
+
{
|
|
291
|
+
method: 'post',
|
|
292
|
+
body : JSON.stringify(body)
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
if(res.ok)
|
|
296
|
+
{
|
|
297
|
+
await reef.refreshTokens()
|
|
298
|
+
//reloadWholeApp()
|
|
299
|
+
}
|
|
300
|
+
else
|
|
301
|
+
{
|
|
302
|
+
const result = await res.json();
|
|
303
|
+
console.error(result.error);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
newGroupParams.name = '';
|
|
307
|
+
newGroupModalVisible = false;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function onNewGroupCancel()
|
|
311
|
+
{
|
|
312
|
+
newGroupParams.name = '';
|
|
313
|
+
newGroupModalVisible = false;
|
|
314
|
+
}
|
|
199
315
|
|
|
200
316
|
</script>
|
|
201
317
|
|
|
@@ -219,8 +335,15 @@
|
|
|
219
335
|
|
|
220
336
|
<div class="mt-auto h-auto items-center w-full">
|
|
221
337
|
|
|
338
|
+
{#if show_groups_switch_menu}
|
|
339
|
+
<button class="h-12 px-0 flex justify-center items-center w-full text-stone-300 hover:text-stone-100"
|
|
340
|
+
on:click|stopPropagation={show_groups}>
|
|
341
|
+
<Icon size={4} component={FaUsers} />
|
|
342
|
+
</button>
|
|
343
|
+
{/if}
|
|
344
|
+
|
|
222
345
|
<button
|
|
223
|
-
class="h-
|
|
346
|
+
class="h-12 px-0 flex justify-center items-center w-full text-stone-300 hover:text-stone-100"
|
|
224
347
|
on:click|stopPropagation={show_options}>
|
|
225
348
|
|
|
226
349
|
<Icon size={4} component={FaCog} />
|
|
@@ -232,6 +355,20 @@
|
|
|
232
355
|
|
|
233
356
|
<!--Menu bind:this={menu}/-->
|
|
234
357
|
|
|
358
|
+
<Modal bind:open={newGroupModalVisible}
|
|
359
|
+
title='Create group'
|
|
360
|
+
okCaption='Create'
|
|
361
|
+
onOkCallback={onNewGroupOK}
|
|
362
|
+
onCancelCallback={onNewGroupCancel}
|
|
363
|
+
icon={FaUsers}
|
|
364
|
+
>
|
|
365
|
+
<Input label='Group name'
|
|
366
|
+
placeholder=''
|
|
367
|
+
self={newGroupParams}
|
|
368
|
+
a="name"
|
|
369
|
+
required/>
|
|
370
|
+
</Modal>
|
|
371
|
+
|
|
235
372
|
<style>
|
|
236
373
|
@media print
|
|
237
374
|
{
|