matestack-ui-core 0.7.5 → 1.1.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/LICENSE +8 -0
- data/README.md +28 -216
- data/app/concepts/matestack/ui/core/abbr/abbr.haml +3 -3
- data/app/concepts/matestack/ui/core/abbr/abbr.rb +1 -8
- data/app/concepts/matestack/ui/core/action/action.haml +1 -1
- data/app/concepts/matestack/ui/core/action/action.js +120 -39
- data/app/concepts/matestack/ui/core/action/action.rb +40 -15
- data/app/concepts/matestack/ui/core/actionview/dynamic.haml +4 -4
- data/app/concepts/matestack/ui/core/address/address.haml +3 -3
- data/app/concepts/matestack/ui/core/address/address.rb +1 -1
- data/app/concepts/matestack/ui/core/app/app.haml +2 -3
- data/app/concepts/matestack/ui/core/app/app.js +6 -3
- data/app/concepts/matestack/ui/core/app/app.rb +33 -56
- data/app/concepts/matestack/ui/core/app/store.js +28 -2
- data/app/concepts/matestack/ui/core/area/area.haml +1 -1
- data/app/concepts/matestack/ui/core/area/area.rb +2 -14
- 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.haml +6 -2
- data/app/concepts/matestack/ui/core/async/async.js +43 -9
- data/app/concepts/matestack/ui/core/async/async.rb +29 -4
- data/app/concepts/matestack/ui/core/async/children_wrapper.haml +2 -0
- 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 +5 -3
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.haml +1 -1
- data/app/concepts/matestack/ui/core/collection/filter/filter.rb +4 -5
- 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 +10 -0
- data/app/concepts/matestack/ui/core/collection/filter/select/select.rb +30 -0
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.haml +1 -1
- data/app/concepts/matestack/ui/core/collection/helper.rb +14 -6
- data/app/concepts/matestack/ui/core/collection/order/order.js +1 -1
- data/app/concepts/matestack/ui/core/collection/order/order.rb +4 -5
- data/app/concepts/matestack/ui/core/collection/order/toggle/indicator/indicator.rb +9 -5
- 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 +430 -0
- data/app/concepts/matestack/ui/core/component/children.haml +2 -2
- data/app/concepts/matestack/ui/core/component/component.js +9 -46
- data/app/concepts/matestack/ui/core/component/dynamic.haml +1 -1
- data/app/concepts/matestack/ui/core/component/dynamic.rb +25 -247
- data/app/concepts/matestack/ui/core/component/static.rb +3 -12
- 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/checkbox.rb +79 -0
- data/app/concepts/matestack/ui/core/form/form.haml +1 -1
- data/app/concepts/matestack/ui/core/form/form.js +257 -123
- data/app/concepts/matestack/ui/core/form/form.rb +52 -19
- data/app/concepts/matestack/ui/core/form/has_errors.rb +54 -0
- data/app/concepts/matestack/ui/core/form/has_input_html_attributes.rb +13 -0
- data/app/concepts/matestack/ui/core/form/input/input.rb +32 -52
- data/app/concepts/matestack/ui/core/form/radio/radio.rb +71 -0
- data/app/concepts/matestack/ui/core/form/select/select.haml +9 -76
- data/app/concepts/matestack/ui/core/form/select/select.rb +44 -49
- data/app/concepts/matestack/ui/core/form/submit/submit.haml +1 -1
- data/app/concepts/matestack/ui/core/form/submit/submit.rb +5 -2
- data/app/concepts/matestack/ui/core/form/textarea/textarea.rb +28 -0
- data/app/concepts/matestack/ui/core/form/utils.rb +47 -0
- 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 -1
- 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.haml +1 -2
- data/app/concepts/matestack/ui/core/input/input.rb +4 -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 +2 -0
- data/app/concepts/matestack/ui/core/isolated/isolated.haml +10 -0
- data/app/concepts/matestack/ui/core/isolated/isolated.js +108 -0
- data/app/concepts/matestack/ui/core/isolated/isolated.rb +59 -0
- data/app/concepts/matestack/ui/core/js/core.js +6 -4
- 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/onclick/onclick.rb +1 -0
- 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.js → content/content.js} +8 -2
- data/app/concepts/matestack/ui/core/page/content/content.rb +28 -0
- data/app/concepts/matestack/ui/core/page/page.haml +3 -9
- data/app/concepts/matestack/ui/core/page/page.rb +15 -175
- 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/slot/slot.rb +1 -2
- 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 +5 -0
- data/app/concepts/matestack/ui/core/textarea/textarea.rb +10 -0
- 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 +2 -0
- data/app/concepts/matestack/ui/core/toggle/toggle.js +71 -0
- data/app/concepts/matestack/ui/core/toggle/toggle.rb +13 -0
- 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.js +17 -1
- data/app/concepts/matestack/ui/core/transition/transition.rb +15 -8
- 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 +3 -1
- 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 +4 -14
- data/app/concepts/matestack/ui/core/view/view.haml +1 -0
- data/app/concepts/matestack/ui/core/view/view.rb +30 -0
- 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 +94 -20
- data/app/lib/matestack/ui/component.rb +1 -0
- data/app/lib/matestack/ui/core/has_view_context.rb +4 -4
- data/app/lib/matestack/ui/core/html_attributes.rb +43 -0
- data/app/lib/matestack/ui/core/properties.rb +161 -0
- data/app/lib/matestack/ui/core/rendering/default_renderer_class_determiner.rb +33 -0
- data/app/lib/matestack/ui/core/rendering/main_renderer.rb +200 -0
- data/app/lib/matestack/ui/isolated_component.rb +1 -0
- data/app/lib/matestack/ui/vue_js_component.rb +1 -0
- data/lib/matestack/ui/core.rb +4 -2
- data/lib/matestack/ui/core/cell.rb +0 -2
- data/lib/matestack/ui/core/component/registry.rb +47 -0
- data/lib/matestack/ui/core/components.rb +269 -0
- data/lib/matestack/ui/core/dsl.rb +6 -0
- data/lib/matestack/ui/core/engine.rb +16 -0
- data/lib/matestack/ui/core/version.rb +1 -1
- data/vendor/assets/javascripts/dist/manifest.json +6 -10
- data/vendor/assets/javascripts/dist/matestack-ui-core.js +834 -261
- 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 +50 -65
- data/MIT-LICENSE +0 -20
- data/app/concepts/matestack/ui/core/absolute/absolute.haml +0 -3
- data/app/concepts/matestack/ui/core/absolute/absolute.rb +0 -17
- data/app/concepts/matestack/ui/core/collection/filter/input/input.haml +0 -2
- data/app/concepts/matestack/ui/core/component/response.haml +0 -2
- data/app/concepts/matestack/ui/core/component/response_dynamic.haml +0 -7
- data/app/concepts/matestack/ui/core/component/response_dynamic_without_rerender.haml +0 -3
- data/app/concepts/matestack/ui/core/component/static.haml +0 -1
- data/app/concepts/matestack/ui/core/form/inline/inline.haml +0 -6
- data/app/concepts/matestack/ui/core/form/inline/inline.rb +0 -9
- data/app/concepts/matestack/ui/core/form/input/input.haml +0 -38
- data/app/concepts/matestack/ui/core/html/html.haml +0 -3
- data/app/concepts/matestack/ui/core/html/html.js +0 -10
- data/app/concepts/matestack/ui/core/html/html.rb +0 -17
- data/app/concepts/matestack/ui/core/isolate/isolate.haml +0 -2
- data/app/concepts/matestack/ui/core/isolate/isolate.rb +0 -11
- data/app/concepts/matestack/ui/core/page/content.haml +0 -7
- data/app/concepts/matestack/ui/core/page/content.rb +0 -5
- data/app/concepts/matestack/ui/core/pg/pg.haml +0 -5
- data/app/concepts/matestack/ui/core/pg/pg.rb +0 -5
- data/app/lib/matestack/ui/core/app_node.rb +0 -53
- data/app/lib/matestack/ui/core/component_node.rb +0 -87
- data/app/lib/matestack/ui/core/page_node.rb +0 -100
- data/app/lib/matestack/ui/core/render.rb +0 -89
- data/app/lib/matestack/ui/core/to_cell.rb +0 -129
@@ -1,8 +1,11 @@
|
|
1
1
|
module Matestack::Ui::Core::Form::Submit
|
2
2
|
class Submit < Matestack::Ui::Core::Component::Static
|
3
3
|
|
4
|
-
def
|
5
|
-
|
4
|
+
def submit_attributes
|
5
|
+
html_attributes.merge!({
|
6
|
+
"@click.prevent": "perform",
|
7
|
+
"v-bind:class": "{ 'loading': loading }"
|
8
|
+
})
|
6
9
|
end
|
7
10
|
|
8
11
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative '../utils'
|
2
|
+
require_relative '../has_errors'
|
3
|
+
module Matestack::Ui::Core::Form::Textarea
|
4
|
+
class Textarea < Matestack::Ui::Core::Textarea::Textarea
|
5
|
+
include Matestack::Ui::Core::Form::Utils
|
6
|
+
include Matestack::Ui::Core::Form::HasErrors
|
7
|
+
|
8
|
+
requires :key
|
9
|
+
optional :multiple, :init, for: { as: :input_for }, label: { as: :input_label }
|
10
|
+
|
11
|
+
def response
|
12
|
+
label text: input_label if input_label
|
13
|
+
textarea html_attributes.merge(attributes: vue_attributes)
|
14
|
+
render_errors
|
15
|
+
end
|
16
|
+
|
17
|
+
def vue_attributes
|
18
|
+
(options[:attributes] || {}).merge({
|
19
|
+
'v-model': input_key,
|
20
|
+
'@change': "inputChanged('#{attr_key}')",
|
21
|
+
'v-bind:class': "{ '#{input_error_class}': #{error_key} }",
|
22
|
+
"init-value": init_value,
|
23
|
+
ref: "input.#{attr_key}",
|
24
|
+
})
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Matestack::Ui::Core::Form::Utils
|
2
|
+
|
3
|
+
def input_key
|
4
|
+
"data['#{attr_key.to_s}']"
|
5
|
+
end
|
6
|
+
|
7
|
+
def input_wrapper
|
8
|
+
case input_for
|
9
|
+
when nil
|
10
|
+
return nil
|
11
|
+
when Symbol, String
|
12
|
+
return input_for
|
13
|
+
end
|
14
|
+
if input_for.respond_to?(:model_name)
|
15
|
+
return input_for.model_name.singular
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def attr_key
|
20
|
+
if input_wrapper.nil?
|
21
|
+
return "#{key.to_s}"
|
22
|
+
else
|
23
|
+
return "#{input_wrapper}.#{key.to_s}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def init_value
|
28
|
+
return init unless init.nil?
|
29
|
+
|
30
|
+
unless input_for.nil?
|
31
|
+
value = parse_value(input_for.send key)
|
32
|
+
else
|
33
|
+
unless @included_config.nil? && @included_config[:for].nil?
|
34
|
+
if @included_config[:for].respond_to?(key)
|
35
|
+
value = parse_value(@included_config[:for].send key)
|
36
|
+
else
|
37
|
+
@included_config[:for][key] if @included_config[:for].is_a?(Hash)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def parse_value(value)
|
44
|
+
value
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -1,50 +1,5 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
- if options[:text].blank?
|
5
|
-
- if block_given?
|
6
|
-
= yield
|
7
|
-
- else
|
8
|
-
= options[:text]
|
9
|
-
- when 2
|
10
|
-
%h2{@tag_attributes}
|
11
|
-
- if options[:text].blank?
|
12
|
-
- if block_given?
|
13
|
-
= yield
|
14
|
-
- else
|
15
|
-
= options[:text]
|
16
|
-
- when 3
|
17
|
-
%h3{@tag_attributes}
|
18
|
-
- if options[:text].blank?
|
19
|
-
- if block_given?
|
20
|
-
= yield
|
21
|
-
- else
|
22
|
-
= options[:text]
|
23
|
-
- when 4
|
24
|
-
%h4{@tag_attributes}
|
25
|
-
- if options[:text].blank?
|
26
|
-
- if block_given?
|
27
|
-
= yield
|
28
|
-
- else
|
29
|
-
= options[:text]
|
30
|
-
- when 5
|
31
|
-
%h5{@tag_attributes}
|
32
|
-
- if options[:text].blank?
|
33
|
-
- if block_given?
|
34
|
-
= yield
|
35
|
-
- else
|
36
|
-
= options[:text]
|
37
|
-
- when 6
|
38
|
-
%h6{@tag_attributes}
|
39
|
-
- if options[:text].blank?
|
40
|
-
- if block_given?
|
41
|
-
= yield
|
42
|
-
- else
|
43
|
-
= options[:text]
|
1
|
+
- if text.blank? && block_given?
|
2
|
+
= content_tag("h#{size || 1}", html_attributes) do
|
3
|
+
= yield
|
44
4
|
- else
|
45
|
-
|
46
|
-
- if options[:text].blank?
|
47
|
-
- if block_given?
|
48
|
-
= yield
|
49
|
-
- else
|
50
|
-
= options[:text]
|
5
|
+
= content_tag("h#{size || 1}", text, html_attributes)
|
@@ -1 +1 @@
|
|
1
|
-
%hr{
|
1
|
+
%hr{ html_attributes }
|
@@ -1,14 +1,7 @@
|
|
1
1
|
module Matestack::Ui::Core::Iframe
|
2
2
|
class Iframe < Matestack::Ui::Core::Component::Static
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
src: options[:src],
|
7
|
-
height: options[:height],
|
8
|
-
width: options[:width],
|
9
|
-
srcdoc: options[:srcdoc]
|
10
|
-
})
|
11
|
-
end
|
12
|
-
|
3
|
+
html_attributes :allow, :allowfullscreen, :allowpaymentrequest, :height, :name,
|
4
|
+
:referrerpolicy, :sandbox, :src, :srcdoc, :width
|
5
|
+
optional :text
|
13
6
|
end
|
14
7
|
end
|
@@ -1 +1 @@
|
|
1
|
-
%img{
|
1
|
+
%img{ img_attributes }
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Matestack::Ui::Core::Img
|
2
2
|
class Img < Matestack::Ui::Core::Component::Static
|
3
|
+
html_attributes :alt, :crossorigin, :height, :ismap, :longdesc, :referrerpolicy,
|
4
|
+
:sizes, :src, :srcset, :usemap, :width
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
alt: options[:alt]
|
11
|
-
})
|
6
|
+
optional :path
|
7
|
+
|
8
|
+
def img_attributes
|
9
|
+
html_attributes.tap do |attributes|
|
10
|
+
attributes[:src] = ActionController::Base.helpers.asset_path(path) if path
|
11
|
+
end
|
12
12
|
end
|
13
13
|
|
14
14
|
end
|
@@ -1,2 +1 @@
|
|
1
|
-
%input{
|
2
|
-
type: type }
|
1
|
+
%input{ html_attributes }
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Matestack::Ui::Core::Input
|
2
2
|
class Input < Matestack::Ui::Core::Component::Static
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
|
4
|
+
html_attributes :accept, :alt, :autocomplete, :autofocus, :checked, :dirname, :disabled, :form, :formaction,
|
5
|
+
:formenctype, :formmethod, :formnovalidate, :formtarget, :height, :list, :max, :maxlength, :min, :minlength,
|
6
|
+
:multiple, :name, :pattern, :placeholder, :readonly, :required, :size, :src, :step, :type, :value, :width
|
7
7
|
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
%component{dynamic_tag_attributes}
|
2
|
+
%div{loading_classes.merge(class: "matestack-isolated-component-container")}
|
3
|
+
- if loading_state_element.present?
|
4
|
+
%div{loading_classes.merge(class: "loading-state-element-wrapper")}
|
5
|
+
=loading_state_element
|
6
|
+
- unless options[:defer] || options[:init_on]
|
7
|
+
%div{class: "matestack-isolated-component-wrapper", "v-if": "isolatedTemplate == null", "v-bind:class": "{ 'loading': loading === true }"}
|
8
|
+
= render_isolated_content
|
9
|
+
%div{class: "matestack-isolated-component-wrapper", "v-if": "isolatedTemplate != null", "v-bind:class": "{ 'loading': loading === true }"}
|
10
|
+
%v-runtime-template{":template":"isolatedTemplate"}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
import Vue from 'vue/dist/vue.esm'
|
2
|
+
import axios from 'axios'
|
3
|
+
import VRuntimeTemplate from "v-runtime-template"
|
4
|
+
import matestackEventHub from '../js/event-hub'
|
5
|
+
|
6
|
+
const componentDef = {
|
7
|
+
props: ['componentConfig', 'params'],
|
8
|
+
data: function(){
|
9
|
+
return {
|
10
|
+
isolatedTemplate: null,
|
11
|
+
loading: false,
|
12
|
+
loadingError: false
|
13
|
+
}
|
14
|
+
},
|
15
|
+
methods: {
|
16
|
+
rerender: function(){
|
17
|
+
var self = this;
|
18
|
+
self.loading = true;
|
19
|
+
self.loadingError = false;
|
20
|
+
if(self.componentConfig["rerender_delay"] != undefined){
|
21
|
+
setTimeout(function () {
|
22
|
+
self.renderIsolatedContent();
|
23
|
+
}, parseInt(this.componentConfig["rerender_delay"]));
|
24
|
+
} else {
|
25
|
+
self.renderIsolatedContent();
|
26
|
+
}
|
27
|
+
},
|
28
|
+
renderIsolatedContent: function(){
|
29
|
+
var self = this;
|
30
|
+
self.loading = true;
|
31
|
+
self.loadingError = false;
|
32
|
+
axios({
|
33
|
+
method: "get",
|
34
|
+
url: location.pathname + location.search,
|
35
|
+
headers: {
|
36
|
+
'X-CSRF-Token': document.getElementsByName("csrf-token")[0].getAttribute('content')
|
37
|
+
},
|
38
|
+
params: {
|
39
|
+
"component_class": self.componentConfig["component_class"],
|
40
|
+
"public_options": self.componentConfig["public_options"]
|
41
|
+
}
|
42
|
+
})
|
43
|
+
.then(function(response){
|
44
|
+
self.loading = false;
|
45
|
+
self.loadingStart = false;
|
46
|
+
self.loadingEnd = true;
|
47
|
+
self.isolatedTemplate = response['data'];
|
48
|
+
})
|
49
|
+
.catch(function(error){
|
50
|
+
self.loadingError = true;
|
51
|
+
matestackEventHub.$emit('isolate_rerender_error', { class: self.componentConfig["component_class"] })
|
52
|
+
})
|
53
|
+
},
|
54
|
+
startDefer: function(){
|
55
|
+
const self = this
|
56
|
+
self.loading = true;
|
57
|
+
setTimeout(function () {
|
58
|
+
self.renderIsolatedContent()
|
59
|
+
}, parseInt(this.componentConfig["defer"]));
|
60
|
+
}
|
61
|
+
},
|
62
|
+
created: function () {
|
63
|
+
const self = this
|
64
|
+
},
|
65
|
+
beforeDestroy: function() {
|
66
|
+
const self = this
|
67
|
+
if(this.componentConfig["rerender_on"] != undefined){
|
68
|
+
var rerender_events = this.componentConfig["rerender_on"].split(",")
|
69
|
+
rerender_events.forEach(rerender_event => matestackEventHub.$off(rerender_event.trim(), self.renderIsolatedContent));
|
70
|
+
}
|
71
|
+
},
|
72
|
+
mounted: function (){
|
73
|
+
const self = this
|
74
|
+
if(this.componentConfig["init_on"] === undefined || this.componentConfig["init_on"] === null){
|
75
|
+
if(self.componentConfig["defer"] == true || Number.isInteger(self.componentConfig["defer"])){
|
76
|
+
if(!isNaN(self.componentConfig["defer"])){
|
77
|
+
self.startDefer()
|
78
|
+
}
|
79
|
+
else{
|
80
|
+
self.renderIsolatedContent();
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}else{
|
84
|
+
if(self.componentConfig["defer"] != undefined){
|
85
|
+
if(!isNaN(self.componentConfig["defer"])){
|
86
|
+
var init_on_events = this.componentConfig["init_on"].split(",")
|
87
|
+
init_on_events.forEach(init_on_event => matestackEventHub.$on(init_on_event.trim(), self.startDefer));
|
88
|
+
}
|
89
|
+
}else{
|
90
|
+
var init_on_events = this.componentConfig["init_on"].split(",")
|
91
|
+
init_on_events.forEach(init_on_event => matestackEventHub.$on(init_on_event.trim(), self.renderIsolatedContent));
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
if(this.componentConfig["rerender_on"] != undefined){
|
96
|
+
var rerender_events = this.componentConfig["rerender_on"].split(",")
|
97
|
+
rerender_events.forEach(rerender_event => matestackEventHub.$on(rerender_event.trim(), self.rerender));
|
98
|
+
}
|
99
|
+
|
100
|
+
},
|
101
|
+
components: {
|
102
|
+
VRuntimeTemplate: VRuntimeTemplate
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
let component = Vue.component('matestack-ui-core-isolate', componentDef)
|
107
|
+
|
108
|
+
export default componentDef
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Matestack::Ui::Core::Isolated
|
2
|
+
class Isolated < Matestack::Ui::Core::Component::Dynamic
|
3
|
+
vue_js_component_name "matestack-ui-core-isolate"
|
4
|
+
|
5
|
+
def initialize(*args)
|
6
|
+
super
|
7
|
+
@public_options = args.map { |hash| hash&.dig(:public_options) }[0]
|
8
|
+
end
|
9
|
+
|
10
|
+
def public_options
|
11
|
+
@public_options ||= {}
|
12
|
+
end
|
13
|
+
|
14
|
+
# def params
|
15
|
+
# context[:params] || matestack_context[:params]
|
16
|
+
# end
|
17
|
+
|
18
|
+
def setup
|
19
|
+
@component_config[:component_class] = self.class.name
|
20
|
+
@component_config[:public_options] = @options[:public_options]
|
21
|
+
@component_config[:defer] = @options[:defer]
|
22
|
+
@component_config[:rerender_on] = @options[:rerender_on]
|
23
|
+
@component_config[:rerender_delay] = @options[:rerender_delay]
|
24
|
+
@component_config[:init_on] = @options[:init_on]
|
25
|
+
end
|
26
|
+
|
27
|
+
def loading_classes
|
28
|
+
{ "v-bind:class": "{ 'loading': loading === true }" }
|
29
|
+
end
|
30
|
+
|
31
|
+
# overwrite parent class render mechanism in order to make sure to only render wrapper
|
32
|
+
def render_content
|
33
|
+
show
|
34
|
+
end
|
35
|
+
|
36
|
+
# only render vuejs component wrapper on show
|
37
|
+
def show
|
38
|
+
render :isolated
|
39
|
+
end
|
40
|
+
|
41
|
+
# this method gets called when the isolate vuejs component requests isolated content
|
42
|
+
def render_isolated_content
|
43
|
+
if authorized?
|
44
|
+
render :children_wrapper do
|
45
|
+
render :children
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def authorized?
|
51
|
+
raise "please implement the `authorized? method: isolated components have to be authorized separately"
|
52
|
+
end
|
53
|
+
|
54
|
+
def loading_state_element
|
55
|
+
nil # overwrite in subclass
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|