Skip to content

Commit 1577699

Browse files
authored
Refactor Timelion expression suggestion logic for clarity. (#11285) (#11597)
* Refactor Timelion expression suggestion logic for clarity. - Create timelionExpressionInput directive. - Create timelionExpressionSuggestions directive. - Create expression_directive_helpers service.
1 parent 0a63610 commit 1577699

File tree

9 files changed

+336
-216
lines changed

9 files changed

+336
-216
lines changed

src/core_plugins/timelion/public/app.less

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424
}
2525
}
2626

27+
/**
28+
* 1. Needs to be relative to contain absolutely-positioned typeahead suggestions.
29+
*/
30+
.timelionLocalSearch {
31+
position: relative; /* 1 */
32+
}
33+
34+
.timelionSearchInputContainer {
35+
flex: 1 1 auto;
36+
display: flex;
37+
}
38+
2739
.timelion-container {
2840
margin: 20px;
2941
}
@@ -38,10 +50,6 @@
3850
background-color: @gray-lighter;
3951
}
4052

41-
.timelion-expression {
42-
position: relative !important;
43-
}
44-
4553
.timelion-subnav {
4654
background-color: @gray-lighter;
4755
margin: 0px
@@ -88,33 +96,17 @@
8896
opacity: 0.50;
8997
}
9098

91-
.timelion-interval {
92-
width: 70px !important;
93-
height: auto;
94-
-webkit-appearance: none;
95-
-moz-appearance: none;
96-
padding: .5em;
97-
padding-right: 1.5em;
98-
line-height: 1;
99-
border-top: 0;
100-
border-right: 0;
101-
border-bottom: 0;
102-
border-radius: 0;
103-
text-align: center;
104-
105-
&:focus {
106-
border-color: #ecf0f1;
107-
}
99+
.timelion-interval-custom {
100+
width: 60px;
108101
}
109102

110-
.timelion-interval--select {
111-
background-position: right 50%;
112-
background-repeat: no-repeat;
113-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ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QSdykiKJrBGpOhgJFYTWNEIiEeAAAMAzNENEOH+do8AAAAASUVORK5CYII=);
103+
.timelion-interval-presets {
104+
width: 90px;
114105
}
115106

116-
.timelion-interval-other {
117-
width: 10px !important;
107+
.timelion-interval-presets-compact {
108+
width: 10px;
109+
padding-left: 0;
118110
}
119111

120112
timelion-interval {
@@ -214,10 +206,3 @@ timelion-interval {
214206
margin-right: 5px;
215207
font-weight: bold;
216208
}
217-
218-
/**
219-
* 1. Needs to be relative to contain absolutely-positioned typeahead suggestions.
220-
*/
221-
.timelionLocalSearch {
222-
position: relative; /* 1 */
223-
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<div class="timelionSearchInputContainer">
2+
<input
3+
id="timelionSearchInput"
4+
input-focus
5+
ng-model="sheet"
6+
timelion-expression="{{sheet}}"
7+
placeholder="Expression..."
8+
aria-label="Expression input"
9+
type="text"
10+
class="kuiLocalSearchInput"
11+
ng-keyup="keyUpHandler($event)"
12+
ng-keydown="keyDownHandler($event)"
13+
ng-mouseup="mouseUpHandler()"
14+
ng-blur="blurHandler()"
15+
>
16+
17+
<timelion-expression-suggestions
18+
ng-show="functionSuggestions.isVisible"
19+
suggestions="functionSuggestions.list"
20+
selected-index="functionSuggestions.index"
21+
on-click-suggestion="suggestionClickHandler"
22+
></timelion-expression-suggestions>
23+
</div>

0 commit comments

Comments
 (0)