saasufy-components 1.14.0 → 2.0.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-browser.js +8 -1
- package/package.json +3 -3
package/collection-browser.js
CHANGED
|
@@ -8,6 +8,7 @@ class CollectionBrowser extends SocketConsumer {
|
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
10
10
|
this.isReady = false;
|
|
11
|
+
this.isStale = true;
|
|
11
12
|
this.attachShadow({ mode: 'open' });
|
|
12
13
|
|
|
13
14
|
this.handleShowModalEvent = (event) => {
|
|
@@ -76,12 +77,14 @@ class CollectionBrowser extends SocketConsumer {
|
|
|
76
77
|
|
|
77
78
|
goToPreviousPage() {
|
|
78
79
|
if (!this.collection) return;
|
|
80
|
+
this.isStale = true;
|
|
79
81
|
this.collection.fetchPreviousPage();
|
|
80
82
|
this.setAttribute('collection-page-offset', this.collection.meta.pageOffset);
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
goToNextPage() {
|
|
84
86
|
if (!this.collection) return;
|
|
87
|
+
this.isStale = true;
|
|
85
88
|
this.collection.fetchNextPage();
|
|
86
89
|
this.setAttribute('collection-page-offset', this.collection.meta.pageOffset);
|
|
87
90
|
}
|
|
@@ -98,6 +101,7 @@ class CollectionBrowser extends SocketConsumer {
|
|
|
98
101
|
'collection-view-params',
|
|
99
102
|
'collection-page-size',
|
|
100
103
|
'collection-page-offset',
|
|
104
|
+
'max-show-loader',
|
|
101
105
|
'type-alias',
|
|
102
106
|
'hide-error-logs'
|
|
103
107
|
];
|
|
@@ -108,6 +112,7 @@ class CollectionBrowser extends SocketConsumer {
|
|
|
108
112
|
if (this.collection && name === 'collection-page-offset') {
|
|
109
113
|
let newOffset = Number(newValue);
|
|
110
114
|
if (newOffset !== this.collection.meta.pageOffset) {
|
|
115
|
+
this.isStale = true;
|
|
111
116
|
this.collection.fetchPage(newOffset);
|
|
112
117
|
}
|
|
113
118
|
this.updatePageNumberElements();
|
|
@@ -161,12 +166,13 @@ class CollectionBrowser extends SocketConsumer {
|
|
|
161
166
|
let hasLoaders = !!loaderSlot.assignedNodes().length;
|
|
162
167
|
|
|
163
168
|
if (!this.collection || !this.collection.isLoaded) {
|
|
164
|
-
if (hasLoaders) {
|
|
169
|
+
if (hasLoaders && (this.isStale || this.hasAttribute('max-show-loader'))) {
|
|
165
170
|
viewportSlot.classList.add('hidden');
|
|
166
171
|
loaderSlot.classList.remove('hidden');
|
|
167
172
|
}
|
|
168
173
|
return;
|
|
169
174
|
}
|
|
175
|
+
this.isStale = false;
|
|
170
176
|
|
|
171
177
|
loaderSlot.classList.add('hidden');
|
|
172
178
|
viewportSlot.classList.remove('hidden');
|
|
@@ -221,6 +227,7 @@ class CollectionBrowser extends SocketConsumer {
|
|
|
221
227
|
.filter(([field]) => field)
|
|
222
228
|
);
|
|
223
229
|
if (this.collection) this.collection.destroy();
|
|
230
|
+
this.isStale = true;
|
|
224
231
|
|
|
225
232
|
this.collection = new AGCollection({
|
|
226
233
|
socket: this.socket,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saasufy-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Components for Saasufy.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"author": "Jonathan Gros-Dubois",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"ag-collection": "^
|
|
21
|
-
"ag-model": "^
|
|
20
|
+
"ag-collection": "^4.0.0",
|
|
21
|
+
"ag-model": "^2.0.0",
|
|
22
22
|
"capitalisk-auth-client": "^1.5.1",
|
|
23
23
|
"socketcluster-client": "^19.1.0"
|
|
24
24
|
},
|