Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
najiu-frontend
najiu-admin-template
Commits
93006c7d
Unverified
Commit
93006c7d
authored
May 26, 2021
by
Netfan
Committed by
GitHub
May 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(table): add editable DatePicker & TimePicker (#654)
为表格的可编辑单元格添加日期选择框和时间选择框组件
parent
4f0d45f1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
3 deletions
+73
-3
table-demo.ts
mock/demo/table-demo.ts
+2
-0
componentMap.ts
src/components/Table/src/componentMap.ts
+11
-1
helper.ts
src/components/Table/src/components/editable/helper.ts
+3
-1
componentType.ts
src/components/Table/src/types/componentType.ts
+3
-1
EditCellTable.vue
src/views/demo/table/EditCellTable.vue
+22
-0
EditRowTable.vue
src/views/demo/table/EditRowTable.vue
+32
-0
No files found.
mock/demo/table-demo.ts
View file @
93006c7d
...
...
@@ -18,6 +18,8 @@ const demoList = (() => {
name6
:
'
@cname()
'
,
name7
:
'
@cname()
'
,
name8
:
'
@cname()
'
,
date
:
`@date('yyyy-MM-dd')`
,
time
:
`@time('HH:mm')`
,
'
no|100000-10000000
'
:
100000
,
'
status|1
'
:
[
'
normal
'
,
'
enable
'
,
'
disable
'
],
});
...
...
src/components/Table/src/componentMap.ts
View file @
93006c7d
import
type
{
Component
}
from
'
vue
'
;
import
{
Input
,
Select
,
Checkbox
,
InputNumber
,
Switch
}
from
'
ant-design-vue
'
;
import
{
Input
,
Select
,
Checkbox
,
InputNumber
,
Switch
,
DatePicker
,
TimePicker
,
}
from
'
ant-design-vue
'
;
import
type
{
ComponentType
}
from
'
./types/componentType
'
;
import
{
ApiSelect
}
from
'
/@/components/Form
'
;
...
...
@@ -14,6 +22,8 @@ componentMap.set('Select', Select);
componentMap
.
set
(
'
ApiSelect
'
,
ApiSelect
);
componentMap
.
set
(
'
Switch
'
,
Switch
);
componentMap
.
set
(
'
Checkbox
'
,
Checkbox
);
componentMap
.
set
(
'
DatePicker
'
,
DatePicker
);
componentMap
.
set
(
'
TimePicker
'
,
TimePicker
);
export
function
add
(
compName
:
ComponentType
,
component
:
Component
)
{
componentMap
.
set
(
compName
,
component
);
...
...
src/components/Table/src/components/editable/helper.ts
View file @
93006c7d
...
...
@@ -18,7 +18,9 @@ export function createPlaceholderMessage(component: ComponentType) {
component
.
includes
(
'
Select
'
)
||
component
.
includes
(
'
Checkbox
'
)
||
component
.
includes
(
'
Radio
'
)
||
component
.
includes
(
'
Switch
'
)
component
.
includes
(
'
Switch
'
)
||
component
.
includes
(
'
DatePicker
'
)
||
component
.
includes
(
'
TimePicker
'
)
)
{
return
t
(
'
common.chooseText
'
);
}
...
...
src/components/Table/src/types/componentType.ts
View file @
93006c7d
...
...
@@ -4,4 +4,6 @@ export type ComponentType =
|
'
Select
'
|
'
ApiSelect
'
|
'
Checkbox
'
|
'
Switch
'
;
|
'
Switch
'
|
'
DatePicker
'
|
'
TimePicker
'
;
src/views/demo/table/EditCellTable.vue
View file @
93006c7d
...
...
@@ -87,6 +87,28 @@
},
width
:
200
,
},
{
title
:
'
日期选择
'
,
dataIndex
:
'
date
'
,
edit
:
true
,
editComponent
:
'
DatePicker
'
,
editComponentProps
:
{
valueFormat
:
'
YYYY-MM-DD
'
,
format
:
'
YYYY-MM-DD
'
,
},
width
:
200
,
},
{
title
:
'
时间选择
'
,
dataIndex
:
'
time
'
,
edit
:
true
,
editComponent
:
'
TimePicker
'
,
editComponentProps
:
{
valueFormat
:
'
HH:mm
'
,
format
:
'
HH:mm
'
,
},
width
:
200
,
},
{
title
:
'
勾选框
'
,
dataIndex
:
'
name5
'
,
...
...
src/views/demo/table/EditRowTable.vue
View file @
93006c7d
...
...
@@ -93,6 +93,38 @@
},
width
:
200
,
},
{
title
:
'
日期选择
'
,
dataIndex
:
'
date
'
,
editRow
:
true
,
editComponent
:
'
DatePicker
'
,
editComponentProps
:
{
valueFormat
:
'
YYYY-MM-DD
'
,
format
:
'
YYYY-MM-DD
'
,
},
width
:
200
,
},
{
title
:
'
时间选择
'
,
dataIndex
:
'
time
'
,
editRow
:
true
,
editComponent
:
'
TimePicker
'
,
editComponentProps
:
{
valueFormat
:
'
HH:mm
'
,
format
:
'
HH:mm
'
,
},
width
:
200
,
},
{
title
:
'
远程下拉
'
,
dataIndex
:
'
name4
'
,
editRow
:
true
,
editComponent
:
'
ApiSelect
'
,
editComponentProps
:
{
api
:
optionsListApi
,
},
width
:
200
,
},
{
title
:
'
勾选框
'
,
dataIndex
:
'
name5
'
,
...
...
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