|
@@ -15,6 +15,7 @@ interface ISimpleFieldMetaData {
|
|
type?: string; // The component type e.g. BasicInput, Checkbutton, Timepicker, etc
|
|
type?: string; // The component type e.g. BasicInput, Checkbutton, Timepicker, etc
|
|
label?: string; // The field label - defaults to unCamelCased name if not supplied
|
|
label?: string; // The field label - defaults to unCamelCased name if not supplied
|
|
value?: any; // The field value - defaults to empty string if not supplied
|
|
value?: any; // The field value - defaults to empty string if not supplied
|
|
|
|
+ checkedValue?: boolean|number|string; // Checkboxes and Checkbuttons only
|
|
default?: any; // Default value
|
|
default?: any; // Default value
|
|
placeholder?: string; // Optional placeholder text
|
|
placeholder?: string; // Optional placeholder text
|
|
class?: string | string[]; // CSS classes to apply
|
|
class?: string | string[]; // CSS classes to apply
|
|
@@ -74,6 +75,7 @@ abstract class SimpleField {
|
|
source?: string;
|
|
source?: string;
|
|
label?: string;
|
|
label?: string;
|
|
value;
|
|
value;
|
|
|
|
+ checkedValue?: boolean|number|string;
|
|
default = '';
|
|
default = '';
|
|
placeholder = '';
|
|
placeholder = '';
|
|
class?: string | string[];
|
|
class?: string | string[];
|
|
@@ -84,9 +86,6 @@ abstract class SimpleField {
|
|
valFailureMsgs: StringMap<any> = {};
|
|
valFailureMsgs: StringMap<any> = {};
|
|
|
|
|
|
constructor(meta: ISimpleFieldMetaData) {
|
|
constructor(meta: ISimpleFieldMetaData) {
|
|
- if (meta.type === 'Multiline') {
|
|
|
|
- console.log(meta);
|
|
|
|
- }
|
|
|
|
Object.assign(this, meta);
|
|
Object.assign(this, meta);
|
|
if (!this.source) {
|
|
if (!this.source) {
|
|
// If source is not supplied it's the same as the name
|
|
// If source is not supplied it's the same as the name
|
|
@@ -164,10 +163,19 @@ class RadioField extends OptionsField {
|
|
|
|
|
|
class CheckboxField extends SimpleField {
|
|
class CheckboxField extends SimpleField {
|
|
type = 'Checkbox';
|
|
type = 'Checkbox';
|
|
- default: any = false;
|
|
|
|
isChecked: boolean;
|
|
isChecked: boolean;
|
|
- checkedValue: boolean | string = true;
|
|
|
|
|
|
+ default: any = false;
|
|
|
|
+ checkedValue: boolean|number|string = true;
|
|
rowLabel: null;
|
|
rowLabel: null;
|
|
|
|
+ constructor(meta: ISimpleFieldMetaData) {
|
|
|
|
+ super(meta);
|
|
|
|
+ if (meta.checkedValue) {
|
|
|
|
+ this.checkedValue = meta.checkedValue;
|
|
|
|
+ }
|
|
|
|
+ if (meta.default) {
|
|
|
|
+ this.default = meta.default;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
class HiddenField extends SimpleField {
|
|
class HiddenField extends SimpleField {
|
|
@@ -177,12 +185,8 @@ class HiddenField extends SimpleField {
|
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
// Concrete Implementations - Custom Form Components
|
|
// Concrete Implementations - Custom Form Components
|
|
|
|
|
|
-class CheckbuttonField extends SimpleField {
|
|
|
|
|
|
+class CheckbuttonField extends CheckboxField {
|
|
type = 'Checkbutton';
|
|
type = 'Checkbutton';
|
|
- default: any = false;
|
|
|
|
- isChecked: boolean;
|
|
|
|
- checkedValue: boolean | string = true;
|
|
|
|
- rowLabel: null;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
class DropdownModifiedInputField extends SimpleField {
|
|
class DropdownModifiedInputField extends SimpleField {
|