@xaypay/tui 0.2.11 → 0.2.13

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
@@ -1173,6 +1173,12 @@ var packageResult = {
1173
1173
  font: {
1174
1174
  ...fontObject
1175
1175
  }
1176
+ },
1177
+ order: {
1178
+ color: '#000',
1179
+ font: {
1180
+ ...fontObject
1181
+ }
1176
1182
  }
1177
1183
  },
1178
1184
  // default properties for <Pagination /> component
@@ -1602,7 +1608,22 @@ const File = /*#__PURE__*/React.forwardRef(({
1602
1608
  const [singleFile, setSingleFile] = React.useState(null);
1603
1609
  const [configStyles, setConfigStyles] = React.useState({});
1604
1610
  const [choosenFileCount, setChoosenFileCount] = React.useState(0);
1605
- const [image, setImage] = React.useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
1611
+ const [image, setImage] = React.useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url.startsWith('data:image/heif') || defaultData.url.startsWith('data:image/heic') || defaultData.url.startsWith('data:application/octet-stream') ? 'heic' : defaultData.url : 'pdf' : null : null);
1612
+ const handleCheckHeicFormat = async file => {
1613
+ const buffer = await file.arrayBuffer();
1614
+ const dataView = new DataView(buffer);
1615
+ if (dataView.byteLength < 12) return false;
1616
+ for (let i = 0; i < dataView.byteLength - 8; i++) {
1617
+ if (dataView.getUint8(i) === 0x66 && dataView.getUint8(i + 1) === 0x74 && dataView.getUint8(i + 2) === 0x79 && dataView.getUint8(i + 3) === 0x70) {
1618
+ const majorBrand = String.fromCharCode(dataView.getUint8(i + 4), dataView.getUint8(i + 5), dataView.getUint8(i + 6), dataView.getUint8(i + 7));
1619
+ const heicIdentifiers = ['heic', 'heix', 'mif1', 'msf1', 'hevc'];
1620
+ if (heicIdentifiers.includes(majorBrand)) {
1621
+ return Promise.resolve();
1622
+ }
1623
+ }
1624
+ }
1625
+ return Promise.reject();
1626
+ };
1606
1627
  const handleRemoveComponent = () => {
1607
1628
  if (!multiple) {
1608
1629
  removeFile && removeFile(singleFile);
@@ -1631,14 +1652,33 @@ const File = /*#__PURE__*/React.forwardRef(({
1631
1652
  for (let ix = 0; ix < file.length; ix++) {
1632
1653
  if (file[ix]) {
1633
1654
  if (file[ix].size <= maxSize * Math.pow(2, 20)) {
1634
- if (fileExtensions.includes(file[ix].type.split('/')[1]) || fileExtensions.includes('heic') && file[ix].type.split('/')[1] === 'heif') {
1635
- change({
1636
- id: '',
1637
- check: '',
1638
- status: '',
1639
- file: file[ix],
1640
- uuid: v4()
1641
- });
1655
+ if (fileExtensions.includes(file[ix].type.split('/')[1]) || file[ix].name.toLowerCase().endsWith('.heic') || file[ix].name.toLowerCase().endsWith('.heif')) {
1656
+ if ((fileExtensions.includes('heic') || fileExtensions.includes('heif')) && (file[ix].name.toLowerCase().endsWith('.heic') || file[ix].name.toLowerCase().endsWith('.heif'))) {
1657
+ handleCheckHeicFormat(file[ix]).then(() => {
1658
+ change({
1659
+ id: '',
1660
+ check: '',
1661
+ status: '',
1662
+ file: file[ix],
1663
+ uuid: v4()
1664
+ });
1665
+ setImage('heic');
1666
+ }).catch(() => {
1667
+ change({
1668
+ file: file[ix],
1669
+ uuid: v4(),
1670
+ check: formatError ?? configStyles.FILE.error.format
1671
+ });
1672
+ });
1673
+ } else {
1674
+ change({
1675
+ id: '',
1676
+ check: '',
1677
+ status: '',
1678
+ file: file[ix],
1679
+ uuid: v4()
1680
+ });
1681
+ }
1642
1682
  } else {
1643
1683
  change({
1644
1684
  file: file[ix],
@@ -1660,14 +1700,33 @@ const File = /*#__PURE__*/React.forwardRef(({
1660
1700
  for (let ix = 0; ix < file.length; ix++) {
1661
1701
  if (file[ix]) {
1662
1702
  if (file[ix].size <= maxSize * Math.pow(2, 20)) {
1663
- if (fileExtensions.includes(file[ix].type.split('/')[1]) || fileExtensions.includes('heic') && file[ix].type.split('/')[1] === 'heif') {
1664
- change({
1665
- id: '',
1666
- check: '',
1667
- status: '',
1668
- file: file[ix],
1669
- uuid: v4()
1670
- });
1703
+ if (fileExtensions.includes(file[ix].type.split('/')[1]) || file[ix].name.toLowerCase().endsWith('.heic') || file[ix].name.toLowerCase().endsWith('.heif')) {
1704
+ if ((fileExtensions.includes('heic') || fileExtensions.includes('heif')) && (file[ix].name.toLowerCase().endsWith('.heic') || file[ix].name.toLowerCase().endsWith('.heif'))) {
1705
+ handleCheckHeicFormat(file[ix]).then(() => {
1706
+ change({
1707
+ id: '',
1708
+ check: '',
1709
+ status: '',
1710
+ file: file[ix],
1711
+ uuid: v4()
1712
+ });
1713
+ setImage('heic');
1714
+ }).catch(() => {
1715
+ change({
1716
+ file: file[ix],
1717
+ uuid: v4(),
1718
+ check: formatError ?? configStyles.FILE.error.format
1719
+ });
1720
+ });
1721
+ } else {
1722
+ change({
1723
+ id: '',
1724
+ check: '',
1725
+ status: '',
1726
+ file: file[ix],
1727
+ uuid: v4()
1728
+ });
1729
+ }
1671
1730
  } else {
1672
1731
  change({
1673
1732
  file: file[ix],
@@ -1698,15 +1757,23 @@ const File = /*#__PURE__*/React.forwardRef(({
1698
1757
  } else {
1699
1758
  if (file[0]) {
1700
1759
  if (file[0].size <= maxSize * Math.pow(2, 20)) {
1701
- if (fileExtensions.includes(file[0].type.split('/')[1]) || fileExtensions.includes('heic') && (file[0].type === 'image/heif' || file[0].type === 'image/heic')) {
1760
+ if (fileExtensions.includes(file[0].type.split('/')[1]) || (fileExtensions.includes('heic') || fileExtensions.includes('heif')) && (file[0].type === 'image/heif' || file[0].type === 'image/heic' || file[0].name.toLowerCase().endsWith('.heic') || file[0].name.toLowerCase().endsWith('.heif'))) {
1702
1761
  setError('');
1703
- change(file);
1704
- setSingleFile(file);
1705
1762
  if (file[0].type === 'application/pdf') {
1706
1763
  setImage('pdf');
1707
- } else if (file[0].type === 'image/heif' || file[0].type === 'image/heic') {
1708
- setImage('heic');
1764
+ change(file[0]);
1765
+ setSingleFile(file[0]);
1766
+ } else if (file[0].type === 'image/heif' || file[0].type === 'image/heic' || file[0].name.toLowerCase().endsWith('.heic') || file[0].name.toLowerCase().endsWith('.heif')) {
1767
+ handleCheckHeicFormat(file[0]).then(() => {
1768
+ setImage('heic');
1769
+ change(file[0]);
1770
+ setSingleFile(file[0]);
1771
+ }).catch(() => {
1772
+ setImage(null);
1773
+ setError(formatError ?? configStyles.FILE.error.format);
1774
+ });
1709
1775
  } else {
1776
+ change(file[0]);
1710
1777
  setImage(URL.createObjectURL(file[0]));
1711
1778
  }
1712
1779
  } else {
@@ -1762,7 +1829,7 @@ const File = /*#__PURE__*/React.forwardRef(({
1762
1829
  }));
1763
1830
  React.useEffect(() => {
1764
1831
  if (!multiple && defaultData) {
1765
- if (!defaultData.type) {
1832
+ if (!defaultData.type && !defaultData.url.startsWith('data:image/heif') && !defaultData.url.startsWith('data:image/heic') && !defaultData.url.startsWith('data:application/octet-stream')) {
1766
1833
  alert('Please add type in defaultData prop');
1767
1834
  }
1768
1835
  if (!defaultData.url) {
@@ -2307,6 +2374,9 @@ const handleUtilsMouseEnterLeave = (e, behaviourStyle) => {
2307
2374
  };
2308
2375
  const handleUtilsCheckTypeTel = (val, prevVal) => {
2309
2376
  const phoneNumberRegex = /^\d{0,8}$/;
2377
+ if (val.length > 7) {
2378
+ val = val.substr(0, 8);
2379
+ }
2310
2380
  if (!phoneNumberRegex.test(val)) {
2311
2381
  val = prevVal;
2312
2382
  }
@@ -2341,14 +2411,16 @@ const handleUtilsCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumS
2341
2411
  }
2342
2412
  }
2343
2413
  if (!regNum.test(val)) {
2344
- const newStr = val.replace(/[^0-9.]/g, '').replace(/^([^.]*\.|\․|\.|\,)(.*)$/, function (_, b, c) {
2414
+ let newVal = typeof val === 'number' ? val.toString() : val;
2415
+ const newStr = newVal.replace(/[^0-9.]/g, '').replace(/^([^.]*\.|\․|\.|\,)(.*)$/, function (_, b, c) {
2345
2416
  return b + c.replace(/\.|\․|\.|\,/g, '');
2346
2417
  });
2347
2418
  val = newStr;
2348
2419
  }
2349
2420
  }
2350
2421
  if (withoutDot && !/^\d+$/.test(val)) {
2351
- const newStr = val.replace(/[^0-9]/g, '').replace(/^([^.]*\.|\․|\.|\,)(.*)$/, function (_, b, c) {
2422
+ let newVal = typeof val === 'number' ? val.toString() : val;
2423
+ const newStr = newVal.replace(/[^0-9]/g, '').replace(/^([^.]*\.|\․|\.|\,)(.*)$/, function (_, b, c) {
2352
2424
  return b + c.replace(/\.|\․|\.|\,/g, '');
2353
2425
  });
2354
2426
  val = newStr;
@@ -2360,6 +2432,9 @@ const handleUtilsOpenInNewTab = url => {
2360
2432
  imageLink.href = url, imageLink.target = '_blank';
2361
2433
  imageLink.click();
2362
2434
  };
2435
+ const handleRemoveLeadingZeros = str => {
2436
+ return str.replace(/^0+(\d)/, '$1');
2437
+ };
2363
2438
 
2364
2439
  function styleInject(css, ref) {
2365
2440
  if ( ref === void 0 ) ref = {};
@@ -2454,28 +2529,38 @@ const TH = ({
2454
2529
  }, item.type === 'show' ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : '')));
2455
2530
  };
2456
2531
 
2532
+ var img$1 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cmask id='mask0_18604_3112' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='24' height='24'%3e%3cpath d='M0 0H24V24H0V0Z' fill='white'/%3e%3c/mask%3e%3cg mask='url(%23mask0_18604_3112)'%3e%3cpath d='M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z' fill='%23A3A5A9'/%3e%3c/g%3e%3c/svg%3e";
2533
+
2457
2534
  const TD = ({
2458
2535
  row,
2459
2536
  item,
2460
2537
  index,
2461
2538
  rowItem,
2462
2539
  rowRadius,
2540
+ dragStart,
2541
+ handleMouseDown,
2463
2542
  hideBorder,
2464
2543
  innerIndex,
2465
2544
  tBodyColor,
2545
+ orderColor,
2466
2546
  borderRight,
2467
- borderRightColor,
2468
2547
  tBodyPadding,
2548
+ setIsDragging,
2549
+ orderFontSize,
2469
2550
  tBodyFontSize,
2470
2551
  openListColor,
2552
+ orderFontStyle,
2471
2553
  tBodyTextAlign,
2554
+ orderFontFamily,
2555
+ orderFontWeight,
2472
2556
  tBodyFontFamily,
2473
2557
  tBodyFontWeight,
2474
2558
  handleCheckDots,
2475
2559
  openListFontSize,
2560
+ borderRightColor,
2476
2561
  openListFontStyle,
2477
- openListFontWeight,
2478
2562
  handleCheckedBody,
2563
+ openListFontWeight,
2479
2564
  openListFontFamily,
2480
2565
  tableColumnMinWidth,
2481
2566
  tableColumnMaxWidth,
@@ -2603,7 +2688,26 @@ const TD = ({
2603
2688
  },
2604
2689
  onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
2605
2690
  className: styles$9['td-span']
2606
- }, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, 'checkBox') && /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
2691
+ }, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, 'draggableIcon') && /*#__PURE__*/React__default["default"].createElement("div", {
2692
+ draggable: true,
2693
+ style: {
2694
+ width: '24px',
2695
+ height: '24px',
2696
+ cursor: 'grab'
2697
+ },
2698
+ onDragStart: () => dragStart(index)
2699
+ }, /*#__PURE__*/React__default["default"].createElement("img", {
2700
+ src: img$1,
2701
+ alt: "drag"
2702
+ })), hasOwnerProperty(item, 'draggable') && /*#__PURE__*/React__default["default"].createElement("p", {
2703
+ style: {
2704
+ color: orderColor,
2705
+ fontSize: orderFontSize,
2706
+ fontStyle: orderFontStyle,
2707
+ fontFamily: orderFontFamily,
2708
+ fontWeight: orderFontWeight
2709
+ }
2710
+ }, item.order), hasOwnerProperty(item, 'checkBox') && /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
2607
2711
  data: item,
2608
2712
  index: index,
2609
2713
  innerIndex: innerIndex,
@@ -2816,20 +2920,34 @@ const Table = ({
2816
2920
  tBodyFontWeight,
2817
2921
  tBodyFontFamily,
2818
2922
  tBodyRowMarginTop,
2923
+ orderColor,
2924
+ orderFontSize,
2925
+ orderFontStyle,
2926
+ orderFontFamily,
2927
+ orderFontWeight,
2819
2928
  className,
2820
2929
  openListColor,
2821
2930
  openListFontSize,
2822
2931
  openListFontStyle,
2823
2932
  openListFontWeight,
2824
2933
  openListFontFamily,
2825
- hideBorder
2934
+ hideBorder,
2935
+ draggable,
2936
+ showOrder,
2937
+ draggableColor,
2938
+ getDraggableData
2826
2939
  }) => {
2940
+ const headerRef = React.useRef(null);
2941
+ const draggedRowIndex = React.useRef(null);
2827
2942
  const [body, setBody] = React.useState([]);
2828
2943
  const [header, setHeader] = React.useState([]);
2829
2944
  const [disableArr, setDisableArr] = React.useState([]);
2830
2945
  const [classProps, setClassProps] = React.useState({});
2946
+ const [checkDrag, setCheckDrag] = React.useState(false);
2831
2947
  const [checkedArray, setCheckedArray] = React.useState([]);
2832
2948
  const [configStyles, setConfigStyles] = React.useState({});
2949
+ React.useState(false);
2950
+ const [draggingIndex, setDraggingIndex] = React.useState(null);
2833
2951
  const handleCheckIfArrow = (bodyData, data) => {
2834
2952
  let removeItemIndex;
2835
2953
  let headerWithoutArrow = [];
@@ -3236,66 +3354,172 @@ const Table = ({
3236
3354
  });
3237
3355
  setBody(() => checkBodyMore);
3238
3356
  };
3357
+ const handleDragStart = index => {
3358
+ draggedRowIndex.current = index;
3359
+ setDraggingIndex(() => index);
3360
+ };
3361
+ const handleDrop = index => {
3362
+ let correctData = [];
3363
+ const newRows = body;
3364
+ const [draggedRow] = newRows.splice(draggedRowIndex.current, 1);
3365
+ newRows.splice(index, 0, draggedRow);
3366
+ newRows.map(item => {
3367
+ correctData.push([...item]);
3368
+ });
3369
+ setBody(correctData);
3370
+ getDraggableData && getDraggableData(correctData);
3371
+ setCheckDrag(prev => !prev);
3372
+ draggedRowIndex.current = null;
3373
+ setDraggingIndex(() => null);
3374
+ correctData = null;
3375
+ };
3239
3376
  React.useEffect(() => {
3240
- let checkedItems = [];
3241
- const disabledArray = [];
3242
- const checkBodyForChackedItems = dataBody.slice().map(item => Object.values(item));
3243
- if (arrowShow) {
3244
- const arrowColumnCount = handleSetInsertIndex(checkBodyForChackedItems[0], arrowColumn);
3245
- const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
3246
- const insert = checkForInsertArrow.map((item, index) => {
3247
- item.map((innerItem, innerIndex) => {
3248
- if (hasOwnerProperty(innerItem, 'checkBox')) {
3249
- if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3250
- if (innerItem.checkBox.disabled === true) {
3251
- if (!disabledArray[innerIndex]) {
3252
- disabledArray[innerIndex] = {
3253
- rowIndex: index,
3254
- columnIndex: innerIndex
3255
- };
3377
+ const draggableArray = body && body.length && body.map((item, index) => {
3378
+ if (showOrder) {
3379
+ Object.values(item).map((innerItem, innerIndex) => {
3380
+ if (innerIndex === 1) {
3381
+ innerItem.content = index + 1, innerItem.draggable = true;
3382
+ }
3383
+ return innerItem;
3384
+ });
3385
+ }
3386
+ return item;
3387
+ });
3388
+ getDraggableData && getDraggableData(draggableArray);
3389
+ setBody(() => draggableArray);
3390
+ }, [checkDrag]);
3391
+ React.useEffect(() => {
3392
+ const isEqual = JSON.stringify(body) === JSON.stringify(dataBody);
3393
+ if (!isEqual) {
3394
+ let insert = [];
3395
+ let newArray = [];
3396
+ let checkedItems = [];
3397
+ const disabledArray = [];
3398
+ const checkBodyForChackedItems = dataBody.slice().map(item => Object.values(item));
3399
+ if (arrowShow) {
3400
+ const arrowColumnCount = handleSetInsertIndex(checkBodyForChackedItems[0], arrowColumn);
3401
+ const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
3402
+ insert = checkForInsertArrow.map((item, index) => {
3403
+ item.map((innerItem, innerIndex) => {
3404
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
3405
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3406
+ if (innerItem.checkBox.disabled === true) {
3407
+ if (!disabledArray[innerIndex]) {
3408
+ disabledArray[innerIndex] = {
3409
+ rowIndex: index,
3410
+ columnIndex: innerIndex
3411
+ };
3412
+ }
3256
3413
  }
3257
3414
  }
3258
3415
  }
3259
- }
3416
+ });
3417
+ return item;
3260
3418
  });
3261
- return item;
3262
- });
3263
- checkedItems = handleSetCheckboxArray(insert);
3264
- setBody(() => insert);
3265
- } else {
3266
- const insert = checkBodyForChackedItems.map((item, index) => {
3267
- item.map((innerItem, innerIndex) => {
3268
- if (hasOwnerProperty(innerItem, 'checkBox')) {
3269
- if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3270
- if (innerItem.checkBox.disabled === true) {
3271
- if (!disabledArray[innerIndex]) {
3272
- disabledArray[innerIndex] = {
3273
- rowIndex: index,
3274
- columnIndex: innerIndex
3275
- };
3419
+ checkedItems = handleSetCheckboxArray(insert);
3420
+ if (draggable) {
3421
+ newArray = insert && insert.length && insert.map((item, index) => {
3422
+ item.map(innerItem => {
3423
+ if (hasOwnerProperty(innerItem, 'colorStatus')) {
3424
+ innerItem.colorStatus = null;
3425
+ }
3426
+ });
3427
+ if (showOrder) {
3428
+ item.unshift({
3429
+ content: index + 1,
3430
+ draggable: true
3431
+ });
3432
+ }
3433
+ item.unshift({
3434
+ draggableIcon: '',
3435
+ colorStatus: draggableColor
3436
+ });
3437
+ return item;
3438
+ });
3439
+ }
3440
+ } else {
3441
+ insert = checkBodyForChackedItems.map((item, index) => {
3442
+ item.map((innerItem, innerIndex) => {
3443
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
3444
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3445
+ if (innerItem.checkBox.disabled === true) {
3446
+ if (!disabledArray[innerIndex]) {
3447
+ disabledArray[innerIndex] = {
3448
+ rowIndex: index,
3449
+ columnIndex: innerIndex
3450
+ };
3451
+ }
3276
3452
  }
3277
3453
  }
3278
3454
  }
3279
- }
3455
+ });
3456
+ return item;
3280
3457
  });
3281
- return item;
3282
- });
3283
- checkedItems = handleSetCheckboxArray(insert);
3284
- setBody(() => insert);
3458
+ checkedItems = handleSetCheckboxArray(insert);
3459
+ if (draggable) {
3460
+ newArray = insert && insert.length && insert.map((item, index) => {
3461
+ item.map(innerItem => {
3462
+ if (hasOwnerProperty(innerItem, 'colorStatus')) {
3463
+ innerItem.colorStatus = null;
3464
+ }
3465
+ });
3466
+ if (showOrder) {
3467
+ item.unshift({
3468
+ content: index + 1,
3469
+ draggable: true
3470
+ });
3471
+ }
3472
+ item.unshift({
3473
+ draggableIcon: '',
3474
+ colorStatus: draggableColor
3475
+ });
3476
+ return item;
3477
+ });
3478
+ }
3479
+ }
3480
+ getDraggableData && getDraggableData(newArray && newArray.length ? newArray : insert);
3481
+ setBody(() => newArray && newArray.length ? newArray : insert);
3482
+ setDisableArr(disabledArray);
3483
+ setCheckedArray(() => checkedItems);
3285
3484
  }
3286
- setDisableArr(disabledArray);
3287
- setCheckedArray(() => checkedItems);
3288
- }, [dataBody, arrowColumn, arrowShow]);
3485
+ }, [dataBody, arrowColumn, arrowShow, draggable]);
3289
3486
  React.useEffect(() => {
3290
- if (arrowShow) {
3291
- const header = dataHeader.slice();
3292
- const arrowColumnCount = handleSetInsertIndex(header, arrowColumn);
3293
- const checkForInsertArrow = handleTransformDataForInsertArrow(header, arrowColumnCount, 'header');
3294
- setHeader(() => checkForInsertArrow);
3295
- } else {
3296
- setHeader(() => dataHeader);
3487
+ const isEqual = JSON.stringify(header) === JSON.stringify(dataHeader);
3488
+ if (!isEqual) {
3489
+ let insert = [];
3490
+ let newArray = [];
3491
+ if (arrowShow) {
3492
+ const header = dataHeader.slice();
3493
+ const arrowColumnCount = handleSetInsertIndex(header, arrowColumn);
3494
+ const checkForInsertArrow = handleTransformDataForInsertArrow(header, arrowColumnCount, 'header');
3495
+ insert = checkForInsertArrow;
3496
+ if (draggable) {
3497
+ newArray = insert;
3498
+ newArray && newArray.length && newArray.unshift({
3499
+ content: ''
3500
+ });
3501
+ if (showOrder) {
3502
+ newArray.unshift({
3503
+ content: ''
3504
+ });
3505
+ }
3506
+ }
3507
+ } else {
3508
+ if (draggable) {
3509
+ newArray = dataHeader;
3510
+ newArray && newArray.length && newArray.unshift({
3511
+ content: ''
3512
+ });
3513
+ if (showOrder) {
3514
+ newArray.unshift({
3515
+ content: ''
3516
+ });
3517
+ }
3518
+ }
3519
+ }
3520
+ setHeader(() => newArray && newArray.length ? newArray : insert);
3297
3521
  }
3298
- }, [dataHeader, arrowColumn, arrowShow, disableArr]);
3522
+ }, [dataHeader, arrowColumn, arrowShow, disableArr, draggable]);
3299
3523
  React.useEffect(() => {
3300
3524
  className && setClassProps(() => classnames__default["default"](className ?? configStyles.TABLE.className));
3301
3525
  }, [className]);
@@ -3319,7 +3543,9 @@ const Table = ({
3319
3543
  },
3320
3544
  onClick: handleTableClick,
3321
3545
  className: classProps
3322
- }, header && header.length > 0 && /*#__PURE__*/React__default["default"].createElement("thead", null, /*#__PURE__*/React__default["default"].createElement("tr", {
3546
+ }, header && header.length > 0 && /*#__PURE__*/React__default["default"].createElement("thead", {
3547
+ ref: headerRef
3548
+ }, /*#__PURE__*/React__default["default"].createElement("tr", {
3323
3549
  style: {
3324
3550
  color: tHeadColor ?? configStyles.TABLE.head.color,
3325
3551
  backgroundColor: tHeadBackgroundColor ?? configStyles.TABLE.head.colors.background,
@@ -3350,6 +3576,9 @@ const Table = ({
3350
3576
  }
3351
3577
  }, body.map((item, index) => {
3352
3578
  return /*#__PURE__*/React__default["default"].createElement("tr", {
3579
+ onDragStart: () => handleDragStart(index),
3580
+ onDragOver: e => e.preventDefault(),
3581
+ onDrop: () => handleDrop(index),
3353
3582
  key: `${item}_${index}`,
3354
3583
  style: {
3355
3584
  backgroundColor: tableRowBGColor ?? configStyles.TABLE.body.row.colors.background,
@@ -3364,6 +3593,7 @@ const Table = ({
3364
3593
  hideBorder: hideBorder,
3365
3594
  innerIndex: innerIndex,
3366
3595
  row: Object.values(item),
3596
+ dragStart: handleDragStart,
3367
3597
  id: item.id ? item.id : '',
3368
3598
  handleCheckDots: handleCheckDots,
3369
3599
  key: `${innerItem}_${index}_${innerIndex}`,
@@ -3378,6 +3608,11 @@ const Table = ({
3378
3608
  handleBodyActionClick: handleBodyActionClick,
3379
3609
  handleMoreOptionsClick: handleMoreOptionsClick,
3380
3610
  handleContentListClick: handleContentListClick,
3611
+ orderColor: orderColor ?? configStyles.TABLE.order.color,
3612
+ orderFontSize: orderFontSize ?? configStyles.TABLE.order.font.size,
3613
+ orderFontStyle: orderFontStyle ?? configStyles.TABLE.order.font.style,
3614
+ orderFontFamily: orderFontFamily ?? configStyles.TABLE.order.font.family,
3615
+ orderFontWeight: orderFontWeight ?? configStyles.TABLE.order.font.weight,
3381
3616
  tBodyColor: tBodyColor ?? configStyles.TABLE.body.color,
3382
3617
  rowItem: tableRowItem ?? configStyles.TABLE.body.row.isItem,
3383
3618
  rowRadius: tableRowRadius ?? configStyles.TABLE.body.row.radius,
@@ -3587,6 +3822,8 @@ const Modal = ({
3587
3822
  closeAreaBackgroundColor,
3588
3823
  type = 'content'
3589
3824
  }) => {
3825
+ const leftBtnRef = React.useRef(null);
3826
+ const rightBtnRef = React.useRef(null);
3590
3827
  const [select, setSelect] = React.useState(0);
3591
3828
  const [isHover, setIsHover] = React.useState(false);
3592
3829
  const [innerData, setInnerData] = React.useState([]);
@@ -3613,6 +3850,17 @@ const Modal = ({
3613
3850
  }
3614
3851
  }
3615
3852
  };
3853
+ const handleNavigateArrow = e => {
3854
+ if (e.key === 'ArrowRight') {
3855
+ if (rightBtnRef.current) {
3856
+ rightBtnRef.current.click();
3857
+ }
3858
+ } else if (e.key === 'ArrowLeft') {
3859
+ if (leftBtnRef.current) {
3860
+ leftBtnRef.current.click();
3861
+ }
3862
+ }
3863
+ };
3616
3864
  const handleESC = e => {
3617
3865
  if (e.key === 'Escape') {
3618
3866
  handleCloseModal();
@@ -3652,7 +3900,10 @@ const Modal = ({
3652
3900
  className && setClassProps(() => classnames__default["default"](className ?? configStyles.MODAL.className));
3653
3901
  }, [className]);
3654
3902
  React.useEffect(() => {
3655
- document.addEventListener('keydown', handleESC, false);
3903
+ document.addEventListener('keydown', e => {
3904
+ handleESC(e);
3905
+ handleNavigateArrow(e);
3906
+ }, false);
3656
3907
  configStylesPromise.then(data => {
3657
3908
  setClassProps(() => classnames__default["default"](className ?? data.MODAL.className));
3658
3909
  setConfigStyles(() => {
@@ -3666,7 +3917,10 @@ const Modal = ({
3666
3917
  return () => {
3667
3918
  setSelect(0);
3668
3919
  setInnerData([]);
3669
- document.removeEventListener('keydown', handleESC, false);
3920
+ document.removeEventListener('keydown', e => {
3921
+ handleESC(e);
3922
+ handleNavigateArrow(e);
3923
+ }, false);
3670
3924
  };
3671
3925
  }, []);
3672
3926
  return configStyles.MODAL && /*#__PURE__*/React__default["default"].createElement("div", {
@@ -3840,6 +4094,7 @@ const Modal = ({
3840
4094
  }
3841
4095
  }
3842
4096
  }), innerData && innerData.length > 1 && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("button", {
4097
+ ref: leftBtnRef,
3843
4098
  onClick: () => handleGoTo('prev'),
3844
4099
  style: {
3845
4100
  position: 'absolute',
@@ -3854,6 +4109,7 @@ const Modal = ({
3854
4109
  backgroundColor: 'transparent'
3855
4110
  }
3856
4111
  }, prevIcon ? prevIcon : configStyles.MODAL.icon.prev ? configStyles.MODAL.icon.prev : /*#__PURE__*/React__default["default"].createElement(SvgPrev, null)), /*#__PURE__*/React__default["default"].createElement("button", {
4112
+ ref: rightBtnRef,
3857
4113
  onClick: () => handleGoTo('next'),
3858
4114
  style: {
3859
4115
  position: 'absolute',
@@ -3943,7 +4199,7 @@ const TelInput = ({
3943
4199
  React.useEffect(() => {
3944
4200
  let newValue = '';
3945
4201
  if (value !== undefined && value !== null) {
3946
- newValue = handleUtilsCheckTypeTel(value, newValue);
4202
+ newValue = handleUtilsCheckTypeTel(value);
3947
4203
  }
3948
4204
  setInnerValue(() => newValue);
3949
4205
  }, [value]);
@@ -4087,6 +4343,7 @@ const NumberInput = ({
4087
4343
  inpStyles,
4088
4344
  minNumSize,
4089
4345
  maxNumSize,
4346
+ insideError,
4090
4347
  inputChange,
4091
4348
  inpAttributes,
4092
4349
  setInnerErrorMessage
@@ -4095,15 +4352,29 @@ const NumberInput = ({
4095
4352
  const [innerMinNumSize, setInnerMinNumSize] = React.useState(0);
4096
4353
  const handleChange = event => {
4097
4354
  let prevValue = innerValue;
4098
- let currentValue = event.target.value;
4355
+ let currentValue = event.target.value.replace(/\.|․|\.|,/g, '.');
4099
4356
  currentValue = handleUtilsCheckTypeNumber(currentValue, prevValue, null, float, maxNumSize, dots);
4100
4357
  setInnerValue(() => currentValue);
4101
4358
  if (inputChange && currentValue !== prevValue) {
4102
- if (currentValue < Number.MIN_SAFE_INTEGER || currentValue > Number.MAX_SAFE_INTEGER || innerMinNumSize && currentValue < innerMinNumSize || maxNumSize && currentValue > maxNumSize) {
4359
+ if (currentValue < Number.MIN_SAFE_INTEGER || currentValue > Number.MAX_SAFE_INTEGER) {
4103
4360
  if (currentValue === '') {
4104
4361
  setInnerErrorMessage(() => '');
4105
4362
  } else {
4106
- setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${innerMinNumSize} - ${maxNumSize} միջակայքում`);
4363
+ insideError && insideError();
4364
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${Number.MIN_SAFE_INTEGER} - ${Number.MAX_SAFE_INTEGER} թվերի միջակայքում`);
4365
+ }
4366
+ } else if (innerMinNumSize && currentValue < innerMinNumSize || maxNumSize && currentValue > maxNumSize) {
4367
+ if (currentValue === '') {
4368
+ setInnerErrorMessage(() => '');
4369
+ } else {
4370
+ insideError && insideError();
4371
+ if (innerMinNumSize && !maxNumSize) {
4372
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ոչ պակաս ${innerMinNumSize} - ից`);
4373
+ } else if (!innerMinNumSize && maxNumSize) {
4374
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ոչ մեծ ${maxNumSize} ֊ ից`);
4375
+ } else if (innerMinNumSize && maxNumSize) {
4376
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${innerMinNumSize} - ${maxNumSize} թվերի միջակայքում`);
4377
+ }
4107
4378
  }
4108
4379
  } else if (currentValue >= Number.MIN_SAFE_INTEGER || currentValue <= Number.MAX_SAFE_INTEGER || innerMinNumSize && currentValue >= innerMinNumSize || maxNumSize && currentValue <= maxNumSize) {
4109
4380
  inputChange(currentValue);
@@ -4111,6 +4382,14 @@ const NumberInput = ({
4111
4382
  }
4112
4383
  }
4113
4384
  };
4385
+ const handleBlur = () => {
4386
+ const newVal = handleRemoveLeadingZeros(innerValue);
4387
+ if (parseFloat(newVal) === 0) {
4388
+ inputChange('');
4389
+ } else {
4390
+ inputChange(newVal);
4391
+ }
4392
+ };
4114
4393
  React.useEffect(() => {
4115
4394
  if (minNumSize && minNumSize < 0) {
4116
4395
  setInnerMinNumSize(0);
@@ -4144,6 +4423,7 @@ const NumberInput = ({
4144
4423
  },
4145
4424
  min: minNumSize,
4146
4425
  max: maxNumSize,
4426
+ onBlur: handleBlur,
4147
4427
  onInput: handleChange
4148
4428
  });
4149
4429
  };
@@ -4220,6 +4500,7 @@ const Input = ({
4220
4500
  telBorderRightWidth,
4221
4501
  telBorderRightStyle,
4222
4502
  telBorderRightColor,
4503
+ fireInputInsideError,
4223
4504
  backgroundDisableColor,
4224
4505
  telBorderRightColorHover,
4225
4506
  type = 'text'
@@ -4335,7 +4616,7 @@ const Input = ({
4335
4616
  boxSizing: boxSizing ?? configStyles.INPUT.box.sizing,
4336
4617
  borderTopLeftRadius: radius ?? configStyles.INPUT.radius,
4337
4618
  borderBottomLeftRadius: radius ?? configStyles.INPUT.radius,
4338
- backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.colors.background
4619
+ backgroundColor: disabled ? backgroundDisableColor ? backgroundDisableColor : configStyles.INPUT.colors.backgroundDisable : backgroundColor ? backgroundColor : configStyles.INPUT.colors.background
4339
4620
  }
4340
4621
  }, type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]) : '', type === 'tel' ? /*#__PURE__*/React__default["default"].createElement(TelInput, {
4341
4622
  type: type,
@@ -4361,6 +4642,7 @@ const Input = ({
4361
4642
  inputChange: change,
4362
4643
  inpStyles: inpStyles,
4363
4644
  inpAttributes: inpAttributes,
4645
+ insideError: fireInputInsideError,
4364
4646
  minNumSize: minNumSize ? minNumSize : '',
4365
4647
  maxNumSize: maxNumSize ? maxNumSize : '',
4366
4648
  setInnerErrorMessage: setInnerErrorMessage,
@@ -4396,7 +4678,7 @@ const Input = ({
4396
4678
  boxSizing: boxSizing ?? configStyles.INPUT.box.sizing,
4397
4679
  borderTopRightRadius: radius ?? configStyles.INPUT.radius,
4398
4680
  borderBottomRightRadius: radius ?? configStyles.INPUT.radius,
4399
- backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.colors.background
4681
+ backgroundColor: disabled ? backgroundDisableColor ? backgroundDisableColor : configStyles.INPUT.colors.backgroundDisable : backgroundColor ? backgroundColor : configStyles.INPUT.colors.background
4400
4682
  }
4401
4683
  }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
4402
4684
  animation: animation,
@@ -4472,6 +4754,7 @@ Input.propTypes = {
4472
4754
  labelMarginBottom: PropTypes__default["default"].string,
4473
4755
  regexpErrorMessage: PropTypes__default["default"].string,
4474
4756
  regexp: PropTypes__default["default"].instanceOf(RegExp),
4757
+ fireInputInsideError: PropTypes__default["default"].func,
4475
4758
  telBorderRightWidth: PropTypes__default["default"].string,
4476
4759
  telBorderRightStyle: PropTypes__default["default"].string,
4477
4760
  telBorderRightColor: PropTypes__default["default"].string,