@cocreate/render 1.9.1 → 1.9.2
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 +1 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.9.2](https://github.com/CoCreate-app/CoCreate-render/compare/v1.9.1...v1.9.2) (2022-07-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* use dataOriginal if path includes collection ([e6b9288](https://github.com/CoCreate-app/CoCreate-render/commit/e6b92886bad560fa64e487609c69f37268d87587))
|
|
7
|
+
|
|
1
8
|
## [1.9.1](https://github.com/CoCreate-app/CoCreate-render/compare/v1.9.0...v1.9.1) (2022-07-08)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const CoCreateRender = {
|
|
|
10
10
|
try {
|
|
11
11
|
if(typeof json == 'undefined' || !path)
|
|
12
12
|
return false;
|
|
13
|
-
if (path.indexOf('.') == -1)
|
|
13
|
+
if (path.indexOf('.') == -1 && path.includes('collection'))
|
|
14
14
|
json = this.dataOriginal
|
|
15
15
|
let jsonData = json, subpath = path.split('.');
|
|
16
16
|
|
|
@@ -64,18 +64,8 @@ const CoCreateRender = {
|
|
|
64
64
|
data[renderKey]['collection'] = this.dataOriginal[renderKey]['collection']
|
|
65
65
|
|
|
66
66
|
let value = self.__getValue(data, attr);
|
|
67
|
-
// if (value) {
|
|
68
|
-
// if (value && typeof(value) !== "object") {
|
|
69
|
-
// if (value && !Array.isArray(value)) {
|
|
70
67
|
if (value) {
|
|
71
|
-
// converts object to string
|
|
72
|
-
// if (!Array.isArray(value) && typeof(value) == "object") {
|
|
73
68
|
if (typeof(value) == "object") {
|
|
74
|
-
// let str = '';
|
|
75
|
-
// for (const [key, val] of Object.entries(value)) {
|
|
76
|
-
// str += `${key}: ${val}\n`;
|
|
77
|
-
// }
|
|
78
|
-
|
|
79
69
|
value = this.generateString(value)
|
|
80
70
|
}
|
|
81
71
|
isPass = true;
|
|
@@ -117,7 +107,6 @@ const CoCreateRender = {
|
|
|
117
107
|
const renderKey = template.getAttribute('render-key') || type;
|
|
118
108
|
const self = this;
|
|
119
109
|
|
|
120
|
-
// const arrayData = this.__getValueFromObject(data, type);
|
|
121
110
|
let arrayData = data;
|
|
122
111
|
|
|
123
112
|
const isRenderObject = template.hasAttribute('render-object');
|
|
@@ -245,12 +234,6 @@ const CoCreateRender = {
|
|
|
245
234
|
this.render(elements[0], data);
|
|
246
235
|
else
|
|
247
236
|
this.setValue(elements, data);
|
|
248
|
-
// for (let element of elements) {
|
|
249
|
-
// if (element.classList.contains('template'))
|
|
250
|
-
// this.render(element, data);
|
|
251
|
-
// else
|
|
252
|
-
// this.setValue([element], data);
|
|
253
|
-
// }
|
|
254
237
|
}
|
|
255
238
|
|
|
256
239
|
}
|