mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-11 16:00:45 +01:00
Fix missing label in date widgets
This commit is contained in:
parent
c9f6c98a5d
commit
ec13b1a472
@ -17,14 +17,15 @@ export const dateStyles = [
|
|||||||
.overdue {
|
.overdue {
|
||||||
color: red; // var(--whatever the theme color)
|
color: red; // var(--whatever the theme color)
|
||||||
}
|
}
|
||||||
input.flatpickr-input {
|
input.flatpickr {
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
border-color: var(--input-border-color);
|
border-color: var(--input-border-color);
|
||||||
color: var(--input-text-color);
|
color: var(--input-text-color);
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
input.flatpickr-input:hover {
|
input.flatpickr:hover {
|
||||||
background-image: ${cssImage("datepopup")};
|
background-image: ${cssImage("datepopup")};
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position-x: right;
|
background-position-x: right;
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import {css} from "@lion/core";
|
import {css, html} from "@lion/core";
|
||||||
|
import {FormControlMixin} from "@lion/form-core";
|
||||||
import 'lit-flatpickr';
|
import 'lit-flatpickr';
|
||||||
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
||||||
import {dateStyles} from "./DateStyles";
|
import {dateStyles} from "./DateStyles";
|
||||||
@ -269,7 +270,7 @@ export function formatDateTime(date : Date, options = {dateFormat: "", timeForma
|
|||||||
return formatDate(date, options) + " " + formatTime(date, options);
|
return formatDate(date, options) + " " + formatTime(date, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Et2Date extends Et2InputWidget(LitFlatpickr)
|
export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
|
||||||
{
|
{
|
||||||
static get styles()
|
static get styles()
|
||||||
{
|
{
|
||||||
@ -326,6 +327,7 @@ export class Et2Date extends Et2InputWidget(LitFlatpickr)
|
|||||||
options.weekNumbers = true;
|
options.weekNumbers = true;
|
||||||
|
|
||||||
// Turn on scroll wheel support
|
// Turn on scroll wheel support
|
||||||
|
// @ts-ignore TypeScript can't find scrollPlugin, but rollup does
|
||||||
options.plugins = [new scrollPlugin()];
|
options.plugins = [new scrollPlugin()];
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
@ -372,6 +374,36 @@ export class Et2Date extends Et2InputWidget(LitFlatpickr)
|
|||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_inputGroupInputTemplate()
|
||||||
|
{
|
||||||
|
return html`
|
||||||
|
<div class="input-group__input">
|
||||||
|
<slot name="input">
|
||||||
|
<input class="lit-flatpickr flatpickr flatpickr-input"
|
||||||
|
placeholder=${this.placeholder}/>
|
||||||
|
</slot>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override from flatpickr
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
findInputField()
|
||||||
|
{
|
||||||
|
return this._inputNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interactive (form) element. Override from Lion
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
get _inputNode()
|
||||||
|
{
|
||||||
|
return /** @type {HTMLElementWithValue} */ (this.shadowRoot.querySelector('input'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore TypeScript is not recognizing that Et2Date is a LitElement
|
// @ts-ignore TypeScript is not recognizing that Et2Date is a LitElement
|
||||||
|
@ -14,6 +14,7 @@ import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
|||||||
import {sprintf} from "../../egw_action/egw_action_common";
|
import {sprintf} from "../../egw_action/egw_action_common";
|
||||||
import {dateStyles} from "./DateStyles";
|
import {dateStyles} from "./DateStyles";
|
||||||
import {cssImage} from "../Et2Widget/Et2Widget";
|
import {cssImage} from "../Et2Widget/Et2Widget";
|
||||||
|
import {FormControlMixin} from "@lion/form-core";
|
||||||
|
|
||||||
export interface formatOptions
|
export interface formatOptions
|
||||||
{
|
{
|
||||||
@ -110,7 +111,7 @@ export function formatDuration(value : number | string, options : formatOptions)
|
|||||||
* If not specified, the time is in assumed to be minutes and will be displayed with a calculated unit
|
* If not specified, the time is in assumed to be minutes and will be displayed with a calculated unit
|
||||||
* but this can be specified with the properties.
|
* but this can be specified with the properties.
|
||||||
*/
|
*/
|
||||||
export class Et2DateDuration extends Et2InputWidget(LitElement)
|
export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement))
|
||||||
{
|
{
|
||||||
static get styles()
|
static get styles()
|
||||||
{
|
{
|
||||||
@ -118,8 +119,8 @@ export class Et2DateDuration extends Et2InputWidget(LitElement)
|
|||||||
...super.styles,
|
...super.styles,
|
||||||
...dateStyles,
|
...dateStyles,
|
||||||
css`
|
css`
|
||||||
:host {
|
.form-field__group-two {
|
||||||
display: inline-flex;
|
width: 100%;
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
color: var(--input-text-color);
|
color: var(--input-text-color);
|
||||||
@ -307,15 +308,23 @@ export class Et2DateDuration extends Et2InputWidget(LitElement)
|
|||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
render()
|
* @return {TemplateResult}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line class-methods-use-this
|
||||||
|
_inputGroupInputTemplate()
|
||||||
{
|
{
|
||||||
return html`
|
return html`
|
||||||
|
<div class="input-group__input">
|
||||||
|
<slot name="input">
|
||||||
${this._inputTemplate()}
|
${this._inputTemplate()}
|
||||||
${this._formatTemplate()}`;
|
${this._formatTemplate()}
|
||||||
|
</slot>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the value in data format into value in display format.
|
* Converts the value in data format into value in display format.
|
||||||
*
|
*
|
||||||
|
@ -50,6 +50,19 @@ export class Et2DateTimeOnly extends Et2DateTime
|
|||||||
options.noCalendar = true;
|
options.noCalendar = true;
|
||||||
options.dateFormat = "1970-01-01TH:i:00\\Z";
|
options.dateFormat = "1970-01-01TH:i:00\\Z";
|
||||||
|
|
||||||
|
// Time only does not have year & month, which scrollPlugin blindly tries to use
|
||||||
|
// This causes an error and interrupts the initialization
|
||||||
|
options.plugins.push(instance =>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
onReady: function()
|
||||||
|
{
|
||||||
|
this.yearElements = []
|
||||||
|
this.monthElements = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user