matestack-ui-core 1.5.0 → 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 +18 -6
- data/README.md +48 -548
- data/Rakefile +0 -2
- data/lib/matestack/ui/component.rb +1 -0
- data/lib/matestack/ui/core/base.rb +131 -0
- data/lib/matestack/ui/core/component.rb +8 -0
- data/lib/matestack/ui/core/context.rb +17 -0
- data/lib/matestack/ui/core/helper.rb +91 -0
- data/lib/matestack/ui/core/layout.rb +25 -0
- data/lib/matestack/ui/core/page.rb +13 -0
- data/lib/matestack/ui/core/properties.rb +105 -0
- data/lib/matestack/ui/core/slots.rb +15 -0
- data/lib/matestack/ui/core/tag_helper.rb +101 -0
- data/lib/matestack/ui/core/version.rb +1 -1
- data/lib/matestack/ui/core.rb +16 -11
- data/lib/matestack/ui/layout.rb +1 -0
- data/lib/matestack/ui/page.rb +1 -0
- metadata +18 -408
- data/app/concepts/matestack/ui/core/abbr/abbr.haml +0 -5
- data/app/concepts/matestack/ui/core/abbr/abbr.rb +0 -5
- data/app/concepts/matestack/ui/core/action/action.haml +0 -3
- data/app/concepts/matestack/ui/core/action/action.js +0 -152
- data/app/concepts/matestack/ui/core/action/action.rb +0 -80
- data/app/concepts/matestack/ui/core/actionview/dynamic.haml +0 -6
- data/app/concepts/matestack/ui/core/actionview/dynamic.rb +0 -28
- data/app/concepts/matestack/ui/core/actionview/static.haml +0 -1
- data/app/concepts/matestack/ui/core/actionview/static.rb +0 -28
- data/app/concepts/matestack/ui/core/address/address.haml +0 -5
- data/app/concepts/matestack/ui/core/address/address.rb +0 -5
- data/app/concepts/matestack/ui/core/app/app.haml +0 -3
- data/app/concepts/matestack/ui/core/app/app.js +0 -41
- data/app/concepts/matestack/ui/core/app/app.rb +0 -51
- data/app/concepts/matestack/ui/core/app/location.js +0 -9
- data/app/concepts/matestack/ui/core/app/store.js +0 -103
- data/app/concepts/matestack/ui/core/area/area.haml +0 -1
- data/app/concepts/matestack/ui/core/area/area.rb +0 -6
- data/app/concepts/matestack/ui/core/article/article.haml +0 -5
- data/app/concepts/matestack/ui/core/article/article.rb +0 -5
- data/app/concepts/matestack/ui/core/aside/aside.haml +0 -3
- data/app/concepts/matestack/ui/core/aside/aside.rb +0 -4
- data/app/concepts/matestack/ui/core/async/async.haml +0 -6
- data/app/concepts/matestack/ui/core/async/async.js +0 -110
- data/app/concepts/matestack/ui/core/async/async.rb +0 -37
- data/app/concepts/matestack/ui/core/async/children_wrapper.haml +0 -2
- data/app/concepts/matestack/ui/core/b/b.haml +0 -5
- data/app/concepts/matestack/ui/core/b/b.rb +0 -5
- data/app/concepts/matestack/ui/core/bdi/bdi.haml +0 -5
- data/app/concepts/matestack/ui/core/bdi/bdi.rb +0 -5
- data/app/concepts/matestack/ui/core/bdo/bdo.haml +0 -5
- data/app/concepts/matestack/ui/core/bdo/bdo.rb +0 -6
- data/app/concepts/matestack/ui/core/blockquote/blockquote.haml +0 -5
- data/app/concepts/matestack/ui/core/blockquote/blockquote.rb +0 -6
- data/app/concepts/matestack/ui/core/br/br.haml +0 -5
- data/app/concepts/matestack/ui/core/br/br.rb +0 -5
- data/app/concepts/matestack/ui/core/button/button.haml +0 -5
- data/app/concepts/matestack/ui/core/button/button.rb +0 -7
- data/app/concepts/matestack/ui/core/cable/cable.haml +0 -4
- data/app/concepts/matestack/ui/core/cable/cable.js +0 -100
- data/app/concepts/matestack/ui/core/cable/cable.rb +0 -28
- data/app/concepts/matestack/ui/core/cable/children_wrapper.haml +0 -2
- data/app/concepts/matestack/ui/core/caption/caption.haml +0 -5
- data/app/concepts/matestack/ui/core/caption/caption.rb +0 -5
- data/app/concepts/matestack/ui/core/cite/cite.haml +0 -5
- data/app/concepts/matestack/ui/core/cite/cite.rb +0 -5
- data/app/concepts/matestack/ui/core/code/code.haml +0 -5
- data/app/concepts/matestack/ui/core/code/code.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/content/content.js +0 -98
- data/app/concepts/matestack/ui/core/collection/content/content.rb +0 -16
- data/app/concepts/matestack/ui/core/collection/content/next/next.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/content/next/next.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.rb +0 -7
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/filter/filter.js +0 -48
- data/app/concepts/matestack/ui/core/collection/filter/filter.rb +0 -16
- data/app/concepts/matestack/ui/core/collection/filter/input/input.rb +0 -28
- data/app/concepts/matestack/ui/core/collection/filter/reset/reset.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/filter/reset/reset.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/filter/select/select.haml +0 -10
- data/app/concepts/matestack/ui/core/collection/filter/select/select.rb +0 -30
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/helper.rb +0 -127
- data/app/concepts/matestack/ui/core/collection/order/order.js +0 -56
- data/app/concepts/matestack/ui/core/collection/order/order.rb +0 -16
- data/app/concepts/matestack/ui/core/collection/order/toggle/indicator/indicator.rb +0 -17
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.rb +0 -4
- data/app/concepts/matestack/ui/core/component/anonym-dynamic-component.js +0 -10
- data/app/concepts/matestack/ui/core/component/base.rb +0 -430
- data/app/concepts/matestack/ui/core/component/children.haml +0 -2
- data/app/concepts/matestack/ui/core/component/component.js +0 -22
- data/app/concepts/matestack/ui/core/component/dynamic.haml +0 -6
- data/app/concepts/matestack/ui/core/component/dynamic.rb +0 -47
- data/app/concepts/matestack/ui/core/component/dynamic_without_rerender.haml +0 -2
- data/app/concepts/matestack/ui/core/component/static.rb +0 -7
- data/app/concepts/matestack/ui/core/data/data.haml +0 -5
- data/app/concepts/matestack/ui/core/data/data.rb +0 -6
- data/app/concepts/matestack/ui/core/datalist/datalist.haml +0 -3
- data/app/concepts/matestack/ui/core/datalist/datalist.rb +0 -4
- data/app/concepts/matestack/ui/core/dd/dd.haml +0 -5
- data/app/concepts/matestack/ui/core/dd/dd.rb +0 -5
- data/app/concepts/matestack/ui/core/del/del.haml +0 -5
- data/app/concepts/matestack/ui/core/del/del.rb +0 -6
- data/app/concepts/matestack/ui/core/details/details.haml +0 -3
- data/app/concepts/matestack/ui/core/details/details.rb +0 -5
- data/app/concepts/matestack/ui/core/dfn/dfn.haml +0 -5
- data/app/concepts/matestack/ui/core/dfn/dfn.rb +0 -6
- data/app/concepts/matestack/ui/core/dialog/dialog.haml +0 -5
- data/app/concepts/matestack/ui/core/dialog/dialog.rb +0 -6
- data/app/concepts/matestack/ui/core/div/div.haml +0 -3
- data/app/concepts/matestack/ui/core/div/div.rb +0 -4
- data/app/concepts/matestack/ui/core/dl/dl.haml +0 -5
- data/app/concepts/matestack/ui/core/dl/dl.rb +0 -5
- data/app/concepts/matestack/ui/core/dt/dt.haml +0 -5
- data/app/concepts/matestack/ui/core/dt/dt.rb +0 -5
- data/app/concepts/matestack/ui/core/em/em.haml +0 -5
- data/app/concepts/matestack/ui/core/em/em.rb +0 -5
- data/app/concepts/matestack/ui/core/fieldset/fieldset.haml +0 -5
- data/app/concepts/matestack/ui/core/fieldset/fieldset.rb +0 -6
- data/app/concepts/matestack/ui/core/figure/figure.haml +0 -3
- data/app/concepts/matestack/ui/core/figure/figure.rb +0 -4
- data/app/concepts/matestack/ui/core/footer/footer.haml +0 -3
- data/app/concepts/matestack/ui/core/footer/footer.rb +0 -4
- data/app/concepts/matestack/ui/core/form/checkbox/base.rb +0 -120
- data/app/concepts/matestack/ui/core/form/checkbox/checkbox.js +0 -15
- data/app/concepts/matestack/ui/core/form/checkbox/checkbox.rb +0 -16
- data/app/concepts/matestack/ui/core/form/checkbox/mixin.js +0 -80
- data/app/concepts/matestack/ui/core/form/form.haml +0 -2
- data/app/concepts/matestack/ui/core/form/form.js +0 -275
- data/app/concepts/matestack/ui/core/form/form.rb +0 -104
- data/app/concepts/matestack/ui/core/form/has_errors.rb +0 -54
- data/app/concepts/matestack/ui/core/form/has_input_html_attributes.rb +0 -13
- data/app/concepts/matestack/ui/core/form/input/base.rb +0 -75
- data/app/concepts/matestack/ui/core/form/input/input.js +0 -15
- data/app/concepts/matestack/ui/core/form/input/input.rb +0 -17
- data/app/concepts/matestack/ui/core/form/input/mixin.js +0 -55
- data/app/concepts/matestack/ui/core/form/radio/base.rb +0 -90
- data/app/concepts/matestack/ui/core/form/radio/mixin.js +0 -62
- data/app/concepts/matestack/ui/core/form/radio/radio.js +0 -15
- data/app/concepts/matestack/ui/core/form/radio/radio.rb +0 -16
- data/app/concepts/matestack/ui/core/form/select/base.rb +0 -98
- data/app/concepts/matestack/ui/core/form/select/mixin.js +0 -58
- data/app/concepts/matestack/ui/core/form/select/select.js +0 -15
- data/app/concepts/matestack/ui/core/form/select/select.rb +0 -19
- data/app/concepts/matestack/ui/core/form/submit/base.rb +0 -12
- data/app/concepts/matestack/ui/core/form/submit/submit.js +0 -19
- data/app/concepts/matestack/ui/core/form/submit/submit.rb +0 -15
- data/app/concepts/matestack/ui/core/form/textarea/base.rb +0 -49
- data/app/concepts/matestack/ui/core/form/textarea/mixin.js +0 -41
- data/app/concepts/matestack/ui/core/form/textarea/textarea.js +0 -15
- data/app/concepts/matestack/ui/core/form/textarea/textarea.rb +0 -17
- data/app/concepts/matestack/ui/core/form/utils.rb +0 -47
- data/app/concepts/matestack/ui/core/header/header.haml +0 -3
- data/app/concepts/matestack/ui/core/header/header.rb +0 -4
- data/app/concepts/matestack/ui/core/heading/heading.haml +0 -5
- data/app/concepts/matestack/ui/core/heading/heading.rb +0 -5
- data/app/concepts/matestack/ui/core/hr/hr.haml +0 -1
- data/app/concepts/matestack/ui/core/hr/hr.rb +0 -4
- data/app/concepts/matestack/ui/core/icon/icon.haml +0 -5
- data/app/concepts/matestack/ui/core/icon/icon.rb +0 -5
- data/app/concepts/matestack/ui/core/iframe/iframe.haml +0 -5
- data/app/concepts/matestack/ui/core/iframe/iframe.rb +0 -7
- data/app/concepts/matestack/ui/core/img/img.haml +0 -1
- data/app/concepts/matestack/ui/core/img/img.rb +0 -15
- data/app/concepts/matestack/ui/core/input/input.haml +0 -1
- data/app/concepts/matestack/ui/core/input/input.rb +0 -9
- data/app/concepts/matestack/ui/core/ins/ins.haml +0 -5
- data/app/concepts/matestack/ui/core/ins/ins.rb +0 -6
- data/app/concepts/matestack/ui/core/isolated/children_wrapper.haml +0 -2
- data/app/concepts/matestack/ui/core/isolated/isolated.haml +0 -10
- data/app/concepts/matestack/ui/core/isolated/isolated.js +0 -108
- data/app/concepts/matestack/ui/core/isolated/isolated.rb +0 -59
- data/app/concepts/matestack/ui/core/js/core.js +0 -66
- data/app/concepts/matestack/ui/core/js/event-hub.js +0 -5
- data/app/concepts/matestack/ui/core/js/helpers/query-params-helper.js +0 -56
- data/app/concepts/matestack/ui/core/kbd/kbd.haml +0 -5
- data/app/concepts/matestack/ui/core/kbd/kbd.rb +0 -5
- data/app/concepts/matestack/ui/core/label/label.haml +0 -5
- data/app/concepts/matestack/ui/core/label/label.rb +0 -6
- data/app/concepts/matestack/ui/core/legend/legend.haml +0 -5
- data/app/concepts/matestack/ui/core/legend/legend.rb +0 -5
- data/app/concepts/matestack/ui/core/li/li.haml +0 -5
- data/app/concepts/matestack/ui/core/li/li.rb +0 -6
- data/app/concepts/matestack/ui/core/link/link.haml +0 -5
- data/app/concepts/matestack/ui/core/link/link.rb +0 -23
- data/app/concepts/matestack/ui/core/main/main.haml +0 -3
- data/app/concepts/matestack/ui/core/main/main.rb +0 -4
- data/app/concepts/matestack/ui/core/map/map.haml +0 -3
- data/app/concepts/matestack/ui/core/map/map.rb +0 -5
- data/app/concepts/matestack/ui/core/mark/mark.haml +0 -5
- data/app/concepts/matestack/ui/core/mark/mark.rb +0 -5
- data/app/concepts/matestack/ui/core/meter/meter.haml +0 -4
- data/app/concepts/matestack/ui/core/meter/meter.rb +0 -5
- data/app/concepts/matestack/ui/core/nav/nav.haml +0 -3
- data/app/concepts/matestack/ui/core/nav/nav.rb +0 -4
- data/app/concepts/matestack/ui/core/noscript/noscript.haml +0 -5
- data/app/concepts/matestack/ui/core/noscript/noscript.rb +0 -5
- data/app/concepts/matestack/ui/core/object/object.haml +0 -1
- data/app/concepts/matestack/ui/core/object/object.rb +0 -5
- data/app/concepts/matestack/ui/core/ol/ol.haml +0 -3
- data/app/concepts/matestack/ui/core/ol/ol.rb +0 -5
- data/app/concepts/matestack/ui/core/onclick/onclick.haml +0 -2
- data/app/concepts/matestack/ui/core/onclick/onclick.js +0 -20
- data/app/concepts/matestack/ui/core/onclick/onclick.rb +0 -6
- data/app/concepts/matestack/ui/core/optgroup/optgroup.haml +0 -3
- data/app/concepts/matestack/ui/core/optgroup/optgroup.rb +0 -5
- data/app/concepts/matestack/ui/core/option/option.haml +0 -5
- data/app/concepts/matestack/ui/core/option/option.rb +0 -6
- data/app/concepts/matestack/ui/core/output/output.haml +0 -5
- data/app/concepts/matestack/ui/core/output/output.rb +0 -6
- data/app/concepts/matestack/ui/core/page/content/content.js +0 -23
- data/app/concepts/matestack/ui/core/page/content/content.rb +0 -28
- data/app/concepts/matestack/ui/core/page/page.haml +0 -3
- data/app/concepts/matestack/ui/core/page/page.rb +0 -30
- data/app/concepts/matestack/ui/core/paragraph/paragraph.haml +0 -5
- data/app/concepts/matestack/ui/core/paragraph/paragraph.rb +0 -5
- data/app/concepts/matestack/ui/core/param/param.haml +0 -1
- data/app/concepts/matestack/ui/core/param/param.rb +0 -5
- data/app/concepts/matestack/ui/core/partial/partial.haml +0 -2
- data/app/concepts/matestack/ui/core/partial/partial.rb +0 -4
- data/app/concepts/matestack/ui/core/picture/picture.haml +0 -3
- data/app/concepts/matestack/ui/core/picture/picture.rb +0 -4
- data/app/concepts/matestack/ui/core/plain/plain.rb +0 -9
- data/app/concepts/matestack/ui/core/pre/pre.haml +0 -5
- data/app/concepts/matestack/ui/core/pre/pre.rb +0 -5
- data/app/concepts/matestack/ui/core/progress/progress.haml +0 -3
- data/app/concepts/matestack/ui/core/progress/progress.rb +0 -5
- data/app/concepts/matestack/ui/core/q/q.haml +0 -5
- data/app/concepts/matestack/ui/core/q/q.rb +0 -6
- data/app/concepts/matestack/ui/core/rp/rp.haml +0 -5
- data/app/concepts/matestack/ui/core/rp/rp.rb +0 -5
- data/app/concepts/matestack/ui/core/rt/rt.haml +0 -5
- data/app/concepts/matestack/ui/core/rt/rt.rb +0 -5
- data/app/concepts/matestack/ui/core/ruby/ruby.haml +0 -5
- data/app/concepts/matestack/ui/core/ruby/ruby.rb +0 -5
- data/app/concepts/matestack/ui/core/s/s.haml +0 -5
- data/app/concepts/matestack/ui/core/s/s.rb +0 -6
- data/app/concepts/matestack/ui/core/samp/samp.haml +0 -5
- data/app/concepts/matestack/ui/core/samp/samp.rb +0 -5
- data/app/concepts/matestack/ui/core/section/section.haml +0 -3
- data/app/concepts/matestack/ui/core/section/section.rb +0 -4
- data/app/concepts/matestack/ui/core/select/select.haml +0 -3
- data/app/concepts/matestack/ui/core/select/select.rb +0 -7
- data/app/concepts/matestack/ui/core/slot/slot.haml +0 -2
- data/app/concepts/matestack/ui/core/slot/slot.rb +0 -4
- data/app/concepts/matestack/ui/core/small/small.haml +0 -5
- data/app/concepts/matestack/ui/core/small/small.rb +0 -5
- data/app/concepts/matestack/ui/core/span/span.haml +0 -5
- data/app/concepts/matestack/ui/core/span/span.rb +0 -5
- data/app/concepts/matestack/ui/core/strong/strong.haml +0 -5
- data/app/concepts/matestack/ui/core/strong/strong.rb +0 -5
- data/app/concepts/matestack/ui/core/sub/sub.haml +0 -5
- data/app/concepts/matestack/ui/core/sub/sub.rb +0 -5
- data/app/concepts/matestack/ui/core/summary/summary.haml +0 -5
- data/app/concepts/matestack/ui/core/summary/summary.rb +0 -5
- data/app/concepts/matestack/ui/core/sup/sup.haml +0 -5
- data/app/concepts/matestack/ui/core/sup/sup.rb +0 -5
- data/app/concepts/matestack/ui/core/table/table.haml +0 -3
- data/app/concepts/matestack/ui/core/table/table.rb +0 -4
- data/app/concepts/matestack/ui/core/tbody/tbody.haml +0 -3
- data/app/concepts/matestack/ui/core/tbody/tbody.rb +0 -4
- data/app/concepts/matestack/ui/core/td/td.haml +0 -5
- data/app/concepts/matestack/ui/core/td/td.rb +0 -6
- data/app/concepts/matestack/ui/core/template/template.haml +0 -3
- data/app/concepts/matestack/ui/core/template/template.rb +0 -4
- data/app/concepts/matestack/ui/core/textarea/textarea.haml +0 -5
- data/app/concepts/matestack/ui/core/textarea/textarea.rb +0 -10
- data/app/concepts/matestack/ui/core/tfoot/tfoot.haml +0 -3
- data/app/concepts/matestack/ui/core/tfoot/tfoot.rb +0 -4
- data/app/concepts/matestack/ui/core/th/th.haml +0 -5
- data/app/concepts/matestack/ui/core/th/th.rb +0 -6
- data/app/concepts/matestack/ui/core/thead/thead.haml +0 -3
- data/app/concepts/matestack/ui/core/thead/thead.rb +0 -4
- data/app/concepts/matestack/ui/core/time/time.haml +0 -3
- data/app/concepts/matestack/ui/core/time/time.rb +0 -5
- data/app/concepts/matestack/ui/core/toggle/toggle.haml +0 -2
- data/app/concepts/matestack/ui/core/toggle/toggle.js +0 -71
- data/app/concepts/matestack/ui/core/toggle/toggle.rb +0 -13
- data/app/concepts/matestack/ui/core/tr/tr.haml +0 -3
- data/app/concepts/matestack/ui/core/tr/tr.rb +0 -4
- data/app/concepts/matestack/ui/core/transition/transition.haml +0 -5
- data/app/concepts/matestack/ui/core/transition/transition.js +0 -42
- data/app/concepts/matestack/ui/core/transition/transition.rb +0 -38
- data/app/concepts/matestack/ui/core/u/u.haml +0 -5
- data/app/concepts/matestack/ui/core/u/u.rb +0 -6
- data/app/concepts/matestack/ui/core/ul/ul.haml +0 -3
- data/app/concepts/matestack/ui/core/ul/ul.rb +0 -4
- data/app/concepts/matestack/ui/core/unescaped/unescaped.rb +0 -9
- data/app/concepts/matestack/ui/core/var/var.haml +0 -5
- data/app/concepts/matestack/ui/core/var/var.rb +0 -5
- data/app/concepts/matestack/ui/core/video/video.haml +0 -3
- data/app/concepts/matestack/ui/core/video/video.rb +0 -13
- data/app/concepts/matestack/ui/core/view/view.haml +0 -1
- data/app/concepts/matestack/ui/core/view/view.rb +0 -30
- data/app/concepts/matestack/ui/core/wbr/wbr.haml +0 -5
- data/app/concepts/matestack/ui/core/wbr/wbr.rb +0 -5
- data/app/concepts/matestack/ui/core/youtube/youtube.haml +0 -1
- data/app/concepts/matestack/ui/core/youtube/youtube.rb +0 -28
- data/app/helpers/matestack/ui/core/application_helper.rb +0 -111
- data/app/javascript/matestack-ui-core/index.js +0 -32
- data/app/javascript/matestack-ui-core/styles/index.scss +0 -5
- data/app/javascript/packs/matestack-ui-core.js +0 -8
- data/app/lib/matestack/ui/app.rb +0 -1
- data/app/lib/matestack/ui/component.rb +0 -1
- data/app/lib/matestack/ui/core/has_view_context.rb +0 -16
- data/app/lib/matestack/ui/core/html_attributes.rb +0 -43
- data/app/lib/matestack/ui/core/properties.rb +0 -161
- data/app/lib/matestack/ui/core/rendering/default_renderer_class_determiner.rb +0 -33
- data/app/lib/matestack/ui/core/rendering/main_renderer.rb +0 -203
- data/app/lib/matestack/ui/dynamic_actionview_component.rb +0 -1
- data/app/lib/matestack/ui/dynamic_component.rb +0 -1
- data/app/lib/matestack/ui/isolated_component.rb +0 -1
- data/app/lib/matestack/ui/page.rb +0 -1
- data/app/lib/matestack/ui/static_actionview_component.rb +0 -1
- data/app/lib/matestack/ui/static_component.rb +0 -1
- data/app/lib/matestack/ui/vue_js_component.rb +0 -1
- data/config/routes.rb +0 -2
- data/lib/generators/matestack/app/USAGE +0 -21
- data/lib/generators/matestack/app/app_generator.rb +0 -25
- data/lib/generators/matestack/app/templates/app/controllers/%file_name%_controller.rb.tt +0 -5
- data/lib/generators/matestack/app/templates/app/matestack/apps/%file_name%.rb.tt +0 -28
- data/lib/generators/matestack/component/USAGE +0 -20
- data/lib/generators/matestack/component/component_generator.rb +0 -29
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.haml.tt +0 -5
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.js.tt +0 -17
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.rb.tt +0 -11
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.scss.tt +0 -1
- data/lib/generators/matestack/core/component/USAGE +0 -16
- data/lib/generators/matestack/core/component/component_generator.rb +0 -23
- data/lib/generators/matestack/core/component/templates/app/concepts/matestack/ui/core/%file_name%/%file_name%.haml.tt +0 -5
- data/lib/generators/matestack/core/component/templates/app/concepts/matestack/ui/core/%file_name%/%file_name%.rb.tt +0 -4
- data/lib/generators/matestack/core/component/templates/docs/components/%file_name%.md.tt +0 -45
- data/lib/generators/matestack/core/component/templates/spec/usage/components/%file_name%_spec.rb +0 -31
- data/lib/generators/matestack/page/USAGE +0 -28
- data/lib/generators/matestack/page/page_generator.rb +0 -54
- data/lib/generators/matestack/page/templates/app/matestack/pages/%app_name%/%namespace%/%file_name%.rb.tt +0 -29
- data/lib/matestack/ui/core/cell.rb +0 -31
- data/lib/matestack/ui/core/component/registry.rb +0 -47
- data/lib/matestack/ui/core/components.rb +0 -271
- data/lib/matestack/ui/core/dsl.rb +0 -6
- data/lib/matestack/ui/core/engine.rb +0 -35
- data/lib/tasks/matestack/ui/core_tasks.rake +0 -4
- data/vendor/assets/javascripts/dist/manifest.json +0 -18
- data/vendor/assets/javascripts/dist/manifest.json.br +0 -0
- data/vendor/assets/javascripts/dist/manifest.json.gz +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.css +0 -3
- data/vendor/assets/javascripts/dist/matestack-ui-core.css.map +0 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.js +0 -17734
- data/vendor/assets/javascripts/dist/matestack-ui-core.js.map +0 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.css +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js +0 -3
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.LICENSE.txt +0 -11
- 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 +0 -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
- data/vendor/assets/javascripts/matestack-ui-core.js.erb +0 -2
- data/vendor/assets/stylesheets/dist +0 -1
- data/vendor/assets/stylesheets/matestack-ui-core.css.erb +0 -2
@@ -1,104 +0,0 @@
|
|
1
|
-
module Matestack::Ui::Core::Form
|
2
|
-
class Form < Matestack::Ui::Core::Component::Dynamic
|
3
|
-
vue_js_component_name "matestack-ui-core-form"
|
4
|
-
|
5
|
-
html_attributes :'accept-charset', :action, :autocomplete, :enctype, :method, :name, :novalidate, :rel, :target
|
6
|
-
|
7
|
-
requires :path, for: { as: :for_option }, method: { as: :form_method }
|
8
|
-
optional :success, :failure, :multipart, params: { as: :form_params }
|
9
|
-
|
10
|
-
def setup
|
11
|
-
begin
|
12
|
-
@component_config[:for] = form_wrapper
|
13
|
-
@component_config[:submit_path] = submit_path
|
14
|
-
@component_config[:method] = form_method
|
15
|
-
@component_config[:success] = success
|
16
|
-
@component_config[:multipart] = multipart == true
|
17
|
-
unless success.nil?
|
18
|
-
unless success[:transition].nil?
|
19
|
-
@component_config[:success][:transition][:path] = transition_path success
|
20
|
-
end
|
21
|
-
unless success[:redirect].nil?
|
22
|
-
@component_config[:success][:redirect][:path] = redirect_path success
|
23
|
-
end
|
24
|
-
end
|
25
|
-
@component_config[:failure] = failure
|
26
|
-
unless failure.nil?
|
27
|
-
unless failure[:transition].nil?
|
28
|
-
@component_config[:failure][:transition][:path] = transition_path failure
|
29
|
-
end
|
30
|
-
unless failure[:redirect].nil?
|
31
|
-
@component_config[:failure][:redirect][:path] = redirect_path failure
|
32
|
-
end
|
33
|
-
end
|
34
|
-
rescue => e
|
35
|
-
raise "Form component could not be setted up. Reason: #{e}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def form_attributes
|
40
|
-
html_attributes.merge({
|
41
|
-
"@submit.prevent": true,
|
42
|
-
"class": "matestack-form #{options[:class]}",
|
43
|
-
"v-bind:class": "{ 'has-errors': hasErrors(), 'loading': loading }"
|
44
|
-
})
|
45
|
-
end
|
46
|
-
|
47
|
-
def submit_path
|
48
|
-
begin
|
49
|
-
if path.is_a?(Symbol)
|
50
|
-
return ::Rails.application.routes.url_helpers.send(path, form_params)
|
51
|
-
else
|
52
|
-
return path
|
53
|
-
end
|
54
|
-
rescue
|
55
|
-
raise "Submit path not found"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def transition_path callback_options
|
60
|
-
begin
|
61
|
-
if callback_options[:transition][:path].is_a?(Symbol)
|
62
|
-
return ::Rails.application.routes.url_helpers.send(
|
63
|
-
callback_options[:transition][:path],
|
64
|
-
callback_options[:transition][:params]
|
65
|
-
)
|
66
|
-
else
|
67
|
-
return callback_options[:transition][:path]
|
68
|
-
end
|
69
|
-
rescue
|
70
|
-
raise "Transition path not found"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def redirect_path callback_options
|
75
|
-
begin
|
76
|
-
if callback_options[:redirect][:path].is_a?(Symbol)
|
77
|
-
return ::Rails.application.routes.url_helpers.send(
|
78
|
-
callback_options[:redirect][:path],
|
79
|
-
callback_options[:redirect][:params]
|
80
|
-
)
|
81
|
-
else
|
82
|
-
return callback_options[:redirect][:path]
|
83
|
-
end
|
84
|
-
rescue
|
85
|
-
raise "Redirect path not found"
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def form_wrapper
|
90
|
-
case for_option
|
91
|
-
when Symbol
|
92
|
-
return for_option
|
93
|
-
when String
|
94
|
-
return for_option
|
95
|
-
end
|
96
|
-
|
97
|
-
if for_option.respond_to?(:model_name)
|
98
|
-
return for_option.model_name.singular
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
|
103
|
-
end
|
104
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module Matestack::Ui::Core::Form::HasErrors
|
2
|
-
|
3
|
-
def self.included(base)
|
4
|
-
base.class_eval do
|
5
|
-
optional :errors
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
def error_key
|
10
|
-
"errors['#{key.to_s}']"
|
11
|
-
end
|
12
|
-
|
13
|
-
# error partial
|
14
|
-
# overwrite render_errors to customize error rendering
|
15
|
-
def render_errors
|
16
|
-
unless @included_config[:errors] == false && (errors == false || errors.nil?) || errors == false
|
17
|
-
self.send(wrapper_tag, class: wrapper_class, attributes: { 'v-if': error_key }) do
|
18
|
-
self.send(error_tag, class: error_class, attributes: { 'v-for': "error in #{error_key}" }) do
|
19
|
-
plain '{{ error }}'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def wrapper_tag
|
26
|
-
tag = get_error_config(@included_config[:errors], :wrapper, :tag) || :span
|
27
|
-
tag = get_error_config(errors, :wrapper, :tag) || tag
|
28
|
-
end
|
29
|
-
|
30
|
-
def wrapper_class
|
31
|
-
klass = get_error_config(@included_config[:errors], :wrapper, :class) || 'errors'
|
32
|
-
klass = get_error_config(errors, :wrapper, :class) || klass
|
33
|
-
end
|
34
|
-
|
35
|
-
def error_tag
|
36
|
-
tag = get_error_config(@included_config[:errors], :tag) || :span
|
37
|
-
tag = get_error_config(errors, :tag) || tag
|
38
|
-
end
|
39
|
-
|
40
|
-
def error_class
|
41
|
-
klass = get_error_config(@included_config[:errors], :class) || 'error'
|
42
|
-
klass = get_error_config(errors, :class) || klass
|
43
|
-
end
|
44
|
-
|
45
|
-
def input_error_class
|
46
|
-
klass = get_error_config(@included_config[:errors], :input, :class) || 'error'
|
47
|
-
klass = get_error_config(errors, :input, :class) || klass
|
48
|
-
end
|
49
|
-
|
50
|
-
def get_error_config(hash, *keys)
|
51
|
-
hash.dig(*keys) if hash.is_a?(Hash) && hash.dig(*keys)
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Matestack::Ui::Core::Form::HasInputHtmlAttributes
|
2
|
-
|
3
|
-
def self.included(base)
|
4
|
-
base.class_eval do
|
5
|
-
html_attributes(
|
6
|
-
:accept, :alt, :autocomplete, :autofocus, :checked, :dirname, :disabled, :form, :formaction,
|
7
|
-
:formenctype, :formmethod, :formnovalidate, :formtarget, :height, :list, :max, :maxlength, :min, :minlength,
|
8
|
-
:multiple, :name, :pattern, :placeholder, :readonly, :required, :size, :src, :step, :type, :value, :width
|
9
|
-
)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require_relative '../utils'
|
2
|
-
require_relative '../has_input_html_attributes'
|
3
|
-
require_relative '../has_errors'
|
4
|
-
module Matestack::Ui::Core::Form::Input
|
5
|
-
class Base < Matestack::Ui::Core::Component::Dynamic
|
6
|
-
include Matestack::Ui::Core::Form::Utils
|
7
|
-
include Matestack::Ui::Core::Form::HasInputHtmlAttributes
|
8
|
-
include Matestack::Ui::Core::Form::HasErrors
|
9
|
-
|
10
|
-
requires :key, :type
|
11
|
-
optional :multiple, :init, for: { as: :input_for }, label: { as: :input_label }
|
12
|
-
|
13
|
-
def setup
|
14
|
-
@component_config[:init_value] = init_value
|
15
|
-
end
|
16
|
-
|
17
|
-
def component_id
|
18
|
-
"input-component-for-#{attr_key}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def input_attributes
|
22
|
-
html_attributes.merge(attributes: vue_attributes)
|
23
|
-
end
|
24
|
-
|
25
|
-
def input_key
|
26
|
-
"$parent.data[\"#{key}\"]"
|
27
|
-
end
|
28
|
-
|
29
|
-
def error_key
|
30
|
-
"$parent.errors[\"#{key}\"]"
|
31
|
-
end
|
32
|
-
|
33
|
-
def change_event
|
34
|
-
"inputChanged('#{attr_key}'); #{ "filesAdded('#{attr_key}');" if type == :file }".strip
|
35
|
-
end
|
36
|
-
|
37
|
-
def vue_attributes
|
38
|
-
(options[:attributes] || {}).merge({
|
39
|
-
"@change": change_event,
|
40
|
-
ref: "input.#{attr_key}",
|
41
|
-
'init-value': init_value,
|
42
|
-
'v-bind:class': "{ '#{input_error_class}': #{error_key} }"
|
43
|
-
}).merge(
|
44
|
-
type != :file ? { "#{v_model_type}": input_key } : {}
|
45
|
-
) # file inputs are readonly, no v-model possible
|
46
|
-
end
|
47
|
-
|
48
|
-
def v_model_type
|
49
|
-
if type == :number || init_value.is_a?(Integer)
|
50
|
-
'v-model.number'
|
51
|
-
else
|
52
|
-
'v-model'
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def custom_options_validation
|
57
|
-
raise "included form config is missing, please add ':include' to parent form component" if @included_config.nil?
|
58
|
-
end
|
59
|
-
|
60
|
-
def attr_key
|
61
|
-
super + "#{'[]' if multiple && type == :file}"
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def parse_value(value)
|
67
|
-
if [true, false].include? value
|
68
|
-
value ? 1 : 0
|
69
|
-
else
|
70
|
-
return value
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import Vue from "vue/dist/vue.esm";
|
2
|
-
|
3
|
-
import formInputMixin from "./mixin";
|
4
|
-
import componentMixin from "../../component/component";
|
5
|
-
|
6
|
-
const componentDef = {
|
7
|
-
mixins: [componentMixin, formInputMixin],
|
8
|
-
data() {
|
9
|
-
return {};
|
10
|
-
}
|
11
|
-
}
|
12
|
-
|
13
|
-
let component = Vue.component("matestack-ui-core-form-input", componentDef);
|
14
|
-
|
15
|
-
export default componentDef;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require_relative './base'
|
2
|
-
|
3
|
-
module Matestack::Ui::Core::Form::Input
|
4
|
-
class Input < Base
|
5
|
-
|
6
|
-
vue_js_component_name "matestack-ui-core-form-input"
|
7
|
-
|
8
|
-
def response
|
9
|
-
div class: "matestack-ui-core-form-input" do
|
10
|
-
label text: input_label if input_label
|
11
|
-
input input_attributes
|
12
|
-
render_errors
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
const formInputMixin = {
|
2
|
-
methods: {
|
3
|
-
initialize: function(){
|
4
|
-
const self = this
|
5
|
-
let data = {};
|
6
|
-
|
7
|
-
for (let key in this.$refs) {
|
8
|
-
let initValue = this.$refs[key]["attributes"]["init-value"];
|
9
|
-
|
10
|
-
if (initValue) {
|
11
|
-
data[key.replace("input.", "")] = initValue["value"];
|
12
|
-
Object.assign(self.$parent.data, data);
|
13
|
-
self.afterInitialize(initValue["value"])
|
14
|
-
} else {
|
15
|
-
data[key.replace("input.", "")] = null;
|
16
|
-
Object.assign(self.$parent.data, data);
|
17
|
-
self.afterInitialize(null)
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
//without the timeout it's somehow not working
|
22
|
-
setTimeout(function () {
|
23
|
-
self.$forceUpdate()
|
24
|
-
}, 1);
|
25
|
-
},
|
26
|
-
filesAdded: function (key) {
|
27
|
-
const dataTransfer = event.dataTransfer || event.target;
|
28
|
-
const files = dataTransfer.files;
|
29
|
-
if (event.target.attributes.multiple) {
|
30
|
-
this.$parent.data[key] = [];
|
31
|
-
for (let index in files) {
|
32
|
-
if (files[index] instanceof File) {
|
33
|
-
this.$parent.data[key].push(files[index]);
|
34
|
-
}
|
35
|
-
}
|
36
|
-
} else {
|
37
|
-
this.$parent.data[key] = files[0];
|
38
|
-
}
|
39
|
-
},
|
40
|
-
inputChanged: function (key) {
|
41
|
-
this.$parent.resetErrors(key);
|
42
|
-
this.$forceUpdate();
|
43
|
-
},
|
44
|
-
afterInitialize: function(value){
|
45
|
-
// can be used in the main component for further initialization steps
|
46
|
-
},
|
47
|
-
setValue: function (value){
|
48
|
-
this.$parent.data[this.componentConfig["key"]] = value
|
49
|
-
this.$forceUpdate();
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
}
|
54
|
-
|
55
|
-
export default formInputMixin
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require_relative '../utils'
|
2
|
-
require_relative '../has_input_html_attributes'
|
3
|
-
require_relative '../has_errors'
|
4
|
-
module Matestack::Ui::Core::Form::Radio
|
5
|
-
class Base < Matestack::Ui::Core::Component::Dynamic
|
6
|
-
include Matestack::Ui::Core::Form::Utils
|
7
|
-
include Matestack::Ui::Core::Form::HasInputHtmlAttributes
|
8
|
-
include Matestack::Ui::Core::Form::HasErrors
|
9
|
-
|
10
|
-
requires :key
|
11
|
-
optional :multiple, :init, for: { as: :input_for }, label: { as: :input_label }, options: { as: :radio_options }
|
12
|
-
|
13
|
-
def setup
|
14
|
-
@component_config[:init_value] = init_value
|
15
|
-
end
|
16
|
-
|
17
|
-
def component_id
|
18
|
-
"radio-component-for-#{attr_key}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def input_key
|
22
|
-
"$parent.data[\"#{key}\"]"
|
23
|
-
end
|
24
|
-
|
25
|
-
def error_key
|
26
|
-
"$parent.errors[\"#{key}\"]"
|
27
|
-
end
|
28
|
-
|
29
|
-
def change_event
|
30
|
-
"inputChanged('#{attr_key}')"
|
31
|
-
end
|
32
|
-
|
33
|
-
def render_options
|
34
|
-
radio_options.to_a.each do |item|
|
35
|
-
input radio_attributes(item)
|
36
|
-
label text: item_label(item), for: id_for_item(item_value(item))
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def radio_attributes(item)
|
41
|
-
html_attributes.merge(
|
42
|
-
attributes: vue_attributes,
|
43
|
-
type: :radio,
|
44
|
-
id: "#{id_for_item(item_value(item))}",
|
45
|
-
name: item_name(item),
|
46
|
-
value: item_value(item),
|
47
|
-
)
|
48
|
-
end
|
49
|
-
|
50
|
-
def vue_attributes
|
51
|
-
(options[:attributes] || {}).merge({
|
52
|
-
"@change": change_event,
|
53
|
-
ref: "select.#{attr_key}",
|
54
|
-
'init-value': init_value,
|
55
|
-
'v-bind:class': "{ '#{input_error_class}': #{error_key} }",
|
56
|
-
'value-type': value_type,
|
57
|
-
"#{v_model_type}": input_key,
|
58
|
-
})
|
59
|
-
end
|
60
|
-
|
61
|
-
def value_type
|
62
|
-
item_value(radio_options.first).is_a?(Integer) ? Integer : nil
|
63
|
-
end
|
64
|
-
|
65
|
-
def item_value(item)
|
66
|
-
item.is_a?(Array) ? item.last : item
|
67
|
-
end
|
68
|
-
|
69
|
-
def item_name(item)
|
70
|
-
"#{attr_key}_#{item.is_a?(Array) ? item.first : item}"
|
71
|
-
end
|
72
|
-
|
73
|
-
def item_label(item)
|
74
|
-
item.is_a?(Array) ? item.first : item
|
75
|
-
end
|
76
|
-
|
77
|
-
def v_model_type
|
78
|
-
if radio_options && item_value(radio_options.first).is_a?(Integer)
|
79
|
-
'v-model.number'
|
80
|
-
else
|
81
|
-
'v-model'
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def id_for_item(value)
|
86
|
-
"#{html_attributes[:id] || attr_key}_#{value}"
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
const formRadioMixin = {
|
2
|
-
methods: {
|
3
|
-
initialize: function(){
|
4
|
-
const self = this
|
5
|
-
let data = {};
|
6
|
-
|
7
|
-
for (let key in self.$refs) {
|
8
|
-
let initValue = self.$refs[key]["attributes"]["init-value"];
|
9
|
-
let valueType = self.$refs[key]["attributes"]["value-type"];
|
10
|
-
|
11
|
-
if (key.startsWith("select.")) {
|
12
|
-
if (key.startsWith("select.multiple.")) {
|
13
|
-
if (initValue) {
|
14
|
-
data[key.replace("select.multiple.", "")] = JSON.parse(initValue["value"]);
|
15
|
-
Object.assign(self.$parent.data, data);
|
16
|
-
self.afterInitialize(JSON.parse(initValue["value"]))
|
17
|
-
} else {
|
18
|
-
data[key.replace("select.multiple.", "")] = [];
|
19
|
-
Object.assign(self.$parent.data, data);
|
20
|
-
self.afterInitialize([])
|
21
|
-
}
|
22
|
-
} else {
|
23
|
-
if (initValue) {
|
24
|
-
if (valueType && valueType["value"] == "Integer") {
|
25
|
-
data[key.replace("select.", "")] = parseInt(initValue["value"]);
|
26
|
-
Object.assign(self.$parent.data, data);
|
27
|
-
self.afterInitialize(parseInt(initValue["value"]))
|
28
|
-
} else {
|
29
|
-
data[key.replace("select.", "")] = initValue["value"];
|
30
|
-
Object.assign(self.$parent.data, data);
|
31
|
-
self.afterInitialize(initValue["value"])
|
32
|
-
}
|
33
|
-
} else {
|
34
|
-
data[key.replace("select.", "")] = null;
|
35
|
-
Object.assign(self.$parent.data, data);
|
36
|
-
self.afterInitialize(null)
|
37
|
-
}
|
38
|
-
}
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
//without the timeout it's somehow not working
|
43
|
-
setTimeout(function () {
|
44
|
-
self.$forceUpdate();
|
45
|
-
}, 1);
|
46
|
-
},
|
47
|
-
inputChanged: function (key) {
|
48
|
-
this.$parent.resetErrors(key);
|
49
|
-
this.$forceUpdate();
|
50
|
-
},
|
51
|
-
afterInitialize: function(value){
|
52
|
-
// can be used in the main component for further initialization steps
|
53
|
-
},
|
54
|
-
setValue: function (value){
|
55
|
-
this.$parent.data[this.componentConfig["key"]] = value
|
56
|
-
this.$forceUpdate();
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
}
|
61
|
-
|
62
|
-
export default formRadioMixin
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import Vue from "vue/dist/vue.esm";
|
2
|
-
|
3
|
-
import formRadioMixin from "./mixin";
|
4
|
-
import componentMixin from "../../component/component";
|
5
|
-
|
6
|
-
const componentDef = {
|
7
|
-
mixins: [componentMixin, formRadioMixin],
|
8
|
-
data() {
|
9
|
-
return {};
|
10
|
-
}
|
11
|
-
}
|
12
|
-
|
13
|
-
let component = Vue.component("matestack-ui-core-form-radio", componentDef);
|
14
|
-
|
15
|
-
export default componentDef;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require_relative './base'
|
2
|
-
|
3
|
-
module Matestack::Ui::Core::Form::Radio
|
4
|
-
class Radio < Base
|
5
|
-
|
6
|
-
vue_js_component_name "matestack-ui-core-form-radio"
|
7
|
-
|
8
|
-
def response
|
9
|
-
div class: "matestack-ui-core-form-radio" do
|
10
|
-
render_options
|
11
|
-
render_errors
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
require_relative '../utils'
|
2
|
-
require_relative '../has_errors'
|
3
|
-
module Matestack::Ui::Core::Form::Select
|
4
|
-
class Base < Matestack::Ui::Core::Component::Dynamic
|
5
|
-
include Matestack::Ui::Core::Form::Utils
|
6
|
-
include Matestack::Ui::Core::Form::HasErrors
|
7
|
-
|
8
|
-
html_attributes :autofocus, :disabled, :form, :multiple, :name, :required, :size
|
9
|
-
|
10
|
-
requires :key
|
11
|
-
optional :multiple, :init, :placeholder, :disabled_values,
|
12
|
-
for: { as: :input_for },
|
13
|
-
label: { as: :input_label },
|
14
|
-
options: { as: :select_options }
|
15
|
-
|
16
|
-
def setup
|
17
|
-
@component_config[:init_value] = init_value
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
def component_id
|
22
|
-
"select-component-for-#{attr_key}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def select_attributes
|
26
|
-
html_attributes.merge(attributes: vue_attributes)
|
27
|
-
end
|
28
|
-
|
29
|
-
def render_options
|
30
|
-
if placeholder
|
31
|
-
option value: 'null', disabled: true, selected: init_value.nil?, text: placeholder
|
32
|
-
end
|
33
|
-
select_options.to_a.each do |item|
|
34
|
-
option value: item_value(item), disabled: item_disabled(item), text: item_label(item)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def input_key
|
39
|
-
"$parent.data[\"#{key}\"]"
|
40
|
-
end
|
41
|
-
|
42
|
-
def error_key
|
43
|
-
"$parent.errors[\"#{key}\"]"
|
44
|
-
end
|
45
|
-
|
46
|
-
def change_event
|
47
|
-
"inputChanged('#{attr_key}')"
|
48
|
-
end
|
49
|
-
|
50
|
-
def vue_attributes
|
51
|
-
(options[:attributes] || {}).merge({
|
52
|
-
"@change": change_event,
|
53
|
-
ref: vue_ref,
|
54
|
-
'init-value': init_value || [],
|
55
|
-
'v-bind:class': "{ '#{input_error_class}': #{error_key} }",
|
56
|
-
'value-type': value_type,
|
57
|
-
"#{v_model_type}": input_key,
|
58
|
-
})
|
59
|
-
end
|
60
|
-
|
61
|
-
def vue_ref
|
62
|
-
"select#{'.multiple' if multiple}.#{attr_key}"
|
63
|
-
end
|
64
|
-
|
65
|
-
def value_type
|
66
|
-
item_value(select_options.first).is_a?(Integer) ? Integer : nil
|
67
|
-
end
|
68
|
-
|
69
|
-
def item_value(item)
|
70
|
-
item.is_a?(Array) ? item.last : item
|
71
|
-
end
|
72
|
-
|
73
|
-
def item_name(item)
|
74
|
-
"#{attr_key}_#{item.is_a?(Array) ? item.first : item}"
|
75
|
-
end
|
76
|
-
|
77
|
-
def item_disabled(item)
|
78
|
-
disabled_values.present? && disabled_values.include?(item_value(item))
|
79
|
-
end
|
80
|
-
|
81
|
-
def item_label(item)
|
82
|
-
item.is_a?(Array) ? item.first : item
|
83
|
-
end
|
84
|
-
|
85
|
-
def v_model_type
|
86
|
-
if select_options && item_value(select_options.first).is_a?(Integer) && !multiple
|
87
|
-
'v-model.number'
|
88
|
-
else
|
89
|
-
'v-model'
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def id_for_item(value)
|
94
|
-
"#{html_attributes[:id]}_#{value}"
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
const formSelectMixin = {
|
2
|
-
methods: {
|
3
|
-
initialize: function(){
|
4
|
-
const self = this
|
5
|
-
let data = {};
|
6
|
-
|
7
|
-
for (let key in self.$refs) {
|
8
|
-
let initValue = self.$refs[key]["attributes"]["init-value"];
|
9
|
-
let valueType = self.$refs[key]["attributes"]["value-type"];
|
10
|
-
|
11
|
-
if (key.startsWith("select.")) {
|
12
|
-
if (key.startsWith("select.multiple.")) {
|
13
|
-
if (initValue) {
|
14
|
-
data[key.replace("select.multiple.", "")] = JSON.parse(initValue["value"]);
|
15
|
-
self.afterInitialize(JSON.parse(initValue["value"]))
|
16
|
-
} else {
|
17
|
-
data[key.replace("select.multiple.", "")] = [];
|
18
|
-
self.afterInitialize([])
|
19
|
-
}
|
20
|
-
} else {
|
21
|
-
if (initValue) {
|
22
|
-
if (valueType && valueType["value"] == "Integer") {
|
23
|
-
data[key.replace("select.", "")] = parseInt(initValue["value"]);
|
24
|
-
self.afterInitialize(parseInt(initValue["value"]))
|
25
|
-
} else {
|
26
|
-
data[key.replace("select.", "")] = initValue["value"];
|
27
|
-
self.afterInitialize(initValue["value"])
|
28
|
-
}
|
29
|
-
} else {
|
30
|
-
data[key.replace("select.", "")] = null;
|
31
|
-
self.afterInitialize(null)
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
//without the timeout it's somehow not working
|
38
|
-
setTimeout(function () {
|
39
|
-
Object.assign(self.$parent.data, data);
|
40
|
-
self.$forceUpdate()
|
41
|
-
}, 1);
|
42
|
-
},
|
43
|
-
inputChanged: function (key) {
|
44
|
-
this.$parent.resetErrors(key);
|
45
|
-
this.$forceUpdate();
|
46
|
-
},
|
47
|
-
afterInitialize: function(value){
|
48
|
-
// can be used in the main component for further initialization steps
|
49
|
-
},
|
50
|
-
setValue: function (value){
|
51
|
-
this.$parent.data[this.componentConfig["key"]] = value
|
52
|
-
this.$forceUpdate();
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
}
|
57
|
-
|
58
|
-
export default formSelectMixin
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import Vue from "vue/dist/vue.esm";
|
2
|
-
|
3
|
-
import formSelectMixin from "./mixin";
|
4
|
-
import componentMixin from "../../component/component";
|
5
|
-
|
6
|
-
const componentDef = {
|
7
|
-
mixins: [componentMixin, formSelectMixin],
|
8
|
-
data() {
|
9
|
-
return {};
|
10
|
-
}
|
11
|
-
}
|
12
|
-
|
13
|
-
let component = Vue.component("matestack-ui-core-form-select", componentDef);
|
14
|
-
|
15
|
-
export default componentDef;
|