@xaypay/tui 0.2.11 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +369 -86
- package/dist/index.js +369 -86
- package/package.json +1 -1
- package/tui.config.js +6 -1
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
|
|
@@ -1571,7 +1577,22 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
1571
1577
|
const [singleFile, setSingleFile] = useState(null);
|
|
1572
1578
|
const [configStyles, setConfigStyles] = useState({});
|
|
1573
1579
|
const [choosenFileCount, setChoosenFileCount] = useState(0);
|
|
1574
|
-
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);
|
|
1581
|
+
const handleCheckHeicFormat = async file => {
|
|
1582
|
+
const buffer = await file.arrayBuffer();
|
|
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
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
return Promise.reject();
|
|
1595
|
+
};
|
|
1575
1596
|
const handleRemoveComponent = () => {
|
|
1576
1597
|
if (!multiple) {
|
|
1577
1598
|
removeFile && removeFile(singleFile);
|
|
@@ -1600,14 +1621,33 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
1600
1621
|
for (let ix = 0; ix < file.length; ix++) {
|
|
1601
1622
|
if (file[ix]) {
|
|
1602
1623
|
if (file[ix].size <= maxSize * Math.pow(2, 20)) {
|
|
1603
|
-
if (fileExtensions.includes(file[ix].type.split('/')[1]) ||
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1624
|
+
if (fileExtensions.includes(file[ix].type.split('/')[1]) || file[ix].name.toLowerCase().endsWith('.heic') || file[ix].name.toLowerCase().endsWith('.heif')) {
|
|
1625
|
+
if ((fileExtensions.includes('heic') || fileExtensions.includes('heif')) && (file[ix].name.toLowerCase().endsWith('.heic') || file[ix].name.toLowerCase().endsWith('.heif'))) {
|
|
1626
|
+
handleCheckHeicFormat(file[ix]).then(() => {
|
|
1627
|
+
change({
|
|
1628
|
+
id: '',
|
|
1629
|
+
check: '',
|
|
1630
|
+
status: '',
|
|
1631
|
+
file: file[ix],
|
|
1632
|
+
uuid: v4()
|
|
1633
|
+
});
|
|
1634
|
+
setImage('heic');
|
|
1635
|
+
}).catch(() => {
|
|
1636
|
+
change({
|
|
1637
|
+
file: file[ix],
|
|
1638
|
+
uuid: v4(),
|
|
1639
|
+
check: formatError ?? configStyles.FILE.error.format
|
|
1640
|
+
});
|
|
1641
|
+
});
|
|
1642
|
+
} else {
|
|
1643
|
+
change({
|
|
1644
|
+
id: '',
|
|
1645
|
+
check: '',
|
|
1646
|
+
status: '',
|
|
1647
|
+
file: file[ix],
|
|
1648
|
+
uuid: v4()
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1611
1651
|
} else {
|
|
1612
1652
|
change({
|
|
1613
1653
|
file: file[ix],
|
|
@@ -1629,14 +1669,33 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
1629
1669
|
for (let ix = 0; ix < file.length; ix++) {
|
|
1630
1670
|
if (file[ix]) {
|
|
1631
1671
|
if (file[ix].size <= maxSize * Math.pow(2, 20)) {
|
|
1632
|
-
if (fileExtensions.includes(file[ix].type.split('/')[1]) ||
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1672
|
+
if (fileExtensions.includes(file[ix].type.split('/')[1]) || file[ix].name.toLowerCase().endsWith('.heic') || file[ix].name.toLowerCase().endsWith('.heif')) {
|
|
1673
|
+
if ((fileExtensions.includes('heic') || fileExtensions.includes('heif')) && (file[ix].name.toLowerCase().endsWith('.heic') || file[ix].name.toLowerCase().endsWith('.heif'))) {
|
|
1674
|
+
handleCheckHeicFormat(file[ix]).then(() => {
|
|
1675
|
+
change({
|
|
1676
|
+
id: '',
|
|
1677
|
+
check: '',
|
|
1678
|
+
status: '',
|
|
1679
|
+
file: file[ix],
|
|
1680
|
+
uuid: v4()
|
|
1681
|
+
});
|
|
1682
|
+
setImage('heic');
|
|
1683
|
+
}).catch(() => {
|
|
1684
|
+
change({
|
|
1685
|
+
file: file[ix],
|
|
1686
|
+
uuid: v4(),
|
|
1687
|
+
check: formatError ?? configStyles.FILE.error.format
|
|
1688
|
+
});
|
|
1689
|
+
});
|
|
1690
|
+
} else {
|
|
1691
|
+
change({
|
|
1692
|
+
id: '',
|
|
1693
|
+
check: '',
|
|
1694
|
+
status: '',
|
|
1695
|
+
file: file[ix],
|
|
1696
|
+
uuid: v4()
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1640
1699
|
} else {
|
|
1641
1700
|
change({
|
|
1642
1701
|
file: file[ix],
|
|
@@ -1667,15 +1726,23 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
1667
1726
|
} else {
|
|
1668
1727
|
if (file[0]) {
|
|
1669
1728
|
if (file[0].size <= maxSize * Math.pow(2, 20)) {
|
|
1670
|
-
if (fileExtensions.includes(file[0].type.split('/')[1]) || fileExtensions.includes('heic') && (file[0].type === 'image/heif' || file[0].type === 'image/heic')) {
|
|
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'))) {
|
|
1671
1730
|
setError('');
|
|
1672
|
-
change(file);
|
|
1673
|
-
setSingleFile(file);
|
|
1674
1731
|
if (file[0].type === 'application/pdf') {
|
|
1675
1732
|
setImage('pdf');
|
|
1676
|
-
|
|
1677
|
-
|
|
1733
|
+
change(file[0]);
|
|
1734
|
+
setSingleFile(file[0]);
|
|
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')) {
|
|
1736
|
+
handleCheckHeicFormat(file[0]).then(() => {
|
|
1737
|
+
setImage('heic');
|
|
1738
|
+
change(file[0]);
|
|
1739
|
+
setSingleFile(file[0]);
|
|
1740
|
+
}).catch(() => {
|
|
1741
|
+
setImage(null);
|
|
1742
|
+
setError(formatError ?? configStyles.FILE.error.format);
|
|
1743
|
+
});
|
|
1678
1744
|
} else {
|
|
1745
|
+
change(file[0]);
|
|
1679
1746
|
setImage(URL.createObjectURL(file[0]));
|
|
1680
1747
|
}
|
|
1681
1748
|
} else {
|
|
@@ -1731,7 +1798,7 @@ const File = /*#__PURE__*/forwardRef(({
|
|
|
1731
1798
|
}));
|
|
1732
1799
|
useEffect(() => {
|
|
1733
1800
|
if (!multiple && defaultData) {
|
|
1734
|
-
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')) {
|
|
1735
1802
|
alert('Please add type in defaultData prop');
|
|
1736
1803
|
}
|
|
1737
1804
|
if (!defaultData.url) {
|
|
@@ -2276,6 +2343,9 @@ const handleUtilsMouseEnterLeave = (e, behaviourStyle) => {
|
|
|
2276
2343
|
};
|
|
2277
2344
|
const handleUtilsCheckTypeTel = (val, prevVal) => {
|
|
2278
2345
|
const phoneNumberRegex = /^\d{0,8}$/;
|
|
2346
|
+
if (val.length > 7) {
|
|
2347
|
+
val = val.substr(0, 8);
|
|
2348
|
+
}
|
|
2279
2349
|
if (!phoneNumberRegex.test(val)) {
|
|
2280
2350
|
val = prevVal;
|
|
2281
2351
|
}
|
|
@@ -2310,14 +2380,16 @@ const handleUtilsCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumS
|
|
|
2310
2380
|
}
|
|
2311
2381
|
}
|
|
2312
2382
|
if (!regNum.test(val)) {
|
|
2313
|
-
|
|
2383
|
+
let newVal = typeof val === 'number' ? val.toString() : val;
|
|
2384
|
+
const newStr = newVal.replace(/[^0-9.]/g, '').replace(/^([^.]*\.|\․|\.|\,)(.*)$/, function (_, b, c) {
|
|
2314
2385
|
return b + c.replace(/\.|\․|\.|\,/g, '');
|
|
2315
2386
|
});
|
|
2316
2387
|
val = newStr;
|
|
2317
2388
|
}
|
|
2318
2389
|
}
|
|
2319
2390
|
if (withoutDot && !/^\d+$/.test(val)) {
|
|
2320
|
-
|
|
2391
|
+
let newVal = typeof val === 'number' ? val.toString() : val;
|
|
2392
|
+
const newStr = newVal.replace(/[^0-9]/g, '').replace(/^([^.]*\.|\․|\.|\,)(.*)$/, function (_, b, c) {
|
|
2321
2393
|
return b + c.replace(/\.|\․|\.|\,/g, '');
|
|
2322
2394
|
});
|
|
2323
2395
|
val = newStr;
|
|
@@ -2329,6 +2401,9 @@ const handleUtilsOpenInNewTab = url => {
|
|
|
2329
2401
|
imageLink.href = url, imageLink.target = '_blank';
|
|
2330
2402
|
imageLink.click();
|
|
2331
2403
|
};
|
|
2404
|
+
const handleRemoveLeadingZeros = str => {
|
|
2405
|
+
return str.replace(/^0+(\d)/, '$1');
|
|
2406
|
+
};
|
|
2332
2407
|
|
|
2333
2408
|
function styleInject(css, ref) {
|
|
2334
2409
|
if ( ref === void 0 ) ref = {};
|
|
@@ -2423,28 +2498,38 @@ const TH = ({
|
|
|
2423
2498
|
}, item.type === 'show' ? item.content : hasOwnerProperty(item, 'arrowComponent') ? item.status === 'close' ? item.closeArrow : item.openArrow : '')));
|
|
2424
2499
|
};
|
|
2425
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
|
+
|
|
2426
2503
|
const TD = ({
|
|
2427
2504
|
row,
|
|
2428
2505
|
item,
|
|
2429
2506
|
index,
|
|
2430
2507
|
rowItem,
|
|
2431
2508
|
rowRadius,
|
|
2509
|
+
dragStart,
|
|
2510
|
+
handleMouseDown,
|
|
2432
2511
|
hideBorder,
|
|
2433
2512
|
innerIndex,
|
|
2434
2513
|
tBodyColor,
|
|
2514
|
+
orderColor,
|
|
2435
2515
|
borderRight,
|
|
2436
|
-
borderRightColor,
|
|
2437
2516
|
tBodyPadding,
|
|
2517
|
+
setIsDragging,
|
|
2518
|
+
orderFontSize,
|
|
2438
2519
|
tBodyFontSize,
|
|
2439
2520
|
openListColor,
|
|
2521
|
+
orderFontStyle,
|
|
2440
2522
|
tBodyTextAlign,
|
|
2523
|
+
orderFontFamily,
|
|
2524
|
+
orderFontWeight,
|
|
2441
2525
|
tBodyFontFamily,
|
|
2442
2526
|
tBodyFontWeight,
|
|
2443
2527
|
handleCheckDots,
|
|
2444
2528
|
openListFontSize,
|
|
2529
|
+
borderRightColor,
|
|
2445
2530
|
openListFontStyle,
|
|
2446
|
-
openListFontWeight,
|
|
2447
2531
|
handleCheckedBody,
|
|
2532
|
+
openListFontWeight,
|
|
2448
2533
|
openListFontFamily,
|
|
2449
2534
|
tableColumnMinWidth,
|
|
2450
2535
|
tableColumnMaxWidth,
|
|
@@ -2572,7 +2657,26 @@ const TD = ({
|
|
|
2572
2657
|
},
|
|
2573
2658
|
onClick: () => handleOpenCloseRowSingleArrow(index, innerIndex, item),
|
|
2574
2659
|
className: styles$9['td-span']
|
|
2575
|
-
}, hasOwnerProperty(item, 'status') && item.status === 'close' ? item.closeArrow : item.openArrow) : '', hasOwnerProperty(item, '
|
|
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, {
|
|
2576
2680
|
data: item,
|
|
2577
2681
|
index: index,
|
|
2578
2682
|
innerIndex: innerIndex,
|
|
@@ -2785,20 +2889,34 @@ const Table = ({
|
|
|
2785
2889
|
tBodyFontWeight,
|
|
2786
2890
|
tBodyFontFamily,
|
|
2787
2891
|
tBodyRowMarginTop,
|
|
2892
|
+
orderColor,
|
|
2893
|
+
orderFontSize,
|
|
2894
|
+
orderFontStyle,
|
|
2895
|
+
orderFontFamily,
|
|
2896
|
+
orderFontWeight,
|
|
2788
2897
|
className,
|
|
2789
2898
|
openListColor,
|
|
2790
2899
|
openListFontSize,
|
|
2791
2900
|
openListFontStyle,
|
|
2792
2901
|
openListFontWeight,
|
|
2793
2902
|
openListFontFamily,
|
|
2794
|
-
hideBorder
|
|
2903
|
+
hideBorder,
|
|
2904
|
+
draggable,
|
|
2905
|
+
showOrder,
|
|
2906
|
+
draggableColor,
|
|
2907
|
+
getDraggableData
|
|
2795
2908
|
}) => {
|
|
2909
|
+
const headerRef = useRef(null);
|
|
2910
|
+
const draggedRowIndex = useRef(null);
|
|
2796
2911
|
const [body, setBody] = useState([]);
|
|
2797
2912
|
const [header, setHeader] = useState([]);
|
|
2798
2913
|
const [disableArr, setDisableArr] = useState([]);
|
|
2799
2914
|
const [classProps, setClassProps] = useState({});
|
|
2915
|
+
const [checkDrag, setCheckDrag] = useState(false);
|
|
2800
2916
|
const [checkedArray, setCheckedArray] = useState([]);
|
|
2801
2917
|
const [configStyles, setConfigStyles] = useState({});
|
|
2918
|
+
useState(false);
|
|
2919
|
+
const [draggingIndex, setDraggingIndex] = useState(null);
|
|
2802
2920
|
const handleCheckIfArrow = (bodyData, data) => {
|
|
2803
2921
|
let removeItemIndex;
|
|
2804
2922
|
let headerWithoutArrow = [];
|
|
@@ -3205,66 +3323,172 @@ const Table = ({
|
|
|
3205
3323
|
});
|
|
3206
3324
|
setBody(() => checkBodyMore);
|
|
3207
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
|
+
};
|
|
3208
3345
|
useEffect(() => {
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
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
|
+
}
|
|
3225
3382
|
}
|
|
3226
3383
|
}
|
|
3227
3384
|
}
|
|
3228
|
-
}
|
|
3385
|
+
});
|
|
3386
|
+
return item;
|
|
3229
3387
|
});
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
if (
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
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
|
+
}
|
|
3245
3421
|
}
|
|
3246
3422
|
}
|
|
3247
3423
|
}
|
|
3248
|
-
}
|
|
3424
|
+
});
|
|
3425
|
+
return item;
|
|
3249
3426
|
});
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
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);
|
|
3254
3453
|
}
|
|
3255
|
-
|
|
3256
|
-
setCheckedArray(() => checkedItems);
|
|
3257
|
-
}, [dataBody, arrowColumn, arrowShow]);
|
|
3454
|
+
}, [dataBody, arrowColumn, arrowShow, draggable]);
|
|
3258
3455
|
useEffect(() => {
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
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);
|
|
3266
3490
|
}
|
|
3267
|
-
}, [dataHeader, arrowColumn, arrowShow, disableArr]);
|
|
3491
|
+
}, [dataHeader, arrowColumn, arrowShow, disableArr, draggable]);
|
|
3268
3492
|
useEffect(() => {
|
|
3269
3493
|
className && setClassProps(() => classnames(className ?? configStyles.TABLE.className));
|
|
3270
3494
|
}, [className]);
|
|
@@ -3288,7 +3512,9 @@ const Table = ({
|
|
|
3288
3512
|
},
|
|
3289
3513
|
onClick: handleTableClick,
|
|
3290
3514
|
className: classProps
|
|
3291
|
-
}, header && header.length > 0 && /*#__PURE__*/React__default.createElement("thead",
|
|
3515
|
+
}, header && header.length > 0 && /*#__PURE__*/React__default.createElement("thead", {
|
|
3516
|
+
ref: headerRef
|
|
3517
|
+
}, /*#__PURE__*/React__default.createElement("tr", {
|
|
3292
3518
|
style: {
|
|
3293
3519
|
color: tHeadColor ?? configStyles.TABLE.head.color,
|
|
3294
3520
|
backgroundColor: tHeadBackgroundColor ?? configStyles.TABLE.head.colors.background,
|
|
@@ -3319,6 +3545,9 @@ const Table = ({
|
|
|
3319
3545
|
}
|
|
3320
3546
|
}, body.map((item, index) => {
|
|
3321
3547
|
return /*#__PURE__*/React__default.createElement("tr", {
|
|
3548
|
+
onDragStart: () => handleDragStart(index),
|
|
3549
|
+
onDragOver: e => e.preventDefault(),
|
|
3550
|
+
onDrop: () => handleDrop(index),
|
|
3322
3551
|
key: `${item}_${index}`,
|
|
3323
3552
|
style: {
|
|
3324
3553
|
backgroundColor: tableRowBGColor ?? configStyles.TABLE.body.row.colors.background,
|
|
@@ -3333,6 +3562,7 @@ const Table = ({
|
|
|
3333
3562
|
hideBorder: hideBorder,
|
|
3334
3563
|
innerIndex: innerIndex,
|
|
3335
3564
|
row: Object.values(item),
|
|
3565
|
+
dragStart: handleDragStart,
|
|
3336
3566
|
id: item.id ? item.id : '',
|
|
3337
3567
|
handleCheckDots: handleCheckDots,
|
|
3338
3568
|
key: `${innerItem}_${index}_${innerIndex}`,
|
|
@@ -3347,6 +3577,11 @@ const Table = ({
|
|
|
3347
3577
|
handleBodyActionClick: handleBodyActionClick,
|
|
3348
3578
|
handleMoreOptionsClick: handleMoreOptionsClick,
|
|
3349
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,
|
|
3350
3585
|
tBodyColor: tBodyColor ?? configStyles.TABLE.body.color,
|
|
3351
3586
|
rowItem: tableRowItem ?? configStyles.TABLE.body.row.isItem,
|
|
3352
3587
|
rowRadius: tableRowRadius ?? configStyles.TABLE.body.row.radius,
|
|
@@ -3556,6 +3791,8 @@ const Modal = ({
|
|
|
3556
3791
|
closeAreaBackgroundColor,
|
|
3557
3792
|
type = 'content'
|
|
3558
3793
|
}) => {
|
|
3794
|
+
const leftBtnRef = useRef(null);
|
|
3795
|
+
const rightBtnRef = useRef(null);
|
|
3559
3796
|
const [select, setSelect] = useState(0);
|
|
3560
3797
|
const [isHover, setIsHover] = useState(false);
|
|
3561
3798
|
const [innerData, setInnerData] = useState([]);
|
|
@@ -3582,6 +3819,17 @@ const Modal = ({
|
|
|
3582
3819
|
}
|
|
3583
3820
|
}
|
|
3584
3821
|
};
|
|
3822
|
+
const handleNavigateArrow = e => {
|
|
3823
|
+
if (e.key === 'ArrowRight') {
|
|
3824
|
+
if (rightBtnRef.current) {
|
|
3825
|
+
rightBtnRef.current.click();
|
|
3826
|
+
}
|
|
3827
|
+
} else if (e.key === 'ArrowLeft') {
|
|
3828
|
+
if (leftBtnRef.current) {
|
|
3829
|
+
leftBtnRef.current.click();
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
};
|
|
3585
3833
|
const handleESC = e => {
|
|
3586
3834
|
if (e.key === 'Escape') {
|
|
3587
3835
|
handleCloseModal();
|
|
@@ -3621,7 +3869,10 @@ const Modal = ({
|
|
|
3621
3869
|
className && setClassProps(() => classnames(className ?? configStyles.MODAL.className));
|
|
3622
3870
|
}, [className]);
|
|
3623
3871
|
useEffect(() => {
|
|
3624
|
-
document.addEventListener('keydown',
|
|
3872
|
+
document.addEventListener('keydown', e => {
|
|
3873
|
+
handleESC(e);
|
|
3874
|
+
handleNavigateArrow(e);
|
|
3875
|
+
}, false);
|
|
3625
3876
|
configStylesPromise.then(data => {
|
|
3626
3877
|
setClassProps(() => classnames(className ?? data.MODAL.className));
|
|
3627
3878
|
setConfigStyles(() => {
|
|
@@ -3635,7 +3886,10 @@ const Modal = ({
|
|
|
3635
3886
|
return () => {
|
|
3636
3887
|
setSelect(0);
|
|
3637
3888
|
setInnerData([]);
|
|
3638
|
-
document.removeEventListener('keydown',
|
|
3889
|
+
document.removeEventListener('keydown', e => {
|
|
3890
|
+
handleESC(e);
|
|
3891
|
+
handleNavigateArrow(e);
|
|
3892
|
+
}, false);
|
|
3639
3893
|
};
|
|
3640
3894
|
}, []);
|
|
3641
3895
|
return configStyles.MODAL && /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -3809,6 +4063,7 @@ const Modal = ({
|
|
|
3809
4063
|
}
|
|
3810
4064
|
}
|
|
3811
4065
|
}), innerData && innerData.length > 1 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("button", {
|
|
4066
|
+
ref: leftBtnRef,
|
|
3812
4067
|
onClick: () => handleGoTo('prev'),
|
|
3813
4068
|
style: {
|
|
3814
4069
|
position: 'absolute',
|
|
@@ -3823,6 +4078,7 @@ const Modal = ({
|
|
|
3823
4078
|
backgroundColor: 'transparent'
|
|
3824
4079
|
}
|
|
3825
4080
|
}, prevIcon ? prevIcon : configStyles.MODAL.icon.prev ? configStyles.MODAL.icon.prev : /*#__PURE__*/React__default.createElement(SvgPrev, null)), /*#__PURE__*/React__default.createElement("button", {
|
|
4081
|
+
ref: rightBtnRef,
|
|
3826
4082
|
onClick: () => handleGoTo('next'),
|
|
3827
4083
|
style: {
|
|
3828
4084
|
position: 'absolute',
|
|
@@ -3912,7 +4168,7 @@ const TelInput = ({
|
|
|
3912
4168
|
useEffect(() => {
|
|
3913
4169
|
let newValue = '';
|
|
3914
4170
|
if (value !== undefined && value !== null) {
|
|
3915
|
-
newValue = handleUtilsCheckTypeTel(value
|
|
4171
|
+
newValue = handleUtilsCheckTypeTel(value);
|
|
3916
4172
|
}
|
|
3917
4173
|
setInnerValue(() => newValue);
|
|
3918
4174
|
}, [value]);
|
|
@@ -4056,6 +4312,7 @@ const NumberInput = ({
|
|
|
4056
4312
|
inpStyles,
|
|
4057
4313
|
minNumSize,
|
|
4058
4314
|
maxNumSize,
|
|
4315
|
+
insideError,
|
|
4059
4316
|
inputChange,
|
|
4060
4317
|
inpAttributes,
|
|
4061
4318
|
setInnerErrorMessage
|
|
@@ -4064,15 +4321,29 @@ const NumberInput = ({
|
|
|
4064
4321
|
const [innerMinNumSize, setInnerMinNumSize] = useState(0);
|
|
4065
4322
|
const handleChange = event => {
|
|
4066
4323
|
let prevValue = innerValue;
|
|
4067
|
-
let currentValue = event.target.value;
|
|
4324
|
+
let currentValue = event.target.value.replace(/\.|․|\.|,/g, '.');
|
|
4068
4325
|
currentValue = handleUtilsCheckTypeNumber(currentValue, prevValue, null, float, maxNumSize, dots);
|
|
4069
4326
|
setInnerValue(() => currentValue);
|
|
4070
4327
|
if (inputChange && currentValue !== prevValue) {
|
|
4071
|
-
if (currentValue < Number.MIN_SAFE_INTEGER || currentValue > Number.MAX_SAFE_INTEGER
|
|
4328
|
+
if (currentValue < Number.MIN_SAFE_INTEGER || currentValue > Number.MAX_SAFE_INTEGER) {
|
|
4072
4329
|
if (currentValue === '') {
|
|
4073
4330
|
setInnerErrorMessage(() => '');
|
|
4074
4331
|
} else {
|
|
4075
|
-
|
|
4332
|
+
insideError && insideError();
|
|
4333
|
+
setInnerErrorMessage(() => `Լրացված դաշտի արժեքը պետք է լինի ${Number.MIN_SAFE_INTEGER} - ${Number.MAX_SAFE_INTEGER} թվերի միջակայքում`);
|
|
4334
|
+
}
|
|
4335
|
+
} else if (innerMinNumSize && currentValue < innerMinNumSize || maxNumSize && currentValue > maxNumSize) {
|
|
4336
|
+
if (currentValue === '') {
|
|
4337
|
+
setInnerErrorMessage(() => '');
|
|
4338
|
+
} else {
|
|
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
|
+
}
|
|
4076
4347
|
}
|
|
4077
4348
|
} else if (currentValue >= Number.MIN_SAFE_INTEGER || currentValue <= Number.MAX_SAFE_INTEGER || innerMinNumSize && currentValue >= innerMinNumSize || maxNumSize && currentValue <= maxNumSize) {
|
|
4078
4349
|
inputChange(currentValue);
|
|
@@ -4080,6 +4351,14 @@ const NumberInput = ({
|
|
|
4080
4351
|
}
|
|
4081
4352
|
}
|
|
4082
4353
|
};
|
|
4354
|
+
const handleBlur = () => {
|
|
4355
|
+
const newVal = handleRemoveLeadingZeros(innerValue);
|
|
4356
|
+
if (parseFloat(newVal) === 0) {
|
|
4357
|
+
inputChange('');
|
|
4358
|
+
} else {
|
|
4359
|
+
inputChange(newVal);
|
|
4360
|
+
}
|
|
4361
|
+
};
|
|
4083
4362
|
useEffect(() => {
|
|
4084
4363
|
if (minNumSize && minNumSize < 0) {
|
|
4085
4364
|
setInnerMinNumSize(0);
|
|
@@ -4113,6 +4392,7 @@ const NumberInput = ({
|
|
|
4113
4392
|
},
|
|
4114
4393
|
min: minNumSize,
|
|
4115
4394
|
max: maxNumSize,
|
|
4395
|
+
onBlur: handleBlur,
|
|
4116
4396
|
onInput: handleChange
|
|
4117
4397
|
});
|
|
4118
4398
|
};
|
|
@@ -4189,6 +4469,7 @@ const Input = ({
|
|
|
4189
4469
|
telBorderRightWidth,
|
|
4190
4470
|
telBorderRightStyle,
|
|
4191
4471
|
telBorderRightColor,
|
|
4472
|
+
fireInputInsideError,
|
|
4192
4473
|
backgroundDisableColor,
|
|
4193
4474
|
telBorderRightColorHover,
|
|
4194
4475
|
type = 'text'
|
|
@@ -4304,7 +4585,7 @@ const Input = ({
|
|
|
4304
4585
|
boxSizing: boxSizing ?? configStyles.INPUT.box.sizing,
|
|
4305
4586
|
borderTopLeftRadius: radius ?? configStyles.INPUT.radius,
|
|
4306
4587
|
borderBottomLeftRadius: radius ?? configStyles.INPUT.radius,
|
|
4307
|
-
backgroundColor: disabled ?
|
|
4588
|
+
backgroundColor: disabled ? backgroundDisableColor ? backgroundDisableColor : configStyles.INPUT.colors.backgroundDisable : backgroundColor ? backgroundColor : configStyles.INPUT.colors.background
|
|
4308
4589
|
}
|
|
4309
4590
|
}, type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]) : '', type === 'tel' ? /*#__PURE__*/React__default.createElement(TelInput, {
|
|
4310
4591
|
type: type,
|
|
@@ -4330,6 +4611,7 @@ const Input = ({
|
|
|
4330
4611
|
inputChange: change,
|
|
4331
4612
|
inpStyles: inpStyles,
|
|
4332
4613
|
inpAttributes: inpAttributes,
|
|
4614
|
+
insideError: fireInputInsideError,
|
|
4333
4615
|
minNumSize: minNumSize ? minNumSize : '',
|
|
4334
4616
|
maxNumSize: maxNumSize ? maxNumSize : '',
|
|
4335
4617
|
setInnerErrorMessage: setInnerErrorMessage,
|
|
@@ -4365,7 +4647,7 @@ const Input = ({
|
|
|
4365
4647
|
boxSizing: boxSizing ?? configStyles.INPUT.box.sizing,
|
|
4366
4648
|
borderTopRightRadius: radius ?? configStyles.INPUT.radius,
|
|
4367
4649
|
borderBottomRightRadius: radius ?? configStyles.INPUT.radius,
|
|
4368
|
-
backgroundColor: disabled ?
|
|
4650
|
+
backgroundColor: disabled ? backgroundDisableColor ? backgroundDisableColor : configStyles.INPUT.colors.backgroundDisable : backgroundColor ? backgroundColor : configStyles.INPUT.colors.background
|
|
4369
4651
|
}
|
|
4370
4652
|
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default.createElement(P, {
|
|
4371
4653
|
animation: animation,
|
|
@@ -4441,6 +4723,7 @@ Input.propTypes = {
|
|
|
4441
4723
|
labelMarginBottom: PropTypes.string,
|
|
4442
4724
|
regexpErrorMessage: PropTypes.string,
|
|
4443
4725
|
regexp: PropTypes.instanceOf(RegExp),
|
|
4726
|
+
fireInputInsideError: PropTypes.func,
|
|
4444
4727
|
telBorderRightWidth: PropTypes.string,
|
|
4445
4728
|
telBorderRightStyle: PropTypes.string,
|
|
4446
4729
|
telBorderRightColor: PropTypes.string,
|