File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import * as selection from '../../../src/selection/grid/_export.mjs' ;
22import Container from '../../../src/container/Base.mjs' ;
3+ import Country from '../../../src/form/field/Country.mjs' ;
34import Radio from '../../../src/form/field/Radio.mjs' ;
45import TabContainer from '../../../src/tab/Container.mjs' ;
56
@@ -48,6 +49,15 @@ class ControlsContainer extends Container {
4849 name : 'search' ,
4950 style : { marginTop : '.3em' } ,
5051 width : 200
52+ } , {
53+ module : Country ,
54+ clearable : true ,
55+ labelText : 'Country' ,
56+ labelWidth : 65 ,
57+ pickerWidth : null ,
58+ showFlags : true ,
59+ style : { marginTop : '.3em' } ,
60+ width : 200
5161 } , {
5262 ntype : 'label' ,
5363 reference : 'count-rows-label' ,
Original file line number Diff line number Diff line change 1+ .neo-country-list.neo-list {
2+ .neo-country-flag {
3+ display : inline-block ;
4+ height : 20px ;
5+ margin-right : 10px ;
6+ vertical-align : middle ;
7+ width : 20px ;
8+ }
9+
10+ .neo-country-text {
11+ text-transform : capitalize ;
12+ vertical-align : middle ;
13+ }
14+ }
Original file line number Diff line number Diff line change @@ -19,11 +19,36 @@ class Country extends ComboBox {
1919 * @protected
2020 */
2121 ntype : 'countryfield' ,
22+ /**
23+ * @member {Number} pickerWidth=200
24+ */
25+ pickerWidth : 300 ,
2226 /**
2327 * @member {Boolean} showFlags_=false
2428 * @reactive
2529 */
2630 showFlags_ : false ,
31+ /**
32+ * @member {Object} store
33+ */
34+ store : {
35+ data : CountryFlags . countries ,
36+ keyProperty : 'code' ,
37+ model : {
38+ fields : [
39+ { name : 'name' , type : 'String' } ,
40+ { name : 'code' , type : 'String' }
41+ ]
42+ } ,
43+ sorters : [ {
44+ property : 'name' ,
45+ direction : 'ASC'
46+ } ]
47+ } ,
48+ /**
49+ * @member {String} valueField='name'
50+ */
51+ valueField : 'name' ,
2752 /**
2853 * You can either pass a field instance or a field reference
2954 * @member {Neo.form.field.Base|String|null} zipCodeField_=null
@@ -83,11 +108,16 @@ class Country extends ComboBox {
83108 let me = this ;
84109
85110 if ( me . showFlags ) {
86- let flagIcon = VDomUtil . find ( me . vdom , me . getFlagIconId ( ) ) ;
111+ let flagIcon = VDomUtil . find ( me . vdom , me . getFlagIconId ( ) ) ,
112+ flagUrl = CountryFlags . getFlagUrl ( value ) ;
87113
88114 if ( flagIcon ) {
89- if ( value ) {
90- flagIcon . vdom . src = CountryFlags . getFlagUrl ( value ) ;
115+ if ( Neo . isRecord ( value ) ) {
116+ value = value . code
117+ }
118+
119+ if ( value && flagUrl ) {
120+ flagIcon . vdom . src = flagUrl ;
91121 flagIcon . vdom . removeDom = false
92122 } else {
93123 flagIcon . vdom . src = '' ;
Original file line number Diff line number Diff line change @@ -16,7 +16,11 @@ class Country extends List {
1616 * @member {String} ntype='countrylist'
1717 * @protected
1818 */
19- ntype : 'countrylist'
19+ ntype : 'countrylist' ,
20+ /**
21+ * @member {String[]} baseCls=['neo-country-list','neo-list']
22+ */
23+ baseCls : [ 'neo-country-list' , 'neo-list' ]
2024 }
2125
2226 /**
@@ -33,15 +37,9 @@ class Country extends List {
3337
3438 if ( flagUrl ) {
3539 flagNode = {
36- tag : 'img' ,
37- cls : [ 'neo-country-flag' ] ,
38- src : flagUrl ,
39- style : {
40- height : '20px' ,
41- marginRight : '10px' ,
42- verticalAlign : 'middle' ,
43- width : '20px'
44- }
40+ tag : 'img' ,
41+ cls : [ 'neo-country-flag' ] ,
42+ src : flagUrl
4543 }
4644 }
4745
@@ -53,7 +51,7 @@ class Country extends List {
5351
5452 return [
5553 flagNode ,
56- { tag : 'span' , html : itemText , style : { verticalAlign : 'middle' } }
54+ { tag : 'span' , cls : [ 'neo-country-text' ] , html : itemText }
5755 ]
5856 }
5957}
You can’t perform that action at this time.
0 commit comments