neo.mjs 5.6.8 → 5.6.9

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.9'
24
24
  */
25
- version: '5.6.8'
25
+ version: '5.6.9'
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.9'
24
24
  */
25
- version: '5.6.8'
25
+ version: '5.6.9'
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.9",
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.9'
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.9'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {
@@ -1251,12 +1251,6 @@ class Base extends CoreBase {
1251
1251
  * @returns {Neo.component.Base|null}
1252
1252
  */
1253
1253
  getReference(value) {
1254
- let controller = this.getController();
1255
-
1256
- if (controller) {
1257
- return controller.getReference(value)
1258
- }
1259
-
1260
1254
  return this.down({reference: value})
1261
1255
  }
1262
1256
 
@@ -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;