Skip to content

Commit

Permalink
fix(demo): update demo for selectWeekRange functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
daniloff200 committed Feb 4, 2020
1 parent f2a1036 commit e847356
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@

<div class="row">
<div class="col-xs-12 col-12 col-sm-6 col-md-5 form-group">
<p>Two first days of the each week are disabled</p>
<input
class="form-control"
placeholder="First day of each week in January is disabled"
bsDaterangepicker [datesDisabled]="disabledFirstWeekDays"
placeholder="Two days disabled"
bsDaterangepicker [daysDisabled]="[0,1]"
[bsConfig]="{ selectWeekDateRange: true }">
</div>
</div>
Expand All @@ -41,8 +42,8 @@
<div class="col-xs-12 col-12 col-sm-6 col-md-5 form-group">
<input
class="form-control"
placeholder="All days disabled (1st week of February)"
bsDaterangepicker [datesDisabled]="disabledWeekDays"
placeholder="All days disabled"
bsDaterangepicker [daysDisabled]="[0,1,2,3,4,5,6]"
[bsConfig]="{ selectWeekDateRange: true }">
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,4 @@ import { Component } from '@angular/core';
selector: 'demo-datepicker-select-week-range',
templateUrl: './select-week-range.html'
})
export class DemoDatePickerSelectWeekRangeComponent {
disabledFirstWeekDays =[
new Date('2020-01-05'),
new Date('2020-01-12'),
new Date('2020-01-19'),
new Date('2020-01-26'),
new Date('2020-01-05'),
];

disabledWeekDays = [
new Date('2020-02-01'),
new Date('2020-02-02'),
new Date('2020-02-03'),
new Date('2020-02-04'),
new Date('2020-02-05'),
new Date('2020-02-06'),
new Date('2020-02-07'),
new Date('2020-02-08'),
]
}
export class DemoDatePickerSelectWeekRangeComponent {}
22 changes: 21 additions & 1 deletion demo/src/ng-api-doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,11 @@ export const ngdoc: any = {
"type": "Date[]",
"description": "<p>Disable specific dates</p>\n"
},
{
"name": "daysDisabled",
"type": "number[]",
"description": "<p>Disable certain days in the week</p>\n"
},
{
"name": "isDisabled",
"type": "boolean",
Expand Down Expand Up @@ -877,7 +882,7 @@ export const ngdoc: any = {
{
"name": "daysDisabled",
"type": "number[]",
"description": "<p>Disable Certain days in the week</p>\n"
"description": "<p>Disable certain days in the week</p>\n"
},
{
"name": "isDisabled",
Expand Down Expand Up @@ -1004,6 +1009,11 @@ export const ngdoc: any = {
"type": "Date[]",
"description": "<p>Disable specific dates</p>\n"
},
{
"name": "daysDisabled",
"type": "number[]",
"description": "<p>Disable certain days in the week</p>\n"
},
{
"name": "isAnimated",
"defaultValue": "false",
Expand Down Expand Up @@ -1092,6 +1102,11 @@ export const ngdoc: any = {
"type": "Date[]",
"description": "<p>Disable specific dates</p>\n"
},
{
"name": "daysDisabled",
"type": "number[]",
"description": "<p>Disable certain days in the week</p>\n"
},
{
"name": "isDisabled",
"type": "boolean",
Expand Down Expand Up @@ -1181,6 +1196,11 @@ export const ngdoc: any = {
"type": "Date[]",
"description": "<p>Disable specific dates</p>\n"
},
{
"name": "daysDisabled",
"type": "number[]",
"description": "<p>Disable certain days in the week</p>\n"
},
{
"name": "isDisabled",
"type": "boolean",
Expand Down
8 changes: 4 additions & 4 deletions src/datepicker/bs-daterangepicker-inline.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class BsDaterangepickerInlineDirective implements OnInit, OnDestroy, OnCh
@Input() dateCustomClasses: DatepickerDateCustomClasses[];
/**
* Disable specific days, e.g. [0,6] will disable all Saturdays and Sundays
*/
*/
@Input() daysDisabled?: number[];
/**
* Disable specific dates
Expand Down Expand Up @@ -130,9 +130,9 @@ export class BsDaterangepickerInlineDirective implements OnInit, OnDestroy, OnCh
this._datepickerRef.instance.datesDisabled = this.datesDisabled;
}

if (changes.daysDisabled) {
this._datepickerRef.instance.daysDisabled = this.daysDisabled;
}
if (changes.daysDisabled) {
this._datepickerRef.instance.daysDisabled = this.daysDisabled;
}

if (changes.isDisabled) {
this._datepickerRef.instance.isDisabled = this.isDisabled;
Expand Down

0 comments on commit e847356

Please sign in to comment.