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 ComposeTitleBar extends ViewPU { 28 constructor(e, t, o, i = -1) { 29 super(e, o, i); 30 this.item = void 0; 31 this.title = void 0; 32 this.subtitle = void 0; 33 this.menuItems = void 0; 34 this.__titleMaxWidth = new ObservedPropertySimplePU(0, this, "titleMaxWidth"); 35 this.__isItemOnFocus = new ObservedPropertySimplePU(!1, this, "isItemOnFocus"); 36 this.setInitiallyProvidedValue(t) 37 } 38 setInitiallyProvidedValue(e) { 39 void 0 !== e.item && (this.item = e.item); 40 void 0 !== e.title && (this.title = e.title); 41 void 0 !== e.subtitle && (this.subtitle = e.subtitle); 42 void 0 !== e.menuItems && (this.menuItems = e.menuItems); 43 void 0 !== e.titleMaxWidth && (this.titleMaxWidth = e.titleMaxWidth); 44 void 0 !== e.isItemOnFocus && (this.isItemOnFocus = e.isItemOnFocus) 45 } 46 updateStateVars(e) {} 47 purgeVariableDependenciesOnElmtId(e) { 48 this.__titleMaxWidth.purgeDependencyOnElmtId(e); 49 this.__isItemOnFocus.purgeDependencyOnElmtId(e) 50 } 51 aboutToBeDeleted() { 52 this.__titleMaxWidth.aboutToBeDeleted(); 53 this.__isItemOnFocus.aboutToBeDeleted(); 54 SubscriberManager.Get().delete(this.id__()); 55 this.aboutToBeDeletedInternal() 56 } 57 get titleMaxWidth() { 58 return this.__titleMaxWidth.get() 59 } 60 set titleMaxWidth(e) { 61 this.__titleMaxWidth.set(e) 62 } 63 get isItemOnFocus() { 64 return this.__isItemOnFocus.get() 65 } 66 set isItemOnFocus(e) { 67 this.__isItemOnFocus.set(e) 68 } 69 initialRender() { 70 this.observeComponentCreation(((e, t) => { 71 ViewStackProcessor.StartGetAccessRecordingFor(e); 72 Flex.create({ 73 justifyContent: FlexAlign.SpaceBetween, 74 alignItems: ItemAlign.Stretch 75 }); 76 Flex.width("100%"); 77 Flex.height(ComposeTitleBar.totalHeight); 78 Flex.backgroundColor({ 79 id: -1, 80 type: 10001, 81 params: ["sys.color.ohos_id_color_background"], 82 bundleName: "", 83 moduleName: "" 84 }); 85 Flex.onAreaChange(((e, t) => { 86 let o = Number(t.width); 87 if (void 0 !== this.menuItems) { 88 let e = this.menuItems.length; 89 e >= CollapsibleMenuSection.maxCountOfVisibleItems ? o -= ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems : e > 0 && (o -= ImageMenuItem.imageHotZoneWidth * e) 90 } 91 this.titleMaxWidth = o; 92 this.titleMaxWidth -= ComposeTitleBar.leftPadding; 93 this.titleMaxWidth -= ImageMenuItem.imageHotZoneWidth; 94 void 0 !== this.item && (this.titleMaxWidth -= ComposeTitleBar.portraitImageLeftPadding + ComposeTitleBar.portraitImageSize + ComposeTitleBar.portraitImageRightPadding); 95 this.titleMaxWidth -= ComposeTitleBar.rightPadding 96 })); 97 t || Flex.pop(); 98 ViewStackProcessor.StopGetAccessRecording() 99 })); 100 this.observeComponentCreation(((e, t) => { 101 ViewStackProcessor.StartGetAccessRecordingFor(e); 102 Row.create(); 103 Row.margin({ 104 left: { 105 id: -1, 106 type: 10002, 107 params: ["sys.float.ohos_id_default_padding_start"], 108 bundleName: "", 109 moduleName: "" 110 } 111 }); 112 t || Row.pop(); 113 ViewStackProcessor.StopGetAccessRecording() 114 })); 115 this.observeComponentCreation(((e, t) => { 116 ViewStackProcessor.StartGetAccessRecordingFor(e); 117 Navigator.create(); 118 t || Navigator.pop(); 119 ViewStackProcessor.StopGetAccessRecording() 120 })); 121 this.observeComponentCreation(((e, t) => { 122 ViewStackProcessor.StartGetAccessRecordingFor(e); 123 t ? ViewPU.create(new ImageMenuItem(this, { 124 item: { 125 value: PUBLIC_BACK, 126 isEnabled: !0 127 } 128 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 129 ViewStackProcessor.StopGetAccessRecording() 130 })); 131 Navigator.pop(); 132 this.observeComponentCreation(((e, t) => { 133 ViewStackProcessor.StartGetAccessRecordingFor(e); 134 If.create(); 135 void 0 !== this.item ? this.ifElseBranchUpdateFunction(0, (() => { 136 this.observeComponentCreation(((e, t) => { 137 ViewStackProcessor.StartGetAccessRecordingFor(e); 138 Image.create(this.item.value); 139 Image.width(ComposeTitleBar.portraitImageSize); 140 Image.height(ComposeTitleBar.portraitImageSize); 141 Image.margin({ 142 left: { 143 id: -1, 144 type: 10002, 145 params: ["sys.float.ohos_id_text_paragraph_margin_xs"], 146 bundleName: "", 147 moduleName: "" 148 }, 149 right: { 150 id: -1, 151 type: 10002, 152 params: ["sys.float.ohos_id_text_paragraph_margin_m"], 153 bundleName: "", 154 moduleName: "" 155 } 156 }); 157 Image.focusable(this.item.isEnabled); 158 Image.borderRadius(ImageMenuItem.buttonBorderRadius); 159 Image.onFocus((() => this.isItemOnFocus = !0)); 160 Image.onBlur((() => this.isItemOnFocus = !1)); 161 Image.border(this.isItemOnFocus ? { 162 width: ImageMenuItem.focusBorderWidth, 163 color: { 164 id: -1, 165 type: 10001, 166 params: ["sys.color.ohos_id_color_emphasize"], 167 bundleName: "", 168 moduleName: "" 169 }, 170 style: BorderStyle.Solid 171 } : { 172 width: 0 173 }); 174 Image.onClick((() => this.item.isEnabled && this.item.action && this.item.action())); 175 t || Image.pop(); 176 ViewStackProcessor.StopGetAccessRecording() 177 })) 178 })) : If.branchId(1); 179 t || If.pop(); 180 ViewStackProcessor.StopGetAccessRecording() 181 })); 182 If.pop(); 183 this.observeComponentCreation(((e, t) => { 184 ViewStackProcessor.StartGetAccessRecordingFor(e); 185 Column.create(); 186 Column.justifyContent(FlexAlign.Start); 187 Column.alignItems(HorizontalAlign.Start); 188 Column.constraintSize({ 189 maxWidth: this.titleMaxWidth 190 }); 191 t || Column.pop(); 192 ViewStackProcessor.StopGetAccessRecording() 193 })); 194 this.observeComponentCreation(((e, t) => { 195 ViewStackProcessor.StartGetAccessRecordingFor(e); 196 If.create(); 197 void 0 !== this.title ? this.ifElseBranchUpdateFunction(0, (() => { 198 this.observeComponentCreation(((e, t) => { 199 ViewStackProcessor.StartGetAccessRecordingFor(e); 200 Row.create(); 201 Row.justifyContent(FlexAlign.Start); 202 t || Row.pop(); 203 ViewStackProcessor.StopGetAccessRecording() 204 })); 205 this.observeComponentCreation(((e, t) => { 206 ViewStackProcessor.StartGetAccessRecordingFor(e); 207 Text.create(this.title); 208 Text.fontWeight(FontWeight.Medium); 209 Text.fontSize({ 210 id: -1, 211 type: 10002, 212 params: ["sys.float.ohos_id_text_size_headline8"], 213 bundleName: "", 214 moduleName: "" 215 }); 216 Text.fontColor({ 217 id: -1, 218 type: 10001, 219 params: ["sys.color.ohos_id_color_titlebar_text"], 220 bundleName: "", 221 moduleName: "" 222 }); 223 Text.maxLines(void 0 !== this.subtitle ? 1 : 2); 224 Text.textOverflow({ 225 overflow: TextOverflow.Ellipsis 226 }); 227 Text.constraintSize({ 228 maxWidth: this.titleMaxWidth 229 }); 230 t || Text.pop(); 231 ViewStackProcessor.StopGetAccessRecording() 232 })); 233 Text.pop(); 234 Row.pop() 235 })) : If.branchId(1); 236 t || If.pop(); 237 ViewStackProcessor.StopGetAccessRecording() 238 })); 239 If.pop(); 240 this.observeComponentCreation(((e, t) => { 241 ViewStackProcessor.StartGetAccessRecordingFor(e); 242 If.create(); 243 void 0 !== this.subtitle ? this.ifElseBranchUpdateFunction(0, (() => { 244 this.observeComponentCreation(((e, t) => { 245 ViewStackProcessor.StartGetAccessRecordingFor(e); 246 Row.create(); 247 Row.justifyContent(FlexAlign.Start); 248 t || Row.pop(); 249 ViewStackProcessor.StopGetAccessRecording() 250 })); 251 this.observeComponentCreation(((e, t) => { 252 ViewStackProcessor.StartGetAccessRecordingFor(e); 253 Text.create(this.subtitle); 254 Text.fontSize({ 255 id: -1, 256 type: 10002, 257 params: ["sys.float.ohos_id_text_size_over_line"], 258 bundleName: "", 259 moduleName: "" 260 }); 261 Text.fontColor({ 262 id: -1, 263 type: 10001, 264 params: ["sys.color.ohos_id_color_titlebar_subtitle_text"], 265 bundleName: "", 266 moduleName: "" 267 }); 268 Text.maxLines(1); 269 Text.textOverflow({ 270 overflow: TextOverflow.Ellipsis 271 }); 272 Text.constraintSize({ 273 maxWidth: this.titleMaxWidth 274 }); 275 t || Text.pop(); 276 ViewStackProcessor.StopGetAccessRecording() 277 })); 278 Text.pop(); 279 Row.pop() 280 })) : If.branchId(1); 281 t || If.pop(); 282 ViewStackProcessor.StopGetAccessRecording() 283 })); 284 If.pop(); 285 Column.pop(); 286 Row.pop(); 287 this.observeComponentCreation(((e, t) => { 288 ViewStackProcessor.StartGetAccessRecordingFor(e); 289 If.create(); 290 void 0 !== this.menuItems && this.menuItems.length > 0 ? this.ifElseBranchUpdateFunction(0, (() => { 291 this.observeComponentCreation(((e, t) => { 292 ViewStackProcessor.StartGetAccessRecordingFor(e); 293 t ? ViewPU.create(new CollapsibleMenuSection(this, { 294 menuItems: this.menuItems 295 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 296 ViewStackProcessor.StopGetAccessRecording() 297 })) 298 })) : If.branchId(1); 299 t || If.pop(); 300 ViewStackProcessor.StopGetAccessRecording() 301 })); 302 If.pop(); 303 Flex.pop() 304 } 305 rerender() { 306 this.updateDirtyElements() 307 } 308} 309ComposeTitleBar.totalHeight = 56; 310ComposeTitleBar.leftPadding = 12; 311ComposeTitleBar.rightPadding = 12; 312ComposeTitleBar.portraitImageSize = 40; 313ComposeTitleBar.portraitImageLeftPadding = 4; 314ComposeTitleBar.portraitImageRightPadding = 16; 315class CollapsibleMenuSection extends ViewPU { 316 constructor(e, t, o, i = -1) { 317 super(e, o, i); 318 this.menuItems = void 0; 319 this.__isPopupShown = new ObservedPropertySimplePU(!1, this, "isPopupShown"); 320 this.__isMoreIconOnFocus = new ObservedPropertySimplePU(!1, this, "isMoreIconOnFocus"); 321 this.__isMoreIconOnHover = new ObservedPropertySimplePU(!1, this, "isMoreIconOnHover"); 322 this.__isMoreIconOnClick = new ObservedPropertySimplePU(!1, this, "isMoreIconOnClick"); 323 this.setInitiallyProvidedValue(t) 324 } 325 setInitiallyProvidedValue(e) { 326 void 0 !== e.menuItems && (this.menuItems = e.menuItems); 327 void 0 !== e.isPopupShown && (this.isPopupShown = e.isPopupShown); 328 void 0 !== e.isMoreIconOnFocus && (this.isMoreIconOnFocus = e.isMoreIconOnFocus); 329 void 0 !== e.isMoreIconOnHover && (this.isMoreIconOnHover = e.isMoreIconOnHover); 330 void 0 !== e.isMoreIconOnClick && (this.isMoreIconOnClick = e.isMoreIconOnClick) 331 } 332 updateStateVars(e) {} 333 purgeVariableDependenciesOnElmtId(e) { 334 this.__isPopupShown.purgeDependencyOnElmtId(e); 335 this.__isMoreIconOnFocus.purgeDependencyOnElmtId(e); 336 this.__isMoreIconOnHover.purgeDependencyOnElmtId(e); 337 this.__isMoreIconOnClick.purgeDependencyOnElmtId(e) 338 } 339 aboutToBeDeleted() { 340 this.__isPopupShown.aboutToBeDeleted(); 341 this.__isMoreIconOnFocus.aboutToBeDeleted(); 342 this.__isMoreIconOnHover.aboutToBeDeleted(); 343 this.__isMoreIconOnClick.aboutToBeDeleted(); 344 SubscriberManager.Get().delete(this.id__()); 345 this.aboutToBeDeletedInternal() 346 } 347 get isPopupShown() { 348 return this.__isPopupShown.get() 349 } 350 set isPopupShown(e) { 351 this.__isPopupShown.set(e) 352 } 353 get isMoreIconOnFocus() { 354 return this.__isMoreIconOnFocus.get() 355 } 356 set isMoreIconOnFocus(e) { 357 this.__isMoreIconOnFocus.set(e) 358 } 359 get isMoreIconOnHover() { 360 return this.__isMoreIconOnHover.get() 361 } 362 set isMoreIconOnHover(e) { 363 this.__isMoreIconOnHover.set(e) 364 } 365 get isMoreIconOnClick() { 366 return this.__isMoreIconOnClick.get() 367 } 368 set isMoreIconOnClick(e) { 369 this.__isMoreIconOnClick.set(e) 370 } 371 getMoreIconFgColor() { 372 return this.isMoreIconOnClick ? { 373 id: -1, 374 type: 10001, 375 params: ["sys.color.ohos_id_color_titlebar_icon_pressed"], 376 bundleName: "", 377 moduleName: "" 378 } : { 379 id: -1, 380 type: 10001, 381 params: ["sys.color.ohos_id_color_titlebar_icon"], 382 bundleName: "", 383 moduleName: "" 384 } 385 } 386 getMoreIconBgColor() { 387 return this.isMoreIconOnClick ? { 388 id: -1, 389 type: 10001, 390 params: ["sys.color.ohos_id_color_click_effect"], 391 bundleName: "", 392 moduleName: "" 393 } : this.isMoreIconOnHover ? { 394 id: -1, 395 type: 10001, 396 params: ["sys.color.ohos_id_color_hover"], 397 bundleName: "", 398 moduleName: "" 399 } : Color.Transparent 400 } 401 initialRender() { 402 this.observeComponentCreation(((e, t) => { 403 ViewStackProcessor.StartGetAccessRecordingFor(e); 404 Column.create(); 405 Column.height("100%"); 406 Column.margin({ 407 right: { 408 id: -1, 409 type: 10002, 410 params: ["sys.float.ohos_id_default_padding_end"], 411 bundleName: "", 412 moduleName: "" 413 } 414 }); 415 Column.justifyContent(FlexAlign.Center); 416 t || Column.pop(); 417 ViewStackProcessor.StopGetAccessRecording() 418 })); 419 this.observeComponentCreation(((e, t) => { 420 ViewStackProcessor.StartGetAccessRecordingFor(e); 421 Row.create(); 422 t || Row.pop(); 423 ViewStackProcessor.StopGetAccessRecording() 424 })); 425 this.observeComponentCreation(((e, t) => { 426 ViewStackProcessor.StartGetAccessRecordingFor(e); 427 If.create(); 428 this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems ? this.ifElseBranchUpdateFunction(0, (() => { 429 this.observeComponentCreation(((e, t) => { 430 ViewStackProcessor.StartGetAccessRecordingFor(e); 431 ForEach.create(); 432 this.forEachUpdateFunction(e, this.menuItems, (e => { 433 const t = e; 434 this.observeComponentCreation(((e, o) => { 435 ViewStackProcessor.StartGetAccessRecordingFor(e); 436 o ? ViewPU.create(new ImageMenuItem(this, { 437 item: t 438 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 439 ViewStackProcessor.StopGetAccessRecording() 440 })) 441 })); 442 t || ForEach.pop(); 443 ViewStackProcessor.StopGetAccessRecording() 444 })); 445 ForEach.pop() 446 })) : this.ifElseBranchUpdateFunction(1, (() => { 447 this.observeComponentCreation(((e, t) => { 448 ViewStackProcessor.StartGetAccessRecordingFor(e); 449 ForEach.create(); 450 this.forEachUpdateFunction(e, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), (e => { 451 const t = e; 452 this.observeComponentCreation(((e, o) => { 453 ViewStackProcessor.StartGetAccessRecordingFor(e); 454 o ? ViewPU.create(new ImageMenuItem(this, { 455 item: t 456 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 457 ViewStackProcessor.StopGetAccessRecording() 458 })) 459 })); 460 t || ForEach.pop(); 461 ViewStackProcessor.StopGetAccessRecording() 462 })); 463 ForEach.pop(); 464 this.observeComponentCreation(((e, t) => { 465 ViewStackProcessor.StartGetAccessRecordingFor(e); 466 Row.create(); 467 Row.width(ImageMenuItem.imageHotZoneWidth); 468 Row.height(ImageMenuItem.imageHotZoneWidth); 469 Row.borderRadius(ImageMenuItem.buttonBorderRadius); 470 Row.foregroundColor(this.getMoreIconFgColor()); 471 Row.backgroundColor(this.getMoreIconBgColor()); 472 Row.justifyContent(FlexAlign.Center); 473 Row.border(this.isMoreIconOnFocus ? { 474 width: ImageMenuItem.focusBorderWidth, 475 color: { 476 id: -1, 477 type: 10001, 478 params: ["sys.color.ohos_id_color_emphasize"], 479 bundleName: "", 480 moduleName: "" 481 }, 482 style: BorderStyle.Solid 483 } : { 484 width: 0 485 }); 486 Row.onFocus((() => this.isMoreIconOnFocus = !0)); 487 Row.onBlur((() => this.isMoreIconOnFocus = !1)); 488 Row.onHover((e => this.isMoreIconOnHover = e)); 489 Row.onKeyEvent((e => { 490 if (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE) { 491 e.type === KeyType.Down && (this.isMoreIconOnClick = !0); 492 e.type === KeyType.Up && (this.isMoreIconOnClick = !1) 493 } 494 })); 495 Row.onTouch((e => { 496 e.type === TouchType.Down && (this.isMoreIconOnClick = !0); 497 e.type === TouchType.Up && (this.isMoreIconOnClick = !1) 498 })); 499 Row.onClick((() => this.isPopupShown = !0)); 500 Row.bindPopup(this.isPopupShown, { 501 builder: { 502 builder: this.popupBuilder.bind(this) 503 }, 504 placement: Placement.Bottom, 505 popupColor: Color.White, 506 enableArrow: !1, 507 onStateChange: e => this.isPopupShown = e.isVisible 508 }); 509 t || Row.pop(); 510 ViewStackProcessor.StopGetAccessRecording() 511 })); 512 this.observeComponentCreation(((e, t) => { 513 ViewStackProcessor.StartGetAccessRecordingFor(e); 514 Image.create(PUBLIC_MORE); 515 Image.width(ImageMenuItem.imageSize); 516 Image.height(ImageMenuItem.imageSize); 517 Image.focusable(!0); 518 t || Image.pop(); 519 ViewStackProcessor.StopGetAccessRecording() 520 })); 521 Row.pop() 522 })); 523 t || If.pop(); 524 ViewStackProcessor.StopGetAccessRecording() 525 })); 526 If.pop(); 527 Row.pop(); 528 Column.pop() 529 } 530 popupBuilder(e = null) { 531 this.observeComponentCreation(((e, t) => { 532 ViewStackProcessor.StartGetAccessRecordingFor(e); 533 Column.create(); 534 Column.width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum); 535 Column.margin({ 536 top: CollapsibleMenuSection.focusPadding, 537 bottom: CollapsibleMenuSection.focusPadding 538 }); 539 t || Column.pop(); 540 ViewStackProcessor.StopGetAccessRecording() 541 })); 542 this.observeComponentCreation(((e, t) => { 543 ViewStackProcessor.StartGetAccessRecordingFor(e); 544 ForEach.create(); 545 this.forEachUpdateFunction(e, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), ((e, t) => { 546 const o = e; 547 this.observeComponentCreation(((e, t) => { 548 ViewStackProcessor.StartGetAccessRecordingFor(e); 549 t ? ViewPU.create(new ImageMenuItem(this, { 550 item: o 551 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 552 ViewStackProcessor.StopGetAccessRecording() 553 })) 554 }), void 0, !0, !1); 555 t || ForEach.pop(); 556 ViewStackProcessor.StopGetAccessRecording() 557 })); 558 ForEach.pop(); 559 Column.pop() 560 } 561 rerender() { 562 this.updateDirtyElements() 563 } 564} 565CollapsibleMenuSection.maxCountOfVisibleItems = 3; 566CollapsibleMenuSection.focusPadding = 4; 567CollapsibleMenuSection.marginsNum = 2; 568__decorate([], CollapsibleMenuSection.prototype, "popupBuilder", null); 569class ImageMenuItem extends ViewPU { 570 constructor(e, t, o, i = -1) { 571 super(e, o, i); 572 this.item = void 0; 573 this.__isOnFocus = new ObservedPropertySimplePU(!1, this, "isOnFocus"); 574 this.__isOnHover = new ObservedPropertySimplePU(!1, this, "isOnHover"); 575 this.__isOnClick = new ObservedPropertySimplePU(!1, this, "isOnClick"); 576 this.setInitiallyProvidedValue(t) 577 } 578 setInitiallyProvidedValue(e) { 579 void 0 !== e.item && (this.item = e.item); 580 void 0 !== e.isOnFocus && (this.isOnFocus = e.isOnFocus); 581 void 0 !== e.isOnHover && (this.isOnHover = e.isOnHover); 582 void 0 !== e.isOnClick && (this.isOnClick = e.isOnClick) 583 } 584 updateStateVars(e) {} 585 purgeVariableDependenciesOnElmtId(e) { 586 this.__isOnFocus.purgeDependencyOnElmtId(e); 587 this.__isOnHover.purgeDependencyOnElmtId(e); 588 this.__isOnClick.purgeDependencyOnElmtId(e) 589 } 590 aboutToBeDeleted() { 591 this.__isOnFocus.aboutToBeDeleted(); 592 this.__isOnHover.aboutToBeDeleted(); 593 this.__isOnClick.aboutToBeDeleted(); 594 SubscriberManager.Get().delete(this.id__()); 595 this.aboutToBeDeletedInternal() 596 } 597 get isOnFocus() { 598 return this.__isOnFocus.get() 599 } 600 set isOnFocus(e) { 601 this.__isOnFocus.set(e) 602 } 603 get isOnHover() { 604 return this.__isOnHover.get() 605 } 606 set isOnHover(e) { 607 this.__isOnHover.set(e) 608 } 609 get isOnClick() { 610 return this.__isOnClick.get() 611 } 612 set isOnClick(e) { 613 this.__isOnClick.set(e) 614 } 615 getFgColor() { 616 return this.isOnClick ? { 617 id: -1, 618 type: 10001, 619 params: ["sys.color.ohos_id_color_titlebar_icon_pressed"], 620 bundleName: "", 621 moduleName: "" 622 } : { 623 id: -1, 624 type: 10001, 625 params: ["sys.color.ohos_id_color_titlebar_icon"], 626 bundleName: "", 627 moduleName: "" 628 } 629 } 630 getBgColor() { 631 return this.isOnClick ? { 632 id: -1, 633 type: 10001, 634 params: ["sys.color.ohos_id_color_click_effect"], 635 bundleName: "", 636 moduleName: "" 637 } : this.isOnHover ? { 638 id: -1, 639 type: 10001, 640 params: ["sys.color.ohos_id_color_hover"], 641 bundleName: "", 642 moduleName: "" 643 } : Color.Transparent 644 } 645 initialRender() { 646 this.observeComponentCreation(((e, t) => { 647 ViewStackProcessor.StartGetAccessRecordingFor(e); 648 Row.create(); 649 Row.width(ImageMenuItem.imageHotZoneWidth); 650 Row.height(ImageMenuItem.imageHotZoneWidth); 651 Row.borderRadius(ImageMenuItem.buttonBorderRadius); 652 Row.foregroundColor(this.getFgColor()); 653 Row.backgroundColor(this.getBgColor()); 654 Row.justifyContent(FlexAlign.Center); 655 Row.opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity); 656 Row.border(this.isOnFocus ? { 657 width: ImageMenuItem.focusBorderWidth, 658 color: { 659 id: -1, 660 type: 10001, 661 params: ["sys.color.ohos_id_color_emphasize"], 662 bundleName: "", 663 moduleName: "" 664 }, 665 style: BorderStyle.Solid 666 } : { 667 width: 0 668 }); 669 Row.onFocus((() => { 670 this.item.isEnabled && (this.isOnFocus = !0) 671 })); 672 Row.onBlur((() => this.isOnFocus = !1)); 673 Row.onHover((e => { 674 this.item.isEnabled && (this.isOnHover = e) 675 })); 676 Row.onKeyEvent((e => { 677 if (this.item.isEnabled && (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE)) { 678 e.type === KeyType.Down && (this.isOnClick = !0); 679 e.type === KeyType.Up && (this.isOnClick = !1) 680 } 681 })); 682 Row.onTouch((e => { 683 if (this.item.isEnabled) { 684 e.type === TouchType.Down && (this.isOnClick = !0); 685 e.type === TouchType.Up && (this.isOnClick = !1) 686 } 687 })); 688 Row.onClick((() => this.item.isEnabled && this.item.action && this.item.action())); 689 t || Row.pop(); 690 ViewStackProcessor.StopGetAccessRecording() 691 })); 692 this.observeComponentCreation(((e, t) => { 693 ViewStackProcessor.StartGetAccessRecordingFor(e); 694 Image.create(this.item.value); 695 Image.width(ImageMenuItem.imageSize); 696 Image.height(ImageMenuItem.imageSize); 697 Image.focusable(this.item.isEnabled); 698 t || Image.pop(); 699 ViewStackProcessor.StopGetAccessRecording() 700 })); 701 Row.pop() 702 } 703 rerender() { 704 this.updateDirtyElements() 705 } 706} 707ImageMenuItem.imageSize = 24; 708ImageMenuItem.imageHotZoneWidth = 48; 709ImageMenuItem.buttonBorderRadius = 8; 710ImageMenuItem.focusBorderWidth = 2; 711ImageMenuItem.disabledImageOpacity = .4; 712export default { 713 ComposeTitleBar: ComposeTitleBar 714};