@ng-simplicity/forms-core 1.1.3 → 1.1.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 +10 -2
- package/fesm2022/ng-simplicity-forms-core.mjs +230 -66
- package/fesm2022/ng-simplicity-forms-core.mjs.map +1 -1
- package/index.d.ts +115 -39
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import * as rxjs from 'rxjs';
|
|
2
1
|
import { Subject, Subscription, Observable, BehaviorSubject } from 'rxjs';
|
|
3
2
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { OnInit, OnDestroy, Signal, Type, InjectionToken, Injector, ViewContainerRef, ChangeDetectorRef } from '@angular/core';
|
|
3
|
+
import { OnInit, OnDestroy, Signal, Type, InjectionToken, Injector, ViewContainerRef, ChangeDetectorRef, OnChanges, SimpleChanges } from '@angular/core';
|
|
5
4
|
import * as _angular_forms from '@angular/forms';
|
|
6
|
-
import { ValidatorFn, UntypedFormControl, FormGroup,
|
|
5
|
+
import { ValidatorFn, AbstractControl, UntypedFormControl, FormGroup, UntypedFormGroup, UntypedFormArray, FormArray } from '@angular/forms';
|
|
7
6
|
import * as _ng_simplicity_forms_core from '@ng-simplicity/forms-core';
|
|
8
7
|
import * as i1 from '@angular/common';
|
|
9
8
|
|
|
@@ -39,8 +38,8 @@ type NgsFormsFormErrorKeyValueMap = {
|
|
|
39
38
|
|
|
40
39
|
/** One option of a radio group or select. */
|
|
41
40
|
interface NgsFormsFormInputOption {
|
|
42
|
-
/** Value written to the form control when the option is chosen. */
|
|
43
|
-
id: string;
|
|
41
|
+
/** Value written to the form control when the option is chosen. Numbers stay numbers. */
|
|
42
|
+
id: string | number;
|
|
44
43
|
/** Text shown to the user. */
|
|
45
44
|
label: string;
|
|
46
45
|
/** Renders the option but prevents choosing it. */
|
|
@@ -133,10 +132,7 @@ interface NgsFormsFormItemConfigBaseItemWithNameAndValidators extends NgsFormsFo
|
|
|
133
132
|
validators?: Array<ValidatorFn>;
|
|
134
133
|
/**
|
|
135
134
|
* Stream of validator arrays. Each emission replaces the control's validators, which lets rules depend on other
|
|
136
|
-
* values in the form. Ignored when `validators` is also set.
|
|
137
|
-
*
|
|
138
|
-
* @remarks The control's validity is recalculated on its next value change, so call `updateValueAndValidity()`
|
|
139
|
-
* yourself if you need the new rules to apply immediately.
|
|
135
|
+
* values in the form. The control is re-validated on each emission. Ignored when `validators` is also set.
|
|
140
136
|
*/
|
|
141
137
|
validators$?: Observable<Array<ValidatorFn>>;
|
|
142
138
|
}
|
|
@@ -210,6 +206,8 @@ interface NgsFormsCommonComponentState {
|
|
|
210
206
|
displayMode?: 'input' | 'summary';
|
|
211
207
|
/** Whether to show a control that lets the user switch between `summary` and `input`. */
|
|
212
208
|
showEditToggle?: boolean;
|
|
209
|
+
/** Your own keys. Read them from `commonState()` in custom components. */
|
|
210
|
+
[key: string]: unknown;
|
|
213
211
|
}
|
|
214
212
|
|
|
215
213
|
interface NgsFormsGlobalFormState extends NgsFormsCommonComponentState {
|
|
@@ -288,10 +286,14 @@ declare abstract class NgsFormsBaseClassFormComponent<T extends NgsFormsFormItem
|
|
|
288
286
|
* Base class for items that own a form control. Creates the control (seeded with `value` when the config has one),
|
|
289
287
|
* applies `validators` / `validators$` and `disabled` / `disabled$`, registers it with the parent group under
|
|
290
288
|
* `config.name` and keeps `errorMessage` up to date.
|
|
289
|
+
*
|
|
290
|
+
* @typeParam T - The item's config type.
|
|
291
|
+
* @typeParam C - The type of `control`. Inputs use the default `UntypedFormControl`; groups and arrays set it in
|
|
292
|
+
* their constructor to an `UntypedFormGroup` or `UntypedFormArray`.
|
|
291
293
|
*/
|
|
292
|
-
declare class NgsFormsFormItemWithVisibleAndValidatorsBase<T extends NgsFormsFormItemConfigBaseItemWithNameAndValidators> extends NgsFormsBaseClassFormComponent<T> implements OnInit, OnDestroy {
|
|
294
|
+
declare class NgsFormsFormItemWithVisibleAndValidatorsBase<T extends NgsFormsFormItemConfigBaseItemWithNameAndValidators, C extends AbstractControl = UntypedFormControl> extends NgsFormsBaseClassFormComponent<T> implements OnInit, OnDestroy {
|
|
293
295
|
/** The item's form control. Bind it with `[formControl]`. */
|
|
294
|
-
control:
|
|
296
|
+
control: C | undefined;
|
|
295
297
|
/**
|
|
296
298
|
* Message for the control's first error, taken from `errorMessageMap`. Empty while the control is valid, or
|
|
297
299
|
* before it is touched, dirty or submitted.
|
|
@@ -305,13 +307,15 @@ declare class NgsFormsFormItemWithVisibleAndValidatorsBase<T extends NgsFormsFor
|
|
|
305
307
|
/** The latest value of `disabled` / `disabled$`, or `undefined` when the config sets neither. */
|
|
306
308
|
private disabledFromConfig;
|
|
307
309
|
ngOnInit(): void;
|
|
310
|
+
/** Whether the control currently has `Validators.required` or `Validators.requiredTrue`. */
|
|
311
|
+
get isRequired(): boolean;
|
|
308
312
|
private updateErrorMessage;
|
|
309
313
|
ngOnDestroy(): void;
|
|
310
314
|
private bindValidators;
|
|
311
315
|
private bindDisabled;
|
|
312
316
|
private applyDisabled;
|
|
313
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgsFormsFormItemWithVisibleAndValidatorsBase<any>, never>;
|
|
314
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgsFormsFormItemWithVisibleAndValidatorsBase<any>, never, never, {}, {}, never, never, true, never>;
|
|
317
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgsFormsFormItemWithVisibleAndValidatorsBase<any, any>, never>;
|
|
318
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgsFormsFormItemWithVisibleAndValidatorsBase<any, any>, never, never, {}, {}, never, never, true, never>;
|
|
315
319
|
}
|
|
316
320
|
|
|
317
321
|
/**
|
|
@@ -353,18 +357,19 @@ declare class NgsFormsInternalService {
|
|
|
353
357
|
[key: string]: any;
|
|
354
358
|
}>;
|
|
355
359
|
setIsSubmitted(isSubmitted: boolean): void;
|
|
360
|
+
/** `true` when no rendered control fails its validators. A form whose controls are all disabled counts as valid. */
|
|
356
361
|
checkIsValid(): boolean;
|
|
357
362
|
setFormData(formConfig: NgsFormsFormConfig): void;
|
|
358
363
|
private mergeState;
|
|
359
364
|
/** Sets a component's state from its config's `initialState`, unless state for `uuid` already exists. */
|
|
360
365
|
seedComponentState(uuid: string, initialState: any): void;
|
|
361
|
-
updateGlobalState(state: NgsFormsGlobalFormState): void;
|
|
362
|
-
updateComponentState(componentKey: string, state:
|
|
366
|
+
updateGlobalState(state: Partial<NgsFormsGlobalFormState>): void;
|
|
367
|
+
updateComponentState(componentKey: string, state: Partial<NgsFormsCommonComponentState>): void;
|
|
363
368
|
/**
|
|
364
369
|
* Merged state for one component: its own (by `uuid`), then by `name`, then global.
|
|
365
370
|
* `initialState` seeds the component's own state unless state for `uuid` already exists.
|
|
366
371
|
*/
|
|
367
|
-
subscribeToState(uuid: string, name?: string, initialState?: any):
|
|
372
|
+
subscribeToState(uuid: string, name?: string, initialState?: any): Observable<NgsFormsCommonComponentState>;
|
|
368
373
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgsFormsInternalService, never>;
|
|
369
374
|
static ɵprov: i0.ɵɵInjectableDeclaration<NgsFormsInternalService>;
|
|
370
375
|
}
|
|
@@ -387,10 +392,6 @@ declare class NgsFormsInternalService {
|
|
|
387
392
|
* ```
|
|
388
393
|
*/
|
|
389
394
|
declare class NgsFormsService implements OnDestroy {
|
|
390
|
-
/**
|
|
391
|
-
* @internal
|
|
392
|
-
*/
|
|
393
|
-
attempt: number;
|
|
394
395
|
/**
|
|
395
396
|
* Emits the root form group's value every time it changes. Combine with `toSignal()` to read it in a template.
|
|
396
397
|
*
|
|
@@ -400,8 +401,12 @@ declare class NgsFormsService implements OnDestroy {
|
|
|
400
401
|
/** The latest value emitted by `formValue$`. */
|
|
401
402
|
formValue: any;
|
|
402
403
|
private internalFormService;
|
|
403
|
-
private
|
|
404
|
+
private formGroupBinding;
|
|
404
405
|
private formGroup;
|
|
406
|
+
/** The config from the latest `setFormConfig()` call, re-applied when `<ngs-form>` (re)connects. */
|
|
407
|
+
private lastConfig;
|
|
408
|
+
private missingFormTimer;
|
|
409
|
+
private destroyed;
|
|
405
410
|
/** `true` once the user has changed any control in the form. */
|
|
406
411
|
get dirty(): boolean;
|
|
407
412
|
/** `true` when every rendered control passes its validators. Hidden items are not validated. */
|
|
@@ -411,14 +416,21 @@ declare class NgsFormsService implements OnDestroy {
|
|
|
411
416
|
/**
|
|
412
417
|
* Renders a form from `formConfig`, replacing any form that is already shown and resetting the submitted state.
|
|
413
418
|
*
|
|
414
|
-
* @remarks It is safe to call before `<ngs-form>` has initialised (for example in `ngOnInit`): the
|
|
415
|
-
*
|
|
419
|
+
* @remarks It is safe to call before `<ngs-form>` has initialised (for example in `ngOnInit`): the latest config
|
|
420
|
+
* is kept and applied as soon as the form component connects, and also when it is destroyed and created again
|
|
421
|
+
* (inside an `@if` or a tab, for example). An error is logged if no form has connected after half a second.
|
|
416
422
|
*/
|
|
417
423
|
setFormConfig(formConfig: NgsFormsFormConfig): void;
|
|
418
424
|
/**
|
|
419
425
|
* @internal
|
|
420
426
|
*/
|
|
421
427
|
setInternalService(internalFormsService: NgsFormsInternalService): void;
|
|
428
|
+
/**
|
|
429
|
+
* @internal
|
|
430
|
+
* Disconnects `internalFormsService` when its `<ngs-form>` is destroyed. Does nothing if another form has
|
|
431
|
+
* connected since.
|
|
432
|
+
*/
|
|
433
|
+
clearInternalService(internalFormsService: NgsFormsInternalService): void;
|
|
422
434
|
/**
|
|
423
435
|
* Marks the form as submitted (or not). While submitted, every invalid control shows its error message even if
|
|
424
436
|
* the user never touched it.
|
|
@@ -429,9 +441,9 @@ declare class NgsFormsService implements OnDestroy {
|
|
|
429
441
|
* Merges `state` into the state of one component, identified by its `uuid` or control `name`.
|
|
430
442
|
* Components read the merged result through `commonState`.
|
|
431
443
|
*/
|
|
432
|
-
updateComponentState(componentKey: string, state:
|
|
444
|
+
updateComponentState(componentKey: string, state: Partial<NgsFormsCommonComponentState>): void;
|
|
433
445
|
/** Merges `state` into the state shared by every component in the form. */
|
|
434
|
-
updateGlobalState(state:
|
|
446
|
+
updateGlobalState(state: Partial<NgsFormsGlobalFormState>): void;
|
|
435
447
|
ngOnDestroy(): void;
|
|
436
448
|
/**
|
|
437
449
|
* Patches values into the form, using the same shape as `formValue$` (including the root group name).
|
|
@@ -490,7 +502,7 @@ declare class NgsFormsBaseClassFormItemInputWithOptionsComponent<T extends NgsFo
|
|
|
490
502
|
* <ngs-form></ngs-form>
|
|
491
503
|
* ```
|
|
492
504
|
*/
|
|
493
|
-
declare class NgsFormComponent {
|
|
505
|
+
declare class NgsFormComponent implements OnDestroy {
|
|
494
506
|
private readonly ngsInternalFormsService;
|
|
495
507
|
readonly ngsFormsService: NgsFormsService;
|
|
496
508
|
readonly formGroup: i0.Signal<_angular_forms.FormGroup<any> | undefined>;
|
|
@@ -501,6 +513,7 @@ declare class NgsFormComponent {
|
|
|
501
513
|
root: _ng_simplicity_forms_core.NgsFormsFormItem<any>;
|
|
502
514
|
}[]>;
|
|
503
515
|
constructor();
|
|
516
|
+
ngOnDestroy(): void;
|
|
504
517
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgsFormComponent, never>;
|
|
505
518
|
static ɵcmp: i0.ɵɵComponentDeclaration<NgsFormComponent, "ngs-form", never, {}, {}, never, never, true, never>;
|
|
506
519
|
}
|
|
@@ -511,8 +524,18 @@ declare const NGS_FORMS_ITEM_DATA: InjectionToken<unknown>;
|
|
|
511
524
|
* @internal
|
|
512
525
|
*/
|
|
513
526
|
declare const NGS_FORMS_CONTROL_ADD_REMOVE_FN: InjectionToken<unknown>;
|
|
514
|
-
/**
|
|
515
|
-
|
|
527
|
+
/**
|
|
528
|
+
* Injection token for the row index when a component is rendered inside a form array list.
|
|
529
|
+
*
|
|
530
|
+
* @remarks This is the index the row had when the component was created. Rows before it can be removed later,
|
|
531
|
+
* so to find a row's current position use `NGS_FORMS_ARRAY_ROW` with `formArray.controls.indexOf(row)`.
|
|
532
|
+
*/
|
|
533
|
+
declare const NGS_FORMS_ITEM_INDEX: InjectionToken<number>;
|
|
534
|
+
/**
|
|
535
|
+
* Injection token for the `UntypedFormGroup` of the form array row a component is rendered in. Unlike
|
|
536
|
+
* `NGS_FORMS_ITEM_INDEX`, it stays correct when earlier rows are removed.
|
|
537
|
+
*/
|
|
538
|
+
declare const NGS_FORMS_ARRAY_ROW: InjectionToken<UntypedFormGroup>;
|
|
516
539
|
type FormControlAddRemoveFn = (control: AbstractControl, controlName: string) => void;
|
|
517
540
|
/**
|
|
518
541
|
* @internal
|
|
@@ -576,12 +599,20 @@ declare class NgsFormItemController extends NgsSubscriber {
|
|
|
576
599
|
private readonly addRemoveControlFn?;
|
|
577
600
|
private readonly index?;
|
|
578
601
|
private readonly changeDetectorRef?;
|
|
602
|
+
private readonly arrayRow?;
|
|
579
603
|
private componentRef;
|
|
580
|
-
private parentVisibility;
|
|
581
604
|
private lastVisible;
|
|
582
|
-
|
|
605
|
+
/** Incremented whenever a scheduled create becomes stale (hidden again, or destroyed). */
|
|
606
|
+
private createToken;
|
|
607
|
+
private destroyed;
|
|
608
|
+
constructor(injector: Injector, viewContainerRef: ViewContainerRef, itemData: NgsFormsFormItem<any>, addRemoveControlFn?: INgsFormsFormControlAddRemove | undefined, index?: number | undefined, changeDetectorRef?: ChangeDetectorRef | undefined, arrayRow?: UntypedFormGroup | undefined);
|
|
583
609
|
destroy(): void;
|
|
584
610
|
private bindVisibility;
|
|
611
|
+
/**
|
|
612
|
+
* Creates the component in a microtask. A create that is overtaken by a later visibility change or by
|
|
613
|
+
* `destroy()` before it runs is dropped.
|
|
614
|
+
*/
|
|
615
|
+
private scheduleCreate;
|
|
585
616
|
private create;
|
|
586
617
|
private detach;
|
|
587
618
|
}
|
|
@@ -592,7 +623,7 @@ declare class NgsFormItemController extends NgsSubscriber {
|
|
|
592
623
|
* @remarks Use it inside custom container components to render child items:
|
|
593
624
|
* `<ng-container [ngs-form-item]="item" [ngs-form-group]="group"></ng-container>`.
|
|
594
625
|
*/
|
|
595
|
-
declare class NgsFormsFormItemDirective implements OnInit, OnDestroy {
|
|
626
|
+
declare class NgsFormsFormItemDirective implements OnInit, OnChanges, OnDestroy {
|
|
596
627
|
/** The item to render. */
|
|
597
628
|
itemData: NgsFormsFormItem<any> | undefined;
|
|
598
629
|
/** Form group that the item's control is added to. */
|
|
@@ -600,7 +631,8 @@ declare class NgsFormsFormItemDirective implements OnInit, OnDestroy {
|
|
|
600
631
|
/** Form array that the item's control is added to. */
|
|
601
632
|
formArray?: UntypedFormArray;
|
|
602
633
|
/**
|
|
603
|
-
* Index of the item inside a form array row, provided to children as `NGS_FORMS_ITEM_INDEX`.
|
|
634
|
+
* Index of the item inside a form array row, provided to children as `NGS_FORMS_ITEM_INDEX`. When it is set, the
|
|
635
|
+
* `ngs-form-group` is also provided to children as `NGS_FORMS_ARRAY_ROW`.
|
|
604
636
|
*/
|
|
605
637
|
index?: number;
|
|
606
638
|
controller: NgsFormItemController | undefined;
|
|
@@ -608,7 +640,10 @@ declare class NgsFormsFormItemDirective implements OnInit, OnDestroy {
|
|
|
608
640
|
private readonly injector;
|
|
609
641
|
private readonly changeDetectorRef;
|
|
610
642
|
private readonly formComponentRegistryService;
|
|
643
|
+
private initialized;
|
|
611
644
|
ngOnInit(): void;
|
|
645
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
646
|
+
private build;
|
|
612
647
|
ngOnDestroy(): void;
|
|
613
648
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgsFormsFormItemDirective, never>;
|
|
614
649
|
static ɵdir: i0.ɵɵDirectiveDeclaration<NgsFormsFormItemDirective, "[ngs-form-item]", never, { "itemData": { "alias": "ngs-form-item"; "required": false; }; "formGroup": { "alias": "ngs-form-group"; "required": false; }; "formArray": { "alias": "ngs-form-array"; "required": false; }; "index": { "alias": "ngs-form-index"; "required": false; }; }, {}, never, never, true, never>;
|
|
@@ -676,7 +711,7 @@ declare class NgsFormsRowComponent extends NgsFormsBaseClassFormComponent<NgsFor
|
|
|
676
711
|
* })
|
|
677
712
|
* ```
|
|
678
713
|
*/
|
|
679
|
-
declare class NgsFormsFormGroupComponent extends NgsFormsFormItemWithVisibleAndValidatorsBase<NgsFormsFormGroupConfig> implements OnInit {
|
|
714
|
+
declare class NgsFormsFormGroupComponent extends NgsFormsFormItemWithVisibleAndValidatorsBase<NgsFormsFormGroupConfig, UntypedFormGroup> implements OnInit {
|
|
680
715
|
static key: string;
|
|
681
716
|
/** Creates a `form-group` item. */
|
|
682
717
|
static create(config: NgsFormsFormGroupConfig): NgsFormsFormItem<NgsFormsFormGroupConfig>;
|
|
@@ -729,7 +764,7 @@ interface NgsFormItemArrayConfig extends NgsFormsFormItemConfigBaseItemWithNameA
|
|
|
729
764
|
* @remarks Registry key: `form-array`. Put an `NgsFormsFormArrayListComponent` inside `items` to render the rows,
|
|
730
765
|
* and `NgsFormsFormArrayAddItemComponent` / `NgsFormsFormArrayRemoveItemComponent` to let users change them.
|
|
731
766
|
*/
|
|
732
|
-
declare class NgsFormsFormArrayContainerComponent extends NgsFormsFormItemWithVisibleAndValidatorsBase<NgsFormItemArrayConfig> {
|
|
767
|
+
declare class NgsFormsFormArrayContainerComponent extends NgsFormsFormItemWithVisibleAndValidatorsBase<NgsFormItemArrayConfig, UntypedFormArray> {
|
|
733
768
|
private formArrayService;
|
|
734
769
|
static key: string;
|
|
735
770
|
constructor(formArrayService: NgsFormsFormArrayInternalService);
|
|
@@ -749,6 +784,8 @@ declare class NgsFormsFormArrayInternalService implements OnDestroy {
|
|
|
749
784
|
readonly formArray: UntypedFormArray;
|
|
750
785
|
/** Emits after a row is added or removed. */
|
|
751
786
|
readonly itemsChanged: Subject<void>;
|
|
787
|
+
/** Emits the index of a row right after it is removed. */
|
|
788
|
+
readonly rowRemoved: Subject<number>;
|
|
752
789
|
constructor();
|
|
753
790
|
ngOnDestroy(): void;
|
|
754
791
|
/** Removes the row at `index`, unless that would go below `minItems`. */
|
|
@@ -793,7 +830,14 @@ declare class NgsFormsFormArrayListComponent extends NgsFormsBaseClassFormCompon
|
|
|
793
830
|
internalArrayService: NgsFormsFormArrayInternalService;
|
|
794
831
|
myFormArray: FormArray<any>;
|
|
795
832
|
private changeDetectorRef;
|
|
833
|
+
private elementRef;
|
|
834
|
+
private injector;
|
|
796
835
|
ngOnInit(): void;
|
|
836
|
+
/**
|
|
837
|
+
* When the focused element (usually the row's Remove button) was removed with its row, moves focus to the
|
|
838
|
+
* same kind of control in the row that took its place, so keyboard users are not sent back to the top of the page.
|
|
839
|
+
*/
|
|
840
|
+
private restoreFocusAfterRemove;
|
|
797
841
|
/** Creates a `form-array-list` item. */
|
|
798
842
|
static create(config: NgsFormsFormArrayListConfig): NgsFormsFormItem<NgsFormsFormArrayListConfig>;
|
|
799
843
|
castToFormGroup(control: AbstractControl): UntypedFormGroup;
|
|
@@ -815,6 +859,12 @@ interface NgsFormItemArrayRemoveItemConfig extends NgsFormsFormItemConfigBase {
|
|
|
815
859
|
buttonClass?: string;
|
|
816
860
|
/** Class of an `<i>` icon shown before the label, for example `bi bi-trash`. */
|
|
817
861
|
buttonIcon?: string;
|
|
862
|
+
/**
|
|
863
|
+
* Accessible name of the button, so screen reader users can tell the rows' buttons apart. A function receives
|
|
864
|
+
* the row's zero-based index.
|
|
865
|
+
* @defaultValue `${buttonText} item ${index + 1}`, for example `Remove item 2`
|
|
866
|
+
*/
|
|
867
|
+
ariaLabel?: string | ((index: number) => string);
|
|
818
868
|
}
|
|
819
869
|
|
|
820
870
|
/**
|
|
@@ -823,14 +873,19 @@ interface NgsFormItemArrayRemoveItemConfig extends NgsFormsFormItemConfigBase {
|
|
|
823
873
|
* @remarks Registry key: `form-array-remove-item`. Place it inside the `templateItem` of an
|
|
824
874
|
* `NgsFormsFormArrayListComponent` so each row gets one.
|
|
825
875
|
*/
|
|
826
|
-
declare class NgsFormsFormArrayRemoveItemComponent extends NgsFormsBaseClassFormComponent<NgsFormItemArrayRemoveItemConfig> {
|
|
876
|
+
declare class NgsFormsFormArrayRemoveItemComponent extends NgsFormsBaseClassFormComponent<NgsFormItemArrayRemoveItemConfig> implements OnInit {
|
|
827
877
|
static key: string;
|
|
828
878
|
internalArrayService: NgsFormsFormArrayInternalService;
|
|
829
879
|
private elementRef;
|
|
830
880
|
private indexFromDi;
|
|
831
|
-
|
|
881
|
+
private row;
|
|
882
|
+
private changeDetectorRef;
|
|
883
|
+
/** Accessible name of the button, from `ariaLabel` or `${buttonText} item ${index + 1}`. */
|
|
884
|
+
get ariaLabel(): string;
|
|
885
|
+
/** Current index of the row this button belongs to. */
|
|
832
886
|
get myIndex(): number;
|
|
833
887
|
constructor();
|
|
888
|
+
ngOnInit(): void;
|
|
834
889
|
/** Creates a `form-array-remove-item` item. */
|
|
835
890
|
static create(config: NgsFormItemArrayRemoveItemConfig): NgsFormsFormItem<NgsFormItemArrayRemoveItemConfig>;
|
|
836
891
|
removeItem(): void;
|
|
@@ -885,22 +940,43 @@ declare class NgsFormsHtmlContentComponent extends NgsFormsBaseClassFormComponen
|
|
|
885
940
|
static ɵcmp: i0.ɵɵComponentDeclaration<NgsFormsHtmlContentComponent, "ngs-form-component-html-content", never, {}, {}, never, never, true, never>;
|
|
886
941
|
}
|
|
887
942
|
|
|
943
|
+
/** Configuration for `NgsFormsFormSectionComponent`. */
|
|
888
944
|
interface NgsFormsFormSectionConfig extends NgsFormsFormItemContainerConfigBase {
|
|
945
|
+
/** Section heading. It also names the section's group for assistive technology. */
|
|
889
946
|
title: string;
|
|
947
|
+
/**
|
|
948
|
+
* Class of the title.
|
|
949
|
+
* @defaultValue 'h3'
|
|
950
|
+
*/
|
|
890
951
|
titleClass?: string;
|
|
952
|
+
/**
|
|
953
|
+
* Heading level (1 to 6) that assistive technology announces for the title.
|
|
954
|
+
* @defaultValue 3
|
|
955
|
+
*/
|
|
956
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
957
|
+
/** Text shown under the title. */
|
|
891
958
|
subtitle?: string;
|
|
959
|
+
/**
|
|
960
|
+
* Class of the subtitle.
|
|
961
|
+
* @defaultValue 'lead'
|
|
962
|
+
*/
|
|
892
963
|
subtitleClass?: string;
|
|
893
964
|
}
|
|
965
|
+
/** @internal */
|
|
966
|
+
declare const sectionConfigDefaults: Partial<NgsFormsFormSectionConfig>;
|
|
894
967
|
|
|
895
968
|
/**
|
|
896
969
|
* Groups items under a title and optional subtitle. Does not create a form control, so child values stay in the
|
|
897
970
|
* parent group.
|
|
898
971
|
*
|
|
899
972
|
* @remarks Registry key: `section`. Config: `title`, `subtitle`, `titleClass` (default `h3`),
|
|
900
|
-
* `subtitleClass` (default `lead`) and `items`.
|
|
973
|
+
* `headingLevel` (default 3), `subtitleClass` (default `lead`) and `items`. The section is exposed to assistive
|
|
974
|
+
* technology as a group named by its title.
|
|
901
975
|
*/
|
|
902
976
|
declare class NgsFormsFormSectionComponent extends NgsFormsBaseClassItemsContainerBase<NgsFormsFormSectionConfig> implements OnInit {
|
|
903
977
|
static key: string;
|
|
978
|
+
/** Element id of the title, used to name the section's group. */
|
|
979
|
+
readonly titleId: string;
|
|
904
980
|
/** Creates a `section` item. */
|
|
905
981
|
static create(config: NgsFormsFormSectionConfig): NgsFormsFormItem<NgsFormsFormSectionConfig>;
|
|
906
982
|
ngOnInit(): void;
|
|
@@ -922,5 +998,5 @@ declare class NgsFormsCoreModule {
|
|
|
922
998
|
static ɵinj: i0.ɵɵInjectorDeclaration<NgsFormsCoreModule>;
|
|
923
999
|
}
|
|
924
1000
|
|
|
925
|
-
export { NGS_FORMS_CONTROL_ADD_REMOVE_FN, NGS_FORMS_ITEM_DATA, NGS_FORMS_ITEM_INDEX, NgsFormComponent, NgsFormsBaseClassFormComponent, NgsFormsBaseClassFormInputComponent, NgsFormsBaseClassFormItemInputWithOptionsComponent, NgsFormsBaseClassItemsContainerBase, NgsFormsColumnComponent, NgsFormsComponentRegistryService, NgsFormsCoreModule, NgsFormsFormArrayAddItemComponent, NgsFormsFormArrayContainerComponent, NgsFormsFormArrayInternalService, NgsFormsFormArrayListComponent, NgsFormsFormArrayRemoveItemComponent, NgsFormsFormControlAddRemoveFunctions, NgsFormsFormGroupComponent, NgsFormsFormItemDirective, NgsFormsFormItemWithVisibleAndValidatorsBase, NgsFormsFormSectionComponent, NgsFormsHtmlContentComponent, NgsFormsInternalService, NgsFormsRowComponent, NgsFormsService, NgsFormsTextDivComponent, NgsSubscriber, ngsDefaults };
|
|
926
|
-
export type { INgsFormsFormControlAddRemove, NgsFormDisableFn, NgsFormItemArrayAddItemConfig, NgsFormItemArrayConfig, NgsFormItemArrayRemoveItemConfig, NgsFormItemHtmlContentConfig, NgsFormItemRowConfig, NgsFormItemVisibilityFn, NgsFormValidatorArrayBuilderFn, NgsFormsFormArrayListConfig, NgsFormsFormConfig, NgsFormsFormErrorKeyValueMap, NgsFormsFormGroupConfig, NgsFormsFormInputOption, NgsFormsFormItem, NgsFormsFormItemConfigBase, NgsFormsFormItemConfigBaseInput, NgsFormsFormItemConfigBaseInputWithOptions, NgsFormsFormItemConfigBaseItemWithNameAndValidators, NgsFormsFormItemConfigBaseTextInput, NgsFormsFormItemContainerConfigBase, NgsFormsFunctionParameters, NgsServerSideValidationErrorObjectType };
|
|
1001
|
+
export { NGS_FORMS_ARRAY_ROW, NGS_FORMS_CONTROL_ADD_REMOVE_FN, NGS_FORMS_ITEM_DATA, NGS_FORMS_ITEM_INDEX, NgsFormComponent, NgsFormsBaseClassFormComponent, NgsFormsBaseClassFormInputComponent, NgsFormsBaseClassFormItemInputWithOptionsComponent, NgsFormsBaseClassItemsContainerBase, NgsFormsColumnComponent, NgsFormsComponentRegistryService, NgsFormsCoreModule, NgsFormsFormArrayAddItemComponent, NgsFormsFormArrayContainerComponent, NgsFormsFormArrayInternalService, NgsFormsFormArrayListComponent, NgsFormsFormArrayRemoveItemComponent, NgsFormsFormControlAddRemoveFunctions, NgsFormsFormGroupComponent, NgsFormsFormItemDirective, NgsFormsFormItemWithVisibleAndValidatorsBase, NgsFormsFormSectionComponent, NgsFormsHtmlContentComponent, NgsFormsInternalService, NgsFormsRowComponent, NgsFormsService, NgsFormsTextDivComponent, NgsSubscriber, ngsDefaults, sectionConfigDefaults };
|
|
1002
|
+
export type { INgsFormsFormControlAddRemove, NgsFormDisableFn, NgsFormItemArrayAddItemConfig, NgsFormItemArrayConfig, NgsFormItemArrayRemoveItemConfig, NgsFormItemHtmlContentConfig, NgsFormItemRowConfig, NgsFormItemVisibilityFn, NgsFormValidatorArrayBuilderFn, NgsFormsCommonComponentState, NgsFormsFormArrayListConfig, NgsFormsFormConfig, NgsFormsFormErrorKeyValueMap, NgsFormsFormGroupConfig, NgsFormsFormInputOption, NgsFormsFormItem, NgsFormsFormItemConfigBase, NgsFormsFormItemConfigBaseInput, NgsFormsFormItemConfigBaseInputWithOptions, NgsFormsFormItemConfigBaseItemWithNameAndValidators, NgsFormsFormItemConfigBaseTextInput, NgsFormsFormItemContainerConfigBase, NgsFormsFormSectionConfig, NgsFormsFunctionParameters, NgsFormsGlobalFormState, NgsFormsTextDivConfig, NgsServerSideValidationErrorObjectType };
|