material_raingular 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5758cbbb60a81e13a8f9ee724676bbb1daf1351
4
- data.tar.gz: 003e3ccf07f0befbddd525fba209cd0cfaab8601
3
+ metadata.gz: f66bf16eb66fabb42468ea92f44cb92f85359534
4
+ data.tar.gz: 684e58c7df7473f04b3afcec0a33fb25b9c61689
5
5
  SHA512:
6
- metadata.gz: 5e7bc01cb048abdb22363ba8d000f6d9a864bf7bdf9169c525b1b9a5f7d213452f191993d5e5bea15d1c7136173058dfc3f62c7507aa4976ec787a458c4c7bb2
7
- data.tar.gz: ff49fc825f94c229299489eab7d898233515121061e39d7b6129ae2391f2cb66ff6d34d84ccf4d288ebf32f45154e0edd562c8ab9bc10a1c5abb789b700184fd
6
+ metadata.gz: 6f4c6cc6b92dc6d2fce3e22e32c031f0b4207a5b2dc548231deda26a2786c4c4f841d61745876e7ce473677fb07144b86be5b2d6f44bc05af537dcfea59f09fa
7
+ data.tar.gz: fe0a299756ac4b72a5f325f5d1a0d1f05fc307356469fb635f03ad3ed244bbfb4948192d90411f3473e0b2b6ee74c8af6b73f090286e0bf03b16f20992ce5ee7
@@ -154,7 +154,7 @@ class EventFunctions
154
154
  collection = @functions.collection(@scope)
155
155
  if @options.allowNew
156
156
  collection.push(obj) unless collection.includes(obj)
157
- val = @filter('filter')(collection, obj, !!@options.allowNew)[0]
157
+ val = @filteredList(true,false,@options.allowNew)[0]
158
158
  @updateValue @functions.modelValueFn(val)
159
159
 
160
160
  keydownFunction: (search,typeAhead,template,input) =>
@@ -220,16 +220,21 @@ angular.module('FilteredSelect', [])
220
220
  if !isNaN(left) && !isNaN(right)
221
221
  return true if parseFloat(left) == parseFloat(right)
222
222
  false
223
- filteredList = (bool)->
223
+ filteredList = (bool,model,exact)->
224
224
  if bool
225
225
  bool = (left,right) ->
226
226
  !!left.match(new RegExp("^" + right))
227
+ if exact
228
+ bool = (left,right) -> left == right
227
229
  location = elements.search[0].selectionStart || elements.search.val().length
228
230
  if functions.isPrimative
229
- obj = elements.search.val()[0..location - 1].replace(/^\s+/g,'') || ''
231
+ obj = if model then scope.$eval(attrs.ngModel) else elements.search.val()[0..location - 1].replace(/^\s+/g,'') || ''
230
232
  else
231
233
  obj={}
232
- obj[functions.viewValue] = elements.search.val()[0..location - 1].replace(/^\s+/g,'') || ''
234
+ if model
235
+ obj[functions.modelValue] = scope.$eval(attrs.ngModel)
236
+ else
237
+ obj[functions.viewValue] = elements.search.val()[0..location - 1].replace(/^\s+/g,'') || ''
233
238
  return unless functions.collection(scope)
234
239
  fList = $filter('orderBy')($filter('filter')(functions.collection(scope), obj,bool), viewOptions.orderBy || functions.viewValue)
235
240
  for filter in options.filters
@@ -248,21 +253,16 @@ angular.module('FilteredSelect', [])
248
253
  ip.val(functions.modelValueFn(item))
249
254
  ip[0].setAttribute('ng-data-type',typeof functions.modelValueFn(item))
250
255
  li.append(ip)
251
- li.bind 'mousedown', ($event)->
256
+ li.bind 'mousedown', ($event)=>
252
257
  val = ($event.target.children[0].value)["to_" + $event.target.children[0].getAttribute('ng-data-type')]()
258
+ @clickedVal = val
253
259
  updateValue(val)
254
260
  elements.template.append(li)
255
261
  setInitialValue = ->
256
262
  unless isMobile
257
263
  val = ''
258
264
  if model = scope.$eval(attrs.ngModel)
259
- if functions.isPrimative
260
- obj = model
261
- else
262
- obj = {}
263
- obj[functions.modelValue] = model
264
- list = $filter('filter')(functions.collection(scope), obj,equiv)
265
- viewScope = list[0] if list
265
+ viewScope = filteredList(true,true,true)[0]
266
266
  val = if viewScope then (functions.altValue(viewScope) || functions.viewValueFn(viewScope)).replace(/^\s+/g,'') else ''
267
267
  elements.search.val(val)
268
268
  elements.typeAhead.html(elements.search.val())
@@ -284,6 +284,10 @@ angular.module('FilteredSelect', [])
284
284
  element.html(view)
285
285
 
286
286
  updateValue = (model) ->
287
+ return if @clickedVal && @clickedVal != model
288
+ $timeout ->
289
+ delete @clickedVal
290
+ , 300
287
291
  scope.$apply ->
288
292
  ngModel.$setViewValue(model || '')
289
293
  elements.tempHolder.removeClass('active')
@@ -1,3 +1,3 @@
1
1
  module MaterialRaingular
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material_raingular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Moody
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.4.3
147
+ rubygems_version: 2.5.1
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Angular v1.4 for rails. Angular Material v0.9.8.