@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.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: Object.prototype.hasOwnProperty.call(item, 'checkBox') ? 'space-between' : 'center'
439
+ justifyContent: hasOwnerProperty(item, 'checkBox') ? 'space-between' : 'center'
432
440
  }
433
- }, item.hasOwnProperty('checkBox') ? /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
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: Object.prototype.hasOwnProperty.call(item, 'arrowComponent') ? e => handleCheckArrowActionHeader(e, item) : _ => _
446
- }, item.type === 'show' ? item.content : Object.prototype.hasOwnProperty.call(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : '')));
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: Object.prototype.hasOwnProperty.call(item, 'colorStatus') ? `inset 3px 0px 0px 0px ${item.colorStatus}` : ''
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: Object.prototype.hasOwnProperty.call(newItem, 'type') ? 'pointer' : 'auto'
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: Object.prototype.hasOwnProperty.call(newItem, 'type') ? e => handleBodyAction(e, {
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: Object.prototype.hasOwnProperty.call(iT, 'type') ? 'pointer' : 'auto'
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: Object.prototype.hasOwnProperty.call(iT, 'type') ? e => handleBodyAction(e, {
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,9 +573,9 @@ const TD = ({
543
573
  style: {
544
574
  display: 'flex',
545
575
  alignItems: 'flex-start',
546
- justifyContent: Object.prototype.hasOwnProperty.call(item, 'contentList') || Object.prototype.hasOwnProperty.call(item, 'checkBox') ? 'space-between' : 'center'
576
+ justifyContent: hasOwnerProperty(item, 'contentList') || hasOwnerProperty(item, 'checkBox') ? 'space-between' : 'center'
547
577
  }
548
- }, Object.prototype.hasOwnProperty.call(item, 'contentList') && /*#__PURE__*/React__default["default"].createElement("div", {
578
+ }, hasOwnerProperty(item, 'contentList') && /*#__PURE__*/React__default["default"].createElement("div", {
549
579
  id: item.id,
550
580
  style: {
551
581
  width: '21px',
@@ -554,7 +584,7 @@ const TD = ({
554
584
  },
555
585
  onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex),
556
586
  className: styles$c['td-span']
557
- }, item.status === 'close' ? item.closeArrow : item.openArrow), Object.prototype.hasOwnProperty.call(item, 'checkBox') && /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
587
+ }, 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,
@@ -570,10 +600,10 @@ const TD = ({
570
600
  }, /*#__PURE__*/React__default["default"].createElement("p", {
571
601
  style: {
572
602
  margin: '0px',
573
- cursor: Object.prototype.hasOwnProperty.call(item, 'arrowComponent') || Object.prototype.hasOwnProperty.call(item, 'dots') ? 'pointer' : 'auto'
603
+ cursor: hasOwnerProperty(item, 'arrowComponent') || hasOwnerProperty(item, 'dots') ? 'pointer' : 'auto'
574
604
  },
575
- onClick: Object.prototype.hasOwnProperty.call(item, 'arrowComponent') ? () => handleCheckArrowAction(item, item.checkIndex) : Object.prototype.hasOwnProperty.call(item, 'dots') ? e => handleCheckDots(e, item, index, innerIndex) : _ => _
576
- }, item.content ? item.content : Object.prototype.hasOwnProperty.call(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : Object.prototype.hasOwnProperty.call(item, 'dots') ? /*#__PURE__*/React__default["default"].createElement("span", {
605
+ onClick: hasOwnerProperty(item, 'arrowComponent') ? () => handleCheckArrowAction(item, item.checkIndex) : hasOwnerProperty(item, 'dots') ? e => handleCheckDots(e, item, index, innerIndex) : _ => _
606
+ }, item.content ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : hasOwnerProperty(item, 'dots') ? /*#__PURE__*/React__default["default"].createElement("span", {
577
607
  style: {
578
608
  display: 'block',
579
609
  position: 'relative'
@@ -594,7 +624,7 @@ const TD = ({
594
624
  backgroundColor: '#FFFFFF',
595
625
  boxShadow: '0px 0px 20px 0px #3C393E4D'
596
626
  }
597
- }, Object.prototype.hasOwnProperty.call(item, 'options') && item.options.map((optionItem, optionIndex) => {
627
+ }, hasOwnerProperty(item, 'options') && item.options.map((optionItem, optionIndex) => {
598
628
  return /*#__PURE__*/React__default["default"].createElement("span", {
599
629
  key: `${optionItem.content}_${optionIndex}`,
600
630
  className: styles$c['dots-option-item'],
@@ -603,14 +633,7 @@ const TD = ({
603
633
  fontSize: '14px',
604
634
  fontFamily: 'Noto Sans Armenian'
605
635
  },
606
- onClick: () => handleMoreOptionsClick({
607
- item,
608
- index,
609
- optionItem,
610
- innerIndex,
611
- optionIndex,
612
- options: item.options
613
- })
636
+ onClick: () => handleMoreOptions(item, index, optionItem, innerIndex, optionIndex, item.options)
614
637
  }, /*#__PURE__*/React__default["default"].createElement("span", {
615
638
  style: {
616
639
  marginRight: '10px'
@@ -625,7 +648,7 @@ const TD = ({
625
648
  },
626
649
  title: optionItem.content
627
650
  }, optionItem.content));
628
- }))) : ''), Object.prototype.hasOwnProperty.call(item, 'contentList') && /*#__PURE__*/React__default["default"].createElement("div", {
651
+ }))) : ''), hasOwnerProperty(item, 'contentList') && /*#__PURE__*/React__default["default"].createElement("div", {
629
652
  style: {
630
653
  overflow: 'auto',
631
654
  marginTop: '10px',
@@ -641,14 +664,7 @@ const TD = ({
641
664
  color: openListColor,
642
665
  maxWidth: (item.content.length * 9 <= 100 ? 100 : item.content.length * 9) + 'px'
643
666
  },
644
- onClick: e => handleContentListClick(e, {
645
- item,
646
- index,
647
- innerIndex,
648
- listContentId: innerItem.id,
649
- listContent: innerItem.content,
650
- listContentIndex: innerItemIndex
651
- })
667
+ onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex)
652
668
  }, innerItem.content);
653
669
  })))) : '');
654
670
  };
@@ -738,7 +754,7 @@ const Table = ({
738
754
  bodyData.map((item, index) => {
739
755
  if (index === data.index) {
740
756
  item.map((innerItem, innerIndex) => {
741
- if (Object.prototype.hasOwnProperty.call(innerItem, 'arrowComponent')) {
757
+ if (hasOwnerProperty(innerItem, 'arrowComponent')) {
742
758
  removeItemIndex = innerIndex;
743
759
  }
744
760
  });
@@ -762,7 +778,7 @@ const Table = ({
762
778
  let removeItemIndex;
763
779
  let headerWithoutArrow;
764
780
  header.map((item, index) => {
765
- if (Object.prototype.hasOwnProperty.call(item, 'arrowComponent')) {
781
+ if (hasOwnerProperty(item, 'arrowComponent')) {
766
782
  removeItemIndex = index;
767
783
  }
768
784
  });
@@ -802,7 +818,7 @@ const Table = ({
802
818
  let checkedItems = [];
803
819
  data.map((item, index) => {
804
820
  item.map((innerItem, innerIndex) => {
805
- if (Object.prototype.hasOwnProperty.call(innerItem, 'checkBox')) {
821
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
806
822
  if (!checkedItems[innerIndex]) {
807
823
  checkedItems[innerIndex] = [];
808
824
  }
@@ -882,7 +898,7 @@ const Table = ({
882
898
  checkableItemBool = !item.checkBox.checked;
883
899
  item.checkBox.checked = !item.checkBox.checked;
884
900
  }
885
- if (Object.prototype.hasOwnProperty.call(item, 'arrowComponent')) {
901
+ if (hasOwnerProperty(item, 'arrowComponent')) {
886
902
  removeItemIndex = index;
887
903
  }
888
904
  return item;
@@ -932,7 +948,7 @@ const Table = ({
932
948
  const updatedBody = body.slice().map(item => Object.values(item));
933
949
  const newData = updatedBody.map((item, index) => {
934
950
  return item.map((innerItem, innerIndex) => {
935
- if (innerItem.id === data.id && innerItem.content == data.content && Object.prototype.hasOwnProperty.call(innerItem, 'checkBox')) {
951
+ if (innerItem.id === data.id && innerItem.content == data.content && hasOwnerProperty(innerItem, 'checkBox')) {
936
952
  innerItem.checkBox.checked = !innerItem.checkBox.checked;
937
953
  handleHeaderCheckedUpdate({
938
954
  row: index,
@@ -989,7 +1005,7 @@ const Table = ({
989
1005
  const handleCheckArrowAction = (item, rowPosition) => {
990
1006
  const status = item.status;
991
1007
  const checkedOpenableRow = body[rowPosition].map(innerItem => {
992
- if (Object.prototype.hasOwnProperty.call(innerItem, 'status')) {
1008
+ if (hasOwnerProperty(innerItem, 'status')) {
993
1009
  if (status === 'close') {
994
1010
  innerItem.status = 'open';
995
1011
  } else {
@@ -1015,13 +1031,13 @@ const Table = ({
1015
1031
  }
1016
1032
  single = item;
1017
1033
  }
1018
- if (Object.prototype.hasOwnProperty.call(item, 'status') && !Object.prototype.hasOwnProperty.call(item, 'arrowComponent')) {
1034
+ if (hasOwnerProperty(item, 'status') && !hasOwnerProperty(item, 'arrowComponent')) {
1019
1035
  allArrows.push(item);
1020
1036
  }
1021
1037
  return item;
1022
1038
  });
1023
1039
  const checkedOpenableRowArrow = checkedOpenableRow.map(item => {
1024
- if (Object.prototype.hasOwnProperty.call(item, 'arrowComponent')) {
1040
+ if (hasOwnerProperty(item, 'arrowComponent')) {
1025
1041
  if (single && single.status === 'close') {
1026
1042
  item.status = 'close';
1027
1043
  } else if (single && single.status === 'open') {
@@ -1051,7 +1067,7 @@ const Table = ({
1051
1067
  });
1052
1068
  const checkedOpenableAllRowsBody = body.map(innerItem => {
1053
1069
  return innerItem.map(iElem => {
1054
- if (Object.prototype.hasOwnProperty.call(iElem, 'status')) {
1070
+ if (hasOwnerProperty(iElem, 'status')) {
1055
1071
  if (item.status === 'open') {
1056
1072
  iElem.status = 'open';
1057
1073
  } else {
@@ -1068,7 +1084,7 @@ const Table = ({
1068
1084
  e.stopPropagation();
1069
1085
  const checkBodyMore = body.map((elemItem, elemIndex) => {
1070
1086
  return elemItem.map((elemInnerItem, elemInnerIndex) => {
1071
- if (elemIndex === index && Object.prototype.hasOwnProperty.call(elemInnerItem, 'dots')) {
1087
+ if (elemIndex === index && hasOwnerProperty(elemInnerItem, 'dots')) {
1072
1088
  if (elemInnerIndex === innerIndex) {
1073
1089
  if (item.dotsStatus === 'deActive') {
1074
1090
  elemInnerItem.dotsStatus = 'active';
@@ -1076,7 +1092,7 @@ const Table = ({
1076
1092
  elemInnerItem.dotsStatus = 'deActive';
1077
1093
  }
1078
1094
  }
1079
- } else if (elemIndex !== index && Object.prototype.hasOwnProperty.call(elemInnerItem, 'dots')) {
1095
+ } else if (elemIndex !== index && hasOwnerProperty(elemInnerItem, 'dots')) {
1080
1096
  if (elemInnerIndex === innerIndex) {
1081
1097
  elemInnerItem.dotsStatus = 'deActive';
1082
1098
  }
@@ -1091,7 +1107,7 @@ const Table = ({
1091
1107
  if (disableArr && disableArr.length > 0) {
1092
1108
  headerWithDisabled = arr.map((item, index) => {
1093
1109
  if (disableArr[index]) {
1094
- if (Object.prototype.hasOwnProperty.call(item, 'checkBox')) {
1110
+ if (hasOwnerProperty(item, 'checkBox')) {
1095
1111
  item.checkBox.disabled = true;
1096
1112
  }
1097
1113
  }
@@ -1138,7 +1154,7 @@ const Table = ({
1138
1154
  const handleTableClick = () => {
1139
1155
  const checkBodyMore = body.map(elemItem => {
1140
1156
  return elemItem.map(elemInnerItem => {
1141
- if (Object.prototype.hasOwnProperty.call(elemInnerItem, 'dots')) {
1157
+ if (hasOwnerProperty(elemInnerItem, 'dots')) {
1142
1158
  elemInnerItem.dotsStatus = 'deActive';
1143
1159
  }
1144
1160
  return elemInnerItem;
@@ -1155,8 +1171,8 @@ const Table = ({
1155
1171
  const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
1156
1172
  const insert = checkForInsertArrow.map((item, index) => {
1157
1173
  item.map((innerItem, innerIndex) => {
1158
- if (Object.prototype.hasOwnProperty.call(innerItem, 'checkBox')) {
1159
- if (Object.prototype.hasOwnProperty.call(innerItem.checkBox, 'disabled')) {
1174
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
1175
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
1160
1176
  if (innerItem.checkBox.disabled === true) {
1161
1177
  if (!disabledArray[innerIndex]) {
1162
1178
  disabledArray[innerIndex] = {
@@ -1175,8 +1191,8 @@ const Table = ({
1175
1191
  } else {
1176
1192
  const insert = checkBodyForChackedItems.map((item, index) => {
1177
1193
  item.map((innerItem, innerIndex) => {
1178
- if (Object.prototype.hasOwnProperty.call(innerItem, 'checkBox')) {
1179
- if (Object.prototype.hasOwnProperty.call(innerItem.checkBox, 'disabled')) {
1194
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
1195
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
1180
1196
  if (innerItem.checkBox.disabled === true) {
1181
1197
  if (!disabledArray[innerIndex]) {
1182
1198
  disabledArray[innerIndex] = {
@@ -1593,8 +1609,7 @@ const Modal = ({
1593
1609
  }
1594
1610
  }, innerData && innerData.length > 0 && innerData.map((item, index) => {
1595
1611
  if (select === index) {
1596
- // eslint-disable-next-line no-prototype-builtins
1597
- if (!item.hasOwnProperty('url')) {
1612
+ if (!hasOwnerProperty(item, 'url')) {
1598
1613
  alert('Please add url property in data prop on each element');
1599
1614
  } else {
1600
1615
  return /*#__PURE__*/React__default["default"].createElement("img", {
@@ -1727,6 +1742,7 @@ const Input = ({
1727
1742
  maxNumSize,
1728
1743
  labelColor,
1729
1744
  errorColor,
1745
+ withoutDot,
1730
1746
  borderRight,
1731
1747
  placeholder,
1732
1748
  errorZindex,
@@ -1872,6 +1888,15 @@ const Input = ({
1872
1888
  change(newStr);
1873
1889
  }
1874
1890
  }
1891
+ if (withoutDot && !/^\d+$/.test(currentValue)) {
1892
+ const newStr = currentValue.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
1893
+ return b + c.replace(/\./g, '');
1894
+ });
1895
+ setInnerValue(newStr);
1896
+ if (change) {
1897
+ change(newStr);
1898
+ }
1899
+ }
1875
1900
  if (currentValue === '') {
1876
1901
  setInnerValue('');
1877
1902
  if (change) {
@@ -2004,6 +2029,15 @@ const Input = ({
2004
2029
  change(newStr);
2005
2030
  }
2006
2031
  }
2032
+ if (withoutDot && !/^\d+$/.test(value)) {
2033
+ const newStr = value.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
2034
+ return b + c.replace(/\./g, '');
2035
+ });
2036
+ setInnerValue(newStr);
2037
+ if (change) {
2038
+ change(newStr);
2039
+ }
2040
+ }
2007
2041
  if (value === '') {
2008
2042
  setInnerValue('');
2009
2043
  if (change) {
@@ -2143,6 +2177,7 @@ Input.propTypes = {
2143
2177
  padding: PropTypes__default["default"].string,
2144
2178
  fontSize: PropTypes__default["default"].string,
2145
2179
  tooltip: PropTypes__default["default"].element,
2180
+ withoutDot: PropTypes__default["default"].bool,
2146
2181
  marginTop: PropTypes__default["default"].string,
2147
2182
  transform: PropTypes__default["default"].string,
2148
2183
  className: PropTypes__default["default"].string,
@@ -2500,8 +2535,7 @@ const Select = ({
2500
2535
  };
2501
2536
  const isObjectEmpty = obj => {
2502
2537
  for (var key in obj) {
2503
- // eslint-disable-next-line no-prototype-builtins
2504
- if (obj.hasOwnProperty(key)) {
2538
+ if (hasOwnerProperty(obj, key)) {
2505
2539
  return false;
2506
2540
  }
2507
2541
  }
@@ -3411,7 +3445,7 @@ for (let i = 0; i < 256; ++i) {
3411
3445
  function unsafeStringify(arr, offset = 0) {
3412
3446
  // Note: Be careful editing this code! It's been tuned for performance
3413
3447
  // 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]];
3448
+ 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
3449
  }
3416
3450
 
3417
3451
  const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
@@ -3631,6 +3665,7 @@ const FileItem = /*#__PURE__*/React__default["default"].memo(({
3631
3665
  }, time));
3632
3666
  return () => {
3633
3667
  setI(_ => _);
3668
+ setT(_ => _);
3634
3669
  clearTimeout(t);
3635
3670
  clearInterval(i);
3636
3671
  };
@@ -3890,6 +3925,7 @@ const NewFile = ({
3890
3925
  listItemPadding,
3891
3926
  progressFontSize,
3892
3927
  borderHoverColor,
3928
+ maxCHoosenLength,
3893
3929
  listItemErrorSize,
3894
3930
  progressTrackColor,
3895
3931
  fileAreaImageWidth,
@@ -3900,9 +3936,11 @@ const NewFile = ({
3900
3936
  progressSuccessColor,
3901
3937
  progressLoadingColor,
3902
3938
  hiddenBackgroundColor,
3939
+ maxCHoosenLengthError,
3903
3940
  extentionsRowMarginTop,
3904
3941
  listItemBackgroundColor,
3905
- listItemBackgroundErrorColor
3942
+ listItemBackgroundErrorColor,
3943
+ maxCHoosenLengthErrorHideTime
3906
3944
  }) => {
3907
3945
  const ref = React.useRef(null);
3908
3946
  const inpRef = React.useRef(null);
@@ -3910,13 +3948,10 @@ const NewFile = ({
3910
3948
  const [error, setError] = React.useState('');
3911
3949
  const [isHover, setIsHover] = React.useState(false);
3912
3950
  const [singleFile, setSingleFile] = React.useState(null);
3951
+ const [choosenFileCount, setChoosenFileCount] = React.useState(0);
3913
3952
  const [image, setImage] = React.useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
3914
3953
  const configStyles = compereConfigs();
3915
3954
  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
3955
  if (!multiple) {
3921
3956
  removeFile && removeFile(singleFile);
3922
3957
  } else {
@@ -3928,11 +3963,47 @@ const NewFile = ({
3928
3963
  setImage(null);
3929
3964
  removeFile && removeFile(singleFile);
3930
3965
  };
3931
- const handleChange = e => {
3932
- const file = e.target.files;
3933
- if (multiple) {
3934
- setError('');
3935
- setImage(null);
3966
+ const handleUploadFiles = file => {
3967
+ if (maxCHoosenLength && choosenFileCount > 0) {
3968
+ if (file.length > choosenFileCount || file.length + memoizedItems.length > choosenFileCount) {
3969
+ setError(maxCHoosenLengthError ? maxCHoosenLengthError : `Դիմումին կարող եք կցել առավելագույնը ${choosenFileCount} ֆայլ`);
3970
+ const clearFunc = () => {
3971
+ clearTimeout(time);
3972
+ };
3973
+ const time = setTimeout(() => {
3974
+ setError('');
3975
+ clearFunc();
3976
+ }, maxCHoosenLengthErrorHideTime && typeof maxCHoosenLengthErrorHideTime === 'number' ? Math.round(maxCHoosenLengthErrorHideTime) : 3000);
3977
+ } else {
3978
+ for (let ix = 0; ix < file.length; ix++) {
3979
+ if (file[ix]) {
3980
+ if (file[ix].size <= maxSize * Math.pow(2, 20)) {
3981
+ if (fileExtensions.includes(file[ix].type.split('/')[1]) || fileExtensions.includes('heic') && file[ix].type.split('/')[1] === 'heif') {
3982
+ change({
3983
+ id: '',
3984
+ check: '',
3985
+ status: '',
3986
+ file: file[ix],
3987
+ uuid: v4()
3988
+ });
3989
+ } else {
3990
+ change({
3991
+ file: file[ix],
3992
+ uuid: v4(),
3993
+ check: formatError
3994
+ });
3995
+ }
3996
+ } else {
3997
+ change({
3998
+ file: file[ix],
3999
+ uuid: v4(),
4000
+ check: maxSizeError
4001
+ });
4002
+ }
4003
+ }
4004
+ }
4005
+ }
4006
+ } else {
3936
4007
  for (let ix = 0; ix < file.length; ix++) {
3937
4008
  if (file[ix]) {
3938
4009
  if (file[ix].size <= maxSize * Math.pow(2, 20)) {
@@ -3960,6 +4031,14 @@ const NewFile = ({
3960
4031
  }
3961
4032
  }
3962
4033
  }
4034
+ }
4035
+ };
4036
+ const handleChange = e => {
4037
+ const file = e.target.files;
4038
+ if (multiple) {
4039
+ setError('');
4040
+ setImage(null);
4041
+ handleUploadFiles(file);
3963
4042
  if (file.length === 0 && memoizedItems.length === 0) {
3964
4043
  setError(noChoosenFile);
3965
4044
  }
@@ -4041,7 +4120,18 @@ const NewFile = ({
4041
4120
  if (multiple && !removeFile) {
4042
4121
  alert('Please add removeFile prop on NewFile component, it is a require in multiple mode');
4043
4122
  }
4044
- }, [multiple, removeFile, filesArray && filesArray.length, defaultData]);
4123
+ if (maxCHoosenLength) {
4124
+ if (typeof maxCHoosenLength !== 'number') {
4125
+ alert('maxCHoosenLength prop must be a number, please check it!');
4126
+ } else {
4127
+ if (maxCHoosenLength <= 0) {
4128
+ setChoosenFileCount(1);
4129
+ } else {
4130
+ setChoosenFileCount(Math.round(maxCHoosenLength));
4131
+ }
4132
+ }
4133
+ }
4134
+ }, [multiple, removeFile, filesArray && filesArray.length, defaultData, maxCHoosenLength]);
4045
4135
  React.useEffect(() => {
4046
4136
  if (deleteComponent && !removeComponent) {
4047
4137
  alert('Please add removeComponent prop on NewFile component it is require when deleteComponent prop is true');
@@ -4243,6 +4333,7 @@ NewFile.propTypes = {
4243
4333
  backgroundColor: PropTypes__default["default"].string,
4244
4334
  change: PropTypes__default["default"].func.isRequired,
4245
4335
  listItemPadding: PropTypes__default["default"].string,
4336
+ maxCHoosenLength: PropTypes__default["default"].number,
4246
4337
  progressFontSize: PropTypes__default["default"].string,
4247
4338
  borderHoverColor: PropTypes__default["default"].string,
4248
4339
  listItemErrorSize: PropTypes__default["default"].string,
@@ -4255,9 +4346,11 @@ NewFile.propTypes = {
4255
4346
  progressSuccessColor: PropTypes__default["default"].string,
4256
4347
  progressLoadingColor: PropTypes__default["default"].string,
4257
4348
  hiddenBackgroundColor: PropTypes__default["default"].string,
4349
+ maxCHoosenLengthError: PropTypes__default["default"].string,
4258
4350
  extentionsRowMarginTop: PropTypes__default["default"].string,
4259
4351
  listItemBackgroundColor: PropTypes__default["default"].string,
4260
4352
  listItemBackgroundErrorColor: PropTypes__default["default"].string,
4353
+ maxCHoosenLengthErrorHideTime: PropTypes__default["default"].number,
4261
4354
  filesArray: PropTypes__default["default"].arrayOf(PropTypes__default["default"].object),
4262
4355
  fileExtensions: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string)
4263
4356
  };
@@ -4412,16 +4505,10 @@ const Textarea = ({
4412
4505
  if (maxLength) {
4413
4506
  if (value.length > maxLength) {
4414
4507
  onChange(value.substr(0, maxLength));
4415
- setError('Նիշերի քանակը գերազանցում է');
4416
- } else {
4417
- setError('');
4418
4508
  }
4419
4509
  } else {
4420
4510
  if (value.length > configStyles.TEXTAREA.maxLength) {
4421
- setError('Նիշերի քանակը գերազանցում է');
4422
4511
  onChange(value.substr(0, configStyles.TEXTAREA.maxLength));
4423
- } else {
4424
- setError('');
4425
4512
  }
4426
4513
  }
4427
4514
  };
@@ -4632,7 +4719,7 @@ Typography.propTypes = {
4632
4719
  textDecoration: PropTypes__default["default"].string,
4633
4720
  backgroundColor: PropTypes__default["default"].string,
4634
4721
  variant: PropTypes__default["default"].oneOf(Object.values(TypographyType)),
4635
- size: PropTypes__default["default"].oneOf([PropTypes__default["default"].string, PropTypes__default["default"].number])
4722
+ size: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])
4636
4723
  };
4637
4724
  Typography.defaultProps = {
4638
4725
  variant: 'p'
@@ -5220,8 +5307,7 @@ const NewAutocomplete = ({
5220
5307
  alert('Please add options prop');
5221
5308
  }
5222
5309
  options && options.length > 0 && options.map(item => {
5223
- // eslint-disable-next-line no-prototype-builtins
5224
- if (!item.hasOwnProperty(keyNames.name)) {
5310
+ if (!hasOwnerProperty(item, keyNames.name)) {
5225
5311
  alert(`Please add ${keyNames.name} property in items of options array`);
5226
5312
  }
5227
5313
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.112",
3
+ "version": "0.0.113",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -52,6 +52,7 @@ export const Input = ({
52
52
  maxNumSize,
53
53
  labelColor,
54
54
  errorColor,
55
+ withoutDot,
55
56
  borderRight,
56
57
  placeholder,
57
58
  errorZindex,
@@ -215,6 +216,17 @@ export const Input = ({
215
216
  change(newStr)
216
217
  }
217
218
  }
219
+
220
+ if (withoutDot && !/^\d+$/.test(currentValue)) {
221
+ const newStr = currentValue.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
222
+ return b + c.replace(/\./g, '')
223
+ })
224
+ setInnerValue(newStr)
225
+ if (change) {
226
+ change(newStr)
227
+ }
228
+ }
229
+
218
230
  if (currentValue === '') {
219
231
  setInnerValue('')
220
232
  if (change) {
@@ -357,6 +369,17 @@ export const Input = ({
357
369
  change(newStr)
358
370
  }
359
371
  }
372
+
373
+ if (withoutDot && !/^\d+$/.test(value)) {
374
+ const newStr = value.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
375
+ return b + c.replace(/\./g, '')
376
+ })
377
+ setInnerValue(newStr)
378
+ if (change) {
379
+ change(newStr)
380
+ }
381
+ }
382
+
360
383
  if (value === '') {
361
384
  setInnerValue('')
362
385
  if (change) {
@@ -591,6 +614,7 @@ Input.propTypes = {
591
614
  padding: PropTypes.string,
592
615
  fontSize: PropTypes.string,
593
616
  tooltip: PropTypes.element,
617
+ withoutDot: PropTypes.bool,
594
618
  marginTop: PropTypes.string,
595
619
  transform: PropTypes.string,
596
620
  className: PropTypes.string,
@@ -23,6 +23,4 @@ const Template = (args) => {
23
23
  export const Default = Template.bind({})
24
24
  Default.args = {
25
25
  type: InputTypes.TEXT,
26
- minNumSize: 1,
27
- maxNumSize: 8.8,
28
26
  }