diff options
author | Armen Kesablyan | 2012-06-19 00:45:26 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-19 00:45:26 -0700 |
commit | c59eb371559a3061ce53223e249ca97daace5968 (patch) | |
tree | f9540e26c0f273d35f92010605da65dd85bbe70c /node_modules/montage/ui/token-field | |
parent | 0f040acabfb7a4bf3138debec5aff869487ceb11 (diff) | |
parent | 918a4f5870e972b6e4e301c3237e065a1ffd26f5 (diff) | |
download | ninja-c59eb371559a3061ce53223e249ca97daace5968.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Diffstat (limited to 'node_modules/montage/ui/token-field')
4 files changed, 68 insertions, 39 deletions
diff --git a/node_modules/montage/ui/token-field/token-field.reel/token-field.html b/node_modules/montage/ui/token-field/token-field.reel/token-field.html index 0335de13..2a2d98d4 100644 --- a/node_modules/montage/ui/token-field/token-field.reel/token-field.html +++ b/node_modules/montage/ui/token-field/token-field.reel/token-field.html | |||
@@ -9,7 +9,7 @@ | |||
9 | { | 9 | { |
10 | 10 | ||
11 | "owner": { | 11 | "owner": { |
12 | "prototype": "montage/ui/token-field/token-field.reel", | 12 | "prototype": "ui/token-field/token-field.reel", |
13 | "properties": { | 13 | "properties": { |
14 | "element": {"#": "token-field"}, | 14 | "element": {"#": "token-field"}, |
15 | "_autocomplete": {"@": "autocomplete"}, | 15 | "_autocomplete": {"@": "autocomplete"}, |
@@ -22,18 +22,18 @@ | |||
22 | } | 22 | } |
23 | }, | 23 | }, |
24 | "tokensController": { | 24 | "tokensController": { |
25 | "prototype": "montage/ui/controller/array-controller", | 25 | "prototype": "ui/controller/array-controller", |
26 | "properties": { | 26 | "properties": { |
27 | "selectObjectsOnAddition": true, | 27 | "selectObjectsOnAddition": true, |
28 | "automaticallyOrganizeObjects": true | 28 | "automaticallyOrganizeObjects": true |
29 | }, | 29 | }, |
30 | "bindings": { | 30 | "bindings": { |
31 | "content": {"<<->": "@owner.values"} | 31 | "content": {"<->": "@owner.values"} |
32 | } | 32 | } |
33 | }, | 33 | }, |
34 | 34 | ||
35 | "tokenList": { | 35 | "tokenList": { |
36 | "prototype": "montage/ui/repetition.reel", | 36 | "prototype": "ui/repetition.reel", |
37 | "properties": { | 37 | "properties": { |
38 | "element": { | 38 | "element": { |
39 | "#": "token-list" | 39 | "#": "token-list" |
@@ -45,7 +45,7 @@ | |||
45 | }, | 45 | }, |
46 | 46 | ||
47 | "token": { | 47 | "token": { |
48 | "prototype": "montage/ui/token-field/token.reel", | 48 | "prototype": "ui/token-field/token.reel", |
49 | "properties": { | 49 | "properties": { |
50 | "element": {"#": "token"} | 50 | "element": {"#": "token"} |
51 | }, | 51 | }, |
@@ -57,7 +57,7 @@ | |||
57 | } | 57 | } |
58 | }, | 58 | }, |
59 | "autocomplete": { | 59 | "autocomplete": { |
60 | "prototype": "montage/ui/autocomplete/autocomplete.reel", | 60 | "prototype": "ui/autocomplete/autocomplete.reel", |
61 | "properties": { | 61 | "properties": { |
62 | "element": {"#": "autocomplete"}, | 62 | "element": {"#": "autocomplete"}, |
63 | "identifier": "autocomplete", | 63 | "identifier": "autocomplete", |
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 | ||
16 | exports.TokenField = Montage.create(Component, { | 16 | exports.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 | } |
diff --git a/node_modules/montage/ui/token-field/token.reel/token.html b/node_modules/montage/ui/token-field/token.reel/token.html index 54ba266e..c478ef0c 100644 --- a/node_modules/montage/ui/token-field/token.reel/token.html +++ b/node_modules/montage/ui/token-field/token.reel/token.html | |||
@@ -9,7 +9,7 @@ | |||
9 | { | 9 | { |
10 | 10 | ||
11 | "tokenText": { | 11 | "tokenText": { |
12 | "prototype": "montage/ui/dynamic-text.reel", | 12 | "prototype": "ui/dynamic-text.reel", |
13 | "properties": { | 13 | "properties": { |
14 | "element": {"#": "token-text"} | 14 | "element": {"#": "token-text"} |
15 | }, | 15 | }, |
@@ -18,7 +18,7 @@ | |||
18 | } | 18 | } |
19 | }, | 19 | }, |
20 | "tokenDelete": { | 20 | "tokenDelete": { |
21 | "prototype": "montage/ui/dynamic-text.reel", | 21 | "prototype": "ui/dynamic-text.reel", |
22 | "properties": { | 22 | "properties": { |
23 | "element": {"#": "token-delete"}, | 23 | "element": {"#": "token-delete"}, |
24 | "value": "✕" | 24 | "value": "✕" |
@@ -26,7 +26,7 @@ | |||
26 | }, | 26 | }, |
27 | 27 | ||
28 | "owner": { | 28 | "owner": { |
29 | "prototype": "montage/ui/token-field/token.reel", | 29 | "prototype": "ui/token-field/token.reel", |
30 | "properties": { |