fixing the fix, missed the camelCase of Et2Checkbox and changed Et2Checkbox so IDE can check it

This commit is contained in:
ralf 2024-07-06 09:06:58 +02:00
parent 7f92a44dce
commit ca2d82b32d
3 changed files with 19 additions and 30 deletions

View File

@ -14,6 +14,7 @@ import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
import '../Et2Image/Et2Image'; import '../Et2Image/Et2Image';
import {SlCheckbox} from "@shoelace-style/shoelace"; import {SlCheckbox} from "@shoelace-style/shoelace";
import shoelace from "../Styles/shoelace"; import shoelace from "../Styles/shoelace";
import {property} from "lit/decorators/property.js";
export class Et2Checkbox extends Et2InputWidget(SlCheckbox) export class Et2Checkbox extends Et2InputWidget(SlCheckbox)
{ {
@ -59,31 +60,21 @@ export class Et2Checkbox extends Et2InputWidget(SlCheckbox)
]; ];
} }
static get properties() @property({type: String})
{ selectedValue = 'true';
return { @property({type: String})
...super.properties, unselectedValue = '';
/* Different value when checked */
selectedValue: {type: String},
/* Different value when unchecked */
unselectedValue: {type: String}
}
}
constructor() constructor()
{ {
super(); super();
this.isSlComponent = true; this.isSlComponent = true;
this.selectedValue = 'true';
this.unselectedValue = '';
} }
connectedCallback() connectedCallback()
{ {
super.connectedCallback(); super.connectedCallback();
} }
get label() get label()

View File

@ -22,7 +22,7 @@ import {egw, IegwAppLocal} from "../jsapi/egw_global";
import {et2_cloneObject, et2_csvSplit} from "./et2_core_common"; import {et2_cloneObject, et2_csvSplit} from "./et2_core_common";
import {et2_compileLegacyJS} from "./et2_core_legacyJSFunctions"; import {et2_compileLegacyJS} from "./et2_core_legacyJSFunctions";
import {et2_IDOMNode, et2_IInputNode} from "./et2_core_interfaces"; import {et2_IDOMNode, et2_IInputNode} from "./et2_core_interfaces";
import {loadWebComponent} from "./Et2Widget/Et2Widget"; import {loadWebComponent,Et2Widget} from "./Et2Widget/Et2Widget";
// fixing circular dependencies by only importing type // fixing circular dependencies by only importing type
import type {et2_container} from "./et2_core_baseWidget"; import type {et2_container} from "./et2_core_baseWidget";
import type {et2_inputWidget} from "./et2_core_inputWidget"; import type {et2_inputWidget} from "./et2_core_inputWidget";
@ -460,7 +460,7 @@ export class et2_widget extends ClassWithAttributes
* *
* @param _id is the id you're searching for * @param _id is the id you're searching for
*/ */
getWidgetById(_id): et2_widget | null getWidgetById(_id): Et2Widget | et2_widget | null
{ {
if (this.id == _id) if (this.id == _id)
{ {
@ -480,7 +480,7 @@ export class et2_widget extends ClassWithAttributes
if (this.id && _id.indexOf('[') > -1 && this._children.length) if (this.id && _id.indexOf('[') > -1 && this._children.length)
{ {
var ids = (new et2_arrayMgr()).explodeKey(_id); var ids = (new et2_arrayMgr()).explodeKey(_id);
var widget: et2_widget = this; var widget: Et2Widget | et2_widget = this;
for (var i = 0; i < ids.length && widget !== null; i++) for (var i = 0; i < ids.length && widget !== null; i++)
{ {
widget = widget.getWidgetById(ids[i]); widget = widget.getWidgetById(ids[i]);

View File

@ -37,14 +37,11 @@ import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox";
import {et2_widget} from "../../api/js/etemplate/et2_core_widget"; import {et2_widget} from "../../api/js/etemplate/et2_core_widget";
import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch"; import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch";
import {et2_iframe} from "../../api/js/etemplate/et2_widget_iframe"; import {et2_iframe} from "../../api/js/etemplate/et2_widget_iframe";
// @ts-ignore
import {date} from "../../api/js/etemplate/lib/date.js";
import {sprintf} from "../../api/js/egw_action/egw_action_common"; import {sprintf} from "../../api/js/egw_action/egw_action_common";
import {egw_registerGlobalShortcut, egw_unregisterGlobalShortcut} from "../../api/js/egw_action/egw_keymanager"; import {egw_registerGlobalShortcut, egw_unregisterGlobalShortcut} from "../../api/js/egw_action/egw_keymanager";
import {egw, egw_getFramework} from "../../api/js/jsapi/egw_global"; import {egw, egw_getFramework} from "../../api/js/jsapi/egw_global";
import {et2_number} from "../../api/js/etemplate/et2_widget_number"; import {et2_number} from "../../api/js/etemplate/et2_widget_number";
import {et2_template} from "../../api/js/etemplate/et2_widget_template"; import {et2_template} from "../../api/js/etemplate/et2_widget_template";
import {et2_checkbox} from "../../api/js/etemplate/et2_widget_checkbox";
import {et2_grid} from "../../api/js/etemplate/et2_widget_grid"; import {et2_grid} from "../../api/js/etemplate/et2_widget_grid";
import {Et2Textbox} from "../../api/js/etemplate/Et2Textbox/Et2Textbox"; import {Et2Textbox} from "../../api/js/etemplate/Et2Textbox/Et2Textbox";
import "./SidemenuDate"; import "./SidemenuDate";
@ -59,6 +56,7 @@ import {et2_IInput} from "../../api/js/etemplate/et2_core_interfaces";
import {Et2DateTime} from "../../api/js/etemplate/Et2Date/Et2DateTime"; import {Et2DateTime} from "../../api/js/etemplate/Et2Date/Et2DateTime";
import {Et2Select} from "../../api/js/etemplate/Et2Select/Et2Select"; import {Et2Select} from "../../api/js/etemplate/Et2Select/Et2Select";
import type {SelectOption} from "../../api/js/etemplate/Et2Select/FindSelectOptions"; import type {SelectOption} from "../../api/js/etemplate/Et2Select/FindSelectOptions";
import type {Et2Checkbox} from "../../api/js/etemplate/Et2Checkbox/Et2Checkbox";
/** /**
* UI for calendar * UI for calendar
@ -2245,14 +2243,14 @@ export class CalendarApp extends EgwApp
*/ */
move_edit_series(_DOM,_button) move_edit_series(_DOM,_button)
{ {
var content : any = this.et2.getArrayMgr('content').data; const content : any = this.et2.getArrayMgr('content').data;
var start_date = this.et2.getValueById('start'); const start_date = this.et2.getValueById('start');
var end_date = this.et2.getValueById('end'); const end_date = this.et2.getValueById('end');
var whole_day = <et2_checkbox> this.et2.getWidgetById('whole_day'); const whole_day = <Et2Checkbox>this.et2.getWidgetById('whole_day');
var duration = ''+this.et2.getValueById('duration'); const duration = ''+this.et2.getValueById('duration');
var is_whole_day = whole_day && whole_day.value == whole_day.selected_value; const is_whole_day = whole_day && whole_day.value == whole_day.selectedValue;
var button = _button; const button = _button;
var that = this; const that = this;
let instance_date_regex = window.location.search.match(/date=(\d{4}-\d{2}-\d{2}(?:.+Z)?)/); let instance_date_regex = window.location.search.match(/date=(\d{4}-\d{2}-\d{2}(?:.+Z)?)/);
let instance_date; let instance_date;
@ -4246,7 +4244,7 @@ export class CalendarApp extends EgwApp
{ {
if (content.grid[i] != null) if (content.grid[i] != null)
{ {
checkbox = <et2_checkbox> this.et2.getWidgetById(i+'[enable]'); checkbox = <Et2Checkbox>this.et2.getWidgetById(i+'[enable]');
if (checkbox) if (checkbox)
{ {
checkbox.set_value(_widget.checked); checkbox.set_value(_widget.checked);
@ -4284,7 +4282,7 @@ export class CalendarApp extends EgwApp
*/ */
public videoconferenceOnChange(event) public videoconferenceOnChange(event)
{ {
let widget = <et2_checkbox> this.et2.getWidgetById('videoconference'); let widget = <Et2Checkbox>this.et2.getWidgetById('videoconference');
if (widget && widget.get_value()) if (widget && widget.get_value())
{ {