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.
- checksums.yaml +4 -4
- data/app/concepts/br/cell/br.rb +5 -0
- data/app/concepts/br/view/br.haml +5 -0
- data/app/concepts/button/view/button.haml +2 -2
- data/app/concepts/component/cell/dynamic.rb +32 -3
- data/app/concepts/component/js/component.js +7 -0
- data/app/concepts/component/view/response_dynamic.haml +7 -0
- data/app/concepts/div/view/div.haml +1 -1
- data/app/concepts/form/cell/form.rb +2 -0
- data/app/concepts/form/view/form.haml +1 -1
- data/app/concepts/header/view/header.haml +1 -1
- data/app/concepts/heading/view/heading.haml +7 -7
- data/app/concepts/icon/cell/icon.rb +5 -0
- data/app/concepts/icon/view/icon.haml +2 -0
- data/app/concepts/img/view/img.haml +1 -1
- data/app/concepts/input/view/inline.haml +1 -1
- data/app/concepts/input/view/input.haml +1 -1
- data/app/concepts/label/cell/label.rb +5 -0
- data/app/concepts/label/view/label.haml +7 -0
- data/app/concepts/li/cell/li.rb +5 -0
- data/app/concepts/li/view/li.haml +6 -0
- data/app/concepts/link/cell/link.rb +8 -0
- data/app/concepts/link/view/link.haml +2 -2
- data/app/concepts/main/view/main.haml +1 -1
- data/app/concepts/nav/view/nav.haml +1 -1
- data/app/concepts/ol/cell/ol.rb +5 -0
- data/app/concepts/ol/view/ol.haml +3 -0
- data/app/concepts/pg/cell/pg.rb +5 -0
- data/app/concepts/pg/view/pg.haml +8 -0
- data/app/concepts/section/view/section.haml +1 -1
- data/app/concepts/span/view/span.haml +1 -1
- data/app/concepts/submit/cell/submit.rb +4 -0
- data/app/concepts/submit/view/submit.haml +1 -1
- data/app/concepts/table/cell/table.rb +5 -0
- data/app/concepts/table/view/table.haml +3 -0
- data/app/concepts/td/cell/td.rb +5 -0
- data/app/concepts/td/view/td.haml +8 -0
- data/app/concepts/th/cell/th.rb +5 -0
- data/app/concepts/th/view/th.haml +8 -0
- data/app/concepts/tr/cell/tr.rb +5 -0
- data/app/concepts/tr/view/tr.haml +3 -0
- data/app/concepts/transition/cell/transition.rb +5 -0
- data/app/concepts/transition/view/transition.haml +2 -2
- data/app/concepts/ul/cell/ul.rb +5 -0
- data/app/concepts/ul/view/ul.haml +3 -0
- data/lib/basemate/ui/core/version.rb +1 -1
- data/vendor/assets/javascripts/basemate-ui-core.js +188 -163
- data/vendor/assets/javascripts/basemate-ui-core.js.map +1 -1
- metadata +25 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 217c5184463185ad29f062bfa57b4d7b5558c06d159dfa3972146a4e80b85158
|
4
|
+
data.tar.gz: cbbe98f147f4b6510039b754258c8120959b1e82218c2fc801bd0187053b92a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71be319c99eb3e9e2552cea8c747ace9bf39de01a4a3fd999d9fc0537d04a79bc3a75eb201a759ae05efe97a38c44b57fb6ce07b32a3baf3b7521991cb6f030c
|
7
|
+
data.tar.gz: 6fb5c920fe69d11d149586872cef0290fc8d66dd54dd1dfe86b9cc5da9bd841e9f0a35261d66f6dd096cf07e4360bff4b83fd37db956e234c937e60306e6929d
|
@@ -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
|
-
|
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
|
-
|
78
|
-
|
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,2 +1,2 @@
|
|
1
|
-
%form{
|
1
|
+
%form{@tag_attributes}
|
2
2
|
= yield
|
@@ -1,48 +1,48 @@
|
|
1
1
|
- case options[:size]
|
2
2
|
- when 1
|
3
|
-
%h1{
|
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{
|
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{
|
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{
|
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{
|
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{
|
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{
|
45
|
+
%h1{@tag_attributes}
|
46
46
|
- if options[:text].blank?
|
47
47
|
- if block_given?
|
48
48
|
= yield
|
@@ -1 +1 @@
|
|
1
|
-
= image_tag(ActionController::Base.helpers.asset_path(options[:path]), height: options[:height],
|
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}
|
@@ -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,
|
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,
|
6
|
+
= link_to options[:text], link_path, @tag_attributes
|