@@ -36,66 +36,82 @@ export class GridListItem {
3636 itemPrototype : GridsterItemPrototypeDirective ;
3737 itemObject : any ;
3838
39- get $element ( ) {
39+ get $element ( ) {
4040 return this . getItem ( ) . $element ;
4141 }
4242
43- get x ( ) {
43+ get x ( ) {
4444 const item = this . getItem ( ) ;
45- const breakpoint = item . gridster ? item . gridster . options . breakpoint : null ;
45+ const breakpoint = item . gridster
46+ ? item . gridster . options . breakpoint
47+ : null ;
4648
4749 return this . getValueX ( breakpoint ) ;
4850 }
49- set x ( value : number ) {
51+ set x ( value : number ) {
5052 const item = this . getItem ( ) ;
51- const breakpoint = item . gridster ? item . gridster . options . breakpoint : null ;
53+ const breakpoint = item . gridster
54+ ? item . gridster . options . breakpoint
55+ : null ;
5256
5357 this . setValueX ( value , breakpoint ) ;
5458 }
5559
56- get y ( ) {
60+ get y ( ) {
5761 const item = this . getItem ( ) ;
58- const breakpoint = item . gridster ? item . gridster . options . breakpoint : null ;
62+ const breakpoint = item . gridster
63+ ? item . gridster . options . breakpoint
64+ : null ;
5965
6066 return this . getValueY ( breakpoint ) ;
6167 }
62- set y ( value : number ) {
68+ set y ( value : number ) {
6369 const item = this . getItem ( ) ;
64- const breakpoint = item . gridster ? item . gridster . options . breakpoint : null ;
70+ const breakpoint = item . gridster
71+ ? item . gridster . options . breakpoint
72+ : null ;
6573
6674 this . setValueY ( value , breakpoint ) ;
6775 }
6876
69- get w ( ) {
77+ get w ( ) {
7078 const item = this . getItem ( ) ;
71- const breakpoint = item . gridster ? item . gridster . options . breakpoint : null ;
79+ const breakpoint = item . gridster
80+ ? item . gridster . options . breakpoint
81+ : null ;
7282
7383 return this . getValueW ( breakpoint ) ;
7484 }
75- set w ( value : number ) {
85+ set w ( value : number ) {
7686 const item = this . getItem ( ) ;
77- const breakpoint = item . gridster ? item . gridster . options . breakpoint : null ;
87+ const breakpoint = item . gridster
88+ ? item . gridster . options . breakpoint
89+ : null ;
7890
7991 this . setValueW ( value , breakpoint ) ;
8092 }
8193
82- get h ( ) {
94+ get h ( ) {
8395 const item = this . getItem ( ) ;
84- const breakpoint = item . gridster ? item . gridster . options . breakpoint : null ;
96+ const breakpoint = item . gridster
97+ ? item . gridster . options . breakpoint
98+ : null ;
8599
86100 return this . getValueH ( breakpoint ) ;
87101 }
88- set h ( value : number ) {
102+ set h ( value : number ) {
89103 const item = this . getItem ( ) ;
90- const breakpoint = item . gridster ? item . gridster . options . breakpoint : null ;
104+ const breakpoint = item . gridster
105+ ? item . gridster . options . breakpoint
106+ : null ;
91107
92108 this . setValueH ( value , breakpoint ) ;
93109 }
94110
95- get autoSize ( ) {
111+ get autoSize ( ) {
96112 return this . getItem ( ) . autoSize ;
97113 }
98- set autoSize ( value : boolean ) {
114+ set autoSize ( value : boolean ) {
99115 this . getItem ( ) . autoSize = value ;
100116 }
101117
@@ -127,23 +143,25 @@ export class GridListItem {
127143 return item . positionY ;
128144 }
129145
130- public setFromGridsterItem ( item : GridsterItemComponent ) : GridListItem {
146+ public setFromGridsterItem ( item : GridsterItemComponent ) : GridListItem {
131147 if ( this . isItemSet ( ) ) {
132148 throw new Error ( 'GridListItem is already set.' ) ;
133149 }
134150 this . itemComponent = item ;
135151 return this ;
136152 }
137153
138- public setFromGridsterItemPrototype ( item : GridsterItemPrototypeDirective ) : GridListItem {
154+ public setFromGridsterItemPrototype (
155+ item : GridsterItemPrototypeDirective
156+ ) : GridListItem {
139157 if ( this . isItemSet ( ) ) {
140158 throw new Error ( 'GridListItem is already set.' ) ;
141159 }
142160 this . itemPrototype = item ;
143161 return this ;
144162 }
145163
146- public setFromObjectLiteral ( item : Object ) : GridListItem {
164+ public setFromObjectLiteral ( item : Object ) : GridListItem {
147165 if ( this . isItemSet ( ) ) {
148166 throw new Error ( 'GridListItem is already set.' ) ;
149167 }
@@ -232,28 +250,36 @@ export class GridListItem {
232250 public triggerChangeX ( breakpoint ?) {
233251 const item = this . itemComponent ;
234252 if ( item ) {
235- item [ this . getXProperty ( breakpoint ) + 'Change' ] . emit ( this . getValueX ( breakpoint ) ) ;
253+ item [ this . getXProperty ( breakpoint ) + 'Change' ] . emit (
254+ this . getValueX ( breakpoint )
255+ ) ;
236256 }
237257 }
238258
239259 public triggerChangeY ( breakpoint ?) {
240260 const item = this . itemComponent ;
241261 if ( item ) {
242- item [ this . getYProperty ( breakpoint ) + 'Change' ] . emit ( this . getValueY ( breakpoint ) ) ;
262+ item [ this . getYProperty ( breakpoint ) + 'Change' ] . emit (
263+ this . getValueY ( breakpoint )
264+ ) ;
243265 }
244266 }
245267
246268 public triggerChangeW ( breakpoint ?) {
247269 const item = this . itemComponent ;
248270 if ( item ) {
249- item [ this . getWProperty ( breakpoint ) + 'Change' ] . emit ( this . getValueW ( breakpoint ) ) ;
271+ item [ this . getWProperty ( breakpoint ) + 'Change' ] . emit (
272+ this . getValueW ( breakpoint )
273+ ) ;
250274 }
251275 }
252276
253277 public triggerChangeH ( breakpoint ?) {
254278 const item = this . itemComponent ;
255279 if ( item ) {
256- item [ this . getHProperty ( breakpoint ) + 'Change' ] . emit ( this . getValueH ( breakpoint ) ) ;
280+ item [ this . getHProperty ( breakpoint ) + 'Change' ] . emit (
281+ this . getValueH ( breakpoint )
282+ ) ;
257283 }
258284 }
259285
@@ -272,9 +298,11 @@ export class GridListItem {
272298 this . itemComponent . updateElemenetPosition ( ) ;
273299 }
274300
275- public calculatePosition ( gridster ?: GridsterService ) : { left : number , top : number } {
301+ public calculatePosition (
302+ gridster ?: GridsterService
303+ ) : { left : number ; top : number } {
276304 if ( ! gridster && ! this . itemComponent ) {
277- return { left : 0 , top : 0 } ;
305+ return { left : 0 , top : 0 } ;
278306 }
279307 gridster = gridster || this . itemComponent . gridster ;
280308
@@ -291,9 +319,11 @@ export class GridListItem {
291319 this . $element . style . height = size . height + 'px' ;
292320 }
293321
294- public calculateSize ( gridster ?: GridsterService ) : { width : number , height : number } {
322+ public calculateSize (
323+ gridster ?: GridsterService
324+ ) : { width : number ; height : number } {
295325 if ( ! gridster && ! this . itemComponent ) {
296- return { width : 0 , height : 0 } ;
326+ return { width : 0 , height : 0 } ;
297327 }
298328 gridster = gridster || this . itemComponent . gridster ;
299329
@@ -314,7 +344,6 @@ export class GridListItem {
314344 }
315345
316346 private getXProperty ( breakpoint ?: string ) {
317-
318347 if ( breakpoint && this . itemComponent ) {
319348 return GridListItem . X_PROPERTY_MAP [ breakpoint ] ;
320349 } else {
@@ -323,7 +352,6 @@ export class GridListItem {
323352 }
324353
325354 private getYProperty ( breakpoint ?: string ) {
326-
327355 if ( breakpoint && this . itemComponent ) {
328356 return GridListItem . Y_PROPERTY_MAP [ breakpoint ] ;
329357 } else {
@@ -333,12 +361,14 @@ export class GridListItem {
333361
334362 private getWProperty ( breakpoint ?: string ) {
335363 if ( this . itemPrototype ) {
336- return this . itemPrototype [ GridListItem . W_PROPERTY_MAP [ breakpoint ] ] ?
337- GridListItem . W_PROPERTY_MAP [ breakpoint ] : 'w' ;
364+ return this . itemPrototype [ GridListItem . W_PROPERTY_MAP [ breakpoint ] ]
365+ ? GridListItem . W_PROPERTY_MAP [ breakpoint ]
366+ : 'w' ;
338367 }
339368
340369 const item = this . getItem ( ) ;
341- const responsiveSizes = item . gridster && item . gridster . options . responsiveSizes ;
370+ const responsiveSizes =
371+ item . gridster && item . gridster . options . responsiveSizes ;
342372
343373 if ( breakpoint && responsiveSizes ) {
344374 return GridListItem . W_PROPERTY_MAP [ breakpoint ] ;
@@ -349,12 +379,14 @@ export class GridListItem {
349379
350380 private getHProperty ( breakpoint ?: string ) {
351381 if ( this . itemPrototype ) {
352- return this . itemPrototype [ GridListItem . H_PROPERTY_MAP [ breakpoint ] ] ?
353- GridListItem . H_PROPERTY_MAP [ breakpoint ] : 'w' ;
382+ return this . itemPrototype [ GridListItem . H_PROPERTY_MAP [ breakpoint ] ]
383+ ? GridListItem . H_PROPERTY_MAP [ breakpoint ]
384+ : 'w' ;
354385 }
355386
356387 const item = this . getItem ( ) ;
357- const responsiveSizes = item . gridster && item . gridster . options . responsiveSizes ;
388+ const responsiveSizes =
389+ item . gridster && item . gridster . options . responsiveSizes ;
358390
359391 if ( breakpoint && responsiveSizes ) {
360392 return GridListItem . H_PROPERTY_MAP [ breakpoint ] ;
@@ -364,7 +396,8 @@ export class GridListItem {
364396 }
365397
366398 private getItem ( ) : any {
367- const item = this . itemComponent || this . itemPrototype || this . itemObject ;
399+ const item =
400+ this . itemComponent || this . itemPrototype || this . itemObject ;
368401
369402 if ( ! item ) {
370403 throw new Error ( 'GridListItem is not set.' ) ;
0 commit comments