@ng-nest/ui 13.0.2 → 13.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/carousel/carousel-panel.component.d.ts +2 -3
- package/date-picker/date-picker.property.d.ts +51 -1
- package/date-picker/date-range-portal.component.d.ts +7 -5
- package/date-picker/date-range.component.d.ts +5 -1
- package/date-picker/examples/en_US/default/disabled/README.md +1 -1
- package/date-picker/examples/en_US/default/time/README.md +6 -0
- package/date-picker/examples/zh_CN/default/disabled/README.md +1 -1
- package/date-picker/examples/zh_CN/default/time/README.md +6 -0
- package/date-picker/picker-date.component.d.ts +3 -0
- package/esm2020/button/button.component.mjs +2 -2
- package/esm2020/carousel/carousel-panel.component.mjs +11 -10
- package/esm2020/date-picker/date-picker.property.mjs +72 -2
- package/esm2020/date-picker/date-range-portal.component.mjs +45 -26
- package/esm2020/date-picker/date-range.component.mjs +31 -8
- package/esm2020/date-picker/picker-date.component.mjs +31 -4
- package/esm2020/menu/menu.component.mjs +2 -2
- package/esm2020/table/table.property.mjs +1 -1
- package/fesm2015/ng-nest-ui-button.mjs +2 -2
- package/fesm2015/ng-nest-ui-carousel.mjs +10 -10
- package/fesm2015/ng-nest-ui-carousel.mjs.map +1 -1
- package/fesm2015/ng-nest-ui-date-picker.mjs +175 -36
- package/fesm2015/ng-nest-ui-date-picker.mjs.map +1 -1
- package/fesm2015/ng-nest-ui-menu.mjs +1 -1
- package/fesm2015/ng-nest-ui-menu.mjs.map +1 -1
- package/fesm2015/ng-nest-ui-table.mjs.map +1 -1
- package/fesm2020/ng-nest-ui-button.mjs +2 -2
- package/fesm2020/ng-nest-ui-carousel.mjs +10 -9
- package/fesm2020/ng-nest-ui-carousel.mjs.map +1 -1
- package/fesm2020/ng-nest-ui-date-picker.mjs +175 -36
- package/fesm2020/ng-nest-ui-date-picker.mjs.map +1 -1
- package/fesm2020/ng-nest-ui-menu.mjs +1 -1
- package/fesm2020/ng-nest-ui-menu.mjs.map +1 -1
- package/fesm2020/ng-nest-ui-table.mjs.map +1 -1
- package/package.json +1 -1
- package/table/table.property.d.ts +1 -1
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { EventEmitter, Component, Input, Output, ViewEncapsulation, ChangeDetectionStrategy, HostBinding, HostListener, ViewChild, NgModule } from '@angular/core';
|
|
3
3
|
import { __decorate } from 'tslib';
|
|
4
4
|
import * as i2 from '@ng-nest/ui/core';
|
|
5
|
-
import { XWithConfig, XInputBoolean, XDataConvert, XProperty, XIsChange, chunk, XIsEmpty, XAddDays, XConnectBaseAnimation, XIsDate, XIsNumber, XIsString, XClearClass, XAddMonths, XIsUndefined } from '@ng-nest/ui/core';
|
|
5
|
+
import { XWithConfig, XInputBoolean, XDataConvert, XProperty, XIsChange, chunk, XIsEmpty, XAddDays, XConnectBaseAnimation, XIsDate, XIsNumber, XIsString, XClearClass, XAddMonths, XAddYears, XIsUndefined } from '@ng-nest/ui/core';
|
|
6
6
|
import { XControlValueAccessor, XValueAccessor, XBaseFormModule } from '@ng-nest/ui/base-form';
|
|
7
7
|
import { Subject } from 'rxjs';
|
|
8
8
|
import { map, takeUntil } from 'rxjs/operators';
|
|
@@ -207,6 +207,31 @@ class XPickerDateProperty extends XProperty {
|
|
|
207
207
|
* @en_US Display switch button
|
|
208
208
|
*/
|
|
209
209
|
this.showHeader = true;
|
|
210
|
+
/**
|
|
211
|
+
* @zh_CN 上一年
|
|
212
|
+
* @en_US Last year
|
|
213
|
+
*/
|
|
214
|
+
this.lastYearBtn = true;
|
|
215
|
+
/**
|
|
216
|
+
* @zh_CN 上月
|
|
217
|
+
* @en_US Last month
|
|
218
|
+
*/
|
|
219
|
+
this.lastMonthBtn = true;
|
|
220
|
+
/**
|
|
221
|
+
* @zh_CN 下一年
|
|
222
|
+
* @en_US Next year
|
|
223
|
+
*/
|
|
224
|
+
this.nextYearBtn = true;
|
|
225
|
+
/**
|
|
226
|
+
* @zh_CN 上月
|
|
227
|
+
* @en_US Next month
|
|
228
|
+
*/
|
|
229
|
+
this.nextMonthBtn = true;
|
|
230
|
+
/**
|
|
231
|
+
* @zh_CN 范围日期
|
|
232
|
+
* @en_US Range date
|
|
233
|
+
*/
|
|
234
|
+
this.rangeValue = [];
|
|
210
235
|
/**
|
|
211
236
|
* @zh_CN 选择类型
|
|
212
237
|
* @en_US Select type
|
|
@@ -222,16 +247,43 @@ class XPickerDateProperty extends XProperty {
|
|
|
222
247
|
* @en_US Scope change event
|
|
223
248
|
*/
|
|
224
249
|
this.rangeChange = new EventEmitter();
|
|
250
|
+
/**
|
|
251
|
+
* @zh_CN 选年的事件
|
|
252
|
+
* @en_US Year change event
|
|
253
|
+
*/
|
|
254
|
+
this.yearChange = new EventEmitter();
|
|
255
|
+
/**
|
|
256
|
+
* @zh_CN 选月的事件
|
|
257
|
+
* @en_US Month change event
|
|
258
|
+
*/
|
|
259
|
+
this.monthChange = new EventEmitter();
|
|
260
|
+
/**
|
|
261
|
+
* @zh_CN 显示日期事件
|
|
262
|
+
* @en_US display date event
|
|
263
|
+
*/
|
|
264
|
+
this.displayChange = new EventEmitter();
|
|
225
265
|
}
|
|
226
266
|
}
|
|
227
267
|
/** @nocollapse */ /** @nocollapse */ XPickerDateProperty.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XPickerDateProperty, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
228
|
-
/** @nocollapse */ /** @nocollapse */ XPickerDateProperty.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: XPickerDateProperty, selector: "ng-component", inputs: { type: "type", display: "display", model: "model", dateTemp: "dateTemp", showHeader: "showHeader", rangePicker: "rangePicker" }, outputs: { typeChange: "typeChange", modelChange: "modelChange", rangeChange: "rangeChange" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
268
|
+
/** @nocollapse */ /** @nocollapse */ XPickerDateProperty.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: XPickerDateProperty, selector: "ng-component", inputs: { type: "type", display: "display", model: "model", dateTemp: "dateTemp", showHeader: "showHeader", rangePicker: "rangePicker", lastYearBtn: "lastYearBtn", lastMonthBtn: "lastMonthBtn", nextYearBtn: "nextYearBtn", nextMonthBtn: "nextMonthBtn", rangeValue: "rangeValue", rangeType: "rangeType" }, outputs: { typeChange: "typeChange", modelChange: "modelChange", rangeChange: "rangeChange", yearChange: "yearChange", monthChange: "monthChange", displayChange: "displayChange" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
229
269
|
__decorate([
|
|
230
270
|
XInputBoolean()
|
|
231
271
|
], XPickerDateProperty.prototype, "showHeader", void 0);
|
|
232
272
|
__decorate([
|
|
233
273
|
XInputBoolean()
|
|
234
274
|
], XPickerDateProperty.prototype, "rangePicker", void 0);
|
|
275
|
+
__decorate([
|
|
276
|
+
XInputBoolean()
|
|
277
|
+
], XPickerDateProperty.prototype, "lastYearBtn", void 0);
|
|
278
|
+
__decorate([
|
|
279
|
+
XInputBoolean()
|
|
280
|
+
], XPickerDateProperty.prototype, "lastMonthBtn", void 0);
|
|
281
|
+
__decorate([
|
|
282
|
+
XInputBoolean()
|
|
283
|
+
], XPickerDateProperty.prototype, "nextYearBtn", void 0);
|
|
284
|
+
__decorate([
|
|
285
|
+
XInputBoolean()
|
|
286
|
+
], XPickerDateProperty.prototype, "nextMonthBtn", void 0);
|
|
235
287
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XPickerDateProperty, decorators: [{
|
|
236
288
|
type: Component,
|
|
237
289
|
args: [{ template: '' }]
|
|
@@ -247,12 +299,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
247
299
|
type: Input
|
|
248
300
|
}], rangePicker: [{
|
|
249
301
|
type: Input
|
|
302
|
+
}], lastYearBtn: [{
|
|
303
|
+
type: Input
|
|
304
|
+
}], lastMonthBtn: [{
|
|
305
|
+
type: Input
|
|
306
|
+
}], nextYearBtn: [{
|
|
307
|
+
type: Input
|
|
308
|
+
}], nextMonthBtn: [{
|
|
309
|
+
type: Input
|
|
310
|
+
}], rangeValue: [{
|
|
311
|
+
type: Input
|
|
312
|
+
}], rangeType: [{
|
|
313
|
+
type: Input
|
|
250
314
|
}], typeChange: [{
|
|
251
315
|
type: Output
|
|
252
316
|
}], modelChange: [{
|
|
253
317
|
type: Output
|
|
254
318
|
}], rangeChange: [{
|
|
255
319
|
type: Output
|
|
320
|
+
}], yearChange: [{
|
|
321
|
+
type: Output
|
|
322
|
+
}], monthChange: [{
|
|
323
|
+
type: Output
|
|
324
|
+
}], displayChange: [{
|
|
325
|
+
type: Output
|
|
256
326
|
}] } });
|
|
257
327
|
/**
|
|
258
328
|
* PickerMonth
|
|
@@ -414,6 +484,18 @@ class XPickerDateComponent extends XPickerDateProperty {
|
|
|
414
484
|
this.locale = {};
|
|
415
485
|
this._unSubject = new Subject();
|
|
416
486
|
}
|
|
487
|
+
get rangeStart() {
|
|
488
|
+
if (this.rangeValue && this.rangeValue.length > 0) {
|
|
489
|
+
return this.rangeValue[0];
|
|
490
|
+
}
|
|
491
|
+
return '';
|
|
492
|
+
}
|
|
493
|
+
get rangeEnd() {
|
|
494
|
+
if (this.rangeValue && this.rangeValue.length > 1) {
|
|
495
|
+
return this.rangeValue[1];
|
|
496
|
+
}
|
|
497
|
+
return '';
|
|
498
|
+
}
|
|
417
499
|
ngOnInit() {
|
|
418
500
|
this.i18n.localeChange
|
|
419
501
|
.pipe(map((x) => x.datePicker), takeUntil(this._unSubject))
|
|
@@ -423,8 +505,11 @@ class XPickerDateComponent extends XPickerDateProperty {
|
|
|
423
505
|
});
|
|
424
506
|
}
|
|
425
507
|
ngOnChanges(simples) {
|
|
426
|
-
const { display } = simples;
|
|
508
|
+
const { display, rangeType } = simples;
|
|
427
509
|
XIsChange(display) && this.init();
|
|
510
|
+
if (rangeType) {
|
|
511
|
+
console.log(this.rangeType);
|
|
512
|
+
}
|
|
428
513
|
}
|
|
429
514
|
ngOnDestory() {
|
|
430
515
|
this._unSubject.next();
|
|
@@ -477,20 +562,32 @@ class XPickerDateComponent extends XPickerDateProperty {
|
|
|
477
562
|
getLocaleMonth(date) {
|
|
478
563
|
return this.locale[this.lowerCasePipe.transform(this.datePipe.transform(date, 'LLLL'))];
|
|
479
564
|
}
|
|
565
|
+
rangeDisabled(date) {
|
|
566
|
+
if (this.rangeType === 'end') {
|
|
567
|
+
return this.rangeStart !== '' && date.getTime() < this.rangeStart;
|
|
568
|
+
}
|
|
569
|
+
else if (this.rangeType === 'start') {
|
|
570
|
+
return this.rangeEnd !== '' && date.getTime() > this.rangeEnd;
|
|
571
|
+
}
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
480
574
|
setDisplay(date) {
|
|
481
575
|
this.display = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
576
|
+
this.displayChange.emit(this.display);
|
|
482
577
|
this.setDays(this.display);
|
|
483
578
|
}
|
|
484
579
|
nextMonth(num) {
|
|
485
580
|
let date = new Date(this.display);
|
|
486
581
|
date.setMonth(date.getMonth() + num);
|
|
487
582
|
this.setDisplay(date);
|
|
583
|
+
this.monthChange.emit(num);
|
|
488
584
|
this.cdr.detectChanges();
|
|
489
585
|
}
|
|
490
586
|
nextYear(num) {
|
|
491
587
|
let date = new Date(this.display);
|
|
492
588
|
date.setFullYear(date.getFullYear() + num);
|
|
493
589
|
this.setDisplay(date);
|
|
590
|
+
this.yearChange.emit(num);
|
|
494
591
|
this.cdr.detectChanges();
|
|
495
592
|
}
|
|
496
593
|
typeOnChange(type) {
|
|
@@ -503,10 +600,10 @@ class XPickerDateComponent extends XPickerDateProperty {
|
|
|
503
600
|
}
|
|
504
601
|
}
|
|
505
602
|
/** @nocollapse */ /** @nocollapse */ XPickerDateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XPickerDateComponent, deps: [{ token: i0.Renderer2 }, { token: i1.DatePipe }, { token: i1.LowerCasePipe }, { token: i0.ChangeDetectorRef }, { token: i2.XConfigService }, { token: i3.XI18nService }], target: i0.ɵɵFactoryTarget.Component });
|
|
506
|
-
/** @nocollapse */ /** @nocollapse */ XPickerDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: XPickerDateComponent, selector: "x-picker-date", providers: [DatePipe, LowerCasePipe], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"x-picker-date\" [class.x-date-picker-datetemp]=\"dateTemp\">\r\n <div class=\"x-picker-date-header\" *ngIf=\"showHeader\">\r\n <x-button icon=\"fto-chevrons-left\" size=\"small\" onlyIcon (click)=\"nextYear(-1)\"></x-button>\r\n <x-button icon=\"fto-chevron-left\" size=\"small\" onlyIcon (click)=\"nextMonth(-1)\"></x-button>\r\n <div class=\"x-picker-date-year-month\">\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeOnChange('year')\">{{ display | date: 'yyyy' }}{{ locale.year }}</x-button>\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeOnChange('month')\">{{ getLocaleMonth(display) }}</x-button>\r\n </div>\r\n <x-button icon=\"fto-chevron-right\" size=\"small\" onlyIcon (click)=\"nextMonth(1)\"></x-button>\r\n <x-button icon=\"fto-chevrons-right\" size=\"small\" onlyIcon (click)=\"nextYear(1)\"></x-button>\r\n </div>\r\n <div class=\"x-picker-date-body\">\r\n <table cellspacing=\"0\" cellpadding=\"0\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let title of titles; trackBy: trackByNode\">{{ title | xI18n }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let weeks of dates\">\r\n <ng-container *ngFor=\"let week of weeks; trackBy: trackByNode\">\r\n <td\r\n [class.x-date-last-or-next]=\"(week | date: 'yyyyMM') !== (display | date: 'yyyyMM')\"\r\n [class.x-date-now]=\"(week | date: 'yyyyMMdd') === (now | date: 'yyyyMMdd')\"\r\n (click)=\"dateTemp && dateClick(week)\"\r\n >\r\n <x-button\r\n *ngIf=\"!dateTemp\"\r\n type=\"text\"\r\n size=\"mini\"\r\n title=\"{{ week | date: 'yyyy-MM-dd' }}\"\r\n [activated]=\"!rangePicker && (week | date: 'yyyyMMdd') === (model | date: 'yyyyMMdd')\"\r\n (click)=\"dateClick(week)\"\r\n >{{ week | date: 'd' }}</x-button\r\n >\r\n <ng-container *ngIf=\"dateTemp\">\r\n <ng-container *ngTemplateOutlet=\"dateTemp; context: { date$: week }\"></ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n</div>\r\n", styles: ["@charset \"UTF-8\";.x-picker-date{margin:0;padding:0}.x-picker-date-header{display:flex;align-items:center;justify-content:space-between;padding:.5rem;border-bottom:var(--x-border-width) solid var(--x-border)}.x-picker-date-year-month{flex:1;text-align:center}.x-picker-date-body{padding:.5rem}.x-picker-date-body>table{width:100%;border-collapse:collapse;border-spacing:0}.x-picker-date-body>table th{font-weight:400;height:2rem;color:var(--x-text-400)}.x-picker-date-body>table td{padding:.25rem 0;text-align:center}.x-picker-date-body>table td x-button .x-button{width:1.625rem;height:1.5rem;margin:0 auto;border:.0625rem solid transparent}.x-picker-date-body>table td x-button .x-button:hover{background-color:var(--x-primary-900)}.x-picker-date-body>table td x-button .x-button-activated{color:var(--x-background-100);background-color:var(--x-primary)}.x-picker-date-body>table td x-button .x-button-activated:hover{color:var(--x-background-100);background-color:var(--x-primary)}.x-picker-date-body>table td.x-date-last-or-next x-button .x-button{color:var(--x-text-700)}.x-picker-date-body>table td.x-date-now x-button .x-button:not(.x-button-activated){color:var(--x-primary);background-color:transparent;border-color:var(--x-primary)}\n"], components: [{ type: i4.XButtonComponent, selector: "x-button" }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "date": i1.DatePipe, "xI18n": i3.XI18nPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
603
|
+
/** @nocollapse */ /** @nocollapse */ XPickerDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: XPickerDateComponent, selector: "x-picker-date", providers: [DatePipe, LowerCasePipe], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"x-picker-date\" [class.x-date-picker-datetemp]=\"dateTemp\">\r\n <div class=\"x-picker-date-header\" *ngIf=\"showHeader\">\r\n <x-button icon=\"fto-chevrons-left\" size=\"small\" onlyIcon (click)=\"nextYear(-1)\" [class.x-visibility]=\"!lastYearBtn\"></x-button>\r\n <x-button icon=\"fto-chevron-left\" size=\"small\" onlyIcon (click)=\"nextMonth(-1)\" [class.x-visibility]=\"!lastMonthBtn\"></x-button>\r\n <div class=\"x-picker-date-year-month\">\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeOnChange('year')\">{{ display | date: 'yyyy' }}{{ locale.year }}</x-button>\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeOnChange('month')\">{{ getLocaleMonth(display) }}</x-button>\r\n </div>\r\n <x-button icon=\"fto-chevron-right\" size=\"small\" onlyIcon (click)=\"nextMonth(1)\" [class.x-visibility]=\"!nextYearBtn\"></x-button>\r\n <x-button icon=\"fto-chevrons-right\" size=\"small\" onlyIcon (click)=\"nextYear(1)\" [class.x-visibility]=\"!nextMonthBtn\"></x-button>\r\n </div>\r\n <div class=\"x-picker-date-body\">\r\n <table cellspacing=\"0\" cellpadding=\"0\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let title of titles; trackBy: trackByNode\">{{ title | xI18n }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let weeks of dates\">\r\n <ng-container *ngFor=\"let week of weeks; trackBy: trackByNode\">\r\n <td\r\n [class.x-date-last-or-next]=\"(week | date: 'yyyyMM') !== (display | date: 'yyyyMM')\"\r\n [class.x-date-now]=\"(week | date: 'yyyyMMdd') === (now | date: 'yyyyMMdd')\"\r\n (click)=\"dateTemp && dateClick(week)\"\r\n >\r\n <x-button\r\n *ngIf=\"!dateTemp\"\r\n type=\"text\"\r\n size=\"mini\"\r\n title=\"{{ week | date: 'yyyy-MM-dd' }}\"\r\n [activated]=\"!rangePicker && (week | date: 'yyyyMMdd') === (model | date: 'yyyyMMdd')\"\r\n [disabled]=\"false\"\r\n (click)=\"dateClick(week)\"\r\n >{{ week | date: 'd' }}</x-button\r\n >\r\n <ng-container *ngIf=\"dateTemp\">\r\n <ng-container *ngTemplateOutlet=\"dateTemp; context: { date$: week }\"></ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n</div>\r\n", styles: ["@charset \"UTF-8\";.x-picker-date{margin:0;padding:0}.x-picker-date-header{display:flex;align-items:center;justify-content:space-between;padding:.5rem;border-bottom:var(--x-border-width) solid var(--x-border)}.x-picker-date-year-month{flex:1;text-align:center}.x-picker-date-body{padding:.5rem}.x-picker-date-body>table{width:100%;border-collapse:collapse;border-spacing:0}.x-picker-date-body>table th{font-weight:400;height:2rem;color:var(--x-text-400)}.x-picker-date-body>table td{padding:.25rem 0;text-align:center}.x-picker-date-body>table td x-button .x-button{width:1.625rem;height:1.5rem;margin:0 auto;border:.0625rem solid transparent}.x-picker-date-body>table td x-button .x-button:hover{background-color:var(--x-primary-900)}.x-picker-date-body>table td x-button .x-button-activated{color:var(--x-background-100);background-color:var(--x-primary)}.x-picker-date-body>table td x-button .x-button-activated:hover{color:var(--x-background-100);background-color:var(--x-primary)}.x-picker-date-body>table td.x-date-last-or-next x-button .x-button{color:var(--x-text-700)}.x-picker-date-body>table td.x-date-now x-button .x-button:not(.x-button-activated){color:var(--x-primary);background-color:transparent;border-color:var(--x-primary)}.x-picker-date .x-visibility{visibility:hidden}\n"], components: [{ type: i4.XButtonComponent, selector: "x-button" }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "date": i1.DatePipe, "xI18n": i3.XI18nPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
507
604
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XPickerDateComponent, decorators: [{
|
|
508
605
|
type: Component,
|
|
509
|
-
args: [{ selector: `${XPickerDatePrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [DatePipe, LowerCasePipe], template: "<div class=\"x-picker-date\" [class.x-date-picker-datetemp]=\"dateTemp\">\r\n <div class=\"x-picker-date-header\" *ngIf=\"showHeader\">\r\n <x-button icon=\"fto-chevrons-left\" size=\"small\" onlyIcon (click)=\"nextYear(-1)\"></x-button>\r\n <x-button icon=\"fto-chevron-left\" size=\"small\" onlyIcon (click)=\"nextMonth(-1)\"></x-button>\r\n <div class=\"x-picker-date-year-month\">\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeOnChange('year')\">{{ display | date: 'yyyy' }}{{ locale.year }}</x-button>\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeOnChange('month')\">{{ getLocaleMonth(display) }}</x-button>\r\n </div>\r\n <x-button icon=\"fto-chevron-right\" size=\"small\" onlyIcon (click)=\"nextMonth(1)\"></x-button>\r\n <x-button icon=\"fto-chevrons-right\" size=\"small\" onlyIcon (click)=\"nextYear(1)\"></x-button>\r\n </div>\r\n <div class=\"x-picker-date-body\">\r\n <table cellspacing=\"0\" cellpadding=\"0\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let title of titles; trackBy: trackByNode\">{{ title | xI18n }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let weeks of dates\">\r\n <ng-container *ngFor=\"let week of weeks; trackBy: trackByNode\">\r\n <td\r\n [class.x-date-last-or-next]=\"(week | date: 'yyyyMM') !== (display | date: 'yyyyMM')\"\r\n [class.x-date-now]=\"(week | date: 'yyyyMMdd') === (now | date: 'yyyyMMdd')\"\r\n (click)=\"dateTemp && dateClick(week)\"\r\n >\r\n <x-button\r\n *ngIf=\"!dateTemp\"\r\n type=\"text\"\r\n size=\"mini\"\r\n title=\"{{ week | date: 'yyyy-MM-dd' }}\"\r\n [activated]=\"!rangePicker && (week | date: 'yyyyMMdd') === (model | date: 'yyyyMMdd')\"\r\n (click)=\"dateClick(week)\"\r\n >{{ week | date: 'd' }}</x-button\r\n >\r\n <ng-container *ngIf=\"dateTemp\">\r\n <ng-container *ngTemplateOutlet=\"dateTemp; context: { date$: week }\"></ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n</div>\r\n", styles: ["@charset \"UTF-8\";.x-picker-date{margin:0;padding:0}.x-picker-date-header{display:flex;align-items:center;justify-content:space-between;padding:.5rem;border-bottom:var(--x-border-width) solid var(--x-border)}.x-picker-date-year-month{flex:1;text-align:center}.x-picker-date-body{padding:.5rem}.x-picker-date-body>table{width:100%;border-collapse:collapse;border-spacing:0}.x-picker-date-body>table th{font-weight:400;height:2rem;color:var(--x-text-400)}.x-picker-date-body>table td{padding:.25rem 0;text-align:center}.x-picker-date-body>table td x-button .x-button{width:1.625rem;height:1.5rem;margin:0 auto;border:.0625rem solid transparent}.x-picker-date-body>table td x-button .x-button:hover{background-color:var(--x-primary-900)}.x-picker-date-body>table td x-button .x-button-activated{color:var(--x-background-100);background-color:var(--x-primary)}.x-picker-date-body>table td x-button .x-button-activated:hover{color:var(--x-background-100);background-color:var(--x-primary)}.x-picker-date-body>table td.x-date-last-or-next x-button .x-button{color:var(--x-text-700)}.x-picker-date-body>table td.x-date-now x-button .x-button:not(.x-button-activated){color:var(--x-primary);background-color:transparent;border-color:var(--x-primary)}\n"] }]
|
|
606
|
+
args: [{ selector: `${XPickerDatePrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [DatePipe, LowerCasePipe], template: "<div class=\"x-picker-date\" [class.x-date-picker-datetemp]=\"dateTemp\">\r\n <div class=\"x-picker-date-header\" *ngIf=\"showHeader\">\r\n <x-button icon=\"fto-chevrons-left\" size=\"small\" onlyIcon (click)=\"nextYear(-1)\" [class.x-visibility]=\"!lastYearBtn\"></x-button>\r\n <x-button icon=\"fto-chevron-left\" size=\"small\" onlyIcon (click)=\"nextMonth(-1)\" [class.x-visibility]=\"!lastMonthBtn\"></x-button>\r\n <div class=\"x-picker-date-year-month\">\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeOnChange('year')\">{{ display | date: 'yyyy' }}{{ locale.year }}</x-button>\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeOnChange('month')\">{{ getLocaleMonth(display) }}</x-button>\r\n </div>\r\n <x-button icon=\"fto-chevron-right\" size=\"small\" onlyIcon (click)=\"nextMonth(1)\" [class.x-visibility]=\"!nextYearBtn\"></x-button>\r\n <x-button icon=\"fto-chevrons-right\" size=\"small\" onlyIcon (click)=\"nextYear(1)\" [class.x-visibility]=\"!nextMonthBtn\"></x-button>\r\n </div>\r\n <div class=\"x-picker-date-body\">\r\n <table cellspacing=\"0\" cellpadding=\"0\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let title of titles; trackBy: trackByNode\">{{ title | xI18n }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let weeks of dates\">\r\n <ng-container *ngFor=\"let week of weeks; trackBy: trackByNode\">\r\n <td\r\n [class.x-date-last-or-next]=\"(week | date: 'yyyyMM') !== (display | date: 'yyyyMM')\"\r\n [class.x-date-now]=\"(week | date: 'yyyyMMdd') === (now | date: 'yyyyMMdd')\"\r\n (click)=\"dateTemp && dateClick(week)\"\r\n >\r\n <x-button\r\n *ngIf=\"!dateTemp\"\r\n type=\"text\"\r\n size=\"mini\"\r\n title=\"{{ week | date: 'yyyy-MM-dd' }}\"\r\n [activated]=\"!rangePicker && (week | date: 'yyyyMMdd') === (model | date: 'yyyyMMdd')\"\r\n [disabled]=\"false\"\r\n (click)=\"dateClick(week)\"\r\n >{{ week | date: 'd' }}</x-button\r\n >\r\n <ng-container *ngIf=\"dateTemp\">\r\n <ng-container *ngTemplateOutlet=\"dateTemp; context: { date$: week }\"></ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n</div>\r\n", styles: ["@charset \"UTF-8\";.x-picker-date{margin:0;padding:0}.x-picker-date-header{display:flex;align-items:center;justify-content:space-between;padding:.5rem;border-bottom:var(--x-border-width) solid var(--x-border)}.x-picker-date-year-month{flex:1;text-align:center}.x-picker-date-body{padding:.5rem}.x-picker-date-body>table{width:100%;border-collapse:collapse;border-spacing:0}.x-picker-date-body>table th{font-weight:400;height:2rem;color:var(--x-text-400)}.x-picker-date-body>table td{padding:.25rem 0;text-align:center}.x-picker-date-body>table td x-button .x-button{width:1.625rem;height:1.5rem;margin:0 auto;border:.0625rem solid transparent}.x-picker-date-body>table td x-button .x-button:hover{background-color:var(--x-primary-900)}.x-picker-date-body>table td x-button .x-button-activated{color:var(--x-background-100);background-color:var(--x-primary)}.x-picker-date-body>table td x-button .x-button-activated:hover{color:var(--x-background-100);background-color:var(--x-primary)}.x-picker-date-body>table td.x-date-last-or-next x-button .x-button{color:var(--x-text-700)}.x-picker-date-body>table td.x-date-now x-button .x-button:not(.x-button-activated){color:var(--x-primary);background-color:transparent;border-color:var(--x-primary)}.x-picker-date .x-visibility{visibility:hidden}\n"] }]
|
|
510
607
|
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i1.DatePipe }, { type: i1.LowerCasePipe }, { type: i0.ChangeDetectorRef }, { type: i2.XConfigService }, { type: i3.XI18nService }]; } });
|
|
511
608
|
|
|
512
609
|
class XPickerMonthComponent extends XPickerMonthProperty {
|
|
@@ -1069,6 +1166,10 @@ class XDateRangePortalComponent {
|
|
|
1069
1166
|
this.placement = x;
|
|
1070
1167
|
this.cdr.detectChanges();
|
|
1071
1168
|
});
|
|
1169
|
+
this.inputActiveChange.pipe(takeUntil(this._unSubject)).subscribe((x) => {
|
|
1170
|
+
this.activeType = x;
|
|
1171
|
+
this.setDefault();
|
|
1172
|
+
});
|
|
1072
1173
|
this.i18n.localeChange
|
|
1073
1174
|
.pipe(map((x) => x.datePicker), takeUntil(this._unSubject))
|
|
1074
1175
|
.subscribe((x) => {
|
|
@@ -1092,50 +1193,65 @@ class XDateRangePortalComponent {
|
|
|
1092
1193
|
this.model = this.display;
|
|
1093
1194
|
this.startModel = this.model;
|
|
1094
1195
|
this.endModel = XAddMonths(this.model, 1);
|
|
1196
|
+
this.setDisplay(this.model);
|
|
1095
1197
|
}
|
|
1096
|
-
this.time = this.model.getTime();
|
|
1097
1198
|
this._type = this.type;
|
|
1098
|
-
this.setDisplay(this.model);
|
|
1099
1199
|
this.cdr.detectChanges();
|
|
1100
1200
|
}
|
|
1101
1201
|
stopPropagation(event) {
|
|
1102
1202
|
event.stopPropagation();
|
|
1103
1203
|
}
|
|
1104
1204
|
setDefault() {
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
if (this.value.length > 0) {
|
|
1205
|
+
const type = this.activeType || 'start';
|
|
1206
|
+
if (type === 'start') {
|
|
1108
1207
|
this.startModel = new Date(this.value[0]);
|
|
1109
1208
|
this.startDisplay = this.startModel;
|
|
1209
|
+
this.endModel = XAddMonths(this.startModel, 1);
|
|
1210
|
+
this.endDisplay = this.endModel;
|
|
1110
1211
|
}
|
|
1111
|
-
if (
|
|
1212
|
+
else if (type === 'end') {
|
|
1112
1213
|
this.endModel = new Date(this.value[1]);
|
|
1113
1214
|
this.endDisplay = this.endModel;
|
|
1215
|
+
this.startModel = XAddMonths(this.endModel, -1);
|
|
1216
|
+
this.startDisplay = this.startModel;
|
|
1114
1217
|
}
|
|
1218
|
+
this.cdr.detectChanges();
|
|
1115
1219
|
}
|
|
1116
1220
|
setDisplay(date) {
|
|
1117
1221
|
this.display = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
1118
1222
|
this.startDisplay = this.display;
|
|
1119
1223
|
this.endDisplay = XAddMonths(this.display, 1);
|
|
1120
1224
|
}
|
|
1121
|
-
dateChange(date) {
|
|
1225
|
+
dateChange(date, type) {
|
|
1122
1226
|
let time = date.getTime();
|
|
1123
1227
|
if (this.value.length === 0) {
|
|
1124
|
-
this.value
|
|
1228
|
+
this.value = [time];
|
|
1125
1229
|
this.startNodeEmit(date);
|
|
1126
1230
|
}
|
|
1127
1231
|
else if (this.value.length === 1) {
|
|
1128
1232
|
if (time > this.value[0]) {
|
|
1129
|
-
this.value.
|
|
1233
|
+
this.value = [...this.value, time];
|
|
1130
1234
|
this.endNodeEmit(date);
|
|
1131
1235
|
}
|
|
1132
1236
|
else {
|
|
1133
|
-
this.value.
|
|
1237
|
+
this.value = [time, ...this.value];
|
|
1134
1238
|
this.startNodeEmit(date);
|
|
1135
1239
|
this.endNodeEmit(new Date(this.value[1]));
|
|
1136
1240
|
}
|
|
1137
1241
|
this.nodeEmit(this.value.map((x) => new Date(x)));
|
|
1138
1242
|
}
|
|
1243
|
+
else {
|
|
1244
|
+
if (type === 'start') {
|
|
1245
|
+
this.value = [time, this.value[1]];
|
|
1246
|
+
this.startNodeEmit(date);
|
|
1247
|
+
}
|
|
1248
|
+
else if (type === 'end') {
|
|
1249
|
+
this.value = [this.value[0], time];
|
|
1250
|
+
this.cdr.detectChanges();
|
|
1251
|
+
this.endNodeEmit(date);
|
|
1252
|
+
}
|
|
1253
|
+
this.nodeEmit(this.value.map((x) => new Date(x)), type !== 'start');
|
|
1254
|
+
}
|
|
1139
1255
|
}
|
|
1140
1256
|
typeChange(type) {
|
|
1141
1257
|
this.type = type;
|
|
@@ -1189,18 +1305,6 @@ class XDateRangePortalComponent {
|
|
|
1189
1305
|
getLocaleMonth(date) {
|
|
1190
1306
|
return this.locale[this.lowerCasePipe.transform(this.datePipe.transform(date, 'LLLL'))];
|
|
1191
1307
|
}
|
|
1192
|
-
onToday() {
|
|
1193
|
-
this.dateChange(new Date());
|
|
1194
|
-
}
|
|
1195
|
-
onYesterday() {
|
|
1196
|
-
this.dateChange(XAddDays(new Date(), -1));
|
|
1197
|
-
}
|
|
1198
|
-
onTomorrow() {
|
|
1199
|
-
this.dateChange(XAddDays(new Date(), 1));
|
|
1200
|
-
}
|
|
1201
|
-
onPresetFunc(item) {
|
|
1202
|
-
this.dateChange(item.func());
|
|
1203
|
-
}
|
|
1204
1308
|
selectTime(time) {
|
|
1205
1309
|
this.time = time.getTime();
|
|
1206
1310
|
// this.nodeEmit(this.setModel(this.model, time), false);
|
|
@@ -1210,12 +1314,24 @@ class XDateRangePortalComponent {
|
|
|
1210
1314
|
this.model = new Date(date.getFullYear(), date.getMonth(), date.getDate(), time.getHours(), time.getMinutes(), time.getSeconds());
|
|
1211
1315
|
return this.model;
|
|
1212
1316
|
}
|
|
1317
|
+
startYearChange(num) {
|
|
1318
|
+
this.endDisplay = XAddYears(this.endDisplay, num);
|
|
1319
|
+
}
|
|
1320
|
+
endYearChange(num) {
|
|
1321
|
+
this.startDisplay = XAddYears(this.startDisplay, num);
|
|
1322
|
+
}
|
|
1323
|
+
startMonthChange(num) {
|
|
1324
|
+
this.endDisplay = XAddMonths(this.endDisplay, num);
|
|
1325
|
+
}
|
|
1326
|
+
endMonthChange(num) {
|
|
1327
|
+
this.startDisplay = XAddMonths(this.startDisplay, num);
|
|
1328
|
+
}
|
|
1213
1329
|
}
|
|
1214
1330
|
/** @nocollapse */ /** @nocollapse */ XDateRangePortalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XDateRangePortalComponent, deps: [{ token: i1.DatePipe }, { token: i1.LowerCasePipe }, { token: i0.ChangeDetectorRef }, { token: i3.XI18nService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1215
|
-
/** @nocollapse */ /** @nocollapse */ XDateRangePortalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: XDateRangePortalComponent, selector: "x-date-range-portal", host: { listeners: { "@x-connect-base-animation.done": "done($event)", "@x-connect-base-animation.start": "start($event)" }, properties: { "@x-connect-base-animation": "this.placement" } }, providers: [DatePipe, LowerCasePipe], ngImport: i0, template: "<div class=\"x-date-range-portal {{ type }}\" [ngSwitch]=\"type\">\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <div class=\"x-date-range-portal-
|
|
1331
|
+
/** @nocollapse */ /** @nocollapse */ XDateRangePortalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: XDateRangePortalComponent, selector: "x-date-range-portal", host: { listeners: { "@x-connect-base-animation.done": "done($event)", "@x-connect-base-animation.start": "start($event)" }, properties: { "@x-connect-base-animation": "this.placement" } }, providers: [DatePipe, LowerCasePipe], ngImport: i0, template: "<div class=\"x-date-range-portal {{ type }}\" [ngSwitch]=\"type\">\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <div class=\"x-date-range-portal-body\">\r\n <x-picker-date\r\n class=\"x-date-range-portal-start\"\r\n [(display)]=\"startDisplay\"\r\n [model]=\"startModel\"\r\n [rangeValue]=\"value\"\r\n [rangeType]=\"activeType\"\r\n [nextYearBtn]=\"false\"\r\n [nextMonthBtn]=\"false\"\r\n (modelChange)=\"dateChange($event, 'start')\"\r\n (yearChange)=\"startYearChange($event)\"\r\n (monthChange)=\"startMonthChange($event)\"\r\n rangePicker\r\n ></x-picker-date>\r\n <x-picker-date\r\n class=\"x-date-range-portal-end\"\r\n [(display)]=\"endDisplay\"\r\n [model]=\"endModel\"\r\n [rangeValue]=\"value\"\r\n [rangeType]=\"activeType\"\r\n [lastYearBtn]=\"false\"\r\n [lastMonthBtn]=\"false\"\r\n (modelChange)=\"dateChange($event, 'end')\"\r\n (yearChange)=\"endYearChange($event)\"\r\n (monthChange)=\"endMonthChange($event)\"\r\n rangePicker\r\n ></x-picker-date>\r\n </div>\r\n </ng-container>\r\n</div>\r\n\r\n<ng-template #startDateHeaderTpl>\r\n <x-button icon=\"fto-chevrons-left\" size=\"small\" onlyIcon (click)=\"nextYear(-1)\"></x-button>\r\n <x-button icon=\"fto-chevron-left\" size=\"small\" onlyIcon (click)=\"nextMonth(-1)\"></x-button>\r\n <div class=\"x-date-range-portal-year-month\">\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeChange('year')\">{{ startDisplay | date: 'yyyy' }}{{ locale.year }}</x-button>\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeChange('month')\">{{ getLocaleMonth(startDisplay) }}</x-button>\r\n </div>\r\n <x-button icon=\"fto-chevron-right\" size=\"small\" onlyIcon style=\"visibility: hidden\"></x-button>\r\n <x-button icon=\"fto-chevrons-right\" size=\"small\" onlyIcon style=\"visibility: hidden\"></x-button>\r\n</ng-template>\r\n\r\n<ng-template #endDateHeaderTpl>\r\n <x-button icon=\"fto-chevrons-left\" size=\"small\" onlyIcon (click)=\"nextYear(-1)\" style=\"visibility: hidden\"></x-button>\r\n <x-button icon=\"fto-chevron-left\" size=\"small\" onlyIcon (click)=\"nextMonth(-1)\" style=\"visibility: hidden\"></x-button>\r\n <div class=\"x-date-range-portal-year-month\">\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeChange('year')\">{{ endDisplay | date: 'yyyy' }}{{ locale.year }}</x-button>\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeChange('month')\">{{ getLocaleMonth(endDisplay) }}</x-button>\r\n </div>\r\n <x-button icon=\"fto-chevron-right\" size=\"small\" onlyIcon (click)=\"nextMonth(1)\"></x-button>\r\n <x-button icon=\"fto-chevrons-right\" size=\"small\" onlyIcon (click)=\"nextYear(1)\"></x-button>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";.x-date-range-portal{margin:.0625rem 0;font-size:var(--x-font-size);color:var(--x-text);border:var(--x-border-width) var(--x-border-style) var(--x-border);border-radius:var(--x-border-radius);box-shadow:var(--x-box-shadow) var(--x-box-shadow-light-color);background-color:var(--x-background);width:34rem;display:flex;flex-direction:column;font-size:var(--x-font-size-small)}.x-date-range-portal.date-time{width:27rem}.x-date-range-portal.date-hour{width:19.75rem}.x-date-range-portal.date-minute{width:23.375rem}.x-date-range-portal-content{display:flex}.x-date-range-portal-header{display:flex;align-items:center;justify-content:space-between;padding:.4rem;border-bottom:var(--x-border-width) solid var(--x-border)}.x-date-range-portal-preset{display:flex;align-items:center;justify-content:center;border-top:var(--x-border-width) solid var(--x-border)}.x-date-range-portal-preset>x-button{flex:1}.x-date-range-portal-year-month{flex:1;text-align:center}.x-date-range-portal-body{display:flex}.x-date-range-portal-start{flex:1}.x-date-range-portal-end{flex:1}.x-date-range-portal-footer{display:flex;justify-content:flex-end;border-top:var(--x-border-width) var(--x-border-style) var(--x-border);padding:.5rem}.x-date-range-portal-date{flex:1}.x-date-range-portal-time{display:flex;flex-direction:column}.x-date-range-portal-time-label{padding:.4rem;text-align:center;border-left:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-date-range-portal-time .x-time-picker-frame{border-width:var(--x-border-width) 0 0 var(--x-border-width);box-shadow:none}\n"], components: [{ type: XPickerDateComponent, selector: "x-picker-date" }, { type: i4.XButtonComponent, selector: "x-button" }], directives: [{ type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "date": i1.DatePipe }, animations: [XConnectBaseAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1216
1332
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XDateRangePortalComponent, decorators: [{
|
|
1217
1333
|
type: Component,
|
|
1218
|
-
args: [{ selector: `${XDateRangePortalPrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [XConnectBaseAnimation], providers: [DatePipe, LowerCasePipe], template: "<div class=\"x-date-range-portal {{ type }}\" [ngSwitch]=\"type\">\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <div class=\"x-date-range-portal-
|
|
1334
|
+
args: [{ selector: `${XDateRangePortalPrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [XConnectBaseAnimation], providers: [DatePipe, LowerCasePipe], template: "<div class=\"x-date-range-portal {{ type }}\" [ngSwitch]=\"type\">\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <div class=\"x-date-range-portal-body\">\r\n <x-picker-date\r\n class=\"x-date-range-portal-start\"\r\n [(display)]=\"startDisplay\"\r\n [model]=\"startModel\"\r\n [rangeValue]=\"value\"\r\n [rangeType]=\"activeType\"\r\n [nextYearBtn]=\"false\"\r\n [nextMonthBtn]=\"false\"\r\n (modelChange)=\"dateChange($event, 'start')\"\r\n (yearChange)=\"startYearChange($event)\"\r\n (monthChange)=\"startMonthChange($event)\"\r\n rangePicker\r\n ></x-picker-date>\r\n <x-picker-date\r\n class=\"x-date-range-portal-end\"\r\n [(display)]=\"endDisplay\"\r\n [model]=\"endModel\"\r\n [rangeValue]=\"value\"\r\n [rangeType]=\"activeType\"\r\n [lastYearBtn]=\"false\"\r\n [lastMonthBtn]=\"false\"\r\n (modelChange)=\"dateChange($event, 'end')\"\r\n (yearChange)=\"endYearChange($event)\"\r\n (monthChange)=\"endMonthChange($event)\"\r\n rangePicker\r\n ></x-picker-date>\r\n </div>\r\n </ng-container>\r\n</div>\r\n\r\n<ng-template #startDateHeaderTpl>\r\n <x-button icon=\"fto-chevrons-left\" size=\"small\" onlyIcon (click)=\"nextYear(-1)\"></x-button>\r\n <x-button icon=\"fto-chevron-left\" size=\"small\" onlyIcon (click)=\"nextMonth(-1)\"></x-button>\r\n <div class=\"x-date-range-portal-year-month\">\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeChange('year')\">{{ startDisplay | date: 'yyyy' }}{{ locale.year }}</x-button>\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeChange('month')\">{{ getLocaleMonth(startDisplay) }}</x-button>\r\n </div>\r\n <x-button icon=\"fto-chevron-right\" size=\"small\" onlyIcon style=\"visibility: hidden\"></x-button>\r\n <x-button icon=\"fto-chevrons-right\" size=\"small\" onlyIcon style=\"visibility: hidden\"></x-button>\r\n</ng-template>\r\n\r\n<ng-template #endDateHeaderTpl>\r\n <x-button icon=\"fto-chevrons-left\" size=\"small\" onlyIcon (click)=\"nextYear(-1)\" style=\"visibility: hidden\"></x-button>\r\n <x-button icon=\"fto-chevron-left\" size=\"small\" onlyIcon (click)=\"nextMonth(-1)\" style=\"visibility: hidden\"></x-button>\r\n <div class=\"x-date-range-portal-year-month\">\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeChange('year')\">{{ endDisplay | date: 'yyyy' }}{{ locale.year }}</x-button>\r\n <x-button type=\"text\" size=\"small\" (click)=\"typeChange('month')\">{{ getLocaleMonth(endDisplay) }}</x-button>\r\n </div>\r\n <x-button icon=\"fto-chevron-right\" size=\"small\" onlyIcon (click)=\"nextMonth(1)\"></x-button>\r\n <x-button icon=\"fto-chevrons-right\" size=\"small\" onlyIcon (click)=\"nextYear(1)\"></x-button>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";.x-date-range-portal{margin:.0625rem 0;font-size:var(--x-font-size);color:var(--x-text);border:var(--x-border-width) var(--x-border-style) var(--x-border);border-radius:var(--x-border-radius);box-shadow:var(--x-box-shadow) var(--x-box-shadow-light-color);background-color:var(--x-background);width:34rem;display:flex;flex-direction:column;font-size:var(--x-font-size-small)}.x-date-range-portal.date-time{width:27rem}.x-date-range-portal.date-hour{width:19.75rem}.x-date-range-portal.date-minute{width:23.375rem}.x-date-range-portal-content{display:flex}.x-date-range-portal-header{display:flex;align-items:center;justify-content:space-between;padding:.4rem;border-bottom:var(--x-border-width) solid var(--x-border)}.x-date-range-portal-preset{display:flex;align-items:center;justify-content:center;border-top:var(--x-border-width) solid var(--x-border)}.x-date-range-portal-preset>x-button{flex:1}.x-date-range-portal-year-month{flex:1;text-align:center}.x-date-range-portal-body{display:flex}.x-date-range-portal-start{flex:1}.x-date-range-portal-end{flex:1}.x-date-range-portal-footer{display:flex;justify-content:flex-end;border-top:var(--x-border-width) var(--x-border-style) var(--x-border);padding:.5rem}.x-date-range-portal-date{flex:1}.x-date-range-portal-time{display:flex;flex-direction:column}.x-date-range-portal-time-label{padding:.4rem;text-align:center;border-left:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-date-range-portal-time .x-time-picker-frame{border-width:var(--x-border-width) 0 0 var(--x-border-width);box-shadow:none}\n"] }]
|
|
1219
1335
|
}], ctorParameters: function () { return [{ type: i1.DatePipe }, { type: i1.LowerCasePipe }, { type: i0.ChangeDetectorRef }, { type: i3.XI18nService }]; }, propDecorators: { placement: [{
|
|
1220
1336
|
type: HostBinding,
|
|
1221
1337
|
args: ['@x-connect-base-animation']
|
|
@@ -1249,6 +1365,7 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1249
1365
|
this.valueChange = new Subject();
|
|
1250
1366
|
this.dataChange = new Subject();
|
|
1251
1367
|
this.positionChange = new Subject();
|
|
1368
|
+
this.inputActiveChange = new Subject();
|
|
1252
1369
|
this.closeSubject = new Subject();
|
|
1253
1370
|
this.startDisplay = '';
|
|
1254
1371
|
this.endDisplay = '';
|
|
@@ -1378,6 +1495,8 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1378
1495
|
if (this.portalAttached()) {
|
|
1379
1496
|
(_b = (_a = this.portal) === null || _a === void 0 ? void 0 : _a.overlayRef) === null || _b === void 0 ? void 0 : _b.detach();
|
|
1380
1497
|
this.active = false;
|
|
1498
|
+
this.startActive = false;
|
|
1499
|
+
this.endActive = false;
|
|
1381
1500
|
this.cdr.detectChanges();
|
|
1382
1501
|
return true;
|
|
1383
1502
|
}
|
|
@@ -1389,12 +1508,16 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1389
1508
|
}
|
|
1390
1509
|
showPortal($event, type) {
|
|
1391
1510
|
var _a;
|
|
1392
|
-
$event.stopPropagation();
|
|
1511
|
+
type && $event.stopPropagation();
|
|
1393
1512
|
if (this.disabled || this.animating)
|
|
1394
1513
|
return;
|
|
1395
|
-
this.active = true;
|
|
1396
1514
|
this.startActive = type === 'start';
|
|
1397
1515
|
this.endActive = type === 'end';
|
|
1516
|
+
this.activeType = type;
|
|
1517
|
+
this.activeType && this.inputActiveChange.next(this.activeType);
|
|
1518
|
+
if (this.active)
|
|
1519
|
+
return;
|
|
1520
|
+
this.active = true;
|
|
1398
1521
|
const config = {
|
|
1399
1522
|
backdropClass: '',
|
|
1400
1523
|
positionStrategy: this.setPlacement(),
|
|
@@ -1406,9 +1529,12 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1406
1529
|
viewContainerRef: this.viewContainerRef,
|
|
1407
1530
|
overlayConfig: config
|
|
1408
1531
|
});
|
|
1409
|
-
(_a = this.portal.overlayRef) === null || _a === void 0 ? void 0 : _a.outsidePointerEvents().pipe(takeUntil(this._unSubject)).subscribe(() => {
|
|
1410
|
-
|
|
1411
|
-
this.
|
|
1532
|
+
(_a = this.portal.overlayRef) === null || _a === void 0 ? void 0 : _a.outsidePointerEvents().pipe(takeUntil(this._unSubject)).subscribe((event) => {
|
|
1533
|
+
const clickTarget = event.target;
|
|
1534
|
+
if (clickTarget !== this.inputStartCom.inputRef.nativeElement && clickTarget !== this.inputEndCom.inputRef.nativeElement) {
|
|
1535
|
+
this.setDisplayValue(this.numberValue);
|
|
1536
|
+
this.closeSubject.next();
|
|
1537
|
+
}
|
|
1412
1538
|
});
|
|
1413
1539
|
this.setInstance();
|
|
1414
1540
|
}
|
|
@@ -1431,6 +1557,8 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1431
1557
|
preset: this.preset,
|
|
1432
1558
|
valueChange: this.valueChange,
|
|
1433
1559
|
positionChange: this.positionChange,
|
|
1560
|
+
inputActiveChange: this.inputActiveChange,
|
|
1561
|
+
activeType: this.activeType,
|
|
1434
1562
|
closePortal: () => this.closeSubject.next(),
|
|
1435
1563
|
destroyPortal: () => this.destroyPortal(),
|
|
1436
1564
|
nodeEmit: (dates, sure = true) => this.onNodeClick(dates, sure),
|
|
@@ -1442,6 +1570,9 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1442
1570
|
}
|
|
1443
1571
|
startNodeClick(node) {
|
|
1444
1572
|
this.startDisplay = this.datePipe.transform(node, this.format);
|
|
1573
|
+
this.startActive = false;
|
|
1574
|
+
this.endActive = true;
|
|
1575
|
+
this.inputEndCom.inputFocus('after');
|
|
1445
1576
|
this.cdr.detectChanges();
|
|
1446
1577
|
}
|
|
1447
1578
|
endNodeClick(node) {
|
|
@@ -1474,6 +1605,8 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1474
1605
|
// this.modelChange();
|
|
1475
1606
|
// this.isInput = false;
|
|
1476
1607
|
// } else {
|
|
1608
|
+
if (!dateNumber)
|
|
1609
|
+
return;
|
|
1477
1610
|
this.displayValue = dateNumber.map((x) => this.datePipe.transform(x, this.format));
|
|
1478
1611
|
// }
|
|
1479
1612
|
}
|
|
@@ -1498,16 +1631,22 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1498
1631
|
}
|
|
1499
1632
|
}
|
|
1500
1633
|
/** @nocollapse */ /** @nocollapse */ XDateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XDateRangeComponent, deps: [{ token: i0.Renderer2 }, { token: i2.XConfigService }, { token: i0.ChangeDetectorRef }, { token: i2$1.XPortalService }, { token: i0.ViewContainerRef }, { token: i1.DatePipe }, { token: i4$1.Overlay }], target: i0.ɵɵFactoryTarget.Component });
|
|
1501
|
-
/** @nocollapse */ /** @nocollapse */ XDateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: XDateRangeComponent, selector: "x-date-range", providers: [XValueAccessor(XDateRangeComponent), DatePipe], viewQueries: [{ propertyName: "dateRange", first: true, predicate: ["dateRange"], descendants: true, static: true }, { propertyName: "inputGroup", first: true, predicate: ["inputGroup"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div #dateRange class=\"x-date-range\" [class.x-date-range-active]=\"active\">\r\n <div class=\"x-date-range-row\">\r\n <x-input-group #inputGroup class=\"x-date-range-group\" bordered=\"false\" (click)=\"showPortal($event)\">\r\n <x-input\r\n #inputStartCom\r\n type=\"text\"\r\n placeholder=\"\u5F00\u59CB\u65E5\u671F\"\r\n
|
|
1634
|
+
/** @nocollapse */ /** @nocollapse */ XDateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: XDateRangeComponent, selector: "x-date-range", providers: [XValueAccessor(XDateRangeComponent), DatePipe], viewQueries: [{ propertyName: "dateRange", first: true, predicate: ["dateRange"], descendants: true, static: true }, { propertyName: "inputGroup", first: true, predicate: ["inputGroup"], descendants: true, static: true }, { propertyName: "inputStartCom", first: true, predicate: ["inputStartCom"], descendants: true, static: true }, { propertyName: "inputEndCom", first: true, predicate: ["inputEndCom"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div #dateRange class=\"x-date-range\" [class.x-date-range-active]=\"active\">\r\n <div class=\"x-date-range-row\">\r\n <x-input-group #inputGroup class=\"x-date-range-group\" bordered=\"false\" (click)=\"showPortal($event)\">\r\n <x-input\r\n #inputStartCom\r\n [class.x-input-active]=\"startActive\"\r\n type=\"text\"\r\n placeholder=\"\u5F00\u59CB\u65E5\u671F\"\r\n (click)=\"showPortal($event, 'start')\"\r\n (xFocus)=\"startActive = true\"\r\n (xBlur)=\"startActive = false\"\r\n [(ngModel)]=\"startDisplay\"\r\n ></x-input>\r\n <x-icon type=\"fto-arrow-right\"></x-icon>\r\n <x-input\r\n #inputEndCom\r\n [class.x-input-active]=\"endActive\"\r\n type=\"text\"\r\n placeholder=\"\u7ED3\u675F\u65E5\u671F\"\r\n (click)=\"showPortal($event, 'end')\"\r\n (xFocus)=\"endActive = true\"\r\n (xBlur)=\"endActive = false\"\r\n [(ngModel)]=\"endDisplay\"\r\n ></x-input>\r\n <x-icon [type]=\"icon\"></x-icon>\r\n </x-input-group>\r\n </div>\r\n</div>\r\n", styles: ["@charset \"UTF-8\";x-date-range{display:inline-block}.x-date-range{margin:0;padding:0;width:100%}.x-date-range-row{flex:1;display:flex;align-items:center}.x-date-range-group{display:inline-flex;flex:1;width:100%;font-size:var(--x-font-size);background-color:var(--x-background);background-image:none;border:var(--x-border-width) var(--x-border-style) var(--x-border);border-radius:var(--x-border-radius);box-shadow:var(--x-box-shadow) transparent;transition:all var(--x-animation-duration-slow)}.x-date-range-group .x-input-group{display:flex;align-items:center}.x-date-range-group .x-input-group>x-icon{color:var(--x-text-400);transition:all var(--x-animation-duration-base);z-index:2;padding:.4rem}.x-date-range-group .x-input-group>x-input{width:6rem}.x-date-range-group .x-input-group>x-input input{padding-left:0!important;padding-right:0!important;margin-left:.4rem;margin-right:.4rem;border-radius:0;border-bottom:var(--x-border-width) var(--x-border-style) transparent}.x-date-range-group .x-input-group>x-input .x-input-active input{border-color:var(--x-primary)}.x-date-range-group:hover{border-color:var(--x-primary-300)}.x-date-range-active .x-date-range-group{border-color:var(--x-primary)}\n"], components: [{ type: i5.XInputGroupComponent, selector: "x-input-group" }, { type: i5.XInputComponent, selector: "x-input" }, { type: i6$1.XIconComponent, selector: "x-icon" }], directives: [{ type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1502
1635
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XDateRangeComponent, decorators: [{
|
|
1503
1636
|
type: Component,
|
|
1504
|
-
args: [{ selector: `${XDateRangePrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [XValueAccessor(XDateRangeComponent), DatePipe], template: "<div #dateRange class=\"x-date-range\" [class.x-date-range-active]=\"active\">\r\n <div class=\"x-date-range-row\">\r\n <x-input-group #inputGroup class=\"x-date-range-group\" bordered=\"false\" (click)=\"showPortal($event)\">\r\n <x-input\r\n #inputStartCom\r\n type=\"text\"\r\n placeholder=\"\u5F00\u59CB\u65E5\u671F\"\r\n
|
|
1637
|
+
args: [{ selector: `${XDateRangePrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [XValueAccessor(XDateRangeComponent), DatePipe], template: "<div #dateRange class=\"x-date-range\" [class.x-date-range-active]=\"active\">\r\n <div class=\"x-date-range-row\">\r\n <x-input-group #inputGroup class=\"x-date-range-group\" bordered=\"false\" (click)=\"showPortal($event)\">\r\n <x-input\r\n #inputStartCom\r\n [class.x-input-active]=\"startActive\"\r\n type=\"text\"\r\n placeholder=\"\u5F00\u59CB\u65E5\u671F\"\r\n (click)=\"showPortal($event, 'start')\"\r\n (xFocus)=\"startActive = true\"\r\n (xBlur)=\"startActive = false\"\r\n [(ngModel)]=\"startDisplay\"\r\n ></x-input>\r\n <x-icon type=\"fto-arrow-right\"></x-icon>\r\n <x-input\r\n #inputEndCom\r\n [class.x-input-active]=\"endActive\"\r\n type=\"text\"\r\n placeholder=\"\u7ED3\u675F\u65E5\u671F\"\r\n (click)=\"showPortal($event, 'end')\"\r\n (xFocus)=\"endActive = true\"\r\n (xBlur)=\"endActive = false\"\r\n [(ngModel)]=\"endDisplay\"\r\n ></x-input>\r\n <x-icon [type]=\"icon\"></x-icon>\r\n </x-input-group>\r\n </div>\r\n</div>\r\n", styles: ["@charset \"UTF-8\";x-date-range{display:inline-block}.x-date-range{margin:0;padding:0;width:100%}.x-date-range-row{flex:1;display:flex;align-items:center}.x-date-range-group{display:inline-flex;flex:1;width:100%;font-size:var(--x-font-size);background-color:var(--x-background);background-image:none;border:var(--x-border-width) var(--x-border-style) var(--x-border);border-radius:var(--x-border-radius);box-shadow:var(--x-box-shadow) transparent;transition:all var(--x-animation-duration-slow)}.x-date-range-group .x-input-group{display:flex;align-items:center}.x-date-range-group .x-input-group>x-icon{color:var(--x-text-400);transition:all var(--x-animation-duration-base);z-index:2;padding:.4rem}.x-date-range-group .x-input-group>x-input{width:6rem}.x-date-range-group .x-input-group>x-input input{padding-left:0!important;padding-right:0!important;margin-left:.4rem;margin-right:.4rem;border-radius:0;border-bottom:var(--x-border-width) var(--x-border-style) transparent}.x-date-range-group .x-input-group>x-input .x-input-active input{border-color:var(--x-primary)}.x-date-range-group:hover{border-color:var(--x-primary-300)}.x-date-range-active .x-date-range-group{border-color:var(--x-primary)}\n"] }]
|
|
1505
1638
|
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i2.XConfigService }, { type: i0.ChangeDetectorRef }, { type: i2$1.XPortalService }, { type: i0.ViewContainerRef }, { type: i1.DatePipe }, { type: i4$1.Overlay }]; }, propDecorators: { dateRange: [{
|
|
1506
1639
|
type: ViewChild,
|
|
1507
1640
|
args: ['dateRange', { static: true }]
|
|
1508
1641
|
}], inputGroup: [{
|
|
1509
1642
|
type: ViewChild,
|
|
1510
1643
|
args: ['inputGroup', { static: true }]
|
|
1644
|
+
}], inputStartCom: [{
|
|
1645
|
+
type: ViewChild,
|
|
1646
|
+
args: ['inputStartCom', { static: true }]
|
|
1647
|
+
}], inputEndCom: [{
|
|
1648
|
+
type: ViewChild,
|
|
1649
|
+
args: ['inputEndCom', { static: true }]
|
|
1511
1650
|
}] } });
|
|
1512
1651
|
|
|
1513
1652
|
class XDatePickerModule {
|