@cocreate/validation 1.8.7 → 1.8.8
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 +7 -0
- package/CoCreate.config.js +1 -1
- package/package.json +1 -1
- package/src/validations/unique.js +15 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.8.8](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.8.7...v1.8.8) (2023-05-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* apikey renamed to key ([61bffcf](https://github.com/CoCreate-app/CoCreate-validation/commit/61bffcf69c977afcb12126bb5f741958cec2f06f))
|
|
7
|
+
|
|
1
8
|
## [1.8.7](https://github.com/CoCreate-app/CoCreate-validation/compare/v1.8.6...v1.8.7) (2023-05-06)
|
|
2
9
|
|
|
3
10
|
|
package/CoCreate.config.js
CHANGED
package/package.json
CHANGED
|
@@ -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();
|