Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
airtable
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
airtable
Commits
b4e046cd
Commit
b4e046cd
authored
Apr 02, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
dfb54cbd
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
15 deletions
+15
-15
Cell.tsx
src/apollo-table/component/Cell.tsx
+1
-0
getFormatter.tsx
src/apollo-table/component/base/_utils/getFormatter.tsx
+1
-1
setFormatter.tsx
src/apollo-table/component/base/_utils/setFormatter.tsx
+1
-1
index.tsx
src/apollo-table/component/base/edit/container/index.tsx
+7
-6
editInterface.tsx
src/apollo-table/component/base/edit/editInterface.tsx
+1
-3
index.tsx
src/apollo-table/component/base/edit/percentage/index.tsx
+2
-4
index.tsx
src/apollo-table/component/base/index.tsx
+2
-0
No files found.
src/apollo-table/component/Cell.tsx
View file @
b4e046cd
...
@@ -32,6 +32,7 @@ const Cell = (props: CellProps) => {
...
@@ -32,6 +32,7 @@ const Cell = (props: CellProps) => {
cellData
.
map
((
item
)
=>
{
cellData
.
map
((
item
)
=>
{
temp
.
push
({
text
:
item
.
text
,
value
:
item
.
value
});
temp
.
push
({
text
:
item
.
text
,
value
:
item
.
value
});
});
});
console
.
log
(
'cellData'
,
temp
)
if
(
_
.
isEqual
(
temp
,
changedValue
))
{
if
(
_
.
isEqual
(
temp
,
changedValue
))
{
setStatus
(
'detail'
);
setStatus
(
'detail'
);
return
;
return
;
...
...
src/apollo-table/component/base/_utils/getFormatter.tsx
View file @
b4e046cd
...
@@ -62,7 +62,7 @@ export const GetFormatter = {
...
@@ -62,7 +62,7 @@ export const GetFormatter = {
PERCENTAGE
:
(
val
)
=>
{
PERCENTAGE
:
(
val
)
=>
{
const
obj
=
Array
.
isArray
(
val
)
&&
val
.
length
>
0
?
val
[
0
]
:
{};
const
obj
=
Array
.
isArray
(
val
)
&&
val
.
length
>
0
?
val
[
0
]
:
{};
if
(
isNumber
(
obj
.
value
))
{
if
(
isNumber
(
obj
.
value
))
{
return
obj
.
value
/
100
;
return
obj
.
value
*
100
;
}
}
return
undefined
;
return
undefined
;
},
},
...
...
src/apollo-table/component/base/_utils/setFormatter.tsx
View file @
b4e046cd
...
@@ -63,7 +63,7 @@ export const SetFormatter = {
...
@@ -63,7 +63,7 @@ export const SetFormatter = {
},
},
PERCENTAGE
:
(
val
)
=>
{
PERCENTAGE
:
(
val
)
=>
{
if
(
!
isNumber
(
val
))
return
emptyModel
;
if
(
!
isNumber
(
val
))
return
emptyModel
;
val
=
val
*
100
;
val
=
val
/
100
;
return
SetFormatter
.
NUMBER
(
val
);
return
SetFormatter
.
NUMBER
(
val
);
},
},
DATE
:
(
val
,
config
)
=>
{
DATE
:
(
val
,
config
)
=>
{
...
...
src/apollo-table/component/base/edit/container/index.tsx
View file @
b4e046cd
...
@@ -3,21 +3,21 @@ import s from './index.less';
...
@@ -3,21 +3,21 @@ import s from './index.less';
import
{
antiAssign
}
from
'@/apollo-table/utils/utils'
;
import
{
antiAssign
}
from
'@/apollo-table/utils/utils'
;
interface
Props
{
interface
Props
{
value
:
any
;
onEmitChange
:
Function
;
onEmitChange
:
Function
;
}
}
interface
State
{
interface
State
{
value
:
any
;
value
:
any
;
option
:
any
;
option
:
any
;
}
}
const
CellContainer
=
(
Comp
)
=>
{
export
default
function
CellContainer
<
P
extends
Props
>
(
Comp
)
{
return
class
extends
React
.
Component
<
Props
,
State
>
{
return
class
extends
React
.
Component
<
P
&
P
rops
,
State
>
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
value
:
props
.
value
,
// 组件的值
value
:
props
.
value
,
// 组件的值
option
:
undefined
,
// 选择项
option
:
undefined
,
// 选择项
};
};
console
.
log
(
'props.value'
,
props
.
value
)
}
}
componentDidMount
():
void
{
componentDidMount
():
void
{
document
.
addEventListener
(
'click'
,
this
.
onBlur
,
false
);
document
.
addEventListener
(
'click'
,
this
.
onBlur
,
false
);
...
@@ -26,11 +26,13 @@ const CellContainer = (Comp) => {
...
@@ -26,11 +26,13 @@ const CellContainer = (Comp) => {
document
.
removeEventListener
(
'click'
,
this
.
onBlur
,
false
);
document
.
removeEventListener
(
'click'
,
this
.
onBlur
,
false
);
}
}
changeValue
=
(
value
:
any
,
option
:
any
)
=>
{
changeValue
=
(
value
:
any
,
option
:
any
)
=>
{
console
.
log
(
'value'
,
value
)
this
.
setState
({
value
,
option
});
this
.
setState
({
value
,
option
});
};
};
onBlur
=
()
=>
{
onBlur
=
()
=>
{
const
{
onEmitChange
}
=
this
.
props
;
const
{
onEmitChange
}
=
this
.
props
;
const
{
value
,
option
}
=
this
.
state
;
const
{
value
,
option
}
=
this
.
state
;
console
.
log
(
'state.value'
,
value
)
if
(
typeof
onEmitChange
===
'function'
)
{
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
value
,
option
);
onEmitChange
(
value
,
option
);
}
}
...
@@ -49,5 +51,4 @@ const CellContainer = (Comp) => {
...
@@ -49,5 +51,4 @@ const CellContainer = (Comp) => {
);
);
}
}
};
};
};
}
export
default
CellContainer
;
src/apollo-table/component/base/edit/editInterface.tsx
View file @
b4e046cd
...
@@ -40,9 +40,7 @@ export interface ApolloSelectProps extends SelectProps, CommonProps {
...
@@ -40,9 +40,7 @@ export interface ApolloSelectProps extends SelectProps, CommonProps {
options
?:
any
[];
options
?:
any
[];
}
}
export
interface
ApolloNumberProps
extends
InputNumberProps
,
CommonProps
{}
export
interface
ApolloNumberProps
extends
InputNumberProps
,
CommonProps
{}
export
interface
ApolloDateProps
extends
DatePickerProps
,
CommonProps
{
export
interface
ApolloDateProps
extends
DatePickerProps
,
CommonProps
{}
ref
?:
any
;
}
export
interface
ApolloCheckboxProps
extends
CheckboxProps
,
CommonProps
{
export
interface
ApolloCheckboxProps
extends
CheckboxProps
,
CommonProps
{
label
:
string
;
label
:
string
;
}
}
...
...
src/apollo-table/component/base/edit/percentage/index.tsx
View file @
b4e046cd
import
React
from
'react'
;
import
React
from
'react'
;
import
{
ApolloNumberProps
}
from
'../editInterface'
;
import
ApolloNumber
from
'@/apollo-table/component/base/edit/number'
;
import
ApolloNumber
from
'@/apollo-table/component/base/edit/number'
;
import
{
isNumber
}
from
'@/apollo-table/utils/utils'
;
import
{
isNumber
}
from
'@/apollo-table/utils/utils'
;
import
CellContainer
from
'../container'
;
const
ApolloPercentage
=
(
props
:
ApolloNumberProps
)
=>
{
const
ApolloPercentage
=
(
props
)
=>
{
return
(
return
(
<
ApolloNumber
<
ApolloNumber
{
...
props
}
{
...
props
}
...
@@ -24,4 +22,4 @@ const ApolloPercentage = (props: ApolloNumberProps) => {
...
@@ -24,4 +22,4 @@ const ApolloPercentage = (props: ApolloNumberProps) => {
);
);
};
};
export
default
CellContainer
(
ApolloPercentage
)
;
export
default
ApolloPercentage
;
src/apollo-table/component/base/index.tsx
View file @
b4e046cd
...
@@ -71,7 +71,9 @@ export const getComponent = (type: string) => {
...
@@ -71,7 +71,9 @@ export const getComponent = (type: string) => {
onEmitChange
=
(
changedValue
:
any
,
option
:
any
)
=>
{
onEmitChange
=
(
changedValue
:
any
,
option
:
any
)
=>
{
const
{
columnConfig
}
=
this
.
state
;
const
{
columnConfig
}
=
this
.
state
;
const
{
onEmitChange
}
=
this
.
props
;
const
{
onEmitChange
}
=
this
.
props
;
console
.
log
(
'changedValue'
,
changedValue
)
let
value
=
setFormat
(
columnConfig
,
changedValue
,
option
);
let
value
=
setFormat
(
columnConfig
,
changedValue
,
option
);
console
.
log
(
'formatValue'
,
value
)
if
(
typeof
onEmitChange
===
'function'
)
{
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
value
,
option
);
onEmitChange
(
value
,
option
);
}
}
...
...
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