Commit 5a3dbad0 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Implementa redimensión libre de Window

Permite a los usuarios decidir el tamaño de los módulos mostrados en
ventanas, actuando sobre la esquina inferior derecha.
parent c60c086c
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -189,6 +189,10 @@ define([

			this._chartInstance = this._createChartLayer();

			if (!this.chartsData) {
				return;
			}

			var label = this.chartsData[this._currentDataSelectorValue].timeInterval;
			this._publish(this._chartInstance.getChannel("SET_PROPS"), {
				label: Utilities.formatDate(label, "dateTime")
@@ -198,9 +202,7 @@ define([
				layerInstance: this._chartInstance
			});

			if (this.chartsData) {
			this._addDataToChart();
			}
		},

		_createChartLayer: function(layerConfig) {
+4 −0
Original line number Diff line number Diff line
@@ -312,6 +312,10 @@ define([

			this.inherited(arguments);

			if (!this.chartsData) {
				return;
			}

			for (var cat in this.chartsData.definitionIndex) {

				var dataDefinitionIds = [],
+53 −2
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ define([
	, "dojo/dom-attr"
	, "dojo/dom-class"
	, "dojo/dom-style"
	, "dojo/on"
	, "put-selector/put"
], function(
	lang
@@ -11,6 +12,7 @@ define([
	, domAttr
	, domClass
	, domStyle
	, on
	, put
) {

@@ -20,6 +22,8 @@ define([
		//	description:
		//		Añade al módulo una barra de título con controles.

		windowResizedParentClass: 'resizedByUser',
		windowResizableClass: 'resizable',
		windowContainerClass: 'moduleWindow',

		windowTitleClass: 'windowTitle',
@@ -43,11 +47,15 @@ define([
		minWidthCols: 1,
		maxWidthCols: 6,

		resizable: true,
		// TODO renombrar estos flags aquí y donde se usen
		noTitleWindow: false,
		noButtonsWindow: false,
		noCloseWindow: false,

		_validSizeInterval: 100,
		_userResizeTimeout: 100,

		_setShowOwnCallbacksForEvents: function () {

			this.inherited(arguments);
@@ -85,7 +93,13 @@ define([

			this._emitEvt('LOADING');

			this._windowNode = put(node, "div." + this.windowContainerClass);
			var containerClass = this.windowContainerClass;

			if (this.resizable) {
				containerClass += '.' + this.windowResizableClass;
			}

			this._windowNode = put(node, "div." + containerClass);

			if (!this.noTitleWindow) {
				this._createWindowTitle();
@@ -131,6 +145,10 @@ define([

			this._windowContentNode.addEventListener('transitionend', this._transitionEndCallback);
			this._windowNode.parentNode.addEventListener('transitionend', this._transitionEndCallback);

			if (this.resizable) {
				this._windowNode.addEventListener('mousedown', lang.hitch(this, this._onWindowUserResizeStart));
			}
		},

		_removeNodeListeners: function() {
@@ -155,6 +173,38 @@ define([
			}
		},

		_onWindowUserResizeStart: function(evt) {

			on.once(window, 'mouseup', lang.hitch(this, this._onWindowUserResizeEnd));

			if (!this._windowMutationObserver) {
				this._windowMutationObserver = new MutationObserver(lang.partial(this._onWindowResizeProgress, this));
			}

			this._windowMutationObserver.observe(this._windowNode, {
				attributes: true,
				attributeFilter: ['style']
			});
		},

		_onWindowResizeProgress: function(self, mutations) {

			if (!self._resizeMutationHandler) {
				// TODO sería mejor que esta clase la colocase el propio padre (details) cuando este lo pida
				domClass.add(self._windowNode.parentNode, self.windowResizedParentClass);
				self._resizeMutationHandler = this;
			}

			clearTimeout(self._userResizeTimeoutHandler);
			self._userResizeTimeoutHandler = setTimeout(lang.hitch(self, self._emitResize), self._userResizeTimeout);
		},

		_onWindowUserResizeEnd: function(evt) {

			this._resizeMutationHandler && this._resizeMutationHandler.disconnect();
			delete self._resizeMutationHandler;
		},

		_show: function(req) {

			if (req && req.node) {
@@ -190,7 +240,7 @@ define([
					clearInterval(this._validSizeIntervalHandler);
					dfd.resolve();
				}
			}, validSizeDfd), 100);
			}, validSizeDfd), this._validSizeInterval);
		},

		_onWindowValidSize: function() {
@@ -333,6 +383,7 @@ define([
		_autoMaximizeOnLowWidth: function() {

			if (!this.node.offsetWidth || this.node.offsetWidth >= this.minWidth) {
				this._enableMaximize();
				return;
			}

Compare c4510203 to 23ddd0e8
Original line number Diff line number Diff line
Subproject commit c4510203e7c4c31e94cea8c63e434dcf3af9409b
Subproject commit 23ddd0e8ab9c39a642db97eeaef150fd79a9073a