add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import useLayoutEffect from "rc-util/es/hooks/useLayoutEffect";
import { collectScroller, getWin } from "../util";
export default function useWatch(open, target, popup, onAlign, onScroll) {
useLayoutEffect(function () {
if (open && target && popup) {
var targetElement = target;
var popupElement = popup;
var targetScrollList = collectScroller(targetElement);
var popupScrollList = collectScroller(popupElement);
var win = getWin(popupElement);
var mergedList = new Set([win].concat(_toConsumableArray(targetScrollList), _toConsumableArray(popupScrollList)));
function notifyScroll() {
onAlign();
onScroll();
}
mergedList.forEach(function (scroller) {
scroller.addEventListener('scroll', notifyScroll, {
passive: true
});
});
win.addEventListener('resize', notifyScroll, {
passive: true
});
// First time always do align
onAlign();
return function () {
mergedList.forEach(function (scroller) {
scroller.removeEventListener('scroll', notifyScroll);
win.removeEventListener('resize', notifyScroll);
});
};
}
}, [open, target, popup]);
}