Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:Spinner组件delay属性不生效 Closes #9093 #9302

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/amis-ui/scss/components/_spinner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
opacity: 1;
}

&.ing {
opacity: 0;
}

.#{$ns}Spinner-icon {
width: var(--Spinner-width);
height: var(--Spinner-height);
Expand Down
9 changes: 7 additions & 2 deletions packages/amis-ui/src/components/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const fadeStyles: {
[propName: string]: string;
} = {
[ENTERED]: 'in',
[ENTERING]: 'in'
[ENTERING]: 'ing'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改了样式类名之后需要更新一下快照文件,具体更新的范围可以看CI里失败的单测

};

// Spinner Props
Expand Down Expand Up @@ -199,7 +199,11 @@ export class Spinner extends React.Component<
// 定义了挂载位置时只能使用默认icon
const icon = loadingConfig?.root ? undefined : iconConfig;
const isCustomIcon = icon && React.isValidElement(icon);
const timeout = {enter: delay, exit: 0};
const timeout = {
appear: delay,
enter: delay,
exit: 0
};

const showOverlay = loadingConfig?.root || overlay;

Expand All @@ -213,6 +217,7 @@ export class Spinner extends React.Component<
unmountOnExit
in={this.state.spinning}
timeout={timeout}
appear={this.state.spinning}
>
{(status: string) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ exports[`EventAction:drawer 1`] = `
class="cxd-Drawer-body"
>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -344,10 +344,10 @@ exports[`EventAction:drawer args 1`] = `
class="cxd-Drawer-body"
>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -530,32 +530,4 @@ exports[`EventAction:drawer args 6`] = `
</div>
`;

exports[`EventAction:drawer args 7`] = `
<div>
<div
class="cxd-Page"
>
<div
class="cxd-Page-content"
>
<div
class="cxd-Page-main"
>
<div
class="cxd-Page-body"
role="page-body"
>
<button
class="cxd-Button cxd-Button--default cxd-Button--size-default"
type="button"
>
<span>
打开抽屉
</span>
</button>
</div>
</div>
</div>
</div>
</div>
`;
exports[`EventAction:drawer args 7`] = `<div />`;
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ exports[`doAction:crud reload 1`] = `
</table>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -555,10 +555,10 @@ exports[`doAction:crud reload with data1 1`] = `
</table>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -862,10 +862,10 @@ exports[`doAction:crud reload with data2 1`] = `
</table>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ exports[`doAction:page reload 2`] = `
role="page-body"
>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -327,10 +327,10 @@ exports[`doAction:page reload with data 2`] = `
role="page-body"
>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ exports[`doAction:service reload 2`] = `
</div>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -624,10 +624,10 @@ exports[`doAction:service reload with data 2`] = `
</div>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -843,10 +843,10 @@ exports[`doAction:service(schemaApi) reload 2`] = `
</div>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -1062,10 +1062,10 @@ exports[`doAction:service(schemaApi) reload with data 2`] = `
</div>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -1281,10 +1281,10 @@ exports[`doAction:service(schemaApi+data) reload with data 2`] = `
</div>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,10 @@ exports[`doAction:form reset 1`] = `
type="submit"
/>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ exports[`Renderer:chained-select 1`] = `
</span>
</div>
<div
class="cxd-Spinner in cxd-ChainedSelectControl-spinner"
class="cxd-Spinner ing cxd-ChainedSelectControl-spinner"
data-testid="spinner"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,10 @@ exports[`Renderer:Nav with itemActions 1`] = `
/>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,10 @@ exports[`Renderer:Page handleAction actionType=drawer default 1`] = `
class="cxd-Drawer-body"
>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down Expand Up @@ -1834,10 +1834,10 @@ exports[`Renderer:Page initApi show loading 1`] = `
role="page-body"
>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2294,10 +2294,10 @@ exports[`Renderer:Wizard initApi show loading 1`] = `
/>
</div>
<div
class="cxd-Spinner-overlay in"
class="cxd-Spinner-overlay ing"
/>
<div
class="cxd-Spinner cxd-Spinner--overlay in"
class="cxd-Spinner cxd-Spinner--overlay ing"
data-testid="spinner"
>
<div
Expand Down
Loading