chore(format): update to latest formatter

Closes #7958
This commit is contained in:
Alex Eagle
2016-04-07 17:17:50 -07:00
committed by Alex Eagle
parent 83b8f59297
commit 03627aa84d
527 changed files with 13975 additions and 19252 deletions

View File

@ -11,18 +11,18 @@ var TreeComponent = React.createClass({
var left = null;
if (treeNode.left) {
left = React.createElement(
"span", {}, [React.createElement(TreeComponent, {treeNode: treeNode.left}, "")])
'span', {}, [React.createElement(TreeComponent, {treeNode: treeNode.left}, '')])
}
var right = null;
if (treeNode.right) {
right = React.createElement(
"span", {}, [React.createElement(TreeComponent, {treeNode: treeNode.right}, "")])
'span', {}, [React.createElement(TreeComponent, {treeNode: treeNode.right}, '')])
}
var span = React.createElement("span", {}, [" " + treeNode.value, left, right]);
var span = React.createElement('span', {}, [' ' + treeNode.value, left, right]);
return (React.createElement("tree", {}, [span]));
return (React.createElement('tree', {}, [span]));
}
});
@ -34,8 +34,9 @@ export function main() {
bindAction('#createDom', createDom);
var empty = new TreeNode(0, null, null);
var rootComponent = React.render(React.createElement(TreeComponent, {treeNode: empty}, ""),
document.getElementById('rootTree'));
var rootComponent = React.render(
React.createElement(TreeComponent, {treeNode: empty}, ''),
document.getElementById('rootTree'));
function destroyDom() { rootComponent.setProps({treeNode: empty}); }
@ -60,6 +61,7 @@ class TreeNode {
function buildTree(maxDepth, values, curDepth) {
if (maxDepth === curDepth) return new TreeNode('', null, null);
return new TreeNode(values[curDepth], buildTree(maxDepth, values, curDepth + 1),
buildTree(maxDepth, values, curDepth + 1));
return new TreeNode(
values[curDepth], buildTree(maxDepth, values, curDepth + 1),
buildTree(maxDepth, values, curDepth + 1));
}

View File

@ -7,57 +7,57 @@ export function main() {
}
angular.module('app', [])
.directive('tree',
function() {
return {
scope: {data: '='},
template: '<span> {{data.value}}' +
' <span tree-if="data.left"></span>' +
' <span tree-if="data.right"></span>' +
'</span>'
};
})
.directive(
'tree',
function() {
return {
scope: {data: '='},
template: '<span> {{data.value}}' +
' <span tree-if="data.left"></span>' +
' <span tree-if="data.right"></span>' +
'</span>'
};
})
// special directive for "if" as angular 1.3 does not support
// recursive components.
.directive('treeIf',
[
'$compile',
'$parse',
function($compile, $parse) {
var transcludeFn;
return {
compile: function(element, attrs) {
var expr = $parse('!!' + attrs.treeIf);
var template = '<tree data="' + attrs.treeIf + '"></tree>';
var transclude;
return function($scope, $element, $attrs) {
if (!transclude) {
transclude = $compile(template);
}
var childScope;
var childElement;
$scope.$watch(expr, function(newValue) {
if (childScope) {
childScope.$destroy();
childElement.remove();
childScope = null;
childElement = null;
}
if (newValue) {
childScope = $scope.$new();
childElement = transclude(childScope,
function(clone) { $element.append(clone); });
}
});
}
.directive(
'treeIf',
[
'$compile', '$parse',
function($compile, $parse) {
var transcludeFn;
return {
compile: function(element, attrs) {
var expr = $parse('!!' + attrs.treeIf);
var template = '<tree data="' + attrs.treeIf + '"></tree>';
var transclude;
return function($scope, $element, $attrs) {
if (!transclude) {
transclude = $compile(template);
}
var childScope;
var childElement;
$scope.$watch(expr, function(newValue) {
if (childScope) {
childScope.$destroy();
childElement.remove();
childScope = null;
childElement = null;
}
if (newValue) {
childScope = $scope.$new();
childElement =
transclude(childScope, function(clone) { $element.append(clone); });
}
});
}
}
}
}
])
}
}
}
])
.config([
'$compileProvider',
function($compileProvider) { $compileProvider.debugInfoEnabled(false); }
'$compileProvider', function($compileProvider) { $compileProvider.debugInfoEnabled(false); }
])
.run([
'$rootScope',
@ -94,6 +94,7 @@ class TreeNode {
function buildTree(maxDepth, values, curDepth) {
if (maxDepth === curDepth) return new TreeNode('', null, null);
return new TreeNode(values[curDepth], buildTree(maxDepth, values, curDepth + 1),
buildTree(maxDepth, values, curDepth + 1));
return new TreeNode(
values[curDepth], buildTree(maxDepth, values, curDepth + 1),
buildTree(maxDepth, values, curDepth + 1));
}