@cocreate/elements 1.31.1 → 1.33.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 +14 -0
- package/package.json +6 -6
- package/src/index.js +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.33.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.32.0...v1.33.0) (2024-01-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* bumped CoCreate dependencies to their latest versions ([e8679cb](https://github.com/CoCreate-app/CoCreate-elements/commit/e8679cb986723650f65b427b0e465874fefb785b))
|
|
7
|
+
|
|
8
|
+
# [1.32.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.31.1...v1.32.0) (2023-12-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* sort data by filter operator $in ([7fdb3e0](https://github.com/CoCreate-app/CoCreate-elements/commit/7fdb3e0b0e78077fa0a3e4d69c09aa73e9733f41))
|
|
14
|
+
|
|
1
15
|
## [1.31.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.31.0...v1.31.1) (2023-12-18)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/elements",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.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",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"webpack-log": "^3.0.1"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@cocreate/actions": "^1.
|
|
62
|
-
"@cocreate/crud-client": "^1.
|
|
61
|
+
"@cocreate/actions": "^1.15.1",
|
|
62
|
+
"@cocreate/crud-client": "^1.32.2",
|
|
63
63
|
"@cocreate/element-prototype": "^1.15.0",
|
|
64
64
|
"@cocreate/filter": "^1.27.0",
|
|
65
|
-
"@cocreate/observer": "^1.
|
|
66
|
-
"@cocreate/render": "^1.
|
|
67
|
-
"@cocreate/utils": "^1.
|
|
65
|
+
"@cocreate/observer": "^1.15.0",
|
|
66
|
+
"@cocreate/render": "^1.37.1",
|
|
67
|
+
"@cocreate/utils": "^1.30.0"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/index.js
CHANGED
|
@@ -300,6 +300,23 @@ async function setData(element, data) {
|
|
|
300
300
|
} else if (type == 'key')
|
|
301
301
|
type = 'object'
|
|
302
302
|
|
|
303
|
+
if (data.$filter && data.$filter.query) {
|
|
304
|
+
let mergedValues = [];
|
|
305
|
+
|
|
306
|
+
data.$filter.query.forEach(obj => {
|
|
307
|
+
if (obj.operator === '$in') {
|
|
308
|
+
mergedValues = [...mergedValues, ...obj.value];
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
if (mergedValues.length) {
|
|
313
|
+
const sortedType = mergedValues
|
|
314
|
+
.map(name => data[type].find(career => career.name === name))
|
|
315
|
+
.filter(career => career !== undefined);
|
|
316
|
+
data[type] = sortedType
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
303
320
|
for (let el of element) {
|
|
304
321
|
// if rendered in server side skip
|
|
305
322
|
if (el.hasAttribute('rendered'))
|