mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-22 17:47:11 +03:00
namespace all jquery global functions as mdb*
This commit is contained in:
parent
97b11afbc4
commit
99bccfde1b
|
@ -7,7 +7,8 @@ const Autofill = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'autofill'
|
const NAME = 'autofill'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {}
|
const Default = {}
|
||||||
|
|
||||||
|
@ -95,10 +96,10 @@ const Autofill = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = Autofill._jQueryInterface
|
$.fn[JQUERY_NAME] = Autofill._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Autofill
|
$.fn[JQUERY_NAME].Constructor = Autofill
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return Autofill._jQueryInterface
|
return Autofill._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
js/src/bootstrapMaterialDesign.js
vendored
18
js/src/bootstrapMaterialDesign.js
vendored
|
@ -13,7 +13,8 @@ const BootstrapMaterialDesign = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'bootstrapMaterialDesign'
|
const NAME = 'bootstrapMaterialDesign'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = NAME // retain this full name since it is long enough not to conflict
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -105,14 +106,17 @@ const BootstrapMaterialDesign = (($) => {
|
||||||
// assemble the selector as it may be an array
|
// assemble the selector as it may be an array
|
||||||
let selector = this._resolveSelector(componentConfig)
|
let selector = this._resolveSelector(componentConfig)
|
||||||
|
|
||||||
|
// create the jquery fn name e.g. 'mdbText' for 'text'
|
||||||
|
let jqueryFn = `mdb${component.charAt(0).toUpperCase() + component.slice(1)}`
|
||||||
|
|
||||||
// instantiate component on selector elements with config
|
// instantiate component on selector elements with config
|
||||||
// console.debug(`instantiating: ${component}`)
|
// console.debug(`instantiating: ${component}`)
|
||||||
$(selector)[component](componentConfig)
|
$(selector)[jqueryFn](componentConfig)
|
||||||
|
|
||||||
// add to arrive if present and enabled
|
// add to arrive if present and enabled
|
||||||
if (document.arrive && this.config.arrive) {
|
if (document.arrive && this.config.arrive) {
|
||||||
$document.arrive(selector, (element) => { // eslint-disable-line no-loop-func
|
$document.arrive(selector, (element) => { // eslint-disable-line no-loop-func
|
||||||
$(element)[component](componentConfig)
|
$(element)[jqueryFn](componentConfig)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,10 +161,10 @@ const BootstrapMaterialDesign = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = BootstrapMaterialDesign._jQueryInterface
|
$.fn[JQUERY_NAME] = BootstrapMaterialDesign._jQueryInterface
|
||||||
$.fn[NAME].Constructor = BootstrapMaterialDesign
|
$.fn[JQUERY_NAME].Constructor = BootstrapMaterialDesign
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return BootstrapMaterialDesign._jQueryInterface
|
return BootstrapMaterialDesign._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ const Checkbox = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'checkbox'
|
const NAME = 'checkbox'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
template: `<span class='checkbox-decorator'><span class='check'></span></span>`
|
template: `<span class='checkbox-decorator'><span class='check'></span></span>`
|
||||||
|
@ -79,10 +80,10 @@ const Checkbox = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = Checkbox._jQueryInterface
|
$.fn[JQUERY_NAME] = Checkbox._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Checkbox
|
$.fn[JQUERY_NAME].Constructor = Checkbox
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return Checkbox._jQueryInterface
|
return Checkbox._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ const CheckboxInline = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'checkboxInline'
|
const NAME = 'checkboxInline'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {}
|
const Default = {}
|
||||||
|
|
||||||
|
@ -69,10 +70,10 @@ const CheckboxInline = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = CheckboxInline._jQueryInterface
|
$.fn[JQUERY_NAME] = CheckboxInline._jQueryInterface
|
||||||
$.fn[NAME].Constructor = CheckboxInline
|
$.fn[JQUERY_NAME].Constructor = CheckboxInline
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return CheckboxInline._jQueryInterface
|
return CheckboxInline._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ const File = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'file'
|
const NAME = 'file'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {}
|
const Default = {}
|
||||||
|
|
||||||
|
@ -122,10 +123,10 @@ const File = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = File._jQueryInterface
|
$.fn[JQUERY_NAME] = File._jQueryInterface
|
||||||
$.fn[NAME].Constructor = File
|
$.fn[JQUERY_NAME].Constructor = File
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return File._jQueryInterface
|
return File._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ const Foo = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'foo'
|
const NAME = 'foo'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
template: ``
|
template: ``
|
||||||
|
@ -61,10 +61,10 @@ const Foo = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = Foo._jQueryInterface
|
$.fn[JQUERY_NAME] = Foo._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Foo
|
$.fn[JQUERY_NAME].Constructor = Foo
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return Foo._jQueryInterface
|
return Foo._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ const Radio = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'radio'
|
const NAME = 'radio'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
template: `<span class='radio-decorator'></span><span class='check'></span>`
|
template: `<span class='radio-decorator'></span><span class='check'></span>`
|
||||||
|
@ -75,10 +76,10 @@ const Radio = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = Radio._jQueryInterface
|
$.fn[JQUERY_NAME] = Radio._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Radio
|
$.fn[JQUERY_NAME].Constructor = Radio
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return Radio._jQueryInterface
|
return Radio._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ const RadioInline = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'radioInline'
|
const NAME = 'radioInline'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {}
|
const Default = {}
|
||||||
|
|
||||||
|
@ -57,10 +58,10 @@ const RadioInline = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = RadioInline._jQueryInterface
|
$.fn[JQUERY_NAME] = RadioInline._jQueryInterface
|
||||||
$.fn[NAME].Constructor = RadioInline
|
$.fn[JQUERY_NAME].Constructor = RadioInline
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return RadioInline._jQueryInterface
|
return RadioInline._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ const Ripples = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'ripples'
|
const NAME = 'ripples'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
CONTAINER: 'ripple-container',
|
CONTAINER: 'ripple-container',
|
||||||
|
@ -284,10 +285,10 @@ const Ripples = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = Ripples._jQueryInterface
|
$.fn[JQUERY_NAME] = Ripples._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Ripples
|
$.fn[JQUERY_NAME].Constructor = Ripples
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return Ripples._jQueryInterface
|
return Ripples._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ const Select = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'select'
|
const NAME = 'select'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
requiredClasses: ['form-control||c-select']
|
requiredClasses: ['form-control||c-select']
|
||||||
|
@ -73,10 +74,10 @@ const Select = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = Select._jQueryInterface
|
$.fn[JQUERY_NAME] = Select._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Select
|
$.fn[JQUERY_NAME].Constructor = Select
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return Select._jQueryInterface
|
return Select._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ const Switch = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'switch'
|
const NAME = 'switch'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
template: `<span class='switch-decorator'></span>`
|
template: `<span class='switch-decorator'></span>`
|
||||||
|
@ -57,10 +58,10 @@ const Switch = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = Switch._jQueryInterface
|
$.fn[JQUERY_NAME] = Switch._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Switch
|
$.fn[JQUERY_NAME].Constructor = Switch
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return Switch._jQueryInterface
|
return Switch._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ const Text = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'text'
|
const NAME = 'text'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
template: `<span class='text-input-decorator'></span>`,
|
template: `<span class='text-input-decorator'></span>`,
|
||||||
|
@ -98,10 +99,10 @@ const Text = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = Text._jQueryInterface
|
$.fn[JQUERY_NAME] = Text._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Text
|
$.fn[JQUERY_NAME].Constructor = Text
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return Text._jQueryInterface
|
return Text._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ const Textarea = (($) => {
|
||||||
*/
|
*/
|
||||||
const NAME = 'textarea'
|
const NAME = 'textarea'
|
||||||
const DATA_KEY = `mdb.${NAME}`
|
const DATA_KEY = `mdb.${NAME}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {}
|
const Default = {}
|
||||||
|
|
||||||
|
@ -71,10 +72,10 @@ const Textarea = (($) => {
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$.fn[NAME] = Textarea._jQueryInterface
|
$.fn[JQUERY_NAME] = Textarea._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Textarea
|
$.fn[JQUERY_NAME].Constructor = Textarea
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[JQUERY_NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT
|
||||||
return Textarea._jQueryInterface
|
return Textarea._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user