habarico 7.3.0.pre.beta.6 → 7.3.0.pre.beta.8

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: eda89e03950b126daf32cd28fc71e2304ad8f0ea952a40a7cbbe4f22bb214074
4
- data.tar.gz: e3d1f3ba8d50cc95d9a06ac90aef33a2a79a3cc988a69c099e259d6ee00ff4bc
3
+ metadata.gz: 02c2b994d63392dd85fc668efee018789371f77979afc35bc8fa71b40395962d
4
+ data.tar.gz: 69b2d4fdb8afab87d7fa24ea3728f84ea623af3952a830ae836beafd8229fbad
5
5
  SHA512:
6
- metadata.gz: 7543c39d73bd2e0036111fdfccb10d43527c93efea40486a5cf57f112b1566e7a032c8e6224838cd9ae3b56cdb27072eea7858a58e631c63d99e9c16e2b8fff3
7
- data.tar.gz: e1791678ea0908958c68090f9545b1870c37096f65e94a37ba502f35905c5260d60d3480351b48cc5516560c101780cff72ce8618d12edeac7927542637a1664
6
+ metadata.gz: a691cba026b07b3d45a19a82b834c356c36320e7580d0ce0c8419fe4fd14d10d4b9877a609d857bbfac6e250fa83a6594c14b9c7963763f1eea72678674c596e
7
+ data.tar.gz: 28d2e9ba64bb1bc9767b3f5f626d9838e23117858ed3e249a5f2e7772c9084af2f471b627fa255e17bee501494110d921d9c3347ea307e727a8dc010adb8bddf
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.3.0-beta.6
1
+ 7.3.0-beta.8
@@ -10,8 +10,9 @@ module Habarico
10
10
  # Array
11
11
  attr_accessor :target, :inline # rubocop:disable Lint/DuplicateMethods -- intentional for readability
12
12
 
13
- # Grid Item
14
- attr_accessor :xs, :sm, :md, :lg, :xl
13
+ # Grid Item - placement of the box inside its parent grid box, a hash of breakpoint spans
14
+ # ({ md: 9 }). Accepted by every box type, so a grid cell can be a list/gallery/array box itself.
15
+ attr_accessor :grid_item
15
16
 
16
17
  # List
17
18
  attr_accessor :reference, :target, :extra_filters, :row_actions, :list_toolbar_actions, :list_actions, :filters, :default_sorting, # rubocop:disable Lint/DuplicateMethods -- intentional for readability
@@ -152,8 +152,13 @@ module Habarico
152
152
  end
153
153
  end
154
154
 
155
+ # Unlike the other type-specific parameters, `grid_item` is a placement rather than a box type:
156
+ # any box carries it, so a grid cell can be a list/gallery/array box itself (HAB-963). A box
157
+ # without a placement must emit no `grid_item` key at all - the frontend turns the computed spans
158
+ # of the whole grid off as soon as one cell carries one, so an empty object would silently switch
159
+ # every other cell to a full-width row.
155
160
  def generate_grid_item(_view, box, _index, context)
156
- return nil unless box.type == 'grid-item'
161
+ return nil if box.grid_item.blank?
157
162
  grid_item_box_parameters_generator.generate(box, context)
158
163
  end
159
164
 
@@ -3,7 +3,7 @@ module Habarico
3
3
 
4
4
  def generate(box, context)
5
5
  # Validate arguments
6
- raise Eluvia::Errors::StandardError.new('Argument `box` must be a Habarico::GridItemBox') unless box.is_a?(Habarico::GridItemBox)
6
+ raise Eluvia::Errors::StandardError.new('Argument `box` must be a Habarico::Box') unless box.is_a?(Habarico::Box)
7
7
 
8
8
  # Create model
9
9
  Habarico::GridItemBoxParameters.new(
@@ -17,28 +17,34 @@ module Habarico
17
17
 
18
18
  protected
19
19
 
20
+ # Breakpoint spans of the box, given as a `grid_item` hash on any box type ({ md: 9 }).
21
+ def grid_item_spans(box)
22
+ spans = box.grid_item || {}
23
+ spans.respond_to?(:symbolize_keys) ? spans.symbolize_keys : spans
24
+ end
25
+
20
26
  # ***********************************************************************
21
27
  # Attribute generators
22
28
  # ***********************************************************************
23
29
 
24
30
  def generate_xs(box, _context)
25
- box.xs
31
+ grid_item_spans(box)[:xs]
26
32
  end
27
33
 
28
34
  def generate_sm(box, _context)
29
- box.sm
35
+ grid_item_spans(box)[:sm]
30
36
  end
31
37
 
32
38
  def generate_md(box, _context)
33
- box.md
39
+ grid_item_spans(box)[:md]
34
40
  end
35
41
 
36
42
  def generate_lg(box, _context)
37
- box.lg
43
+ grid_item_spans(box)[:lg]
38
44
  end
39
45
 
40
46
  def generate_xl(box, _context)
41
- box.xl
47
+ grid_item_spans(box)[:xl]
42
48
  end
43
49
  end
44
50
  end
@@ -29,7 +29,7 @@ module Habarico
29
29
  ai ai-text range]
30
30
 
31
31
  # BoxType - layout container types
32
- BOX_TYPE = %i[tab tab-item wizard simple list object array grid grid-item gallery] # rubocop:disable Style/MutableConstant
32
+ BOX_TYPE = %i[tab tab-item wizard simple list object array grid gallery] # rubocop:disable Style/MutableConstant
33
33
 
34
34
  # ViewType - kind of the view
35
35
  VIEW_TYPE = %i[list show create edit action].freeze
@@ -27,7 +27,7 @@ module Habarico
27
27
  boolean_attr :card
28
28
 
29
29
  # Makes the box collapsible; value sets the default state ('open' = expanded, 'closed' = collapsed).
30
- # Null means the box is not collapsible.
30
+ # Absent means the box is not collapsible.
31
31
  string_attr :collapsible
32
32
  enum_attr :collapsible, %i[open closed]
33
33
 
@@ -45,7 +45,10 @@ module Habarico
45
45
  # Additional parameters for box type 'wizard'
46
46
  has_one_attr :wizard, 'Habarico::WizardBoxParameters'
47
47
 
48
- # Additional parameters for box type 'grid-item'
48
+ # Placement of the box inside its parent 'grid' box - the column span at each breakpoint. Unlike
49
+ # the parameter blocks around it this one is not tied to a box type: any box carries it, so a grid
50
+ # cell can be a 'list'/'gallery'/'array' box itself (HAB-963). Absent when the box has no placement
51
+ # and the frontend computes the span from the number of cells.
49
52
  has_one_attr :grid_item, 'Habarico::GridItemBoxParameters'
50
53
 
51
54
  # Additional parameters for box type 'list'
data/lib/habarico.rb CHANGED
@@ -220,7 +220,6 @@ require "habarico/definition/boxes/box"
220
220
  require "habarico/definition/boxes/array_box"
221
221
  require "habarico/definition/boxes/gallery_box"
222
222
  require "habarico/definition/boxes/grid_box"
223
- require "habarico/definition/boxes/grid_item_box"
224
223
  require "habarico/definition/boxes/list_box"
225
224
  require "habarico/definition/boxes/object_box"
226
225
  require "habarico/definition/boxes/tab_box"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: habarico
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.0.pre.beta.6
4
+ version: 7.3.0.pre.beta.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matěj Outlý
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-29 00:00:00.000000000 Z
11
+ date: 2026-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -146,7 +146,6 @@ files:
146
146
  - lib/habarico/definition/boxes/box.rb
147
147
  - lib/habarico/definition/boxes/gallery_box.rb
148
148
  - lib/habarico/definition/boxes/grid_box.rb
149
- - lib/habarico/definition/boxes/grid_item_box.rb
150
149
  - lib/habarico/definition/boxes/list_box.rb
151
150
  - lib/habarico/definition/boxes/object_box.rb
152
151
  - lib/habarico/definition/boxes/tab_box.rb
@@ -1,10 +0,0 @@
1
- module Habarico
2
- class GridItemBox < Box
3
- include DefinitionModel
4
-
5
- def initialize(params = {})
6
- super(params)
7
- @type = 'grid-item'
8
- end
9
- end
10
- end