Skip to content

Commit 4487b50

Browse files
match lazy comp's loading skeleton height as per comp's default height
1 parent c42c0e0 commit 4487b50

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

client/packages/lowcoder-design/src/components/Loading.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type LoadingProps = {
7474
size?: number; // circle's size
7575
className?: string;
7676
style?: CSSProperties;
77+
compHeight?: number;
7778
};
7879

7980
export const Loading = (props: LoadingProps) => {
@@ -92,7 +93,11 @@ export const Loading = (props: LoadingProps) => {
9293
<Load2 {...loadingProps} />
9394
</Container>
9495
</ContainerX> */}
95-
<StyledSkeleton active style={{height: '100%', animationDuration: '2s'}} />
96+
<StyledSkeleton
97+
active
98+
paragraph={{rows: props.compHeight ? Math.floor((props.compHeight * 8) / 35) : 4}}
99+
style={{height: '100%', animationDuration: '2s'}}
100+
/>
96101
</LoadingWrapper>
97102
);
98103
};

client/packages/lowcoder/src/comps/comps/gridItemComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const TmpComp = withTypeAndChildren<
5555
undefined,
5656
undefined,
5757
manifest.withoutLoading,
58+
manifest.layoutInfo?.h,
5859
)
5960
}
6061
const comp = manifest.withoutLoading ? manifest.comp : withIsLoading(manifest.comp!);

client/packages/lowcoder/src/comps/comps/lazyLoadComp/lazyLoadComp.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ interface LazyCompViewProps {
4949
loadComp: () => Promise<void>;
5050
loadingElement?: () => React.ReactNode;
5151
errorElement?: (error: any) => React.ReactNode;
52+
height?: number,
5253
}
5354

5455
const LazyCompView = React.memo((props: React.PropsWithChildren<LazyCompViewProps>) => {
@@ -82,7 +83,7 @@ const LazyCompView = React.memo((props: React.PropsWithChildren<LazyCompViewProp
8283
}
8384

8485
return (
85-
<WhiteLoading />
86+
<WhiteLoading compHeight={props.height} />
8687
);
8788
});
8889

@@ -94,6 +95,7 @@ export function lazyLoadComp(
9495
loader?: LazyloadCompLoader,
9596
loadingElement?: () => React.ReactNode,
9697
withoutLoading?: boolean,
98+
height?: number,
9799
) {
98100
class LazyLoadComp extends simpleMultiComp({}) {
99101
compValue: any;
@@ -145,7 +147,12 @@ export function lazyLoadComp(
145147
// const key = `${remoteInfo?.packageName}-${remoteInfo?.packageVersion}-${remoteInfo?.compName}`;
146148
const key = `${compName}`;
147149
return (
148-
<LazyCompView key={key} loadComp={() => this.load()} loadingElement={loadingElement} />
150+
<LazyCompView
151+
key={key}
152+
loadComp={() => this.load()}
153+
loadingElement={loadingElement}
154+
height={height}
155+
/>
149156
);
150157
}
151158

0 commit comments

Comments
 (0)