neo.mjs 5.5.6 → 5.5.7
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
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
+
import EmailField from '../../../../src/form/field/Email.mjs';
|
1
2
|
import FormPageContainer from '../FormPageContainer.mjs';
|
2
|
-
import TextField from '../../../../src/form/field/Text.mjs';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* @class Form.view.pages.Page12
|
@@ -16,11 +16,12 @@ class Page12 extends FormPageContainer {
|
|
16
16
|
* @member {Object[]} items
|
17
17
|
*/
|
18
18
|
items: [{
|
19
|
-
module :
|
19
|
+
module : EmailField,
|
20
20
|
labelText: 'Page 12 Field 1',
|
21
|
-
name : 'page12field1'
|
21
|
+
name : 'page12field1',
|
22
|
+
required : true
|
22
23
|
}, {
|
23
|
-
module :
|
24
|
+
module : EmailField,
|
24
25
|
labelText: 'Page 12 Field 2',
|
25
26
|
name : 'page12field2'
|
26
27
|
}]
|
package/package.json
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
{"id": 13, "cardIndex": 9, "isHeader": false, "isValid": null, "name": "SelectFields"},
|
18
18
|
{"id": 14, "cardIndex": null, "isHeader": true, "isValid": null, "name": "4. Optional data"},
|
19
19
|
{"id": 15, "cardIndex": 10, "isHeader": false, "isValid": null, "name": "ZipCodeFields"},
|
20
|
-
{"id": 16, "cardIndex": 11, "isHeader": false, "isValid": null, "name": "
|
20
|
+
{"id": 16, "cardIndex": 11, "isHeader": false, "isValid": null, "name": "EmailFields"},
|
21
21
|
{"id": 17, "cardIndex": 12, "isHeader": false, "isValid": null, "name": "Page 13"},
|
22
22
|
{"id": 18, "cardIndex": 13, "isHeader": false, "isValid": null, "name": "Page 14"}
|
23
23
|
]
|
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.5.
|
239
|
+
* @default '5.5.7'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '5.5.
|
244
|
+
version: '5.5.7'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
package/src/form/field/Email.mjs
CHANGED
@@ -5,6 +5,14 @@ import Text from './Text.mjs';
|
|
5
5
|
* @extends Neo.form.field.Text
|
6
6
|
*/
|
7
7
|
class Email extends Text {
|
8
|
+
/**
|
9
|
+
* See: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
|
10
|
+
* @member {RegExp} emailRegex
|
11
|
+
* @protected
|
12
|
+
* @static
|
13
|
+
*/
|
14
|
+
static emailRegex = /^[a-z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
|
15
|
+
|
8
16
|
static config = {
|
9
17
|
/**
|
10
18
|
* @member {String} className='Neo.form.field.Email'
|
@@ -16,11 +24,36 @@ class Email extends Text {
|
|
16
24
|
* @protected
|
17
25
|
*/
|
18
26
|
ntype: 'emailfield',
|
27
|
+
/**
|
28
|
+
* @member {String} errorTextValidEmail='Not a valid email address'
|
29
|
+
*/
|
30
|
+
errorTextValidEmail: 'Not a valid email address',
|
19
31
|
/**
|
20
32
|
* @member {String} inputType='email'
|
21
33
|
*/
|
22
34
|
inputType: 'email'
|
23
35
|
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Checks for client-side field errors
|
39
|
+
* @param {Boolean} silent=true
|
40
|
+
* @returns {Boolean} Returns true in case there are no client-side errors
|
41
|
+
*/
|
42
|
+
validate(silent=true) {
|
43
|
+
let me = this,
|
44
|
+
returnValue = super.validate(silent);
|
45
|
+
|
46
|
+
if (returnValue) {
|
47
|
+
if (!Email.emailRegex.test(me.value)) {
|
48
|
+
me._error = me.errorTextValidEmail;
|
49
|
+
returnValue = false;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
!returnValue && !me.clean && me.updateError(me._error, silent);
|
54
|
+
|
55
|
+
return returnValue
|
56
|
+
}
|
24
57
|
}
|
25
58
|
|
26
59
|
Neo.applyClassConfig(Email);
|