Skip to content

Commit 338542e

Browse files
Ben RubinBen Rubin
authored andcommitted
remove unused branchTemplate Directive (may implement later)
Fix filter close method so it does not break searching fix layout for rows without checkbox or arrow add hide-checkbox attribute add color highlighting when no checkbox
1 parent 2be9a93 commit 338542e

File tree

5 files changed

+26
-33
lines changed

5 files changed

+26
-33
lines changed

src/js/branch.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ function branchDirective($parse, $document, $mdUtil, $filter, $$mdTree, $mdConst
2727

2828
return {
2929
restrict: 'E',
30-
require: ['?^mdBranchTemplates'],
3130
priority: 1000,
3231
terminal: true,
3332
transclude: 'element',
@@ -57,6 +56,7 @@ function branchDirective($parse, $document, $mdUtil, $filter, $$mdTree, $mdConst
5756
if (isOpen) { startWatching(); }
5857

5958
// standard angular filter wrapped so we can determian if the parent should be opened for closed
59+
var filters = {};
6060
scope.$mdBranchFilter = function (value) {
6161
var filtered = $filter('filter')(value);
6262

@@ -190,12 +190,17 @@ function branchDirective($parse, $document, $mdUtil, $filter, $$mdTree, $mdConst
190190
// this is only done once
191191
function updateNewBlock(block) {
192192
var isSelectable = block.element.attr('select') !== undefined;
193+
var hideCheckbox = block.element.attr('hide-checkbox') !== undefined;
193194
var innerContainer = angular.element('<div class="md-branch-inner">'); // branch contents
194195
var branchContainer = angular.element('<div class="md-branch-container">'); // nested branched
195-
innerContainer.append(BRANCH_ARROW_TEMPLATE.clone());
196+
196197
if (isSelectable) {
197-
block.element.addClass('md-checkbox-enabled');
198-
innerContainer.append(CHECKBOX_SELECTION_INDICATOR.clone());
198+
if (!hideCheckbox) {
199+
block.element.addClass('md-checkbox-enabled');
200+
innerContainer.append(CHECKBOX_SELECTION_INDICATOR.clone());
201+
} else {
202+
block.element.addClass('md-select-highlight-enabled');
203+
}
199204
}
200205
Array.prototype.slice.call(block.element[0].childNodes).forEach(function (node) {
201206
if (node.nodeType === 8 && node.nodeValue.trim() === 'mdBranch:') {
@@ -208,11 +213,12 @@ function branchDirective($parse, $document, $mdUtil, $filter, $$mdTree, $mdConst
208213

209214
// add branches
210215
if (branchContainer[0].childNodes.length) {
216+
innerContainer.prepend(BRANCH_ARROW_TEMPLATE.clone());
211217
block.element.append(branchContainer);
212218

213219
// if no more branches then mark as tip
214220
} else {
215-
block.element.addClass('md-tip');
221+
block.element.addClass('md-tip no-arrow');
216222
}
217223
}
218224

src/js/branchTemplates.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/js/service.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,12 @@ function treeService($mdUtil, $animateCss) {
117117
// close branch for filtering
118118
// No animations
119119
function filterClose(block) {
120-
$mdUtil.disconnectScope(block.scope);
120+
// do not disconnect top layer scopes or watchers
121+
if (block.scope.$depth > 0) {
122+
$mdUtil.disconnectScope(block.scope);
123+
block.scope.killWatching();
124+
}
121125
block.scope.isOpen = false;
122-
block.scope.killWatching();
123126
block.element.removeClass('md-open');
124127
var container = angular.element(block.element[0].querySelector('.md-branch-container'));
125128
container.css('max-height', '');

src/style-theme.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ md-branch.md-THEME_NAME-theme {
1919
}
2020
}
2121

22-
2322
&.md-checkbox-enabled {
2423
.checkbox-icon {
2524
border-color: '{{foreground-2}}';
@@ -56,7 +55,12 @@ md-branch.md-THEME_NAME-theme {
5655

5756
& >.md-branch-inner {
5857
background-color: '{{background-100}}';
59-
// border-color: '{{primary-color-0.36}}';
58+
}
59+
}
60+
61+
&.md-select-highlight-enabled[selected] {
62+
& >.md-branch-inner {
63+
background-color: '{{primary-color-0.12}}';
6064
}
6165
}
6266
}

src/style.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ md-tree {
1515
display: flex;
1616
flex-direction: column;
1717
min-height: 72px;
18-
width: 60px;
18+
width: 52px;
19+
margin-left: -16px;
1920
justify-content: center;
2021

2122
.md-branch-icon {
@@ -45,7 +46,7 @@ md-branch {
4546
display: block;
4647

4748
.md-branch-inner {
48-
// Layout [flex layout-align='start center']
49+
padding-left: 16px;
4950
display: flex;
5051
justify-content: flex-start;
5152
align-items: center;
@@ -164,7 +165,7 @@ md-branch {
164165
font-size: 14px;
165166
letter-spacing: 0.010em;
166167
margin: 3px 0 1px;
167-
font-weight: 400;
168+
font-weight: 500;
168169
line-height: 1.2em;
169170
overflow: hidden;
170171
white-space: nowrap;

0 commit comments

Comments
 (0)