@@ -23,7 +23,7 @@ import * as Handsontable
2323/**
2424 * The class name added to a spreadsheet widget.
2525 */
26- const SPREADSHEET_CLASS = 'jp-Spreadsheet' ;
26+ // const SPREADSHEET_CLASS = 'jp-Spreadsheet';
2727
2828
2929/**
@@ -38,7 +38,7 @@ class Spreadsheet extends Widget {
3838 */
3939 constructor ( options : Spreadsheet . IOptions ) {
4040 super ( ) ;
41- this . addClass ( SPREADSHEET_CLASS ) ;
41+ // this.addClass(SPREADSHEET_CLASS);
4242
4343 }
4444
@@ -189,61 +189,18 @@ class Spreadsheet extends Widget {
189189 for ( r = r1 ; r <= r2 ; r ++ ) {
190190 for ( c = c1 ; c <= c2 ; c ++ ) {
191191 let existing = cell . filter ( ( item :filterItem ) => item . row === r && item . col === c ) [ 0 ] ;
192- switch ( property ) {
193- case 'fontWeight' :
194- if ( existing != null ) {
195- if ( existing . fontWeight == value )
196- existing . fontWeight = '' ;
197- else
198- existing . fontWeight = value ;
199- } else {
200- cell . push ( { row : r , col : c , fontWeight : value } )
201- }
202- break ;
203- case 'fontStyle' :
204- if ( existing != null ) {
205- if ( existing . fontStyle == value )
206- existing . fontStyle = '' ;
207- else
208- existing . fontStyle = value ;
209- } else {
210- cell . push ( { row : r , col : c , fontStyle : value } )
211- }
212- break ;
213- case 'className' :
214- if ( existing != null ) {
215- if ( existing . className == value )
216- existing . className = '' ;
217- else
218- existing . className = value ;
219- } else {
220- cell . push ( { row : r , col : c , className : value } )
221- }
222- break ;
223- case 'background' :
224- if ( existing != null ) {
225- if ( existing . background == value )
226- existing . background = '' ;
227- else
228- existing . background = value ;
229- } else {
230- cell . push ( { row : r , col : c , background : value } )
231- }
232- break ;
233- case 'color' :
234- if ( existing != null ) {
235- if ( existing . color == value )
236- existing . color = '' ;
237- else
238- existing . color = value ;
239- } else {
240- cell . push ( { row : r , col : c , color : value } )
241- }
242- break ;
243- default :
244- break ;
192+ if ( existing != null && existing != undefined ) {
193+ if ( existing . hasOwnProperty ( property ) && existing [ property ] == value )
194+ existing [ property ] = '' ;
195+ else
196+ existing [ property ] = value ;
197+ } else {
198+ let cellStyle :any = { } ;
199+ cellStyle [ 'row' ] = r ;
200+ cellStyle [ 'col' ] = c ;
201+ cellStyle [ property ] = value ;
202+ cell . push ( cellStyle ) ;
245203 }
246-
247204 }
248205 }
249206
0 commit comments