neo.mjs 5.6.10 → 5.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/apps/ServiceWorker.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
+
import CountryField from '../../../../src/form/field/Country.mjs';
|
1
2
|
import FormPageContainer from '../FormPageContainer.mjs';
|
2
|
-
import SelectField from '../../../../src/form/field/Select.mjs';
|
3
3
|
import ZipCodeField from '../../../../src/form/field/ZipCode.mjs';
|
4
4
|
|
5
5
|
/**
|
@@ -13,36 +13,75 @@ class Page11 extends FormPageContainer {
|
|
13
13
|
* @protected
|
14
14
|
*/
|
15
15
|
className: 'Form.view.pages.Page11',
|
16
|
+
/**
|
17
|
+
* @member {Object} itemDefaults
|
18
|
+
*/
|
19
|
+
itemDefaults: {
|
20
|
+
itemDefaults: {
|
21
|
+
flex : 1,
|
22
|
+
style: {maxWidth: '300px'}
|
23
|
+
}
|
24
|
+
},
|
16
25
|
/**
|
17
26
|
* @member {Object[]} items
|
18
27
|
*/
|
19
28
|
items: [{
|
20
|
-
|
21
|
-
|
22
|
-
forceSelection: true,
|
23
|
-
labelText : 'Country',
|
24
|
-
name : 'page11.countryfield',
|
25
|
-
reference : 'country',
|
26
|
-
value : 'DE',
|
29
|
+
ntype : 'container',
|
30
|
+
layout: {ntype: 'hbox'},
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
items : [{
|
33
|
+
module : CountryField,
|
34
|
+
editable : false,
|
35
|
+
forceSelection: true,
|
36
|
+
labelText : 'Country',
|
37
|
+
name : 'page11.countryfield1',
|
38
|
+
reference : 'country1',
|
39
|
+
value : 'DE',
|
40
|
+
|
41
|
+
store: {
|
42
|
+
data: [
|
43
|
+
{id: 'DE', name: 'Germany'},
|
44
|
+
{id: 'Others', name: 'Others'}
|
45
|
+
]
|
46
|
+
}
|
47
|
+
}, {
|
48
|
+
module : ZipCodeField,
|
49
|
+
countryField: 'country1',
|
50
|
+
labelText : 'Munich',
|
51
|
+
name : 'page11.zipcodefield1',
|
52
|
+
required : true,
|
53
|
+
style : {marginLeft: '10px', maxWidth: '300px'},
|
54
|
+
value : '80796'
|
55
|
+
}]
|
41
56
|
}, {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
57
|
+
ntype : 'container',
|
58
|
+
layout: {ntype: 'hbox', align: 'stretch'},
|
59
|
+
|
60
|
+
items: [{
|
61
|
+
module : ZipCodeField,
|
62
|
+
labelText: 'Munich',
|
63
|
+
name : 'page11.zipcodefield2',
|
64
|
+
reference: 'zipcodefield2',
|
65
|
+
required : true,
|
66
|
+
value : '80796'
|
67
|
+
}, {
|
68
|
+
module : CountryField,
|
69
|
+
editable : false,
|
70
|
+
forceSelection: true,
|
71
|
+
labelText : 'Country',
|
72
|
+
name : 'page11.countryfield2',
|
73
|
+
reference : 'country2',
|
74
|
+
style : {marginLeft: '10px', maxWidth: '300px'},
|
75
|
+
value : 'DE',
|
76
|
+
zipCodeField : 'zipcodefield2',
|
77
|
+
|
78
|
+
store: {
|
79
|
+
data: [
|
80
|
+
{id: 'DE', name: 'Germany'},
|
81
|
+
{id: 'Others', name: 'Others'}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
}]
|
46
85
|
}]
|
47
86
|
}
|
48
87
|
}
|
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -236,12 +236,12 @@ const DefaultConfig = {
|
|
236
236
|
useVdomWorker: true,
|
237
237
|
/**
|
238
238
|
* buildScripts/injectPackageVersion.mjs will update this value
|
239
|
-
* @default '5.6.
|
239
|
+
* @default '5.6.11'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '5.6.
|
244
|
+
version: '5.6.11'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import Select from '../../form/field/Select.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.form.field.Country
|
5
|
+
* @extends Neo.form.field.Select
|
6
|
+
*/
|
7
|
+
class Country extends Select {
|
8
|
+
static config = {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Neo.form.field.Country'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Neo.form.field.Country',
|
14
|
+
/**
|
15
|
+
* @member {String} ntype='countryfield'
|
16
|
+
* @protected
|
17
|
+
*/
|
18
|
+
ntype: 'countryfield',
|
19
|
+
/**
|
20
|
+
* You can either pass a field instance or a field reference
|
21
|
+
* @member {Neo.form.field.Base|String|null} zipCodeField_=null
|
22
|
+
*/
|
23
|
+
zipCodeField_: null
|
24
|
+
}
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Triggered after the zipCodeField config got changed
|
28
|
+
* @param {Neo.form.field.Base|null} value
|
29
|
+
* @param {Neo.form.field.Base|null} oldValue
|
30
|
+
* @protected
|
31
|
+
*/
|
32
|
+
afterSetZipCodeField(value, oldValue) {
|
33
|
+
if (value && value instanceof Neo.form.field.Base) {
|
34
|
+
value.countryField = this
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Triggered before the zipCodeField config gets changed
|
40
|
+
* @param {Neo.form.field.Base|String|null} value
|
41
|
+
* @param {Neo.form.field.Base|String|null} oldValue
|
42
|
+
* @returns {Neo.form.field.Base|null}
|
43
|
+
* @protected
|
44
|
+
*/
|
45
|
+
beforeSetZipCodeField(value, oldValue) {
|
46
|
+
let me = this;
|
47
|
+
|
48
|
+
if (Neo.isString(value)) {
|
49
|
+
return me.up().getReference(value)
|
50
|
+
}
|
51
|
+
|
52
|
+
return value;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
Neo.applyClassConfig(Country);
|
57
|
+
|
58
|
+
export default Country;
|
@@ -93,24 +93,10 @@ class ZipCode extends Text {
|
|
93
93
|
* @protected
|
94
94
|
*/
|
95
95
|
beforeSetCountryField(value, oldValue) {
|
96
|
-
let me = this
|
97
|
-
field;
|
96
|
+
let me = this;
|
98
97
|
|
99
98
|
if (Neo.isString(value)) {
|
100
|
-
|
101
|
-
|
102
|
-
/*
|
103
|
-
* The related field could be at a higher index inside the items array
|
104
|
-
* => Not being constructed when this logic triggers.
|
105
|
-
* In this case we want to frequently check again until the field is found.
|
106
|
-
*/
|
107
|
-
if (!field) {
|
108
|
-
setTimeout(() => {
|
109
|
-
me.countryField = value;
|
110
|
-
}, 20)
|
111
|
-
}
|
112
|
-
|
113
|
-
return field
|
99
|
+
return me.up().getReference(value)
|
114
100
|
}
|
115
101
|
|
116
102
|
return value;
|