@cocreate/events 1.19.1 → 1.19.3

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.19.3](https://github.com/CoCreate-app/CoCreate-events/compare/v1.19.2...v1.19.3) (2024-02-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * handle values that are not string ([7b1374b](https://github.com/CoCreate-app/CoCreate-events/commit/7b1374b984673f541b99d7deb29af990b88e962c))
7
+
8
+ ## [1.19.2](https://github.com/CoCreate-app/CoCreate-events/compare/v1.19.1...v1.19.2) (2024-02-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * condition "false" ([9bbd374](https://github.com/CoCreate-app/CoCreate-events/commit/9bbd374254ec8a421493618a5a9ad4e45e9b2830))
14
+
1
15
  ## [1.19.1](https://github.com/CoCreate-app/CoCreate-events/compare/v1.19.0...v1.19.1) (2024-02-05)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/events",
3
- "version": "1.19.1",
3
+ "version": "1.19.3",
4
4
  "description": "A simple events component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "events",
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
- if (values)
248
- values = values.split(',');
249
- else {
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]
@@ -313,7 +317,8 @@ const CoCreateEvents = {
313
317
  // values = values.map(x => x.trim());
314
318
 
315
319
  values = values.map(x => {
316
- x = x.trim(); // Update x with the trimmed value
320
+ if (typeof x === 'string')
321
+ x = x.trim(); // Update x with the trimmed value
317
322
  let prop = element.getAttribute(`${prefix}-property`);
318
323
  if (prop) {
319
324
  x = `${prop}:${x}`; // Update x with prop if it exists
@@ -544,7 +549,10 @@ function checkCondition(condition, value) {
544
549
  const operatorMatch = condition.match(/(<=|>=|<|>)(.+)/);
545
550
  if (operatorMatch)
546
551
  condition = operatorMatch[2].trim()
547
- condition = parseCondition(condition);
552
+
553
+ // TODO: why parse updated conditin to boolean false
554
+ if (condition !== 'false')
555
+ condition = parseCondition(condition);
548
556
  let result;
549
557
 
550
558
  if (Array.isArray(value) && !(typeof condition === 'object')) {