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
2210d571
Commit
2210d571
authored
Jul 22, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改cell id,增加消息方法
parent
9c2a6098
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
Cell.tsx
components/apolloTable/component/Cell.tsx
+14
-4
Table.tsx
components/apolloTable/component/Table.tsx
+2
-0
index.tsx
components/apolloTable/component/index.tsx
+2
-0
interface.tsx
components/apolloTable/component/interface.tsx
+3
-0
No files found.
components/apolloTable/component/Cell.tsx
View file @
2210d571
...
@@ -33,6 +33,7 @@ const Cell = (props: CellProps) => {
...
@@ -33,6 +33,7 @@ const Cell = (props: CellProps) => {
rowSelection
,
rowSelection
,
columns
,
columns
,
contentMenu
,
contentMenu
,
onEmitMsg
,
}
=
props
;
}
=
props
;
const
{
const
{
columnType
,
columnType
,
...
@@ -46,9 +47,9 @@ const Cell = (props: CellProps) => {
...
@@ -46,9 +47,9 @@ const Cell = (props: CellProps) => {
const
cellUnit
=
useRef
(
null
);
const
cellUnit
=
useRef
(
null
);
const
[
status
,
setStatus
]
=
useState
(
'detail'
);
const
[
status
,
setStatus
]
=
useState
(
'detail'
);
useEffect
(()
=>
{
//
useEffect(() => {
setStatus
(
'detail'
);
//
setStatus('detail');
},
[
cellData
]);
//
}, [cellData]);
const
changeCellData
=
(
changedValue
:
any
,
option
?:
any
)
=>
{};
const
changeCellData
=
(
changedValue
:
any
,
option
?:
any
)
=>
{};
const
emitChangeCellData
=
(
changedValue
:
any
,
optionValue
:
any
)
=>
{
const
emitChangeCellData
=
(
changedValue
:
any
,
optionValue
:
any
)
=>
{
...
@@ -62,6 +63,9 @@ const Cell = (props: CellProps) => {
...
@@ -62,6 +63,9 @@ const Cell = (props: CellProps) => {
if
(
_
.
isEqual
(
temp
,
changedValue
))
{
if
(
_
.
isEqual
(
temp
,
changedValue
))
{
setStatus
(
'detail'
);
setStatus
(
'detail'
);
if
(
typeof
onEmitMsg
===
'function'
)
{
onEmitMsg
({
status
:
'free'
});
}
return
;
return
;
}
}
changeValue
(
changedValue
,
optionValue
);
changeValue
(
changedValue
,
optionValue
);
...
@@ -99,6 +103,9 @@ const Cell = (props: CellProps) => {
...
@@ -99,6 +103,9 @@ const Cell = (props: CellProps) => {
});
});
}
}
setStatus
(
'detail'
);
setStatus
(
'detail'
);
if
(
typeof
onEmitMsg
===
'function'
)
{
onEmitMsg
({
status
:
'free'
});
}
};
};
// 添加行hover样式
// 添加行hover样式
const
onMouseEnter
=
()
=>
{
const
onMouseEnter
=
()
=>
{
...
@@ -232,6 +239,9 @@ const Cell = (props: CellProps) => {
...
@@ -232,6 +239,9 @@ const Cell = (props: CellProps) => {
if
(
selected
)
{
if
(
selected
)
{
// 当前已选中,则进入编辑状态
// 当前已选中,则进入编辑状态
setStatus
(
'edit'
);
setStatus
(
'edit'
);
if
(
typeof
onEmitMsg
===
'function'
)
{
onEmitMsg
({
rowId
:
record
.
id
,
columnName
,
status
:
'editing'
});
}
if
(
dom
)
{
if
(
dom
)
{
// 给当前dom添加编辑状态
// 给当前dom添加编辑状态
dom
.
setAttribute
(
'data-editing-cell'
,
'1'
);
dom
.
setAttribute
(
'data-editing-cell'
,
'1'
);
...
@@ -354,7 +364,7 @@ const Cell = (props: CellProps) => {
...
@@ -354,7 +364,7 @@ const Cell = (props: CellProps) => {
{
columnIndex
===
0
&&
(
rowSelection
||
showExpand
||
showIndex
)
&&
renderFirst
()
}
{
columnIndex
===
0
&&
(
rowSelection
||
showExpand
||
showIndex
)
&&
renderFirst
()
}
<
div
<
div
className=
{
classNames
(
s
.
cellData
,
'cellUnit'
,
`row_${rowIndex}`
,
`col_${columnIndex}`
)
}
className=
{
classNames
(
s
.
cellData
,
'cellUnit'
,
`row_${rowIndex}`
,
`col_${columnIndex}`
)
}
id=
{
`cellUnit_${r
owIndex}_${columnIndex
}`
}
id=
{
`cellUnit_${r
ecord.id}_${columnName
}`
}
data
-
selected
-
cell=
"0"
data
-
selected
-
cell=
"0"
data
-
editing
-
cell=
"0"
data
-
editing
-
cell=
"0"
ref=
{
cellUnit
}
ref=
{
cellUnit
}
...
...
components/apolloTable/component/Table.tsx
View file @
2210d571
...
@@ -434,6 +434,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -434,6 +434,7 @@ export default class AirTable extends Component<TableProps, TableState> {
contentMenu
,
contentMenu
,
rowClassName
,
rowClassName
,
rowStyle
,
rowStyle
,
onEmitMsg
,
}
=
this
.
props
;
}
=
this
.
props
;
if
(
showColumns
.
length
===
0
||
showData
.
length
===
0
)
{
if
(
showColumns
.
length
===
0
||
showData
.
length
===
0
)
{
return
;
return
;
...
@@ -501,6 +502,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -501,6 +502,7 @@ export default class AirTable extends Component<TableProps, TableState> {
contentMenu=
{
contentMenu
}
contentMenu=
{
contentMenu
}
cellKey=
{
key
}
cellKey=
{
key
}
position=
{
position
}
position=
{
position
}
onEmitMsg=
{
onEmitMsg
}
/>
/>
);
);
};
};
...
...
components/apolloTable/component/index.tsx
View file @
2210d571
...
@@ -86,6 +86,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
...
@@ -86,6 +86,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
canFixed
,
canFixed
,
id
,
id
,
onDragSorted
,
onDragSorted
,
onEmitMsg
,
}
=
this
.
props
;
}
=
this
.
props
;
const
sortConfig
=
operateConfig
const
sortConfig
=
operateConfig
&&
operateConfig
.
menusGroup
&&
operateConfig
.
menusGroup
...
@@ -145,6 +146,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
...
@@ -145,6 +146,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
loadComp=
{
loadComp
}
loadComp=
{
loadComp
}
canFixed=
{
canFixed
}
canFixed=
{
canFixed
}
onDragSorted=
{
onDragSorted
}
onDragSorted=
{
onDragSorted
}
onEmitMsg=
{
onEmitMsg
}
/>
/>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
components/apolloTable/component/interface.tsx
View file @
2210d571
...
@@ -77,6 +77,7 @@ export interface TableProps extends LoadConfigProps {
...
@@ -77,6 +77,7 @@ export interface TableProps extends LoadConfigProps {
canSorted
?:
boolean
;
// 是否可以拖拽自定义列排序
canSorted
?:
boolean
;
// 是否可以拖拽自定义列排序
canResized
?:
boolean
;
// 是否可以拖拽自定义列伸缩
canResized
?:
boolean
;
// 是否可以拖拽自定义列伸缩
onDragSorted
?:
Function
;
// 拖拽更改列排序回调
onDragSorted
?:
Function
;
// 拖拽更改列排序回调
onEmitMsg
?:
Function
;
}
}
export
interface
TableState
{
export
interface
TableState
{
columns
:
ColumnProps
[];
columns
:
ColumnProps
[];
...
@@ -93,6 +94,7 @@ export interface CommonProps extends TableProps {
...
@@ -93,6 +94,7 @@ export interface CommonProps extends TableProps {
tableClassName
?:
string
;
tableClassName
?:
string
;
showCondition
?:
boolean
;
showCondition
?:
boolean
;
id
?:
string
;
id
?:
string
;
onEmitMsg
?:
Function
;
}
}
export
interface
CommonState
extends
TableState
{}
export
interface
CommonState
extends
TableState
{}
...
@@ -130,6 +132,7 @@ export interface CellProps {
...
@@ -130,6 +132,7 @@ export interface CellProps {
selectedCell
?:
any
;
selectedCell
?:
any
;
changeSelectedCell
?:
Function
;
changeSelectedCell
?:
Function
;
position
:
string
;
position
:
string
;
onEmitMsg
?:
Function
;
}
}
export
interface
EditCellProps
{
export
interface
EditCellProps
{
...
...
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