neo.mjs 5.6.9 → 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 +2 -2
- package/apps/form/view/pages/Page11.mjs +64 -25
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Base.mjs +14 -2
- package/src/form/field/Country.mjs +58 -0
- package/src/form/field/ZipCode.mjs +2 -16
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, {
|
package/src/component/Base.mjs
CHANGED
@@ -1184,6 +1184,18 @@ class Base extends CoreBase {
|
|
1184
1184
|
return this.getConfigInstanceByNtype('model', ntype);
|
1185
1185
|
}
|
1186
1186
|
|
1187
|
+
/**
|
1188
|
+
* Honors different item roots for mount / render OPs
|
1189
|
+
* @returns {String}
|
1190
|
+
*/
|
1191
|
+
getMountedParentId() {
|
1192
|
+
let parentId = this.parentId,
|
1193
|
+
parent = Neo.getComponent(parentId),
|
1194
|
+
itemsRoot = parent?.getVdomItemsRoot();
|
1195
|
+
|
1196
|
+
return itemsRoot ? itemsRoot.id : parentId
|
1197
|
+
}
|
1198
|
+
|
1187
1199
|
/**
|
1188
1200
|
* Calculate the real parentIndex inside the DOM
|
1189
1201
|
* @returns {Number|undefined}
|
@@ -1432,7 +1444,7 @@ class Base extends CoreBase {
|
|
1432
1444
|
appName : me.appName,
|
1433
1445
|
id : me.id,
|
1434
1446
|
html : me.vnode.outerHTML,
|
1435
|
-
parentId : me.
|
1447
|
+
parentId : me.getMountedParentId(),
|
1436
1448
|
parentIndex: me.getMountedParentIndex()
|
1437
1449
|
});
|
1438
1450
|
|
@@ -1655,7 +1667,7 @@ class Base extends CoreBase {
|
|
1655
1667
|
Neo.vdom.Helper.create({
|
1656
1668
|
appName : me.appName,
|
1657
1669
|
autoMount,
|
1658
|
-
parentId : autoMount ? me.
|
1670
|
+
parentId : autoMount ? me.getMountedParentId() : undefined,
|
1659
1671
|
parentIndex: autoMount ? me.getMountedParentIndex() : undefined,
|
1660
1672
|
...me.vdom
|
1661
1673
|
}).then(data => {
|
@@ -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;
|