@cocreate/events 1.21.0 → 1.22.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 +7 -0
- package/package.json +1 -1
- package/src/index.js +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.22.0](https://github.com/CoCreate-app/CoCreate-events/compare/v1.21.0...v1.22.0) (2024-06-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* $template condition checks for {{}} ([bd7219a](https://github.com/CoCreate-app/CoCreate-events/commit/bd7219a03b5d1b04772596872af15351bfd5f999))
|
|
7
|
+
|
|
1
8
|
# [1.21.0](https://github.com/CoCreate-app/CoCreate-events/compare/v1.20.1...v1.21.0) (2024-06-12)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
// you must obtain a commercial license from CoCreate LLC.
|
|
21
21
|
// For details, visit <https://cocreate.app/licenses/> or contact us at sales@cocreate.app.
|
|
22
22
|
|
|
23
|
-
import { queryElements,
|
|
23
|
+
import { queryElements, queryData } from '@cocreate/utils';
|
|
24
24
|
import action from '@cocreate/actions';
|
|
25
25
|
import observer from '@cocreate/observer';
|
|
26
26
|
import '@cocreate/element-prototype';
|
|
@@ -289,6 +289,7 @@ const CoCreateEvents = {
|
|
|
289
289
|
//TODO: improved resize toggling of values
|
|
290
290
|
// let hasCondition = this.elements2.get(element)
|
|
291
291
|
if (ifCondition && evaluateCondition(ifCondition, ifValue)) {
|
|
292
|
+
|
|
292
293
|
// if (hasCondition && hasCondition.condition === ifCondition) {
|
|
293
294
|
// return
|
|
294
295
|
// } else
|
|
@@ -588,7 +589,9 @@ function checkCondition(condition, value) {
|
|
|
588
589
|
condition = parseCondition(condition);
|
|
589
590
|
let result;
|
|
590
591
|
|
|
591
|
-
if (
|
|
592
|
+
if (condition === '$template') {
|
|
593
|
+
result = (/{{\s*([\w\W]+)\s*}}/g.test(value[0]))
|
|
594
|
+
} else if (Array.isArray(value) && !(typeof condition === 'object')) {
|
|
592
595
|
if (operatorMatch) {
|
|
593
596
|
condition = parseFloat(condition)
|
|
594
597
|
result = value.some(v => {
|