From c83b281aa9f0368936c2a9dafa7fffa0457e2179 Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 24 Feb 2022 19:44:30 +0200 Subject: [PATCH] added et2-date-timeonly_ro widget --- .../Et2Date/Et2DateTimeOnlyReadonly.ts | 27 +++++++++++++++++++ api/js/etemplate/etemplate2.ts | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 api/js/etemplate/Et2Date/Et2DateTimeOnlyReadonly.ts diff --git a/api/js/etemplate/Et2Date/Et2DateTimeOnlyReadonly.ts b/api/js/etemplate/Et2Date/Et2DateTimeOnlyReadonly.ts new file mode 100644 index 0000000000..01cda51a94 --- /dev/null +++ b/api/js/etemplate/Et2Date/Et2DateTimeOnlyReadonly.ts @@ -0,0 +1,27 @@ +/** + * EGroupware eTemplate2 - Readonly date+time WebComponent + * + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package api + * @link https://www.egroupware.org + * @author Nathan Gray + */ + +import {formatTime, parseDateTime} from "./Et2Date"; +import {Et2DateReadonly} from "./Et2DateReadonly"; + +/** + * This is a stripped-down read-only widget used in nextmatch + */ +export class Et2DateTimeOnlyReadonly extends Et2DateReadonly +{ + constructor() + { + super(); + this.parser = parseDateTime; + this.formatter = formatTime; + } +} + +// @ts-ignore TypeScript is not recognizing that Et2Date is a LitElement +customElements.define("et2-date-timeonly_ro", Et2DateTimeOnlyReadonly); \ No newline at end of file diff --git a/api/js/etemplate/etemplate2.ts b/api/js/etemplate/etemplate2.ts index e8ef2d5b6b..a663f9dd5e 100644 --- a/api/js/etemplate/etemplate2.ts +++ b/api/js/etemplate/etemplate2.ts @@ -32,6 +32,7 @@ import './Et2Date/Et2DateReadonly'; import './Et2Date/Et2DateSinceReadonly'; import './Et2Date/Et2DateTime'; import './Et2Date/Et2DateTimeOnly'; +import './Et2Date/Et2DateTimeOnlyReadonly'; import './Et2Date/Et2DateTimeReadonly'; import './Et2Date/Et2DateTimeToday'; import './Et2Description/Et2Description'; @@ -1568,4 +1569,4 @@ if(typeof window.etemplate2 === 'undefined') // Calls etemplate2_handle_response in the context of the object which // requested the response from the server egw(window).registerJSONPlugin(etemplate2.handle_load, null, 'et2_load'); -egw(window).registerJSONPlugin(etemplate2.handle_validation_error, null, 'et2_validation_error'); +egw(window).registerJSONPlugin(etemplate2.handle_validation_error, null, 'et2_validation_error'); \ No newline at end of file