Skip to content

Commit

Permalink
feat(datepicker): rename left right classes for positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
fbasso committed May 12, 2021
1 parent bebd9ab commit a821d49
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import {Component} from '@angular/core';
import {
NgbCalendar,
NgbDate,
NgbDateStruct,
NgbInputDatepickerConfig
} from '@ng-bootstrap/ng-bootstrap';
import {NgbCalendar, NgbDate, NgbDateStruct, NgbInputDatepickerConfig} from '@ng-bootstrap/ng-bootstrap';

@Component({
selector: 'ngbd-datepicker-config',
templateUrl: './datepicker-config.html',
providers: [NgbInputDatepickerConfig] // add config to the component providers
providers: [NgbInputDatepickerConfig] // add config to the component providers
})
export class NgbdDatepickerConfig {

model: NgbDateStruct;

constructor(config: NgbInputDatepickerConfig, calendar: NgbCalendar) {
Expand All @@ -30,6 +24,6 @@ export class NgbdDatepickerConfig {
config.autoClose = 'outside';

// setting datepicker popup to open above the input
config.placement = ['top-left', 'top-right'];
config.placement = ['top-start', 'top-end'];
}
}
2 changes: 1 addition & 1 deletion src/datepicker/datepicker-input-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('NgbInputDatepickerConfig', () => {
expect(config.autoClose).toBe(true);
expect(config.container).toBeUndefined();
expect(config.positionTarget).toBeUndefined();
expect(config.placement).toEqual(['bottom-left', 'bottom-right', 'top-left', 'top-right']);
expect(config.placement).toEqual(['bottom-start', 'bottom-end', 'top-start', 'top-end']);
expect(config.restoreFocus).toBe(true);
});
});
2 changes: 1 addition & 1 deletion src/datepicker/datepicker-input-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export class NgbInputDatepickerConfig extends NgbDatepickerConfig {
autoClose: boolean | 'inside' | 'outside' = true;
container: null | 'body';
positionTarget: string | HTMLElement;
placement: PlacementArray = ['bottom-left', 'bottom-right', 'top-left', 'top-right'];
placement: PlacementArray = ['bottom-start', 'bottom-end', 'top-start', 'top-end'];
restoreFocus: true | HTMLElement | string = true;
}
2 changes: 1 addition & 1 deletion src/datepicker/datepicker-input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function customizeConfig(config: NgbInputDatepickerConfig) {
config.autoClose = 'outside';
config.container = 'body';
config.positionTarget = 'positionTarget';
config.placement = ['bottom-left', 'top-right'];
config.placement = ['bottom-start', 'top-end'];
}

describe('NgbInputDatepicker', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/datepicker/datepicker-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ export class NgbInputDatepicker implements OnChanges,
/**
* The preferred placement of the datepicker popup.
*
* Possible values are `"top"`, `"top-left"`, `"top-right"`, `"bottom"`, `"bottom-left"`,
* `"bottom-right"`, `"left"`, `"left-top"`, `"left-bottom"`, `"right"`, `"right-top"`,
* `"right-bottom"`
* Possible values are `"top"`, `"top-start"`, `"top-end"`, `"bottom"`, `"bottom-start"`,
* `"bottom-end"`, `"start"`, `"start-top"`, `"start-bottom"`, `"end"`, `"end-top"`,
* `"end-bottom"`
*
* Accepts an array of strings or a string with space separated possible values.
*
Expand Down

0 comments on commit a821d49

Please sign in to comment.