File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
frontend/src/views/chat/component/charts Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 88 type S2MountContainer ,
99 type SortMethod ,
1010 type Node ,
11+ type CellTextWordWrapStyle ,
1112} from '@antv/s2'
1213import { debounce , filter } from 'lodash-es'
1314import { i18n } from '@/i18n'
@@ -70,6 +71,15 @@ export class Table extends BaseChart {
7071 data : this . data ,
7172 }
7273
74+ const cellTextWordWrapStyle : CellTextWordWrapStyle = {
75+ // 最大行数,文本超出后将被截断
76+ maxLines : 3 ,
77+ // 文本是否换行
78+ wordWrap : true ,
79+ // 可选项见:https://g.antv.antgroup.com/api/basic/text#textoverflow
80+ textOverflow : 'ellipsis' ,
81+ }
82+
7383 const s2Options : S2Options = {
7484 width : 600 ,
7585 height : 360 ,
@@ -146,6 +156,24 @@ export class Table extends BaseChart {
146156 } ,
147157 } ,
148158 } ,
159+ // 如果有省略号, 复制到的是完整文本
160+ interaction : {
161+ copy : {
162+ enable : true ,
163+ withFormat : true ,
164+ withHeader : true ,
165+ } ,
166+ brushSelection : {
167+ dataCell : true ,
168+ rowCell : true ,
169+ colCell : true ,
170+ } ,
171+ } ,
172+ style : {
173+ colCell : cellTextWordWrapStyle ,
174+ // 如果是数值不建议换行, 容易产生歧义
175+ dataCell : cellTextWordWrapStyle ,
176+ } ,
149177 placeholder : {
150178 cell : '-' ,
151179 empty : {
You can’t perform that action at this time.
0 commit comments