@praxisui/core 10.0.0-rc.34 → 10.0.0-rc.36
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 +6 -0
- package/ai/component-registry.json +5 -5
- package/fesm2022/praxisui-core-schema.mjs +240 -14
- package/fesm2022/praxisui-core.mjs +1105 -166
- package/package.json +1 -1
- package/types/praxisui-core-schema.d.ts +11 -3
- package/types/praxisui-core.d.ts +145 -13
package/README.md
CHANGED
|
@@ -844,6 +844,12 @@ contracts are unchanged.
|
|
|
844
844
|
|
|
845
845
|
`DomainKnowledgeService` and `DomainRuleService` are shared clients for governed semantic decision flows exposed by `praxis-config-starter`. `browseDefinitionCatalog` exposes the bounded, redacted and server-scoped decision catalog; consumers then use `getDefinition` with the exact returned definition id instead of downloading every rule body or joining versions by key. `getDefinitionFacts` projects the same definition's versioned fact vocabulary, including type, localized meaning, provider evidence, sensitivity and redaction policy; Angular must not reconstruct that vocabulary from JSON Logic or host-specific fixtures. `getDefinitionCapabilities` returns the authenticated principal's server-scoped `CREATE_NEW_VERSION` action per definition; consumers must not treat projection metadata such as editor support as authorization. For change workspaces, `getChangeWorkspaceCapabilities` returns the authenticated principal's `availableActions` and stable blockers; consumers must not infer submit, review or promotion authority from lifecycle status. `DomainRuleService` also exposes the safe RuleSet version catalog, active head/status, redacted execution summary, aggregate host alignment, forward activation and rollback protected by the current head ETag. The same client projects immutable rollout-policy versions, their independent anti-ABA head, maker-checker approval, activation and append-only timeline; policy authority and lifecycle validation remain server-owned. It also exposes the two-phase operational rollout through a recoverable human catalog, redacted readiness, create/cancel commands and candidate activation bound to the rollout identity. Consumers must obey the Config-owned `availableActions`; they must not recalculate quorum or head validity. Execution summaries contain only aggregate outcome counts, distinct-host count and observation timestamps for an immutable snapshot. Host-status summaries contain only aligned, snapshot-drifted, runtime-incompatible, unavailable and stale counts derived against the active head and its approved compatibility coordinates; facts and host identities remain outside Angular. Runtime surfaces should treat materializations as derived projections of backend-governed decisions, not as frontend-owned business rules.
|
|
846
846
|
|
|
847
|
+
`getDefinitionParameters` reads the same immutable definition's Engine-owned parameter template and typed constraints, together with declared/default/effective values. An absent `defaultValue` or `declaredValue` property differs from explicit JSON null; `origin` identifies the declared/default source. Consumers edit only workspace `parameters.parameterValues`, preserve other parameter metadata, and let Config derive the structural condition. Template identity, read-only flags, constraints, workspace ETags and publication through the governed snapshot lifecycle remain server-owned.
|
|
848
|
+
|
|
849
|
+
An intact historical snapshot with a different runtime compatibility is `RUNTIME_INCOMPATIBLE`, remains available for authorized audit, and is not executable (`executionReady=false`). All non-`READY` versions expose `availableAction=UNAVAILABLE`, including an incompatible version still referenced by the active head. Consumers must preserve that historical identity without offering activation, rollback or rollout; `READY` still requires the current compiler and implementation catalog. Historical readability never authorizes execution.
|
|
850
|
+
|
|
851
|
+
Snapshot publication returns `DomainRuleSnapshotStored` (immutable content/hash), without selecting or refreshing an active head. Before a first activation, a server-published `CREATE_ROLLOUT` version action may authorize starting the staged flow together with the rollout catalog action. `createRollout` and `activateSnapshotCandidate` accept an explicit null head token for verified absence and send only `If-None-Match: *`; existing tokens send only `If-Match`. Candidate activation retains the actual rollout ID. The nullable expected snapshot/head pair records bootstrap absence; clients must never replace it with a content hash, fabricated head or local readiness calculation.
|
|
852
|
+
|
|
847
853
|
## Public API Areas
|
|
848
854
|
|
|
849
855
|
Core exports:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-21T13:45:30.091Z",
|
|
4
4
|
"packageName": "@praxisui/core",
|
|
5
|
-
"packageVersion": "10.0.0-rc.
|
|
5
|
+
"packageVersion": "10.0.0-rc.36",
|
|
6
6
|
"sourceRegistry": "praxis-component-registry-ingestion",
|
|
7
7
|
"sourceRegistryVersion": "1.0.0",
|
|
8
8
|
"componentCount": 4,
|
|
@@ -2063,7 +2063,7 @@
|
|
|
2063
2063
|
"Nested component ports usam endpoint component-port com nestedPath; o owner em ref.widget continua sendo o widget top-level.",
|
|
2064
2064
|
"Objetivo: compor widgets e relacionamentos canonicos (ex.: master-detail).",
|
|
2065
2065
|
"Link tipico de master-detail: component-port(table.rowClick) -> component-port(form.resourceId) com transform map payload.row.id.",
|
|
2066
|
-
"Templates {{state.<path> | pipe}} e ${state.<path> | pipe} em inputs de widgets suportam pipes declarativos CSP-safe (default/coalesce, round[:N], number[:N], percent[:N], currency[:BRL|USD|EUR|GBP], uppercase, lowercase) via applyDeclarativeValuePipe, tratando tokens não resolvidos e NaN como ausentes no fallback."
|
|
2066
|
+
"Templates {{state.<path> | pipe}} e ${state.<path> | pipe} em inputs de widgets suportam pipes declarativos CSP-safe (default/coalesce, round[:N], number[:N], numberCompact, percent[:N], currency[:BRL|USD|EUR|GBP], currencyCompact[:BRL|USD|EUR|GBP], date[:locale], dateTime[:locale], time[:locale], uppercase, lowercase) via applyDeclarativeValuePipe, tratando tokens não resolvidos e NaN como ausentes no fallback."
|
|
2067
2067
|
],
|
|
2068
2068
|
"componentContext": {
|
|
2069
2069
|
"version": "v1.0",
|
|
@@ -3154,9 +3154,9 @@
|
|
|
3154
3154
|
{
|
|
3155
3155
|
"chunkIndex": 6,
|
|
3156
3156
|
"chunkKind": "capabilities",
|
|
3157
|
-
"content": "Component Capability:\n - Path: page.deviceLayouts.mobile\n Category: layout\n Kind: object\n Description: Overrides de layout para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.layout\n Category: layout\n Kind: object\n Description: Override de WidgetPageLayout para desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.canvas\n Category: layout\n Kind: object\n Description: Override de canvas para desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.groupingOverrides\n Category: layout\n Kind: array\n Description: Overrides de agrupamentos para desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.widgetOverrides\n Category: layout\n Kind: object\n Description: Overrides por widget key para desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.widgetOverrides.<widgetKey>.hidden\n Category: layout\n Kind: boolean\n Description: Oculta o widget em desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.layout\n Category: layout\n Kind: object\n Description: Override de WidgetPageLayout para tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.canvas\n Category: layout\n Kind: object\n Description: Override de canvas para tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.groupingOverrides\n Category: layout\n Kind: array\n Description: Overrides de agrupamentos para tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.widgetOverrides\n Category: layout\n Kind: object\n Description: Overrides por widget key para tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.widgetOverrides.<widgetKey>.hidden\n Category: layout\n Kind: boolean\n Description: Oculta o widget em tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.layout\n Category: layout\n Kind: object\n Description: Override de WidgetPageLayout para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.canvas\n Category: layout\n Kind: object\n Description: Override de canvas para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.groupingOverrides\n Category: layout\n Kind: array\n Description: Overrides de agrupamentos para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.widgetOverrides\n Category: layout\n Kind: object\n Description: Overrides por widget key para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.widgetOverrides.<widgetKey>.hidden\n Category: layout\n Kind: boolean\n Description: Oculta o widget em mobile.\n\nCapability Note:\n - page segue o modelo canonico WidgetPageDefinition (widgets, composition.links, context e state opcional); composition.links pode despachar actions globais via to.kind = global-action e receber continuations exatas via from.kind = global-action.\n\nCapability Note:\n - Conteudo editorial rico deve ser modelado como widget praxis-rich-content com definition.inputs.document: RichContentDocument, nao como DSL local do page-builder.\n\nCapability Note:\n - Quando definition.id = praxis-rich-content em uma pagina dinamica, definition.inputs.document continua sendo o contrato persistido; hostCapabilities e mediado em runtime pelo host praxis-dynamic-page e nao deve ser serializado no JSON da pagina.\n\nCapability Note:\n - Edicao visual de inputs de widget deve usar ComponentDocMeta.configEditor ou ComponentDocMeta.authoringManifestRef publicado pela lib dona do componente; nao criar editor local no page-builder para semantica de outro pacote.\n\nCapability Note:\n - Canvas e o modelo espacial canonico da pagina quando houver posicionamento explicito.\n\nCapability Note:\n - Taxonomia editorial: condition usa Json Logic canonico; transform usa pipeline declarativo; policy cobre apenas comportamento operacional.\n\nCapability Note:\n - Para criacao agentic de paginas, o preview pode trazer uiCompositionPlan como plano intermediario validavel; o page-builder compila esse plano para WidgetPageDefinition antes de aplicar.\n\nCapability Note:\n - UiCompositionPlan usa widgets[].componentId e bindings declarativos. UiCompositionPlanTemplateReference pode piná-lo por registryKey + configSha256, mas precisa ser resolvido pelo backend governado antes da compilação. O JSON persistido continua sendo page.widgets[].definition.id e page.composition.links.\n\nCapability Note:\n - Nested component ports usam endpoint component-port com nestedPath. O owner em ref.widget ou bindings[].*.widget continua sendo o widget top-level; a porta real do filho fica em port/direction e o caminho ate o filho fica em nestedPath.\n\nCapability Note:\n - Nao gere links nested via owner.widgetEvent, bindingPath profundo, page.connections ou wrappers host-specific. widgetEvent e bridge legada/avancada, nao contrato principal de authoring.\n\nCapability Note:\n - Payloads legados de layout ainda podem ser ingeridos, mas sao normalizados para canvas e nao devem ser reemitidos.\n\nCapability Note:\n - pageIdentity identifica o escopo de persistencia e nao pertence ao objeto page.\n\nCapability Note:\n - authoringCapabilities é um grant transitório do host para limitar affordances visíveis; não integra WidgetPageDefinition, não é persistido e não concede autoridade de edição à IA.\n\nCapability Note:\n - Tokens de interpolacao de estado/contexto em inputs de widgets ({{state.<path> | pipe}} ou ${state.<path> | pipe}) suportam pipes declarativos CSP-safe encadeaveis: default:<fallback>, number, round[:decimals], percent[:decimals], currency[:code], uppercase e lowercase.\n\nCapability Note:\n - Este catálogo é específico para o runtime praxis-dynamic-page; operações de authoring/mutação pertencem ao manifesto do praxis-page-builder.\n\nCapability Note:\n - WidgetPageDefinition e o contrato canonico persistido: widgets, composition.links, state, context, i18n, layout, canvas, presets, grouping, slotAssignments, deviceLayouts e themePreset.\n\nCapability Note:\n - Widgets e page.composition.links sao arrays; ferramentas de patch legadas fazem merge por key estavel e id estavel.\n\nCapability Note:\n - page.canvas.items é um mapa por widget key; não modele canvas.items como array.\n\nCapability Note:\n - Taxonomia editorial: condition usa Json Logic canônico; transform usa pipeline declarativo; não trate ambos como a mesma \"expression\".\n\nCapability Note:\n - Para remocao/replace, use flags {_remove:true} ou {_replace:true} no item.\n\nCapability Note:\n - Para renomear um link, inclua {_beforeKey:\"link-id-anterior\"} no item.\n\nCapability Note:\n - Inputs de widgets dependem do componente (ex: praxis-table, praxis-dynamic-form). Evite inventar campos; prefira pedir confirmação.\n\nCapability Note:\n - Quando page.widgets[].definition.id for praxis-rich-content, o host praxis-dynamic-page injeta hostCapabilities em runtime para actions e capability gating; não serialize funções nem tente persistir page.widgets[].definition.inputs.hostCapabilities.\n\nCapability Note:\n - Use ids estaveis para links e keys estaveis para widgets.\n\nCapability Note:\n - Nested component ports usam endpoint component-port com nestedPath; o owner em ref.widget continua sendo o widget top-level.\n\nCapability Note:\n - Objetivo: compor widgets e relacionamentos canonicos (ex.: master-detail).\n\nCapability Note:\n - Link tipico de master-detail: component-port(table.rowClick) -> component-port(form.resourceId) com transform map payload.row.id.\n\nCapability Note:\n - Templates {{state.<path> | pipe}} e ${state.<path> | pipe} em inputs de widgets suportam pipes declarativos CSP-safe (default/coalesce, round[:N], number[:N], percent[:N], currency[:BRL|USD|EUR|GBP], uppercase, lowercase) via applyDeclarativeValuePipe, tratando tokens não resolvidos e NaN como ausentes no fallback.",
|
|
3157
|
+
"content": "Component Capability:\n - Path: page.deviceLayouts.mobile\n Category: layout\n Kind: object\n Description: Overrides de layout para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.layout\n Category: layout\n Kind: object\n Description: Override de WidgetPageLayout para desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.canvas\n Category: layout\n Kind: object\n Description: Override de canvas para desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.groupingOverrides\n Category: layout\n Kind: array\n Description: Overrides de agrupamentos para desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.widgetOverrides\n Category: layout\n Kind: object\n Description: Overrides por widget key para desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.desktop.widgetOverrides.<widgetKey>.hidden\n Category: layout\n Kind: boolean\n Description: Oculta o widget em desktop.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.layout\n Category: layout\n Kind: object\n Description: Override de WidgetPageLayout para tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.canvas\n Category: layout\n Kind: object\n Description: Override de canvas para tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.groupingOverrides\n Category: layout\n Kind: array\n Description: Overrides de agrupamentos para tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.widgetOverrides\n Category: layout\n Kind: object\n Description: Overrides por widget key para tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.tablet.widgetOverrides.<widgetKey>.hidden\n Category: layout\n Kind: boolean\n Description: Oculta o widget em tablet.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.layout\n Category: layout\n Kind: object\n Description: Override de WidgetPageLayout para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.canvas\n Category: layout\n Kind: object\n Description: Override de canvas para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.groupingOverrides\n Category: layout\n Kind: array\n Description: Overrides de agrupamentos para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.widgetOverrides\n Category: layout\n Kind: object\n Description: Overrides por widget key para mobile.\n\nComponent Capability:\n - Path: page.deviceLayouts.mobile.widgetOverrides.<widgetKey>.hidden\n Category: layout\n Kind: boolean\n Description: Oculta o widget em mobile.\n\nCapability Note:\n - page segue o modelo canonico WidgetPageDefinition (widgets, composition.links, context e state opcional); composition.links pode despachar actions globais via to.kind = global-action e receber continuations exatas via from.kind = global-action.\n\nCapability Note:\n - Conteudo editorial rico deve ser modelado como widget praxis-rich-content com definition.inputs.document: RichContentDocument, nao como DSL local do page-builder.\n\nCapability Note:\n - Quando definition.id = praxis-rich-content em uma pagina dinamica, definition.inputs.document continua sendo o contrato persistido; hostCapabilities e mediado em runtime pelo host praxis-dynamic-page e nao deve ser serializado no JSON da pagina.\n\nCapability Note:\n - Edicao visual de inputs de widget deve usar ComponentDocMeta.configEditor ou ComponentDocMeta.authoringManifestRef publicado pela lib dona do componente; nao criar editor local no page-builder para semantica de outro pacote.\n\nCapability Note:\n - Canvas e o modelo espacial canonico da pagina quando houver posicionamento explicito.\n\nCapability Note:\n - Taxonomia editorial: condition usa Json Logic canonico; transform usa pipeline declarativo; policy cobre apenas comportamento operacional.\n\nCapability Note:\n - Para criacao agentic de paginas, o preview pode trazer uiCompositionPlan como plano intermediario validavel; o page-builder compila esse plano para WidgetPageDefinition antes de aplicar.\n\nCapability Note:\n - UiCompositionPlan usa widgets[].componentId e bindings declarativos. UiCompositionPlanTemplateReference pode piná-lo por registryKey + configSha256, mas precisa ser resolvido pelo backend governado antes da compilação. O JSON persistido continua sendo page.widgets[].definition.id e page.composition.links.\n\nCapability Note:\n - Nested component ports usam endpoint component-port com nestedPath. O owner em ref.widget ou bindings[].*.widget continua sendo o widget top-level; a porta real do filho fica em port/direction e o caminho ate o filho fica em nestedPath.\n\nCapability Note:\n - Nao gere links nested via owner.widgetEvent, bindingPath profundo, page.connections ou wrappers host-specific. widgetEvent e bridge legada/avancada, nao contrato principal de authoring.\n\nCapability Note:\n - Payloads legados de layout ainda podem ser ingeridos, mas sao normalizados para canvas e nao devem ser reemitidos.\n\nCapability Note:\n - pageIdentity identifica o escopo de persistencia e nao pertence ao objeto page.\n\nCapability Note:\n - authoringCapabilities é um grant transitório do host para limitar affordances visíveis; não integra WidgetPageDefinition, não é persistido e não concede autoridade de edição à IA.\n\nCapability Note:\n - Tokens de interpolacao de estado/contexto em inputs de widgets ({{state.<path> | pipe}} ou ${state.<path> | pipe}) suportam pipes declarativos CSP-safe encadeaveis: default:<fallback>, number, round[:decimals], percent[:decimals], currency[:code], uppercase e lowercase.\n\nCapability Note:\n - Este catálogo é específico para o runtime praxis-dynamic-page; operações de authoring/mutação pertencem ao manifesto do praxis-page-builder.\n\nCapability Note:\n - WidgetPageDefinition e o contrato canonico persistido: widgets, composition.links, state, context, i18n, layout, canvas, presets, grouping, slotAssignments, deviceLayouts e themePreset.\n\nCapability Note:\n - Widgets e page.composition.links sao arrays; ferramentas de patch legadas fazem merge por key estavel e id estavel.\n\nCapability Note:\n - page.canvas.items é um mapa por widget key; não modele canvas.items como array.\n\nCapability Note:\n - Taxonomia editorial: condition usa Json Logic canônico; transform usa pipeline declarativo; não trate ambos como a mesma \"expression\".\n\nCapability Note:\n - Para remocao/replace, use flags {_remove:true} ou {_replace:true} no item.\n\nCapability Note:\n - Para renomear um link, inclua {_beforeKey:\"link-id-anterior\"} no item.\n\nCapability Note:\n - Inputs de widgets dependem do componente (ex: praxis-table, praxis-dynamic-form). Evite inventar campos; prefira pedir confirmação.\n\nCapability Note:\n - Quando page.widgets[].definition.id for praxis-rich-content, o host praxis-dynamic-page injeta hostCapabilities em runtime para actions e capability gating; não serialize funções nem tente persistir page.widgets[].definition.inputs.hostCapabilities.\n\nCapability Note:\n - Use ids estaveis para links e keys estaveis para widgets.\n\nCapability Note:\n - Nested component ports usam endpoint component-port com nestedPath; o owner em ref.widget continua sendo o widget top-level.\n\nCapability Note:\n - Objetivo: compor widgets e relacionamentos canonicos (ex.: master-detail).\n\nCapability Note:\n - Link tipico de master-detail: component-port(table.rowClick) -> component-port(form.resourceId) com transform map payload.row.id.\n\nCapability Note:\n - Templates {{state.<path> | pipe}} e ${state.<path> | pipe} em inputs de widgets suportam pipes declarativos CSP-safe (default/coalesce, round[:N], number[:N], numberCompact, percent[:N], currency[:BRL|USD|EUR|GBP], currencyCompact[:BRL|USD|EUR|GBP], date[:locale], dateTime[:locale], time[:locale], uppercase, lowercase) via applyDeclarativeValuePipe, tratando tokens não resolvidos e NaN como ausentes no fallback.",
|
|
3158
3158
|
"sourcePointer": "projects/praxis-core/src/lib/ai/dynamic-page-ai-capabilities.ts",
|
|
3159
|
-
"contentHash": "
|
|
3159
|
+
"contentHash": "4d18b28a892b3ae253fd4463d0b2cc8251cba7c2c6c4f77cf332982a7639abca",
|
|
3160
3160
|
"sourceKind": "component_definition",
|
|
3161
3161
|
"sourceId": "praxis-dynamic-page",
|
|
3162
3162
|
"corpusVersion": "1.0.0"
|
|
@@ -2309,7 +2309,14 @@ class SchemaNormalizationKernel {
|
|
|
2309
2309
|
if (!this.isNumericSchemaType(typeToken)) {
|
|
2310
2310
|
return undefined;
|
|
2311
2311
|
}
|
|
2312
|
-
|
|
2312
|
+
const explicitFormat = this.resolveNonEmptyStringToken(ui?.format, prop?.format);
|
|
2313
|
+
if (explicitFormat) {
|
|
2314
|
+
return explicitFormat;
|
|
2315
|
+
}
|
|
2316
|
+
if (String(prop?.type ?? '').trim().toLowerCase() === 'integer') {
|
|
2317
|
+
return 'integer';
|
|
2318
|
+
}
|
|
2319
|
+
return undefined;
|
|
2313
2320
|
}
|
|
2314
2321
|
/**
|
|
2315
2322
|
* Converte o schema bruto do backend (OpenAPI + x-ui) em FieldDefinition[] tipado.
|
|
@@ -2561,6 +2568,9 @@ class SchemaNormalizationKernel {
|
|
|
2561
2568
|
if (ui.options !== undefined) {
|
|
2562
2569
|
field.options = this.parseOptions(ui.options);
|
|
2563
2570
|
}
|
|
2571
|
+
if (Array.isArray(prop?.enum) && prop.enum.length > 0 && field.enumValues === undefined) {
|
|
2572
|
+
field.enumValues = [...prop.enum];
|
|
2573
|
+
}
|
|
2564
2574
|
if (ui.optionGroups !== undefined) {
|
|
2565
2575
|
field.optionGroups = this.parseOptions(ui.optionGroups);
|
|
2566
2576
|
}
|
|
@@ -2778,9 +2788,24 @@ class SchemaNormalizationKernel {
|
|
|
2778
2788
|
'showTicks',
|
|
2779
2789
|
'trueLabel',
|
|
2780
2790
|
'falseLabel',
|
|
2791
|
+
'labelTrue',
|
|
2792
|
+
'labelFalse',
|
|
2793
|
+
'iconTrue',
|
|
2794
|
+
'iconFalse',
|
|
2795
|
+
'tone',
|
|
2796
|
+
'toneTrue',
|
|
2797
|
+
'toneFalse',
|
|
2798
|
+
'booleanFormat',
|
|
2799
|
+
'displayFormat',
|
|
2800
|
+
'currency',
|
|
2781
2801
|
'currencyCode',
|
|
2782
2802
|
'locale',
|
|
2783
2803
|
'precision',
|
|
2804
|
+
'decimalPlaces',
|
|
2805
|
+
'initialsField',
|
|
2806
|
+
'optionLabelKey',
|
|
2807
|
+
'optionValueKey',
|
|
2808
|
+
'extraProperties',
|
|
2784
2809
|
'rangeMode',
|
|
2785
2810
|
'maxRating',
|
|
2786
2811
|
'allowHalf',
|
|
@@ -2993,8 +3018,11 @@ function clone(v) {
|
|
|
2993
3018
|
|
|
2994
3019
|
function buildBaseColumnFromDef(def) {
|
|
2995
3020
|
const type = resolveColumnTypeFromFieldDefinition(def);
|
|
2996
|
-
const format =
|
|
2997
|
-
const
|
|
3021
|
+
const format = resolveFormatFromFieldDefinition(def, type);
|
|
3022
|
+
const valueMapping = resolveSchemaValueMappingFromFieldDefinition(def);
|
|
3023
|
+
const renderer = resolveRendererFromFieldDefinition(def);
|
|
3024
|
+
const isAvatar = renderer?.type === 'avatar';
|
|
3025
|
+
const explicitWidth = firstNonEmptyString(def.width);
|
|
2998
3026
|
return {
|
|
2999
3027
|
field: def.name,
|
|
3000
3028
|
header: def.label || def.name,
|
|
@@ -3004,7 +3032,10 @@ function buildBaseColumnFromDef(def) {
|
|
|
3004
3032
|
filterable: def.filterable === true,
|
|
3005
3033
|
resizable: true,
|
|
3006
3034
|
order: typeof def.order === 'number' ? def.order : undefined,
|
|
3035
|
+
...(explicitWidth ? { width: explicitWidth } : isAvatar ? { width: '56px' } : {}),
|
|
3036
|
+
...(isAvatar ? { align: 'center' } : {}),
|
|
3007
3037
|
...(format ? { format } : {}),
|
|
3038
|
+
...(valueMapping ? { valueMapping } : {}),
|
|
3008
3039
|
...(renderer ? { renderer } : {}),
|
|
3009
3040
|
};
|
|
3010
3041
|
}
|
|
@@ -3157,21 +3188,175 @@ function resolveTextMaskFormat(value) {
|
|
|
3157
3188
|
const hasInvalidMaskLetters = /[A-WYZa-wyz]/.test(format);
|
|
3158
3189
|
return hasMaskTokens && !hasInvalidMaskLetters ? format : undefined;
|
|
3159
3190
|
}
|
|
3191
|
+
function resolveFormatFromFieldDefinition(def, type) {
|
|
3192
|
+
if (type === 'string') {
|
|
3193
|
+
return resolveTextMaskFormatFromFieldDefinition(def);
|
|
3194
|
+
}
|
|
3195
|
+
if (type === 'currency') {
|
|
3196
|
+
return resolveSchemaCurrencyFormatFromFieldDefinition(def);
|
|
3197
|
+
}
|
|
3198
|
+
if (type === 'date') {
|
|
3199
|
+
return (firstNonEmptyString(def.displayFormat) ??
|
|
3200
|
+
firstNonEmptyString(def.extraProperties?.displayFormat));
|
|
3201
|
+
}
|
|
3202
|
+
if (type === 'boolean') {
|
|
3203
|
+
return resolveSchemaBooleanFormatFromFieldDefinition(def);
|
|
3204
|
+
}
|
|
3205
|
+
if (type === 'number') {
|
|
3206
|
+
const schemaDataType = normalizePresentationToken(def.type);
|
|
3207
|
+
const schemaFormat = normalizePresentationToken(def.format);
|
|
3208
|
+
const numericFormat = normalizePresentationToken(def.numericFormat ?? def.extraProperties?.numericFormat);
|
|
3209
|
+
if (schemaDataType === 'integer' ||
|
|
3210
|
+
schemaFormat === 'integer' ||
|
|
3211
|
+
schemaFormat === 'int32' ||
|
|
3212
|
+
schemaFormat === 'int64' ||
|
|
3213
|
+
numericFormat === 'integer' ||
|
|
3214
|
+
numericFormat === 'int32' ||
|
|
3215
|
+
numericFormat === 'int64') {
|
|
3216
|
+
return '1.0-0';
|
|
3217
|
+
}
|
|
3218
|
+
const explicitDecimals = firstFiniteNumber(def.decimalPlaces) ??
|
|
3219
|
+
firstFiniteNumber(def.extraProperties?.decimalPlaces);
|
|
3220
|
+
if (explicitDecimals !== undefined && explicitDecimals >= 0) {
|
|
3221
|
+
const decimals = Math.trunc(explicitDecimals);
|
|
3222
|
+
return `1.${decimals}-${decimals}`;
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
return undefined;
|
|
3226
|
+
}
|
|
3227
|
+
function resolveSchemaCurrencyFormatFromFieldDefinition(def) {
|
|
3228
|
+
const currency = firstNonEmptyString(def.currency) ??
|
|
3229
|
+
firstNonEmptyString(def.extraProperties?.currency) ??
|
|
3230
|
+
'BRL';
|
|
3231
|
+
const decimalPlaces = firstFiniteNumber(def.decimalPlaces) ??
|
|
3232
|
+
firstFiniteNumber(def.extraProperties?.decimalPlaces) ??
|
|
3233
|
+
2;
|
|
3234
|
+
return `${currency}|symbol|${decimalPlaces}`;
|
|
3235
|
+
}
|
|
3236
|
+
function resolveSchemaBooleanFormatFromFieldDefinition(def) {
|
|
3237
|
+
const explicit = firstNonEmptyString(def.booleanFormat) ??
|
|
3238
|
+
firstNonEmptyString(def.extraProperties?.booleanFormat);
|
|
3239
|
+
if (explicit)
|
|
3240
|
+
return explicit;
|
|
3241
|
+
const trueLabel = firstNonEmptyString(def.trueLabel) ??
|
|
3242
|
+
firstNonEmptyString(def.labelTrue) ??
|
|
3243
|
+
firstNonEmptyString(def.extraProperties?.trueLabel) ??
|
|
3244
|
+
firstNonEmptyString(def.extraProperties?.labelTrue);
|
|
3245
|
+
const falseLabel = firstNonEmptyString(def.falseLabel) ??
|
|
3246
|
+
firstNonEmptyString(def.labelFalse) ??
|
|
3247
|
+
firstNonEmptyString(def.extraProperties?.falseLabel) ??
|
|
3248
|
+
firstNonEmptyString(def.extraProperties?.labelFalse);
|
|
3249
|
+
if (trueLabel && falseLabel) {
|
|
3250
|
+
const tNorm = normalizePresentationToken(trueLabel);
|
|
3251
|
+
const fNorm = normalizePresentationToken(falseLabel);
|
|
3252
|
+
if (tNorm === 'ativo' && fNorm === 'inativo')
|
|
3253
|
+
return 'active-inactive';
|
|
3254
|
+
if (tNorm === 'sim' && (fNorm === 'nao' || fNorm === 'não'))
|
|
3255
|
+
return 'yes-no';
|
|
3256
|
+
return `custom|${trueLabel}|${falseLabel}`;
|
|
3257
|
+
}
|
|
3258
|
+
const name = normalizePresentationToken(def.name);
|
|
3259
|
+
if (name === 'ativo' || name === 'active' || name.endsWith('ativo')) {
|
|
3260
|
+
return 'active-inactive';
|
|
3261
|
+
}
|
|
3262
|
+
return undefined;
|
|
3263
|
+
}
|
|
3264
|
+
function resolveSchemaValueMappingFromFieldDefinition(def) {
|
|
3265
|
+
const explicit = def.valueMapping;
|
|
3266
|
+
if (explicit && typeof explicit === 'object' && !Array.isArray(explicit)) {
|
|
3267
|
+
const normalized = Object.entries(explicit).reduce((acc, [key, value]) => {
|
|
3268
|
+
if (key && typeof value === 'string' && value.trim()) {
|
|
3269
|
+
acc[key] = value.trim();
|
|
3270
|
+
}
|
|
3271
|
+
return acc;
|
|
3272
|
+
}, {});
|
|
3273
|
+
if (Object.keys(normalized).length > 0)
|
|
3274
|
+
return normalized;
|
|
3275
|
+
}
|
|
3276
|
+
const options = Array.isArray(def.options) ? def.options : [];
|
|
3277
|
+
if (options.length > 0) {
|
|
3278
|
+
const valueKey = firstNonEmptyString(def.optionValueKey) ?? 'key';
|
|
3279
|
+
const labelKey = firstNonEmptyString(def.optionLabelKey) ?? 'value';
|
|
3280
|
+
const mapping = options.reduce((acc, option) => {
|
|
3281
|
+
if (!option || typeof option !== 'object')
|
|
3282
|
+
return acc;
|
|
3283
|
+
const record = option;
|
|
3284
|
+
const value = record[valueKey] ?? record.key ?? record.id ?? record.value;
|
|
3285
|
+
const label = record[labelKey] ?? record.label ?? record.value ?? record.name;
|
|
3286
|
+
if (value !== undefined && value !== null && label !== undefined && label !== null) {
|
|
3287
|
+
acc[String(value)] = String(label);
|
|
3288
|
+
}
|
|
3289
|
+
return acc;
|
|
3290
|
+
}, {});
|
|
3291
|
+
if (Object.keys(mapping).length > 0)
|
|
3292
|
+
return mapping;
|
|
3293
|
+
}
|
|
3294
|
+
const enumValues = Array.isArray(def.enumValues)
|
|
3295
|
+
? def.enumValues
|
|
3296
|
+
.map((v) => (v != null ? String(v).trim() : ''))
|
|
3297
|
+
.filter((v) => v.length > 0)
|
|
3298
|
+
: [];
|
|
3299
|
+
if (enumValues.length > 0) {
|
|
3300
|
+
return enumValues.reduce((acc, value) => {
|
|
3301
|
+
acc[value] = humanizeSchemaEnumValue(value);
|
|
3302
|
+
return acc;
|
|
3303
|
+
}, {});
|
|
3304
|
+
}
|
|
3305
|
+
return undefined;
|
|
3306
|
+
}
|
|
3307
|
+
function humanizeSchemaEnumValue(value) {
|
|
3308
|
+
return value
|
|
3309
|
+
.toLowerCase()
|
|
3310
|
+
.split(/[_\-\s]+/)
|
|
3311
|
+
.filter(Boolean)
|
|
3312
|
+
.map((part, index) => (index === 0 ? `${part.charAt(0).toUpperCase()}${part.slice(1)}` : part))
|
|
3313
|
+
.join(' ');
|
|
3314
|
+
}
|
|
3315
|
+
function resolveRendererFromFieldDefinition(def) {
|
|
3316
|
+
const presentationRenderer = resolveRendererFromFieldPresentation(def);
|
|
3317
|
+
if (presentationRenderer)
|
|
3318
|
+
return presentationRenderer;
|
|
3319
|
+
if (normalizePresentationToken(def.controlType) === 'avatar') {
|
|
3320
|
+
const initialsField = firstNonEmptyString(def.initialsField) ??
|
|
3321
|
+
firstNonEmptyString(def.extraProperties?.initialsField) ??
|
|
3322
|
+
'nomeCompleto';
|
|
3323
|
+
return {
|
|
3324
|
+
type: 'avatar',
|
|
3325
|
+
avatar: {
|
|
3326
|
+
srcField: def.name,
|
|
3327
|
+
initialsField,
|
|
3328
|
+
shape: 'circle',
|
|
3329
|
+
size: 32,
|
|
3330
|
+
},
|
|
3331
|
+
};
|
|
3332
|
+
}
|
|
3333
|
+
return undefined;
|
|
3334
|
+
}
|
|
3160
3335
|
function resolveRendererFromFieldPresentation(def) {
|
|
3161
3336
|
const presentation = def.presentation;
|
|
3162
3337
|
if (!presentation || typeof presentation !== 'object')
|
|
3163
3338
|
return undefined;
|
|
3339
|
+
if (presentation.presenter === 'microVisualization' &&
|
|
3340
|
+
isPraxisPresentationVisualizationTableSafe(presentation.visualization)) {
|
|
3341
|
+
return {
|
|
3342
|
+
type: 'microVisualization',
|
|
3343
|
+
microVisualization: {
|
|
3344
|
+
visualization: presentation.visualization,
|
|
3345
|
+
},
|
|
3346
|
+
};
|
|
3347
|
+
}
|
|
3164
3348
|
const presenter = normalizePresentationToken(presentation.presenter ?? presentation.variant);
|
|
3165
3349
|
const color = resolveSemanticPresentationColor(presentation.tone);
|
|
3166
3350
|
const variant = resolveSemanticPresentationVariant(presentation.appearance);
|
|
3167
3351
|
const icon = firstNonEmptyString(presentation.icon);
|
|
3168
3352
|
const tooltipText = firstNonEmptyString(presentation.tooltip);
|
|
3169
3353
|
const tooltip = tooltipText ? { text: tooltipText } : undefined;
|
|
3354
|
+
const fixedText = firstNonEmptyString(presentation.label);
|
|
3170
3355
|
if (presenter === 'chip') {
|
|
3171
3356
|
return {
|
|
3172
3357
|
type: 'chip',
|
|
3173
3358
|
chip: {
|
|
3174
|
-
textField: def.name,
|
|
3359
|
+
...(fixedText ? { text: fixedText } : { textField: def.name }),
|
|
3175
3360
|
...(color ? { color } : {}),
|
|
3176
3361
|
...(variant ? { variant } : {}),
|
|
3177
3362
|
...(icon ? { icon } : {}),
|
|
@@ -3183,7 +3368,7 @@ function resolveRendererFromFieldPresentation(def) {
|
|
|
3183
3368
|
return {
|
|
3184
3369
|
type: 'badge',
|
|
3185
3370
|
badge: {
|
|
3186
|
-
textField: def.name,
|
|
3371
|
+
...(fixedText ? { text: fixedText } : { textField: def.name }),
|
|
3187
3372
|
...(color ? { color } : {}),
|
|
3188
3373
|
...(variant ? { variant } : {}),
|
|
3189
3374
|
...(icon ? { icon } : {}),
|
|
@@ -3197,13 +3382,41 @@ function resolveRendererFromFieldPresentation(def) {
|
|
|
3197
3382
|
const hasAffixes = !!(affixes.prefix || affixes.suffix);
|
|
3198
3383
|
if (!rendererIcon && !hasAffixes)
|
|
3199
3384
|
return undefined;
|
|
3385
|
+
if (affixes.prefix || affixes.suffix || tooltipText) {
|
|
3386
|
+
return {
|
|
3387
|
+
type: 'icon',
|
|
3388
|
+
icon: {
|
|
3389
|
+
...(!hasAffixes && rendererIcon ? { name: rendererIcon } : {}),
|
|
3390
|
+
textField: def.name,
|
|
3391
|
+
...(tooltipText ? { ariaLabel: tooltipText } : {}),
|
|
3392
|
+
...affixes,
|
|
3393
|
+
},
|
|
3394
|
+
};
|
|
3395
|
+
}
|
|
3396
|
+
if (!rendererIcon)
|
|
3397
|
+
return undefined;
|
|
3200
3398
|
return {
|
|
3201
|
-
type: '
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3399
|
+
type: 'compose',
|
|
3400
|
+
compose: {
|
|
3401
|
+
items: [
|
|
3402
|
+
{
|
|
3403
|
+
type: 'icon',
|
|
3404
|
+
icon: {
|
|
3405
|
+
name: rendererIcon,
|
|
3406
|
+
...(color ? { color } : {}),
|
|
3407
|
+
...(def.label ? { ariaLabel: def.label } : {}),
|
|
3408
|
+
},
|
|
3409
|
+
},
|
|
3410
|
+
{
|
|
3411
|
+
type: 'value',
|
|
3412
|
+
field: def.name,
|
|
3413
|
+
},
|
|
3414
|
+
],
|
|
3415
|
+
layout: {
|
|
3416
|
+
direction: 'row',
|
|
3417
|
+
gap: 6,
|
|
3418
|
+
align: 'center',
|
|
3419
|
+
},
|
|
3207
3420
|
},
|
|
3208
3421
|
};
|
|
3209
3422
|
}
|
|
@@ -3211,13 +3424,20 @@ function resolveRendererFromFieldPresentation(def) {
|
|
|
3211
3424
|
}
|
|
3212
3425
|
function resolveSemanticPresentationColor(tone) {
|
|
3213
3426
|
const normalized = normalizePresentationToken(tone);
|
|
3214
|
-
if (
|
|
3427
|
+
if (normalized === 'neutral')
|
|
3428
|
+
return 'basic';
|
|
3429
|
+
if (!normalized)
|
|
3215
3430
|
return undefined;
|
|
3216
|
-
|
|
3431
|
+
if (normalized === 'danger' || normalized === 'warning')
|
|
3432
|
+
return 'warn';
|
|
3433
|
+
return normalized;
|
|
3217
3434
|
}
|
|
3218
3435
|
function resolveSemanticPresentationVariant(appearance) {
|
|
3219
3436
|
const normalized = normalizePresentationToken(appearance);
|
|
3220
|
-
return normalized === 'filled' ||
|
|
3437
|
+
return normalized === 'filled' ||
|
|
3438
|
+
normalized === 'outlined' ||
|
|
3439
|
+
normalized === 'soft' ||
|
|
3440
|
+
normalized === 'plain'
|
|
3221
3441
|
? normalized
|
|
3222
3442
|
: undefined;
|
|
3223
3443
|
}
|
|
@@ -3235,6 +3455,12 @@ function firstNonEmptyString(value) {
|
|
|
3235
3455
|
const trimmed = value.trim();
|
|
3236
3456
|
return trimmed ? trimmed : undefined;
|
|
3237
3457
|
}
|
|
3458
|
+
function firstFiniteNumber(value) {
|
|
3459
|
+
if (value === null || value === undefined || value === '')
|
|
3460
|
+
return undefined;
|
|
3461
|
+
const numeric = typeof value === 'number' ? value : Number(value);
|
|
3462
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
3463
|
+
}
|
|
3238
3464
|
function normalizePresentationToken(value) {
|
|
3239
3465
|
return String(value ?? '').trim().toLowerCase().replace(/[\s_-]+/g, '');
|
|
3240
3466
|
}
|