forest_admin_datasource_toolkit 1.0.0.pre.beta.71 → 1.0.0.pre.beta.73
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.rb +9 -0
- data/lib/forest_admin_datasource_toolkit/components/actions/action_field_factory.rb +5 -1
- data/lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb +27 -1
- data/lib/forest_admin_datasource_toolkit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2634924a0be0624dfb4d8b88ea7820b0b0a758ff01aa2dd5819cb0450ab08234
|
4
|
+
data.tar.gz: ece413eb1f5d7c363cecd5d69059cb2423e4741fcfbe8847189ee5506965beb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 177bcdd7ac53927498c2805c31d1817610d30e1f5614af39370cb1fff75e8076b8234510f40ba9322911bb67a298fe1c1fbd3f65bf4d4625122e0463aa7ec9c6
|
7
|
+
data.tar.gz: 65492c3ef7aff8904c544e43905140d91d54ea12b5e25969f2a5dfba9213bd97f26a7e65a7e6bbcf6ab63a3a7fecc7156ea5f41ed82078d576c6cc1fe387399e
|
@@ -37,6 +37,15 @@ module ForestAdminDatasourceToolkit
|
|
37
37
|
def watch_changes?
|
38
38
|
@watch_changes
|
39
39
|
end
|
40
|
+
|
41
|
+
def to_h
|
42
|
+
result = {}
|
43
|
+
instance_variables.each do |attribute|
|
44
|
+
result[attribute.to_s.delete('@').to_sym] = instance_variable_get(attribute)
|
45
|
+
end
|
46
|
+
|
47
|
+
result
|
48
|
+
end
|
40
49
|
end
|
41
50
|
end
|
42
51
|
end
|
@@ -3,7 +3,7 @@ module ForestAdminDatasourceToolkit
|
|
3
3
|
module Actions
|
4
4
|
class ActionFieldFactory
|
5
5
|
def self.build(field)
|
6
|
-
if field.key? :widget
|
6
|
+
if field.key?(:widget) && !field[:widget].nil?
|
7
7
|
build_widget(field)
|
8
8
|
elsif field[:type] == 'Layout'
|
9
9
|
build_layout_element(field)
|
@@ -21,6 +21,10 @@ module ForestAdminDatasourceToolkit
|
|
21
21
|
when 'Row'
|
22
22
|
return ActionLayoutElement::RowElement.new(**field) unless field[:fields].empty?
|
23
23
|
|
24
|
+
nil
|
25
|
+
when 'Page'
|
26
|
+
return ActionLayoutElement::PageElement.new(**field) unless field[:elements].empty?
|
27
|
+
|
24
28
|
nil
|
25
29
|
end
|
26
30
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_support/core_ext/string/inflections'
|
2
|
+
|
1
3
|
module ForestAdminDatasourceToolkit
|
2
4
|
module Components
|
3
5
|
module Actions
|
@@ -49,7 +51,31 @@ module ForestAdminDatasourceToolkit
|
|
49
51
|
|
50
52
|
def initialize(fields:, **options)
|
51
53
|
super(component: 'Row', **options)
|
52
|
-
@fields = fields
|
54
|
+
@fields = instantiate_subfields(fields)
|
55
|
+
end
|
56
|
+
|
57
|
+
def instantiate_subfields(fields)
|
58
|
+
fields.map do |field|
|
59
|
+
ActionFieldFactory.build(field.to_h)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class PageElement < BaseLayoutElement
|
65
|
+
attr_accessor :elements, :next_button_label, :previous_button_label
|
66
|
+
|
67
|
+
def initialize(elements:, previous_button_label:, next_button_label:, **options)
|
68
|
+
super(component: 'Page', **options)
|
69
|
+
@elements = elements
|
70
|
+
@next_button_label = next_button_label
|
71
|
+
@previous_button_label = previous_button_label
|
72
|
+
@elements = instantiate_elements(elements)
|
73
|
+
end
|
74
|
+
|
75
|
+
def instantiate_elements(elements)
|
76
|
+
elements.map do |element|
|
77
|
+
ActionFieldFactory.build(element.to_h)
|
78
|
+
end
|
53
79
|
end
|
54
80
|
end
|
55
81
|
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.73
|
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-10-
|
12
|
+
date: 2024-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|