only call widget.resize() if it's a function:

- web-components do not implement it
- et2-textarea / SlTextarea uses resize as a property name
--> we can postpone the decision, if we need an explicit resize handler for our web-components, or using flex is sufficient, for now
This commit is contained in:
ralf 2022-07-29 14:56:03 +02:00
parent 14252a471c
commit 125a8abf61
5 changed files with 33 additions and 10 deletions

View File

@ -321,7 +321,10 @@ export class Et2Split extends Et2Widget(SlotMixin(SlSplitPanel))
// Tell widgets that manually resize about it
this.iterateOver(function(_widget)
{
_widget.resize();
if (typeof _widget.resize === 'function')
{
_widget.resize();
}
}, self, et2_IResizeable);
}.bind(this), 100);
}

View File

@ -1731,7 +1731,10 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
// Allow column widgets a chance to resize
self.iterateOver(function(widget)
{
widget.resize();
if (typeof widget.resize === 'function')
{
widget.resize();
}
}, self, et2_IResizeable);
};
@ -2191,7 +2194,10 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
// Allow column widgets a chance to resize
this.iterateOver(function(widget)
{
widget.resize();
if (typeof widget.resize === 'function')
{
widget.resize();
}
}, this, et2_IResizeable);
}

View File

@ -150,7 +150,12 @@ export class et2_portlet extends et2_valueWidget
self
);
// Tell children
self.iterateOver(function(widget) {widget.resize();},null,et2_IResizeable);
self.iterateOver(function(widget) {
if (typeof widget.resize === 'function')
{
widget.resize();
}
},null,et2_IResizeable);
}
});
this.header = jQuery(document.createElement("div"))
@ -330,7 +335,12 @@ export class et2_portlet extends et2_valueWidget
{
// Tell children
try {
this.iterateOver(function(widget) {widget.resize();},null,et2_IResizeable);
this.iterateOver(function(widget) {
if (typeof widget.resize === 'function')
{
widget.resize();
}
},null,et2_IResizeable);
} catch (e) {
// Something went wrong, but do not stop
egw.debug('warn',e,this);
@ -429,5 +439,4 @@ export class et2_portlet extends et2_valueWidget
this.div.css('height','');
}
}
et2_register_widget(et2_portlet, ["portlet"]);
et2_register_widget(et2_portlet, ["portlet"]);

View File

@ -276,7 +276,10 @@ export class etemplate2
{
self._widgetContainer.iterateOver(function(_widget)
{
_widget.resize(excess_height);
if (typeof _widget.resize === 'function')
{
_widget.resize(excess_height);
}
}, self, et2_IResizeable);
}
}

View File

@ -943,8 +943,10 @@ export class et2_calendar_timegrid extends et2_calendar_view implements et2_IDet
if(this.rowHeight != old_height)
{
this.iterateOver(function(child) {
if(child === this) return;
child.resize();
if (child !== this && typeof child.resize === 'function')
{
child.resize();
}
},this, et2_IResizeable);
}