1
1
<import-sjs from =" ./index.sjs" name =" utils" />
2
- <template name =" content" >
3
- <view a : if =" {{contentType === 'text'}}" class =" ant-copilot-thoughtchain-node-content-text" >
4
- <view a : if =" {{typeof content === 'string'}}" >{{content}}</view >
5
- <view a : elif =" {{typeof content === 'object'}}" >
6
- <view a : for =" {{content}}" class =" ant-copilot-thoughtchain-node-content-text-item" >
7
- {{item}}
8
- </view >
9
- </view >
10
- </view >
11
- <view a : if =" {{contentType === 'link'}}" class =" ant-copilot-thoughtchain-node-content-link" >
12
- <view
13
- a : if =" {{typeof content === 'string'}}"
14
- data-id =" {{id}}"
15
- data-index =" {{0}}"
16
- data-content =" {{content}}"
17
- data-nodeItem =" {{nodeItem}}"
18
- data-contentType =" {{contentType}}"
19
- onTap =" onContentItemTap"
20
- >
21
- {{content}}
22
- </view >
23
- <view a : elif =" {{typeof content === 'object'}}" >
24
- <view
25
- a : for =" {{content}}"
26
- class =" ant-copilot-thoughtchain-node-content-link-item"
27
- data-id =" {{id}}"
28
- data-index =" {{index}}"
29
- data-content =" {{item}}"
30
- data-contentType =" {{contentType}}"
31
- data-nodeItem =" {{nodeItem}}"
32
- onTap =" onContentItemTap"
33
- >
34
- {{item}}
35
- </view >
36
- </view >
37
- </view >
38
- <view a : if =" {{contentType === 'tag'}}" class =" ant-copilot-thoughtchain-node-content-tag" >
39
- <view
40
- a : for =" {{content}}"
41
- class =" ant-copilot-thoughtchain-node-content-tag-item"
42
- data-id =" {{id}}"
43
- data-index =" {{index}}"
44
- data-content =" {{item}}"
45
- data-nodeItem =" {{nodeItem}}"
46
- data-contentType =" {{contentType}}"
47
- onTap =" onContentItemTap"
48
- >
49
- {{item}}
50
- </view >
51
- </view >
52
- </template >
53
- <template name =" title" >
54
- <view class =" ant-copilot-thoughtchain-node-title" >
55
- <ant-loading
56
- a : if =" {{item.status === statusEnum.LOADING}}"
57
- className =" ant-copilot-thoughtchain-node-title-loading"
58
- type =" spin"
59
- size =" small"
60
- color =" {{isFirstLevel ? '#000000a6' : '#000'}}"
61
- />
62
- <ant-icon
63
- a : elif =" {{item.status === statusEnum.FAIL}}"
64
- className =" ant-copilot-thoughtchain-node-title-fail"
65
- type =" CloseCircleOutline"
66
- />
67
- <ant-icon
68
- a:else
69
- className =" ant-copilot-thoughtchain-node-title-success"
70
- type =" CheckCircleOutline"
71
- />
72
- <view class =" ant-copilot-thoughtchain-node-title-text" >
73
- {{item.title}}
74
- <ant-icon a : if =" {{isExpand && hasExpandArrow}}" type =" UpOutline" />
75
- <ant-icon a : elif =" {{hasExpandArrow}}" type =" DownOutline" />
76
- </view >
77
-
78
- </view >
79
- </template >
80
2
<view class =" ant-copilot-thoughtchain {{ className }}" >
81
- <view
82
- a : for =" {{list}}"
83
- a : for-index =" firstLevelIndex"
84
- a : for-item =" firstLevelItem"
85
- class =" ant-copilot-thoughtchain-node"
86
- >
87
- <view onTap =" onTitleTap" data-index =" {{firstLevelIndex}}" data-isExpand =" {{utils.isExpand(firstLevelFoldStatusList[firstLevelIndex], list.length, firstLevelIndex, firstLevelItem)}}" >
88
- <slot name =" title" title =" {{firstLevelItem.title}}" isExpand =" {{utils.isExpand(firstLevelFoldStatusList[firstLevelIndex], list.length, firstLevelIndex, firstLevelItem)}}" >
89
- <template is =" title" data =" {{item: firstLevelItem, statusEnum, isFirstLevel: true, hasExpandArrow: utils.hasExpandArrow(firstLevelItem) ,isExpand: utils.isExpand(firstLevelFoldStatusList[firstLevelIndex], list.length, firstLevelIndex, firstLevelItem)}}" />
90
- </slot >
3
+ <view a : for =" {{items}}" class =" ant-copilot-thoughtchain-node" >
4
+ <view onTap =" onTitleTap" data-index =" {{index}}" data-key =" {{item.key || index}}" >
5
+ <view class =" ant-copilot-thoughtchain-node-title" >
6
+ <image
7
+ a : if =" {{item.icon && item.icon.includes('https://')}}"
8
+ class =" ant-copilot-thoughtchain-node-title-icon"
9
+ mode =" widthFix"
10
+ src =" {{item.icon}}"
11
+ />
12
+ <ant-icon a:else type =" {{item.icon || 'CheckCircleOutline'}}" class =" ant-copilot-thoughtchain-node-title-icon" />
13
+ {{item.title}}
14
+ <view a : if =" {{collapsible}}" class =" ant-copilot-thoughtchain-node-title-collapse" >
15
+ <ant-icon type =" {{utils.isExpand(collapsible, item.key || index, foldStatusMap) ? 'UpOutline' : 'DownOutline'}}" />
16
+ </view >
17
+ </view >
91
18
</view >
92
19
<view
93
- a : if =" {{utils.isExpand(firstLevelFoldStatusList[firstLevelIndex], list.length, firstLevelIndex, firstLevelItem) && firstLevelItem.content && firstLevelItem.contentType }}"
20
+ a : if =" {{utils.isExpand(collapsible, item.key || index, foldStatusMap) }}"
94
21
class =" ant-copilot-thoughtchain-node-content"
95
22
>
96
- <view a : if =" {{['text', 'link', 'tag'].includes(firstLevelItem.contentType)}}" >
97
- <template is =" content" data =" {{content: firstLevelItem.content, contentType: firstLevelItem.contentType, id: firstLevelItem.id || firstLevelIndex, nodeItem: firstLevelItem}}" >
98
- </template >
99
- </view >
100
- <view a:else>
101
- <slot
102
- name =" content"
103
- contentType =" {{firstLevelItem.contentType}}"
104
- content =" {{firstLevelItem.content}}"
105
- id =" {{firstLevelItem.id || firstLevelIndex}}"
106
- >
107
- </slot >
108
- </view >
109
-
110
- </view >
111
- <view a : if =" {{utils.isExpand(firstLevelFoldStatusList[firstLevelIndex], list.length, firstLevelIndex, firstLevelItem) && firstLevelItem.list && firstLevelItem.list.length}}" class =" ant-copilot-thoughtchain-node-secondlevel" >
112
- <view
113
- a : for =" {{firstLevelItem.list}}"
114
- a : for-index =" secondLevelIndex"
115
- a : for-item =" secondLevelItem"
116
- class =" ant-copilot-thoughtchain-node secondLevel"
117
- >
118
- <slot name =" title" title =" {{secondLevelItem.title}}" >
119
- <template is =" title" data =" {{item: secondLevelItem, statusEnum, isFirstLevel: false}}" />
120
- </slot >
121
- <view
122
- a : if =" {{secondLevelItem.content && secondLevelItem.contentType}}"
123
- class =" ant-copilot-thoughtchain-node-content secondLevel"
124
- >
125
- <view a : if =" {{['text', 'link', 'tag'].includes(secondLevelItem.contentType)}}" >
126
- <template is =" content" data =" {{content: secondLevelItem.content, contentType: secondLevelItem.contentType, id: `${firstLevelItem.id || firstLevelIndex}-${secondLevelItem.id || secondLevelIndex}` , nodeItem: secondLevelItem}}" >
127
- </template >
128
- </view >
129
- <view a:else>
130
- <slot
131
- name =" content"
132
- contentType =" {{secondLevelItem.contentType}}"
133
- content =" {{secondLevelItem.content}}"
134
- id =" {{`${firstLevelItem.id || firstLevelIndex}-${secondLevelItem.id || secondLevelIndex}` }}"
135
- >
136
- </slot >
137
- </view >
23
+ <slot name =" content" content =" {{item.content}}" item =" {{item}}" >
24
+ <view class =" ant-copilot-thoughtchain-node-content-text" onTap =" onContentItemTap" data-key =" {{item.key || index}}" data-content =" {{item.content}}" >
25
+ <view >{{item.content}}</view >
138
26
</view >
139
- </view >
27
+ </slot >
140
28
</view >
141
29
</view >
142
30
</view >
0 commit comments