@xaypay/tui 0.0.112 → 0.0.113
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 +167 -81
- package/dist/index.js +167 -81
- package/package.json +1 -1
- package/src/components/input/index.js +24 -0
- package/src/components/input/input.stories.js +0 -2
- package/src/components/modal/index.js +2 -3
- 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 +18 -21
- package/src/components/table/td.js +57 -47
- 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/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,9 +543,9 @@ const TD = ({
|
|
|
513
543
|
style: {
|
|
514
544
|
display: 'flex',
|
|
515
545
|
alignItems: 'flex-start',
|
|
516
|
-
justifyContent:
|
|
546
|
+
justifyContent: hasOwnerProperty(item, 'contentList') || hasOwnerProperty(item, 'checkBox') ? 'space-between' : 'center'
|
|
517
547
|
}
|
|
518
|
-
},
|
|
548
|
+
}, hasOwnerProperty(item, 'contentList') && /*#__PURE__*/React__default.createElement("div", {
|
|
519
549
|
id: item.id,
|
|
520
550
|
style: {
|
|
521
551
|
width: '21px',
|
|
@@ -524,7 +554,7 @@ const TD = ({
|
|
|
524
554
|
},
|
|
525
555
|
onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex),
|
|
526
556
|
className: styles$c['td-span']
|
|
527
|
-
}, item.status === 'close' ? item.closeArrow : item.openArrow),
|
|
557
|
+
}, 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,
|
|
@@ -540,10 +570,10 @@ const TD = ({
|
|
|
540
570
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
541
571
|
style: {
|
|
542
572
|
margin: '0px',
|
|
543
|
-
cursor:
|
|
573
|
+
cursor: hasOwnerProperty(item, 'arrowComponent') || hasOwnerProperty(item, 'dots') ? 'pointer' : 'auto'
|
|
544
574
|
},
|
|
545
|
-
onClick:
|
|
546
|
-
}, item.content ? item.content :
|
|
575
|
+
onClick: hasOwnerProperty(item, 'arrowComponent') ? () => handleCheckArrowAction(item, item.checkIndex) : hasOwnerProperty(item, 'dots') ? e => handleCheckDots(e, item, index, innerIndex) : _ => _
|
|
576
|
+
}, item.content ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : hasOwnerProperty(item, 'dots') ? /*#__PURE__*/React__default.createElement("span", {
|
|
547
577
|
style: {
|
|
548
578
|
display: 'block',
|
|
549
579
|
position: 'relative'
|
|
@@ -564,7 +594,7 @@ const TD = ({
|
|
|
564
594
|
backgroundColor: '#FFFFFF',
|
|
565
595
|
boxShadow: '0px 0px 20px 0px #3C393E4D'
|
|
566
596
|
}
|
|
567
|
-
},
|
|
597
|
+
}, hasOwnerProperty(item, 'options') && item.options.map((optionItem, optionIndex) => {
|
|
568
598
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
569
599
|
key: `${optionItem.content}_${optionIndex}`,
|
|
570
600
|
className: styles$c['dots-option-item'],
|
|
@@ -573,14 +603,7 @@ const TD = ({
|
|
|
573
603
|
fontSize: '14px',
|
|
574
604
|
fontFamily: 'Noto Sans Armenian'
|
|
575
605
|
},
|
|
576
|
-
onClick: () =>
|
|
577
|
-
item,
|
|
578
|
-
index,
|
|
579
|
-
optionItem,
|
|
580
|
-
innerIndex,
|
|
581
|
-
optionIndex,
|
|
582
|
-
options: item.options
|
|
583
|
-
})
|
|
606
|
+
onClick: () => handleMoreOptions(item, index, optionItem, innerIndex, optionIndex, item.options)
|
|
584
607
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
585
608
|
style: {
|
|
586
609
|
marginRight: '10px'
|
|
@@ -595,7 +618,7 @@ const TD = ({
|
|
|
595
618
|
},
|
|
596
619
|
title: optionItem.content
|
|
597
620
|
}, optionItem.content));
|
|
598
|
-
}))) : ''),
|
|
621
|
+
}))) : ''), hasOwnerProperty(item, 'contentList') && /*#__PURE__*/React__default.createElement("div", {
|
|
599
622
|
style: {
|
|
600
623
|
overflow: 'auto',
|
|
601
624
|
marginTop: '10px',
|
|
@@ -611,14 +634,7 @@ const TD = ({
|
|
|
611
634
|
color: openListColor,
|
|
612
635
|
maxWidth: (item.content.length * 9 <= 100 ? 100 : item.content.length * 9) + 'px'
|
|
613
636
|
},
|
|
614
|
-
onClick: e =>
|
|
615
|
-
item,
|
|
616
|
-
index,
|
|
617
|
-
innerIndex,
|
|
618
|
-
listContentId: innerItem.id,
|
|
619
|
-
listContent: innerItem.content,
|
|
620
|
-
listContentIndex: innerItemIndex
|
|
621
|
-
})
|
|
637
|
+
onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex)
|
|
622
638
|
}, innerItem.content);
|
|
623
639
|
})))) : '');
|
|
624
640
|
};
|
|
@@ -708,7 +724,7 @@ const Table = ({
|
|
|
708
724
|
bodyData.map((item, index) => {
|
|
709
725
|
if (index === data.index) {
|
|
710
726
|
item.map((innerItem, innerIndex) => {
|
|
711
|
-
if (
|
|
727
|
+
if (hasOwnerProperty(innerItem, 'arrowComponent')) {
|
|
712
728
|
removeItemIndex = innerIndex;
|
|
713
729
|
}
|
|
714
730
|
});
|
|
@@ -732,7 +748,7 @@ const Table = ({
|
|
|
732
748
|
let removeItemIndex;
|
|
733
749
|
let headerWithoutArrow;
|
|
734
750
|
header.map((item, index) => {
|
|
735
|
-
if (
|
|
751
|
+
if (hasOwnerProperty(item, 'arrowComponent')) {
|
|
736
752
|
removeItemIndex = index;
|
|
737
753
|
}
|
|
738
754
|
});
|
|
@@ -772,7 +788,7 @@ const Table = ({
|
|
|
772
788
|
let checkedItems = [];
|
|
773
789
|
data.map((item, index) => {
|
|
774
790
|
item.map((innerItem, innerIndex) => {
|
|
775
|
-
if (
|
|
791
|
+
if (hasOwnerProperty(innerItem, 'checkBox')) {
|
|
776
792
|
if (!checkedItems[innerIndex]) {
|
|
777
793
|
checkedItems[innerIndex] = [];
|
|
778
794
|
}
|
|
@@ -852,7 +868,7 @@ const Table = ({
|
|
|
852
868
|
checkableItemBool = !item.checkBox.checked;
|
|
853
869
|
item.checkBox.checked = !item.checkBox.checked;
|
|
854
870
|
}
|
|
855
|
-
if (
|
|
871
|
+
if (hasOwnerProperty(item, 'arrowComponent')) {
|
|
856
872
|
removeItemIndex = index;
|
|
857
873
|
}
|
|
858
874
|
return item;
|
|
@@ -902,7 +918,7 @@ const Table = ({
|
|
|
902
918
|
const updatedBody = body.slice().map(item => Object.values(item));
|
|
903
919
|
const newData = updatedBody.map((item, index) => {
|
|
904
920
|
return item.map((innerItem, innerIndex) => {
|
|
905
|
-
if (innerItem.id === data.id && innerItem.content == data.content &&
|
|
921
|
+
if (innerItem.id === data.id && innerItem.content == data.content && hasOwnerProperty(innerItem, 'checkBox')) {
|
|
906
922
|
innerItem.checkBox.checked = !innerItem.checkBox.checked;
|
|
907
923
|
handleHeaderCheckedUpdate({
|
|
908
924
|
row: index,
|
|
@@ -959,7 +975,7 @@ const Table = ({
|
|
|
959
975
|
const handleCheckArrowAction = (item, rowPosition) => {
|
|
960
976
|
const status = item.status;
|
|
961
977
|
const checkedOpenableRow = body[rowPosition].map(innerItem => {
|
|
962
|
-
if (
|
|
978
|
+
if (hasOwnerProperty(innerItem, 'status')) {
|
|
963
979
|
if (status === 'close') {
|
|
964
980
|
innerItem.status = 'open';
|
|
965
981
|
} else {
|
|
@@ -985,13 +1001,13 @@ const Table = ({
|
|
|
985
1001
|
}
|
|
986
1002
|
single = item;
|
|
987
1003
|
}
|
|
988
|
-
if (
|
|
1004
|
+
if (hasOwnerProperty(item, 'status') && !hasOwnerProperty(item, 'arrowComponent')) {
|
|
989
1005
|
allArrows.push(item);
|
|
990
1006
|
}
|
|
991
1007
|
return item;
|
|
992
1008
|
});
|
|
993
1009
|
const checkedOpenableRowArrow = checkedOpenableRow.map(item => {
|
|
994
|
-
if (
|
|
1010
|
+
if (hasOwnerProperty(item, 'arrowComponent')) {
|
|
995
1011
|
if (single && single.status === 'close') {
|
|
996
1012
|
item.status = 'close';
|
|
997
1013
|
} else if (single && single.status === 'open') {
|
|
@@ -1021,7 +1037,7 @@ const Table = ({
|
|
|
1021
1037
|
});
|
|
1022
1038
|
const checkedOpenableAllRowsBody = body.map(innerItem => {
|
|
1023
1039
|
return innerItem.map(iElem => {
|
|
1024
|
-
if (
|
|
1040
|
+
if (hasOwnerProperty(iElem, 'status')) {
|
|
1025
1041
|
if (item.status === 'open') {
|
|
1026
1042
|
iElem.status = 'open';
|
|
1027
1043
|
} else {
|
|
@@ -1038,7 +1054,7 @@ const Table = ({
|
|
|
1038
1054
|
e.stopPropagation();
|
|
1039
1055
|
const checkBodyMore = body.map((elemItem, elemIndex) => {
|
|
1040
1056
|
return elemItem.map((elemInnerItem, elemInnerIndex) => {
|
|
1041
|
-
if (elemIndex === index &&
|
|
1057
|
+
if (elemIndex === index && hasOwnerProperty(elemInnerItem, 'dots')) {
|
|
1042
1058
|
if (elemInnerIndex === innerIndex) {
|
|
1043
1059
|
if (item.dotsStatus === 'deActive') {
|
|
1044
1060
|
elemInnerItem.dotsStatus = 'active';
|
|
@@ -1046,7 +1062,7 @@ const Table = ({
|
|
|
1046
1062
|
elemInnerItem.dotsStatus = 'deActive';
|
|
1047
1063
|
}
|
|
1048
1064
|
}
|
|
1049
|
-
} else if (elemIndex !== index &&
|
|
1065
|
+
} else if (elemIndex !== index && hasOwnerProperty(elemInnerItem, 'dots')) {
|
|
1050
1066
|
if (elemInnerIndex === innerIndex) {
|
|
1051
1067
|
elemInnerItem.dotsStatus = 'deActive';
|
|
1052
1068
|
}
|
|
@@ -1061,7 +1077,7 @@ const Table = ({
|
|
|
1061
1077
|
if (disableArr && disableArr.length > 0) {
|
|
1062
1078
|
headerWithDisabled = arr.map((item, index) => {
|
|
1063
1079
|
if (disableArr[index]) {
|
|
1064
|
-
if (
|
|
1080
|
+
if (hasOwnerProperty(item, 'checkBox')) {
|
|
1065
1081
|
item.checkBox.disabled = true;
|
|
1066
1082
|
}
|
|
1067
1083
|
}
|
|
@@ -1108,7 +1124,7 @@ const Table = ({
|
|
|
1108
1124
|
const handleTableClick = () => {
|
|
1109
1125
|
const checkBodyMore = body.map(elemItem => {
|
|
1110
1126
|
return elemItem.map(elemInnerItem => {
|
|
1111
|
-
if (
|
|
1127
|
+
if (hasOwnerProperty(elemInnerItem, 'dots')) {
|
|
1112
1128
|
elemInnerItem.dotsStatus = 'deActive';
|
|
1113
1129
|
}
|
|
1114
1130
|
return elemInnerItem;
|
|
@@ -1125,8 +1141,8 @@ const Table = ({
|
|
|
1125
1141
|
const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
|
|
1126
1142
|
const insert = checkForInsertArrow.map((item, index) => {
|
|
1127
1143
|
item.map((innerItem, innerIndex) => {
|
|
1128
|
-
if (
|
|
1129
|
-
if (
|
|
1144
|
+
if (hasOwnerProperty(innerItem, 'checkBox')) {
|
|
1145
|
+
if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
|
|
1130
1146
|
if (innerItem.checkBox.disabled === true) {
|
|
1131
1147
|
if (!disabledArray[innerIndex]) {
|
|
1132
1148
|
disabledArray[innerIndex] = {
|
|
@@ -1145,8 +1161,8 @@ const Table = ({
|
|
|
1145
1161
|
} else {
|
|
1146
1162
|
const insert = checkBodyForChackedItems.map((item, index) => {
|
|
1147
1163
|
item.map((innerItem, innerIndex) => {
|
|
1148
|
-
if (
|
|
1149
|
-
if (
|
|
1164
|
+
if (hasOwnerProperty(innerItem, 'checkBox')) {
|
|
1165
|
+
if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
|
|
1150
1166
|
if (innerItem.checkBox.disabled === true) {
|
|
1151
1167
|
if (!disabledArray[innerIndex]) {
|
|
1152
1168
|
disabledArray[innerIndex] = {
|
|
@@ -1563,8 +1579,7 @@ const Modal = ({
|
|
|
1563
1579
|
}
|
|
1564
1580
|
}, innerData && innerData.length > 0 && innerData.map((item, index) => {
|
|
1565
1581
|
if (select === index) {
|
|
1566
|
-
|
|
1567
|
-
if (!item.hasOwnProperty('url')) {
|
|
1582
|
+
if (!hasOwnerProperty(item, 'url')) {
|
|
1568
1583
|
alert('Please add url property in data prop on each element');
|
|
1569
1584
|
} else {
|
|
1570
1585
|
return /*#__PURE__*/React__default.createElement("img", {
|
|
@@ -1697,6 +1712,7 @@ const Input = ({
|
|
|
1697
1712
|
maxNumSize,
|
|
1698
1713
|
labelColor,
|
|
1699
1714
|
errorColor,
|
|
1715
|
+
withoutDot,
|
|
1700
1716
|
borderRight,
|
|
1701
1717
|
placeholder,
|
|
1702
1718
|
errorZindex,
|
|
@@ -1842,6 +1858,15 @@ const Input = ({
|
|
|
1842
1858
|
change(newStr);
|
|
1843
1859
|
}
|
|
1844
1860
|
}
|
|
1861
|
+
if (withoutDot && !/^\d+$/.test(currentValue)) {
|
|
1862
|
+
const newStr = currentValue.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
1863
|
+
return b + c.replace(/\./g, '');
|
|
1864
|
+
});
|
|
1865
|
+
setInnerValue(newStr);
|
|
1866
|
+
if (change) {
|
|
1867
|
+
change(newStr);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1845
1870
|
if (currentValue === '') {
|
|
1846
1871
|
setInnerValue('');
|
|
1847
1872
|
if (change) {
|
|
@@ -1974,6 +1999,15 @@ const Input = ({
|
|
|
1974
1999
|
change(newStr);
|
|
1975
2000
|
}
|
|
1976
2001
|
}
|
|
2002
|
+
if (withoutDot && !/^\d+$/.test(value)) {
|
|
2003
|
+
const newStr = value.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
2004
|
+
return b + c.replace(/\./g, '');
|
|
2005
|
+
});
|
|
2006
|
+
setInnerValue(newStr);
|
|
2007
|
+
if (change) {
|
|
2008
|
+
change(newStr);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
1977
2011
|
if (value === '') {
|
|
1978
2012
|
setInnerValue('');
|
|
1979
2013
|
if (change) {
|
|
@@ -2113,6 +2147,7 @@ Input.propTypes = {
|
|
|
2113
2147
|
padding: PropTypes.string,
|
|
2114
2148
|
fontSize: PropTypes.string,
|
|
2115
2149
|
tooltip: PropTypes.element,
|
|
2150
|
+
withoutDot: PropTypes.bool,
|
|
2116
2151
|
marginTop: PropTypes.string,
|
|
2117
2152
|
transform: PropTypes.string,
|
|
2118
2153
|
className: PropTypes.string,
|
|
@@ -2470,8 +2505,7 @@ const Select = ({
|
|
|
2470
2505
|
};
|
|
2471
2506
|
const isObjectEmpty = obj => {
|
|
2472
2507
|
for (var key in obj) {
|
|
2473
|
-
|
|
2474
|
-
if (obj.hasOwnProperty(key)) {
|
|
2508
|
+
if (hasOwnerProperty(obj, key)) {
|
|
2475
2509
|
return false;
|
|
2476
2510
|
}
|
|
2477
2511
|
}
|
|
@@ -3381,7 +3415,7 @@ for (let i = 0; i < 256; ++i) {
|
|
|
3381
3415
|
function unsafeStringify(arr, offset = 0) {
|
|
3382
3416
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
3383
3417
|
// 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]];
|
|
3418
|
+
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
3419
|
}
|
|
3386
3420
|
|
|
3387
3421
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
@@ -3601,6 +3635,7 @@ const FileItem = /*#__PURE__*/React__default.memo(({
|
|
|
3601
3635
|
}, time));
|
|
3602
3636
|
return () => {
|
|
3603
3637
|
setI(_ => _);
|
|
3638
|
+
setT(_ => _);
|
|
3604
3639
|
clearTimeout(t);
|
|
3605
3640
|
clearInterval(i);
|
|
3606
3641
|
};
|
|
@@ -3860,6 +3895,7 @@ const NewFile = ({
|
|
|
3860
3895
|
listItemPadding,
|
|
3861
3896
|
progressFontSize,
|
|
3862
3897
|
borderHoverColor,
|
|
3898
|
+
maxCHoosenLength,
|
|
3863
3899
|
listItemErrorSize,
|
|
3864
3900
|
progressTrackColor,
|
|
3865
3901
|
fileAreaImageWidth,
|
|
@@ -3870,9 +3906,11 @@ const NewFile = ({
|
|
|
3870
3906
|
progressSuccessColor,
|
|
3871
3907
|
progressLoadingColor,
|
|
3872
3908
|
hiddenBackgroundColor,
|
|
3909
|
+
maxCHoosenLengthError,
|
|
3873
3910
|
extentionsRowMarginTop,
|
|
3874
3911
|
listItemBackgroundColor,
|
|
3875
|
-
listItemBackgroundErrorColor
|
|
3912
|
+
listItemBackgroundErrorColor,
|
|
3913
|
+
maxCHoosenLengthErrorHideTime
|
|
3876
3914
|
}) => {
|
|
3877
3915
|
const ref = useRef(null);
|
|
3878
3916
|
const inpRef = useRef(null);
|
|
@@ -3880,13 +3918,10 @@ const NewFile = ({
|
|
|
3880
3918
|
const [error, setError] = useState('');
|
|
3881
3919
|
const [isHover, setIsHover] = useState(false);
|
|
3882
3920
|
const [singleFile, setSingleFile] = useState(null);
|
|
3921
|
+
const [choosenFileCount, setChoosenFileCount] = useState(0);
|
|
3883
3922
|
const [image, setImage] = useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
|
|
3884
3923
|
const configStyles = compereConfigs();
|
|
3885
3924
|
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
3925
|
if (!multiple) {
|
|
3891
3926
|
removeFile && removeFile(singleFile);
|
|
3892
3927
|
} else {
|
|
@@ -3898,11 +3933,47 @@ const NewFile = ({
|
|
|
3898
3933
|
setImage(null);
|
|
3899
3934
|
removeFile && removeFile(singleFile);
|
|
3900
3935
|
};
|
|
3901
|
-
const
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3936
|
+
const handleUploadFiles = file => {
|
|
3937
|
+
if (maxCHoosenLength && choosenFileCount > 0) {
|
|
3938
|
+
if (file.length > choosenFileCount || file.length + memoizedItems.length > choosenFileCount) {
|
|
3939
|
+
setError(maxCHoosenLengthError ? maxCHoosenLengthError : `Դիմումին կարող եք կցել առավելագույնը ${choosenFileCount} ֆայլ`);
|
|
3940
|
+
const clearFunc = () => {
|
|
3941
|
+
clearTimeout(time);
|
|
3942
|
+
};
|
|
3943
|
+
const time = setTimeout(() => {
|
|
3944
|
+
setError('');
|
|
3945
|
+
clearFunc();
|
|
3946
|
+
}, maxCHoosenLengthErrorHideTime && typeof maxCHoosenLengthErrorHideTime === 'number' ? Math.round(maxCHoosenLengthErrorHideTime) : 3000);
|
|
3947
|
+
} else {
|
|
3948
|
+
for (let ix = 0; ix < file.length; ix++) {
|
|
3949
|
+
if (file[ix]) {
|
|
3950
|
+
if (file[ix].size <= maxSize * Math.pow(2, 20)) {
|
|
3951
|
+
if (fileExtensions.includes(file[ix].type.split('/')[1]) || fileExtensions.includes('heic') && file[ix].type.split('/')[1] === 'heif') {
|
|
3952
|
+
change({
|
|
3953
|
+
id: '',
|
|
3954
|
+
check: '',
|
|
3955
|
+
status: '',
|
|
3956
|
+
file: file[ix],
|
|
3957
|
+
uuid: v4()
|
|
3958
|
+
});
|
|
3959
|
+
} else {
|
|
3960
|
+
change({
|
|
3961
|
+
file: file[ix],
|
|
3962
|
+
uuid: v4(),
|
|
3963
|
+
check: formatError
|
|
3964
|
+
});
|
|
3965
|
+
}
|
|
3966
|
+
} else {
|
|
3967
|
+
change({
|
|
3968
|
+
file: file[ix],
|
|
3969
|
+
uuid: v4(),
|
|
3970
|
+
check: maxSizeError
|
|
3971
|
+
});
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3976
|
+
} else {
|
|
3906
3977
|
for (let ix = 0; ix < file.length; ix++) {
|
|
3907
3978
|
if (file[ix]) {
|
|
3908
3979
|
if (file[ix].size <= maxSize * Math.pow(2, 20)) {
|
|
@@ -3930,6 +4001,14 @@ const NewFile = ({
|
|
|
3930
4001
|
}
|
|
3931
4002
|
}
|
|
3932
4003
|
}
|
|
4004
|
+
}
|
|
4005
|
+
};
|
|
4006
|
+
const handleChange = e => {
|
|
4007
|
+
const file = e.target.files;
|
|
4008
|
+
if (multiple) {
|
|
4009
|
+
setError('');
|
|
4010
|
+
setImage(null);
|
|
4011
|
+
handleUploadFiles(file);
|
|
3933
4012
|
if (file.length === 0 && memoizedItems.length === 0) {
|
|
3934
4013
|
setError(noChoosenFile);
|
|
3935
4014
|
}
|
|
@@ -4011,7 +4090,18 @@ const NewFile = ({
|
|
|
4011
4090
|
if (multiple && !removeFile) {
|
|
4012
4091
|
alert('Please add removeFile prop on NewFile component, it is a require in multiple mode');
|
|
4013
4092
|
}
|
|
4014
|
-
|
|
4093
|
+
if (maxCHoosenLength) {
|
|
4094
|
+
if (typeof maxCHoosenLength !== 'number') {
|
|
4095
|
+
alert('maxCHoosenLength prop must be a number, please check it!');
|
|
4096
|
+
} else {
|
|
4097
|
+
if (maxCHoosenLength <= 0) {
|
|
4098
|
+
setChoosenFileCount(1);
|
|
4099
|
+
} else {
|
|
4100
|
+
setChoosenFileCount(Math.round(maxCHoosenLength));
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
}
|
|
4104
|
+
}, [multiple, removeFile, filesArray && filesArray.length, defaultData, maxCHoosenLength]);
|
|
4015
4105
|
useEffect(() => {
|
|
4016
4106
|
if (deleteComponent && !removeComponent) {
|
|
4017
4107
|
alert('Please add removeComponent prop on NewFile component it is require when deleteComponent prop is true');
|
|
@@ -4213,6 +4303,7 @@ NewFile.propTypes = {
|
|
|
4213
4303
|
backgroundColor: PropTypes.string,
|
|
4214
4304
|
change: PropTypes.func.isRequired,
|
|
4215
4305
|
listItemPadding: PropTypes.string,
|
|
4306
|
+
maxCHoosenLength: PropTypes.number,
|
|
4216
4307
|
progressFontSize: PropTypes.string,
|
|
4217
4308
|
borderHoverColor: PropTypes.string,
|
|
4218
4309
|
listItemErrorSize: PropTypes.string,
|
|
@@ -4225,9 +4316,11 @@ NewFile.propTypes = {
|
|
|
4225
4316
|
progressSuccessColor: PropTypes.string,
|
|
4226
4317
|
progressLoadingColor: PropTypes.string,
|
|
4227
4318
|
hiddenBackgroundColor: PropTypes.string,
|
|
4319
|
+
maxCHoosenLengthError: PropTypes.string,
|
|
4228
4320
|
extentionsRowMarginTop: PropTypes.string,
|
|
4229
4321
|
listItemBackgroundColor: PropTypes.string,
|
|
4230
4322
|
listItemBackgroundErrorColor: PropTypes.string,
|
|
4323
|
+
maxCHoosenLengthErrorHideTime: PropTypes.number,
|
|
4231
4324
|
filesArray: PropTypes.arrayOf(PropTypes.object),
|
|
4232
4325
|
fileExtensions: PropTypes.arrayOf(PropTypes.string)
|
|
4233
4326
|
};
|
|
@@ -4382,16 +4475,10 @@ const Textarea = ({
|
|
|
4382
4475
|
if (maxLength) {
|
|
4383
4476
|
if (value.length > maxLength) {
|
|
4384
4477
|
onChange(value.substr(0, maxLength));
|
|
4385
|
-
setError('Նիշերի քանակը գերազանցում է');
|
|
4386
|
-
} else {
|
|
4387
|
-
setError('');
|
|
4388
4478
|
}
|
|
4389
4479
|
} else {
|
|
4390
4480
|
if (value.length > configStyles.TEXTAREA.maxLength) {
|
|
4391
|
-
setError('Նիշերի քանակը գերազանցում է');
|
|
4392
4481
|
onChange(value.substr(0, configStyles.TEXTAREA.maxLength));
|
|
4393
|
-
} else {
|
|
4394
|
-
setError('');
|
|
4395
4482
|
}
|
|
4396
4483
|
}
|
|
4397
4484
|
};
|
|
@@ -4602,7 +4689,7 @@ Typography.propTypes = {
|
|
|
4602
4689
|
textDecoration: PropTypes.string,
|
|
4603
4690
|
backgroundColor: PropTypes.string,
|
|
4604
4691
|
variant: PropTypes.oneOf(Object.values(TypographyType)),
|
|
4605
|
-
size: PropTypes.
|
|
4692
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
4606
4693
|
};
|
|
4607
4694
|
Typography.defaultProps = {
|
|
4608
4695
|
variant: 'p'
|
|
@@ -5190,8 +5277,7 @@ const NewAutocomplete = ({
|
|
|
5190
5277
|
alert('Please add options prop');
|
|
5191
5278
|
}
|
|
5192
5279
|
options && options.length > 0 && options.map(item => {
|
|
5193
|
-
|
|
5194
|
-
if (!item.hasOwnProperty(keyNames.name)) {
|
|
5280
|
+
if (!hasOwnerProperty(item, keyNames.name)) {
|
|
5195
5281
|
alert(`Please add ${keyNames.name} property in items of options array`);
|
|
5196
5282
|
}
|
|
5197
5283
|
});
|