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
39a62173
Commit
39a62173
authored
Jul 16, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改新业务兼容
parent
990424b2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
27 deletions
+26
-27
Cell.tsx
components/apolloTable/component/Cell.tsx
+1
-0
Table.tsx
components/apolloTable/component/Table.tsx
+4
-14
index.tsx
components/apolloTable/component/base/detail/tag/index.tsx
+7
-3
index.tsx
...nts/apolloTable/component/base/edit/text-select/index.tsx
+2
-2
interface.tsx
components/apolloTable/component/interface.tsx
+0
-1
index.tsx
components/apolloTable/editFormV3/index.tsx
+12
-7
No files found.
components/apolloTable/component/Cell.tsx
View file @
39a62173
...
@@ -334,6 +334,7 @@ const Cell = (props: CellProps) => {
...
@@ -334,6 +334,7 @@ const Cell = (props: CellProps) => {
const
value
=
setFormat
(
editConfig
,
columnConfig
,
changedValue
,
optionValue
);
const
value
=
setFormat
(
editConfig
,
columnConfig
,
changedValue
,
optionValue
);
emitChangeCellData
(
value
,
optionValue
);
emitChangeCellData
(
value
,
optionValue
);
}
}
}
}
cellRenderProps=
{
cellRenderProps
}
style=
{
{
style=
{
{
minHeight
:
cellStyle
.
height
,
minHeight
:
cellStyle
.
height
,
borderRadius
:
0
,
borderRadius
:
0
,
...
...
components/apolloTable/component/Table.tsx
View file @
39a62173
...
@@ -55,11 +55,9 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -55,11 +55,9 @@ export default class AirTable extends Component<TableProps, TableState> {
};
};
if
(
JSON
.
stringify
(
dataSource
)
!==
JSON
.
stringify
(
nextProps
.
dataSource
))
{
if
(
JSON
.
stringify
(
dataSource
)
!==
JSON
.
stringify
(
nextProps
.
dataSource
))
{
nextState
.
dataSource
=
nextProps
.
dataSource
;
nextState
.
dataSource
=
nextProps
.
dataSource
;
nextState
.
selectedCell
=
null
;
}
}
if
(
JSON
.
stringify
(
columns
)
!==
JSON
.
stringify
(
nextProps
.
columns
))
{
if
(
JSON
.
stringify
(
columns
)
!==
JSON
.
stringify
(
nextProps
.
columns
))
{
nextState
.
columns
=
nextProps
.
columns
;
nextState
.
columns
=
nextProps
.
columns
;
nextState
.
selectedCell
=
null
;
}
}
return
nextState
;
return
nextState
;
}
}
...
@@ -72,7 +70,6 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -72,7 +70,6 @@ export default class AirTable extends Component<TableProps, TableState> {
dataSource
,
dataSource
,
tableWidth
:
width
,
tableWidth
:
width
,
tableHeight
:
height
,
tableHeight
:
height
,
selectedCell
:
null
,
};
};
this
.
config
=
{
this
.
config
=
{
overscanColumnCount
:
5
,
overscanColumnCount
:
5
,
...
@@ -216,12 +213,6 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -216,12 +213,6 @@ export default class AirTable extends Component<TableProps, TableState> {
}
}
};
};
changeSelectedCell
=
(
key
)
=>
{
this
.
setState
({
selectedCell
:
key
,
});
};
// 列伸缩回调
// 列伸缩回调
onResizeWidth
=
(
e
)
=>
{
onResizeWidth
=
(
e
)
=>
{
const
originLeft
=
(
this
.
tableContainer
&&
this
.
tableContainer
.
getBoundingClientRect
().
x
)
||
0
;
const
originLeft
=
(
this
.
tableContainer
&&
this
.
tableContainer
.
getBoundingClientRect
().
x
)
||
0
;
...
@@ -312,10 +303,10 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -312,10 +303,10 @@ export default class AirTable extends Component<TableProps, TableState> {
}
}
};
};
// 拖拽排序回调
// 拖拽排序回调
onDragSorted
=
(
dragColumn
:
any
,
dropColumn
:
any
)
=>
{
onDragSorted
=
(
dragColumn
:
any
,
dropColumn
:
any
)
=>
{
const
{
onDragSorted
}
=
this
.
props
;
const
{
onDragSorted
}
=
this
.
props
;
const
{
columns
}
=
this
.
state
;
const
{
columns
}
=
this
.
state
;
const
newColumns
:
any
[]
=
[];
const
newColumns
:
any
[]
=
[];
columns
.
map
((
item
)
=>
{
columns
.
map
((
item
)
=>
{
if
(
dragColumn
.
orderNo
>
dropColumn
.
orderNo
)
{
if
(
dragColumn
.
orderNo
>
dropColumn
.
orderNo
)
{
if
(
item
.
orderNo
>=
dropColumn
.
orderNo
&&
item
.
orderNo
<=
dragColumn
.
orderNo
)
{
if
(
item
.
orderNo
>=
dropColumn
.
orderNo
&&
item
.
orderNo
<=
dragColumn
.
orderNo
)
{
...
@@ -387,6 +378,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -387,6 +378,7 @@ export default class AirTable extends Component<TableProps, TableState> {
>
>
<
ResizableBox
<
ResizableBox
width=
{
style
.
width
}
width=
{
style
.
width
}
height=
{
style
.
height
}
handle=
{
handle=
{
<
span
<
span
className=
{
styles
.
handleWidth
}
className=
{
styles
.
handleWidth
}
...
@@ -430,7 +422,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -430,7 +422,7 @@ export default class AirTable extends Component<TableProps, TableState> {
}:
{
showColumns
:
ColumnProps
[];
showData
:
RowProps
;
position
?:
string
},
}:
{
showColumns
:
ColumnProps
[];
showData
:
RowProps
;
position
?:
string
},
{
columnIndex
,
key
,
rowIndex
,
style
}:
any
,
{
columnIndex
,
key
,
rowIndex
,
style
}:
any
,
)
=>
{
)
=>
{
const
{
columns
,
dataSource
,
selectedCell
}
=
this
.
state
;
const
{
columns
,
dataSource
}
=
this
.
state
;
const
{
const
{
emitChangeCell
,
emitChangeCell
,
paginationConfig
,
paginationConfig
,
...
@@ -507,8 +499,6 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -507,8 +499,6 @@ export default class AirTable extends Component<TableProps, TableState> {
cellEditable=
{
cellEditable
}
cellEditable=
{
cellEditable
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
contentMenu=
{
contentMenu
}
contentMenu=
{
contentMenu
}
selectedCell=
{
selectedCell
}
changeSelectedCell=
{
this
.
changeSelectedCell
}
cellKey=
{
key
}
cellKey=
{
key
}
position=
{
position
}
position=
{
position
}
/>
/>
...
...
components/apolloTable/component/base/detail/tag/index.tsx
View file @
39a62173
...
@@ -6,6 +6,9 @@ import s from './index.less';
...
@@ -6,6 +6,9 @@ import s from './index.less';
export
const
Tags
=
(
props
:
any
)
=>
{
export
const
Tags
=
(
props
:
any
)
=>
{
const
{
value
,
origin
,
componentAttr
,
columnConfig
}
=
props
;
const
{
value
,
origin
,
componentAttr
,
columnConfig
}
=
props
;
if
(
!
Array
.
isArray
(
value
)
||
value
.
length
===
0
)
return
null
;
if
(
!
Array
.
isArray
(
value
)
||
value
.
length
===
0
)
return
null
;
if
(
value
.
length
===
1
&&
!
value
[
0
].
text
&&
!
value
[
0
].
value
)
{
return
null
;
}
const
{
options
,
mode
}
=
componentAttr
||
{};
const
{
options
,
mode
}
=
componentAttr
||
{};
const
outStyle
:
any
=
{};
const
outStyle
:
any
=
{};
const
innerStyle
:
any
=
{};
const
innerStyle
:
any
=
{};
...
@@ -18,9 +21,10 @@ export const Tags = (props: any) => {
...
@@ -18,9 +21,10 @@ export const Tags = (props: any) => {
const
getColor
=
(
item
:
any
)
=>
{
const
getColor
=
(
item
:
any
)
=>
{
let
color
=
''
;
let
color
=
''
;
if
(
options
&&
Array
.
isArray
(
options
)
&&
options
.
length
>
0
)
{
if
(
options
&&
Array
.
isArray
(
options
)
&&
options
.
length
>
0
)
{
const
obj
=
options
.
find
((
ls
)
=>
{
const
obj
=
return
String
(
ls
.
id
)
===
String
(
item
.
value
);
options
.
find
((
ls
)
=>
{
})
||
{};
return
String
(
ls
.
id
)
===
String
(
item
.
value
);
})
||
{};
color
=
obj
.
color
||
'e9eef9'
;
color
=
obj
.
color
||
'e9eef9'
;
}
}
return
color
;
return
color
;
...
...
components/apolloTable/component/base/edit/text-select/index.tsx
View file @
39a62173
...
@@ -5,7 +5,7 @@ import { antiAssign } from '../../../../utils/utils';
...
@@ -5,7 +5,7 @@ import { antiAssign } from '../../../../utils/utils';
import
s
from
'./index.less'
;
import
s
from
'./index.less'
;
export
const
ApolloInputSearch
=
(
props
:
ApolloInputSearchProps
)
=>
{
export
const
ApolloInputSearch
=
(
props
:
ApolloInputSearchProps
)
=>
{
const
{
onChange
,
request
,
type
}
=
props
;
const
{
onChange
,
request
}
=
props
;
const
selfProps
=
antiAssign
(
props
,
[
'columnConfig'
,
'onChange'
,
'request'
]);
const
selfProps
=
antiAssign
(
props
,
[
'columnConfig'
,
'onChange'
,
'request'
]);
const
changeValue
=
(
value
)
=>
{
const
changeValue
=
(
value
)
=>
{
...
@@ -17,7 +17,7 @@ export const ApolloInputSearch = (props: ApolloInputSearchProps) => {
...
@@ -17,7 +17,7 @@ export const ApolloInputSearch = (props: ApolloInputSearchProps) => {
return
(
return
(
<
InputSearch
<
InputSearch
className=
{
s
.
select
}
className=
{
s
.
select
}
request=
{
(
val
)
=>
{
return
request
({
name
:
val
,
fieldValueName
:
type
});
}
}
request=
{
request
}
fieldNames=
{
{
value
:
'fieldValueValue'
,
label
:
'fieldValueName'
}
}
fieldNames=
{
{
value
:
'fieldValueValue'
,
label
:
'fieldValueName'
}
}
{
...
selfProps
}
{
...
selfProps
}
onChange=
{
changeValue
}
onChange=
{
changeValue
}
...
...
components/apolloTable/component/interface.tsx
View file @
39a62173
...
@@ -83,7 +83,6 @@ export interface TableState {
...
@@ -83,7 +83,6 @@ export interface TableState {
dataSource
:
RowProps
[];
dataSource
:
RowProps
[];
tableHeight
?:
number
;
tableHeight
?:
number
;
tableWidth
?:
number
;
tableWidth
?:
number
;
selectedCell
?:
any
;
}
}
export
interface
CommonProps
extends
TableProps
{
export
interface
CommonProps
extends
TableProps
{
operateConfig
?:
OperateConfigProps
;
operateConfig
?:
OperateConfigProps
;
...
...
components/apolloTable/editFormV3/index.tsx
View file @
39a62173
...
@@ -25,7 +25,7 @@ class FormWrap extends Component {
...
@@ -25,7 +25,7 @@ class FormWrap extends Component {
handleSubmit
=
(
e
)
=>
{
handleSubmit
=
(
e
)
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
e
.
stopPropagation
();
e
.
stopPropagation
();
const
{
rowId
,
form
,
handleSubmit
,
data
,
rowData
}
=
this
.
props
;
const
{
rowId
,
form
,
handleSubmit
,
data
,
rowData
,
detailType
}
=
this
.
props
;
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
const
newValues
:
any
[]
=
[];
const
newValues
:
any
[]
=
[];
...
@@ -33,7 +33,7 @@ class FormWrap extends Component {
...
@@ -33,7 +33,7 @@ class FormWrap extends Component {
const
item
=
data
.
find
((
temp
:
any
)
=>
{
const
item
=
data
.
find
((
temp
:
any
)
=>
{
return
temp
.
columnName
===
key
;
return
temp
.
columnName
===
key
;
});
});
const
{
columnType
,
renderEditForm
,
readOnlyFlag
,
dynamicCellConfigDTO
}
=
item
;
const
{
columnType
,
columnAttrObj
,
renderEditForm
,
readOnlyFlag
,
dynamicCellConfigDTO
}
=
item
;
if
(
readOnlyFlag
||
(
dynamicCellConfigDTO
&&
dynamicCellConfigDTO
.
readonlyFlag
))
{
if
(
readOnlyFlag
||
(
dynamicCellConfigDTO
&&
dynamicCellConfigDTO
.
readonlyFlag
))
{
return
;
return
;
}
}
...
@@ -44,13 +44,15 @@ class FormWrap extends Component {
...
@@ -44,13 +44,15 @@ class FormWrap extends Component {
detailConfig
=
config
[
String
(
columnType
)]
||
config
[
'1'
];
detailConfig
=
config
[
String
(
columnType
)]
||
config
[
'1'
];
}
}
const
cellValueList
=
setFormat
(
detailConfig
,
item
,
values
[
key
]);
const
cellValueList
=
setFormat
(
detailConfig
,
item
,
values
[
key
]);
newValues
.
push
(
{
const
newData
:
any
=
{
columnCode
:
key
,
columnCode
:
key
,
cellValueList
,
cellValueList
,
});
};
newValues
.
push
(
newData
);
});
});
if
(
typeof
handleSubmit
===
'function'
)
{
if
(
typeof
handleSubmit
===
'function'
)
{
handleSubmit
({
data
:
{
value
:
newValues
}
});
handleSubmit
({
data
:
{
value
:
newValues
}
,
formValues
:
values
,
detailType
});
}
}
}
}
});
});
...
@@ -82,7 +84,7 @@ class FormWrap extends Component {
...
@@ -82,7 +84,7 @@ class FormWrap extends Component {
renderEditForm
=
(
item
)
=>
{
renderEditForm
=
(
item
)
=>
{
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
const
{
rowData
}
=
this
.
props
;
const
{
rowData
,
rowId
}
=
this
.
props
;
const
{
const
{
columnType
,
columnType
,
columnName
,
columnName
,
...
@@ -94,6 +96,7 @@ class FormWrap extends Component {
...
@@ -94,6 +96,7 @@ class FormWrap extends Component {
validateFirst
=
true
,
validateFirst
=
true
,
validateTrigger
=
'onChange'
,
validateTrigger
=
'onChange'
,
dynamicCellConfigDTO
,
dynamicCellConfigDTO
,
cellRenderProps
,
}
=
item
;
}
=
item
;
let
detailConfig
:
any
;
let
detailConfig
:
any
;
if
(
typeof
renderEditForm
===
'function'
)
{
if
(
typeof
renderEditForm
===
'function'
)
{
...
@@ -114,13 +117,15 @@ class FormWrap extends Component {
...
@@ -114,13 +117,15 @@ class FormWrap extends Component {
{
getFieldDecorator
(
columnName
,
{
{
getFieldDecorator
(
columnName
,
{
validateFirst
,
validateFirst
,
validateTrigger
,
validateTrigger
,
rules
:
[{
required
:
!!
item
.
requiredFlag
,
message
:
'必填项不能为空'
},
...
rules
],
//
rules: [
{
required
:
!!
item
.
requiredFlag
,
message
:
'必填项不能为空'
},
...
rules
],
initialValue
:
getFormat
(
detailConfig
,
item
,
value
),
initialValue
:
getFormat
(
detailConfig
,
item
,
value
),
})(
})(
<
EditComp
<
EditComp
{
...
transferColumn
}
{
...
transferColumn
}
columnConfig=
{
item
}
columnConfig=
{
item
}
disabled=
{
disabled
}
disabled=
{
disabled
}
rowData=
{
{
id
:
rowId
,
rowData
}
}
cellRenderProps=
{
cellRenderProps
}
origin=
"editForm"
origin=
"editForm"
form=
{
this
.
props
.
form
}
form=
{
this
.
props
.
form
}
/>,
/>,
...
...
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