@@ -87,12 +87,13 @@ export class AutomaticSliderShowWebcomponent extends BaseCustomWebComponentConst
8787 public static readonly is = 'node-projects-slidershow' ;
8888
8989 public static properties = {
90-
90+ slideIndex : Number ,
91+ interval : Number
9192 }
9293
9394 private _dots : HTMLDivElement ;
94- private _slideIndex = 0 ;
95- private _interval : number = 0 ;
95+ private slideIndex = 0 ;
96+ private interval : number = 0 ;
9697 private _timeoutId : any ;
9798 private _observer : MutationObserver ;
9899
@@ -109,7 +110,7 @@ export class AutomaticSliderShowWebcomponent extends BaseCustomWebComponentConst
109110
110111 connectedCallback ( ) {
111112 this . _observer . observe ( this , { childList : true } ) ;
112- this . _interval = parseInt ( this . getAttribute ( 'interval' ) ) || this . _interval ;
113+ this . interval = parseInt ( this . getAttribute ( 'interval' ) ) || this . interval ;
113114 this . _initializeSlider ( ) ;
114115 }
115116
@@ -132,17 +133,17 @@ export class AutomaticSliderShowWebcomponent extends BaseCustomWebComponentConst
132133
133134 private _refreshContent ( ) {
134135 this . _dots . innerHTML = "" ;
135- this . _slideIndex = 0 ;
136+ this . slideIndex = 0 ;
136137 }
137138
138139 setSlideIndex ( index : number ) {
139- this . _slideIndex = index ;
140+ this . slideIndex = index ;
140141 this . _showSlides ( ) ;
141142 }
142143
143144 private _showSlides ( ) {
144- if ( this . _slideIndex >= this . children . length ) {
145- this . _slideIndex = 0 ;
145+ if ( this . slideIndex >= this . children . length ) {
146+ this . slideIndex = 0 ;
146147 }
147148
148149 let count = 1 ;
@@ -157,46 +158,46 @@ export class AutomaticSliderShowWebcomponent extends BaseCustomWebComponentConst
157158 }
158159
159160 if ( ( < HTMLDivElement > this . _dots ) . children . length != 0 ) {
160- ( < HTMLDivElement > this . _dots . children [ this . _slideIndex ] ) . classList . add ( "dot-active" ) ;
161+ ( < HTMLDivElement > this . _dots . children [ this . slideIndex ] ) . classList . add ( "dot-active" ) ;
161162 }
162163
163164 let i = 0 ;
164165 for ( const item of this . children as any as HTMLElement [ ] ) {
165- item . setAttribute ( 'slot' , i === this . _slideIndex ? 'main' : '' ) ;
166+ item . setAttribute ( 'slot' , i === this . slideIndex ? 'main' : '' ) ;
166167 i ++ ;
167168 }
168169
169170 i = 0 ;
170171 for ( const dot of this . _dots . children as any as HTMLElement [ ] ) {
171- dot . style . background = i === this . _slideIndex ? 'darkgrey' : 'lightgray' ;
172+ dot . style . background = i === this . slideIndex ? 'darkgrey' : 'lightgray' ;
172173 i ++ ;
173174 }
174175
175- this . _slideIndex ++ ;
176+ this . slideIndex ++ ;
176177 // console.log(this._slideIndex);
177- if ( this . _interval != 0 ) {
178+ if ( this . interval != 0 ) {
178179 clearTimeout ( this . _timeoutId ) ;
179- this . _timeoutId = setTimeout ( ( ) => this . _showSlides ( ) , this . _interval ) ;
180+ this . _timeoutId = setTimeout ( ( ) => this . _showSlides ( ) , this . interval ) ;
180181 }
181182 }
182183
183184 prevSlide ( ) {
184- this . _slideIndex = this . _slideIndex - 2 ;
185- if ( this . _slideIndex < 0 ) {
186- this . _slideIndex = this . children . length - 1 ;
185+ this . slideIndex = this . slideIndex - 2 ;
186+ if ( this . slideIndex < 0 ) {
187+ this . slideIndex = this . children . length - 1 ;
187188 }
188189 this . _showSlides ( ) ;
189190 }
190191
191192 nextSlide ( ) {
192- if ( this . _slideIndex >= this . children . length ) {
193- this . _slideIndex = 0 ;
193+ if ( this . slideIndex >= this . children . length ) {
194+ this . slideIndex = 0 ;
194195 }
195196 this . _showSlides ( ) ;
196197 }
197198
198199 public refresh ( ) {
199- this . _slideIndex = 0 ;
200+ this . slideIndex = 0 ;
200201 this . _showSlides ( ) ;
201202 }
202203}
0 commit comments