Commit ec81fcba authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Implementa ajuste de altura de window al contenido

Permite asignar un valor concreto de altura a un componente mostrado
como widget de vista detalle (que usa _Window) para que su altura se
ajuste a la altura de su contenido, evitando scroll.
parent 94c27352
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ define([
		omitTitleCloseButton: false,
		resizable: true,
		scrollSensitive: true,
		fitHeightToContent: false,

		_resizableForcedMinWidth: 100,
		_validSizeInterval: 100,
@@ -132,6 +133,10 @@ define([

		_limitMaxHeightToAvailableHeight: function() {

			if (this.fitHeightToContent) {
				return;
			}

			var currMaxHeight = window.innerHeight;

			if (this._lastMaxHeight !== currMaxHeight) {
@@ -177,7 +182,7 @@ define([
			this._windowNode.parentNode.addEventListener('transitionend', this._transitionEndCallback);

			if (this.scrollSensitive) {
				this._windowNode.parentNode.parentNode.addEventListener('scroll', lang.hitch(this,
				this._windowNode.parentNode.parentNode.addEventListener('scrollend', lang.hitch(this,
					this._onGrandParentScroll));
			}

+9 −7
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ define([
				idProperty: "id",
				hiddenClass: "hidden",

				_heightFitContentValue: 'fitContent',
				_rowsParameterName: "data-rows",
				_colsParameterName: "data-cols",
				_updateInteractiveTimeout: 100,
@@ -251,22 +252,23 @@ define([
				{
					ownChannel: key,
					parentChannel: this.getChannel(),
					windowTitle: key
					windowTitle: key,
					fitHeightToContent: config.height === this._heightFitContentValue
				}
			]);

			var moduleType = config.type,
				moduleDefinition = declare(moduleType).extend(_Window),
				moduleInstance = new moduleDefinition(moduleProps);
				WidgetDefinition = declare(moduleType).extend(_Window),
				widgetInstance = new WidgetDefinition(moduleProps);

			this._widgets[key] = moduleInstance;
			this._listenModule(moduleInstance);
			this._widgets[key] = widgetInstance;
			this._listenWidget(widgetInstance);
		},

		_listenModule: function(moduleInstance) {
		_listenWidget: function(widgetInstance) {

			this._setSubscription({
				channel: moduleInstance.getChannel("RESIZED"),
				channel: widgetInstance.getChannel("RESIZED"),
				callback: "_subModuleResized"
			});
		},
Compare dfd7a358 to 284fcacf
Original line number Diff line number Diff line
Subproject commit dfd7a358410dac513da0a13b8e8c273489d6f1de
Subproject commit 284fcacf34e1ae3ce63f2f687148dbb339904d38