Debian Codegraph @

node/@patternfly/react-table/dist/esm/components/Table/EditableSelectInputCell.js

raw
1 import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2 import { Fragment } from 'react';
3 import { css } from '@patternfly/react-styles';
4 import { Select, SelectList } from '@patternfly/react-core/dist/esm/components/Select';
5 import { MenuToggle } from '@patternfly/react-core/dist/esm/components/MenuToggle';
6 import inlineStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit.mjs';
7 import formStyles from '@patternfly/react-styles/css/components/Form/form.mjs';
8 export const EditableSelectInputCell = ({ value, rowIndex, cellIndex, onSelect = () => { }, clearSelection, isOpen = false, isPlaceholder = false, onToggle = () => { }, selections = [''], options = [], props }) => {
9 const onSelectHandler = (event, newValue) => {
10 onSelect(event, newValue, rowIndex, cellIndex, isPlaceholder);
11 };
12 const onClear = (event) => {
13 clearSelection(event, rowIndex, cellIndex);
14 };
15 const select = (_jsx(Select, Object.assign({ onSelect: onSelectHandler }, (clearSelection && { onClear }), { isOpen: isOpen, selected: selections, toggle: (toggleRef) => (_jsx(MenuToggle, { ref: toggleRef, onClick: onToggle, isExpanded: isOpen, isPlaceholder: isPlaceholder, children: isOpen ? 'Expanded' : 'Collapsed' })) }, props.editableSelectProps, { children: _jsx(SelectList, { children: options }) })));
16 return (_jsxs(Fragment, { children: [_jsx("div", { className: inlineStyles.inlineEditValue, children: Array.isArray(value) ? value.join(', ') : value }), _jsxs("div", { className: inlineStyles.inlineEditInput, children: [select, _jsx("div", { className: css(formStyles.formHelperText), "aria-live": "polite", children: props.errorText })] })] }));
17 };
18 EditableSelectInputCell.displayName = 'EditableSelectInputCell';
19 //# sourceMappingURL=EditableSelectInputCell.js.map