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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.6.9'
23
+ * @member {String} version='5.6.11'
24
24
  */
25
- version: '5.6.9'
25
+ version: '5.6.11'
26
26
  }
27
27
 
28
28
  /**
@@ -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
- module : SelectField,
21
- editable : false,
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
- store: {
29
- data: [
30
- {id: 'DE', name: 'Germany'},
31
- {id: 'Others', name: 'Others'}
32
- ]
33
- }
34
- }, {
35
- module : ZipCodeField,
36
- countryField: 'country',
37
- labelText : 'Munich',
38
- name : 'page11.field1',
39
- required : true,
40
- value : '80796'
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
- module : ZipCodeField,
43
- countryField: 'country',
44
- labelText : 'Page 11 Field 2',
45
- name : 'page11.field2'
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
  }
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.6.9'
23
+ * @member {String} version='5.6.11'
24
24
  */
25
- version: '5.6.9'
25
+ version: '5.6.11'
26
26
  }
27
27
 
28
28
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "5.6.9",
3
+ "version": "5.6.11",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -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.9'
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.9'
244
+ version: '5.6.11'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {
@@ -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.parentId,
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.parentId : undefined,
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
- field = me.up().getReference(value);
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;