Skip to content

Commit

Permalink
Refactor on VirtualScroller. Related - #4226
Browse files Browse the repository at this point in the history
  • Loading branch information
ulasturann committed Apr 17, 2023
1 parent f4164ba commit c034168
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions components/lib/virtualscroller/VirtualScroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,15 +584,15 @@ export const VirtualScroller = React.memo(

const createLoader = () => {
const iconClassName = 'p-virtualscroller-loading-icon';
const icon = props.loaderIcon || <SpinnerIcon className={iconClassName} spin />;
const icon = props.loadingIcon || <SpinnerIcon className={iconClassName} spin />;
const loadingIcon = IconUtils.getJSXIcon(icon, { className: iconClassName }, { props });

if (!props.loaderDisabled && props.showLoader && loadingState) {
const className = classNames('p-virtualscroller-loader', {
'p-component-overlay': !props.loadingTemplate
});

let content = <i> {loadingIcon} </i>;
let content = loadingIcon;

if (props.loadingTemplate) {
content = loaderArrState.map((_, index) => {
Expand Down
9 changes: 5 additions & 4 deletions components/lib/virtualscroller/virtualscroller.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ interface VirtualScrollerContentTemplateOptions {
* Template of loading item.
*/
loadingTemplate: React.ReactNode | ((options: VirtualScrollerLoadingTemplateOptions) => React.ReactNode);
/**
* Icon of the loading icon.
*/
loadingIcon: IconType<VirtualScrollerProps> | number[];
/**
* The height/width of item according to orientation.
*/
Expand Down Expand Up @@ -362,12 +358,17 @@ export interface VirtualScrollerProps {
* @defaultValue false
*/
showLoader?: boolean | undefined;
/**
* The icon to show while indicating data load is in progress.
*/
loadingIcon?: IconType<VirtualScrollerProps> | undefined;
/**
* The template of loader.
*/
loadingTemplate?: React.ReactNode | ((options: VirtualScrollerLoadingTemplateOptions) => React.ReactNode);
/**
* The template of loader's icon.
* @deprecated Since v9.2.3, use `loadingIcon` instead.
*/
loaderIconTemplate?: React.ReactNode | ((options: VirtualScrollerLoaderIconTemplateOptions) => React.ReactNode);
/**
Expand Down

0 comments on commit c034168

Please sign in to comment.