tuiGrid의 xlsx 플러그인 추가

dev
박성영 4 months ago
parent 72bc009be7
commit 106095430f

@ -63,6 +63,7 @@
<link rel="stylesheet" type="text/css" href="<c:url value='/plugins/tuiGrid/tui-pagination.css' />">
<link rel="stylesheet" type="text/css" href="<c:url value='/plugins/tuiGrid/tui-time-picker.css' />">
<link rel="stylesheet" type="text/css" href="<c:url value='/plugins/tuiGrid/tui-grid.css' />">
<script type="text/javascript" src="<c:url value='/plugins/tuiGrid/xlsx.full.min.js' />"></script>
<script type="text/javascript" src="<c:url value='/plugins/tuiGrid/tui-pagination.js' />"></script>
<script type="text/javascript" src="<c:url value='/plugins/tuiGrid/tui-date-picker.js' />"></script>
<script type="text/javascript" src="<c:url value='/plugins/tuiGrid/tui-time-picker.js' />"></script>

File diff suppressed because one or more lines are too long

@ -200,8 +200,12 @@
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
z-index: 9999;
min-width: 120px;
max-width: 200px;
padding: 4px 0;
font-family: inherit;
/* 메뉴가 화면 경계를 벗어나지 않도록 추가 설정 */
overflow: visible;
white-space: nowrap;
}
/* 메뉴 아이템 */

@ -660,12 +660,68 @@ var XitTuiGridDropdownMenu = {
// 메뉴가 숨겨져 있으면 표시
var btnOffset = $btn.offset();
var btnHeight = $btn.outerHeight();
var btnWidth = $btn.outerWidth();
// 메뉴 위치 계산 (버튼 아래쪽 우측 정렬로 표시)
// 메뉴를 임시로 표시하여 크기 측정
$menu.css({
//'top': btnOffset.top + btnHeight + 2,
'top': btnOffset.top + btnHeight + 2 - 35,
'left': btnOffset.left - $menu.outerWidth() + $btn.outerWidth()
'visibility': 'hidden',
'display': 'block'
});
var menuHeight = $menu.outerHeight();
var menuWidth = $menu.outerWidth();
// 다시 숨김
$menu.css({
'visibility': 'visible',
'display': 'none'
});
// 화면 크기 정보
var windowHeight = $(window).height();
var windowScrollTop = $(window).scrollTop();
var viewportBottom = windowScrollTop + windowHeight;
// 기본 위치 계산 (버튼 아래쪽) - 35px 위쪽으로 조정하여 정확한 위치에 표시
var defaultTop = btnOffset.top + btnHeight + 2 - 35;
var menuBottom = defaultTop + menuHeight;
var finalTop, finalLeft;
// 세로 위치 결정: 메뉴가 화면 하단을 벗어나는지 확인
if (menuBottom > viewportBottom - 10) { // 10px 여유 공간
// 메뉴를 버튼 위쪽에 표시 - 35px 위쪽으로 조정하여 일관성 유지
finalTop = btnOffset.top - menuHeight - 2 - 35;
// 버튼 위쪽에 표시해도 화면 상단을 벗어나는 경우
if (finalTop < windowScrollTop + 10) {
// 화면 내에서 최적 위치로 조정
finalTop = windowScrollTop + 10;
}
} else {
// 기본 위치 (버튼 아래쪽) 사용
finalTop = defaultTop;
}
// 가로 위치 계산 (버튼 우측 정렬)
finalLeft = btnOffset.left - menuWidth + btnWidth;
// 메뉴가 화면 왼쪽을 벗어나는지 확인
if (finalLeft < 10) {
// 버튼 왼쪽 정렬로 변경
finalLeft = btnOffset.left;
}
// 메뉴가 화면 오른쪽을 벗어나는지 확인
var windowWidth = $(window).width();
if (finalLeft + menuWidth > windowWidth - 10) {
finalLeft = windowWidth - menuWidth - 10;
}
// 최종 위치 적용 및 표시
$menu.css({
'top': finalTop,
'left': finalLeft
}).show();
}
});

Loading…
Cancel
Save