@arsedizioni/ars-utils 19.3.7 → 19.3.10
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.
|
@@ -29,7 +29,7 @@ import * as i20 from '@arsedizioni/ars-utils/core';
|
|
|
29
29
|
import { SystemUtils, BroadcastService, SafeUrlPipe, DateInterval, ThemeService, ScreenService, DateFormat, FormatPipe, SelectableModel, ArsCoreModule } from '@arsedizioni/ars-utils/core';
|
|
30
30
|
import { FlexLayoutModule, FlexModule } from '@ngbracket/ngx-layout';
|
|
31
31
|
import { takeUntil as takeUntil$1, finalize as finalize$1 } from 'rxjs/operators';
|
|
32
|
-
import { startOfToday, subDays, endOfDay, startOfMonth, endOfMonth,
|
|
32
|
+
import { startOfToday, subDays, endOfDay, startOfMonth, endOfMonth, startOfDay } from 'date-fns';
|
|
33
33
|
import { finalize, Subject, takeUntil } from 'rxjs';
|
|
34
34
|
import * as i4$1 from '@angular/material/divider';
|
|
35
35
|
import { MatDividerModule } from '@angular/material/divider';
|
|
@@ -1591,15 +1591,25 @@ class ClipperSearchCalendarComponent {
|
|
|
1591
1591
|
* @param date : the date to filter to or "month" to filter by the whole month.
|
|
1592
1592
|
*/
|
|
1593
1593
|
filterByDate(date) {
|
|
1594
|
-
console.log("change date:" + date?.toString());
|
|
1595
1594
|
if (date === 'month') {
|
|
1596
1595
|
if (this.calendarDate) {
|
|
1597
|
-
|
|
1596
|
+
const today = new Date();
|
|
1597
|
+
const start = endOfDay(startOfMonth(this.calendarDate));
|
|
1598
|
+
const end = endOfMonth(this.calendarDate);
|
|
1599
|
+
this.changed.emit(new DateInterval(start, end));
|
|
1600
|
+
if (start <= today && end >= today) {
|
|
1601
|
+
const calendar = this.calendar();
|
|
1602
|
+
calendar.selected = today;
|
|
1603
|
+
calendar.updateTodaysDate();
|
|
1604
|
+
}
|
|
1598
1605
|
}
|
|
1599
1606
|
}
|
|
1600
1607
|
else if (date) {
|
|
1601
|
-
this.changed.emit(new DateInterval(
|
|
1608
|
+
this.changed.emit(new DateInterval(endOfDay(date), endOfDay(date)));
|
|
1602
1609
|
this.calendarDate = date;
|
|
1610
|
+
const calendar = this.calendar();
|
|
1611
|
+
calendar.selected = date;
|
|
1612
|
+
calendar.updateTodaysDate();
|
|
1603
1613
|
}
|
|
1604
1614
|
else {
|
|
1605
1615
|
this.changed.emit(null);
|
|
@@ -1610,16 +1620,22 @@ class ClipperSearchCalendarComponent {
|
|
|
1610
1620
|
* @param monthInfo: the month info
|
|
1611
1621
|
*/
|
|
1612
1622
|
filterByMonth(monthInfo) {
|
|
1613
|
-
|
|
1614
|
-
|
|
1623
|
+
const newDate = new Date(monthInfo.year, monthInfo.month - 1, 1);
|
|
1624
|
+
const today = new Date();
|
|
1625
|
+
const start = endOfDay(startOfMonth(newDate));
|
|
1626
|
+
const end = endOfMonth(newDate);
|
|
1627
|
+
this.changed.emit(new DateInterval(start, end));
|
|
1615
1628
|
this.calendarSpecialDays = monthInfo.days;
|
|
1616
1629
|
const calendar = this.calendar();
|
|
1630
|
+
if (start <= today && end >= today) {
|
|
1631
|
+
calendar.selected = today;
|
|
1632
|
+
}
|
|
1617
1633
|
calendar.activeDate = newDate;
|
|
1618
1634
|
calendar.updateTodaysDate();
|
|
1619
1635
|
this.calendarDate = newDate;
|
|
1620
1636
|
}
|
|
1621
1637
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ClipperSearchCalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1622
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: ClipperSearchCalendarComponent, isStandalone: true, selector: "clipper-search-calendar", inputs: { canFilter: { classPropertyName: "canFilter", publicName: "canFilter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changed: "changed" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: ["calendar"], descendants: true, isSignal: true }], ngImport: i0, template: "<div fxLayout=\"column\" fxFill class=\"calendar-container scroll-hidden\">\r\n <div class=\"calendar-months\">\r\n <div>\r\n <div fxLayout=\"row wrap\" fxLayoutAlign=\"center\" fxLayoutGap=\"8px\" fxFill>\r\n @for (m of months(); track $index) {\r\n <button fxFlex=\"37px\" mat-button class=\"small uppercase\" (click)=\"filterByMonth(m)\" [disabled]=\"m.total === 0\">\r\n @if (m.expired) {\r\n <span class=\"expired\" [matTooltip]=\"m.expired + ' elementi in ritardo'\">{{m.monthShortName}}</span>\r\n }
|
|
1638
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: ClipperSearchCalendarComponent, isStandalone: true, selector: "clipper-search-calendar", inputs: { canFilter: { classPropertyName: "canFilter", publicName: "canFilter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changed: "changed" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: ["calendar"], descendants: true, isSignal: true }], ngImport: i0, template: "<div fxLayout=\"column\" fxFill class=\"calendar-container scroll-hidden\">\r\n <div class=\"calendar-months\">\r\n <div>\r\n <div fxLayout=\"row wrap\" fxLayoutAlign=\"center\" fxLayoutGap=\"8px\" fxFill>\r\n @for (m of months(); track $index) {\r\n <button fxFlex=\"37px\" mat-button class=\"small uppercase\" (click)=\"filterByMonth(m)\" [disabled]=\"m.total === 0\">\r\n @if (m.expired) {\r\n <span class=\"expired\" [matTooltip]=\"m.expired + ' elementi in ritardo'\">{{m.monthShortName}}</span>\r\n } @else {\r\n <span [matTooltip]=\"m.total + ' elementi'\">{{m.monthShortName}}</span>\r\n }\r\n </button>\r\n }\r\n </div>\r\n </div>\r\n <div class=\"separator\"></div>\r\n </div>\r\n <div fxFlex=\"*\" class=\"scroll-auto\">\r\n @if (!busy()) {\r\n <mat-calendar #calendar [headerComponent]=\"calendarEmptyHeader\" [dateClass]=\"calendarDateClass\"\r\n [dateFilter]=\"calendarDateFilter\" (selectedChange)=\"filterByDate($event)\" class=\"calendar-month\">\r\n </mat-calendar>\r\n <div fxLayout=\"row\" fxLayoutAlign=\"space-around\" style=\"padding:0 15px\">\r\n <button type=\"button\" mat-stroked-button color=\"primary\" (click)=\"filterByDate('month')\">Tutto il\r\n mese</button>\r\n </div>\r\n }\r\n </div>\r\n</div>", styles: [".calendar-container{padding-top:20px;padding-bottom:10px}.calendar-message{padding-top:10px;padding-left:15px}.calendar-months .separator{border-top:1px var(--ars-color-divider, #757d87) solid;margin-top:15px;padding-top:15px}.calendar-months .expired{color:var(--ars-color-error, #ff5449)!important}.calendar-month{padding:10px 0 30px;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: FlexModule$1 }, { kind: "directive", type: i1.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i1.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i1.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i1.FlexFillDirective, selector: "[fxFill], [fxFlexFill]" }, { kind: "directive", type: i1.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatDividerModule }, { kind: "ngmodule", type: MatExpansionModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1623
1639
|
}
|
|
1624
1640
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ClipperSearchCalendarComponent, decorators: [{
|
|
1625
1641
|
type: Component,
|
|
@@ -1632,7 +1648,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
1632
1648
|
MatIconModule,
|
|
1633
1649
|
MatDividerModule,
|
|
1634
1650
|
MatExpansionModule
|
|
1635
|
-
], template: "<div fxLayout=\"column\" fxFill class=\"calendar-container scroll-hidden\">\r\n <div class=\"calendar-months\">\r\n <div>\r\n <div fxLayout=\"row wrap\" fxLayoutAlign=\"center\" fxLayoutGap=\"8px\" fxFill>\r\n @for (m of months(); track $index) {\r\n <button fxFlex=\"37px\" mat-button class=\"small uppercase\" (click)=\"filterByMonth(m)\" [disabled]=\"m.total === 0\">\r\n @if (m.expired) {\r\n <span class=\"expired\" [matTooltip]=\"m.expired + ' elementi in ritardo'\">{{m.monthShortName}}</span>\r\n }
|
|
1651
|
+
], template: "<div fxLayout=\"column\" fxFill class=\"calendar-container scroll-hidden\">\r\n <div class=\"calendar-months\">\r\n <div>\r\n <div fxLayout=\"row wrap\" fxLayoutAlign=\"center\" fxLayoutGap=\"8px\" fxFill>\r\n @for (m of months(); track $index) {\r\n <button fxFlex=\"37px\" mat-button class=\"small uppercase\" (click)=\"filterByMonth(m)\" [disabled]=\"m.total === 0\">\r\n @if (m.expired) {\r\n <span class=\"expired\" [matTooltip]=\"m.expired + ' elementi in ritardo'\">{{m.monthShortName}}</span>\r\n } @else {\r\n <span [matTooltip]=\"m.total + ' elementi'\">{{m.monthShortName}}</span>\r\n }\r\n </button>\r\n }\r\n </div>\r\n </div>\r\n <div class=\"separator\"></div>\r\n </div>\r\n <div fxFlex=\"*\" class=\"scroll-auto\">\r\n @if (!busy()) {\r\n <mat-calendar #calendar [headerComponent]=\"calendarEmptyHeader\" [dateClass]=\"calendarDateClass\"\r\n [dateFilter]=\"calendarDateFilter\" (selectedChange)=\"filterByDate($event)\" class=\"calendar-month\">\r\n </mat-calendar>\r\n <div fxLayout=\"row\" fxLayoutAlign=\"space-around\" style=\"padding:0 15px\">\r\n <button type=\"button\" mat-stroked-button color=\"primary\" (click)=\"filterByDate('month')\">Tutto il\r\n mese</button>\r\n </div>\r\n }\r\n </div>\r\n</div>", styles: [".calendar-container{padding-top:20px;padding-bottom:10px}.calendar-message{padding-top:10px;padding-left:15px}.calendar-months .separator{border-top:1px var(--ars-color-divider, #757d87) solid;margin-top:15px;padding-top:15px}.calendar-months .expired{color:var(--ars-color-error, #ff5449)!important}.calendar-month{padding:10px 0 30px;width:100%}\n"] }]
|
|
1636
1652
|
}] });
|
|
1637
1653
|
|
|
1638
1654
|
class ClipperSearchFacetsComponent {
|