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
45c158dd
Commit
45c158dd
authored
Jul 23, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch1.0.1' into dev
parents
a136e052
49179a1a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
98 additions
and
24 deletions
+98
-24
IconFont.js
components/CustomIcon/IconFont.js
+1
-1
Cell.tsx
components/apolloTable/component/Cell.tsx
+11
-5
Column.tsx
components/apolloTable/component/Column.tsx
+8
-1
Table.tsx
components/apolloTable/component/Table.tsx
+12
-3
index.less
...ts/apolloTable/component/base/detail/text-link/index.less
+1
-0
index.tsx
...nts/apolloTable/component/base/detail/text-link/index.tsx
+1
-1
editInterface.tsx
components/apolloTable/component/base/edit/editInterface.tsx
+2
-0
index.tsx
components/apolloTable/component/base/edit/select/index.tsx
+14
-5
index.tsx
...lloTable/component/base/extra/associationSearch/index.tsx
+4
-1
index.tsx
...Table/component/base/extra/dataEntry/textSelect/index.tsx
+9
-6
index.tsx
components/apolloTable/component/index.tsx
+2
-0
interface.tsx
components/apolloTable/component/interface.tsx
+4
-0
index.tsx
components/apolloTable/editFormV3/index.tsx
+29
-1
No files found.
components/CustomIcon/IconFont.js
View file @
45c158dd
import
{
createFromIconfontCN
}
from
'@ant-design/icons'
;
const
IconFont
=
createFromIconfontCN
({
scriptUrl
:
'https://
influencer-attachment.mttop.cn/influencer/v2/website/20200629/iconF
ont.js'
,
scriptUrl
:
'https://
static.mttop.cn/website/20200723/iconFont.jsiconf
ont.js'
,
});
export
default
IconFont
;
components/apolloTable/component/Cell.tsx
View file @
45c158dd
...
...
@@ -33,6 +33,8 @@ const Cell = (props: CellProps) => {
rowSelection
,
columns
,
contentMenu
,
tableId
,
maxPopHeight
,
}
=
props
;
const
{
columnType
,
...
...
@@ -72,12 +74,14 @@ const Cell = (props: CellProps) => {
if
(
requiredFlag
)
{
if
(
!
changedValue
||
changedValue
.
length
===
0
)
{
message
.
error
(
'该字段为必填项'
);
setStatus
(
'detail'
);
return
;
}
if
(
changedValue
.
length
===
1
)
{
const
data
=
changedValue
[
0
];
if
(
!
data
.
value
&&
!
data
.
text
)
{
message
.
error
(
'该字段为必填项'
);
setStatus
(
'detail'
);
return
;
}
}
...
...
@@ -102,14 +106,14 @@ const Cell = (props: CellProps) => {
};
// 添加行hover样式
const
onMouseEnter
=
()
=>
{
const
doms
=
document
.
querySelectorAll
(
`.row_
${
rowIndex
}
`
);
const
doms
=
document
.
querySelectorAll
(
`.
table_
${
tableId
}
.
row_
${
rowIndex
}
`
);
doms
.
forEach
((
dom
)
=>
{
dom
.
classList
.
add
(
s
.
hover
);
});
};
// 去除行hover样式
const
onMouseLeave
=
()
=>
{
const
doms
=
document
.
querySelectorAll
(
`.row_
${
rowIndex
}
`
);
const
doms
=
document
.
querySelectorAll
(
`.
table_
${
tableId
}
.
row_
${
rowIndex
}
`
);
doms
.
forEach
((
dom
)
=>
{
dom
.
classList
.
remove
(
s
.
hover
);
});
...
...
@@ -240,7 +244,7 @@ const Cell = (props: CellProps) => {
// 否则进入选中状态
if
(
dom
)
{
// 先清除所有dom的选中状态及样式
const
doms
=
document
.
querySelectorAll
(
'.cellUnit'
);
const
doms
=
document
.
querySelectorAll
(
`.cellUnit.table_${tableId}`
);
if
(
doms
)
{
doms
.
forEach
((
item
)
=>
{
item
.
setAttribute
(
'data-selected-cell'
,
'0'
);
...
...
@@ -334,11 +338,13 @@ const Cell = (props: CellProps) => {
const
value
=
setFormat
(
editConfig
,
columnConfig
,
changedValue
,
optionValue
);
emitChangeCellData
(
value
,
optionValue
);
}
}
tableId=
{
tableId
}
cellRenderProps=
{
cellRenderProps
}
style=
{
{
minHeight
:
cellStyle
.
height
,
borderRadius
:
0
,
}
}
maxPopHeight=
{
maxPopHeight
}
/>
</
div
>
);
...
...
@@ -346,14 +352,14 @@ const Cell = (props: CellProps) => {
return
(
<
div
className=
{
classNames
(
s
.
cellContainer
,
`row_${rowIndex}`
,
`col_${columnIndex}`
,
cellClassName
)
}
className=
{
classNames
(
s
.
cellContainer
,
`
table_${tableId}`
,
`
row_${rowIndex}`
,
`col_${columnIndex}`
,
cellClassName
)
}
style=
{
cellStyle
}
onMouseEnter=
{
onMouseEnter
}
onMouseLeave=
{
onMouseLeave
}
>
{
columnIndex
===
0
&&
(
rowSelection
||
showExpand
||
showIndex
)
&&
renderFirst
()
}
<
div
className=
{
classNames
(
s
.
cellData
,
'cellUnit'
,
`row_${rowIndex}`
,
`col_${columnIndex}`
)
}
className=
{
classNames
(
s
.
cellData
,
'cellUnit'
,
`
table_${tableId}`
,
`
row_${rowIndex}`
,
`col_${columnIndex}`
)
}
id=
{
`cellUnit_${rowIndex}_${columnIndex}`
}
data
-
selected
-
cell=
"0"
data
-
editing
-
cell=
"0"
...
...
components/apolloTable/component/Column.tsx
View file @
45c158dd
...
...
@@ -82,10 +82,17 @@ export default class TableColumn extends PureComponent<ColumnProps> {
return
item
.
colName
===
columnName
;
});
const
{
sortType
}:
{
sortType
:
string
}
=
sort
||
{};
let
marginLeft
:
any
=
0
;
if
(
columnIndex
===
0
&&
(
rowSelection
||
showIndex
))
{
marginLeft
=
'56px'
;
if
(
!
rowSelection
)
{
marginLeft
=
'82px'
;
}
}
return
(
<
div
className=
{
s
.
colContainer
}
>
{
rowSelection
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
checkbox
}
>
{
this
.
getCheckbox
()
}
</
div
>
}
<
div
className=
{
s
.
colBrief
}
style=
{
{
marginLeft
:
showIndex
&&
columnIndex
===
0
?
'56px'
:
0
}
}
>
<
div
className=
{
s
.
colBrief
}
style=
{
{
marginLeft
}
}
>
{
icon
&&
<
div
className=
{
s
.
colIcon
}
>
{
icon
()
}
</
div
>
}
<
span
className=
{
required
?
classNames
(
s
.
colTitle
,
s
.
required
)
:
s
.
colTitle
}
>
{
columnChsName
}
...
...
components/apolloTable/component/Table.tsx
View file @
45c158dd
...
...
@@ -422,7 +422,8 @@ export default class AirTable extends Component<TableProps, TableState> {
}:
{
showColumns
:
ColumnProps
[];
showData
:
RowProps
;
position
?:
string
},
{
columnIndex
,
key
,
rowIndex
,
style
}:
any
,
)
=>
{
const
{
columns
,
dataSource
}
=
this
.
state
;
const
{
columns
,
dataSource
,
tableHeight
=
0
}
=
this
.
state
;
const
{
headerHeight
}
=
this
.
config
;
const
{
emitChangeCell
,
paginationConfig
,
...
...
@@ -434,6 +435,7 @@ export default class AirTable extends Component<TableProps, TableState> {
contentMenu
,
rowClassName
,
rowStyle
,
tableId
,
}
=
this
.
props
;
if
(
showColumns
.
length
===
0
||
showData
.
length
===
0
)
{
return
;
...
...
@@ -479,6 +481,11 @@ export default class AirTable extends Component<TableProps, TableState> {
cellData
,
});
let
maxPopHeight
=
(
tableHeight
-
headerHeight
)
/
2
;
if
(
maxPopHeight
>
250
)
{
maxPopHeight
=
250
;
}
return
(
<
Cell
key=
{
key
}
...
...
@@ -501,12 +508,14 @@ export default class AirTable extends Component<TableProps, TableState> {
contentMenu=
{
contentMenu
}
cellKey=
{
key
}
position=
{
position
}
tableId=
{
tableId
}
maxPopHeight=
{
maxPopHeight
}
/>
);
};
render
()
{
const
{
loading
,
noDataPlaceholder
,
loadComp
,
canFixed
}
=
this
.
props
;
const
{
loading
,
noDataPlaceholder
,
loadComp
,
canFixed
,
tableId
}
=
this
.
props
;
const
{
columns
,
dataSource
,
tableWidth
=
0
,
tableHeight
=
0
}
=
this
.
state
;
const
{
overscanColumnCount
,
overscanRowCount
,
rowHeight
,
headerHeight
,
columnWidth
}
=
this
.
config
;
const
scrollbarWidth
=
scrollbarSize
()
||
0
;
...
...
@@ -548,7 +557,7 @@ export default class AirTable extends Component<TableProps, TableState> {
style=
{
{
paddingRight
:
this
.
props
.
onScroll
?
paddingRight
:
0
,
}
}
id=
"tableContainer"
id=
{
`apolloTable_${tableId}`
}
ref=
{
(
dom
)
=>
{
this
.
tableContainer
=
dom
;
}
}
...
...
components/apolloTable/component/base/detail/text-link/index.less
View file @
45c158dd
...
...
@@ -44,6 +44,7 @@
cursor: pointer;
text-align: center;
display: none;
color: #B7CCFE;
.extend {
width: 14px;
border-radius: 50%;
...
...
components/apolloTable/component/base/detail/text-link/index.tsx
View file @
45c158dd
...
...
@@ -130,7 +130,7 @@ export const ApolloTextLinkDetail = (props: any) => {
changeEdit
();
}
}
>
<
IconFont
type=
"iconzhankai1"
/>
<
IconFont
type=
"iconzhankai1
1
"
/>
</
div
>
)
}
</
div
>
...
...
components/apolloTable/component/base/edit/editInterface.tsx
View file @
45c158dd
...
...
@@ -13,6 +13,8 @@ export interface LinkData {
export
interface
CommonProps
{
onEmitChange
?:
Function
;
isMobile
?:
boolean
;
origin
?:
string
;
tableId
?:
string
|
number
;
}
export
interface
ApolloInputProps
extends
InputProps
,
CommonProps
{
value
:
string
|
undefined
;
...
...
components/apolloTable/component/base/edit/select/index.tsx
View file @
45c158dd
...
...
@@ -6,9 +6,9 @@ import { antiAssign } from '../../../../utils/utils';
import
styles
from
'./styles.less'
;
export
const
ApolloSelect
=
(
props
:
ApolloSelectProps
)
=>
{
const
{
options
=
[],
onChange
,
isMultiple
,
origin
}
=
props
;
const
selfProps
=
antiAssign
(
props
,
[
'columnConfig'
,
'onChange'
,
'isMultiple'
,
'options'
]);
const
isOpen
=
useRef
();
const
{
options
=
[],
onChange
,
isMultiple
,
origin
,
maxPopHeight
}
=
props
;
const
selfProps
=
antiAssign
(
props
,
[
'columnConfig'
,
'onChange'
,
'isMultiple'
,
'options'
,
'maxPopHeight'
]);
const
isOpen
:
any
=
useRef
();
if
(
isMultiple
)
{
selfProps
.
mode
=
'multiple'
;
...
...
@@ -30,12 +30,16 @@ export const ApolloSelect = (props: ApolloSelectProps) => {
onBlurFn
(
props
);
}
};
return
(
origin
===
'editForm'
?
return
origin
===
'editForm'
?
(
<
Select
className=
{
styles
.
select
}
{
...
selfProps
}
onChange=
{
changeValue
}
onDropdownVisibleChange=
{
selfProps
.
mode
===
'multiple'
?
multipleBlurFn
:
singleBlurFn
}
dropdownStyle=
{
{
maxHeight
:
maxPopHeight
,
}
}
>
{
options
.
map
((
item
)
=>
{
return
(
...
...
@@ -44,10 +48,15 @@ export const ApolloSelect = (props: ApolloSelectProps) => {
</
Select
.
Option
>
);
})
}
</
Select
>
:
<
Select
</
Select
>
)
:
(
<
Select
className=
{
styles
.
select
}
{
...
selfProps
}
onChange=
{
changeValue
}
dropdownStyle=
{
{
maxHeight
:
maxPopHeight
,
}
}
>
{
options
.
map
((
item
)
=>
{
return
(
...
...
components/apolloTable/component/base/extra/associationSearch/index.tsx
View file @
45c158dd
...
...
@@ -227,7 +227,7 @@ class AssociationSearch extends React.Component<Props, State> {
render
()
{
const
{
data
,
value
}
=
this
.
state
;
const
{
selfCom
,
autoFocus
,
onChange
,
...
rest
}
=
this
.
props
;
const
{
selfCom
,
autoFocus
,
onChange
,
maxPopHeight
,
...
rest
}
=
this
.
props
;
return
(
<
Consumer
>
{
({
locale
}:
any
)
=>
{
...
...
@@ -243,6 +243,9 @@ class AssociationSearch extends React.Component<Props, State> {
onChange=
{
this
.
handleChange
}
onFocus=
{
this
.
onFocus
}
onBlur=
{
this
.
onBlur
}
dropdownStyle=
{
{
maxHeight
:
maxPopHeight
,
}
}
>
{
data
.
map
((
d
:
any
)
=>
{
return
(
...
...
components/apolloTable/component/base/extra/dataEntry/textSelect/index.tsx
View file @
45c158dd
...
...
@@ -137,11 +137,7 @@ class TextSelect extends React.Component<Props, State> {
onChange
=
(
obj
)
=>
{
const
{
onChange
}
=
this
.
props
;
if
(
typeof
onChange
===
'function'
)
{
if
(
!
obj
||
(
!
obj
.
label
&&
!
obj
.
value
))
{
onChange
(
undefined
);
}
else
{
onChange
(
obj
);
}
onChange
(
obj
);
}
};
...
...
@@ -158,7 +154,11 @@ class TextSelect extends React.Component<Props, State> {
};
onVisibleChange
=
(
tempVisible
)
=>
{
const
{
onDropdownVisibleChange
}
=
this
.
props
;
this
.
setState
({
tempVisible
});
if
(
onDropdownVisibleChange
)
{
onDropdownVisibleChange
(
tempVisible
);
}
};
renderList
=
()
=>
{
...
...
@@ -198,13 +198,16 @@ class TextSelect extends React.Component<Props, State> {
};
render
()
{
const
{
placeholder
,
disabled
}
=
this
.
props
;
const
{
placeholder
,
disabled
,
maxPopHeight
}
=
this
.
props
;
const
{
searchStr
}
=
this
.
state
;
return
(
<
div
className=
{
styles
.
textSelectContainer
}
ref=
{
this
.
container
}
>
<
Dropdown
trigger=
{
[
'click'
]
}
overlayClassName=
{
styles
.
overlayClassName
}
overlayStyle=
{
{
maxHeight
:
maxPopHeight
,
}
}
onVisibleChange=
{
this
.
onVisibleChange
}
placement=
"bottomLeft"
overlay=
{
this
.
renderList
()
}
...
...
components/apolloTable/component/index.tsx
View file @
45c158dd
...
...
@@ -86,6 +86,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
canFixed
,
id
,
onDragSorted
,
tableId
,
}
=
this
.
props
;
const
sortConfig
=
operateConfig
&&
operateConfig
.
menusGroup
...
...
@@ -145,6 +146,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
loadComp=
{
loadComp
}
canFixed=
{
canFixed
}
onDragSorted=
{
onDragSorted
}
tableId=
{
tableId
}
/>
</
div
>
</
div
>
...
...
components/apolloTable/component/interface.tsx
View file @
45c158dd
...
...
@@ -77,6 +77,7 @@ export interface TableProps extends LoadConfigProps {
canSorted
?:
boolean
;
// 是否可以拖拽自定义列排序
canResized
?:
boolean
;
// 是否可以拖拽自定义列伸缩
onDragSorted
?:
Function
;
// 拖拽更改列排序回调
tableId
?:
string
|
number
;
// tableId
}
export
interface
TableState
{
columns
:
ColumnProps
[];
...
...
@@ -93,6 +94,7 @@ export interface CommonProps extends TableProps {
tableClassName
?:
string
;
showCondition
?:
boolean
;
id
?:
string
;
tableId
?:
string
|
number
;
}
export
interface
CommonState
extends
TableState
{}
...
...
@@ -130,6 +132,8 @@ export interface CellProps {
selectedCell
?:
any
;
changeSelectedCell
?:
Function
;
position
:
string
;
tableId
?:
string
|
number
;
maxPopHeight
?:
string
|
number
;
}
export
interface
EditCellProps
{
...
...
components/apolloTable/editFormV3/index.tsx
View file @
45c158dd
...
...
@@ -89,6 +89,30 @@ class FormWrap extends Component {
);
};
validateRequired
=
(
item
,
rule
,
value
,
callback
)
=>
{
if
(
!
item
.
requiredFlag
)
{
return
callback
();
}
if
(
!
value
)
{
return
callback
(
'必填项不能为空'
);
}
if
(
Array
.
isArray
(
value
))
{
if
(
value
.
length
===
0
)
{
return
callback
(
'必填项不能为空'
);
}
const
[
first
]
=
value
;
if
(
!
first
.
text
&&
first
.
text
!==
0
&&
!
first
.
value
&&
first
.
value
!==
0
)
{
return
callback
(
'必填项不能为空'
);
}
}
if
(
typeof
value
===
'object'
)
{
if
(
!
value
.
text
&&
value
.
text
!==
0
&&
!
value
.
value
&&
value
.
value
!==
0
)
{
return
callback
(
'必填项不能为空'
);
}
}
return
callback
();
};
renderEditForm
=
(
item
)
=>
{
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
const
{
rowData
,
rowId
,
getInstanceDetail
,
onBlurFn
}
=
this
.
props
;
...
...
@@ -141,7 +165,11 @@ class FormWrap extends Component {
{
getFieldDecorator
(
columnName
,
{
validateFirst
,
validateTrigger
,
rules
:
[{
required
:
!!
item
.
requiredFlag
,
message
:
'必填项不能为空'
},
...
rules
],
rules
:
[
{
required
:
!!
item
.
requiredFlag
,
message
:
'必填项不能为空'
},
{
validator
:
this
.
validateRequired
.
bind
(
this
,
item
)
},
...
rules
,
],
initialValue
:
getFormat
(
detailConfig
,
item
,
value
),
})(
<
EditComp
...
...
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