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/plugins/content-export-import/admin/src/components/MappingTable/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import React, { memo } from "react";
import PropTypes from "prop-types";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faTrashAlt } from "@fortawesome/free-solid-svg-icons/faTrashAlt";
import MediaPreview from "../MediaPreview";
import { isUrlMedia } from "../../utils/mediaFormat";
function TableBody({ rows, headers, onDeleteItem, onlyFistRow }) {
return (
<tbody className={onlyFistRow ? "fist-row-selected" : ""}>
{rows.map((row, i) => (
<tr key={i}>
{headers.map(({ name }, j) => {
const cell = row[name];
if (cell === undefined || cell === null) return <td key={j}>-</td>;
if (Array.isArray(cell)) {
return (
<td key={j} title={JSON.stringify(cell, null, 2)}>
{cell.map((cellItem, k) => {
if (typeof cellItem === "object")
return (
<div key={k} className="m-2">{`${JSON.stringify(
cellItem
)}`}</div>
);
if (typeof cellItem === "string" && isUrlMedia(cellItem))
return (
<div key={k} className="border p-1 m-2">
<MediaPreview url={cellItem} height={25} />
</div>
);
return <div key={k} className="m-2">{`${cellItem}`}</div>;
})}
</td>
);
}
if (typeof cell === "object")
return (
<td key={j} title={JSON.stringify(cell, null, 2)}>
{JSON.stringify(cell)}
</td>
);
if (typeof cell === "string" && isUrlMedia(cell))
return (
<td key={j} title={cell}>
<div className="media justify-content-center">
<div className="border p-1">
<MediaPreview url={cell} height={25} />
</div>
</div>
</td>
);
return <td key={j} title={`${cell}`}>{`${cell}`}</td>;
})}
<td>
<button onClick={onDeleteItem(row)}>
<FontAwesomeIcon icon={faTrashAlt} />
</button>
</td>
</tr>
))}
</tbody>
);
}
TableBody.defaultProps = {
rows: [],
headers: [],
onDeleteItem: () => {},
onlyFistRow: false,
};
TableBody.propTypes = {
rows: PropTypes.array,
headers: PropTypes.array,
onDeleteItem: PropTypes.func,
onlyFistRow: PropTypes.bool,
};
export default memo(TableBody);
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0049 ]-- |