matestack-ui-bootstrap 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +65 -7
- data/app/concepts/matestack/ui/bootstrap/components/accordion.rb +17 -14
- data/app/concepts/matestack/ui/bootstrap/components/alert.rb +1 -1
- data/app/concepts/matestack/ui/bootstrap/components/badge.rb +4 -4
- data/app/concepts/matestack/ui/bootstrap/components/breadcrumb.rb +8 -6
- data/app/concepts/matestack/ui/bootstrap/components/button.rb +18 -3
- data/app/concepts/matestack/ui/bootstrap/components/carousel.rb +15 -14
- data/app/concepts/matestack/ui/bootstrap/components/close.rb +1 -1
- data/app/concepts/matestack/ui/bootstrap/components/collapse.rb +6 -6
- data/app/concepts/matestack/ui/bootstrap/components/dropdown.rb +3 -2
- data/app/concepts/matestack/ui/bootstrap/components/list_group.rb +87 -25
- data/app/concepts/matestack/ui/bootstrap/components/modal.rb +1 -1
- data/app/concepts/matestack/ui/bootstrap/components/navbar.rb +54 -20
- data/app/concepts/matestack/ui/bootstrap/components/pagination.rb +5 -5
- data/app/concepts/matestack/ui/bootstrap/components/popover.rb +1 -1
- data/app/concepts/matestack/ui/bootstrap/components/progress.rb +7 -7
- data/app/concepts/matestack/ui/bootstrap/components/scrollspy.rb +15 -0
- data/app/concepts/matestack/ui/bootstrap/components/spinner.rb +1 -1
- data/app/concepts/matestack/ui/bootstrap/components/tab_nav.rb +4 -2
- data/app/concepts/matestack/ui/bootstrap/components/toast.js +7 -1
- data/app/concepts/matestack/ui/bootstrap/components/tooltip.rb +8 -26
- data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/collection.rb +18 -16
- data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/collection.scss +0 -0
- data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/content.rb +3 -3
- data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/filter.rb +3 -3
- data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/paginate.rb +3 -3
- data/app/concepts/matestack/ui/bootstrap/form/checkbox.rb +55 -46
- data/app/concepts/matestack/ui/bootstrap/form/input.rb +5 -16
- data/app/concepts/matestack/ui/bootstrap/form/radio.rb +22 -30
- data/app/concepts/matestack/ui/bootstrap/form/select.rb +12 -33
- data/app/concepts/matestack/ui/bootstrap/form/submit.rb +3 -2
- data/app/concepts/matestack/ui/bootstrap/form/switch.rb +80 -71
- data/app/concepts/matestack/ui/bootstrap/registry.rb +2 -4
- data/app/helpers/matestack/ui/bootstrap/application_helper.rb +9 -5
- data/app/javascript/matestack-ui-bootstrap/index.js +1 -3
- data/app/matestack/bootstrap/form/submit.rb +20 -0
- data/lib/matestack/ui/bootstrap/engine.rb +2 -2
- data/lib/matestack/ui/bootstrap/version.rb +1 -1
- data/lib/tasks/matestack/ui/bootstrap_tasks.rake +25 -25
- metadata +8 -12
- data/app/concepts/matestack/ui/bootstrap/components/chart.js +0 -232
- data/app/concepts/matestack/ui/bootstrap/components/chart.rb +0 -71
- data/app/concepts/matestack/ui/bootstrap/form/date.js +0 -38
- data/app/concepts/matestack/ui/bootstrap/form/date.rb +0 -98
- data/app/concepts/matestack/ui/bootstrap/form/select.haml +0 -11
@@ -1,71 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::Chart < Matestack::Ui::VueJsComponent
|
2
|
-
vue_js_component_name "matestack-ui-bootstrap-chart"
|
3
|
-
|
4
|
-
requires :type
|
5
|
-
requires :datasets
|
6
|
-
optional :labels
|
7
|
-
optional :height
|
8
|
-
optional :width
|
9
|
-
optional :display_legend
|
10
|
-
optional :display_x_axes
|
11
|
-
optional :display_y_axes
|
12
|
-
optional :cutout_percentage
|
13
|
-
optional class: { as: :bs_class }
|
14
|
-
|
15
|
-
def setup
|
16
|
-
@component_config[:type] = type
|
17
|
-
@component_config[:datasets] = datasets
|
18
|
-
@component_config[:labels] = labels
|
19
|
-
@component_config[:display_legend] = !display_legend.nil? ? display_legend : false
|
20
|
-
@component_config[:display_x_axes] = !display_x_axes.nil? ? display_x_axes : true
|
21
|
-
@component_config[:display_y_axes] = !display_y_axes.nil? ? display_y_axes : true
|
22
|
-
@component_config[:display_y_axes] = !display_y_axes.nil? ? display_y_axes : true
|
23
|
-
@component_config[:cutout_percentage] = !cutout_percentage.nil? ? cutout_percentage : 70
|
24
|
-
end
|
25
|
-
|
26
|
-
def response
|
27
|
-
div class: "chart-container #{bs_class}", attributes: { style: "width: 100%; height: 100%;" } do
|
28
|
-
plain "<canvas ref='chart'></canvas>".html_safe
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
# chart class: "w-50", type: :bar, datasets: [
|
35
|
-
# {
|
36
|
-
# label: "€",
|
37
|
-
# data: [total, last_7_days, last_30_days],
|
38
|
-
# backgroundColor: :primary
|
39
|
-
# },
|
40
|
-
# ], labels: ["total", "last 7 days", "last 30 days"]
|
41
|
-
|
42
|
-
# chart type: :doughnut, datasets: [
|
43
|
-
# {
|
44
|
-
# label: "€",
|
45
|
-
# data: [total, last_7_days, last_30_days],
|
46
|
-
# backgroundColor: [:orange, :secondary, :primary]
|
47
|
-
# },
|
48
|
-
# ], labels: ["total", "last 7 days", "last 30 days"]
|
49
|
-
|
50
|
-
# chart type: :line, datasets: [
|
51
|
-
# {
|
52
|
-
# label: "€",
|
53
|
-
# data: [total, last_7_days, last_30_days],
|
54
|
-
# borderColor: :primary,
|
55
|
-
# pointRadius: 0
|
56
|
-
# },
|
57
|
-
# {
|
58
|
-
# label: "€",
|
59
|
-
# data: [last_7_days, total, last_30_days],
|
60
|
-
# borderColor: :danger,
|
61
|
-
# fill: false
|
62
|
-
# },
|
63
|
-
# ], labels: ["total", "last 7 days", "last 30 days"], display_x_axes: false, display_y_axes: false
|
64
|
-
|
65
|
-
# chart type: :pie, datasets: [
|
66
|
-
# {
|
67
|
-
# label: "€",
|
68
|
-
# data: [total, last_7_days, last_30_days],
|
69
|
-
# backgroundColor: [:orange, :secondary, :primary]
|
70
|
-
# },
|
71
|
-
# ], labels: ["total", "last 7 days", "last 30 days"]
|
@@ -1,38 +0,0 @@
|
|
1
|
-
const bootstrap = require('bootstrap')
|
2
|
-
import flatpickr from "flatpickr";
|
3
|
-
|
4
|
-
MatestackUiCore.Vue.component('matestack-ui-bootstrap-date', {
|
5
|
-
mixins: [MatestackUiCore.componentMixin],
|
6
|
-
|
7
|
-
data() {
|
8
|
-
return {};
|
9
|
-
},
|
10
|
-
|
11
|
-
methods: {
|
12
|
-
|
13
|
-
},
|
14
|
-
|
15
|
-
mounted: function() {
|
16
|
-
const self = this
|
17
|
-
let data = this.$parent.data;
|
18
|
-
flatpickr(this.$el.querySelector('.flatpickr'), {
|
19
|
-
defaultDate: this.componentConfig["init_value"],
|
20
|
-
enableTime: (this.componentConfig["enable_time"] == true)
|
21
|
-
});
|
22
|
-
for (let key in this.$refs) {
|
23
|
-
let initValue = this.$refs[key]["attributes"]["init-value"];
|
24
|
-
|
25
|
-
if (initValue) {
|
26
|
-
data[key.replace("input.", "")] = initValue["value"];
|
27
|
-
} else {
|
28
|
-
data[key.replace("input.", "")] = null;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
this.$parent.data = data
|
32
|
-
|
33
|
-
//without the timeout it's somehow not working
|
34
|
-
setTimeout(function () {
|
35
|
-
self.$parent.data = data
|
36
|
-
}, 100);
|
37
|
-
}
|
38
|
-
});
|
@@ -1,98 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Form::Date < Matestack::Ui::Core::Component::Dynamic
|
2
|
-
|
3
|
-
include Matestack::Ui::Core::Form::Utils
|
4
|
-
include Matestack::Ui::Core::Form::HasInputHtmlAttributes
|
5
|
-
include Matestack::Ui::Core::Form::HasErrors
|
6
|
-
|
7
|
-
requires :key
|
8
|
-
optional :multiple, :init, for: { as: :input_for }, label: { as: :input_label }
|
9
|
-
|
10
|
-
optional :form_text
|
11
|
-
optional :disabled
|
12
|
-
optional :placeholder
|
13
|
-
|
14
|
-
optional :with_time
|
15
|
-
|
16
|
-
vue_js_component_name "matestack-ui-bootstrap-date"
|
17
|
-
|
18
|
-
def input_key
|
19
|
-
"$parent.data[\"#{key}\"]"
|
20
|
-
end
|
21
|
-
|
22
|
-
def error_key
|
23
|
-
"$parent.errors[\"#{key}\"]"
|
24
|
-
end
|
25
|
-
|
26
|
-
def setup
|
27
|
-
@component_config[:init_value] = init_value
|
28
|
-
@component_config[:with_time] = with_time
|
29
|
-
end
|
30
|
-
|
31
|
-
def response
|
32
|
-
div do
|
33
|
-
label for: attr_key, class: "form-label", text: input_label if input_label
|
34
|
-
input html_attributes.merge(attributes: vue_attributes).merge(bootstrap_input_attributes)
|
35
|
-
render_errors
|
36
|
-
render_form_text if form_text
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def vue_attributes
|
41
|
-
(options[:attributes] || {}).merge({
|
42
|
-
id: attr_key,
|
43
|
-
"@change": change_event,
|
44
|
-
ref: "input.#{attr_key}",
|
45
|
-
'init-value': init_value,
|
46
|
-
'v-bind:class': "{ '#{input_error_class}': #{error_key} }",
|
47
|
-
"aria-describedby": attr_key
|
48
|
-
}).merge({ "v-model": input_key })
|
49
|
-
end
|
50
|
-
|
51
|
-
def change_event
|
52
|
-
"$parent.inputChanged('#{attr_key}');".strip
|
53
|
-
end
|
54
|
-
|
55
|
-
def custom_options_validation
|
56
|
-
raise "included form config is missing, please add ':include' to parent form component" if @included_config.nil?
|
57
|
-
end
|
58
|
-
|
59
|
-
def attr_key
|
60
|
-
super
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def parse_value(value)
|
66
|
-
if [true, false].include? value
|
67
|
-
value ? 1 : 0
|
68
|
-
else
|
69
|
-
return value
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def bootstrap_input_attributes
|
74
|
-
{
|
75
|
-
class: (options[:class] || "") << (" form-control flatpickr"),
|
76
|
-
disabled: disabled
|
77
|
-
}
|
78
|
-
end
|
79
|
-
|
80
|
-
def render_errors
|
81
|
-
unless @included_config[:errors] == false && (errors == false || errors.nil?) || errors == false
|
82
|
-
div class: 'invalid-feedback', attributes: { 'v-for': "error in #{error_key}" } do
|
83
|
-
plain '{{ error }}'
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def input_error_class
|
89
|
-
'is-invalid'
|
90
|
-
end
|
91
|
-
|
92
|
-
def render_form_text
|
93
|
-
div id: "form_text_for_#{attr_key}", class: "form-text" do
|
94
|
-
plain form_text
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
- if input_label
|
2
|
-
%label{ for: attr_key, class: "form-label" }= input_label
|
3
|
-
|
4
|
-
%select{ html_attributes.merge(vue_attributes) }
|
5
|
-
- if placeholder
|
6
|
-
%option{value: placeholder_value, disabled: true, selected: init_value.nil?}= placeholder
|
7
|
-
- select_options.to_a.each do |item|
|
8
|
-
%option{value: item_value(item), disabled: item_disabled(item)}= item_label(item)
|
9
|
-
= render_errors
|
10
|
-
- if form_text
|
11
|
-
= render_form_text
|