Class: Mxrb::Compiler::DataGridBundleCompiler
- Inherits:
-
Object
- Object
- Mxrb::Compiler::DataGridBundleCompiler
- Includes:
- ModelValues
- Defined in:
- lib/mxrb/compiler/data_grid_bundle_compiler.rb
Overview
Compiles the Data Grid 2 XPath/attribute-column subset into pluggable-widget properties. rubocop:disable Metrics
Constant Summary collapse
- WIDGET_ID =
'com.mendix.widget.web.datagrid.Datagrid'
Instance Method Summary collapse
-
#initialize(source, page_name, widget = nil, render_widgets: nil, **widget_keywords) ⇒ DataGridBundleCompiler
constructor
A new instance of DataGridBundleCompiler.
- #render ⇒ Object
- #supported? ⇒ Boolean
Constructor Details
#initialize(source, page_name, widget = nil, render_widgets: nil, **widget_keywords) ⇒ DataGridBundleCompiler
Returns a new instance of DataGridBundleCompiler.
14 15 16 17 18 19 20 |
# File 'lib/mxrb/compiler/data_grid_bundle_compiler.rb', line 14 def initialize(source, page_name, = nil, render_widgets: nil, **) @source = source @page_name = page_name @widget = || @render_widgets = @index = document_index end |
Instance Method Details
#render ⇒ Object
27 28 29 |
# File 'lib/mxrb/compiler/data_grid_bundle_compiler.rb', line 27 def render "React.createElement($Datagrid, #{js_object(properties)})" end |
#supported? ⇒ Boolean
22 23 24 25 |
# File 'lib/mxrb/compiler/data_grid_bundle_compiler.rb', line 22 def supported? &.fetch('WidgetId', nil) == WIDGET_ID && xpath_source && columns.all? { supported_column?(_1) } end |