mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-16 19:08:27 +01:00
Support scroll wheel on date year, month, hour, minute
This commit is contained in:
parent
1e23a3c45e
commit
354d15ba57
@ -14,6 +14,7 @@ import 'lit-flatpickr';
|
|||||||
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
||||||
import {dateStyles} from "./DateStyles";
|
import {dateStyles} from "./DateStyles";
|
||||||
import {LitFlatpickr} from "lit-flatpickr";
|
import {LitFlatpickr} from "lit-flatpickr";
|
||||||
|
import "flatpickr/dist/plugins/scrollPlugin.js";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,13 +294,6 @@ export class Et2Date extends Et2InputWidget(LitFlatpickr)
|
|||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
// Override some flatpickr defaults how we like it
|
|
||||||
this.altFormat = this.egw().preference("dateformat") || "Y-m-d";
|
|
||||||
this.altInput = true;
|
|
||||||
this.allowInput = true;
|
|
||||||
this.dateFormat = "Y-m-dT00:00:00\\Z";
|
|
||||||
this.weekNumbers = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -315,6 +309,28 @@ export class Et2Date extends Et2InputWidget(LitFlatpickr)
|
|||||||
this.initializeComponent();
|
this.initializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override some flatpickr defaults to get things how we like it
|
||||||
|
*
|
||||||
|
* @see https://flatpickr.js.org/options/
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
protected getOptions()
|
||||||
|
{
|
||||||
|
let options = super.getOptions();
|
||||||
|
|
||||||
|
options.altFormat = this.egw().preference("dateformat") || "Y-m-d";
|
||||||
|
options.altInput = true;
|
||||||
|
options.allowInput = true;
|
||||||
|
options.dateFormat = "Y-m-dT00:00:00\\Z";
|
||||||
|
options.weekNumbers = true;
|
||||||
|
|
||||||
|
// Turn on scroll wheel support
|
||||||
|
options.plugins = [new scrollPlugin()];
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
set_value(value)
|
set_value(value)
|
||||||
{
|
{
|
||||||
if(!value || value == 0 || value == "0")
|
if(!value || value == 0 || value == "0")
|
||||||
|
@ -43,15 +43,28 @@ export class Et2DateTime extends Et2Date
|
|||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override some flatpickr defaults to get things how we like it
|
||||||
|
*
|
||||||
|
* @see https://flatpickr.js.org/options/
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
protected getOptions()
|
||||||
|
{
|
||||||
|
let options = super.getOptions();
|
||||||
|
|
||||||
// Configure flatpickr
|
|
||||||
let dateFormat = (this.egw().preference("dateformat") || "Y-m-d");
|
let dateFormat = (this.egw().preference("dateformat") || "Y-m-d");
|
||||||
let timeFormat = ((<string>window.egw.preference("timeformat") || "24") == "24" ? "H:i" : "h:i K");
|
let timeFormat = ((<string>window.egw.preference("timeformat") || "24") == "24" ? "H:i" : "h:i K");
|
||||||
this.altFormat = dateFormat + " " + timeFormat;
|
options.altFormat = dateFormat + " " + timeFormat;
|
||||||
this.enableTime = true;
|
options.enableTime = true;
|
||||||
this.time_24hr = this.egw().preference("timeformat", "common") == "24";
|
options.time_24hr = this.egw().preference("timeformat", "common") == "24";
|
||||||
this.dateFormat = "Y-m-dTH:i:00\\Z";
|
options.dateFormat = "Y-m-dTH:i:00\\Z";
|
||||||
this.defaultHour = new Date().getHours();
|
options.defaultHour = new Date().getHours();
|
||||||
|
|
||||||
|
return options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,13 +33,24 @@ export class Et2DateTimeOnly extends Et2DateTime
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
// Configure flatpickr
|
// Configure flatpickr
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override some flatpickr defaults to get things how we like it
|
||||||
|
*
|
||||||
|
* @see https://flatpickr.js.org/options/
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
protected getOptions()
|
||||||
|
{
|
||||||
|
let options = super.getOptions();
|
||||||
let timeFormat = ((<string>window.egw.preference("timeformat") || "24") == "24" ? "H:i" : "h:i K");
|
let timeFormat = ((<string>window.egw.preference("timeformat") || "24") == "24" ? "H:i" : "h:i K");
|
||||||
this.altFormat = timeFormat;
|
options.altFormat = timeFormat;
|
||||||
this.enableTime = true;
|
options.noCalendar = true;
|
||||||
this.noCalendar = true;
|
options.dateFormat = "1970-01-01TH:i:00\\Z";
|
||||||
this.time_24hr = this.egw().preference("timeformat", "common") == "24";
|
|
||||||
this.dateFormat = "1970-01-01TH:i:00\\Z";
|
return options;
|
||||||
this.defaultHour = new Date().getHours();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_value(value)
|
set_value(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user