@appbuckets/react-ui
Version:
Just Another React UI Framework
52 lines (48 loc) • 1.36 kB
JavaScript
;
var EmptyContent = require('../../EmptyContent/EmptyContent.js');
var RxTable_context = require('../RxTable.context.js');
/* --------
* Component Definition
* -------- */
var RxTableEmptyContent = function (props) {
var hasData = props.hasData;
// ----
// Get extra props
// ----
var _a = RxTable_context.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';
module.exports = RxTableEmptyContent;