@daeryun/dr_components 0.0.12 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -28
- package/custom.d.ts +7 -0
- package/dist/asset/images/cat.png +0 -0
- package/dist/asset/images/categoryView/section9_arrow_01.webp +0 -0
- package/dist/asset/images/categoryView/section9_arrow_02.webp +0 -0
- package/dist/asset/images/categoryView/section9_arrow_03.webp +0 -0
- package/dist/asset/images/categoryView/section9_arrow_04.webp +0 -0
- package/dist/asset/images/categoryView/section9_arrow_05.webp +0 -0
- package/dist/asset/images/categoryView/section9_icon.webp +0 -0
- package/dist/asset/images/fix/arrow.webp +0 -0
- package/dist/asset/images/fix/call.webp +0 -0
- package/dist/asset/images/fix/call2.webp +0 -0
- package/dist/asset/images/fix/kakao.webp +0 -0
- package/dist/asset/images/fix/menu_x.webp +0 -0
- package/dist/asset/images/fix/online.webp +0 -0
- package/dist/asset/images/footer/footer_daeryun.webp +0 -0
- package/dist/asset/images/footer/ft_icon_arr_2.webp +0 -0
- package/dist/asset/images/footer/icon_arrow_gray.webp +0 -0
- package/dist/asset/images/footer/sns_01.webp +0 -0
- package/dist/asset/images/footer/sns_02.webp +0 -0
- package/dist/asset/images/footer/sns_03.webp +0 -0
- package/dist/asset/images/footer/sns_04.webp +0 -0
- package/dist/asset/images/footer/sns_05.webp +0 -0
- package/dist/asset/images/header/h_icon_g.webp +0 -0
- package/dist/asset/images/header/header_call.webp +0 -0
- package/dist/asset/images/header/language.webp +0 -0
- package/dist/asset/images/header/logo_s.webp +0 -0
- package/dist/asset/images/header/main_img_01.webp +0 -0
- package/dist/asset/images/header/main_img_02.webp +0 -0
- package/dist/asset/images/header/main_img_03.webp +0 -0
- package/dist/asset/images/header/menu.webp +0 -0
- package/dist/asset/images/header/menu_call.webp +0 -0
- package/dist/asset/images/header/menu_sns.webp +0 -0
- package/dist/asset/images/header/menu_sns_01.webp +0 -0
- package/dist/asset/images/header/menu_sns_02.webp +0 -0
- package/dist/asset/images/header/menu_sns_03.webp +0 -0
- package/dist/asset/images/header/menu_sns_04.webp +0 -0
- package/dist/asset/images/header/menu_sns_05.webp +0 -0
- package/dist/asset/images/header/menu_x.webp +0 -0
- package/dist/asset/images/header/online.png +0 -0
- package/dist/asset/images/header/phone.png +0 -0
- package/dist/asset/images/header/talk.png +0 -0
- package/dist/asset/images/header/top_icon_01.webp +0 -0
- package/dist/asset/images/header/top_icon_02.webp +0 -0
- package/dist/asset/images/header/top_icon_03.webp +0 -0
- package/dist/asset/images/header/top_icon_04.webp +0 -0
- package/dist/asset/images/logo.webp +0 -0
- package/dist/cjs/cn/common.json +156 -0
- package/dist/cjs/en/common.json +156 -0
- package/dist/cjs/index.js +14 -0
- package/dist/cjs/jp/common.json +156 -0
- package/dist/cjs/ko/common.json +156 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -0
- package/dist/components/Cat/index.d.ts +3 -0
- package/dist/components/Cat/index.jsx +9 -0
- package/dist/components/Cat/index.tsx +20 -0
- package/dist/components/Fix/Fix.stories.d.ts +13 -0
- package/dist/components/Fix/Fix.stories.jsx +12 -0
- package/dist/components/Fix/Fix.stories.tsx +20 -0
- package/dist/components/Fix/index.d.ts +5 -0
- package/dist/components/Fix/index.jsx +254 -0
- package/dist/components/Fix/index.module.css +316 -0
- package/dist/components/Fix/index.tsx +383 -0
- package/dist/components/Footer/Footer.stories.d.ts +17 -0
- package/dist/components/Footer/Footer.stories.jsx +14 -0
- package/dist/components/Footer/Footer.stories.tsx +20 -0
- package/dist/components/Footer/index.d.ts +10 -0
- package/dist/components/Footer/index.jsx +170 -0
- package/dist/components/Footer/index.tsx +313 -0
- package/dist/components/FooterKeywd/index.d.ts +3 -0
- package/dist/components/FooterKeywd/index.jsx +88 -0
- package/dist/components/FooterKeywd/index.module.css +123 -0
- package/dist/components/FooterKeywd/index.tsx +92 -0
- package/dist/components/Layout/Wrapper.d.ts +10 -0
- package/dist/components/Layout/Wrapper.jsx +42 -0
- package/dist/components/Layout/Wrapper.tsx +54 -0
- package/dist/components/SearchBar/SearchBar.d.ts +14 -0
- package/dist/components/SearchBar/SearchBar.jsx +73 -0
- package/dist/components/SearchBar/SearchBar.tsx +139 -0
- package/dist/components/Top/Fix.d.ts +0 -0
- package/dist/components/Top/Fix.jsx +306 -0
- package/dist/components/Top/Fix.module.css +54 -0
- package/dist/components/Top/Fix.tsx +305 -0
- package/dist/components/Top/Gnb.d.ts +0 -0
- package/dist/components/Top/Gnb.jsx +212 -0
- package/dist/components/Top/Gnb.tsx +211 -0
- package/dist/components/Top/Hamburger.d.ts +0 -0
- package/dist/components/Top/Hamburger.jsx +743 -0
- package/dist/components/Top/Hamburger.tsx +742 -0
- package/dist/components/Top/index.d.ts +0 -0
- package/dist/components/Top/index.jsx +62 -0
- package/dist/components/Top/index.tsx +61 -0
- package/dist/components/common/hook/useBrowser.d.ts +5 -0
- package/dist/components/common/hook/useBrowser.js +45 -0
- package/dist/components/common/hook/useBrowser.ts +52 -0
- package/dist/components/common/index.d.ts +37 -0
- package/dist/components/common/index.js +2041 -0
- package/dist/components/common/index.ts +2061 -0
- package/dist/components/common/types/index.d.ts +20 -0
- package/dist/components/common/types/index.js +1 -0
- package/dist/components/common/types/index.ts +22 -0
- package/dist/components/index.js +6 -0
- package/dist/components/index.ts +6 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.ts +2 -0
- package/dist/lib/catagoryMenuName.d.ts +8 -0
- package/dist/lib/catagoryMenuName.js +8 -0
- package/dist/lib/catagoryMenuName.ts +12 -0
- package/dist/lib/conversion.d.ts +1 -0
- package/dist/lib/conversion.js +6 -0
- package/dist/lib/conversion.ts +6 -0
- package/dist/lib/gtag.d.ts +8 -0
- package/dist/lib/gtag.js +16 -0
- package/dist/lib/index.js +5 -0
- package/dist/lib/index.ts +5 -0
- package/dist/lib/pagination/locale/en_US.js +23 -0
- package/dist/lib/pagination/locale/ko_KR.js +23 -0
- package/dist/lib/powerlink.d.ts +2 -0
- package/dist/lib/powerlink.js +128 -0
- package/dist/lib/powerlink.ts +147 -0
- package/dist/lib/utils.d.ts +35 -0
- package/dist/lib/utils.js +267 -0
- package/dist/lib/utils.ts +301 -0
- package/dist/styles/globals.css +2781 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +54 -23
- package/.eslintrc.json +0 -3
- package/.idea/modules.xml +0 -8
- package/.idea/npm_test.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/babel.config.json +0 -31
- package/dist/components/Button/Button.d.ts +0 -11
- package/dist/components/Button/Button.jsx +0 -19
- package/next.config.js +0 -22
- package/pages/_app.tsx +0 -5
- package/pages/_document.tsx +0 -13
- package/pages/api/hello.ts +0 -13
- package/pages/index.tsx +0 -9
- package/postcss.config.js +0 -6
- package/src/lib/components/Button/Button.d.ts +0 -11
- package/src/lib/components/Button/Button.js +0 -17
- package/src/lib/components/Button/Button.tsx +0 -30
- package/src/lib/index.ts +0 -1
- package/styles/globals.css +0 -27
- package/tailwind.config.js +0 -37
- package/tsconfig.json +0 -35
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* <pre>
|
|
4
|
+
* utils.ts
|
|
5
|
+
* 수정일 수정자 수정내용
|
|
6
|
+
* -------------------------------------------------
|
|
7
|
+
* 2022-08-16 최초생성
|
|
8
|
+
* </pre>
|
|
9
|
+
* @author sbpark
|
|
10
|
+
* @since 2022-08-16
|
|
11
|
+
* @version 1.0
|
|
12
|
+
*
|
|
13
|
+
* Copyright (C) by DeaRyunLaw All right Preserved.
|
|
14
|
+
*/
|
|
15
|
+
export function htmlTagRemove(str) {
|
|
16
|
+
if (str === "")
|
|
17
|
+
return "";
|
|
18
|
+
const removeMd = require('remove-markdown');
|
|
19
|
+
str = removeMd(str);
|
|
20
|
+
return str
|
|
21
|
+
.replace(/<br\/>/gi, "\n")
|
|
22
|
+
.replace(/<(\/)?([a-zA-Z]*)(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/gi, "")
|
|
23
|
+
.replace(/&/g, "&")
|
|
24
|
+
.replace(/</g, "<")
|
|
25
|
+
.replace(/>/g, ">")
|
|
26
|
+
.replace(/"/g, '"')
|
|
27
|
+
.replace(/'/g, "'")
|
|
28
|
+
.replace(/'/g, "'")
|
|
29
|
+
.replace(/ /g, " ");
|
|
30
|
+
}
|
|
31
|
+
export function htmlUrlDecode(str) {
|
|
32
|
+
if (str === "")
|
|
33
|
+
return "";
|
|
34
|
+
return str
|
|
35
|
+
.replace(/&/g, "&")
|
|
36
|
+
.replace(/</g, "<")
|
|
37
|
+
.replace(/>/g, ">")
|
|
38
|
+
.replace(/"/g, '"')
|
|
39
|
+
.replace(/'/g, "'")
|
|
40
|
+
.replace(/'/g, "'")
|
|
41
|
+
.replace(/ /g, " ");
|
|
42
|
+
}
|
|
43
|
+
export function htmlUrlEncode(str) {
|
|
44
|
+
if (str === "")
|
|
45
|
+
return "";
|
|
46
|
+
return str
|
|
47
|
+
.replace(new RegExp("&", 'g'), "&")
|
|
48
|
+
.replace(new RegExp("<", 'g'), "<")
|
|
49
|
+
.replace(new RegExp(">", 'g'), ">")
|
|
50
|
+
.replace(new RegExp('"', 'g'), """)
|
|
51
|
+
.replace(new RegExp("'", 'g'), "'")
|
|
52
|
+
.replace(new RegExp("'", 'g'), "'")
|
|
53
|
+
.replace(new RegExp("\r\n", 'g'), " ")
|
|
54
|
+
.replace(new RegExp("\n", 'g'), " ");
|
|
55
|
+
}
|
|
56
|
+
export function numComma(x) {
|
|
57
|
+
if (x === undefined || x === null) {
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
return ("" + x).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
61
|
+
}
|
|
62
|
+
export function bodyFetch(url, sendData, processFn, method = "POST") {
|
|
63
|
+
let myHeaders = new Headers();
|
|
64
|
+
myHeaders.append("Content-Type", "application/json");
|
|
65
|
+
let parsedJson;
|
|
66
|
+
try {
|
|
67
|
+
parsedJson = JSON.stringify(sendData);
|
|
68
|
+
}
|
|
69
|
+
catch (exception) {
|
|
70
|
+
console.error(exception);
|
|
71
|
+
parsedJson = null;
|
|
72
|
+
}
|
|
73
|
+
let requestOptions = {
|
|
74
|
+
method: method,
|
|
75
|
+
headers: myHeaders,
|
|
76
|
+
body: parsedJson,
|
|
77
|
+
};
|
|
78
|
+
fetch(url, requestOptions)
|
|
79
|
+
.then((response) => response.json())
|
|
80
|
+
.then(processFn)
|
|
81
|
+
.catch((error) => {
|
|
82
|
+
console.error(error);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export function paramFetch(url, sendData, processFn, method = "POST") {
|
|
86
|
+
let myHeaders = new Headers();
|
|
87
|
+
let sendParam = "";
|
|
88
|
+
for (const key in sendData) {
|
|
89
|
+
if (sendParam !== "")
|
|
90
|
+
sendParam += "&";
|
|
91
|
+
sendParam += key + "=" + sendData[key];
|
|
92
|
+
}
|
|
93
|
+
let requestOptions = {
|
|
94
|
+
method: method,
|
|
95
|
+
headers: myHeaders,
|
|
96
|
+
};
|
|
97
|
+
url += "?" + sendParam;
|
|
98
|
+
fetch(url, requestOptions)
|
|
99
|
+
.then((response) => response.json())
|
|
100
|
+
.then(processFn)
|
|
101
|
+
.catch((error) => {
|
|
102
|
+
console.error(error);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//이메일 정규식
|
|
106
|
+
export function isEmail(asValue) {
|
|
107
|
+
const regExp = /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i;
|
|
108
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
109
|
+
}
|
|
110
|
+
//아이디 정규식
|
|
111
|
+
export function isLoginId(asValue) {
|
|
112
|
+
// if(!isCelluar(asValue)){
|
|
113
|
+
const regExp = /^[a-z0-9.]{5,49}$/g;
|
|
114
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
115
|
+
// }else{
|
|
116
|
+
// return true;
|
|
117
|
+
// }
|
|
118
|
+
}
|
|
119
|
+
//비밀번호 체크 정규식
|
|
120
|
+
export function isJobPassword(asValue) {
|
|
121
|
+
const regExp = /^(?=.*[a-zA-z])(?=.*[0-9])(?=.*[$`~!@$!%*#^?&\\(\\)\-_=+])(?!.*[^a-zA-z0-9$`~!@$!%*#^?&\\(\\)\-_=+]).{8,12}$/;
|
|
122
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
123
|
+
}
|
|
124
|
+
// 핸드폰 번호 체크 정규식
|
|
125
|
+
export function isCelluar(asValue) {
|
|
126
|
+
const regExp = /^01(?:0|1|[6-9])(?:\d{3}|\d{4})\d{4}$/;
|
|
127
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
128
|
+
}
|
|
129
|
+
// 생년월일 체크 정규식
|
|
130
|
+
export function isBirthDay(asValue) {
|
|
131
|
+
const regExp = /^(19[0-9][0-9]|20\d{2})(0[0-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])$/;
|
|
132
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
133
|
+
}
|
|
134
|
+
// 핸드폰 번호 체크 정규식
|
|
135
|
+
export function setCelluar(asValue) {
|
|
136
|
+
if (asValue === undefined || asValue === "" || asValue === null) {
|
|
137
|
+
return "";
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
return asValue.replace(/(^02.{0}|^01.{1}|[0-9]{3})([0-9]+)([0-9]{4})/, "$1-$2-$3");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export function dateFomat(date, formatStr) {
|
|
144
|
+
const moment = require("moment");
|
|
145
|
+
const returnDate = moment(date).format(formatStr);
|
|
146
|
+
return returnDate;
|
|
147
|
+
}
|
|
148
|
+
export function nowDate(formatStr) {
|
|
149
|
+
const moment = require("moment");
|
|
150
|
+
const returnDate = moment().format(formatStr);
|
|
151
|
+
return returnDate;
|
|
152
|
+
}
|
|
153
|
+
export function dateAddDay(formatStr, addDay) {
|
|
154
|
+
const moment = require("moment");
|
|
155
|
+
const returnDate = moment().add(addDay, "day").format(formatStr);
|
|
156
|
+
return returnDate;
|
|
157
|
+
}
|
|
158
|
+
export function dateAddMonth(formatStr, addMonth) {
|
|
159
|
+
const moment = require("moment");
|
|
160
|
+
const returnDate = moment().add(addMonth, "month").format(formatStr);
|
|
161
|
+
return returnDate;
|
|
162
|
+
}
|
|
163
|
+
//전화번호 마스킹 20220816 임의로 수정이후 테스트안함. 사용시 테스트해보고하세요~~
|
|
164
|
+
export function maskTell(tell) {
|
|
165
|
+
if (tell === undefined || tell === null)
|
|
166
|
+
return "";
|
|
167
|
+
let maskingData = "";
|
|
168
|
+
let phoneMatchValue = tell.match(/\d{2,3}-\d{3,4}-\d{4}/gi);
|
|
169
|
+
if (phoneMatchValue === null) {
|
|
170
|
+
return "";
|
|
171
|
+
}
|
|
172
|
+
let str = phoneMatchValue.toString();
|
|
173
|
+
if (/-[0-9]{3}-/.test(str)) {
|
|
174
|
+
// 000-000-0000 형태인 경우
|
|
175
|
+
maskingData = tell
|
|
176
|
+
.toString()
|
|
177
|
+
.replace(str, str.replace(/-[0-9]{3}-/g, "-***-"));
|
|
178
|
+
}
|
|
179
|
+
else if (/-[0-9]{4}-/.test(str)) {
|
|
180
|
+
// 000-0000-0000 형태인 경우
|
|
181
|
+
maskingData = tell
|
|
182
|
+
.toString()
|
|
183
|
+
.replace(str, str.replace(/-[0-9]{4}-/g, "-****-"));
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
// - 없을 경우
|
|
187
|
+
phoneMatchValue =
|
|
188
|
+
tell.length < 11
|
|
189
|
+
? tell.length < 10
|
|
190
|
+
? tell.match(/\d{9}/gi)
|
|
191
|
+
: tell.match(/\d{10}/gi)
|
|
192
|
+
: tell.match(/\d{11}/gi);
|
|
193
|
+
if (phoneMatchValue === null) {
|
|
194
|
+
return "";
|
|
195
|
+
}
|
|
196
|
+
str = phoneMatchValue.toString();
|
|
197
|
+
if (tell.length < 11) {
|
|
198
|
+
if (tell.length < 10) {
|
|
199
|
+
maskingData = tell
|
|
200
|
+
.toString()
|
|
201
|
+
.replace(str, str.replace(/(\d{2})(\d{3})(\d{4})/gi, "$1-***-$3"));
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
if (tell.indexOf("02") < 0) {
|
|
205
|
+
maskingData = tell
|
|
206
|
+
.toString()
|
|
207
|
+
.replace(str, str.replace(/(\d{3})(\d{3})(\d{4})/gi, "$1-***-$3"));
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
maskingData = tell
|
|
211
|
+
.toString()
|
|
212
|
+
.replace(str, str.replace(/(\d{2})(\d{4})(\d{4})/gi, "$1-****-$3"));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
maskingData = tell
|
|
218
|
+
.toString()
|
|
219
|
+
.replace(str, str.replace(/(\d{3})(\d{4})(\d{4})/gi, "$1-****-$3"));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return maskingData;
|
|
223
|
+
}
|
|
224
|
+
//이름 마스킹
|
|
225
|
+
export function maskName(name) {
|
|
226
|
+
if (name === null || name === undefined)
|
|
227
|
+
return "";
|
|
228
|
+
return setCharAt(name, 1, "*");
|
|
229
|
+
}
|
|
230
|
+
//이메일 마스킹
|
|
231
|
+
export function maskEmail(email) {
|
|
232
|
+
if (email === null || email === undefined)
|
|
233
|
+
return "";
|
|
234
|
+
var temp = email.split("@");
|
|
235
|
+
var maskEmail;
|
|
236
|
+
//아이디 뒤 세자리
|
|
237
|
+
if (temp[0].length > 3) {
|
|
238
|
+
maskEmail = temp[0].substring(0, temp[0].length - 3) + "***";
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
maskEmail = "***";
|
|
242
|
+
}
|
|
243
|
+
if (temp[1] !== undefined) {
|
|
244
|
+
return maskEmail + "@" + temp[1];
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
return maskEmail;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//특정 위치 문자열 교체
|
|
251
|
+
function setCharAt(str, index, chr) {
|
|
252
|
+
if (index > str.length - 1)
|
|
253
|
+
return str;
|
|
254
|
+
return str.substr(0, index) + chr + str.substr(index + 1);
|
|
255
|
+
}
|
|
256
|
+
export function cutString(str, length) {
|
|
257
|
+
if (str.length > length - 3) {
|
|
258
|
+
let tempStr = htmlTagRemove(str);
|
|
259
|
+
return tempStr.substring(0, length - 3) + "...";
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
return htmlTagRemove(str);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
export const getLangClassName = (type, kor, en, jp, cn) => {
|
|
266
|
+
return (type == "ko" ? ` ${kor} ` : type == "en" ? ` ${en} ` : type === 'jp' ? ` ${jp} ` : type === 'cn' ? ` ${cn} ` : '');
|
|
267
|
+
};
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* <pre>
|
|
4
|
+
* utils.ts
|
|
5
|
+
* 수정일 수정자 수정내용
|
|
6
|
+
* -------------------------------------------------
|
|
7
|
+
* 2022-08-16 최초생성
|
|
8
|
+
* </pre>
|
|
9
|
+
* @author sbpark
|
|
10
|
+
* @since 2022-08-16
|
|
11
|
+
* @version 1.0
|
|
12
|
+
*
|
|
13
|
+
* Copyright (C) by DeaRyunLaw All right Preserved.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export function htmlTagRemove(str: string) {
|
|
17
|
+
if (str === "") return "";
|
|
18
|
+
|
|
19
|
+
const removeMd = require('remove-markdown');
|
|
20
|
+
|
|
21
|
+
str = removeMd(str);
|
|
22
|
+
|
|
23
|
+
return str
|
|
24
|
+
.replace(/<br\/>/gi, "\n")
|
|
25
|
+
.replace(/<(\/)?([a-zA-Z]*)(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/gi, "")
|
|
26
|
+
.replace(/&/g, "&")
|
|
27
|
+
.replace(/</g, "<")
|
|
28
|
+
.replace(/>/g, ">")
|
|
29
|
+
.replace(/"/g, '"')
|
|
30
|
+
.replace(/'/g, "'")
|
|
31
|
+
.replace(/'/g, "'")
|
|
32
|
+
.replace(/ /g, " ");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function htmlUrlDecode(str: string) {
|
|
36
|
+
if (str === "") return "";
|
|
37
|
+
|
|
38
|
+
return str
|
|
39
|
+
.replace(/&/g, "&")
|
|
40
|
+
.replace(/</g, "<")
|
|
41
|
+
.replace(/>/g, ">")
|
|
42
|
+
.replace(/"/g, '"')
|
|
43
|
+
.replace(/'/g, "'")
|
|
44
|
+
.replace(/'/g, "'")
|
|
45
|
+
.replace(/ /g, " ");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function htmlUrlEncode(str: string) {
|
|
49
|
+
if (str === "") return "";
|
|
50
|
+
|
|
51
|
+
return str
|
|
52
|
+
.replace(new RegExp("&", 'g'), "&")
|
|
53
|
+
.replace(new RegExp("<", 'g'), "<")
|
|
54
|
+
.replace(new RegExp(">", 'g'), ">")
|
|
55
|
+
.replace(new RegExp('"', 'g'), """)
|
|
56
|
+
.replace(new RegExp("'", 'g'), "'")
|
|
57
|
+
.replace(new RegExp("'", 'g'), "'")
|
|
58
|
+
.replace(new RegExp("\r\n", 'g'), " ")
|
|
59
|
+
.replace(new RegExp("\n", 'g'), " ");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function numComma(x: number) {
|
|
63
|
+
if (x === undefined || x === null) {
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
return ("" + x).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function bodyFetch(
|
|
70
|
+
url: string,
|
|
71
|
+
sendData: any,
|
|
72
|
+
processFn: any,
|
|
73
|
+
method = "POST"
|
|
74
|
+
) {
|
|
75
|
+
let myHeaders = new Headers();
|
|
76
|
+
myHeaders.append("Content-Type", "application/json");
|
|
77
|
+
|
|
78
|
+
let parsedJson;
|
|
79
|
+
try {
|
|
80
|
+
parsedJson = JSON.stringify(sendData);
|
|
81
|
+
} catch (exception) {
|
|
82
|
+
console.error(exception);
|
|
83
|
+
parsedJson = null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let requestOptions = {
|
|
87
|
+
method: method,
|
|
88
|
+
headers: myHeaders,
|
|
89
|
+
body: parsedJson,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
fetch(url, requestOptions)
|
|
93
|
+
.then((response) => response.json())
|
|
94
|
+
.then(processFn)
|
|
95
|
+
.catch((error) => {
|
|
96
|
+
console.error(error);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function paramFetch(
|
|
101
|
+
url: string,
|
|
102
|
+
sendData: any,
|
|
103
|
+
processFn: any,
|
|
104
|
+
method = "POST"
|
|
105
|
+
) {
|
|
106
|
+
let myHeaders = new Headers();
|
|
107
|
+
|
|
108
|
+
let sendParam = "";
|
|
109
|
+
for (const key in sendData) {
|
|
110
|
+
if (sendParam !== "") sendParam += "&";
|
|
111
|
+
sendParam += key + "=" + sendData[key];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
let requestOptions = {
|
|
115
|
+
method: method,
|
|
116
|
+
headers: myHeaders,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
url += "?" + sendParam;
|
|
120
|
+
fetch(url, requestOptions)
|
|
121
|
+
.then((response) => response.json())
|
|
122
|
+
.then(processFn)
|
|
123
|
+
.catch((error) => {
|
|
124
|
+
console.error(error);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
//이메일 정규식
|
|
129
|
+
export function isEmail(asValue: string) {
|
|
130
|
+
const regExp =
|
|
131
|
+
/^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i;
|
|
132
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//아이디 정규식
|
|
136
|
+
export function isLoginId(asValue: string) {
|
|
137
|
+
// if(!isCelluar(asValue)){
|
|
138
|
+
const regExp = /^[a-z0-9.]{5,49}$/g;
|
|
139
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
140
|
+
// }else{
|
|
141
|
+
// return true;
|
|
142
|
+
// }
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
//비밀번호 체크 정규식
|
|
146
|
+
export function isJobPassword(asValue: string) {
|
|
147
|
+
const regExp =
|
|
148
|
+
/^(?=.*[a-zA-z])(?=.*[0-9])(?=.*[$`~!@$!%*#^?&\\(\\)\-_=+])(?!.*[^a-zA-z0-9$`~!@$!%*#^?&\\(\\)\-_=+]).{8,12}$/;
|
|
149
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// 핸드폰 번호 체크 정규식
|
|
153
|
+
export function isCelluar(asValue: string) {
|
|
154
|
+
const regExp = /^01(?:0|1|[6-9])(?:\d{3}|\d{4})\d{4}$/;
|
|
155
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
156
|
+
}
|
|
157
|
+
// 생년월일 체크 정규식
|
|
158
|
+
export function isBirthDay(asValue: string) {
|
|
159
|
+
const regExp =
|
|
160
|
+
/^(19[0-9][0-9]|20\d{2})(0[0-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])$/;
|
|
161
|
+
return regExp.test(asValue); // 형식에 맞는 경우 true 리턴
|
|
162
|
+
}
|
|
163
|
+
// 핸드폰 번호 체크 정규식
|
|
164
|
+
export function setCelluar(asValue: string) {
|
|
165
|
+
if (asValue === undefined || asValue === "" || asValue === null) {
|
|
166
|
+
return "";
|
|
167
|
+
} else {
|
|
168
|
+
return asValue.replace(
|
|
169
|
+
/(^02.{0}|^01.{1}|[0-9]{3})([0-9]+)([0-9]{4})/,
|
|
170
|
+
"$1-$2-$3"
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function dateFomat(date: string, formatStr: string) {
|
|
176
|
+
const moment = require("moment");
|
|
177
|
+
|
|
178
|
+
const returnDate = moment(date).format(formatStr);
|
|
179
|
+
return returnDate;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function nowDate(formatStr: string) {
|
|
183
|
+
const moment = require("moment");
|
|
184
|
+
|
|
185
|
+
const returnDate = moment().format(formatStr);
|
|
186
|
+
return returnDate;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function dateAddDay(formatStr: string, addDay: number) {
|
|
190
|
+
const moment = require("moment");
|
|
191
|
+
|
|
192
|
+
const returnDate = moment().add(addDay, "day").format(formatStr);
|
|
193
|
+
return returnDate;
|
|
194
|
+
}
|
|
195
|
+
export function dateAddMonth(formatStr: string, addMonth: number) {
|
|
196
|
+
const moment = require("moment");
|
|
197
|
+
|
|
198
|
+
const returnDate = moment().add(addMonth, "month").format(formatStr);
|
|
199
|
+
return returnDate;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
//전화번호 마스킹 20220816 임의로 수정이후 테스트안함. 사용시 테스트해보고하세요~~
|
|
203
|
+
export function maskTell(tell: string) {
|
|
204
|
+
if (tell === undefined || tell === null) return "";
|
|
205
|
+
let maskingData = "";
|
|
206
|
+
let phoneMatchValue: RegExpMatchArray | null = tell.match(
|
|
207
|
+
/\d{2,3}-\d{3,4}-\d{4}/gi
|
|
208
|
+
);
|
|
209
|
+
if (phoneMatchValue === null) {
|
|
210
|
+
return "";
|
|
211
|
+
}
|
|
212
|
+
let str = phoneMatchValue.toString();
|
|
213
|
+
if (/-[0-9]{3}-/.test(str)) {
|
|
214
|
+
// 000-000-0000 형태인 경우
|
|
215
|
+
maskingData = tell
|
|
216
|
+
.toString()
|
|
217
|
+
.replace(str, str.replace(/-[0-9]{3}-/g, "-***-"));
|
|
218
|
+
} else if (/-[0-9]{4}-/.test(str)) {
|
|
219
|
+
// 000-0000-0000 형태인 경우
|
|
220
|
+
maskingData = tell
|
|
221
|
+
.toString()
|
|
222
|
+
.replace(str, str.replace(/-[0-9]{4}-/g, "-****-"));
|
|
223
|
+
} else {
|
|
224
|
+
// - 없을 경우
|
|
225
|
+
phoneMatchValue =
|
|
226
|
+
tell.length < 11
|
|
227
|
+
? tell.length < 10
|
|
228
|
+
? tell.match(/\d{9}/gi)
|
|
229
|
+
: tell.match(/\d{10}/gi)
|
|
230
|
+
: tell.match(/\d{11}/gi);
|
|
231
|
+
if (phoneMatchValue === null) {
|
|
232
|
+
return "";
|
|
233
|
+
}
|
|
234
|
+
str = phoneMatchValue.toString();
|
|
235
|
+
if (tell.length < 11) {
|
|
236
|
+
if (tell.length < 10) {
|
|
237
|
+
maskingData = tell
|
|
238
|
+
.toString()
|
|
239
|
+
.replace(str, str.replace(/(\d{2})(\d{3})(\d{4})/gi, "$1-***-$3"));
|
|
240
|
+
} else {
|
|
241
|
+
if (tell.indexOf("02") < 0) {
|
|
242
|
+
maskingData = tell
|
|
243
|
+
.toString()
|
|
244
|
+
.replace(str, str.replace(/(\d{3})(\d{3})(\d{4})/gi, "$1-***-$3"));
|
|
245
|
+
} else {
|
|
246
|
+
maskingData = tell
|
|
247
|
+
.toString()
|
|
248
|
+
.replace(str, str.replace(/(\d{2})(\d{4})(\d{4})/gi, "$1-****-$3"));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
maskingData = tell
|
|
253
|
+
.toString()
|
|
254
|
+
.replace(str, str.replace(/(\d{3})(\d{4})(\d{4})/gi, "$1-****-$3"));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return maskingData;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
//이름 마스킹
|
|
261
|
+
export function maskName(name: string) {
|
|
262
|
+
if (name === null || name === undefined) return "";
|
|
263
|
+
return setCharAt(name, 1, "*");
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
//이메일 마스킹
|
|
267
|
+
export function maskEmail(email: string) {
|
|
268
|
+
if (email === null || email === undefined) return "";
|
|
269
|
+
var temp = email.split("@");
|
|
270
|
+
var maskEmail;
|
|
271
|
+
//아이디 뒤 세자리
|
|
272
|
+
if (temp[0].length > 3) {
|
|
273
|
+
maskEmail = temp[0].substring(0, temp[0].length - 3) + "***";
|
|
274
|
+
} else {
|
|
275
|
+
maskEmail = "***";
|
|
276
|
+
}
|
|
277
|
+
if (temp[1] !== undefined) {
|
|
278
|
+
return maskEmail + "@" + temp[1];
|
|
279
|
+
} else {
|
|
280
|
+
return maskEmail;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
//특정 위치 문자열 교체
|
|
285
|
+
function setCharAt(str: string, index: number, chr: string) {
|
|
286
|
+
if (index > str.length - 1) return str;
|
|
287
|
+
return str.substr(0, index) + chr + str.substr(index + 1);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export function cutString(str:string,length:number){
|
|
291
|
+
if(str.length>length-3){
|
|
292
|
+
let tempStr = htmlTagRemove(str)
|
|
293
|
+
return tempStr.substring(0,length-3)+"..."
|
|
294
|
+
}else{
|
|
295
|
+
return htmlTagRemove(str)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
}
|
|
299
|
+
export const getLangClassName = (type: string | undefined, kor: string, en: string, jp: string, cn:string) => {
|
|
300
|
+
return (type == "ko" ? ` ${kor} ` : type == "en" ? ` ${en} ` : type === 'jp' ? ` ${jp} ` : type === 'cn' ? ` ${cn} ` : '')
|
|
301
|
+
}
|