@cocreate/element-prototype 1.14.0 → 1.15.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 +19 -0
- package/package.json +2 -2
- package/src/setValue.js +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [1.15.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.14.1...v1.15.0) (2023-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* pass attributes renamed to state ([66fa12e](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/66fa12e5081566507d71da273da654d96c3b4b96))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* upgrade dependencies for latest features and fixes ([0ddf814](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/0ddf814a498565331edb886bb69e9aeaccfb9655))
|
|
12
|
+
|
|
13
|
+
## [1.14.1](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.14.0...v1.14.1) (2023-11-22)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* if prefix, suffix value.toString() ([a4d1cf1](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/a4d1cf1e5219d1c5b7c34e12c24006aa0c9d63f1))
|
|
19
|
+
|
|
1
20
|
# [1.14.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.13.2...v1.14.0) (2023-11-19)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/element-prototype",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.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.
|
|
61
|
+
"@cocreate/utils": "^1.28.0"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/setValue.js
CHANGED
|
@@ -27,11 +27,11 @@ const setValue = (el, value) => {
|
|
|
27
27
|
let valueType = el.getAttribute('value-type');
|
|
28
28
|
let prefix = el.getAttribute('value-prefix') || "";
|
|
29
29
|
if (prefix)
|
|
30
|
-
value = value.replace(prefix, "");
|
|
30
|
+
value = value.toString().replace(prefix, "");
|
|
31
31
|
|
|
32
32
|
let suffix = el.getAttribute('value-suffix') || "";
|
|
33
33
|
if (suffix)
|
|
34
|
-
value = value.replace(suffix, "");
|
|
34
|
+
value = value.toString().replace(suffix, "");
|
|
35
35
|
|
|
36
36
|
if (el.tagName == 'INPUT' || el.tagName == 'TEXTAREA' || el.tagName == 'SELECT') {
|
|
37
37
|
let { isCrdt } = getAttributes(el)
|
|
@@ -93,7 +93,7 @@ const setValue = (el, value) => {
|
|
|
93
93
|
else {
|
|
94
94
|
let newElement = document.createElement("div");
|
|
95
95
|
newElement.innerHTML = value;
|
|
96
|
-
|
|
96
|
+
setState(newElement)
|
|
97
97
|
|
|
98
98
|
let CoCreateJS = newElement.querySelector('script[src*="CoCreate.js"], script[src*="CoCreate.min.js"]')
|
|
99
99
|
if (CoCreateJS)
|
|
@@ -132,7 +132,7 @@ const setValue = (el, value) => {
|
|
|
132
132
|
if (el.tagName == 'HEAD' || el.tagName == 'BODY') {
|
|
133
133
|
el.removeAttribute('array');
|
|
134
134
|
el.removeAttribute('object');
|
|
135
|
-
el.removeAttribute('
|
|
135
|
+
el.removeAttribute('state_id');
|
|
136
136
|
|
|
137
137
|
let scripts = el.querySelectorAll('script');
|
|
138
138
|
for (let script of scripts) {
|
|
@@ -141,11 +141,11 @@ const setValue = (el, value) => {
|
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
-
function
|
|
145
|
-
if (CoCreate.
|
|
146
|
-
let
|
|
147
|
-
if (
|
|
148
|
-
CoCreate.
|
|
144
|
+
function setState(el) {
|
|
145
|
+
if (CoCreate.state) {
|
|
146
|
+
let stateElements = el.querySelectorAll('[state_id]');
|
|
147
|
+
if (stateElements)
|
|
148
|
+
CoCreate.state.initElements(stateElements)
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|