adb-shared 2.0.7 → 2.0.8
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/esm2020/lib/components/date-picker/adb-date-picker.component.mjs +26 -13
- package/esm2020/lib/components/date-picker/adb-date-picker.directive.mjs +16 -22
- package/esm2020/lib/components/date-picker/adb-date-picker.service.mjs +1 -19
- package/fesm2015/adb-shared.mjs +126 -137
- package/fesm2015/adb-shared.mjs.map +1 -1
- package/fesm2020/adb-shared.mjs +125 -136
- package/fesm2020/adb-shared.mjs.map +1 -1
- package/lib/components/date-picker/adb-date-picker.component.d.ts +5 -2
- package/lib/components/date-picker/adb-date-picker.directive.d.ts +1 -2
- package/lib/components/date-picker/adb-date-picker.service.d.ts +3 -15
- package/package.json +1 -1
package/fesm2015/adb-shared.mjs
CHANGED
|
@@ -4,12 +4,12 @@ import * as i0 from '@angular/core';
|
|
|
4
4
|
import { Injectable, Inject, EventEmitter, Component, Output, Input, Directive, HostListener, NgModule, HostBinding, Pipe, forwardRef } from '@angular/core';
|
|
5
5
|
import * as i3 from '@ngx-translate/core';
|
|
6
6
|
import { TranslateModule } from '@ngx-translate/core';
|
|
7
|
-
import { Subscription
|
|
7
|
+
import { Subscription } from 'rxjs';
|
|
8
8
|
import * as i1 from '@angular/common/http';
|
|
9
9
|
import { HttpClientModule } from '@angular/common/http';
|
|
10
10
|
import * as i1$1 from '@angular/router';
|
|
11
11
|
import { RouterModule } from '@angular/router';
|
|
12
|
-
import { startOfDay, subYears, endOfDay, addYears, subMonths, addMonths, getMonth, isSameYear, startOfMonth, endOfMonth, eachWeekOfInterval, getISOWeek, addDays, eachDayOfInterval, getHours, getMinutes, isWithinInterval, isSameDay
|
|
12
|
+
import { isValid, parseISO, startOfDay, subYears, endOfDay, addYears, subMonths, addMonths, getMonth, isSameYear, startOfMonth, endOfMonth, eachWeekOfInterval, getISOWeek, addDays, eachDayOfInterval, getHours, getMinutes, isWithinInterval, isSameDay } from 'date-fns';
|
|
13
13
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
14
14
|
|
|
15
15
|
class EnvironmentService {
|
|
@@ -438,23 +438,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
438
438
|
}] });
|
|
439
439
|
|
|
440
440
|
class AdbDatePickerService {
|
|
441
|
-
constructor() {
|
|
442
|
-
this.dateSubject = new Subject();
|
|
443
|
-
this.date$ = this.dateSubject.asObservable();
|
|
444
|
-
this.hideSubject = new Subject();
|
|
445
|
-
this.hide$ = this.hideSubject.asObservable();
|
|
446
|
-
this.settingSubject = new BehaviorSubject(null);
|
|
447
|
-
this.settings$ = this.settingSubject.asObservable();
|
|
448
|
-
}
|
|
449
|
-
selectDate(date) {
|
|
450
|
-
this.dateSubject.next(date);
|
|
451
|
-
}
|
|
452
|
-
setSetting(settings) {
|
|
453
|
-
this.settingSubject.next(settings);
|
|
454
|
-
}
|
|
455
|
-
hide() {
|
|
456
|
-
this.hideSubject.next();
|
|
457
|
-
}
|
|
458
441
|
}
|
|
459
442
|
/** @nocollapse */ AdbDatePickerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
460
443
|
/** @nocollapse */ AdbDatePickerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerService });
|
|
@@ -462,6 +445,108 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
462
445
|
type: Injectable
|
|
463
446
|
}] });
|
|
464
447
|
|
|
448
|
+
class AdbDatePickerDirective {
|
|
449
|
+
constructor(viewContainerRef, renderer, elementRef, adbDatePickerService, translate) {
|
|
450
|
+
this.viewContainerRef = viewContainerRef;
|
|
451
|
+
this.renderer = renderer;
|
|
452
|
+
this.elementRef = elementRef;
|
|
453
|
+
this.adbDatePickerService = adbDatePickerService;
|
|
454
|
+
this.translate = translate;
|
|
455
|
+
this.subscriptions = new Subscription();
|
|
456
|
+
this.format = 'yyyy-MM-dd';
|
|
457
|
+
//TODO: convert to getter if this would become dynamic from server
|
|
458
|
+
this.settings = null;
|
|
459
|
+
//ControlValueAccessor
|
|
460
|
+
this.onChange = () => { };
|
|
461
|
+
this.onTouched = () => { };
|
|
462
|
+
}
|
|
463
|
+
ngOnInit() {
|
|
464
|
+
}
|
|
465
|
+
onClick() {
|
|
466
|
+
if (this.adbDatePickerService.viewRef) {
|
|
467
|
+
this.adbDatePickerService.viewRef.destroy();
|
|
468
|
+
}
|
|
469
|
+
const viewRef = this.viewContainerRef.createComponent(AdbDatePickerComponent);
|
|
470
|
+
viewRef.instance.settings = this.settings;
|
|
471
|
+
viewRef.instance.selectDate.subscribe((date) => {
|
|
472
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(date, this.format, this.translate.currentLang));
|
|
473
|
+
this.onChange(date);
|
|
474
|
+
this.onHide();
|
|
475
|
+
});
|
|
476
|
+
viewRef.instance.hide.subscribe(() => {
|
|
477
|
+
this.onHide();
|
|
478
|
+
});
|
|
479
|
+
this.adbDatePickerService.viewRef = viewRef;
|
|
480
|
+
}
|
|
481
|
+
onHide() {
|
|
482
|
+
this.adbDatePickerService.viewRef = null;
|
|
483
|
+
this.viewContainerRef.detach();
|
|
484
|
+
this.viewContainerRef.clear();
|
|
485
|
+
}
|
|
486
|
+
ngOnDestroy() {
|
|
487
|
+
this.subscriptions.unsubscribe();
|
|
488
|
+
}
|
|
489
|
+
writeValue(value) {
|
|
490
|
+
if (value) {
|
|
491
|
+
let initialDate = AdbDatePickerDirective.parseDate(value);
|
|
492
|
+
if (initialDate) {
|
|
493
|
+
console.log(this.elementRef.nativeElement);
|
|
494
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(initialDate, this.format, this.translate.currentLang));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
registerOnChange(fn) {
|
|
499
|
+
this.onChange = fn;
|
|
500
|
+
}
|
|
501
|
+
registerOnTouched(fn) {
|
|
502
|
+
this.onTouched = fn;
|
|
503
|
+
}
|
|
504
|
+
setDisabledState(isDisabled) {
|
|
505
|
+
this.viewContainerRef.clear();
|
|
506
|
+
}
|
|
507
|
+
static parseDate(value) {
|
|
508
|
+
if (typeof value === 'string') {
|
|
509
|
+
if (isValid(parseISO(value))) {
|
|
510
|
+
return parseISO(value);
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
else if (value instanceof Date) {
|
|
517
|
+
return value;
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
/** @nocollapse */ AdbDatePickerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: AdbDatePickerService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
525
|
+
/** @nocollapse */ AdbDatePickerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: AdbDatePickerDirective, selector: "input[adbDatepicker]", inputs: { format: "format", settings: "settings" }, host: { listeners: { "click": "onClick()", "keyup.esc": "onHide()" } }, providers: [{
|
|
526
|
+
provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
|
|
527
|
+
multi: true
|
|
528
|
+
}], ngImport: i0 });
|
|
529
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerDirective, decorators: [{
|
|
530
|
+
type: Directive,
|
|
531
|
+
args: [{
|
|
532
|
+
selector: `input[adbDatepicker]`,
|
|
533
|
+
providers: [{
|
|
534
|
+
provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
|
|
535
|
+
multi: true
|
|
536
|
+
}]
|
|
537
|
+
}]
|
|
538
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: AdbDatePickerService }, { type: i3.TranslateService }]; }, propDecorators: { format: [{
|
|
539
|
+
type: Input
|
|
540
|
+
}], settings: [{
|
|
541
|
+
type: Input
|
|
542
|
+
}], onClick: [{
|
|
543
|
+
type: HostListener,
|
|
544
|
+
args: ['click']
|
|
545
|
+
}], onHide: [{
|
|
546
|
+
type: HostListener,
|
|
547
|
+
args: ['keyup.esc']
|
|
548
|
+
}] } });
|
|
549
|
+
|
|
465
550
|
class AdbDatePickerComponent {
|
|
466
551
|
constructor(adbDatePickerService, elementRef) {
|
|
467
552
|
this.adbDatePickerService = adbDatePickerService;
|
|
@@ -470,15 +555,22 @@ class AdbDatePickerComponent {
|
|
|
470
555
|
this.currentdDate = new Date();
|
|
471
556
|
this.selectedDate = new Date();
|
|
472
557
|
this.weekDays = AdbDatePickerComponent.WEEK_DAYS;
|
|
558
|
+
this.selectDate = new EventEmitter();
|
|
559
|
+
this.hide = new EventEmitter();
|
|
473
560
|
}
|
|
474
561
|
ngOnInit() {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
562
|
+
var _a, _b;
|
|
563
|
+
if (this.settings) {
|
|
564
|
+
if (((_a = this.settings) === null || _a === void 0 ? void 0 : _a.minDate) || ((_b = this.settings) === null || _b === void 0 ? void 0 : _b.maxDate)) {
|
|
565
|
+
const minDate = AdbDatePickerDirective.parseDate(this.settings.minDate);
|
|
566
|
+
const maxDate = AdbDatePickerDirective.parseDate(this.settings.maxDate);
|
|
567
|
+
this.range = {
|
|
568
|
+
start: minDate ? startOfDay(minDate) : subYears(new Date(), 1000),
|
|
569
|
+
end: maxDate ? endOfDay(maxDate) : addYears(new Date(), 1000)
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
this.createCalendar();
|
|
482
574
|
}
|
|
483
575
|
onShowYear() {
|
|
484
576
|
this.months = null;
|
|
@@ -564,7 +656,7 @@ class AdbDatePickerComponent {
|
|
|
564
656
|
this.years = years;
|
|
565
657
|
}
|
|
566
658
|
onSelectDate(day) {
|
|
567
|
-
this.
|
|
659
|
+
this.selectDate.emit(day.value);
|
|
568
660
|
}
|
|
569
661
|
createCalendar() {
|
|
570
662
|
const weeks = [];
|
|
@@ -593,119 +685,16 @@ AdbDatePickerComponent.MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
|
593
685
|
AdbDatePickerComponent.WEEK_DAYS = ['1', '2', '3', '4', '5', '6', '7'];
|
|
594
686
|
AdbDatePickerComponent.YEAR_INTERVALL = 8;
|
|
595
687
|
/** @nocollapse */ AdbDatePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerComponent, deps: [{ token: AdbDatePickerService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
596
|
-
/** @nocollapse */ AdbDatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: AdbDatePickerComponent, selector: "adb-date-picker", ngImport: i0, template: "<nav class=\"bg-white shadow rounded\" style=\"width:350px\">\r\n
|
|
688
|
+
/** @nocollapse */ AdbDatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: AdbDatePickerComponent, selector: "adb-date-picker", inputs: { settings: "settings" }, outputs: { selectDate: "selectDate", hide: "hide" }, ngImport: i0, template: "<div class=\"position-relative\">\r\n <nav class=\"bg-white shadow rounded position-absolute\" style=\"width:350px\">\r\n <header class=\"bg-primary p-2 rounded-top d-flex justify-content-between align-items-center gap-1\">\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onPrev()\"><span class=\"fa fa-chevron-left\"></span></button>\r\n <ng-container *ngIf=\"!years&&!months\">\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowMonth()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear()\">{{selectedDate|date:'yyyy'}}</button>\r\n </ng-container>\r\n <button *ngIf=\"years\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"years=null\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n <button *ngIf=\"months\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear()\">{{selectedDate|date:'yyyy'}}</button>\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onNext()\"><span class=\"fa fa-chevron-right\"></span></button>\r\n </header>\r\n <div class=\"p-0 border calendar\">\r\n <ul class=\"list-unstyled row\" *ngIf=\"years\">\r\n <li class=\"col-3 text-center px-2 py-3\" *ngFor=\"let year of years\">\r\n <button class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value)\" [class.active]=\"year.hasObservation\" [ngClass]=\"{'border border-secondary':year.isThisYear}\">{{year.title}}</button>\r\n </li>\r\n </ul>\r\n <ul class=\"list-unstyled row\" *ngIf=\"months\">\r\n <li class=\"col-4 text-center px-2 py-3\" *ngFor=\"let month of months\">\r\n <button class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value)\" [class.active]=\"month.observation\" [ngClass]=\"{'border border-secondary':month.isThisMonth}\">\r\n {{'MONTHS.'+(month.value+1)|translate}}\r\n </button>\r\n </li>\r\n </ul>\r\n <div class=\"days\" *ngIf=\"!years&&!months\">\r\n <div class=\"text-center border-bottom py-2 text-muted\" *ngFor=\"let weekDay of weekDays\">{{'WEEK_DAYS.'+weekDay|translate}}</div>\r\n <ng-container *ngFor=\"let week of weeks\">\r\n <button class=\"btn rounded-circle p-0 m-2\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\"\r\n [class.border]=\"day.isToday\" [ngClass]=\"{'pe-none text-muted opacity-50':!day.inMonth||!day.isInRange}\">\r\n <small>{{day.value|date:'d'}}</small>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </nav>\r\n</div>", directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "adbLocaleDate": LocaleDatePipe, "date": i2.DatePipe, "translate": i3.TranslatePipe } });
|
|
597
689
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerComponent, decorators: [{
|
|
598
690
|
type: Component,
|
|
599
|
-
args: [{ selector: 'adb-date-picker', template: "<nav class=\"bg-white shadow rounded\" style=\"width:350px\">\r\n
|
|
600
|
-
}], ctorParameters: function () { return [{ type: AdbDatePickerService }, { type: i0.ElementRef }]; }
|
|
601
|
-
|
|
602
|
-
class AdbDatePickerDirective {
|
|
603
|
-
constructor(viewContainerRef, renderer, elementRef, adbDatePickerService, translate) {
|
|
604
|
-
this.viewContainerRef = viewContainerRef;
|
|
605
|
-
this.renderer = renderer;
|
|
606
|
-
this.elementRef = elementRef;
|
|
607
|
-
this.adbDatePickerService = adbDatePickerService;
|
|
608
|
-
this.translate = translate;
|
|
609
|
-
this.subscriptions = new Subscription();
|
|
610
|
-
this.format = 'yyyy-MM-dd';
|
|
611
|
-
//TODO: convert to getter if this would become dynamic from server
|
|
612
|
-
this.settings = null;
|
|
613
|
-
//ControlValueAccessor
|
|
614
|
-
this.onChange = () => { };
|
|
615
|
-
this.onTouched = () => { };
|
|
616
|
-
}
|
|
617
|
-
ngOnInit() {
|
|
618
|
-
var _a, _b;
|
|
619
|
-
this.subscriptions.add(this.adbDatePickerService.date$.subscribe({
|
|
620
|
-
next: date => {
|
|
621
|
-
this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(date, this.format, this.translate.currentLang));
|
|
622
|
-
this.onChange(date);
|
|
623
|
-
this.onHide();
|
|
624
|
-
}
|
|
625
|
-
}));
|
|
626
|
-
this.subscriptions.add(this.adbDatePickerService.hide$.subscribe({
|
|
627
|
-
next: () => {
|
|
628
|
-
this.onHide();
|
|
629
|
-
}
|
|
630
|
-
}));
|
|
631
|
-
if (((_a = this.settings) === null || _a === void 0 ? void 0 : _a.maxDate) || ((_b = this.settings) === null || _b === void 0 ? void 0 : _b.minDate)) {
|
|
632
|
-
this.adbDatePickerService.setSetting({
|
|
633
|
-
minDate: AdbDatePickerDirective.parseDate(this.settings.minDate),
|
|
634
|
-
maxDate: AdbDatePickerDirective.parseDate(this.settings.maxDate)
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
onClick() {
|
|
639
|
-
if (!this.viewRef) {
|
|
640
|
-
this.viewRef = this.viewContainerRef.createComponent(AdbDatePickerComponent);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
onHide() {
|
|
644
|
-
this.viewRef = null;
|
|
645
|
-
this.viewContainerRef.detach();
|
|
646
|
-
this.viewContainerRef.clear();
|
|
647
|
-
}
|
|
648
|
-
ngOnDestroy() {
|
|
649
|
-
this.subscriptions.unsubscribe();
|
|
650
|
-
}
|
|
651
|
-
writeValue(value) {
|
|
652
|
-
if (value) {
|
|
653
|
-
let initialDate = AdbDatePickerDirective.parseDate(value);
|
|
654
|
-
if (initialDate) {
|
|
655
|
-
this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(initialDate, this.format, this.translate.currentLang));
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
registerOnChange(fn) {
|
|
660
|
-
this.onChange = fn;
|
|
661
|
-
}
|
|
662
|
-
registerOnTouched(fn) {
|
|
663
|
-
this.onTouched = fn;
|
|
664
|
-
}
|
|
665
|
-
setDisabledState(isDisabled) {
|
|
666
|
-
this.viewContainerRef.clear();
|
|
667
|
-
}
|
|
668
|
-
static parseDate(value) {
|
|
669
|
-
if (typeof value === 'string') {
|
|
670
|
-
if (isValid(parseISO(value))) {
|
|
671
|
-
return parseISO(value);
|
|
672
|
-
}
|
|
673
|
-
else {
|
|
674
|
-
return null;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
else if (value instanceof Date) {
|
|
678
|
-
return value;
|
|
679
|
-
}
|
|
680
|
-
else {
|
|
681
|
-
return null;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
/** @nocollapse */ AdbDatePickerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: AdbDatePickerService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
686
|
-
/** @nocollapse */ AdbDatePickerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: AdbDatePickerDirective, selector: "input[adbDatepicker]", inputs: { format: "format", settings: "settings" }, host: { listeners: { "click": "onClick()", "keyup.esc": "onHide()" } }, providers: [{
|
|
687
|
-
provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
|
|
688
|
-
multi: true
|
|
689
|
-
}], ngImport: i0 });
|
|
690
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerDirective, decorators: [{
|
|
691
|
-
type: Directive,
|
|
692
|
-
args: [{
|
|
693
|
-
selector: `input[adbDatepicker]`,
|
|
694
|
-
providers: [{
|
|
695
|
-
provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
|
|
696
|
-
multi: true
|
|
697
|
-
}]
|
|
698
|
-
}]
|
|
699
|
-
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: AdbDatePickerService }, { type: i3.TranslateService }]; }, propDecorators: { format: [{
|
|
700
|
-
type: Input
|
|
701
|
-
}], settings: [{
|
|
691
|
+
args: [{ selector: 'adb-date-picker', template: "<div class=\"position-relative\">\r\n <nav class=\"bg-white shadow rounded position-absolute\" style=\"width:350px\">\r\n <header class=\"bg-primary p-2 rounded-top d-flex justify-content-between align-items-center gap-1\">\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onPrev()\"><span class=\"fa fa-chevron-left\"></span></button>\r\n <ng-container *ngIf=\"!years&&!months\">\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowMonth()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear()\">{{selectedDate|date:'yyyy'}}</button>\r\n </ng-container>\r\n <button *ngIf=\"years\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"years=null\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n <button *ngIf=\"months\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear()\">{{selectedDate|date:'yyyy'}}</button>\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onNext()\"><span class=\"fa fa-chevron-right\"></span></button>\r\n </header>\r\n <div class=\"p-0 border calendar\">\r\n <ul class=\"list-unstyled row\" *ngIf=\"years\">\r\n <li class=\"col-3 text-center px-2 py-3\" *ngFor=\"let year of years\">\r\n <button class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value)\" [class.active]=\"year.hasObservation\" [ngClass]=\"{'border border-secondary':year.isThisYear}\">{{year.title}}</button>\r\n </li>\r\n </ul>\r\n <ul class=\"list-unstyled row\" *ngIf=\"months\">\r\n <li class=\"col-4 text-center px-2 py-3\" *ngFor=\"let month of months\">\r\n <button class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value)\" [class.active]=\"month.observation\" [ngClass]=\"{'border border-secondary':month.isThisMonth}\">\r\n {{'MONTHS.'+(month.value+1)|translate}}\r\n </button>\r\n </li>\r\n </ul>\r\n <div class=\"days\" *ngIf=\"!years&&!months\">\r\n <div class=\"text-center border-bottom py-2 text-muted\" *ngFor=\"let weekDay of weekDays\">{{'WEEK_DAYS.'+weekDay|translate}}</div>\r\n <ng-container *ngFor=\"let week of weeks\">\r\n <button class=\"btn rounded-circle p-0 m-2\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\"\r\n [class.border]=\"day.isToday\" [ngClass]=\"{'pe-none text-muted opacity-50':!day.inMonth||!day.isInRange}\">\r\n <small>{{day.value|date:'d'}}</small>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </nav>\r\n</div>" }]
|
|
692
|
+
}], ctorParameters: function () { return [{ type: AdbDatePickerService }, { type: i0.ElementRef }]; }, propDecorators: { settings: [{
|
|
702
693
|
type: Input
|
|
703
|
-
}],
|
|
704
|
-
type:
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
type: HostListener,
|
|
708
|
-
args: ['keyup.esc']
|
|
694
|
+
}], selectDate: [{
|
|
695
|
+
type: Output
|
|
696
|
+
}], hide: [{
|
|
697
|
+
type: Output
|
|
709
698
|
}] } });
|
|
710
699
|
|
|
711
700
|
class AdbDatePickerModule {
|