|
@@ -10,21 +10,22 @@ import { ValueTransformer } from '@modules/dynaform/interfaces';
|
|
|
import { standardModifiers, standardTransformer } from '@modules/dynaform/utils';
|
|
|
|
|
|
interface SimpleFieldMetaData {
|
|
|
- name: string;
|
|
|
- source?: string;
|
|
|
- type?: string;
|
|
|
- label?: string;
|
|
|
- value?: any;
|
|
|
- default?: any;
|
|
|
- placeholder?: string;
|
|
|
- class?: string | Array<string>;
|
|
|
- id?: string;
|
|
|
- before?: string;
|
|
|
- after?: string;
|
|
|
- isDisabled?: boolean;
|
|
|
- validators?: Array<ValidatorFn>;
|
|
|
- asyncValidators?: Array<AsyncValidatorFn>;
|
|
|
- valFailureMsgs?: StringMap;
|
|
|
+ name: string;
|
|
|
+ source?: string;
|
|
|
+ type?: string;
|
|
|
+ label?: string;
|
|
|
+ value?: any;
|
|
|
+ default?: any;
|
|
|
+ placeholder?: string;
|
|
|
+ class?: string | string[];
|
|
|
+ id?: string;
|
|
|
+ before?: string;
|
|
|
+ after?: string;
|
|
|
+ isDisabled?: boolean;
|
|
|
+ validators?: ValidatorFn[];
|
|
|
+ asyncValidators?: AsyncValidatorFn[];
|
|
|
+ valFailureMsgs?: StringMap;
|
|
|
+ onChange?: (val) => {};
|
|
|
}
|
|
|
|
|
|
interface Option {
|
|
@@ -75,11 +76,11 @@ abstract class SimpleField {
|
|
|
value;
|
|
|
default = '';
|
|
|
placeholder = '';
|
|
|
- class?: string | Array<string>;
|
|
|
+ class?: string | string[];
|
|
|
id?: string;
|
|
|
isDisabled = false;
|
|
|
- validators: Array<ValidatorFn> = [];
|
|
|
- asyncValidators: Array<AsyncValidatorFn> = [];
|
|
|
+ validators: ValidatorFn[] = [];
|
|
|
+ asyncValidators: AsyncValidatorFn[] = [];
|
|
|
valFailureMsgs: StringMap = {};
|
|
|
|
|
|
constructor(meta: SimpleFieldMetaData) {
|
|
@@ -139,7 +140,6 @@ abstract class OptionsField extends SimpleField {
|
|
|
class TextField extends SimpleField {
|
|
|
type = 'Text';
|
|
|
link?: Link;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
class TextareaField extends SimpleField {
|
|
@@ -215,7 +215,7 @@ class CheckbuttonGroup {
|
|
|
const groupMembers = groupmeta.meta;
|
|
|
this.meta = Object.entries(groupMembers)
|
|
|
.map( ([key, cb]) => [key, new CheckbuttonField(cb as SimpleFieldMetaData)] )
|
|
|
- .reduce((res, [key, cbf]) => { res[<string>key] = cbf; return res; }, {});
|
|
|
+ .reduce((res, [key, cbf]) => { res[key as string] = cbf; return res; }, {});
|
|
|
}
|
|
|
}
|
|
|
}
|