@cocreate/validation 1.1.4 → 1.2.3

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 CHANGED
@@ -1,3 +1,37 @@
1
+ ## [1.2.3](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.2.2...v1.2.3) (2021-10-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update dependencies ([753e6b0](https://github.com/CoCreate-app/CoCreate-validation/commit/753e6b0236bfec8247ea9727ea17790f1a1b3823))
7
+ * update dependencies ([74d23bb](https://github.com/CoCreate-app/CoCreate-validation/commit/74d23bb4c83ebae5a059a61ebdf9068df3f30a7b))
8
+
9
+ ## [1.2.2](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.2.1...v1.2.2) (2021-10-15)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * update packages ([f8d5393](https://github.com/CoCreate-app/CoCreate-validation/commit/f8d5393589077fc4bb47bb68592bd2e62ecb8606))
15
+
16
+ ## [1.2.1](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.2.0...v1.2.1) (2021-10-15)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * update packages ([db5eb17](https://github.com/CoCreate-app/CoCreate-validation/commit/db5eb178bed1447539d728c7cb1c158940083431))
22
+
23
+ # [1.2.0](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.1.4...v1.2.0) (2021-10-14)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * updated dependencies ([f10f55e](https://github.com/CoCreate-app/CoCreate-validation/commit/f10f55e81d374f7df20d0d88920fd1ed8c4c41ab))
29
+
30
+
31
+ ### Features
32
+
33
+ * 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))
34
+
1
35
  ## [1.1.4](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.1.3...v1.1.4) (2021-10-14)
2
36
 
3
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/validation",
3
- "version": "1.1.4",
3
+ "version": "1.2.3",
4
4
  "description": "A simple validation component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "validation",
@@ -61,9 +61,9 @@
61
61
  "webpack-log": "^3.0.1"
62
62
  },
63
63
  "dependencies": {
64
- "@cocreate/action": "^1.2.27",
65
- "@cocreate/docs": "^1.2.30",
66
- "@cocreate/hosting": "^1.2.27",
67
- "@cocreate/render": "^1.2.0"
64
+ "@cocreate/action": "^1.3.1",
65
+ "@cocreate/docs": "^1.2.35",
66
+ "@cocreate/hosting": "^1.2.32",
67
+ "@cocreate/render": "^1.3.2"
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 element = btn.closest('form');
14
- let validateElements = element.querySelectorAll('[unique="false"]');
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({