Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/@buffetjs/core/build/esm/components/TableRow/ drwxr-xr-x | |
| Viewing file: Select action/file-type: /**
*
* TableRow
*
*/
import React from 'react';
import PropTypes from 'prop-types';
import { isFunction, isObject } from 'lodash';
import { Checkbox, Links as StyledLinks } from '@buffetjs/styles';
import Icon from '../Icon';
function TableRow(_ref) {
var headers = _ref.headers,
_onClick = _ref.onClick,
onSelect = _ref.onSelect,
row = _ref.row,
rowLinks = _ref.rowLinks,
withBulkAction = _ref.withBulkAction;
// const displayedCells = headers.map(header => ({ key: header.value, );
return /*#__PURE__*/React.createElement("tr", {
onClick: function onClick(e) {
e.preventDefault();
e.stopPropagation();
_onClick(e, row);
}
}, withBulkAction && /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(Checkbox, {
onClick: function onClick(e) {
e.stopPropagation();
},
onChange: onSelect,
checked: row._isChecked
})), headers.map(function (_ref2) {
var cellName = _ref2.value,
cellFormatter = _ref2.cellFormatter,
cellAdapter = _ref2.cellAdapter;
var displayedValue = !isObject(row[cellName]) ? row[cellName] : '-';
if (isFunction(cellFormatter)) {
displayedValue = cellFormatter(row[cellName], row);
}
var displayedContent = /*#__PURE__*/React.createElement("p", null, displayedValue || '-');
if (isFunction(cellAdapter)) {
displayedContent = cellAdapter(row);
}
return /*#__PURE__*/React.createElement("td", {
key: cellName,
className: "".concat(cellName, "-cell")
}, displayedContent);
}), rowLinks.length > 0 && /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", {
style: {
width: 'fit-content',
"float": 'right'
}
}, /*#__PURE__*/React.createElement(StyledLinks, null, rowLinks.map(function (icon, index) {
return /*#__PURE__*/React.createElement("button", {
// eslint-disable-next-line react/no-array-index-key
key: index + icon,
onClick: function onClick(e) {
e.preventDefault();
e.stopPropagation();
icon.onClick(row);
},
type: "button"
}, /*#__PURE__*/React.createElement(Icon, {
className: "link-icon",
icon: icon.icon
}));
})))));
}
TableRow.defaultProps = {
headers: [],
onClick: function onClick() {},
onSelect: function onSelect() {},
row: {},
rowLinks: [],
withBulkAction: false
};
TableRow.propTypes = {
headers: PropTypes.arrayOf(PropTypes.shape({
isSortEnabled: PropTypes.bool,
name: PropTypes.string,
value: PropTypes.string
})),
onClick: PropTypes.func,
onSelect: PropTypes.func,
// eslint-disable-next-line react/forbid-prop-types
row: PropTypes.object,
rowLinks: PropTypes.arrayOf(PropTypes.shape({
icon: PropTypes.node
})),
withBulkAction: PropTypes.bool
};
export default TableRow; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0041 ]-- |