ng-primitives 0.70.0 → 0.71.0
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/date-picker/config/date-picker-config.d.ts +22 -0
- package/date-picker/date-picker/date-picker-first-day-of-week.d.ts +29 -0
- package/date-picker/date-picker/date-picker.d.ts +13 -1
- package/date-picker/date-picker-row-render/date-picker-row-render.d.ts +12 -0
- package/date-picker/date-range-picker/date-range-picker.d.ts +13 -1
- package/date-picker/index.d.ts +2 -0
- package/fesm2022/ng-primitives-date-picker.mjs +106 -13
- package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
- package/fesm2022/ng-primitives-internal.mjs +19 -4
- package/fesm2022/ng-primitives-internal.mjs.map +1 -1
- package/fesm2022/ng-primitives-toast.mjs +1 -2
- package/fesm2022/ng-primitives-toast.mjs.map +1 -1
- package/fesm2022/ng-primitives-utils.mjs +2 -36
- package/fesm2022/ng-primitives-utils.mjs.map +1 -1
- package/internal/index.d.ts +1 -1
- package/internal/utilities/resize.d.ts +4 -0
- package/package.json +23 -23
- package/toast/toast/toast.d.ts +2 -6
- package/utils/index.d.ts +1 -2
- package/utils/ui/dimensions.d.ts +0 -9
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
+
import { NgpDatePickerFirstDayOfWeekNumber } from '../date-picker/date-picker-first-day-of-week';
|
|
3
|
+
export interface NgpDatePickerConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Define the first day of the week for the date picker calendar.
|
|
6
|
+
* @default 7 (Sunday)
|
|
7
|
+
*/
|
|
8
|
+
firstDayOfWeek: NgpDatePickerFirstDayOfWeekNumber;
|
|
9
|
+
}
|
|
10
|
+
export declare const defaultDatePickerConfig: NgpDatePickerConfig;
|
|
11
|
+
export declare const NgpDatePickerConfigToken: InjectionToken<NgpDatePickerConfig>;
|
|
12
|
+
/**
|
|
13
|
+
* Provide the default DatePicker / DateRangePicker configuration
|
|
14
|
+
* @param config The DatePicker / DateRangePicker configuration
|
|
15
|
+
* @returns The provider
|
|
16
|
+
*/
|
|
17
|
+
export declare function provideDatePickerConfig(config: Partial<NgpDatePickerConfig>): Provider[];
|
|
18
|
+
/**
|
|
19
|
+
* Inject the DatePicker / DateRangePicker configuration
|
|
20
|
+
* @returns The global DatePicker / DateRangePicker configuration
|
|
21
|
+
*/
|
|
22
|
+
export declare function injectDatePickerConfig(): NgpDatePickerConfig;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first day of the week as a number (0-7).
|
|
3
|
+
* - `1` = Monday
|
|
4
|
+
* - `2` = Tuesday
|
|
5
|
+
* - `3` = Wednesday
|
|
6
|
+
* - `4` = Thursday
|
|
7
|
+
* - `5` = Friday
|
|
8
|
+
* - `6` = Saturday
|
|
9
|
+
* - `7` = Sunday
|
|
10
|
+
*/
|
|
11
|
+
export type NgpDatePickerFirstDayOfWeekNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
12
|
+
/**
|
|
13
|
+
* The first day of the week as a number (0-7).
|
|
14
|
+
* - `1` = Monday
|
|
15
|
+
* - `2` = Tuesday
|
|
16
|
+
* - `3` = Wednesday
|
|
17
|
+
* - `4` = Thursday
|
|
18
|
+
* - `5` = Friday
|
|
19
|
+
* - `6` = Saturday
|
|
20
|
+
* - `7` = Sunday
|
|
21
|
+
*/
|
|
22
|
+
export type NgpDatePickerFirstDayOfWeekNumberInput = NgpDatePickerFirstDayOfWeekNumber | `${NgpDatePickerFirstDayOfWeekNumber}`;
|
|
23
|
+
/**
|
|
24
|
+
* Transform the first day of the week input value to a number (0-7) for the start of the week in
|
|
25
|
+
* the calendar.
|
|
26
|
+
* @param firstDayOfWeek The first day of the week input value (number).
|
|
27
|
+
* @returns The first day of the week number.
|
|
28
|
+
*/
|
|
29
|
+
export declare function transformToFirstDayOfWeekNumber(firstDayOfWeek: NgpDatePickerFirstDayOfWeekNumberInput): NgpDatePickerFirstDayOfWeekNumber;
|
|
@@ -10,6 +10,10 @@ export declare class NgpDatePicker<T> {
|
|
|
10
10
|
* Access the date adapter.
|
|
11
11
|
*/
|
|
12
12
|
private readonly dateAdapter;
|
|
13
|
+
/**
|
|
14
|
+
* Access the date picker config.
|
|
15
|
+
*/
|
|
16
|
+
private readonly config;
|
|
13
17
|
/**
|
|
14
18
|
* Access the injector.
|
|
15
19
|
*/
|
|
@@ -30,6 +34,14 @@ export declare class NgpDatePicker<T> {
|
|
|
30
34
|
* A function that is called to determine if a specific date should be disabled.
|
|
31
35
|
*/
|
|
32
36
|
readonly dateDisabled: import("@angular/core").InputSignal<(date: T) => boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Sets which day starts the week in the calendar.
|
|
39
|
+
* Accepts 0-7 where 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday.
|
|
40
|
+
* Defaults to NgpDatePickerConfig.firstDayOfWeek (default 7 if not overridden).
|
|
41
|
+
* Note: Update calendar header column order when changing from Sunday start.
|
|
42
|
+
* @default 7 (Sunday)
|
|
43
|
+
*/
|
|
44
|
+
readonly firstDayOfWeek: import("@angular/core").InputSignalWithTransform<import("./date-picker-first-day-of-week").NgpDatePickerFirstDayOfWeekNumber, import("./date-picker-first-day-of-week").NgpDatePickerFirstDayOfWeekNumberInput>;
|
|
33
45
|
/**
|
|
34
46
|
* The selected value.
|
|
35
47
|
*/
|
|
@@ -112,5 +124,5 @@ export declare class NgpDatePicker<T> {
|
|
|
112
124
|
*/
|
|
113
125
|
isBetweenRange(_: T): boolean;
|
|
114
126
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgpDatePicker<any>, never>;
|
|
115
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDatePicker<any>, "[ngpDatePicker]", ["ngpDatePicker"], { "min": { "alias": "ngpDatePickerMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpDatePickerMax"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpDatePickerDisabled"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "ngpDatePickerDateDisabled"; "required": false; "isSignal": true; }; "date": { "alias": "ngpDatePickerDate"; "required": false; "isSignal": true; }; "focusedDate": { "alias": "ngpDatePickerFocusedDate"; "required": false; "isSignal": true; }; }, { "dateChange": "ngpDatePickerDateChange"; "focusedDateChange": "ngpDatePickerFocusedDateChange"; }, ["label"], never, true, never>;
|
|
127
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDatePicker<any>, "[ngpDatePicker]", ["ngpDatePicker"], { "min": { "alias": "ngpDatePickerMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpDatePickerMax"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpDatePickerDisabled"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "ngpDatePickerDateDisabled"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "ngpDatePickerFirstDayOfWeek"; "required": false; "isSignal": true; }; "date": { "alias": "ngpDatePickerDate"; "required": false; "isSignal": true; }; "focusedDate": { "alias": "ngpDatePickerFocusedDate"; "required": false; "isSignal": true; }; }, { "dateChange": "ngpDatePickerDateChange"; "focusedDateChange": "ngpDatePickerFocusedDateChange"; }, ["label"], never, true, never>;
|
|
116
128
|
}
|
|
@@ -30,6 +30,10 @@ export declare class NgpDatePickerRowRender<T> implements OnDestroy {
|
|
|
30
30
|
* Store the embedded view refs of each rendered row.
|
|
31
31
|
*/
|
|
32
32
|
private readonly viewRefs;
|
|
33
|
+
/**
|
|
34
|
+
* Store the previously rendered month.
|
|
35
|
+
*/
|
|
36
|
+
private previousMonth;
|
|
33
37
|
constructor();
|
|
34
38
|
ngOnDestroy(): void;
|
|
35
39
|
/**
|
|
@@ -40,6 +44,14 @@ export declare class NgpDatePickerRowRender<T> implements OnDestroy {
|
|
|
40
44
|
* Destroy the row.
|
|
41
45
|
*/
|
|
42
46
|
private destroyRows;
|
|
47
|
+
/**
|
|
48
|
+
* Get the offset of the first day of the week.
|
|
49
|
+
* @param firstCalendarDay The first day of the calendar without the offset.
|
|
50
|
+
* @returns The offset of the first day of the week.
|
|
51
|
+
*
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
getFirstDayOfWeekOffset(firstCalendarDay: T): number;
|
|
43
55
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgpDatePickerRowRender<any>, never>;
|
|
44
56
|
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDatePickerRowRender<any>, "[ngpDatePickerRowRender]", ["ngpDatePickerRowRender"], {}, {}, never, never, true, never>;
|
|
45
57
|
}
|
|
@@ -4,6 +4,10 @@ import { NgpDatePickerDateButton } from '../date-picker-date-button/date-picker-
|
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class NgpDateRangePicker<T> {
|
|
6
6
|
private readonly dateAdapter;
|
|
7
|
+
/**
|
|
8
|
+
* Access the date range picker config.
|
|
9
|
+
*/
|
|
10
|
+
private readonly config;
|
|
7
11
|
/**
|
|
8
12
|
* Access the injector.
|
|
9
13
|
*/
|
|
@@ -24,6 +28,14 @@ export declare class NgpDateRangePicker<T> {
|
|
|
24
28
|
* A function that is called to determine if a specific date should be disabled.
|
|
25
29
|
*/
|
|
26
30
|
readonly dateDisabled: import("@angular/core").InputSignal<(date: T) => boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Sets which day starts the week in the calendar.
|
|
33
|
+
* Accepts 0-7 where 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday.
|
|
34
|
+
* Defaults to NgpDatePickerConfig.firstDayOfWeek (default 7 if not overridden).
|
|
35
|
+
* Note: Update calendar header column order when changing from Sunday start.
|
|
36
|
+
* @default 7 (Sunday)
|
|
37
|
+
*/
|
|
38
|
+
readonly firstDayOfWeek: import("@angular/core").InputSignalWithTransform<import("../date-picker/date-picker-first-day-of-week").NgpDatePickerFirstDayOfWeekNumber, import("../date-picker/date-picker-first-day-of-week").NgpDatePickerFirstDayOfWeekNumberInput>;
|
|
27
39
|
/**
|
|
28
40
|
* The selected start date
|
|
29
41
|
*/
|
|
@@ -128,5 +140,5 @@ export declare class NgpDateRangePicker<T> {
|
|
|
128
140
|
*/
|
|
129
141
|
isBetweenRange(date: T): boolean;
|
|
130
142
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgpDateRangePicker<any>, never>;
|
|
131
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDateRangePicker<any>, "[ngpDateRangePicker]", ["ngpDateRangePicker"], { "min": { "alias": "ngpDateRangePickerMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpDateRangePickerMax"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpDateRangePickerDisabled"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "ngpDateRangePickerDateDisabled"; "required": false; "isSignal": true; }; "startDate": { "alias": "ngpDateRangePickerStartDate"; "required": false; "isSignal": true; }; "endDate": { "alias": "ngpDateRangePickerEndDate"; "required": false; "isSignal": true; }; "focusedDate": { "alias": "ngpDateRangePickerFocusedDate"; "required": false; "isSignal": true; }; }, { "startDateChange": "ngpDateRangePickerStartDateChange"; "endDateChange": "ngpDateRangePickerEndDateChange"; "focusedDateChange": "ngpDateRangePickerFocusedDateChange"; }, ["label"], never, true, never>;
|
|
143
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDateRangePicker<any>, "[ngpDateRangePicker]", ["ngpDateRangePicker"], { "min": { "alias": "ngpDateRangePickerMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpDateRangePickerMax"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpDateRangePickerDisabled"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "ngpDateRangePickerDateDisabled"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "ngpDateRangePickerFirstDayOfWeek"; "required": false; "isSignal": true; }; "startDate": { "alias": "ngpDateRangePickerStartDate"; "required": false; "isSignal": true; }; "endDate": { "alias": "ngpDateRangePickerEndDate"; "required": false; "isSignal": true; }; "focusedDate": { "alias": "ngpDateRangePickerFocusedDate"; "required": false; "isSignal": true; }; }, { "startDateChange": "ngpDateRangePickerStartDateChange"; "endDateChange": "ngpDateRangePickerEndDateChange"; "focusedDateChange": "ngpDateRangePickerFocusedDateChange"; }, ["label"], never, true, never>;
|
|
132
144
|
}
|
package/date-picker/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { injectDatePickerConfig, provideDatePickerConfig } from './config/date-picker-config';
|
|
1
2
|
export { NgpDatePickerCellRender } from './date-picker-cell-render/date-picker-cell-render';
|
|
2
3
|
export { injectDatePickerCellDate, injectDatePickerCellRender, NgpDatePickerCellRenderToken, } from './date-picker-cell-render/date-picker-cell-render-token';
|
|
3
4
|
export { NgpDatePickerCell } from './date-picker-cell/date-picker-cell';
|
|
@@ -11,6 +12,7 @@ export { NgpDatePickerPreviousMonth } from './date-picker-previous-month/date-pi
|
|
|
11
12
|
export { NgpDatePickerRowRender } from './date-picker-row-render/date-picker-row-render';
|
|
12
13
|
export { injectDatePickerRowRender, injectDatePickerWeek, NgpDatePickerRowRenderToken, } from './date-picker-row-render/date-picker-row-render-token';
|
|
13
14
|
export { NgpDatePicker } from './date-picker/date-picker';
|
|
15
|
+
export { transformToFirstDayOfWeekNumber, type NgpDatePickerFirstDayOfWeekNumber, type NgpDatePickerFirstDayOfWeekNumberInput, } from './date-picker/date-picker-first-day-of-week';
|
|
14
16
|
export { injectDatePickerState, provideDatePickerState } from './date-picker/date-picker-state';
|
|
15
17
|
export { NgpDateRangePicker } from './date-range-picker/date-range-picker';
|
|
16
18
|
export { provideDateRangePickerState, injectDateRangePickerState, } from './date-range-picker/date-range-picker-state';
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, TemplateRef, ViewContainerRef, Injector, Directive, contentChild, computed, ElementRef, HostListener, input, booleanAttribute, output, signal, afterNextRender } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, TemplateRef, ViewContainerRef, Injector, Directive, contentChild, computed, ElementRef, HostListener, input, numberAttribute, booleanAttribute, output, signal, afterNextRender } from '@angular/core';
|
|
3
3
|
import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
|
|
4
4
|
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
5
5
|
import { injectDateAdapter } from 'ng-primitives/date-time';
|
|
6
|
-
import { setupButton } from 'ng-primitives/internal';
|
|
7
|
-
import { uniqueId
|
|
6
|
+
import { setupButton, explicitEffect } from 'ng-primitives/internal';
|
|
7
|
+
import { uniqueId } from 'ng-primitives/utils';
|
|
8
|
+
|
|
9
|
+
const defaultDatePickerConfig = {
|
|
10
|
+
firstDayOfWeek: 7,
|
|
11
|
+
};
|
|
12
|
+
const NgpDatePickerConfigToken = new InjectionToken('NgpDatePickerConfigToken');
|
|
13
|
+
/**
|
|
14
|
+
* Provide the default DatePicker / DateRangePicker configuration
|
|
15
|
+
* @param config The DatePicker / DateRangePicker configuration
|
|
16
|
+
* @returns The provider
|
|
17
|
+
*/
|
|
18
|
+
function provideDatePickerConfig(config) {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
provide: NgpDatePickerConfigToken,
|
|
22
|
+
useValue: { ...defaultDatePickerConfig, ...config },
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Inject the DatePicker / DateRangePicker configuration
|
|
28
|
+
* @returns The global DatePicker / DateRangePicker configuration
|
|
29
|
+
*/
|
|
30
|
+
function injectDatePickerConfig() {
|
|
31
|
+
return inject(NgpDatePickerConfigToken, { optional: true }) ?? defaultDatePickerConfig;
|
|
32
|
+
}
|
|
8
33
|
|
|
9
34
|
const NgpDatePickerRowRenderToken = new InjectionToken('NgpDatePickerRowRenderToken');
|
|
10
35
|
/**
|
|
@@ -689,6 +714,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
689
714
|
args: ['click']
|
|
690
715
|
}] } });
|
|
691
716
|
|
|
717
|
+
/**
|
|
718
|
+
* The number of days in a week.
|
|
719
|
+
* @internal
|
|
720
|
+
*/
|
|
721
|
+
const DAYS_PER_WEEK = 7;
|
|
692
722
|
/**
|
|
693
723
|
* A structural directive that renders a row of weekdays in the date picker grid.
|
|
694
724
|
*/
|
|
@@ -720,9 +750,11 @@ class NgpDatePickerRowRender {
|
|
|
720
750
|
// Get the first and last day of the month.
|
|
721
751
|
let firstDay = this.dateAdapter.startOfMonth(month);
|
|
722
752
|
let lastDay = this.dateAdapter.endOfMonth(month);
|
|
753
|
+
// calculate the offset of the first day of the week.
|
|
754
|
+
const firstDayOfWeekOffset = this.getFirstDayOfWeekOffset(firstDay);
|
|
723
755
|
// find the first and last day of visible in the grid.
|
|
724
756
|
firstDay = this.dateAdapter.subtract(firstDay, {
|
|
725
|
-
days:
|
|
757
|
+
days: firstDayOfWeekOffset,
|
|
726
758
|
});
|
|
727
759
|
lastDay = this.dateAdapter.add(lastDay, {
|
|
728
760
|
days: 6 - this.dateAdapter.getDay(lastDay),
|
|
@@ -747,12 +779,12 @@ class NgpDatePickerRowRender {
|
|
|
747
779
|
* Store the embedded view refs of each rendered row.
|
|
748
780
|
*/
|
|
749
781
|
this.viewRefs = [];
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
782
|
+
/**
|
|
783
|
+
* Store the previously rendered month.
|
|
784
|
+
*/
|
|
785
|
+
this.previousMonth = null;
|
|
786
|
+
// Wait for the inputs of the containing picker to be initialized.
|
|
787
|
+
explicitEffect([this.state().focusedDate, this.state().firstDayOfWeek], () => this.renderRows());
|
|
756
788
|
}
|
|
757
789
|
ngOnDestroy() {
|
|
758
790
|
this.destroyRows();
|
|
@@ -761,6 +793,13 @@ class NgpDatePickerRowRender {
|
|
|
761
793
|
* Render the row.
|
|
762
794
|
*/
|
|
763
795
|
renderRows() {
|
|
796
|
+
// If the focused date has not changed, do not re-render.
|
|
797
|
+
if (this.previousMonth &&
|
|
798
|
+
this.dateAdapter.isSameMonth(this.previousMonth, this.state().focusedDate())) {
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
// Store the current focused month.
|
|
802
|
+
this.previousMonth = this.state().focusedDate();
|
|
764
803
|
const weeks = this.weeks();
|
|
765
804
|
// clear the view container.
|
|
766
805
|
this.destroyRows();
|
|
@@ -783,6 +822,17 @@ class NgpDatePickerRowRender {
|
|
|
783
822
|
viewRef.destroy();
|
|
784
823
|
}
|
|
785
824
|
}
|
|
825
|
+
/**
|
|
826
|
+
* Get the offset of the first day of the week.
|
|
827
|
+
* @param firstCalendarDay The first day of the calendar without the offset.
|
|
828
|
+
* @returns The offset of the first day of the week.
|
|
829
|
+
*
|
|
830
|
+
* @internal
|
|
831
|
+
*/
|
|
832
|
+
getFirstDayOfWeekOffset(firstCalendarDay) {
|
|
833
|
+
return ((DAYS_PER_WEEK + this.dateAdapter.getDay(firstCalendarDay) - this.state().firstDayOfWeek()) %
|
|
834
|
+
DAYS_PER_WEEK);
|
|
835
|
+
}
|
|
786
836
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDatePickerRowRender, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
787
837
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.11", type: NgpDatePickerRowRender, isStandalone: true, selector: "[ngpDatePickerRowRender]", providers: [{ provide: NgpDatePickerRowRenderToken, useExisting: NgpDatePickerRowRender }], exportAs: ["ngpDatePickerRowRender"], ngImport: i0 }); }
|
|
788
838
|
}
|
|
@@ -795,6 +845,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
795
845
|
}]
|
|
796
846
|
}], ctorParameters: () => [] });
|
|
797
847
|
|
|
848
|
+
/**
|
|
849
|
+
* Transform the first day of the week input value to a number (0-7) for the start of the week in
|
|
850
|
+
* the calendar.
|
|
851
|
+
* @param firstDayOfWeek The first day of the week input value (number).
|
|
852
|
+
* @returns The first day of the week number.
|
|
853
|
+
*/
|
|
854
|
+
function transformToFirstDayOfWeekNumber(firstDayOfWeek) {
|
|
855
|
+
if (!firstDayOfWeek) {
|
|
856
|
+
return 7;
|
|
857
|
+
}
|
|
858
|
+
return numberAttribute(firstDayOfWeek);
|
|
859
|
+
}
|
|
860
|
+
|
|
798
861
|
/**
|
|
799
862
|
* The outermost container for the date picker.
|
|
800
863
|
*/
|
|
@@ -804,6 +867,10 @@ class NgpDatePicker {
|
|
|
804
867
|
* Access the date adapter.
|
|
805
868
|
*/
|
|
806
869
|
this.dateAdapter = injectDateAdapter();
|
|
870
|
+
/**
|
|
871
|
+
* Access the date picker config.
|
|
872
|
+
*/
|
|
873
|
+
this.config = injectDatePickerConfig();
|
|
807
874
|
/**
|
|
808
875
|
* Access the injector.
|
|
809
876
|
*/
|
|
@@ -833,6 +900,17 @@ class NgpDatePicker {
|
|
|
833
900
|
this.dateDisabled = input(() => false, {
|
|
834
901
|
alias: 'ngpDatePickerDateDisabled',
|
|
835
902
|
});
|
|
903
|
+
/**
|
|
904
|
+
* Sets which day starts the week in the calendar.
|
|
905
|
+
* Accepts 0-7 where 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday.
|
|
906
|
+
* Defaults to NgpDatePickerConfig.firstDayOfWeek (default 7 if not overridden).
|
|
907
|
+
* Note: Update calendar header column order when changing from Sunday start.
|
|
908
|
+
* @default 7 (Sunday)
|
|
909
|
+
*/
|
|
910
|
+
this.firstDayOfWeek = input(transformToFirstDayOfWeekNumber(this.config.firstDayOfWeek), {
|
|
911
|
+
alias: 'ngpDatePickerFirstDayOfWeek',
|
|
912
|
+
transform: transformToFirstDayOfWeekNumber,
|
|
913
|
+
});
|
|
836
914
|
/**
|
|
837
915
|
* The selected value.
|
|
838
916
|
*/
|
|
@@ -974,7 +1052,7 @@ class NgpDatePicker {
|
|
|
974
1052
|
return false;
|
|
975
1053
|
}
|
|
976
1054
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDatePicker, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
977
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.11", type: NgpDatePicker, isStandalone: true, selector: "[ngpDatePicker]", inputs: { min: { classPropertyName: "min", publicName: "ngpDatePickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpDatePickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpDatePickerDisabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "ngpDatePickerDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "ngpDatePickerDate", isSignal: true, isRequired: false, transformFunction: null }, focusedDate: { classPropertyName: "focusedDate", publicName: "ngpDatePickerFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "ngpDatePickerDateChange", focusedDateChange: "ngpDatePickerFocusedDateChange" }, host: { properties: { "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideDatePickerState()], queries: [{ propertyName: "label", first: true, predicate: NgpDatePickerLabelToken, descendants: true, isSignal: true }], exportAs: ["ngpDatePicker"], ngImport: i0 }); }
|
|
1055
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.11", type: NgpDatePicker, isStandalone: true, selector: "[ngpDatePicker]", inputs: { min: { classPropertyName: "min", publicName: "ngpDatePickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpDatePickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpDatePickerDisabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "ngpDatePickerDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "ngpDatePickerFirstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "ngpDatePickerDate", isSignal: true, isRequired: false, transformFunction: null }, focusedDate: { classPropertyName: "focusedDate", publicName: "ngpDatePickerFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "ngpDatePickerDateChange", focusedDateChange: "ngpDatePickerFocusedDateChange" }, host: { properties: { "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideDatePickerState()], queries: [{ propertyName: "label", first: true, predicate: NgpDatePickerLabelToken, descendants: true, isSignal: true }], exportAs: ["ngpDatePicker"], ngImport: i0 }); }
|
|
978
1056
|
}
|
|
979
1057
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDatePicker, decorators: [{
|
|
980
1058
|
type: Directive,
|
|
@@ -991,6 +1069,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
991
1069
|
class NgpDateRangePicker {
|
|
992
1070
|
constructor() {
|
|
993
1071
|
this.dateAdapter = injectDateAdapter();
|
|
1072
|
+
/**
|
|
1073
|
+
* Access the date range picker config.
|
|
1074
|
+
*/
|
|
1075
|
+
this.config = injectDatePickerConfig();
|
|
994
1076
|
/**
|
|
995
1077
|
* Access the injector.
|
|
996
1078
|
*/
|
|
@@ -1020,6 +1102,17 @@ class NgpDateRangePicker {
|
|
|
1020
1102
|
this.dateDisabled = input(() => false, {
|
|
1021
1103
|
alias: 'ngpDateRangePickerDateDisabled',
|
|
1022
1104
|
});
|
|
1105
|
+
/**
|
|
1106
|
+
* Sets which day starts the week in the calendar.
|
|
1107
|
+
* Accepts 0-7 where 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday.
|
|
1108
|
+
* Defaults to NgpDatePickerConfig.firstDayOfWeek (default 7 if not overridden).
|
|
1109
|
+
* Note: Update calendar header column order when changing from Sunday start.
|
|
1110
|
+
* @default 7 (Sunday)
|
|
1111
|
+
*/
|
|
1112
|
+
this.firstDayOfWeek = input(transformToFirstDayOfWeekNumber(this.config.firstDayOfWeek), {
|
|
1113
|
+
alias: 'ngpDateRangePickerFirstDayOfWeek',
|
|
1114
|
+
transform: transformToFirstDayOfWeekNumber,
|
|
1115
|
+
});
|
|
1023
1116
|
/**
|
|
1024
1117
|
* The selected start date
|
|
1025
1118
|
*/
|
|
@@ -1218,7 +1311,7 @@ class NgpDateRangePicker {
|
|
|
1218
1311
|
return this.dateAdapter.isAfter(date, start) && this.dateAdapter.isBefore(date, end);
|
|
1219
1312
|
}
|
|
1220
1313
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDateRangePicker, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1221
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.11", type: NgpDateRangePicker, isStandalone: true, selector: "[ngpDateRangePicker]", inputs: { min: { classPropertyName: "min", publicName: "ngpDateRangePickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpDateRangePickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpDateRangePickerDisabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "ngpDateRangePickerDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "ngpDateRangePickerStartDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "ngpDateRangePickerEndDate", isSignal: true, isRequired: false, transformFunction: null }, focusedDate: { classPropertyName: "focusedDate", publicName: "ngpDateRangePickerFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startDateChange: "ngpDateRangePickerStartDateChange", endDateChange: "ngpDateRangePickerEndDateChange", focusedDateChange: "ngpDateRangePickerFocusedDateChange" }, host: { properties: { "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideDateRangePickerState()], queries: [{ propertyName: "label", first: true, predicate: NgpDatePickerLabelToken, descendants: true, isSignal: true }], exportAs: ["ngpDateRangePicker"], ngImport: i0 }); }
|
|
1314
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.11", type: NgpDateRangePicker, isStandalone: true, selector: "[ngpDateRangePicker]", inputs: { min: { classPropertyName: "min", publicName: "ngpDateRangePickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpDateRangePickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpDateRangePickerDisabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "ngpDateRangePickerDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "ngpDateRangePickerFirstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "ngpDateRangePickerStartDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "ngpDateRangePickerEndDate", isSignal: true, isRequired: false, transformFunction: null }, focusedDate: { classPropertyName: "focusedDate", publicName: "ngpDateRangePickerFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startDateChange: "ngpDateRangePickerStartDateChange", endDateChange: "ngpDateRangePickerEndDateChange", focusedDateChange: "ngpDateRangePickerFocusedDateChange" }, host: { properties: { "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideDateRangePickerState()], queries: [{ propertyName: "label", first: true, predicate: NgpDatePickerLabelToken, descendants: true, isSignal: true }], exportAs: ["ngpDateRangePicker"], ngImport: i0 }); }
|
|
1222
1315
|
}
|
|
1223
1316
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDateRangePicker, decorators: [{
|
|
1224
1317
|
type: Directive,
|
|
@@ -1236,5 +1329,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
1236
1329
|
* Generated bundle index. Do not edit.
|
|
1237
1330
|
*/
|
|
1238
1331
|
|
|
1239
|
-
export { NgpDatePicker, NgpDatePickerCell, NgpDatePickerCellRender, NgpDatePickerCellRenderToken, NgpDatePickerDateButton, NgpDatePickerDateButtonToken, NgpDatePickerGrid, NgpDatePickerLabel, NgpDatePickerLabelToken, NgpDatePickerNextMonth, NgpDatePickerPreviousMonth, NgpDatePickerRowRender, NgpDatePickerRowRenderToken, NgpDateRangePicker, injectDatePickerCellDate, injectDatePickerCellRender, injectDatePickerDateButton, injectDatePickerLabel, injectDatePickerRowRender, injectDatePickerState, injectDatePickerWeek, injectDateRangePickerState, provideDatePickerState, provideDateRangePickerState };
|
|
1332
|
+
export { NgpDatePicker, NgpDatePickerCell, NgpDatePickerCellRender, NgpDatePickerCellRenderToken, NgpDatePickerDateButton, NgpDatePickerDateButtonToken, NgpDatePickerGrid, NgpDatePickerLabel, NgpDatePickerLabelToken, NgpDatePickerNextMonth, NgpDatePickerPreviousMonth, NgpDatePickerRowRender, NgpDatePickerRowRenderToken, NgpDateRangePicker, injectDatePickerCellDate, injectDatePickerCellRender, injectDatePickerConfig, injectDatePickerDateButton, injectDatePickerLabel, injectDatePickerRowRender, injectDatePickerState, injectDatePickerWeek, injectDateRangePickerState, provideDatePickerConfig, provideDatePickerState, provideDateRangePickerState, transformToFirstDayOfWeekNumber };
|
|
1240
1333
|
//# sourceMappingURL=ng-primitives-date-picker.mjs.map
|