UNPKG

@lxlib/seed

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.

509 lines (500 loc) 16.2 kB
import { __assign, __decorate, __metadata, __spread } from 'tslib'; import { Injectable, ɵɵdefineInjectable, Component, ChangeDetectionStrategy, ViewEncapsulation, ElementRef, Renderer2, Input, Host, Optional, ViewChild, NgModule } from '@angular/core'; import { updateHostClass, InputNumber, isEmpty, InputBoolean, LxlibUtilModule } from '@lxlib/util'; import { ResponsiveService } from '@lxlib/theme'; import { ObserversModule } from '@angular/cdk/observers'; import { CommonModule } from '@angular/common'; import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzToolTipModule } from 'ng-zorro-antd/tooltip'; /** * @fileoverview added by tsickle * Generated from: sv.config.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var SVConfig = /** @class */ (function () { function SVConfig() { /** * 间距,默认:`32` */ this.gutter = 32; /** * 布局,默认:`horizontal` */ this.layout = 'horizontal'; /** * 列数,默认:`3` */ this.col = 3; /** * 是否显示默认值,当内容为空值时显示 `-`,默认:`true` */ this.default = true; /** * `label` 固定宽度,若 `null` 或 `undefined` 表示非固定,默认:`null` */ this.labelWidth = null; } SVConfig.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ SVConfig.ɵprov = ɵɵdefineInjectable({ factory: function SVConfig_Factory() { return new SVConfig(); }, token: SVConfig, providedIn: "root" }); return SVConfig; }()); if (false) { /** * 大小 * @type {?} */ SVConfig.prototype.size; /** * 间距,默认:`32` * @type {?} */ SVConfig.prototype.gutter; /** * 布局,默认:`horizontal` * @type {?} */ SVConfig.prototype.layout; /** * 列数,默认:`3` * @type {?} */ SVConfig.prototype.col; /** * 是否显示默认值,当内容为空值时显示 `-`,默认:`true` * @type {?} */ SVConfig.prototype.default; /** * `label` 固定宽度,若 `null` 或 `undefined` 表示非固定,默认:`null` * @type {?} */ SVConfig.prototype.labelWidth; } /** * @fileoverview added by tsickle * Generated from: sv-container.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var prefixCls = "sv"; var SVContainerComponent = /** @class */ (function () { // #endregion function SVContainerComponent(el, ren, cog) { this.ren = ren; this.size = 'large'; this.layout = 'horizontal'; this.el = el.nativeElement; Object.assign(this, __assign(__assign({}, new SVConfig()), cog)); } /** * @private * @return {?} */ SVContainerComponent.prototype.setClass = /** * @private * @return {?} */ function () { var _a; var _b = this, el = _b.el, ren = _b.ren, size = _b.size, layout = _b.layout; updateHostClass(el, ren, (_a = {}, _a[prefixCls + "__container"] = true, _a[prefixCls + "__" + size] = true, _a[prefixCls + "__" + layout] = true, _a["clearfix"] = true, _a)); }; /** * @return {?} */ SVContainerComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.setClass(); }; /** * @return {?} */ SVContainerComponent.prototype.ngOnChanges = /** * @return {?} */ function () { this.setClass(); }; SVContainerComponent.decorators = [ { type: Component, args: [{ selector: 'sv-container, [sv-container]', exportAs: 'svContainer', template: "<div class=\"ant-row\"\n [ngStyle]=\"{'margin-left.px': -(gutter / 2), 'margin-right.px': -(gutter / 2)}\">\n <sv-title *ngIf=\"title\">\n <ng-container *nzStringTemplateOutlet=\"title\">{{title}}</ng-container>\n </sv-title>\n <ng-content></ng-content>\n</div>\n", preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ SVContainerComponent.ctorParameters = function () { return [ { type: ElementRef }, { type: Renderer2 }, { type: SVConfig } ]; }; SVContainerComponent.propDecorators = { title: [{ type: Input }], size: [{ type: Input }], gutter: [{ type: Input }], layout: [{ type: Input }], labelWidth: [{ type: Input }], col: [{ type: Input }], default: [{ type: Input }] }; __decorate([ InputNumber(), __metadata("design:type", Number) ], SVContainerComponent.prototype, "gutter", void 0); __decorate([ InputNumber(null), __metadata("design:type", Number) ], SVContainerComponent.prototype, "labelWidth", void 0); __decorate([ InputNumber(), __metadata("design:type", Number) ], SVContainerComponent.prototype, "col", void 0); return SVContainerComponent; }()); if (false) { /** * @type {?} * @private */ SVContainerComponent.prototype.el; /** @type {?} */ SVContainerComponent.prototype.title; /** @type {?} */ SVContainerComponent.prototype.size; /** * 列表项间距,单位为 `px` * @type {?} */ SVContainerComponent.prototype.gutter; /** @type {?} */ SVContainerComponent.prototype.layout; /** @type {?} */ SVContainerComponent.prototype.labelWidth; /** * 指定信息最多分几列展示,最终一行几列由 col 配置结合响应式规则决定 * @type {?} */ SVContainerComponent.prototype.col; /** @type {?} */ SVContainerComponent.prototype.default; /** * @type {?} * @private */ SVContainerComponent.prototype.ren; } /** * @fileoverview added by tsickle * Generated from: sv-title.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var SVTitleComponent = /** @class */ (function () { function SVTitleComponent(el, parent, ren) { this.parent = parent; this.ren = ren; if (parent == null) { throw new Error("[sv-title] must include 'sv-container' component"); } this.el = el.nativeElement; } /** * @private * @return {?} */ SVTitleComponent.prototype.setClass = /** * @private * @return {?} */ function () { var gutter = this.parent.gutter; var el = this.el; this.ren.setStyle(el, 'padding-left', gutter / 2 + "px"); this.ren.setStyle(el, 'padding-right', gutter / 2 + "px"); }; /** * @return {?} */ SVTitleComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.setClass(); }; SVTitleComponent.decorators = [ { type: Component, args: [{ selector: 'sv-title, [sv-title]', exportAs: 'svTitle', template: '<ng-content></ng-content>', host: { '[class.sv__title]': 'true', }, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ SVTitleComponent.ctorParameters = function () { return [ { type: ElementRef }, { type: SVContainerComponent, decorators: [{ type: Host }, { type: Optional }] }, { type: Renderer2 } ]; }; return SVTitleComponent; }()); if (false) { /** * @type {?} * @private */ SVTitleComponent.prototype.el; /** * @type {?} * @private */ SVTitleComponent.prototype.parent; /** * @type {?} * @private */ SVTitleComponent.prototype.ren; } /** * @fileoverview added by tsickle * Generated from: sv.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var prefixCls$1 = "sv"; var SVComponent = /** @class */ (function () { function SVComponent(el, parent, rep, ren) { this.parent = parent; this.rep = rep; this.ren = ren; this.clsMap = []; if (parent == null) { throw new Error("[sv] must include 'sv-container' component"); } this.el = el.nativeElement; } Object.defineProperty(SVComponent.prototype, "paddingValue", { // #endregion get: // #endregion /** * @return {?} */ function () { return this.parent && this.parent.gutter / 2; }, enumerable: true, configurable: true }); Object.defineProperty(SVComponent.prototype, "labelWidth", { get: /** * @return {?} */ function () { var _a = this.parent, labelWidth = _a.labelWidth, layout = _a.layout; return layout === 'horizontal' ? labelWidth : null; }, enumerable: true, configurable: true }); /** * @private * @return {?} */ SVComponent.prototype.setClass = /** * @private * @return {?} */ function () { var _a = this, el = _a.el, ren = _a.ren, col = _a.col, clsMap = _a.clsMap, type = _a.type, rep = _a.rep; clsMap.forEach((/** * @param {?} cls * @return {?} */ function (cls) { return ren.removeClass(el, cls); })); clsMap.length = 0; clsMap.push.apply(clsMap, __spread(rep.genCls(col != null ? col : this.parent.col))); clsMap.push(prefixCls$1 + "__item"); if (this.parent.labelWidth) clsMap.push(prefixCls$1 + "__item-fixed"); if (type) clsMap.push(prefixCls$1 + "__type-" + type); clsMap.forEach((/** * @param {?} cls * @return {?} */ function (cls) { return ren.addClass(el, cls); })); }; /** * @return {?} */ SVComponent.prototype.ngAfterViewInit = /** * @return {?} */ function () { this.setClass(); this.checkContent(); }; /** * @return {?} */ SVComponent.prototype.ngOnChanges = /** * @return {?} */ function () { this.setClass(); }; /** * @return {?} */ SVComponent.prototype.checkContent = /** * @return {?} */ function () { var conEl = this.conEl; /** @type {?} */ var def = this.default; if (!(def != null ? def : this.parent.default)) return; /** @type {?} */ var el = (/** @type {?} */ (conEl.nativeElement)); /** @type {?} */ var cls = "sv__default"; if (el.classList.contains(cls)) { el.classList.remove(cls); } if (isEmpty(el)) { el.classList.add(cls); } }; SVComponent.decorators = [ { type: Component, args: [{ selector: 'sv, [sv]', exportAs: 'sv', template: "<div class=\"sv__label\" [class.sv__label-empty]=\"!label\" [class.sv__label-width]=\"labelWidth !== null\"\n [style.width.px]=\"labelWidth\">\n <span class=\"sv__label-text\">\n <ng-container *nzStringTemplateOutlet=\"label\">{{label}}</ng-container>\n </span>\n <span *ngIf=\"optional || optionalHelp\" class=\"sv__label-optional\" [class.sv__label-optional-no-text]=\"!optional\">\n <ng-container *nzStringTemplateOutlet=\"optional\">{{ optional }}</ng-container>\n <i *ngIf=\"optionalHelp\" nz-tooltip [nzTooltipTitle]=\"optionalHelp\" nz-icon nzType=\"question-circle\"></i>\n </span>\n</div>\n<div class=\"sv__detail\">\n <span (cdkObserveContent)=\"checkContent()\" #conEl>\n <ng-content></ng-content>\n </span>\n <ng-container *ngIf=\"!!unit\">\n <span class=\"sv__unit\" *nzStringTemplateOutlet=\"unit\">{{unit}}</span>\n </ng-container>\n</div>\n", host: { '[style.padding-left.px]': 'paddingValue', '[style.padding-right.px]': 'paddingValue', }, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ SVComponent.ctorParameters = function () { return [ { type: ElementRef }, { type: SVContainerComponent, decorators: [{ type: Host }, { type: Optional }] }, { type: ResponsiveService }, { type: Renderer2 } ]; }; SVComponent.propDecorators = { conEl: [{ type: ViewChild, args: ['conEl', { static: false },] }], optional: [{ type: Input }], optionalHelp: [{ type: Input }], label: [{ type: Input }], unit: [{ type: Input }], col: [{ type: Input }], default: [{ type: Input }], type: [{ type: Input }] }; __decorate([ InputNumber(null), __metadata("design:type", Number) ], SVComponent.prototype, "col", void 0); __decorate([ InputBoolean(null), __metadata("design:type", Boolean) ], SVComponent.prototype, "default", void 0); return SVComponent; }()); if (false) { /** * @type {?} * @private */ SVComponent.prototype.conEl; /** * @type {?} * @private */ SVComponent.prototype.el; /** * @type {?} * @private */ SVComponent.prototype.clsMap; /** @type {?} */ SVComponent.prototype.optional; /** @type {?} */ SVComponent.prototype.optionalHelp; /** @type {?} */ SVComponent.prototype.label; /** @type {?} */ SVComponent.prototype.unit; /** @type {?} */ SVComponent.prototype.col; /** @type {?} */ SVComponent.prototype.default; /** @type {?} */ SVComponent.prototype.type; /** @type {?} */ SVComponent.prototype.parent; /** * @type {?} * @private */ SVComponent.prototype.rep; /** * @type {?} * @private */ SVComponent.prototype.ren; } /** * @fileoverview added by tsickle * Generated from: sv.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var COMPONENTS = [SVContainerComponent, SVComponent, SVTitleComponent]; var SVModule = /** @class */ (function () { function SVModule() { } SVModule.decorators = [ { type: NgModule, args: [{ imports: [CommonModule, ObserversModule, LxlibUtilModule, NzToolTipModule, NzIconModule, NzOutletModule], declarations: __spread(COMPONENTS), exports: __spread(COMPONENTS), },] } ]; return SVModule; }()); /** * @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: view.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { SVComponent, SVConfig, SVContainerComponent, SVModule, SVTitleComponent }; //# sourceMappingURL=view.js.map