saasufy-components 7.3.2 → 7.4.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/collection-viewer.js +33 -1
- package/package.json +2 -2
package/collection-viewer.js
CHANGED
|
@@ -37,10 +37,40 @@ class CollectionViewer extends SocketConsumer {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
this.handleCRUDUpdateEvent = async (event) => {
|
|
41
|
+
event.stopPropagation();
|
|
42
|
+
if (this.collection) {
|
|
43
|
+
let detail = event.detail || {};
|
|
44
|
+
let modelId = detail.id;
|
|
45
|
+
let modelValue = detail.value;
|
|
46
|
+
await this.collection.update(modelId, modelValue);
|
|
47
|
+
this.dispatchEvent(
|
|
48
|
+
new CustomEvent('collectionUpdate', {
|
|
49
|
+
detail: {
|
|
50
|
+
type: this.collection.type,
|
|
51
|
+
id: modelId,
|
|
52
|
+
value: modelValue
|
|
53
|
+
},
|
|
54
|
+
bubbles: true
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
if (this.hasAttribute('collection-disable-realtime') && this.collection) {
|
|
58
|
+
this.collection.reloadCurrentPage();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
40
63
|
this.handleCRUDDeleteEvent = async (event) => {
|
|
41
64
|
event.stopPropagation();
|
|
42
65
|
if (this.collection) {
|
|
43
|
-
|
|
66
|
+
let detail = event.detail || {};
|
|
67
|
+
let modelId = detail.id;
|
|
68
|
+
let modelField = detail.field;
|
|
69
|
+
if (modelId != null) {
|
|
70
|
+
await this.collection.delete(modelId, modelField);
|
|
71
|
+
} else {
|
|
72
|
+
await this.collection.delete(event.detail);
|
|
73
|
+
}
|
|
44
74
|
this.dispatchEvent(
|
|
45
75
|
new CustomEvent('collectionDelete', {
|
|
46
76
|
detail: {
|
|
@@ -83,6 +113,7 @@ class CollectionViewer extends SocketConsumer {
|
|
|
83
113
|
this.shadowRoot.addEventListener('slotchange', this.handleSlotChangeEvent);
|
|
84
114
|
this.addEventListener('showModal', this.handleShowModalEvent);
|
|
85
115
|
this.addEventListener('crudCreate', this.handleCRUDCreateEvent);
|
|
116
|
+
this.addEventListener('crudUpdate', this.handleCRUDUpdateEvent);
|
|
86
117
|
this.addEventListener('crudDelete', this.handleCRUDDeleteEvent);
|
|
87
118
|
this.addEventListener('goToPreviousPage', this.handleGoToPreviousPageEvent);
|
|
88
119
|
this.addEventListener('goToNextPage', this.handleGoToNextPageEvent);
|
|
@@ -95,6 +126,7 @@ class CollectionViewer extends SocketConsumer {
|
|
|
95
126
|
this.shadowRoot.removeEventListener('slotchange', this.handleSlotChangeEvent);
|
|
96
127
|
this.removeEventListener('showModal', this.handleShowModalEvent);
|
|
97
128
|
this.removeEventListener('crudCreate', this.handleCRUDCreateEvent);
|
|
129
|
+
this.removeEventListener('crudUpdate', this.handleCRUDUpdateEvent);
|
|
98
130
|
this.removeEventListener('crudDelete', this.handleCRUDDeleteEvent);
|
|
99
131
|
this.removeEventListener('goToPreviousPage', this.handleGoToPreviousPageEvent);
|
|
100
132
|
this.removeEventListener('goToNextPage', this.handleGoToNextPageEvent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saasufy-components",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "Components for Saasufy.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "Jonathan Gros-Dubois",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"ag-collection": "^5.3.
|
|
20
|
+
"ag-collection": "^5.3.1",
|
|
21
21
|
"ag-model": "^3.1.0",
|
|
22
22
|
"capitalisk-auth-client": "^1.5.1",
|
|
23
23
|
"socketcluster-client": "^19.2.1",
|