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
5c0d3fbe
Commit
5c0d3fbe
authored
Aug 03, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update cell emit change
parent
85cca90f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
6 deletions
+43
-6
index.tsx
...nents/apolloTable/component/base/edit/container/index.tsx
+3
-3
index.tsx
...nents/apolloTable/component/base/edit/text-link/index.tsx
+13
-1
index.tsx
...onents/apolloTable/component/base/edit/textarea/index.tsx
+13
-1
index.tsx
components/apolloTable/component/base/edit/upload/index.tsx
+14
-1
No files found.
components/apolloTable/component/base/edit/container/index.tsx
View file @
5c0d3fbe
...
...
@@ -4,6 +4,7 @@ import { antiAssign } from '../../../../utils/utils';
interface
Props
{
onEmitChange
:
Function
;
tableId
:
string
|
number
;
}
interface
State
{
value
:
any
;
...
...
@@ -51,13 +52,12 @@ export default function CellContainer<P extends Props>(Comp) {
}
currTarget
=
currTarget
.
parentNode
;
}
const
{
onEmitChange
}
=
this
.
props
;
const
{
onEmitChange
,
tableId
}
=
this
.
props
;
const
{
value
,
option
}
=
this
.
state
;
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
value
,
option
);
// 清除所有dom的编辑状态
const
doms
=
document
.
querySelectorAll
(
'.cellUnit'
);
const
doms
=
document
.
querySelectorAll
(
`.cellUnit.table_
${
tableId
}
`
);
if
(
doms
)
{
doms
.
forEach
((
item
)
=>
{
item
.
setAttribute
(
'data-editing-cell'
,
'0'
);
...
...
components/apolloTable/component/base/edit/text-link/index.tsx
View file @
5c0d3fbe
...
...
@@ -7,7 +7,7 @@ import { ApolloTextAreaProps } from '../editInterface';
import
{
Consumer
}
from
'../../../context'
;
export
const
ApolloTextLink
=
(
props
:
ApolloTextAreaProps
)
=>
{
const
{
maxLength
,
onChange
,
value
,
onEmitChange
,
columnConfig
,
origin
}
=
props
;
const
{
maxLength
,
onChange
,
value
,
onEmitChange
,
columnConfig
,
origin
,
tableId
}
=
props
;
const
{
columnChsName
}
=
columnConfig
;
const
selfProps
=
antiAssign
(
props
,
[
'columnConfig'
,
...
...
@@ -58,10 +58,21 @@ export const ApolloTextLink = (props: ApolloTextAreaProps) => {
}
};
const
clearEdit
=
()
=>
{
// 清除所有dom的编辑状态
const
doms
=
document
.
querySelectorAll
(
`.cellUnit.table_
${
tableId
}
`
);
if
(
doms
)
{
doms
.
forEach
((
item
)
=>
{
item
.
setAttribute
(
'data-editing-cell'
,
'0'
);
});
}
};
const
hide
=
()
=>
{
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
value
);
}
clearEdit
();
setVisible
(
false
);
};
...
...
@@ -69,6 +80,7 @@ export const ApolloTextLink = (props: ApolloTextAreaProps) => {
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
curValue
);
}
clearEdit
();
setVisible
(
false
);
};
...
...
components/apolloTable/component/base/edit/textarea/index.tsx
View file @
5c0d3fbe
...
...
@@ -7,7 +7,7 @@ import { ApolloTextAreaProps } from '../editInterface';
import
{
Consumer
}
from
'../../../context'
;
export
const
ApolloTextArea
=
(
props
:
ApolloTextAreaProps
)
=>
{
const
{
maxLength
,
onChange
,
value
,
getDetail
,
rowData
,
onEmitChange
,
columnConfig
,
origin
}
=
props
;
const
{
maxLength
,
onChange
,
value
,
getDetail
,
rowData
,
onEmitChange
,
columnConfig
,
origin
,
tableId
}
=
props
;
const
{
columnChsName
}
=
columnConfig
;
const
selfProps
=
antiAssign
(
props
,
[
'columnConfig'
,
...
...
@@ -52,10 +52,21 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => {
}
};
const
clearEdit
=
()
=>
{
// 清除所有dom的编辑状态
const
doms
=
document
.
querySelectorAll
(
`.cellUnit.table_
${
tableId
}
`
);
if
(
doms
)
{
doms
.
forEach
((
item
)
=>
{
item
.
setAttribute
(
'data-editing-cell'
,
'0'
);
});
}
};
const
hide
=
()
=>
{
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
value
);
}
clearEdit
();
setVisible
(
false
);
};
...
...
@@ -63,6 +74,7 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => {
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
curValue
);
}
clearEdit
();
setVisible
(
false
);
};
...
...
components/apolloTable/component/base/edit/upload/index.tsx
View file @
5c0d3fbe
...
...
@@ -8,7 +8,7 @@ import { onBlurFn } from '../onBlurFn';
import
Upload
from
'../../extra/upload'
;
export
const
ApolloUpload
=
(
props
:
ApolloUploadProps
)
=>
{
const
{
isMultiple
,
onEmitChange
,
onChange
,
disabled
,
origin
}
=
props
;
const
{
isMultiple
,
onEmitChange
,
onChange
,
disabled
,
origin
,
tableId
}
=
props
;
const
selfProps
=
antiAssign
(
props
,
[
'onChange'
,
'value'
,
...
...
@@ -51,6 +51,16 @@ export const ApolloUpload = (props: ApolloUploadProps) => {
document
.
removeEventListener
(
'click'
,
onBlur
,
false
);
};
},
[]);
const
clearEdit
=
()
=>
{
// 清除所有dom的编辑状态
const
doms
=
document
.
querySelectorAll
(
`.cellUnit.table_
${
tableId
}
`
);
if
(
doms
)
{
doms
.
forEach
((
item
)
=>
{
item
.
setAttribute
(
'data-editing-cell'
,
'0'
);
});
}
};
const
onBlur
=
()
=>
{
// 当弹框显示时,不触发emit事件
if
(
refHelper
.
current
)
{
...
...
@@ -59,6 +69,7 @@ export const ApolloUpload = (props: ApolloUploadProps) => {
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
props
.
value
);
}
clearEdit
();
};
const
onOk
=
()
=>
{
if
(
typeof
onEmitChange
===
'function'
)
{
...
...
@@ -67,12 +78,14 @@ export const ApolloUpload = (props: ApolloUploadProps) => {
if
(
typeof
onChange
===
'function'
)
{
onChange
(
value
);
}
clearEdit
();
toggleUploadDialog
(
false
);
};
const
onCancel
=
()
=>
{
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
props
.
value
);
}
clearEdit
();
toggleUploadDialog
(
false
);
};
const
onClickContainer
=
(
e
)
=>
{
...
...
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