tgios 0.0.29 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/lib/tgios/animatable_view.rb +4 -4
- data/lib/tgios/images_collection_view_binding.rb +1 -1
- data/lib/tgios/search_controller.rb +10 -3
- data/lib/tgios/ui_picker_view_list_binding.rb +2 -1
- data/lib/tgios/ui_table_view_model_list_binding.rb +11 -3
- data/lib/tgios/ui_table_view_utility_binding.rb +6 -4
- data/lib/tgios/ui_text_field_binding.rb +19 -14
- data/lib/tgios/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTAzMDBiY2EyMjc5ZTI5ZDVkNzgwMWRlNDE5MTU1YzgwNGQ4ZDE1Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2EyODYxMjJkMDAyYmU4ZjJhNjYwZjE5YWJmYzI3NTg0YWExOGY3MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzBlNGViMDMwMTY5NzRiM2JjYjNjZjY5NDYxYzllZWI3ZjZmMzM3NWMxZjRh
|
10
|
+
ZGE0MTNlNDI2YWUyOWY1MjNlNzk0NDJlNzQxNjI2NWVmNmFkOTcyODRlZDgy
|
11
|
+
ZjBkOGM0MGI0NjNkODgyZDFkNGE0OTliNWJlMGIwMmNmYTgwNDE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDVhMGU3ZDVjMGM3NTI3OWZhNzQ5ODNmZDdlM2IzNDgxOGU2N2ZhZmUyZWI4
|
14
|
+
N2YzNDBkY2IxMWIxMjAwZjQ2ZGRlOTZkNzhiNzgwMjRjMjAwODhlZjMwNWFm
|
15
|
+
MjdmNTIwZTBlN2MzNDZmODc4ZDI5YTY3YWIyZDYzMzJjNDU2M2M=
|
data/Gemfile.lock
CHANGED
@@ -16,18 +16,18 @@ module Tgios
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def show_animated
|
19
|
+
new_frame = self.frame
|
20
|
+
new_frame.origin.y = self.superview.frame.size.height - self.bounds.size.height
|
19
21
|
@show_notification ||= NSNotification.notificationWithName(
|
20
22
|
UIKeyboardWillShowNotification,
|
21
23
|
object: self,
|
22
|
-
userInfo:{UIKeyboardFrameEndUserInfoKey=> NSValue.valueWithCGRect(self.
|
24
|
+
userInfo:{UIKeyboardFrameEndUserInfoKey=> NSValue.valueWithCGRect(self.superview.convertRect(new_frame, toView: nil)),
|
23
25
|
UIKeyboardAnimationCurveUserInfoKey=> UIViewAnimationOptionCurveEaseInOut,
|
24
26
|
UIKeyboardAnimationDurationUserInfoKey=> DURATION})
|
25
27
|
UIView.animateWithDuration(DURATION, animations: ->{
|
26
28
|
NSNotificationCenter.defaultCenter.postNotification(@show_notification)
|
27
29
|
self.alpha = 1.0
|
28
|
-
frame =
|
29
|
-
frame.origin.y = self.superview.frame.size.height - self.bounds.size.height
|
30
|
-
self.frame = frame
|
30
|
+
self.frame = new_frame
|
31
31
|
})
|
32
32
|
@is_shown = true
|
33
33
|
end
|
@@ -2,7 +2,7 @@ module Tgios
|
|
2
2
|
class SearchController < ExtendedUIViewController
|
3
3
|
include ExtendedUITableView
|
4
4
|
Events=[:record_selected, :search, :after_layout, :load_more]
|
5
|
-
attr_accessor :table_list_binding_options, :pop_after_selected, :hide_keyboard, :field_name
|
5
|
+
attr_accessor :table_list_binding_options, :pop_after_selected, :hide_keyboard, :field_name, :instant_search
|
6
6
|
|
7
7
|
def on(event_name, &block)
|
8
8
|
raise ArgumentError.new("Event not found, valid events are: [#{Events.join(', ')}]") unless Events.include?(event_name)
|
@@ -42,12 +42,19 @@ module Tgios
|
|
42
42
|
|
43
43
|
def searchBarSearchButtonClicked(searchBar)
|
44
44
|
searchBar.resignFirstResponder
|
45
|
+
call_search(searchBar.text, true)
|
46
|
+
end
|
47
|
+
|
48
|
+
def searchBar(searchBar, textDidChange: searchText)
|
49
|
+
call_search(searchText) if @instant_search
|
50
|
+
end
|
45
51
|
|
52
|
+
def call_search(text, select_one=false)
|
46
53
|
unless @events.nil? || @events[:search].nil?
|
47
|
-
@events[:search].call(
|
54
|
+
@events[:search].call(text) do |success, result|
|
48
55
|
if success
|
49
56
|
@result=result
|
50
|
-
if @result.count == 1
|
57
|
+
if @result.count == 1 && select_one
|
51
58
|
select_record(@result.first)
|
52
59
|
else
|
53
60
|
@search_result_table_binding.reload(@result) unless @search_result_table_binding.nil?
|
@@ -26,7 +26,8 @@ module Tgios
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def pickerView(pickerView, titleForRow: row, forComponent: component)
|
29
|
-
@list[row]
|
29
|
+
record = @list[row]
|
30
|
+
record.is_a?(Hash) ? record[@display_field] : record.send(@display_field)
|
30
31
|
end
|
31
32
|
|
32
33
|
def pickerView(pickerView, didSelectRow:row, inComponent:component)
|
@@ -122,12 +122,13 @@ module Tgios
|
|
122
122
|
field_set = field_set_at_index_path(index_path)
|
123
123
|
real_fs = field_set
|
124
124
|
real_fs = real_fs[:child_field] unless real_fs[:child_index].nil?
|
125
|
-
if real_fs[:delete] == true
|
125
|
+
if real_fs[:delete] == true # TODO: change :delete to :delete_row after trim-ios changed
|
126
126
|
unless @events[:delete_row].nil?
|
127
127
|
@events[:delete_row].call(field_set, @models[index_path.section].send(field_set[:name]), {tableView: tableView, commitEditingStyle: editingStyle, forRowAtIndexPath:index_path}) do |success|
|
128
128
|
tableView.deleteRowsAtIndexPaths([index_path], withRowAnimation: UITableViewRowAnimationFade) if success
|
129
129
|
end
|
130
130
|
end
|
131
|
+
elsif real_fs[:delete_section] == true
|
131
132
|
unless @events[:delete_section].nil?
|
132
133
|
@events[:delete_section].call(field_set, @models[index_path.section], {tableView: tableView, commitEditingStyle:editingStyle, forRowAtIndexPath:index_path}) do |success|
|
133
134
|
tableView.deleteSections(NSIndexSet.indexSetWithIndex(index_path.section), withRowAnimation: UITableViewRowAnimationFade) if success
|
@@ -139,8 +140,15 @@ module Tgios
|
|
139
140
|
|
140
141
|
def tableView(tableView, canEditRowAtIndexPath: index_path)
|
141
142
|
field_set = field_set_at_index_path(index_path)
|
142
|
-
|
143
|
-
|
143
|
+
unless field_set.nil?
|
144
|
+
can_edit = @events[:can_edit].call(field_set, index_path) unless @events[:can_edit].nil?
|
145
|
+
if can_edit.nil?
|
146
|
+
field_set = field_set[:child_field] unless field_set[:child_index].nil?
|
147
|
+
can_edit = field_set[:delete] == true || field_set[:delete_section] == true
|
148
|
+
end
|
149
|
+
end
|
150
|
+
can_edit = false if can_edit.nil?
|
151
|
+
can_edit
|
144
152
|
end
|
145
153
|
|
146
154
|
def tableView(tableView, heightForRowAtIndexPath: index_path)
|
@@ -63,13 +63,15 @@ module Tgios
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def shrink_table_view(note)
|
66
|
-
# TODO: don't shrink when table frame bottom is above the keyboard
|
67
66
|
@shrinking = true
|
68
67
|
rect = note[UIKeyboardFrameEndUserInfoKey].CGRectValue
|
68
|
+
table_rect= @table.superview.convertRect(@table.frame, toView:nil)
|
69
|
+
intersect = CGRectIntersection(rect, table_rect)
|
70
|
+
expand_height = intersect.present? ? intersect.size.height : 0
|
69
71
|
if @expanding
|
70
|
-
@shrink_height =
|
72
|
+
@shrink_height = expand_height
|
71
73
|
else
|
72
|
-
set_content_inset_bottom(
|
74
|
+
set_content_inset_bottom(expand_height)
|
73
75
|
end
|
74
76
|
end
|
75
77
|
|
@@ -104,7 +106,7 @@ module Tgios
|
|
104
106
|
end
|
105
107
|
|
106
108
|
def scroll_to_index_path(index_path)
|
107
|
-
@table.scrollToRowAtIndexPath(index_path, atScrollPosition:
|
109
|
+
@table.scrollToRowAtIndexPath(index_path, atScrollPosition: UITableViewScrollPositionMiddle, animated: true)
|
108
110
|
@index_path_to_scroll = nil
|
109
111
|
end
|
110
112
|
|
@@ -27,7 +27,11 @@ module Tgios
|
|
27
27
|
}) unless Base.get_style_sheet(:decimal_button)
|
28
28
|
|
29
29
|
@field_name=field_name
|
30
|
-
@options=options
|
30
|
+
@options=options.dup
|
31
|
+
%w(precision keyboard ignore_number_addon type auto_correct auto_capitalize reduce_font_size field_style).each do |k|
|
32
|
+
instance_variable_set("@#{k}", @options.delete(k.to_sym))
|
33
|
+
end
|
34
|
+
|
31
35
|
@events={}
|
32
36
|
@ui_field=WeakRef.new(ui_field)
|
33
37
|
@model=WeakRef.new(model)
|
@@ -43,7 +47,7 @@ module Tgios
|
|
43
47
|
@ui_field.text= if val.respond_to?(:round)
|
44
48
|
default_precision = 0
|
45
49
|
default_precision = 6 unless val.is_a?(Integer)
|
46
|
-
val.round((@
|
50
|
+
val.round((@precision || default_precision)).to_s
|
47
51
|
else
|
48
52
|
val.to_s
|
49
53
|
end
|
@@ -122,16 +126,16 @@ module Tgios
|
|
122
126
|
end
|
123
127
|
|
124
128
|
def is_decimal?
|
125
|
-
@
|
129
|
+
@keyboard == :decimal && is_number_pad?
|
126
130
|
end
|
127
131
|
|
128
132
|
def add_decimal_button
|
129
|
-
if is_decimal? && @ui_field.delegate == self && !@
|
133
|
+
if is_decimal? && @ui_field.delegate == self && !@ignore_number_addon
|
130
134
|
temp_window = (UIApplication.sharedApplication.windows[1] || UIApplication.sharedApplication.windows[0])
|
131
135
|
temp_window.subviews.each do |keyboard|
|
132
136
|
if keyboard.description.hasPrefix('<UIPeripheralHost')
|
133
137
|
if @decimal_button.nil?
|
134
|
-
@decimal_button =
|
138
|
+
@decimal_button = Base.style(UIButton.custom, :decimal_button)
|
135
139
|
@decimal_button.addTarget(self, action: 'decimal_tapped', forControlEvents: UIControlEventTouchUpInside)
|
136
140
|
end
|
137
141
|
keyboard.addSubview(@decimal_button)
|
@@ -180,12 +184,13 @@ module Tgios
|
|
180
184
|
####
|
181
185
|
|
182
186
|
def update_ui_field_style
|
183
|
-
@ui_field.
|
184
|
-
@ui_field.
|
185
|
-
@ui_field.
|
186
|
-
@ui_field.
|
187
|
-
@ui_field.
|
188
|
-
@ui_field.
|
187
|
+
Base.style(@ui_field, @field_style) if @field_style.present?
|
188
|
+
@ui_field.secureTextEntry=@type==:password
|
189
|
+
@ui_field.autocorrectionType = get_auto_correct_type(@auto_correct)
|
190
|
+
@ui_field.autocapitalizationType = get_auto_capitalize_type(@auto_capitalize)
|
191
|
+
@ui_field.keyboardType = get_keyboard_type(@keyboard)
|
192
|
+
@ui_field.enabled = @type != :label
|
193
|
+
@ui_field.adjustsFontSizeToFitWidth = @reduce_font_size
|
189
194
|
|
190
195
|
if @model.respond_to?(:has_error?) && @model.has_error?(@field_name)
|
191
196
|
@ui_field.leftViewMode = UITextFieldViewModeAlways
|
@@ -197,15 +202,15 @@ module Tgios
|
|
197
202
|
textAlignment: :center.uialignment,
|
198
203
|
text: '!',
|
199
204
|
tag: 888}
|
200
|
-
error_label =
|
205
|
+
error_label = Base.style(UILabel.new, error_label_styles)
|
201
206
|
@ui_field.leftView = error_label
|
202
207
|
end
|
203
208
|
else
|
204
209
|
@ui_field.leftViewMode = UITextFieldViewModeNever
|
205
210
|
end
|
206
211
|
|
207
|
-
if is_number_pad? && !@
|
208
|
-
text_toolbar =
|
212
|
+
if is_number_pad? && !@ignore_number_addon
|
213
|
+
text_toolbar = Base.style(UIToolbar.new, frame: CGRectMake(0,0,320,44))
|
209
214
|
done_button = UIBarButtonItem.alloc.initWithBarButtonSystemItem(UIBarButtonSystemItemDone, target: self, action: 'textFieldShouldReturn:')
|
210
215
|
text_toolbar.items=[
|
211
216
|
UIBarButtonItem.flexible_space, done_button
|
data/lib/tgios/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tgios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- April Tsang
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sugarcube
|