UNPKG

@lxlib/seed

Version:

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

16 lines (14 loc) 8.53 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@lxlib/util"),require("@lxlib/theme"),require("@angular/cdk/observers"),require("@angular/common"),require("ng-zorro-antd/core/outlet"),require("ng-zorro-antd/icon"),require("ng-zorro-antd/tooltip")):"function"==typeof define&&define.amd?define("@lxlib/seed/sv",["exports","@angular/core","@lxlib/util","@lxlib/theme","@angular/cdk/observers","@angular/common","ng-zorro-antd/core/outlet","ng-zorro-antd/icon","ng-zorro-antd/tooltip"],e):e(((t=t||self).lxlib=t.lxlib||{},t.lxlib.seed=t.lxlib.seed||{},t.lxlib.seed.sv={}),t.ng.core,t.lxlib.util,t.lxlib.theme,t.ng.cdk.observers,t.ng.common,t["ng-zorro-antd/core/outlet"],t["ng-zorro-antd/icon"],t["ng-zorro-antd/tooltip"])}(this,(function(t,e,n,o,r,i,l,a,s){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */var p=function(){return(p=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function u(t,e,n,o){var r,i=arguments.length,l=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,n,o);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(l=(i<3?r(l):i>3?r(e,n,l):r(e,n))||l);return i>3&&l&&Object.defineProperty(e,n,l),l}function c(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function d(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),l=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)l.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return l}function f(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(d(arguments[e]));return t}var g=function(){function t(){this.gutter=32,this.layout="horizontal",this.col=3,this.default=!0,this.labelWidth=null}return t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new t},token:t,providedIn:"root"}),t}();var h=function(){function t(t,e,n){this.ren=e,this.size="large",this.layout="horizontal",this.el=t.nativeElement,Object.assign(this,p(p({},new g),n))}return t.prototype.setClass=function(){var t,e=this.el,o=this.ren,r=this.size,i=this.layout;n.updateHostClass(e,o,((t={}).sv__container=!0,t["sv__"+r]=!0,t["sv__"+i]=!0,t.clearfix=!0,t))},t.prototype.ngOnInit=function(){this.setClass()},t.prototype.ngOnChanges=function(){this.setClass()},t.decorators=[{type:e.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:!1,changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2},{type:g}]},t.propDecorators={title:[{type:e.Input}],size:[{type:e.Input}],gutter:[{type:e.Input}],layout:[{type:e.Input}],labelWidth:[{type:e.Input}],col:[{type:e.Input}],default:[{type:e.Input}]},u([n.InputNumber(),c("design:type",Number)],t.prototype,"gutter",void 0),u([n.InputNumber(null),c("design:type",Number)],t.prototype,"labelWidth",void 0),u([n.InputNumber(),c("design:type",Number)],t.prototype,"col",void 0),t}();var y=function(){function t(t,e,n){if(this.parent=e,this.ren=n,null==e)throw new Error("[sv-title] must include 'sv-container' component");this.el=t.nativeElement}return t.prototype.setClass=function(){var t=this.parent.gutter,e=this.el;this.ren.setStyle(e,"padding-left",t/2+"px"),this.ren.setStyle(e,"padding-right",t/2+"px")},t.prototype.ngOnInit=function(){this.setClass()},t.decorators=[{type:e.Component,args:[{selector:"sv-title, [sv-title]",exportAs:"svTitle",template:"<ng-content></ng-content>",host:{"[class.sv__title]":"true"},preserveWhitespaces:!1,changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:h,decorators:[{type:e.Host},{type:e.Optional}]},{type:e.Renderer2}]},t}();var v=function(){function t(t,e,n,o){if(this.parent=e,this.rep=n,this.ren=o,this.clsMap=[],null==e)throw new Error("[sv] must include 'sv-container' component");this.el=t.nativeElement}return Object.defineProperty(t.prototype,"paddingValue",{get:function(){return this.parent&&this.parent.gutter/2},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"labelWidth",{get:function(){var t=this.parent,e=t.labelWidth;return"horizontal"===t.layout?e:null},enumerable:!0,configurable:!0}),t.prototype.setClass=function(){var t=this,e=t.el,n=t.ren,o=t.col,r=t.clsMap,i=t.type,l=t.rep;r.forEach((function(t){return n.removeClass(e,t)})),r.length=0,r.push.apply(r,f(l.genCls(null!=o?o:this.parent.col))),r.push("sv__item"),this.parent.labelWidth&&r.push("sv__item-fixed"),i&&r.push("sv__type-"+i),r.forEach((function(t){return n.addClass(e,t)}))},t.prototype.ngAfterViewInit=function(){this.setClass(),this.checkContent()},t.prototype.ngOnChanges=function(){this.setClass()},t.prototype.checkContent=function(){var t=this.conEl,e=this.default;if(null!=e?e:this.parent.default){var o=t.nativeElement,r="sv__default";o.classList.contains(r)&&o.classList.remove(r),n.isEmpty(o)&&o.classList.add(r)}},t.decorators=[{type:e.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:!1,changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:h,decorators:[{type:e.Host},{type:e.Optional}]},{type:o.ResponsiveService},{type:e.Renderer2}]},t.propDecorators={conEl:[{type:e.ViewChild,args:["conEl",{static:!1}]}],optional:[{type:e.Input}],optionalHelp:[{type:e.Input}],label:[{type:e.Input}],unit:[{type:e.Input}],col:[{type:e.Input}],default:[{type:e.Input}],type:[{type:e.Input}]},u([n.InputNumber(null),c("design:type",Number)],t.prototype,"col",void 0),u([n.InputBoolean(null),c("design:type",Boolean)],t.prototype,"default",void 0),t}();var b=[h,v,y],m=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[i.CommonModule,r.ObserversModule,n.LxlibUtilModule,s.NzToolTipModule,a.NzIconModule,l.NzOutletModule],declarations:f(b),exports:f(b)}]}],t}();t.SVComponent=v,t.SVConfig=g,t.SVContainerComponent=h,t.SVModule=m,t.SVTitleComponent=y,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=view.umd.min.js.map