Added form-level change event

This commit is contained in:
Henry
2016-02-08 17:46:21 -08:00
parent 9371fcbc4c
commit be031285b9
7 changed files with 18 additions and 23 deletions

View File

@ -46,6 +46,7 @@ define(
*/ */
this.xAxisForm = { this.xAxisForm = {
'name':'x-axis', 'name':'x-axis',
'onchange': onchange,
'sections': [{ 'sections': [{
'name': 'x-axis', 'name': 'x-axis',
'rows': [ 'rows': [
@ -53,7 +54,6 @@ define(
'name': 'Domain', 'name': 'Domain',
'control': 'select', 'control': 'select',
'key': 'key', 'key': 'key',
'onchange': onchange,
'options': [ 'options': [
{'name':'scet', 'value': 'scet'}, {'name':'scet', 'value': 'scet'},
{'name':'sclk', 'value': 'sclk'}, {'name':'sclk', 'value': 'sclk'},
@ -65,6 +65,7 @@ define(
this.yAxisForm = { this.yAxisForm = {
'name':'y-axis', 'name':'y-axis',
'onchange': onchange,
'sections': [{ 'sections': [{
// Will need to be repeated for each y-axis, with a // Will need to be repeated for each y-axis, with a
// distinct name for each. Ideally the name of the axis // distinct name for each. Ideally the name of the axis
@ -74,28 +75,24 @@ define(
{ {
'name': 'Autoscale', 'name': 'Autoscale',
'control': 'checkbox', 'control': 'checkbox',
'key': 'autoscale', 'key': 'autoscale'
'onchange': onchange
}, },
{ {
'name': 'Min', 'name': 'Min',
'control': 'textfield', 'control': 'textfield',
'key': 'min', 'key': 'min',
'pattern': '[0-9]', 'pattern': '[0-9]'
'onchange': onchange
}, },
{ {
'name': 'Max', 'name': 'Max',
'control': 'textfield', 'control': 'textfield',
'key': 'max', 'key': 'max',
'pattern': '[0-9]', 'pattern': '[0-9]'
'onchange': onchange
}, },
{ {
'name': 'Range', 'name': 'Range',
'control': 'select', 'control': 'select',
'key': 'key', 'key': 'key',
'onchange': onchange,
'options': [ 'options': [
{'name':'eu', 'value': 'eu'}, {'name':'eu', 'value': 'eu'},
{'name':'dn', 'value': 'dn'}, {'name':'dn', 'value': 'dn'},
@ -107,14 +104,14 @@ define(
}; };
this.plotSeriesForm = { this.plotSeriesForm = {
'name':'Series Options', 'name':'Series Options',
'onchange': onchange,
'sections': [ 'sections': [
{ {
rows: [ rows: [
{ {
'name': 'Color', 'name': 'Color',
'control': 'color', 'control': 'color',
'key': 'color', 'key': 'color'
'onchange': onchange
}] }]
}, },
{ {
@ -122,8 +119,7 @@ define(
{ {
'name': 'Markers', 'name': 'Markers',
'control': 'checkbox', 'control': 'checkbox',
'key': 'markers', 'key': 'markers'
'onchange': onchange
} }
] ]
}, },
@ -133,22 +129,19 @@ define(
'name': 'No Line', 'name': 'No Line',
'control': 'radio', 'control': 'radio',
'key': 'lineType', 'key': 'lineType',
'value': 'noLine', 'value': 'noLine'
'onchange': onchange
}, },
{ {
'name': 'Step Line', 'name': 'Step Line',
'control': 'radio', 'control': 'radio',
'key': 'lineType', 'key': 'lineType',
'value': 'stepLine', 'value': 'stepLine'
'onchange': onchange
}, },
{ {
'name': 'Linear Line', 'name': 'Linear Line',
'control': 'radio', 'control': 'radio',
'key': 'lineType', 'key': 'lineType',
'value': 'linearLine', 'value': 'linearLine'
'onchange': onchange
} }
] ]
} }

View File

@ -23,7 +23,7 @@
<input type="checkbox" <input type="checkbox"
name="mctControl" name="mctControl"
ng-model="ngModel[field]" ng-model="ngModel[field]"
ng-change="structure.onchange(ngModel[field])" ng-change="ngChange()"
ng-disabled="ngDisabled"> ng-disabled="ngDisabled">
<em></em> <em></em>
</label> </label>

View File

@ -24,7 +24,7 @@
name="mctControl" name="mctControl"
ng-model="ngModel[field]" ng-model="ngModel[field]"
ng-disabled="ngDisabled" ng-disabled="ngDisabled"
ng-change="structure.onchange(ngModel[field])" ng-change="ngChange()"
ng-value="structure.value"> ng-value="structure.value">
<em></em> <em></em>
</label> </label>

View File

@ -24,7 +24,7 @@
ng-model="ngModel[field]" ng-model="ngModel[field]"
ng-options="opt.value as opt.name for opt in options" ng-options="opt.value as opt.name for opt in options"
ng-required="ngRequired" ng-required="ngRequired"
ng-change="structure.onchange(ngModel[field])" ng-change="ngChange()"
name="mctControl"> name="mctControl">
<option value="" ng-show="!ngModel[field]">- Select One -</option> <option value="" ng-show="!ngModel[field]">- Select One -</option>
</select> </select>

View File

@ -25,7 +25,7 @@
ng-required="ngRequired" ng-required="ngRequired"
ng-model="ngModel[field]" ng-model="ngModel[field]"
ng-pattern="ngPattern" ng-pattern="ngPattern"
ng-change="structure.onchange(ngModel[field])" ng-change="ngChange()"
size="{{structure.size}}" size="{{structure.size}}"
name="mctControl"> name="mctControl">
</span> </span>

View File

@ -41,7 +41,7 @@
<mct-control key="row.control" <mct-control key="row.control"
ng-model="ngModel" ng-model="ngModel"
ng-required="row.required" ng-required="row.required"
ng-change="row.onchange" ng-change="row.onchange(ngModel[row.key]); structure.onchange(ngModel)"
ng-pattern="getRegExp(row.pattern)" ng-pattern="getRegExp(row.pattern)"
options="row.options" options="row.options"
structure="row" structure="row"

View File

@ -97,6 +97,8 @@ define(
// Set of choices (if any) // Set of choices (if any)
options: "=", options: "=",
ngChange: "&",
// Structure (subtree of Form Structure) // Structure (subtree of Form Structure)
structure: "=", structure: "=",