@luizleon/sf.prefeiturasp.vuecomponents 4.0.2 → 4.0.3
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/package.json +5 -2
- package/src/axios/axiosClient.ts +0 -207
- package/src/common/appResult.ts +0 -34
- package/src/components/button/Button.vue +0 -104
- package/src/components/content/Content.vue +0 -49
- package/src/components/drawer/Drawer.vue +0 -146
- package/src/components/icon/Icon.vue +0 -96
- package/src/components/internal/HeaderAvatar.vue +0 -73
- package/src/components/internal/LoadingCircle.vue +0 -16
- package/src/components/internal/MenuIcon.vue +0 -13
- package/src/components/internal/ScrollToTop.vue +0 -26
- package/src/components/internal/ThemeToggle.ts +0 -41
- package/src/components/internal/ThemeToggle.vue +0 -23
- package/src/components/internal/cssClassBuilder.ts +0 -44
- package/src/components/internal/getMaxZindex.ts +0 -15
- package/src/components/layout/Layout.d.ts +0 -38
- package/src/components/layout/Layout.vue +0 -58
- package/src/components/message/Message.vue +0 -65
- package/src/components/navmenu/NavMenu.vue +0 -109
- package/src/components/tabnavigation/TabNavigation.vue +0 -125
- package/src/components/tooltip/Tooltip.vue +0 -91
- package/src/index.ts +0 -53
- package/src/keycloak.d.ts +0 -671
- package/src/keycloak.js +0 -1731
- package/src/services/authService.ts +0 -118
- package/src/services/dialogService.ts +0 -109
- package/src/services/navMenuService.ts +0 -21
- package/src/style/componentes.scss +0 -20
- package/src/style/src/_functions.scss +0 -19
- package/src/style/src/_mixins.scss +0 -193
- package/src/style/src/_variables.scss +0 -12
- package/src/style/src/components/_button.scss +0 -104
- package/src/style/src/components/_content.scss +0 -57
- package/src/style/src/components/_drawer.scss +0 -89
- package/src/style/src/components/_headerAvatar.scss +0 -22
- package/src/style/src/components/_icon.scss +0 -119
- package/src/style/src/components/_layout.scss +0 -160
- package/src/style/src/components/_loading-circle.scss +0 -24
- package/src/style/src/components/_mask.scss +0 -35
- package/src/style/src/components/_message.scss +0 -47
- package/src/style/src/components/_navmenulink.scss +0 -31
- package/src/style/src/components/_scrollToTop.scss +0 -28
- package/src/style/src/components/_svg_icon.scss +0 -5
- package/src/style/src/components/_tab-navigation.scss +0 -93
- package/src/style/src/components/_themetoggle.scss +0 -52
- package/src/style/src/components/_tooltip.scss +0 -53
- package/src/style/src/sweetalert/_sweetalert.scss +0 -9
- package/src/style/src/sweetalert/scss/_animations.scss +0 -197
- package/src/style/src/sweetalert/scss/_body.scss +0 -45
- package/src/style/src/sweetalert/scss/_core.scss +0 -862
- package/src/style/src/sweetalert/scss/_mixins.scss +0 -16
- package/src/style/src/sweetalert/scss/_theming.scss +0 -8
- package/src/style/src/sweetalert/scss/_toasts-animations.scss +0 -83
- package/src/style/src/sweetalert/scss/_toasts-body.scss +0 -85
- package/src/style/src/sweetalert/scss/_toasts.scss +0 -203
- package/src/style/src/sweetalert/scss/_variables.scss +0 -271
- package/src/ts-helpers.d.ts +0 -44
- package/src/types/index.ts +0 -59
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -22
- package/vite.config.js +0 -29
- /package/dist/{src/axios → axios}/axiosClient.d.ts +0 -0
- /package/dist/{src/common → common}/appResult.d.ts +0 -0
- /package/dist/{src/components → components}/button/Button.d.ts +0 -0
- /package/dist/{src/components → components}/content/Content.d.ts +0 -0
- /package/dist/{src/components → components}/drawer/Drawer.d.ts +0 -0
- /package/dist/{src/components → components}/icon/Icon.d.ts +0 -0
- /package/dist/{src/components → components}/internal/HeaderAvatar.d.ts +0 -0
- /package/dist/{src/components → components}/internal/LoadingCircle.d.ts +0 -0
- /package/dist/{src/components → components}/internal/MenuIcon.d.ts +0 -0
- /package/dist/{src/components → components}/internal/ScrollToTop.d.ts +0 -0
- /package/dist/{src/components → components}/internal/ThemeToggle.d.ts +0 -0
- /package/dist/{src/components → components}/internal/cssClassBuilder.d.ts +0 -0
- /package/dist/{src/components → components}/internal/getMaxZindex.d.ts +0 -0
- /package/dist/{src/components → components}/layout/Layout.d.ts +0 -0
- /package/dist/{src/components → components}/message/Message.d.ts +0 -0
- /package/dist/{src/components → components}/navmenu/NavMenu.d.ts +0 -0
- /package/dist/{src/components → components}/tabnavigation/TabNavigation.d.ts +0 -0
- /package/dist/{src/components → components}/tooltip/Tooltip.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/keycloak.d.ts → keycloak.d.ts} +0 -0
- /package/dist/{src/services → services}/authService.d.ts +0 -0
- /package/dist/{src/services → services}/dialogService.d.ts +0 -0
- /package/dist/{src/services → services}/navMenuService.d.ts +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, onMounted, ref } from "vue";
|
|
3
|
-
import SfDrawer from "../drawer/Drawer.vue";
|
|
4
|
-
import SfButton from "../button/Button.vue";
|
|
5
|
-
import { UseConfirmService } from "../../services/dialogService";
|
|
6
|
-
|
|
7
|
-
const confirmService = UseConfirmService();
|
|
8
|
-
|
|
9
|
-
const letters = ref("?");
|
|
10
|
-
|
|
11
|
-
const emit = defineEmits<{
|
|
12
|
-
(event: "logout"): void;
|
|
13
|
-
}>();
|
|
14
|
-
|
|
15
|
-
async function Logout() {
|
|
16
|
-
const confirm = await confirmService.CreateConfirmAsync({
|
|
17
|
-
text: `Você deseja sair da conta?`,
|
|
18
|
-
confirmLabel: "sair",
|
|
19
|
-
});
|
|
20
|
-
if (!confirm) return;
|
|
21
|
-
emit("logout");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function Letters() {
|
|
25
|
-
const name = sessionStorage.getItem("name");
|
|
26
|
-
let letters = "?";
|
|
27
|
-
if (!name) return letters;
|
|
28
|
-
|
|
29
|
-
const parts = name
|
|
30
|
-
.split(" ")
|
|
31
|
-
.filter((x) => x.length > 0)
|
|
32
|
-
.map((x) => x[0].toUpperCase());
|
|
33
|
-
|
|
34
|
-
const count = Math.min(2, parts.length);
|
|
35
|
-
|
|
36
|
-
letters = parts.slice(0, count).join("");
|
|
37
|
-
|
|
38
|
-
return letters.length > 0 ? letters : "?";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const color = computed(() => {
|
|
42
|
-
const primeiraLetra = letters.value[0];
|
|
43
|
-
const cor =
|
|
44
|
-
primeiraLetra === "?"
|
|
45
|
-
? 0
|
|
46
|
-
: (primeiraLetra.charCodeAt(0) - 64) % 19;
|
|
47
|
-
return Math.max(cor, 0);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const showDrawer = ref(false);
|
|
51
|
-
|
|
52
|
-
onMounted(() => {
|
|
53
|
-
letters.value = Letters();
|
|
54
|
-
});
|
|
55
|
-
</script>
|
|
56
|
-
|
|
57
|
-
<template>
|
|
58
|
-
<div
|
|
59
|
-
id="sf-header-avatar"
|
|
60
|
-
:data-cor="color"
|
|
61
|
-
@click="showDrawer = true"
|
|
62
|
-
>
|
|
63
|
-
{{ letters }}
|
|
64
|
-
</div>
|
|
65
|
-
<SfDrawer v-model:visible="showDrawer" :position="'right'">
|
|
66
|
-
<template #title>Minha conta</template>
|
|
67
|
-
<template #default>
|
|
68
|
-
<div class="sf-p-4">
|
|
69
|
-
<SfButton :color="'error'" @click="Logout">Sair</SfButton>
|
|
70
|
-
</div>
|
|
71
|
-
</template>
|
|
72
|
-
</SfDrawer>
|
|
73
|
-
</template>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg
|
|
3
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
-
height="48"
|
|
5
|
-
viewBox="0 -960 960 960"
|
|
6
|
-
width="48"
|
|
7
|
-
class="sf-svg-icon"
|
|
8
|
-
>
|
|
9
|
-
<path
|
|
10
|
-
d="m307.231-83.463-54.999-55.23 343.923-343.922-343.923-343.539 54.999-54.614 398.153 398.153L307.231-83.462Z"
|
|
11
|
-
/>
|
|
12
|
-
</svg>
|
|
13
|
-
</template>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { onMounted, ref } from "vue";
|
|
3
|
-
|
|
4
|
-
const visible = ref(false);
|
|
5
|
-
const id = `--${+new Date()}`;
|
|
6
|
-
let parent: HTMLElement | null = null;
|
|
7
|
-
|
|
8
|
-
function ButtonClick() {
|
|
9
|
-
parent?.scrollTo(0, 0);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
onMounted(() => {
|
|
13
|
-
parent = document.getElementById(id)?.parentElement ?? null;
|
|
14
|
-
if (!parent) return;
|
|
15
|
-
parent.addEventListener("scroll", function () {
|
|
16
|
-
visible.value = this.scrollTop - this.clientHeight > 0;
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
</script>
|
|
20
|
-
<template>
|
|
21
|
-
<button
|
|
22
|
-
:id="id"
|
|
23
|
-
:class="['sf-scrollToTop', { 'sf-scrollToTop-visible': visible }]"
|
|
24
|
-
@click="ButtonClick"
|
|
25
|
-
></button>
|
|
26
|
-
</template>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
class ThemeToggle {
|
|
2
|
-
get storedTheme() {
|
|
3
|
-
return localStorage.getItem("color-scheme") as
|
|
4
|
-
| "light"
|
|
5
|
-
| "dark"
|
|
6
|
-
| null;
|
|
7
|
-
}
|
|
8
|
-
get IsDark() {
|
|
9
|
-
return document.documentElement.classList.contains("dark");
|
|
10
|
-
}
|
|
11
|
-
Toggle() {
|
|
12
|
-
this.IsDark ? this.EnableLightMode() : this.EnableDarkMode();
|
|
13
|
-
}
|
|
14
|
-
EnableDarkMode() {
|
|
15
|
-
document.documentElement.classList.add("dark");
|
|
16
|
-
document.documentElement.classList.remove("light");
|
|
17
|
-
localStorage.setItem("color-scheme", "dark");
|
|
18
|
-
}
|
|
19
|
-
EnableLightMode() {
|
|
20
|
-
document.documentElement.classList.remove("dark");
|
|
21
|
-
document.documentElement.classList.add("light");
|
|
22
|
-
localStorage.setItem("color-scheme", "light");
|
|
23
|
-
}
|
|
24
|
-
SetInitialTheme() {
|
|
25
|
-
if (this.storedTheme === "light") {
|
|
26
|
-
return this.EnableLightMode();
|
|
27
|
-
}
|
|
28
|
-
if (this.storedTheme === "dark") {
|
|
29
|
-
return this.EnableDarkMode();
|
|
30
|
-
}
|
|
31
|
-
if (
|
|
32
|
-
window.matchMedia &&
|
|
33
|
-
window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
34
|
-
) {
|
|
35
|
-
return this.EnableDarkMode();
|
|
36
|
-
}
|
|
37
|
-
this.EnableLightMode();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const ThemeToggleBase = (() => new ThemeToggle())();
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ThemeToggleBase } from "./ThemeToggle";
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<template>
|
|
6
|
-
<button id="sf-theme-toggle" @click="ThemeToggleBase.Toggle">
|
|
7
|
-
<svg
|
|
8
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
width="472.39"
|
|
10
|
-
height="472.39"
|
|
11
|
-
viewBox="0 0 472.39 472.39"
|
|
12
|
-
>
|
|
13
|
-
<g class="toggle-sun">
|
|
14
|
-
<path
|
|
15
|
-
d="M403.21,167V69.18H305.38L236.2,0,167,69.18H69.18V167L0,236.2l69.18,69.18v97.83H167l69.18,69.18,69.18-69.18h97.83V305.38l69.18-69.18Zm-167,198.17a129,129,0,1,1,129-129A129,129,0,0,1,236.2,365.19Z"
|
|
16
|
-
/>
|
|
17
|
-
</g>
|
|
18
|
-
<g class="toggle-circle">
|
|
19
|
-
<circle class="cls-1" cx="236.2" cy="236.2" r="103.78" />
|
|
20
|
-
</g>
|
|
21
|
-
</svg>
|
|
22
|
-
</button>
|
|
23
|
-
</template>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A utility class for building CSS class strings.
|
|
3
|
-
*/
|
|
4
|
-
export class CssClassBuilder {
|
|
5
|
-
/**
|
|
6
|
-
* Creates a new instance of the CssClassBuilder class.
|
|
7
|
-
* @param value The initial value of the CSS class string.
|
|
8
|
-
*/
|
|
9
|
-
constructor(value: string) {
|
|
10
|
-
this.retorno = value ?? "";
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
retorno: string;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Concatenates a new CSS class to the existing string.
|
|
17
|
-
* @param value The CSS class to concatenate.
|
|
18
|
-
* @returns The current instance of the CssClassBuilder class.
|
|
19
|
-
*/
|
|
20
|
-
private Concat(value?: string) {
|
|
21
|
-
if (value && value.trim().length) {
|
|
22
|
-
this.retorno += ` ${value}`;
|
|
23
|
-
}
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Adds a new CSS class to the string if the specified condition is true.
|
|
29
|
-
* @param value The CSS class to add.
|
|
30
|
-
* @param when The condition that determines whether to add the CSS class.
|
|
31
|
-
* @returns The current instance of the CssClassBuilder class.
|
|
32
|
-
*/
|
|
33
|
-
AddClass(value?: string, when: boolean = true) {
|
|
34
|
-
return when ? this.Concat(value) : this;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Builds the final CSS class string.
|
|
39
|
-
* @returns The final CSS class string.
|
|
40
|
-
*/
|
|
41
|
-
Build() {
|
|
42
|
-
return this.retorno.trim();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
function GetMaxZindex(seletores: string[] = []) {
|
|
2
|
-
let selector = "body > *:not(script):not(style)";
|
|
3
|
-
for (const s of seletores) {
|
|
4
|
-
selector += `, ${s}`;
|
|
5
|
-
}
|
|
6
|
-
const max = Math.max(
|
|
7
|
-
...Array.from(document.querySelectorAll(selector)).map((x) => {
|
|
8
|
-
const z = getComputedStyle(x).zIndex;
|
|
9
|
-
return +z === +z ? +z : 0;
|
|
10
|
-
})
|
|
11
|
-
);
|
|
12
|
-
return max >= 100 ? max : 100;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { GetMaxZindex };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClassComponent,
|
|
3
|
-
GlobalComponentConstructor,
|
|
4
|
-
} from "../ts-helpers";
|
|
5
|
-
|
|
6
|
-
export interface SfLayoutSlots {
|
|
7
|
-
/**
|
|
8
|
-
* Título ao lado do botão do menu
|
|
9
|
-
*/
|
|
10
|
-
title: () => VNode[];
|
|
11
|
-
/**
|
|
12
|
-
* Conteúdo para ficar no menu
|
|
13
|
-
*/
|
|
14
|
-
menu: () => VNode[];
|
|
15
|
-
/**
|
|
16
|
-
* Conteúdo principal
|
|
17
|
-
*/
|
|
18
|
-
content: () => VNode[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export declare type SfLayoutEmits = {
|
|
22
|
-
mounted: () => void;
|
|
23
|
-
logout: () => void;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
declare class SfLayout extends ClassComponent<
|
|
27
|
-
SfLayoutProps,
|
|
28
|
-
SfLayoutSlots,
|
|
29
|
-
SfLayoutEmits
|
|
30
|
-
> {}
|
|
31
|
-
|
|
32
|
-
declare module "@vue/runtime-core" {
|
|
33
|
-
interface GlobalComponent {
|
|
34
|
-
SfLayout: GlobalComponentConstructor<SfLayout>;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default SfLayout;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { onMounted } from "vue";
|
|
3
|
-
import { UseNavMenuService } from "../../services/navMenuService";
|
|
4
|
-
import HeaderAvatar from "../internal/HeaderAvatar.vue";
|
|
5
|
-
import MenuIcon from "../internal/MenuIcon.vue";
|
|
6
|
-
import ThemeToggle from "../internal/ThemeToggle.vue";
|
|
7
|
-
import SfTooltip from "../tooltip/Tooltip.vue";
|
|
8
|
-
|
|
9
|
-
const navService = UseNavMenuService();
|
|
10
|
-
|
|
11
|
-
const emit = defineEmits<{
|
|
12
|
-
(event: "mounted"): void;
|
|
13
|
-
(event: "logout"): void;
|
|
14
|
-
}>();
|
|
15
|
-
|
|
16
|
-
onMounted(() => {
|
|
17
|
-
emit("mounted");
|
|
18
|
-
});
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<template>
|
|
22
|
-
<div id="sf-layout">
|
|
23
|
-
<header>
|
|
24
|
-
<div
|
|
25
|
-
:class="[
|
|
26
|
-
'sf-layout-menu-toggler',
|
|
27
|
-
{ invert: navService.IsVisible },
|
|
28
|
-
]"
|
|
29
|
-
@click="navService.Toggle()"
|
|
30
|
-
>
|
|
31
|
-
<div class="sf-layout-menu-toggler-logo"></div>
|
|
32
|
-
<MenuIcon />
|
|
33
|
-
</div>
|
|
34
|
-
<div class="title">
|
|
35
|
-
<slot name="title"></slot>
|
|
36
|
-
</div>
|
|
37
|
-
<slot name="action"> </slot>
|
|
38
|
-
<SfTooltip :text="'Tema'">
|
|
39
|
-
<ThemeToggle />
|
|
40
|
-
</SfTooltip>
|
|
41
|
-
<HeaderAvatar @logout="emit('logout')" />
|
|
42
|
-
</header>
|
|
43
|
-
<nav :class="{ visible: navService.IsVisible }">
|
|
44
|
-
<div class="sf-layout-nav-content">
|
|
45
|
-
<slot name="menu"></slot>
|
|
46
|
-
</div>
|
|
47
|
-
<div class="sf-layout-nav-footer">
|
|
48
|
-
<div class="sf-layout-nav-footer-logo"></div>
|
|
49
|
-
</div>
|
|
50
|
-
</nav>
|
|
51
|
-
<main :class="{ 'menu-visible': navService.IsVisible }">
|
|
52
|
-
<section id="sf-layout-page-title"></section>
|
|
53
|
-
<section id="sf-layout-content">
|
|
54
|
-
<slot name="content"></slot>
|
|
55
|
-
</section>
|
|
56
|
-
</main>
|
|
57
|
-
</div>
|
|
58
|
-
</template>
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { CssClassBuilder } from "../internal/cssClassBuilder";
|
|
3
|
-
import { StyleValue, computed } from "vue";
|
|
4
|
-
|
|
5
|
-
export interface SfMessageProps {
|
|
6
|
-
/**
|
|
7
|
-
* @default 'info'
|
|
8
|
-
*/
|
|
9
|
-
color?:
|
|
10
|
-
| "primary"
|
|
11
|
-
| "secondary"
|
|
12
|
-
| "info"
|
|
13
|
-
| "success"
|
|
14
|
-
| "help"
|
|
15
|
-
| "warn"
|
|
16
|
-
| "error"
|
|
17
|
-
| undefined;
|
|
18
|
-
class?: any;
|
|
19
|
-
style?: StyleValue;
|
|
20
|
-
icon?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const props: SfMessageProps = withDefaults(
|
|
24
|
-
defineProps<SfMessageProps>(),
|
|
25
|
-
{
|
|
26
|
-
color: "info",
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const icon = computed(() => {
|
|
31
|
-
if (!!props.icon) return props.icon;
|
|
32
|
-
switch (props.color) {
|
|
33
|
-
case "error":
|
|
34
|
-
return "cancel";
|
|
35
|
-
case "info":
|
|
36
|
-
return "info";
|
|
37
|
-
case "warn":
|
|
38
|
-
return "warning";
|
|
39
|
-
case "success":
|
|
40
|
-
return "check";
|
|
41
|
-
case "help":
|
|
42
|
-
return "help";
|
|
43
|
-
default:
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const css = computed(() => {
|
|
49
|
-
return new CssClassBuilder("sf-message")
|
|
50
|
-
.AddClass("sf-message-error", props.color === "error")
|
|
51
|
-
.AddClass("sf-message-info", props.color === "info")
|
|
52
|
-
.AddClass("sf-message-warning", props.color === "warn")
|
|
53
|
-
.AddClass("sf-message-success", props.color === "success")
|
|
54
|
-
.AddClass("sf-message-help", props.color === "help")
|
|
55
|
-
.AddClass("sf-message-primary", props.color === "primary")
|
|
56
|
-
.AddClass("sf-message-secondary", props.color === "secondary")
|
|
57
|
-
.AddClass(props.class)
|
|
58
|
-
.Build();
|
|
59
|
-
});
|
|
60
|
-
</script>
|
|
61
|
-
<template>
|
|
62
|
-
<div :class="css" :data-icon="icon">
|
|
63
|
-
<slot name="default"></slot>
|
|
64
|
-
</div>
|
|
65
|
-
</template>
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import PanelMenu from "primevue/panelmenu";
|
|
3
|
-
import { UseNavMenuService } from "../../services/navMenuService";
|
|
4
|
-
import { SfNavMenuItem } from "./../../types";
|
|
5
|
-
|
|
6
|
-
export interface SfNavMenuProps {
|
|
7
|
-
items: SfNavMenuItem[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const props = defineProps<SfNavMenuProps>();
|
|
11
|
-
|
|
12
|
-
const navService = UseNavMenuService();
|
|
13
|
-
|
|
14
|
-
function OnClickRoute(ev: Event, navigate: () => void) {
|
|
15
|
-
ev.preventDefault();
|
|
16
|
-
const target = ev.target as HTMLElement;
|
|
17
|
-
const nav = target.closest(".panel-menu-wrapper");
|
|
18
|
-
if (nav && nav.clientWidth + 10 > document.body.clientWidth) {
|
|
19
|
-
navService.Close();
|
|
20
|
-
}
|
|
21
|
-
navigate();
|
|
22
|
-
}
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<template>
|
|
26
|
-
<div class="panel-menu-wrapper">
|
|
27
|
-
<PanelMenu :model="props.items" :unstyled="true">
|
|
28
|
-
<template #item="{ item, active }">
|
|
29
|
-
<router-link
|
|
30
|
-
v-if="!!item.href"
|
|
31
|
-
v-slot="{ navigate, isActive }"
|
|
32
|
-
:to="{
|
|
33
|
-
path: item.href,
|
|
34
|
-
params: item.params ?? {},
|
|
35
|
-
query: item.query ?? {},
|
|
36
|
-
}"
|
|
37
|
-
custom
|
|
38
|
-
>
|
|
39
|
-
<a
|
|
40
|
-
class="item-menu sf-ripple"
|
|
41
|
-
:data-active="isActive"
|
|
42
|
-
:href="item.href"
|
|
43
|
-
@click="OnClickRoute($event, navigate)"
|
|
44
|
-
>
|
|
45
|
-
<span class="material-symbols-outlined sf-mr-3">
|
|
46
|
-
{{ item.icon ?? "chevron_right" }}
|
|
47
|
-
</span>
|
|
48
|
-
<span>{{ item.text }}</span>
|
|
49
|
-
</a>
|
|
50
|
-
</router-link>
|
|
51
|
-
<a v-else class="item-menu sf-ripple">
|
|
52
|
-
<span
|
|
53
|
-
v-if="item.icon"
|
|
54
|
-
class="material-symbols-outlined sf-mr-3"
|
|
55
|
-
>
|
|
56
|
-
{{ item.icon }}
|
|
57
|
-
</span>
|
|
58
|
-
<span>{{ item.text }}</span>
|
|
59
|
-
<div class="sf-flex-grow-1"></div>
|
|
60
|
-
<span
|
|
61
|
-
:class="[
|
|
62
|
-
'material-symbols-outlined arrow',
|
|
63
|
-
{ '--expand': active },
|
|
64
|
-
]"
|
|
65
|
-
>
|
|
66
|
-
chevron_right
|
|
67
|
-
</span>
|
|
68
|
-
</a>
|
|
69
|
-
</template>
|
|
70
|
-
</PanelMenu>
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<style scoped lang="scss">
|
|
75
|
-
.panel-menu-wrapper {
|
|
76
|
-
padding: var(--inline-spacing);
|
|
77
|
-
:deep(ul, li) {
|
|
78
|
-
list-style-type: none;
|
|
79
|
-
padding: 0;
|
|
80
|
-
margin: 0;
|
|
81
|
-
}
|
|
82
|
-
:deep(ul) {
|
|
83
|
-
padding-left: var(--inline-spacing);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
.item-menu {
|
|
87
|
-
display: flex;
|
|
88
|
-
align-items: center;
|
|
89
|
-
padding: var(--inline-spacing);
|
|
90
|
-
color: var(--text-color);
|
|
91
|
-
text-decoration: none;
|
|
92
|
-
border-radius: 6px;
|
|
93
|
-
margin-bottom: 0.25em;
|
|
94
|
-
cursor: pointer;
|
|
95
|
-
&.sub-item {
|
|
96
|
-
margin-bottom: var(--inline-spacing);
|
|
97
|
-
}
|
|
98
|
-
&[data-active="true"] {
|
|
99
|
-
background-color: var(--primary-hover-color);
|
|
100
|
-
color: var(--primary-color);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
.arrow {
|
|
104
|
-
transition: transform 0.3s;
|
|
105
|
-
&.--expand {
|
|
106
|
-
transform: rotate(90deg);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
</style>
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { onMounted, onBeforeUnmount, ref } from "vue";
|
|
3
|
-
|
|
4
|
-
export interface SfTabNavigationTab {
|
|
5
|
-
text: string;
|
|
6
|
-
route: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface SfTabNavigationProps {
|
|
10
|
-
tabs: SfTabNavigationTab[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const props: SfTabNavigationProps =
|
|
14
|
-
defineProps<SfTabNavigationProps>();
|
|
15
|
-
|
|
16
|
-
const trackerContainer = ref<HTMLInputElement | null>(null);
|
|
17
|
-
const trackerContainerObserver = new ResizeObserver((_) => {
|
|
18
|
-
AjustarIcones();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const isLeftArrowActive = ref(false);
|
|
22
|
-
const isRightArrowActive = ref(false);
|
|
23
|
-
|
|
24
|
-
function Scroll(left: boolean = false) {
|
|
25
|
-
const amount = trackerContainer.value!.clientWidth;
|
|
26
|
-
trackerContainer.value!.scrollLeft += left ? -amount : amount;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function AjustarIcones() {
|
|
30
|
-
const maxScrollValue =
|
|
31
|
-
trackerContainer.value!.scrollWidth -
|
|
32
|
-
trackerContainer.value!.clientWidth;
|
|
33
|
-
|
|
34
|
-
isLeftArrowActive.value! = trackerContainer.value!.scrollLeft > 10;
|
|
35
|
-
|
|
36
|
-
isRightArrowActive.value! =
|
|
37
|
-
trackerContainer.value!.scrollLeft < maxScrollValue - 10;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
onMounted(() => {
|
|
41
|
-
trackerContainer.value!.addEventListener("scroll", AjustarIcones);
|
|
42
|
-
trackerContainerObserver.observe(trackerContainer.value!);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
onBeforeUnmount(() => {
|
|
46
|
-
try {
|
|
47
|
-
trackerContainer.value?.removeEventListener(
|
|
48
|
-
"scroll",
|
|
49
|
-
AjustarIcones
|
|
50
|
-
);
|
|
51
|
-
trackerContainerObserver.unobserve(trackerContainer.value!);
|
|
52
|
-
trackerContainerObserver.disconnect();
|
|
53
|
-
} catch {}
|
|
54
|
-
});
|
|
55
|
-
</script>
|
|
56
|
-
|
|
57
|
-
<template>
|
|
58
|
-
<div class="sf-tab-navigation">
|
|
59
|
-
<div
|
|
60
|
-
:class="['left-arrow', { active: isLeftArrowActive }]"
|
|
61
|
-
@click="Scroll(true)"
|
|
62
|
-
>
|
|
63
|
-
<svg
|
|
64
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
65
|
-
fill="none"
|
|
66
|
-
viewBox="0 0 24 24"
|
|
67
|
-
stroke-width="1.5"
|
|
68
|
-
stroke="currentColor"
|
|
69
|
-
class="w-6 h-6"
|
|
70
|
-
>
|
|
71
|
-
<path
|
|
72
|
-
stroke-linecap="round"
|
|
73
|
-
stroke-linejoin="round"
|
|
74
|
-
d="M15.75 19.5L8.25 12l7.5-7.5"
|
|
75
|
-
/>
|
|
76
|
-
</svg>
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<ul ref="trackerContainer">
|
|
80
|
-
<RouterLink
|
|
81
|
-
v-for="tab in props.tabs"
|
|
82
|
-
:to="tab.route"
|
|
83
|
-
:custom="true"
|
|
84
|
-
v-slot="{ navigate, isActive }"
|
|
85
|
-
>
|
|
86
|
-
<li :data-active="isActive">
|
|
87
|
-
<slot
|
|
88
|
-
name="item"
|
|
89
|
-
:item="tab"
|
|
90
|
-
:navigate="navigate"
|
|
91
|
-
:is-active="isActive"
|
|
92
|
-
>
|
|
93
|
-
<a
|
|
94
|
-
:href="tab.route"
|
|
95
|
-
:class="{ active: isActive }"
|
|
96
|
-
@click="navigate"
|
|
97
|
-
>
|
|
98
|
-
{{ tab.text }}
|
|
99
|
-
</a>
|
|
100
|
-
</slot>
|
|
101
|
-
</li>
|
|
102
|
-
</RouterLink>
|
|
103
|
-
</ul>
|
|
104
|
-
|
|
105
|
-
<div
|
|
106
|
-
:class="['right-arrow', { active: isRightArrowActive }]"
|
|
107
|
-
@click="Scroll()"
|
|
108
|
-
>
|
|
109
|
-
<svg
|
|
110
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
111
|
-
fill="none"
|
|
112
|
-
viewBox="0 0 24 24"
|
|
113
|
-
stroke-width="1.5"
|
|
114
|
-
stroke="currentColor"
|
|
115
|
-
class="w-6 h-6"
|
|
116
|
-
>
|
|
117
|
-
<path
|
|
118
|
-
stroke-linecap="round"
|
|
119
|
-
stroke-linejoin="round"
|
|
120
|
-
d="M8.25 4.5l7.5 7.5-7.5 7.5"
|
|
121
|
-
/>
|
|
122
|
-
</svg>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
</template>
|