componenteshospitais 1.4.1 → 1.4.2
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/dist/cjs/index.js
CHANGED
|
@@ -1467,11 +1467,20 @@ var styles$1 = {"selectPadrao":"select-module_selectPadrao__poGiL"};
|
|
|
1467
1467
|
styleInject(css_248z$1);
|
|
1468
1468
|
|
|
1469
1469
|
var SelectField = function (_a) {
|
|
1470
|
-
var id = _a.id, name = _a.name, options = _a.options, value = _a.value, onChange = _a.onChange, label = _a.label, optionDefault = _a.optionDefault, largura = _a.largura, disabled = _a.disabled;
|
|
1470
|
+
var id = _a.id, name = _a.name, options = _a.options, value = _a.value, onChange = _a.onChange, label = _a.label, optionDefault = _a.optionDefault, largura = _a.largura, disabled = _a.disabled, multiple = _a.multiple;
|
|
1471
|
+
var handleSelectChange = function (e) {
|
|
1472
|
+
if (multiple) {
|
|
1473
|
+
var selectedOptions = Array.from(e.target.selectedOptions, function (option) { return option.value; });
|
|
1474
|
+
onChange(selectedOptions);
|
|
1475
|
+
}
|
|
1476
|
+
else {
|
|
1477
|
+
onChange(e.target.value);
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1471
1480
|
return (React$2.createElement(React$2.Fragment, null,
|
|
1472
1481
|
label && React$2.createElement("label", { htmlFor: id }, label),
|
|
1473
|
-
React$2.createElement("select", { id: id, name: name, className: styles$1.selectPadrao, value: value, onChange:
|
|
1474
|
-
optionDefault
|
|
1482
|
+
React$2.createElement("select", { id: id, name: name, className: styles$1.selectPadrao, value: value, onChange: handleSelectChange, style: { width: largura ? "".concat(largura) : '' }, disabled: disabled, multiple: multiple },
|
|
1483
|
+
optionDefault && !multiple && (React$2.createElement("option", { value: "" }, "Selecione...")),
|
|
1475
1484
|
options.map(function (option) { return (React$2.createElement("option", { key: option.value, value: option.value }, option.description)); }))));
|
|
1476
1485
|
};
|
|
1477
1486
|
|