saasufy-components 10.1.0 → 10.1.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 -1
- package/collection-adder-form.js +2 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -511,7 +511,7 @@ This component is similar to the `collection-adder` component except that it req
|
|
|
511
511
|
**Attributes of slotted input, select, textarea... elements**
|
|
512
512
|
|
|
513
513
|
- `name` (required): This must correspond to a field name on the model specified via the `collection-type` attribute of the `collection-adder-form`.
|
|
514
|
-
- `output-type`: An optional type to cast the value of the input element into when the form is submitted.
|
|
514
|
+
- `output-type`: An optional type to cast the value of the input element into when the form is submitted; supported types are `string` (default), `number` and `boolean`. This is especially useful for `select` elements as their values are always strings by default; for example `<select name="duration" output-type="number">` will submit the number `30` instead of the string `'30'`. If not specified, the value is cast based on the element's own type.
|
|
515
515
|
|
|
516
516
|
### collection-deleter
|
|
517
517
|
|
package/collection-adder-form.js
CHANGED
|
@@ -92,10 +92,8 @@ class CollectionAdderForm extends SocketConsumer {
|
|
|
92
92
|
} else {
|
|
93
93
|
inputType = input.type;
|
|
94
94
|
}
|
|
95
|
-
let
|
|
96
|
-
|
|
97
|
-
input.getAttribute('output-type') : inputType
|
|
98
|
-
);
|
|
95
|
+
let outputType = input.getAttribute('output-type');
|
|
96
|
+
let Type = getTypeCastFunction(outputType || inputType);
|
|
99
97
|
let value;
|
|
100
98
|
if (inputType === 'file' && input.files && input.files.length) {
|
|
101
99
|
let reader = new FileReader();
|