@jk-core/components 1.1.7 → 1.1.9
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/dist/index.js +102 -94
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +5 -5
- package/dist/index.umd.cjs.map +1 -1
- package/dist/src/common/Table/index.d.ts +12 -8
- package/package.json +4 -2
- package/src/common/Accordion/Accordion.module.scss +3 -2
- package/src/common/Button/Button.module.scss +1 -3
- package/src/common/Card/Card.module.scss +1 -0
- package/src/common/SegmentButton/SegmentButton.module.scss +1 -1
- package/src/common/Table/Table.module.scss +1 -1
- package/src/common/Table/index.tsx +22 -13
|
@@ -1,26 +1,30 @@
|
|
|
1
|
+
interface TableLabelType {
|
|
2
|
+
text: string | number;
|
|
3
|
+
align?: 'left' | 'center' | 'right';
|
|
4
|
+
}
|
|
1
5
|
interface TableHeaderType {
|
|
2
|
-
label:
|
|
6
|
+
label: TableLabelType;
|
|
3
7
|
width?: string;
|
|
4
8
|
subWidth?: string[];
|
|
5
|
-
subLabel?:
|
|
9
|
+
subLabel?: TableLabelType[];
|
|
6
10
|
}
|
|
7
11
|
interface TableBodyType {
|
|
8
|
-
head?:
|
|
9
|
-
labels:
|
|
12
|
+
head?: TableLabelType;
|
|
13
|
+
labels: TableLabelType[];
|
|
10
14
|
}
|
|
11
15
|
interface TableProps {
|
|
12
16
|
/**
|
|
13
17
|
* 테이블 헤더 설정
|
|
14
|
-
* - `label`: 헤더의 라벨
|
|
18
|
+
* - `label`: 헤더의 라벨 텍스트, text와 align 속성을 포함한 객체
|
|
15
19
|
* - `width`: 헤더의 너비, subWidth가 있을 경우 무시됨 (선택적)
|
|
16
20
|
* - `subWidth`: 서브 헤더의 너비 배열 (선택적)
|
|
17
|
-
* - `subLabel`: 서브 헤더의
|
|
21
|
+
* - `subLabel`: 서브 헤더의 라벨, text와 align 속성을 포함한 객체 배열 (선택적)
|
|
18
22
|
*/
|
|
19
23
|
header: TableHeaderType[];
|
|
20
24
|
/**
|
|
21
25
|
* 테이블 바디 설정
|
|
22
|
-
* - `head`: 바디의 헤더
|
|
23
|
-
* - `labels`: 각 행의 라벨 배열
|
|
26
|
+
* - `head`: 바디의 헤더 텍스트, text와 align 속성을 포함한 객체 (선택적)
|
|
27
|
+
* - `labels`: 각 행의 라벨 배열, text와 align 속성을 포함한 객체 배열
|
|
24
28
|
*/
|
|
25
29
|
body: TableBodyType[];
|
|
26
30
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jk-core/components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.umd.cjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "yarn clean && vite build",
|
|
44
|
-
"clean": "
|
|
44
|
+
"clean:win": "if exist dist rmdir /S /Q dist",
|
|
45
|
+
"clean:unix": "rm -rf dist",
|
|
46
|
+
"clean": "node -e \"require('child_process').execSync(process.platform === 'win32' ? 'npm run clean:win' : 'npm run clean:unix', {stdio: 'inherit'})\"",
|
|
45
47
|
"lint": "yarn lint:eslint && yarn lint:stylelint",
|
|
46
48
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:stylelint --fix",
|
|
47
49
|
"lint:eslint": "eslint src",
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
border: 1px solid var(--G-20);
|
|
7
7
|
transition: margin-bottom 0.25s;
|
|
8
8
|
border-radius: 5px;
|
|
9
|
+
font-size: 1em;
|
|
9
10
|
|
|
10
11
|
&--visible {
|
|
11
12
|
margin-bottom: 10px;
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
justify-content: space-between;
|
|
21
22
|
align-items: center;
|
|
22
23
|
padding: 20px 10px;
|
|
23
|
-
font-size:
|
|
24
|
+
font-size: 1.5em;
|
|
24
25
|
font-weight: 500;
|
|
25
26
|
|
|
26
27
|
&__arrow {
|
|
@@ -47,6 +48,6 @@
|
|
|
47
48
|
|
|
48
49
|
.content {
|
|
49
50
|
white-space: pre-wrap;
|
|
50
|
-
font-size:
|
|
51
|
+
font-size: 1em;
|
|
51
52
|
padding: 20px;
|
|
52
53
|
}
|
|
@@ -41,12 +41,10 @@
|
|
|
41
41
|
|
|
42
42
|
.button {
|
|
43
43
|
position: relative;
|
|
44
|
-
width: fit-content;
|
|
45
44
|
border-radius: 8px;
|
|
46
45
|
padding: 10px 24px;
|
|
47
46
|
transition: background-color 0.1s;
|
|
48
|
-
font-size:
|
|
49
|
-
font-weight: 500;
|
|
47
|
+
font-size: 1em;
|
|
50
48
|
|
|
51
49
|
&__loading {
|
|
52
50
|
color: transparent !important;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
border-radius: 8px;
|
|
7
7
|
z-index: 0;
|
|
8
8
|
overflow: hidden;
|
|
9
|
+
font-size: 1em;
|
|
9
10
|
|
|
10
11
|
&--selector {
|
|
11
12
|
position: absolute;
|
|
@@ -28,7 +29,6 @@
|
|
|
28
29
|
padding: 8px 5px;
|
|
29
30
|
color: var(--G-40);
|
|
30
31
|
transition: color 0.2s;
|
|
31
|
-
font-size: 17px;
|
|
32
32
|
font-weight: 500;
|
|
33
33
|
|
|
34
34
|
& > div {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
z-index: 1;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
thead > tr > th:last-child,
|
|
28
27
|
tbody > tr > td:last-child {
|
|
29
28
|
border-right: none;
|
|
30
29
|
}
|
|
@@ -33,6 +32,7 @@
|
|
|
33
32
|
flex-shrink: 0;
|
|
34
33
|
background-color: var(--G-5);
|
|
35
34
|
padding: 10px;
|
|
35
|
+
font-size: 1em;
|
|
36
36
|
font-weight: 600;
|
|
37
37
|
color: var(--G-80);
|
|
38
38
|
border-right: 1px solid var(--G-30);
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
import { cn } from '@jk-core/utils';
|
|
2
2
|
import styles from './Table.module.scss';
|
|
3
3
|
|
|
4
|
+
interface TableLabelType{
|
|
5
|
+
text: string | number;
|
|
6
|
+
align?: 'left' | 'center' | 'right';
|
|
7
|
+
}
|
|
4
8
|
interface TableHeaderType {
|
|
5
|
-
label:
|
|
9
|
+
label: TableLabelType;
|
|
6
10
|
width?: string;
|
|
7
11
|
subWidth?: string[];
|
|
8
|
-
subLabel?:
|
|
12
|
+
subLabel?:TableLabelType[];
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
interface TableBodyType{
|
|
12
|
-
head?:
|
|
13
|
-
labels:
|
|
16
|
+
head?: TableLabelType;
|
|
17
|
+
labels: TableLabelType[];
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
interface TableProps {
|
|
17
21
|
/**
|
|
18
22
|
* 테이블 헤더 설정
|
|
19
|
-
* - `label`: 헤더의 라벨
|
|
23
|
+
* - `label`: 헤더의 라벨 텍스트, text와 align 속성을 포함한 객체
|
|
20
24
|
* - `width`: 헤더의 너비, subWidth가 있을 경우 무시됨 (선택적)
|
|
21
25
|
* - `subWidth`: 서브 헤더의 너비 배열 (선택적)
|
|
22
|
-
* - `subLabel`: 서브 헤더의
|
|
26
|
+
* - `subLabel`: 서브 헤더의 라벨, text와 align 속성을 포함한 객체 배열 (선택적)
|
|
23
27
|
*/
|
|
24
28
|
header: TableHeaderType[];
|
|
25
29
|
/**
|
|
26
30
|
* 테이블 바디 설정
|
|
27
|
-
* - `head`: 바디의 헤더
|
|
28
|
-
* - `labels`: 각 행의 라벨 배열
|
|
31
|
+
* - `head`: 바디의 헤더 텍스트, text와 align 속성을 포함한 객체 (선택적)
|
|
32
|
+
* - `labels`: 각 행의 라벨 배열, text와 align 속성을 포함한 객체 배열
|
|
29
33
|
*/
|
|
30
34
|
body: TableBodyType[];
|
|
31
35
|
/**
|
|
@@ -86,17 +90,22 @@ export default function Table({ header, body, rounded, border }: TableProps) {
|
|
|
86
90
|
{header.map((col, index) => (
|
|
87
91
|
<th
|
|
88
92
|
key={index}
|
|
93
|
+
style={{ textAlign: col.label.align || 'left' }}
|
|
89
94
|
rowSpan={col.subLabel ? 1 : 2}
|
|
90
95
|
colSpan={col.subLabel ? col.subLabel.length : undefined}
|
|
91
96
|
>
|
|
92
|
-
{col.label}
|
|
97
|
+
{col.label.text}
|
|
93
98
|
</th>
|
|
94
99
|
))}
|
|
95
100
|
</tr>
|
|
96
101
|
{subLabels.length > 0 && (
|
|
97
102
|
<tr>
|
|
98
103
|
{subLabels.map((subLabel, index) => (
|
|
99
|
-
<th
|
|
104
|
+
<th
|
|
105
|
+
style={{ textAlign: subLabel.align || 'left' }}
|
|
106
|
+
key={index}
|
|
107
|
+
>{subLabel.text}
|
|
108
|
+
</th>
|
|
100
109
|
))}
|
|
101
110
|
</tr>
|
|
102
111
|
)}
|
|
@@ -104,10 +113,10 @@ export default function Table({ header, body, rounded, border }: TableProps) {
|
|
|
104
113
|
<tbody>
|
|
105
114
|
{body.map((row, rowIndex) => (
|
|
106
115
|
<tr key={rowIndex}>
|
|
107
|
-
{isBodyWithHead && <th>{row?.head || ''}</th>}
|
|
116
|
+
{isBodyWithHead && <th style={{ textAlign: row?.head?.align || 'left' }}>{row?.head?.text || ''}</th>}
|
|
108
117
|
{row.labels.map((col, colIndex) => (
|
|
109
|
-
<td key={colIndex}>
|
|
110
|
-
{col}
|
|
118
|
+
<td style={{ textAlign: col.align || 'left' }} key={colIndex}>
|
|
119
|
+
{col.text}
|
|
111
120
|
</td>
|
|
112
121
|
))}
|
|
113
122
|
</tr>
|