From 2f4cb14b09cbaf587f3aa59e952cf9104f94913f Mon Sep 17 00:00:00 2001 From: vitam Date: Sat, 29 Jul 2017 21:59:14 +0200 Subject: [PATCH] modify css --- css/modals.css | 4 ++++ index.html | 4 ++-- js/directives/fileselect.js | 19 ++++++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/css/modals.css b/css/modals.css index f5740ae..3548831 100644 --- a/css/modals.css +++ b/css/modals.css @@ -42,3 +42,7 @@ .selectFiles div .controls { margin-left: 30px; } + +.selectFiles div.recursivedir { + width: 100%; +} \ No newline at end of file diff --git a/index.html b/index.html index c58e77e..4caa7af 100644 --- a/index.html +++ b/index.html @@ -23,7 +23,7 @@ - + @@ -1044,7 +1044,7 @@ {{ 'click the text to expand the folder' | translate }} {{ 'click the text to collapse the folder' | translate }} -
+
diff --git a/js/directives/fileselect.js b/js/directives/fileselect.js index d1f5f61..235fddb 100644 --- a/js/directives/fileselect.js +++ b/js/directives/fileselect.js @@ -48,6 +48,13 @@ app.directive("indeterminate", [ } }; }; + var passIfIsIndeterminate = function (callback) { // pass through the event from the scope where they sent + return function () { + if (!elem.prop("indeterminate")) { + return callback.apply(this, arguments); + } + }; + }; var catchEventOnlyOnce = function (callback) { // only fire once, and stop event's propagation return function (event) { callback.apply(this, arguments); @@ -102,15 +109,13 @@ app.directive("indeterminate", [ var allSelected = (cacheNoSelectedSubInputNumber === 0); var anySeleted = (cacheSelectedSubInputNumber > 0); setIndeterminateState(allSelected !== anySeleted); // if at least one is selected, but not all then set input property indeterminate to true - setModelValueWithSideEffect(allSelected); + setModelValueWithSideEffect(allSelected); // change binding model value and trigger onchange event }; // is not leaf input, Only receive child change and parent change event - ngModelCtrl.$viewChangeListeners.push(passIfIsLeafChild(function () { - // emit when property indeterminate is set to false, prevent recursively emitting event from parent to children, children to parent - if (!elem.prop("indeterminate")) { - scope.$broadcast("ParentSelectedChange", get()); - } - })); + ngModelCtrl.$viewChangeListeners.push(passIfIsLeafChild(passIfIsIndeterminate(function () { + // emit when input property indeterminate is false, prevent recursively emitting event from parent to children, children to parent + scope.$broadcast("ParentSelectedChange", get()); + }))); // reset input state base on children inputs scope.$on("childSelectedChange", passThroughThisScope(passIfIsLeafChild(updateBaseOnChildrenState))); }