@ohayojp.com/components
Version:
Common business components of ohayojp.
203 lines (195 loc) • 6.61 kB
JavaScript
import { Component, ChangeDetectionStrategy, ViewEncapsulation, ViewChild, Input, Inject, ContentChildren, NgModule } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { Router, RouterModule } from '@angular/router';
import { WINDOW } from '@ohayojp.com/theme';
import { __decorate, __metadata } from 'tslib';
import { InputBoolean, OhayoUtilModule } from '@ohayojp.com/util';
import { CommonModule } from '@angular/common';
/**
* @fileoverview added by tsickle
* Generated from: global-footer.types.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function GlobalFooterLink() { }
if (false) {
/** @type {?} */
GlobalFooterLink.prototype.title;
/** @type {?} */
GlobalFooterLink.prototype.href;
/** @type {?|undefined} */
GlobalFooterLink.prototype.blankTarget;
/* Skipping unhandled member: [key: string]: any;*/
}
/**
* @fileoverview added by tsickle
* Generated from: global-footer-item.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class GlobalFooterItemComponent {
}
GlobalFooterItemComponent.decorators = [
{
type: Component, args: [{
selector: 'global-footer-item',
exportAs: 'globalFooterItem',
template: ` <ng-template #host><ng-content></ng-content></ng-template> `,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
}]
}
];
GlobalFooterItemComponent.propDecorators = {
host: [{ type: ViewChild, args: ['host', { static: true },] }],
href: [{ type: Input }],
blankTarget: [{ type: Input }]
};
__decorate([
InputBoolean(),
__metadata("design:type", Boolean)
], GlobalFooterItemComponent.prototype, "blankTarget", void 0);
if (false) {
/** @type {?} */
GlobalFooterItemComponent.ngAcceptInputType_blankTarget;
/** @type {?} */
GlobalFooterItemComponent.prototype.host;
/** @type {?} */
GlobalFooterItemComponent.prototype.href;
/** @type {?} */
GlobalFooterItemComponent.prototype.blankTarget;
}
/**
* @fileoverview added by tsickle
* Generated from: global-footer.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class GlobalFooterComponent {
/**
* @param {?} router
* @param {?} win
* @param {?} dom
*/
constructor(router, win, dom) {
this.router = router;
this.win = win;
this.dom = dom;
this._links = [];
}
/**
* @param {?} val
* @return {?}
*/
set links(val) {
val.forEach((/**
* @param {?} i
* @return {?}
*/
i => (i._title = this.dom.bypassSecurityTrustHtml(i.title))));
this._links = val;
}
/**
* @return {?}
*/
get links() {
return this._links;
}
/**
* @param {?} item
* @return {?}
*/
to(item) {
if (!item.href) {
return;
}
if (item.blankTarget) {
this.win.open(item.href);
return;
}
if (/^https?:\/\//.test(item.href)) {
this.win.location.href = item.href;
}
else {
this.router.navigateByUrl(item.href);
}
}
}
GlobalFooterComponent.decorators = [
{
type: Component, args: [{
selector: 'global-footer',
exportAs: 'globalFooter',
template: "<div *ngIf=\"links.length > 0 || items.length > 0\" class=\"global-footer__links\">\n <a *ngFor=\"let i of links\" class=\"global-footer__links-item\" (click)=\"to(i)\" [innerHTML]=\"i._title\"></a>\n <a *ngFor=\"let i of items\" class=\"global-footer__links-item\" (click)=\"to(i)\">\n <ng-container *ngTemplateOutlet=\"i.host\"></ng-container>\n </a>\n</div>\n<div class=\"global-footer__copyright\">\n <ng-content></ng-content>\n</div>\n",
host: { '[class.global-footer]': 'true' },
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
}]
}
];
/** @nocollapse */
GlobalFooterComponent.ctorParameters = () => [
{ type: Router },
{ type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] },
{ type: DomSanitizer }
];
GlobalFooterComponent.propDecorators = {
links: [{ type: Input }],
items: [{ type: ContentChildren, args: [GlobalFooterItemComponent,] }]
};
if (false) {
/**
* @type {?}
* @private
*/
GlobalFooterComponent.prototype._links;
/** @type {?} */
GlobalFooterComponent.prototype.items;
/**
* @type {?}
* @private
*/
GlobalFooterComponent.prototype.router;
/**
* @type {?}
* @private
*/
GlobalFooterComponent.prototype.win;
/**
* @type {?}
* @private
*/
GlobalFooterComponent.prototype.dom;
}
/**
* @fileoverview added by tsickle
* Generated from: global-footer.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const COMPONENTS = [GlobalFooterComponent, GlobalFooterItemComponent];
class GlobalFooterModule {
}
GlobalFooterModule.decorators = [
{
type: NgModule, args: [{
imports: [CommonModule, RouterModule, OhayoUtilModule],
declarations: [...COMPONENTS],
exports: [...COMPONENTS],
},]
}
];
/**
* @fileoverview added by tsickle
* Generated from: public_api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: globalFooter.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { GlobalFooterComponent, GlobalFooterItemComponent, GlobalFooterModule };
//# sourceMappingURL=globalFooter.js.map