feat(datepicker): add option to change the position of the datepicker

This commit is contained in:
Sarah Vaupel 2019-08-14 11:42:02 +02:00
parent 863971fbde
commit 85f46ef230

View File

@ -75,6 +75,12 @@ export class Datepicker {
const datepickerGlobalConfig = DATEPICKER_CONFIG['global'];
const datepickerConfig = DATEPICKER_CONFIG[this._element.getAttribute('type')];
// additional position config (optional data-datepicker-position attribute in html) that can specialize the global config
const datepickerPosition = this._element.dataSet.datepickerPosition;
if (datepickerPosition) {
datepickerGlobalConfig.position = datepickerPosition;
}
if (!datepickerConfig) {
throw new Error('Datepicker utility called on unsupported element!');
}