@jk-core/components 1.1.17 → 1.1.18
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 +73 -73
- package/dist/index.js +42 -42
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -2
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +99 -99
- package/src/Calendar/Calendar.module.scss +213 -213
- package/src/Calendar/RangeCalendar.tsx +125 -125
- package/src/Calendar/ScrollCalendar.module.scss +214 -214
- package/src/Calendar/ScrollCalendar.tsx +124 -124
- package/src/Calendar/SingleCalendar.tsx +121 -121
- package/src/Calendar/components/DateLabel/DateLabel.module.scss +89 -89
- package/src/Calendar/components/DateLabel/index.tsx +91 -91
- package/src/Calendar/components/DayTile/DayTile.module.scss +117 -117
- package/src/Calendar/components/DayTile/index.tsx +108 -108
- package/src/Calendar/components/MonthTile/MonthTile.module.scss +59 -59
- package/src/Calendar/components/MonthTile/index.tsx +50 -50
- package/src/Calendar/components/ViewSelector/ViewSelector.module.scss +48 -48
- package/src/Calendar/components/ViewSelector/index.tsx +49 -49
- package/src/Calendar/components/YearTile/YearTile.module.scss +85 -85
- package/src/Calendar/components/YearTile/index.tsx +65 -65
- package/src/Calendar/hooks/useCalendarNav.ts +83 -83
- package/src/Calendar/hooks/useDateSelect.ts +54 -54
- package/src/Calendar/index.scss +189 -189
- package/src/Calendar/index.tsx +66 -66
- package/src/Calendar/type.ts +3 -3
- package/src/Calendar/utils/getWeeksInMonth.ts +45 -45
- package/src/Calendar/utils/isInRange.ts +8 -8
- package/src/Calendar/utils/isSameDay.ts +21 -21
- package/src/assets/arrow.svg +11 -11
- package/src/assets/close.svg +15 -15
- package/src/assets/drop-arrow.svg +3 -3
- package/src/common/Accordion/Accordion.module.scss +53 -53
- package/src/common/Accordion/arrow-down.svg +3 -3
- package/src/common/Accordion/arrow-up.svg +3 -3
- package/src/common/Accordion/index.tsx +54 -54
- package/src/common/Breadcrumbs/Breadcrumbs.module.scss +46 -46
- package/src/common/Breadcrumbs/home.svg +5 -5
- package/src/common/Breadcrumbs/index.tsx +82 -82
- package/src/common/Button/Button.module.scss +127 -127
- package/src/common/Button/index.tsx +60 -60
- package/src/common/Card/Card.module.scss +28 -28
- package/src/common/Card/index.tsx +19 -19
- package/src/common/Divider/Divider.module.scss +101 -101
- package/src/common/Divider/index.tsx +24 -24
- package/src/common/DropDown/DropDown.module.scss +135 -135
- package/src/common/DropDown/List.tsx +156 -156
- package/src/common/DropDown/arrow-down.svg +3 -3
- package/src/common/DropDown/index.tsx +108 -108
- package/src/common/DropDown/search.svg +4 -4
- package/src/common/Pagination/Pagination.module.scss +210 -210
- package/src/common/Pagination/arrow-left.svg +11 -11
- package/src/common/Pagination/arrow-right.svg +11 -11
- package/src/common/Pagination/index.tsx +156 -156
- package/src/common/SegmentButton/SegmentButton.module.scss +46 -45
- package/src/common/SegmentButton/index.tsx +79 -79
- package/src/common/Skeleton/Skeleton.module.scss +80 -80
- package/src/common/Skeleton/index.tsx +47 -47
- package/src/common/SwitchButton/SwitchButton.module.scss +65 -65
- package/src/common/SwitchButton/index.tsx +57 -57
- package/src/common/Table/Table.module.scss +70 -70
- package/src/common/Table/index.tsx +128 -128
- package/src/index.scss +1 -1
- package/src/index.tsx +21 -21
- package/src/styles/color.scss +346 -346
- package/src/styles/font-face.scss +18 -18
- package/src/styles/font.scss +49 -49
- package/src/styles/mediaQuery.scss +22 -22
- package/src/styles/scrollbar.scss +71 -71
- package/src/svg.d.ts +6 -6
- package/src/utils/styles/mediaQuery.scss +22 -22
- package/src/utils/ts/allowDecimal.ts +4 -4
- package/src/utils/ts/autoHypen.ts +33 -33
- package/src/utils/ts/calculateMax.ts +24 -24
- package/src/utils/ts/checkIsMobilePlatform.ts +15 -15
- package/src/utils/ts/formatFileSize.ts +16 -16
- package/src/utils/ts/formatMoney.ts +16 -16
- package/src/utils/ts/gradientRatio.ts +61 -61
- package/src/utils/ts/kiloToMega.ts +30 -30
- package/src/utils/ts/maskingPhone.ts +8 -8
- package/src/utils/ts/toQueryString.ts +7 -7
- package/src/utils/ts/valueAsNumber.ts +15 -15
- package/src/vite-env.d.ts +2 -2
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
@use "sass:string";
|
|
2
|
-
|
|
3
|
-
@mixin font-face($font-name, $src, $weight: normal, $style: normal) {
|
|
4
|
-
@font-face {
|
|
5
|
-
font-family: $font-name;
|
|
6
|
-
src: url($src);
|
|
7
|
-
font-style: $style;
|
|
8
|
-
font-weight: $weight;
|
|
9
|
-
font-display: swap;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-Regular.woff2", 400);
|
|
14
|
-
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-Medium.woff2", 500);
|
|
15
|
-
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-SemiBold.woff2", 600);
|
|
16
|
-
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-Bold.woff2", 700);
|
|
17
|
-
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-ExtraBold.woff2", 800);
|
|
18
|
-
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-Black.woff2", 900);
|
|
1
|
+
@use "sass:string";
|
|
2
|
+
|
|
3
|
+
@mixin font-face($font-name, $src, $weight: normal, $style: normal) {
|
|
4
|
+
@font-face {
|
|
5
|
+
font-family: $font-name;
|
|
6
|
+
src: url($src);
|
|
7
|
+
font-style: $style;
|
|
8
|
+
font-weight: $weight;
|
|
9
|
+
font-display: swap;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-Regular.woff2", 400);
|
|
14
|
+
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-Medium.woff2", 500);
|
|
15
|
+
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-SemiBold.woff2", 600);
|
|
16
|
+
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-Bold.woff2", 700);
|
|
17
|
+
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-ExtraBold.woff2", 800);
|
|
18
|
+
@include font-face("Pretendard", "/fonts/Pretendard/Pretendard-Black.woff2", 900);
|
package/src/styles/font.scss
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
@use "/src/utils/styles/mediaQuery.scss" as media;
|
|
2
|
-
@use "sass:math";
|
|
3
|
-
|
|
4
|
-
@mixin font($weight, $size) {
|
|
5
|
-
font-weight: $weight;
|
|
6
|
-
font-size: $size;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// 반응형 폰트 mixin
|
|
10
|
-
// nesting 규칙에 의해 폰트는 항상 코드의 가장 마지막에 위치해야 한다.
|
|
11
|
-
|
|
12
|
-
@mixin B-($i) {
|
|
13
|
-
font-weight: 700;
|
|
14
|
-
font-size: #{$i}rem;
|
|
15
|
-
|
|
16
|
-
@include media.tablet {
|
|
17
|
-
font-size: #{math.round($i * 0.9)}px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@include media.mobile {
|
|
21
|
-
font-size: #{math.round($i * 0.8)}px;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@mixin Semi-($i) {
|
|
26
|
-
font-weight: 600;
|
|
27
|
-
font-size: #{$i}rem;
|
|
28
|
-
|
|
29
|
-
@include media.tablet {
|
|
30
|
-
font-size: #{math.round($i * 0.9)}px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@include media.mobile {
|
|
34
|
-
font-size: #{math.round($i * 0.8)}px;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@mixin R-($i) {
|
|
39
|
-
font-weight: 400;
|
|
40
|
-
font-size: #{$i}rem;
|
|
41
|
-
|
|
42
|
-
@include media.tablet {
|
|
43
|
-
font-size: #{math.round($i * 0.9)}px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@include media.mobile {
|
|
47
|
-
font-size: #{math.round($i * 0.8)}px;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
1
|
+
@use "/src/utils/styles/mediaQuery.scss" as media;
|
|
2
|
+
@use "sass:math";
|
|
3
|
+
|
|
4
|
+
@mixin font($weight, $size) {
|
|
5
|
+
font-weight: $weight;
|
|
6
|
+
font-size: $size;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// 반응형 폰트 mixin
|
|
10
|
+
// nesting 규칙에 의해 폰트는 항상 코드의 가장 마지막에 위치해야 한다.
|
|
11
|
+
|
|
12
|
+
@mixin B-($i) {
|
|
13
|
+
font-weight: 700;
|
|
14
|
+
font-size: #{$i}rem;
|
|
15
|
+
|
|
16
|
+
@include media.tablet {
|
|
17
|
+
font-size: #{math.round($i * 0.9)}px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@include media.mobile {
|
|
21
|
+
font-size: #{math.round($i * 0.8)}px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@mixin Semi-($i) {
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
font-size: #{$i}rem;
|
|
28
|
+
|
|
29
|
+
@include media.tablet {
|
|
30
|
+
font-size: #{math.round($i * 0.9)}px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@include media.mobile {
|
|
34
|
+
font-size: #{math.round($i * 0.8)}px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@mixin R-($i) {
|
|
39
|
+
font-weight: 400;
|
|
40
|
+
font-size: #{$i}rem;
|
|
41
|
+
|
|
42
|
+
@include media.tablet {
|
|
43
|
+
font-size: #{math.round($i * 0.9)}px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include media.mobile {
|
|
47
|
+
font-size: #{math.round($i * 0.8)}px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
// 스크롤바 너비 14px 추가
|
|
2
|
-
$pc: 1396px;
|
|
3
|
-
$tablet: 1395px;
|
|
4
|
-
$mobile: 774px;
|
|
5
|
-
|
|
6
|
-
@mixin pc {
|
|
7
|
-
@media (min-width: $pc) {
|
|
8
|
-
@content;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@mixin tablet {
|
|
13
|
-
@media (max-width: $tablet) {
|
|
14
|
-
@content;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@mixin mobile {
|
|
19
|
-
@media (max-width: $mobile) {
|
|
20
|
-
@content;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
// 스크롤바 너비 14px 추가
|
|
2
|
+
$pc: 1396px;
|
|
3
|
+
$tablet: 1395px;
|
|
4
|
+
$mobile: 774px;
|
|
5
|
+
|
|
6
|
+
@mixin pc {
|
|
7
|
+
@media (min-width: $pc) {
|
|
8
|
+
@content;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@mixin tablet {
|
|
13
|
+
@media (max-width: $tablet) {
|
|
14
|
+
@content;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@mixin mobile {
|
|
19
|
+
@media (max-width: $mobile) {
|
|
20
|
+
@content;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
@use "@/utils/styles/mediaQuery.scss" as mixinMedia;
|
|
2
|
-
|
|
3
|
-
@mixin custom-scrollbar($background: var(--G-10), $color: #c6c6c6) {
|
|
4
|
-
&::-webkit-scrollbar {
|
|
5
|
-
width: 8px;
|
|
6
|
-
height: 8px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
&::-webkit-scrollbar-thumb {
|
|
10
|
-
background-color: $color;
|
|
11
|
-
border-radius: 100px;
|
|
12
|
-
|
|
13
|
-
&:hover {
|
|
14
|
-
background: $color;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@include mixinMedia.tablet {
|
|
18
|
-
border: none;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&::-webkit-scrollbar-track {
|
|
23
|
-
background-color: $background;
|
|
24
|
-
border-radius: 100px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&::-webkit-scrollbar-corner {
|
|
28
|
-
background: $background;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@mixin global-scrollbar() {
|
|
33
|
-
&::-webkit-scrollbar {
|
|
34
|
-
width: 12px;
|
|
35
|
-
height: 12px;
|
|
36
|
-
|
|
37
|
-
@include mixinMedia.tablet {
|
|
38
|
-
width: 8px;
|
|
39
|
-
height: 8px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@include mixinMedia.mobile {
|
|
43
|
-
width: 6px;
|
|
44
|
-
height: 6px;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&::-webkit-scrollbar-thumb {
|
|
49
|
-
background-clip: padding-box;
|
|
50
|
-
border: 2px solid transparent;
|
|
51
|
-
background-color: #c6c6c6;
|
|
52
|
-
border-radius: 100px;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
|
|
55
|
-
&:hover {
|
|
56
|
-
background: #aeaeae;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@include mixinMedia.tablet {
|
|
60
|
-
border: none;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&::-webkit-scrollbar-track {
|
|
65
|
-
background-color: var(--G-10);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&::-webkit-scrollbar-corner {
|
|
69
|
-
background: var(--G-10);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
@use "@/utils/styles/mediaQuery.scss" as mixinMedia;
|
|
2
|
+
|
|
3
|
+
@mixin custom-scrollbar($background: var(--G-10), $color: #c6c6c6) {
|
|
4
|
+
&::-webkit-scrollbar {
|
|
5
|
+
width: 8px;
|
|
6
|
+
height: 8px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&::-webkit-scrollbar-thumb {
|
|
10
|
+
background-color: $color;
|
|
11
|
+
border-radius: 100px;
|
|
12
|
+
|
|
13
|
+
&:hover {
|
|
14
|
+
background: $color;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@include mixinMedia.tablet {
|
|
18
|
+
border: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&::-webkit-scrollbar-track {
|
|
23
|
+
background-color: $background;
|
|
24
|
+
border-radius: 100px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&::-webkit-scrollbar-corner {
|
|
28
|
+
background: $background;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@mixin global-scrollbar() {
|
|
33
|
+
&::-webkit-scrollbar {
|
|
34
|
+
width: 12px;
|
|
35
|
+
height: 12px;
|
|
36
|
+
|
|
37
|
+
@include mixinMedia.tablet {
|
|
38
|
+
width: 8px;
|
|
39
|
+
height: 8px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@include mixinMedia.mobile {
|
|
43
|
+
width: 6px;
|
|
44
|
+
height: 6px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&::-webkit-scrollbar-thumb {
|
|
49
|
+
background-clip: padding-box;
|
|
50
|
+
border: 2px solid transparent;
|
|
51
|
+
background-color: #c6c6c6;
|
|
52
|
+
border-radius: 100px;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
background: #aeaeae;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@include mixinMedia.tablet {
|
|
60
|
+
border: none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&::-webkit-scrollbar-track {
|
|
65
|
+
background-color: var(--G-10);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&::-webkit-scrollbar-corner {
|
|
69
|
+
background: var(--G-10);
|
|
70
|
+
}
|
|
71
|
+
}
|
package/src/svg.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// svg를 ReactComponent처럼 사용하기 위해 선언
|
|
2
|
-
declare module '*.svg' {
|
|
3
|
-
import { HTMLAttributes } from 'react';
|
|
4
|
-
|
|
5
|
-
export default React.Component<HTMLAttributes<HTMLDivElement>>;
|
|
6
|
-
}
|
|
1
|
+
// svg를 ReactComponent처럼 사용하기 위해 선언
|
|
2
|
+
declare module '*.svg' {
|
|
3
|
+
import { HTMLAttributes } from 'react';
|
|
4
|
+
|
|
5
|
+
export default React.Component<HTMLAttributes<HTMLDivElement>>;
|
|
6
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
// 스크롤바 너비 14px 추가
|
|
2
|
-
$pc: 1396px;
|
|
3
|
-
$tablet: 1395px;
|
|
4
|
-
$mobile: 774px;
|
|
5
|
-
|
|
6
|
-
@mixin pc {
|
|
7
|
-
@media (min-width: $pc) {
|
|
8
|
-
@content;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@mixin tablet {
|
|
13
|
-
@media (max-width: $tablet) {
|
|
14
|
-
@content;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@mixin mobile {
|
|
19
|
-
@media (max-width: $mobile) {
|
|
20
|
-
@content;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
// 스크롤바 너비 14px 추가
|
|
2
|
+
$pc: 1396px;
|
|
3
|
+
$tablet: 1395px;
|
|
4
|
+
$mobile: 774px;
|
|
5
|
+
|
|
6
|
+
@mixin pc {
|
|
7
|
+
@media (min-width: $pc) {
|
|
8
|
+
@content;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@mixin tablet {
|
|
13
|
+
@media (max-width: $tablet) {
|
|
14
|
+
@content;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@mixin mobile {
|
|
19
|
+
@media (max-width: $mobile) {
|
|
20
|
+
@content;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const allowDecimal = (val: number) => {
|
|
2
|
-
const str = val.toString();
|
|
3
|
-
const decimal = str.split('.')[1];
|
|
4
|
-
return !decimal || decimal.length <= 2;
|
|
1
|
+
export const allowDecimal = (val: number) => {
|
|
2
|
+
const str = val.toString();
|
|
3
|
+
const decimal = str.split('.')[1];
|
|
4
|
+
return !decimal || decimal.length <= 2;
|
|
5
5
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export default function AutoHypen(input:string) {
|
|
2
|
-
const value = input.replace(/[^0-9]/g, '');
|
|
3
|
-
|
|
4
|
-
const result = [];
|
|
5
|
-
let restNumber = '';
|
|
6
|
-
|
|
7
|
-
// 지역번호와 나머지 번호로 나누기
|
|
8
|
-
if (value.startsWith('02')) {
|
|
9
|
-
// 서울 02 지역번호
|
|
10
|
-
result.push(value.substr(0, 2));
|
|
11
|
-
restNumber = value.substring(2);
|
|
12
|
-
} else if (value.startsWith('1')) {
|
|
13
|
-
// 지역 번호가 없는 경우
|
|
14
|
-
// 1xxx-yyyy
|
|
15
|
-
restNumber = value;
|
|
16
|
-
} else {
|
|
17
|
-
// 나머지 3자리 지역번호
|
|
18
|
-
// 0xx-yyyy-zzzz
|
|
19
|
-
result.push(value.substr(0, 3));
|
|
20
|
-
restNumber = value.substring(3);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (restNumber.length === 7) {
|
|
24
|
-
// 7자리만 남았을 때는 xxx-yyyy
|
|
25
|
-
result.push(restNumber.substring(0, 3));
|
|
26
|
-
result.push(restNumber.substring(3));
|
|
27
|
-
} else {
|
|
28
|
-
result.push(restNumber.substring(0, 4));
|
|
29
|
-
result.push(restNumber.substring(4));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (result.filter((val) => val).join('-'));
|
|
33
|
-
}
|
|
1
|
+
export default function AutoHypen(input:string) {
|
|
2
|
+
const value = input.replace(/[^0-9]/g, '');
|
|
3
|
+
|
|
4
|
+
const result = [];
|
|
5
|
+
let restNumber = '';
|
|
6
|
+
|
|
7
|
+
// 지역번호와 나머지 번호로 나누기
|
|
8
|
+
if (value.startsWith('02')) {
|
|
9
|
+
// 서울 02 지역번호
|
|
10
|
+
result.push(value.substr(0, 2));
|
|
11
|
+
restNumber = value.substring(2);
|
|
12
|
+
} else if (value.startsWith('1')) {
|
|
13
|
+
// 지역 번호가 없는 경우
|
|
14
|
+
// 1xxx-yyyy
|
|
15
|
+
restNumber = value;
|
|
16
|
+
} else {
|
|
17
|
+
// 나머지 3자리 지역번호
|
|
18
|
+
// 0xx-yyyy-zzzz
|
|
19
|
+
result.push(value.substr(0, 3));
|
|
20
|
+
restNumber = value.substring(3);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (restNumber.length === 7) {
|
|
24
|
+
// 7자리만 남았을 때는 xxx-yyyy
|
|
25
|
+
result.push(restNumber.substring(0, 3));
|
|
26
|
+
result.push(restNumber.substring(3));
|
|
27
|
+
} else {
|
|
28
|
+
result.push(restNumber.substring(0, 4));
|
|
29
|
+
result.push(restNumber.substring(4));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (result.filter((val) => val).join('-'));
|
|
33
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { isDefined } from '@jk-core/utils';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* unit으로 나누어떨어지면서,
|
|
5
|
-
* a가 양수라면, a보다 크되 가장 작은 정수.
|
|
6
|
-
* a가 음수라면, a보다 작되 가장 큰 정수를 반환.
|
|
7
|
-
* 절댓값이 threshold에 미치지못한다면, 그대로 반환.
|
|
8
|
-
* @param {*} value
|
|
9
|
-
* @param {*} unit
|
|
10
|
-
*/
|
|
11
|
-
export const calculateMax = (
|
|
12
|
-
value?: number,
|
|
13
|
-
threshold: number = 10,
|
|
14
|
-
unit: number = 10,
|
|
15
|
-
) => {
|
|
16
|
-
if (!isDefined(value)) return value;
|
|
17
|
-
if (unit === 0 || Math.abs(value) < threshold) return value;
|
|
18
|
-
if (value > 0) {
|
|
19
|
-
return Math.ceil(value / unit) * unit;
|
|
20
|
-
} if (value < 0) {
|
|
21
|
-
return Math.floor(value / unit) * unit;
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
1
|
+
import { isDefined } from '@jk-core/utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* unit으로 나누어떨어지면서,
|
|
5
|
+
* a가 양수라면, a보다 크되 가장 작은 정수.
|
|
6
|
+
* a가 음수라면, a보다 작되 가장 큰 정수를 반환.
|
|
7
|
+
* 절댓값이 threshold에 미치지못한다면, 그대로 반환.
|
|
8
|
+
* @param {*} value
|
|
9
|
+
* @param {*} unit
|
|
10
|
+
*/
|
|
11
|
+
export const calculateMax = (
|
|
12
|
+
value?: number,
|
|
13
|
+
threshold: number = 10,
|
|
14
|
+
unit: number = 10,
|
|
15
|
+
) => {
|
|
16
|
+
if (!isDefined(value)) return value;
|
|
17
|
+
if (unit === 0 || Math.abs(value) < threshold) return value;
|
|
18
|
+
if (value > 0) {
|
|
19
|
+
return Math.ceil(value / unit) * unit;
|
|
20
|
+
} if (value < 0) {
|
|
21
|
+
return Math.floor(value / unit) * unit;
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const checkIsMobile = () => {
|
|
2
|
-
const { userAgent } = navigator;
|
|
3
|
-
|
|
4
|
-
if (userAgent.match(/Android/i) || userAgent.match(/iPhone|iPad|iPod/i)) {
|
|
5
|
-
return true;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
if (userAgent.match(/Windows/i) || userAgent.match(/Macintosh/i)) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return true;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default checkIsMobile;
|
|
1
|
+
const checkIsMobile = () => {
|
|
2
|
+
const { userAgent } = navigator;
|
|
3
|
+
|
|
4
|
+
if (userAgent.match(/Android/i) || userAgent.match(/iPhone|iPad|iPod/i)) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (userAgent.match(/Windows/i) || userAgent.match(/Macintosh/i)) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return true;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default checkIsMobile;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export const formatFileSize = (bytes: number, unit: 'KB' | 'MB' | 'GB' | 'TB' = 'MB') => {
|
|
2
|
-
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
3
|
-
let unitIndex = 0;
|
|
4
|
-
let size = bytes;
|
|
5
|
-
|
|
6
|
-
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
7
|
-
size /= 1024;
|
|
8
|
-
unitIndex += 1;
|
|
9
|
-
if (units[unitIndex] === unit) break;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return ({
|
|
13
|
-
size,
|
|
14
|
-
unit: units[unitIndex],
|
|
15
|
-
});
|
|
16
|
-
};
|
|
1
|
+
export const formatFileSize = (bytes: number, unit: 'KB' | 'MB' | 'GB' | 'TB' = 'MB') => {
|
|
2
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
3
|
+
let unitIndex = 0;
|
|
4
|
+
let size = bytes;
|
|
5
|
+
|
|
6
|
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
7
|
+
size /= 1024;
|
|
8
|
+
unitIndex += 1;
|
|
9
|
+
if (units[unitIndex] === unit) break;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return ({
|
|
13
|
+
size,
|
|
14
|
+
unit: units[unitIndex],
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const formatMoney = (value?: number) => {
|
|
2
|
-
if (value === undefined) return '- 원';
|
|
3
|
-
|
|
4
|
-
let money = value;
|
|
5
|
-
const units = ['원', '만원', '억원', '조원', '경원', '해원'];
|
|
6
|
-
let unitIndex = 0;
|
|
7
|
-
|
|
8
|
-
while (money >= 10000 && unitIndex < units.length - 1) {
|
|
9
|
-
money /= 10000;
|
|
10
|
-
unitIndex += 1;
|
|
11
|
-
}
|
|
12
|
-
money = Math.round(money);
|
|
13
|
-
return [money, units[unitIndex]];
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default formatMoney;
|
|
1
|
+
const formatMoney = (value?: number) => {
|
|
2
|
+
if (value === undefined) return '- 원';
|
|
3
|
+
|
|
4
|
+
let money = value;
|
|
5
|
+
const units = ['원', '만원', '억원', '조원', '경원', '해원'];
|
|
6
|
+
let unitIndex = 0;
|
|
7
|
+
|
|
8
|
+
while (money >= 10000 && unitIndex < units.length - 1) {
|
|
9
|
+
money /= 10000;
|
|
10
|
+
unitIndex += 1;
|
|
11
|
+
}
|
|
12
|
+
money = Math.round(money);
|
|
13
|
+
return [money, units[unitIndex]];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default formatMoney;
|