refactor: 移除 Loading 组件

This commit is contained in:
力皓 2020-12-10 10:36:57 +08:00
parent 3ee5fba476
commit cc33fecf27
4 changed files with 59 additions and 59 deletions

View File

@ -2,7 +2,7 @@ import React, { Component, PureComponent, createElement as reactCreateElement }
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Debug from 'debug'; import Debug from 'debug';
import { ConfigProvider } from '@alifd/next'; import ConfigProvider from '@alifd/next/lib/config-provider';
import { isEmpty } from '@ali/b3-one/lib/obj'; import { isEmpty } from '@ali/b3-one/lib/obj';
import AppContext from './context/appContext'; import AppContext from './context/appContext';
import { isFileSchema, goldlog } from './utils'; import { isFileSchema, goldlog } from './utils';

View File

@ -2,8 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Debug from 'debug'; import Debug from 'debug';
import classnames from 'classnames'; import classnames from 'classnames';
import Loading from '@alifd/next/lib/loading'; // import Loading from '@alifd/next/lib/loading';
import '@alifd/next/lib/loading/style'; // import '@alifd/next/lib/loading/style';
import BaseRenderer from './base'; import BaseRenderer from './base';
import AppContext from '../context/appContext'; import AppContext from '../context/appContext';
import { isSchema, getFileCssName } from '../utils'; import { isSchema, getFileCssName } from '../utils';
@ -114,23 +114,23 @@ export default class BlockRenderer extends BaseRenderer {
</AppContext.Provider> </AppContext.Provider>
); );
if (autoLoading || loading !== undefined) { // if (autoLoading || loading !== undefined) {
return ( // return (
<Loading // <Loading
size="medium" // size="medium"
visible={!!(this.__showPlaceholder || loading)} // visible={!!(this.__showPlaceholder || loading)}
style={{ // style={{
height: this.__showPlaceholder ? defaultHeight : 'auto', // height: this.__showPlaceholder ? defaultHeight : 'auto',
display: 'block', // display: 'block',
...style, // ...style,
}} // }}
className={classnames('luna-block', getFileCssName(__schema.fileName), className, this.props.className)} // className={classnames('luna-block', getFileCssName(__schema.fileName), className, this.props.className)}
id={id} // id={id}
> // >
{!this.__showPlaceholder && renderContent()} // {!this.__showPlaceholder && renderContent()}
</Loading> // </Loading>
); // );
} // }
return ( return (
<div <div

View File

@ -2,8 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Debug from 'debug'; import Debug from 'debug';
import classnames from 'classnames'; import classnames from 'classnames';
import Loading from '@alifd/next/lib/loading'; // import Loading from '@alifd/next/lib/loading';
import '@alifd/next/lib/loading/style'; // import '@alifd/next/lib/loading/style';
import AppContext from '../context/appContext'; import AppContext from '../context/appContext';
import BaseRenderer from './base'; import BaseRenderer from './base';
import { isSchema, getFileCssName } from '../utils'; import { isSchema, getFileCssName } from '../utils';
@ -98,23 +98,23 @@ export default class CompRenderer extends BaseRenderer {
if (noContainer) { if (noContainer) {
return renderContent(); return renderContent();
} }
if (autoLoading || loading !== undefined) { // if (autoLoading || loading !== undefined) {
return ( // return (
<Loading // <Loading
size="medium" // size="medium"
visible={!!(this.__showPlaceholder || loading)} // visible={!!(this.__showPlaceholder || loading)}
style={{ // style={{
height: this.__showPlaceholder ? defaultHeight : 'auto', // height: this.__showPlaceholder ? defaultHeight : 'auto',
display: 'block', // display: 'block',
...style, // ...style,
}} // }}
className={classnames('luna-comp', getFileCssName(__schema.fileName), className, this.props.className)} // className={classnames('luna-comp', getFileCssName(__schema.fileName), className, this.props.className)}
id={this.props.id || id} // id={this.props.id || id}
> // >
{!this.__showPlaceholder && renderContent()} // {!this.__showPlaceholder && renderContent()}
</Loading> // </Loading>
); // );
} // }
return ( return (
<div <div
ref={this.__getRef} ref={this.__getRef}

View File

@ -2,8 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Debug from 'debug'; import Debug from 'debug';
import classnames from 'classnames'; import classnames from 'classnames';
import Loading from '@alifd/next/lib/loading'; // import Loading from '@alifd/next/lib/loading';
import '@alifd/next/lib/loading/style'; // import '@alifd/next/lib/loading/style';
import AppContext from '../context/appContext'; import AppContext from '../context/appContext';
import BaseRenderer from './base'; import BaseRenderer from './base';
import { isSchema, getFileCssName } from '../utils'; import { isSchema, getFileCssName } from '../utils';
@ -126,23 +126,23 @@ export default class PageRenderer extends BaseRenderer {
</AppContext.Provider> </AppContext.Provider>
); );
if (autoLoading || loading !== undefined) { // if (autoLoading || loading !== undefined) {
return ( // return (
<Loading // <Loading
size="medium" // size="medium"
visible={!!(this.__showPlaceholder || loading)} // visible={!!(this.__showPlaceholder || loading)}
style={{ // style={{
height: this.__showPlaceholder ? defaultHeight : 'auto', // height: this.__showPlaceholder ? defaultHeight : 'auto',
display: 'block', // display: 'block',
...style, // ...style,
}} // }}
className={classnames('luna-page', getFileCssName(__schema.fileName), className, this.props.className)} // className={classnames('luna-page', getFileCssName(__schema.fileName), className, this.props.className)}
id={id} // id={id}
> // >
{!this.__showPlaceholder && renderContent()} // {!this.__showPlaceholder && renderContent()}
</Loading> // </Loading>
); // );
} // }
return ( return (
<div <div