@xaypay/tui 0.2.12 → 0.2.14

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
@@ -521,6 +521,7 @@ var packageResult = {
521
521
  ...fontObject
522
522
  },
523
523
  label: {
524
+ dots: false,
524
525
  color: presetColors.dark,
525
526
  display: 'block',
526
527
  lineHeight: '22px',
@@ -1142,6 +1143,18 @@ var packageResult = {
1142
1143
  font: {
1143
1144
  ...fontObject
1144
1145
  }
1146
+ },
1147
+ order: {
1148
+ color: '#000',
1149
+ font: {
1150
+ ...fontObject
1151
+ }
1152
+ },
1153
+ draggable: {
1154
+ boxShadow: '1px 1px 9px black',
1155
+ color: {
1156
+ background: 'white'
1157
+ }
1145
1158
  }
1146
1159
  },
1147
1160
  // default properties for <Pagination /> component
@@ -1465,22 +1478,6 @@ const SvgDeleteComponent = ({
1465
1478
  fill: fillColor ? fillColor : '#E00'
1466
1479
  }));
1467
1480
 
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
1481
  // eslint-disable-next-line react/display-name
1485
1482
  const File = /*#__PURE__*/forwardRef(({
1486
1483
  or,
@@ -1587,13 +1584,19 @@ const File = /*#__PURE__*/forwardRef(({
1587
1584
  const [singleFile, setSingleFile] = useState(null);
1588
1585
  const [configStyles, setConfigStyles] = useState({});
1589
1586
  const [choosenFileCount, setChoosenFileCount] = useState(0);
1590
- const [image, setImage] = useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
1587
+ 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
1588
  const handleCheckHeicFormat = async file => {
1592
1589
  const buffer = await file.arrayBuffer();
1593
- const fileTypeParser = new FileTypeParser();
1594
- const hasISOBaseMediaFile = fileTypeParser.hasISOBaseMediaFile(buffer);
1595
- if (hasISOBaseMediaFile) {
1596
- return Promise.resolve();
1590
+ const dataView = new DataView(buffer);
1591
+ if (dataView.byteLength < 12) return false;
1592
+ for (let i = 0; i < dataView.byteLength - 8; i++) {
1593
+ if (dataView.getUint8(i) === 0x66 && dataView.getUint8(i + 1) === 0x74 && dataView.getUint8(i + 2) === 0x79 && dataView.getUint8(i + 3) === 0x70) {
1594
+ const majorBrand = String.fromCharCode(dataView.getUint8(i + 4), dataView.getUint8(i + 5), dataView.getUint8(i + 6), dataView.getUint8(i + 7));
1595
+ const heicIdentifiers = ['heic', 'heix', 'mif1', 'msf1', 'hevc'];
1596
+ if (heicIdentifiers.includes(majorBrand)) {
1597
+ return Promise.resolve();
1598
+ }
1599
+ }
1597
1600
  }
1598
1601
  return Promise.reject();
1599
1602
  };
@@ -1635,6 +1638,7 @@ const File = /*#__PURE__*/forwardRef(({
1635
1638
  file: file[ix],
1636
1639
  uuid: v4()
1637
1640
  });
1641
+ setImage('heic');
1638
1642
  }).catch(() => {
1639
1643
  change({
1640
1644
  file: file[ix],
@@ -1682,6 +1686,7 @@ const File = /*#__PURE__*/forwardRef(({
1682
1686
  file: file[ix],
1683
1687
  uuid: v4()
1684
1688
  });
1689
+ setImage('heic');
1685
1690
  }).catch(() => {
1686
1691
  change({
1687
1692
  file: file[ix],
@@ -1730,18 +1735,21 @@ const File = /*#__PURE__*/forwardRef(({
1730
1735
  if (file[0].size <= maxSize * Math.pow(2, 20)) {
1731
1736
  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
1737
  setError('');
1733
- change(file);
1734
- setSingleFile(file);
1735
1738
  if (file[0].type === 'application/pdf') {
1736
1739
  setImage('pdf');
1740
+ change(file);
1741
+ setSingleFile(file);
1737
1742
  } 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
1743
  handleCheckHeicFormat(file[0]).then(() => {
1739
1744
  setImage('heic');
1745
+ change(file);
1746
+ setSingleFile(file);
1740
1747
  }).catch(() => {
1741
1748
  setImage(null);
1742
1749
  setError(formatError ?? configStyles.FILE.error.format);
1743
1750
  });
1744
1751
  } else {
1752
+ change(file);
1745
1753
  setImage(URL.createObjectURL(file[0]));
1746
1754
  }
1747
1755
  } else {
@@ -1797,7 +1805,7 @@ const File = /*#__PURE__*/forwardRef(({
1797
1805
  }));
1798
1806
  useEffect(() => {
1799
1807
  if (!multiple && defaultData) {
1800
- if (!defaultData.type) {
1808
+ if (!defaultData.type && !defaultData.url.startsWith('data:image/heif') && !defaultData.url.startsWith('data:image/heic') && !defaultData.url.startsWith('data:application/octet-stream')) {
1801
1809
  alert('Please add type in defaultData prop');
1802
1810
  }
1803
1811
  if (!defaultData.url) {
@@ -2350,7 +2358,7 @@ const handleUtilsCheckTypeTel = (val, prevVal) => {
2350
2358
  }
2351
2359
  return val;
2352
2360
  };
2353
- const handleUtilsCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumSize, withoutDot, innerMinNumSize) => {
2361
+ const handleUtilsCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumSize, withoutDot, innerMinNumSize, numberMaxLength) => {
2354
2362
  if (maxLength && maxLength > 0) {
2355
2363
  if (val.length > maxLength) {
2356
2364
  val = val.substr(0, maxLength);
@@ -2360,6 +2368,9 @@ const handleUtilsCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumS
2360
2368
  if (val.length > 16 && !val.includes('.')) {
2361
2369
  val = val.substr(0, 16);
2362
2370
  }
2371
+ if (numberMaxLength && numberMaxLength > 0 && !val.includes('.')) {
2372
+ val = val.substr(0, numberMaxLength);
2373
+ }
2363
2374
  const floatNumParts = typeof val === 'string' ? val.split(/\.|\․|\.|\,/) : val;
2364
2375
  const int = floatNumParts[0];
2365
2376
  const float = floatNumParts[1];
@@ -2497,28 +2508,38 @@ const TH = ({
2497
2508
  }, item.type === 'show' ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : '')));
2498
2509
  };
2499
2510
 
2511
+ 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";
2512
+
2500
2513
  const TD = ({
2501
2514
  row,
2502
2515
  item,
2503
2516
  index,
2504
2517
  rowItem,
2518
+ dragged,
2519
+ dragEnd,
2505
2520
  rowRadius,
2521
+ dragStart,
2506
2522
  hideBorder,
2507
2523
  innerIndex,
2508
2524
  tBodyColor,
2525
+ orderColor,
2509
2526
  borderRight,
2510
- borderRightColor,
2511
2527
  tBodyPadding,
2528
+ orderFontSize,
2512
2529
  tBodyFontSize,
2513
2530
  openListColor,
2531
+ orderFontStyle,
2514
2532
  tBodyTextAlign,
2533
+ orderFontFamily,
2534
+ orderFontWeight,
2515
2535
  tBodyFontFamily,
2516
2536
  tBodyFontWeight,
2517
2537
  handleCheckDots,
2518
2538
  openListFontSize,
2539
+ borderRightColor,
2519
2540
  openListFontStyle,
2520
- openListFontWeight,
2521
2541
  handleCheckedBody,
2542
+ openListFontWeight,
2522
2543
  openListFontFamily,
2523
2544
  tableColumnMinWidth,
2524
2545
  tableColumnMaxWidth,
@@ -2646,7 +2667,28 @@ const TD = ({
2646
2667
  },
2647
2668
  onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
2648
2669
  className: styles$9['td-span']
2649
- }, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, 'checkBox') && /*#__PURE__*/React__default.createElement(SingleCheckbox, {
2670
+ }, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, 'draggableIcon') && /*#__PURE__*/React__default.createElement("div", {
2671
+ draggable: true,
2672
+ style: {
2673
+ width: '24px',
2674
+ height: '24px',
2675
+ cursor: 'grab'
2676
+ },
2677
+ onDrag: dragged,
2678
+ onDragEnd: dragEnd,
2679
+ onDragStart: e => dragStart(e, index, row)
2680
+ }, /*#__PURE__*/React__default.createElement("img", {
2681
+ src: img$1,
2682
+ alt: "drag"
2683
+ })), hasOwnerProperty(item, 'draggable') && /*#__PURE__*/React__default.createElement("p", {
2684
+ style: {
2685
+ color: orderColor,
2686
+ fontSize: orderFontSize,
2687
+ fontStyle: orderFontStyle,
2688
+ fontFamily: orderFontFamily,
2689
+ fontWeight: orderFontWeight
2690
+ }
2691
+ }, item.order), hasOwnerProperty(item, 'checkBox') && /*#__PURE__*/React__default.createElement(SingleCheckbox, {
2650
2692
  data: item,
2651
2693
  index: index,
2652
2694
  innerIndex: innerIndex,
@@ -2859,20 +2901,41 @@ const Table = ({
2859
2901
  tBodyFontWeight,
2860
2902
  tBodyFontFamily,
2861
2903
  tBodyRowMarginTop,
2904
+ orderColor,
2905
+ orderFontSize,
2906
+ orderFontStyle,
2907
+ orderFontFamily,
2908
+ orderFontWeight,
2862
2909
  className,
2863
2910
  openListColor,
2864
2911
  openListFontSize,
2865
2912
  openListFontStyle,
2866
2913
  openListFontWeight,
2867
2914
  openListFontFamily,
2868
- hideBorder
2915
+ hideBorder,
2916
+ draggable,
2917
+ showOrder,
2918
+ draggableColor,
2919
+ getDraggableData,
2920
+ draggableItemBoxShadow,
2921
+ draggableItemBackgroundColor
2869
2922
  }) => {
2923
+ const itemRefs = useRef({});
2924
+ const headerRef = useRef(null);
2925
+ const draggedRowIndex = useRef(null);
2870
2926
  const [body, setBody] = useState([]);
2871
2927
  const [header, setHeader] = useState([]);
2872
2928
  const [disableArr, setDisableArr] = useState([]);
2873
2929
  const [classProps, setClassProps] = useState({});
2930
+ const [checkDrag, setCheckDrag] = useState(false);
2874
2931
  const [checkedArray, setCheckedArray] = useState([]);
2875
2932
  const [configStyles, setConfigStyles] = useState({});
2933
+ const [dragging, setDragging] = useState(false);
2934
+ const [draggedItem, setDraggedItem] = useState(null);
2935
+ const [position, setPosition] = useState({
2936
+ x: 0,
2937
+ y: 0
2938
+ });
2876
2939
  const handleCheckIfArrow = (bodyData, data) => {
2877
2940
  let removeItemIndex;
2878
2941
  let headerWithoutArrow = [];
@@ -3009,6 +3072,7 @@ const Table = ({
3009
3072
  }
3010
3073
  };
3011
3074
  const handleCheckedHeader = (data, e) => {
3075
+ console.log('ok - - - - - - - ');
3012
3076
  e.stopPropagation();
3013
3077
  let removeItemIndex;
3014
3078
  let checkableItemBool;
@@ -3279,66 +3343,192 @@ const Table = ({
3279
3343
  });
3280
3344
  setBody(() => checkBodyMore);
3281
3345
  };
3346
+ const handleDragStart = (e, index, row) => {
3347
+ setDragging(true);
3348
+ setDraggedItem(row);
3349
+ draggedRowIndex.current = index;
3350
+ e.dataTransfer.setDragImage(new Image(), 0, 0);
3351
+ };
3352
+ const handleDrag = e => {
3353
+ setPosition({
3354
+ x: e.clientX,
3355
+ y: e.clientY
3356
+ });
3357
+ };
3358
+ const handleDrop = (e, index) => {
3359
+ let correctData = [];
3360
+ const newRows = body;
3361
+ const [draggedRow] = newRows.splice(draggedRowIndex.current, 1);
3362
+ newRows.splice(index, 0, draggedRow);
3363
+ newRows.map(item => {
3364
+ correctData.push([...item]);
3365
+ });
3366
+ setBody(correctData);
3367
+ getDraggableData && getDraggableData(correctData);
3368
+ setCheckDrag(prev => !prev);
3369
+ draggedRowIndex.current = null;
3370
+ correctData = null;
3371
+ setDraggedItem(null);
3372
+ setDragging(false);
3373
+ e.dataTransfer.setDragImage(new Image(), 0, 0);
3374
+ };
3375
+ const handleDragEnd = e => {
3376
+ setDraggedItem(null);
3377
+ setDragging(false);
3378
+ e.dataTransfer.setDragImage(new Image(), 0, 0);
3379
+ };
3380
+ const setRef = (index, element) => {
3381
+ if (element) {
3382
+ itemRefs.current[index] = element;
3383
+ }
3384
+ };
3282
3385
  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
- };
3386
+ const draggableArray = body && body.length && body.map((item, index) => {
3387
+ if (showOrder) {
3388
+ Object.values(item).map((innerItem, innerIndex) => {
3389
+ if (innerIndex === 1) {
3390
+ innerItem.content = index + 1, innerItem.draggable = true;
3391
+ }
3392
+ return innerItem;
3393
+ });
3394
+ }
3395
+ return item;
3396
+ });
3397
+ getDraggableData && getDraggableData(draggableArray);
3398
+ setBody(() => draggableArray);
3399
+ }, [checkDrag]);
3400
+ useEffect(() => {
3401
+ const isEqual = JSON.stringify(body) === JSON.stringify(dataBody);
3402
+ if (!isEqual) {
3403
+ let insert = [];
3404
+ let newArray = [];
3405
+ let checkedItems = [];
3406
+ const disabledArray = [];
3407
+ const checkBodyForChackedItems = dataBody.slice().map(item => Object.values(item));
3408
+ if (arrowShow) {
3409
+ const arrowColumnCount = handleSetInsertIndex(checkBodyForChackedItems[0], arrowColumn);
3410
+ const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
3411
+ insert = checkForInsertArrow.map((item, index) => {
3412
+ item.map((innerItem, innerIndex) => {
3413
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
3414
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3415
+ if (innerItem.checkBox.disabled === true) {
3416
+ if (!disabledArray[innerIndex]) {
3417
+ disabledArray[innerIndex] = {
3418
+ rowIndex: index,
3419
+ columnIndex: innerIndex
3420
+ };
3421
+ }
3299
3422
  }
3300
3423
  }
3301
3424
  }
3302
- }
3425
+ });
3426
+ return item;
3303
3427
  });
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
- };
3428
+ checkedItems = handleSetCheckboxArray(insert);
3429
+ if (draggable) {
3430
+ newArray = insert && insert.length && insert.map((item, index) => {
3431
+ item.map(innerItem => {
3432
+ if (hasOwnerProperty(innerItem, 'colorStatus')) {
3433
+ innerItem.colorStatus = null;
3434
+ }
3435
+ });
3436
+ if (showOrder) {
3437
+ item.unshift({
3438
+ content: index + 1,
3439
+ draggable: true
3440
+ });
3441
+ }
3442
+ item.unshift({
3443
+ draggableIcon: '',
3444
+ colorStatus: draggableColor
3445
+ });
3446
+ return item;
3447
+ });
3448
+ }
3449
+ } else {
3450
+ insert = checkBodyForChackedItems.map((item, index) => {
3451
+ item.map((innerItem, innerIndex) => {
3452
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
3453
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3454
+ if (innerItem.checkBox.disabled === true) {
3455
+ if (!disabledArray[innerIndex]) {
3456
+ disabledArray[innerIndex] = {
3457
+ rowIndex: index,
3458
+ columnIndex: innerIndex
3459
+ };
3460
+ }
3319
3461
  }
3320
3462
  }
3321
3463
  }
3322
- }
3464
+ });
3465
+ return item;
3323
3466
  });
3324
- return item;
3325
- });
3326
- checkedItems = handleSetCheckboxArray(insert);
3327
- setBody(() => insert);
3467
+ checkedItems = handleSetCheckboxArray(insert);
3468
+ if (draggable) {
3469
+ newArray = insert && insert.length && insert.map((item, index) => {
3470
+ item.map(innerItem => {
3471
+ if (hasOwnerProperty(innerItem, 'colorStatus')) {
3472
+ innerItem.colorStatus = null;
3473
+ }
3474
+ });
3475
+ if (showOrder) {
3476
+ item.unshift({
3477
+ content: index + 1,
3478
+ draggable: true
3479
+ });
3480
+ }
3481
+ item.unshift({
3482
+ draggableIcon: '',
3483
+ colorStatus: draggableColor
3484
+ });
3485
+ return item;
3486
+ });
3487
+ }
3488
+ }
3489
+ getDraggableData && getDraggableData(newArray && newArray.length ? newArray : insert);
3490
+ setBody(() => newArray && newArray.length ? newArray : insert);
3491
+ setDisableArr(disabledArray);
3492
+ setCheckedArray(() => checkedItems);
3328
3493
  }
3329
- setDisableArr(disabledArray);
3330
- setCheckedArray(() => checkedItems);
3331
- }, [dataBody, arrowColumn, arrowShow]);
3494
+ }, [dataBody, arrowColumn, arrowShow, draggable]);
3332
3495
  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);
3496
+ const isEqual = JSON.stringify(header) === JSON.stringify(dataHeader);
3497
+ if (!isEqual) {
3498
+ let insert = [];
3499
+ let newArray = [];
3500
+ if (arrowShow) {
3501
+ const header = dataHeader.slice();
3502
+ const arrowColumnCount = handleSetInsertIndex(header, arrowColumn);
3503
+ const checkForInsertArrow = handleTransformDataForInsertArrow(header, arrowColumnCount, 'header');
3504
+ insert = checkForInsertArrow;
3505
+ if (draggable) {
3506
+ newArray = insert;
3507
+ newArray && newArray.length && newArray.unshift({
3508
+ content: ''
3509
+ });
3510
+ if (showOrder) {
3511
+ newArray.unshift({
3512
+ content: ''
3513
+ });
3514
+ }
3515
+ }
3516
+ } else {
3517
+ if (draggable) {
3518
+ newArray = dataHeader;
3519
+ newArray && newArray.length && newArray.unshift({
3520
+ content: ''
3521
+ });
3522
+ if (showOrder) {
3523
+ newArray.unshift({
3524
+ content: ''
3525
+ });
3526
+ }
3527
+ }
3528
+ }
3529
+ setHeader(() => newArray && newArray.length ? newArray : insert);
3340
3530
  }
3341
- }, [dataHeader, arrowColumn, arrowShow, disableArr]);
3531
+ }, [dataHeader, arrowColumn, arrowShow, disableArr, draggable]);
3342
3532
  useEffect(() => {
3343
3533
  className && setClassProps(() => classnames(className ?? configStyles.TABLE.className));
3344
3534
  }, [className]);
@@ -3362,7 +3552,9 @@ const Table = ({
3362
3552
  },
3363
3553
  onClick: handleTableClick,
3364
3554
  className: classProps
3365
- }, header && header.length > 0 && /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", {
3555
+ }, header && header.length > 0 && /*#__PURE__*/React__default.createElement("thead", {
3556
+ ref: headerRef
3557
+ }, /*#__PURE__*/React__default.createElement("tr", {
3366
3558
  style: {
3367
3559
  color: tHeadColor ?? configStyles.TABLE.head.color,
3368
3560
  backgroundColor: tHeadBackgroundColor ?? configStyles.TABLE.head.colors.background,
@@ -3393,20 +3585,26 @@ const Table = ({
3393
3585
  }
3394
3586
  }, body.map((item, index) => {
3395
3587
  return /*#__PURE__*/React__default.createElement("tr", {
3588
+ onDragOver: e => e.preventDefault(),
3589
+ onDrop: e => handleDrop(e, index),
3396
3590
  key: `${item}_${index}`,
3397
3591
  style: {
3398
3592
  backgroundColor: tableRowBGColor ?? configStyles.TABLE.body.row.colors.background,
3399
3593
  borderBottom: index === body.length - 1 ? 'none' : tBodyRowBorder ? tBodyRowBorder : configStyles.TABLE.body.row.border,
3400
3594
  borderColor: hideBorder ? 'transparent' : configStyles.TABLE.body.row.borderColor,
3401
3595
  boxShadow: (tableRowItem ? tableRowItem : configStyles.TABLE.body.row.asItem) ? tableRowBoxShadow ? tableRowBoxShadow : configStyles.TABLE.body.row.box.shadow : 'none'
3402
- }
3596
+ },
3597
+ ref: el => setRef(index, el)
3403
3598
  }, Object.values(item).map((innerItem, innerIndex) => {
3404
3599
  return /*#__PURE__*/React__default.createElement(TD, {
3405
3600
  index: index,
3406
3601
  item: innerItem,
3602
+ dragged: handleDrag,
3407
3603
  hideBorder: hideBorder,
3408
3604
  innerIndex: innerIndex,
3605
+ dragEnd: handleDragEnd,
3409
3606
  row: Object.values(item),
3607
+ dragStart: handleDragStart,
3410
3608
  id: item.id ? item.id : '',
3411
3609
  handleCheckDots: handleCheckDots,
3412
3610
  key: `${innerItem}_${index}_${innerIndex}`,
@@ -3421,6 +3619,11 @@ const Table = ({
3421
3619
  handleBodyActionClick: handleBodyActionClick,
3422
3620
  handleMoreOptionsClick: handleMoreOptionsClick,
3423
3621
  handleContentListClick: handleContentListClick,
3622
+ orderColor: orderColor ?? configStyles.TABLE.order.color,
3623
+ orderFontSize: orderFontSize ?? configStyles.TABLE.order.font.size,
3624
+ orderFontStyle: orderFontStyle ?? configStyles.TABLE.order.font.style,
3625
+ orderFontFamily: orderFontFamily ?? configStyles.TABLE.order.font.family,
3626
+ orderFontWeight: orderFontWeight ?? configStyles.TABLE.order.font.weight,
3424
3627
  tBodyColor: tBodyColor ?? configStyles.TABLE.body.color,
3425
3628
  rowItem: tableRowItem ?? configStyles.TABLE.body.row.isItem,
3426
3629
  rowRadius: tableRowRadius ?? configStyles.TABLE.body.row.radius,
@@ -3435,6 +3638,52 @@ const Table = ({
3435
3638
  handleOpenCloseRowSingleArrow: handleOpenCloseRowSingleArrow
3436
3639
  });
3437
3640
  }));
3641
+ })), draggable && dragging && draggedItem && /*#__PURE__*/React__default.createElement("div", {
3642
+ style: {
3643
+ position: 'fixed',
3644
+ top: `${position.y - 30}px`,
3645
+ left: `${position.x - 30}px`,
3646
+ borderSpacing: '0px',
3647
+ pointerEvents: 'none',
3648
+ height: 'fit-content',
3649
+ blockSize: 'fit-content',
3650
+ borderRadius: tableRowItem ? tableRowRadius ?? configStyles.TABLE.body.row.radius : '0px',
3651
+ boxShadow: draggableItemBoxShadow ?? configStyles.TABLE.draggable.boxShadow,
3652
+ backgroundColor: draggableItemBackgroundColor ?? configStyles.TABLE.draggable.color.background
3653
+ }
3654
+ }, draggedItem.map((innerItem, innerIndex) => {
3655
+ return /*#__PURE__*/React__default.createElement(TD, {
3656
+ item: innerItem,
3657
+ dragged: handleDrag,
3658
+ hideBorder: hideBorder,
3659
+ innerIndex: innerIndex,
3660
+ row: Object.values(draggedItem),
3661
+ dragStart: handleDragStart,
3662
+ handleCheckDots: handleCheckDots,
3663
+ key: `${innerItem}__${innerIndex}`,
3664
+ openListColor: openListColor ?? configStyles.TABLE.openList.color,
3665
+ tableColumnMinWidth: tableColumnMinWidth ?? configStyles.TABLE.column.minWidth,
3666
+ tableColumnMaxWidth: tableColumnMaxWidth ?? configStyles.TABLE.column.maxWidth,
3667
+ openListFontSize: openListFontSize ?? configStyles.TABLE.openList.font.size,
3668
+ openListFontStyle: openListFontStyle ?? configStyles.TABLE.openList.font.style,
3669
+ openListFontWeight: openListFontWeight ?? configStyles.TABLE.openList.font.weight,
3670
+ openListFontFamily: openListFontFamily ?? configStyles.TABLE.openList.font.family,
3671
+ tBodyColor: tBodyColor ?? configStyles.TABLE.body.color,
3672
+ orderColor: orderColor ?? configStyles.TABLE.order.color,
3673
+ rowItem: tableRowItem ?? configStyles.TABLE.body.row.isItem,
3674
+ tBodyPadding: tBodyPadding ?? configStyles.TABLE.body.padding,
3675
+ tBodyTextAlign: tBodyTextAlign ?? configStyles.TABLE.textAlign,
3676
+ rowRadius: tableRowRadius ?? configStyles.TABLE.body.row.radius,
3677
+ tBodyFontSize: tBodyFontSize ?? configStyles.TABLE.body.font.size,
3678
+ orderFontSize: orderFontSize ?? configStyles.TABLE.order.font.size,
3679
+ orderFontStyle: orderFontStyle ?? configStyles.TABLE.order.font.style,
3680
+ tBodyFontFamily: tBodyFontFamily ?? configStyles.TABLE.body.font.family,
3681
+ tBodyFontWeight: tBodyFontWeight ?? configStyles.TABLE.body.font.weight,
3682
+ orderFontFamily: orderFontFamily ?? configStyles.TABLE.order.font.family,
3683
+ orderFontWeight: orderFontWeight ?? configStyles.TABLE.order.font.weight,
3684
+ borderRight: innerIndex === Object.values(draggedItem).length - 1 ? 'none' : configStyles.TABLE.body.row.border,
3685
+ borderRightColor: innerIndex === Object.values(draggedItem).length - 1 ? 'transparent' : configStyles.TABLE.body.row.borderColor
3686
+ });
3438
3687
  })));
3439
3688
  };
3440
3689
  Table.propTypes = {
@@ -4147,12 +4396,15 @@ const NumberInput = ({
4147
4396
  value,
4148
4397
  float,
4149
4398
  radius,
4399
+ withZero,
4150
4400
  disabled,
4151
4401
  inpStyles,
4152
4402
  minNumSize,
4153
4403
  maxNumSize,
4404
+ insideError,
4154
4405
  inputChange,
4155
4406
  inpAttributes,
4407
+ numberMaxLength,
4156
4408
  setInnerErrorMessage
4157
4409
  }) => {
4158
4410
  const [innerValue, setInnerValue] = useState('');
@@ -4160,20 +4412,28 @@ const NumberInput = ({
4160
4412
  const handleChange = event => {
4161
4413
  let prevValue = innerValue;
4162
4414
  let currentValue = event.target.value.replace(/\.|․|\.|,/g, '.');
4163
- currentValue = handleUtilsCheckTypeNumber(currentValue, prevValue, null, float, maxNumSize, dots);
4415
+ currentValue = handleUtilsCheckTypeNumber(currentValue, prevValue, null, float, maxNumSize, dots, innerMinNumSize, numberMaxLength);
4164
4416
  setInnerValue(() => currentValue);
4165
4417
  if (inputChange && currentValue !== prevValue) {
4166
4418
  if (currentValue < Number.MIN_SAFE_INTEGER || currentValue > Number.MAX_SAFE_INTEGER) {
4167
4419
  if (currentValue === '') {
4168
4420
  setInnerErrorMessage(() => '');
4169
4421
  } else {
4422
+ insideError && insideError();
4170
4423
  setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${Number.MIN_SAFE_INTEGER} - ${Number.MAX_SAFE_INTEGER} թվերի միջակայքում`);
4171
4424
  }
4172
4425
  } else if (innerMinNumSize && currentValue < innerMinNumSize || maxNumSize && currentValue > maxNumSize) {
4173
4426
  if (currentValue === '') {
4174
4427
  setInnerErrorMessage(() => '');
4175
4428
  } else {
4176
- setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${innerMinNumSize} - ${maxNumSize} թվերի միջակայքում`);
4429
+ insideError && insideError();
4430
+ if (innerMinNumSize && !maxNumSize) {
4431
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ոչ պակաս ${innerMinNumSize} - ից`);
4432
+ } else if (!innerMinNumSize && maxNumSize) {
4433
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ոչ մեծ ${maxNumSize} ֊ ից`);
4434
+ } else if (innerMinNumSize && maxNumSize) {
4435
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${innerMinNumSize} - ${maxNumSize} թվերի միջակայքում`);
4436
+ }
4177
4437
  }
4178
4438
  } else if (currentValue >= Number.MIN_SAFE_INTEGER || currentValue <= Number.MAX_SAFE_INTEGER || innerMinNumSize && currentValue >= innerMinNumSize || maxNumSize && currentValue <= maxNumSize) {
4179
4439
  inputChange(currentValue);
@@ -4182,11 +4442,13 @@ const NumberInput = ({
4182
4442
  }
4183
4443
  };
4184
4444
  const handleBlur = () => {
4185
- const newVal = handleRemoveLeadingZeros(innerValue);
4186
- if (parseFloat(newVal) === 0) {
4187
- inputChange('');
4188
- } else {
4189
- inputChange(newVal);
4445
+ if (!withZero) {
4446
+ const newVal = handleRemoveLeadingZeros(innerValue);
4447
+ if (parseFloat(newVal) === 0) {
4448
+ inputChange('');
4449
+ } else {
4450
+ inputChange(newVal);
4451
+ }
4190
4452
  }
4191
4453
  };
4192
4454
  useEffect(() => {
@@ -4203,10 +4465,10 @@ const NumberInput = ({
4203
4465
  useEffect(() => {
4204
4466
  let newValue = '';
4205
4467
  if (value !== undefined && value !== null) {
4206
- newValue = handleUtilsCheckTypeNumber(value, newValue, null, float, maxNumSize, dots);
4468
+ newValue = handleUtilsCheckTypeNumber(value, newValue, null, float, maxNumSize, dots, innerMinNumSize, numberMaxLength);
4207
4469
  }
4208
4470
  setInnerValue(() => newValue);
4209
- }, [dots, value, float, maxNumSize, minNumSize]);
4471
+ }, [dots, value, float, maxNumSize, minNumSize, numberMaxLength]);
4210
4472
  return /*#__PURE__*/React__default.createElement("input", {
4211
4473
  type: "text",
4212
4474
  value: innerValue,
@@ -4259,6 +4521,7 @@ const Input = ({
4259
4521
  leftIcon,
4260
4522
  required,
4261
4523
  disabled,
4524
+ labelDots,
4262
4525
  iconWidth,
4263
4526
  rightIcon,
4264
4527
  className,
@@ -4292,13 +4555,16 @@ const Input = ({
4292
4555
  phoneAlignItems,
4293
4556
  errorLineHeight,
4294
4557
  labelLineHeight,
4558
+ numberMaxLength,
4295
4559
  backgroundColor,
4560
+ withZero = false,
4296
4561
  labelMarginBottom,
4297
4562
  regexpErrorMessage,
4298
4563
  phoneJustifyContent,
4299
4564
  telBorderRightWidth,
4300
4565
  telBorderRightStyle,
4301
4566
  telBorderRightColor,
4567
+ fireInputInsideError,
4302
4568
  backgroundDisableColor,
4303
4569
  telBorderRightColorHover,
4304
4570
  type = 'text'
@@ -4383,6 +4649,7 @@ const Input = ({
4383
4649
  className: classProps
4384
4650
  }, label ? /*#__PURE__*/React__default.createElement("label", {
4385
4651
  style: {
4652
+ maxWidth: '100%',
4386
4653
  color: labelColor ?? configStyles.INPUT.label.color,
4387
4654
  fontSize: labelSize ?? configStyles.INPUT.label.font.size,
4388
4655
  fontStyle: labelStyle ?? configStyles.INPUT.label.font.style,
@@ -4390,8 +4657,12 @@ const Input = ({
4390
4657
  fontWeight: labelWeight ?? configStyles.INPUT.label.font.weight,
4391
4658
  lineHeight: labelLineHeight ?? configStyles.INPUT.label.lineHeight,
4392
4659
  marginBottom: labelMarginBottom ?? configStyles.INPUT.label.marginBottom,
4393
- fontFamily: labelFontFamily ?? configStyles.INPUT.label.font.family
4394
- }
4660
+ fontFamily: labelFontFamily ?? configStyles.INPUT.label.font.family,
4661
+ whiteSpace: (labelDots ? labelDots : configStyles.INPUT.label.dots) ? 'nowrap' : 'normal',
4662
+ overflow: (labelDots ? labelDots : configStyles.INPUT.label.dots) ? 'hidden' : 'visible',
4663
+ textOverflow: (labelDots ? labelDots : configStyles.INPUT.label.dots) ? 'ellipsis' : ''
4664
+ },
4665
+ title: label
4395
4666
  }, label, required && /*#__PURE__*/React__default.createElement("sup", null, /*#__PURE__*/React__default.createElement(SvgRequired, null))) : '', /*#__PURE__*/React__default.createElement("div", {
4396
4667
  className: `${styles$7['input-content']}`,
4397
4668
  style: {
@@ -4437,9 +4708,12 @@ const Input = ({
4437
4708
  value: innerValue,
4438
4709
  float: floatToFix,
4439
4710
  disabled: disabled,
4711
+ withZero: withZero,
4440
4712
  inputChange: change,
4441
4713
  inpStyles: inpStyles,
4442
4714
  inpAttributes: inpAttributes,
4715
+ numberMaxLength: numberMaxLength,
4716
+ insideError: fireInputInsideError,
4443
4717
  minNumSize: minNumSize ? minNumSize : '',
4444
4718
  maxNumSize: maxNumSize ? maxNumSize : '',
4445
4719
  setInnerErrorMessage: setInnerErrorMessage,
@@ -4500,18 +4774,20 @@ const Input = ({
4500
4774
  Input.propTypes = {
4501
4775
  size: PropTypes.string,
4502
4776
  name: PropTypes.string,
4503
- style: PropTypes.string,
4504
- weight: PropTypes.string,
4505
- family: PropTypes.string,
4506
4777
  change: PropTypes.func,
4778
+ style: PropTypes.string,
4507
4779
  color: PropTypes.string,
4508
4780
  width: PropTypes.string,
4509
4781
  label: PropTypes.string,
4782
+ withZero: PropTypes.bool,
4783
+ weight: PropTypes.string,
4784
+ family: PropTypes.string,
4510
4785
  required: PropTypes.bool,
4511
4786
  disabled: PropTypes.bool,
4512
4787
  height: PropTypes.string,
4513
4788
  radius: PropTypes.string,
4514
4789
  padding: PropTypes.string,
4790
+ labelDots: PropTypes.bool,
4515
4791
  tooltip: PropTypes.element,
4516
4792
  withoutDot: PropTypes.bool,
4517
4793
  className: PropTypes.string,
@@ -4548,9 +4824,11 @@ Input.propTypes = {
4548
4824
  phoneAlignItems: PropTypes.string,
4549
4825
  errorLineHeight: PropTypes.string,
4550
4826
  labelLineHeight: PropTypes.string,
4827
+ numberMaxLength: PropTypes.number,
4551
4828
  labelMarginBottom: PropTypes.string,
4552
4829
  regexpErrorMessage: PropTypes.string,
4553
4830
  regexp: PropTypes.instanceOf(RegExp),
4831
+ fireInputInsideError: PropTypes.func,
4554
4832
  telBorderRightWidth: PropTypes.string,
4555
4833
  telBorderRightStyle: PropTypes.string,
4556
4834
  telBorderRightColor: PropTypes.string,