@luizleon/sf.prefeiturasp.vuecomponents 0.0.21 → 0.0.22
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 +4 -14
- package/src/common/appResult.ts +22 -0
- package/src/components/button/Button.d.ts +42 -0
- package/src/components/button/Button.vue +61 -0
- package/src/components/content/Content.d.ts +35 -0
- package/src/components/content/Content.vue +41 -0
- package/src/components/icon/Icon.d.ts +38 -0
- package/src/components/icon/Icon.vue +43 -0
- package/src/components/internal/HeaderAvatar.vue +49 -0
- package/src/components/internal/LoadingCircle.vue +16 -0
- package/src/components/internal/MenuIcon.vue +13 -0
- package/src/components/internal/ScrollToTop.vue +26 -0
- package/src/components/internal/ThemeToggle.ts +41 -0
- package/src/components/internal/ThemeToggle.vue +23 -0
- package/src/components/internal/cssClassBuilder.ts +44 -0
- package/src/components/layout/Layout.d.ts +44 -0
- package/src/components/layout/Layout.vue +51 -0
- package/src/components/navmenulink/NavMenuLink.d.ts +35 -0
- package/src/components/navmenulink/NavMenuLink.vue +41 -0
- package/src/components/tabnavigation/TabNavigation.d.ts +42 -0
- package/src/components/tabnavigation/TabNavigation.vue +117 -0
- package/src/enum/cor.ts +9 -0
- package/src/enum/index.ts +2 -0
- package/src/enum/tamanho.ts +5 -0
- package/src/index.ts +62 -0
- package/src/keycloak.d.ts +671 -0
- package/src/keycloak.js +1731 -0
- package/src/services/authService.ts +68 -0
- package/src/services/dialogService.ts +63 -0
- package/src/services/navMenuService.ts +21 -0
- package/src/style/componentes.scss +15 -0
- package/src/style/src/_animation.scss +441 -0
- package/src/style/src/_display.scss +10 -0
- package/src/style/src/_flexbox.scss +85 -0
- package/src/style/src/_functions.scss +171 -0
- package/src/style/src/_gap.scss +8 -0
- package/src/style/src/_grid.scss +100 -0
- package/src/style/src/_mixins.scss +633 -0
- package/src/style/src/_normalize.scss +351 -0
- package/src/style/src/_ripple.scss +30 -0
- package/src/style/src/_size.scss +98 -0
- package/src/style/src/_spacing.scss +42 -0
- package/src/style/src/_typography.scss +43 -0
- package/src/style/src/_variables.scss +87 -0
- package/src/style/src/components/_button.scss +107 -0
- package/src/style/src/components/_content.scss +57 -0
- package/src/style/src/components/_drawer.scss +99 -0
- package/src/style/src/components/_headerAvatar.scss +22 -0
- package/src/style/src/components/_icon.scss +120 -0
- package/src/style/src/components/_internal-icon-button.scss +5 -0
- package/src/style/src/components/_layout.scss +183 -0
- package/src/style/src/components/_loading-circle.scss +24 -0
- package/src/style/src/components/_navmenulink.scss +31 -0
- package/src/style/src/components/_scrollToTop.scss +28 -0
- package/src/style/src/components/_svg_icon.scss +5 -0
- package/src/style/src/components/_tab-navigation.scss +93 -0
- package/src/style/src/components/_themetoggle.scss +25 -0
- package/src/style/src/components/_tooltip.scss +55 -0
- package/src/style/src/sweetalert/_sweetalert.scss +9 -0
- package/src/style/src/sweetalert/scss/_animations.scss +197 -0
- package/src/style/src/sweetalert/scss/_body.scss +45 -0
- package/src/style/src/sweetalert/scss/_core.scss +863 -0
- package/src/style/src/sweetalert/scss/_mixins.scss +16 -0
- package/src/style/src/sweetalert/scss/_theming.scss +8 -0
- package/src/style/src/sweetalert/scss/_toasts-animations.scss +83 -0
- package/src/style/src/sweetalert/scss/_toasts-body.scss +85 -0
- package/src/style/src/sweetalert/scss/_toasts.scss +203 -0
- package/src/style/src/sweetalert/scss/_variables.scss +265 -0
- package/src/style/tema.scss +169 -0
- package/src/ts-helpers.d.ts +57 -0
- package/tsconfig.json +20 -0
- package/vite.config.js +26 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { SfNavMenuLinkProps } from "./NavMenuLink";
|
|
3
|
+
import { UseNavMenuService } from "../../services/navMenuService";
|
|
4
|
+
import Icon from "../icon/Icon.vue";
|
|
5
|
+
|
|
6
|
+
const props: SfNavMenuLinkProps = defineProps<SfNavMenuLinkProps>();
|
|
7
|
+
|
|
8
|
+
const navService = UseNavMenuService();
|
|
9
|
+
|
|
10
|
+
function OnClick(ev: Event, navigate: any) {
|
|
11
|
+
ev.preventDefault();
|
|
12
|
+
const target = ev.target as HTMLElement;
|
|
13
|
+
const nav = target.closest(".sf-layout-nav-content");
|
|
14
|
+
navigate();
|
|
15
|
+
if (nav && nav.clientWidth + 10 > document.body.clientWidth) {
|
|
16
|
+
navService.Close();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<router-link
|
|
23
|
+
:to="props.href"
|
|
24
|
+
custom
|
|
25
|
+
v-slot="{ href, navigate, isExactActive, isActive }"
|
|
26
|
+
>
|
|
27
|
+
<a
|
|
28
|
+
class="sf-navmenulink"
|
|
29
|
+
:href="href"
|
|
30
|
+
:data-active="props.exact ? isExactActive : isActive"
|
|
31
|
+
@click="OnClick($event, navigate)"
|
|
32
|
+
>
|
|
33
|
+
<Icon
|
|
34
|
+
v-if="props.icon"
|
|
35
|
+
:icone="props.icon"
|
|
36
|
+
:button-props="{ tabindex: -1 }"
|
|
37
|
+
/>
|
|
38
|
+
<span class="sf-navmenulink-text">{{ props.text }}</span>
|
|
39
|
+
</a>
|
|
40
|
+
</router-link>
|
|
41
|
+
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ClassComponent,
|
|
3
|
+
GlobalComponentConstructor,
|
|
4
|
+
} from "../../ts-helpers";
|
|
5
|
+
|
|
6
|
+
export interface SfTabNavigationTab {
|
|
7
|
+
text: string;
|
|
8
|
+
route: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SfTabNavigationProps {
|
|
12
|
+
tabs: SfTabNavigationTab[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SfTabNavigationSlots {
|
|
16
|
+
item: (scope: {
|
|
17
|
+
navigate: () => void;
|
|
18
|
+
isActive: boolean;
|
|
19
|
+
}) => VNode[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare type SfTabNavigationEmits = {};
|
|
23
|
+
|
|
24
|
+
declare class SfTabNavigation extends ClassComponent<
|
|
25
|
+
SfTabNavigationProps,
|
|
26
|
+
SfTabNavigationSlots,
|
|
27
|
+
SfTabNavigationEmits
|
|
28
|
+
> {}
|
|
29
|
+
|
|
30
|
+
declare module "@vue/runtime-core" {
|
|
31
|
+
interface GlobalComponents {
|
|
32
|
+
SfTabNavigation: GlobalComponentConstructor<SfTabNavigation>;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Componente para navegação em abas
|
|
38
|
+
*
|
|
39
|
+
* Dependência: router-link.
|
|
40
|
+
* @see [https://router.vuejs.org/api/#router-link-s-v-slot](https://router.vuejs.org/api/#router-link-s-v-slot)
|
|
41
|
+
*/
|
|
42
|
+
export default SfTabNavigation;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onMounted, onBeforeUnmount, ref } from "vue";
|
|
3
|
+
import { SfTabNavigationProps } from "./TabNavigation";
|
|
4
|
+
|
|
5
|
+
const props: SfTabNavigationProps =
|
|
6
|
+
defineProps<SfTabNavigationProps>();
|
|
7
|
+
|
|
8
|
+
const trackerContainer = ref<HTMLInputElement | null>(null);
|
|
9
|
+
const trackerContainerObserver = new ResizeObserver((_) => {
|
|
10
|
+
AjustarIcones();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const isLeftArrowActive = ref(false);
|
|
14
|
+
const isRightArrowActive = ref(false);
|
|
15
|
+
|
|
16
|
+
function Scroll(left: boolean = false) {
|
|
17
|
+
const amount = trackerContainer.value!.clientWidth;
|
|
18
|
+
trackerContainer.value!.scrollLeft += left ? -amount : amount;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function AjustarIcones() {
|
|
22
|
+
const maxScrollValue =
|
|
23
|
+
trackerContainer.value!.scrollWidth -
|
|
24
|
+
trackerContainer.value!.clientWidth;
|
|
25
|
+
|
|
26
|
+
isLeftArrowActive.value! = trackerContainer.value!.scrollLeft > 10;
|
|
27
|
+
|
|
28
|
+
isRightArrowActive.value! =
|
|
29
|
+
trackerContainer.value!.scrollLeft < maxScrollValue - 10;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
trackerContainer.value!.addEventListener("scroll", AjustarIcones);
|
|
34
|
+
trackerContainerObserver.observe(trackerContainer.value!);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
onBeforeUnmount(() => {
|
|
38
|
+
try {
|
|
39
|
+
trackerContainer.value?.removeEventListener(
|
|
40
|
+
"scroll",
|
|
41
|
+
AjustarIcones
|
|
42
|
+
);
|
|
43
|
+
trackerContainerObserver.unobserve(trackerContainer.value!);
|
|
44
|
+
trackerContainerObserver.disconnect();
|
|
45
|
+
} catch {}
|
|
46
|
+
});
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<div class="sf-tab-navigation">
|
|
51
|
+
<div
|
|
52
|
+
:class="['left-arrow', { active: isLeftArrowActive }]"
|
|
53
|
+
@click="Scroll(true)"
|
|
54
|
+
>
|
|
55
|
+
<svg
|
|
56
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
57
|
+
fill="none"
|
|
58
|
+
viewBox="0 0 24 24"
|
|
59
|
+
stroke-width="1.5"
|
|
60
|
+
stroke="currentColor"
|
|
61
|
+
class="w-6 h-6"
|
|
62
|
+
>
|
|
63
|
+
<path
|
|
64
|
+
stroke-linecap="round"
|
|
65
|
+
stroke-linejoin="round"
|
|
66
|
+
d="M15.75 19.5L8.25 12l7.5-7.5"
|
|
67
|
+
/>
|
|
68
|
+
</svg>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<ul ref="trackerContainer">
|
|
72
|
+
<RouterLink
|
|
73
|
+
v-for="tab in props.tabs"
|
|
74
|
+
:to="tab.route"
|
|
75
|
+
:custom="true"
|
|
76
|
+
v-slot="{ navigate, isActive }"
|
|
77
|
+
>
|
|
78
|
+
<li :data-active="isActive">
|
|
79
|
+
<slot
|
|
80
|
+
name="item"
|
|
81
|
+
:item="tab"
|
|
82
|
+
:navigate="navigate"
|
|
83
|
+
:is-active="isActive"
|
|
84
|
+
>
|
|
85
|
+
<a
|
|
86
|
+
:href="tab.route"
|
|
87
|
+
:class="{ active: isActive }"
|
|
88
|
+
@click="navigate"
|
|
89
|
+
>
|
|
90
|
+
{{ tab.text }}
|
|
91
|
+
</a>
|
|
92
|
+
</slot>
|
|
93
|
+
</li>
|
|
94
|
+
</RouterLink>
|
|
95
|
+
</ul>
|
|
96
|
+
|
|
97
|
+
<div
|
|
98
|
+
:class="['right-arrow', { active: isRightArrowActive }]"
|
|
99
|
+
@click="Scroll()"
|
|
100
|
+
>
|
|
101
|
+
<svg
|
|
102
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
103
|
+
fill="none"
|
|
104
|
+
viewBox="0 0 24 24"
|
|
105
|
+
stroke-width="1.5"
|
|
106
|
+
stroke="currentColor"
|
|
107
|
+
class="w-6 h-6"
|
|
108
|
+
>
|
|
109
|
+
<path
|
|
110
|
+
stroke-linecap="round"
|
|
111
|
+
stroke-linejoin="round"
|
|
112
|
+
d="M8.25 4.5l7.5 7.5-7.5 7.5"
|
|
113
|
+
/>
|
|
114
|
+
</svg>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</template>
|
package/src/enum/cor.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import SfLayout from "./components/layout/Layout.vue";
|
|
2
|
+
import SfIcon from "./components/icon/Icon.vue";
|
|
3
|
+
import SfNavMenuLink from "./components/navmenulink/NavMenuLink.vue";
|
|
4
|
+
import SfContent from "./components/content/Content.vue";
|
|
5
|
+
import SfTabNavigation from "./components/tabnavigation/TabNavigation.vue";
|
|
6
|
+
import SfButton from "./components/button/Button.vue";
|
|
7
|
+
|
|
8
|
+
import { UseNavMenuService } from "./services/navMenuService";
|
|
9
|
+
import { UseDialogService } from "./services/dialogService";
|
|
10
|
+
import { AuthService } from "./services/authService";
|
|
11
|
+
import { AppResult } from "./common/appResult";
|
|
12
|
+
|
|
13
|
+
import { Cor, Tamanho } from "./enum";
|
|
14
|
+
|
|
15
|
+
import { nextTick } from "vue";
|
|
16
|
+
|
|
17
|
+
import "./style/tema.scss";
|
|
18
|
+
import "./style/componentes.scss";
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
SfLayout,
|
|
22
|
+
SfIcon,
|
|
23
|
+
SfNavMenuLink,
|
|
24
|
+
SfContent,
|
|
25
|
+
SfTabNavigation,
|
|
26
|
+
SfButton,
|
|
27
|
+
AuthService,
|
|
28
|
+
AppResult,
|
|
29
|
+
UseNavMenuService,
|
|
30
|
+
UseDialogService,
|
|
31
|
+
Cor,
|
|
32
|
+
Tamanho,
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* https://stackoverflow.com/questions/37112218/css3-100vh-not-constant-in-mobile-browser
|
|
36
|
+
*/
|
|
37
|
+
(() => {
|
|
38
|
+
function Ajusta() {
|
|
39
|
+
nextTick(() => {
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
const root = document.querySelector(":root");
|
|
42
|
+
root &&
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
root.style.setProperty(
|
|
45
|
+
"--window-height",
|
|
46
|
+
`${window.visualViewport?.height ?? window.innerHeight}px`
|
|
47
|
+
);
|
|
48
|
+
}, 1);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
Ajusta();
|
|
52
|
+
window.addEventListener("resize", Ajusta);
|
|
53
|
+
})();
|
|
54
|
+
|
|
55
|
+
import { ThemeToggleBase } from "./components/internal/ThemeToggle";
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Tema inicial
|
|
59
|
+
*/
|
|
60
|
+
(() => {
|
|
61
|
+
ThemeToggleBase.SetInitialTheme();
|
|
62
|
+
})();
|