11( function ( global , factory ) {
22 if ( typeof define === "function" && define . amd ) {
3- define ( "vxe-table-plugin-renderer" , [ ] , factory ) ;
3+ define ( "vxe-table-plugin-renderer" , [ "exports" , "xe-utils" ] , factory ) ;
44 } else if ( typeof exports !== "undefined" ) {
5- factory ( ) ;
5+ factory ( exports , require ( "xe-utils" ) ) ;
66 } else {
77 var mod = {
88 exports : { }
99 } ;
10- factory ( ) ;
10+ factory ( mod . exports , global . XEUtils ) ;
1111 global . VXETablePluginRenderer = mod . exports . default ;
1212 }
13- } ) ( this , function ( ) {
13+ } ) ( this , function ( _exports , _xeUtils ) {
1414 "use strict" ;
1515
16- exports . __esModule = true ;
16+ Object . defineProperty ( _exports , "__esModule" , {
17+ value : true
18+ } ) ;
19+ _exports [ "default" ] = _exports . VXETablePluginRenderer = void 0 ;
20+ _xeUtils = _interopRequireDefault ( _xeUtils ) ;
1721
18- var xe_utils_1 = require ( "xe-utils" ) ;
22+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { "default" : obj } ; }
1923
24+ // import { VXETable } from 'vxe-table'
2025 function getCursorPosition ( textarea ) {
2126 var rangeData = {
2227 text : '' ,
5055 }
5156
5257 function autoResizeTextarea ( evnt , renderOpts , params ) {
53- var _a = renderOpts . props ,
54- props = _a === void 0 ? { } : _a ;
58+ var _renderOpts$props = renderOpts . props ,
59+ props = _renderOpts$props === void 0 ? { } : _renderOpts$props ;
5560 var $table = params . $table ,
5661 column = params . column ;
5762 var minWidth = column . renderWidth ,
6065
6166 var maxWidth = props . maxWidth || 600 ;
6267 var maxHeight = props . maxHeight || 400 ;
63- $text . textContent = inpElem . value + "\n" ;
64- $text . style . maxWidth = maxWidth + "px" ;
68+ $text . textContent = "" . concat ( inpElem . value , "\n" ) ;
69+ $text . style . maxWidth = "" . concat ( maxWidth , "px" ) ;
6570
6671 if ( ! $text . parentNode ) {
6772 $table . $el . appendChild ( $text ) ;
6873 }
6974
7075 var height = Math . min ( maxHeight , $text . offsetHeight + 4 ) ;
71- inpElem . style . width = Math . min ( maxWidth , Math . max ( minWidth , $text . offsetWidth + 20 ) ) + "px" ;
72- inpElem . style . height = ( height < minHeight ? minHeight : height ) + "px" ;
76+ inpElem . style . width = "" . concat ( Math . min ( maxWidth , Math . max ( minWidth , $text . offsetWidth + 20 ) ) , "px" ) ;
77+ inpElem . style . height = "" . concat ( height < minHeight ? minHeight : height , "px" ) ;
7378 inpElem . style . overflowY = height > maxWidth ? 'auto' : '' ;
7479 }
7580
8893 } ;
8994
9095 if ( events ) {
91- xe_utils_1 [ "default" ] . assign ( on , xe_utils_1 [ "default" ] . objectMap ( events , function ( cb ) {
96+ _xeUtils [ "default" ] . assign ( on , _xeUtils [ "default" ] . objectMap ( events , function ( cb ) {
9297 return function ( ) {
9398 cb . apply ( null , [ params ] . concat . apply ( params , arguments ) ) ;
9499 } ;
106111 XInput : {
107112 autofocus : '.x-input' ,
108113 renderEdit : function renderEdit ( h , renderOpts , params ) {
109- var _a = renderOpts . props ,
110- props = _a === void 0 ? { } : _a ,
114+ var _renderOpts$props2 = renderOpts . props ,
115+ props = _renderOpts$props2 === void 0 ? { } : _renderOpts$props2 ,
111116 attrs = renderOpts . attrs ,
112- _b = renderOpts . events ,
113- events = _b === void 0 ? { } : _b ;
117+ _renderOpts$events = renderOpts . events ,
118+ events = _renderOpts$events === void 0 ? { } : _renderOpts$events ;
114119 var column = params . column ;
115120 var model = column . model ;
116121 var prefixIcon = props . prefixIcon ,
123128 'is--suffix' : props . suffixIcon
124129 } ] ,
125130 style : {
126- height : column . renderHeight - 1 + "px"
131+ height : "" . concat ( column . renderHeight - 1 , "px" )
127132 }
128133 } , [ prefixIcon ? h ( 'i' , {
129134 "class" : [ 'x-input--prefix' , prefixIcon , {
175180 return [ h ( 'div' , {
176181 "class" : 'x-textarea--wrapper' ,
177182 style : {
178- height : column . renderHeight - 1 + "px"
183+ height : "" . concat ( column . renderHeight - 1 , "px" )
179184 }
180185 } , [ h ( 'textarea' , {
181186 "class" : 'x-textarea' ,
182187 attrs : attrs ,
183188 domProps : {
184189 value : model . value
185190 } ,
186- on : xe_utils_1 [ "default" ] . assign ( getEvents ( renderOpts , params ) , {
191+ on : _xeUtils [ "default" ] . assign ( getEvents ( renderOpts , params ) , {
187192 cut : autoResizeEvent ,
188193 paste : autoResizeEvent ,
189194 drop : autoResizeEvent ,
192197 if ( evnt . keyCode === 13 && ( ! $table . keyboardConfig || evnt . altKey ) ) {
193198 evnt . preventDefault ( ) ;
194199 evnt . stopPropagation ( ) ;
195- var inpElem_1 = evnt . target ;
196- var rangeData_1 = getCursorPosition ( inpElem_1 ) ;
197- var pos_1 = rangeData_1 . end ;
198- var cellValue = inpElem_1 . value ;
199- cellValue = cellValue . slice ( 0 , pos_1 ) + "\n" + cellValue . slice ( pos_1 , cellValue . length ) ;
200- inpElem_1 . value = cellValue ;
200+ var inpElem = evnt . target ;
201+ var rangeData = getCursorPosition ( inpElem ) ;
202+ var pos = rangeData . end ;
203+ var cellValue = inpElem . value ;
204+ cellValue = "" . concat ( cellValue . slice ( 0 , pos ) , "\n" ) . concat ( cellValue . slice ( pos , cellValue . length ) ) ;
205+ inpElem . value = cellValue ;
201206 model . update = true ;
202207 model . value = cellValue ;
203208 setTimeout ( function ( ) {
204- rangeData_1 . start = rangeData_1 . end = ++ pos_1 ;
205- setCursorPosition ( inpElem_1 , rangeData_1 ) ;
209+ rangeData . start = rangeData . end = ++ pos ;
210+ setCursorPosition ( inpElem , rangeData ) ;
206211 autoResizeEvent ( evnt ) ;
207212 } ) ;
208213 } else {
220225 column = params . column ;
221226 return [ h ( 'span' , {
222227 "class" : 'x-textarea--content'
223- } , xe_utils_1 [ "default" ] . get ( row , column . property ) ) ] ;
228+ } , _xeUtils [ "default" ] . get ( row , column . property ) ) ] ;
224229 }
225230 }
226231 } ;
227232 /**
228233 * 基于 vxe-table 表格的增强插件,提供一些常用的渲染器
229234 */
230235
231- exports . VXETablePluginRenderer = {
236+ var VXETablePluginRenderer = {
232237 install : function install ( xtable ) {
233238 xtable . renderer . mixin ( renderMap ) ;
234239 }
235240 } ;
241+ _exports . VXETablePluginRenderer = VXETablePluginRenderer ;
236242
237243 if ( typeof window !== 'undefined' && window . VXETable ) {
238- window . VXETable . use ( exports . VXETablePluginRenderer ) ;
244+ window . VXETable . use ( VXETablePluginRenderer ) ;
239245 }
240246
241- exports [ "default" ] = exports . VXETablePluginRenderer ;
247+ var _default = VXETablePluginRenderer ;
248+ _exports [ "default" ] = _default ;
242249} ) ;
0 commit comments