@cocreate/elements 1.34.4 → 1.34.5

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,11 @@
1
+ ## [1.34.5](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.34.4...v1.34.5) (2024-02-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * data.object conditions ([d7f1431](https://github.com/CoCreate-app/CoCreate-elements/commit/d7f1431a70e48cf70dac8d219ab9f1c26df91a42))
7
+ * processing object.$update ([157f094](https://github.com/CoCreate-app/CoCreate-elements/commit/157f094d50bed51b94af9be272fdfc733b9f1cc6))
8
+
1
9
  ## [1.34.4](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.34.3...v1.34.4) (2024-02-19)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.34.4",
3
+ "version": "1.34.5",
4
4
  "description": "Fetch content into any html element by using html5 attributes to query data stored in CoCreate headless CMS. If data is changed it will instantly reflect in html tags as changes are broadcasted in realtime",
5
5
  "keywords": [
6
6
  "elements",
package/src/index.js CHANGED
@@ -85,7 +85,7 @@ async function initElement(el) {
85
85
 
86
86
  let data = getObject(el);
87
87
  if (!data || !data.type) return
88
- if (data.object !== '' && data.object !== 'pending' && !(/^[0-9a-fA-F]{24}$/.test(data.object)))
88
+ if (data.object && data.object !== 'pending' && !(/^[0-9a-fA-F]{24}$/.test(data.object)))
89
89
  return
90
90
 
91
91
  if (!elements.has(el)) {
@@ -360,6 +360,11 @@ async function setData(element, data) {
360
360
  else
361
361
  value = 0
362
362
  } else {
363
+ let $update = data[type][0].$update
364
+ if ($update) {
365
+ delete data[type][0].$update
366
+ data[type][0] = { ...data[type][0], ...$update }
367
+ }
363
368
  value = CRUD.getValueFromObject(data[type][0], key)
364
369
  }
365
370
 
@@ -395,6 +400,12 @@ async function filterData(element, data, type, key) {
395
400
  let _id = element.getAttribute('object')
396
401
  if (_id && doc._id !== _id)
397
402
  return
403
+ let $update = doc.$update
404
+ if ($update) {
405
+ delete doc.$update
406
+ doc = { ...doc, ...$update }
407
+ }
408
+
398
409
  }
399
410
  if (doc[property]) {
400
411
  if (Array.isArray(doc[property]))
@@ -472,6 +483,7 @@ async function checkFilters(element, data, type) {
472
483
  if (!isMatch)
473
484
  newData.slice(i, 1)
474
485
  }
486
+
475
487
  }
476
488
 
477
489
  if (!newData || !newData.length)