Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/autocomplete input #228

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Move inline styles into css
Zarlex committed Oct 15, 2018
commit ae39984cbdfc3e5b04ad9f7e42c1a124a006da8a
23 changes: 13 additions & 10 deletions src/mw-inputs/directives/templates/mw_autocomplete.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div class="mw-autocomplete"
style="width: 100%">
<div class="mw-autocomplete">
<input type="text"
placeholder="{{getPlaceholder()}}"
ng-disabled="mwDisabled"
@@ -8,7 +7,8 @@
ng-change="fetchSuggestions($event)"
ng-focus="setSearchActive(true)"
ng-blur="setSearchActive(false)">
<div class="auto-complete-text" ng-show="viewModel.searchActive">
<div ng-show="viewModel.searchActive"
class="auto-complete-text">
{{getAutocompleteText()}}
</div>
<div class="selected-item badge badge-light" ng-if="getSelectedModelLabel()">
@@ -17,23 +17,26 @@
class="clickable"
ng-click="unselect()"></span>
</div>
<div class="auto-complete-holder"
ng-show="(mwOptionsCollection.length>0 || viewModel.isSearching) && viewModel.searchActive"
style="max-height: 115px; overflow:scroll">
<div ng-show="(mwOptionsCollection.length>0 || viewModel.isSearching) && viewModel.searchActive"
class="auto-complete-holder">
<ul mw-infinite-scroll collection="mwOptionsCollection" scroll-container-selector=".auto-complete-holder">
<li ng-repeat="model in mwOptionsCollection.models"
class="clickable"
class="search-item clickable"
ng-class="{selected: model.selectable.isSelected()}"
id="{{model.cid}}"
ng-mouseover="tmpSelect(model)"
ng-mousedown="select(model)">
{{getLabel(model)}}
</li>
<li ng-show="viewModel.isSearching" style="display: flex;justify-content: center;">
<li ng-show="viewModel.isSearching"
class="loading-item">
<div mw-spinner></div>
</li>
</ul>
</div>
<input type="hidden" ng-model="viewModel.tmp" ng-required="mwRequired" mw-model="mwModel"
mw-model-attr="{{getModelAttribute()}}">
<input type="hidden"
ng-model="viewModel.tmp"
mw-model="mwModel"
mw-model-attr="{{getModelAttribute()}}"
ng-required="mwRequired">
</div>
7 changes: 7 additions & 0 deletions src/mw-inputs/styles/_mw_autocomplete.scss
Original file line number Diff line number Diff line change
@@ -54,6 +54,8 @@
margin-top: -5px;
border-radius: $border-radius-small;
box-shadow: 0 3px 7px 0 rgba(0, 0, 0, 0.2);
max-height: 115px;
overflow: scroll;

ul {
list-style: none;
@@ -69,6 +71,11 @@
color: white;
}
}

.loading-item {
display: flex;
justify-content: center;
}
}
}
}