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
cc13ce4b
Commit
cc13ce4b
authored
Jul 27, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加编辑状态数据同步
parent
e16b0b50
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
Cell.tsx
components/apolloTable/component/Cell.tsx
+2
-5
index.tsx
...nents/apolloTable/component/base/edit/container/index.tsx
+11
-0
No files found.
components/apolloTable/component/Cell.tsx
View file @
cc13ce4b
import
React
,
{
use
Effect
,
useMemo
,
use
State
,
useRef
}
from
'react'
;
import
React
,
{
useState
,
useRef
}
from
'react'
;
import
{
Checkbox
,
message
,
Popover
}
from
'antd'
;
import
{
Checkbox
,
message
,
Popover
}
from
'antd'
;
import
classNames
from
'classnames'
;
import
classNames
from
'classnames'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
{
config
}
from
'./base/config'
;
import
{
config
}
from
'./base/config'
;
import
{
get
EditComponent
,
get
Format
,
setFormat
}
from
'./base'
;
import
{
getFormat
,
setFormat
}
from
'./base'
;
import
s
from
'./Cell.less'
;
import
s
from
'./Cell.less'
;
import
{
CellProps
,
CellDataProps
}
from
'./interface'
;
import
{
CellProps
,
CellDataProps
}
from
'./interface'
;
import
FormHelper
from
'../utils/formHelper'
;
import
FormHelper
from
'../utils/formHelper'
;
import
firstIcon
from
'../assets/first.png'
;
import
secondIcon
from
'../assets/second.png'
;
import
thirdIcon
from
'../assets/third.png'
;
import
expandIcon
from
'../assets/extend.png'
;
import
expandIcon
from
'../assets/extend.png'
;
import
{
transferAttr
}
from
'./base/_utils/transferAttr'
;
import
{
transferAttr
}
from
'./base/_utils/transferAttr'
;
import
{
emptyModel
}
from
'@/submodule/components/apolloTable/component/base/_utils/setFormatter'
;
import
{
emptyModel
}
from
'@/submodule/components/apolloTable/component/base/_utils/setFormatter'
;
...
...
components/apolloTable/component/base/edit/container/index.tsx
View file @
cc13ce4b
...
@@ -8,6 +8,7 @@ interface Props {
...
@@ -8,6 +8,7 @@ interface Props {
interface
State
{
interface
State
{
value
:
any
;
value
:
any
;
option
:
any
;
option
:
any
;
propsValue
:
any
;
}
}
export
default
function
CellContainer
<
P
extends
Props
>
(
Comp
)
{
export
default
function
CellContainer
<
P
extends
Props
>
(
Comp
)
{
return
class
extends
React
.
Component
<
P
&
Props
,
State
>
{
return
class
extends
React
.
Component
<
P
&
Props
,
State
>
{
...
@@ -15,11 +16,21 @@ export default function CellContainer<P extends Props>(Comp) {
...
@@ -15,11 +16,21 @@ export default function CellContainer<P extends Props>(Comp) {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
propsValue
:
props
.
value
,
// 组件的原值
value
:
props
.
value
,
// 组件的值
value
:
props
.
value
,
// 组件的值
option
:
undefined
,
// 选择项
option
:
undefined
,
// 选择项
};
};
this
.
container
=
React
.
createRef
();
this
.
container
=
React
.
createRef
();
}
}
static
getDerivedStateFromProps
(
nextProps
:
any
,
prevState
:
any
)
{
if
(
JSON
.
stringify
(
prevState
.
propsValue
)
!==
JSON
.
stringify
(
nextProps
.
value
))
{
return
{
propsValue
:
nextProps
.
value
,
value
:
nextProps
.
value
,
};
}
return
null
;
}
componentDidMount
():
void
{
componentDidMount
():
void
{
document
.
addEventListener
(
'click'
,
this
.
onBlur
,
false
);
document
.
addEventListener
(
'click'
,
this
.
onBlur
,
false
);
}
}
...
...
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