| @@ 8848-8870 (lines=23) @@ | ||
| 8845 | lastItemCtrl = ctrl; |
|
| 8846 | }); |
|
| 8847 | }, |
|
| 8848 | value: function (value) { |
|
| 8849 | if (arguments.length === 0) { |
|
| 8850 | return this.state.get('value'); |
|
| 8851 | } |
|
| 8852 | if (typeof value === 'undefined') { |
|
| 8853 | return this; |
|
| 8854 | } |
|
| 8855 | function valueExists(values) { |
|
| 8856 | return exists(values, function (a) { |
|
| 8857 | return a.menu ? valueExists(a.menu) : a.value === value; |
|
| 8858 | }); |
|
| 8859 | } |
|
| 8860 | if (this.settings.values) { |
|
| 8861 | if (valueExists(this.settings.values)) { |
|
| 8862 | this.state.set('value', value); |
|
| 8863 | } else if (value === null) { |
|
| 8864 | this.state.set('value', null); |
|
| 8865 | } |
|
| 8866 | } else { |
|
| 8867 | this.state.set('value', value); |
|
| 8868 | } |
|
| 8869 | return this; |
|
| 8870 | }, |
|
| 8871 | bindStates: function () { |
|
| 8872 | var self = this; |
|
| 8873 | function activateMenuItemsByValue(menu, value) { |
|
| @@ 8656-8678 (lines=23) @@ | ||
| 8653 | lastItemCtrl = ctrl; |
|
| 8654 | }); |
|
| 8655 | }, |
|
| 8656 | value: function (value) { |
|
| 8657 | if (arguments.length === 0) { |
|
| 8658 | return this.state.get('value'); |
|
| 8659 | } |
|
| 8660 | if (typeof value === 'undefined') { |
|
| 8661 | return this; |
|
| 8662 | } |
|
| 8663 | function valueExists(values) { |
|
| 8664 | return exists(values, function (a) { |
|
| 8665 | return a.menu ? valueExists(a.menu) : a.value === value; |
|
| 8666 | }); |
|
| 8667 | } |
|
| 8668 | if (this.settings.values) { |
|
| 8669 | if (valueExists(this.settings.values)) { |
|
| 8670 | this.state.set('value', value); |
|
| 8671 | } else if (value === null) { |
|
| 8672 | this.state.set('value', null); |
|
| 8673 | } |
|
| 8674 | } else { |
|
| 8675 | this.state.set('value', value); |
|
| 8676 | } |
|
| 8677 | return this; |
|
| 8678 | }, |
|
| 8679 | bindStates: function () { |
|
| 8680 | var self = this; |
|
| 8681 | function activateMenuItemsByValue(menu, value) { |
|