@xaypay/tui 0.2.12 → 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.es.js CHANGED
@@ -1142,6 +1142,12 @@ var packageResult = {
1142
1142
  font: {
1143
1143
  ...fontObject
1144
1144
  }
1145
+ },
1146
+ order: {
1147
+ color: '#000',
1148
+ font: {
1149
+ ...fontObject
1150
+ }
1145
1151
  }
1146
1152
  },
1147
1153
  // default properties for <Pagination /> component
@@ -1465,22 +1471,6 @@ const SvgDeleteComponent = ({
1465
1471
  fill: fillColor ? fillColor : '#E00'
1466
1472
  }));
1467
1473
 
1468
- class FileTypeParser {
1469
- static ftypHeader = new Uint8Array([0x66, 0x74, 0x79, 0x70]);
1470
- hasISOBaseMediaFile(buffer) {
1471
- const slicedBuffer = new Uint8Array(buffer.slice(0, 12));
1472
- return this.check(slicedBuffer, FileTypeParser.ftypHeader, {
1473
- offset: 4
1474
- }) && (slicedBuffer[8] & 0x60) !== 0x00;
1475
- }
1476
- check(buffer, headers, options) {
1477
- for (const [index, header] of headers.entries()) {
1478
- if (header !== buffer[index + options.offset]) return false;
1479
- }
1480
- return true;
1481
- }
1482
- }
1483
-
1484
1474
  // eslint-disable-next-line react/display-name
1485
1475
  const File = /*#__PURE__*/forwardRef(({
1486
1476
  or,
@@ -1587,13 +1577,19 @@ const File = /*#__PURE__*/forwardRef(({
1587
1577
  const [singleFile, setSingleFile] = useState(null);
1588
1578
  const [configStyles, setConfigStyles] = useState({});
1589
1579
  const [choosenFileCount, setChoosenFileCount] = useState(0);
1590
- const [image, setImage] = useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
1580
+ const [image, setImage] = 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);
1591
1581
  const handleCheckHeicFormat = async file => {
1592
1582
  const buffer = await file.arrayBuffer();
1593
- const fileTypeParser = new FileTypeParser();
1594
- const hasISOBaseMediaFile = fileTypeParser.hasISOBaseMediaFile(buffer);
1595
- if (hasISOBaseMediaFile) {
1596
- return Promise.resolve();
1583
+ const dataView = new DataView(buffer);
1584
+ if (dataView.byteLength < 12) return false;
1585
+ for (let i = 0; i < dataView.byteLength - 8; i++) {
1586
+ if (dataView.getUint8(i) === 0x66 && dataView.getUint8(i + 1) === 0x74 && dataView.getUint8(i + 2) === 0x79 && dataView.getUint8(i + 3) === 0x70) {
1587
+ const majorBrand = String.fromCharCode(dataView.getUint8(i + 4), dataView.getUint8(i + 5), dataView.getUint8(i + 6), dataView.getUint8(i + 7));
1588
+ const heicIdentifiers = ['heic', 'heix', 'mif1', 'msf1', 'hevc'];
1589
+ if (heicIdentifiers.includes(majorBrand)) {
1590
+ return Promise.resolve();
1591
+ }
1592
+ }
1597
1593
  }
1598
1594
  return Promise.reject();
1599
1595
  };
@@ -1635,6 +1631,7 @@ const File = /*#__PURE__*/forwardRef(({
1635
1631
  file: file[ix],
1636
1632
  uuid: v4()
1637
1633
  });
1634
+ setImage('heic');
1638
1635
  }).catch(() => {
1639
1636
  change({
1640
1637
  file: file[ix],
@@ -1682,6 +1679,7 @@ const File = /*#__PURE__*/forwardRef(({
1682
1679
  file: file[ix],
1683
1680
  uuid: v4()
1684
1681
  });
1682
+ setImage('heic');
1685
1683
  }).catch(() => {
1686
1684
  change({
1687
1685
  file: file[ix],
@@ -1730,18 +1728,21 @@ const File = /*#__PURE__*/forwardRef(({
1730
1728
  if (file[0].size <= maxSize * Math.pow(2, 20)) {
1731
1729
  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'))) {
1732
1730
  setError('');
1733
- change(file);
1734
- setSingleFile(file);
1735
1731
  if (file[0].type === 'application/pdf') {
1736
1732
  setImage('pdf');
1733
+ change(file[0]);
1734
+ setSingleFile(file[0]);
1737
1735
  } else if (file[0].type === 'image/heif' || file[0].type === 'image/heic' || file[0].name.toLowerCase().endsWith('.heic') || file[0].name.toLowerCase().endsWith('.heif')) {
1738
1736
  handleCheckHeicFormat(file[0]).then(() => {
1739
1737
  setImage('heic');
1738
+ change(file[0]);
1739
+ setSingleFile(file[0]);
1740
1740
  }).catch(() => {
1741
1741
  setImage(null);
1742
1742
  setError(formatError ?? configStyles.FILE.error.format);
1743
1743
  });
1744
1744
  } else {
1745
+ change(file[0]);
1745
1746
  setImage(URL.createObjectURL(file[0]));
1746
1747
  }
1747
1748
  } else {
@@ -1797,7 +1798,7 @@ const File = /*#__PURE__*/forwardRef(({
1797
1798
  }));
1798
1799
  useEffect(() => {
1799
1800
  if (!multiple && defaultData) {
1800
- if (!defaultData.type) {
1801
+ if (!defaultData.type && !defaultData.url.startsWith('data:image/heif') && !defaultData.url.startsWith('data:image/heic') && !defaultData.url.startsWith('data:application/octet-stream')) {
1801
1802
  alert('Please add type in defaultData prop');
1802
1803
  }
1803
1804
  if (!defaultData.url) {
@@ -2497,28 +2498,38 @@ const TH = ({
2497
2498
  }, item.type === 'show' ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : '')));
2498
2499
  };
2499
2500
 
2501
+ 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";
2502
+
2500
2503
  const TD = ({
2501
2504
  row,
2502
2505
  item,
2503
2506
  index,
2504
2507
  rowItem,
2505
2508
  rowRadius,
2509
+ dragStart,
2510
+ handleMouseDown,
2506
2511
  hideBorder,
2507
2512
  innerIndex,
2508
2513
  tBodyColor,
2514
+ orderColor,
2509
2515
  borderRight,
2510
- borderRightColor,
2511
2516
  tBodyPadding,
2517
+ setIsDragging,
2518
+ orderFontSize,
2512
2519
  tBodyFontSize,
2513
2520
  openListColor,
2521
+ orderFontStyle,
2514
2522
  tBodyTextAlign,
2523
+ orderFontFamily,
2524
+ orderFontWeight,
2515
2525
  tBodyFontFamily,
2516
2526
  tBodyFontWeight,
2517
2527
  handleCheckDots,
2518
2528
  openListFontSize,
2529
+ borderRightColor,
2519
2530
  openListFontStyle,
2520
- openListFontWeight,
2521
2531
  handleCheckedBody,
2532
+ openListFontWeight,
2522
2533
  openListFontFamily,
2523
2534
  tableColumnMinWidth,
2524
2535
  tableColumnMaxWidth,
@@ -2646,7 +2657,26 @@ const TD = ({
2646
2657
  },
2647
2658
  onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
2648
2659
  className: styles$9['td-span']
2649
- }, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, 'checkBox') && /*#__PURE__*/React__default.createElement(SingleCheckbox, {
2660
+ }, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, 'draggableIcon') && /*#__PURE__*/React__default.createElement("div", {
2661
+ draggable: true,
2662
+ style: {
2663
+ width: '24px',
2664
+ height: '24px',
2665
+ cursor: 'grab'
2666
+ },
2667
+ onDragStart: () => dragStart(index)
2668
+ }, /*#__PURE__*/React__default.createElement("img", {
2669
+ src: img$1,
2670
+ alt: "drag"
2671
+ })), hasOwnerProperty(item, 'draggable') && /*#__PURE__*/React__default.createElement("p", {
2672
+ style: {
2673
+ color: orderColor,
2674
+ fontSize: orderFontSize,
2675
+ fontStyle: orderFontStyle,
2676
+ fontFamily: orderFontFamily,
2677
+ fontWeight: orderFontWeight
2678
+ }
2679
+ }, item.order), hasOwnerProperty(item, 'checkBox') && /*#__PURE__*/React__default.createElement(SingleCheckbox, {
2650
2680
  data: item,
2651
2681
  index: index,
2652
2682
  innerIndex: innerIndex,
@@ -2859,20 +2889,34 @@ const Table = ({
2859
2889
  tBodyFontWeight,
2860
2890
  tBodyFontFamily,
2861
2891
  tBodyRowMarginTop,
2892
+ orderColor,
2893
+ orderFontSize,
2894
+ orderFontStyle,
2895
+ orderFontFamily,
2896
+ orderFontWeight,
2862
2897
  className,
2863
2898
  openListColor,
2864
2899
  openListFontSize,
2865
2900
  openListFontStyle,
2866
2901
  openListFontWeight,
2867
2902
  openListFontFamily,
2868
- hideBorder
2903
+ hideBorder,
2904
+ draggable,
2905
+ showOrder,
2906
+ draggableColor,
2907
+ getDraggableData
2869
2908
  }) => {
2909
+ const headerRef = useRef(null);
2910
+ const draggedRowIndex = useRef(null);
2870
2911
  const [body, setBody] = useState([]);
2871
2912
  const [header, setHeader] = useState([]);
2872
2913
  const [disableArr, setDisableArr] = useState([]);
2873
2914
  const [classProps, setClassProps] = useState({});
2915
+ const [checkDrag, setCheckDrag] = useState(false);
2874
2916
  const [checkedArray, setCheckedArray] = useState([]);
2875
2917
  const [configStyles, setConfigStyles] = useState({});
2918
+ useState(false);
2919
+ const [draggingIndex, setDraggingIndex] = useState(null);
2876
2920
  const handleCheckIfArrow = (bodyData, data) => {
2877
2921
  let removeItemIndex;
2878
2922
  let headerWithoutArrow = [];
@@ -3279,66 +3323,172 @@ const Table = ({
3279
3323
  });
3280
3324
  setBody(() => checkBodyMore);
3281
3325
  };
3326
+ const handleDragStart = index => {
3327
+ draggedRowIndex.current = index;
3328
+ setDraggingIndex(() => index);
3329
+ };
3330
+ const handleDrop = index => {
3331
+ let correctData = [];
3332
+ const newRows = body;
3333
+ const [draggedRow] = newRows.splice(draggedRowIndex.current, 1);
3334
+ newRows.splice(index, 0, draggedRow);
3335
+ newRows.map(item => {
3336
+ correctData.push([...item]);
3337
+ });
3338
+ setBody(correctData);
3339
+ getDraggableData && getDraggableData(correctData);
3340
+ setCheckDrag(prev => !prev);
3341
+ draggedRowIndex.current = null;
3342
+ setDraggingIndex(() => null);
3343
+ correctData = null;
3344
+ };
3282
3345
  useEffect(() => {
3283
- let checkedItems = [];
3284
- const disabledArray = [];
3285
- const checkBodyForChackedItems = dataBody.slice().map(item => Object.values(item));
3286
- if (arrowShow) {
3287
- const arrowColumnCount = handleSetInsertIndex(checkBodyForChackedItems[0], arrowColumn);
3288
- const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
3289
- const insert = checkForInsertArrow.map((item, index) => {
3290
- item.map((innerItem, innerIndex) => {
3291
- if (hasOwnerProperty(innerItem, 'checkBox')) {
3292
- if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3293
- if (innerItem.checkBox.disabled === true) {
3294
- if (!disabledArray[innerIndex]) {
3295
- disabledArray[innerIndex] = {
3296
- rowIndex: index,
3297
- columnIndex: innerIndex
3298
- };
3346
+ const draggableArray = body && body.length && body.map((item, index) => {
3347
+ if (showOrder) {
3348
+ Object.values(item).map((innerItem, innerIndex) => {
3349
+ if (innerIndex === 1) {
3350
+ innerItem.content = index + 1, innerItem.draggable = true;
3351
+ }
3352
+ return innerItem;
3353
+ });
3354
+ }
3355
+ return item;
3356
+ });
3357
+ getDraggableData && getDraggableData(draggableArray);
3358
+ setBody(() => draggableArray);
3359
+ }, [checkDrag]);
3360
+ useEffect(() => {
3361
+ const isEqual = JSON.stringify(body) === JSON.stringify(dataBody);
3362
+ if (!isEqual) {
3363
+ let insert = [];
3364
+ let newArray = [];
3365
+ let checkedItems = [];
3366
+ const disabledArray = [];
3367
+ const checkBodyForChackedItems = dataBody.slice().map(item => Object.values(item));
3368
+ if (arrowShow) {
3369
+ const arrowColumnCount = handleSetInsertIndex(checkBodyForChackedItems[0], arrowColumn);
3370
+ const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
3371
+ insert = checkForInsertArrow.map((item, index) => {
3372
+ item.map((innerItem, innerIndex) => {
3373
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
3374
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3375
+ if (innerItem.checkBox.disabled === true) {
3376
+ if (!disabledArray[innerIndex]) {
3377
+ disabledArray[innerIndex] = {
3378
+ rowIndex: index,
3379
+ columnIndex: innerIndex
3380
+ };
3381
+ }
3299
3382
  }
3300
3383
  }
3301
3384
  }
3302
- }
3385
+ });
3386
+ return item;
3303
3387
  });
3304
- return item;
3305
- });
3306
- checkedItems = handleSetCheckboxArray(insert);
3307
- setBody(() => insert);
3308
- } else {
3309
- const insert = checkBodyForChackedItems.map((item, index) => {
3310
- item.map((innerItem, innerIndex) => {
3311
- if (hasOwnerProperty(innerItem, 'checkBox')) {
3312
- if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3313
- if (innerItem.checkBox.disabled === true) {
3314
- if (!disabledArray[innerIndex]) {
3315
- disabledArray[innerIndex] = {
3316
- rowIndex: index,
3317
- columnIndex: innerIndex
3318
- };
3388
+ checkedItems = handleSetCheckboxArray(insert);
3389
+ if (draggable) {
3390
+ newArray = insert && insert.length && insert.map((item, index) => {
3391
+ item.map(innerItem => {
3392
+ if (hasOwnerProperty(innerItem, 'colorStatus')) {
3393
+ innerItem.colorStatus = null;
3394
+ }
3395
+ });
3396
+ if (showOrder) {
3397
+ item.unshift({
3398
+ content: index + 1,
3399
+ draggable: true
3400
+ });
3401
+ }
3402
+ item.unshift({
3403
+ draggableIcon: '',
3404
+ colorStatus: draggableColor
3405
+ });
3406
+ return item;
3407
+ });
3408
+ }
3409
+ } else {
3410
+ insert = checkBodyForChackedItems.map((item, index) => {
3411
+ item.map((innerItem, innerIndex) => {
3412
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
3413
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3414
+ if (innerItem.checkBox.disabled === true) {
3415
+ if (!disabledArray[innerIndex]) {
3416
+ disabledArray[innerIndex] = {
3417
+ rowIndex: index,
3418
+ columnIndex: innerIndex
3419
+ };
3420
+ }
3319
3421
  }
3320
3422
  }
3321
3423
  }
3322
- }
3424
+ });
3425
+ return item;
3323
3426
  });
3324
- return item;
3325
- });
3326
- checkedItems = handleSetCheckboxArray(insert);
3327
- setBody(() => insert);
3427
+ checkedItems = handleSetCheckboxArray(insert);
3428
+ if (draggable) {
3429
+ newArray = insert && insert.length && insert.map((item, index) => {
3430
+ item.map(innerItem => {
3431
+ if (hasOwnerProperty(innerItem, 'colorStatus')) {
3432
+ innerItem.colorStatus = null;
3433
+ }
3434
+ });
3435
+ if (showOrder) {
3436
+ item.unshift({
3437
+ content: index + 1,
3438
+ draggable: true
3439
+ });
3440
+ }
3441
+ item.unshift({
3442
+ draggableIcon: '',
3443
+ colorStatus: draggableColor
3444
+ });
3445
+ return item;
3446
+ });
3447
+ }
3448
+ }
3449
+ getDraggableData && getDraggableData(newArray && newArray.length ? newArray : insert);
3450
+ setBody(() => newArray && newArray.length ? newArray : insert);
3451
+ setDisableArr(disabledArray);
3452
+ setCheckedArray(() => checkedItems);
3328
3453
  }
3329
- setDisableArr(disabledArray);
3330
- setCheckedArray(() => checkedItems);
3331
- }, [dataBody, arrowColumn, arrowShow]);
3454
+ }, [dataBody, arrowColumn, arrowShow, draggable]);
3332
3455
  useEffect(() => {
3333
- if (arrowShow) {
3334
- const header = dataHeader.slice();
3335
- const arrowColumnCount = handleSetInsertIndex(header, arrowColumn);
3336
- const checkForInsertArrow = handleTransformDataForInsertArrow(header, arrowColumnCount, 'header');
3337
- setHeader(() => checkForInsertArrow);
3338
- } else {
3339
- setHeader(() => dataHeader);
3456
+ const isEqual = JSON.stringify(header) === JSON.stringify(dataHeader);
3457
+ if (!isEqual) {
3458
+ let insert = [];
3459
+ let newArray = [];
3460
+ if (arrowShow) {
3461
+ const header = dataHeader.slice();
3462
+ const arrowColumnCount = handleSetInsertIndex(header, arrowColumn);
3463
+ const checkForInsertArrow = handleTransformDataForInsertArrow(header, arrowColumnCount, 'header');
3464
+ insert = checkForInsertArrow;
3465
+ if (draggable) {
3466
+ newArray = insert;
3467
+ newArray && newArray.length && newArray.unshift({
3468
+ content: ''
3469
+ });
3470
+ if (showOrder) {
3471
+ newArray.unshift({
3472
+ content: ''
3473
+ });
3474
+ }
3475
+ }
3476
+ } else {
3477
+ if (draggable) {
3478
+ newArray = dataHeader;
3479
+ newArray && newArray.length && newArray.unshift({
3480
+ content: ''
3481
+ });
3482
+ if (showOrder) {
3483
+ newArray.unshift({
3484
+ content: ''
3485
+ });
3486
+ }
3487
+ }
3488
+ }
3489
+ setHeader(() => newArray && newArray.length ? newArray : insert);
3340
3490
  }
3341
- }, [dataHeader, arrowColumn, arrowShow, disableArr]);
3491
+ }, [dataHeader, arrowColumn, arrowShow, disableArr, draggable]);
3342
3492
  useEffect(() => {
3343
3493
  className && setClassProps(() => classnames(className ?? configStyles.TABLE.className));
3344
3494
  }, [className]);
@@ -3362,7 +3512,9 @@ const Table = ({
3362
3512
  },
3363
3513
  onClick: handleTableClick,
3364
3514
  className: classProps
3365
- }, header && header.length > 0 && /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", {
3515
+ }, header && header.length > 0 && /*#__PURE__*/React__default.createElement("thead", {
3516
+ ref: headerRef
3517
+ }, /*#__PURE__*/React__default.createElement("tr", {
3366
3518
  style: {
3367
3519
  color: tHeadColor ?? configStyles.TABLE.head.color,
3368
3520
  backgroundColor: tHeadBackgroundColor ?? configStyles.TABLE.head.colors.background,
@@ -3393,6 +3545,9 @@ const Table = ({
3393
3545
  }
3394
3546
  }, body.map((item, index) => {
3395
3547
  return /*#__PURE__*/React__default.createElement("tr", {
3548
+ onDragStart: () => handleDragStart(index),
3549
+ onDragOver: e => e.preventDefault(),
3550
+ onDrop: () => handleDrop(index),
3396
3551
  key: `${item}_${index}`,
3397
3552
  style: {
3398
3553
  backgroundColor: tableRowBGColor ?? configStyles.TABLE.body.row.colors.background,
@@ -3407,6 +3562,7 @@ const Table = ({
3407
3562
  hideBorder: hideBorder,
3408
3563
  innerIndex: innerIndex,
3409
3564
  row: Object.values(item),
3565
+ dragStart: handleDragStart,
3410
3566
  id: item.id ? item.id : '',
3411
3567
  handleCheckDots: handleCheckDots,
3412
3568
  key: `${innerItem}_${index}_${innerIndex}`,
@@ -3421,6 +3577,11 @@ const Table = ({
3421
3577
  handleBodyActionClick: handleBodyActionClick,
3422
3578
  handleMoreOptionsClick: handleMoreOptionsClick,
3423
3579
  handleContentListClick: handleContentListClick,
3580
+ orderColor: orderColor ?? configStyles.TABLE.order.color,
3581
+ orderFontSize: orderFontSize ?? configStyles.TABLE.order.font.size,
3582
+ orderFontStyle: orderFontStyle ?? configStyles.TABLE.order.font.style,
3583
+ orderFontFamily: orderFontFamily ?? configStyles.TABLE.order.font.family,
3584
+ orderFontWeight: orderFontWeight ?? configStyles.TABLE.order.font.weight,
3424
3585
  tBodyColor: tBodyColor ?? configStyles.TABLE.body.color,
3425
3586
  rowItem: tableRowItem ?? configStyles.TABLE.body.row.isItem,
3426
3587
  rowRadius: tableRowRadius ?? configStyles.TABLE.body.row.radius,
@@ -4151,6 +4312,7 @@ const NumberInput = ({
4151
4312
  inpStyles,
4152
4313
  minNumSize,
4153
4314
  maxNumSize,
4315
+ insideError,
4154
4316
  inputChange,
4155
4317
  inpAttributes,
4156
4318
  setInnerErrorMessage
@@ -4167,13 +4329,21 @@ const NumberInput = ({
4167
4329
  if (currentValue === '') {
4168
4330
  setInnerErrorMessage(() => '');
4169
4331
  } else {
4332
+ insideError && insideError();
4170
4333
  setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${Number.MIN_SAFE_INTEGER} - ${Number.MAX_SAFE_INTEGER} թվերի միջակայքում`);
4171
4334
  }
4172
4335
  } else if (innerMinNumSize && currentValue < innerMinNumSize || maxNumSize && currentValue > maxNumSize) {
4173
4336
  if (currentValue === '') {
4174
4337
  setInnerErrorMessage(() => '');
4175
4338
  } else {
4176
- setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${innerMinNumSize} - ${maxNumSize} թվերի միջակայքում`);
4339
+ insideError && insideError();
4340
+ if (innerMinNumSize && !maxNumSize) {
4341
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ոչ պակաս ${innerMinNumSize} - ից`);
4342
+ } else if (!innerMinNumSize && maxNumSize) {
4343
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ոչ մեծ ${maxNumSize} ֊ ից`);
4344
+ } else if (innerMinNumSize && maxNumSize) {
4345
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${innerMinNumSize} - ${maxNumSize} թվերի միջակայքում`);
4346
+ }
4177
4347
  }
4178
4348
  } else if (currentValue >= Number.MIN_SAFE_INTEGER || currentValue <= Number.MAX_SAFE_INTEGER || innerMinNumSize && currentValue >= innerMinNumSize || maxNumSize && currentValue <= maxNumSize) {
4179
4349
  inputChange(currentValue);
@@ -4299,6 +4469,7 @@ const Input = ({
4299
4469
  telBorderRightWidth,
4300
4470
  telBorderRightStyle,
4301
4471
  telBorderRightColor,
4472
+ fireInputInsideError,
4302
4473
  backgroundDisableColor,
4303
4474
  telBorderRightColorHover,
4304
4475
  type = 'text'
@@ -4440,6 +4611,7 @@ const Input = ({
4440
4611
  inputChange: change,
4441
4612
  inpStyles: inpStyles,
4442
4613
  inpAttributes: inpAttributes,
4614
+ insideError: fireInputInsideError,
4443
4615
  minNumSize: minNumSize ? minNumSize : '',
4444
4616
  maxNumSize: maxNumSize ? maxNumSize : '',
4445
4617
  setInnerErrorMessage: setInnerErrorMessage,
@@ -4551,6 +4723,7 @@ Input.propTypes = {
4551
4723
  labelMarginBottom: PropTypes.string,
4552
4724
  regexpErrorMessage: PropTypes.string,
4553
4725
  regexp: PropTypes.instanceOf(RegExp),
4726
+ fireInputInsideError: PropTypes.func,
4554
4727
  telBorderRightWidth: PropTypes.string,
4555
4728
  telBorderRightStyle: PropTypes.string,
4556
4729
  telBorderRightColor: PropTypes.string,
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
@@ -1496,22 +1502,6 @@ const SvgDeleteComponent = ({
1496
1502
  fill: fillColor ? fillColor : '#E00'
1497
1503
  }));
1498
1504
 
1499
- class FileTypeParser {
1500
- static ftypHeader = new Uint8Array([0x66, 0x74, 0x79, 0x70]);
1501
- hasISOBaseMediaFile(buffer) {
1502
- const slicedBuffer = new Uint8Array(buffer.slice(0, 12));
1503
- return this.check(slicedBuffer, FileTypeParser.ftypHeader, {
1504
- offset: 4
1505
- }) && (slicedBuffer[8] & 0x60) !== 0x00;
1506
- }
1507
- check(buffer, headers, options) {
1508
- for (const [index, header] of headers.entries()) {
1509
- if (header !== buffer[index + options.offset]) return false;
1510
- }
1511
- return true;
1512
- }
1513
- }
1514
-
1515
1505
  // eslint-disable-next-line react/display-name
1516
1506
  const File = /*#__PURE__*/React.forwardRef(({
1517
1507
  or,
@@ -1618,13 +1608,19 @@ const File = /*#__PURE__*/React.forwardRef(({
1618
1608
  const [singleFile, setSingleFile] = React.useState(null);
1619
1609
  const [configStyles, setConfigStyles] = React.useState({});
1620
1610
  const [choosenFileCount, setChoosenFileCount] = React.useState(0);
1621
- 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);
1622
1612
  const handleCheckHeicFormat = async file => {
1623
1613
  const buffer = await file.arrayBuffer();
1624
- const fileTypeParser = new FileTypeParser();
1625
- const hasISOBaseMediaFile = fileTypeParser.hasISOBaseMediaFile(buffer);
1626
- if (hasISOBaseMediaFile) {
1627
- return Promise.resolve();
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
+ }
1628
1624
  }
1629
1625
  return Promise.reject();
1630
1626
  };
@@ -1666,6 +1662,7 @@ const File = /*#__PURE__*/React.forwardRef(({
1666
1662
  file: file[ix],
1667
1663
  uuid: v4()
1668
1664
  });
1665
+ setImage('heic');
1669
1666
  }).catch(() => {
1670
1667
  change({
1671
1668
  file: file[ix],
@@ -1713,6 +1710,7 @@ const File = /*#__PURE__*/React.forwardRef(({
1713
1710
  file: file[ix],
1714
1711
  uuid: v4()
1715
1712
  });
1713
+ setImage('heic');
1716
1714
  }).catch(() => {
1717
1715
  change({
1718
1716
  file: file[ix],
@@ -1761,18 +1759,21 @@ const File = /*#__PURE__*/React.forwardRef(({
1761
1759
  if (file[0].size <= maxSize * Math.pow(2, 20)) {
1762
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'))) {
1763
1761
  setError('');
1764
- change(file);
1765
- setSingleFile(file);
1766
1762
  if (file[0].type === 'application/pdf') {
1767
1763
  setImage('pdf');
1764
+ change(file[0]);
1765
+ setSingleFile(file[0]);
1768
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')) {
1769
1767
  handleCheckHeicFormat(file[0]).then(() => {
1770
1768
  setImage('heic');
1769
+ change(file[0]);
1770
+ setSingleFile(file[0]);
1771
1771
  }).catch(() => {
1772
1772
  setImage(null);
1773
1773
  setError(formatError ?? configStyles.FILE.error.format);
1774
1774
  });
1775
1775
  } else {
1776
+ change(file[0]);
1776
1777
  setImage(URL.createObjectURL(file[0]));
1777
1778
  }
1778
1779
  } else {
@@ -1828,7 +1829,7 @@ const File = /*#__PURE__*/React.forwardRef(({
1828
1829
  }));
1829
1830
  React.useEffect(() => {
1830
1831
  if (!multiple && defaultData) {
1831
- 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')) {
1832
1833
  alert('Please add type in defaultData prop');
1833
1834
  }
1834
1835
  if (!defaultData.url) {
@@ -2528,28 +2529,38 @@ const TH = ({
2528
2529
  }, item.type === 'show' ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : '')));
2529
2530
  };
2530
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
+
2531
2534
  const TD = ({
2532
2535
  row,
2533
2536
  item,
2534
2537
  index,
2535
2538
  rowItem,
2536
2539
  rowRadius,
2540
+ dragStart,
2541
+ handleMouseDown,
2537
2542
  hideBorder,
2538
2543
  innerIndex,
2539
2544
  tBodyColor,
2545
+ orderColor,
2540
2546
  borderRight,
2541
- borderRightColor,
2542
2547
  tBodyPadding,
2548
+ setIsDragging,
2549
+ orderFontSize,
2543
2550
  tBodyFontSize,
2544
2551
  openListColor,
2552
+ orderFontStyle,
2545
2553
  tBodyTextAlign,
2554
+ orderFontFamily,
2555
+ orderFontWeight,
2546
2556
  tBodyFontFamily,
2547
2557
  tBodyFontWeight,
2548
2558
  handleCheckDots,
2549
2559
  openListFontSize,
2560
+ borderRightColor,
2550
2561
  openListFontStyle,
2551
- openListFontWeight,
2552
2562
  handleCheckedBody,
2563
+ openListFontWeight,
2553
2564
  openListFontFamily,
2554
2565
  tableColumnMinWidth,
2555
2566
  tableColumnMaxWidth,
@@ -2677,7 +2688,26 @@ const TD = ({
2677
2688
  },
2678
2689
  onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
2679
2690
  className: styles$9['td-span']
2680
- }, 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, {
2681
2711
  data: item,
2682
2712
  index: index,
2683
2713
  innerIndex: innerIndex,
@@ -2890,20 +2920,34 @@ const Table = ({
2890
2920
  tBodyFontWeight,
2891
2921
  tBodyFontFamily,
2892
2922
  tBodyRowMarginTop,
2923
+ orderColor,
2924
+ orderFontSize,
2925
+ orderFontStyle,
2926
+ orderFontFamily,
2927
+ orderFontWeight,
2893
2928
  className,
2894
2929
  openListColor,
2895
2930
  openListFontSize,
2896
2931
  openListFontStyle,
2897
2932
  openListFontWeight,
2898
2933
  openListFontFamily,
2899
- hideBorder
2934
+ hideBorder,
2935
+ draggable,
2936
+ showOrder,
2937
+ draggableColor,
2938
+ getDraggableData
2900
2939
  }) => {
2940
+ const headerRef = React.useRef(null);
2941
+ const draggedRowIndex = React.useRef(null);
2901
2942
  const [body, setBody] = React.useState([]);
2902
2943
  const [header, setHeader] = React.useState([]);
2903
2944
  const [disableArr, setDisableArr] = React.useState([]);
2904
2945
  const [classProps, setClassProps] = React.useState({});
2946
+ const [checkDrag, setCheckDrag] = React.useState(false);
2905
2947
  const [checkedArray, setCheckedArray] = React.useState([]);
2906
2948
  const [configStyles, setConfigStyles] = React.useState({});
2949
+ React.useState(false);
2950
+ const [draggingIndex, setDraggingIndex] = React.useState(null);
2907
2951
  const handleCheckIfArrow = (bodyData, data) => {
2908
2952
  let removeItemIndex;
2909
2953
  let headerWithoutArrow = [];
@@ -3310,66 +3354,172 @@ const Table = ({
3310
3354
  });
3311
3355
  setBody(() => checkBodyMore);
3312
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
+ };
3313
3376
  React.useEffect(() => {
3314
- let checkedItems = [];
3315
- const disabledArray = [];
3316
- const checkBodyForChackedItems = dataBody.slice().map(item => Object.values(item));
3317
- if (arrowShow) {
3318
- const arrowColumnCount = handleSetInsertIndex(checkBodyForChackedItems[0], arrowColumn);
3319
- const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
3320
- const insert = checkForInsertArrow.map((item, index) => {
3321
- item.map((innerItem, innerIndex) => {
3322
- if (hasOwnerProperty(innerItem, 'checkBox')) {
3323
- if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3324
- if (innerItem.checkBox.disabled === true) {
3325
- if (!disabledArray[innerIndex]) {
3326
- disabledArray[innerIndex] = {
3327
- rowIndex: index,
3328
- columnIndex: innerIndex
3329
- };
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
+ }
3330
3413
  }
3331
3414
  }
3332
3415
  }
3333
- }
3416
+ });
3417
+ return item;
3334
3418
  });
3335
- return item;
3336
- });
3337
- checkedItems = handleSetCheckboxArray(insert);
3338
- setBody(() => insert);
3339
- } else {
3340
- const insert = checkBodyForChackedItems.map((item, index) => {
3341
- item.map((innerItem, innerIndex) => {
3342
- if (hasOwnerProperty(innerItem, 'checkBox')) {
3343
- if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3344
- if (innerItem.checkBox.disabled === true) {
3345
- if (!disabledArray[innerIndex]) {
3346
- disabledArray[innerIndex] = {
3347
- rowIndex: index,
3348
- columnIndex: innerIndex
3349
- };
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
+ }
3350
3452
  }
3351
3453
  }
3352
3454
  }
3353
- }
3455
+ });
3456
+ return item;
3354
3457
  });
3355
- return item;
3356
- });
3357
- checkedItems = handleSetCheckboxArray(insert);
3358
- 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);
3359
3484
  }
3360
- setDisableArr(disabledArray);
3361
- setCheckedArray(() => checkedItems);
3362
- }, [dataBody, arrowColumn, arrowShow]);
3485
+ }, [dataBody, arrowColumn, arrowShow, draggable]);
3363
3486
  React.useEffect(() => {
3364
- if (arrowShow) {
3365
- const header = dataHeader.slice();
3366
- const arrowColumnCount = handleSetInsertIndex(header, arrowColumn);
3367
- const checkForInsertArrow = handleTransformDataForInsertArrow(header, arrowColumnCount, 'header');
3368
- setHeader(() => checkForInsertArrow);
3369
- } else {
3370
- 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);
3371
3521
  }
3372
- }, [dataHeader, arrowColumn, arrowShow, disableArr]);
3522
+ }, [dataHeader, arrowColumn, arrowShow, disableArr, draggable]);
3373
3523
  React.useEffect(() => {
3374
3524
  className && setClassProps(() => classnames__default["default"](className ?? configStyles.TABLE.className));
3375
3525
  }, [className]);
@@ -3393,7 +3543,9 @@ const Table = ({
3393
3543
  },
3394
3544
  onClick: handleTableClick,
3395
3545
  className: classProps
3396
- }, 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", {
3397
3549
  style: {
3398
3550
  color: tHeadColor ?? configStyles.TABLE.head.color,
3399
3551
  backgroundColor: tHeadBackgroundColor ?? configStyles.TABLE.head.colors.background,
@@ -3424,6 +3576,9 @@ const Table = ({
3424
3576
  }
3425
3577
  }, body.map((item, index) => {
3426
3578
  return /*#__PURE__*/React__default["default"].createElement("tr", {
3579
+ onDragStart: () => handleDragStart(index),
3580
+ onDragOver: e => e.preventDefault(),
3581
+ onDrop: () => handleDrop(index),
3427
3582
  key: `${item}_${index}`,
3428
3583
  style: {
3429
3584
  backgroundColor: tableRowBGColor ?? configStyles.TABLE.body.row.colors.background,
@@ -3438,6 +3593,7 @@ const Table = ({
3438
3593
  hideBorder: hideBorder,
3439
3594
  innerIndex: innerIndex,
3440
3595
  row: Object.values(item),
3596
+ dragStart: handleDragStart,
3441
3597
  id: item.id ? item.id : '',
3442
3598
  handleCheckDots: handleCheckDots,
3443
3599
  key: `${innerItem}_${index}_${innerIndex}`,
@@ -3452,6 +3608,11 @@ const Table = ({
3452
3608
  handleBodyActionClick: handleBodyActionClick,
3453
3609
  handleMoreOptionsClick: handleMoreOptionsClick,
3454
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,
3455
3616
  tBodyColor: tBodyColor ?? configStyles.TABLE.body.color,
3456
3617
  rowItem: tableRowItem ?? configStyles.TABLE.body.row.isItem,
3457
3618
  rowRadius: tableRowRadius ?? configStyles.TABLE.body.row.radius,
@@ -4182,6 +4343,7 @@ const NumberInput = ({
4182
4343
  inpStyles,
4183
4344
  minNumSize,
4184
4345
  maxNumSize,
4346
+ insideError,
4185
4347
  inputChange,
4186
4348
  inpAttributes,
4187
4349
  setInnerErrorMessage
@@ -4198,13 +4360,21 @@ const NumberInput = ({
4198
4360
  if (currentValue === '') {
4199
4361
  setInnerErrorMessage(() => '');
4200
4362
  } else {
4363
+ insideError && insideError();
4201
4364
  setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${Number.MIN_SAFE_INTEGER} - ${Number.MAX_SAFE_INTEGER} թվերի միջակայքում`);
4202
4365
  }
4203
4366
  } else if (innerMinNumSize && currentValue < innerMinNumSize || maxNumSize && currentValue > maxNumSize) {
4204
4367
  if (currentValue === '') {
4205
4368
  setInnerErrorMessage(() => '');
4206
4369
  } else {
4207
- setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${innerMinNumSize} - ${maxNumSize} թվերի միջակայքում`);
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
+ }
4208
4378
  }
4209
4379
  } else if (currentValue >= Number.MIN_SAFE_INTEGER || currentValue <= Number.MAX_SAFE_INTEGER || innerMinNumSize && currentValue >= innerMinNumSize || maxNumSize && currentValue <= maxNumSize) {
4210
4380
  inputChange(currentValue);
@@ -4330,6 +4500,7 @@ const Input = ({
4330
4500
  telBorderRightWidth,
4331
4501
  telBorderRightStyle,
4332
4502
  telBorderRightColor,
4503
+ fireInputInsideError,
4333
4504
  backgroundDisableColor,
4334
4505
  telBorderRightColorHover,
4335
4506
  type = 'text'
@@ -4471,6 +4642,7 @@ const Input = ({
4471
4642
  inputChange: change,
4472
4643
  inpStyles: inpStyles,
4473
4644
  inpAttributes: inpAttributes,
4645
+ insideError: fireInputInsideError,
4474
4646
  minNumSize: minNumSize ? minNumSize : '',
4475
4647
  maxNumSize: maxNumSize ? maxNumSize : '',
4476
4648
  setInnerErrorMessage: setInnerErrorMessage,
@@ -4582,6 +4754,7 @@ Input.propTypes = {
4582
4754
  labelMarginBottom: PropTypes__default["default"].string,
4583
4755
  regexpErrorMessage: PropTypes__default["default"].string,
4584
4756
  regexp: PropTypes__default["default"].instanceOf(RegExp),
4757
+ fireInputInsideError: PropTypes__default["default"].func,
4585
4758
  telBorderRightWidth: PropTypes__default["default"].string,
4586
4759
  telBorderRightStyle: PropTypes__default["default"].string,
4587
4760
  telBorderRightColor: PropTypes__default["default"].string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
package/tui.config.js CHANGED
@@ -767,7 +767,12 @@ export default {
767
767
  openList: {
768
768
  color: '#A3A5A9',
769
769
  font: {...fontObject}
770
- }
770
+ },
771
+
772
+ order: {
773
+ color: '#000',
774
+ font: {...fontObject}
775
+ }
771
776
  },
772
777
  // default properties for <Pagination /> component
773
778
  PAGINATION: {