@appbuckets/react-ui
Version:
Just Another React UI Framework
50 lines (47 loc) • 1.33 kB
JavaScript
import EmptyContent from '../../EmptyContent/EmptyContent.js';
import { useRxTable } from '../RxTable.context.js';
/* --------
* Component Definition
* -------- */
var RxTableEmptyContent = function (props) {
var hasData = props.hasData;
// ----
// Get extra props
// ----
var _a = useRxTable(),
noDataEmptyContentProps = _a.noDataEmptyContentProps,
noFilteredDataEmptyContentProps = _a.noFilteredDataEmptyContentProps;
// ----
// Render an Empty Content if no data exists
// ----
if (!hasData) {
return EmptyContent.create(
noDataEmptyContentProps !== null && noDataEmptyContentProps !== void 0
? noDataEmptyContentProps
: {
header: 'No Data',
content: 'No data to show',
},
{
autoGenerateKey: false,
}
);
}
// ----
// Render component if no filtered data exists
// ----
return EmptyContent.create(
noFilteredDataEmptyContentProps !== null &&
noFilteredDataEmptyContentProps !== void 0
? noFilteredDataEmptyContentProps
: {
header: 'No Data to Show',
content: 'No data to show for current filters',
},
{
autoGenerateKey: false,
}
);
};
RxTableEmptyContent.displayName = 'RxTableEmptyContent';
export { RxTableEmptyContent as default };