@cocreate/element-prototype 1.17.0 → 1.18.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 +13 -0
- package/package.json +1 -1
- package/src/getValue.js +13 -4
- package/src/setValue.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [1.18.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.17.0...v1.18.0) (2024-01-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* handle checkbox value true ([ec73ce0](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/ec73ce0ecfff3a21c2f3b333514ca166ca28a69a))
|
|
7
|
+
* handling checkbox defualt values ([635f262](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/635f2626e7be3117dea6a4603bea45a7d80ba82a))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* if value matches operators $user_id, $organization_id, $clientId will return from localStorage ([e4bb41a](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/e4bb41a47350d97c64677f68f0d28b356e981122))
|
|
13
|
+
|
|
1
14
|
# [1.17.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.16.0...v1.17.0) (2023-12-18)
|
|
2
15
|
|
|
3
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/element-prototype",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "A simple element-prototype component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"element-prototype",
|
package/src/getValue.js
CHANGED
|
@@ -46,10 +46,13 @@ const getValue = (element) => {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
} else {
|
|
49
|
-
if (element.checked)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
if (element.checked) {
|
|
50
|
+
if (element.hasAttribute('value'))
|
|
51
|
+
value = element.value || true
|
|
52
|
+
else
|
|
53
|
+
value = true
|
|
54
|
+
} else
|
|
55
|
+
value = false
|
|
53
56
|
|
|
54
57
|
}
|
|
55
58
|
} else if (element.type === 'radio') {
|
|
@@ -106,6 +109,12 @@ const getValue = (element) => {
|
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
|
|
112
|
+
if (value === '$user_id')
|
|
113
|
+
value = localStorage.getItem('user_id')
|
|
114
|
+
else if (value === '$organization_id')
|
|
115
|
+
value = localStorage.getItem('organization_id')
|
|
116
|
+
else if (value === '$clientId')
|
|
117
|
+
value = localStorage.getItem('clientId')
|
|
109
118
|
return value;
|
|
110
119
|
};
|
|
111
120
|
|
package/src/setValue.js
CHANGED
|
@@ -47,7 +47,7 @@ const setValue = (el, value, dispatch) => {
|
|
|
47
47
|
|
|
48
48
|
for (let i = 0; i < inputs.length; i++) {
|
|
49
49
|
if (inputs[i].value) {
|
|
50
|
-
if (value.includes(inputs[i].value))
|
|
50
|
+
if (value === true || value.includes(inputs[i].value))
|
|
51
51
|
inputs[i].checked = true;
|
|
52
52
|
else
|
|
53
53
|
inputs[i].checked = false;
|