basemate-ui-core 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/concepts/br/cell/br.rb +5 -0
  3. data/app/concepts/br/view/br.haml +5 -0
  4. data/app/concepts/button/view/button.haml +2 -2
  5. data/app/concepts/component/cell/dynamic.rb +32 -3
  6. data/app/concepts/component/js/component.js +7 -0
  7. data/app/concepts/component/view/response_dynamic.haml +7 -0
  8. data/app/concepts/div/view/div.haml +1 -1
  9. data/app/concepts/form/cell/form.rb +2 -0
  10. data/app/concepts/form/view/form.haml +1 -1
  11. data/app/concepts/header/view/header.haml +1 -1
  12. data/app/concepts/heading/view/heading.haml +7 -7
  13. data/app/concepts/icon/cell/icon.rb +5 -0
  14. data/app/concepts/icon/view/icon.haml +2 -0
  15. data/app/concepts/img/view/img.haml +1 -1
  16. data/app/concepts/input/view/inline.haml +1 -1
  17. data/app/concepts/input/view/input.haml +1 -1
  18. data/app/concepts/label/cell/label.rb +5 -0
  19. data/app/concepts/label/view/label.haml +7 -0
  20. data/app/concepts/li/cell/li.rb +5 -0
  21. data/app/concepts/li/view/li.haml +6 -0
  22. data/app/concepts/link/cell/link.rb +8 -0
  23. data/app/concepts/link/view/link.haml +2 -2
  24. data/app/concepts/main/view/main.haml +1 -1
  25. data/app/concepts/nav/view/nav.haml +1 -1
  26. data/app/concepts/ol/cell/ol.rb +5 -0
  27. data/app/concepts/ol/view/ol.haml +3 -0
  28. data/app/concepts/pg/cell/pg.rb +5 -0
  29. data/app/concepts/pg/view/pg.haml +8 -0
  30. data/app/concepts/section/view/section.haml +1 -1
  31. data/app/concepts/span/view/span.haml +1 -1
  32. data/app/concepts/submit/cell/submit.rb +4 -0
  33. data/app/concepts/submit/view/submit.haml +1 -1
  34. data/app/concepts/table/cell/table.rb +5 -0
  35. data/app/concepts/table/view/table.haml +3 -0
  36. data/app/concepts/td/cell/td.rb +5 -0
  37. data/app/concepts/td/view/td.haml +8 -0
  38. data/app/concepts/th/cell/th.rb +5 -0
  39. data/app/concepts/th/view/th.haml +8 -0
  40. data/app/concepts/tr/cell/tr.rb +5 -0
  41. data/app/concepts/tr/view/tr.haml +3 -0
  42. data/app/concepts/transition/cell/transition.rb +5 -0
  43. data/app/concepts/transition/view/transition.haml +2 -2
  44. data/app/concepts/ul/cell/ul.rb +5 -0
  45. data/app/concepts/ul/view/ul.haml +3 -0
  46. data/lib/basemate/ui/core/version.rb +1 -1
  47. data/vendor/assets/javascripts/basemate-ui-core.js +188 -163
  48. data/vendor/assets/javascripts/basemate-ui-core.js.map +1 -1
  49. metadata +25 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dff05e3fe084c36ce2fbd5c1812f87da7682563e314f3cb354e797cfed814b19
4
- data.tar.gz: dfcc244c148cc0a38adcdcb363cadc6cd211a692a88a3295737b7cc47b5a1abb
3
+ metadata.gz: 217c5184463185ad29f062bfa57b4d7b5558c06d159dfa3972146a4e80b85158
4
+ data.tar.gz: cbbe98f147f4b6510039b754258c8120959b1e82218c2fc801bd0187053b92a1
5
5
  SHA512:
6
- metadata.gz: 34047d5f4853321fccb736f091840deb4cd77602aafe060be4e1826300cf80eba36424f2604502ec00fd5829dd0cbcb02142b55950972d49329ff6f64d559599
7
- data.tar.gz: aa2d3034364c8e1c7f060d9f61977734a0353afc3a23148f2c894718d7c8683d8800ea5c5a044c639506d9f2b38874fcd7e4b4efe51f8e4f961d344989ab1a58
6
+ metadata.gz: 71be319c99eb3e9e2552cea8c747ace9bf39de01a4a3fd999d9fc0537d04a79bc3a75eb201a759ae05efe97a38c44b57fb6ce07b32a3baf3b7521991cb6f030c
7
+ data.tar.gz: 6fb5c920fe69d11d149586872cef0290fc8d66dd54dd1dfe86b9cc5da9bd841e9f0a35261d66f6dd096cf07e4360bff4b83fd37db956e234c937e60306e6929d
@@ -0,0 +1,5 @@
1
+ module Br::Cell
2
+ class Br < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ - unless options[:times].nil?
2
+ - options[:times].times do
3
+ %br
4
+ - else
5
+ %br
@@ -1,7 +1,7 @@
1
1
  - if options[:text].nil?
2
- %button{"class": options[:class], "id": component_id}
2
+ %button{@tag_attributes}
3
3
  - if block_given?
4
4
  = yield
5
5
  - else
6
- %button{"class": options[:class], "id": component_id}
6
+ %button{@tag_attributes}
7
7
  = options[:text]
@@ -46,6 +46,7 @@ module Component::Cell
46
46
  @cells = {}
47
47
  generate_component_name
48
48
  generate_children_cells
49
+ set_tag_attributes
49
50
  setup
50
51
  end
51
52
 
@@ -59,7 +60,11 @@ module Component::Cell
59
60
  end
60
61
  if respond_to? :response
61
62
  response &block
62
- render :response
63
+ if @static
64
+ render :response
65
+ else
66
+ render :response_dynamic
67
+ end
63
68
  else
64
69
  if @static
65
70
  render(view: :static, &block)
@@ -74,8 +79,16 @@ module Component::Cell
74
79
  end
75
80
 
76
81
  def render_content(&block)
77
- render do
78
- render_children
82
+ if respond_to? :prepare
83
+ prepare
84
+ end
85
+ if respond_to? :response
86
+ response &block
87
+ render :response
88
+ else
89
+ render do
90
+ render_children
91
+ end
79
92
  end
80
93
  end
81
94
 
@@ -117,6 +130,10 @@ module Component::Cell
117
130
 
118
131
  def generate_component_name
119
132
  name_parts = self.class.name.split("::")
133
+ module_name = name_parts[0]
134
+ if module_name == "Components"
135
+ name_parts.shift
136
+ end
120
137
  name = name_parts[0] + name_parts[1]
121
138
  if name_parts[0] == name_parts[2]
122
139
  name = name_parts[0] + name_parts[1]
@@ -128,5 +145,17 @@ module Component::Cell
128
145
  @component_name = @component_class.gsub("-cell", "")
129
146
  end
130
147
 
148
+ def set_tag_attributes
149
+ default_attributes = {
150
+ "class": options[:class],
151
+ "id": component_id
152
+ }
153
+ unless options[:attributes].nil?
154
+ default_attributes.merge!(options[:attributes])
155
+ end
156
+
157
+ @tag_attributes = default_attributes
158
+ end
159
+
131
160
  end
132
161
  end
@@ -17,6 +17,11 @@ const componentMixin = {
17
17
  this.rerender()
18
18
  }
19
19
  },
20
+ onBasemateUiCoreChannel: function(event){
21
+ if (this.componentConfig["rerender_on"] == event.message){
22
+ this.rerender()
23
+ }
24
+ },
20
25
  rerender: function(){
21
26
  var self = this;
22
27
  self.params["component_key"] = self.componentConfig["component_key"]
@@ -40,10 +45,12 @@ const componentMixin = {
40
45
  created: function () {
41
46
  const self = this
42
47
  basemateEventHub.$on('rerender', self.onRerender)
48
+ basemateEventHub.$on('BasemateUiCoreChannel', self.onBasemateUiCoreChannel)
43
49
  },
44
50
  beforeDestroy: function() {
45
51
  const self = this
46
52
  basemateEventHub.$off('rerender', self.onRerender);
53
+ basemateEventHub.$off('BasemateUiCoreChannel', self.onBasemateUiCoreChannel)
47
54
  },
48
55
  components: {
49
56
  VRuntimeTemplate: VRuntimeTemplate
@@ -0,0 +1,7 @@
1
+ %component{"is": @component_class, "ref": component_id, ":params": @url_params.to_json, ":component-config": @component_config.to_json, "inline-template": true}
2
+ %div{"id": component_id, "class": @component_class}
3
+ %div{"v-if": "asyncTemplate == null"}
4
+ - @cells.each do |key, cell|
5
+ = cell.call(:show)
6
+ %div{"v-if": "asyncTemplate != null"}
7
+ %v-runtime-template{":template":"asyncTemplate"}
@@ -1,3 +1,3 @@
1
- %div{"class": options[:class], "id": component_id}
1
+ %div{@tag_attributes}
2
2
  - if block_given?
3
3
  = yield
@@ -8,6 +8,8 @@ module Form::Cell
8
8
  if options[:notify].nil?
9
9
  @component_config[:notify] = true
10
10
  end
11
+
12
+ @tag_attributes.merge!({"@submit.prevent": true})
11
13
  end
12
14
 
13
15
  def submit_path
@@ -1,2 +1,2 @@
1
- %form{"@submit.prevent": true}
1
+ %form{@tag_attributes}
2
2
  = yield
@@ -1,3 +1,3 @@
1
- %header{"class": options[:class], "id": component_id}
1
+ %header{@tag_attributes}
2
2
  - if block_given?
3
3
  = yield
@@ -1,48 +1,48 @@
1
1
  - case options[:size]
2
2
  - when 1
3
- %h1{"class": options[:class], "id": component_id}
3
+ %h1{@tag_attributes}
4
4
  - if options[:text].blank?
5
5
  - if block_given?
6
6
  = yield
7
7
  - else
8
8
  = options[:text]
9
9
  - when 2
10
- %h2{"class": options[:class], "id": component_id}
10
+ %h2{@tag_attributes}
11
11
  - if options[:text].blank?
12
12
  - if block_given?
13
13
  = yield
14
14
  - else
15
15
  = options[:text]
16
16
  - when 3
17
- %h3{"class": options[:class], "id": component_id}
17
+ %h3{@tag_attributes}
18
18
  - if options[:text].blank?
19
19
  - if block_given?
20
20
  = yield
21
21
  - else
22
22
  = options[:text]
23
23
  - when 4
24
- %h4{"class": options[:class], "id": component_id}
24
+ %h4{@tag_attributes}
25
25
  - if options[:text].blank?
26
26
  - if block_given?
27
27
  = yield
28
28
  - else
29
29
  = options[:text]
30
30
  - when 5
31
- %h5{"class": options[:class], "id": component_id}
31
+ %h5{@tag_attributes}
32
32
  - if options[:text].blank?
33
33
  - if block_given?
34
34
  = yield
35
35
  - else
36
36
  = options[:text]
37
37
  - when 6
38
- %h6{"class": options[:class], "id": component_id}
38
+ %h6{@tag_attributes}
39
39
  - if options[:text].blank?
40
40
  - if block_given?
41
41
  = yield
42
42
  - else
43
43
  = options[:text]
44
44
  - else
45
- %h1{"class": options[:class], "id": component_id}
45
+ %h1{@tag_attributes}
46
46
  - if options[:text].blank?
47
47
  - if block_given?
48
48
  = yield
@@ -0,0 +1,5 @@
1
+ module Icon::Cell
2
+ class Icon < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ %i{"class": options[:class], "id": component_id}
2
+ = options[:text]
@@ -1 +1 @@
1
- = image_tag(ActionController::Base.helpers.asset_path(options[:path]), height: options[:height], height: options[:width], alt: options[:alt])
1
+ = image_tag(ActionController::Base.helpers.asset_path(options[:path]), height: options[:height], width: options[:width], alt: options[:alt])
@@ -1,6 +1,6 @@
1
1
  %div{"v-if": "!showInlineForm", "@click": "launchInlineForm(\"#{options[:key]}\", \"#{options[:value]}\")"}
2
2
  = options[:value]
3
3
  %div{"v-if": "showInlineForm"}
4
- %input{"ref": "inlineinput", "v-model": input_key, "@blur": "perform", "@keyup.esc": "closeInlineForm"}
4
+ %input{"ref": "inlineinput", "v-model": input_key, "@blur": "perform", "@keyup.esc": "closeInlineForm", class: options[:class], id: component_id}
5
5
  - if block_given?
6
6
  = yield
@@ -1 +1 @@
1
- %input{"v-model": input_key}
1
+ %input{"v-model": input_key, class: options[:class], id: component_id}
@@ -0,0 +1,5 @@
1
+ module Label::Cell
2
+ class Label < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ - if options[:text].blank?
2
+ %label{@tag_attributes}
3
+ - if block_given?
4
+ = yield
5
+ - else
6
+ %label{@tag_attributes}
7
+ = options[:text]
@@ -0,0 +1,5 @@
1
+ module Li::Cell
2
+ class Li < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ %li{"class": options[:class], "id": component_id}
2
+ - if options[:text].blank?
3
+ - if block_given?
4
+ = yield
5
+ - else
6
+ = options[:text]
@@ -1,6 +1,14 @@
1
1
  module Link::Cell
2
2
  class Link < Component::Cell::Static
3
3
 
4
+ def setup
5
+ @tag_attributes.merge!({ "class": options[:class],
6
+ "id": component_id,
7
+ "method": options[:method] ||= :get,
8
+ "target": options[:target] ||= nil
9
+ })
10
+ end
11
+
4
12
  def link_path
5
13
  if options[:path].is_a?(Symbol)
6
14
  return ::Rails.application.routes.url_helpers.send(options[:path], options[:params])
@@ -1,6 +1,6 @@
1
1
  - if options[:text].nil?
2
- = link_to link_path, {"class": options[:class], "id": component_id, method: options[:method] ||= :get, "target": options[:target] ||= nil} do
2
+ = link_to link_path, @tag_attributes do
3
3
  - if block_given?
4
4
  = yield
5
5
  - else
6
- = link_to options[:text], link_path, {"class": options[:class], "id": component_id, method: options[:method] ||= :get, "target": options[:target] ||= nil}
6
+ = link_to options[:text], link_path, @tag_attributes
@@ -1,3 +1,3 @@
1
- %main{"class": options[:class], "id": component_id}
1
+ %main{@tag_attributes}
2
2
  - if block_given?
3
3
  = yield
@@ -1,3 +1,3 @@
1
- %nav{"class": options[:class], "id": component_id}
1
+ %nav{@tag_attributes}
2
2
  - if block_given?
3
3
  = yield
@@ -0,0 +1,5 @@
1
+ module Ol::Cell
2
+ class Ol < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ %ol{"class": options[:class], "id": component_id}
2
+ - if block_given?
3
+ = yield
@@ -0,0 +1,5 @@
1
+ module Pg::Cell
2
+ class Pg < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ - if options[:text].nil?
2
+ %p{"class": options[:class], "id": component_id}
3
+ - if block_given?
4
+ = yield
5
+
6
+ - else
7
+ %p{"class": options[:class], "id": component_id}
8
+ = options[:text]
@@ -1,3 +1,3 @@
1
- %section{"class": options[:class], "id": component_id}
1
+ %section{@tag_attributes}
2
2
  - if block_given?
3
3
  = yield
@@ -1,3 +1,3 @@
1
- %span{"class": options[:class], "id": component_id}
1
+ %span{@tag_attributes}
2
2
  - if block_given?
3
3
  = yield
@@ -1,5 +1,9 @@
1
1
  module Submit::Cell
2
2
  class Submit < Component::Cell::Static
3
3
 
4
+ def setup
5
+ @tag_attributes.merge!({ "@click.prevent": "perform" })
6
+ end
7
+
4
8
  end
5
9
  end
@@ -1,3 +1,3 @@
1
- %span{"@click.prevent": "perform"}
1
+ %span{@tag_attributes}
2
2
  - if block_given?
3
3
  = yield
@@ -0,0 +1,5 @@
1
+ module Table::Cell
2
+ class Table < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ %table{"class": options[:class], "id": component_id}
2
+ - if block_given?
3
+ = yield
@@ -0,0 +1,5 @@
1
+ module Td::Cell
2
+ class Td < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ - if options[:text].nil?
2
+ %td{"class": options[:class], "id": component_id}
3
+ - if block_given?
4
+ = yield
5
+
6
+ - else
7
+ %td{"class": options[:class], "id": component_id}
8
+ = options[:text]
@@ -0,0 +1,5 @@
1
+ module Th::Cell
2
+ class Th < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ - if options[:text].nil?
2
+ %th{"class": options[:class], "id": component_id}
3
+ - if block_given?
4
+ = yield
5
+
6
+ - else
7
+ %th{"class": options[:class], "id": component_id}
8
+ = options[:text]
@@ -0,0 +1,5 @@
1
+ module Tr::Cell
2
+ class Tr < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ %tr{"class": options[:class], "id": component_id}
2
+ - if block_given?
3
+ = yield
@@ -3,6 +3,11 @@ module Transition::Cell
3
3
 
4
4
  def setup
5
5
  @component_config[:link_path] = link_path
6
+ @tag_attributes.merge!({
7
+ "href": link_path,
8
+ "@click.prevent": navigate_to(link_path),
9
+ "v-bind:class": "{ active: isActive }"
10
+ })
6
11
  end
7
12
 
8
13
  def link_path