From 886b940796b3595a03b44230ca8b78197c5ee1c5 Mon Sep 17 00:00:00 2001 From: GeoSot Date: Fri, 10 Dec 2021 18:18:18 +0200 Subject: Extract Component config functionality to a separate class (#33872) Co-authored-by: XhmikosR --- js/src/base-component.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index 3c5eb460a..4140bf194 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -6,11 +6,9 @@ */ import Data from './dom/data' -import { - executeAfterTransition, - getElement -} from './util/index' +import { executeAfterTransition, getElement } from './util/index' import EventHandler from './dom/event-handler' +import Config from './util/config' /** * Constants @@ -22,15 +20,18 @@ const VERSION = '5.1.3' * Class definition */ -class BaseComponent { - constructor(element) { - element = getElement(element) +class BaseComponent extends Config { + constructor(element, config) { + super() + element = getElement(element) if (!element) { return } this._element = element + this._config = this._getConfig(config) + Data.set(this._element, this.constructor.DATA_KEY, this) } @@ -48,6 +49,13 @@ class BaseComponent { executeAfterTransition(callback, element, isAnimated) } + _getConfig(config) { + config = this._mergeConfigObj(config, this._element) + config = this._configAfterMerge(config) + this._typeCheckConfig(config) + return config + } + // Static static getInstance(element) { return Data.get(getElement(element), this.DATA_KEY) @@ -61,10 +69,6 @@ class BaseComponent { return VERSION } - static get NAME() { - throw new Error('You have to implement the static method "NAME" for each component!') - } - static get DATA_KEY() { return `bs.${this.NAME}` } -- cgit v1.2.3 From 407af8ac7f9296627aebc1e4c5d0ee948f8be1f3 Mon Sep 17 00:00:00 2001 From: GeoSot Date: Sat, 19 Feb 2022 15:10:47 +0200 Subject: Make event name helper and use it on tooltip & popover to reduce dist sizes (#35856) * feat: create eventName getter function in baseComponent * refactor: use `eventName` getter on tooltip & popover --- js/src/base-component.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index 4140bf194..75bb90c32 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -76,6 +76,10 @@ class BaseComponent extends Config { static get EVENT_KEY() { return `.${this.DATA_KEY}` } + + static eventName(name) { + return `${name}${this.EVENT_KEY}` + } } export default BaseComponent -- cgit v1.2.3 From f7e8ca91e03165abb82d4c82555dc4ef96340cc9 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 6 May 2022 23:57:58 +0300 Subject: Prepare v5.2.0-beta1 --- js/src/base-component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index 75bb90c32..09de681be 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.3): base-component.js + * Bootstrap (v5.2.0-beta1): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -14,7 +14,7 @@ import Config from './util/config' * Constants */ -const VERSION = '5.1.3' +const VERSION = '5.2.0-beta1' /** * Class definition -- cgit v1.2.3 From edf9c40956d19e6ab3f9151bfe0dfac6be06fa21 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 19 Jul 2022 18:43:58 +0300 Subject: Release v5.2.0 (#36768) * Bump version to 5.2.0 * Dist * Update masthead.html --- js/src/base-component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index 09de681be..b5008b3a2 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): base-component.js + * Bootstrap (v5.2.0): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -14,7 +14,7 @@ import Config from './util/config' * Constants */ -const VERSION = '5.2.0-beta1' +const VERSION = '5.2.0' /** * Class definition -- cgit v1.2.3 From 23e50829f958ea1d741d63e2781716be037e4644 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 7 Sep 2022 18:31:39 +0300 Subject: Release v5.2.1 (#37098) * Bump version to v5.2.1. * Dist --- js/src/base-component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index b5008b3a2..a80a20136 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0): base-component.js + * Bootstrap (v5.2.1): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -14,7 +14,7 @@ import Config from './util/config' * Constants */ -const VERSION = '5.2.0' +const VERSION = '5.2.1' /** * Class definition -- cgit v1.2.3 From 961d5ff9844372a4e294980c667bbe7e0651cdeb Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 3 Oct 2022 10:44:02 +0300 Subject: Release v5.2.2 (#37236) * Bump version to v5.2.2 * Dist --- js/src/base-component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index a80a20136..dba5e0742 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.1): base-component.js + * Bootstrap (v5.2.2): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -14,7 +14,7 @@ import Config from './util/config' * Constants */ -const VERSION = '5.2.1' +const VERSION = '5.2.2' /** * Class definition -- cgit v1.2.3 From aa9d32dd153ed16943ad8be5e8795afaad24d0cf Mon Sep 17 00:00:00 2001 From: GeoSot Date: Wed, 26 Oct 2022 08:26:51 +0300 Subject: Use explicit imports in our javascript source files (#36854) --- js/src/base-component.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index dba5e0742..168d7f8cb 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -5,10 +5,10 @@ * -------------------------------------------------------------------------- */ -import Data from './dom/data' -import { executeAfterTransition, getElement } from './util/index' -import EventHandler from './dom/event-handler' -import Config from './util/config' +import Data from './dom/data.js' +import { executeAfterTransition, getElement } from './util/index.js' +import EventHandler from './dom/event-handler.js' +import Config from './util/config.js' /** * Constants -- cgit v1.2.3 From 39589472f709ddf7d614ffd4f0ab1a50e542ac91 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 21 Nov 2022 20:15:33 +0200 Subject: Bump version to 5.2.3 --- js/src/base-component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index dba5e0742..0c1a2592d 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.2): base-component.js + * Bootstrap (v5.2.3): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -14,7 +14,7 @@ import Config from './util/config' * Constants */ -const VERSION = '5.2.2' +const VERSION = '5.2.3' /** * Class definition -- cgit v1.2.3 From cf9454caa00872899215603e5e036d9a824b1b11 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 24 Dec 2022 18:37:22 +0200 Subject: Release v5.3.0-alpha1 (#37661) * Bump version to 5.3.0-alpha1 * Dist * Add docs versions updates * Update note in homepage hero Co-authored-by: Mark Otto --- js/src/base-component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index ea266cee8..6b64aefd6 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.3): base-component.js + * Bootstrap (v5.3.0-alpha1): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -14,7 +14,7 @@ import Config from './util/config.js' * Constants */ -const VERSION = '5.2.3' +const VERSION = '5.3.0-alpha1' /** * Class definition -- cgit v1.2.3 From ab049cd4a02650ca95d490217f93bd628f9295a6 Mon Sep 17 00:00:00 2001 From: GeoSot Date: Wed, 22 Mar 2023 09:12:33 +0200 Subject: Remove version comment from JavaScript src files (#38294) --- js/src/base-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index 6b64aefd6..2015311a0 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.3.0-alpha1): base-component.js + * Bootstrap base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ -- cgit v1.2.3 From c877cefcef18d6a60c5eaec8df469933e64e212a Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 24 Mar 2023 16:30:16 +0200 Subject: Release v5.3.0-alpha2 (#38244) * Bump version to 5.3.0-alpha2 * Dist --- js/src/base-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index 2015311a0..ee30390ae 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -14,7 +14,7 @@ import Config from './util/config.js' * Constants */ -const VERSION = '5.3.0-alpha1' +const VERSION = '5.3.0-alpha2' /** * Class definition -- cgit v1.2.3 From ae43f0c48bf7acede8a325b24197001fe2b2f416 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 29 Mar 2023 20:49:30 +0300 Subject: Tweak and re-organize ESLint config (#38369) * Tweak and re-organize ESLint config * merge individual configs to the root config * enable more eslint-plugin-import rules * lint markdown files * Lint --- js/src/base-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index ee30390ae..813fc39c6 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -6,9 +6,9 @@ */ import Data from './dom/data.js' -import { executeAfterTransition, getElement } from './util/index.js' import EventHandler from './dom/event-handler.js' import Config from './util/config.js' +import { executeAfterTransition, getElement } from './util/index.js' /** * Constants -- cgit v1.2.3 From 60098ac499d30aa50575b0b7137391c06ef25429 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 30 May 2023 18:15:55 +0300 Subject: Release v5.3.0 (#38657) * Bump version to 5.3.0 * Dist --- js/src/base-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index 813fc39c6..d13c7abab 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -14,7 +14,7 @@ import { executeAfterTransition, getElement } from './util/index.js' * Constants */ -const VERSION = '5.3.0-alpha2' +const VERSION = '5.3.0' /** * Class definition -- cgit v1.2.3 From 2a1bf52b73fc9a97f6fef75aa1b29b3e9f0288b3 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 26 Jul 2023 10:46:38 +0300 Subject: Release v5.3.1 (#38956) * Bump version to 5.3.1 * Dist --- js/src/base-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index d13c7abab..19a09ad2d 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -14,7 +14,7 @@ import { executeAfterTransition, getElement } from './util/index.js' * Constants */ -const VERSION = '5.3.0' +const VERSION = '5.3.1' /** * Class definition -- cgit v1.2.3 From 344e912d04b5b6a04482113eff20ab416ff01048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20D=C3=A9ramond?= Date: Thu, 14 Sep 2023 16:19:27 +0200 Subject: Release v5.3.2 (#39173) * Bump version to 5.3.2 * Dist --- js/src/base-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index 19a09ad2d..85af731ef 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -14,7 +14,7 @@ import { executeAfterTransition, getElement } from './util/index.js' * Constants */ -const VERSION = '5.3.1' +const VERSION = '5.3.2' /** * Class definition -- cgit v1.2.3 From 6e1f75f420f68e1d52733b8e407fc7c3766c9dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20D=C3=A9ramond?= Date: Tue, 20 Feb 2024 16:14:29 +0100 Subject: Release v5.3.3 (#39524) * Release v5.3.3 * Dist --------- Co-authored-by: XhmikosR --- js/src/base-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index 85af731ef..82bf77030 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -14,7 +14,7 @@ import { executeAfterTransition, getElement } from './util/index.js' * Constants */ -const VERSION = '5.3.2' +const VERSION = '5.3.3' /** * Class definition -- cgit v1.2.3