Skip to content

Commit

Permalink
fix(common): consider target size when auto-position picker/modal (#1517
Browse files Browse the repository at this point in the history
)

- when calculating picker/modal by available position, it should (wasn't) consider targeted element. For example when a calendar picker is reposition according to attached input
- exact same change was applied to Vanilla-Calendar-Picker external dep, also remove it from unused package.json
  • Loading branch information
ghiscoding committed May 9, 2024
1 parent ba68019 commit e3a70b8
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 19 deletions.
1 change: 0 additions & 1 deletion examples/vite-demo-vanilla-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"fetch-jsonp": "^1.3.0",
"multiple-select-vanilla": "^3.2.0",
"rxjs": "^7.8.1",
"vanilla-calendar-picker": "^2.11.4",
"whatwg-fetch": "^3.6.20"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.8.0",
"vanilla-calendar-picker": "^2.11.4",
"whatwg-fetch": "^3.6.20"
},
"funding": {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"multiple-select-vanilla": "^3.2.0",
"sortablejs": "^1.15.2",
"un-flatten-tree": "^2.0.12",
"vanilla-calendar-picker": "^2.11.4"
"vanilla-calendar-picker": "^2.11.5"
},
"devDependencies": {
"autoprefixer": "^10.4.19",
Expand Down
4 changes: 2 additions & 2 deletions packages/utils/src/domUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export function calculateAvailableSpace(element: HTMLElement): { top: number; bo
const elementOffsetTop = elmOffset.top ?? 0;
const elementOffsetLeft = elmOffset.left ?? 0;
top = elementOffsetTop - pageScrollTop;
bottom = windowHeight - (elementOffsetTop - pageScrollTop);
left = elementOffsetLeft - pageScrollLeft;
right = windowWidth - (elementOffsetLeft - pageScrollLeft);
bottom = windowHeight - (elementOffsetTop - pageScrollTop + element.clientHeight);
right = windowWidth - (elementOffsetLeft - pageScrollLeft + element.clientWidth);
}

return { top, bottom, left, right };
Expand Down
1 change: 0 additions & 1 deletion packages/vanilla-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"@slickgrid-universal/utils": "workspace:~",
"dequal": "^2.0.3",
"sortablejs": "^1.15.2",
"vanilla-calendar-picker": "^2.11.4",
"whatwg-fetch": "^3.6.20"
},
"devDependencies": {
Expand Down
Binary file not shown.
18 changes: 5 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e3a70b8

Please sign in to comment.