@cocreate/elements 1.13.24 → 1.13.26

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,18 @@
1
+ ## [1.13.26](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.13.25...v1.13.26) (2022-12-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bump dependencies ([3de8486](https://github.com/CoCreate-app/CoCreate-elements/commit/3de848652d358db97b18b41831211975a7d41b10))
7
+ * compare collection prior to setValue ([49df60e](https://github.com/CoCreate-app/CoCreate-elements/commit/49df60ecac8f0f78e67ef98d0a59258c3e56bc4d))
8
+
9
+ ## [1.13.25](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.13.24...v1.13.25) (2022-12-15)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * add missing dev dependency style-loader ([dfa7ef4](https://github.com/CoCreate-app/CoCreate-elements/commit/dfa7ef44e25da0fed5f4e6bf0093e35771bec156))
15
+
1
16
  ## [1.13.24](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.13.23...v1.13.24) (2022-12-13)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.13.24",
3
+ "version": "1.13.26",
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",
@@ -52,6 +52,7 @@
52
52
  "clean-webpack-plugin": "^3.0.0",
53
53
  "file-loader": "^6.2.0",
54
54
  "mini-css-extract-plugin": "^1.5.0",
55
+ "style-loader": "^3.3.1",
55
56
  "terser-webpack-plugin": "^5.1.1",
56
57
  "uglifyjs-webpack-plugin": "^2.2.0",
57
58
  "webpack": "^5.24.4",
@@ -59,11 +60,11 @@
59
60
  "webpack-log": "^3.0.1"
60
61
  },
61
62
  "dependencies": {
62
- "@cocreate/actions": "^1.5.35",
63
- "@cocreate/crud-client": "^1.16.11",
64
- "@cocreate/docs": "^1.4.19",
65
- "@cocreate/element-prototype": "^1.2.2",
66
- "@cocreate/observer": "^1.5.39",
67
- "@cocreate/utils": "^1.16.2"
63
+ "@cocreate/actions": "^1.5.38",
64
+ "@cocreate/crud-client": "^1.16.16",
65
+ "@cocreate/docs": "^1.4.20",
66
+ "@cocreate/element-prototype": "^1.2.5",
67
+ "@cocreate/observer": "^1.5.42",
68
+ "@cocreate/utils": "^1.17.0"
68
69
  }
69
70
  }
package/src/index.js CHANGED
@@ -123,13 +123,13 @@ function setData(elements, data) {
123
123
  }
124
124
  if (!elements || elements.length == 0)
125
125
  return
126
-
127
- elements.forEach((el) => {
126
+
127
+ for (let el of elements) {
128
128
  const { collection, document_id, name, isRead, isUpdate, isCrdt } = crud.getAttributes(el);
129
- if (el.hasAttribute('actions')) return;
130
- if (isRead == "false" || isUpdate == "false" || isCrdt == "true") return;
129
+ if (el.hasAttribute('actions')) continue;
130
+ if (isRead == "false" || isUpdate == "false" || isCrdt == "true") continue;
131
131
 
132
- // if (data.document[0]['collection'] == collection && data.document[0]['_id'] == document_id) {
132
+ if (data.document[0]['collection'] == collection) {
133
133
  let value;
134
134
  let valueType = el.getAttribute('value-type');
135
135
  if (valueType == 'object' || valueType == 'json'){
@@ -138,16 +138,17 @@ function setData(elements, data) {
138
138
  // else
139
139
  value = JSON.stringify(data.document[0][name])
140
140
  value = decodeURIComponent(value)
141
- } else
141
+ } else {
142
142
  value = crud.getValueFromObject(data.document[0], name);
143
-
144
- el.setValue(value);
145
-
143
+ }
144
+
145
+ el.setValue(value);
146
146
  isRendered = true;
147
- // }
147
+ }
148
+
148
149
  initializing.delete(el)
149
150
 
150
- });
151
+ }
151
152
 
152
153
 
153
154
  if (isRendered) {