@rolster/forms 2.4.2 → 2.5.1

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.
@@ -3,7 +3,7 @@ export type ValidationFormType = 'control' | 'group' | 'array';
3
3
  export interface ValidationFormError<T = any> extends ValidatorError<T> {
4
4
  type: ValidationFormType;
5
5
  }
6
- export type SubscriberControl<T> = (state: T) => void;
6
+ export type SubscriberControl<T> = (value: T) => void;
7
7
  export interface AbstractControl<T = any> {
8
8
  readonly dirty: boolean;
9
9
  readonly disabled: boolean;
@@ -17,7 +17,7 @@ export interface AbstractControl<T = any> {
17
17
  readonly valid: boolean;
18
18
  readonly wrong: boolean;
19
19
  readonly error?: ValidatorError;
20
- readonly state?: T;
20
+ readonly value?: T;
21
21
  }
22
22
  export interface AbstractFormControl<T = any> extends AbstractControl<T> {
23
23
  blur: () => void;
@@ -25,7 +25,7 @@ export interface AbstractFormControl<T = any> extends AbstractControl<T> {
25
25
  enable: () => void;
26
26
  focus: () => void;
27
27
  readonly focused: boolean;
28
- setState: (state: T) => void;
28
+ setValue: (value: T) => void;
29
29
  setValidators: (validators?: ValidatorFn<T>[]) => void;
30
30
  touch: () => void;
31
31
  readonly unfocused: boolean;
@@ -34,8 +34,8 @@ export interface AbstractReactiveControl<T = any> extends AbstractFormControl<T>
34
34
  subscribe: (subscriber: SubscriberControl<T>) => Unsubscription;
35
35
  }
36
36
  export type AbstractControls<T extends AbstractControl = AbstractControl> = Record<string, T>;
37
- export interface AbstractGroup<T extends AbstractControls = AbstractControls> {
38
- readonly controls: T;
37
+ export interface AbstractGroup<C extends AbstractControls = AbstractControls> {
38
+ readonly controls: C;
39
39
  readonly dirty: boolean;
40
40
  readonly dirtyAll: boolean;
41
41
  readonly errors: ValidatorError[];
@@ -50,15 +50,15 @@ export interface AbstractGroup<T extends AbstractControls = AbstractControls> {
50
50
  readonly wrong: boolean;
51
51
  readonly error?: ValidatorError;
52
52
  }
53
- export type StateGroup<C extends AbstractControls = AbstractControls> = {
54
- [K in keyof C]: C[K]['state'];
53
+ export type ValueGroup<C extends AbstractControls = AbstractControls> = {
54
+ [K in keyof C]: C[K]['value'];
55
55
  };
56
56
  export type ValidatorGroupFn<C extends AbstractControls = AbstractControls, V = any> = (controls: C) => ValidatorResult<V>;
57
- export type SubscriberGroup<C extends AbstractControls = AbstractControls> = (state: StateGroup<C>) => void;
57
+ export type SubscriberGroup<C extends AbstractControls = AbstractControls> = (value: ValueGroup<C>) => void;
58
58
  export interface AbstractFormGroup<C extends AbstractControls = AbstractControls> extends AbstractGroup<C> {
59
59
  reset: () => void;
60
60
  setValidators: (validators: ValidatorGroupFn<C>[]) => void;
61
- readonly state: StateGroup<C>;
61
+ readonly value: ValueGroup<C>;
62
62
  }
63
63
  export interface AbstractReactiveGroup<C extends AbstractControls = AbstractControls> extends AbstractFormGroup<C> {
64
64
  subscribe: (subscriber: SubscriberGroup<C>) => Unsubscription;
@@ -72,7 +72,7 @@ export interface AbstractReactiveArrayControl<T = any> extends AbstractArrayCont
72
72
  export type AbstractArrayControls<T extends AbstractArrayControl = AbstractArrayControl> = AbstractControls<T>;
73
73
  export interface AbstractArrayGroup<C extends AbstractArrayControls, R = any> extends AbstractGroup<C> {
74
74
  setValidators: (validators: ValidatorGroupFn<C>[]) => void;
75
- readonly state: ArrayStateGroup<C>;
75
+ readonly value: ArrayStateGroup<C>;
76
76
  readonly uuid: string;
77
77
  resource?: R;
78
78
  }
@@ -80,7 +80,7 @@ export interface AbstractReactiveArrayGroup<C extends AbstractArrayControls, R =
80
80
  subscribe: (subscriber: SubscriberGroup<C>) => Unsubscription;
81
81
  }
82
82
  export type ArrayStateGroup<C extends AbstractArrayControls> = {
83
- [K in keyof C]: C[K]['state'];
83
+ [K in keyof C]: C[K]['value'];
84
84
  };
85
85
  export type ValidatorArrayFn<T extends AbstractArrayControls = AbstractArrayControls, R = any, G extends AbstractArrayGroup<T, R> = AbstractArrayGroup<T, R>, V = any> = (groups: G[]) => ValidatorResult<V>;
86
86
  export type ArrayFormControls<T extends AbstractArrayControl = AbstractArrayControl> = AbstractArrayControls<T>;
@@ -105,11 +105,11 @@ export interface AbstractReactiveArray<C extends AbstractArrayControls = Abstrac
105
105
  subscribe: (subscriber: SubscriberArray<C>) => Unsubscription;
106
106
  }
107
107
  export interface FormControlOptions<T = any> {
108
- state: T;
108
+ value: T;
109
109
  validators?: ValidatorFn<T>[];
110
110
  }
111
111
  export type FormStateOptions<T> = Omit<FormControlOptions<T>, 'validators'>;
112
- export type FormValidatorsOptions<T> = Omit<FormControlOptions<T>, 'state'>;
112
+ export type FormValidatorsOptions<T> = Omit<FormControlOptions<T>, 'value'>;
113
113
  export interface FormGroupOptions<C extends AbstractControls = AbstractControls> {
114
114
  controls: C;
115
115
  validators?: ValidatorGroupFn<C>[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolster/forms",
3
- "version": "2.4.2",
3
+ "version": "2.5.1",
4
4
  "description": "It implements a set of classes that allow managing the control of states of the input components of the UI.",
5
5
  "module": "dist/esm/index.js",
6
6
  "main": "dist/cjs/index.js",