@@ -23,6 +23,7 @@ interface CellProps {
2323 filter ?: string ;
2424 index : number ;
2525 showFullText : ( index : number ) => void ;
26+ maxValueWidth ?: number ;
2627}
2728
2829export function Cell ( props : CellProps ) {
@@ -69,6 +70,7 @@ export function Cell(props: CellProps) {
6970 matched = { matched ?. valueMatch }
7071 filter = { filter }
7172 showFullText = { handleShowFullText }
73+ maxValueWidth = { props . maxValueWidth }
7274 />
7375 ) }
7476 { collapsed && depth === undefined && < span className = { 'unipika' } > ...</ span > }
@@ -97,6 +99,7 @@ function Key(props: KeyProps) {
9799
98100interface ValueProps extends KeyProps {
99101 showFullText ?: ( ) => void ;
102+ maxValueWidth ?: number ;
100103}
101104
102105function Value ( props : ValueProps ) {
@@ -109,16 +112,24 @@ function Value(props: ValueProps) {
109112
110113function renderValueWithFilter ( props : ValueProps , className : string ) {
111114 if ( 'string' === props . text ?. $type ) {
112- return renderStringWithFilter ( props , className , 100 ) ;
115+ return renderStringWithFilter ( props , className ) ;
113116 }
114117 return renderWithFilter ( props , block ( 'value' ) ) ;
115118}
116119
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 } ) ;
120131 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 ) ) ;
122133 const truncated = visible . length < tmp . length - 2 ;
123134 let hasHiddenMatch = false ;
124135 if ( truncated ) {
0 commit comments