mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2025-02-03 05:14:16 +03:00
43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
|
import BaseInput from './baseInput'
|
||
|
|
||
|
const BaseFormControl = (($) => {
|
||
|
|
||
|
/**
|
||
|
* ------------------------------------------------------------------------
|
||
|
* Constants
|
||
|
* ------------------------------------------------------------------------
|
||
|
*/
|
||
|
const Default = {
|
||
|
decorator: {
|
||
|
template: `<span class='mdb-form-control-decorator'></span>`
|
||
|
},
|
||
|
requiredClasses: ['form-control']
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* ------------------------------------------------------------------------
|
||
|
* Class Definition
|
||
|
* ------------------------------------------------------------------------
|
||
|
*/
|
||
|
class BaseFormControl extends BaseInput {
|
||
|
|
||
|
constructor($element, config) {
|
||
|
super($element, $.extend(true, Default, config))
|
||
|
|
||
|
// Initially mark as empty
|
||
|
if (this.isEmpty()) {
|
||
|
this.removeIsFilled()
|
||
|
}
|
||
|
|
||
|
// Add marker div the end of the form-group
|
||
|
this.$element.after(this.config.decorator.template)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
return BaseFormControl
|
||
|
|
||
|
})(jQuery)
|
||
|
|
||
|
export default BaseFormControl
|