@cocreate/elements 1.29.1 → 1.30.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 +12 -0
- package/package.json +1 -1
- package/src/index.js +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [1.30.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.29.1...v1.30.0) (2023-12-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* spread render import ([19e7abd](https://github.com/CoCreate-app/CoCreate-elements/commit/19e7abdb4ebcccfd05a79d17ad4c8681546b4ce5))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* handle resolved property and set index for create ([5e0d92d](https://github.com/CoCreate-app/CoCreate-elements/commit/5e0d92d37f26e2916f5c2b748d8c571f9814198a))
|
|
12
|
+
|
|
1
13
|
## [1.29.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.29.0...v1.29.1) (2023-12-15)
|
|
2
14
|
|
|
3
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/elements",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.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",
|
package/src/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import Actions from '@cocreate/actions';
|
|
|
27
27
|
import CRUD from '@cocreate/crud-client';
|
|
28
28
|
import { dotNotationToObject, queryElements, queryData, sortData, getAttributes, getAttributeNames, checkValue } from '@cocreate/utils';
|
|
29
29
|
import filter from '@cocreate/filter';
|
|
30
|
-
import render from '@cocreate/render';
|
|
30
|
+
import { render, renderValue, renderedNodes } from '@cocreate/render';
|
|
31
31
|
import '@cocreate/element-prototype';
|
|
32
32
|
import './fetchSrc';
|
|
33
33
|
import { reset } from './form'
|
|
@@ -86,13 +86,13 @@ async function initElement(el) {
|
|
|
86
86
|
// if found add the node as an element, if the element has crud attributes also add as the element
|
|
87
87
|
for (let attribute of el.attributes) {
|
|
88
88
|
if (attribute.match(/{{(.*?)}}/)) {
|
|
89
|
-
let value =
|
|
89
|
+
let value = renderValue(attribute, undefined, attribute.value)
|
|
90
90
|
if (value)
|
|
91
91
|
attribute.value = value
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
if (el.innerHTML.match(/{{(.*?)}}/)) {
|
|
95
|
-
let value =
|
|
95
|
+
let value = renderValue(el, undefined, el.innerHTML)
|
|
96
96
|
if (value)
|
|
97
97
|
attribute.value = value
|
|
98
98
|
}
|
|
@@ -441,6 +441,8 @@ function checkIndex(element, data, Data, newData, type, filter) {
|
|
|
441
441
|
data.$filter.create = true
|
|
442
442
|
if (filter && filter.sort)
|
|
443
443
|
newData.isNewData = true
|
|
444
|
+
else
|
|
445
|
+
index = Data.length
|
|
444
446
|
Data.push(newData)
|
|
445
447
|
}
|
|
446
448
|
} else {
|
|
@@ -531,11 +533,6 @@ function getDataKeys(data) {
|
|
|
531
533
|
const matches = sortedKey.data[key].some(value => {
|
|
532
534
|
if (key === 'object') {
|
|
533
535
|
return data[key].some(obj => {
|
|
534
|
-
if (data.array.includes('users'))
|
|
535
|
-
console.log('users')
|
|
536
|
-
if (data.array.includes('questions'))
|
|
537
|
-
console.log('questions')
|
|
538
|
-
|
|
539
536
|
return obj._id === value._id
|
|
540
537
|
});
|
|
541
538
|
} else {
|
|
@@ -950,6 +947,8 @@ function initSocket() {
|
|
|
950
947
|
const action = type[i] + '.' + method[j];
|
|
951
948
|
|
|
952
949
|
CRUD.listen(action, function (data) {
|
|
950
|
+
if (data.resolved && data.status === 'received' && CRUD.socket.clientId === data.clientId)
|
|
951
|
+
return
|
|
953
952
|
setData(null, data);
|
|
954
953
|
});
|
|
955
954
|
}
|
|
@@ -965,7 +964,7 @@ Observer.init({
|
|
|
965
964
|
clearTimeout(delayTimer);
|
|
966
965
|
debounce.delete(mutation.target)
|
|
967
966
|
|
|
968
|
-
let renderedNode =
|
|
967
|
+
let renderedNode = renderedNodes.get(mutation.target)
|
|
969
968
|
if (!renderedNode) return
|
|
970
969
|
|
|
971
970
|
if (!mutation.movedFrom) return
|
|
@@ -1072,7 +1071,7 @@ function dndNewData(element, data) {
|
|
|
1072
1071
|
|
|
1073
1072
|
let keyPath, clonesMap, clones, index
|
|
1074
1073
|
|
|
1075
|
-
let renderedNode =
|
|
1074
|
+
let renderedNode = renderedNodes.get(element)
|
|
1076
1075
|
if (renderedNode) {
|
|
1077
1076
|
keyPath = renderedNode.keyPath
|
|
1078
1077
|
clonesMap = renderedNode.template.clones
|