|
|
|
@ -413,13 +413,15 @@ String.prototype.isEmail = function() {
|
|
|
|
|
/**
|
|
|
|
|
* 숫자를 콤마 포멧으로 변환
|
|
|
|
|
**/
|
|
|
|
|
function setComma(n) {
|
|
|
|
|
var reg = /(^[+-]?\d+)(\d{3})/;
|
|
|
|
|
n += '';
|
|
|
|
|
while (reg.test(n))
|
|
|
|
|
n = n.replace(reg, '$1' + ',' + '$2');
|
|
|
|
|
|
|
|
|
|
return n;
|
|
|
|
|
const CommaNumberFormat = {
|
|
|
|
|
format(value){
|
|
|
|
|
var reg = /(^[+-]?\d+)(\d{3})/;
|
|
|
|
|
value += '';
|
|
|
|
|
while (reg.test(value))
|
|
|
|
|
value = value.replace(reg, '$1' + ',' + '$2');
|
|
|
|
|
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -429,59 +431,63 @@ function setComma(n) {
|
|
|
|
|
* @param {string} delimiter
|
|
|
|
|
* @returns {string|*}
|
|
|
|
|
*/
|
|
|
|
|
function setDateTimeFmt(srcDateStr, delimiter = '-') {
|
|
|
|
|
if(srcDateStr == null || srcDateStr.isBlank()) return srcDateStr;
|
|
|
|
|
|
|
|
|
|
let srcDate = srcDateStr.replace(/\-|\s|\:|\.|T|Z/g,'');
|
|
|
|
|
if(srcDate.length == 8) {
|
|
|
|
|
return srcDate.substring(0, 4)+delimiter+srcDate.substring(4, 6)+delimiter+srcDate.substring(6, 8);
|
|
|
|
|
}else if(srcDate.length >= 14){
|
|
|
|
|
return srcDate.substring(0, 4)+delimiter+srcDate.substring(4, 6)+delimiter+srcDate.substring(6, 8)
|
|
|
|
|
+ ' ' + srcDate.substring(8, 10) + ':' + srcDate.substring(10, 12) + ':' + srcDate.substring(12, 14);
|
|
|
|
|
}else{
|
|
|
|
|
return srcDate;
|
|
|
|
|
const StrDateTimeFormat = {
|
|
|
|
|
format(value){
|
|
|
|
|
if(value == null || value.isBlank()) return value;
|
|
|
|
|
|
|
|
|
|
let srcDate = value.replace(/\-|\s|\:|\.|T|Z/g,'');
|
|
|
|
|
if(srcDate.length == 8) {
|
|
|
|
|
return srcDate.substring(0, 4)+"-"+srcDate.substring(4, 6)+"-"+srcDate.substring(6, 8);
|
|
|
|
|
}else if(srcDate.length >= 14){
|
|
|
|
|
return srcDate.substring(0, 4)+"-"+srcDate.substring(4, 6)+"-"+srcDate.substring(6, 8)
|
|
|
|
|
+ ' ' + srcDate.substring(8, 10) + ':' + srcDate.substring(10, 12) + ':' + srcDate.substring(12, 14);
|
|
|
|
|
}else{
|
|
|
|
|
return srcDate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setDateFmt(srcDateStr, delimiter = '-') {
|
|
|
|
|
if(srcDateStr == null || srcDateStr.isBlank()) return srcDateStr;
|
|
|
|
|
const StrDateFormat = {
|
|
|
|
|
format(value){
|
|
|
|
|
if(value == null || value.isBlank()) return value;
|
|
|
|
|
|
|
|
|
|
let srcDate = srcDateStr.replace(/\-|\s|\:|\./g,'');
|
|
|
|
|
if(srcDate.length >= 8) {
|
|
|
|
|
return srcDate.substring(0, 4)+delimiter+srcDate.substring(4, 6)+delimiter+srcDate.substring(6, 8);
|
|
|
|
|
}else{
|
|
|
|
|
return srcDate;
|
|
|
|
|
let srcDate = value.replace(/\-|\s|\:|\./g,'');
|
|
|
|
|
if(srcDate.length >= 8) {
|
|
|
|
|
return srcDate.substring(0, 4)+"-"+srcDate.substring(4, 6)+"-"+srcDate.substring(6, 8);
|
|
|
|
|
}else{
|
|
|
|
|
return srcDate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setTimeFmt(srcDateStr, delimiter = ':') {
|
|
|
|
|
if(srcDateStr == null || srcDateStr.isBlank()) return srcDateStr;
|
|
|
|
|
const StrTimeFormat= {
|
|
|
|
|
format(value){
|
|
|
|
|
if(value == null || value.isBlank()) return value;
|
|
|
|
|
|
|
|
|
|
let srcDate = srcDateStr.replace(/\-|\s|\:|\./g,'');
|
|
|
|
|
if(srcDate.length >= 6) {
|
|
|
|
|
return srcDate.substring(0, 2)+delimiter+srcDate.substring(2, 4)+delimiter+srcDate.substring(4, 6);
|
|
|
|
|
}else{
|
|
|
|
|
return srcDate;
|
|
|
|
|
let srcDate = value.replace(/\-|\s|\:|\./g,'');
|
|
|
|
|
if(srcDate.length >= 6) {
|
|
|
|
|
return srcDate.substring(0, 2)+delimiter+srcDate.substring(2, 4)+delimiter+srcDate.substring(4, 6);
|
|
|
|
|
}else{
|
|
|
|
|
return srcDate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* yyyy-MM-ddTHH24:mi:ss.xxxxxxZ
|
|
|
|
|
* @param {string} srcDateStr
|
|
|
|
|
* @param {string} delimiter
|
|
|
|
|
* @returns {string|*}
|
|
|
|
|
*/
|
|
|
|
|
function setDateTimeFmt2(srcDateStr, delimiter = '-') {
|
|
|
|
|
if(srcDateStr == null || srcDateStr.isBlank()) return srcDateStr;
|
|
|
|
|
|
|
|
|
|
let srcDate = srcDateStr.replace(/\-|\s|\:|\.|T|Z/g,'');
|
|
|
|
|
if(srcDate.length == 8) {
|
|
|
|
|
return srcDate.substring(0, 4)+delimiter+srcDate.substring(4, 6)+delimiter+srcDate.substring(6, 8);
|
|
|
|
|
}else if(srcDate.length >= 14){
|
|
|
|
|
return srcDate.substring(0, 4)+delimiter+srcDate.substring(4, 6)+delimiter+srcDate.substring(6, 8)
|
|
|
|
|
+ ' ' + srcDate.substring(8, 10) + ':' + srcDate.substring(10, 12) + ':' + srcDate.substring(12, 14);
|
|
|
|
|
}else{
|
|
|
|
|
return srcDate;
|
|
|
|
|
class CodeFormat {
|
|
|
|
|
_codeList;
|
|
|
|
|
constructor(codeList) {
|
|
|
|
|
this._codeList = codeList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
format(value) {
|
|
|
|
|
let txt = "";
|
|
|
|
|
for (let i=0; i<this._codeList.length; i++){
|
|
|
|
|
if(value == this._codeList[i].value){
|
|
|
|
|
txt = this._codeList[i].text;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return txt;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -529,16 +535,16 @@ class FimsFormFields extends FormFields {
|
|
|
|
|
const fmtType = input.dataset.fmtType;
|
|
|
|
|
switch (fmtType) {
|
|
|
|
|
case 'dt' :
|
|
|
|
|
value = setDateTimeFmt(value);
|
|
|
|
|
value = StrDateTimeFormat.format(value);
|
|
|
|
|
break;
|
|
|
|
|
case 'day' :
|
|
|
|
|
value = setDateFmt(value);
|
|
|
|
|
value = StrDateFormat.format(value);
|
|
|
|
|
break;
|
|
|
|
|
case 'time' :
|
|
|
|
|
value = setTimeFmt(value);
|
|
|
|
|
value = StrTimeFormat.format(value);
|
|
|
|
|
break;
|
|
|
|
|
case 'number' :
|
|
|
|
|
value = setComma(value);
|
|
|
|
|
value = CommaNumberFormat.format(value);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|