From 8b74d8bcb108640030c9a0165290aef00fa21288 Mon Sep 17 00:00:00 2001 From: "BugMaker.Huang" Date: Tue, 20 Feb 2024 18:09:36 +0800 Subject: [PATCH] fix: modify some default-true properties --- packages/banana/src/carousel/index.ts | 9 +++++---- packages/banana/src/dropdown/index.ts | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/banana/src/carousel/index.ts b/packages/banana/src/carousel/index.ts index 68b3e158..685c3221 100644 --- a/packages/banana/src/carousel/index.ts +++ b/packages/banana/src/carousel/index.ts @@ -99,8 +99,9 @@ export default class BCarousel extends LitElement { @property({ type: Number, reflect: true, attribute: 'autoplay-delay' }) autoplayDelay = 3000; - @property({ type: Boolean, reflect: true, attribute: 'pause-on-mouse-enter' }) - pauseOnMouseEnter = true; + // Caraousel will pause when mouse enter by default. + @property({ type: Boolean, reflect: true, attribute: 'no-pause-on-mouse-enter' }) + noPauseOnMouseEnter = false; @property({ type: Boolean, reflect: true, attribute: 'disable-drag' }) disableDrag = false; @@ -445,13 +446,13 @@ export default class BCarousel extends LitElement { } private _onWrapperMouseEnter() { - if (this.pauseOnMouseEnter) { + if (!this.noPauseOnMouseEnter) { this._clearAutoplayTimer(); } } private _onWrapperMouseLeave() { - if (this.pauseOnMouseEnter) { + if (!this.noPauseOnMouseEnter) { this._setAutoplayTimer(); } } diff --git a/packages/banana/src/dropdown/index.ts b/packages/banana/src/dropdown/index.ts index 991af7fc..b7a74554 100644 --- a/packages/banana/src/dropdown/index.ts +++ b/packages/banana/src/dropdown/index.ts @@ -55,8 +55,8 @@ export default class BDropdown extends LitElement { @property({ reflect: true }) placement: Placement = 'bottomLeft'; - @property({ type: Boolean, reflect: true, attribute: 'auto-adjust-overflow' }) - autoAdjustOverflow = true; + @property({ type: Boolean, reflect: true, attribute: 'no-auto-adjust-overflow' }) + noAutoAdjustOverflow = false; @property({ reflect: true, attribute: 'trigger-action' }) triggerAction: 'hover' | 'click' = 'hover'; @@ -72,7 +72,7 @@ export default class BDropdown extends LitElement { if (!this._trigger || !this._content) return; const middleware: ComputePositionConfig['middleware'] = [offset(this.margin)]; - if (this.autoAdjustOverflow) middleware.push(flip()); + if (!this.noAutoAdjustOverflow) middleware.push(flip()); if (this._arrowElements[0] !== undefined) middleware.push(arrow({ element: this._arrowElements[0] })); void computePosition(this._trigger, this._content, {