@acpaas-ui/ngx-forms 6.1.10 → 6.1.11
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/package.json +27 -6
- package/.eslintrc.json +0 -42
- package/LICENSE.md +0 -21
- package/dist/README.md +0 -23
- package/dist/package.json +0 -44
- package/karma.conf.js +0 -38
- package/ng-package.json +0 -8
- package/src/lib/auto-complete/README.md +0 -148
- package/src/lib/auto-complete/auto-complete.module.ts +0 -15
- package/src/lib/auto-complete/components/auto-complete/auto-complete.component.html +0 -51
- package/src/lib/auto-complete/components/auto-complete/auto-complete.component.scss +0 -4
- package/src/lib/auto-complete/components/auto-complete/auto-complete.component.spec.ts +0 -378
- package/src/lib/auto-complete/components/auto-complete/auto-complete.component.ts +0 -281
- package/src/lib/auto-complete/public-api.ts +0 -2
- package/src/lib/datepicker/README.md +0 -110
- package/src/lib/datepicker/components/datepicker/datepicker.component.html +0 -47
- package/src/lib/datepicker/components/datepicker/datepicker.component.scss +0 -13
- package/src/lib/datepicker/components/datepicker/datepicker.component.spec.ts +0 -204
- package/src/lib/datepicker/components/datepicker/datepicker.component.ts +0 -251
- package/src/lib/datepicker/datepicker.conf.ts +0 -11
- package/src/lib/datepicker/datepicker.module.ts +0 -50
- package/src/lib/datepicker/public-api.ts +0 -8
- package/src/lib/datepicker/types/datepicker.types.ts +0 -8
- package/src/lib/range-slider/README.md +0 -56
- package/src/lib/range-slider/components/range-slider/range-slider.component.html +0 -46
- package/src/lib/range-slider/components/range-slider/range-slider.component.scss +0 -12
- package/src/lib/range-slider/components/range-slider/range-slider.component.spec.ts +0 -216
- package/src/lib/range-slider/components/range-slider/range-slider.component.ts +0 -301
- package/src/lib/range-slider/public-api.ts +0 -3
- package/src/lib/range-slider/range-slider.module.ts +0 -11
- package/src/lib/range-slider/types/range-slider.types.ts +0 -4
- package/src/lib/search-filter/README.md +0 -86
- package/src/lib/search-filter/components/search-filter/search-filter.component.html +0 -66
- package/src/lib/search-filter/components/search-filter/search-filter.component.scss +0 -23
- package/src/lib/search-filter/components/search-filter/search-filter.component.spec.ts +0 -264
- package/src/lib/search-filter/components/search-filter/search-filter.component.ts +0 -140
- package/src/lib/search-filter/public-api.ts +0 -3
- package/src/lib/search-filter/search-filter.module.ts +0 -13
- package/src/lib/search-filter/types/search-filter.types.ts +0 -4
- package/src/lib/shared/services/search.service.spec.ts +0 -78
- package/src/lib/shared/services/search.service.ts +0 -32
- package/src/lib/shared/types/search.types.ts +0 -6
- package/src/lib/timepicker/README.md +0 -84
- package/src/lib/timepicker/classes/timepicker.validators.spec.ts +0 -54
- package/src/lib/timepicker/classes/timepicker.validators.ts +0 -61
- package/src/lib/timepicker/components/timepicker/timepicker.component.html +0 -37
- package/src/lib/timepicker/components/timepicker/timepicker.component.scss +0 -3
- package/src/lib/timepicker/components/timepicker/timepicker.component.spec.ts +0 -161
- package/src/lib/timepicker/components/timepicker/timepicker.component.ts +0 -128
- package/src/lib/timepicker/public-api.ts +0 -4
- package/src/lib/timepicker/timepicker.module.ts +0 -13
- package/src/lib/timepicker/types/timepicker.types.ts +0 -5
- package/src/lib/upload/README.md +0 -283
- package/src/lib/upload/classes/uploader.class.spec.ts +0 -100
- package/src/lib/upload/classes/uploader.class.ts +0 -144
- package/src/lib/upload/components/upload/upload.component.html +0 -28
- package/src/lib/upload/components/upload/upload.component.scss +0 -3
- package/src/lib/upload/components/upload/upload.component.spec.ts +0 -117
- package/src/lib/upload/components/upload/upload.component.ts +0 -50
- package/src/lib/upload/components/upload-input/upload-input.component.html +0 -11
- package/src/lib/upload/components/upload-input/upload-input.component.spec.ts +0 -55
- package/src/lib/upload/components/upload-input/upload-input.component.ts +0 -35
- package/src/lib/upload/components/upload-queue/upload-queue.component.html +0 -16
- package/src/lib/upload/components/upload-queue/upload-queue.component.spec.ts +0 -99
- package/src/lib/upload/components/upload-queue/upload-queue.component.ts +0 -36
- package/src/lib/upload/components/upload-zone/upload-zone.component.html +0 -55
- package/src/lib/upload/components/upload-zone/upload-zone.component.scss +0 -3
- package/src/lib/upload/components/upload-zone/upload-zone.component.spec.ts +0 -144
- package/src/lib/upload/components/upload-zone/upload-zone.component.ts +0 -142
- package/src/lib/upload/components/validation-list/validation-list.component.html +0 -15
- package/src/lib/upload/components/validation-list/validation-list.component.spec.ts +0 -57
- package/src/lib/upload/components/validation-list/validation-list.component.ts +0 -29
- package/src/lib/upload/public-api.ts +0 -10
- package/src/lib/upload/services/validation-messages.service.spec.ts +0 -66
- package/src/lib/upload/services/validation-messages.service.ts +0 -27
- package/src/lib/upload/types/upload.types.ts +0 -20
- package/src/lib/upload/upload.conf.ts +0 -15
- package/src/lib/upload/upload.module.ts +0 -34
- package/src/public-api.ts +0 -6
- package/src/test.ts +0 -9
- package/tsconfig.lib.json +0 -26
- package/tsconfig.spec.json +0 -17
- /package/{dist/esm2020 → esm2020}/acpaas-ui-ngx-forms.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/auto-complete/auto-complete.module.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/auto-complete/components/auto-complete/auto-complete.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/auto-complete/public-api.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/datepicker/components/datepicker/datepicker.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/datepicker/datepicker.conf.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/datepicker/datepicker.module.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/datepicker/public-api.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/datepicker/types/datepicker.types.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/range-slider/components/range-slider/range-slider.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/range-slider/public-api.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/range-slider/range-slider.module.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/range-slider/types/range-slider.types.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/search-filter/components/search-filter/search-filter.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/search-filter/public-api.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/search-filter/search-filter.module.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/search-filter/types/search-filter.types.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/shared/services/search.service.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/shared/types/search.types.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/timepicker/classes/timepicker.validators.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/timepicker/components/timepicker/timepicker.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/timepicker/public-api.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/timepicker/timepicker.module.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/timepicker/types/timepicker.types.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/classes/uploader.class.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/components/upload/upload.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/components/upload-input/upload-input.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/components/upload-queue/upload-queue.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/components/upload-zone/upload-zone.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/components/validation-list/validation-list.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/public-api.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/services/validation-messages.service.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/types/upload.types.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/upload.conf.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/upload/upload.module.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/public-api.mjs +0 -0
- /package/{dist/fesm2015 → fesm2015}/acpaas-ui-ngx-forms.mjs +0 -0
- /package/{dist/fesm2015 → fesm2015}/acpaas-ui-ngx-forms.mjs.map +0 -0
- /package/{dist/fesm2020 → fesm2020}/acpaas-ui-ngx-forms.mjs +0 -0
- /package/{dist/fesm2020 → fesm2020}/acpaas-ui-ngx-forms.mjs.map +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/lib → lib}/auto-complete/auto-complete.module.d.ts +0 -0
- /package/{dist/lib → lib}/auto-complete/components/auto-complete/auto-complete.component.d.ts +0 -0
- /package/{dist/lib → lib}/auto-complete/public-api.d.ts +0 -0
- /package/{dist/lib → lib}/datepicker/components/datepicker/datepicker.component.d.ts +0 -0
- /package/{dist/lib → lib}/datepicker/datepicker.conf.d.ts +0 -0
- /package/{dist/lib → lib}/datepicker/datepicker.module.d.ts +0 -0
- /package/{dist/lib → lib}/datepicker/public-api.d.ts +0 -0
- /package/{dist/lib → lib}/datepicker/types/datepicker.types.d.ts +0 -0
- /package/{dist/lib → lib}/range-slider/components/range-slider/range-slider.component.d.ts +0 -0
- /package/{dist/lib → lib}/range-slider/public-api.d.ts +0 -0
- /package/{dist/lib → lib}/range-slider/range-slider.module.d.ts +0 -0
- /package/{dist/lib → lib}/range-slider/types/range-slider.types.d.ts +0 -0
- /package/{dist/lib → lib}/search-filter/components/search-filter/search-filter.component.d.ts +0 -0
- /package/{dist/lib → lib}/search-filter/public-api.d.ts +0 -0
- /package/{dist/lib → lib}/search-filter/search-filter.module.d.ts +0 -0
- /package/{dist/lib → lib}/search-filter/types/search-filter.types.d.ts +0 -0
- /package/{dist/lib → lib}/shared/services/search.service.d.ts +0 -0
- /package/{dist/lib → lib}/shared/types/search.types.d.ts +0 -0
- /package/{dist/lib → lib}/timepicker/classes/timepicker.validators.d.ts +0 -0
- /package/{dist/lib → lib}/timepicker/components/timepicker/timepicker.component.d.ts +0 -0
- /package/{dist/lib → lib}/timepicker/public-api.d.ts +0 -0
- /package/{dist/lib → lib}/timepicker/timepicker.module.d.ts +0 -0
- /package/{dist/lib → lib}/timepicker/types/timepicker.types.d.ts +0 -0
- /package/{dist/lib → lib}/upload/classes/uploader.class.d.ts +0 -0
- /package/{dist/lib → lib}/upload/components/upload/upload.component.d.ts +0 -0
- /package/{dist/lib → lib}/upload/components/upload-input/upload-input.component.d.ts +0 -0
- /package/{dist/lib → lib}/upload/components/upload-queue/upload-queue.component.d.ts +0 -0
- /package/{dist/lib → lib}/upload/components/upload-zone/upload-zone.component.d.ts +0 -0
- /package/{dist/lib → lib}/upload/components/validation-list/validation-list.component.d.ts +0 -0
- /package/{dist/lib → lib}/upload/public-api.d.ts +0 -0
- /package/{dist/lib → lib}/upload/services/validation-messages.service.d.ts +0 -0
- /package/{dist/lib → lib}/upload/types/upload.types.d.ts +0 -0
- /package/{dist/lib → lib}/upload/upload.conf.d.ts +0 -0
- /package/{dist/lib → lib}/upload/upload.module.d.ts +0 -0
- /package/{dist/public-api.d.ts → public-api.d.ts} +0 -0
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
# @acpaas-ui/ngx-forms
|
|
2
|
-
|
|
3
|
-
The package creates a custom input component allowing the user to select a date either by input or by picking one in the calendar flyout.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { DatepickerModule } from '@acpaas-ui/ngx-forms';
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Documentation
|
|
12
|
-
|
|
13
|
-
Visit our [documentation site](https://antwerp-ui.digipolis.be/) for full how-to docs and guidelines
|
|
14
|
-
|
|
15
|
-
### Flyout module
|
|
16
|
-
|
|
17
|
-
#### API
|
|
18
|
-
|
|
19
|
-
| Name | Default value | Description |
|
|
20
|
-
| -------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
-
| `@Input() id: string;` | - | The id to use on the input field. |
|
|
22
|
-
| `@Input() name: string;` | - | The name to use on the input field. |
|
|
23
|
-
| `@Input() label: string;` | - | The label to use on the input field. |
|
|
24
|
-
| `@Input() description: string;` | - | The description to use on the input field. |
|
|
25
|
-
| `@Input() placeholder: string;` | `'dd/mm/yyyy'` | The placeholder to use on the input field. |
|
|
26
|
-
| `@Input() autocomplete: string;` | `'off'` | Turn the browsers autocompletion on or off. |
|
|
27
|
-
| `@Input() range: DateRange;` | - | A range of dates or weekdays to disable (see the [@acpaas-ui/js-date-utils](https://github.com/digipolisantwerp/antwerp-ui_js/blob/master/packages/date-utils/README.md) package for more info on date ranges). |
|
|
28
|
-
|
|
29
|
-
#### Example
|
|
30
|
-
|
|
31
|
-
You can provide custom month and weekday labels as wel as error labels via the `forChild` method.
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
import { DatepickerModule } from '@acpaas-ui/ngx-forms';
|
|
35
|
-
|
|
36
|
-
@NgModule({
|
|
37
|
-
imports: [
|
|
38
|
-
DatepickerModule.forChild(
|
|
39
|
-
['Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag', 'Zondag'],
|
|
40
|
-
[
|
|
41
|
-
'Januari',
|
|
42
|
-
'Februari',
|
|
43
|
-
'Maart',
|
|
44
|
-
'April',
|
|
45
|
-
'Mei',
|
|
46
|
-
'Juni',
|
|
47
|
-
'Juli',
|
|
48
|
-
'Augustus',
|
|
49
|
-
'September',
|
|
50
|
-
'Oktober',
|
|
51
|
-
'November',
|
|
52
|
-
'December',
|
|
53
|
-
],
|
|
54
|
-
{
|
|
55
|
-
ERRORS_INVALID_DATE: 'Ongeldige datum.',
|
|
56
|
-
ERRORS_INVALID_RANGE: 'Deze datum kan niet gekozen worden.',
|
|
57
|
-
}
|
|
58
|
-
),
|
|
59
|
-
],
|
|
60
|
-
})
|
|
61
|
-
export class AppModule {}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
You can use the component in template driven, as well as reactive forms. The value is always an ISO string of the Date.
|
|
65
|
-
In the example below we use a reactive form.
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
import { FormBuilder, FormGroup } from '@angular/forms';
|
|
69
|
-
|
|
70
|
-
import { DateRange } from '@acpaas-ui/ngx-utils';
|
|
71
|
-
|
|
72
|
-
constructor(private fb: FormBuilder) { }
|
|
73
|
-
|
|
74
|
-
public dateRange: DateRange = [5, 6];
|
|
75
|
-
public dateForm: FormGroup;
|
|
76
|
-
|
|
77
|
-
this.dateForm = this.fb.group({
|
|
78
|
-
inputDate: [''],
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
```html
|
|
83
|
-
<form [formGroup]="dateForm">
|
|
84
|
-
<div
|
|
85
|
-
class="a-input has-icon-right"
|
|
86
|
-
[ngClass]="{'has-error': dateForm.controls.inputDate.dirty && dateForm.controls.inputDate.invalid}"
|
|
87
|
-
>
|
|
88
|
-
<label class="a-input__label" for="input-datepicker">Pick a date</label>
|
|
89
|
-
<aui-datepicker
|
|
90
|
-
data-id="input-datepicker"
|
|
91
|
-
name="input-datepicker"
|
|
92
|
-
autocomplete="off"
|
|
93
|
-
label="Pick date"
|
|
94
|
-
description="Description"
|
|
95
|
-
placeholder="dd/mm/jjjj"
|
|
96
|
-
formControlName="inputDate"
|
|
97
|
-
[range]="dateRange"
|
|
98
|
-
>
|
|
99
|
-
</aui-datepicker>
|
|
100
|
-
<div *ngIf="dateForm.controls['inputDate'].errors">
|
|
101
|
-
<p *ngIf="dateForm.controls['inputDate'].errors.format">{{ dateForm.controls['inputDate'].errors.format }}</p>
|
|
102
|
-
<p *ngIf="dateForm.controls['inputDate'].errors.range">{{ dateForm.controls['inputDate'].errors.range }}</p>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
</form>
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Contributing
|
|
109
|
-
|
|
110
|
-
Visit our [Contribution Guidelines](../../../../../CONTRIBUTING.md) for more information on how to contribute.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<div aria-haspopup="grid" auiFlyout class="aui-datepicker a-input has-icon-right">
|
|
2
|
-
<label class="a-input__label" for="{{ id }}" *ngIf="label">{{ label }}</label>
|
|
3
|
-
<small class="a-input__description" *ngIf="description"> {{ description }}</small>
|
|
4
|
-
<div class="a-input__wrapper">
|
|
5
|
-
<input
|
|
6
|
-
(blur)="handleBlur($event)"
|
|
7
|
-
[attr.disabled]="isDisabled ? true : null"
|
|
8
|
-
[autocomplete]="autocomplete"
|
|
9
|
-
[formControl]="formControl"
|
|
10
|
-
id="{{ id }}"
|
|
11
|
-
label="Pick date"
|
|
12
|
-
description="Description"
|
|
13
|
-
name="{{ name }}"
|
|
14
|
-
placeholder="{{ placeholder }}"
|
|
15
|
-
type="text"
|
|
16
|
-
/>
|
|
17
|
-
<ng-container *ngIf="isDisabled">
|
|
18
|
-
<aui-icon
|
|
19
|
-
name="ai-calendar"
|
|
20
|
-
/>
|
|
21
|
-
</ng-container>
|
|
22
|
-
<ng-container *ngIf="!isDisabled">
|
|
23
|
-
<aui-icon
|
|
24
|
-
auiFlyoutAction
|
|
25
|
-
[openOnFocus]="false"
|
|
26
|
-
name="ai-calendar"
|
|
27
|
-
className="is-clickable"
|
|
28
|
-
role="button"
|
|
29
|
-
[attr.aria-label]="ariaOpenDatepickerLabel"
|
|
30
|
-
tabindex="0"
|
|
31
|
-
/>
|
|
32
|
-
</ng-container>
|
|
33
|
-
|
|
34
|
-
<ng-container *ngIf="!isDisabled">
|
|
35
|
-
<div auiFlyoutZone class="m-datepicker m-datepicker--fixed" role="dialog">
|
|
36
|
-
<aui-calendar
|
|
37
|
-
(selectDate)="selectDateFromCalendar($event)"
|
|
38
|
-
[range]="range"
|
|
39
|
-
[selectedDate]="selectedDate"
|
|
40
|
-
[interval]="interval"
|
|
41
|
-
[weekdayLabels]="weekdayLabels"
|
|
42
|
-
[monthLabels]="monthLabels"
|
|
43
|
-
></aui-calendar>
|
|
44
|
-
</div>
|
|
45
|
-
</ng-container>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { Component, OnInit } from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
UntypedFormBuilder,
|
|
5
|
-
UntypedFormControl,
|
|
6
|
-
UntypedFormGroup,
|
|
7
|
-
FormsModule,
|
|
8
|
-
ReactiveFormsModule,
|
|
9
|
-
} from '@angular/forms';
|
|
10
|
-
import { DateRange, DateHelper } from '@acpaas-ui/ngx-utils';
|
|
11
|
-
import { CalendarModule } from '@acpaas-ui/ngx-calendar';
|
|
12
|
-
import { FlyoutModule } from '@acpaas-ui/ngx-flyout';
|
|
13
|
-
import { IconModule } from '@acpaas-ui/ngx-icon';
|
|
14
|
-
|
|
15
|
-
import { DATEPICKER_DEFAULT_ERROR_LABELS, DATEPICKER_ERROR_LABELS } from '../../datepicker.conf';
|
|
16
|
-
import { DatepickerComponent } from './datepicker.component';
|
|
17
|
-
|
|
18
|
-
@Component({
|
|
19
|
-
selector: 'aui-test-one',
|
|
20
|
-
template: `
|
|
21
|
-
<form #testForm="ngForm" (ngSubmit)="submit(testForm.value)">
|
|
22
|
-
<aui-datepicker
|
|
23
|
-
id="test"
|
|
24
|
-
name="test"
|
|
25
|
-
placeholder="dd/mm/jjjj"
|
|
26
|
-
autocomplete="off"
|
|
27
|
-
[range]="range"
|
|
28
|
-
[(ngModel)]="dateModel"
|
|
29
|
-
></aui-datepicker>
|
|
30
|
-
</form>
|
|
31
|
-
`,
|
|
32
|
-
})
|
|
33
|
-
export class TestComponent {
|
|
34
|
-
public range: DateRange;
|
|
35
|
-
public dateModel: Date;
|
|
36
|
-
|
|
37
|
-
submit(form) {}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Component({
|
|
41
|
-
selector: 'aui-test-two',
|
|
42
|
-
template: `
|
|
43
|
-
<form [formGroup]="testForm" (ngSubmit)="submit(testForm.value)">
|
|
44
|
-
<aui-datepicker
|
|
45
|
-
id="test"
|
|
46
|
-
name="test"
|
|
47
|
-
placeholder="dd/mm/jjjj"
|
|
48
|
-
autocomplete="off"
|
|
49
|
-
[range]="range"
|
|
50
|
-
formControlName="date"
|
|
51
|
-
></aui-datepicker>
|
|
52
|
-
</form>
|
|
53
|
-
`,
|
|
54
|
-
})
|
|
55
|
-
export class ReactiveTestComponent implements OnInit {
|
|
56
|
-
public range: DateRange;
|
|
57
|
-
public dateModel: Date;
|
|
58
|
-
public testForm: UntypedFormGroup;
|
|
59
|
-
|
|
60
|
-
constructor(private fb: UntypedFormBuilder) {}
|
|
61
|
-
|
|
62
|
-
public ngOnInit() {
|
|
63
|
-
this.testForm = this.fb.group({
|
|
64
|
-
date: '',
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
submit(form) {}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
describe('The Datepicker Component', () => {
|
|
72
|
-
// waitForAsync beforeEach
|
|
73
|
-
beforeEach(waitForAsync(() => {
|
|
74
|
-
TestBed.configureTestingModule({
|
|
75
|
-
imports: [FormsModule, ReactiveFormsModule, FlyoutModule, IconModule, CalendarModule],
|
|
76
|
-
declarations: [TestComponent, ReactiveTestComponent, DatepickerComponent],
|
|
77
|
-
providers: [
|
|
78
|
-
{
|
|
79
|
-
provide: DATEPICKER_ERROR_LABELS,
|
|
80
|
-
useValue: DATEPICKER_DEFAULT_ERROR_LABELS,
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
}).compileComponents();
|
|
84
|
-
}));
|
|
85
|
-
|
|
86
|
-
// describe('Template driven', () => {
|
|
87
|
-
// let comp: TestComponent;
|
|
88
|
-
// let fixture: ComponentFixture<TestComponent>;
|
|
89
|
-
// let picker: DatepickerComponent;
|
|
90
|
-
|
|
91
|
-
// // synchronous beforeEach
|
|
92
|
-
// beforeEach(() => {
|
|
93
|
-
// fixture = TestBed.createComponent(TestComponent);
|
|
94
|
-
|
|
95
|
-
// comp = fixture.componentInstance;
|
|
96
|
-
|
|
97
|
-
// picker = fixture.debugElement.children[0].children[0].componentInstance;
|
|
98
|
-
// });
|
|
99
|
-
|
|
100
|
-
// it('should exist', () => {
|
|
101
|
-
// fixture.detectChanges();
|
|
102
|
-
// expect(picker).toBeDefined();
|
|
103
|
-
// });
|
|
104
|
-
// });
|
|
105
|
-
|
|
106
|
-
describe('Reactive', () => {
|
|
107
|
-
let comp: ReactiveTestComponent;
|
|
108
|
-
let fixture: ComponentFixture<ReactiveTestComponent>;
|
|
109
|
-
let picker: DatepickerComponent;
|
|
110
|
-
|
|
111
|
-
// synchronous beforeEach
|
|
112
|
-
beforeEach(() => {
|
|
113
|
-
fixture = TestBed.createComponent(ReactiveTestComponent);
|
|
114
|
-
|
|
115
|
-
comp = fixture.componentInstance;
|
|
116
|
-
|
|
117
|
-
picker = fixture.debugElement.children[0].children[0].componentInstance;
|
|
118
|
-
picker.ngOnInit();
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
describe('writeValue', () => {
|
|
122
|
-
let accessor;
|
|
123
|
-
|
|
124
|
-
beforeEach(() => {
|
|
125
|
-
accessor = {
|
|
126
|
-
update: () => {},
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
spyOn(accessor, 'update');
|
|
130
|
-
|
|
131
|
-
picker.registerOnChange(accessor.update);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('should update the model if the value is a valid date', () => {
|
|
135
|
-
const date = new Date('2018-01-10T00:00:00Z');
|
|
136
|
-
|
|
137
|
-
picker.writeValue(date.toISOString());
|
|
138
|
-
|
|
139
|
-
expect(picker.formControl.value).toBeTruthy();
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
describe('selectDateFromCalendar', () => {
|
|
144
|
-
beforeEach(() => {
|
|
145
|
-
spyOn(picker.formControl, 'setValue').and.stub();
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('should update the values', () => {
|
|
149
|
-
const date = new Date('2018-01-10T00:00:00+01:00');
|
|
150
|
-
picker.selectDateFromCalendar({
|
|
151
|
-
date,
|
|
152
|
-
complete: true,
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
expect(picker.formControl.setValue).toHaveBeenCalledWith('10/01/2018');
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
describe('validate', () => {
|
|
160
|
-
it('should return null if the control has no value', () => {
|
|
161
|
-
const ctrl = new UntypedFormControl();
|
|
162
|
-
|
|
163
|
-
expect(picker.validate(ctrl)).toEqual(null);
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('should return the invalid date error if the date is invalid', () => {
|
|
167
|
-
const ctrl = new UntypedFormControl(false);
|
|
168
|
-
|
|
169
|
-
expect(picker.validate(ctrl)).toEqual({
|
|
170
|
-
format: DATEPICKER_DEFAULT_ERROR_LABELS.ERRORS_INVALID_DATE,
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it('should return null if the date is valid and no range was set', () => {
|
|
175
|
-
const ctrl = new UntypedFormControl(new Date());
|
|
176
|
-
|
|
177
|
-
expect(picker.validate(ctrl)).toEqual(null);
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
it('should return null if the date is valid and outside of the set range', () => {
|
|
181
|
-
spyOn(picker.calendarService, 'getRangeForDate').and.callFake(() => []);
|
|
182
|
-
picker.range = [1];
|
|
183
|
-
|
|
184
|
-
const ctrl = new UntypedFormControl(new Date().toISOString());
|
|
185
|
-
|
|
186
|
-
expect(picker.validate(ctrl)).toEqual(null);
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
it('should return the invalid range error if the date was valid and in the set range', () => {
|
|
190
|
-
const testDateISO = new Date('2018-01-15T12:00:00Z').toISOString();
|
|
191
|
-
const parsedDate = DateHelper.parseDate(testDateISO);
|
|
192
|
-
const range = [parsedDate.getDate()];
|
|
193
|
-
spyOn(picker.calendarService, 'getRangeForDate').and.callFake(() => range);
|
|
194
|
-
picker.range = range;
|
|
195
|
-
|
|
196
|
-
const ctrl = new UntypedFormControl(testDateISO);
|
|
197
|
-
|
|
198
|
-
expect(picker.validate(ctrl)).toEqual({
|
|
199
|
-
range: DATEPICKER_DEFAULT_ERROR_LABELS.ERRORS_INVALID_RANGE,
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
});
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
ChangeDetectorRef,
|
|
4
|
-
Component,
|
|
5
|
-
EventEmitter,
|
|
6
|
-
forwardRef,
|
|
7
|
-
Inject,
|
|
8
|
-
Input,
|
|
9
|
-
OnChanges,
|
|
10
|
-
OnDestroy,
|
|
11
|
-
OnInit,
|
|
12
|
-
Output,
|
|
13
|
-
SimpleChanges,
|
|
14
|
-
ViewChild,
|
|
15
|
-
} from '@angular/core';
|
|
16
|
-
import { Subject } from 'rxjs';
|
|
17
|
-
import { takeUntil } from 'rxjs/operators';
|
|
18
|
-
import {
|
|
19
|
-
ControlValueAccessor,
|
|
20
|
-
UntypedFormBuilder,
|
|
21
|
-
UntypedFormControl,
|
|
22
|
-
NG_VALIDATORS,
|
|
23
|
-
NG_VALUE_ACCESSOR,
|
|
24
|
-
} from '@angular/forms';
|
|
25
|
-
import { DateHelper, DateRange } from '@acpaas-ui/ngx-utils';
|
|
26
|
-
import { TZDate } from '@date-fns/tz';
|
|
27
|
-
import { FlyoutDirective } from '@acpaas-ui/ngx-flyout';
|
|
28
|
-
import {
|
|
29
|
-
CALENDAR_DEFAULT_MONTH_LABELS,
|
|
30
|
-
CALENDAR_DEFAULT_WEEKDAY_LABELS,
|
|
31
|
-
CALENDAR_MONTH_LABELS,
|
|
32
|
-
CALENDAR_WEEKDAY_LABELS,
|
|
33
|
-
CalendarService,
|
|
34
|
-
DatepickerResult,
|
|
35
|
-
WeekdayLabelsConfig,
|
|
36
|
-
MonthLabelsConfig,
|
|
37
|
-
} from '@acpaas-ui/ngx-calendar';
|
|
38
|
-
|
|
39
|
-
import {
|
|
40
|
-
DATEPICKER_SEPARATOR_CHAR,
|
|
41
|
-
DATEPICKER_DEFAULT_ERROR_LABELS,
|
|
42
|
-
DATEPICKER_ERROR_LABELS,
|
|
43
|
-
} from '../../datepicker.conf';
|
|
44
|
-
import { DatepickerValidationErrors } from '../../types/datepicker.types';
|
|
45
|
-
import { Interval, IntervalBuilder } from '@acpaas-ui/ngx-utils';
|
|
46
|
-
|
|
47
|
-
@Component({
|
|
48
|
-
selector: 'aui-datepicker',
|
|
49
|
-
templateUrl: './datepicker.component.html',
|
|
50
|
-
styleUrls: ['./datepicker.component.scss'],
|
|
51
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
52
|
-
providers: [
|
|
53
|
-
{
|
|
54
|
-
provide: NG_VALUE_ACCESSOR,
|
|
55
|
-
useExisting: forwardRef(() => DatepickerComponent), // eslint-disable-line @angular-eslint/no-forward-ref
|
|
56
|
-
multi: true,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
provide: NG_VALIDATORS,
|
|
60
|
-
useExisting: forwardRef(() => DatepickerComponent), // eslint-disable-line @angular-eslint/no-forward-ref
|
|
61
|
-
multi: true,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
})
|
|
65
|
-
export class DatepickerComponent implements OnInit, OnChanges, OnDestroy, ControlValueAccessor {
|
|
66
|
-
@ViewChild(FlyoutDirective, { static: true }) flyout: FlyoutDirective;
|
|
67
|
-
@Input() id: string;
|
|
68
|
-
@Input() name: string;
|
|
69
|
-
@Input() placeholder = 'dd/mm/yyyy';
|
|
70
|
-
@Input() label: string;
|
|
71
|
-
@Input() description: string;
|
|
72
|
-
@Input() range: DateRange;
|
|
73
|
-
@Input()
|
|
74
|
-
min: Date | null;
|
|
75
|
-
@Input()
|
|
76
|
-
max: Date | null;
|
|
77
|
-
@Input() autocomplete: 'off';
|
|
78
|
-
@Input() weekdayLabels: WeekdayLabelsConfig;
|
|
79
|
-
@Input() monthLabels: MonthLabelsConfig;
|
|
80
|
-
@Input() ariaOpenDatepickerLabel = 'Open kalender';
|
|
81
|
-
|
|
82
|
-
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
83
|
-
@Output() blur = new EventEmitter<Event>();
|
|
84
|
-
|
|
85
|
-
public formControl: UntypedFormControl;
|
|
86
|
-
public selectedDate: Date;
|
|
87
|
-
public isDisabled = false;
|
|
88
|
-
public interval: Interval.IInterval<Date>;
|
|
89
|
-
|
|
90
|
-
private componentDestroyed$: Subject<boolean> = new Subject<boolean>();
|
|
91
|
-
|
|
92
|
-
constructor(
|
|
93
|
-
@Inject(CALENDAR_MONTH_LABELS) private moduleMonthLabels = CALENDAR_DEFAULT_MONTH_LABELS,
|
|
94
|
-
@Inject(CALENDAR_WEEKDAY_LABELS) private moduleWeekdayLabels = CALENDAR_DEFAULT_WEEKDAY_LABELS,
|
|
95
|
-
@Inject(DATEPICKER_ERROR_LABELS) private errorLabels = DATEPICKER_DEFAULT_ERROR_LABELS,
|
|
96
|
-
public calendarService: CalendarService,
|
|
97
|
-
private formBuilder: UntypedFormBuilder,
|
|
98
|
-
private ref: ChangeDetectorRef
|
|
99
|
-
) {}
|
|
100
|
-
|
|
101
|
-
public ngOnInit(): void {
|
|
102
|
-
this.weekdayLabels = this.weekdayLabels || this.moduleWeekdayLabels;
|
|
103
|
-
this.monthLabels = this.monthLabels || this.moduleMonthLabels;
|
|
104
|
-
this.createInterval();
|
|
105
|
-
this.formControl = this.formBuilder.control({ value: '', disabled: this.isDisabled });
|
|
106
|
-
this.formControl.valueChanges.pipe(takeUntil(this.componentDestroyed$)).subscribe((value) => {
|
|
107
|
-
if (value) {
|
|
108
|
-
const date = DateHelper.parseDate(value, 'dd/MM/yyyy');
|
|
109
|
-
if (date instanceof Date) {
|
|
110
|
-
this.selectedDate = date;
|
|
111
|
-
const brusselsDate = new TZDate(date, 'Europe/Brussels');
|
|
112
|
-
const year = brusselsDate.getFullYear();
|
|
113
|
-
const month = brusselsDate.getMonth();
|
|
114
|
-
const day = brusselsDate.getDate();
|
|
115
|
-
this.onChange(DateHelper.toUtcMidnightInBrussels(year, month, day));
|
|
116
|
-
} else if (typeof date === 'string') {
|
|
117
|
-
this.onChange(value);
|
|
118
|
-
} else {
|
|
119
|
-
this.onChange(value);
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
this.selectedDate = null;
|
|
123
|
-
this.onChange('');
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public ngOnChanges(changes: SimpleChanges): void {
|
|
129
|
-
if (changes.min || changes.max) {
|
|
130
|
-
this.createInterval();
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public ngOnDestroy(): void {
|
|
135
|
-
this.componentDestroyed$.next(true);
|
|
136
|
-
this.componentDestroyed$.complete();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
private createInterval() {
|
|
140
|
-
if (!this.min && !this.max) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
// Create an interval if min/max is filled in
|
|
144
|
-
this.interval = IntervalBuilder.dateInterval(
|
|
145
|
-
this.min ? new Date(this.min) : null,
|
|
146
|
-
this.max ? new Date(this.max) : null
|
|
147
|
-
)
|
|
148
|
-
.not()
|
|
149
|
-
.build();
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
public writeValue(value: string | Date): void {
|
|
153
|
-
if (typeof value === 'string') {
|
|
154
|
-
if (this.isISODateFormat(value)) {
|
|
155
|
-
this.selectedDate = DateHelper.parseDate(value) as Date;
|
|
156
|
-
} else {
|
|
157
|
-
const parsed = DateHelper.parseDate(value, 'dd/MM/yyyy');
|
|
158
|
-
this.selectedDate = parsed instanceof Date ? parsed : null;
|
|
159
|
-
}
|
|
160
|
-
} else if (value instanceof Date) {
|
|
161
|
-
this.selectedDate = value;
|
|
162
|
-
} else {
|
|
163
|
-
this.selectedDate = null;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const dateString = this.selectedDate ? this.formatDate(this.selectedDate) : '';
|
|
167
|
-
this.formControl.setValue(dateString);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
public registerOnChange(onChange: (res: any) => void): void {
|
|
171
|
-
this.onChange = onChange;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
public registerOnTouched(onTouched: (_: any) => void): void {
|
|
175
|
-
this.onTouched = onTouched;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
public setDisabledState(isDisabled: boolean): void {
|
|
179
|
-
this.isDisabled = isDisabled;
|
|
180
|
-
|
|
181
|
-
if (this.formControl) {
|
|
182
|
-
if (isDisabled && this.formControl.enabled) {
|
|
183
|
-
this.formControl.disable();
|
|
184
|
-
} else if (!isDisabled && this.formControl.disabled) {
|
|
185
|
-
this.formControl.enable();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
this.ref.markForCheck();
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
public selectDateFromCalendar(result: DatepickerResult): void {
|
|
193
|
-
if (result.complete) {
|
|
194
|
-
this.formControl.setValue(this.formatDate(result.date));
|
|
195
|
-
this.flyout.close();
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
public formatDate(date: Date): string {
|
|
200
|
-
return DateHelper.formatDate(date, 'DD/MM/YYYY', {
|
|
201
|
-
leadingZero: true,
|
|
202
|
-
monthLabels: this.monthLabels,
|
|
203
|
-
weekdayLabels: this.weekdayLabels,
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
public validate(ctrl: UntypedFormControl): DatepickerValidationErrors {
|
|
208
|
-
// no error on empty value (add required validator in app)
|
|
209
|
-
if (ctrl.value === '' || ctrl.value === null) {
|
|
210
|
-
return null;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// throw format error if no valid date was provided
|
|
214
|
-
const date = DateHelper.parseDate(ctrl.value);
|
|
215
|
-
if (!date) {
|
|
216
|
-
return {
|
|
217
|
-
format: this.errorLabels.ERRORS_INVALID_DATE,
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// no error if valid date an no range provided
|
|
222
|
-
if (!this.range || !this.range.length) {
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// throw error when out of range
|
|
227
|
-
const range = this.calendarService.getRangeForDate(date, this.range);
|
|
228
|
-
|
|
229
|
-
return range.indexOf(date.getDate()) >= 0
|
|
230
|
-
? {
|
|
231
|
-
range: this.errorLabels.ERRORS_INVALID_RANGE,
|
|
232
|
-
}
|
|
233
|
-
: null;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
public handleBlur(e: Event): void {
|
|
237
|
-
this.blur.emit(e);
|
|
238
|
-
this.onTouched(e);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
private onChange: (res: any) => void = () => undefined;
|
|
242
|
-
|
|
243
|
-
private onTouched: (_: any) => void = () => undefined;
|
|
244
|
-
|
|
245
|
-
private isISODateFormat(value: string) {
|
|
246
|
-
if (typeof value !== 'string') {
|
|
247
|
-
return false;
|
|
248
|
-
}
|
|
249
|
-
return value.match(/\d{4}-\d{2}-\d{2}T.*/);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { DatepickerErrorLabels } from './types/datepicker.types';
|
|
3
|
-
|
|
4
|
-
export const DATEPICKER_ERROR_LABELS = new InjectionToken<DatepickerErrorLabels>('errorLabels');
|
|
5
|
-
|
|
6
|
-
export const DATEPICKER_DEFAULT_ERROR_LABELS = {
|
|
7
|
-
ERRORS_INVALID_DATE: 'INVALID_DATE',
|
|
8
|
-
ERRORS_INVALID_RANGE: 'INVALID_RANGE',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const DATEPICKER_SEPARATOR_CHAR = '/';
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ModuleWithProviders, NgModule } from '@angular/core';
|
|
2
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
|
-
|
|
5
|
-
import { FlyoutModule } from '@acpaas-ui/ngx-flyout';
|
|
6
|
-
import {
|
|
7
|
-
CALENDAR_DEFAULT_MONTH_LABELS,
|
|
8
|
-
CALENDAR_DEFAULT_WEEKDAY_LABELS,
|
|
9
|
-
CALENDAR_MONTH_LABELS,
|
|
10
|
-
CALENDAR_WEEKDAY_LABELS,
|
|
11
|
-
CalendarModule,
|
|
12
|
-
} from '@acpaas-ui/ngx-calendar';
|
|
13
|
-
import { IconModule } from '@acpaas-ui/ngx-icon';
|
|
14
|
-
|
|
15
|
-
import { DatepickerComponent } from './components/datepicker/datepicker.component';
|
|
16
|
-
import { DATEPICKER_DEFAULT_ERROR_LABELS, DATEPICKER_ERROR_LABELS } from './datepicker.conf';
|
|
17
|
-
import { DatepickerErrorLabels } from './types/datepicker.types';
|
|
18
|
-
|
|
19
|
-
@NgModule({
|
|
20
|
-
imports: [CommonModule, FormsModule, ReactiveFormsModule, CalendarModule, IconModule, FlyoutModule],
|
|
21
|
-
declarations: [DatepickerComponent],
|
|
22
|
-
exports: [DatepickerComponent],
|
|
23
|
-
providers: [
|
|
24
|
-
{
|
|
25
|
-
provide: CALENDAR_WEEKDAY_LABELS,
|
|
26
|
-
useValue: CALENDAR_DEFAULT_WEEKDAY_LABELS,
|
|
27
|
-
},
|
|
28
|
-
{ provide: CALENDAR_MONTH_LABELS, useValue: CALENDAR_DEFAULT_MONTH_LABELS },
|
|
29
|
-
{
|
|
30
|
-
provide: DATEPICKER_ERROR_LABELS,
|
|
31
|
-
useValue: DATEPICKER_DEFAULT_ERROR_LABELS,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
})
|
|
35
|
-
export class DatepickerModule {
|
|
36
|
-
static forChild(
|
|
37
|
-
weekdayLabels: string[],
|
|
38
|
-
monthLabels: string[],
|
|
39
|
-
errorLabels: DatepickerErrorLabels
|
|
40
|
-
): ModuleWithProviders<DatepickerModule> {
|
|
41
|
-
return {
|
|
42
|
-
ngModule: DatepickerModule,
|
|
43
|
-
providers: [
|
|
44
|
-
{ provide: CALENDAR_WEEKDAY_LABELS, useValue: weekdayLabels },
|
|
45
|
-
{ provide: CALENDAR_MONTH_LABELS, useValue: monthLabels },
|
|
46
|
-
{ provide: DATEPICKER_ERROR_LABELS, useValue: errorLabels },
|
|
47
|
-
],
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { DatepickerComponent } from './components/datepicker/datepicker.component';
|
|
2
|
-
export { DatepickerErrorLabels, DatepickerValidationErrors } from './types/datepicker.types';
|
|
3
|
-
export {
|
|
4
|
-
DATEPICKER_DEFAULT_ERROR_LABELS,
|
|
5
|
-
DATEPICKER_ERROR_LABELS,
|
|
6
|
-
DATEPICKER_SEPARATOR_CHAR,
|
|
7
|
-
} from './datepicker.conf';
|
|
8
|
-
export { DatepickerModule } from './datepicker.module';
|