structra-ui 0.1.41 → 0.1.43
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/README.md +2 -2
- package/fesm2022/structra-ui.mjs +33 -41
- package/fesm2022/structra-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/structra-ui.d.ts +14 -7
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# structra-ui
|
|
2
2
|
|
|
3
|
-
Biblioteca
|
|
3
|
+
Biblioteca de componentes para projetos **Angular**.
|
|
4
|
+
**Site oficial**: [StructraLab](https://structralab.com/).
|
|
4
5
|
|
|
5
6
|
## Instalar
|
|
6
7
|
|
|
7
8
|
```bash
|
|
8
9
|
npm install structra-ui
|
|
9
10
|
```
|
|
10
|
-
|
|
11
11
|
## AG Grid (grid)
|
|
12
12
|
|
|
13
13
|
Registre os módulos Community uma vez no main.ts (antes do bootstrapApplication):
|
package/fesm2022/structra-ui.mjs
CHANGED
|
@@ -552,16 +552,28 @@ const APP_THEME_IDS = [
|
|
|
552
552
|
'black',
|
|
553
553
|
];
|
|
554
554
|
/**
|
|
555
|
-
* Estado global do tema da library:
|
|
556
|
-
* Os tokens
|
|
555
|
+
* Estado global do tema da library: **sempre** `.app-library-theme` + `theme-*` juntos.
|
|
556
|
+
* Os tokens de paleta em `_theme-palettes.scss` usam o selector `.app-library-theme.theme-*`.
|
|
557
557
|
*/
|
|
558
558
|
class AppThemeService {
|
|
559
559
|
constructor() {
|
|
560
560
|
this.activeId = signal('black', ...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
|
|
561
561
|
/** Identificador do tema activo (`blue`, `green`, …). */
|
|
562
562
|
this.activeThemeId = this.activeId.asReadonly();
|
|
563
|
-
/**
|
|
564
|
-
|
|
563
|
+
/**
|
|
564
|
+
* Classes separadas (ex.: CDK `panelClass` — uma string com espaço quebra `classList.add`).
|
|
565
|
+
*/
|
|
566
|
+
this.themeClassList = computed(() => ['app-library-theme', `theme-${this.activeId()}`], ...(ngDevMode ? [{ debugName: "themeClassList" }] : /* istanbul ignore next */ []));
|
|
567
|
+
/**
|
|
568
|
+
* As duas classes numa string — útil para `[class]`, `[ngClass]` com string, ou hosts HTML.
|
|
569
|
+
* Ex.: `<div [ngClass]="libTheme.themeClass()">` aplica paleta completa no consumidor.
|
|
570
|
+
*/
|
|
571
|
+
this.themeClass = computed(() => this.themeClassList().join(' '), ...(ngDevMode ? [{ debugName: "themeClass" }] : /* istanbul ignore next */ []));
|
|
572
|
+
/** Mapa para `[ngClass]` com chaves dinâmicas (painéis overlay). */
|
|
573
|
+
this.themeClassMap = computed(() => {
|
|
574
|
+
const [base, token] = this.themeClassList();
|
|
575
|
+
return { [base]: true, [token]: true };
|
|
576
|
+
}, ...(ngDevMode ? [{ debugName: "themeClassMap" }] : /* istanbul ignore next */ []));
|
|
565
577
|
/** Lista fixa de temas suportados pela library. */
|
|
566
578
|
this.themeOptions = [
|
|
567
579
|
{ id: 'blue', label: 'Azul' },
|
|
@@ -609,18 +621,14 @@ class DropdownBaseComponent {
|
|
|
609
621
|
* O overlay do CDK fica sob `body`; sem estas classes, `var(--app-color-*)` cai no `:root`.
|
|
610
622
|
* Tem de ser **array**: uma única string com espaço quebra `classList.add` e as classes não aplicam.
|
|
611
623
|
*/
|
|
612
|
-
this.overlayPanelClasses = computed(() => [
|
|
624
|
+
this.overlayPanelClasses = computed(() => [
|
|
625
|
+
...this.appTheme.themeClassList(),
|
|
626
|
+
], ...(ngDevMode ? [{ debugName: "overlayPanelClasses" }] : /* istanbul ignore next */ []));
|
|
613
627
|
/**
|
|
614
628
|
* O CDK não reaplica `cdkConnectedOverlayPanelClass` quando o overlay já existe.
|
|
615
629
|
* As classes de tema no painel interno seguem o tema activo sempre.
|
|
616
630
|
*/
|
|
617
|
-
this.panelThemeNgClass = computed(() => {
|
|
618
|
-
const themeClass = this.appTheme.themeClass();
|
|
619
|
-
return {
|
|
620
|
-
'app-library-theme': true,
|
|
621
|
-
[themeClass]: true,
|
|
622
|
-
};
|
|
623
|
-
}, ...(ngDevMode ? [{ debugName: "panelThemeNgClass" }] : /* istanbul ignore next */ []));
|
|
631
|
+
this.panelThemeNgClass = computed(() => this.appTheme.themeClassMap(), ...(ngDevMode ? [{ debugName: "panelThemeNgClass" }] : /* istanbul ignore next */ []));
|
|
624
632
|
this.open = false;
|
|
625
633
|
this.openChange = new EventEmitter();
|
|
626
634
|
/** Largura do painel em px (ex.: largura total do campo). */
|
|
@@ -850,16 +858,10 @@ class MenuListComponent {
|
|
|
850
858
|
this.submenuOpenTimer = null;
|
|
851
859
|
this.submenuCloseTimer = null;
|
|
852
860
|
this.submenuPositions = submenuConnectedPositions();
|
|
853
|
-
this.panelThemeNgClass = computed(() => {
|
|
854
|
-
const themeClass = this.appTheme.themeClass();
|
|
855
|
-
return {
|
|
856
|
-
'app-library-theme': true,
|
|
857
|
-
[themeClass]: true,
|
|
858
|
-
};
|
|
859
|
-
}, ...(ngDevMode ? [{ debugName: "panelThemeNgClass" }] : /* istanbul ignore next */ []));
|
|
861
|
+
this.panelThemeNgClass = computed(() => this.appTheme.themeClassMap(), ...(ngDevMode ? [{ debugName: "panelThemeNgClass" }] : /* istanbul ignore next */ []));
|
|
860
862
|
}
|
|
861
863
|
overlayPanelClasses() {
|
|
862
|
-
return [
|
|
864
|
+
return [...this.appTheme.themeClassList(), 'menu-submenu__cdk-panel'];
|
|
863
865
|
}
|
|
864
866
|
onNestedItemSelect(id) {
|
|
865
867
|
this.closeOpenSubmenu();
|
|
@@ -7409,7 +7411,7 @@ class AppDialogComponent {
|
|
|
7409
7411
|
* valores de `:root` (azul); alinhamos ao CDK Dialog (`libDialogPanelClasses`).
|
|
7410
7412
|
*/
|
|
7411
7413
|
get hostThemeClasses() {
|
|
7412
|
-
return
|
|
7414
|
+
return this.appTheme.themeClass();
|
|
7413
7415
|
}
|
|
7414
7416
|
ngOnInit() {
|
|
7415
7417
|
this.stripHostNativeTitle();
|
|
@@ -7611,7 +7613,7 @@ class AppLibLightBlockScrollStrategy {
|
|
|
7611
7613
|
/** Classes aplicadas ao painel CDK Dialog + tema da app. */
|
|
7612
7614
|
function libDialogPanelClasses(theme, extra = []) {
|
|
7613
7615
|
const rest = Array.isArray(extra) ? extra : [extra];
|
|
7614
|
-
return ['app-lib-dialog-panel',
|
|
7616
|
+
return ['app-lib-dialog-panel', ...theme.themeClassList(), ...rest];
|
|
7615
7617
|
}
|
|
7616
7618
|
|
|
7617
7619
|
class ConfirmDialogService {
|
|
@@ -7847,13 +7849,7 @@ class ContextMenuComponent {
|
|
|
7847
7849
|
this.overlayRef = null;
|
|
7848
7850
|
this.escSub = null;
|
|
7849
7851
|
this.generatedId = `app-ctx-${Math.random().toString(36).slice(2, 9)}`;
|
|
7850
|
-
this.panelThemeNgClass = computed(() => {
|
|
7851
|
-
const themeClass = this.appTheme.themeClass();
|
|
7852
|
-
return {
|
|
7853
|
-
'app-library-theme': true,
|
|
7854
|
-
[themeClass]: true,
|
|
7855
|
-
};
|
|
7856
|
-
}, ...(ngDevMode ? [{ debugName: "panelThemeNgClass" }] : /* istanbul ignore next */ []));
|
|
7852
|
+
this.panelThemeNgClass = computed(() => this.appTheme.themeClassMap(), ...(ngDevMode ? [{ debugName: "panelThemeNgClass" }] : /* istanbul ignore next */ []));
|
|
7857
7853
|
}
|
|
7858
7854
|
get resolvedMenuId() {
|
|
7859
7855
|
return this.menuId.trim() || this.generatedId;
|
|
@@ -7873,11 +7869,10 @@ class ContextMenuComponent {
|
|
|
7873
7869
|
this.disposeOverlay();
|
|
7874
7870
|
const left = Math.min(clientX, window.innerWidth - PANEL_MIN_W - VIEWPORT_PAD);
|
|
7875
7871
|
const top = Math.min(clientY, window.innerHeight - VIEWPORT_PAD);
|
|
7876
|
-
const themeClass = this.appTheme.themeClass();
|
|
7877
7872
|
this.overlayRef = this.overlay.create({
|
|
7878
7873
|
hasBackdrop: true,
|
|
7879
7874
|
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
7880
|
-
panelClass: [
|
|
7875
|
+
panelClass: [...this.appTheme.themeClassList()],
|
|
7881
7876
|
scrollStrategy: this.overlay.scrollStrategies.close(),
|
|
7882
7877
|
positionStrategy: this.overlay
|
|
7883
7878
|
.position()
|
|
@@ -8158,14 +8153,11 @@ class AnchoredOverlayComponent {
|
|
|
8158
8153
|
* Estratégia de scroll (predefinição: reposicionar; `close` para fechar ao scroll em certos modais).
|
|
8159
8154
|
*/
|
|
8160
8155
|
this.scrollStrategy = null;
|
|
8161
|
-
this.overlayPanelClasses = computed(() => [
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
[themeClass]: true,
|
|
8167
|
-
};
|
|
8168
|
-
}, ...(ngDevMode ? [{ debugName: "panelThemeNgClass" }] : /* istanbul ignore next */ []));
|
|
8156
|
+
this.overlayPanelClasses = computed(() => [
|
|
8157
|
+
...this.appTheme.themeClassList(),
|
|
8158
|
+
'anchored-overlay__pane',
|
|
8159
|
+
], ...(ngDevMode ? [{ debugName: "overlayPanelClasses" }] : /* istanbul ignore next */ []));
|
|
8160
|
+
this.panelThemeNgClass = computed(() => this.appTheme.themeClassMap(), ...(ngDevMode ? [{ debugName: "panelThemeNgClass" }] : /* istanbul ignore next */ []));
|
|
8169
8161
|
this.defaultScrollStrategy = this.overlay.scrollStrategies.reposition();
|
|
8170
8162
|
}
|
|
8171
8163
|
get effectiveScrollStrategy() {
|
|
@@ -8671,7 +8663,7 @@ class AppShellComponent {
|
|
|
8671
8663
|
this.DrawerSize = DrawerSize;
|
|
8672
8664
|
}
|
|
8673
8665
|
get hostThemeClasses() {
|
|
8674
|
-
return
|
|
8666
|
+
return this.theme.themeClass();
|
|
8675
8667
|
}
|
|
8676
8668
|
/** Conteúdo lateral (obrigatório): `<ng-template appShellSidebar>...</ng-template>`. */
|
|
8677
8669
|
get sidebarTemplate() {
|
|
@@ -8752,7 +8744,7 @@ class AppSidebarComponent {
|
|
|
8752
8744
|
* herdarem a paleta activa (útil fora da demo ou sem antepassado tematizado).
|
|
8753
8745
|
*/
|
|
8754
8746
|
get hostThemeClasses() {
|
|
8755
|
-
return
|
|
8747
|
+
return this.theme.themeClass();
|
|
8756
8748
|
}
|
|
8757
8749
|
constructor() {
|
|
8758
8750
|
this.theme = inject(AppThemeService);
|