@cqa-lib/cqa-ui 1.0.98 → 1.0.100
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/filters/daterangepicker/daterangepicker.component.mjs +234 -0
- package/esm2020/lib/filters/daterangepicker/daterangepicker.directive.mjs +322 -0
- package/esm2020/lib/filters/dynamic-filter/dynamic-filter.component.mjs +56 -15
- package/esm2020/lib/ui-kit.module.mjs +11 -1
- package/esm2020/public-api.mjs +3 -1
- package/fesm2015/cqa-lib-cqa-ui.mjs +615 -22
- package/fesm2015/cqa-lib-cqa-ui.mjs.map +1 -1
- package/fesm2020/cqa-lib-cqa-ui.mjs +619 -22
- package/fesm2020/cqa-lib-cqa-ui.mjs.map +1 -1
- package/lib/filters/daterangepicker/daterangepicker.component.d.ts +56 -0
- package/lib/filters/daterangepicker/daterangepicker.directive.d.ts +73 -0
- package/lib/filters/dynamic-filter/dynamic-filter.component.d.ts +11 -2
- package/lib/ui-kit.module.d.ts +38 -36
- package/package.json +4 -1
- package/public-api.d.ts +2 -0
- package/src/lib/filters/daterangepicker/README.md +146 -0
- package/styles.css +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { EventEmitter, ElementRef, OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import { DateRangePickerOptions } from './daterangepicker.directive';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class DaterangepickerComponent implements OnInit, OnDestroy, ControlValueAccessor {
|
|
6
|
+
label?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
startDate?: Date | string;
|
|
10
|
+
endDate?: Date | string;
|
|
11
|
+
minDate?: Date | string;
|
|
12
|
+
maxDate?: Date | string;
|
|
13
|
+
ranges?: any;
|
|
14
|
+
autoApply: boolean;
|
|
15
|
+
alwaysShowCalendars: boolean;
|
|
16
|
+
opens: 'left' | 'right' | 'center';
|
|
17
|
+
drops: 'down' | 'up' | 'auto';
|
|
18
|
+
isInvalidDate?: (date: Date) => boolean;
|
|
19
|
+
datesUpdated: EventEmitter<{
|
|
20
|
+
startDate: Date | null;
|
|
21
|
+
endDate: Date | null;
|
|
22
|
+
}>;
|
|
23
|
+
cancelClicked: EventEmitter<void>;
|
|
24
|
+
applyClicked: EventEmitter<{
|
|
25
|
+
startDate: Date | null;
|
|
26
|
+
endDate: Date | null;
|
|
27
|
+
}>;
|
|
28
|
+
inputRef: ElementRef<HTMLInputElement>;
|
|
29
|
+
pickerOptions: DateRangePickerOptions;
|
|
30
|
+
private onChange;
|
|
31
|
+
private onTouched;
|
|
32
|
+
ngOnInit(): void;
|
|
33
|
+
ngOnDestroy(): void;
|
|
34
|
+
onDatesUpdated(event: {
|
|
35
|
+
startDate: Date | null;
|
|
36
|
+
endDate: Date | null;
|
|
37
|
+
}): void;
|
|
38
|
+
onCancel(): void;
|
|
39
|
+
onApply(event: {
|
|
40
|
+
startDate: Date | null;
|
|
41
|
+
endDate: Date | null;
|
|
42
|
+
}): void;
|
|
43
|
+
writeValue(value: {
|
|
44
|
+
start: Date | null;
|
|
45
|
+
end: Date | null;
|
|
46
|
+
} | null): void;
|
|
47
|
+
registerOnChange(fn: (value: {
|
|
48
|
+
start: Date | null;
|
|
49
|
+
end: Date | null;
|
|
50
|
+
} | null) => void): void;
|
|
51
|
+
registerOnTouched(fn: () => void): void;
|
|
52
|
+
setDisabledState(isDisabled: boolean): void;
|
|
53
|
+
openPicker(): void;
|
|
54
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaterangepickerComponent, never>;
|
|
55
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DaterangepickerComponent, "cqa-daterangepicker", never, { "label": "label"; "placeholder": "placeholder"; "disabled": "disabled"; "startDate": "startDate"; "endDate": "endDate"; "minDate": "minDate"; "maxDate": "maxDate"; "ranges": "ranges"; "autoApply": "autoApply"; "alwaysShowCalendars": "alwaysShowCalendars"; "opens": "opens"; "drops": "drops"; "isInvalidDate": "isInvalidDate"; }, { "datesUpdated": "datesUpdated"; "cancelClicked": "cancelClicked"; "applyClicked": "applyClicked"; }, never, never>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ElementRef, EventEmitter, OnInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import 'daterangepicker';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export interface DateRangePickerOptions {
|
|
6
|
+
startDate?: Date | string;
|
|
7
|
+
endDate?: Date | string;
|
|
8
|
+
minDate?: Date | string;
|
|
9
|
+
maxDate?: Date | string;
|
|
10
|
+
locale?: any;
|
|
11
|
+
ranges?: any;
|
|
12
|
+
opens?: 'left' | 'right' | 'center';
|
|
13
|
+
drops?: 'down' | 'up' | 'auto';
|
|
14
|
+
buttonClasses?: string;
|
|
15
|
+
applyButtonClasses?: string;
|
|
16
|
+
cancelButtonClasses?: string;
|
|
17
|
+
autoApply?: boolean;
|
|
18
|
+
alwaysShowCalendars?: boolean;
|
|
19
|
+
showDropdowns?: boolean;
|
|
20
|
+
showWeekNumbers?: boolean;
|
|
21
|
+
showISOWeekNumbers?: boolean;
|
|
22
|
+
singleDatePicker?: boolean;
|
|
23
|
+
timePicker?: boolean;
|
|
24
|
+
timePicker24Hour?: boolean;
|
|
25
|
+
timePickerIncrement?: number;
|
|
26
|
+
timePickerSeconds?: boolean;
|
|
27
|
+
linkedCalendars?: boolean;
|
|
28
|
+
autoUpdateInput?: boolean;
|
|
29
|
+
isInvalidDate?: (date: Date) => boolean;
|
|
30
|
+
isCustomDate?: (date: Date) => string | boolean;
|
|
31
|
+
parentEl?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare class DaterangepickerDirective implements OnInit, OnDestroy, OnChanges, ControlValueAccessor {
|
|
34
|
+
private el;
|
|
35
|
+
options: DateRangePickerOptions;
|
|
36
|
+
startDate?: Date | string;
|
|
37
|
+
endDate?: Date | string;
|
|
38
|
+
minDate?: Date | string;
|
|
39
|
+
maxDate?: Date | string;
|
|
40
|
+
datesUpdated: EventEmitter<{
|
|
41
|
+
startDate: Date | null;
|
|
42
|
+
endDate: Date | null;
|
|
43
|
+
}>;
|
|
44
|
+
cancelClicked: EventEmitter<void>;
|
|
45
|
+
applyClicked: EventEmitter<{
|
|
46
|
+
startDate: Date | null;
|
|
47
|
+
endDate: Date | null;
|
|
48
|
+
}>;
|
|
49
|
+
private pickerInstance;
|
|
50
|
+
private onChange;
|
|
51
|
+
private onTouched;
|
|
52
|
+
/**
|
|
53
|
+
* Safely update the input text to avoid "Invalid date" or "undefined" strings.
|
|
54
|
+
*/
|
|
55
|
+
private updateInputValue;
|
|
56
|
+
constructor(el: ElementRef);
|
|
57
|
+
ngOnInit(): void;
|
|
58
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
59
|
+
ngOnDestroy(): void;
|
|
60
|
+
private initDaterangepicker;
|
|
61
|
+
private updateDates;
|
|
62
|
+
private updateMinMaxDates;
|
|
63
|
+
private destroyPicker;
|
|
64
|
+
writeValue(value: {
|
|
65
|
+
start: Date | null;
|
|
66
|
+
end: Date | null;
|
|
67
|
+
} | null): void;
|
|
68
|
+
registerOnChange(fn: (value: any) => void): void;
|
|
69
|
+
registerOnTouched(fn: () => void): void;
|
|
70
|
+
setDisabledState(isDisabled: boolean): void;
|
|
71
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaterangepickerDirective, never>;
|
|
72
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DaterangepickerDirective, "[cqaDaterangepicker]", never, { "options": "options"; "startDate": "startDate"; "endDate": "endDate"; "minDate": "minDate"; "maxDate": "maxDate"; }, { "datesUpdated": "datesUpdated"; "cancelClicked": "cancelClicked"; "applyClicked": "applyClicked"; }, never>;
|
|
73
|
+
}
|
|
@@ -4,7 +4,7 @@ import { MatDatepickerInputEvent } from '@angular/material/datepicker';
|
|
|
4
4
|
import { DynamicSelectFieldConfig } from '../../dynamic-select/dynamic-select-field.component';
|
|
5
5
|
import { DynamicSelectFieldComponent } from '../../dynamic-select/dynamic-select-field.component';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
|
-
declare type FilterType = 'select' | 'date-range';
|
|
7
|
+
declare type FilterType = 'select' | 'date-range-picker';
|
|
8
8
|
export interface DynamicFilterOption {
|
|
9
9
|
id?: number | string;
|
|
10
10
|
name?: string;
|
|
@@ -88,13 +88,22 @@ export declare class DynamicFilterComponent implements OnChanges {
|
|
|
88
88
|
private getInitialDateRangeValue;
|
|
89
89
|
private normalizeDateValue;
|
|
90
90
|
private invokeDateRangeChange;
|
|
91
|
-
applyPresetToGroup(key: string, presetKey: 'today' | 'last7days' | 'last30days' | 'last90days' | 'thismonth' | 'lastmonth'): void;
|
|
91
|
+
applyPresetToGroup(key: string, presetKey: 'today' | 'last7days' | 'last30days' | 'last90days' | 'last3months' | 'thismonth' | 'lastmonth'): void;
|
|
92
92
|
private getPresetDates;
|
|
93
93
|
private startOfDay;
|
|
94
94
|
private endOfDay;
|
|
95
95
|
private startOfMonth;
|
|
96
96
|
private endOfMonth;
|
|
97
97
|
private buildNgxRanges;
|
|
98
|
+
onDaterangepickerChange(event: {
|
|
99
|
+
startDate: Date | null;
|
|
100
|
+
endDate: Date | null;
|
|
101
|
+
}, key: string): void;
|
|
102
|
+
onDaterangepickerApply(event: {
|
|
103
|
+
startDate: Date | null;
|
|
104
|
+
endDate: Date | null;
|
|
105
|
+
}, key: string): void;
|
|
106
|
+
getDaterangepickerRanges(): any;
|
|
98
107
|
getDateValidationError(key: string): string | null;
|
|
99
108
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFilterComponent, never>;
|
|
100
109
|
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFilterComponent, "cqa-dynamic-filter", never, { "config": "config"; "model": "model"; "showFilterPanel": "showFilterPanel"; "buttonLayout": "buttonLayout"; }, { "filtersApplied": "filtersApplied"; "filtersChanged": "filtersChanged"; "resetAction": "resetAction"; "onApplyFilterClick": "onApplyFilterClick"; "onResetFilterClick": "onResetFilterClick"; }, never, never>;
|
package/lib/ui-kit.module.d.ts
CHANGED
|
@@ -11,44 +11,46 @@ import * as i8 from "./pagination/pagination.component";
|
|
|
11
11
|
import * as i9 from "./action-menu/action-menu.component";
|
|
12
12
|
import * as i10 from "./other-button/other-button.component";
|
|
13
13
|
import * as i11 from "./filters/dynamic-filter/dynamic-filter.component";
|
|
14
|
-
import * as i12 from "./
|
|
15
|
-
import * as i13 from "./
|
|
16
|
-
import * as i14 from "./
|
|
17
|
-
import * as i15 from "./
|
|
18
|
-
import * as i16 from "./dashboards/
|
|
19
|
-
import * as i17 from "./dashboards/
|
|
20
|
-
import * as i18 from "./dashboards/
|
|
21
|
-
import * as i19 from "./dashboards/
|
|
22
|
-
import * as i20 from "./dashboards/
|
|
23
|
-
import * as i21 from "./dashboards/
|
|
24
|
-
import * as i22 from "./
|
|
25
|
-
import * as i23 from "./
|
|
26
|
-
import * as i24 from "./
|
|
27
|
-
import * as i25 from "./
|
|
28
|
-
import * as i26 from "./
|
|
29
|
-
import * as i27 from "./
|
|
30
|
-
import * as i28 from "./
|
|
31
|
-
import * as i29 from "./
|
|
32
|
-
import * as i30 from "./
|
|
33
|
-
import * as i31 from "./
|
|
34
|
-
import * as i32 from "
|
|
35
|
-
import * as i33 from "
|
|
36
|
-
import * as i34 from "@angular/
|
|
37
|
-
import * as i35 from "@angular/
|
|
38
|
-
import * as i36 from "@angular/material/
|
|
39
|
-
import * as i37 from "@angular/material/
|
|
40
|
-
import * as i38 from "@angular/material/
|
|
41
|
-
import * as i39 from "@angular/material/
|
|
42
|
-
import * as i40 from "@angular/material/
|
|
43
|
-
import * as i41 from "@angular/material/
|
|
44
|
-
import * as i42 from "@angular/material/
|
|
45
|
-
import * as i43 from "@angular/material/
|
|
46
|
-
import * as i44 from "@angular/material/
|
|
47
|
-
import * as i45 from "@angular/
|
|
48
|
-
import * as i46 from "@angular/
|
|
14
|
+
import * as i12 from "./filters/daterangepicker/daterangepicker.directive";
|
|
15
|
+
import * as i13 from "./filters/daterangepicker/daterangepicker.component";
|
|
16
|
+
import * as i14 from "./column-visibility/column-visibility.component";
|
|
17
|
+
import * as i15 from "./table-action-toolbar/table-action-toolbar.component";
|
|
18
|
+
import * as i16 from "./dashboards/metrics-card/metrics-card.component";
|
|
19
|
+
import * as i17 from "./dashboards/metrics-card/metrics-block.component";
|
|
20
|
+
import * as i18 from "./dashboards/chart-card/chart-card.component";
|
|
21
|
+
import * as i19 from "./dashboards/progress-text-card/progress-text-card.component";
|
|
22
|
+
import * as i20 from "./dashboards/dashboard-header/dashboard-header.component";
|
|
23
|
+
import * as i21 from "./dashboards/coverage-module-card/coverage-module-card.component";
|
|
24
|
+
import * as i22 from "./dashboards/test-distribution-card/test-distribution-card.component";
|
|
25
|
+
import * as i23 from "./dashboards/failed-test-cases-card/failed-test-cases-card.component";
|
|
26
|
+
import * as i24 from "./dynamic-select/dynamic-select-field.component";
|
|
27
|
+
import * as i25 from "./selected-filters/selected-filters.component";
|
|
28
|
+
import * as i26 from "./dashboards/insight-card/insight-card.component";
|
|
29
|
+
import * as i27 from "./badge/badge.component";
|
|
30
|
+
import * as i28 from "./dropdown-button/dropdown-button.component";
|
|
31
|
+
import * as i29 from "./dashboards/heat-error-map-cell/heat-error-map-cell.component";
|
|
32
|
+
import * as i30 from "./empty-state/empty-state.component";
|
|
33
|
+
import * as i31 from "./templates/table-template.component";
|
|
34
|
+
import * as i32 from "./full-table-loader/full-table-loader.component";
|
|
35
|
+
import * as i33 from "./table-data-loader/table-data-loader.component";
|
|
36
|
+
import * as i34 from "@angular/common";
|
|
37
|
+
import * as i35 from "@angular/forms";
|
|
38
|
+
import * as i36 from "@angular/material/icon";
|
|
39
|
+
import * as i37 from "@angular/material/menu";
|
|
40
|
+
import * as i38 from "@angular/material/button";
|
|
41
|
+
import * as i39 from "@angular/material/form-field";
|
|
42
|
+
import * as i40 from "@angular/material/select";
|
|
43
|
+
import * as i41 from "@angular/material/core";
|
|
44
|
+
import * as i42 from "@angular/material/checkbox";
|
|
45
|
+
import * as i43 from "@angular/material/radio";
|
|
46
|
+
import * as i44 from "@angular/material/datepicker";
|
|
47
|
+
import * as i45 from "@angular/material/progress-spinner";
|
|
48
|
+
import * as i46 from "@angular/material/tooltip";
|
|
49
|
+
import * as i47 from "@angular/cdk/overlay";
|
|
50
|
+
import * as i48 from "@angular/cdk/portal";
|
|
49
51
|
export declare class UiKitModule {
|
|
50
52
|
constructor(iconRegistry: MatIconRegistry);
|
|
51
53
|
static ɵfac: i0.ɵɵFactoryDeclaration<UiKitModule, never>;
|
|
52
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<UiKitModule, [typeof i1.ButtonComponent, typeof i2.SearchBarComponent, typeof i3.SegmentControlComponent, typeof i4.DialogComponent, typeof i5.DynamicTableComponent, typeof i6.DynamicCellTemplateDirective, typeof i6.DynamicHeaderTemplateDirective, typeof i7.DynamicCellContainerDirective, typeof i8.PaginationComponent, typeof i9.ActionMenuButtonComponent, typeof i10.OtherButtonComponent, typeof i11.DynamicFilterComponent, typeof i12.
|
|
54
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<UiKitModule, [typeof i1.ButtonComponent, typeof i2.SearchBarComponent, typeof i3.SegmentControlComponent, typeof i4.DialogComponent, typeof i5.DynamicTableComponent, typeof i6.DynamicCellTemplateDirective, typeof i6.DynamicHeaderTemplateDirective, typeof i7.DynamicCellContainerDirective, typeof i8.PaginationComponent, typeof i9.ActionMenuButtonComponent, typeof i10.OtherButtonComponent, typeof i11.DynamicFilterComponent, typeof i12.DaterangepickerDirective, typeof i13.DaterangepickerComponent, typeof i14.ColumnVisibilityComponent, typeof i15.TableActionToolbarComponent, typeof i16.MetricsCardComponent, typeof i17.MetricsBlockComponent, typeof i18.ChartCardComponent, typeof i19.ProgressTextCardComponent, typeof i20.DashboardHeaderComponent, typeof i21.CoverageModuleCardComponent, typeof i22.TestDistributionCardComponent, typeof i23.FailedTestCasesCardComponent, typeof i24.DynamicSelectFieldComponent, typeof i25.SelectedFiltersComponent, typeof i26.InsightCardComponent, typeof i27.BadgeComponent, typeof i28.DropdownButtonComponent, typeof i29.HeatErrorMapCellComponent, typeof i30.EmptyStateComponent, typeof i31.TableTemplateComponent, typeof i32.FullTableLoaderComponent, typeof i33.TableDataLoaderComponent], [typeof i34.CommonModule, typeof i35.FormsModule, typeof i35.ReactiveFormsModule, typeof i36.MatIconModule, typeof i37.MatMenuModule, typeof i38.MatButtonModule, typeof i39.MatFormFieldModule, typeof i40.MatSelectModule, typeof i41.MatOptionModule, typeof i42.MatCheckboxModule, typeof i43.MatRadioModule, typeof i44.MatDatepickerModule, typeof i41.MatNativeDateModule, typeof i45.MatProgressSpinnerModule, typeof i46.MatTooltipModule, typeof i47.OverlayModule, typeof i48.PortalModule], [typeof i1.ButtonComponent, typeof i2.SearchBarComponent, typeof i3.SegmentControlComponent, typeof i4.DialogComponent, typeof i5.DynamicTableComponent, typeof i6.DynamicCellTemplateDirective, typeof i6.DynamicHeaderTemplateDirective, typeof i7.DynamicCellContainerDirective, typeof i8.PaginationComponent, typeof i9.ActionMenuButtonComponent, typeof i10.OtherButtonComponent, typeof i11.DynamicFilterComponent, typeof i12.DaterangepickerDirective, typeof i13.DaterangepickerComponent, typeof i14.ColumnVisibilityComponent, typeof i15.TableActionToolbarComponent, typeof i16.MetricsCardComponent, typeof i18.ChartCardComponent, typeof i19.ProgressTextCardComponent, typeof i20.DashboardHeaderComponent, typeof i21.CoverageModuleCardComponent, typeof i22.TestDistributionCardComponent, typeof i23.FailedTestCasesCardComponent, typeof i24.DynamicSelectFieldComponent, typeof i25.SelectedFiltersComponent, typeof i26.InsightCardComponent, typeof i27.BadgeComponent, typeof i28.DropdownButtonComponent, typeof i29.HeatErrorMapCellComponent, typeof i30.EmptyStateComponent, typeof i31.TableTemplateComponent, typeof i32.FullTableLoaderComponent, typeof i33.TableDataLoaderComponent]>;
|
|
53
55
|
static ɵinj: i0.ɵɵInjectorDeclaration<UiKitModule>;
|
|
54
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cqa-lib/cqa-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.100",
|
|
4
4
|
"description": "UI Kit library for Angular 13.4",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
"rxjs": "^6.6.7 || ^7.5.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"daterangepicker": "^3.1.0",
|
|
35
|
+
"jquery": "^3.7.1",
|
|
36
|
+
"moment": "^2.30.1",
|
|
34
37
|
"tslib": "^2.3.0"
|
|
35
38
|
},
|
|
36
39
|
"module": "fesm2015/cqa-lib-cqa-ui.mjs",
|
package/public-api.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export * from './lib/pagination/pagination.component';
|
|
|
15
15
|
export * from './lib/action-menu/action-menu.component';
|
|
16
16
|
export * from './lib/other-button/other-button.component';
|
|
17
17
|
export * from './lib/filters/dynamic-filter/dynamic-filter.component';
|
|
18
|
+
export * from './lib/filters/daterangepicker/daterangepicker.directive';
|
|
19
|
+
export * from './lib/filters/daterangepicker/daterangepicker.component';
|
|
18
20
|
export * from './lib/column-visibility/column-visibility.component';
|
|
19
21
|
export * from './lib/table-action-toolbar/table-action-toolbar.component';
|
|
20
22
|
export * from './lib/dashboards/metrics-card/metrics-card.component';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Daterangepicker Integration
|
|
2
|
+
|
|
3
|
+
This library integrates the [daterangepicker](https://github.com/dangrossman/daterangepicker) component from Dan Grossman, providing a styled Angular wrapper that matches the existing Material date picker styling.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
### 1. Install Dependencies
|
|
8
|
+
|
|
9
|
+
The `daterangepicker` package is included as a dependency. You also need to include jQuery and moment.js (or dayjs) in your application:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install jquery moment
|
|
13
|
+
# OR
|
|
14
|
+
npm install jquery dayjs
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 2. Include Scripts and Styles
|
|
18
|
+
|
|
19
|
+
In your `angular.json`:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"projects": {
|
|
24
|
+
"your-app": {
|
|
25
|
+
"architect": {
|
|
26
|
+
"build": {
|
|
27
|
+
"options": {
|
|
28
|
+
"scripts": [
|
|
29
|
+
"node_modules/jquery/dist/jquery.min.js",
|
|
30
|
+
"node_modules/moment/min/moment.min.js",
|
|
31
|
+
"node_modules/daterangepicker/daterangepicker.js"
|
|
32
|
+
],
|
|
33
|
+
"styles": [
|
|
34
|
+
"node_modules/daterangepicker/daterangepicker.css"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or include in your `index.html`:
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
|
|
48
|
+
<script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
49
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
|
|
50
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
### In Dynamic Filter Component
|
|
56
|
+
|
|
57
|
+
Use `type: 'date-range-picker'` in your filter configuration:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { DynamicFilterItem } from '@cqa-lib/cqa-ui';
|
|
61
|
+
|
|
62
|
+
const filterConfig: DynamicFilterItem[] = [
|
|
63
|
+
{
|
|
64
|
+
label: 'Date Range',
|
|
65
|
+
key: 'dateRange',
|
|
66
|
+
type: 'date-range-picker', // Use this instead of 'date-range'
|
|
67
|
+
placeholder: 'Select date range'
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Standalone Component
|
|
73
|
+
|
|
74
|
+
You can also use the component directly:
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<cqa-daterangepicker
|
|
78
|
+
label="Select Date Range"
|
|
79
|
+
placeholder="Choose dates"
|
|
80
|
+
[startDate]="startDate"
|
|
81
|
+
[endDate]="endDate"
|
|
82
|
+
[maxDate]="maxDate"
|
|
83
|
+
[ranges]="dateRanges"
|
|
84
|
+
[autoApply]="false"
|
|
85
|
+
[alwaysShowCalendars]="true"
|
|
86
|
+
(datesUpdated)="onDateRangeChange($event)"
|
|
87
|
+
(applyClicked)="onApply($event)">
|
|
88
|
+
</cqa-daterangepicker>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### With Reactive Forms
|
|
92
|
+
|
|
93
|
+
The component implements `ControlValueAccessor`, so it works seamlessly with Angular forms:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { FormGroup, FormControl } from '@angular/forms';
|
|
97
|
+
|
|
98
|
+
form = new FormGroup({
|
|
99
|
+
dateRange: new FormGroup({
|
|
100
|
+
start: new FormControl(null),
|
|
101
|
+
end: new FormControl(null)
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<cqa-daterangepicker
|
|
108
|
+
[formControl]="form.get('dateRange')"
|
|
109
|
+
[maxDate]="maxDate">
|
|
110
|
+
</cqa-daterangepicker>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Inputs
|
|
114
|
+
|
|
115
|
+
- `label?: string` - Label text displayed above the input
|
|
116
|
+
- `placeholder?: string` - Placeholder text for the input
|
|
117
|
+
- `disabled?: boolean` - Disable the picker
|
|
118
|
+
- `startDate?: Date | string` - Initial start date
|
|
119
|
+
- `endDate?: Date | string` - Initial end date
|
|
120
|
+
- `minDate?: Date | string` - Minimum selectable date
|
|
121
|
+
- `maxDate?: Date | string` - Maximum selectable date
|
|
122
|
+
- `ranges?: any` - Predefined date ranges (see daterangepicker docs)
|
|
123
|
+
- `autoApply?: boolean` - Automatically apply selection (default: false)
|
|
124
|
+
- `alwaysShowCalendars?: boolean` - Always show both calendars (default: false)
|
|
125
|
+
- `opens?: 'left' | 'right' | 'center'` - Dropdown opening direction
|
|
126
|
+
- `drops?: 'down' | 'up' | 'auto'` - Dropdown position
|
|
127
|
+
- `isInvalidDate?: (date: Date) => boolean` - Custom date validation
|
|
128
|
+
|
|
129
|
+
## Outputs
|
|
130
|
+
|
|
131
|
+
- `datesUpdated` - Emitted when dates change
|
|
132
|
+
- `cancelClicked` - Emitted when cancel button is clicked
|
|
133
|
+
- `applyClicked` - Emitted when apply button is clicked
|
|
134
|
+
|
|
135
|
+
## Styling
|
|
136
|
+
|
|
137
|
+
The component is styled to match the existing Material date picker styling. All styles are scoped to `.cqa-ui-root` to prevent conflicts with your application styles.
|
|
138
|
+
|
|
139
|
+
The daterangepicker dropdown will automatically inherit the library's styling and will not affect your existing date range select component.
|
|
140
|
+
|
|
141
|
+
## Notes
|
|
142
|
+
|
|
143
|
+
- The component requires jQuery and moment.js (or dayjs) to be loaded globally
|
|
144
|
+
- The styling is scoped to prevent conflicts with existing components
|
|
145
|
+
- The component works alongside the existing `date-range` type without affecting it
|
|
146
|
+
|