@cocreate/validation 1.8.7 → 1.8.9
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 +14 -0
- package/CoCreate.config.js +1 -1
- package/package.json +5 -5
- package/src/validations/unique.js +15 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.8.9](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.8.8...v1.8.9) (2023-05-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update packages to latest version. This commit updates various packages in the dependencies section of the package.json file to their latest published versions, thereby fixing multiple bugs and improving overall performance. ([85d5ca7](https://github.com/CoCreate-app/CoCreate-validation/commit/85d5ca73a6241ac41da52ca305f999b5f939dbc1))
|
|
7
|
+
|
|
8
|
+
## [1.8.8](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.8.7...v1.8.8) (2023-05-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* apikey renamed to key ([61bffcf](https://github.com/CoCreate-app/CoCreate-validation/commit/61bffcf69c977afcb12126bb5f741958cec2f06f))
|
|
14
|
+
|
|
1
15
|
## [1.8.7](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.8.6...v1.8.7) (2023-05-06)
|
|
2
16
|
|
|
3
17
|
|
package/CoCreate.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/validation",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.9",
|
|
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",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"webpack-log": "^3.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cocreate/actions": "^1.8.
|
|
63
|
-
"@cocreate/docs": "^1.7.
|
|
64
|
-
"@cocreate/hosting": "^1.10.
|
|
65
|
-
"@cocreate/render": "^1.24.
|
|
62
|
+
"@cocreate/actions": "^1.8.10",
|
|
63
|
+
"@cocreate/docs": "^1.7.10",
|
|
64
|
+
"@cocreate/hosting": "^1.10.2",
|
|
65
|
+
"@cocreate/render": "^1.24.10"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
import render from '@cocreate/render';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export const unique = (elements) => {
|
|
4
4
|
let failedElements = [];
|
|
5
|
-
for (let element of elements){
|
|
5
|
+
for (let element of elements) {
|
|
6
6
|
let unique = element.getAttribute('unique');
|
|
7
|
-
if (unique == 'false'){
|
|
7
|
+
if (unique == 'false') {
|
|
8
8
|
failedElements.push(element);
|
|
9
9
|
}
|
|
10
|
-
// if (unique != 'false'){
|
|
11
|
-
// element.setAttribute('validation', 'true');
|
|
12
|
-
// }
|
|
13
|
-
// else {
|
|
14
|
-
// element.setAttribute('validation', 'false');
|
|
15
|
-
// failedElements.push(element);
|
|
16
|
-
// }
|
|
17
10
|
}
|
|
18
|
-
if (failedElements.length){
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
if (failedElements.length) {
|
|
12
|
+
render.data({
|
|
13
|
+
selector: "[template='validate']",
|
|
14
|
+
data: {
|
|
15
|
+
type: 'unique',
|
|
16
|
+
status: 'failed',
|
|
17
|
+
message: 'One or more values are not unique',
|
|
18
|
+
selector: '[unique="false"]',
|
|
19
|
+
elements: failedElements
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return failedElements;
|
|
30
23
|
}
|
|
31
24
|
};
|
|
32
|
-
|
|
33
|
-
// unique();
|