@cocreate/state 1.24.5 → 1.24.6
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/package.json +1 -1
- package/src/index.js +16 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.24.6](https://github.com/CoCreate-app/CoCreate-state/compare/v1.24.5...v1.24.6) (2025-11-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* correct method name for retrieving element value and enhance state attribute handling ([bda5c5a](https://github.com/CoCreate-app/CoCreate-state/commit/bda5c5a2ed26215b824b75052e4cf19f5f3c16b3))
|
|
7
|
+
|
|
1
8
|
## [1.24.5](https://github.com/CoCreate-app/CoCreate-state/compare/v1.24.4...v1.24.5) (2025-09-07)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/state",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.6",
|
|
4
4
|
"description": "Data attributes which can be used for components in CoCreate framework combined as a group of attributes that dynamically change attributes & fetch custom data.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"state",
|
package/src/index.js
CHANGED
|
@@ -126,14 +126,21 @@ async function stateAttributes(element) {
|
|
|
126
126
|
}
|
|
127
127
|
let elements = [];
|
|
128
128
|
|
|
129
|
-
let form = element.closest("form");
|
|
130
|
-
if (form) {
|
|
131
|
-
|
|
132
|
-
} else {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
// let form = element.closest("form");
|
|
130
|
+
// if (form) {
|
|
131
|
+
// elements = form.querySelectorAll("[state_to]");
|
|
132
|
+
// } else {
|
|
133
|
+
if (element.hasAttribute("state_to")) elements.push(element);
|
|
134
|
+
let nestedElements = element.querySelectorAll("[state_to]");
|
|
135
|
+
elements.push(...nestedElements);
|
|
136
|
+
let current = element;
|
|
137
|
+
while (current) {
|
|
138
|
+
if (current.hasAttribute("state_to") && !elements.includes(current)) {
|
|
139
|
+
elements.push(current);
|
|
140
|
+
}
|
|
141
|
+
current = current.parentElement;
|
|
136
142
|
}
|
|
143
|
+
// }
|
|
137
144
|
|
|
138
145
|
let changeState = false;
|
|
139
146
|
for (let i = 0; i < elements.length; i++) {
|
|
@@ -187,7 +194,7 @@ async function _getAttributeValues(element) {
|
|
|
187
194
|
});
|
|
188
195
|
else if (attribute.name == "state-value" && !attribute.value)
|
|
189
196
|
Object.assign(attributeValues, {
|
|
190
|
-
value: await element.
|
|
197
|
+
value: await element.getValue()
|
|
191
198
|
});
|
|
192
199
|
else
|
|
193
200
|
Object.assign(attributeValues, {
|
|
@@ -200,7 +207,7 @@ async function _getAttributeValues(element) {
|
|
|
200
207
|
!element.hasAttribute("state-value") &&
|
|
201
208
|
element.getvalue
|
|
202
209
|
)
|
|
203
|
-
Object.assign(attributeValues, { value: await element.
|
|
210
|
+
Object.assign(attributeValues, { value: await element.getValue() });
|
|
204
211
|
|
|
205
212
|
return attributeValues;
|
|
206
213
|
}
|