saasufy-components 3.37.0 → 3.39.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 +8 -0
- package/model-input.js +4 -4
- package/package.json +1 -1
- package/styles.css +6 -4
package/README.md
CHANGED
|
@@ -217,6 +217,7 @@ So for example, if your `index.html` file is served up from the URL `http://mywe
|
|
|
217
217
|
- `default-page`: The path/route of the default page to send the user to in case no routes are matched. Commonly used to point to a `/page-not-found` page. For the home page, it's typically recommended to create a page template with `route-path=""` instead.
|
|
218
218
|
- `debounce-delay`: The number of milliseconds to wait before changing the route. This can help to avoid multiple renders if the route changes rapidly (e.g. when doing hard redirects). Defaults to 100ms.
|
|
219
219
|
- `target-page`: A convenience attribute which can be used to programmatically change the `location.hash` in the address bar.
|
|
220
|
+
- `force-render-paths`: An optional list of comma-separated paths to force a page render/re-render, regardless of whether or not the page has changed.
|
|
220
221
|
|
|
221
222
|
**Attributes of slotted page templates**
|
|
222
223
|
|
package/app-router.js
CHANGED
|
@@ -58,6 +58,7 @@ export class AppRouter extends SocketConsumer {
|
|
|
58
58
|
return [
|
|
59
59
|
'target-page',
|
|
60
60
|
'default-page',
|
|
61
|
+
'force-render-paths',
|
|
61
62
|
'debounce-delay',
|
|
62
63
|
'max-redirects'
|
|
63
64
|
];
|
|
@@ -141,9 +142,16 @@ export class AppRouter extends SocketConsumer {
|
|
|
141
142
|
let routerViewport = this.shadowRoot.querySelector('slot[name="viewport"]').assignedNodes()[0];
|
|
142
143
|
if (!routerViewport) return;
|
|
143
144
|
|
|
145
|
+
let forceRenderPathsString = this.getAttribute('force-render-paths');
|
|
146
|
+
let forceRenderPaths = forceRenderPathsString == null ?
|
|
147
|
+
[] : forceRenderPathsString.split(',').map(path => path.trim());
|
|
148
|
+
|
|
144
149
|
let routeArgs;
|
|
145
150
|
let pagePath = location.hash.replace(this.hashStartRegex, '');
|
|
146
151
|
let { pageTemplate, route, regExp, params } = this.getMatchingPage(pagePath, 'path', true);
|
|
152
|
+
if (forceRenderPaths.includes(pagePath)) {
|
|
153
|
+
this.lastPageState = null;
|
|
154
|
+
}
|
|
147
155
|
|
|
148
156
|
if (!pageTemplate) {
|
|
149
157
|
let defaultPage = this.getAttribute('default-page');
|
package/model-input.js
CHANGED
|
@@ -332,7 +332,6 @@ class ModelInput extends SocketConsumer {
|
|
|
332
332
|
inputElement.classList.remove(successStyleClass);
|
|
333
333
|
debounce(async () => {
|
|
334
334
|
if (event.target.value === String(model.value[fieldName] || '')) return;
|
|
335
|
-
|
|
336
335
|
let providerTemplate = this.getAttribute('provider-template');
|
|
337
336
|
try {
|
|
338
337
|
if (inputElement.type === 'checkbox') {
|
|
@@ -347,6 +346,7 @@ class ModelInput extends SocketConsumer {
|
|
|
347
346
|
let inputValue;
|
|
348
347
|
if (inputElement.type === 'file') {
|
|
349
348
|
if (inputElement.files && inputElement.files.length) {
|
|
349
|
+
inputElement.focus();
|
|
350
350
|
let reader = new FileReader();
|
|
351
351
|
let readerLoadPromise = new Promise((resolve, reject) => {
|
|
352
352
|
reader.addEventListener('load', () => {
|
|
@@ -386,19 +386,19 @@ class ModelInput extends SocketConsumer {
|
|
|
386
386
|
inputElement.addEventListener('change', onInputChange);
|
|
387
387
|
|
|
388
388
|
let onInputKeyUp;
|
|
389
|
-
|
|
389
|
+
let inputType = inputElement.type;
|
|
390
|
+
if (inputType !== 'checkbox' && inputType !== 'select' && inputType !== 'file') {
|
|
390
391
|
onInputKeyUp = async (event) => {
|
|
391
392
|
inputElement.classList.remove(successStyleClass);
|
|
392
393
|
debounce(async () => {
|
|
393
394
|
if (event.target.value === String(model.value[fieldName] || '')) return;
|
|
394
|
-
|
|
395
395
|
let providerTemplate = this.getAttribute('provider-template');
|
|
396
396
|
try {
|
|
397
397
|
if (event.target.value === '') {
|
|
398
398
|
await model.delete(fieldName);
|
|
399
399
|
updateConsumerElements(consumers, '', providerTemplate, this.getAttribute('name'));
|
|
400
400
|
} else {
|
|
401
|
-
let targetValue =
|
|
401
|
+
let targetValue = inputType === 'number' ?
|
|
402
402
|
Number(event.target.value) : event.target.value;
|
|
403
403
|
updateConsumerElements(consumers, targetValue, providerTemplate, this.getAttribute('name'));
|
|
404
404
|
await model.update(fieldName, targetValue);
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -33,22 +33,24 @@ input[type=file] {
|
|
|
33
33
|
padding: 10px;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
input[type=text]:focus,input[type=password]:focus,input[type=number]:focus,select:focus,textarea:focus {
|
|
36
|
+
input[type=text]:focus,input[type=password]:focus,input[type=number]:focus,input[type=file]:focus,select:focus,textarea:focus {
|
|
37
37
|
border-color: #00a5e5;
|
|
38
38
|
outline-color: #00a5e5;
|
|
39
|
+
outline-width: 1px;
|
|
40
|
+
outline-style: solid;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
input[type=text].error,input[type=password].error,input[type=number].error,select.error,textarea.error {
|
|
43
|
+
input[type=text].error,input[type=password].error,input[type=number].error,input[type=file].error,select.error,textarea.error {
|
|
42
44
|
border-color: #ff0000;
|
|
43
45
|
outline-color: #ff0000;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
input[type=text].warning,input[type=password].warning,input[type=number].warning,select.warning,textarea.warning {
|
|
48
|
+
input[type=text].warning,input[type=password].warning,input[type=number].warning,input[type=file].warning,select.warning,textarea.warning {
|
|
47
49
|
border-color: #ee9900;
|
|
48
50
|
outline-color: #ee9900;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
input[type=text].success:focus,input[type=password].success:focus,input[type=number].success:focus,select.success:focus,textarea.success:focus {
|
|
53
|
+
input[type=text].success:focus,input[type=password].success:focus,input[type=number].success:focus,input[type=file].success:focus,select.success:focus,textarea.success:focus {
|
|
52
54
|
border-color: #009900;
|
|
53
55
|
outline-color: #009900;
|
|
54
56
|
}
|