@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.es.js
CHANGED
|
@@ -224,6 +224,9 @@ const compereConfigs = () => {
|
|
|
224
224
|
|
|
225
225
|
return _.merge(packageConfig, projectConfig);
|
|
226
226
|
};
|
|
227
|
+
const hasOwnerProperty = (object, property) => {
|
|
228
|
+
return Object.prototype.hasOwnProperty.call(object, property);
|
|
229
|
+
};
|
|
227
230
|
|
|
228
231
|
const SvgCheckboxUnchecked = ({
|
|
229
232
|
title,
|
|
@@ -379,6 +382,11 @@ const TH = ({
|
|
|
379
382
|
handleHeaderItemClick,
|
|
380
383
|
handleCheckArrowActionHeader
|
|
381
384
|
}) => {
|
|
385
|
+
const handleCheckArrowAction = (e, object, property) => {
|
|
386
|
+
if (hasOwnerProperty(object, property)) {
|
|
387
|
+
handleCheckArrowActionHeader(e, object);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
382
390
|
return /*#__PURE__*/React__default.createElement("th", {
|
|
383
391
|
style: {
|
|
384
392
|
width: 'auto',
|
|
@@ -398,9 +406,9 @@ const TH = ({
|
|
|
398
406
|
style: {
|
|
399
407
|
display: 'flex',
|
|
400
408
|
alignItems: 'flex-start',
|
|
401
|
-
justifyContent:
|
|
409
|
+
justifyContent: hasOwnerProperty(item, 'checkBox') ? 'space-between' : 'center'
|
|
402
410
|
}
|
|
403
|
-
}, item
|
|
411
|
+
}, hasOwnerProperty(item, 'checkBox') ? /*#__PURE__*/React__default.createElement(SingleCheckbox, {
|
|
404
412
|
data: item,
|
|
405
413
|
float: "left",
|
|
406
414
|
checked: item.checkBox.checked,
|
|
@@ -412,8 +420,8 @@ const TH = ({
|
|
|
412
420
|
style: {
|
|
413
421
|
margin: '0px'
|
|
414
422
|
},
|
|
415
|
-
onClick:
|
|
416
|
-
}, item.type === 'show' ? item.content :
|
|
423
|
+
onClick: e => handleCheckArrowAction(e, item, 'arrowComponent')
|
|
424
|
+
}, item.type === 'show' ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : '')));
|
|
417
425
|
};
|
|
418
426
|
|
|
419
427
|
const TD = ({
|
|
@@ -446,6 +454,34 @@ const TD = ({
|
|
|
446
454
|
};
|
|
447
455
|
handleBodyActionClick(e, actionData);
|
|
448
456
|
};
|
|
457
|
+
const handleCheckActions = (e, object, property, objectIndex) => {
|
|
458
|
+
if (hasOwnerProperty(object, property)) {
|
|
459
|
+
handleBodyAction(e, {
|
|
460
|
+
item: object,
|
|
461
|
+
itemIndex: objectIndex
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
const handleMoreOptions = (item, index, optionItem, innerIndex, optionIndex, options) => {
|
|
466
|
+
handleMoreOptionsClick({
|
|
467
|
+
item,
|
|
468
|
+
index,
|
|
469
|
+
options,
|
|
470
|
+
optionItem,
|
|
471
|
+
innerIndex,
|
|
472
|
+
optionIndex
|
|
473
|
+
});
|
|
474
|
+
};
|
|
475
|
+
const handleContentList = (e, item, index, innerIndex, listContentId, listContent, listContentIndex) => {
|
|
476
|
+
handleContentListClick(e, {
|
|
477
|
+
item,
|
|
478
|
+
index,
|
|
479
|
+
innerIndex,
|
|
480
|
+
listContentId,
|
|
481
|
+
listContent,
|
|
482
|
+
listContentIndex
|
|
483
|
+
});
|
|
484
|
+
};
|
|
449
485
|
return /*#__PURE__*/React__default.createElement("td", {
|
|
450
486
|
style: {
|
|
451
487
|
width: 'auto',
|
|
@@ -458,7 +494,7 @@ const TD = ({
|
|
|
458
494
|
textAlign: tBodyTextAlign,
|
|
459
495
|
fontFamily: tBodyFontFamily,
|
|
460
496
|
fontWeight: tBodyFontWeight,
|
|
461
|
-
boxShadow:
|
|
497
|
+
boxShadow: hasOwnerProperty(item, 'colorStatus') ? `inset 3px 0px 0px 0px ${item.colorStatus}` : ''
|
|
462
498
|
}
|
|
463
499
|
}, Array.isArray(item) ? item.length > 0 ? item.map((newItem, newIndex) => {
|
|
464
500
|
if (newItem && !Array.isArray(newItem) && typeof newItem === 'object') {
|
|
@@ -467,16 +503,13 @@ const TD = ({
|
|
|
467
503
|
width: '32px',
|
|
468
504
|
height: '32px',
|
|
469
505
|
marginRight: '10px',
|
|
470
|
-
cursor:
|
|
506
|
+
cursor: hasOwnerProperty(newItem, 'type') ? 'pointer' : 'auto'
|
|
471
507
|
},
|
|
472
508
|
id: newItem.id,
|
|
473
509
|
type: newItem.type,
|
|
474
510
|
className: styles$c['td-span'],
|
|
475
511
|
key: `${newItem.id}_${newIndex}`,
|
|
476
|
-
onClick:
|
|
477
|
-
item: newItem,
|
|
478
|
-
itemIndex: newIndex
|
|
479
|
-
}) : _ => _
|
|
512
|
+
onClick: e => handleCheckActions(e, newItem, 'type', newIndex)
|
|
480
513
|
}, newItem.content);
|
|
481
514
|
} else if (newItem && Array.isArray(newItem)) {
|
|
482
515
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -492,15 +525,12 @@ const TD = ({
|
|
|
492
525
|
width: '32px',
|
|
493
526
|
height: '32px',
|
|
494
527
|
marginRight: '10px',
|
|
495
|
-
cursor:
|
|
528
|
+
cursor: hasOwnerProperty(iT, 'type') ? 'pointer' : 'auto'
|
|
496
529
|
},
|
|
497
530
|
id: iT.id ? iT.id : '',
|
|
498
531
|
type: iT.type ? iT.type : '',
|
|
499
532
|
className: styles$c['td-span'],
|
|
500
|
-
onClick:
|
|
501
|
-
item: iT,
|
|
502
|
-
itemIndex: iN
|
|
503
|
-
}) : _ => _,
|
|
533
|
+
onClick: e => handleCheckActions(e, iT, 'type', iN),
|
|
504
534
|
key: `${iT.id || iT.content}_${iN}`
|
|
505
535
|
}, iT.content);
|
|
506
536
|
}));
|
|
@@ -513,18 +543,18 @@ const TD = ({
|
|
|
513
543
|
style: {
|
|
514
544
|
display: 'flex',
|
|
515
545
|
alignItems: 'flex-start',
|
|
516
|
-
justifyContent:
|
|
546
|
+
justifyContent: hasOwnerProperty(item, 'checkBox') ? 'space-between' : 'center'
|
|
517
547
|
}
|
|
518
|
-
},
|
|
548
|
+
}, !hasOwnerProperty(item, 'hideArrow') && item.hideArrow !== false && (!hasOwnerProperty(item, 'rightArrow') || item.rightArrow !== true) ? hasOwnerProperty(item, 'contentList') && (hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow')) && /*#__PURE__*/React__default.createElement("div", {
|
|
519
549
|
id: item.id,
|
|
520
550
|
style: {
|
|
521
551
|
width: '21px',
|
|
522
552
|
height: '21px',
|
|
523
553
|
cursor: 'pointer'
|
|
524
554
|
},
|
|
525
|
-
onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex),
|
|
555
|
+
onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
|
|
526
556
|
className: styles$c['td-span']
|
|
527
|
-
}, item.status === 'close' ? item.closeArrow : item.openArrow),
|
|
557
|
+
}, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, 'checkBox') && /*#__PURE__*/React__default.createElement(SingleCheckbox, {
|
|
528
558
|
data: item,
|
|
529
559
|
index: index,
|
|
530
560
|
innerIndex: innerIndex,
|
|
@@ -535,15 +565,16 @@ const TD = ({
|
|
|
535
565
|
unCheckedColor: item.checkBox.unCheckedColor
|
|
536
566
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
537
567
|
style: {
|
|
538
|
-
marginLeft: item
|
|
568
|
+
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',
|
|
569
|
+
marginRight: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '10px' : '0px' : '0px' : '0px'
|
|
539
570
|
}
|
|
540
571
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
541
572
|
style: {
|
|
542
573
|
margin: '0px',
|
|
543
|
-
cursor:
|
|
574
|
+
cursor: hasOwnerProperty(item, 'arrowComponent') || hasOwnerProperty(item, 'dots') ? 'pointer' : 'auto'
|
|
544
575
|
},
|
|
545
|
-
onClick:
|
|
546
|
-
}, item.content ? item.content :
|
|
576
|
+
onClick: hasOwnerProperty(item, 'arrowComponent') ? () => handleCheckArrowAction(item, item.checkIndex) : hasOwnerProperty(item, 'dots') ? e => handleCheckDots(e, item, index, innerIndex) : _ => _
|
|
577
|
+
}, item.content ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : hasOwnerProperty(item, 'dots') ? /*#__PURE__*/React__default.createElement("span", {
|
|
547
578
|
style: {
|
|
548
579
|
display: 'block',
|
|
549
580
|
position: 'relative'
|
|
@@ -564,7 +595,7 @@ const TD = ({
|
|
|
564
595
|
backgroundColor: '#FFFFFF',
|
|
565
596
|
boxShadow: '0px 0px 20px 0px #3C393E4D'
|
|
566
597
|
}
|
|
567
|
-
},
|
|
598
|
+
}, hasOwnerProperty(item, 'options') && item.options.map((optionItem, optionIndex) => {
|
|
568
599
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
569
600
|
key: `${optionItem.content}_${optionIndex}`,
|
|
570
601
|
className: styles$c['dots-option-item'],
|
|
@@ -573,14 +604,7 @@ const TD = ({
|
|
|
573
604
|
fontSize: '14px',
|
|
574
605
|
fontFamily: 'Noto Sans Armenian'
|
|
575
606
|
},
|
|
576
|
-
onClick: () =>
|
|
577
|
-
item,
|
|
578
|
-
index,
|
|
579
|
-
optionItem,
|
|
580
|
-
innerIndex,
|
|
581
|
-
optionIndex,
|
|
582
|
-
options: item.options
|
|
583
|
-
})
|
|
607
|
+
onClick: () => handleMoreOptions(item, index, optionItem, innerIndex, optionIndex, item.options)
|
|
584
608
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
585
609
|
style: {
|
|
586
610
|
marginRight: '10px'
|
|
@@ -591,11 +615,12 @@ const TD = ({
|
|
|
591
615
|
textAlign: 'left',
|
|
592
616
|
overflow: 'hidden',
|
|
593
617
|
whiteSpace: 'nowrap',
|
|
594
|
-
textOverflow: 'ellipsis'
|
|
618
|
+
textOverflow: 'ellipsis',
|
|
619
|
+
marginBottom: '5px'
|
|
595
620
|
},
|
|
596
621
|
title: optionItem.content
|
|
597
622
|
}, optionItem.content));
|
|
598
|
-
}))) : ''),
|
|
623
|
+
}))) : ''), hasOwnerProperty(item, 'contentList') && /*#__PURE__*/React__default.createElement("div", {
|
|
599
624
|
style: {
|
|
600
625
|
overflow: 'auto',
|
|
601
626
|
marginTop: '10px',
|
|
@@ -611,16 +636,18 @@ const TD = ({
|
|
|
611
636
|
color: openListColor,
|
|
612
637
|
maxWidth: (item.content.length * 9 <= 100 ? 100 : item.content.length * 9) + 'px'
|
|
613
638
|
},
|
|
614
|
-
onClick: e =>
|
|
615
|
-
item,
|
|
616
|
-
index,
|
|
617
|
-
innerIndex,
|
|
618
|
-
listContentId: innerItem.id,
|
|
619
|
-
listContent: innerItem.content,
|
|
620
|
-
listContentIndex: innerItemIndex
|
|
621
|
-
})
|
|
639
|
+
onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex)
|
|
622
640
|
}, innerItem.content);
|
|
623
|
-
}))))
|
|
641
|
+
}))), !hasOwnerProperty(item, 'hideArrow') && item.hideArrow !== false && hasOwnerProperty(item, 'rightArrow') && item.rightArrow === true ? hasOwnerProperty(item, 'contentList') && (hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow')) && /*#__PURE__*/React__default.createElement("div", {
|
|
642
|
+
id: item.id,
|
|
643
|
+
style: {
|
|
644
|
+
width: '21px',
|
|
645
|
+
height: '21px',
|
|
646
|
+
cursor: 'pointer'
|
|
647
|
+
},
|
|
648
|
+
onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
|
|
649
|
+
className: styles$c['td-span']
|
|
650
|
+
}, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '') : '');
|
|
624
651
|
};
|
|
625
652
|
|
|
626
653
|
const SvgUpArrow = ({
|
|
@@ -708,7 +735,7 @@ const Table = ({
|
|
|
708
735
|
bodyData.map((item, index) => {
|
|
709
736
|
if (index === data.index) {
|
|
710
737
|
item.map((innerItem, innerIndex) => {
|
|
711
|
-
if (
|
|
738
|
+
if (hasOwnerProperty(innerItem, 'arrowComponent')) {
|
|
712
739
|
removeItemIndex = innerIndex;
|
|
713
740
|
}
|
|
714
741
|
});
|
|
@@ -732,7 +759,7 @@ const Table = ({
|
|
|
732
759
|
let removeItemIndex;
|
|
733
760
|
let headerWithoutArrow;
|
|
734
761
|
header.map((item, index) => {
|
|
735
|
-
if (
|
|
762
|
+
if (hasOwnerProperty(item, 'arrowComponent')) {
|
|
736
763
|
removeItemIndex = index;
|
|
737
764
|
}
|
|
738
765
|
});
|
|
@@ -772,7 +799,7 @@ const Table = ({
|
|
|
772
799
|
let checkedItems = [];
|
|
773
800
|
data.map((item, index) => {
|
|
774
801
|
item.map((innerItem, innerIndex) => {
|
|
775
|
-
if (
|
|
802
|
+
if (hasOwnerProperty(innerItem, 'checkBox')) {
|
|
776
803
|
if (!checkedItems[innerIndex]) {
|
|
777
804
|
checkedItems[innerIndex] = [];
|
|
778
805
|
}
|
|
@@ -852,7 +879,7 @@ const Table = ({
|
|
|
852
879
|
checkableItemBool = !item.checkBox.checked;
|
|
853
880
|
item.checkBox.checked = !item.checkBox.checked;
|
|
854
881
|
}
|
|
855
|
-
if (
|
|
882
|
+
if (hasOwnerProperty(item, 'arrowComponent')) {
|
|
856
883
|
removeItemIndex = index;
|
|
857
884
|
}
|
|
858
885
|
return item;
|
|
@@ -860,11 +887,13 @@ const Table = ({
|
|
|
860
887
|
const newUpdatedBody = updatedBody.map((item, index) => {
|
|
861
888
|
return item.map((innerItem, innerIndex) => {
|
|
862
889
|
if (checkableItemIndex === innerIndex) {
|
|
863
|
-
innerItem.checkBox.
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
890
|
+
if (!hasOwnerProperty(innerItem.checkBox, 'disabled') || innerItem.checkBox.disabled !== true) {
|
|
891
|
+
innerItem.checkBox.checked = checkableItemBool;
|
|
892
|
+
checkableBodyRowItems.push({
|
|
893
|
+
column: innerIndex,
|
|
894
|
+
columnItem: innerItem
|
|
895
|
+
});
|
|
896
|
+
}
|
|
868
897
|
handleHeaderCheckedUpdate({
|
|
869
898
|
row: index,
|
|
870
899
|
column: innerIndex,
|
|
@@ -902,7 +931,7 @@ const Table = ({
|
|
|
902
931
|
const updatedBody = body.slice().map(item => Object.values(item));
|
|
903
932
|
const newData = updatedBody.map((item, index) => {
|
|
904
933
|
return item.map((innerItem, innerIndex) => {
|
|
905
|
-
if (innerItem.id === data.id && innerItem.content == data.content &&
|
|
934
|
+
if (innerItem.id === data.id && innerItem.content == data.content && hasOwnerProperty(innerItem, 'checkBox')) {
|
|
906
935
|
innerItem.checkBox.checked = !innerItem.checkBox.checked;
|
|
907
936
|
handleHeaderCheckedUpdate({
|
|
908
937
|
row: index,
|
|
@@ -959,7 +988,7 @@ const Table = ({
|
|
|
959
988
|
const handleCheckArrowAction = (item, rowPosition) => {
|
|
960
989
|
const status = item.status;
|
|
961
990
|
const checkedOpenableRow = body[rowPosition].map(innerItem => {
|
|
962
|
-
if (
|
|
991
|
+
if (hasOwnerProperty(innerItem, 'status')) {
|
|
963
992
|
if (status === 'close') {
|
|
964
993
|
innerItem.status = 'open';
|
|
965
994
|
} else {
|
|
@@ -973,7 +1002,8 @@ const Table = ({
|
|
|
973
1002
|
return [...prev];
|
|
974
1003
|
});
|
|
975
1004
|
};
|
|
976
|
-
const handleOpenCloseRowSingleArrow = (arrowRowIndex, arrowIndex) => {
|
|
1005
|
+
const handleOpenCloseRowSingleArrow = (arrowRowIndex, arrowIndex, clickableItem) => {
|
|
1006
|
+
console.log(clickableItem, 'clickableItem');
|
|
977
1007
|
let single = {};
|
|
978
1008
|
const allArrows = [];
|
|
979
1009
|
const checkedOpenableRow = body[arrowRowIndex].map((item, index) => {
|
|
@@ -985,13 +1015,13 @@ const Table = ({
|
|
|
985
1015
|
}
|
|
986
1016
|
single = item;
|
|
987
1017
|
}
|
|
988
|
-
if (
|
|
1018
|
+
if (hasOwnerProperty(item, 'status') && !hasOwnerProperty(item, 'arrowComponent')) {
|
|
989
1019
|
allArrows.push(item);
|
|
990
1020
|
}
|
|
991
1021
|
return item;
|
|
992
1022
|
});
|
|
993
1023
|
const checkedOpenableRowArrow = checkedOpenableRow.map(item => {
|
|
994
|
-
if (
|
|
1024
|
+
if (hasOwnerProperty(item, 'arrowComponent')) {
|
|
995
1025
|
if (single && single.status === 'close') {
|
|
996
1026
|
item.status = 'close';
|
|
997
1027
|
} else if (single && single.status === 'open') {
|
|
@@ -1000,6 +1030,9 @@ const Table = ({
|
|
|
1000
1030
|
}
|
|
1001
1031
|
}
|
|
1002
1032
|
}
|
|
1033
|
+
if (hasOwnerProperty(clickableItem, 'theSame') && hasOwnerProperty(item, 'theSame') && clickableItem.theSame === item.theSame) {
|
|
1034
|
+
item.status = clickableItem.status;
|
|
1035
|
+
}
|
|
1003
1036
|
return item;
|
|
1004
1037
|
});
|
|
1005
1038
|
setBody(prev => {
|
|
@@ -1021,7 +1054,7 @@ const Table = ({
|
|
|
1021
1054
|
});
|
|
1022
1055
|
const checkedOpenableAllRowsBody = body.map(innerItem => {
|
|
1023
1056
|
return innerItem.map(iElem => {
|
|
1024
|
-
if (
|
|
1057
|
+
if (hasOwnerProperty(iElem, 'status')) {
|
|
1025
1058
|
if (item.status === 'open') {
|
|
1026
1059
|
iElem.status = 'open';
|
|
1027
1060
|
} else {
|
|
@@ -1038,7 +1071,7 @@ const Table = ({
|
|
|
1038
1071
|
e.stopPropagation();
|
|
1039
1072
|
const checkBodyMore = body.map((elemItem, elemIndex) => {
|
|
1040
1073
|
return elemItem.map((elemInnerItem, elemInnerIndex) => {
|
|
1041
|
-
if (elemIndex === index &&
|
|
1074
|
+
if (elemIndex === index && hasOwnerProperty(elemInnerItem, 'dots')) {
|
|
1042
1075
|
if (elemInnerIndex === innerIndex) {
|
|
1043
1076
|
if (item.dotsStatus === 'deActive') {
|
|
1044
1077
|
elemInnerItem.dotsStatus = 'active';
|
|
@@ -1046,7 +1079,7 @@ const Table = ({
|
|
|
1046
1079
|
elemInnerItem.dotsStatus = 'deActive';
|
|
1047
1080
|
}
|
|
1048
1081
|
}
|
|
1049
|
-
} else if (elemIndex !== index &&
|
|
1082
|
+
} else if (elemIndex !== index && hasOwnerProperty(elemInnerItem, 'dots')) {
|
|
1050
1083
|
if (elemInnerIndex === innerIndex) {
|
|
1051
1084
|
elemInnerItem.dotsStatus = 'deActive';
|
|
1052
1085
|
}
|
|
@@ -1056,20 +1089,6 @@ const Table = ({
|
|
|
1056
1089
|
});
|
|
1057
1090
|
setBody(() => checkBodyMore);
|
|
1058
1091
|
};
|
|
1059
|
-
const handleCheckDisable = (arr, disableArr) => {
|
|
1060
|
-
let headerWithDisabled = [];
|
|
1061
|
-
if (disableArr && disableArr.length > 0) {
|
|
1062
|
-
headerWithDisabled = arr.map((item, index) => {
|
|
1063
|
-
if (disableArr[index]) {
|
|
1064
|
-
if (Object.prototype.hasOwnProperty.call(item, 'checkBox')) {
|
|
1065
|
-
item.checkBox.disabled = true;
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
return item;
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
return headerWithDisabled;
|
|
1072
|
-
};
|
|
1073
1092
|
const handleContentListClick = (e, data) => {
|
|
1074
1093
|
e.stopPropagation();
|
|
1075
1094
|
const {
|
|
@@ -1108,7 +1127,7 @@ const Table = ({
|
|
|
1108
1127
|
const handleTableClick = () => {
|
|
1109
1128
|
const checkBodyMore = body.map(elemItem => {
|
|
1110
1129
|
return elemItem.map(elemInnerItem => {
|
|
1111
|
-
if (
|
|
1130
|
+
if (hasOwnerProperty(elemInnerItem, 'dots')) {
|
|
1112
1131
|
elemInnerItem.dotsStatus = 'deActive';
|
|
1113
1132
|
}
|
|
1114
1133
|
return elemInnerItem;
|
|
@@ -1125,8 +1144,8 @@ const Table = ({
|
|
|
1125
1144
|
const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
|
|
1126
1145
|
const insert = checkForInsertArrow.map((item, index) => {
|
|
1127
1146
|
item.map((innerItem, innerIndex) => {
|
|
1128
|
-
if (
|
|
1129
|
-
if (
|
|
1147
|
+
if (hasOwnerProperty(innerItem, 'checkBox')) {
|
|
1148
|
+
if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
|
|
1130
1149
|
if (innerItem.checkBox.disabled === true) {
|
|
1131
1150
|
if (!disabledArray[innerIndex]) {
|
|
1132
1151
|
disabledArray[innerIndex] = {
|
|
@@ -1145,8 +1164,8 @@ const Table = ({
|
|
|
1145
1164
|
} else {
|
|
1146
1165
|
const insert = checkBodyForChackedItems.map((item, index) => {
|
|
1147
1166
|
item.map((innerItem, innerIndex) => {
|
|
1148
|
-
if (
|
|
1149
|
-
if (
|
|
1167
|
+
if (hasOwnerProperty(innerItem, 'checkBox')) {
|
|
1168
|
+
if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
|
|
1150
1169
|
if (innerItem.checkBox.disabled === true) {
|
|
1151
1170
|
if (!disabledArray[innerIndex]) {
|
|
1152
1171
|
disabledArray[innerIndex] = {
|
|
@@ -1171,11 +1190,9 @@ const Table = ({
|
|
|
1171
1190
|
const header = dataHeader.slice();
|
|
1172
1191
|
const arrowColumnCount = handleSetInsertIndex(header, arrowColumn);
|
|
1173
1192
|
const checkForInsertArrow = handleTransformDataForInsertArrow(header, arrowColumnCount, 'header');
|
|
1174
|
-
|
|
1175
|
-
setHeader(() => headerWithDisabled.length > 0 ? headerWithDisabled : checkForInsertArrow);
|
|
1193
|
+
setHeader(() => checkForInsertArrow);
|
|
1176
1194
|
} else {
|
|
1177
|
-
|
|
1178
|
-
setHeader(() => headerWithDisabled.length > 0 ? headerWithDisabled : dataHeader);
|
|
1195
|
+
setHeader(() => dataHeader);
|
|
1179
1196
|
}
|
|
1180
1197
|
}, [dataHeader, arrowColumn, arrowShow, disableArr]);
|
|
1181
1198
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("table", {
|
|
@@ -1313,6 +1330,26 @@ const SvgPrev = ({
|
|
|
1313
1330
|
fill: "#3C393E"
|
|
1314
1331
|
}));
|
|
1315
1332
|
|
|
1333
|
+
const SvgZoom = ({
|
|
1334
|
+
title,
|
|
1335
|
+
titleId,
|
|
1336
|
+
...props
|
|
1337
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends({
|
|
1338
|
+
width: "32",
|
|
1339
|
+
height: "32",
|
|
1340
|
+
viewBox: "0 0 32 32",
|
|
1341
|
+
fill: "none",
|
|
1342
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1343
|
+
"aria-labelledby": titleId
|
|
1344
|
+
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
|
1345
|
+
id: titleId
|
|
1346
|
+
}, title) : null, /*#__PURE__*/React.createElement("path", {
|
|
1347
|
+
fillRule: "evenodd",
|
|
1348
|
+
clipRule: "evenodd",
|
|
1349
|
+
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",
|
|
1350
|
+
fill: "#fff"
|
|
1351
|
+
}));
|
|
1352
|
+
|
|
1316
1353
|
const SvgCloseIcon = ({
|
|
1317
1354
|
title,
|
|
1318
1355
|
titleId,
|
|
@@ -1358,6 +1395,7 @@ const Modal = ({
|
|
|
1358
1395
|
height,
|
|
1359
1396
|
padding,
|
|
1360
1397
|
setShow,
|
|
1398
|
+
zoomIcon,
|
|
1361
1399
|
selected,
|
|
1362
1400
|
children,
|
|
1363
1401
|
minWidth,
|
|
@@ -1374,17 +1412,18 @@ const Modal = ({
|
|
|
1374
1412
|
borderStyle,
|
|
1375
1413
|
borderWidth,
|
|
1376
1414
|
borderColor,
|
|
1415
|
+
imageMargin,
|
|
1416
|
+
showZoomIcon,
|
|
1377
1417
|
outsideClose,
|
|
1378
1418
|
headerWeight,
|
|
1379
1419
|
headerHeight,
|
|
1420
|
+
imageMaxWidth,
|
|
1380
1421
|
justifyContent,
|
|
1422
|
+
imageWrapWidth,
|
|
1381
1423
|
backgroundColor,
|
|
1424
|
+
imageWrapHeight,
|
|
1382
1425
|
grayDecorHeight,
|
|
1383
|
-
layerBackgroundColor
|
|
1384
|
-
imageMargin,
|
|
1385
|
-
imageMaxWidth,
|
|
1386
|
-
imageWrapWidth,
|
|
1387
|
-
imageWrapHeight
|
|
1426
|
+
layerBackgroundColor
|
|
1388
1427
|
}) => {
|
|
1389
1428
|
const [select, setSelect] = useState(0);
|
|
1390
1429
|
const [innerData, setInnerData] = useState([]);
|
|
@@ -1416,6 +1455,11 @@ const Modal = ({
|
|
|
1416
1455
|
handleCloseModal();
|
|
1417
1456
|
}
|
|
1418
1457
|
};
|
|
1458
|
+
const handleOpenInNewTab = url => {
|
|
1459
|
+
const imageLink = document.createElement('a');
|
|
1460
|
+
imageLink.href = url, imageLink.target = '_blank';
|
|
1461
|
+
imageLink.click();
|
|
1462
|
+
};
|
|
1419
1463
|
useEffect(() => {
|
|
1420
1464
|
if (type === 'images') {
|
|
1421
1465
|
if (data) {
|
|
@@ -1563,11 +1607,12 @@ const Modal = ({
|
|
|
1563
1607
|
}
|
|
1564
1608
|
}, innerData && innerData.length > 0 && innerData.map((item, index) => {
|
|
1565
1609
|
if (select === index) {
|
|
1566
|
-
|
|
1567
|
-
if (!item.hasOwnProperty('url')) {
|
|
1610
|
+
if (!hasOwnerProperty(item, 'url')) {
|
|
1568
1611
|
alert('Please add url property in data prop on each element');
|
|
1569
1612
|
} else {
|
|
1570
|
-
return /*#__PURE__*/React__default.createElement("
|
|
1613
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
|
1614
|
+
key: `${item.url}_${item.id ? item.id : '007'}_${index}`
|
|
1615
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
1571
1616
|
style: {
|
|
1572
1617
|
display: 'block',
|
|
1573
1618
|
objectFit: 'cover',
|
|
@@ -1578,9 +1623,26 @@ const Modal = ({
|
|
|
1578
1623
|
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight,
|
|
1579
1624
|
maxWidth: imageMaxWidth ? imageMaxWidth : configStyles.MODAL.imageMaxWidth
|
|
1580
1625
|
},
|
|
1581
|
-
src: item.url
|
|
1582
|
-
|
|
1583
|
-
|
|
1626
|
+
src: item.url
|
|
1627
|
+
}), showZoomIcon ? /*#__PURE__*/React__default.createElement("div", {
|
|
1628
|
+
style: {
|
|
1629
|
+
top: '0px',
|
|
1630
|
+
left: '0px',
|
|
1631
|
+
zIndex: '10',
|
|
1632
|
+
right: '0px',
|
|
1633
|
+
bottom: '0px',
|
|
1634
|
+
margin: 'auto',
|
|
1635
|
+
display: 'flex',
|
|
1636
|
+
maxWidth: '40px',
|
|
1637
|
+
maxHeight: '40px',
|
|
1638
|
+
cursor: 'pointer',
|
|
1639
|
+
overflow: 'hidden',
|
|
1640
|
+
position: 'absolute',
|
|
1641
|
+
alignItems: 'center',
|
|
1642
|
+
justifyContent: 'center'
|
|
1643
|
+
},
|
|
1644
|
+
onClick: () => handleOpenInNewTab(item.url)
|
|
1645
|
+
}, zoomIcon ? zoomIcon : /*#__PURE__*/React__default.createElement(SvgZoom, null)) : '');
|
|
1584
1646
|
}
|
|
1585
1647
|
}
|
|
1586
1648
|
}), innerData && innerData.length > 1 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("button", {
|
|
@@ -1626,26 +1688,28 @@ Modal.propTypes = {
|
|
|
1626
1688
|
mMaxWidth: PropTypes.string,
|
|
1627
1689
|
minHeight: PropTypes.string,
|
|
1628
1690
|
className: PropTypes.string,
|
|
1691
|
+
zoomIcon: PropTypes.element,
|
|
1629
1692
|
alignItems: PropTypes.string,
|
|
1630
1693
|
mMaxHeight: PropTypes.string,
|
|
1631
1694
|
headerText: PropTypes.string,
|
|
1632
1695
|
imageWidth: PropTypes.string,
|
|
1633
1696
|
headerSize: PropTypes.string,
|
|
1634
1697
|
outsideClose: PropTypes.bool,
|
|
1698
|
+
showZoomIcon: PropTypes.bool,
|
|
1699
|
+
imageMargin: PropTypes.string,
|
|
1635
1700
|
borderStyle: PropTypes.string,
|
|
1636
1701
|
borderWidth: PropTypes.string,
|
|
1637
1702
|
headerColor: PropTypes.string,
|
|
1638
1703
|
imageHeight: PropTypes.string,
|
|
1639
1704
|
headerWeight: PropTypes.string,
|
|
1640
1705
|
headerHeight: PropTypes.string,
|
|
1706
|
+
imageMaxWidth: PropTypes.string,
|
|
1641
1707
|
justifyContent: PropTypes.string,
|
|
1708
|
+
imageWrapWidth: PropTypes.string,
|
|
1642
1709
|
backgroundColor: PropTypes.string,
|
|
1643
1710
|
grayDecorHeight: PropTypes.string,
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
imageMaxWidth: PropTypes.string,
|
|
1647
|
-
imageWrapWidth: PropTypes.string,
|
|
1648
|
-
imageWrapHeight: PropTypes.string
|
|
1711
|
+
imageWrapHeight: PropTypes.string,
|
|
1712
|
+
layerBackgroundColor: PropTypes.string
|
|
1649
1713
|
};
|
|
1650
1714
|
Modal.defaultProps = {
|
|
1651
1715
|
type: 'content'
|
|
@@ -1697,6 +1761,7 @@ const Input = ({
|
|
|
1697
1761
|
maxNumSize,
|
|
1698
1762
|
labelColor,
|
|
1699
1763
|
errorColor,
|
|
1764
|
+
withoutDot,
|
|
1700
1765
|
borderRight,
|
|
1701
1766
|
placeholder,
|
|
1702
1767
|
errorZindex,
|
|
@@ -1842,6 +1907,15 @@ const Input = ({
|
|
|
1842
1907
|
change(newStr);
|
|
1843
1908
|
}
|
|
1844
1909
|
}
|
|
1910
|
+
if (withoutDot && !/^\d+$/.test(currentValue)) {
|
|
1911
|
+
const newStr = currentValue.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
1912
|
+
return b + c.replace(/\./g, '');
|
|
1913
|
+
});
|
|
1914
|
+
setInnerValue(newStr);
|
|
1915
|
+
if (change) {
|
|
1916
|
+
change(newStr);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1845
1919
|
if (currentValue === '') {
|
|
1846
1920
|
setInnerValue('');
|
|
1847
1921
|
if (change) {
|
|
@@ -1974,6 +2048,15 @@ const Input = ({
|
|
|
1974
2048
|
change(newStr);
|
|
1975
2049
|
}
|
|
1976
2050
|
}
|
|
2051
|
+
if (withoutDot && !/^\d+$/.test(value)) {
|
|
2052
|
+
const newStr = value.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
2053
|
+
return b + c.replace(/\./g, '');
|
|
2054
|
+
});
|
|
2055
|
+
setInnerValue(newStr);
|
|
2056
|
+
if (change) {
|
|
2057
|
+
change(newStr);
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
1977
2060
|
if (value === '') {
|
|
1978
2061
|
setInnerValue('');
|
|
1979
2062
|
if (change) {
|
|
@@ -2113,6 +2196,7 @@ Input.propTypes = {
|
|
|
2113
2196
|
padding: PropTypes.string,
|
|
2114
2197
|
fontSize: PropTypes.string,
|
|
2115
2198
|
tooltip: PropTypes.element,
|
|
2199
|
+
withoutDot: PropTypes.bool,
|
|
2116
2200
|
marginTop: PropTypes.string,
|
|
2117
2201
|
transform: PropTypes.string,
|
|
2118
2202
|
className: PropTypes.string,
|
|
@@ -2470,8 +2554,7 @@ const Select = ({
|
|
|
2470
2554
|
};
|
|
2471
2555
|
const isObjectEmpty = obj => {
|
|
2472
2556
|
for (var key in obj) {
|
|
2473
|
-
|
|
2474
|
-
if (obj.hasOwnProperty(key)) {
|
|
2557
|
+
if (hasOwnerProperty(obj, key)) {
|
|
2475
2558
|
return false;
|
|
2476
2559
|
}
|
|
2477
2560
|
}
|
|
@@ -3381,7 +3464,7 @@ for (let i = 0; i < 256; ++i) {
|
|
|
3381
3464
|
function unsafeStringify(arr, offset = 0) {
|
|
3382
3465
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
3383
3466
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
3384
|
-
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]];
|
|
3467
|
+
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();
|
|
3385
3468
|
}
|
|
3386
3469
|
|
|
3387
3470
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
@@ -3601,6 +3684,7 @@ const FileItem = /*#__PURE__*/React__default.memo(({
|
|
|
3601
3684
|
}, time));
|
|
3602
3685
|
return () => {
|
|
3603
3686
|
setI(_ => _);
|
|
3687
|
+
setT(_ => _);
|
|
3604
3688
|
clearTimeout(t);
|
|
3605
3689
|
clearInterval(i);
|
|
3606
3690
|
};
|
|
@@ -3860,6 +3944,7 @@ const NewFile = ({
|
|
|
3860
3944
|
listItemPadding,
|
|
3861
3945
|
progressFontSize,
|
|
3862
3946
|
borderHoverColor,
|
|
3947
|
+
maxCHoosenLength,
|
|
3863
3948
|
listItemErrorSize,
|
|
3864
3949
|
progressTrackColor,
|
|
3865
3950
|
fileAreaImageWidth,
|
|
@@ -3870,9 +3955,11 @@ const NewFile = ({
|
|
|
3870
3955
|
progressSuccessColor,
|
|
3871
3956
|
progressLoadingColor,
|
|
3872
3957
|
hiddenBackgroundColor,
|
|
3958
|
+
maxCHoosenLengthError,
|
|
3873
3959
|
extentionsRowMarginTop,
|
|
3874
3960
|
listItemBackgroundColor,
|
|
3875
|
-
listItemBackgroundErrorColor
|
|
3961
|
+
listItemBackgroundErrorColor,
|
|
3962
|
+
maxCHoosenLengthErrorHideTime
|
|
3876
3963
|
}) => {
|
|
3877
3964
|
const ref = useRef(null);
|
|
3878
3965
|
const inpRef = useRef(null);
|
|
@@ -3880,13 +3967,10 @@ const NewFile = ({
|
|
|
3880
3967
|
const [error, setError] = useState('');
|
|
3881
3968
|
const [isHover, setIsHover] = useState(false);
|
|
3882
3969
|
const [singleFile, setSingleFile] = useState(null);
|
|
3970
|
+
const [choosenFileCount, setChoosenFileCount] = useState(0);
|
|
3883
3971
|
const [image, setImage] = useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
|
|
3884
3972
|
const configStyles = compereConfigs();
|
|
3885
3973
|
const handleRemoveComponent = () => {
|
|
3886
|
-
// eslint-disable-next-line react/no-find-dom-node
|
|
3887
|
-
const node = ReactDOM.findDOMNode(ref.current);
|
|
3888
|
-
const parent = node.parentNode;
|
|
3889
|
-
parent.removeChild(node);
|
|
3890
3974
|
if (!multiple) {
|
|
3891
3975
|
removeFile && removeFile(singleFile);
|
|
3892
3976
|
} else {
|
|
@@ -3898,11 +3982,47 @@ const NewFile = ({
|
|
|
3898
3982
|
setImage(null);
|
|
3899
3983
|
removeFile && removeFile(singleFile);
|
|
3900
3984
|
};
|
|
3901
|
-
const
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3985
|
+
const handleUploadFiles = file => {
|
|
3986
|
+
if (maxCHoosenLength && choosenFileCount > 0) {
|
|
3987
|
+
if (file.length > choosenFileCount || file.length + memoizedItems.length > choosenFileCount) {
|
|
3988
|
+
setError(maxCHoosenLengthError ? maxCHoosenLengthError : `Դիմումին կարող եք կցել առավելագույնը ${choosenFileCount} ֆայլ`);
|
|
3989
|
+
const clearFunc = () => {
|
|
3990
|
+
clearTimeout(time);
|
|
3991
|
+
};
|
|
3992
|
+
const time = setTimeout(() => {
|
|
3993
|
+
setError('');
|
|
3994
|
+
clearFunc();
|
|
3995
|
+
}, maxCHoosenLengthErrorHideTime && typeof maxCHoosenLengthErrorHideTime === 'number' ? Math.round(maxCHoosenLengthErrorHideTime) : 3000);
|
|
3996
|
+
} else {
|
|
3997
|
+
for (let ix = 0; ix < file.length; ix++) {
|
|
3998
|
+
if (file[ix]) {
|
|
3999
|
+
if (file[ix].size <= maxSize * Math.pow(2, 20)) {
|
|
4000
|
+
if (fileExtensions.includes(file[ix].type.split('/')[1]) || fileExtensions.includes('heic') && file[ix].type.split('/')[1] === 'heif') {
|
|
4001
|
+
change({
|
|
4002
|
+
id: '',
|
|
4003
|
+
check: '',
|
|
4004
|
+
status: '',
|
|
4005
|
+
file: file[ix],
|
|
4006
|
+
uuid: v4()
|
|
4007
|
+
});
|
|
4008
|
+
} else {
|
|
4009
|
+
change({
|
|
4010
|
+
file: file[ix],
|
|
4011
|
+
uuid: v4(),
|
|
4012
|
+
check: formatError
|
|
4013
|
+
});
|
|
4014
|
+
}
|
|
4015
|
+
} else {
|
|
4016
|
+
change({
|
|
4017
|
+
file: file[ix],
|
|
4018
|
+
uuid: v4(),
|
|
4019
|
+
check: maxSizeError
|
|
4020
|
+
});
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
}
|
|
4024
|
+
}
|
|
4025
|
+
} else {
|
|
3906
4026
|
for (let ix = 0; ix < file.length; ix++) {
|
|
3907
4027
|
if (file[ix]) {
|
|
3908
4028
|
if (file[ix].size <= maxSize * Math.pow(2, 20)) {
|
|
@@ -3930,6 +4050,14 @@ const NewFile = ({
|
|
|
3930
4050
|
}
|
|
3931
4051
|
}
|
|
3932
4052
|
}
|
|
4053
|
+
}
|
|
4054
|
+
};
|
|
4055
|
+
const handleChange = e => {
|
|
4056
|
+
const file = e.target.files;
|
|
4057
|
+
if (multiple) {
|
|
4058
|
+
setError('');
|
|
4059
|
+
setImage(null);
|
|
4060
|
+
handleUploadFiles(file);
|
|
3933
4061
|
if (file.length === 0 && memoizedItems.length === 0) {
|
|
3934
4062
|
setError(noChoosenFile);
|
|
3935
4063
|
}
|
|
@@ -4011,7 +4139,18 @@ const NewFile = ({
|
|
|
4011
4139
|
if (multiple && !removeFile) {
|
|
4012
4140
|
alert('Please add removeFile prop on NewFile component, it is a require in multiple mode');
|
|
4013
4141
|
}
|
|
4014
|
-
|
|
4142
|
+
if (maxCHoosenLength) {
|
|
4143
|
+
if (typeof maxCHoosenLength !== 'number') {
|
|
4144
|
+
alert('maxCHoosenLength prop must be a number, please check it!');
|
|
4145
|
+
} else {
|
|
4146
|
+
if (maxCHoosenLength <= 0) {
|
|
4147
|
+
setChoosenFileCount(1);
|
|
4148
|
+
} else {
|
|
4149
|
+
setChoosenFileCount(Math.round(maxCHoosenLength));
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
4153
|
+
}, [multiple, removeFile, filesArray && filesArray.length, defaultData, maxCHoosenLength]);
|
|
4015
4154
|
useEffect(() => {
|
|
4016
4155
|
if (deleteComponent && !removeComponent) {
|
|
4017
4156
|
alert('Please add removeComponent prop on NewFile component it is require when deleteComponent prop is true');
|
|
@@ -4213,6 +4352,7 @@ NewFile.propTypes = {
|
|
|
4213
4352
|
backgroundColor: PropTypes.string,
|
|
4214
4353
|
change: PropTypes.func.isRequired,
|
|
4215
4354
|
listItemPadding: PropTypes.string,
|
|
4355
|
+
maxCHoosenLength: PropTypes.number,
|
|
4216
4356
|
progressFontSize: PropTypes.string,
|
|
4217
4357
|
borderHoverColor: PropTypes.string,
|
|
4218
4358
|
listItemErrorSize: PropTypes.string,
|
|
@@ -4225,9 +4365,11 @@ NewFile.propTypes = {
|
|
|
4225
4365
|
progressSuccessColor: PropTypes.string,
|
|
4226
4366
|
progressLoadingColor: PropTypes.string,
|
|
4227
4367
|
hiddenBackgroundColor: PropTypes.string,
|
|
4368
|
+
maxCHoosenLengthError: PropTypes.string,
|
|
4228
4369
|
extentionsRowMarginTop: PropTypes.string,
|
|
4229
4370
|
listItemBackgroundColor: PropTypes.string,
|
|
4230
4371
|
listItemBackgroundErrorColor: PropTypes.string,
|
|
4372
|
+
maxCHoosenLengthErrorHideTime: PropTypes.number,
|
|
4231
4373
|
filesArray: PropTypes.arrayOf(PropTypes.object),
|
|
4232
4374
|
fileExtensions: PropTypes.arrayOf(PropTypes.string)
|
|
4233
4375
|
};
|
|
@@ -4382,16 +4524,10 @@ const Textarea = ({
|
|
|
4382
4524
|
if (maxLength) {
|
|
4383
4525
|
if (value.length > maxLength) {
|
|
4384
4526
|
onChange(value.substr(0, maxLength));
|
|
4385
|
-
setError('Նիշերի քանակը գերազանցում է');
|
|
4386
|
-
} else {
|
|
4387
|
-
setError('');
|
|
4388
4527
|
}
|
|
4389
4528
|
} else {
|
|
4390
4529
|
if (value.length > configStyles.TEXTAREA.maxLength) {
|
|
4391
|
-
setError('Նիշերի քանակը գերազանցում է');
|
|
4392
4530
|
onChange(value.substr(0, configStyles.TEXTAREA.maxLength));
|
|
4393
|
-
} else {
|
|
4394
|
-
setError('');
|
|
4395
4531
|
}
|
|
4396
4532
|
}
|
|
4397
4533
|
};
|
|
@@ -4602,7 +4738,7 @@ Typography.propTypes = {
|
|
|
4602
4738
|
textDecoration: PropTypes.string,
|
|
4603
4739
|
backgroundColor: PropTypes.string,
|
|
4604
4740
|
variant: PropTypes.oneOf(Object.values(TypographyType)),
|
|
4605
|
-
size: PropTypes.
|
|
4741
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
4606
4742
|
};
|
|
4607
4743
|
Typography.defaultProps = {
|
|
4608
4744
|
variant: 'p'
|
|
@@ -5190,8 +5326,7 @@ const NewAutocomplete = ({
|
|
|
5190
5326
|
alert('Please add options prop');
|
|
5191
5327
|
}
|
|
5192
5328
|
options && options.length > 0 && options.map(item => {
|
|
5193
|
-
|
|
5194
|
-
if (!item.hasOwnProperty(keyNames.name)) {
|
|
5329
|
+
if (!hasOwnerProperty(item, keyNames.name)) {
|
|
5195
5330
|
alert(`Please add ${keyNames.name} property in items of options array`);
|
|
5196
5331
|
}
|
|
5197
5332
|
});
|