-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(positioning): fix errors on invalid position (#5212)
* fix(positioning): fix errors on invalid position
- Loading branch information
Showing
14 changed files
with
98 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,5 @@ export interface Options { | |
enabled: boolean; | ||
}; | ||
}; | ||
allowedPositions?: string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Update class for the given popper | ||
*/ | ||
import { Renderer2 } from '@angular/core'; | ||
import { Data } from '../models'; | ||
|
||
export function updateContainerClass(data: Data, renderer?: Renderer2): void { | ||
const target = data.instance.target; | ||
|
||
let containerClass = target.className; | ||
|
||
if (data.placementAuto) { | ||
containerClass = containerClass.replace(/bs-popover-auto/g, `bs-popover-${data.placement}`); | ||
containerClass = containerClass.replace(/bs-tooltip-auto/g, `bs-tooltip-${data.placement}`); | ||
containerClass = containerClass.replace(/\sauto/g, ` ${data.placement}`); | ||
|
||
if (containerClass.indexOf('popover') !== -1 && containerClass.indexOf('popover-auto') === -1) { | ||
containerClass += ' popover-auto'; | ||
} | ||
|
||
if (containerClass.indexOf('tooltip') !== -1 && containerClass.indexOf('tooltip-auto') === -1) { | ||
containerClass += ' tooltip-auto'; | ||
} | ||
} | ||
|
||
containerClass = containerClass.replace(/left|right|top|bottom/g, `${data.placement.split(' ')[0]}`); | ||
|
||
if (renderer) { | ||
renderer.setAttribute(target, 'class', containerClass); | ||
|
||
return; | ||
} | ||
|
||
target.className = containerClass; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters