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
62249dc2
Commit
62249dc2
authored
Jul 02, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update data- param
parent
db1fcf46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
Cell.tsx
components/apolloTable/component/Cell.tsx
+7
-7
index.tsx
...nents/apolloTable/component/base/edit/container/index.tsx
+2
-2
No files found.
components/apolloTable/component/Cell.tsx
View file @
62249dc2
...
@@ -201,15 +201,15 @@ const Cell = (props: CellProps) => {
...
@@ -201,15 +201,15 @@ const Cell = (props: CellProps) => {
// 获取当前节点的选中状态
// 获取当前节点的选中状态
const
dom
=
cellUnit
.
current
;
const
dom
=
cellUnit
.
current
;
let
selected
=
false
;
let
selected
=
false
;
if
(
dom
&&
dom
.
getAttribute
(
'data-selected
C
ell'
))
{
if
(
dom
&&
dom
.
getAttribute
(
'data-selected
-c
ell'
))
{
selected
=
dom
.
getAttribute
(
'data-selected
C
ell'
)
===
'1'
;
selected
=
dom
.
getAttribute
(
'data-selected
-c
ell'
)
===
'1'
;
}
}
if
(
selected
)
{
if
(
selected
)
{
// 当前已选中,则进入编辑状态
// 当前已选中,则进入编辑状态
setStatus
(
'edit'
);
setStatus
(
'edit'
);
if
(
dom
)
{
if
(
dom
)
{
// 给当前dom添加编辑状态
// 给当前dom添加编辑状态
dom
.
setAttribute
(
'data-editing
C
ell'
,
'1'
);
dom
.
setAttribute
(
'data-editing
-c
ell'
,
'1'
);
}
}
}
else
{
}
else
{
// 否则进入选中状态
// 否则进入选中状态
...
@@ -218,12 +218,12 @@ const Cell = (props: CellProps) => {
...
@@ -218,12 +218,12 @@ const Cell = (props: CellProps) => {
const
doms
=
document
.
querySelectorAll
(
'.cellUnit'
);
const
doms
=
document
.
querySelectorAll
(
'.cellUnit'
);
if
(
doms
)
{
if
(
doms
)
{
doms
.
forEach
((
item
)
=>
{
doms
.
forEach
((
item
)
=>
{
item
.
setAttribute
(
'data-selected
C
ell'
,
'0'
);
item
.
setAttribute
(
'data-selected
-c
ell'
,
'0'
);
item
.
classList
.
remove
(
s
.
selected
);
item
.
classList
.
remove
(
s
.
selected
);
});
});
}
}
// 给当前dom添加选中状态
// 给当前dom添加选中状态
dom
.
setAttribute
(
'data-selected
C
ell'
,
'1'
);
dom
.
setAttribute
(
'data-selected
-c
ell'
,
'1'
);
// 给当前dom添加选中样式
// 给当前dom添加选中样式
dom
.
classList
.
add
(
s
.
selected
);
dom
.
classList
.
add
(
s
.
selected
);
}
}
...
@@ -346,8 +346,8 @@ const Cell = (props: CellProps) => {
...
@@ -346,8 +346,8 @@ const Cell = (props: CellProps) => {
className=
{
classNames
(
'cellUnit'
,
`row_${rowIndex}`
,
`col_${columnIndex}`
,
cellClassName
)
}
className=
{
classNames
(
'cellUnit'
,
`row_${rowIndex}`
,
`col_${columnIndex}`
,
cellClassName
)
}
style=
{
cellStyle
}
style=
{
cellStyle
}
id=
{
`cellUnit_${rowIndex}_${columnIndex}`
}
id=
{
`cellUnit_${rowIndex}_${columnIndex}`
}
data
-
selected
C
ell=
"0"
data
-
selected
-
c
ell=
"0"
data
-
editing
C
ell=
"0"
data
-
editing
-
c
ell=
"0"
onMouseEnter=
{
onMouseEnter
}
onMouseEnter=
{
onMouseEnter
}
onMouseLeave=
{
onMouseLeave
}
onMouseLeave=
{
onMouseLeave
}
ref=
{
cellUnit
}
ref=
{
cellUnit
}
...
...
components/apolloTable/component/base/edit/container/index.tsx
View file @
62249dc2
...
@@ -32,7 +32,7 @@ export default function CellContainer<P extends Props>(Comp) {
...
@@ -32,7 +32,7 @@ export default function CellContainer<P extends Props>(Comp) {
onBlur
=
(
e
:
any
)
=>
{
onBlur
=
(
e
:
any
)
=>
{
let
currTarget
=
e
.
target
;
let
currTarget
=
e
.
target
;
while
(
currTarget
!=
document
)
{
while
(
currTarget
!=
document
)
{
let
editing
=
currTarget
.
getAttribute
(
'data-editing
C
ell'
);
let
editing
=
currTarget
.
getAttribute
(
'data-editing
-c
ell'
);
// 当前点击div是正在编辑的cell时,阻止修改回调
// 当前点击div是正在编辑的cell时,阻止修改回调
if
(
editing
===
'1'
)
{
if
(
editing
===
'1'
)
{
return
;
return
;
...
@@ -48,7 +48,7 @@ export default function CellContainer<P extends Props>(Comp) {
...
@@ -48,7 +48,7 @@ export default function CellContainer<P extends Props>(Comp) {
const
doms
=
document
.
querySelectorAll
(
'.cellUnit'
);
const
doms
=
document
.
querySelectorAll
(
'.cellUnit'
);
if
(
doms
)
{
if
(
doms
)
{
doms
.
forEach
((
item
)
=>
{
doms
.
forEach
((
item
)
=>
{
item
.
setAttribute
(
'data-editing
C
ell'
,
'0'
);
item
.
setAttribute
(
'data-editing
-c
ell'
,
'0'
);
});
});
}
}
}
}
...
...
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