UNPKG

@tririga/tri-template

Version:

A simple tool for generating IBM TRIRIGA UX view skeletons from available templates.

60 lines (54 loc) 1.59 kB
<script> @ElementCamelCaseBannerRoutingBehavior = { properties: { _showMobileBackButton: { type: Boolean, value: false }, _mobilePageLabel: { type: String, value: null }, _previousPageLabel: String, _openedPopupElement: { type: Object, observer: '_manageAppLayoutBannerPopup' } }, listeners: { 'inbox-route-active': '_manageAppLayoutBannerRoute', 'detail-route-active': '_manageAppLayoutBannerRoute', 'popup-opened': '_setOpenedPopupElement' }, _setOpenedPopupElement: function(e) { this.set('_openedPopupElement', e.detail.element); }, _manageAppLayoutBannerPopup: function() { var openedPopupElement = this._openedPopupElement; if (openedPopupElement) { if ((this._mobilePageLabel === undefined && this._previousPageLabel === undefined) || (this._mobilePageLabel && (this._mobilePageLabel !== this._previousPageLabel))) { this.set('_previousPageLabel', this._mobilePageLabel); } this.set('_showMobileBackButton', true); this.set('_mobilePageLabel', openedPopupElement.title); } else { this.set('_mobilePageLabel', this._previousPageLabel); } }, _manageAppLayoutBannerRoute: function(e) { var routedPage = e.detail; if (e.detail.active) { this.set('_showMobileBackButton', routedPage.hasBackButton); this.set('_mobilePageLabel', routedPage.pageLabel); } }, _handleBackButtonTap: function(e) { if (this._openedPopupElement) { this._openedPopupElement.closePopup(); } else { window.history.back(); } } } </script>