saasufy-components 7.2.0 → 7.3.1
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-adder-form.js +5 -13
- package/collection-adder.js +1 -12
- package/package.json +1 -1
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-adder-form.js
CHANGED
|
@@ -77,7 +77,10 @@ class CollectionAdderForm extends SocketConsumer {
|
|
|
77
77
|
} else {
|
|
78
78
|
inputType = input.type;
|
|
79
79
|
}
|
|
80
|
-
let Type = getTypeCastFunction(
|
|
80
|
+
let Type = getTypeCastFunction(
|
|
81
|
+
inputType === 'hidden' ?
|
|
82
|
+
input.getAttribute('output-type') : inputType
|
|
83
|
+
);
|
|
81
84
|
let value;
|
|
82
85
|
if (inputType === 'file' && input.files && input.files.length) {
|
|
83
86
|
let reader = new FileReader();
|
|
@@ -198,21 +201,10 @@ class CollectionAdderForm extends SocketConsumer {
|
|
|
198
201
|
let collectionType = this.getAttribute('collection-type');
|
|
199
202
|
|
|
200
203
|
let {
|
|
201
|
-
fieldTypes: modelFieldTypes,
|
|
202
204
|
fieldValues: modelFieldValues
|
|
203
205
|
} = convertStringToFieldParams(this.getAttribute('model-values'));
|
|
204
206
|
|
|
205
|
-
this.modelFieldValues =
|
|
206
|
-
Object.entries(modelFieldValues).map(([key, value]) => {
|
|
207
|
-
if (modelFieldTypes[key] === 'boolean') {
|
|
208
|
-
return [ key, value !== 'false' && value !== '' ];
|
|
209
|
-
}
|
|
210
|
-
if (modelFieldTypes[key] === 'number') {
|
|
211
|
-
return [ key, Number(value) ];
|
|
212
|
-
}
|
|
213
|
-
return [ key, value ];
|
|
214
|
-
})
|
|
215
|
-
);
|
|
207
|
+
this.modelFieldValues = modelFieldValues;
|
|
216
208
|
|
|
217
209
|
if (this.collection) this.collection.destroy();
|
|
218
210
|
|
package/collection-adder.js
CHANGED
|
@@ -184,7 +184,6 @@ class CollectionAdder extends SocketConsumer {
|
|
|
184
184
|
|
|
185
185
|
let {
|
|
186
186
|
fieldNames: modelFieldNames,
|
|
187
|
-
fieldTypes: modelFieldTypes,
|
|
188
187
|
fieldValues: modelFieldValues
|
|
189
188
|
} = convertStringToFieldParams(this.getAttribute('model-values'));
|
|
190
189
|
|
|
@@ -205,17 +204,7 @@ class CollectionAdder extends SocketConsumer {
|
|
|
205
204
|
autocorrect ? ` autocorrect="${autocorrect}"` : ''
|
|
206
205
|
}`;
|
|
207
206
|
|
|
208
|
-
this.modelFieldValues =
|
|
209
|
-
Object.entries(modelFieldValues).map(([key, value]) => {
|
|
210
|
-
if (modelFieldTypes[key] === 'boolean') {
|
|
211
|
-
return [ key, value !== 'false' && value !== '' ];
|
|
212
|
-
}
|
|
213
|
-
if (modelFieldTypes[key] === 'number') {
|
|
214
|
-
return [ key, Number(value) ];
|
|
215
|
-
}
|
|
216
|
-
return [ key, value ];
|
|
217
|
-
})
|
|
218
|
-
);
|
|
207
|
+
this.modelFieldValues = modelFieldValues;
|
|
219
208
|
|
|
220
209
|
if (this.collection) this.collection.destroy();
|
|
221
210
|
|