@ngrdt/forms 0.0.56 → 0.0.58

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/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { OnInit, OnDestroy, Injector, Signal, InjectionToken } from '@angular/core';
2
+ import { OnInit, OnDestroy, Injector, Signal, Type, InjectionToken, PipeTransform } from '@angular/core';
3
3
  import * as _angular_forms from '@angular/forms';
4
4
  import { ControlValueAccessor, AbstractControl, ValidationErrors, NgControl, FormControl, ValidatorFn } from '@angular/forms';
5
- import { RdtInteractiveElementComponent } from '@ngrdt/core';
6
- import { Nullable, RdtFile, RdtMimeType, RdtCombinedMimeType, AllEncodingAliases } from '@ngrdt/utils';
5
+ import { RdtInteractiveElementComponent, RdtComponentOutletDirective } from '@ngrdt/core';
6
+ import { Nullable, RdtBaseFormInputComponentInputsInt, RdtFile, RdtMimeType, RdtCombinedMimeType, AllEncodingAliases } from '@ngrdt/utils';
7
7
  import * as _ngrdt_forms from '@ngrdt/forms';
8
8
  import * as rxjs from 'rxjs';
9
9
  import { Observable, Subscription, Subject } from 'rxjs';
@@ -16,6 +16,7 @@ declare abstract class RdtBaseFormInputComponent<TExt, TInt = TExt> extends RdtI
16
16
  readonly control: Signal<AbstractControl<TExt, TExt> | null>;
17
17
  readonly label: _angular_core.InputSignal<string>;
18
18
  readonly placeholder: _angular_core.InputSignal<string>;
19
+ readonly name: _angular_core.InputSignal<string>;
19
20
  readonly externalValue: _angular_core.ModelSignal<TExt | null>;
20
21
  readonly internalValue: _angular_core.WritableSignal<TInt | null>;
21
22
  readonly dataTestIdInput: _angular_core.InputSignal<undefined>;
@@ -58,22 +59,56 @@ declare abstract class RdtBaseFormInputComponent<TExt, TInt = TExt> extends RdtI
58
59
  private getRequiredError;
59
60
  private static readonly REQUIRED_ERROR;
60
61
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdtBaseFormInputComponent<any, any>, never>;
61
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdtBaseFormInputComponent<any, any>, never, never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "externalValue": { "alias": "value"; "required": false; "isSignal": true; }; "dataTestIdInput": { "alias": "dataTestId"; "required": false; "isSignal": true; }; "readonlyInput": { "alias": "readonly"; "required": false; "isSignal": true; }; "requiredInput": { "alias": "required"; "required": false; "isSignal": true; }; }, { "externalValue": "valueChange"; }, never, never, true, never>;
62
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdtBaseFormInputComponent<any, any>, never, never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "externalValue": { "alias": "value"; "required": false; "isSignal": true; }; "dataTestIdInput": { "alias": "dataTestId"; "required": false; "isSignal": true; }; "readonlyInput": { "alias": "readonly"; "required": false; "isSignal": true; }; "requiredInput": { "alias": "required"; "required": false; "isSignal": true; }; }, { "externalValue": "valueChange"; }, never, never, true, never>;
62
63
  }
63
64
 
64
- declare abstract class RdtCheckboxComponent<TTrue = true, TFalse = false> extends RdtBaseFormInputComponent<TTrue | TFalse, boolean> {
65
+ declare abstract class RdtFormInputOutletDirective<TComponent, TInputs> extends RdtComponentOutletDirective<TComponent, TInputs> implements ControlValueAccessor {
66
+ protected onChangeFn: any;
67
+ protected onTouchedFn: any;
68
+ writeValue(value: any): void;
69
+ registerOnChange(fn: any): void;
70
+ registerOnTouched(fn: any): void;
71
+ setDisabledState(isDisabled: boolean): void;
72
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdtFormInputOutletDirective<any, any>, never>;
73
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdtFormInputOutletDirective<any, any>, never, never, {}, {}, never, never, true, never>;
74
+ }
75
+
76
+ interface RdtCheckboxInputInt extends RdtBaseFormInputComponentInputsInt {
77
+ checked: boolean;
78
+ value: any;
79
+ trueValue: any;
80
+ falseValue: any;
81
+ }
82
+
83
+ declare abstract class RdtCheckboxComponent<TTrue = any, TFalse = any> extends RdtBaseFormInputComponent<TTrue | TFalse, boolean> {
65
84
  readonly trueValueInput: _angular_core.InputSignal<TTrue>;
66
85
  readonly trueValue: _angular_core.WritableSignal<TTrue>;
67
86
  readonly falseValueInput: _angular_core.InputSignal<TFalse>;
68
87
  readonly falseValue: _angular_core.WritableSignal<TFalse>;
69
88
  readonly indeterminate: _angular_core.InputSignalWithTransform<boolean, unknown>;
89
+ readonly value: _angular_core.InputSignal<string | undefined>;
90
+ readonly checked: _angular_core.InputSignal<boolean>;
91
+ readonly checkedChange: _angular_core.OutputEmitterRef<boolean>;
92
+ readonly checkedState: _angular_core.WritableSignal<boolean>;
93
+ constructor();
94
+ writeValue(value: TFalse | TTrue): void;
95
+ protected handleValueChange(newInternal: boolean): void;
70
96
  protected toExternalValue(internalValue: boolean | null): TTrue | TFalse | null;
71
97
  protected toInternalValue(externalValue: TTrue | TFalse | null): boolean | null;
72
98
  protected isEmpty(value: TTrue | TFalse | null): boolean;
73
99
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdtCheckboxComponent<any, any>, never>;
74
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdtCheckboxComponent<any, any>, never, never, { "trueValueInput": { "alias": "trueValue"; "required": false; "isSignal": true; }; "falseValueInput": { "alias": "falseValue"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
100
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdtCheckboxComponent<any, any>, never, never, { "trueValueInput": { "alias": "trueValue"; "required": false; "isSignal": true; }; "falseValueInput": { "alias": "falseValue"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, never, true, never>;
101
+ }
102
+
103
+ declare class RdtCheckboxOutletDirective<TCheckComp extends RdtCheckboxComponent, TCheckInputs extends RdtCheckboxInputInt = RdtCheckboxInputInt> extends RdtFormInputOutletDirective<TCheckComp, TCheckInputs> {
104
+ readonly componentClass: Type<TCheckComp>;
105
+ constructor();
106
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdtCheckboxOutletDirective<any, any>, never>;
107
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdtCheckboxOutletDirective<any, any>, "[rdtCheckboxOutlet]", ["rdtCheckboxOutlet"], {}, {}, never, never, true, never>;
75
108
  }
76
109
 
110
+ declare const RDT_CHECKBOX_BASE_PROVIDER: InjectionToken<Type<RdtCheckboxComponent<any, any>>>;
111
+
77
112
  type RdtDateType = 'date' | 'month' | 'week' | 'datetime-local' | 'time';
78
113
 
79
114
  declare abstract class RdtDateComponent<TExt = string, TInt = TExt> extends RdtBaseFormInputComponent<TExt, TInt> {
@@ -489,6 +524,33 @@ declare abstract class RdtTextInputComponent extends RdtBaseFormInputComponent<s
489
524
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdtTextInputComponent, never, never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "maxlength": { "alias": "maxlength"; "required": false; "isSignal": true; }; "minlength": { "alias": "minlength"; "required": false; "isSignal": true; }; "pattern": { "alias": "pattern"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
490
525
  }
491
526
 
527
+ type RdtErrorValue = {
528
+ key: string;
529
+ value: string;
530
+ } | null;
531
+ type ErrorCodesFn = (value?: any) => string;
532
+
533
+ interface RdtFormErrorCodeMap {
534
+ required: ErrorCodesFn;
535
+ email: ErrorCodesFn;
536
+ minlength: ErrorCodesFn;
537
+ maxlength: ErrorCodesFn;
538
+ notFound: ErrorCodesFn;
539
+ multipleFound: ErrorCodesFn;
540
+ [key: string]: ErrorCodesFn;
541
+ }
542
+
543
+ declare function getFirstError(errors: ValidationErrors): RdtErrorValue;
544
+ declare const defaultRdtFormErrorCodes: RdtFormErrorCodeMap;
545
+ declare class RdtFormErrorPipe implements PipeTransform {
546
+ private readonly errorCodes;
547
+ transform(errors: ValidationErrors | undefined | null): string;
548
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdtFormErrorPipe, never>;
549
+ static ɵpipe: _angular_core.ɵɵPipeDeclaration<RdtFormErrorPipe, "rdtFormError", true>;
550
+ }
551
+
552
+ declare const RDT_FORM_ERROR_CODES_PROVIDER: InjectionToken<Type<RdtFormErrorCodeMap>>;
553
+
492
554
  declare class RdtDateValidators {
493
555
  static readonly notInFuture: ValidatorFn;
494
556
  static lastDayOfMonth: ValidatorFn;
@@ -518,5 +580,5 @@ declare class RdtCommonValidators {
518
580
  static cannotContainAccents: ValidatorFn;
519
581
  }
520
582
 
521
- export { NO_OP_FILE_READER, NoOpFileReader, RDT_DEFAULT_FILE_LABEL_FN, RDT_DEFAULT_FILE_READER, RDT_DEFAULT_MAX_FILE_SIZE, RdtBaseFormInputComponent, RdtBaseSelectCommonComponent, RdtCheckboxComponent, RdtCommonValidators, RdtDateComponent, RdtDateValidators, RdtFileInputComponent, RdtFileReader, RdtFileReaderArrayBuffer, RdtFileReaderBase64, RdtMultiSelectComponent, RdtNumericInputComponent, RdtOfflineSelectDatasource, RdtSelectDatasource, RdtSelectOfflineDatasourceProviderDirective, RdtSelectOptionDirective, RdtSelectStore, RdtSingleSelectComponent, RdtTextAreaComponent, RdtTextInputComponent, VnshFileReaderText, czechFileLabelFn, getRdtSelectPage, rdtSelectInitialState };
522
- export type { RdtDateType, RdtFileLabelFn, RdtLabelValue, RdtLabelValueId, RdtRenderedSelectOption, RdtSelectPage, RdtSelectRequestParams, RdtSelectState };
583
+ export { NO_OP_FILE_READER, NoOpFileReader, RDT_CHECKBOX_BASE_PROVIDER, RDT_DEFAULT_FILE_LABEL_FN, RDT_DEFAULT_FILE_READER, RDT_DEFAULT_MAX_FILE_SIZE, RDT_FORM_ERROR_CODES_PROVIDER, RdtBaseFormInputComponent, RdtBaseSelectCommonComponent, RdtCheckboxComponent, RdtCheckboxOutletDirective, RdtCommonValidators, RdtDateComponent, RdtDateValidators, RdtFileInputComponent, RdtFileReader, RdtFileReaderArrayBuffer, RdtFileReaderBase64, RdtFormErrorPipe, RdtFormInputOutletDirective, RdtMultiSelectComponent, RdtNumericInputComponent, RdtOfflineSelectDatasource, RdtSelectDatasource, RdtSelectOfflineDatasourceProviderDirective, RdtSelectOptionDirective, RdtSelectStore, RdtSingleSelectComponent, RdtTextAreaComponent, RdtTextInputComponent, VnshFileReaderText, czechFileLabelFn, defaultRdtFormErrorCodes, getFirstError, getRdtSelectPage, rdtSelectInitialState };
584
+ export type { ErrorCodesFn, RdtCheckboxInputInt, RdtDateType, RdtErrorValue, RdtFileLabelFn, RdtFormErrorCodeMap, RdtLabelValue, RdtLabelValueId, RdtRenderedSelectOption, RdtSelectPage, RdtSelectRequestParams, RdtSelectState };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@ngrdt/forms",
3
- "version": "0.0.56",
3
+ "version": "0.0.58",
4
4
  "peerDependencies": {
5
- "@ngrdt/core": "^0.0.56",
6
- "@ngrdt/utils": "^0.0.56",
5
+ "@ngrdt/core": "^0.0.58",
6
+ "@ngrdt/utils": "^0.0.58",
7
7
  "@angular/core": ">=18.2.0",
8
8
  "@angular/forms": ">=18.2.0",
9
9
  "rxjs": ">=7.0.0",