단축키 관련 자바스크립트 설정 추가

main
이범준 1 year ago
parent 6feb16da96
commit d499a66a4e

@ -14,8 +14,8 @@
<button type="button" id="btnReset--${pageName}" class="btn btn-primary">초기화</button> <button type="button" id="btnReset--${pageName}" class="btn btn-primary">초기화</button>
<span class="float-end"> <span class="float-end">
<input type="text" id="countStauts--${pageName}" class="form-control w-px-150 text-center fw-bold" readonly /> <input type="text" id="countStauts--${pageName}" class="form-control w-px-150 text-center fw-bold" readonly />
<button type="button" class="w-px-50" id="btnPrev--${pageName}">◀</button> <button type="button" id="btnPrev--${pageName}" class="w-px-50 btn-PageUp">◀</button>
<button type="button" class="w-px-50" id="btnNext--${pageName}">▶</button> <button type="button" id="btnNext--${pageName}" class="w-px-50 btn-PageDown">▶</button>
</span> </span>
</div> </div>
</div> </div>

@ -73,8 +73,8 @@
</div> </div>
<div class="col-md-6" id="pageNavArea--${pageName}"> <div class="col-md-6" id="pageNavArea--${pageName}">
<input type="text" id="countStauts--${pageName}" class="form-control w-px-150 text-center fw-bold" readonly /> <input type="text" id="countStauts--${pageName}" class="form-control w-px-150 text-center fw-bold" readonly />
<button type="button" class="w-px-50" id="btnPrev--${pageName}">◀</button> <button type="button" id="btnPrev--${pageName}" class="w-px-50 btn-PageUp">◀</button>
<button type="button" class="w-px-50" id="btnNext--${pageName}">▶</button> <button type="button" id="btnNext--${pageName}" class="w-px-50 btn-PageDown">▶</button>
</div> </div>
</div> </div>
</form> </form>

@ -16,8 +16,8 @@
</div> </div>
<div class="col-md-6 text-end"> <div class="col-md-6 text-end">
<input type="text" id="countStauts--${pageName}" class="form-control w-px-150 text-center fw-bold" readonly /> <input type="text" id="countStauts--${pageName}" class="form-control w-px-150 text-center fw-bold" readonly />
<button type="button" class="w-px-50" id="btnPrev--${pageName}">◀</button> <button type="button" id="btnPrev--${pageName}" class="w-px-50 btn-PageUp">◀</button>
<button type="button" class="w-px-50" id="btnNext--${pageName}">▶</button> <button type="button" id="btnNext--${pageName}" class="w-px-50 btn-PageDown">▶</button>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="px-2"> <div class="px-2">

@ -53,7 +53,8 @@
<script src="<c:url value="/resources/js/fims/framework/cmm/initAfterPageLoad.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/fims/framework/cmm/initAfterPageLoad.js?${ver}"/>"></script>
<!-- 검색 유틸 --> <!-- 검색 유틸 -->
<script src="<c:url value="/resources/js/fims/framework/cmm/searchUtil.js"/>?${ver}"></script> <script src="<c:url value="/resources/js/fims/framework/cmm/searchUtil.js"/>?${ver}"></script>
<!-- 단축키 설정 -->
<script src="<c:url value="/resources/js/fims/framework/cmm/shortcutKey.js"/>?${ver}"></script>
<!-- endbuild --> <!-- endbuild -->
<c:set var="functions" scope="request"> <c:set var="functions" scope="request">

@ -0,0 +1,79 @@
document.addEventListener('keydown', (event) => {
var RESERVED_FUNCTION_KEYS = ["F1","F2","F3","F4","F6","F7","F8","F9","F10","F11","PageDown","PageUp"];
var KEYS_FOR_GLOBAL = ["F9","F10","F11"];
if(RESERVED_FUNCTION_KEYS.includes(event.key)){
event.preventDefault();
var activeBasckdropYn = isActiveBackdrop();
var curArea = getCurrentAreaForShortcutKey();
if(KEYS_FOR_GLOBAL.includes(event.key)){ //전역 기능
if(!activeBasckdropYn){
//TODO : do somthing
}
} else { //페이지별,다이얼로그별 버튼
if(curArea != null){
var targetButton = $(curArea).find("button.btn-"+event.key);
if(targetButton.length == 1){
targetButton.click();
} else {
if(targetButton.length > 1){
debug('단축키 버튼 중복 : ' + targetButton.length + "개");
}
}
}
}
return false;
}
});
//단축키 기능이 사용될 영역을 반환한다.
function getCurrentAreaForShortcutKey(){
if(isActiveBackdrop()){
return getLastDialog();
} else {
return getActiveRootTabArea();
}
return null;
}
//현재 활성화된 최상위 탭 영역을 반환한다.
function getActiveRootTabArea(){
return $("#innerPageTabContents").children(".active")[0];
}
//마지막으로 열린 다이얼로그 영역을 반환한다.
function getLastDialog(){
return $("div.modal.show").last()[0];
}
//백드롭 영역 활성화 여부를 반환한다.
function isActiveBackdrop(){
if($("div.modal-backdrop").length < 1){
return false;
}
var isActiveYn = false;
$("div.modal-backdrop").each(function(){
if($(this).hasClass("show")){
isActiveYn = true;
};
});
return isActiveYn;
}
Loading…
Cancel
Save