mirror of
				https://github.com/mdbootstrap/mdb-ui-kit.git
				synced 2025-11-04 01:47:35 +03:00 
			
		
		
		
	resolved some issues with es6 classes, about to break input into discreet classes instead of sharing any handlers to prevent confusion
This commit is contained in:
		
							parent
							
								
									0bfeb61b69
								
							
						
					
					
						commit
						93f0402161
					
				| 
						 | 
				
			
			@ -20,8 +20,8 @@ const Autofill = (($) => {
 | 
			
		|||
   */
 | 
			
		||||
  class Autofill {
 | 
			
		||||
 | 
			
		||||
    constructor($element, config) {
 | 
			
		||||
      this.$element = $element
 | 
			
		||||
    constructor(element, config) {
 | 
			
		||||
      this.$element = $(element)
 | 
			
		||||
      this.config = $.extend({}, Default, config)
 | 
			
		||||
 | 
			
		||||
      this._watchLoading()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										7
									
								
								js/src/bootstrapMaterialDesign.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								js/src/bootstrapMaterialDesign.js
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -84,12 +84,12 @@ const BootstrapMaterialDesign = (($) => {
 | 
			
		|||
   */
 | 
			
		||||
  class BootstrapMaterialDesign {
 | 
			
		||||
 | 
			
		||||
    constructor($element, config) {
 | 
			
		||||
      this.$element = $element
 | 
			
		||||
    constructor(element, config) {
 | 
			
		||||
      this.$element = $(element)
 | 
			
		||||
      this.config = $.extend({}, Default, config)
 | 
			
		||||
      let $document = $(document)
 | 
			
		||||
 | 
			
		||||
      for (let component in this.config.instantiation) {
 | 
			
		||||
      for (let component of this.config.instantiation) {
 | 
			
		||||
 | 
			
		||||
        // the component's config fragment is passed in directly, allowing users to override
 | 
			
		||||
        let componentConfig = this.config[component]
 | 
			
		||||
| 
						 | 
				
			
			@ -101,6 +101,7 @@ const BootstrapMaterialDesign = (($) => {
 | 
			
		|||
          let selector = this._resolveSelector(componentConfig)
 | 
			
		||||
 | 
			
		||||
          // instantiate component on selector elements with config
 | 
			
		||||
          console.debug(`instantiating: ${component}`)
 | 
			
		||||
          $(selector)[component](componentConfig)
 | 
			
		||||
 | 
			
		||||
          // add to arrive if present and enabled
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,12 +23,12 @@ const Checkbox = (($) => {
 | 
			
		|||
   */
 | 
			
		||||
  class Checkbox {
 | 
			
		||||
 | 
			
		||||
    constructor($element, config) {
 | 
			
		||||
      this.$element = $element
 | 
			
		||||
    constructor(element, config) {
 | 
			
		||||
      this.$element = $(element)
 | 
			
		||||
      this.config = $.extend({}, Default, config)
 | 
			
		||||
 | 
			
		||||
      this.$element.after(this.config.template)
 | 
			
		||||
      this.$formGroup = Util.findFormGroup(this.$element)
 | 
			
		||||
      this.$formGroup = Util.findFormGroup(this.$element, false)
 | 
			
		||||
 | 
			
		||||
      this._bindEventListeners()
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,8 +27,8 @@ const FileInput = (($) => {
 | 
			
		|||
   */
 | 
			
		||||
  class FileInput {
 | 
			
		||||
 | 
			
		||||
    constructor($element, config) {
 | 
			
		||||
      this.$element = $element
 | 
			
		||||
    constructor(element, config) {
 | 
			
		||||
      this.$element = $(element)
 | 
			
		||||
      this.config = $.extend({}, Default, config)
 | 
			
		||||
      this.$formGroup = Util.findFormGroup(this.$element)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,8 +41,8 @@ const Input = (($) => {
 | 
			
		|||
   */
 | 
			
		||||
  class Input {
 | 
			
		||||
 | 
			
		||||
    constructor($element, config) {
 | 
			
		||||
      this.$element = $element
 | 
			
		||||
    constructor(element, config) {
 | 
			
		||||
      this.$element = $(element)
 | 
			
		||||
      this.config = $.extend({}, Default, config)
 | 
			
		||||
 | 
			
		||||
      // Requires form-group standard markup (will add it if necessary)
 | 
			
		||||
| 
						 | 
				
			
			@ -158,8 +158,8 @@ const Input = (($) => {
 | 
			
		|||
 | 
			
		||||
    _findOrCreateFormGroup() {
 | 
			
		||||
      let fg = this.$element.closest(Selector.FORM_GROUP) // note that form-group may be grandparent in the case of an input-group
 | 
			
		||||
      if (fg.length === 0) {
 | 
			
		||||
        this.$element.wrap(this.config.$formGroup.template)
 | 
			
		||||
      if (fg === null || fg.length === 0) {
 | 
			
		||||
        this.$element.wrap(this.config.formGroup.template)
 | 
			
		||||
        fg = this.$element.closest(Selector.FORM_GROUP) // find node after attached (otherwise additional attachments don't work)
 | 
			
		||||
      }
 | 
			
		||||
      return fg
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,8 +22,8 @@ const Foo = (($) => {
 | 
			
		|||
   */
 | 
			
		||||
  class Foo {
 | 
			
		||||
 | 
			
		||||
    constructor($element, config) {
 | 
			
		||||
      this.$element = $element
 | 
			
		||||
    constructor(element, config) {
 | 
			
		||||
      this.$element = $(element)
 | 
			
		||||
      this.config = $.extend({}, Default, config)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,8 +23,8 @@ const Radio = (($) => {
 | 
			
		|||
   */
 | 
			
		||||
  class Radio {
 | 
			
		||||
 | 
			
		||||
    constructor($element, config) {
 | 
			
		||||
      this.$element = $element
 | 
			
		||||
    constructor(element, config) {
 | 
			
		||||
      this.$element = $(element)
 | 
			
		||||
      this.config = $.extend({}, Default, config)
 | 
			
		||||
 | 
			
		||||
      this.$element.after(this.config.template)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,8 +44,8 @@ const Ripples = (($) => {
 | 
			
		|||
   */
 | 
			
		||||
  class Ripples {
 | 
			
		||||
 | 
			
		||||
    constructor($element, config) {
 | 
			
		||||
      this.$element = $element
 | 
			
		||||
    constructor(element, config) {
 | 
			
		||||
      this.$element = $(element)
 | 
			
		||||
      this.config = $.extend({}, Default, config)
 | 
			
		||||
 | 
			
		||||
      // attach initial listener
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,8 +23,8 @@ const Togglebutton = (($) => {
 | 
			
		|||
   */
 | 
			
		||||
  class Togglebutton {
 | 
			
		||||
 | 
			
		||||
    constructor($element, config) {
 | 
			
		||||
      this.$element = $element
 | 
			
		||||
    constructor(element, config) {
 | 
			
		||||
      this.$element = $(element)
 | 
			
		||||
      this.config = $.extend({}, Default, config)
 | 
			
		||||
 | 
			
		||||
      this.$element.after(this.config.template)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,9 +86,9 @@ const Util = (($) => {
 | 
			
		|||
    /**
 | 
			
		||||
     Find expected form-group
 | 
			
		||||
     */
 | 
			
		||||
    findFormGroup($element) {
 | 
			
		||||
    findFormGroup($element, raiseError = true) {
 | 
			
		||||
      let fg = $element.closest(Selector.FORM_GROUP) // note that form-group may be grandparent in the case of an input-group
 | 
			
		||||
      if (fg.length === 0) {
 | 
			
		||||
      if (fg.length === 0 && raiseError) {
 | 
			
		||||
        $.error(`Failed to find form-group for ${$element}`)
 | 
			
		||||
      }
 | 
			
		||||
      return fg
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user