@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 {
|
|
@@ -1066,6 +1163,10 @@ class XDateRangePortalComponent {
|
|
|
1066
1163
|
this.placement = x;
|
|
1067
1164
|
this.cdr.detectChanges();
|
|
1068
1165
|
});
|
|
1166
|
+
this.inputActiveChange.pipe(takeUntil(this._unSubject)).subscribe((x) => {
|
|
1167
|
+
this.activeType = x;
|
|
1168
|
+
this.setDefault();
|
|
1169
|
+
});
|
|
1069
1170
|
this.i18n.localeChange
|
|
1070
1171
|
.pipe(map((x) => x.datePicker), takeUntil(this._unSubject))
|
|
1071
1172
|
.subscribe((x) => {
|
|
@@ -1089,50 +1190,65 @@ class XDateRangePortalComponent {
|
|
|
1089
1190
|
this.model = this.display;
|
|
1090
1191
|
this.startModel = this.model;
|
|
1091
1192
|
this.endModel = XAddMonths(this.model, 1);
|
|
1193
|
+
this.setDisplay(this.model);
|
|
1092
1194
|
}
|
|
1093
|
-
this.time = this.model.getTime();
|
|
1094
1195
|
this._type = this.type;
|
|
1095
|
-
this.setDisplay(this.model);
|
|
1096
1196
|
this.cdr.detectChanges();
|
|
1097
1197
|
}
|
|
1098
1198
|
stopPropagation(event) {
|
|
1099
1199
|
event.stopPropagation();
|
|
1100
1200
|
}
|
|
1101
1201
|
setDefault() {
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
if (this.value.length > 0) {
|
|
1202
|
+
const type = this.activeType || 'start';
|
|
1203
|
+
if (type === 'start') {
|
|
1105
1204
|
this.startModel = new Date(this.value[0]);
|
|
1106
1205
|
this.startDisplay = this.startModel;
|
|
1206
|
+
this.endModel = XAddMonths(this.startModel, 1);
|
|
1207
|
+
this.endDisplay = this.endModel;
|
|
1107
1208
|
}
|
|
1108
|
-
if (
|
|
1209
|
+
else if (type === 'end') {
|
|
1109
1210
|
this.endModel = new Date(this.value[1]);
|
|
1110
1211
|
this.endDisplay = this.endModel;
|
|
1212
|
+
this.startModel = XAddMonths(this.endModel, -1);
|
|
1213
|
+
this.startDisplay = this.startModel;
|
|
1111
1214
|
}
|
|
1215
|
+
this.cdr.detectChanges();
|
|
1112
1216
|
}
|
|
1113
1217
|
setDisplay(date) {
|
|
1114
1218
|
this.display = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
1115
1219
|
this.startDisplay = this.display;
|
|
1116
1220
|
this.endDisplay = XAddMonths(this.display, 1);
|
|
1117
1221
|
}
|
|
1118
|
-
dateChange(date) {
|
|
1222
|
+
dateChange(date, type) {
|
|
1119
1223
|
let time = date.getTime();
|
|
1120
1224
|
if (this.value.length === 0) {
|
|
1121
|
-
this.value
|
|
1225
|
+
this.value = [time];
|
|
1122
1226
|
this.startNodeEmit(date);
|
|
1123
1227
|
}
|
|
1124
1228
|
else if (this.value.length === 1) {
|
|
1125
1229
|
if (time > this.value[0]) {
|
|
1126
|
-
this.value.
|
|
1230
|
+
this.value = [...this.value, time];
|
|
1127
1231
|
this.endNodeEmit(date);
|
|
1128
1232
|
}
|
|
1129
1233
|
else {
|
|
1130
|
-
this.value.
|
|
1234
|
+
this.value = [time, ...this.value];
|
|
1131
1235
|
this.startNodeEmit(date);
|
|
1132
1236
|
this.endNodeEmit(new Date(this.value[1]));
|
|
1133
1237
|
}
|
|
1134
1238
|
this.nodeEmit(this.value.map((x) => new Date(x)));
|
|
1135
1239
|
}
|
|
1240
|
+
else {
|
|
1241
|
+
if (type === 'start') {
|
|
1242
|
+
this.value = [time, this.value[1]];
|
|
1243
|
+
this.startNodeEmit(date);
|
|
1244
|
+
}
|
|
1245
|
+
else if (type === 'end') {
|
|
1246
|
+
this.value = [this.value[0], time];
|
|
1247
|
+
this.cdr.detectChanges();
|
|
1248
|
+
this.endNodeEmit(date);
|
|
1249
|
+
}
|
|
1250
|
+
this.nodeEmit(this.value.map((x) => new Date(x)), type !== 'start');
|
|
1251
|
+
}
|
|
1136
1252
|
}
|
|
1137
1253
|
typeChange(type) {
|
|
1138
1254
|
this.type = type;
|
|
@@ -1186,18 +1302,6 @@ class XDateRangePortalComponent {
|
|
|
1186
1302
|
getLocaleMonth(date) {
|
|
1187
1303
|
return this.locale[this.lowerCasePipe.transform(this.datePipe.transform(date, 'LLLL'))];
|
|
1188
1304
|
}
|
|
1189
|
-
onToday() {
|
|
1190
|
-
this.dateChange(new Date());
|
|
1191
|
-
}
|
|
1192
|
-
onYesterday() {
|
|
1193
|
-
this.dateChange(XAddDays(new Date(), -1));
|
|
1194
|
-
}
|
|
1195
|
-
onTomorrow() {
|
|
1196
|
-
this.dateChange(XAddDays(new Date(), 1));
|
|
1197
|
-
}
|
|
1198
|
-
onPresetFunc(item) {
|
|
1199
|
-
this.dateChange(item.func());
|
|
1200
|
-
}
|
|
1201
1305
|
selectTime(time) {
|
|
1202
1306
|
this.time = time.getTime();
|
|
1203
1307
|
// this.nodeEmit(this.setModel(this.model, time), false);
|
|
@@ -1207,12 +1311,24 @@ class XDateRangePortalComponent {
|
|
|
1207
1311
|
this.model = new Date(date.getFullYear(), date.getMonth(), date.getDate(), time.getHours(), time.getMinutes(), time.getSeconds());
|
|
1208
1312
|
return this.model;
|
|
1209
1313
|
}
|
|
1314
|
+
startYearChange(num) {
|
|
1315
|
+
this.endDisplay = XAddYears(this.endDisplay, num);
|
|
1316
|
+
}
|
|
1317
|
+
endYearChange(num) {
|
|
1318
|
+
this.startDisplay = XAddYears(this.startDisplay, num);
|
|
1319
|
+
}
|
|
1320
|
+
startMonthChange(num) {
|
|
1321
|
+
this.endDisplay = XAddMonths(this.endDisplay, num);
|
|
1322
|
+
}
|
|
1323
|
+
endMonthChange(num) {
|
|
1324
|
+
this.startDisplay = XAddMonths(this.startDisplay, num);
|
|
1325
|
+
}
|
|
1210
1326
|
}
|
|
1211
1327
|
/** @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 });
|
|
1212
|
-
/** @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-
|
|
1328
|
+
/** @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 });
|
|
1213
1329
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XDateRangePortalComponent, decorators: [{
|
|
1214
1330
|
type: Component,
|
|
1215
|
-
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-
|
|
1331
|
+
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"] }]
|
|
1216
1332
|
}], ctorParameters: function () { return [{ type: i1.DatePipe }, { type: i1.LowerCasePipe }, { type: i0.ChangeDetectorRef }, { type: i3.XI18nService }]; }, propDecorators: { placement: [{
|
|
1217
1333
|
type: HostBinding,
|
|
1218
1334
|
args: ['@x-connect-base-animation']
|
|
@@ -1246,6 +1362,7 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1246
1362
|
this.valueChange = new Subject();
|
|
1247
1363
|
this.dataChange = new Subject();
|
|
1248
1364
|
this.positionChange = new Subject();
|
|
1365
|
+
this.inputActiveChange = new Subject();
|
|
1249
1366
|
this.closeSubject = new Subject();
|
|
1250
1367
|
this.startDisplay = '';
|
|
1251
1368
|
this.endDisplay = '';
|
|
@@ -1373,6 +1490,8 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1373
1490
|
if (this.portalAttached()) {
|
|
1374
1491
|
this.portal?.overlayRef?.detach();
|
|
1375
1492
|
this.active = false;
|
|
1493
|
+
this.startActive = false;
|
|
1494
|
+
this.endActive = false;
|
|
1376
1495
|
this.cdr.detectChanges();
|
|
1377
1496
|
return true;
|
|
1378
1497
|
}
|
|
@@ -1382,12 +1501,16 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1382
1501
|
this.portal?.overlayRef?.dispose();
|
|
1383
1502
|
}
|
|
1384
1503
|
showPortal($event, type) {
|
|
1385
|
-
$event.stopPropagation();
|
|
1504
|
+
type && $event.stopPropagation();
|
|
1386
1505
|
if (this.disabled || this.animating)
|
|
1387
1506
|
return;
|
|
1388
|
-
this.active = true;
|
|
1389
1507
|
this.startActive = type === 'start';
|
|
1390
1508
|
this.endActive = type === 'end';
|
|
1509
|
+
this.activeType = type;
|
|
1510
|
+
this.activeType && this.inputActiveChange.next(this.activeType);
|
|
1511
|
+
if (this.active)
|
|
1512
|
+
return;
|
|
1513
|
+
this.active = true;
|
|
1391
1514
|
const config = {
|
|
1392
1515
|
backdropClass: '',
|
|
1393
1516
|
positionStrategy: this.setPlacement(),
|
|
@@ -1402,9 +1525,12 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1402
1525
|
this.portal.overlayRef
|
|
1403
1526
|
?.outsidePointerEvents()
|
|
1404
1527
|
.pipe(takeUntil(this._unSubject))
|
|
1405
|
-
.subscribe(() => {
|
|
1406
|
-
|
|
1407
|
-
this.
|
|
1528
|
+
.subscribe((event) => {
|
|
1529
|
+
const clickTarget = event.target;
|
|
1530
|
+
if (clickTarget !== this.inputStartCom.inputRef.nativeElement && clickTarget !== this.inputEndCom.inputRef.nativeElement) {
|
|
1531
|
+
this.setDisplayValue(this.numberValue);
|
|
1532
|
+
this.closeSubject.next();
|
|
1533
|
+
}
|
|
1408
1534
|
});
|
|
1409
1535
|
this.setInstance();
|
|
1410
1536
|
}
|
|
@@ -1426,6 +1552,8 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1426
1552
|
preset: this.preset,
|
|
1427
1553
|
valueChange: this.valueChange,
|
|
1428
1554
|
positionChange: this.positionChange,
|
|
1555
|
+
inputActiveChange: this.inputActiveChange,
|
|
1556
|
+
activeType: this.activeType,
|
|
1429
1557
|
closePortal: () => this.closeSubject.next(),
|
|
1430
1558
|
destroyPortal: () => this.destroyPortal(),
|
|
1431
1559
|
nodeEmit: (dates, sure = true) => this.onNodeClick(dates, sure),
|
|
@@ -1437,6 +1565,9 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1437
1565
|
}
|
|
1438
1566
|
startNodeClick(node) {
|
|
1439
1567
|
this.startDisplay = this.datePipe.transform(node, this.format);
|
|
1568
|
+
this.startActive = false;
|
|
1569
|
+
this.endActive = true;
|
|
1570
|
+
this.inputEndCom.inputFocus('after');
|
|
1440
1571
|
this.cdr.detectChanges();
|
|
1441
1572
|
}
|
|
1442
1573
|
endNodeClick(node) {
|
|
@@ -1469,6 +1600,8 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1469
1600
|
// this.modelChange();
|
|
1470
1601
|
// this.isInput = false;
|
|
1471
1602
|
// } else {
|
|
1603
|
+
if (!dateNumber)
|
|
1604
|
+
return;
|
|
1472
1605
|
this.displayValue = dateNumber.map((x) => this.datePipe.transform(x, this.format));
|
|
1473
1606
|
// }
|
|
1474
1607
|
}
|
|
@@ -1492,16 +1625,22 @@ class XDateRangeComponent extends XDateRangeProperty {
|
|
|
1492
1625
|
}
|
|
1493
1626
|
}
|
|
1494
1627
|
/** @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 });
|
|
1495
|
-
/** @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
|
|
1628
|
+
/** @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 });
|
|
1496
1629
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: XDateRangeComponent, decorators: [{
|
|
1497
1630
|
type: Component,
|
|
1498
|
-
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
|
|
1631
|
+
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"] }]
|
|
1499
1632
|
}], 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: [{
|
|
1500
1633
|
type: ViewChild,
|
|
1501
1634
|
args: ['dateRange', { static: true }]
|
|
1502
1635
|
}], inputGroup: [{
|
|
1503
1636
|
type: ViewChild,
|
|
1504
1637
|
args: ['inputGroup', { static: true }]
|
|
1638
|
+
}], inputStartCom: [{
|
|
1639
|
+
type: ViewChild,
|
|
1640
|
+
args: ['inputStartCom', { static: true }]
|
|
1641
|
+
}], inputEndCom: [{
|
|
1642
|
+
type: ViewChild,
|
|
1643
|
+
args: ['inputEndCom', { static: true }]
|
|
1505
1644
|
}] } });
|
|
1506
1645
|
|
|
1507
1646
|
class XDatePickerModule {
|