@cocreate/element-prototype 1.13.1 → 1.14.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 +15 -0
- package/package.json +2 -2
- package/src/getValue.js +6 -3
- package/src/setValue.js +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [1.14.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.13.2...v1.14.0) (2023-11-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* update dependecies for th latest features and bug fixes ([0fecc37](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/0fecc37d7a5000a8cf11e699668680c9f8b85b84))
|
|
7
|
+
|
|
8
|
+
## [1.13.2](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.13.1...v1.13.2) (2023-11-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* if value is the same do not set ([ee8538d](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/ee8538d684ab759cc131e1f785b5d80f610557eb))
|
|
14
|
+
* try catch valueType object or json ([bdc6e8a](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/bdc6e8ae951c62351f70a20c9c85b329b5dae545))
|
|
15
|
+
|
|
1
16
|
## [1.13.1](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.13.0...v1.13.1) (2023-11-12)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/element-prototype",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.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",
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
"webpack-log": "^3.0.1"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@cocreate/utils": "^1.27.
|
|
61
|
+
"@cocreate/utils": "^1.27.4"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/getValue.js
CHANGED
|
@@ -98,11 +98,14 @@ const getValue = (element) => {
|
|
|
98
98
|
value = [value];
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
if (valueType == 'object' || valueType == 'json') {
|
|
102
|
-
|
|
101
|
+
if (value && (valueType == 'object' || valueType == 'json')) {
|
|
102
|
+
try {
|
|
103
|
+
value = JSON.parse(value)
|
|
104
|
+
} catch (error) {
|
|
105
|
+
value = value
|
|
106
|
+
}
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
|
|
106
109
|
return value;
|
|
107
110
|
};
|
|
108
111
|
|
package/src/setValue.js
CHANGED
|
@@ -15,7 +15,6 @@ HTMLHeadingElement.prototype.setValue = function (value) {
|
|
|
15
15
|
|
|
16
16
|
// TODO: check if using a a switch case will provide better performance
|
|
17
17
|
const setValue = (el, value) => {
|
|
18
|
-
|
|
19
18
|
if (value === null || value === undefined) return;
|
|
20
19
|
if (el.hasAttribute('component') || el.hasAttribute('plugin'))
|
|
21
20
|
return storage.set(el, value)
|
|
@@ -73,9 +72,12 @@ const setValue = (el, value) => {
|
|
|
73
72
|
options[i].selected = "";
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
} else
|
|
77
|
-
el.value
|
|
75
|
+
} else {
|
|
76
|
+
if (el.value === value)
|
|
77
|
+
return
|
|
78
78
|
|
|
79
|
+
el.value = value;
|
|
80
|
+
}
|
|
79
81
|
dispatchEvents(el)
|
|
80
82
|
} else if (el.tagName === 'IMG' || el.tagName === 'SOURCE') {
|
|
81
83
|
el.src = value;
|