@cocreate/elements 1.8.4 → 1.9.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 +8 -0
- package/package.json +3 -2
- package/src/index.js +10 -1
- package/src/setValue.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# [1.9.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.8.4...v1.9.0) (2022-07-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* setValue can target element in iframe or parent of iframe using @cocreate/utils queryDocumentSelectorAll ([1447236](https://github.com/CoCreate-app/CoCreate-elements/commit/1447236b86507336a9c3db6452f0760790cabd59))
|
|
7
|
+
* value-type attribute to define if value is an object ([9649b6a](https://github.com/CoCreate-app/CoCreate-elements/commit/9649b6acdbe5e97f5418df5244025a359433891c))
|
|
8
|
+
|
|
1
9
|
## [1.8.4](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.8.3...v1.8.4) (2022-06-18)
|
|
2
10
|
|
|
3
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/elements",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
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",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"@cocreate/actions": "^1.4.3",
|
|
65
65
|
"@cocreate/crud-client": "^1.7.1",
|
|
66
66
|
"@cocreate/docs": "^1.3.3",
|
|
67
|
-
"@cocreate/observer": "^1.5.3"
|
|
67
|
+
"@cocreate/observer": "^1.5.3",
|
|
68
|
+
"@cocreate/utils": "^1.8.1"
|
|
68
69
|
}
|
|
69
70
|
}
|
package/src/index.js
CHANGED
|
@@ -89,7 +89,16 @@ function setData(elements, data) {
|
|
|
89
89
|
|
|
90
90
|
// if (data['collection'] == collection && data['document_id'] == document_id && !isEditable) {
|
|
91
91
|
if (data['collection'] == collection && data['document_id'] == document_id) {
|
|
92
|
-
|
|
92
|
+
let value;
|
|
93
|
+
let valueType = el.getAttribute('value-type');
|
|
94
|
+
if(valueType == 'object' || valueType == 'json'){
|
|
95
|
+
// if (name == 'data')
|
|
96
|
+
// value = JSON.stringify(data[name])
|
|
97
|
+
// else
|
|
98
|
+
value = JSON.stringify(data.data[name])
|
|
99
|
+
value = decodeURIComponent(value)
|
|
100
|
+
} else
|
|
101
|
+
value = encodeData[name];
|
|
93
102
|
setValue(el, value);
|
|
94
103
|
|
|
95
104
|
isRendered = true;
|
package/src/setValue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import observer from '@cocreate/observer';
|
|
2
2
|
import crud from '@cocreate/crud-client';
|
|
3
|
-
import {
|
|
3
|
+
import { queryDocumentSelectorAll } from '@cocreate/utils';
|
|
4
4
|
|
|
5
5
|
function initSetValues() {
|
|
6
6
|
var elements = document.querySelectorAll('[set-value]');
|
|
@@ -35,7 +35,7 @@ function setValueByFind(element){
|
|
|
35
35
|
if (!value) return;
|
|
36
36
|
let selector = element.getAttribute('set-value');
|
|
37
37
|
if(!selector) return;
|
|
38
|
-
let elements =
|
|
38
|
+
let elements = queryDocumentSelectorAll(selector);
|
|
39
39
|
|
|
40
40
|
for(let element of elements){
|
|
41
41
|
if (key){
|