Skip to content

Commit

Permalink
fix(limel-date-picker): fix width calculation if initially hidden
Browse files Browse the repository at this point in the history
close #228
  • Loading branch information
BregenzerK committed Dec 20, 2018
1 parent 588ae93 commit c21e84a
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/components/date-picker/date-picker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { Component, Element, Event, EventEmitter, Prop } from '@stencil/core';
import {
Component,
Element,
Event,
EventEmitter,
Listen,
Prop,
} from '@stencil/core';

import { Translations } from '../../global/translations';
import { DateType } from './date-type';
Expand Down Expand Up @@ -77,6 +84,9 @@ export class DatePicker {

private picker: Picker;

private container: HTMLElement;
private input: HTMLElement;

public componentWillLoad() {
switch (this.type) {
case 'date':
Expand Down Expand Up @@ -125,12 +135,10 @@ export class DatePicker {
const textfield: HTMLElement = this.host.shadowRoot.querySelector(
'limel-input-field'
);
const input = textfield.shadowRoot.querySelector('input');
const container: HTMLElement = this.host.shadowRoot.querySelector(
'.container'
);
this.input = textfield.shadowRoot.querySelector('input');
this.container = this.host.shadowRoot.querySelector('.container');

this.picker.init(input, container, this.value);
this.picker.init(this.input, this.container, this.value);
}

public componentDidUnload() {
Expand All @@ -154,6 +162,11 @@ export class DatePicker {
);
}

@Listen('window:resize')
public resizeEvent() {
this.picker.init(this.input, this.container, this.value);
}

private handleChange(event) {
event.stopPropagation();
}
Expand Down

0 comments on commit c21e84a

Please sign in to comment.