UNPKG

@ohayojp.com/components

Version:

Common business components of ohayojp.

251 lines (244 loc) 7.18 kB
import { __decorate, __metadata } from 'tslib'; import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ElementRef, Renderer2, Optional, Host, NgModule } from '@angular/core'; import { OhayoConfigService, InputNumber, OhayoUtilModule } from '@ohayojp.com/util'; import { ResponsiveService } from '@ohayojp.com/theme'; import { CommonModule } from '@angular/common'; /** * @fileoverview added by tsickle * Generated from: sg-container.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class SGContainerComponent { /** * @param {?} configSrv */ constructor(configSrv) { configSrv.attach(this, 'sg', { gutter: 32, col: 2, }); } /** * @return {?} */ get marginValue() { return -(this.gutter / 2); } } SGContainerComponent.decorators = [ { type: Component, args: [{ selector: 'sg-container, [sg-container]', exportAs: 'sgContainer', template: ` <ng-content></ng-content> `, host: { '[style.margin-left.px]': 'marginValue', '[style.margin-right.px]': 'marginValue', '[class.ant-row]': 'true', '[class.sg__wrap]': 'true', }, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ SGContainerComponent.ctorParameters = () => [ { type: OhayoConfigService } ]; SGContainerComponent.propDecorators = { gutter: [{ type: Input }], colInCon: [{ type: Input, args: ['sg-container',] }], col: [{ type: Input }] }; __decorate([ InputNumber(), __metadata("design:type", Number) ], SGContainerComponent.prototype, "gutter", void 0); __decorate([ InputNumber(null), __metadata("design:type", Number) ], SGContainerComponent.prototype, "colInCon", void 0); __decorate([ InputNumber(null), __metadata("design:type", Number) ], SGContainerComponent.prototype, "col", void 0); if (false) { /** @type {?} */ SGContainerComponent.ngAcceptInputType_gutter; /** @type {?} */ SGContainerComponent.ngAcceptInputType_colInCon; /** @type {?} */ SGContainerComponent.ngAcceptInputType_col; /** @type {?} */ SGContainerComponent.prototype.gutter; /** @type {?} */ SGContainerComponent.prototype.colInCon; /** @type {?} */ SGContainerComponent.prototype.col; } /** * @fileoverview added by tsickle * Generated from: sg.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ const prefixCls = `sg`; class SGComponent { /** * @param {?} el * @param {?} ren * @param {?} parent * @param {?} rep */ constructor(el, ren, parent, rep) { this.ren = ren; this.parent = parent; this.rep = rep; this.clsMap = []; this.inited = false; if (parent == null) { throw new Error(`[sg] must include 'sg-container' component`); } this.el = el.nativeElement; } /** * @return {?} */ get paddingValue() { return this.parent.gutter / 2; } /** * @private * @template THIS * @this {THIS} * @return {THIS} */ setClass() { const { el, ren, clsMap, col, parent } = (/** @type {?} */ (this)); clsMap.forEach((/** * @param {?} cls * @return {?} */ cls => ren.removeClass(el, cls))); clsMap.length = 0; clsMap.push(...(/** @type {?} */ (this)).rep.genCls(col != null ? col : parent.colInCon || parent.col), `${prefixCls}__item`); clsMap.forEach((/** * @param {?} cls * @return {?} */ cls => ren.addClass(el, cls))); return (/** @type {?} */ (this)); } /** * @return {?} */ ngOnChanges() { if (this.inited) this.setClass(); } /** * @return {?} */ ngAfterViewInit() { this.setClass(); this.inited = true; } } SGComponent.decorators = [ { type: Component, args: [{ selector: 'sg', exportAs: 'sg', template: ` <ng-content></ng-content> `, host: { '[style.padding-left.px]': 'paddingValue', '[style.padding-right.px]': 'paddingValue', }, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ SGComponent.ctorParameters = () => [ { type: ElementRef }, { type: Renderer2 }, { type: SGContainerComponent, decorators: [{ type: Optional }, { type: Host }] }, { type: ResponsiveService } ]; SGComponent.propDecorators = { col: [{ type: Input }] }; __decorate([ InputNumber(null), __metadata("design:type", Number) ], SGComponent.prototype, "col", void 0); if (false) { /** @type {?} */ SGComponent.ngAcceptInputType_col; /** * @type {?} * @private */ SGComponent.prototype.el; /** * @type {?} * @private */ SGComponent.prototype.clsMap; /** * @type {?} * @private */ SGComponent.prototype.inited; /** @type {?} */ SGComponent.prototype.col; /** * @type {?} * @private */ SGComponent.prototype.ren; /** * @type {?} * @private */ SGComponent.prototype.parent; /** * @type {?} * @private */ SGComponent.prototype.rep; } /** * @fileoverview added by tsickle * Generated from: sg.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ const COMPONENTS = [SGContainerComponent, SGComponent]; class SGModule { } SGModule.decorators = [ { type: NgModule, args: [{ imports: [CommonModule, 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: grid.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { SGComponent, SGContainerComponent, SGModule }; //# sourceMappingURL=grid.js.map