forest_admin_datasource_toolkit 1.0.0.pre.beta.50 → 1.0.0.pre.beta.52
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/forest_admin_datasource_toolkit/components/actions/action_field.rb +41 -0
- data/lib/forest_admin_datasource_toolkit/components/actions/action_field_factory.rb +50 -0
- data/lib/forest_admin_datasource_toolkit/components/actions/field_type.rb +39 -0
- data/lib/forest_admin_datasource_toolkit/components/actions/widget_field.rb +201 -0
- data/lib/forest_admin_datasource_toolkit/version.rb +1 -1
- metadata +6 -3
- data/lib/forest_admin_datasource_toolkit/components/action_field.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3915a9517060cb365ddde414dbe40e366bd01fbf425a3644e78fdeeaa197e0e
|
4
|
+
data.tar.gz: 38f7b4c1e6ef8035f93fc7da60150b0f9c62e6a175a0e591b4923cb7dc0cf070
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bae78c0a93a208bcb4b488a870f06a27280b2df9c64c3ff0e98353df008ebd4f18f442f052cc014d92a5e0e66f0034bd6dc3fd47032ffc180c6385d06b6e059e
|
7
|
+
data.tar.gz: 07472a96ba5b395b8a443674c763c54ff2bea64612e69761da77457612fdf2ce672e21bcb3dbebdf841a2b1ab365c05b6a9f28b65aac556830265deceebfa0e9
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module ForestAdminDatasourceToolkit
|
2
|
+
module Components
|
3
|
+
module Actions
|
4
|
+
class ActionField
|
5
|
+
attr_accessor :value, :watch_changes
|
6
|
+
attr_reader :type, :label, :description, :is_required, :is_read_only, :enum_values, :collection_name, :widget,
|
7
|
+
:placeholder
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
type:,
|
11
|
+
label:,
|
12
|
+
description: nil,
|
13
|
+
is_required: false,
|
14
|
+
is_read_only: false,
|
15
|
+
value: nil,
|
16
|
+
enum_values: nil,
|
17
|
+
collection_name: nil,
|
18
|
+
watch_changes: false,
|
19
|
+
placeholder: nil,
|
20
|
+
**_kwargs
|
21
|
+
)
|
22
|
+
@type = type
|
23
|
+
@label = label
|
24
|
+
@description = description
|
25
|
+
@is_required = is_required
|
26
|
+
@is_read_only = is_read_only
|
27
|
+
@value = value
|
28
|
+
@enum_values = enum_values
|
29
|
+
@collection_name = collection_name
|
30
|
+
@watch_changes = watch_changes
|
31
|
+
@widget = nil
|
32
|
+
@placeholder = placeholder
|
33
|
+
end
|
34
|
+
|
35
|
+
def watch_changes?
|
36
|
+
@watch_changes
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module ForestAdminDatasourceToolkit
|
2
|
+
module Components
|
3
|
+
module Actions
|
4
|
+
class ActionFieldFactory
|
5
|
+
def self.build(field)
|
6
|
+
case field[:widget]
|
7
|
+
when 'AddressAutocomplete'
|
8
|
+
WidgetField::AddressAutocompleteField.new(**field)
|
9
|
+
when 'Checkbox'
|
10
|
+
WidgetField::CheckboxField.new(**field)
|
11
|
+
when 'CheckboxGroup'
|
12
|
+
WidgetField::CheckboxGroupField.new(**field)
|
13
|
+
when 'ColorPicker'
|
14
|
+
WidgetField::ColorPickerField.new(**field)
|
15
|
+
when 'CurrencyInput'
|
16
|
+
WidgetField::CurrencyInputField.new(**field)
|
17
|
+
when 'DatePicker'
|
18
|
+
WidgetField::DatePickerField.new(**field)
|
19
|
+
when 'Dropdown'
|
20
|
+
WidgetField::DropdownField.new(**field)
|
21
|
+
when 'FilePicker'
|
22
|
+
WidgetField::FilePickerField.new(**field)
|
23
|
+
when 'JsonEditor'
|
24
|
+
WidgetField::JsonEditorField.new(**field)
|
25
|
+
when 'NumberInput'
|
26
|
+
WidgetField::NumberInputField.new(**field)
|
27
|
+
when 'NumberInputList'
|
28
|
+
WidgetField::NumberInputListField.new(**field)
|
29
|
+
when 'RadioGroup'
|
30
|
+
WidgetField::RadioGroupField.new(**field)
|
31
|
+
when 'RichText'
|
32
|
+
WidgetField::RichTextField.new(**field)
|
33
|
+
when 'TextArea'
|
34
|
+
WidgetField::TextAreaField.new(**field)
|
35
|
+
when 'TextInput'
|
36
|
+
WidgetField::TextInputField.new(**field)
|
37
|
+
when 'TextInputList'
|
38
|
+
WidgetField::TextInputListField.new(**field)
|
39
|
+
when 'TimePicker'
|
40
|
+
WidgetField::TimePickerField.new(**field)
|
41
|
+
when 'UserDropdown'
|
42
|
+
WidgetField::UserDropdownField.new(**field)
|
43
|
+
else
|
44
|
+
ActionField.new(**field)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module ForestAdminDatasourceToolkit
|
2
|
+
module Components
|
3
|
+
module Actions
|
4
|
+
class FieldType
|
5
|
+
BOOLEAN = 'Boolean'.freeze
|
6
|
+
|
7
|
+
DATE = 'Date'.freeze
|
8
|
+
|
9
|
+
TIME = 'Time'.freeze
|
10
|
+
|
11
|
+
DATE_ONLY = 'Dateonly'.freeze
|
12
|
+
|
13
|
+
COLLECTION = 'Collection'.freeze
|
14
|
+
|
15
|
+
ENUM = 'Enum'.freeze
|
16
|
+
|
17
|
+
ENUM_LIST = 'EnumList'.freeze
|
18
|
+
|
19
|
+
FILE = 'File'.freeze
|
20
|
+
|
21
|
+
FILE_LIST = 'FileList'.freeze
|
22
|
+
|
23
|
+
JSON = 'Json'.freeze
|
24
|
+
|
25
|
+
NUMBER = 'Number'.freeze
|
26
|
+
|
27
|
+
NUMBER_LIST = 'NumberList'.freeze
|
28
|
+
|
29
|
+
STRING = 'String'.freeze
|
30
|
+
|
31
|
+
STRING_LIST = 'StringList'.freeze
|
32
|
+
|
33
|
+
def self.all
|
34
|
+
constants.map { |constant| const_get(constant) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
module ForestAdminDatasourceToolkit
|
2
|
+
module Components
|
3
|
+
module Actions
|
4
|
+
module WidgetField
|
5
|
+
class TimePickerField < ActionField
|
6
|
+
attr_accessor :widget
|
7
|
+
|
8
|
+
def initialize(options)
|
9
|
+
super(**options)
|
10
|
+
@widget = 'TimePicker'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class AddressAutocompleteField < ActionField
|
15
|
+
attr_accessor :widget
|
16
|
+
|
17
|
+
def initialize(options)
|
18
|
+
super(**options)
|
19
|
+
@widget = 'AddressAutocomplete'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class CheckboxField < ActionField
|
24
|
+
attr_accessor :widget
|
25
|
+
|
26
|
+
def initialize(options)
|
27
|
+
super(**options)
|
28
|
+
@widget = 'Checkbox'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class CheckboxGroupField < ActionField
|
33
|
+
attr_accessor :widget, :options
|
34
|
+
|
35
|
+
def initialize(options)
|
36
|
+
super(**options)
|
37
|
+
@widget = 'CheckboxGroup'
|
38
|
+
@options = options[:options]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class ColorPickerField < ActionField
|
43
|
+
attr_accessor :widget, :enable_opacity, :quick_palette
|
44
|
+
|
45
|
+
def initialize(options)
|
46
|
+
super(**options)
|
47
|
+
@widget = 'ColorPicker'
|
48
|
+
@enable_opacity = options[:enable_opacity].nil? ? false : options[:enable_opacity]
|
49
|
+
@quick_palette = options[:quick_palette] || nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class CurrencyInputField < ActionField
|
54
|
+
attr_accessor :widget, :currency, :base, :min, :max, :step
|
55
|
+
|
56
|
+
def initialize(options)
|
57
|
+
super(**options)
|
58
|
+
@widget = 'CurrencyInput'
|
59
|
+
@currency = options[:currency]
|
60
|
+
@base = options[:base] || 'Unit'
|
61
|
+
@min = options[:min] || nil
|
62
|
+
@max = options[:max] || nil
|
63
|
+
@step = options[:step] || nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class DatePickerField < ActionField
|
68
|
+
attr_accessor :widget, :min, :max, :format, :step
|
69
|
+
|
70
|
+
def initialize(options)
|
71
|
+
super(**options)
|
72
|
+
@widget = 'DatePicker'
|
73
|
+
@format = options[:format] || nil
|
74
|
+
@min = options[:min] || nil
|
75
|
+
@max = options[:max] || nil
|
76
|
+
@step = options[:step] || nil
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class DropdownField < ActionField
|
81
|
+
attr_accessor :widget, :options, :search
|
82
|
+
|
83
|
+
def initialize(options)
|
84
|
+
super(**options)
|
85
|
+
@widget = 'Dropdown'
|
86
|
+
@options = options[:options]
|
87
|
+
@search = options[:search] || nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
class FilePickerField < ActionField
|
92
|
+
attr_accessor :widget, :extensions, :max_count, :max_size_mb
|
93
|
+
|
94
|
+
def initialize(options)
|
95
|
+
super(**options)
|
96
|
+
@widget = 'FilePicker'
|
97
|
+
@extensions = options[:extensions] || nil
|
98
|
+
@max_size_mb = options[:max_size_mb] || nil
|
99
|
+
@max_count = options[:max_count] || nil
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class NumberInputField < ActionField
|
104
|
+
attr_accessor :widget, :step, :min, :max
|
105
|
+
|
106
|
+
def initialize(options)
|
107
|
+
super(**options)
|
108
|
+
@widget = 'NumberInput'
|
109
|
+
@step = options[:step] || nil
|
110
|
+
@min = options[:min] || nil
|
111
|
+
@max = options[:max] || nil
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
class JsonEditorField < ActionField
|
116
|
+
attr_accessor :widget
|
117
|
+
|
118
|
+
def initialize(options)
|
119
|
+
super(**options)
|
120
|
+
@widget = 'JsonEditor'
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
class NumberInputListField < ActionField
|
125
|
+
attr_accessor :widget, :allow_duplicates, :allow_empty_values, :enable_reorder, :min, :max, :step
|
126
|
+
|
127
|
+
def initialize(options)
|
128
|
+
super(**options)
|
129
|
+
@widget = 'NumberInputList'
|
130
|
+
@allow_duplicates = options[:allow_duplicates]
|
131
|
+
@allow_empty_values = options[:allow_empty_values]
|
132
|
+
@enable_reorder = options[:enable_reorder]
|
133
|
+
@min = options[:min]
|
134
|
+
@max = options[:max]
|
135
|
+
@step = options[:step]
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
class RadioGroupField < ActionField
|
140
|
+
attr_accessor :widget, :options
|
141
|
+
|
142
|
+
def initialize(options)
|
143
|
+
super(**options)
|
144
|
+
@widget = 'RadioGroup'
|
145
|
+
@options = options[:options]
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
class RichTextField < ActionField
|
150
|
+
attr_accessor :widget
|
151
|
+
|
152
|
+
def initialize(options)
|
153
|
+
super(**options)
|
154
|
+
@widget = 'RichText'
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
class TextAreaField < ActionField
|
159
|
+
attr_accessor :widget, :rows
|
160
|
+
|
161
|
+
def initialize(options)
|
162
|
+
super(**options)
|
163
|
+
@widget = 'TextArea'
|
164
|
+
@rows = options[:rows] || nil
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
class TextInputField < ActionField
|
169
|
+
attr_accessor :widget
|
170
|
+
|
171
|
+
def initialize(options)
|
172
|
+
super(**options)
|
173
|
+
@widget = 'TextInput'
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
class TextInputListField < ActionField
|
178
|
+
attr_accessor :widget, :allow_duplicates, :allow_empty_values, :enable_reorder
|
179
|
+
|
180
|
+
def initialize(options)
|
181
|
+
super(**options)
|
182
|
+
|
183
|
+
@widget = 'TextInputList'
|
184
|
+
@allow_duplicates = !options[:allow_duplicates].nil?
|
185
|
+
@allow_empty_values = !options[:allow_empty_values].nil?
|
186
|
+
@enable_reorder = options[:enable_reorder].nil?
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
class UserDropdownField < ActionField
|
191
|
+
attr_accessor :widget
|
192
|
+
|
193
|
+
def initialize(options)
|
194
|
+
super(**options)
|
195
|
+
@widget = 'UserDropdown'
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
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.52
|
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-
|
12
|
+
date: 2024-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -55,7 +55,10 @@ files:
|
|
55
55
|
- forest_admin_datasource_toolkit.gemspec
|
56
56
|
- lib/forest_admin_datasource_toolkit.rb
|
57
57
|
- lib/forest_admin_datasource_toolkit/collection.rb
|
58
|
-
- lib/forest_admin_datasource_toolkit/components/action_field.rb
|
58
|
+
- lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
|
59
|
+
- lib/forest_admin_datasource_toolkit/components/actions/action_field_factory.rb
|
60
|
+
- lib/forest_admin_datasource_toolkit/components/actions/field_type.rb
|
61
|
+
- lib/forest_admin_datasource_toolkit/components/actions/widget_field.rb
|
59
62
|
- lib/forest_admin_datasource_toolkit/components/caller.rb
|
60
63
|
- lib/forest_admin_datasource_toolkit/components/charts/chart.rb
|
61
64
|
- lib/forest_admin_datasource_toolkit/components/charts/leaderboard_chart.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module ForestAdminDatasourceToolkit
|
2
|
-
module Components
|
3
|
-
class ActionField
|
4
|
-
attr_accessor :value, :watch_changes
|
5
|
-
attr_reader :type, :label, :description, :is_required, :is_read_only, :enum_values, :collection_name
|
6
|
-
|
7
|
-
def initialize(
|
8
|
-
type:,
|
9
|
-
label:,
|
10
|
-
description: nil,
|
11
|
-
is_required: false,
|
12
|
-
is_read_only: false,
|
13
|
-
value: nil,
|
14
|
-
enum_values: nil,
|
15
|
-
collection_name: nil,
|
16
|
-
watch_changes: false
|
17
|
-
)
|
18
|
-
@type = type
|
19
|
-
@label = label
|
20
|
-
@description = description
|
21
|
-
@is_required = is_required
|
22
|
-
@is_read_only = is_read_only
|
23
|
-
@value = value
|
24
|
-
@enum_values = enum_values
|
25
|
-
@collection_name = collection_name
|
26
|
-
@watch_changes = watch_changes
|
27
|
-
end
|
28
|
-
|
29
|
-
def watch_changes?
|
30
|
-
@watch_changes
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|