@edm-sdui/sdui 1.0.1 → 1.0.2
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/fesm2022/edm-sdui-sdui.mjs +2324 -0
- package/fesm2022/edm-sdui-sdui.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/navigation-controls/navigation-controls.component.d.ts +11 -0
- package/lib/components/uicomponent/button/button.component.d.ts +16 -0
- package/lib/components/uicomponent/column/column.component.d.ts +10 -0
- package/lib/components/uicomponent/image/image.component.d.ts +14 -0
- package/lib/components/uicomponent/label/label.component.d.ts +14 -0
- package/lib/components/uicomponent/row/row.component.d.ts +10 -0
- package/lib/components/uicomponent/row-divisor/row-divisor.component.d.ts +10 -0
- package/lib/components/uicomponent/search-bar/search-bar.component.d.ts +16 -0
- package/lib/components/uicomponent/space/space.component.d.ts +10 -0
- package/lib/components/uicomponent/tag/tag.component.d.ts +16 -0
- package/lib/components/uicomponent/uicomponent.component.d.ts +16 -0
- package/lib/components/uicomponent/zstack/zstack.component.d.ts +10 -0
- package/lib/components/uilayout/centered-content-layout/centered-content-layout.component.d.ts +9 -0
- package/lib/components/uilayout/single-column-layout/single-column-layout.component.d.ts +9 -0
- package/lib/components/uilayout/uinavigation/uinavigation.component.d.ts +7 -0
- package/lib/components/uiscreen/uiscreen.component.d.ts +10 -0
- package/lib/core/services/ui-action.service.d.ts +10 -0
- package/lib/core/services/uiscreen.service.d.ts +23 -0
- package/lib/core/tokens/sdui-config.token.d.ts +2 -0
- package/lib/core/uicomposition/enums/uicomponent-type.d.ts +19 -0
- package/lib/core/uicomposition/enums/uiplatform-type.d.ts +4 -0
- package/lib/core/uicomposition/enums/uiscene.d.ts +3 -0
- package/lib/core/uicomposition/enums/uiscreen-identifier.d.ts +4 -0
- package/lib/core/uicomposition/mapping/component-mapping.d.ts +3 -0
- package/{src/lib/core/uicomposition/models/uicentered-content-layout.ts → lib/core/uicomposition/models/uicentered-content-layout.d.ts} +5 -6
- package/{src/lib/core/uicomposition/models/uicomponent.ts → lib/core/uicomposition/models/uicomponent.d.ts} +4 -5
- package/lib/core/uicomposition/models/uielement.d.ts +24 -0
- package/lib/core/uicomposition/models/uilayout.d.ts +3 -0
- package/{src/lib/core/uicomposition/models/uinavigation.ts → lib/core/uicomposition/models/uinavigation.d.ts} +2 -3
- package/{src/lib/core/uicomposition/models/uiscreen.ts → lib/core/uicomposition/models/uiscreen.d.ts} +5 -6
- package/{src/lib/core/uicomposition/models/uisingle-column-layout.ts → lib/core/uicomposition/models/uisingle-column-layout.d.ts} +4 -5
- package/{src/lib/core/uicomposition/models/uiview.ts → lib/core/uicomposition/models/uiview.d.ts} +7 -9
- package/lib/core/uitheme/enums/uiaction-type.d.ts +9 -0
- package/lib/core/uitheme/enums/uialignment-type.d.ts +5 -0
- package/lib/core/uitheme/enums/uiaspect-type.d.ts +4 -0
- package/lib/core/uitheme/enums/uiasset.d.ts +353 -0
- package/lib/core/uitheme/enums/uicolor.d.ts +129 -0
- package/lib/core/uitheme/enums/uicontent-type.d.ts +8 -0
- package/lib/core/uitheme/enums/uipadding-level.d.ts +10 -0
- package/lib/core/uitheme/enums/uipresentation-style.d.ts +5 -0
- package/lib/core/uitheme/enums/uiradius-level.d.ts +8 -0
- package/lib/core/uitheme/enums/uishadow-blur-radius.d.ts +3 -0
- package/lib/core/uitheme/enums/uishadow-offset.d.ts +3 -0
- package/lib/core/uitheme/enums/uisize.d.ts +11 -0
- package/lib/core/uitheme/enums/uispacing-level.d.ts +6 -0
- package/lib/core/uitheme/enums/uitext-style.d.ts +13 -0
- package/lib/core/uitheme/mapping/alignment-mapping.d.ts +2 -0
- package/lib/core/uitheme/mapping/asset-mapping.d.ts +2 -0
- package/lib/core/uitheme/mapping/color-mapping.d.ts +2 -0
- package/lib/core/uitheme/mapping/pad-mapping.d.ts +2 -0
- package/lib/core/uitheme/mapping/radius-mapping.d.ts +2 -0
- package/lib/core/uitheme/mapping/size-mapping.d.ts +3 -0
- package/lib/core/uitheme/mapping/space-mapping.d.ts +2 -0
- package/lib/core/uitheme/mapping/text-style-mapping.d.ts +2 -0
- package/lib/core/uitheme/models/uiaction.d.ts +9 -0
- package/{src/lib/core/uitheme/models/uialignment.ts → lib/core/uitheme/models/uialignment.d.ts} +1 -2
- package/{src/lib/core/uitheme/models/uibackground.ts → lib/core/uitheme/models/uibackground.d.ts} +1 -2
- package/lib/core/uitheme/models/uipadding.d.ts +7 -0
- package/lib/core/uitheme/models/uiradius.d.ts +7 -0
- package/{src/lib/core/uitheme/models/uishadow.ts → lib/core/uitheme/models/uishadow.d.ts} +5 -6
- package/{src/lib/core/uitheme/models/uispacing.ts → lib/core/uitheme/models/uispacing.d.ts} +1 -2
- package/lib/core/utils/url-parser.util.d.ts +2 -0
- package/lib/core/view-models/uiscreen.viewmodel.d.ts +39 -0
- package/lib/directives/uiview.directive.d.ts +28 -0
- package/lib/sdui-routing.module.d.ts +9 -0
- package/lib/sdui.component.d.ts +16 -0
- package/lib/sdui.module.d.ts +34 -0
- package/package.json +16 -14
- package/public-api.d.ts +4 -0
- package/ng-package.json +0 -9
- package/src/index.ts +0 -1
- package/src/lib/components/navigation-controls/navigation-controls.component.html +0 -9
- package/src/lib/components/navigation-controls/navigation-controls.component.scss +0 -35
- package/src/lib/components/navigation-controls/navigation-controls.component.ts +0 -27
- package/src/lib/components/uicomponent/button/button.component.html +0 -4
- package/src/lib/components/uicomponent/button/button.component.scss +0 -11
- package/src/lib/components/uicomponent/button/button.component.ts +0 -64
- package/src/lib/components/uicomponent/column/column.component.html +0 -7
- package/src/lib/components/uicomponent/column/column.component.scss +0 -9
- package/src/lib/components/uicomponent/column/column.component.ts +0 -16
- package/src/lib/components/uicomponent/image/image.component.html +0 -1
- package/src/lib/components/uicomponent/image/image.component.scss +0 -3
- package/src/lib/components/uicomponent/image/image.component.ts +0 -69
- package/src/lib/components/uicomponent/label/label.component.html +0 -3
- package/src/lib/components/uicomponent/label/label.component.scss +0 -3
- package/src/lib/components/uicomponent/label/label.component.ts +0 -66
- package/src/lib/components/uicomponent/row/row.component.html +0 -7
- package/src/lib/components/uicomponent/row/row.component.scss +0 -8
- package/src/lib/components/uicomponent/row/row.component.ts +0 -16
- package/src/lib/components/uicomponent/row-divisor/row-divisor.component.html +0 -5
- package/src/lib/components/uicomponent/row-divisor/row-divisor.component.scss +0 -8
- package/src/lib/components/uicomponent/row-divisor/row-divisor.component.ts +0 -16
- package/src/lib/components/uicomponent/search-bar/search-bar.component.html +0 -7
- package/src/lib/components/uicomponent/search-bar/search-bar.component.scss +0 -7
- package/src/lib/components/uicomponent/search-bar/search-bar.component.ts +0 -129
- package/src/lib/components/uicomponent/space/space.component.html +0 -1
- package/src/lib/components/uicomponent/space/space.component.scss +0 -10
- package/src/lib/components/uicomponent/space/space.component.ts +0 -16
- package/src/lib/components/uicomponent/tag/tag.component.html +0 -3
- package/src/lib/components/uicomponent/tag/tag.component.scss +0 -7
- package/src/lib/components/uicomponent/tag/tag.component.ts +0 -54
- package/src/lib/components/uicomponent/uicomponent.component.html +0 -5
- package/src/lib/components/uicomponent/uicomponent.component.scss +0 -3
- package/src/lib/components/uicomponent/uicomponent.component.ts +0 -53
- package/src/lib/components/uicomponent/zstack/zstack.component.html +0 -6
- package/src/lib/components/uicomponent/zstack/zstack.component.scss +0 -12
- package/src/lib/components/uicomponent/zstack/zstack.component.ts +0 -16
- package/src/lib/components/uilayout/centered-content-layout/centered-content-layout.component.html +0 -20
- package/src/lib/components/uilayout/centered-content-layout/centered-content-layout.component.scss +0 -36
- package/src/lib/components/uilayout/centered-content-layout/centered-content-layout.component.ts +0 -21
- package/src/lib/components/uilayout/single-column-layout/single-column-layout.component.html +0 -22
- package/src/lib/components/uilayout/single-column-layout/single-column-layout.component.scss +0 -37
- package/src/lib/components/uilayout/single-column-layout/single-column-layout.component.ts +0 -27
- package/src/lib/components/uilayout/uinavigation/uinavigation.component.html +0 -8
- package/src/lib/components/uilayout/uinavigation/uinavigation.component.scss +0 -4
- package/src/lib/components/uilayout/uinavigation/uinavigation.component.ts +0 -12
- package/src/lib/components/uiscreen/uiscreen.component.html +0 -29
- package/src/lib/components/uiscreen/uiscreen.component.scss +0 -12
- package/src/lib/components/uiscreen/uiscreen.component.ts +0 -15
- package/src/lib/core/interfaces/sdui-config.interface.ts +0 -3
- package/src/lib/core/services/navigation.service.ts +0 -25
- package/src/lib/core/services/sdui-config.service.ts +0 -19
- package/src/lib/core/services/ui-action.service.ts +0 -36
- package/src/lib/core/services/uiscreen.service.ts +0 -185
- package/src/lib/core/tokens/sdui-config.token.ts +0 -3
- package/src/lib/core/uicomposition/enums/uicomponent-type.ts +0 -32
- package/src/lib/core/uicomposition/enums/uiplatform-type.ts +0 -4
- package/src/lib/core/uicomposition/enums/uiscene.ts +0 -3
- package/src/lib/core/uicomposition/enums/uiscreen-identifier.ts +0 -4
- package/src/lib/core/uicomposition/mapping/component-mapping.ts +0 -90
- package/src/lib/core/uicomposition/models/uielement.ts +0 -25
- package/src/lib/core/uicomposition/models/uilayout.ts +0 -4
- package/src/lib/core/uitheme/enums/uiaction-type.ts +0 -14
- package/src/lib/core/uitheme/enums/uialignment-type.ts +0 -5
- package/src/lib/core/uitheme/enums/uiaspect-type.ts +0 -4
- package/src/lib/core/uitheme/enums/uiasset.ts +0 -361
- package/src/lib/core/uitheme/enums/uicolor.ts +0 -129
- package/src/lib/core/uitheme/enums/uicontent-type.ts +0 -8
- package/src/lib/core/uitheme/enums/uipadding-level.ts +0 -10
- package/src/lib/core/uitheme/enums/uipresentation-style.ts +0 -5
- package/src/lib/core/uitheme/enums/uiradius-level.ts +0 -8
- package/src/lib/core/uitheme/enums/uishadow-blur-radius.ts +0 -3
- package/src/lib/core/uitheme/enums/uishadow-offset.ts +0 -3
- package/src/lib/core/uitheme/enums/uisize.ts +0 -12
- package/src/lib/core/uitheme/enums/uispacing-level.ts +0 -6
- package/src/lib/core/uitheme/enums/uitext-style.ts +0 -13
- package/src/lib/core/uitheme/mapping/alignment-mapping.ts +0 -7
- package/src/lib/core/uitheme/mapping/asset-mapping.ts +0 -363
- package/src/lib/core/uitheme/mapping/color-mapping.ts +0 -131
- package/src/lib/core/uitheme/mapping/pad-mapping.ts +0 -12
- package/src/lib/core/uitheme/mapping/radius-mapping.ts +0 -10
- package/src/lib/core/uitheme/mapping/size-mapping.ts +0 -25
- package/src/lib/core/uitheme/mapping/space-mapping.ts +0 -8
- package/src/lib/core/uitheme/mapping/text-style-mapping.ts +0 -15
- package/src/lib/core/uitheme/models/uiaction.ts +0 -10
- package/src/lib/core/uitheme/models/uipadding.ts +0 -8
- package/src/lib/core/uitheme/models/uiradius.ts +0 -8
- package/src/lib/core/uitheme/models/uiview.ts +0 -0
- package/src/lib/core/utils/url-parser.util.ts +0 -24
- package/src/lib/core/view-models/uiscreen.viewmodel.ts +0 -115
- package/src/lib/directives/uiview.directive.ts +0 -207
- package/src/lib/sdui-routing.module.ts +0 -22
- package/src/lib/sdui.component.html +0 -3
- package/src/lib/sdui.component.scss +0 -11
- package/src/lib/sdui.component.ts +0 -65
- package/src/lib/sdui.module.ts +0 -84
- package/src/public-api.ts +0 -16
- package/tsconfig.lib.json +0 -16
- package/tsconfig.spec.json +0 -12
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { BehaviorSubject, catchError, finalize, Observable, of } from 'rxjs';
|
|
3
|
-
import { UIScreen } from '../uicomposition/models/uiscreen';
|
|
4
|
-
import { UIScreenService } from '../services/uiscreen.service';
|
|
5
|
-
import { UIScreenIdentifier } from '../uicomposition/enums/uiscreen-identifier';
|
|
6
|
-
import { Location } from '@angular/common';
|
|
7
|
-
import { ActivatedRoute, Router } from '@angular/router';
|
|
8
|
-
import { tap } from 'rxjs/operators';
|
|
9
|
-
|
|
10
|
-
export const SDUI_URL_PARAM = 'sduiUrl';
|
|
11
|
-
|
|
12
|
-
@Injectable({
|
|
13
|
-
providedIn: 'root',
|
|
14
|
-
})
|
|
15
|
-
export class UIScreenViewModel {
|
|
16
|
-
private uiScreenSubject = new BehaviorSubject<UIScreen | null>(null);
|
|
17
|
-
private isLoadingSubject = new BehaviorSubject<boolean>(false);
|
|
18
|
-
private errorSubject = new BehaviorSubject<string | null>(null);
|
|
19
|
-
private navigationHistorySubject = new BehaviorSubject<string[]>([]);
|
|
20
|
-
private canGoBackSubject = new BehaviorSubject<boolean>(false);
|
|
21
|
-
private currentUrlSubject = new BehaviorSubject<string | null>(null);
|
|
22
|
-
|
|
23
|
-
public uiScreen$ = this.uiScreenSubject.asObservable();
|
|
24
|
-
public isLoading$ = this.isLoadingSubject.asObservable();
|
|
25
|
-
public error$ = this.errorSubject.asObservable();
|
|
26
|
-
public navigationHistory$ = this.navigationHistorySubject.asObservable();
|
|
27
|
-
public canGoBack$ = this.canGoBackSubject.asObservable();
|
|
28
|
-
public currentUrl$ = this.currentUrlSubject.asObservable();
|
|
29
|
-
|
|
30
|
-
constructor(
|
|
31
|
-
private uiScreenService: UIScreenService,
|
|
32
|
-
private location: Location //private router: Router, //private route: ActivatedRoute
|
|
33
|
-
) {
|
|
34
|
-
console.debug('[UIScreenViewModel] Inicializado');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Atualiza o estado do botão de voltar com base no tamanho do histórico
|
|
39
|
-
*/
|
|
40
|
-
private updateCanGoBack(): void {
|
|
41
|
-
const history = this.navigationHistorySubject.getValue();
|
|
42
|
-
const canGoBack = history.length > 1;
|
|
43
|
-
console.debug(
|
|
44
|
-
`[UIScreenViewModel] Histórico: ${history.length} item(s), pode voltar: ${canGoBack}`
|
|
45
|
-
);
|
|
46
|
-
this.canGoBackSubject.next(canGoBack);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
loadUIScreen(url: string, shouldUpdateHistory: boolean = true, shouldUpdateBrowserUrl: boolean = false): void {
|
|
50
|
-
console.debug(`[UIScreenViewModel] Carregando tela: ${url}`);
|
|
51
|
-
|
|
52
|
-
if (shouldUpdateHistory) {
|
|
53
|
-
const history = this.navigationHistorySubject.getValue();
|
|
54
|
-
this.navigationHistorySubject.next([...history, url]);
|
|
55
|
-
this.updateCanGoBack();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (shouldUpdateBrowserUrl) {
|
|
59
|
-
this.location.go(url);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
this.loadUIScreenInternal(url);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private loadUIScreenInternal(url: string): void {
|
|
66
|
-
this.isLoadingSubject.next(true);
|
|
67
|
-
this.errorSubject.next(null);
|
|
68
|
-
|
|
69
|
-
this.uiScreenService
|
|
70
|
-
.getUIScreen(url)
|
|
71
|
-
.pipe(
|
|
72
|
-
tap(() => console.debug('[UIScreenViewModel] URL carregada:', url)),
|
|
73
|
-
finalize(() => this.isLoadingSubject.next(false)),
|
|
74
|
-
catchError((error) => {
|
|
75
|
-
this.errorSubject.next(`Erro ao carregar tela: ${error.message}`);
|
|
76
|
-
return of(null);
|
|
77
|
-
})
|
|
78
|
-
)
|
|
79
|
-
.subscribe((screen: UIScreen | null) => {
|
|
80
|
-
if (screen) {
|
|
81
|
-
console.debug('[UIScreenViewModel] nova screen:', screen.identifier);
|
|
82
|
-
this.currentUrlSubject.next(url);
|
|
83
|
-
this.uiScreenSubject.next(screen);
|
|
84
|
-
} else {
|
|
85
|
-
console.debug('[UIScreenViewModel] nova screen nula!');
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Volta para a tela anterior
|
|
92
|
-
*/
|
|
93
|
-
goBack(): void {
|
|
94
|
-
const history = this.navigationHistorySubject.getValue();
|
|
95
|
-
|
|
96
|
-
if (history.length > 1) {
|
|
97
|
-
// Remove o último item da pilha
|
|
98
|
-
const newHistory = history.slice(0, -1);
|
|
99
|
-
const previousUrl = newHistory[newHistory.length - 1];
|
|
100
|
-
|
|
101
|
-
console.debug(`[UIScreenViewModel] Voltando para: ${previousUrl}`);
|
|
102
|
-
this.navigationHistorySubject.next(newHistory);
|
|
103
|
-
this.location.back();
|
|
104
|
-
this.updateCanGoBack();
|
|
105
|
-
this.loadUIScreenInternal(previousUrl);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Verifica se é possível voltar
|
|
111
|
-
*/
|
|
112
|
-
canGoBack(): boolean {
|
|
113
|
-
return this.navigationHistorySubject.getValue().length > 1;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Directive,
|
|
3
|
-
ElementRef,
|
|
4
|
-
Host,
|
|
5
|
-
HostListener,
|
|
6
|
-
Input,
|
|
7
|
-
OnChanges,
|
|
8
|
-
Optional,
|
|
9
|
-
Renderer2,
|
|
10
|
-
SimpleChanges,
|
|
11
|
-
} from '@angular/core';
|
|
12
|
-
import { UIView } from '../core/uicomposition/models/uiview';
|
|
13
|
-
import { UIPadding } from '../core/uitheme/models/uipadding';
|
|
14
|
-
import { UIBackground } from '../core/uitheme/models/uibackground';
|
|
15
|
-
import { UIAction } from '../core/uitheme/models/uiaction';
|
|
16
|
-
import { UIAlignment } from '../core/uitheme/models/uialignment';
|
|
17
|
-
import { UIShadow } from '../core/uitheme/models/uishadow';
|
|
18
|
-
import { UIRadius } from '../core/uitheme/models/uiradius';
|
|
19
|
-
import { UISpacing } from '../core/uitheme/models/uispacing';
|
|
20
|
-
import { spaceMapping } from '../core/uitheme/mapping/space-mapping';
|
|
21
|
-
import { colorMapping } from '../core/uitheme/mapping/color-mapping';
|
|
22
|
-
import { padMapping } from '../core/uitheme/mapping/pad-mapping';
|
|
23
|
-
import { radiusMapping } from '../core/uitheme/mapping/radius-mapping';
|
|
24
|
-
import { alignmentMapping } from '../core/uitheme/mapping/alignment-mapping';
|
|
25
|
-
import { Router } from '@angular/router';
|
|
26
|
-
import { UIScreenViewModel } from '../core/view-models/uiscreen.viewmodel';
|
|
27
|
-
import { UIActionService } from '../core/services/ui-action.service';
|
|
28
|
-
|
|
29
|
-
@Directive({
|
|
30
|
-
selector: '[edmSduiView]',
|
|
31
|
-
standalone: false,
|
|
32
|
-
})
|
|
33
|
-
export class UIViewDirective implements OnChanges {
|
|
34
|
-
@Input() edmSduiView?: UIView;
|
|
35
|
-
@Input() disableClick: boolean = false;
|
|
36
|
-
|
|
37
|
-
constructor(
|
|
38
|
-
private elementRef: ElementRef,
|
|
39
|
-
private renderer: Renderer2,
|
|
40
|
-
private router: Router,
|
|
41
|
-
private actionService: UIActionService,
|
|
42
|
-
@Optional() private screenViewModel: UIScreenViewModel
|
|
43
|
-
) {}
|
|
44
|
-
|
|
45
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
46
|
-
if (this.edmSduiView) {
|
|
47
|
-
this.applyStyles(this.edmSduiView);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
private applyStyles(uiView: UIView) {
|
|
52
|
-
if (uiView.padding) {
|
|
53
|
-
this.applyPadding(uiView.padding);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (uiView.background) {
|
|
57
|
-
this.applyBackground(uiView.background);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (uiView.action) {
|
|
61
|
-
this.applyAction(uiView.action);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (uiView.alignment) {
|
|
65
|
-
this.applyAlignment(uiView.alignment);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (uiView.shadow) {
|
|
69
|
-
this.applyShadow(uiView.shadow);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (uiView.radius) {
|
|
73
|
-
this.applyRadius(uiView.radius);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (uiView.spacing) {
|
|
77
|
-
this.applySpacing(uiView.spacing);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
private applyPadding(uiPadding: UIPadding) {
|
|
82
|
-
if (uiPadding.top) {
|
|
83
|
-
const padValue = padMapping[uiPadding.top];
|
|
84
|
-
this.renderer.setStyle(
|
|
85
|
-
this.elementRef.nativeElement,
|
|
86
|
-
'margin-top',
|
|
87
|
-
padValue
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
if (uiPadding.left) {
|
|
91
|
-
const padValue = padMapping[uiPadding.left];
|
|
92
|
-
this.renderer.setStyle(
|
|
93
|
-
this.elementRef.nativeElement,
|
|
94
|
-
'margin-left',
|
|
95
|
-
padValue
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
if (uiPadding.right) {
|
|
99
|
-
const padValue = padMapping[uiPadding.right];
|
|
100
|
-
this.renderer.setStyle(
|
|
101
|
-
this.elementRef.nativeElement,
|
|
102
|
-
'margin-right',
|
|
103
|
-
padValue
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
if (uiPadding.bottom) {
|
|
107
|
-
const padValue = padMapping[uiPadding.bottom];
|
|
108
|
-
this.renderer.setStyle(
|
|
109
|
-
this.elementRef.nativeElement,
|
|
110
|
-
'margin-bottom',
|
|
111
|
-
padValue
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
private applyBackground(uiBackground: UIBackground) {
|
|
117
|
-
if (uiBackground.backgroundColor) {
|
|
118
|
-
const backgroundColor = colorMapping[uiBackground.backgroundColor];
|
|
119
|
-
this.renderer.setStyle(
|
|
120
|
-
this.elementRef.nativeElement,
|
|
121
|
-
'background-color',
|
|
122
|
-
backgroundColor
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
private applyAction(uiAction: UIAction) {
|
|
128
|
-
if (this.disableClick) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
this.renderer.setStyle(this.elementRef.nativeElement, 'cursor', 'pointer');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
private applyAlignment(uiAlignment: UIAlignment) {
|
|
136
|
-
if (uiAlignment.alignment) {
|
|
137
|
-
// console.debug('alignment:', uiAlignment.alignment);
|
|
138
|
-
const alignment = alignmentMapping[uiAlignment.alignment];
|
|
139
|
-
this.renderer.setStyle(
|
|
140
|
-
this.elementRef.nativeElement,
|
|
141
|
-
'align-items',
|
|
142
|
-
alignment
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
private applyShadow(uiShadow: UIShadow) {}
|
|
148
|
-
|
|
149
|
-
private applyRadius(uiRadius: UIRadius) {
|
|
150
|
-
if (uiRadius.topLeft) {
|
|
151
|
-
const radius = radiusMapping[uiRadius.topLeft];
|
|
152
|
-
this.renderer.setStyle(
|
|
153
|
-
this.elementRef.nativeElement,
|
|
154
|
-
'border-top-left-radius',
|
|
155
|
-
radius
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (uiRadius.topRight) {
|
|
160
|
-
const radius = radiusMapping[uiRadius.topRight];
|
|
161
|
-
this.renderer.setStyle(
|
|
162
|
-
this.elementRef.nativeElement,
|
|
163
|
-
'border-top-right-radius',
|
|
164
|
-
radius
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (uiRadius.bottomLeft) {
|
|
169
|
-
const radius = radiusMapping[uiRadius.bottomLeft];
|
|
170
|
-
this.renderer.setStyle(
|
|
171
|
-
this.elementRef.nativeElement,
|
|
172
|
-
'border-bottom-left-radius',
|
|
173
|
-
radius
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (uiRadius.bottomRight) {
|
|
178
|
-
const radius = radiusMapping[uiRadius.bottomRight];
|
|
179
|
-
this.renderer.setStyle(
|
|
180
|
-
this.elementRef.nativeElement,
|
|
181
|
-
'border-bottom-right-radius',
|
|
182
|
-
radius
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
private applySpacing(uiSpacing: UISpacing) {
|
|
188
|
-
if (uiSpacing.spacing) {
|
|
189
|
-
const spacingValue = spaceMapping[uiSpacing.spacing];
|
|
190
|
-
this.renderer.setStyle(
|
|
191
|
-
this.elementRef.nativeElement,
|
|
192
|
-
'gap',
|
|
193
|
-
spacingValue
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
@HostListener('click', ['$event'])
|
|
199
|
-
onClick(event: Event): void {
|
|
200
|
-
if (this.disableClick) return;
|
|
201
|
-
|
|
202
|
-
if (this.edmSduiView?.action) {
|
|
203
|
-
event.stopPropagation();
|
|
204
|
-
this.actionService.execute(this.edmSduiView.action);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NgModule, ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
-
import { SduiComponent } from './sdui.component';
|
|
4
|
-
|
|
5
|
-
const defaultRoutes: Routes = [{ path: 'sdui', component: SduiComponent }];
|
|
6
|
-
|
|
7
|
-
@NgModule({
|
|
8
|
-
imports: [RouterModule.forChild(defaultRoutes)],
|
|
9
|
-
exports: [RouterModule],
|
|
10
|
-
})
|
|
11
|
-
export class SduiRoutingModule {
|
|
12
|
-
static forChild(customPath?: string): ModuleWithProviders<SduiRoutingModule> {
|
|
13
|
-
const routes = customPath
|
|
14
|
-
? [{ path: customPath, component: SduiComponent }]
|
|
15
|
-
: defaultRoutes;
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
ngModule: SduiRoutingModule,
|
|
19
|
-
providers: [],
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
OnInit,
|
|
4
|
-
Input,
|
|
5
|
-
OnChanges,
|
|
6
|
-
SimpleChanges,
|
|
7
|
-
AfterViewInit,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
import { ActivatedRoute } from '@angular/router';
|
|
10
|
-
import {
|
|
11
|
-
UIScreenViewModel,
|
|
12
|
-
SDUI_URL_PARAM,
|
|
13
|
-
} from './core/view-models/uiscreen.viewmodel';
|
|
14
|
-
import { take } from 'rxjs/operators';
|
|
15
|
-
|
|
16
|
-
@Component({
|
|
17
|
-
selector: 'edm-sdui',
|
|
18
|
-
templateUrl: './sdui.component.html',
|
|
19
|
-
styleUrls: ['./sdui.component.scss'],
|
|
20
|
-
standalone: false,
|
|
21
|
-
})
|
|
22
|
-
export class SduiComponent implements OnInit, AfterViewInit {
|
|
23
|
-
currentSduiUrl: string | null = null;
|
|
24
|
-
|
|
25
|
-
@Input() initialUrl: string | null = null;
|
|
26
|
-
|
|
27
|
-
constructor(
|
|
28
|
-
private route: ActivatedRoute,
|
|
29
|
-
private viewModel: UIScreenViewModel
|
|
30
|
-
) {}
|
|
31
|
-
|
|
32
|
-
ngOnInit() {
|
|
33
|
-
this.viewModel.currentUrl$.subscribe((url) => {
|
|
34
|
-
this.currentSduiUrl = url;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
this.route.queryParams.subscribe((params) => {
|
|
38
|
-
const paramValue = params[SDUI_URL_PARAM];
|
|
39
|
-
|
|
40
|
-
const hasValidParam = this.validateParam(paramValue);
|
|
41
|
-
if (hasValidParam && this.currentSduiUrl !== paramValue) {
|
|
42
|
-
console.debug('[SduiComponent] carregando sdui do parâmetro...');
|
|
43
|
-
this.viewModel.loadUIScreen(paramValue);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
ngAfterViewInit(): void {
|
|
49
|
-
const paramValue = this.route.snapshot.queryParamMap.get(SDUI_URL_PARAM);
|
|
50
|
-
const hasValidParam = this.validateParam(paramValue);
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
!hasValidParam &&
|
|
54
|
-
this.initialUrl &&
|
|
55
|
-
this.currentSduiUrl !== this.initialUrl
|
|
56
|
-
) {
|
|
57
|
-
console.debug('[SduiComponent] carregando initialUrl:', this.initialUrl);
|
|
58
|
-
this.viewModel.loadUIScreen(this.initialUrl);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
private validateParam(paramValue: any): boolean {
|
|
63
|
-
return !!paramValue && paramValue.trim() !== '';
|
|
64
|
-
}
|
|
65
|
-
}
|
package/src/lib/sdui.module.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { NgModule, ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { RouterModule } from '@angular/router';
|
|
4
|
-
import { UIScreenComponent } from './components/uiscreen/uiscreen.component';
|
|
5
|
-
import { SingleColumnLayoutComponent } from './components/uilayout/single-column-layout/single-column-layout.component';
|
|
6
|
-
import { UINavigationComponent } from './components/uilayout/uinavigation/uinavigation.component';
|
|
7
|
-
import { UIComponentComponent } from './components/uicomponent/uicomponent.component';
|
|
8
|
-
import { RowComponent } from './components/uicomponent/row/row.component';
|
|
9
|
-
import { ColumnComponent } from './components/uicomponent/column/column.component';
|
|
10
|
-
import { LabelComponent } from './components/uicomponent/label/label.component';
|
|
11
|
-
import { SpaceComponent } from './components/uicomponent/space/space.component';
|
|
12
|
-
import { ZStackComponent } from './components/uicomponent/zstack/zstack.component';
|
|
13
|
-
import { RowDivisorComponent } from './components/uicomponent/row-divisor/row-divisor.component';
|
|
14
|
-
import { UIViewDirective } from './directives/uiview.directive';
|
|
15
|
-
import { ButtonComponent } from './components/uicomponent/button/button.component';
|
|
16
|
-
import { ImageComponent } from './components/uicomponent/image/image.component';
|
|
17
|
-
import { SDUI_BASE_URL } from './core/tokens/sdui-config.token';
|
|
18
|
-
import { NavigationControlsComponent } from './components/navigation-controls/navigation-controls.component';
|
|
19
|
-
import { SduiComponent } from './sdui.component';
|
|
20
|
-
import { SduiRoutingModule } from './sdui-routing.module';
|
|
21
|
-
import { CenteredContentLayoutComponent } from './components/uilayout/centered-content-layout/centered-content-layout.component';
|
|
22
|
-
import { TagComponent } from './components/uicomponent/tag/tag.component';
|
|
23
|
-
import { SearchBarComponent } from './components/uicomponent/search-bar/search-bar.component';
|
|
24
|
-
|
|
25
|
-
export interface SduiModuleConfig {
|
|
26
|
-
baseUrl: string;
|
|
27
|
-
routePath?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@NgModule({
|
|
31
|
-
declarations: [
|
|
32
|
-
// UIComposite
|
|
33
|
-
UIScreenComponent,
|
|
34
|
-
UINavigationComponent,
|
|
35
|
-
|
|
36
|
-
// Layout
|
|
37
|
-
SingleColumnLayoutComponent,
|
|
38
|
-
CenteredContentLayoutComponent,
|
|
39
|
-
|
|
40
|
-
// UIComponents
|
|
41
|
-
UIComponentComponent,
|
|
42
|
-
RowComponent,
|
|
43
|
-
RowDivisorComponent,
|
|
44
|
-
ColumnComponent,
|
|
45
|
-
ZStackComponent,
|
|
46
|
-
LabelComponent,
|
|
47
|
-
SpaceComponent,
|
|
48
|
-
ButtonComponent,
|
|
49
|
-
ImageComponent,
|
|
50
|
-
TagComponent,
|
|
51
|
-
SearchBarComponent,
|
|
52
|
-
|
|
53
|
-
// diretivas
|
|
54
|
-
UIViewDirective,
|
|
55
|
-
|
|
56
|
-
// navegação
|
|
57
|
-
NavigationControlsComponent,
|
|
58
|
-
|
|
59
|
-
// componente base da lib
|
|
60
|
-
SduiComponent,
|
|
61
|
-
],
|
|
62
|
-
imports: [CommonModule, RouterModule],
|
|
63
|
-
exports: [SduiComponent],
|
|
64
|
-
providers: [],
|
|
65
|
-
})
|
|
66
|
-
export class SduiModule {
|
|
67
|
-
static forRoot(config: SduiModuleConfig): ModuleWithProviders<SduiModule> {
|
|
68
|
-
return {
|
|
69
|
-
ngModule: SduiModule,
|
|
70
|
-
providers: [
|
|
71
|
-
{
|
|
72
|
-
provide: SDUI_BASE_URL,
|
|
73
|
-
useValue: config.baseUrl,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
static forRouting(
|
|
80
|
-
config?: SduiModuleConfig
|
|
81
|
-
): ModuleWithProviders<SduiRoutingModule> {
|
|
82
|
-
return SduiRoutingModule.forChild(config?.routePath);
|
|
83
|
-
}
|
|
84
|
-
}
|
package/src/public-api.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Public API Surface of sdui
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Módulo principal
|
|
6
|
-
export { SduiModule } from './lib/sdui.module';
|
|
7
|
-
|
|
8
|
-
// Componente principal para uso direto
|
|
9
|
-
export { SduiComponent } from './lib/sdui.component';
|
|
10
|
-
|
|
11
|
-
// Constantes e interfaces para configuração
|
|
12
|
-
export { SDUI_URL_PARAM } from './lib/core/view-models/uiscreen.viewmodel';
|
|
13
|
-
export { SduiModuleConfig } from './lib/sdui.module';
|
|
14
|
-
|
|
15
|
-
// Roteamento (opcional, apenas se necessário)
|
|
16
|
-
// export { SduiRoutingModule } from './lib/sdui-routing.module';
|
package/tsconfig.lib.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"declarationMap": true,
|
|
7
|
-
"types": [],
|
|
8
|
-
"target": "ES2022",
|
|
9
|
-
"module": "ES2022",
|
|
10
|
-
"useDefineForClassFields": false
|
|
11
|
-
},
|
|
12
|
-
"angularCompilerOptions": {
|
|
13
|
-
"compilationMode": "partial"
|
|
14
|
-
},
|
|
15
|
-
"exclude": ["src/test.ts", "**/*.spec.ts"]
|
|
16
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.lib.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc/libs/sdui",
|
|
5
|
-
"module": "CommonJS",
|
|
6
|
-
"target": "ES2022",
|
|
7
|
-
"types": ["jasmine"],
|
|
8
|
-
"lib": ["ES2022", "DOM"]
|
|
9
|
-
},
|
|
10
|
-
"files": ["src/test.ts"],
|
|
11
|
-
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
|
|
12
|
-
}
|