import React from 'react'; import type { TableLocaleType } from './types'; interface LoaderProps extends React.HTMLAttributes { locale?: TableLocaleType; loadAnimation?: boolean; loading?: boolean; addPrefix: (...classes: any) => string; renderLoading?: (loading: React.ReactNode) => any; } const Loader = React.forwardRef((props: LoaderProps, ref: React.Ref) => { const { loadAnimation, loading, locale, addPrefix, renderLoading } = props; const loadingElement = (
{locale?.loading}
); // Custom render a loader if (typeof renderLoading === 'function') { return loading ? renderLoading(loadingElement) : null; } // If loadAnimation is true , it returns the DOM element, // and controls whether the loader is displayed through CSS to achieve animation effect. return loading || loadAnimation ? loadingElement : null; }); Loader.displayName = 'Table.Loader'; export default Loader;