jquery from position.js, select.js

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia 2023-02-21 17:22:03 +01:00
parent f76a53c02c
commit d1e7734ece
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393
2 changed files with 6 additions and 11 deletions

View File

@ -1,5 +1,4 @@
// @TODO replace this with popper.js...
import $ from 'jquery';
export const LEFT = 'left';
export const RIGHT = 'right';
@ -10,10 +9,9 @@ export const BOTTOM = 'bottom';
export const AUTO = 'auto';
export function boundingRect(elem) {
const $elem = $(elem);
const pos = $elem.offset();
const width = $elem.outerWidth(false);
const height = $elem.outerHeight(false);
const pos = elem.getBoundingClientRect();
const width = elem.offsetWidth;
const height = elem.offsetHeight;
return {
top: pos.top,
@ -37,9 +35,8 @@ export function fakeRectFor(event) {
}
export function screenRect() {
const $window = $(window);
const width = $window.width();
const height = $window.height();
const width = window.innerWidth;
const height = window.innerHeight;
const top = window.pageYOffset;
const left = window.pageXOffset;

View File

@ -1,5 +1,3 @@
import $ from 'jquery';
export function onClickOption(option, e) {
if (!this.$attrs.multiple) {
return;
@ -29,7 +27,7 @@ export function onClickOption(option, e) {
// We used to use popper for these, but it does not suppotr fractional pixel placements which
// means the dropdown does not appear aligned to the control when placed in a column-based layout
export function calculatePosition(dropdownList, component, width, placement) {
const selectEl = $(component.$parent.$el)[0];
const selectEl = component.$parent.$el;
const r = selectEl.getBoundingClientRect();
const p = placement || 'bottom-start';
const docHeight = document.body.offsetHeight;