ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 11 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/bidi"),require("@angular/common"),require("@angular/core"),require("@angular/forms"),require("ng-zorro-antd/date-picker"),require("ng-zorro-antd/i18n"),require("ng-zorro-antd/radio"),require("ng-zorro-antd/select"),require("ng-zorro-antd/core/time"),require("ng-zorro-antd/core/util"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("ng-zorro-antd/calendar",["exports","@angular/cdk/bidi","@angular/common","@angular/core","@angular/forms","ng-zorro-antd/date-picker","ng-zorro-antd/i18n","ng-zorro-antd/radio","ng-zorro-antd/select","ng-zorro-antd/core/time","ng-zorro-antd/core/util","rxjs","rxjs/operators"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].calendar={}),e.ng.cdk.bidi,e.ng.common,e.ng.core,e.ng.forms,e["ng-zorro-antd"]["date-picker"],e["ng-zorro-antd"].i18n,e["ng-zorro-antd"].radio,e["ng-zorro-antd"].select,e["ng-zorro-antd"].core.time,e["ng-zorro-antd"].core.util,e.rxjs,e.rxjs.operators)}(this,(function(e,t,n,a,r,o,l,i,c,s,d,u,p){"use strict";var h=function(){};h.decorators=[{type:a.Directive,args:[{selector:"[nzDateCell]",exportAs:"nzDateCell"}]}];var g=function(){};g.decorators=[{type:a.Directive,args:[{selector:"[nzMonthCell]",exportAs:"nzMonthCell"}]}];var f=function(){};f.decorators=[{type:a.Directive,args:[{selector:"[nzDateFullCell]",exportAs:"nzDateFullCell"}]}];var y=function(){};y.decorators=[{type:a.Directive,args:[{selector:"[nzMonthFullCell]",exportAs:"nzMonthFullCell"}]}];var z=function(){function e(e,t,n){this.i18n=e,this.dateHelper=t,this.elementRef=n,this.mode="month",this.fullscreen=!0,this.activeDate=new s.CandyDate,this.modeChange=new a.EventEmitter,this.yearChange=new a.EventEmitter,this.monthChange=new a.EventEmitter,this.yearOffset=10,this.yearTotal=20,this.years=[],this.months=[],this.elementRef.nativeElement.classList.add("ant-fullcalendar-header")}return Object.defineProperty(e.prototype,"activeYear",{get:function(){return this.activeDate.getYear()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeMonth",{get:function(){return this.activeDate.getMonth()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.fullscreen?"default":"small"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"yearTypeText",{get:function(){return this.i18n.getLocale().Calendar.lang.year},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"monthTypeText",{get:function(){return this.i18n.getLocale().Calendar.lang.month},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){this.setUpYears(),this.setUpMonths()},e.prototype.updateYear=function(e){this.yearChange.emit(e),this.setUpYears(e)},e.prototype.setUpYears=function(e){var t=(e||this.activeYear)-this.yearOffset,n=t+this.yearTotal;this.years=[];for(var a=t;a<n;a++)this.years.push({label:""+a,value:a})},e.prototype.setUpMonths=function(){this.months=[];for(var e=0;e<12;e++){var t=this.activeDate.setMonth(e),n=this.dateHelper.format(t.nativeDate,"MMM");this.months.push({label:n,value:e})}},e}();z.decorators=[{type:a.Component,args:[{encapsulation:a.ViewEncapsulation.None,changeDetection:a.ChangeDetectionStrategy.OnPush,selector:"nz-calendar-header",exportAs:"nzCalendarHeader",template:'\n <div class="ant-picker-calendar-header">\n <nz-select\n class="ant-picker-calendar-year-select"\n [nzSize]="size"\n [nzDropdownMatchSelectWidth]="false"\n [ngModel]="activeYear"\n (ngModelChange)="updateYear($event)"\n >\n <nz-option *ngFor="let year of years" [nzLabel]="year.label" [nzValue]="year.value"></nz-option>\n </nz-select>\n\n <nz-select\n *ngIf="mode === \'month\'"\n class="ant-picker-calendar-month-select"\n [nzSize]="size"\n [nzDropdownMatchSelectWidth]="false"\n [ngModel]="activeMonth"\n (ngModelChange)="monthChange.emit($event)"\n >\n <nz-option *ngFor="let month of months" [nzLabel]="month.label" [nzValue]="month.value"></nz-option>\n </nz-select>\n\n <nz-radio-group class="ant-picker-calendar-mode-switch" [(ngModel)]="mode" (ngModelChange)="modeChange.emit($event)" [nzSize]="size">\n <label nz-radio-button nzValue="month">{{ monthTypeText }}</label>\n <label nz-radio-button nzValue="year">{{ yearTypeText }}</label>\n </nz-radio-group>\n </div>\n ',host:{"[style.display]":"'block'"}}]}],z.ctorParameters=function(){return[{type:l.NzI18nService},{type:l.DateHelperService},{type:a.ElementRef}]},z.propDecorators={mode:[{type:a.Input}],fullscreen:[{type:a.Input}],activeDate:[{type:a.Input}],modeChange:[{type:a.Output}],yearChange:[{type:a.Output}],monthChange:[{type:a.Output}]};Object.create;Object.create;var C=function(){function e(e,t,n){this.cdr=e,this.elementRef=t,this.directionality=n,this.activeDate=new s.CandyDate,this.prefixCls="ant-picker-calendar",this.destroy$=new u.Subject,this.dir="ltr",this.onChangeFn=function(){},this.onTouchFn=function(){},this.nzMode="month",this.nzModeChange=new a.EventEmitter,this.nzPanelChange=new a.EventEmitter,this.nzSelectChange=new a.EventEmitter,this.nzValueChange=new a.EventEmitter,this.nzFullscreen=!0,this.elementRef.nativeElement.classList.add("ant-picker-calendar")}return Object.defineProperty(e.prototype,"dateCell",{get:function(){return this.nzDateCell||this.nzDateCellChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dateFullCell",{get:function(){return this.nzDateFullCell||this.nzDateFullCellChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"monthCell",{get:function(){return this.nzMonthCell||this.nzMonthCellChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"monthFullCell",{get:function(){return this.nzMonthFullCell||this.nzMonthFullCellChild},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e,t=this;this.dir=this.directionality.value,null===(e=this.directionality.change)||void 0===e||e.pipe(p.takeUntil(this.destroy$)).subscribe((function(){t.dir=t.directionality.value}))},e.prototype.onModeChange=function(e){this.nzModeChange.emit(e),this.nzPanelChange.emit({date:this.activeDate.nativeDate,mode:e})},e.prototype.onYearSelect=function(e){var t=this.activeDate.setYear(e);this.updateDate(t)},e.prototype.onMonthSelect=function(e){var t=this.activeDate.setMonth(e);this.updateDate(t)},e.prototype.onDateSelect=function(e){this.updateDate(e)},e.prototype.writeValue=function(e){this.updateDate(new s.CandyDate(e),!1),this.cdr.markForCheck()},e.prototype.registerOnChange=function(e){this.onChangeFn=e},e.prototype.registerOnTouched=function(e){this.onTouchFn=e},e.prototype.updateDate=function(e,t){void 0===t&&(t=!0),this.activeDate=e,t&&(this.onChangeFn(e.nativeDate),this.onTouchFn(),this.nzSelectChange.emit(e.nativeDate),this.nzValueChange.emit(e.nativeDate))},e.prototype.ngOnChanges=function(e){e.nzValue&&this.updateDate(new s.CandyDate(this.nzValue),!1)},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e}();C.decorators=[{type:a.Component,args:[{encapsulation:a.ViewEncapsulation.None,changeDetection:a.ChangeDetectionStrategy.OnPush,selector:"nz-calendar",exportAs:"nzCalendar",template:'\n <nz-calendar-header\n [fullscreen]="nzFullscreen"\n [activeDate]="activeDate"\n [(mode)]="nzMode"\n (modeChange)="onModeChange($event)"\n (yearChange)="onYearSelect($event)"\n (monthChange)="onMonthSelect($event)"\n ></nz-calendar-header>\n\n <div class="ant-picker-panel">\n <div class="ant-picker-{{ nzMode === \'month\' ? \'date\' : \'month\' }}-panel">\n <div class="ant-picker-body">\n <ng-container *ngIf="nzMode === \'month\'; then monthModeTable; else yearModeTable"></ng-container>\n </div>\n </div>\n </div>\n <ng-template #monthModeTable>\n \x3c!-- TODO(@wenqi73) [cellRender] [fullCellRender] --\x3e\n <date-table\n [prefixCls]="prefixCls"\n [value]="activeDate"\n [activeDate]="activeDate"\n [cellRender]="$any(dateCell)"\n [fullCellRender]="$any(dateFullCell)"\n [disabledDate]="nzDisabledDate"\n (valueChange)="onDateSelect($event)"\n ></date-table>\n </ng-template>\n\n \x3c!-- TODO(@wenqi73) [cellRender] [fullCellRender] --\x3e\n <ng-template #yearModeTable>\n <month-table\n [prefixCls]="prefixCls"\n [value]="activeDate"\n [activeDate]="activeDate"\n [cellRender]="$any(monthCell)"\n [fullCellRender]="$any(monthFullCell)"\n (valueChange)="onDateSelect($event)"\n ></month-table>\n </ng-template>\n ',host:{"[class.ant-picker-calendar-full]":"nzFullscreen","[class.ant-picker-calendar-mini]":"!nzFullscreen","[class.ant-picker-calendar-rtl]":"dir === 'rtl'"},providers:[{provide:r.NG_VALUE_ACCESSOR,useExisting:a.forwardRef((function(){return C})),multi:!0}]}]}],C.ctorParameters=function(){return[{type:a.ChangeDetectorRef},{type:a.ElementRef},{type:t.Directionality,decorators:[{type:a.Optional}]}]},C.propDecorators={nzMode:[{type:a.Input}],nzValue:[{type:a.Input}],nzDisabledDate:[{type:a.Input}],nzModeChange:[{type:a.Output}],nzPanelChange:[{type:a.Output}],nzSelectChange:[{type:a.Output}],nzValueChange:[{type:a.Output}],nzDateCell:[{type:a.Input}],nzDateCellChild:[{type:a.ContentChild,args:[h,{static:!1,read:a.TemplateRef}]}],nzDateFullCell:[{type:a.Input}],nzDateFullCellChild:[{type:a.ContentChild,args:[f,{static:!1,read:a.TemplateRef}]}],nzMonthCell:[{type:a.Input}],nzMonthCellChild:[{type:a.ContentChild,args:[g,{static:!1,read:a.TemplateRef}]}],nzMonthFullCell:[{type:a.Input}],nzMonthFullCellChild:[{type:a.ContentChild,args:[y,{static:!1,read:a.TemplateRef}]}],nzFullscreen:[{type:a.Input}]},function(e,t,n,a){var r,o=arguments.length,l=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,a);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(l=(o<3?r(l):o>3?r(t,n,l):r(t,n))||l);o>3&&l&&Object.defineProperty(t,n,l)}([d.InputBoolean(),function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}("design:type",Boolean)],C.prototype,"nzFullscreen",void 0);var m=function(){};m.decorators=[{type:a.NgModule,args:[{declarations:[z,C,h,f,g,y],exports:[C,h,f,g,y],imports:[t.BidiModule,n.CommonModule,r.FormsModule,l.NzI18nModule,i.NzRadioModule,c.NzSelectModule,o.LibPackerModule]}]}],e.NzCalendarComponent=C,e.NzCalendarHeaderComponent=z,e.NzCalendarModule=m,e.NzDateCellDirective=h,e.NzDateFullCellDirective=f,e.NzMonthCellDirective=g,e.NzMonthFullCellDirective=y,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-calendar.umd.min.js.map