@ansible/ansible-ui-framework 0.0.391 → 0.0.392
Sign up to get free protection for your applications and to get access to all the features.
@@ -34,8 +34,9 @@ var react_1 = require("react");
|
|
34
34
|
var PageFormGroup_1 = require("./PageFormGroup");
|
35
35
|
/** A PatternFly FormGroup with a PatternFly Select */
|
36
36
|
function FormGroupSelect(props) {
|
37
|
+
var _a;
|
37
38
|
var children = props.children, helperTextInvalid = props.helperTextInvalid, isReadOnly = props.isReadOnly, onSelect = props.onSelect, value = props.value;
|
38
|
-
var
|
39
|
+
var _b = __read((0, react_1.useState)(false), 2), open = _b[0], setOpen = _b[1];
|
39
40
|
var onToggle = (0, react_1.useCallback)(function () { return setOpen(function (open) { return !open; }); }, []);
|
40
41
|
var onSelectHandler = (0, react_1.useCallback)(function (event, value) {
|
41
42
|
if (typeof value === 'string')
|
@@ -44,6 +45,6 @@ function FormGroupSelect(props) {
|
|
44
45
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, value.toString());
|
45
46
|
setOpen(false);
|
46
47
|
}, [onSelect]);
|
47
|
-
return ((0, jsx_runtime_1.jsx)(PageFormGroup_1.PageFormGroup, __assign({}, props, { children: (0, jsx_runtime_1.jsx)(react_core_1.Select, __assign({}, props, { label: undefined, variant: react_core_1.SelectVariant.single, "aria-describedby": props.id ? "".concat(props.id, "-form-group") : undefined, selections: value, onSelect: onSelectHandler, isOpen: open, onToggle: onToggle, maxHeight: 280, validated: helperTextInvalid ? 'error' : undefined, isDisabled: props.isDisabled || isReadOnly }, { children: children })) })));
|
48
|
+
return ((0, jsx_runtime_1.jsx)(PageFormGroup_1.PageFormGroup, __assign({}, props, { children: (0, jsx_runtime_1.jsx)(react_core_1.Select, __assign({}, props, { label: undefined, variant: react_core_1.SelectVariant.single, "aria-describedby": props.id ? "".concat(props.id, "-form-group") : undefined, selections: value, onSelect: onSelectHandler, isOpen: open, onToggle: onToggle, maxHeight: 280, validated: helperTextInvalid ? 'error' : undefined, isDisabled: props.isDisabled || isReadOnly, placeholderText: (_a = props.placeholder) !== null && _a !== void 0 ? _a : '' }, { children: children })) })));
|
48
49
|
}
|
49
50
|
exports.FormGroupSelect = FormGroupSelect;
|
@@ -43,7 +43,7 @@ function PageFormSchema(props) {
|
|
43
43
|
case 'select':
|
44
44
|
{
|
45
45
|
if (!prop.placeholder) {
|
46
|
-
prop.placeholder = "
|
46
|
+
prop.placeholder = "Select ".concat(((_b = property.title) !== null && _b !== void 0 ? _b : propertyName).toLowerCase());
|
47
47
|
}
|
48
48
|
if (!prop.enum) {
|
49
49
|
prop.enum = (_c = prop.options) === null || _c === void 0 ? void 0 : _c.map(function (option) { return option.value; });
|