|
@@ -105,10 +105,10 @@ abstract class SimpleField {
|
|
|
const boundFn = this.asyncValidators.bind(context);
|
|
|
this.asyncValidators = boundFn;
|
|
|
} else {
|
|
|
- for (const i in this.asyncValidators) {
|
|
|
- const boundFn = this.asyncValidators[i].bind(context);
|
|
|
+ this.asyncValidators.forEach((valFn, i) => {
|
|
|
+ const boundFn = valFn.bind(context);
|
|
|
this.asyncValidators[i] = boundFn;
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -176,6 +176,13 @@ class PasswordField extends SimpleField {
|
|
|
class SelectField extends OptionsField {
|
|
|
type = 'Select';
|
|
|
link?: ILink;
|
|
|
+ constructor(meta: IOptionsFieldMetaData, context?: any) {
|
|
|
+ super(meta, context);
|
|
|
+ // If there's only one possible choice set the value
|
|
|
+ if (this.options.length === 1) {
|
|
|
+ this.default = this.options[0].value as string;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class RadioField extends OptionsField {
|
|
@@ -334,9 +341,9 @@ class RepeatingContainer {
|
|
|
this.initialRepeat = containerMeta.meta.length;
|
|
|
}
|
|
|
this.meta = containerMeta.meta.map((m, i) => new Container({
|
|
|
- name: `${this.prefix}${i+1}`,
|
|
|
+ name: `${this.prefix}${i + 1}`,
|
|
|
meta: m,
|
|
|
- button: unCamelCase(`${this.prefix}${i+1}`),
|
|
|
+ button: unCamelCase(`${this.prefix}${i + 1}`),
|
|
|
focussed: this.display === 'SINGLE' ? i === 0 : true
|
|
|
}));
|
|
|
}
|
|
@@ -407,7 +414,7 @@ class DisplayField extends SimpleField {
|
|
|
// Interfaces
|
|
|
export {
|
|
|
IOption, ILink
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
// Classes
|
|
|
export {
|