material_raingular 0.0.4.2.1 → 0.0.4.3

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: 18193f16394298e1cc7af1f636b7ebc986fedc3d
4
- data.tar.gz: b612c444e8029453cec479f5ecb596f66c03c418
3
+ metadata.gz: 8d1099f86d79c7a785d7a04c0ecee5bab2a6b94d
4
+ data.tar.gz: fcfb376bb6e54f7162892dc1295dcf33a43632e6
5
5
  SHA512:
6
- metadata.gz: d41a7c58e35a2e24065e99f69f7b50c013f8c26d591b8e6d9acf8911a6a0470114be4e2ce05e45d7dd26329b314e54d4af89cbcdce5def2e2723e685d7d1d460
7
- data.tar.gz: d193dbae32b24a0612189895c9296aef13e184457157f5a07c25ef4d63f4b7a32b201a320058c11d3512efba964736d995da871e503f5bb33a2c994848075486
6
+ metadata.gz: 47379b9618bfffa903291868cb06d6f857f10c9654f40c0c51e3d9c604e4bb5079ea59a236346f2f76e0b7bd142dbb5da208c2e08ffcbf517e580ff8d9ab3307
7
+ data.tar.gz: 7d50f1205b362df6e66f74c3a7d05894dbb0a71b0722760505282e6259c061f877cec9af0834772637a4c82612492d62b1bc53df91d458bccfca84ca1fabf762
@@ -19,13 +19,17 @@ class SelectOptions
19
19
  "Expected expression in form of " +
20
20
  "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
21
21
  " but got '" + @unparsed + "'. Element: " + @html)
22
+ PrimitiveValueFunction = (s,l,a,i) ->
23
+ return s
24
+
22
25
  class SelectFunctions
23
26
  constructor: (match,parse) ->
24
27
  @collection = parse(match[8])
25
28
  @modelValue = match[1].replace(match[5] + '.','')
26
29
  @viewValue = if match[2] then match[2].replace(match[5] + '.','') else @modelValue
27
- @viewValueFn = parse(@viewValue || @modelValue)
28
- @modelValueFn = parse(@modelValue || @viewValue)
30
+ @modelValueFn = if @modelValue == match[5] then PrimitiveValueFunction else parse(@modelValue || @viewValue)
31
+ @viewValueFn = if @viewValue == match[5] then PrimitiveValueFunction else parse(@viewValue || @modelValue)
32
+ @isPrimative = @viewValue == match[5]
29
33
 
30
34
  class MobileTemplate
31
35
  constructor: (@element,functions) ->
@@ -203,8 +207,11 @@ angular.module('FilteredSelect', [])
203
207
  bool = (left,right) ->
204
208
  !!left.match(new RegExp("^" + right))
205
209
  location = elements.search[0].selectionStart || elements.search.val().length
206
- obj={}
207
- obj[functions.viewValue] = elements.search.val()[0..location - 1].replace(/^\s+/g,'') || ''
210
+ if functions.isPrimative
211
+ obj = elements.search.val()[0..location - 1].replace(/^\s+/g,'') || ''
212
+ else
213
+ obj={}
214
+ obj[functions.viewValue] = elements.search.val()[0..location - 1].replace(/^\s+/g,'') || ''
208
215
  return unless functions.collection(scope)
209
216
  fList = $filter('orderBy')($filter('filter')(functions.collection(scope), obj,bool), functions.viewValue)
210
217
  for filter in options.filters
@@ -221,15 +228,20 @@ angular.module('FilteredSelect', [])
221
228
  li = angular.element '<a class="item">' + functions.viewValueFn(item) + '</a>'
222
229
  ip = angular.element '<input type="hidden">'
223
230
  ip.val(functions.modelValueFn(item))
231
+ ip[0].setAttribute('ng-data-type',typeof functions.modelValueFn(item))
224
232
  li.append(ip)
225
233
  li.bind 'mousedown', ($event)->
226
- updateValue($event.target.children[0].value)
234
+ val = ($event.target.children[0].value)["to_" + $event.target.children[0].getAttribute('ng-data-type')]()
235
+ updateValue(val)
227
236
  elements.template.append(li)
228
237
  setInitialValue = ->
229
238
  unless isMobile
230
239
  if model = scope.$eval(attrs.ngModel)
231
- obj = {}
232
- obj[functions.modelValue] = scope.$eval(attrs.ngModel)
240
+ if functions.isPrimative
241
+ obj = model
242
+ else
243
+ obj = {}
244
+ obj[functions.modelValue] = model
233
245
  list = $filter('filter')(functions.collection(scope), obj,equiv)
234
246
  viewScope = list[0] if list
235
247
  elements.search.val(if viewScope then functions.viewValueFn(viewScope).replace(/^\s+/g,'') else '')
@@ -240,8 +252,11 @@ angular.module('FilteredSelect', [])
240
252
  element.css('color','rgba(0,0,0,0.4)')
241
253
  else
242
254
  element.css('color','')
243
- obj = {}
244
- obj[functions.modelValue] = model
255
+ if functions.isPrimative
256
+ obj = model
257
+ else
258
+ obj = {}
259
+ obj[functions.modelValue] = model
245
260
  list = $filter('filter')(functions.collection(scope), obj,true)
246
261
  viewScope = list[0] if list
247
262
  view = if viewScope then functions.viewValueFn(viewScope) else attrs.placeholder
@@ -61,6 +61,7 @@ angular.module('NgSlide', [])
61
61
  else
62
62
  element.css(margin, start)
63
63
  setHeight = (element) ->
64
+ return if params[2].resize == 'false'
64
65
  rect = element[0].getBoundingClientRect()
65
66
  content = angular.element('.content')[0].getBoundingClientRect()
66
67
  height = rect.height + rect.top - content.top unless params[0] == 'down'
@@ -69,7 +70,7 @@ angular.module('NgSlide', [])
69
70
  scope.$watch params[1], (newValue, oldValue)->
70
71
  if params[2].auto
71
72
  start = calcStart(element[0])
72
- end = 0 + 'px'
73
+ end = params[2].finalMargin || 0 + 'px'
73
74
  if newValue
74
75
  PreviousHeight.set(angular.element('.content')[0].getBoundingClientRect().height)
75
76
  element.css(margin, end)
@@ -79,4 +80,4 @@ angular.module('NgSlide', [])
79
80
  else
80
81
  watcher() if watcher
81
82
  element.css(margin, start)
82
- angular.element('.content').css('height', PreviousHeight.get())
83
+ angular.element('.content').css('height', PreviousHeight.get())
@@ -1,3 +1,9 @@
1
+ String.prototype.to_number = ->
2
+ Number(this)
3
+ String.prototype.to_string = ->
4
+ this.toString()
5
+ String.prototype.to_date = ->
6
+ new Date(this)
1
7
  Array.prototype.empty = ->
2
8
  this.length == 0
3
9
  Array.prototype.present = ->
@@ -39,6 +45,7 @@ Array.prototype.sum = ->
39
45
  Array.prototype.includes = (entry)->
40
46
  this.indexOf(entry) > -1
41
47
  Array.prototype.drop = (entry)->
48
+ return this unless this.indexOf(entry) > -1
42
49
  this.splice(this.indexOf(entry),1)
43
50
  String.prototype.titleize = ->
44
51
  return this.replace(/\_/g,' ').replace(/([A-Z])/g, ' $1').trim().replace(/\b[a-z]/g, (letter)->
@@ -1,3 +1,3 @@
1
1
  module MaterialRaingular
2
- VERSION = "0.0.4.2.1"
2
+ VERSION = "0.0.4.3"
3
3
  end
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.0.4.2.1
4
+ version: 0.0.4.3
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-02-15 00:00:00.000000000 Z
11
+ date: 2016-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler