150150 <!-- Tool Tip -->
151151 <div v-show =" tip" ref =" tooltip" class =" tool-tip" >{{ tip }}</div >
152152
153+ <!-- Text Tip -->
154+ <div v-show =" textTip" ref =" texttip" class =" text-tip" >{{ textTip }}</div >
155+
153156 <!-- Editor Square -->
154157 <div v-show =" focused" ref =" inputSquare" class =" input-square" @mousedown =" inputSquareClick" >
155158 <div style =" position : relative ; height : 100% ; padding : 2px 2px 1px " >
@@ -435,6 +438,7 @@ export default defineComponent({
435438 errmsg: {},
436439 rowerr: {},
437440 tip: ' ' ,
441+ textTip: ' ' ,
438442
439443 colHash: ' ' ,
440444 fields: [],
@@ -752,6 +756,7 @@ export default defineComponent({
752756 this .refreshPageSize ()
753757 },
754758 calTable () {
759+ this .textTip = ' '
755760 // add unique key to each row if no key is provided
756761 let seed = String (new Date ().getTime () % 1e8 )
757762 this .modelValue .forEach ((rec ,i ) => {
@@ -2252,7 +2257,30 @@ export default defineComponent({
22522257 if (this .currentField && this .currentField .link /* && e.altKey */ )
22532258 setTimeout (() => this .currentField .link (this .currentCell .textContent , this .currentRecord , rowPos, colPos, this .currentField , this ))
22542259 if (this .currentField .listByClick ) return this .calAutocompleteList (true )
2255- if (e .target .offsetWidth - e .offsetX > 15 ) return
2260+ if (e .target .offsetWidth - e .offsetX > 25 ) return
2261+ if (e .target .offsetWidth < e .target .scrollWidth ) {
2262+ // show textTip
2263+ this .textTip = this .currentCell .textContent
2264+ this .$refs .texttip .style .opacity = 0
2265+ const rect = e .target .getBoundingClientRect ()
2266+ setTimeout (() => {
2267+ const r = this .$refs .texttip .getBoundingClientRect ()
2268+ if (rect .bottom + r .height > window .innerHeight ) {
2269+ // show at top
2270+ this .$refs .texttip .style .top = (rect .top - r .height ) + ' px'
2271+ }
2272+ else {
2273+ this .$refs .texttip .style .top = rect .bottom + ' px'
2274+ }
2275+ if (rect .left + r .width > window .innerWidth )
2276+ this .$refs .texttip .style .left = (rect .right - r .width ) + ' px'
2277+ else
2278+ this .$refs .texttip .style .left = rect .left + ' px'
2279+ this .$refs .texttip .style .opacity = 1
2280+ })
2281+ // this.$refs.texttip.style.top = rect.bottom + 'px'
2282+ // this.$refs.texttip.style.left = rect.left + 'px'
2283+ }
22562284 if (this .currentField .readonly ) return
22572285 this .inputBox .value = this .currentCell .textContent
22582286 if (e .target .classList .contains (' select' )) this .calAutocompleteList (true )
@@ -2262,19 +2290,26 @@ export default defineComponent({
22622290 cellMouseMove (e ) {
22632291 let cursor = ' cell'
22642292 if (this .inputBoxShow ) cursor = ' default'
2265- if (! e .target .classList .contains (' readonly' )
2266- && (e .target .classList .contains (' select' ) || e .target .classList .contains (' datepick' ))
2267- && e .target .offsetWidth - e .offsetX < 15 )
2293+ if (e .target .offsetWidth - e .offsetX < 25 ) {
2294+ if (! e .target .classList .contains (' readonly' ) && (e .target .classList .contains (' select' ) || e .target .classList .contains (' datepick' )))
2295+ cursor = ' pointer'
2296+ if (e .target .offsetWidth < e .target .scrollWidth )
2297+ cursor = ' pointer'
2298+ }
2299+ if (this .currentField && this .currentField .type === ' action' )
22682300 cursor = ' pointer'
22692301 e .target .style .cursor = cursor
22702302 },
22712303 cellMouseOver (e ) {
22722304 const cell = e .target
2305+ const row = e .target .parentNode
2306+ const colPos = Array .from (row .children ).indexOf (e .target ) - 1
2307+ this .currentField = this .fields [colPos]
22732308 if (! cell .classList .contains (' error' )) return
22742309 if (this .tipTimeout ) clearTimeout (this .tipTimeout )
22752310 if ((this .tip = this .errmsg [cell .getAttribute (' id' )]) === ' ' ) return
22762311 const rect = cell .getBoundingClientRect ()
2277- this .$refs .tooltip .style .top = (rect .top - 14 ) + ' px' ;
2312+ this .$refs .tooltip .style .top = (rect .top - 14 ) + ' px'
22782313 this .$refs .tooltip .style .left = (rect .right + 8 ) + ' px'
22792314 cell .addEventListener (' mouseout' , this .cellMouseOut )
22802315 },
@@ -2284,7 +2319,7 @@ export default defineComponent({
22842319 if (this .tipTimeout ) clearTimeout (this .tipTimeout )
22852320 if ((this .tip = this .rowerr [cell .getAttribute (' id' )]) === ' ' ) return
22862321 const rect = cell .getBoundingClientRect ()
2287- this .$refs .tooltip .style .top = (rect .top - 14 ) + ' px' ;
2322+ this .$refs .tooltip .style .top = (rect .top - 14 ) + ' px'
22882323 this .$refs .tooltip .style .left = (rect .right + 8 ) + ' px'
22892324 cell .addEventListener (' mouseout' , this .cellMouseOut )
22902325 },
@@ -2306,6 +2341,7 @@ export default defineComponent({
23062341 /* *** InputBox *****************************************************************************************
23072342 */
23082343 moveInputSquare (rowPos , colPos ) {
2344+ this .textTip = ' '
23092345 if (colPos < 0 ) return false
23102346 const top = this .pageTop
23112347 let row = this .recordBody .children [rowPos]
@@ -3281,6 +3317,20 @@ a:disabled {
32813317 left: - 8px ;
32823318 top: 8px ;
32833319}
3320+ .text - tip {
3321+ display: inline- block;
3322+ position: fixed;
3323+ font- size: 0 .88rem ;
3324+ text- align: left;
3325+ color: gray;
3326+ background- color: lightyellow;
3327+ border: 1px solid lightgray;
3328+ padding: 0 .5rem ;
3329+ min- height: 1rem ;
3330+ max- width: 300px ;
3331+ word- wrap: break - word;
3332+ z- index: 50 ;
3333+ }
32843334.norecord {
32853335 z- index: 1 ;
32863336 font- size: smaller;
0 commit comments