mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 01:43:47 +01:00
Fix DateRange UI did not fill in start date properly
This commit is contained in:
parent
e21ce3f54b
commit
be4506fa3b
@ -3,9 +3,8 @@ import {FormControlMixin} from "@lion/form-core";
|
|||||||
import {classMap, css, html, ifDefined, LitElement, TemplateResult} from "@lion/core";
|
import {classMap, css, html, ifDefined, LitElement, TemplateResult} from "@lion/core";
|
||||||
import shoelace from "../Styles/shoelace";
|
import shoelace from "../Styles/shoelace";
|
||||||
import {dateStyles} from "./DateStyles";
|
import {dateStyles} from "./DateStyles";
|
||||||
import flatpickr from "flatpickr";
|
|
||||||
import "flatpickr/dist/plugins/rangePlugin";
|
import "flatpickr/dist/plugins/rangePlugin";
|
||||||
import {Et2Date, formatDate, parseDate} from "./Et2Date";
|
import {formatDate, parseDate} from "./Et2Date";
|
||||||
import {egw} from "../../jsapi/egw_global";
|
import {egw} from "../../jsapi/egw_global";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,31 +54,6 @@ export class Et2DateRange extends Et2InputWidget(FormControlMixin(LitElement))
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
getUpdateComplete() {
|
|
||||||
const p = super.getUpdateComplete();
|
|
||||||
if(!this.relative)
|
|
||||||
{
|
|
||||||
p.then(() => this.setupFlatpickr());
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
protected setupFlatpickr()
|
|
||||||
{
|
|
||||||
if(!this.fromElement || !this.fromElement._inputElement) return;
|
|
||||||
|
|
||||||
this.fromElement._instance = flatpickr((<Et2Date>this.fromElement).findInputField(), {
|
|
||||||
...(<Et2Date>this.fromElement).getOptions(),
|
|
||||||
...{
|
|
||||||
plugins: [
|
|
||||||
// @ts-ignore ts can't find rangePlugin in IDE
|
|
||||||
rangePlugin({
|
|
||||||
input: this.toElement
|
|
||||||
})
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
render()
|
render()
|
||||||
{
|
{
|
||||||
const hasLabel = this.label ? true : false
|
const hasLabel = this.label ? true : false
|
||||||
@ -158,14 +132,14 @@ export class Et2DateRange extends Et2InputWidget(FormControlMixin(LitElement))
|
|||||||
placeholder=${ifDefined(this.placeholder)}
|
placeholder=${ifDefined(this.placeholder)}
|
||||||
defaultDate=${ifDefined(this.value?.from)}
|
defaultDate=${ifDefined(this.value?.from)}
|
||||||
></et2-date>
|
></et2-date>
|
||||||
<et2-textbox
|
<et2-date
|
||||||
name="to"
|
name="to"
|
||||||
?disabled=${this.disabled}
|
?disabled=${this.disabled}
|
||||||
?readonly=${this.readonly}
|
?readonly=${this.readonly}
|
||||||
?required=${this.required}
|
?required=${this.required}
|
||||||
placeholder=${ifDefined(this.placeholder)}
|
placeholder=${ifDefined(this.placeholder)}
|
||||||
value=${ifDefined(this.value?.to)}
|
value=${ifDefined(this.value?.to)}
|
||||||
></et2-textbox>
|
></et2-date>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user