@@ -29,23 +29,19 @@ import BaseComponent from './base-component'
29
29
const NAME = 'loading-button'
30
30
const DATA_KEY = 'coreui.loading-button'
31
31
const EVENT_KEY = `.${ DATA_KEY } `
32
- // const DATA_API_KEY = '.data-api'
33
32
34
33
const MAX_PERCENT = 100
35
34
const MILLISECONDS = 10
36
35
const PROGRESS_BAR_BG_COLOR_LIGHT = 'rgba(255, 255, 255, .2)'
37
36
const PROGRESS_BAR_BG_COLOR_DARK = 'rgba(0, 0, 0, .2)'
38
37
39
- // const SELECTOR_COMPONENT = '[data-coreui="loading-button"]'
40
-
41
38
const EVENT_START = `start${ EVENT_KEY } `
42
39
const EVENT_STOP = `stop${ EVENT_KEY } `
43
40
const EVENT_COMPLETE = `complete${ EVENT_KEY } `
44
- // const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`
45
41
46
- const CLASS_NAME_LOADING_BUTTON_LOADING = 'loading-button -loading'
47
- const CLASS_NAME_LOADING_BUTTON_PROGRESS = 'loading-button -progress'
48
- const CLASS_NAME_LOADING_BUTTON_SPINNER = 'loading-button -spinner'
42
+ const CLASS_NAME_IS_LOADING = 'is -loading'
43
+ const CLASS_NAME_LOADING_BUTTON_PROGRESS = 'btn-loading -progress'
44
+ const CLASS_NAME_LOADING_BUTTON_SPINNER = 'btn-loading -spinner'
49
45
50
46
const Default = {
51
47
percent : 0 ,
@@ -71,8 +67,6 @@ const DefaultType = {
71
67
72
68
class LoadingButton extends BaseComponent {
73
69
constructor ( element , config ) {
74
- // eslint-disable-next-line no-console
75
- console . log ( 'created' )
76
70
super ( element )
77
71
78
72
this . _config = this . _getConfig ( config )
@@ -110,15 +104,15 @@ class LoadingButton extends BaseComponent {
110
104
this . _createProgressBar ( )
111
105
112
106
setTimeout ( ( ) => {
113
- this . _element . classList . add ( CLASS_NAME_LOADING_BUTTON_LOADING )
107
+ this . _element . classList . add ( CLASS_NAME_IS_LOADING )
114
108
this . _loading ( )
115
109
EventHandler . trigger ( this . _element , EVENT_START )
116
110
} , 1 )
117
111
}
118
112
}
119
113
120
114
stop ( ) {
121
- this . _element . classList . remove ( CLASS_NAME_LOADING_BUTTON_LOADING )
115
+ this . _element . classList . remove ( CLASS_NAME_IS_LOADING )
122
116
const stoped = ( ) => {
123
117
this . _removeSpinner ( )
124
118
this . _removeProgressBar ( )
@@ -169,7 +163,7 @@ class LoadingButton extends BaseComponent {
169
163
this . _element = null
170
164
}
171
165
172
- update ( config ) { // public method
166
+ update ( config ) {
173
167
this . _config = this . _getConfig ( config )
174
168
}
175
169
@@ -299,24 +293,13 @@ class LoadingButton extends BaseComponent {
299
293
}
300
294
}
301
295
302
- static jQueryInterface ( config , par ) {
296
+ static jQueryInterface ( config ) {
303
297
return this . each ( function ( ) {
304
- LoadingButton . loadingButtonInterface ( this , config , par )
298
+ LoadingButton . loadingButtonInterface ( this , config )
305
299
} )
306
300
}
307
301
}
308
302
309
- /**
310
- * ------------------------------------------------------------------------
311
- * Data Api implementation
312
- * ------------------------------------------------------------------------
313
- */
314
- // EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
315
- // SelectorEngine.find(SELECTOR_COMPONENT).forEach(element => {
316
- // LoadingButton.loadingButtonInterface(element, Manipulator.getDataAttributes(element))
317
- // })
318
- // })
319
-
320
303
/**
321
304
* ------------------------------------------------------------------------
322
305
* jQuery
0 commit comments