forked from alibaba/lowcode-materials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeta.ts
More file actions
143 lines (143 loc) · 3.38 KB
/
meta.ts
File metadata and controls
143 lines (143 loc) · 3.38 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
module.exports = {
group: '原子组件',
componentName: 'ResponsiveGrid',
title: '布局容器',
docUrl: '',
screenshot: '',
npm: {
package: '@alifd/next',
version: '{{version}}',
exportName: 'ResponsiveGrid',
main: '',
destructuring: true,
subName: '',
},
props: [
{
name: 'className',
propType: 'any',
},
{
name: 'device',
propType: {
type: 'oneOf',
value: ['phone', 'tablet', 'desktop'],
},
description: '设备,用来做自适应,默认为PC',
defaultValue: 'desktop',
},
{
name: 'columns',
propType: 'number',
description: '分为几列',
defaultValue: 12,
},
{
name: 'style',
propType: 'object',
},
],
configure: {
component: {
isContainer: true,
},
props: [
{
name: 'layout',
title: '布局',
defaultValue: '6:6',
// setter: {
// componentName: 'NewArraySetter',
// props: {
// itemSetter: {
// componentName: 'NumberSetter',
// }
// }
// },
setter: {
componentName: 'StringSetter',
},
extraProps: {
setValue(target, value) {
// 解析x:y:z的数据形式,排除不符合规范的传入
let arrValue = value.split(':');
arrValue = arrValue.filter((item) => {
return item && item.trim(); // 去除空数组项
});
const flag = arrValue.find((item) => {
return isNaN(Number(item));
});
if (flag) {
return;
}
const node = target.node;
node.children.mergeChildren(
(child, index) => {
child.setPropValue('colSpan', arrValue[index]);
return index >= arrValue.length;
},
(children) => {
let l = children.length;
const items = [];
while (l++ < arrValue.length) {
items.push({
componentName: 'ResponsiveGrid.Cell',
props: {
colSpan: arrValue[l - 1] || 1,
},
});
}
return items;
},
null,
);
},
},
},
{
name: 'gap',
title: '列间距',
defaultValue: 0,
setter: {
componentName: 'MixedSetter',
props: {
setters: [
{
componentName: 'NumberSetter',
props: {
defaultValue: 8,
},
},
{
componentName: 'JsonSetter',
props: {
defaultValue: [8, 4],
},
},
'ExpressionSetter',
],
},
},
},
{
name: 'dense',
title: '紧密模式',
defaultValue: false,
setter: {
componentName: 'MixedSetter',
props: {
setters: ['BoolSetter', 'ExpressionSetter'],
},
},
},
{
name: 'style',
setter: {
componentName: 'StyleSetter',
},
},
],
},
icon: '',
category: '布局容器类',
};