forked from ng-bootstrap/ng-bootstrap
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datepicker): wip datepicker input global config
Closes ng-bootstrap#3273
- Loading branch information
Showing
6 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {NgbInputDatepickerConfig} from './datepicker-input-config'; | ||
|
||
describe('NgbInputDatepickerConfig', () => { | ||
it('should have sensible default values', () => { | ||
const config = new 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']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {Injectable} from '@angular/core'; | ||
|
||
import {PlacementArray} from '../util/positioning'; | ||
|
||
/** | ||
* A configuration service for the [`NgbDatepickerInput`](#/components/datepicker/api#NgbDatepicker) component. | ||
* | ||
* You can inject this service, typically in your root component, and customize the values of its properties in | ||
* order to provide default values for all the datepicker inputs used in the application. | ||
*/ | ||
@Injectable({providedIn: 'root'}) | ||
export class NgbInputDatepickerConfig { | ||
autoClose: boolean | 'inside' | 'outside' = true; | ||
container: null | 'body'; | ||
positionTarget: string | HTMLElement; | ||
placement: PlacementArray = ['bottom-left', 'bottom-right', 'top-left', 'top-right']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters