Class: Ruflet::UI::Controls::RufletComponents::DragTargetControl

Inherits:
Control
  • Object
show all
Defined in:
lib/ruflet_ui/ruflet/ui/controls/shared/dragtarget_control.rb

Constant Summary collapse

TYPE =
"dragtarget".freeze
WIRE =
"DragTarget".freeze

Constants inherited from Control

Control::HOST_EXPANDED_TYPES

Instance Attribute Summary

Attributes inherited from Control

#children, #id, #props, #runtime_page, #type, #wire_id

Instance Method Summary collapse

Methods inherited from Control

#emit, generate_id, #has_handler?, #on, #to_patch

Constructor Details

#initialize(id: nil, badge: nil, col: nil, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, group: nil, key: nil, opacity: nil, rtl: nil, tooltip: nil, visible: nil, on_accept: nil, on_leave: nil, on_move: nil, on_will_accept: nil) ⇒ DragTargetControl

Returns a new instance of DragTargetControl.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ruflet_ui/ruflet/ui/controls/shared/dragtarget_control.rb', line 11

def initialize(id: nil, badge: nil, col: nil, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, group: nil, key: nil, opacity: nil, rtl: nil, tooltip: nil, visible: nil, on_accept: nil, on_leave: nil, on_move: nil, on_will_accept: nil)
  if content.nil? || (content.respond_to?(:props) && content.props["visible"] == false)
    raise ArgumentError, "drag_target requires visible content"
  end

  group = "default" if group.nil?

  props = {}
  props[:badge] = badge unless badge.nil?
  props[:col] = col unless col.nil?
  props[:content] = content unless content.nil?
  props[:data] = data unless data.nil?
  props[:disabled] = disabled unless disabled.nil?
  props[:expand] = expand unless expand.nil?
  props[:expand_loose] = expand_loose unless expand_loose.nil?
  props[:group] = group unless group.nil?
  props[:key] = key unless key.nil?
  props[:opacity] = opacity unless opacity.nil?
  props[:rtl] = rtl unless rtl.nil?
  props[:tooltip] = tooltip unless tooltip.nil?
  props[:visible] = visible unless visible.nil?
  props[:on_accept] = on_accept unless on_accept.nil?
  props[:on_leave] = on_leave unless on_leave.nil?
  props[:on_move] = on_move unless on_move.nil?
  props[:on_will_accept] = on_will_accept unless on_will_accept.nil?
  super(type: TYPE, id: id, **props)
end