matestack-ui-bootstrap 1.5.1 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +17 -5
- data/README.md +36 -60
- data/lib/matestack/ui/bootstrap/base_component.rb +11 -0
- data/lib/matestack/ui/bootstrap/base_vue_js_component.rb +11 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/accordion.rb +18 -16
- data/lib/matestack/ui/bootstrap/components/alert.js +58 -0
- data/lib/matestack/ui/bootstrap/components/alert.rb +43 -0
- data/lib/matestack/ui/bootstrap/components/avatar.rb +27 -0
- data/lib/matestack/ui/bootstrap/components/badge.rb +32 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/breadcrumb.rb +12 -10
- data/lib/matestack/ui/bootstrap/components/button.rb +71 -0
- data/lib/matestack/ui/bootstrap/components/button_group.rb +36 -0
- data/lib/matestack/ui/bootstrap/components/card.rb +105 -0
- data/lib/matestack/ui/bootstrap/components/carousel.js +84 -0
- data/lib/matestack/ui/bootstrap/components/carousel.rb +103 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/close.rb +10 -9
- data/lib/matestack/ui/bootstrap/components/collapse.js +89 -0
- data/lib/matestack/ui/bootstrap/components/collapse.rb +54 -0
- data/lib/matestack/ui/bootstrap/components/dropdown.js +19 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.rb +29 -25
- data/lib/matestack/ui/bootstrap/components/icon.rb +21 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/list_group.rb +32 -29
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/modal.js +32 -28
- data/lib/matestack/ui/bootstrap/components/modal.rb +121 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/navbar.rb +39 -30
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/page_heading.rb +7 -5
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/pagination.rb +11 -9
- data/lib/matestack/ui/bootstrap/components/popover.js +30 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.rb +25 -21
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/progress.rb +19 -19
- data/lib/matestack/ui/bootstrap/components/scrollspy.rb +50 -0
- data/lib/matestack/ui/bootstrap/components/section_card.rb +33 -0
- data/lib/matestack/ui/bootstrap/components/spinner.rb +35 -0
- data/lib/matestack/ui/bootstrap/components/tab_nav.rb +79 -0
- data/lib/matestack/ui/bootstrap/components/tab_nav_content.rb +35 -0
- data/lib/matestack/ui/bootstrap/components/toast.js +89 -0
- data/lib/matestack/ui/bootstrap/components/toast.rb +113 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/tooltip.js +9 -6
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/tooltip.rb +20 -18
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/figure.rb +4 -2
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/collection.rb +22 -16
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/collection.scss +0 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/content.rb +38 -21
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/filter.rb +6 -2
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/paginate.rb +16 -11
- data/lib/matestack/ui/bootstrap/form/checkbox.rb +88 -0
- data/lib/matestack/ui/bootstrap/form/input.rb +116 -0
- data/lib/matestack/ui/bootstrap/form/radio.rb +55 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/form/select.rb +18 -10
- data/lib/matestack/ui/bootstrap/form/submit.rb +20 -0
- data/lib/matestack/ui/bootstrap/form/switch.rb +30 -0
- data/lib/matestack/ui/bootstrap/form/textarea.rb +47 -0
- data/lib/matestack/ui/bootstrap/index.js +40 -0
- data/lib/matestack/ui/bootstrap/initialize.rb +3 -0
- data/lib/matestack/ui/bootstrap/layout/column.rb +49 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/layout/container.rb +12 -9
- data/lib/matestack/ui/bootstrap/layout/row.rb +25 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.js +10 -6
- data/lib/matestack/ui/bootstrap/layout/sidebar.rb +43 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.scss +0 -0
- data/{app/concepts/matestack/ui/bootstrap/apps → lib/matestack/ui/bootstrap/layouts}/admin_template.rb +18 -13
- data/lib/matestack/ui/bootstrap/registry.rb +173 -0
- data/{app/javascript/matestack-ui-bootstrap → lib/matestack/ui/bootstrap}/stylesheets/matestack-ui-bootstrap.scss +0 -0
- data/lib/matestack/ui/bootstrap/version.rb +1 -1
- data/lib/matestack/ui/bootstrap.rb +99 -17
- metadata +85 -80
- data/app/assets/images/avatar-placeholder.png +0 -0
- data/app/assets/images/icons/bootstrap-icons.svg +0 -1
- data/app/concepts/matestack/ui/bootstrap/components/alert.js +0 -53
- data/app/concepts/matestack/ui/bootstrap/components/alert.rb +0 -34
- data/app/concepts/matestack/ui/bootstrap/components/avatar.rb +0 -27
- data/app/concepts/matestack/ui/bootstrap/components/badge.rb +0 -30
- data/app/concepts/matestack/ui/bootstrap/components/button.rb +0 -69
- data/app/concepts/matestack/ui/bootstrap/components/button_group.rb +0 -36
- data/app/concepts/matestack/ui/bootstrap/components/card.rb +0 -100
- data/app/concepts/matestack/ui/bootstrap/components/carousel.js +0 -79
- data/app/concepts/matestack/ui/bootstrap/components/carousel.rb +0 -86
- data/app/concepts/matestack/ui/bootstrap/components/collapse.js +0 -84
- data/app/concepts/matestack/ui/bootstrap/components/collapse.rb +0 -43
- data/app/concepts/matestack/ui/bootstrap/components/dropdown.js +0 -14
- data/app/concepts/matestack/ui/bootstrap/components/icon.rb +0 -19
- data/app/concepts/matestack/ui/bootstrap/components/modal.rb +0 -106
- data/app/concepts/matestack/ui/bootstrap/components/popover.js +0 -26
- data/app/concepts/matestack/ui/bootstrap/components/scrollspy.rb +0 -48
- data/app/concepts/matestack/ui/bootstrap/components/section_card.rb +0 -31
- data/app/concepts/matestack/ui/bootstrap/components/spinner.rb +0 -31
- data/app/concepts/matestack/ui/bootstrap/components/tab_nav.rb +0 -83
- data/app/concepts/matestack/ui/bootstrap/components/tab_nav_content.rb +0 -32
- data/app/concepts/matestack/ui/bootstrap/components/toast.js +0 -85
- data/app/concepts/matestack/ui/bootstrap/components/toast.rb +0 -99
- data/app/concepts/matestack/ui/bootstrap/form/checkbox.rb +0 -99
- data/app/concepts/matestack/ui/bootstrap/form/input.rb +0 -112
- data/app/concepts/matestack/ui/bootstrap/form/radio.rb +0 -57
- data/app/concepts/matestack/ui/bootstrap/form/submit.rb +0 -21
- data/app/concepts/matestack/ui/bootstrap/form/switch.rb +0 -99
- data/app/concepts/matestack/ui/bootstrap/layout/column.rb +0 -47
- data/app/concepts/matestack/ui/bootstrap/layout/row.rb +0 -15
- data/app/concepts/matestack/ui/bootstrap/layout/sidebar.rb +0 -45
- data/app/concepts/matestack/ui/bootstrap/pages/devise/sign_in.rb +0 -40
- data/app/concepts/matestack/ui/bootstrap/registry.rb +0 -61
- data/app/helpers/matestack/ui/bootstrap/application_helper.rb +0 -17
- data/app/javascript/matestack-ui-bootstrap/index.js +0 -24
- data/app/javascript/packs/matestack-ui-bootstrap.js +0 -2
- data/app/matestack/bootstrap/form/submit.rb +0 -20
- data/config/routes.rb +0 -2
- data/config/webpack/development.js +0 -5
- data/config/webpack/environment.js +0 -29
- data/config/webpack/production.js +0 -33
- data/config/webpack/test.js +0 -5
- data/config/webpacker.yml +0 -96
- data/lib/matestack/ui/bootstrap/engine.rb +0 -26
@@ -1,21 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "../base_component"
|
2
|
+
|
3
|
+
class Matestack::Ui::Bootstrap::Components::ListGroup < Matestack::Ui::Bootstrap::BaseComponent
|
4
|
+
optional :role
|
3
5
|
|
4
6
|
optional :items
|
5
7
|
optional :horizontal, :horizontal_size, :checkbox
|
6
|
-
optional :variant, class: { as:
|
8
|
+
optional :variant, class: { as: :bs_class }
|
7
9
|
|
8
10
|
|
9
11
|
def response
|
10
12
|
if actionable_items?
|
11
13
|
div list_group_attributes do
|
12
|
-
|
13
|
-
list_partial if items
|
14
|
+
yield if block_given? unless context.items
|
15
|
+
list_partial if context.items
|
14
16
|
end
|
15
17
|
else
|
16
18
|
ul list_group_attributes do
|
17
|
-
|
18
|
-
list_partial if items
|
19
|
+
yield if block_given? unless context.items
|
20
|
+
list_partial if context.items
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -23,49 +25,49 @@ class Matestack::Ui::Bootstrap::Components::ListGroup < Matestack::Ui::Component
|
|
23
25
|
protected
|
24
26
|
|
25
27
|
def actionable_items?
|
26
|
-
if items.present?
|
27
|
-
items.any? { |item| [:tab, :transition, :action, :link].include?(item[:type]) }
|
28
|
+
if context.items.present?
|
29
|
+
context.items.any? { |item| [:tab, :transition, :action, :link].include?(item[:type]) }
|
28
30
|
else
|
29
31
|
false
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
35
|
def tab_nav?
|
34
|
-
if items.present?
|
35
|
-
items.any? { |item| item[:type] == :tab }
|
36
|
+
if context.items.present?
|
37
|
+
context.items.any? { |item| item[:type] == :tab }
|
36
38
|
else
|
37
39
|
false
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
43
|
def list_partial
|
42
|
-
items.each do |item|
|
44
|
+
context.items.each do |item|
|
43
45
|
case item[:type]
|
44
46
|
when :link
|
45
|
-
|
47
|
+
a link_attrs(item) do
|
46
48
|
text_rendering(item)
|
47
49
|
end
|
48
50
|
when :tab
|
49
|
-
|
51
|
+
a tab_attrs(item) do
|
50
52
|
text_rendering(item)
|
51
53
|
end
|
52
54
|
when :transition
|
53
|
-
transition transition_attrs(item)
|
55
|
+
transition transition_attrs(item) do
|
54
56
|
text_rendering(item)
|
55
57
|
end
|
56
58
|
when :action
|
57
|
-
action action_attrs(item)
|
59
|
+
action action_attrs(item) do
|
58
60
|
text_rendering(item)
|
59
61
|
end
|
60
62
|
when :label
|
61
63
|
label id: item[:id], class: "#{list_classes item, false}" do
|
62
|
-
input class: "form-check-input me-1",
|
64
|
+
input class: "form-check-input me-1", 'type': "checkbox", 'value': "" if context.checkbox
|
63
65
|
text_rendering(item)
|
64
66
|
end
|
65
67
|
else
|
66
|
-
li id: item[:id], class: "#{list_classes item, false}",
|
68
|
+
li id: item[:id], class: "#{list_classes item, false}", "aria-disabled": "#{true if item[:disabled]}" do
|
67
69
|
# this implementation is useless, would need to be connected to a form through bs_form_checkbox
|
68
|
-
# input class: "form-check-input me-1",
|
70
|
+
# input class: "form-check-input me-1", 'type': "checkbox", 'value': "", 'aria-label': "#{item[:text]}" if checkbox
|
69
71
|
text_rendering(item)
|
70
72
|
bs_badge variant: :primary, rounded: true, text: item[:badge] if item[:badge]
|
71
73
|
end
|
@@ -81,9 +83,9 @@ class Matestack::Ui::Bootstrap::Components::ListGroup < Matestack::Ui::Component
|
|
81
83
|
def list_group_attributes
|
82
84
|
attributes = {}.tap do |hash|
|
83
85
|
hash[:class] = list_group_classes
|
84
|
-
hash[:
|
86
|
+
hash[:role] = "tablist" if tab_nav?
|
85
87
|
end
|
86
|
-
|
88
|
+
options.merge(
|
87
89
|
attributes
|
88
90
|
)
|
89
91
|
end
|
@@ -91,16 +93,16 @@ class Matestack::Ui::Bootstrap::Components::ListGroup < Matestack::Ui::Component
|
|
91
93
|
def list_group_classes
|
92
94
|
[].tap do |classes|
|
93
95
|
classes << 'list-group'
|
94
|
-
classes << (horizontal_size.present? ? "list-group-horizontal-#{horizontal_size}": "list-group-horizontal") if horizontal
|
95
|
-
classes << 'list-group-flush' if variant == :flush
|
96
|
-
classes << bs_class
|
96
|
+
classes << (context.horizontal_size.present? ? "list-group-horizontal-#{context.horizontal_size}": "list-group-horizontal") if context.horizontal
|
97
|
+
classes << 'list-group-flush' if context.variant == :flush
|
98
|
+
classes << context.bs_class
|
97
99
|
end.join(' ').strip
|
98
100
|
end
|
99
101
|
|
100
102
|
def link_attrs(item)
|
101
103
|
attrs = item
|
102
104
|
attrs[:class] = "#{list_classes item, true}"
|
103
|
-
attrs[
|
105
|
+
attrs["aria-disabled"] = "#{true if item[:disabled]}" if item[:disabled]
|
104
106
|
attrs
|
105
107
|
end
|
106
108
|
|
@@ -109,8 +111,9 @@ class Matestack::Ui::Bootstrap::Components::ListGroup < Matestack::Ui::Component
|
|
109
111
|
hash[:id] = "tab-#{item[:id]}" if tab_nav?
|
110
112
|
hash[:class] = "#{list_classes item, true}"
|
111
113
|
hash[:data] = { "bs-toggle": "list" }
|
112
|
-
hash[
|
113
|
-
hash[
|
114
|
+
hash["aria-disabled"] = "#{true if item[:disabled]}" if item[:disabled]
|
115
|
+
hash['aria-controls'] = "#tab-#{item[:id]}-content"
|
116
|
+
hash[:role] = "tab"
|
114
117
|
hash[:path] = "#tab-#{item[:id]}-content"
|
115
118
|
hash[:target] = item[:target]
|
116
119
|
end
|
@@ -119,14 +122,14 @@ class Matestack::Ui::Bootstrap::Components::ListGroup < Matestack::Ui::Component
|
|
119
122
|
def transition_attrs(item)
|
120
123
|
attrs = item
|
121
124
|
attrs[:class] = "#{list_classes item, true}"
|
122
|
-
attrs[
|
125
|
+
attrs["aria-disabled"] = "#{true if item[:disabled]}" if item[:disabled]
|
123
126
|
attrs
|
124
127
|
end
|
125
128
|
|
126
129
|
def action_attrs(item)
|
127
130
|
attrs = item
|
128
131
|
attrs[:class] = "#{list_classes item, true}"
|
129
|
-
attrs[
|
132
|
+
attrs["aria-disabled"] = "#{true if item[:disabled]}" if item[:disabled]
|
130
133
|
attrs
|
131
134
|
end
|
132
135
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import * as bootstrap from 'bootstrap'
|
2
|
+
import MatestackUiVueJs from 'matestack-ui-vuejs'
|
2
3
|
|
3
|
-
|
4
|
-
mixins: [
|
4
|
+
const modalComponent = {
|
5
|
+
mixins: [MatestackUiVueJs.componentMixin],
|
6
|
+
template: MatestackUiVueJs.componentHelpers.inlineTemplate,
|
5
7
|
|
6
8
|
data() {
|
7
9
|
return {
|
@@ -29,62 +31,64 @@ MatestackUiCore.Vue.component('matestack-ui-bootstrap-modal', {
|
|
29
31
|
|
30
32
|
mounted: function() {
|
31
33
|
const self = this
|
32
|
-
|
33
|
-
self.modalInstance = new bootstrap.Modal(
|
34
|
+
const modalElement = self.getElement()
|
35
|
+
self.modalInstance = new bootstrap.Modal(modalElement)
|
34
36
|
},
|
35
37
|
|
36
38
|
created: function() {
|
37
39
|
const self = this
|
38
|
-
var eventHub =
|
40
|
+
var eventHub = MatestackUiVueJs.eventHub;
|
39
41
|
// toggle_on event registration
|
40
|
-
if(self.
|
41
|
-
var toggle_events = self.
|
42
|
+
if(self.props["toggle_on"] != undefined){
|
43
|
+
var toggle_events = self.props["toggle_on"].split(",")
|
42
44
|
toggle_events.forEach(toggle_event => eventHub.$on(toggle_event.trim(), self.toggle));
|
43
45
|
}
|
44
46
|
// show_on event registration
|
45
|
-
if(self.
|
46
|
-
var show_events = self.
|
47
|
+
if(self.props["show_on"] != undefined){
|
48
|
+
var show_events = self.props["show_on"].split(",")
|
47
49
|
show_events.forEach(show_event => eventHub.$on(show_event.trim(), self.show));
|
48
50
|
}
|
49
51
|
// hide_on event registration
|
50
|
-
if(self.
|
51
|
-
var hide_events = self.
|
52
|
+
if(self.props["hide_on"] != undefined){
|
53
|
+
var hide_events = self.props["hide_on"].split(",")
|
52
54
|
hide_events.forEach(hide_event => eventHub.$on(hide_event.trim(), self.hide));
|
53
55
|
}
|
54
56
|
// handle_update_on event registration
|
55
|
-
if(self.
|
56
|
-
var handle_update_events = self.
|
57
|
+
if(self.props["handle_update_on"] != undefined){
|
58
|
+
var handle_update_events = self.props["handle_update_on"].split(",")
|
57
59
|
handle_update_events.forEach(handle_update_event => eventHub.$on(handle_update_event.trim(), self.handle_update));
|
58
60
|
}
|
59
61
|
// dispose_on event registration
|
60
|
-
if(self.
|
61
|
-
var dispose_events = self.
|
62
|
+
if(self.props["dispose_on"] != undefined){
|
63
|
+
var dispose_events = self.props["dispose_on"].split(",")
|
62
64
|
dispose_events.forEach(dispose_event => eventHub.$on(dispose_event.trim(), self.dispose));
|
63
65
|
}
|
64
66
|
},
|
65
67
|
|
66
|
-
|
68
|
+
beforeUnmount: function() {
|
67
69
|
const self = this
|
68
|
-
var eventHub =
|
69
|
-
if(self.
|
70
|
-
var toggle_events = self.
|
70
|
+
var eventHub = MatestackUiVueJs.eventHub;
|
71
|
+
if(self.props["toggle_on"] != undefined){
|
72
|
+
var toggle_events = self.props["toggle_on"].split(",")
|
71
73
|
toggle_events.forEach(toggle_event => eventHub.$off(toggle_event.trim(), self.toggle));
|
72
74
|
}
|
73
|
-
if(self.
|
74
|
-
var show_events = self.
|
75
|
+
if(self.props["show_on"] != undefined){
|
76
|
+
var show_events = self.props["show_on"].split(",")
|
75
77
|
show_events.forEach(show_event => eventHub.$off(show_event.trim(), self.show));
|
76
78
|
}
|
77
|
-
if(self.
|
78
|
-
var hide_events = self.
|
79
|
+
if(self.props["hide_on"] != undefined){
|
80
|
+
var hide_events = self.props["hide_on"].split(",")
|
79
81
|
hide_events.forEach(hide_event => eventHub.$off(hide_event.trim(), self.hide));
|
80
82
|
}
|
81
|
-
if(self.
|
82
|
-
var handle_update_events = self.
|
83
|
+
if(self.props["handle_update_on"] != undefined){
|
84
|
+
var handle_update_events = self.props["handle_update_on"].split(",")
|
83
85
|
handle_update_events.forEach(handle_update_event => eventHub.$off(handle_update_event.trim(), self.handle_update));
|
84
86
|
}
|
85
|
-
if(self.
|
86
|
-
var dispose_events = self.
|
87
|
+
if(self.props["dispose_on"] != undefined){
|
88
|
+
var dispose_events = self.props["dispose_on"].split(",")
|
87
89
|
dispose_events.forEach(dispose_event => eventHub.$off(dispose_event.trim(), self.dispose));
|
88
90
|
}
|
89
91
|
},
|
90
|
-
}
|
92
|
+
}
|
93
|
+
|
94
|
+
export default modalComponent
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require_relative "../base_vue_js_component"
|
2
|
+
|
3
|
+
class Matestack::Ui::Bootstrap::Components::Modal < Matestack::Ui::Bootstrap::BaseVueJsComponent
|
4
|
+
vue_name 'matestack-ui-bootstrap-modal'
|
5
|
+
|
6
|
+
# header attributes, expects a hash or string
|
7
|
+
# possible keys `:class, :text, :size`
|
8
|
+
optional :header
|
9
|
+
# body attributes, expects a hash or string
|
10
|
+
# possible keys `:class, :text`
|
11
|
+
optional :body
|
12
|
+
# footer is a dismiss button, expects a hash or string for button text
|
13
|
+
# possible keys `:class, :text`
|
14
|
+
optional :footer
|
15
|
+
optional :fade, :size
|
16
|
+
optional :fullscreen # fullscreen attribute, expects boolean or bootstrap breakpoint
|
17
|
+
optional :static, :keyboard, :scrollable, :centered
|
18
|
+
optional :modal_dialog_class
|
19
|
+
optional :id
|
20
|
+
# event trigger
|
21
|
+
optional :toggle_on, :show_on, :hide_on, :handle_update_on, :dispose_on
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
def response
|
26
|
+
div modal_attributes do
|
27
|
+
div class: dialog_classes do
|
28
|
+
div class: "modal-content" do
|
29
|
+
header_partial if context.header || (slots && slots[:header])
|
30
|
+
body_partial if context.body || slots && slots[:body]
|
31
|
+
footer_partial if context.footer || (slots && slots[:footer])
|
32
|
+
yield if block_given?
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def vue_props
|
41
|
+
{}.tap do |props|
|
42
|
+
props[:toggle_on] = context.toggle_on
|
43
|
+
props[:show_on] = context.show_on
|
44
|
+
props[:hide_on] = context.hide_on
|
45
|
+
props[:handle_update_on] = context.handle_update_on
|
46
|
+
props[:dispose_on] = context.dispose_on
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def header_partial
|
51
|
+
header = context.header.is_a?(Hash) ? context.header : { text: context.header }
|
52
|
+
div class: "modal-header" do
|
53
|
+
if slots && slots[:header]
|
54
|
+
slot :header
|
55
|
+
else
|
56
|
+
heading header[:text], size: (header[:size] || 5), class: "modal-title #{header[:class]}" if header[:text].present?
|
57
|
+
bs_close dismiss: 'modal'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def body_partial
|
63
|
+
body = context.body.is_a?(Hash) ? context.body : { text: context.body }
|
64
|
+
div class: "modal-body #{body[:class]}".strip do
|
65
|
+
if slots && slots[:body]
|
66
|
+
slot :body
|
67
|
+
else
|
68
|
+
plain body[:text] if body[:text].present?
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def footer_partial
|
74
|
+
footer = context.footer.is_a?(Hash) ? context.footer : { text: context.footer }
|
75
|
+
div class: "modal-footer" do
|
76
|
+
slot :footer if slots && slots[:footer]
|
77
|
+
if footer[:text].present?
|
78
|
+
button class: "btn #{footer[:class].present? ? footer[:class] : 'btn-secondary'}",
|
79
|
+
data: { "bs-dismiss": 'modal' }, type: 'button' do
|
80
|
+
plain footer[:text]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def modal_attributes
|
87
|
+
attributes = {}.tap do |hash|
|
88
|
+
hash[:id] = context.id
|
89
|
+
hash[:class] = modal_classes
|
90
|
+
hash[:attributes] = { 'tabindex': "-1", 'aria-labelledby': "#{context.id}Label", 'aria-hidden': "true" }
|
91
|
+
hash[:data] = {}.tap do |data|
|
92
|
+
data[:backdrop] = "static" if context.static
|
93
|
+
data[:keyboard] = "false" if context.keyboard
|
94
|
+
end
|
95
|
+
end
|
96
|
+
options.merge(
|
97
|
+
attributes
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
101
|
+
def modal_classes
|
102
|
+
[].tap do |classes|
|
103
|
+
classes << 'modal'
|
104
|
+
classes << 'fade' if context.fade || !context.fade.present?
|
105
|
+
classes << context.bs_class
|
106
|
+
end.join(' ').strip
|
107
|
+
end
|
108
|
+
|
109
|
+
def dialog_classes
|
110
|
+
[].tap do |classes|
|
111
|
+
classes << 'modal-dialog'
|
112
|
+
classes << 'modal-dialog-centered' if context.centered
|
113
|
+
classes << 'modal-dialog-scrollable' if context.scrollable
|
114
|
+
classes << "modal-#{context.size}" if context.size
|
115
|
+
if context.fullscreen.present?
|
116
|
+
classes << (context.fullscreen == true ? 'modal-fullscreen' : "modal-fullscreen-#{context.fullscreen}-down")
|
117
|
+
end
|
118
|
+
classes << context.modal_dialog_class
|
119
|
+
end.join(' ').strip
|
120
|
+
end
|
121
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
1
|
+
require_relative "../base_component"
|
2
|
+
|
3
|
+
class Matestack::Ui::Bootstrap::Components::Navbar < Matestack::Ui::Bootstrap::BaseComponent
|
2
4
|
|
3
5
|
POS_ATTRIBUTES = %i[fixed_top fixed_bottom sticky_top]
|
4
6
|
optional *POS_ATTRIBUTES
|
5
7
|
|
6
|
-
optional class: { as:
|
8
|
+
optional class: { as: :bs_class }
|
7
9
|
optional :items, :items_class, :theme, :expand_at, :color, :container_size
|
8
10
|
optional :collapse_class
|
9
11
|
# brand expect hash or string, possible keys for hash: text, path, img
|
@@ -12,21 +14,22 @@ class Matestack::Ui::Bootstrap::Components::Navbar < Matestack::Ui::Component
|
|
12
14
|
# possible keys for hash: position, class
|
13
15
|
optional :toggle
|
14
16
|
|
17
|
+
|
15
18
|
def prepare
|
16
|
-
@toggle =
|
19
|
+
@toggle = context.toggle.is_a?(Hash) ? context.toggle : { position: context.toggle }
|
17
20
|
end
|
18
21
|
|
19
|
-
def response
|
22
|
+
def response(&block)
|
20
23
|
nav navbar_attributes do
|
21
|
-
bs_container size: "#{container_size.present? ? container_size : "fluid" }" do
|
24
|
+
bs_container size: "#{context.container_size.present? ? context.container_size : "fluid" }" do
|
22
25
|
# custom elements for navbar
|
23
|
-
if
|
24
|
-
slot
|
26
|
+
if slots && slots[:custom_items]
|
27
|
+
slot :custom_items
|
25
28
|
else
|
26
29
|
toggle_button if @toggle[:position] == :left
|
27
30
|
brand_partial
|
28
31
|
toggle_button if !@toggle[:position].present? || @toggle[:position] == :right
|
29
|
-
navbar_content_partial
|
32
|
+
navbar_content_partial(&block)
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
@@ -35,51 +38,57 @@ class Matestack::Ui::Bootstrap::Components::Navbar < Matestack::Ui::Component
|
|
35
38
|
protected
|
36
39
|
|
37
40
|
def brand_partial
|
38
|
-
brand =
|
41
|
+
brand = context.brand.is_a?(Hash) ? context.brand : { text: context.brand }
|
39
42
|
path = brand[:path].present? ? brand[:path] : "/"
|
40
43
|
brand[:path] = path
|
41
44
|
case brand[:type]
|
42
|
-
when :
|
43
|
-
|
44
|
-
img height: 40, path: brand[:img],
|
45
|
+
when :transition
|
46
|
+
transition brand.except(:text).merge(class: "navbar-brand") do
|
47
|
+
img height: 40, path: brand[:img], loading: "lazy" if brand[:img].present?
|
45
48
|
plain brand[:text]
|
46
49
|
end
|
47
50
|
else
|
48
|
-
|
49
|
-
img height: 40, path: brand[:img],
|
51
|
+
a brand.except(:text).merge(class: "navbar-brand") do
|
52
|
+
img height: 40, path: brand[:img], loading: "lazy" if brand[:img].present?
|
50
53
|
plain brand[:text]
|
51
54
|
end
|
52
55
|
end
|
53
56
|
end
|
54
57
|
|
55
|
-
def navbar_content_partial
|
56
|
-
div class: "collapse navbar-collapse #{collapse_class}", id: 'matestackNavbarContent' do
|
57
|
-
if items.present?
|
58
|
+
def navbar_content_partial(&block)
|
59
|
+
div class: "collapse navbar-collapse #{context.collapse_class}", id: 'matestackNavbarContent' do
|
60
|
+
if context.items.present?
|
58
61
|
ul class: items_classes do
|
59
|
-
items.each do |item|
|
62
|
+
context.items.each do |item|
|
60
63
|
li class: "nav-item" do
|
61
64
|
case item[:type]
|
62
65
|
when :link
|
63
|
-
|
66
|
+
a link_config(item) do
|
64
67
|
bs_icon name: item[:icon], size: 20 if item[:icon]
|
65
|
-
span class: "ps-3"
|
68
|
+
span class: "ps-3" do
|
69
|
+
plain item[:text] if item[:text]
|
70
|
+
end
|
66
71
|
end
|
67
72
|
when :action
|
68
73
|
action action_config(item) do
|
69
74
|
bs_icon name: item[:icon], size: 20 if item[:icon]
|
70
|
-
span class: "ps-3"
|
75
|
+
span class: "ps-3" do
|
76
|
+
plain item[:text] if item[:text]
|
77
|
+
end
|
71
78
|
end
|
72
79
|
else
|
73
80
|
transition transition_config(item) do
|
74
81
|
bs_icon name: item[:icon], size: 20 if item[:icon]
|
75
|
-
span class: "ps-3"
|
82
|
+
span class: "ps-3" do
|
83
|
+
plain item[:text] if item[:text]
|
84
|
+
end
|
76
85
|
end
|
77
86
|
end
|
78
87
|
end
|
79
88
|
end
|
80
89
|
end
|
81
90
|
end
|
82
|
-
|
91
|
+
yield if block_given?
|
83
92
|
end
|
84
93
|
end
|
85
94
|
|
@@ -102,7 +111,7 @@ class Matestack::Ui::Bootstrap::Components::Navbar < Matestack::Ui::Component
|
|
102
111
|
end
|
103
112
|
|
104
113
|
def navbar_attributes
|
105
|
-
|
114
|
+
options.merge(
|
106
115
|
class: navbar_classes
|
107
116
|
)
|
108
117
|
end
|
@@ -111,12 +120,12 @@ class Matestack::Ui::Bootstrap::Components::Navbar < Matestack::Ui::Component
|
|
111
120
|
[].tap do |classes|
|
112
121
|
classes << "navbar"
|
113
122
|
POS_ATTRIBUTES.each do |pos|
|
114
|
-
classes << "#{pos}".gsub('_','-') if
|
123
|
+
classes << "#{pos}".gsub('_','-') if context.send("#{pos}")
|
115
124
|
end
|
116
|
-
classes << "navbar-expand-#{ (expand_at.present? ? expand_at : "lg") }"
|
117
|
-
classes << "navbar-#{theme}" if theme.present?
|
118
|
-
classes << (color.present? ? "bg-#{color}" : "bg-#{theme}") if theme || color
|
119
|
-
classes << bs_class
|
125
|
+
classes << "navbar-expand-#{ (context.expand_at.present? ? context.expand_at : "lg") }"
|
126
|
+
classes << "navbar-#{context.theme}" if context.theme.present?
|
127
|
+
classes << (context.color.present? ? "bg-#{context.color}" : "bg-#{context.theme}") if context.theme || context.color
|
128
|
+
classes << context.bs_class
|
120
129
|
end.join(' ').strip
|
121
130
|
end
|
122
131
|
|
@@ -147,7 +156,7 @@ class Matestack::Ui::Bootstrap::Components::Navbar < Matestack::Ui::Component
|
|
147
156
|
def items_classes
|
148
157
|
[].tap do |classes|
|
149
158
|
classes << 'navbar-nav'
|
150
|
-
classes << (items_class.present? ? items_class : "ms-auto mb-2 mb-lg-0")
|
159
|
+
classes << (context.items_class.present? ? context.items_class : "ms-auto mb-2 mb-lg-0")
|
151
160
|
# classes << "ms-auto" unless items_class.present?
|
152
161
|
end.join(' ').strip
|
153
162
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require_relative "../base_component"
|
2
|
+
|
3
|
+
class Matestack::Ui::Bootstrap::Components::PageHeading < Matestack::Ui::Bootstrap::BaseComponent
|
2
4
|
|
3
5
|
optional :title, :subtitle, :icon
|
4
6
|
|
@@ -8,17 +10,17 @@ class Matestack::Ui::Bootstrap::Components::PageHeading < Matestack::Ui::Compone
|
|
8
10
|
bs_col do
|
9
11
|
div class: "page-heading-heading" do
|
10
12
|
heading size: 2 do
|
11
|
-
bs_icon name: icon, size: "35" if icon.present?
|
12
|
-
plain title
|
13
|
+
bs_icon name: context.icon, size: "35" if context.icon.present?
|
14
|
+
plain context.title
|
13
15
|
end
|
14
16
|
heading size: 6, class: "text-muted" do
|
15
|
-
plain subtitle
|
17
|
+
plain context.subtitle
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
bs_col md: 12, xl: 4, class: "text-xl-end mt-3" do
|
20
22
|
div class: "page-heading-actions text-xl-end" do
|
21
|
-
|
23
|
+
yield if block_given?
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
@@ -1,23 +1,25 @@
|
|
1
|
-
|
1
|
+
require_relative "../base_component"
|
2
2
|
|
3
|
-
|
3
|
+
class Matestack::Ui::Bootstrap::Components::Pagination < Matestack::Ui::Bootstrap::BaseComponent
|
4
|
+
|
5
|
+
optional :aria_label, :size
|
4
6
|
optional :items
|
5
7
|
|
6
8
|
def response
|
7
9
|
nav pagination_attributes do
|
8
10
|
ul class: ul_classes do
|
9
|
-
if items.present?
|
10
|
-
items.each do |item|
|
11
|
+
if context.items.present?
|
12
|
+
context.items.each do |item|
|
11
13
|
li class: "page-item #{ 'active' if item[:active] }" do
|
12
14
|
if item[:type] == :link
|
13
|
-
|
15
|
+
a item.merge({ class: 'page-link' })
|
14
16
|
else
|
15
17
|
transition item.merge({ class: 'page-link' })
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
20
|
-
|
22
|
+
yield if block_given?
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -25,15 +27,15 @@ class Matestack::Ui::Bootstrap::Components::Pagination < Matestack::Ui::Componen
|
|
25
27
|
protected
|
26
28
|
|
27
29
|
def pagination_attributes
|
28
|
-
|
29
|
-
|
30
|
+
options.merge(
|
31
|
+
'aria-label': "#{context.aria_label || 'Page navigation'}"
|
30
32
|
)
|
31
33
|
end
|
32
34
|
|
33
35
|
def ul_classes
|
34
36
|
[].tap do |classes|
|
35
37
|
classes << "pagination"
|
36
|
-
classes << "pagination-#{size}" if size.present?
|
38
|
+
classes << "pagination-#{context.size}" if context.size.present?
|
37
39
|
end.join(' ').strip
|
38
40
|
end
|
39
41
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import * as bootstrap from 'bootstrap'
|
2
|
+
|
3
|
+
import MatestackUiVueJs from 'matestack-ui-vuejs'
|
4
|
+
|
5
|
+
const popoverComponent = {
|
6
|
+
mixins: [MatestackUiVueJs.componentMixin],
|
7
|
+
template: MatestackUiVueJs.componentHelpers.inlineTemplate,
|
8
|
+
data() {
|
9
|
+
return {
|
10
|
+
popoverInstance: undefined
|
11
|
+
|
12
|
+
};
|
13
|
+
},
|
14
|
+
methods: {
|
15
|
+
|
16
|
+
},
|
17
|
+
mounted: function() {
|
18
|
+
const self = this;
|
19
|
+
const popoverElement = self.getElement()
|
20
|
+
self.popoverInstance = new bootstrap.Popover(popoverElement, {})
|
21
|
+
},
|
22
|
+
created: function() {
|
23
|
+
},
|
24
|
+
|
25
|
+
beforeUnmount: function() {
|
26
|
+
|
27
|
+
},
|
28
|
+
}
|
29
|
+
|
30
|
+
export default popoverComponent
|