neo.mjs 5.7.3 → 5.7.4

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.7.3'
23
+ * @member {String} version='5.7.4'
24
24
  */
25
- version: '5.7.3'
25
+ version: '5.7.4'
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.7.3'
23
+ * @member {String} version='5.7.4'
24
24
  */
25
- version: '5.7.3'
25
+ version: '5.7.4'
26
26
  }
27
27
 
28
28
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "5.7.3",
3
+ "version": "5.7.4",
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.7.3'
239
+ * @default '5.7.4'
240
240
  * @memberOf! module:Neo
241
241
  * @name config.version
242
242
  * @type String
243
243
  */
244
- version: '5.7.3'
244
+ version: '5.7.4'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {
@@ -19,107 +19,22 @@ class Url extends Text {
19
19
  */
20
20
  ntype: 'urlfield',
21
21
  /**
22
- * @member {String} errorTextValidUrl='Not a valid URL'
22
+ * @member {String} errorTextInputPattern=data=>'Not a valid URL'
23
23
  */
24
- errorTextValidUrl: 'Not a valid URL',
24
+ errorTextInputPattern: data => 'Not a valid URL',
25
25
  /**
26
- * Value for the inputType_ textfield config
27
- * @member {String} inputType='url'
26
+ * @member {RegExp|null} inputPattern_=/^(https?:\/\/)?(([a-zA-Z0-9_-]+\.)*([a-zA-Z0-9_-]+\.[a-zA-Z]{2,}))(\/([a-zA-Z0-9._-]+)\/?)*$/
28
27
  */
29
- inputType: 'url',
28
+ inputPattern_: /^(https?:\/\/)?(([a-zA-Z0-9_-]+\.)*([a-zA-Z0-9_-]+\.[a-zA-Z]{2,}))(\/([a-zA-Z0-9._-]+)\/?)*$/,
30
29
  /**
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']
30
+ * @member {Boolean} inputPatternDOM=false
34
31
  */
35
- protocols: ['http:', 'https:', 'none']
36
- }
37
-
38
- /**
39
- * Triggered when accessing the value config
40
- * The default URL ctor has some sanity checks to convert an "almost" valid URL into a real one.
41
- * E.g. new URL("http:www.google.com").href => "http://www.google.com"
42
- * @param {String|null} value
43
- * @returns {String|null}
44
- * @protected
45
- */
46
- beforeGetValue(value) {
47
- if (value) {
48
- let me = this,
49
- href = me.getUrl(value)?.href;
50
-
51
- if (!href && me.protocols.includes('none')) {
52
- href = me.getUrl(`https://${value}`)?.href;
53
-
54
- if (href) {
55
- href = href.replace('https://', '')
56
- }
57
- }
58
-
59
- if (href) {
60
- return href
61
- }
62
- }
63
-
64
- return value
65
- }
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
-
84
- /**
85
- * Checks for client-side field errors
86
- * @param {Boolean} silent=true
87
- * @returns {Boolean} Returns true in case there are no client-side errors
88
- */
89
- validate(silent=true) {
90
- let me = this,
91
- returnValue = super.validate(silent),
92
- value = me.value;
93
-
94
- if (returnValue) {
95
- if (value && !me.verifyUrl(value)) {
96
- me._error = me.errorTextValidUrl;
97
- returnValue = false;
98
- }
99
- }
100
-
101
- !returnValue && !me.clean && me.updateError(me._error, silent);
102
-
103
- return returnValue
104
- }
105
-
106
- /**
107
- * @param {String} value
108
- * @returns {Boolean}
109
- */
110
- verifyUrl(value) {
111
- let me = this,
112
- url = me.getUrl(value);
113
-
114
- if (!url && me.protocols.includes('none')) {
115
- url = me.getUrl(`https://${value}`);console.log(url)
116
- }
117
-
118
- if (!url) {
119
- return false
120
- }
121
-
122
- return me.protocols.includes(url.protocol)
32
+ inputPatternDOM: false,
33
+ /**
34
+ * Value for the inputType_ textfield config
35
+ * @member {String} inputType='url'
36
+ */
37
+ inputType: 'url'
123
38
  }
124
39
  }
125
40