forked from giscafer/sailor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddProjectModal.tsx
More file actions
60 lines (57 loc) · 1.73 KB
/
Copy pathAddProjectModal.tsx
File metadata and controls
60 lines (57 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import {schema2component} from './AMISRenderer';
export default schema2component(
{
type: 'dialog',
title: '新增项目',
body: {
type: 'form',
controls: [
{
type: 'text',
label: '项目名称',
name: 'name',
validations: {
maxLength: 20
},
required: true
},
{
type: 'text',
label: '项目标识',
name: 'path',
validations: {
isUrlPath: true
},
required: true,
validate(values: any, value: string) {
const exists = !!values.pages.filter((item: any) => item.path === value).length;
return exists ? '当前项目标识已被占用,请换一个' : '';
}
},
{
type: 'textarea',
label: '项目描述',
name: 'description',
maxLength: 200,
validations: {
maxLength: 200
}
}
/* {
type: 'icon-picker',
label: '图标',
name: 'icon'
} */
]
}
},
({onConfirm, pages, ...rest}: any) => {
return {
...rest,
data: {
pages
},
onConfirm: (values: Array<any>) => onConfirm && onConfirm(values[0])
};
}
);