@ng-modular-forms/core 0.7.8 → 0.8.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.
- package/README.md +19 -12
- package/fesm2022/ng-modular-forms-core.mjs +656 -122
- package/fesm2022/ng-modular-forms-core.mjs.map +1 -1
- package/lib/base/form-control-base.d.ts +28 -11
- package/lib/base/form-handler-base.d.ts +6 -9
- package/lib/behavior/lookup/lookup.behavior.d.ts +22 -0
- package/lib/{input/input-currency.component.d.ts → controls/currency/currency.component.d.ts} +2 -2
- package/lib/{input/input-datepicker.component.d.ts → controls/datepicker/datepicker.component.d.ts} +1 -1
- package/lib/{input → controls/form-field}/form-field.component.d.ts +3 -1
- package/lib/controls/lookup/lookup.component.d.ts +43 -0
- package/lib/controls/lookup/lookup.types.d.ts +17 -0
- package/lib/{input/input-number.component.d.ts → controls/number/number.component.d.ts} +3 -3
- package/lib/{input/input-select.component.d.ts → controls/select/select.component.d.ts} +5 -4
- package/lib/{input/input-text.component.d.ts → controls/text/text.component.d.ts} +3 -2
- package/lib/{input/input-textarea.component.d.ts → controls/textarea/textarea.component.d.ts} +2 -1
- package/lib/{input/input-timepicker.component.d.ts → controls/timepicker/timepicker.component.d.ts} +1 -1
- package/lib/form-orchestrator.d.ts +2 -2
- package/lib/types.d.ts +2 -2
- package/package.json +1 -1
- package/public-api.d.ts +12 -9
- /package/lib/behavior/{currency.behavior.d.ts → currency/currency.behavior.d.ts} +0 -0
- /package/lib/behavior/{text.behavior.d.ts → text/text.behavior.d.ts} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ElementRef, OnDestroy } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { FormControlBase } from '../../base/form-control-base';
|
|
4
|
+
import { LookupOption, LookupStatus } from './lookup.types';
|
|
5
|
+
import { LookupBehavior } from '../../behavior/lookup/lookup.behavior';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class InputLookupComponent<TOption> extends FormControlBase<TOption> implements OnDestroy {
|
|
8
|
+
readonly autocompleteAttr: import("@angular/core").InputSignal<string | null>;
|
|
9
|
+
optionsSource: import("@angular/core").InputSignal<LookupOption<TOption>[]>;
|
|
10
|
+
optionsProvider: import("@angular/core").InputSignal<((query: string | null) => Observable<LookupOption<TOption>[]>) | undefined>;
|
|
11
|
+
displayWith: import("@angular/core").InputSignal<((value: TOption | null) => string) | undefined>;
|
|
12
|
+
displayProvider: import("@angular/core").InputSignal<((value: TOption | null) => Observable<string>) | undefined>;
|
|
13
|
+
compareWith: import("@angular/core").InputSignal<((a: TOption, b: TOption) => boolean) | undefined>;
|
|
14
|
+
emptyOptionsLabel: import("@angular/core").InputSignal<string>;
|
|
15
|
+
debounceTime: import("@angular/core").InputSignal<number>;
|
|
16
|
+
searchThreshold: import("@angular/core").InputSignal<number>;
|
|
17
|
+
private readonly _activeIndex;
|
|
18
|
+
readonly activeIndex: import("@angular/core").Signal<number>;
|
|
19
|
+
private readonly _searchQuery;
|
|
20
|
+
private readonly _isInteractingWithOptions;
|
|
21
|
+
private readonly _searchQuery$;
|
|
22
|
+
readonly isOpen: import("@angular/core").WritableSignal<boolean>;
|
|
23
|
+
readonly openUpwards: import("@angular/core").WritableSignal<boolean>;
|
|
24
|
+
readonly displayLabel: import("@angular/core").Signal<string>;
|
|
25
|
+
inputElement: ElementRef<any>;
|
|
26
|
+
behavior: LookupBehavior<TOption>;
|
|
27
|
+
constructor();
|
|
28
|
+
ngOnInit(): void;
|
|
29
|
+
writeValue(value: TOption | null): void;
|
|
30
|
+
onFocusOut(): void;
|
|
31
|
+
onFocusIn(): void;
|
|
32
|
+
ngOnDestroy(): void;
|
|
33
|
+
onInput(event: Event): void;
|
|
34
|
+
selectOption(event: Event, option: LookupOption<TOption>): void;
|
|
35
|
+
resetActiveIndex(): void;
|
|
36
|
+
setOptionsInteraction(state: boolean): void;
|
|
37
|
+
updateOptions(results: LookupOption<TOption>[], status?: LookupStatus): void;
|
|
38
|
+
clearSelectedOption(): void;
|
|
39
|
+
onKeyDown(event: KeyboardEvent, currentOptions: LookupOption<TOption>[] | null): void;
|
|
40
|
+
private calculateDropdownPosition;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InputLookupComponent<any>, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InputLookupComponent<any>, "nmf-lookup", ["nmfLookup"], { "autocompleteAttr": { "alias": "autocompleteAttr"; "required": false; "isSignal": true; }; "optionsSource": { "alias": "optionsSource"; "required": false; "isSignal": true; }; "optionsProvider": { "alias": "optionsProvider"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "required": false; "isSignal": true; }; "displayProvider": { "alias": "displayProvider"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; "emptyOptionsLabel": { "alias": "emptyOptionsLabel"; "required": false; "isSignal": true; }; "debounceTime": { "alias": "debounceTime"; "required": false; "isSignal": true; }; "searchThreshold": { "alias": "searchThreshold"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DestroyRef, InputSignal } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
export type LookupStatus = 'default' | 'loading' | 'error' | 'empty';
|
|
4
|
+
export interface LookupOption<TResult> {
|
|
5
|
+
value: TResult;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LookupBehaviorOptions<T> {
|
|
9
|
+
destroyRef: DestroyRef;
|
|
10
|
+
resolvers: LookupResolvers<T>;
|
|
11
|
+
}
|
|
12
|
+
export interface LookupResolvers<T> {
|
|
13
|
+
compare: InputSignal<((a: T, b: T) => boolean) | undefined>;
|
|
14
|
+
label: InputSignal<((value: T | null) => string) | undefined>;
|
|
15
|
+
labelAsync: InputSignal<((value: T | null) => Observable<string>) | undefined>;
|
|
16
|
+
search: InputSignal<((query: string | null) => Observable<LookupOption<T>[]>) | undefined>;
|
|
17
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FormControlBase } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { FormControlBase } from '../../base/form-control-base';
|
|
2
|
+
import { TextBehavior } from '../../behavior/text/text.behavior';
|
|
3
|
+
import { CurrencyBehavior } from '../../behavior/currency/currency.behavior';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class InputNumberComponent extends FormControlBase<string | number | null> {
|
|
6
6
|
formatValue: import("@angular/core").InputSignal<boolean>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { FormControlBase } from '
|
|
1
|
+
import { FormControlBase } from '../../base/form-control-base';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export interface SelectOption {
|
|
4
|
-
|
|
4
|
+
value: string | number;
|
|
5
5
|
label: string | number;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare class InputSelectComponent extends FormControlBase<string | number | null> {
|
|
9
9
|
options: import("@angular/core").InputSignal<SelectOption[]>;
|
|
10
10
|
emptyOptionLabel: import("@angular/core").InputSignal<string>;
|
|
11
|
-
|
|
11
|
+
allowEmptyOptionSelection: import("@angular/core").InputSignal<boolean>;
|
|
12
|
+
handleChange(event: Event): void;
|
|
12
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<InputSelectComponent, never>;
|
|
13
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<InputSelectComponent, "nmf-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "emptyOptionLabel": { "alias": "emptyOptionLabel"; "required": false; "isSignal": true; }; "
|
|
14
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InputSelectComponent, "nmf-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "emptyOptionLabel": { "alias": "emptyOptionLabel"; "required": false; "isSignal": true; }; "allowEmptyOptionSelection": { "alias": "allowEmptyOptionSelection"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
14
15
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { FormControlBase } from '
|
|
2
|
-
import { TextBehavior } from '
|
|
1
|
+
import { FormControlBase } from '../../base/form-control-base';
|
|
2
|
+
import { TextBehavior } from '../../behavior/text/text.behavior';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class InputTextComponent extends FormControlBase<string | number | null> {
|
|
5
5
|
type: import("@angular/core").InputSignal<"number" | "email" | "search" | "text" | "tel" | "url" | "password">;
|
|
6
6
|
behavior: TextBehavior;
|
|
7
7
|
computedType: import("@angular/core").Signal<"number" | "email" | "search" | "text" | "tel" | "url" | "password">;
|
|
8
|
+
onInput(event: Event): void;
|
|
8
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<InputTextComponent, never>;
|
|
9
10
|
static ɵcmp: i0.ɵɵComponentDeclaration<InputTextComponent, "nmf-text", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
10
11
|
}
|
package/lib/{input/input-textarea.component.d.ts → controls/textarea/textarea.component.d.ts}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { FormControlBase } from '
|
|
1
|
+
import { FormControlBase } from '../../base/form-control-base';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class InputTextareaComponent extends FormControlBase<string | null> {
|
|
4
4
|
rows: import("@angular/core").InputSignal<number>;
|
|
5
5
|
cols: import("@angular/core").InputSignal<number>;
|
|
6
|
+
onInput(event: Event): void;
|
|
6
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<InputTextareaComponent, never>;
|
|
7
8
|
static ɵcmp: i0.ɵɵComponentDeclaration<InputTextareaComponent, "nmf-textarea", never, { "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "cols": { "alias": "cols"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
8
9
|
}
|
package/lib/{input/input-timepicker.component.d.ts → controls/timepicker/timepicker.component.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormControlBase } from '
|
|
1
|
+
import { FormControlBase } from '../../base/form-control-base';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class InputTimepickerComponent extends FormControlBase<Date | null> {
|
|
4
4
|
step: import("@angular/core").InputSignal<number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormGroup } from '@angular/forms';
|
|
1
|
+
import { 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';
|
|
@@ -29,7 +29,7 @@ export declare abstract class FormOrchestrator extends FormMapperBase implements
|
|
|
29
29
|
orchestrate(options: FormOrchestratorOptions): void;
|
|
30
30
|
setForm(form: FormGroup): void;
|
|
31
31
|
getSubForm(key: string): FormGroup;
|
|
32
|
-
addHandlerToRegistry(handler: FormHandlerBase): void;
|
|
32
|
+
addHandlerToRegistry<TControls extends Record<string, FormControl>>(handler: FormHandlerBase<TControls>): void;
|
|
33
33
|
addReactiveLogic(subscription: Subscription): void;
|
|
34
34
|
setStatus(status: FormStatus): void;
|
|
35
35
|
setErrorMessage(message: string | null): void;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { FormGroup } from '@angular/forms';
|
|
1
|
+
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
5
|
export type MapperRegistry = Record<string, FormMapperBase<unknown, unknown, unknown>>;
|
|
6
|
-
export type FormHandlerRegistry = FormHandlerBase[];
|
|
6
|
+
export type FormHandlerRegistry = FormHandlerBase<Record<string, FormControl<unknown>>>[];
|
|
7
7
|
export interface FormOrchestratorOptions {
|
|
8
8
|
form: FormGroup;
|
|
9
9
|
mapperRegistry?: MapperRegistry;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-modular-forms/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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,15 +1,18 @@
|
|
|
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.behavior';
|
|
5
|
-
export * from './lib/behavior/
|
|
6
|
-
export * from './lib/
|
|
7
|
-
export * from './lib/
|
|
8
|
-
export * from './lib/
|
|
9
|
-
export * from './lib/
|
|
10
|
-
export * from './lib/
|
|
11
|
-
export * from './lib/
|
|
12
|
-
export * from './lib/
|
|
4
|
+
export * from './lib/behavior/currency/currency.behavior';
|
|
5
|
+
export * from './lib/behavior/lookup/lookup.behavior';
|
|
6
|
+
export * from './lib/behavior/text/text.behavior';
|
|
7
|
+
export * from './lib/controls/currency/currency.component';
|
|
8
|
+
export * from './lib/controls/datepicker/datepicker.component';
|
|
9
|
+
export * from './lib/controls/lookup/lookup.component';
|
|
10
|
+
export * from './lib/controls/lookup/lookup.types';
|
|
11
|
+
export * from './lib/controls/number/number.component';
|
|
12
|
+
export * from './lib/controls/select/select.component';
|
|
13
|
+
export * from './lib/controls/text/text.component';
|
|
14
|
+
export * from './lib/controls/textarea/textarea.component';
|
|
15
|
+
export * from './lib/controls/timepicker/timepicker.component';
|
|
13
16
|
export * from './lib/form-hydrator';
|
|
14
17
|
export * from './lib/form-orchestrator';
|
|
15
18
|
export * from './lib/form-serializer';
|
|
File without changes
|
|
File without changes
|