ng-form-foundry 0.3.2 → 0.3.4
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 +11 -2
- package/fesm2022/ng-form-foundry.mjs +272 -54
- package/fesm2022/ng-form-foundry.mjs.map +1 -1
- package/index.d.ts +81 -17
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -114,6 +114,14 @@ type NodeGroup = {
|
|
|
114
114
|
*/
|
|
115
115
|
presence?: boolean;
|
|
116
116
|
description?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Minimum / maximum number of keys present in the group's value (JSON Schema
|
|
119
|
+
* `minProperties`/`maxProperties` on a closed object). Meaningful when
|
|
120
|
+
* children are presence-optional: the group carries a `minPresent` /
|
|
121
|
+
* `maxPresent` error while the count of enabled children is out of range.
|
|
122
|
+
*/
|
|
123
|
+
minPresent?: number;
|
|
124
|
+
maxPresent?: number;
|
|
117
125
|
children: Record<string, NodeType>;
|
|
118
126
|
appearance?: Appearance;
|
|
119
127
|
};
|
|
@@ -206,9 +214,10 @@ type DFormGroup<T extends NodeGroup> = FormGroup<FormGroupType<T>>;
|
|
|
206
214
|
declare function caseFields(body: ChoiceCase): Record<string, NodeType>;
|
|
207
215
|
/**
|
|
208
216
|
* The active case of a choice: an explicit `__case` in the initial value, else
|
|
209
|
-
* the case
|
|
210
|
-
* `__case`), else the schema `default`. This lets a choice
|
|
211
|
-
* instance data whose branch is discriminated by which fields
|
|
217
|
+
* the case {@link inferChoiceCase} ranks best against the initial data (inline
|
|
218
|
+
* wire data carries no `__case`), else the schema `default`. This lets a choice
|
|
219
|
+
* seed from real instance data whose branch is discriminated by which fields
|
|
220
|
+
* are present and required.
|
|
212
221
|
*/
|
|
213
222
|
declare function resolveChoiceCase(choice: NodeChoice, initial?: Record<string, unknown> | null): string | undefined;
|
|
214
223
|
/**
|
|
@@ -413,6 +422,10 @@ interface DetailSection {
|
|
|
413
422
|
schema: NodeGroup | null;
|
|
414
423
|
/** The group `schema` binds to (the node's group; for a choice, the choice group). */
|
|
415
424
|
group: FormGroup | null;
|
|
425
|
+
/** A trailing add-control section of a list / complex map: renders after the last item, with no heading. */
|
|
426
|
+
footer?: boolean;
|
|
427
|
+
/** The section continues a run of same-list items / same-map entries: its heading draws no divider line. */
|
|
428
|
+
continuation?: boolean;
|
|
416
429
|
}
|
|
417
430
|
/**
|
|
418
431
|
* A navigable node in the config tree. Its `id` is the node's stable path from
|
|
@@ -485,8 +498,12 @@ declare class ConfigEditorComponent implements OnDestroy {
|
|
|
485
498
|
readonly schema: _angular_core.InputSignal<NodeGroup>;
|
|
486
499
|
/** The schema-built reactive group the editor binds to and mutates. */
|
|
487
500
|
readonly formGroup: _angular_core.InputSignal<FormGroup<any>>;
|
|
488
|
-
/**
|
|
489
|
-
|
|
501
|
+
/**
|
|
502
|
+
* Whether fields accept input and structural controls (add/remove/menus)
|
|
503
|
+
* show. Two-way bindable: the root tree row carries a toggle, so the editor
|
|
504
|
+
* can flip it itself and the host observes the change.
|
|
505
|
+
*/
|
|
506
|
+
readonly editable: _angular_core.ModelSignal<boolean>;
|
|
490
507
|
root: TreeNode;
|
|
491
508
|
selected: TreeNode | null;
|
|
492
509
|
/** The selected subtree as a flat, breadcrumb-separated section list. */
|
|
@@ -521,15 +538,20 @@ declare class ConfigEditorComponent implements OnDestroy {
|
|
|
521
538
|
* descendants, so an error anywhere below lights every ancestor row.
|
|
522
539
|
*/
|
|
523
540
|
protected hasError(node: TreeNode): boolean;
|
|
524
|
-
/**
|
|
525
|
-
|
|
541
|
+
/**
|
|
542
|
+
* Append a new item to a list node's FormArray (up to `maxItems`). A tree-row
|
|
543
|
+
* add selects the new item; a detail-pane add passes `keepSelection` so the
|
|
544
|
+
* current (possibly ancestor) view stays put and the item appears as a new
|
|
545
|
+
* section in it.
|
|
546
|
+
*/
|
|
547
|
+
addItem(listNode: TreeNode, keepSelection?: boolean): void;
|
|
526
548
|
/**
|
|
527
549
|
* Remove a list item from its FormArray (down to `minItems`). List-item
|
|
528
550
|
* identity is positional, so expansion state under the list is cleared —
|
|
529
551
|
* otherwise it would silently migrate to the items that shift into the
|
|
530
552
|
* removed indexes.
|
|
531
553
|
*/
|
|
532
|
-
removeItem(listNode: TreeNode, item: TreeNode): void;
|
|
554
|
+
removeItem(listNode: TreeNode, item: TreeNode, keepSelection?: boolean): void;
|
|
533
555
|
/** The just-added optional leaf (section path + key) whose field grabs focus when rendered. */
|
|
534
556
|
protected focusSectionId: string | null;
|
|
535
557
|
protected focusLeafKey: string | null;
|
|
@@ -543,23 +565,40 @@ declare class ConfigEditorComponent implements OnDestroy {
|
|
|
543
565
|
activeCaseLabel(node: TreeNode): string | null;
|
|
544
566
|
/** The display label for a case: the schema's `caseLabels` entry, else the case name. */
|
|
545
567
|
protected caseLabel(choice: NodeChoice, caseName: string): string;
|
|
546
|
-
/**
|
|
568
|
+
/**
|
|
569
|
+
* Switch a choice node's active case from its detail selector; the
|
|
570
|
+
* structural sync rebuilds the tree and sections. The tree selection stays
|
|
571
|
+
* where it is: detail edits must never steal it, or a flattened ancestor
|
|
572
|
+
* view would collapse to the choice node mid-edit. Selection moves only
|
|
573
|
+
* through the tree itself.
|
|
574
|
+
*/
|
|
547
575
|
switchTreeCase(node: TreeNode, caseName: string): void;
|
|
548
576
|
protected objectKeys(obj: Record<string, unknown>): string[];
|
|
549
|
-
/**
|
|
550
|
-
|
|
577
|
+
/**
|
|
578
|
+
* Append a new entry to a complex map node under a generated unique key. A
|
|
579
|
+
* tree-row add selects the new entry; a detail-pane add passes
|
|
580
|
+
* `keepSelection` so the current view stays put (see {@link addItem}).
|
|
581
|
+
*/
|
|
582
|
+
addTreeMapEntry(mapNode: TreeNode, keepSelection?: boolean): void;
|
|
551
583
|
/** Remove a complex map entry (down to `minEntries`). */
|
|
552
|
-
removeTreeMapEntry(mapNode: TreeNode, entryNode: TreeNode): void;
|
|
584
|
+
removeTreeMapEntry(mapNode: TreeNode, entryNode: TreeNode, keepSelection?: boolean): void;
|
|
553
585
|
/**
|
|
554
|
-
* Commit a rename-on-blur of a map entry's key; on success the
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
586
|
+
* Commit a rename-on-blur of a map entry's key; on success the selection is
|
|
587
|
+
* remapped to the entry's new identity when it pointed at (or inside) the
|
|
588
|
+
* entry — otherwise it stays put — and the fresh key field regains focus
|
|
589
|
+
* (the rename re-renders the section under a new id, destroying the input
|
|
590
|
+
* that held focus).
|
|
558
591
|
*/
|
|
559
592
|
renameTreeMapEntry(entryNode: TreeNode, rawKey: string): void;
|
|
560
593
|
/** Move keyboard focus to the selected tree row once the action's re-render settles. */
|
|
561
594
|
private focusSelectedRow;
|
|
562
595
|
/** A muted hint for a section whose node currently renders no content of its own. */
|
|
596
|
+
/**
|
|
597
|
+
* Explains a group's `minPresent`/`maxPresent` violation next to the red
|
|
598
|
+
* tree marker: the fix is enabling or removing optional fields, which is not
|
|
599
|
+
* evident from any single field's own error.
|
|
600
|
+
*/
|
|
601
|
+
protected presentRangeHint(s: DetailSection): string | null;
|
|
563
602
|
protected emptySectionHint(s: DetailSection): string | null;
|
|
564
603
|
/** Whether a list node is at `maxItems` (the add control is hidden). */
|
|
565
604
|
protected listAtMax(node: TreeNode | undefined): boolean;
|
|
@@ -595,6 +634,31 @@ declare class ConfigEditorComponent implements OnDestroy {
|
|
|
595
634
|
* chrome — the headings are the boundaries between children.
|
|
596
635
|
*/
|
|
597
636
|
private buildSections;
|
|
637
|
+
/**
|
|
638
|
+
* Whether a section renders anything beyond its heading: a leaf slice, the
|
|
639
|
+
* chrome of its node kind (case selector, key field, add controls), or a
|
|
640
|
+
* present-children error that needs explaining. Heading-only sections are
|
|
641
|
+
* dropped from the flat list — a divider with nothing under it is clutter.
|
|
642
|
+
*/
|
|
643
|
+
private sectionHasContent;
|
|
644
|
+
/** Every expandable node currently expanded — drives the root row's expand/collapse-all toggle. */
|
|
645
|
+
protected allExpanded(): boolean;
|
|
646
|
+
/**
|
|
647
|
+
* Expand every expandable node, or collapse back when all are open. The
|
|
648
|
+
* collapse keeps the root open — a tree reduced to one row reads as empty.
|
|
649
|
+
*/
|
|
650
|
+
protected toggleExpandAll(): void;
|
|
651
|
+
/** The selected member's container (list / map), for the breadcrumb's remove control. */
|
|
652
|
+
protected selectedMemberParent(): TreeNode | null;
|
|
653
|
+
/** The section node's container (list / map), for member controls in its heading. */
|
|
654
|
+
protected memberParent(s: DetailSection): TreeNode | null;
|
|
655
|
+
/**
|
|
656
|
+
* Flag the sections that continue a run of siblings — a list item or map
|
|
657
|
+
* entry whose preceding section is inside the same container. Their headings
|
|
658
|
+
* draw no divider line, so a run of same-kind members reads as one list
|
|
659
|
+
* rather than a stack of separated blocks.
|
|
660
|
+
*/
|
|
661
|
+
private markContinuations;
|
|
598
662
|
/** A section's own renderable fields: a leaf-only schema slice and the group it binds to. */
|
|
599
663
|
private sectionContent;
|
|
600
664
|
/**
|
|
@@ -619,7 +683,7 @@ declare class ConfigEditorComponent implements OnDestroy {
|
|
|
619
683
|
*/
|
|
620
684
|
private escapeSeg;
|
|
621
685
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ConfigEditorComponent, never>;
|
|
622
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ConfigEditorComponent, "nff-config-editor", never, { "schema": { "alias": "schema"; "required": true; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": true; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
686
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ConfigEditorComponent, "nff-config-editor", never, { "schema": { "alias": "schema"; "required": true; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": true; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; }, { "editable": "editableChange"; }, never, never, true, never>;
|
|
623
687
|
}
|
|
624
688
|
|
|
625
689
|
declare class LeafRendererComponent implements AfterViewInit {
|
package/package.json
CHANGED