소스 정리

main
이범준 3 months ago
parent 55502feb47
commit dad5dc07fe

@ -240,9 +240,9 @@ function fnMakeStatReq(taskSeCd){
lastDay : lastDay
};
defaultQuery = fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
statReqArr.push({
query : defaultQuery,
@ -270,9 +270,9 @@ function fnMakeStatReq(taskSeCd){
lastDay : lastDay
};
defaultQuery = fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
statReqArr.push({
query : defaultQuery,
@ -308,9 +308,9 @@ function fnMakeStatReq(taskSeCd){
lastDay : lastDay
};
defaultQuery = fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
statReqArr.push({
query : defaultQuery,
@ -346,9 +346,9 @@ function fnMakeStatReq(taskSeCd){
lastDay : lastDay
};
defaultQuery = fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
statReqArr.push({
query : defaultQuery,
@ -389,9 +389,9 @@ function fnMakeStatReq(taskSeCd){
dayRange : 15
};
defaultQuery = fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
statReqArr.push({
query : defaultQuery,
@ -430,9 +430,9 @@ function fnMakeStatReq(taskSeCd){
lastDay : firstDay
};
defaultQuery = fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
statReqArr.push({
query : defaultQuery,
@ -471,9 +471,9 @@ function fnMakeStatReq(taskSeCd){
lastDay : firstDay
};
defaultQuery = fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
statReqArr.push({
query : defaultQuery,
@ -504,9 +504,9 @@ function fnMakeStatReq(taskSeCd){
lastDay : firstDay
};
defaultQuery = fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "groupInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "numberValueInfoList");
defaultQuery = FimsSupport.fnJsonToFormData(defaultQuery, "codeSubsetInfoList");
statReqArr.push({
query : defaultQuery,

@ -593,7 +593,7 @@ $(document).ready(function(){
},
success : (resp) => {
var crdnInfo = resp.crdnInfo;
crdnInfo.CVLCPT_APLY_CN = escapeHTMLEntity(crdnInfo.CVLCPT_APLY_CN);
crdnInfo.CVLCPT_APLY_CN = StringSupport.escapeHTMLEntity(crdnInfo.CVLCPT_APLY_CN);
$P.ctrl.dataset.setData([crdnInfo]);
$P.$find("btnViewCrdnList").attr("hidden","hidden");
@ -1210,7 +1210,7 @@ $(document).ready(function(){
$P.$find("btnViewCvlcptDscsnList").attr("hidden","hidden");
var crdnInfo = ${crdnInfo};
crdnInfo.CVLCPT_APLY_CN = escapeHTMLEntity(crdnInfo.CVLCPT_APLY_CN);
crdnInfo.CVLCPT_APLY_CN = StringSupport.escapeHTMLEntity(crdnInfo.CVLCPT_APLY_CN);
$P.ctrl.dataset.setData([crdnInfo]);
if($P.$find("taskSeCd").val() == "DPV" && $P.$find("vltnCd").val() == "01"){

@ -164,7 +164,7 @@ $(document).ready(function() {
},
success : (resp) => {
var cvlcptInfo = resp.cvlcptInfo;
cvlcptInfo.CVLCPT_APLY_CN = escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
cvlcptInfo.CVLCPT_APLY_CN = StringSupport.escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
$P.ctrl.dataset.setData([cvlcptInfo]);
var cs = $P.provided.getCountStatus($P.$find("crdnId").val());
@ -192,7 +192,7 @@ $(document).ready(function() {
* 초기화
**************************************************************************/
var cvlcptInfo = ${cvlcptInfo};
cvlcptInfo.CVLCPT_APLY_CN = escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
cvlcptInfo.CVLCPT_APLY_CN = StringSupport.escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
$P.ctrl.dataset.setData([cvlcptInfo]);
var cs = $P.provided.getCountStatus($P.$find("crdnId").val());
$P.$find("countStauts").val(cs);

@ -134,7 +134,7 @@ $(document).ready(function() {
},
success : (resp) => {
var cvlcptInfo = resp.cvlcptInfo;
cvlcptInfo.CVLCPT_APLY_CN = escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
cvlcptInfo.CVLCPT_APLY_CN = StringSupport.escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
$P.ctrl.dataset.setData([cvlcptInfo]);
var cs = $P.parentRes.getCountStatus($P.$find("crdnId").val());
@ -190,7 +190,7 @@ $(document).ready(function() {
* 초기화
**************************************************************************/
var cvlcptInfo = ${cvlcptInfo};
cvlcptInfo.CVLCPT_APLY_CN = escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
cvlcptInfo.CVLCPT_APLY_CN = StringSupport.escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
$P.ctrl.dataset.setData([cvlcptInfo]);
var cs = $P.parentRes.getCountStatus($P.$find("crdnId").val());
$P.$find("countStauts").val(cs);

@ -505,7 +505,7 @@ $(document).ready(function(){
var rowArr = $P.getRowData(taskSeCd+"tbody", formData);
var vltnStngList = fnJsonArrayToFormData(rowArr,"vltnStngList");
var vltnStngList = FimsSupport.fnJsonArrayToFormData(rowArr,"vltnStngList");
var keys = Object.keys(vltnStngList);
for(var i=0; i < keys.length; i++){
formData.append(keys[i], vltnStngList[keys[i]]);

@ -23,7 +23,7 @@ function fnGoToEditSgg(selected){
let menuUrl = wctx.url("/ogdp/sggStngMain.do");
let curTabId = getActiveRootTabArea().id;
let curTabId = FimsSupport.getActiveRootTabArea().id;
ajax.get({
url: menuUrl,

@ -499,9 +499,9 @@ $(document).ready(function(){
$P.statQuery = JSON.parse(JSON.stringify(statQuery));
statQuery = fnJsonToFormData(statQuery, "groupInfoList");
statQuery = fnJsonToFormData(statQuery, "numberValueInfoList");
statQuery = fnJsonToFormData(statQuery, "codeSubsetInfoList");
statQuery = FimsSupport.fnJsonToFormData(statQuery, "groupInfoList");
statQuery = FimsSupport.fnJsonToFormData(statQuery, "numberValueInfoList");
statQuery = FimsSupport.fnJsonToFormData(statQuery, "codeSubsetInfoList");
ajax.get({
url : wctx.url("/stat/stat01/010/info.do"),

@ -710,7 +710,7 @@ $(document).ready(function(){
}
}
var otptArtclStngList = fnJsonArrayToFormData(rowArr,"otptArtclStngList");
var otptArtclStngList = FimsSupport.fnJsonArrayToFormData(rowArr,"otptArtclStngList");
var keys = Object.keys(otptArtclStngList);
for(var i=0; i < keys.length; i++){
formData.append(keys[i], otptArtclStngList[keys[i]]);

@ -446,7 +446,7 @@ $(document).ready(function(){
}
}
var extrArtclStngList = fnJsonArrayToFormData(rowArr,"extrArtclStngList");
var extrArtclStngList = FimsSupport.fnJsonArrayToFormData(rowArr,"extrArtclStngList");
var keys = Object.keys(extrArtclStngList);
for(var i=0; i < keys.length; i++){
formData.append(keys[i], extrArtclStngList[keys[i]]);

@ -346,7 +346,7 @@ $(document).ready(function(){
}
}
var zipArtclStngList = fnJsonArrayToFormData(rowArr,"zipArtclStngList");
var zipArtclStngList = FimsSupport.fnJsonArrayToFormData(rowArr,"zipArtclStngList");
var keys = Object.keys(zipArtclStngList);
for(var i=0; i < keys.length; i++){
formData.append(keys[i], zipArtclStngList[keys[i]]);

@ -40,27 +40,24 @@
<!-- 공통 유틸 -->
<script src="<c:url value="/webjars/applib/js/cmmnUtil.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/fims-cmmnUtil.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/fims-support.js?${ver}"/>"></script>
<!-- 날짜 관련 유틸 -->
<script src="<c:url value="/webjars/applib/js/cmmnDateUtil.js?${ver}"/>"></script>
<!-- 초기화 유틸 -->
<script src="<c:url value="/webjars/applib/js/initAfterPageLoad.js?${ver}"/>"></script>
<!-- 단축키 설정 -->
<script src="<c:url value="/resources/js/fims/cmmn/shortcutKey.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/customElements.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/fims-cmmnUtil.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/string-support.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/fims-support.js?${ver}"/>"></script>
<!-- 커스텀UI -->
<script src="<c:url value="/webjars/applib/js/componentization.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/fims-componentization.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/customElements.js?${ver}"/>"></script>
<!-- 사전정의요소 클립보드 저장 -->
<script src="<c:url value="/webjars/js/support/toolPalette.js?${ver}"/>"></script>
<!-- 이벤트 자동 탐지 -->
<script src="<c:url value="/resources/js/fims/cmmn/detect.js?${ver}"/>"></script>

@ -542,7 +542,7 @@ FimsSupport.mappingButtonAndMenu("btnGoToSchdl","일정관리");
/*--------------------- 사용자 메뉴얼 클릭 이벤트 ---------------------*/
$("#btnDownloadMenual--top").on( "click", function() {
fnMenualDownload();
FimsSupport.fnMenualDownload();
});
/*--------------------- 보안모드 체크박스 클릭 이벤트 ---------------------*/

@ -68,6 +68,8 @@
</c:set>
<script>
//단축키 등록
FimsSupport.registShortcutKey();
let sticky = {id: -1, index: "dashboard", name: "대시보드", url: "/dashboard.do", parentID: null, description: "대시보드"};
let mainTabs = new TabControl({

@ -45,7 +45,7 @@
<img src="<c:url value='/'/>resources/img/login/mainLogo_02.png" alt="Logo Image" />
<span id="userFor" hidden>(임대기업사용자)</span>
<span class="float-end mt-4 me-5">
<button id="btnDownMenual" type="button" onclick="fnMenualDownload();" class="btn btn-primary" hidden>사용자 메뉴얼</button>
<button id="btnDownMenual" type="button" onclick="FimsSupport.fnMenualDownload();" class="btn btn-primary" hidden>사용자 메뉴얼</button>
</span>
</h1>
</div>

@ -281,157 +281,14 @@ const Apply = {
};
//메뉴얼 다운로드
function fnMenualDownload(){
var filenameInHeader = "";
fetch(wctx.url("/file/downloadMenual.do"))
.then((response) => {
var header = response.headers.get('Content-Disposition');
console.log(header);
var parts = header.split(';');
filenameInHeader = parts[1].split('=')[1];
if(filenameInHeader.startsWith("\"") && filenameInHeader.endsWith("\"")){
filenameInHeader = filenameInHeader.substring(1,filenameInHeader.length-1);
}
filenameInHeader = decodeURIComponent(filenameInHeader);
return response.blob();
})
.then((blob) => {
var URL = window.URL || window.webkitURL;
var downloadUrl = URL.createObjectURL(blob);
var a = document.createElement("a");
a.href = downloadUrl;
a.download = filenameInHeader;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
});
}
//현재 활성화된 최상위 탭 영역을 반환한다.
function getActiveRootTabArea(){
return $("#main-tab-content").children(".active")[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;
}
/**
* HTML 엔티티 문자코드를 특수문자로 치환한다.
* @return 치환된 문자열
*/
function escapeHTMLEntity(str) {
if(str == undefined || str == null){
return ""
}
var regex = /&(amp|lt|gt|quot|#39);/g;
var chars = {
'&amp;': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&#39;': "'"
};
if(regex.test(str)) {
return str.replace(regex, (matched) => chars[matched] || matched);
} else {
return str;
}
}
/**
* 스네이크 표기법을 카멜 표기법으로 변경한다.
* @return 치환된 문자열
*/
function snakeToCamel(text){
text = text.toLowerCase();
var arrUnderbar = text.match(/\_[a-zA-Z]/g);
if(arrUnderbar){
for(var j = 0; j < arrUnderbar.length; j++) {
text = text.replace(arrUnderbar[j], arrUnderbar[j].toUpperCase().replace("_", ""));
}
}
return text;
}
/**
* 카멜 표기법을 케밥 표기법으로 변경한다.
* @return 치환된 문자열
*/
function camelToKebab(text){
return text.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
}
/**
* jsonArray를 FormData형식의 키를 갖는 json으로 치환한다.
* @return FormData형식의 키를 갖는 json
*/
function fnJsonArrayToFormData(array, arrayName){
var newObj = {};
for(var i=0; i<array.length; i++){
var json = array[i];
var keys = Object.keys(json);
for(var j=0; j<keys.length; j++){
var key = keys[j];
newObj[arrayName+"["+i+"]."+key] = json[key];
}
}
return newObj;
}
/**
* json객체 안의 jsonArray를 FormData형식의 키로 치환한다.
* @return FormData형식의 키를 갖는 json
*/
function fnJsonToFormData(originalJson, arrayName){
if(originalJson[arrayName] == undefined){
return originalJson;
} else {
var newObj = {};
var array = originalJson[arrayName];
for(var i=0; i<array.length; i++){
var json = array[i];
var keys = Object.keys(json);
for(var j=0; j<keys.length; j++){
var key = keys[j];
newObj[arrayName+"["+i+"]."+key] = json[key];
}
}
delete originalJson[arrayName];
return {...originalJson, ...newObj};
}
}
const GRID = {
checkbox : {

@ -2,6 +2,7 @@ class FimsSupport {
static help(){
console.log("메소드 목록");
console.log("fnMenualDownload() : 메뉴얼 다운로드");
console.log("mappingButtonAndMenu(버튼id, 메뉴이름) : 버튼과 메뉴를 매핑한다.");
console.log("fnDownsizeToggle(th객체) : 테이블 컬럼 축소 여부 변경");
console.log("fnDownsizeCheck(html테이블객체) : 테이블 렌더링 후 축소 처리할 컬럼 확인");
@ -11,6 +12,45 @@ class FimsSupport {
console.log("getVhclDisabledParkingInfo(차량번호) : 장애인 차량여부 조회");
console.log("searchFromGridTitle(키워드영문명, 키워드한글명, 메인옵션, 추가옵션) : 그리드의 특정 열 값을 키워드로 자료 조회");
console.log("renderForTask(렌더링영역객체, 업무class속성명) : 업무구분별 화면 렌더링");
console.log("registShortcutKey() : 단축키 등록");
console.log("getActiveRootTabArea() : 현재 활성화된 최상위 탭 영역을 반환한다.");
console.log("fnJsonToFormData(json,배열이름) : son객체 안의 jsonArray를 FormData형식의 키로 치환한다.");
console.log("fnJsonArrayToFormData(json배열,배열이름) : jsonArray를 FormData형식의 키를 갖는 json으로 치환한다.");
}
/**************************************************************************
* 메뉴얼 다운로드
**************************************************************************/
static fnMenualDownload(){
var filenameInHeader = "";
fetch(wctx.url("/file/downloadMenual.do"))
.then((response) => {
var header = response.headers.get('Content-Disposition');
console.log(header);
var parts = header.split(';');
filenameInHeader = parts[1].split('=')[1];
if(filenameInHeader.startsWith("\"") && filenameInHeader.endsWith("\"")){
filenameInHeader = filenameInHeader.substring(1,filenameInHeader.length-1);
}
filenameInHeader = decodeURIComponent(filenameInHeader);
return response.blob();
})
.then((blob) => {
var URL = window.URL || window.webkitURL;
var downloadUrl = URL.createObjectURL(blob);
var a = document.createElement("a");
a.href = downloadUrl;
a.download = filenameInHeader;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
});
}
/**************************************************************************
@ -169,7 +209,7 @@ class FimsSupport {
var mainOptionElementId = trDataset.mainOption;
var subOptionElementId = trDataset.subOption;
document.getElementById(byElementId).value = snakeToCamel(byValue);
document.getElementById(byElementId).value = StringSupport.snakeToCamel(byValue);
document.getElementById(byOutputElementId).value = byOutputValue;
document.getElementById(mainOptionElementId).value = mainOption;
@ -181,7 +221,7 @@ class FimsSupport {
let mainOptionEl = $($(tr).attr("data-search-target")).find("[name='mainOption']")[0];
let subOptionEl = $($(tr).attr("data-search-target")).find("[name='subOption']")[0];
byEl.value = snakeToCamel(byValue);
byEl.value = StringSupport.snakeToCamel(byValue);
byOutputEl.value = byOutputValue;
mainOptionEl.value = mainOption;
subOptionEl.value = subOption;
@ -246,6 +286,158 @@ class FimsSupport {
}
});
}
/**************************************************************************
* 단축키 등록
**************************************************************************/
static registShortcutKey(){
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 = FimsSupport.isActiveBackdrop();
var curArea = FimsSupport.getCurrentAreaForShortcutKey();
if(KEYS_FOR_GLOBAL.includes(event.key)){ //전역 기능
if(event.key == "F9"){
if($("#securityMode--top").is(":checked")){
$("#securityMode--top").prop("checked", false);
fn_securityModeToggle(false);
} else {
$("#securityMode--top").prop("checked", true);
fn_securityModeToggle(true);
}
}
if(event.key == "F10"){
if($("#photoMask--top").is(":checked")){
$("#photoMask--top").prop("checked", false);
fn_photoMask(false);
} else {
$("#photoMask--top").prop("checked", true);
fn_photoMask(true);
}
}
if(!activeBasckdropYn){
//TODO : do something
}
} 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;
}
});
}
//단축키 기능이 사용될 영역을 반환한다.
static getCurrentAreaForShortcutKey(){
if(FimsSupport.isActiveBackdrop()){
return FimsSupport.getLastOpenDialog();
} else {
return FimsSupport.getActiveRootTabArea();
}
return null;
}
//현재 활성화된 최상위 탭 영역을 반환한다.
static getActiveRootTabArea(){
return $("#main-tab-content").children(".active")[0];
}
//백드롭 영역 활성화 여부를 반환한다.
static 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;
}
/**
* json객체 안의 jsonArray를 FormData형식의 키로 치환한다.
* @return FormData형식의 키를 갖는 json
*/
static fnJsonToFormData(originalJson, arrayName){
if(originalJson[arrayName] == undefined){
return originalJson;
} else {
var newObj = {};
var array = originalJson[arrayName];
for(var i=0; i<array.length; i++){
var json = array[i];
var keys = Object.keys(json);
for(var j=0; j<keys.length; j++){
var key = keys[j];
newObj[arrayName+"["+i+"]."+key] = json[key];
}
}
delete originalJson[arrayName];
return {...originalJson, ...newObj};
}
}
/**
* jsonArray를 FormData형식의 키를 갖는 json으로 치환한다.
* @return FormData형식의 키를 갖는 json
*/
static fnJsonArrayToFormData(array, arrayName){
var newObj = {};
for(var i=0; i<array.length; i++){
var json = array[i];
var keys = Object.keys(json);
for(var j=0; j<keys.length; j++){
var key = keys[j];
newObj[arrayName+"["+i+"]."+key] = json[key];
}
}
return newObj;
}
}
const BOOTSTRAP_COLS = [

@ -1,75 +0,0 @@
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(event.key == "F9"){
if($("#securityMode--top").is(":checked")){
$("#securityMode--top").prop("checked", false);
fn_securityModeToggle(false);
} else {
$("#securityMode--top").prop("checked", true);
fn_securityModeToggle(true);
}
}
if(event.key == "F10"){
if($("#photoMask--top").is(":checked")){
$("#photoMask--top").prop("checked", false);
fn_photoMask(false);
} else {
$("#photoMask--top").prop("checked", true);
fn_photoMask(true);
}
}
if(!activeBasckdropYn){
//TODO : do something
}
} 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 getLastOpenDialog();
} else {
return getActiveRootTabArea();
}
return null;
}

@ -0,0 +1,59 @@
class StringSupport {
static help(){
console.log("snakeToCamel(문자열) : 스네이크 표기법을 카멜 표기법으로 변경한다.");
console.log("camelToKebab(문자열) : 카멜 표기법을 케밥 표기법으로 변경한다.");
console.log("escapeHTMLEntity(문자열) : HTML 엔티티 문자코드를 특수문자로 치환한다.");
}
/**
* 스네이크 표기법을 카멜 표기법으로 변경한다.
* @return 치환된 문자열
*/
static snakeToCamel(text){
text = text.toLowerCase();
var arrUnderbar = text.match(/\_[a-zA-Z]/g);
if(arrUnderbar){
for(var j = 0; j < arrUnderbar.length; j++) {
text = text.replace(arrUnderbar[j], arrUnderbar[j].toUpperCase().replace("_", ""));
}
}
return text;
}
/**
* 카멜 표기법을 케밥 표기법으로 변경한다.
* @return 치환된 문자열
*/
static camelToKebab(text){
return text.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
}
/**
* HTML 엔티티 문자코드를 특수문자로 치환한다.
* @return 치환된 문자열
*/
static escapeHTMLEntity(str) {
if(str == undefined || str == null){
return ""
}
var regex = /&(amp|lt|gt|quot|#39);/g;
var chars = {
'&amp;': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&#39;': "'"
};
if(regex.test(str)) {
return str.replace(regex, (matched) => chars[matched] || matched);
} else {
return str;
}
}
}
Loading…
Cancel
Save