saasufy-components 7.1.0 → 7.3.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/README.md +1 -0
- package/app-router.js +4 -0
- package/collection-viewer.js +0 -2
- package/package.json +1 -1
- package/utils.js +3 -26
package/README.md
CHANGED
|
@@ -232,6 +232,7 @@ If you want to make sure that some data (e.g. a config file) has been fully load
|
|
|
232
232
|
- `no-auth-redirect`: An optional alternative path/route to redirect to if the user is on this page but they are not authenticated. If the user is authenticated, then the content of the template will be displayed as normal.
|
|
233
233
|
- `auth-redirect`: An optional alternative path/route to redirect to if the user is on this page but they are already authenticated. If the user is not authenticated, then the content of the template will be displayed as normal.
|
|
234
234
|
- `hard-redirect`: An optional, additional attribute which can be specified alongside a `redirect`, `no-auth-redirect` or `auth-redirect` attribute to ensure that any redirect will change the URL in the address bar. Redirects are `soft` redirects by default; this means that they redirect the user to the target page but keep the current URL path unchanged.
|
|
235
|
+
- `auto-reset-window-scroll`: If this attribute is present, the page scroll will be reset to the top when each new page is rendered.
|
|
235
236
|
|
|
236
237
|
### socket-provider
|
|
237
238
|
|
package/app-router.js
CHANGED
|
@@ -255,6 +255,10 @@ export class AppRouter extends SocketConsumer {
|
|
|
255
255
|
|
|
256
256
|
this.lastPageState = pageState;
|
|
257
257
|
|
|
258
|
+
if (this.hasAttribute('auto-reset-window-scroll')) {
|
|
259
|
+
window.scrollTo(0, 0);
|
|
260
|
+
}
|
|
261
|
+
|
|
258
262
|
routerViewport.innerHTML = renderTemplate(
|
|
259
263
|
pageTemplate.innerHTML,
|
|
260
264
|
routeArgs,
|
package/collection-viewer.js
CHANGED
|
@@ -361,8 +361,6 @@ class CollectionViewer extends SocketConsumer {
|
|
|
361
361
|
|
|
362
362
|
(async () => {
|
|
363
363
|
for await (let event of this.collection.listener('change')) {
|
|
364
|
-
// Ignore change events which originate from this collection instance.
|
|
365
|
-
if (!event.isRemote) continue;
|
|
366
364
|
this.renderList();
|
|
367
365
|
this.updatePageButtons();
|
|
368
366
|
}
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -63,32 +63,17 @@ export function createReactiveCollection(collectionOptions, callback) {
|
|
|
63
63
|
collection.safeValue = [];
|
|
64
64
|
|
|
65
65
|
(async () => {
|
|
66
|
-
let changes = {};
|
|
67
66
|
for await (let event of collection.listener('change')) {
|
|
68
|
-
// Ignore change events which originate from this collection instance.
|
|
69
|
-
if (!event.isRemote) continue;
|
|
70
|
-
|
|
71
|
-
if (event.resourceId != null && changes[event.resourceId] !== false) {
|
|
72
|
-
changes[event.resourceId] = event.isRemote;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
67
|
if (!collection.isLoaded) continue;
|
|
76
|
-
|
|
77
68
|
collection.safeValue = collection.value.map(toSafeModelValue);
|
|
78
|
-
|
|
79
|
-
callback({
|
|
80
|
-
changes
|
|
81
|
-
});
|
|
82
|
-
changes = {};
|
|
69
|
+
callback();
|
|
83
70
|
}
|
|
84
71
|
})();
|
|
85
72
|
|
|
86
73
|
(async () => {
|
|
87
74
|
for await (let event of collection.listener('load')) {
|
|
88
75
|
if (collection.isLoaded && !collection.value.length) {
|
|
89
|
-
callback(
|
|
90
|
-
changes: {}
|
|
91
|
-
});
|
|
76
|
+
callback();
|
|
92
77
|
}
|
|
93
78
|
}
|
|
94
79
|
})();
|
|
@@ -114,17 +99,9 @@ export function createReactiveModel(modelOptions, callback) {
|
|
|
114
99
|
})();
|
|
115
100
|
|
|
116
101
|
(async () => {
|
|
117
|
-
let changes = {};
|
|
118
102
|
for await (let event of model.listener('change')) {
|
|
119
|
-
if (changes[event.resourceField] !== false) {
|
|
120
|
-
changes[event.resourceField] = event.isRemote;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
103
|
model.safeValue = toSafeModelValue(model.value);
|
|
124
|
-
callback(
|
|
125
|
-
changes
|
|
126
|
-
});
|
|
127
|
-
changes = {};
|
|
104
|
+
callback();
|
|
128
105
|
}
|
|
129
106
|
})();
|
|
130
107
|
|