From 2f44b3c17d958924265734d71453698f25ba5c9e Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Mon, 29 Jan 2024 13:22:41 +0900 Subject: [PATCH] =?UTF-8?q?datepicker=20=EB=AA=A8=EB=8B=AC=20=EC=B0=BD=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bootstrap-datepicker-support.js | 29 +++++++- .../webapp/resources/js/base/base-fims.js | 4 +- .../fims/framework/cmm/initAfterPageLoad.js | 67 ++++++++++--------- 3 files changed, 67 insertions(+), 33 deletions(-) diff --git a/src/main/webapp/resources/3rd-party/bootstrap-datepicker/bootstrap-datepicker-support.js b/src/main/webapp/resources/3rd-party/bootstrap-datepicker/bootstrap-datepicker-support.js index 7e236c0c..6af0fcca 100644 --- a/src/main/webapp/resources/3rd-party/bootstrap-datepicker/bootstrap-datepicker-support.js +++ b/src/main/webapp/resources/3rd-party/bootstrap-datepicker/bootstrap-datepicker-support.js @@ -38,6 +38,7 @@ $.fn.datepicker.makeTemplate = function(){ ''; }; +//한국어설정 추가, 기본설정 변경, 오늘버튼,지우기버튼 영역 수정 $.fn.datepicker.addKo = function(){ this.dates['ko'] = { @@ -65,6 +66,7 @@ $.fn.datepicker.addKo = function(){ this.defaults.disableTouchKeyboard = true; this.defaults.enableOnReadonly = false; this.defaults.immediateUpdates = true; + this.defaults.zIndexOffset = 1; this.DPGlobal.footTemplate = ''+ ''+ @@ -74,7 +76,32 @@ $.fn.datepicker.addKo = function(){ ''+ ''+ ''; - this.makeTemplate(); + this.makeTemplate(); + } +//z-index 변경 +$.fn.datepicker.prototype.constructor.Constructor.prototype.originalPlace = +$.fn.datepicker.prototype.constructor.Constructor.prototype.place; +$.fn.datepicker.prototype.constructor.Constructor.prototype.place = function(){ + + var r = this.originalPlace(); + var styleAttr = r.picker.attr('style'); + var ziStart = styleAttr.substring(styleAttr.indexOf("z-index")); + var semicolonIdx = ziStart.indexOf(";"); + if(semicolonIdx != -1){ + ziString = ziStart.substring(0,semicolonIdx); + } else { + ziString = ziStart; + } + + if(ziString.indexOf("!important") == -1){ + var ziValue = ziString.substring(9); + var replaceStr = "z-index: " + ziValue + ' !important'; + r.picker.attr('style', styleAttr.replace(ziString, replaceStr)); + } + + return r; +}; + $.fn.datepicker.addKo(); \ No newline at end of file diff --git a/src/main/webapp/resources/js/base/base-fims.js b/src/main/webapp/resources/js/base/base-fims.js index b33b56ad..63976c59 100644 --- a/src/main/webapp/resources/js/base/base-fims.js +++ b/src/main/webapp/resources/js/base/base-fims.js @@ -10,11 +10,11 @@ function setDialogZindex(){ } var parentZ = $(parentDialog).css("z-index"); - $(childDialog).css("z-index", parentZ+10); + $(childDialog).css("z-index", Number(parentZ)+10); var backdrop = $(childDialog).next(); if(backdrop.hasClass("modal-backdrop")){ - backdrop.css("z-index", parentZ+9); + backdrop.css("z-index", Number(parentZ)+9); }; } diff --git a/src/main/webapp/resources/js/fims/framework/cmm/initAfterPageLoad.js b/src/main/webapp/resources/js/fims/framework/cmm/initAfterPageLoad.js index 9ae8e1e5..975031c3 100644 --- a/src/main/webapp/resources/js/fims/framework/cmm/initAfterPageLoad.js +++ b/src/main/webapp/resources/js/fims/framework/cmm/initAfterPageLoad.js @@ -3,40 +3,47 @@ function initDatepicker(elementId){ var executionArea = $("#"+elementId); /*--------------------- 달력 제어 ---------------------*/ - executionArea.find(".form-date").datepicker() - .attr("maxlength", "10") - .on("input",function(e){ + executionArea.find(".form-date").each(function(){ - if(this.value.length <= 0){ - return; - } - if(this.value.length != this.selectionStart){ - return; - } - - var value = this.value.replaceAll("-",""); - - if(value.length > 7){ - this.value = value.substring(0,4)+"-"+value.substring(4,6)+"-"+value.substring(6); - } else if(value.length > 5){ - this.value = value.substring(0,4)+"-"+value.substring(4); - } + $(this) + .datepicker() + .attr("maxlength", "10") + .on("input",function(e){ + + if(this.value.length <= 0){ + return; + } + if(this.value.length != this.selectionStart){ + return; + } - }) - .on("paste", function(e){ + var value = this.value.replaceAll("-",""); + + if(value.length > 7){ + this.value = value.substring(0,4)+"-"+value.substring(4,6)+"-"+value.substring(6); + } else if(value.length > 5){ + this.value = value.substring(0,4)+"-"+value.substring(4); + } + + }) + .on("paste", function(e){ + + var value = e.originalEvent.clipboardData.getData('text'); + if(value.length == 8){ + this.value = value.substring(0,4)+"-"+value.substring(4,6)+"-"+value.substring(6); + } - var value = e.originalEvent.clipboardData.getData('text'); - if(value.length == 8){ - this.value = value.substring(0,4)+"-"+value.substring(4,6)+"-"+value.substring(6); + }) + ; + + var calendarIcon = $(this).next("button.bx-calendar"); + if(calendarIcon.length > 0){ + $(calendarIcon).on("click", function() { + $(this).prev().focus(); + }); } - - }) - ; - - executionArea.find(".form-date").next("button.bx-calendar").on("click", function() { - $(this).prev().focus(); - }); - + }); + } function initDetailSearchButton(elementId){