vdom-rb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vdom-rb.rb +2 -0
- data/lib/vdom/version.rb +1 -1
- data/opal/vdom/component.rb +0 -1
- data/opal/vdom/renderer.rb +20 -11
- data/opal/vdom/table.rb +7 -5
- data/opal/vdom/table_column.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae060eafd4a737e9346b3c04d192e2e1b51922d1
|
4
|
+
data.tar.gz: 56029e3e1cf1afd1df129607289d8bc79c017029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8abe0441436d59e9f9b1e0087d8497d1f2dd53b64d162f83e8e2695c3ea983429aa5c7852abd5602e9d4a660280cac39958e8ddb2efbe605e47bee79e348515c
|
7
|
+
data.tar.gz: 7d8a70cb6668761bca7a335736ec3259ab5221d5782eb428d7ecee804b07763ee84b4cad3475ec174aa34cfb64e5dcc1b3d91ff84daf8865e178513d8c0aacdd
|
data/lib/vdom-rb.rb
CHANGED
data/lib/vdom/version.rb
CHANGED
data/opal/vdom/component.rb
CHANGED
data/opal/vdom/renderer.rb
CHANGED
@@ -120,7 +120,10 @@ module VDOM
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
-
def
|
123
|
+
def up_down(callback, up: true, down: false, content: nil, pull: 'left')
|
124
|
+
up = up && !down
|
125
|
+
pull = pull.to_s
|
126
|
+
left = pull == 'left'
|
124
127
|
node(:div,
|
125
128
|
attributes: {
|
126
129
|
onclick: callback,
|
@@ -129,10 +132,12 @@ module VDOM
|
|
129
132
|
content: [
|
130
133
|
node(:span,
|
131
134
|
attributes: {
|
132
|
-
class: "glyphicon glyphicon-menu-#{
|
135
|
+
class: "glyphicon glyphicon-menu-#{up ? 'up' : 'down'} pull-#{pull}",
|
133
136
|
style: {
|
134
137
|
font_size: 'smaller',
|
135
|
-
|
138
|
+
margin_top: '0.2em',
|
139
|
+
margin_left: left ? '0.3em' : '0.5em',
|
140
|
+
margin_right: left ? '0.5em' : '0.3em',
|
136
141
|
vertical_align: 'middle',
|
137
142
|
color: 'inherit',
|
138
143
|
background_color: 'inherit',
|
@@ -143,16 +148,20 @@ module VDOM
|
|
143
148
|
)
|
144
149
|
end
|
145
150
|
|
146
|
-
def arrify(
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
151
|
+
def arrify(*args)
|
152
|
+
result = []
|
153
|
+
args.each do |arg|
|
154
|
+
if arg
|
155
|
+
if Enumerable === arg
|
156
|
+
arg.each do |e|
|
157
|
+
result << e
|
158
|
+
end
|
159
|
+
else
|
160
|
+
result << arg
|
161
|
+
end
|
152
162
|
end
|
153
|
-
else
|
154
|
-
[]
|
155
163
|
end
|
164
|
+
result
|
156
165
|
end
|
157
166
|
|
158
167
|
# TODO: generalize from bootstrap
|
data/opal/vdom/table.rb
CHANGED
@@ -40,7 +40,7 @@ module VDOM
|
|
40
40
|
# debug __FILE__, __LINE__, __method__, "section=#{section} column=#{column.id} content=#{content}"
|
41
41
|
end
|
42
42
|
if _is_head && column.sort?
|
43
|
-
content =
|
43
|
+
content = sortable(
|
44
44
|
column.sort_callback,
|
45
45
|
direction: _table.sort_column_id == column.id ? _table.sort_order : 0,
|
46
46
|
content: content
|
@@ -198,13 +198,14 @@ module VDOM
|
|
198
198
|
|
199
199
|
def render
|
200
200
|
@render_count += 1
|
201
|
-
node(
|
201
|
+
Renderer.node(
|
202
202
|
:table,
|
203
203
|
attributes: { class: css, style: style },
|
204
|
-
content: [caption_component] +
|
204
|
+
content: (caption_content ? [caption_component] : []) +
|
205
|
+
section_components
|
205
206
|
)
|
206
207
|
end
|
207
|
-
|
208
|
+
|
208
209
|
def caption_component
|
209
210
|
TableCaption.new(caption_state)
|
210
211
|
end
|
@@ -238,7 +239,6 @@ module VDOM
|
|
238
239
|
end
|
239
240
|
|
240
241
|
def section_attributes(section)
|
241
|
-
# TODO:
|
242
242
|
nil
|
243
243
|
end
|
244
244
|
|
@@ -253,6 +253,7 @@ module VDOM
|
|
253
253
|
|
254
254
|
# set or toggle the sort order to/of the given column
|
255
255
|
def sort!(column_id)
|
256
|
+
# debug __FILE__, __LINE__, __method__, "column_id=#{column_id}"
|
256
257
|
if @sort_column_id == column_id
|
257
258
|
sort_orders[@sort_column_id] *= -1
|
258
259
|
else
|
@@ -275,6 +276,7 @@ module VDOM
|
|
275
276
|
end
|
276
277
|
|
277
278
|
def invalidate
|
279
|
+
# debug __FILE__, __LINE__, __method__
|
278
280
|
init_row_models
|
279
281
|
init_sorting
|
280
282
|
invalidate_caption
|
data/opal/vdom/table_column.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vdom-rb
|
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
|
- Colin Gunn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|