@bexis2/bexis2-core-ui 0.1.0 → 0.1.2
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/README.md +13 -1
- package/dist/components/file/FileUploader.svelte +1 -1
- package/dist/components/form/MultiSelect.svelte +108 -91
- package/dist/components/form/MultiSelect.svelte.d.ts +4 -4
- package/dist/components/page/Page.svelte +13 -2
- package/dist/components/page/Page.svelte.d.ts +2 -0
- package/dist/components/page/menu/Menu.svelte +36 -0
- package/dist/components/page/menu/Menu.svelte.d.ts +14 -0
- package/dist/components/page/menu/MenuBar.svelte +21 -0
- package/dist/components/page/menu/MenuBar.svelte.d.ts +17 -0
- package/dist/components/page/menu/MenuDataCaller.d.ts +1 -0
- package/dist/components/page/menu/MenuDataCaller.js +11 -0
- package/dist/components/page/menu/MenuItem.svelte +36 -0
- package/dist/components/page/menu/MenuItem.svelte.d.ts +17 -0
- package/dist/components/page/menu/SettingsBar.svelte +46 -0
- package/dist/components/page/menu/SettingsBar.svelte.d.ts +17 -0
- package/dist/components/page/menu/menu.d.ts +21 -0
- package/dist/components/page/menu/menu.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/lib/components/file/FileUploader.svelte +1 -1
- package/src/lib/components/form/MultiSelect.svelte +108 -91
- package/src/lib/components/page/Alert.svelte +0 -1
- package/src/lib/components/page/Page.svelte +15 -1
- package/src/lib/components/page/menu/Menu.svelte +53 -0
- package/src/lib/components/page/menu/MenuBar.svelte +30 -0
- package/src/lib/components/page/menu/MenuDataCaller.js +11 -0
- package/src/lib/components/page/menu/MenuItem.svelte +43 -0
- package/src/lib/components/page/menu/SettingsBar.svelte +61 -0
- package/src/lib/components/page/menu/menu.ts +23 -0
- package/src/lib/index.ts +1 -1
- /package/dist/components/{spinner → page}/Spinner.svelte +0 -0
- /package/dist/components/{spinner → page}/Spinner.svelte.d.ts +0 -0
- /package/src/lib/components/{spinner → page}/Spinner.svelte +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import DropZone from "svelte-file-dropzone/Dropzone.svelte";
|
|
2
2
|
import Fa from "svelte-fa/src/fa.svelte";
|
|
3
|
-
import Spinner from "../
|
|
3
|
+
import Spinner from "../page/Spinner.svelte";
|
|
4
4
|
import { createEventDispatcher } from "svelte";
|
|
5
5
|
import { faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
6
6
|
import { faSave } from "@fortawesome/free-regular-svg-icons";
|
|
@@ -1,91 +1,108 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import InputContainer from './InputContainer.svelte';
|
|
3
|
-
|
|
4
|
-
import Select from 'svelte-select';
|
|
5
|
-
import { onMount } from 'svelte';
|
|
6
|
-
|
|
7
|
-
export let source;
|
|
8
|
-
export let target;
|
|
9
|
-
export let title;
|
|
10
|
-
export let itemId = 'value';
|
|
11
|
-
export let label = 'label';
|
|
12
|
-
export let isMulti = true;
|
|
13
|
-
export let isComplex = false;
|
|
14
|
-
export let isTargetComplex = false;
|
|
15
|
-
export let required = false;
|
|
16
|
-
export let feedback = [];
|
|
17
|
-
|
|
18
|
-
let isLoaded = false;
|
|
19
|
-
|
|
20
|
-
$: value = null;
|
|
21
|
-
$: updateTarget(value);
|
|
22
|
-
|
|
23
|
-
function updateTarget(selection) {
|
|
24
|
-
//diffrent cases
|
|
25
|
-
console.log('------');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
isLoaded = true;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
1
|
+
<script>
|
|
2
|
+
import InputContainer from './InputContainer.svelte';
|
|
3
|
+
|
|
4
|
+
import Select from 'svelte-select';
|
|
5
|
+
import { onMount } from 'svelte';
|
|
6
|
+
|
|
7
|
+
export let source;
|
|
8
|
+
export let target;
|
|
9
|
+
export let title;
|
|
10
|
+
export let itemId = 'value';
|
|
11
|
+
export let label = 'label';
|
|
12
|
+
export let isMulti = true;
|
|
13
|
+
export let isComplex = false;
|
|
14
|
+
export let isTargetComplex = false;
|
|
15
|
+
export let required = false;
|
|
16
|
+
export let feedback = [];
|
|
17
|
+
|
|
18
|
+
let isLoaded = false;
|
|
19
|
+
|
|
20
|
+
$: value = null;
|
|
21
|
+
$: updateTarget(value);
|
|
22
|
+
|
|
23
|
+
function updateTarget(selection) {
|
|
24
|
+
//diffrent cases
|
|
25
|
+
console.log('------');
|
|
26
|
+
console.log('isComplex',isComplex);
|
|
27
|
+
console.log('isTargetComplex',isTargetComplex);
|
|
28
|
+
console.log('selection',selection);
|
|
29
|
+
|
|
30
|
+
//a) source is complex model is simple
|
|
31
|
+
if (isComplex && !isTargetComplex && isLoaded) {
|
|
32
|
+
console.log('a) source is complex model is simple');
|
|
33
|
+
|
|
34
|
+
target = [];
|
|
35
|
+
for (let i in selection) {
|
|
36
|
+
let item = selection[i];
|
|
37
|
+
target.push(item[itemId]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!isComplex && !isTargetComplex && isLoaded) {
|
|
42
|
+
target = [];
|
|
43
|
+
for (let i in selection) {
|
|
44
|
+
target.push(selection[i].value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isComplex && isTargetComplex && isLoaded)
|
|
49
|
+
{
|
|
50
|
+
console.log("both complex",selection);
|
|
51
|
+
target = selection;
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// console.log('selection ' + title, selection);
|
|
56
|
+
// console.log('target ' + title, target);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
onMount(async () => {
|
|
60
|
+
//console.log("on mount multiselect");
|
|
61
|
+
//console.log(source);
|
|
62
|
+
|
|
63
|
+
//a) source is complex model is simple
|
|
64
|
+
if (isComplex && !isTargetComplex) {
|
|
65
|
+
let items = [];
|
|
66
|
+
// event.detail will be null unless isMulti is true and user has removed a single item
|
|
67
|
+
for (let i in target) {
|
|
68
|
+
let t = target[i];
|
|
69
|
+
items.push(source.find((item) => item[itemId] === t));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
isLoaded = true;
|
|
73
|
+
if (items.length > 0) {
|
|
74
|
+
value = items;
|
|
75
|
+
}
|
|
76
|
+
//console.log(value);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (isComplex && isTargetComplex)
|
|
80
|
+
{
|
|
81
|
+
value = target
|
|
82
|
+
isLoaded = true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//b) simple liust and simple model
|
|
86
|
+
if (!isComplex && !isTargetComplex) {
|
|
87
|
+
//console.log("source", source);
|
|
88
|
+
//console.log("target",target);
|
|
89
|
+
isLoaded = true;
|
|
90
|
+
//set target only if its nit empty
|
|
91
|
+
if (target != null && target !== undefined && target != '') {
|
|
92
|
+
value = target;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<InputContainer label={title} {feedback} {required}>
|
|
99
|
+
<Select
|
|
100
|
+
class="select variant-form-material"
|
|
101
|
+
items={source}
|
|
102
|
+
{itemId}
|
|
103
|
+
{label}
|
|
104
|
+
multiple={isMulti}
|
|
105
|
+
bind:value
|
|
106
|
+
placeholder="-- Please select --"
|
|
107
|
+
/>
|
|
108
|
+
</InputContainer>
|
|
@@ -8,10 +8,10 @@ export default class MultiSelect extends SvelteComponentTyped<{
|
|
|
8
8
|
required?: boolean | undefined;
|
|
9
9
|
label?: string | undefined;
|
|
10
10
|
feedback?: any[] | undefined;
|
|
11
|
-
itemId?: string | undefined;
|
|
12
|
-
isMulti?: boolean | undefined;
|
|
13
11
|
isComplex?: boolean | undefined;
|
|
14
12
|
isTargetComplex?: boolean | undefined;
|
|
13
|
+
itemId?: string | undefined;
|
|
14
|
+
isMulti?: boolean | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
[evt: string]: CustomEvent<any>;
|
|
17
17
|
}, {}> {
|
|
@@ -28,10 +28,10 @@ declare const __propDef: {
|
|
|
28
28
|
required?: boolean | undefined;
|
|
29
29
|
label?: string | undefined;
|
|
30
30
|
feedback?: any[] | undefined;
|
|
31
|
-
itemId?: string | undefined;
|
|
32
|
-
isMulti?: boolean | undefined;
|
|
33
31
|
isComplex?: boolean | undefined;
|
|
34
32
|
isTargetComplex?: boolean | undefined;
|
|
33
|
+
itemId?: string | undefined;
|
|
34
|
+
isMulti?: boolean | undefined;
|
|
35
35
|
};
|
|
36
36
|
events: {
|
|
37
37
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import Menu from "./menu/Menu.svelte";
|
|
2
|
+
export let title = "";
|
|
2
3
|
export let note = "";
|
|
3
4
|
export let links = [];
|
|
5
|
+
export let menu = true;
|
|
6
|
+
export let footer = true;
|
|
4
7
|
</script>
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
{#if menu}
|
|
10
|
+
<Menu/>
|
|
11
|
+
{/if}
|
|
12
|
+
|
|
13
|
+
<div class="px-5 grid gap-5 content-center" >
|
|
7
14
|
<h1 class="h1">{title}</h1>
|
|
8
15
|
{#if note}
|
|
9
16
|
<blockquote class="blockquote">{note}</blockquote>
|
|
@@ -20,4 +27,8 @@ export let links = [];
|
|
|
20
27
|
{/if}
|
|
21
28
|
<slot/>
|
|
22
29
|
</div>
|
|
30
|
+
|
|
31
|
+
{#if menu}
|
|
32
|
+
<!-- footer -->
|
|
33
|
+
{/if}
|
|
23
34
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script>import Fa from "svelte-fa/src/fa.svelte";
|
|
2
|
+
import { faCog } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
+
import { onMount } from "svelte";
|
|
4
|
+
import { setApiConfig } from "../../../stores/apistore";
|
|
5
|
+
import { getMenuItems } from "./MenuDataCaller";
|
|
6
|
+
import MenuBar from "./MenuBar.svelte";
|
|
7
|
+
import SettingsBar from "./SettingsBar.svelte";
|
|
8
|
+
let menu;
|
|
9
|
+
onMount(async () => {
|
|
10
|
+
setApiConfig("https://localhost:44345", "david", "123456");
|
|
11
|
+
menu = await getMenuItems();
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
{#if menu}
|
|
16
|
+
|
|
17
|
+
<div class="flex flex-row md:flex px-3 py-2">
|
|
18
|
+
<div class="basis-2/3">
|
|
19
|
+
{#if menu.Logo}
|
|
20
|
+
<img src='data:{menu.Logo.Mime};charset=utf-8;base64, {menu.Logo.Data}' alt='{menu.Logo.Name}' style='height:40px;' />
|
|
21
|
+
{/if}
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="flex-auto w-64 flex items-center md:space-x-3 justify-end">
|
|
25
|
+
|
|
26
|
+
<MenuBar menuBar={menu.AccountBar} />
|
|
27
|
+
<MenuBar menuBar={menu.LaunchBar} />
|
|
28
|
+
<SettingsBar menuBar={menu.Settings} />
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
<div class="flex items-center md:space-x-5 px-3 text-lg">
|
|
33
|
+
<MenuBar menuBar={menu.MenuBar} />
|
|
34
|
+
<MenuBar menuBar={menu.Extended} />
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type MenuProps = typeof __propDef.props;
|
|
10
|
+
export type MenuEvents = typeof __propDef.events;
|
|
11
|
+
export type MenuSlots = typeof __propDef.slots;
|
|
12
|
+
export default class Menu extends SvelteComponentTyped<MenuProps, MenuEvents, MenuSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
<script>import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floating-ui/dom";
|
|
3
|
+
import { storePopup } from "@skeletonlabs/skeleton";
|
|
4
|
+
storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
|
|
5
|
+
import Item from "./MenuItem.svelte";
|
|
6
|
+
export let menuBar;
|
|
7
|
+
let comboboxValue;
|
|
8
|
+
let radomNumber = Math.floor(Math.random() * 100);
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
{#if menuBar}
|
|
13
|
+
{#each menuBar as menubarItem}
|
|
14
|
+
|
|
15
|
+
<Item {menubarItem}{comboboxValue}/>
|
|
16
|
+
|
|
17
|
+
{/each}
|
|
18
|
+
{/if}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { MenuItem } from "../../models/menu";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
menuBar: MenuItem[];
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type MenuBarProps = typeof __propDef.props;
|
|
13
|
+
export type MenuBarEvents = typeof __propDef.events;
|
|
14
|
+
export type MenuBarSlots = typeof __propDef.slots;
|
|
15
|
+
export default class MenuBar extends SvelteComponentTyped<MenuBarProps, MenuBarEvents, MenuBarSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getMenuItems(): Promise<any>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script>import { popup } from "@skeletonlabs/skeleton";
|
|
2
|
+
import { ListBox, ListBoxItem } from "@skeletonlabs/skeleton";
|
|
3
|
+
export let menubarItem;
|
|
4
|
+
export let comboboxValue;
|
|
5
|
+
let radomNumber = Math.floor(Math.random() * 100).toString();
|
|
6
|
+
let popupCombobox = {
|
|
7
|
+
event: "click",
|
|
8
|
+
target: radomNumber,
|
|
9
|
+
placement: "bottom",
|
|
10
|
+
// Close the popup when the item is clicked
|
|
11
|
+
closeQuery: ".listbox-item"
|
|
12
|
+
};
|
|
13
|
+
</script>
|
|
14
|
+
{#if menubarItem.Items.length<1}
|
|
15
|
+
|
|
16
|
+
<button class="flex items-center gap-x-1 text-xl font-semibold leading-6 text-gray-500" use:popup={popupCombobox}>
|
|
17
|
+
<span class="capitalize">{comboboxValue ?? menubarItem.Title}</span>
|
|
18
|
+
|
|
19
|
+
</button>
|
|
20
|
+
|
|
21
|
+
{:else}
|
|
22
|
+
<button class="flex items-center gap-x-1 text-xl font-semibold leading-6 text-gray-00" use:popup={popupCombobox}>
|
|
23
|
+
<span class="capitalize">{menubarItem.Title}</span>
|
|
24
|
+
<div class="before:content-['▾']"></div>
|
|
25
|
+
</button>
|
|
26
|
+
<div class="card w-48 shadow-xl py-2" data-popup={radomNumber}>
|
|
27
|
+
|
|
28
|
+
<ListBox rounded="rounded-none">
|
|
29
|
+
{#each menubarItem.Items as item}
|
|
30
|
+
|
|
31
|
+
<ListBoxItem class="bg-white text-gray-900 py-1 text-sm" bind:group={menubarItem.Title} name="medium" value={item.Title}>{item.Title}</ListBoxItem>
|
|
32
|
+
{/each}
|
|
33
|
+
</ListBox>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
menubarItem: any;
|
|
5
|
+
comboboxValue: any;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type MenuItemProps = typeof __propDef.props;
|
|
13
|
+
export type MenuItemEvents = typeof __propDef.events;
|
|
14
|
+
export type MenuItemSlots = typeof __propDef.slots;
|
|
15
|
+
export default class MenuItem extends SvelteComponentTyped<MenuItemProps, MenuItemEvents, MenuItemSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script>import { popup } from "@skeletonlabs/skeleton";
|
|
2
|
+
import { ListBox, ListBoxItem } from "@skeletonlabs/skeleton";
|
|
3
|
+
import Fa from "svelte-fa/src/fa.svelte";
|
|
4
|
+
import { faCog } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
+
export let menuBar;
|
|
6
|
+
let lastModule = "";
|
|
7
|
+
let first = true;
|
|
8
|
+
function isNewModule(module) {
|
|
9
|
+
if (module === lastModule) {
|
|
10
|
+
return false;
|
|
11
|
+
} else {
|
|
12
|
+
lastModule = module;
|
|
13
|
+
if (first) {
|
|
14
|
+
first = false;
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
let popupCombobox = {
|
|
21
|
+
event: "click",
|
|
22
|
+
target: "popupCombobox",
|
|
23
|
+
placement: "bottom",
|
|
24
|
+
// Close the popup when the item is clicked
|
|
25
|
+
closeQuery: ".listbox-item"
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#if menuBar}
|
|
30
|
+
<button class="flex items-center gap-x-1 text-sm font-semibold leading-6 text-gray-900" use:popup={popupCombobox}>
|
|
31
|
+
<span class="capitalize"><Fa icon={faCog} /></span>
|
|
32
|
+
|
|
33
|
+
</button>
|
|
34
|
+
<div class="card w-48 shadow-xl py-2" data-popup="popupCombobox">
|
|
35
|
+
<ListBox rounded="rounded-none bg-white">
|
|
36
|
+
{#each menuBar as menubarItem}
|
|
37
|
+
{#if isNewModule(menubarItem.Module) }<hr class="bg-gray-900">{/if}
|
|
38
|
+
<ListBoxItem class="bg-white text-gray-900 py-1" bind:group={menubarItem.Title} name="medium" value={menubarItem.Title}>{menubarItem.Title}</ListBoxItem>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
{/each}
|
|
43
|
+
</ListBox>
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { MenuItem } from "../../models/menu";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
menuBar: MenuItem[];
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type SettingsBarProps = typeof __propDef.props;
|
|
13
|
+
export type SettingsBarEvents = typeof __propDef.events;
|
|
14
|
+
export type SettingsBarSlots = typeof __propDef.slots;
|
|
15
|
+
export default class SettingsBar extends SvelteComponentTyped<SettingsBarProps, SettingsBarEvents, SettingsBarSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface Menu {
|
|
2
|
+
Logo: Logo;
|
|
3
|
+
LaunchBar: MenuItem[];
|
|
4
|
+
MenuBar: MenuItem[];
|
|
5
|
+
AccountBar: MenuItem[];
|
|
6
|
+
Settings: MenuItem[];
|
|
7
|
+
Extended: MenuItem[];
|
|
8
|
+
}
|
|
9
|
+
export interface MenuItem {
|
|
10
|
+
Title: string;
|
|
11
|
+
Url: string;
|
|
12
|
+
Target: string;
|
|
13
|
+
Module: string;
|
|
14
|
+
Items: MenuItem[];
|
|
15
|
+
}
|
|
16
|
+
export interface Logo {
|
|
17
|
+
Mime: string;
|
|
18
|
+
Name: string;
|
|
19
|
+
Data: string;
|
|
20
|
+
Height: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import TableView from './TableView.svelte';
|
|
|
3
3
|
import FileIcon from './components/file/FileIcon.svelte';
|
|
4
4
|
import FileInfo from './components/file/FileInfo.svelte';
|
|
5
5
|
import FileUploader from './components/file/FileUploader.svelte';
|
|
6
|
-
import Spinner from './components/
|
|
6
|
+
import Spinner from './components/page/Spinner.svelte';
|
|
7
7
|
import Page from './components/page/Page.svelte';
|
|
8
8
|
import Alert from './components/page/Alert.svelte';
|
|
9
9
|
import Checkbox from './components/form/Checkbox.svelte';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import FileIcon from './components/file/FileIcon.svelte';
|
|
|
5
5
|
import FileInfo from './components/file/FileInfo.svelte';
|
|
6
6
|
import FileUploader from './components/file/FileUploader.svelte';
|
|
7
7
|
//page
|
|
8
|
-
import Spinner from './components/
|
|
8
|
+
import Spinner from './components/page/Spinner.svelte';
|
|
9
9
|
import Page from './components/page/Page.svelte';
|
|
10
10
|
import Alert from './components/page/Alert.svelte';
|
|
11
11
|
// input
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import DropZone from 'svelte-file-dropzone/Dropzone.svelte';
|
|
5
5
|
import Fa from 'svelte-fa/src/fa.svelte';
|
|
6
6
|
|
|
7
|
-
import Spinner from '../
|
|
7
|
+
import Spinner from '../page/Spinner.svelte';
|
|
8
8
|
import { createEventDispatcher } from 'svelte';
|
|
9
9
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
10
10
|
import { faSave } from '@fortawesome/free-regular-svg-icons';
|
|
@@ -1,91 +1,108 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import InputContainer from './InputContainer.svelte';
|
|
3
|
-
|
|
4
|
-
import Select from 'svelte-select';
|
|
5
|
-
import { onMount } from 'svelte';
|
|
6
|
-
|
|
7
|
-
export let source;
|
|
8
|
-
export let target;
|
|
9
|
-
export let title;
|
|
10
|
-
export let itemId = 'value';
|
|
11
|
-
export let label = 'label';
|
|
12
|
-
export let isMulti = true;
|
|
13
|
-
export let isComplex = false;
|
|
14
|
-
export let isTargetComplex = false;
|
|
15
|
-
export let required = false;
|
|
16
|
-
export let feedback = [];
|
|
17
|
-
|
|
18
|
-
let isLoaded = false;
|
|
19
|
-
|
|
20
|
-
$: value = null;
|
|
21
|
-
$: updateTarget(value);
|
|
22
|
-
|
|
23
|
-
function updateTarget(selection) {
|
|
24
|
-
//diffrent cases
|
|
25
|
-
console.log('------');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
isLoaded = true;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
1
|
+
<script>
|
|
2
|
+
import InputContainer from './InputContainer.svelte';
|
|
3
|
+
|
|
4
|
+
import Select from 'svelte-select';
|
|
5
|
+
import { onMount } from 'svelte';
|
|
6
|
+
|
|
7
|
+
export let source;
|
|
8
|
+
export let target;
|
|
9
|
+
export let title;
|
|
10
|
+
export let itemId = 'value';
|
|
11
|
+
export let label = 'label';
|
|
12
|
+
export let isMulti = true;
|
|
13
|
+
export let isComplex = false;
|
|
14
|
+
export let isTargetComplex = false;
|
|
15
|
+
export let required = false;
|
|
16
|
+
export let feedback = [];
|
|
17
|
+
|
|
18
|
+
let isLoaded = false;
|
|
19
|
+
|
|
20
|
+
$: value = null;
|
|
21
|
+
$: updateTarget(value);
|
|
22
|
+
|
|
23
|
+
function updateTarget(selection) {
|
|
24
|
+
//diffrent cases
|
|
25
|
+
console.log('------');
|
|
26
|
+
console.log('isComplex',isComplex);
|
|
27
|
+
console.log('isTargetComplex',isTargetComplex);
|
|
28
|
+
console.log('selection',selection);
|
|
29
|
+
|
|
30
|
+
//a) source is complex model is simple
|
|
31
|
+
if (isComplex && !isTargetComplex && isLoaded) {
|
|
32
|
+
console.log('a) source is complex model is simple');
|
|
33
|
+
|
|
34
|
+
target = [];
|
|
35
|
+
for (let i in selection) {
|
|
36
|
+
let item = selection[i];
|
|
37
|
+
target.push(item[itemId]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!isComplex && !isTargetComplex && isLoaded) {
|
|
42
|
+
target = [];
|
|
43
|
+
for (let i in selection) {
|
|
44
|
+
target.push(selection[i].value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isComplex && isTargetComplex && isLoaded)
|
|
49
|
+
{
|
|
50
|
+
console.log("both complex",selection);
|
|
51
|
+
target = selection;
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// console.log('selection ' + title, selection);
|
|
56
|
+
// console.log('target ' + title, target);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
onMount(async () => {
|
|
60
|
+
//console.log("on mount multiselect");
|
|
61
|
+
//console.log(source);
|
|
62
|
+
|
|
63
|
+
//a) source is complex model is simple
|
|
64
|
+
if (isComplex && !isTargetComplex) {
|
|
65
|
+
let items = [];
|
|
66
|
+
// event.detail will be null unless isMulti is true and user has removed a single item
|
|
67
|
+
for (let i in target) {
|
|
68
|
+
let t = target[i];
|
|
69
|
+
items.push(source.find((item) => item[itemId] === t));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
isLoaded = true;
|
|
73
|
+
if (items.length > 0) {
|
|
74
|
+
value = items;
|
|
75
|
+
}
|
|
76
|
+
//console.log(value);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (isComplex && isTargetComplex)
|
|
80
|
+
{
|
|
81
|
+
value = target
|
|
82
|
+
isLoaded = true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//b) simple liust and simple model
|
|
86
|
+
if (!isComplex && !isTargetComplex) {
|
|
87
|
+
//console.log("source", source);
|
|
88
|
+
//console.log("target",target);
|
|
89
|
+
isLoaded = true;
|
|
90
|
+
//set target only if its nit empty
|
|
91
|
+
if (target != null && target !== undefined && target != '') {
|
|
92
|
+
value = target;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<InputContainer label={title} {feedback} {required}>
|
|
99
|
+
<Select
|
|
100
|
+
class="select variant-form-material"
|
|
101
|
+
items={source}
|
|
102
|
+
{itemId}
|
|
103
|
+
{label}
|
|
104
|
+
multiple={isMulti}
|
|
105
|
+
bind:value
|
|
106
|
+
placeholder="-- Please select --"
|
|
107
|
+
/>
|
|
108
|
+
</InputContainer>
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
|
|
3
3
|
import type { Link } from "$lib/models/Models";
|
|
4
|
+
|
|
5
|
+
import Menu from './menu/Menu.svelte'
|
|
4
6
|
|
|
5
7
|
export let title = "";
|
|
6
8
|
export let note = "";
|
|
7
9
|
export let links:Link[]=[];
|
|
10
|
+
|
|
11
|
+
// active or hide menu
|
|
12
|
+
export let menu:boolean = true;
|
|
13
|
+
export let footer:boolean = true;
|
|
8
14
|
|
|
9
15
|
</script>
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
{#if menu}
|
|
18
|
+
<Menu/>
|
|
19
|
+
{/if}
|
|
20
|
+
|
|
21
|
+
<div class="px-5 grid gap-5 content-center" >
|
|
12
22
|
<h1 class="h1">{title}</h1>
|
|
13
23
|
{#if note}
|
|
14
24
|
<blockquote class="blockquote">{note}</blockquote>
|
|
@@ -25,4 +35,8 @@
|
|
|
25
35
|
{/if}
|
|
26
36
|
<slot/>
|
|
27
37
|
</div>
|
|
38
|
+
|
|
39
|
+
{#if menu}
|
|
40
|
+
<!-- footer -->
|
|
41
|
+
{/if}
|
|
28
42
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
//
|
|
3
|
+
import Fa from 'svelte-fa/src/fa.svelte'
|
|
4
|
+
import { faCog } from '@fortawesome/free-solid-svg-icons'
|
|
5
|
+
|
|
6
|
+
import { onMount } from 'svelte';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
import { setApiConfig } from '../../../stores/apistore';
|
|
10
|
+
import { getMenuItems} from './MenuDataCaller';
|
|
11
|
+
|
|
12
|
+
import type { Menu } from "./menu";
|
|
13
|
+
|
|
14
|
+
import MenuBar from './MenuBar.svelte';
|
|
15
|
+
import SettingsBar from './SettingsBar.svelte';
|
|
16
|
+
|
|
17
|
+
let menu:Menu;
|
|
18
|
+
|
|
19
|
+
onMount(async () => {
|
|
20
|
+
|
|
21
|
+
setApiConfig("https://localhost:44345","david","123456");
|
|
22
|
+
|
|
23
|
+
menu = await getMenuItems();
|
|
24
|
+
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
{#if menu}
|
|
33
|
+
|
|
34
|
+
<div class="flex flex-row md:flex px-3 py-2">
|
|
35
|
+
<div class="basis-2/3">
|
|
36
|
+
{#if menu.Logo}
|
|
37
|
+
<img src='data:{menu.Logo.Mime};charset=utf-8;base64, {menu.Logo.Data}' alt='{menu.Logo.Name}' style='height:40px;' />
|
|
38
|
+
{/if}
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="flex-auto w-64 flex items-center md:space-x-3 justify-end">
|
|
42
|
+
|
|
43
|
+
<MenuBar menuBar={menu.AccountBar} />
|
|
44
|
+
<MenuBar menuBar={menu.LaunchBar} />
|
|
45
|
+
<SettingsBar menuBar={menu.Settings} />
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
</div>
|
|
49
|
+
<div class="flex items-center md:space-x-5 px-3 text-lg">
|
|
50
|
+
<MenuBar menuBar={menu.MenuBar} />
|
|
51
|
+
<MenuBar menuBar={menu.Extended} />
|
|
52
|
+
</div>
|
|
53
|
+
{/if}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
|
|
4
|
+
import { computePosition, autoUpdate, offset, shift, flip, arrow } from '@floating-ui/dom';
|
|
5
|
+
import { storePopup } from '@skeletonlabs/skeleton';
|
|
6
|
+
storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
|
|
7
|
+
|
|
8
|
+
import type { MenuItem } from "../../models/menu";
|
|
9
|
+
import Item from "./MenuItem.svelte";
|
|
10
|
+
|
|
11
|
+
export let menuBar:MenuItem [];
|
|
12
|
+
|
|
13
|
+
let comboboxValue: string;
|
|
14
|
+
|
|
15
|
+
let radomNumber = Math.floor(Math.random() * 100);
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
{#if menuBar}
|
|
22
|
+
{#each menuBar as menubarItem}
|
|
23
|
+
|
|
24
|
+
<Item {menubarItem}{comboboxValue}/>
|
|
25
|
+
|
|
26
|
+
{/each}
|
|
27
|
+
{/if}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { popup } from '@skeletonlabs/skeleton';
|
|
3
|
+
import { ListBox, ListBoxItem } from '@skeletonlabs/skeleton';
|
|
4
|
+
|
|
5
|
+
import type { PopupSettings } from '@skeletonlabs/skeleton';
|
|
6
|
+
|
|
7
|
+
export let menubarItem;
|
|
8
|
+
export let comboboxValue;
|
|
9
|
+
|
|
10
|
+
let radomNumber = Math.floor(Math.random() * 100).toString();
|
|
11
|
+
|
|
12
|
+
let popupCombobox: PopupSettings = {
|
|
13
|
+
event: 'click',
|
|
14
|
+
target: radomNumber,
|
|
15
|
+
placement: 'bottom',
|
|
16
|
+
// Close the popup when the item is clicked
|
|
17
|
+
closeQuery: '.listbox-item'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
</script>
|
|
21
|
+
{#if menubarItem.Items.length<1}
|
|
22
|
+
|
|
23
|
+
<button class="flex items-center gap-x-1 text-xl font-semibold leading-6 text-gray-500" use:popup={popupCombobox}>
|
|
24
|
+
<span class="capitalize">{comboboxValue ?? menubarItem.Title}</span>
|
|
25
|
+
|
|
26
|
+
</button>
|
|
27
|
+
|
|
28
|
+
{:else}
|
|
29
|
+
<button class="flex items-center gap-x-1 text-xl font-semibold leading-6 text-gray-00" use:popup={popupCombobox}>
|
|
30
|
+
<span class="capitalize">{menubarItem.Title}</span>
|
|
31
|
+
<div class="before:content-['▾']"></div>
|
|
32
|
+
</button>
|
|
33
|
+
<div class="card w-48 shadow-xl py-2" data-popup={radomNumber}>
|
|
34
|
+
|
|
35
|
+
<ListBox rounded="rounded-none">
|
|
36
|
+
{#each menubarItem.Items as item}
|
|
37
|
+
|
|
38
|
+
<ListBoxItem class="bg-white text-gray-900 py-1 text-sm" bind:group={menubarItem.Title} name="medium" value={item.Title}>{item.Title}</ListBoxItem>
|
|
39
|
+
{/each}
|
|
40
|
+
</ListBox>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
{/if}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { popup } from '@skeletonlabs/skeleton';
|
|
3
|
+
import { ListBox, ListBoxItem } from '@skeletonlabs/skeleton';
|
|
4
|
+
|
|
5
|
+
import type { PopupSettings } from '@skeletonlabs/skeleton';
|
|
6
|
+
import type { MenuItem } from "../../models/menu";
|
|
7
|
+
import Fa from 'svelte-fa/src/fa.svelte'
|
|
8
|
+
import { faCog } from '@fortawesome/free-solid-svg-icons'
|
|
9
|
+
|
|
10
|
+
export let menuBar:MenuItem [];
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
let lastModule = "";
|
|
14
|
+
let first = true;
|
|
15
|
+
|
|
16
|
+
function isNewModule(module)
|
|
17
|
+
{
|
|
18
|
+
if(module === lastModule ){
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
else
|
|
22
|
+
{
|
|
23
|
+
lastModule = module;
|
|
24
|
+
if(first)
|
|
25
|
+
{
|
|
26
|
+
first = false;
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let popupCombobox: PopupSettings = {
|
|
35
|
+
event: 'click',
|
|
36
|
+
target: 'popupCombobox',
|
|
37
|
+
placement: 'bottom',
|
|
38
|
+
// Close the popup when the item is clicked
|
|
39
|
+
closeQuery: '.listbox-item'
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
{#if menuBar}
|
|
45
|
+
<button class="flex items-center gap-x-1 text-sm font-semibold leading-6 text-gray-900" use:popup={popupCombobox}>
|
|
46
|
+
<span class="capitalize"><Fa icon={faCog} /></span>
|
|
47
|
+
|
|
48
|
+
</button>
|
|
49
|
+
<div class="card w-48 shadow-xl py-2" data-popup="popupCombobox">
|
|
50
|
+
<ListBox rounded="rounded-none bg-white">
|
|
51
|
+
{#each menuBar as menubarItem}
|
|
52
|
+
{#if isNewModule(menubarItem.Module) }<hr class="bg-gray-900">{/if}
|
|
53
|
+
<ListBoxItem class="bg-white text-gray-900 py-1" bind:group={menubarItem.Title} name="medium" value={menubarItem.Title}>{menubarItem.Title}</ListBoxItem>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
{/each}
|
|
58
|
+
</ListBox>
|
|
59
|
+
</div>
|
|
60
|
+
{/if}
|
|
61
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface Menu {
|
|
2
|
+
Logo: Logo;
|
|
3
|
+
LaunchBar: MenuItem[];
|
|
4
|
+
MenuBar: MenuItem[];
|
|
5
|
+
AccountBar: MenuItem[];
|
|
6
|
+
Settings: MenuItem[];
|
|
7
|
+
Extended: MenuItem[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface MenuItem {
|
|
11
|
+
Title: string;
|
|
12
|
+
Url: string;
|
|
13
|
+
Target: string;
|
|
14
|
+
Module: string;
|
|
15
|
+
Items: MenuItem[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Logo {
|
|
19
|
+
Mime: string;
|
|
20
|
+
Name: string;
|
|
21
|
+
Data: string;
|
|
22
|
+
Height: number;
|
|
23
|
+
}
|
package/src/lib/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import FileInfo from './components/file/FileInfo.svelte';
|
|
|
7
7
|
import FileUploader from './components/file/FileUploader.svelte';
|
|
8
8
|
|
|
9
9
|
//page
|
|
10
|
-
import Spinner from './components/
|
|
10
|
+
import Spinner from './components/page/Spinner.svelte';
|
|
11
11
|
import Page from './components/page/Page.svelte';
|
|
12
12
|
import Alert from './components/page/Alert.svelte';
|
|
13
13
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|