forest_admin_datasource_customizer 1.50.2 → 1.51.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7408cccc4f3730e14b16b8c62d92a345dac5013c103b01b0da27b6d67d72ba26
4
- data.tar.gz: a76e286219233871a7a6ca4f68a0745753a008821665f7c65fd8821c83d37336
3
+ metadata.gz: 9b26c9a68554922fa0f5d0302d8789049b31bd199dfee20e41726b953dd86b3f
4
+ data.tar.gz: 12217da00d7cde2f488b3b6851a6457cf87bfc4865fc66b38cfb6a9f2cf82f81
5
5
  SHA512:
6
- metadata.gz: 22eafc1dbfade8f464b8c4f8bfaa1bea9ec8e81cf267a178d66024f6d6f9ac1b5b0befa3412b9f0f0c0fc5354a12409d4b938b513631c0d44d250fb8359e4f7c
7
- data.tar.gz: 223dcff798198873e6ebddf00b738896ecf71a88284b5b4c477a85d51f80eda03f63acea7af23490de09e9c29aacd04d3f7712ad7e4e71241d683afd02b4d03d
6
+ metadata.gz: ce718458a7c787db63015d5fbce7221f5b187bc5bee7755f9a8ed6c1ec8cd6d0946d68cd502608f447a4edd94b934a678c8f36ec2e4d0a6cde7290e013f475f6
7
+ data.tar.gz: 5dcbec9ade5e7ac9680d2ec86a6f78e1ed43d90db957abe281e81e3ba78084d42054505d6edcd7235f80e929282b9399ab0e2dce419b8601890ac8ef24ea3369
@@ -2,16 +2,18 @@ module ForestAdminDatasourceCustomizer
2
2
  module Decorators
3
3
  module Action
4
4
  class BaseAction
5
- attr_reader :scope, :form, :is_generate_file, :description, :submit_button_label, :execute, :static_form
5
+ attr_reader :scope, :form, :is_generate_file, :description, :submit_button_label, :pending_refresh_interval,
6
+ :execute, :static_form
6
7
 
7
8
  # rubocop:disable Metrics/ParameterLists
8
9
  def initialize(scope:, form: nil, is_generate_file: false, description: nil,
9
- submit_button_label: nil, static_form: false, &execute)
10
+ submit_button_label: nil, pending_refresh_interval: nil, static_form: false, &execute)
10
11
  @scope = scope
11
12
  @form = form
12
13
  @is_generate_file = is_generate_file
13
14
  @description = description
14
15
  @submit_button_label = submit_button_label
16
+ @pending_refresh_interval = pending_refresh_interval
15
17
  @execute = execute
16
18
  @static_form = static_form
17
19
  end
@@ -24,6 +26,7 @@ module ForestAdminDatasourceCustomizer
24
26
  is_generate_file: action[:is_generate_file],
25
27
  description: action[:description],
26
28
  submit_button_label: action[:submit_button_label],
29
+ pending_refresh_interval: action[:pending_refresh_interval],
27
30
  static_form: action[:static_form] || false,
28
31
  &action[:execute]
29
32
  )
@@ -2,8 +2,8 @@ module ForestAdminDatasourceCustomizer
2
2
  module Decorators
3
3
  module Action
4
4
  class DynamicField < BaseFormElement
5
- attr_accessor :type, :label, :description, :is_required, :is_read_only, :if_condition, :value, :default_value,
6
- :collection_name, :enum_values, :placeholder, :id
5
+ attr_accessor :type, :label, :description, :is_required, :is_read_only, :is_pending, :if_condition, :value,
6
+ :default_value, :collection_name, :enum_values, :placeholder, :id
7
7
 
8
8
  def initialize(
9
9
  type:,
@@ -12,6 +12,7 @@ module ForestAdminDatasourceCustomizer
12
12
  description: nil,
13
13
  is_required: false,
14
14
  is_read_only: false,
15
+ is_pending: false,
15
16
  if_condition: nil,
16
17
  value: nil,
17
18
  default_value: nil,
@@ -32,6 +33,7 @@ module ForestAdminDatasourceCustomizer
32
33
  @description = description
33
34
  @is_required = is_required
34
35
  @is_read_only = is_read_only
36
+ @is_pending = is_pending
35
37
  @if_condition = if_condition
36
38
  @value = value
37
39
  @default_value = default_value
@@ -33,6 +33,7 @@ module ForestAdminDatasourceCustomizer
33
33
  @execute_block = nil
34
34
  @description = nil
35
35
  @submit_button_label = nil
36
+ @pending_refresh_interval = nil
36
37
  @generate_file = false
37
38
  end
38
39
 
@@ -48,6 +49,12 @@ module ForestAdminDatasourceCustomizer
48
49
  @submit_button_label = label
49
50
  end
50
51
 
52
+ # Set the delay between two form refreshes while a field is pending
53
+ # @param seconds [Integer] refresh interval in seconds
54
+ def pending_refresh_interval(seconds)
55
+ @pending_refresh_interval = seconds
56
+ end
57
+
51
58
  # Mark action as generating a file
52
59
  def generates_file!
53
60
  @generate_file = true
@@ -85,6 +92,7 @@ module ForestAdminDatasourceCustomizer
85
92
  is_generate_file: @generate_file,
86
93
  description: @description,
87
94
  submit_button_label: @submit_button_label,
95
+ pending_refresh_interval: @pending_refresh_interval,
88
96
  &@execute_block
89
97
  )
90
98
  end
@@ -38,6 +38,7 @@ module ForestAdminDatasourceCustomizer
38
38
  # @param options [Array<Hash>, Proc] options for dropdown/radio widgets (static or dynamic)
39
39
  # @param readonly [Boolean, Proc] whether field is read-only (static or dynamic)
40
40
  # @param required [Boolean, Proc] whether field is required (static or dynamic)
41
+ # @param pending [Boolean, Proc] whether field is waiting for its data (static or dynamic)
41
42
  # @param default [Object, Proc] default value (static or dynamic)
42
43
  # @param description [String, Proc] field description (static or dynamic)
43
44
  # @param placeholder [String, Proc] placeholder text (static or dynamic)
@@ -45,7 +46,7 @@ module ForestAdminDatasourceCustomizer
45
46
  # @param enum_values [Array, Proc] enum values for enum fields (static or dynamic)
46
47
  # @param collection_name [String, Proc] target collection name (static or dynamic)
47
48
  # @param block [Proc] optional proc for computed values
48
- def field(name, type:, widget: nil, options: nil, readonly: nil, required: nil, default: nil,
49
+ def field(name, type:, widget: nil, options: nil, readonly: nil, required: nil, pending: nil, default: nil,
49
50
  description: nil, placeholder: nil, if_condition: nil, enum_values: nil, collection_name: nil, &block)
50
51
  field_def = {
51
52
  label: name.to_s,
@@ -56,6 +57,7 @@ module ForestAdminDatasourceCustomizer
56
57
  field_def[:options] = options if options
57
58
  field_def[:is_read_only] = readonly if readonly
58
59
  field_def[:is_required] = required if required
60
+ field_def[:is_pending] = pending if pending
59
61
  field_def[:default_value] = default if default
60
62
  field_def[:description] = description if description
61
63
  field_def[:placeholder] = placeholder if placeholder
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceCustomizer
2
- VERSION = "1.50.2"
2
+ VERSION = "1.51.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_customizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.50.2
4
+ version: 1.51.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu