@cocreate/validation 1.6.5 → 1.7.0

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,17 @@
1
+ # [1.7.0](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.6.6...v1.7.0) (2023-04-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * params now handeld and returned by action ([68f611b](https://github.com/CoCreate-app/CoCreate-validation/commit/68f611b11ef8df52141f36fd5abe9b985df32892))
7
+
8
+ ## [1.6.6](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.6.5...v1.6.6) (2023-04-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump dependencies ([9822aad](https://github.com/CoCreate-app/CoCreate-validation/commit/9822aad34b8d08fb69e946a01c4f1fd761025c16))
14
+
1
15
  ## [1.6.5](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.6.4...v1.6.5) (2023-04-11)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/validation",
3
- "version": "1.6.5",
3
+ "version": "1.7.0",
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",
@@ -60,9 +60,9 @@
60
60
  "webpack-log": "^3.0.1"
61
61
  },
62
62
  "dependencies": {
63
- "@cocreate/actions": "^1.6.4",
64
- "@cocreate/docs": "^1.6.4",
65
- "@cocreate/hosting": "^1.8.4",
66
- "@cocreate/render": "^1.22.5"
63
+ "@cocreate/actions": "^1.6.5",
64
+ "@cocreate/docs": "^1.6.5",
65
+ "@cocreate/hosting": "^1.8.5",
66
+ "@cocreate/render": "^1.22.6"
67
67
  }
68
68
  }
package/src/index.js CHANGED
@@ -21,13 +21,13 @@ validations.set('unique', unique);
21
21
 
22
22
  const selectors = '[matches], [required], [unique], [subdomain]';
23
23
 
24
- function validate(btn) {
24
+ function validate(btn, params) {
25
25
  let validateElements;
26
26
  let validateSelectors = [];
27
27
  let failedElements = [];
28
28
 
29
- if (btn.actionParams.size != 0){
30
- let selector = btn.actionParams.get('validate');
29
+ if (params){
30
+ let selector = params
31
31
  for (let [validation] of validations){
32
32
  let vSelctor = `${selector}[${validation}]`;
33
33
  validateSelectors.push(vSelctor);
@@ -74,9 +74,8 @@ function validate(btn) {
74
74
 
75
75
  action.init({
76
76
  name: "validate",
77
- endEvent: "validate",
78
- callback: (btn, data) => {
79
- validate(btn);
77
+ callback: (btn, params) => {
78
+ validate(btn, params);
80
79
  }
81
80
  });
82
81
 
@@ -14,7 +14,8 @@ function validateSubdomainEvent(e){
14
14
  function validateSubdomain(element){
15
15
  let subdomain = element.getValue();
16
16
  let validation = 'false';
17
-
17
+ if (Array.isArray(subdomain))
18
+ subdomain = subdomain[0]
18
19
  let array = subdomain.split('.');
19
20
  if (array.length -1 == 2){
20
21
  validation = 'true';