Skip to content
This repository was archived by the owner on Oct 11, 2018. It is now read-only.

Commit 6064dec

Browse files
joshuarulepchaussalet
authored andcommitted
Treeview component cleanup
Adds disabled setting to treeview and field-treeview, switches target button to blue-shark
1 parent 2dc4c48 commit 6064dec

File tree

7 files changed

+54
-31
lines changed

7 files changed

+54
-31
lines changed

ui/controls/field-treeview.info/sample/ui/main.reel/main.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
},
1616
"icons": {
17-
"prototype": "gui/ui/icons.reel",
17+
"prototype": "blue-shark/ui/icons.reel",
1818
"properties": {
1919
"element": {"#": "icons"}
2020
}
@@ -24,6 +24,8 @@
2424
"properties": {
2525
"element": {"#": "default"},
2626
"label": "test",
27+
"disabled": false,
28+
"readOnly": false,
2729
"currentNode": {
2830
"name": "parentNode",
2931
"path": "/parentNode"

ui/controls/field-treeview.reel/_field-treeview.css

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,42 @@
11
.FieldTreeview {}
22

3-
.FieldTreeview-pathButton {
3+
.FieldTreeview-pathButton[role="button"] {
44
position: relative;
55
display: flex;
66
align-items: center;
7+
font-size: 1em;
78
line-height: 2em;
89
height: 2em;
910
padding: 0 .5em;
10-
border: 1px solid currentColor;
11-
border-radius: 4px;
12-
cursor: pointer;
13-
outline: none;
14-
background-color: #242628;
15-
transition-property: color, background-color;
11+
background-image: none;
12+
text-align: left;
13+
width: 100%;
14+
transition-property: color, background-color, opacity;
1615
transition-timing-function: ease-in-out;
1716
transition-duration: .25s;
18-
}
1917

20-
.FieldTreeview-pathButton:hover {
21-
color: #DFE4E4;
22-
background: #2F3233;
23-
}
18+
&:hover:not(.montage--disabled) {
19+
color: #fff;
20+
background: #7c7c7c;
21+
}
2422

23+
&:active:not(.montage--disabled) {
24+
color: #fff;
25+
background: #7c7c7c;
26+
background-image: none;
27+
}
28+
}
2529

2630
.FieldTreeview-icon {
2731
display: flex;
2832
align-items: center;
2933

34+
/* button overrides */
35+
margin-top: 0 !important;
36+
margin-right: 0 !important;
37+
max-height: none !important;
38+
max-width: none !important;
39+
3040
& svg {
3141
position: relative;
3242
z-index: 200;
@@ -37,32 +47,35 @@
3747
}
3848
}
3949

40-
4150
.FieldTreeview-treeView {
4251
position: absolute;
4352
visibility: hidden;
4453
}
4554

46-
.FieldTreeview.isExpanded .FieldTreeview-treeView {
55+
.FieldTreeview.is-expanded .FieldTreeview-treeView {
4756
position: relative;
4857
visibility: visible;
4958
margin-bottom: 1em;
5059
}
5160

52-
.FieldTreeview.isExpanded .FieldTreeview-pathButton {
53-
visibility: hidden;
54-
}
61+
/* selected path */
5562

56-
.FieldTreeview-selectedPath {
63+
.FieldTreeview .FieldTreeview-selectedPath {
5764
position: absolute;
5865
left: 1.5em;
5966
right: .5em;
60-
top: 0;
61-
bottom: 0;
67+
height: calc(2em - 2px);
68+
line-height: calc(2em - 2px);
6269
white-space: nowrap;
6370
overflow: hidden;
6471
text-overflow: clip;
6572
background-color: inherit;
73+
74+
/* button overrides */
75+
margin-top: 0 !important;
76+
margin-right: 0 !important;
77+
max-height: none !important;
78+
max-width: none !important;
6679
}
6780

6881
.FieldTreeview-selectedPath:before {

ui/controls/field-treeview.reel/field-treeview.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/controls/field-treeview.reel/field-treeview.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"element": {"#": "owner"}
1111
},
1212
"bindings": {
13-
"classList.has('isExpanded')": {"<-": "@owner.isExpanded"}
13+
"classList.has('is-expanded')": {"<-": "@owner.isExpanded"}
1414
}
1515
},
1616
"field": {
@@ -25,12 +25,12 @@
2525
}
2626
},
2727
"pathButton": {
28-
"prototype": "montage/ui/button.reel",
28+
"prototype": "blue-shark/ui/button.reel",
2929
"properties": {
3030
"element": {"#": "pathButton"}
3131
},
3232
"bindings": {
33-
"disabled": {"<-": "@owner.readOnly"}
33+
"disabled": {"<-": "@owner.disabled || @owner.readOnly"}
3434
}
3535
},
3636
"selectedPath": {
@@ -52,7 +52,8 @@
5252
"isExpanded": {"<->": "@owner.isExpanded"},
5353
"selectedPath": {"<->": "@owner.selectedPath"},
5454
"suffix": {"<-": "@owner.suffix"},
55-
"removePrefix": {"<-": "@owner.removePrefix || ''"}
55+
"removePrefix": {"<-": "@owner.removePrefix || ''"},
56+
"disabled": {"<-": "@owner.disabled"}
5657
}
5758
},
5859
"iconSubstitution": {
@@ -70,14 +71,15 @@
7071
<body>
7172
<div data-montage-id="owner" class="FieldTreeview">
7273
<div data-montage-id="field">
73-
<div data-montage-id="pathButton" class="FieldTreeview-pathButton">
74+
<div data-montage-id="pathButton" class="FieldTreeview-pathButton" tabindex="0">
7475
<div class="FieldTreeview-selectedPath">
7576
<span data-montage-id="selectedPath"></span>
7677
</div>
7778
<div data-montage-id="iconSubstitution" class="FieldTreeview-icon">
7879
<svg data-arg="FILE"><use xlink:href="#i-file"/></svg>
7980
<svg data-arg="DATASET"><use xlink:href="#i-dataset"/></svg>
8081
<svg data-arg="DIRECTORY"><use xlink:href="#i-folder"/></svg>
82+
<svg data-arg="ZVOL"><use xlink:href="#i-zvol"/></svg>
8183
</div>
8284
</div>
8385
</div>

ui/controls/tree-view.reel/_tree-view.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
border: 1px solid #000;
33
border-radius: 4px;
44
background-color: #242628;
5+
transition: opacity .25s ease-in-out;
6+
7+
&.is-disabled {
8+
opacity: .5;
9+
pointer-events: none;
10+
}
511
}
612

713
.TreeView-header {

ui/controls/tree-view.reel/tree-view.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/controls/tree-view.reel/tree-view.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"bindings": {
1414
"entry": {"<-": "@owner.controller.entry"},
1515
"type": {"<-": "@owner.controller.type"},
16-
"isPathInvalid": {"<-": "@owner.controller.isPathInvalid"}
16+
"isPathInvalid": {"<-": "@owner.controller.isPathInvalid"},
17+
"classList.has('is-disabled')": {"<-": "@owner.disabled"}
1718
}
1819
},
1920
"currentPath": {
2021
"prototype": "blue-shark/ui/text-field.reel",
2122
"properties": {
22-
"element": {"#": "currentPath"},
23-
"enabled": false
23+
"element": {"#": "currentPath"}
2424
},
2525
"bindings": {
2626
"value": {"<-": "(@owner.entry.path + ([email protected] ? '/' + @owner.suffix : '')).replace(([email protected] ? @owner.removePrefix: ''), '')"}

0 commit comments

Comments
 (0)