Commit e6032be1 authored by zhangwenshuai's avatar zhangwenshuai

update

parent 762f5814
import { IBundleOptions } from 'umi-library/src/types'; // import { IBundleOptions } from 'umi-library/src/types';
// @ts-ignore // @ts-ignore
const options: IBundleOptions = { const options: any = {
cjs: 'rollup', cjs: 'rollup',
esm: 'rollup', esm: 'rollup',
doc: { typescript: true }, doc: { typescript: true },
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
},
],
],
cssModules:true,
}; };
export default options; export default options;
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
}, },
"repository": "/airtable", "repository": "/airtable",
"scripts": { "scripts": {
"dev": "umi-lib doc dev", "dev": "father doc dev",
"build": "umi-lib build", "build": "umi-lib build",
"lint:ts": "tslint \"src/**/*.ts\" \"src/**/*.tsx\"", "lint:ts": "tslint \"src/**/*.ts\" \"src/**/*.tsx\"",
"precommit": "lint-staged:ts" "precommit": "lint-staged:ts"
}, },
"peerDependencies": { "peerDependencies": {
"react": "16.x" "react": "16.x"
...@@ -21,8 +21,13 @@ ...@@ -21,8 +21,13 @@
"devDependencies": { "devDependencies": {
"@types/react": "^16.9.13", "@types/react": "^16.9.13",
"@types/react-dom": "^16.9.4", "@types/react-dom": "^16.9.4",
"babel-plugin-import": "^1.13.0",
"css-loader": "^3.3.0",
"docz": "^2.0.0-rc.76", "docz": "^2.0.0-rc.76",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"less": "^3.10.3",
"less-loader": "^5.0.0",
"style-loader": "^1.0.1",
"typescript": "^3.3.3", "typescript": "^3.3.3",
"umi": "^2.12.2", "umi": "^2.12.2",
"umi-library": "^1.1.1", "umi-library": "^1.1.1",
...@@ -31,12 +36,13 @@ ...@@ -31,12 +36,13 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"antd": "^3.25.2", "antd": "^3.25.2",
"father": "^2.29.1",
"react-virtualized": "^9.21.2" "react-virtualized": "^9.21.2"
}, },
"lint-staged:ts": { "lint-staged:ts": {
"src/**/*.{ts,tsx}": [ "src/**/*.{ts,tsx}": [
"prettier --write", "prettier --write",
"tslint --fix" "tslint --fix"
] ]
} }
} }
@import '../../common';
.cell { .cell {
width: 100%; max-width: 100%;
min-width: 100%;
height: 100%; height: 100%;
&.disabled { &.disabled {
background: #f9f9f9; background: @disabledColor;
} }
.cellContent { .cellContent {
...@@ -19,10 +22,14 @@ ...@@ -19,10 +22,14 @@
.editPop { .editPop {
width: 300px; width: 300px;
:global(.ant-popover-inner){
box-shadow: none;
}
:global(.ant-popover-inner-content) { :global(.ant-popover-inner-content) {
padding: 0; padding: 0;
border: 1px solid #5c99ff; border: 1px solid @primaryColor;
border-radius: 4px; border-radius: 2px;
} }
} }
...@@ -30,8 +37,8 @@ ...@@ -30,8 +37,8 @@
width: 110px; width: 110px;
:global(.ant-popover-inner-content) { :global(.ant-popover-inner-content) {
padding: 6px 0; padding: @paddingSmX 0;
border-radius: 4px; border-radius: @borderRadius;
background: #333333; background: #333333;
} }
...@@ -45,7 +52,7 @@ ...@@ -45,7 +52,7 @@
.menu { .menu {
display: flex; display: flex;
height: 28px; height: 28px;
padding: 0 10px; padding: 0 @paddingGen;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
...@@ -55,11 +62,14 @@ ...@@ -55,11 +62,14 @@
.menuIcon { .menuIcon {
width: 12px; width: 12px;
margin-right: 6px; margin-right: @marginSmX;
color: white;
font-size: @textFontGen;
display: flex;
} }
.menuTitle { .menuTitle {
font-size: 14px; font-size: @textFontGen;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: white; color: white;
......
This diff is collapsed.
@import '../../common';
.colContainer { .colContainer {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
height: 100%; height: 100%;
width: 100%;
.colBrief { .colBrief {
display: flex; display: flex;
align-items: center; align-items: center;
flex: 1; flex: 1;
width: 100%;
.colIcon { .colIcon {
width: 14px; width: @textFontGen;
//height: 12px; color: @textPrimaryColor;
margin-right: 5px;
} }
.colTitle { .colTitle {
...@@ -21,9 +24,12 @@ ...@@ -21,9 +24,12 @@
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
text-align: left; text-align: left;
margin-left: 5px;
color: @textPrimaryColor;
} }
} }
.colOpera { .colOpera {
width: 20px; width: 20px;
text-align: center; text-align: center;
......
import React, { Component } from 'react'; import React, { PureComponent } from 'react';
import { config } from './base/config'; import { config } from './config';
import s from './Column.less'; import s from './Column.less';
import { ColumnProps } from './interface'; import { ColumnProps } from './interface';
import IconFont from './base/extra/iconFont';
export default class TableColumn extends Component<ColumnProps> { export default class TableColumn extends PureComponent<ColumnProps> {
constructor(props: ColumnProps) {
super(props);
}
render() { render() {
let { type, title, width=200 } = this.props; let { type, title, width = 200, columnAttrObj = {} } = this.props;
let icon = config[String(type)] && config[String(type)].icon; let icon = config[String(type)] && config[String(type)].icon;
if (String(type) === '13' && !columnAttrObj.isMultiple) {
icon = 'iconziduan-lianxiangdanxuan';
}
return ( return (
<div className={s.colContainer} style={{ width: width }}> <div className={s.colContainer} style={{ width }}>
<div className={s.colBrief}> <div className={s.colBrief}>
<img className={s.colIcon} src={icon} /> {icon && (typeof icon === 'string' ? <IconFont className={s.colIcon} type={icon} /> : icon)}
<span className={s.colTitle}>{title}</span> <span className={s.colTitle}>{title}</span>
</div> </div>
</div> </div>
......
import React from 'react'; import React from 'react';
import { EditCellProps, EditCellState } from './interface'; import { EditCellProps, EditCellState } from './interface';
import FormHelper from '../utils/formHelper';
export default class EditCell extends React.Component { export default class EditCell extends React.Component {
static getDerivedStateFromProps(nextProps: EditCellProps, prevState: EditCellState) { static getDerivedStateFromProps(nextProps: EditCellProps, prevState: EditCellState) {
...@@ -8,32 +9,72 @@ export default class EditCell extends React.Component { ...@@ -8,32 +9,72 @@ export default class EditCell extends React.Component {
...prevState, ...prevState,
prevProps: nextProps, prevProps: nextProps,
}; };
if (JSON.stringify(prevProps.columnAttrObj) !== JSON.stringify(nextProps.columnAttrObj)) { if (
nextState.columnAttrObj = nextProps.columnAttrObj; JSON.stringify(prevProps.columnConfig) !== JSON.stringify(nextProps.columnConfig) ||
JSON.stringify(prevProps.rowData) !== JSON.stringify(nextProps.rowData)
) {
let columnConfig = this.formHelp(nextProps.columnConfig, nextProps.rowData);
if (JSON.stringify(prevState.columnConfig) !== JSON.stringify(columnConfig)) {
nextState.columnConfig = columnConfig;
}
} }
return nextState; return nextState;
} }
constructor(props: EditCellProps) { constructor(props: EditCellProps) {
super(props); super(props);
this.state = { this.state = {
itemConfig: {}, prevProps: props,
columnConfig: {},
}; };
} }
handleChange = ({ newValue, originValue, emitFlag }: any) => { formHelp = async (item: any, record: any) => {
this.props.onChange(newValue, originValue, emitFlag); const list = this.formatData(record.rowData);
const itemsConfig = await FormHelper.getFormData({ list, rowLocked: record.isLocked });
const itemConfig = itemsConfig.find((temp: any) => {
return temp.columnName === item.columnName;
});
return itemConfig;
};
formatData = (rowData: []) => {
const { columns, noEdit } = this.props;
const temp: any[] = [];
columns.forEach((item: any) => {
const value: any = rowData.find((itemData: any) => {
return itemData.colName === item.key;
});
temp.push({
...item,
value: (value && value.cellValueList) || [{ text: '', value: '' }],
type: item.columnType,
readonlyFlag: noEdit ? true : item.readonlyFlag,
});
});
return temp;
};
handleChange = (newValue: any, originValue: any, emitFlag: boolean) => {
const { onChange } = this.props;
if (typeof onChange === 'function') {
onChange(newValue, originValue, emitFlag);
}
}; };
render() { render() {
const Component = this.props.component; const { columnConfig } = this.state;
const { itemConfig } = this.state; const { component, value, tableId, cellData, rowId } = this.props;
const Component = component;
return ( return (
<Component <Component
value={this.props.value} value={value}
changeParams={this.handleChange} changeParams={this.handleChange}
columnConfig={itemConfig} columnConfig={columnConfig}
autoFocus autoFocus={true}
style={{ width: '100%' }} style={{ width: '100%' }}
tableId={tableId}
cellData={cellData}
rowId={rowId}
/> />
); );
} }
......
...@@ -38,20 +38,6 @@ ...@@ -38,20 +38,6 @@
padding: 10px; padding: 10px;
background: white; background: white;
} }
:global(.ant-table-row-hover) {
.unchecked {
display: block;
}
.no {
display: none;
}
.showFormBtn {
visibility: visible;
}
}
} }
.indexCell { .indexCell {
...@@ -74,8 +60,10 @@ ...@@ -74,8 +60,10 @@
&:hover { &:hover {
box-shadow: inset 0 0 0 1px @operateColor; box-shadow: inset 0 0 0 1px @operateColor;
.showFormBtn { .showFormBtnCls {
visibility: visible; .showFormBtn {
display: initial;
}
} }
.unchecked { .unchecked {
...@@ -85,6 +73,12 @@ ...@@ -85,6 +73,12 @@
.no { .no {
display: none; display: none;
} }
.addCls {
.addIcon {
display: initial;
}
}
} }
.cellNo { .cellNo {
...@@ -94,10 +88,34 @@ ...@@ -94,10 +88,34 @@
} }
.cellContent { .cellContent {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
height: 100%; height: 100%;
display: flex;
align-items: center;
.firstCell {
min-width: 0;
max-width: 80%;
}
.empty {
min-width: 80%;
}
.historyCount {
margin: @marginSmX;
cursor: pointer;
.countNo {
color: @primaryColor;
}
}
}
.addCls {
width: 20px;
text-align: center;
cursor: pointer;
.addIcon {
display: none;
color: @primaryColor;
}
} }
.unchecked { .unchecked {
...@@ -111,15 +129,18 @@ ...@@ -111,15 +129,18 @@
white-space: nowrap; white-space: nowrap;
} }
.showFormBtn { .showFormBtnCls {
visibility: hidden;
margin: 0 5px; margin: 0 5px;
width: 18px; width: 18px;
border-radius: 50%;
cursor: pointer; cursor: pointer;
&:hover { .showFormBtn {
background: #d0f0fd; display: none;
width: 18px;
border-radius: 50%;
&:hover {
background: #d0f0fd;
}
} }
} }
} }
...@@ -129,7 +150,7 @@ ...@@ -129,7 +150,7 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
background: #fff; background: #fff;
.LeftSideContainer{ .LeftSideContainer {
box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15); box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15);
position: absolute; position: absolute;
z-index: 1; z-index: 1;
...@@ -186,20 +207,3 @@ ...@@ -186,20 +207,3 @@
outline: none; outline: none;
} }
.cell,
.headerCell,
.leftCell {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
padding: 0 .5em;
}
.headerCell,
.leftCell {
font-weight: bold;
}
...@@ -9,6 +9,8 @@ import { TableProps, TableState } from './interface'; ...@@ -9,6 +9,8 @@ import { TableProps, TableState } from './interface';
import Column from './Column'; import Column from './Column';
import Cell from './Cell'; import Cell from './Cell';
import extendIcon from '../assets/extend.png'; import extendIcon from '../assets/extend.png';
import IconFont from './base/extra/iconFont';
import scrollbarSize from '../utils/scrollbarSize';
export default class AirTable extends Component<TableProps, TableState> { export default class AirTable extends Component<TableProps, TableState> {
static getDerivedStateFromProps(nextProps: TableProps, prevState: TableState) { static getDerivedStateFromProps(nextProps: TableProps, prevState: TableState) {
...@@ -23,6 +25,9 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -23,6 +25,9 @@ export default class AirTable extends Component<TableProps, TableState> {
if (JSON.stringify(prevProps.columns) !== JSON.stringify(nextProps.columns)) { if (JSON.stringify(prevProps.columns) !== JSON.stringify(nextProps.columns)) {
nextState.columns = nextProps.columns; nextState.columns = nextProps.columns;
} }
if (JSON.stringify(prevProps.checked) !== JSON.stringify(nextProps.checked)) {
nextState.checked = nextProps.checked;
}
return nextState; return nextState;
} }
constructor(props: TableProps) { constructor(props: TableProps) {
...@@ -36,7 +41,6 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -36,7 +41,6 @@ export default class AirTable extends Component<TableProps, TableState> {
prevProps: props, prevProps: props,
height: document.body.clientHeight - 193, height: document.body.clientHeight - 193,
}; };
this.indexCount = {};
this.config = { this.config = {
overscanColumnCount: 5, overscanColumnCount: 5,
overscanRowCount: 5, overscanRowCount: 5,
...@@ -166,7 +170,8 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -166,7 +170,8 @@ export default class AirTable extends Component<TableProps, TableState> {
// 下拉加载 // 下拉加载
onScrollRow = ({ clientHeight, scrollTop }: any) => { onScrollRow = ({ clientHeight, scrollTop }: any) => {
const height = clientHeight + scrollTop || 0; const height = clientHeight + scrollTop || 0;
const { dataSource = [], rowHeight = 40 } = this.state; const { dataSource = [], } = this.state;
const { rowHeight } = this.config;
const { onScroll } = this.props; const { onScroll } = this.props;
const offset = 100; const offset = 100;
if (dataSource.length === 0) return; if (dataSource.length === 0) return;
...@@ -243,6 +248,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -243,6 +248,7 @@ export default class AirTable extends Component<TableProps, TableState> {
noDel, noDel,
tableId, tableId,
flush, flush,
showHistory=()=>{},
} = this.props; } = this.props;
if (columns.length === 0 || data.length === 0) { if (columns.length === 0 || data.length === 0) {
return; return;
...@@ -305,6 +311,11 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -305,6 +311,11 @@ export default class AirTable extends Component<TableProps, TableState> {
</div> </div>
<div className={styles.cellContent} style={extraCellContentStyle}> <div className={styles.cellContent} style={extraCellContentStyle}>
<Cell <Cell
overlayClassName={
cellData && cellData.length > 0
? styles.firstCell
: styles.empty
}
columns={columns} columns={columns}
columnConfig={columnConfig} columnConfig={columnConfig}
rowData={rowData} rowData={rowData}
...@@ -321,7 +332,37 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -321,7 +332,37 @@ export default class AirTable extends Component<TableProps, TableState> {
tableId={tableId} tableId={tableId}
flush={flush} flush={flush}
/> />
{(tableId === 1 || tableId === 14) && (
<div
className={styles.historyCount}
role="presentation"
onClick={showHistory.bind(this, {
rowId: rowData.id,
rowData: rowData.rowData,
initType: 'detail',
})}
>
{filterRowData.groupHistoryCount && filterRowData.groupHistoryCount > 1 && (
<span className={styles.countNo}>
{`(${filterRowData.groupHistoryCount > 99 ? '99+' : filterRowData.groupHistoryCount})`}
</span>
)}
</div>
)}
</div> </div>
{(tableId === 1 || tableId === 14) && (
<div
className={styles.addCls}
role="presentation"
onClick={showHistory.bind(this, {
rowId: rowData.id,
rowData: rowData.rowData,
initType: 'add',
})}
>
<IconFont className={styles.addIcon} type="iconxinzeng" />
</div>
)}
</div> </div>
); );
} }
...@@ -382,7 +423,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -382,7 +423,7 @@ export default class AirTable extends Component<TableProps, TableState> {
className={styles.LeftSideContainer} className={styles.LeftSideContainer}
style={{ style={{
width: `${columnWidth * leftCount}px`, width: `${columnWidth * leftCount}px`,
height: `${height + rowHeight}px`, height: `${height - scrollbarSize() + rowHeight}px`,
}} }}
> >
{ {
...@@ -434,7 +475,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -434,7 +475,7 @@ export default class AirTable extends Component<TableProps, TableState> {
width={columnWidth * leftCount} width={columnWidth * leftCount}
rowHeight={rowHeight} rowHeight={rowHeight}
rowCount={rowCount} rowCount={rowCount}
height={height} height={height - scrollbarSize()}
scrollTop={scrollTop} scrollTop={scrollTop}
checked={checked} checked={checked}
dataSource={dataSource} dataSource={dataSource}
...@@ -446,8 +487,10 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -446,8 +487,10 @@ export default class AirTable extends Component<TableProps, TableState> {
</div> </div>
<div className={styles.GridColumn}> <div className={styles.GridColumn}>
<AutoSizer disableHeight> <AutoSizer disableHeight>
{({ width }: any) => ( {({ width }: any) => {
<div> // 如果列太少不满一屏时,列头宽度按列计算
const headerWidth:number = columnWidth * columnCount < width ? columnWidth * columnCount : width;
return ( <div>
{ {
//右侧表头 //右侧表头
<div <div
...@@ -457,7 +500,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -457,7 +500,7 @@ export default class AirTable extends Component<TableProps, TableState> {
width: width:
columnWidth * columnCount < width columnWidth * columnCount < width
? columnWidth * columnCount ? columnWidth * columnCount
: width, //如果列太少不满一屏时,列头宽度按列计算 : headerWidth - scrollbarSize(),
}} }}
> >
<Grid <Grid
...@@ -466,7 +509,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -466,7 +509,7 @@ export default class AirTable extends Component<TableProps, TableState> {
columnData={columns} columnData={columns}
columnWidth={columnWidth} columnWidth={columnWidth}
columnCount={columnCount} columnCount={columnCount}
width={width} width={width - scrollbarSize()}
rowHeight={rowHeight} rowHeight={rowHeight}
rowCount={1} rowCount={1}
height={rowHeight} height={rowHeight}
...@@ -507,7 +550,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -507,7 +550,7 @@ export default class AirTable extends Component<TableProps, TableState> {
</div> </div>
} }
</div> </div>
)} )}}
</AutoSizer> </AutoSizer>
</div> </div>
</div> </div>
......
import React from 'react'; import React from 'react';
import _ from 'lodash';
import { config } from '../config'; import { config } from '../config';
import styles from './styles.less'; import styles from './styles.less';
import { transferAttr } from '../_utils/transferAttr'; import { transferAttr } from '../_utils/transferAttr';
import { BaseComponentProps } from '@/apollo-table/component/interface'; import { BaseComponentProps } from '../../../component/interface';
import Text from './input'; import Text from './input';
// 此方法为高阶组件,不应再render里面频繁调用,防止频繁实例化,带来性能上的浪费 // 此方法为高阶组件,不应再render里面频繁调用,防止频繁实例化,带来性能上的浪费
export const getDetail = (type: string) => { export const getDetail = (type: string) => {
const NodeObj = config[type] || {}; const NodeObj = config[type] || {};
const Node = NodeObj.detail || Text; // 默认文本类型 const Detail = NodeObj.detail || Text; // 默认文本类型
if (!NodeObj.detail) { if (!NodeObj.detail) {
console.warn(NodeObj.name + '---详情组件暂未定义,默认使用文本类型'); console.warn(`${NodeObj.name}---详情组件暂未定义,默认使用文本类型`);
} }
return class extends React.Component { return class extends React.PureComponent<BaseComponentProps> {
state = {
value: undefined,
};
shouldComponentUpdate(nextProps: BaseComponentProps) {
return !_.isEqual(this.props, nextProps);
}
render() { render() {
const { const {
columnConfig: { columnAttrObj, columnType }, columnConfig: { columnAttrObj, columnType },
...@@ -31,11 +23,11 @@ export const getDetail = (type: string) => { ...@@ -31,11 +23,11 @@ export const getDetail = (type: string) => {
...(NodeObj.componentAttr || {}), ...(NodeObj.componentAttr || {}),
...(columnAttrObj || {}), ...(columnAttrObj || {}),
}; };
let transferColumn = transferAttr(columnType, newProps); const transferColumn = transferAttr(columnType, newProps);
return Node ? ( return (
<div className={styles.container}> <div className={styles.container}>
<Node <Detail
{...this.props} {...this.props}
componentAttr={transferColumn} componentAttr={transferColumn}
formatter={NodeObj.getFormatter} formatter={NodeObj.getFormatter}
...@@ -43,7 +35,7 @@ export const getDetail = (type: string) => { ...@@ -43,7 +35,7 @@ export const getDetail = (type: string) => {
onChange={this.onChange} onChange={this.onChange}
/> />
</div> </div>
) : null; );
} }
}; };
}; };
import { Icon } from 'antd';
const IconFont = Icon.createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/font_1509781_8rwgy6vdhtx.js',
});
export default IconFont;
...@@ -25,7 +25,6 @@ export const getComponent = (type: string) => { ...@@ -25,7 +25,6 @@ export const getComponent = (type: string) => {
componentDidMount() { componentDidMount() {
const { value, columnConfig } = this.props; const { value, columnConfig } = this.props;
debugger
this.setState({ value: this.getFormat(value), columnConfig }); this.setState({ value: this.getFormat(value), columnConfig });
} }
......
import { getComponent } from './base';
export const config:any = {
'1': {
name: '单行文本',
component: getComponent('1'),
icon: 'iconziduan-danhangwenben',
},
'2': {
name: '超链接',
component: getComponent('2'),
icon: 'iconziduan-chaolianjie',
},
'3': {
name: '多行文本',
component: getComponent('3'),
icon: 'iconziduan-duohangwenben',
},
'4': {
name: '附件上传',
component: getComponent('4'),
icon: 'iconziduan-fujian',
},
'5': {
name: '复选',
component: getComponent('5'),
icon: 'iconziduan-fuxuan',
},
'6': {
name: '下拉单选',
component: getComponent('6'),
icon: 'iconziduan-xiala',
},
'7': {
name: '下拉多选',
component: getComponent('7'),
icon: 'iconziduan-xialaduoxuan',
},
'8': {
name: '评级',
component: getComponent('8'),
icon: 'iconziduan-pingji',
},
'9': {
name: '数字输入',
component: getComponent('9'),
icon: 'iconziduan-shuzi',
},
'10': {
name: '百分比',
component: getComponent('10'),
icon: 'iconziduan-baifenbi',
},
'11': {
name: '日期',
component: getComponent('11'),
icon: 'iconziduan-riqi',
},
'12': {
name: '引用',
component: getComponent('12'),
icon: 'iconziduan-yinyong',
},
'13': {
name: '模糊搜索多选',
component: getComponent('13'),
icon: 'iconziduan-lianxiangduoxuan',
},
'14': {
name: '树结构',
component: getComponent('14'),
icon: 'iconziduan-ren',
},
'15': {
name: '文本搜索框',
component: getComponent('15'),
icon: 'iconziduan-lianxiangdanxuan',
},
};
export default config;
This diff is collapsed.
This diff is collapsed.
...@@ -5,6 +5,7 @@ export interface CommonProps { ...@@ -5,6 +5,7 @@ export interface CommonProps {
dataSource?: []; dataSource?: [];
tableId?: number; tableId?: number;
checked?: []; checked?: [];
columnWidth?: number;
} }
export interface CommonState { export interface CommonState {
...@@ -13,6 +14,7 @@ export interface CommonState { ...@@ -13,6 +14,7 @@ export interface CommonState {
dataSource?: []; dataSource?: [];
tableId?: number; tableId?: number;
checked?: []; checked?: [];
columnWidth?: number;
} }
export interface TableProps extends CommonProps {} export interface TableProps extends CommonProps {}
...@@ -48,7 +50,15 @@ export interface CellState { ...@@ -48,7 +50,15 @@ export interface CellState {
columns: []; columns: [];
columnConfig: any; columnConfig: any;
rowData: []; rowData: [];
cellData: []; editValue: [];
originValue: [];
}
export interface EditCellProps {
columnConfig: any;
rowData: [];
value: any;
}
export interface EditCellState {
prevProps: EditCellProps;
columnConfig: any;
} }
export interface EditCellProps extends BaseComponentProps {}
export interface EditCellState extends BaseComponentState {}
const canUseDOM:boolean = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
let size: number;
export default function scrollbarSize(recalc?: boolean) {
if ((!size && size !== 0) || recalc) {
if (canUseDOM) {
const scrollDiv = document.createElement('div');
scrollDiv.style.position = 'absolute';
scrollDiv.style.top = '-9999px';
scrollDiv.style.width = '50px';
scrollDiv.style.height = '50px';
scrollDiv.style.overflow = 'scroll';
document.body.appendChild(scrollDiv);
size = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
}
}
return size;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment