@@ -23,6 +23,7 @@ interface CellProps {
23
23
filter ?: string ;
24
24
index : number ;
25
25
showFullText : ( index : number ) => void ;
26
+ maxValueWidth ?: number ;
26
27
}
27
28
28
29
export function Cell ( props : CellProps ) {
@@ -69,6 +70,7 @@ export function Cell(props: CellProps) {
69
70
matched = { matched ?. valueMatch }
70
71
filter = { filter }
71
72
showFullText = { handleShowFullText }
73
+ maxValueWidth = { props . maxValueWidth }
72
74
/>
73
75
) }
74
76
{ collapsed && depth === undefined && < span className = { 'unipika' } > ...</ span > }
@@ -97,6 +99,7 @@ function Key(props: KeyProps) {
97
99
98
100
interface ValueProps extends KeyProps {
99
101
showFullText ?: ( ) => void ;
102
+ maxValueWidth ?: number ;
100
103
}
101
104
102
105
function Value ( props : ValueProps ) {
@@ -109,16 +112,24 @@ function Value(props: ValueProps) {
109
112
110
113
function renderValueWithFilter ( props : ValueProps , className : string ) {
111
114
if ( 'string' === props . text ?. $type ) {
112
- return renderStringWithFilter ( props , className , 100 ) ;
115
+ return renderStringWithFilter ( props , className ) ;
113
116
}
114
117
return renderWithFilter ( props , block ( 'value' ) ) ;
115
118
}
116
119
117
- function renderStringWithFilter ( props : ValueProps , className : string , maxWidth = Infinity ) {
118
- const { text, settings = defaultUnipikaSettings , matched = [ ] , filter, showFullText} = props ;
119
- const tmp = unipika . format ( text , { ...settings , asHTML : false } ) ;
120
+ function renderStringWithFilter ( props : ValueProps , className : string ) {
121
+ const {
122
+ text,
123
+ settings = defaultUnipikaSettings ,
124
+ matched = [ ] ,
125
+ filter,
126
+ showFullText,
127
+ maxValueWidth = Infinity ,
128
+ } = props ;
129
+
130
+ const tmp = unipika . format ( text , { ...settings , maxStringSize : 10 , asHTML : false } ) ;
120
131
const length = tmp . length ;
121
- const visible = tmp . substring ( 1 , Math . min ( length - 1 , maxWidth + 1 ) ) ;
132
+ const visible = tmp . substring ( 1 , Math . min ( length - 1 , maxValueWidth + 1 ) ) ;
122
133
const truncated = visible . length < tmp . length - 2 ;
123
134
let hasHiddenMatch = false ;
124
135
if ( truncated ) {
0 commit comments