neo.mjs 5.6.8 → 5.6.10

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.8'
23
+ * @member {String} version='5.6.10'
24
24
  */
25
- version: '5.6.8'
25
+ version: '5.6.10'
26
26
  }
27
27
 
28
28
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.6.8'
23
+ * @member {String} version='5.6.10'
24
24
  */
25
- version: '5.6.8'
25
+ version: '5.6.10'
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.8",
3
+ "version": "5.6.10",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -58,7 +58,7 @@
58
58
  "postcss": "^8.4.23",
59
59
  "sass": "^1.62.1",
60
60
  "webpack": "^5.82.0",
61
- "webpack-cli": "^5.1.0",
61
+ "webpack-cli": "^5.1.1",
62
62
  "webpack-dev-server": "4.15.0",
63
63
  "webpack-hook-plugin": "^1.0.7",
64
64
  "webpack-node-externals": "^3.0.0"
@@ -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.8'
239
+ * @default '5.6.10'
240
240
  * @memberOf! module:Neo
241
241
  * @name config.version
242
242
  * @type String
243
243
  */
244
- version: '5.6.8'
244
+ version: '5.6.10'
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}
@@ -1251,12 +1263,6 @@ class Base extends CoreBase {
1251
1263
  * @returns {Neo.component.Base|null}
1252
1264
  */
1253
1265
  getReference(value) {
1254
- let controller = this.getController();
1255
-
1256
- if (controller) {
1257
- return controller.getReference(value)
1258
- }
1259
-
1260
1266
  return this.down({reference: value})
1261
1267
  }
1262
1268
 
@@ -1438,7 +1444,7 @@ class Base extends CoreBase {
1438
1444
  appName : me.appName,
1439
1445
  id : me.id,
1440
1446
  html : me.vnode.outerHTML,
1441
- parentId : me.parentId,
1447
+ parentId : me.getMountedParentId(),
1442
1448
  parentIndex: me.getMountedParentIndex()
1443
1449
  });
1444
1450
 
@@ -1661,7 +1667,7 @@ class Base extends CoreBase {
1661
1667
  Neo.vdom.Helper.create({
1662
1668
  appName : me.appName,
1663
1669
  autoMount,
1664
- parentId : autoMount ? me.parentId : undefined,
1670
+ parentId : autoMount ? me.getMountedParentId() : undefined,
1665
1671
  parentIndex: autoMount ? me.getMountedParentIndex() : undefined,
1666
1672
  ...me.vdom
1667
1673
  }).then(data => {
@@ -28,10 +28,11 @@ class Url extends Text {
28
28
  */
29
29
  inputType: 'url',
30
30
  /**
31
- * Specify allowed protocols
32
- * @member {String[]} protocols=['http:','https:']
31
+ * Specify allowed protocols.
32
+ * 'none' means that user inputs like "www.google.com" will be considered as valid.
33
+ * @member {String[]} protocols=['http:','https:','none']
33
34
  */
34
- protocols: ['http:', 'https:']
35
+ protocols: ['http:', 'https:', 'none']
35
36
  }
36
37
 
37
38
  /**
@@ -44,20 +45,42 @@ class Url extends Text {
44
45
  */
45
46
  beforeGetValue(value) {
46
47
  if (value) {
47
- let url;
48
+ let me = this,
49
+ href = me.getUrl(value)?.href;
48
50
 
49
- try {
50
- url = new URL(value);
51
- } catch(e) {
52
- return value
51
+ if (!href && me.protocols.includes('none')) {
52
+ href = me.getUrl(`https://${value}`)?.href;
53
+
54
+ if (href) {
55
+ href = href.replace('https://', '')
56
+ }
53
57
  }
54
58
 
55
- return url.href
59
+ if (href) {
60
+ return href
61
+ }
56
62
  }
57
63
 
58
64
  return value
59
65
  }
60
66
 
67
+ /**
68
+ * Returns false in case an URL could not get created
69
+ * @param {String} value
70
+ * @returns {Boolean|URL}
71
+ */
72
+ getUrl(value) {
73
+ let url;
74
+
75
+ try {
76
+ url = new URL(value);
77
+ } catch(e) {
78
+ return false
79
+ }
80
+
81
+ return url
82
+ }
83
+
61
84
  /**
62
85
  * Checks for client-side field errors
63
86
  * @param {Boolean} silent=true
@@ -85,15 +108,18 @@ class Url extends Text {
85
108
  * @returns {Boolean}
86
109
  */
87
110
  verifyUrl(value) {
88
- let url;
111
+ let me = this,
112
+ url = me.getUrl(value);
89
113
 
90
- try {
91
- url = new URL(value);
92
- } catch(e) {
114
+ if (!url && me.protocols.includes('none')) {
115
+ url = me.getUrl(`https://${value}`);console.log(url)
116
+ }
117
+
118
+ if (!url) {
93
119
  return false
94
120
  }
95
121
 
96
- return this.protocols.includes(url.protocol)
122
+ return me.protocols.includes(url.protocol)
97
123
  }
98
124
  }
99
125
 
@@ -99,6 +99,11 @@ class ZipCode extends Text {
99
99
  if (Neo.isString(value)) {
100
100
  field = me.up().getReference(value);
101
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
+ */
102
107
  if (!field) {
103
108
  setTimeout(() => {
104
109
  me.countryField = value;