@cocreate/validation 1.1.2 → 1.2.1
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/CHANGELOG.md +33 -0
- package/README.md +1 -1
- package/docs/index.html +2 -2
- package/package.json +6 -6
- package/src/index.js +13 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
## [1.2.1](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.2.0...v1.2.1) (2021-10-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update packages ([db5eb17](https://github.com/CoCreate-app/CoCreate-validation/commit/db5eb178bed1447539d728c7cb1c158940083431))
|
|
7
|
+
|
|
8
|
+
# [1.2.0](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.1.4...v1.2.0) (2021-10-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* updated dependencies ([f10f55e](https://github.com/CoCreate-app/CoCreate-validation/commit/f10f55e81d374f7df20d0d88920fd1ed8c4c41ab))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* apply a selector to actions='validate(#name)' and use selector to validate a specific element rather then whole form ([ab9bb28](https://github.com/CoCreate-app/CoCreate-validation/commit/ab9bb28cf3250b416ea019d8001c7dda8e011a19))
|
|
19
|
+
|
|
20
|
+
## [1.1.4](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.1.3...v1.1.4) (2021-10-14)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* relocated removeElement action to render ([e4ea779](https://github.com/CoCreate-app/CoCreate-validation/commit/e4ea779a92cf59ba1eac1ddec3643789e2c3fa8f))
|
|
26
|
+
|
|
27
|
+
## [1.1.3](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.1.2...v1.1.3) (2021-10-13)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* update descriptions ([9b70821](https://github.com/CoCreate-app/CoCreate-validation/commit/9b7082155fbec706c764ec8ec98dee00b9eccb9c))
|
|
33
|
+
|
|
1
34
|
## [1.1.2](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.1.1...v1.1.2) (2021-10-13)
|
|
2
35
|
|
|
3
36
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CoCreate-validation
|
|
2
2
|
|
|
3
|
-
A simple validation component in vanilla javascript. Easily configured using HTML5
|
|
3
|
+
A simple validation component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API. Take it for a spin in our [playground!](https://cocreate.app/docs/validation)
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|

|
package/docs/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
7
|
<title>CoCreate-validation Documentation | CoCreateJS </title>
|
|
8
8
|
<link rel="icon" type="image/png" sizes="32x32" href="https://cocreate.app/images/favicon.ico">
|
|
9
|
-
<meta name="description" content="A simple HTML5 and pure javascript component. Easy configuration using
|
|
9
|
+
<meta name="description" content="A simple HTML5 and pure javascript component. Easy configuration using HTML5 attributes or Javscript api and highly styleable." />
|
|
10
10
|
<meta name="keywords" content="helper classes, utility classes, css framework, css library, inline style classes" />
|
|
11
11
|
<meta name="robots" content="index,follow" />
|
|
12
12
|
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<a class="margin-right:15px share" share-network='share' title="Share on share"><i class="fas fa-share-alt"></i></a>
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
32
|
-
<p class="max-width:500px margin:20px_10px">A
|
|
32
|
+
<p class="max-width:500px margin:20px_10px">A headless vinilla javascript micro component. Easy configuration using HTML5 attributes or Javscript api.</h1>
|
|
33
33
|
<div id="validation-section" class="display:flex flex-wrap:wrap">
|
|
34
34
|
<div class="flex-grow:1 width:300px padding:20px_10px">
|
|
35
35
|
<h2 class="border-bottom:1px_solid_lightgrey padding:5px_0px">Install</h2>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/validation",
|
|
3
|
-
"version": "1.1
|
|
4
|
-
"description": "A simple validation component in vanilla javascript. Easily configured using HTML5
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "A simple validation component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"validation",
|
|
7
7
|
"cocreate",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"webpack-log": "^3.0.1"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@cocreate/action": "^1.
|
|
65
|
-
"@cocreate/docs": "^1.2.
|
|
66
|
-
"@cocreate/hosting": "^1.2.
|
|
67
|
-
"@cocreate/render": "^1.
|
|
64
|
+
"@cocreate/action": "^1.3.0",
|
|
65
|
+
"@cocreate/docs": "^1.2.32",
|
|
66
|
+
"@cocreate/hosting": "^1.2.29",
|
|
67
|
+
"@cocreate/render": "^1.3.0"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/index.js
CHANGED
|
@@ -10,8 +10,19 @@ import action from '@cocreate/action';
|
|
|
10
10
|
import render from '@cocreate/render';
|
|
11
11
|
|
|
12
12
|
function validate(btn) {
|
|
13
|
-
let
|
|
14
|
-
|
|
13
|
+
let validateElements;
|
|
14
|
+
|
|
15
|
+
if (btn.actionParams.size != 0){
|
|
16
|
+
let selector = btn.actionParams.get('validate');
|
|
17
|
+
validateElements = document.querySelectorAll(`${selector}[unique="false"]`);
|
|
18
|
+
if (!validateElements.length){
|
|
19
|
+
let element = document.querySelector(selector);
|
|
20
|
+
validateElements = element.querySelectorAll('[unique="false"]');
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
let element = btn.closest('form');
|
|
24
|
+
validateElements = element.querySelectorAll('[unique="false"]');
|
|
25
|
+
}
|
|
15
26
|
|
|
16
27
|
if (validateElements.length){
|
|
17
28
|
render.data({
|
|
@@ -30,13 +41,6 @@ function validate(btn) {
|
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
|
|
33
|
-
function removeElement(btn) {
|
|
34
|
-
let element = btn.closest('[templateid]');
|
|
35
|
-
if (element)
|
|
36
|
-
element.remove();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
44
|
action.init({
|
|
41
45
|
action: "validate",
|
|
42
46
|
endEvent: "validate",
|
|
@@ -45,10 +49,3 @@ action.init({
|
|
|
45
49
|
}
|
|
46
50
|
});
|
|
47
51
|
|
|
48
|
-
action.init({
|
|
49
|
-
action: "remove",
|
|
50
|
-
endEvent: "remove",
|
|
51
|
-
callback: (btn, data) => {
|
|
52
|
-
removeElement(btn);
|
|
53
|
-
}
|
|
54
|
-
});
|