aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/token-field/token-field.reel/token-field.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/ui/token-field/token-field.reel/token-field.js')
-rw-r--r--node_modules/montage/ui/token-field/token-field.reel/token-field.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/node_modules/montage/ui/token-field/token-field.reel/token-field.js b/node_modules/montage/ui/token-field/token-field.reel/token-field.js
index 9f08e477..f8070993 100644
--- a/node_modules/montage/ui/token-field/token-field.reel/token-field.js
+++ b/node_modules/montage/ui/token-field/token-field.reel/token-field.js
@@ -15,21 +15,21 @@ KEY_DOWN = 40;
15 15
16exports.TokenField = Montage.create(Component, { 16exports.TokenField = Montage.create(Component, {
17 17
18 delegate: {value: null}, 18 delegate: {value: null, serializable: true},
19 19
20 values: {value: null}, 20 values: {value: null, serializable: true},
21 21
22 /** 22 /**
23 * Path to a String within an Object that is representative of the Object 23 * Path to a String within an Object that is representative of the Object
24 */ 24 */
25 textPropertyPath: {value: null}, 25 textPropertyPath: {value: null, serializable: true},
26 26
27 /** 27 /**
28 * Allow ad-hoc strings (strings that do not have corresponding represented object) to be entered. 28 * Allow ad-hoc strings (strings that do not have corresponding represented object) to be entered.
29 */ 29 */
30 allowAdHocValues: {value: null}, 30 allowAdHocValues: {value: null, serializable: true},
31 31
32 placeholder: {value: null}, 32 placeholder: {value: null, serializable: true},
33 33
34 34
35 // private 35 // private
@@ -47,11 +47,12 @@ exports.TokenField = Montage.create(Component, {
47 } 47 }
48 }, 48 },
49 49
50 _tokensController: {value: null}, 50 _tokensController: {value: null, serializable: true},
51 _tokenList: {value: null, enumerable: false}, 51 _tokenList: {value: null, serializable: true},
52 _autocomplete: {value: null, enumerable: false}, 52 _autocomplete: {value: null, serializable: true},
53 __autocompleteValue: {value: null}, 53 __autocompleteValue: {value: null},
54 _autocompleteValue: { 54 _autocompleteValue: {
55 serializable: true,
55 get: function() { 56 get: function() {
56 return this.__autocompleteValue; 57 return this.__autocompleteValue;
57 }, 58 },
@@ -62,6 +63,7 @@ exports.TokenField = Montage.create(Component, {
62 63
63 __suggestedValue: {value: null}, 64 __suggestedValue: {value: null},
64 _suggestedValue: { 65 _suggestedValue: {
66 serializable: true,
65 get: function() { 67 get: function() {
66 return this.__suggestedValue; 68 return this.__suggestedValue;
67 }, 69 },
@@ -84,6 +86,8 @@ exports.TokenField = Montage.create(Component, {
84 this.values.push(this.__suggestedValue); 86 this.values.push(this.__suggestedValue);
85 this._autocomplete.value = ''; 87 this._autocomplete.value = '';
86 } 88 }
89 // nullify the value as autocomplete.value is empty
90 this.__suggestedValue = null;
87 91
88 } 92 }
89 } 93 }
@@ -129,7 +133,6 @@ exports.TokenField = Montage.create(Component, {
129 }, 133 },
130 134
131 handleKeyup: { 135 handleKeyup: {
132 enumerable: false,
133 value: function(e) { 136 value: function(e) {
134 var code = e.keyCode; 137 var code = e.keyCode;
135 //console.log('keyCode', code); 138 //console.log('keyCode', code);
@@ -150,7 +153,8 @@ exports.TokenField = Montage.create(Component, {
150 // check if the selected token is the last one 153 // check if the selected token is the last one
151 if(selectedIndexes && selectedIndexes.length > 0) { 154 if(selectedIndexes && selectedIndexes.length > 0) {
152 // removes the selected one 155 // removes the selected one
153 this._tokensController.remove(); 156 this._tokensController.removeObjectsAtSelectedIndexes();
157 this._tokensController.selectedIndexes = [];
154 } else { 158 } else {
155 this._tokensController.selectedIndexes = [this.values.length-1]; 159 this._tokensController.selectedIndexes = [this.values.length-1];
156 } 160 }