@cocreate/elements 1.34.2 → 1.34.4
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 +14 -0
- package/package.json +1 -1
- package/src/index.js +16 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.34.4](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.34.3...v1.34.4) (2024-02-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* minor bug fixes ([b136dda](https://github.com/CoCreate-app/CoCreate-elements/commit/b136dda0543ca1e3e558e38384fb4b447c455e05))
|
|
7
|
+
|
|
8
|
+
## [1.34.3](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.34.2...v1.34.3) (2024-02-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* getObject error ([ca732bb](https://github.com/CoCreate-app/CoCreate-elements/commit/ca732bb7824a6fc2dcdad6532f316fa9a2221915))
|
|
14
|
+
|
|
1
15
|
## [1.34.2](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.34.1...v1.34.2) (2024-02-17)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/elements",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.4",
|
|
4
4
|
"description": "Fetch content into any html element by using html5 attributes to query data stored in CoCreate headless CMS. If data is changed it will instantly reflect in html tags as changes are broadcasted in realtime",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"elements",
|
package/src/index.js
CHANGED
|
@@ -85,6 +85,8 @@ async function initElement(el) {
|
|
|
85
85
|
|
|
86
86
|
let data = getObject(el);
|
|
87
87
|
if (!data || !data.type) return
|
|
88
|
+
if (data.object !== '' && data.object !== 'pending' && !(/^[0-9a-fA-F]{24}$/.test(data.object)))
|
|
89
|
+
return
|
|
88
90
|
|
|
89
91
|
if (!elements.has(el)) {
|
|
90
92
|
elements.set(el, '')
|
|
@@ -202,8 +204,11 @@ function initDataKey(element, data) {
|
|
|
202
204
|
async function read(element, data, dataKey) {
|
|
203
205
|
if (!dataKey)
|
|
204
206
|
dataKey = { string: elements.get(element) }
|
|
205
|
-
if (!data)
|
|
206
|
-
|
|
207
|
+
if (!data) {
|
|
208
|
+
let existingData = keys.get(dataKey.string)
|
|
209
|
+
if (existingData && existingData.dataKey && existingData.dataKey.object)
|
|
210
|
+
data = { ...existingData.dataKey.object }
|
|
211
|
+
}
|
|
207
212
|
|
|
208
213
|
if (!dataKey || !data.type)
|
|
209
214
|
return
|
|
@@ -442,7 +447,15 @@ async function filterData(element, data, type, key) {
|
|
|
442
447
|
}
|
|
443
448
|
|
|
444
449
|
async function checkFilters(element, data, type) {
|
|
445
|
-
let Data
|
|
450
|
+
let Data
|
|
451
|
+
if (!element.getData) {
|
|
452
|
+
// TODO: fix: getObject as this is related to render or form, but filter could exist on an input which does not have getObject
|
|
453
|
+
// TODO: generate an object of current element key: value to use with filter. because filter is used object is not defined
|
|
454
|
+
Data = getObject(element)
|
|
455
|
+
Data = Data[type][0]
|
|
456
|
+
} else
|
|
457
|
+
Data = await element.getData()
|
|
458
|
+
|
|
446
459
|
if (!Data) return
|
|
447
460
|
|
|
448
461
|
let newData
|