1/* 2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16var __decorate = this && this.__decorate || function(e, t, o, i) { 17 var s, r = arguments.length, 18 n = r < 3 ? t : null === i ? i = Object.getOwnPropertyDescriptor(t, o) : i; 19 if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(e, t, o, i); 20 else 21 for (var c = e.length - 1; c >= 0; c--)(s = e[c]) && (n = (r < 3 ? s(n) : r > 3 ? s(t, o, n) : s(t, o)) || n); 22 return r > 3 && n && Object.defineProperty(t, o, n), n 23}; 24const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 25const PUBLIC_MORE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABEZJREFUeNrt3D1rFFEUBuAxhmAhFlYpUohYiYWFRcAmKAhWK2pjo1iKf8BCMIKFf8BarCyMhVj4VZhGSKEg2FqJyCKWIhYWnstMINgYsh+cmfs88BICydxw7jmzu2HvNg0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADBN+3r6dx+LXIqsRpa7FF8j48hm5Fn3Peo9mAEYRdYjJ3f582Vj7nZfUe/eDsCRyMPI2h5/fyNyI/JDT6v3Tvt7sBllE15ETkxwjeORi5G3ke/6W737MgBnI68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hftlx1TWjR4ZICqPVcE1q0XloA96rBa7XQhl5pAWzFXKm8i8vo9WMeN3VnnQa/sO8xL2POxEy7Toxo+RdjNpu6w1F9HuBqNXi99lw1eKMM9utHzIeYV8MftbccCQAAAAAAsBdt/XLc+sPy9W+MmPqL+1iJuVA1+C4gdFr6d77FvK0GH2nb739lPR5zNuZ51eBnQhFAJQIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE8M8jmBlGgABSRnAqZiXms+MUQNYIDnkUKMu4I/gj6zELMRv7/PsnHKEAMkcw6fgEkDmCNUcngMwRvHFsngRnfWJcL/9tRyaAgxrB+ZijO9ymH7MUs+m4yjLmCBozEXMr5nr1+9We1ZgXMXccDwAAAAAAAAAAAAAAAAAAAAAAwO5+AfVgtqHKRnawAAAAAElFTkSuQmCC"; 27export class SelectTitleBar extends ViewPU { 28 constructor(e, t, o, i = -1) { 29 super(e, o, i); 30 this.__selected = new ObservedPropertySimplePU(0, this, "selected"); 31 this.options = void 0; 32 this.menuItems = void 0; 33 this.subtitle = void 0; 34 this.badgeValue = void 0; 35 this.hidesBackButton = void 0; 36 this.onSelected = void 0; 37 this.__selectMaxWidth = new ObservedPropertySimplePU(0, this, "selectMaxWidth"); 38 this.setInitiallyProvidedValue(t) 39 } 40 setInitiallyProvidedValue(e) { 41 void 0 !== e.selected && (this.selected = e.selected); 42 void 0 !== e.options && (this.options = e.options); 43 void 0 !== e.menuItems && (this.menuItems = e.menuItems); 44 void 0 !== e.subtitle && (this.subtitle = e.subtitle); 45 void 0 !== e.badgeValue && (this.badgeValue = e.badgeValue); 46 void 0 !== e.hidesBackButton && (this.hidesBackButton = e.hidesBackButton); 47 void 0 !== e.onSelected && (this.onSelected = e.onSelected); 48 void 0 !== e.selectMaxWidth && (this.selectMaxWidth = e.selectMaxWidth) 49 } 50 updateStateVars(e) {} 51 purgeVariableDependenciesOnElmtId(e) { 52 this.__selected.purgeDependencyOnElmtId(e); 53 this.__selectMaxWidth.purgeDependencyOnElmtId(e) 54 } 55 aboutToBeDeleted() { 56 this.__selected.aboutToBeDeleted(); 57 this.__selectMaxWidth.aboutToBeDeleted(); 58 SubscriberManager.Get().delete(this.id__()); 59 this.aboutToBeDeletedInternal() 60 } 61 get selected() { 62 return this.__selected.get() 63 } 64 set selected(e) { 65 this.__selected.set(e) 66 } 67 get selectMaxWidth() { 68 return this.__selectMaxWidth.get() 69 } 70 set selectMaxWidth(e) { 71 this.__selectMaxWidth.set(e) 72 } 73 initialRender() { 74 this.observeComponentCreation(((e, t) => { 75 ViewStackProcessor.StartGetAccessRecordingFor(e); 76 Flex.create({ 77 justifyContent: FlexAlign.SpaceBetween, 78 alignItems: ItemAlign.Stretch 79 }); 80 Flex.width("100%"); 81 Flex.height(SelectTitleBar.totalHeight); 82 Flex.backgroundColor({ 83 id: -1, 84 type: 10001, 85 params: ["sys.color.ohos_id_color_background"], 86 bundleName: "", 87 moduleName: "" 88 }); 89 Flex.onAreaChange(((e, t) => { 90 let o = Number(t.width); 91 if (!this.hidesBackButton) { 92 o -= ImageMenuItem.imageHotZoneWidth; 93 o += SelectTitleBar.leftPadding; 94 o -= SelectTitleBar.leftPaddingWithBack 95 } 96 if (void 0 !== this.menuItems) { 97 let e = this.menuItems.length; 98 e >= CollapsibleMenuSection.maxCountOfVisibleItems ? o -= ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems : e > 0 && (o -= ImageMenuItem.imageHotZoneWidth * e) 99 } 100 void 0 !== this.badgeValue ? this.selectMaxWidth = o - SelectTitleBar.badgeSize - SelectTitleBar.leftPadding - SelectTitleBar.rightPadding - SelectTitleBar.badgePadding : this.selectMaxWidth = o - SelectTitleBar.leftPadding - SelectTitleBar.rightPadding 101 })); 102 t || Flex.pop(); 103 ViewStackProcessor.StopGetAccessRecording() 104 })); 105 this.observeComponentCreation(((e, t) => { 106 ViewStackProcessor.StartGetAccessRecordingFor(e); 107 Row.create(); 108 Row.margin({ 109 left: this.hidesBackButton ? { 110 id: -1, 111 type: 10002, 112 params: ["sys.float.ohos_id_max_padding_start"], 113 bundleName: "", 114 moduleName: "" 115 } : { 116 id: -1, 117 type: 10002, 118 params: ["sys.float.ohos_id_default_padding_start"], 119 bundleName: "", 120 moduleName: "" 121 } 122 }); 123 t || Row.pop(); 124 ViewStackProcessor.StopGetAccessRecording() 125 })); 126 this.observeComponentCreation(((e, t) => { 127 ViewStackProcessor.StartGetAccessRecordingFor(e); 128 If.create(); 129 this.hidesBackButton ? If.branchId(1) : this.ifElseBranchUpdateFunction(0, (() => { 130 this.observeComponentCreation(((e, t) => { 131 ViewStackProcessor.StartGetAccessRecordingFor(e); 132 Navigator.create(); 133 t || Navigator.pop(); 134 ViewStackProcessor.StopGetAccessRecording() 135 })); 136 this.observeComponentCreation(((e, t) => { 137 ViewStackProcessor.StartGetAccessRecordingFor(e); 138 t ? ViewPU.create(new ImageMenuItem(this, { 139 item: { 140 value: PUBLIC_BACK, 141 isEnabled: !0 142 } 143 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 144 ViewStackProcessor.StopGetAccessRecording() 145 })); 146 Navigator.pop() 147 })); 148 t || If.pop(); 149 ViewStackProcessor.StopGetAccessRecording() 150 })); 151 If.pop(); 152 this.observeComponentCreation(((e, t) => { 153 ViewStackProcessor.StartGetAccessRecordingFor(e); 154 Column.create(); 155 Column.justifyContent(FlexAlign.Start); 156 Column.alignItems(HorizontalAlign.Start); 157 Column.constraintSize({ 158 maxWidth: this.selectMaxWidth 159 }); 160 t || Column.pop(); 161 ViewStackProcessor.StopGetAccessRecording() 162 })); 163 this.observeComponentCreation(((e, t) => { 164 ViewStackProcessor.StartGetAccessRecordingFor(e); 165 If.create(); 166 void 0 !== this.badgeValue ? this.ifElseBranchUpdateFunction(0, (() => { 167 this.observeComponentCreation(((e, t) => { 168 ViewStackProcessor.StartGetAccessRecordingFor(e); 169 Badge.create({ 170 count: this.badgeValue, 171 position: BadgePosition.Right, 172 style: { 173 badgeSize: SelectTitleBar.badgeSize, 174 badgeColor: { 175 id: -1, 176 type: 10001, 177 params: ["sys.color.ohos_id_color_emphasize"], 178 bundleName: "", 179 moduleName: "" 180 }, 181 borderColor: { 182 id: -1, 183 type: 10001, 184 params: ["sys.color.ohos_id_color_emphasize"], 185 bundleName: "", 186 moduleName: "" 187 }, 188 borderWidth: 0 189 } 190 }); 191 t || Badge.pop(); 192 ViewStackProcessor.StopGetAccessRecording() 193 })); 194 this.observeComponentCreation(((e, t) => { 195 ViewStackProcessor.StartGetAccessRecordingFor(e); 196 Row.create(); 197 Row.justifyContent(FlexAlign.Start); 198 Row.margin({ 199 right: { 200 id: -1, 201 type: 10002, 202 params: ["sys.float.ohos_id_elements_margin_horizontal_l"], 203 bundleName: "", 204 moduleName: "" 205 } 206 }); 207 t || Row.pop(); 208 ViewStackProcessor.StopGetAccessRecording() 209 })); 210 this.observeComponentCreation(((e, t) => { 211 ViewStackProcessor.StartGetAccessRecordingFor(e); 212 Select.create(this.options); 213 Select.selected(this.selected); 214 Select.value(this.selected < this.options.length ? this.options[this.selected].value.toString() : ""); 215 Select.font({ 216 size: this.hidesBackButton && void 0 === this.subtitle ? { 217 id: -1, 218 type: 10002, 219 params: ["sys.float.ohos_id_text_size_headline7"], 220 bundleName: "", 221 moduleName: "" 222 } : { 223 id: -1, 224 type: 10002, 225 params: ["sys.float.ohos_id_text_size_headline8"], 226 bundleName: "", 227 moduleName: "" 228 } 229 }); 230 Select.fontColor({ 231 id: -1, 232 type: 10001, 233 params: ["sys.color.ohos_id_color_titlebar_text"], 234 bundleName: "", 235 moduleName: "" 236 }); 237 Select.backgroundColor(Color.Transparent); 238 Select.onSelect(this.onSelected); 239 Select.constraintSize({ 240 maxWidth: this.selectMaxWidth 241 }); 242 Select.offset({ 243 x: -4 244 }); 245 t || Select.pop(); 246 ViewStackProcessor.StopGetAccessRecording() 247 })); 248 Select.pop(); 249 Row.pop(); 250 Badge.pop() 251 })) : this.ifElseBranchUpdateFunction(1, (() => { 252 this.observeComponentCreation(((e, t) => { 253 ViewStackProcessor.StartGetAccessRecordingFor(e); 254 Row.create(); 255 Row.justifyContent(FlexAlign.Start); 256 t || Row.pop(); 257 ViewStackProcessor.StopGetAccessRecording() 258 })); 259 this.observeComponentCreation(((e, t) => { 260 ViewStackProcessor.StartGetAccessRecordingFor(e); 261 Select.create(this.options); 262 Select.selected(this.selected); 263 Select.value(this.selected < this.options.length ? this.options[this.selected].value.toString() : ""); 264 Select.font({ 265 size: this.hidesBackButton && void 0 === this.subtitle ? { 266 id: -1, 267 type: 10002, 268 params: ["sys.float.ohos_id_text_size_headline7"], 269 bundleName: "", 270 moduleName: "" 271 } : { 272 id: -1, 273 type: 10002, 274 params: ["sys.float.ohos_id_text_size_headline8"], 275 bundleName: "", 276 moduleName: "" 277 } 278 }); 279 Select.fontColor({ 280 id: -1, 281 type: 10001, 282 params: ["sys.color.ohos_id_color_titlebar_text"], 283 bundleName: "", 284 moduleName: "" 285 }); 286 Select.backgroundColor(Color.Transparent); 287 Select.onSelect(this.onSelected); 288 Select.constraintSize({ 289 maxWidth: this.selectMaxWidth 290 }); 291 Select.offset({ 292 x: -4 293 }); 294 t || Select.pop(); 295 ViewStackProcessor.StopGetAccessRecording() 296 })); 297 Select.pop(); 298 Row.pop() 299 })); 300 t || If.pop(); 301 ViewStackProcessor.StopGetAccessRecording() 302 })); 303 If.pop(); 304 this.observeComponentCreation(((e, t) => { 305 ViewStackProcessor.StartGetAccessRecordingFor(e); 306 If.create(); 307 void 0 !== this.subtitle ? this.ifElseBranchUpdateFunction(0, (() => { 308 this.observeComponentCreation(((e, t) => { 309 ViewStackProcessor.StartGetAccessRecordingFor(e); 310 Row.create(); 311 Row.justifyContent(FlexAlign.Start); 312 Row.margin({ 313 left: SelectTitleBar.subtitleLeftPadding 314 }); 315 t || Row.pop(); 316 ViewStackProcessor.StopGetAccessRecording() 317 })); 318 this.observeComponentCreation(((e, t) => { 319 ViewStackProcessor.StartGetAccessRecordingFor(e); 320 Text.create(this.subtitle); 321 Text.fontSize({ 322 id: -1, 323 type: 10002, 324 params: ["sys.float.ohos_id_text_size_over_line"], 325 bundleName: "", 326 moduleName: "" 327 }); 328 Text.fontColor({ 329 id: -1, 330 type: 10001, 331 params: ["sys.color.ohos_id_color_titlebar_subtitle_text"], 332 bundleName: "", 333 moduleName: "" 334 }); 335 Text.maxLines(1); 336 Text.textOverflow({ 337 overflow: TextOverflow.Ellipsis 338 }); 339 Text.constraintSize({ 340 maxWidth: this.selectMaxWidth 341 }); 342 Text.offset({ 343 y: -4 344 }); 345 t || Text.pop(); 346 ViewStackProcessor.StopGetAccessRecording() 347 })); 348 Text.pop(); 349 Row.pop() 350 })) : If.branchId(1); 351 t || If.pop(); 352 ViewStackProcessor.StopGetAccessRecording() 353 })); 354 If.pop(); 355 Column.pop(); 356 Row.pop(); 357 this.observeComponentCreation(((e, t) => { 358 ViewStackProcessor.StartGetAccessRecordingFor(e); 359 If.create(); 360 void 0 !== this.menuItems && this.menuItems.length > 0 ? this.ifElseBranchUpdateFunction(0, (() => { 361 this.observeComponentCreation(((e, t) => { 362 ViewStackProcessor.StartGetAccessRecordingFor(e); 363 t ? ViewPU.create(new CollapsibleMenuSection(this, { 364 menuItems: this.menuItems 365 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 366 ViewStackProcessor.StopGetAccessRecording() 367 })) 368 })) : If.branchId(1); 369 t || If.pop(); 370 ViewStackProcessor.StopGetAccessRecording() 371 })); 372 If.pop(); 373 Flex.pop() 374 } 375 rerender() { 376 this.updateDirtyElements() 377 } 378} 379SelectTitleBar.badgeSize = 16; 380SelectTitleBar.totalHeight = 56; 381SelectTitleBar.leftPadding = 24; 382SelectTitleBar.leftPaddingWithBack = 12; 383SelectTitleBar.rightPadding = 24; 384SelectTitleBar.badgePadding = 16; 385SelectTitleBar.subtitleLeftPadding = 4; 386class CollapsibleMenuSection extends ViewPU { 387 constructor(e, t, o, i = -1) { 388 super(e, o, i); 389 this.menuItems = void 0; 390 this.__isPopupShown = new ObservedPropertySimplePU(!1, this, "isPopupShown"); 391 this.__isMoreIconOnFocus = new ObservedPropertySimplePU(!1, this, "isMoreIconOnFocus"); 392 this.__isMoreIconOnHover = new ObservedPropertySimplePU(!1, this, "isMoreIconOnHover"); 393 this.__isMoreIconOnClick = new ObservedPropertySimplePU(!1, this, "isMoreIconOnClick"); 394 this.setInitiallyProvidedValue(t) 395 } 396 setInitiallyProvidedValue(e) { 397 void 0 !== e.menuItems && (this.menuItems = e.menuItems); 398 void 0 !== e.isPopupShown && (this.isPopupShown = e.isPopupShown); 399 void 0 !== e.isMoreIconOnFocus && (this.isMoreIconOnFocus = e.isMoreIconOnFocus); 400 void 0 !== e.isMoreIconOnHover && (this.isMoreIconOnHover = e.isMoreIconOnHover); 401 void 0 !== e.isMoreIconOnClick && (this.isMoreIconOnClick = e.isMoreIconOnClick) 402 } 403 updateStateVars(e) {} 404 purgeVariableDependenciesOnElmtId(e) { 405 this.__isPopupShown.purgeDependencyOnElmtId(e); 406 this.__isMoreIconOnFocus.purgeDependencyOnElmtId(e); 407 this.__isMoreIconOnHover.purgeDependencyOnElmtId(e); 408 this.__isMoreIconOnClick.purgeDependencyOnElmtId(e) 409 } 410 aboutToBeDeleted() { 411 this.__isPopupShown.aboutToBeDeleted(); 412 this.__isMoreIconOnFocus.aboutToBeDeleted(); 413 this.__isMoreIconOnHover.aboutToBeDeleted(); 414 this.__isMoreIconOnClick.aboutToBeDeleted(); 415 SubscriberManager.Get().delete(this.id__()); 416 this.aboutToBeDeletedInternal() 417 } 418 get isPopupShown() { 419 return this.__isPopupShown.get() 420 } 421 set isPopupShown(e) { 422 this.__isPopupShown.set(e) 423 } 424 get isMoreIconOnFocus() { 425 return this.__isMoreIconOnFocus.get() 426 } 427 set isMoreIconOnFocus(e) { 428 this.__isMoreIconOnFocus.set(e) 429 } 430 get isMoreIconOnHover() { 431 return this.__isMoreIconOnHover.get() 432 } 433 set isMoreIconOnHover(e) { 434 this.__isMoreIconOnHover.set(e) 435 } 436 get isMoreIconOnClick() { 437 return this.__isMoreIconOnClick.get() 438 } 439 set isMoreIconOnClick(e) { 440 this.__isMoreIconOnClick.set(e) 441 } 442 getMoreIconFgColor() { 443 return this.isMoreIconOnClick ? { 444 id: -1, 445 type: 10001, 446 params: ["sys.color.ohos_id_color_titlebar_icon_pressed"], 447 bundleName: "", 448 moduleName: "" 449 } : { 450 id: -1, 451 type: 10001, 452 params: ["sys.color.ohos_id_color_titlebar_icon"], 453 bundleName: "", 454 moduleName: "" 455 } 456 } 457 getMoreIconBgColor() { 458 return this.isMoreIconOnClick ? { 459 id: -1, 460 type: 10001, 461 params: ["sys.color.ohos_id_color_click_effect"], 462 bundleName: "", 463 moduleName: "" 464 } : this.isMoreIconOnHover ? { 465 id: -1, 466 type: 10001, 467 params: ["sys.color.ohos_id_color_hover"], 468 bundleName: "", 469 moduleName: "" 470 } : Color.Transparent 471 } 472 initialRender() { 473 this.observeComponentCreation(((e, t) => { 474 ViewStackProcessor.StartGetAccessRecordingFor(e); 475 Column.create(); 476 Column.height("100%"); 477 Column.margin({ 478 right: { 479 id: -1, 480 type: 10002, 481 params: ["sys.float.ohos_id_default_padding_end"], 482 bundleName: "", 483 moduleName: "" 484 } 485 }); 486 Column.justifyContent(FlexAlign.Center); 487 t || Column.pop(); 488 ViewStackProcessor.StopGetAccessRecording() 489 })); 490 this.observeComponentCreation(((e, t) => { 491 ViewStackProcessor.StartGetAccessRecordingFor(e); 492 Row.create(); 493 t || Row.pop(); 494 ViewStackProcessor.StopGetAccessRecording() 495 })); 496 this.observeComponentCreation(((e, t) => { 497 ViewStackProcessor.StartGetAccessRecordingFor(e); 498 If.create(); 499 this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems ? this.ifElseBranchUpdateFunction(0, (() => { 500 this.observeComponentCreation(((e, t) => { 501 ViewStackProcessor.StartGetAccessRecordingFor(e); 502 ForEach.create(); 503 this.forEachUpdateFunction(e, this.menuItems, (e => { 504 const t = e; 505 this.observeComponentCreation(((e, o) => { 506 ViewStackProcessor.StartGetAccessRecordingFor(e); 507 o ? ViewPU.create(new ImageMenuItem(this, { 508 item: t 509 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 510 ViewStackProcessor.StopGetAccessRecording() 511 })) 512 })); 513 t || ForEach.pop(); 514 ViewStackProcessor.StopGetAccessRecording() 515 })); 516 ForEach.pop() 517 })) : this.ifElseBranchUpdateFunction(1, (() => { 518 this.observeComponentCreation(((e, t) => { 519 ViewStackProcessor.StartGetAccessRecordingFor(e); 520 ForEach.create(); 521 this.forEachUpdateFunction(e, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), (e => { 522 const t = e; 523 this.observeComponentCreation(((e, o) => { 524 ViewStackProcessor.StartGetAccessRecordingFor(e); 525 o ? ViewPU.create(new ImageMenuItem(this, { 526 item: t 527 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 528 ViewStackProcessor.StopGetAccessRecording() 529 })) 530 })); 531 t || ForEach.pop(); 532 ViewStackProcessor.StopGetAccessRecording() 533 })); 534 ForEach.pop(); 535 this.observeComponentCreation(((e, t) => { 536 ViewStackProcessor.StartGetAccessRecordingFor(e); 537 Row.create(); 538 Row.width(ImageMenuItem.imageHotZoneWidth); 539 Row.height(ImageMenuItem.imageHotZoneWidth); 540 Row.borderRadius(ImageMenuItem.buttonBorderRadius); 541 Row.foregroundColor(this.getMoreIconFgColor()); 542 Row.backgroundColor(this.getMoreIconBgColor()); 543 Row.justifyContent(FlexAlign.Center); 544 Row.border(this.isMoreIconOnFocus ? { 545 width: ImageMenuItem.focusBorderWidth, 546 color: { 547 id: -1, 548 type: 10001, 549 params: ["sys.color.ohos_id_color_emphasize"], 550 bundleName: "", 551 moduleName: "" 552 }, 553 style: BorderStyle.Solid 554 } : { 555 width: 0 556 }); 557 Row.onFocus((() => this.isMoreIconOnFocus = !0)); 558 Row.onBlur((() => this.isMoreIconOnFocus = !1)); 559 Row.onHover((e => this.isMoreIconOnHover = e)); 560 Row.onKeyEvent((e => { 561 if (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE) { 562 e.type === KeyType.Down && (this.isMoreIconOnClick = !0); 563 e.type === KeyType.Up && (this.isMoreIconOnClick = !1) 564 } 565 })); 566 Row.onTouch((e => { 567 e.type === TouchType.Down && (this.isMoreIconOnClick = !0); 568 e.type === TouchType.Up && (this.isMoreIconOnClick = !1) 569 })); 570 Row.onClick((() => this.isPopupShown = !0)); 571 Row.bindPopup(this.isPopupShown, { 572 builder: { 573 builder: this.popupBuilder.bind(this) 574 }, 575 placement: Placement.Bottom, 576 popupColor: Color.White, 577 enableArrow: !1, 578 onStateChange: e => this.isPopupShown = e.isVisible 579 }); 580 t || Row.pop(); 581 ViewStackProcessor.StopGetAccessRecording() 582 })); 583 this.observeComponentCreation(((e, t) => { 584 ViewStackProcessor.StartGetAccessRecordingFor(e); 585 Image.create(PUBLIC_MORE); 586 Image.width(ImageMenuItem.imageSize); 587 Image.height(ImageMenuItem.imageSize); 588 Image.focusable(!0); 589 t || Image.pop(); 590 ViewStackProcessor.StopGetAccessRecording() 591 })); 592 Row.pop() 593 })); 594 t || If.pop(); 595 ViewStackProcessor.StopGetAccessRecording() 596 })); 597 If.pop(); 598 Row.pop(); 599 Column.pop() 600 } 601 popupBuilder(e = null) { 602 this.observeComponentCreation(((e, t) => { 603 ViewStackProcessor.StartGetAccessRecordingFor(e); 604 Column.create(); 605 Column.width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum); 606 Column.margin({ 607 top: CollapsibleMenuSection.focusPadding, 608 bottom: CollapsibleMenuSection.focusPadding 609 }); 610 t || Column.pop(); 611 ViewStackProcessor.StopGetAccessRecording() 612 })); 613 this.observeComponentCreation(((e, t) => { 614 ViewStackProcessor.StartGetAccessRecordingFor(e); 615 ForEach.create(); 616 this.forEachUpdateFunction(e, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), ((e, t) => { 617 const o = e; 618 this.observeComponentCreation(((e, t) => { 619 ViewStackProcessor.StartGetAccessRecordingFor(e); 620 t ? ViewPU.create(new ImageMenuItem(this, { 621 item: o 622 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 623 ViewStackProcessor.StopGetAccessRecording() 624 })) 625 }), void 0, !0, !1); 626 t || ForEach.pop(); 627 ViewStackProcessor.StopGetAccessRecording() 628 })); 629 ForEach.pop(); 630 Column.pop() 631 } 632 rerender() { 633 this.updateDirtyElements() 634 } 635} 636CollapsibleMenuSection.maxCountOfVisibleItems = 3; 637CollapsibleMenuSection.focusPadding = 4; 638CollapsibleMenuSection.marginsNum = 2; 639__decorate([], CollapsibleMenuSection.prototype, "popupBuilder", null); 640class ImageMenuItem extends ViewPU { 641 constructor(e, t, o, i = -1) { 642 super(e, o, i); 643 this.item = void 0; 644 this.__isOnFocus = new ObservedPropertySimplePU(!1, this, "isOnFocus"); 645 this.__isOnHover = new ObservedPropertySimplePU(!1, this, "isOnHover"); 646 this.__isOnClick = new ObservedPropertySimplePU(!1, this, "isOnClick"); 647 this.setInitiallyProvidedValue(t) 648 } 649 setInitiallyProvidedValue(e) { 650 void 0 !== e.item && (this.item = e.item); 651 void 0 !== e.isOnFocus && (this.isOnFocus = e.isOnFocus); 652 void 0 !== e.isOnHover && (this.isOnHover = e.isOnHover); 653 void 0 !== e.isOnClick && (this.isOnClick = e.isOnClick) 654 } 655 updateStateVars(e) {} 656 purgeVariableDependenciesOnElmtId(e) { 657 this.__isOnFocus.purgeDependencyOnElmtId(e); 658 this.__isOnHover.purgeDependencyOnElmtId(e); 659 this.__isOnClick.purgeDependencyOnElmtId(e) 660 } 661 aboutToBeDeleted() { 662 this.__isOnFocus.aboutToBeDeleted(); 663 this.__isOnHover.aboutToBeDeleted(); 664 this.__isOnClick.aboutToBeDeleted(); 665 SubscriberManager.Get().delete(this.id__()); 666 this.aboutToBeDeletedInternal() 667 } 668 get isOnFocus() { 669 return this.__isOnFocus.get() 670 } 671 set isOnFocus(e) { 672 this.__isOnFocus.set(e) 673 } 674 get isOnHover() { 675 return this.__isOnHover.get() 676 } 677 set isOnHover(e) { 678 this.__isOnHover.set(e) 679 } 680 get isOnClick() { 681 return this.__isOnClick.get() 682 } 683 set isOnClick(e) { 684 this.__isOnClick.set(e) 685 } 686 getFgColor() { 687 return this.isOnClick ? { 688 id: -1, 689 type: 10001, 690 params: ["sys.color.ohos_id_color_titlebar_icon_pressed"], 691 bundleName: "", 692 moduleName: "" 693 } : { 694 id: -1, 695 type: 10001, 696 params: ["sys.color.ohos_id_color_titlebar_icon"], 697 bundleName: "", 698 moduleName: "" 699 } 700 } 701 getBgColor() { 702 return this.isOnClick ? { 703 id: -1, 704 type: 10001, 705 params: ["sys.color.ohos_id_color_click_effect"], 706 bundleName: "", 707 moduleName: "" 708 } : this.isOnHover ? { 709 id: -1, 710 type: 10001, 711 params: ["sys.color.ohos_id_color_hover"], 712 bundleName: "", 713 moduleName: "" 714 } : Color.Transparent 715 } 716 initialRender() { 717 this.observeComponentCreation(((e, t) => { 718 ViewStackProcessor.StartGetAccessRecordingFor(e); 719 Row.create(); 720 Row.width(ImageMenuItem.imageHotZoneWidth); 721 Row.height(ImageMenuItem.imageHotZoneWidth); 722 Row.borderRadius(ImageMenuItem.buttonBorderRadius); 723 Row.foregroundColor(this.getFgColor()); 724 Row.backgroundColor(this.getBgColor()); 725 Row.justifyContent(FlexAlign.Center); 726 Row.opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity); 727 Row.border(this.isOnFocus ? { 728 width: ImageMenuItem.focusBorderWidth, 729 color: { 730 id: -1, 731 type: 10001, 732 params: ["sys.color.ohos_id_color_emphasize"], 733 bundleName: "", 734 moduleName: "" 735 }, 736 style: BorderStyle.Solid 737 } : { 738 width: 0 739 }); 740 Row.onFocus((() => { 741 this.item.isEnabled && (this.isOnFocus = !0) 742 })); 743 Row.onBlur((() => this.isOnFocus = !1)); 744 Row.onHover((e => { 745 this.item.isEnabled && (this.isOnHover = e) 746 })); 747 Row.onKeyEvent((e => { 748 if (this.item.isEnabled && (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE)) { 749 e.type === KeyType.Down && (this.isOnClick = !0); 750 e.type === KeyType.Up && (this.isOnClick = !1) 751 } 752 })); 753 Row.onTouch((e => { 754 if (this.item.isEnabled) { 755 e.type === TouchType.Down && (this.isOnClick = !0); 756 e.type === TouchType.Up && (this.isOnClick = !1) 757 } 758 })); 759 Row.onClick((() => this.item.isEnabled && this.item.action && this.item.action())); 760 t || Row.pop(); 761 ViewStackProcessor.StopGetAccessRecording() 762 })); 763 this.observeComponentCreation(((e, t) => { 764 ViewStackProcessor.StartGetAccessRecordingFor(e); 765 Image.create(this.item.value); 766 Image.width(ImageMenuItem.imageSize); 767 Image.height(ImageMenuItem.imageSize); 768 Image.focusable(this.item.isEnabled); 769 t || Image.pop(); 770 ViewStackProcessor.StopGetAccessRecording() 771 })); 772 Row.pop() 773 } 774 rerender() { 775 this.updateDirtyElements() 776 } 777} 778ImageMenuItem.imageSize = 24; 779ImageMenuItem.imageHotZoneWidth = 48; 780ImageMenuItem.buttonBorderRadius = 8; 781ImageMenuItem.focusBorderWidth = 2; 782ImageMenuItem.disabledImageOpacity = .4; 783export default { 784 SelectTitleBar: SelectTitleBar 785};