@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.js CHANGED
@@ -552,6 +552,7 @@ var packageResult = {
552
552
  ...fontObject
553
553
  },
554
554
  label: {
555
+ dots: false,
555
556
  color: presetColors.dark,
556
557
  display: 'block',
557
558
  lineHeight: '22px',
@@ -1173,6 +1174,18 @@ var packageResult = {
1173
1174
  font: {
1174
1175
  ...fontObject
1175
1176
  }
1177
+ },
1178
+ order: {
1179
+ color: '#000',
1180
+ font: {
1181
+ ...fontObject
1182
+ }
1183
+ },
1184
+ draggable: {
1185
+ boxShadow: '1px 1px 9px black',
1186
+ color: {
1187
+ background: 'white'
1188
+ }
1176
1189
  }
1177
1190
  },
1178
1191
  // default properties for <Pagination /> component
@@ -1496,22 +1509,6 @@ const SvgDeleteComponent = ({
1496
1509
  fill: fillColor ? fillColor : '#E00'
1497
1510
  }));
1498
1511
 
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
1512
  // eslint-disable-next-line react/display-name
1516
1513
  const File = /*#__PURE__*/React.forwardRef(({
1517
1514
  or,
@@ -1618,13 +1615,19 @@ const File = /*#__PURE__*/React.forwardRef(({
1618
1615
  const [singleFile, setSingleFile] = React.useState(null);
1619
1616
  const [configStyles, setConfigStyles] = React.useState({});
1620
1617
  const [choosenFileCount, setChoosenFileCount] = React.useState(0);
1621
- const [image, setImage] = React.useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
1618
+ 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
1619
  const handleCheckHeicFormat = async file => {
1623
1620
  const buffer = await file.arrayBuffer();
1624
- const fileTypeParser = new FileTypeParser();
1625
- const hasISOBaseMediaFile = fileTypeParser.hasISOBaseMediaFile(buffer);
1626
- if (hasISOBaseMediaFile) {
1627
- return Promise.resolve();
1621
+ const dataView = new DataView(buffer);
1622
+ if (dataView.byteLength < 12) return false;
1623
+ for (let i = 0; i < dataView.byteLength - 8; i++) {
1624
+ if (dataView.getUint8(i) === 0x66 && dataView.getUint8(i + 1) === 0x74 && dataView.getUint8(i + 2) === 0x79 && dataView.getUint8(i + 3) === 0x70) {
1625
+ const majorBrand = String.fromCharCode(dataView.getUint8(i + 4), dataView.getUint8(i + 5), dataView.getUint8(i + 6), dataView.getUint8(i + 7));
1626
+ const heicIdentifiers = ['heic', 'heix', 'mif1', 'msf1', 'hevc'];
1627
+ if (heicIdentifiers.includes(majorBrand)) {
1628
+ return Promise.resolve();
1629
+ }
1630
+ }
1628
1631
  }
1629
1632
  return Promise.reject();
1630
1633
  };
@@ -1666,6 +1669,7 @@ const File = /*#__PURE__*/React.forwardRef(({
1666
1669
  file: file[ix],
1667
1670
  uuid: v4()
1668
1671
  });
1672
+ setImage('heic');
1669
1673
  }).catch(() => {
1670
1674
  change({
1671
1675
  file: file[ix],
@@ -1713,6 +1717,7 @@ const File = /*#__PURE__*/React.forwardRef(({
1713
1717
  file: file[ix],
1714
1718
  uuid: v4()
1715
1719
  });
1720
+ setImage('heic');
1716
1721
  }).catch(() => {
1717
1722
  change({
1718
1723
  file: file[ix],
@@ -1761,18 +1766,21 @@ const File = /*#__PURE__*/React.forwardRef(({
1761
1766
  if (file[0].size <= maxSize * Math.pow(2, 20)) {
1762
1767
  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
1768
  setError('');
1764
- change(file);
1765
- setSingleFile(file);
1766
1769
  if (file[0].type === 'application/pdf') {
1767
1770
  setImage('pdf');
1771
+ change(file);
1772
+ setSingleFile(file);
1768
1773
  } 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
1774
  handleCheckHeicFormat(file[0]).then(() => {
1770
1775
  setImage('heic');
1776
+ change(file);
1777
+ setSingleFile(file);
1771
1778
  }).catch(() => {
1772
1779
  setImage(null);
1773
1780
  setError(formatError ?? configStyles.FILE.error.format);
1774
1781
  });
1775
1782
  } else {
1783
+ change(file);
1776
1784
  setImage(URL.createObjectURL(file[0]));
1777
1785
  }
1778
1786
  } else {
@@ -1828,7 +1836,7 @@ const File = /*#__PURE__*/React.forwardRef(({
1828
1836
  }));
1829
1837
  React.useEffect(() => {
1830
1838
  if (!multiple && defaultData) {
1831
- if (!defaultData.type) {
1839
+ if (!defaultData.type && !defaultData.url.startsWith('data:image/heif') && !defaultData.url.startsWith('data:image/heic') && !defaultData.url.startsWith('data:application/octet-stream')) {
1832
1840
  alert('Please add type in defaultData prop');
1833
1841
  }
1834
1842
  if (!defaultData.url) {
@@ -2381,7 +2389,7 @@ const handleUtilsCheckTypeTel = (val, prevVal) => {
2381
2389
  }
2382
2390
  return val;
2383
2391
  };
2384
- const handleUtilsCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumSize, withoutDot, innerMinNumSize) => {
2392
+ const handleUtilsCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumSize, withoutDot, innerMinNumSize, numberMaxLength) => {
2385
2393
  if (maxLength && maxLength > 0) {
2386
2394
  if (val.length > maxLength) {
2387
2395
  val = val.substr(0, maxLength);
@@ -2391,6 +2399,9 @@ const handleUtilsCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumS
2391
2399
  if (val.length > 16 && !val.includes('.')) {
2392
2400
  val = val.substr(0, 16);
2393
2401
  }
2402
+ if (numberMaxLength && numberMaxLength > 0 && !val.includes('.')) {
2403
+ val = val.substr(0, numberMaxLength);
2404
+ }
2394
2405
  const floatNumParts = typeof val === 'string' ? val.split(/\.|\․|\.|\,/) : val;
2395
2406
  const int = floatNumParts[0];
2396
2407
  const float = floatNumParts[1];
@@ -2528,28 +2539,38 @@ const TH = ({
2528
2539
  }, item.type === 'show' ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : '')));
2529
2540
  };
2530
2541
 
2542
+ 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";
2543
+
2531
2544
  const TD = ({
2532
2545
  row,
2533
2546
  item,
2534
2547
  index,
2535
2548
  rowItem,
2549
+ dragged,
2550
+ dragEnd,
2536
2551
  rowRadius,
2552
+ dragStart,
2537
2553
  hideBorder,
2538
2554
  innerIndex,
2539
2555
  tBodyColor,
2556
+ orderColor,
2540
2557
  borderRight,
2541
- borderRightColor,
2542
2558
  tBodyPadding,
2559
+ orderFontSize,
2543
2560
  tBodyFontSize,
2544
2561
  openListColor,
2562
+ orderFontStyle,
2545
2563
  tBodyTextAlign,
2564
+ orderFontFamily,
2565
+ orderFontWeight,
2546
2566
  tBodyFontFamily,
2547
2567
  tBodyFontWeight,
2548
2568
  handleCheckDots,
2549
2569
  openListFontSize,
2570
+ borderRightColor,
2550
2571
  openListFontStyle,
2551
- openListFontWeight,
2552
2572
  handleCheckedBody,
2573
+ openListFontWeight,
2553
2574
  openListFontFamily,
2554
2575
  tableColumnMinWidth,
2555
2576
  tableColumnMaxWidth,
@@ -2677,7 +2698,28 @@ const TD = ({
2677
2698
  },
2678
2699
  onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
2679
2700
  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, {
2701
+ }, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, 'draggableIcon') && /*#__PURE__*/React__default["default"].createElement("div", {
2702
+ draggable: true,
2703
+ style: {
2704
+ width: '24px',
2705
+ height: '24px',
2706
+ cursor: 'grab'
2707
+ },
2708
+ onDrag: dragged,
2709
+ onDragEnd: dragEnd,
2710
+ onDragStart: e => dragStart(e, index, row)
2711
+ }, /*#__PURE__*/React__default["default"].createElement("img", {
2712
+ src: img$1,
2713
+ alt: "drag"
2714
+ })), hasOwnerProperty(item, 'draggable') && /*#__PURE__*/React__default["default"].createElement("p", {
2715
+ style: {
2716
+ color: orderColor,
2717
+ fontSize: orderFontSize,
2718
+ fontStyle: orderFontStyle,
2719
+ fontFamily: orderFontFamily,
2720
+ fontWeight: orderFontWeight
2721
+ }
2722
+ }, item.order), hasOwnerProperty(item, 'checkBox') && /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
2681
2723
  data: item,
2682
2724
  index: index,
2683
2725
  innerIndex: innerIndex,
@@ -2890,20 +2932,41 @@ const Table = ({
2890
2932
  tBodyFontWeight,
2891
2933
  tBodyFontFamily,
2892
2934
  tBodyRowMarginTop,
2935
+ orderColor,
2936
+ orderFontSize,
2937
+ orderFontStyle,
2938
+ orderFontFamily,
2939
+ orderFontWeight,
2893
2940
  className,
2894
2941
  openListColor,
2895
2942
  openListFontSize,
2896
2943
  openListFontStyle,
2897
2944
  openListFontWeight,
2898
2945
  openListFontFamily,
2899
- hideBorder
2946
+ hideBorder,
2947
+ draggable,
2948
+ showOrder,
2949
+ draggableColor,
2950
+ getDraggableData,
2951
+ draggableItemBoxShadow,
2952
+ draggableItemBackgroundColor
2900
2953
  }) => {
2954
+ const itemRefs = React.useRef({});
2955
+ const headerRef = React.useRef(null);
2956
+ const draggedRowIndex = React.useRef(null);
2901
2957
  const [body, setBody] = React.useState([]);
2902
2958
  const [header, setHeader] = React.useState([]);
2903
2959
  const [disableArr, setDisableArr] = React.useState([]);
2904
2960
  const [classProps, setClassProps] = React.useState({});
2961
+ const [checkDrag, setCheckDrag] = React.useState(false);
2905
2962
  const [checkedArray, setCheckedArray] = React.useState([]);
2906
2963
  const [configStyles, setConfigStyles] = React.useState({});
2964
+ const [dragging, setDragging] = React.useState(false);
2965
+ const [draggedItem, setDraggedItem] = React.useState(null);
2966
+ const [position, setPosition] = React.useState({
2967
+ x: 0,
2968
+ y: 0
2969
+ });
2907
2970
  const handleCheckIfArrow = (bodyData, data) => {
2908
2971
  let removeItemIndex;
2909
2972
  let headerWithoutArrow = [];
@@ -3040,6 +3103,7 @@ const Table = ({
3040
3103
  }
3041
3104
  };
3042
3105
  const handleCheckedHeader = (data, e) => {
3106
+ console.log('ok - - - - - - - ');
3043
3107
  e.stopPropagation();
3044
3108
  let removeItemIndex;
3045
3109
  let checkableItemBool;
@@ -3310,66 +3374,192 @@ const Table = ({
3310
3374
  });
3311
3375
  setBody(() => checkBodyMore);
3312
3376
  };
3377
+ const handleDragStart = (e, index, row) => {
3378
+ setDragging(true);
3379
+ setDraggedItem(row);
3380
+ draggedRowIndex.current = index;
3381
+ e.dataTransfer.setDragImage(new Image(), 0, 0);
3382
+ };
3383
+ const handleDrag = e => {
3384
+ setPosition({
3385
+ x: e.clientX,
3386
+ y: e.clientY
3387
+ });
3388
+ };
3389
+ const handleDrop = (e, index) => {
3390
+ let correctData = [];
3391
+ const newRows = body;
3392
+ const [draggedRow] = newRows.splice(draggedRowIndex.current, 1);
3393
+ newRows.splice(index, 0, draggedRow);
3394
+ newRows.map(item => {
3395
+ correctData.push([...item]);
3396
+ });
3397
+ setBody(correctData);
3398
+ getDraggableData && getDraggableData(correctData);
3399
+ setCheckDrag(prev => !prev);
3400
+ draggedRowIndex.current = null;
3401
+ correctData = null;
3402
+ setDraggedItem(null);
3403
+ setDragging(false);
3404
+ e.dataTransfer.setDragImage(new Image(), 0, 0);
3405
+ };
3406
+ const handleDragEnd = e => {
3407
+ setDraggedItem(null);
3408
+ setDragging(false);
3409
+ e.dataTransfer.setDragImage(new Image(), 0, 0);
3410
+ };
3411
+ const setRef = (index, element) => {
3412
+ if (element) {
3413
+ itemRefs.current[index] = element;
3414
+ }
3415
+ };
3313
3416
  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
- };
3417
+ const draggableArray = body && body.length && body.map((item, index) => {
3418
+ if (showOrder) {
3419
+ Object.values(item).map((innerItem, innerIndex) => {
3420
+ if (innerIndex === 1) {
3421
+ innerItem.content = index + 1, innerItem.draggable = true;
3422
+ }
3423
+ return innerItem;
3424
+ });
3425
+ }
3426
+ return item;
3427
+ });
3428
+ getDraggableData && getDraggableData(draggableArray);
3429
+ setBody(() => draggableArray);
3430
+ }, [checkDrag]);
3431
+ React.useEffect(() => {
3432
+ const isEqual = JSON.stringify(body) === JSON.stringify(dataBody);
3433
+ if (!isEqual) {
3434
+ let insert = [];
3435
+ let newArray = [];
3436
+ let checkedItems = [];
3437
+ const disabledArray = [];
3438
+ const checkBodyForChackedItems = dataBody.slice().map(item => Object.values(item));
3439
+ if (arrowShow) {
3440
+ const arrowColumnCount = handleSetInsertIndex(checkBodyForChackedItems[0], arrowColumn);
3441
+ const checkForInsertArrow = handleTransformDataForInsertArrow(checkBodyForChackedItems, arrowColumnCount, 'body');
3442
+ insert = checkForInsertArrow.map((item, index) => {
3443
+ item.map((innerItem, innerIndex) => {
3444
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
3445
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3446
+ if (innerItem.checkBox.disabled === true) {
3447
+ if (!disabledArray[innerIndex]) {
3448
+ disabledArray[innerIndex] = {
3449
+ rowIndex: index,
3450
+ columnIndex: innerIndex
3451
+ };
3452
+ }
3330
3453
  }
3331
3454
  }
3332
3455
  }
3333
- }
3456
+ });
3457
+ return item;
3334
3458
  });
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
- };
3459
+ checkedItems = handleSetCheckboxArray(insert);
3460
+ if (draggable) {
3461
+ newArray = insert && insert.length && insert.map((item, index) => {
3462
+ item.map(innerItem => {
3463
+ if (hasOwnerProperty(innerItem, 'colorStatus')) {
3464
+ innerItem.colorStatus = null;
3465
+ }
3466
+ });
3467
+ if (showOrder) {
3468
+ item.unshift({
3469
+ content: index + 1,
3470
+ draggable: true
3471
+ });
3472
+ }
3473
+ item.unshift({
3474
+ draggableIcon: '',
3475
+ colorStatus: draggableColor
3476
+ });
3477
+ return item;
3478
+ });
3479
+ }
3480
+ } else {
3481
+ insert = checkBodyForChackedItems.map((item, index) => {
3482
+ item.map((innerItem, innerIndex) => {
3483
+ if (hasOwnerProperty(innerItem, 'checkBox')) {
3484
+ if (hasOwnerProperty(innerItem.checkBox, 'disabled')) {
3485
+ if (innerItem.checkBox.disabled === true) {
3486
+ if (!disabledArray[innerIndex]) {
3487
+ disabledArray[innerIndex] = {
3488
+ rowIndex: index,
3489
+ columnIndex: innerIndex
3490
+ };
3491
+ }
3350
3492
  }
3351
3493
  }
3352
3494
  }
3353
- }
3495
+ });
3496
+ return item;
3354
3497
  });
3355
- return item;
3356
- });
3357
- checkedItems = handleSetCheckboxArray(insert);
3358
- setBody(() => insert);
3498
+ checkedItems = handleSetCheckboxArray(insert);
3499
+ if (draggable) {
3500
+ newArray = insert && insert.length && insert.map((item, index) => {
3501
+ item.map(innerItem => {
3502
+ if (hasOwnerProperty(innerItem, 'colorStatus')) {
3503
+ innerItem.colorStatus = null;
3504
+ }
3505
+ });
3506
+ if (showOrder) {
3507
+ item.unshift({
3508
+ content: index + 1,
3509
+ draggable: true
3510
+ });
3511
+ }
3512
+ item.unshift({
3513
+ draggableIcon: '',
3514
+ colorStatus: draggableColor
3515
+ });
3516
+ return item;
3517
+ });
3518
+ }
3519
+ }
3520
+ getDraggableData && getDraggableData(newArray && newArray.length ? newArray : insert);
3521
+ setBody(() => newArray && newArray.length ? newArray : insert);
3522
+ setDisableArr(disabledArray);
3523
+ setCheckedArray(() => checkedItems);
3359
3524
  }
3360
- setDisableArr(disabledArray);
3361
- setCheckedArray(() => checkedItems);
3362
- }, [dataBody, arrowColumn, arrowShow]);
3525
+ }, [dataBody, arrowColumn, arrowShow, draggable]);
3363
3526
  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);
3527
+ const isEqual = JSON.stringify(header) === JSON.stringify(dataHeader);
3528
+ if (!isEqual) {
3529
+ let insert = [];
3530
+ let newArray = [];
3531
+ if (arrowShow) {
3532
+ const header = dataHeader.slice();
3533
+ const arrowColumnCount = handleSetInsertIndex(header, arrowColumn);
3534
+ const checkForInsertArrow = handleTransformDataForInsertArrow(header, arrowColumnCount, 'header');
3535
+ insert = checkForInsertArrow;
3536
+ if (draggable) {
3537
+ newArray = insert;
3538
+ newArray && newArray.length && newArray.unshift({
3539
+ content: ''
3540
+ });
3541
+ if (showOrder) {
3542
+ newArray.unshift({
3543
+ content: ''
3544
+ });
3545
+ }
3546
+ }
3547
+ } else {
3548
+ if (draggable) {
3549
+ newArray = dataHeader;
3550
+ newArray && newArray.length && newArray.unshift({
3551
+ content: ''
3552
+ });
3553
+ if (showOrder) {
3554
+ newArray.unshift({
3555
+ content: ''
3556
+ });
3557
+ }
3558
+ }
3559
+ }
3560
+ setHeader(() => newArray && newArray.length ? newArray : insert);
3371
3561
  }
3372
- }, [dataHeader, arrowColumn, arrowShow, disableArr]);
3562
+ }, [dataHeader, arrowColumn, arrowShow, disableArr, draggable]);
3373
3563
  React.useEffect(() => {
3374
3564
  className && setClassProps(() => classnames__default["default"](className ?? configStyles.TABLE.className));
3375
3565
  }, [className]);
@@ -3393,7 +3583,9 @@ const Table = ({
3393
3583
  },
3394
3584
  onClick: handleTableClick,
3395
3585
  className: classProps
3396
- }, header && header.length > 0 && /*#__PURE__*/React__default["default"].createElement("thead", null, /*#__PURE__*/React__default["default"].createElement("tr", {
3586
+ }, header && header.length > 0 && /*#__PURE__*/React__default["default"].createElement("thead", {
3587
+ ref: headerRef
3588
+ }, /*#__PURE__*/React__default["default"].createElement("tr", {
3397
3589
  style: {
3398
3590
  color: tHeadColor ?? configStyles.TABLE.head.color,
3399
3591
  backgroundColor: tHeadBackgroundColor ?? configStyles.TABLE.head.colors.background,
@@ -3424,20 +3616,26 @@ const Table = ({
3424
3616
  }
3425
3617
  }, body.map((item, index) => {
3426
3618
  return /*#__PURE__*/React__default["default"].createElement("tr", {
3619
+ onDragOver: e => e.preventDefault(),
3620
+ onDrop: e => handleDrop(e, index),
3427
3621
  key: `${item}_${index}`,
3428
3622
  style: {
3429
3623
  backgroundColor: tableRowBGColor ?? configStyles.TABLE.body.row.colors.background,
3430
3624
  borderBottom: index === body.length - 1 ? 'none' : tBodyRowBorder ? tBodyRowBorder : configStyles.TABLE.body.row.border,
3431
3625
  borderColor: hideBorder ? 'transparent' : configStyles.TABLE.body.row.borderColor,
3432
3626
  boxShadow: (tableRowItem ? tableRowItem : configStyles.TABLE.body.row.asItem) ? tableRowBoxShadow ? tableRowBoxShadow : configStyles.TABLE.body.row.box.shadow : 'none'
3433
- }
3627
+ },
3628
+ ref: el => setRef(index, el)
3434
3629
  }, Object.values(item).map((innerItem, innerIndex) => {
3435
3630
  return /*#__PURE__*/React__default["default"].createElement(TD, {
3436
3631
  index: index,
3437
3632
  item: innerItem,
3633
+ dragged: handleDrag,
3438
3634
  hideBorder: hideBorder,
3439
3635
  innerIndex: innerIndex,
3636
+ dragEnd: handleDragEnd,
3440
3637
  row: Object.values(item),
3638
+ dragStart: handleDragStart,
3441
3639
  id: item.id ? item.id : '',
3442
3640
  handleCheckDots: handleCheckDots,
3443
3641
  key: `${innerItem}_${index}_${innerIndex}`,
@@ -3452,6 +3650,11 @@ const Table = ({
3452
3650
  handleBodyActionClick: handleBodyActionClick,
3453
3651
  handleMoreOptionsClick: handleMoreOptionsClick,
3454
3652
  handleContentListClick: handleContentListClick,
3653
+ orderColor: orderColor ?? configStyles.TABLE.order.color,
3654
+ orderFontSize: orderFontSize ?? configStyles.TABLE.order.font.size,
3655
+ orderFontStyle: orderFontStyle ?? configStyles.TABLE.order.font.style,
3656
+ orderFontFamily: orderFontFamily ?? configStyles.TABLE.order.font.family,
3657
+ orderFontWeight: orderFontWeight ?? configStyles.TABLE.order.font.weight,
3455
3658
  tBodyColor: tBodyColor ?? configStyles.TABLE.body.color,
3456
3659
  rowItem: tableRowItem ?? configStyles.TABLE.body.row.isItem,
3457
3660
  rowRadius: tableRowRadius ?? configStyles.TABLE.body.row.radius,
@@ -3466,6 +3669,52 @@ const Table = ({
3466
3669
  handleOpenCloseRowSingleArrow: handleOpenCloseRowSingleArrow
3467
3670
  });
3468
3671
  }));
3672
+ })), draggable && dragging && draggedItem && /*#__PURE__*/React__default["default"].createElement("div", {
3673
+ style: {
3674
+ position: 'fixed',
3675
+ top: `${position.y - 30}px`,
3676
+ left: `${position.x - 30}px`,
3677
+ borderSpacing: '0px',
3678
+ pointerEvents: 'none',
3679
+ height: 'fit-content',
3680
+ blockSize: 'fit-content',
3681
+ borderRadius: tableRowItem ? tableRowRadius ?? configStyles.TABLE.body.row.radius : '0px',
3682
+ boxShadow: draggableItemBoxShadow ?? configStyles.TABLE.draggable.boxShadow,
3683
+ backgroundColor: draggableItemBackgroundColor ?? configStyles.TABLE.draggable.color.background
3684
+ }
3685
+ }, draggedItem.map((innerItem, innerIndex) => {
3686
+ return /*#__PURE__*/React__default["default"].createElement(TD, {
3687
+ item: innerItem,
3688
+ dragged: handleDrag,
3689
+ hideBorder: hideBorder,
3690
+ innerIndex: innerIndex,
3691
+ row: Object.values(draggedItem),
3692
+ dragStart: handleDragStart,
3693
+ handleCheckDots: handleCheckDots,
3694
+ key: `${innerItem}__${innerIndex}`,
3695
+ openListColor: openListColor ?? configStyles.TABLE.openList.color,
3696
+ tableColumnMinWidth: tableColumnMinWidth ?? configStyles.TABLE.column.minWidth,
3697
+ tableColumnMaxWidth: tableColumnMaxWidth ?? configStyles.TABLE.column.maxWidth,
3698
+ openListFontSize: openListFontSize ?? configStyles.TABLE.openList.font.size,
3699
+ openListFontStyle: openListFontStyle ?? configStyles.TABLE.openList.font.style,
3700
+ openListFontWeight: openListFontWeight ?? configStyles.TABLE.openList.font.weight,
3701
+ openListFontFamily: openListFontFamily ?? configStyles.TABLE.openList.font.family,
3702
+ tBodyColor: tBodyColor ?? configStyles.TABLE.body.color,
3703
+ orderColor: orderColor ?? configStyles.TABLE.order.color,
3704
+ rowItem: tableRowItem ?? configStyles.TABLE.body.row.isItem,
3705
+ tBodyPadding: tBodyPadding ?? configStyles.TABLE.body.padding,
3706
+ tBodyTextAlign: tBodyTextAlign ?? configStyles.TABLE.textAlign,
3707
+ rowRadius: tableRowRadius ?? configStyles.TABLE.body.row.radius,
3708
+ tBodyFontSize: tBodyFontSize ?? configStyles.TABLE.body.font.size,
3709
+ orderFontSize: orderFontSize ?? configStyles.TABLE.order.font.size,
3710
+ orderFontStyle: orderFontStyle ?? configStyles.TABLE.order.font.style,
3711
+ tBodyFontFamily: tBodyFontFamily ?? configStyles.TABLE.body.font.family,
3712
+ tBodyFontWeight: tBodyFontWeight ?? configStyles.TABLE.body.font.weight,
3713
+ orderFontFamily: orderFontFamily ?? configStyles.TABLE.order.font.family,
3714
+ orderFontWeight: orderFontWeight ?? configStyles.TABLE.order.font.weight,
3715
+ borderRight: innerIndex === Object.values(draggedItem).length - 1 ? 'none' : configStyles.TABLE.body.row.border,
3716
+ borderRightColor: innerIndex === Object.values(draggedItem).length - 1 ? 'transparent' : configStyles.TABLE.body.row.borderColor
3717
+ });
3469
3718
  })));
3470
3719
  };
3471
3720
  Table.propTypes = {
@@ -4178,12 +4427,15 @@ const NumberInput = ({
4178
4427
  value,
4179
4428
  float,
4180
4429
  radius,
4430
+ withZero,
4181
4431
  disabled,
4182
4432
  inpStyles,
4183
4433
  minNumSize,
4184
4434
  maxNumSize,
4435
+ insideError,
4185
4436
  inputChange,
4186
4437
  inpAttributes,
4438
+ numberMaxLength,
4187
4439
  setInnerErrorMessage
4188
4440
  }) => {
4189
4441
  const [innerValue, setInnerValue] = React.useState('');
@@ -4191,20 +4443,28 @@ const NumberInput = ({
4191
4443
  const handleChange = event => {
4192
4444
  let prevValue = innerValue;
4193
4445
  let currentValue = event.target.value.replace(/\.|․|\.|,/g, '.');
4194
- currentValue = handleUtilsCheckTypeNumber(currentValue, prevValue, null, float, maxNumSize, dots);
4446
+ currentValue = handleUtilsCheckTypeNumber(currentValue, prevValue, null, float, maxNumSize, dots, innerMinNumSize, numberMaxLength);
4195
4447
  setInnerValue(() => currentValue);
4196
4448
  if (inputChange && currentValue !== prevValue) {
4197
4449
  if (currentValue < Number.MIN_SAFE_INTEGER || currentValue > Number.MAX_SAFE_INTEGER) {
4198
4450
  if (currentValue === '') {
4199
4451
  setInnerErrorMessage(() => '');
4200
4452
  } else {
4453
+ insideError && insideError();
4201
4454
  setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${Number.MIN_SAFE_INTEGER} - ${Number.MAX_SAFE_INTEGER} թվերի միջակայքում`);
4202
4455
  }
4203
4456
  } else if (innerMinNumSize && currentValue < innerMinNumSize || maxNumSize && currentValue > maxNumSize) {
4204
4457
  if (currentValue === '') {
4205
4458
  setInnerErrorMessage(() => '');
4206
4459
  } else {
4207
- setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${innerMinNumSize} - ${maxNumSize} թվերի միջակայքում`);
4460
+ insideError && insideError();
4461
+ if (innerMinNumSize && !maxNumSize) {
4462
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ոչ պակաս ${innerMinNumSize} - ից`);
4463
+ } else if (!innerMinNumSize && maxNumSize) {
4464
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ոչ մեծ ${maxNumSize} ֊ ից`);
4465
+ } else if (innerMinNumSize && maxNumSize) {
4466
+ setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${innerMinNumSize} - ${maxNumSize} թվերի միջակայքում`);
4467
+ }
4208
4468
  }
4209
4469
  } else if (currentValue >= Number.MIN_SAFE_INTEGER || currentValue <= Number.MAX_SAFE_INTEGER || innerMinNumSize && currentValue >= innerMinNumSize || maxNumSize && currentValue <= maxNumSize) {
4210
4470
  inputChange(currentValue);
@@ -4213,11 +4473,13 @@ const NumberInput = ({
4213
4473
  }
4214
4474
  };
4215
4475
  const handleBlur = () => {
4216
- const newVal = handleRemoveLeadingZeros(innerValue);
4217
- if (parseFloat(newVal) === 0) {
4218
- inputChange('');
4219
- } else {
4220
- inputChange(newVal);
4476
+ if (!withZero) {
4477
+ const newVal = handleRemoveLeadingZeros(innerValue);
4478
+ if (parseFloat(newVal) === 0) {
4479
+ inputChange('');
4480
+ } else {
4481
+ inputChange(newVal);
4482
+ }
4221
4483
  }
4222
4484
  };
4223
4485
  React.useEffect(() => {
@@ -4234,10 +4496,10 @@ const NumberInput = ({
4234
4496
  React.useEffect(() => {
4235
4497
  let newValue = '';
4236
4498
  if (value !== undefined && value !== null) {
4237
- newValue = handleUtilsCheckTypeNumber(value, newValue, null, float, maxNumSize, dots);
4499
+ newValue = handleUtilsCheckTypeNumber(value, newValue, null, float, maxNumSize, dots, innerMinNumSize, numberMaxLength);
4238
4500
  }
4239
4501
  setInnerValue(() => newValue);
4240
- }, [dots, value, float, maxNumSize, minNumSize]);
4502
+ }, [dots, value, float, maxNumSize, minNumSize, numberMaxLength]);
4241
4503
  return /*#__PURE__*/React__default["default"].createElement("input", {
4242
4504
  type: "text",
4243
4505
  value: innerValue,
@@ -4290,6 +4552,7 @@ const Input = ({
4290
4552
  leftIcon,
4291
4553
  required,
4292
4554
  disabled,
4555
+ labelDots,
4293
4556
  iconWidth,
4294
4557
  rightIcon,
4295
4558
  className,
@@ -4323,13 +4586,16 @@ const Input = ({
4323
4586
  phoneAlignItems,
4324
4587
  errorLineHeight,
4325
4588
  labelLineHeight,
4589
+ numberMaxLength,
4326
4590
  backgroundColor,
4591
+ withZero = false,
4327
4592
  labelMarginBottom,
4328
4593
  regexpErrorMessage,
4329
4594
  phoneJustifyContent,
4330
4595
  telBorderRightWidth,
4331
4596
  telBorderRightStyle,
4332
4597
  telBorderRightColor,
4598
+ fireInputInsideError,
4333
4599
  backgroundDisableColor,
4334
4600
  telBorderRightColorHover,
4335
4601
  type = 'text'
@@ -4414,6 +4680,7 @@ const Input = ({
4414
4680
  className: classProps
4415
4681
  }, label ? /*#__PURE__*/React__default["default"].createElement("label", {
4416
4682
  style: {
4683
+ maxWidth: '100%',
4417
4684
  color: labelColor ?? configStyles.INPUT.label.color,
4418
4685
  fontSize: labelSize ?? configStyles.INPUT.label.font.size,
4419
4686
  fontStyle: labelStyle ?? configStyles.INPUT.label.font.style,
@@ -4421,8 +4688,12 @@ const Input = ({
4421
4688
  fontWeight: labelWeight ?? configStyles.INPUT.label.font.weight,
4422
4689
  lineHeight: labelLineHeight ?? configStyles.INPUT.label.lineHeight,
4423
4690
  marginBottom: labelMarginBottom ?? configStyles.INPUT.label.marginBottom,
4424
- fontFamily: labelFontFamily ?? configStyles.INPUT.label.font.family
4425
- }
4691
+ fontFamily: labelFontFamily ?? configStyles.INPUT.label.font.family,
4692
+ whiteSpace: (labelDots ? labelDots : configStyles.INPUT.label.dots) ? 'nowrap' : 'normal',
4693
+ overflow: (labelDots ? labelDots : configStyles.INPUT.label.dots) ? 'hidden' : 'visible',
4694
+ textOverflow: (labelDots ? labelDots : configStyles.INPUT.label.dots) ? 'ellipsis' : ''
4695
+ },
4696
+ title: label
4426
4697
  }, label, required && /*#__PURE__*/React__default["default"].createElement("sup", null, /*#__PURE__*/React__default["default"].createElement(SvgRequired, null))) : '', /*#__PURE__*/React__default["default"].createElement("div", {
4427
4698
  className: `${styles$7['input-content']}`,
4428
4699
  style: {
@@ -4468,9 +4739,12 @@ const Input = ({
4468
4739
  value: innerValue,
4469
4740
  float: floatToFix,
4470
4741
  disabled: disabled,
4742
+ withZero: withZero,
4471
4743
  inputChange: change,
4472
4744
  inpStyles: inpStyles,
4473
4745
  inpAttributes: inpAttributes,
4746
+ numberMaxLength: numberMaxLength,
4747
+ insideError: fireInputInsideError,
4474
4748
  minNumSize: minNumSize ? minNumSize : '',
4475
4749
  maxNumSize: maxNumSize ? maxNumSize : '',
4476
4750
  setInnerErrorMessage: setInnerErrorMessage,
@@ -4531,18 +4805,20 @@ const Input = ({
4531
4805
  Input.propTypes = {
4532
4806
  size: PropTypes__default["default"].string,
4533
4807
  name: PropTypes__default["default"].string,
4534
- style: PropTypes__default["default"].string,
4535
- weight: PropTypes__default["default"].string,
4536
- family: PropTypes__default["default"].string,
4537
4808
  change: PropTypes__default["default"].func,
4809
+ style: PropTypes__default["default"].string,
4538
4810
  color: PropTypes__default["default"].string,
4539
4811
  width: PropTypes__default["default"].string,
4540
4812
  label: PropTypes__default["default"].string,
4813
+ withZero: PropTypes__default["default"].bool,
4814
+ weight: PropTypes__default["default"].string,
4815
+ family: PropTypes__default["default"].string,
4541
4816
  required: PropTypes__default["default"].bool,
4542
4817
  disabled: PropTypes__default["default"].bool,
4543
4818
  height: PropTypes__default["default"].string,
4544
4819
  radius: PropTypes__default["default"].string,
4545
4820
  padding: PropTypes__default["default"].string,
4821
+ labelDots: PropTypes__default["default"].bool,
4546
4822
  tooltip: PropTypes__default["default"].element,
4547
4823
  withoutDot: PropTypes__default["default"].bool,
4548
4824
  className: PropTypes__default["default"].string,
@@ -4579,9 +4855,11 @@ Input.propTypes = {
4579
4855
  phoneAlignItems: PropTypes__default["default"].string,
4580
4856
  errorLineHeight: PropTypes__default["default"].string,
4581
4857
  labelLineHeight: PropTypes__default["default"].string,
4858
+ numberMaxLength: PropTypes__default["default"].number,
4582
4859
  labelMarginBottom: PropTypes__default["default"].string,
4583
4860
  regexpErrorMessage: PropTypes__default["default"].string,
4584
4861
  regexp: PropTypes__default["default"].instanceOf(RegExp),
4862
+ fireInputInsideError: PropTypes__default["default"].func,
4585
4863
  telBorderRightWidth: PropTypes__default["default"].string,
4586
4864
  telBorderRightStyle: PropTypes__default["default"].string,
4587
4865
  telBorderRightColor: PropTypes__default["default"].string,