Compare commits

...
Sign in to create a new pull request.

6 commits

Author SHA1 Message Date
XhmikosR
ea0eaa0b8b
Merge branch 'main' into main-xmr-js-isRTL 2021-01-13 22:44:32 +02:00
XhmikosR
742a551ec0
Merge branch 'main' into main-xmr-js-isRTL 2021-01-09 14:40:14 +02:00
XhmikosR
26cc6665e9
Merge branch 'main' into main-xmr-js-isRTL 2020-12-17 15:09:55 +02:00
XhmikosR
ec2172dfdb Revert "WIP" 2020-12-16 11:24:14 +02:00
XhmikosR
1c2a3bc418 WIP 2020-12-16 11:20:55 +02:00
XhmikosR
f5ca90bd80 util: change isRTL to a function
This allows the bundler to tree-shake the function.
2020-12-16 11:20:50 +02:00
5 changed files with 21 additions and 18 deletions

View file

@ -251,7 +251,7 @@ class Carousel extends BaseComponent {
// swipe left // swipe left
if (direction > 0) { if (direction > 0) {
if (isRTL) { if (isRTL()) {
this.next() this.next()
} else { } else {
this.prev() this.prev()
@ -260,7 +260,7 @@ class Carousel extends BaseComponent {
// swipe right // swipe right
if (direction < 0) { if (direction < 0) {
if (isRTL) { if (isRTL()) {
this.prev() this.prev()
} else { } else {
this.next() this.next()
@ -348,14 +348,14 @@ class Carousel extends BaseComponent {
if (event.key === ARROW_LEFT_KEY) { if (event.key === ARROW_LEFT_KEY) {
event.preventDefault() event.preventDefault()
if (isRTL) { if (isRTL()) {
this.next() this.next()
} else { } else {
this.prev() this.prev()
} }
} else if (event.key === ARROW_RIGHT_KEY) { } else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault() event.preventDefault()
if (isRTL) { if (isRTL()) {
this.prev() this.prev()
} else { } else {
this.next() this.next()

View file

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

View file

@ -431,14 +431,13 @@ class Modal extends BaseComponent {
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
_adjustDialog() { _adjustDialog() {
const isModalOverflowing = const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight
this._element.scrollHeight > document.documentElement.clientHeight
if ((!this._isBodyOverflowing && isModalOverflowing && !isRTL) || (this._isBodyOverflowing && !isModalOverflowing && isRTL)) { if ((!this._isBodyOverflowing && isModalOverflowing && !isRTL()) || (this._isBodyOverflowing && !isModalOverflowing && isRTL())) {
this._element.style.paddingLeft = `${this._scrollbarWidth}px` this._element.style.paddingLeft = `${this._scrollbarWidth}px`
} }
if ((this._isBodyOverflowing && !isModalOverflowing && !isRTL) || (!this._isBodyOverflowing && isModalOverflowing && isRTL)) { if ((this._isBodyOverflowing && !isModalOverflowing && !isRTL()) || (!this._isBodyOverflowing && isModalOverflowing && isRTL())) {
this._element.style.paddingRight = `${this._scrollbarWidth}px` this._element.style.paddingRight = `${this._scrollbarWidth}px`
} }
} }

View file

@ -63,9 +63,9 @@ const DefaultType = {
const AttachmentMap = { const AttachmentMap = {
AUTO: 'auto', AUTO: 'auto',
TOP: 'top', TOP: 'top',
RIGHT: isRTL ? 'left' : 'right', RIGHT: isRTL() ? 'left' : 'right',
BOTTOM: 'bottom', BOTTOM: 'bottom',
LEFT: isRTL ? 'right' : 'left' LEFT: isRTL() ? 'right' : 'left'
} }
const Default = { const Default = {
@ -533,7 +533,11 @@ class Tooltip extends BaseComponent {
triggers.forEach(trigger => { triggers.forEach(trigger => {
if (trigger === 'click') { if (trigger === 'click') {
EventHandler.on(this._element, this.constructor.Event.CLICK, this.config.selector, event => this.toggle(event) EventHandler.on(
this._element,
this.constructor.Event.CLICK,
this.config.selector,
event => this.toggle(event)
) )
} else if (trigger !== TRIGGER_MANUAL) { } else if (trigger !== TRIGGER_MANUAL) {
const eventIn = trigger === TRIGGER_HOVER ? const eventIn = trigger === TRIGGER_HOVER ?

View file

@ -185,7 +185,7 @@ const onDOMContentLoaded = callback => {
} }
} }
const isRTL = document.documentElement.dir === 'rtl' const isRTL = () => document.documentElement.dir === 'rtl'
const defineJQueryPlugin = (name, plugin) => { const defineJQueryPlugin = (name, plugin) => {
onDOMContentLoaded(() => { onDOMContentLoaded(() => {