@lxlib/seed
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.
269 lines (261 loc) • 7.51 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Injectable, ɵɵdefineInjectable, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ElementRef, Renderer2, Optional, Host, NgModule } from '@angular/core';
import { InputNumber, LxlibUtilModule } from '@lxlib/util';
import { ResponsiveService } from '@lxlib/theme';
import { CommonModule } from '@angular/common';
/**
* @fileoverview added by tsickle
* Generated from: sg.config.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class SGConfig {
constructor() {
/**
* 间距,默认:`32`
*/
this.gutter = 32;
/**
* 列数,默认:`2`
*/
this.col = 2;
}
}
SGConfig.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */ SGConfig.ɵprov = ɵɵdefineInjectable({ factory: function SGConfig_Factory() { return new SGConfig(); }, token: SGConfig, providedIn: "root" });
if (false) {
/**
* 间距,默认:`32`
* @type {?}
*/
SGConfig.prototype.gutter;
/**
* 列数,默认:`2`
* @type {?}
*/
SGConfig.prototype.col;
}
/**
* @fileoverview added by tsickle
* Generated from: sg-container.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class SGContainerComponent {
/**
* @param {?} cog
*/
constructor(cog) {
Object.assign(this, Object.assign(Object.assign({}, new SGConfig()), cog));
}
// #endregion
/**
* @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: SGConfig }
];
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.prototype.gutter;
/** @type {?} */
SGContainerComponent.prototype.colInCon;
/** @type {?} */
SGContainerComponent.prototype.col;
}
/**
* @fileoverview added by tsickle
* Generated from: sg.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,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 {?}
* @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,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const COMPONENTS = [SGContainerComponent, SGComponent];
class SGModule {
}
SGModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule, LxlibUtilModule],
declarations: [...COMPONENTS],
exports: [...COMPONENTS],
},] }
];
/**
* @fileoverview added by tsickle
* Generated from: public_api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: grid.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { SGComponent, SGConfig, SGContainerComponent, SGModule };
//# sourceMappingURL=grid.js.map