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
88 lines (88 loc) · 2.37 KB
/
meta.ts
File metadata and controls
88 lines (88 loc) · 2.37 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
module.exports = {
componentName: 'RichText',
title: '需求占位',
npm: {
package: '@alilc/lowcode-materials',
version: 'latest',
exportName: 'RichText',
main: '',
destructuring: true,
subName: '',
},
props: [
{
name: 'style',
propType: 'object',
},
],
configure: {
props: {
override: [
{
name: 'style',
propType: 'object',
},
{
name: 'maxHeight',
title: '最大高度',
propType: 'number',
setter: 'NumberSetter',
description: '最大高度',
},
{
name: 'content',
title: '需求内容',
display: 'inline',
supportVariable: true,
setter: {
componentName: 'EditSetter',
props: {
title: '编辑内容',
},
},
},
],
},
},
advanced: {
getResizingHandlers: () => {
return ['e'];
},
callbacks: {
onResizeStart: (e, currentNode) => {
const parent = currentNode.parent;
if (parent) {
const parentNode = parent.getDOMNode();
if (parentNode) {
currentNode.parentRect = parentNode.getBoundingClientRect();
}
}
currentNode.beforeSpan = currentNode.getPropValue('colSpan') || 12;
currentNode.startRect = currentNode.getRect();
},
onResize: (e, currentNode) => {
const { deltaX } = e;
const startWidth = currentNode.startRect
? currentNode.startRect.width
: currentNode.beforeSpan * (currentNode.parentRect.width / 12);
let width = startWidth + deltaX;
if (!currentNode.startRect) {
currentNode.startRect = {
width,
};
}
width = Math.max(0, width); // 不能小于0
width = Math.min(width, currentNode.parentRect.width); // 不能大于父容器宽度
currentNode.getDOMNode().style['width'] = `${Math.round(width)}px`;
},
onResizeEnd: (e, currentNode) => {
currentNode.setPropValue('style.width', currentNode.getDOMNode().style['width']);
},
},
},
icon: 'https://img.alicdn.com/imgextra/i3/O1CN01G7Lc8e1pZL7p4cdKc_!!6000000005374-2-tps-112-112.png',
category: '基础元素',
group: '精选组件',
snippets: require('./snippets'),
hidden: true,
};