@cocreate/render 1.3.14 → 1.3.18
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 +28 -0
- package/package.json +4 -4
- package/src/index.js +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [1.3.18](https://github.com/CoCreate-app/CoCreate-render/compare/v1.3.17...v1.3.18) (2021-11-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update dependencies ([a1b32d4](https://github.com/CoCreate-app/CoCreate-render/commit/a1b32d4d98c3788e96852a5e3769374f78ed2fc9))
|
|
7
|
+
|
|
8
|
+
## [1.3.17](https://github.com/CoCreate-app/CoCreate-render/compare/v1.3.16...v1.3.17) (2021-11-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update dependencies ([b46ab83](https://github.com/CoCreate-app/CoCreate-render/commit/b46ab837ba56f96988a70622918c7e5055327dc8))
|
|
14
|
+
|
|
15
|
+
## [1.3.16](https://github.com/CoCreate-app/CoCreate-render/compare/v1.3.15...v1.3.16) (2021-11-19)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* if element has class template cloneEl then insert values ([7556035](https://github.com/CoCreate-app/CoCreate-render/commit/75560356eaa9cec8db27a73acb60bd9a44c27d7b))
|
|
21
|
+
|
|
22
|
+
## [1.3.15](https://github.com/CoCreate-app/CoCreate-render/compare/v1.3.14...v1.3.15) (2021-11-18)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* update dependencies ([48ef2f9](https://github.com/CoCreate-app/CoCreate-render/commit/48ef2f9cc287adf2e1794b5e530472a7dc370d53))
|
|
28
|
+
|
|
1
29
|
## [1.3.14](https://github.com/CoCreate-app/CoCreate-render/compare/v1.3.13...v1.3.14) (2021-11-16)
|
|
2
30
|
|
|
3
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/render",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.18",
|
|
4
4
|
"description": "A simple render component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"render",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"webpack-log": "^3.0.1"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@cocreate/action": "^1.3.
|
|
65
|
-
"@cocreate/api": "^1.2.
|
|
66
|
-
"@cocreate/docs": "^1.2.
|
|
64
|
+
"@cocreate/action": "^1.3.17",
|
|
65
|
+
"@cocreate/api": "^1.2.10",
|
|
66
|
+
"@cocreate/docs": "^1.2.55"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/src/index.js
CHANGED
|
@@ -83,6 +83,7 @@ const CoCreateRender = {
|
|
|
83
83
|
if (!arrayData){
|
|
84
84
|
let cloneEl = this.cloneEl(template);
|
|
85
85
|
cloneEl.classList.add('cloned');
|
|
86
|
+
self.setValue([cloneEl], data);
|
|
86
87
|
template.insertAdjacentHTML('beforebegin', cloneEl.outerHTML);
|
|
87
88
|
}
|
|
88
89
|
if (type && Array.isArray(arrayData)) {
|
|
@@ -117,10 +118,14 @@ const CoCreateRender = {
|
|
|
117
118
|
if (!data) return;
|
|
118
119
|
const that = this;
|
|
119
120
|
Array.from(els).forEach(el => {
|
|
121
|
+
|
|
120
122
|
// let passId = e.getAttribute('pass_id');
|
|
121
123
|
// if (passTo && passId != passTo) {
|
|
122
124
|
// return;
|
|
123
125
|
// }
|
|
126
|
+
// if (el.classList.contains('template')) {
|
|
127
|
+
// el = this.cloneEl(el);
|
|
128
|
+
// }
|
|
124
129
|
Array.from(el.attributes).forEach(attr=>{
|
|
125
130
|
let attr_name = attr.name.toLowerCase();
|
|
126
131
|
// let isPass = false;
|
|
@@ -170,10 +175,15 @@ const CoCreateRender = {
|
|
|
170
175
|
if (selector) {
|
|
171
176
|
let template = document.querySelector(selector)
|
|
172
177
|
if (!template) return;
|
|
173
|
-
|
|
178
|
+
if (template.classList.contains('template')) {
|
|
179
|
+
this.render(template, data)
|
|
180
|
+
}
|
|
181
|
+
else
|
|
182
|
+
this.setValue([template], data, passTo, template);
|
|
174
183
|
} else if (elements) {
|
|
175
184
|
this.setValue(elements, data, passTo);
|
|
176
185
|
}
|
|
186
|
+
|
|
177
187
|
}
|
|
178
188
|
|
|
179
189
|
}
|