matestack-ui-core 1.0.0.rc.1 → 1.3.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 +784 -18
- data/app/concepts/matestack/ui/core/abbr/abbr.haml +1 -1
- data/app/concepts/matestack/ui/core/abbr/abbr.rb +0 -8
- data/app/concepts/matestack/ui/core/action/action.haml +1 -1
- data/app/concepts/matestack/ui/core/actionview/dynamic.haml +4 -4
- data/app/concepts/matestack/ui/core/address/address.haml +2 -2
- data/app/concepts/matestack/ui/core/app/store.js +5 -1
- data/app/concepts/matestack/ui/core/area/area.haml +1 -1
- data/app/concepts/matestack/ui/core/area/area.rb +2 -16
- data/app/concepts/matestack/ui/core/article/article.haml +3 -3
- data/app/concepts/matestack/ui/core/article/article.rb +1 -1
- data/app/concepts/matestack/ui/core/aside/aside.haml +1 -1
- data/app/concepts/matestack/ui/core/aside/aside.rb +0 -1
- data/app/concepts/matestack/ui/core/async/async.js +6 -28
- data/app/concepts/matestack/ui/core/async/async.rb +11 -11
- data/app/concepts/matestack/ui/core/async/children_wrapper.haml +1 -1
- data/app/concepts/matestack/ui/core/b/b.haml +3 -3
- data/app/concepts/matestack/ui/core/b/b.rb +1 -1
- data/app/concepts/matestack/ui/core/bdi/bdi.haml +3 -3
- data/app/concepts/matestack/ui/core/bdi/bdi.rb +1 -0
- data/app/concepts/matestack/ui/core/bdo/bdo.haml +3 -3
- data/app/concepts/matestack/ui/core/bdo/bdo.rb +2 -7
- data/app/concepts/matestack/ui/core/blockquote/blockquote.haml +3 -3
- data/app/concepts/matestack/ui/core/blockquote/blockquote.rb +2 -7
- data/app/concepts/matestack/ui/core/br/br.haml +4 -4
- data/app/concepts/matestack/ui/core/br/br.rb +1 -1
- data/app/concepts/matestack/ui/core/button/button.haml +3 -3
- data/app/concepts/matestack/ui/core/button/button.rb +3 -7
- data/app/concepts/matestack/ui/core/cable/cable.haml +4 -0
- data/app/concepts/matestack/ui/core/cable/cable.js +100 -0
- data/app/concepts/matestack/ui/core/cable/cable.rb +28 -0
- data/app/concepts/matestack/ui/core/cable/children_wrapper.haml +2 -0
- data/app/concepts/matestack/ui/core/caption/caption.haml +3 -3
- data/app/concepts/matestack/ui/core/caption/caption.rb +1 -1
- data/app/concepts/matestack/ui/core/cite/cite.haml +3 -3
- data/app/concepts/matestack/ui/core/cite/cite.rb +1 -1
- data/app/concepts/matestack/ui/core/code/code.haml +3 -3
- data/app/concepts/matestack/ui/core/code/code.rb +1 -1
- data/app/concepts/matestack/ui/core/collection/content/content.js +2 -2
- data/app/concepts/matestack/ui/core/collection/content/content.rb +4 -6
- data/app/concepts/matestack/ui/core/collection/content/next/next.haml +1 -1
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.haml +1 -1
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.rb +1 -1
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.haml +1 -1
- data/app/concepts/matestack/ui/core/collection/filter/filter.rb +1 -1
- data/app/concepts/matestack/ui/core/collection/filter/input/input.rb +11 -8
- data/app/concepts/matestack/ui/core/collection/filter/reset/reset.haml +1 -1
- data/app/concepts/matestack/ui/core/collection/filter/select/select.haml +6 -6
- data/app/concepts/matestack/ui/core/collection/filter/select/select.rb +10 -9
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.haml +1 -1
- data/app/concepts/matestack/ui/core/collection/order/order.rb +1 -1
- data/app/concepts/matestack/ui/core/collection/order/toggle/indicator/indicator.rb +5 -2
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.haml +1 -1
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.rb +0 -1
- data/app/concepts/matestack/ui/core/component/base.rb +10 -4
- data/app/concepts/matestack/ui/core/component/component.js +18 -1
- data/app/concepts/matestack/ui/core/component/dynamic.rb +2 -1
- data/app/concepts/matestack/ui/core/data/data.haml +3 -3
- data/app/concepts/matestack/ui/core/data/data.rb +2 -5
- data/app/concepts/matestack/ui/core/datalist/datalist.haml +2 -2
- data/app/concepts/matestack/ui/core/datalist/datalist.rb +1 -2
- data/app/concepts/matestack/ui/core/dd/dd.haml +3 -3
- data/app/concepts/matestack/ui/core/dd/dd.rb +1 -1
- data/app/concepts/matestack/ui/core/del/del.haml +3 -3
- data/app/concepts/matestack/ui/core/del/del.rb +2 -0
- data/app/concepts/matestack/ui/core/details/details.haml +1 -1
- data/app/concepts/matestack/ui/core/details/details.rb +1 -1
- data/app/concepts/matestack/ui/core/dfn/dfn.haml +3 -3
- data/app/concepts/matestack/ui/core/dfn/dfn.rb +1 -1
- data/app/concepts/matestack/ui/core/dialog/dialog.haml +3 -3
- data/app/concepts/matestack/ui/core/dialog/dialog.rb +2 -5
- data/app/concepts/matestack/ui/core/div/div.haml +1 -1
- data/app/concepts/matestack/ui/core/div/div.rb +0 -1
- data/app/concepts/matestack/ui/core/dl/dl.haml +3 -3
- data/app/concepts/matestack/ui/core/dl/dl.rb +2 -2
- data/app/concepts/matestack/ui/core/dt/dt.haml +3 -3
- data/app/concepts/matestack/ui/core/dt/dt.rb +1 -1
- data/app/concepts/matestack/ui/core/em/em.haml +3 -3
- data/app/concepts/matestack/ui/core/em/em.rb +1 -1
- data/app/concepts/matestack/ui/core/fieldset/fieldset.haml +4 -4
- data/app/concepts/matestack/ui/core/fieldset/fieldset.rb +3 -6
- data/app/concepts/matestack/ui/core/figure/figure.haml +1 -1
- data/app/concepts/matestack/ui/core/figure/figure.rb +0 -1
- data/app/concepts/matestack/ui/core/footer/footer.haml +1 -1
- data/app/concepts/matestack/ui/core/footer/footer.rb +0 -1
- data/app/concepts/matestack/ui/core/form/checkbox/base.rb +120 -0
- data/app/concepts/matestack/ui/core/form/checkbox/checkbox.js +15 -0
- data/app/concepts/matestack/ui/core/form/checkbox/checkbox.rb +7 -70
- data/app/concepts/matestack/ui/core/form/checkbox/mixin.js +80 -0
- data/app/concepts/matestack/ui/core/form/form.haml +1 -1
- data/app/concepts/matestack/ui/core/form/form.js +15 -46
- data/app/concepts/matestack/ui/core/form/form.rb +34 -28
- data/app/concepts/matestack/ui/core/form/input/base.rb +75 -0
- data/app/concepts/matestack/ui/core/form/input/input.js +15 -0
- data/app/concepts/matestack/ui/core/form/input/input.rb +8 -52
- data/app/concepts/matestack/ui/core/form/input/mixin.js +55 -0
- data/app/concepts/matestack/ui/core/form/radio/base.rb +90 -0
- data/app/concepts/matestack/ui/core/form/radio/mixin.js +62 -0
- data/app/concepts/matestack/ui/core/form/radio/radio.js +15 -0
- data/app/concepts/matestack/ui/core/form/radio/radio.rb +7 -62
- data/app/concepts/matestack/ui/core/form/select/base.rb +98 -0
- data/app/concepts/matestack/ui/core/form/select/mixin.js +58 -0
- data/app/concepts/matestack/ui/core/form/select/select.js +15 -0
- data/app/concepts/matestack/ui/core/form/select/select.rb +11 -80
- data/app/concepts/matestack/ui/core/form/submit/base.rb +12 -0
- data/app/concepts/matestack/ui/core/form/submit/submit.js +19 -0
- data/app/concepts/matestack/ui/core/form/submit/submit.rb +9 -6
- data/app/concepts/matestack/ui/core/form/textarea/base.rb +49 -0
- data/app/concepts/matestack/ui/core/form/textarea/mixin.js +41 -0
- data/app/concepts/matestack/ui/core/form/textarea/textarea.js +15 -0
- data/app/concepts/matestack/ui/core/form/textarea/textarea.rb +10 -21
- data/app/concepts/matestack/ui/core/header/header.haml +1 -1
- data/app/concepts/matestack/ui/core/header/header.rb +0 -1
- data/app/concepts/matestack/ui/core/heading/heading.haml +4 -49
- data/app/concepts/matestack/ui/core/heading/heading.rb +1 -3
- data/app/concepts/matestack/ui/core/hr/hr.haml +1 -1
- data/app/concepts/matestack/ui/core/hr/hr.rb +0 -1
- data/app/concepts/matestack/ui/core/icon/icon.haml +3 -3
- data/app/concepts/matestack/ui/core/icon/icon.rb +1 -1
- data/app/concepts/matestack/ui/core/iframe/iframe.haml +3 -3
- data/app/concepts/matestack/ui/core/iframe/iframe.rb +3 -10
- data/app/concepts/matestack/ui/core/img/img.haml +1 -1
- data/app/concepts/matestack/ui/core/img/img.rb +8 -8
- data/app/concepts/matestack/ui/core/input/input.rb +0 -4
- data/app/concepts/matestack/ui/core/ins/ins.haml +3 -3
- data/app/concepts/matestack/ui/core/ins/ins.rb +2 -6
- data/app/concepts/matestack/ui/core/isolated/children_wrapper.haml +1 -1
- data/app/concepts/matestack/ui/core/isolated/isolated.rb +1 -1
- data/app/concepts/matestack/ui/core/js/core.js +12 -0
- data/app/concepts/matestack/ui/core/kbd/kbd.haml +3 -3
- data/app/concepts/matestack/ui/core/kbd/kbd.rb +1 -0
- data/app/concepts/matestack/ui/core/label/label.haml +3 -3
- data/app/concepts/matestack/ui/core/label/label.rb +2 -6
- data/app/concepts/matestack/ui/core/legend/legend.haml +3 -3
- data/app/concepts/matestack/ui/core/legend/legend.rb +1 -1
- data/app/concepts/matestack/ui/core/li/li.haml +3 -3
- data/app/concepts/matestack/ui/core/li/li.rb +2 -1
- data/app/concepts/matestack/ui/core/link/link.haml +3 -3
- data/app/concepts/matestack/ui/core/link/link.rb +10 -14
- data/app/concepts/matestack/ui/core/main/main.haml +1 -1
- data/app/concepts/matestack/ui/core/main/main.rb +0 -1
- data/app/concepts/matestack/ui/core/map/map.haml +1 -1
- data/app/concepts/matestack/ui/core/map/map.rb +1 -7
- data/app/concepts/matestack/ui/core/mark/mark.haml +3 -3
- data/app/concepts/matestack/ui/core/mark/mark.rb +1 -0
- data/app/concepts/matestack/ui/core/meter/meter.haml +1 -1
- data/app/concepts/matestack/ui/core/meter/meter.rb +1 -10
- data/app/concepts/matestack/ui/core/nav/nav.haml +1 -1
- data/app/concepts/matestack/ui/core/nav/nav.rb +0 -1
- data/app/concepts/matestack/ui/core/noscript/noscript.haml +3 -3
- data/app/concepts/matestack/ui/core/noscript/noscript.rb +1 -1
- data/app/concepts/matestack/ui/core/object/object.haml +1 -1
- data/app/concepts/matestack/ui/core/object/object.rb +1 -11
- data/app/concepts/matestack/ui/core/ol/ol.haml +1 -1
- data/app/concepts/matestack/ui/core/ol/ol.rb +1 -1
- data/app/concepts/matestack/ui/core/onclick/onclick.haml +1 -1
- data/app/concepts/matestack/ui/core/optgroup/optgroup.haml +1 -1
- data/app/concepts/matestack/ui/core/optgroup/optgroup.rb +1 -6
- data/app/concepts/matestack/ui/core/option/option.haml +3 -3
- data/app/concepts/matestack/ui/core/option/option.rb +2 -8
- data/app/concepts/matestack/ui/core/output/output.haml +3 -3
- data/app/concepts/matestack/ui/core/output/output.rb +2 -7
- data/app/concepts/matestack/ui/core/page/content/content.rb +0 -1
- data/app/concepts/matestack/ui/core/page/page.haml +1 -1
- data/app/concepts/matestack/ui/core/paragraph/paragraph.haml +3 -3
- data/app/concepts/matestack/ui/core/paragraph/paragraph.rb +1 -1
- data/app/concepts/matestack/ui/core/param/param.haml +1 -1
- data/app/concepts/matestack/ui/core/param/param.rb +1 -6
- data/app/concepts/matestack/ui/core/partial/partial.rb +0 -1
- data/app/concepts/matestack/ui/core/picture/picture.haml +1 -1
- data/app/concepts/matestack/ui/core/pre/pre.haml +3 -3
- data/app/concepts/matestack/ui/core/pre/pre.rb +1 -1
- data/app/concepts/matestack/ui/core/progress/progress.haml +1 -1
- data/app/concepts/matestack/ui/core/progress/progress.rb +1 -10
- data/app/concepts/matestack/ui/core/q/q.haml +3 -3
- data/app/concepts/matestack/ui/core/q/q.rb +2 -7
- data/app/concepts/matestack/ui/core/rp/rp.haml +3 -3
- data/app/concepts/matestack/ui/core/rp/rp.rb +1 -1
- data/app/concepts/matestack/ui/core/rt/rt.haml +3 -3
- data/app/concepts/matestack/ui/core/rt/rt.rb +1 -1
- data/app/concepts/matestack/ui/core/ruby/ruby.haml +3 -3
- data/app/concepts/matestack/ui/core/ruby/ruby.rb +1 -1
- data/app/concepts/matestack/ui/core/s/s.haml +3 -3
- data/app/concepts/matestack/ui/core/s/s.rb +1 -1
- data/app/concepts/matestack/ui/core/samp/samp.haml +3 -3
- data/app/concepts/matestack/ui/core/samp/samp.rb +1 -0
- data/app/concepts/matestack/ui/core/section/section.haml +1 -1
- data/app/concepts/matestack/ui/core/section/section.rb +0 -1
- data/app/concepts/matestack/ui/core/{form/submit/submit.haml → select/select.haml} +1 -1
- data/app/concepts/matestack/ui/core/select/select.rb +7 -0
- data/app/concepts/matestack/ui/core/slot/slot.rb +0 -1
- data/app/concepts/matestack/ui/core/small/small.haml +3 -3
- data/app/concepts/matestack/ui/core/small/small.rb +1 -1
- data/app/concepts/matestack/ui/core/span/span.haml +3 -3
- data/app/concepts/matestack/ui/core/span/span.rb +1 -1
- data/app/concepts/matestack/ui/core/strong/strong.haml +3 -3
- data/app/concepts/matestack/ui/core/strong/strong.rb +1 -1
- data/app/concepts/matestack/ui/core/sub/sub.haml +3 -3
- data/app/concepts/matestack/ui/core/sub/sub.rb +1 -1
- data/app/concepts/matestack/ui/core/summary/summary.haml +3 -3
- data/app/concepts/matestack/ui/core/summary/summary.rb +1 -1
- data/app/concepts/matestack/ui/core/sup/sup.haml +3 -3
- data/app/concepts/matestack/ui/core/sup/sup.rb +1 -1
- data/app/concepts/matestack/ui/core/table/table.haml +1 -1
- data/app/concepts/matestack/ui/core/table/table.rb +0 -1
- data/app/concepts/matestack/ui/core/tbody/tbody.haml +1 -1
- data/app/concepts/matestack/ui/core/tbody/tbody.rb +0 -1
- data/app/concepts/matestack/ui/core/td/td.haml +3 -3
- data/app/concepts/matestack/ui/core/td/td.rb +2 -1
- data/app/concepts/matestack/ui/core/template/template.haml +1 -1
- data/app/concepts/matestack/ui/core/textarea/textarea.haml +4 -1
- data/app/concepts/matestack/ui/core/tfoot/tfoot.haml +1 -1
- data/app/concepts/matestack/ui/core/tfoot/tfoot.rb +0 -1
- data/app/concepts/matestack/ui/core/th/th.haml +3 -3
- data/app/concepts/matestack/ui/core/th/th.rb +2 -1
- data/app/concepts/matestack/ui/core/thead/thead.haml +1 -1
- data/app/concepts/matestack/ui/core/thead/thead.rb +0 -1
- data/app/concepts/matestack/ui/core/time/time.haml +1 -1
- data/app/concepts/matestack/ui/core/time/time.rb +1 -7
- data/app/concepts/matestack/ui/core/toggle/toggle.haml +1 -1
- data/app/concepts/matestack/ui/core/toggle/toggle.rb +4 -5
- data/app/concepts/matestack/ui/core/tr/tr.haml +1 -1
- data/app/concepts/matestack/ui/core/tr/tr.rb +0 -1
- data/app/concepts/matestack/ui/core/transition/transition.haml +3 -3
- data/app/concepts/matestack/ui/core/transition/transition.rb +13 -7
- data/app/concepts/matestack/ui/core/u/u.haml +3 -3
- data/app/concepts/matestack/ui/core/u/u.rb +1 -1
- data/app/concepts/matestack/ui/core/ul/ul.haml +1 -1
- data/app/concepts/matestack/ui/core/ul/ul.rb +0 -1
- data/app/concepts/matestack/ui/core/unescaped/unescaped.rb +2 -0
- data/app/concepts/matestack/ui/core/var/var.haml +3 -3
- data/app/concepts/matestack/ui/core/var/var.rb +1 -0
- data/app/concepts/matestack/ui/core/video/video.haml +2 -2
- data/app/concepts/matestack/ui/core/video/video.rb +3 -13
- data/app/concepts/matestack/ui/core/wbr/wbr.haml +5 -1
- data/app/concepts/matestack/ui/core/wbr/wbr.rb +1 -0
- data/app/concepts/matestack/ui/core/youtube/youtube.haml +1 -1
- data/app/concepts/matestack/ui/core/youtube/youtube.rb +18 -16
- data/app/helpers/matestack/ui/core/application_helper.rb +6 -2
- data/app/javascript/matestack-ui-core/index.js +12 -2
- data/app/lib/matestack/ui/core/has_view_context.rb +4 -2
- data/app/lib/matestack/ui/core/html_attributes.rb +1 -1
- data/app/lib/matestack/ui/core/properties.rb +95 -22
- data/app/lib/matestack/ui/core/rendering/main_renderer.rb +11 -7
- data/lib/matestack/ui/core/components.rb +6 -2
- data/lib/matestack/ui/core/version.rb +1 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.js +773 -99
- data/vendor/assets/javascripts/dist/matestack-ui-core.js.map +1 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js +1 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.br +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.gz +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map +1 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.br +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.gz +0 -0
- metadata +29 -8
- data/app/concepts/matestack/ui/core/collection/filter/input/input.haml +0 -2
- data/app/concepts/matestack/ui/core/component/rerender.rb +0 -8
- data/app/concepts/matestack/ui/core/form/select/select.haml +0 -9
@@ -1,3 +1,3 @@
|
|
1
|
-
%video{
|
2
|
-
%source{:
|
1
|
+
%video{ html_attributes }
|
2
|
+
%source{ src: @source, type: @type}
|
3
3
|
Your browser does not support the video tag.
|
@@ -1,22 +1,12 @@
|
|
1
1
|
module Matestack::Ui::Core::Video
|
2
2
|
class Video < Matestack::Ui::Core::Component::Static
|
3
|
+
html_attributes :autoplay, :controls, :height, :loop, :muted, :poster, :preload, :src, :width
|
3
4
|
|
4
5
|
requires :path, :type
|
5
6
|
|
6
7
|
def setup
|
7
|
-
@
|
8
|
-
|
9
|
-
controls: options[:controls],
|
10
|
-
height: options[:height],
|
11
|
-
loop: options[:loop],
|
12
|
-
muted: options[:muted],
|
13
|
-
playsinline: options[:playsinline],
|
14
|
-
preload: options[:preload],
|
15
|
-
width: options[:width]
|
16
|
-
})
|
17
|
-
|
18
|
-
@source = ActionController::Base.helpers.asset_path(options[:path])
|
19
|
-
@type = "video/#{@options[:type]}"
|
8
|
+
@source = ActionController::Base.helpers.asset_path(path)
|
9
|
+
@type = "video/#{type}"
|
20
10
|
end
|
21
11
|
|
22
12
|
end
|
@@ -1 +1 @@
|
|
1
|
-
%iframe{
|
1
|
+
%iframe{ youtube_attributes }
|
@@ -1,25 +1,27 @@
|
|
1
1
|
module Matestack::Ui::Core::Youtube
|
2
2
|
class Youtube < Matestack::Ui::Core::Component::Static
|
3
|
+
html_attributes :allow, :allowfullscreen, :allowpaymentrequest, :height, :name,
|
4
|
+
:referrerpolicy, :sandbox, :src, :srcdoc, :width
|
3
5
|
|
4
|
-
requires :
|
6
|
+
requires :youtube_id
|
7
|
+
optional :privacy_mode, :no_controls, :start_at
|
5
8
|
|
6
9
|
def setup
|
7
|
-
url = 'https://www.youtube.com/embed/'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
url = privacy_mode ? 'https://www.youtube-nocookie.com/embed/' : 'https://www.youtube.com/embed/'
|
11
|
+
@uri = URI("#{url}#{youtube_id}")
|
12
|
+
@uri.query = {
|
13
|
+
controls: (no_controls ? 0 : 1),
|
14
|
+
start: start_at
|
15
|
+
}.to_query
|
16
|
+
end
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
'
|
20
|
-
|
21
|
-
|
22
|
-
})
|
18
|
+
def youtube_attributes
|
19
|
+
html_attributes.merge(
|
20
|
+
src: @uri.to_s,
|
21
|
+
allow: 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture',
|
22
|
+
allowfullscreen: '',
|
23
|
+
frameborder: 0,
|
24
|
+
)
|
23
25
|
end
|
24
26
|
|
25
27
|
end
|
@@ -14,6 +14,7 @@ module Matestack
|
|
14
14
|
def self.included(base)
|
15
15
|
base.extend(ClassMethods)
|
16
16
|
end
|
17
|
+
|
17
18
|
module ClassMethods
|
18
19
|
def matestack_app _class
|
19
20
|
@matestack_app_class = _class
|
@@ -98,8 +99,11 @@ module Matestack
|
|
98
99
|
end
|
99
100
|
|
100
101
|
def matestack_component(component, options = {}, &block)
|
101
|
-
|
102
|
-
|
102
|
+
controller = (self.class <= ActionController::Base) ? self : @_controller
|
103
|
+
context = (options[:matestack_context] ||= {}).merge(controller: controller)
|
104
|
+
Matestack::Ui::Core::Component::Base
|
105
|
+
.new(options.merge(context: context, matestack_context: context))
|
106
|
+
.send(component, options.merge(context: context, matestack_context: context), &block).to_s
|
103
107
|
end
|
104
108
|
end
|
105
109
|
end
|
@@ -5,6 +5,11 @@ import axios from 'axios'
|
|
5
5
|
// Import from app/concepts/matestack/ui/core:
|
6
6
|
import matestackEventHub from '../../../app/concepts/matestack/ui/core/js/event-hub'
|
7
7
|
import componentMixin from '../../../app/concepts/matestack/ui/core/component/component'
|
8
|
+
import formInputMixin from '../../../app/concepts/matestack/ui/core/form/input/mixin'
|
9
|
+
import formSelectMixin from '../../../app/concepts/matestack/ui/core/form/select/mixin'
|
10
|
+
import formRadioMixin from '../../../app/concepts/matestack/ui/core/form/radio/mixin'
|
11
|
+
import formCheckboxMixin from '../../../app/concepts/matestack/ui/core/form/checkbox/mixin'
|
12
|
+
import formTextareaMixin from '../../../app/concepts/matestack/ui/core/form/textarea/mixin'
|
8
13
|
import matestackUiCore from '../../../app/concepts/matestack/ui/core/js/core'
|
9
14
|
|
10
15
|
import styles from './styles/index.scss'
|
@@ -14,9 +19,14 @@ const MatestackUiCore = {
|
|
14
19
|
Vuex,
|
15
20
|
axios,
|
16
21
|
matestackEventHub,
|
17
|
-
componentMixin
|
22
|
+
componentMixin,
|
23
|
+
formInputMixin,
|
24
|
+
formSelectMixin,
|
25
|
+
formCheckboxMixin,
|
26
|
+
formTextareaMixin,
|
27
|
+
formRadioMixin
|
18
28
|
}
|
19
29
|
|
20
30
|
window.MatestackUiCore = MatestackUiCore
|
21
31
|
|
22
|
-
export default MatestackUiCore
|
32
|
+
export default MatestackUiCore
|
@@ -2,8 +2,10 @@ module Matestack::Ui::Core::HasViewContext
|
|
2
2
|
def initialize(*args)
|
3
3
|
super
|
4
4
|
@view_context = @options.dig(:context, :view_context)
|
5
|
+
unless @view_context
|
6
|
+
@view_context = @options.dig(:matestack_context, :controller)&.view_context
|
7
|
+
end
|
5
8
|
end
|
6
|
-
|
7
9
|
def method_missing(*args, &block)
|
8
10
|
if @view_context.respond_to? args.first
|
9
11
|
@view_context.send(*args, &block)
|
@@ -11,4 +13,4 @@ module Matestack::Ui::Core::HasViewContext
|
|
11
13
|
raise NameError, "NameError: undefined method or local variable `#{args.first}' for #{self.class.name}"
|
12
14
|
end
|
13
15
|
end
|
14
|
-
end
|
16
|
+
end
|
@@ -10,7 +10,6 @@ module Matestack::Ui::Core::HtmlAttributes
|
|
10
10
|
:onoffline, :ononline, :onpagehide, :onpageshow, :onpopstate, :onresize, :onstorage, :onunload
|
11
11
|
]
|
12
12
|
|
13
|
-
# prepend the initializer and add class methods
|
14
13
|
def self.included(base)
|
15
14
|
base.class_eval do
|
16
15
|
extend ClassMethods
|
@@ -20,6 +19,7 @@ module Matestack::Ui::Core::HtmlAttributes
|
|
20
19
|
module ClassMethods
|
21
20
|
|
22
21
|
def inherited(subclass)
|
22
|
+
super
|
23
23
|
subclass.html_attributes *self.allowed_html_attributes
|
24
24
|
end
|
25
25
|
|
@@ -18,21 +18,63 @@ module Matestack::Ui::Core::Properties
|
|
18
18
|
module Initializer
|
19
19
|
def initialize(model=nil, options={})
|
20
20
|
options = model.dup if options.empty? && model.is_a?(Hash)
|
21
|
-
required_hooks(options)
|
22
|
-
optional_hooks(options)
|
21
|
+
# required_hooks(options)
|
22
|
+
# optional_hooks(options)
|
23
|
+
set_values(options) unless options[:skip_set_values]
|
23
24
|
super
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
28
|
module ClassMethods
|
29
|
+
|
30
|
+
def inherited(subclass)
|
31
|
+
super
|
32
|
+
# self.new(nil, skip_set_values: true)
|
33
|
+
subclass.property_keys *self.all_property_keys
|
34
|
+
subclass.all_required_properties.concat(self.all_required_properties)
|
35
|
+
subclass.created_properties.concat(self.created_properties)
|
36
|
+
end
|
37
|
+
|
38
|
+
# contains all property keys, or property hashes regardless of wheter they are optional or required
|
39
|
+
# used in order to initialize values of properties correctly for subclasses and make properties inheritable
|
40
|
+
def all_property_keys
|
41
|
+
@all_properties.flatten!&.uniq! if defined? @all_properties
|
42
|
+
@all_properties ||= []
|
43
|
+
end
|
44
|
+
|
45
|
+
def all_required_properties
|
46
|
+
@all_required_properties ||= []
|
47
|
+
end
|
48
|
+
|
49
|
+
def created_properties
|
50
|
+
@created_properties ||= []
|
51
|
+
end
|
52
|
+
|
53
|
+
# add property keys to array containing all property keys
|
54
|
+
def property_keys(*attributes)
|
55
|
+
attributes.each do |attribute|
|
56
|
+
if attribute.is_a?(Hash)
|
57
|
+
attribute.each do |temp|
|
58
|
+
all_property_keys.push({ "#{temp.first}": temp.last})
|
59
|
+
end
|
60
|
+
else
|
61
|
+
all_property_keys.push(attribute)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
28
66
|
# define optinoal properties for custom components with `optional :foo, :bar`
|
29
67
|
def optional(*properties)
|
68
|
+
property_keys *properties
|
30
69
|
add_properties_to_list(optional_properties, properties)
|
70
|
+
optional_hooks
|
31
71
|
end
|
32
72
|
|
33
73
|
# define required properties for custom components with `requires :title, :foo, :bar`
|
34
74
|
def requires(*properties)
|
75
|
+
property_keys *properties
|
35
76
|
add_properties_to_list(requires_properties, properties)
|
77
|
+
required_hooks
|
36
78
|
end
|
37
79
|
|
38
80
|
def add_properties_to_list(list, properties)
|
@@ -47,42 +89,73 @@ module Matestack::Ui::Core::Properties
|
|
47
89
|
|
48
90
|
# array of properties created from the component
|
49
91
|
def optional_properties
|
50
|
-
@
|
92
|
+
@optional_properties ||= []
|
51
93
|
end
|
52
94
|
|
53
95
|
# array of required properties from the component
|
54
96
|
def requires_properties
|
55
97
|
@requires_properties ||= []
|
56
98
|
end
|
57
|
-
end
|
58
99
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
options[hash.last[:as]] = options[hash.first]
|
64
|
-
prop = hash.last[:as]
|
100
|
+
def optional_hooks
|
101
|
+
self.optional_properties.compact.each do |prop|
|
102
|
+
prop = extract_property_key({}, prop)
|
103
|
+
define_getter_and_setter_for_property(prop)
|
65
104
|
end
|
66
|
-
|
67
|
-
|
68
|
-
|
105
|
+
end
|
106
|
+
|
107
|
+
def required_hooks
|
108
|
+
self.requires_properties.compact.each do |prop|
|
109
|
+
prop = extract_property_key({}, prop)
|
110
|
+
self.all_required_properties.push(prop).uniq!
|
111
|
+
define_getter_and_setter_for_property(prop)
|
69
112
|
end
|
70
113
|
end
|
71
|
-
end
|
72
114
|
|
73
|
-
|
74
|
-
|
75
|
-
if prop.is_a? Array
|
115
|
+
def extract_property_key(options, prop)
|
116
|
+
if prop.is_a?(Array) || prop.is_a?(Hash)
|
76
117
|
hash = prop.flatten
|
77
|
-
options[hash.last[:as]] = options[hash.first]
|
78
118
|
prop = hash.last[:as]
|
79
119
|
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
120
|
+
prop
|
121
|
+
end
|
122
|
+
|
123
|
+
def define_getter_and_setter_for_property(prop)
|
124
|
+
self.created_properties.push(prop)
|
125
|
+
self.send(:define_method, prop) do
|
126
|
+
self.instance_variable_get(:"@#{prop}")
|
127
|
+
end
|
128
|
+
self.send(:define_method, :"#{prop}=") do |value|
|
129
|
+
self.instance_variable_set(:"@#{prop}", value)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def method_added(name)
|
134
|
+
if all_property_keys.include?(name) && !created_properties.include?(name)
|
135
|
+
raise PropertyOverwritingExistingMethodException, "Property \"#{name}\" would overwrite already defined instance method for #{self}"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def set_values(options)
|
141
|
+
self.class.all_property_keys.compact.each do |prop|
|
142
|
+
value_key = prop
|
143
|
+
prop = extract_property_key(options, prop)
|
144
|
+
if self.class.all_required_properties.include?(prop) && options[prop].nil?
|
145
|
+
raise PropertyMissingException, "Required property #{prop} is missing for #{self.class}"
|
84
146
|
end
|
147
|
+
send(:"#{prop}=", options[prop])
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# returns property key and sets alias if hash with as option is given
|
152
|
+
def extract_property_key(options, prop)
|
153
|
+
if prop.is_a?(Array) || prop.is_a?(Hash)
|
154
|
+
hash = prop.flatten
|
155
|
+
options[hash.last[:as]] = options[hash.first]
|
156
|
+
prop = hash.last[:as]
|
85
157
|
end
|
158
|
+
prop
|
86
159
|
end
|
87
160
|
|
88
161
|
end
|
@@ -21,9 +21,10 @@ module Matestack::Ui::Core::Rendering::MainRenderer
|
|
21
21
|
render_matestack_object(controller_instance, page_instance)
|
22
22
|
elsif (params[:component_key].present? && params[:component_class].blank?)
|
23
23
|
# async component rerendering from non isolated context
|
24
|
+
app_instance = app_class.new(page_class, controller_instance, context)
|
24
25
|
component_key = params[:component_key]
|
25
26
|
page_instance = page_class.new(controller_instance: controller_instance, context: context)
|
26
|
-
render_component(component_key,
|
27
|
+
render_component(component_key, app_instance, controller_instance, context)
|
27
28
|
elsif (params[:component_class].present? && params[:component_key].blank?)
|
28
29
|
# isolated component rendering
|
29
30
|
component_class = params[:component_class]
|
@@ -60,11 +61,14 @@ module Matestack::Ui::Core::Rendering::MainRenderer
|
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
64
|
+
# needs refactoring!
|
65
|
+
# we shouldn't pass in the parts of the controller_instance and the instance itself
|
63
66
|
def create_context_hash(controller_instance)
|
64
67
|
{
|
65
68
|
view_context: controller_instance.view_context,
|
66
69
|
params: controller_instance.params,
|
67
|
-
request: controller_instance.request
|
70
|
+
request: controller_instance.request,
|
71
|
+
controller: controller_instance # if this is not included here, rails route helpers will fail with undefined method `url_options' for nil:NilClass in some cases
|
68
72
|
}
|
69
73
|
end
|
70
74
|
|
@@ -75,15 +79,15 @@ module Matestack::Ui::Core::Rendering::MainRenderer
|
|
75
79
|
controller_instance.render rendering_options
|
76
80
|
end
|
77
81
|
|
78
|
-
def render_component(component_key,
|
82
|
+
def render_component(component_key, app_or_page_instance, controller_instance, context)
|
79
83
|
matched_component = nil
|
80
84
|
|
81
|
-
|
85
|
+
app_or_page_instance.matestack_set_skip_defer(false)
|
82
86
|
|
83
|
-
|
84
|
-
|
87
|
+
app_or_page_instance.prepare
|
88
|
+
app_or_page_instance.response
|
85
89
|
|
86
|
-
matched_component = dig_for_component(component_key,
|
90
|
+
matched_component = dig_for_component(component_key, app_or_page_instance)
|
87
91
|
|
88
92
|
unless matched_component.nil?
|
89
93
|
render_matestack_object(controller_instance, matched_component, {}, :render_content)
|
@@ -25,7 +25,6 @@ module Matestack::Ui::Core::Components
|
|
25
25
|
|
26
26
|
require_app_path "concepts/matestack/ui/core/component/base"
|
27
27
|
require_app_path "concepts/matestack/ui/core/component/dynamic"
|
28
|
-
require_app_path "concepts/matestack/ui/core/component/rerender"
|
29
28
|
require_app_path "concepts/matestack/ui/core/component/static"
|
30
29
|
|
31
30
|
require_core_component "abbr"
|
@@ -41,9 +40,12 @@ module Matestack::Ui::Core::Components
|
|
41
40
|
require_core_component "blockquote"
|
42
41
|
require_core_component "br"
|
43
42
|
require_core_component "button"
|
43
|
+
require_core_component "cable"
|
44
44
|
require_core_component "caption"
|
45
45
|
require_core_component "cite"
|
46
46
|
require_core_component "code"
|
47
|
+
require_core_component "form" # required before collection
|
48
|
+
require_app_path "concepts/matestack/ui/core/form/has_input_html_attributes" # required before collection
|
47
49
|
require_app_path "concepts/matestack/ui/core/collection/helper"
|
48
50
|
require_core_component "collection/content"
|
49
51
|
require_core_component "collection/content/next"
|
@@ -71,7 +73,6 @@ module Matestack::Ui::Core::Components
|
|
71
73
|
require_core_component "fieldset"
|
72
74
|
require_core_component "figure"
|
73
75
|
require_core_component "footer"
|
74
|
-
require_core_component "form"
|
75
76
|
require_core_component "form/checkbox"
|
76
77
|
require_core_component "form/input"
|
77
78
|
require_core_component "form/radio"
|
@@ -119,6 +120,7 @@ module Matestack::Ui::Core::Components
|
|
119
120
|
require_core_component "s"
|
120
121
|
require_core_component "samp"
|
121
122
|
require_core_component "section"
|
123
|
+
require_core_component "select"
|
122
124
|
require_core_component "small"
|
123
125
|
require_core_component "span"
|
124
126
|
require_core_component "strong"
|
@@ -161,6 +163,7 @@ Matestack::Ui::Core::Component::Registry.register_components(
|
|
161
163
|
blockquote: Matestack::Ui::Core::Blockquote::Blockquote,
|
162
164
|
br: Matestack::Ui::Core::Br::Br,
|
163
165
|
button: Matestack::Ui::Core::Button::Button,
|
166
|
+
cable: Matestack::Ui::Core::Cable::Cable,
|
164
167
|
caption: Matestack::Ui::Core::Caption::Caption,
|
165
168
|
cite: Matestack::Ui::Core::Cite::Cite,
|
166
169
|
code: Matestack::Ui::Core::Code::Code,
|
@@ -239,6 +242,7 @@ Matestack::Ui::Core::Component::Registry.register_components(
|
|
239
242
|
s: Matestack::Ui::Core::S::S,
|
240
243
|
samp: Matestack::Ui::Core::Samp::Samp,
|
241
244
|
section: Matestack::Ui::Core::Section::Section,
|
245
|
+
select: Matestack::Ui::Core::Select::Select,
|
242
246
|
small: Matestack::Ui::Core::Small::Small,
|
243
247
|
span: Matestack::Ui::Core::Span::Span,
|
244
248
|
strong: Matestack::Ui::Core::Strong::Strong,
|