@cocreate/render 1.41.1 → 1.41.3
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 +15 -0
- package/package.json +5 -5
- package/src/index.js +14 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [1.41.3](https://github.com/CoCreate-app/CoCreate-render/compare/v1.41.2...v1.41.3) (2024-06-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update dependencies ([50078df](https://github.com/CoCreate-app/CoCreate-render/commit/50078df06306f086379e84aee70a732f1dee02d1))
|
|
7
|
+
|
|
8
|
+
## [1.41.2](https://github.com/CoCreate-app/CoCreate-render/compare/v1.41.1...v1.41.2) (2024-06-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* create new object from data to perserve its values ([a3496fc](https://github.com/CoCreate-app/CoCreate-render/commit/a3496fcb17e3488586ff8f6495c87feab7a38da8))
|
|
14
|
+
* handle key='{}' object ([37cc2aa](https://github.com/CoCreate-app/CoCreate-render/commit/37cc2aa324d37d248593b84b0398bc5a4938c13e))
|
|
15
|
+
|
|
1
16
|
## [1.41.1](https://github.com/CoCreate-app/CoCreate-render/compare/v1.41.0...v1.41.1) (2024-06-12)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/render",
|
|
3
|
-
"version": "1.41.
|
|
3
|
+
"version": "1.41.3",
|
|
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",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"webpack-log": "^3.0.1"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@cocreate/actions": "^1.18.
|
|
62
|
-
"@cocreate/api": "^1.
|
|
61
|
+
"@cocreate/actions": "^1.18.3",
|
|
62
|
+
"@cocreate/api": "^1.4.2",
|
|
63
63
|
"@cocreate/element-prototype": "^1.23.0",
|
|
64
|
-
"@cocreate/observer": "^1.16.
|
|
65
|
-
"@cocreate/utils": "^1.
|
|
64
|
+
"@cocreate/observer": "^1.16.2",
|
|
65
|
+
"@cocreate/utils": "^1.34.0"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/index.js
CHANGED
|
@@ -81,6 +81,7 @@ function init(element) {
|
|
|
81
81
|
* @param {boolean} [options.remove] - Flag to indicate if the rendering should remove elements instead of updating or appending.
|
|
82
82
|
*/
|
|
83
83
|
async function render({ source, element, selector, data, key, index, currentIndex, update, remove }) {
|
|
84
|
+
let Data = { ...data }
|
|
84
85
|
if (!element) {
|
|
85
86
|
if (source) {
|
|
86
87
|
element = queryElements({ element: source, prefix: 'render' })
|
|
@@ -114,20 +115,21 @@ async function render({ source, element, selector, data, key, index, currentInde
|
|
|
114
115
|
else if (!key)
|
|
115
116
|
return
|
|
116
117
|
|
|
117
|
-
}
|
|
118
|
+
} else if (key == '{}')
|
|
119
|
+
key = 'object'
|
|
118
120
|
}
|
|
119
121
|
let sourceData = sources.get(source)
|
|
120
122
|
if (!sourceData) {
|
|
121
|
-
sourceData = { element: source,
|
|
123
|
+
sourceData = { element: source, Data }
|
|
122
124
|
sources.set(source, sourceData)
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
source = sourceData
|
|
126
128
|
if (!source.data)
|
|
127
|
-
source.data =
|
|
129
|
+
source.data = Data
|
|
128
130
|
|
|
129
131
|
} else if (data)
|
|
130
|
-
source = {
|
|
132
|
+
source = { Data }
|
|
131
133
|
|
|
132
134
|
if (data.$filter) {
|
|
133
135
|
index = index || data.$filter.startingIndex || data.$filter.index
|
|
@@ -259,6 +261,14 @@ async function renderTemplate(template, data, key, index, keyPath) {
|
|
|
259
261
|
element.remove()
|
|
260
262
|
template.clones.delete(key)
|
|
261
263
|
}
|
|
264
|
+
// if (renderedNodes.size) {
|
|
265
|
+
// for (let [element] of renderedNodes) {
|
|
266
|
+
// element.remove()
|
|
267
|
+
// }
|
|
268
|
+
// renderedNodes.clear();
|
|
269
|
+
// }
|
|
270
|
+
|
|
271
|
+
|
|
262
272
|
// template.data = renderData
|
|
263
273
|
}
|
|
264
274
|
// else if (index) {
|