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
b645f18f
Commit
b645f18f
authored
Jun 04, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update apolloTable locale
parent
728c2b95
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
498 additions
and
349 deletions
+498
-349
Cell.tsx
components/apolloTable/component/Cell.tsx
+0
-1
Table.less
components/apolloTable/component/Table.less
+12
-0
Table.tsx
components/apolloTable/component/Table.tsx
+246
-220
context.ts
components/apolloTable/component/context.ts
+4
-0
index.tsx
components/apolloTable/component/filter-condition/index.tsx
+41
-33
index.tsx
components/apolloTable/component/filter/index.tsx
+28
-20
index.tsx
components/apolloTable/component/hide/index.tsx
+27
-17
index.less
components/apolloTable/component/index.less
+9
-1
index.tsx
components/apolloTable/component/index.tsx
+55
-33
interface.tsx
components/apolloTable/component/interface.tsx
+4
-2
index.tsx
components/apolloTable/component/sort/index.tsx
+30
-22
locale.ts
components/apolloTable/locale.ts
+42
-0
No files found.
components/apolloTable/component/Cell.tsx
View file @
b645f18f
...
@@ -191,7 +191,6 @@ const Cell = (props: CellProps) => {
...
@@ -191,7 +191,6 @@ const Cell = (props: CellProps) => {
)
}
)
}
</
div
>
</
div
>
);
);
console
.
log
(
'contentMenu'
,
contentMenu
);
return
contentMenu
?
(
return
contentMenu
?
(
<
Popover
<
Popover
...
...
components/apolloTable/component/Table.less
View file @
b645f18f
...
@@ -5,6 +5,15 @@
...
@@ -5,6 +5,15 @@
display: flex;
display: flex;
flex-direction: row;
flex-direction: row;
border: 1px solid @borderColor;
border: 1px solid @borderColor;
&.scroll {
height: 100%;
.loading{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
}
.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;
...
@@ -88,3 +97,6 @@
...
@@ -88,3 +97,6 @@
right: 0;
right: 0;
pointer-events: none;
pointer-events: none;
}
}
.defaultEmpty{
padding-top: 100px;
}
components/apolloTable/component/Table.tsx
View file @
b645f18f
This diff is collapsed.
Click to expand it.
components/apolloTable/component/context.ts
0 → 100644
View file @
b645f18f
import
React
from
'react'
;
const
{
Consumer
,
Provider
}
=
React
.
createContext
({});
export
{
Consumer
,
Provider
};
components/apolloTable/component/filter-condition/index.tsx
View file @
b645f18f
...
@@ -5,6 +5,7 @@ import styles from './styles.less';
...
@@ -5,6 +5,7 @@ import styles from './styles.less';
import
{
config
}
from
'../base/config'
;
import
{
config
}
from
'../base/config'
;
import
{
transferAttr
}
from
'../base/_utils/transferAttr'
;
import
{
transferAttr
}
from
'../base/_utils/transferAttr'
;
import
{
ColumnProps
}
from
'../interface'
;
import
{
ColumnProps
}
from
'../interface'
;
import
{
Consumer
}
from
'../context'
;
const
formatTags
=
(
columns
:
ColumnProps
[],
tags
:
any
[])
=>
{
const
formatTags
=
(
columns
:
ColumnProps
[],
tags
:
any
[])
=>
{
if
(
!
columns
||
columns
.
length
===
0
||
!
tags
||
!
Array
.
isArray
(
tags
))
{
if
(
!
columns
||
columns
.
length
===
0
||
!
tags
||
!
Array
.
isArray
(
tags
))
{
...
@@ -29,7 +30,8 @@ const formatTags = (columns: ColumnProps[], tags: any[]) => {
...
@@ -29,7 +30,8 @@ const formatTags = (columns: ColumnProps[], tags: any[]) => {
return
item
.
text
;
return
item
.
text
;
})
})
.
join
(
','
);
.
join
(
','
);
const
op
=
operator
.
find
((
item
:
any
)
=>
{
const
op
=
operator
.
find
((
item
:
any
)
=>
{
return
item
.
id
===
tag
.
operationCode
;
return
item
.
id
===
tag
.
operationCode
;
})
||
{};
})
||
{};
textTags
.
push
(
`
${
colConfig
.
columnChsName
}
${
op
.
name
}
${
value
}
`
);
textTags
.
push
(
`
${
colConfig
.
columnChsName
}
${
op
.
name
}
${
value
}
`
);
...
@@ -59,8 +61,8 @@ class FormFilterButton extends Component<Props, State> {
...
@@ -59,8 +61,8 @@ class FormFilterButton extends Component<Props, State> {
static
getDerivedStateFromProps
(
nextProps
:
Props
,
prevState
:
State
)
{
static
getDerivedStateFromProps
(
nextProps
:
Props
,
prevState
:
State
)
{
if
(
if
(
JSON
.
stringify
(
nextProps
.
value
)
!==
JSON
.
stringify
(
prevState
.
value
)
JSON
.
stringify
(
nextProps
.
value
)
!==
JSON
.
stringify
(
prevState
.
value
)
||
||
JSON
.
stringify
(
nextProps
.
columns
)
!==
JSON
.
stringify
(
prevState
.
columns
)
JSON
.
stringify
(
nextProps
.
columns
)
!==
JSON
.
stringify
(
prevState
.
columns
)
)
{
)
{
return
{
return
{
value
:
_
.
cloneDeep
(
nextProps
.
value
),
value
:
_
.
cloneDeep
(
nextProps
.
value
),
...
@@ -104,9 +106,12 @@ class FormFilterButton extends Component<Props, State> {
...
@@ -104,9 +106,12 @@ class FormFilterButton extends Component<Props, State> {
render
()
{
render
()
{
const
{
tags
}
=
this
.
state
;
const
{
tags
}
=
this
.
state
;
const
{
onSaveFilter
}
=
this
.
props
;
const
{
onSaveFilter
}
=
this
.
props
;
return
(
<
Consumer
>
{
({
locale
})
=>
{
return
(
return
(
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
title
}
>
Selected conditions:
</
div
>
<
div
className=
{
styles
.
title
}
>
{
locale
.
selectedConditions
}
</
div
>
<
div
className=
{
styles
.
footer
}
>
<
div
className=
{
styles
.
footer
}
>
<
div
className=
{
styles
.
chooseItem
}
>
<
div
className=
{
styles
.
chooseItem
}
>
{
tags
.
map
((
item
:
any
,
i
:
number
)
=>
{
{
tags
.
map
((
item
:
any
,
i
:
number
)
=>
{
...
@@ -126,16 +131,19 @@ class FormFilterButton extends Component<Props, State> {
...
@@ -126,16 +131,19 @@ class FormFilterButton extends Component<Props, State> {
<
div
className=
{
styles
.
buttonGroup
}
>
<
div
className=
{
styles
.
buttonGroup
}
>
{
onSaveFilter
&&
(
{
onSaveFilter
&&
(
<
div
onClick=
{
this
.
save
}
className=
{
styles
.
saveBtn
}
>
<
div
onClick=
{
this
.
save
}
className=
{
styles
.
saveBtn
}
>
Save as a shortcut
{
locale
.
saveShortcut
}
</
div
>
</
div
>
)
}
)
}
<
div
onClick=
{
this
.
reset
}
className=
{
styles
.
resetBtn
}
>
<
div
onClick=
{
this
.
reset
}
className=
{
styles
.
resetBtn
}
>
Clear filters
{
locale
.
clearFilter
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
);
);
}
}
</
Consumer
>
);
}
}
}
}
...
...
components/apolloTable/component/filter/index.tsx
View file @
b645f18f
...
@@ -9,6 +9,7 @@ import s from '../hide/index.less';
...
@@ -9,6 +9,7 @@ import s from '../hide/index.less';
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
import
filterIcon
from
'../../assets/filter.png'
;
import
filterIcon
from
'../../assets/filter.png'
;
import
closeIcon
from
'../../assets/close.png'
;
import
closeIcon
from
'../../assets/close.png'
;
import
{
Consumer
}
from
'../context'
;
const
TransType
=
[
'2'
,
'3'
,
'4'
,
'13'
,
'14'
,
'15'
];
const
TransType
=
[
'2'
,
'3'
,
'4'
,
'13'
,
'14'
,
'15'
];
interface
Props
{
interface
Props
{
...
@@ -190,7 +191,7 @@ export default class Filter extends Component<Props, State> {
...
@@ -190,7 +191,7 @@ export default class Filter extends Component<Props, State> {
}
}
};
};
renderContent
=
()
=>
{
renderContent
=
(
locale
)
=>
{
const
{
filterConfig
}
=
this
.
state
;
const
{
filterConfig
}
=
this
.
state
;
const
{
columns
}
=
this
.
props
;
const
{
columns
}
=
this
.
props
;
const
filterColumnConfig
=
this
.
getFilterColumns
(
columns
);
const
filterColumnConfig
=
this
.
getFilterColumns
(
columns
);
...
@@ -229,7 +230,7 @@ export default class Filter extends Component<Props, State> {
...
@@ -229,7 +230,7 @@ export default class Filter extends Component<Props, State> {
value=
{
item
.
colName
||
undefined
}
value=
{
item
.
colName
||
undefined
}
onChange=
{
this
.
changeFilterKey
.
bind
(
this
,
i
)
}
onChange=
{
this
.
changeFilterKey
.
bind
(
this
,
i
)
}
style=
{
{
width
:
'100%'
}
}
style=
{
{
width
:
'100%'
}
}
placeholder=
"please select"
placeholder=
{
locale
.
select
}
>
>
{
filterColumnConfig
.
map
((
option
)
=>
{
{
filterColumnConfig
.
map
((
option
)
=>
{
return
(
return
(
...
@@ -243,7 +244,7 @@ export default class Filter extends Component<Props, State> {
...
@@ -243,7 +244,7 @@ export default class Filter extends Component<Props, State> {
<
div
className=
{
styles
.
optionMid
}
>
<
div
className=
{
styles
.
optionMid
}
>
<
Select
<
Select
value=
{
item
.
operationCode
||
undefined
}
value=
{
item
.
operationCode
||
undefined
}
placeholder=
"please select"
placeholder=
{
locale
.
select
}
onChange=
{
this
.
changeFilterOperate
.
bind
(
this
,
i
)
}
onChange=
{
this
.
changeFilterOperate
.
bind
(
this
,
i
)
}
style=
{
{
width
:
'100%'
}
}
style=
{
{
width
:
'100%'
}
}
>
>
...
@@ -279,7 +280,7 @@ export default class Filter extends Component<Props, State> {
...
@@ -279,7 +280,7 @@ export default class Filter extends Component<Props, State> {
})
}
})
}
<
div
className=
{
styles
.
optionItem
}
>
<
div
className=
{
styles
.
optionItem
}
>
<
div
role=
"presentation"
className=
{
styles
.
add
}
onClick=
{
this
.
addFilterLine
}
>
<
div
role=
"presentation"
className=
{
styles
.
add
}
onClick=
{
this
.
addFilterLine
}
>
Add
{
locale
.
filterAdd
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
btns
}
>
<
div
className=
{
styles
.
btns
}
>
...
@@ -288,14 +289,14 @@ export default class Filter extends Component<Props, State> {
...
@@ -288,14 +289,14 @@ export default class Filter extends Component<Props, State> {
className=
{
classNames
(
styles
.
btn
,
styles
.
search
)
}
className=
{
classNames
(
styles
.
btn
,
styles
.
search
)
}
onClick=
{
this
.
saveFilterList
}
onClick=
{
this
.
saveFilterList
}
>
>
Search
{
locale
.
filterSearch
}
</
div
>
</
div
>
<
div
<
div
role=
"presentation"
role=
"presentation"
className=
{
classNames
(
styles
.
btn
,
styles
.
reset
)
}
className=
{
classNames
(
styles
.
btn
,
styles
.
reset
)
}
onClick=
{
this
.
resetFilterItem
}
onClick=
{
this
.
resetFilterItem
}
>
>
Reset
{
locale
.
filterReset
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
@@ -312,21 +313,28 @@ export default class Filter extends Component<Props, State> {
...
@@ -312,21 +313,28 @@ export default class Filter extends Component<Props, State> {
if
(
len
>
0
)
{
if
(
len
>
0
)
{
bg
=
'rgba(247,181,0,0.1)'
;
bg
=
'rgba(247,181,0,0.1)'
;
}
}
return
(
<
Consumer
>
{
({
locale
})
=>
{
const
txt
=
locale
.
filter
===
'筛选'
?
`${len}条筛选`
:
`Filtered by ${len} fields`
;
return
(
return
(
<
Popover
<
Popover
overlayClassName=
{
s
.
popover
}
overlayClassName=
{
s
.
popover
}
placement=
"bottomLeft"
placement=
"bottomLeft"
title=
"Filter"
title=
{
locale
.
filter
}
content=
{
this
.
renderContent
(
)
}
content=
{
this
.
renderContent
(
locale
)
}
visible=
{
visible
}
visible=
{
visible
}
onVisibleChange=
{
this
.
toggleOption
}
onVisibleChange=
{
this
.
toggleOption
}
trigger=
"click"
trigger=
"click"
>
>
<
div
className=
{
s
.
operateContainer
}
style=
{
{
background
:
bg
}
}
>
<
div
className=
{
s
.
operateContainer
}
style=
{
{
background
:
bg
}
}
>
<
img
alt=
""
className=
{
s
.
operateIcon
}
src=
{
filterIcon
}
/>
<
img
alt=
""
className=
{
s
.
operateIcon
}
src=
{
filterIcon
}
/>
<
span
className=
{
s
.
operateName
}
>
{
len
>
0
?
`Filtered by ${len} fields`
:
'Filter'
}
</
span
>
<
span
className=
{
s
.
operateName
}
>
{
len
>
0
?
txt
:
locale
.
filter
}
</
span
>
</
div
>
</
div
>
</
Popover
>
</
Popover
>
);
);
}
}
</
Consumer
>
);
}
}
}
}
components/apolloTable/component/hide/index.tsx
View file @
b645f18f
...
@@ -3,6 +3,7 @@ import { Switch, Popover } from 'antd';
...
@@ -3,6 +3,7 @@ import { Switch, Popover } from 'antd';
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
s
from
'./index.less'
;
import
s
from
'./index.less'
;
import
hideIcon
from
'../../assets/hide.png'
;
import
hideIcon
from
'../../assets/hide.png'
;
import
{
Consumer
}
from
'../context'
;
interface
Props
{
interface
Props
{
columns
:
any
;
columns
:
any
;
...
@@ -72,7 +73,7 @@ export default class Hide extends Component<Props, State> {
...
@@ -72,7 +73,7 @@ export default class Hide extends Component<Props, State> {
}
}
};
};
renderContent
=
()
=>
{
renderContent
=
(
locale
)
=>
{
const
{
columnConfig
}
=
this
.
state
;
const
{
columnConfig
}
=
this
.
state
;
return
(
return
(
<
div
className=
{
s
.
optionsModal
}
>
<
div
className=
{
s
.
optionsModal
}
>
...
@@ -95,10 +96,10 @@ export default class Hide extends Component<Props, State> {
...
@@ -95,10 +96,10 @@ export default class Hide extends Component<Props, State> {
</
div
>
</
div
>
<
div
className=
{
s
.
btns
}
>
<
div
className=
{
s
.
btns
}
>
<
div
className=
{
s
.
btn
}
role=
"presentation"
onClick=
{
this
.
changeHide
.
bind
(
this
,
'all'
,
0
)
}
>
<
div
className=
{
s
.
btn
}
role=
"presentation"
onClick=
{
this
.
changeHide
.
bind
(
this
,
'all'
,
0
)
}
>
Hide all
{
locale
.
hideHideAll
}
</
div
>
</
div
>
<
div
className=
{
s
.
btn
}
role=
"presentation"
onClick=
{
this
.
changeHide
.
bind
(
this
,
'all'
,
1
)
}
>
<
div
className=
{
s
.
btn
}
role=
"presentation"
onClick=
{
this
.
changeHide
.
bind
(
this
,
'all'
,
1
)
}
>
Show all
{
locale
.
hideShowAll
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
@@ -114,21 +115,30 @@ export default class Hide extends Component<Props, State> {
...
@@ -114,21 +115,30 @@ export default class Hide extends Component<Props, State> {
if
(
len
>
0
)
{
if
(
len
>
0
)
{
bg
=
'rgba(66,202,196,0.1)'
;
bg
=
'rgba(66,202,196,0.1)'
;
}
}
return
(
<
Consumer
>
{
({
locale
})
=>
{
const
txt
=
locale
.
hide
===
'隐藏'
?
`${len}条隐藏`
:
`${len} fields hidden`
;
return
(
return
(
<
Popover
<
Popover
overlayClassName=
{
s
.
popover
}
overlayClassName=
{
s
.
popover
}
placement=
"bottomLeft"
placement=
"bottomLeft"
title=
"Hide"
title=
{
locale
.
hide
}
content=
{
this
.
renderContent
(
)
}
content=
{
this
.
renderContent
(
locale
)
}
visible=
{
visible
}
visible=
{
visible
}
onVisibleChange=
{
this
.
toggleOption
}
onVisibleChange=
{
this
.
toggleOption
}
trigger=
"click"
trigger=
"click"
>
>
<
div
className=
{
s
.
operateContainer
}
style=
{
{
background
:
bg
}
}
>
<
div
className=
{
s
.
operateContainer
}
style=
{
{
background
:
bg
}
}
>
<
img
alt=
""
className=
{
s
.
operateIcon
}
src=
{
hideIcon
}
/>
<
img
alt=
""
className=
{
s
.
operateIcon
}
src=
{
hideIcon
}
/>
<
span
className=
{
s
.
operateName
}
>
{
len
>
0
?
`${len} fields hidden`
:
'Hide fields'
}
</
span
>
<
span
className=
{
s
.
operateName
}
>
{
len
>
0
?
txt
:
locale
.
hide
}
</
span
>
</
div
>
</
div
>
</
Popover
>
</
Popover
>
);
);
}
}
</
Consumer
>
);
}
}
}
}
components/apolloTable/component/index.less
View file @
b645f18f
...
@@ -4,13 +4,21 @@
...
@@ -4,13 +4,21 @@
//height: 100%;
//height: 100%;
width: 100%;
width: 100%;
position: relative;
position: relative;
.operateContainer {
&.scroll {
display: flex;
flex-direction: column;
height: calc(100vh - 92px);
}
.operateContainer {
}
}
.tableContainer {
.tableContainer {
position: relative;
position: relative;
box-shadow: @boxShadow;
box-shadow: @boxShadow;
//min-height: 600px;
//min-height: 600px;
&.scroll {
flex: 1;
}
.tableC {
.tableC {
padding: 0 16px;
padding: 0 16px;
...
...
components/apolloTable/component/index.tsx
View file @
b645f18f
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Pagination
}
from
'antd'
;
import
{
Pagination
}
from
'antd'
;
import
classNames
from
'classnames'
;
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
import
{
CommonProps
,
CommonState
}
from
'./interface'
;
import
{
CommonProps
,
CommonState
}
from
'./interface'
;
import
Table
from
'./Table'
;
import
Table
from
'./Table'
;
import
OperateConfig
from
'./operate'
;
import
OperateConfig
from
'./operate'
;
import
TableOperateConfig
from
'./tableOperate'
;
import
TableOperateConfig
from
'./tableOperate'
;
import
{
defaultLocale
}
from
'../locale'
;
import
{
Provider
}
from
'./context'
;
class
AirTable
extends
React
.
Component
<
CommonProps
,
CommonState
>
{
class
AirTable
extends
React
.
Component
<
CommonProps
,
CommonState
>
{
static
getDerivedStateFromProps
(
nextProps
:
CommonProps
,
prevState
:
CommonState
)
{
static
getDerivedStateFromProps
(
nextProps
:
CommonProps
,
prevState
:
CommonState
)
{
...
@@ -38,6 +41,19 @@ class AirTable extends React.Component<CommonProps, CommonState> {
...
@@ -38,6 +41,19 @@ class AirTable extends React.Component<CommonProps, CommonState> {
}
}
};
};
getContext
=
()
=>
{
const
{
locale
}
=
this
.
props
;
if
(
locale
)
{
if
(
locale
.
context
)
{
if
(
locale
.
lang
&&
defaultLocale
[
locale
.
lang
])
{
return
{
...
defaultLocale
[
locale
.
lang
],
...
locale
.
context
};
}
return
locale
.
context
;
}
}
return
defaultLocale
.
cn
;
};
render
()
{
render
()
{
const
{
columns
,
dataSource
}
=
this
.
state
;
const
{
columns
,
dataSource
}
=
this
.
state
;
const
{
const
{
...
@@ -61,16 +77,21 @@ class AirTable extends React.Component<CommonProps, CommonState> {
...
@@ -61,16 +77,21 @@ class AirTable extends React.Component<CommonProps, CommonState> {
columnWidth
,
columnWidth
,
headerHeight
,
headerHeight
,
contentMenu
,
contentMenu
,
onScroll
,
}
=
this
.
props
;
}
=
this
.
props
;
const
sortConfig
=
operateConfig
const
sortConfig
=
&&
operateConfig
.
menusGroup
operateConfig
&&
&&
operateConfig
.
menusGroup
.
find
((
item
:
any
)
=>
{
operateConfig
.
menusGroup
&&
operateConfig
.
menusGroup
.
find
((
item
:
any
)
=>
{
return
item
.
type
===
'sort'
;
return
item
.
type
===
'sort'
;
});
});
return
(
return
(
<
div
className=
{
styles
.
container
}
>
<
Provider
value=
{
{
locale
:
this
.
getContext
()
}
}
>
<
div
className=
{
onScroll
?
classNames
(
styles
.
container
,
styles
.
scroll
)
:
styles
.
container
}
>
{
operateConfig
&&
<
OperateConfig
columns=
{
columns
}
operateConfig=
{
operateConfig
}
/>
}
{
operateConfig
&&
<
OperateConfig
columns=
{
columns
}
operateConfig=
{
operateConfig
}
/>
}
<
div
className=
{
styles
.
tableContainer
}
>
<
div
className=
{
onScroll
?
classNames
(
styles
.
tableContainer
,
styles
.
scroll
)
:
styles
.
tableContainer
}
>
{
tableOperateConfig
&&
<
TableOperateConfig
operateConfig=
{
tableOperateConfig
}
/>
}
{
tableOperateConfig
&&
<
TableOperateConfig
operateConfig=
{
tableOperateConfig
}
/>
}
<
Table
<
Table
columns=
{
columns
}
columns=
{
columns
}
...
@@ -99,6 +120,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
...
@@ -99,6 +120,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
</
div
>
</
div
>
{
paginationConfig
&&
<
Pagination
{
...
paginationConfig
}
/>
}
{
paginationConfig
&&
<
Pagination
{
...
paginationConfig
}
/>
}
</
div
>
</
div
>
</
Provider
>
);
);
}
}
}
}
...
...
components/apolloTable/component/interface.tsx
View file @
b645f18f
...
@@ -70,7 +70,8 @@ export interface TableProps extends LoadConfigProps {
...
@@ -70,7 +70,8 @@ export interface TableProps extends LoadConfigProps {
loading
?:
boolean
;
loading
?:
boolean
;
rowSelection
?:
any
;
rowSelection
?:
any
;
noDataPlaceholder
?:
any
;
noDataPlaceholder
?:
any
;
contentMenu
?:
any
;
contentMenu
?:
any
;
loadComp
?:
any
;
}
}
export
interface
TableState
{
export
interface
TableState
{
columns
:
ColumnProps
[];
columns
:
ColumnProps
[];
...
@@ -82,6 +83,7 @@ export interface CommonProps extends TableProps {
...
@@ -82,6 +83,7 @@ export interface CommonProps extends TableProps {
operateConfig
?:
OperateConfigProps
;
operateConfig
?:
OperateConfigProps
;
tableOperateConfig
?:
OperateConfigProps
;
tableOperateConfig
?:
OperateConfigProps
;
paginationConfig
?:
any
;
paginationConfig
?:
any
;
locale
?:
any
;
}
}
export
interface
CommonState
extends
TableState
{}
export
interface
CommonState
extends
TableState
{}
...
@@ -112,7 +114,7 @@ export interface CellProps {
...
@@ -112,7 +114,7 @@ export interface CellProps {
emptyPlaceholder
?:
string
;
emptyPlaceholder
?:
string
;
cellEditable
?:
boolean
;
cellEditable
?:
boolean
;
rowSelection
?:
any
;
rowSelection
?:
any
;
contentMenu
?:
any
;
contentMenu
?:
any
;
}
}
export
interface
EditCellProps
{
export
interface
EditCellProps
{
...
...
components/apolloTable/component/sort/index.tsx
View file @
b645f18f
...
@@ -7,6 +7,7 @@ import styles from './index.less';
...
@@ -7,6 +7,7 @@ import styles from './index.less';
import
sortIcon
from
'../../assets/sort.png'
;
import
sortIcon
from
'../../assets/sort.png'
;
import
closeIcon
from
'../../assets/close.png'
;
import
closeIcon
from
'../../assets/close.png'
;
import
{
ColumnProps
}
from
'../interface'
;
import
{
ColumnProps
}
from
'../interface'
;
import
{
Consumer
}
from
'../context'
;
interface
Props
{
interface
Props
{
columns
:
any
;
columns
:
any
;
...
@@ -169,7 +170,7 @@ export default class Sort extends Component<Props, State> {
...
@@ -169,7 +170,7 @@ export default class Sort extends Component<Props, State> {
});
});
};
};
renderContent
=
()
=>
{
renderContent
=
(
locale
)
=>
{
const
{
sortConfig
,
temp
}
=
this
.
state
;
const
{
sortConfig
,
temp
}
=
this
.
state
;
const
filterConfig
=
this
.
getFilterConfig
();
const
filterConfig
=
this
.
getFilterConfig
();
return
(
return
(
...
@@ -182,7 +183,7 @@ export default class Sort extends Component<Props, State> {
...
@@ -182,7 +183,7 @@ export default class Sort extends Component<Props, State> {
value=
{
item
.
colName
}
value=
{
item
.
colName
}
onChange=
{
this
.
changeSortKey
.
bind
(
this
,
i
)
}
onChange=
{
this
.
changeSortKey
.
bind
(
this
,
i
)
}
style=
{
{
width
:
'100%'
}
}
style=
{
{
width
:
'100%'
}
}
placeholder=
"please select"
placeholder=
{
locale
.
select
}
>
>
{
filterConfig
.
map
((
option
)
=>
{
{
filterConfig
.
map
((
option
)
=>
{
return
(
return
(
...
@@ -207,7 +208,7 @@ export default class Sort extends Component<Props, State> {
...
@@ -207,7 +208,7 @@ export default class Sort extends Component<Props, State> {
}
}
onClick=
{
this
.
changeSortType
.
bind
(
this
,
i
,
'ASC'
)
}
onClick=
{
this
.
changeSortType
.
bind
(
this
,
i
,
'ASC'
)
}
>
>
ASC
{
locale
.
sortASC
}
</
Button
>
</
Button
>
<
Button
<
Button
className=
{
className=
{
...
@@ -217,7 +218,7 @@ export default class Sort extends Component<Props, State> {
...
@@ -217,7 +218,7 @@ export default class Sort extends Component<Props, State> {
}
}
onClick=
{
this
.
changeSortType
.
bind
(
this
,
i
,
'DESC'
)
}
onClick=
{
this
.
changeSortType
.
bind
(
this
,
i
,
'DESC'
)
}
>
>
DESC
{
locale
.
sortDESC
}
</
Button
>
</
Button
>
</
Button
.
Group
>
</
Button
.
Group
>
</
div
>
</
div
>
...
@@ -236,7 +237,7 @@ export default class Sort extends Component<Props, State> {
...
@@ -236,7 +237,7 @@ export default class Sort extends Component<Props, State> {
<
div
className=
{
styles
.
optionLeft
}
>
<
div
className=
{
styles
.
optionLeft
}
>
<
Select
<
Select
value=
{
temp
.
colName
}
value=
{
temp
.
colName
}
placeholder=
"please select"
placeholder=
{
locale
.
select
}
onChange=
{
this
.
changeColName
}
onChange=
{
this
.
changeColName
}
style=
{
{
width
:
'100%'
}
}
style=
{
{
width
:
'100%'
}
}
>
>
...
@@ -263,7 +264,7 @@ export default class Sort extends Component<Props, State> {
...
@@ -263,7 +264,7 @@ export default class Sort extends Component<Props, State> {
}
}
onClick=
{
this
.
changeNewSortType
.
bind
(
this
,
'ASC'
)
}
onClick=
{
this
.
changeNewSortType
.
bind
(
this
,
'ASC'
)
}
>
>
ASC
{
locale
.
sortASC
}
</
Button
>
</
Button
>
<
Button
<
Button
className=
{
className=
{
...
@@ -273,7 +274,7 @@ export default class Sort extends Component<Props, State> {
...
@@ -273,7 +274,7 @@ export default class Sort extends Component<Props, State> {
}
}
onClick=
{
this
.
changeNewSortType
.
bind
(
this
,
'DESC'
)
}
onClick=
{
this
.
changeNewSortType
.
bind
(
this
,
'DESC'
)
}
>
>
DESC
{
locale
.
sortDESC
}
</
Button
>
</
Button
>
</
Button
.
Group
>
</
Button
.
Group
>
</
div
>
</
div
>
...
@@ -285,7 +286,7 @@ export default class Sort extends Component<Props, State> {
...
@@ -285,7 +286,7 @@ export default class Sort extends Component<Props, State> {
className=
{
classNames
(
styles
.
btn
,
styles
.
reset
)
}
className=
{
classNames
(
styles
.
btn
,
styles
.
reset
)
}
onClick=
{
this
.
resetSortItem
}
onClick=
{
this
.
resetSortItem
}
>
>
Reset
{
locale
.
sortReset
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
@@ -302,21 +303,28 @@ export default class Sort extends Component<Props, State> {
...
@@ -302,21 +303,28 @@ export default class Sort extends Component<Props, State> {
if
(
len
>
0
)
{
if
(
len
>
0
)
{
bg
=
'rgba(92,153,255,0.2)'
;
bg
=
'rgba(92,153,255,0.2)'
;
}
}
return
(
<
Consumer
>
{
({
locale
})
=>
{
const
txt
=
locale
.
sort
===
'排序'
?
`${len}条排序`
:
`Sorted by ${len} fields`
;
return
(
return
(
<
Popover
<
Popover
overlayClassName=
{
s
.
popover
}
overlayClassName=
{
s
.
popover
}
placement=
"bottomLeft"
placement=
"bottomLeft"
title=
"Sort"
title=
{
locale
.
sort
}
content=
{
this
.
renderContent
(
)
}
content=
{
this
.
renderContent
(
locale
)
}
visible=
{
visible
}
visible=
{
visible
}
onVisibleChange=
{
this
.
toggleOption
}
onVisibleChange=
{
this
.
toggleOption
}
trigger=
"click"
trigger=
"click"
>
>
<
div
className=
{
s
.
operateContainer
}
style=
{
{
background
:
bg
}
}
>
<
div
className=
{
s
.
operateContainer
}
style=
{
{
background
:
bg
}
}
>
<
img
alt=
""
className=
{
s
.
operateIcon
}
src=
{
sortIcon
}
/>
<
img
alt=
""
className=
{
s
.
operateIcon
}
src=
{
sortIcon
}
/>
<
span
className=
{
s
.
operateName
}
>
{
len
>
0
?
`Sorted by ${len} fields`
:
'Sort'
}
</
span
>
<
span
className=
{
s
.
operateName
}
>
{
len
>
0
?
txt
:
locale
.
sort
}
</
span
>
</
div
>
</
div
>
</
Popover
>
</
Popover
>
);
);
}
}
</
Consumer
>
);
}
}
}
}
components/apolloTable/locale.ts
0 → 100644
View file @
b645f18f
export
const
defaultLocale
:
any
=
{
cn
:
{
empty
:
'暂无数据'
,
filter
:
'筛选'
,
filterAdd
:
'添加'
,
filterSearch
:
'查询'
,
filterReset
:
'重置'
,
selectedConditions
:
'已选条件:'
,
saveShortcut
:
'新建快捷筛选'
,
clearFilter
:
'重置'
,
sort
:
'排序'
,
sortReset
:
'重置'
,
sortASC
:
'正序'
,
sortDESC
:
'倒序'
,
group
:
'分组'
,
hide
:
'隐藏'
,
hideShowAll
:
'显示所有'
,
hideHideAll
:
'全部隐藏'
,
select
:
'请选择'
,
text
:
'请输入'
,
},
en
:
{
empty
:
'It’s empty here.'
,
filter
:
'Filter'
,
filterAdd
:
'Add'
,
filterSearch
:
'Search'
,
filterReset
:
'Reset'
,
selectedConditions
:
'Selected conditions:'
,
saveShortcut
:
'Save as a shortcut'
,
clearFilter
:
'Clear filters'
,
sort
:
'Sort'
,
sortReset
:
'Reset'
,
sortASC
:
'ASC'
,
sortDESC
:
'DESC'
,
group
:
'Group'
,
hide
:
'Hide'
,
hideShowAll
:
'Show all'
,
hideHideAll
:
'Hide all'
,
select
:
'please select'
,
text
:
'please input'
,
},
};
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