Commit e85caa82 authored by Xavier Guimard's avatar Xavier Guimard

Update javascripts

git-svn-id: svn://svn.forge.objectweb.org/svnroot/lemonldap/branches/lemonldap-ng_version_1_9-bugfixes@6681 1dbb9719-a921-0410-b57f-c3a383c2c641
parent c1f6a358
......@@ -192,7 +192,7 @@ MANAGERJSONDST=$(SRCMANAGERDIR)/site/static/struct.json \
# Javascript and CSS to minify
JSSRCFILES:=$(shell find $(SRCMANAGERDIR)/site/static/js $(SRCPORTALDIR)/example -type f -name '*.js' ! -name '*.min.js') \
$(SRCMANAGERDIR)/site/static/bwr/file-saver.js/FileSaver.js
CSSSRCFILES:=$(shell find $(SRCMANAGERDIR)/site/static/css $(SRCPORTALDIR)/example -type f -name '*.css' ! -name '*.min.css')
CSSSRCFILES:=$(shell find $(SRCMANAGERDIR)/site/static $(SRCPORTALDIR)/example -type f -name '*.css' ! -name '*.min.css')
# Minified files
JSDSTFILES=$(JSSRCFILES:.js=.min.js)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* @license Angular UI Tree v2.22.2
* (c) 2010-2016. https://github.com/angular-ui-tree/angular-ui-tree
* @license Angular UI Tree v2.22.6
* (c) 2010-2017. https://github.com/angular-ui-tree/angular-ui-tree
* License: MIT
*/
(function () {
......@@ -10,6 +10,7 @@
.constant('treeConfig', {
treeClass: 'angular-ui-tree',
emptyTreeClass: 'angular-ui-tree-empty',
dropzoneClass: 'angular-ui-tree-dropzone',
hiddenClass: 'angular-ui-tree-hidden',
nodesClass: 'angular-ui-tree-nodes',
nodeClass: 'angular-ui-tree-node',
......@@ -197,8 +198,8 @@
angular.module('ui.tree')
.controller('TreeNodesController', ['$scope', '$element',
function ($scope, $element) {
.controller('TreeNodesController', ['$scope', '$element', '$timeout',
function ($scope, $element, $timeout) {
this.scope = $scope;
$scope.$element = $element;
......@@ -242,22 +243,11 @@
return $scope.$modelValue.length > 0;
};
$scope.safeApply = function (fn) {
var phase = this.$root.$$phase;
if (phase == '$apply' || phase == '$digest') {
if (fn && (typeof (fn) === 'function')) {
fn();
}
} else {
this.$apply(fn);
}
};
//Called in apply method of UiTreeHelper.dragInfo.
$scope.removeNode = function (node) {
var index = $scope.$modelValue.indexOf(node.$modelValue);
if (index > -1) {
$scope.safeApply(function () {
$timeout(function () {
$scope.$modelValue.splice(index, 1)[0];
});
return $scope.$treeScope.$callbacks.removed(node);
......@@ -267,7 +257,7 @@
//Called in apply method of UiTreeHelper.dragInfo.
$scope.insertNode = function (index, nodeData) {
$scope.safeApply(function () {
$timeout(function () {
$scope.$modelValue.splice(index, 0, nodeData);
});
};
......@@ -315,6 +305,7 @@
$scope.$nodesScope = null; // root nodes
$scope.$type = 'uiTree';
$scope.$emptyElm = null;
$scope.$dropzoneElm = null;
$scope.$callbacks = null;
$scope.dragEnabled = true;
......@@ -323,6 +314,7 @@
$scope.dragDelay = 0;
$scope.cloneEnabled = false;
$scope.nodropEnabled = false;
$scope.dropzoneEnabled = false;
// Check if it's a empty tree
$scope.isEmpty = function () {
......@@ -345,7 +337,17 @@
}
};
this.resetDropzoneElement = function () {
if ((!$scope.$nodesScope.$modelValue || $scope.$nodesScope.$modelValue.length !== 0) &&
$scope.dropzoneEnabled) {
$element.append($scope.$dropzoneElm);
} else {
$scope.$dropzoneElm.remove();
}
};
$scope.resetEmptyElement = this.resetEmptyElement;
$scope.resetDropzoneElement = this.resetDropzoneElement;
}
]);
})();
......@@ -396,11 +398,15 @@
scope.$emptyElm.append(tdElm);
} else {
scope.$emptyElm = angular.element($window.document.createElement('div'));
scope.$dropzoneElm = angular.element($window.document.createElement('div'));
}
if (config.emptyTreeClass) {
scope.$emptyElm.addClass(config.emptyTreeClass);
}
if (config.dropzoneClass) {
scope.$dropzoneElm.addClass(config.dropzoneClass);
}
scope.$watch('$nodesScope.$modelValue.length', function (val) {
if (!angular.isNumber(val)) {
......@@ -408,6 +414,7 @@
}
ctrl.resetEmptyElement();
ctrl.resetDropzoneElement();
}, true);
scope.$watch(attrs.dragEnabled, function (val) {
......@@ -429,6 +436,13 @@
}
});
scope.$watch(attrs.dropzoneEnabled, function (val) {
if ((typeof val) == 'boolean') {
scope.dropzoneEnabled = val;
ctrl.resetDropzoneElement();
}
});
scope.$watch(attrs.cloneEnabled, function (val) {
if ((typeof val) == 'boolean') {
scope.cloneEnabled = val;
......@@ -756,6 +770,7 @@
//Check if it or it's parents has a 'data-nodrag' attribute
el = angular.element(e.target);
isUiTreeRoot = el[0].attributes['ui-tree'];
while (el && el[0] && el[0] !== element && !isUiTreeRoot) {
//Checking that I can access attributes.
......@@ -822,7 +837,7 @@
//Getting starting position of element being moved.
pos = UiTreeHelper.positionStarted(eventObj, element);
placeElm.css('height', UiTreeHelper.height(element) + 'px');
placeElm.css('height', element.prop('offsetHeight') + 'px');
//Creating drag element to represent node.
dragElm = angular.element($window.document.createElement(scope.$parentNodesScope.$element.prop('tagName')))
......@@ -901,7 +916,8 @@
targetBeforeBuffer,
targetHeight,
targetChildElm,
targetChildHeight;
targetChildHeight,
isDropzone;
//If check ensures that drag element was created.
if (dragElm) {
......@@ -1039,6 +1055,9 @@
targetNode = targetElm.controller('uiTreeNodes').scope;
} else if (UiTreeHelper.elementIsPlaceholder(targetElm)) {
targetNode = targetElm.controller('uiTreeNodes').scope;
} else if (UiTreeHelper.elementIsDropzone(targetElm)) {
targetNode = targetElm.controller('uiTree').scope;
isDropzone = true;
} else if (targetElm.controller('uiTreeNode')) {
//Is a child element of a node.
targetNode = targetElm.controller('uiTreeNode').scope;
......@@ -1105,8 +1124,8 @@
targetNode = targetNode.$nodeScope;
}
//Check if it is a uiTreeNode or it's an empty tree.
if (targetNode.$type !== 'uiTreeNode' && !isEmpty) {
//Check if it is a uiTreeNode or it's an empty tree or it's a dropzone.
if (targetNode.$type !== 'uiTreeNode' && !isEmpty && !isDropzone) {
// Allow node to return to its original position if no longer hovering over target
if (config.appendChildOnHover) {
......@@ -1124,6 +1143,7 @@
//If placeholder move from empty tree, reset it.
if (treeScope && placeElm.parent()[0] != treeScope.$element[0]) {
treeScope.resetEmptyElement();
treeScope.resetDropzoneElement();
treeScope = null;
}
......@@ -1131,9 +1151,14 @@
if (isEmpty) {
treeScope = targetNode;
if (targetNode.$nodesScope.accept(scope, 0)) {
targetNode.place(placeElm);
dragInfo.moveTo(targetNode.$nodesScope, targetNode.$nodesScope.childNodes(), 0);
}
//It's a dropzone
} else if (isDropzone) {
treeScope = targetNode;
if (targetNode.$nodesScope.accept(scope, targetNode.$nodesScope.childNodes().length)) {
dragInfo.moveTo(targetNode.$nodesScope, targetNode.$nodesScope.childNodes(), targetNode.$nodesScope.childNodes().length);
}
//Not empty and drag enabled.
} else if (targetNode.dragEnabled()) {
......@@ -1150,6 +1175,7 @@
if (targetNode.collapsed) {
if (scope.expandOnHover === true || (angular.isNumber(scope.expandOnHover) && scope.expandOnHover === 0)) {
targetNode.collapsed = false;
targetNode.$treeScope.$callbacks.toggle(false, targetNode);
} else if (scope.expandOnHover !== false && angular.isNumber(scope.expandOnHover) && scope.expandOnHover > 0) {
//Triggering expansion.
......@@ -1161,6 +1187,7 @@
{
scope.$callbacks.expandTimeoutEnd();
targetNode.collapsed = false;
targetNode.$treeScope.$callbacks.toggle(false, targetNode);
}, scope.expandOnHover);
}
}
......@@ -1362,6 +1389,7 @@
}
]);
})();
(function () {
'use strict';
......@@ -1787,6 +1815,9 @@
elementIsPlaceholder: function (element) {
return element.hasClass(treeConfig.placeholderClass);
},
elementIsDropzone: function (element) {
return element.hasClass(treeConfig.dropzoneClass);
},
elementContainsTreeNodeHandler: function (element) {
return element[0].querySelectorAll('[ui-tree-handle]').length >= 1;
},
......
.angular-ui-tree-empty{border:1px dashed #bbb;min-height:100px;background-color:#e5e5e5;background-image:-webkit-linear-gradient(45deg,#fff 25%,transparent 0,transparent 75%,#fff 0,#fff),-webkit-linear-gradient(45deg,#fff 25%,transparent 0,transparent 75%,#fff 0,#fff);background-image:linear-gradient(45deg,#fff 25%,transparent 0,transparent 75%,#fff 0,#fff),linear-gradient(45deg,#fff 25%,transparent 0,transparent 75%,#fff 0,#fff);background-size:60px 60px;background-position:0 0,30px 30px;pointer-events:none}.angular-ui-tree-nodes{position:relative;margin:0;padding:0;list-style:none}.angular-ui-tree-nodes .angular-ui-tree-nodes{padding-left:20px}.angular-ui-tree-node,.angular-ui-tree-placeholder{position:relative;margin:0;padding:0;min-height:20px;line-height:20px}.angular-ui-tree-hidden{display:none}.angular-ui-tree-placeholder{margin:5px 0;padding:0;min-height:30px}.angular-ui-tree-handle{cursor:move;text-decoration:none;font-weight:700;box-sizing:border-box;min-height:20px;line-height:20px}.angular-ui-tree-drag{position:absolute;pointer-events:none;z-index:999;opacity:.8}
\ No newline at end of file
.angular-ui-tree-dropzone,.angular-ui-tree-empty{border:1px dashed #bbb;min-height:100px;background-color:#e5e5e5;background-image:-webkit-linear-gradient(45deg,#fff 25%,transparent 0,transparent 75%,#fff 0,#fff),-webkit-linear-gradient(45deg,#fff 25%,transparent 0,transparent 75%,#fff 0,#fff);background-image:linear-gradient(45deg,#fff 25%,transparent 0,transparent 75%,#fff 0,#fff),linear-gradient(45deg,#fff 25%,transparent 0,transparent 75%,#fff 0,#fff);background-size:60px 60px;background-position:0 0,30px 30px}.angular-ui-tree-empty{pointer-events:none}.angular-ui-tree-nodes{position:relative;margin:0;padding:0;list-style:none}.angular-ui-tree-nodes .angular-ui-tree-nodes{padding-left:20px}.angular-ui-tree-node,.angular-ui-tree-placeholder{position:relative;margin:0;padding:0;min-height:20px;line-height:20px}.angular-ui-tree-hidden{display:none}.angular-ui-tree-placeholder{margin:10px;padding:0;min-height:30px}.angular-ui-tree-handle{cursor:move;text-decoration:none;font-weight:700;box-sizing:border-box;min-height:20px;line-height:20px}.angular-ui-tree-drag{position:absolute;pointer-events:none;z-index:999;opacity:.8}.angular-ui-tree-drag .tree-node-content{margin-top:0}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment