@praxisui/core 10.0.0-rc.58 → 10.0.0-rc.59
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 +26 -1
- package/ai/component-registry.json +2 -2
- package/fesm2022/praxisui-core-schema.mjs +970 -63
- package/fesm2022/praxisui-core.mjs +4437 -968
- package/package.json +1 -1
- package/types/praxisui-core-schema.d.ts +294 -0
- package/types/praxisui-core.d.ts +4484 -3882
|
@@ -2505,6 +2505,368 @@ function isScalarEnum(value) {
|
|
|
2505
2505
|
return Array.isArray(value) && value.length > 0 && value.every(item => item === null || typeof item === 'string' || typeof item === 'boolean' || typeof item === 'number' && Number.isFinite(item));
|
|
2506
2506
|
}
|
|
2507
2507
|
|
|
2508
|
+
/**
|
|
2509
|
+
* Enum que define os tipos de controle (`CONTROL_TYPE`) disponíveis para a apresentação dos campos de formulário.
|
|
2510
|
+
*
|
|
2511
|
+
* O `CONTROL_TYPE` especifica o tipo de elemento de UI (User Interface) que será usado para capturar ou exibir dados do campo.
|
|
2512
|
+
* Essa configuração permite que a camada de apresentação saiba como renderizar o campo e oferecer a interação adequada ao usuário.
|
|
2513
|
+
* Em casos onde o `CONTROL_TYPE` não é especificado, a camada de apresentação pode usar o valor de `TYPE` (definido em `FieldDataType`)
|
|
2514
|
+
* para decidir o controle mais adequado de forma automática.
|
|
2515
|
+
*/
|
|
2516
|
+
const FieldControlType = {
|
|
2517
|
+
AI_PROMPT: 'aiPrompt',
|
|
2518
|
+
APP_BAR: 'appBar',
|
|
2519
|
+
ARC_GAUGE: 'arcGauge',
|
|
2520
|
+
ARRAY_INPUT: 'array',
|
|
2521
|
+
ASYNC_SELECT: 'async-select',
|
|
2522
|
+
AUTO_COMPLETE: 'autoComplete',
|
|
2523
|
+
AVATAR: 'avatar',
|
|
2524
|
+
BARCODE_GENERATOR: 'barcodeGenerator',
|
|
2525
|
+
BOTTOM_NAVIGATION: 'bottomNavigation',
|
|
2526
|
+
BREADCRUMB: 'breadcrumb',
|
|
2527
|
+
BUTTON: 'button',
|
|
2528
|
+
BUTTON_TOGGLE: 'buttonToggle',
|
|
2529
|
+
CALENDAR: 'calendar',
|
|
2530
|
+
CARD: 'card',
|
|
2531
|
+
CHECKBOX: 'checkbox',
|
|
2532
|
+
CHIP_INPUT: 'chipInput',
|
|
2533
|
+
CHIP_LIST: 'chipList',
|
|
2534
|
+
CIRCULAR_GAUGE: 'circularGauge',
|
|
2535
|
+
COLOR_GRADIENT: 'colorGradient',
|
|
2536
|
+
CPF_CNPJ_INPUT: 'cpfCnpjInput',
|
|
2537
|
+
COLOR_PALETTE: 'colorPalette',
|
|
2538
|
+
COLOR_PICKER: 'colorPicker',
|
|
2539
|
+
COLOR_INPUT: 'color',
|
|
2540
|
+
CRON_BUILDER: 'cronBuilder',
|
|
2541
|
+
CONTEXT_MENU: 'contextMenu',
|
|
2542
|
+
CONVERSATIONAL_UI: 'conversationalUI',
|
|
2543
|
+
CURRENCY_INPUT: 'currency',
|
|
2544
|
+
DATE_INPUT: 'dateInput',
|
|
2545
|
+
DATE_PICKER: 'date',
|
|
2546
|
+
DATE_RANGE: 'dateRange',
|
|
2547
|
+
DATE_TIME_PICKER: 'dateTime',
|
|
2548
|
+
DATE_TIME_RANGE: 'dateTimeRange',
|
|
2549
|
+
DATETIME_LOCAL_INPUT: 'dateTimeLocal',
|
|
2550
|
+
DIALOG: 'dialog',
|
|
2551
|
+
DRAWER: 'drawer',
|
|
2552
|
+
DROP_DOWN_TREE: 'dropDownTree',
|
|
2553
|
+
EMAIL_INPUT: 'email',
|
|
2554
|
+
ENTITY_LOOKUP: 'entityLookup',
|
|
2555
|
+
EXPANSION_PANEL: 'expansionPanel',
|
|
2556
|
+
FILE_SAVER: 'fileSaver',
|
|
2557
|
+
FILE_SELECT: 'fileSelect',
|
|
2558
|
+
FILE_UPLOAD: 'upload',
|
|
2559
|
+
FILTER: 'filter',
|
|
2560
|
+
FLOATING_LABEL: 'floatingLabel',
|
|
2561
|
+
FLOATING_ACTION_BUTTON: 'floatingActionButton',
|
|
2562
|
+
GRID: 'grid',
|
|
2563
|
+
GRID_LAYOUT: 'gridLayout',
|
|
2564
|
+
INPUT: 'input',
|
|
2565
|
+
INLINE_SELECT: 'inlineSelect',
|
|
2566
|
+
INLINE_SEARCHABLE_SELECT: 'inlineSearchableSelect',
|
|
2567
|
+
INLINE_ASYNC_SELECT: 'inlineAsyncSelect',
|
|
2568
|
+
INLINE_ENTITY_LOOKUP: 'inlineEntityLookup',
|
|
2569
|
+
INLINE_AUTOCOMPLETE: 'inlineAutocomplete',
|
|
2570
|
+
INLINE_INPUT: 'inlineInput',
|
|
2571
|
+
INLINE_PHONE: 'inlinePhone',
|
|
2572
|
+
INLINE_NUMBER: 'inlineNumber',
|
|
2573
|
+
INLINE_CURRENCY: 'inlineCurrency',
|
|
2574
|
+
INLINE_CURRENCY_RANGE: 'inlineCurrencyRange',
|
|
2575
|
+
INLINE_MULTISELECT: 'inlineMultiSelect',
|
|
2576
|
+
INLINE_TOGGLE: 'inlineToggle',
|
|
2577
|
+
INLINE_RANGE: 'inlineRange',
|
|
2578
|
+
INLINE_PERIOD_RANGE: 'inlinePeriodRange',
|
|
2579
|
+
INLINE_YEAR_RANGE: 'inlineYearRange',
|
|
2580
|
+
INLINE_MONTH_RANGE: 'inlineMonthRange',
|
|
2581
|
+
INLINE_DATE: 'inlineDate',
|
|
2582
|
+
INLINE_DATE_RANGE: 'inlineDateRange',
|
|
2583
|
+
INLINE_TIME: 'inlineTime',
|
|
2584
|
+
INLINE_TIME_RANGE: 'inlineTimeRange',
|
|
2585
|
+
INLINE_TREE_SELECT: 'inlineTreeSelect',
|
|
2586
|
+
INLINE_RATING: 'inlineRating',
|
|
2587
|
+
INLINE_DISTANCE_RADIUS: 'inlineDistanceRadius',
|
|
2588
|
+
INLINE_PIPELINE_STATUS: 'inlinePipelineStatus',
|
|
2589
|
+
INLINE_SCORE_PRIORITY: 'inlineScorePriority',
|
|
2590
|
+
INLINE_RELATIVE_PERIOD: 'inlineRelativePeriod',
|
|
2591
|
+
INLINE_SENTIMENT: 'inlineSentiment',
|
|
2592
|
+
INLINE_COLOR_LABEL: 'inlineColorLabel',
|
|
2593
|
+
LINEAR_GAUGE: 'linearGauge',
|
|
2594
|
+
LIST_VIEW: 'listView',
|
|
2595
|
+
MAP: 'map',
|
|
2596
|
+
MASKED_TEXT_BOX: 'maskedTextBox',
|
|
2597
|
+
MONTH_INPUT: 'month',
|
|
2598
|
+
MULTI_COLUMN_COMBO_BOX: 'multiColumnComboBox',
|
|
2599
|
+
MULTI_SELECT: 'multiSelect',
|
|
2600
|
+
MULTI_SELECT_TREE: 'multiSelectTree',
|
|
2601
|
+
TRANSFER_LIST: 'transferList',
|
|
2602
|
+
NOTIFICATION: 'notification',
|
|
2603
|
+
NUMERIC_TEXT_BOX: 'numericTextBox',
|
|
2604
|
+
PAGER: 'pager',
|
|
2605
|
+
PAGINATOR: 'paginator',
|
|
2606
|
+
PASSWORD: 'password',
|
|
2607
|
+
PDF_VIEWER: 'pdfViewer',
|
|
2608
|
+
PHONE: 'phone',
|
|
2609
|
+
PIVOT_GRID: 'pivotGrid',
|
|
2610
|
+
POPUP: 'popup',
|
|
2611
|
+
PROGRESS_BAR: 'progressBar',
|
|
2612
|
+
PROGRESS_SPINNER: 'progressSpinner',
|
|
2613
|
+
QR_CODE: 'qrCode',
|
|
2614
|
+
RADIO: 'radio',
|
|
2615
|
+
RADIAL_GAUGE: 'radialGauge',
|
|
2616
|
+
RANGE_SLIDER: 'rangeSlider',
|
|
2617
|
+
PRICE_RANGE: 'priceRange',
|
|
2618
|
+
RATING: 'rating',
|
|
2619
|
+
RICH_TEXT_EDITOR: 'richTextEditor',
|
|
2620
|
+
RIPPLE: 'ripple',
|
|
2621
|
+
SCROLL_VIEW: 'scrollView',
|
|
2622
|
+
SEARCH_INPUT: 'search',
|
|
2623
|
+
SEARCHABLE_SELECT: 'searchable-select',
|
|
2624
|
+
SELECTION_LIST: 'selectionList',
|
|
2625
|
+
SELECT: 'select',
|
|
2626
|
+
SIGNATURE: 'signature',
|
|
2627
|
+
SLIDER: 'slider',
|
|
2628
|
+
SORTABLE: 'sortable',
|
|
2629
|
+
SORTABLE_TABLE: 'sortableTable',
|
|
2630
|
+
SPLITTER: 'splitter',
|
|
2631
|
+
SPREADSHEET: 'spreadsheet',
|
|
2632
|
+
STACK_LAYOUT: 'stackLayout',
|
|
2633
|
+
STEP_BAR: 'stepBar',
|
|
2634
|
+
STEPPER: 'stepper',
|
|
2635
|
+
SVG_ICON: 'svgIcon',
|
|
2636
|
+
TABS: 'tabs',
|
|
2637
|
+
TEXTAREA: 'textarea',
|
|
2638
|
+
TIME_INPUT: 'time',
|
|
2639
|
+
TIME_PICKER: 'timePicker',
|
|
2640
|
+
TIME_RANGE: 'timeRange',
|
|
2641
|
+
TIMELINE: 'timeline',
|
|
2642
|
+
TOGGLE: 'toggle',
|
|
2643
|
+
TOOLBAR: 'toolbar',
|
|
2644
|
+
TOOLTIP: 'tooltip',
|
|
2645
|
+
TREE_VIEW: 'treeView',
|
|
2646
|
+
TREE_SELECT: 'treeSelect',
|
|
2647
|
+
TYPOGRAPHY: 'typography',
|
|
2648
|
+
URL_INPUT: 'url',
|
|
2649
|
+
WEEK_INPUT: 'week',
|
|
2650
|
+
WINDOW: 'window',
|
|
2651
|
+
YEAR_INPUT: 'year',
|
|
2652
|
+
};
|
|
2653
|
+
|
|
2654
|
+
const INLINE_FILTER_CONTROL_TYPES = Object.freeze({
|
|
2655
|
+
SELECT: FieldControlType.INLINE_SELECT,
|
|
2656
|
+
SEARCHABLE_SELECT: FieldControlType.INLINE_SEARCHABLE_SELECT,
|
|
2657
|
+
ASYNC_SELECT: FieldControlType.INLINE_ASYNC_SELECT,
|
|
2658
|
+
ENTITY_LOOKUP: FieldControlType.INLINE_ENTITY_LOOKUP,
|
|
2659
|
+
AUTOCOMPLETE: FieldControlType.INLINE_AUTOCOMPLETE,
|
|
2660
|
+
NUMBER: FieldControlType.INLINE_NUMBER,
|
|
2661
|
+
CURRENCY: FieldControlType.INLINE_CURRENCY,
|
|
2662
|
+
CURRENCY_RANGE: FieldControlType.INLINE_CURRENCY_RANGE,
|
|
2663
|
+
MULTI_SELECT: FieldControlType.INLINE_MULTISELECT,
|
|
2664
|
+
INPUT: FieldControlType.INLINE_INPUT,
|
|
2665
|
+
PHONE: FieldControlType.INLINE_PHONE,
|
|
2666
|
+
TOGGLE: FieldControlType.INLINE_TOGGLE,
|
|
2667
|
+
RANGE: FieldControlType.INLINE_RANGE,
|
|
2668
|
+
PERIOD_RANGE: FieldControlType.INLINE_PERIOD_RANGE,
|
|
2669
|
+
YEAR_RANGE: FieldControlType.INLINE_YEAR_RANGE,
|
|
2670
|
+
MONTH_RANGE: FieldControlType.INLINE_MONTH_RANGE,
|
|
2671
|
+
DATE: FieldControlType.INLINE_DATE,
|
|
2672
|
+
DATE_RANGE: FieldControlType.INLINE_DATE_RANGE,
|
|
2673
|
+
TIME: FieldControlType.INLINE_TIME,
|
|
2674
|
+
TIME_RANGE: FieldControlType.INLINE_TIME_RANGE,
|
|
2675
|
+
TREE_SELECT: FieldControlType.INLINE_TREE_SELECT,
|
|
2676
|
+
RATING: FieldControlType.INLINE_RATING,
|
|
2677
|
+
DISTANCE_RADIUS: FieldControlType.INLINE_DISTANCE_RADIUS,
|
|
2678
|
+
PIPELINE_STATUS: FieldControlType.INLINE_PIPELINE_STATUS,
|
|
2679
|
+
SCORE_PRIORITY: FieldControlType.INLINE_SCORE_PRIORITY,
|
|
2680
|
+
RELATIVE_PERIOD: FieldControlType.INLINE_RELATIVE_PERIOD,
|
|
2681
|
+
SENTIMENT: FieldControlType.INLINE_SENTIMENT,
|
|
2682
|
+
COLOR_LABEL: FieldControlType.INLINE_COLOR_LABEL,
|
|
2683
|
+
});
|
|
2684
|
+
const INLINE_FILTER_CONTROL_TYPE_VALUES = Object.freeze(Object.values(INLINE_FILTER_CONTROL_TYPES));
|
|
2685
|
+
const INLINE_FILTER_CONTROL_TYPE_SET = new Set(INLINE_FILTER_CONTROL_TYPE_VALUES);
|
|
2686
|
+
function normalizeInlineControlTypeToken(value) {
|
|
2687
|
+
return String(value || '')
|
|
2688
|
+
.trim()
|
|
2689
|
+
.toLowerCase()
|
|
2690
|
+
.replace(/[-_\s]/g, '');
|
|
2691
|
+
}
|
|
2692
|
+
const INLINE_FILTER_CANONICAL_TOKEN_TO_CONTROL_TYPE_MAP = {
|
|
2693
|
+
inlineselect: INLINE_FILTER_CONTROL_TYPES.SELECT,
|
|
2694
|
+
inlinesearchableselect: INLINE_FILTER_CONTROL_TYPES.SEARCHABLE_SELECT,
|
|
2695
|
+
inlineasyncselect: INLINE_FILTER_CONTROL_TYPES.ASYNC_SELECT,
|
|
2696
|
+
inlineentitylookup: INLINE_FILTER_CONTROL_TYPES.ENTITY_LOOKUP,
|
|
2697
|
+
inlineautocomplete: INLINE_FILTER_CONTROL_TYPES.AUTOCOMPLETE,
|
|
2698
|
+
inlinenumber: INLINE_FILTER_CONTROL_TYPES.NUMBER,
|
|
2699
|
+
inlinecurrency: INLINE_FILTER_CONTROL_TYPES.CURRENCY,
|
|
2700
|
+
inlinecurrencyrange: INLINE_FILTER_CONTROL_TYPES.CURRENCY_RANGE,
|
|
2701
|
+
inlinemultiselect: INLINE_FILTER_CONTROL_TYPES.MULTI_SELECT,
|
|
2702
|
+
inlineinput: INLINE_FILTER_CONTROL_TYPES.INPUT,
|
|
2703
|
+
inlinephone: INLINE_FILTER_CONTROL_TYPES.PHONE,
|
|
2704
|
+
inlinetoggle: INLINE_FILTER_CONTROL_TYPES.TOGGLE,
|
|
2705
|
+
inlinerange: INLINE_FILTER_CONTROL_TYPES.RANGE,
|
|
2706
|
+
inlineperiodrange: INLINE_FILTER_CONTROL_TYPES.PERIOD_RANGE,
|
|
2707
|
+
inlineyearrange: INLINE_FILTER_CONTROL_TYPES.YEAR_RANGE,
|
|
2708
|
+
inlinemonthrange: INLINE_FILTER_CONTROL_TYPES.MONTH_RANGE,
|
|
2709
|
+
inlinedate: INLINE_FILTER_CONTROL_TYPES.DATE,
|
|
2710
|
+
inlinedaterange: INLINE_FILTER_CONTROL_TYPES.DATE_RANGE,
|
|
2711
|
+
inlinetime: INLINE_FILTER_CONTROL_TYPES.TIME,
|
|
2712
|
+
inlinetimerange: INLINE_FILTER_CONTROL_TYPES.TIME_RANGE,
|
|
2713
|
+
inlinetreeselect: INLINE_FILTER_CONTROL_TYPES.TREE_SELECT,
|
|
2714
|
+
inlinerating: INLINE_FILTER_CONTROL_TYPES.RATING,
|
|
2715
|
+
inlinedistanceradius: INLINE_FILTER_CONTROL_TYPES.DISTANCE_RADIUS,
|
|
2716
|
+
inlinepipelinestatus: INLINE_FILTER_CONTROL_TYPES.PIPELINE_STATUS,
|
|
2717
|
+
inlinescorepriority: INLINE_FILTER_CONTROL_TYPES.SCORE_PRIORITY,
|
|
2718
|
+
inlinerelativeperiod: INLINE_FILTER_CONTROL_TYPES.RELATIVE_PERIOD,
|
|
2719
|
+
inlinesentiment: INLINE_FILTER_CONTROL_TYPES.SENTIMENT,
|
|
2720
|
+
inlinecolorlabel: INLINE_FILTER_CONTROL_TYPES.COLOR_LABEL,
|
|
2721
|
+
};
|
|
2722
|
+
const INLINE_FILTER_ALIAS_TOKEN_MAP = {};
|
|
2723
|
+
for (const [token, controlType] of Object.entries(INLINE_FILTER_CANONICAL_TOKEN_TO_CONTROL_TYPE_MAP)) {
|
|
2724
|
+
INLINE_FILTER_ALIAS_TOKEN_MAP[`filter${token}`] = controlType;
|
|
2725
|
+
INLINE_FILTER_ALIAS_TOKEN_MAP[`pdxfilter${token}`] = controlType;
|
|
2726
|
+
}
|
|
2727
|
+
const INLINE_FILTER_TOKEN_TO_CONTROL_TYPE = Object.freeze({
|
|
2728
|
+
...INLINE_FILTER_CANONICAL_TOKEN_TO_CONTROL_TYPE_MAP,
|
|
2729
|
+
...INLINE_FILTER_ALIAS_TOKEN_MAP,
|
|
2730
|
+
});
|
|
2731
|
+
const INLINE_FILTER_ALIAS_TOKENS = Object.freeze(Object.keys(INLINE_FILTER_ALIAS_TOKEN_MAP));
|
|
2732
|
+
const INLINE_FILTER_CANONICAL_TOKEN_TO_BASE_CONTROL_TYPE_MAP = {
|
|
2733
|
+
inlineselect: FieldControlType.SELECT,
|
|
2734
|
+
inlinesearchableselect: FieldControlType.SEARCHABLE_SELECT,
|
|
2735
|
+
inlineasyncselect: FieldControlType.ASYNC_SELECT,
|
|
2736
|
+
inlineentitylookup: FieldControlType.ENTITY_LOOKUP,
|
|
2737
|
+
inlineautocomplete: FieldControlType.AUTO_COMPLETE,
|
|
2738
|
+
inlinenumber: FieldControlType.NUMERIC_TEXT_BOX,
|
|
2739
|
+
inlinecurrency: FieldControlType.CURRENCY_INPUT,
|
|
2740
|
+
inlinecurrencyrange: FieldControlType.PRICE_RANGE,
|
|
2741
|
+
inlinemultiselect: FieldControlType.MULTI_SELECT,
|
|
2742
|
+
inlineinput: FieldControlType.INPUT,
|
|
2743
|
+
inlinephone: FieldControlType.PHONE,
|
|
2744
|
+
inlinetoggle: FieldControlType.TOGGLE,
|
|
2745
|
+
inlinerange: FieldControlType.RANGE_SLIDER,
|
|
2746
|
+
inlineperiodrange: FieldControlType.RANGE_SLIDER,
|
|
2747
|
+
inlineyearrange: FieldControlType.YEAR_INPUT,
|
|
2748
|
+
inlinemonthrange: FieldControlType.MONTH_INPUT,
|
|
2749
|
+
inlinedate: FieldControlType.DATE_PICKER,
|
|
2750
|
+
inlinedaterange: FieldControlType.DATE_RANGE,
|
|
2751
|
+
inlinetime: FieldControlType.TIME_PICKER,
|
|
2752
|
+
inlinetimerange: FieldControlType.TIME_RANGE,
|
|
2753
|
+
inlinetreeselect: FieldControlType.TREE_SELECT,
|
|
2754
|
+
inlinerating: FieldControlType.RATING,
|
|
2755
|
+
inlinedistanceradius: FieldControlType.INLINE_DISTANCE_RADIUS,
|
|
2756
|
+
inlinepipelinestatus: FieldControlType.INLINE_PIPELINE_STATUS,
|
|
2757
|
+
inlinescorepriority: FieldControlType.INLINE_SCORE_PRIORITY,
|
|
2758
|
+
inlinerelativeperiod: FieldControlType.INLINE_RELATIVE_PERIOD,
|
|
2759
|
+
inlinesentiment: FieldControlType.INLINE_SENTIMENT,
|
|
2760
|
+
inlinecolorlabel: FieldControlType.INLINE_COLOR_LABEL,
|
|
2761
|
+
};
|
|
2762
|
+
const INLINE_FILTER_ALIAS_TOKEN_TO_BASE_CONTROL_TYPE_MAP = {};
|
|
2763
|
+
for (const [aliasToken, controlType] of Object.entries(INLINE_FILTER_ALIAS_TOKEN_MAP)) {
|
|
2764
|
+
const canonicalToken = aliasToken.startsWith('pdxfilter')
|
|
2765
|
+
? aliasToken.replace(/^pdxfilter/, '')
|
|
2766
|
+
: aliasToken.replace(/^filter/, '');
|
|
2767
|
+
const baseControlType = INLINE_FILTER_CANONICAL_TOKEN_TO_BASE_CONTROL_TYPE_MAP[canonicalToken];
|
|
2768
|
+
if (baseControlType) {
|
|
2769
|
+
INLINE_FILTER_ALIAS_TOKEN_TO_BASE_CONTROL_TYPE_MAP[aliasToken] = baseControlType;
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
const INLINE_FILTER_TOKEN_TO_BASE_CONTROL_TYPE = Object.freeze({
|
|
2773
|
+
...INLINE_FILTER_CANONICAL_TOKEN_TO_BASE_CONTROL_TYPE_MAP,
|
|
2774
|
+
...INLINE_FILTER_ALIAS_TOKEN_TO_BASE_CONTROL_TYPE_MAP,
|
|
2775
|
+
});
|
|
2776
|
+
function resolveInlineFilterControlType(value) {
|
|
2777
|
+
const token = normalizeInlineControlTypeToken(value);
|
|
2778
|
+
if (!token)
|
|
2779
|
+
return undefined;
|
|
2780
|
+
return INLINE_FILTER_TOKEN_TO_CONTROL_TYPE[token];
|
|
2781
|
+
}
|
|
2782
|
+
function resolveInlineFilterControlTypeToBaseControlType(value) {
|
|
2783
|
+
const token = normalizeInlineControlTypeToken(value);
|
|
2784
|
+
if (!token)
|
|
2785
|
+
return undefined;
|
|
2786
|
+
return INLINE_FILTER_TOKEN_TO_BASE_CONTROL_TYPE[token];
|
|
2787
|
+
}
|
|
2788
|
+
function isInlineFilterControlType(value) {
|
|
2789
|
+
return INLINE_FILTER_CONTROL_TYPE_SET.has(String(value || '').trim());
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
function toUpperSnakeCase(raw) {
|
|
2793
|
+
return raw
|
|
2794
|
+
.trim()
|
|
2795
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
2796
|
+
.replace(/[-\s]+/g, '_')
|
|
2797
|
+
.replace(/__+/g, '_')
|
|
2798
|
+
.toUpperCase();
|
|
2799
|
+
}
|
|
2800
|
+
function normalizeControlTypeToken(value) {
|
|
2801
|
+
return String(value || '')
|
|
2802
|
+
.trim()
|
|
2803
|
+
.toLowerCase()
|
|
2804
|
+
.replace(/[-_\s]/g, '');
|
|
2805
|
+
}
|
|
2806
|
+
const CONTROL_TYPE_TOKEN_TO_KEY = Object.entries(FieldControlType).reduce((acc, [key, controlTypeValue]) => {
|
|
2807
|
+
acc[normalizeControlTypeToken(key)] = key;
|
|
2808
|
+
acc[normalizeControlTypeToken(controlTypeValue)] = key;
|
|
2809
|
+
return acc;
|
|
2810
|
+
}, {});
|
|
2811
|
+
const ALIAS_TOKEN_TO_CONTROL_TYPE = {
|
|
2812
|
+
// Legacy/common synonyms
|
|
2813
|
+
searchable: FieldControlType.SEARCHABLE_SELECT,
|
|
2814
|
+
searchableinput: FieldControlType.SEARCHABLE_SELECT,
|
|
2815
|
+
searchableselect: FieldControlType.SEARCHABLE_SELECT,
|
|
2816
|
+
materialsearchableselect: FieldControlType.SEARCHABLE_SELECT,
|
|
2817
|
+
asyncselect: FieldControlType.ASYNC_SELECT,
|
|
2818
|
+
materialasyncselect: FieldControlType.ASYNC_SELECT,
|
|
2819
|
+
entitylookup: FieldControlType.ENTITY_LOOKUP,
|
|
2820
|
+
materialentitylookup: FieldControlType.ENTITY_LOOKUP,
|
|
2821
|
+
autocomplete: FieldControlType.AUTO_COMPLETE,
|
|
2822
|
+
multiselect: FieldControlType.MULTI_SELECT,
|
|
2823
|
+
multiselecttree: FieldControlType.MULTI_SELECT_TREE,
|
|
2824
|
+
treeselect: FieldControlType.TREE_SELECT,
|
|
2825
|
+
datepicker: FieldControlType.DATE_PICKER,
|
|
2826
|
+
daterange: FieldControlType.DATE_RANGE,
|
|
2827
|
+
datetime: FieldControlType.DATETIME_LOCAL_INPUT,
|
|
2828
|
+
timepicker: FieldControlType.TIME_PICKER,
|
|
2829
|
+
timerange: FieldControlType.TIME_RANGE,
|
|
2830
|
+
pricerange: FieldControlType.PRICE_RANGE,
|
|
2831
|
+
rangeslider: FieldControlType.RANGE_SLIDER,
|
|
2832
|
+
number: FieldControlType.NUMERIC_TEXT_BOX,
|
|
2833
|
+
numeric: FieldControlType.NUMERIC_TEXT_BOX,
|
|
2834
|
+
currencyinput: FieldControlType.CURRENCY_INPUT,
|
|
2835
|
+
switch: FieldControlType.TOGGLE,
|
|
2836
|
+
radiogroup: FieldControlType.RADIO,
|
|
2837
|
+
checkboxgroup: FieldControlType.CHECKBOX,
|
|
2838
|
+
chiplist: FieldControlType.CHIP_LIST,
|
|
2839
|
+
chipinput: FieldControlType.CHIP_INPUT,
|
|
2840
|
+
searchinput: FieldControlType.SEARCH_INPUT,
|
|
2841
|
+
};
|
|
2842
|
+
function normalizeControlTypeKey(value) {
|
|
2843
|
+
const token = normalizeControlTypeToken(value);
|
|
2844
|
+
if (!token)
|
|
2845
|
+
return '';
|
|
2846
|
+
const resolvedKey = CONTROL_TYPE_TOKEN_TO_KEY[token];
|
|
2847
|
+
if (resolvedKey)
|
|
2848
|
+
return resolvedKey;
|
|
2849
|
+
return toUpperSnakeCase(String(value || ''));
|
|
2850
|
+
}
|
|
2851
|
+
function resolveControlTypeAlias(value, fallback = FieldControlType.INPUT) {
|
|
2852
|
+
const raw = String(value || '').trim();
|
|
2853
|
+
if (!raw)
|
|
2854
|
+
return fallback;
|
|
2855
|
+
const token = normalizeControlTypeToken(raw);
|
|
2856
|
+
const inlineAliased = INLINE_FILTER_TOKEN_TO_BASE_CONTROL_TYPE[token];
|
|
2857
|
+
if (inlineAliased)
|
|
2858
|
+
return inlineAliased;
|
|
2859
|
+
const aliased = ALIAS_TOKEN_TO_CONTROL_TYPE[token];
|
|
2860
|
+
if (aliased)
|
|
2861
|
+
return aliased;
|
|
2862
|
+
const resolvedKey = CONTROL_TYPE_TOKEN_TO_KEY[token];
|
|
2863
|
+
if (resolvedKey) {
|
|
2864
|
+
return FieldControlType[resolvedKey];
|
|
2865
|
+
}
|
|
2866
|
+
return raw;
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
const MAX_OPTION_SOURCE_DEPTH = 3;
|
|
2508
2870
|
// Mirrors the backend custom-field key policy. Ordinary static field names are
|
|
2509
2871
|
// outside this boundary; custom keys must be safe across all runtime consumers.
|
|
2510
2872
|
const RESERVED_CUSTOM_FIELD_KEYS = new Set([
|
|
@@ -2802,6 +3164,41 @@ class SchemaNormalizationKernel {
|
|
|
2802
3164
|
.filter((v) => v.length > 0);
|
|
2803
3165
|
return normalized.filter((v, index) => normalized.indexOf(v) === index);
|
|
2804
3166
|
}
|
|
3167
|
+
parseDependsOn(value) {
|
|
3168
|
+
const rawItems = Array.isArray(value)
|
|
3169
|
+
? value
|
|
3170
|
+
: typeof value === 'string'
|
|
3171
|
+
? value.split(',')
|
|
3172
|
+
: [];
|
|
3173
|
+
const normalized = rawItems
|
|
3174
|
+
.map((item) => (typeof item === 'string' ? item.trim() : ''))
|
|
3175
|
+
.filter((item) => item.length > 0);
|
|
3176
|
+
return normalized.filter((item, index) => normalized.indexOf(item) === index);
|
|
3177
|
+
}
|
|
3178
|
+
parseStrictStringRecord(value) {
|
|
3179
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
3180
|
+
return undefined;
|
|
3181
|
+
}
|
|
3182
|
+
const normalized = Object.entries(value)
|
|
3183
|
+
.reduce((acc, [key, mapValue]) => {
|
|
3184
|
+
if (typeof mapValue !== 'string') {
|
|
3185
|
+
return acc;
|
|
3186
|
+
}
|
|
3187
|
+
const normalizedKey = String(key).trim();
|
|
3188
|
+
if (!normalizedKey ||
|
|
3189
|
+
normalizedKey === '__proto__' ||
|
|
3190
|
+
normalizedKey === 'constructor' ||
|
|
3191
|
+
normalizedKey === 'prototype') {
|
|
3192
|
+
return acc;
|
|
3193
|
+
}
|
|
3194
|
+
const normalizedValue = mapValue.trim();
|
|
3195
|
+
if (normalizedValue) {
|
|
3196
|
+
acc[normalizedKey] = normalizedValue;
|
|
3197
|
+
}
|
|
3198
|
+
return acc;
|
|
3199
|
+
}, {});
|
|
3200
|
+
return Object.keys(normalized).length ? normalized : undefined;
|
|
3201
|
+
}
|
|
2805
3202
|
parseStringRecord(value) {
|
|
2806
3203
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
2807
3204
|
return undefined;
|
|
@@ -3059,10 +3456,13 @@ class SchemaNormalizationKernel {
|
|
|
3059
3456
|
}
|
|
3060
3457
|
const dialog = {};
|
|
3061
3458
|
if (value.enabled !== undefined) {
|
|
3062
|
-
|
|
3459
|
+
const enabled = this.parseOptionalBoolean(value.enabled);
|
|
3460
|
+
if (enabled !== undefined) {
|
|
3461
|
+
dialog.enabled = enabled;
|
|
3462
|
+
}
|
|
3063
3463
|
}
|
|
3064
|
-
if (value.title
|
|
3065
|
-
const title =
|
|
3464
|
+
if (typeof value.title === 'string') {
|
|
3465
|
+
const title = value.title.trim();
|
|
3066
3466
|
if (title) {
|
|
3067
3467
|
dialog.title = title;
|
|
3068
3468
|
}
|
|
@@ -3074,13 +3474,22 @@ class SchemaNormalizationKernel {
|
|
|
3074
3474
|
}
|
|
3075
3475
|
}
|
|
3076
3476
|
if (value.previewPanel !== undefined) {
|
|
3077
|
-
|
|
3477
|
+
const previewPanel = this.parseOptionalBoolean(value.previewPanel);
|
|
3478
|
+
if (previewPanel !== undefined) {
|
|
3479
|
+
dialog.previewPanel = previewPanel;
|
|
3480
|
+
}
|
|
3078
3481
|
}
|
|
3079
3482
|
if (value.allowColumnChooser !== undefined) {
|
|
3080
|
-
|
|
3483
|
+
const allowColumnChooser = this.parseOptionalBoolean(value.allowColumnChooser);
|
|
3484
|
+
if (allowColumnChooser !== undefined) {
|
|
3485
|
+
dialog.allowColumnChooser = allowColumnChooser;
|
|
3486
|
+
}
|
|
3081
3487
|
}
|
|
3082
3488
|
if (value.allowSavedViews !== undefined) {
|
|
3083
|
-
|
|
3489
|
+
const allowSavedViews = this.parseOptionalBoolean(value.allowSavedViews);
|
|
3490
|
+
if (allowSavedViews !== undefined) {
|
|
3491
|
+
dialog.allowSavedViews = allowSavedViews;
|
|
3492
|
+
}
|
|
3084
3493
|
}
|
|
3085
3494
|
if (Array.isArray(value.resultColumns)) {
|
|
3086
3495
|
const resultColumns = value.resultColumns
|
|
@@ -3090,20 +3499,20 @@ class SchemaNormalizationKernel {
|
|
|
3090
3499
|
dialog.resultColumns = resultColumns;
|
|
3091
3500
|
}
|
|
3092
3501
|
}
|
|
3093
|
-
if (value.openActionLabel
|
|
3094
|
-
const openActionLabel =
|
|
3502
|
+
if (typeof value.openActionLabel === 'string') {
|
|
3503
|
+
const openActionLabel = value.openActionLabel.trim();
|
|
3095
3504
|
if (openActionLabel) {
|
|
3096
3505
|
dialog.openActionLabel = openActionLabel;
|
|
3097
3506
|
}
|
|
3098
3507
|
}
|
|
3099
|
-
if (value.applyActionLabel
|
|
3100
|
-
const applyActionLabel =
|
|
3508
|
+
if (typeof value.applyActionLabel === 'string') {
|
|
3509
|
+
const applyActionLabel = value.applyActionLabel.trim();
|
|
3101
3510
|
if (applyActionLabel) {
|
|
3102
3511
|
dialog.applyActionLabel = applyActionLabel;
|
|
3103
3512
|
}
|
|
3104
3513
|
}
|
|
3105
|
-
if (value.cancelActionLabel
|
|
3106
|
-
const cancelActionLabel =
|
|
3514
|
+
if (typeof value.cancelActionLabel === 'string') {
|
|
3515
|
+
const cancelActionLabel = value.cancelActionLabel.trim();
|
|
3107
3516
|
if (cancelActionLabel) {
|
|
3108
3517
|
dialog.cancelActionLabel = cancelActionLabel;
|
|
3109
3518
|
}
|
|
@@ -3114,19 +3523,19 @@ class SchemaNormalizationKernel {
|
|
|
3114
3523
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
3115
3524
|
return undefined;
|
|
3116
3525
|
}
|
|
3117
|
-
const field =
|
|
3526
|
+
const field = typeof value.field === 'string' ? value.field.trim() : '';
|
|
3118
3527
|
if (!field) {
|
|
3119
3528
|
return undefined;
|
|
3120
3529
|
}
|
|
3121
3530
|
const column = { field };
|
|
3122
|
-
if (value.label
|
|
3123
|
-
const label =
|
|
3531
|
+
if (typeof value.label === 'string') {
|
|
3532
|
+
const label = value.label.trim();
|
|
3124
3533
|
if (label) {
|
|
3125
3534
|
column.label = label;
|
|
3126
3535
|
}
|
|
3127
3536
|
}
|
|
3128
|
-
if (value.kind
|
|
3129
|
-
const kind =
|
|
3537
|
+
if (typeof value.kind === 'string') {
|
|
3538
|
+
const kind = value.kind.trim();
|
|
3130
3539
|
if (kind === 'code' ||
|
|
3131
3540
|
kind === 'label' ||
|
|
3132
3541
|
kind === 'description' ||
|
|
@@ -3136,15 +3545,137 @@ class SchemaNormalizationKernel {
|
|
|
3136
3545
|
column.kind = kind;
|
|
3137
3546
|
}
|
|
3138
3547
|
}
|
|
3139
|
-
if (value.width
|
|
3140
|
-
const width =
|
|
3548
|
+
if (typeof value.width === 'string') {
|
|
3549
|
+
const width = value.width.trim();
|
|
3141
3550
|
if (width) {
|
|
3142
3551
|
column.width = width;
|
|
3143
3552
|
}
|
|
3144
3553
|
}
|
|
3145
3554
|
return column;
|
|
3146
3555
|
}
|
|
3147
|
-
|
|
3556
|
+
mergeLookupDialog(base, override) {
|
|
3557
|
+
const merged = {
|
|
3558
|
+
...(this.parseLookupDialog(base) ?? {}),
|
|
3559
|
+
...(this.parseLookupDialog(override) ?? {}),
|
|
3560
|
+
};
|
|
3561
|
+
return Object.keys(merged).length ? merged : undefined;
|
|
3562
|
+
}
|
|
3563
|
+
parseLookupFilterOptions(value) {
|
|
3564
|
+
if (!Array.isArray(value)) {
|
|
3565
|
+
return undefined;
|
|
3566
|
+
}
|
|
3567
|
+
const options = [];
|
|
3568
|
+
const seen = new Set();
|
|
3569
|
+
for (const item of value) {
|
|
3570
|
+
if (typeof item === 'string' ||
|
|
3571
|
+
typeof item === 'number' ||
|
|
3572
|
+
typeof item === 'boolean') {
|
|
3573
|
+
let parsedValue;
|
|
3574
|
+
if (typeof item === 'string') {
|
|
3575
|
+
const trimmed = item.trim();
|
|
3576
|
+
if (!trimmed) {
|
|
3577
|
+
continue;
|
|
3578
|
+
}
|
|
3579
|
+
parsedValue = trimmed;
|
|
3580
|
+
}
|
|
3581
|
+
else if (typeof item === 'number') {
|
|
3582
|
+
if (!Number.isFinite(item)) {
|
|
3583
|
+
continue;
|
|
3584
|
+
}
|
|
3585
|
+
parsedValue = item;
|
|
3586
|
+
}
|
|
3587
|
+
else {
|
|
3588
|
+
parsedValue = item;
|
|
3589
|
+
}
|
|
3590
|
+
const dedupeKey = `${typeof parsedValue}:${String(parsedValue)}`;
|
|
3591
|
+
if (seen.has(dedupeKey)) {
|
|
3592
|
+
continue;
|
|
3593
|
+
}
|
|
3594
|
+
seen.add(dedupeKey);
|
|
3595
|
+
options.push({
|
|
3596
|
+
value: parsedValue,
|
|
3597
|
+
label: String(parsedValue),
|
|
3598
|
+
});
|
|
3599
|
+
continue;
|
|
3600
|
+
}
|
|
3601
|
+
if (!item || typeof item !== 'object' || Array.isArray(item)) {
|
|
3602
|
+
continue;
|
|
3603
|
+
}
|
|
3604
|
+
const raw = item;
|
|
3605
|
+
const isLegacyKeyValue = raw['key'] !== undefined &&
|
|
3606
|
+
raw['key'] !== null &&
|
|
3607
|
+
raw['label'] === undefined &&
|
|
3608
|
+
raw['text'] === undefined &&
|
|
3609
|
+
typeof raw['value'] === 'string' &&
|
|
3610
|
+
raw['key'] !== raw['value'];
|
|
3611
|
+
const rawValue = isLegacyKeyValue
|
|
3612
|
+
? raw['key']
|
|
3613
|
+
: raw['value'] !== undefined && raw['value'] !== null
|
|
3614
|
+
? raw['value']
|
|
3615
|
+
: raw['key'];
|
|
3616
|
+
const rawLabel = isLegacyKeyValue
|
|
3617
|
+
? raw['value']
|
|
3618
|
+
: raw['label'] ?? raw['text'];
|
|
3619
|
+
let parsedValue;
|
|
3620
|
+
if (typeof rawValue === 'string') {
|
|
3621
|
+
const trimmed = rawValue.trim();
|
|
3622
|
+
if (!trimmed) {
|
|
3623
|
+
continue;
|
|
3624
|
+
}
|
|
3625
|
+
parsedValue = trimmed;
|
|
3626
|
+
}
|
|
3627
|
+
else if (typeof rawValue === 'number') {
|
|
3628
|
+
if (!Number.isFinite(rawValue)) {
|
|
3629
|
+
continue;
|
|
3630
|
+
}
|
|
3631
|
+
parsedValue = rawValue;
|
|
3632
|
+
}
|
|
3633
|
+
else if (typeof rawValue === 'boolean') {
|
|
3634
|
+
parsedValue = rawValue;
|
|
3635
|
+
}
|
|
3636
|
+
else {
|
|
3637
|
+
continue;
|
|
3638
|
+
}
|
|
3639
|
+
const dedupeKey = `${typeof parsedValue}:${String(parsedValue)}`;
|
|
3640
|
+
if (seen.has(dedupeKey)) {
|
|
3641
|
+
continue;
|
|
3642
|
+
}
|
|
3643
|
+
seen.add(dedupeKey);
|
|
3644
|
+
let label;
|
|
3645
|
+
if (typeof rawLabel === 'string' && rawLabel.trim().length > 0) {
|
|
3646
|
+
label = rawLabel.trim();
|
|
3647
|
+
}
|
|
3648
|
+
else if ((typeof rawLabel === 'number' && Number.isFinite(rawLabel)) ||
|
|
3649
|
+
typeof rawLabel === 'boolean') {
|
|
3650
|
+
label = String(rawLabel);
|
|
3651
|
+
}
|
|
3652
|
+
else {
|
|
3653
|
+
label = String(parsedValue);
|
|
3654
|
+
}
|
|
3655
|
+
const option = {
|
|
3656
|
+
value: parsedValue,
|
|
3657
|
+
label,
|
|
3658
|
+
};
|
|
3659
|
+
if (typeof raw['icon'] === 'string' && raw['icon'].trim()) {
|
|
3660
|
+
option.icon = raw['icon'].trim();
|
|
3661
|
+
}
|
|
3662
|
+
if (typeof raw['tone'] === 'string' && raw['tone'].trim()) {
|
|
3663
|
+
option.tone = raw['tone'].trim();
|
|
3664
|
+
}
|
|
3665
|
+
if (typeof raw['description'] === 'string' && raw['description'].trim()) {
|
|
3666
|
+
option.description = raw['description'].trim();
|
|
3667
|
+
}
|
|
3668
|
+
if (raw['disabled'] !== undefined) {
|
|
3669
|
+
const disabled = this.parseOptionalBoolean(raw['disabled']);
|
|
3670
|
+
if (disabled !== undefined) {
|
|
3671
|
+
option.disabled = disabled;
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
options.push(option);
|
|
3675
|
+
}
|
|
3676
|
+
return options.length ? options : undefined;
|
|
3677
|
+
}
|
|
3678
|
+
parseLookupFilterDefinition(value, optionSourceDepth = 0, visitedOptionSources = new Set()) {
|
|
3148
3679
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
3149
3680
|
return undefined;
|
|
3150
3681
|
}
|
|
@@ -3169,8 +3700,38 @@ class SchemaNormalizationKernel {
|
|
|
3169
3700
|
if (defaultOperator && operators.includes(defaultOperator)) {
|
|
3170
3701
|
definition.defaultOperator = defaultOperator;
|
|
3171
3702
|
}
|
|
3172
|
-
if (value.
|
|
3173
|
-
const
|
|
3703
|
+
if (value.options !== undefined) {
|
|
3704
|
+
const options = this.parseLookupFilterOptions(value.options);
|
|
3705
|
+
if (options) {
|
|
3706
|
+
definition.options = options;
|
|
3707
|
+
}
|
|
3708
|
+
}
|
|
3709
|
+
if (typeof value.optionSource === 'string') {
|
|
3710
|
+
const optionSource = value.optionSource.trim();
|
|
3711
|
+
if (optionSource) {
|
|
3712
|
+
definition.optionSource = optionSource;
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
else if (value.optionSource &&
|
|
3716
|
+
typeof value.optionSource === 'object' &&
|
|
3717
|
+
!Array.isArray(value.optionSource)) {
|
|
3718
|
+
const optionSource = this.parseOptionSource(value.optionSource, optionSourceDepth + 1, visitedOptionSources);
|
|
3719
|
+
if (optionSource) {
|
|
3720
|
+
definition.optionSource = optionSource;
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
if (value.dependsOn !== undefined) {
|
|
3724
|
+
const dependsOn = this.parseDependsOn(value.dependsOn);
|
|
3725
|
+
if (dependsOn.length) {
|
|
3726
|
+
definition.dependsOn = dependsOn;
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
const dependencyFilterMap = this.parseStrictStringRecord(value.dependencyFilterMap);
|
|
3730
|
+
if (dependencyFilterMap) {
|
|
3731
|
+
definition.dependencyFilterMap = dependencyFilterMap;
|
|
3732
|
+
}
|
|
3733
|
+
if (typeof value.optionsSource === 'string') {
|
|
3734
|
+
const optionsSource = value.optionsSource.trim();
|
|
3174
3735
|
if (optionsSource) {
|
|
3175
3736
|
definition.optionsSource = optionsSource;
|
|
3176
3737
|
}
|
|
@@ -3204,7 +3765,7 @@ class SchemaNormalizationKernel {
|
|
|
3204
3765
|
}, {});
|
|
3205
3766
|
return Object.keys(normalized).length ? normalized : undefined;
|
|
3206
3767
|
}
|
|
3207
|
-
parseLookupFiltering(value) {
|
|
3768
|
+
parseLookupFiltering(value, optionSourceDepth = 0, visitedOptionSources = new Set()) {
|
|
3208
3769
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
3209
3770
|
return undefined;
|
|
3210
3771
|
}
|
|
@@ -3212,7 +3773,7 @@ class SchemaNormalizationKernel {
|
|
|
3212
3773
|
if (value.availableFilters !== undefined) {
|
|
3213
3774
|
const availableFilters = Array.isArray(value.availableFilters)
|
|
3214
3775
|
? value.availableFilters
|
|
3215
|
-
.map((item) => this.parseLookupFilterDefinition(item))
|
|
3776
|
+
.map((item) => this.parseLookupFilterDefinition(item, optionSourceDepth, visitedOptionSources))
|
|
3216
3777
|
.filter((item) => !!item)
|
|
3217
3778
|
: [];
|
|
3218
3779
|
if (availableFilters.length) {
|
|
@@ -3298,6 +3859,12 @@ class SchemaNormalizationKernel {
|
|
|
3298
3859
|
filtering.searchStrategies = searchStrategies;
|
|
3299
3860
|
}
|
|
3300
3861
|
}
|
|
3862
|
+
if (typeof value.defaultSearchStrategy === 'string') {
|
|
3863
|
+
const defaultSearchStrategy = value.defaultSearchStrategy.trim();
|
|
3864
|
+
if (defaultSearchStrategy) {
|
|
3865
|
+
filtering.defaultSearchStrategy = defaultSearchStrategy;
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3301
3868
|
return Object.keys(filtering).length ? filtering : undefined;
|
|
3302
3869
|
}
|
|
3303
3870
|
/** Parse option arrays into `{ key, value }` objects with label preservation. */
|
|
@@ -3328,16 +3895,23 @@ class SchemaNormalizationKernel {
|
|
|
3328
3895
|
return { key: String(opt), value: String(opt) };
|
|
3329
3896
|
});
|
|
3330
3897
|
}
|
|
3331
|
-
parseOptionSource(value) {
|
|
3332
|
-
if (!value ||
|
|
3898
|
+
parseOptionSource(value, depth = 0, visited = new Set()) {
|
|
3899
|
+
if (!value ||
|
|
3900
|
+
typeof value !== 'object' ||
|
|
3901
|
+
Array.isArray(value) ||
|
|
3902
|
+
depth > MAX_OPTION_SOURCE_DEPTH ||
|
|
3903
|
+
visited.has(value)) {
|
|
3333
3904
|
return undefined;
|
|
3334
3905
|
}
|
|
3335
|
-
const
|
|
3336
|
-
|
|
3337
|
-
};
|
|
3338
|
-
if (!optionSource.key) {
|
|
3906
|
+
const key = String(value.key ?? '').trim();
|
|
3907
|
+
if (!key) {
|
|
3339
3908
|
return undefined;
|
|
3340
3909
|
}
|
|
3910
|
+
const nextVisited = new Set(visited);
|
|
3911
|
+
nextVisited.add(value);
|
|
3912
|
+
const optionSource = {
|
|
3913
|
+
key,
|
|
3914
|
+
};
|
|
3341
3915
|
if (value.type !== undefined) {
|
|
3342
3916
|
const optionSourceType = this.parseOptionSourceType(value.type);
|
|
3343
3917
|
if (optionSourceType) {
|
|
@@ -3381,12 +3955,12 @@ class SchemaNormalizationKernel {
|
|
|
3381
3955
|
optionSource.searchPropertyPaths = this.parseStringArray(value.searchPropertyPaths);
|
|
3382
3956
|
}
|
|
3383
3957
|
if (value.dependsOn !== undefined) {
|
|
3384
|
-
const dependsOn = this.
|
|
3958
|
+
const dependsOn = this.parseDependsOn(value.dependsOn);
|
|
3385
3959
|
if (dependsOn.length) {
|
|
3386
3960
|
optionSource.dependsOn = dependsOn;
|
|
3387
3961
|
}
|
|
3388
3962
|
}
|
|
3389
|
-
const dependencyFilterMap = this.
|
|
3963
|
+
const dependencyFilterMap = this.parseStrictStringRecord(value.dependencyFilterMap);
|
|
3390
3964
|
if (dependencyFilterMap) {
|
|
3391
3965
|
optionSource.dependencyFilterMap = dependencyFilterMap;
|
|
3392
3966
|
}
|
|
@@ -3410,10 +3984,14 @@ class SchemaNormalizationKernel {
|
|
|
3410
3984
|
if (create) {
|
|
3411
3985
|
optionSource.create = create;
|
|
3412
3986
|
}
|
|
3413
|
-
const filtering = this.parseLookupFiltering(value.filtering);
|
|
3987
|
+
const filtering = this.parseLookupFiltering(value.filtering, depth, nextVisited);
|
|
3414
3988
|
if (filtering) {
|
|
3415
3989
|
optionSource.filtering = filtering;
|
|
3416
3990
|
}
|
|
3991
|
+
const dialog = this.parseLookupDialog(value.dialog);
|
|
3992
|
+
if (dialog) {
|
|
3993
|
+
optionSource.dialog = dialog;
|
|
3994
|
+
}
|
|
3417
3995
|
if (value.excludeSelfField !== undefined) {
|
|
3418
3996
|
optionSource.excludeSelfField = this.parseBoolean(value.excludeSelfField);
|
|
3419
3997
|
}
|
|
@@ -4078,7 +4656,7 @@ class SchemaNormalizationKernel {
|
|
|
4078
4656
|
// Basic information
|
|
4079
4657
|
// -------------------------------------------------------------------
|
|
4080
4658
|
field.label = ui.label ?? prop.title ?? name;
|
|
4081
|
-
field.type = this.resolveFieldType(prop, ui);
|
|
4659
|
+
field.type = this.resolveFieldType(prop, ui, rootSchema);
|
|
4082
4660
|
if (field.type === 'array')
|
|
4083
4661
|
field.items = normalizeScalarItemsSchema(prop?.items);
|
|
4084
4662
|
const numericFormat = this.resolveNumericFormatToken(prop, ui, field.type);
|
|
@@ -4097,6 +4675,18 @@ class SchemaNormalizationKernel {
|
|
|
4097
4675
|
if (ui.controlType) {
|
|
4098
4676
|
field.controlType = ui.controlType;
|
|
4099
4677
|
}
|
|
4678
|
+
if (this.isCanonicalMonetaryRangeUnion(prop, rootSchema)) {
|
|
4679
|
+
field.type = 'array';
|
|
4680
|
+
const controlToken = normalizeControlTypeToken(field.controlType);
|
|
4681
|
+
const isInlineCurrencyRange = controlToken === 'inlinecurrencyrange' ||
|
|
4682
|
+
resolveInlineFilterControlType(field.controlType) === 'inlineCurrencyRange';
|
|
4683
|
+
if (!isInlineCurrencyRange) {
|
|
4684
|
+
field.controlType = 'priceRange';
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
if (this.inferRequireTwoBoundsFromUnion(prop, rootSchema)) {
|
|
4688
|
+
field.requireTwoBounds = true;
|
|
4689
|
+
}
|
|
4100
4690
|
if (field.controlType === 'array' || ui.array !== undefined) {
|
|
4101
4691
|
const arrayConfig = this.normalizeArrayConfig(ui, prop, rootSchema);
|
|
4102
4692
|
if (arrayConfig) {
|
|
@@ -4392,11 +4982,11 @@ class SchemaNormalizationKernel {
|
|
|
4392
4982
|
if (optionSource) {
|
|
4393
4983
|
// Java metadata publishes cascade context beside optionSource. Keep the
|
|
4394
4984
|
// runtime contract canonical by materializing it inside optionSource.
|
|
4395
|
-
const dependsOn = this.
|
|
4985
|
+
const dependsOn = this.parseDependsOn(ui.dependsOn);
|
|
4396
4986
|
if (!optionSource.dependsOn?.length && dependsOn.length) {
|
|
4397
4987
|
optionSource.dependsOn = dependsOn;
|
|
4398
4988
|
}
|
|
4399
|
-
const dependencyFilterMap = this.
|
|
4989
|
+
const dependencyFilterMap = this.parseStrictStringRecord(ui.dependencyFilterMap);
|
|
4400
4990
|
if (!optionSource.dependencyFilterMap &&
|
|
4401
4991
|
dependencyFilterMap) {
|
|
4402
4992
|
optionSource.dependencyFilterMap = dependencyFilterMap;
|
|
@@ -4443,11 +5033,10 @@ class SchemaNormalizationKernel {
|
|
|
4443
5033
|
if (ui.filter !== undefined) {
|
|
4444
5034
|
field.filter = ui.filter;
|
|
4445
5035
|
}
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
}
|
|
5036
|
+
const explicitDialog = ui.dialog !== undefined ? this.parseLookupDialog(ui.dialog) : undefined;
|
|
5037
|
+
const resolvedDialog = this.mergeLookupDialog(field.optionSource?.dialog, explicitDialog);
|
|
5038
|
+
if (resolvedDialog) {
|
|
5039
|
+
field.dialog = resolvedDialog;
|
|
4451
5040
|
}
|
|
4452
5041
|
if (ui.detailActionLabel !== undefined) {
|
|
4453
5042
|
const detailActionLabel = String(ui.detailActionLabel).trim();
|
|
@@ -4555,6 +5144,8 @@ class SchemaNormalizationKernel {
|
|
|
4555
5144
|
'thumbLabel',
|
|
4556
5145
|
'discrete',
|
|
4557
5146
|
'showInputs',
|
|
5147
|
+
'showInlineInputs',
|
|
5148
|
+
'showCurrencySymbol',
|
|
4558
5149
|
'disableThumbSwap',
|
|
4559
5150
|
'vertical',
|
|
4560
5151
|
'invert',
|
|
@@ -4567,20 +5158,25 @@ class SchemaNormalizationKernel {
|
|
|
4567
5158
|
}
|
|
4568
5159
|
}
|
|
4569
5160
|
}
|
|
4570
|
-
|
|
4571
|
-
const
|
|
4572
|
-
if (
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
5161
|
+
for (const guideKey of ['showTicks', 'showAnchors']) {
|
|
5162
|
+
const rawGuide = ui[guideKey];
|
|
5163
|
+
if (rawGuide !== undefined) {
|
|
5164
|
+
const parsedGuide = this.parseOptionalBoolean(rawGuide);
|
|
5165
|
+
if (parsedGuide !== undefined) {
|
|
5166
|
+
field[guideKey] = parsedGuide;
|
|
5167
|
+
}
|
|
5168
|
+
else if (typeof rawGuide === 'string' &&
|
|
5169
|
+
rawGuide.trim().toLowerCase() === 'auto') {
|
|
5170
|
+
field[guideKey] = 'auto';
|
|
5171
|
+
}
|
|
4578
5172
|
}
|
|
4579
5173
|
}
|
|
4580
5174
|
const sliderNumberKeys = [
|
|
5175
|
+
'sliderStep',
|
|
4581
5176
|
'shiftStep',
|
|
4582
5177
|
'minDistance',
|
|
4583
5178
|
'maxDistance',
|
|
5179
|
+
'decimalPlaces',
|
|
4584
5180
|
];
|
|
4585
5181
|
for (const key of sliderNumberKeys) {
|
|
4586
5182
|
if (ui[key] !== undefined) {
|
|
@@ -4614,6 +5210,9 @@ class SchemaNormalizationKernel {
|
|
|
4614
5210
|
'inlineChipSummaryTemplate',
|
|
4615
5211
|
'inlineChipUnitLabel',
|
|
4616
5212
|
'inlinePanelTitle',
|
|
5213
|
+
'inlinePanelSubtitle',
|
|
5214
|
+
'inlinePanelIcon',
|
|
5215
|
+
'inlinePanelIconColor',
|
|
4617
5216
|
'inlineQuickPresets',
|
|
4618
5217
|
'inlineQuickPresetsApplyMode',
|
|
4619
5218
|
'inlineTexts',
|
|
@@ -4632,7 +5231,14 @@ class SchemaNormalizationKernel {
|
|
|
4632
5231
|
'maxYear',
|
|
4633
5232
|
'minTime',
|
|
4634
5233
|
'maxTime',
|
|
5234
|
+
'stepMinute',
|
|
4635
5235
|
'stepMinutes',
|
|
5236
|
+
'interval',
|
|
5237
|
+
'inlineTimeTrackShifts',
|
|
5238
|
+
'inlineTrackShifts',
|
|
5239
|
+
'trackShifts',
|
|
5240
|
+
'minDistanceMinutes',
|
|
5241
|
+
'maxDistanceMinutes',
|
|
4636
5242
|
'startField',
|
|
4637
5243
|
'endField',
|
|
4638
5244
|
'startLabel',
|
|
@@ -4641,6 +5247,19 @@ class SchemaNormalizationKernel {
|
|
|
4641
5247
|
'endPlaceholder',
|
|
4642
5248
|
'inputMinLabel',
|
|
4643
5249
|
'inputMaxLabel',
|
|
5250
|
+
'inputExactLabel',
|
|
5251
|
+
'startMin',
|
|
5252
|
+
'startMax',
|
|
5253
|
+
'endMin',
|
|
5254
|
+
'endMax',
|
|
5255
|
+
'startMinMessage',
|
|
5256
|
+
'startMaxMessage',
|
|
5257
|
+
'endMinMessage',
|
|
5258
|
+
'endMaxMessage',
|
|
5259
|
+
'endMinOffset',
|
|
5260
|
+
'endMinOffsetMessage',
|
|
5261
|
+
'startMaxOffset',
|
|
5262
|
+
'startMaxOffsetMessage',
|
|
4644
5263
|
'maxVisibleChips',
|
|
4645
5264
|
'maxVisibleBadges',
|
|
4646
5265
|
'showSelectAll',
|
|
@@ -4678,21 +5297,51 @@ class SchemaNormalizationKernel {
|
|
|
4678
5297
|
'displayFormat',
|
|
4679
5298
|
'currency',
|
|
4680
5299
|
'currencyCode',
|
|
5300
|
+
'currencyPosition',
|
|
5301
|
+
'thousandSeparator',
|
|
5302
|
+
'thousandsSeparator',
|
|
5303
|
+
'decimalSeparator',
|
|
5304
|
+
'allowNegative',
|
|
5305
|
+
'operatorModes',
|
|
5306
|
+
'defaultOperatorMode',
|
|
5307
|
+
'requireTwoBounds',
|
|
4681
5308
|
'locale',
|
|
4682
5309
|
'precision',
|
|
4683
|
-
'decimalPlaces',
|
|
4684
5310
|
'initialsField',
|
|
4685
5311
|
'optionLabelKey',
|
|
4686
5312
|
'optionValueKey',
|
|
4687
5313
|
'extraProperties',
|
|
4688
5314
|
'rangeMode',
|
|
4689
5315
|
'maxRating',
|
|
5316
|
+
'ratingMin',
|
|
5317
|
+
'ratingMax',
|
|
5318
|
+
'itemsCount',
|
|
5319
|
+
'ratingStep',
|
|
4690
5320
|
'allowHalf',
|
|
5321
|
+
'ratingAllowHalf',
|
|
5322
|
+
'ratingPrecision',
|
|
4691
5323
|
'ratingIcon',
|
|
4692
5324
|
'ratingEmptyIcon',
|
|
4693
5325
|
'ratingHalfIcon',
|
|
5326
|
+
'ratingActiveIcon',
|
|
5327
|
+
'ratingInactiveIcon',
|
|
4694
5328
|
'ratingTone',
|
|
4695
5329
|
'ratingToneColors',
|
|
5330
|
+
'ratingColors',
|
|
5331
|
+
'starColors',
|
|
5332
|
+
'ratingLowColor',
|
|
5333
|
+
'ratingMidColor',
|
|
5334
|
+
'ratingHighColor',
|
|
5335
|
+
'ratingGradientLowColor',
|
|
5336
|
+
'ratingGradientMidColor',
|
|
5337
|
+
'ratingGradientHighColor',
|
|
5338
|
+
'ratingToneLowColor',
|
|
5339
|
+
'ratingToneMidColor',
|
|
5340
|
+
'ratingToneHighColor',
|
|
5341
|
+
'ratingBadgeColor',
|
|
5342
|
+
'ratingBadgeIcon',
|
|
5343
|
+
'ratingBadgeIconColor',
|
|
5344
|
+
'ratingIndicatorColor',
|
|
4696
5345
|
'ratingLabels',
|
|
4697
5346
|
'distanceUnit',
|
|
4698
5347
|
'distanceBaseUnit',
|
|
@@ -4704,6 +5353,14 @@ class SchemaNormalizationKernel {
|
|
|
4704
5353
|
'distanceDecimalsMi',
|
|
4705
5354
|
'distancePresets',
|
|
4706
5355
|
'distanceSubtitle',
|
|
5356
|
+
'distanceIcon',
|
|
5357
|
+
'distanceStart',
|
|
5358
|
+
'distanceEnd',
|
|
5359
|
+
'radiusMin',
|
|
5360
|
+
'radiusMax',
|
|
5361
|
+
'radiusStep',
|
|
5362
|
+
'radiusMode',
|
|
5363
|
+
'distanceSliderStep',
|
|
4707
5364
|
'distanceRadialRings',
|
|
4708
5365
|
'distanceAccentColor',
|
|
4709
5366
|
'distanceRingColor',
|
|
@@ -4721,6 +5378,25 @@ class SchemaNormalizationKernel {
|
|
|
4721
5378
|
'severityBands',
|
|
4722
5379
|
'scorePalette',
|
|
4723
5380
|
'scoreTexts',
|
|
5381
|
+
'scoreSubtitle',
|
|
5382
|
+
'scoreUnit',
|
|
5383
|
+
'scoreDisplayDecimals',
|
|
5384
|
+
'scoreShowScaleLabels',
|
|
5385
|
+
'scoreShowBandChips',
|
|
5386
|
+
'scoreRangeSeparator',
|
|
5387
|
+
'scoreGradientLowColor',
|
|
5388
|
+
'scoreGradientMidColor',
|
|
5389
|
+
'scoreGradientHighColor',
|
|
5390
|
+
'scoreValueFallbackColor',
|
|
5391
|
+
'scoreEmptyGradient',
|
|
5392
|
+
'scoreIcon',
|
|
5393
|
+
'scoreBandsAriaLabel',
|
|
5394
|
+
'scoreBandAriaLabelTemplate',
|
|
5395
|
+
'scoreMin',
|
|
5396
|
+
'scoreMax',
|
|
5397
|
+
'scoreStep',
|
|
5398
|
+
'scoreMode',
|
|
5399
|
+
'scoreSliderStep',
|
|
4724
5400
|
'relativePeriodOptions',
|
|
4725
5401
|
'relativePeriodPresets',
|
|
4726
5402
|
'relativePeriodTexts',
|
|
@@ -4737,6 +5413,114 @@ class SchemaNormalizationKernel {
|
|
|
4737
5413
|
'numberFormat',
|
|
4738
5414
|
'valueLabelFormat',
|
|
4739
5415
|
'scale',
|
|
5416
|
+
'optionSubtitleKey',
|
|
5417
|
+
'optionWeightKey',
|
|
5418
|
+
'optionColorKey',
|
|
5419
|
+
'optionIconKey',
|
|
5420
|
+
'optionEmojiKey',
|
|
5421
|
+
'panelSearchIcon',
|
|
5422
|
+
'panelSearchIconColor',
|
|
5423
|
+
'panelResetIcon',
|
|
5424
|
+
'panelResetIconColor',
|
|
5425
|
+
'optionSelectedIcon',
|
|
5426
|
+
'optionSelectedIconColor',
|
|
5427
|
+
'columns',
|
|
5428
|
+
'pipelineTitle',
|
|
5429
|
+
'pipelineSubtitle',
|
|
5430
|
+
'pipelineMode',
|
|
5431
|
+
'pipelineMultiple',
|
|
5432
|
+
'pipelineSearchable',
|
|
5433
|
+
'pipelineSearchPlaceholder',
|
|
5434
|
+
'pipelineOptionSubtitleKey',
|
|
5435
|
+
'pipelineOptionWeightKey',
|
|
5436
|
+
'pipelineOptionColorKey',
|
|
5437
|
+
'pipelineShowBar',
|
|
5438
|
+
'pipelineShowSelectionPills',
|
|
5439
|
+
'pipelineShowSelectAll',
|
|
5440
|
+
'pipelineSelectAllText',
|
|
5441
|
+
'pipelineShowClearAction',
|
|
5442
|
+
'pipelineClearActionText',
|
|
5443
|
+
'pipelineChipMaxVisible',
|
|
5444
|
+
'statusColors',
|
|
5445
|
+
'pipelineGradientLowColor',
|
|
5446
|
+
'pipelineGradientMidColor',
|
|
5447
|
+
'pipelineGradientHighColor',
|
|
5448
|
+
'pipelineEmptyStateText',
|
|
5449
|
+
'pipelineSelectionActionsAriaLabel',
|
|
5450
|
+
'pipelineOptionsGroupAriaLabelMultiple',
|
|
5451
|
+
'pipelineOptionsGroupAriaLabelSingle',
|
|
5452
|
+
'pipelineSelectionPillsAriaLabel',
|
|
5453
|
+
'pipelineBarAriaLabelEmpty',
|
|
5454
|
+
'pipelineBarAriaLabelSelected',
|
|
5455
|
+
'pipelineIcon',
|
|
5456
|
+
'pipelineSearchIcon',
|
|
5457
|
+
'pipelineSearchIconColor',
|
|
5458
|
+
'relativePeriodTitle',
|
|
5459
|
+
'relativePeriodSubtitle',
|
|
5460
|
+
'relativePeriodShowProgress',
|
|
5461
|
+
'relativePeriodProgressGradientLowColor',
|
|
5462
|
+
'relativePeriodProgressGradientMidColor',
|
|
5463
|
+
'relativePeriodProgressGradientHighColor',
|
|
5464
|
+
'relativePeriodColumns',
|
|
5465
|
+
'relativePeriodCloseOnSelect',
|
|
5466
|
+
'relativePeriodMultiple',
|
|
5467
|
+
'relativePeriodSearchable',
|
|
5468
|
+
'relativePeriodIcon',
|
|
5469
|
+
'relativePeriodIconKey',
|
|
5470
|
+
'relativePeriodSubtitleKey',
|
|
5471
|
+
'relativePeriodSelectedIcon',
|
|
5472
|
+
'relativePeriodSelectedIconColor',
|
|
5473
|
+
'relativePeriodOptionsAriaLabel',
|
|
5474
|
+
'relativePeriodProgressEmptyLabel',
|
|
5475
|
+
'relativePeriodEmptyStateText',
|
|
5476
|
+
'sentimentTitle',
|
|
5477
|
+
'sentimentSubtitle',
|
|
5478
|
+
'sentimentGradientLowColor',
|
|
5479
|
+
'sentimentGradientMidColor',
|
|
5480
|
+
'sentimentGradientHighColor',
|
|
5481
|
+
'sentimentShowBar',
|
|
5482
|
+
'sentimentAnimatedEmoji',
|
|
5483
|
+
'sentimentCloseOnSelect',
|
|
5484
|
+
'sentimentMultiple',
|
|
5485
|
+
'sentimentShowSelectionPills',
|
|
5486
|
+
'sentimentIcon',
|
|
5487
|
+
'sentimentColorKey',
|
|
5488
|
+
'sentimentEmojiKey',
|
|
5489
|
+
'sentimentOptionsAriaLabel',
|
|
5490
|
+
'sentimentSelectionPillsAriaLabel',
|
|
5491
|
+
'sentimentEmptyStateText',
|
|
5492
|
+
'colorLabelTitle',
|
|
5493
|
+
'colorLabelSubtitle',
|
|
5494
|
+
'colorLabelMultiple',
|
|
5495
|
+
'colorLabelColumns',
|
|
5496
|
+
'colorLabelShowSelectedBadges',
|
|
5497
|
+
'colorLabelCloseOnSelect',
|
|
5498
|
+
'colorLabelSelectionTitle',
|
|
5499
|
+
'colorLabelIcon',
|
|
5500
|
+
'colorLabelSelectedIcon',
|
|
5501
|
+
'colorLabelSelectedIconColor',
|
|
5502
|
+
'colorLabelBadgeRemoveIcon',
|
|
5503
|
+
'colorLabelBadgeRemoveIconColor',
|
|
5504
|
+
'colorLabelColorKey',
|
|
5505
|
+
'colorLabelOptionsAriaLabel',
|
|
5506
|
+
'colorLabelSelectionBadgesAriaLabel',
|
|
5507
|
+
'colorLabelRemoveSelectionAriaLabel',
|
|
5508
|
+
'colorLabelEmptyStateText',
|
|
5509
|
+
'startAriaLabel',
|
|
5510
|
+
'endAriaLabel',
|
|
5511
|
+
'inlineQuickPresetsAriaLabel',
|
|
5512
|
+
'inlineQuickPresetsCancelLabel',
|
|
5513
|
+
'inlineQuickPresetsCancelAriaLabel',
|
|
5514
|
+
'inlineQuickPresetsApplyLabel',
|
|
5515
|
+
'inlineQuickPresetsApplyAriaLabel',
|
|
5516
|
+
'shortcutsPosition',
|
|
5517
|
+
'applyOnShortcutClick',
|
|
5518
|
+
'i18nShortcuts',
|
|
5519
|
+
'startView',
|
|
5520
|
+
'startAt',
|
|
5521
|
+
'touchUi',
|
|
5522
|
+
'minDate',
|
|
5523
|
+
'maxDate',
|
|
4740
5524
|
];
|
|
4741
5525
|
for (const key of inlinePassThroughKeys) {
|
|
4742
5526
|
if (ui[key] !== undefined && field[key] === undefined) {
|
|
@@ -4774,27 +5558,150 @@ class SchemaNormalizationKernel {
|
|
|
4774
5558
|
]);
|
|
4775
5559
|
return identity(left) === identity(right);
|
|
4776
5560
|
}
|
|
4777
|
-
|
|
5561
|
+
resolveSchemaNode(node, rootSchema, visited = new Set()) {
|
|
5562
|
+
if (!node || typeof node !== 'object' || Array.isArray(node)) {
|
|
5563
|
+
return node;
|
|
5564
|
+
}
|
|
5565
|
+
const ref = typeof node.$ref === 'string' ? node.$ref.trim() : '';
|
|
5566
|
+
if (!ref || visited.has(ref)) {
|
|
5567
|
+
return node;
|
|
5568
|
+
}
|
|
5569
|
+
const resolved = this.resolveSchemaRef(ref, rootSchema);
|
|
5570
|
+
if (!resolved || typeof resolved !== 'object' || Array.isArray(resolved)) {
|
|
5571
|
+
return node;
|
|
5572
|
+
}
|
|
5573
|
+
const nextVisited = new Set(visited);
|
|
5574
|
+
nextVisited.add(ref);
|
|
5575
|
+
const resolvedDeep = this.resolveSchemaNode(resolved, rootSchema, nextVisited);
|
|
5576
|
+
const { $ref: _ignoredRef, ...rest } = node;
|
|
5577
|
+
return {
|
|
5578
|
+
...(resolvedDeep && typeof resolvedDeep === 'object' ? resolvedDeep : {}),
|
|
5579
|
+
...rest,
|
|
5580
|
+
};
|
|
5581
|
+
}
|
|
5582
|
+
extractSchemaNonNullTypes(node) {
|
|
5583
|
+
if (!node || typeof node !== 'object') {
|
|
5584
|
+
return [];
|
|
5585
|
+
}
|
|
5586
|
+
const collected = [];
|
|
5587
|
+
const pushType = (raw) => {
|
|
5588
|
+
if (typeof raw !== 'string') {
|
|
5589
|
+
return;
|
|
5590
|
+
}
|
|
5591
|
+
const normalized = raw.trim().toLowerCase();
|
|
5592
|
+
if (normalized && normalized !== 'null' && !collected.includes(normalized)) {
|
|
5593
|
+
collected.push(normalized);
|
|
5594
|
+
}
|
|
5595
|
+
};
|
|
5596
|
+
const pushFrom = (raw) => {
|
|
5597
|
+
if (typeof raw === 'string') {
|
|
5598
|
+
pushType(raw);
|
|
5599
|
+
}
|
|
5600
|
+
else if (Array.isArray(raw)) {
|
|
5601
|
+
for (const item of raw) {
|
|
5602
|
+
pushType(item);
|
|
5603
|
+
}
|
|
5604
|
+
}
|
|
5605
|
+
else if (raw instanceof Set) {
|
|
5606
|
+
for (const item of raw) {
|
|
5607
|
+
pushType(item);
|
|
5608
|
+
}
|
|
5609
|
+
}
|
|
5610
|
+
};
|
|
5611
|
+
pushFrom(node.type);
|
|
5612
|
+
pushFrom(node.types);
|
|
5613
|
+
return collected;
|
|
5614
|
+
}
|
|
5615
|
+
extractUnionVariants(prop, rootSchema) {
|
|
5616
|
+
const resolvedProp = this.resolveSchemaNode(prop, rootSchema);
|
|
5617
|
+
if (!resolvedProp || typeof resolvedProp !== 'object' || Array.isArray(resolvedProp)) {
|
|
5618
|
+
return [];
|
|
5619
|
+
}
|
|
5620
|
+
const rawVariants = [
|
|
5621
|
+
...(Array.isArray(resolvedProp.oneOf) ? resolvedProp.oneOf : []),
|
|
5622
|
+
...(Array.isArray(resolvedProp.anyOf) ? resolvedProp.anyOf : []),
|
|
5623
|
+
];
|
|
5624
|
+
return rawVariants
|
|
5625
|
+
.filter((variant) => variant && typeof variant === 'object' && !Array.isArray(variant))
|
|
5626
|
+
.map((variant) => this.resolveSchemaNode(variant, rootSchema));
|
|
5627
|
+
}
|
|
5628
|
+
isArrayVariant(variant) {
|
|
5629
|
+
return this.extractSchemaNonNullTypes(variant).includes('array');
|
|
5630
|
+
}
|
|
5631
|
+
isObjectVariant(variant) {
|
|
5632
|
+
const types = this.extractSchemaNonNullTypes(variant);
|
|
5633
|
+
return (types.includes('object') ||
|
|
5634
|
+
(types.length === 0 &&
|
|
5635
|
+
!!variant?.properties &&
|
|
5636
|
+
typeof variant.properties === 'object' &&
|
|
5637
|
+
!Array.isArray(variant.properties)));
|
|
5638
|
+
}
|
|
5639
|
+
isCanonicalMonetaryRangeUnion(prop, rootSchema) {
|
|
5640
|
+
const variants = this.extractUnionVariants(prop, rootSchema);
|
|
5641
|
+
if (variants.length === 0) {
|
|
5642
|
+
return false;
|
|
5643
|
+
}
|
|
5644
|
+
const hasArrayBranch = variants.some((variant) => this.isArrayVariant(variant));
|
|
5645
|
+
if (!hasArrayBranch) {
|
|
5646
|
+
return false;
|
|
5647
|
+
}
|
|
5648
|
+
return variants.some((variant) => {
|
|
5649
|
+
if (!this.isObjectVariant(variant)) {
|
|
5650
|
+
return false;
|
|
5651
|
+
}
|
|
5652
|
+
const props = variant?.properties;
|
|
5653
|
+
if (!props || typeof props !== 'object' || Array.isArray(props)) {
|
|
5654
|
+
return false;
|
|
5655
|
+
}
|
|
5656
|
+
return (Object.prototype.hasOwnProperty.call(props, 'minPrice') &&
|
|
5657
|
+
props.minPrice != null &&
|
|
5658
|
+
Object.prototype.hasOwnProperty.call(props, 'maxPrice') &&
|
|
5659
|
+
props.maxPrice != null);
|
|
5660
|
+
});
|
|
5661
|
+
}
|
|
5662
|
+
inferRequireTwoBoundsFromUnion(prop, rootSchema) {
|
|
5663
|
+
const variants = this.extractUnionVariants(prop, rootSchema);
|
|
5664
|
+
if (variants.length === 0) {
|
|
5665
|
+
return false;
|
|
5666
|
+
}
|
|
5667
|
+
const requiredPairs = [
|
|
5668
|
+
['minPrice', 'maxPrice'],
|
|
5669
|
+
['min', 'max'],
|
|
5670
|
+
['startDate', 'endDate'],
|
|
5671
|
+
];
|
|
5672
|
+
for (const variant of variants) {
|
|
5673
|
+
if (this.isArrayVariant(variant) && Number(variant?.minItems) === 2) {
|
|
5674
|
+
return true;
|
|
5675
|
+
}
|
|
5676
|
+
if (this.isObjectVariant(variant) && Array.isArray(variant?.required)) {
|
|
5677
|
+
const requiredSet = new Set(variant.required.filter((entry) => typeof entry === 'string'));
|
|
5678
|
+
if (requiredPairs.some(([lower, upper]) => requiredSet.has(lower) && requiredSet.has(upper))) {
|
|
5679
|
+
return true;
|
|
5680
|
+
}
|
|
5681
|
+
}
|
|
5682
|
+
}
|
|
5683
|
+
return false;
|
|
5684
|
+
}
|
|
5685
|
+
resolveFieldType(prop, ui, rootSchema) {
|
|
5686
|
+
if (this.isCanonicalMonetaryRangeUnion(prop, rootSchema)) {
|
|
5687
|
+
return 'array';
|
|
5688
|
+
}
|
|
4778
5689
|
if (ui?.type !== undefined && ui?.type !== null && String(ui.type).trim() !== '') {
|
|
4779
5690
|
return String(ui.type);
|
|
4780
5691
|
}
|
|
4781
5692
|
if (String(ui?.controlType ?? '').trim() === 'array') {
|
|
4782
5693
|
return 'array';
|
|
4783
5694
|
}
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
5695
|
+
const resolvedProp = this.resolveSchemaNode(prop, rootSchema);
|
|
5696
|
+
const propTypes = this.extractSchemaNonNullTypes(resolvedProp);
|
|
5697
|
+
if (propTypes.length === 1) {
|
|
5698
|
+
return propTypes[0];
|
|
4787
5699
|
}
|
|
4788
|
-
if (
|
|
4789
|
-
return String(
|
|
5700
|
+
if (resolvedProp?.type && !Array.isArray(resolvedProp.type)) {
|
|
5701
|
+
return String(resolvedProp.type);
|
|
4790
5702
|
}
|
|
4791
|
-
const variants =
|
|
4792
|
-
|
|
4793
|
-
...(Array.isArray(prop?.anyOf) ? prop.anyOf : []),
|
|
4794
|
-
].filter((variant) => variant && typeof variant === 'object');
|
|
4795
|
-
const nonNullTypes = Array.from(new Set(variants
|
|
4796
|
-
.map((variant) => (typeof variant.type === 'string' ? variant.type.trim() : ''))
|
|
4797
|
-
.filter((type) => !!type && type !== 'null')));
|
|
5703
|
+
const variants = this.extractUnionVariants(prop, rootSchema);
|
|
5704
|
+
const nonNullTypes = Array.from(new Set(variants.flatMap((variant) => this.extractSchemaNonNullTypes(variant))));
|
|
4798
5705
|
if (nonNullTypes.length === 1) {
|
|
4799
5706
|
return nonNullTypes[0];
|
|
4800
5707
|
}
|