Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web_component
submodule
Commits
602ab98f
Commit
602ab98f
authored
Jun 02, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update apolloTable
parent
8c526b9d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
11 deletions
+19
-11
Column.tsx
components/apolloTable/component/Column.tsx
+6
-4
Table.tsx
components/apolloTable/component/Table.tsx
+7
-7
index.tsx
components/apolloTable/component/index.tsx
+4
-0
interface.tsx
components/apolloTable/component/interface.tsx
+2
-0
No files found.
components/apolloTable/component/Column.tsx
View file @
602ab98f
...
@@ -48,7 +48,9 @@ export default class TableColumn extends PureComponent<ColumnProps> {
...
@@ -48,7 +48,9 @@ export default class TableColumn extends PureComponent<ColumnProps> {
if
(
typeof
onChange
===
'function'
)
{
if
(
typeof
onChange
===
'function'
)
{
const
data
=
_
.
cloneDeep
(
selectedRows
);
const
data
=
_
.
cloneDeep
(
selectedRows
);
dataSource
.
map
((
item
:
any
)
=>
{
dataSource
.
map
((
item
:
any
)
=>
{
const
index
=
data
.
findIndex
((
temp
:
any
)
=>
{
return
temp
.
id
===
item
.
id
;
});
const
index
=
data
.
findIndex
((
temp
:
any
)
=>
{
return
temp
.
id
===
item
.
id
;
});
if
(
checked
)
{
if
(
checked
)
{
index
>
-
1
&&
data
.
splice
(
index
,
1
);
index
>
-
1
&&
data
.
splice
(
index
,
1
);
}
else
{
}
else
{
...
@@ -72,6 +74,7 @@ export default class TableColumn extends PureComponent<ColumnProps> {
...
@@ -72,6 +74,7 @@ export default class TableColumn extends PureComponent<ColumnProps> {
columnIndex
,
columnIndex
,
questionText
,
questionText
,
rowSelection
,
rowSelection
,
icon
,
}
=
this
.
props
;
}
=
this
.
props
;
const
{
value
=
[]
}
=
sortConfig
||
{};
const
{
value
=
[]
}
=
sortConfig
||
{};
const
sort
=
value
.
find
((
item
:
any
)
=>
{
const
sort
=
value
.
find
((
item
:
any
)
=>
{
...
@@ -82,13 +85,12 @@ export default class TableColumn extends PureComponent<ColumnProps> {
...
@@ -82,13 +85,12 @@ export default class TableColumn extends PureComponent<ColumnProps> {
<
div
className=
{
s
.
colContainer
}
>
<
div
className=
{
s
.
colContainer
}
>
{
rowSelection
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
checkbox
}
>
{
this
.
getCheckbox
()
}
</
div
>
}
{
rowSelection
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
checkbox
}
>
{
this
.
getCheckbox
()
}
</
div
>
}
<
div
className=
{
s
.
colBrief
}
style=
{
{
marginLeft
:
showIndex
&&
columnIndex
===
0
?
'40px'
:
0
}
}
>
<
div
className=
{
s
.
colBrief
}
style=
{
{
marginLeft
:
showIndex
&&
columnIndex
===
0
?
'40px'
:
0
}
}
>
{
icon
&&
<
div
className=
{
s
.
colIcon
}
>
{
icon
()
}
</
div
>
}
<
span
className=
{
s
.
colTitle
}
>
<
span
className=
{
s
.
colTitle
}
>
{
columnChsName
}
{
columnChsName
}
{
questionText
&&
(
{
questionText
&&
(
<
Tooltip
title=
{
questionText
}
>
<
Tooltip
title=
{
questionText
}
>
<
div
className=
{
s
.
tipContainer
}
>
<
div
className=
{
s
.
tipContainer
}
>
?
</
div
>
?
</
div
>
</
Tooltip
>
</
Tooltip
>
)
}
)
}
</
span
>
</
span
>
...
...
components/apolloTable/component/Table.tsx
View file @
602ab98f
...
@@ -55,7 +55,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -55,7 +55,7 @@ export default class AirTable extends Component<TableProps, TableState> {
constructor
(
props
:
TableProps
)
{
constructor
(
props
:
TableProps
)
{
super
(
props
);
super
(
props
);
const
{
columns
,
dataSource
,
width
=
0
,
height
=
0
,
rowHeight
}
=
props
;
const
{
columns
,
dataSource
,
width
=
0
,
height
=
0
,
rowHeight
,
headerHeight
,
columnWidth
}
=
props
;
this
.
state
=
{
this
.
state
=
{
columns
,
columns
,
dataSource
,
dataSource
,
...
@@ -65,9 +65,9 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -65,9 +65,9 @@ export default class AirTable extends Component<TableProps, TableState> {
this
.
config
=
{
this
.
config
=
{
overscanColumnCount
:
5
,
overscanColumnCount
:
5
,
overscanRowCount
:
5
,
overscanRowCount
:
5
,
columnWidth
:
150
,
columnWidth
:
columnWidth
||
150
,
rowHeight
:
rowHeight
||
80
,
rowHeight
:
rowHeight
||
80
,
headerHeight
:
60
,
headerHeight
:
headerHeight
||
60
,
};
};
this
.
memoizeLeftColumns
=
memoizeOne
(
this
.
getLeftColumns
);
this
.
memoizeLeftColumns
=
memoizeOne
(
this
.
getLeftColumns
);
this
.
memoizeRightColumns
=
memoizeOne
(
this
.
getRightColumns
);
this
.
memoizeRightColumns
=
memoizeOne
(
this
.
getRightColumns
);
...
@@ -214,6 +214,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -214,6 +214,7 @@ export default class AirTable extends Component<TableProps, TableState> {
columnAttrObj
=
{},
columnAttrObj
=
{},
sortFlag
,
sortFlag
,
questionText
,
questionText
,
icon
,
}
=
showColumns
[
columnIndex
];
}
=
showColumns
[
columnIndex
];
return
(
return
(
<
div
className=
{
styles
.
headerCell
}
key=
{
key
}
style=
{
style
}
>
<
div
className=
{
styles
.
headerCell
}
key=
{
key
}
style=
{
style
}
>
...
@@ -229,6 +230,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -229,6 +230,7 @@ export default class AirTable extends Component<TableProps, TableState> {
questionText=
{
questionText
}
questionText=
{
questionText
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
dataSource=
{
dataSource
}
dataSource=
{
dataSource
}
icon=
{
icon
}
/>
/>
</
div
>
</
div
>
);
);
...
@@ -352,7 +354,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -352,7 +354,7 @@ export default class AirTable extends Component<TableProps, TableState> {
const
rightWidth
=
this
.
memoizeLeftWidth
(
rightColumns
,
showColumns
);
const
rightWidth
=
this
.
memoizeLeftWidth
(
rightColumns
,
showColumns
);
let
totalHeight
:
number
=
rowCount
*
rowHeight
;
let
totalHeight
:
number
=
rowCount
*
rowHeight
;
const
{
totalWidth
}
=
this
.
memoizeTotalWidth
(
showColumns
);
const
{
totalWidth
}
=
this
.
memoizeTotalWidth
(
showColumns
);
if
(
totalWidth
>
tableWidth
)
{
if
(
rowCount
>
0
&&
totalWidth
>
tableWidth
)
{
totalHeight
=
rowCount
*
rowHeight
+
scrollbarWidth
;
totalHeight
=
rowCount
*
rowHeight
+
scrollbarWidth
;
}
}
return
(
return
(
...
@@ -581,9 +583,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -581,9 +583,7 @@ export default class AirTable extends Component<TableProps, TableState> {
</
div
>
</
div
>
)
}
)
}
<
div
className=
{
styles
.
fillHandleWrapper
}
/>
<
div
className=
{
styles
.
fillHandleWrapper
}
/>
<
div
className=
{
styles
.
loading
}
>
<
div
className=
{
styles
.
loading
}
>
{
/*<Spin spinning={loading} />*/
}
</
div
>
{
/*<Spin spinning={loading} />*/
}
</
div
>
</
div
>
</
div
>
);
);
}
}
}
}
...
...
components/apolloTable/component/index.tsx
View file @
602ab98f
...
@@ -58,6 +58,8 @@ class AirTable extends React.Component<CommonProps, CommonState> {
...
@@ -58,6 +58,8 @@ class AirTable extends React.Component<CommonProps, CommonState> {
rowSelection
,
rowSelection
,
tableOperateConfig
,
tableOperateConfig
,
noDataPlaceholder
,
noDataPlaceholder
,
columnWidth
,
headerHeight
,
}
=
this
.
props
;
}
=
this
.
props
;
const
sortConfig
=
operateConfig
const
sortConfig
=
operateConfig
&&
operateConfig
.
menusGroup
&&
operateConfig
.
menusGroup
...
@@ -86,6 +88,8 @@ class AirTable extends React.Component<CommonProps, CommonState> {
...
@@ -86,6 +88,8 @@ class AirTable extends React.Component<CommonProps, CommonState> {
emptyPlaceholder=
{
emptyPlaceholder
}
emptyPlaceholder=
{
emptyPlaceholder
}
cellEditable=
{
cellEditable
}
cellEditable=
{
cellEditable
}
rowHeight=
{
rowHeight
}
rowHeight=
{
rowHeight
}
headerHeight=
{
headerHeight
}
columnWidth=
{
columnWidth
}
loading=
{
loading
}
loading=
{
loading
}
rowSelection=
{
rowSelection
}
rowSelection=
{
rowSelection
}
noDataPlaceholder=
{
noDataPlaceholder
}
noDataPlaceholder=
{
noDataPlaceholder
}
...
...
components/apolloTable/component/interface.tsx
View file @
602ab98f
...
@@ -65,6 +65,8 @@ export interface TableProps extends LoadConfigProps {
...
@@ -65,6 +65,8 @@ export interface TableProps extends LoadConfigProps {
emptyPlaceholder
?:
string
;
emptyPlaceholder
?:
string
;
cellEditable
?:
boolean
;
cellEditable
?:
boolean
;
rowHeight
?:
number
;
rowHeight
?:
number
;
headerHeight
?:
number
;
columnWidth
?:
number
;
loading
?:
boolean
;
loading
?:
boolean
;
rowSelection
?:
any
;
rowSelection
?:
any
;
noDataPlaceholder
?:
any
;
noDataPlaceholder
?:
any
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment