@xaypay/tui 0.0.110 → 0.0.112
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 +185 -46
- package/dist/index.js +185 -46
- package/package.json +1 -1
- package/src/components/singleCheckbox/Checkbox.js +12 -1
- package/src/components/singleCheckbox/index.js +6 -0
- package/src/components/table/index.js +121 -15
- package/src/components/table/table.stories.js +25 -14
- package/src/components/table/td.js +68 -26
- package/src/components/textarea/index.js +4 -0
- package/src/stories/configuration.stories.mdx +0 -1
- package/src/stories/static/table-body-data-structure-first-part-usage.png +0 -0
- package/src/stories/static/table-body-data-structure-second-part-usage.png +0 -0
- package/src/stories/static/table-body-data-structure-third-part-usage.png +0 -0
- package/src/stories/static/table-component-usage.png +0 -0
- package/src/stories/static/table-header-data-structure-usage.png +0 -0
- package/src/stories/usage.stories.mdx +12 -0
- package/tui.config.js +0 -1
package/dist/index.js
CHANGED
|
@@ -299,9 +299,11 @@ const SvgCheckboxChecked = ({
|
|
|
299
299
|
|
|
300
300
|
const Checkbox$1 = ({
|
|
301
301
|
data,
|
|
302
|
+
index,
|
|
302
303
|
styles,
|
|
303
304
|
checked,
|
|
304
305
|
disabled,
|
|
306
|
+
innerIndex,
|
|
305
307
|
checkedColor,
|
|
306
308
|
handleChecked,
|
|
307
309
|
unCheckedColor,
|
|
@@ -311,7 +313,11 @@ const Checkbox$1 = ({
|
|
|
311
313
|
const [innerChecked, setInnerChecked] = React.useState(false);
|
|
312
314
|
const [innerDisabled, setInnerDisabled] = React.useState(false);
|
|
313
315
|
const handleClick = e => {
|
|
314
|
-
|
|
316
|
+
if (index !== undefined && innerIndex !== undefined && typeof index === 'number' && typeof innerIndex === 'number') {
|
|
317
|
+
handleChecked(data, e, index, innerIndex);
|
|
318
|
+
} else {
|
|
319
|
+
handleChecked(data, e);
|
|
320
|
+
}
|
|
315
321
|
};
|
|
316
322
|
React.useEffect(() => {
|
|
317
323
|
setInnerDisabled(disabled);
|
|
@@ -338,9 +344,11 @@ const Checkbox$1 = ({
|
|
|
338
344
|
|
|
339
345
|
const SingleCheckbox = ({
|
|
340
346
|
data,
|
|
347
|
+
index,
|
|
341
348
|
styles,
|
|
342
349
|
checked,
|
|
343
350
|
disabled,
|
|
351
|
+
innerIndex,
|
|
344
352
|
checkedColor,
|
|
345
353
|
handleChecked,
|
|
346
354
|
unCheckedColor,
|
|
@@ -360,10 +368,12 @@ const SingleCheckbox = ({
|
|
|
360
368
|
setInnerData(data);
|
|
361
369
|
}, [data]);
|
|
362
370
|
return /*#__PURE__*/React__default["default"].createElement(Checkbox$1, {
|
|
371
|
+
index: index,
|
|
363
372
|
styles: styles,
|
|
364
373
|
data: innerData,
|
|
365
374
|
checked: checked,
|
|
366
375
|
disabled: disabled,
|
|
376
|
+
innerIndex: innerIndex,
|
|
367
377
|
checkedColor: checkedColor,
|
|
368
378
|
handleChecked: handleChecked,
|
|
369
379
|
unCheckedColor: unCheckedColor,
|
|
@@ -373,8 +383,10 @@ const SingleCheckbox = ({
|
|
|
373
383
|
SingleCheckbox.propTypes = {
|
|
374
384
|
data: PropTypes__default["default"].object,
|
|
375
385
|
onClick: PropTypes__default["default"].func,
|
|
386
|
+
index: PropTypes__default["default"].number,
|
|
376
387
|
styles: PropTypes__default["default"].object,
|
|
377
388
|
disabled: PropTypes__default["default"].bool,
|
|
389
|
+
innerIndex: PropTypes__default["default"].number,
|
|
378
390
|
checkedColor: PropTypes__default["default"].string,
|
|
379
391
|
unCheckedColor: PropTypes__default["default"].string,
|
|
380
392
|
ignoreDisabledForChecked: PropTypes__default["default"].bool
|
|
@@ -449,9 +461,21 @@ const TD = ({
|
|
|
449
461
|
handleCheckDots,
|
|
450
462
|
handleCheckedBody,
|
|
451
463
|
handleBodyActionClick,
|
|
464
|
+
handleMoreOptionsClick,
|
|
465
|
+
handleContentListClick,
|
|
452
466
|
handleCheckArrowAction,
|
|
453
467
|
handleOpenCloseRowSingleArrow
|
|
454
468
|
}) => {
|
|
469
|
+
const handleBodyAction = (e, data) => {
|
|
470
|
+
const actionData = {
|
|
471
|
+
index,
|
|
472
|
+
innerIndex,
|
|
473
|
+
items: item,
|
|
474
|
+
item: data.item,
|
|
475
|
+
itemIndex: data.itemIndex
|
|
476
|
+
};
|
|
477
|
+
handleBodyActionClick(e, actionData);
|
|
478
|
+
};
|
|
455
479
|
return /*#__PURE__*/React__default["default"].createElement("td", {
|
|
456
480
|
style: {
|
|
457
481
|
width: 'auto',
|
|
@@ -464,7 +488,7 @@ const TD = ({
|
|
|
464
488
|
textAlign: tBodyTextAlign,
|
|
465
489
|
fontFamily: tBodyFontFamily,
|
|
466
490
|
fontWeight: tBodyFontWeight,
|
|
467
|
-
boxShadow: item
|
|
491
|
+
boxShadow: Object.prototype.hasOwnProperty.call(item, 'colorStatus') ? `inset 3px 0px 0px 0px ${item.colorStatus}` : ''
|
|
468
492
|
}
|
|
469
493
|
}, Array.isArray(item) ? item.length > 0 ? item.map((newItem, newIndex) => {
|
|
470
494
|
if (newItem && !Array.isArray(newItem) && typeof newItem === 'object') {
|
|
@@ -479,10 +503,9 @@ const TD = ({
|
|
|
479
503
|
type: newItem.type,
|
|
480
504
|
className: styles$c['td-span'],
|
|
481
505
|
key: `${newItem.id}_${newIndex}`,
|
|
482
|
-
onClick: Object.prototype.hasOwnProperty.call(newItem, 'type') ? e =>
|
|
483
|
-
item,
|
|
484
|
-
|
|
485
|
-
innerIndex
|
|
506
|
+
onClick: Object.prototype.hasOwnProperty.call(newItem, 'type') ? e => handleBodyAction(e, {
|
|
507
|
+
item: newItem,
|
|
508
|
+
itemIndex: newIndex
|
|
486
509
|
}) : _ => _
|
|
487
510
|
}, newItem.content);
|
|
488
511
|
} else if (newItem && Array.isArray(newItem)) {
|
|
@@ -504,10 +527,7 @@ const TD = ({
|
|
|
504
527
|
id: iT.id ? iT.id : '',
|
|
505
528
|
type: iT.type ? iT.type : '',
|
|
506
529
|
className: styles$c['td-span'],
|
|
507
|
-
onClick: Object.prototype.hasOwnProperty.call(iT, 'type') ? e =>
|
|
508
|
-
index,
|
|
509
|
-
innerIndex,
|
|
510
|
-
items: item,
|
|
530
|
+
onClick: Object.prototype.hasOwnProperty.call(iT, 'type') ? e => handleBodyAction(e, {
|
|
511
531
|
item: iT,
|
|
512
532
|
itemIndex: iN
|
|
513
533
|
}) : _ => _,
|
|
@@ -523,20 +543,23 @@ const TD = ({
|
|
|
523
543
|
style: {
|
|
524
544
|
display: 'flex',
|
|
525
545
|
alignItems: 'flex-start',
|
|
526
|
-
justifyContent: item
|
|
546
|
+
justifyContent: Object.prototype.hasOwnProperty.call(item, 'contentList') || Object.prototype.hasOwnProperty.call(item, 'checkBox') ? 'space-between' : 'center'
|
|
527
547
|
}
|
|
528
|
-
}, item
|
|
548
|
+
}, Object.prototype.hasOwnProperty.call(item, 'contentList') && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
529
549
|
id: item.id,
|
|
530
550
|
style: {
|
|
531
551
|
width: '21px',
|
|
532
|
-
height: '21px'
|
|
552
|
+
height: '21px',
|
|
553
|
+
cursor: 'pointer'
|
|
533
554
|
},
|
|
534
555
|
onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex),
|
|
535
556
|
className: styles$c['td-span']
|
|
536
|
-
}, item.status === 'close' ? item.closeArrow : item.openArrow), item
|
|
557
|
+
}, item.status === 'close' ? item.closeArrow : item.openArrow), Object.prototype.hasOwnProperty.call(item, 'checkBox') && /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
|
|
537
558
|
data: item,
|
|
538
|
-
|
|
559
|
+
index: index,
|
|
560
|
+
innerIndex: innerIndex,
|
|
539
561
|
checked: item.checkBox.checked,
|
|
562
|
+
handleChecked: handleCheckedBody,
|
|
540
563
|
disabled: item.checkBox.disabled,
|
|
541
564
|
checkedColor: item.checkBox.checkedColor,
|
|
542
565
|
unCheckedColor: item.checkBox.unCheckedColor
|
|
@@ -560,6 +583,7 @@ const TD = ({
|
|
|
560
583
|
position: 'absolute',
|
|
561
584
|
display: item.dotsStatus === 'deActive' ? 'none' : 'block',
|
|
562
585
|
top: '0px',
|
|
586
|
+
zIndex: 100,
|
|
563
587
|
right: 'calc(100% + 6px)',
|
|
564
588
|
width: '223px',
|
|
565
589
|
height: 'auto',
|
|
@@ -570,21 +594,28 @@ const TD = ({
|
|
|
570
594
|
backgroundColor: '#FFFFFF',
|
|
571
595
|
boxShadow: '0px 0px 20px 0px #3C393E4D'
|
|
572
596
|
}
|
|
573
|
-
}, item
|
|
597
|
+
}, Object.prototype.hasOwnProperty.call(item, 'options') && item.options.map((optionItem, optionIndex) => {
|
|
574
598
|
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
575
|
-
key: `${
|
|
599
|
+
key: `${optionItem.content}_${optionIndex}`,
|
|
576
600
|
className: styles$c['dots-option-item'],
|
|
577
601
|
style: {
|
|
578
602
|
color: '#3C393E',
|
|
579
603
|
fontSize: '14px',
|
|
580
604
|
fontFamily: 'Noto Sans Armenian'
|
|
581
|
-
}
|
|
582
|
-
|
|
605
|
+
},
|
|
606
|
+
onClick: () => handleMoreOptionsClick({
|
|
607
|
+
item,
|
|
608
|
+
index,
|
|
609
|
+
optionItem,
|
|
610
|
+
innerIndex,
|
|
611
|
+
optionIndex,
|
|
612
|
+
options: item.options
|
|
613
|
+
})
|
|
583
614
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
584
615
|
style: {
|
|
585
616
|
marginRight: '10px'
|
|
586
617
|
}
|
|
587
|
-
},
|
|
618
|
+
}, optionItem.icon), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
588
619
|
style: {
|
|
589
620
|
width: 'calc(100% - 36px)',
|
|
590
621
|
textAlign: 'left',
|
|
@@ -592,23 +623,33 @@ const TD = ({
|
|
|
592
623
|
whiteSpace: 'nowrap',
|
|
593
624
|
textOverflow: 'ellipsis'
|
|
594
625
|
},
|
|
595
|
-
title:
|
|
596
|
-
},
|
|
597
|
-
}))) : ''), item
|
|
626
|
+
title: optionItem.content
|
|
627
|
+
}, optionItem.content));
|
|
628
|
+
}))) : ''), Object.prototype.hasOwnProperty.call(item, 'contentList') && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
598
629
|
style: {
|
|
599
|
-
overflow: '
|
|
630
|
+
overflow: 'auto',
|
|
600
631
|
marginTop: '10px',
|
|
632
|
+
maxHeight: '300px',
|
|
633
|
+
maxWidth: '100%',
|
|
601
634
|
height: item.status === 'close' ? '0px' : 'auto'
|
|
602
635
|
}
|
|
603
|
-
}, item.contentList.map((innerItem,
|
|
636
|
+
}, item.contentList.map((innerItem, innerItemIndex) => {
|
|
604
637
|
return /*#__PURE__*/React__default["default"].createElement("p", {
|
|
605
|
-
key: `${innerItem}_${
|
|
638
|
+
key: `${innerItem}_${innerItemIndex}`,
|
|
606
639
|
className: styles$c['list-text'],
|
|
607
640
|
style: {
|
|
608
|
-
color: openListColor
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
641
|
+
color: openListColor,
|
|
642
|
+
maxWidth: (item.content.length * 9 <= 100 ? 100 : item.content.length * 9) + 'px'
|
|
643
|
+
},
|
|
644
|
+
onClick: e => handleContentListClick(e, {
|
|
645
|
+
item,
|
|
646
|
+
index,
|
|
647
|
+
innerIndex,
|
|
648
|
+
listContentId: innerItem.id,
|
|
649
|
+
listContent: innerItem.content,
|
|
650
|
+
listContentIndex: innerItemIndex
|
|
651
|
+
})
|
|
652
|
+
}, innerItem.content);
|
|
612
653
|
})))) : '');
|
|
613
654
|
};
|
|
614
655
|
|
|
@@ -691,6 +732,30 @@ const Table = ({
|
|
|
691
732
|
const [disableArr, setDisableArr] = React.useState([]);
|
|
692
733
|
const [checkedArray, setCheckedArray] = React.useState([]);
|
|
693
734
|
const configStyles = compereConfigs();
|
|
735
|
+
const handleCheckIfArrow = (bodyData, data) => {
|
|
736
|
+
let removeItemIndex;
|
|
737
|
+
let headerWithoutArrow = [];
|
|
738
|
+
bodyData.map((item, index) => {
|
|
739
|
+
if (index === data.index) {
|
|
740
|
+
item.map((innerItem, innerIndex) => {
|
|
741
|
+
if (Object.prototype.hasOwnProperty.call(innerItem, 'arrowComponent')) {
|
|
742
|
+
removeItemIndex = innerIndex;
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
if (removeItemIndex !== undefined) {
|
|
746
|
+
const firstPart = item.slice(0, removeItemIndex);
|
|
747
|
+
const secondPart = item.slice(removeItemIndex + 1, item.length);
|
|
748
|
+
headerWithoutArrow = [...firstPart, ...secondPart];
|
|
749
|
+
} else {
|
|
750
|
+
headerWithoutArrow.push(item);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
return {
|
|
755
|
+
removeItemIndex,
|
|
756
|
+
headerWithoutArrow
|
|
757
|
+
};
|
|
758
|
+
};
|
|
694
759
|
const handleHeaderItemClick = e => {
|
|
695
760
|
e.stopPropagation();
|
|
696
761
|
if (!e.target.tagName.startsWith('svg') && e.target.innerText !== undefined && e.target.innerText !== '') {
|
|
@@ -716,19 +781,22 @@ const Table = ({
|
|
|
716
781
|
};
|
|
717
782
|
const handleBodyActionClick = (e, data) => {
|
|
718
783
|
e.stopPropagation();
|
|
719
|
-
|
|
720
|
-
|
|
784
|
+
const {
|
|
785
|
+
removeItemIndex,
|
|
786
|
+
headerWithoutArrow
|
|
787
|
+
} = handleCheckIfArrow(body, data);
|
|
721
788
|
const actionData = {
|
|
722
|
-
|
|
789
|
+
from: 'body',
|
|
723
790
|
item: data.item,
|
|
724
791
|
id: data.item.id,
|
|
725
792
|
items: data.items,
|
|
726
793
|
type: data.item.type,
|
|
727
794
|
rowIndex: data.index,
|
|
728
|
-
|
|
729
|
-
itemInnerIndex: data.itemIndex
|
|
795
|
+
row: headerWithoutArrow,
|
|
796
|
+
itemInnerIndex: data.itemIndex,
|
|
797
|
+
itemIndex: removeItemIndex !== undefined && removeItemIndex < data.innerIndex ? data.innerIndex - 1 : data.innerIndex
|
|
730
798
|
};
|
|
731
|
-
|
|
799
|
+
getData(actionData);
|
|
732
800
|
};
|
|
733
801
|
const handleSetCheckboxArray = data => {
|
|
734
802
|
let checkedItems = [];
|
|
@@ -809,7 +877,7 @@ const Table = ({
|
|
|
809
877
|
const updatedHeader = header.slice();
|
|
810
878
|
const updatedBody = body.slice().map(item => Object.values(item));
|
|
811
879
|
const newData = updatedHeader.map((item, index) => {
|
|
812
|
-
if (item.content
|
|
880
|
+
if (item.content == data.content) {
|
|
813
881
|
checkableItemIndex = index;
|
|
814
882
|
checkableItemBool = !item.checkBox.checked;
|
|
815
883
|
item.checkBox.checked = !item.checkBox.checked;
|
|
@@ -854,12 +922,17 @@ const Table = ({
|
|
|
854
922
|
setHeader(newData);
|
|
855
923
|
setBody(newUpdatedBody);
|
|
856
924
|
};
|
|
857
|
-
const handleCheckedBody = (data, e) => {
|
|
925
|
+
const handleCheckedBody = (data, e, dataRowIndex, dataItemIndex) => {
|
|
858
926
|
e.stopPropagation();
|
|
927
|
+
const transformedData = {
|
|
928
|
+
...data
|
|
929
|
+
};
|
|
930
|
+
transformedData.index = dataRowIndex;
|
|
931
|
+
transformedData.innerIndex = dataItemIndex;
|
|
859
932
|
const updatedBody = body.slice().map(item => Object.values(item));
|
|
860
933
|
const newData = updatedBody.map((item, index) => {
|
|
861
934
|
return item.map((innerItem, innerIndex) => {
|
|
862
|
-
if (innerItem.id === data.id && innerItem.content
|
|
935
|
+
if (innerItem.id === data.id && innerItem.content == data.content && Object.prototype.hasOwnProperty.call(innerItem, 'checkBox')) {
|
|
863
936
|
innerItem.checkBox.checked = !innerItem.checkBox.checked;
|
|
864
937
|
handleHeaderCheckedUpdate({
|
|
865
938
|
row: index,
|
|
@@ -870,6 +943,18 @@ const Table = ({
|
|
|
870
943
|
return innerItem;
|
|
871
944
|
});
|
|
872
945
|
});
|
|
946
|
+
const {
|
|
947
|
+
removeItemIndex,
|
|
948
|
+
headerWithoutArrow
|
|
949
|
+
} = handleCheckIfArrow(body, transformedData);
|
|
950
|
+
const checkedData = {
|
|
951
|
+
item: data,
|
|
952
|
+
from: 'body',
|
|
953
|
+
row: removeItemIndex !== undefined ? headerWithoutArrow : headerWithoutArrow[0],
|
|
954
|
+
rowIndex: transformedData.index,
|
|
955
|
+
itemIndex: removeItemIndex !== undefined && removeItemIndex < transformedData.innerIndex ? transformedData.innerIndex - 1 : transformedData.innerIndex
|
|
956
|
+
};
|
|
957
|
+
getData(checkedData);
|
|
873
958
|
setBody(newData);
|
|
874
959
|
};
|
|
875
960
|
const handleHeaderCheckedUpdate = checkedData => {
|
|
@@ -1015,6 +1100,52 @@ const Table = ({
|
|
|
1015
1100
|
}
|
|
1016
1101
|
return headerWithDisabled;
|
|
1017
1102
|
};
|
|
1103
|
+
const handleContentListClick = (e, data) => {
|
|
1104
|
+
e.stopPropagation();
|
|
1105
|
+
const {
|
|
1106
|
+
removeItemIndex,
|
|
1107
|
+
headerWithoutArrow
|
|
1108
|
+
} = handleCheckIfArrow(body, data);
|
|
1109
|
+
const listData = {
|
|
1110
|
+
from: 'body',
|
|
1111
|
+
item: data.item,
|
|
1112
|
+
rowIndex: data.index,
|
|
1113
|
+
row: headerWithoutArrow,
|
|
1114
|
+
listItemId: data.listContentId,
|
|
1115
|
+
listItemContent: data.listContent,
|
|
1116
|
+
itemIndex: removeItemIndex !== undefined && removeItemIndex < data.innerIndex ? data.innerIndex - 1 : data.innerIndex,
|
|
1117
|
+
listItemInnerIndex: data.listContentIndex
|
|
1118
|
+
};
|
|
1119
|
+
getData(listData);
|
|
1120
|
+
};
|
|
1121
|
+
const handleMoreOptionsClick = data => {
|
|
1122
|
+
const {
|
|
1123
|
+
removeItemIndex,
|
|
1124
|
+
headerWithoutArrow
|
|
1125
|
+
} = handleCheckIfArrow(body, data);
|
|
1126
|
+
const moreData = {
|
|
1127
|
+
from: 'body',
|
|
1128
|
+
item: data.item,
|
|
1129
|
+
rowIndex: data.index,
|
|
1130
|
+
options: data.options,
|
|
1131
|
+
row: headerWithoutArrow,
|
|
1132
|
+
itemIndex: removeItemIndex !== undefined && removeItemIndex < data.innerIndex ? data.innerIndex - 1 : data.innerIndex,
|
|
1133
|
+
optionItem: data.optionItem,
|
|
1134
|
+
optionIndex: data.optionIndex
|
|
1135
|
+
};
|
|
1136
|
+
getData(moreData);
|
|
1137
|
+
};
|
|
1138
|
+
const handleTableClick = () => {
|
|
1139
|
+
const checkBodyMore = body.map(elemItem => {
|
|
1140
|
+
return elemItem.map(elemInnerItem => {
|
|
1141
|
+
if (Object.prototype.hasOwnProperty.call(elemInnerItem, 'dots')) {
|
|
1142
|
+
elemInnerItem.dotsStatus = 'deActive';
|
|
1143
|
+
}
|
|
1144
|
+
return elemInnerItem;
|
|
1145
|
+
});
|
|
1146
|
+
});
|
|
1147
|
+
setBody(() => checkBodyMore);
|
|
1148
|
+
};
|
|
1018
1149
|
React.useEffect(() => {
|
|
1019
1150
|
let checkedItems = [];
|
|
1020
1151
|
const disabledArray = [];
|
|
@@ -1022,7 +1153,7 @@ const Table = ({
|
|
|
1022
1153
|
if (arrowShow) {
|
|
1023
1154
|
const arrowColumnCount = handleSetInsertIndex(checkBodyForChackedItems[0], arrowColumn);
|
|
1024
1155
|
const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
|
|
1025
|
-
checkForInsertArrow.map((item, index) => {
|
|
1156
|
+
const insert = checkForInsertArrow.map((item, index) => {
|
|
1026
1157
|
item.map((innerItem, innerIndex) => {
|
|
1027
1158
|
if (Object.prototype.hasOwnProperty.call(innerItem, 'checkBox')) {
|
|
1028
1159
|
if (Object.prototype.hasOwnProperty.call(innerItem.checkBox, 'disabled')) {
|
|
@@ -1037,12 +1168,12 @@ const Table = ({
|
|
|
1037
1168
|
}
|
|
1038
1169
|
}
|
|
1039
1170
|
});
|
|
1171
|
+
return item;
|
|
1040
1172
|
});
|
|
1041
|
-
checkedItems = handleSetCheckboxArray(
|
|
1042
|
-
setBody(() =>
|
|
1173
|
+
checkedItems = handleSetCheckboxArray(insert);
|
|
1174
|
+
setBody(() => insert);
|
|
1043
1175
|
} else {
|
|
1044
|
-
|
|
1045
|
-
checkBodyForChackedItems.map((item, index) => {
|
|
1176
|
+
const insert = checkBodyForChackedItems.map((item, index) => {
|
|
1046
1177
|
item.map((innerItem, innerIndex) => {
|
|
1047
1178
|
if (Object.prototype.hasOwnProperty.call(innerItem, 'checkBox')) {
|
|
1048
1179
|
if (Object.prototype.hasOwnProperty.call(innerItem.checkBox, 'disabled')) {
|
|
@@ -1057,8 +1188,10 @@ const Table = ({
|
|
|
1057
1188
|
}
|
|
1058
1189
|
}
|
|
1059
1190
|
});
|
|
1191
|
+
return item;
|
|
1060
1192
|
});
|
|
1061
|
-
|
|
1193
|
+
checkedItems = handleSetCheckboxArray(insert);
|
|
1194
|
+
setBody(() => insert);
|
|
1062
1195
|
}
|
|
1063
1196
|
setDisableArr(disabledArray);
|
|
1064
1197
|
setCheckedArray(() => checkedItems);
|
|
@@ -1079,7 +1212,8 @@ const Table = ({
|
|
|
1079
1212
|
style: {
|
|
1080
1213
|
width: '100%',
|
|
1081
1214
|
borderCollapse: 'collapse'
|
|
1082
|
-
}
|
|
1215
|
+
},
|
|
1216
|
+
onClick: handleTableClick
|
|
1083
1217
|
}, header && header.length > 0 && /*#__PURE__*/React__default["default"].createElement("thead", null, /*#__PURE__*/React__default["default"].createElement("tr", {
|
|
1084
1218
|
style: {
|
|
1085
1219
|
color: tHeadColor ? tHeadColor : configStyles.TABLE.tHeadColor,
|
|
@@ -1120,6 +1254,8 @@ const Table = ({
|
|
|
1120
1254
|
openListColor: openListColor ? openListColor : configStyles.TABLE.openListColor,
|
|
1121
1255
|
handleCheckedBody: handleCheckedBody,
|
|
1122
1256
|
handleBodyActionClick: handleBodyActionClick,
|
|
1257
|
+
handleMoreOptionsClick: handleMoreOptionsClick,
|
|
1258
|
+
handleContentListClick: handleContentListClick,
|
|
1123
1259
|
tBodyColor: tBodyColor ? tBodyColor : configStyles.TABLE.tBodyColor,
|
|
1124
1260
|
tBodyPadding: tBodyPadding ? tBodyPadding : configStyles.TABLE.tBodyPadding,
|
|
1125
1261
|
tBodyFontSize: tBodyFontSize ? tBodyFontSize : configStyles.TABLE.tBodyFontSize,
|
|
@@ -4296,6 +4432,9 @@ const Textarea = ({
|
|
|
4296
4432
|
if (!onChange) {
|
|
4297
4433
|
alert('Please add onChange function on Textarea component');
|
|
4298
4434
|
}
|
|
4435
|
+
if (value === '') {
|
|
4436
|
+
setError('');
|
|
4437
|
+
}
|
|
4299
4438
|
setInnerValue(value);
|
|
4300
4439
|
}, [value, onChange]);
|
|
4301
4440
|
React.useEffect(() => {
|
package/package.json
CHANGED
|
@@ -7,9 +7,11 @@ import ReactCheckboxChecked from '../icon/CheckboxChecked'
|
|
|
7
7
|
|
|
8
8
|
const Checkbox = ({
|
|
9
9
|
data,
|
|
10
|
+
index,
|
|
10
11
|
styles,
|
|
11
12
|
checked,
|
|
12
13
|
disabled,
|
|
14
|
+
innerIndex,
|
|
13
15
|
checkedColor,
|
|
14
16
|
handleChecked,
|
|
15
17
|
unCheckedColor,
|
|
@@ -21,7 +23,16 @@ const Checkbox = ({
|
|
|
21
23
|
const [innerDisabled, setInnerDisabled] = useState(false)
|
|
22
24
|
|
|
23
25
|
const handleClick = (e) => {
|
|
24
|
-
|
|
26
|
+
if (
|
|
27
|
+
index !== undefined &&
|
|
28
|
+
innerIndex !== undefined &&
|
|
29
|
+
typeof index === 'number' &&
|
|
30
|
+
typeof innerIndex === 'number'
|
|
31
|
+
) {
|
|
32
|
+
handleChecked(data, e, index, innerIndex)
|
|
33
|
+
} else {
|
|
34
|
+
handleChecked(data, e)
|
|
35
|
+
}
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
useEffect(() => {
|
|
@@ -5,9 +5,11 @@ import Checkbox from './Checkbox'
|
|
|
5
5
|
|
|
6
6
|
export const SingleCheckbox = ({
|
|
7
7
|
data,
|
|
8
|
+
index,
|
|
8
9
|
styles,
|
|
9
10
|
checked,
|
|
10
11
|
disabled,
|
|
12
|
+
innerIndex,
|
|
11
13
|
checkedColor,
|
|
12
14
|
handleChecked,
|
|
13
15
|
unCheckedColor,
|
|
@@ -30,10 +32,12 @@ export const SingleCheckbox = ({
|
|
|
30
32
|
|
|
31
33
|
return (
|
|
32
34
|
<Checkbox
|
|
35
|
+
index={index}
|
|
33
36
|
styles={styles}
|
|
34
37
|
data={innerData}
|
|
35
38
|
checked={checked}
|
|
36
39
|
disabled={disabled}
|
|
40
|
+
innerIndex={innerIndex}
|
|
37
41
|
checkedColor={checkedColor}
|
|
38
42
|
handleChecked={handleChecked}
|
|
39
43
|
unCheckedColor={unCheckedColor}
|
|
@@ -45,8 +49,10 @@ export const SingleCheckbox = ({
|
|
|
45
49
|
SingleCheckbox.propTypes = {
|
|
46
50
|
data: PropTypes.object,
|
|
47
51
|
onClick: PropTypes.func,
|
|
52
|
+
index: PropTypes.number,
|
|
48
53
|
styles: PropTypes.object,
|
|
49
54
|
disabled: PropTypes.bool,
|
|
55
|
+
innerIndex: PropTypes.number,
|
|
50
56
|
checkedColor: PropTypes.string,
|
|
51
57
|
unCheckedColor: PropTypes.string,
|
|
52
58
|
ignoreDisabledForChecked: PropTypes.bool,
|