@praxisui/core 10.0.0-rc.37 → 10.0.0-rc.39
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 +40 -0
- package/ai/component-registry.json +4 -4
- package/fesm2022/praxisui-core-schema.mjs +558 -44
- package/fesm2022/praxisui-core.mjs +9236 -4617
- package/package.json +1 -1
- package/theme-bridge.css +81 -0
- package/theming/_theming.scss +96 -0
- package/types/praxisui-core-schema.d.ts +231 -132
- package/types/praxisui-core.d.ts +3635 -2828
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
|
|
1
3
|
function normalizeFieldAccessMetadata(value) {
|
|
2
4
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
3
5
|
return undefined;
|
|
@@ -167,8 +169,8 @@ function resolvePraxisMicroVisualizationTone(value, thresholds, fallbackTone) {
|
|
|
167
169
|
if (value === undefined || value === null || !Array.isArray(thresholds) || thresholds.length === 0) {
|
|
168
170
|
return fallbackTone ? { tone: fallbackTone } : undefined;
|
|
169
171
|
}
|
|
170
|
-
const num =
|
|
171
|
-
const isNum =
|
|
172
|
+
const num = toFiniteNumber(value);
|
|
173
|
+
const isNum = num !== undefined;
|
|
172
174
|
// 1. Pass 1: Correspondencia discreta (equals) tem prioridade maxima
|
|
173
175
|
for (const t of thresholds) {
|
|
174
176
|
if (!t || !t.tone || t.equals === undefined) {
|
|
@@ -177,7 +179,8 @@ function resolvePraxisMicroVisualizationTone(value, thresholds, fallbackTone) {
|
|
|
177
179
|
if (t.equals === value || String(t.equals) === String(value)) {
|
|
178
180
|
return { tone: t.tone, label: t.label, matchedThreshold: t };
|
|
179
181
|
}
|
|
180
|
-
|
|
182
|
+
const eqNum = toFiniteNumber(t.equals);
|
|
183
|
+
if (isNum && eqNum !== undefined && eqNum === num) {
|
|
181
184
|
return { tone: t.tone, label: t.label, matchedThreshold: t };
|
|
182
185
|
}
|
|
183
186
|
}
|
|
@@ -354,7 +357,7 @@ function renderComparisonVisualizationHtml(visualization, options) {
|
|
|
354
357
|
const rows = points
|
|
355
358
|
.map((point) => {
|
|
356
359
|
const width = percent(point.value, max);
|
|
357
|
-
const formattedVal =
|
|
360
|
+
const formattedVal = formatVisualizationMetricValue(point.value, options, useCompact, suffix);
|
|
358
361
|
const readout = `${point.label ? `${point.label}: ` : ''}${formattedVal} (${Math.round(Number(width))}%)`;
|
|
359
362
|
return `
|
|
360
363
|
<span class="pfx-micro-viz__row" data-tone="${escapeHtml(point.tone ?? visualization.tone ?? 'info')}" data-micro-readout="${escapeHtml(readout)}">
|
|
@@ -379,10 +382,11 @@ function renderStackedBarVisualizationHtml(visualization, options) {
|
|
|
379
382
|
? visualization.total
|
|
380
383
|
: Math.max(1, segments.reduce((sum, segment) => sum + Math.max(0, segment.value), 0));
|
|
381
384
|
const suffix = visualization.valueSuffix ?? '';
|
|
385
|
+
const useCompact = visualization.compactValue === true;
|
|
382
386
|
const bars = segments
|
|
383
387
|
.map((segment) => {
|
|
384
388
|
const pctStr = percent(segment.value, total);
|
|
385
|
-
const formattedVal =
|
|
389
|
+
const formattedVal = formatVisualizationMetricValue(segment.value, options, useCompact, suffix);
|
|
386
390
|
const readout = `${segment.label ? `${segment.label}: ` : ''}${formattedVal} (${Math.round(Number(pctStr))}%)`;
|
|
387
391
|
return `
|
|
388
392
|
<span
|
|
@@ -396,7 +400,7 @@ function renderStackedBarVisualizationHtml(visualization, options) {
|
|
|
396
400
|
.join('');
|
|
397
401
|
const meta = segments
|
|
398
402
|
.slice(0, 3)
|
|
399
|
-
.map((segment) => `<span>${escapeHtml(segment.label ?? '')}: ${escapeHtml(
|
|
403
|
+
.map((segment) => `<span>${escapeHtml(segment.label ?? '')}: ${escapeHtml(formatVisualizationMetricValue(segment.value, options, useCompact, suffix))}</span>`)
|
|
400
404
|
.join('');
|
|
401
405
|
return `
|
|
402
406
|
<span class="pfx-micro-viz pfx-micro-viz__stacked" role="img" aria-label="${escapeHtml(visualization.ariaLabel ?? visualization.fallbackText)}">
|
|
@@ -454,26 +458,26 @@ function renderBulletVisualizationHtml(visualization, options) {
|
|
|
454
458
|
<div class="pfx-micro-bullet__top">
|
|
455
459
|
<span class="pfx-micro-bullet__label">${escapeHtml(visualization.fallbackText)}</span>
|
|
456
460
|
<span class="pfx-micro-bullet__value">
|
|
457
|
-
${escapeHtml(
|
|
458
|
-
${target === undefined ? '' : `<span class="pfx-micro-bullet__target-val">/ Target: ${escapeHtml(
|
|
461
|
+
${escapeHtml(formatVisualizationMetricValue(currentValue, options, false, suffix))}
|
|
462
|
+
${target === undefined ? '' : `<span class="pfx-micro-bullet__target-val">/ Target: ${escapeHtml(formatVisualizationMetricValue(target, options, false, suffix))}</span>`}
|
|
459
463
|
</span>
|
|
460
464
|
</div>`;
|
|
461
465
|
const bottomHtml = isTable ? '' : `
|
|
462
466
|
<div class="pfx-micro-bullet__bottom">
|
|
463
|
-
<span>${escapeHtml(
|
|
464
|
-
<span>${escapeHtml(
|
|
467
|
+
<span>${escapeHtml(formatVisualizationMetricValue(visualization.baseline ?? 0, options, false, suffix))}</span>
|
|
468
|
+
<span>${escapeHtml(formatVisualizationMetricValue(max, options, false, suffix))}</span>
|
|
465
469
|
</div>`;
|
|
466
470
|
const showCompactValue = isTable && visualization.compactValue !== false;
|
|
467
471
|
const useCompactNotation = visualization.compactValue === true;
|
|
468
472
|
const compactValueHtml = showCompactValue
|
|
469
|
-
? `<span class="pfx-micro-bullet__compact-value">${escapeHtml(
|
|
473
|
+
? `<span class="pfx-micro-bullet__compact-value">${escapeHtml(formatVisualizationMetricValue(currentValue, options, useCompactNotation, suffix))}</span>`
|
|
470
474
|
: '';
|
|
471
|
-
const currentStr =
|
|
475
|
+
const currentStr = formatVisualizationMetricValue(currentValue, options, false, suffix);
|
|
472
476
|
const diff = target !== undefined ? currentValue - target : undefined;
|
|
473
477
|
const diffSign = diff !== undefined && diff > 0 ? '+' : '';
|
|
474
478
|
const bulletReadout = target !== undefined && diff !== undefined
|
|
475
|
-
? `${currentStr} / Target ${
|
|
476
|
-
: `${currentStr} / ${
|
|
479
|
+
? `${currentStr} / Target ${formatVisualizationMetricValue(target, options, false, suffix)} (${diffSign}${formatVisualizationMetricValue(diff, options, false, suffix)})`
|
|
480
|
+
: `${currentStr} / ${formatVisualizationMetricValue(max, options, false, suffix)}`;
|
|
477
481
|
const tabIndexAttr = isTable ? '' : ' tabindex="0"';
|
|
478
482
|
return `
|
|
479
483
|
<span class="pfx-micro-viz pfx-micro-viz__bullet"${tabIndexAttr} data-tone="${escapeHtml(visualization.tone ?? 'info')}" data-micro-readout="${escapeHtml(bulletReadout)}" role="img" aria-label="${escapeHtml(visualization.ariaLabel ?? visualization.fallbackText)}">
|
|
@@ -502,7 +506,7 @@ function renderDeltaVisualizationHtml(visualization, options) {
|
|
|
502
506
|
const valueSuffix = visualization.valueSuffix ?? '';
|
|
503
507
|
const text = value === undefined
|
|
504
508
|
? visualization.fallbackText
|
|
505
|
-
:
|
|
509
|
+
: formatVisualizationMetricValue(Math.abs(value), options, visualization.compactValue === true, valueSuffix);
|
|
506
510
|
const directionLabel = direction === 'up'
|
|
507
511
|
? 'up'
|
|
508
512
|
: direction === 'down'
|
|
@@ -513,9 +517,9 @@ function renderDeltaVisualizationHtml(visualization, options) {
|
|
|
513
517
|
const baseline = toFiniteNumber(visualization.baseline);
|
|
514
518
|
const isTable = visualization.surface === 'table-cell';
|
|
515
519
|
const deltaReadout = target !== undefined
|
|
516
|
-
? `Target ${
|
|
520
|
+
? `Target ${formatVisualizationMetricValue(target, options, false, valueSuffix)}`
|
|
517
521
|
: baseline !== undefined
|
|
518
|
-
? `Base ${
|
|
522
|
+
? `Base ${formatVisualizationMetricValue(baseline, options, false, valueSuffix)}`
|
|
519
523
|
: null;
|
|
520
524
|
const readoutAttr = deltaReadout
|
|
521
525
|
? `${isTable ? '' : ' tabindex="0"'} data-micro-readout="${escapeHtml(deltaReadout)}"`
|
|
@@ -533,7 +537,27 @@ function percent(value, total) {
|
|
|
533
537
|
return Math.max(0, Math.min(100, (value / total) * 100)).toFixed(2);
|
|
534
538
|
}
|
|
535
539
|
function toFiniteNumber(value) {
|
|
536
|
-
|
|
540
|
+
if (typeof value === 'number') {
|
|
541
|
+
return Number.isFinite(value) ? value : undefined;
|
|
542
|
+
}
|
|
543
|
+
if (typeof value === 'string') {
|
|
544
|
+
const trimmed = value.trim();
|
|
545
|
+
if (!trimmed) {
|
|
546
|
+
return undefined;
|
|
547
|
+
}
|
|
548
|
+
const parsed = Number(trimmed);
|
|
549
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
550
|
+
}
|
|
551
|
+
return undefined;
|
|
552
|
+
}
|
|
553
|
+
function formatVisualizationMetricValue(value, options, compactValue = false, suffix = '') {
|
|
554
|
+
if (typeof options.formatValue === 'function') {
|
|
555
|
+
const custom = options.formatValue(value, compactValue);
|
|
556
|
+
if (typeof custom === 'string' && custom.trim().length > 0) {
|
|
557
|
+
return suffix && !custom.endsWith(suffix) ? `${custom}${suffix}` : custom;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return `${formatMicroNumber(value, options.locale, compactValue)}${suffix}`;
|
|
537
561
|
}
|
|
538
562
|
function formatMicroNumber(value, locale, compactValue = false) {
|
|
539
563
|
if (compactValue && Math.abs(value) >= 1000) {
|
|
@@ -617,16 +641,21 @@ function normalizeNumericEntries(value) {
|
|
|
617
641
|
}
|
|
618
642
|
return value
|
|
619
643
|
.map((item) => {
|
|
620
|
-
if (typeof item === 'number') {
|
|
621
|
-
|
|
644
|
+
if (typeof item === 'number' || typeof item === 'string') {
|
|
645
|
+
const num = toFiniteNumber(item);
|
|
646
|
+
return num !== undefined ? { value: num } : null;
|
|
647
|
+
}
|
|
648
|
+
if (!item || typeof item !== 'object') {
|
|
649
|
+
return null;
|
|
622
650
|
}
|
|
623
|
-
|
|
651
|
+
const num = toFiniteNumber(item.value);
|
|
652
|
+
if (num === undefined) {
|
|
624
653
|
return null;
|
|
625
654
|
}
|
|
626
655
|
const label = normalizeText$1(item.label);
|
|
627
656
|
const tone = normalizeEnum$1(item.tone, VISUALIZATION_TONES);
|
|
628
657
|
return {
|
|
629
|
-
value:
|
|
658
|
+
value: num,
|
|
630
659
|
...(label ? { label } : {}),
|
|
631
660
|
...(tone ? { tone } : {}),
|
|
632
661
|
};
|
|
@@ -642,7 +671,7 @@ function normalizeVisualizationItem(item) {
|
|
|
642
671
|
const icon = normalizeText$1(item.icon);
|
|
643
672
|
const state = normalizeText$1(item.state);
|
|
644
673
|
const tone = normalizeEnum$1(item.tone, VISUALIZATION_TONES);
|
|
645
|
-
const normalizedValue =
|
|
674
|
+
const normalizedValue = toFiniteNumber(item.value);
|
|
646
675
|
if (!id && !label && normalizedValue === undefined && !icon && !state && !tone) {
|
|
647
676
|
return null;
|
|
648
677
|
}
|
|
@@ -656,7 +685,8 @@ function normalizeVisualizationItem(item) {
|
|
|
656
685
|
};
|
|
657
686
|
}
|
|
658
687
|
function normalizeNumber(value, key) {
|
|
659
|
-
|
|
688
|
+
const num = toFiniteNumber(value);
|
|
689
|
+
return num !== undefined ? { [key]: num } : undefined;
|
|
660
690
|
}
|
|
661
691
|
function normalizeEnum$1(value, allowed) {
|
|
662
692
|
if (typeof value !== 'string') {
|
|
@@ -691,7 +721,7 @@ function renderRadialVisualizationHtml(visualization, options) {
|
|
|
691
721
|
const externalText = isTable
|
|
692
722
|
? `<span class="pfx-micro-radial-value">${escapeHtml(pctText)}</span>`
|
|
693
723
|
: '';
|
|
694
|
-
const radialReadout = `${
|
|
724
|
+
const radialReadout = `${formatVisualizationMetricValue(value, options, false, suffix)} / ${formatVisualizationMetricValue(total, options, false, suffix)} (${pctText})`;
|
|
695
725
|
const tabIndexAttr = isTable ? '' : ' tabindex="0"';
|
|
696
726
|
return `
|
|
697
727
|
<span class="pfx-micro-viz pfx-micro-viz__radial"${tabIndexAttr} data-tone="${escapeHtml(tone)}" data-micro-readout="${escapeHtml(radialReadout)}" role="img" aria-label="${escapeHtml(aria)}">
|
|
@@ -713,10 +743,13 @@ function renderHarveyBallVisualizationHtml(visualization, options) {
|
|
|
713
743
|
const tone = visualization.tone ?? 'info';
|
|
714
744
|
const isTable = visualization.surface === 'table-cell';
|
|
715
745
|
const tabIndexAttr = isTable ? '' : ' tabindex="0"';
|
|
746
|
+
const suffix = visualization.valueSuffix ?? '';
|
|
716
747
|
const strokeLength = pct * 0.50265;
|
|
717
748
|
const dashArray = `${strokeLength.toFixed(3)} 50.265`;
|
|
718
749
|
const aria = visualization.ariaLabel ?? `${visualization.fallbackText} (${Math.round(pct)}%)`;
|
|
719
|
-
const
|
|
750
|
+
const formattedValue = formatVisualizationMetricValue(value, options, false, suffix);
|
|
751
|
+
const formattedTotal = formatVisualizationMetricValue(total, options, false, suffix);
|
|
752
|
+
const harveyReadout = `${formattedValue}/${formattedTotal} (${Math.round(pct)}%)`;
|
|
720
753
|
return `
|
|
721
754
|
<span class="pfx-micro-viz pfx-micro-viz__harvey"${tabIndexAttr} data-tone="${escapeHtml(tone)}" data-micro-readout="${escapeHtml(harveyReadout)}" role="img" aria-label="${escapeHtml(aria)}">
|
|
722
755
|
<svg class="pfx-micro-harvey-svg" viewBox="0 0 36 36">
|
|
@@ -724,9 +757,9 @@ function renderHarveyBallVisualizationHtml(visualization, options) {
|
|
|
724
757
|
<circle class="pfx-micro-harvey-svg__bar" cx="18" cy="18" r="8" stroke-dasharray="${dashArray}" transform="rotate(-90 18 18)" />
|
|
725
758
|
</svg>
|
|
726
759
|
<span class="pfx-micro-harvey-fraction">
|
|
727
|
-
<strong>${escapeHtml(
|
|
760
|
+
<strong>${escapeHtml(formattedValue)}</strong>
|
|
728
761
|
<span class="pfx-separator">/</span>
|
|
729
|
-
<span class="pfx-total">${escapeHtml(
|
|
762
|
+
<span class="pfx-total">${escapeHtml(formattedTotal)}</span>
|
|
730
763
|
</span>
|
|
731
764
|
</span>`;
|
|
732
765
|
}
|
|
@@ -775,7 +808,7 @@ function renderTrendScrubLayerHtml(points, coords, width, height, visualization,
|
|
|
775
808
|
? resolvePraxisMicroVisualizationTone(point.value, visualization.thresholds)?.tone ?? defaultTone
|
|
776
809
|
: defaultTone);
|
|
777
810
|
const labelPrefix = point.label ? `${point.label}: ` : `#${index + 1}: `;
|
|
778
|
-
const readout = `${labelPrefix}${
|
|
811
|
+
const readout = `${labelPrefix}${formatVisualizationMetricValue(point.value, options, visualization.compactValue === true, suffix)}`;
|
|
779
812
|
return `<span class="pfx-micro-trend__scrub-slice" data-tone="${escapeHtml(pointTone)}" data-micro-readout="${escapeHtml(readout)}" style="--pfx-scrub-x:${xPct}%;--pfx-scrub-y:${yPct}%;"></span>`;
|
|
780
813
|
})
|
|
781
814
|
.join('');
|
|
@@ -817,14 +850,15 @@ function renderLineVisualizationHtml(visualization, options) {
|
|
|
817
850
|
const isTable = visualization.surface === 'table-cell';
|
|
818
851
|
const firstPoint = points[0];
|
|
819
852
|
const lastPoint = points[points.length - 1];
|
|
853
|
+
const suffix = visualization.valueSuffix ?? '';
|
|
820
854
|
const leftHtml = isTable ? '' : `
|
|
821
855
|
<div class="pfx-micro-trend__label-col pfx-micro-trend__label-col--start">
|
|
822
|
-
<span class="pfx-micro-trend__value">${escapeHtml(
|
|
856
|
+
<span class="pfx-micro-trend__value">${escapeHtml(formatVisualizationMetricValue(firstPoint.value, options, visualization.compactValue === true, suffix))}</span>
|
|
823
857
|
${firstPoint.label ? `<span class="pfx-micro-trend__label">${escapeHtml(firstPoint.label)}</span>` : ''}
|
|
824
858
|
</div>`;
|
|
825
859
|
const rightHtml = isTable ? '' : `
|
|
826
860
|
<div class="pfx-micro-trend__label-col pfx-micro-trend__label-col--end">
|
|
827
|
-
<span class="pfx-micro-trend__value">${escapeHtml(
|
|
861
|
+
<span class="pfx-micro-trend__value">${escapeHtml(formatVisualizationMetricValue(lastPoint.value, options, visualization.compactValue === true, suffix))}</span>
|
|
828
862
|
${lastPoint.label ? `<span class="pfx-micro-trend__label">${escapeHtml(lastPoint.label)}</span>` : ''}
|
|
829
863
|
</div>`;
|
|
830
864
|
return `
|
|
@@ -880,14 +914,15 @@ function renderAreaVisualizationHtml(visualization, options) {
|
|
|
880
914
|
const isTable = visualization.surface === 'table-cell';
|
|
881
915
|
const firstPoint = points[0];
|
|
882
916
|
const lastPoint = points[points.length - 1];
|
|
917
|
+
const suffix = visualization.valueSuffix ?? '';
|
|
883
918
|
const leftHtml = isTable ? '' : `
|
|
884
919
|
<div class="pfx-micro-trend__label-col pfx-micro-trend__label-col--start">
|
|
885
|
-
<span class="pfx-micro-trend__value">${escapeHtml(
|
|
920
|
+
<span class="pfx-micro-trend__value">${escapeHtml(formatVisualizationMetricValue(firstPoint.value, options, visualization.compactValue === true, suffix))}</span>
|
|
886
921
|
${firstPoint.label ? `<span class="pfx-micro-trend__label">${escapeHtml(firstPoint.label)}</span>` : ''}
|
|
887
922
|
</div>`;
|
|
888
923
|
const rightHtml = isTable ? '' : `
|
|
889
924
|
<div class="pfx-micro-trend__label-col pfx-micro-trend__label-col--end">
|
|
890
|
-
<span class="pfx-micro-trend__value">${escapeHtml(
|
|
925
|
+
<span class="pfx-micro-trend__value">${escapeHtml(formatVisualizationMetricValue(lastPoint.value, options, visualization.compactValue === true, suffix))}</span>
|
|
891
926
|
${lastPoint.label ? `<span class="pfx-micro-trend__label">${escapeHtml(lastPoint.label)}</span>` : ''}
|
|
892
927
|
</div>`;
|
|
893
928
|
return `
|
|
@@ -933,14 +968,15 @@ function renderColumnVisualizationHtml(visualization, options) {
|
|
|
933
968
|
const isTable = visualization.surface === 'table-cell';
|
|
934
969
|
const firstPoint = points[0];
|
|
935
970
|
const lastPoint = points[points.length - 1];
|
|
971
|
+
const suffix = visualization.valueSuffix ?? '';
|
|
936
972
|
const leftHtml = isTable ? '' : `
|
|
937
973
|
<div class="pfx-micro-trend__label-col pfx-micro-trend__label-col--start">
|
|
938
|
-
<span class="pfx-micro-trend__value">${escapeHtml(
|
|
974
|
+
<span class="pfx-micro-trend__value">${escapeHtml(formatVisualizationMetricValue(firstPoint.value, options, visualization.compactValue === true, suffix))}</span>
|
|
939
975
|
${firstPoint.label ? `<span class="pfx-micro-trend__label">${escapeHtml(firstPoint.label)}</span>` : ''}
|
|
940
976
|
</div>`;
|
|
941
977
|
const rightHtml = isTable ? '' : `
|
|
942
978
|
<div class="pfx-micro-trend__label-col pfx-micro-trend__label-col--end">
|
|
943
|
-
<span class="pfx-micro-trend__value">${escapeHtml(
|
|
979
|
+
<span class="pfx-micro-trend__value">${escapeHtml(formatVisualizationMetricValue(lastPoint.value, options, visualization.compactValue === true, suffix))}</span>
|
|
944
980
|
${lastPoint.label ? `<span class="pfx-micro-trend__label">${escapeHtml(lastPoint.label)}</span>` : ''}
|
|
945
981
|
</div>`;
|
|
946
982
|
return `
|
|
@@ -980,20 +1016,21 @@ function renderProcessFlowVisualizationHtml(visualization, options) {
|
|
|
980
1016
|
const itemState = item.state ?? '';
|
|
981
1017
|
const isLast = index === items.length - 1;
|
|
982
1018
|
const itemLabel = stepLabels[index];
|
|
1019
|
+
const normalizedIcon = item.icon ? item.icon.replace(/-/g, '_') : undefined;
|
|
983
1020
|
const label = !isTable && item.label ? `<span class="pfx-micro-step__label"${labelInlineStyle}>${escapeHtml(item.label)}</span>` : '';
|
|
984
1021
|
const isActiveStep = itemState === 'active' ||
|
|
985
1022
|
itemState === 'current' ||
|
|
986
1023
|
itemState === 'in_progress' ||
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1024
|
+
normalizedIcon === 'sync' ||
|
|
1025
|
+
normalizedIcon === 'pending' ||
|
|
1026
|
+
normalizedIcon === 'pending_actions' ||
|
|
1027
|
+
normalizedIcon === 'schedule' ||
|
|
991
1028
|
(!itemState && itemTone === 'warning');
|
|
992
1029
|
const stepReadout = `${index + 1}/${items.length} · ${itemLabel}`;
|
|
993
1030
|
const connector = !isLast ? `<span class="pfx-micro-step__connector" data-tone="${escapeHtml(itemTone)}"></span>` : '';
|
|
994
1031
|
const stepCircle = `
|
|
995
1032
|
<span class="pfx-micro-step__node" data-tone="${escapeHtml(itemTone)}"${isActiveStep ? ' data-active="true"' : ''} aria-hidden="true">
|
|
996
|
-
${
|
|
1033
|
+
${normalizedIcon ? `<span class="material-icons pfx-micro-step__icon" aria-hidden="true">${escapeHtml(normalizedIcon)}</span>` : `${index + 1}`}
|
|
997
1034
|
</span>`;
|
|
998
1035
|
return `
|
|
999
1036
|
<div class="pfx-micro-step" data-state="${escapeHtml(itemState)}" data-tone="${escapeHtml(itemTone)}">
|
|
@@ -1019,6 +1056,288 @@ function renderFallbackVisualizationHtml(visualization, tone) {
|
|
|
1019
1056
|
>${escapeHtml(visualization.fallbackText)}</span>`;
|
|
1020
1057
|
}
|
|
1021
1058
|
|
|
1059
|
+
const PRAXIS_QUICK_VIEW_PRESENTER = new InjectionToken('PRAXIS_QUICK_VIEW_PRESENTER');
|
|
1060
|
+
const PRAXIS_QUICK_VIEW_BODY_RENDERER = new InjectionToken('PRAXIS_QUICK_VIEW_BODY_RENDERER');
|
|
1061
|
+
const FORBIDDEN_BINDING_KEYS = new Set([
|
|
1062
|
+
'element',
|
|
1063
|
+
'nativeElement',
|
|
1064
|
+
'anchor',
|
|
1065
|
+
'hostElement',
|
|
1066
|
+
'focusOrigin',
|
|
1067
|
+
'getViewportRect',
|
|
1068
|
+
'nodes',
|
|
1069
|
+
'document',
|
|
1070
|
+
'action',
|
|
1071
|
+
'actions',
|
|
1072
|
+
'ctaAction',
|
|
1073
|
+
'overrideAction',
|
|
1074
|
+
'route',
|
|
1075
|
+
'href',
|
|
1076
|
+
'payload',
|
|
1077
|
+
'hostCapabilities',
|
|
1078
|
+
]);
|
|
1079
|
+
const RESOURCE_KEY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/;
|
|
1080
|
+
/**
|
|
1081
|
+
* Detecta se um valor candidato à serialização contém referências efêmeras de DOM ou funções.
|
|
1082
|
+
*/
|
|
1083
|
+
function containsEphemeralQuickViewRuntimeValue(value, visited = new Set()) {
|
|
1084
|
+
if (!value || typeof value !== 'object') {
|
|
1085
|
+
return typeof value === 'function';
|
|
1086
|
+
}
|
|
1087
|
+
if (visited.has(value)) {
|
|
1088
|
+
return false;
|
|
1089
|
+
}
|
|
1090
|
+
visited.add(value);
|
|
1091
|
+
if (typeof Element !== 'undefined' && value instanceof Element) {
|
|
1092
|
+
return true;
|
|
1093
|
+
}
|
|
1094
|
+
if (typeof value.nodeType === 'number' &&
|
|
1095
|
+
typeof value.nodeName === 'string') {
|
|
1096
|
+
return true;
|
|
1097
|
+
}
|
|
1098
|
+
if (Array.isArray(value)) {
|
|
1099
|
+
return value.some((item) => containsEphemeralQuickViewRuntimeValue(item, visited));
|
|
1100
|
+
}
|
|
1101
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
1102
|
+
if (key === 'element' ||
|
|
1103
|
+
key === 'nativeElement' ||
|
|
1104
|
+
key === 'hostElement' ||
|
|
1105
|
+
key === 'focusOrigin' ||
|
|
1106
|
+
typeof entry === 'function') {
|
|
1107
|
+
return true;
|
|
1108
|
+
}
|
|
1109
|
+
if (containsEphemeralQuickViewRuntimeValue(entry, visited)) {
|
|
1110
|
+
return true;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
return false;
|
|
1114
|
+
}
|
|
1115
|
+
function normalizeResourceRecordOpenReference(candidate) {
|
|
1116
|
+
if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) {
|
|
1117
|
+
return null;
|
|
1118
|
+
}
|
|
1119
|
+
const record = candidate;
|
|
1120
|
+
const target = record['target'] && typeof record['target'] === 'object' && !Array.isArray(record['target'])
|
|
1121
|
+
? record['target']
|
|
1122
|
+
: null;
|
|
1123
|
+
const sourceIdentityField = typeof record['sourceIdentityField'] === 'string'
|
|
1124
|
+
? record['sourceIdentityField'].trim()
|
|
1125
|
+
: '';
|
|
1126
|
+
const resourceKey = typeof target?.['resourceKey'] === 'string'
|
|
1127
|
+
? target['resourceKey'].trim()
|
|
1128
|
+
: '';
|
|
1129
|
+
const surfaceId = typeof target?.['surfaceId'] === 'string'
|
|
1130
|
+
? target['surfaceId'].trim()
|
|
1131
|
+
: '';
|
|
1132
|
+
if (!sourceIdentityField ||
|
|
1133
|
+
sourceIdentityField.length > 200 ||
|
|
1134
|
+
!RESOURCE_KEY_PATTERN.test(resourceKey) ||
|
|
1135
|
+
!surfaceId ||
|
|
1136
|
+
surfaceId.length > 200) {
|
|
1137
|
+
return null;
|
|
1138
|
+
}
|
|
1139
|
+
return {
|
|
1140
|
+
sourceIdentityField,
|
|
1141
|
+
target: {
|
|
1142
|
+
resourceKey,
|
|
1143
|
+
surfaceId,
|
|
1144
|
+
},
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Valida e normaliza um `ResourceQuickViewBinding` de forma fail-closed.
|
|
1149
|
+
*/
|
|
1150
|
+
function validateResourceQuickViewBinding(value) {
|
|
1151
|
+
const diagnostics = [];
|
|
1152
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
1153
|
+
return {
|
|
1154
|
+
valid: false,
|
|
1155
|
+
binding: null,
|
|
1156
|
+
diagnostics: ['Quick View binding must be a non-null object.'],
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
const record = value;
|
|
1160
|
+
for (const forbiddenKey of FORBIDDEN_BINDING_KEYS) {
|
|
1161
|
+
if (forbiddenKey in record && record[forbiddenKey] !== undefined) {
|
|
1162
|
+
diagnostics.push(`Quick View binding cannot contain runtime, inline document or action override property "${forbiddenKey}".`);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
if (containsEphemeralQuickViewRuntimeValue(record)) {
|
|
1166
|
+
diagnostics.push('Quick View binding cannot contain DOM elements or functions.');
|
|
1167
|
+
}
|
|
1168
|
+
const rawRecordOpen = record['recordOpen'];
|
|
1169
|
+
if (!rawRecordOpen || typeof rawRecordOpen !== 'object' || Array.isArray(rawRecordOpen)) {
|
|
1170
|
+
diagnostics.push('Quick View binding requires a valid "recordOpen" object.');
|
|
1171
|
+
}
|
|
1172
|
+
else {
|
|
1173
|
+
const recordOpenObj = rawRecordOpen;
|
|
1174
|
+
for (const forbiddenKey of FORBIDDEN_BINDING_KEYS) {
|
|
1175
|
+
if (forbiddenKey in recordOpenObj && recordOpenObj[forbiddenKey] !== undefined) {
|
|
1176
|
+
diagnostics.push(`Quick View recordOpen cannot contain override property "${forbiddenKey}".`);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
if ('presentation' in recordOpenObj && recordOpenObj['presentation'] === 'popover') {
|
|
1180
|
+
diagnostics.push('Quick View recordOpen cannot declare "popover" presentation.');
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
let detailPresentation;
|
|
1184
|
+
const rawDetailPresentation = record['detailPresentation'];
|
|
1185
|
+
if (rawDetailPresentation !== undefined && rawDetailPresentation !== null) {
|
|
1186
|
+
if (rawDetailPresentation === 'drawer' || rawDetailPresentation === 'modal') {
|
|
1187
|
+
detailPresentation = rawDetailPresentation;
|
|
1188
|
+
}
|
|
1189
|
+
else {
|
|
1190
|
+
diagnostics.push(`Quick View detailPresentation must be "drawer" or "modal"; received "${String(rawDetailPresentation)}".`);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
const normalizedRecordOpen = normalizeResourceRecordOpenReference(rawRecordOpen);
|
|
1194
|
+
if (!normalizedRecordOpen) {
|
|
1195
|
+
diagnostics.push('Quick View recordOpen must declare non-empty sourceIdentityField and target.{resourceKey, surfaceId}.');
|
|
1196
|
+
}
|
|
1197
|
+
let normalizedContentRef;
|
|
1198
|
+
const rawContentRef = record['contentRef'];
|
|
1199
|
+
if (rawContentRef !== undefined && rawContentRef !== null) {
|
|
1200
|
+
if (typeof rawContentRef !== 'object' || Array.isArray(rawContentRef)) {
|
|
1201
|
+
diagnostics.push('Quick View contentRef must be an object reference to a rich-block preset.');
|
|
1202
|
+
}
|
|
1203
|
+
else {
|
|
1204
|
+
const refObj = rawContentRef;
|
|
1205
|
+
const kind = typeof refObj['kind'] === 'string' ? refObj['kind'].trim() : '';
|
|
1206
|
+
const namespace = typeof refObj['namespace'] === 'string' ? refObj['namespace'].trim() : '';
|
|
1207
|
+
const presetId = typeof refObj['presetId'] === 'string' ? refObj['presetId'].trim() : '';
|
|
1208
|
+
const version = typeof refObj['version'] === 'string' ? refObj['version'].trim() : '';
|
|
1209
|
+
if (kind !== 'rich-block') {
|
|
1210
|
+
diagnostics.push(`Quick View contentRef.kind must be "rich-block"; received "${kind || 'empty'}".`);
|
|
1211
|
+
}
|
|
1212
|
+
if (!namespace) {
|
|
1213
|
+
diagnostics.push('Quick View contentRef.namespace must be a non-empty string.');
|
|
1214
|
+
}
|
|
1215
|
+
if (!presetId) {
|
|
1216
|
+
diagnostics.push('Quick View contentRef.presetId must be a non-empty string.');
|
|
1217
|
+
}
|
|
1218
|
+
if (!version) {
|
|
1219
|
+
diagnostics.push('Quick View contentRef.version must be explicitly declared.');
|
|
1220
|
+
}
|
|
1221
|
+
if ('nodes' in refObj || 'inputs' in refObj || 'action' in refObj) {
|
|
1222
|
+
diagnostics.push('Quick View contentRef cannot embed inline nodes, inputs or actions.');
|
|
1223
|
+
}
|
|
1224
|
+
if (kind === 'rich-block' &&
|
|
1225
|
+
namespace &&
|
|
1226
|
+
presetId &&
|
|
1227
|
+
version &&
|
|
1228
|
+
!('nodes' in refObj || 'inputs' in refObj || 'action' in refObj)) {
|
|
1229
|
+
normalizedContentRef = {
|
|
1230
|
+
kind: 'rich-block',
|
|
1231
|
+
namespace,
|
|
1232
|
+
presetId,
|
|
1233
|
+
version,
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
if (diagnostics.length > 0 || !normalizedRecordOpen) {
|
|
1239
|
+
return {
|
|
1240
|
+
valid: false,
|
|
1241
|
+
binding: null,
|
|
1242
|
+
diagnostics,
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
return {
|
|
1246
|
+
valid: true,
|
|
1247
|
+
binding: {
|
|
1248
|
+
recordOpen: normalizedRecordOpen,
|
|
1249
|
+
...(normalizedContentRef ? { contentRef: normalizedContentRef } : {}),
|
|
1250
|
+
...(detailPresentation ? { detailPresentation } : {}),
|
|
1251
|
+
},
|
|
1252
|
+
diagnostics: [],
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
function normalizeResourceQuickViewBinding(value) {
|
|
1256
|
+
return validateResourceQuickViewBinding(value).binding;
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Verifica se a âncora efêmera de runtime permanece conectada e visível na viewport.
|
|
1260
|
+
*/
|
|
1261
|
+
function isResourceQuickViewAnchorValid(anchor) {
|
|
1262
|
+
if (!anchor || typeof anchor !== 'object') {
|
|
1263
|
+
return false;
|
|
1264
|
+
}
|
|
1265
|
+
if (typeof anchor.isValid === 'function' && !anchor.isValid()) {
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1268
|
+
const viewportWidth = typeof window !== 'undefined' && Number.isFinite(window.innerWidth) && window.innerWidth > 0
|
|
1269
|
+
? window.innerWidth
|
|
1270
|
+
: 1920;
|
|
1271
|
+
const viewportHeight = typeof window !== 'undefined' && Number.isFinite(window.innerHeight) && window.innerHeight > 0
|
|
1272
|
+
? window.innerHeight
|
|
1273
|
+
: 1080;
|
|
1274
|
+
if (anchor.kind === 'element') {
|
|
1275
|
+
const el = anchor.element;
|
|
1276
|
+
if (!el || typeof el.getBoundingClientRect !== 'function' || el.isConnected === false) {
|
|
1277
|
+
return false;
|
|
1278
|
+
}
|
|
1279
|
+
const rect = el.getBoundingClientRect();
|
|
1280
|
+
if (!Number.isFinite(rect.left) || !Number.isFinite(rect.top)) {
|
|
1281
|
+
return false;
|
|
1282
|
+
}
|
|
1283
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
1284
|
+
return false;
|
|
1285
|
+
}
|
|
1286
|
+
return (rect.bottom >= 0 &&
|
|
1287
|
+
rect.right >= 0 &&
|
|
1288
|
+
rect.top <= viewportHeight &&
|
|
1289
|
+
rect.left <= viewportWidth);
|
|
1290
|
+
}
|
|
1291
|
+
if (anchor.kind === 'virtual-rect') {
|
|
1292
|
+
if (!anchor.anchorKey || !anchor.anchorKey.trim()) {
|
|
1293
|
+
return false;
|
|
1294
|
+
}
|
|
1295
|
+
if (anchor.hostElement && anchor.hostElement.isConnected === false) {
|
|
1296
|
+
return false;
|
|
1297
|
+
}
|
|
1298
|
+
if (typeof anchor.getViewportRect !== 'function') {
|
|
1299
|
+
return false;
|
|
1300
|
+
}
|
|
1301
|
+
const rect = anchor.getViewportRect();
|
|
1302
|
+
if (!rect ||
|
|
1303
|
+
!Number.isFinite(rect.x) ||
|
|
1304
|
+
!Number.isFinite(rect.y) ||
|
|
1305
|
+
!Number.isFinite(rect.width) ||
|
|
1306
|
+
!Number.isFinite(rect.height) ||
|
|
1307
|
+
rect.width < 0 ||
|
|
1308
|
+
rect.height < 0) {
|
|
1309
|
+
return false;
|
|
1310
|
+
}
|
|
1311
|
+
const right = rect.right ?? rect.x + rect.width;
|
|
1312
|
+
const bottom = rect.bottom ?? rect.y + rect.height;
|
|
1313
|
+
const left = rect.left ?? rect.x;
|
|
1314
|
+
const top = rect.top ?? rect.y;
|
|
1315
|
+
return (bottom >= 0 &&
|
|
1316
|
+
right >= 0 &&
|
|
1317
|
+
top <= viewportHeight &&
|
|
1318
|
+
left <= viewportWidth);
|
|
1319
|
+
}
|
|
1320
|
+
return false;
|
|
1321
|
+
}
|
|
1322
|
+
function resolveQuickViewAnchorKey(anchor) {
|
|
1323
|
+
if (anchor.kind === 'virtual-rect') {
|
|
1324
|
+
return anchor.anchorKey.trim();
|
|
1325
|
+
}
|
|
1326
|
+
const explicit = anchor.anchorKey?.trim();
|
|
1327
|
+
if (explicit) {
|
|
1328
|
+
return explicit;
|
|
1329
|
+
}
|
|
1330
|
+
const focusKey = anchor.element?.getAttribute?.('data-praxis-focus-key')?.trim();
|
|
1331
|
+
if (focusKey) {
|
|
1332
|
+
return focusKey;
|
|
1333
|
+
}
|
|
1334
|
+
const id = anchor.element?.id?.trim();
|
|
1335
|
+
if (id) {
|
|
1336
|
+
return `element:${id}`;
|
|
1337
|
+
}
|
|
1338
|
+
return 'element:anonymous';
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1022
1341
|
const TONES = new Set([
|
|
1023
1342
|
'neutral',
|
|
1024
1343
|
'info',
|
|
@@ -1145,11 +1464,13 @@ function normalizeText(value) {
|
|
|
1145
1464
|
return trimmed.length ? trimmed : undefined;
|
|
1146
1465
|
}
|
|
1147
1466
|
function normalizeInteractions(value) {
|
|
1467
|
+
const quickView = normalizeResourceQuickViewBinding(value.quickView);
|
|
1148
1468
|
return {
|
|
1149
1469
|
...(value.copy === true ? { copy: true } : {}),
|
|
1150
1470
|
...(value.details === true ? { details: true } : {}),
|
|
1151
1471
|
...(value.expand === true ? { expand: true } : {}),
|
|
1152
1472
|
...(value.link === true ? { link: true } : {}),
|
|
1473
|
+
...(quickView ? { quickView } : {}),
|
|
1153
1474
|
};
|
|
1154
1475
|
}
|
|
1155
1476
|
|
|
@@ -1401,6 +1722,33 @@ class SchemaNormalizationKernel {
|
|
|
1401
1722
|
}
|
|
1402
1723
|
return false;
|
|
1403
1724
|
}
|
|
1725
|
+
parseOptionalBoolean(value) {
|
|
1726
|
+
if (typeof value === 'boolean') {
|
|
1727
|
+
return value;
|
|
1728
|
+
}
|
|
1729
|
+
if (typeof value === 'string') {
|
|
1730
|
+
const normalized = value.trim().toLowerCase();
|
|
1731
|
+
if (normalized === 'true') {
|
|
1732
|
+
return true;
|
|
1733
|
+
}
|
|
1734
|
+
if (normalized === 'false') {
|
|
1735
|
+
return false;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
return undefined;
|
|
1739
|
+
}
|
|
1740
|
+
parseOptionalFiniteNumber(value) {
|
|
1741
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
1742
|
+
return value;
|
|
1743
|
+
}
|
|
1744
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
1745
|
+
const parsed = Number(value);
|
|
1746
|
+
if (Number.isFinite(parsed)) {
|
|
1747
|
+
return parsed;
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
return undefined;
|
|
1751
|
+
}
|
|
1404
1752
|
/** Ensure an array of strings from various inputs. */
|
|
1405
1753
|
parseStringArray(value) {
|
|
1406
1754
|
if (Array.isArray(value)) {
|
|
@@ -2710,6 +3058,55 @@ class SchemaNormalizationKernel {
|
|
|
2710
3058
|
if (ui.buttons !== undefined) {
|
|
2711
3059
|
field.buttons = this.parseButtons(ui.buttons);
|
|
2712
3060
|
}
|
|
3061
|
+
if (ui.valueLabelDisplay !== undefined) {
|
|
3062
|
+
const normalizedValueLabelDisplay = typeof ui.valueLabelDisplay === 'string'
|
|
3063
|
+
? ui.valueLabelDisplay.trim().toLowerCase()
|
|
3064
|
+
: '';
|
|
3065
|
+
if (normalizedValueLabelDisplay === 'off' ||
|
|
3066
|
+
normalizedValueLabelDisplay === 'auto' ||
|
|
3067
|
+
normalizedValueLabelDisplay === 'on') {
|
|
3068
|
+
field.valueLabelDisplay = normalizedValueLabelDisplay;
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
const sliderBooleanKeys = [
|
|
3072
|
+
'thumbLabel',
|
|
3073
|
+
'discrete',
|
|
3074
|
+
'showInputs',
|
|
3075
|
+
'disableThumbSwap',
|
|
3076
|
+
'vertical',
|
|
3077
|
+
'invert',
|
|
3078
|
+
];
|
|
3079
|
+
for (const key of sliderBooleanKeys) {
|
|
3080
|
+
if (ui[key] !== undefined) {
|
|
3081
|
+
const parsed = this.parseOptionalBoolean(ui[key]);
|
|
3082
|
+
if (parsed !== undefined) {
|
|
3083
|
+
field[key] = parsed;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
if (ui.showTicks !== undefined) {
|
|
3088
|
+
const parsedTicks = this.parseOptionalBoolean(ui.showTicks);
|
|
3089
|
+
if (parsedTicks !== undefined) {
|
|
3090
|
+
field.showTicks = parsedTicks;
|
|
3091
|
+
}
|
|
3092
|
+
else if (typeof ui.showTicks === 'string' &&
|
|
3093
|
+
ui.showTicks.trim().toLowerCase() === 'auto') {
|
|
3094
|
+
field.showTicks = 'auto';
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
const sliderNumberKeys = [
|
|
3098
|
+
'shiftStep',
|
|
3099
|
+
'minDistance',
|
|
3100
|
+
'maxDistance',
|
|
3101
|
+
];
|
|
3102
|
+
for (const key of sliderNumberKeys) {
|
|
3103
|
+
if (ui[key] !== undefined) {
|
|
3104
|
+
const parsed = this.parseOptionalFiniteNumber(ui[key]);
|
|
3105
|
+
if (parsed !== undefined) {
|
|
3106
|
+
field[key] = parsed;
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
2713
3110
|
// -------------------------------------------------------------------
|
|
2714
3111
|
// Inline filter and specialized control metadata (x-ui)
|
|
2715
3112
|
// -------------------------------------------------------------------
|
|
@@ -2746,7 +3143,6 @@ class SchemaNormalizationKernel {
|
|
|
2746
3143
|
'defaultGranularity',
|
|
2747
3144
|
'selectionGrid',
|
|
2748
3145
|
'showSlider',
|
|
2749
|
-
'showInputs',
|
|
2750
3146
|
'minPeriod',
|
|
2751
3147
|
'maxPeriod',
|
|
2752
3148
|
'minYear',
|
|
@@ -2784,8 +3180,8 @@ class SchemaNormalizationKernel {
|
|
|
2784
3180
|
'marks',
|
|
2785
3181
|
'semanticBands',
|
|
2786
3182
|
'distribution',
|
|
2787
|
-
'
|
|
2788
|
-
'
|
|
3183
|
+
'inlineDistribution',
|
|
3184
|
+
'track',
|
|
2789
3185
|
'trueLabel',
|
|
2790
3186
|
'falseLabel',
|
|
2791
3187
|
'labelTrue',
|
|
@@ -3021,6 +3417,7 @@ function buildBaseColumnFromDef(def) {
|
|
|
3021
3417
|
const format = resolveFormatFromFieldDefinition(def, type);
|
|
3022
3418
|
const valueMapping = resolveSchemaValueMappingFromFieldDefinition(def);
|
|
3023
3419
|
const renderer = resolveRendererFromFieldDefinition(def);
|
|
3420
|
+
const quickView = resolveQuickViewFromFieldDefinition(def);
|
|
3024
3421
|
const isAvatar = renderer?.type === 'avatar';
|
|
3025
3422
|
const explicitWidth = firstNonEmptyString(def.width);
|
|
3026
3423
|
return {
|
|
@@ -3037,6 +3434,7 @@ function buildBaseColumnFromDef(def) {
|
|
|
3037
3434
|
...(format ? { format } : {}),
|
|
3038
3435
|
...(valueMapping ? { valueMapping } : {}),
|
|
3039
3436
|
...(renderer ? { renderer } : {}),
|
|
3437
|
+
...(quickView ? { quickView } : {}),
|
|
3040
3438
|
};
|
|
3041
3439
|
}
|
|
3042
3440
|
function applyLocalCustomizations(baseCol, localCol) {
|
|
@@ -3063,11 +3461,19 @@ function applyLocalCustomizations(baseCol, localCol) {
|
|
|
3063
3461
|
result.headerStyle = localCol.headerStyle ?? baseCol.headerStyle;
|
|
3064
3462
|
result.cssClass = localCol.cssClass ?? baseCol.cssClass;
|
|
3065
3463
|
result.headerCssClass = localCol.headerCssClass ?? baseCol.headerCssClass;
|
|
3464
|
+
const resolvedQuickView = normalizeResourceQuickViewBinding(localCol.quickView) ??
|
|
3465
|
+
normalizeResourceQuickViewBinding(baseCol.quickView);
|
|
3466
|
+
if (resolvedQuickView) {
|
|
3467
|
+
result.quickView = resolvedQuickView;
|
|
3468
|
+
}
|
|
3469
|
+
else {
|
|
3470
|
+
delete result.quickView;
|
|
3471
|
+
}
|
|
3066
3472
|
// If server type changed, drop potentially incompatible formatting/renderers.
|
|
3067
3473
|
if (!typeChanged) {
|
|
3068
3474
|
result.format = localCol.format ?? baseCol.format;
|
|
3069
3475
|
result.valueMapping = localCol.valueMapping ?? baseCol.valueMapping;
|
|
3070
|
-
result.renderer = localCol.renderer ?? baseCol.renderer;
|
|
3476
|
+
result.renderer = normalizeColumnRendererQuickView(localCol.renderer ?? baseCol.renderer);
|
|
3071
3477
|
}
|
|
3072
3478
|
else {
|
|
3073
3479
|
// Drop local presentation that may be incompatible with the new server type,
|
|
@@ -3312,6 +3718,114 @@ function humanizeSchemaEnumValue(value) {
|
|
|
3312
3718
|
.map((part, index) => (index === 0 ? `${part.charAt(0).toUpperCase()}${part.slice(1)}` : part))
|
|
3313
3719
|
.join(' ');
|
|
3314
3720
|
}
|
|
3721
|
+
function resolveQuickViewFromFieldDefinition(def) {
|
|
3722
|
+
return (normalizeResourceQuickViewBinding(def.quickView) ??
|
|
3723
|
+
normalizeResourceQuickViewBinding(def.presentation?.interactions?.quickView) ??
|
|
3724
|
+
normalizeResourceQuickViewBinding(def['extraProperties'] && typeof def['extraProperties'] === 'object' ? def['extraProperties']['quickView'] : undefined) ??
|
|
3725
|
+
undefined);
|
|
3726
|
+
}
|
|
3727
|
+
function normalizeColumnRendererQuickView(renderer) {
|
|
3728
|
+
if (!renderer || typeof renderer !== 'object') {
|
|
3729
|
+
return renderer;
|
|
3730
|
+
}
|
|
3731
|
+
const next = { ...renderer };
|
|
3732
|
+
if (next.link && typeof next.link === 'object') {
|
|
3733
|
+
const qv = normalizeResourceQuickViewBinding(next.link.quickView);
|
|
3734
|
+
next.link = { ...next.link };
|
|
3735
|
+
if (qv) {
|
|
3736
|
+
next.link.quickView = qv;
|
|
3737
|
+
}
|
|
3738
|
+
else {
|
|
3739
|
+
delete next.link.quickView;
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
if (next.badge && typeof next.badge === 'object') {
|
|
3743
|
+
const qv = normalizeResourceQuickViewBinding(next.badge.quickView);
|
|
3744
|
+
next.badge = { ...next.badge };
|
|
3745
|
+
if (qv) {
|
|
3746
|
+
next.badge.quickView = qv;
|
|
3747
|
+
}
|
|
3748
|
+
else {
|
|
3749
|
+
delete next.badge.quickView;
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
if (next.chip && typeof next.chip === 'object') {
|
|
3753
|
+
const qv = normalizeResourceQuickViewBinding(next.chip.quickView);
|
|
3754
|
+
next.chip = { ...next.chip };
|
|
3755
|
+
if (qv) {
|
|
3756
|
+
next.chip.quickView = qv;
|
|
3757
|
+
}
|
|
3758
|
+
else {
|
|
3759
|
+
delete next.chip.quickView;
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
if (next.icon && typeof next.icon === 'object') {
|
|
3763
|
+
const qv = normalizeResourceQuickViewBinding(next.icon.quickView);
|
|
3764
|
+
next.icon = { ...next.icon };
|
|
3765
|
+
if (qv) {
|
|
3766
|
+
next.icon.quickView = qv;
|
|
3767
|
+
}
|
|
3768
|
+
else {
|
|
3769
|
+
delete next.icon.quickView;
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
if (next.compose && typeof next.compose === 'object' && Array.isArray(next.compose.items)) {
|
|
3773
|
+
next.compose = {
|
|
3774
|
+
...next.compose,
|
|
3775
|
+
items: next.compose.items.map((item) => {
|
|
3776
|
+
if (!item || typeof item !== 'object')
|
|
3777
|
+
return item;
|
|
3778
|
+
if (item.type === 'value') {
|
|
3779
|
+
const qv = normalizeResourceQuickViewBinding(item.quickView);
|
|
3780
|
+
const cloned = { ...item };
|
|
3781
|
+
if (qv)
|
|
3782
|
+
cloned.quickView = qv;
|
|
3783
|
+
else
|
|
3784
|
+
delete cloned.quickView;
|
|
3785
|
+
return cloned;
|
|
3786
|
+
}
|
|
3787
|
+
if (item.type === 'link' && item.link) {
|
|
3788
|
+
const qv = normalizeResourceQuickViewBinding(item.link.quickView);
|
|
3789
|
+
const link = { ...item.link };
|
|
3790
|
+
if (qv)
|
|
3791
|
+
link.quickView = qv;
|
|
3792
|
+
else
|
|
3793
|
+
delete link.quickView;
|
|
3794
|
+
return { ...item, link };
|
|
3795
|
+
}
|
|
3796
|
+
if (item.type === 'badge' && item.badge) {
|
|
3797
|
+
const qv = normalizeResourceQuickViewBinding(item.badge.quickView);
|
|
3798
|
+
const badge = { ...item.badge };
|
|
3799
|
+
if (qv)
|
|
3800
|
+
badge.quickView = qv;
|
|
3801
|
+
else
|
|
3802
|
+
delete badge.quickView;
|
|
3803
|
+
return { ...item, badge };
|
|
3804
|
+
}
|
|
3805
|
+
if (item.type === 'chip' && item.chip) {
|
|
3806
|
+
const qv = normalizeResourceQuickViewBinding(item.chip.quickView);
|
|
3807
|
+
const chip = { ...item.chip };
|
|
3808
|
+
if (qv)
|
|
3809
|
+
chip.quickView = qv;
|
|
3810
|
+
else
|
|
3811
|
+
delete chip.quickView;
|
|
3812
|
+
return { ...item, chip };
|
|
3813
|
+
}
|
|
3814
|
+
if (item.type === 'icon' && item.icon) {
|
|
3815
|
+
const qv = normalizeResourceQuickViewBinding(item.icon.quickView);
|
|
3816
|
+
const icon = { ...item.icon };
|
|
3817
|
+
if (qv)
|
|
3818
|
+
icon.quickView = qv;
|
|
3819
|
+
else
|
|
3820
|
+
delete icon.quickView;
|
|
3821
|
+
return { ...item, icon };
|
|
3822
|
+
}
|
|
3823
|
+
return item;
|
|
3824
|
+
}),
|
|
3825
|
+
};
|
|
3826
|
+
}
|
|
3827
|
+
return next;
|
|
3828
|
+
}
|
|
3315
3829
|
function resolveRendererFromFieldDefinition(def) {
|
|
3316
3830
|
const presentationRenderer = resolveRendererFromFieldPresentation(def);
|
|
3317
3831
|
if (presentationRenderer)
|