@praxisui/core 10.0.0-rc.47 → 10.0.0-rc.49
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 +1 -1
- package/ai/component-registry.json +351 -351
- package/fesm2022/praxisui-core-schema.mjs +230 -1
- package/fesm2022/praxisui-core.mjs +31302 -28747
- package/package.json +1 -1
- package/theming/_theming.scss +97 -97
- package/theming/workspace-themes.scss +519 -0
- package/types/praxisui-core-schema.d.ts +64 -7
- package/types/praxisui-core.d.ts +636 -78
|
@@ -3514,6 +3514,151 @@ class SchemaNormalizationKernel {
|
|
|
3514
3514
|
normalizeSchema(schema) {
|
|
3515
3515
|
return this.normalizeSchemaWithRoot(schema, schema);
|
|
3516
3516
|
}
|
|
3517
|
+
/**
|
|
3518
|
+
* Extrai metadados estruturais de nível raiz (`x-ui` no objeto schema),
|
|
3519
|
+
* cobrindo `formLayout`, `progression`, `timeline`, `schedule`, `hierarchy`,
|
|
3520
|
+
* `calculationMemory`, `contextBinding` e `resourceState`.
|
|
3521
|
+
*/
|
|
3522
|
+
extractRootUiMetadata(schema) {
|
|
3523
|
+
const ui = schema &&
|
|
3524
|
+
typeof schema === 'object' &&
|
|
3525
|
+
!Array.isArray(schema) &&
|
|
3526
|
+
schema['x-ui'] &&
|
|
3527
|
+
typeof schema['x-ui'] === 'object' &&
|
|
3528
|
+
!Array.isArray(schema['x-ui'])
|
|
3529
|
+
? schema['x-ui']
|
|
3530
|
+
: undefined;
|
|
3531
|
+
if (!ui) {
|
|
3532
|
+
return null;
|
|
3533
|
+
}
|
|
3534
|
+
const out = {};
|
|
3535
|
+
const formLayout = this.parseSchemaFormLayout(ui['formLayout']);
|
|
3536
|
+
if (formLayout)
|
|
3537
|
+
out.formLayout = formLayout;
|
|
3538
|
+
if (ui['progression'] && typeof ui['progression'] === 'object' && !Array.isArray(ui['progression'])) {
|
|
3539
|
+
out.progression = this.clonePlain(ui['progression']);
|
|
3540
|
+
}
|
|
3541
|
+
if (ui['timeline'] && typeof ui['timeline'] === 'object' && !Array.isArray(ui['timeline'])) {
|
|
3542
|
+
out.timeline = this.clonePlain(ui['timeline']);
|
|
3543
|
+
}
|
|
3544
|
+
if (ui['schedule'] && typeof ui['schedule'] === 'object' && !Array.isArray(ui['schedule'])) {
|
|
3545
|
+
out.schedule = this.clonePlain(ui['schedule']);
|
|
3546
|
+
}
|
|
3547
|
+
if (ui['hierarchy'] && typeof ui['hierarchy'] === 'object' && !Array.isArray(ui['hierarchy'])) {
|
|
3548
|
+
out.hierarchy = this.clonePlain(ui['hierarchy']);
|
|
3549
|
+
}
|
|
3550
|
+
if (ui['calculationMemory'] && typeof ui['calculationMemory'] === 'object' && !Array.isArray(ui['calculationMemory'])) {
|
|
3551
|
+
out.calculationMemory = this.clonePlain(ui['calculationMemory']);
|
|
3552
|
+
}
|
|
3553
|
+
const contextBinding = this.parseContextBinding(ui['contextBinding']);
|
|
3554
|
+
if (contextBinding)
|
|
3555
|
+
out.contextBinding = contextBinding;
|
|
3556
|
+
const resourceState = this.parseResourceState(ui['resourceState']);
|
|
3557
|
+
if (resourceState)
|
|
3558
|
+
out.resourceState = resourceState;
|
|
3559
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
3560
|
+
}
|
|
3561
|
+
parseSchemaFormLayout(raw) {
|
|
3562
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
3563
|
+
return undefined;
|
|
3564
|
+
}
|
|
3565
|
+
const record = raw;
|
|
3566
|
+
const rawMode = String(record['mode'] ?? 'flat').trim().toLowerCase();
|
|
3567
|
+
const mode = rawMode === 'tabs' || rawMode === 'accordion' || rawMode === 'stepper' || rawMode === 'flat'
|
|
3568
|
+
? rawMode
|
|
3569
|
+
: 'flat';
|
|
3570
|
+
const rawSections = Array.isArray(record['sections']) ? record['sections'] : [];
|
|
3571
|
+
const sections = [];
|
|
3572
|
+
for (let idx = 0; idx < rawSections.length; idx++) {
|
|
3573
|
+
const entry = rawSections[idx];
|
|
3574
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry))
|
|
3575
|
+
continue;
|
|
3576
|
+
const item = entry;
|
|
3577
|
+
const id = String(item['id'] ?? '').trim();
|
|
3578
|
+
const title = String(item['title'] ?? '').trim();
|
|
3579
|
+
if (!id || !title)
|
|
3580
|
+
continue;
|
|
3581
|
+
const orderNum = Number(item['order']);
|
|
3582
|
+
const subtitle = typeof item['subtitle'] === 'string' && item['subtitle'].trim() ? item['subtitle'].trim() : undefined;
|
|
3583
|
+
const icon = typeof item['icon'] === 'string' && item['icon'].trim() ? item['icon'].trim() : undefined;
|
|
3584
|
+
const groups = this.parseNonBlankStringArray(item['groups']);
|
|
3585
|
+
sections.push({
|
|
3586
|
+
id,
|
|
3587
|
+
title,
|
|
3588
|
+
...(subtitle ? { subtitle } : {}),
|
|
3589
|
+
...(icon ? { icon } : {}),
|
|
3590
|
+
order: Number.isFinite(orderNum) ? orderNum : idx,
|
|
3591
|
+
...(groups.length ? { groups } : {}),
|
|
3592
|
+
});
|
|
3593
|
+
}
|
|
3594
|
+
sections.sort((a, b) => a.order - b.order);
|
|
3595
|
+
return {
|
|
3596
|
+
mode,
|
|
3597
|
+
...(sections.length ? { sections } : {}),
|
|
3598
|
+
};
|
|
3599
|
+
}
|
|
3600
|
+
parseContextBinding(raw) {
|
|
3601
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
3602
|
+
return undefined;
|
|
3603
|
+
}
|
|
3604
|
+
const record = raw;
|
|
3605
|
+
const dim = String(record['dimension'] ?? '').trim().toLowerCase();
|
|
3606
|
+
if (dim !== 'organization' &&
|
|
3607
|
+
dim !== 'company_group' &&
|
|
3608
|
+
dim !== 'unit' &&
|
|
3609
|
+
dim !== 'person' &&
|
|
3610
|
+
dim !== 'bond' &&
|
|
3611
|
+
dim !== 'contract') {
|
|
3612
|
+
return undefined;
|
|
3613
|
+
}
|
|
3614
|
+
const targetField = typeof record['targetField'] === 'string' && record['targetField'].trim()
|
|
3615
|
+
? record['targetField'].trim()
|
|
3616
|
+
: undefined;
|
|
3617
|
+
return {
|
|
3618
|
+
dimension: dim,
|
|
3619
|
+
lockWhenActive: this.parseBoolean(record['lockWhenActive']),
|
|
3620
|
+
...(targetField ? { targetField } : {}),
|
|
3621
|
+
};
|
|
3622
|
+
}
|
|
3623
|
+
parseResourceState(raw) {
|
|
3624
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
3625
|
+
return undefined;
|
|
3626
|
+
}
|
|
3627
|
+
const record = raw;
|
|
3628
|
+
const initialStates = this.parseNonBlankStringArray(record['initialStates']);
|
|
3629
|
+
const putMutableStates = this.parseNonBlankStringArray(record['putMutableStates']);
|
|
3630
|
+
if (!initialStates.length && !putMutableStates.length) {
|
|
3631
|
+
return undefined;
|
|
3632
|
+
}
|
|
3633
|
+
return {
|
|
3634
|
+
...(initialStates.length ? { initialStates } : {}),
|
|
3635
|
+
...(putMutableStates.length ? { putMutableStates } : {}),
|
|
3636
|
+
};
|
|
3637
|
+
}
|
|
3638
|
+
parseMicroVisualization(raw) {
|
|
3639
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
3640
|
+
return undefined;
|
|
3641
|
+
}
|
|
3642
|
+
const normalized = normalizePraxisPresentationVisualization(raw);
|
|
3643
|
+
if (normalized) {
|
|
3644
|
+
return normalized;
|
|
3645
|
+
}
|
|
3646
|
+
const clone = this.clonePlain(raw);
|
|
3647
|
+
if (typeof clone['kind'] === 'string' && clone['kind'].trim()) {
|
|
3648
|
+
const rawKind = clone['kind'].trim();
|
|
3649
|
+
const upper = rawKind.toUpperCase();
|
|
3650
|
+
if (upper === 'HARVEY_BALL')
|
|
3651
|
+
clone['kind'] = 'harveyBall';
|
|
3652
|
+
else if (upper === 'STACKED_BAR')
|
|
3653
|
+
clone['kind'] = 'stackedBar';
|
|
3654
|
+
else if (upper === 'PROCESS_FLOW')
|
|
3655
|
+
clone['kind'] = 'processFlow';
|
|
3656
|
+
else if (upper === upper && /^[A-Z_]+$/.test(rawKind))
|
|
3657
|
+
clone['kind'] = rawKind.toLowerCase();
|
|
3658
|
+
return clone;
|
|
3659
|
+
}
|
|
3660
|
+
return undefined;
|
|
3661
|
+
}
|
|
3517
3662
|
normalizeSchemaWithRoot(schema, rootSchema) {
|
|
3518
3663
|
if (!schema || typeof schema !== 'object') {
|
|
3519
3664
|
return [];
|
|
@@ -3697,6 +3842,40 @@ class SchemaNormalizationKernel {
|
|
|
3697
3842
|
if (condRequired !== undefined) {
|
|
3698
3843
|
field.conditionalRequired = condRequired;
|
|
3699
3844
|
}
|
|
3845
|
+
if (ui.conditionalReadOnly !== undefined && ui.conditionalReadOnly !== null) {
|
|
3846
|
+
if (typeof ui.conditionalReadOnly === 'string') {
|
|
3847
|
+
const trimmed = ui.conditionalReadOnly.trim();
|
|
3848
|
+
if (trimmed) {
|
|
3849
|
+
field.conditionalReadOnly = trimmed;
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
else {
|
|
3853
|
+
const condReadOnly = this.parseJsonLogicExpression(ui.conditionalReadOnly, name, 'x-ui.conditionalReadOnly');
|
|
3854
|
+
if (condReadOnly !== undefined) {
|
|
3855
|
+
field.conditionalReadOnly = condReadOnly;
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
if (ui.colSpan !== undefined) {
|
|
3860
|
+
const parsedSpan = this.parseOptionalFiniteNumber(ui.colSpan);
|
|
3861
|
+
if (parsedSpan !== undefined) {
|
|
3862
|
+
field.colSpan = Math.min(12, Math.max(1, Math.trunc(parsedSpan)));
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
const contextBinding = this.parseContextBinding(ui.contextBinding);
|
|
3866
|
+
if (contextBinding) {
|
|
3867
|
+
field.contextBinding = contextBinding;
|
|
3868
|
+
}
|
|
3869
|
+
if (ui.draftCleared !== undefined) {
|
|
3870
|
+
const parsedDraftCleared = this.parseOptionalBoolean(ui.draftCleared);
|
|
3871
|
+
if (parsedDraftCleared !== undefined) {
|
|
3872
|
+
field.draftCleared = parsedDraftCleared;
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
const resourceState = this.parseResourceState(ui.resourceState);
|
|
3876
|
+
if (resourceState) {
|
|
3877
|
+
field.resourceState = resourceState;
|
|
3878
|
+
}
|
|
3700
3879
|
const transformFn = this.parseTransformFunction(ui.transformValueFunction);
|
|
3701
3880
|
if (transformFn) {
|
|
3702
3881
|
field.transformValueFunction = transformFn;
|
|
@@ -3711,6 +3890,30 @@ class SchemaNormalizationKernel {
|
|
|
3711
3890
|
if (ui.tableHidden !== undefined) {
|
|
3712
3891
|
field.tableHidden = this.parseBoolean(ui.tableHidden);
|
|
3713
3892
|
}
|
|
3893
|
+
if (ui.tableOrder !== undefined) {
|
|
3894
|
+
const parsedTableOrder = this.parseOptionalFiniteNumber(ui.tableOrder);
|
|
3895
|
+
if (parsedTableOrder !== undefined) {
|
|
3896
|
+
field.tableOrder = parsedTableOrder;
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
if (ui.pinned !== undefined && typeof ui.pinned === 'string') {
|
|
3900
|
+
const pinned = ui.pinned.trim().toLowerCase();
|
|
3901
|
+
if (pinned === 'start' || pinned === 'end') {
|
|
3902
|
+
field.pinned = pinned;
|
|
3903
|
+
}
|
|
3904
|
+
}
|
|
3905
|
+
if (ui.primarySearch !== undefined) {
|
|
3906
|
+
const primarySearch = this.parseOptionalBoolean(ui.primarySearch);
|
|
3907
|
+
if (primarySearch !== undefined) {
|
|
3908
|
+
field.primarySearch = primarySearch;
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
if (ui.microVisualization !== undefined) {
|
|
3912
|
+
const microVisualization = this.parseMicroVisualization(ui.microVisualization);
|
|
3913
|
+
if (microVisualization) {
|
|
3914
|
+
field.microVisualization = microVisualization;
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3714
3917
|
if (ui.formHidden !== undefined) {
|
|
3715
3918
|
field.formHidden = this.parseBoolean(ui.formHidden);
|
|
3716
3919
|
}
|
|
@@ -4267,6 +4470,10 @@ class SchemaNormalizationKernel {
|
|
|
4267
4470
|
function normalizeSchemaFields(schema) {
|
|
4268
4471
|
return new SchemaNormalizationKernel().normalizeSchema(schema);
|
|
4269
4472
|
}
|
|
4473
|
+
/** Extracts root-level `x-ui` metadata blocks (`formLayout`, `progression`, `timeline`, `schedule`, `hierarchy`, `calculationMemory`). */
|
|
4474
|
+
function extractSchemaRootUiMetadata(schema) {
|
|
4475
|
+
return new SchemaNormalizationKernel().extractRootUiMetadata(schema);
|
|
4476
|
+
}
|
|
4270
4477
|
|
|
4271
4478
|
function isObject(value) {
|
|
4272
4479
|
return value != null && typeof value === 'object' && !Array.isArray(value);
|
|
@@ -4351,6 +4558,12 @@ function buildBaseColumnFromDef(def) {
|
|
|
4351
4558
|
const quickView = resolveQuickViewFromFieldDefinition(def);
|
|
4352
4559
|
const isAvatar = renderer?.type === 'avatar';
|
|
4353
4560
|
const explicitWidth = firstNonEmptyString(def.width);
|
|
4561
|
+
const resolvedOrder = typeof def.tableOrder === 'number'
|
|
4562
|
+
? def.tableOrder
|
|
4563
|
+
: typeof def.order === 'number'
|
|
4564
|
+
? def.order
|
|
4565
|
+
: undefined;
|
|
4566
|
+
const sticky = def.pinned ?? def.sticky;
|
|
4354
4567
|
return {
|
|
4355
4568
|
field: def.name,
|
|
4356
4569
|
header: def.label || def.name,
|
|
@@ -4359,7 +4572,8 @@ function buildBaseColumnFromDef(def) {
|
|
|
4359
4572
|
sortable: def.sortable !== false,
|
|
4360
4573
|
filterable: def.filterable === true,
|
|
4361
4574
|
resizable: true,
|
|
4362
|
-
|
|
4575
|
+
...(sticky !== undefined ? { sticky } : {}),
|
|
4576
|
+
order: resolvedOrder,
|
|
4363
4577
|
...(explicitWidth ? { width: explicitWidth } : isAvatar ? { width: '56px' } : {}),
|
|
4364
4578
|
...(isAvatar ? { align: 'center' } : {}),
|
|
4365
4579
|
...(format ? { format } : {}),
|
|
@@ -4422,6 +4636,10 @@ function reconcileTableConfig(layout, serverDefs) {
|
|
|
4422
4636
|
const localCol = localByField.get(base.field);
|
|
4423
4637
|
return localCol ? applyLocalCustomizations(base, localCol) : base;
|
|
4424
4638
|
});
|
|
4639
|
+
if (serverDefs.some((d) => typeof d.tableOrder === 'number')) {
|
|
4640
|
+
mergedColumns.sort((a, b) => (a.order ?? Number.MAX_SAFE_INTEGER) -
|
|
4641
|
+
(b.order ?? Number.MAX_SAFE_INTEGER));
|
|
4642
|
+
}
|
|
4425
4643
|
const serverFields = new Set(serverDefs.map((d) => d.name));
|
|
4426
4644
|
const orphans = (local.columns || []).filter((c) => !serverFields.has(c.field));
|
|
4427
4645
|
const hiddenOrphans = orphans.map((c) => ({ ...c, visible: false }));
|
|
@@ -4554,6 +4772,9 @@ function resolveFormatFromFieldDefinition(def, type) {
|
|
|
4554
4772
|
numericFormat === 'int64') {
|
|
4555
4773
|
return '1.0-0';
|
|
4556
4774
|
}
|
|
4775
|
+
if (numericFormat === 'auto') {
|
|
4776
|
+
return undefined;
|
|
4777
|
+
}
|
|
4557
4778
|
const explicitDecimals = firstFiniteNumber(def.decimalPlaces) ??
|
|
4558
4779
|
firstFiniteNumber(def.extraProperties?.decimalPlaces);
|
|
4559
4780
|
if (explicitDecimals !== undefined && explicitDecimals >= 0) {
|
|
@@ -4762,6 +4983,14 @@ function resolveRendererFromFieldDefinition(def) {
|
|
|
4762
4983
|
const presentationRenderer = resolveRendererFromFieldPresentation(def);
|
|
4763
4984
|
if (presentationRenderer)
|
|
4764
4985
|
return presentationRenderer;
|
|
4986
|
+
if (isPraxisPresentationVisualizationTableSafe(def.microVisualization)) {
|
|
4987
|
+
return {
|
|
4988
|
+
type: 'microVisualization',
|
|
4989
|
+
microVisualization: {
|
|
4990
|
+
visualization: def.microVisualization,
|
|
4991
|
+
},
|
|
4992
|
+
};
|
|
4993
|
+
}
|
|
4765
4994
|
if (normalizePresentationToken(def.controlType) === 'avatar') {
|
|
4766
4995
|
const initialsField = firstNonEmptyString(def.initialsField) ??
|
|
4767
4996
|
firstNonEmptyString(def.extraProperties?.initialsField) ??
|