mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
adding optional submit_value parameter to widget getValue() method to let widgets know value is needed for submit/getValues
This commit is contained in:
parent
372e6ebbdb
commit
be7f95d0aa
@ -33,7 +33,7 @@ export declare class Et2InputWidgetInterface
|
||||
|
||||
public get_value() : any;
|
||||
|
||||
public getValue() : any;
|
||||
public getValue(submit_value? : boolean) : any;
|
||||
|
||||
public set_readonly(boolean) : void;
|
||||
|
||||
@ -358,18 +358,29 @@ const Et2InputWidgetMixin = <T extends Constructor<LitElement>>(superclass : T)
|
||||
this.requestUpdate("readonly");
|
||||
}
|
||||
|
||||
public get readonly() { return this.__readonly};
|
||||
public get readonly()
|
||||
{
|
||||
return this.__readonly;
|
||||
}
|
||||
|
||||
set readOnly(new_value) {this.readonly = new_value;}
|
||||
set readOnly(new_value)
|
||||
{
|
||||
this.readonly = new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lion mapping
|
||||
* @deprecated
|
||||
*/
|
||||
get readOnly()
|
||||
{ return this.readonly};
|
||||
{
|
||||
return this.readonly;
|
||||
}
|
||||
|
||||
getValue()
|
||||
/**
|
||||
* @param boolean submit_value true: call by etemplate2.(getValues|submit|postSubmit)()
|
||||
*/
|
||||
getValue(submit_value? : boolean)
|
||||
{
|
||||
return this.readonly || this.disabled ? null : (
|
||||
// Give a clone of objects or receiver might use the reference
|
||||
|
@ -312,7 +312,10 @@ export class et2_inputWidget extends et2_valueWidget implements et2_IInput, et2_
|
||||
return this.getValue();
|
||||
}
|
||||
|
||||
getValue()
|
||||
/**
|
||||
* @param boolean submit_value true: call by etemplate2.(getValues|submit|postSubmit)()
|
||||
*/
|
||||
getValue(submit_value? : boolean)
|
||||
{
|
||||
var node = this.getInputNode();
|
||||
if (node)
|
||||
|
@ -541,13 +541,15 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
|
||||
this.value = _value;
|
||||
}
|
||||
|
||||
getValue()
|
||||
/**
|
||||
* @param boolean submit_value true: call by etemplate2.(getValues|submit|postSubmit)()
|
||||
*/
|
||||
getValue(submit_value? : boolean)
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
// are we called by etemplate2.getValues() (has a closure result)
|
||||
// not always setting it, as getValue() is called a lot, e.g. to test input is dirty
|
||||
if (this.options.applyDefaultFont && this.getInstanceManager().get_values)
|
||||
// not always applying defaut font, as getValue() is called a lot, e.g. to test input is dirty
|
||||
if (this.options.applyDefaultFont && submit_value)
|
||||
{
|
||||
this.applyDefaultFont();
|
||||
}
|
||||
|
@ -1220,11 +1220,6 @@ export class etemplate2
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag that getValues() is running
|
||||
*/
|
||||
get_values = false;
|
||||
|
||||
/**
|
||||
* Fetches all input element values and returns them in an associative
|
||||
* array. Widgets which introduce namespacing can use the internal _target
|
||||
@ -1235,8 +1230,6 @@ export class etemplate2
|
||||
*/
|
||||
getValues(_root : et2_widget, skip_reset_dirty : boolean)
|
||||
{
|
||||
this.get_values = true;
|
||||
|
||||
const result = {};
|
||||
|
||||
// Iterate over the widget tree
|
||||
@ -1296,7 +1289,7 @@ export class etemplate2
|
||||
id = typeof _target == "undefined" ? 0 : Object.keys(_target).length;
|
||||
}
|
||||
|
||||
const value = _widget.getValue();
|
||||
const value = _widget.getValue(true); // true: let widget know getValue() / submit is calling it
|
||||
|
||||
// Check whether the entry is really undefined
|
||||
if(typeof _target[id] != "undefined" && (typeof _target[id] != 'object' || typeof value != 'object'))
|
||||
@ -1339,8 +1332,6 @@ export class etemplate2
|
||||
|
||||
}, this, et2_IInput);
|
||||
|
||||
this.get_values = false;
|
||||
|
||||
egw().debug("info", "Value", result);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user