UNPKG

@vlsergey/react-bootstrap-pagetable

Version:

Complex solution to work with pageable data, including sorting, filtering, actions, changing displayed columns, etc.

24 lines (23 loc) 1.14 kB
import { __assign, __rest } from "tslib"; /** @jsx jsx */ import { css, jsx } from '@emotion/react'; import React, { useMemo } from 'react'; import ItemFieldValue from '../ItemFieldValue'; import { useControlledContext } from './ControlledContext'; function DefaultItemFieldCellRenderer(_a) { var field = _a.field, item = _a.item, etc = __rest(_a, ["field", "item"]); var _b = useControlledContext(), itemModel = _b.itemModel, itemFieldCellHyperlink = _b.itemFieldCellHyperlink, itemFieldCellLinkWrapper = _b.itemFieldCellLinkWrapper; var hyperlink = useMemo(function () { return itemFieldCellHyperlink(item, field); }, [itemFieldCellHyperlink, item, field]); var children = jsx(ItemFieldValue, { field: field, item: item, itemModel: itemModel }); if (hyperlink) { children = React.createElement(itemFieldCellLinkWrapper, { field: field, hyperlink: hyperlink, item: item }, children); } return jsx("td", __assign({ css: css('height: inherit;') }, etc), children); } export default React.memo(DefaultItemFieldCellRenderer);