@cocreate/render 1.21.0 → 1.21.1
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 +7 -7
- package/src/index.js +33 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.21.1](https://github.com/CoCreate-app/CoCreate-render/compare/v1.21.0...v1.21.1) (2023-01-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* bump dependencies ([8be30b6](https://github.com/CoCreate-app/CoCreate-render/commit/8be30b676bb20b53165dadd8a7fd8b05388df793))
|
|
7
|
+
|
|
1
8
|
# [1.21.0](https://github.com/CoCreate-app/CoCreate-render/compare/v1.20.0...v1.21.0) (2023-01-10)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/render",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.1",
|
|
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",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"webpack-log": "^3.0.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@cocreate/actions": "^1.5.
|
|
64
|
-
"@cocreate/api": "^1.6.
|
|
65
|
-
"@cocreate/docs": "^1.5.
|
|
66
|
-
"@cocreate/element-prototype": "^1.4.
|
|
67
|
-
"@cocreate/observer": "^1.5.
|
|
68
|
-
"@cocreate/utils": "^1.17.
|
|
63
|
+
"@cocreate/actions": "^1.5.53",
|
|
64
|
+
"@cocreate/api": "^1.6.4",
|
|
65
|
+
"@cocreate/docs": "^1.5.7",
|
|
66
|
+
"@cocreate/element-prototype": "^1.4.3",
|
|
67
|
+
"@cocreate/observer": "^1.5.57",
|
|
68
|
+
"@cocreate/utils": "^1.17.20"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/src/index.js
CHANGED
|
@@ -306,9 +306,24 @@ const CoCreateRender = {
|
|
|
306
306
|
CoCreate.pass.initElement(el)
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
+
if (el.tagName === 'SCRIPT' && el.src) {
|
|
310
|
+
if (el.src.includes('CoCreate.js') || el.src.includes('CoCreate.min.js')) {
|
|
311
|
+
el.remove()
|
|
312
|
+
return
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (el.tagName === 'LINK' && el.href) {
|
|
317
|
+
if (el.href.includes('CoCreate.css') || el.href.includes('CoCreate.min.css')) {
|
|
318
|
+
el.remove()
|
|
319
|
+
return
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
309
323
|
if (el.childNodes.length > 0) {
|
|
310
324
|
that.setValue(el.childNodes, updateData || data, renderArray, renderKey);
|
|
311
325
|
}
|
|
326
|
+
|
|
312
327
|
if ((el.tagName == 'TEMPLATE' || el.hasAttribute('template') || el.classList.contains('template')) && !el.hasAttribute('template_id')) {
|
|
313
328
|
if (el.getAttribute('render-object') || el.getAttribute('render-array'))
|
|
314
329
|
that.render(el, data);
|
|
@@ -322,19 +337,20 @@ const CoCreateRender = {
|
|
|
322
337
|
let textContent, placeholder, text;
|
|
323
338
|
if (el.renderMap)
|
|
324
339
|
placeholder = el.renderMap.get(el)
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
340
|
+
if (placeholder && !isRenderKey) {
|
|
341
|
+
let updateData = data;
|
|
342
|
+
textContent = placeholder.placeholder
|
|
343
|
+
renderKey = placeholder.renderKey
|
|
344
|
+
renderArray = placeholder.renderArray
|
|
345
|
+
if (renderArray && Array.isArray(data[renderArray]))
|
|
346
|
+
updateData = data[renderArray][0]
|
|
347
|
+
else
|
|
348
|
+
updateData = data[renderArray]
|
|
349
|
+
if (renderKey)
|
|
350
|
+
updateData = {[renderKey]: updateData}
|
|
351
|
+
text = that.__replaceValue(updateData, textContent, renderKey, el);
|
|
352
|
+
}
|
|
353
|
+
|
|
338
354
|
if (!placeholder && !text) {
|
|
339
355
|
textContent = el.textContent;
|
|
340
356
|
if (!el.renderMap)
|
|
@@ -358,6 +374,10 @@ const CoCreateRender = {
|
|
|
358
374
|
} else if (!parentElement['renderMap'].has(parentElement))
|
|
359
375
|
that.renderMap(parentElement, textContent, renderArray, renderKey)
|
|
360
376
|
el.replaceWith(...newNode.childNodes)
|
|
377
|
+
|
|
378
|
+
if (el.childNodes.length > 0) {
|
|
379
|
+
that.setValue(el.childNodes, updateData || data, renderArray, renderKey);
|
|
380
|
+
}
|
|
361
381
|
}
|
|
362
382
|
}
|
|
363
383
|
}
|