saasufy-components 3.17.0 → 3.18.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 +3 -1
- package/input-provider.js +15 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -443,7 +443,6 @@ Used for displaying and editing a single field of a model instance in real time.
|
|
|
443
443
|
- `model-id` (required): The id of the model instance/record to bind to.
|
|
444
444
|
- `model-field` (required): The field of the model instance/record to bind to for reading and updating.
|
|
445
445
|
- `debounce-delay`: The delay in milliseconds to wait before sending an update to the server. This is useful to batch multiple updates together (as is common when user is typing). Default is 300ms.
|
|
446
|
-
- `input-id`: Can be used to set an `id` attribute on the inner `input` element.
|
|
447
446
|
- `list`: If specified, this sets the list attribute of the inner `input` element to provide input suggestions (only works with standard input elements).
|
|
448
447
|
- `type`: The type of the input component; can be `text`, `number`, `select`, `textarea`, `checkbox` or `file`.
|
|
449
448
|
- `placeholder`: Can be used to set the placeholder text on the inner input element.
|
|
@@ -460,6 +459,8 @@ Used for displaying and editing a single field of a model instance in real time.
|
|
|
460
459
|
- `autocorrect`: Can be `on` or `off` - It will set the auto-correct attribute on the inner input element. This is useful for mobile devices to enable or disable auto-correct.
|
|
461
460
|
- `enable-rebound`: By default, for efficiency reasons, real-time updates performed via `model-input` components are not sent back to the publishing client; it is usually unnecessary because state changes are shared locally between all components which are bound to the same `socket-provider`. You can add the `enable-rebound` attribute to the `model-input` component to force real-time updates to rebound back to the publisher to support more advanced scenarios. Note that enabling rebound comes with additional performance overheads.
|
|
462
461
|
- `accept`: This attribute should only be used if the `type` is set to `file`; it serves to constrain the types of files which can be selected by the user.
|
|
462
|
+
- `input-id`: Can be used to set an `id` attribute on the inner `input` element.
|
|
463
|
+
- `input-props`: Can be used to set additional attributes on the inner `input` element. Must be in the format `attr1=value1,attr2=value2`.
|
|
463
464
|
|
|
464
465
|
### model-text
|
|
465
466
|
|
|
@@ -565,6 +566,7 @@ This component can be configured to provide its data to multiple components (con
|
|
|
565
566
|
- `computable-value`: If this attribute is present, it will be possible to execute expressions using the `{{expression}}` syntax inside the `value` attribute.
|
|
566
567
|
- `autocapitalize`: Can be `on` or `off` - It will set the auto-capitalize attribute on the inner input element. This is useful for mobile devices to enable or disable auto-capitalization of the first character which is typed into the input element.
|
|
567
568
|
- `autocorrect`: Can be `on` or `off` - It will set the auto-correct attribute on the inner input element. This is useful for mobile devices to enable or disable auto-correct.
|
|
569
|
+
- `input-props`: Can be used to set additional attributes on the inner `input` element. Must be in the format `attr1=value1,attr2=value2`.
|
|
568
570
|
|
|
569
571
|
### input-combiner
|
|
570
572
|
|
package/input-provider.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
debouncer,
|
|
3
3
|
renderTemplate,
|
|
4
|
-
updateConsumerElements
|
|
4
|
+
updateConsumerElements,
|
|
5
|
+
convertStringToFieldParams
|
|
5
6
|
} from './utils.js';
|
|
6
7
|
|
|
7
8
|
const DEFAULT_DEBOUNCE_DELAY = 800;
|
|
@@ -24,7 +25,6 @@ class InputProvider extends HTMLElement {
|
|
|
24
25
|
|
|
25
26
|
static get observedAttributes() {
|
|
26
27
|
return [
|
|
27
|
-
'input-id',
|
|
28
28
|
'list',
|
|
29
29
|
'type',
|
|
30
30
|
'placeholder',
|
|
@@ -34,7 +34,9 @@ class InputProvider extends HTMLElement {
|
|
|
34
34
|
'value',
|
|
35
35
|
'height',
|
|
36
36
|
'autocapitalize',
|
|
37
|
-
'autocorrect'
|
|
37
|
+
'autocorrect',
|
|
38
|
+
'input-id',
|
|
39
|
+
'input-props'
|
|
38
40
|
];
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -99,6 +101,7 @@ class InputProvider extends HTMLElement {
|
|
|
99
101
|
let options = this.getAttribute('options');
|
|
100
102
|
let height = this.getAttribute('height');
|
|
101
103
|
let value = this.getAttribute('value') || '';
|
|
104
|
+
let inputProps = this.getAttribute('input-props');
|
|
102
105
|
|
|
103
106
|
let elementType;
|
|
104
107
|
if (type === 'select') {
|
|
@@ -140,6 +143,15 @@ class InputProvider extends HTMLElement {
|
|
|
140
143
|
if (placeholder) {
|
|
141
144
|
this.inputElement.setAttribute('placeholder', placeholder);
|
|
142
145
|
}
|
|
146
|
+
if (inputProps) {
|
|
147
|
+
let {
|
|
148
|
+
fieldNames: attrNames,
|
|
149
|
+
fieldValues: attrValues
|
|
150
|
+
} = convertStringToFieldParams(inputProps);
|
|
151
|
+
for (let attr of attrNames) {
|
|
152
|
+
this.inputElement.setAttribute(attr, attrValues[attr]);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
143
155
|
|
|
144
156
|
this.appendChild(this.inputElement);
|
|
145
157
|
|