@xaypay/tui 0.0.80 → 0.0.82
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.es.js +220 -146
- package/dist/index.js +220 -146
- package/package.json +1 -1
- package/src/assets/attach.svg +4 -0
- package/src/assets/delete.svg +4 -0
- package/src/assets/down-arrow.svg +4 -0
- package/src/assets/minus.svg +4 -0
- package/src/assets/plus.svg +4 -0
- package/src/assets/up-arrow.svg +4 -0
- package/src/components/icon/Arrow.js +2 -2
- package/src/components/icon/CaptchaArrowDown.js +2 -2
- package/src/components/icon/CaptchaArrowUp.js +2 -2
- package/src/components/icon/CheckboxChecked.js +2 -2
- package/src/components/icon/CheckboxUnchecked.js +2 -2
- package/src/components/icon/Close.js +2 -2
- package/src/components/icon/CloseIcon.js +2 -2
- package/src/components/icon/CloseSlide.js +2 -2
- package/src/components/icon/DeleteComponent.js +2 -2
- package/src/components/icon/Dots.js +2 -2
- package/src/components/icon/HeartFilled.js +2 -2
- package/src/components/icon/HeartOutline.js +2 -2
- package/src/components/icon/ListItemDelete.js +2 -2
- package/src/components/icon/ListItemJpeg.js +2 -2
- package/src/components/icon/ListItemJpg.js +2 -2
- package/src/components/icon/ListItemPdf.js +2 -2
- package/src/components/icon/ListItemPng.js +2 -2
- package/src/components/icon/Next.js +2 -2
- package/src/components/icon/Nextarrow.js +2 -2
- package/src/components/icon/PDF.js +2 -2
- package/src/components/icon/Prev.js +2 -2
- package/src/components/icon/RangeArrowDefault.js +2 -2
- package/src/components/icon/RangeArrowError.js +2 -2
- package/src/components/icon/RangeArrowSuccess.js +2 -2
- package/src/components/icon/RemoveFile.js +2 -2
- package/src/components/icon/ToasterClose.js +2 -2
- package/src/components/icon/ToasterError.js +2 -2
- package/src/components/icon/ToasterInfo.js +2 -2
- package/src/components/icon/ToasterSuccess.js +2 -2
- package/src/components/icon/ToasterWarning.js +2 -2
- package/src/components/icon/Tooltip.js +2 -2
- package/src/components/icon/Upload.js +2 -2
- package/src/components/input/index.js +11 -21
- package/src/components/modal/index.js +28 -20
- package/src/components/modal/modal.stories.js +1 -1
- package/src/components/newAutocomplete/index.js +9 -5
- package/src/components/newFile/index.js +4 -3
- package/src/components/select/index.js +9 -2
- package/src/components/singleCheckbox/index.js +27 -5
- package/src/components/table/index.js +70 -97
- package/src/components/table/table.module.css +28 -0
- package/src/components/table/table.stories.js +391 -172
- package/src/components/table/td.js +133 -0
- package/src/components/table/th.js +55 -0
- package/src/components/textarea/index.js +21 -15
- package/src/components/textarea/textarea.stories.js +4 -0
- package/src/stories/configuration.stories.mdx +17 -5
- package/tui.config.js +18 -7
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
+
import TH from './th';
|
|
5
|
+
import TD from './td';
|
|
6
|
+
|
|
4
7
|
import { compereConfigs } from './../../utils';
|
|
5
8
|
|
|
6
9
|
const Table = ({
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
dataBody,
|
|
11
|
+
dataHeader,
|
|
9
12
|
|
|
10
13
|
tHeadColor,
|
|
11
14
|
tHeadFamily,
|
|
@@ -22,22 +25,36 @@ const Table = ({
|
|
|
22
25
|
tBodyFontFamily,
|
|
23
26
|
|
|
24
27
|
tBodyRowBorder,
|
|
25
|
-
|
|
28
|
+
|
|
29
|
+
handleCheckedBody,
|
|
30
|
+
handleCheckedHeader,
|
|
31
|
+
handleHeaderItemClick,
|
|
32
|
+
handleBodyActionClick
|
|
26
33
|
}) => {
|
|
34
|
+
const [body, setBody] = useState([]);
|
|
35
|
+
const [header, setHeader] = useState([]);
|
|
27
36
|
|
|
28
37
|
const configStyles = compereConfigs();
|
|
29
38
|
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setBody(dataBody);
|
|
41
|
+
}, [dataBody]);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setHeader(dataHeader);
|
|
45
|
+
}, [dataHeader]);
|
|
46
|
+
|
|
30
47
|
return (
|
|
31
48
|
<>
|
|
32
49
|
<table
|
|
33
50
|
style={{
|
|
34
|
-
width: '
|
|
51
|
+
width: '2000px',
|
|
35
52
|
borderCollapse: 'collapse'
|
|
36
53
|
}}
|
|
37
54
|
>
|
|
38
55
|
|
|
39
56
|
{
|
|
40
|
-
|
|
57
|
+
header && header.length > 0 && <thead>
|
|
41
58
|
<tr
|
|
42
59
|
style={{
|
|
43
60
|
color: tHeadColor ? tHeadColor : configStyles.TABLE.tHeadColor,
|
|
@@ -45,21 +62,19 @@ const Table = ({
|
|
|
45
62
|
}}
|
|
46
63
|
>
|
|
47
64
|
{
|
|
48
|
-
|
|
65
|
+
header.map((item, index) => {
|
|
49
66
|
return (
|
|
50
|
-
<
|
|
67
|
+
<TH
|
|
68
|
+
item={item}
|
|
51
69
|
key={`${item}_${index}`}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
>
|
|
61
|
-
{item.type === 'show' ? item.content : ''}
|
|
62
|
-
</th>
|
|
70
|
+
tHeadFamily={tHeadFamily ? tHeadFamily : configStyles.TABLE.tHeadFamily}
|
|
71
|
+
handleCheckedHeader={handleCheckedHeader ? handleCheckedHeader : _ => _}
|
|
72
|
+
tHeadPadding={tHeadPadding ? tHeadPadding : configStyles.TABLE.tHeadPadding}
|
|
73
|
+
handleHeaderItemClick={handleHeaderItemClick ? handleHeaderItemClick : _ => _}
|
|
74
|
+
tHeadFontWeight={tHeadFontWeight ? tHeadFontWeight : configStyles.TABLE.tHeadFontWeight}
|
|
75
|
+
borderTopLeftRadius={index === 0 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'}
|
|
76
|
+
borderTopRightRadius={index === header.length - 1 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'}
|
|
77
|
+
/>
|
|
63
78
|
)
|
|
64
79
|
})
|
|
65
80
|
}
|
|
@@ -68,87 +83,41 @@ const Table = ({
|
|
|
68
83
|
}
|
|
69
84
|
|
|
70
85
|
{
|
|
71
|
-
|
|
86
|
+
body && body.length > 0 && <tbody
|
|
72
87
|
style={{
|
|
73
|
-
overflow: 'auto',
|
|
74
88
|
boxShadow: '0px 10px 30px rgba(0, 35, 106, 0.06)'
|
|
75
89
|
}}
|
|
76
90
|
>
|
|
77
|
-
|
|
78
91
|
{
|
|
79
|
-
|
|
80
|
-
tableBodyItems.map((item, index) => {
|
|
81
|
-
const monst = Object.entries(item);
|
|
92
|
+
body.map((item, index) => {
|
|
82
93
|
return (
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
fontSize: tBodyFontSize ? tBodyFontSize : configStyles.TABLE.tBodyFontSize,
|
|
111
|
-
textAlign: tBodyTextAlign ? tBodyTextAlign : configStyles.TABLE.tBodyTextAlign,
|
|
112
|
-
fontFamily: tBodyFontFamily ? tBodyFontFamily : configStyles.TABLE.tBodyFontFamily,
|
|
113
|
-
fontWeight: tBodyFontWeight ? tBodyFontWeight : configStyles.TABLE.tBodyFontWeight,
|
|
114
|
-
borderRight: innerIndex === Object.values(item).length - 1 ? 'none' : configStyles.TABLE.tBodyRowBorder
|
|
115
|
-
}}
|
|
116
|
-
>
|
|
117
|
-
{
|
|
118
|
-
Array.isArray(innerItem)
|
|
119
|
-
? innerItem.length > 0
|
|
120
|
-
? innerItem.map((newItem, newIndex) => {
|
|
121
|
-
if (newItem && !Array.isArray(newItem) && typeof newItem === 'object') {
|
|
122
|
-
return Object.values(newItem).map((actionItem, actionIndex) => {
|
|
123
|
-
return (
|
|
124
|
-
<span
|
|
125
|
-
key={`${actionItem}_${actionIndex}`}
|
|
126
|
-
style={{
|
|
127
|
-
cursor: 'pointer'
|
|
128
|
-
}}
|
|
129
|
-
>
|
|
130
|
-
{ actionItem }
|
|
131
|
-
</span>
|
|
132
|
-
)
|
|
133
|
-
})
|
|
134
|
-
} else {
|
|
135
|
-
return <span
|
|
136
|
-
key={`${newItem}_${newIndex}`}
|
|
137
|
-
>
|
|
138
|
-
{newItem}
|
|
139
|
-
</span>
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
: ''
|
|
143
|
-
: innerItem
|
|
144
|
-
}
|
|
145
|
-
</td>
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
</tr>
|
|
151
|
-
</>
|
|
94
|
+
<tr
|
|
95
|
+
key={`${item}_${index}`}
|
|
96
|
+
style={{
|
|
97
|
+
borderBottom: index === body.length - 1 ? 'none' : tBodyRowBorder ? tBodyRowBorder : configStyles.TABLE.tBodyRowBorder
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
{
|
|
101
|
+
Object.values(item).map((innerItem, innerIndex) => {
|
|
102
|
+
return (
|
|
103
|
+
<TD
|
|
104
|
+
item={innerItem}
|
|
105
|
+
id={item.id ? item.id : ''}
|
|
106
|
+
key={`${innerItem}_${innerIndex}`}
|
|
107
|
+
handleCheckedBody={handleCheckedBody ? handleCheckedBody : _ => _}
|
|
108
|
+
tBodyColor={tBodyColor ? tBodyColor : configStyles.TABLE.tBodyColor}
|
|
109
|
+
tBodyPadding={tBodyPadding ? tBodyPadding : configStyles.TABLE.tBodyPadding}
|
|
110
|
+
handleBodyActionClick={handleBodyActionClick ? handleBodyActionClick : _ => _}
|
|
111
|
+
tBodyFontSize={tBodyFontSize ? tBodyFontSize : configStyles.TABLE.tBodyFontSize}
|
|
112
|
+
tBodyTextAlign={tBodyTextAlign ? tBodyTextAlign : configStyles.TABLE.tBodyTextAlign}
|
|
113
|
+
tBodyFontFamily={tBodyFontFamily ? tBodyFontFamily : configStyles.TABLE.tBodyFontFamily}
|
|
114
|
+
tBodyFontWeight={tBodyFontWeight ? tBodyFontWeight : configStyles.TABLE.tBodyFontWeight}
|
|
115
|
+
borderRight={innerIndex === Object.values(item).length - 1 ? 'none' : configStyles.TABLE.tBodyRowBorder}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
</tr>
|
|
152
121
|
)
|
|
153
122
|
})
|
|
154
123
|
}
|
|
@@ -160,8 +129,8 @@ const Table = ({
|
|
|
160
129
|
};
|
|
161
130
|
|
|
162
131
|
Table.propTypes = {
|
|
163
|
-
|
|
164
|
-
|
|
132
|
+
dataBody: PropTypes.array,
|
|
133
|
+
dataHeader: PropTypes.array,
|
|
165
134
|
|
|
166
135
|
tHeadColor: PropTypes.string,
|
|
167
136
|
tHeadFamily: PropTypes.string,
|
|
@@ -178,7 +147,11 @@ Table.propTypes = {
|
|
|
178
147
|
tBodyFontFamily: PropTypes.string,
|
|
179
148
|
|
|
180
149
|
tBodyRowBorder: PropTypes.string,
|
|
181
|
-
|
|
150
|
+
|
|
151
|
+
handleCheckedBody: PropTypes.func,
|
|
152
|
+
handleCheckedHeader: PropTypes.func,
|
|
153
|
+
handleHeaderItemClick: PropTypes.func,
|
|
154
|
+
handleBodyActionClick: PropTypes.func
|
|
182
155
|
};
|
|
183
156
|
|
|
184
157
|
export default Table;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.sorting-arrows::after {
|
|
2
|
+
content: "▲";
|
|
3
|
+
position: absolute;
|
|
4
|
+
right: 0px;
|
|
5
|
+
font-size: 11px;
|
|
6
|
+
top: calc(50% - 12px);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.sorting-arrows::before {
|
|
10
|
+
content: "▼";
|
|
11
|
+
position: absolute;
|
|
12
|
+
right: 0px;
|
|
13
|
+
font-size: 11px;
|
|
14
|
+
bottom: calc(50% - 12px);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.td-span {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: inline-block;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.td-span > svg {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0px;
|
|
26
|
+
left: 0px;
|
|
27
|
+
z-index: -1;
|
|
28
|
+
}
|