1/* 2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16var __decorate = this && this.__decorate || function (e, t, o, i) { 17 var s, a = arguments.length, d = a < 3 ? t : null === i ? i = Object.getOwnPropertyDescriptor(t, o) : i; 18 if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) d = Reflect.decorate(e, t, o, i); else for (var r = e.length - 1;r >= 0; r--) (s = e[r]) && (d = (a < 3 ? s(d) : a > 3 ? s(t, o, d) : s(t, o)) || d); 19 return a > 3 && d && Object.defineProperty(t, o, d), d 20}; 21 22export var TreeView; 23!function(e){ 24 const t = "#00000000"; 25 const o = "#FFFFFF"; 26 27 class i { 28 constructor() { 29 this._events = [] 30 } 31 32 on(e, t) { 33 if (Array.isArray(e)) for (let o = 0, 34 i = e.length;o < i; o++) this.on(e[o], t); else (this._events[e] || (this._events[e] = [])).push(t) 35 } 36 37 once(e, t) { 38 let o = this; 39 40 function i() { 41 o.off(e, i); 42 t.apply(null, [e, t]) 43 } 44 45 i.callback = t; 46 this.on(e, i) 47 } 48 49 off(e, t) { 50 null == e && (this._events = []); 51 if (Array.isArray(e)) for (let o = 0, i = e.length;o < i; o++) this.off(e[o], t); 52 const o = this._events[e]; 53 if (!o) return; 54 null == t && (this._events[e] = null); 55 let i, s = o.length; 56 for (; s--; ) { 57 i = o[s]; 58 if (i === t || i.callback === t) { 59 o.splice(s, 1); 60 break 61 } 62 } 63 } 64 65 emit(e, t) { 66 let o = this; 67 if (!this._events[e]) return; 68 let i = [...this._events[e]]; 69 if (i) for (let e = 0, s = i.length;e < s; e++) try { 70 i[e].apply(o, t) 71 } catch (e) { 72 new Error(e) 73 } 74 } 75 } 76 77 e.TreeListener = i; 78 let s; 79 !function(e){ 80 e.NODE_ADD = "NodeAdd"; 81 e.NODE_DELETE = "NodeDelete"; 82 e.NODE_MODIFY = "NodeModify"; 83 e.NODE_MOVE = "NodeMove"; 84 e.NODE_CLICK = "NodeClick" 85 }(s = e.TreeListenType || (e.TreeListenType = {})); 86 87 class a { 88 constructor() { 89 this.appEventBus = new i 90 } 91 92 static getInstance() { 93 null == AppStorage.Get(this.APP_KEY_EVENT_BUS) && AppStorage.SetOrCreate(this.APP_KEY_EVENT_BUS, new a); 94 return AppStorage.Get(this.APP_KEY_EVENT_BUS) 95 } 96 97 getTreeListener() { 98 return this.appEventBus 99 } 100 } 101 102 a.APP_KEY_EVENT_BUS = "app_key_event_bus"; 103 e.TreeListenerManager = a; 104 105 class d { 106 constructor() { 107 this.listeners = [] 108 } 109 110 totalCount() { 111 return 0 112 } 113 114 getData(e) { 115 } 116 117 registerDataChangeListener(e) { 118 this.listeners.indexOf(e) < 0 && this.listeners.push(e) 119 } 120 121 unregisterDataChangeListener(e) { 122 const t = this.listeners.indexOf(e); 123 t >= 0 && this.listeners.splice(t, 1) 124 } 125 126 notifyDataReload() { 127 this.listeners.forEach((e => { 128 e.onDataReloaded() 129 })) 130 } 131 132 notifyDataAdd(e) { 133 this.listeners.forEach((t => { 134 t.onDataAdd(e) 135 })) 136 } 137 138 notifyDataChange(e) { 139 this.listeners.forEach((t => { 140 t.onDataChange(e) 141 })) 142 } 143 144 notifyDataDelete(e) { 145 this.listeners.forEach((t => { 146 t.onDataDelete(e) 147 })) 148 } 149 150 notifyDataMove(e, t) { 151 this.listeners.forEach((o => { 152 o.onDataMove(e, t) 153 })) 154 } 155 } 156 157 let r; 158 !function(e){ 159 e[e.TOUCH_DOWN=0] = "TOUCH_DOWN"; 160 e[e.TOUCH_UP=1] = "TOUCH_UP"; 161 e[e.HOVER=3] = "HOVER"; 162 e[e.HOVER_OVER=4] = "HOVER_OVER"; 163 e[e.FOCUS=5] = "FOCUS"; 164 e[e.BLUR=6] = "BLUR"; 165 e[e.MOUSE_BUTTON_RIGHT=7] = "MOUSE_BUTTON_RIGHT"; 166 e[e.DRAG=8] = "DRAG" 167 }(r = e.Event || (e.Event = {})); 168 let n; 169 !function(e){ 170 e[e.ADD_NODE=0] = "ADD_NODE"; 171 e[e.REMOVE_NODE=1] = "REMOVE_NODE"; 172 e[e.MODIFY_NODE=2] = "MODIFY_NODE"; 173 e[e.COMMIT_NODE=3] = "COMMIT_NODE" 174 }(n = e.MenuOperation || (e.MenuOperation = {})); 175 let l; 176 !function(e){ 177 e[e.HINTS=0] = "HINTS"; 178 e[e.WARNINGS=1] = "WARNINGS" 179 }(l = e.PopUpType || (e.PopUpType = {})); 180 let h; 181 !function(e){ 182 e[e.INVALID_ERROR=0] = "INVALID_ERROR"; 183 e[e.LENGTH_ERROR=1] = "LENGTH_ERROR"; 184 e[e.NONE=2] = "NONE" 185 }(h = e.InputError || (e.InputError = {})); 186 let g; 187 !function(e){ 188 e[e.DOWN_FLAG=0] = "DOWN_FLAG"; 189 e[e.UP_FLAG=1] = "UP_FLAG"; 190 e[e.NONE=2] = "NONE" 191 }(g = e.Flag || (e.Flag = {})); 192 193 class c { 194 constructor(e) { 195 this.data = e; 196 this.nodeLevel = -1; 197 this.parentNodeId = -1; 198 this.nodeItem = { imageNode: null, mainTitleNode: null, imageCollapse: null }; 199 this.childNodeInfo = { isHasChildNode: !1, childNum: 0, allChildNum: 0 }; 200 this.menu = e.menu; 201 e.icon && (this.nodeItem.imageNode = new p(e.icon, e.selectedIcon, e.editIcon, { 202 id: -1, 203 type: 10002, 204 params: ["sys.float.ohos_id_alpha_content_fourth"], 205 bundleName: "", 206 moduleName: "" 207 }, 24, 24)); 208 e.primaryTitle && (this.nodeItem.mainTitleNode = new m(e.primaryTitle)); 209 this.children = [] 210 } 211 212 addImageCollapse(e) { 213 if (e) { 214 this.nodeItem.imageCollapse = new p({ 215 id: -1, 216 type: 2e4, 217 params: ["sys.media.ohos_ic_public_arrow_right"], 218 bundleName: "", 219 moduleName: "" 220 }, null, null, { 221 id: -1, 222 type: 10002, 223 params: ["sys.float.ohos_id_alpha_content_tertiary"], 224 bundleName: "", 225 moduleName: "" 226 }, 24, 24); 227 this.nodeItem.imageCollapse.itemRightMargin = { 228 id: -1, 229 type: 10002, 230 params: ["sys.float.ohos_id_text_paragraph_margin_xs"], 231 bundleName: "", 232 moduleName: "" 233 } 234 } else this.nodeItem.imageCollapse = null 235 } 236 237 getNodeItem() { 238 return this.nodeItem 239 } 240 241 getChildNodeInfo() { 242 return this.childNodeInfo 243 } 244 245 getMenu() { 246 return this.menu 247 } 248 249 getCurrentNodeId() { 250 return this.currentNodeId 251 } 252 253 getIsFolder() { 254 return this.data.isFolder 255 } 256 } 257 258 e.NodeItem = c; 259 260 class N { 261 constructor() { 262 } 263 264 set itemWidth(e) { 265 this.width = e 266 } 267 268 get itemWidth() { 269 return this.width 270 } 271 272 set itemHeight(e) { 273 this.height = e 274 } 275 276 get itemHeight() { 277 return this.height 278 } 279 280 set itemRightMargin(e) { 281 this.rightMargin = e 282 } 283 284 get itemRightMargin() { 285 return this.rightMargin 286 } 287 } 288 289 let I; 290 !function(e){ 291 e[e.Expand=0] = "Expand"; 292 e[e.Collapse=1] = "Collapse" 293 }(I = e.NodeStatus || (e.NodeStatus = {})); 294 let u; 295 !function(e){ 296 e[e.Normal=0] = "Normal"; 297 e[e.Selected=1] = "Selected"; 298 e[e.Edit=2] = "Edit"; 299 e[e.FinishEdit=3] = "FinishEdit"; 300 e[e.DragInsert=4] = "DragInsert"; 301 e[e.FinishDragInsert=5] = "FinishDragInsert" 302 }(u = e.InteractionStatus || (e.InteractionStatus = {})); 303 304 class p extends N { 305 constructor(e, t, o, i, s, a) { 306 super(); 307 this.rightMargin = { 308 id: -1, 309 type: 10002, 310 params: ["sys.float.ohos_id_elements_margin_horizontal_m"], 311 bundleName: "", 312 moduleName: "" 313 }; 314 this.imageSource = e; 315 this.imageNormalSource = e; 316 this.imageSelectedSource = null != t ? t : this.imageNormalSource; 317 this.imageEditSource = null != o ? o : this.imageNormalSource; 318 this.imageOpacity = i; 319 this.itemWidth = s; 320 this.itemHeight = a; 321 this.imageCollapseSource = e; 322 this.imageCollapseDownSource = { 323 id: -1, 324 type: 2e4, 325 params: ["sys.media.ohos_ic_public_arrow_down"], 326 bundleName: "", 327 moduleName: "" 328 }; 329 this.imageCollapseRightSource = { 330 id: -1, 331 type: 2e4, 332 params: ["sys.media.ohos_ic_public_arrow_right"], 333 bundleName: "", 334 moduleName: "" 335 }; 336 this.isImageCollapse = !0 337 } 338 339 get source() { 340 return this.imageSource 341 } 342 343 get normalSource() { 344 return this.imageNormalSource 345 } 346 347 get selectedSource() { 348 return this.imageSelectedSource 349 } 350 351 get editSource() { 352 return this.imageEditSource 353 } 354 355 get opacity() { 356 return this.imageOpacity 357 } 358 359 get noOpacity() { 360 return 1 361 } 362 363 get collapseSource() { 364 return this.imageCollapseSource 365 } 366 367 get isCollapse() { 368 return this.isImageCollapse 369 } 370 371 changeImageCollapseSource(e) { 372 e == I.Expand ? this.imageCollapseSource = this.imageCollapseDownSource : e == I.Collapse && (this.imageCollapseSource = this.imageCollapseRightSource) 373 } 374 375 setImageCollapseSource(e, t) { 376 if (e === u.Edit || e === u.DragInsert) { 377 this.imageCollapseDownSource = { 378 id: -1, 379 type: 2e4, 380 params: ["sys.media.ohos_ic_public_arrow_down"], 381 bundleName: "", 382 moduleName: "" 383 }; 384 this.imageCollapseRightSource = { 385 id: -1, 386 type: 2e4, 387 params: ["sys.media.ohos_ic_public_arrow_right"], 388 bundleName: "", 389 moduleName: "" 390 }; 391 this.isImageCollapse = !1 392 } else if (e === u.FinishEdit || e === u.FinishDragInsert) { 393 this.imageCollapseDownSource = { 394 id: -1, 395 type: 2e4, 396 params: ["sys.media.ohos_ic_public_arrow_down"], 397 bundleName: "", 398 moduleName: "" 399 }; 400 this.imageCollapseRightSource = { 401 id: -1, 402 type: 2e4, 403 params: ["sys.media.ohos_ic_public_arrow_right"], 404 bundleName: "", 405 moduleName: "" 406 }; 407 this.isImageCollapse = !0 408 } 409 this.imageCollapseSource = t == I.Collapse ? this.imageCollapseRightSource : this.imageCollapseDownSource 410 } 411 412 setImageSource(e) { 413 switch (e) { 414 case u.Normal: 415 this.imageSource = this.imageNormalSource; 416 this.currentInteractionStatus = e; 417 break; 418 case u.Selected: 419 if (this.currentInteractionStatus !== u.Edit) { 420 this.imageSource = this.imageSelectedSource; 421 this.currentInteractionStatus = e 422 } 423 break; 424 case u.Edit: 425 this.imageSource = this.imageEditSource; 426 this.currentInteractionStatus = e; 427 break; 428 case u.FinishEdit: 429 this.imageSource = this.imageSelectedSource; 430 this.currentInteractionStatus = e; 431 break; 432 case u.DragInsert: 433 this.imageSource = this.imageEditSource; 434 this.currentInteractionStatus = e; 435 break; 436 case u.FinishDragInsert: 437 this.imageSource = this.imageNormalSource; 438 this.currentInteractionStatus = e 439 } 440 } 441 } 442 443 e.ImageNode = p; 444 445 class m extends N { 446 constructor(e) { 447 super(); 448 this.mainTitleName = e; 449 this.itemWidth = 0; 450 this.itemHeight = 44; 451 this.rightMargin = { 452 id: -1, 453 type: 10002, 454 params: ["sys.float.ohos_id_text_paragraph_margin_xs"], 455 bundleName: "", 456 moduleName: "" 457 }; 458 this.mainTitleSetting = { 459 fontColor: { 460 id: -1, 461 type: 10001, 462 params: ["sys.color.ohos_id_color_primary"], 463 bundleName: "", 464 moduleName: "" 465 }, 466 fontSize: { 467 id: -1, 468 type: 10002, 469 params: ["sys.float.ohos_id_text_size_body1"], 470 bundleName: "", 471 moduleName: "" 472 }, 473 fontWeight: FontWeight.Normal 474 }; 475 this.showPopUpTimeout = 0 476 } 477 478 setMainTitleSelected(e) { 479 this.mainTitleSetting = e ? { 480 fontColor: { 481 id: -1, 482 type: 10001, 483 params: ["sys.color.ohos_id_color_text_primary_activated"], 484 bundleName: "", 485 moduleName: "" 486 }, 487 fontSize: { 488 id: -1, 489 type: 10002, 490 params: ["sys.float.ohos_id_text_size_body1"], 491 bundleName: "", 492 moduleName: "" 493 }, 494 fontWeight: FontWeight.Regular 495 } : { 496 fontColor: { 497 id: -1, 498 type: 10001, 499 params: ["sys.color.ohos_id_color_primary"], 500 bundleName: "", 501 moduleName: "" 502 }, 503 fontSize: { 504 id: -1, 505 type: 10002, 506 params: ["sys.float.ohos_id_text_size_body1"], 507 bundleName: "", 508 moduleName: "" 509 }, 510 fontWeight: FontWeight.Normal 511 } 512 } 513 514 set title(e) { 515 this.mainTitleName = e 516 } 517 518 get title() { 519 return this.mainTitleName 520 } 521 522 set popUpTimeout(e) { 523 this.showPopUpTimeout = e 524 } 525 526 get popUpTimeout() { 527 return this.showPopUpTimeout 528 } 529 530 get color() { 531 return this.mainTitleSetting.fontColor 532 } 533 534 get size() { 535 return this.mainTitleSetting.fontSize 536 } 537 538 get weight() { 539 return this.mainTitleSetting.fontWeight 540 } 541 542 setMainTitleHighLight(e) { 543 this.mainTitleSetting = e ? { 544 fontColor: { 545 id: -1, 546 type: 10001, 547 params: ["sys.color.ohos_id_color_primary_contrary"], 548 bundleName: "", 549 moduleName: "" 550 }, 551 fontSize: { 552 id: -1, 553 type: 10002, 554 params: ["sys.float.ohos_id_text_size_body1"], 555 bundleName: "", 556 moduleName: "" 557 }, 558 fontWeight: FontWeight.Regular 559 } : { 560 fontColor: { 561 id: -1, 562 type: 10001, 563 params: ["sys.color.ohos_id_color_primary"], 564 bundleName: "", 565 moduleName: "" 566 }, 567 fontSize: { 568 id: -1, 569 type: 10002, 570 params: ["sys.float.ohos_id_text_size_body1"], 571 bundleName: "", 572 moduleName: "" 573 }, 574 fontWeight: FontWeight.Normal 575 } 576 } 577 } 578 579 e.MainTitleNode = m; 580 581 class f extends N { 582 constructor() { 583 super(); 584 this.statusColor = { 585 id: -1, 586 type: 10001, 587 params: ["sys.color.ohos_id_color_background"], 588 bundleName: "", 589 moduleName: "" 590 }; 591 this.editItemColor = { 592 id: -1, 593 type: 10001, 594 params: ["sys.color.ohos_id_color_emphasize"], 595 bundleName: "", 596 moduleName: "" 597 }; 598 this.radius = { 599 id: -1, 600 type: 10002, 601 params: ["sys.float.ohos_id_corner_radius_default_xs"], 602 bundleName: "", 603 moduleName: "" 604 }; 605 this.itemWidth = 0; 606 this.itemHeight = 32; 607 this.rightMargin = { 608 id: -1, 609 type: 10002, 610 params: ["sys.float.ohos_id_text_paragraph_margin_xs"], 611 bundleName: "", 612 moduleName: "" 613 }; 614 this.inputTextSetting = { 615 fontColor: { 616 id: -1, 617 type: 10001, 618 params: ["sys.color.ohos_id_color_text_primary"], 619 bundleName: "", 620 moduleName: "" 621 }, 622 fontSize: { 623 id: -1, 624 type: 10002, 625 params: ["sys.float.ohos_id_text_size_body1"], 626 bundleName: "", 627 moduleName: "" 628 }, 629 fontWeight: FontWeight.Normal 630 } 631 } 632 633 get color() { 634 return this.inputTextSetting.fontColor 635 } 636 637 get size() { 638 return this.inputTextSetting.fontSize 639 } 640 641 get weight() { 642 return this.inputTextSetting.fontWeight 643 } 644 645 get borderRadius() { 646 return this.radius 647 } 648 649 get backgroundColor() { 650 return this.statusColor 651 } 652 653 get editColor() { 654 return this.editItemColor 655 } 656 657 get textInputStatusColor() { 658 return this.status 659 } 660 } 661 662 e.InputText = f; 663 664 class S { 665 constructor(e) { 666 this.borderWidth = { has: 2, none: 0 }; 667 this.canShowFlagLine = !1; 668 this.isOverBorder = !1; 669 this.canShowBottomFlagLine = !1; 670 this.isHighLight = !1; 671 this.isModify = !1; 672 this.childNodeInfo = e.getChildNodeInfo(); 673 this.nodeItem = { imageNode: null, inputText: null, mainTitleNode: null, imageCollapse: null }; 674 this.popUpInfo = { 675 popUpIsShow: !1, 676 popUpEnableArrow: !1, 677 popUpColor: null, 678 popUpText: "", 679 popUpTextColor: null 680 }; 681 this.nodeItem.imageNode = e.getNodeItem().imageNode; 682 this.nodeItem.inputText = new f; 683 this.nodeItem.mainTitleNode = e.getNodeItem().mainTitleNode; 684 this.nodeItem.imageCollapse = e.getNodeItem().imageCollapse; 685 this.menu = e.menu; 686 this.parentNodeId = e.parentNodeId; 687 this.currentNodeId = e.currentNodeId; 688 this.nodeHeight = 44; 689 this.nodeLevel = e.nodeLevel; 690 this.nodeLeftPadding = 12 * e.nodeLevel + 8; 691 this.nodeColor = { 692 id: -1, 693 type: 10001, 694 params: ["sys.color.ohos_id_color_background"], 695 bundleName: "", 696 moduleName: "" 697 }; 698 this.nodeIsShow = !(this.nodeLevel > 0); 699 this.listItemHeight = this.nodeLevel > 0 ? 0 : 48; 700 this.isShowTitle = !0; 701 this.isShowInputText = !1; 702 this.isSelected = !1; 703 this.status = { 704 normal: { 705 id: -1, 706 type: 10001, 707 params: ["sys.color.ohos_id_color_background_transparent"], 708 bundleName: "", 709 moduleName: "" 710 }, 711 hover: { 712 id: -1, 713 type: 10001, 714 params: ["sys.color.ohos_id_color_hover"], 715 bundleName: "", 716 moduleName: "" 717 }, 718 press: { 719 id: -1, 720 type: 10001, 721 params: ["sys.color.ohos_id_color_click_effect"], 722 bundleName: "", 723 moduleName: "" 724 }, 725 selected: "#1A0A59F7", 726 highLight: { 727 id: -1, 728 type: 10001, 729 params: ["sys.color.ohos_id_color_activated"], 730 bundleName: "", 731 moduleName: "" 732 } 733 }; 734 this.nodeBorder = { 735 borderWidth: 0, 736 borderColor: { 737 id: -1, 738 type: 10001, 739 params: ["sys.color.ohos_id_color_focused_outline"], 740 bundleName: "", 741 moduleName: "" 742 }, 743 borderRadius: { 744 id: -1, 745 type: 10002, 746 params: ["sys.float.ohos_id_corner_radius_clicked"], 747 bundleName: "", 748 moduleName: "" 749 } 750 }; 751 this.flagLineLeftMargin = 12 * e.nodeLevel + 8; 752 this.node = e; 753 this.nodeParam = e.data 754 } 755 756 getPopUpInfo() { 757 return this.popUpInfo 758 } 759 760 setPopUpIsShow(e) { 761 this.popUpInfo.popUpIsShow = e 762 } 763 764 setPopUpEnableArrow(e) { 765 this.popUpInfo.popUpEnableArrow = e 766 } 767 768 setPopUpColor(e) { 769 this.popUpInfo.popUpColor = e 770 } 771 772 setPopUpText(e) { 773 this.popUpInfo.popUpText = e 774 } 775 776 setPopUpTextColor(e) { 777 this.popUpInfo.popUpTextColor = e 778 } 779 780 getIsShowTitle() { 781 return this.isShowTitle 782 } 783 784 getIsShowInputText() { 785 return this.isShowInputText 786 } 787 788 setTitleAndInputTextStatus(e) { 789 if (e) { 790 this.isShowTitle = !1; 791 this.isShowInputText = !0 792 } else { 793 this.isShowTitle = !0; 794 this.isShowInputText = !1 795 } 796 } 797 798 handleImageCollapseAfterAddNode(e) { 799 if (e) { 800 this.nodeItem.imageCollapse = new p({ 801 id: -1, 802 type: 2e4, 803 params: ["sys.media.ohos_ic_public_arrow_down"], 804 bundleName: "", 805 moduleName: "" 806 }, null, null, { 807 id: -1, 808 type: 10002, 809 params: ["sys.float.ohos_id_alpha_content_tertiary"], 810 bundleName: "", 811 moduleName: "" 812 }, 24, 24); 813 this.nodeItem.imageCollapse.itemRightMargin = { 814 id: -1, 815 type: 10002, 816 params: ["sys.float.ohos_id_text_paragraph_margin_xs"], 817 bundleName: "", 818 moduleName: "" 819 } 820 } else this.nodeItem.imageCollapse = null 821 } 822 823 setNodeColor(e) { 824 this.nodeColor = e 825 } 826 827 getNodeColor() { 828 return this.nodeColor 829 } 830 831 setListItemHeight(e) { 832 this.listItemHeight = e 833 } 834 835 getListItemHeight() { 836 return this.listItemHeight 837 } 838 839 getNodeCurrentNodeId() { 840 return this.currentNodeId 841 } 842 843 getNodeParentNodeId() { 844 return this.parentNodeId 845 } 846 847 getNodeLeftPadding() { 848 return this.nodeLeftPadding 849 } 850 851 getNodeHeight() { 852 return this.nodeHeight 853 } 854 855 setNodeIsShow(e) { 856 this.nodeIsShow = e 857 } 858 859 getNodeIsShow() { 860 return this.nodeIsShow 861 } 862 863 getNodeItem() { 864 return this.nodeItem 865 } 866 867 getNodeStatus() { 868 return this.status 869 } 870 871 getNodeBorder() { 872 return this.nodeBorder 873 } 874 875 setNodeBorder(e) { 876 this.nodeBorder.borderWidth = e ? this.borderWidth.has : this.borderWidth.none 877 } 878 879 getChildNodeInfo() { 880 return this.childNodeInfo 881 } 882 883 getCurrentNodeId() { 884 return this.currentNodeId 885 } 886 887 getMenu() { 888 return this.menu 889 } 890 891 setIsSelected(e) { 892 this.isSelected = e 893 } 894 895 getIsSelected() { 896 return this.isSelected 897 } 898 899 getNodeInfoData() { 900 return this.nodeParam 901 } 902 903 getNodeInfoNode() { 904 return this.node 905 } 906 907 getIsFolder() { 908 return this.nodeParam.isFolder 909 } 910 911 setCanShowFlagLine(e) { 912 this.canShowFlagLine = e 913 } 914 915 getCanShowFlagLine() { 916 return this.canShowFlagLine 917 } 918 919 setFlagLineLeftMargin(e) { 920 this.flagLineLeftMargin = 12 * e + 8 921 } 922 923 getFlagLineLeftMargin() { 924 return this.flagLineLeftMargin 925 } 926 927 getNodeLevel() { 928 return this.nodeLevel 929 } 930 931 setIsOverBorder(e) { 932 this.isOverBorder = e 933 } 934 935 getIsOverBorder() { 936 return this.isOverBorder 937 } 938 939 setCanShowBottomFlagLine(e) { 940 this.canShowBottomFlagLine = e 941 } 942 943 getCanShowBottomFlagLine() { 944 return this.canShowBottomFlagLine 945 } 946 947 setIsHighLight(e) { 948 this.isHighLight = e 949 } 950 951 getIsHighLight() { 952 return this.isHighLight 953 } 954 955 setIsModify(e) { 956 this.isModify = e 957 } 958 959 getIsModify() { 960 return this.isModify 961 } 962 } 963 964 e.NodeInfo = S; 965 966 class C { 967 constructor() { 968 this.MaxNodeLevel = 50; 969 this.MAX_CN_LENGTH = 254; 970 this.MAX_EN_LENGTH = 255; 971 this.INITIAL_INVALID_VALUE = -1; 972 this._root = new c({}); 973 this._root.nodeLevel = -1; 974 this._root.parentNodeId = -1; 975 this._root.currentNodeId = -1 976 } 977 978 getNewNodeId() { 979 return this.addNewNodeId 980 } 981 982 traverseNodeDF(e, t = this._root) { 983 let o = [], i = !1; 984 o.unshift(t); 985 let s = o.shift(); 986 for (;!i && s; ) { 987 i = !0 === e(s); 988 if (!i) { 989 o.unshift(...s.children); 990 s = o.shift() 991 } 992 } 993 } 994 995 traverseNodeBF(e) { 996 let t = []; 997 let o = !1; 998 t.push(this._root); 999 let i = t.shift(); 1000 for (;!o && i; ) { 1001 try { 1002 o = e(i) 1003 } catch (e) { 1004 e.name, e.message 1005 } 1006 if (!o) { 1007 t.push(...i.children); 1008 i = t.shift() 1009 } 1010 } 1011 } 1012 1013 contains(e, t) { 1014 t.call(this, e,!0) 1015 } 1016 1017 updateParentChildNum(e, t, o) { 1018 let i = e.parentNodeId; 1019 for (; i >= 0; ) this.traverseNodeDF((e => { 1020 if (e.currentNodeId == i) { 1021 e.getChildNodeInfo().allChildNum = t ? e.getChildNodeInfo().allChildNum + o : e.getChildNodeInfo() 1022 .allChildNum - o; 1023 i = e.parentNodeId; 1024 return !1 1025 } 1026 return !1 1027 })) 1028 } 1029 1030 findParentNodeId(e) { 1031 let t = null; 1032 this.contains((function (o) { 1033 if (o.currentNodeId == e) { 1034 t = o; 1035 return !0 1036 } 1037 return !1 1038 }), this.traverseNodeBF); 1039 return t.parentNodeId 1040 } 1041 1042 addNode(e, t, o) { 1043 if (null === this._root) { 1044 this._root = new c({}); 1045 this._root.nodeLevel = -1; 1046 this._root.parentNodeId = -1; 1047 this._root.currentNodeId = -1 1048 } 1049 let i = null; 1050 this.contains((function (t) { 1051 if (t.currentNodeId == e) { 1052 i = t; 1053 return !0 1054 } 1055 return !1 1056 }), this.traverseNodeBF); 1057 if (i) { 1058 let s = new c(o); 1059 if (i.nodeLevel > this.MaxNodeLevel) throw new Error("ListNodeUtils[addNode]: The level of the tree view cannot exceed 50."); 1060 s.nodeLevel = i.nodeLevel + 1; 1061 s.parentNodeId = e; 1062 s.currentNodeId = t; 1063 i.children.push(s); 1064 i.getChildNodeInfo().isHasChildNode = !0; 1065 i.getChildNodeInfo().childNum = i.children.length; 1066 i.getChildNodeInfo().allChildNum += 1; 1067 i.addImageCollapse(i.getChildNodeInfo().isHasChildNode); 1068 this.updateParentChildNum(i,!0, 1); 1069 return this 1070 } 1071 throw new Error("ListNodeUtils[addNode]: Parent node not found.") 1072 } 1073 1074 findNodeIndex(e, t) { 1075 let o = this.INITIAL_INVALID_VALUE; 1076 for (let i = 0, s = e.length;i < s; i++) if (e[i].currentNodeId === t) { 1077 o = i; 1078 break 1079 } 1080 return o 1081 } 1082 1083 freeNodeMemory(e, t) { 1084 let o = []; 1085 this.traverseNodeDF((function (e) { 1086 o.push(e); 1087 return !1 1088 }), e); 1089 o.forEach((e => { 1090 t.push(e.currentNodeId); 1091 e = null 1092 })) 1093 } 1094 1095 removeNode(e, t, o) { 1096 let i = null; 1097 this.contains((function (e) { 1098 if (e.currentNodeId == t) { 1099 i = e; 1100 return !0 1101 } 1102 return !1 1103 }), o); 1104 if (i) { 1105 let t = []; 1106 let o = this.findNodeIndex(i.children, e); 1107 if (o < 0) throw new Error("Node does not exist."); 1108 { 1109 var s = i.children[o].getChildNodeInfo().allChildNum + 1; 1110 this.freeNodeMemory(i.children[o], t); 1111 let e = i.children.splice(o, 1); 1112 e = null; 1113 0 == i.children.length && i.addImageCollapse(!1) 1114 } 1115 i.getChildNodeInfo().childNum = i.children.length; 1116 i.getChildNodeInfo().allChildNum -= s; 1117 this.updateParentChildNum(i,!1, s); 1118 return t 1119 } 1120 throw new Error("Parent does not exist.") 1121 } 1122 1123 getNewNodeInfo(e) { 1124 let t = null; 1125 this.contains((function (o) { 1126 if (o.currentNodeId == e) { 1127 t = o; 1128 return !0 1129 } 1130 return !1 1131 }), this.traverseNodeBF); 1132 let o = { 1133 isFolder: !0, 1134 icon: null, 1135 selectedIcon: null, 1136 editIcon: null, 1137 menu: null, 1138 secondaryTitle: "" 1139 }; 1140 if (t) if (0 === t.children.length) if (null != t.getNodeItem().imageNode) { 1141 o.icon = t.getNodeItem().imageNode.normalSource; 1142 o.selectedIcon = t.getNodeItem().imageNode.selectedSource; 1143 o.editIcon = t.getNodeItem().imageNode.editSource; 1144 o.menu = t.getMenu() 1145 } else { 1146 o.icon = null; 1147 o.selectedIcon = null; 1148 o.editIcon = null; 1149 o.menu = t.getMenu() 1150 } else if (t.children.length > 0) if (null != t.getNodeItem().imageNode) { 1151 o.icon = null != t.children[0].getNodeItem().imageNode ? t.children[0].getNodeItem() 1152 .imageNode 1153 .normalSource : null; 1154 o.selectedIcon = null != t.children[0].getNodeItem().imageNode ? t.children[0].getNodeItem() 1155 .imageNode 1156 .selectedSource : null; 1157 o.editIcon = null != t.children[0].getNodeItem().imageNode ? t.children[0].getNodeItem() 1158 .imageNode 1159 .editSource : null; 1160 o.menu = t.children[0].getMenu() 1161 } else { 1162 o.icon = null; 1163 o.selectedIcon = null; 1164 o.editIcon = null; 1165 o.menu = t.children[0].getMenu() 1166 } 1167 return o 1168 } 1169 1170 getClickChildId(e) { 1171 let t = null; 1172 this.contains((function (o) { 1173 if (o.currentNodeId == e) { 1174 t = o; 1175 return !0 1176 } 1177 return !1 1178 }), this.traverseNodeBF); 1179 if (t) { 1180 if (0 === t.children.length) return []; 1181 if (t.children.length > 0) { 1182 var o = new Array(t.children.length); 1183 for (let e = 0;e < o.length; e++) o[e] = 0; 1184 for (let e = 0;e < t.children.length && e < o.length; e++) o[e] = t.children[e].currentNodeId; 1185 return o 1186 } 1187 } 1188 return [] 1189 } 1190 1191 getClickNodeChildrenInfo(e) { 1192 let t = null; 1193 this.contains((function (o) { 1194 if (o.currentNodeId == e) { 1195 t = o; 1196 return !0 1197 } 1198 return !1 1199 }), this.traverseNodeBF); 1200 if (t) { 1201 if (0 === t.children.length) return []; 1202 if (t.children.length > 0) { 1203 var o = new Array(t.children.length); 1204 for (let e = 0;e < o.length; e++) o[e] = { itemId: null, itemIcon: null, itemTitle: null, isFolder: null }; 1205 for (let e = 0;e < t.children.length && e < o.length; e++) { 1206 o[e].itemId = t.children[e].currentNodeId; 1207 t.children[e].getNodeItem().imageNode && (o[e].itemIcon = t.children[e].getNodeItem().imageNode.source); 1208 t.children[e].getNodeItem().mainTitleNode && (o[e].itemTitle = t.children[e].getNodeItem() 1209 .mainTitleNode 1210 .title); 1211 o[e].isFolder = t.children[e].getIsFolder() 1212 } 1213 return o 1214 } 1215 } 1216 return [] 1217 } 1218 1219 checkMainTitleIsValid(e) { 1220 let t = /^[\u4e00-\u9fa5]+$/; 1221 return!/[\\\/:*?"<>|]/.test(e) && !(t.test(e) && e.length > this.MAX_CN_LENGTH || !t.test(e) && e.length > this.MAX_EN_LENGTH) 1222 } 1223 1224 dragTraverseNodeDF(e, t = this._root, o) { 1225 let i = [], s = !1; 1226 i.unshift(t); 1227 let a = i.shift(); 1228 for (;!s && a; ) { 1229 s = !0 === e(a, o); 1230 if (!s) { 1231 i.unshift(...a.children); 1232 a = i.shift() 1233 } 1234 } 1235 } 1236 1237 addDragNode(e, t, o, i, s) { 1238 if (null === this._root) { 1239 this._root = new c({}); 1240 this._root.nodeLevel = this.INITIAL_INVALID_VALUE; 1241 this._root.parentNodeId = this.INITIAL_INVALID_VALUE; 1242 this._root.currentNodeId = this.INITIAL_INVALID_VALUE 1243 } 1244 let a = null; 1245 this.contains((function (t) { 1246 if (t.currentNodeId == e) { 1247 a = t; 1248 return !0 1249 } 1250 return !1 1251 }), this.traverseNodeBF); 1252 if (a) { 1253 let d = new c(s); 1254 if (a.nodeLevel > this.MaxNodeLevel) throw new Error("ListNodeUtils[addNode]: The level of the tree view cannot exceed 50."); 1255 d.nodeLevel = a.nodeLevel + 1; 1256 d.parentNodeId = e; 1257 d.currentNodeId = t; 1258 let r = this.INITIAL_INVALID_VALUE; 1259 if (a.children.length) { 1260 for (let e = 0;e < a.children.length; e++) if (a.children[e].getCurrentNodeId() == o) { 1261 r = e; 1262 break 1263 } 1264 i ? a.children.splice(r + 1, 0, d) : a.children.splice(r, 0, d) 1265 } else a.children.push(d); 1266 a.getChildNodeInfo().isHasChildNode = !0; 1267 a.getChildNodeInfo().childNum = a.children.length; 1268 a.getChildNodeInfo().allChildNum += 1; 1269 a.addImageCollapse(a.getChildNodeInfo().isHasChildNode); 1270 this.updateParentChildNum(a,!0, 1); 1271 return this 1272 } 1273 throw new Error("ListNodeUtils[addNode]: Parent node not found.") 1274 } 1275 } 1276 1277 e.ListNodeUtils = C; 1278 1279 class D extends d { 1280 constructor() { 1281 super(...arguments); 1282 this.ROOT_NODE_ID = -1; 1283 this.listNodeUtils = new C; 1284 this.listNode = []; 1285 this.INITIAL_INVALID_VALUE = -1; 1286 this.lastIndex = -1; 1287 this.thisIndex = -1; 1288 this.modifyNodeIndex = -1; 1289 this.modifyNodeId = -1; 1290 this.expandAndCollapseInfo = new Map; 1291 this.loadedNodeIdAndIndexMap = new Map; 1292 this.isTouchDown = !1; 1293 this.appEventBus = a.getInstance().getTreeListener(); 1294 this.isInnerDrag = !1; 1295 this.isDrag = !1; 1296 this.draggingCurrentNodeId = this.INITIAL_INVALID_VALUE; 1297 this.draggingParentNodeId = this.INITIAL_INVALID_VALUE; 1298 this.currentNodeInfo = null; 1299 this.listItemOpacity = 1; 1300 this.lastPassIndex = this.INITIAL_INVALID_VALUE; 1301 this.lastPassId = this.INITIAL_INVALID_VALUE; 1302 this.thisPassIndex = this.INITIAL_INVALID_VALUE; 1303 this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE; 1304 this.timeoutExpandId = this.INITIAL_INVALID_VALUE; 1305 this.lastTimeoutExpandId = this.INITIAL_INVALID_VALUE; 1306 this.clearTimeoutExpandId = this.INITIAL_INVALID_VALUE; 1307 this.timeoutHighLightId = this.INITIAL_INVALID_VALUE; 1308 this.lastTimeoutHighLightId = this.INITIAL_INVALID_VALUE; 1309 this.clearTimeoutHighLightId = this.INITIAL_INVALID_VALUE; 1310 this.lastDelayHighLightIndex = this.INITIAL_INVALID_VALUE; 1311 this.lastDelayHighLightId = this.INITIAL_INVALID_VALUE; 1312 this.nodeIdAndSubtitleMap = new Map; 1313 this.flag = g.NONE; 1314 this.selectedParentNodeId = this.INITIAL_INVALID_VALUE; 1315 this.selectedParentNodeSubtitle = ""; 1316 this.insertNodeSubtitle = ""; 1317 this.currentFocusNodeId = this.INITIAL_INVALID_VALUE; 1318 this.lastFocusNodeId = this.INITIAL_INVALID_VALUE; 1319 this.addFocusNodeId = this.INITIAL_INVALID_VALUE; 1320 this.FLAG_LINE = { 1321 flagLineHeight: "1.5vp", 1322 flagLineColor: { 1323 id: -1, 1324 type: 10001, 1325 params: ["sys.color.ohos_id_color_activated"], 1326 bundleName: "", 1327 moduleName: "" 1328 }, 1329 xOffset: "0vp", 1330 yTopOffset: "2.75vp", 1331 yBottomOffset: "-1.25vp", 1332 yBasePlateOffset: "1.5vp" 1333 }; 1334 this.DRAG_POPUP = { 1335 floorConstraintSize: { minWidth: "128vp", maxWidth: "208vp" }, 1336 textConstraintSize: { minWidth1: "80vp", maxWidth1: "160vp", minWidth2: "112vp", maxWidth2: "192vp" }, 1337 padding: { left: "8vp", right: "8vp" }, 1338 backgroundColor: o, 1339 height: "48", 1340 shadow: { 1341 radius: { 1342 id: -1, 1343 type: 10002, 1344 params: ["sys.float.ohos_id_corner_radius_default_m"], 1345 bundleName: "", 1346 moduleName: "" 1347 }, 1348 color: "#00001E", 1349 offsetX: 0, 1350 offsetY: 10 1351 }, 1352 borderRadius: { 1353 id: -1, 1354 type: 10002, 1355 params: ["sys.float.ohos_id_corner_radius_clicked"], 1356 bundleName: "", 1357 moduleName: "" 1358 }, 1359 fontColor: { 1360 id: -1, 1361 type: 10001, 1362 params: ["sys.color.ohos_id_color_primary"], 1363 bundleName: "", 1364 moduleName: "" 1365 }, 1366 fontSize: { 1367 id: -1, 1368 type: 10002, 1369 params: ["sys.float.ohos_id_text_size_body1"], 1370 bundleName: "", 1371 moduleName: "" 1372 }, 1373 fontWeight: FontWeight.Regular, 1374 imageOpacity: { 1375 id: -1, 1376 type: 10002, 1377 params: ["sys.float.ohos_id_alpha_content_fourth"], 1378 bundleName: "", 1379 moduleName: "" 1380 } 1381 }; 1382 this.subTitle = { 1383 normalFontColor: { 1384 id: -1, 1385 type: 10001, 1386 params: ["sys.color.ohos_id_color_secondary"], 1387 bundleName: "", 1388 moduleName: "" 1389 }, 1390 highLightFontColor: { 1391 id: -1, 1392 type: 10001, 1393 params: ["sys.color.ohos_id_color_primary_contrary"], 1394 bundleName: "", 1395 moduleName: "" 1396 }, 1397 fontSize: { 1398 id: -1, 1399 type: 10002, 1400 params: ["sys.float.ohos_id_text_size_body2"], 1401 bundleName: "", 1402 moduleName: "" 1403 }, 1404 fontWeight: FontWeight.Regular, 1405 margin: { left: "4vp", right: "24" } 1406 } 1407 } 1408 1409 changeNodeColor(e, t) { 1410 this.listNode[e].setNodeColor(t) 1411 } 1412 1413 getNodeColor(e) { 1414 return this.listNode[e].getNodeColor() 1415 } 1416 1417 handleFocusEffect(e, t) { 1418 this.listNode[e].getNodeIsShow() && this.listNode[e].setNodeBorder(t) 1419 } 1420 1421 setImageSource(e, t) { 1422 let o = this.listNode[e]; 1423 o.setIsSelected(t === u.Selected || t === u.Edit || t === u.FinishEdit); 1424 null != o.getNodeItem().mainTitleNode && t != u.DragInsert && t != u.FinishDragInsert && o.getNodeItem() 1425 .mainTitleNode 1426 .setMainTitleSelected(t === u.Selected || t === u.FinishEdit); 1427 null != o.getNodeItem().imageNode && o.getNodeItem().imageNode.setImageSource(t) 1428 } 1429 1430 setImageCollapseSource(e, t) { 1431 let o = this.listNode[e]; 1432 null != o.getNodeItem().imageCollapse && o.getNodeItem() 1433 .imageCollapse 1434 .setImageCollapseSource(t, this.expandAndCollapseInfo.get(o.getCurrentNodeId())) 1435 } 1436 1437 clearLastIndexStatus() { 1438 if (!(-1 == this.lastIndex || this.lastIndex >= this.listNode.length)) { 1439 this.setImageSource(this.lastIndex, u.Normal); 1440 this.changeNodeColor(this.lastIndex, this.listNode[this.lastIndex].getNodeStatus().normal); 1441 this.handleFocusEffect(this.lastIndex,!1); 1442 this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.listNode[this.lastIndex].getCurrentNodeId())) 1443 } 1444 } 1445 1446 changeNodeStatus(e) { 1447 let t = e; 1448 let o = this.ListNode; 1449 let i = o[e].getCurrentNodeId(); 1450 if (this.expandAndCollapseInfo.get(i) == I.Expand) { 1451 this.expandAndCollapseInfo.set(i, I.Collapse); 1452 o[t].getNodeItem().imageCollapse.changeImageCollapseSource(I.Collapse) 1453 } else if (this.expandAndCollapseInfo.get(i) == I.Collapse) { 1454 this.expandAndCollapseInfo.set(i, I.Expand); 1455 o[t].getNodeItem().imageCollapse.changeImageCollapseSource(I.Expand) 1456 } 1457 } 1458 1459 handleExpandAndCollapse(e) { 1460 let t = e; 1461 let o = this.ListNode; 1462 let i = o[t].getCurrentNodeId(); 1463 if (!this.expandAndCollapseInfo.has(i)) return; 1464 let s = this.expandAndCollapseInfo.get(i); 1465 if (o[t].getChildNodeInfo().isHasChildNode && s == I.Collapse) { 1466 for (var a = 0;a < o[t].getChildNodeInfo().allChildNum; a++) { 1467 o[t + 1+a].setNodeIsShow(!1); 1468 o[t + 1+a].setListItemHeight(0) 1469 } 1470 this.notifyDataReload(); 1471 return 1472 } 1473 let d = new Array(o[t].getChildNodeInfo().childNum); 1474 d[0] = t + 1; 1475 let r = 1; 1476 for (; r < o[t].getChildNodeInfo().childNum; ) { 1477 d[r] = d[r-1] + o[d[r-1]].getChildNodeInfo().allChildNum + 1; 1478 r++ 1479 } 1480 if (s == I.Expand) for (a = 0; a < d.length; a++) { 1481 o[d[a]].setNodeIsShow(!0); 1482 o[d[a]].setListItemHeight(48); 1483 let e = o[d[a]].getCurrentNodeId(); 1484 this.expandAndCollapseInfo.get(e) == I.Expand && this.handleExpandAndCollapse(d[a]) 1485 } 1486 d = null; 1487 this.notifyDataReload() 1488 } 1489 1490 init(e) { 1491 let t = 0; 1492 this.listNode = []; 1493 this.listNodeUtils = e; 1494 this.loadedNodeIdAndIndexMap.clear(); 1495 this.listNodeUtils.traverseNodeDF((e => { 1496 if (e.currentNodeId >= 0) { 1497 var o = new S(e); 1498 this.listNode.push(o); 1499 o.getChildNodeInfo().isHasChildNode && this.expandAndCollapseInfo.set(o.getCurrentNodeId(), I.Collapse); 1500 o.getNodeIsShow() && this.loadedNodeIdAndIndexMap.set(o.getCurrentNodeId(), t++); 1501 o.getIsFolder() && this.nodeIdAndSubtitleMap.set(o.getCurrentNodeId(), o.getNodeInfoData() 1502 .secondaryTitle || 0 == o.getNodeInfoData() 1503 .secondaryTitle ? o.getNodeInfoData().secondaryTitle : "") 1504 } 1505 return !1 1506 })) 1507 } 1508 1509 refreshRemoveNodeData(e, t) { 1510 let o = []; 1511 for (let t = 0;t < e.length; t++) for (let i = 0;i < this.listNode.length; i++) if (this.listNode[i].getNodeCurrentNodeId() == e[t]) { 1512 let s = this.listNode[i].getNodeCurrentNodeId(); 1513 this.loadedNodeIdAndIndexMap.has(s) && o.push(this.loadedNodeIdAndIndexMap.get(s)); 1514 let a = this.listNode.splice(i, 1); 1515 a = null; 1516 this.expandAndCollapseInfo.has(e[t]) && this.expandAndCollapseInfo.delete(e[t]); 1517 break 1518 } 1519 o.forEach((e => { 1520 this.notifyDataDelete(e); 1521 this.notifyDataChange(e) 1522 })); 1523 for (let e = 0;e < this.listNode.length; e++) if (this.listNode[e].getNodeCurrentNodeId() == t.getNodeCurrentNodeId()) { 1524 if (null == t.getNodeItem().imageCollapse) { 1525 this.listNode[e].handleImageCollapseAfterAddNode(!1); 1526 this.expandAndCollapseInfo.delete(t.getNodeCurrentNodeId()); 1527 this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.listNode[e].getNodeCurrentNodeId())) 1528 } 1529 break 1530 } 1531 let i = { currentNodeId: t.getNodeCurrentNodeId(), parentNodeId: t.getNodeParentNodeId() }; 1532 this.appEventBus.emit(s.NODE_DELETE, [i]) 1533 } 1534 1535 refreshAddNodeData(e) { 1536 var t; 1537 this.listNodeUtils.traverseNodeDF((o => { 1538 if (o.currentNodeId === e[0]) { 1539 t = new S(o); 1540 return !0 1541 } 1542 return !1 1543 })); 1544 t.setIsModify(!0); 1545 let o = 0; 1546 for (let e = 0;e < this.listNode.length; e++) if (this.listNode[e].getNodeCurrentNodeId() == t.getNodeParentNodeId()) { 1547 o = e; 1548 if (null == this.listNode[e].getNodeItem().imageCollapse) { 1549 this.listNode[e].handleImageCollapseAfterAddNode(!0); 1550 this.notifyDataChange(o) 1551 } else this.expandAndCollapseInfo.get(this.listNode[e].getNodeCurrentNodeId()) == I.Collapse && this.changeNodeStatus(o); 1552 this.listNode.splice(e + 1, 0, t); 1553 this.listNode[e+1].setTitleAndInputTextStatus(!0); 1554 this.listNode[e+1].setNodeIsShow(!0); 1555 this.listNode[e+1].setListItemHeight(48); 1556 this.setImageSource(e + 1, u.Edit); 1557 this.currentOperation = n.ADD_NODE; 1558 this.notifyDataAdd(e + 1); 1559 this.notificationNodeInfo(e + 1, this.currentOperation); 1560 break 1561 } 1562 this.modifyNodeIndex = o + 1; 1563 this.expandAndCollapseInfo.set(t.getNodeParentNodeId(), I.Expand); 1564 this.handleExpandAndCollapse(o) 1565 } 1566 1567 refreshData(e, t, o, i) { 1568 let s; 1569 this.listNodeUtils = e; 1570 this.listNodeUtils.traverseNodeDF((e => { 1571 if (e.currentNodeId == o) { 1572 s = new S(e); 1573 return !0 1574 } 1575 return !1 1576 })); 1577 if (t === n.REMOVE_NODE) { 1578 this.nodeIdAndSubtitleMap.set(o, this.selectedParentNodeSubtitle); 1579 this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(o)); 1580 this.refreshRemoveNodeData(i, s) 1581 } 1582 if (t === n.ADD_NODE) { 1583 this.addFocusNodeId = i[0]; 1584 this.nodeIdAndSubtitleMap.set(this.getClickNodeId(), this.selectedParentNodeSubtitle); 1585 this.nodeIdAndSubtitleMap.set(i[0], this.insertNodeSubtitle); 1586 this.refreshAddNodeData(i) 1587 } 1588 } 1589 1590 setClickIndex(e) { 1591 this.thisIndex = e 1592 } 1593 1594 getClickNodeId() { 1595 return this.thisIndex < 0 || this.thisIndex >= this.ListNode.length ? -1 : this.ListNode[this.thisIndex].getCurrentNodeId() 1596 } 1597 1598 expandAndCollapseNode(e) { 1599 this.changeNodeStatus(e); 1600 this.handleExpandAndCollapse(e) 1601 } 1602 1603 getIsTouchDown() { 1604 return this.isTouchDown 1605 } 1606 1607 getLastIndex() { 1608 return this.lastIndex 1609 } 1610 1611 handleEvent(e, t) { 1612 if (this.isDrag) return; 1613 e !== r.TOUCH_DOWN && e !== r.TOUCH_UP && e !== r.MOUSE_BUTTON_RIGHT || t != this.lastIndex && this.clearLastIndexStatus(); 1614 let o = this.loadedNodeIdAndIndexMap.get(this.listNode[t].getCurrentNodeId()); 1615 switch (e) { 1616 case r.TOUCH_DOWN: 1617 this.isTouchDown = !0; 1618 this.changeNodeColor(t, this.listNode[t].getNodeStatus().press); 1619 break; 1620 case r.TOUCH_UP: { 1621 this.isInnerDrag && (this.isInnerDrag = !1); 1622 this.isTouchDown = !1; 1623 let e = this.listNode[t]; 1624 this.setImageSource(t, u.Selected); 1625 this.lastIndex = t; 1626 this.changeNodeColor(t, e.getNodeStatus().selected); 1627 this.notifyDataChange(o); 1628 break 1629 } 1630 case r.HOVER: 1631 if (this.getNodeColor(t) != this.listNode[t].getNodeStatus().selected) { 1632 this.changeNodeColor(t, this.listNode[t].getNodeStatus().hover); 1633 this.notifyDataChange(o) 1634 } 1635 break; 1636 case r.HOVER_OVER: 1637 if (this.getNodeColor(t) != this.listNode[t].getNodeStatus().selected) { 1638 this.changeNodeColor(t, this.listNode[t].getNodeStatus().normal); 1639 this.notifyDataChange(o) 1640 } 1641 break; 1642 case r.FOCUS: 1643 this.handleFocusEffect(t,!0); 1644 this.notifyDataChange(o); 1645 break; 1646 case r.BLUR: 1647 this.handleFocusEffect(t,!1); 1648 this.notifyDataChange(o); 1649 break; 1650 case r.MOUSE_BUTTON_RIGHT: 1651 this.lastIndex = t; 1652 this.finishEditing(); 1653 break; 1654 case r.DRAG: 1655 this.isTouchDown = !1; 1656 let e = this.listNode[t]; 1657 this.setImageSource(t, u.Selected); 1658 this.lastIndex = t; 1659 this.changeNodeColor(t, e.getNodeStatus().selected); 1660 this.notifyDataChange(o) 1661 } 1662 } 1663 1664 notificationNodeInfo(e, t) { 1665 if (t === n.MODIFY_NODE) { 1666 let e = this.listNode[this.modifyNodeIndex]; 1667 let t = { currentNodeId: e.getNodeCurrentNodeId(), parentNodeId: e.getNodeParentNodeId() }; 1668 this.appEventBus.emit(s.NODE_MODIFY, [t]) 1669 } else if (t === n.ADD_NODE) { 1670 let t = this.listNode[e]; 1671 null != t.getNodeItem().imageNode && t.getNodeItem().imageNode.source; 1672 null != t.getNodeItem().imageNode && t.getNodeItem().imageNode.selectedSource; 1673 null != t.getNodeItem().imageNode && t.getNodeItem().imageNode.editSource; 1674 let o = { currentNodeId: t.getNodeCurrentNodeId(), parentNodeId: t.getNodeParentNodeId() }; 1675 this.appEventBus.emit(s.NODE_ADD, [o]) 1676 } 1677 } 1678 1679 finishEditing() { 1680 if (-1 != this.modifyNodeIndex) { 1681 this.setImageSource(this.modifyNodeIndex, u.FinishEdit); 1682 this.setImageCollapseSource(this.modifyNodeIndex, u.FinishEdit); 1683 this.listNode[this.modifyNodeIndex].setIsModify(!1); 1684 this.listNode[this.modifyNodeIndex].setTitleAndInputTextStatus(!1); 1685 this.notificationNodeInfo(this.modifyNodeIndex, this.currentOperation); 1686 this.notifyDataChange(this.modifyNodeIndex) 1687 } 1688 } 1689 1690 setItemVisibilityOnEdit(e, t) { 1691 let o = -1; 1692 if (-1 != e) { 1693 if (t === n.MODIFY_NODE) { 1694 for (let t = 0;t < this.listNode.length; t++) if (this.listNode[t].getCurrentNodeId() == e) { 1695 o = t; 1696 break 1697 } 1698 let t = this.listNode[o]; 1699 t.setIsModify(!0); 1700 if (null === t.getNodeItem().mainTitleNode) return; 1701 this.currentOperation = n.MODIFY_NODE; 1702 t.setTitleAndInputTextStatus(!0); 1703 this.setImageSource(o, u.Edit); 1704 this.setImageCollapseSource(o, u.Edit); 1705 this.modifyNodeIndex = o; 1706 t.getNodeItem().inputText && (null != t.getNodeItem().imageCollapse ? t.getNodeItem() 1707 .inputText 1708 .rightMargin = { 1709 id: -1, 1710 type: 10002, 1711 params: ["sys.float.ohos_id_text_paragraph_margin_xs"], 1712 bundleName: "", 1713 moduleName: "" 1714 } : t.getNodeItem().inputText.rightMargin = { 1715 id: -1, 1716 type: 10002, 1717 params: ["sys.float.ohos_id_elements_margin_horizontal_m"], 1718 bundleName: "", 1719 moduleName: "" 1720 }); 1721 this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(e)) 1722 } 1723 o = e; 1724 if (t === n.COMMIT_NODE) { 1725 let e = this.listNode[o]; 1726 e.setTitleAndInputTextStatus(!1); 1727 e.setIsModify(!1); 1728 this.setImageSource(o, u.FinishEdit); 1729 this.setImageCollapseSource(o, u.FinishEdit); 1730 this.notificationNodeInfo(this.modifyNodeIndex, this.currentOperation); 1731 this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(e.getCurrentNodeId())) 1732 } 1733 } 1734 } 1735 1736 setPopUpInfo(e, t, o, i) { 1737 let s = this.listNode[i]; 1738 s.setPopUpIsShow(o); 1739 let a = this.loadedNodeIdAndIndexMap.get(s.getCurrentNodeId()); 1740 if (o) { 1741 if (e === l.HINTS) { 1742 if (null != s.getNodeItem().mainTitleNode) s.setPopUpText(s.getNodeItem().mainTitleNode.title); else { 1743 s.setPopUpText(""); 1744 s.setPopUpIsShow(!1) 1745 } 1746 s.setPopUpEnableArrow(!1); 1747 s.setPopUpColor({ 1748 id: -1, 1749 type: 10001, 1750 params: ["sys.color.ohos_id_color_background"], 1751 bundleName: "", 1752 moduleName: "" 1753 }); 1754 s.setPopUpTextColor({ 1755 id: -1, 1756 type: 10001, 1757 params: ["sys.color.ohos_id_color_text_secondary"], 1758 bundleName: "", 1759 moduleName: "" 1760 }) 1761 } else if (e === l.WARNINGS && null != s.getNodeItem().inputText) { 1762 t === h.INVALID_ERROR ? s.setPopUpText("invalid error") : t === h.LENGTH_ERROR && s.setPopUpText("length error"); 1763 s.setPopUpEnableArrow(!0); 1764 s.setPopUpColor({ 1765 id: -1, 1766 type: 10001, 1767 params: ["sys.color.ohos_id_color_help_tip_bg"], 1768 bundleName: "", 1769 moduleName: "" 1770 }); 1771 s.setPopUpTextColor({ 1772 id: -1, 1773 type: 10001, 1774 params: ["sys.color.ohos_id_color_text_hint_contrary"], 1775 bundleName: "", 1776 moduleName: "" 1777 }) 1778 } 1779 this.notifyDataChange(a) 1780 } else this.notifyDataChange(a) 1781 } 1782 1783 setShowPopUpTimeout(e, t) { 1784 null != this.listNode[t].getNodeItem().mainTitleNode && (this.listNode[t].getNodeItem() 1785 .mainTitleNode 1786 .popUpTimeout = e); 1787 let o = this.loadedNodeIdAndIndexMap.get(this.listNode[t].getCurrentNodeId()); 1788 this.notifyDataChange(o) 1789 } 1790 1791 setMainTitleNameOnEdit(e, t) { 1792 this.modifyNodeIndex = e; 1793 if (null != this.listNode[e].getNodeItem().mainTitleNode) { 1794 this.listNode[e].getNodeItem().mainTitleNode.title = t; 1795 let o = this.loadedNodeIdAndIndexMap.get(this.listNode[e].getCurrentNodeId()); 1796 this.notifyDataChange(o) 1797 } 1798 } 1799 1800 get ListNode() { 1801 return this.listNode 1802 } 1803 1804 totalCount() { 1805 let e = 0; 1806 let t = 0; 1807 this.loadedNodeIdAndIndexMap.clear(); 1808 for (let o = 0;o < this.listNode.length; o++) if (this.listNode[o].getNodeIsShow()) { 1809 this.loadedNodeIdAndIndexMap.set(this.listNode[o].getCurrentNodeId(), t++); 1810 e++ 1811 } 1812 return e 1813 } 1814 1815 getData(e) { 1816 let t = 0; 1817 for (let o = 0;o < this.listNode.length; o++) if (this.listNode[o].getNodeIsShow()) { 1818 if (e == t) return this.listNode[o]; 1819 t++ 1820 } 1821 return null 1822 } 1823 1824 addData(e, t) { 1825 this.listNode.splice(e, 0, t); 1826 this.notifyDataAdd(e) 1827 } 1828 1829 pushData(e) { 1830 this.listNode.push(e); 1831 this.notifyDataAdd(this.listNode.length - 1) 1832 } 1833 1834 setIsInnerDrag(e) { 1835 this.isInnerDrag = e 1836 } 1837 1838 getIsInnerDrag() { 1839 return this.isInnerDrag 1840 } 1841 1842 setIsDrag(e) { 1843 this.isDrag = e 1844 } 1845 1846 getIsDrag() { 1847 return this.isDrag 1848 } 1849 1850 setCurrentNodeInfo(e) { 1851 this.currentNodeInfo = e 1852 } 1853 1854 getCurrentNodeInfo() { 1855 return this.currentNodeInfo 1856 } 1857 1858 setDraggingParentNodeId(e) { 1859 this.draggingParentNodeId = e 1860 } 1861 1862 getDraggingParentNodeId() { 1863 return this.draggingParentNodeId 1864 } 1865 1866 getDraggingCurrentNodeId() { 1867 return this.draggingCurrentNodeId 1868 } 1869 1870 setDraggingCurrentNodeId(e) { 1871 this.draggingCurrentNodeId = e 1872 } 1873 1874 setListItemOpacity(e) { 1875 this.listItemOpacity = e 1876 } 1877 1878 getListItemOpacity(e) { 1879 return e.getCurrentNodeId() == this.getDraggingCurrentNodeId() ? this.listItemOpacity : 1 1880 } 1881 1882 getDragPopupPara() { 1883 return this.DRAG_POPUP 1884 } 1885 1886 setLastPassIndex(e) { 1887 this.lastPassIndex = e 1888 } 1889 1890 getLastPassIndex() { 1891 return this.lastPassIndex 1892 } 1893 1894 getIsParentOfInsertNode(e) { 1895 let t = this.currentNodeInfo.getNodeInfoNode(); 1896 let o = !1; 1897 this.listNodeUtils.traverseNodeDF((function (t) { 1898 if (t.currentNodeId == e) { 1899 o = !0; 1900 return !0 1901 } 1902 return !1 1903 }), t); 1904 return o 1905 } 1906 1907 setPassIndex(e) { 1908 this.thisPassIndex = e 1909 } 1910 1911 getPassIndex() { 1912 return this.thisPassIndex 1913 } 1914 1915 clearTimeOutAboutDelayHighLightAndExpand(e) { 1916 if (this.lastPassId != this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) { 1917 let e = this.loadedNodeIdAndIndexMap.get(this.lastPassId); 1918 let t = this; 1919 this.ListNode.forEach((function (e) { 1920 e.getNodeCurrentNodeId() == t.lastPassId && e.setCanShowFlagLine(!1) 1921 })); 1922 this.notifyDataChange(e) 1923 } 1924 if (this.lastTimeoutHighLightId != this.INITIAL_INVALID_VALUE && this.clearTimeoutHighLightId != this.lastTimeoutHighLightId) { 1925 clearTimeout(this.lastTimeoutHighLightId); 1926 if (this.lastDelayHighLightIndex != this.INITIAL_INVALID_VALUE) { 1927 this.clearHighLight(this.lastDelayHighLightIndex); 1928 let e = this.loadedNodeIdAndIndexMap.get(this.listNode[this.lastDelayHighLightIndex].getCurrentNodeId()); 1929 this.notifyDataChange(e) 1930 } 1931 this.clearTimeoutHighLightId = this.lastTimeoutHighLightId 1932 } 1933 this.lastTimeoutHighLightId = this.timeoutHighLightId; 1934 this.lastDelayHighLightIndex = e; 1935 if (this.lastTimeoutExpandId != this.INITIAL_INVALID_VALUE && this.clearTimeoutExpandId != this.lastTimeoutExpandId) { 1936 clearTimeout(this.lastTimeoutExpandId); 1937 this.clearTimeoutExpandId = this.lastTimeoutExpandId 1938 } 1939 this.lastTimeoutExpandId = this.timeoutExpandId; 1940 this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE 1941 } 1942 1943 clearHighLight(e) { 1944 this.changeNodeColor(e, this.listNode[e].getNodeStatus().normal); 1945 this.changeNodeHighLightColor(e,!1); 1946 this.setImageSource(e, u.FinishDragInsert); 1947 this.setImageCollapseSource(e, u.FinishDragInsert); 1948 this.listNode[e].setIsHighLight(!1) 1949 } 1950 1951 changeNodeHighLightColor(e, t) { 1952 this.listNode[e].getNodeItem() 1953 .mainTitleNode && this.listNode[e].getIsShowTitle() && this.listNode[e].getNodeItem() 1954 .mainTitleNode 1955 .setMainTitleHighLight(t) 1956 } 1957 1958 setVisibility(e, t, o) { 1959 let i = this.thisPassIndex != t || this.flag != e; 1960 this.thisPassIndex = t; 1961 if ((i || o) && this.isInnerDrag) { 1962 this.flag = e; 1963 let o = this.getData(t).getCurrentNodeId(); 1964 let i = this.expandAndCollapseInfo.get(o) == I.Expand && this.flag == g.DOWN_FLAG ? this.getData(t) 1965 .getNodeLevel() + 1 : this.getData(t) 1966 .getNodeLevel(); 1967 if (this.lastPassId != this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) { 1968 let e = this.loadedNodeIdAndIndexMap.get(this.lastPassId); 1969 let t = this; 1970 this.ListNode.forEach((function (e) { 1971 e.getNodeCurrentNodeId() == t.lastPassId && e.setCanShowFlagLine(!1) 1972 })); 1973 this.notifyDataChange(e) 1974 } 1975 if (this.flag == g.DOWN_FLAG && t < this.totalCount() - 1) { 1976 this.getData(t).setCanShowFlagLine(!1); 1977 this.getData(t + 1).setCanShowFlagLine(!0); 1978 this.getData(t).setCanShowBottomFlagLine(!1); 1979 this.getData(t + 1).setFlagLineLeftMargin(i); 1980 this.notifyDataChange(t); 1981 this.notifyDataChange(t + 1); 1982 this.lastPassId = this.getData(t + 1).getNodeCurrentNodeId() 1983 } else if (this.flag == g.UP_FLAG && t < this.totalCount() - 1) { 1984 this.getData(t).setCanShowFlagLine(!0); 1985 this.getData(t + 1).setCanShowFlagLine(!1); 1986 this.getData(t).setCanShowBottomFlagLine(!1); 1987 this.getData(t).setFlagLineLeftMargin(i); 1988 this.notifyDataChange(t); 1989 this.notifyDataChange(t + 1); 1990 this.lastPassId = this.getData(t).getNodeCurrentNodeId() 1991 } else if (t >= this.totalCount() - 1) { 1992 if (this.flag == g.DOWN_FLAG) { 1993 this.getData(t).setCanShowFlagLine(!1); 1994 this.getData(t).setCanShowBottomFlagLine(!0) 1995 } else { 1996 this.getData(t).setCanShowFlagLine(!0); 1997 this.getData(t).setCanShowBottomFlagLine(!1) 1998 } 1999 this.getData(t).setFlagLineLeftMargin(i); 2000 this.notifyDataChange(t); 2001 this.lastPassId = this.getData(t).getNodeCurrentNodeId() 2002 } 2003 } 2004 } 2005 2006 delayHighLightAndExpandNode(e, t, o) { 2007 let i = e != this.lastDelayExpandIndex; 2008 let s = this.getData(o).getIsOverBorder(); 2009 this.lastDelayExpandIndex = s ? this.INITIAL_INVALID_VALUE : e; 2010 if (s || i) { 2011 let i = this; 2012 if (!s && (!this.isInnerDrag || this.expandAndCollapseInfo.get(t) == I.Collapse && this.isInnerDrag || !this.expandAndCollapseInfo.has(t) && this.listNode[e].getIsFolder())) { 2013 this.changeNodeColor(e, this.listNode[e].getNodeStatus().hover); 2014 this.notifyDataChange(o); 2015 let t = this.isInnerDrag ? 1e3 : 0; 2016 this.timeoutHighLightId = setTimeout((function () { 2017 i.delayHighLight(e) 2018 }), t) 2019 } 2020 if (s || this.lastTimeoutHighLightId != this.INITIAL_INVALID_VALUE && this.clearTimeoutHighLightId != this.lastTimeoutHighLightId) { 2021 clearTimeout(this.lastTimeoutHighLightId); 2022 if (this.lastDelayHighLightIndex != this.INITIAL_INVALID_VALUE) { 2023 this.clearHighLight(this.lastDelayHighLightIndex); 2024 this.notifyDataReload() 2025 } 2026 this.clearTimeoutHighLightId = this.lastTimeoutHighLightId 2027 } 2028 this.lastTimeoutHighLightId = this.timeoutHighLightId; 2029 this.lastDelayHighLightIndex = e; 2030 if (!s && this.expandAndCollapseInfo.get(t) == I.Collapse) { 2031 let t = this.getData(o).getNodeInfoNode().children[0].currentNodeId; 2032 let s = 2e3; 2033 this.timeoutExpandId = setTimeout((function () { 2034 i.clearHighLight(i.lastDelayHighLightIndex); 2035 i.alterFlagLineAndExpandNode(e, t) 2036 }), s) 2037 } 2038 if (s || this.lastTimeoutExpandId != this.INITIAL_INVALID_VALUE && this.clearTimeoutExpandId != this.lastTimeoutExpandId) { 2039 clearTimeout(this.lastTimeoutExpandId); 2040 this.clearTimeoutExpandId = this.lastTimeoutExpandId 2041 } 2042 this.lastTimeoutExpandId = this.timeoutExpandId 2043 } 2044 } 2045 2046 delayHighLight(e) { 2047 let t = this; 2048 this.ListNode.forEach((function (e) { 2049 if (e.getNodeCurrentNodeId() == t.lastPassId) { 2050 e.setCanShowFlagLine(!1); 2051 e.setCanShowBottomFlagLine(!1) 2052 } 2053 })); 2054 this.changeNodeColor(e, this.listNode[e].getNodeStatus().highLight); 2055 this.listNode[e].setIsHighLight(!0); 2056 this.changeNodeHighLightColor(e,!0); 2057 this.setImageSource(e, u.DragInsert); 2058 this.setImageCollapseSource(e, u.DragInsert); 2059 this.notifyDataReload() 2060 } 2061 2062 alterFlagLineAndExpandNode(e, t) { 2063 let o = this; 2064 this.ListNode.forEach((function (e) { 2065 if (e.getNodeCurrentNodeId() == o.lastPassId) { 2066 e.setCanShowFlagLine(!1); 2067 e.setCanShowBottomFlagLine(!1) 2068 } 2069 })); 2070 this.ListNode.forEach((function (e) { 2071 o.isInnerDrag && e.getNodeCurrentNodeId() == t && e.setCanShowFlagLine(!0) 2072 })); 2073 this.changeNodeStatus(e); 2074 this.handleExpandAndCollapse(e); 2075 this.lastPassId = t 2076 } 2077 2078 hideLastLine() { 2079 if (this.lastPassId != this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) { 2080 let e = this; 2081 this.ListNode.forEach((function (t) { 2082 if (t.getNodeCurrentNodeId() == e.lastPassId) { 2083 t.setCanShowFlagLine(!1); 2084 t.setCanShowBottomFlagLine(!1) 2085 } 2086 })); 2087 let t = this.loadedNodeIdAndIndexMap.get(this.lastPassId); 2088 this.notifyDataChange(t) 2089 } 2090 } 2091 2092 clearLastTimeoutHighLight() { 2093 if (this.lastTimeoutHighLightId != this.INITIAL_INVALID_VALUE && this.clearTimeoutHighLightId != this.lastTimeoutHighLightId) { 2094 clearTimeout(this.lastTimeoutHighLightId); 2095 this.lastDelayHighLightIndex != this.INITIAL_INVALID_VALUE && this.clearHighLight(this.lastDelayHighLightIndex) 2096 } 2097 } 2098 2099 clearLastTimeoutExpand() { 2100 this.lastTimeoutExpandId != this.INITIAL_INVALID_VALUE && this.clearTimeoutExpandId != this.lastTimeoutExpandId && clearTimeout(this.lastTimeoutExpandId) 2101 } 2102 2103 getSubtitle(e) { 2104 return this.nodeIdAndSubtitleMap.has(e) ? "number" == typeof this.nodeIdAndSubtitleMap.get(e) ? this.nodeIdAndSubtitleMap.get(e) 2105 .toString() : this.nodeIdAndSubtitleMap.get(e) : "" 2106 } 2107 2108 hasSubtitle(e) { 2109 return this.nodeIdAndSubtitleMap.has(e) 2110 } 2111 2112 initialParameterAboutDelayHighLightAndExpandIndex() { 2113 this.lastDelayHighLightIndex = this.INITIAL_INVALID_VALUE; 2114 this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE; 2115 this.lastPassIndex = this.INITIAL_INVALID_VALUE; 2116 this.draggingCurrentNodeId = this.INITIAL_INVALID_VALUE; 2117 this.flag = g.NONE 2118 } 2119 2120 refreshSubtitle(e) { 2121 this.nodeIdAndSubtitleMap.set(this.selectedParentNodeId, this.selectedParentNodeSubtitle); 2122 this.nodeIdAndSubtitleMap.set(e, this.insertNodeSubtitle); 2123 this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.selectedParentNodeId)); 2124 this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(e)) 2125 } 2126 2127 setNodeSubtitlePara(e, t, o) { 2128 this.selectedParentNodeId = e; 2129 this.selectedParentNodeSubtitle = t; 2130 this.insertNodeSubtitle = o 2131 } 2132 2133 getInsertNodeSubtitle() { 2134 return this.insertNodeSubtitle 2135 } 2136 2137 getExpandAndCollapseInfo(e) { 2138 return this.expandAndCollapseInfo.get(e) 2139 } 2140 2141 getLastDelayHighLightId() { 2142 return this.lastDelayHighLightId 2143 } 2144 2145 setLastDelayHighLightId() { 2146 this.ListNode.forEach(((e, t) => { 2147 t == this.lastDelayHighLightIndex && (this.lastDelayHighLightId = e.getCurrentNodeId()) 2148 })) 2149 } 2150 2151 setLastPassId(e) { 2152 this.lastPassId = e 2153 } 2154 2155 setLastDelayHighLightIndex(e) { 2156 this.lastDelayHighLightIndex = e 2157 } 2158 2159 alterDragNode(e, t, o, i, a, d) { 2160 let r = []; 2161 let n = e; 2162 let l = a; 2163 let h = d.getNodeInfoData(); 2164 let c = null; 2165 let N = d.getNodeInfoNode(); 2166 let u = !1; 2167 let p = this.INITIAL_INVALID_VALUE; 2168 let m = this.INITIAL_INVALID_VALUE; 2169 let f = this.flag == g.DOWN_FLAG; 2170 m = this.getChildIndex(i, a); 2171 p = this.getChildIndex(e, t); 2172 p = e != i ? f ? p + 1 : p : p > m ? f ? p : p - 1 : f ? p + 1 : p; 2173 for (let e = 0;e < this.listNode.length; e++) if (this.listNode[e].getCurrentNodeId() == t) { 2174 u = this.listNode[e].getIsHighLight(); 2175 if (this.flag == g.DOWN_FLAG && this.expandAndCollapseInfo.get(t) == I.Expand) { 2176 n = t; 2177 p = 0 2178 } else if (this.flag == g.UP_FLAG && this.expandAndCollapseInfo.get(t) == I.Expand && 0 == this.listNode[e].getCanShowFlagLine()) { 2179 n = t; 2180 p = 0 2181 } else if (u) { 2182 n = t; 2183 p = 0 2184 } 2185 break 2186 } 2187 let S = { currentNodeId: l, parentNodeId: n, childIndex: p }; 2188 this.appEventBus.emit(s.NODE_MOVE, [S]); 2189 r.push({ parentId: n, currentId: l, data: h }); 2190 let C = null; 2191 this.listNodeUtils.dragTraverseNodeDF((function (e, t) { 2192 if (e) { 2193 C = e; 2194 n = C.parentNodeId; 2195 l = C.currentNodeId; 2196 for (let e = 0;e < t.length; e++) if (t[e].getNodeCurrentNodeId() == l) { 2197 c = t[e]; 2198 break 2199 } 2200 h = c.getNodeInfoData(); 2201 n != i && r.push({ parentId: n, currentId: l, data: h }); 2202 return !1 2203 } 2204 return !1 2205 }), N, this.listNode); 2206 this.listNodeUtils.removeNode(a, i, this.listNodeUtils.traverseNodeBF); 2207 let D = t; 2208 let _ = f; 2209 if (this.expandAndCollapseInfo.get(t) == I.Expand) { 2210 _ = !1; 2211 this.listNode.forEach((e => { 2212 e.getCurrentNodeId() == t && 0 == e.getCanShowFlagLine() && (D = e.getNodeInfoNode() 2213 .children 2214 .length ? e.getNodeInfoNode() 2215 .children[0] 2216 .currentNodeId : this.INITIAL_INVALID_VALUE) 2217 })) 2218 } else !this.expandAndCollapseInfo.get(t) && u && this.expandAndCollapseInfo.set(t, I.Expand); 2219 this.listNodeUtils.addDragNode(r[0].parentId, r[0].currentId, D, _, r[0].data); 2220 for (let e = 1;e < r.length; e++) this.listNodeUtils.addNode(r[e].parentId, r[e].currentId, r[e].data); 2221 for (let e = 0;e < this.listNode.length; e++) if (this.listNode[e].getCurrentNodeId() == i && null == this.listNode[e].getNodeInfoNode() 2222 .getNodeItem() 2223 .imageCollapse) { 2224 this.listNode[e].handleImageCollapseAfterAddNode(!1); 2225 this.expandAndCollapseInfo.delete(i); 2226 break 2227 } 2228 let T = [...this.listNode]; 2229 this.reloadListNode(this.listNodeUtils, T) 2230 } 2231 2232 reloadListNode(e, t) { 2233 let o = 0; 2234 this.listNode = []; 2235 this.listNodeUtils = e; 2236 this.loadedNodeIdAndIndexMap.clear(); 2237 this.listNodeUtils.traverseNodeDF((e => { 2238 if (e.currentNodeId >= 0) { 2239 var i = new S(e); 2240 this.listNode.push(i); 2241 this.expandAndCollapseInfo.get(e.currentNodeId) == I.Expand ? i.getNodeItem() 2242 .imageCollapse 2243 .changeImageCollapseSource(I.Expand) : this.expandAndCollapseInfo.get(e.currentNodeId) == I.Collapse && i.getNodeItem() 2244 .imageCollapse 2245 .changeImageCollapseSource(I.Collapse); 2246 for (let e = 0;e < t.length; e++) if (t[e].getCurrentNodeId() == i.getCurrentNodeId()) { 2247 i.setNodeIsShow(t[e].getNodeIsShow()); 2248 i.setListItemHeight(t[e].getListItemHeight()); 2249 i.getNodeItem().mainTitleNode && i.getIsShowTitle() && (i.getNodeItem() 2250 .mainTitleNode 2251 .title = t[e].getNodeItem().mainTitleNode.title); 2252 break 2253 } 2254 i.getNodeIsShow() && this.loadedNodeIdAndIndexMap.set(i.getCurrentNodeId(), o++) 2255 } 2256 return !1 2257 })) 2258 } 2259 2260 getFlagLine() { 2261 return this.FLAG_LINE 2262 } 2263 2264 getVisibility(e) { 2265 let t = this.loadedNodeIdAndIndexMap.get(e.getCurrentNodeId()) - 1; 2266 if (t > this.INITIAL_INVALID_VALUE) { 2267 let o = this.getData(t); 2268 return 1 != e.getCanShowFlagLine() || e.getIsHighLight() || o.getIsHighLight() ? Visibility.Hidden : Visibility.Visible 2269 } 2270 return 1 != e.getCanShowFlagLine() || e.getIsHighLight() ? Visibility.Hidden : Visibility.Visible 2271 } 2272 2273 getSubTitlePara() { 2274 return this.subTitle 2275 } 2276 2277 getIsFolder(e) { 2278 return!!this.loadedNodeIdAndIndexMap.has(e) && this.getData(this.loadedNodeIdAndIndexMap.get(e)).getIsFolder() 2279 } 2280 2281 getSubTitleFontColor(e) { 2282 return e ? this.subTitle.highLightFontColor : this.subTitle.normalFontColor 2283 } 2284 2285 getChildIndex(e, t) { 2286 let o = this.INITIAL_INVALID_VALUE; 2287 this.listNodeUtils.traverseNodeBF((function (i) { 2288 if (i.getCurrentNodeId() == e) { 2289 i.children.forEach(((e, i) => { 2290 e.getCurrentNodeId() == t && (o = i) 2291 })); 2292 return !0 2293 } 2294 return !1 2295 })); 2296 return o 2297 } 2298 2299 setCurrentFocusNodeId(e) { 2300 this.currentFocusNodeId = e 2301 } 2302 2303 getCurrentFocusNodeId() { 2304 return this.currentFocusNodeId 2305 } 2306 2307 setLastFocusNodeId(e) { 2308 this.lastFocusNodeId = e 2309 } 2310 2311 getLastFocusNodeId() { 2312 return this.lastFocusNodeId 2313 } 2314 2315 getAddFocusNodeId() { 2316 return this.addFocusNodeId 2317 } 2318 2319 setFlag(e) { 2320 this.flag = e 2321 } 2322 } 2323 2324 e.ListNodeDataSource = D; 2325 2326 function _(e) { 2327 let t = 0; 2328 this.listNodeDataSource.ListNode.forEach((function (o, i) { 2329 o.getNodeCurrentNodeId() == e && (t = i) 2330 })); 2331 return t 2332 } 2333 2334 class T extends ViewPU { 2335 constructor(e, t, o, i = -1) { 2336 super(e, o, i); 2337 this.listNodeDataSource = void 0; 2338 this.treeController = void 0; 2339 this.__dropSelectedIndex = new ObservedPropertySimplePU(0, this, "dropSelectedIndex"); 2340 this.listTreeViewMenu = null; 2341 this.__listTreeViewWidth = new SynchedPropertySimpleOneWayPU(t.listTreeViewWidth, this, "listTreeViewWidth"); 2342 this.__listTreeViewHeight = new SynchedPropertySimpleOneWayPU(t.listTreeViewHeight, this, "listTreeViewHeight"); 2343 this.MAX_CN_LENGTH = 254; 2344 this.MAX_EN_LENGTH = 255; 2345 this.INITIAL_INVALID_VALUE = -1; 2346 this.MAX_TOUCH_DOWN_COUNT = 0; 2347 this.isMultiPress = !1; 2348 this.touchDownCount = this.INITIAL_INVALID_VALUE; 2349 this.appEventBus = a.getInstance().getTreeListener(); 2350 this.itemPadding = { 2351 left: { 2352 id: -1, 2353 type: 10002, 2354 params: ["sys.float.ohos_id_card_margin_middle"], 2355 bundleName: "", 2356 moduleName: "" 2357 }, 2358 right: { 2359 id: -1, 2360 type: 10002, 2361 params: ["sys.float.ohos_id_card_margin_middle"], 2362 bundleName: "", 2363 moduleName: "" 2364 }, 2365 top: { 2366 id: -1, 2367 type: 10002, 2368 params: ["sys.float.ohos_id_text_margin_vertical"], 2369 bundleName: "", 2370 moduleName: "" 2371 }, 2372 bottom: { 2373 id: -1, 2374 type: 10002, 2375 params: ["sys.float.ohos_id_text_margin_vertical"], 2376 bundleName: "", 2377 moduleName: "" 2378 } 2379 }; 2380 this.textInputPadding = { left: "0vp", right: "0vp", top: "0vp", bottom: "0vp" }; 2381 this.setInitiallyProvidedValue(t) 2382 } 2383 2384 setInitiallyProvidedValue(e) { 2385 void 0 !== e.listNodeDataSource && (this.listNodeDataSource = e.listNodeDataSource); 2386 void 0 !== e.treeController && (this.treeController = e.treeController); 2387 void 0 !== e.dropSelectedIndex && (this.dropSelectedIndex = e.dropSelectedIndex); 2388 void 0 !== e.listTreeViewMenu && (this.listTreeViewMenu = e.listTreeViewMenu); 2389 void 0 !== e.MAX_CN_LENGTH && (this.MAX_CN_LENGTH = e.MAX_CN_LENGTH); 2390 void 0 !== e.MAX_EN_LENGTH && (this.MAX_EN_LENGTH = e.MAX_EN_LENGTH); 2391 void 0 !== e.INITIAL_INVALID_VALUE && (this.INITIAL_INVALID_VALUE = e.INITIAL_INVALID_VALUE); 2392 void 0 !== e.MAX_TOUCH_DOWN_COUNT && (this.MAX_TOUCH_DOWN_COUNT = e.MAX_TOUCH_DOWN_COUNT); 2393 void 0 !== e.isMultiPress && (this.isMultiPress = e.isMultiPress); 2394 void 0 !== e.touchDownCount && (this.touchDownCount = e.touchDownCount); 2395 void 0 !== e.appEventBus && (this.appEventBus = e.appEventBus); 2396 void 0 !== e.itemPadding && (this.itemPadding = e.itemPadding); 2397 void 0 !== e.textInputPadding && (this.textInputPadding = e.textInputPadding) 2398 } 2399 2400 updateStateVars(e) { 2401 this.__listTreeViewWidth.reset(e.listTreeViewWidth); 2402 this.__listTreeViewHeight.reset(e.listTreeViewHeight) 2403 } 2404 2405 purgeVariableDependenciesOnElmtId(e) { 2406 this.__dropSelectedIndex.purgeDependencyOnElmtId(e); 2407 this.__listTreeViewWidth.purgeDependencyOnElmtId(e); 2408 this.__listTreeViewHeight.purgeDependencyOnElmtId(e) 2409 } 2410 2411 aboutToBeDeleted() { 2412 this.__dropSelectedIndex.aboutToBeDeleted(); 2413 this.__listTreeViewWidth.aboutToBeDeleted(); 2414 this.__listTreeViewHeight.aboutToBeDeleted(); 2415 SubscriberManager.Get().delete(this.id__()); 2416 this.aboutToBeDeletedInternal() 2417 } 2418 2419 get dropSelectedIndex() { 2420 return this.__dropSelectedIndex.get() 2421 } 2422 2423 set dropSelectedIndex(e) { 2424 this.__dropSelectedIndex.set(e) 2425 } 2426 2427 get listTreeViewWidth() { 2428 return this.__listTreeViewWidth.get() 2429 } 2430 2431 set listTreeViewWidth(e) { 2432 this.__listTreeViewWidth.set(e) 2433 } 2434 2435 get listTreeViewHeight() { 2436 return this.__listTreeViewHeight.get() 2437 } 2438 2439 set listTreeViewHeight(e) { 2440 this.__listTreeViewHeight.set(e) 2441 } 2442 2443 aboutToAppear() { 2444 this.listTreeViewWidth = void 0 === this.listTreeViewWidth ? 200 : this.listTreeViewWidth; 2445 this.listNodeDataSource = this.treeController.getListNodeDataSource() 2446 } 2447 2448 checkInvalidPattern(e) { 2449 return /[\\\/:*?"<>|]/.test(e) 2450 } 2451 2452 checkIsAllCN(e) { 2453 return /^[\u4e00-\u9fa5]+$/.test(e) 2454 } 2455 2456 popupForShowTitle(e, t, o, i = null) { 2457 this.observeComponentCreation(((e, o) => { 2458 ViewStackProcessor.StartGetAccessRecordingFor(e); 2459 Row.create(); 2460 Row.backgroundColor(t); 2461 Row.border({ 2462 radius: { 2463 id: -1, 2464 type: 10002, 2465 params: ["sys.float.ohos_id_elements_margin_horizontal_l"], 2466 bundleName: "", 2467 moduleName: "" 2468 } 2469 }); 2470 Row.padding({ 2471 left: { 2472 id: -1, 2473 type: 10002, 2474 params: ["sys.float.ohos_id_elements_margin_horizontal_l"], 2475 bundleName: "", 2476 moduleName: "" 2477 }, 2478 right: { 2479 id: -1, 2480 type: 10002, 2481 params: ["sys.float.ohos_id_elements_margin_horizontal_l"], 2482 bundleName: "", 2483 moduleName: "" 2484 }, 2485 top: { 2486 id: -1, 2487 type: 10002, 2488 params: ["sys.float.ohos_id_card_margin_middle"], 2489 bundleName: "", 2490 moduleName: "" 2491 }, 2492 bottom: { 2493 id: -1, 2494 type: 10002, 2495 params: ["sys.float.ohos_id_card_margin_middle"], 2496 bundleName: "", 2497 moduleName: "" 2498 } 2499 }); 2500 o || Row.pop(); 2501 ViewStackProcessor.StopGetAccessRecording() 2502 })); 2503 this.observeComponentCreation(((t, i) => { 2504 ViewStackProcessor.StartGetAccessRecordingFor(t); 2505 Text.create(e); 2506 Text.fontSize({ 2507 id: -1, 2508 type: 10002, 2509 params: ["sys.float.ohos_id_text_size_body2"], 2510 bundleName: "", 2511 moduleName: "" 2512 }); 2513 Text.fontWeight("regular"); 2514 Text.fontColor(o); 2515 i || Text.pop(); 2516 ViewStackProcessor.StopGetAccessRecording() 2517 })); 2518 Text.pop(); 2519 Row.pop() 2520 } 2521 2522 builder(e = null) { 2523 this.listTreeViewMenu.bind(this)() 2524 } 2525 2526 draggingPopup(e, o = null) { 2527 this.observeComponentCreation(((e, t) => { 2528 ViewStackProcessor.StartGetAccessRecordingFor(e); 2529 Row.create(); 2530 Row.constraintSize({ 2531 minWidth: this.listNodeDataSource.getDragPopupPara().floorConstraintSize.minWidth, 2532 maxWidth: this.listNodeDataSource.getDragPopupPara().floorConstraintSize.maxWidth 2533 }); 2534 Row.height(this.listNodeDataSource.getDragPopupPara().height); 2535 Row.backgroundColor(this.listNodeDataSource.getDragPopupPara().backgroundColor); 2536 Row.padding({ 2537 left: this.listNodeDataSource.getDragPopupPara().padding.left, 2538 right: this.listNodeDataSource.getDragPopupPara().padding.right 2539 }); 2540 Row.shadow({ 2541 radius: this.listNodeDataSource.getDragPopupPara().shadow.radius, 2542 color: this.listNodeDataSource.getDragPopupPara().shadow.color, 2543 offsetY: this.listNodeDataSource.getDragPopupPara().shadow.offsetY 2544 }); 2545 Row.borderRadius(this.listNodeDataSource.getDragPopupPara().borderRadius); 2546 t || Row.pop(); 2547 ViewStackProcessor.StopGetAccessRecording() 2548 })); 2549 this.observeComponentCreation(((o, i) => { 2550 ViewStackProcessor.StartGetAccessRecordingFor(o); 2551 If.create(); 2552 e.getNodeItem().imageNode ? this.ifElseBranchUpdateFunction(0, (() => { 2553 this.observeComponentCreation(((o, i) => { 2554 ViewStackProcessor.StartGetAccessRecordingFor(o); 2555 Row.create(); 2556 Row.backgroundColor(t); 2557 Row.margin({ right: e.getNodeItem().imageNode.itemRightMargin }); 2558 Row.height(e.getNodeItem().imageNode.itemHeight); 2559 Row.width(e.getNodeItem().imageNode.itemWidth); 2560 i || Row.pop(); 2561 ViewStackProcessor.StopGetAccessRecording() 2562 })); 2563 this.observeComponentCreation(((t, o) => { 2564 ViewStackProcessor.StartGetAccessRecordingFor(t); 2565 Image.create(e.getNodeItem().imageNode.normalSource); 2566 Image.objectFit(ImageFit.Contain); 2567 Image.height(e.getNodeItem().imageNode.itemHeight); 2568 Image.width(e.getNodeItem().imageNode.itemWidth); 2569 Image.opacity(this.listNodeDataSource.getDragPopupPara().imageOpacity); 2570 o || Image.pop(); 2571 ViewStackProcessor.StopGetAccessRecording() 2572 })); 2573 Row.pop() 2574 })) : If.branchId(1); 2575 i || If.pop(); 2576 ViewStackProcessor.StopGetAccessRecording() 2577 })); 2578 If.pop(); 2579 this.observeComponentCreation(((t, o) => { 2580 ViewStackProcessor.StartGetAccessRecordingFor(t); 2581 Row.create(); 2582 Row.constraintSize({ 2583 minWidth: e.getNodeItem().imageNode ? this.listNodeDataSource.getDragPopupPara() 2584 .textConstraintSize 2585 .minWidth1 : this.listNodeDataSource.getDragPopupPara() 2586 .textConstraintSize 2587 .minWidth2, 2588 maxWidth: e.getNodeItem().imageNode ? this.listNodeDataSource.getDragPopupPara() 2589 .textConstraintSize 2590 .maxWidth1 : this.listNodeDataSource.getDragPopupPara() 2591 .textConstraintSize 2592 .maxWidth2 2593 }); 2594 o || Row.pop(); 2595 ViewStackProcessor.StopGetAccessRecording() 2596 })); 2597 this.observeComponentCreation(((t, o) => { 2598 ViewStackProcessor.StartGetAccessRecordingFor(t); 2599 If.create(); 2600 e.getNodeItem().mainTitleNode && e.getIsShowTitle() ? this.ifElseBranchUpdateFunction(0, (() => { 2601 this.observeComponentCreation(((t, o) => { 2602 ViewStackProcessor.StartGetAccessRecordingFor(t); 2603 Text.create(e.getNodeItem().mainTitleNode.title); 2604 Text.maxLines(1); 2605 Text.fontSize(e.getNodeItem().mainTitleNode.size); 2606 Text.fontColor(this.listNodeDataSource.getDragPopupPara().fontColor); 2607 Text.fontWeight(this.listNodeDataSource.getDragPopupPara().fontWeight); 2608 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 2609 o || Text.pop(); 2610 ViewStackProcessor.StopGetAccessRecording() 2611 })); 2612 Text.pop() 2613 })) : If.branchId(1); 2614 o || If.pop(); 2615 ViewStackProcessor.StopGetAccessRecording() 2616 })); 2617 If.pop(); 2618 Row.pop(); 2619 Row.pop() 2620 } 2621 2622 initialRender() { 2623 this.observeComponentCreation(((e, t) => { 2624 ViewStackProcessor.StartGetAccessRecordingFor(e); 2625 List.create({}); 2626 List.width(this.listTreeViewWidth); 2627 List.height(this.listTreeViewHeight); 2628 List.onDragMove((e => { 2629 if (this.isMultiPress) { 2630 console.error("drag error, a item has been dragged"); 2631 return 2632 } 2633 let t = Math.floor(e.getY() / 24) % 2 ? g.DOWN_FLAG : g.UP_FLAG; 2634 let o = Math.floor(e.getY() / 48); 2635 let i = !1; 2636 if (o >= this.listNodeDataSource.totalCount()) { 2637 t = g.DOWN_FLAG; 2638 o = this.listNodeDataSource.totalCount() - 1; 2639 this.listNodeDataSource.getData(o).setIsOverBorder(!0); 2640 i = !0 2641 } else this.listNodeDataSource.getData(o).setIsOverBorder(!1); 2642 let s = this.listNodeDataSource.getData(o).getCurrentNodeId(); 2643 if (o != this.listNodeDataSource.getLastPassIndex() && this.listNodeDataSource.getIsInnerDrag()) { 2644 if (this.listNodeDataSource.getIsParentOfInsertNode(s)) { 2645 this.listNodeDataSource.setPassIndex(o); 2646 let e = this; 2647 this.listNodeDataSource.clearTimeOutAboutDelayHighLightAndExpand(_.call(e, s)); 2648 this.listNodeDataSource.setFlag(g.NONE); 2649 return 2650 } 2651 } 2652 this.listNodeDataSource.setLastPassIndex(o); 2653 this.listNodeDataSource.setVisibility(t, o, i); 2654 if (s != this.listNodeDataSource.getDraggingCurrentNodeId()) { 2655 let e = this; 2656 this.listNodeDataSource.delayHighLightAndExpandNode(_.call(e, s), s, o) 2657 } 2658 })); 2659 List.onDragEnter(((e, t) => { 2660 if (this.listNodeDataSource.getIsInnerDrag()) { 2661 this.listNodeDataSource.setIsDrag(!0); 2662 let e = .4; 2663 this.listNodeDataSource.setListItemOpacity(e) 2664 } 2665 })); 2666 List.onDragLeave(((e, t) => { 2667 this.listNodeDataSource.hideLastLine(); 2668 this.listNodeDataSource.clearLastTimeoutHighLight(); 2669 this.listNodeDataSource.clearLastTimeoutExpand(); 2670 this.listNodeDataSource.setListItemOpacity(1); 2671 this.listNodeDataSource.setIsDrag(!1); 2672 this.listNodeDataSource.notifyDataReload() 2673 })); 2674 List.onDrop(((e, t) => { 2675 this.listNodeDataSource.clearLastTimeoutExpand(); 2676 this.listNodeDataSource.setListItemOpacity(1); 2677 let o = this.listNodeDataSource.getPassIndex(); 2678 let i = this.dropSelectedIndex; 2679 if (i - 1 > this.listNodeDataSource.totalCount() || null == i) { 2680 console.error("drag error, currentNodeIndex is not found"); 2681 this.listNodeDataSource.setIsDrag(!1); 2682 return 2683 } 2684 if (o == this.listNodeDataSource.totalCount()) { 2685 console.log("need to insert into the position of the last line, now insertNodeIndex = insertNodeIndex - 1"); 2686 o -= 1 2687 } 2688 let s = this.listNodeDataSource.getData(o); 2689 let a = s.getNodeCurrentNodeId(); 2690 if (!this.listNodeDataSource.getIsDrag() || !this.listNodeDataSource.getIsInnerDrag()) { 2691 this.listNodeDataSource.clearLastTimeoutHighLight(); 2692 this.listNodeDataSource.setIsInnerDrag(!1); 2693 this.listNodeDataSource.hideLastLine(); 2694 this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex(); 2695 this.listNodeDataSource.refreshSubtitle(a); 2696 this.listNodeDataSource.notifyDataReload(); 2697 return 2698 } 2699 let d = this.listNodeDataSource.getCurrentNodeInfo(); 2700 let n = s.getNodeParentNodeId(); 2701 let l = this.listNodeDataSource.getDraggingCurrentNodeId(); 2702 let h = this.listNodeDataSource.getDraggingParentNodeId(); 2703 if (this.listNodeDataSource.getIsParentOfInsertNode(a)) { 2704 this.listNodeDataSource.clearLastTimeoutHighLight(); 2705 this.listNodeDataSource.setIsInnerDrag(!1); 2706 this.listNodeDataSource.hideLastLine(); 2707 this.listNodeDataSource.notifyDataChange(o); 2708 this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex(); 2709 this.listNodeDataSource.setIsDrag(!1); 2710 let e = this; 2711 let t = _.call(e, l); 2712 this.listNodeDataSource.setClickIndex(t); 2713 this.listNodeDataSource.handleEvent(r.DRAG, t); 2714 return 2715 } 2716 if (this.listNodeDataSource.getExpandAndCollapseInfo(l) == I.Expand) { 2717 let e = this; 2718 this.listNodeDataSource.expandAndCollapseNode(_.call(e, l)) 2719 } 2720 if (this.listNodeDataSource.getExpandAndCollapseInfo(a) == I.Collapse) { 2721 let e = this; 2722 let t = _.call(e, a); 2723 this.listNodeDataSource.ListNode[t].getIsHighLight() && this.listNodeDataSource.expandAndCollapseNode(t) 2724 } 2725 this.listNodeDataSource.setLastDelayHighLightId(); 2726 if (l != a) { 2727 this.listNodeDataSource.alterDragNode(n, a, s, h, l, d); 2728 this.listNodeDataSource.hideLastLine() 2729 } else { 2730 this.listNodeDataSource.hideLastLine(); 2731 this.listNodeDataSource.setLastPassId(l); 2732 this.listNodeDataSource.hideLastLine() 2733 } 2734 let g = _.call(this, this.listNodeDataSource.getLastDelayHighLightId()); 2735 this.listNodeDataSource.setLastDelayHighLightIndex(g); 2736 this.listNodeDataSource.clearLastTimeoutHighLight(); 2737 this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex(); 2738 this.listNodeDataSource.setIsDrag(!1); 2739 let c = _.call(this, l); 2740 this.listNodeDataSource.setClickIndex(c); 2741 this.listNodeDataSource.handleEvent(r.DRAG, c); 2742 this.listNodeDataSource.setIsInnerDrag(!1); 2743 this.listNodeDataSource.notifyDataReload() 2744 })); 2745 t || List.pop(); 2746 ViewStackProcessor.StopGetAccessRecording() 2747 })); 2748 { 2749 const e = e => { 2750 const i = e; 2751 { 2752 const e = void 0 !== globalThis.__lazyForEachItemGenFunction && !0; 2753 const a = (t, o) => { 2754 ViewStackProcessor.StartGetAccessRecordingFor(t); 2755 ListItem.create(g, e); 2756 ListItem.width("100%"); 2757 ListItem.height(i.getListItemHeight()); 2758 ListItem.padding({ left: this.itemPadding.left, right: this.itemPadding.right }); 2759 ListItem.align(Alignment.Start); 2760 ListItem.onDragStart(((e, t) => { 2761 if (this.listNodeDataSource.getIsDrag() || this.listNodeDataSource.getIsInnerDrag() || this.isMultiPress) { 2762 console.error("drag error, a item has been dragged"); 2763 return 2764 } 2765 this.dropSelectedIndex = JSON.parse(t).selectedIndex; 2766 let o = JSON.parse(t).selectedIndex; 2767 let s = this.listNodeDataSource.getData(o); 2768 let a = i.getNodeCurrentNodeId(); 2769 if (o >= this.listNodeDataSource.totalCount() || null == o) { 2770 console.error("drag error, currentNodeIndex is not found in onDragStart"); 2771 return 2772 } 2773 this.listNodeDataSource.setIsInnerDrag(!0); 2774 this.listNodeDataSource.setIsDrag(!0); 2775 this.listNodeDataSource.setCurrentNodeInfo(s); 2776 this.listNodeDataSource.setDraggingCurrentNodeId(s.getNodeCurrentNodeId()); 2777 this.listNodeDataSource.setDraggingParentNodeId(s.getNodeParentNodeId()); 2778 this.listNodeDataSource.setListItemOpacity(.4); 2779 this.listNodeDataSource.notifyDataChange(o); 2780 if (a == s.getNodeCurrentNodeId()) return { builder: () => { 2781 this.draggingPopup.call(this, s) 2782 } }; 2783 console.error("drag is too fast,it attribute a fault to OH"); 2784 this.listNodeDataSource.setIsDrag(!1) 2785 })); 2786 o || ListItem.pop(); 2787 ViewStackProcessor.StopGetAccessRecording() 2788 }; 2789 const d = () => { 2790 this.observeComponentCreation(a); 2791 this.observeComponentCreation(((e, a) => { 2792 ViewStackProcessor.StartGetAccessRecordingFor(e); 2793 If.create(); 2794 i.getNodeIsShow() ? this.ifElseBranchUpdateFunction(0, (() => { 2795 this.observeComponentCreation(((e, t) => { 2796 ViewStackProcessor.StartGetAccessRecordingFor(e); 2797 Column.create(); 2798 Column.focusable(!0); 2799 Column.onMouse((e => { 2800 let t = this; 2801 let o = _.call(t, i.getNodeCurrentNodeId()); 2802 if (e.button == MouseButton.Right) { 2803 t.listNodeDataSource.handleEvent(r.MOUSE_BUTTON_RIGHT, _.call(t, i.getNodeCurrentNodeId())); 2804 this.listTreeViewMenu = i.getMenu(); 2805 t.listNodeDataSource.setClickIndex(o); 2806 t.listNodeDataSource.setPopUpInfo(l.HINTS, h.NONE,!1, o); 2807 clearTimeout(i.getNodeItem().mainTitleNode.popUpTimeout) 2808 } 2809 e.stopPropagation() 2810 })); 2811 Column.padding({ top: this.itemPadding.top, bottom: this.itemPadding.bottom }); 2812 Column.bindPopup(i.getPopUpInfo().popUpIsShow, { 2813 builder: { builder: () => { 2814 this.popupForShowTitle.call(this, i.getPopUpInfo().popUpText, i.getPopUpInfo() 2815 .popUpColor, i.getPopUpInfo().popUpTextColor) 2816 } }, 2817 placement: Placement.BottomLeft, 2818 placementOnTop: !1, 2819 popupColor: i.getPopUpInfo().popUpColor, 2820 autoCancel: !0, 2821 enableArrow: i.getPopUpInfo().popUpEnableArrow 2822 }); 2823 t || Column.pop(); 2824 ViewStackProcessor.StopGetAccessRecording() 2825 })); 2826 this.observeComponentCreation(((e, t) => { 2827 ViewStackProcessor.StartGetAccessRecordingFor(e); 2828 Divider.create(); 2829 Divider.height(this.listNodeDataSource.getFlagLine().flagLineHeight); 2830 Divider.color(this.listNodeDataSource.getFlagLine().flagLineColor); 2831 Divider.visibility(this.listNodeDataSource.getVisibility(i)); 2832 Divider.lineCap(LineCapStyle.Round); 2833 Divider.margin({ left: i.getFlagLineLeftMargin() }); 2834 Divider.markAnchor({ 2835 x: this.listNodeDataSource.getFlagLine().xOffset, 2836 y: this.listNodeDataSource.getFlagLine().yTopOffset 2837 }); 2838 t || Divider.pop(); 2839 ViewStackProcessor.StopGetAccessRecording() 2840 })); 2841 this.observeComponentCreation(((e, t) => { 2842 ViewStackProcessor.StartGetAccessRecordingFor(e); 2843 Row.create({}); 2844 Row.opacity(this.listNodeDataSource.getListItemOpacity(i)); 2845 Row.markAnchor({ 2846 x: this.listNodeDataSource.getFlagLine().xOffset, 2847 y: this.listNodeDataSource.getFlagLine().yBasePlateOffset 2848 }); 2849 t || Row.pop(); 2850 ViewStackProcessor.StopGetAccessRecording() 2851 })); 2852 this.observeComponentCreation(((e, t) => { 2853 ViewStackProcessor.StartGetAccessRecordingFor(e); 2854 Row.create({}); 2855 Row.width("100%"); 2856 Row.onTouch((e => { 2857 let t = this; 2858 let o = _.call(t, i.getNodeCurrentNodeId()); 2859 let a = i.getNodeCurrentNodeId(); 2860 t.listNodeDataSource.setClickIndex(o); 2861 if (e.type === TouchType.Down) { 2862 this.touchDownCount++; 2863 this.isMultiPress = this.touchDownCount > this.MAX_TOUCH_DOWN_COUNT; 2864 this.listNodeDataSource.getIsTouchDown() || t.listNodeDataSource.handleEvent(r.TOUCH_DOWN, o) 2865 } 2866 if (e.type === TouchType.Up) { 2867 this.touchDownCount--; 2868 this.touchDownCount < this.MAX_TOUCH_DOWN_COUNT && (this.isMultiPress = !1); 2869 let e = { currentNodeId: a }; 2870 this.appEventBus.emit(s.NODE_CLICK, [e]); 2871 t.listNodeDataSource.handleEvent(r.TOUCH_UP, o) 2872 } 2873 })); 2874 Row.onHover((e => { 2875 let t = this; 2876 let o = _.call(t, i.getNodeCurrentNodeId()); 2877 e ? t.listNodeDataSource.handleEvent(r.HOVER, o) : t.listNodeDataSource.getIsTouchDown() || t.listNodeDataSource.handleEvent(r.HOVER_OVER, o) 2878 })); 2879 Gesture.create(GesturePriority.Low); 2880 TapGesture.create({ count: 2 }); 2881 TapGesture.onAction((e => { 2882 this.listNodeDataSource.expandAndCollapseNode(_.call(this, i.getNodeCurrentNodeId())) 2883 })); 2884 TapGesture.pop(); 2885 Gesture.pop(); 2886 Row.height(i.getNodeHeight()); 2887 Row.padding({ left: i.getNodeLeftPadding() }); 2888 Row.backgroundColor(i.getNodeItem().mainTitleNode && i.getNodeItem() 2889 .inputText && i.getIsShowInputText() ? i.getNodeItem().inputText.editColor : i.getNodeColor()); 2890 Row.border({ 2891 width: i.getNodeBorder().borderWidth, 2892 color: i.getNodeBorder().borderColor, 2893 radius: i.getNodeBorder().borderRadius 2894 }); 2895 Row.bindContextMenu({ builder: this.builder.bind(this) }, ResponseType.RightClick); 2896 t || Row.pop(); 2897 ViewStackProcessor.StopGetAccessRecording() 2898 })); 2899 this.observeComponentCreation(((e, o) => { 2900 ViewStackProcessor.StartGetAccessRecordingFor(e); 2901 If.create(); 2902 i.getNodeItem().imageNode ? this.ifElseBranchUpdateFunction(0, (() => { 2903 this.observeComponentCreation(((e, o) => { 2904 ViewStackProcessor.StartGetAccessRecordingFor(e); 2905 Row.create(); 2906 Row.backgroundColor(t); 2907 Row.margin({ right: i.getNodeItem().imageNode.itemRightMargin }); 2908 Row.height(i.getNodeItem().imageNode.itemHeight); 2909 Row.width(i.getNodeItem().imageNode.itemWidth); 2910 o || Row.pop(); 2911 ViewStackProcessor.StopGetAccessRecording() 2912 })); 2913 this.observeComponentCreation(((e, t) => { 2914 ViewStackProcessor.StartGetAccessRecordingFor(e); 2915 Image.create(i.getNodeItem().imageNode.source); 2916 Image.objectFit(ImageFit.Contain); 2917 Image.height(i.getNodeItem().imageNode.itemHeight); 2918 Image.width(i.getNodeItem().imageNode.itemWidth); 2919 Image.opacity(i.getIsSelected() || i.getIsHighLight() ? i.getNodeItem() 2920 .imageNode 2921 .noOpacity : i.getNodeItem() 2922 .imageNode 2923 .opacity); 2924 Image.focusable(null == i.getNodeItem().mainTitleNode); 2925 Image.onFocus((() => { 2926 this.listNodeDataSource.handleEvent(r.FOCUS, _.call(this, i.getNodeCurrentNodeId())) 2927 })); 2928 Image.onBlur((() => { 2929 this.listNodeDataSource.handleEvent(r.BLUR, _.call(this, i.getNodeCurrentNodeId())) 2930 })); 2931 t || Image.pop(); 2932 ViewStackProcessor.StopGetAccessRecording() 2933 })); 2934 Row.pop() 2935 })) : If.branchId(1); 2936 o || If.pop(); 2937 ViewStackProcessor.StopGetAccessRecording() 2938 })); 2939 If.pop(); 2940 this.observeComponentCreation(((e, t) => { 2941 ViewStackProcessor.StartGetAccessRecordingFor(e); 2942 Row.create(); 2943 Row.layoutWeight(1); 2944 t || Row.pop(); 2945 ViewStackProcessor.StopGetAccessRecording() 2946 })); 2947 this.observeComponentCreation(((e, t) => { 2948 ViewStackProcessor.StartGetAccessRecordingFor(e); 2949 If.create(); 2950 i.getNodeItem().mainTitleNode && i.getIsShowTitle() ? this.ifElseBranchUpdateFunction(0, (() => { 2951 this.observeComponentCreation(((e, t) => { 2952 ViewStackProcessor.StartGetAccessRecordingFor(e); 2953 Text.create(i.getNodeItem().mainTitleNode.title); 2954 Text.maxLines(1); 2955 Text.fontSize(i.getNodeItem().mainTitleNode.size); 2956 Text.fontColor(i.getNodeItem().mainTitleNode.color); 2957 Text.margin({ right: i.getNodeItem().mainTitleNode.itemRightMargin }); 2958 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 2959 Text.fontWeight(i.getNodeItem().mainTitleNode.weight); 2960 Text.focusable(!0); 2961 Text.onFocus((() => { 2962 this.listNodeDataSource.handleEvent(r.FOCUS, _.call(this, i.getNodeCurrentNodeId())) 2963 })); 2964 Text.onBlur((() => { 2965 this.listNodeDataSource.handleEvent(r.BLUR, _.call(this, i.getNodeCurrentNodeId())) 2966 })); 2967 t || Text.pop(); 2968 ViewStackProcessor.StopGetAccessRecording() 2969 })); 2970 Text.pop() 2971 })) : If.branchId(1); 2972 t || If.pop(); 2973 ViewStackProcessor.StopGetAccessRecording() 2974 })); 2975 If.pop(); 2976 this.observeComponentCreation(((e, t) => { 2977 ViewStackProcessor.StartGetAccessRecordingFor(e); 2978 If.create(); 2979 i.getNodeItem().mainTitleNode && i.getNodeItem() 2980 .inputText && i.getIsShowInputText() ? this.ifElseBranchUpdateFunction(0, (() => { 2981 this.observeComponentCreation(((e, t) => { 2982 ViewStackProcessor.StartGetAccessRecordingFor(e); 2983 Row.create(); 2984 Row.backgroundColor(i.getNodeItem().inputText.backgroundColor); 2985 Row.borderRadius(i.getNodeItem().inputText.borderRadius); 2986 Row.margin({ right: i.getNodeItem().inputText.itemRightMargin }); 2987 t || Row.pop(); 2988 ViewStackProcessor.StopGetAccessRecording() 2989 })); 2990 this.observeComponentCreation(((e, t) => { 2991 ViewStackProcessor.StartGetAccessRecordingFor(e); 2992 TextInput.create({ text: i.getNodeItem().mainTitleNode.title }); 2993 TextInput.height(i.getNodeItem().inputText.itemHeight); 2994 TextInput.fontSize(i.getNodeItem().inputText.size); 2995 TextInput.fontColor(i.getNodeItem().inputText.color); 2996 TextInput.borderRadius(i.getNodeItem().inputText.borderRadius); 2997 TextInput.backgroundColor(i.getNodeItem().inputText.backgroundColor); 2998 TextInput.enterKeyType(EnterKeyType.Done); 2999 TextInput.padding({ 3000 left: this.textInputPadding.left, 3001 right: this.textInputPadding.right, 3002 top: this.textInputPadding.top, 3003 bottom: this.textInputPadding.bottom 3004 }); 3005 TextInput.onChange((e => { 3006 let t = this; 3007 var o = _.call(t, i.getNodeCurrentNodeId()); 3008 let s = ""; 3009 let a = !1; 3010 let d = !1; 3011 if (t.checkInvalidPattern(e)) { 3012 for (let o = 0;o < e.length; o++) t.checkInvalidPattern(e[o]) || (s += e[o]); 3013 a = !0; 3014 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.INVALID_ERROR,!0, o) 3015 } else { 3016 s = e; 3017 a = !1; 3018 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.INVALID_ERROR,!1, o) 3019 } 3020 if (t.checkIsAllCN(s) && s.length > this.MAX_CN_LENGTH || !t.checkIsAllCN(s) && s.length > this.MAX_EN_LENGTH) { 3021 s = t.checkIsAllCN(s) ? s.substr(0, this.MAX_CN_LENGTH) : s.substr(0, this.MAX_EN_LENGTH); 3022 d = !0; 3023 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.LENGTH_ERROR,!0, o) 3024 } else d = !1; 3025 if (!d && !a) { 3026 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.LENGTH_ERROR,!1, o); 3027 t.listNodeDataSource.setMainTitleNameOnEdit(o, s) 3028 } 3029 })); 3030 TextInput.onSubmit((e => { 3031 let t = this; 3032 var o = _.call(t, i.getNodeCurrentNodeId()); 3033 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.NONE,!1, o); 3034 t.listNodeDataSource.setItemVisibilityOnEdit(o, n.COMMIT_NODE) 3035 })); 3036 t || TextInput.pop(); 3037 ViewStackProcessor.StopGetAccessRecording() 3038 })); 3039 Row.pop() 3040 })) : If.branchId(1); 3041 t || If.pop(); 3042 ViewStackProcessor.StopGetAccessRecording() 3043 })); 3044 If.pop(); 3045 this.observeComponentCreation(((e, t) => { 3046 ViewStackProcessor.StartGetAccessRecordingFor(e); 3047 Blank.create(); 3048 t || Blank.pop(); 3049 ViewStackProcessor.StopGetAccessRecording() 3050 })); 3051 Blank.pop(); 3052 Row.pop(); 3053 this.observeComponentCreation(((e, t) => { 3054 ViewStackProcessor.StartGetAccessRecordingFor(e); 3055 If.create(); 3056 this.listNodeDataSource.hasSubtitle(i.getCurrentNodeId()) ? this.ifElseBranchUpdateFunction(0, (() => { 3057 this.observeComponentCreation(((e, t) => { 3058 ViewStackProcessor.StartGetAccessRecordingFor(e); 3059 Row.create(); 3060 Row.margin({ 3061 left: this.listNodeDataSource.getSubTitlePara().margin.left, 3062 right: i.getNodeItem().imageCollapse ? 0 : this.listNodeDataSource.getSubTitlePara() 3063 .margin 3064 .right 3065 }); 3066 t || Row.pop(); 3067 ViewStackProcessor.StopGetAccessRecording() 3068 })); 3069 this.observeComponentCreation(((e, t) => { 3070 ViewStackProcessor.StartGetAccessRecordingFor(e); 3071 Text.create(this.listNodeDataSource.getSubtitle(i.getCurrentNodeId())); 3072 Text.fontSize(this.listNodeDataSource.getSubTitlePara().fontSize); 3073 Text.fontColor(this.listNodeDataSource.getSubTitleFontColor(i.getIsHighLight() || i.getIsModify())); 3074 Text.fontWeight(this.listNodeDataSource.getSubTitlePara().fontWeight); 3075 t || Text.pop(); 3076 ViewStackProcessor.StopGetAccessRecording() 3077 })); 3078 Text.pop(); 3079 Row.pop() 3080 })) : If.branchId(1); 3081 t || If.pop(); 3082 ViewStackProcessor.StopGetAccessRecording() 3083 })); 3084 If.pop(); 3085 this.observeComponentCreation(((e, s) => { 3086 ViewStackProcessor.StartGetAccessRecordingFor(e); 3087 If.create(); 3088 i.getNodeItem().imageCollapse ? this.ifElseBranchUpdateFunction(0, (() => { 3089 this.observeComponentCreation(((e, o) => { 3090 ViewStackProcessor.StartGetAccessRecordingFor(e); 3091 Row.create(); 3092 Row.backgroundColor(t); 3093 Row.height(i.getNodeItem().imageCollapse.itemHeight); 3094 Row.width(i.getNodeItem().imageCollapse.itemWidth); 3095 o || Row.pop(); 3096 ViewStackProcessor.StopGetAccessRecording() 3097 })); 3098 this.observeComponentCreation(((e, s) => { 3099 ViewStackProcessor.StartGetAccessRecordingFor(e); 3100 Image.create(i.getNodeItem().imageCollapse.collapseSource); 3101 Image.fillColor(i.getNodeItem().imageCollapse.isCollapse ? t : o); 3102 Image.align(Alignment.End); 3103 Image.objectFit(ImageFit.Contain); 3104 Image.height(i.getNodeItem().imageCollapse.itemHeight); 3105 Image.width(i.getNodeItem().imageCollapse.itemWidth); 3106 Image.opacity(i.getIsHighLight() ? i.getNodeItem().imageCollapse.noOpacity : i.getNodeItem() 3107 .imageCollapse 3108 .opacity); 3109 Image.onTouch((e => { 3110 if (e.type === TouchType.Down) { 3111 let e = this; 3112 e.listNodeDataSource.expandAndCollapseNode(_.call(e, i.getNodeCurrentNodeId())); 3113 this.listNodeDataSource.setCurrentFocusNodeId(i.getCurrentNodeId()) 3114 } 3115 e.stopPropagation() 3116 })); 3117 s || Image.pop(); 3118 ViewStackProcessor.StopGetAccessRecording() 3119 })); 3120 Row.pop() 3121 })) : If.branchId(1); 3122 s || If.pop(); 3123 ViewStackProcessor.StopGetAccessRecording() 3124 })); 3125 If.pop(); 3126 Row.pop(); 3127 Row.pop(); 3128 this.observeComponentCreation(((e, t) => { 3129 ViewStackProcessor.StartGetAccessRecordingFor(e); 3130 If.create(); 3131 i.getCanShowBottomFlagLine() ? this.ifElseBranchUpdateFunction(0, (() => { 3132 this.observeComponentCreation(((e, t) => { 3133 ViewStackProcessor.StartGetAccessRecordingFor(e); 3134 If.create(); 3135 this.listNodeDataSource.getPassIndex() != this.listNodeDataSource.totalCount() - 1 || i.getIsHighLight() ? If.branchId(1) : this.ifElseBranchUpdateFunction(0, (() => { 3136 this.observeComponentCreation(((e, t) => { 3137 ViewStackProcessor.StartGetAccessRecordingFor(e); 3138 Divider.create(); 3139 Divider.height(this.listNodeDataSource.getFlagLine().flagLineHeight); 3140 Divider.color(this.listNodeDataSource.getFlagLine().flagLineColor); 3141 Divider.visibility(Visibility.Visible); 3142 Divider.lineCap(LineCapStyle.Round); 3143 Divider.margin({ left: i.getFlagLineLeftMargin() }); 3144 Divider.markAnchor({ 3145 x: this.listNodeDataSource.getFlagLine().xOffset, 3146 y: this.listNodeDataSource.getFlagLine().yBottomOffset 3147 }); 3148 t || Divider.pop(); 3149 ViewStackProcessor.StopGetAccessRecording() 3150 })) 3151 })); 3152 t || If.pop(); 3153 ViewStackProcessor.StopGetAccessRecording() 3154 })); 3155 If.pop() 3156 })) : If.branchId(1); 3157 t || If.pop(); 3158 ViewStackProcessor.StopGetAccessRecording() 3159 })); 3160 If.pop(); 3161 Column.pop() 3162 })) : If.branchId(1); 3163 a || If.pop(); 3164 ViewStackProcessor.StopGetAccessRecording() 3165 })); 3166 If.pop(); 3167 ListItem.pop() 3168 }; 3169 const g = (e, d) => { 3170 a(e, d); 3171 this.updateFuncByElmtId.set(e, a); 3172 this.observeComponentCreation(((e, a) => { 3173 ViewStackProcessor.StartGetAccessRecordingFor(e); 3174 If.create(); 3175 i.getNodeIsShow() ? this.ifElseBranchUpdateFunction(0, (() => { 3176 this.observeComponentCreation(((e, t) => { 3177 ViewStackProcessor.StartGetAccessRecordingFor(e); 3178 Column.create(); 3179 Column.focusable(!0); 3180 Column.onMouse((e => { 3181 let t = this; 3182 let o = _.call(t, i.getNodeCurrentNodeId()); 3183 if (e.button == MouseButton.Right) { 3184 t.listNodeDataSource.handleEvent(r.MOUSE_BUTTON_RIGHT, _.call(t, i.getNodeCurrentNodeId())); 3185 this.listTreeViewMenu = i.getMenu(); 3186 t.listNodeDataSource.setClickIndex(o); 3187 t.listNodeDataSource.setPopUpInfo(l.HINTS, h.NONE,!1, o); 3188 clearTimeout(i.getNodeItem().mainTitleNode.popUpTimeout) 3189 } 3190 e.stopPropagation() 3191 })); 3192 Column.padding({ top: this.itemPadding.top, bottom: this.itemPadding.bottom }); 3193 Column.bindPopup(i.getPopUpInfo().popUpIsShow, { 3194 builder: { builder: () => { 3195 this.popupForShowTitle.call(this, i.getPopUpInfo().popUpText, i.getPopUpInfo() 3196 .popUpColor, i.getPopUpInfo().popUpTextColor) 3197 } }, 3198 placement: Placement.BottomLeft, 3199 placementOnTop: !1, 3200 popupColor: i.getPopUpInfo().popUpColor, 3201 autoCancel: !0, 3202 enableArrow: i.getPopUpInfo().popUpEnableArrow 3203 }); 3204 t || Column.pop(); 3205 ViewStackProcessor.StopGetAccessRecording() 3206 })); 3207 this.observeComponentCreation(((e, t) => { 3208 ViewStackProcessor.StartGetAccessRecordingFor(e); 3209 Divider.create(); 3210 Divider.height(this.listNodeDataSource.getFlagLine().flagLineHeight); 3211 Divider.color(this.listNodeDataSource.getFlagLine().flagLineColor); 3212 Divider.visibility(this.listNodeDataSource.getVisibility(i)); 3213 Divider.lineCap(LineCapStyle.Round); 3214 Divider.margin({ left: i.getFlagLineLeftMargin() }); 3215 Divider.markAnchor({ 3216 x: this.listNodeDataSource.getFlagLine().xOffset, 3217 y: this.listNodeDataSource.getFlagLine().yTopOffset 3218 }); 3219 t || Divider.pop(); 3220 ViewStackProcessor.StopGetAccessRecording() 3221 })); 3222 this.observeComponentCreation(((e, t) => { 3223 ViewStackProcessor.StartGetAccessRecordingFor(e); 3224 Row.create({}); 3225 Row.opacity(this.listNodeDataSource.getListItemOpacity(i)); 3226 Row.markAnchor({ 3227 x: this.listNodeDataSource.getFlagLine().xOffset, 3228 y: this.listNodeDataSource.getFlagLine().yBasePlateOffset 3229 }); 3230 t || Row.pop(); 3231 ViewStackProcessor.StopGetAccessRecording() 3232 })); 3233 this.observeComponentCreation(((e, t) => { 3234 ViewStackProcessor.StartGetAccessRecordingFor(e); 3235 Row.create({}); 3236 Row.width("100%"); 3237 Row.onTouch((e => { 3238 let t = this; 3239 let o = _.call(t, i.getNodeCurrentNodeId()); 3240 let a = i.getNodeCurrentNodeId(); 3241 t.listNodeDataSource.setClickIndex(o); 3242 if (e.type === TouchType.Down) { 3243 this.touchDownCount++; 3244 this.isMultiPress = this.touchDownCount > this.MAX_TOUCH_DOWN_COUNT; 3245 this.listNodeDataSource.getIsTouchDown() || t.listNodeDataSource.handleEvent(r.TOUCH_DOWN, o) 3246 } 3247 if (e.type === TouchType.Up) { 3248 this.touchDownCount--; 3249 this.touchDownCount < this.MAX_TOUCH_DOWN_COUNT && (this.isMultiPress = !1); 3250 let e = { currentNodeId: a }; 3251 this.appEventBus.emit(s.NODE_CLICK, [e]); 3252 t.listNodeDataSource.handleEvent(r.TOUCH_UP, o) 3253 } 3254 })); 3255 Row.onHover((e => { 3256 let t = this; 3257 let o = _.call(t, i.getNodeCurrentNodeId()); 3258 e ? t.listNodeDataSource.handleEvent(r.HOVER, o) : t.listNodeDataSource.getIsTouchDown() || t.listNodeDataSource.handleEvent(r.HOVER_OVER, o) 3259 })); 3260 Gesture.create(GesturePriority.Low); 3261 TapGesture.create({ count: 2 }); 3262 TapGesture.onAction((e => { 3263 this.listNodeDataSource.expandAndCollapseNode(_.call(this, i.getNodeCurrentNodeId())) 3264 })); 3265 TapGesture.pop(); 3266 Gesture.pop(); 3267 Row.height(i.getNodeHeight()); 3268 Row.padding({ left: i.getNodeLeftPadding() }); 3269 Row.backgroundColor(i.getNodeItem().mainTitleNode && i.getNodeItem() 3270 .inputText && i.getIsShowInputText() ? i.getNodeItem().inputText.editColor : i.getNodeColor()); 3271 Row.border({ 3272 width: i.getNodeBorder().borderWidth, 3273 color: i.getNodeBorder().borderColor, 3274 radius: i.getNodeBorder().borderRadius 3275 }); 3276 Row.bindContextMenu({ builder: this.builder.bind(this) }, ResponseType.RightClick); 3277 t || Row.pop(); 3278 ViewStackProcessor.StopGetAccessRecording() 3279 })); 3280 this.observeComponentCreation(((e, o) => { 3281 ViewStackProcessor.StartGetAccessRecordingFor(e); 3282 If.create(); 3283 i.getNodeItem().imageNode ? this.ifElseBranchUpdateFunction(0, (() => { 3284 this.observeComponentCreation(((e, o) => { 3285 ViewStackProcessor.StartGetAccessRecordingFor(e); 3286 Row.create(); 3287 Row.backgroundColor(t); 3288 Row.margin({ right: i.getNodeItem().imageNode.itemRightMargin }); 3289 Row.height(i.getNodeItem().imageNode.itemHeight); 3290 Row.width(i.getNodeItem().imageNode.itemWidth); 3291 o || Row.pop(); 3292 ViewStackProcessor.StopGetAccessRecording() 3293 })); 3294 this.observeComponentCreation(((e, t) => { 3295 ViewStackProcessor.StartGetAccessRecordingFor(e); 3296 Image.create(i.getNodeItem().imageNode.source); 3297 Image.objectFit(ImageFit.Contain); 3298 Image.height(i.getNodeItem().imageNode.itemHeight); 3299 Image.width(i.getNodeItem().imageNode.itemWidth); 3300 Image.opacity(i.getIsSelected() || i.getIsHighLight() ? i.getNodeItem() 3301 .imageNode 3302 .noOpacity : i.getNodeItem() 3303 .imageNode 3304 .opacity); 3305 Image.focusable(null == i.getNodeItem().mainTitleNode); 3306 Image.onFocus((() => { 3307 this.listNodeDataSource.handleEvent(r.FOCUS, _.call(this, i.getNodeCurrentNodeId())) 3308 })); 3309 Image.onBlur((() => { 3310 this.listNodeDataSource.handleEvent(r.BLUR, _.call(this, i.getNodeCurrentNodeId())) 3311 })); 3312 t || Image.pop(); 3313 ViewStackProcessor.StopGetAccessRecording() 3314 })); 3315 Row.pop() 3316 })) : If.branchId(1); 3317 o || If.pop(); 3318 ViewStackProcessor.StopGetAccessRecording() 3319 })); 3320 If.pop(); 3321 this.observeComponentCreation(((e, t) => { 3322 ViewStackProcessor.StartGetAccessRecordingFor(e); 3323 Row.create(); 3324 Row.layoutWeight(1); 3325 t || Row.pop(); 3326 ViewStackProcessor.StopGetAccessRecording() 3327 })); 3328 this.observeComponentCreation(((e, t) => { 3329 ViewStackProcessor.StartGetAccessRecordingFor(e); 3330 If.create(); 3331 i.getNodeItem().mainTitleNode && i.getIsShowTitle() ? this.ifElseBranchUpdateFunction(0, (() => { 3332 this.observeComponentCreation(((e, t) => { 3333 ViewStackProcessor.StartGetAccessRecordingFor(e); 3334 Text.create(i.getNodeItem().mainTitleNode.title); 3335 Text.maxLines(1); 3336 Text.fontSize(i.getNodeItem().mainTitleNode.size); 3337 Text.fontColor(i.getNodeItem().mainTitleNode.color); 3338 Text.margin({ right: i.getNodeItem().mainTitleNode.itemRightMargin }); 3339 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 3340 Text.fontWeight(i.getNodeItem().mainTitleNode.weight); 3341 Text.focusable(!0); 3342 Text.onFocus((() => { 3343 this.listNodeDataSource.handleEvent(r.FOCUS, _.call(this, i.getNodeCurrentNodeId())) 3344 })); 3345 Text.onBlur((() => { 3346 this.listNodeDataSource.handleEvent(r.BLUR, _.call(this, i.getNodeCurrentNodeId())) 3347 })); 3348 t || Text.pop(); 3349 ViewStackProcessor.StopGetAccessRecording() 3350 })); 3351 Text.pop() 3352 })) : If.branchId(1); 3353 t || If.pop(); 3354 ViewStackProcessor.StopGetAccessRecording() 3355 })); 3356 If.pop(); 3357 this.observeComponentCreation(((e, t) => { 3358 ViewStackProcessor.StartGetAccessRecordingFor(e); 3359 If.create(); 3360 i.getNodeItem().mainTitleNode && i.getNodeItem() 3361 .inputText && i.getIsShowInputText() ? this.ifElseBranchUpdateFunction(0, (() => { 3362 this.observeComponentCreation(((e, t) => { 3363 ViewStackProcessor.StartGetAccessRecordingFor(e); 3364 Row.create(); 3365 Row.backgroundColor(i.getNodeItem().inputText.backgroundColor); 3366 Row.borderRadius(i.getNodeItem().inputText.borderRadius); 3367 Row.margin({ right: i.getNodeItem().inputText.itemRightMargin }); 3368 t || Row.pop(); 3369 ViewStackProcessor.StopGetAccessRecording() 3370 })); 3371 this.observeComponentCreation(((e, t) => { 3372 ViewStackProcessor.StartGetAccessRecordingFor(e); 3373 TextInput.create({ text: i.getNodeItem().mainTitleNode.title }); 3374 TextInput.height(i.getNodeItem().inputText.itemHeight); 3375 TextInput.fontSize(i.getNodeItem().inputText.size); 3376 TextInput.fontColor(i.getNodeItem().inputText.color); 3377 TextInput.borderRadius(i.getNodeItem().inputText.borderRadius); 3378 TextInput.backgroundColor(i.getNodeItem().inputText.backgroundColor); 3379 TextInput.enterKeyType(EnterKeyType.Done); 3380 TextInput.padding({ 3381 left: this.textInputPadding.left, 3382 right: this.textInputPadding.right, 3383 top: this.textInputPadding.top, 3384 bottom: this.textInputPadding.bottom 3385 }); 3386 TextInput.onChange((e => { 3387 let t = this; 3388 var o = _.call(t, i.getNodeCurrentNodeId()); 3389 let s = ""; 3390 let a = !1; 3391 let d = !1; 3392 if (t.checkInvalidPattern(e)) { 3393 for (let o = 0;o < e.length; o++) t.checkInvalidPattern(e[o]) || (s += e[o]); 3394 a = !0; 3395 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.INVALID_ERROR,!0, o) 3396 } else { 3397 s = e; 3398 a = !1; 3399 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.INVALID_ERROR,!1, o) 3400 } 3401 if (t.checkIsAllCN(s) && s.length > this.MAX_CN_LENGTH || !t.checkIsAllCN(s) && s.length > this.MAX_EN_LENGTH) { 3402 s = t.checkIsAllCN(s) ? s.substr(0, this.MAX_CN_LENGTH) : s.substr(0, this.MAX_EN_LENGTH); 3403 d = !0; 3404 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.LENGTH_ERROR,!0, o) 3405 } else d = !1; 3406 if (!d && !a) { 3407 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.LENGTH_ERROR,!1, o); 3408 t.listNodeDataSource.setMainTitleNameOnEdit(o, s) 3409 } 3410 })); 3411 TextInput.onSubmit((e => { 3412 let t = this; 3413 var o = _.call(t, i.getNodeCurrentNodeId()); 3414 t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.NONE,!1, o); 3415 t.listNodeDataSource.setItemVisibilityOnEdit(o, n.COMMIT_NODE) 3416 })); 3417 t || TextInput.pop(); 3418 ViewStackProcessor.StopGetAccessRecording() 3419 })); 3420 Row.pop() 3421 })) : If.branchId(1); 3422 t || If.pop(); 3423 ViewStackProcessor.StopGetAccessRecording() 3424 })); 3425 If.pop(); 3426 this.observeComponentCreation(((e, t) => { 3427 ViewStackProcessor.StartGetAccessRecordingFor(e); 3428 Blank.create(); 3429 t || Blank.pop(); 3430 ViewStackProcessor.StopGetAccessRecording() 3431 })); 3432 Blank.pop(); 3433 Row.pop(); 3434 this.observeComponentCreation(((e, t) => { 3435 ViewStackProcessor.StartGetAccessRecordingFor(e); 3436 If.create(); 3437 this.listNodeDataSource.hasSubtitle(i.getCurrentNodeId()) ? this.ifElseBranchUpdateFunction(0, (() => { 3438 this.observeComponentCreation(((e, t) => { 3439 ViewStackProcessor.StartGetAccessRecordingFor(e); 3440 Row.create(); 3441 Row.margin({ 3442 left: this.listNodeDataSource.getSubTitlePara().margin.left, 3443 right: i.getNodeItem().imageCollapse ? 0 : this.listNodeDataSource.getSubTitlePara() 3444 .margin 3445 .right 3446 }); 3447 t || Row.pop(); 3448 ViewStackProcessor.StopGetAccessRecording() 3449 })); 3450 this.observeComponentCreation(((e, t) => { 3451 ViewStackProcessor.StartGetAccessRecordingFor(e); 3452 Text.create(this.listNodeDataSource.getSubtitle(i.getCurrentNodeId())); 3453 Text.fontSize(this.listNodeDataSource.getSubTitlePara().fontSize); 3454 Text.fontColor(this.listNodeDataSource.getSubTitleFontColor(i.getIsHighLight() || i.getIsModify())); 3455 Text.fontWeight(this.listNodeDataSource.getSubTitlePara().fontWeight); 3456 t || Text.pop(); 3457 ViewStackProcessor.StopGetAccessRecording() 3458 })); 3459 Text.pop(); 3460 Row.pop() 3461 })) : If.branchId(1); 3462 t || If.pop(); 3463 ViewStackProcessor.StopGetAccessRecording() 3464 })); 3465 If.pop(); 3466 this.observeComponentCreation(((e, s) => { 3467 ViewStackProcessor.StartGetAccessRecordingFor(e); 3468 If.create(); 3469 i.getNodeItem().imageCollapse ? this.ifElseBranchUpdateFunction(0, (() => { 3470 this.observeComponentCreation(((e, o) => { 3471 ViewStackProcessor.StartGetAccessRecordingFor(e); 3472 Row.create(); 3473 Row.backgroundColor(t); 3474 Row.height(i.getNodeItem().imageCollapse.itemHeight); 3475 Row.width(i.getNodeItem().imageCollapse.itemWidth); 3476 o || Row.pop(); 3477 ViewStackProcessor.StopGetAccessRecording() 3478 })); 3479 this.observeComponentCreation(((e, s) => { 3480 ViewStackProcessor.StartGetAccessRecordingFor(e); 3481 Image.create(i.getNodeItem().imageCollapse.collapseSource); 3482 Image.fillColor(i.getNodeItem().imageCollapse.isCollapse ? t : o); 3483 Image.align(Alignment.End); 3484 Image.objectFit(ImageFit.Contain); 3485 Image.height(i.getNodeItem().imageCollapse.itemHeight); 3486 Image.width(i.getNodeItem().imageCollapse.itemWidth); 3487 Image.opacity(i.getIsHighLight() ? i.getNodeItem().imageCollapse.noOpacity : i.getNodeItem() 3488 .imageCollapse 3489 .opacity); 3490 Image.onTouch((e => { 3491 if (e.type === TouchType.Down) { 3492 let e = this; 3493 e.listNodeDataSource.expandAndCollapseNode(_.call(e, i.getNodeCurrentNodeId())); 3494 this.listNodeDataSource.setCurrentFocusNodeId(i.getCurrentNodeId()) 3495 } 3496 e.stopPropagation() 3497 })); 3498 s || Image.pop(); 3499 ViewStackProcessor.StopGetAccessRecording() 3500 })); 3501 Row.pop() 3502 })) : If.branchId(1); 3503 s || If.pop(); 3504 ViewStackProcessor.StopGetAccessRecording() 3505 })); 3506 If.pop(); 3507 Row.pop(); 3508 Row.pop(); 3509 this.observeComponentCreation(((e, t) => { 3510 ViewStackProcessor.StartGetAccessRecordingFor(e); 3511 If.create(); 3512 i.getCanShowBottomFlagLine() ? this.ifElseBranchUpdateFunction(0, (() => { 3513 this.observeComponentCreation(((e, t) => { 3514 ViewStackProcessor.StartGetAccessRecordingFor(e); 3515 If.create(); 3516 this.listNodeDataSource.getPassIndex() != this.listNodeDataSource.totalCount() - 1 || i.getIsHighLight() ? If.branchId(1) : this.ifElseBranchUpdateFunction(0, (() => { 3517 this.observeComponentCreation(((e, t) => { 3518 ViewStackProcessor.StartGetAccessRecordingFor(e); 3519 Divider.create(); 3520 Divider.height(this.listNodeDataSource.getFlagLine().flagLineHeight); 3521 Divider.color(this.listNodeDataSource.getFlagLine().flagLineColor); 3522 Divider.visibility(Visibility.Visible); 3523 Divider.lineCap(LineCapStyle.Round); 3524 Divider.margin({ left: i.getFlagLineLeftMargin() }); 3525 Divider.markAnchor({ 3526 x: this.listNodeDataSource.getFlagLine().xOffset, 3527 y: this.listNodeDataSource.getFlagLine().yBottomOffset 3528 }); 3529 t || Divider.pop(); 3530 ViewStackProcessor.StopGetAccessRecording() 3531 })) 3532 })); 3533 t || If.pop(); 3534 ViewStackProcessor.StopGetAccessRecording() 3535 })); 3536 If.pop() 3537 })) : If.branchId(1); 3538 t || If.pop(); 3539 ViewStackProcessor.StopGetAccessRecording() 3540 })); 3541 If.pop(); 3542 Column.pop() 3543 })) : If.branchId(1); 3544 a || If.pop(); 3545 ViewStackProcessor.StopGetAccessRecording() 3546 })); 3547 If.pop(); 3548 ListItem.pop() 3549 }; 3550 e ? (() => { 3551 this.observeComponentCreation(a); 3552 ListItem.pop() 3553 })() : d() 3554 } 3555 }; 3556 const i = e => JSON.stringify(e); 3557 LazyForEach.create("1", this, this.listNodeDataSource, e, i); 3558 LazyForEach.pop() 3559 } 3560 List.pop() 3561 } 3562 3563 rerender() { 3564 this.updateDirtyElements() 3565 } 3566 } 3567 3568 __decorate([], T.prototype, "popupForShowTitle", null); 3569 __decorate([], T.prototype, "builder", null); 3570 __decorate([], T.prototype, "draggingPopup", null); 3571 e.TreeView = T; 3572 e.TreeController = class { 3573 constructor() { 3574 this.ROOT_NODE_ID = -1; 3575 this.nodeIdList = []; 3576 this.listNodeUtils = new C; 3577 this.listNodeDataSource = new D 3578 } 3579 3580 getListNodeDataSource() { 3581 return this.listNodeDataSource 3582 } 3583 3584 getClickNodeChildrenInfo() { 3585 let e = this.listNodeDataSource.getClickNodeId(); 3586 return this.listNodeUtils.getClickNodeChildrenInfo(e) 3587 } 3588 3589 getChildrenId() { 3590 let e = this.listNodeDataSource.getClickNodeId(); 3591 return this.listNodeUtils.getClickChildId(e) 3592 } 3593 3594 removeNode() { 3595 let e = this.listNodeDataSource.getClickNodeId(); 3596 let t = this.listNodeUtils.findParentNodeId(e); 3597 let o = this.listNodeUtils.removeNode(e, t, this.listNodeUtils.traverseNodeBF); 3598 this.listNodeDataSource.refreshData(this.listNodeUtils, n.REMOVE_NODE, t, o); 3599 this.nodeIdList.splice(this.nodeIdList.indexOf(e), 1) 3600 } 3601 3602 modifyNode() { 3603 let e = this.listNodeDataSource.getClickNodeId(); 3604 this.listNodeDataSource.setItemVisibilityOnEdit(e, n.MODIFY_NODE) 3605 } 3606 3607 add() { 3608 let e = this.listNodeDataSource.getClickNodeId(); 3609 if (e == this.listNodeDataSource.ROOT_NODE_ID || !this.listNodeDataSource.getIsFolder(e)) return; 3610 let t = { 3611 isFolder: !0, 3612 icon: null, 3613 selectedIcon: null, 3614 editIcon: null, 3615 menu: null, 3616 secondaryTitle: "" 3617 }; 3618 t = this.listNodeUtils.getNewNodeInfo(e); 3619 this.nodeIdList.push(this.nodeIdList[this.nodeIdList.length-1] + 1); 3620 let o = this.nodeIdList[this.nodeIdList.length-1]; 3621 this.listNodeUtils.addNewNodeId = o; 3622 this.listNodeUtils.addNode(e, o, { 3623 isFolder: t.isFolder, 3624 icon: t.icon, 3625 selectedIcon: t.selectedIcon, 3626 editIcon: t.editIcon, 3627 primaryTitle: "新建文件夹", 3628 menu: t.menu, 3629 secondaryTitle: t.secondaryTitle 3630 }); 3631 this.listNodeDataSource.refreshData(this.listNodeUtils, n.ADD_NODE, e, [o]) 3632 } 3633 3634 addNodeParam(e) { 3635 if (null != e.primaryTitle && !this.listNodeUtils.checkMainTitleIsValid(e.primaryTitle)) throw new Error('ListTreeNode[addNode]: The directory name cannot contain the following characters /: *? "< > | or exceeds the maximum length.'); 3636 if (null == e.primaryTitle && null == e.icon) throw new Error("ListTreeNode[addNode]: The icon and directory name cannot be empty at the same time."); 3637 if (e.currentNodeId === this.ROOT_NODE_ID || null === e.currentNodeId) throw new Error("ListTreeNode[addNode]: currentNodeId can not be -1 or null."); 3638 this.nodeIdList.push(e.currentNodeId); 3639 this.listNodeUtils.addNode(e.parentNodeId, e.currentNodeId, e); 3640 return this 3641 } 3642 3643 addNode(e) { 3644 if (null != e) { 3645 if (null != e.primaryTitle && !this.listNodeUtils.checkMainTitleIsValid(e.primaryTitle)) throw new Error('ListTreeNode[addNode]: The directory name cannot contain the following characters /: *? "< > | or exceeds the maximum length.'); 3646 if (null == e.primaryTitle && null == e.icon) throw new Error("ListTreeNode[addNode]: The icon and directory name cannot be empty at the same time."); 3647 if (e.currentNodeId === this.ROOT_NODE_ID || null === e.currentNodeId) throw new Error("ListTreeNode[addNode]: currentNodeId can not be -1 or null."); 3648 this.nodeIdList.push(e.currentNodeId); 3649 this.listNodeUtils.addNode(e.parentNodeId, e.currentNodeId, e); 3650 return this 3651 } 3652 this.add() 3653 } 3654 3655 buildDone() { 3656 this.listNodeDataSource.init(this.listNodeUtils); 3657 this.nodeIdList.sort(((e, t) => e - t)) 3658 } 3659 3660 refreshNode(e, t = "", o = "") { 3661 this.listNodeDataSource.setNodeSubtitlePara(e, t, o) 3662 } 3663 } 3664}(TreeView || (TreeView = {})); 3665 3666export default TreeView