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

View File

@ -1,5 +1,3 @@
import $ from 'jquery';
export function onClickOption(option, e) { export function onClickOption(option, e) {
if (!this.$attrs.multiple) { if (!this.$attrs.multiple) {
return; 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 // 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 // means the dropdown does not appear aligned to the control when placed in a column-based layout
export function calculatePosition(dropdownList, component, width, placement) { export function calculatePosition(dropdownList, component, width, placement) {
const selectEl = $(component.$parent.$el)[0]; const selectEl = component.$parent.$el;
const r = selectEl.getBoundingClientRect(); const r = selectEl.getBoundingClientRect();
const p = placement || 'bottom-start'; const p = placement || 'bottom-start';
const docHeight = document.body.offsetHeight; const docHeight = document.body.offsetHeight;