|
|
@@ -7,6 +7,13 @@ import EmptyContent from '../common/emptyContent/index'
|
|
|
import DataPreview from '../common/dataPreview/dataPreview'
|
|
|
import ViewLayoutItem from './viewLayoutItem';
|
|
|
|
|
|
+const isMobile = function() {
|
|
|
+ if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)))
|
|
|
+ return true;
|
|
|
+ else
|
|
|
+ return false;
|
|
|
+};
|
|
|
+const esMobile = isMobile();
|
|
|
class ViewLayout extends React.PureComponent {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
@@ -37,10 +44,10 @@ class ViewLayout extends React.PureComponent {
|
|
|
|
|
|
createElement = (item, isPreview, reload) => {
|
|
|
const { code, layout } = item;
|
|
|
-
|
|
|
- return <div key={code} data-grid={layout} style={{ height: '100%' }}>
|
|
|
+ return <div key={code} data-grid={esMobile ? { x:0, y:50, w:12, h:8, minW: 12, maxW:12, minH:8, maxH:8 } : layout} style={{ height: '100%' }}>
|
|
|
<ViewLayoutItem
|
|
|
item={item}
|
|
|
+ esMobile={esMobile}
|
|
|
isPreview={isPreview}
|
|
|
reload={reload}
|
|
|
showPreviewBox={this.showPreviewBox}
|
|
|
@@ -122,8 +129,8 @@ class ViewLayout extends React.PureComponent {
|
|
|
</div> : children}
|
|
|
</ReactGridLayout>
|
|
|
{visiblePreviewBox && previewItem.chartType === 'dataView' && <DataPreview
|
|
|
+ modalClassName={`${themeName} ${esMobile ? 'mobile' : ''}`}
|
|
|
title={previewItem.name}
|
|
|
- modalClassName={themeName}
|
|
|
visibleBox={visiblePreviewBox}
|
|
|
hideBox={this.hidePreviewBox}
|
|
|
fetchFunction={(page, pageSize) => {
|
|
|
@@ -131,9 +138,9 @@ class ViewLayout extends React.PureComponent {
|
|
|
}}
|
|
|
/>}
|
|
|
{visiblePreviewBox && previewItem.chartType !== 'dataView' && <Modal
|
|
|
- className='previewbox'
|
|
|
- width='80%'
|
|
|
- height='80%'
|
|
|
+ className={`previewbox ${themeName} ${esMobile ? 'mobile' : ''}`}
|
|
|
+ width={'100%'}
|
|
|
+ height={'100%'}
|
|
|
visible={visiblePreviewBox}
|
|
|
onCancel={this.hidePreviewBox}
|
|
|
footer={null}
|