forest_admin_datasource_toolkit 1.0.0.pre.beta.66 → 1.0.0.pre.beta.67
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/lib/forest_admin_datasource_toolkit/components/actions/action_field_factory.rb +17 -2
- data/lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb +40 -0
- data/lib/forest_admin_datasource_toolkit/components/actions/field_type.rb +2 -0
- data/lib/forest_admin_datasource_toolkit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c661bd99cd5135390e188b12d0741f71c7cc88126487c7bbd1fb6503cc940280
|
4
|
+
data.tar.gz: c7dd01683fa557de9bd52c8c0dddf24d84cb507849bf6554cb1b7462bcdf8900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4de408d6d0c1096dcb294e9c89a8d3e1cab74d497a0be4423d96c877875744e3d3a24a627e9467f07ca81fa0b2e50d29b24dafb60954f95ff37d7ee769c6355
|
7
|
+
data.tar.gz: 1d4e8e061f8bfb608f030b349b38ddba92b621cbeb2397a1e09834069bc3ecc1c5a979ff977f346fd8c40c5ae88063b7d2285500ebfbf5f0c1d5cbc56710f51e
|
@@ -3,6 +3,23 @@ module ForestAdminDatasourceToolkit
|
|
3
3
|
module Actions
|
4
4
|
class ActionFieldFactory
|
5
5
|
def self.build(field)
|
6
|
+
if field.key? :widget
|
7
|
+
build_widget(field)
|
8
|
+
elsif field[:type] == 'Layout'
|
9
|
+
build_layout_element(field)
|
10
|
+
else
|
11
|
+
ActionField.new(**field)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.build_layout_element(field)
|
16
|
+
case field[:component]
|
17
|
+
when 'Separator'
|
18
|
+
ActionLayoutElement::SeparatorElement.new(**field)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.build_widget(field)
|
6
23
|
case field[:widget]
|
7
24
|
when 'AddressAutocomplete'
|
8
25
|
WidgetField::AddressAutocompleteField.new(**field)
|
@@ -40,8 +57,6 @@ module ForestAdminDatasourceToolkit
|
|
40
57
|
WidgetField::TimePickerField.new(**field)
|
41
58
|
when 'UserDropdown'
|
42
59
|
WidgetField::UserDropdownField.new(**field)
|
43
|
-
else
|
44
|
-
ActionField.new(**field)
|
45
60
|
end
|
46
61
|
end
|
47
62
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module ForestAdminDatasourceToolkit
|
2
|
+
module Components
|
3
|
+
module Actions
|
4
|
+
module ActionLayoutElement
|
5
|
+
class BaseLayoutElement
|
6
|
+
attr_reader :type, :component
|
7
|
+
|
8
|
+
def initialize(component:, **_kwargs)
|
9
|
+
@type = FieldType::LAYOUT
|
10
|
+
@component = component
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_h
|
14
|
+
result = {}
|
15
|
+
instance_variables.each do |attribute|
|
16
|
+
result[attribute.to_s.delete('@').camelize(:lower).to_sym] = instance_variable_get(attribute)
|
17
|
+
end
|
18
|
+
|
19
|
+
result
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class InputElement < BaseLayoutElement
|
24
|
+
attr_reader :field_id
|
25
|
+
|
26
|
+
def initialize(field_id:, **options)
|
27
|
+
super(component: 'Separator', **options)
|
28
|
+
@field_id = field_id
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class SeparatorElement < BaseLayoutElement
|
33
|
+
def initialize(**options)
|
34
|
+
super(component: 'Separator', **options)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forest_admin_datasource_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.beta.
|
4
|
+
version: 1.0.0.pre.beta.67
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-09-
|
12
|
+
date: 2024-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/forest_admin_datasource_toolkit/collection.rb
|
58
58
|
- lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
|
59
59
|
- lib/forest_admin_datasource_toolkit/components/actions/action_field_factory.rb
|
60
|
+
- lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb
|
60
61
|
- lib/forest_admin_datasource_toolkit/components/actions/field_type.rb
|
61
62
|
- lib/forest_admin_datasource_toolkit/components/actions/widget_field.rb
|
62
63
|
- lib/forest_admin_datasource_toolkit/components/caller.rb
|