@cocreate/render 1.21.7 → 1.22.0

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.22.0](https://github.com/CoCreate-app/CoCreate-render/compare/v1.21.8...v1.22.0) (2023-03-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * replaced get-value and set-value with a super charged version of CoCreate-events ([d8a040c](https://github.com/CoCreate-app/CoCreate-render/commit/d8a040c79afa9fc81ec4dd093fec6bf545441463))
7
+
8
+ ## [1.21.8](https://github.com/CoCreate-app/CoCreate-render/compare/v1.21.7...v1.21.8) (2023-03-15)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * !updateData attrVaue set to undefined ([44e339f](https://github.com/CoCreate-app/CoCreate-render/commit/44e339fa3e5bd9868a31038a7b2cf0017fb53340))
14
+ * supports empty string ([3dc45a9](https://github.com/CoCreate-app/CoCreate-render/commit/3dc45a92840f722a896f87a8e22a6bb44b5398e7))
15
+
1
16
  ## [1.21.7](https://github.com/CoCreate-app/CoCreate-render/compare/v1.21.6...v1.21.7) (2023-02-01)
2
17
 
3
18
 
package/docs/index.html CHANGED
@@ -240,7 +240,7 @@
240
240
  </div>
241
241
 
242
242
  <div id="demo-preview" class="position:relative overflow:auto background-color:white">
243
- <div get-value="#demo" class="padding:20px"></div>
243
+ <div class="demopreview" class="padding:20px"></div>
244
244
  </div>
245
245
 
246
246
  <div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/render",
3
- "version": "1.21.7",
3
+ "version": "1.22.0",
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