material_raingular 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca25f62ed20ba508fe00801587895b28329ad328
|
4
|
+
data.tar.gz: 818e8b319126d6f5cb154e5ca04c598db286acc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cf7d64d6dfc4921db568f48de7956fb111c5de8f70d82da582755ac80e5469b9c59b528e00e7e94b26fcf3aea18d4e2cdf9e441b6eead9a2e867a5756c5432d
|
7
|
+
data.tar.gz: c38201d4f38f35a97bda236dea815e03c4b7c76468ccb60540b888bb3a204d515b847c6c388004ea061aa857fa9ecaf908091dd5e9c8809255825ee13d3cf77d
|
@@ -116,9 +116,11 @@ class EventFunctions
|
|
116
116
|
|
117
117
|
inputFunction: (search,typeAhead,event) =>
|
118
118
|
location = search[0].selectionStart
|
119
|
-
if location >
|
119
|
+
if location > (@options.minLength || 4) - 1
|
120
120
|
if @functions.viewValueFn(@filteredList()[0])
|
121
|
-
search.val(
|
121
|
+
search.val(search.val()[0..location - 1])
|
122
|
+
unless [8,46].includes(@keyholder)
|
123
|
+
search.val(@functions.viewValueFn(@filteredList()[0]).replace(/^\s+/g,'')) if search.val().toLowerCase() == @functions.viewValueFn(@filteredList()[0]).replace(/^\s+/g,'')[0..location - 1].toLowerCase()
|
122
124
|
else
|
123
125
|
search.val(search.val()[0..location - 1].replace(/^\s+/g,''))
|
124
126
|
search[0].setSelectionRange(location,location)
|
@@ -140,15 +142,21 @@ class EventFunctions
|
|
140
142
|
template.removeClass('focused')
|
141
143
|
@setTypeAheadScroll(search,typeAhead)
|
142
144
|
if search.val().length < (@options.minLength || 4)
|
143
|
-
|
145
|
+
@updateValue('')
|
144
146
|
else
|
145
|
-
|
146
|
-
|
147
|
-
|
147
|
+
if @functions.isPrimative
|
148
|
+
obj = search.val()
|
149
|
+
else
|
150
|
+
obj={}
|
151
|
+
obj[@functions.viewValue] = search.val()
|
152
|
+
collection = @functions.collection(@scope)
|
153
|
+
if @options.allowNew
|
154
|
+
collection.push(obj) unless collection.includes(obj)
|
155
|
+
val = @filter('filter')(collection, obj, !!@options.allowNew)[0]
|
148
156
|
@updateValue @functions.modelValueFn(val)
|
149
|
-
search.val(@functions.viewValueFn(val).replace(/^\s+/g,''))
|
150
157
|
|
151
158
|
keydownFunction: (search,typeAhead,template,input) =>
|
159
|
+
@keyholder = input.keyCode
|
152
160
|
@setTypeAheadScroll(search,typeAhead)
|
153
161
|
keypress = (direction) ->
|
154
162
|
index = if direction == 'next' then 0 else template.find('a').length - 1
|
@@ -203,6 +211,7 @@ angular.module('FilteredSelect', [])
|
|
203
211
|
.directive 'ngFilteredSelect', ($parse,$filter,$timeout)->
|
204
212
|
require: 'ngModel'
|
205
213
|
link: (scope,element,attrs,ngModel) ->
|
214
|
+
viewOptions = JSON.parse(attrs.filterOptions || '{}')
|
206
215
|
equiv = (left,right) ->
|
207
216
|
return true if left == right
|
208
217
|
return true if (!!left && !!right) == false
|
@@ -220,7 +229,8 @@ angular.module('FilteredSelect', [])
|
|
220
229
|
obj={}
|
221
230
|
obj[functions.viewValue] = elements.search.val()[0..location - 1].replace(/^\s+/g,'') || ''
|
222
231
|
return unless functions.collection(scope)
|
223
|
-
fList = $filter('orderBy')($filter('filter')(functions.collection(scope), obj,bool), functions.viewValue)
|
232
|
+
fList = $filter('orderBy')($filter('filter')(functions.collection(scope), obj,bool), viewOptions.orderBy || functions.viewValue)
|
233
|
+
console.dir fList
|
224
234
|
for filter in options.filters
|
225
235
|
[filterType,value] = filter.replace(/\s+/,'').split(':')
|
226
236
|
fList = $filter(filterType)(fList, value)
|
@@ -243,6 +253,7 @@ angular.module('FilteredSelect', [])
|
|
243
253
|
elements.template.append(li)
|
244
254
|
setInitialValue = ->
|
245
255
|
unless isMobile
|
256
|
+
val = ''
|
246
257
|
if model = scope.$eval(attrs.ngModel)
|
247
258
|
if functions.isPrimative
|
248
259
|
obj = model
|
@@ -251,8 +262,9 @@ angular.module('FilteredSelect', [])
|
|
251
262
|
obj[functions.modelValue] = model
|
252
263
|
list = $filter('filter')(functions.collection(scope), obj,equiv)
|
253
264
|
viewScope = list[0] if list
|
254
|
-
|
255
|
-
|
265
|
+
val = if viewScope then functions.viewValueFn(viewScope).replace(/^\s+/g,'') else ''
|
266
|
+
elements.search.val(val)
|
267
|
+
elements.typeAhead.html(elements.search.val())
|
256
268
|
else
|
257
269
|
unless model = scope.$eval(attrs.ngModel)
|
258
270
|
view = attrs.placeholder
|
@@ -272,7 +284,7 @@ angular.module('FilteredSelect', [])
|
|
272
284
|
|
273
285
|
updateValue = (model) ->
|
274
286
|
scope.$apply ->
|
275
|
-
ngModel.$setViewValue(model)
|
287
|
+
ngModel.$setViewValue(model || '')
|
276
288
|
elements.tempHolder.removeClass('active')
|
277
289
|
setInitialValue()
|
278
290
|
disabled = ->
|
@@ -295,7 +307,6 @@ angular.module('FilteredSelect', [])
|
|
295
307
|
return true if form.disabled
|
296
308
|
return false
|
297
309
|
|
298
|
-
viewOptions = JSON.parse(attrs.filterOptions || '{}')
|
299
310
|
options = new SelectOptions(attrs.ngSelectOptions,element[0].outerHTML)
|
300
311
|
functions = new SelectFunctions(options.match,$parse)
|
301
312
|
eFunctions = new EventFunctions(functions,buildTemplate,updateValue,filteredList,$filter,$timeout,$parse,scope,disabled,viewOptions)
|
@@ -13,7 +13,7 @@ class ElementUpdate
|
|
13
13
|
@timeout = timeout
|
14
14
|
@bindInput() if @isInput
|
15
15
|
@bindElement() unless @isInput
|
16
|
-
@setPlaceholder()
|
16
|
+
@setPlaceholder() if typeof @placeholder == 'undefined'
|
17
17
|
watcher: ->
|
18
18
|
eu = @
|
19
19
|
@scope.$watch @modelVal, (updated,old) ->
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: material_raingular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Moody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|