@luizleon/sf.prefeiturasp.vuecomponents 4.0.2 → 4.0.4
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/dist/{src/components → components}/navmenu/NavMenu.d.ts +4 -3
- package/dist/sf.prefeiturasp.vuecomponents.cjs +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.cjs.map +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.js +2 -2
- package/dist/sf.prefeiturasp.vuecomponents.js.map +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.umd.cjs +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- 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}/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,49 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { StyleValue } from "vue";
|
|
3
|
-
import ScrollToTop from "../internal/ScrollToTop.vue";
|
|
4
|
-
import { CssClassBuilder } from "../internal/cssClassBuilder";
|
|
5
|
-
|
|
6
|
-
export interface SfContentProps {
|
|
7
|
-
class?: any;
|
|
8
|
-
style?: StyleValue;
|
|
9
|
-
disableBodyPadding?: boolean;
|
|
10
|
-
disableHeaderPadding?: boolean;
|
|
11
|
-
disableFooterPadding?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const props: SfContentProps = defineProps<SfContentProps>();
|
|
15
|
-
|
|
16
|
-
function Css() {
|
|
17
|
-
return new CssClassBuilder("sf-content")
|
|
18
|
-
.AddClass(props.class, !!props.class)
|
|
19
|
-
.Build();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function CssBody() {
|
|
23
|
-
return new CssClassBuilder("sf-content-body")
|
|
24
|
-
.AddClass("sf-content-no-padding", props.disableBodyPadding)
|
|
25
|
-
.Build();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function CssHeader() {
|
|
29
|
-
return new CssClassBuilder("sf-content-header")
|
|
30
|
-
.AddClass("sf-content-no-padding", props.disableHeaderPadding)
|
|
31
|
-
.Build();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function CssFooter() {
|
|
35
|
-
return new CssClassBuilder("sf-content-footer")
|
|
36
|
-
.AddClass("sf-content-no-padding", props.disableFooterPadding)
|
|
37
|
-
.Build();
|
|
38
|
-
}
|
|
39
|
-
</script>
|
|
40
|
-
<template>
|
|
41
|
-
<div :class="Css()" :style="props.style">
|
|
42
|
-
<div :class="CssHeader()"><slot name="header"></slot></div>
|
|
43
|
-
<div :class="CssBody()">
|
|
44
|
-
<slot name="default"></slot>
|
|
45
|
-
<ScrollToTop />
|
|
46
|
-
</div>
|
|
47
|
-
<div :class="CssFooter()"><slot name="footer"></slot></div>
|
|
48
|
-
</div>
|
|
49
|
-
</template>
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { StyleValue, ref, useSlots, watch } from "vue";
|
|
3
|
-
import { CssClassBuilder } from "../internal/cssClassBuilder";
|
|
4
|
-
import { GetMaxZindex } from "../internal/getMaxZindex";
|
|
5
|
-
import { nanoid } from "nanoid";
|
|
6
|
-
import SfIcon from "../icon/Icon.vue";
|
|
7
|
-
|
|
8
|
-
export interface SfDrawerProps {
|
|
9
|
-
visible: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* @default 'left'
|
|
12
|
-
*/
|
|
13
|
-
position?: "left" | "right" | "bottom" | "full";
|
|
14
|
-
style?: StyleValue;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const props: SfDrawerProps = withDefaults(
|
|
18
|
-
defineProps<SfDrawerProps>(),
|
|
19
|
-
{
|
|
20
|
-
visible: false,
|
|
21
|
-
position: "left",
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const emit = defineEmits<{
|
|
26
|
-
(e: "update:visible", v: boolean): void;
|
|
27
|
-
(e: "open"): void;
|
|
28
|
-
(e: "before-close"): void;
|
|
29
|
-
}>();
|
|
30
|
-
|
|
31
|
-
const slots = useSlots();
|
|
32
|
-
|
|
33
|
-
const visible = ref(props.visible);
|
|
34
|
-
|
|
35
|
-
const maskVisible = ref(false);
|
|
36
|
-
|
|
37
|
-
const zIndex = ref(0);
|
|
38
|
-
|
|
39
|
-
const id = nanoid();
|
|
40
|
-
|
|
41
|
-
function Close() {
|
|
42
|
-
visible.value = false;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function OnKeydown(ev: KeyboardEvent) {
|
|
46
|
-
if (ev.key === "Escape" || ev.code === "Escape") {
|
|
47
|
-
Close();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function OnEnter() {
|
|
52
|
-
emit("open");
|
|
53
|
-
window.document.addEventListener("keydown", OnKeydown, true);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function OnBeforeEnter(el: Element) {
|
|
57
|
-
zIndex.value = GetMaxZindex();
|
|
58
|
-
(el as HTMLElement).style.zIndex = `${zIndex.value}`;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function OnBeforeLeave(el: Element) {
|
|
62
|
-
emit("before-close");
|
|
63
|
-
el?.parentElement?.classList.add("sf-mask-overlay-leave");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function OnAfterLeave() {
|
|
67
|
-
window.document.removeEventListener("keydown", OnKeydown, true);
|
|
68
|
-
maskVisible.value = false;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function CssMask() {
|
|
72
|
-
return new CssClassBuilder("sf-mask sf-mask-overlay")
|
|
73
|
-
.AddClass("right", props.position === "right")
|
|
74
|
-
.AddClass("bottom", props.position === "bottom")
|
|
75
|
-
.AddClass("full", props.position === "full")
|
|
76
|
-
.AddClass("sf-mask-overlay-enter", props.visible === true)
|
|
77
|
-
.Build();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
watch(
|
|
81
|
-
() => props.visible,
|
|
82
|
-
(v) => {
|
|
83
|
-
visible.value = v;
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
watch(
|
|
87
|
-
() => visible.value,
|
|
88
|
-
(v) => {
|
|
89
|
-
emit("update:visible", v);
|
|
90
|
-
if (v) {
|
|
91
|
-
maskVisible.value = true;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
</script>
|
|
96
|
-
|
|
97
|
-
<template>
|
|
98
|
-
<Teleport :to="'body'">
|
|
99
|
-
<div
|
|
100
|
-
v-if="maskVisible"
|
|
101
|
-
:id="id"
|
|
102
|
-
:class="CssMask()"
|
|
103
|
-
:style="{ zIndex: zIndex - 1 }"
|
|
104
|
-
@click.stop="Close"
|
|
105
|
-
>
|
|
106
|
-
<transition
|
|
107
|
-
name="sf-drawer"
|
|
108
|
-
appear
|
|
109
|
-
@before-enter="OnBeforeEnter"
|
|
110
|
-
@enter="OnEnter"
|
|
111
|
-
@before-leave="OnBeforeLeave"
|
|
112
|
-
@after-leave="OnAfterLeave"
|
|
113
|
-
>
|
|
114
|
-
<div
|
|
115
|
-
v-if="visible"
|
|
116
|
-
:class="[
|
|
117
|
-
'sf-drawer',
|
|
118
|
-
{
|
|
119
|
-
'sf-drawer-with-footer': !!slots.footer,
|
|
120
|
-
},
|
|
121
|
-
]"
|
|
122
|
-
:style="props.style"
|
|
123
|
-
role="dialog"
|
|
124
|
-
@click.stop="void"
|
|
125
|
-
>
|
|
126
|
-
<div class="sf-drawer-header">
|
|
127
|
-
<span class="sf-drawer-title">
|
|
128
|
-
<slot name="title"></slot>
|
|
129
|
-
</span>
|
|
130
|
-
<SfIcon
|
|
131
|
-
:button="true"
|
|
132
|
-
:icon="'close'"
|
|
133
|
-
@click.stop="Close"
|
|
134
|
-
/>
|
|
135
|
-
</div>
|
|
136
|
-
<div class="sf-drawer-content">
|
|
137
|
-
<slot name="default"></slot>
|
|
138
|
-
</div>
|
|
139
|
-
<div class="sf-drawer-footer" v-if="slots.footer">
|
|
140
|
-
<slot name="footer"></slot>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
</transition>
|
|
144
|
-
</div>
|
|
145
|
-
</Teleport>
|
|
146
|
-
</template>
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ButtonHTMLAttributes, StyleValue, computed } from "vue";
|
|
3
|
-
import LoadingCircle from "../internal/LoadingCircle.vue";
|
|
4
|
-
import { CssClassBuilder } from "../internal/cssClassBuilder";
|
|
5
|
-
import Tooltip from "../tooltip/Tooltip.vue";
|
|
6
|
-
import { Color, IconSize } from "../../types";
|
|
7
|
-
|
|
8
|
-
export interface SfIconProps {
|
|
9
|
-
icon?: string;
|
|
10
|
-
visible?: boolean;
|
|
11
|
-
class?: any;
|
|
12
|
-
style?: StyleValue;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
loading?: boolean;
|
|
15
|
-
button?: boolean;
|
|
16
|
-
size?: IconSize;
|
|
17
|
-
dot?: boolean;
|
|
18
|
-
dotColor?: Color;
|
|
19
|
-
filled?: boolean;
|
|
20
|
-
buttonProps?: ButtonHTMLAttributes;
|
|
21
|
-
tooltip?: string;
|
|
22
|
-
color?: Color | "inherit";
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const props: SfIconProps = withDefaults(defineProps<SfIconProps>(), {
|
|
26
|
-
visible: true,
|
|
27
|
-
class: "",
|
|
28
|
-
style: "",
|
|
29
|
-
size: "md",
|
|
30
|
-
dotColor: "error",
|
|
31
|
-
color: "inherit",
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const dynamicComponent = computed(() =>
|
|
35
|
-
props.tooltip ? Tooltip : "div"
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const componentClass = computed(() => {
|
|
39
|
-
return props.tooltip ? "" : "display-content";
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const cssClass = computed(() => {
|
|
43
|
-
return new CssClassBuilder(`${props.class} sf-icon`)
|
|
44
|
-
.AddClass("sf-component-loading", props.loading)
|
|
45
|
-
.AddClass("sf-component-disabled", props.disabled)
|
|
46
|
-
.AddClass("sf-icon-button", props.button)
|
|
47
|
-
.AddClass("sf-icon-small", props.size === "sm")
|
|
48
|
-
.AddClass("sf-icon-medium", props.size === "md")
|
|
49
|
-
.AddClass("sf-icon-large", props.size === "lg")
|
|
50
|
-
.AddClass("sf-icon-xlarge", props.size === "xl")
|
|
51
|
-
.AddClass("sf-icon-2xlarge", props.size === "2xl")
|
|
52
|
-
.AddClass("sf-icon-3xlarge", props.size === "3xl")
|
|
53
|
-
.AddClass("sf-ripple", props.button === true)
|
|
54
|
-
.AddClass(
|
|
55
|
-
`${props.color}-color`,
|
|
56
|
-
!!props.color && props.color !== "inherit"
|
|
57
|
-
)
|
|
58
|
-
.Build();
|
|
59
|
-
});
|
|
60
|
-
</script>
|
|
61
|
-
|
|
62
|
-
<template>
|
|
63
|
-
<component
|
|
64
|
-
:is="dynamicComponent"
|
|
65
|
-
:text="props.tooltip"
|
|
66
|
-
:class="componentClass"
|
|
67
|
-
>
|
|
68
|
-
<div
|
|
69
|
-
v-if="!!props.visible"
|
|
70
|
-
:style="props.style"
|
|
71
|
-
:class="cssClass"
|
|
72
|
-
>
|
|
73
|
-
<button
|
|
74
|
-
:class="[
|
|
75
|
-
'material-symbols-outlined',
|
|
76
|
-
{ 'icon-filled': !!props.filled },
|
|
77
|
-
]"
|
|
78
|
-
:disabled="props.disabled || props.loading"
|
|
79
|
-
v-bind="props.buttonProps"
|
|
80
|
-
:tabindex="!props.button ? -1 : undefined"
|
|
81
|
-
>
|
|
82
|
-
<template v-if="props.loading">
|
|
83
|
-
<LoadingCircle></LoadingCircle>
|
|
84
|
-
</template>
|
|
85
|
-
<template v-else>{{ props.icon }}</template>
|
|
86
|
-
</button>
|
|
87
|
-
<span v-if="props.dot" :data-color="props.dotColor"></span>
|
|
88
|
-
</div>
|
|
89
|
-
</component>
|
|
90
|
-
</template>
|
|
91
|
-
|
|
92
|
-
<style scoped>
|
|
93
|
-
.display-content {
|
|
94
|
-
display: contents;
|
|
95
|
-
}
|
|
96
|
-
</style>
|
|
@@ -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>
|