@dynamicforms/vue-forms 0.3.3 → 0.3.5

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/dist/index.d.ts CHANGED
@@ -4,18 +4,14 @@ import { Ref } from 'vue';
4
4
  export declare class AbortEventHandlingException extends Error {
5
5
  }
6
6
 
7
- export declare class Action<T extends ActionValue = ActionValue> extends FieldBase<T> {
8
- private _value;
7
+ export declare class Action<T extends ActionValue = ActionValue> extends Field<T> {
9
8
  constructor(guard?: symbol);
10
9
  protected init(params?: Partial<IFieldConstructorParams<T>>): void;
11
- static create<T extends ActionValue = ActionValue>(this: new (guard?: symbol) => Action<T>, params?: Partial<IFieldConstructorParams<T>>): InstanceType<typeof this>;
12
- get value(): T;
13
- set value(newValue: T);
10
+ static create<T extends ActionValue = ActionValue>(params?: Partial<IFieldConstructorParams<T>>): Action<T>;
14
11
  get icon(): string | undefined;
15
12
  set icon(newValue: string | undefined);
16
13
  get label(): string | undefined;
17
14
  set label(newValue: string | undefined);
18
- clone(overrides?: Partial<IField<T>>): Action<T>;
19
15
  execute(params: any): void;
20
16
  }
21
17
 
@@ -117,7 +113,7 @@ export declare class ExecuteAction extends FieldActionBase {
117
113
  }
118
114
 
119
115
  export declare class Field<T = any> extends FieldBase {
120
- private _value;
116
+ protected _value: T;
121
117
  constructor(guard?: symbol);
122
118
  protected init(params?: Partial<IFieldConstructorParams<T>>): void;
123
119
  /**
@@ -128,7 +124,7 @@ export declare class Field<T = any> extends FieldBase {
128
124
  static create<T = any>(this: new (guard?: symbol) => Field<T>, params?: Partial<IFieldConstructorParams<T>>): InstanceType<typeof this>;
129
125
  get value(): T;
130
126
  set value(newValue: T);
131
- clone(overrides?: Partial<IField<T>>): Field<T>;
127
+ clone(overrides?: Partial<IField<T>>): this;
132
128
  }
133
129
 
134
130
  export declare abstract class FieldActionBase implements IFieldAction {
@@ -172,6 +168,10 @@ export declare abstract class FieldBase<T = any> implements IField<T> {
172
168
  clearValidators(): void;
173
169
  }
174
170
 
171
+ declare type FieldsToValues<T extends GenericFieldsInterface> = {
172
+ [K in keyof T]: T[K] extends IField<infer U> ? U : T[K] extends Group<infer G> ? FieldsToValues<G> : any;
173
+ };
174
+
175
175
  declare namespace Form {
176
176
  export {
177
177
  DisplayMode,
@@ -241,6 +241,7 @@ export declare type GenericFieldsInterface = Record<string, IField>;
241
241
  export declare class Group<T extends GenericFieldsInterface = GenericFieldsInterface> extends FieldBase {
242
242
  private readonly _fields;
243
243
  private _value;
244
+ readonly reactiveValue: ComputedRef<FieldsToValues<T> | null>;
244
245
  private suppressNotifyValueChanged;
245
246
  constructor(fields: T, params?: Partial<IFieldConstructorParams>);
246
247
  private addField;
@@ -248,8 +249,8 @@ export declare class Group<T extends GenericFieldsInterface = GenericFieldsInter
248
249
  static createFromFormData(data: Record<string, any> | null): Group;
249
250
  field<K extends keyof T>(fieldName: K): T[K] | null;
250
251
  get fields(): T;
251
- get value(): Record<string, any> | null;
252
- set value(newValue: Record<string, any> | null);
252
+ get value(): FieldsToValues<T> | null;
253
+ set value(newValue: FieldsToValues<T> | null);
253
254
  get fullValue(): Record<string, any>;
254
255
  notifyValueChanged(): void;
255
256
  get valid(): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dynamicforms/vue-forms",
3
3
  "private": false,
4
- "version": "0.3.3",
4
+ "version": "0.3.5",
5
5
  "type": "module",
6
6
  "description": "Data entry forms for vue - logic (no controls here)",
7
7
  "author": "Jure Erznožnik",