@cocreate/elements 1.26.3 → 1.26.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 CHANGED
@@ -1,3 +1,11 @@
1
+ ## [1.26.4](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.26.3...v1.26.4) (2023-11-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * dataKey.string ([57cc534](https://github.com/CoCreate-app/CoCreate-elements/commit/57cc5344e7ba3d66e949c9f6999aaf90d066d2d3))
7
+ * return if no dataKey ([ace669b](https://github.com/CoCreate-app/CoCreate-elements/commit/ace669b19c59f37d1a0a2e62043171fd0b0999d2))
8
+
1
9
  ## [1.26.3](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.26.2...v1.26.3) (2023-11-16)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.26.3",
3
+ "version": "1.26.4",
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
@@ -215,11 +215,11 @@ function initDataKey(element, data) {
215
215
 
216
216
  async function read(element, data, dataKey) {
217
217
  if (!dataKey)
218
- dataKey = elements.get(element)
218
+ dataKey = { string: elements.get(element) }
219
219
  if (!data)
220
220
  data = { ...keys.get(dataKey).dataKey.object }
221
221
 
222
- if (!data.type)
222
+ if (!dataKey || !data.type)
223
223
  return
224
224
  if (!data.$filter && (!data[data.type] || !data[data.type].length))
225
225
  return
@@ -534,8 +534,9 @@ async function getData(form) {
534
534
  let formObject = forms.get(form)
535
535
  for (let type of formObject.types.values()) {
536
536
  for (let [element, data] of type.entries()) {
537
- if (!element.hasAttribute('key'))
537
+ if (!element.hasAttribute('key') || element.getAttribute('save') === 'false')
538
538
  continue
539
+
539
540
  if (element.hasAttribute('actions')) {
540
541
  let attribute = element.getAttribute('actions')
541
542
  if (attribute.includes('save', 'delete'))
@@ -783,6 +784,8 @@ function setTypeValue(element, data) {
783
784
  el.setAttribute(data.type, data[data.type].name)
784
785
  }
785
786
  }
787
+ setData(Array.from(elements.keys()), data)
788
+
786
789
 
787
790
  // const pass_ids = new Map();
788
791