@cocreate/events 1.19.2 → 1.19.4
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 +14 -0
- package/package.json +1 -1
- package/src/index.js +15 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.19.4](https://github.com/CoCreate-app/CoCreate-events/compare/v1.19.3...v1.19.4) (2024-03-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* ifValue defaults to value or <prefix>-if-value ([74a35c5](https://github.com/CoCreate-app/CoCreate-events/commit/74a35c5b17644caa52c40ce2ca931cbafe161a28))
|
|
7
|
+
|
|
8
|
+
## [1.19.3](https://github.com/CoCreate-app/CoCreate-events/compare/v1.19.2...v1.19.3) (2024-02-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* handle values that are not string ([7b1374b](https://github.com/CoCreate-app/CoCreate-events/commit/7b1374b984673f541b99d7deb29af990b88e962c))
|
|
14
|
+
|
|
1
15
|
## [1.19.2](https://github.com/CoCreate-app/CoCreate-events/compare/v1.19.1...v1.19.2) (2024-02-18)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -244,9 +244,13 @@ const CoCreateEvents = {
|
|
|
244
244
|
} else {
|
|
245
245
|
values = element.getAttribute(`${prefix}-value`) || element.getAttribute(`${prefix}-if-value`) || element.getAttribute(prefix);
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
|
|
248
|
+
if (values) {
|
|
249
|
+
if (typeof values === 'string')
|
|
250
|
+
values = values.split(',');
|
|
251
|
+
else if (!Array.isArray(values))
|
|
252
|
+
values = [values]
|
|
253
|
+
} else {
|
|
250
254
|
values = await element.getValue()
|
|
251
255
|
if (!Array.isArray(values))
|
|
252
256
|
values = [values]
|
|
@@ -259,11 +263,16 @@ const CoCreateEvents = {
|
|
|
259
263
|
let elseCondition = element.getAttribute(`${prefix}-else`);
|
|
260
264
|
|
|
261
265
|
let ifValue = element.getAttribute(`${prefix}-if-value`)
|
|
262
|
-
if (ifValue
|
|
266
|
+
if (!ifValue && ifValue !== "")
|
|
267
|
+
ifValue = await element.getValue()
|
|
268
|
+
else if (ifValue || ifValue === "")
|
|
263
269
|
ifValue = [ifValue]
|
|
264
270
|
else
|
|
265
271
|
ifValue = values
|
|
266
272
|
|
|
273
|
+
if (!Array.isArray(ifValue))
|
|
274
|
+
ifValue = [ifValue]
|
|
275
|
+
|
|
267
276
|
//TODO: improved resize toggling of values
|
|
268
277
|
// let hasCondition = this.elements2.get(element)
|
|
269
278
|
if (ifCondition && evaluateCondition(ifCondition, ifValue)) {
|
|
@@ -313,7 +322,8 @@ const CoCreateEvents = {
|
|
|
313
322
|
// values = values.map(x => x.trim());
|
|
314
323
|
|
|
315
324
|
values = values.map(x => {
|
|
316
|
-
|
|
325
|
+
if (typeof x === 'string')
|
|
326
|
+
x = x.trim(); // Update x with the trimmed value
|
|
317
327
|
let prop = element.getAttribute(`${prefix}-property`);
|
|
318
328
|
if (prop) {
|
|
319
329
|
x = `${prop}:${x}`; // Update x with prop if it exists
|