@ng-modular-forms/core 0.8.1 → 0.9.0

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.
@@ -1,11 +1,20 @@
1
1
  import { FormControlBase } from '../../base/form-control-base';
2
- import { TextBehavior } from '../../behavior/text/text.behavior';
2
+ import { PasswordBehavior } from '../../behavior/password/password.behavior';
3
+ import { NmfPrefixDirective } from '../../directives/nmf-prefix.directive';
4
+ import { NmfSuffixDirective } from '../../directives/nmf-suffix.directive';
3
5
  import * as i0 from "@angular/core";
4
6
  export declare class InputTextComponent extends FormControlBase<string | number | null> {
5
- type: import("@angular/core").InputSignal<"number" | "email" | "search" | "text" | "tel" | "url" | "password">;
6
- behavior: TextBehavior;
7
- computedType: import("@angular/core").Signal<"number" | "email" | "search" | "text" | "tel" | "url" | "password">;
7
+ type: import("@angular/core").InputSignal<"email" | "search" | "tel" | "text" | "url" | "password">;
8
+ prefix: import("@angular/core").InputSignal<string | null>;
9
+ suffix: import("@angular/core").InputSignal<string | null>;
10
+ displayValue: import("@angular/core").WritableSignal<string | number | null>;
11
+ passwordBehavior: PasswordBehavior;
12
+ prefixContent: import("@angular/core").Signal<NmfPrefixDirective | undefined>;
13
+ suffixContent: import("@angular/core").Signal<NmfSuffixDirective | undefined>;
14
+ hasPrefix: import("@angular/core").Signal<boolean>;
15
+ hasSuffix: import("@angular/core").Signal<boolean>;
16
+ readonly computedType: import("@angular/core").Signal<"email" | "search" | "tel" | "text" | "url" | "password">;
8
17
  onInput(event: Event): void;
9
18
  static ɵfac: i0.ɵɵFactoryDeclaration<InputTextComponent, never>;
10
- static ɵcmp: i0.ɵɵComponentDeclaration<InputTextComponent, "nmf-text", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
19
+ static ɵcmp: i0.ɵɵComponentDeclaration<InputTextComponent, "nmf-text", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "prefix": { "alias": "prefix"; "required": false; "isSignal": true; }; "suffix": { "alias": "suffix"; "required": false; "isSignal": true; }; }, {}, ["prefixContent", "suffixContent"], ["[nmfPrefix]", "[nmfSuffix]"], true, never>;
11
20
  }
@@ -0,0 +1,5 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class NmfPrefixDirective {
3
+ static ɵfac: i0.ɵɵFactoryDeclaration<NmfPrefixDirective, never>;
4
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NmfPrefixDirective, "[nmfPrefix]", never, {}, {}, never, never, true, never>;
5
+ }
@@ -0,0 +1,5 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class NmfSuffixDirective {
3
+ static ɵfac: i0.ɵɵFactoryDeclaration<NmfSuffixDirective, never>;
4
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NmfSuffixDirective, "[nmfSuffix]", never, {}, {}, never, never, true, never>;
5
+ }
@@ -1,8 +1,11 @@
1
- import { FormGroup } from '@angular/forms';
1
+ import { FormArray, FormGroup } from '@angular/forms';
2
2
  import type { MapperRegistry } from './types';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class FormHydrator {
5
- hydrate<TModel extends Record<string, unknown>>(form: FormGroup, model: TModel, registry?: MapperRegistry): void;
5
+ hydrate(form: FormGroup | FormArray, model: unknown, registry?: MapperRegistry): void;
6
+ private hydrateFormArray;
7
+ private createControlFromModel;
8
+ private cloneControl;
6
9
  static ɵfac: i0.ɵɵFactoryDeclaration<FormHydrator, never>;
7
10
  static ɵprov: i0.ɵɵInjectableDeclaration<FormHydrator>;
8
11
  }
@@ -1,4 +1,4 @@
1
- import { FormControl, FormGroup } from '@angular/forms';
1
+ import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
2
2
  import { OnDestroy } from '@angular/core';
3
3
  import { Subscription } from 'rxjs';
4
4
  import { FormHandlerBase } from './base/form-handler-base';
@@ -28,7 +28,7 @@ export declare abstract class FormOrchestrator extends FormMapperBase implements
28
28
  */
29
29
  orchestrate(options: FormOrchestratorOptions): void;
30
30
  setForm(form: FormGroup): void;
31
- getSubForm(key: string): FormGroup;
31
+ getSubForm<T extends AbstractControl = AbstractControl>(key: string): T;
32
32
  addHandlerToRegistry<TControls extends Record<string, FormControl>>(handler: FormHandlerBase<TControls>): void;
33
33
  addReactiveLogic(subscription: Subscription): void;
34
34
  setStatus(status: FormStatus): void;
@@ -1,8 +1,9 @@
1
- import { FormGroup } from '@angular/forms';
1
+ import { FormArray, FormGroup } from '@angular/forms';
2
2
  import type { MapperRegistry } from './types';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class FormSerializer {
5
5
  toRequest<TOptions extends object = object>(form: FormGroup, registry?: MapperRegistry, options?: TOptions): Record<string, unknown>;
6
+ toRequest<TOptions extends object = object>(form: FormArray, registry?: MapperRegistry, options?: TOptions): unknown[];
6
7
  static ɵfac: i0.ɵɵFactoryDeclaration<FormSerializer, never>;
7
8
  static ɵprov: i0.ɵɵInjectableDeclaration<FormSerializer>;
8
9
  }
package/lib/types.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { FormControl, FormGroup } from '@angular/forms';
2
2
  import type { FormMapperBase } from './base/form-mapper-base';
3
3
  import type { FormHandlerBase } from './base/form-handler-base';
4
4
  export type FormStatus = 'idle' | 'submitting' | 'error' | 'success';
5
- export type MapperRegistry = Record<string, FormMapperBase<unknown, unknown, unknown>>;
5
+ export type MapperRegistry = Record<string, FormMapperBase<unknown>>;
6
6
  export type FormHandlerRegistry = FormHandlerBase<Record<string, FormControl<unknown>>>[];
7
7
  export interface FormOrchestratorOptions {
8
8
  form: FormGroup;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-modular-forms/core",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Composable Angular reactive form primitives, custom controls, and Material-compatible components for building enterprise-ready, complex typed forms.",
5
5
  "keywords": [
6
6
  "angular",
package/public-api.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export * from './lib/base/form-control-base';
2
2
  export * from './lib/base/form-handler-base';
3
3
  export * from './lib/base/form-mapper-base';
4
- export * from './lib/behavior/currency/currency.behavior';
4
+ export * from './lib/behavior/number/number.behavior';
5
5
  export * from './lib/behavior/lookup/lookup.behavior';
6
- export * from './lib/behavior/text/text.behavior';
7
- export * from './lib/controls/currency/currency.component';
6
+ export * from './lib/behavior/password/password.behavior';
8
7
  export * from './lib/controls/datepicker/datepicker.component';
8
+ export * from './lib/controls/form-field/form-field.component';
9
9
  export * from './lib/controls/lookup/lookup.component';
10
10
  export * from './lib/controls/lookup/lookup.types';
11
11
  export * from './lib/controls/number/number.component';
@@ -13,6 +13,8 @@ export * from './lib/controls/select/select.component';
13
13
  export * from './lib/controls/text/text.component';
14
14
  export * from './lib/controls/textarea/textarea.component';
15
15
  export * from './lib/controls/timepicker/timepicker.component';
16
+ export * from './lib/directives/nmf-prefix.directive';
17
+ export * from './lib/directives/nmf-suffix.directive';
16
18
  export * from './lib/form-hydrator';
17
19
  export * from './lib/form-orchestrator';
18
20
  export * from './lib/form-serializer';
@@ -1,3 +0,0 @@
1
- export declare class CurrencyBehavior {
2
- blockNonDigitKey(event: KeyboardEvent): void;
3
- }
@@ -1,13 +0,0 @@
1
- import { FormControlBase } from '../../base/form-control-base';
2
- import { CurrencyBehavior } from '../../behavior/currency/currency.behavior';
3
- import * as i0 from "@angular/core";
4
- export declare class InputCurrencyComponent extends FormControlBase<number | null> {
5
- displayValue: import("@angular/core").WritableSignal<string | null>;
6
- behavior: CurrencyBehavior;
7
- writeValue(value: number | null): void;
8
- handleKeyDown(event: KeyboardEvent): void;
9
- onInput(event: Event): void;
10
- textColor: import("@angular/core").Signal<"inherit" | "#dc6262">;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<InputCurrencyComponent, never>;
12
- static ɵcmp: i0.ɵɵComponentDeclaration<InputCurrencyComponent, "nmf-currency", never, {}, {}, never, never, true, never>;
13
- }