all files / actions/ taskbar-edit.js

81.67% Statements 1430/1751
72.15% Branches 1176/1630
90% Functions 72/80
81.65% Lines 1424/1744
11 statements, 6 functions, 9 branches Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698                              747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747× 747×   747× 747× 747× 747× 747×   922× 922× 922× 922× 922× 922× 922× 922× 922× 922× 922× 922× 922× 922× 922×   922× 922×   179× 179× 179×       170× 169×                                                                                                                                                                         182× 182× 182× 182×     179×       179× 179×   159× 159× 17×                 17×         182× 177× 177× 177× 177× 177× 15×     162×   177× 177× 175× 175× 175× 175× 175× 175× 175× 175× 175× 175× 175×     171×   175× 175× 175× 175× 175× 175× 175×     171×       170×     175× 175× 175× 175×           175× 175× 175× 175× 175×   175×     171×   175× 175× 175× 175× 175× 175×       175× 175× 175× 25×   150× 31× 31× 15× 15× 15× 15×                                 202× 202× 202× 202×     202×   202× 33× 33× 33× 15× 15×       202× 194× 160× 160× 160× 142×           142× 142× 142×       34×           194× 194×       159×   159× 159×   159× 159×         202× 61× 52× 52× 52×     52× 52×     61×     52×   52× 52× 52× 52×   52× 52×               61×     197× 197× 197× 197× 25×   172× 31×   141×   12×   129× 14×   115×   108×   106×       105× 93×     197×   175× 175× 175×         175× 173× 173×       169×     173× 173×     175× 17× 17×     170×       164× 164× 164× 164× 164×     146×   164×                                                                                                                                                   170× 170×               170× 170× 170×       166×     170×   170× 170× 170× 85× 85×     83×   85×             85× 85×   170× 170×   170× 164× 164×   146× 146×       145×   146×             144× 10×     134×     146× 137×       136× 136×       164×   11× 11× 11× 11× 11×       11×   11×   11× 11× 11× 11× 11×       11×   11×             11×   11× 11×                 11× 11× 11×                                   11× 11× 10×   11×                                                                                     164×           164× 13×   164× 164×       164× 164× 19×     19× 19×   12× 12× 12× 12× 12× 12× 12× 12×       164×     164×     164× 163×           163× 163× 163× 163× 163× 163× 163×   162× 162× 162× 162× 162× 162× 162× 162× 162× 162× 100×   162× 162×                                 153× 23×   130× 31×   99×   82×   17×   17× 17× 17×   162× 15× 15× 15× 15× 15×                           15× 15× 15×       15×   15×         15×     15× 15× 15×                 15×     147×   162× 162× 162× 162× 162× 162×   162×     162× 162× 11× 11×         162× 162× 162× 162×         162× 162×       158×     162× 162×     162×     162×     160× 160×       156×     160×   160×   14× 14×   146×             146× 122× 122×   24×         24× 24× 24×                 160× 160× 160× 160×                                                         1083× 1083×   82× 82×   82× 82×                             79× 20× 20× 20×       59× 59×   79×   79×     18× 18×         18×   18×                                                                     25× 25× 25×     20× 16× 15× 15× 15× 15×                               20×     20× 20×     29× 11× 11× 11×                                                                           11× 11×   48× 48×   48× 14× 14× 14×         34× 34× 34×         36× 36× 36× 23×                                                   28× 11×     10× 10×         17×     28×     28×     162× 162× 162× 162× 162× 162×         23× 18× 18× 18×       18× 18× 18×       18×   18× 18×       23×     31× 28× 28× 28×       28× 28×   28× 28× 28×       31×         82× 79×       82×   162× 15×     79× 79× 79× 79×     78×           78× 78× 78×                     15× 15× 34× 34×   15×                       37×   37× 37×   37× 37× 37× 37×     37×             34× 34×       33×         32× 20×       37×   107×   107×   107×   107× 107× 107× 107×     107×                 106× 106×     105×       104×     107×   284× 284× 284× 284×   284×   284× 284×         284×   162× 162× 162×     153×       152×       162× 162× 162× 162×   162× 162× 13×   162× 162× 162×       162×       162×   162× 162× 162× 162× 162× 162× 162× 162× 162× 162× 162× 162× 162× 162×   162×   145× 142×   11× 11×   10×     11× 11×       11× 11× 11×   10×         142× 142× 142× 13×   142×   11× 11× 11×   142×                         142×     145× 133×     129×     145× 18×   145× 119× 119×   145×   145× 18× 18× 18×   127×                                     118× 17× 17× 17× 17× 17× 17× 17×       101×         93×   92×             91× 78× 78× 78× 78× 78× 78×   91× 91× 91× 91× 91×     91× 13× 13× 13× 13×         162×   11× 11×       11×       175× 175× 175× 175× 164× 164×         164×               158×   164×       164× 164× 164× 164×                     175× 31× 28× 15× 15× 15×       175× 175×   175×   164× 164× 164× 164× 164× 164× 164× 164× 164×     164× 164×                   156×   22×         134× 17×     156× 156× 156× 156× 156× 156× 156× 156× 156× 156× 156× 156×       164×                       156× 156× 156× 156× 156×                                                                                                                           156×             147× 147×       11× 11× 11×   11×   11×   11×   11× 11× 11×     10× 10×   11×                                             10×                       147×   156× 156× 156×   16×   17× 17× 17× 17× 17× 17× 17× 17× 17× 17× 17×   17× 12×         12×       17×               17×   17× 17×           17×           17× 17× 17×   17×   367× 17× 17× 17× 17× 17× 17× 17× 17×       17× 17× 17× 17× 17× 17× 12× 12×             17× 17×       17×   17×           17×       14× 14×       17× 17×   17×   17×             17× 17× 17×     19× 19× 19×       19× 19× 19× 19× 19× 19× 19× 19× 14×     19× 19× 14× 14×       19×       19×     17×   19× 19× 19× 19× 19× 19× 19× 19× 19× 19× 19×     19×     19× 19×                 17×             17×   17×     688× 688× 688× 688× 688× 688× 688×     688×   424× 423×                 746× 714×   32× 32× 32× 32× 32×   746× 746× 746×        
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
define(["require", "exports", "@syncfusion/ej2-base", "../base/utils", "../base/date-processor", "../base/css-constants", "../renderer/edit-tooltip"], function (require, exports, ej2_base_1, utils_1, date_processor_1, cls, edit_tooltip_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var TaskbarEdit = (function (_super) {
        __extends(TaskbarEdit, _super);
        function TaskbarEdit(ganttObj) {
            var _this = _super.call(this, ganttObj) || this;
            _this.leftValue = 0;
            _this.previousLeftValue = 0;
            _this.isMouseDragged = false;
            _this.dependencyCancel = false;
            _this.isDragged = false;
            _this.editElement = null;
            _this.elementOffsetLeft = 0;
            _this.elementOffsetTop = 0;
            _this.elementOffsetWidth = 0;
            _this.elementOffsetHeight = 0;
            _this.segmentIndex = -1;
            _this.currentItemTop = 0;
            _this.currentItemPrevTop = 0;
            _this.topValue = 0;
            _this.draggedRecordMarginTop = '0px';
            _this.isClonedElement = false;
            _this.updatePosition = false;
            _this.tooltipValue = 0;
            _this.parent = ganttObj;
            _this.initPublicProp();
            _this.wireEvents();
            _this.editTooltip = new edit_tooltip_1.EditTooltip(_this.parent, _this);
            return _this;
        }
        TaskbarEdit.prototype.wireEvents = function () {
            this.parent.on('chartMouseDown', this.mouseDownHandler, this);
            this.parent.on('chartMouseUp', this.mouseUpHandler, this);
            this.parent.on('chartMouseLeave', this.mouseLeaveHandler, this);
            this.parent.on('chartMouseMove', this.mouseMoveAction, this);
            this.parent.on('chartMouseClick', this.mouseClickHandler, this);
        };
        TaskbarEdit.prototype.initPublicProp = function () {
            this.taskBarEditElement = null;
            this.taskBarEditRecord = null;
            this.taskBarEditAction = null;
            this.connectorSecondElement = null;
            this.connectorSecondRecord = null;
            this.connectorSecondAction = null;
            this.highlightedSecondElement = null;
            this.fromPredecessorText = null;
            this.toPredecessorText = null;
            this.finalPredecessor = null;
            this.drawPredecessor = false;
            this.roundOffDuration = true;
            this.dragMouseLeave = false;
            this.isMouseDragged = false;
            this.previousItemProperty = ['left', 'progress', 'duration', 'isMilestone', 'startDate', 'endDate', 'width', 'progressWidth',
                'autoLeft', 'autoDuration', 'autoStartDate', 'autoEndDate', 'autoWidth', 'segments'];
            this.tapPointOnFocus = false;
            this.touchEdit = false;
        };
        TaskbarEdit.prototype.mouseDownHandler = function (e) {
            Eif (this.parent.editSettings.allowTaskbarEditing && !this.parent.readOnly) {
                this.canDrag = false;
                if (this.taskBarEditElement) {
                    var targetElement = this.getElementByPosition(e);
                    var element = utils_1.parentsUntil(targetElement, cls.taskBarMainContainer);
                    Eif ((element && element.innerHTML === this.taskBarEditElement.innerHTML ||
                        this.taskBarEditElement.classList.contains('e-segmented-taskbar') || this.taskBarEditElement.classList.contains('collpse-parent-border'))) {
                        this.updateTaskBarEditElement(e);
                        this.canDrag = true;
                        e.preventDefault();
                    }
                }
                else if (!this.parent.isAdaptive) {
                    this.updateTaskBarEditElement(e);
                }
            }
        };
        TaskbarEdit.prototype.mouseClickHandler = function (e) {
            if (!this.parent.editSettings.allowTaskbarEditing) {
                return;
            }
            var targetElement = this.getElementByPosition(e);
            var element = utils_1.parentsUntil(targetElement, cls.taskBarMainContainer);
            if (this.parent.selectionModule && this.parent.selectionModule.enableSelectMultiTouch) {
                if (this.tapPointOnFocus) {
                    this.updateTaskBarEditElement(e);
                }
                return;
            }
            if (this.tapPointOnFocus && !ej2_base_1.isNullOrUndefined(this.taskBarEditElement) && element &&
                element.innerHTML !== this.taskBarEditElement.innerHTML) {
                this.connectorSecondRecord = this.parent.ganttChartModule.getRecordByTaskBar(element);
                this.connectorSecondAction = 'ConnectorPointLeftDrag';
                this.connectorSecondElement = element;
                this.fromPredecessorText = 'Finish';
                if (this.validateConnectorPoint()) {
                    this.taskBarEditingAction(e, true);
                }
                this.showHideActivePredecessors(false);
                this.initPublicProp();
            }
            else if (targetElement.classList.contains(cls.connectorPointLeftHover)) {
                this.canDrag = false;
                this.multipleSelectionEnabled();
                this.showHideTaskBarEditingElements(targetElement, this.taskBarEditElement);
                this.tapPointOnFocus = true;
                this.taskBarEditAction = 'ConnectorPointLeftDrag';
                this.connectorSecondRecord = this.taskBarEditRecord;
                this.taskBarEditingAction(e, false);
            }
            else if (targetElement.classList.contains(cls.connectorPointRightHover)) {
                this.canDrag = false;
                this.multipleSelectionEnabled();
                this.showHideTaskBarEditingElements(targetElement, this.taskBarEditElement);
                this.tapPointOnFocus = true;
                this.taskBarEditAction = 'ConnectorPointRightDrag';
                this.connectorSecondRecord = this.taskBarEditRecord;
                this.taskBarEditingAction(e, false);
            }
            else {
                if (this.tapPointOnFocus) {
                    this.showHideActivePredecessors(false);
                    this.showHideTaskBarEditingElements(element, this.taskBarEditElement);
                }
                this.updateTaskBarEditElement(e);
            }
        };
        TaskbarEdit.prototype.showHideActivePredecessors = function (show) {
            var ganttProp = this.taskBarEditRecord.ganttProperties;
            var predecessors = ganttProp.predecessor;
            var id = this.parent.viewType === 'ResourceView' ? ganttProp.taskId : ganttProp.rowUniqueID;
            Eif (predecessors) {
                for (var i = 0; i < predecessors.length; i++) {
                    var predecessor = predecessors[i];
                    Eif (id.toString() === predecessor.from || id.toString() === predecessor.to) {
                        this.applyActiveColor(predecessor.from, predecessor.to, show);
                    }
                }
            }
            var chartContent = this.parent.ganttChartModule.chartBodyContainer;
            if (show) {
                ej2_base_1.addClass([this.taskBarEditElement], [cls.activeChildTask]);
                ej2_base_1.addClass([chartContent], [cls.touchMode]);
            }
            else {
                ej2_base_1.removeClass([this.taskBarEditElement], [cls.activeChildTask]);
                ej2_base_1.removeClass([chartContent], [cls.touchMode]);
            }
            this.touchEdit = show;
            Eif (!ej2_base_1.isNullOrUndefined(this.parent.toolbarModule)) {
                this.parent.toolbarModule.refreshToolbarItems();
            }
        };
        TaskbarEdit.prototype.applyActiveColor = function (from, to, enable) {
            var taskId = this.parent.viewType === 'ProjectView' ? this.taskBarEditRecord.ganttProperties.taskId.toString() :
                this.taskBarEditRecord.ganttProperties.rowUniqueID.toString();
            var ganttRecord = (taskId === from) ? this.parent.connectorLineModule.getRecordByID(to) :
                this.parent.connectorLineModule.getRecordByID(from);
            var $tr = this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(ganttRecord)];
            Eif (!ej2_base_1.isNullOrUndefined($tr)) {
                var $taskbar = $tr.querySelector('.' + cls.taskBarMainContainer);
                var $connectorElement = this.parent.element.querySelector('#ConnectorLineparent' + from + 'child' + to);
                if (enable) {
                    ej2_base_1.addClass([$taskbar], [cls.activeConnectedTask]);
                    Eif ($connectorElement) {
                        ej2_base_1.addClass([$connectorElement], [cls.activeConnectedTask]);
                    }
                }
                else {
                    ej2_base_1.removeClass([$taskbar], [cls.activeConnectedTask]);
                    Eif ($connectorElement) {
                        ej2_base_1.removeClass([$connectorElement], [cls.activeConnectedTask]);
                    }
                }
            }
        };
        TaskbarEdit.prototype.validateConnectorPoint = function () {
            var parentRecord = this.taskBarEditRecord.ganttProperties;
            var childRecord = this.connectorSecondRecord.ganttProperties;
            var isValid = true;
            var parentId = this.parent.viewType === 'ResourceView' ? parentRecord.taskId : parentRecord.rowUniqueID;
            var childId = this.parent.viewType === 'ResourceView' ? childRecord.taskId : childRecord.rowUniqueID;
            Iif (this.connectorSecondRecord.hasChildRecords) {
                isValid = false;
            }
            else Eif (childRecord.predecessor) {
                for (var i = 0; i < childRecord.predecessor.length; i++) {
                    var predecessor = childRecord.predecessor[i];
                    if (predecessor.from === parentId.toString() &&
                        predecessor.to === childId.toString()) {
                        this.parent.connectorLineEditModule.childRecord = this.connectorSecondRecord;
                        this.parent.connectorLineEditModule.predecessorIndex = i;
                        this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog();
                        isValid = false;
                        break;
                    }
                    else if (predecessor.from === childId.toString() &&
                        predecessor.to === parentId.toString()) {
                        this.parent.connectorLineEditModule.childRecord = this.taskBarEditRecord;
                        this.parent.connectorLineEditModule.predecessorIndex = i;
                        this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog();
                        isValid = false;
                        break;
                    }
                }
            }
            return isValid;
        };
        TaskbarEdit.prototype.mouseLeaveHandler = function (e) {
            if (this.taskBarEditAction === 'ChildDrag' || this.taskBarEditAction === 'ParentDrag' ||
                this.taskBarEditAction === 'ProgressResizing' || this.taskBarEditAction === 'LeftResizing' ||
                this.taskBarEditAction === 'RightResizing') {
                this.dragMouseLeave = false;
            }
            else {
                this.dragMouseLeave = true;
            }
        };
        TaskbarEdit.prototype.updateTaskBarEditElement = function (e) {
            var target = this.getElementByPosition(e);
            var cloneTaskBar;
            var element;
            if (target.classList.contains(cls.manualParentRightResizer) || target.classList.contains(cls.manualParentMainContainer)
                || target.classList.contains(cls.manualParentTaskBar)) {
                element = utils_1.parentsUntil(target, cls.manualParentMainContainer);
            }
            else Iif (target.classList.contains(cls.manualParentMilestone)) {
                element = utils_1.parentsUntil(target, cls.manualParentMilestone);
            }
            else {
                element = utils_1.parentsUntil(target, cls.taskBarMainContainer);
                if (!ej2_base_1.isNullOrUndefined(element) && !target.classList.contains('e-connectorpoint-left') &&
                    !target.classList.contains('e-connectorpoint-right')) {
                    var currentRecord = this.parent.ganttChartModule.getRecordByTaskBar(element);
                    if (!ej2_base_1.isNullOrUndefined(currentRecord.ganttProperties.segments) && currentRecord.ganttProperties.segments.length > 0) {
                        Iif (target.classList.contains('e-progressbar-handler-after')) {
                            for (var i = 0; i < currentRecord.ganttProperties.segments.length; i++) {
                                if (currentRecord.ganttProperties.segments[i].showProgress) {
                                    element = element.querySelectorAll('.e-segmented-taskbar')[i];
                                    break;
                                }
                            }
                        }
                        else {
                            element = utils_1.parentsUntil(target, cls.childTaskBarInnerDiv);
                        }
                    }
                }
            }
            if (this.parent.editSettings.allowTaskbarEditing && element) {
                this.showHideTaskBarEditingElements(element, this.editElement);
                this.editElement = element;
                this.realTaskbarElement = this.editElement;
                var index = this.editElement.getAttribute('data-segment-index');
                if (!ej2_base_1.isNullOrUndefined(index)) {
                    this.segmentIndex = Number(index);
                }
                else {
                    this.segmentIndex = -1;
                }
                this.taskBarEditRecord = this.parent.ganttChartModule.getRecordByTaskBar(this.editElement);
                if (e.type === 'mousedown' || e.type === 'touchstart' || e.type === 'click') {
                    this.taskBarEditAction = this.getTaskBarAction(e);
                    var index_1 = this.editElement.getAttribute('data-segment-index');
                    var currentRecord = this.parent.ganttChartModule.getRecordByTaskBar(element);
                    var ganttprop = currentRecord.ganttProperties;
                    var parentleft = this.editElement.parentElement.offsetLeft;
                    this.currentData = currentRecord;
                    var resizeElement = ej2_base_1.createElement('div', { styles: 'height:100%;border-style:dashed;border-bottom:none;border-top:none;border-width:1px;position:absolute;z-index:10000' });
                    ej2_base_1.addClass([resizeElement], 'e-taskbar-resize-div');
                    resizeElement.style.setProperty('width', ganttprop.width + 'px');
                    var currentindex = this.editElement.getAttribute('data-segment-index');
                    if (!ej2_base_1.isNullOrUndefined(ganttprop.segments) && this.parent.allowTaskbarDragAndDrop && this.taskBarEditAction !== 'LeftResizing' && this.taskBarEditAction !== 'RightResizing' && this.taskBarEditAction !== 'ProgressResizing') {
                        resizeElement.style.setProperty('left', ((!ej2_base_1.isNullOrUndefined(ganttprop.segments) ? parentleft + 'px' : (ganttprop.left) + 'px')));
                    }
                    else {
                        resizeElement.style.setProperty('left', (((!ej2_base_1.isNullOrUndefined(ganttprop.segments) && ganttprop.segments.length > 1) ? parentleft + ganttprop.segments[Number(currentindex)].left + 'px' : (ganttprop.left) + 'px')));
                    }
                    var resizeTable = this.parent.createElement('table');
                    var resizetableBody = this.parent.createElement('tbody');
                    resizetableBody.appendChild(resizeElement);
                    resizeTable.appendChild(resizetableBody);
                    var Check = this.parent.ganttChartModule.chartBodyContainer.querySelector('.e-clone-taskbar');
                    var createTable = null;
                    if ((this.taskBarEditAction === 'ChildDrag' || this.taskBarEditAction === 'LeftResizing') && !ej2_base_1.isNullOrUndefined(index_1) && !ej2_base_1.isNullOrUndefined(index_1) ? Number(index_1) === 0 : false) {
                        cloneTaskBar = this.editElement.parentElement.cloneNode(true);
                    }
                    else {
                        if (this.segmentIndex !== -1 && this.parent.allowTaskbarDragAndDrop && this.taskBarEditAction !== 'LeftResizing' &&
                            this.taskBarEditAction !== 'RightResizing' && this.taskBarEditAction !== 'ProgressResizing') {
                            cloneTaskBar = this.editElement.parentElement.cloneNode(true);
                        }
                        else {
                            cloneTaskBar = this.editElement.cloneNode(true);
                        }
                    }
                    Eif (!Check) {
                        ej2_base_1.addClass([cloneTaskBar], 'e-clone-taskbar');
                        cloneTaskBar.style.setProperty('position', 'absolute');
                        if (currentRecord.hasChildRecords && !currentRecord.ganttProperties.isAutoSchedule) {
                            var containerPosition = this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer);
                            var taskbarPosition = this.parent.getOffsetRect(this.editElement);
                            if (this.editElement.classList.contains('e-manualparent-main-container')) {
                                cloneTaskBar.style.setProperty('left', (currentRecord.ganttProperties.left - currentRecord.ganttProperties.autoLeft) + 'px');
                            }
                            else {
                                cloneTaskBar.style.setProperty(this.parent.enableRtl ?
                                    'right' : 'left', Math.abs(taskbarPosition.left - containerPosition.left + Math.abs(this.parent.ganttChartModule.scrollElement.scrollLeft)) + 'px');
                            }
                        }
                        cloneTaskBar.style.setProperty('top', 0 + 'px');
                        createTable = this.parent.createElement('table');
                        var tableBody = this.parent.createElement('tbody');
                        tableBody.appendChild(cloneTaskBar);
                        createTable.appendChild(tableBody);
                    }
                    if ((this.taskBarEditAction === 'ChildDrag' || this.taskBarEditAction === 'LeftResizing') && !ej2_base_1.isNullOrUndefined(index_1) && !ej2_base_1.isNullOrUndefined(index_1) ? Number(index_1) === 0 : false) {
                        var segmentedTasks = cloneTaskBar.getElementsByClassName('e-segmented-taskbar');
                        this.cloneTaskbarElement = segmentedTasks[Number(index_1)];
                    }
                    else {
                        this.cloneTaskbarElement = cloneTaskBar;
                    }
                    this.taskBarEditElement = this.cloneTaskbarElement;
                    this.taskbarElement = createTable;
                    this.taskbarResizer = resizeTable;
                    this.currentIndex = index_1;
                    this.roundOffDuration = true;
                    Iif ((this.taskBarEditAction === 'ConnectorPointLeftDrag' || this.taskBarEditAction === 'ConnectorPointRightDrag') &&
                        ej2_base_1.isNullOrUndefined(this.parent.taskFields.dependency)) {
                        this.taskBarEditAction = null;
                    }
                    this.updateMouseDownProperties(e);
                    Eif (this.parent.viewType === 'ResourceView' || this.parent.viewType === 'ProjectView') {
                        if (this.taskBarEditRecord.level === 0) {
                            return;
                        }
                        else if (this.parent.enableMultiTaskbar) {
                            var parentRecord = this.parent.getTaskByUniqueID(this.taskBarEditRecord.parentItem.uniqueID);
                            if (!ej2_base_1.isNullOrUndefined(parentRecord) && !parentRecord.expanded) {
                                this.prevZIndex = (this.taskBarEditElement).style.zIndex;
                                (this.taskBarEditElement).style.zIndex = '1000';
                                Eif (this.taskBarEditElement.querySelector('.e-gantt-child-taskbar')) {
                                    ej2_base_1.addClass([this.taskBarEditElement.querySelector('.e-gantt-child-taskbar')], 'e-collapsed-taskbar-drag');
                                }
                            }
                        }
                    }
                }
            }
            else {
                Iif (this.parent.isAdaptive) {
                    if (this.taskBarEditElement) {
                        this.showHideTaskBarEditingElements(element, this.editElement);
                    }
                    this.initPublicProp();
                }
                else {
                    this.showHideTaskBarEditingElements(element, this.editElement);
                }
            }
        };
        TaskbarEdit.prototype.showHideTaskBarEditingElements = function (element, secondElement, fadeConnectorLine) {
            secondElement = secondElement ? secondElement : this.editElement;
            var isShowProgressResizer = this.parent.taskFields.progress ? true : false;
            var isShowConnectorPoints = true;
            Iif (this.parent.readOnly) {
                return;
            }
            var record = element ? this.parent.ganttChartModule.getRecordByTaskBar(element) :
                secondElement ? this.parent.ganttChartModule.getRecordByTaskBar(secondElement) : null;
            if (this.parent.enableMultiTaskbar && element) {
                var parentRecord = this.parent.getParentTask(record.parentItem);
                Eif (!ej2_base_1.isNullOrUndefined(parentRecord)) {
                    if (!parentRecord.expanded) {
                        isShowProgressResizer = false;
                        isShowConnectorPoints = false;
                    }
                }
            }
            if (element) {
                if (element.querySelector('.' + cls.taskBarLeftResizer)) {
                    ej2_base_1.addClass([element.querySelector('.' + cls.taskBarLeftResizer)], [cls.leftResizeGripper]);
                    ej2_base_1.addClass([element.querySelector('.' + cls.taskBarRightResizer)], [cls.rightResizeGripper]);
                    if (isShowProgressResizer) {
                        var progressElement = (record && record.ganttProperties.segments &&
                            record.ganttProperties.segments.length > 0) ?
                            this.parent.getRowByIndex(this.parent.enableVirtualization ? this.parent.currentViewData.indexOf(record)
                                : this.parent.flatData.indexOf(record)).
                                querySelectorAll('.' + cls.childProgressResizer)[0] :
                            element.querySelector('.' + cls.childProgressResizer);
                        Eif (!ej2_base_1.isNullOrUndefined(progressElement)) {
                            ej2_base_1.addClass([progressElement], [cls.progressResizeGripper]);
                            progressElement.style.top = '3px';
                        }
                    }
                }
                else Iif (this.parent.isAdaptive && isShowProgressResizer) {
                    var record_1 = this.parent.ganttChartModule.getRecordByTaskBar(element);
                    if (record_1.hasChildRecords) {
                        ej2_base_1.addClass([element], [cls.activeParentTask]);
                    }
                }
                ej2_base_1.addClass(this.parent.ganttChartModule.scrollElement.querySelectorAll('.' + cls.connectorLineContainer), [cls.connectorLineZIndex]);
                if (!ej2_base_1.isNullOrUndefined(this.parent.taskFields.dependency)
                    && (element.querySelector('.' + cls.connectorPointLeft)
                        || element.parentElement.querySelector('.' + cls.connectorPointLeft))
                    && isShowConnectorPoints) {
                    var connectorElement = !ej2_base_1.isNullOrUndefined(element.querySelector('.' + cls.connectorPointLeft)) ?
                        element : element.parentElement;
                    Eif (!ej2_base_1.isNullOrUndefined(connectorElement.querySelector('.' + cls.connectorPointLeft))) {
                        ej2_base_1.addClass([connectorElement.querySelector('.' + cls.connectorPointLeft)], [cls.connectorPointLeftHover]);
                    }
                    Eif (!ej2_base_1.isNullOrUndefined(connectorElement.querySelector('.' + cls.connectorPointRight))) {
                        ej2_base_1.addClass([connectorElement.querySelector('.' + cls.connectorPointRight)], [cls.connectorPointRightHover]);
                    }
                }
            }
            else if (!fadeConnectorLine) {
                ej2_base_1.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll('.' + cls.connectorLineContainer), [cls.connectorLineZIndex]);
            }
            if (secondElement && element !== secondElement) {
                if (secondElement.querySelector('.' + cls.taskBarLeftResizer)) {
                    ej2_base_1.removeClass([secondElement.querySelector('.' + cls.taskBarLeftResizer)], [cls.leftResizeGripper]);
                    ej2_base_1.removeClass([secondElement.querySelector('.' + cls.taskBarRightResizer)], [cls.rightResizeGripper]);
                    var progressElement = (record && record.ganttProperties.segments && record.ganttProperties.segments.length > 0) ?
                        this.parent.getRowByIndex(this.parent.enableVirtualization ? this.parent.currentViewData.indexOf(record) :
                            this.parent.flatData.indexOf(record)) : secondElement;
                    Eif (progressElement && progressElement.querySelector('.' + cls.childProgressResizer)) {
                        ej2_base_1.removeClass([progressElement.querySelector('.' + cls.childProgressResizer)], [cls.progressResizeGripper]);
                    }
                }
                if (!ej2_base_1.isNullOrUndefined(this.parent.taskFields.dependency)
                    && (secondElement.querySelector('.' + cls.connectorPointLeft)
                        || secondElement.parentElement.querySelector('.' + cls.connectorPointLeft))) {
                    var connectorElement = !ej2_base_1.isNullOrUndefined(secondElement.querySelector('.' + cls.connectorPointLeft)) ?
                        secondElement : secondElement.parentElement;
                    var leftConnector = connectorElement.querySelector('.' + cls.connectorPointLeft);
                    var rightConnector = connectorElement.querySelector('.' + cls.connectorPointRight);
                    Eif (leftConnector) {
                        ej2_base_1.removeClass([leftConnector], [cls.connectorPointLeftHover]);
                    }
                    Eif (rightConnector) {
                        ej2_base_1.removeClass([rightConnector], [cls.connectorPointRightHover]);
                    }
                }
                else Iif (this.parent.isAdaptive) {
                    var record_2 = this.parent.ganttChartModule.getRecordByTaskBar(secondElement);
                    if (record_2 && record_2.hasChildRecords) {
                        ej2_base_1.removeClass([secondElement], [cls.activeParentTask]);
                    }
                }
                this.editElement = null;
            }
        };
        TaskbarEdit.prototype.getTaskBarAction = function (e) {
            var mouseDownElement = this.getElementByPosition(e);
            var data = this.taskBarEditRecord;
            var action = '';
            if (mouseDownElement.classList.contains(cls.taskBarLeftResizer)) {
                action = 'LeftResizing';
            }
            else if (mouseDownElement.classList.contains(cls.taskBarRightResizer)) {
                action = 'RightResizing';
            }
            else if ((mouseDownElement.classList.contains(cls.childProgressResizer) ||
                ej2_base_1.closest(mouseDownElement, '.' + cls.childProgressResizer)) && (this.parent.taskFields.progress)) {
                action = 'ProgressResizing';
            }
            else if (mouseDownElement.classList.contains(cls.connectorPointLeft)) {
                action = 'ConnectorPointLeftDrag';
            }
            else if (mouseDownElement.classList.contains(cls.connectorPointRight)) {
                action = 'ConnectorPointRightDrag';
            }
            else if (mouseDownElement.classList.contains(cls.manualParentRightResizer)) {
                action = 'ParentResizing';
            }
            else if (mouseDownElement.classList.contains(cls.manualParentTaskBar) ||
                mouseDownElement.classList.contains(cls.manualParentMainContainer) ||
                mouseDownElement.classList.contains(cls.manualParentMilestone)) {
                action = 'ManualParentDrag';
            }
            else if (data) {
                action = data.hasChildRecords ? data[this.parent.taskFields.manual] ? '' : 'ParentDrag'
                    : data.ganttProperties.isMilestone ? 'MilestoneDrag' : 'ChildDrag';
            }
            return action;
        };
        TaskbarEdit.prototype.updateMouseDownProperties = function (event) {
            var e = this.getCoordinate(event);
            var parentWithZoomStyle = this.parent.element.closest('[style*="zoom"]');
            Iif (parentWithZoomStyle) {
                var zoom1 = parseFloat(getComputedStyle(parentWithZoomStyle).zoom);
                e.pageX = e.pageX / zoom1;
                e.pageY = e.pageY / zoom1;
            }
            if (e.pageX || e.pageY) {
                var containerPosition = this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer);
                if (this.parent.enableRtl) {
                    this.mouseDownX = Math.abs(e.pageX - (containerPosition.left +
                        Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left)));
                }
                else {
                    this.mouseDownX = (e.pageX - containerPosition.left) +
                        this.parent.ganttChartModule.scrollObject.previousScroll.left;
                }
                this.tooltipPositionX = this.mouseDownX;
                this.mouseDownY = this.dragMoveY = e.pageY - containerPosition.top +
                    this.parent.ganttChartModule.scrollObject.previousScroll.top;
            }
            if (this.taskBarEditAction === 'ConnectorPointLeftDrag' || this.taskBarEditAction === 'ConnectorPointRightDrag') {
                this.fromPredecessorText = this.taskBarEditAction === 'ConnectorPointLeftDrag' ? 'start' : 'finish';
                this.parent.connectorLineModule.tooltipTable.innerHTML = this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.taskBarEditRecord.ganttProperties.taskName, this.fromPredecessorText, '', '');
            }
        };
        TaskbarEdit.prototype.isMouseDragCheck = function () {
            if (!this.isMouseDragged && this.taskBarEditAction && ((this.mouseDownX !== this.mouseMoveX) &&
                ((this.mouseDownX + 3) < this.mouseMoveX || (this.mouseDownX - 3) > this.mouseMoveX)
                || (this.mouseDownY !== this.mouseMoveY) &&
                    ((this.mouseDownY + 3) < this.mouseMoveY || (this.mouseDownY - 3) > this.mouseMoveY))) {
                this.isMouseDragged = true;
                this.parent.initiateEditAction(true);
                var item = this.taskBarEditRecord.ganttProperties;
                this.previousItem = this.parent.timelineModule.extendFunction(item, this.previousItemProperty);
                if (this.taskBarEditAction !== 'ConnectorPointLeftDrag' &&
                    this.taskBarEditAction !== 'ConnectorPointRightDrag' &&
                    !(this.parent.viewType === 'ResourceView' && this.taskBarEditAction === 'ParentDrag')) {
                    this.editTooltip.showHideTaskbarEditTooltip(true, this.segmentIndex);
                }
                this.taskBarEditElement.setAttribute('aria-grabbed', 'true');
            }
        };
        TaskbarEdit.prototype.removeFirstBorder = function (element) {
            var canremove = this.parent.rowDragAndDropModule['dropPosition'] === 'bottomSegment';
            Iif (this.parent.element.getElementsByClassName('e-firstrow-border').length > 0 && element &&
                (element.getAttribute('data-rowindex') !== 0 || canremove)) {
                this.parent.element.getElementsByClassName('e-firstrow-border')[0].remove();
            }
        };
        TaskbarEdit.prototype.removeLastBorder = function (element) {
            var isEmptyRow = element && (element.classList.contains('e-emptyrow') || element.classList.contains('e-columnheader')
                || element.classList.contains('e-detailrow'));
            var islastRowIndex;
            Iif (this.parent.enableVirtualization) {
                islastRowIndex = element && !isEmptyRow &&
                    this.parent.treeGrid.getRows()[this.parent.treeGrid.getCurrentViewRecords().length - 1].getAttribute('data-uid') !==
                        element.getAttribute('data-uid');
            }
            else {
                islastRowIndex = element && !isEmptyRow &&
                    this.parent.treeGrid.getRowByIndex(this.parent.treeGrid.getCurrentViewRecords().length - 1).getAttribute('data-uid') !==
                        element.getAttribute('data-uid');
            }
            var canremove = islastRowIndex || this.parent.rowDragAndDropModule['dropPosition'] === 'topSegment';
            Iif (this.parent.element.getElementsByClassName('e-lastrow-border').length > 0 && element && (islastRowIndex || canremove)) {
                this.parent.element.getElementsByClassName('e-lastrow-border')[0].remove();
            }
        };
        TaskbarEdit.prototype.removetopOrBottomBorder = function () {
            var border = [].slice.call(this.parent.element.querySelectorAll('.e-dropbottom, .e-droptop'));
            Iif (border.length) {
                this.addRemoveClasses(border, false, 'e-dropbottom');
                this.addRemoveClasses(border, false, 'e-droptop');
            }
        };
        TaskbarEdit.prototype.topOrBottomBorder = function (target) {
            var rowElement;
            Iif (this.parent.enableVirtualization) {
                var gridElement = this.parent.treeGrid.getRows().filter(function (data) {
                    return data.getAttribute('data-rowindex') === target.getAttribute('data-rowindex');
                })[0];
                var index = this.parent.treeGrid.getRows().indexOf(gridElement);
                rowElement = this.parent.getRowByIndex(index).children;
            }
            else {
                rowElement = this.parent.getRowByIndex(parseInt(target.getAttribute('data-rowindex'), 10)).children;
            }
            Eif (rowElement) {
                Eif (this.parent.rowDragAndDropModule['dropPosition'] === 'above') {
                    this.addRemoveClasses(rowElement, true, 'e-droptop');
                    Iif (this.parent.element.getElementsByClassName('e-lastrow-dragborder').length > 0) {
                        this.parent.element.getElementsByClassName('e-lastrow-dragborder')[0].remove();
                    }
                }
                Iif (this.parent.rowDragAndDropModule['dropPosition'] === 'below') {
                    this.addRemoveClasses(rowElement, true, 'e-dropbottom');
                }
            }
        };
        TaskbarEdit.prototype.removeChildBorder = function () {
            var borderElem = [].slice.call(this.parent.element.querySelectorAll('.e-childborder'));
            Iif (borderElem.length > 0) {
                this.addRemoveClasses(borderElem, false, 'e-childborder');
            }
        };
        TaskbarEdit.prototype.addRemoveClasses = function (cells, add, className) {
            for (var i = 0, len = cells.length; i < len; i++) {
                Eif (add) {
                    cells[parseInt(i.toString(), 10)].classList.add(className);
                }
                else {
                    cells[parseInt(i.toString(), 10)].classList.remove(className);
                }
            }
        };
        TaskbarEdit.prototype.addErrorElem = function () {
            var dragelem = document.getElementsByClassName('e-clone-taskbar')[0];
            var errorelem = document.querySelectorAll('.e-errorelem').length;
            if (!errorelem) {
                var ele = document.createElement('div');
                ej2_base_1.classList(ele, ['e-errorcontainer'], []);
                ej2_base_1.classList(ele, ['e-icons', 'e-errorelem'], []);
                if (this.taskBarEditRecord.ganttProperties.segments && this.taskBarEditRecord.ganttProperties.segments.length > 0) {
                    ele.style.paddingTop = this.parent.taskbarHeight + 'px';
                }
                dragelem.appendChild(ele);
            }
        };
        TaskbarEdit.prototype.removeErrorElem = function () {
            var errorelem = document.querySelector('.e-errorelem');
            Iif (errorelem) {
                errorelem.remove();
            }
        };
        TaskbarEdit.prototype.ensurePosition = function (draggedRecords, currentRecord) {
            var _this = this;
            draggedRecords.filter(function (draggedRecord) {
                Iif (draggedRecord.hasChildRecords && !ej2_base_1.isNullOrUndefined(draggedRecord.childRecords)) {
                    var valid = draggedRecord.childRecords.indexOf(currentRecord);
                    if (valid === -1) {
                        _this.ensurePosition(draggedRecord.childRecords, currentRecord);
                    }
                    else {
                        _this.parent.rowDragAndDropModule['dropPosition'] = 'Invalid';
                        _this.addErrorElem();
                        return;
                    }
                }
            });
        };
        TaskbarEdit.prototype.mouseMoveAction = function (event) {
            var _this = this;
            Iif (this.parent.isAdaptive) {
                if (!this.canDrag) {
                    return;
                }
                else {
                    this.multipleSelectionEnabled();
                }
            }
            var containerPosition = this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer);
            var e = this.getCoordinate(event);
            if (this.parent.enableRtl) {
                this.mouseMoveX = Math.abs(e.pageX - (containerPosition.left +
                    Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left)));
            }
            else {
                this.mouseMoveX = e.pageX - containerPosition.left +
                    this.parent.ganttChartModule.scrollObject.previousScroll.left;
            }
            this.mouseMoveY = e.pageY - containerPosition.top +
                this.parent.ganttChartModule.scrollObject.previousScroll.top;
            this.dragMouseLeave = false;
            var cancel = false;
            if (this.taskBarEditAction === 'ChildDrag' || this.taskBarEditAction === 'ParentDrag' || this.taskBarEditAction === 'ManualParentDrag' || this.taskBarEditAction === 'MilestoneDrag') {
                var ganttRowElement = void 0;
                if (this.parent.enableVirtualization) {
                    var index = this.parent.currentViewData.indexOf(this.taskBarEditRecord);
                    ganttRowElement = this.parent.getRowByIndex(index);
                }
                else {
                    ganttRowElement = this.parent.getRowByIndex(this.taskBarEditRecord.index);
                }
                var eventArgs = {
                    cancel: cancel,
                    cloneElement: this.taskbarElement,
                    data: this.taskBarEditRecord,
                    target: event.target,
                    rows: ganttRowElement
                };
                this.parent.trigger('rowDrag', eventArgs);
                cancel = eventArgs['cancel'];
            }
            Eif (!cancel) {
                this.isMouseDragCheck();
            }
            if (this.isMouseDragged && this.taskBarEditAction) {
                event.preventDefault();
                if (!ej2_base_1.isNullOrUndefined(this.taskbarElement) && !ej2_base_1.isNullOrUndefined(this.editElement) && (this.taskBarEditAction !== 'ConnectorPointRightDrag' &&
                    this.taskBarEditAction !== 'ConnectorPointLeftDrag') && !(this.parent.viewType === 'ResourceView' && this.currentData.hasChildRecords)) {
                    var currentElement = this.editElement.parentElement;
                    if (this.parent.enableTimelineVirtualization &&
                        this.parent.timelineModule.wholeTimelineWidth > this.parent.element.offsetWidth * 3) {
                        currentElement.style.setProperty('position', 'relative');
                    }
                    else {
                        currentElement.style.setProperty('position', 'absolute');
                    }
                    if ((this.taskBarEditAction === 'ChildDrag' || this.taskBarEditAction === 'LeftResizing') &&
                        !ej2_base_1.isNullOrUndefined(this.currentIndex) && !ej2_base_1.isNullOrUndefined(this.currentIndex) ? Number(this.currentIndex) === 0 : false) {
                        this.taskbarElement.childNodes[0].childNodes[0].style.setProperty('top', currentElement.parentElement.offsetTop + 'px');
                        if (this.parent.allowTaskbarDragAndDrop && this.taskBarEditAction !== 'LeftResizing' && this.taskBarEditAction !== 'RightResizing' && this.taskBarEditAction !== 'ProgressResizing') {
                            this.parent.chartPane.getElementsByClassName('e-gantt-chart')[0].appendChild(this.taskbarElement);
                        }
                        else {
                            currentElement.parentElement.appendChild(this.taskbarElement);
                        }
                    }
                    else {
                        if (this.parent.allowTaskbarDragAndDrop && this.taskBarEditAction !== 'LeftResizing' && this.taskBarEditAction !== 'RightResizing' && this.taskBarEditAction !== 'ProgressResizing') {
                            this.parent.chartPane.getElementsByClassName('e-gantt-chart')[0].appendChild(this.taskbarElement);
                        }
                        else {
                            currentElement.appendChild(this.taskbarElement);
                        }
                    }
                    if (this.taskBarEditAction !== 'ProgressResizing') {
                        if (this.parent.enableTimelineVirtualization &&
                            this.parent.timelineModule.wholeTimelineWidth > this.parent.element.offsetWidth * 3) {
                            var rootElement = this.parent.ganttChartModule.chartBodyContainer.querySelectorAll('.e-chart-scroll-container');
                            rootElement[0].appendChild(this.taskbarResizer);
                        }
                        else {
                            var rootElement = this.parent.ganttChartModule.chartBodyContainer.querySelectorAll('.e-chart-rows-container');
                            rootElement[0].appendChild(this.taskbarResizer);
                        }
                    }
                }
                if (this.parent.allowTaskbarDragAndDrop && (this.taskBarEditAction === 'ChildDrag' || this.taskBarEditAction === 'ParentDrag' ||
                    this.taskBarEditAction === 'MilestoneDrag' || this.taskBarEditAction === 'ManualParentDrag')) {
                    var taskbarPosition = this.parent.getOffsetRect(this.taskBarEditElement);
                    var left = (!ej2_base_1.isNullOrUndefined(document.body.className) && document.body.className.includes('e-bigger')) ? 12 : 0;
                    var pointerLeft = (3 + this.parent.chartRowsModule.connectorPointWidth + left);
                    var xValue = void 0;
                    Iif (this.parent.enableRtl) {
                        xValue = Math.abs(taskbarPosition.left + pointerLeft + 1);
                    }
                    else {
                        xValue = Math.abs(taskbarPosition.left - pointerLeft - 1);
                    }
                    if (!this.isClonedElement && !this.parent.enableRtl) {
                        xValue = xValue - this.parent.ganttChartModule.scrollElement.scrollLeft;
                        this.isClonedElement = true;
                    }
                    var rowPositionHeight = 0;
                    this.parent.rowDragAndDropModule['dropPosition'] = undefined;
                    var target = void 0;
                    var yValue = void 0;
                    Iif (event.type === 'touchmove' || event.type === 'touchstart' || event.type === 'touchend') {
                        yValue = event['changedTouches'][0].pageY;
                    }
                    else {
                        yValue = event.y;
                    }
                    Iif (this.parent.enableRtl) {
                        target = document.elementFromPoint(this.parent.ganttChartModule.chartBodyContainer.offsetWidth, yValue);
                        if (target.classList.contains('e-taskbar-resize-div')) {
                            target = document.elementFromPoint(this.parent.ganttChartModule.chartBodyContainer.offsetWidth - target['offsetWidth'], yValue);
                        }
                    }
                    else {
                        target = document.elementFromPoint(xValue, yValue);
                    }
                    var draggedTreeGridRowElement = void 0;
                    Iif (this.parent.enableVirtualization) {
                        if (!this.draggedTreeGridRowElement) {
                            var currentElement = this.editElement.parentElement;
                            draggedTreeGridRowElement = currentElement.parentElement;
                            this.draggedTreeGridRowElement = draggedTreeGridRowElement;
                            this.draggedTreeGridRowHeight = this.draggedTreeGridRowElement.offsetHeight;
                        }
                    }
                    else {
                        draggedTreeGridRowElement = this.parent.treeGrid.getRows()[this.parent.flatData.indexOf(this.taskBarEditRecord)];
                        this.draggedTreeGridRowElement = draggedTreeGridRowElement;
                        if (this.parent.enableMultiTaskbar) {
                            Eif (this.taskBarEditRecord.parentItem &&
                                !ej2_base_1.isNullOrUndefined(this.parent.getRowByID(this.taskBarEditRecord.parentItem.taskId))) {
                                this.draggedTreeGridRowHeight = this.parent.getRowByID(this.taskBarEditRecord.parentItem.taskId).offsetHeight;
                                Iif (this.parent.viewType === 'ProjectView' && this.draggedTreeGridRowHeight === 0) {
                                    var nestedParent = this.parent.getRecordByID(this.taskBarEditRecord.parentItem.taskId);
                                    while (nestedParent.parentItem) {
                                        nestedParent = this.parent.getRecordByID(nestedParent.parentItem.taskId);
                                        this.draggedTreeGridRowHeight = this.parent.getRowByID(nestedParent['TaskID']).offsetHeight;
                                    }
                                }
                            }
                            else {
                                var currentElement = this.editElement.parentElement;
                                this.draggedTreeGridRowElement = currentElement.parentElement;
                                this.draggedTreeGridRowHeight = this.draggedTreeGridRowElement.offsetHeight;
                            }
                        }
                        else {
                            this.draggedTreeGridRowHeight = this.draggedTreeGridRowElement.offsetHeight;
                        }
                    }
                    var chartRowElement_1;
                    if (target) {
                        chartRowElement_1 = ej2_base_1.closest(target, 'tr.' + cls.chartRow);
                    }
                    if (chartRowElement_1) {
                        var droppedTreeGridRowElement = void 0;
                        Iif (this.parent.enableVirtualization) {
                            droppedTreeGridRowElement = this.parent.treeGrid.getRows().filter(function (data) {
                                return data.getAttribute('data-rowindex') === chartRowElement_1.getAttribute('data-rowindex');
                            })[0];
                        }
                        else {
                            droppedTreeGridRowElement = this.parent.treeGrid.getRows()[parseInt(chartRowElement_1.getAttribute('data-rowindex'), 10)];
                        }
                        this.removeFirstBorder(droppedTreeGridRowElement);
                        this.removeLastBorder(droppedTreeGridRowElement);
                        Iif (!ej2_base_1.isNullOrUndefined(droppedTreeGridRowElement) && droppedTreeGridRowElement.getAttribute('data-uid') === this.draggedTreeGridRowElement.getAttribute('data-uid')
                            || !utils_1.parentsUntil(target, 'e-chart-rows-container')) {
                            this.parent.rowDragAndDropModule['dropPosition'] = 'Invalid';
                            this.addErrorElem();
                        }
                        var tObj = this.parent;
                        var rowTop = 0;
                        var toolHeight = tObj.toolbarModule ?
                            this.parent.toolbarModule.element.offsetHeight : 0;
                        var positionOffSet = this.parent.getOffsetRect(tObj.element);
                        var contentHeight = tObj.treeGrid.getHeaderContent().offsetHeight + positionOffSet.top + toolHeight;
                        var scrollTop = tObj.treeGrid.getContent().firstElementChild.scrollTop;
                        Eif (!ej2_base_1.isNullOrUndefined(droppedTreeGridRowElement)) {
                            rowPositionHeight = droppedTreeGridRowElement.offsetTop - scrollTop;
                        }
                        Iif (this.parent.enableVirtualization) {
                            rowTop = this.parent.getOffsetRect(droppedTreeGridRowElement).top;
                        }
                        else {
                            rowTop = rowPositionHeight + contentHeight;
                        }
                        var rowBottom = rowTop + this.draggedTreeGridRowHeight;
                        var difference = rowBottom - rowTop;
                        var divide = difference / 3;
                        var topRowSegment = rowTop + divide;
                        var middleRowSegment = topRowSegment + divide;
                        var bottomRowSegment = middleRowSegment + divide;
                        var posy = (event.type === 'mousemove') ? event.pageY : ((!ej2_base_1.isNullOrUndefined(event['changedTouches'])) ? event['changedTouches'][0].pageY : null);
                        var isTopSegment = posy <= topRowSegment;
                        var isMiddleRowSegment = (posy > topRowSegment && posy <= middleRowSegment);
                        var isBottomRowSegment = (posy > middleRowSegment && posy <= bottomRowSegment);
                        Eif (isTopSegment || isMiddleRowSegment || isBottomRowSegment) {
                            var rowElement = void 0;
                            Iif (this.parent.enableVirtualization) {
                                var index = this.parent.treeGrid.getRows().indexOf(droppedTreeGridRowElement);
                                rowElement = this.parent.getRowByIndex(index);
                            }
                            else {
                                rowElement = this.parent.getRowByIndex(parseInt(droppedTreeGridRowElement.getAttribute('data-rowindex'), 10));
                            }
                            var rowIndex = ej2_base_1.getValue('rowIndex', rowElement);
                            var droppedTreeGridRecord = this.parent.flatData[rowIndex];
                            var isValid = true;
                            Iif (this.parent.viewType === 'ResourceView' && !this.taskBarEditRecord.hasChildRecords && !droppedTreeGridRecord.hasChildRecords &&
                                !ej2_base_1.isNullOrUndefined(droppedTreeGridRecord.parentItem) &&
                                this.taskBarEditRecord.parentItem.taskId === droppedTreeGridRecord.parentItem.taskId) {
                                isValid = false;
                            }
                            Eif (droppedTreeGridRecord) {
                                this.ensurePosition([this.taskBarEditRecord], droppedTreeGridRecord);
                            }
                            Eif (isValid) {
                                Eif (isTopSegment && this.parent.rowDragAndDropModule['dropPosition'] !== 'Invalid') {
                                    this.parent.rowDragAndDropModule['dropPosition'] = 'above';
                                    this.removeChildBorder();
                                    this.removeErrorElem();
                                    this.removetopOrBottomBorder();
                                    this.topOrBottomBorder(rowElement);
                                }
                                Iif (isMiddleRowSegment && this.parent.rowDragAndDropModule['dropPosition'] !== 'Invalid') {
                                    this.parent.rowDragAndDropModule['dropPosition'] = 'child';
                                    this.removetopOrBottomBorder();
                                    this.addRemoveClasses(rowElement.children, true, 'e-childborder');
                                }
                                Iif (isBottomRowSegment && this.parent.rowDragAndDropModule['dropPosition'] !== 'Invalid') {
                                    this.parent.rowDragAndDropModule['dropPosition'] = 'below';
                                    this.removetopOrBottomBorder();
                                    this.removeErrorElem();
                                    this.removeChildBorder();
                                    this.removeFirstBorder(droppedTreeGridRowElement);
                                    this.topOrBottomBorder(droppedTreeGridRowElement);
                                }
                            }
                        }
                    }
                }
                var args_1 = {
                    cancel: false,
                    requestType: 'taskbarediting',
                    taskBarEditAction: this.taskBarEditAction,
                    data: this.taskBarEditRecord
                };
                if (this.segmentIndex !== -1) {
                    args_1.requestType = 'mergeSegment';
                }
                this.parent.trigger('actionBegin', args_1, function (arg) {
                    Eif (args_1.taskBarEditAction === 'ConnectorPointRightDrag' || args_1.taskBarEditAction === 'ConnectorPointLeftDrag'
                        || args_1.taskBarEditAction === 'LeftResizing' || args_1.taskBarEditAction === 'RightResizing'
                        || args_1.taskBarEditAction === 'ProgressResizing' || args_1.taskBarEditAction === 'ChildDrag' || args_1.taskBarEditAction === 'ParentDrag' ||
                        args_1.taskBarEditAction === 'MilestoneDrag' || args_1.taskBarEditAction === 'ManualParentDrag' || args_1.taskBarEditAction === 'ParentResizing') {
                        _this.parent.showIndicator = false;
                        if (_this.parent.undoRedoModule && _this.parent['isUndoRedoItemPresent']('Edit')) {
                            Iif (_this.parent.undoRedoModule['redoEnabled']) {
                                _this.parent.undoRedoModule['disableRedo']();
                            }
                            var action = {};
                            if (_this.parent.undoRedoModule['getUndoCollection'].length === 0) {
                                _this.isDragged = true;
                                action['modifiedRecords'] = [];
                                action['action'] = args_1.taskBarEditAction;
                                _this.parent.undoRedoModule['createUndoCollection']();
                                _this.parent.undoRedoModule['getUndoCollection'][_this.parent.undoRedoModule['getUndoCollection'].length - 1] = action;
                                _this.parent.editModule['createArray'] = false;
                                _this.parent.undoRedoModule['changedRecords'] = [];
                            }
                            else Eif (_this.parent.editModule['createArray']) {
                                _this.isDragged = true;
                                action['modifiedRecords'] = [];
                                action['action'] = args_1.taskBarEditAction;
                                _this.parent.undoRedoModule['createUndoCollection']();
                                _this.parent.undoRedoModule['getUndoCollection'][_this.parent.undoRedoModule['getUndoCollection'].length - 1] = action;
                                _this.parent.editModule['createArray'] = false;
                                _this.parent.undoRedoModule['changedRecords'] = [];
                            }
                        }
                    }
                    Iif (!ej2_base_1.isNullOrUndefined(_this.parent.loadingIndicator) && _this.parent.loadingIndicator.indicatorType === 'Shimmer' && _this.parent.showIndicator) {
                        _this.parent.showMaskRow();
                    }
                    else Iif (_this.parent.showIndicator) {
                        _this.parent.showSpinner();
                    }
                    if (arg.cancel === false) {
                        _this.taskBarEditingAction(event, false);
                    }
                });
            }
            else if (!this.parent.isAdaptive && !this.taskBarEditAction) {
                this.updateTaskBarEditElement(event);
            }
        };
        TaskbarEdit.prototype.taskBarEditingAction = function (e, isMouseClick) {
            var _this = this;
            var args = {};
            var recordIndex = this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement);
            Eif (this.taskBarEditRecord !== null) {
                args.editingFields = this.taskBarEditRecord.ganttProperties;
                args.data = this.taskBarEditRecord;
                if (this.parent.viewType === 'ResourceView' && args.data.level === 0) {
                    return;
                }
                args.recordIndex = recordIndex;
                args.taskBarEditAction = this.taskBarEditAction;
                args.roundOffDuration = this.roundOffDuration;
                args.cancel = false;
                args.previousData = this.previousItem;
                args.segmentIndex = this.segmentIndex;
                this.roundOffDuration = args.roundOffDuration;
                this.targetElement = args.target = ej2_base_1.closest(e.target, '.e-gantt-child-taskbar');
                this.updateMouseMoveProperties(e);
                if (!this.oldData) {
                    this.oldData = ej2_base_1.extend([], [], [this.taskBarEditRecord], true)[0];
                }
                var segmentIndex = this.segmentIndex !== -1 ? this.segmentIndex : null;
                if (this.taskBarEditAction === 'ProgressResizing') {
                    this.mainElement = utils_1.parentsUntil(this.taskBarEditElement, cls.taskBarMainContainer);
                    Iif (this.taskBarEditRecord.ganttProperties.segments && this.taskBarEditRecord.ganttProperties.segments.length > 0) {
                        segmentIndex = -1;
                        for (var i = 0; i < this.taskBarEditRecord.ganttProperties.segments.length; i++) {
                            var resizeGripper = document.getElementsByClassName('e-child-progress-resizer e-progress-resize-gripper')[0]['style'];
                            var currentWidth = (this.parent.enableRtl ? parseInt(resizeGripper['right'], 10) - 8 : parseInt(resizeGripper['left'], 10) + 8);
                            if (currentWidth < this.taskBarEditRecord.ganttProperties.segments[i].width && i === 0) {
                                segmentIndex = i;
                            }
                            if (this.taskBarEditRecord.ganttProperties.segments[i + 1] &&
                                currentWidth < this.taskBarEditRecord.ganttProperties.segments[i + 1].width +
                                    this.taskBarEditRecord.ganttProperties.segments[i + 1].left && currentWidth >
                                this.taskBarEditRecord.ganttProperties.segments[i + 1].left) {
                                segmentIndex = i + 1;
                            }
                        }
                    }
                    this.performProgressResize(e, segmentIndex);
                }
                else if (this.taskBarEditAction === 'LeftResizing') {
                    this.enableLeftResizing(e);
                }
                else if (this.taskBarEditAction === 'RightResizing' || this.taskBarEditAction === 'ParentResizing') {
                    this.enableRightResizing(e);
                }
                else if (this.taskBarEditAction === 'ParentDrag' || this.taskBarEditAction === 'ChildDrag' ||
                    this.taskBarEditAction === 'MilestoneDrag' || this.taskBarEditAction === 'ManualParentDrag') {
                    this.enableDragging(e);
                }
                else Eif (this.taskBarEditAction === 'ConnectorPointLeftDrag' ||
                    this.taskBarEditAction === 'ConnectorPointRightDrag') {
                    this.updateConnectorLineSecondProperties(e);
                    this.triggerDependencyEvent(e);
                    this.drawFalseLine();
                }
                if (this.parent.allowTaskbarDragAndDrop && this.taskBarEditAction !== 'LeftResizing' && this.taskBarEditAction !== 'RightResizing' && this.taskBarEditAction !== 'ProgressResizing') {
                    var parentClientRect = this.parent.getOffsetRect(this.parent.chartPane);
                    var coordinates = this.getCoordinate(e);
                    var position = { top: coordinates.pageY, left: coordinates.pageX };
                    var pos = { left: Math.abs(position.left - parentClientRect.left), top: position.top - parentClientRect.top };
                    if (this.parent.viewType === 'ResourceView' && this.parent.enableMultiTaskbar) {
                        var parentRecord = this.parent.getRecordByID(this.taskBarEditRecord.parentItem.taskId);
                        if (!this.parent.allowTaskbarOverlap && this.taskBarEditRecord.parentItem && !parentRecord.expanded) {
                            var reduceHeight = 0;
                            Iif (parseInt(this.editElement['style'].marginTop, 10) > this.parent.rowHeight) {
                                for (var i = 0; i < parentRecord.childRecords.length; i++) {
                                    if (parentRecord.childRecords[i].ganttProperties.taskId !==
                                        this.taskBarEditRecord.ganttProperties.taskId) {
                                        reduceHeight = reduceHeight + this.parent.rowHeight;
                                    }
                                    else {
                                        break;
                                    }
                                }
                                pos.top = pos.top - reduceHeight;
                            }
                        }
                    }
                    this.topValue = pos.top;
                    var xValue = void 0;
                    Iif (e.type === 'touchmove' || e.type === 'touchstart' || e.type === 'touchend') {
                        xValue = e['changedTouches'][0].pageX;
                    }
                    else {
                        xValue = e.pageX;
                    }
                    Iif (this.parent.enableRtl) {
                        this.leftValue = pos.left - Math.abs(xValue - (this.parent.getOffsetRect(this.taskBarEditElement).left)) -
                            (this.previousLeftValue !== 0 ? xValue - this.previousLeftValue : 0);
                    }
                    else {
                        this.leftValue = pos.left - (xValue - this.parent.getOffsetRect(this.taskBarEditElement).left) +
                            (this.previousLeftValue !== 0 ? xValue - this.previousLeftValue : 0);
                    }
                    Eif (this.previousLeftValue === 0) {
                        Eif (!this.parent.enableRtl) {
                            this.leftValue = this.leftValue - this.parent.ganttChartModule.scrollObject.previousScroll.left;
                        }
                        else {
                            this.leftValue = this.leftValue - (this.parent.ganttChartModule.scrollObject.previousScroll.left);
                            if (this.parent.ganttChartModule.scrollObject.previousScroll.left === 0) {
                                this.leftValue = this.leftValue - 60;
                            }
                        }
                    }
                    this.previousLeftValue = xValue;
                }
                else {
                    this.leftValue = this.taskBarEditRecord.ganttProperties.left;
                }
                this.currentSegmentIndex = segmentIndex;
                this.setItemPosition();
                this.updateEditedItem();
                this.tooltipValue = (e.type === 'touchmove' || e.type === 'touchstart' || e.type === 'touchend') ? e['changedTouches'][0].pageX : e.pageX;
                Eif (!this.taskBarEditRecord.ganttProperties.segments || segmentIndex !== -1) {
                    this.editTooltip.updateTooltip(segmentIndex);
                }
                Iif (isMouseClick) {
                    this.taskBarEditedAction(e);
                }
                this.parent.trigger('taskbarEditing', args, function (arg) {
                    if (arg.cancel && _this.taskBarEditRecord !== null) {
                        _this.tapPointOnFocus = false;
                        ej2_base_1.merge(_this.taskBarEditRecord.ganttProperties, arg.previousData);
                    }
                });
            }
        };
        TaskbarEdit.prototype.updateMouseMoveProperties = function (event) {
            var containerPosition = this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer);
            var e = this.getCoordinate(event);
            var parentWithZoomStyle = this.parent.element.closest('[style*="zoom"]');
            Iif (parentWithZoomStyle) {
                var zoom1 = parseFloat(getComputedStyle(parentWithZoomStyle).zoom);
                e.pageX = e.pageX / zoom1;
                e.pageY = e.pageY / zoom1;
            }
            Eif (e.pageX || e.pageY) {
                if (this.parent.enableRtl) {
                    this.mouseMoveX = Math.abs(e.pageX - (containerPosition.left +
                        Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left)));
                }
                else {
                    this.mouseMoveX = e.pageX - containerPosition.left +
                        this.parent.ganttChartModule.scrollObject.previousScroll.left;
                }
                this.tooltipPositionX = this.mouseMoveX;
                this.mouseMoveY = e.pageY - containerPosition.top +
                    this.parent.ganttChartModule.scrollObject.previousScroll.top;
            }
            var isConnectorLineEdit = (this.taskBarEditAction === 'ConnectorPointLeftDrag' ||
                this.taskBarEditAction === 'ConnectorPointRightDrag') ?
                true : false;
            if (((this.taskBarEditRecord.ganttProperties.width > 3 || this.taskBarEditRecord.ganttProperties.isMilestone) && !(this.taskBarEditAction === 'ProgressResizing' &&
                (this.taskBarEditRecord.ganttProperties.progress === 0 || this.taskBarEditRecord.ganttProperties.progress === 100))) ||
                isConnectorLineEdit) {
                var mouseX = 0;
                if (this.parent.enableRtl) {
                    mouseX = Math.abs(Math.abs(this.mouseMoveX) - Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left) +
                        containerPosition.left);
                }
                else {
                    mouseX = this.mouseMoveX - this.parent.ganttChartModule.scrollObject.previousScroll.left +
                        containerPosition.left;
                }
                var mouseY = this.mouseMoveY - this.parent.ganttChartModule.scrollObject.previousScroll.top +
                    containerPosition.top;
                if ((mouseX + 20) >
                    containerPosition.left + this.parent.ganttChartModule.chartBodyContainer.offsetWidth) {
                    this.timerCount = this.parent.ganttChartModule.scrollObject.previousScroll.left;
                    this.startScrollTimer('right');
                }
                else Iif ((mouseX + 40) >
                    containerPosition.left + this.parent.ganttChartModule.chartBodyContainer.offsetWidth && this.parent.enableRtl &&
                    this.parent.ganttChartModule.scrollObject.previousScroll.left === 0) {
                    this.parent.ganttChartModule.scrollObject.previousScroll.left = -1;
                    this.timerCount = this.parent.ganttChartModule.scrollObject.previousScroll.left;
                    this.startScrollTimer('right');
                }
                else if ((mouseX - 20) < containerPosition.left) {
                    this.timerCount = this.parent.ganttChartModule.scrollObject.previousScroll.left;
                    this.startScrollTimer('left');
                }
                else Iif (((mouseY + 80) >
                    containerPosition.top + this.parent.ganttChartModule.chartBodyContainer.offsetHeight)) {
                    this.timerCount = this.parent.ganttChartModule.scrollObject.previousScroll.top;
                    this.startScrollTimer('bottom');
                }
                else Eif (((mouseY - 20) < containerPosition.top)) {
                    this.timerCount = this.parent.ganttChartModule.scrollObject.previousScroll.top;
                    this.startScrollTimer('top');
                }
                else {
                    this.stopScrollTimer();
                }
            }
            else {
                this.stopScrollTimer();
            }
        };
        TaskbarEdit.prototype.startScrollTimer = function (direction) {
            var _this = this;
            this.stopScrollTimer();
            var leftSign = 0;
            this.scrollTimer = window.setInterval(function () {
                if (Math.sign(_this.timerCount) === -1) {
                    leftSign = -1;
                    _this.timerCount = Math.abs(_this.timerCount);
                }
                if (direction === 'right') {
                    var timelineWidth = _this.parent.enableTimelineVirtualization ?
                        _this.parent.timelineModule.wholeTimelineWidth : _this.parent.timelineModule.totalTimelineWidth;
                    _this.timerCount = (_this.timerCount + 1) >= timelineWidth ?
                        timelineWidth : (_this.timerCount + 1);
                }
                else if (direction === 'bottom') {
                    _this.timerCount = _this.timerCount + 1;
                }
                else {
                    _this.timerCount = (_this.timerCount - 1) < 0 ? 0 : (_this.timerCount - 1);
                }
                if (direction === 'bottom' || direction === 'top') {
                    _this.parent.ganttChartModule.scrollObject.setScrollTop(_this.timerCount);
                }
                else {
                    _this.parent.ganttChartModule.scrollObject.setScrollLeft(_this.timerCount, leftSign);
                }
                if (_this.taskBarEditAction === 'ConnectorPointLeftDrag'
                    || _this.taskBarEditAction === 'ConnectorPointRightDrag') {
                    _this.drawFalseLine();
                }
            }, 0);
        };
        TaskbarEdit.prototype.stopScrollTimer = function () {
            window.clearInterval(this.scrollTimer);
            this.scrollTimer = null;
        };
        TaskbarEdit.prototype.enableDragging = function (e) {
            var item = this.taskBarEditRecord.ganttProperties;
            var timelineWidth = this.parent.enableTimelineVirtualization ?
                this.parent.timelineModule.wholeTimelineWidth : this.parent.timelineModule.totalTimelineWidth;
            var differenceWidth = 0;
            if (this.taskBarEditElement.classList.contains('e-segmented-taskbar') &&
                !this.taskBarEditElement.classList.contains('e-segment-first')) {
                var segments = this.taskBarEditRecord.ganttProperties.segments.map(function (e) { return (__assign({}, e)); });
                var segment = segments[this.segmentIndex];
                if (this.mouseDownX > this.mouseMoveX) {
                    differenceWidth = ej2_base_1.isNullOrUndefined(this.previousMouseMove) ?
                        (this.mouseDownX - this.mouseMoveX) : (this.previousMouseMove - this.mouseMoveX);
                    this.previousMouseMove = this.mouseMoveX;
                    segment.left = segment.left - differenceWidth;
                }
                else {
                    differenceWidth = ej2_base_1.isNullOrUndefined(this.previousMouseMove) ?
                        (this.mouseMoveX - this.mouseDownX) : (this.mouseMoveX - this.previousMouseMove);
                    this.previousMouseMove = this.mouseMoveX;
                    segment.left = segment.left + differenceWidth;
                }
                var previousSegment = segments[this.segmentIndex - 1];
                var nextSegment = segments[this.segmentIndex + 1];
                var left = void 0;
                if (this.taskBarEditElement.classList.contains('e-segment-inprogress')) {
                    left = segment.left < (previousSegment.left + previousSegment.width) ? (previousSegment.left + previousSegment.width) :
                        ((segment.width + segment.left) > (nextSegment.left)) ? nextSegment.left - segment.width : segment.left;
                }
                else {
                    left = segment.left < (previousSegment.left + previousSegment.width) ? (previousSegment.left + previousSegment.width) :
                        (item.left + segment.width + segment.left) >= timelineWidth ?
                            (timelineWidth - segment.width) : segment.left;
                }
                segment.left = left;
                this.parent.setRecordValue('segments', segments, item, true);
                this.parent.dataOperation.updateMappingData(this.taskBarEditRecord, 'segments');
            }
            else {
                if (this.mouseDownX > this.mouseMoveX) {
                    differenceWidth = this.mouseDownX - this.mouseMoveX;
                    Eif (differenceWidth > 0) {
                        this.parent.setRecordValue('left', this.previousItem.left - differenceWidth, item, true);
                    }
                }
                else {
                    differenceWidth = this.mouseMoveX - this.mouseDownX;
                    this.parent.setRecordValue('left', this.previousItem.left + differenceWidth, item, true);
                }
                var left = item.left < 0 ? 0 : (item.left + item.width) >= timelineWidth ?
                    (timelineWidth - item.width) : item.left;
                this.parent.setRecordValue('left', left, item, true);
            }
        };
        TaskbarEdit.prototype.validateProgressWidth = function (item, progressWidth, totalTaskWidth) {
            var reduceWidth = 0;
            if (this.currentSegmentIndex !== -1 && item.segments) {
                var startIndex = this.currentSegmentIndex >= this.segmentIndex ? 0 : this.currentSegmentIndex !== 0 ?
                    this.currentSegmentIndex : -1;
                var endIndex = this.currentSegmentIndex >= this.segmentIndex ? this.currentSegmentIndex : this.segmentIndex;
                Eif (startIndex !== -1) {
                    for (var i = startIndex; i < endIndex; i++) {
                        reduceWidth = (item.segments[i + 1].left) - (item.segments[i].left + item.segments[i].width);
                        progressWidth = progressWidth - reduceWidth;
                    }
                }
            }
            if (item.segments && item.segments.length > 0) {
                totalTaskWidth = this.splitTasksDuration(item.segments) * this.parent.perDayWidth;
            }
            return { progressWidth: progressWidth, totalTaskWidth: totalTaskWidth };
        };
        TaskbarEdit.prototype.performProgressResize = function (e, segmentIndex) {
            var item = this.taskBarEditRecord.ganttProperties;
            var diffrenceWidth = 0;
            var prevProgress = item.progressWidth;
            if (this.mouseDownX > this.mouseMoveX) {
                Iif (this.mouseMoveX > item.left &&
                    (this.mouseMoveX < (item.left + item.width)) && item.left > 0) {
                    diffrenceWidth = this.mouseMoveX - item.left;
                    this.parent.setRecordValue('progressWidth', diffrenceWidth, item, true);
                }
                else {
                    Iif (this.mouseMoveX >= (item.left + item.width)) {
                        this.parent.setRecordValue('progressWidth', item.width, item, true);
                    }
                    else {
                        this.parent.setRecordValue('progressWidth', 0, item, true);
                    }
                }
            }
            else {
                Iif (this.mouseMoveX > item.left &&
                    (this.mouseMoveX < (item.left + item.width))) {
                    diffrenceWidth = this.mouseMoveX - item.left;
                    this.parent.setRecordValue('progressWidth', diffrenceWidth, item, true);
                }
                else {
                    Eif (this.mouseMoveX <= item.left) {
                        this.parent.setRecordValue('progressWidth', 0, item, true);
                    }
                    else {
                        this.parent.setRecordValue('progressWidth', item.width, item, true);
                    }
                }
            }
            var widthValue = item.progressWidth > item.width ?
                item.width : item.progressWidth;
            widthValue = item.progressWidth < 0 ? 0 : item.progressWidth;
            Eif (segmentIndex !== -1 || !segmentIndex) {
                this.parent.setRecordValue('progressWidth', widthValue, item, true);
            }
            else {
                this.parent.setRecordValue('progressWidth', prevProgress, item, true);
            }
            this.progressValue = widthValue;
            var diff = item.width - item.progressWidth;
            Iif (diff <= 4) {
                this.progressBorderRadius = 4 - diff;
            }
            else {
                this.progressBorderRadius = 0;
            }
        };
        TaskbarEdit.prototype.enableLeftResizing = function (e) {
            var item = this.taskBarEditRecord.ganttProperties;
            var differenceWidth = 0;
            if (this.taskBarEditElement.classList.contains('e-segmented-taskbar') && item.segments.length > 1) {
                this.enableSplitTaskLeftResize(item);
            }
            else {
                if (this.mouseDownX > this.mouseMoveX) {
                    if (this.mouseMoveX < (item.left + item.width)) {
                        differenceWidth = this.mouseDownX - this.mouseMoveX;
                        Eif (item.left > 0) {
                            this.parent.setRecordValue('left', this.previousItem.left - differenceWidth, item, true);
                            this.parent.setRecordValue('width', this.previousItem.width + differenceWidth, item, true);
                        }
                    }
                    else {
                        Eif (this.mouseMoveX > (item.left + item.width)) {
                            differenceWidth = this.mouseDownX - this.mouseMoveX;
                            this.parent.setRecordValue('left', this.previousItem.left - differenceWidth, item, true);
                            this.parent.setRecordValue('width', 3, item, true);
                        }
                    }
                }
                else {
                    if (this.mouseMoveX < (item.left + item.width)) {
                        differenceWidth = this.mouseMoveX - this.mouseDownX;
                        Iif ((item.left) < (item.left + item.width) &&
                            ((this.previousItem.left + differenceWidth) <= (this.previousItem.left + this.previousItem.width))) {
                            this.parent.setRecordValue('left', this.previousItem.left + differenceWidth, item, true);
                            this.parent.setRecordValue('width', this.previousItem.width - differenceWidth, item, true);
                        }
                    }
                    else {
                        differenceWidth = this.mouseMoveX - this.mouseDownX;
                        this.parent.setRecordValue('left', this.previousItem.left + differenceWidth, item, true);
                        this.parent.setRecordValue('width', 3, item, true);
                    }
                }
                Iif (item.segments && item.segments.length === 1) {
                    item.segments[0].width = item.width;
                }
                this.updateEditPosition(e, item);
                this.parent.setRecordValue('left', (this.previousItem.left + this.previousItem.width - item.width), item, true);
            }
        };
        TaskbarEdit.prototype.enableSplitTaskLeftResize = function (item) {
            var segments = this.taskBarEditRecord.ganttProperties.segments.map(function (e) { return (__assign({}, e)); });
            var segment = segments[this.segmentIndex];
            var differenceWidth = 0;
            if (this.mouseDownX > this.mouseMoveX) {
                if (this.mouseMoveX < (item.left + segment.width + segment.left)) {
                    differenceWidth = ej2_base_1.isNullOrUndefined(this.previousMouseMove) ?
                        (this.mouseDownX - this.mouseMoveX) : (this.previousMouseMove - this.mouseMoveX);
                    this.previousMouseMove = this.mouseMoveX;
                    if (segment.left > 0) {
                        segment.left = segment.left - differenceWidth;
                        segment.width = segment.width + differenceWidth;
                        Eif (this.segmentIndex !== 0) {
                            var previousSegment = segments[this.segmentIndex - 1];
                            if ((item.left + segment.left) < (item.left + previousSegment.left + previousSegment.width)) {
                                var difference = (item.left + previousSegment.left + previousSegment.width) - (item.left + segment.left);
                                segment.width -= difference;
                                segment.left = segment.left + difference;
                            }
                        }
                    }
                    else Eif (segment.left <= 0 && this.segmentIndex === 0) {
                        this.parent.setRecordValue('left', item.left - differenceWidth, item, true);
                        this.parent.setRecordValue('width', item.width + differenceWidth, item, true);
                        segment.width = segment.width + differenceWidth;
                        for (var i = 1; i < item.segments.length; i++) {
                            var segment_1 = segments[i];
                            segment_1.left = segment_1.left + differenceWidth;
                        }
                    }
                }
                else {
                    Eif (this.mouseMoveX > (item.left + segment.width + segment.left)) {
                        differenceWidth = ej2_base_1.isNullOrUndefined(this.previousMouseMove) ?
                            (this.mouseDownX - this.mouseMoveX) : (this.previousMouseMove - this.mouseMoveX);
                        this.previousMouseMove = this.mouseMoveX;
                        segment.left = segment.left - differenceWidth;
                        segment.width = this.parent.perDayWidth;
                    }
                }
            }
            else {
                if (this.mouseMoveX < (item.left + segment.width + segment.left - this.parent.perDayWidth)) {
                    differenceWidth = ej2_base_1.isNullOrUndefined(this.previousMouseMove) ?
                        (this.mouseMoveX - this.mouseDownX) : (this.mouseMoveX - this.previousMouseMove);
                    this.previousMouseMove = this.mouseMoveX;
                    if (this.segmentIndex === 0 && segment.left <= 0) {
                        this.parent.setRecordValue('left', item.left + differenceWidth, item, true);
                        this.parent.setRecordValue('width', item.width - differenceWidth, item, true);
                        segment.width = segment.width - differenceWidth;
                        for (var i = 1; i < item.segments.length; i++) {
                            var segment_2 = segments[i];
                            segment_2.left = segment_2.left - differenceWidth;
                        }
                    }
                    else if ((segment.left) < (segment.left + segment.width) &&
                        ((segment.left + differenceWidth) <= (segment.left + segment.width))) {
                        segment.left = segment.left + differenceWidth;
                        segment.width = segment.width - differenceWidth;
                    }
                }
                else {
                    if (this.mouseMoveX < (item.left + segment.left + segment.width)) {
                        Eif (segment.width > this.parent.perDayWidth) {
                            differenceWidth = ej2_base_1.isNullOrUndefined(this.previousMouseMove) ?
                                (this.mouseMoveX - this.mouseDownX) : (this.mouseMoveX - this.previousMouseMove);
                            this.previousMouseMove = this.mouseMoveX;
                            var singleDayDifference = (segment.width - differenceWidth) < this.parent.perDayWidth ?
                                this.parent.perDayWidth > segment.width ?
                                    this.parent.perDayWidth - segment.width : segment.width - this.parent.perDayWidth : 0;
                            differenceWidth -= singleDayDifference;
                            Iif (this.segmentIndex === 0) {
                                this.parent.setRecordValue('width', item.width - differenceWidth, item, true);
                                this.parent.setRecordValue('left', item.left + differenceWidth, item, true);
                                segment.width = segment.width - differenceWidth;
                                for (var i = 1; i < item.segments.length; i++) {
                                    var segment_3 = segments[i];
                                    segment_3.left = segment_3.left - differenceWidth;
                                }
                            }
                            else {
                                segment.left = segment.left + differenceWidth;
                                segment.width = segment.width - differenceWidth;
                            }
                        }
                    }
                }
            }
            this.parent.setRecordValue('segments', segments, item, true);
            this.parent.dataOperation.updateMappingData(this.taskBarEditRecord, 'segments');
        };
        TaskbarEdit.prototype.updateEditPosition = function (e, item) {
            this.updateIsMilestone(item);
            this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth(item.width, item.progress), item, true);
        };
        TaskbarEdit.prototype.updateIsMilestone = function (item) {
            if (item.width <= 3) {
                this.parent.setRecordValue('width', 3, item, true);
                this.parent.setRecordValue('isMilestone', true, item, true);
                Iif (!ej2_base_1.isNullOrUndefined(this.taskBarEditRecord[this.parent.taskFields.milestone])) {
                    this.parent.setRecordValue(this.parent.taskFields.milestone, true, this.taskBarEditRecord, true);
                }
            }
            else {
                this.parent.setRecordValue('width', item.width, item, true);
                this.parent.setRecordValue('isMilestone', false, item, true);
                Iif (!ej2_base_1.isNullOrUndefined(this.taskBarEditRecord[this.parent.taskFields.milestone])) {
                    this.parent.setRecordValue(this.parent.taskFields.milestone, false, this.taskBarEditRecord, true);
                }
            }
        };
        TaskbarEdit.prototype.enableRightResizing = function (e) {
            var item = this.taskBarEditRecord.ganttProperties;
            var differenceWidth = 0;
            if (this.taskBarEditElement.classList.contains('e-segmented-taskbar') && item.segments.length > 1) {
                var segments = this.taskBarEditRecord.ganttProperties.segments.map(function (e) { return (__assign({}, e)); });
                var segment = segments[this.segmentIndex];
                if (this.mouseDownX > this.mouseMoveX) {
                    if (this.mouseMoveX > (item.left + segment.left) && (this.mouseDownX - this.mouseMoveX) > 3) {
                        differenceWidth = ej2_base_1.isNullOrUndefined(this.previousMouseMove) ?
                            (this.mouseDownX - this.mouseMoveX) : (this.previousMouseMove - this.mouseMoveX);
                        this.previousMouseMove = this.mouseMoveX;
                        segment.width = segment.width - differenceWidth;
                    }
                    else {
                        Eif (this.mouseMoveX < (item.left + segment.left)) {
                            var segmentWidth = (this.parent.timelineModule.isSingleTier &&
                                (this.parent.timelineModule.customTimelineSettings.bottomTier.unit === 'Hour' ||
                                    this.parent.timelineModule.customTimelineSettings.topTier.unit === 'Hour' ||
                                    this.parent.timelineModule.customTimelineSettings.bottomTier.unit === 'Minutes' ||
                                    this.parent.timelineModule.customTimelineSettings.topTier.unit === 'Minutes')) ||
                                (this.parent.timelineModule.customTimelineSettings.bottomTier.unit === 'Hour' ||
                                    this.parent.timelineModule.customTimelineSettings.bottomTier.unit === 'Minutes') ?
                                this.parent.timelineModule.customTimelineSettings.timelineUnitSize :
                                this.parent.perDayWidth;
                            segment.width = segmentWidth;
                        }
                    }
                }
                else {
                    Eif (this.mouseMoveX > segment.left) {
                        differenceWidth = ej2_base_1.isNullOrUndefined(this.previousMouseMove) ?
                            (this.mouseMoveX - this.mouseDownX) : (this.mouseMoveX - this.previousMouseMove);
                        this.previousMouseMove = this.mouseMoveX;
                        segment.width = segment.width + differenceWidth;
                    }
                }
                var width = void 0;
                var nextSegment = this.segmentIndex !== segments.length - 1 ? segments[this.segmentIndex + 1] : null;
                if (!ej2_base_1.isNullOrUndefined(nextSegment)) {
                    Eif (!this.taskBarEditElement.classList.contains('e-segment-last')) {
                        width = (segment.left + segment.width) > nextSegment.left ? (nextSegment.left - segment.left) : segment.width;
                    }
                    segment.width = width;
                }
                if (this.segmentIndex === item.segments.length - 1) {
                    Iif (this.segmentIndex === 0) {
                        this.parent.setRecordValue('width', segment.width, item, true);
                    }
                }
                this.parent.setRecordValue('segments', segments, item, true);
                this.parent.dataOperation.updateMappingData(this.taskBarEditRecord, 'segments');
            }
            else {
                if (this.mouseDownX > this.mouseMoveX) {
                    if (this.mouseMoveX > item.left && (this.mouseDownX - this.mouseMoveX) > 3) {
                        differenceWidth = this.mouseDownX - this.mouseMoveX;
                        this.parent.setRecordValue('width', this.previousItem.width - differenceWidth, item, true);
                    }
                    else {
                        Eif (this.mouseMoveX < item.left) {
                            this.parent.setRecordValue('width', 3, item, true);
                        }
                    }
                }
                else {
                    if (this.mouseMoveX > item.left) {
                        differenceWidth = this.mouseMoveX - this.mouseDownX;
                        this.parent.setRecordValue('width', this.previousItem.width + differenceWidth, item, true);
                    }
                }
                Iif (item.segments && item.segments.length === 1) {
                    item.segments[0].width = item.width;
                }
                this.updateEditPosition(e, item);
            }
        };
        TaskbarEdit.prototype.updateEditedItem = function () {
            var item = this.taskBarEditRecord.ganttProperties;
            var left;
            var projectStartDate;
            var endDate;
            var startDate;
            switch (this.taskBarEditAction) {
                case 'ProgressResizing':
                    {
                        var progressWidth = item.progressWidth;
                        var totalTaskWidth = item.width;
                        var updatedValues = this.validateProgressWidth(item, progressWidth, totalTaskWidth);
                        this.parent.setRecordValue('progress', this.getProgressPercent(updatedValues.totalTaskWidth, updatedValues.progressWidth), item, true);
                        break;
                    }
                case 'LeftResizing':
                    if (this.segmentIndex === -1) {
                        left = this.getRoundOffStartLeft(item, this.roundOffDuration);
                        projectStartDate = this.getDateByLeft(left);
                        Iif (ej2_base_1.isNullOrUndefined(item.endDate)) {
                            endDate = this.parent.dateValidationModule.getValidEndDate(item);
                            this.parent.setRecordValue('endDate', endDate, item, true);
                        }
                        startDate = this.parent.dateValidationModule.checkStartDate(projectStartDate, item, null);
                        this.parent.setRecordValue('startDate', new Date(startDate.getTime()), item, true);
                        Iif (this.parent.dateValidationModule.compareDates(item.startDate, item.endDate) === 0
                            && ej2_base_1.isNullOrUndefined(item.isMilestone) && item.isMilestone === false && item.duration === 0) {
                            this.parent.setRecordValue('duration', 1, item, true);
                        }
                        if (item.isMilestone) {
                            this.parent.setRecordValue('endDate', new Date(startDate.getTime()), item, true);
                        }
                        this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord);
                        this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord, 'duration');
                    }
                    else {
                        this.updateSplitLeftResize(item);
                    }
                    break;
                case 'RightResizing':
                case 'ParentResizing':
                    if (this.segmentIndex === -1) {
                        left = this.getRoundOffEndLeft(item, this.roundOffDuration);
                        var tempEndDate = this.getDateByLeft(left);
                        Iif (ej2_base_1.isNullOrUndefined(item.startDate)) {
                            startDate = this.parent.dateValidationModule.getValidStartDate(item);
                            this.parent.setRecordValue('startDate', startDate, item, true);
                        }
                        var tempdate = ej2_base_1.isNullOrUndefined(item.startDate) ? startDate : item.startDate;
                        endDate = item.isMilestone ? tempdate :
                            this.parent.dateValidationModule.checkEndDate(tempEndDate, this.taskBarEditRecord.ganttProperties);
                        this.parent.setRecordValue('endDate', new Date(endDate.getTime()), item, true);
                        this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord);
                        this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord, 'duration');
                    }
                    else {
                        this.updateSplitRightResizing(item);
                    }
                    break;
                case 'ParentDrag':
                case 'ChildDrag':
                case 'MilestoneDrag':
                case 'ManualParentDrag':
                    if (this.segmentIndex === -1 || this.segmentIndex === 0 || (this.segmentIndex !== -1 && this.parent.allowTaskbarDragAndDrop)) {
                        this.updateChildDrag(item);
                    }
                    else {
                        this.setSplitTaskDrag(item);
                    }
                    break;
            }
            if (!ej2_base_1.isNullOrUndefined(this.taskBarEditRecord.ganttProperties.segments)) {
                this.parent.chartRowsModule.updateSegment(this.taskBarEditRecord.ganttProperties.segments, this.taskBarEditRecord.ganttProperties.taskId);
            }
        };
        TaskbarEdit.prototype.updateChildDrag = function (item) {
            var left = this.getRoundOffStartLeft(item, this.roundOffDuration);
            var projectStartDate = this.getDateByLeft(left, item.isMilestone, item);
            var endDate;
            if (this.segmentIndex === 0) {
                this.parent.setRecordValue('startDate', this.parent.dateValidationModule.checkStartDate(projectStartDate, item, null), item, true);
                item.segments[0].startDate = projectStartDate;
                item.segments[0].endDate = this.parent.dataOperation.getEndDate(item.segments[0].startDate, item.segments[0].duration, item.durationUnit, item, false);
                this.parent.setRecordValue('segments', item.segments, item, true);
                this.parent.dataOperation.updateMappingData(this.taskBarEditRecord, 'segments');
                this.parent.chartRowsModule.incrementSegments(item.segments, 0, this.taskBarEditRecord);
                this.parent.setRecordValue('endDate', item.segments[item.segments.length - 1].endDate, item, true);
                this.parent.setRecordValue('taskData.' + this.parent.taskFields.segments, item.segments, this.taskBarEditRecord, true);
            }
            else {
                Iif (!ej2_base_1.isNullOrUndefined(item.endDate) && ej2_base_1.isNullOrUndefined(item.startDate)) {
                    endDate = this.parent.dateValidationModule.checkStartDate(projectStartDate, item, null);
                    endDate = this.parent.dateValidationModule.checkEndDate(endDate, this.taskBarEditRecord.ganttProperties);
                    this.parent.setRecordValue('endDate', endDate, item, true);
                }
                else {
                    this.parent.setRecordValue('startDate', this.parent.dateValidationModule.checkStartDate(projectStartDate, item, null), item, true);
                    Eif (!ej2_base_1.isNullOrUndefined(item.duration)) {
                        this.parent.dateValidationModule.calculateEndDate(this.taskBarEditRecord);
                    }
                }
            }
        };
        TaskbarEdit.prototype.updateSplitLeftResize = function (item) {
            var segment = item.segments[this.segmentIndex];
            var left = this.segmentIndex === 0 ? this.getRoundOffStartLeft(item, this.roundOffDuration) :
                this.getRoundOffStartLeft(segment, this.roundOffDuration);
            var projectStartDate = this.getDateByLeft(left);
            var startDate = this.parent.dataOperation.checkStartDate(projectStartDate, item, false);
            var duration = this.parent.dataOperation.getDuration(startDate, segment.endDate, item.durationUnit, item.isAutoSchedule, item.isMilestone);
            segment.startDate = new Date(startDate.getTime());
            segment.duration = duration;
            this.parent.setRecordValue('duration', this.sumOfDuration(item.segments), item, true);
            if (this.segmentIndex === 0) {
                this.parent.setRecordValue('startDate', segment.startDate, item, true);
            }
            this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord, 'duration');
            if (!ej2_base_1.isNullOrUndefined(item.segments[this.segmentIndex - 1])) {
                var segmentOffsetDuration = this.parent.dataOperation.getDuration(item.segments[this.segmentIndex - 1].endDate, item.segments[this.segmentIndex].startDate, item.durationUnit, item.isAutoSchedule, item.isMilestone);
                segment.offsetDuration = segmentOffsetDuration;
            }
            this.parent.setRecordValue('segments', item.segments, item, true);
            this.parent.dataOperation.updateMappingData(this.taskBarEditRecord, 'segments');
        };
        TaskbarEdit.prototype.updateSplitRightResizing = function (item) {
            var segment = item.segments[this.segmentIndex];
            var left = this.getRoundOffEndLeft(item, this.roundOffDuration);
            var tempEndDate = this.getDateByLeft(left);
            var endDate = this.parent.dataOperation.checkEndDate(tempEndDate, item, false);
            var duration = this.parent.dataOperation.getDuration(segment.startDate, endDate, item.durationUnit, item.isAutoSchedule, item.isMilestone);
            segment.endDate = new Date(endDate.getTime());
            segment.duration = duration;
            if (!ej2_base_1.isNullOrUndefined(item.segments[this.segmentIndex + 1])) {
                var nextSegment = item.segments[this.segmentIndex + 1];
                var segmentOffset = this.parent.dataOperation.getDuration(item.segments[this.segmentIndex].endDate, nextSegment.startDate, item.durationUnit, item.isAutoSchedule, item.isMilestone);
                segment.offsetDuration = segmentOffset;
            }
            this.parent.setRecordValue('segments', item.segments, item, true);
            this.parent.dataOperation.updateMappingData(this.taskBarEditRecord, 'segments');
            this.parent.setRecordValue('duration', this.sumOfDuration(item.segments), item, true);
            this.parent.setRecordValue('endDate', item.segments[item.segments.length - 1].endDate, item, true);
            this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord, 'duration');
        };
        TaskbarEdit.prototype.sumOfDuration = function (segments) {
            var duration = 0;
            for (var i = 0; i < segments.length; i++) {
                var segment = segments[i];
                duration += segment.duration;
            }
            return duration;
        };
        TaskbarEdit.prototype.setSplitTaskDrag = function (item) {
            var segment = item.segments[this.segmentIndex];
            var left = this.getRoundOffStartLeft(segment, this.roundOffDuration);
            var projectStartDate = this.getDateByLeft(left);
            projectStartDate = this.parent.dateValidationModule.checkStartDate(projectStartDate, item, null);
            segment.startDate = projectStartDate;
            var segmentDate = this.parent.dataOperation.getEndDate(segment.startDate, segment.duration, item.durationUnit, item, false);
            if (item.segments[this.segmentIndex + 1] && segmentDate.getTime() > item.segments[this.segmentIndex + 1].startDate.getTime()) {
                segment.endDate = item.segments[this.segmentIndex + 1].startDate;
            }
            else {
                segment.endDate = segmentDate;
            }
            segment.duration = this.parent.dataOperation.getDuration(segment.startDate, segment.endDate, item.durationUnit, item.isAutoSchedule, item.isMilestone);
            this.parent.setRecordValue('duration', this.sumOfDuration(item.segments), item, true);
            this.parent.setRecordValue('endDate', item.segments[item.segments.length - 1].endDate, item, true);
            if (!ej2_base_1.isNullOrUndefined(this.parent.taskFields.endDate)) {
                this.parent.dataOperation.updateMappingData(this.taskBarEditRecord, 'endDate');
            }
            Eif (!ej2_base_1.isNullOrUndefined(item.segments[this.segmentIndex - 1])) {
                var offsetDuration = this.parent.dataOperation.getDuration(item.segments[this.segmentIndex - 1].endDate, item.segments[this.segmentIndex].startDate, item.durationUnit, item.isAutoSchedule, item.isMilestone);
                Iif (segment.startDate.getDay() === 1 && offsetDuration === 0 && !this.parent.includeWeekend) {
                    offsetDuration = 1;
                }
                segment.offsetDuration = offsetDuration;
            }
            if (!ej2_base_1.isNullOrUndefined(item.segments[this.segmentIndex + 1])) {
                var nextSegment = item.segments[this.segmentIndex + 1];
                var offsetDuration = this.parent.dataOperation.getDuration(item.segments[this.segmentIndex].endDate, nextSegment.startDate, item.durationUnit, item.isAutoSchedule, item.isMilestone);
                Eif (nextSegment.startDate.getDay() === 1 && offsetDuration === 0 && !this.parent.includeWeekend) {
                    offsetDuration = 1;
                }
                nextSegment.offsetDuration = offsetDuration;
            }
            this.parent.setRecordValue('segments', item.segments, item, true);
            this.parent.dataOperation.updateMappingData(this.taskBarEditRecord, 'segments');
        };
        TaskbarEdit.prototype.getRoundOffEndLeft = function (ganttRecord, isRoundOff) {
            var tierMode = this.parent.timelineModule.bottomTier !== 'None' ? this.parent.timelineModule.bottomTier :
                this.parent.timelineModule.topTier;
            var totalLeft = ganttRecord.width + ganttRecord.left;
            if (this.segmentIndex !== -1 && ganttRecord.segments.length > 1) {
                var segment = ganttRecord.segments[this.segmentIndex];
                totalLeft = totalLeft - ganttRecord.width + segment.width + segment.left;
            }
            var remainingContribution = (1 / (this.parent.timelineModule.getIncrement(this.getDateByLeft(totalLeft), 1, 'Day') / (1000 * 60 * 60 * 24)));
            var remainingLeft = this.parent.perDayWidth - (this.parent.perDayWidth / remainingContribution);
            var positionValue = remainingLeft / this.parent.perDayWidth;
            Iif (isRoundOff === undefined) {
                isRoundOff = false;
            }
            if (!isRoundOff) {
                if ((tierMode !== 'Hour' && tierMode !== 'Minutes')) {
                    Iif (positionValue > 0.5) {
                        totalLeft = totalLeft - remainingLeft + this.parent.perDayWidth;
                    }
                    else Iif (positionValue < 0.5) {
                        totalLeft = (totalLeft - remainingLeft) + (this.parent.perDayWidth / 2);
                    }
                }
            }
            else Eif (isRoundOff) {
                if (tierMode === 'Hour') {
                    var inHour = (this.parent.perDayWidth / 24);
                    remainingContribution =
                        (1 / (this.parent.timelineModule.getIncrement(this.getDateByLeft(totalLeft), 1, 'Hour') / (1000 * 60 * 60)));
                    remainingLeft = (this.parent.perDayWidth / 24) - ((this.parent.perDayWidth / 24) / remainingContribution);
                    Eif (remainingLeft !== 0) {
                        totalLeft = (totalLeft - remainingLeft) + inHour;
                    }
                }
                else if (tierMode === 'Minutes') {
                    var inMinutes = (this.parent.perDayWidth / (24 * 60));
                    remainingContribution =
                        (1 / (this.parent.timelineModule.getIncrement(this.getDateByLeft(totalLeft), 1, 'Minutes') / (1000 * 60)));
                    remainingLeft = (this.parent.perDayWidth / (24 * 60)) - ((this.parent.perDayWidth / (24 * 60)) / remainingContribution);
                    Eif (remainingLeft !== 0) {
                        totalLeft = (totalLeft - remainingLeft) + inMinutes;
                    }
                }
                else {
                    if (remainingLeft !== 0) {
                        totalLeft = (totalLeft - remainingLeft) + this.parent.perDayWidth;
                    }
                }
            }
            return totalLeft;
        };
        TaskbarEdit.prototype.getRoundOffStartLeft = function (ganttRecord, isRoundOff) {
            var left = ej2_base_1.isNullOrUndefined(ganttRecord) ? ganttRecord.left
                : ganttRecord.left;
            if (this.segmentIndex !== -1 && ej2_base_1.isNullOrUndefined(ganttRecord.segments)) {
                left = ganttRecord.left + this.taskBarEditRecord.ganttProperties.left;
            }
            var tierMode = this.parent.timelineModule.bottomTier !== 'None' ? this.parent.timelineModule.bottomTier :
                this.parent.timelineModule.topTier;
            var remainingContribution = (1 / (this.parent.timelineModule.getIncrement(this.getDateByLeft(left, ej2_base_1.isNullOrUndefined(ganttRecord) ? ganttRecord.isMilestone : null, ganttRecord), 1, 'Day') / (1000 * 60 * 60 * 24)));
            var remainDays = this.parent.perDayWidth - (this.parent.perDayWidth / remainingContribution);
            var remainDaysInDecimal = remainDays / this.parent.perDayWidth;
            Iif (isRoundOff === undefined) {
                isRoundOff = false;
            }
            if (!isRoundOff) {
                Iif ((tierMode !== 'Hour' && tierMode !== 'Minutes')) {
                    if (remainDaysInDecimal <= 0.5) {
                        left = left - remainDays;
                    }
                    else if (remainDaysInDecimal > 0.5) {
                        left = (left - remainDays) + this.parent.perDayWidth / 2;
                    }
                }
            }
            else Eif (isRoundOff) {
                if (tierMode === 'Hour') {
                    remainingContribution =
                        (1 / (this.parent.timelineModule.getIncrement(this.getDateByLeft(left), 1, 'Hour') / (1000 * 60 * 60)));
                    remainDays = (this.parent.perDayWidth / 24) - ((this.parent.perDayWidth / 24) / remainingContribution);
                    left = left - remainDays;
                }
                else if (tierMode === 'Minutes') {
                    remainingContribution =
                        (1 / (this.parent.timelineModule.getIncrement(this.getDateByLeft(left), 1, 'Minutes') / (1000 * 60)));
                    remainDays = (this.parent.perDayWidth / (24 * 60)) - ((this.parent.perDayWidth / (24 * 60)) / remainingContribution);
                    left = left - remainDays;
                }
                else {
                    left = left - remainDays;
                }
            }
            return left;
        };
        TaskbarEdit.prototype.getDateByLeft = function (left, isMilestone, property) {
            var pStartDate = new Date(this.parent.timelineModule.timelineStartDate.toString());
            var milliSecondsPerPixel = (24 * 60 * 60 * 1000) / this.parent.perDayWidth;
            pStartDate.setTime(pStartDate.getTime() + (left * milliSecondsPerPixel));
            if (isMilestone && !ej2_base_1.isNullOrUndefined(property.predecessorsName) && property.predecessorsName !== '') {
                var dayEndTime = this.parent['getCurrentDayEndTime'](property.isAutoSchedule ? property.autoEndDate : property.endDate);
                this.parent.dateValidationModule.setTime(dayEndTime, pStartDate);
                pStartDate = this.parent.dateValidationModule.checkStartDate(pStartDate, property, true);
            }
            var tierMode = this.parent.timelineModule.bottomTier !== 'None' ? this.parent.timelineModule.topTier :
                this.parent.timelineModule.bottomTier;
            Eif (tierMode !== 'Hour' && tierMode !== 'Minutes') {
                Iif (this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString())) &&
                    !this.parent.isInDst(pStartDate)) {
                    pStartDate.setTime(pStartDate.getTime() + (60 * 60 * 1000));
                }
            }
            return pStartDate;
        };
        TaskbarEdit.prototype.setItemPosition = function () {
            Eif (!ej2_base_1.isNullOrUndefined(this.editElement)) {
                var currentElement = this.editElement.parentElement;
                if (this.parent.allowTaskbarDragAndDrop && this.taskBarEditAction === 'ChildDrag') {
                    currentElement.style.position = null;
                }
                else {
                    if (this.parent.enableTimelineVirtualization &&
                        this.parent.timelineModule.wholeTimelineWidth > this.parent.element.offsetWidth * 3) {
                        currentElement.style.setProperty('position', 'relative');
                    }
                    else {
                        currentElement.style.setProperty('position', 'absolute');
                    }
                }
            }
            var item = this.taskBarEditRecord.ganttProperties;
            var position = this.parent.enableRtl ? 'right' : 'left';
            var segment = !ej2_base_1.isNullOrUndefined(item.segments) ? item.segments[this.segmentIndex] : null;
            var width = this.taskBarEditAction === 'MilestoneDrag' || item.isMilestone ?
                this.parent.chartRowsModule.milestoneHeight : item.width;
            var rightResizer = this.parent.isAdaptive ? (width - 2) : (width - 10);
            if (!ej2_base_1.isNullOrUndefined(segment)) {
                rightResizer = this.parent.isAdaptive ? (segment.width - 2) : (segment.width - 10);
            }
            this.taskBarEditElement.style.setProperty('opacity', '.75');
            var taskBarMainContainer;
            Iif (this.parent.allowTaskbarDragAndDrop && !item.isAutoSchedule && this.taskBarEditRecord.hasChildRecords) {
                taskBarMainContainer = this.taskBarEditElement;
            }
            else {
                taskBarMainContainer = (!this.taskBarEditElement.classList.contains(cls.taskBarMainContainer)) ? ((this.taskBarEditAction === 'ChildDrag' ||
                    this.taskBarEditAction === 'LeftResizing') && this.segmentIndex === 0) ? this.taskBarEditElement.parentElement : ej2_base_1.closest(this.taskBarEditElement, 'tr.' + cls.chartRow)
                    .querySelector('.' + cls.taskBarMainContainer) : this.taskBarEditElement;
            }
            var segmentedTaskBarContainer = (this.taskBarEditElement.classList.contains('e-segmented-taskbar') ||
                this.taskBarEditElement.querySelector('.e-segmented-taskbar')) ? true : false;
            var traceChildProgressBar = this.taskBarEditElement.querySelector('.' + cls.traceChildProgressBar);
            var traceChildTaskBar = this.taskBarEditElement.querySelector('.' + cls.traceChildTaskBar);
            var childProgressResizer = segmentedTaskBarContainer ? utils_1.parentsUntil(this.taskBarEditElement, cls.taskBarMainContainer).querySelector('.' + cls.childProgressResizer) : this.taskBarEditElement.querySelector('.' + cls.childProgressResizer);
            var taskBarRightResizer = this.taskBarEditElement.querySelector('.' + cls.taskBarRightResizer);
            var traceParentTaskBar = this.taskBarEditElement.querySelector('.' + cls.traceParentTaskBar);
            var traceParentProgressBar = this.taskBarEditElement.querySelector('.' + cls.traceParentProgressBar);
            var traceConnectorPointRight = this.taskBarEditElement.querySelector('.' + cls.rightConnectorPointOuterDiv);
            var segmentConnectorPointRight = taskBarMainContainer.querySelector('.' + cls.rightConnectorPointOuterDiv);
            var manualParentTaskbar = this.taskBarEditElement;
            var manualTaskbar = this.taskBarEditElement.querySelector('.' + cls.manualParentTaskBar);
            var manualParentRight = this.taskBarEditElement.querySelector('.' + cls.manualParentRightResizer);
            var manualParentLeft = this.taskBarEditElement.querySelector('.' + cls.manualParentLeftResizer);
            var resizeLine = this.parent.ganttChartModule.chartBodyContainer.querySelector('.e-taskbar-resize-div');
            if (this.parent.allowTaskbarDragAndDrop && !this.updatePosition) {
                this.leftValue = this.leftValue + 30;
                this.updatePosition = true;
            }
            if (this.taskBarEditAction !== 'ConnectorPointRightDrag' &&
                this.taskBarEditAction !== 'ConnectorPointLeftDrag') {
                if (this.taskBarEditAction !== 'ParentResizing' && this.taskBarEditAction !== 'ManualParentDrag') {
                    if (segmentedTaskBarContainer && !ej2_base_1.isNullOrUndefined(item.segments)
                        && (this.taskBarEditAction === 'RightResizing' || this.segmentIndex !== 0)) {
                        Eif (!ej2_base_1.isNullOrUndefined(resizeLine)) {
                            if (!this.parent.allowTaskbarDragAndDrop || (this.parent.allowTaskbarDragAndDrop && this.parent.rowDragAndDropModule && this.taskBarEditAction !== 'ChildDrag' &&
                                this.taskBarEditAction !== 'ParentDrag')) {
                                resizeLine.style.width = (segment.width) + 'px';
                            }
                        }
                        this.taskBarEditElement.style.width = (segment.width) + 'px';
                        Iif (this.parent.enableRtl) {
                            this.taskBarEditElement.style.right = (segment.left) + 'px';
                        }
                        else {
                            this.taskBarEditElement.style.left = (segment.left) + 'px';
                            Eif (!ej2_base_1.isNullOrUndefined(resizeLine)) {
                                if (!this.parent.allowTaskbarDragAndDrop || (this.parent.allowTaskbarDragAndDrop && this.parent.rowDragAndDropModule && this.taskBarEditAction !== 'ChildDrag'
                                    && this.taskBarEditAction !== 'ParentDrag')) {
                                    resizeLine.style.left = (segment.left + this.editElement.parentElement.offsetLeft) + 'px';
                                }
                            }
                        }
                    }
                    taskBarMainContainer.style.setProperty(position, (this.parent.allowTaskbarDragAndDrop ? this.leftValue : (item.left)) + 'px');
                    taskBarMainContainer.style.width = (width) + 'px';
                    if (segmentedTaskBarContainer && segmentConnectorPointRight) {
                        segmentConnectorPointRight.style.left = (this.parent.isAdaptive ? (width + 10) : (width + 2)) + 'px';
                    }
                    if (this.parent.allowTaskbarDragAndDrop && this.parent.rowDragAndDropModule && this.taskBarEditAction !== 'LeftResizing' &&
                        this.taskBarEditAction !== 'RightResizing' && this.taskBarEditAction !== 'ProgressResizing') {
                        var addTop = this.parent.taskbarHeight / 2;
                        taskBarMainContainer.style.setProperty('top', (this.topValue + addTop) + 'px');
                        taskBarMainContainer.style.zIndex = '4';
                    }
                    if (this.taskBarEditAction === 'LeftResizing' && this.segmentIndex === 0) {
                        this.taskBarEditElement.style.setProperty('opacity', '.75');
                        var parent_1 = this.taskBarEditElement.parentElement;
                        var segmentedTasks = parent_1.getElementsByClassName('e-segmented-taskbar');
                        for (var i = 0; i < item.segments.length; i++) {
                            var segment_4 = item.segments[i];
                            var segmentElement = segmentedTasks[i];
                            segmentElement.style.width = (segment_4.width) + 'px';
                            Iif (item.segments.length === 1) {
                                resizeLine.style.width = (segment_4.width) + 'px';
                                resizeLine.style.setProperty(position, (item.left) + 'px');
                            }
                            else {
                                if (i === 0) {
                                    resizeLine.style.width = (segment_4.width) + 'px';
                                    resizeLine.style.setProperty(position, (segment_4.left + item.left) + 'px');
                                }
                                Iif (this.parent.enableRtl) {
                                    segmentElement.style.right = (segment_4.left) + 'px';
                                }
                                else {
                                    segmentElement.style.left = (segment_4.left) + 'px';
                                }
                            }
                        }
                    }
                    if (this.taskBarEditAction === 'ChildDrag' && (this.segmentIndex === 0 || (this.segmentIndex !== -1 && this.parent.allowTaskbarDragAndDrop))) {
                        resizeLine.style.width = (width) + 'px';
                        resizeLine.style.setProperty(position, item.left + 'px');
                        taskBarMainContainer.style.setProperty('opacity', '.75');
                    }
                }
                if (traceConnectorPointRight) {
                    if (this.parent.enableRtl) {
                        traceConnectorPointRight.style.left = (this.parent.isAdaptive ? (width + 10) : (width - 2)) + 'px';
                    }
                    else {
                        traceConnectorPointRight.style.left = (this.parent.isAdaptive ? (width + 10) : (width + 2)) + 'px';
                    }
                }
                if (traceConnectorPointRight && this.taskBarEditAction === 'LeftResizing') {
                    traceConnectorPointRight.style.left = (width - 2) + 'px';
                }
                if (childProgressResizer && traceChildProgressBar && (this.taskBarEditAction === 'LeftResizing' || this.taskBarEditAction === 'RightResizing' || this.taskBarEditAction === 'ChildDrag' || this.taskBarEditAction === 'ParentDrag')) {
                    childProgressResizer.style.display = 'none';
                    traceChildProgressBar.style.display = 'none';
                }
                if (traceConnectorPointRight && this.taskBarEditAction === 'ProgressResizing') {
                    traceConnectorPointRight.style.display = 'none';
                }
                if (this.taskBarEditAction === 'MilestoneDrag' || item.isMilestone) {
                    taskBarMainContainer.style.setProperty(position, (this.parent.allowTaskbarDragAndDrop ? this.leftValue : (item.left - (width / 2))) + 'px');
                    resizeLine.style.setProperty(position, (item.left - (width / 2)) + 'px');
                    resizeLine.style.width = (width) + 'px';
                }
                else if (this.taskBarEditAction === 'ProgressResizing') {
                    Eif (this.segmentIndex === -1) {
                        traceChildTaskBar.style.setProperty(position, (item.left + item.progressWidth - 10) + 'px');
                        Eif (!ej2_base_1.isNullOrUndefined(traceChildProgressBar)) {
                            traceChildProgressBar.style.width = item.progressWidth + 'px';
                            traceChildProgressBar.style.borderBottomRightRadius = this.progressBorderRadius + 'px';
                            traceChildProgressBar.style.borderTopRightRadius = this.progressBorderRadius + 'px';
                            var width_1 = this.parent.enableRtl ? item.progressWidth + 8 : item.progressWidth - 8;
                            childProgressResizer.style.setProperty(position, width_1 + 'px');
                        }
                    }
                    else {
                        this.updateSegmentProgress(this.taskBarEditRecord.ganttProperties);
                        var progressElements = taskBarMainContainer.querySelectorAll('.e-gantt-child-progressbar');
                        for (var count = 0; count < progressElements.length; count++) {
                            if (item.segments[count] && item.segments[count].progressWidth && this.segmentIndex !== count) {
                                progressElements[count]['style'].display = 'block';
                                progressElements[count].style.width = item.segments[count].progressWidth + 'px';
                            }
                        }
                        traceChildProgressBar.style.width = item.segments[this.segmentIndex].progressWidth + 'px';
                        traceChildProgressBar.style.borderBottomRightRadius = this.progressBorderRadius + 'px';
                        traceChildProgressBar.style.borderTopRightRadius = this.progressBorderRadius + 'px';
                        var width_2 = this.parent.enableRtl ? this.progressValue + 8 : this.progressValue - 8;
                        childProgressResizer.style.setProperty(position, width_2 + 'px');
                    }
                }
                else if (this.taskBarEditAction === 'RightResizing' && !ej2_base_1.isNullOrUndefined(traceChildTaskBar)) {
                    resizeLine.style.width = (width) + 'px';
                    traceChildTaskBar.style.width = (width) + 'px';
                    Eif (!ej2_base_1.isNullOrUndefined(traceChildProgressBar)) {
                        traceChildProgressBar.style.width = (item.progressWidth) + 'px';
                        taskBarRightResizer.style.setProperty(position, rightResizer + 'px');
                        Eif (!ej2_base_1.isNullOrUndefined(childProgressResizer)) {
                            childProgressResizer.style.setProperty(position, item.progressWidth - 10 + 'px');
                        }
                    }
                }
                else if (this.taskBarEditAction === 'ParentDrag') {
                    resizeLine.style.setProperty(position, item.left + 'px');
                    resizeLine.style.width = (width) + 'px';
                    resizeLine.style.width = (item.width) + 'px';
                    if (!ej2_base_1.isNullOrUndefined(traceParentTaskBar)) {
                        traceParentTaskBar.style.width = (width) + 'px';
                        resizeLine.style.width = (item.width) + 'px';
                    }
                    Iif (!ej2_base_1.isNullOrUndefined(traceChildProgressBar)) {
                        traceParentProgressBar.style.width = (item.progressWidth) + 'px';
                    }
                }
                else if (this.taskBarEditAction === 'ParentResizing') {
                    resizeLine.style.width = (item.width) + 'px';
                    resizeLine.style.setProperty(position, item.left + 'px');
                    manualParentTaskbar.style.setProperty('width', (item.width) + 'px');
                    manualTaskbar.style.setProperty('width', (item.width) + 'px');
                    this.editElement.parentElement.style.setProperty('width', (item.width) + 'px');
                }
                else if (this.taskBarEditAction === 'ManualParentDrag') {
                    resizeLine.style.width = (item.width) + 'px';
                    resizeLine.style.setProperty(position, item.left + 'px');
                    manualParentTaskbar.style.setProperty(position, item.left - item.autoLeft + 'px');
                    Iif (this.parent.allowTaskbarDragAndDrop) {
                        manualParentTaskbar.style.setProperty(position, this.leftValue + 'px');
                        manualParentTaskbar.style.setProperty('top', (this.topValue) + 'px');
                        manualParentTaskbar.style.zIndex = '4';
                    }
                }
                else {
                    if (!ej2_base_1.isNullOrUndefined(traceChildTaskBar) && !segmentedTaskBarContainer) {
                        traceChildTaskBar.style.width = (item.width) + 'px';
                        traceChildTaskBar.style.left = (item.left) + 'px';
                        this.taskBarEditElement.style.width = (item.width) + 'px';
                        this.taskBarEditElement.style.left = ((this.parent.allowTaskbarDragAndDrop ? this.leftValue : (item.left))) + 'px';
                        resizeLine.style.setProperty(position, item.left + 'px');
                        resizeLine.style.width = (item.width) + 'px';
                    }
                    Eif (!ej2_base_1.isNullOrUndefined(traceChildProgressBar)) {
                        taskBarRightResizer.style.setProperty(position, rightResizer + 'px');
                        traceChildProgressBar.style.width = (item.progressWidth) + 'px';
                        Eif (!ej2_base_1.isNullOrUndefined(childProgressResizer)) {
                            childProgressResizer.style.setProperty(position, item.progressWidth - 10 + 'px');
                        }
                    }
                    if (segmentedTaskBarContainer) {
                        taskBarRightResizer.style.setProperty(position, rightResizer + 'px');
                        traceChildProgressBar.style.width = (segment.width) + 'px';
                        Eif (!ej2_base_1.isNullOrUndefined(childProgressResizer)) {
                            childProgressResizer.style.setProperty(position, segment.width - 10 + 'px');
                        }
                    }
                }
            }
            if (this.parent.allowTaskbarDragAndDrop && (this.taskBarEditAction === 'ChildDrag' || this.taskBarEditAction === 'ParentDrag' ||
                this.taskBarEditAction === 'ManualParentDrag' || this.taskBarEditAction === 'MilestoneDrag')) {
                var resizeValue = this.parent.enableRtl ? parseInt(resizeLine.style.right, 10) : parseInt(resizeLine.style.left, 10);
                Iif (this.parent.enableRtl) {
                    resizeLine.style.right = (resizeValue - 30) + 'px';
                }
                else {
                    resizeLine.style.left = (resizeValue + 30) + 'px';
                }
            }
        };
        TaskbarEdit.prototype.mouseUpHandler = function (e) {
            var mouseDragged = this.isMouseDragged;
            this.previousMouseMove = null;
            this.editTooltip.showHideTaskbarEditTooltip(false, this.segmentIndex);
            if (this.taskBarEditAction && this.isMouseDragged) {
                Eif ((!this.dragMouseLeave && this.taskBarEditedAction) || (this.parent.allowTaskbarDragAndDrop)) {
                    Iif (e.type === 'touchmove' || e.type === 'touchstart' || e.type === 'touchend') {
                        var coordinates = this.getCoordinate(e);
                        this['droppedTarget'] = document.elementFromPoint(coordinates.pageX, coordinates.pageY);
                    }
                    else {
                        if (this.taskBarEditRecord.hasChildRecords && !this.taskBarEditRecord.ganttProperties.isAutoSchedule) {
                            var taskbarPosition = this.parent.getOffsetRect(this.taskBarEditElement);
                            var left = (!ej2_base_1.isNullOrUndefined(document.body.className) && document.body.className.includes('e-bigger')) ? 12 : 0;
                            var pointerLeft = (3 + this.parent.chartRowsModule.connectorPointWidth + left);
                            var xValue = void 0;
                            Iif (this.parent.enableRtl) {
                                xValue = Math.abs(taskbarPosition.left + pointerLeft + 1);
                            }
                            else {
                                xValue = Math.abs(Math.abs(taskbarPosition.left - pointerLeft - 1) -
                                    this.parent.ganttChartModule.scrollElement.scrollLeft);
                            }
                            this['droppedTarget'] = document.elementFromPoint(xValue, e.y);
                        }
                        else {
                            this['droppedTarget'] = document.elementFromPoint(e.x, e.y);
                        }
                        Iif (this['droppedTarget'] && this['droppedTarget'].classList.contains('e-span-label')) {
                            this['droppedTarget'] = document.elementFromPoint(e.x + this['droppedTarget']['offsetWidth'], e.y);
                        }
                    }
                    this.previousIds = this.parent.ids.slice();
                    this.previousFlatData = this.parent.flatData.slice();
                    this.taskBarEditedAction(e);
                    this.isMouseDragged = false;
                }
                else {
                    this.parent.isOnEdit = false;
                    this.cancelTaskbarEditActionInMouseLeave();
                    var criticalModule = this.parent.criticalPathModule;
                    if (this.parent.enableCriticalPath && criticalModule && criticalModule.criticalPathCollection) {
                        criticalModule.criticalConnectorLine(criticalModule.criticalPathCollection, criticalModule.detailPredecessorCollection, true, criticalModule.predecessorCollectionTaskIds);
                    }
                }
            }
            if (this.parent.enableMultiTaskbar && !ej2_base_1.isNullOrUndefined(this.taskBarEditElement)) {
                if (!ej2_base_1.isNullOrUndefined(this.taskBarEditElement.querySelector('.e-gantt-child-taskbar'))) {
                    if (this.taskBarEditElement.querySelector('.e-gantt-child-taskbar').classList.contains('e-collapsed-taskbar-drag')) {
                        ej2_base_1.removeClass([this.taskBarEditElement.querySelector('.e-gantt-child-taskbar')], 'e-collapsed-taskbar-drag');
                        this.taskBarEditElement.style.zIndex = this.prevZIndex;
                        this.prevZIndex = '';
                    }
                }
            }
            Eif (!this.parent.isAdaptive || mouseDragged) {
                this.initPublicProp();
            }
            this.stopScrollTimer();
        };
        TaskbarEdit.prototype.taskBarEditedAction = function (event) {
            var args = {};
            var x1 = this.mouseDownX;
            var y1 = this.mouseDownY;
            var item = this.taskBarEditRecord;
            var recordIndex = this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement);
            var x2 = this.mouseMoveX;
            var e = this.getCoordinate(event);
            var resMouseY = e.pageY - this.parent.ganttChartModule.chartBodyContainer.offsetTop;
            if ((this.taskBarEditAction === 'ConnectorPointLeftDrag' ||
                this.taskBarEditAction === 'ConnectorPointRightDrag') && !this.drawPredecessor) {
                this.dependencyCancel = true;
            }
            var parentRecord = [];
            if ((this.taskBarEditAction === 'ConnectorPointLeftDrag' ||
                this.taskBarEditAction === 'ConnectorPointRightDrag') && this.drawPredecessor && (!this.connectorSecondRecord.hasChildRecords ||
                this.connectorSecondRecord.hasChildRecords && this.parent.allowParentDependency)) {
                parentRecord.push(ej2_base_1.extend([], [], [this.taskBarEditRecord], true)[0]);
                Iif (this.parent.undoRedoModule) {
                    this.parent.undoRedoModule['getUndoCollection'][this.parent.undoRedoModule['getUndoCollection'].length - 1]['connectedRecords'] = parentRecord;
                    if (this.parent.toolbarModule) {
                        this.parent.toolbarModule.enableItems([this.parent.controlId + '_undo'], true);
                    }
                }
                this.parent.connectorLineEditModule.updatePredecessor(this.connectorSecondRecord, this.finalPredecessor);
            }
            else {
                if ((this.taskBarEditAction === 'ConnectorPointLeftDrag' ||
                    this.taskBarEditAction === 'ConnectorPointRightDrag') || (this.oldData && JSON.stringify(item.ganttProperties) === JSON.stringify(this.oldData.ganttProperties))) {
                    if (this.parent.undoRedoModule && this.parent.undoRedoModule['getUndoCollection'].length > 0) {
                        this.parent['totalUndoAction']--;
                        this.parent.undoRedoModule['getUndoCollection'].splice(this.parent.undoRedoModule['getUndoCollection'].length - 1, 1);
                        Eif (this.parent.toolbarModule) {
                            this.parent.toolbarModule.enableItems([this.parent.controlId + '_undo'], false);
                        }
                    }
                }
                else {
                    if (this.parent.undoRedoModule && this.parent.toolbarModule && this.parent.undoRedoModule['getUndoCollection'].length > 0) {
                        this.parent.toolbarModule.enableItems([this.parent.controlId + '_undo'], true);
                    }
                }
                Eif (x1 !== x2 || (Math.abs(y1 - resMouseY) >= (this.parent.rowHeight - this.parent.taskbarHeight) / 2)) {
                    Eif (item !== null) {
                        args.editingFields = item.ganttProperties;
                        args.data = item;
                        args.recordIndex = recordIndex;
                        args.previousData = this.previousItem;
                        args.taskBarEditAction = this.taskBarEditAction;
                        args.action = 'TaskbarEditing';
                        args.roundOffDuration = this.roundOffDuration;
                        args.target = this.targetElement;
                        this.taskbarEditedArgs = args;
                        this.taskbarEdited(args);
                    }
                }
            }
            this.parent['isProjectDateUpdated'] = false;
        };
        TaskbarEdit.prototype.cancelTaskbarEditActionInMouseLeave = function () {
            this.parent.editModule.reUpdatePreviousRecords(true);
        };
        TaskbarEdit.prototype.updateSegmentProgress = function (taskData) {
            var segments = taskData.segments;
            var fixedWidth = true;
            var totalTaskWidth = this.splitTasksDuration(segments) * this.parent.perDayWidth;
            var progress = Math.ceil((taskData.progressWidth / totalTaskWidth) * 100);
            var totalProgressWidth = (totalTaskWidth * progress) / 100;
            var tempWidth = totalProgressWidth;
            for (var i = 0; i < segments.length; i++) {
                var segment = segments[i];
                if (i !== 0) {
                    if (segment.left <= tempWidth) {
                        var newWidth = (tempWidth - segment.left);
                        totalProgressWidth = newWidth;
                    }
                    else {
                        totalProgressWidth = 0;
                    }
                }
                delete segment.progressWidth;
                if (totalProgressWidth > 0 && totalProgressWidth > segment.width) {
                    totalProgressWidth = totalProgressWidth - segment.width;
                    segment.progressWidth = segment.width;
                    segment.showProgress = false;
                }
                else if (fixedWidth) {
                    segment.progressWidth = totalProgressWidth;
                    segment.showProgress = true;
                    totalProgressWidth = totalProgressWidth - segment.width;
                    fixedWidth = false;
                }
            }
        };
        TaskbarEdit.prototype.taskbarEdited = function (arg) {
            var args = ej2_base_1.extend({}, arg);
            var ganttRecord = args.data;
            var taskData = ganttRecord.ganttProperties;
            var draggedRecIndex = this.parent.flatData.indexOf(ganttRecord);
            Iif (this.parent.allowTaskbarDragAndDrop && this.dragMoveY > 0 && ((this.parent.viewType === 'ResourceView' &&
                !ganttRecord.hasChildRecords) || this.parent.viewType === 'ProjectView')) {
                if (this.parent.rowDragAndDropModule) {
                    var flatRecordCol = this.parent.currentViewData;
                    if (this.taskBarEditRecord.parentItem && flatRecordCol[this.taskBarEditRecord.parentItem.index] &&
                        ((this.parent.editedRecords.indexOf(flatRecordCol[this.taskBarEditRecord.parentItem.index]) === -1))) {
                        this.parent.editedRecords.push(flatRecordCol[this.taskBarEditRecord.parentItem.index]);
                    }
                    this.removeChildBorder();
                    this.removeErrorElem();
                    this.removetopOrBottomBorder();
                    var droppedRecord = void 0;
                    this.updatePosition = false;
                    this.draggedRecordMarginTop = this.taskBarEditElement.style.marginTop;
                    var row = void 0;
                    if (!ej2_base_1.isNullOrUndefined(this.droppedTarget)) {
                        row = ej2_base_1.closest(this.droppedTarget, 'tr.' + cls.chartRow);
                    }
                    if (row) {
                        var recordIndex = parseInt(row.getAttribute('data-rowindex'), 10);
                        droppedRecord = this.parent.flatData[recordIndex];
                        var droppedParentRecordIndex = this.parent.getRootParent(droppedRecord, 0).index;
                        var draggedParentRecordIndex = this.parent.getRootParent(this.taskBarEditRecord, 0).index;
                        var e = {
                            cancel: false,
                            data: this.taskBarEditRecord,
                            fromIndex: this.taskBarEditRecord.index,
                            dropIndex: droppedRecord.index,
                            dropPosition: this.parent.rowDragAndDropModule['dropPosition'],
                            dropRecord: droppedRecord
                        };
                        this.parent.trigger('rowDrop', e);
                        if (!e['cancel'] && droppedRecord && recordIndex !== draggedRecIndex && ((droppedParentRecordIndex !== draggedParentRecordIndex ||
                            (this.taskBarEditRecord.hasChildRecords && droppedRecord.hasChildRecords)) ||
                            !this.taskBarEditRecord.hasChildRecords)) {
                            var droppedRecordIndex = this.parent.flatData.indexOf(droppedRecord);
                            var position = void 0;
                            if (this.parent.viewType === 'ProjectView' && !ej2_base_1.isNullOrUndefined(this.parent.rowDragAndDropModule['dropPosition'])) {
                                position = this.parent.rowDragAndDropModule['dropPosition'];
                            }
                            else {
                                position = (droppedRecord.hasChildRecords || (!droppedRecord.parentItem &&
                                    droppedRecord.childRecords.length === 0)) ? 'child' : this.parent.rowDragAndDropModule['dropPosition'];
                            }
                            if (this.parent.rowDragAndDropModule) {
                                if (this.parent.viewType === 'ResourceView' && (position === 'child' && !droppedRecord.hasChildRecords) && !ej2_base_1.isNullOrUndefined(droppedRecord.parentItem)) {
                                    position = 'Invalid';
                                    this.parent.rowDragAndDropModule['dropPosition'] = 'Invalid';
                                }
                                if (position) {
                                    this.parent.rowDragAndDropModule.reorderRows([draggedRecIndex], droppedRecordIndex, position);
                                }
                            }
                            this.dragMoveY = 0;
                        }
                    }
                    this.isClonedElement = false;
                }
                if (this.parent.showOverAllocation) {
                    this.parent.ganttChartModule.renderOverAllocationContainer();
                }
            }
            if (args.taskBarEditAction === 'ProgressResizing') {
                if (args.previousData.progress !== taskData.progress) {
                    var progressWidth = args.data.ganttProperties.progressWidth;
                    var totalTaskWidth = args.data.ganttProperties.width;
                    var updatedValues = this.validateProgressWidth(args.data.ganttProperties, progressWidth, totalTaskWidth);
                    this.parent.setRecordValue('progress', this.getProgressPercent(updatedValues.totalTaskWidth, updatedValues.progressWidth), taskData, true);
                    Eif (ganttRecord.parentItem) {
                        this.parent.editModule.updateParentProgress(ganttRecord.parentItem);
                    }
                    Iif (!ej2_base_1.isNullOrUndefined(taskData.segments)) {
                        this.updateSegmentProgress(taskData);
                    }
                }
            }
            else {
                var segments = args.data.ganttProperties.segments;
                if (!ej2_base_1.isNullOrUndefined(segments) && segments.length > 0
                    && ((this.taskBarEditAction === 'LeftResizing' && this.segmentIndex !== 0)
                        || (this.taskBarEditAction === 'ChildDrag' && this.segmentIndex !== 0)
                        || (this.taskBarEditAction === 'RightResizing'))) {
                    var segment = segments[this.segmentIndex];
                    var ganttProp = this.taskBarEditRecord.ganttProperties;
                    var previousSegment = this.segmentIndex === 0 ? null
                        : segments[this.segmentIndex - 1];
                    var nextSegment = this.segmentIndex === segments.length - 1 ? null
                        : segments[this.segmentIndex + 1];
                    var sDate = !ej2_base_1.isNullOrUndefined(nextSegment) ?
                        new Date(nextSegment.startDate.getTime()) : this.parent.cloneProjectEndDate;
                    var eDate = !ej2_base_1.isNullOrUndefined(previousSegment) ?
                        new Date(previousSegment.endDate.getTime()) : this.parent.cloneProjectStartDate;
                    var cStartDate = new Date(segment.startDate.getTime());
                    var cEndDate = new Date(segment.endDate.getTime());
                    if (this.parent.timelineModule.topTier === 'Day' && this.parent.timelineModule.bottomTier === 'Hour') {
                        cStartDate.setHours(cStartDate.getHours() - 1);
                        cEndDate.setHours(cEndDate.getHours() + 1);
                    }
                    else {
                        cStartDate.setDate(cStartDate.getDate());
                        cEndDate.setDate(cEndDate.getDate());
                    }
                    if (this.parent.includeWeekend) {
                        sDate.setHours(0, 0, 0, 0);
                        eDate.setHours(0, 0, 0, 0);
                        cStartDate.setDate(cStartDate.getDate() - 1);
                        cEndDate.setDate(cEndDate.getDate() + 1);
                        cStartDate.setHours(0, 0, 0, 0);
                        cEndDate.setHours(0, 0, 0, 0);
                        Eif (cStartDate.getTime() <= eDate.getTime() && !ej2_base_1.isNullOrUndefined(previousSegment) && !ej2_base_1.isNullOrUndefined(segment)) {
                            var segmentIndexes = [
                                { 'firstSegmentIndex': previousSegment.segmentIndex, 'secondSegmentIndex': segment.segmentIndex }
                            ];
                            this.parent.chartRowsModule.mergeTask(ganttProp.taskId, segmentIndexes);
                        }
                        else if (cEndDate.getTime() >= sDate.getTime() && this.segmentIndex !== segments.length - 1) {
                            var segmentIndexes = [
                                { 'firstSegmentIndex': segment.segmentIndex, 'secondSegmentIndex': nextSegment.segmentIndex }
                            ];
                            this.parent.chartRowsModule.mergeTask(ganttProp.taskId, segmentIndexes);
                        }
                        else if (cEndDate.getTime() >= sDate.getTime()) {
                            segment.endDate.setDate(this.parent.cloneProjectEndDate.getDate() - 1);
                            segment.startDate = this.parent.dataOperation.getStartDate(segment.endDate, segment.duration, ganttProp.durationUnit, ganttProp);
                            for (var i = segments.length - 2; i >= 0; i++) {
                                var segment_5 = segments[i];
                                var eDate_1 = segment_5.endDate;
                                eDate_1.setDate(eDate_1.getDate() - segment_5.offsetDuration);
                                segment_5.endDate = eDate_1;
                                segment_5.startDate = this.parent.dataOperation.getStartDate(segment_5.endDate, segment_5.duration, ganttProp.durationUnit, ganttProp);
                            }
                        }
                    }
                    else {
                        if (cEndDate.getTime() <= sDate.getTime() && this.segmentIndex !== segments.length - 1 && !this.parent.includeWeekend &&
                            this.parent.dataOperation.getDuration((this.parent.dataOperation.checkStartDate(cEndDate, taskData, false)), sDate, taskData.durationUnit, false, false) === 0) {
                            var segmentIndexes = [
                                { 'firstSegmentIndex': segment.segmentIndex, 'secondSegmentIndex': nextSegment.segmentIndex }
                            ];
                            this.parent.chartRowsModule.mergeTask(ganttProp.taskId, segmentIndexes);
                        }
                        else if (cStartDate.getTime() >= eDate.getTime() &&
                            !ej2_base_1.isNullOrUndefined(previousSegment) && !ej2_base_1.isNullOrUndefined(segment) &&
                            !this.parent.includeWeekend && this.parent.dataOperation.getDuration((this.parent.dataOperation.checkEndDate(cStartDate, taskData, false)), eDate, taskData.durationUnit, false, false) === 0) {
                            var segmentIndexes = [
                                { 'firstSegmentIndex': previousSegment.segmentIndex, 'secondSegmentIndex': segment.segmentIndex }
                            ];
                            this.parent.chartRowsModule.mergeTask(ganttProp.taskId, segmentIndexes);
                        }
                    }
                }
                this.parent.dataOperation.updateWidthLeft(args.data);
            }
            this.isDragged = false;
            this.parent.dataOperation.updateTaskData(ganttRecord);
            this.parent.editModule.initiateUpdateAction(args);
        };
        TaskbarEdit.prototype.getProgressPercent = function (parentwidth, progresswidth) {
            return Math.ceil(((progresswidth / parentwidth) * 100));
        };
        TaskbarEdit.prototype.drawFalseLine = function () {
            var x1 = this.mouseDownX;
            var y1 = this.mouseDownY;
            var x2 = this.mouseMoveX;
            var y2 = this.mouseMoveY;
            var length = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
            var angle = Math.atan2(y2 - y1, x2 - x1) * 180 / Math.PI;
            var transform = 'rotate(' + (this.parent.enableRtl ? -angle : angle) + 'deg)';
            var left;
            var width = 0;
            Eif (!ej2_base_1.isNullOrUndefined(document.querySelectorAll('.e-chart-row')[0])) {
                width = document.querySelectorAll('.e-chart-row')[0].offsetWidth;
            }
            if (this.taskBarEditAction === 'ConnectorPointLeftDrag') {
                Iif (this.parent.enableRtl) {
                    left = ((width - (this.elementOffsetLeft + (this.parent.chartRowsModule.connectorPointWidth / 2)))) -
                        Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left);
                }
                else {
                    left = (this.elementOffsetLeft - (this.parent.chartRowsModule.connectorPointWidth / 2)) -
                        this.parent.ganttChartModule.scrollObject.previousScroll.left;
                }
            }
            if (this.taskBarEditAction === 'ConnectorPointRightDrag') {
                Iif (this.parent.enableRtl) {
                    left = (width - (this.elementOffsetLeft + this.elementOffsetWidth +
                        (this.parent.chartRowsModule.connectorPointWidth / 2))) - Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left);
                }
                else {
                    left = (this.elementOffsetLeft + this.elementOffsetWidth) +
                        (this.parent.chartRowsModule.connectorPointWidth / 2) - Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left);
                }
            }
            var top = ((this.elementOffsetTop) + (this.elementOffsetHeight / 2) +
                this.parent.ganttChartModule.chartBodyContainer.offsetTop) - this.parent.ganttChartModule.scrollObject.previousScroll.top;
            this.removeFalseLine(false);
            this.falseLine = ej2_base_1.createElement('div', {
                className: cls.falseLine, id: 'ganttfalseline' + this.parent.element.id,
                styles: 'position: absolute;transform:' + transform + ';' +
                    'border-top-width: 1px;border-top-style: dashed;z-index: 5;width:' + (length - 3) + 'px;' +
                    'top:' + top + 'px;'
            });
            Iif (this.parent.enableRtl) {
                this.falseLine.style.left = 'auto';
                this.falseLine.style.right = left + 'px';
                this.falseLine.style.transformOrigin = '100% 0%';
            }
            else {
                this.falseLine.style.right = 'auto';
                this.falseLine.style.left = left + 'px';
                this.falseLine.style.transformOrigin = '0% 100%';
            }
            this.parent.ganttChartModule.chartBodyContainer.appendChild(this.falseLine);
        };
        TaskbarEdit.prototype.removeFalseLine = function (isRemoveConnectorPointDisplay) {
            if (this.falseLine) {
                ej2_base_1.remove(this.falseLine);
                this.falseLine = null;
                Eif (isRemoveConnectorPointDisplay) {
                    this.elementOffsetLeft = 0;
                    this.elementOffsetTop = 0;
                    this.elementOffsetWidth = 0;
                    this.elementOffsetHeight = 0;
                    ej2_base_1.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll('.' + cls.connectorLineContainer), [cls.connectorLineZIndex]);
                }
            }
        };
        TaskbarEdit.prototype.updateConnectorLineSecondProperties = function (e) {
            var target = this.getElementByPosition(e);
            var element = utils_1.parentsUntil(target, cls.taskBarMainContainer);
            var isBigger = document.body.className.includes('e-bigger');
            this.connectorSecondAction = null;
            var scrollTop = 0;
            if (utils_1.parentsUntil(target, cls.connectorPointLeft)) {
                this.connectorSecondAction = 'ConnectorPointLeftDrag';
                this.toPredecessorText = 'Start';
            }
            else Eif (utils_1.parentsUntil(target, cls.connectorPointRight)) {
                this.connectorSecondAction = 'ConnectorPointRightDrag';
                this.toPredecessorText = 'Finish';
            }
            else {
                this.connectorSecondAction = null;
                this.toPredecessorText = null;
            }
            Eif (this.taskBarEditElement !== element && this.taskBarEditElement !== this.highlightedSecondElement) {
                Iif (this.parent.virtualScrollModule && this.parent.enableVirtualization) {
                    var top_1 = this.parent.virtualScrollModule.getTopPosition();
                    scrollTop = top_1;
                }
                Eif ((this.parent.virtualScrollModule && this.parent.enableVirtualization &&
                    !this.elementOffsetLeft) || !this.parent.enableVirtualization) {
                    Iif (!this.parent.allowParentDependency) {
                        this.elementOffsetLeft = this.realTaskbarElement.offsetLeft - ((isBigger) ? 10 : 0);
                        this.elementOffsetTop = this.realTaskbarElement.parentElement.offsetTop +
                            this.realTaskbarElement.offsetHeight / 3 + scrollTop;
                    }
                    else {
                        if (this.taskBarEditElement.children[0].classList.contains('e-manualparent-main-container')) {
                            this.elementOffsetLeft = this.realTaskbarElement.children[0]['offsetLeft'] +
                                this.realTaskbarElement.offsetLeft - ((isBigger) ? 10 : 0);
                            this.elementOffsetTop = ((this.realTaskbarElement.parentElement.offsetTop + this.realTaskbarElement.offsetHeight / 3 - 5) + this.taskBarEditElement.children[0]['offsetTop']) + scrollTop;
                        }
                        else {
                            this.elementOffsetLeft = this.realTaskbarElement.offsetLeft - ((isBigger) ? 10 : 0);
                            this.elementOffsetTop = this.realTaskbarElement.parentElement.offsetTop +
                                this.realTaskbarElement.offsetHeight / 3 + scrollTop;
                        }
                    }
                    this.elementOffsetWidth = this.realTaskbarElement.offsetWidth + ((isBigger) ? 20 : 0);
                    this.elementOffsetHeight = this.realTaskbarElement.offsetHeight;
                }
                this.showHideTaskBarEditingElements(element, this.highlightedSecondElement, true);
            }
            Iif (ej2_base_1.isNullOrUndefined(this.connectorSecondAction) && !ej2_base_1.isNullOrUndefined(this.connectorSecondElement) &&
                (!this.connectorSecondRecord.hasChildRecords || this.connectorSecondRecord.hasChildRecords &&
                    this.parent.allowParentDependency)) {
                this.editTooltip.showHideTaskbarEditTooltip(false, this.segmentIndex);
                ej2_base_1.removeClass([this.connectorSecondElement.querySelector('.' + cls.connectorPointLeft)], [cls.connectorPointAllowBlock]);
                ej2_base_1.removeClass([this.connectorSecondElement.querySelector('.' + cls.connectorPointRight)], [cls.connectorPointAllowBlock]);
            }
            this.connectorSecondElement = this.connectorSecondAction ? element : null;
            this.highlightedSecondElement = element;
            this.connectorSecondRecord = ej2_base_1.isNullOrUndefined(this.connectorSecondElement) ?
                null : this.parent.ganttChartModule.getRecordByTaskBar(this.connectorSecondElement);
        };
        TaskbarEdit.prototype.triggerDependencyEvent = function (e, mouseUp) {
            var parentWithZoomStyle = this.parent.element.closest('[style*="zoom"]');
            var zoomedPageY;
            Iif (parentWithZoomStyle) {
                var zoom1 = parseFloat(getComputedStyle(parentWithZoomStyle).zoom);
                zoomedPageY = e.pageY / zoom1;
            }
            var fromItem = this.taskBarEditRecord.ganttProperties;
            var toItem = this.connectorSecondRecord ? this.connectorSecondRecord.ganttProperties : null;
            var predecessor;
            var currentTarget;
            var target = this.getElementByPosition(e);
            var element = target;
            var uniqueId = this.parent.viewType === 'ResourceView' ? fromItem.taskId : fromItem.rowUniqueID;
            if (this.taskBarEditAction === 'ConnectorPointLeftDrag') {
                predecessor = uniqueId + (this.parent.enableRtl ? 'F' : 'S');
            }
            else Eif (this.taskBarEditAction === 'ConnectorPointRightDrag') {
                predecessor = uniqueId + (this.parent.enableRtl ? 'S' : 'F');
            }
            Eif (this.connectorSecondAction) {
                if (this.connectorSecondAction === 'ConnectorPointLeftDrag') {
                    predecessor += this.parent.enableRtl ? 'F' : 'S';
                    currentTarget = this.parent.enableRtl ? 'finish' : 'start';
                }
                else Eif (this.connectorSecondAction === 'ConnectorPointRightDrag') {
                    predecessor += this.parent.enableRtl ? 'S' : 'F';
                    currentTarget = this.parent.enableRtl ? 'start' : 'finish';
                }
            }
            Iif (ej2_base_1.isNullOrUndefined(toItem)) {
                this.drawPredecessor = false;
                return;
            }
            if (toItem.predecessorsName) {
                this.finalPredecessor = toItem.predecessorsName + ',' + predecessor;
            }
            else {
                this.finalPredecessor = predecessor;
            }
            var isValidLink = this.parent.connectorLineEditModule.validatePredecessorRelation(this.connectorSecondRecord, this.finalPredecessor);
            var predecessorArray = this.parent.predecessorModule.calculatePredecessor(predecessor, this.connectorSecondRecord);
            var args = {};
            args.fromItem = fromItem;
            args.toItem = toItem;
            args.newPredecessorString = this.finalPredecessor;
            args.predecessor = predecessorArray && predecessorArray[0];
            args.isValidLink = isValidLink;
            args.requestType = 'ValidateDependency';
            this.parent.trigger('actionBegin', args);
            Iif (!ej2_base_1.isNullOrUndefined(this.parent.loadingIndicator) && this.parent.loadingIndicator.indicatorType === 'Shimmer' && args.requestType !== 'ValidateDependency') {
                this.parent.showMaskRow();
            }
            else Iif (args.requestType !== 'ValidateDependency') {
                this.parent.showSpinner();
            }
            args.isValidLink = !isValidLink && args.isValidLink ? false : args.isValidLink;
            if (args.isValidLink) {
                Eif (!this.editTooltip.toolTipObj && !this.parent.isAdaptive) {
                    this.editTooltip.showHideTaskbarEditTooltip(true, this.segmentIndex);
                }
                Eif (!ej2_base_1.isNullOrUndefined(this.editTooltip.toolTipObj)) {
                    this.parent.connectorLineModule.tooltipTable.innerHTML = this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName, this.parent.editModule.taskbarEditModule.fromPredecessorText, '', '');
                    var table = this.parent.connectorLineModule.tooltipTable.querySelector('#toPredecessor').querySelectorAll('td');
                    table[1].innerText = toItem.taskName;
                    table[2].innerText = this.parent.localeObj.getConstant(currentTarget);
                    Eif (!ej2_base_1.isNullOrUndefined(this.parent.connectorLineModule.tooltipTable.parentElement) &&
                        !ej2_base_1.isNullOrUndefined(this.parent.connectorLineModule.tooltipTable.parentElement.parentElement)) {
                        var tooltipElement = this.parent.connectorLineModule.tooltipTable.parentElement.parentElement;
                        Iif (tooltipElement.offsetTop + tooltipElement.offsetHeight > zoomedPageY) {
                            tooltipElement.style.top = (e.pageY - tooltipElement.offsetHeight - 20) + 'px';
                        }
                    }
                }
                this.drawPredecessor = true;
            }
            else {
                Iif (this.parent.isAdaptive) {
                    if (target.classList.contains(cls.connectorPointLeft) ||
                        target.classList.contains(cls.connectorPointRight)) {
                        this.showHideActivePredecessors(true);
                    }
                }
                else {
                    ej2_base_1.addClass([element], [cls.connectorPointAllowBlock]);
                }
                this.drawPredecessor = false;
            }
        };
        TaskbarEdit.prototype.getCoordinate = function (event) {
            var coordinates = {};
            var e = event;
            coordinates.pageX = e.pageX;
            coordinates.pageY = e.pageY;
            Eif (event && event.type !== 'click') {
                var e_1 = event;
                if (e_1.type === 'touchmove' || e_1.type === 'touchstart' || e_1.type === 'touchend') {
                    coordinates.pageX = e_1.changedTouches[0].pageX;
                    coordinates.pageY = e_1.changedTouches[0].pageY;
                }
            }
            return coordinates;
        };
        TaskbarEdit.prototype.getElementByPosition = function (event) {
            if (!this.parent.isAdaptive) {
                return event.target;
            }
            else {
                var e = this.getCoordinate(event);
                return document.elementFromPoint((e.pageX - window.pageXOffset), (e.pageY - window.pageYOffset));
            }
        };
        TaskbarEdit.prototype.multipleSelectionEnabled = function () {
            Eif (this.parent.selectionModule &&
                this.parent.selectionSettings.mode !== 'Cell'
                && this.parent.selectionSettings.type === 'Multiple') {
                this.parent.selectionModule.hidePopUp();
            }
        };
        TaskbarEdit.prototype.unWireEvents = function () {
            if (this.parent.isDestroyed) {
                return;
            }
            this.parent.off('chartMouseDown', this.mouseDownHandler);
            this.parent.off('chartMouseUp', this.mouseUpHandler);
            this.parent.off('chartMouseLeave', this.mouseLeaveHandler);
            this.parent.off('chartMouseMove', this.mouseMoveAction);
            this.parent.off('chartMouseClick', this.mouseClickHandler);
        };
        TaskbarEdit.prototype.destroy = function () {
            this.unWireEvents();
            this.stopScrollTimer();
            this.parent.editModule.taskbarEditModule = undefined;
        };
        return TaskbarEdit;
    }(date_processor_1.DateProcessor));
    exports.TaskbarEdit = TaskbarEdit;
});