@cocreate/elements 1.26.3 → 1.27.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 +20 -0
- package/package.json +8 -8
- package/src/form.js +3 -3
- package/src/index.js +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# [1.27.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.26.4...v1.27.0) (2023-11-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* use action.form ([e1dbf09](https://github.com/CoCreate-app/CoCreate-elements/commit/e1dbf0972d52733225ba9caccd2a72f045e25dec))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* update dependecies for th latest features and bug fixes ([69f772b](https://github.com/CoCreate-app/CoCreate-elements/commit/69f772bec35ea1a2803e98eb983cb5261eff8673))
|
|
12
|
+
|
|
13
|
+
## [1.26.4](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.26.3...v1.26.4) (2023-11-18)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* dataKey.string ([57cc534](https://github.com/CoCreate-app/CoCreate-elements/commit/57cc5344e7ba3d66e949c9f6999aaf90d066d2d3))
|
|
19
|
+
* return if no dataKey ([ace669b](https://github.com/CoCreate-app/CoCreate-elements/commit/ace669b19c59f37d1a0a2e62043171fd0b0999d2))
|
|
20
|
+
|
|
1
21
|
## [1.26.3](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.26.2...v1.26.3) (2023-11-16)
|
|
2
22
|
|
|
3
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/elements",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.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.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
|
@@ -215,11 +215,11 @@ function initDataKey(element, data) {
|
|
|
215
215
|
|
|
216
216
|
async function read(element, data, dataKey) {
|
|
217
217
|
if (!dataKey)
|
|
218
|
-
dataKey = elements.get(element)
|
|
218
|
+
dataKey = { string: elements.get(element) }
|
|
219
219
|
if (!data)
|
|
220
220
|
data = { ...keys.get(dataKey).dataKey.object }
|
|
221
221
|
|
|
222
|
-
if (!data.type)
|
|
222
|
+
if (!dataKey || !data.type)
|
|
223
223
|
return
|
|
224
224
|
if (!data.$filter && (!data[data.type] || !data[data.type].length))
|
|
225
225
|
return
|
|
@@ -534,8 +534,9 @@ async function getData(form) {
|
|
|
534
534
|
let formObject = forms.get(form)
|
|
535
535
|
for (let type of formObject.types.values()) {
|
|
536
536
|
for (let [element, data] of type.entries()) {
|
|
537
|
-
if (!element.hasAttribute('key'))
|
|
537
|
+
if (!element.hasAttribute('key') || element.getAttribute('save') === 'false')
|
|
538
538
|
continue
|
|
539
|
+
|
|
539
540
|
if (element.hasAttribute('actions')) {
|
|
540
541
|
let attribute = element.getAttribute('actions')
|
|
541
542
|
if (attribute.includes('save', 'delete'))
|
|
@@ -783,6 +784,8 @@ function setTypeValue(element, data) {
|
|
|
783
784
|
el.setAttribute(data.type, data[data.type].name)
|
|
784
785
|
}
|
|
785
786
|
}
|
|
787
|
+
setData(Array.from(elements.keys()), data)
|
|
788
|
+
|
|
786
789
|
|
|
787
790
|
// const pass_ids = new Map();
|
|
788
791
|
|
|
@@ -1093,8 +1096,8 @@ Actions.init([
|
|
|
1093
1096
|
name: "save",
|
|
1094
1097
|
endEvent: "saved",
|
|
1095
1098
|
callback: (action) => {
|
|
1096
|
-
|
|
1097
|
-
|
|
1099
|
+
if (action.form)
|
|
1100
|
+
save(action.form);
|
|
1098
1101
|
}
|
|
1099
1102
|
},
|
|
1100
1103
|
{
|