@xaypay/tui 0.0.81 → 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 +210 -135
- package/dist/index.js +210 -135
- package/package.json +1 -1
- 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 +26 -15
- package/src/components/modal/modal.stories.js +1 -1
- package/src/components/newAutocomplete/index.js +9 -5
- package/src/components/select/index.js +9 -2
- package/src/components/singleCheckbox/index.js +27 -5
- package/src/components/table/index.js +28 -11
- package/src/components/table/table.stories.js +382 -256
- package/src/components/table/td.js +26 -8
- package/src/components/table/th.js +28 -5
- 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 +17 -6
|
@@ -12,7 +12,7 @@ export const InputTypes = {
|
|
|
12
12
|
PASSWORD: "password",
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const P = styled.
|
|
15
|
+
const P = styled.span`
|
|
16
16
|
animation: ${props => props.errorAnimation ? props.animation : 'none'};
|
|
17
17
|
`;
|
|
18
18
|
|
|
@@ -33,6 +33,7 @@ export const Input = ({
|
|
|
33
33
|
leftIcon,
|
|
34
34
|
required,
|
|
35
35
|
disabled,
|
|
36
|
+
marginTop,
|
|
36
37
|
transform,
|
|
37
38
|
iconWidth,
|
|
38
39
|
rightIcon,
|
|
@@ -48,7 +49,6 @@ export const Input = ({
|
|
|
48
49
|
borderRight,
|
|
49
50
|
placeholder,
|
|
50
51
|
errorZindex,
|
|
51
|
-
errorBottom,
|
|
52
52
|
labelWeight,
|
|
53
53
|
phoneDisplay,
|
|
54
54
|
errorMessage,
|
|
@@ -112,10 +112,6 @@ export const Input = ({
|
|
|
112
112
|
if (!phoneNumberRegex.test(currentValue)) {
|
|
113
113
|
if (currentValue === '') {
|
|
114
114
|
setInnerErrorMessage('');
|
|
115
|
-
setInnerValue('');
|
|
116
|
-
if (change) {
|
|
117
|
-
change('');
|
|
118
|
-
}
|
|
119
115
|
} else {
|
|
120
116
|
telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(configStyles.INPUT.telErrorMessage);
|
|
121
117
|
setInnerValue(prevValue);
|
|
@@ -130,11 +126,6 @@ export const Input = ({
|
|
|
130
126
|
if (change) {
|
|
131
127
|
change(currentValue.substr(0, 8));
|
|
132
128
|
}
|
|
133
|
-
} else {
|
|
134
|
-
setInnerValue(currentValue);
|
|
135
|
-
if (change) {
|
|
136
|
-
change(currentValue);
|
|
137
|
-
}
|
|
138
129
|
}
|
|
139
130
|
}
|
|
140
131
|
}
|
|
@@ -181,16 +172,14 @@ export const Input = ({
|
|
|
181
172
|
} else {
|
|
182
173
|
telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(configStyles.INPUT.telErrorMessage);
|
|
183
174
|
}
|
|
184
|
-
setInnerValue('');
|
|
185
175
|
} else {
|
|
186
|
-
|
|
187
|
-
|
|
176
|
+
if (value.length < 8) {
|
|
177
|
+
telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(configStyles.INPUT.telErrorMessage);
|
|
178
|
+
} else if (value.length > 8) {
|
|
188
179
|
setInnerValue(value.substr(0, 8));
|
|
189
|
-
} else {
|
|
190
|
-
setInnerValue(value);
|
|
191
180
|
}
|
|
192
181
|
}
|
|
193
|
-
}
|
|
182
|
+
}
|
|
194
183
|
|
|
195
184
|
if (maxLength && value.length > maxLength && type !== 'tel') {
|
|
196
185
|
setInnerValue(value.substr(0, maxLength));
|
|
@@ -301,8 +290,8 @@ export const Input = ({
|
|
|
301
290
|
padding: padding ? padding : configStyles.INPUT.padding,
|
|
302
291
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
303
292
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
304
|
-
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
305
293
|
color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
294
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
306
295
|
}}
|
|
307
296
|
/>
|
|
308
297
|
{
|
|
@@ -336,13 +325,14 @@ export const Input = ({
|
|
|
336
325
|
animation={animation}
|
|
337
326
|
style={{
|
|
338
327
|
margin: '0px',
|
|
328
|
+
position: 'absolute',
|
|
329
|
+
width: width ? width : configStyles.INPUT.width,
|
|
339
330
|
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
340
331
|
color: errorColor ? errorColor : configStyles.INPUT.errorColor,
|
|
341
332
|
fontSize: errorSize ? errorSize : configStyles.INPUT.errorSize,
|
|
342
|
-
bottom: errorBottom ? errorBottom : configStyles.INPUT.errorBottom,
|
|
343
333
|
zIndex: errorZindex ? errorZindex : configStyles.INPUT.errorZindex,
|
|
344
|
-
position: errorPosition ? errorPosition : configStyles.INPUT.errorPosition,
|
|
345
334
|
lineHeight: errorLineHeight ? errorLineHeight : configStyles.INPUT.errorLineHeight,
|
|
335
|
+
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
346
336
|
transform: !errorAnimation ? 'scale3d(1,1,1)' : transform ? transform : configStyles.INPUT.transform,
|
|
347
337
|
}}
|
|
348
338
|
className={errorClassName ? errorClassName : configStyles.INPUT.errorClassName}
|
|
@@ -368,6 +358,7 @@ Input.propTypes = {
|
|
|
368
358
|
padding: PropTypes.string,
|
|
369
359
|
fontSize: PropTypes.string,
|
|
370
360
|
tooltip: PropTypes.element,
|
|
361
|
+
marginTop: PropTypes.string,
|
|
371
362
|
transform: PropTypes.string,
|
|
372
363
|
className: PropTypes.string,
|
|
373
364
|
iconWidth: PropTypes.string,
|
|
@@ -382,7 +373,6 @@ Input.propTypes = {
|
|
|
382
373
|
borderRight: PropTypes.string,
|
|
383
374
|
placeholder: PropTypes.string,
|
|
384
375
|
errorZindex: PropTypes.string,
|
|
385
|
-
errorBottom: PropTypes.string,
|
|
386
376
|
labelWeight: PropTypes.string,
|
|
387
377
|
errorMessage: PropTypes.string,
|
|
388
378
|
phoneDisplay: PropTypes.string,
|
|
@@ -13,7 +13,9 @@ import SvgCloseSlide from './../icon/CloseSlide';
|
|
|
13
13
|
export const Modal = ({
|
|
14
14
|
type,
|
|
15
15
|
data,
|
|
16
|
+
width,
|
|
16
17
|
radius,
|
|
18
|
+
height,
|
|
17
19
|
padding,
|
|
18
20
|
setShow,
|
|
19
21
|
selected,
|
|
@@ -21,13 +23,18 @@ export const Modal = ({
|
|
|
21
23
|
minWidth,
|
|
22
24
|
minHeight,
|
|
23
25
|
className,
|
|
26
|
+
mMaxWidth,
|
|
27
|
+
alignItems,
|
|
28
|
+
mMaxHeight,
|
|
24
29
|
headerText,
|
|
25
30
|
imageWidth,
|
|
26
31
|
headerSize,
|
|
27
32
|
imageHeight,
|
|
28
33
|
headerColor,
|
|
34
|
+
outsideClose,
|
|
29
35
|
headerWeight,
|
|
30
36
|
headerHeight,
|
|
37
|
+
justifyContent,
|
|
31
38
|
backgroundColor,
|
|
32
39
|
layerBackgroundColor,
|
|
33
40
|
}) => {
|
|
@@ -45,8 +52,7 @@ export const Modal = ({
|
|
|
45
52
|
e.stopPropagation();
|
|
46
53
|
};
|
|
47
54
|
|
|
48
|
-
const handleGoTo = (
|
|
49
|
-
const goTo = e.target.getAttribute('data-go');
|
|
55
|
+
const handleGoTo = (goTo) => {
|
|
50
56
|
if (goTo === 'next') {
|
|
51
57
|
if (select >= data.length - 1) {
|
|
52
58
|
setSelect(0);
|
|
@@ -97,7 +103,7 @@ export const Modal = ({
|
|
|
97
103
|
|
|
98
104
|
return (
|
|
99
105
|
<div
|
|
100
|
-
onClick={handleCloseModal}
|
|
106
|
+
onClick={outsideClose || configStyles.MODAL.outsideClose ? handleCloseModal : _ => _}
|
|
101
107
|
style={{
|
|
102
108
|
top: '0px',
|
|
103
109
|
left: '0px',
|
|
@@ -114,25 +120,25 @@ export const Modal = ({
|
|
|
114
120
|
display: 'flex',
|
|
115
121
|
width: '100%',
|
|
116
122
|
height: '100vh',
|
|
117
|
-
alignItems:
|
|
118
|
-
justifyContent:
|
|
123
|
+
alignItems: alignItems ? alignItems : configStyles.MODAL.alignItems,
|
|
124
|
+
justifyContent: justifyContent ? justifyContent : configStyles.MODAL.justifyContent
|
|
119
125
|
}}
|
|
120
126
|
>
|
|
121
127
|
<div
|
|
122
128
|
className={`${classProps} ${styles['animation__modal']}`}
|
|
123
129
|
onClick={handleStopClosing}
|
|
124
130
|
style={{
|
|
125
|
-
maxWidth: '95%',
|
|
126
131
|
overflow: 'auto',
|
|
127
|
-
maxHeight: '95vh',
|
|
128
|
-
width: 'fit-content',
|
|
129
|
-
height: 'fit-content',
|
|
130
132
|
boxSizing: 'border-box',
|
|
133
|
+
width: width ? width : configStyles.MODAL.width,
|
|
134
|
+
height: height ? height : configStyles.MODAL.height,
|
|
131
135
|
borderRadius: radius ? radius : configStyles.MODAL.radius,
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
maxWidth: mMaxWidth ? mMaxWidth : configStyles.MODAL.mMaxWidth,
|
|
137
|
+
maxHeight: mMaxHeight ? mMaxHeight : configStyles.MODAL.mMaxHeight,
|
|
138
|
+
minWidth: type === 'content' ? minWidth ? minWidth : configStyles.MODAL.minWidth : '',
|
|
134
139
|
padding: type === 'content' ? padding ? padding : configStyles.MODAL.padding : '10px',
|
|
135
140
|
backgroundColor: backgroundColor ? backgroundColor : configStyles.MODAL.backgroundColor,
|
|
141
|
+
minHeight: type === 'content' ? minHeight ? minHeight : configStyles.MODAL.minHeight : '',
|
|
136
142
|
}}
|
|
137
143
|
>
|
|
138
144
|
<div
|
|
@@ -246,8 +252,7 @@ export const Modal = ({
|
|
|
246
252
|
{
|
|
247
253
|
innerData && innerData.length > 1 && <>
|
|
248
254
|
<button
|
|
249
|
-
onClick={handleGoTo}
|
|
250
|
-
data-go='prev'
|
|
255
|
+
onClick={_ => handleGoTo('prev')}
|
|
251
256
|
style={{
|
|
252
257
|
position: 'absolute',
|
|
253
258
|
left: '14px',
|
|
@@ -264,8 +269,7 @@ export const Modal = ({
|
|
|
264
269
|
<SvgPrev />
|
|
265
270
|
</button>
|
|
266
271
|
<button
|
|
267
|
-
onClick={handleGoTo}
|
|
268
|
-
data-go='next'
|
|
272
|
+
onClick={_ => handleGoTo('next')}
|
|
269
273
|
style={{
|
|
270
274
|
position: 'absolute',
|
|
271
275
|
width: '24px',
|
|
@@ -297,19 +301,26 @@ Modal.propTypes = {
|
|
|
297
301
|
data: PropTypes.array,
|
|
298
302
|
type: PropTypes.string,
|
|
299
303
|
setShow: PropTypes.func,
|
|
304
|
+
width: PropTypes.string,
|
|
300
305
|
radius: PropTypes.string,
|
|
306
|
+
height: PropTypes.string,
|
|
301
307
|
padding: PropTypes.string,
|
|
302
308
|
selected: PropTypes.number,
|
|
303
309
|
minWidth: PropTypes.string,
|
|
310
|
+
mMaxWidth: PropTypes.string,
|
|
304
311
|
minHeight: PropTypes.string,
|
|
305
312
|
className: PropTypes.string,
|
|
313
|
+
alignItems: PropTypes.string,
|
|
314
|
+
mMaxHeight: PropTypes.string,
|
|
306
315
|
headerText: PropTypes.string,
|
|
307
316
|
imageWidth: PropTypes.string,
|
|
308
317
|
headerSize: PropTypes.string,
|
|
318
|
+
outsideClose: PropTypes.bool,
|
|
309
319
|
headerColor: PropTypes.string,
|
|
310
320
|
imageHeight: PropTypes.string,
|
|
311
321
|
headerWeight: PropTypes.string,
|
|
312
322
|
headerHeight: PropTypes.string,
|
|
323
|
+
justifyContent: PropTypes.string,
|
|
313
324
|
backgroundColor: PropTypes.string,
|
|
314
325
|
layerBackgroundColor: PropTypes.string,
|
|
315
326
|
};
|
|
@@ -55,7 +55,7 @@ const Template = ({ headerText, className }) => {
|
|
|
55
55
|
style={{ cursor: 'pointer', padding: '8px', fontSize: '16px' }}
|
|
56
56
|
>Change type to {type === 'content' ? 'images' : 'content'}</button>
|
|
57
57
|
{show && (
|
|
58
|
-
<Modal type={type} selected={0} data={data} setShow={setShow}
|
|
58
|
+
<Modal type={type} selected={0} data={data} setShow={setShow} className={className}>
|
|
59
59
|
<p>
|
|
60
60
|
Children content
|
|
61
61
|
</p>
|
|
@@ -15,6 +15,7 @@ export const NewAutocomplete = ({
|
|
|
15
15
|
selected,
|
|
16
16
|
errorSize,
|
|
17
17
|
labelSize,
|
|
18
|
+
marginTop,
|
|
18
19
|
errorColor,
|
|
19
20
|
labelColor,
|
|
20
21
|
labelWeight,
|
|
@@ -209,11 +210,12 @@ export const NewAutocomplete = ({
|
|
|
209
210
|
</div>
|
|
210
211
|
: innerOptions.length <= 0
|
|
211
212
|
?
|
|
212
|
-
<
|
|
213
|
+
<span
|
|
213
214
|
style={{
|
|
214
|
-
|
|
215
|
+
position: 'absolute',
|
|
215
216
|
color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
|
|
216
217
|
fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
|
|
218
|
+
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
217
219
|
height: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
|
|
218
220
|
padding: contentBottomRowPadding ? contentBottomRowPadding : configStyles.NEWAUTOCOMPLETE.contentBottomRowPadding,
|
|
219
221
|
lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
|
|
@@ -225,7 +227,7 @@ export const NewAutocomplete = ({
|
|
|
225
227
|
? 'Նման տվյալ առկա չէ'
|
|
226
228
|
: `Լրացնել առնվազն ${searchCount} նիշ`
|
|
227
229
|
}
|
|
228
|
-
</
|
|
230
|
+
</span>
|
|
229
231
|
: ''
|
|
230
232
|
: ''
|
|
231
233
|
}
|
|
@@ -339,10 +341,11 @@ export const NewAutocomplete = ({
|
|
|
339
341
|
errorMessage
|
|
340
342
|
? <span
|
|
341
343
|
style={{
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
left: '0px',
|
|
345
|
+
position: 'absolute',
|
|
344
346
|
color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
|
|
345
347
|
fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
|
|
348
|
+
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
346
349
|
maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
|
|
347
350
|
}}
|
|
348
351
|
>
|
|
@@ -365,6 +368,7 @@ NewAutocomplete.propTypes = {
|
|
|
365
368
|
disabled: PropTypes.bool,
|
|
366
369
|
selected: PropTypes.string,
|
|
367
370
|
errorSize: PropTypes.string,
|
|
371
|
+
marginTop: PropTypes.string,
|
|
368
372
|
labelSize: PropTypes.string,
|
|
369
373
|
errorColor: PropTypes.string,
|
|
370
374
|
labelColor: PropTypes.string,
|
|
@@ -18,8 +18,10 @@ export const Select = ({
|
|
|
18
18
|
keyNames,
|
|
19
19
|
selected,
|
|
20
20
|
className,
|
|
21
|
+
marginTop,
|
|
21
22
|
arrowIcon,
|
|
22
23
|
closeIcon,
|
|
24
|
+
errorZindex,
|
|
23
25
|
errorMessage,
|
|
24
26
|
defaultOption,
|
|
25
27
|
multipleCheckbox,
|
|
@@ -198,7 +200,7 @@ export const Select = ({
|
|
|
198
200
|
}, [options, multiple, selected, selected?.length]);
|
|
199
201
|
|
|
200
202
|
return (
|
|
201
|
-
<div className={classProps}>
|
|
203
|
+
<div className={classProps} style={{ position: 'relative' }}>
|
|
202
204
|
{
|
|
203
205
|
label ?
|
|
204
206
|
<label
|
|
@@ -338,8 +340,11 @@ export const Select = ({
|
|
|
338
340
|
errorMessage ?
|
|
339
341
|
<span
|
|
340
342
|
style={{
|
|
343
|
+
position: 'absolute',
|
|
341
344
|
color: errorColor ? errorColor : configStyles.SELECT.errorColor,
|
|
342
|
-
fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize
|
|
345
|
+
fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize,
|
|
346
|
+
zIndex: errorZindex ? errorZindex : configStyles.SELECT.errorZindex,
|
|
347
|
+
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`
|
|
343
348
|
}}
|
|
344
349
|
>
|
|
345
350
|
{errorMessage}
|
|
@@ -358,9 +363,11 @@ Select.propTypes = {
|
|
|
358
363
|
disabled: PropTypes.bool,
|
|
359
364
|
selected: PropTypes.array,
|
|
360
365
|
keyNames: PropTypes.object,
|
|
366
|
+
marginTop: PropTypes.string,
|
|
361
367
|
className: PropTypes.string,
|
|
362
368
|
arrowIcon: PropTypes.element,
|
|
363
369
|
closeIcon: PropTypes.element,
|
|
370
|
+
errorZindex: PropTypes.number,
|
|
364
371
|
errorMessage: PropTypes.string,
|
|
365
372
|
defaultOption: PropTypes.string,
|
|
366
373
|
multipleCheckbox: PropTypes.bool,
|
|
@@ -1,20 +1,42 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
import ReactCheckbox from '../icon/CheckboxUnchecked';
|
|
5
5
|
import ReactCheckboxChecked from '../icon/CheckboxChecked';
|
|
6
6
|
|
|
7
|
-
export const SingleCheckbox = ({
|
|
7
|
+
export const SingleCheckbox = ({
|
|
8
|
+
id,
|
|
9
|
+
float,
|
|
10
|
+
checked,
|
|
11
|
+
onClick,
|
|
12
|
+
content,
|
|
13
|
+
disabled,
|
|
14
|
+
checkedColor,
|
|
15
|
+
unCheckedColor
|
|
16
|
+
}) => {
|
|
17
|
+
const [innerCheckd, setInnerChecked] = useState(false);
|
|
8
18
|
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setInnerChecked(checked);
|
|
21
|
+
}, [checked]);
|
|
9
22
|
return <div
|
|
10
23
|
style={{
|
|
11
|
-
|
|
24
|
+
width: '16px',
|
|
25
|
+
height: '16px',
|
|
26
|
+
marginRight: '9px',
|
|
27
|
+
display: 'inline-block',
|
|
28
|
+
float: float ? float : '',
|
|
29
|
+
cursor: !disabled && onClick ? 'pointer' : 'normal'
|
|
12
30
|
}}
|
|
13
31
|
>
|
|
14
|
-
{
|
|
32
|
+
{ innerCheckd
|
|
33
|
+
? <ReactCheckboxChecked onClick={!disabled && onClick ? (e) => onClick(e, content, id) : _ => _} fillColor={checkedColor ? checkedColor : ''} />
|
|
34
|
+
: <ReactCheckbox onClick={!disabled && onClick ? (e) => onClick(e, content, id) : _ => _} fillColor={unCheckedColor ? unCheckedColor : ''} />
|
|
35
|
+
}
|
|
15
36
|
</div>;
|
|
16
37
|
};
|
|
17
38
|
|
|
18
39
|
SingleCheckbox.propTypes = {
|
|
19
|
-
|
|
40
|
+
disabled: PropTypes.bool,
|
|
41
|
+
checked: PropTypes.bool.isRequired,
|
|
20
42
|
}
|
|
@@ -7,7 +7,8 @@ import TD from './td';
|
|
|
7
7
|
import { compereConfigs } from './../../utils';
|
|
8
8
|
|
|
9
9
|
const Table = ({
|
|
10
|
-
|
|
10
|
+
dataBody,
|
|
11
|
+
dataHeader,
|
|
11
12
|
|
|
12
13
|
tHeadColor,
|
|
13
14
|
tHeadFamily,
|
|
@@ -23,7 +24,12 @@ const Table = ({
|
|
|
23
24
|
tBodyFontWeight,
|
|
24
25
|
tBodyFontFamily,
|
|
25
26
|
|
|
26
|
-
tBodyRowBorder
|
|
27
|
+
tBodyRowBorder,
|
|
28
|
+
|
|
29
|
+
handleCheckedBody,
|
|
30
|
+
handleCheckedHeader,
|
|
31
|
+
handleHeaderItemClick,
|
|
32
|
+
handleBodyActionClick
|
|
27
33
|
}) => {
|
|
28
34
|
const [body, setBody] = useState([]);
|
|
29
35
|
const [header, setHeader] = useState([]);
|
|
@@ -31,24 +37,24 @@ const Table = ({
|
|
|
31
37
|
const configStyles = compereConfigs();
|
|
32
38
|
|
|
33
39
|
useEffect(() => {
|
|
34
|
-
setBody(
|
|
35
|
-
}, [
|
|
40
|
+
setBody(dataBody);
|
|
41
|
+
}, [dataBody]);
|
|
36
42
|
|
|
37
43
|
useEffect(() => {
|
|
38
|
-
setHeader(
|
|
39
|
-
}, [
|
|
44
|
+
setHeader(dataHeader);
|
|
45
|
+
}, [dataHeader]);
|
|
40
46
|
|
|
41
47
|
return (
|
|
42
48
|
<>
|
|
43
49
|
<table
|
|
44
50
|
style={{
|
|
45
|
-
width: '
|
|
51
|
+
width: '2000px',
|
|
46
52
|
borderCollapse: 'collapse'
|
|
47
53
|
}}
|
|
48
54
|
>
|
|
49
55
|
|
|
50
56
|
{
|
|
51
|
-
header && header
|
|
57
|
+
header && header.length > 0 && <thead>
|
|
52
58
|
<tr
|
|
53
59
|
style={{
|
|
54
60
|
color: tHeadColor ? tHeadColor : configStyles.TABLE.tHeadColor,
|
|
@@ -62,7 +68,9 @@ const Table = ({
|
|
|
62
68
|
item={item}
|
|
63
69
|
key={`${item}_${index}`}
|
|
64
70
|
tHeadFamily={tHeadFamily ? tHeadFamily : configStyles.TABLE.tHeadFamily}
|
|
71
|
+
handleCheckedHeader={handleCheckedHeader ? handleCheckedHeader : _ => _}
|
|
65
72
|
tHeadPadding={tHeadPadding ? tHeadPadding : configStyles.TABLE.tHeadPadding}
|
|
73
|
+
handleHeaderItemClick={handleHeaderItemClick ? handleHeaderItemClick : _ => _}
|
|
66
74
|
tHeadFontWeight={tHeadFontWeight ? tHeadFontWeight : configStyles.TABLE.tHeadFontWeight}
|
|
67
75
|
borderTopLeftRadius={index === 0 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'}
|
|
68
76
|
borderTopRightRadius={index === header.length - 1 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'}
|
|
@@ -75,7 +83,7 @@ const Table = ({
|
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
{
|
|
78
|
-
body && body
|
|
86
|
+
body && body.length > 0 && <tbody
|
|
79
87
|
style={{
|
|
80
88
|
boxShadow: '0px 10px 30px rgba(0, 35, 106, 0.06)'
|
|
81
89
|
}}
|
|
@@ -94,9 +102,12 @@ const Table = ({
|
|
|
94
102
|
return (
|
|
95
103
|
<TD
|
|
96
104
|
item={innerItem}
|
|
105
|
+
id={item.id ? item.id : ''}
|
|
97
106
|
key={`${innerItem}_${innerIndex}`}
|
|
107
|
+
handleCheckedBody={handleCheckedBody ? handleCheckedBody : _ => _}
|
|
98
108
|
tBodyColor={tBodyColor ? tBodyColor : configStyles.TABLE.tBodyColor}
|
|
99
109
|
tBodyPadding={tBodyPadding ? tBodyPadding : configStyles.TABLE.tBodyPadding}
|
|
110
|
+
handleBodyActionClick={handleBodyActionClick ? handleBodyActionClick : _ => _}
|
|
100
111
|
tBodyFontSize={tBodyFontSize ? tBodyFontSize : configStyles.TABLE.tBodyFontSize}
|
|
101
112
|
tBodyTextAlign={tBodyTextAlign ? tBodyTextAlign : configStyles.TABLE.tBodyTextAlign}
|
|
102
113
|
tBodyFontFamily={tBodyFontFamily ? tBodyFontFamily : configStyles.TABLE.tBodyFontFamily}
|
|
@@ -118,7 +129,8 @@ const Table = ({
|
|
|
118
129
|
};
|
|
119
130
|
|
|
120
131
|
Table.propTypes = {
|
|
121
|
-
|
|
132
|
+
dataBody: PropTypes.array,
|
|
133
|
+
dataHeader: PropTypes.array,
|
|
122
134
|
|
|
123
135
|
tHeadColor: PropTypes.string,
|
|
124
136
|
tHeadFamily: PropTypes.string,
|
|
@@ -134,7 +146,12 @@ Table.propTypes = {
|
|
|
134
146
|
tBodyFontWeight: PropTypes.string,
|
|
135
147
|
tBodyFontFamily: PropTypes.string,
|
|
136
148
|
|
|
137
|
-
tBodyRowBorder: PropTypes.string
|
|
149
|
+
tBodyRowBorder: PropTypes.string,
|
|
150
|
+
|
|
151
|
+
handleCheckedBody: PropTypes.func,
|
|
152
|
+
handleCheckedHeader: PropTypes.func,
|
|
153
|
+
handleHeaderItemClick: PropTypes.func,
|
|
154
|
+
handleBodyActionClick: PropTypes.func
|
|
138
155
|
};
|
|
139
156
|
|
|
140
157
|
export default Table;
|