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
| import type { QualityComponentDefinition } from '../core/types';
|
| import { escapeHtmlMultiline } from '../core/html';
| import { QUALITY_ICONS } from '../core/icons';
| import { QUALITY_CATEGORY } from '../core/types';
|
| export const textDefinition: QualityComponentDefinition = {
| type: 'Text',
| name: 'text',
| label: '文本',
| category: QUALITY_CATEGORY.BASIC,
| icon: QUALITY_ICONS.text,
| aiHint:
| '兜底的纯文字段落。只有在没有任何专门组件合适时才用我——页眉、页脚、样品信息、判定结论都各有专门组件,不要图省事都用我。',
| contentKey: 'text',
| defaults: { text: '在此输入文本内容', align: 'left' },
| propertySchema: [
| {
| key: 'text',
| label: '文本内容',
| type: 'text',
| defaultValue: '在此输入文本内容',
| bindable: true,
| },
| {
| key: 'align',
| label: '对齐方式',
| type: 'enum',
| defaultValue: 'left',
| options: [
| { label: '左对齐', value: 'left' },
| { label: '居中', value: 'center' },
| { label: '右对齐', value: 'right' },
| ],
| },
| ],
| dataSchema: [{ key: 'text', label: '文本内容', type: 'string', bindable: true }],
| buildContent: (properties) => ({
| tagName: 'p',
| content: escapeHtmlMultiline(properties.text),
| style: {
| margin: '0 0 8px',
| 'font-size': '12px',
| 'line-height': '1.6',
| 'text-align': String(properties.align ?? 'left'),
| },
| }),
| };
|
|