@xaypay/tui 0.0.112 → 0.0.114
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 +257 -122
- package/dist/index.js +257 -122
- package/package.json +1 -1
- package/src/components/icon/Zoom.js +21 -0
- package/src/components/input/index.js +24 -0
- package/src/components/input/input.stories.js +0 -2
- package/src/components/modal/index.js +71 -35
- package/src/components/modal/modal.stories.js +1 -1
- package/src/components/newAutocomplete/index.js +2 -3
- package/src/components/newFile/fileItem.js +1 -0
- package/src/components/newFile/index.js +84 -12
- package/src/components/newFile/newFile.stories.js +2 -1
- package/src/components/select/index.js +2 -3
- package/src/components/table/index.js +35 -46
- package/src/components/table/table.stories.js +65 -1
- package/src/components/table/td.js +121 -64
- package/src/components/table/th.js +12 -8
- package/src/components/textarea/index.js +0 -6
- package/src/components/typography/index.js +1 -1
- package/src/stories/static/table-new-data-structure-usage.png +0 -0
- package/src/stories/usage.stories.mdx +2 -0
- package/src/utils/index.js +4 -0
package/dist/index.js
CHANGED
|
@@ -254,6 +254,9 @@ const compereConfigs = () => {
|
|
|
254
254
|
|
|
255
255
|
return _.merge(packageConfig, projectConfig);
|
|
256
256
|
};
|
|
257
|
+
const hasOwnerProperty = (object, property) => {
|
|
258
|
+
return Object.prototype.hasOwnProperty.call(object, property);
|
|
259
|
+
};
|
|
257
260
|
|
|
258
261
|
const SvgCheckboxUnchecked = ({
|
|
259
262
|
title,
|
|
@@ -409,6 +412,11 @@ const TH = ({
|
|
|
409
412
|
handleHeaderItemClick,
|
|
410
413
|
handleCheckArrowActionHeader
|
|
411
414
|
}) => {
|
|
415
|
+
const handleCheckArrowAction = (e, object, property) => {
|
|
416
|
+
if (hasOwnerProperty(object, property)) {
|
|
417
|
+
handleCheckArrowActionHeader(e, object);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
412
420
|
return /*#__PURE__*/React__default["default"].createElement("th", {
|
|
413
421
|
style: {
|
|
414
422
|
width: 'auto',
|
|
@@ -428,9 +436,9 @@ const TH = ({
|
|
|
428
436
|
style: {
|
|
429
437
|
display: 'flex',
|
|
430
438
|
alignItems: 'flex-start',
|
|
431
|
-
justifyContent:
|
|
439
|
+
justifyContent: hasOwnerProperty(item, 'checkBox') ? 'space-between' : 'center'
|
|
432
440
|
}
|
|
433
|
-
}, item
|
|
441
|
+
}, hasOwnerProperty(item, 'checkBox') ? /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
|
|
434
442
|
data: item,
|
|
435
443
|
float: "left",
|
|
436
444
|
checked: item.checkBox.checked,
|
|
@@ -442,8 +450,8 @@ const TH = ({
|
|
|
442
450
|
style: {
|
|
443
451
|
margin: '0px'
|
|
444
452
|
},
|
|
445
|
-
onClick:
|
|
446
|
-
}, item.type === 'show' ? item.content :
|
|
453
|
+
onClick: e => handleCheckArrowAction(e, item, 'arrowComponent')
|
|
454
|
+
}, item.type === 'show' ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : '')));
|
|
447
455
|
};
|
|
448
456
|
|
|
449
457
|
const TD = ({
|
|
@@ -476,6 +484,34 @@ const TD = ({
|
|
|
476
484
|
};
|
|
477
485
|
handleBodyActionClick(e, actionData);
|
|
478
486
|
};
|
|
487
|
+
const handleCheckActions = (e, object, property, objectIndex) => {
|
|
488
|
+
if (hasOwnerProperty(object, property)) {
|
|
489
|
+
handleBodyAction(e, {
|
|
490
|
+
item: object,
|
|
491
|
+
itemIndex: objectIndex
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
const handleMoreOptions = (item, index, optionItem, innerIndex, optionIndex, options) => {
|
|
496
|
+
handleMoreOptionsClick({
|
|
497
|
+
item,
|
|
498
|
+
index,
|
|
499
|
+
options,
|
|
500
|
+
optionItem,
|
|
501
|
+
innerIndex,
|
|
502
|
+
optionIndex
|
|
503
|
+
});
|
|
504
|
+
};
|
|
505
|
+
const handleContentList = (e, item, index, innerIndex, listContentId, listContent, listContentIndex) => {
|
|
506
|
+
handleContentListClick(e, {
|
|
507
|
+
item,
|
|
508
|
+
index,
|
|
509
|
+
innerIndex,
|
|
510
|
+
listContentId,
|
|
511
|
+
listContent,
|
|
512
|
+
listContentIndex
|
|
513
|
+
});
|
|
514
|
+
};
|
|
479
515
|
return /*#__PURE__*/React__default["default"].createElement("td", {
|
|
480
516
|
style: {
|
|
481
517
|
width: 'auto',
|
|
@@ -488,7 +524,7 @@ const TD = ({
|
|
|
488
524
|
textAlign: tBodyTextAlign,
|
|
489
525
|
fontFamily: tBodyFontFamily,
|
|
490
526
|
fontWeight: tBodyFontWeight,
|
|
491
|
-
boxShadow:
|
|
527
|
+
boxShadow: hasOwnerProperty(item, 'colorStatus') ? `inset 3px 0px 0px 0px ${item.colorStatus}` : ''
|
|
492
528
|
}
|
|
493
529
|
}, Array.isArray(item) ? item.length > 0 ? item.map((newItem, newIndex) => {
|
|
494
530
|
if (newItem && !Array.isArray(newItem) && typeof newItem === 'object') {
|
|
@@ -497,16 +533,13 @@ const TD = ({
|
|
|
497
533
|
width: '32px',
|
|
498
534
|
height: '32px',
|
|
499
535
|
marginRight: '10px',
|
|
500
|
-
cursor:
|
|
536
|
+
cursor: hasOwnerProperty(newItem, 'type') ? 'pointer' : 'auto'
|
|
501
537
|
},
|
|
502
538
|
id: newItem.id,
|
|
503
539
|
type: newItem.type,
|
|
504
540
|
className: styles$c['td-span'],
|
|
505
541
|
key: `${newItem.id}_${newIndex}`,
|
|
506
|
-
onClick:
|
|
507
|
-
item: newItem,
|
|
508
|
-
itemIndex: newIndex
|
|
509
|
-
}) : _ => _
|
|
542
|
+
onClick: e => handleCheckActions(e, newItem, 'type', newIndex)
|
|
510
543
|
}, newItem.content);
|
|
511
544
|
} else if (newItem && Array.isArray(newItem)) {
|
|
512
545
|
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -522,15 +555,12 @@ const TD = ({
|
|
|
522
555
|
width: '32px',
|
|
523
556
|
height: '32px',
|
|
524
557
|
marginRight: '10px',
|
|
525
|
-
cursor:
|
|
558
|
+
cursor: hasOwnerProperty(iT, 'type') ? 'pointer' : 'auto'
|
|
526
559
|
},
|
|
527
560
|
id: iT.id ? iT.id : '',
|
|
528
561
|
type: iT.type ? iT.type : '',
|
|
529
562
|
className: styles$c['td-span'],
|
|
530
|
-
onClick:
|
|
531
|
-
item: iT,
|
|
532
|
-
itemIndex: iN
|
|
533
|
-
}) : _ => _,
|
|
563
|
+
onClick: e => handleCheckActions(e, iT, 'type', iN),
|
|
534
564
|
key: `${iT.id || iT.content}_${iN}`
|
|
535
565
|
}, iT.content);
|
|
536
566
|
}));
|
|
@@ -543,18 +573,18 @@ const TD = ({
|
|
|
543
573
|
style: {
|
|
544
574
|
display: 'flex',
|
|
545
575
|
alignItems: 'flex-start',
|
|
546
|
-
justifyContent:
|
|
576
|
+
justifyContent: hasOwnerProperty(item, 'checkBox') ? 'space-between' : 'center'
|
|
547
577
|
}
|
|
548
|
-
},
|
|
578
|
+
}, !hasOwnerProperty(item, 'hideArrow') && item.hideArrow !== false && (!hasOwnerProperty(item, 'rightArrow') || item.rightArrow !== true) ? hasOwnerProperty(item, 'contentList') && (hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow')) && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
549
579
|
id: item.id,
|
|
550
580
|
style: {
|
|
551
581
|
width: '21px',
|
|
552
582
|
height: '21px',
|
|
553
583
|
cursor: 'pointer'
|
|
554
584
|
},
|
|
555
|
-
onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex),
|
|
585
|
+
onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
|
|
556
586
|
className: styles$c['td-span']
|
|
557
|
-
}, item.status === 'close' ? item.closeArrow : item.openArrow),
|
|
587
|
+
}, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, 'checkBox') && /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
|
|
558
588
|
data: item,
|
|
559
589
|
index: index,
|
|
560
590
|
innerIndex: innerIndex,
|
|
@@ -565,15 +595,16 @@ const TD = ({
|
|
|
565
595
|
unCheckedColor: item.checkBox.unCheckedColor
|
|
566
596
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
567
597
|
style: {
|
|
568
|
-
marginLeft: item
|
|
598
|
+
marginLeft: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '0px' : '10px' : hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow') ? '10px' : '0px' : '0px',
|
|
599
|
+
marginRight: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '10px' : '0px' : '0px' : '0px'
|
|
569
600
|
}
|
|
570
601
|
}, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
571
602
|
style: {
|
|
572
603
|
margin: '0px',
|
|
573
|
-
cursor:
|
|
604
|
+
cursor: hasOwnerProperty(item, 'arrowComponent') || hasOwnerProperty(item, 'dots') ? 'pointer' : 'auto'
|
|
574
605
|
},
|
|
575
|
-
onClick:
|
|
576
|
-
}, item.content ? item.content :
|
|
606
|
+
onClick: hasOwnerProperty(item, 'arrowComponent') ? () => handleCheckArrowAction(item, item.checkIndex) : hasOwnerProperty(item, 'dots') ? e => handleCheckDots(e, item, index, innerIndex) : _ => _
|
|
607
|
+
}, item.content ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : hasOwnerProperty(item, 'dots') ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
577
608
|
style: {
|
|
578
609
|
display: 'block',
|
|
579
610
|
position: 'relative'
|
|
@@ -594,7 +625,7 @@ const TD = ({
|
|
|
594
625
|
backgroundColor: '#FFFFFF',
|
|
595
626
|
boxShadow: '0px 0px 20px 0px #3C393E4D'
|
|
596
627
|
}
|
|
597
|
-
},
|
|
628
|
+
}, hasOwnerProperty(item, 'options') && item.options.map((optionItem, optionIndex) => {
|
|
598
629
|
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
599
630
|
key: `${optionItem.content}_${optionIndex}`,
|
|
600
631
|
className: styles$c['dots-option-item'],
|
|
@@ -603,14 +634,7 @@ const TD = ({
|
|
|
603
634
|
fontSize: '14px',
|
|
604
635
|
fontFamily: 'Noto Sans Armenian'
|
|
605
636
|
},
|
|
606
|
-
onClick: () =>
|
|
607
|
-
item,
|
|
608
|
-
index,
|
|
609
|
-
optionItem,
|
|
610
|
-
innerIndex,
|
|
611
|
-
optionIndex,
|
|
612
|
-
options: item.options
|
|
613
|
-
})
|
|
637
|
+
onClick: () => handleMoreOptions(item, index, optionItem, innerIndex, optionIndex, item.options)
|
|
614
638
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
615
639
|
style: {
|
|
616
640
|
marginRight: '10px'
|
|
@@ -621,11 +645,12 @@ const TD = ({
|
|
|
621
645
|
textAlign: 'left',
|
|
622
646
|
overflow: 'hidden',
|
|
623
647
|
whiteSpace: 'nowrap',
|
|
624
|
-
textOverflow: 'ellipsis'
|
|
648
|
+
textOverflow: 'ellipsis',
|
|
649
|
+
marginBottom: '5px'
|
|
625
650
|
},
|
|
626
651
|
title: optionItem.content
|
|
627
652
|
}, optionItem.content));
|
|
628
|
-
}))) : ''),
|
|
653
|
+
}))) : ''), hasOwnerProperty(item, 'contentList') && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
629
654
|
style: {
|
|
630
655
|
overflow: 'auto',
|
|
631
656
|
marginTop: '10px',
|
|
@@ -641,16 +666,18 @@ const TD = ({
|
|
|
641
666
|
color: openListColor,
|
|
642
667
|
maxWidth: (item.content.length * 9 <= 100 ? 100 : item.content.length * 9) + 'px'
|
|
643
668
|
},
|
|
644
|
-
onClick: e =>
|
|
645
|
-
item,
|
|
646
|
-
index,
|
|
647
|
-
innerIndex,
|
|
648
|
-
listContentId: innerItem.id,
|
|
649
|
-
listContent: innerItem.content,
|
|
650
|
-
listContentIndex: innerItemIndex
|
|
651
|
-
})
|
|
669
|
+
onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex)
|
|
652
670
|
}, innerItem.content);
|
|
653
|
-
}))))
|
|
671
|
+
}))), !hasOwnerProperty(item, 'hideArrow') && item.hideArrow !== false && hasOwnerProperty(item, 'rightArrow') && item.rightArrow === true ? hasOwnerProperty(item, 'contentList') && (hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow')) && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
672
|
+
id: item.id,
|
|
673
|
+
style: {
|
|
674
|
+
width: '21px',
|
|
675
|
+
height: '21px',
|
|
676
|
+
cursor: 'pointer'
|
|
677
|
+
},
|
|
678
|
+
onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
|
|
679
|
+
className: styles$c['td-span']
|
|
680
|
+
}, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '') : '');
|
|
654
681
|
};
|
|
655
682
|
|
|
656
683
|
const SvgUpArrow = ({
|
|
@@ -738,7 +765,7 @@ const Table = ({
|
|
|
738
765
|
bodyData.map((item, index) => {
|
|
739
766
|
if (index === data.index) {
|
|
740
767
|
item.map((innerItem, innerIndex) => {
|
|
741
|
-
if (
|
|
768
|
+
if (hasOwnerProperty(innerItem, 'arrowComponent')) {
|
|
742
769
|
removeItemIndex = innerIndex;
|
|
743
770
|
}
|
|
744
771
|
});
|
|
@@ -762,7 +789,7 @@ const Table = ({
|
|
|
762
789
|
let removeItemIndex;
|
|
763
790
|
let headerWithoutArrow;
|
|
764
791
|
header.map((item, index) => {
|
|
765
|
-
if (
|
|
792
|
+
if (hasOwnerProperty(item, 'arrowComponent')) {
|
|
766
793
|
removeItemIndex = index;
|
|
767
794
|
}
|
|
768
795
|
});
|
|
@@ -802,7 +829,7 @@ const Table = ({
|
|
|
802
829
|
let checkedItems = [];
|
|
803
830
|
data.map((item, index) => {
|
|
804
831
|
item.map((innerItem, innerIndex) => {
|
|
805
|
-
if (
|
|
832
|
+
if (hasOwnerProperty(innerItem, 'checkBox')) {
|
|
806
833
|
if (!checkedItems[innerIndex]) {
|
|
807
834
|
checkedItems[innerIndex] = [];
|
|
808
835
|
}
|
|
@@ -882,7 +909,7 @@ const Table = ({
|
|
|
882
909
|
checkableItemBool = !item.checkBox.checked;
|
|
883
910
|
item.checkBox.checked = !item.checkBox.checked;
|
|
884
911
|
}
|
|
885
|
-
if (
|
|
912
|
+
if (hasOwnerProperty(item, 'arrowComponent')) {
|
|
886
913
|
removeItemIndex = index;
|
|
887
914
|
}
|
|
888
915
|
return item;
|
|
@@ -890,11 +917,13 @@ const Table = ({
|
|
|
890
917
|
const newUpdatedBody = updatedBody.map((item, index) => {
|
|
891
918
|
return item.map((innerItem, innerIndex) => {
|
|
892
919
|
if (checkableItemIndex === innerIndex) {
|
|
893
|
-
innerItem.checkBox.
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
920
|
+
if (!hasOwnerProperty(innerItem.checkBox, 'disabled') || innerItem.checkBox.disabled !== true) {
|
|
921
|
+
innerItem.checkBox.checked = checkableItemBool;
|
|
922
|
+
checkableBodyRowItems.push({
|
|
923
|
+
column: innerIndex,
|
|
924
|
+
columnItem: innerItem
|
|
925
|
+
});
|
|
926
|
+
}
|
|
898
927
|
handleHeaderCheckedUpdate({
|
|
899
928
|
row: index,
|
|
900
929
|
column: innerIndex,
|
|
@@ -932,7 +961,7 @@ const Table = ({
|
|
|
932
961
|
const updatedBody = body.slice().map(item => Object.values(item));
|
|
933
962
|
const newData = updatedBody.map((item, index) => {
|
|
934
963
|
return item.map((innerItem, innerIndex) => {
|
|
935
|
-
if (innerItem.id === data.id && innerItem.content == data.content &&
|
|
964
|
+
if (innerItem.id === data.id && innerItem.content == data.content && hasOwnerProperty(innerItem, 'checkBox')) {
|
|
936
965
|
innerItem.checkBox.checked = !innerItem.checkBox.checked;
|
|
937
966
|
handleHeaderCheckedUpdate({
|
|
938
967
|
row: index,
|
|
@@ -989,7 +1018,7 @@ const Table = ({
|
|
|
989
1018
|
const handleCheckArrowAction = (item, rowPosition) => {
|
|
990
1019
|
const status = item.status;
|
|
991
1020
|
const checkedOpenableRow = body[rowPosition].map(innerItem => {
|
|
992
|
-
if (
|
|
1021
|
+
if (hasOwnerProperty(innerItem, 'status')) {
|
|
993
1022
|
if (status === 'close') {
|
|
994
1023
|
innerItem.status = 'open';
|
|
995
1024
|
} else {
|
|
@@ -1003,7 +1032,8 @@ const Table = ({
|
|
|
1003
1032
|
return [...prev];
|
|
1004
1033
|
});
|
|
1005
1034
|
};
|
|
1006
|
-
const handleOpenCloseRowSingleArrow = (arrowRowIndex, arrowIndex) => {
|
|
1035
|
+
const handleOpenCloseRowSingleArrow = (arrowRowIndex, arrowIndex, clickableItem) => {
|
|
1036
|
+
console.log(clickableItem, 'clickableItem');
|
|
1007
1037
|
let single = {};
|
|
1008
1038
|
const allArrows = [];
|
|
1009
1039
|
const checkedOpenableRow = body[arrowRowIndex].map((item, index) => {
|
|
@@ -1015,13 +1045,13 @@ const Table = ({
|
|
|
1015
1045
|
}
|
|
1016
1046
|
single = item;
|
|
1017
1047
|
}
|
|
1018
|
-
if (
|
|
1048
|
+
if (hasOwnerProperty(item, 'status') && !hasOwnerProperty(item, 'arrowComponent')) {
|
|
1019
1049
|
allArrows.push(item);
|
|
1020
1050
|
}
|
|
1021
1051
|
return item;
|
|
1022
1052
|
});
|
|
1023
1053
|
const checkedOpenableRowArrow = checkedOpenableRow.map(item => {
|
|
1024
|
-
if (
|
|
1054
|
+
if (hasOwnerProperty(item, 'arrowComponent')) {
|
|
1025
1055
|
if (single && single.status === 'close') {
|
|
1026
1056
|
item.status = 'close';
|
|
1027
1057
|
} else if (single && single.status === 'open') {
|
|
@@ -1030,6 +1060,9 @@ const Table = ({
|
|
|
1030
1060
|
}
|
|
1031
1061
|
}
|
|
1032
1062
|
}
|
|
1063
|
+
if (hasOwnerProperty(clickableItem, 'theSame') && hasOwnerProperty(item, 'theSame') && clickableItem.theSame === item.theSame) {
|
|
1064
|
+
item.status = clickableItem.status;
|
|
1065
|
+
}
|
|
1033
1066
|
return item;
|
|
1034
1067
|
});
|
|
1035
1068
|
setBody(prev => {
|
|
@@ -1051,7 +1084,7 @@ const Table = ({
|
|
|
1051
1084
|
});
|
|
1052
1085
|
const checkedOpenableAllRowsBody = body.map(innerItem => {
|
|
1053
1086
|
return innerItem.map(iElem => {
|
|
1054
|
-
if (
|
|
1087
|
+
if (hasOwnerProperty(iElem, 'status')) {
|
|
1055
1088
|
if (item.status === 'open') {
|
|
1056
1089
|
iElem.status = 'open';
|
|
1057
1090
|
} else {
|
|
@@ -1068,7 +1101,7 @@ const Table = ({
|
|
|
1068
1101
|
e.stopPropagation();
|
|
1069
1102
|
const checkBodyMore = body.map((elemItem, elemIndex) => {
|
|
1070
1103
|
return elemItem.map((elemInnerItem, elemInnerIndex) => {
|
|
1071
|
-
if (elemIndex === index &&
|
|
1104
|
+
if (elemIndex === index && hasOwnerProperty(elemInnerItem, 'dots')) {
|
|
1072
1105
|
if (elemInnerIndex === innerIndex) {
|
|
1073
1106
|
if (item.dotsStatus === 'deActive') {
|
|
1074
1107
|
elemInnerItem.dotsStatus = 'active';
|
|
@@ -1076,7 +1109,7 @@ const Table = ({
|
|
|
1076
1109
|
elemInnerItem.dotsStatus = 'deActive';
|
|
1077
1110
|
}
|
|
1078
1111
|
}
|
|
1079
|
-
} else if (elemIndex !== index &&
|
|
1112
|
+
} else if (elemIndex !== index && hasOwnerProperty(elemInnerItem, 'dots')) {
|
|
1080
1113
|
if (elemInnerIndex === innerIndex) {
|
|
1081
1114
|
elemInnerItem.dotsStatus = 'deActive';
|
|
1082
1115
|
}
|
|
@@ -1086,20 +1119,6 @@ const Table = ({
|
|
|
1086
1119
|
});
|
|
1087
1120
|
setBody(() => checkBodyMore);
|
|
1088
1121
|
};
|
|
1089
|
-
const handleCheckDisable = (arr, disableArr) => {
|
|
1090
|
-
let headerWithDisabled = [];
|
|
1091
|
-
if (disableArr && disableArr.length > 0) {
|
|
1092
|
-
headerWithDisabled = arr.map((item, index) => {
|
|
1093
|
-
if (disableArr[index]) {
|
|
1094
|
-
if (Object.prototype.hasOwnProperty.call(item, 'checkBox')) {
|
|
1095
|
-
item.checkBox.disabled = true;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
return item;
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
return headerWithDisabled;
|
|
1102
|
-
};
|
|
1103
1122
|
const handleContentListClick = (e, data) => {
|
|
1104
1123
|
e.stopPropagation();
|
|
1105
1124
|
const {
|
|
@@ -1138,7 +1157,7 @@ const Table = ({
|
|
|
1138
1157
|
const handleTableClick = () => {
|
|
1139
1158
|
const checkBodyMore = body.map(elemItem => {
|
|
1140
1159
|
return elemItem.map(elemInnerItem => {
|
|
1141
|
-
if (
|
|
1160
|
+
if (hasOwnerProperty(elemInnerItem, 'dots')) {
|
|
1142
1161
|
elemInnerItem.dotsStatus = 'deActive';
|
|
1143
1162
|
}
|
|
1144
1163
|
return elemInnerItem;
|
|
@@ -1155,8 +1174,8 @@ const Table = ({
|
|
|
1155
1174
|
const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
|
|
1156
1175
|
const insert = checkForInsertArrow.map((item, index) => {
|
|
1157
1176
|
item.map((innerItem, innerIndex) => {
|
|
1158
|
-
if (
|
|
1159
|
-
if (
|
|
1177
|
+
if (hasOwnerProperty(innerItem, 'checkBox')) {
|
|
1178
|
+
if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
|
|
1160
1179
|
if (innerItem.checkBox.disabled === true) {
|
|
1161
1180
|
if (!disabledArray[innerIndex]) {
|
|
1162
1181
|
disabledArray[innerIndex] = {
|
|
@@ -1175,8 +1194,8 @@ const Table = ({
|
|
|
1175
1194
|
} else {
|
|
1176
1195
|
const insert = checkBodyForChackedItems.map((item, index) => {
|
|
1177
1196
|
item.map((innerItem, innerIndex) => {
|
|
1178
|
-
if (
|
|
1179
|
-
if (
|
|
1197
|
+
if (hasOwnerProperty(innerItem, 'checkBox')) {
|
|
1198
|
+
if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
|
|
1180
1199
|
if (innerItem.checkBox.disabled === true) {
|
|
1181
1200
|
if (!disabledArray[innerIndex]) {
|
|
1182
1201
|
disabledArray[innerIndex] = {
|
|
@@ -1201,11 +1220,9 @@ const Table = ({
|
|
|
1201
1220
|
const header = dataHeader.slice();
|
|
1202
1221
|
const arrowColumnCount = handleSetInsertIndex(header, arrowColumn);
|
|
1203
1222
|
const checkForInsertArrow = handleTransformDataForInsertArrow(header, arrowColumnCount, 'header');
|
|
1204
|
-
|
|
1205
|
-
setHeader(() => headerWithDisabled.length > 0 ? headerWithDisabled : checkForInsertArrow);
|
|
1223
|
+
setHeader(() => checkForInsertArrow);
|
|
1206
1224
|
} else {
|
|
1207
|
-
|
|
1208
|
-
setHeader(() => headerWithDisabled.length > 0 ? headerWithDisabled : dataHeader);
|
|
1225
|
+
setHeader(() => dataHeader);
|
|
1209
1226
|
}
|
|
1210
1227
|
}, [dataHeader, arrowColumn, arrowShow, disableArr]);
|
|
1211
1228
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("table", {
|
|
@@ -1343,6 +1360,26 @@ const SvgPrev = ({
|
|
|
1343
1360
|
fill: "#3C393E"
|
|
1344
1361
|
}));
|
|
1345
1362
|
|
|
1363
|
+
const SvgZoom = ({
|
|
1364
|
+
title,
|
|
1365
|
+
titleId,
|
|
1366
|
+
...props
|
|
1367
|
+
}) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1368
|
+
width: "32",
|
|
1369
|
+
height: "32",
|
|
1370
|
+
viewBox: "0 0 32 32",
|
|
1371
|
+
fill: "none",
|
|
1372
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1373
|
+
"aria-labelledby": titleId
|
|
1374
|
+
}, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
|
|
1375
|
+
id: titleId
|
|
1376
|
+
}, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
|
|
1377
|
+
fillRule: "evenodd",
|
|
1378
|
+
clipRule: "evenodd",
|
|
1379
|
+
d: "M3 14C3 7.925 7.925 3 14 3s11 4.925 11 11-4.925 11-11 11S3 20.075 3 14ZM14 1C6.82 1 1 6.82 1 14s5.82 13 13 13c3.23 0 6.185-1.178 8.458-3.128l6.835 6.835a1 1 0 0 0 1.414-1.414l-6.835-6.835A12.949 12.949 0 0 0 27 14c0-7.18-5.82-13-13-13Zm1 9a1 1 0 1 0-2 0v3h-3a1 1 0 1 0 0 2h3v3a1 1 0 1 0 2 0v-3h3a1 1 0 1 0 0-2h-3v-3Z",
|
|
1380
|
+
fill: "#fff"
|
|
1381
|
+
}));
|
|
1382
|
+
|
|
1346
1383
|
const SvgCloseIcon = ({
|
|
1347
1384
|
title,
|
|
1348
1385
|
titleId,
|
|
@@ -1388,6 +1425,7 @@ const Modal = ({
|
|
|
1388
1425
|
height,
|
|
1389
1426
|
padding,
|
|
1390
1427
|
setShow,
|
|
1428
|
+
zoomIcon,
|
|
1391
1429
|
selected,
|
|
1392
1430
|
children,
|
|
1393
1431
|
minWidth,
|
|
@@ -1404,17 +1442,18 @@ const Modal = ({
|
|
|
1404
1442
|
borderStyle,
|
|
1405
1443
|
borderWidth,
|
|
1406
1444
|
borderColor,
|
|
1445
|
+
imageMargin,
|
|
1446
|
+
showZoomIcon,
|
|
1407
1447
|
outsideClose,
|
|
1408
1448
|
headerWeight,
|
|
1409
1449
|
headerHeight,
|
|
1450
|
+
imageMaxWidth,
|
|
1410
1451
|
justifyContent,
|
|
1452
|
+
imageWrapWidth,
|
|
1411
1453
|
backgroundColor,
|
|
1454
|
+
imageWrapHeight,
|
|
1412
1455
|
grayDecorHeight,
|
|
1413
|
-
layerBackgroundColor
|
|
1414
|
-
imageMargin,
|
|
1415
|
-
imageMaxWidth,
|
|
1416
|
-
imageWrapWidth,
|
|
1417
|
-
imageWrapHeight
|
|
1456
|
+
layerBackgroundColor
|
|
1418
1457
|
}) => {
|
|
1419
1458
|
const [select, setSelect] = React.useState(0);
|
|
1420
1459
|
const [innerData, setInnerData] = React.useState([]);
|
|
@@ -1446,6 +1485,11 @@ const Modal = ({
|
|
|
1446
1485
|
handleCloseModal();
|
|
1447
1486
|
}
|
|
1448
1487
|
};
|
|
1488
|
+
const handleOpenInNewTab = url => {
|
|
1489
|
+
const imageLink = document.createElement('a');
|
|
1490
|
+
imageLink.href = url, imageLink.target = '_blank';
|
|
1491
|
+
imageLink.click();
|
|
1492
|
+
};
|
|
1449
1493
|
React.useEffect(() => {
|
|
1450
1494
|
if (type === 'images') {
|
|
1451
1495
|
if (data) {
|
|
@@ -1593,11 +1637,12 @@ const Modal = ({
|
|
|
1593
1637
|
}
|
|
1594
1638
|
}, innerData && innerData.length > 0 && innerData.map((item, index) => {
|
|
1595
1639
|
if (select === index) {
|
|
1596
|
-
|
|
1597
|
-
if (!item.hasOwnProperty('url')) {
|
|
1640
|
+
if (!hasOwnerProperty(item, 'url')) {
|
|
1598
1641
|
alert('Please add url property in data prop on each element');
|
|
1599
1642
|
} else {
|
|
1600
|
-
return /*#__PURE__*/React__default["default"].createElement("
|
|
1643
|
+
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1644
|
+
key: `${item.url}_${item.id ? item.id : '007'}_${index}`
|
|
1645
|
+
}, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1601
1646
|
style: {
|
|
1602
1647
|
display: 'block',
|
|
1603
1648
|
objectFit: 'cover',
|
|
@@ -1608,9 +1653,26 @@ const Modal = ({
|
|
|
1608
1653
|
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight,
|
|
1609
1654
|
maxWidth: imageMaxWidth ? imageMaxWidth : configStyles.MODAL.imageMaxWidth
|
|
1610
1655
|
},
|
|
1611
|
-
src: item.url
|
|
1612
|
-
|
|
1613
|
-
|
|
1656
|
+
src: item.url
|
|
1657
|
+
}), showZoomIcon ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1658
|
+
style: {
|
|
1659
|
+
top: '0px',
|
|
1660
|
+
left: '0px',
|
|
1661
|
+
zIndex: '10',
|
|
1662
|
+
right: '0px',
|
|
1663
|
+
bottom: '0px',
|
|
1664
|
+
margin: 'auto',
|
|
1665
|
+
display: 'flex',
|
|
1666
|
+
maxWidth: '40px',
|
|
1667
|
+
maxHeight: '40px',
|
|
1668
|
+
cursor: 'pointer',
|
|
1669
|
+
overflow: 'hidden',
|
|
1670
|
+
position: 'absolute',
|
|
1671
|
+
alignItems: 'center',
|
|
1672
|
+
justifyContent: 'center'
|
|
1673
|
+
},
|
|
1674
|
+
onClick: () => handleOpenInNewTab(item.url)
|
|
1675
|
+
}, zoomIcon ? zoomIcon : /*#__PURE__*/React__default["default"].createElement(SvgZoom, null)) : '');
|
|
1614
1676
|
}
|
|
1615
1677
|
}
|
|
1616
1678
|
}), innerData && innerData.length > 1 && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
@@ -1656,26 +1718,28 @@ Modal.propTypes = {
|
|
|
1656
1718
|
mMaxWidth: PropTypes__default["default"].string,
|
|
1657
1719
|
minHeight: PropTypes__default["default"].string,
|
|
1658
1720
|
className: PropTypes__default["default"].string,
|
|
1721
|
+
zoomIcon: PropTypes__default["default"].element,
|
|
1659
1722
|
alignItems: PropTypes__default["default"].string,
|
|
1660
1723
|
mMaxHeight: PropTypes__default["default"].string,
|
|
1661
1724
|
headerText: PropTypes__default["default"].string,
|
|
1662
1725
|
imageWidth: PropTypes__default["default"].string,
|
|
1663
1726
|
headerSize: PropTypes__default["default"].string,
|
|
1664
1727
|
outsideClose: PropTypes__default["default"].bool,
|
|
1728
|
+
showZoomIcon: PropTypes__default["default"].bool,
|
|
1729
|
+
imageMargin: PropTypes__default["default"].string,
|
|
1665
1730
|
borderStyle: PropTypes__default["default"].string,
|
|
1666
1731
|
borderWidth: PropTypes__default["default"].string,
|
|
1667
1732
|
headerColor: PropTypes__default["default"].string,
|
|
1668
1733
|
imageHeight: PropTypes__default["default"].string,
|
|
1669
1734
|
headerWeight: PropTypes__default["default"].string,
|
|
1670
1735
|
headerHeight: PropTypes__default["default"].string,
|
|
1736
|
+
imageMaxWidth: PropTypes__default["default"].string,
|
|
1671
1737
|
justifyContent: PropTypes__default["default"].string,
|
|
1738
|
+
imageWrapWidth: PropTypes__default["default"].string,
|
|
1672
1739
|
backgroundColor: PropTypes__default["default"].string,
|
|
1673
1740
|
grayDecorHeight: PropTypes__default["default"].string,
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
imageMaxWidth: PropTypes__default["default"].string,
|
|
1677
|
-
imageWrapWidth: PropTypes__default["default"].string,
|
|
1678
|
-
imageWrapHeight: PropTypes__default["default"].string
|
|
1741
|
+
imageWrapHeight: PropTypes__default["default"].string,
|
|
1742
|
+
layerBackgroundColor: PropTypes__default["default"].string
|
|
1679
1743
|
};
|
|
1680
1744
|
Modal.defaultProps = {
|
|
1681
1745
|
type: 'content'
|
|
@@ -1727,6 +1791,7 @@ const Input = ({
|
|
|
1727
1791
|
maxNumSize,
|
|
1728
1792
|
labelColor,
|
|
1729
1793
|
errorColor,
|
|
1794
|
+
withoutDot,
|
|
1730
1795
|
borderRight,
|
|
1731
1796
|
placeholder,
|
|
1732
1797
|
errorZindex,
|
|
@@ -1872,6 +1937,15 @@ const Input = ({
|
|
|
1872
1937
|
change(newStr);
|
|
1873
1938
|
}
|
|
1874
1939
|
}
|
|
1940
|
+
if (withoutDot && !/^\d+$/.test(currentValue)) {
|
|
1941
|
+
const newStr = currentValue.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
1942
|
+
return b + c.replace(/\./g, '');
|
|
1943
|
+
});
|
|
1944
|
+
setInnerValue(newStr);
|
|
1945
|
+
if (change) {
|
|
1946
|
+
change(newStr);
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1875
1949
|
if (currentValue === '') {
|
|
1876
1950
|
setInnerValue('');
|
|
1877
1951
|
if (change) {
|
|
@@ -2004,6 +2078,15 @@ const Input = ({
|
|
|
2004
2078
|
change(newStr);
|
|
2005
2079
|
}
|
|
2006
2080
|
}
|
|
2081
|
+
if (withoutDot && !/^\d+$/.test(value)) {
|
|
2082
|
+
const newStr = value.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
2083
|
+
return b + c.replace(/\./g, '');
|
|
2084
|
+
});
|
|
2085
|
+
setInnerValue(newStr);
|
|
2086
|
+
if (change) {
|
|
2087
|
+
change(newStr);
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2007
2090
|
if (value === '') {
|
|
2008
2091
|
setInnerValue('');
|
|
2009
2092
|
if (change) {
|
|
@@ -2143,6 +2226,7 @@ Input.propTypes = {
|
|
|
2143
2226
|
padding: PropTypes__default["default"].string,
|
|
2144
2227
|
fontSize: PropTypes__default["default"].string,
|
|
2145
2228
|
tooltip: PropTypes__default["default"].element,
|
|
2229
|
+
withoutDot: PropTypes__default["default"].bool,
|
|
2146
2230
|
marginTop: PropTypes__default["default"].string,
|
|
2147
2231
|
transform: PropTypes__default["default"].string,
|
|
2148
2232
|
className: PropTypes__default["default"].string,
|
|
@@ -2500,8 +2584,7 @@ const Select = ({
|
|
|
2500
2584
|
};
|
|
2501
2585
|
const isObjectEmpty = obj => {
|
|
2502
2586
|
for (var key in obj) {
|
|
2503
|
-
|
|
2504
|
-
if (obj.hasOwnProperty(key)) {
|
|
2587
|
+
if (hasOwnerProperty(obj, key)) {
|
|
2505
2588
|
return false;
|
|
2506
2589
|
}
|
|
2507
2590
|
}
|
|
@@ -3411,7 +3494,7 @@ for (let i = 0; i < 256; ++i) {
|
|
|
3411
3494
|
function unsafeStringify(arr, offset = 0) {
|
|
3412
3495
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
3413
3496
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
3414
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
3497
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
3415
3498
|
}
|
|
3416
3499
|
|
|
3417
3500
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
@@ -3631,6 +3714,7 @@ const FileItem = /*#__PURE__*/React__default["default"].memo(({
|
|
|
3631
3714
|
}, time));
|
|
3632
3715
|
return () => {
|
|
3633
3716
|
setI(_ => _);
|
|
3717
|
+
setT(_ => _);
|
|
3634
3718
|
clearTimeout(t);
|
|
3635
3719
|
clearInterval(i);
|
|
3636
3720
|
};
|
|
@@ -3890,6 +3974,7 @@ const NewFile = ({
|
|
|
3890
3974
|
listItemPadding,
|
|
3891
3975
|
progressFontSize,
|
|
3892
3976
|
borderHoverColor,
|
|
3977
|
+
maxCHoosenLength,
|
|
3893
3978
|
listItemErrorSize,
|
|
3894
3979
|
progressTrackColor,
|
|
3895
3980
|
fileAreaImageWidth,
|
|
@@ -3900,9 +3985,11 @@ const NewFile = ({
|
|
|
3900
3985
|
progressSuccessColor,
|
|
3901
3986
|
progressLoadingColor,
|
|
3902
3987
|
hiddenBackgroundColor,
|
|
3988
|
+
maxCHoosenLengthError,
|
|
3903
3989
|
extentionsRowMarginTop,
|
|
3904
3990
|
listItemBackgroundColor,
|
|
3905
|
-
listItemBackgroundErrorColor
|
|
3991
|
+
listItemBackgroundErrorColor,
|
|
3992
|
+
maxCHoosenLengthErrorHideTime
|
|
3906
3993
|
}) => {
|
|
3907
3994
|
const ref = React.useRef(null);
|
|
3908
3995
|
const inpRef = React.useRef(null);
|
|
@@ -3910,13 +3997,10 @@ const NewFile = ({
|
|
|
3910
3997
|
const [error, setError] = React.useState('');
|
|
3911
3998
|
const [isHover, setIsHover] = React.useState(false);
|
|
3912
3999
|
const [singleFile, setSingleFile] = React.useState(null);
|
|
4000
|
+
const [choosenFileCount, setChoosenFileCount] = React.useState(0);
|
|
3913
4001
|
const [image, setImage] = React.useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
|
|
3914
4002
|
const configStyles = compereConfigs();
|
|
3915
4003
|
const handleRemoveComponent = () => {
|
|
3916
|
-
// eslint-disable-next-line react/no-find-dom-node
|
|
3917
|
-
const node = ReactDOM__default["default"].findDOMNode(ref.current);
|
|
3918
|
-
const parent = node.parentNode;
|
|
3919
|
-
parent.removeChild(node);
|
|
3920
4004
|
if (!multiple) {
|
|
3921
4005
|
removeFile && removeFile(singleFile);
|
|
3922
4006
|
} else {
|
|
@@ -3928,11 +4012,47 @@ const NewFile = ({
|
|
|
3928
4012
|
setImage(null);
|
|
3929
4013
|
removeFile && removeFile(singleFile);
|
|
3930
4014
|
};
|
|
3931
|
-
const
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
4015
|
+
const handleUploadFiles = file => {
|
|
4016
|
+
if (maxCHoosenLength && choosenFileCount > 0) {
|
|
4017
|
+
if (file.length > choosenFileCount || file.length + memoizedItems.length > choosenFileCount) {
|
|
4018
|
+
setError(maxCHoosenLengthError ? maxCHoosenLengthError : `Դիմումին կարող եք կցել առավելագույնը ${choosenFileCount} ֆայլ`);
|
|
4019
|
+
const clearFunc = () => {
|
|
4020
|
+
clearTimeout(time);
|
|
4021
|
+
};
|
|
4022
|
+
const time = setTimeout(() => {
|
|
4023
|
+
setError('');
|
|
4024
|
+
clearFunc();
|
|
4025
|
+
}, maxCHoosenLengthErrorHideTime && typeof maxCHoosenLengthErrorHideTime === 'number' ? Math.round(maxCHoosenLengthErrorHideTime) : 3000);
|
|
4026
|
+
} else {
|
|
4027
|
+
for (let ix = 0; ix < file.length; ix++) {
|
|
4028
|
+
if (file[ix]) {
|
|
4029
|
+
if (file[ix].size <= maxSize * Math.pow(2, 20)) {
|
|
4030
|
+
if (fileExtensions.includes(file[ix].type.split('/')[1]) || fileExtensions.includes('heic') && file[ix].type.split('/')[1] === 'heif') {
|
|
4031
|
+
change({
|
|
4032
|
+
id: '',
|
|
4033
|
+
check: '',
|
|
4034
|
+
status: '',
|
|
4035
|
+
file: file[ix],
|
|
4036
|
+
uuid: v4()
|
|
4037
|
+
});
|
|
4038
|
+
} else {
|
|
4039
|
+
change({
|
|
4040
|
+
file: file[ix],
|
|
4041
|
+
uuid: v4(),
|
|
4042
|
+
check: formatError
|
|
4043
|
+
});
|
|
4044
|
+
}
|
|
4045
|
+
} else {
|
|
4046
|
+
change({
|
|
4047
|
+
file: file[ix],
|
|
4048
|
+
uuid: v4(),
|
|
4049
|
+
check: maxSizeError
|
|
4050
|
+
});
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
4055
|
+
} else {
|
|
3936
4056
|
for (let ix = 0; ix < file.length; ix++) {
|
|
3937
4057
|
if (file[ix]) {
|
|
3938
4058
|
if (file[ix].size <= maxSize * Math.pow(2, 20)) {
|
|
@@ -3960,6 +4080,14 @@ const NewFile = ({
|
|
|
3960
4080
|
}
|
|
3961
4081
|
}
|
|
3962
4082
|
}
|
|
4083
|
+
}
|
|
4084
|
+
};
|
|
4085
|
+
const handleChange = e => {
|
|
4086
|
+
const file = e.target.files;
|
|
4087
|
+
if (multiple) {
|
|
4088
|
+
setError('');
|
|
4089
|
+
setImage(null);
|
|
4090
|
+
handleUploadFiles(file);
|
|
3963
4091
|
if (file.length === 0 && memoizedItems.length === 0) {
|
|
3964
4092
|
setError(noChoosenFile);
|
|
3965
4093
|
}
|
|
@@ -4041,7 +4169,18 @@ const NewFile = ({
|
|
|
4041
4169
|
if (multiple && !removeFile) {
|
|
4042
4170
|
alert('Please add removeFile prop on NewFile component, it is a require in multiple mode');
|
|
4043
4171
|
}
|
|
4044
|
-
|
|
4172
|
+
if (maxCHoosenLength) {
|
|
4173
|
+
if (typeof maxCHoosenLength !== 'number') {
|
|
4174
|
+
alert('maxCHoosenLength prop must be a number, please check it!');
|
|
4175
|
+
} else {
|
|
4176
|
+
if (maxCHoosenLength <= 0) {
|
|
4177
|
+
setChoosenFileCount(1);
|
|
4178
|
+
} else {
|
|
4179
|
+
setChoosenFileCount(Math.round(maxCHoosenLength));
|
|
4180
|
+
}
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
}, [multiple, removeFile, filesArray && filesArray.length, defaultData, maxCHoosenLength]);
|
|
4045
4184
|
React.useEffect(() => {
|
|
4046
4185
|
if (deleteComponent && !removeComponent) {
|
|
4047
4186
|
alert('Please add removeComponent prop on NewFile component it is require when deleteComponent prop is true');
|
|
@@ -4243,6 +4382,7 @@ NewFile.propTypes = {
|
|
|
4243
4382
|
backgroundColor: PropTypes__default["default"].string,
|
|
4244
4383
|
change: PropTypes__default["default"].func.isRequired,
|
|
4245
4384
|
listItemPadding: PropTypes__default["default"].string,
|
|
4385
|
+
maxCHoosenLength: PropTypes__default["default"].number,
|
|
4246
4386
|
progressFontSize: PropTypes__default["default"].string,
|
|
4247
4387
|
borderHoverColor: PropTypes__default["default"].string,
|
|
4248
4388
|
listItemErrorSize: PropTypes__default["default"].string,
|
|
@@ -4255,9 +4395,11 @@ NewFile.propTypes = {
|
|
|
4255
4395
|
progressSuccessColor: PropTypes__default["default"].string,
|
|
4256
4396
|
progressLoadingColor: PropTypes__default["default"].string,
|
|
4257
4397
|
hiddenBackgroundColor: PropTypes__default["default"].string,
|
|
4398
|
+
maxCHoosenLengthError: PropTypes__default["default"].string,
|
|
4258
4399
|
extentionsRowMarginTop: PropTypes__default["default"].string,
|
|
4259
4400
|
listItemBackgroundColor: PropTypes__default["default"].string,
|
|
4260
4401
|
listItemBackgroundErrorColor: PropTypes__default["default"].string,
|
|
4402
|
+
maxCHoosenLengthErrorHideTime: PropTypes__default["default"].number,
|
|
4261
4403
|
filesArray: PropTypes__default["default"].arrayOf(PropTypes__default["default"].object),
|
|
4262
4404
|
fileExtensions: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string)
|
|
4263
4405
|
};
|
|
@@ -4412,16 +4554,10 @@ const Textarea = ({
|
|
|
4412
4554
|
if (maxLength) {
|
|
4413
4555
|
if (value.length > maxLength) {
|
|
4414
4556
|
onChange(value.substr(0, maxLength));
|
|
4415
|
-
setError('Նիշերի քանակը գերազանցում է');
|
|
4416
|
-
} else {
|
|
4417
|
-
setError('');
|
|
4418
4557
|
}
|
|
4419
4558
|
} else {
|
|
4420
4559
|
if (value.length > configStyles.TEXTAREA.maxLength) {
|
|
4421
|
-
setError('Նիշերի քանակը գերազանցում է');
|
|
4422
4560
|
onChange(value.substr(0, configStyles.TEXTAREA.maxLength));
|
|
4423
|
-
} else {
|
|
4424
|
-
setError('');
|
|
4425
4561
|
}
|
|
4426
4562
|
}
|
|
4427
4563
|
};
|
|
@@ -4632,7 +4768,7 @@ Typography.propTypes = {
|
|
|
4632
4768
|
textDecoration: PropTypes__default["default"].string,
|
|
4633
4769
|
backgroundColor: PropTypes__default["default"].string,
|
|
4634
4770
|
variant: PropTypes__default["default"].oneOf(Object.values(TypographyType)),
|
|
4635
|
-
size: PropTypes__default["default"].
|
|
4771
|
+
size: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])
|
|
4636
4772
|
};
|
|
4637
4773
|
Typography.defaultProps = {
|
|
4638
4774
|
variant: 'p'
|
|
@@ -5220,8 +5356,7 @@ const NewAutocomplete = ({
|
|
|
5220
5356
|
alert('Please add options prop');
|
|
5221
5357
|
}
|
|
5222
5358
|
options && options.length > 0 && options.map(item => {
|
|
5223
|
-
|
|
5224
|
-
if (!item.hasOwnProperty(keyNames.name)) {
|
|
5359
|
+
if (!hasOwnerProperty(item, keyNames.name)) {
|
|
5225
5360
|
alert(`Please add ${keyNames.name} property in items of options array`);
|
|
5226
5361
|
}
|
|
5227
5362
|
});
|