all files / document-editor/implementation/dialogs/ table-of-contents-dialog.js

85.1% Statements 777/913
74.52% Branches 272/365
69.44% Functions 25/36
85.1% Lines 777/913
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   147× 147× 147× 147× 147× 147× 147×   147×   147×   147×           147×     147×   147×                                                 147×                                                     147×               147×           147×                             147×                     147×       147×   14486×                                                                                                                                               63×     11× 11× 11×   11× 11× 11× 11× 11× 11× 11× 11×               11× 11×                                                                                                                                                                                                                     18×                                                                 14× 14× 14×         14×                                         18×                           203×   203×   203×   203×   203×   203×   203×   203×   203× 203× 203× 203× 203× 203× 203× 203× 203× 203× 203× 203× 203× 203× 203×             203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×     203×     203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×       203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×   203×          
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-buttons", "@syncfusion/ej2-dropdowns", "@syncfusion/ej2-inputs", "@syncfusion/ej2-lists", "@syncfusion/ej2-popups"], function (require, exports, ej2_base_1, ej2_buttons_1, ej2_dropdowns_1, ej2_inputs_1, ej2_lists_1, ej2_popups_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var TableOfContentsDialog = (function () {
        function TableOfContentsDialog(documentHelper) {
            var _this = this;
            this.changeStyleClickHandler = this.onChangeStyleClick.bind(this);
            this.changingStyleClickHandler = this.onChangingStyleClick.bind(this);
            this.resetClickHandler = this.onResetClick.bind(this);
            this.selectHandlerClickHandler = this.onSelectHandlerClick.bind(this);
            this.showDialogHandler = this.onShowDialog.bind(this);
            this.loadTableofContentDialog = function () {
                _this.documentHelper.updateFocus();
                _this.pageNumber.checked = true;
                _this.rightAlign.disabled = false;
                _this.rightAlign.checked = true;
                _this.tabLeader.enabled = true;
                _this.hyperlink.checked = true;
                _this.style.checked = true;
                _this.outline.checked = true;
                _this.outline.disabled = false;
                _this.showLevel.enabled = true;
            };
            this.closeTableOfContentDialog = function () {
                _this.unWireEventsAndBindings();
                _this.documentHelper.updateFocus();
            };
            this.onCancelButtonClick = function () {
                _this.documentHelper.dialog3.hide();
                _this.unWireEventsAndBindings();
                _this.documentHelper.updateFocus();
            };
            this.selectHandler = function (args) {
                _this.textBoxInput.value = args.text;
                var value = _this.textBoxInput;
                value.setSelectionRange(0, args.text.length);
                value.focus();
            };
            this.showStyleDialog = function () {
                if (!ej2_base_1.isNullOrUndefined(_this.documentHelper.owner.styleDialogModule)) {
                    _this.documentHelper.owner.styleDialogModule.show(_this.textBoxInput.value);
                }
            };
            this.reset = function () {
                _this.showLevel.enabled = true;
                _this.showLevel.value = 3;
                _this.outline.disabled = false;
                _this.outline.checked = true;
                var values = ['1', '2', '3', null, null, null, null, null, null];
                _this.changeByValue(values);
                _this.normal.value = null;
            };
            this.changeStyle = function (args) {
                var headingLevel = 0;
                if (!ej2_base_1.isNullOrUndefined(args.srcElement.value)) {
                    var headingValue = args.srcElement.value;
                    headingLevel = parseInt(headingValue);
                    if (!headingValue.match(/^[0-9]+$/) && headingValue !== '') {
                        _this.initAlertDialog(false);
                        return;
                    }
                    else if (headingLevel < 1 || headingLevel > 9) {
                        _this.initAlertDialog(true);
                        return;
                    }
                    else {
                        var value = _this.getElementValue(args.srcElement);
                        if (headingValue !== value && headingValue !== '') {
                            _this.showLevel.enabled = false;
                        }
                        else {
                            _this.showLevel.enabled = true;
                            _this.checkLevel();
                        }
                    }
                }
            };
            this.changeHeadingStyle = function (args) {
                var headingLevel = 0;
                if (!ej2_base_1.isNullOrUndefined(args.srcElement.value)) {
                    var headingValue = args.srcElement.value;
                    headingLevel = parseInt(headingValue);
                    if (!headingValue.match(/^[0-9]+$/) && headingValue !== '') {
                        _this.initAlertDialog(false);
                        return;
                    }
                    else if (headingLevel < 1 || headingLevel > 9) {
                        _this.initAlertDialog(true);
                        return;
                    }
                    else {
                        if (headingValue === '') {
                            _this.showLevel.enabled = true;
                        }
                        else {
                            _this.showLevel.enabled = false;
                        }
                        if (_this.normal === args.srcElement) {
                            _this.outline.checked = false;
                            _this.outline.disabled = true;
                        }
                    }
                }
            };
            this.changePageNumberValue = function (args) {
                Iif (args.checked) {
                    _this.rightAlign.checked = true;
                    _this.rightAlign.disabled = false;
                    _this.tabLeader.enabled = true;
                }
                else {
                    _this.rightAlign.disabled = true;
                    _this.tabLeader.enabled = false;
                }
            };
            this.changeRightAlignValue = function (args) {
                Iif (args.checked) {
                    _this.tabLeader.enabled = true;
                }
                else {
                    _this.tabLeader.enabled = false;
                }
            };
            this.changeStyleValue = function (args) {
                Iif (args.checked) {
                    _this.heading1.disabled = false;
                    _this.heading2.disabled = false;
                    _this.heading3.disabled = false;
                    _this.heading4.disabled = false;
                    _this.heading5.disabled = false;
                    _this.heading6.disabled = false;
                    _this.heading7.disabled = false;
                    _this.heading8.disabled = false;
                    _this.heading9.disabled = false;
                    _this.normal.disabled = false;
                }
                else {
                    _this.heading1.disabled = true;
                    _this.heading2.disabled = true;
                    _this.heading3.disabled = true;
                    _this.heading4.disabled = true;
                    _this.heading5.disabled = true;
                    _this.heading6.disabled = true;
                    _this.heading7.disabled = true;
                    _this.heading8.disabled = true;
                    _this.heading9.disabled = true;
                    _this.normal.disabled = true;
                }
            };
            this.applyTableOfContentProperties = function () {
                var tocSettings = {
                    startLevel: 1,
                    endLevel: _this.showLevel.value,
                    includeHyperlink: _this.hyperlink.checked,
                    includePageNumber: _this.pageNumber.checked,
                    rightAlign: _this.rightAlign.checked,
                    tabLeader: _this.tabLeader.value,
                    includeOutlineLevels: _this.outline.checked
                };
                Eif (_this.applyLevelSetting(tocSettings)) {
                    _this.documentHelper.owner.editorModule.insertTableOfContents(tocSettings);
                    _this.documentHelper.dialog3.hide();
                    _this.documentHelper.updateFocus();
                }
            };
            this.unWireEventsAndBindings = function () {
                _this.pageNumber.checked = false;
                _this.rightAlign.checked = false;
                Eif (_this.tabLeader) {
                    _this.tabLeader.value = '';
                }
                _this.hyperlink.checked = false;
                _this.style.checked = false;
                _this.outline.checked = false;
                Eif (_this.normal) {
                    _this.normal.value = '';
                }
            };
            this.documentHelper = documentHelper;
        }
        TableOfContentsDialog.prototype.getModuleName = function () {
            return 'TableOfContentsDialog';
        };
        TableOfContentsDialog.prototype.initTableOfContentDialog = function (locale, isRtl) {
            var instance = this;
            var ownerId = this.documentHelper.owner.containerId;
            var id = ownerId + '_toc_dialog';
            this.target = ej2_base_1.createElement('div', { id: id, className: 'e-de-toc-dlg-container' });
            this.generalDiv = ej2_base_1.createElement('div', { id: 'general_div', className: 'e-de-toc-dlg-sub-container' });
            this.target.appendChild(this.generalDiv);
            this.genLabel = ej2_base_1.createElement('div', { id: ownerId + '_genLabel', className: 'e-de-toc-dlg-main-heading', styles: 'margin-bottom: 13px;', innerHTML: locale.getConstant('General') });
            this.generalDiv.appendChild(this.genLabel);
            var leftGeneralDivStyles;
            var rightBottomGeneralDivStyles;
            if (isRtl) {
                leftGeneralDivStyles = 'float:right;';
                rightBottomGeneralDivStyles = 'float:left;position:relative;';
            }
            else {
                leftGeneralDivStyles = 'float:left;';
                rightBottomGeneralDivStyles = 'float:right;';
            }
            this.topContainer = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
            this.leftGeneralDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-left' });
            this.topContainer.appendChild(this.leftGeneralDiv);
            this.rightGeneralDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-right' });
            this.topContainer.appendChild(this.rightGeneralDiv);
            this.generalDiv.appendChild(this.topContainer);
            this.bottomContainer = ej2_base_1.createElement('div', { className: 'e-de-dlg-row' });
            this.leftBottomGeneralDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-left' });
            this.bottomContainer.appendChild(this.leftBottomGeneralDiv);
            this.rightBottomGeneralDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-right' });
            this.bottomContainer.appendChild(this.rightBottomGeneralDiv);
            this.pageNumberDiv = ej2_base_1.createElement('div', { className: 'e-de-toc-dlg-sub-container' });
            this.pageNumber1 = ej2_base_1.createElement('input', {
                attrs: { 'type': 'checkbox' }, id: this.target.id + '_pageNumber'
            });
            this.pageNumberDiv.appendChild(this.pageNumber1);
            this.rightAlignDiv = ej2_base_1.createElement('div', { className: 'e-de-toc-dlg-sub-container' });
            this.rightAlign1 = ej2_base_1.createElement('input', {
                attrs: { 'type': 'checkbox' }, id: this.target.id + '_rightAlign'
            });
            this.rightAlignDiv.appendChild(this.rightAlign1);
            this.pageNumber = new ej2_buttons_1.CheckBox({ label: locale.getConstant('Show page numbers'), enableRtl: isRtl, checked: true, change: this.changePageNumberValue });
            this.rightAlign = new ej2_buttons_1.CheckBox({ label: locale.getConstant('Right align page numbers'), enableRtl: isRtl, checked: true, change: this.changeRightAlignValue });
            this.pageNumber.appendTo(this.pageNumber1);
            this.rightAlign.appendTo(this.rightAlign1);
            this.tabDivContainer = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
            this.tabDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-left' });
            this.tabLeaderLabelDiv = ej2_base_1.createElement('div');
            this.tabLeaderLabel = ej2_base_1.createElement('label', { className: 'e-de-toc-dlg-heading', innerHTML: locale.getConstant('Tab leader') + ':' });
            this.tabLeaderLabelDiv.appendChild(this.tabLeaderLabel);
            this.tabLeaderDiv = ej2_base_1.createElement('div', { id: 'tabLeader_div' });
            this.tabLeader1 = ej2_base_1.createElement('select', {
                id: ownerId + '_tabLeader',
                innerHTML: '<option value="None">' + '(' + locale.getConstant('None').toLocaleLowerCase() + ')' +
                    '</option><option value="Dot" selected>' + '....................' +
                    '</option><option value="Hyphen">' + '-------------------' +
                    '</option><option value="Underscore">' + '____________' + '</option>'
            });
            this.tabLeaderDiv.appendChild(this.tabLeader1);
            this.tabDiv.appendChild(this.tabLeaderLabelDiv);
            this.tabDiv.appendChild(this.tabLeaderDiv);
            this.leftGeneralDiv.appendChild(this.pageNumberDiv);
            this.leftGeneralDiv.appendChild(this.rightAlignDiv);
            this.tabDivContainer.appendChild(this.tabDiv);
            this.tabLeader = new ej2_dropdowns_1.DropDownList({ enableRtl: isRtl });
            this.tabLeader.appendTo(this.tabLeader1);
            this.hyperlink1 = ej2_base_1.createElement('input', {
                attrs: { 'type': 'checkbox' }, id: this.target.id + '_hyperlink'
            });
            this.rightGeneralDiv.appendChild(this.hyperlink1);
            this.hyperlink = new ej2_buttons_1.CheckBox({ label: locale.getConstant('Use hyperlinks instead of page numbers'), cssClass: 'e-de-toc-label', enableRtl: isRtl, checked: true });
            this.hyperlink.appendTo(this.hyperlink1);
            this.showDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-right' });
            this.showLevelLabelDiv = ej2_base_1.createElement('div', { className: 'e-de-toc-dlg-show-level-div' });
            this.showLevelLabel = ej2_base_1.createElement('label', { className: 'e-de-toc-dlg-heading', innerHTML: locale.getConstant('Show levels') + ':' });
            this.showLevelLabelDiv.appendChild(this.showLevelLabel);
            this.showLevelDiv = ej2_base_1.createElement('div', { className: 'e-de-toc-dlg-showlevel-div' });
            this.showLevel1 = ej2_base_1.createElement('input', { id: ownerId + '_showLevel', attrs: { 'type': 'text', 'aria-label': 'showLevel' } });
            this.showLevelDiv.appendChild(this.showLevel1);
            this.showDiv.appendChild(this.showLevelLabelDiv);
            this.showDiv.appendChild(this.showLevelDiv);
            this.tabDivContainer.appendChild(this.showDiv);
            this.generalDiv.appendChild(this.tabDivContainer);
            this.showLevel = new ej2_inputs_1.NumericTextBox({ format: '#', value: 3, min: 1, max: 9, change: this.changeShowLevelValue.bind(this) });
            this.showLevel.appendTo(this.showLevel1);
            if (isRtl) {
                this.hyperlink.cssClass = 'e-de-toc-label-rtl';
                this.showLevelLabelDiv.classList.add('e-de-rtl');
                this.showLevelDiv.classList.add('e-de-rtl');
                this.rightBottomGeneralDiv.classList.add('e-de-rtl');
            }
            this.buildTableLabel = ej2_base_1.createElement('div', { className: 'e-de-toc-dlg-main-heading e-de-toc-dlg-build-table', innerHTML: locale.getConstant('Build table of contents from') + ':' });
            this.generalDiv.appendChild(this.bottomContainer);
            var style = ej2_base_1.createElement('input', {
                attrs: { 'type': 'checkbox' }, id: this.target.id + '_style',
            });
            this.leftBottomGeneralDiv.appendChild(this.buildTableLabel);
            this.leftBottomGeneralDiv.appendChild(style);
            this.style = new ej2_buttons_1.CheckBox({ label: locale.getConstant('Styles'), enableRtl: isRtl, checked: true, change: this.changeStyleValue });
            this.style.appendTo(style);
            this.table = ej2_base_1.createElement('TABLE', { styles: 'margin-top:3px;' });
            this.tr1 = ej2_base_1.createElement('tr');
            this.td1 = ej2_base_1.createElement('td', { styles: 'width:120px;padding-left:10px;' });
            this.availableLabel = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Available styles'), className: 'e-de-toc-dlg-main-heading e-de-toc-dlg-sub-level-heading', id: this.target.id + '_availableLabel'
            });
            this.td1.appendChild(this.availableLabel);
            this.td2 = ej2_base_1.createElement('td');
            this.tocLabel = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('TOC level') + ':', className: 'e-de-toc-dlg-main-heading e-de-toc-dlg-sub-level-heading',
                id: this.target.id + '_tocLabel'
            });
            this.td2.appendChild(this.tocLabel);
            this.tr1.appendChild(this.td1);
            this.tr1.appendChild(this.td2);
            this.table.appendChild(this.tr1);
            this.tableDiv = ej2_base_1.createElement('div', { id: 'table_div', className: 'e-de-toc-table-div' });
            this.table1 = ej2_base_1.createElement('TABLE');
            this.tr2 = ej2_base_1.createElement('tr');
            this.td3 = ej2_base_1.createElement('td');
            this.heading1Label = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Heading') + ' 1',
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_heading1Label'
            });
            this.td3.appendChild(this.heading1Label);
            this.td4 = ej2_base_1.createElement('td');
            this.heading1 = ej2_base_1.createElement('input', { id: '_heading1', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Heading') + ' 1' } });
            this.heading1.value = '1';
            this.heading1.addEventListener('keyup', this.changeStyleClickHandler);
            this.td4.appendChild(this.heading1);
            this.tr2.appendChild(this.td3);
            this.tr2.appendChild(this.td4);
            this.tr3 = ej2_base_1.createElement('tr');
            this.td5 = ej2_base_1.createElement('td');
            this.heading2Label = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Heading') + ' 2',
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_heading2Label'
            });
            this.td5.appendChild(this.heading2Label);
            this.td6 = ej2_base_1.createElement('td');
            this.heading2 = ej2_base_1.createElement('input', { id: '_heading2', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Heading') + ' 2' } });
            this.heading2.value = '2';
            this.heading2.addEventListener('keyup', this.changeStyleClickHandler);
            this.td6.appendChild(this.heading2);
            this.tr3.appendChild(this.td5);
            this.tr3.appendChild(this.td6);
            this.tr4 = ej2_base_1.createElement('tr');
            this.td7 = ej2_base_1.createElement('td');
            this.heading3Label = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Heading') + ' 3',
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_heading3Label'
            });
            this.td7.appendChild(this.heading3Label);
            this.td8 = ej2_base_1.createElement('td');
            this.heading3 = ej2_base_1.createElement('input', { id: '_heading3', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Heading') + ' 3' } });
            this.heading3.value = '3';
            this.heading3.addEventListener('keyup', this.changeStyleClickHandler);
            this.td8.appendChild(this.heading3);
            this.tr4.appendChild(this.td7);
            this.tr4.appendChild(this.td8);
            this.tr5 = ej2_base_1.createElement('tr');
            this.td9 = ej2_base_1.createElement('td');
            this.heading4Label = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Heading') + ' 4',
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_heading4Label'
            });
            this.td9.appendChild(this.heading4Label);
            this.td10 = ej2_base_1.createElement('td');
            this.heading4 = ej2_base_1.createElement('input', { id: '_heading4', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Heading') + ' 4' } });
            this.heading4.addEventListener('keyup', this.changeStyleClickHandler);
            this.td10.appendChild(this.heading4);
            this.tr5.appendChild(this.td9);
            this.tr5.appendChild(this.td10);
            this.tr6 = ej2_base_1.createElement('tr');
            this.td11 = ej2_base_1.createElement('td');
            this.heading5Label = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Heading') + ' 5',
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_heading5Label'
            });
            this.td11.appendChild(this.heading5Label);
            this.td12 = ej2_base_1.createElement('td');
            this.heading5 = ej2_base_1.createElement('input', { id: '_heading5', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Heading') + ' 5' } });
            this.heading5.addEventListener('keyup', this.changeStyleClickHandler);
            this.td12.appendChild(this.heading5);
            this.tr6.appendChild(this.td11);
            this.tr6.appendChild(this.td12);
            this.tr7 = ej2_base_1.createElement('tr');
            this.td13 = ej2_base_1.createElement('td');
            this.heading6Label = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Heading') + ' 6',
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_heading6Label'
            });
            this.td13.appendChild(this.heading6Label);
            this.td14 = ej2_base_1.createElement('td');
            this.heading6 = ej2_base_1.createElement('input', { id: '_heading6', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Heading') + ' 6' } });
            this.heading6.addEventListener('keyup', this.changeStyleClickHandler);
            this.td14.appendChild(this.heading6);
            this.tr7.appendChild(this.td13);
            this.tr7.appendChild(this.td14);
            this.tr8 = ej2_base_1.createElement('tr');
            this.td15 = ej2_base_1.createElement('td');
            this.heading7Label = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Heading') + ' 7',
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_heading7Label'
            });
            this.td15.appendChild(this.heading7Label);
            this.td16 = ej2_base_1.createElement('td');
            this.heading7 = ej2_base_1.createElement('input', { id: '_heading7', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Heading') + ' 7' } });
            this.heading7.addEventListener('keyup', this.changeStyleClickHandler);
            this.td16.appendChild(this.heading7);
            this.tr8.appendChild(this.td15);
            this.tr8.appendChild(this.td16);
            this.tr9 = ej2_base_1.createElement('tr');
            this.td17 = ej2_base_1.createElement('td');
            this.heading8Label = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Heading') + ' 8',
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_heading8Label'
            });
            this.td17.appendChild(this.heading8Label);
            this.td18 = ej2_base_1.createElement('td');
            this.heading8 = ej2_base_1.createElement('input', { id: '_heading8', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Heading') + ' 8' } });
            this.heading8.addEventListener('keyup', this.changeStyleClickHandler);
            this.td18.appendChild(this.heading8);
            this.tr9.appendChild(this.td17);
            this.tr9.appendChild(this.td18);
            this.tr10 = ej2_base_1.createElement('tr');
            this.td19 = ej2_base_1.createElement('td');
            this.heading9Label = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Heading') + ' 9',
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_heading9Label'
            });
            this.td19.appendChild(this.heading9Label);
            this.td20 = ej2_base_1.createElement('td');
            this.heading9 = ej2_base_1.createElement('input', { id: '_heading9', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Heading') + ' 9' } });
            this.heading9.addEventListener('keyup', this.changeStyleClickHandler);
            this.td20.appendChild(this.heading9);
            this.tr10.appendChild(this.td19);
            this.tr10.appendChild(this.td20);
            this.tr12 = ej2_base_1.createElement('tr');
            this.td23 = ej2_base_1.createElement('td');
            this.normalLabel = ej2_base_1.createElement('label', {
                innerHTML: locale.getConstant('Normal'),
                className: 'e-de-toc-dlg-sub-heading', id: this.target.id + '_normalLabel'
            });
            this.td23.appendChild(this.normalLabel);
            this.td24 = ej2_base_1.createElement('td');
            this.normal = ej2_base_1.createElement('input', { id: '_normal', className: 'e-input e-de-toc-dlg-toc-level', attrs: { 'aria-label': locale.getConstant('Normal') } });
            this.normal.addEventListener('keyup', this.changingStyleClickHandler);
            this.td24.appendChild(this.normal);
            this.tr12.appendChild(this.td23);
            this.tr12.appendChild(this.td24);
            if (isRtl) {
                this.normal.classList.add('e-de-rtl');
                this.heading1.classList.add('e-de-rtl');
                this.heading2.classList.add('e-de-rtl');
                this.heading3.classList.add('e-de-rtl');
                this.heading4.classList.add('e-de-rtl');
                this.heading5.classList.add('e-de-rtl');
                this.heading6.classList.add('e-de-rtl');
                this.heading7.classList.add('e-de-rtl');
                this.heading8.classList.add('e-de-rtl');
                this.heading9.classList.add('e-de-rtl');
            }
            this.table1.appendChild(this.tr2);
            this.table1.appendChild(this.tr3);
            this.table1.appendChild(this.tr4);
            this.table1.appendChild(this.tr5);
            this.table1.appendChild(this.tr6);
            this.table1.appendChild(this.tr7);
            this.table1.appendChild(this.tr8);
            this.table1.appendChild(this.tr9);
            this.table1.appendChild(this.tr10);
            this.table1.appendChild(this.tr12);
            this.tableDiv.appendChild(this.table1);
            this.stylesLevelDiv = ej2_base_1.createElement('div', { className: 'e-de-toc-styles-table-div' });
            this.stylesLevelDiv.appendChild(this.table);
            this.stylesLevelDiv.appendChild(this.tableDiv);
            this.leftBottomGeneralDiv.appendChild(this.stylesLevelDiv);
            this.fieldsDiv = ej2_base_1.createElement('div', { id: 'fields_div', styles: 'display: flex;' });
            this.leftBottomGeneralDiv.appendChild(this.fieldsDiv);
            this.outDiv = ej2_base_1.createElement('div', { id: 'out_div' });
            this.outlineDiv = ej2_base_1.createElement('div', { id: 'outline_div', className: 'e-de-toc-dlg-sub-container e-de-toc-dlg-outline-levels' });
            this.outline1 = ej2_base_1.createElement('input', {
                attrs: { 'type': 'checkbox' }, id: '_outline'
            });
            this.outlineDiv.appendChild(this.outline1);
            this.outDiv.appendChild(this.outlineDiv);
            this.fieldsDiv.appendChild(this.outDiv);
            this.outline = new ej2_buttons_1.CheckBox({
                label: locale.getConstant('Outline levels'),
                enableRtl: isRtl, checked: true, cssClass: 'e-de-outline-rtl'
            });
            this.outline.appendTo(this.outline1);
            this.resetButtonDiv = ej2_base_1.createElement('div', { className: 'e-de-toc-reset-button' });
            this.fieldsDiv.appendChild(this.resetButtonDiv);
            this.resetElement = ej2_base_1.createElement('button', {
                innerHTML: locale.getConstant('Reset'), id: 'reset',
                attrs: { type: 'button' }
            });
            this.resetButtonDiv.appendChild(this.resetElement);
            this.resetButton = new ej2_buttons_1.Button({ cssClass: 'e-btn e-flat' });
            this.resetButton.appendTo(this.resetElement);
            this.resetElement.addEventListener('click', this.resetClickHandler);
            this.tocStylesLabel = ej2_base_1.createElement('div', {
                id: ownerId + '_tocStylesLabel', className: 'e-de-toc-dlg-main-heading',
                innerHTML: locale.getConstant('Styles') + ':'
            });
            this.rightBottomGeneralDiv.appendChild(this.tocStylesLabel);
            this.textBoxDiv = ej2_base_1.createElement('div');
            this.rightBottomGeneralDiv.appendChild(this.textBoxDiv);
            this.textBoxInput = ej2_base_1.createElement('input', { className: 'e-input', attrs: { 'aria-label': 'Type of TOC' } });
            this.textBoxInput.setAttribute('type', 'text');
            this.textBoxDiv.appendChild(this.textBoxInput);
            this.listViewDiv = ej2_base_1.createElement('div', { className: 'e-de-toc-list-view' });
            var styleLocale = ['TOC 1', 'TOC 2', 'TOC 3', 'TOC 4', 'TOC 5', 'TOC 6', 'TOC 7', 'TOC 8', 'TOC 9'];
            var styleValues = this.styleLocaleValue(styleLocale, locale);
            this.listViewInstance = new ej2_lists_1.ListView({ dataSource: styleValues, cssClass: 'e-toc-list-view' });
            this.listViewInstance.appendTo(this.listViewDiv);
            this.listViewInstance.addEventListener('select', this.selectHandlerClickHandler);
            this.rightBottomGeneralDiv.appendChild(this.listViewDiv);
            this.modifyButtonDiv = ej2_base_1.createElement('div', { className: 'e-de-toc-modify-button' });
            this.rightBottomGeneralDiv.appendChild(this.modifyButtonDiv);
            this.modifyElement = ej2_base_1.createElement('button', {
                innerHTML: locale.getConstant('Modify') + '...', id: 'modify',
                attrs: { type: 'button' }
            });
            this.modifyButtonDiv.appendChild(this.modifyElement);
            this.modifyButton = new ej2_buttons_1.Button({ cssClass: 'e-btn e-flat' });
            this.modifyButton.appendTo(this.modifyElement);
            this.modifyElement.addEventListener('click', this.showDialogHandler);
            if (isRtl) {
                this.resetButtonDiv.classList.add('e-de-rtl');
                this.tocStylesLabel.classList.add('e-de-rtl');
                this.textBoxDiv.classList.add('e-de-rtl');
                this.listViewDiv.classList.add('e-de-rtl');
                this.modifyButtonDiv.classList.add('e-de-rtl');
            }
        };
        TableOfContentsDialog.prototype.styleLocaleValue = function (styleLocale, localValue) {
            var styleName = [];
            for (var index = 0; index < styleLocale.length; index++) {
                styleName.push(localValue.getConstant(styleLocale[index]));
            }
            return styleName;
        };
        TableOfContentsDialog.prototype.show = function () {
            var localValue = new ej2_base_1.L10n('documenteditor', this.documentHelper.owner.defaultLocale);
            localValue.setLocale(this.documentHelper.owner.locale);
            if (!this.target) {
                this.initTableOfContentDialog(localValue, this.documentHelper.owner.enableRtl);
            }
            this.documentHelper.dialog3.header = localValue.getConstant('Table of Contents');
            this.documentHelper.dialog3.position = { X: 'center', Y: 'center' };
            this.documentHelper.dialog3.width = 'auto';
            this.documentHelper.dialog3.height = 'auto';
            this.documentHelper.dialog3.content = this.target;
            this.documentHelper.dialog3.beforeOpen = this.loadTableofContentDialog;
            this.documentHelper.dialog3.close = this.closeTableOfContentDialog;
            this.documentHelper.dialog3.buttons = [{
                    click: this.applyTableOfContentProperties,
                    buttonModel: { content: localValue.getConstant('Ok'), cssClass: 'e-flat e-toc-okay', isPrimary: true }
                },
                {
                    click: this.onCancelButtonClick,
                    buttonModel: { content: localValue.getConstant('Cancel'), cssClass: 'e-flat e-toc-cancel' }
                }];
            this.documentHelper.dialog3.dataBind();
            this.documentHelper.dialog3.show();
        };
        TableOfContentsDialog.prototype.onSelectHandlerClick = function (args) {
            this.selectHandler(args);
        };
        TableOfContentsDialog.prototype.onShowDialog = function () {
            this.showStyleDialog();
        };
        TableOfContentsDialog.prototype.changeShowLevelValue = function (event) {
            var levels = event.value;
            var values = [];
            switch (levels) {
                case 1:
                    values = ['1', null, null, null, null, null, null, null, null];
                    this.changeByValue(values);
                    break;
                case 2:
                    values = ['1', '2', null, null, null, null, null, null, null];
                    this.changeByValue(values);
                    break;
                case 3:
                    values = ['1', '2', '3', null, null, null, null, null, null];
                    this.changeByValue(values);
                    break;
                case 4:
                    values = ['1', '2', '3', '4', null, null, null, null, null];
                    this.changeByValue(values);
                    break;
                case 5:
                    values = ['1', '2', '3', '4', '5', null, null, null, null];
                    this.changeByValue(values);
                    break;
                case 6:
                    values = ['1', '2', '3', '4', '5', '6', null, null, null];
                    this.changeByValue(values);
                    break;
                case 7:
                    values = ['1', '2', '3', '4', '5', '6', '7', null, null];
                    this.changeByValue(values);
                    break;
                case 8:
                    values = ['1', '2', '3', '4', '5', '6', '7', '8', null];
                    this.changeByValue(values);
                    break;
                case 9:
                    values = ['1', '2', '3', '4', '5', '6', '7', '8', '9'];
                    this.changeByValue(values);
                    break;
            }
        };
        TableOfContentsDialog.prototype.changeByValue = function (headings) {
            this.heading1.value = headings[0];
            this.heading2.value = headings[1];
            this.heading3.value = headings[2];
            this.heading4.value = headings[3];
            this.heading5.value = headings[4];
            this.heading6.value = headings[5];
            this.heading7.value = headings[6];
            this.heading8.value = headings[7];
            this.heading9.value = headings[8];
        };
        TableOfContentsDialog.prototype.onResetClick = function () {
            this.reset();
        };
        TableOfContentsDialog.prototype.onChangeStyleClick = function (args) {
            this.changeStyle(args);
        };
        TableOfContentsDialog.prototype.initAlertDialog = function (isvalid) {
            var localValue = new ej2_base_1.L10n("documenteditor", this.documentHelper.owner.defaultLocale);
            localValue.setLocale(this.documentHelper.owner.locale);
            var dialogContent = isvalid ? localValue.getConstant("The number must be between") : localValue.getConstant("The Invalid number");
            ej2_popups_1.DialogUtility.alert({
                title: localValue.getConstant("Information"),
                content: dialogContent,
                closeOnEscape: true,
                showCloseIcon: true,
                position: { X: "center", Y: "center" },
            }).enableRtl = this.documentHelper.owner.enableRtl;
        };
        TableOfContentsDialog.prototype.checkLevel = function () {
            if (this.heading1.value !== '') {
                this.showLevel.value = 1;
            }
            if (this.heading2.value !== '') {
                this.showLevel.value = 2;
            }
            if (this.heading3.value !== '') {
                this.showLevel.value = 3;
            }
            if (this.heading4.value !== '') {
                this.showLevel.value = 4;
            }
            if (this.heading5.value !== '') {
                this.showLevel.value = 5;
            }
            if (this.heading6.value !== '') {
                this.showLevel.value = 6;
            }
            if (this.heading7.value !== '') {
                this.showLevel.value = 7;
            }
            if (this.heading8.value !== '') {
                this.showLevel.value = 8;
            }
            if (this.heading9.value !== '') {
                this.showLevel.value = 9;
            }
        };
        TableOfContentsDialog.prototype.getElementValue = function (element) {
            switch (element) {
                case this.heading1:
                    return '1';
                case this.heading2:
                    return '2';
                case this.heading3:
                    return '3';
                case this.heading4:
                    return '4';
                case this.heading5:
                    return '5';
                case this.heading6:
                    return '6';
                case this.heading7:
                    return '7';
                case this.heading8:
                    return '8';
                case this.heading9:
                    return '9';
                default:
                    return '1';
            }
        };
        TableOfContentsDialog.prototype.onChangingStyleClick = function (args) {
            this.changeHeadingStyle(args);
        };
        TableOfContentsDialog.prototype.getHeadingLevel = function (index) {
            switch (index) {
                case 1:
                    return parseInt(this.heading1.value);
                case 2:
                    return parseInt(this.heading2.value);
                case 3:
                    return parseInt(this.heading3.value);
                case 4:
                    return parseInt(this.heading4.value);
                case 5:
                    return parseInt(this.heading5.value);
                case 6:
                    return parseInt(this.heading6.value);
                case 7:
                    return parseInt(this.heading7.value);
                case 8:
                    return parseInt(this.heading8.value);
                case 9:
                    return parseInt(this.heading9.value);
                default:
                    return 0;
            }
        };
        TableOfContentsDialog.prototype.applyLevelSetting = function (tocSettings) {
            tocSettings.levelSettings = {};
            var headingPrefix = 'Heading ';
            var newStartLevel = 0;
            var newEndLevel = 0;
            var isEndLevel = false;
            for (var i = 1; i <= tocSettings.endLevel; i++) {
                var outlineLevelValue = this.getTOCInputValue(i);
                var outlineLevel = this.getHeadingLevel(i);
                Eif (i === outlineLevel && outlineLevelValue.match(/^[0-9]+$/)) {
                    if (newStartLevel === 0) {
                        newStartLevel = i;
                        isEndLevel = false;
                    }
                    Eif (!isEndLevel) {
                        newEndLevel = i;
                    }
                }
                else {
                    isEndLevel = true;
                    if (!outlineLevelValue.match(/^[0-9]+$/)) {
                        this.initAlertDialog(false);
                        return false;
                    }
                    else if (outlineLevel < 1 || outlineLevel > 9) {
                        this.initAlertDialog(true);
                        return false;
                    }
                    else {
                        var headingStyle = headingPrefix + i.toString();
                        tocSettings.levelSettings[headingStyle] = outlineLevel;
                    }
                }
            }
            tocSettings.startLevel = newStartLevel;
            tocSettings.endLevel = newEndLevel;
            Eif (newEndLevel) {
                for (var j = newEndLevel + 1; j <= 9; j++) {
                    var outlineHeader = this.getTOCInputValue(j);
                    var outlineLevel = this.getHeadingLevel(j);
                    Iif (!outlineHeader.match(/^[0-9]+$/) && outlineHeader !== "") {
                        this.initAlertDialog(false);
                        return false;
                    }
                    else {
                        Iif (outlineLevel < 1 || outlineLevel > 9) {
                            this.initAlertDialog(true);
                            return false;
                        }
                    }
                }
            }
            Iif (this.normal.value !== '') {
                var normalvalue = parseInt(this.normal.value);
                if (!this.normal.value.match(/^[0-9]+$/)) {
                    this.initAlertDialog(false);
                    return false;
                }
                else if (normalvalue < 1 || normalvalue > 9) {
                    this.initAlertDialog(true);
                    return false;
                }
                else {
                    tocSettings.levelSettings["Normal"] = normalvalue;
                }
            }
            return true;
        };
        TableOfContentsDialog.prototype.getTOCInputValue = function (input) {
            switch (input) {
                case 1:
                    return this.heading1.value;
                case 2:
                    return this.heading2.value;
                case 3:
                    return this.heading3.value;
                case 4:
                    return this.heading4.value;
                case 5:
                    return this.heading5.value;
                case 6:
                    return this.heading6.value;
                case 7:
                    return this.heading7.value;
                case 8:
                    return this.heading8.value;
                case 9:
                    return this.heading9.value;
                default:
                    return "";
            }
        };
        TableOfContentsDialog.prototype.destroy = function () {
            if (this.pageNumber) {
                this.pageNumber.destroy();
                this.pageNumber = undefined;
            }
            if (this.rightAlign) {
                this.rightAlign.destroy();
                this.rightAlign = undefined;
            }
            if (this.tabLeader) {
                this.tabLeader.destroy();
                this.tabLeader = undefined;
            }
            if (this.showLevel) {
                this.showLevel.destroy();
                this.showLevel = undefined;
            }
            if (this.hyperlink) {
                this.hyperlink.destroy();
                this.hyperlink = undefined;
            }
            if (this.style) {
                this.style.destroy();
                this.style = undefined;
            }
            if (this.outline) {
                this.outline.destroy();
                this.outline = undefined;
            }
            if (this.listViewInstance) {
                this.listViewInstance.destroy();
                this.listViewInstance = undefined;
            }
            this.removeEvents();
            this.removeElements();
            this.heading1 = undefined;
            this.heading2 = undefined;
            this.heading3 = undefined;
            this.heading4 = undefined;
            this.heading5 = undefined;
            this.heading6 = undefined;
            this.heading7 = undefined;
            this.heading8 = undefined;
            this.heading9 = undefined;
            this.normal = undefined;
            this.textBoxInput = undefined;
            this.documentHelper = undefined;
            if (!ej2_base_1.isNullOrUndefined(this.target)) {
                if (this.target.parentElement) {
                    this.target.parentElement.removeChild(this.target);
                }
                for (var count = 0; count < this.target.childNodes.length; count++) {
                    this.target.removeChild(this.target.childNodes[count]);
                    count--;
                }
                this.target = undefined;
            }
        };
        TableOfContentsDialog.prototype.removeEvents = function () {
            if (this.heading1) {
                this.heading1.removeEventListener('keyup', this.changeStyleClickHandler);
            }
            if (this.heading2) {
                this.heading2.removeEventListener('keyup', this.changeStyleClickHandler);
            }
            if (this.heading3) {
                this.heading3.removeEventListener('keyup', this.changeStyleClickHandler);
            }
            if (this.heading4) {
                this.heading4.removeEventListener('keyup', this.changeStyleClickHandler);
            }
            if (this.heading5) {
                this.heading5.removeEventListener('keyup', this.changeStyleClickHandler);
            }
            if (this.heading6) {
                this.heading6.removeEventListener('keyup', this.changeStyleClickHandler);
            }
            if (this.heading7) {
                this.heading7.removeEventListener('keyup', this.changeStyleClickHandler);
            }
            if (this.heading8) {
                this.heading8.removeEventListener('keyup', this.changeStyleClickHandler);
            }
            if (this.heading9) {
                this.heading9.removeEventListener('keyup', this.changeStyleClickHandler);
            }
            if (this.normal) {
                this.normal.removeEventListener('keyup', this.changingStyleClickHandler);
            }
            if (this.resetElement) {
                this.resetElement.removeEventListener('click', this.resetClickHandler);
            }
            Iif (this.listViewInstance) {
                this.listViewInstance.removeEventListener('select', this.selectHandlerClickHandler);
            }
            if (this.modifyElement) {
                this.modifyElement.removeEventListener('click', this.showDialogHandler);
            }
        };
        TableOfContentsDialog.prototype.removeElements = function () {
            if (this.generalDiv) {
                this.generalDiv.remove();
                this.generalDiv = undefined;
            }
            if (this.genLabel) {
                this.genLabel.remove();
                this.genLabel = undefined;
            }
            if (this.topContainer) {
                this.topContainer.remove();
                this.topContainer = undefined;
            }
            if (this.leftGeneralDiv) {
                this.leftGeneralDiv.remove();
                this.leftGeneralDiv = undefined;
            }
            if (this.rightGeneralDiv) {
                this.rightGeneralDiv.remove();
                this.rightGeneralDiv = undefined;
            }
            if (this.bottomContainer) {
                this.bottomContainer.remove();
                this.bottomContainer = undefined;
            }
            if (this.leftBottomGeneralDiv) {
                this.leftBottomGeneralDiv.remove();
                this.leftBottomGeneralDiv = undefined;
            }
            if (this.rightBottomGeneralDiv) {
                this.rightBottomGeneralDiv.remove();
                this.rightBottomGeneralDiv = undefined;
            }
            if (this.pageNumberDiv) {
                this.pageNumberDiv.remove();
                this.pageNumberDiv = undefined;
            }
            if (this.pageNumber1) {
                this.pageNumber1.remove();
                this.pageNumber1 = undefined;
            }
            if (this.rightAlignDiv) {
                this.rightAlignDiv.remove();
                this.rightAlignDiv = undefined;
            }
            if (this.rightAlign1) {
                this.rightAlign1.remove();
                this.rightAlign1 = undefined;
            }
            if (this.tabDivContainer) {
                this.tabDivContainer.remove();
                this.tabDivContainer = undefined;
            }
            if (this.tabDiv) {
                this.tabDiv.remove();
                this.tabDiv = undefined;
            }
            if (this.tabLeaderLabelDiv) {
                this.tabLeaderLabelDiv.remove();
                this.tabLeaderLabelDiv = undefined;
            }
            if (this.tabLeaderLabel) {
                this.tabLeaderLabel.remove();
                this.tabLeaderLabel = undefined;
            }
            if (this.tabLeaderDiv) {
                this.tabLeaderDiv.remove();
                this.tabLeaderDiv = undefined;
            }
            if (this.tabLeader1) {
                this.tabLeader1.remove();
                this.tabLeader1 = undefined;
            }
            if (this.hyperlink1) {
                this.hyperlink1.remove();
                this.hyperlink1 = undefined;
            }
            Iif (this.hyperlink1) {
                this.hyperlink1.remove();
                this.hyperlink1 = undefined;
            }
            if (this.showDiv) {
                this.showDiv.remove();
                this.showDiv = undefined;
            }
            if (this.showLevelLabelDiv) {
                this.showLevelLabelDiv.remove();
                this.showLevelLabelDiv = undefined;
            }
            if (this.showLevelLabel) {
                this.showLevelLabel.remove();
                this.showLevelLabel = undefined;
            }
            if (this.showLevelDiv) {
                this.showLevelDiv.remove();
                this.showLevelDiv = undefined;
            }
            if (this.showLevel1) {
                this.showLevel1.remove();
                this.showLevel1 = undefined;
            }
            if (this.buildTableLabel) {
                this.buildTableLabel.remove();
                this.buildTableLabel = undefined;
            }
            if (this.table) {
                this.table.remove();
                this.table = undefined;
            }
            if (this.tr1) {
                this.tr1.remove();
                this.tr1 = undefined;
            }
            if (this.td1) {
                this.td1.remove();
                this.td1 = undefined;
            }
            if (this.availableLabel) {
                this.availableLabel.remove();
                this.availableLabel = undefined;
            }
            if (this.td2) {
                this.td2.remove();
                this.td2 = undefined;
            }
            if (this.tocLabel) {
                this.tocLabel.remove();
                this.tocLabel = undefined;
            }
            if (this.tableDiv) {
                this.tableDiv.remove();
                this.tableDiv = undefined;
            }
            if (this.table1) {
                this.table1.remove();
                this.table1 = undefined;
            }
            if (this.tr2) {
                this.tr2.remove();
                this.tr2 = undefined;
            }
            if (this.td3) {
                this.td3.remove();
                this.td3 = undefined;
            }
            if (this.heading1Label) {
                this.heading1Label.remove();
                this.heading1Label = undefined;
            }
            if (this.td4) {
                this.td4.remove();
                this.td4 = undefined;
            }
            if (this.tr3) {
                this.tr3.remove();
                this.tr3 = undefined;
            }
            if (this.td5) {
                this.td5.remove();
                this.td5 = undefined;
            }
            if (this.heading2Label) {
                this.heading2Label.remove();
                this.heading2Label = undefined;
            }
            if (this.td6) {
                this.td6.remove();
                this.td6 = undefined;
            }
            if (this.tr4) {
                this.tr4.remove();
                this.tr4 = undefined;
            }
            if (this.td7) {
                this.td7.remove();
                this.td7 = undefined;
            }
            if (this.heading3Label) {
                this.heading3Label.remove();
                this.heading3Label = undefined;
            }
            if (this.td8) {
                this.td8.remove();
                this.td8 = undefined;
            }
            if (this.tr5) {
                this.tr5.remove();
                this.tr5 = undefined;
            }
            if (this.td9) {
                this.td9.remove();
                this.td9 = undefined;
            }
            if (this.heading4Label) {
                this.heading4Label.remove();
                this.heading4Label = undefined;
            }
            if (this.td10) {
                this.td10.remove();
                this.td10 = undefined;
            }
            if (this.tr6) {
                this.tr6.remove();
                this.tr6 = undefined;
            }
            if (this.td11) {
                this.td11.remove();
                this.td11 = undefined;
            }
            if (this.heading5Label) {
                this.heading5Label.remove();
                this.heading5Label = undefined;
            }
            if (this.td12) {
                this.td12.remove();
                this.td12 = undefined;
            }
            if (this.tr7) {
                this.tr7.remove();
                this.tr7 = undefined;
            }
            if (this.td13) {
                this.td13.remove();
                this.td13 = undefined;
            }
            if (this.heading6Label) {
                this.heading6Label.remove();
                this.heading6Label = undefined;
            }
            if (this.td14) {
                this.td14.remove();
                this.td14 = undefined;
            }
            if (this.tr8) {
                this.tr8.remove();
                this.tr8 = undefined;
            }
            if (this.td15) {
                this.td15.remove();
                this.td15 = undefined;
            }
            if (this.heading7Label) {
                this.heading7Label.remove();
                this.heading7Label = undefined;
            }
            if (this.td16) {
                this.td16.remove();
                this.td16 = undefined;
            }
            if (this.tr9) {
                this.tr9.remove();
                this.tr9 = undefined;
            }
            if (this.td17) {
                this.td17.remove();
                this.td17 = undefined;
            }
            if (this.heading8Label) {
                this.heading8Label.remove();
                this.heading8Label = undefined;
            }
            if (this.td18) {
                this.td18.remove();
                this.td18 = undefined;
            }
            if (this.tr10) {
                this.tr10.remove();
                this.tr10 = undefined;
            }
            if (this.td19) {
                this.td19.remove();
                this.td19 = undefined;
            }
            if (this.heading9Label) {
                this.heading9Label.remove();
                this.heading9Label = undefined;
            }
            if (this.td20) {
                this.td20.remove();
                this.td20 = undefined;
            }
            if (this.tr12) {
                this.tr12.remove();
                this.tr12 = undefined;
            }
            if (this.td23) {
                this.td23.remove();
                this.td23 = undefined;
            }
            if (this.normalLabel) {
                this.normalLabel.remove();
                this.normalLabel = undefined;
            }
            if (this.td24) {
                this.td24.remove();
                this.td24 = undefined;
            }
            if (this.stylesLevelDiv) {
                this.stylesLevelDiv.remove();
                this.stylesLevelDiv = undefined;
            }
            if (this.fieldsDiv) {
                this.fieldsDiv.remove();
                this.fieldsDiv = undefined;
            }
            if (this.outDiv) {
                this.outDiv.remove();
                this.outDiv = undefined;
            }
            if (this.outlineDiv) {
                this.outlineDiv.remove();
                this.outlineDiv = undefined;
            }
            if (this.outline1) {
                this.outline1.remove();
                this.outline1 = undefined;
            }
            if (this.resetButtonDiv) {
                this.resetButtonDiv.remove();
                this.resetButtonDiv = undefined;
            }
            if (this.resetElement) {
                this.resetElement.remove();
                this.resetElement = undefined;
            }
            if (this.resetButton) {
                this.resetButton.destroy();
                this.resetButton = undefined;
            }
            if (this.tocStylesLabel) {
                this.tocStylesLabel.remove();
                this.tocStylesLabel = undefined;
            }
            if (this.textBoxDiv) {
                this.textBoxDiv.remove();
                this.textBoxDiv = undefined;
            }
            if (this.listViewDiv) {
                this.listViewDiv.remove();
                this.listViewDiv = undefined;
            }
            if (this.modifyButtonDiv) {
                this.modifyButtonDiv.remove();
                this.modifyButtonDiv = undefined;
            }
            if (this.modifyElement) {
                this.modifyElement.remove();
                this.modifyElement = undefined;
            }
            if (this.modifyButton) {
                this.modifyButton.destroy();
                this.modifyButton = undefined;
            }
        };
        return TableOfContentsDialog;
    }());
    exports.TableOfContentsDialog = TableOfContentsDialog;
});