UNPKG

@grafana/ui

Version:
52 lines (45 loc) 1.67 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var jsxRuntime = require('react/jsx-runtime'); var css = require('@emotion/css'); var memoize = require('micro-memoize'); var styles = require('../styles.cjs'); var utils = require('../utils.cjs'); function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; } var memoize__default = /*#__PURE__*/_interopDefaultCompat(memoize); "use strict"; const DataLinksCell = ({ field, rowIdx }) => { const links = utils.getCellLinks(field, rowIdx); if (!(links == null ? void 0 : links.length)) { return null; } return links.map((link, idx) => /* @__PURE__ */ jsxRuntime.jsx("a", { onClick: link.onClick, href: link.href, target: link.target, children: link.title }, idx)); }; const getStyles = memoize__default.default( (theme, { textWrap, textAlign }) => css.css({ ...textWrap && { flexDirection: "column", justifyContent: "center", alignItems: `${utils.getJustifyContent(textAlign)} !important` // we can't guarantee order, and alignItems is set on a sibling class. }, "> a": { flexWrap: "nowrap", ...!textWrap && { paddingInline: theme.spacing(0.5), borderRight: `2px solid ${theme.colors.border.medium}`, "&:first-child": { paddingInlineStart: 0 }, "&:last-child": { paddingInlineEnd: 0, borderRight: "none" } } } }), { isMatchingKey: styles.isTableCellStylesKeyEqual } ); exports.DataLinksCell = DataLinksCell; exports.getStyles = getStyles; //# sourceMappingURL=DataLinksCell.cjs.map