@skyux/datetime 10.19.0 → 10.20.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.
@@ -4,5 +4,5 @@ import * as i0 from "@angular/core";
4
4
  export declare class SkyDateRangePickerEndDateResourceKeyPipe implements PipeTransform {
5
5
  transform(calculatorType: SkyDateRangeCalculatorType | undefined): string;
6
6
  static ɵfac: i0.ɵɵFactoryDeclaration<SkyDateRangePickerEndDateResourceKeyPipe, never>;
7
- static ɵpipe: i0.ɵɵPipeDeclaration<SkyDateRangePickerEndDateResourceKeyPipe, "skyDateRangePickerEndDateResourceKey", false>;
7
+ static ɵpipe: i0.ɵɵPipeDeclaration<SkyDateRangePickerEndDateResourceKeyPipe, "skyDateRangePickerEndDateResourceKey", true>;
8
8
  }
@@ -4,5 +4,5 @@ import * as i0 from "@angular/core";
4
4
  export declare class SkyDateRangePickerStartDateResourceKeyPipe implements PipeTransform {
5
5
  transform(calculatorType: SkyDateRangeCalculatorType | undefined): string;
6
6
  static ɵfac: i0.ɵɵFactoryDeclaration<SkyDateRangePickerStartDateResourceKeyPipe, never>;
7
- static ɵpipe: i0.ɵɵPipeDeclaration<SkyDateRangePickerStartDateResourceKeyPipe, "skyDateRangePickerStartDateResourceKey", false>;
7
+ static ɵpipe: i0.ɵɵPipeDeclaration<SkyDateRangePickerStartDateResourceKeyPipe, "skyDateRangePickerStartDateResourceKey", true>;
8
8
  }
@@ -1,30 +1,17 @@
1
- import { ChangeDetectorRef, NgZone, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
- import { AbstractControl, ControlValueAccessor, UntypedFormBuilder, UntypedFormGroup, ValidationErrors, Validator } from '@angular/forms';
3
- import { SkyAppLocaleProvider } from '@skyux/i18n';
4
- import { SkyThemeService } from '@skyux/theme';
5
- import { SkyDateRangeService } from './date-range.service';
1
+ import { AfterViewInit, DoCheck, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
+ import { AbstractControl, ControlValueAccessor, FormGroup, ValidationErrors, Validator } from '@angular/forms';
6
3
  import { SkyDateRangeCalculation } from './types/date-range-calculation';
7
4
  import { SkyDateRangeCalculator } from './types/date-range-calculator';
8
5
  import { SkyDateRangeCalculatorId } from './types/date-range-calculator-id';
9
6
  import * as i0 from "@angular/core";
10
- /**
11
- * Acts as a form control with a form model of type `SkyDateRangeCalculation`.
12
- * @example
13
- * ```
14
- * <sky-date-range-picker
15
- * formControlName="myPicker"
16
- * >
17
- * </sky-date-range-picker>
18
- * ```
19
- */
20
- export declare class SkyDateRangePickerComponent implements OnInit, OnChanges, OnDestroy, ControlValueAccessor, Validator {
7
+ export declare class SkyDateRangePickerComponent implements AfterViewInit, ControlValueAccessor, DoCheck, OnDestroy, OnInit, Validator {
21
8
  #private;
22
9
  /**
23
10
  * IDs for the date range options to include in the picker's dropdown.
24
11
  * The options specify calculator objects that return two `Date` objects to represent date ranges.
25
12
  * By default, this property includes all `SkyDateRangeCalculatorId` values.
26
13
  */
27
- set calculatorIds(value: SkyDateRangeCalculatorId[] | undefined);
14
+ set calculatorIds(calculatorIds: SkyDateRangeCalculatorId[] | undefined);
28
15
  get calculatorIds(): SkyDateRangeCalculatorId[];
29
16
  /**
30
17
  * The date format for
@@ -33,36 +20,21 @@ export declare class SkyDateRangePickerComponent implements OnInit, OnChanges, O
33
20
  * up to two `sky-datepicker` components.
34
21
  * @default "MM/DD/YYYY"
35
22
  */
36
- set dateFormat(value: string | undefined);
37
- get dateFormat(): string | undefined;
23
+ dateFormat: string | undefined;
38
24
  /**
39
- * Whether to disable the date range picker on template-driven forms. Don't use this input on reactive forms because they may overwrite the input or leave the control out of sync.
40
- * To set the disabled state on reactive forms, use the `FormControl` instead.
25
+ * Whether to disable the date range picker on template-driven forms. Don't use
26
+ * this input on reactive forms because they may overwrite the input or leave
27
+ * the control out of sync. To set the disabled state on reactive forms,
28
+ * use the `FormControl` instead.
41
29
  * @default false
42
30
  */
43
- set disabled(value: boolean | undefined);
44
- get disabled(): boolean | undefined;
45
- /**
46
- * The label for the date range picker.
47
- * @required
48
- */
49
- label: string | undefined;
50
- /**
51
- * [Persistent inline help text](https://developer.blackbaud.com/skyux/design/guidelines/user-assistance#inline-help) that provides
52
- * additional context to the user.
53
- * @preview
54
- */
55
- hintText: string | undefined;
56
- /**
57
- * Whether to require users to specify a start date.
58
- * @default false
59
- */
60
- startDateRequired: boolean | undefined;
31
+ set disabled(value: boolean);
61
32
  /**
62
33
  * Whether to require users to specify a end date.
63
- * @default false
34
+ * @deprecated Use the `required` directive or Angular's `Validators.required`
35
+ * on the form control to mark the date range picker as required.
64
36
  */
65
- endDateRequired: boolean | undefined;
37
+ endDateRequired: boolean;
66
38
  /**
67
39
  * The content of the help popover. When specified along with `labelText`, a [help inline](https://developer.blackbaud.com/skyux/components/help-inline)
68
40
  * button is added to date range picker. The help inline button displays a [popover](https://developer.blackbaud.com/skyux/components/popover)
@@ -76,33 +48,64 @@ export declare class SkyDateRangePickerComponent implements OnInit, OnChanges, O
76
48
  * @preview
77
49
  */
78
50
  helpPopoverTitle: string | undefined;
51
+ /**
52
+ * [Persistent inline help text](https://developer.blackbaud.com/skyux/design/guidelines/user-assistance#inline-help) that provides
53
+ * additional context to the user.
54
+ * @preview
55
+ */
56
+ hintText: string | undefined;
57
+ /**
58
+ * The label for the date range picker.
59
+ * @required
60
+ */
61
+ label: string | undefined;
62
+ /**
63
+ * Whether the date range picker requires a value.
64
+ */
65
+ required: boolean;
79
66
  /**
80
67
  * Whether the date range picker is stacked on another form component. When specified, the appropriate
81
68
  * vertical spacing is automatically added to the date range picker.
82
69
  * @preview
83
70
  */
84
71
  stacked: boolean;
85
- display: string | undefined;
86
- selectedCalculator: SkyDateRangeCalculator | undefined;
87
- readonly dateRangePickerId: string;
88
- calculators: SkyDateRangeCalculator[];
89
- dateFormatOrDefault: string | undefined;
90
- formGroup: UntypedFormGroup | undefined;
91
- isReady: boolean;
92
- showEndDatePicker: boolean;
93
- showStartDatePicker: boolean;
94
- protected hostHintText: string | undefined;
95
- constructor(changeDetector: ChangeDetectorRef, dateRangeService: SkyDateRangeService, formBuilder: UntypedFormBuilder, localeProvider: SkyAppLocaleProvider, ngZone: NgZone, themeSvc?: SkyThemeService);
72
+ /**
73
+ * Whether to require users to specify a start date.
74
+ * @deprecated Use the `required` directive or Angular's `Validators.required`
75
+ * on the form control to mark the date range picker as required.
76
+ */
77
+ startDateRequired: boolean;
78
+ protected display: string | undefined;
79
+ protected calculators: SkyDateRangeCalculator[];
80
+ protected formGroup: FormGroup;
81
+ protected hasErrors: boolean;
82
+ protected selectedCalculator: SkyDateRangeCalculator;
83
+ protected showEndDatePicker: boolean;
84
+ protected showStartDatePicker: boolean;
85
+ constructor();
96
86
  ngOnInit(): void;
97
- ngOnChanges(changes: SimpleChanges): void;
87
+ ngAfterViewInit(): void;
88
+ /**
89
+ * Check for touched status in ngDoCheck since Angular does not (currently)
90
+ * have an API to respond to touched status changes from the host control.
91
+ * @see https://github.com/angular/angular/issues/17736#issuecomment-310812368
92
+ * TODO: Angular 18 introduces a new API to respond to these statuses.
93
+ * @see https://github.com/angular/angular/issues/10887#issuecomment-2035267400
94
+ */
95
+ ngDoCheck(): void;
98
96
  ngOnDestroy(): void;
99
- onFieldBlur(): void;
100
- writeValue(value: SkyDateRangeCalculation): void;
97
+ registerOnChange(fn: (_: unknown) => void): void;
98
+ registerOnTouched(fn: () => void): void;
99
+ setDisabledState(isDisabled: boolean): void;
101
100
  validate(control: AbstractControl): ValidationErrors | null;
102
- registerOnChange(fn: (value: SkyDateRangeCalculation | undefined) => SkyDateRangeCalculation): void;
103
- registerOnTouched(fn: () => SkyDateRangeCalculation): void;
104
- setDisabledState(disabled: boolean): void;
105
- static ɵfac: i0.ɵɵFactoryDeclaration<SkyDateRangePickerComponent, [null, null, null, null, null, { optional: true; }]>;
106
- static ɵcmp: i0.ɵɵComponentDeclaration<SkyDateRangePickerComponent, "sky-date-range-picker", never, { "calculatorIds": { "alias": "calculatorIds"; "required": false; }; "dateFormat": { "alias": "dateFormat"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "label": { "alias": "label"; "required": false; }; "hintText": { "alias": "hintText"; "required": false; }; "startDateRequired": { "alias": "startDateRequired"; "required": false; }; "endDateRequired": { "alias": "endDateRequired"; "required": false; }; "helpPopoverContent": { "alias": "helpPopoverContent"; "required": false; }; "helpPopoverTitle": { "alias": "helpPopoverTitle"; "required": false; }; "stacked": { "alias": "stacked"; "required": false; }; }, {}, never, never, false, never>;
101
+ writeValue(value: Partial<SkyDateRangeCalculation> | undefined): void;
102
+ protected isRequired(): boolean;
103
+ protected onBlur(): void;
104
+ static ɵfac: i0.ɵɵFactoryDeclaration<SkyDateRangePickerComponent, never>;
105
+ static ɵcmp: i0.ɵɵComponentDeclaration<SkyDateRangePickerComponent, "sky-date-range-picker", never, { "calculatorIds": { "alias": "calculatorIds"; "required": false; }; "dateFormat": { "alias": "dateFormat"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "endDateRequired": { "alias": "endDateRequired"; "required": false; }; "helpPopoverContent": { "alias": "helpPopoverContent"; "required": false; }; "helpPopoverTitle": { "alias": "helpPopoverTitle"; "required": false; }; "hintText": { "alias": "hintText"; "required": false; }; "label": { "alias": "label"; "required": false; }; "required": { "alias": "required"; "required": false; }; "stacked": { "alias": "stacked"; "required": false; }; "startDateRequired": { "alias": "startDateRequired"; "required": false; }; }, {}, never, never, true, never>;
106
+ static ngAcceptInputType_disabled: unknown;
107
+ static ngAcceptInputType_endDateRequired: unknown;
108
+ static ngAcceptInputType_required: unknown;
107
109
  static ngAcceptInputType_stacked: unknown;
110
+ static ngAcceptInputType_startDateRequired: unknown;
108
111
  }
@@ -1,15 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./date-range-picker.component";
3
- import * as i2 from "./date-range-picker-end-date-resource-key.pipe";
4
- import * as i3 from "./date-range-picker-start-date-resource-key.pipe";
5
- import * as i4 from "@angular/common";
6
- import * as i5 from "@angular/forms";
7
- import * as i6 from "../datepicker/datepicker.module";
8
- import * as i7 from "../shared/sky-datetime-resources.module";
9
- import * as i8 from "@skyux/core";
10
- import * as i9 from "@skyux/forms";
11
3
  export declare class SkyDateRangePickerModule {
12
4
  static ɵfac: i0.ɵɵFactoryDeclaration<SkyDateRangePickerModule, never>;
13
- static ɵmod: i0.ɵɵNgModuleDeclaration<SkyDateRangePickerModule, [typeof i1.SkyDateRangePickerComponent, typeof i2.SkyDateRangePickerEndDateResourceKeyPipe, typeof i3.SkyDateRangePickerStartDateResourceKeyPipe], [typeof i4.CommonModule, typeof i5.FormsModule, typeof i5.ReactiveFormsModule, typeof i6.SkyDatepickerModule, typeof i7.SkyDatetimeResourcesModule, typeof i8.SkyIdModule, typeof i9.SkyInputBoxModule], [typeof i1.SkyDateRangePickerComponent]>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SkyDateRangePickerModule, never, [typeof i1.SkyDateRangePickerComponent], [typeof i1.SkyDateRangePickerComponent]>;
14
6
  static ɵinj: i0.ɵɵInjectorDeclaration<SkyDateRangePickerModule>;
15
7
  }
@@ -1,3 +1,4 @@
1
+ import { OnDestroy } from '@angular/core';
1
2
  import { SkyLibResourcesService } from '@skyux/i18n';
2
3
  import { SkyDateRangeCalculator } from './types/date-range-calculator';
3
4
  import { SkyDateRangeCalculatorConfig } from './types/date-range-calculator-config';
@@ -6,23 +7,32 @@ import * as i0 from "@angular/core";
6
7
  /**
7
8
  * Creates and manages `SkyDateRangeCalculator` instances.
8
9
  */
9
- export declare class SkyDateRangeService {
10
+ export declare class SkyDateRangeService implements OnDestroy {
10
11
  #private;
12
+ get calculators(): SkyDateRangeCalculator[];
11
13
  private static lastId;
12
14
  constructor(resourcesService: SkyLibResourcesService);
15
+ ngOnDestroy(): void;
13
16
  /**
14
17
  * Creates a custom date range calculator.
15
18
  * @param config The calculator config.
16
19
  */
17
20
  createCalculator(config: SkyDateRangeCalculatorConfig): SkyDateRangeCalculator;
21
+ /**
22
+ * Returns calculators from an array of calculator IDs.
23
+ * @param calculatorIds The array of calculator IDs.
24
+ */
25
+ filterCalculators(calculatorIds: SkyDateRangeCalculatorId[]): SkyDateRangeCalculator[];
18
26
  /**
19
27
  * Returns calculators from an array of calculator IDs.
20
28
  * @param ids The array of calculator IDs.
29
+ * @deprecated Call `filterCalculators()` instead.
21
30
  */
22
31
  getCalculators(ids: SkyDateRangeCalculatorId[]): Promise<SkyDateRangeCalculator[]>;
23
32
  /**
24
33
  * Returns a calculator from a calculator ID.
25
34
  * @param id The calculator ID.
35
+ * @deprecated Call `filterCalculators()` instead.
26
36
  */
27
37
  getCalculatorById(id: SkyDateRangeCalculatorId): Promise<SkyDateRangeCalculator>;
28
38
  static ɵfac: i0.ɵɵFactoryDeclaration<SkyDateRangeService, never>;
@@ -16,7 +16,11 @@ export declare class SkyDateRangeCalculator {
16
16
  /**
17
17
  * The text to display in the calculator select menu.
18
18
  */
19
- readonly shortDescription: string;
19
+ shortDescription: string;
20
+ /**
21
+ * @internal
22
+ */
23
+ readonly _shortDescriptionResourceKey: string | undefined;
20
24
  /**
21
25
  * The type of calculations available for the date range.
22
26
  */
@@ -25,7 +29,9 @@ export declare class SkyDateRangeCalculator {
25
29
  /**
26
30
  * The calculator ID that specifies calculator objects that represent date ranges.
27
31
  */
28
- calculatorId: SkyDateRangeCalculatorId, config: SkyDateRangeCalculatorConfig);
32
+ calculatorId: SkyDateRangeCalculatorId, config: SkyDateRangeCalculatorConfig & {
33
+ _shortDescriptionResourceKey?: string;
34
+ });
29
35
  /**
30
36
  * Gets the current value of the calculator.
31
37
  * @param startDateInput The start date.
@@ -1,2 +1,4 @@
1
+ import { SkyDateRangeCalculatorId } from './date-range-calculator-id';
1
2
  import { SkyDateRangeDefaultCalculatorConfig } from './date-range-default-calculator-config';
3
+ export declare const SKY_DEFAULT_CALCULATOR_IDS: SkyDateRangeCalculatorId[];
2
4
  export declare const SKY_DEFAULT_CALCULATOR_CONFIGS: SkyDateRangeDefaultCalculatorConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyux/datetime",
3
- "version": "10.19.0",
3
+ "version": "10.20.0",
4
4
  "author": "Blackbaud, Inc.",
5
5
  "keywords": [
6
6
  "blackbaud",
@@ -41,13 +41,13 @@
41
41
  "@angular/core": "^17.3.4",
42
42
  "@angular/forms": "^17.3.4",
43
43
  "@angular/platform-browser": "^17.3.4",
44
- "@skyux-sdk/testing": "10.19.0",
45
- "@skyux/core": "10.19.0",
46
- "@skyux/forms": "10.19.0",
47
- "@skyux/i18n": "10.19.0",
48
- "@skyux/indicators": "10.19.0",
49
- "@skyux/popovers": "10.19.0",
50
- "@skyux/theme": "10.19.0",
44
+ "@skyux-sdk/testing": "10.20.0",
45
+ "@skyux/core": "10.20.0",
46
+ "@skyux/forms": "10.20.0",
47
+ "@skyux/i18n": "10.20.0",
48
+ "@skyux/indicators": "10.20.0",
49
+ "@skyux/popovers": "10.20.0",
50
+ "@skyux/theme": "10.20.0",
51
51
  "moment": "^2.30.1"
52
52
  },
53
53
  "dependencies": {