@praxisui/expansion 10.0.0-rc.60 → 10.0.0-rc.61
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/ai/component-registry.json +22 -10
- package/fesm2022/praxisui-expansion.mjs +126 -22
- package/package.json +5 -5
- package/types/praxisui-expansion.d.ts +7 -3
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ export class ExpansionHostComponent {
|
|
|
96
96
|
- `config: ExpansionMetadata | null`: canonical accordion and panel configuration.
|
|
97
97
|
- `expansionId: string`: required stable id used for local configuration persistence.
|
|
98
98
|
- `componentInstanceId?: string`: disambiguates repeated instances on the same route.
|
|
99
|
-
- `configPersistenceStrategy: 'storage-first' | 'input-first'`: defaults to `storage-first
|
|
99
|
+
- `configPersistenceStrategy: 'local-first' | 'storage-first' | 'input-first' | 'volatile'`: defaults to `storage-first` (normalized as `local-first` via `@praxisui/core`); with `input-first` and a supplied `config`, the parent composition owns configuration without reading or writing storage; `volatile` disables all storage reads and writes unconditionally.
|
|
100
100
|
- `context: Record<string, unknown>`: context passed to dynamic child widgets.
|
|
101
101
|
- `strictValidation: boolean`: keeps runtime validation strict by default.
|
|
102
102
|
- `enableCustomization: boolean`: opens runtime authoring affordances.
|
|
@@ -189,7 +189,7 @@ export const appConfig = {
|
|
|
189
189
|
};
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
Without that provider, resource-backed table details remain fail-closed. Inline, same-origin `resourcePath`, and hypermedia sources retain their respective table contracts.
|
|
192
|
+
Without that provider, resource-backed table details remain fail-closed. Inline, same-origin `resourcePath`, and hypermedia sources retain their respective table contracts. `PraxisExpansion` honors `configPersistenceStrategy` (`'local-first' | 'input-first' | 'volatile'`), avoids premature persistence inside `ngOnChanges`, passes `configStorageKey` with async `onSave`/`onReset` Settings Panel handlers, and restores the host baseline config on reset.
|
|
193
193
|
|
|
194
194
|
## Public API Snapshot
|
|
195
195
|
|
|
@@ -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/expansion",
|
|
5
|
-
"packageVersion": "10.0.0-rc.
|
|
5
|
+
"packageVersion": "10.0.0-rc.61",
|
|
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": "
|
|
39
|
+
"description": "Define a precedência entre storage e entrada (`local-first`/`storage-first` para persistência standalone, `input-first` com config fornecido para composição dona da instância, `volatile` para execução efêmera sem leitura ou gravação).",
|
|
40
40
|
"label": "Estratégia de persistência",
|
|
41
41
|
"default": "storage-first"
|
|
42
42
|
},
|
|
@@ -121,6 +121,18 @@
|
|
|
121
121
|
"configurable"
|
|
122
122
|
],
|
|
123
123
|
"lib": "@praxisui/expansion",
|
|
124
|
+
"transientInputs": [
|
|
125
|
+
"context"
|
|
126
|
+
],
|
|
127
|
+
"lockedInputs": [
|
|
128
|
+
"expansionId"
|
|
129
|
+
],
|
|
130
|
+
"visualOverrideKeys": [
|
|
131
|
+
"config",
|
|
132
|
+
"enableCustomization",
|
|
133
|
+
"configPersistenceStrategy"
|
|
134
|
+
],
|
|
135
|
+
"schemaVersion": "1.0.0",
|
|
124
136
|
"actions": [
|
|
125
137
|
{
|
|
126
138
|
"id": "panel-opened",
|
|
@@ -804,8 +816,8 @@
|
|
|
804
816
|
},
|
|
805
817
|
{
|
|
806
818
|
"name": "configPersistenceStrategy",
|
|
807
|
-
"type": "\"
|
|
808
|
-
"description": "Host-owned lifecycle policy. Input-first with supplied config skips component storage; authoring returns the widget input document to its composition owner."
|
|
819
|
+
"type": "\"local-first\" | \"input-first\" | \"volatile\" | \"storage-first\"",
|
|
820
|
+
"description": "Host-owned lifecycle policy (`local-first`, legacy `storage-first`, composition-owned `input-first`, or ephemeral `volatile`). Input-first with supplied config skips component storage; authoring returns the widget input document to its composition owner."
|
|
809
821
|
},
|
|
810
822
|
{
|
|
811
823
|
"name": "context",
|
|
@@ -1986,9 +1998,9 @@
|
|
|
1986
1998
|
{
|
|
1987
1999
|
"chunkIndex": 0,
|
|
1988
2000
|
"chunkKind": "summary",
|
|
1989
|
-
"content": "Component ID: praxis-expansion\nSelector: praxis-expansion\nFriendly Name: Praxis Expansion Panel\nDescription: Acordeão/Painéis de expansão configuráveis por metadata, com aparência e tokens M3.\nLib/Package: @praxisui/expansion\nTags: widget, expansion, accordion, configurable\nInputs:\n - config (ExpansionMetadata)\n - expansionId (string)\n - componentInstanceId (string)\n - configPersistenceStrategy (\"storage-first\" | \"input-first\")\n - enableCustomization (boolean)\n - context (Record<string, any>)\n - strictValidation (boolean)\n - defaultOptions (MatExpansionPanelDefaultOptions)\nOutputs:\n - opened ({ panelId?: string; panelIndex: number })\n - closed ({ panelId?: string; panelIndex: number })\n - expandedChange ({ panelId?: string; panelIndex: number; expanded: boolean })\n - afterExpand ({ panelId?: string; panelIndex: number })\n - afterCollapse ({ panelId?: string; panelIndex: number })\n - destroyed ({ panelId?: string; panelIndex: number })\n - widgetEvent (WidgetEventEnvelope)\n",
|
|
2001
|
+
"content": "Component ID: praxis-expansion\nSelector: praxis-expansion\nFriendly Name: Praxis Expansion Panel\nDescription: Acordeão/Painéis de expansão configuráveis por metadata, com aparência e tokens M3.\nLib/Package: @praxisui/expansion\nTags: widget, expansion, accordion, configurable\nInputs:\n - config (ExpansionMetadata)\n - expansionId (string)\n - componentInstanceId (string)\n - configPersistenceStrategy (\"storage-first\" | \"local-first\" | \"input-first\" | \"volatile\")\n - enableCustomization (boolean)\n - context (Record<string, any>)\n - strictValidation (boolean)\n - defaultOptions (MatExpansionPanelDefaultOptions)\nOutputs:\n - opened ({ panelId?: string; panelIndex: number })\n - closed ({ panelId?: string; panelIndex: number })\n - expandedChange ({ panelId?: string; panelIndex: number; expanded: boolean })\n - afterExpand ({ panelId?: string; panelIndex: number })\n - afterCollapse ({ panelId?: string; panelIndex: number })\n - destroyed ({ panelId?: string; panelIndex: number })\n - widgetEvent (WidgetEventEnvelope)\n",
|
|
1990
2002
|
"sourcePointer": "projects/praxis-expansion/src/lib/praxis-expansion.metadata.ts",
|
|
1991
|
-
"contentHash": "
|
|
2003
|
+
"contentHash": "9f017572bd13d5a5fd452e5e6644b2933699322e31f83b09c967764b153d2f44",
|
|
1992
2004
|
"sourceKind": "component_definition",
|
|
1993
2005
|
"sourceId": "praxis-expansion",
|
|
1994
2006
|
"corpusVersion": "1.0.0"
|
|
@@ -2116,9 +2128,9 @@
|
|
|
2116
2128
|
{
|
|
2117
2129
|
"chunkIndex": 13,
|
|
2118
2130
|
"chunkKind": "authoring_manifest",
|
|
2119
|
-
"content": "{\"schemaVersion\":\"1.0.0\",\"manifestVersion\":\"1.0.0\",\"componentId\":\"praxis-expansion\",\"ownerPackage\":\"@praxisui/expansion\",\"configSchemaId\":\"ExpansionMetadata\",\"chunkSection\":\"runtimeInputs\",\"runtimeInputs\":[{\"name\":\"config\",\"type\":\"ExpansionMetadata\",\"description\":\"Canonical accordion and panel configuration.\"},{\"name\":\"expansionId\",\"type\":\"string\",\"description\":\"Stable id used to derive expansion config persistence scope.\"},{\"name\":\"componentInstanceId\",\"type\":\"string\",\"description\":\"Optional instance discriminator for persistence scope.\"},{\"name\":\"configPersistenceStrategy\",\"type\":\"\\\"
|
|
2131
|
+
"content": "{\"schemaVersion\":\"1.0.0\",\"manifestVersion\":\"1.0.0\",\"componentId\":\"praxis-expansion\",\"ownerPackage\":\"@praxisui/expansion\",\"configSchemaId\":\"ExpansionMetadata\",\"chunkSection\":\"runtimeInputs\",\"runtimeInputs\":[{\"name\":\"config\",\"type\":\"ExpansionMetadata\",\"description\":\"Canonical accordion and panel configuration.\"},{\"name\":\"expansionId\",\"type\":\"string\",\"description\":\"Stable id used to derive expansion config persistence scope.\"},{\"name\":\"componentInstanceId\",\"type\":\"string\",\"description\":\"Optional instance discriminator for persistence scope.\"},{\"name\":\"configPersistenceStrategy\",\"type\":\"\\\"local-first\\\" | \\\"input-first\\\" | \\\"volatile\\\" | \\\"storage-first\\\"\",\"description\":\"Host-owned lifecycle policy (`local-first`, legacy `storage-first`, composition-owned `input-first`, or ephemeral `volatile`). Input-first with supplied config skips component storage; authoring returns the widget input document to its composition owner.\"},{\"name\":\"context\",\"type\":\"Record<string, any>\",\"description\":\"Context passed to nested widgets.\"},{\"name\":\"strictValidation\",\"type\":\"boolean\",\"description\":\"Controls nested widget validation strictness.\"},{\"name\":\"defaultOptions\",\"type\":\"MatExpansionPanelDefaultOptions\",\"description\":\"Instance-level Material expansion defaults.\"},{\"name\":\"enableCustomization\",\"type\":\"boolean\",\"description\":\"Enables Settings Panel authoring surfaces.\"}]}",
|
|
2120
2132
|
"sourcePointer": "projects/praxis-expansion/src/lib/ai/praxis-expansion-authoring-manifest.ts",
|
|
2121
|
-
"contentHash": "
|
|
2133
|
+
"contentHash": "6c400a15cc84ba171326823ba7dbfaf54ff6b5cf70963b1531686769af47d92c",
|
|
2122
2134
|
"sourceKind": "component_definition",
|
|
2123
2135
|
"sourceId": "praxis-expansion",
|
|
2124
2136
|
"corpusVersion": "1.0.0"
|
|
@@ -21,7 +21,7 @@ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
|
21
21
|
import * as i5 from '@angular/material/tooltip';
|
|
22
22
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
23
23
|
import { DynamicFieldLoaderDirective } from '@praxisui/dynamic-fields';
|
|
24
|
-
import { deepMerge, ASYNC_CONFIG_STORAGE, DynamicFormService, ComponentKeyService, normalizeResourceQuickViewBinding, resolveResourceQuickViewTarget, DynamicWidgetLoaderDirective, PraxisIconDirective, PraxisQuickViewTriggerDirective, EmptyStateCardComponent, PraxisIconButtonComponent, ComponentMetadataRegistry } from '@praxisui/core';
|
|
24
|
+
import { deepMerge, ASYNC_CONFIG_STORAGE, LoggerService, DynamicFormService, ComponentKeyService, normalizeResourceQuickViewBinding, resolveResourceQuickViewTarget, normalizeConfigPersistenceStrategy, DynamicWidgetLoaderDirective, PraxisIconDirective, PraxisQuickViewTriggerDirective, EmptyStateCardComponent, PraxisIconButtonComponent, ComponentMetadataRegistry } from '@praxisui/core';
|
|
25
25
|
import { SettingsPanelService, SETTINGS_PANEL_DATA } from '@praxisui/settings-panel';
|
|
26
26
|
import { firstValueFrom, BehaviorSubject, Subscription } from 'rxjs';
|
|
27
27
|
import { take } from 'rxjs/operators';
|
|
@@ -510,7 +510,7 @@ class PraxisExpansion {
|
|
|
510
510
|
config;
|
|
511
511
|
expansionId;
|
|
512
512
|
componentInstanceId;
|
|
513
|
-
/** Input-owned compositions must not restore or persist materialized child inputs. */
|
|
513
|
+
/** Input-owned compositions must not restore or persist materialized child inputs; `'volatile'` disables all storage reads/writes. */
|
|
514
514
|
configPersistenceStrategy = input('storage-first', ...(ngDevMode ? [{ debugName: "configPersistenceStrategy" }] : /* istanbul ignore next */ []));
|
|
515
515
|
context = {};
|
|
516
516
|
strictValidation = true;
|
|
@@ -525,6 +525,7 @@ class PraxisExpansion {
|
|
|
525
525
|
widgetEvent = new EventEmitter();
|
|
526
526
|
settings = inject(SettingsPanelService);
|
|
527
527
|
storage = inject(ASYNC_CONFIG_STORAGE);
|
|
528
|
+
logger = inject(LoggerService, { optional: true });
|
|
528
529
|
cdr = inject(ChangeDetectorRef);
|
|
529
530
|
destroyRef = inject(DestroyRef);
|
|
530
531
|
dynamicForm = inject(DynamicFormService);
|
|
@@ -549,6 +550,7 @@ class PraxisExpansion {
|
|
|
549
550
|
warnedMissingId = false;
|
|
550
551
|
storageInitialized = false;
|
|
551
552
|
storageLoad;
|
|
553
|
+
hostInputBaselineConfig;
|
|
552
554
|
panelForms = new Map();
|
|
553
555
|
aiAdapter = new ExpansionAiAdapter(this);
|
|
554
556
|
aiAssistantOpen = false;
|
|
@@ -573,18 +575,22 @@ class PraxisExpansion {
|
|
|
573
575
|
single = () => (this.config?.panels && this.config.panels[0]) || null;
|
|
574
576
|
ngOnInit() {
|
|
575
577
|
this.storageInitialized = true;
|
|
578
|
+
if (this.config != null && this.hostInputBaselineConfig === undefined) {
|
|
579
|
+
this.hostInputBaselineConfig = JSON.parse(JSON.stringify(this.config));
|
|
580
|
+
}
|
|
576
581
|
this.loadStoredConfig();
|
|
577
582
|
}
|
|
578
583
|
loadStoredConfig() {
|
|
579
584
|
this.storageLoad?.unsubscribe();
|
|
580
|
-
|
|
585
|
+
this.storageLoad = undefined;
|
|
586
|
+
if (this.isVolatilePersistence() || this.usesInputFirstConfig())
|
|
581
587
|
return;
|
|
582
588
|
const key = this.storageKey();
|
|
583
589
|
if (!key)
|
|
584
590
|
return;
|
|
585
591
|
this.storageLoad = this.storage.loadConfig(key).pipe(take(1)).subscribe({
|
|
586
592
|
next: (stored) => {
|
|
587
|
-
if (!stored || this.usesInputFirstConfig() || key !== this.storageKey())
|
|
593
|
+
if (!stored || this.isVolatilePersistence() || this.usesInputFirstConfig() || key !== this.storageKey())
|
|
588
594
|
return;
|
|
589
595
|
this.config = stored;
|
|
590
596
|
this.buildPanelForms();
|
|
@@ -594,14 +600,22 @@ class PraxisExpansion {
|
|
|
594
600
|
});
|
|
595
601
|
}
|
|
596
602
|
ngOnChanges(changes) {
|
|
603
|
+
if ('config' in changes) {
|
|
604
|
+
const incoming = changes['config'].currentValue;
|
|
605
|
+
this.hostInputBaselineConfig =
|
|
606
|
+
incoming != null
|
|
607
|
+
? JSON.parse(JSON.stringify(incoming))
|
|
608
|
+
: null;
|
|
609
|
+
if (this.usesInputFirstConfig()) {
|
|
610
|
+
this.storageLoad?.unsubscribe();
|
|
611
|
+
this.storageLoad = undefined;
|
|
612
|
+
}
|
|
613
|
+
this.buildPanelForms();
|
|
614
|
+
}
|
|
597
615
|
if (this.storageInitialized && (changes['expansionId'] || changes['componentInstanceId']
|
|
598
616
|
|| changes['configPersistenceStrategy'])) {
|
|
599
617
|
this.loadStoredConfig();
|
|
600
618
|
}
|
|
601
|
-
if ('config' in changes) {
|
|
602
|
-
this.buildPanelForms();
|
|
603
|
-
this.persistConfig(this.config);
|
|
604
|
-
}
|
|
605
619
|
if ('context' in changes) {
|
|
606
620
|
this.cdr.markForCheck();
|
|
607
621
|
}
|
|
@@ -1195,38 +1209,124 @@ class PraxisExpansion {
|
|
|
1195
1209
|
};
|
|
1196
1210
|
}
|
|
1197
1211
|
openEditor() {
|
|
1198
|
-
const
|
|
1212
|
+
const storageKey = this.storageKey();
|
|
1213
|
+
const idSuffix = storageKey || this.expansionId || 'default';
|
|
1214
|
+
const hasInitialConfig = this.hostInputBaselineConfig != null;
|
|
1215
|
+
const initialConfig = hasInitialConfig
|
|
1216
|
+
? JSON.parse(JSON.stringify(this.hostInputBaselineConfig))
|
|
1217
|
+
: undefined;
|
|
1218
|
+
const canPersist = () => Boolean(storageKey) && !this.isVolatilePersistence() && !this.usesInputFirstConfig();
|
|
1219
|
+
let savedViaHandler = false;
|
|
1220
|
+
let resetViaHandler = false;
|
|
1221
|
+
let committed = false;
|
|
1222
|
+
let appliedPreview = false;
|
|
1199
1223
|
const ref = this.settings.open({
|
|
1200
|
-
id: `praxis-expansion-editor:${
|
|
1224
|
+
id: `praxis-expansion-editor:${idSuffix}`,
|
|
1225
|
+
owner: this.destroyRef,
|
|
1201
1226
|
title: 'Configurar Painéis',
|
|
1227
|
+
configStorageKey: canPersist() ? (storageKey ?? undefined) : undefined,
|
|
1228
|
+
onSave: canPersist() && storageKey
|
|
1229
|
+
? async (value) => {
|
|
1230
|
+
if (!canPersist() || this.storageKey() !== storageKey) {
|
|
1231
|
+
throw new Error('Expansion configuration persistence target is no longer active.');
|
|
1232
|
+
}
|
|
1233
|
+
const nextCfg = value?.config || value;
|
|
1234
|
+
if (!nextCfg)
|
|
1235
|
+
return;
|
|
1236
|
+
await firstValueFrom(this.storage.saveConfig(storageKey, nextCfg));
|
|
1237
|
+
savedViaHandler = true;
|
|
1238
|
+
}
|
|
1239
|
+
: undefined,
|
|
1240
|
+
onReset: canPersist() && storageKey
|
|
1241
|
+
? async () => {
|
|
1242
|
+
if (!canPersist() || this.storageKey() !== storageKey) {
|
|
1243
|
+
throw new Error('Expansion configuration persistence target is no longer active.');
|
|
1244
|
+
}
|
|
1245
|
+
await firstValueFrom(this.storage.clearConfig(storageKey));
|
|
1246
|
+
resetViaHandler = true;
|
|
1247
|
+
}
|
|
1248
|
+
: undefined,
|
|
1202
1249
|
content: { component: PraxisExpansionConfigEditor, inputs: { config: this.config, expansionId: this.expansionId } },
|
|
1203
1250
|
});
|
|
1204
|
-
const
|
|
1251
|
+
const restoreInitial = () => {
|
|
1252
|
+
this.config =
|
|
1253
|
+
hasInitialConfig && initialConfig
|
|
1254
|
+
? JSON.parse(JSON.stringify(initialConfig))
|
|
1255
|
+
: undefined;
|
|
1256
|
+
this.buildPanelForms();
|
|
1257
|
+
this.cdr.markForCheck();
|
|
1258
|
+
};
|
|
1259
|
+
const apply = (value, persist) => {
|
|
1205
1260
|
const nextCfg = value?.config || value;
|
|
1206
1261
|
if (nextCfg) {
|
|
1207
1262
|
this.config = { ...nextCfg };
|
|
1208
1263
|
this.buildPanelForms();
|
|
1209
|
-
|
|
1264
|
+
if (persist) {
|
|
1265
|
+
this.persistConfig(this.config);
|
|
1266
|
+
}
|
|
1210
1267
|
this.cdr.markForCheck();
|
|
1211
1268
|
}
|
|
1212
1269
|
};
|
|
1213
|
-
ref.applied$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(
|
|
1214
|
-
|
|
1270
|
+
ref.applied$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
1271
|
+
if (value) {
|
|
1272
|
+
appliedPreview = true;
|
|
1273
|
+
apply(value, false);
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
ref.saved$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
1277
|
+
const skipPersist = savedViaHandler;
|
|
1278
|
+
savedViaHandler = false;
|
|
1279
|
+
committed = true;
|
|
1280
|
+
appliedPreview = false;
|
|
1281
|
+
apply(value, !skipPersist);
|
|
1282
|
+
});
|
|
1283
|
+
ref.reset$?.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
1284
|
+
const skipClear = resetViaHandler;
|
|
1285
|
+
resetViaHandler = false;
|
|
1286
|
+
committed = true;
|
|
1287
|
+
appliedPreview = false;
|
|
1288
|
+
if (!skipClear && canPersist() && storageKey) {
|
|
1289
|
+
this.storage.clearConfig(storageKey).pipe(take(1)).subscribe({
|
|
1290
|
+
error: (error) => {
|
|
1291
|
+
this.logger?.warn?.('[PraxisExpansion] Failed to reset config', {
|
|
1292
|
+
data: { key: storageKey, error },
|
|
1293
|
+
});
|
|
1294
|
+
},
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
restoreInitial();
|
|
1298
|
+
});
|
|
1299
|
+
ref.closed$?.pipe(take(1), takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
1300
|
+
if (appliedPreview && !committed) {
|
|
1301
|
+
restoreInitial();
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1215
1304
|
}
|
|
1216
1305
|
storageKey() {
|
|
1217
1306
|
const id = this.componentKeyId();
|
|
1218
1307
|
return id ? `expansion:${id}` : null;
|
|
1219
1308
|
}
|
|
1220
1309
|
persistConfig(config) {
|
|
1221
|
-
if (!config || this.usesInputFirstConfig())
|
|
1310
|
+
if (!config || this.isVolatilePersistence() || this.usesInputFirstConfig())
|
|
1222
1311
|
return;
|
|
1223
1312
|
const key = this.storageKey();
|
|
1224
1313
|
if (!key)
|
|
1225
1314
|
return;
|
|
1226
|
-
this.storage.saveConfig(key, config).pipe(take(1)).subscribe({
|
|
1315
|
+
this.storage.saveConfig(key, config).pipe(take(1)).subscribe({
|
|
1316
|
+
error: (error) => {
|
|
1317
|
+
this.logger?.warn?.('[PraxisExpansion] Failed to persist config', {
|
|
1318
|
+
data: { key, error },
|
|
1319
|
+
});
|
|
1320
|
+
},
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
isVolatilePersistence() {
|
|
1324
|
+
return (normalizeConfigPersistenceStrategy(this.configPersistenceStrategy(), 'local-first') ===
|
|
1325
|
+
'volatile');
|
|
1227
1326
|
}
|
|
1228
1327
|
usesInputFirstConfig() {
|
|
1229
|
-
|
|
1328
|
+
const normalized = normalizeConfigPersistenceStrategy(this.configPersistenceStrategy(), 'local-first');
|
|
1329
|
+
return normalized === 'volatile' || (normalized === 'input-first' && this.hostInputBaselineConfig != null);
|
|
1230
1330
|
}
|
|
1231
1331
|
emitAction(p, index, action) {
|
|
1232
1332
|
this.widgetEvent.emit({
|
|
@@ -1274,7 +1374,7 @@ class PraxisExpansion {
|
|
|
1274
1374
|
if (this.warnedMissingId)
|
|
1275
1375
|
return;
|
|
1276
1376
|
this.warnedMissingId = true;
|
|
1277
|
-
|
|
1377
|
+
this.logger?.warn?.('[PraxisExpansion] expansionId is required for config persistence.');
|
|
1278
1378
|
}
|
|
1279
1379
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PraxisExpansion, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1280
1380
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: PraxisExpansion, isStandalone: true, selector: "praxis-expansion", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: false, isRequired: false, transformFunction: null }, expansionId: { classPropertyName: "expansionId", publicName: "expansionId", isSignal: false, isRequired: true, transformFunction: null }, componentInstanceId: { classPropertyName: "componentInstanceId", publicName: "componentInstanceId", isSignal: false, isRequired: false, transformFunction: null }, configPersistenceStrategy: { classPropertyName: "configPersistenceStrategy", publicName: "configPersistenceStrategy", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: false, isRequired: false, transformFunction: null }, strictValidation: { classPropertyName: "strictValidation", publicName: "strictValidation", isSignal: false, isRequired: false, transformFunction: null }, enableCustomization: { classPropertyName: "enableCustomization", publicName: "enableCustomization", isSignal: false, isRequired: false, transformFunction: null }, defaultOptions: { classPropertyName: "defaultOptions", publicName: "defaultOptions", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed", expandedChange: "expandedChange", afterExpand: "afterExpand", afterCollapse: "afterCollapse", destroyed: "destroyed", widgetEvent: "widgetEvent" }, viewQueries: [{ propertyName: "accordionRef", first: true, predicate: ["accordion"], descendants: true }, { propertyName: "panels", predicate: ["panel"], descendants: true, read: MatExpansionPanel }], usesOnChanges: true, ngImport: i0, template: `
|
|
@@ -2245,7 +2345,7 @@ class PraxisExpansionConfigEditor {
|
|
|
2245
2345
|
</div>
|
|
2246
2346
|
</section>
|
|
2247
2347
|
|
|
2248
|
-
@for (p of (config?.panels || []); track
|
|
2348
|
+
@for (p of (config?.panels || []); track $index; let i = $index) {
|
|
2249
2349
|
<section class="sec">
|
|
2250
2350
|
<div class="panel-row">
|
|
2251
2351
|
<strong>{{ p.title || ('Painel ' + (i + 1)) }}</strong>
|
|
@@ -2503,7 +2603,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
2503
2603
|
</div>
|
|
2504
2604
|
</section>
|
|
2505
2605
|
|
|
2506
|
-
@for (p of (config?.panels || []); track
|
|
2606
|
+
@for (p of (config?.panels || []); track $index; let i = $index) {
|
|
2507
2607
|
<section class="sec">
|
|
2508
2608
|
<div class="panel-row">
|
|
2509
2609
|
<strong>{{ p.title || ('Painel ' + (i + 1)) }}</strong>
|
|
@@ -2679,7 +2779,7 @@ const PRAXIS_EXPANSION_COMPONENT_METADATA = {
|
|
|
2679
2779
|
{ name: 'config', type: 'ExpansionMetadata', label: 'Configuração', description: 'Configuração JSON (acordeão, aparência e painéis)' },
|
|
2680
2780
|
{ name: 'expansionId', type: 'string', label: 'ID', description: 'Identificador para persistência (obrigatório)' },
|
|
2681
2781
|
{ name: 'componentInstanceId', type: 'string', label: 'ID da instância', description: 'Identificador opcional para múltiplas instâncias na mesma rota' },
|
|
2682
|
-
{ name: 'configPersistenceStrategy', type: '"storage-first" | "input-first"', default: 'storage-first', label: 'Estratégia de persistência', description: '
|
|
2782
|
+
{ name: 'configPersistenceStrategy', type: '"storage-first" | "local-first" | "input-first" | "volatile"', default: 'storage-first', label: 'Estratégia de persistência', description: 'Define a precedência entre storage e entrada (`local-first`/`storage-first` para persistência standalone, `input-first` com config fornecido para composição dona da instância, `volatile` para execução efêmera sem leitura ou gravação).' },
|
|
2683
2783
|
{ name: 'enableCustomization', type: 'boolean', default: false, label: 'Modo de customização' },
|
|
2684
2784
|
{ name: 'context', type: 'Record<string, any>', label: 'Contexto' },
|
|
2685
2785
|
{ name: 'strictValidation', type: 'boolean', default: true },
|
|
@@ -2748,6 +2848,10 @@ const PRAXIS_EXPANSION_COMPONENT_METADATA = {
|
|
|
2748
2848
|
scope: 'context',
|
|
2749
2849
|
},
|
|
2750
2850
|
],
|
|
2851
|
+
schemaVersion: '1.0.0',
|
|
2852
|
+
transientInputs: ['context'],
|
|
2853
|
+
lockedInputs: ['expansionId'],
|
|
2854
|
+
visualOverrideKeys: ['config', 'enableCustomization', 'configPersistenceStrategy'],
|
|
2751
2855
|
tags: ['widget', 'expansion', 'accordion', 'configurable'],
|
|
2752
2856
|
lib: '@praxisui/expansion',
|
|
2753
2857
|
ports: PRAXIS_EXPANSION_PORTS,
|
|
@@ -2838,7 +2942,7 @@ const PRAXIS_EXPANSION_AUTHORING_MANIFEST = {
|
|
|
2838
2942
|
{ name: 'config', type: 'ExpansionMetadata', description: 'Canonical accordion and panel configuration.' },
|
|
2839
2943
|
{ name: 'expansionId', type: 'string', description: 'Stable id used to derive expansion config persistence scope.' },
|
|
2840
2944
|
{ name: 'componentInstanceId', type: 'string', description: 'Optional instance discriminator for persistence scope.' },
|
|
2841
|
-
{ name: 'configPersistenceStrategy', type: '"
|
|
2945
|
+
{ name: 'configPersistenceStrategy', type: '"local-first" | "input-first" | "volatile" | "storage-first"', description: 'Host-owned lifecycle policy (`local-first`, legacy `storage-first`, composition-owned `input-first`, or ephemeral `volatile`). Input-first with supplied config skips component storage; authoring returns the widget input document to its composition owner.' },
|
|
2842
2946
|
{ name: 'context', type: 'Record<string, any>', description: 'Context passed to nested widgets.' },
|
|
2843
2947
|
{ name: 'strictValidation', type: 'boolean', description: 'Controls nested widget validation strictness.' },
|
|
2844
2948
|
{ name: 'defaultOptions', type: 'MatExpansionPanelDefaultOptions', description: 'Instance-level Material expansion defaults.' },
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisui/expansion",
|
|
3
|
-
"version": "10.0.0-rc.
|
|
3
|
+
"version": "10.0.0-rc.61",
|
|
4
4
|
"description": "Expansion panel (accordion) components for Praxis UI with metadata configuration and editor integration.",
|
|
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.61",
|
|
11
|
+
"@praxisui/dynamic-fields": "^10.0.0-rc.61",
|
|
12
|
+
"@praxisui/settings-panel": "^10.0.0-rc.61",
|
|
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.61",
|
|
16
16
|
"rxjs": "~7.8.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
@@ -119,12 +119,13 @@ interface PanelMetadata {
|
|
|
119
119
|
*/
|
|
120
120
|
quickViewActionLabel?: string;
|
|
121
121
|
}
|
|
122
|
+
type ExpansionConfigPersistenceStrategy = 'storage-first' | 'local-first' | 'input-first' | 'volatile';
|
|
122
123
|
declare class PraxisExpansion implements OnChanges, OnDestroy, OnInit {
|
|
123
124
|
config?: ExpansionMetadata | null;
|
|
124
125
|
expansionId: string;
|
|
125
126
|
componentInstanceId?: string;
|
|
126
|
-
/** Input-owned compositions must not restore or persist materialized child inputs. */
|
|
127
|
-
readonly configPersistenceStrategy: i0.InputSignal<
|
|
127
|
+
/** Input-owned compositions must not restore or persist materialized child inputs; `'volatile'` disables all storage reads/writes. */
|
|
128
|
+
readonly configPersistenceStrategy: i0.InputSignal<ExpansionConfigPersistenceStrategy>;
|
|
128
129
|
context: Record<string, any>;
|
|
129
130
|
strictValidation: boolean;
|
|
130
131
|
enableCustomization: boolean;
|
|
@@ -157,6 +158,7 @@ declare class PraxisExpansion implements OnChanges, OnDestroy, OnInit {
|
|
|
157
158
|
widgetEvent: EventEmitter<WidgetEventEnvelope>;
|
|
158
159
|
private readonly settings;
|
|
159
160
|
private readonly storage;
|
|
161
|
+
private readonly logger;
|
|
160
162
|
private readonly cdr;
|
|
161
163
|
private readonly destroyRef;
|
|
162
164
|
private readonly dynamicForm;
|
|
@@ -169,6 +171,7 @@ declare class PraxisExpansion implements OnChanges, OnDestroy, OnInit {
|
|
|
169
171
|
private warnedMissingId;
|
|
170
172
|
private storageInitialized;
|
|
171
173
|
private storageLoad?;
|
|
174
|
+
private hostInputBaselineConfig?;
|
|
172
175
|
private readonly panelForms;
|
|
173
176
|
aiAdapter: ExpansionAiAdapter;
|
|
174
177
|
aiAssistantOpen: boolean;
|
|
@@ -240,6 +243,7 @@ declare class PraxisExpansion implements OnChanges, OnDestroy, OnInit {
|
|
|
240
243
|
openEditor(): void;
|
|
241
244
|
private storageKey;
|
|
242
245
|
private persistConfig;
|
|
246
|
+
private isVolatilePersistence;
|
|
243
247
|
private usesInputFirstConfig;
|
|
244
248
|
emitAction(p: PanelMetadata, index: number, action?: string | undefined): void;
|
|
245
249
|
private panelKey;
|
|
@@ -339,4 +343,4 @@ declare const EXPANSION_AI_CAPABILITIES: CapabilityCatalog;
|
|
|
339
343
|
declare const PRAXIS_EXPANSION_AUTHORING_MANIFEST: ComponentAuthoringManifest;
|
|
340
344
|
|
|
341
345
|
export { EXPANSION_AI_CAPABILITIES, PRAXIS_EXPANSION_AUTHORING_MANIFEST, PRAXIS_EXPANSION_COMPONENT_METADATA, PraxisExpansion, PraxisExpansionConfigEditor, PraxisExpansionWidgetConfigEditor, providePraxisExpansionDefaults, providePraxisExpansionMetadata };
|
|
342
|
-
export type { Capability, CapabilityCatalog, CapabilityCategory, ExpansionAppearanceContainer, ExpansionAppearanceHeader, ExpansionAppearanceStates, ExpansionMetadata, PanelMetadata, PraxisExpansionWidgetEditorInputs, PraxisExpansionWidgetEditorValue, ValueKind };
|
|
346
|
+
export type { Capability, CapabilityCatalog, CapabilityCategory, ExpansionAppearanceContainer, ExpansionAppearanceHeader, ExpansionAppearanceStates, ExpansionConfigPersistenceStrategy, ExpansionMetadata, PanelMetadata, PraxisExpansionWidgetEditorInputs, PraxisExpansionWidgetEditorValue, ValueKind };
|