mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 11:23:54 +01:00
Fix CustomFilterHeader did not work properly
Some transformations were not correctly handled, and events were therefor not bound
This commit is contained in:
parent
8c7cfc3e69
commit
0ae69429b5
@ -43,13 +43,15 @@ export class Et2CustomFilterHeader extends FilterMixin(Et2InputWidget(LitElement
|
||||
{
|
||||
super.transformAttributes(attrs);
|
||||
|
||||
switch(attrs.widgetType)
|
||||
let widgetType = this.getArrayMgr("modifications").getEntry(this.id)?.widgetType || attrs.widgetType || "";
|
||||
|
||||
switch(widgetType)
|
||||
{
|
||||
case "link-entry":
|
||||
this.widgetType = 'et2-nextmatch-header-entry';
|
||||
break;
|
||||
default:
|
||||
this.widgetType = attrs.widgetType;
|
||||
this.widgetType = widgetType;
|
||||
// Prefer webcomponent, if legacy type was sent
|
||||
if(window.customElements.get("et2-" + this.widgetType))
|
||||
{
|
||||
@ -90,7 +92,10 @@ export class Et2CustomFilterHeader extends FilterMixin(Et2InputWidget(LitElement
|
||||
|
||||
set value(new_value)
|
||||
{
|
||||
this.filter_node.value = new_value;
|
||||
if(this.filter_node)
|
||||
{
|
||||
this.filter_node.value = new_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,22 +31,31 @@ class Customfilter extends Widget\Transformer
|
||||
*/
|
||||
public function beforeSendToClient($cname, array $expand=null)
|
||||
{
|
||||
parent::beforeSendToClient($cname, $expand);
|
||||
switch($this->attrs['type'])
|
||||
{
|
||||
case "link-entry":
|
||||
self::$transformation['type'] = $this->attrs['type'] = 'et2-nextmatch-header-entry';
|
||||
break;
|
||||
default:
|
||||
list($type) = explode('-',$this->attrs['type']);
|
||||
list($type) = explode('-', $this->attrs['type']);
|
||||
if($type == 'select')
|
||||
{
|
||||
if(in_array($this->attrs['type'], Widget\Select::$cached_types))
|
||||
{
|
||||
$widget_type = $this->attrs['type'];
|
||||
}
|
||||
$this->attrs['type'] = 'et2-nextmatch-header-custom';
|
||||
}
|
||||
self::$transformation['type'] = $this->attrs['type'];
|
||||
else
|
||||
{
|
||||
// Run the new widget type's beforeSendToClient
|
||||
$expanded_child = self::factory($this->attrs['type'], false, $this->id);
|
||||
$expanded_child->id = $this->id;
|
||||
$expanded_child->type = $this->attrs['type'];
|
||||
$expanded_child->run('beforeSendToClient', array($cname, $expand));
|
||||
$widget_type = $expanded_child->attrs['type'];
|
||||
}
|
||||
$this->attrs['type'] = 'et2-nextmatch-header-custom';
|
||||
}
|
||||
$form_name = self::form_name($cname, $this->id, $expand);
|
||||
|
||||
@ -55,9 +64,8 @@ class Customfilter extends Widget\Transformer
|
||||
self::setElementAttribute($form_name, 'type', $this->attrs['type']);
|
||||
if($widget_type)
|
||||
{
|
||||
self::setElementAttribute($form_name, 'widget_type', $widget_type);
|
||||
self::setElementAttribute($form_name, 'widgetType', $widget_type);
|
||||
}
|
||||
parent::beforeSendToClient($cname, $expand);
|
||||
}
|
||||
|
||||
|
||||
@ -80,4 +88,6 @@ class Customfilter extends Widget\Transformer
|
||||
$valid = $value ? $value : null;
|
||||
}
|
||||
}
|
||||
Widget::registerWidget(__NAMESPACE__.'\\Customfilter', array('nextmatch-customfilter'));
|
||||
|
||||
Widget::registerWidget(__NAMESPACE__ . '\\Customfilter', array('nextmatch-customfilter',
|
||||
'et2-nextmatch-header-custom'));
|
Loading…
Reference in New Issue
Block a user