@praxisui/tabs 10.0.0-rc.60 → 10.0.0-rc.62
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 -1
- package/ai/component-registry.json +23 -10
- package/fesm2022/praxisui-tabs.mjs +291 -57
- package/package.json +5 -5
- package/src/lib/praxis-tabs.json-api.md +1 -0
- package/types/praxisui-tabs.d.ts +7 -2
package/README.md
CHANGED
|
@@ -89,6 +89,7 @@ export class TabsHostComponent {
|
|
|
89
89
|
- `config: TabsMetadata | null`: canonical tabs/nav configuration.
|
|
90
90
|
- `tabsId: string`: stable id used for local configuration persistence.
|
|
91
91
|
- `componentInstanceId?: string`: disambiguates multiple instances with the same `tabsId`.
|
|
92
|
+
- `configPersistenceStrategy?: 'local-first' | 'storage-first' | 'input-first' | 'volatile'`: normalized via `normalizeConfigPersistenceStrategy` (`'storage-first'` maps to `'local-first'`); `'input-first'` keeps host `[config]` precedence when provided, and `'volatile'` disables all storage reads, writes, and resets.
|
|
92
93
|
- `form?: FormGroup`: form context for dynamic field content.
|
|
93
94
|
- `context?: unknown`: context passed to nested widgets.
|
|
94
95
|
- `selectedIndex?: number`: controlled active tab index.
|
|
@@ -146,7 +147,7 @@ When a tab or navigation link contains multiple `widgets`, the runtime renders t
|
|
|
146
147
|
|
|
147
148
|
## Runtime Authoring
|
|
148
149
|
|
|
149
|
-
With `enableCustomization`, the component can open quick setup or the full `PraxisTabsConfigEditor` through Settings Panel. The editor round-trips through `TabsAuthoringDocument`, applies only runtime-backed fields and emits `configChange` so the host can persist canonical page or manifest changes.
|
|
150
|
+
With `enableCustomization`, the component can open quick setup or the full `PraxisTabsConfigEditor` through Settings Panel. The editor round-trips through `TabsAuthoringDocument`, applies only runtime-backed fields and emits `configChange` so the host can persist canonical page or manifest changes. `PraxisTabs` honors `configPersistenceStrategy` (`'local-first' | 'input-first' | 'volatile'`), suppresses premature persistence inside `ngOnChanges`, hides the reset action in `'volatile'` mode, passes `configStorageKey` with async `onSave`/`onReset` handlers to Settings Panel, and restores the baseline host snapshot on reset.
|
|
150
151
|
|
|
151
152
|
`PRAXIS_TABS_AUTHORING_MANIFEST` describes the governed AI/tooling operations for tab add/remove, labels, icons, order, visibility, disabled state, active tab, layout and tab content. Free JSON patches from AI flows are not the public authoring contract.
|
|
152
153
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-24T14:00:56.078Z",
|
|
4
4
|
"packageName": "@praxisui/tabs",
|
|
5
|
-
"packageVersion": "10.0.0-rc.
|
|
5
|
+
"packageVersion": "10.0.0-rc.62",
|
|
6
6
|
"sourceRegistry": "praxis-component-registry-ingestion",
|
|
7
7
|
"sourceRegistryVersion": "1.0.0",
|
|
8
8
|
"componentCount": 1,
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"name": "configPersistenceStrategy",
|
|
37
|
-
"type": "\"storage-first\" | \"input-first\"",
|
|
37
|
+
"type": "\"storage-first\" | \"local-first\" | \"input-first\" | \"volatile\"",
|
|
38
38
|
"required": false,
|
|
39
|
-
"description": "Define
|
|
39
|
+
"description": "Define a precedência entre storage e entrada (`local-first`/`storage-first` para persistência local, `input-first` para composição dona do config, `volatile` para previews efêmeros sem leitura ou escrita).",
|
|
40
40
|
"label": "Estratégia de persistência",
|
|
41
41
|
"default": "storage-first"
|
|
42
42
|
},
|
|
@@ -132,6 +132,19 @@
|
|
|
132
132
|
"stable"
|
|
133
133
|
],
|
|
134
134
|
"lib": "@praxisui/tabs",
|
|
135
|
+
"transientInputs": [
|
|
136
|
+
"context",
|
|
137
|
+
"selectedIndex"
|
|
138
|
+
],
|
|
139
|
+
"lockedInputs": [
|
|
140
|
+
"tabsId"
|
|
141
|
+
],
|
|
142
|
+
"visualOverrideKeys": [
|
|
143
|
+
"config",
|
|
144
|
+
"enableCustomization",
|
|
145
|
+
"configPersistenceStrategy"
|
|
146
|
+
],
|
|
147
|
+
"schemaVersion": "1.0.0",
|
|
135
148
|
"actions": [
|
|
136
149
|
{
|
|
137
150
|
"id": "select-tab",
|
|
@@ -1324,8 +1337,8 @@
|
|
|
1324
1337
|
},
|
|
1325
1338
|
{
|
|
1326
1339
|
"name": "configPersistenceStrategy",
|
|
1327
|
-
"type": "\"
|
|
1328
|
-
"description": "Controls whether persisted customization or explicit input config governs the runtime
|
|
1340
|
+
"type": "\"local-first\" | \"input-first\" | \"volatile\" | \"storage-first\"",
|
|
1341
|
+
"description": "Controls whether persisted customization or explicit input config governs the runtime (`local-first`, legacy `storage-first`, composition-owned `input-first`, or ephemeral `volatile`)."
|
|
1329
1342
|
},
|
|
1330
1343
|
{
|
|
1331
1344
|
"name": "form",
|
|
@@ -2805,9 +2818,9 @@
|
|
|
2805
2818
|
{
|
|
2806
2819
|
"chunkIndex": 0,
|
|
2807
2820
|
"chunkKind": "summary",
|
|
2808
|
-
"content": "Component ID: praxis-tabs\nSelector: praxis-tabs\nFriendly Name: Praxis Tabs\nDescription: Abas dinâmicas baseadas em metadata, com MatTabGroup/TabNav, variantes visuais (underline, pill, segmented), tons por aba/link e suporte a tokens M3 via appearance.\nLib/Package: @praxisui/tabs\nTags: widget, tabs, configurable, stable\nInputs:\n - config (TabsMetadata)\n - tabsId (string)\n - componentInstanceId (string)\n - configPersistenceStrategy (\"storage-first\" | \"input-first\")\n - selectedIndex (number)\n - enableCustomization (boolean)\n - form (FormGroup)\n - context (Record<string, any>)\nOutputs:\n - selectedIndexChange (number)\n - configChange (TabsConfigChangeEvent)\n - selectedTabChange (MatTabChangeEvent)\n - animationDone (void)\n - focusChange (MatTabChangeEvent)\n - indexFocused (number)\n - selectFocusedIndex (number)\n - widgetEvent (WidgetEventEnvelope)\n",
|
|
2821
|
+
"content": "Component ID: praxis-tabs\nSelector: praxis-tabs\nFriendly Name: Praxis Tabs\nDescription: Abas dinâmicas baseadas em metadata, com MatTabGroup/TabNav, variantes visuais (underline, pill, segmented), tons por aba/link e suporte a tokens M3 via appearance.\nLib/Package: @praxisui/tabs\nTags: widget, tabs, configurable, stable\nInputs:\n - config (TabsMetadata)\n - tabsId (string)\n - componentInstanceId (string)\n - configPersistenceStrategy (\"storage-first\" | \"local-first\" | \"input-first\" | \"volatile\")\n - selectedIndex (number)\n - enableCustomization (boolean)\n - form (FormGroup)\n - context (Record<string, any>)\nOutputs:\n - selectedIndexChange (number)\n - configChange (TabsConfigChangeEvent)\n - selectedTabChange (MatTabChangeEvent)\n - animationDone (void)\n - focusChange (MatTabChangeEvent)\n - indexFocused (number)\n - selectFocusedIndex (number)\n - widgetEvent (WidgetEventEnvelope)\n",
|
|
2809
2822
|
"sourcePointer": "projects/praxis-tabs/src/lib/praxis-tabs.metadata.ts",
|
|
2810
|
-
"contentHash": "
|
|
2823
|
+
"contentHash": "7b63fef5920d9f9f13d1510940dbee7f76c42c198639dd4de03f9f10545d08cf",
|
|
2811
2824
|
"sourceKind": "component_definition",
|
|
2812
2825
|
"sourceId": "praxis-tabs",
|
|
2813
2826
|
"corpusVersion": "1.0.0"
|
|
@@ -2945,9 +2958,9 @@
|
|
|
2945
2958
|
{
|
|
2946
2959
|
"chunkIndex": 14,
|
|
2947
2960
|
"chunkKind": "authoring_manifest",
|
|
2948
|
-
"content": "{\"schemaVersion\":\"1.0.0\",\"manifestVersion\":\"1.0.0\",\"componentId\":\"praxis-tabs\",\"ownerPackage\":\"@praxisui/tabs\",\"configSchemaId\":\"TabsMetadata\",\"chunkSection\":\"runtimeInputs\",\"runtimeInputs\":[{\"name\":\"config\",\"type\":\"TabsMetadata\",\"description\":\"Canonical tabs/nav configuration.\"},{\"name\":\"tabsId\",\"type\":\"string\",\"description\":\"Stable id used to derive persistence scope.\"},{\"name\":\"componentInstanceId\",\"type\":\"string\",\"description\":\"Optional instance discriminator for persistence scope.\"},{\"name\":\"configPersistenceStrategy\",\"type\":\"\\\"
|
|
2961
|
+
"content": "{\"schemaVersion\":\"1.0.0\",\"manifestVersion\":\"1.0.0\",\"componentId\":\"praxis-tabs\",\"ownerPackage\":\"@praxisui/tabs\",\"configSchemaId\":\"TabsMetadata\",\"chunkSection\":\"runtimeInputs\",\"runtimeInputs\":[{\"name\":\"config\",\"type\":\"TabsMetadata\",\"description\":\"Canonical tabs/nav configuration.\"},{\"name\":\"tabsId\",\"type\":\"string\",\"description\":\"Stable id used to derive persistence scope.\"},{\"name\":\"componentInstanceId\",\"type\":\"string\",\"description\":\"Optional instance discriminator for persistence scope.\"},{\"name\":\"configPersistenceStrategy\",\"type\":\"\\\"local-first\\\" | \\\"input-first\\\" | \\\"volatile\\\" | \\\"storage-first\\\"\",\"description\":\"Controls whether persisted customization or explicit input config governs the runtime (`local-first`, legacy `storage-first`, composition-owned `input-first`, or ephemeral `volatile`).\"},{\"name\":\"form\",\"type\":\"FormGroup\",\"description\":\"FormGroup consumed by dynamic field content.\"},{\"name\":\"context\",\"type\":\"Record<string, any>\",\"description\":\"Context passed to nested widgets.\"},{\"name\":\"enableCustomization\",\"type\":\"boolean\",\"description\":\"Enables Settings Panel authoring surfaces.\"}]}",
|
|
2949
2962
|
"sourcePointer": "projects/praxis-tabs/src/lib/ai/praxis-tabs-authoring-manifest.ts",
|
|
2950
|
-
"contentHash": "
|
|
2963
|
+
"contentHash": "3397b93bc73433ac08a320e8f65b0c53c8946c5c480578f8e288fc2f2221b24c",
|
|
2951
2964
|
"sourceKind": "component_definition",
|
|
2952
2965
|
"sourceId": "praxis-tabs",
|
|
2953
2966
|
"corpusVersion": "1.0.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Input, Inject, Component, ChangeDetectorRef, effect, EventEmitter, signal, ElementRef, afterEveryRender, ViewChild, Output, ChangeDetectionStrategy, ENVIRONMENT_INITIALIZER } from '@angular/core';
|
|
2
|
+
import { inject, Input, Inject, Component, ChangeDetectorRef, effect, EventEmitter, signal, ElementRef, DestroyRef, afterEveryRender, ViewChild, Output, ChangeDetectionStrategy, ENVIRONMENT_INITIALIZER } from '@angular/core';
|
|
3
3
|
import { ActivatedRoute } from '@angular/router';
|
|
4
4
|
import * as i1$1 from '@angular/common';
|
|
5
5
|
import { CommonModule } from '@angular/common';
|
|
@@ -10,7 +10,7 @@ import { MatIconModule } from '@angular/material/icon';
|
|
|
10
10
|
import * as i11 from '@angular/material/tooltip';
|
|
11
11
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
12
12
|
import * as i1 from '@praxisui/core';
|
|
13
|
-
import { providePraxisI18n, PraxisI18nService, PraxisIconDirective, PraxisIconButtonComponent, providePraxisI18nConfig, deepMerge, ASYNC_CONFIG_STORAGE, ComponentKeyService, LoggerService, EmptyStateCardComponent, DynamicWidgetLoaderDirective, ComponentMetadataRegistry } from '@praxisui/core';
|
|
13
|
+
import { providePraxisI18n, PraxisI18nService, PraxisIconDirective, PraxisIconButtonComponent, providePraxisI18nConfig, deepMerge, ASYNC_CONFIG_STORAGE, ComponentKeyService, LoggerService, normalizeConfigPersistenceStrategy, EmptyStateCardComponent, DynamicWidgetLoaderDirective, ComponentMetadataRegistry } from '@praxisui/core';
|
|
14
14
|
import * as i6$1 from '@angular/material/button';
|
|
15
15
|
import { MatButtonModule } from '@angular/material/button';
|
|
16
16
|
import * as i2_1 from '@angular/forms';
|
|
@@ -1295,7 +1295,7 @@ class PraxisTabsConfigEditor {
|
|
|
1295
1295
|
@if (diagnostics.length) {
|
|
1296
1296
|
<div class="editor-diagnostics">
|
|
1297
1297
|
<div class="editor-diagnostics-title">{{ t('editor.diagnostics.title', 'Diagnosticos de authoring') }}</div>
|
|
1298
|
-
@for (diagnostic of diagnostics; track
|
|
1298
|
+
@for (diagnostic of diagnostics; track $index) {
|
|
1299
1299
|
<div
|
|
1300
1300
|
class="editor-diagnostic"
|
|
1301
1301
|
[class.level-error]="diagnostic.level === 'error'"
|
|
@@ -1591,7 +1591,7 @@ class PraxisTabsConfigEditor {
|
|
|
1591
1591
|
></button>
|
|
1592
1592
|
</div>
|
|
1593
1593
|
<div class="editor-grid two">
|
|
1594
|
-
@for (token of tokenList; track token) {
|
|
1594
|
+
@for (token of tokenList; track token.key) {
|
|
1595
1595
|
<mat-form-field appearance="outline">
|
|
1596
1596
|
<mat-label>{{ t(token.labelKey, token.fallback) }}</mat-label>
|
|
1597
1597
|
<input matInput [placeholder]="t('editor.placeholders.tokenValue', 'var(--md-sys-color-primary) / #RRGGBB')" [ngModel]="appearance.tokens?.[token.key]" (ngModelChange)="onTokenChange(token.key, $event)" />
|
|
@@ -1623,7 +1623,7 @@ class PraxisTabsConfigEditor {
|
|
|
1623
1623
|
<button mat-stroked-button color="primary" (click)="addTab()"><mat-icon [praxisIcon]="'add'"></mat-icon>{{ t('editor.actions.addTab', 'Adicionar aba') }}</button>
|
|
1624
1624
|
@if (editedConfig.tabs?.length) {
|
|
1625
1625
|
<div class="editor-grid">
|
|
1626
|
-
@for (tab of editedConfig.tabs; track
|
|
1626
|
+
@for (tab of editedConfig.tabs; track $index; let i = $index) {
|
|
1627
1627
|
<div class="editor-card">
|
|
1628
1628
|
<div class="editor-card-header">
|
|
1629
1629
|
<strong class="editor-card-title">{{ t('editor.cards.tab', 'Aba') }} #{{ i+1 }}</strong>
|
|
@@ -1675,7 +1675,7 @@ class PraxisTabsConfigEditor {
|
|
|
1675
1675
|
<mat-label>{{ t('editor.fields.addComponent', 'Adicionar componente') }}</mat-label>
|
|
1676
1676
|
<mat-select [(ngModel)]="selectedTabWidgetId[i]" [placeholder]="t('editor.fields.selectPlaceholder', '(selecione)')">
|
|
1677
1677
|
<mat-option [value]="''">{{ t('editor.fields.selectPlaceholder', '(selecione)') }}</mat-option>
|
|
1678
|
-
@for (c of componentOptions; track c) {
|
|
1678
|
+
@for (c of componentOptions; track c.id) {
|
|
1679
1679
|
<mat-option [value]="c.id">{{ c.friendlyName || c.id }}</mat-option>
|
|
1680
1680
|
}
|
|
1681
1681
|
</mat-select>
|
|
@@ -1692,7 +1692,7 @@ class PraxisTabsConfigEditor {
|
|
|
1692
1692
|
</div>
|
|
1693
1693
|
@if (tab.widgets?.length) {
|
|
1694
1694
|
<div class="editor-grid" cdkDropList [cdkDropListData]="tab.widgets || []" (cdkDropListDropped)="onTabWidgetDrop(i, $event)">
|
|
1695
|
-
@for (w of tab.widgets; track
|
|
1695
|
+
@for (w of tab.widgets; track $index; let wi = $index) {
|
|
1696
1696
|
<div cdkDrag class="editor-card dashed">
|
|
1697
1697
|
<div class="editor-card-header">
|
|
1698
1698
|
<button praxisIconButton="drag_indicator" size="compact" type="button" cdkDragHandle [matTooltip]="t('editor.actions.dragToReorder', 'Arrastar para reordenar')" [attr.aria-label]="t('editor.actions.dragToReorder', 'Arrastar para reordenar')"></button>
|
|
@@ -1741,7 +1741,7 @@ class PraxisTabsConfigEditor {
|
|
|
1741
1741
|
<button mat-stroked-button color="primary" (click)="addLink()"><mat-icon [praxisIcon]="'add_link'"></mat-icon>{{ t('editor.actions.addLink', 'Adicionar link') }}</button>
|
|
1742
1742
|
@if (nav.links?.length) {
|
|
1743
1743
|
<div class="editor-grid">
|
|
1744
|
-
@for (l of nav.links; track
|
|
1744
|
+
@for (l of nav.links; track $index; let i = $index) {
|
|
1745
1745
|
<div class="editor-card">
|
|
1746
1746
|
<div class="editor-card-header">
|
|
1747
1747
|
<strong class="editor-card-title">{{ t('editor.cards.link', 'Link') }} #{{ i+1 }}</strong>
|
|
@@ -1786,7 +1786,7 @@ class PraxisTabsConfigEditor {
|
|
|
1786
1786
|
<mat-label>{{ t('editor.fields.addComponent', 'Adicionar componente') }}</mat-label>
|
|
1787
1787
|
<mat-select [(ngModel)]="selectedLinkWidgetId[i]" [placeholder]="t('editor.fields.selectPlaceholder', '(selecione)')">
|
|
1788
1788
|
<mat-option [value]="''">{{ t('editor.fields.selectPlaceholder', '(selecione)') }}</mat-option>
|
|
1789
|
-
@for (c of componentOptions; track c) {
|
|
1789
|
+
@for (c of componentOptions; track c.id) {
|
|
1790
1790
|
<mat-option [value]="c.id">{{ c.friendlyName || c.id }}</mat-option>
|
|
1791
1791
|
}
|
|
1792
1792
|
</mat-select>
|
|
@@ -1803,7 +1803,7 @@ class PraxisTabsConfigEditor {
|
|
|
1803
1803
|
</div>
|
|
1804
1804
|
@if (l.widgets?.length) {
|
|
1805
1805
|
<div class="editor-grid" cdkDropList [cdkDropListData]="l.widgets || []" (cdkDropListDropped)="onLinkWidgetDrop(i, $event)">
|
|
1806
|
-
@for (w of l.widgets; track
|
|
1806
|
+
@for (w of l.widgets; track $index; let wi = $index) {
|
|
1807
1807
|
<div cdkDrag class="editor-card dashed">
|
|
1808
1808
|
<div class="editor-card-header">
|
|
1809
1809
|
<button praxisIconButton="drag_indicator" size="compact" type="button" cdkDragHandle [matTooltip]="t('editor.actions.dragToReorder', 'Arrastar para reordenar')" [attr.aria-label]="t('editor.actions.dragToReorder', 'Arrastar para reordenar')"></button>
|
|
@@ -1871,7 +1871,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
1871
1871
|
@if (diagnostics.length) {
|
|
1872
1872
|
<div class="editor-diagnostics">
|
|
1873
1873
|
<div class="editor-diagnostics-title">{{ t('editor.diagnostics.title', 'Diagnosticos de authoring') }}</div>
|
|
1874
|
-
@for (diagnostic of diagnostics; track
|
|
1874
|
+
@for (diagnostic of diagnostics; track $index) {
|
|
1875
1875
|
<div
|
|
1876
1876
|
class="editor-diagnostic"
|
|
1877
1877
|
[class.level-error]="diagnostic.level === 'error'"
|
|
@@ -2167,7 +2167,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
2167
2167
|
></button>
|
|
2168
2168
|
</div>
|
|
2169
2169
|
<div class="editor-grid two">
|
|
2170
|
-
@for (token of tokenList; track token) {
|
|
2170
|
+
@for (token of tokenList; track token.key) {
|
|
2171
2171
|
<mat-form-field appearance="outline">
|
|
2172
2172
|
<mat-label>{{ t(token.labelKey, token.fallback) }}</mat-label>
|
|
2173
2173
|
<input matInput [placeholder]="t('editor.placeholders.tokenValue', 'var(--md-sys-color-primary) / #RRGGBB')" [ngModel]="appearance.tokens?.[token.key]" (ngModelChange)="onTokenChange(token.key, $event)" />
|
|
@@ -2199,7 +2199,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
2199
2199
|
<button mat-stroked-button color="primary" (click)="addTab()"><mat-icon [praxisIcon]="'add'"></mat-icon>{{ t('editor.actions.addTab', 'Adicionar aba') }}</button>
|
|
2200
2200
|
@if (editedConfig.tabs?.length) {
|
|
2201
2201
|
<div class="editor-grid">
|
|
2202
|
-
@for (tab of editedConfig.tabs; track
|
|
2202
|
+
@for (tab of editedConfig.tabs; track $index; let i = $index) {
|
|
2203
2203
|
<div class="editor-card">
|
|
2204
2204
|
<div class="editor-card-header">
|
|
2205
2205
|
<strong class="editor-card-title">{{ t('editor.cards.tab', 'Aba') }} #{{ i+1 }}</strong>
|
|
@@ -2251,7 +2251,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
2251
2251
|
<mat-label>{{ t('editor.fields.addComponent', 'Adicionar componente') }}</mat-label>
|
|
2252
2252
|
<mat-select [(ngModel)]="selectedTabWidgetId[i]" [placeholder]="t('editor.fields.selectPlaceholder', '(selecione)')">
|
|
2253
2253
|
<mat-option [value]="''">{{ t('editor.fields.selectPlaceholder', '(selecione)') }}</mat-option>
|
|
2254
|
-
@for (c of componentOptions; track c) {
|
|
2254
|
+
@for (c of componentOptions; track c.id) {
|
|
2255
2255
|
<mat-option [value]="c.id">{{ c.friendlyName || c.id }}</mat-option>
|
|
2256
2256
|
}
|
|
2257
2257
|
</mat-select>
|
|
@@ -2268,7 +2268,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
2268
2268
|
</div>
|
|
2269
2269
|
@if (tab.widgets?.length) {
|
|
2270
2270
|
<div class="editor-grid" cdkDropList [cdkDropListData]="tab.widgets || []" (cdkDropListDropped)="onTabWidgetDrop(i, $event)">
|
|
2271
|
-
@for (w of tab.widgets; track
|
|
2271
|
+
@for (w of tab.widgets; track $index; let wi = $index) {
|
|
2272
2272
|
<div cdkDrag class="editor-card dashed">
|
|
2273
2273
|
<div class="editor-card-header">
|
|
2274
2274
|
<button praxisIconButton="drag_indicator" size="compact" type="button" cdkDragHandle [matTooltip]="t('editor.actions.dragToReorder', 'Arrastar para reordenar')" [attr.aria-label]="t('editor.actions.dragToReorder', 'Arrastar para reordenar')"></button>
|
|
@@ -2317,7 +2317,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
2317
2317
|
<button mat-stroked-button color="primary" (click)="addLink()"><mat-icon [praxisIcon]="'add_link'"></mat-icon>{{ t('editor.actions.addLink', 'Adicionar link') }}</button>
|
|
2318
2318
|
@if (nav.links?.length) {
|
|
2319
2319
|
<div class="editor-grid">
|
|
2320
|
-
@for (l of nav.links; track
|
|
2320
|
+
@for (l of nav.links; track $index; let i = $index) {
|
|
2321
2321
|
<div class="editor-card">
|
|
2322
2322
|
<div class="editor-card-header">
|
|
2323
2323
|
<strong class="editor-card-title">{{ t('editor.cards.link', 'Link') }} #{{ i+1 }}</strong>
|
|
@@ -2362,7 +2362,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
2362
2362
|
<mat-label>{{ t('editor.fields.addComponent', 'Adicionar componente') }}</mat-label>
|
|
2363
2363
|
<mat-select [(ngModel)]="selectedLinkWidgetId[i]" [placeholder]="t('editor.fields.selectPlaceholder', '(selecione)')">
|
|
2364
2364
|
<mat-option [value]="''">{{ t('editor.fields.selectPlaceholder', '(selecione)') }}</mat-option>
|
|
2365
|
-
@for (c of componentOptions; track c) {
|
|
2365
|
+
@for (c of componentOptions; track c.id) {
|
|
2366
2366
|
<mat-option [value]="c.id">{{ c.friendlyName || c.id }}</mat-option>
|
|
2367
2367
|
}
|
|
2368
2368
|
</mat-select>
|
|
@@ -2379,7 +2379,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
2379
2379
|
</div>
|
|
2380
2380
|
@if (l.widgets?.length) {
|
|
2381
2381
|
<div class="editor-grid" cdkDropList [cdkDropListData]="l.widgets || []" (cdkDropListDropped)="onLinkWidgetDrop(i, $event)">
|
|
2382
|
-
@for (w of l.widgets; track
|
|
2382
|
+
@for (w of l.widgets; track $index; let wi = $index) {
|
|
2383
2383
|
<div cdkDrag class="editor-card dashed">
|
|
2384
2384
|
<div class="editor-card-header">
|
|
2385
2385
|
<button praxisIconButton="drag_indicator" size="compact" type="button" cdkDragHandle [matTooltip]="t('editor.actions.dragToReorder', 'Arrastar para reordenar')" [attr.aria-label]="t('editor.actions.dragToReorder', 'Arrastar para reordenar')"></button>
|
|
@@ -3599,7 +3599,10 @@ class PraxisTabs {
|
|
|
3599
3599
|
}
|
|
3600
3600
|
}, ...(ngDevMode ? [{ debugName: "aiAssistantSessionEffect" }] : /* istanbul ignore next */ []));
|
|
3601
3601
|
warnedMissingId = false;
|
|
3602
|
+
storageInitialized = false;
|
|
3602
3603
|
loadedStorageKey = null;
|
|
3604
|
+
storageLoad;
|
|
3605
|
+
hostInputBaselineConfig;
|
|
3603
3606
|
config = null;
|
|
3604
3607
|
tabsId;
|
|
3605
3608
|
componentInstanceId;
|
|
@@ -3647,6 +3650,7 @@ class PraxisTabs {
|
|
|
3647
3650
|
groupComponent;
|
|
3648
3651
|
navComponent;
|
|
3649
3652
|
hostElement = inject(ElementRef);
|
|
3653
|
+
destroyRef = inject(DestroyRef);
|
|
3650
3654
|
headerResizeObserver;
|
|
3651
3655
|
observedHeader;
|
|
3652
3656
|
headerResizeFrame;
|
|
@@ -3660,13 +3664,32 @@ class PraxisTabs {
|
|
|
3660
3664
|
runtimeStyleEl;
|
|
3661
3665
|
lastRuntimeCss = '';
|
|
3662
3666
|
ngOnInit() {
|
|
3667
|
+
this.storageInitialized = true;
|
|
3668
|
+
if (this.config != null && this.hostInputBaselineConfig === undefined) {
|
|
3669
|
+
this.hostInputBaselineConfig = this.cloneTabsMetadata(this.config);
|
|
3670
|
+
}
|
|
3663
3671
|
this.syncSelectionFromConfig();
|
|
3664
3672
|
this.syncGeneratedContentForm();
|
|
3665
3673
|
this.loadStoredConfigForCurrentIdentity({ warnMissingId: false });
|
|
3666
3674
|
this.syncRuntimeStyleElement();
|
|
3667
3675
|
}
|
|
3668
3676
|
ngOnChanges(changes) {
|
|
3669
|
-
if (
|
|
3677
|
+
if ('config' in changes) {
|
|
3678
|
+
const incoming = changes['config'].currentValue;
|
|
3679
|
+
this.hostInputBaselineConfig =
|
|
3680
|
+
incoming != null ? this.cloneTabsMetadata(incoming) : null;
|
|
3681
|
+
if (this.usesInputFirstConfig()) {
|
|
3682
|
+
this.storageLoad?.unsubscribe();
|
|
3683
|
+
this.storageLoad = undefined;
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
if (this.storageInitialized &&
|
|
3687
|
+
(changes['tabsId'] || changes['componentInstanceId'] || changes['configPersistenceStrategy'])) {
|
|
3688
|
+
this.loadedStorageKey = null;
|
|
3689
|
+
if (this.isVolatilePersistence() || this.usesInputFirstConfig()) {
|
|
3690
|
+
this.storageLoad?.unsubscribe();
|
|
3691
|
+
this.storageLoad = undefined;
|
|
3692
|
+
}
|
|
3670
3693
|
this.loadStoredConfigForCurrentIdentity({ warnMissingId: false });
|
|
3671
3694
|
}
|
|
3672
3695
|
if (changes['config'] && this.config) {
|
|
@@ -3689,6 +3712,8 @@ class PraxisTabs {
|
|
|
3689
3712
|
}
|
|
3690
3713
|
ngOnDestroy() {
|
|
3691
3714
|
this.destroyed = true;
|
|
3715
|
+
this.storageLoad?.unsubscribe();
|
|
3716
|
+
this.storageLoad = undefined;
|
|
3692
3717
|
this.headerResizeObserver?.disconnect();
|
|
3693
3718
|
if (this.headerResizeFrame !== undefined) {
|
|
3694
3719
|
this.hostElement.nativeElement.ownerDocument.defaultView?.cancelAnimationFrame(this.headerResizeFrame);
|
|
@@ -4007,20 +4032,71 @@ class PraxisTabs {
|
|
|
4007
4032
|
this.persistConfig(this.config);
|
|
4008
4033
|
}
|
|
4009
4034
|
openEditor() {
|
|
4010
|
-
const
|
|
4035
|
+
const storageKey = this.storageKey({ warnMissingId: false });
|
|
4036
|
+
const idSuffix = storageKey || this.tabsId || 'default';
|
|
4037
|
+
const hasHostBaseline = this.hostInputBaselineConfig != null;
|
|
4038
|
+
const baselineConfig = hasHostBaseline
|
|
4039
|
+
? this.cloneTabsMetadata(this.hostInputBaselineConfig)
|
|
4040
|
+
: undefined;
|
|
4041
|
+
const canPersist = () => Boolean(storageKey) && !this.isVolatilePersistence() && !this.usesInputFirstConfig();
|
|
4042
|
+
let savedViaHandler = false;
|
|
4043
|
+
let resetViaHandler = false;
|
|
4044
|
+
let committed = false;
|
|
4045
|
+
let appliedPreview = false;
|
|
4011
4046
|
const initialDocument = createTabsAuthoringDocument({
|
|
4012
4047
|
config: this.config ?? {},
|
|
4013
4048
|
bindings: this.currentTabsBindings(),
|
|
4014
4049
|
});
|
|
4015
4050
|
const ref = this.settings.open({
|
|
4016
|
-
id: `praxis-tabs-editor:${
|
|
4051
|
+
id: `praxis-tabs-editor:${idSuffix}`,
|
|
4052
|
+
owner: this.destroyRef,
|
|
4017
4053
|
title: this.t('settings.title', 'Configurar abas'),
|
|
4054
|
+
configStorageKey: canPersist() ? (storageKey ?? undefined) : undefined,
|
|
4055
|
+
onSave: canPersist() && storageKey
|
|
4056
|
+
? async (value) => {
|
|
4057
|
+
if (!canPersist() || this.storageKey({ warnMissingId: false }) !== storageKey) {
|
|
4058
|
+
throw new Error('Tabs configuration persistence target is no longer active.');
|
|
4059
|
+
}
|
|
4060
|
+
const document = normalizeTabsAuthoringDocument(value);
|
|
4061
|
+
const plan = buildTabsApplyPlan(document, {
|
|
4062
|
+
currentBindings: this.currentTabsBindings(),
|
|
4063
|
+
currentConfig: this.config,
|
|
4064
|
+
}, {
|
|
4065
|
+
saveConfig: true,
|
|
4066
|
+
saveBindings: false,
|
|
4067
|
+
});
|
|
4068
|
+
if (plan.diagnostics.some((item) => item.level === 'error')) {
|
|
4069
|
+
throw new Error('Invalid tabs configuration');
|
|
4070
|
+
}
|
|
4071
|
+
await firstValueFrom(this.storage.saveConfig(storageKey, this.cloneTabsMetadata(plan.canonicalConfig)));
|
|
4072
|
+
savedViaHandler = true;
|
|
4073
|
+
}
|
|
4074
|
+
: undefined,
|
|
4075
|
+
onReset: canPersist() && storageKey
|
|
4076
|
+
? async () => {
|
|
4077
|
+
if (!canPersist() || this.storageKey({ warnMissingId: false }) !== storageKey) {
|
|
4078
|
+
throw new Error('Tabs configuration persistence target is no longer active.');
|
|
4079
|
+
}
|
|
4080
|
+
await firstValueFrom(this.storage.clearConfig(storageKey));
|
|
4081
|
+
resetViaHandler = true;
|
|
4082
|
+
}
|
|
4083
|
+
: undefined,
|
|
4018
4084
|
content: {
|
|
4019
4085
|
component: PraxisTabsConfigEditor,
|
|
4020
4086
|
inputs: { document: initialDocument },
|
|
4021
4087
|
},
|
|
4022
4088
|
});
|
|
4023
|
-
const
|
|
4089
|
+
const restoreBaseline = () => {
|
|
4090
|
+
this.config =
|
|
4091
|
+
hasHostBaseline && baselineConfig
|
|
4092
|
+
? this.cloneTabsMetadata(baselineConfig)
|
|
4093
|
+
: {};
|
|
4094
|
+
this.syncSelectionFromConfig();
|
|
4095
|
+
this.syncGeneratedContentForm();
|
|
4096
|
+
this.syncRuntimeStyleElement();
|
|
4097
|
+
this.configChange.emit({ inputPatch: { config: this.cloneTabsMetadata(this.config) } });
|
|
4098
|
+
};
|
|
4099
|
+
const applyDocument = (value, options) => {
|
|
4024
4100
|
const document = normalizeTabsAuthoringDocument(value);
|
|
4025
4101
|
const plan = buildTabsApplyPlan(document, {
|
|
4026
4102
|
currentBindings: this.currentTabsBindings(),
|
|
@@ -4029,10 +4105,43 @@ class PraxisTabs {
|
|
|
4029
4105
|
saveConfig: true,
|
|
4030
4106
|
saveBindings: false,
|
|
4031
4107
|
});
|
|
4032
|
-
this.applyTabsAuthoringPlan(plan);
|
|
4108
|
+
this.applyTabsAuthoringPlan(plan, options);
|
|
4033
4109
|
};
|
|
4034
|
-
ref.applied$.pipe(takeUntil(this.destroy$)).subscribe(
|
|
4035
|
-
|
|
4110
|
+
ref.applied$.pipe(takeUntil(this.destroy$)).subscribe((val) => {
|
|
4111
|
+
if (!val)
|
|
4112
|
+
return;
|
|
4113
|
+
appliedPreview = true;
|
|
4114
|
+
applyDocument(val, { skipStoragePersist: true });
|
|
4115
|
+
});
|
|
4116
|
+
ref.saved$.pipe(takeUntil(this.destroy$)).subscribe((val) => {
|
|
4117
|
+
const skipStoragePersist = savedViaHandler;
|
|
4118
|
+
savedViaHandler = false;
|
|
4119
|
+
if (!val)
|
|
4120
|
+
return;
|
|
4121
|
+
committed = true;
|
|
4122
|
+
appliedPreview = false;
|
|
4123
|
+
applyDocument(val, { skipStoragePersist });
|
|
4124
|
+
});
|
|
4125
|
+
ref.reset$?.pipe(takeUntil(this.destroy$)).subscribe(() => {
|
|
4126
|
+
const skipClear = resetViaHandler;
|
|
4127
|
+
resetViaHandler = false;
|
|
4128
|
+
committed = true;
|
|
4129
|
+
appliedPreview = false;
|
|
4130
|
+
if (!skipClear && canPersist() && storageKey) {
|
|
4131
|
+
this.storage.clearConfig(storageKey).pipe(take(1)).subscribe({
|
|
4132
|
+
error: (error) => this.logger.warn('[PraxisTabs] Failed to clear tabs configuration.', {
|
|
4133
|
+
context: { lib: 'praxis-tabs', component: 'PraxisTabs' },
|
|
4134
|
+
data: { key: storageKey, error },
|
|
4135
|
+
}),
|
|
4136
|
+
});
|
|
4137
|
+
}
|
|
4138
|
+
restoreBaseline();
|
|
4139
|
+
});
|
|
4140
|
+
ref.closed$?.pipe(take(1), takeUntil(this.destroy$)).subscribe(() => {
|
|
4141
|
+
if (appliedPreview && !committed) {
|
|
4142
|
+
restoreBaseline();
|
|
4143
|
+
}
|
|
4144
|
+
});
|
|
4036
4145
|
}
|
|
4037
4146
|
openAiAssistant() {
|
|
4038
4147
|
this.initializeAiAssistantController();
|
|
@@ -4368,34 +4477,95 @@ class PraxisTabs {
|
|
|
4368
4477
|
}
|
|
4369
4478
|
/** Clears persisted tabs configuration to fallback to defaults */
|
|
4370
4479
|
resetPreferences() {
|
|
4480
|
+
if (this.isVolatilePersistence() || this.usesInputFirstConfig()) {
|
|
4481
|
+
return;
|
|
4482
|
+
}
|
|
4371
4483
|
const key = this.storageKey();
|
|
4372
4484
|
if (!key)
|
|
4373
4485
|
return;
|
|
4374
4486
|
try {
|
|
4375
|
-
this.storage.clearConfig(key).pipe(take(1)).subscribe({
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4487
|
+
this.storage.clearConfig(key).pipe(take(1)).subscribe({
|
|
4488
|
+
next: () => {
|
|
4489
|
+
try {
|
|
4490
|
+
this.snack.open(this.t('settings.resetDone', 'Preferencias de abas redefinidas'), undefined, { duration: 2000 });
|
|
4491
|
+
}
|
|
4492
|
+
catch { }
|
|
4493
|
+
},
|
|
4494
|
+
error: (error) => this.logger.warn('[PraxisTabs] Failed to clear tabs configuration.', {
|
|
4495
|
+
context: { lib: 'praxis-tabs', component: 'PraxisTabs' },
|
|
4496
|
+
data: { key, error },
|
|
4497
|
+
}),
|
|
4498
|
+
});
|
|
4380
4499
|
}
|
|
4381
4500
|
catch { }
|
|
4382
4501
|
// keep current in-memory config; caller may choose to reload
|
|
4383
4502
|
}
|
|
4384
4503
|
openQuickSetup() {
|
|
4385
|
-
const
|
|
4504
|
+
const storageKey = this.storageKey({ warnMissingId: false });
|
|
4505
|
+
const idSuffix = storageKey || this.tabsId || 'default';
|
|
4506
|
+
const hasHostBaseline = this.hostInputBaselineConfig != null;
|
|
4507
|
+
const baselineConfig = hasHostBaseline
|
|
4508
|
+
? this.cloneTabsMetadata(this.hostInputBaselineConfig)
|
|
4509
|
+
: undefined;
|
|
4510
|
+
const canPersist = () => Boolean(storageKey) && !this.isVolatilePersistence() && !this.usesInputFirstConfig();
|
|
4511
|
+
let savedViaHandler = false;
|
|
4512
|
+
let resetViaHandler = false;
|
|
4513
|
+
let committed = false;
|
|
4514
|
+
let appliedPreview = false;
|
|
4386
4515
|
const initialDocument = createTabsAuthoringDocument({
|
|
4387
4516
|
config: this.config ?? {},
|
|
4388
4517
|
bindings: this.currentTabsBindings(),
|
|
4389
4518
|
});
|
|
4390
4519
|
const ref = this.settings.open({
|
|
4391
|
-
id: `praxis-tabs-quick-setup:${
|
|
4520
|
+
id: `praxis-tabs-quick-setup:${idSuffix}`,
|
|
4521
|
+
owner: this.destroyRef,
|
|
4392
4522
|
title: this.t('quickSetup.title', 'Criar abas rapidamente'),
|
|
4523
|
+
configStorageKey: canPersist() ? (storageKey ?? undefined) : undefined,
|
|
4524
|
+
onSave: canPersist() && storageKey
|
|
4525
|
+
? async (value) => {
|
|
4526
|
+
if (!canPersist() || this.storageKey({ warnMissingId: false }) !== storageKey) {
|
|
4527
|
+
throw new Error('Tabs configuration persistence target is no longer active.');
|
|
4528
|
+
}
|
|
4529
|
+
const document = normalizeTabsAuthoringDocument(value);
|
|
4530
|
+
const plan = buildTabsApplyPlan(document, {
|
|
4531
|
+
currentBindings: this.currentTabsBindings(),
|
|
4532
|
+
currentConfig: this.config,
|
|
4533
|
+
}, {
|
|
4534
|
+
saveConfig: true,
|
|
4535
|
+
saveBindings: false,
|
|
4536
|
+
});
|
|
4537
|
+
if (plan.diagnostics.some((item) => item.level === 'error')) {
|
|
4538
|
+
throw new Error('Invalid tabs configuration');
|
|
4539
|
+
}
|
|
4540
|
+
await firstValueFrom(this.storage.saveConfig(storageKey, this.cloneTabsMetadata(plan.canonicalConfig)));
|
|
4541
|
+
savedViaHandler = true;
|
|
4542
|
+
}
|
|
4543
|
+
: undefined,
|
|
4544
|
+
onReset: canPersist() && storageKey
|
|
4545
|
+
? async () => {
|
|
4546
|
+
if (!canPersist() || this.storageKey({ warnMissingId: false }) !== storageKey) {
|
|
4547
|
+
throw new Error('Tabs configuration persistence target is no longer active.');
|
|
4548
|
+
}
|
|
4549
|
+
await firstValueFrom(this.storage.clearConfig(storageKey));
|
|
4550
|
+
resetViaHandler = true;
|
|
4551
|
+
}
|
|
4552
|
+
: undefined,
|
|
4393
4553
|
content: {
|
|
4394
4554
|
component: TabsQuickSetupComponent,
|
|
4395
4555
|
inputs: { document: initialDocument },
|
|
4396
4556
|
},
|
|
4397
4557
|
});
|
|
4398
|
-
const
|
|
4558
|
+
const restoreBaseline = () => {
|
|
4559
|
+
this.config =
|
|
4560
|
+
hasHostBaseline && baselineConfig
|
|
4561
|
+
? this.cloneTabsMetadata(baselineConfig)
|
|
4562
|
+
: {};
|
|
4563
|
+
this.syncSelectionFromConfig();
|
|
4564
|
+
this.syncGeneratedContentForm();
|
|
4565
|
+
this.syncRuntimeStyleElement();
|
|
4566
|
+
this.configChange.emit({ inputPatch: { config: this.cloneTabsMetadata(this.config) } });
|
|
4567
|
+
};
|
|
4568
|
+
const applyDocument = (value, options) => {
|
|
4399
4569
|
const document = normalizeTabsAuthoringDocument(value);
|
|
4400
4570
|
const plan = buildTabsApplyPlan(document, {
|
|
4401
4571
|
currentBindings: this.currentTabsBindings(),
|
|
@@ -4404,10 +4574,43 @@ class PraxisTabs {
|
|
|
4404
4574
|
saveConfig: true,
|
|
4405
4575
|
saveBindings: false,
|
|
4406
4576
|
});
|
|
4407
|
-
this.applyTabsAuthoringPlan(plan);
|
|
4577
|
+
this.applyTabsAuthoringPlan(plan, options);
|
|
4408
4578
|
};
|
|
4409
|
-
ref.applied$.pipe(takeUntil(this.destroy$)).subscribe(
|
|
4410
|
-
|
|
4579
|
+
ref.applied$.pipe(takeUntil(this.destroy$)).subscribe((val) => {
|
|
4580
|
+
if (!val)
|
|
4581
|
+
return;
|
|
4582
|
+
appliedPreview = true;
|
|
4583
|
+
applyDocument(val, { skipStoragePersist: true });
|
|
4584
|
+
});
|
|
4585
|
+
ref.saved$.pipe(takeUntil(this.destroy$)).subscribe((val) => {
|
|
4586
|
+
const skipStoragePersist = savedViaHandler;
|
|
4587
|
+
savedViaHandler = false;
|
|
4588
|
+
if (!val)
|
|
4589
|
+
return;
|
|
4590
|
+
committed = true;
|
|
4591
|
+
appliedPreview = false;
|
|
4592
|
+
applyDocument(val, { skipStoragePersist });
|
|
4593
|
+
});
|
|
4594
|
+
ref.reset$?.pipe(takeUntil(this.destroy$)).subscribe(() => {
|
|
4595
|
+
const skipClear = resetViaHandler;
|
|
4596
|
+
resetViaHandler = false;
|
|
4597
|
+
committed = true;
|
|
4598
|
+
appliedPreview = false;
|
|
4599
|
+
if (!skipClear && canPersist() && storageKey) {
|
|
4600
|
+
this.storage.clearConfig(storageKey).pipe(take(1)).subscribe({
|
|
4601
|
+
error: (error) => this.logger.warn('[PraxisTabs] Failed to clear tabs configuration.', {
|
|
4602
|
+
context: { lib: 'praxis-tabs', component: 'PraxisTabs' },
|
|
4603
|
+
data: { key: storageKey, error },
|
|
4604
|
+
}),
|
|
4605
|
+
});
|
|
4606
|
+
}
|
|
4607
|
+
restoreBaseline();
|
|
4608
|
+
});
|
|
4609
|
+
ref.closed$?.pipe(take(1), takeUntil(this.destroy$)).subscribe(() => {
|
|
4610
|
+
if (appliedPreview && !committed) {
|
|
4611
|
+
restoreBaseline();
|
|
4612
|
+
}
|
|
4613
|
+
});
|
|
4411
4614
|
}
|
|
4412
4615
|
currentTabsBindings() {
|
|
4413
4616
|
return {
|
|
@@ -4418,7 +4621,7 @@ class PraxisTabs {
|
|
|
4418
4621
|
t(key, fallback) {
|
|
4419
4622
|
return this.i18n.t(key, undefined, fallback, PRAXIS_TABS_I18N_NAMESPACE);
|
|
4420
4623
|
}
|
|
4421
|
-
applyTabsAuthoringPlan(plan) {
|
|
4624
|
+
applyTabsAuthoringPlan(plan, options) {
|
|
4422
4625
|
if (plan.diagnostics.some((item) => item.level === 'error')) {
|
|
4423
4626
|
return;
|
|
4424
4627
|
}
|
|
@@ -4438,7 +4641,7 @@ class PraxisTabs {
|
|
|
4438
4641
|
this.navLoaded.add(navIndex);
|
|
4439
4642
|
}
|
|
4440
4643
|
}
|
|
4441
|
-
if (plan.persistence.saveConfig) {
|
|
4644
|
+
if (plan.persistence.saveConfig && !options?.skipStoragePersist) {
|
|
4442
4645
|
this.persistConfig(this.config);
|
|
4443
4646
|
}
|
|
4444
4647
|
this.configChange.emit({ inputPatch: { config: this.cloneTabsMetadata(this.config) } });
|
|
@@ -4448,22 +4651,39 @@ class PraxisTabs {
|
|
|
4448
4651
|
return id ? `tabs:${id}` : null;
|
|
4449
4652
|
}
|
|
4450
4653
|
loadStoredConfigForCurrentIdentity(options = {}) {
|
|
4451
|
-
|
|
4654
|
+
this.storageLoad?.unsubscribe();
|
|
4655
|
+
this.storageLoad = undefined;
|
|
4656
|
+
if (this.isVolatilePersistence() || this.usesInputFirstConfig()) {
|
|
4452
4657
|
return;
|
|
4453
4658
|
}
|
|
4454
4659
|
const key = this.storageKey(options);
|
|
4455
4660
|
if (!key || key === this.loadedStorageKey)
|
|
4456
4661
|
return;
|
|
4457
4662
|
this.loadedStorageKey = key;
|
|
4458
|
-
this.storage.loadConfig(key).pipe(take(1)).subscribe(
|
|
4459
|
-
|
|
4460
|
-
this.
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
this.
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4663
|
+
this.storageLoad = this.storage.loadConfig(key).pipe(take(1)).subscribe({
|
|
4664
|
+
next: (stored) => {
|
|
4665
|
+
if (this.destroyed || this.isVolatilePersistence() || this.usesInputFirstConfig()) {
|
|
4666
|
+
return;
|
|
4667
|
+
}
|
|
4668
|
+
if (key !== this.storageKey({ warnMissingId: false })) {
|
|
4669
|
+
return;
|
|
4670
|
+
}
|
|
4671
|
+
if (stored) {
|
|
4672
|
+
this.config = stored;
|
|
4673
|
+
this.syncGeneratedContentForm();
|
|
4674
|
+
this.syncRuntimeStyleElement();
|
|
4675
|
+
this.configChange.emit({ inputPatch: { config: this.cloneTabsMetadata(this.config) } });
|
|
4676
|
+
}
|
|
4677
|
+
this.syncSelectionFromConfig();
|
|
4678
|
+
this.reapplyControlledSelectedIndex();
|
|
4679
|
+
},
|
|
4680
|
+
error: () => {
|
|
4681
|
+
if (this.destroyed) {
|
|
4682
|
+
return;
|
|
4683
|
+
}
|
|
4684
|
+
this.syncSelectionFromConfig();
|
|
4685
|
+
this.reapplyControlledSelectedIndex();
|
|
4686
|
+
},
|
|
4467
4687
|
});
|
|
4468
4688
|
}
|
|
4469
4689
|
syncSelectionFromConfig() {
|
|
@@ -4523,15 +4743,25 @@ class PraxisTabs {
|
|
|
4523
4743
|
}
|
|
4524
4744
|
}
|
|
4525
4745
|
persistConfig(config) {
|
|
4526
|
-
if (this.usesInputFirstConfig())
|
|
4746
|
+
if (this.isVolatilePersistence() || this.usesInputFirstConfig())
|
|
4527
4747
|
return;
|
|
4528
4748
|
const key = this.storageKey();
|
|
4529
4749
|
if (!key || !config)
|
|
4530
4750
|
return;
|
|
4531
|
-
this.storage.saveConfig(key, config).pipe(take(1)).subscribe({
|
|
4751
|
+
this.storage.saveConfig(key, config).pipe(take(1)).subscribe({
|
|
4752
|
+
error: (error) => this.logger.warn('[PraxisTabs] Failed to persist tabs configuration.', {
|
|
4753
|
+
context: { lib: 'praxis-tabs', component: 'PraxisTabs' },
|
|
4754
|
+
data: { key, error },
|
|
4755
|
+
}),
|
|
4756
|
+
});
|
|
4757
|
+
}
|
|
4758
|
+
isVolatilePersistence() {
|
|
4759
|
+
return (normalizeConfigPersistenceStrategy(this.configPersistenceStrategy, 'local-first') ===
|
|
4760
|
+
'volatile');
|
|
4532
4761
|
}
|
|
4533
4762
|
usesInputFirstConfig() {
|
|
4534
|
-
|
|
4763
|
+
const normalized = normalizeConfigPersistenceStrategy(this.configPersistenceStrategy, 'local-first');
|
|
4764
|
+
return normalized === 'volatile' || (normalized === 'input-first' && this.hostInputBaselineConfig != null);
|
|
4535
4765
|
}
|
|
4536
4766
|
componentKeyId(options = {}) {
|
|
4537
4767
|
const key = this.componentKeys.buildComponentId({
|
|
@@ -5270,7 +5500,7 @@ class PraxisTabs {
|
|
|
5270
5500
|
<mat-icon aria-hidden="true" fontIcon="edit"></mat-icon>
|
|
5271
5501
|
</button>
|
|
5272
5502
|
}
|
|
5273
|
-
@if (enableCustomization && tabsId) {
|
|
5503
|
+
@if (enableCustomization && tabsId && !isVolatilePersistence() && !usesInputFirstConfig()) {
|
|
5274
5504
|
<button
|
|
5275
5505
|
mat-mini-fab
|
|
5276
5506
|
class="edit-fab edit-fab-secondary"
|
|
@@ -5596,7 +5826,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
5596
5826
|
<mat-icon aria-hidden="true" fontIcon="edit"></mat-icon>
|
|
5597
5827
|
</button>
|
|
5598
5828
|
}
|
|
5599
|
-
@if (enableCustomization && tabsId) {
|
|
5829
|
+
@if (enableCustomization && tabsId && !isVolatilePersistence() && !usesInputFirstConfig()) {
|
|
5600
5830
|
<button
|
|
5601
5831
|
mat-mini-fab
|
|
5602
5832
|
class="edit-fab edit-fab-secondary"
|
|
@@ -5866,10 +6096,10 @@ const PRAXIS_TABS_COMPONENT_METADATA = {
|
|
|
5866
6096
|
},
|
|
5867
6097
|
{
|
|
5868
6098
|
name: 'configPersistenceStrategy',
|
|
5869
|
-
type: '"storage-first" | "input-first"',
|
|
6099
|
+
type: '"storage-first" | "local-first" | "input-first" | "volatile"',
|
|
5870
6100
|
default: 'storage-first',
|
|
5871
6101
|
label: 'Estratégia de persistência',
|
|
5872
|
-
description: 'Define
|
|
6102
|
+
description: 'Define a precedência entre storage e entrada (`local-first`/`storage-first` para persistência local, `input-first` para composição dona do config, `volatile` para previews efêmeros sem leitura ou escrita).',
|
|
5873
6103
|
},
|
|
5874
6104
|
{
|
|
5875
6105
|
name: 'selectedIndex',
|
|
@@ -5989,6 +6219,10 @@ const PRAXIS_TABS_COMPONENT_METADATA = {
|
|
|
5989
6219
|
scope: 'any',
|
|
5990
6220
|
},
|
|
5991
6221
|
],
|
|
6222
|
+
schemaVersion: '1.0.0',
|
|
6223
|
+
transientInputs: ['context', 'selectedIndex'],
|
|
6224
|
+
lockedInputs: ['tabsId'],
|
|
6225
|
+
visualOverrideKeys: ['config', 'enableCustomization', 'configPersistenceStrategy'],
|
|
5992
6226
|
tags: ['widget', 'tabs', 'configurable', 'stable'],
|
|
5993
6227
|
lib: '@praxisui/tabs',
|
|
5994
6228
|
ports: PRAXIS_TABS_PORTS,
|
|
@@ -6080,8 +6314,8 @@ const PRAXIS_TABS_AUTHORING_MANIFEST = {
|
|
|
6080
6314
|
{ name: 'componentInstanceId', type: 'string', description: 'Optional instance discriminator for persistence scope.' },
|
|
6081
6315
|
{
|
|
6082
6316
|
name: 'configPersistenceStrategy',
|
|
6083
|
-
type: '"
|
|
6084
|
-
description: 'Controls whether persisted customization or explicit input config governs the runtime
|
|
6317
|
+
type: '"local-first" | "input-first" | "volatile" | "storage-first"',
|
|
6318
|
+
description: 'Controls whether persisted customization or explicit input config governs the runtime (`local-first`, legacy `storage-first`, composition-owned `input-first`, or ephemeral `volatile`).',
|
|
6085
6319
|
},
|
|
6086
6320
|
{ name: 'form', type: 'FormGroup', description: 'FormGroup consumed by dynamic field content.' },
|
|
6087
6321
|
{ name: 'context', type: 'Record<string, any>', description: 'Context passed to nested widgets.' },
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisui/tabs",
|
|
3
|
-
"version": "10.0.0-rc.
|
|
3
|
+
"version": "10.0.0-rc.62",
|
|
4
4
|
"description": "Configurable tabs (group and nav) for Praxis UI with metadata-driven content and runtime editor.",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^21.0.0",
|
|
7
7
|
"@angular/core": "^21.0.0",
|
|
8
8
|
"@angular/material": "^21.0.0",
|
|
9
9
|
"@angular/cdk": "^21.0.0",
|
|
10
|
-
"@praxisui/core": "^10.0.0-rc.
|
|
11
|
-
"@praxisui/dynamic-fields": "^10.0.0-rc.
|
|
12
|
-
"@praxisui/settings-panel": "^10.0.0-rc.
|
|
10
|
+
"@praxisui/core": "^10.0.0-rc.62",
|
|
11
|
+
"@praxisui/dynamic-fields": "^10.0.0-rc.62",
|
|
12
|
+
"@praxisui/settings-panel": "^10.0.0-rc.62",
|
|
13
13
|
"@angular/forms": "^21.0.0",
|
|
14
14
|
"@angular/router": "^21.0.0",
|
|
15
|
-
"@praxisui/ai": "^10.0.0-rc.
|
|
15
|
+
"@praxisui/ai": "^10.0.0-rc.62",
|
|
16
16
|
"rxjs": "~7.8.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
@@ -249,6 +249,7 @@ config explícita -> config persistida -> seleção clamp para `0` quando índic
|
|
|
249
249
|
| Path/Rule | Validation phase | Behavior on fail | Error code / warning | Notes |
|
|
250
250
|
| --- | --- | --- | --- | --- |
|
|
251
251
|
| `tabsId` para persistência | init/runtime | warning + disable persistence | `praxis-tabs:missing-tabs-id` | Fluxo visual continua sem restore/save de estado. |
|
|
252
|
+
| `configPersistenceStrategy` | init/runtime | aceita `local-first` (e legado `storage-first`), `input-first` e `volatile` | n/a | `input-first` com `[config]` preserva ownership da composição; `volatile` nunca lê, salva ou limpa storage. |
|
|
252
253
|
| índices de seleção (`group.selectedIndex`, `nav.selectedIndex`) | runtime | clamp para faixa válida | n/a | Previne acesso fora dos limites após mudanças dinâmicas. |
|
|
253
254
|
| payload de reorder/nav click inválido | runtime | ignore operation | n/a | Guardas de índice evitam mutações incorretas. |
|
|
254
255
|
| valores CSS inseguros em appearance | runtime sanitize | sanitize/ignore | n/a | `sanitizeCssValue()` limita superfícies de injeção de estilo. |
|
package/types/praxisui-tabs.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ interface TabsConfigChangeEvent {
|
|
|
60
60
|
config: TabsMetadata;
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
type TabsConfigPersistenceStrategy = 'storage-first' | 'input-first';
|
|
63
|
+
type TabsConfigPersistenceStrategy = 'storage-first' | 'local-first' | 'input-first' | 'volatile';
|
|
64
64
|
type TabsAppearanceVariant = 'underline' | 'pill' | 'segmented';
|
|
65
65
|
type TabItemTone = 'default' | 'primary' | 'accent' | 'outlined';
|
|
66
66
|
interface TabsAppearanceConfig {
|
|
@@ -188,7 +188,10 @@ declare class PraxisTabs implements OnInit, OnChanges, DoCheck, OnDestroy {
|
|
|
188
188
|
private readonly route;
|
|
189
189
|
private readonly aiAssistantSessionEffect;
|
|
190
190
|
private warnedMissingId;
|
|
191
|
+
private storageInitialized;
|
|
191
192
|
private loadedStorageKey;
|
|
193
|
+
private storageLoad?;
|
|
194
|
+
private hostInputBaselineConfig?;
|
|
192
195
|
config: TabsMetadata | null;
|
|
193
196
|
tabsId: string;
|
|
194
197
|
componentInstanceId?: string;
|
|
@@ -222,6 +225,7 @@ declare class PraxisTabs implements OnInit, OnChanges, DoCheck, OnDestroy {
|
|
|
222
225
|
private groupComponent?;
|
|
223
226
|
private navComponent?;
|
|
224
227
|
private readonly hostElement;
|
|
228
|
+
private readonly destroyRef;
|
|
225
229
|
private headerResizeObserver?;
|
|
226
230
|
private observedHeader?;
|
|
227
231
|
private headerResizeFrame?;
|
|
@@ -308,7 +312,8 @@ declare class PraxisTabs implements OnInit, OnChanges, DoCheck, OnDestroy {
|
|
|
308
312
|
private syncSelectionFromConfigChange;
|
|
309
313
|
private pruneLoadedIndexes;
|
|
310
314
|
private persistConfig;
|
|
311
|
-
|
|
315
|
+
protected isVolatilePersistence(): boolean;
|
|
316
|
+
protected usesInputFirstConfig(): boolean;
|
|
312
317
|
private componentKeyId;
|
|
313
318
|
private warnMissingId;
|
|
314
319
|
private clampIndex;
|