@enki-tek/fms-web-components 0.0.37 → 0.0.39
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/Button/Button.svelte.d.ts +2 -2
- package/components/Button/ButtonFilter.svelte.d.ts +2 -2
- package/components/Card/Card.svelte.d.ts +2 -2
- package/components/CheckBox/Checkbox.svelte.d.ts +2 -2
- package/components/EnkiSidbar/EnkiSidebar.svelte +700 -0
- package/components/EnkiSidbar/EnkiSidebar.svelte.d.ts +33 -0
- package/components/EnkiSidbar/NavIcon.svelte +647 -0
- package/components/EnkiSidbar/NavIcon.svelte.d.ts +31 -0
- package/components/EnkiSidbar/NavItem.svelte +649 -0
- package/components/EnkiSidbar/NavItem.svelte.d.ts +27 -0
- package/components/EnkiSidbar/NavLink.svelte +657 -0
- package/components/EnkiSidbar/NavLink.svelte.d.ts +31 -0
- package/components/EnkiSidbar/Sidebar.scss +128 -0
- package/components/EnkiTable/EnkiTable.svelte.d.ts +2 -2
- package/components/RadioButton/RadioButton.svelte +8 -3
- package/components/RadioButton/RadioButton.svelte.d.ts +10 -0
- package/components/Switches/Switch.svelte.d.ts +2 -2
- package/components/i18n/ShiftLanguage.svelte +34 -0
- package/components/i18n/ShiftLanguage.svelte.d.ts +23 -0
- package/components/i18n/i18n.d.ts +1 -0
- package/components/i18n/i18n.js +47 -0
- package/components/lay-out/Footer.svelte +17 -2
- package/components/lay-out/Footer.svelte.d.ts +6 -2
- package/components/lay-out/LayOut.svelte +36 -6
- package/components/lay-out/LayOut.svelte.d.ts +23 -6
- package/components/lay-out/MainMenuHead.svelte +15 -0
- package/components/lay-out/MainMenuHead.svelte.d.ts +27 -0
- package/components/lay-out/Page.svelte +31 -0
- package/components/lay-out/Page.svelte.d.ts +27 -0
- package/components/lay-out/menuStore.d.ts +15 -0
- package/components/lay-out/menuStore.js +90 -0
- package/components/textField/TextField.svelte.d.ts +2 -2
- package/index.d.ts +13 -2
- package/index.js +13 -2
- package/package.json +11 -1
@@ -0,0 +1,128 @@
|
|
1
|
+
// Importing variables from variable.scss file
|
2
|
+
@import './../variable.scss';
|
3
|
+
|
4
|
+
%common-styles {
|
5
|
+
color: $white;
|
6
|
+
}
|
7
|
+
|
8
|
+
%commom-background-line {
|
9
|
+
background: $white;
|
10
|
+
}
|
11
|
+
|
12
|
+
%sidebar-styles {
|
13
|
+
background: $primary-dark;
|
14
|
+
}
|
15
|
+
|
16
|
+
%active-styles {
|
17
|
+
border-left: 2px solid $white;
|
18
|
+
background: $blue-700;
|
19
|
+
}
|
20
|
+
|
21
|
+
%common-li-styles {
|
22
|
+
display: flex;
|
23
|
+
padding: 15px 32px;
|
24
|
+
align-items: center;
|
25
|
+
gap: 8px;
|
26
|
+
}
|
27
|
+
|
28
|
+
.row {
|
29
|
+
--bs-gutter-x: 0rem;
|
30
|
+
}
|
31
|
+
|
32
|
+
.icon-sidebar {
|
33
|
+
position: fixed;
|
34
|
+
top: 0;
|
35
|
+
left: 0;
|
36
|
+
height: 100%;
|
37
|
+
width: 88px;
|
38
|
+
background: $primary-dark;
|
39
|
+
}
|
40
|
+
|
41
|
+
.line {
|
42
|
+
width: 88px;
|
43
|
+
height: 1px;
|
44
|
+
@extend %commom-background-line;
|
45
|
+
}
|
46
|
+
|
47
|
+
.icon-btn {
|
48
|
+
padding: 20px 27px;
|
49
|
+
}
|
50
|
+
|
51
|
+
.icon-sidebar-content .toggle-button {
|
52
|
+
@extend %common-styles;
|
53
|
+
}
|
54
|
+
|
55
|
+
.icons {
|
56
|
+
@extend %common-styles;
|
57
|
+
@extend %common-li-styles;
|
58
|
+
padding: 16px 32px;
|
59
|
+
flex-direction: column;
|
60
|
+
gap: 37px;
|
61
|
+
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
.icon-sidebar-content ul .active {
|
66
|
+
@extend %active-styles;
|
67
|
+
}
|
68
|
+
|
69
|
+
//sidbar open class
|
70
|
+
|
71
|
+
:global(.offcanvas-body) {
|
72
|
+
@extend %sidebar-styles;
|
73
|
+
padding: 0rem 0rem;
|
74
|
+
}
|
75
|
+
|
76
|
+
.offcanvas-title {
|
77
|
+
color: $white;
|
78
|
+
font-size: 28px;
|
79
|
+
}
|
80
|
+
|
81
|
+
:global(.flex-column) {
|
82
|
+
@extend %common-styles;
|
83
|
+
}
|
84
|
+
|
85
|
+
.sidebar-open-ul {
|
86
|
+
@extend %common-styles;
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
.nav-item {
|
91
|
+
@extend %common-li-styles;
|
92
|
+
@extend %common-styles;
|
93
|
+
padding: 18px 32px;
|
94
|
+
}
|
95
|
+
|
96
|
+
.nav-item .item-name {
|
97
|
+
line-height: 22px;
|
98
|
+
}
|
99
|
+
|
100
|
+
.nav .nav-item.active {
|
101
|
+
@extend %active-styles;
|
102
|
+
}
|
103
|
+
|
104
|
+
.toggle-button {
|
105
|
+
background-color: transparent;
|
106
|
+
border: $white;
|
107
|
+
cursor: pointer;
|
108
|
+
}
|
109
|
+
|
110
|
+
.material-icons {
|
111
|
+
font-size: 16px;
|
112
|
+
color: $white;
|
113
|
+
}
|
114
|
+
|
115
|
+
:global(.offcanvas.offcanvas-start) {
|
116
|
+
width: 274px;
|
117
|
+
border-right: none;
|
118
|
+
}
|
119
|
+
|
120
|
+
.offcanvas-header {
|
121
|
+
padding: 1.5rem 1.5rem;
|
122
|
+
}
|
123
|
+
|
124
|
+
.line-open {
|
125
|
+
width: 274px;
|
126
|
+
height: 1px;
|
127
|
+
@extend %commom-background-line;
|
128
|
+
}
|
@@ -2,8 +2,8 @@
|
|
2
2
|
/** @typedef {typeof __propDef.events} EnkiTableEvents */
|
3
3
|
/** @typedef {typeof __propDef.slots} EnkiTableSlots */
|
4
4
|
export default class EnkiTable extends SvelteComponentTyped<{
|
5
|
-
type?: string | undefined;
|
6
5
|
size?: string | undefined;
|
6
|
+
type?: string | undefined;
|
7
7
|
className?: string | undefined;
|
8
8
|
}, {
|
9
9
|
[evt: string]: CustomEvent<any>;
|
@@ -17,8 +17,8 @@ export type EnkiTableSlots = typeof __propDef.slots;
|
|
17
17
|
import { SvelteComponentTyped } from "svelte";
|
18
18
|
declare const __propDef: {
|
19
19
|
props: {
|
20
|
-
type?: string | undefined;
|
21
20
|
size?: string | undefined;
|
21
|
+
type?: string | undefined;
|
22
22
|
className?: string | undefined;
|
23
23
|
};
|
24
24
|
events: {
|
@@ -7,10 +7,14 @@
|
|
7
7
|
{ value:2, label:'orange'},
|
8
8
|
{ value:3, label:'pinapple',disabled:true}
|
9
9
|
]
|
10
|
-
let
|
10
|
+
export let value ;
|
11
|
+
export let label ;
|
12
|
+
export let disabled ;
|
13
|
+
export let selected = options[0].value;
|
14
|
+
export let name = '';
|
11
15
|
</script>
|
12
16
|
|
13
|
-
{#each options as { value, label, disabled }}
|
17
|
+
<!-- {#each options as { value, label, disabled }} -->
|
14
18
|
<Input
|
15
19
|
type="radio"
|
16
20
|
class={`custom-radio form-check-inline form-control-${size}`}
|
@@ -18,8 +22,9 @@
|
|
18
22
|
bind:group={selected}
|
19
23
|
disabled={disabled}
|
20
24
|
label={label.charAt(0).toUpperCase() + label.slice(1)}
|
25
|
+
name = {name}
|
21
26
|
/>
|
22
|
-
{/each}
|
27
|
+
<!-- {/each} -->
|
23
28
|
|
24
29
|
<style>@import url(https://fonts.googleapis.com/icon?family=Material+Icons);
|
25
30
|
@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");
|
@@ -2,7 +2,11 @@
|
|
2
2
|
/** @typedef {typeof __propDef.events} RadioButtonEvents */
|
3
3
|
/** @typedef {typeof __propDef.slots} RadioButtonSlots */
|
4
4
|
export default class RadioButton extends SvelteComponentTyped<{
|
5
|
+
disabled: any;
|
6
|
+
label: any;
|
7
|
+
value: any;
|
5
8
|
size?: string | undefined;
|
9
|
+
name?: string | undefined;
|
6
10
|
options?: ({
|
7
11
|
value: number;
|
8
12
|
label: string;
|
@@ -12,6 +16,7 @@ export default class RadioButton extends SvelteComponentTyped<{
|
|
12
16
|
label: string;
|
13
17
|
disabled: boolean;
|
14
18
|
})[] | undefined;
|
19
|
+
selected?: number | undefined;
|
15
20
|
}, {
|
16
21
|
[evt: string]: CustomEvent<any>;
|
17
22
|
}, {}> {
|
@@ -22,7 +27,11 @@ export type RadioButtonSlots = typeof __propDef.slots;
|
|
22
27
|
import { SvelteComponentTyped } from "svelte";
|
23
28
|
declare const __propDef: {
|
24
29
|
props: {
|
30
|
+
disabled: any;
|
31
|
+
label: any;
|
32
|
+
value: any;
|
25
33
|
size?: string | undefined;
|
34
|
+
name?: string | undefined;
|
26
35
|
options?: ({
|
27
36
|
value: number;
|
28
37
|
label: string;
|
@@ -32,6 +41,7 @@ declare const __propDef: {
|
|
32
41
|
label: string;
|
33
42
|
disabled: boolean;
|
34
43
|
})[] | undefined;
|
44
|
+
selected?: number | undefined;
|
35
45
|
};
|
36
46
|
events: {
|
37
47
|
[evt: string]: CustomEvent<any>;
|
@@ -4,8 +4,8 @@
|
|
4
4
|
export default class Switch extends SvelteComponentTyped<{
|
5
5
|
disable: any;
|
6
6
|
enable: any;
|
7
|
-
label?: string | undefined;
|
8
7
|
size?: string | undefined;
|
8
|
+
label?: string | undefined;
|
9
9
|
}, {
|
10
10
|
[evt: string]: CustomEvent<any>;
|
11
11
|
}, {}> {
|
@@ -18,8 +18,8 @@ declare const __propDef: {
|
|
18
18
|
props: {
|
19
19
|
disable: any;
|
20
20
|
enable: any;
|
21
|
-
label?: string | undefined;
|
22
21
|
size?: string | undefined;
|
22
|
+
label?: string | undefined;
|
23
23
|
};
|
24
24
|
events: {
|
25
25
|
[evt: string]: CustomEvent<any>;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<script>
|
2
|
+
import { locale, locales } from 'svelte-i18n';
|
3
|
+
import { Dropdown, DropdownToggle,DropdownMenu, DropdownItem } from "sveltestrap";
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @type {import('$app/environment').browser}
|
7
|
+
*/
|
8
|
+
const browser = !import.meta.env.SSR;
|
9
|
+
// import { browser } from '$app/environment';
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @type {string | null | undefined}
|
13
|
+
*/
|
14
|
+
let currLang;
|
15
|
+
if (browser) {
|
16
|
+
currLang = localStorage?.getItem("lang") || 'en';
|
17
|
+
}
|
18
|
+
|
19
|
+
|
20
|
+
function changeLang(lang='en'){
|
21
|
+
currLang = lang;
|
22
|
+
locale.set(currLang);
|
23
|
+
localStorage.setItem("lang",currLang);
|
24
|
+
}
|
25
|
+
</script>
|
26
|
+
|
27
|
+
<Dropdown class="change-lang" direction="up" size="sm">
|
28
|
+
<DropdownToggle caret >{currLang}</DropdownToggle>
|
29
|
+
<DropdownMenu>
|
30
|
+
{#each $locales as lng}
|
31
|
+
<DropdownItem on:click={() => changeLang(lng)}>{lng}</DropdownItem>
|
32
|
+
{/each}
|
33
|
+
</DropdownMenu>
|
34
|
+
</Dropdown>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/** @typedef {typeof __propDef.props} ShiftLanguageProps */
|
2
|
+
/** @typedef {typeof __propDef.events} ShiftLanguageEvents */
|
3
|
+
/** @typedef {typeof __propDef.slots} ShiftLanguageSlots */
|
4
|
+
export default class ShiftLanguage extends SvelteComponentTyped<{
|
5
|
+
[x: string]: never;
|
6
|
+
}, {
|
7
|
+
[evt: string]: CustomEvent<any>;
|
8
|
+
}, {}> {
|
9
|
+
}
|
10
|
+
export type ShiftLanguageProps = typeof __propDef.props;
|
11
|
+
export type ShiftLanguageEvents = typeof __propDef.events;
|
12
|
+
export type ShiftLanguageSlots = typeof __propDef.slots;
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
14
|
+
declare const __propDef: {
|
15
|
+
props: {
|
16
|
+
[x: string]: never;
|
17
|
+
};
|
18
|
+
events: {
|
19
|
+
[evt: string]: CustomEvent<any>;
|
20
|
+
};
|
21
|
+
slots: {};
|
22
|
+
};
|
23
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export function i18nInit(lnags?: any[]): void;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
// @ts-nocheck
|
2
|
+
|
3
|
+
import { addMessages, init } from 'svelte-i18n';
|
4
|
+
// import { browser } from '$app/environment';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @type {import('$app/environment').browser}
|
8
|
+
*/
|
9
|
+
const browser = !import.meta.env.SSR;
|
10
|
+
|
11
|
+
function i18nInit(lnags =[]){
|
12
|
+
lnags.map(lng =>{
|
13
|
+
addMessages(lng?.code, lng?.json);
|
14
|
+
});
|
15
|
+
|
16
|
+
let lang;
|
17
|
+
if(browser){
|
18
|
+
lang = localStorage.getItem("lang");
|
19
|
+
}
|
20
|
+
|
21
|
+
init({
|
22
|
+
fallbackLocale: 'en',
|
23
|
+
initialLocale: lang ?? 'en',
|
24
|
+
})
|
25
|
+
|
26
|
+
|
27
|
+
}
|
28
|
+
export {
|
29
|
+
i18nInit
|
30
|
+
}
|
31
|
+
// register('en', () => import('./en.json'));
|
32
|
+
|
33
|
+
|
34
|
+
// en, en-US and pt are not available yet
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
// dictionary.update(dict => {
|
39
|
+
// dict.en = {
|
40
|
+
// ...dict.en,
|
41
|
+
// Edit: 'asasass'
|
42
|
+
// // ...french messages
|
43
|
+
// }
|
44
|
+
// return dict
|
45
|
+
// })
|
46
|
+
|
47
|
+
|
@@ -1,6 +1,21 @@
|
|
1
|
+
<script>
|
2
|
+
import ShiftLanguage from '../i18n/ShiftLanguage.svelte';
|
3
|
+
|
4
|
+
import { _ } from 'svelte-i18n';
|
5
|
+
</script>
|
6
|
+
|
1
7
|
<footer class="main-footer p-10 d-flex flex-row align-items-center justify-content-between ">
|
2
8
|
<div class="copy-right">
|
3
|
-
All rights reserved
|
4
|
-
<i class="ml-2 text-secondary ">Version 0.0.1</i>
|
9
|
+
{$_({id: 'Common.rightReserved', default: 'All rights reserved.'})}
|
10
|
+
<i class="ml-2 text-secondary ">{$_({id: 'Common.Version', default:'Version'})} 0.0.1</i>
|
5
11
|
</div>
|
12
|
+
<div class="d-flex flex-row align-items-center justify-content-between">
|
13
|
+
<ShiftLanguage />
|
14
|
+
<slot />
|
15
|
+
</div>
|
16
|
+
|
6
17
|
</footer>
|
18
|
+
|
19
|
+
<style>
|
20
|
+
|
21
|
+
</style>
|
@@ -5,7 +5,9 @@ export default class Footer extends SvelteComponentTyped<{
|
|
5
5
|
[x: string]: never;
|
6
6
|
}, {
|
7
7
|
[evt: string]: CustomEvent<any>;
|
8
|
-
}, {
|
8
|
+
}, {
|
9
|
+
default: {};
|
10
|
+
}> {
|
9
11
|
}
|
10
12
|
export type FooterProps = typeof __propDef.props;
|
11
13
|
export type FooterEvents = typeof __propDef.events;
|
@@ -18,6 +20,8 @@ declare const __propDef: {
|
|
18
20
|
events: {
|
19
21
|
[evt: string]: CustomEvent<any>;
|
20
22
|
};
|
21
|
-
slots: {
|
23
|
+
slots: {
|
24
|
+
default: {};
|
25
|
+
};
|
22
26
|
};
|
23
27
|
export {};
|
@@ -1,13 +1,43 @@
|
|
1
|
-
<script>
|
1
|
+
<script>
|
2
|
+
import Footer from './Footer.svelte';
|
3
|
+
import { derivedStore, menuTypeStore, mediaListener } from './menuStore';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @type {import('$app/environment').browser}
|
7
|
+
*/
|
8
|
+
const browser = !import.meta.env.SSR;
|
9
|
+
|
10
|
+
|
11
|
+
if(!mediaListener?.matches){
|
12
|
+
menuTypeStore.set('show');
|
13
|
+
}
|
14
|
+
|
2
15
|
</script>
|
3
16
|
|
4
|
-
<section >
|
17
|
+
<section class={`sidebar-mini ${$derivedStore?.css?.wrapper}`} >
|
5
18
|
<div class="wrapper">
|
6
|
-
<div class="content-wrapper">
|
7
|
-
<slot />
|
19
|
+
<div class="content-wrapper">
|
20
|
+
<slot name="menu" />
|
21
|
+
{#if $$slots.content}
|
22
|
+
<div style="transition: margin-left 0.3s ease-in-out; margin-left: {$derivedStore?.isWeb && $derivedStore?.marginLeft}px">
|
23
|
+
<slot name="content" />
|
24
|
+
</div>
|
25
|
+
{:else}
|
26
|
+
<slot />
|
27
|
+
{/if}
|
8
28
|
</div>
|
9
|
-
<div>
|
10
|
-
<Footer
|
29
|
+
<div style="transition: margin-left 0.3s ease-in-out; margin-left: {$derivedStore?.isWeb && $derivedStore?.marginLeft}px">
|
30
|
+
<Footer>
|
31
|
+
{#if $$slots.footer}
|
32
|
+
<slot name="footer" />
|
33
|
+
{/if}
|
34
|
+
</Footer>
|
11
35
|
</div>
|
12
36
|
</div>
|
13
37
|
</section>
|
38
|
+
|
39
|
+
<style>
|
40
|
+
.content-wrapper {
|
41
|
+
min-height: calc(100vh - 3.4em);
|
42
|
+
}
|
43
|
+
</style>
|
@@ -1,16 +1,33 @@
|
|
1
|
+
/** @typedef {typeof __propDef.props} LayOutProps */
|
2
|
+
/** @typedef {typeof __propDef.events} LayOutEvents */
|
3
|
+
/** @typedef {typeof __propDef.slots} LayOutSlots */
|
4
|
+
export default class LayOut extends SvelteComponentTyped<{
|
5
|
+
[x: string]: never;
|
6
|
+
}, {
|
7
|
+
[evt: string]: CustomEvent<any>;
|
8
|
+
}, {
|
9
|
+
menu: {};
|
10
|
+
content: {};
|
11
|
+
default: {};
|
12
|
+
footer: {};
|
13
|
+
}> {
|
14
|
+
}
|
15
|
+
export type LayOutProps = typeof __propDef.props;
|
16
|
+
export type LayOutEvents = typeof __propDef.events;
|
17
|
+
export type LayOutSlots = typeof __propDef.slots;
|
1
18
|
import { SvelteComponentTyped } from "svelte";
|
2
19
|
declare const __propDef: {
|
3
|
-
props:
|
20
|
+
props: {
|
21
|
+
[x: string]: never;
|
22
|
+
};
|
4
23
|
events: {
|
5
24
|
[evt: string]: CustomEvent<any>;
|
6
25
|
};
|
7
26
|
slots: {
|
27
|
+
menu: {};
|
28
|
+
content: {};
|
8
29
|
default: {};
|
30
|
+
footer: {};
|
9
31
|
};
|
10
32
|
};
|
11
|
-
export type LayOutProps = typeof __propDef.props;
|
12
|
-
export type LayOutEvents = typeof __propDef.events;
|
13
|
-
export type LayOutSlots = typeof __propDef.slots;
|
14
|
-
export default class LayOut extends SvelteComponentTyped<LayOutProps, LayOutEvents, LayOutSlots> {
|
15
|
-
}
|
16
33
|
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<script>
|
2
|
+
|
3
|
+
import { Button } from "sveltestrap";
|
4
|
+
import { derivedStore, menuTypeStore } from "./menuStore";
|
5
|
+
const setState = () =>{
|
6
|
+
menuTypeStore.set('');
|
7
|
+
}
|
8
|
+
|
9
|
+
</script>
|
10
|
+
<div class="logo">
|
11
|
+
<div><slot></slot></div>
|
12
|
+
{#if !$derivedStore?.isWeb}
|
13
|
+
<div > <Button color="light" on:click={setState}>x</Button></div>
|
14
|
+
{/if}
|
15
|
+
</div>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/** @typedef {typeof __propDef.props} MainMenuHeadProps */
|
2
|
+
/** @typedef {typeof __propDef.events} MainMenuHeadEvents */
|
3
|
+
/** @typedef {typeof __propDef.slots} MainMenuHeadSlots */
|
4
|
+
export default class MainMenuHead extends SvelteComponentTyped<{
|
5
|
+
[x: string]: never;
|
6
|
+
}, {
|
7
|
+
[evt: string]: CustomEvent<any>;
|
8
|
+
}, {
|
9
|
+
default: {};
|
10
|
+
}> {
|
11
|
+
}
|
12
|
+
export type MainMenuHeadProps = typeof __propDef.props;
|
13
|
+
export type MainMenuHeadEvents = typeof __propDef.events;
|
14
|
+
export type MainMenuHeadSlots = typeof __propDef.slots;
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
16
|
+
declare const __propDef: {
|
17
|
+
props: {
|
18
|
+
[x: string]: never;
|
19
|
+
};
|
20
|
+
events: {
|
21
|
+
[evt: string]: CustomEvent<any>;
|
22
|
+
};
|
23
|
+
slots: {
|
24
|
+
default: {};
|
25
|
+
};
|
26
|
+
};
|
27
|
+
export {};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<script>
|
2
|
+
import { Col, Row, Button } from "sveltestrap";
|
3
|
+
import { menuTypeStore } from './menuStore.js';
|
4
|
+
|
5
|
+
|
6
|
+
const setState = () =>{
|
7
|
+
menuTypeStore.set($menuTypeStore ? '': 'show');
|
8
|
+
}
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<!-- <section>
|
15
|
+
<div class="container-fluid mb-2">
|
16
|
+
<Row class="border-bottom py-1">
|
17
|
+
<Col>
|
18
|
+
<header>
|
19
|
+
<div class="d-flex flex-row justify-content-start">
|
20
|
+
<a href="{"javascript:{}"}" on:click={setState }><i class="material-icons">menu</i></a>
|
21
|
+
<slot name="title" />
|
22
|
+
</div>
|
23
|
+
</header>
|
24
|
+
</Col>
|
25
|
+
<Col class="mt-1">
|
26
|
+
<slot name="actions" />
|
27
|
+
</Col>
|
28
|
+
</Row>
|
29
|
+
</div>
|
30
|
+
</section> -->
|
31
|
+
<slot name="content" />
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/** @typedef {typeof __propDef.props} PageProps */
|
2
|
+
/** @typedef {typeof __propDef.events} PageEvents */
|
3
|
+
/** @typedef {typeof __propDef.slots} PageSlots */
|
4
|
+
export default class Page extends SvelteComponentTyped<{
|
5
|
+
[x: string]: never;
|
6
|
+
}, {
|
7
|
+
[evt: string]: CustomEvent<any>;
|
8
|
+
}, {
|
9
|
+
content: {};
|
10
|
+
}> {
|
11
|
+
}
|
12
|
+
export type PageProps = typeof __propDef.props;
|
13
|
+
export type PageEvents = typeof __propDef.events;
|
14
|
+
export type PageSlots = typeof __propDef.slots;
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
16
|
+
declare const __propDef: {
|
17
|
+
props: {
|
18
|
+
[x: string]: never;
|
19
|
+
};
|
20
|
+
events: {
|
21
|
+
[evt: string]: CustomEvent<any>;
|
22
|
+
};
|
23
|
+
slots: {
|
24
|
+
content: {};
|
25
|
+
};
|
26
|
+
};
|
27
|
+
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* @type { import("svelte/store").Writable<(string | null)> }
|
3
|
+
*/
|
4
|
+
export const menuTypeStore: import("svelte/store").Writable<(string | null)>;
|
5
|
+
export const mediaListener: MediaQueryList | null;
|
6
|
+
export const smallMenuwidth: 74;
|
7
|
+
export const fullMenuwidth: 265;
|
8
|
+
export const derivedStore: import("svelte/store").Readable<{
|
9
|
+
width: number;
|
10
|
+
marginLeft: number;
|
11
|
+
isWeb: boolean;
|
12
|
+
css?: {
|
13
|
+
wrapper: string;
|
14
|
+
} | undefined;
|
15
|
+
} | null>;
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import { writable, derived } from 'svelte/store';
|
2
|
+
// import { browser } from '$app/environment';
|
3
|
+
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @type {import('$app/environment').browser}
|
7
|
+
*/
|
8
|
+
const browser = !import.meta.env.SSR;
|
9
|
+
|
10
|
+
/**
|
11
|
+
* @type {{ web: { full:{ width: number, marginLeft: number, isWeb: Boolean ,css?: { wrapper: string} }, mini:{ width: number, marginLeft: number,isWeb: Boolean, css?: { wrapper: string} } },
|
12
|
+
* mobile: { full:{ width: number, marginLeft: number, isWeb: Boolean, css?: { wrapper: string} }, mini:{ width: number, marginLeft: number, isWeb: Boolean, css?: { wrapper: string} } } } | null}
|
13
|
+
*/
|
14
|
+
const menuConfig = {
|
15
|
+
web:{
|
16
|
+
full:{
|
17
|
+
width: 300,
|
18
|
+
marginLeft: 300,
|
19
|
+
isWeb: true,
|
20
|
+
css:{
|
21
|
+
wrapper: 'web-full'
|
22
|
+
}
|
23
|
+
},
|
24
|
+
mini:{
|
25
|
+
width: 100,
|
26
|
+
marginLeft: 100,
|
27
|
+
isWeb: true,
|
28
|
+
css:{
|
29
|
+
wrapper: 'web-mini'
|
30
|
+
}
|
31
|
+
}
|
32
|
+
},
|
33
|
+
mobile:{
|
34
|
+
full:{
|
35
|
+
width: 265,
|
36
|
+
marginLeft: 265,
|
37
|
+
isWeb: false,
|
38
|
+
css:{
|
39
|
+
wrapper: 'mobile-full'
|
40
|
+
}
|
41
|
+
},
|
42
|
+
mini:{
|
43
|
+
width: 0,
|
44
|
+
marginLeft: 0,
|
45
|
+
isWeb: false,
|
46
|
+
css:{
|
47
|
+
wrapper: 'mobile-mini'
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
} ;
|
52
|
+
/**
|
53
|
+
* @type { import("svelte/store").Writable<(string | null)> }
|
54
|
+
*/
|
55
|
+
export const menuTypeStore = writable(null);
|
56
|
+
export const mediaListener = browser ? window.matchMedia("(max-width: 767px)") : null;
|
57
|
+
export const smallMenuwidth = 74;
|
58
|
+
export const fullMenuwidth = 265;
|
59
|
+
export const derivedStore = derived(
|
60
|
+
menuTypeStore,
|
61
|
+
($values) => {
|
62
|
+
let result = null;
|
63
|
+
if($values?.trim().length){
|
64
|
+
|
65
|
+
if(browser){
|
66
|
+
|
67
|
+
const mediaListener = isMobile();
|
68
|
+
|
69
|
+
if(mediaListener?.matches){
|
70
|
+
result= menuConfig['mobile']?.full;
|
71
|
+
}else{
|
72
|
+
result = menuConfig['web']?.full;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}else{
|
76
|
+
if(browser){
|
77
|
+
const mediaListener = isMobile();
|
78
|
+
if(mediaListener?.matches){
|
79
|
+
result= menuConfig['mobile']?.mini;
|
80
|
+
}else{
|
81
|
+
result = $values === null ? menuConfig['web']?.full : menuConfig['web']?.mini;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
return result;
|
86
|
+
}
|
87
|
+
);
|
88
|
+
|
89
|
+
const isMobile = () => window.matchMedia("(max-width: 767px)");
|
90
|
+
|