This commit is contained in:
XhmikosR 2020-12-16 11:07:37 +02:00
parent f5ca90bd80
commit 1c2a3bc418
4 changed files with 21 additions and 14 deletions

View file

@ -96,6 +96,8 @@ const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'
const POINTER_TYPE_TOUCH = 'touch'
const POINTER_TYPE_PEN = 'pen'
const IS_RTL = isRTL()
/**
* ------------------------------------------------------------------------
* Class Definition
@ -251,7 +253,7 @@ class Carousel extends BaseComponent {
// swipe left
if (direction > 0) {
if (isRTL()) {
if (IS_RTL) {
this.next()
} else {
this.prev()
@ -260,7 +262,7 @@ class Carousel extends BaseComponent {
// swipe right
if (direction < 0) {
if (isRTL()) {
if (IS_RTL) {
this.prev()
} else {
this.next()
@ -348,14 +350,14 @@ class Carousel extends BaseComponent {
if (event.key === ARROW_LEFT_KEY) {
event.preventDefault()
if (isRTL()) {
if (IS_RTL) {
this.next()
} else {
this.prev()
}
} else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault()
if (isRTL()) {
if (IS_RTL) {
this.prev()
} else {
this.next()

View file

@ -64,12 +64,14 @@ const SELECTOR_MENU = '.dropdown-menu'
const SELECTOR_NAVBAR_NAV = '.navbar-nav'
const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'
const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'
const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'
const IS_RTL = isRTL()
const PLACEMENT_TOP = IS_RTL ? 'top-end' : 'top-start'
const PLACEMENT_TOPEND = IS_RTL ? 'top-start' : 'top-end'
const PLACEMENT_BOTTOM = IS_RTL ? 'bottom-end' : 'bottom-start'
const PLACEMENT_BOTTOMEND = IS_RTL ? 'bottom-start' : 'bottom-end'
const PLACEMENT_RIGHT = IS_RTL ? 'left-start' : 'right-start'
const PLACEMENT_LEFT = IS_RTL ? 'right-start' : 'left-start'
const Default = {
offset: 0,

View file

@ -72,6 +72,8 @@ const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]'
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'
const SELECTOR_STICKY_CONTENT = '.sticky-top'
const IS_RTL = isRTL()
/**
* ------------------------------------------------------------------------
* Class Definition
@ -433,11 +435,11 @@ class Modal extends BaseComponent {
_adjustDialog() {
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight
if ((!this._isBodyOverflowing && isModalOverflowing && !isRTL()) || (this._isBodyOverflowing && !isModalOverflowing && isRTL())) {
if ((!this._isBodyOverflowing && isModalOverflowing && !IS_RTL) || (this._isBodyOverflowing && !isModalOverflowing && IS_RTL)) {
this._element.style.paddingLeft = `${this._scrollbarWidth}px`
}
if ((this._isBodyOverflowing && !isModalOverflowing && !isRTL()) || (!this._isBodyOverflowing && isModalOverflowing && isRTL())) {
if ((this._isBodyOverflowing && !isModalOverflowing && !IS_RTL) || (!this._isBodyOverflowing && isModalOverflowing && IS_RTL)) {
this._element.style.paddingRight = `${this._scrollbarWidth}px`
}
}

View file

@ -40,6 +40,7 @@ const EVENT_KEY = `.${DATA_KEY}`
const CLASS_PREFIX = 'bs-tooltip'
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])
const IS_RTL = isRTL()
const DefaultType = {
animation: 'boolean',
@ -63,9 +64,9 @@ const DefaultType = {
const AttachmentMap = {
AUTO: 'auto',
TOP: 'top',
RIGHT: isRTL() ? 'left' : 'right',
RIGHT: IS_RTL ? 'left' : 'right',
BOTTOM: 'bottom',
LEFT: isRTL() ? 'right' : 'left'
LEFT: IS_RTL ? 'right' : 'left'
}
const Default = {