@cocreate/render 1.21.7 → 1.21.8

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.21.8](https://github.com/CoCreate-app/CoCreate-render/compare/v1.21.7...v1.21.8) (2023-03-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * !updateData attrVaue set to undefined ([44e339f](https://github.com/CoCreate-app/CoCreate-render/commit/44e339fa3e5bd9868a31038a7b2cf0017fb53340))
7
+ * supports empty string ([3dc45a9](https://github.com/CoCreate-app/CoCreate-render/commit/3dc45a92840f722a896f87a8e22a6bb44b5398e7))
8
+
1
9
  ## [1.21.7](https://github.com/CoCreate-app/CoCreate-render/compare/v1.21.6...v1.21.7) (2023-02-01)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/render",
3
- "version": "1.21.7",
3
+ "version": "1.21.8",
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",
package/src/index.js CHANGED
@@ -13,7 +13,7 @@ const CoCreateRender = {
13
13
  let result = /{{\s*([\w\W]+)\s*}}/g.exec(attrValue);
14
14
  if (result) {
15
15
  let value = getValueFromObject(data, result[1].trim());
16
- if (!value) {
16
+ if (!value && value !== '') {
17
17
  let parentTemplate
18
18
  if (el && el.nodeType == 1) {
19
19
  if (el.hasAttribute('templateid') && el.parentElement)
@@ -63,7 +63,7 @@ const CoCreateRender = {
63
63
  for (let placeholder of placeholders) {
64
64
  let value = this.__getValue(data, placeholder, el);
65
65
 
66
- if (value) {
66
+ if (value || value === "") {
67
67
  if (typeof(value) == "object")
68
68
  value = this.generateString(value)
69
69
 
@@ -285,8 +285,8 @@ const CoCreateRender = {
285
285
  // else
286
286
  // updateData = {[renderKey]: data}
287
287
  // }
288
-
289
- attrValue = that.__replaceValue(updateData, temp, renderKey, el);
288
+ if (updateData)
289
+ attrValue = that.__replaceValue(updateData, temp, renderKey, el);
290
290
  if (attrValue == attr.value)
291
291
  attrValue = undefined
292
292
  }
@@ -398,6 +398,7 @@ const CoCreateRender = {
398
398
  let template = queryDocumentSelector(selector);
399
399
  if (!template) return;
400
400
  if (template.tagName == 'TEMPLATE' || template.hasAttribute('template') || template.classList.contains('template')) {
401
+ template.renderedKeys = undefined
401
402
  this.render(template, data);
402
403
  }
403
404
  else