1/** 2 * Copyright (c) 2023-2024 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 t = (this && this.t) || function (f19, target, key, desc) { 17 var c = arguments.length, 18 r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 19 if (typeof Reflect === 'object' && typeof Reflect.u3 === 'function') { 20 r = Reflect.u3(f19, target, key, desc); 21 } else { 22 for (var g19 = f19.length - 1; g19 >= 0; g19--) { 23 if (d = f19[g19]) { 24 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 25 } 26 } 27 } 28 return c > 3 && r && Object.defineProperty(target, key, r), r; 29}; 30if (!('finalizeConstruction' in ViewPU.prototype)) { 31 Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { 32 }); 33} 34 35const hilog = requireNapi('hilog'); 36const LengthMetrics = requireNapi('arkui.node').LengthMetrics; 37const resourceManager = requireNapi('resourceManager'); 38 39const u = 24; 40const a1 = 24; 41const b1 = 0; 42const c1 = 48; 43const d1 = 32; 44const e1 = 2; 45const f1 = 0; 46const g1 = 48; 47const h1 = 0; 48const i1 = 48; 49const j1 = 10; 50const l1 = 2; 51const m1 = 0.4; 52const n1 = 1; 53const o1 = 1; 54const q1 = 2; 55const s1 = '1.0vp'; 56const t1 = '0vp'; 57const u1 = '2.75vp'; 58const v1 = '-1.25vp'; 59const w1 = '1.5vp'; 60const z1 = '#FFFFFF'; 61const a2 = '#00000000'; 62const b2 = '#1A0A59F7'; 63const c2 = '#00001E'; 64const d2 = '48'; 65const e2 = '128vp'; 66const f2 = '208vp'; 67const g2 = '80vp'; 68const h2 = '160vp'; 69const i2 = '112vp'; 70const j2 = '192vp'; 71const l2 = '#00FFFFFF'; 72const m2 = 100; 73const n2 = 12; 74const o2 = 8; 75const TAG = 'TreeView'; 76const LOG_CODE = 0x3900; 77const ARROW_DOWN = { 78 'id': -1, 79 'type': 20000, 80 params: ['sys.media.ohos_ic_public_arrow_down'], 81 'bundleName': '__harDefaultBundleName__', 82 'moduleName': '__harDefaultModuleName__', 83}; 84const q2 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAIGNIUk0AAHomAAC' + 85 'AhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAl' + 86 'wSFlzAAAOxAAADsQBlSsOGwAAAKVJREFUeNpjYBgFo2AU0Bww4pL4////diC1hZGRcSo+A4DqWIDUZCB+AVTbiC7PhEfvByCeAjQgn4Dhy4E' + 87 '4BYgvYFODz4JYIF4DxBOwWYJkeAAQRwBdvxGbIcy4TG9sbPzX0NCwHsjUAuIiIPsDUOwkDsPXkhwHWFwaAsQlQAwyrJsYw4myAIslIPCHGMP' + 88 'xBhGO4PoGxF+AOA9o+NbRTDgKRgFxAAAzj0Grm3RjyAAAAABJRU5ErkJggg=='; 89const ARROW_RIGHT = { 90 'id': -1, 91 'type': 20000, 92 params: ['sys.media.ohos_ic_public_arrow_right'], 93 'bundleName': '__harDefaultBundleName__', 94 'moduleName': '__harDefaultModuleName__', 95}; 96const s2 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAIGNIUk0AAHomAA' + 97 'CAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAA' + 98 'lwSFlzAAAOxAAADsQBlSsOGwAAAKFJREFUeNpjYBgFowAE/v//bwHEPOToZSJS3XIg3k6OJcRaUALEFuRYwkyMosbGxusNDQ3XgMwCIHYAsl' + 99 'cDxX5RzQJKLGEmxbvkWMJEaqQxMjKuBVI5QGwDxOnUimR08AFK81DdAmAqArl8DhDfAOKpVLUAavh2IH4CxI7A4HpDMEgpMPwFUXFGS8NJCa' + 100 'L55BgOAixEqqsB4oOkGj4KRggAAN4STB9zyhGzAAAAAElFTkSuQmCC'; 101var Event; 102(function (Event) { 103 Event[Event['TOUCH_DOWN'] = 0] = 'TOUCH_DOWN'; 104 Event[Event['TOUCH_UP'] = 1] = 'TOUCH_UP'; 105 Event[Event['HOVER'] = 3] = 'HOVER'; 106 Event[Event['HOVER_OVER'] = 4] = 'HOVER_OVER'; 107 Event[Event['FOCUS'] = 5] = 'FOCUS'; 108 Event[Event['BLUR'] = 6] = 'BLUR'; 109 Event[Event['MOUSE_BUTTON_RIGHT'] = 7] = 'MOUSE_BUTTON_RIGHT'; 110 Event[Event['DRAG'] = 8] = 'DRAG'; 111})(Event || (Event = {})); 112var t2; 113(function (d19) { 114 d19[d19['ADD_NODE'] = 0] = 'ADD_NODE'; 115 d19[d19['REMOVE_NODE'] = 1] = 'REMOVE_NODE'; 116 d19[d19['MODIFY_NODE'] = 2] = 'MODIFY_NODE'; 117 d19[d19['COMMIT_NODE'] = 3] = 'COMMIT_NODE'; 118})(t2 || (t2 = {})); 119var u2; 120(function (c19) { 121 c19[c19['HINTS'] = 0] = 'HINTS'; 122 c19[c19['WARNINGS'] = 1] = 'WARNINGS'; 123})(u2 || (u2 = {})); 124var v2; 125(function (b19) { 126 b19[b19['INVALID_ERROR'] = 0] = 'INVALID_ERROR'; 127 b19[b19['LENGTH_ERROR'] = 1] = 'LENGTH_ERROR'; 128 b19[b19['NONE'] = 2] = 'NONE'; 129})(v2 || (v2 = {})); 130var w2; 131(function (a19) { 132 a19[a19['DOWN_FLAG'] = 0] = 'DOWN_FLAG'; 133 a19[a19['UP_FLAG'] = 1] = 'UP_FLAG'; 134 a19[a19['NONE'] = 2] = 'NONE'; 135})(w2 || (w2 = {})); 136 137export var z2; 138(function (z18) { 139 z18[z18['EXPAND'] = 0] = 'EXPAND'; 140 z18[z18['COLLAPSE'] = 1] = 'COLLAPSE'; 141})(z2 || (z2 = {})); 142 143export var a3; 144(function (y18) { 145 y18[y18['NORMAL'] = 0] = 'NORMAL'; 146 y18[y18['SELECTED'] = 1] = 'SELECTED'; 147 y18[y18['EDIT'] = 2] = 'EDIT'; 148 y18[y18['FINISH_EDIT'] = 3] = 'FINISH_EDIT'; 149 y18[y18['DRAG_INSERT'] = 4] = 'DRAG_INSERT'; 150 y18[y18['FINISH_DRAG_INSERT'] = 5] = 'FINISH_DRAG_INSERT'; 151})(a3 || (a3 = {})); 152var b3; 153(function (x18) { 154 x18[x18['ARROW_DOWN'] = 0] = 'ARROW_DOWN'; 155 x18[x18['ARROW_RIGHT'] = 1] = 'ARROW_RIGHT'; 156 x18[x18['ARROW_DOWN_WHITE'] = 2] = 'ARROW_DOWN_WHITE'; 157 x18[x18['ARROW_RIGHT_WHITE'] = 3] = 'ARROW_RIGHT_WHITE'; 158})(b3 || (b3 = {})); 159 160class c3 { 161 constructor() { 162 } 163 164 static getInstance() { 165 if (!c3.instance) { 166 c3.instance = new c3(); 167 } 168 return c3.instance; 169 } 170 171 createNode() { 172 return { 173 v3: undefined, 174 inputText: new t3(), 175 w3: new s3(''), 176 x3: undefined, 177 fontColor: undefined, 178 }; 179 } 180 181 y3(nodeParam) { 182 let w18 = this.createNode(); 183 if (nodeParam.icon) { 184 w18.v3 = new r3(nodeParam.icon, { 185 'id': -1, 186 'type': 10002, 187 params: ['sys.float.ohos_id_alpha_content_fourth'], 188 'bundleName': '__harDefaultBundleName__', 189 'moduleName': '__harDefaultModuleName__', 190 }, u, a1, nodeParam.selectedIcon, nodeParam.editIcon); 191 } 192 if (nodeParam.primaryTitle) { 193 w18.w3 = new s3(nodeParam.primaryTitle); 194 } 195 return w18; 196 } 197} 198 199let d3 = { 200 isFolder: true, 201 icon: '', 202 selectedIcon: '', 203 editIcon: '', 204 container: () => { 205 }, 206 secondaryTitle: '', 207 primaryTitle: '', 208 parentNodeId: -1, 209 currentNodeId: -1, 210}; 211 212class e3 { 213 constructor() { 214 this.z3 = '#1A0A59F7'; 215 this.a4 = { 216 'id': -1, 217 'type': 10001, 218 params: ['sys.color.ohos_id_color_primary'], 219 'bundleName': '__harDefaultBundleName__', 220 'moduleName': '__harDefaultModuleName__', 221 }; 222 this.b4 = { 223 'id': -1, 224 'type': 10001, 225 params: ['sys.color.ohos_id_color_secondary'], 226 'bundleName': '__harDefaultBundleName__', 227 'moduleName': '__harDefaultModuleName__', 228 }; 229 this.c4 = { 230 'id': -1, 231 'type': 10001, 232 params: ['sys.color.ohos_id_color_text_primary_activated'], 233 'bundleName': '__harDefaultBundleName__', 234 'moduleName': '__harDefaultModuleName__', 235 }; 236 this.d4 = { 237 'id': -1, 238 'type': 10001, 239 params: ['sys.color.ohos_id_color_click_effect'], 240 'bundleName': '__harDefaultBundleName__', 241 'moduleName': '__harDefaultModuleName__', 242 }; 243 this.e4 = { 244 'id': -1, 245 'type': 10001, 246 params: ['sys.color.ohos_id_color_hover'], 247 'bundleName': '__harDefaultBundleName__', 248 'moduleName': '__harDefaultModuleName__', 249 }; 250 this.f4 = { 251 'id': -1, 252 'type': 10001, 253 params: ['sys.color.ohos_id_color_focused_outline'], 254 'bundleName': '__harDefaultBundleName__', 255 'moduleName': '__harDefaultModuleName__', 256 }; 257 this.g4 = { 258 'id': -1, 259 'type': 10001, 260 params: ['sys.color.icon_secondary'], 261 'bundleName': '__harDefaultBundleName__', 262 'moduleName': '__harDefaultModuleName__', 263 }; 264 this.h4 = { 265 'id': -1, 266 'type': 10001, 267 params: ['sys.color.icon_secondary'], 268 'bundleName': '__harDefaultBundleName__', 269 'moduleName': '__harDefaultModuleName__', 270 }; 271 this.i4 = { 272 'id': -1, 273 'type': 10001, 274 params: ['sys.color.icon_tertiary'], 275 'bundleName': '__harDefaultBundleName__', 276 'moduleName': '__harDefaultModuleName__', 277 }; 278 } 279 280 static getInstance() { 281 if (!e3.instance) { 282 e3.instance = new e3(); 283 } 284 return e3.instance; 285 } 286} 287 288let f3 = class NodeInfo { 289 constructor(node, nodeParam) { 290 this.j4 = ''; 291 this.borderWidth = { has: e1, l4: f1 }; 292 this.m4 = false; 293 this.n4 = false; 294 this.o4 = false; 295 this.q4 = false; 296 this.r4 = false; 297 this.treeViewTheme = e3.getInstance(); 298 this.fontColor = ''; 299 this.node = node; 300 this.nodeParam = nodeParam; 301 this.s4 = c3.getInstance().y3(nodeParam); 302 this.t4 = { 303 u4: false, 304 v4: false, 305 w4: undefined, 306 x4: '', 307 y4: undefined, 308 }; 309 this.z4 = g1; 310 this.a5 = node.b5 * n2 + o2; 311 this.c5 = { 312 'id': -1, 313 'type': 10001, 314 params: ['sys.color.ohos_id_color_background'], 315 'bundleName': '__harDefaultBundleName__', 316 'moduleName': '__harDefaultModuleName__', 317 }; 318 this.d5 = (this.node.b5 > 0) ? false : true; 319 this.e5 = (this.node.b5 > 0) ? h1 : i1; 320 this.f5 = true; 321 this.g5 = false; 322 this.isSelected = false; 323 this.status = { 324 normal: { 325 'id': -1, 326 'type': 10001, 327 params: ['sys.color.ohos_id_color_background_transparent'], 328 'bundleName': '__harDefaultBundleName__', 329 'moduleName': '__harDefaultModuleName__', 330 }, 331 h5: this.treeViewTheme.e4, 332 i5: this.treeViewTheme.d4, 333 selected: this.treeViewTheme.z3, 334 j5: { 335 'id': -1, 336 'type': 10001, 337 params: ['sys.color.ohos_id_color_activated'], 338 'bundleName': '__harDefaultBundleName__', 339 'moduleName': '__harDefaultModuleName__', 340 } 341 }; 342 this.k5 = { 343 borderWidth: f1, 344 borderColor: this.treeViewTheme.f4, 345 borderRadius: { 346 'id': -1, 347 'type': 10002, 348 params: ['sys.float.ohos_id_corner_radius_clicked'], 349 'bundleName': '__harDefaultBundleName__', 350 'moduleName': '__harDefaultModuleName__', 351 } 352 }; 353 this.l5 = node.b5 * n2 + o2; 354 } 355 356 m5(v18) { 357 if (v18) { 358 this.s4.x3 = 359 q3.n5(b3.ARROW_RIGHT); 360 } else { 361 this.s4.x3 = undefined; 362 } 363 } 364 365 o5(color) { 366 this.fontColor = color; 367 } 368 369 p5() { 370 return this.fontColor; 371 } 372 373 q5() { 374 return this.t4; 375 } 376 377 r5(isShow) { 378 this.t4.u4 = isShow; 379 } 380 381 s5(u18) { 382 this.t4.v4 = u18; 383 } 384 385 t5(color) { 386 this.t4.w4 = color; 387 } 388 389 u5(text) { 390 this.t4.x4 = text; 391 } 392 393 v5(t18) { 394 this.t4.y4 = t18; 395 } 396 397 w5() { 398 return this.f5; 399 } 400 401 x5() { 402 return this.g5; 403 } 404 405 y5(s18) { 406 if (s18) { 407 this.f5 = false; 408 this.g5 = true; 409 } else { 410 this.f5 = true; 411 this.g5 = false; 412 } 413 } 414 415 z5(r18) { 416 if (r18) { 417 this.s4.x3 = 418 q3.n5(b3.ARROW_DOWN); 419 } else { 420 this.s4.x3 = undefined; 421 } 422 } 423 424 a6(q18) { 425 if (q18 === undefined) { 426 return; 427 } 428 this.c5 = q18; 429 } 430 431 b6() { 432 return this.c5; 433 } 434 435 c6(p18) { 436 this.e5 = p18; 437 } 438 439 d6() { 440 return this.e5; 441 } 442 443 e6() { 444 return this.node.currentNodeId; 445 } 446 447 f6() { 448 return this.node.parentNodeId; 449 } 450 451 g6() { 452 return this.a5; 453 } 454 455 h6() { 456 return this.z4; 457 } 458 459 i6(o18) { 460 this.d5 = o18; 461 } 462 463 j6() { 464 return this.d5; 465 } 466 467 k6() { 468 return this.s4; 469 } 470 471 l6() { 472 return this.status; 473 } 474 475 m6() { 476 return this.k5; 477 } 478 479 n6(n18) { 480 this.k5.borderWidth = n18 ? this.borderWidth.has : this.borderWidth.l4; 481 } 482 483 o6() { 484 return this.node.p6; 485 } 486 487 q6() { 488 return this.nodeParam.container; 489 } 490 491 r6(isSelected) { 492 this.isSelected = isSelected; 493 } 494 495 s6() { 496 return this.isSelected; 497 } 498 499 t6() { 500 return this.nodeParam; 501 } 502 503 u6() { 504 return this.node; 505 } 506 507 v6() { 508 return this.nodeParam.isFolder; 509 } 510 511 w6(m18) { 512 this.m4 = m18; 513 } 514 515 x6() { 516 return this.m4; 517 } 518 519 y6(l18) { 520 if (l18 === undefined) { 521 return; 522 } 523 this.l5 = l18 * n2 + o2; 524 } 525 526 z6() { 527 return this.l5; 528 } 529 530 a7() { 531 return this.node.b5; 532 } 533 534 b7(k18) { 535 this.n4 = k18; 536 } 537 538 c7() { 539 return this.n4; 540 } 541 542 d7(j18) { 543 this.o4 = j18; 544 } 545 546 e7() { 547 return this.o4; 548 } 549 550 f7(i18) { 551 this.q4 = i18; 552 } 553 554 g7() { 555 return this.q4; 556 } 557 558 h7(h18) { 559 this.r4 = h18; 560 } 561 562 i7() { 563 return this.r4; 564 } 565}; 566f3 = t([ 567 Observed 568], f3); 569 570export { f3 }; 571 572export var TreeListenType; 573(function (TreeListenType) { 574 TreeListenType['NODE_CLICK'] = 'NodeClick'; 575 TreeListenType['NODE_ADD'] = 'NodeAdd'; 576 TreeListenType['NODE_DELETE'] = 'NodeDelete'; 577 TreeListenType['NODE_MODIFY'] = 'NodeModify'; 578 TreeListenType['NODE_MOVE'] = 'NodeMove'; 579})(TreeListenType || (TreeListenType = {})); 580 581export class TreeListener { 582 constructor() { 583 this.j7 = []; 584 this.k7 = []; 585 } 586 587 on(type, callback) { 588 if (Array.isArray(type)) { 589 for (let g18 = 0, l = type.length; g18 < l; g18++) { 590 this.on(type[g18], callback); 591 } 592 } else { 593 (this.j7[type] || (this.j7[type] = [])).push(callback); 594 } 595 } 596 597 once(type, callback) { 598 if (Array.isArray(type)) { 599 this.off(type, callback); 600 } else { 601 (this.k7[type] || (this.k7[type] = [])).push(callback); 602 } 603 } 604 605 off(type, callback) { 606 if (type === null) { 607 this.j7 = []; 608 } 609 if (Array.isArray(type)) { 610 for (let f18 = 0, l = type.length; f18 < l; f18++) { 611 this.off(type[f18], callback); 612 } 613 } 614 let c18 = this.j7[type]; 615 if (!c18) { 616 return; 617 } 618 if (callback === null) { 619 this.j7[type] = null; 620 } 621 let d18 = c18.length; 622 while (d18--) { 623 let e18 = c18[d18]; 624 if (e18 === callback) { 625 c18.splice(d18, 1); 626 break; 627 } 628 } 629 } 630 631 emit(event, x17) { 632 if (this.k7[event]) { 633 let a18 = Array.from(this.k7[event]); 634 if (a18) { 635 for (let b18 = 0, l = a18.length; b18 < l; b18++) { 636 try { 637 a18[b18](x17); 638 } catch (e) { 639 throw new Error('once function callbacks error.'); 640 } 641 } 642 this.k7[event] = null; 643 } 644 } else if (this.j7[event]) { 645 let y17 = Array.from(this.j7[event]); 646 if (y17) { 647 for (let z17 = 0, l = y17.length; z17 < l; z17++) { 648 try { 649 y17[z17](x17); 650 } catch (e) { 651 throw new Error('on function callbacks error.'); 652 } 653 } 654 } 655 } 656 } 657} 658 659export class TreeListenerManager { 660 constructor() { 661 this.appEventBus = new TreeListener(); 662 } 663 664 static getInstance() { 665 if (AppStorage.Get('app_key_event_bus') === undefined) { 666 AppStorage.SetOrCreate('app_key_event_bus', new TreeListenerManager()); 667 } 668 return AppStorage.Get('app_key_event_bus'); 669 } 670 671 getTreeListener() { 672 return this.appEventBus; 673 } 674} 675TreeListenerManager.l7 = 'app_key_event_bus'; 676 677export class TreeView extends ViewPU { 678 constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 679 super(parent, __localStorage, elmtId, extraInfo); 680 if (typeof paramsLambda === 'function') { 681 this.paramsGenerator_ = paramsLambda; 682 } 683 this.treeController = new TreeController(); 684 this.m7 = new ObservedPropertyObjectPU([], this, 'nodeList'); 685 this.listNodeDataSource = new h3(); 686 this.n7 = new ObservedPropertyObjectPU(null, this, 'item'); 687 this.o7 = new ObservedPropertySimplePU(0, this, 'touchCount'); 688 this.p7 = new ObservedPropertySimplePU(0, this, 'dropSelectedIndex'); 689 this.q7 = new ObservedPropertySimplePU(-1, this, 'viewLastIndex'); 690 this.r7 = new ObservedPropertySimplePU(false, this, 'followingSystemFontScale'); 691 this.s7 = new ObservedPropertySimplePU(1, this, 'maxAppFontScale'); 692 this.t7 = new ObservedPropertyObjectPU({ 693 'id': -1, 694 'type': 10001, 695 params: ['sys.color.ohos_id_color_background_transparent'], 696 'bundleName': '__harDefaultBundleName__', 697 'moduleName': '__harDefaultModuleName__', 698 }, this, 'listItemBgColor'); 699 this.u7 = new ObservedPropertyObjectPU(e3.getInstance(), this, 'treeViewTheme'); 700 this.addProvidedVar('treeViewTheme', this.u7, false); 701 this.listTreeViewMenu = this.NullBuilder; 702 this.MAX_CN_LENGTH = 254; 703 this.MAX_EN_LENGTH = 255; 704 this.INITIAL_INVALID_VALUE = -1; 705 this.MAX_TOUCH_DOWN_COUNT = 0; 706 this.isMultiPress = false; 707 this.touchDownCount = this.INITIAL_INVALID_VALUE; 708 this.appEventBus = TreeListenerManager.getInstance().getTreeListener(); 709 this.itemPadding = { 710 left: { 711 'id': -1, 712 'type': 10002, 713 params: ['sys.float.ohos_id_card_margin_start'], 714 'bundleName': '__harDefaultBundleName__', 715 'moduleName': '__harDefaultModuleName__', 716 }, 717 right: { 718 'id': -1, 719 'type': 10002, 720 params: ['sys.float.ohos_id_card_margin_end'], 721 'bundleName': '__harDefaultBundleName__', 722 'moduleName': '__harDefaultModuleName__', 723 }, 724 top: { 725 'id': -1, 726 'type': 10002, 727 params: ['sys.float.ohos_id_text_margin_vertical'], 728 'bundleName': '__harDefaultBundleName__', 729 'moduleName': '__harDefaultModuleName__', 730 }, 731 bottom: { 732 'id': -1, 733 'type': 10002, 734 params: ['sys.float.ohos_id_text_margin_vertical'], 735 'bundleName': '__harDefaultBundleName__', 736 'moduleName': '__harDefaultModuleName__', 737 }, 738 }; 739 this.textInputPadding = { 740 left: { 741 'id': -1, 742 'type': 10002, 743 params: ['sys.float.padding_level0'], 744 'bundleName': '__harDefaultBundleName__', 745 'moduleName': '__harDefaultModuleName__', 746 }, 747 right: { 748 'id': -1, 749 'type': 10002, 750 params: ['sys.float.padding_level0'], 751 'bundleName': '__harDefaultBundleName__', 752 'moduleName': '__harDefaultModuleName__', 753 }, 754 top: { 755 'id': -1, 756 'type': 10002, 757 params: ['sys.float.padding_level0'], 758 'bundleName': '__harDefaultBundleName__', 759 'moduleName': '__harDefaultModuleName__', 760 }, 761 bottom: { 762 'id': -1, 763 'type': 10002, 764 params: ['sys.float.padding_level0'], 765 'bundleName': '__harDefaultBundleName__', 766 'moduleName': '__harDefaultModuleName__', 767 } 768 }; 769 this.setInitiallyProvidedValue(params); 770 this.finalizeConstruction(); 771 } 772 773 setInitiallyProvidedValue(params) { 774 if (params.treeController !== undefined) { 775 this.treeController = params.treeController; 776 } 777 if (params.nodeList !== undefined) { 778 this.nodeList = params.nodeList; 779 } 780 if (params.listNodeDataSource !== undefined) { 781 this.listNodeDataSource = params.listNodeDataSource; 782 } 783 if (params.item !== undefined) { 784 this.item = params.item; 785 } 786 if (params.touchCount !== undefined) { 787 this.touchCount = params.touchCount; 788 } 789 if (params.dropSelectedIndex !== undefined) { 790 this.dropSelectedIndex = params.dropSelectedIndex; 791 } 792 if (params.viewLastIndex !== undefined) { 793 this.viewLastIndex = params.viewLastIndex; 794 } 795 if (params.followingSystemFontScale !== undefined) { 796 this.followingSystemFontScale = params.followingSystemFontScale; 797 } 798 if (params.maxAppFontScale !== undefined) { 799 this.maxAppFontScale = params.maxAppFontScale; 800 } 801 if (params.listItemBgColor !== undefined) { 802 this.listItemBgColor = params.listItemBgColor; 803 } 804 if (params.treeViewTheme !== undefined) { 805 this.treeViewTheme = params.treeViewTheme; 806 } 807 if (params.listTreeViewMenu !== undefined) { 808 this.listTreeViewMenu = params.listTreeViewMenu; 809 } 810 if (params.MAX_CN_LENGTH !== undefined) { 811 this.MAX_CN_LENGTH = params.MAX_CN_LENGTH; 812 } 813 if (params.MAX_EN_LENGTH !== undefined) { 814 this.MAX_EN_LENGTH = params.MAX_EN_LENGTH; 815 } 816 if (params.INITIAL_INVALID_VALUE !== undefined) { 817 this.INITIAL_INVALID_VALUE = params.INITIAL_INVALID_VALUE; 818 } 819 if (params.MAX_TOUCH_DOWN_COUNT !== undefined) { 820 this.MAX_TOUCH_DOWN_COUNT = params.MAX_TOUCH_DOWN_COUNT; 821 } 822 if (params.isMultiPress !== undefined) { 823 this.isMultiPress = params.isMultiPress; 824 } 825 if (params.touchDownCount !== undefined) { 826 this.touchDownCount = params.touchDownCount; 827 } 828 if (params.appEventBus !== undefined) { 829 this.appEventBus = params.appEventBus; 830 } 831 if (params.itemPadding !== undefined) { 832 this.itemPadding = params.itemPadding; 833 } 834 if (params.textInputPadding !== undefined) { 835 this.textInputPadding = params.textInputPadding; 836 } 837 } 838 839 updateStateVars(params) { 840 } 841 842 purgeVariableDependenciesOnElmtId(rmElmtId) { 843 this.m7.purgeDependencyOnElmtId(rmElmtId); 844 this.n7.purgeDependencyOnElmtId(rmElmtId); 845 this.o7.purgeDependencyOnElmtId(rmElmtId); 846 this.p7.purgeDependencyOnElmtId(rmElmtId); 847 this.q7.purgeDependencyOnElmtId(rmElmtId); 848 this.r7.purgeDependencyOnElmtId(rmElmtId); 849 this.s7.purgeDependencyOnElmtId(rmElmtId); 850 this.t7.purgeDependencyOnElmtId(rmElmtId); 851 this.u7.purgeDependencyOnElmtId(rmElmtId); 852 } 853 854 aboutToBeDeleted() { 855 this.m7.aboutToBeDeleted(); 856 this.n7.aboutToBeDeleted(); 857 this.o7.aboutToBeDeleted(); 858 this.p7.aboutToBeDeleted(); 859 this.q7.aboutToBeDeleted(); 860 this.r7.aboutToBeDeleted(); 861 this.s7.aboutToBeDeleted(); 862 this.t7.aboutToBeDeleted(); 863 this.u7.aboutToBeDeleted(); 864 SubscriberManager.Get().delete(this.id__()); 865 this.aboutToBeDeletedInternal(); 866 } 867 868 get nodeList() { 869 return this.m7.get(); 870 } 871 872 set nodeList(newValue) { 873 this.m7.set(newValue); 874 } 875 876 get item() { 877 return this.n7.get(); 878 } 879 880 set item(newValue) { 881 this.n7.set(newValue); 882 } 883 884 get touchCount() { 885 return this.o7.get(); 886 } 887 888 set touchCount(newValue) { 889 this.o7.set(newValue); 890 } 891 892 get dropSelectedIndex() { 893 return this.p7.get(); 894 } 895 896 set dropSelectedIndex(newValue) { 897 this.p7.set(newValue); 898 } 899 900 get viewLastIndex() { 901 return this.q7.get(); 902 } 903 904 set viewLastIndex(newValue) { 905 this.q7.set(newValue); 906 } 907 908 get followingSystemFontScale() { 909 return this.r7.get(); 910 } 911 912 set followingSystemFontScale(newValue) { 913 this.r7.set(newValue); 914 } 915 916 get maxAppFontScale() { 917 return this.s7.get(); 918 } 919 920 set maxAppFontScale(newValue) { 921 this.s7.set(newValue); 922 } 923 924 get listItemBgColor() { 925 return this.t7.get(); 926 } 927 928 set listItemBgColor(newValue) { 929 this.t7.set(newValue); 930 } 931 932 get treeViewTheme() { 933 return this.u7.get(); 934 } 935 936 set treeViewTheme(newValue) { 937 this.u7.set(newValue); 938 } 939 940 NullBuilder(parent = null) { 941 } 942 943 onWillApplyTheme(theme) { 944 this.treeViewTheme.z3 = theme.colors.interactiveSelect; 945 this.treeViewTheme.d4 = theme.colors.interactivePressed; 946 this.treeViewTheme.e4 = theme.colors.interactiveHover; 947 this.treeViewTheme.a4 = theme.colors.fontPrimary; 948 this.treeViewTheme.b4 = theme.colors.fontSecondary; 949 this.treeViewTheme.c4 = theme.colors.interactiveActive; 950 this.treeViewTheme.f4 = theme.colors.interactiveFocus; 951 this.treeViewTheme.g4 = theme.colors.iconSecondary; 952 this.treeViewTheme.h4 = theme.colors.interactiveActive; 953 this.treeViewTheme.i4 = theme.colors.iconPrimary; 954 this.treeController.treeViewTheme = this.treeViewTheme; 955 } 956 957 aboutToAppear() { 958 if (this.treeController !== null) { 959 this.listNodeDataSource = this.treeController.v7(); 960 this.nodeList = this.treeController.v7().w7; 961 this.item = this.treeController.v7().w7; 962 } 963 let w17 = this.getUIContext(); 964 this.followingSystemFontScale = w17.isFollowingSystemFontScale(); 965 this.maxAppFontScale = w17.getMaxFontScale(); 966 } 967 968 decideFontScale() { 969 let u17 = this.getUIContext(); 970 let v17 = u17.getHostContext()?.config?.fontSizeScale ?? 1; 971 if (!this.followingSystemFontScale) { 972 return 1; 973 } 974 return Math.min(v17, this.maxAppFontScale, q1); 975 } 976 977 popupForShowTitle(text, backgroundColor, fontColor, parent = null) { 978 this.observeComponentCreation2((elmtId, isInitialRender) => { 979 Row.create(); 980 Row.backgroundColor(backgroundColor); 981 Row.border({ 982 radius: { 983 'id': -1, 984 'type': 10002, 985 params: ['sys.float.ohos_id_elements_margin_horizontal_l'], 986 'bundleName': '__harDefaultBundleName__', 987 'moduleName': '__harDefaultModuleName__', 988 } 989 }); 990 Row.padding({ 991 left: { 992 'id': -1, 993 'type': 10002, 994 params: ['sys.float.ohos_id_elements_margin_horizontal_l'], 995 'bundleName': '__harDefaultBundleName__', 996 'moduleName': '__harDefaultModuleName__', 997 }, 998 right: { 999 'id': -1, 1000 'type': 10002, 1001 params: ['sys.float.ohos_id_elements_margin_horizontal_l'], 1002 'bundleName': '__harDefaultBundleName__', 1003 'moduleName': '__harDefaultModuleName__', 1004 }, 1005 top: { 1006 'id': -1, 1007 'type': 10002, 1008 params: ['sys.float.ohos_id_card_margin_middle'], 1009 'bundleName': '__harDefaultBundleName__', 1010 'moduleName': '__harDefaultModuleName__', 1011 }, 1012 bottom: { 1013 'id': -1, 1014 'type': 10002, 1015 params: ['sys.float.ohos_id_card_margin_middle'], 1016 'bundleName': '__harDefaultBundleName__', 1017 'moduleName': '__harDefaultModuleName__', 1018 }, 1019 }); 1020 }, Row); 1021 this.observeComponentCreation2((elmtId, isInitialRender) => { 1022 Text.create(text); 1023 Text.fontSize({ 1024 'id': -1, 1025 'type': 10002, 1026 params: ['sys.float.ohos_id_text_size_body2'], 1027 'bundleName': '__harDefaultBundleName__', 1028 'moduleName': '__harDefaultModuleName__', 1029 }); 1030 Text.fontWeight('regular'); 1031 Text.fontColor(fontColor); 1032 Text.minFontScale(o1); 1033 Text.maxFontScale(this.decideFontScale()); 1034 }, Text); 1035 Text.pop(); 1036 Row.pop(); 1037 } 1038 1039 builder(parent = null) { 1040 this.listTreeViewMenu.bind(this)(); 1041 } 1042 1043 draggingPopup(item, parent = null) { 1044 this.observeComponentCreation2((elmtId, isInitialRender) => { 1045 Row.create(); 1046 Row.constraintSize({ 1047 minWidth: this.listNodeDataSource.x7().y7.minWidth, 1048 maxWidth: this.listNodeDataSource.x7().y7.maxWidth, 1049 }); 1050 Row.height(this.listNodeDataSource.x7().height); 1051 Row.backgroundColor(this.listNodeDataSource.x7().backgroundColor); 1052 Row.padding({ 1053 start: LengthMetrics.resource(this.listNodeDataSource.x7().padding.left), 1054 end: LengthMetrics.resource(this.listNodeDataSource.x7().padding.right), 1055 }); 1056 Row.shadow({ 1057 radius: { 1058 'id': -1, 1059 'type': 10002, 1060 params: ['sys.float.ohos_id_corner_radius_default_m'], 1061 'bundleName': '__harDefaultBundleName__', 1062 'moduleName': '__harDefaultModuleName__', 1063 }, 1064 color: c2, 1065 offsetY: 0, 1066 }); 1067 Row.borderRadius(this.listNodeDataSource.x7().borderRadius); 1068 }, Row); 1069 this.observeComponentCreation2((elmtId, isInitialRender) => { 1070 If.create(); 1071 if (item.k6().v3) { 1072 this.ifElseBranchUpdateFunction(0, () => { 1073 this.observeComponentCreation2((elmtId, isInitialRender) => { 1074 Row.create(); 1075 Row.backgroundColor(a2); 1076 Row.margin({ end: o(item.k6().v3?.z7) }); 1077 Row.height(item.k6().v3?.itemHeight); 1078 Row.width(item.k6().v3?.itemWidth); 1079 }, Row); 1080 this.observeComponentCreation2((elmtId, isInitialRender) => { 1081 Image.create(item.k6().v3?.a8); 1082 Image.objectFit(ImageFit.Contain); 1083 Image.height(item.k6().v3?.itemHeight); 1084 Image.width(item.k6().v3?.itemWidth); 1085 Image.opacity(this.listNodeDataSource.x7().b8); 1086 Image.matchTextDirection((item.k6().x3?.c8 === ARROW_RIGHT || item.k6().x3?.c8 === s2) ? true : 1087 false); 1088 }, Image); 1089 Row.pop(); 1090 }); 1091 } else { 1092 this.ifElseBranchUpdateFunction(1, () => { 1093 }); 1094 } 1095 }, If); 1096 If.pop(); 1097 this.observeComponentCreation2((elmtId, isInitialRender) => { 1098 Row.create(); 1099 Row.constraintSize({ 1100 minWidth: item.k6().v3 ? 1101 this.listNodeDataSource.x7().d8.e8 : 1102 this.listNodeDataSource.x7().d8.f8, 1103 maxWidth: item.k6().v3 ? 1104 this.listNodeDataSource.x7().d8.g8 : 1105 this.listNodeDataSource.x7().d8.h8, 1106 }); 1107 }, Row); 1108 this.observeComponentCreation2((elmtId, isInitialRender) => { 1109 If.create(); 1110 if (item.k6().w3 && item.w5()) { 1111 this.ifElseBranchUpdateFunction(0, () => { 1112 this.observeComponentCreation2((elmtId, isInitialRender) => { 1113 Text.create(item.k6().w3?.title); 1114 Text.maxLines(1); 1115 Text.minFontScale(o1); 1116 Text.maxFontScale(this.decideFontScale()); 1117 Text.fontSize(item.k6().w3?.size); 1118 Text.fontColor(this.listNodeDataSource.x7().fontColor); 1119 Text.fontWeight(this.listNodeDataSource.x7().fontWeight); 1120 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 1121 }, Text); 1122 Text.pop(); 1123 }); 1124 } else { 1125 this.ifElseBranchUpdateFunction(1, () => { 1126 }); 1127 } 1128 }, If); 1129 If.pop(); 1130 Row.pop(); 1131 Row.pop(); 1132 } 1133 1134 clearLastIndexColor() { 1135 if (this.viewLastIndex === -1 || this.viewLastIndex >= this.nodeList.length) { 1136 return; 1137 } 1138 this.setImageSources(this.viewLastIndex, a3.NORMAL); 1139 this.nodeList[this.viewLastIndex].a6({ 1140 'id': -1, 1141 'type': 10001, 1142 params: ['sys.color.ohos_id_color_background_transparent'], 1143 'bundleName': '__harDefaultBundleName__', 1144 'moduleName': '__harDefaultModuleName__', 1145 }); 1146 this.nodeList[this.viewLastIndex].fontColor = this.treeViewTheme.a4; 1147 this.listNodeDataSource.w7[this.viewLastIndex].a6({ 1148 'id': -1, 1149 'type': 10001, 1150 params: ['sys.color.ohos_id_color_background_transparent'], 1151 'bundleName': '__harDefaultBundleName__', 1152 'moduleName': '__harDefaultModuleName__', 1153 }); 1154 this.listNodeDataSource.w7[this.viewLastIndex].fontColor = this.treeViewTheme.a4; 1155 this.listNodeDataSource.w7[this.viewLastIndex].r6(false); 1156 this.listNodeDataSource.i8(this.viewLastIndex, a3.NORMAL); 1157 } 1158 1159 setImageSources(index, f17) { 1160 let g17 = this.nodeList[index]; 1161 g17.r6(f17 === a3.SELECTED || 1162 f17 === a3.EDIT || f17 === a3.FINISH_EDIT); 1163 if (g17.k6().w3 !== null && f17 !== a3.DRAG_INSERT && 1164 f17 !== a3.FINISH_DRAG_INSERT) { 1165 g17.k6().w3?.j8(f17 === a3.SELECTED || 1166 f17 === a3.FINISH_EDIT); 1167 } 1168 if (g17.k6().v3 !== null) { 1169 g17.k6().v3?.i8(f17); 1170 } 1171 } 1172 1173 initialRender() { 1174 this.observeComponentCreation2((elmtId, isInitialRender) => { 1175 List.create({}); 1176 List.onDragMove((event, extraParams) => { 1177 if (this.isMultiPress) { 1178 hilog.error(LOG_CODE, TAG, 'drag error, a item has been dragged'); 1179 return; 1180 } 1181 let b17 = i1; 1182 let flag = Math.floor(event.getY() / 1183 (b17 / l1)) % l1 ? w2.DOWN_FLAG : w2.UP_FLAG; 1184 let index = JSON.parse(extraParams).insertIndex; 1185 let c17 = false; 1186 if (index >= this.listNodeDataSource.totalCount()) { 1187 flag = w2.DOWN_FLAG; 1188 index = this.listNodeDataSource.totalCount() - 1; 1189 this.listNodeDataSource.getData(index)?.b7(true); 1190 c17 = true; 1191 } else { 1192 this.listNodeDataSource.getData(index)?.b7(false); 1193 } 1194 let d17 = this.listNodeDataSource.getData(index); 1195 let currentNodeId = d17?.e6(); 1196 if (index !== this.listNodeDataSource.k8() && this.listNodeDataSource.l8()) { 1197 let e17 = this.listNodeDataSource.m8(currentNodeId); 1198 if (e17) { 1199 this.listNodeDataSource.n8(index); 1200 if (currentNodeId !== undefined) { 1201 this.listNodeDataSource.o8(this.listNodeDataSource.findIndex(currentNodeId)); 1202 } 1203 this.listNodeDataSource.p8(w2.NONE); 1204 return; 1205 } 1206 } 1207 this.listNodeDataSource.q8(index); 1208 this.listNodeDataSource.r8(flag, index - 1, c17); 1209 if (currentNodeId !== undefined && currentNodeId !== this.listNodeDataSource.s8()) { 1210 this.listNodeDataSource.t8(this.listNodeDataSource.findIndex(currentNodeId), currentNodeId, index); 1211 } 1212 }); 1213 List.onDragEnter((event, extraParams) => { 1214 if (this.listNodeDataSource.l8()) { 1215 this.listNodeDataSource.u8(true); 1216 let a17 = m1; 1217 this.listNodeDataSource.v8(a17); 1218 } 1219 }); 1220 List.onDragLeave((event, extraParams) => { 1221 this.listNodeDataSource.w8(); 1222 this.listNodeDataSource.x8(); 1223 this.listNodeDataSource.y8(); 1224 let z16 = n1; 1225 this.listNodeDataSource.v8(z16); 1226 this.listNodeDataSource.u8(false); 1227 this.listNodeDataSource.z8(); 1228 }); 1229 List.onDrop((event, extraParams) => { 1230 this.listNodeDataSource.y8(); 1231 let m16 = n1; 1232 this.listNodeDataSource.v8(m16); 1233 let n16 = JSON.parse(extraParams).insertIndex; 1234 let o16 = this.dropSelectedIndex; 1235 if (o16 - 1 > this.listNodeDataSource.totalCount() || o16 === undefined) { 1236 hilog.error(LOG_CODE, TAG, 'drag error, currentNodeIndex is not found'); 1237 this.listNodeDataSource.u8(false); 1238 return; 1239 } 1240 if (n16 === this.listNodeDataSource.totalCount()) { 1241 hilog.info(LOG_CODE, TAG, 'need to insert into the position of the last line'); 1242 n16 -= 1; 1243 } 1244 let p16 = this.listNodeDataSource.getData(n16); 1245 if (p16 === undefined) { 1246 return; 1247 } 1248 let q16 = p16.e6(); 1249 if (!this.listNodeDataSource.a9() || !this.listNodeDataSource.l8()) { 1250 this.listNodeDataSource.x8(); 1251 this.listNodeDataSource.b9(false); 1252 this.listNodeDataSource.w8(); 1253 this.listNodeDataSource.c9(); 1254 this.listNodeDataSource.d9(q16); 1255 this.listNodeDataSource.z8(); 1256 return; 1257 } 1258 let r16 = this.listNodeDataSource.e9(); 1259 let s16 = p16.f6(); 1260 let t16 = this.listNodeDataSource.s8(); 1261 let u16 = this.listNodeDataSource.f9(); 1262 let v16 = this.listNodeDataSource.m8(q16); 1263 if (v16) { 1264 this.listNodeDataSource.x8(); 1265 this.listNodeDataSource.b9(false); 1266 this.listNodeDataSource.w8(); 1267 this.listNodeDataSource.g9(n16); 1268 this.listNodeDataSource.c9(); 1269 this.listNodeDataSource.u8(false); 1270 let y16 = this.listNodeDataSource.findIndex(t16); 1271 this.listNodeDataSource.h9(y16); 1272 this.listNodeDataSource.i9(Event.DRAG, y16); 1273 return; 1274 } 1275 if (this.listNodeDataSource.j9(t16) === z2.EXPAND) { 1276 this.listNodeDataSource.k9(this.listNodeDataSource.findIndex(t16)); 1277 } 1278 let flag = false; 1279 if (this.listNodeDataSource.j9(q16) === z2.COLLAPSE) { 1280 let currentIndex = this.listNodeDataSource.findIndex(q16); 1281 if (this.listNodeDataSource.w7[currentIndex].g7()) { 1282 this.listNodeDataSource.k9(currentIndex); 1283 } 1284 flag = true; 1285 } 1286 this.listNodeDataSource.l9(); 1287 if (r16 !== null && t16 !== q16) { 1288 this.listNodeDataSource.m9(s16, q16, u16, t16, r16); 1289 this.listNodeDataSource.w8(); 1290 } else { 1291 this.listNodeDataSource.w8(); 1292 this.listNodeDataSource.n9(t16); 1293 this.listNodeDataSource.w8(); 1294 } 1295 let w16 = this.listNodeDataSource.findIndex(this.listNodeDataSource.o9()); 1296 this.listNodeDataSource.p9(w16); 1297 this.listNodeDataSource.x8(); 1298 this.listNodeDataSource.c9(); 1299 this.listNodeDataSource.u8(false); 1300 let x16 = this.listNodeDataSource.findIndex(t16); 1301 this.listNodeDataSource.h9(x16); 1302 this.listNodeDataSource.i9(Event.DRAG, x16); 1303 this.listNodeDataSource.b9(false); 1304 this.listNodeDataSource.z8(); 1305 this.listNodeDataSource.w7[x16].fontColor = this.treeViewTheme.c4; 1306 if (this.viewLastIndex !== -1 && o16 !== this.viewLastIndex) { 1307 this.listNodeDataSource.w7[this.viewLastIndex].k6() 1308 .w3?.j8(false); 1309 this.listNodeDataSource.w7[this.viewLastIndex].k6() 1310 .w3?.q9(false); 1311 } 1312 if (this.listNodeDataSource.w7[this.viewLastIndex] !== null) { 1313 this.listNodeDataSource.w7[this.viewLastIndex].fontColor = this.treeViewTheme.a4; 1314 } 1315 this.listNodeDataSource.lastIndex = this.viewLastIndex; 1316 if (this.listNodeDataSource.w7[this.viewLastIndex]) { 1317 if (this.listNodeDataSource.w7[this.viewLastIndex].k6() 1318 .v3 !== null) { 1319 this.listNodeDataSource.w7[this.viewLastIndex].k6() 1320 .v3?.i8(a3.NORMAL); 1321 this.listNodeDataSource.w7[this.viewLastIndex].j4 = 1322 this.listNodeDataSource.w7[this.viewLastIndex].k6() 1323 .v3?.source; 1324 } 1325 } 1326 if (this.listNodeDataSource.w7[this.viewLastIndex]) { 1327 this.listNodeDataSource.w7[this.viewLastIndex].a6({ 1328 'id': -1, 1329 'type': 10001, 1330 params: ['sys.color.ohos_id_color_background_transparent'], 1331 'bundleName': '__harDefaultBundleName__', 1332 'moduleName': '__harDefaultModuleName__', 1333 }); 1334 } 1335 this.listNodeDataSource.lastIndex = x16; 1336 }); 1337 }, List); 1338 { 1339 const __lazyForEachItemGenFunction = _item => { 1340 const u15 = _item; 1341 { 1342 const itemCreation2 = (elmtId, isInitialRender) => { 1343 ListItem.create(() => { 1344 }, false); 1345 ListItem.width('100%'); 1346 ListItem.height(u15.d6()); 1347 ListItem.padding({ 1348 start: LengthMetrics.resource(this.itemPadding.left), 1349 end: LengthMetrics.resource(this.itemPadding.right) 1350 }); 1351 ListItem.align(Alignment.Start); 1352 ListItem.onDragStart((event, extraParams) => { 1353 if (this.listNodeDataSource.a9() || this.listNodeDataSource.l8() || this.isMultiPress) { 1354 hilog.error(LOG_CODE, TAG, 'drag error, a item has been dragged'); 1355 return; 1356 } 1357 this.dropSelectedIndex = JSON.parse(extraParams).selectedIndex; 1358 let e16 = JSON.parse(extraParams).selectedIndex; 1359 let f16 = this.listNodeDataSource.getData(e16); 1360 let g16 = u15.e6(); 1361 if (e16 >= this.listNodeDataSource.totalCount() || e16 === undefined) { 1362 hilog.error(LOG_CODE, TAG, 1363 'drag error, currentNodeIndex is not found in onDragStart'); 1364 return; 1365 } 1366 this.listNodeDataSource.b9(true); 1367 this.listNodeDataSource.u8(true); 1368 this.listNodeDataSource.r9(f16); 1369 this.listNodeDataSource.s9(f16?.e6()); 1370 this.listNodeDataSource.t9(f16?.f6()); 1371 let h16 = m1; 1372 this.listNodeDataSource.v8(h16); 1373 this.listNodeDataSource.g9(e16); 1374 if (g16 !== f16?.e6()) { 1375 hilog.error(LOG_CODE, TAG, 'drag is too fast, it attribute a fault to OH'); 1376 this.listNodeDataSource.u8(false); 1377 return; 1378 } 1379 return { 1380 builder: () => { 1381 this.draggingPopup.call(this, f16); 1382 } 1383 }; 1384 }); 1385 }; 1386 const observedDeepRender = () => { 1387 this.observeComponentCreation2(itemCreation2, ListItem); 1388 this.observeComponentCreation2((elmtId, isInitialRender) => { 1389 Row.create(); 1390 Row.onTouch((event) => { 1391 this.viewLastIndex = this.listNodeDataSource.u9(); 1392 let index = this.listNodeDataSource.findIndex(u15.e6()); 1393 if (event.type === TouchType.Down) { 1394 if (index !== this.viewLastIndex) { 1395 this.clearLastIndexColor(); 1396 this.listNodeDataSource.lastIndex = index; 1397 this.listNodeDataSource.h9(index); 1398 } 1399 } 1400 if (event.type === TouchType.Up) { 1401 this.listNodeDataSource.w7[index].r6(true); 1402 this.listNodeDataSource.i8(index, a3.SELECTED); 1403 if (this.listNodeDataSource.w7[index].k6().v3 !== null) { 1404 this.listNodeDataSource.w7[index].j4 = 1405 this.listNodeDataSource.w7[index].k6().v3?.source; 1406 } 1407 if (index !== this.viewLastIndex) { 1408 this.clearLastIndexColor(); 1409 this.listNodeDataSource.lastIndex = index; 1410 this.listNodeDataSource.h9(index); 1411 } 1412 this.viewLastIndex = index; 1413 } 1414 if (this.listNodeDataSource.u9() !== -1 && index !== this.listNodeDataSource.u9()) { 1415 this.listNodeDataSource.v9(u2.WARNINGS, v2.NONE, false, 1416 this.listNodeDataSource.u9()); 1417 this.listNodeDataSource.w9(this.listNodeDataSource.u9(), t2.COMMIT_NODE); 1418 } 1419 }); 1420 }, Row); 1421 { 1422 this.observeComponentCreation2((elmtId, isInitialRender) => { 1423 if (isInitialRender) { 1424 let componentCall = new i3(this, { 1425 item: u15, 1426 listNodeDataSource: this.listNodeDataSource, 1427 index: this.listNodeDataSource.findIndex(u15.e6()), 1428 listTreeViewMenu: this.listTreeViewMenu, 1429 }, undefined, elmtId, () => { 1430 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 1130, x9: 13 }); 1431 ViewPU.create(componentCall); 1432 let paramsLambda = () => { 1433 return { 1434 item: u15, 1435 listNodeDataSource: this.listNodeDataSource, 1436 index: this.listNodeDataSource.findIndex(u15.e6()), 1437 listTreeViewMenu: this.listTreeViewMenu 1438 }; 1439 }; 1440 componentCall.paramsGenerator_ = paramsLambda; 1441 } else { 1442 this.updateStateVarsOfChildByElmtId(elmtId, { 1443 item: u15 1444 }); 1445 } 1446 }, { name: 'TreeViewInner' }); 1447 } 1448 Row.pop(); 1449 ListItem.pop(); 1450 }; 1451 observedDeepRender(); 1452 } 1453 }; 1454 const __lazyForEachItemIdFunc = (item) => JSON.stringify(item); 1455 LazyForEach.create('1', this, this.listNodeDataSource, __lazyForEachItemGenFunction, 1456 __lazyForEachItemIdFunc); 1457 LazyForEach.pop(); 1458 } 1459 List.pop(); 1460 } 1461 1462 rerender() { 1463 this.updateDirtyElements(); 1464 } 1465} 1466 1467export class TreeController { 1468 constructor() { 1469 this.y9 = -1; 1470 this.z9 = []; 1471 this.listNodeDataSource = new h3(); 1472 this.a10 = true; 1473 this.treeViewTheme = e3.getInstance(); 1474 } 1475 1476 v7() { 1477 return this.listNodeDataSource; 1478 } 1479 1480 b10() { 1481 let q15 = this.listNodeDataSource.c10(); 1482 return this.listNodeDataSource.b10(q15); 1483 } 1484 1485 d10() { 1486 let p15 = this.listNodeDataSource.c10(); 1487 return this.listNodeDataSource.e10(p15); 1488 } 1489 1490 removeNode() { 1491 let n15 = this.listNodeDataSource.c10(); 1492 if (n15 < 0) { 1493 return; 1494 } 1495 let parentNodeId = this.listNodeDataSource.f10(n15); 1496 let o15 = this.listNodeDataSource.removeNode(n15, parentNodeId); 1497 this.listNodeDataSource.g10(t2.REMOVE_NODE, parentNodeId, o15); 1498 this.z9.splice(this.z9.indexOf(n15), 1); 1499 this.listNodeDataSource.lastIndex = -1; 1500 } 1501 1502 modifyNode() { 1503 let m15 = this.listNodeDataSource.c10(); 1504 this.listNodeDataSource.w9(m15, t2.MODIFY_NODE); 1505 } 1506 1507 add(g15) { 1508 let h15 = this.listNodeDataSource.c10(); 1509 if (h15 === this.listNodeDataSource.y9 || !this.listNodeDataSource.v6(h15)) { 1510 return; 1511 } 1512 let i15 = this.listNodeDataSource.h10(h15); 1513 this.z9.push(this.z9[this.z9.length - 1] + 1); 1514 let j15 = this.z9[this.z9.length - 1]; 1515 let k15 = this.listNodeDataSource.addNode(h15, j15, { 1516 isFolder: i15.isFolder, 1517 icon: i15.icon, 1518 selectedIcon: i15.selectedIcon, 1519 editIcon: i15.editIcon, 1520 primaryTitle: '新建文件夹', 1521 container: i15.container, 1522 secondaryTitle: i15.secondaryTitle, 1523 }, g15); 1524 if (!k15) { 1525 return; 1526 } 1527 this.listNodeDataSource.g10(t2.ADD_NODE, h15, [j15]); 1528 this.listNodeDataSource.v9(u2.WARNINGS, v2.NONE, false, this.listNodeDataSource.u9()); 1529 this.listNodeDataSource.w9(this.listNodeDataSource.u9(), t2.COMMIT_NODE); 1530 this.listNodeDataSource.w7[this.listNodeDataSource.u9()].o5(this.treeViewTheme.a4); 1531 let l15 = this.listNodeDataSource.findIndex(j15); 1532 this.listNodeDataSource.h9(l15); 1533 this.listNodeDataSource.i9(Event.TOUCH_UP, l15); 1534 } 1535 1536 addNode(nodeParam) { 1537 if (nodeParam === undefined) { 1538 this.add(this.a10); 1539 return this; 1540 } else { 1541 let e15 = false; 1542 if (nodeParam.primaryTitle !== undefined && 1543 !this.listNodeDataSource.i10(nodeParam.primaryTitle.toString())) { 1544 throw new Error('ListTreeNode[addNode]: ' + 1545 'The directory name cannot contain the following characters\ /: *? "< > | or exceeds the maximum length.'); 1546 return this; 1547 } 1548 if (nodeParam.primaryTitle === null && nodeParam.icon === null) { 1549 throw new Error('ListTreeNode[addNode]: ' + 1550 'The icon and directory name cannot be empty at the same time.'); 1551 return this; 1552 } 1553 if (nodeParam.currentNodeId === this.y9 || nodeParam.currentNodeId === null) { 1554 throw new Error('ListTreeNode[addNode]: currentNodeId can not be -1 or null.'); 1555 return this; 1556 } 1557 if (nodeParam.currentNodeId !== undefined) { 1558 this.z9.push(nodeParam.currentNodeId); 1559 } 1560 if (nodeParam.parentNodeId !== undefined) { 1561 if (nodeParam.currentNodeId !== undefined) { 1562 e15 = 1563 this.listNodeDataSource.addNode(nodeParam.parentNodeId, nodeParam.currentNodeId, nodeParam, 1564 this.a10); 1565 } 1566 } 1567 if (!e15) { 1568 return this; 1569 } 1570 if (!this.a10 && nodeParam.parentNodeId !== undefined) { 1571 let f15 = this.z9[this.z9.length - 1]; 1572 this.listNodeDataSource.g10(t2.ADD_NODE, nodeParam.parentNodeId, [f15]); 1573 } 1574 return this; 1575 } 1576 } 1577 1578 refreshNode(parentId, parentSubTitle, d15) { 1579 this.listNodeDataSource.j10(parentId, parentSubTitle, d15); 1580 } 1581 1582 buildDone() { 1583 this.listNodeDataSource.k10(); 1584 this.listNodeDataSource.l10(); 1585 this.listNodeDataSource.m10(); 1586 m(this.z9); 1587 this.a10 = false; 1588 } 1589} 1590 1591class g3 { 1592 constructor() { 1593 this.n10 = []; 1594 } 1595 1596 totalCount() { 1597 return 0; 1598 } 1599 1600 getData(index) { 1601 return undefined; 1602 } 1603 1604 registerDataChangeListener(listener) { 1605 if (this.n10.indexOf(listener) < 0) { 1606 this.n10.push(listener); 1607 } 1608 } 1609 1610 unregisterDataChangeListener(listener) { 1611 const pos = this.n10.indexOf(listener); 1612 if (pos >= 0) { 1613 this.n10.splice(pos, 1); 1614 } 1615 } 1616 1617 z8() { 1618 this.n10.forEach(listener => { 1619 listener.onDataReloaded(); 1620 }); 1621 } 1622 1623 o10(index) { 1624 this.n10.forEach(listener => { 1625 listener.onDataAdd(index); 1626 }); 1627 } 1628 1629 g9(index) { 1630 if (index === undefined) { 1631 return; 1632 } 1633 this.n10.forEach(listener => { 1634 listener.onDataChange(index); 1635 }); 1636 } 1637 1638 p10(index) { 1639 this.n10.forEach(listener => { 1640 listener.onDataDelete(index); 1641 }); 1642 } 1643 1644 q10(from, to) { 1645 this.n10.forEach(listener => { 1646 listener.onDataMove(from, to); 1647 }); 1648 } 1649} 1650 1651function i(t14, count, u14, v14) { 1652 let taskId = setTimeout(() => { 1653 v14.forEach((parentNodeId) => { 1654 j(parentNodeId, u14, t14, count); 1655 }); 1656 clearTimeout(taskId); 1657 }, m2); 1658} 1659 1660function j(parentNodeId, q14, r14, count) { 1661 let s14 = parentNodeId; 1662 while (s14 >= 0) { 1663 if (q14.has(s14)) { 1664 let parent = q14.get(s14); 1665 parent.o6().r10 = 1666 r14 ? parent.o6().r10 + count : parent.o6().r10 - count; 1667 s14 = parent.parentNodeId; 1668 } else { 1669 hilog.error(LOG_CODE, TAG, 'updateParentChildNumHandler: parent node not found'); 1670 break; 1671 } 1672 } 1673} 1674 1675function m(n14) { 1676 let taskId = setTimeout(() => { 1677 n14.sort((a, b) => a - b); 1678 clearTimeout(taskId); 1679 }, m2); 1680} 1681 1682class h3 extends g3 { 1683 constructor() { 1684 super(); 1685 this.y9 = -1; 1686 this.s10 = new j3(d3); 1687 this.t10 = 50; 1688 this.MAX_CN_LENGTH = 254; 1689 this.MAX_EN_LENGTH = 255; 1690 this.INITIAL_INVALID_VALUE = -1; 1691 this.w7 = []; 1692 this.u10 = []; 1693 this.v10 = new Map(); 1694 this.w10 = new Map(); 1695 this.lastIndex = -1; 1696 this.x10 = -1; 1697 this.y10 = -1; 1698 this.z10 = -1; 1699 this.a11 = new Map(); 1700 this.b11 = new Map(); 1701 this.c11 = new Map(); 1702 this.d11 = false; 1703 this.appEventBus = TreeListenerManager.getInstance().getTreeListener(); 1704 this.e11 = false; 1705 this.f11 = false; 1706 this.g11 = this.INITIAL_INVALID_VALUE; 1707 this.h11 = this.INITIAL_INVALID_VALUE; 1708 this.i11 = null; 1709 this.j11 = 1; 1710 this.k11 = this.INITIAL_INVALID_VALUE; 1711 this.l11 = this.INITIAL_INVALID_VALUE; 1712 this.n11 = this.INITIAL_INVALID_VALUE; 1713 this.o11 = this.INITIAL_INVALID_VALUE; 1714 this.p11 = this.INITIAL_INVALID_VALUE; 1715 this.q11 = this.INITIAL_INVALID_VALUE; 1716 this.r11 = this.INITIAL_INVALID_VALUE; 1717 this.s11 = this.INITIAL_INVALID_VALUE; 1718 this.t11 = this.INITIAL_INVALID_VALUE; 1719 this.u11 = this.INITIAL_INVALID_VALUE; 1720 this.v11 = this.INITIAL_INVALID_VALUE; 1721 this.w11 = this.INITIAL_INVALID_VALUE; 1722 this.x11 = new Map(); 1723 this.flag = w2.NONE; 1724 this.y11 = this.INITIAL_INVALID_VALUE; 1725 this.z11 = ''; 1726 this.a12 = ''; 1727 this.b12 = this.INITIAL_INVALID_VALUE; 1728 this.c12 = this.INITIAL_INVALID_VALUE; 1729 this.d12 = this.INITIAL_INVALID_VALUE; 1730 this.treeViewTheme = e3.getInstance(); 1731 this.e12 = []; 1732 this.f12 = { 1733 g12: s1, 1734 h12: { 1735 'id': -1, 1736 'type': 10001, 1737 params: ['sys.color.ohos_id_color_emphasize'], 1738 'bundleName': '__harDefaultBundleName__', 1739 'moduleName': '__harDefaultModuleName__', 1740 }, 1741 xOffset: t1, 1742 i12: u1, 1743 j12: v1, 1744 k12: w1, 1745 }; 1746 this.l12 = { 1747 y7: { minWidth: e2, maxWidth: f2 }, 1748 d8: { 1749 e8: g2, 1750 g8: h2, 1751 f8: i2, 1752 h8: j2, 1753 }, 1754 padding: { 1755 left: { 1756 'id': -1, 1757 'type': 10002, 1758 params: ['sys.float.padding_level4'], 1759 'bundleName': '__harDefaultBundleName__', 1760 'moduleName': '__harDefaultModuleName__', 1761 }, 1762 right: { 1763 'id': -1, 1764 'type': 10002, 1765 params: ['sys.float.padding_level4'], 1766 'bundleName': '__harDefaultBundleName__', 1767 'moduleName': '__harDefaultModuleName__', 1768 } 1769 }, 1770 backgroundColor: z1, 1771 height: d2, 1772 shadow: { 1773 radius: { 1774 'id': -1, 1775 'type': 10002, 1776 params: ['sys.float.ohos_id_corner_radius_default_m'], 1777 'bundleName': '__harDefaultBundleName__', 1778 'moduleName': '__harDefaultModuleName__', 1779 }, 1780 color: c2, 1781 offsetX: 0, 1782 offsetY: j1, 1783 }, 1784 borderRadius: { 1785 'id': -1, 1786 'type': 10002, 1787 params: ['sys.float.ohos_id_corner_radius_clicked'], 1788 'bundleName': '__harDefaultBundleName__', 1789 'moduleName': '__harDefaultModuleName__', 1790 }, 1791 fontColor: this.treeViewTheme.a4, 1792 fontSize: { 1793 'id': -1, 1794 'type': 10002, 1795 params: ['sys.float.ohos_id_text_size_body1'], 1796 'bundleName': '__harDefaultBundleName__', 1797 'moduleName': '__harDefaultModuleName__', 1798 }, 1799 fontWeight: FontWeight.Regular, 1800 b8: { 1801 'id': -1, 1802 'type': 10002, 1803 params: ['sys.float.ohos_id_alpha_content_fourth'], 1804 'bundleName': '__harDefaultBundleName__', 1805 'moduleName': '__harDefaultModuleName__', 1806 } 1807 }; 1808 this.subTitle = { 1809 n12: this.treeViewTheme.b4, 1810 o12: { 1811 'id': -1, 1812 'type': 10001, 1813 params: ['sys.color.ohos_id_color_primary_contrary'], 1814 'bundleName': '__harDefaultBundleName__', 1815 'moduleName': '__harDefaultModuleName__', 1816 }, 1817 fontSize: { 1818 'id': -1, 1819 'type': 10002, 1820 params: ['sys.float.ohos_id_text_size_body2'], 1821 'bundleName': '__harDefaultBundleName__', 1822 'moduleName': '__harDefaultModuleName__', 1823 }, 1824 fontWeight: FontWeight.Regular, 1825 margin: { 1826 left: { 1827 'id': -1, 1828 'type': 10002, 1829 params: ['sys.float.padding_level2'], 1830 'bundleName': '__harDefaultBundleName__', 1831 'moduleName': '__harDefaultModuleName__', 1832 }, 1833 right: { 1834 'id': -1, 1835 'type': 10002, 1836 params: ['sys.float.padding_level12'], 1837 'bundleName': '__harDefaultBundleName__', 1838 'moduleName': '__harDefaultModuleName__', 1839 } 1840 } 1841 }; 1842 this.s10.b5 = -1; 1843 this.v10.set(-1, this.s10); 1844 this.w10.set(-1, d3); 1845 } 1846 1847 p12(index) { 1848 if (index < 0 || index >= this.w7.length) { 1849 hilog.error(LOG_CODE, TAG, 'check index fail'); 1850 return false; 1851 } 1852 return true; 1853 } 1854 1855 q12(index, color) { 1856 if (!this.p12(index)) { 1857 return; 1858 } 1859 this.w7[index].a6(color); 1860 this.w7[index].n6(false); 1861 } 1862 1863 b6(index) { 1864 return this.w7[index].b6(); 1865 } 1866 1867 r12(index, m14) { 1868 if (this.w7[index].j6()) { 1869 this.w7[index].n6(m14); 1870 } 1871 } 1872 1873 i8(index, k14) { 1874 if (!this.p12(index)) { 1875 return; 1876 } 1877 let l14 = this.w7[index]; 1878 l14.r6(k14 === a3.SELECTED || 1879 k14 === a3.EDIT || k14 === a3.FINISH_EDIT); 1880 if (l14.k6().w3 !== null && k14 !== a3.DRAG_INSERT && 1881 k14 !== a3.FINISH_DRAG_INSERT) { 1882 l14.k6().w3?.j8(k14 === a3.SELECTED || 1883 k14 === a3.FINISH_EDIT); 1884 } 1885 if (l14.k6().v3 !== null) { 1886 l14.k6().v3?.i8(k14); 1887 } 1888 } 1889 1890 s12(index, i14) { 1891 let j14 = this.w7[index]; 1892 if (j14.k6().x3 !== undefined) { 1893 j14.k6().x3 = q3.t12(i14, this.a11.get(j14.e6()), j14.k6().x3?.type); 1894 } 1895 } 1896 1897 u12() { 1898 if (!this.p12(this.lastIndex)) { 1899 return; 1900 } 1901 this.i8(this.lastIndex, a3.NORMAL); 1902 this.q12(this.lastIndex, this.w7[this.lastIndex].l6().normal); 1903 this.r12(this.lastIndex, false); 1904 this.g9(this.b11.get(this.w7[this.lastIndex].e6())); 1905 } 1906 1907 v12() { 1908 let index = 0; 1909 this.b11.clear(); 1910 this.c11.clear(); 1911 this.u10.splice(0, this.u10.length); 1912 for (let h14 = 0; h14 < this.w7.length; h14++) { 1913 this.c11.set(this.w7[h14].e6(), h14); 1914 if (this.w7[h14].j6()) { 1915 this.b11.set(this.w7[h14].e6(), index++); 1916 this.u10.push(this.w7[h14]); 1917 } 1918 } 1919 } 1920 1921 w12(e14) { 1922 if (e14 >= this.w7.length) { 1923 hilog.error(LOG_CODE, TAG, 'changeNodeStatus clickIndex error.'); 1924 return; 1925 } 1926 let f14 = e14; 1927 let g14 = this.w7[e14].e6(); 1928 if (this.a11.get(g14) === z2.EXPAND) { 1929 this.a11.set(g14, z2.COLLAPSE); 1930 this.w7[f14].k6().x3 = q3.x12(z2.COLLAPSE, this.w7[f14].k6().x3?.y12); 1931 } else if (this.a11.get(g14) === z2.COLLAPSE) { 1932 this.a11.set(g14, z2.EXPAND); 1933 this.w7[f14].k6().x3 = q3.x12(z2.EXPAND, this.w7[f14].k6().x3?.y12); 1934 } 1935 } 1936 1937 z12(v13, w13) { 1938 if (v13 >= this.w7.length) { 1939 hilog.error(LOG_CODE, TAG, 'handleExpandAndCollapse clickIndex error.'); 1940 return; 1941 } 1942 let x13 = v13; 1943 let y13 = this.w7[x13].e6(); 1944 if (!this.a11.has(y13)) { 1945 return; 1946 } 1947 let z13 = this.a11.get(y13); 1948 if (this.w7[x13].o6().a13 && z13 === z2.COLLAPSE) { 1949 for (let d14 = 0; d14 < this.w7[x13].o6().r10; d14++) { 1950 this.w7[x13 + 1 + d14].i6(false); 1951 this.w7[x13 + 1 + d14].c6(h1); 1952 } 1953 this.v12(); 1954 this.z8(); 1955 return; 1956 } 1957 let a14 = new Array(this.w7[x13].o6().b13); 1958 a14[0] = x13 + 1; 1959 let index = 1; 1960 while (index < this.w7[x13].o6().b13) { 1961 a14[index] = a14[index - 1] + this.w7[a14[index - 1]].o6().r10 + 1; 1962 index++; 1963 } 1964 if (z13 === z2.EXPAND) { 1965 for (let b14 = 0; b14 < a14.length; b14++) { 1966 this.w7[a14[b14]].i6(true); 1967 this.w7[a14[b14]].c6(i1); 1968 let c14 = this.w7[a14[b14]].e6(); 1969 if (this.a11.get(c14) === z2.EXPAND) { 1970 this.z12(a14[b14], false); 1971 } 1972 } 1973 } 1974 a14 = null; 1975 if (w13) { 1976 this.v12(); 1977 this.z8(); 1978 } 1979 } 1980 1981 m10() { 1982 i(true, 1, this.v10, this.e12); 1983 } 1984 1985 c13(u13) { 1986 u13.splice(0, u13.length); 1987 this.b11.clear(); 1988 this.u10.splice(0, this.u10.length); 1989 this.c11.clear(); 1990 this.x11.clear(); 1991 } 1992 1993 d13(o13, p13, q13) { 1994 let index = 0; 1995 let r13 = 0; 1996 this.c13(o13); 1997 try { 1998 this.e13((node) => { 1999 if (node.f13() >= 0 && this.w10.has(node.f13())) { 2000 let t13 = new f3(node, this.w10.get(node.f13())); 2001 t13.m5(node.o6().a13); 2002 o13.push(t13); 2003 this.c11.set(t13.e6(), r13++); 2004 index = this.g13(t13, index); 2005 } 2006 return false; 2007 }, this.s10, p13, q13); 2008 } catch (err) { 2009 hilog.error(LOG_CODE, TAG, 'traverseSectionNodeDF function callbacks error.'); 2010 this.c13(o13); 2011 } 2012 } 2013 2014 g13(n13, index) { 2015 if (n13.o6().a13) { 2016 this.a11.set(n13.e6(), z2.COLLAPSE); 2017 } 2018 if (n13.j6()) { 2019 this.b11.set(n13.e6(), index++); 2020 this.u10.push(n13); 2021 } 2022 if (n13.v6()) { 2023 if (n13.t6().secondaryTitle !== undefined) { 2024 this.x11.set(n13.e6(), n13.t6().secondaryTitle); 2025 } else { 2026 this.x11.set(n13.e6(), ''); 2027 } 2028 } 2029 return index; 2030 } 2031 2032 l10() { 2033 let j13 = setTimeout(() => { 2034 let l13 = []; 2035 this.d13(l13, 0); 2036 this.w7.splice(0, this.w7.length); 2037 this.w7.push(...l13); 2038 this.w7.forEach((value, index) => { 2039 this.p10(index); 2040 this.o10(index); 2041 }); 2042 clearTimeout(j13); 2043 }, m2); 2044 } 2045 2046 k10() { 2047 this.d13(this.w7, 0, 1); 2048 } 2049 2050 h13(b13, c13) { 2051 let d13 = []; 2052 if (b13.length === 0) { 2053 return; 2054 } 2055 let startIndex = undefined; 2056 for (let g13 = 0; g13 < b13.length; g13++) { 2057 if (this.b11.has(b13[g13])) { 2058 let i13 = this.b11.get(b13[g13]); 2059 d13.push(i13); 2060 } 2061 if (startIndex === undefined && this.c11.has(b13[g13])) { 2062 startIndex = this.c11.get(b13[g13]); 2063 } 2064 if (startIndex !== undefined) { 2065 let h13 = this.w7.splice(startIndex, 1); 2066 h13 = null; 2067 } 2068 if (this.a11.has(b13[g13])) { 2069 this.a11.delete(b13[g13]); 2070 } 2071 } 2072 d13.forEach((value) => { 2073 this.p10(value); 2074 this.g9(value); 2075 }); 2076 if (c13.k6().x3 === null) { 2077 if (this.c11.has(c13.e6())) { 2078 let f13 = this.c11.get(c13.e6()); 2079 this.w7[f13]?.z5(false); 2080 } 2081 this.a11.delete(c13.e6()); 2082 this.g9(this.b11.get(c13.e6())); 2083 } 2084 let callbackParam = { 2085 currentNodeId: c13.e6(), 2086 parentNodeId: c13.f6(), 2087 }; 2088 this.v12(); 2089 this.appEventBus.emit(TreeListenType.NODE_DELETE, callbackParam); 2090 } 2091 2092 i13(y12) { 2093 let z12 = new f3(new j3(d3), d3); 2094 if (this.v10.has(y12[0])) { 2095 let node = this.v10.get(y12[0]); 2096 z12 = new f3(node, this.w10.get(y12[0])); 2097 z12.m5(node.o6().a13); 2098 } 2099 z12.h7(true); 2100 let index = 0; 2101 for (let a13 = 0; a13 < this.w7.length; a13++) { 2102 if (this.w7[a13].e6() === z12.f6()) { 2103 index = a13; 2104 if (this.w7[a13].k6().x3 === null) { 2105 this.w7[a13].z5(true); 2106 this.g9(index); 2107 } else if (this.a11.get(this.w7[a13].e6()) === z2.COLLAPSE) { 2108 this.w12(index); 2109 } 2110 this.w7.splice(a13 + 1, 0, z12); 2111 this.w7[a13 + 1].y5(true); 2112 this.w7[a13 + 1].i6(true); 2113 this.w7[a13 + 1].c6(i1); 2114 this.c11.set(y12[0], a13 + 1); 2115 this.i8(a13 + 1, a3.EDIT); 2116 this.j13 = t2.ADD_NODE; 2117 this.o10(a13 + 1); 2118 this.k13(a13 + 1, this.j13); 2119 break; 2120 } 2121 } 2122 this.y10 = index + 1; 2123 this.h9(index); 2124 this.lastIndex = index; 2125 this.a11.set(z12.f6(), z2.EXPAND); 2126 this.z12(index, true); 2127 } 2128 2129 g10(operation, parentNodeId, v12) { 2130 let w12 = new f3(new j3(d3), d3); 2131 if (this.v10.has(parentNodeId)) { 2132 let x12 = this.v10.get(parentNodeId); 2133 w12 = new f3(x12, this.w10.get(parentNodeId)); 2134 w12.m5(x12.o6().a13); 2135 } 2136 if (operation === t2.REMOVE_NODE) { 2137 this.x11.set(parentNodeId, this.z11); 2138 this.g9(this.b11.get(parentNodeId)); 2139 this.h13(v12, w12); 2140 } 2141 if (operation === t2.ADD_NODE) { 2142 this.d12 = v12[0]; 2143 this.x11.set(this.c10(), this.z11); 2144 this.x11.set(v12[0], this.a12); 2145 this.i13(v12); 2146 } 2147 } 2148 2149 h9(index) { 2150 this.x10 = index; 2151 } 2152 2153 c10() { 2154 if (!this.p12(this.x10)) { 2155 return -1; 2156 } 2157 return this.w7[this.x10].e6(); 2158 } 2159 2160 k9(u12) { 2161 this.w12(u12); 2162 this.z12(u12, true); 2163 } 2164 2165 l13() { 2166 return this.d11; 2167 } 2168 2169 u9() { 2170 return this.lastIndex; 2171 } 2172 2173 findIndex(currentNodeId) { 2174 let t12 = -1; 2175 if (this.c11.has(currentNodeId)) { 2176 t12 = this.c11.get(currentNodeId); 2177 } 2178 return t12; 2179 } 2180 2181 n13(index) { 2182 if (!this.p12(index)) { 2183 return; 2184 } 2185 this.i8(index, a3.NORMAL); 2186 this.q12(index, this.w7[index].l6().normal); 2187 this.r12(index, false); 2188 this.g9(this.b11.get(this.w7[index].e6())); 2189 } 2190 2191 i9(event, index) { 2192 if (this.f11) { 2193 return; 2194 } 2195 if (!this.p12(index)) { 2196 return; 2197 } 2198 if (event === Event.TOUCH_DOWN || event === Event.TOUCH_UP || event === Event.MOUSE_BUTTON_RIGHT) { 2199 if (index !== this.lastIndex) { 2200 this.u12(); 2201 } 2202 } 2203 this.o13(index, event); 2204 } 2205 2206 o13(index, event) { 2207 let r12 = this.b11.get(this.w7[index].e6()); 2208 switch (event) { 2209 case Event.TOUCH_DOWN: 2210 this.d11 = true; 2211 this.q12(index, this.w7[index].l6().i5); 2212 this.g9(r12); 2213 break; 2214 case Event.TOUCH_UP: { 2215 this.p13(index, r12); 2216 break; 2217 } 2218 case Event.HOVER: 2219 if (this.b6(index) !== this.w7[index].l6().selected) { 2220 this.q12(index, this.w7[index].l6().h5); 2221 this.g9(r12); 2222 } 2223 break; 2224 case Event.HOVER_OVER: 2225 if (this.b6(index) !== this.w7[index].l6().selected) { 2226 this.q12(index, this.w7[index].l6().normal); 2227 this.g9(r12); 2228 } 2229 break; 2230 case Event.FOCUS: 2231 this.r12(index, true); 2232 this.g9(r12); 2233 break; 2234 case Event.BLUR: 2235 this.r12(index, false); 2236 this.g9(r12); 2237 break; 2238 case Event.MOUSE_BUTTON_RIGHT: 2239 this.lastIndex = index; 2240 this.q13(); 2241 break; 2242 case Event.DRAG: 2243 this.d11 = false; 2244 let s12 = this.w7[index]; 2245 this.i8(index, a3.SELECTED); 2246 this.lastIndex = index; 2247 this.q12(index, s12.l6().selected); 2248 this.g9(r12); 2249 break; 2250 default: 2251 break; 2252 } 2253 } 2254 2255 p13(index, p12) { 2256 if (this.e11) { 2257 this.e11 = false; 2258 } 2259 this.d11 = false; 2260 let q12 = this.w7[index]; 2261 this.i8(index, a3.SELECTED); 2262 q12.o5(this.treeViewTheme.a4); 2263 this.lastIndex = index; 2264 this.q12(index, q12.l6().selected); 2265 this.g9(p12); 2266 } 2267 2268 k13(l12, operation) { 2269 if (operation === t2.MODIFY_NODE) { 2270 let n12 = this.w7[this.y10]; 2271 let o12 = { 2272 currentNodeId: n12?.e6(), 2273 parentNodeId: n12?.f6(), 2274 }; 2275 this.appEventBus.emit(TreeListenType.NODE_MODIFY, o12); 2276 } else if (operation === t2.ADD_NODE) { 2277 let m12 = this.w7[l12]; 2278 if (m12 === undefined) { 2279 return; 2280 } 2281 let icon = (m12.k6().v3 !== undefined) ? 2282 m12.k6().v3?.source : undefined; 2283 let selectedIcon = (m12.k6().v3 !== undefined) ? 2284 m12.k6().v3?.r13 : undefined; 2285 let editIcon = (m12.k6().v3 !== undefined) ? 2286 m12.k6().v3?.s13 : undefined; 2287 let callbackParam = { 2288 currentNodeId: m12?.e6(), 2289 parentNodeId: m12?.f6(), 2290 }; 2291 this.appEventBus.emit(TreeListenType.NODE_ADD, callbackParam); 2292 } 2293 } 2294 2295 q13() { 2296 if (this.y10 !== -1) { 2297 this.i8(this.y10, a3.FINISH_EDIT); 2298 this.s12(this.y10, a3.FINISH_EDIT); 2299 this.w7[this.y10].h7(false); 2300 this.w7[this.y10].y5(false); 2301 this.k13(this.y10, this.j13); 2302 this.g9(this.y10); 2303 } 2304 } 2305 2306 w9(h12, operation) { 2307 let index = -1; 2308 if (h12 === -1) { 2309 return; 2310 } 2311 if (operation === t2.MODIFY_NODE) { 2312 for (let k12 = 0; k12 < this.w7.length; k12++) { 2313 if (this.w7[k12]?.e6() === h12) { 2314 index = k12; 2315 break; 2316 } 2317 } 2318 let j12 = this.w7[index]; 2319 if (j12 === undefined) { 2320 return; 2321 } 2322 j12.h7(true); 2323 if (j12.k6().w3 === null) { 2324 return; 2325 } 2326 this.j13 = t2.MODIFY_NODE; 2327 j12.y5(true); 2328 this.i8(index, a3.EDIT); 2329 this.s12(index, a3.EDIT); 2330 this.y10 = index; 2331 if (j12.k6().inputText) { 2332 if (j12.k6().x3 !== null) { 2333 j12.k6().inputText.rightMargin = { 2334 'id': -1, 2335 'type': 10002, 2336 params: ['sys.float.ohos_id_text_paragraph_margin_xs'], 2337 'bundleName': '__harDefaultBundleName__', 2338 'moduleName': '__harDefaultModuleName__', 2339 }; 2340 } else { 2341 j12.k6().inputText.rightMargin = { 2342 'id': -1, 2343 'type': 10002, 2344 params: ['sys.float.ohos_id_elements_margin_horizontal_m'], 2345 'bundleName': '__harDefaultBundleName__', 2346 'moduleName': '__harDefaultModuleName__', 2347 }; 2348 } 2349 } 2350 this.g9(this.b11.get(h12)); 2351 } 2352 index = h12; 2353 if (operation === t2.COMMIT_NODE) { 2354 let i12 = this.w7[index]; 2355 if (i12 === undefined) { 2356 return; 2357 } 2358 i12.y5(false); 2359 i12.h7(false); 2360 this.i8(index, a3.FINISH_EDIT); 2361 this.s12(index, a3.FINISH_EDIT); 2362 this.k13(this.y10, this.j13); 2363 this.g9(this.b11.get(i12?.e6())); 2364 } 2365 } 2366 2367 v9(d12, e12, isShow, index) { 2368 if (!this.p12(index)) { 2369 return; 2370 } 2371 let f12 = this.w7[index]; 2372 if (f12 === undefined) { 2373 return; 2374 } 2375 f12.r5(isShow); 2376 let g12 = this.b11.get(f12.e6()); 2377 if (!isShow) { 2378 this.g9(g12); 2379 return; 2380 } 2381 if (d12 === u2.HINTS) { 2382 if (f12.k6().w3 !== null) { 2383 f12.u5(f12.k6().w3?.title); 2384 } else { 2385 f12.u5(''); 2386 f12.r5(false); 2387 } 2388 f12.s5(false); 2389 f12.t5({ 2390 'id': -1, 2391 'type': 10001, 2392 params: ['sys.color.ohos_id_color_background'], 2393 'bundleName': '__harDefaultBundleName__', 2394 'moduleName': '__harDefaultModuleName__', 2395 }); 2396 f12.v5(this.treeViewTheme.b4); 2397 } else if (d12 === u2.WARNINGS) { 2398 if (f12.k6().inputText !== null) { 2399 if (e12 === v2.INVALID_ERROR) { 2400 f12.u5('invalid error'); 2401 } else if (e12 === v2.LENGTH_ERROR) { 2402 f12.u5('length error'); 2403 } 2404 f12.s5(true); 2405 f12.t5({ 2406 'id': -1, 2407 'type': 10001, 2408 params: ['sys.color.ohos_id_color_help_tip_bg'], 2409 'bundleName': '__harDefaultBundleName__', 2410 'moduleName': '__harDefaultModuleName__', 2411 }); 2412 f12.v5({ 2413 'id': -1, 2414 'type': 10001, 2415 params: ['sys.color.ohos_id_color_text_hint_contrary'], 2416 'bundleName': '__harDefaultBundleName__', 2417 'moduleName': '__harDefaultModuleName__', 2418 }); 2419 } 2420 } 2421 this.g9(g12); 2422 } 2423 2424 t13(timeout, index) { 2425 if (!this.p12(index)) { 2426 return; 2427 } 2428 if (this.w7[index].k6().w3 !== null) { 2429 this.w7[index].k6().w3.u13 = timeout; 2430 } 2431 let c12 = this.b11.get(this.w7[index].e6()); 2432 this.g9(c12); 2433 } 2434 2435 v13(index, text) { 2436 this.y10 = index; 2437 if (this.w7[index].k6().w3 !== null) { 2438 this.w7[index].k6().w3.title = text; 2439 } 2440 } 2441 2442 totalCount() { 2443 return this.b11.size; 2444 } 2445 2446 getData(index) { 2447 if (index < 0 || index >= this.u10.length) { 2448 return undefined; 2449 } 2450 return this.u10[index]; 2451 } 2452 2453 w13(index, data) { 2454 if (!this.p12(index)) { 2455 return; 2456 } 2457 this.w7.splice(index, 0, data); 2458 this.c11.set(data.e6(), index); 2459 this.v12(); 2460 this.o10(index); 2461 } 2462 2463 x13(data) { 2464 this.w7.push(data); 2465 this.c11.set(data.e6(), this.w7.length); 2466 this.v12(); 2467 this.o10(this.w7.length - 1); 2468 } 2469 2470 b9(b12) { 2471 this.e11 = b12; 2472 } 2473 2474 l8() { 2475 return this.e11; 2476 } 2477 2478 u8(a12) { 2479 this.f11 = a12; 2480 } 2481 2482 a9() { 2483 return this.f11; 2484 } 2485 2486 r9(z11) { 2487 if (z11 === undefined) { 2488 return; 2489 } 2490 this.i11 = z11; 2491 } 2492 2493 e9() { 2494 return this.i11; 2495 } 2496 2497 t9(y11) { 2498 if (y11 === undefined) { 2499 return; 2500 } 2501 this.h11 = y11; 2502 } 2503 2504 f9() { 2505 return this.h11; 2506 } 2507 2508 s8() { 2509 return this.g11; 2510 } 2511 2512 s9(x11) { 2513 if (x11 === undefined) { 2514 return; 2515 } 2516 this.g11 = x11; 2517 } 2518 2519 v8(w11) { 2520 this.j11 = w11; 2521 } 2522 2523 y13(item) { 2524 return item.e6() === this.s8() ? this.j11 : 1; 2525 } 2526 2527 x7() { 2528 return this.l12; 2529 } 2530 2531 q8(v11) { 2532 this.k11 = v11; 2533 } 2534 2535 k8() { 2536 return this.k11; 2537 } 2538 2539 m8(s11) { 2540 if (this.i11 === null || s11 === undefined) { 2541 return false; 2542 } 2543 let t11 = this.i11.u6(); 2544 let parentId = t11.currentNodeId; 2545 let u11 = this.v10.get(s11)?.parentNodeId; 2546 while (u11 !== undefined && u11 !== -1) { 2547 if (parentId === u11) { 2548 return true; 2549 } else { 2550 u11 = this.v10.get(u11)?.parentNodeId; 2551 } 2552 } 2553 return false; 2554 } 2555 2556 n8(r11) { 2557 this.n11 = r11; 2558 } 2559 2560 z13() { 2561 return this.n11; 2562 } 2563 2564 o8(currentIndex) { 2565 if (this.l11 !== this.INITIAL_INVALID_VALUE && this.b11.has(this.l11)) { 2566 let index = this.b11.get(this.l11); 2567 this.w7.forEach((value) => { 2568 if (value.e6() === this.l11) { 2569 value.w6(false); 2570 return; 2571 } 2572 }); 2573 this.g9(index); 2574 } 2575 if ((this.t11 !== this.INITIAL_INVALID_VALUE && 2576 this.u11 !== this.t11)) { 2577 clearTimeout(this.t11); 2578 if (this.v11 !== this.INITIAL_INVALID_VALUE) { 2579 this.a14(this.v11); 2580 let index = this.b11 2581 .get(this.w7[this.v11].e6()); 2582 this.g9(index); 2583 } 2584 this.u11 = this.t11; 2585 } 2586 this.t11 = this.s11; 2587 this.v11 = currentIndex; 2588 if ((this.q11 !== this.INITIAL_INVALID_VALUE && 2589 this.r11 !== this.q11)) { 2590 clearTimeout(this.q11); 2591 this.r11 = this.q11; 2592 } 2593 this.q11 = this.p11; 2594 this.o11 = this.INITIAL_INVALID_VALUE; 2595 } 2596 2597 a14(currentIndex) { 2598 if (!this.p12(currentIndex)) { 2599 return; 2600 } 2601 this.q12(currentIndex, this.w7[currentIndex].l6().normal); 2602 this.b14(currentIndex, false); 2603 this.i8(currentIndex, a3.FINISH_DRAG_INSERT); 2604 this.s12(currentIndex, a3.FINISH_DRAG_INSERT); 2605 this.w7[currentIndex].f7(false); 2606 } 2607 2608 b14(index, p11) { 2609 if (this.w7[index].k6().w3 && this.w7[index].w5()) { 2610 this.w7[index].k6().w3?.q9(p11); 2611 } 2612 } 2613 2614 r8(flag, index, k11) { 2615 let l11 = (this.n11 !== index || this.flag !== flag) ? true : false; 2616 this.n11 = index; 2617 if ((l11 || k11) && this.e11) { 2618 this.flag = flag; 2619 let currentNodeId = this.getData(index)?.e6(); 2620 let m11 = this.getData(index)?.a7(); 2621 if (currentNodeId !== undefined) { 2622 m11 = (this.a11.get(currentNodeId) === z2.EXPAND && 2623 this.flag === w2.DOWN_FLAG) ? (m11 ? m11 + 1 : undefined) : m11; 2624 if (this.l11 !== this.INITIAL_INVALID_VALUE && this.b11.has(this.l11)) { 2625 let n11 = this.b11.get(this.l11); 2626 this.w7.forEach((value) => { 2627 if (value.e6() === this.l11) { 2628 value.w6(false); 2629 } 2630 }); 2631 this.g9(n11); 2632 } 2633 if (this.flag === w2.DOWN_FLAG && index < this.totalCount() - 1) { 2634 this.getData(index)?.w6(false); 2635 this.getData(index + 1)?.w6(true); 2636 this.getData(index)?.d7(false); 2637 this.getData(index + 1)?.y6(m11); 2638 this.g9(index); 2639 this.g9(index + 1); 2640 this.l11 = this.getData(index + 1)?.e6(); 2641 } else if (this.flag === w2.UP_FLAG && index < this.totalCount() - 1) { 2642 this.getData(index)?.w6(true); 2643 this.getData(index + 1)?.w6(false); 2644 this.getData(index)?.d7(false); 2645 this.getData(index)?.y6(m11); 2646 this.g9(index); 2647 this.g9(index + 1); 2648 this.l11 = this.getData(index)?.e6(); 2649 } else if (index >= this.totalCount() - 1) { 2650 if (this.flag === w2.DOWN_FLAG) { 2651 this.getData(index)?.w6(false); 2652 this.getData(index)?.d7(true); 2653 } else { 2654 this.getData(index)?.w6(true); 2655 this.getData(index)?.d7(false); 2656 } 2657 this.getData(index)?.y6(m11); 2658 this.g9(index); 2659 this.l11 = this.getData(index)?.e6(); 2660 } 2661 } 2662 } 2663 } 2664 2665 t8(currentIndex, currentNodeId, b11) { 2666 let c11 = currentIndex !== this.o11 ? true : false; 2667 let d11 = this.getData(b11)?.c7(); 2668 if (d11) { 2669 this.o11 = this.INITIAL_INVALID_VALUE; 2670 } else { 2671 this.o11 = currentIndex; 2672 } 2673 if (d11 || c11) { 2674 let e11 = !d11 && (!this.e11 || 2675 (this.a11.get(currentNodeId) === z2.COLLAPSE && this.e11) || 2676 (!this.a11.has(currentNodeId) && this.w7[currentIndex].v6())); 2677 if (e11) { 2678 this.q12(currentIndex, this.w7[currentIndex].l6().h5); 2679 this.g9(b11); 2680 let i11 = this.e11 ? 1000 : 0; 2681 this.s11 = setTimeout(() => { 2682 this.c14(currentIndex); 2683 }, i11); 2684 } 2685 if (d11 || (this.t11 !== this.INITIAL_INVALID_VALUE && 2686 this.u11 !== this.t11)) { 2687 clearTimeout(this.t11); 2688 if (this.v11 !== this.INITIAL_INVALID_VALUE) { 2689 this.a14(this.v11); 2690 this.z8(); 2691 } 2692 this.u11 = this.t11; 2693 } 2694 this.t11 = this.s11; 2695 this.v11 = currentIndex; 2696 if (!d11 && this.a11.get(currentNodeId) === z2.COLLAPSE) { 2697 let f11 = this.getData(b11)?.u6().children[0]?.currentNodeId; 2698 let g11 = 2000; 2699 this.p11 = setTimeout(() => { 2700 this.a14(this.v11); 2701 if (f11 !== undefined) { 2702 this.d14(currentIndex, f11); 2703 } 2704 }, g11); 2705 } 2706 if (d11 || (this.q11 !== this.INITIAL_INVALID_VALUE && 2707 this.r11 !== this.q11)) { 2708 clearTimeout(this.q11); 2709 this.r11 = this.q11; 2710 } 2711 this.q11 = this.p11; 2712 } 2713 } 2714 2715 c14(currentIndex) { 2716 this.w7.forEach((value) => { 2717 if (value.e6() === this.l11) { 2718 value.w6(false); 2719 value.d7(false); 2720 return; 2721 } 2722 }); 2723 this.q12(currentIndex, this.w7[currentIndex].l6().j5); 2724 this.w7[currentIndex].f7(true); 2725 this.b14(currentIndex, true); 2726 this.i8(currentIndex, a3.DRAG_INSERT); 2727 this.s12(currentIndex, a3.DRAG_INSERT); 2728 this.z8(); 2729 } 2730 2731 d14(currentIndex, x10) { 2732 this.w7.forEach((value) => { 2733 if (value.e6() === this.l11) { 2734 value.w6(false); 2735 value.d7(false); 2736 } 2737 }); 2738 this.w7.forEach((value) => { 2739 if (this.e11 && value.e6() === x10) { 2740 value.w6(true); 2741 } 2742 }); 2743 this.w12(currentIndex); 2744 this.z12(currentIndex, true); 2745 this.l11 = x10; 2746 } 2747 2748 w8() { 2749 if (this.l11 !== this.INITIAL_INVALID_VALUE && this.b11.has(this.l11)) { 2750 this.w7.forEach((value) => { 2751 if (value.e6() === this.l11) { 2752 value.w6(false); 2753 value.d7(false); 2754 return; 2755 } 2756 }); 2757 let index = this.b11.get(this.l11); 2758 this.g9(index); 2759 } 2760 } 2761 2762 x8() { 2763 if (this.t11 !== this.INITIAL_INVALID_VALUE && 2764 this.u11 !== this.t11) { 2765 clearTimeout(this.t11); 2766 if (this.v11 !== this.INITIAL_INVALID_VALUE) { 2767 this.a14(this.v11); 2768 } 2769 } 2770 } 2771 2772 y8() { 2773 if (this.q11 !== this.INITIAL_INVALID_VALUE && 2774 this.r11 !== this.q11) { 2775 clearTimeout(this.q11); 2776 } 2777 } 2778 2779 e14(currentNodeId) { 2780 if (this.x11.has(currentNodeId)) { 2781 if (typeof this.x11.get(currentNodeId) === 'number') { 2782 return this.x11.get(currentNodeId)?.toString(); 2783 } else { 2784 return this.x11.get(currentNodeId); 2785 } 2786 } else { 2787 return ''; 2788 } 2789 } 2790 2791 f14(currentNodeId) { 2792 return this.x11.has(currentNodeId); 2793 } 2794 2795 c9() { 2796 this.v11 = this.INITIAL_INVALID_VALUE; 2797 this.o11 = this.INITIAL_INVALID_VALUE; 2798 this.k11 = this.INITIAL_INVALID_VALUE; 2799 this.g11 = this.INITIAL_INVALID_VALUE; 2800 this.flag = w2.NONE; 2801 } 2802 2803 d9(v10) { 2804 this.x11.set(this.y11, this.z11); 2805 this.x11.set(v10, this.a12); 2806 this.g9(this.b11.get(this.y11)); 2807 this.g9(this.b11.get(v10)); 2808 } 2809 2810 j10(s10, t10, u10) { 2811 this.y11 = s10; 2812 this.z11 = t10; 2813 this.a12 = u10; 2814 } 2815 2816 g14() { 2817 return this.a12; 2818 } 2819 2820 j9(currentNodeId) { 2821 return this.a11.get(currentNodeId); 2822 } 2823 2824 o9() { 2825 return this.w11; 2826 } 2827 2828 l9() { 2829 this.w7.forEach((value, index) => { 2830 if (index === this.v11) { 2831 this.w11 = value.e6(); 2832 } 2833 }); 2834 } 2835 2836 n9(q10) { 2837 this.l11 = q10; 2838 } 2839 2840 p9(p10) { 2841 this.v11 = p10; 2842 } 2843 2844 m9(r9, s9, t9, u9, v9) { 2845 let w9 = []; 2846 let parentNodeId = r9; 2847 let currentNodeId = u9; 2848 let nodeParam = v9.t6(); 2849 let x9 = null; 2850 let y9 = v9.u6(); 2851 let z9 = false; 2852 let a10 = this.INITIAL_INVALID_VALUE; 2853 let b10 = this.INITIAL_INVALID_VALUE; 2854 let c10 = this.flag === w2.DOWN_FLAG ? true : false; 2855 b10 = this.h14(t9, u9); 2856 a10 = this.h14(r9, s9) + 1; 2857 if (r9 !== t9) { 2858 a10 = c10 ? a10 + 1 : a10; 2859 } else { 2860 if (a10 > b10) { 2861 a10 = c10 ? a10 : a10 - 1; 2862 } else { 2863 a10 = c10 ? a10 + 1 : a10; 2864 } 2865 } 2866 for (let o10 = 0; o10 < this.w7.length; o10++) { 2867 if (this.w7[o10].e6() === s9) { 2868 z9 = this.w7[o10].g7(); 2869 if (this.flag === w2.DOWN_FLAG && this.a11.get(s9) === z2.EXPAND) { 2870 parentNodeId = s9; 2871 a10 = 0; 2872 } else if (this.flag === w2.UP_FLAG && this.a11.get(s9) === 2873 z2.EXPAND && 2874 this.w7[o10].x6() === false) { 2875 parentNodeId = s9; 2876 a10 = 0; 2877 } else if (z9) { 2878 parentNodeId = s9; 2879 a10 = 0; 2880 } 2881 break; 2882 } 2883 } 2884 let callbackParam = { 2885 currentNodeId: currentNodeId, 2886 parentNodeId: parentNodeId, 2887 childIndex: a10, 2888 }; 2889 this.appEventBus.emit(TreeListenType.NODE_MOVE, callbackParam); 2890 w9.push({ parentId: parentNodeId, i14: currentNodeId, data: nodeParam }); 2891 let callback = (node, m10) => { 2892 if (node) { 2893 parentNodeId = node.parentNodeId; 2894 currentNodeId = node.currentNodeId; 2895 for (let n10 = 0; n10 < m10.length; n10++) { 2896 if (m10[n10].e6() === currentNodeId) { 2897 x9 = m10[n10]; 2898 break; 2899 } 2900 } 2901 if (x9 === null) { 2902 return false; 2903 } 2904 let nodeParam = x9.t6(); 2905 if (parentNodeId !== t9) { 2906 w9.push({ parentId: parentNodeId, i14: currentNodeId, data: nodeParam }); 2907 } 2908 return false; 2909 } 2910 return false; 2911 }; 2912 this.j14(callback, y9, this.w7); 2913 let d10 = this.removeNode(u9, t9); 2914 if (d10.length === 0) { 2915 return; 2916 } 2917 let e10 = s9; 2918 let isAfter = c10; 2919 if (this.a11.get(s9) === z2.EXPAND) { 2920 isAfter = false; 2921 this.w7.forEach((value) => { 2922 if (value.e6() === s9 && value.x6() === false) { 2923 if (value.u6().children.length) { 2924 e10 = value.u6().children[0].currentNodeId; 2925 } else { 2926 e10 = this.INITIAL_INVALID_VALUE; 2927 } 2928 } 2929 }); 2930 } else if (!this.a11.get(s9) && z9) { 2931 this.a11.set(s9, z2.EXPAND); 2932 } 2933 let f10 = this.k14(w9[0].parentId, w9[0].i14, e10, isAfter, w9[0].data); 2934 if (!f10) { 2935 return; 2936 } 2937 for (let j10 = 1; j10 < w9.length; j10++) { 2938 let k10 = this.addNode(w9[j10].parentId, w9[j10].i14, w9[j10].data, false); 2939 if (!k10) { 2940 return; 2941 } 2942 } 2943 for (let i10 = 0; i10 < this.w7.length; i10++) { 2944 if (this.w7[i10].e6() === t9) { 2945 if (this.w7[i10].k6().x3 === null) { 2946 this.w7[i10].z5(false); 2947 this.a11.delete(t9); 2948 break; 2949 } 2950 } 2951 } 2952 let g10 = [...this.w7]; 2953 this.l14(g10); 2954 } 2955 2956 l14(m9) { 2957 let index = 0; 2958 let n9 = 0; 2959 this.w7.splice(0, this.w7.length); 2960 this.b11.clear(); 2961 this.u10.splice(0, this.u10.length); 2962 this.n14((node) => { 2963 let currentNodeId = node.currentNodeId; 2964 if (currentNodeId >= 0) { 2965 if (this.w10.has(currentNodeId)) { 2966 let p9 = new f3(node, this.w10.get(currentNodeId)); 2967 p9.m5(node.o6().a13); 2968 this.w7.push(p9); 2969 this.c11.set(p9.e6(), n9++); 2970 if (this.a11.get(currentNodeId) === z2.EXPAND) { 2971 p9.k6().x3 = q3.x12(z2.EXPAND, p9.k6().x3?.y12); 2972 } else if (this.a11.get(currentNodeId) === z2.COLLAPSE) { 2973 p9.k6().x3 = q3.x12(z2.COLLAPSE, p9.k6().x3?.y12); 2974 } 2975 for (let q9 = 0; q9 < m9.length; q9++) { 2976 if (m9[q9].e6() === p9.e6()) { 2977 p9.i6(m9[q9].j6()); 2978 p9.c6(m9[q9].d6()); 2979 if (p9.k6().w3 && p9.w5()) { 2980 p9.k6().w3.title = m9[q9].k6().w3?.title; 2981 } 2982 break; 2983 } 2984 } 2985 if (p9.j6()) { 2986 this.b11.set(p9.e6(), index++); 2987 this.u10.push(p9); 2988 } 2989 } 2990 } 2991 return false; 2992 }); 2993 } 2994 2995 o14() { 2996 return this.f12; 2997 } 2998 2999 p14(j9) { 3000 let k9 = this.b11.get(j9.e6()) - 1; 3001 if (k9 > this.INITIAL_INVALID_VALUE) { 3002 let l9 = this.getData(k9); 3003 return (j9.x6() === true && !j9.g7() && !l9?.g7()) ? 3004 Visibility.Visible : Visibility.Hidden; 3005 } else { 3006 return (j9.x6() === true && !j9.g7()) ? 3007 Visibility.Visible : Visibility.Hidden; 3008 } 3009 } 3010 3011 q14() { 3012 return this.subTitle; 3013 } 3014 3015 v6(i9) { 3016 if (this.b11.has(i9)) { 3017 return this.getData(this.b11.get(i9))?.v6(); 3018 } 3019 return false; 3020 } 3021 3022 r14(h9) { 3023 return h9 ? this.subTitle.o12 : this.treeViewTheme.b4; 3024 } 3025 3026 h14(d9, e9) { 3027 let f9 = this.INITIAL_INVALID_VALUE; 3028 if (this.v10.has(d9)) { 3029 let node = this.v10.get(d9); 3030 if (node.f13() === d9) { 3031 node.children.forEach((value, index) => { 3032 if (value.f13() === e9) { 3033 f9 = index; 3034 return; 3035 } 3036 }); 3037 } 3038 } 3039 return f9; 3040 } 3041 3042 s14(c9) { 3043 this.b12 = c9; 3044 } 3045 3046 t14() { 3047 return this.b12; 3048 } 3049 3050 u14(b9) { 3051 this.c12 = b9; 3052 } 3053 3054 v14() { 3055 return this.c12; 3056 } 3057 3058 w14() { 3059 return this.d12; 3060 } 3061 3062 p8(flag) { 3063 this.flag = flag; 3064 } 3065 3066 n14(callback, root = this.s10) { 3067 let stack = []; 3068 let z8 = false; 3069 stack.unshift(root); 3070 let a9 = stack.shift(); 3071 while (!z8 && a9) { 3072 z8 = callback(a9) === true; 3073 if (!z8) { 3074 stack.unshift(...a9.children); 3075 a9 = stack.shift(); 3076 } 3077 } 3078 } 3079 3080 e13(callback, root = this.s10, u8, v8) { 3081 let stack = []; 3082 let w8 = false; 3083 let x8 = false; 3084 stack.unshift(root); 3085 let y8 = stack.shift(); 3086 while (!w8 && y8) { 3087 try { 3088 if (u8 !== undefined && y8.b5 < u8) { 3089 x8 = true; 3090 } 3091 if (v8 !== undefined && y8.b5 > v8) { 3092 x8 = true; 3093 } 3094 if (!x8) { 3095 w8 = callback(y8); 3096 } 3097 } catch (err) { 3098 throw new Error('traverseSectionNodeDF function callbacks error'); 3099 } 3100 if (!w8) { 3101 stack.unshift(...y8.children); 3102 y8 = stack.shift(); 3103 x8 = false; 3104 } 3105 } 3106 } 3107 3108 x14(s8, t8, count) { 3109 let parentNodeId = s8.parentNodeId; 3110 while (parentNodeId >= 0) { 3111 if (this.v10.has(parentNodeId)) { 3112 let parent = this.v10.get(parentNodeId); 3113 parent.o6().r10 = 3114 t8 ? parent.o6().r10 + count : parent.o6().r10 - count; 3115 parentNodeId = parent.parentNodeId; 3116 } else { 3117 hilog.error(LOG_CODE, TAG, 'updateParentChildNum: parent node not found.'); 3118 break; 3119 } 3120 } 3121 } 3122 3123 f10(currentNodeId) { 3124 let current = new j3(d3); 3125 if (this.v10.has(currentNodeId)) { 3126 current = this.v10.get(currentNodeId); 3127 } 3128 return current.parentNodeId; 3129 } 3130 3131 addNode(parentNodeId, currentNodeId, data, p8) { 3132 if (this.s10 === null) { 3133 this.s10 = new j3(d3); 3134 this.s10.b5 = -1; 3135 this.v10.set(-1, this.s10); 3136 this.w10.set(-1, d3); 3137 } 3138 if (this.v10.has(parentNodeId)) { 3139 let parent = this.v10.get(parentNodeId); 3140 let q8 = new j3(data); 3141 if (parent.b5 > this.t10) { 3142 hilog.error(LOG_CODE, TAG, 3143 'ListDataSource[addNode]: The level of the tree view cannot exceed 50.'); 3144 return false; 3145 } 3146 q8.b5 = parent.b5 + 1; 3147 q8.parentNodeId = parentNodeId; 3148 q8.currentNodeId = currentNodeId; 3149 q8.y14 = parent.children.length; 3150 data.parentNodeId = parentNodeId; 3151 data.currentNodeId = currentNodeId; 3152 parent.children.push(q8); 3153 parent.o6().a13 = true; 3154 parent.o6().b13 = parent.children.length; 3155 parent.o6().r10 += 1; 3156 if (p8) { 3157 this.e12.push(parent.parentNodeId); 3158 } else { 3159 let r8 = []; 3160 r8.push(parent.parentNodeId); 3161 i(true, 1, this.v10, r8); 3162 } 3163 this.w10.set(currentNodeId, data); 3164 this.v10.set(currentNodeId, q8); 3165 return true; 3166 } else { 3167 hilog.error(LOG_CODE, TAG, 'ListDataSource[addNode]: Parent node not found.'); 3168 return false; 3169 } 3170 } 3171 3172 z14(k8, l8) { 3173 let m8 = []; 3174 let callback = (node) => { 3175 m8.push(node); 3176 return false; 3177 }; 3178 this.n14(callback, k8); 3179 m8.forEach((value) => { 3180 l8.push(value.f13()); 3181 this.v10.delete(value.f13()); 3182 this.w10.delete(value.f13()); 3183 value = new j3(d3); 3184 }); 3185 } 3186 3187 removeNode(currentNodeId, parentNodeId) { 3188 if (this.v10.has(parentNodeId) && this.v10.has(currentNodeId)) { 3189 let parent = this.v10.get(parentNodeId); 3190 let current = this.v10.get(currentNodeId); 3191 let f8 = []; 3192 let index = current.y14; 3193 let g8 = 0; 3194 if (index < 0) { 3195 hilog.error(LOG_CODE, TAG, 'node does not exist.'); 3196 return []; 3197 } else { 3198 g8 = parent.children[index].o6().r10 + 1; 3199 this.z14(parent.children[index], f8); 3200 for (let j8 = index; j8 < parent.children.length; j8++) { 3201 parent.children[j8].y14 -= 1; 3202 } 3203 let node = parent.children.splice(index, 1); 3204 node = null; 3205 if (parent.children.length === 0) { 3206 if (this.c11.has(parentNodeId)) { 3207 let i8 = this.c11.get(parentNodeId); 3208 this.w7[i8]?.m5(false); 3209 } 3210 } 3211 } 3212 parent.o6().b13 = parent.children.length; 3213 parent.o6().r10 -= (g8); 3214 let h8 = []; 3215 h8.push(parent.parentNodeId); 3216 i(false, g8, this.v10, h8); 3217 return f8; 3218 } else { 3219 hilog.error(LOG_CODE, TAG, 'parent does not exist.'); 3220 return []; 3221 } 3222 } 3223 3224 a15(e8) { 3225 if (e8?.currentNodeId === undefined) { 3226 hilog.error(LOG_CODE, TAG, 'getNodeInfoByNodeItem: currentId is undefined'); 3227 return new f3(new j3(d3), d3); 3228 } 3229 if (!this.c11.has(e8.currentNodeId)) { 3230 hilog.error(LOG_CODE, TAG, 'getNodeInfoByNodeItem: not has nodeItem.'); 3231 return new f3(new j3(d3), d3); 3232 } 3233 let index = this.c11.get(e8.currentNodeId); 3234 return this.w7[index]; 3235 } 3236 3237 h10(a8) { 3238 let parent = new j3(d3); 3239 if (this.v10.has(a8)) { 3240 parent = this.v10.get(a8); 3241 } 3242 let b8 = d3; 3243 if (parent) { 3244 let c8 = this.a15(parent); 3245 if (parent.children.length === 0) { 3246 if (c8.k6().v3 !== undefined) { 3247 b8.icon = c8.k6().v3?.a8; 3248 b8.selectedIcon = c8.k6().v3?.r13; 3249 b8.editIcon = c8.k6().v3?.s13; 3250 b8.container = c8.q6(); 3251 } else { 3252 b8.icon = undefined; 3253 b8.selectedIcon = undefined; 3254 b8.editIcon = undefined; 3255 b8.container = c8.q6(); 3256 } 3257 } else if (parent.children.length > 0) { 3258 let d8 = this.a15(parent.children[0]); 3259 if (c8.k6().v3 !== null) { 3260 b8.icon = (d8.k6().v3 !== undefined) ? 3261 d8.k6().v3?.a8 : undefined; 3262 b8.selectedIcon = (d8.k6().v3 !== undefined) ? 3263 d8.k6().v3?.r13 : undefined; 3264 b8.editIcon = (d8.k6().v3 !== undefined) ? 3265 d8.k6().v3?.s13 : undefined; 3266 b8.container = d8.q6(); 3267 } else { 3268 b8.icon = undefined; 3269 b8.selectedIcon = undefined; 3270 b8.editIcon = undefined; 3271 b8.container = d8.q6(); 3272 } 3273 } 3274 } 3275 return b8; 3276 } 3277 3278 e10(w7) { 3279 let parent = new j3(d3); 3280 if (this.v10.has(w7)) { 3281 parent = this.v10.get(w7); 3282 } 3283 if (parent) { 3284 if (parent.children.length === 0) { 3285 return []; 3286 } else if (parent.children.length > 0) { 3287 let x7 = new Array(parent.children.length); 3288 for (let z7 = 0; z7 < x7.length; z7++) { 3289 x7[z7] = 0; 3290 } 3291 for (let y7 = 0; y7 < parent.children.length && y7 < x7.length; y7++) { 3292 x7[y7] = parent.children[y7].currentNodeId; 3293 } 3294 return x7; 3295 } 3296 } 3297 return []; 3298 } 3299 3300 b10(r7) { 3301 let parent = new j3(d3); 3302 if (this.v10.has(r7)) { 3303 parent = this.v10.get(r7); 3304 } 3305 if (parent) { 3306 if (parent.children.length === 0) { 3307 return []; 3308 } else if (parent.children.length > 0) { 3309 let s7 = new Array(parent.children.length); 3310 for (let v7 = 0; v7 < s7.length; v7++) { 3311 s7[v7] = {}; 3312 } 3313 for (let t7 = 0; t7 < parent.children.length && t7 < s7.length; t7++) { 3314 s7[t7].itemId = parent.children[t7].currentNodeId; 3315 let u7 = this.a15(parent.children[t7]); 3316 if (u7.k6().v3) { 3317 s7[t7].b15 = u7.k6().v3?.source; 3318 } 3319 if (u7.k6().w3) { 3320 s7[t7].c15 = u7.k6().w3?.title; 3321 } 3322 s7[t7].isFolder = u7.v6(); 3323 } 3324 return s7; 3325 } 3326 } 3327 return []; 3328 } 3329 3330 i10(title) { 3331 if (new RegExp('/[\\\/:*?"<>|]/').test(title)) { 3332 return false; 3333 } 3334 if ((new RegExp('/^[\u4e00-\u9fa5]+$/').test(title) && title.length > this.MAX_CN_LENGTH) || 3335 (!new RegExp('/^[\u4e00-\u9fa5]+$/').test(title) && title.length > this.MAX_EN_LENGTH)) { 3336 return false; 3337 } 3338 return true; 3339 } 3340 3341 j14(callback, root = this.s10, o7) { 3342 let stack = []; 3343 let p7 = false; 3344 stack.unshift(root); 3345 let q7 = stack.shift(); 3346 while (!p7 && q7) { 3347 p7 = callback(q7, o7) === true; 3348 if (!p7) { 3349 stack.unshift(...q7.children); 3350 q7 = stack.shift(); 3351 } 3352 } 3353 } 3354 3355 d15(insertIndex, parent) { 3356 for (let n7 = insertIndex; n7 < parent.children.length; n7++) { 3357 parent.children[n7].y14 += 1; 3358 } 3359 } 3360 3361 k14(parentNodeId, currentNodeId, k7, isAfter, data) { 3362 if (this.s10 === null) { 3363 this.s10 = new j3(d3); 3364 this.s10.b5 = this.INITIAL_INVALID_VALUE; 3365 } 3366 if (this.v10.has(parentNodeId)) { 3367 let parent = this.v10.get(parentNodeId); 3368 let l7 = new j3(data); 3369 if (parent.b5 > this.t10) { 3370 hilog.error(LOG_CODE, TAG, 'addDragNode: The level of the tree view cannot exceed 50.'); 3371 return false; 3372 } 3373 l7.b5 = parent.b5 + 1; 3374 l7.parentNodeId = parentNodeId; 3375 l7.currentNodeId = currentNodeId; 3376 data.parentNodeId = parentNodeId; 3377 data.currentNodeId = currentNodeId; 3378 let insertIndex = this.INITIAL_INVALID_VALUE; 3379 if (parent.children.length) { 3380 for (let m7 = 0; m7 < parent.children.length; m7++) { 3381 if (parent.children[m7].f13() === k7) { 3382 insertIndex = m7; 3383 break; 3384 } 3385 } 3386 if (isAfter) { 3387 l7.y14 = insertIndex + 1; 3388 this.d15(l7.y14, parent); 3389 parent.children.splice(insertIndex + 1, 0, l7); 3390 } else { 3391 l7.y14 = insertIndex < 0 ? parent.children.length + insertIndex : insertIndex; 3392 this.d15(l7.y14, parent); 3393 parent.children.splice(insertIndex, 0, l7); 3394 } 3395 } else { 3396 l7.y14 = parent.children.length; 3397 parent.children.push(l7); 3398 } 3399 parent.o6().a13 = true; 3400 parent.o6().b13 = parent.children.length; 3401 parent.o6().r10 += 1; 3402 this.x14(parent, true, 1); 3403 this.v10.set(currentNodeId, l7); 3404 this.w10.set(currentNodeId, data); 3405 return true; 3406 } else { 3407 hilog.error(LOG_CODE, TAG, 'addDragNode: Parent node not found.'); 3408 return false; 3409 } 3410 } 3411} 3412 3413export class i3 extends ViewPU { 3414 constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 3415 super(parent, __localStorage, elmtId, extraInfo); 3416 if (typeof paramsLambda === 'function') { 3417 this.paramsGenerator_ = paramsLambda; 3418 } 3419 this.n7 = new SynchedPropertyNesedObjectPU(params.item, this, 'item'); 3420 this.listNodeDataSource = new h3(); 3421 this.e15 = new ObservedPropertySimplePU(0, this, 'columnWidth'); 3422 this.f15 = new ObservedPropertySimplePU(false, this, 'isFocused'); 3423 this.g15 = new ObservedPropertySimplePU(-1, this, 'index'); 3424 this.h15 = new ObservedPropertySimplePU(-1, this, 'lastIndex'); 3425 this.i15 = new ObservedPropertySimplePU(0, this, 'count'); 3426 this.r7 = new ObservedPropertySimplePU(false, this, 'followingSystemFontScale'); 3427 this.s7 = new ObservedPropertySimplePU(1, this, 'maxAppFontScale'); 3428 this.u7 = this.initializeConsume('treeViewTheme', 'treeViewTheme'); 3429 this.listTreeViewMenu = undefined; 3430 this.MAX_CN_LENGTH = 254; 3431 this.MAX_EN_LENGTH = 255; 3432 this.INITIAL_INVALID_VALUE = -1; 3433 this.MAX_TOUCH_DOWN_COUNT = 0; 3434 this.isMultiPress = false; 3435 this.touchDownCount = this.INITIAL_INVALID_VALUE; 3436 this.appEventBus = TreeListenerManager.getInstance().getTreeListener(); 3437 this.itemPadding = { 3438 left: { 3439 'id': -1, 3440 'type': 10002, 3441 params: ['sys.float.ohos_id_card_margin_start'], 3442 'bundleName': '__harDefaultBundleName__', 3443 'moduleName': '__harDefaultModuleName__', 3444 }, 3445 right: { 3446 'id': -1, 3447 'type': 10002, 3448 params: ['sys.float.ohos_id_card_margin_end'], 3449 'bundleName': '__harDefaultBundleName__', 3450 'moduleName': '__harDefaultModuleName__', 3451 }, 3452 top: { 3453 'id': -1, 3454 'type': 10002, 3455 params: ['sys.float.ohos_id_text_margin_vertical'], 3456 'bundleName': '__harDefaultBundleName__', 3457 'moduleName': '__harDefaultModuleName__', 3458 }, 3459 bottom: { 3460 'id': -1, 3461 'type': 10002, 3462 params: ['sys.float.padding_level0'], 3463 'bundleName': '__harDefaultBundleName__', 3464 'moduleName': '__harDefaultModuleName__', 3465 }, 3466 }; 3467 this.textInputPadding = { 3468 left: { 3469 'id': -1, 3470 'type': 10002, 3471 params: ['sys.float.padding_level0'], 3472 'bundleName': '__harDefaultBundleName__', 3473 'moduleName': '__harDefaultModuleName__', 3474 }, 3475 right: { 3476 'id': -1, 3477 'type': 10002, 3478 params: ['sys.float.padding_level0'], 3479 'bundleName': '__harDefaultBundleName__', 3480 'moduleName': '__harDefaultModuleName__', 3481 }, 3482 top: { 3483 'id': -1, 3484 'type': 10002, 3485 params: ['sys.float.padding_level0'], 3486 'bundleName': '__harDefaultBundleName__', 3487 'moduleName': '__harDefaultModuleName__', 3488 }, 3489 bottom: { 3490 'id': -1, 3491 'type': 10002, 3492 params: ['sys.float.padding_level0'], 3493 'bundleName': '__harDefaultBundleName__', 3494 'moduleName': '__harDefaultModuleName__', 3495 } 3496 }; 3497 this.inputFontSize = resourceManager.getSystemResourceManager().getNumberByName('ohos_id_text_size_body1'); 3498 this.setInitiallyProvidedValue(params); 3499 this.finalizeConstruction(); 3500 } 3501 3502 setInitiallyProvidedValue(params) { 3503 this.n7.set(params.item); 3504 if (params.listNodeDataSource !== undefined) { 3505 this.listNodeDataSource = params.listNodeDataSource; 3506 } 3507 if (params.columnWidth !== undefined) { 3508 this.columnWidth = params.columnWidth; 3509 } 3510 if (params.isFocused !== undefined) { 3511 this.isFocused = params.isFocused; 3512 } 3513 if (params.index !== undefined) { 3514 this.index = params.index; 3515 } 3516 if (params.lastIndex !== undefined) { 3517 this.lastIndex = params.lastIndex; 3518 } 3519 if (params.count !== undefined) { 3520 this.count = params.count; 3521 } 3522 if (params.followingSystemFontScale !== undefined) { 3523 this.followingSystemFontScale = params.followingSystemFontScale; 3524 } 3525 if (params.maxAppFontScale !== undefined) { 3526 this.maxAppFontScale = params.maxAppFontScale; 3527 } 3528 if (params.listTreeViewMenu !== undefined) { 3529 this.listTreeViewMenu = params.listTreeViewMenu; 3530 } 3531 if (params.MAX_CN_LENGTH !== undefined) { 3532 this.MAX_CN_LENGTH = params.MAX_CN_LENGTH; 3533 } 3534 if (params.MAX_EN_LENGTH !== undefined) { 3535 this.MAX_EN_LENGTH = params.MAX_EN_LENGTH; 3536 } 3537 if (params.INITIAL_INVALID_VALUE !== undefined) { 3538 this.INITIAL_INVALID_VALUE = params.INITIAL_INVALID_VALUE; 3539 } 3540 if (params.MAX_TOUCH_DOWN_COUNT !== undefined) { 3541 this.MAX_TOUCH_DOWN_COUNT = params.MAX_TOUCH_DOWN_COUNT; 3542 } 3543 if (params.isMultiPress !== undefined) { 3544 this.isMultiPress = params.isMultiPress; 3545 } 3546 if (params.touchDownCount !== undefined) { 3547 this.touchDownCount = params.touchDownCount; 3548 } 3549 if (params.appEventBus !== undefined) { 3550 this.appEventBus = params.appEventBus; 3551 } 3552 if (params.itemPadding !== undefined) { 3553 this.itemPadding = params.itemPadding; 3554 } 3555 if (params.textInputPadding !== undefined) { 3556 this.textInputPadding = params.textInputPadding; 3557 } 3558 if (params.inputFontSize !== undefined) { 3559 this.inputFontSize = params.inputFontSize; 3560 } 3561 } 3562 3563 updateStateVars(params) { 3564 this.n7.set(params.item); 3565 } 3566 3567 purgeVariableDependenciesOnElmtId(rmElmtId) { 3568 this.n7.purgeDependencyOnElmtId(rmElmtId); 3569 this.e15.purgeDependencyOnElmtId(rmElmtId); 3570 this.f15.purgeDependencyOnElmtId(rmElmtId); 3571 this.g15.purgeDependencyOnElmtId(rmElmtId); 3572 this.h15.purgeDependencyOnElmtId(rmElmtId); 3573 this.i15.purgeDependencyOnElmtId(rmElmtId); 3574 this.r7.purgeDependencyOnElmtId(rmElmtId); 3575 this.s7.purgeDependencyOnElmtId(rmElmtId); 3576 this.u7.purgeDependencyOnElmtId(rmElmtId); 3577 } 3578 3579 aboutToBeDeleted() { 3580 this.n7.aboutToBeDeleted(); 3581 this.e15.aboutToBeDeleted(); 3582 this.f15.aboutToBeDeleted(); 3583 this.g15.aboutToBeDeleted(); 3584 this.h15.aboutToBeDeleted(); 3585 this.i15.aboutToBeDeleted(); 3586 this.r7.aboutToBeDeleted(); 3587 this.s7.aboutToBeDeleted(); 3588 this.u7.aboutToBeDeleted(); 3589 SubscriberManager.Get().delete(this.id__()); 3590 this.aboutToBeDeletedInternal(); 3591 } 3592 3593 get item() { 3594 return this.n7.get(); 3595 } 3596 3597 get columnWidth() { 3598 return this.e15.get(); 3599 } 3600 3601 set columnWidth(newValue) { 3602 this.e15.set(newValue); 3603 } 3604 3605 get isFocused() { 3606 return this.f15.get(); 3607 } 3608 3609 set isFocused(newValue) { 3610 this.f15.set(newValue); 3611 } 3612 3613 get index() { 3614 return this.g15.get(); 3615 } 3616 3617 set index(newValue) { 3618 this.g15.set(newValue); 3619 } 3620 3621 get lastIndex() { 3622 return this.h15.get(); 3623 } 3624 3625 set lastIndex(newValue) { 3626 this.h15.set(newValue); 3627 } 3628 3629 get count() { 3630 return this.i15.get(); 3631 } 3632 3633 set count(newValue) { 3634 this.i15.set(newValue); 3635 } 3636 3637 get followingSystemFontScale() { 3638 return this.r7.get(); 3639 } 3640 3641 set followingSystemFontScale(newValue) { 3642 this.r7.set(newValue); 3643 } 3644 3645 get maxAppFontScale() { 3646 return this.s7.get(); 3647 } 3648 3649 set maxAppFontScale(newValue) { 3650 this.s7.set(newValue); 3651 } 3652 3653 get treeViewTheme() { 3654 return this.u7.get(); 3655 } 3656 3657 set treeViewTheme(newValue) { 3658 this.u7.set(newValue); 3659 } 3660 3661 aboutToAppear() { 3662 if (this.item.k6().v3) { 3663 this.item.j4 = this.item.k6().v3?.source; 3664 } 3665 let j7 = this.getUIContext(); 3666 this.followingSystemFontScale = j7.isFollowingSystemFontScale(); 3667 this.maxAppFontScale = j7.getMaxFontScale(); 3668 } 3669 3670 decideFontScale() { 3671 let h7 = this.getUIContext(); 3672 let i7 = h7.getHostContext()?.config?.fontSizeScale ?? 1; 3673 if (!this.followingSystemFontScale) { 3674 return 1; 3675 } 3676 return Math.min(i7, this.maxAppFontScale, q1); 3677 } 3678 3679 getInputTextMaxFontSize() { 3680 let g7 = this.decideFontScale() * this.inputFontSize + 'vp'; 3681 return g7; 3682 } 3683 3684 getLeftIconColor() { 3685 if (this.item.i7()) { 3686 return { 3687 'id': -1, 3688 'type': 10001, 3689 params: ['sys.color.icon_on_primary'], 3690 'bundleName': '__harDefaultBundleName__', 3691 'moduleName': '__harDefaultModuleName__', 3692 }; 3693 } else if (this.item.s6()) { 3694 return this.treeViewTheme.h4; 3695 } else { 3696 return this.treeViewTheme.g4; 3697 } 3698 } 3699 3700 checkInvalidPattern(title) { 3701 return new RegExp('/[\\\/:*?"<>|]/').test(title); 3702 } 3703 3704 checkIsAllCN(title) { 3705 return new RegExp('/^[\u4e00-\u9fa5]+$/').test(title); 3706 } 3707 3708 popupForShowTitle(text, backgroundColor, fontColor, parent = null) { 3709 this.observeComponentCreation2((elmtId, isInitialRender) => { 3710 Row.create(); 3711 Row.backgroundColor(backgroundColor); 3712 Row.border({ 3713 radius: { 3714 'id': -1, 3715 'type': 10002, 3716 params: ['sys.float.ohos_id_elements_margin_horizontal_l'], 3717 'bundleName': '__harDefaultBundleName__', 3718 'moduleName': '__harDefaultModuleName__', 3719 } 3720 }); 3721 Row.padding({ 3722 left: { 3723 'id': -1, 3724 'type': 10002, 3725 params: ['sys.float.ohos_id_elements_margin_horizontal_l'], 3726 'bundleName': '__harDefaultBundleName__', 3727 'moduleName': '__harDefaultModuleName__', 3728 }, 3729 right: { 3730 'id': -1, 3731 'type': 10002, 3732 params: ['sys.float.ohos_id_elements_margin_horizontal_l'], 3733 'bundleName': '__harDefaultBundleName__', 3734 'moduleName': '__harDefaultModuleName__', 3735 }, 3736 top: { 3737 'id': -1, 3738 'type': 10002, 3739 params: ['sys.float.ohos_id_card_margin_middle'], 3740 'bundleName': '__harDefaultBundleName__', 3741 'moduleName': '__harDefaultModuleName__', 3742 }, 3743 bottom: { 3744 'id': -1, 3745 'type': 10002, 3746 params: ['sys.float.ohos_id_card_margin_middle'], 3747 'bundleName': '__harDefaultBundleName__', 3748 'moduleName': '__harDefaultModuleName__', 3749 }, 3750 }); 3751 }, Row); 3752 this.observeComponentCreation2((elmtId, isInitialRender) => { 3753 Text.create(text); 3754 Text.fontSize({ 3755 'id': -1, 3756 'type': 10002, 3757 params: ['sys.float.ohos_id_text_size_body2'], 3758 'bundleName': '__harDefaultBundleName__', 3759 'moduleName': '__harDefaultModuleName__', 3760 }); 3761 Text.fontWeight('regular'); 3762 Text.fontColor(fontColor); 3763 Text.minFontScale(o1); 3764 Text.maxFontScale(this.decideFontScale()); 3765 }, Text); 3766 Text.pop(); 3767 Row.pop(); 3768 } 3769 3770 builder(parent = null) { 3771 this.observeComponentCreation2((elmtId, isInitialRender) => { 3772 If.create(); 3773 if (this.listTreeViewMenu) { 3774 this.ifElseBranchUpdateFunction(0, () => { 3775 this.listTreeViewMenu.bind(this)(); 3776 }); 3777 } else { 3778 this.ifElseBranchUpdateFunction(1, () => { 3779 }); 3780 } 3781 }, If); 3782 If.pop(); 3783 } 3784 3785 initialRender() { 3786 this.observeComponentCreation2((elmtId, isInitialRender) => { 3787 If.create(); 3788 if (this.item.j6()) { 3789 this.ifElseBranchUpdateFunction(0, () => { 3790 this.observeComponentCreation2((elmtId, isInitialRender) => { 3791 Stack.create(); 3792 ViewStackProcessor.visualState('focused'); 3793 Stack.border({ 3794 radius: { 3795 'id': -1, 3796 'type': 10002, 3797 params: ['sys.float.ohos_id_corner_radius_clicked'], 3798 'bundleName': '__harDefaultBundleName__', 3799 'moduleName': '__harDefaultModuleName__', 3800 }, 3801 width: l1, 3802 color: this.treeViewTheme.f4, 3803 style: BorderStyle.Solid, 3804 }); 3805 ViewStackProcessor.visualState('normal'); 3806 Stack.border({ 3807 radius: { 3808 'id': -1, 3809 'type': 10002, 3810 params: ['sys.float.ohos_id_corner_radius_clicked'], 3811 'bundleName': '__harDefaultBundleName__', 3812 'moduleName': '__harDefaultModuleName__', 3813 }, 3814 width: 0, 3815 }); 3816 ViewStackProcessor.visualState(); 3817 }, Stack); 3818 this.observeComponentCreation2((elmtId, isInitialRender) => { 3819 Column.create(); 3820 Column.opacity(this.listNodeDataSource.y13(ObservedObject.GetRawObject(this.item))); 3821 Column.onHover((isHover) => { 3822 if (isHover) { 3823 this.item.a6(this.treeViewTheme.e4); 3824 } else { 3825 this.item.a6({ 3826 'id': -1, 3827 'type': 10001, 3828 params: ['sys.color.ohos_id_color_background_transparent'], 3829 'bundleName': '__harDefaultBundleName__', 3830 'moduleName': '__harDefaultModuleName__', 3831 }); 3832 } 3833 }); 3834 Column.onTouch((event) => { 3835 this.count++; 3836 if (this.count > 1) { 3837 this.count--; 3838 return; 3839 } 3840 this.index = this.listNodeDataSource.findIndex(this.item.e6()); 3841 this.listNodeDataSource.h9(this.index); 3842 let z6 = this.item.e6(); 3843 if (event.type === TouchType.Down) { 3844 this.item.a6(this.treeViewTheme.d4); 3845 } else if (event.type === TouchType.Up) { 3846 if (!(typeof this.treeViewTheme.z3 === 'string')) { 3847 this.item.a6(b2); 3848 } else { 3849 this.item.a6(this.treeViewTheme.z3); 3850 } 3851 if (this.item.k6().v3 !== null) { 3852 this.item.k6().v3?.i8(a3.SELECTED); 3853 this.listNodeDataSource.i8(this.index, a3.SELECTED); 3854 this.item.j4 = this.item.k6().v3?.source; 3855 } 3856 this.item.k6().w3?.j8(true); 3857 let a7 = { currentNodeId: z6 }; 3858 this.appEventBus.emit(TreeListenType.NODE_CLICK, a7); 3859 } 3860 if (this.listNodeDataSource.u9() !== -1 && this.index !== this.listNodeDataSource.u9()) { 3861 this.listNodeDataSource.v9(u2.WARNINGS, v2.NONE, false, this.listNodeDataSource.u9()); 3862 this.listNodeDataSource.w9(this.listNodeDataSource.u9(), t2.COMMIT_NODE); 3863 } 3864 this.lastIndex = this.index; 3865 this.count--; 3866 }); 3867 Column.backgroundColor((this.item.k6().w3 && this.item.k6().inputText && 3868 this.item.x5()) ? this.item.k6().inputText?.j15 : this.item.b6()); 3869 Column.border({ 3870 width: this.item.m6().borderWidth, 3871 color: this.item.m6().borderColor, 3872 radius: this.item.m6().borderRadius, 3873 }); 3874 Column.height(i1); 3875 Column.focusable(true); 3876 Column.onMouse((event) => { 3877 let y6 = this.listNodeDataSource.findIndex(this.item.e6()); 3878 if (event.button === MouseButton.Right) { 3879 this.listNodeDataSource.i9(Event.MOUSE_BUTTON_RIGHT, 3880 this.listNodeDataSource.findIndex(this.item.e6())); 3881 this.listTreeViewMenu = this.item.q6(); 3882 this.listNodeDataSource.h9(y6); 3883 clearTimeout(this.item.k6().w3?.u13); 3884 } 3885 event.stopPropagation(); 3886 }); 3887 Column.padding({ top: 0, bottom: 0 }); 3888 Column.bindPopup(this.item.q5().u4, { 3889 builder: { 3890 builder: () => { 3891 this.popupForShowTitle.call(this, this.item.q5().x4, this.item.q5().w4, 3892 this.item.q5().y4); 3893 } 3894 }, 3895 placement: Placement.BottomLeft, 3896 placementOnTop: false, 3897 popupColor: this.item.q5().w4, 3898 autoCancel: true, 3899 enableArrow: this.item.q5().v4 3900 }); 3901 Column.onAreaChange((oldValue, newValue) => { 3902 let x6 = Number.parseInt(newValue.width.toString()); 3903 this.columnWidth = x6; 3904 }); 3905 }, Column); 3906 this.observeComponentCreation2((elmtId, isInitialRender) => { 3907 Stack.create({ alignContent: Alignment.Bottom }); 3908 Stack.focusable(true); 3909 }, Stack); 3910 this.observeComponentCreation2((elmtId, isInitialRender) => { 3911 Divider.create(); 3912 Divider.height(this.listNodeDataSource.o14().g12); 3913 Divider.color(this.listNodeDataSource.o14().h12); 3914 Divider.visibility(this.listNodeDataSource.p14(ObservedObject.GetRawObject(this.item))); 3915 Divider.lineCap(LineCapStyle.Round); 3916 Divider.margin({ start: LengthMetrics.vp(this.item.z6()) }); 3917 Divider.focusable(true); 3918 }, Divider); 3919 this.observeComponentCreation2((elmtId, isInitialRender) => { 3920 Row.create({}); 3921 Row.focusable(true); 3922 Row.width('100%'); 3923 Gesture.create(GesturePriority.Low); 3924 TapGesture.create({ count: 2 }); 3925 TapGesture.onAction((event) => { 3926 this.listNodeDataSource.k9(this.listNodeDataSource.findIndex(this.item.e6())); 3927 }); 3928 TapGesture.pop(); 3929 Gesture.pop(); 3930 Row.height(this.item.h6()); 3931 Row.padding({ start: LengthMetrics.vp(this.item.g6()) }); 3932 Row.bindContextMenu({ builder: this.builder.bind(this) }, ResponseType.RightClick); 3933 }, Row); 3934 this.observeComponentCreation2((elmtId, isInitialRender) => { 3935 If.create(); 3936 if (this.item.k6().v3) { 3937 this.ifElseBranchUpdateFunction(0, () => { 3938 this.observeComponentCreation2((elmtId, isInitialRender) => { 3939 Row.create(); 3940 Row.focusable(true); 3941 Row.backgroundColor(a2); 3942 Row.margin({ 3943 end: o(this.item.k6().v3?.z7) 3944 }); 3945 Row.height(this.item.k6().v3?.itemHeight); 3946 Row.width(this.item.k6().v3?.itemWidth); 3947 }, Row); 3948 this.observeComponentCreation2((elmtId, isInitialRender) => { 3949 Image.create(this.item.j4); 3950 Image.objectFit(ImageFit.Contain); 3951 Image.height(this.item.k6().v3?.itemHeight); 3952 Image.width(this.item.k6().v3?.itemWidth); 3953 Image.opacity(!this.item.s6() && !this.item.g7() ? 3954 this.item.k6().v3?.opacity : this.item.k6().v3?.k15); 3955 Image.focusable(this.item.k6().w3 !== null ? false : true); 3956 Image.fillColor(this.getLeftIconColor()); 3957 Image.matchTextDirection((this.item.k6().x3?.c8 === ARROW_RIGHT || 3958 this.item.k6().x3?.c8 === s2) ? true : false); 3959 }, Image); 3960 Row.pop(); 3961 }); 3962 } else { 3963 this.ifElseBranchUpdateFunction(1, () => { 3964 }); 3965 } 3966 }, If); 3967 If.pop(); 3968 this.observeComponentCreation2((elmtId, isInitialRender) => { 3969 Row.create(); 3970 Row.layoutWeight(1); 3971 Row.focusable(true); 3972 }, Row); 3973 this.observeComponentCreation2((elmtId, isInitialRender) => { 3974 If.create(); 3975 if (this.item.k6().w3 && this.item.w5()) { 3976 this.ifElseBranchUpdateFunction(0, () => { 3977 this.observeComponentCreation2((elmtId, isInitialRender) => { 3978 Text.create(this.item.k6().w3?.title); 3979 Text.minFontScale(o1); 3980 Text.maxFontScale(this.decideFontScale()); 3981 Text.maxLines(1); 3982 Text.fontSize(this.item.k6().w3?.size); 3983 Text.fontColor(this.item.s6() ? 3984 this.treeViewTheme.c4 : this.treeViewTheme.a4); 3985 Text.margin({ 3986 end: o(this.item.k6().w3?.z7) 3987 }); 3988 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 3989 Text.fontWeight(this.item.k6().w3?.weight); 3990 Text.focusable(true); 3991 }, Text); 3992 Text.pop(); 3993 }); 3994 } else { 3995 this.ifElseBranchUpdateFunction(1, () => { 3996 }); 3997 } 3998 }, If); 3999 If.pop(); 4000 this.observeComponentCreation2((elmtId, isInitialRender) => { 4001 If.create(); 4002 if (this.item.k6().w3 && this.item.k6().inputText && 4003 this.item.x5()) { 4004 this.ifElseBranchUpdateFunction(0, () => { 4005 this.observeComponentCreation2((elmtId, isInitialRender) => { 4006 Row.create(); 4007 Row.backgroundColor(this.item.k6().inputText?.backgroundColor); 4008 Row.borderRadius(this.item.k6().inputText?.borderRadius); 4009 Row.margin({ 4010 end: o(this.item.k6() 4011 .inputText?.z7) 4012 }); 4013 }, Row); 4014 this.observeComponentCreation2((elmtId, isInitialRender) => { 4015 TextInput.create({ text: this.item.k6().w3?.title }); 4016 TextInput.height(this.item.k6().inputText?.itemHeight); 4017 TextInput.fontSize(this.getInputTextMaxFontSize()); 4018 TextInput.fontColor(this.item.k6().inputText?.color); 4019 TextInput.borderRadius(this.item.k6().inputText?.borderRadius); 4020 TextInput.backgroundColor(this.item.k6().inputText?.backgroundColor); 4021 TextInput.enterKeyType(EnterKeyType.Done); 4022 TextInput.focusable(true); 4023 TextInput.padding({ 4024 start: LengthMetrics.resource(this.textInputPadding.left), 4025 end: LengthMetrics.resource(this.textInputPadding.right), 4026 top: LengthMetrics.resource(this.textInputPadding.top), 4027 bottom: LengthMetrics.resource(this.textInputPadding.bottom), 4028 }); 4029 TextInput.onChange((value) => { 4030 let g6 = this.listNodeDataSource.findIndex(this.item.e6()); 4031 let h6 = ''; 4032 let i6 = false; 4033 let j6 = false; 4034 if (this.checkInvalidPattern(value)) { 4035 for (let k6 = 0; k6 < value.length; k6++) { 4036 if (!this.checkInvalidPattern(value[k6])) { 4037 h6 += value[k6]; 4038 } 4039 } 4040 i6 = true; 4041 this.listNodeDataSource.v9(u2.WARNINGS, v2.INVALID_ERROR, true, g6); 4042 } else { 4043 h6 = value; 4044 i6 = false; 4045 } 4046 if ((this.checkIsAllCN(h6) && h6.length > this.MAX_CN_LENGTH) || 4047 (!this.checkIsAllCN(h6) && h6.length > this.MAX_EN_LENGTH)) { 4048 h6 = this.checkIsAllCN(h6) ? 4049 h6.substr(0, this.MAX_CN_LENGTH) : h6.substr(0, this.MAX_EN_LENGTH); 4050 j6 = true; 4051 this.listNodeDataSource.v9(u2.WARNINGS, v2.LENGTH_ERROR, true, g6); 4052 } else { 4053 j6 = false; 4054 } 4055 if (!j6 && !i6) { 4056 this.listNodeDataSource.v13(g6, h6); 4057 } 4058 }); 4059 TextInput.onSubmit((enterKey) => { 4060 let f6 = this.listNodeDataSource.findIndex(this.item.e6()); 4061 this.listNodeDataSource.v9(u2.WARNINGS, v2.NONE, false, f6); 4062 this.listNodeDataSource.w9(f6, t2.COMMIT_NODE); 4063 }); 4064 }, TextInput); 4065 Row.pop(); 4066 }); 4067 } else { 4068 this.ifElseBranchUpdateFunction(1, () => { 4069 }); 4070 } 4071 }, If); 4072 If.pop(); 4073 this.observeComponentCreation2((elmtId, isInitialRender) => { 4074 Blank.create(); 4075 }, Blank); 4076 Blank.pop(); 4077 Row.pop(); 4078 this.observeComponentCreation2((elmtId, isInitialRender) => { 4079 If.create(); 4080 if (this.listNodeDataSource.f14(this.item.e6())) { 4081 this.ifElseBranchUpdateFunction(0, () => { 4082 this.observeComponentCreation2((elmtId, isInitialRender) => { 4083 Row.create(); 4084 Row.focusable(true); 4085 Row.margin({ 4086 start: LengthMetrics.resource(this.listNodeDataSource.q14().margin.left), 4087 end: this.item.k6().x3 ? 4088 LengthMetrics.resource({ 4089 'id': -1, 4090 'type': 10002, 4091 params: ['sys.float.padding_level0'], 4092 'bundleName': '__harDefaultBundleName__', 4093 'moduleName': '__harDefaultModuleName__', 4094 }) : LengthMetrics.resource(this.listNodeDataSource.q14().margin.right) 4095 }); 4096 }, Row); 4097 this.observeComponentCreation2((elmtId, isInitialRender) => { 4098 Text.create(this.listNodeDataSource.e14(this.item.e6())); 4099 Text.minFontScale(o1); 4100 Text.maxFontScale(this.decideFontScale()); 4101 Text.fontSize(this.listNodeDataSource.q14().fontSize); 4102 Text.fontColor(this.item.g7() || this.item.i7() ? { 4103 'id': -1, 4104 'type': 10001, 4105 params: ['sys.color.ohos_id_color_primary_contrary'], 4106 'bundleName': '__harDefaultBundleName__', 4107 'moduleName': '__harDefaultModuleName__', 4108 } : this.treeViewTheme.b4); 4109 Text.fontWeight(this.listNodeDataSource.q14().fontWeight); 4110 }, Text); 4111 Text.pop(); 4112 Row.pop(); 4113 }); 4114 } else { 4115 this.ifElseBranchUpdateFunction(1, () => { 4116 }); 4117 } 4118 }, If); 4119 If.pop(); 4120 this.observeComponentCreation2((elmtId, isInitialRender) => { 4121 If.create(); 4122 if (this.item.k6().x3) { 4123 this.ifElseBranchUpdateFunction(0, () => { 4124 this.observeComponentCreation2((elmtId, isInitialRender) => { 4125 Row.create(); 4126 Row.focusable(true); 4127 Row.height(this.item.k6().x3?.itemHeight); 4128 Row.width(this.item.k6().x3?.itemWidth); 4129 }, Row); 4130 this.observeComponentCreation2((elmtId, isInitialRender) => { 4131 Image.create(this.item.k6().x3?.c8); 4132 Image.fillColor(this.item.k6().x3?.y12 ? 4133 this.treeViewTheme.i4 : z1); 4134 Image.align(Alignment.End); 4135 Image.objectFit(ImageFit.Contain); 4136 Image.height(this.item.k6().x3?.itemHeight); 4137 Image.width(this.item.k6().x3?.itemWidth); 4138 Image.opacity(!this.item.g7() ? 4139 this.item.k6().x3?.opacity : this.item.k6().x3?.k15); 4140 Image.onTouch((event) => { 4141 if (event.type === TouchType.Down) { 4142 this.listNodeDataSource.k9(this.listNodeDataSource.findIndex(this.item.e6())); 4143 this.listNodeDataSource.s14(this.item.e6()); 4144 } 4145 event.stopPropagation(); 4146 }); 4147 Image.focusable(true); 4148 Image.matchTextDirection((this.item.k6().x3?.c8 === ARROW_RIGHT || 4149 this.item.k6().x3?.c8 === s2) ? true : false); 4150 }, Image); 4151 Row.pop(); 4152 }); 4153 } else { 4154 this.ifElseBranchUpdateFunction(1, () => { 4155 }); 4156 } 4157 }, If); 4158 If.pop(); 4159 Row.pop(); 4160 Stack.pop(); 4161 Column.pop(); 4162 Stack.pop(); 4163 }); 4164 } else { 4165 this.ifElseBranchUpdateFunction(1, () => { 4166 }); 4167 } 4168 }, If); 4169 If.pop(); 4170 } 4171 4172 rerender() { 4173 this.updateDirtyElements(); 4174 } 4175} 4176 4177export class j3 { 4178 constructor(nodeParam) { 4179 this.currentNodeId = nodeParam.currentNodeId ?? -1; 4180 this.parentNodeId = nodeParam.parentNodeId ?? -1; 4181 this.isFolder = nodeParam.isFolder; 4182 this.b5 = -1; 4183 this.y14 = -1; 4184 this.p6 = { a13: false, b13: 0, r10: 0 }; 4185 this.children = []; 4186 } 4187 4188 o6() { 4189 return this.p6; 4190 } 4191 4192 f13() { 4193 return this.currentNodeId; 4194 } 4195 4196 v6() { 4197 return this.isFolder; 4198 } 4199} 4200 4201class l3 { 4202 constructor() { 4203 this.rightMargin = -1; 4204 this.width = -1; 4205 this.height = -1; 4206 } 4207 4208 set itemWidth(width) { 4209 this.width = width; 4210 } 4211 4212 get itemWidth() { 4213 return this.width; 4214 } 4215 4216 set itemHeight(height) { 4217 this.height = height; 4218 } 4219 4220 get itemHeight() { 4221 return this.height; 4222 } 4223 4224 set z7(rightMargin) { 4225 this.rightMargin = rightMargin; 4226 } 4227 4228 get z7() { 4229 return this.rightMargin; 4230 } 4231} 4232 4233export class m3 extends l3 { 4234 constructor(w4, x4, itemWidth, itemHeight, y4, z4, a5) { 4235 super(); 4236 this.rightMargin = { 4237 'id': -1, 4238 'type': 10002, 4239 params: ['sys.float.ohos_id_elements_margin_horizontal_m'], 4240 'bundleName': '__harDefaultBundleName__', 4241 'moduleName': '__harDefaultModuleName__', 4242 }; 4243 this.j4 = w4; 4244 this.rightMargin = y4; 4245 this.b8 = x4; 4246 this.itemWidth = itemWidth; 4247 this.itemHeight = itemHeight; 4248 this.l15 = w4; 4249 this.m15 = z4; 4250 this.n15 = a5; 4251 } 4252 4253 get source() { 4254 return this.j4; 4255 } 4256 4257 get opacity() { 4258 return this.b8; 4259 } 4260 4261 get k15() { 4262 return 1; 4263 } 4264 4265 get c8() { 4266 return this.l15; 4267 } 4268 4269 get y12() { 4270 return this.m15; 4271 } 4272 4273 get type() { 4274 return this.n15; 4275 } 4276} 4277 4278class n3 { 4279 constructor() { 4280 } 4281 4282 static getInstance() { 4283 if (!n3.instance) { 4284 n3.instance = new n3(); 4285 } 4286 return n3.instance; 4287 } 4288 4289 o15(type) { 4290 let v4; 4291 switch (type) { 4292 case b3.ARROW_RIGHT_WHITE: 4293 v4 = s2; 4294 break; 4295 case b3.ARROW_RIGHT: 4296 v4 = ARROW_RIGHT; 4297 break; 4298 case b3.ARROW_DOWN_WHITE: 4299 v4 = q2; 4300 break; 4301 default: 4302 v4 = ARROW_DOWN; 4303 } 4304 return new m3(v4, { 4305 'id': -1, 4306 'type': 10002, 4307 params: ['sys.float.ohos_id_alpha_content_tertiary'], 4308 'bundleName': '__harDefaultBundleName__', 4309 'moduleName': '__harDefaultModuleName__', 4310 }, u, a1, { 4311 'id': -1, 4312 'type': 10002, 4313 params: ['sys.float.ohos_id_text_paragraph_margin_xs'], 4314 'bundleName': '__harDefaultBundleName__', 4315 'moduleName': '__harDefaultModuleName__', 4316 }, (type === b3.ARROW_RIGHT_WHITE || type === b3.ARROW_DOWN_WHITE) ? false : true, type); 4317 } 4318} 4319 4320class q3 { 4321 static n5(type) { 4322 let node = q3.p15.get(type); 4323 if (node === undefined) { 4324 node = n3.getInstance().o15(type); 4325 q3.p15.set(type, node); 4326 } 4327 return node; 4328 } 4329 4330 static t12(s4, t4, u4) { 4331 if (u4 === undefined) { 4332 return undefined; 4333 } 4334 let type = u4; 4335 if (s4 == a3.EDIT || 4336 s4 === a3.DRAG_INSERT) { 4337 if (t4 === z2.COLLAPSE) { 4338 type = b3.ARROW_RIGHT_WHITE; 4339 } else { 4340 type = b3.ARROW_DOWN_WHITE; 4341 } 4342 } else if (s4 === a3.FINISH_EDIT || 4343 s4 === a3.FINISH_DRAG_INSERT) { 4344 if (t4 === z2.COLLAPSE) { 4345 type = b3.ARROW_RIGHT; 4346 } else { 4347 type = b3.ARROW_DOWN; 4348 } 4349 } 4350 return q3.n5(type); 4351 } 4352 4353 static x12(q4, r4) { 4354 if (r4 === undefined) { 4355 return undefined; 4356 } 4357 let type; 4358 if (!r4) { 4359 if (q4 === z2.COLLAPSE) { 4360 type = b3.ARROW_RIGHT_WHITE; 4361 } else { 4362 type = b3.ARROW_DOWN_WHITE; 4363 } 4364 } else { 4365 if (q4 === z2.COLLAPSE) { 4366 type = b3.ARROW_RIGHT; 4367 } else { 4368 type = b3.ARROW_DOWN; 4369 } 4370 } 4371 return q3.n5(type); 4372 } 4373} 4374 4375q3.p15 = new Map(); 4376 4377export class r3 extends l3 { 4378 constructor(m4, n4, itemWidth, itemHeight, o4, p4) { 4379 super(); 4380 this.rightMargin = { 4381 'id': -1, 4382 'type': 10002, 4383 params: ['sys.float.ohos_id_elements_margin_horizontal_m'], 4384 'bundleName': '__harDefaultBundleName__', 4385 'moduleName': '__harDefaultModuleName__', 4386 }; 4387 this.j4 = m4; 4388 this.q15 = m4; 4389 if (o4 !== undefined) { 4390 this.r15 = o4; 4391 } else { 4392 this.r15 = this.q15; 4393 } 4394 if (p4 !== undefined) { 4395 this.s15 = p4; 4396 } else { 4397 this.s15 = this.q15; 4398 } 4399 this.b8 = n4; 4400 this.itemWidth = itemWidth; 4401 this.itemHeight = itemHeight; 4402 this.l15 = m4; 4403 this.t15 = ARROW_DOWN; 4404 this.u15 = ARROW_RIGHT; 4405 this.m15 = true; 4406 this.v15 = a3.NORMAL; 4407 } 4408 4409 get source() { 4410 return this.j4; 4411 } 4412 4413 get a8() { 4414 return this.q15; 4415 } 4416 4417 get r13() { 4418 return this.r15; 4419 } 4420 4421 get s13() { 4422 return this.s15; 4423 } 4424 4425 get opacity() { 4426 return this.b8; 4427 } 4428 4429 get k15() { 4430 return 1; 4431 } 4432 4433 get c8() { 4434 return this.l15; 4435 } 4436 4437 get y12() { 4438 return this.m15; 4439 } 4440 4441 x12(l4) { 4442 if (l4 === z2.EXPAND) { 4443 this.l15 = this.t15; 4444 } else if (l4 === z2.COLLAPSE) { 4445 this.l15 = this.u15; 4446 } 4447 } 4448 4449 s12(j4, k4) { 4450 if (j4 === a3.EDIT || j4 === a3.DRAG_INSERT) { 4451 this.t15 = q2; 4452 this.u15 = s2; 4453 this.m15 = false; 4454 } else if (j4 === a3.FINISH_EDIT || 4455 j4 === a3.FINISH_DRAG_INSERT) { 4456 this.t15 = ARROW_DOWN; 4457 this.u15 = ARROW_RIGHT; 4458 this.m15 = true; 4459 } 4460 this.l15 = (k4 === z2.COLLAPSE) ? 4461 this.u15 : this.t15; 4462 } 4463 4464 i8(i4) { 4465 switch (i4) { 4466 case a3.NORMAL: 4467 this.j4 = this.q15; 4468 this.v15 = i4; 4469 break; 4470 case a3.SELECTED: 4471 if (this.v15 !== a3.EDIT) { 4472 this.j4 = this.r15; 4473 this.v15 = i4; 4474 } 4475 break; 4476 case a3.EDIT: 4477 this.j4 = this.s15; 4478 this.v15 = i4; 4479 break; 4480 case a3.FINISH_EDIT: 4481 this.j4 = this.r15; 4482 this.v15 = i4; 4483 break; 4484 case a3.DRAG_INSERT: 4485 this.j4 = this.s15; 4486 this.v15 = i4; 4487 break; 4488 case a3.FINISH_DRAG_INSERT: 4489 this.j4 = this.q15; 4490 this.v15 = i4; 4491 break; 4492 default: 4493 break; 4494 } 4495 } 4496} 4497 4498class s3 extends l3 { 4499 constructor(h4) { 4500 super(); 4501 this.treeViewTheme = e3.getInstance(); 4502 this.w15 = h4; 4503 this.itemWidth = b1; 4504 this.itemHeight = c1; 4505 this.rightMargin = { 4506 'id': -1, 4507 'type': 10002, 4508 params: ['sys.float.ohos_id_text_paragraph_margin_xs'], 4509 'bundleName': '__harDefaultBundleName__', 4510 'moduleName': '__harDefaultModuleName__', 4511 }; 4512 this.x15 = { 4513 fontColor: this.treeViewTheme.a4, 4514 fontSize: { 4515 'id': -1, 4516 'type': 10002, 4517 params: ['sys.float.ohos_id_text_size_body1'], 4518 'bundleName': '__harDefaultBundleName__', 4519 'moduleName': '__harDefaultModuleName__', 4520 }, 4521 fontWeight: FontWeight.Normal, 4522 }; 4523 this.y15 = 0; 4524 } 4525 4526 j8(isSelected) { 4527 if (isSelected) { 4528 this.x15 = { 4529 fontColor: this.treeViewTheme.c4, 4530 fontSize: { 4531 'id': -1, 4532 'type': 10002, 4533 params: ['sys.float.ohos_id_text_size_body1'], 4534 'bundleName': '__harDefaultBundleName__', 4535 'moduleName': '__harDefaultModuleName__', 4536 }, 4537 fontWeight: FontWeight.Regular, 4538 }; 4539 } else { 4540 this.x15 = { 4541 fontColor: this.treeViewTheme.a4, 4542 fontSize: { 4543 'id': -1, 4544 'type': 10002, 4545 params: ['sys.float.ohos_id_text_size_body1'], 4546 'bundleName': '__harDefaultBundleName__', 4547 'moduleName': '__harDefaultModuleName__', 4548 }, 4549 fontWeight: FontWeight.Normal, 4550 }; 4551 } 4552 } 4553 4554 set title(text) { 4555 this.w15 = text; 4556 } 4557 4558 get title() { 4559 return this.w15; 4560 } 4561 4562 set u13(g4) { 4563 this.y15 = g4; 4564 } 4565 4566 get u13() { 4567 return this.y15; 4568 } 4569 4570 get color() { 4571 return this.x15.fontColor; 4572 } 4573 4574 get size() { 4575 return this.x15.fontSize; 4576 } 4577 4578 get weight() { 4579 return this.x15.fontWeight; 4580 } 4581 4582 q9(f4) { 4583 if (f4) { 4584 this.x15 = { 4585 fontColor: this.treeViewTheme.c4, 4586 fontSize: { 4587 'id': -1, 4588 'type': 10002, 4589 params: ['sys.float.ohos_id_text_size_body1'], 4590 'bundleName': '__harDefaultBundleName__', 4591 'moduleName': '__harDefaultModuleName__', 4592 }, 4593 fontWeight: FontWeight.Regular, 4594 }; 4595 } else { 4596 this.x15 = { 4597 fontColor: this.treeViewTheme.a4, 4598 fontSize: { 4599 'id': -1, 4600 'type': 10002, 4601 params: ['sys.float.ohos_id_text_size_body1'], 4602 'bundleName': '__harDefaultBundleName__', 4603 'moduleName': '__harDefaultModuleName__', 4604 }, 4605 fontWeight: FontWeight.Normal, 4606 }; 4607 } 4608 } 4609} 4610 4611export class t3 extends l3 { 4612 constructor() { 4613 super(); 4614 this.status = undefined; 4615 this.z15 = { 4616 'id': -1, 4617 'type': 10001, 4618 params: ['sys.color.ohos_id_color_background'], 4619 'bundleName': '__harDefaultBundleName__', 4620 'moduleName': '__harDefaultModuleName__', 4621 }; 4622 this.a16 = { 4623 'id': -1, 4624 'type': 10001, 4625 params: ['sys.color.ohos_id_color_emphasize'], 4626 'bundleName': '__harDefaultBundleName__', 4627 'moduleName': '__harDefaultModuleName__', 4628 }; 4629 this.radius = { 4630 'id': -1, 4631 'type': 10002, 4632 params: ['sys.float.ohos_id_corner_radius_default_xs'], 4633 'bundleName': '__harDefaultBundleName__', 4634 'moduleName': '__harDefaultModuleName__', 4635 }; 4636 this.treeViewTheme = e3.getInstance(); 4637 this.itemWidth = b1; 4638 this.itemHeight = d1; 4639 this.rightMargin = { 4640 'id': -1, 4641 'type': 10002, 4642 params: ['sys.float.ohos_id_text_paragraph_margin_xs'], 4643 'bundleName': '__harDefaultBundleName__', 4644 'moduleName': '__harDefaultModuleName__', 4645 }; 4646 this.b16 = { 4647 fontColor: this.treeViewTheme.a4, 4648 fontSize: { 4649 'id': -1, 4650 'type': 10002, 4651 params: ['sys.float.ohos_id_text_size_body1'], 4652 'bundleName': '__harDefaultBundleName__', 4653 'moduleName': '__harDefaultModuleName__', 4654 }, 4655 fontWeight: FontWeight.Normal, 4656 }; 4657 } 4658 4659 get color() { 4660 return this.b16.fontColor; 4661 } 4662 4663 get size() { 4664 return this.b16.fontSize; 4665 } 4666 4667 get weight() { 4668 return this.b16.fontWeight; 4669 } 4670 4671 get borderRadius() { 4672 return this.radius; 4673 } 4674 4675 get backgroundColor() { 4676 return this.z15; 4677 } 4678 4679 get j15() { 4680 return this.a16; 4681 } 4682 4683 get c16() { 4684 return this.status; 4685 } 4686} 4687 4688function o(e4) { 4689 if (!e4) { 4690 return LengthMetrics.vp(0); 4691 } else if (typeof e4 === 'number') { 4692 return LengthMetrics.vp(e4); 4693 } else { 4694 return LengthMetrics.resource(e4); 4695 } 4696} 4697 4698export default { 4699 TreeController, 4700 TreeListener, 4701 TreeListenerManager, 4702 TreeListenType, 4703 TreeView, 4704}