@fuentis/phoenix-ui 0.0.9-alpha.658 → 0.0.9-alpha.660
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/fesm2022/fuentis-phoenix-ui.mjs +544 -1073
- package/fesm2022/fuentis-phoenix-ui.mjs.map +1 -1
- package/index.d.ts +96 -166
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import * as rxjs from 'rxjs';
|
|
|
7
7
|
import { Subject, Subscription, Observable } from 'rxjs';
|
|
8
8
|
import { Router } from '@angular/router';
|
|
9
9
|
import { Table } from 'primeng/table';
|
|
10
|
-
import * as _angular_forms from '@angular/forms';
|
|
11
10
|
import { FormGroup, FormBuilder, AbstractControl } from '@angular/forms';
|
|
12
11
|
import { HttpClient } from '@angular/common/http';
|
|
13
12
|
import { DynamicDialogRef, DynamicDialogConfig } from 'primeng/dynamicdialog';
|
|
@@ -1436,143 +1435,96 @@ interface MetaFormV2Config {
|
|
|
1436
1435
|
}
|
|
1437
1436
|
|
|
1438
1437
|
type AccordionValue = string | number | string[] | number[] | null | undefined;
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
/**
|
|
1456
|
-
|
|
1457
|
-
/** Optional
|
|
1458
|
-
|
|
1459
|
-
/**
|
|
1438
|
+
/**
|
|
1439
|
+
* V2 form host. Signal-based (OnPush): inputs are `input()` signals, the
|
|
1440
|
+
* template-facing structure (`hasControls`/`isGrouped`/`groupedControls`/
|
|
1441
|
+
* `controlRows`) is `computed()` (so `splitControlsIntoRows` runs only when the
|
|
1442
|
+
* config changes, not on every CD pass), and `expandedGroupIds` is a signal.
|
|
1443
|
+
*
|
|
1444
|
+
* Reactive forms aren't signal-native, so control building stays imperative: the
|
|
1445
|
+
* first build runs synchronously in `ngOnInit` (controls exist before first
|
|
1446
|
+
* paint), and an `effect()` re-runs the same build when `config`/`form`/`readOnly`
|
|
1447
|
+
* change — with the same change-detection semantics the old `ngOnChanges` had.
|
|
1448
|
+
*/
|
|
1449
|
+
declare class MetaFormV2Component implements OnInit, OnDestroy {
|
|
1450
|
+
/** Form instance created/owned by the parent (dialog/page). */
|
|
1451
|
+
readonly form: i0.InputSignal<FormGroup<any>>;
|
|
1452
|
+
/** V2 metadata/config (controls, initialValues, submitValidators, setupDependencies). */
|
|
1453
|
+
readonly config: i0.InputSignal<MetaFormV2Config>;
|
|
1454
|
+
/** Page-level readOnly state (rendering + "enter edit mode" behavior). */
|
|
1455
|
+
readonly readOnly: i0.InputSignal<boolean>;
|
|
1456
|
+
/** Optional layout customization for the inner content wrapper. */
|
|
1457
|
+
readonly contentStyle: i0.InputSignal<Record<string, any> | null>;
|
|
1458
|
+
/** Optional class name(s) for the inner content wrapper. */
|
|
1459
|
+
readonly contentClass: i0.InputSignal<string | null>;
|
|
1460
1460
|
private fb;
|
|
1461
|
-
/** Registers and executes submit-only validators (async validation on submit) */
|
|
1462
1461
|
private submitValidator;
|
|
1463
|
-
/** Used for validator localization (lang-dependent validators / messages) */
|
|
1464
1462
|
private translate;
|
|
1465
|
-
/**
|
|
1466
|
-
* A lightweight signature of the current metadata structure.
|
|
1467
|
-
* Used to detect when the form schema changes (and avoid unnecessary resets).
|
|
1468
|
-
*/
|
|
1463
|
+
/** Signature of the current schema (key+type only) to detect real schema changes. */
|
|
1469
1464
|
private lastSignature;
|
|
1470
|
-
/**
|
|
1471
|
-
* Cleanup function returned by setupDependencies (if any).
|
|
1472
|
-
* Called only when metadata structure changes or on destroy.
|
|
1473
|
-
*/
|
|
1465
|
+
/** Cleanup from setupDependencies; called on schema change or destroy. */
|
|
1474
1466
|
private depCleanup?;
|
|
1467
|
+
/** Previous input references, to reproduce the old SimpleChanges semantics. */
|
|
1468
|
+
private prevConfig;
|
|
1469
|
+
private prevForm;
|
|
1470
|
+
private prevReadOnly;
|
|
1471
|
+
private initialized;
|
|
1472
|
+
/** PrimeNG Accordion opened-panel ids. */
|
|
1473
|
+
readonly expandedGroupIds: i0.WritableSignal<string[]>;
|
|
1474
|
+
readonly hasControls: i0.Signal<boolean>;
|
|
1475
|
+
/** Heuristic: grouped config has "ctrl" on the first element. */
|
|
1476
|
+
readonly isGrouped: i0.Signal<boolean>;
|
|
1477
|
+
readonly groupedControls: i0.Signal<any[]>;
|
|
1478
|
+
readonly flatControls: i0.Signal<any[]>;
|
|
1479
|
+
/** Flat schema split into rows, honoring `style.newRow` hard breaks. */
|
|
1480
|
+
readonly controlRows: i0.Signal<any[][]>;
|
|
1481
|
+
constructor();
|
|
1482
|
+
ngOnInit(): void;
|
|
1475
1483
|
/**
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1478
|
-
|
|
1479
|
-
expandedGroupIds: string[];
|
|
1480
|
-
ngOnChanges(changes: SimpleChanges): void;
|
|
1481
|
-
/**
|
|
1482
|
-
* PrimeNG Accordion emits value as:
|
|
1483
|
-
* - single id (string/number)
|
|
1484
|
-
* - array of ids
|
|
1485
|
-
* We normalize everything into string[] for stable internal state.
|
|
1484
|
+
* Ensures controls, patches initial values, wires validators/dependencies and
|
|
1485
|
+
* initializes accordion state — only when config/form/readOnly actually change
|
|
1486
|
+
* (same early-exit the old ngOnChanges had).
|
|
1486
1487
|
*/
|
|
1488
|
+
private rebuild;
|
|
1489
|
+
/** Normalizes PrimeNG Accordion value into a stable string[]. */
|
|
1487
1490
|
onAccordionValueChange(v: AccordionValue): void;
|
|
1488
|
-
/** Normalizes Accordion value into a stable string[] representation */
|
|
1489
1491
|
private normalizeAccordionValue;
|
|
1490
|
-
/**
|
|
1491
|
-
get hasControls(): boolean;
|
|
1492
|
-
/**
|
|
1493
|
-
* Heuristic: grouped config has "ctrl" on first element.
|
|
1494
|
-
* (Keeps template simple and avoids extra schema fields.)
|
|
1495
|
-
*/
|
|
1496
|
-
get isGrouped(): boolean;
|
|
1497
|
-
/** Returns grouped schema structure (accordion groups) */
|
|
1498
|
-
get groupedControls(): any[];
|
|
1499
|
-
/** Returns flat schema structure (grid mode) */
|
|
1500
|
-
get flatControls(): any[];
|
|
1501
|
-
/**
|
|
1502
|
-
* Flat schema split into row chunks, honoring `style.newRow` hard breaks.
|
|
1503
|
-
* Used by the non-grouped grid template.
|
|
1504
|
-
*/
|
|
1505
|
-
get controlRows(): any[][];
|
|
1506
|
-
/** TrackBy for group rendering */
|
|
1492
|
+
/** TrackBy for group rendering. */
|
|
1507
1493
|
groupTrack(g: any, idx: number): any;
|
|
1508
|
-
/**
|
|
1509
|
-
* PrimeNG accordion panel `value` must match accordion `value` type.
|
|
1510
|
-
* We always convert group id to string for consistent behavior.
|
|
1511
|
-
*/
|
|
1494
|
+
/** Group id as a string (matches the accordion `value` type). */
|
|
1512
1495
|
panelValue(g: any): string;
|
|
1513
|
-
/**
|
|
1514
|
-
* Marks & validates ONLY controls that already have meaningful values.
|
|
1515
|
-
* This is used when switching from readOnly -> edit mode to avoid:
|
|
1516
|
-
* - triggering "required" errors for empty fields
|
|
1517
|
-
* - expanding groups based on empty mandatory fields on CREATE dialogs
|
|
1518
|
-
*/
|
|
1496
|
+
/** Marks & validates ONLY controls that already have meaningful values. */
|
|
1519
1497
|
private touchAndValidateOnlyFilledControls;
|
|
1520
|
-
/**
|
|
1521
|
-
* Defines what counts as a "meaningful" value:
|
|
1522
|
-
* - non-empty strings
|
|
1523
|
-
* - numbers / booleans
|
|
1524
|
-
* - non-empty arrays
|
|
1525
|
-
* - objects with common identifiers (key/uuid/id) or any own keys
|
|
1526
|
-
*/
|
|
1498
|
+
/** What counts as a "meaningful" value (non-empty string/number/boolean/array/object). */
|
|
1527
1499
|
private hasMeaningfulValue;
|
|
1528
|
-
/**
|
|
1529
|
-
* "Visible invalid" means:
|
|
1530
|
-
* - invalid
|
|
1531
|
-
* - AND user has interacted with it (touched or dirty)
|
|
1532
|
-
* This matches typical UI behavior: show errors only after interaction.
|
|
1533
|
-
*/
|
|
1500
|
+
/** "Visible invalid" = invalid AND interacted with (touched/dirty). */
|
|
1534
1501
|
private isVisibleInvalid;
|
|
1535
|
-
/**
|
|
1536
|
-
* Checks if a group contains at least one visible invalid control.
|
|
1537
|
-
* Used to auto-expand groups when entering edit mode.
|
|
1538
|
-
*/
|
|
1539
1502
|
private groupHasVisibleInvalid;
|
|
1540
|
-
/**
|
|
1541
|
-
* Expands all groups that contain visible invalid controls,
|
|
1542
|
-
* while preserving any groups already expanded by the user.
|
|
1543
|
-
*/
|
|
1503
|
+
/** Expands groups with visible-invalid controls, preserving user-expanded ones. */
|
|
1544
1504
|
private expandVisibleInvalidGroupsUnion;
|
|
1545
|
-
/** Cleanup dependency subscriptions when component is destroyed */
|
|
1546
1505
|
ngOnDestroy(): void;
|
|
1547
1506
|
static ɵfac: i0.ɵɵFactoryDeclaration<MetaFormV2Component, never>;
|
|
1548
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<MetaFormV2Component, "phoenix-meta-form-v2", never, { "form": { "alias": "form"; "required": true; }; "config": { "alias": "config"; "required": true; }; "readOnly": { "alias": "readOnly"; "required": false; }; "contentStyle": { "alias": "contentStyle"; "required": false; }; "contentClass": { "alias": "contentClass"; "required": false; }; }, {}, never, never, true, never>;
|
|
1507
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MetaFormV2Component, "phoenix-meta-form-v2", never, { "form": { "alias": "form"; "required": true; "isSignal": true; }; "config": { "alias": "config"; "required": true; "isSignal": true; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "contentStyle": { "alias": "contentStyle"; "required": false; "isSignal": true; }; "contentClass": { "alias": "contentClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1549
1508
|
}
|
|
1550
1509
|
|
|
1510
|
+
/**
|
|
1511
|
+
* Renders one meta field. Signal-based (OnPush): every template-facing value is a
|
|
1512
|
+
* `computed()` so it is memoized and recomputed only when its inputs actually
|
|
1513
|
+
* change — instead of a plain method re-running on every change-detection pass.
|
|
1514
|
+
* Control state (value/status) is bridged into a signal (`controlTick`), so the
|
|
1515
|
+
* error helpers stay reactive without a manual `markForCheck()`.
|
|
1516
|
+
*/
|
|
1551
1517
|
declare class MetaFormFieldV2Component {
|
|
1552
1518
|
/** Metadata definition of the field (type, key, options, styles, flags, etc.) */
|
|
1553
|
-
field: MetaFieldConfig
|
|
1554
|
-
/** Parent FormGroup that contains the FormControl for this field */
|
|
1555
|
-
form: FormGroup
|
|
1556
|
-
/**
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
readOnly: boolean;
|
|
1561
|
-
/**
|
|
1562
|
-
* Global disable flag (e.g. parent dialog toggles entire form disabled).
|
|
1563
|
-
* This is merged with field-level disable configuration.
|
|
1564
|
-
*/
|
|
1565
|
-
disableForm: boolean;
|
|
1566
|
-
/** Used to manually trigger change detection for OnPush strategy */
|
|
1567
|
-
private cdr;
|
|
1568
|
-
/** Used to automatically unsubscribe from value/status streams on destroy */
|
|
1569
|
-
private dr;
|
|
1570
|
-
/** Translation service for validation and display labels */
|
|
1519
|
+
readonly field: i0.InputSignal<MetaFieldConfig>;
|
|
1520
|
+
/** Parent FormGroup that contains the FormControl for this field. */
|
|
1521
|
+
readonly form: i0.InputSignal<FormGroup<any>>;
|
|
1522
|
+
/** Page-level read-only flag (renders the read-only view). */
|
|
1523
|
+
readonly readOnly: i0.InputSignal<boolean>;
|
|
1524
|
+
/** Global disable flag (merged with the field-level disable config). */
|
|
1525
|
+
readonly disableForm: i0.InputSignal<boolean>;
|
|
1571
1526
|
private translate;
|
|
1572
|
-
/**
|
|
1573
|
-
* Exposed enum-like mapping of MetaFieldType for template usage.
|
|
1574
|
-
* Keeps templates readable and avoids magic strings.
|
|
1575
|
-
*/
|
|
1527
|
+
/** Enum-like map for the template `@switch`. */
|
|
1576
1528
|
readonly MetaFieldType: Readonly<{
|
|
1577
1529
|
TEXT: "TEXT";
|
|
1578
1530
|
URL: "URL";
|
|
@@ -1599,62 +1551,40 @@ declare class MetaFormFieldV2Component {
|
|
|
1599
1551
|
LINKS_DATA: "LINKS_DATA";
|
|
1600
1552
|
SLOT: "SLOT";
|
|
1601
1553
|
}>;
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
*
|
|
1615
|
-
* -
|
|
1616
|
-
*/
|
|
1617
|
-
|
|
1618
|
-
/**
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1554
|
+
readonly key: i0.Signal<string>;
|
|
1555
|
+
readonly type: i0.Signal<MetaFieldType>;
|
|
1556
|
+
readonly colClass: i0.Signal<string>;
|
|
1557
|
+
readonly userFriendlyMessage: i0.Signal<string | null>;
|
|
1558
|
+
readonly placeholderKey: i0.Signal<string | null>;
|
|
1559
|
+
readonly isReadOnly: i0.Signal<boolean>;
|
|
1560
|
+
readonly isDisabled: i0.Signal<boolean>;
|
|
1561
|
+
readonly isCheckbox: i0.Signal<boolean>;
|
|
1562
|
+
/** The underlying FormControl for this field (recomputed if form/key change). */
|
|
1563
|
+
readonly ctrl: i0.Signal<AbstractControl<any, any, any> | null>;
|
|
1564
|
+
/**
|
|
1565
|
+
* Bridge the current control's value/status stream into a signal so the error
|
|
1566
|
+
* helpers below recompute reactively (reactive forms aren't signal-native yet).
|
|
1567
|
+
* Re-subscribes when the control identity changes.
|
|
1568
|
+
*/
|
|
1569
|
+
private readonly controlTick;
|
|
1570
|
+
/** Bumped for silent (emitEvent:false) programmatic writes, e.g. the date field. */
|
|
1571
|
+
private readonly manualTick;
|
|
1572
|
+
/** Track the active language so translated error text refreshes on lang change. */
|
|
1573
|
+
private readonly lang;
|
|
1574
|
+
/** Show validation only after interaction (touched/dirty). */
|
|
1575
|
+
readonly showError: i0.Signal<boolean>;
|
|
1576
|
+
/** Normalized error key for the current control. */
|
|
1577
|
+
readonly errorKey: i0.Signal<string | null>;
|
|
1578
|
+
/** Translated validation message (the single place that owns error UX text). */
|
|
1579
|
+
readonly errorText: i0.Signal<string>;
|
|
1580
|
+
/** Minimal value formatter for legacy read-only rendering (not used in template). */
|
|
1629
1581
|
displayValue(): any;
|
|
1630
|
-
/**
|
|
1631
|
-
* Determines whether validation error should be displayed.
|
|
1632
|
-
* Errors are shown only after user interaction (touched or dirty).
|
|
1633
|
-
*/
|
|
1634
|
-
showError(): boolean;
|
|
1635
|
-
/**
|
|
1636
|
-
* Maps control error object to a normalized error key.
|
|
1637
|
-
* Supports:
|
|
1638
|
-
* - Angular built-in validators
|
|
1639
|
-
* - Phoenix custom validators
|
|
1640
|
-
* - Submit-only async validators
|
|
1641
|
-
*/
|
|
1642
|
-
errorKey(): string | null;
|
|
1643
|
-
/**
|
|
1644
|
-
* Resolves translated error message based on errorKey().
|
|
1645
|
-
* This is the single place responsible for validation message UX.
|
|
1646
|
-
*/
|
|
1647
|
-
errorText(): string;
|
|
1648
|
-
/**
|
|
1649
|
-
* Lightweight text formatter for simple read-only display use cases.
|
|
1650
|
-
* This is used mainly for inline displays and summary UIs.
|
|
1651
|
-
*/
|
|
1582
|
+
/** Lightweight text formatter for simple read-only/summary display. */
|
|
1652
1583
|
valueText(): string;
|
|
1653
|
-
isCheckbox(): boolean;
|
|
1654
1584
|
onDateSelected(val: any): void;
|
|
1655
1585
|
onDateCleared(): void;
|
|
1656
1586
|
static ɵfac: i0.ɵɵFactoryDeclaration<MetaFormFieldV2Component, never>;
|
|
1657
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<MetaFormFieldV2Component, "phoenix-meta-form-field-v2", never, { "field": { "alias": "field"; "required": true; }; "form": { "alias": "form"; "required": true; }; "readOnly": { "alias": "readOnly"; "required": false; }; "disableForm": { "alias": "disableForm"; "required": false; }; }, {}, never, never, true, never>;
|
|
1587
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MetaFormFieldV2Component, "phoenix-meta-form-field-v2", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "form": { "alias": "form"; "required": true; "isSignal": true; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "disableForm": { "alias": "disableForm"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1658
1588
|
}
|
|
1659
1589
|
|
|
1660
1590
|
declare class MetaFormGroupV2Component {
|