@cocreate/elements 1.25.0 → 1.25.2
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 +8 -8
- package/src/index.js +43 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.25.2](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.25.1...v1.25.2) (2023-10-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* bump dependencies ([0dd525a](https://github.com/CoCreate-app/CoCreate-elements/commit/0dd525a6cd1c859d4b8b6a75eb50d457a1b057d7))
|
|
7
|
+
|
|
8
|
+
## [1.25.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.25.0...v1.25.1) (2023-10-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* compbin Actions in to one array of Actions ([716602d](https://github.com/CoCreate-app/CoCreate-elements/commit/716602dd74368e32be5f1e053903b32b54fb003d))
|
|
14
|
+
|
|
1
15
|
# [1.25.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.24.3...v1.25.0) (2023-10-22)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/elements",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.2",
|
|
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.28.
|
|
63
|
-
"@cocreate/element-prototype": "^1.11.
|
|
64
|
-
"@cocreate/filter": "^1.23.
|
|
65
|
-
"@cocreate/observer": "^1.11.
|
|
66
|
-
"@cocreate/render": "^1.
|
|
67
|
-
"@cocreate/utils": "^1.
|
|
61
|
+
"@cocreate/actions": "^1.12.0",
|
|
62
|
+
"@cocreate/crud-client": "^1.28.10",
|
|
63
|
+
"@cocreate/element-prototype": "^1.11.7",
|
|
64
|
+
"@cocreate/filter": "^1.23.5",
|
|
65
|
+
"@cocreate/observer": "^1.11.6",
|
|
66
|
+
"@cocreate/render": "^1.29.0",
|
|
67
|
+
"@cocreate/utils": "^1.26.1"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/index.js
CHANGED
|
@@ -1047,54 +1047,55 @@ Observer.init({
|
|
|
1047
1047
|
}
|
|
1048
1048
|
});
|
|
1049
1049
|
|
|
1050
|
-
Actions.init(
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1050
|
+
Actions.init([
|
|
1051
|
+
{
|
|
1052
|
+
name: "save",
|
|
1053
|
+
endEvent: "saved",
|
|
1054
|
+
callback: (action) => {
|
|
1055
|
+
const form = action.element.closest("form");
|
|
1056
|
+
save(form);
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
name: "delete",
|
|
1061
|
+
endEvent: "deleted",
|
|
1062
|
+
callback: async (action) => {
|
|
1063
|
+
let elements = queryElements({ element: action.element, prefix: 'delete' });
|
|
1064
|
+
if (elements === false)
|
|
1065
|
+
elements = [action.element]
|
|
1066
|
+
|
|
1067
|
+
for (let i = 0; i < elements.length; i++) {
|
|
1068
|
+
const data = getObject(elements[i]);
|
|
1069
|
+
if (!data) return
|
|
1070
|
+
data.method = 'delete.' + data.type
|
|
1071
|
+
|
|
1072
|
+
if (elements[i].renderValue) {
|
|
1073
|
+
let selected = elements[i].querySelectorAll('.selected')
|
|
1074
|
+
data[data.type] = []
|
|
1075
|
+
for (let j = 0; j < selected.length; j++) {
|
|
1076
|
+
let attribute = selected[j].getAttribute(data.type)
|
|
1077
|
+
if (attribute) {
|
|
1078
|
+
attribute = attribute.split(',')
|
|
1079
|
+
for (let k = 0; k < attribute.length; k++) {
|
|
1080
|
+
if (data.type === 'object')
|
|
1081
|
+
data[data.type].push({ _id: attribute[k] })
|
|
1082
|
+
else {
|
|
1083
|
+
data[data.type].push(attribute[k])
|
|
1084
|
+
}
|
|
1084
1085
|
}
|
|
1085
1086
|
}
|
|
1086
1087
|
}
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
data[data.type] = { _id: data[data.type] }
|
|
1088
|
+
} else if (data.type === 'object' && typeof data[data.type] === 'string')
|
|
1089
|
+
data[data.type] = { _id: data[data.type] }
|
|
1090
1090
|
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1091
|
+
let response = await CRUD.send(data)
|
|
1092
|
+
document.dispatchEvent(new CustomEvent('deleted', {
|
|
1093
|
+
detail: response
|
|
1094
|
+
}));
|
|
1095
|
+
}
|
|
1095
1096
|
}
|
|
1096
1097
|
}
|
|
1097
|
-
|
|
1098
|
+
]);
|
|
1098
1099
|
|
|
1099
1100
|
init();
|
|
1100
1101
|
|