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