@praxisui/rich-content 10.0.0-rc.11 → 10.0.0-rc.13
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-14T09:51:43.880Z",
|
|
4
4
|
"packageName": "@praxisui/rich-content",
|
|
5
|
-
"packageVersion": "10.0.0-rc.
|
|
5
|
+
"packageVersion": "10.0.0-rc.13",
|
|
6
6
|
"sourceRegistry": "praxis-component-registry-ingestion",
|
|
7
7
|
"sourceRegistryVersion": "1.0.0",
|
|
8
8
|
"componentCount": 1,
|
|
@@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
|
|
|
3
3
|
import * as i2 from '@angular/material/menu';
|
|
4
4
|
import { MatMenuModule } from '@angular/material/menu';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { InjectionToken, inject, Injectable, signal, input, EventEmitter, computed, Output, Input, ChangeDetectionStrategy, Component, ChangeDetectorRef, ENVIRONMENT_INITIALIZER } from '@angular/core';
|
|
6
|
+
import { InjectionToken, inject, Injectable, LOCALE_ID, signal, input, EventEmitter, computed, Output, Input, ChangeDetectionStrategy, Component, ChangeDetectorRef, ENVIRONMENT_INITIALIZER } from '@angular/core';
|
|
7
7
|
import { providePraxisI18n, PraxisI18nService, PraxisJsonLogicService, GlobalActionService, SchemaNormalizerService, GenericCrudService, SCHEMA_METADATA_CLIENT_OPTIONS, normalizeCardMediaAspectRatio, MemoryCacheAdapter, SchemaMetadataClient, SETTINGS_PANEL_DATA, generateId, ComponentMetadataRegistry } from '@praxisui/core';
|
|
8
8
|
import * as i2$1 from '@angular/forms';
|
|
9
9
|
import { FormsModule } from '@angular/forms';
|
|
@@ -1218,6 +1218,7 @@ class PraxisRichContent {
|
|
|
1218
1218
|
presetRegistry = inject(RichContentPresetRegistryService);
|
|
1219
1219
|
defaultGlobalActions = inject(GlobalActionService, { optional: true });
|
|
1220
1220
|
schemaNormalizer = inject(SchemaNormalizerService, { optional: true });
|
|
1221
|
+
localeId = inject(LOCALE_ID, { optional: true }) || 'pt-BR';
|
|
1221
1222
|
crud = inject(GenericCrudService, { optional: true });
|
|
1222
1223
|
schemaTransportOptions = inject(SCHEMA_METADATA_CLIENT_OPTIONS, { optional: true });
|
|
1223
1224
|
localSchemaMap = new Map();
|
|
@@ -1362,7 +1363,8 @@ class PraxisRichContent {
|
|
|
1362
1363
|
return literalNum;
|
|
1363
1364
|
}
|
|
1364
1365
|
const value = this.resolveValue(node.valueExpr);
|
|
1365
|
-
|
|
1366
|
+
const num = typeof value === 'number' ? value : Number(value ?? 0);
|
|
1367
|
+
return Number.isFinite(num) ? num : 0;
|
|
1366
1368
|
}
|
|
1367
1369
|
return 0;
|
|
1368
1370
|
}
|
|
@@ -1684,9 +1686,7 @@ class PraxisRichContent {
|
|
|
1684
1686
|
const contextSchemas = evalContext?._schemas ?? evalContext?.__schemas;
|
|
1685
1687
|
const directSchema = contextSchemas?.[schemaKey] ?? evalContext?.schema;
|
|
1686
1688
|
if (directSchema) {
|
|
1687
|
-
schemaFields = this.schemaNormalizer
|
|
1688
|
-
? this.schemaNormalizer.normalizeSchema(directSchema)
|
|
1689
|
-
: this.fallbackNormalizeSchema(directSchema);
|
|
1689
|
+
schemaFields = (this.schemaNormalizer ?? new SchemaNormalizerService()).normalizeSchema(directSchema);
|
|
1690
1690
|
if (schemaFields?.length) {
|
|
1691
1691
|
this.localSchemaMap.set(schemaKey, schemaFields);
|
|
1692
1692
|
}
|
|
@@ -1839,27 +1839,32 @@ class PraxisRichContent {
|
|
|
1839
1839
|
}
|
|
1840
1840
|
// 2. Números e moedas
|
|
1841
1841
|
if (typeof rawVal === 'number') {
|
|
1842
|
+
const activeLocale = this.localeId || 'pt-BR';
|
|
1842
1843
|
if (field?.type === 'currency' || field?.controlType === 'currency') {
|
|
1844
|
+
const currencyCode = field?.currency ||
|
|
1845
|
+
field?.extraProperties?.currency ||
|
|
1846
|
+
'BRL';
|
|
1843
1847
|
return {
|
|
1844
|
-
value: rawVal.toLocaleString(
|
|
1848
|
+
value: rawVal.toLocaleString(activeLocale, {
|
|
1845
1849
|
style: 'currency',
|
|
1846
|
-
currency:
|
|
1850
|
+
currency: currencyCode,
|
|
1847
1851
|
}),
|
|
1848
1852
|
};
|
|
1849
1853
|
}
|
|
1850
1854
|
if (field?.type === 'percent' || field?.controlType === 'percent') {
|
|
1851
1855
|
return {
|
|
1852
|
-
value: rawVal.toLocaleString(
|
|
1856
|
+
value: rawVal.toLocaleString(activeLocale, {
|
|
1853
1857
|
style: 'percent',
|
|
1854
1858
|
minimumFractionDigits: 1,
|
|
1855
1859
|
maximumFractionDigits: 2,
|
|
1856
1860
|
}),
|
|
1857
1861
|
};
|
|
1858
1862
|
}
|
|
1859
|
-
return { value: rawVal.toLocaleString(
|
|
1863
|
+
return { value: rawVal.toLocaleString(activeLocale) };
|
|
1860
1864
|
}
|
|
1861
1865
|
// 3. Datas ISO e strings temporais
|
|
1862
1866
|
if (typeof rawVal === 'string') {
|
|
1867
|
+
const activeLocale = this.localeId || 'pt-BR';
|
|
1863
1868
|
const isDateType = field?.type === 'date' ||
|
|
1864
1869
|
field?.type === 'date-time' ||
|
|
1865
1870
|
field?.controlType === 'date' ||
|
|
@@ -1870,7 +1875,7 @@ class PraxisRichContent {
|
|
|
1870
1875
|
const hasTime = rawVal.includes('T') && (field?.type === 'date-time' || !field?.type);
|
|
1871
1876
|
if (hasTime) {
|
|
1872
1877
|
return {
|
|
1873
|
-
value: parsed.toLocaleString(
|
|
1878
|
+
value: parsed.toLocaleString(activeLocale, {
|
|
1874
1879
|
dateStyle: 'short',
|
|
1875
1880
|
timeStyle: 'short',
|
|
1876
1881
|
}),
|
|
@@ -1888,7 +1893,15 @@ class PraxisRichContent {
|
|
|
1888
1893
|
// 4. Objetos complexos
|
|
1889
1894
|
if (typeof rawVal === 'object') {
|
|
1890
1895
|
const obj = rawVal;
|
|
1891
|
-
const
|
|
1896
|
+
const customLabelKey = field?.optionLabelKey || field?.displayField;
|
|
1897
|
+
const displayVal = (customLabelKey && typeof obj[customLabelKey] === 'string'
|
|
1898
|
+
? obj[customLabelKey]
|
|
1899
|
+
: undefined) ||
|
|
1900
|
+
obj['label'] ||
|
|
1901
|
+
obj['title'] ||
|
|
1902
|
+
obj['name'] ||
|
|
1903
|
+
obj['displayName'] ||
|
|
1904
|
+
obj['value'];
|
|
1892
1905
|
if (displayVal && typeof displayVal === 'string') {
|
|
1893
1906
|
return { value: displayVal };
|
|
1894
1907
|
}
|
|
@@ -1900,31 +1913,6 @@ class PraxisRichContent {
|
|
|
1900
1913
|
const spaced = propName.replace(/([A-Z])/g, ' $1').trim();
|
|
1901
1914
|
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
1902
1915
|
}
|
|
1903
|
-
fallbackNormalizeSchema(schema) {
|
|
1904
|
-
const properties = schema?.properties ||
|
|
1905
|
-
schema?.components?.schemas?.[Object.keys(schema?.components?.schemas || {})[0]]?.properties;
|
|
1906
|
-
if (!properties || typeof properties !== 'object') {
|
|
1907
|
-
return [];
|
|
1908
|
-
}
|
|
1909
|
-
return Object.entries(properties).map(([name, prop]) => {
|
|
1910
|
-
const ui = prop?.['x-ui'] || {};
|
|
1911
|
-
const rawOptions = ui.options ||
|
|
1912
|
-
prop.options ||
|
|
1913
|
-
(Array.isArray(prop.enum)
|
|
1914
|
-
? prop.enum.map((e) => ({ key: String(e), value: String(e) }))
|
|
1915
|
-
: undefined);
|
|
1916
|
-
return {
|
|
1917
|
-
name,
|
|
1918
|
-
label: ui.label || prop.title || name,
|
|
1919
|
-
group: ui.group || undefined,
|
|
1920
|
-
description: prop.description,
|
|
1921
|
-
type: prop.type,
|
|
1922
|
-
controlType: ui.controlType,
|
|
1923
|
-
options: rawOptions,
|
|
1924
|
-
presentation: ui.presentation,
|
|
1925
|
-
};
|
|
1926
|
-
});
|
|
1927
|
-
}
|
|
1928
1916
|
loadResourceSchema(resourcePath) {
|
|
1929
1917
|
if (this.inFlightSchemaRequests.has(resourcePath)) {
|
|
1930
1918
|
return;
|
|
@@ -1959,9 +1947,7 @@ class PraxisRichContent {
|
|
|
1959
1947
|
})
|
|
1960
1948
|
.then((entry) => {
|
|
1961
1949
|
if (entry?.schema) {
|
|
1962
|
-
const defs = this.schemaNormalizer
|
|
1963
|
-
? this.schemaNormalizer.normalizeSchema(entry.schema)
|
|
1964
|
-
: this.fallbackNormalizeSchema(entry.schema);
|
|
1950
|
+
const defs = (this.schemaNormalizer ?? new SchemaNormalizerService()).normalizeSchema(entry.schema);
|
|
1965
1951
|
this.localSchemaMap.set(resourcePath, defs);
|
|
1966
1952
|
this.schemaVersion.update((v) => v + 1);
|
|
1967
1953
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisui/rich-content",
|
|
3
|
-
"version": "10.0.0-rc.
|
|
3
|
+
"version": "10.0.0-rc.13",
|
|
4
4
|
"description": "Rich content rendering and authoring primitives for Praxis UI surfaces, including semantic blocks and page-builder 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
|
-
"@praxisui/core": "^10.0.0-rc.
|
|
9
|
+
"@praxisui/core": "^10.0.0-rc.13",
|
|
10
10
|
"@angular/forms": "^21.0.0",
|
|
11
11
|
"rxjs": "~7.8.0"
|
|
12
12
|
},
|
|
@@ -11,6 +11,7 @@ declare class PraxisRichContent {
|
|
|
11
11
|
private readonly presetRegistry;
|
|
12
12
|
private readonly defaultGlobalActions;
|
|
13
13
|
private readonly schemaNormalizer;
|
|
14
|
+
private readonly localeId;
|
|
14
15
|
private readonly crud;
|
|
15
16
|
private readonly schemaTransportOptions;
|
|
16
17
|
private readonly localSchemaMap;
|
|
@@ -137,7 +138,6 @@ declare class PraxisRichContent {
|
|
|
137
138
|
resolveDynamicFormItems(node: RichDynamicFormNode): RichPropertySheetItem[];
|
|
138
139
|
private formatPropertyValue;
|
|
139
140
|
private formatCamelCaseLabel;
|
|
140
|
-
private fallbackNormalizeSchema;
|
|
141
141
|
private loadResourceSchema;
|
|
142
142
|
resolvePropertySheetLabel(item: RichPropertySheetItem): string;
|
|
143
143
|
resolvePropertySheetValue(item: RichPropertySheetItem): string;
|