@cocreate/elements 1.26.4 → 1.27.1
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 +19 -0
- package/package.json +8 -8
- package/src/form.js +3 -3
- package/src/index.js +14 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [1.27.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.27.0...v1.27.1) (2023-11-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* condistions for matching elements and updating ([d7e7a39](https://github.com/CoCreate-app/CoCreate-elements/commit/d7e7a3920f9ccb1693b17f177a2734e3926a7e35))
|
|
7
|
+
|
|
8
|
+
# [1.27.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.26.4...v1.27.0) (2023-11-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* use action.form ([e1dbf09](https://github.com/CoCreate-app/CoCreate-elements/commit/e1dbf0972d52733225ba9caccd2a72f045e25dec))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* update dependecies for th latest features and bug fixes ([69f772b](https://github.com/CoCreate-app/CoCreate-elements/commit/69f772bec35ea1a2803e98eb983cb5261eff8673))
|
|
19
|
+
|
|
1
20
|
## [1.26.4](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.26.3...v1.26.4) (2023-11-18)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/elements",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.1",
|
|
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.12.
|
|
62
|
-
"@cocreate/crud-client": "^1.
|
|
63
|
-
"@cocreate/element-prototype": "^1.13.
|
|
64
|
-
"@cocreate/filter": "^1.
|
|
65
|
-
"@cocreate/observer": "^1.
|
|
66
|
-
"@cocreate/render": "^1.
|
|
67
|
-
"@cocreate/utils": "^1.27.
|
|
61
|
+
"@cocreate/actions": "^1.12.4",
|
|
62
|
+
"@cocreate/crud-client": "^1.29.0",
|
|
63
|
+
"@cocreate/element-prototype": "^1.13.2",
|
|
64
|
+
"@cocreate/filter": "^1.25.0",
|
|
65
|
+
"@cocreate/observer": "^1.12.0",
|
|
66
|
+
"@cocreate/render": "^1.32.0",
|
|
67
|
+
"@cocreate/utils": "^1.27.4"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/form.js
CHANGED
|
@@ -81,8 +81,7 @@ function disableAutoFill(element) {
|
|
|
81
81
|
/**
|
|
82
82
|
* @param btn
|
|
83
83
|
*/
|
|
84
|
-
function reset(
|
|
85
|
-
const form = btn.closest("form");
|
|
84
|
+
function reset(form) {
|
|
86
85
|
let formElements = new Map();
|
|
87
86
|
for (let element of form) {
|
|
88
87
|
formElements.set(element, '')
|
|
@@ -132,7 +131,8 @@ Action.init({
|
|
|
132
131
|
name: "reset",
|
|
133
132
|
endEvent: "reset",
|
|
134
133
|
callback: (action) => {
|
|
135
|
-
|
|
134
|
+
if (action.form)
|
|
135
|
+
send(action.form);
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
|
package/src/index.js
CHANGED
|
@@ -324,7 +324,8 @@ async function filterData(element, data, type, key) {
|
|
|
324
324
|
Data.push(...doc[key])
|
|
325
325
|
else
|
|
326
326
|
Data.push(doc[key])
|
|
327
|
-
}
|
|
327
|
+
} else
|
|
328
|
+
return
|
|
328
329
|
}
|
|
329
330
|
// if (Data.length === 1) {
|
|
330
331
|
// data = { [key]: Data[0] }
|
|
@@ -486,6 +487,7 @@ function getDataElements(data) {
|
|
|
486
487
|
return element
|
|
487
488
|
}
|
|
488
489
|
|
|
490
|
+
// TODO: Correctly check for matches
|
|
489
491
|
function getDataKeys(data) {
|
|
490
492
|
const matchingKeyStrings = [];
|
|
491
493
|
const targetKeys = ["type", "storage", "database", "array", "index", "object", '$filter'];
|
|
@@ -494,7 +496,7 @@ function getDataKeys(data) {
|
|
|
494
496
|
let hasMatch = true;
|
|
495
497
|
|
|
496
498
|
for (const key of targetKeys) {
|
|
497
|
-
if (!data.$filter &&
|
|
499
|
+
if (!data.$filter && key === '$filter' && sortedKey.data.hasOwnProperty(key))
|
|
498
500
|
hasMatch = true
|
|
499
501
|
else if (data.hasOwnProperty(key)) {
|
|
500
502
|
if (!sortedKey.data.hasOwnProperty(key)) {
|
|
@@ -505,7 +507,14 @@ function getDataKeys(data) {
|
|
|
505
507
|
// if key is object check _id
|
|
506
508
|
const matches = sortedKey.data[key].some(value => {
|
|
507
509
|
if (key === 'object') {
|
|
508
|
-
return data[key].some(obj =>
|
|
510
|
+
return data[key].some(obj => {
|
|
511
|
+
if (data.array.includes('users'))
|
|
512
|
+
console.log('users')
|
|
513
|
+
if (data.array.includes('questions'))
|
|
514
|
+
console.log('questions')
|
|
515
|
+
|
|
516
|
+
return obj._id === value._id
|
|
517
|
+
});
|
|
509
518
|
} else {
|
|
510
519
|
return data[key].includes(value)
|
|
511
520
|
}
|
|
@@ -1096,8 +1105,8 @@ Actions.init([
|
|
|
1096
1105
|
name: "save",
|
|
1097
1106
|
endEvent: "saved",
|
|
1098
1107
|
callback: (action) => {
|
|
1099
|
-
|
|
1100
|
-
|
|
1108
|
+
if (action.form)
|
|
1109
|
+
save(action.form);
|
|
1101
1110
|
}
|
|
1102
1111
|
},
|
|
1103
1112
|
{
|