thinreports 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CONTRIBUTING.md +2 -0
  3. data/.travis.yml +3 -3
  4. data/CHANGELOG.md +98 -1
  5. data/README.md +0 -9
  6. data/Rakefile +1 -2
  7. data/examples/character_spacing/character_spacing.tlf +293 -1
  8. data/examples/dynamic_image/dynamic_image.tlf +661 -1
  9. data/examples/dynamic_style/dynamic_style.rb +4 -4
  10. data/examples/dynamic_style/dynamic_style.tlf +1835 -1
  11. data/examples/dynamic_style/dynamic_style_in_list.tlf +344 -1
  12. data/examples/eudc/eudc.tlf +180 -1
  13. data/examples/hidden_shapes/hidden_shapes.tlf +449 -1
  14. data/examples/list_events/list_events.rb +1 -28
  15. data/examples/list_events/list_events.tlf +361 -0
  16. data/examples/list_manual_generation/list_manual_generation.tlf +132 -1
  17. data/examples/list_page_number/list_page_number.tlf +254 -1
  18. data/examples/page_number/page_number.tlf +215 -1
  19. data/examples/palleted_png/palleted_png.rb +2 -0
  20. data/examples/palleted_png/palleted_png.tlf +47 -1
  21. data/examples/password_setting/password_setting.tlf +45 -1
  22. data/examples/report_callbacks/report_callbacks.rb +1 -18
  23. data/examples/report_callbacks/report_callbacks.tlf +147 -1
  24. data/examples/single_line_tblock/single_line_tblock.tlf +170 -1
  25. data/examples/tblock_overflow/tblock_overflow.tlf +538 -1
  26. data/examples/tblock_styles/font_size.tlf +383 -1
  27. data/examples/tblock_styles/tblock_styles.tlf +889 -1
  28. data/examples/text_align/text_align.tlf +241 -1
  29. data/examples/typeB_page_size/B4_ISO.tlf +45 -1
  30. data/examples/typeB_page_size/B4_JIS.tlf +45 -1
  31. data/examples/word_wrap/word_wrap.tlf +297 -1
  32. data/lib/thinreports.rb +0 -1
  33. data/lib/thinreports/config.rb +3 -0
  34. data/lib/thinreports/core/errors.rb +0 -3
  35. data/lib/thinreports/core/format/base.rb +4 -4
  36. data/lib/thinreports/core/shape.rb +1 -9
  37. data/lib/thinreports/core/shape/basic.rb +3 -3
  38. data/lib/thinreports/core/shape/basic/block_format.rb +1 -1
  39. data/lib/thinreports/core/shape/basic/format.rb +2 -14
  40. data/lib/thinreports/core/shape/basic/internal.rb +2 -2
  41. data/lib/thinreports/core/shape/image_block.rb +3 -3
  42. data/lib/thinreports/core/shape/image_block/format.rb +0 -2
  43. data/lib/thinreports/core/shape/image_block/internal.rb +1 -1
  44. data/lib/thinreports/core/shape/list.rb +3 -7
  45. data/lib/thinreports/core/shape/list/format.rb +37 -24
  46. data/lib/thinreports/core/shape/list/manager.rb +1 -36
  47. data/lib/thinreports/core/shape/list/page.rb +0 -15
  48. data/lib/thinreports/core/shape/list/page_state.rb +1 -1
  49. data/lib/thinreports/core/shape/list/section_format.rb +14 -12
  50. data/lib/thinreports/core/shape/list/section_internal.rb +4 -7
  51. data/lib/thinreports/core/shape/manager/format.rb +0 -2
  52. data/lib/thinreports/core/shape/manager/internal.rb +1 -1
  53. data/lib/thinreports/core/shape/page_number.rb +1 -1
  54. data/lib/thinreports/core/shape/page_number/format.rb +9 -6
  55. data/lib/thinreports/core/shape/page_number/interface.rb +1 -1
  56. data/lib/thinreports/core/shape/page_number/internal.rb +2 -6
  57. data/lib/thinreports/core/shape/style/base.rb +11 -13
  58. data/lib/thinreports/core/shape/style/basic.rb +4 -4
  59. data/lib/thinreports/core/shape/style/graphic.rb +4 -10
  60. data/lib/thinreports/core/shape/style/text.rb +36 -69
  61. data/lib/thinreports/core/shape/text.rb +3 -3
  62. data/lib/thinreports/core/shape/text/format.rb +3 -13
  63. data/lib/thinreports/core/shape/text/internal.rb +2 -2
  64. data/lib/thinreports/core/shape/text_block.rb +3 -3
  65. data/lib/thinreports/core/shape/text_block/format.rb +9 -6
  66. data/lib/thinreports/core/shape/text_block/interface.rb +7 -7
  67. data/lib/thinreports/core/shape/text_block/internal.rb +1 -1
  68. data/lib/thinreports/generator/pdf.rb +0 -1
  69. data/lib/thinreports/generator/pdf/document.rb +2 -2
  70. data/lib/thinreports/generator/pdf/document/draw_shape.rb +25 -51
  71. data/lib/thinreports/generator/pdf/document/draw_template_items.rb +66 -0
  72. data/lib/thinreports/generator/pdf/document/font.rb +3 -8
  73. data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +97 -77
  74. data/lib/thinreports/generator/pdf/document/graphics/basic.rb +18 -13
  75. data/lib/thinreports/generator/pdf/document/graphics/image.rb +17 -12
  76. data/lib/thinreports/generator/pdf/document/page.rb +1 -1
  77. data/lib/thinreports/generator/pdf/drawer/list.rb +5 -1
  78. data/lib/thinreports/generator/pdf/drawer/list_section.rb +1 -4
  79. data/lib/thinreports/generator/pdf/drawer/page.rb +9 -9
  80. data/lib/thinreports/layout.rb +3 -3
  81. data/lib/thinreports/layout/base.rb +0 -16
  82. data/lib/thinreports/layout/format.rb +38 -57
  83. data/lib/thinreports/layout/legacy_schema.rb +354 -0
  84. data/lib/thinreports/layout/version.rb +1 -1
  85. data/lib/thinreports/report.rb +0 -1
  86. data/lib/thinreports/report/base.rb +3 -17
  87. data/lib/thinreports/report/internal.rb +13 -55
  88. data/lib/thinreports/report/page.rb +1 -1
  89. data/lib/thinreports/version.rb +1 -1
  90. data/test/data/legacy_layout/all-items.tlf +1 -0
  91. data/test/schema_helper.rb +121 -0
  92. data/test/test_helper.rb +13 -50
  93. data/test/unit/core/format/test_base.rb +35 -31
  94. data/test/unit/core/shape/base/test_internal.rb +1 -1
  95. data/test/unit/core/shape/basic/test_block_format.rb +23 -0
  96. data/test/unit/core/shape/basic/{test_basic_interface.rb → test_block_interface.rb} +1 -1
  97. data/test/unit/core/shape/basic/{test_basic_internal.rb → test_block_internal.rb} +4 -7
  98. data/test/unit/core/shape/basic/test_format.rb +25 -47
  99. data/test/unit/core/shape/basic/test_interface.rb +5 -5
  100. data/test/unit/core/shape/basic/test_internal.rb +6 -11
  101. data/test/unit/core/shape/image_block/test_interface.rb +5 -5
  102. data/test/unit/core/shape/image_block/test_internal.rb +2 -2
  103. data/test/unit/core/shape/list/test_format.rb +86 -44
  104. data/test/unit/core/shape/list/test_manager.rb +10 -65
  105. data/test/unit/core/shape/list/test_page.rb +10 -61
  106. data/test/unit/core/shape/list/test_page_state.rb +1 -1
  107. data/test/unit/core/shape/list/test_section_format.rb +19 -28
  108. data/test/unit/core/shape/list/test_section_interface.rb +14 -6
  109. data/test/unit/core/shape/list/test_section_internal.rb +17 -23
  110. data/test/unit/core/shape/manager/test_format.rb +1 -1
  111. data/test/unit/core/shape/manager/test_internal.rb +59 -98
  112. data/test/unit/core/shape/manager/test_target.rb +21 -30
  113. data/test/unit/core/shape/page_number/test_format.rb +34 -52
  114. data/test/unit/core/shape/page_number/test_interface.rb +1 -1
  115. data/test/unit/core/shape/page_number/test_internal.rb +2 -2
  116. data/test/unit/core/shape/styles/test_base.rb +16 -41
  117. data/test/unit/core/shape/styles/test_basic.rb +7 -7
  118. data/test/unit/core/shape/styles/test_graphic.rb +27 -32
  119. data/test/unit/core/shape/styles/test_text.rb +68 -311
  120. data/test/unit/core/shape/text/test_format.rb +30 -59
  121. data/test/unit/core/shape/text/test_internal.rb +5 -5
  122. data/test/unit/core/shape/text_block/formatter/test_datetime.rb +13 -13
  123. data/test/unit/core/shape/text_block/test_format.rb +145 -146
  124. data/test/unit/core/shape/text_block/test_interface.rb +9 -9
  125. data/test/unit/core/shape/text_block/test_internal.rb +9 -9
  126. data/test/unit/core/test_shape.rb +19 -31
  127. data/test/unit/generator/pdf/document/graphics/test_attributes.rb +112 -122
  128. data/test/unit/generator/pdf/document/graphics/test_basic.rb +45 -0
  129. data/test/unit/generator/pdf/document/graphics/test_image.rb +5 -5
  130. data/test/unit/generator/pdf/document/test_font.rb +4 -10
  131. data/test/unit/generator/pdf/document/test_page.rb +13 -11
  132. data/test/unit/generator/pdf/document/test_parse_color.rb +5 -5
  133. data/test/unit/generator/test_base.rb +5 -5
  134. data/test/unit/generator/test_configuration.rb +4 -8
  135. data/test/unit/generator/test_pdf.rb +3 -2
  136. data/test/unit/layout/test_base.rb +16 -22
  137. data/test/unit/layout/test_format.rb +66 -86
  138. data/test/unit/layout/test_legacy_schema.rb +587 -0
  139. data/test/unit/layout/test_version.rb +20 -20
  140. data/test/unit/report/test_base.rb +32 -45
  141. data/test/unit/report/test_internal.rb +43 -99
  142. data/test/unit/test_config.rb +4 -2
  143. data/test/unit/test_layout.rb +1 -1
  144. metadata +20 -48
  145. data/examples/list_events/list_events_0_7_7.tlf +0 -1
  146. data/examples/list_events/list_events_0_8.tlf +0 -1
  147. data/lib/thinreports/core/events.rb +0 -69
  148. data/lib/thinreports/core/format/builder.rb +0 -62
  149. data/lib/thinreports/core/shape/list/configuration.rb +0 -54
  150. data/lib/thinreports/core/shape/list/events.rb +0 -47
  151. data/lib/thinreports/core/shape/list/store.rb +0 -33
  152. data/lib/thinreports/generator/pdf/configuration.rb +0 -33
  153. data/lib/thinreports/generator/pdf/document/parse_svg.rb +0 -104
  154. data/lib/thinreports/layout/configuration.rb +0 -29
  155. data/test/data/layout_block.tlf +0 -1
  156. data/test/data/layout_list.tlf +0 -1
  157. data/test/data/layout_list_noheader.tlf +0 -1
  158. data/test/data/layout_text1.tlf +0 -1
  159. data/test/data/layout_text2.tlf +0 -1
  160. data/test/unit/core/format/test_builder.rb +0 -109
  161. data/test/unit/core/shape/basic/test_basic_format.rb +0 -30
  162. data/test/unit/core/shape/image_block/test_format.rb +0 -58
  163. data/test/unit/core/shape/list/test_configuration.rb +0 -69
  164. data/test/unit/core/shape/list/test_events.rb +0 -36
  165. data/test/unit/core/shape/list/test_store.rb +0 -41
  166. data/test/unit/core/test_events.rb +0 -93
  167. data/test/unit/generator/pdf/document/test_draw_shape.rb +0 -44
  168. data/test/unit/generator/pdf/test_configuration.rb +0 -31
  169. data/test/unit/layout/test_configuration.rb +0 -21
  170. data/test/unit/report/test_events.rb +0 -22
data/lib/thinreports.rb CHANGED
@@ -8,7 +8,6 @@ require 'thinreports/version'
8
8
  require 'thinreports/config'
9
9
  require 'thinreports/core/utils'
10
10
  require 'thinreports/core/errors'
11
- require 'thinreports/core/events'
12
11
  require 'thinreports/core/format/base'
13
12
  require 'thinreports/core/shape'
14
13
  require 'thinreports/core/utils'
@@ -43,7 +43,10 @@ module Thinreports
43
43
  # config.convert_palleted_transparency_png = true
44
44
  # config.convert_palleted_transparency_png = false # default
45
45
  # @see https://github.com/thinreports/thinreports-generator/pull/32
46
+ # @deprecated convert_palleted_transparency_png is deprecated and will be removed in thinreports-generator 1.0 with no replacement
46
47
  def convert_palleted_transparency_png=(enable)
48
+ warn '[DEPRECATION] convert_palleted_transparency_png is deprecated' \
49
+ ' and will be removed in thinreports-generator 1.0 with no replacement.' if enable
47
50
  @convert_palleted_transparency_png = enable
48
51
  end
49
52
 
@@ -52,9 +52,6 @@ module Thinreports
52
52
  end
53
53
  end
54
54
 
55
- class NoConfigurationFound < Basic
56
- end
57
-
58
55
  class UnsupportedColorName < Basic
59
56
  end
60
57
 
@@ -1,13 +1,9 @@
1
1
  # coding: utf-8
2
- require 'thinreports/core/format/builder'
3
-
4
2
  module Thinreports::Core
5
3
  module Format
6
4
 
7
5
  # @abstract
8
6
  class Base
9
- extend Format::Builder
10
-
11
7
  class << self
12
8
  def config_reader(*configs, &block)
13
9
  each_configs(*configs) do |m, location|
@@ -60,6 +56,10 @@ module Thinreports::Core
60
56
  block.call(self) if ::Kernel.block_given?
61
57
  end
62
58
 
59
+ def attributes
60
+ @config
61
+ end
62
+
63
63
  private
64
64
 
65
65
  def find(*keys)
@@ -12,15 +12,7 @@ module Thinreports
12
12
  find_by_type(type)::Format
13
13
  end
14
14
 
15
- def Configuration(type)
16
- klass = find_by_type(type)
17
- unless klass.const_defined?(:Configuration)
18
- raise Thinreports::Errors::NoConfigurationFound, type
19
- end
20
- klass.const_get(:Configuration)
21
- end
22
-
23
- module_function :Interface, :Format, :Configuration
15
+ module_function :Interface, :Format
24
16
 
25
17
  def self.find_by_type(type)
26
18
  case type
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Thinreports
4
4
  module Core::Shape
5
-
5
+
6
6
  module Basic
7
- TYPE_NAMES = %w( s-line s-rect s-ellipse s-image )
7
+ TYPE_NAMES = %w( line rect ellipse image )
8
8
  end
9
-
9
+
10
10
  end
11
11
  end
12
12
 
@@ -4,7 +4,7 @@ module Thinreports
4
4
  module Core::Shape
5
5
 
6
6
  class Basic::BlockFormat < Basic::Format
7
- config_reader :value, :box
7
+ config_reader :value
8
8
  end
9
9
 
10
10
  end
@@ -7,20 +7,8 @@ module Thinreports
7
7
  include Utils
8
8
 
9
9
  config_reader :type, :id
10
- config_reader svg_tag: %w( svg tag ),
11
- svg_attrs: %w( svg attrs )
12
-
13
- config_checker 'true', :display
14
-
15
- class << self
16
- private
17
-
18
- # @param [Hash] raw_format
19
- # @return [Thinreports::Core::Shape::Basic::Format]
20
- def build_internal(raw_format)
21
- new(raw_format)
22
- end
23
- end
10
+ config_reader :style
11
+ config_checker true, :display
24
12
  end
25
13
 
26
14
  end
@@ -5,14 +5,14 @@ module Thinreports
5
5
 
6
6
  class Basic::Internal < Base::Internal
7
7
  # Delegate to Format's methods
8
- format_delegators :id, :svg_tag, :type
8
+ format_delegators :id, :type
9
9
 
10
10
  def style
11
11
  @style ||= Style::Graphic.new(format)
12
12
  end
13
13
 
14
14
  def type_of?(type_name)
15
- ['s-basic', self.type].include?("s-#{type_name}")
15
+ [:basic, self.type].include?(type_name)
16
16
  end
17
17
 
18
18
  def identifier
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Thinreports
4
4
  module Core::Shape
5
-
5
+
6
6
  module ImageBlock
7
- TYPE_NAME = 's-iblock'
7
+ TYPE_NAME = 'image-block'
8
8
  end
9
-
9
+
10
10
  end
11
11
  end
12
12
 
@@ -4,8 +4,6 @@ module Thinreports
4
4
  module Core::Shape
5
5
 
6
6
  class ImageBlock::Format < Basic::BlockFormat
7
- config_reader position_x: %w( position-x ),
8
- position_y: %w( position-y )
9
7
  end
10
8
 
11
9
  end
@@ -7,7 +7,7 @@ module Thinreports
7
7
  alias_method :src, :read_value
8
8
 
9
9
  def type_of?(type_name)
10
- type_name == :iblock || super
10
+ type_name == ImageBlock::TYPE_NAME || super
11
11
  end
12
12
  end
13
13
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Thinreports
4
4
  module Core::Shape
5
-
5
+
6
6
  module List
7
- TYPE_NAME = 's-list'
7
+ TYPE_NAME = 'list'
8
8
  end
9
-
9
+
10
10
  end
11
11
  end
12
12
 
@@ -19,7 +19,3 @@ require 'thinreports/core/shape/list/page_state'
19
19
  require 'thinreports/core/shape/list/section_format'
20
20
  require 'thinreports/core/shape/list/section_interface'
21
21
  require 'thinreports/core/shape/list/section_internal'
22
-
23
- require 'thinreports/core/shape/list/store'
24
- require 'thinreports/core/shape/list/events'
25
- require 'thinreports/core/shape/list/configuration'
@@ -5,26 +5,34 @@ module Thinreports
5
5
 
6
6
  class List::Format < Basic::Format
7
7
  config_reader height: %w( content-height )
8
- config_checker 'true', auto_page_break: %w( page-break )
8
+ config_checker true, auto_page_break: %w( auto-page-break )
9
9
 
10
+ # @deprecated
10
11
  config_reader :header,
11
12
  :detail,
12
13
  :footer
14
+ # @deprecated
13
15
  config_reader page_footer: %w( page-footer )
14
16
 
15
- config_checker 'true', has_header: %w( header-enabled )
16
- config_checker 'true', has_footer: %w( footer-enabled )
17
- config_checker 'true', has_page_footer: %w( page-footer-enabled )
17
+ config_checker true, has_header: %w( header enabled )
18
+ config_checker true, has_footer: %w( footer enabled )
19
+ config_checker true, has_page_footer: %w( page-footer enabled )
18
20
 
19
21
  config_reader page_footer_height: %w( page-footer height )
20
22
  config_reader footer_height: %w( footer height )
21
23
  config_reader header_height: %w( header height )
22
24
  config_reader detail_height: %w( detail height )
23
25
 
24
- config_accessor :sections
26
+ attr_reader :sections
27
+
28
+ def initialize(*)
29
+ super
30
+ initialize_sections
31
+ end
25
32
 
26
33
  # @param [Symbol] section_name
27
34
  # @return [Hash]
35
+ # @deprecated
28
36
  def section(section_name)
29
37
  __send__(section_name)
30
38
  end
@@ -41,29 +49,34 @@ module Thinreports
41
49
  has_section?(section_name) ? __send__(:"#{section_name}_height") : 0
42
50
  end
43
51
 
44
- class << self
52
+ # @param [:detai, :header, :page_footer, :footer] section_name
53
+ # @return [Numeric]
54
+ def section_base_position_top(section_name)
55
+ section = @sections[section_name]
56
+ return 0 unless has_section?(section_name)
45
57
 
46
- private
58
+ top = section.relative_top
47
59
 
48
- # @param [Hash] raw_format
49
- # @return [Thinreports::Core::Shape::List::Format]
50
- def build_internal(raw_format)
51
- new(raw_format) do |f|
52
- f.sections = {}
53
- build_section(:detail, f)
54
- build_section(:header, f) if f.has_header?
55
- build_section(:footer, f) if f.has_footer?
56
- build_section(:page_footer, f) if f.has_page_footer?
57
- end
60
+ case section_name
61
+ when :page_footer
62
+ top - section_height(:detail)
63
+ when :footer
64
+ top - section_height(:detail) - section_height(:page_footer)
65
+ else
66
+ top
58
67
  end
68
+ end
59
69
 
60
- # @param [Symbol] section_name
61
- # @param [Thinreports::Core::Shape::List::Format] list
62
- # @return [Thinreports::Core::Shape::List::SectionFormat]
63
- def build_section(section_name, list)
64
- list.sections[section_name] =
65
- List::SectionFormat.build(list.section(section_name))
66
- end
70
+ private
71
+
72
+ def initialize_sections
73
+ @sections = {
74
+ detail: List::SectionFormat.new(attributes['detail'])
75
+ }
76
+
77
+ @sections[:header] = List::SectionFormat.new(attributes['header']) if has_section?(:header)
78
+ @sections[:page_footer] = List::SectionFormat.new(attributes['page-footer']) if has_section?(:page_footer)
79
+ @sections[:footer] = List::SectionFormat.new(attributes['footer']) if has_section?(:footer)
67
80
  end
68
81
  end
69
82
 
@@ -6,9 +6,6 @@ module Thinreports
6
6
  class List::Manager
7
7
  include Utils
8
8
 
9
- # @return [Thinreports::Core::Shape::List::Configuration]
10
- attr_reader :config
11
-
12
9
  # @return [Thinreports::Core::Shape:::List::Page]
13
10
  attr_reader :current_page
14
11
 
@@ -31,7 +28,6 @@ module Thinreports
31
28
  def initialize(page)
32
29
  switch_current!(page)
33
30
 
34
- @config = init_config
35
31
  @finalized = false
36
32
  @page_count = 0
37
33
 
@@ -159,16 +155,6 @@ module Thinreports
159
155
  end
160
156
  end
161
157
 
162
- # @return [Thinreports::Core::Shape::List::Store]
163
- def store
164
- config.store
165
- end
166
-
167
- # @return [Thinreports::Core::Shape::List::Events]
168
- def events
169
- config.internal_events
170
- end
171
-
172
158
  # @return [Boolean]
173
159
  def auto_page_break?
174
160
  format.auto_page_break?
@@ -184,22 +170,10 @@ module Thinreports
184
170
 
185
171
  if !options[:ignore_page_footer] && format.has_page_footer?
186
172
  page_footer = insert_row(init_section(:page_footer))
187
-
188
- # [DEPRECATION] Use List::Interface#on_page_footer_insert instead.
189
- events.
190
- dispatch(List::Events::SectionEvent.new(:page_footer_insert,
191
- page_footer, store))
192
- # In 0.8 or later
193
173
  @page_footer_handler.call(page_footer) if @page_footer_handler
194
174
  end
195
- current_page_state.finalized!
196
175
 
197
- # [DEPRECATION] Use List::Interface#on_page_finalize instead.
198
- events.
199
- dispatch(List::Events::PageEvent.new(:page_finalize,
200
- current_page,
201
- current_page_state.parent))
202
- # In 0.8 or later
176
+ current_page_state.finalized!
203
177
  @page_finalize_handler.call if @page_finalize_handler
204
178
 
205
179
  @page_count += 1
@@ -213,10 +187,6 @@ module Thinreports
213
187
  if format.has_footer?
214
188
  footer = init_section(:footer)
215
189
 
216
- # [DEPRECATION] Use List::Interface#on_footer_insert instead.
217
- events.dispatch(List::Events::SectionEvent.new(:footer_insert, footer, store))
218
-
219
- # In 0.8 or later
220
190
  @footer_handler.call(footer) if @footer_handler
221
191
 
222
192
  if auto_page_break? && overflow_with?(:footer)
@@ -250,11 +220,6 @@ module Thinreports
250
220
  def format
251
221
  current_page_state.format
252
222
  end
253
-
254
- # @return [Thinreports::Core::Shape::List::Configuration]
255
- def init_config
256
- layout.config.activate(current_page.id) || List::Configuration.new
257
- end
258
223
  end
259
224
 
260
225
  end
@@ -69,21 +69,6 @@ module Thinreports
69
69
  manager.overflow_with?(:detail)
70
70
  end
71
71
 
72
- # @return [Thinreports::Core::Shape::List::Configuration]
73
- def config
74
- manager.config
75
- end
76
-
77
- # @return [Thinreports::Core::Shape::List::Store]
78
- def store
79
- config.store
80
- end
81
-
82
- # @return [Thinreports::Core::Shape::List::Events]
83
- def events
84
- config.events
85
- end
86
-
87
72
  # @param [Thinreports::Report::Page] new_parent
88
73
  # @return [Thinreports::Core::Shape::List::Page]
89
74
  def copy(new_parent)
@@ -34,7 +34,7 @@ module Thinreports
34
34
  end
35
35
 
36
36
  def type_of?(type_name)
37
- type_name == :list
37
+ type_name == List::TYPE_NAME
38
38
  end
39
39
  end
40
40
 
@@ -7,24 +7,26 @@ module Thinreports
7
7
  config_reader :height
8
8
  config_reader relative_left: %w( translate x ),
9
9
  relative_top: %w( translate y )
10
+ config_reader :style
10
11
 
11
- config_reader layout: %w( svg content ),
12
- svg_tag: %w( svg tag ),
13
- svg_attrs: %w( svg attrs )
12
+ # For compatible 0.8.x format API
13
+ config_checker true, display: %w( enabled )
14
+
15
+ def initialize(*)
16
+ super
17
+ initialize_items(attributes['items'])
18
+ end
14
19
 
15
- class << self
16
20
  private
17
21
 
18
- def build_internal(raw_format)
19
- new(raw_format) do |f|
20
- build_layout(f, level: 2) do |type, shape_format|
21
- Core::Shape::Format(type).build(shape_format)
22
- end
23
- clean(f.layout)
24
- end
22
+ def initialize_items(item_schemas)
23
+ item_schemas.each do |item_schema|
24
+ id, type = item_schema.values_at 'id', 'type'
25
+ next if id.empty?
26
+
27
+ self.shapes[id.to_sym] = Core::Shape::Format(type).new(item_schema)
25
28
  end
26
29
  end
27
-
28
30
  end
29
31
 
30
32
  end