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

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

View File

@ -1730,8 +1730,11 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
// Allow column widgets a chance to resize // Allow column widgets a chance to resize
self.iterateOver(function(widget) self.iterateOver(function(widget)
{
if (typeof widget.resize === 'function')
{ {
widget.resize(); widget.resize();
}
}, self, et2_IResizeable); }, self, et2_IResizeable);
}; };
@ -2190,8 +2193,11 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
// Allow column widgets a chance to resize // Allow column widgets a chance to resize
this.iterateOver(function(widget) this.iterateOver(function(widget)
{
if (typeof widget.resize === 'function')
{ {
widget.resize(); widget.resize();
}
}, this, et2_IResizeable); }, this, et2_IResizeable);
} }

View File

@ -150,7 +150,12 @@ export class et2_portlet extends et2_valueWidget
self self
); );
// Tell children // 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")) this.header = jQuery(document.createElement("div"))
@ -330,7 +335,12 @@ export class et2_portlet extends et2_valueWidget
{ {
// Tell children // Tell children
try { 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) { } catch (e) {
// Something went wrong, but do not stop // Something went wrong, but do not stop
egw.debug('warn',e,this); egw.debug('warn',e,this);
@ -430,4 +440,3 @@ export class et2_portlet extends et2_valueWidget
} }
} }
et2_register_widget(et2_portlet, ["portlet"]); et2_register_widget(et2_portlet, ["portlet"]);

View File

@ -275,8 +275,11 @@ export class etemplate2
if(jQuery(self.DOMContainer).is(":visible")) if(jQuery(self.DOMContainer).is(":visible"))
{ {
self._widgetContainer.iterateOver(function(_widget) self._widgetContainer.iterateOver(function(_widget)
{
if (typeof _widget.resize === 'function')
{ {
_widget.resize(excess_height); _widget.resize(excess_height);
}
}, self, et2_IResizeable); }, 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) if(this.rowHeight != old_height)
{ {
this.iterateOver(function(child) { this.iterateOver(function(child) {
if(child === this) return; if (child !== this && typeof child.resize === 'function')
{
child.resize(); child.resize();
}
},this, et2_IResizeable); },this, et2_IResizeable);
} }