@luizleon/sf.prefeiturasp.vuecomponents 0.0.19 → 0.0.20
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 +14 -4
- package/src/common/appResult.ts +0 -22
- package/src/components/button/Button.d.ts +0 -42
- package/src/components/button/Button.vue +0 -61
- package/src/components/content/Content.d.ts +0 -35
- package/src/components/content/Content.vue +0 -41
- package/src/components/icon/Icon.d.ts +0 -38
- package/src/components/icon/Icon.vue +0 -43
- package/src/components/internal/HeaderAvatar.vue +0 -49
- 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/layout/Layout.d.ts +0 -44
- package/src/components/layout/Layout.vue +0 -51
- package/src/components/navmenulink/NavMenuLink.d.ts +0 -35
- package/src/components/navmenulink/NavMenuLink.vue +0 -41
- package/src/components/tabnavigation/TabNavigation.d.ts +0 -42
- package/src/components/tabnavigation/TabNavigation.vue +0 -117
- package/src/enum/cor.ts +0 -9
- package/src/enum/index.ts +0 -2
- package/src/enum/tamanho.ts +0 -5
- package/src/index.ts +0 -62
- package/src/keycloak.d.ts +0 -671
- package/src/keycloak.js +0 -1731
- package/src/services/authService.ts +0 -68
- package/src/services/dialogService.ts +0 -63
- package/src/services/navMenuService.ts +0 -21
- package/src/style/componentes.scss +0 -15
- package/src/style/src/_animation.scss +0 -441
- package/src/style/src/_display.scss +0 -10
- package/src/style/src/_flexbox.scss +0 -85
- package/src/style/src/_functions.scss +0 -171
- package/src/style/src/_gap.scss +0 -8
- package/src/style/src/_grid.scss +0 -100
- package/src/style/src/_mixins.scss +0 -633
- package/src/style/src/_normalize.scss +0 -351
- package/src/style/src/_ripple.scss +0 -30
- package/src/style/src/_size.scss +0 -98
- package/src/style/src/_spacing.scss +0 -42
- package/src/style/src/_typography.scss +0 -43
- package/src/style/src/_variables.scss +0 -87
- package/src/style/src/components/_button.scss +0 -107
- package/src/style/src/components/_content.scss +0 -57
- package/src/style/src/components/_drawer.scss +0 -99
- package/src/style/src/components/_headerAvatar.scss +0 -22
- package/src/style/src/components/_icon.scss +0 -120
- package/src/style/src/components/_internal-icon-button.scss +0 -5
- package/src/style/src/components/_layout.scss +0 -183
- package/src/style/src/components/_loading-circle.scss +0 -24
- 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 -25
- package/src/style/src/components/_tooltip.scss +0 -55
- 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 -863
- 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 -265
- package/src/style/tema.scss +0 -169
- package/src/ts-helpers.d.ts +0 -57
- package/tsconfig.json +0 -19
- package/vite.config.js +0 -26
package/package.json
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luizleon/sf.prefeiturasp.vuecomponents",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
4
8
|
"description": "Pacote de componentes Vue para projetos em SF.",
|
|
5
|
-
"main": "dist/lib.umd.
|
|
6
|
-
"module": "dist/lib.
|
|
9
|
+
"main": "dist/lib.umd.cjs",
|
|
10
|
+
"module": "dist/lib.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/lib.js",
|
|
14
|
+
"require": "./dist/lib.umd.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
7
17
|
"types": "dist/index.d.ts",
|
|
8
18
|
"scripts": {
|
|
9
|
-
"build": "rimraf ./dist/ && vue-tsc --
|
|
19
|
+
"build": "rimraf ./dist/ && vite build && vue-tsc --noemit"
|
|
10
20
|
},
|
|
11
21
|
"dependencies": {
|
|
12
22
|
"air-datepicker": "3.3.1",
|
package/src/common/appResult.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export class AppResult<Value = null> {
|
|
2
|
-
constructor(value: Value | null = null) {
|
|
3
|
-
this._value = value;
|
|
4
|
-
}
|
|
5
|
-
errors: string[] = [];
|
|
6
|
-
private _value?: Value | null = null;
|
|
7
|
-
get value() {
|
|
8
|
-
return this._value as Value;
|
|
9
|
-
}
|
|
10
|
-
set value(v: Value) {
|
|
11
|
-
this._value = v;
|
|
12
|
-
}
|
|
13
|
-
get hasSuccess(): boolean {
|
|
14
|
-
return !this.hasError;
|
|
15
|
-
}
|
|
16
|
-
get hasError(): boolean {
|
|
17
|
-
return this.errors.length > 0;
|
|
18
|
-
}
|
|
19
|
-
WithError(error: string) {
|
|
20
|
-
this.errors.push(error);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { VNode } from "vue";
|
|
2
|
-
import { StyleValue } from "vue";
|
|
3
|
-
import {
|
|
4
|
-
ClassComponent,
|
|
5
|
-
GlobalComponentConstructor,
|
|
6
|
-
} from "../../ts-helpers";
|
|
7
|
-
|
|
8
|
-
export interface SfButtonProps {
|
|
9
|
-
icon?: string;
|
|
10
|
-
visible?: boolean;
|
|
11
|
-
class?: any;
|
|
12
|
-
style?: StyleValue;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
loading?: boolean;
|
|
15
|
-
color?: Color;
|
|
16
|
-
size?: Size;
|
|
17
|
-
variant?: "filled" | "outlined" | "text";
|
|
18
|
-
autofocus?: boolean;
|
|
19
|
-
form?: string;
|
|
20
|
-
name?: string;
|
|
21
|
-
id?: string;
|
|
22
|
-
type?: "submit" | "reset" | "button";
|
|
23
|
-
value?: string | string[] | number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface SfButtonSlots {}
|
|
27
|
-
|
|
28
|
-
export declare type SfButtonEmits = {};
|
|
29
|
-
|
|
30
|
-
declare class SfButton extends ClassComponent<
|
|
31
|
-
SfButtonProps,
|
|
32
|
-
SfButtonSlots,
|
|
33
|
-
SfButtonEmits
|
|
34
|
-
> {}
|
|
35
|
-
|
|
36
|
-
declare module "@vue/runtime-core" {
|
|
37
|
-
interface GlobalComponents {
|
|
38
|
-
SfButton: GlobalComponentConstructor<SfButton>;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default SfButton;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import Icon from "../icon/Icon.vue";
|
|
3
|
-
import { CssClassBuilder } from "../internal/cssClassBuilder";
|
|
4
|
-
import { SfButtonProps } from "./Button";
|
|
5
|
-
|
|
6
|
-
const props: SfButtonProps = withDefaults(
|
|
7
|
-
defineProps<SfButtonProps>(),
|
|
8
|
-
{
|
|
9
|
-
visible: true,
|
|
10
|
-
color: "primary",
|
|
11
|
-
size: "md",
|
|
12
|
-
type: "button",
|
|
13
|
-
variant: "filled",
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
function CssClass() {
|
|
18
|
-
return new CssClassBuilder(`${props.class ?? ""} sf-button`)
|
|
19
|
-
.AddClass("sf-component-loading", props.loading)
|
|
20
|
-
.AddClass("sf-component-disabled", props.disabled)
|
|
21
|
-
.AddClass("sf-button-small", props.size === "sm")
|
|
22
|
-
.AddClass("sf-button-medium", props.size === "md")
|
|
23
|
-
.AddClass("sf-button-large", props.size === "lg")
|
|
24
|
-
.AddClass("sf-button-filled", props.variant === "filled")
|
|
25
|
-
.AddClass("sf-button-text", props.variant === "text")
|
|
26
|
-
.AddClass("sf-button-outlined", props.variant === "outlined")
|
|
27
|
-
.AddClass("sf-button-with-icon", !!props.icon)
|
|
28
|
-
.AddClass("sf-ripple")
|
|
29
|
-
.Build();
|
|
30
|
-
}
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<template>
|
|
34
|
-
<button
|
|
35
|
-
:id="props.id"
|
|
36
|
-
:name="props.name"
|
|
37
|
-
:class="CssClass()"
|
|
38
|
-
:style="props.style"
|
|
39
|
-
:disabled="props.disabled || props.loading"
|
|
40
|
-
:data-color="props.color"
|
|
41
|
-
:form="props.form"
|
|
42
|
-
:type="props.type"
|
|
43
|
-
>
|
|
44
|
-
<Icon
|
|
45
|
-
v-if="!!props.icon"
|
|
46
|
-
:icone="props.icon"
|
|
47
|
-
:loading="props.loading"
|
|
48
|
-
:size="props.size"
|
|
49
|
-
:button-props="{ tabindex: -1 }"
|
|
50
|
-
/>
|
|
51
|
-
<Icon
|
|
52
|
-
v-else-if="props.loading"
|
|
53
|
-
:loading="true"
|
|
54
|
-
:size="props.size"
|
|
55
|
-
:button-props="{ tabindex: -1 }"
|
|
56
|
-
/>
|
|
57
|
-
<span class="sf-button-label">
|
|
58
|
-
<slot name="default"></slot>
|
|
59
|
-
</span>
|
|
60
|
-
</button>
|
|
61
|
-
</template>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { VNode } from "vue";
|
|
2
|
-
import { StyleValue } from "vue";
|
|
3
|
-
import {
|
|
4
|
-
ClassComponent,
|
|
5
|
-
GlobalComponentConstructor,
|
|
6
|
-
} from "../../ts-helpers";
|
|
7
|
-
|
|
8
|
-
export interface SfContentProps {
|
|
9
|
-
class?: any;
|
|
10
|
-
style?: StyleValue;
|
|
11
|
-
disableBodyPadding?: boolean;
|
|
12
|
-
disableHeaderPadding?: boolean;
|
|
13
|
-
disableFooterPadding?: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface SfContentSlots {
|
|
17
|
-
header: () => VNode[];
|
|
18
|
-
footer: () => VNode[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export declare type SfContentEmits = {};
|
|
22
|
-
|
|
23
|
-
declare class SfContent extends ClassComponent<
|
|
24
|
-
SfContentProps,
|
|
25
|
-
SfContentSlots,
|
|
26
|
-
SfContentEmits
|
|
27
|
-
> {}
|
|
28
|
-
|
|
29
|
-
declare module "@vue/runtime-core" {
|
|
30
|
-
interface GlobalComponents {
|
|
31
|
-
SfContent: GlobalComponentConstructor<SfContent>;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default SfContent;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import ScrollToTop from "../internal/ScrollToTop.vue";
|
|
3
|
-
import { SfContentProps } from "./Content";
|
|
4
|
-
import { CssClassBuilder } from "../internal/cssClassBuilder";
|
|
5
|
-
|
|
6
|
-
const props: SfContentProps = defineProps<SfContentProps>();
|
|
7
|
-
|
|
8
|
-
function Css() {
|
|
9
|
-
return new CssClassBuilder("sf-content")
|
|
10
|
-
.AddClass(props.class, !!props.class)
|
|
11
|
-
.Build();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function CssBody() {
|
|
15
|
-
return new CssClassBuilder("sf-content-body")
|
|
16
|
-
.AddClass("sf-content-no-padding", props.disableBodyPadding)
|
|
17
|
-
.Build();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function CssHeader() {
|
|
21
|
-
return new CssClassBuilder("sf-content-header")
|
|
22
|
-
.AddClass("sf-content-no-padding", props.disableHeaderPadding)
|
|
23
|
-
.Build();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function CssFooter() {
|
|
27
|
-
return new CssClassBuilder("sf-content-footer")
|
|
28
|
-
.AddClass("sf-content-no-padding", props.disableFooterPadding)
|
|
29
|
-
.Build();
|
|
30
|
-
}
|
|
31
|
-
</script>
|
|
32
|
-
<template>
|
|
33
|
-
<div :class="Css()" :style="props.style">
|
|
34
|
-
<div :class="CssHeader()"><slot name="header"></slot></div>
|
|
35
|
-
<div :class="CssBody()">
|
|
36
|
-
<slot name="default"></slot>
|
|
37
|
-
<ScrollToTop />
|
|
38
|
-
</div>
|
|
39
|
-
<div :class="CssFooter()"><slot name="footer"></slot></div>
|
|
40
|
-
</div>
|
|
41
|
-
</template>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Cor, Tamanho } from "../../enum";
|
|
2
|
-
import {
|
|
3
|
-
ClassComponent,
|
|
4
|
-
GlobalComponentConstructor,
|
|
5
|
-
} from "../../ts-helpers";
|
|
6
|
-
import { StyleValue, ButtonHTMLAttributes } from "vue";
|
|
7
|
-
|
|
8
|
-
export interface SfIconProps {
|
|
9
|
-
icone?: string;
|
|
10
|
-
visible?: boolean;
|
|
11
|
-
class?: any;
|
|
12
|
-
style?: StyleValue;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
loading?: boolean;
|
|
15
|
-
button?: boolean;
|
|
16
|
-
tamanho?: Tamanho;
|
|
17
|
-
dot?: boolean;
|
|
18
|
-
dotColor?: Cor;
|
|
19
|
-
buttonProps?: ButtonHTMLAttributes;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface SfIconSlots {}
|
|
23
|
-
|
|
24
|
-
export declare type SfIconEmits = {};
|
|
25
|
-
|
|
26
|
-
declare class SfIcon extends ClassComponent<
|
|
27
|
-
SfIconProps,
|
|
28
|
-
SfIconSlots,
|
|
29
|
-
SfIconEmits
|
|
30
|
-
> {}
|
|
31
|
-
|
|
32
|
-
declare module "@vue/runtime-core" {
|
|
33
|
-
interface GlobalComponents {
|
|
34
|
-
SfIcon: GlobalComponentConstructor<SfIcon>;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default SfIcon;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { Cor, Tamanho } from "../../enum";
|
|
3
|
-
import LoadingCircle from "../internal/LoadingCircle.vue";
|
|
4
|
-
import { CssClassBuilder } from "../internal/cssClassBuilder";
|
|
5
|
-
import { SfIconProps } from "./Icon";
|
|
6
|
-
|
|
7
|
-
const props: SfIconProps = withDefaults(defineProps<SfIconProps>(), {
|
|
8
|
-
visible: true,
|
|
9
|
-
class: "",
|
|
10
|
-
style: "",
|
|
11
|
-
tamanho: Tamanho.Medio,
|
|
12
|
-
dotColor: Cor.Error,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
function CssClass() {
|
|
16
|
-
return new CssClassBuilder(`${props.class} sf-icon`)
|
|
17
|
-
.AddClass("sf-component-loading", props.loading)
|
|
18
|
-
.AddClass("sf-component-disabled", props.disabled)
|
|
19
|
-
.AddClass("sf-icon-button", props.button)
|
|
20
|
-
.AddClass("sf-icon-small", props.tamanho === Tamanho.Pequeno)
|
|
21
|
-
.AddClass("sf-icon-medium", props.tamanho === Tamanho.Medio)
|
|
22
|
-
.AddClass("sf-icon-large", props.tamanho === Tamanho.Grande)
|
|
23
|
-
.AddClass("sf-ripple", props.button === true)
|
|
24
|
-
.Build();
|
|
25
|
-
}
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<template>
|
|
29
|
-
<div :style="props.style" :class="CssClass()">
|
|
30
|
-
<button
|
|
31
|
-
class="material-symbols-outlined"
|
|
32
|
-
:disabled="props.disabled || props.loading"
|
|
33
|
-
v-bind="props.buttonProps"
|
|
34
|
-
:tabindex="!props.button ? -1 : undefined"
|
|
35
|
-
>
|
|
36
|
-
<template v-if="props.loading">
|
|
37
|
-
<LoadingCircle></LoadingCircle>
|
|
38
|
-
</template>
|
|
39
|
-
<template v-else>{{ props.icone }}</template>
|
|
40
|
-
</button>
|
|
41
|
-
<span v-if="props.dot" :data-color="props.dotColor"></span>
|
|
42
|
-
</div>
|
|
43
|
-
</template>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { AuthService } from "../../services/authService";
|
|
3
|
-
import { UseDialogService } from "../../services/dialogService";
|
|
4
|
-
|
|
5
|
-
const dialogService = UseDialogService();
|
|
6
|
-
|
|
7
|
-
const letters = Letters();
|
|
8
|
-
|
|
9
|
-
async function Logout() {
|
|
10
|
-
const confirm = await dialogService.ConfirmAsync({
|
|
11
|
-
text: `${AuthService.User.username} - ${AuthService.User.name}.<br /><br />Você deseja sair da conta?`,
|
|
12
|
-
confirmLabel: "sair",
|
|
13
|
-
});
|
|
14
|
-
if (!confirm) return;
|
|
15
|
-
AuthService.CallLogout();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function Letters() {
|
|
19
|
-
const name = AuthService.User.name;
|
|
20
|
-
let letters = "?";
|
|
21
|
-
if (!name) return letters;
|
|
22
|
-
|
|
23
|
-
const parts = name
|
|
24
|
-
.split(" ")
|
|
25
|
-
.filter((x) => x.length > 0)
|
|
26
|
-
.map((x) => x[0].toUpperCase());
|
|
27
|
-
|
|
28
|
-
const count = Math.min(2, parts.length);
|
|
29
|
-
|
|
30
|
-
letters = parts.slice(0, count).join("");
|
|
31
|
-
|
|
32
|
-
return letters.length > 0 ? letters : "?";
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function Color() {
|
|
36
|
-
const primeiraLetra = letters[0];
|
|
37
|
-
const cor =
|
|
38
|
-
primeiraLetra === "?"
|
|
39
|
-
? 0
|
|
40
|
-
: (primeiraLetra.charCodeAt(0) - 64) % 19;
|
|
41
|
-
return Math.max(cor, 0);
|
|
42
|
-
}
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<template>
|
|
46
|
-
<div id="sf-header-avatar" :data-cor="Color()" @click="Logout">
|
|
47
|
-
{{ letters }}
|
|
48
|
-
</div>
|
|
49
|
-
</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,44 +0,0 @@
|
|
|
1
|
-
import { VNode } from "vue";
|
|
2
|
-
import {
|
|
3
|
-
ClassComponent,
|
|
4
|
-
GlobalComponentConstructor,
|
|
5
|
-
} from "../ts-helpers";
|
|
6
|
-
|
|
7
|
-
export interface SfLayoutProps {}
|
|
8
|
-
|
|
9
|
-
export interface SfLayoutSlots {
|
|
10
|
-
/**
|
|
11
|
-
* Título ao lado do botão do menu
|
|
12
|
-
*/
|
|
13
|
-
title: () => VNode[];
|
|
14
|
-
/**
|
|
15
|
-
* Conteúdo para ficar no menu
|
|
16
|
-
*/
|
|
17
|
-
menu: () => VNode[];
|
|
18
|
-
/**
|
|
19
|
-
* Visível no footer da aplicação.
|
|
20
|
-
*/
|
|
21
|
-
"app-version": () => VNode[];
|
|
22
|
-
/**
|
|
23
|
-
* Conteúdo principal
|
|
24
|
-
*/
|
|
25
|
-
content: () => VNode[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export declare type SfLayoutEmits = {
|
|
29
|
-
mounted: () => void;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
declare class SfLayout extends ClassComponent<
|
|
33
|
-
SfLayoutProps,
|
|
34
|
-
SfLayoutSlots,
|
|
35
|
-
SfLayoutEmits
|
|
36
|
-
> {}
|
|
37
|
-
|
|
38
|
-
declare module "@vue/runtime-core" {
|
|
39
|
-
interface GlobalComponents {
|
|
40
|
-
SfLayout: GlobalComponentConstructor<SfLayout>;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default SfLayout;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { UseNavMenuService } from "../../services/navMenuService";
|
|
3
|
-
import Icon from "../icon/Icon.vue";
|
|
4
|
-
import HeaderAvatar from "../internal/HeaderAvatar.vue";
|
|
5
|
-
import MenuIcon from "../internal/MenuIcon.vue";
|
|
6
|
-
import ThemeToggle from "../internal/ThemeToggle.vue";
|
|
7
|
-
|
|
8
|
-
const navService = UseNavMenuService();
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
<div id="sf-layout">
|
|
13
|
-
<header>
|
|
14
|
-
<div
|
|
15
|
-
:class="[
|
|
16
|
-
'sf-layout-menu-toggler',
|
|
17
|
-
{ invert: navService.IsVisible },
|
|
18
|
-
]"
|
|
19
|
-
@click="navService.Toggle()"
|
|
20
|
-
>
|
|
21
|
-
<div class="sf-layout-menu-toggler-logo"></div>
|
|
22
|
-
<MenuIcon />
|
|
23
|
-
</div>
|
|
24
|
-
<div class="title">
|
|
25
|
-
<slot name="title"></slot>
|
|
26
|
-
</div>
|
|
27
|
-
<slot name="action"> </slot>
|
|
28
|
-
<ThemeToggle />
|
|
29
|
-
<HeaderAvatar />
|
|
30
|
-
</header>
|
|
31
|
-
<nav :class="{ visible: navService.IsVisible }">
|
|
32
|
-
<div class="sf-layout-nav-header">
|
|
33
|
-
<span>Menu</span>
|
|
34
|
-
<Icon
|
|
35
|
-
:icone="'close'"
|
|
36
|
-
button
|
|
37
|
-
@click="navService.Close()"
|
|
38
|
-
></Icon>
|
|
39
|
-
</div>
|
|
40
|
-
<div class="sf-layout-nav-content">
|
|
41
|
-
<slot name="menu"></slot>
|
|
42
|
-
</div>
|
|
43
|
-
</nav>
|
|
44
|
-
<main :class="{ 'menu-visible': navService.IsVisible }">
|
|
45
|
-
<section id="sf-layout-page-title"></section>
|
|
46
|
-
<section id="sf-layout-content">
|
|
47
|
-
<slot name="content"></slot>
|
|
48
|
-
</section>
|
|
49
|
-
</main>
|
|
50
|
-
</div>
|
|
51
|
-
</template>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClassComponent,
|
|
3
|
-
GlobalComponentConstructor,
|
|
4
|
-
} from "../../ts-helpers";
|
|
5
|
-
|
|
6
|
-
export interface SfNavMenuLinkProps {
|
|
7
|
-
href: string;
|
|
8
|
-
text: string;
|
|
9
|
-
icon?: string;
|
|
10
|
-
exact?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface SfNavMenuLinkSlots {}
|
|
14
|
-
|
|
15
|
-
export declare type SfNavMenuLinkEmits = {};
|
|
16
|
-
|
|
17
|
-
declare class SfNavMenuLink extends ClassComponent<
|
|
18
|
-
SfNavMenuLinkProps,
|
|
19
|
-
SfNavMenuLinkSlots,
|
|
20
|
-
SfNavMenuLinkEmits
|
|
21
|
-
> {}
|
|
22
|
-
|
|
23
|
-
declare module "@vue/runtime-core" {
|
|
24
|
-
interface GlobalComponents {
|
|
25
|
-
SfNavMenuLink: GlobalComponentConstructor<SfNavMenuLink>;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Componente para navegação no menu.
|
|
31
|
-
*
|
|
32
|
-
* Dependência: router-link.
|
|
33
|
-
* @see [https://router.vuejs.org/api/#router-link-s-v-slot](https://router.vuejs.org/api/#router-link-s-v-slot)
|
|
34
|
-
*/
|
|
35
|
-
export default SfNavMenuLink;
|