thinreports 0.10.2 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CONTRIBUTING.md +2 -2
  3. data/.github/dependabot.yml +11 -0
  4. data/.github/workflows/test.yml +50 -0
  5. data/.gitignore +1 -0
  6. data/CHANGELOG.md +43 -0
  7. data/Gemfile +2 -1
  8. data/{MIT-LICENSE → LICENSE.txt} +2 -0
  9. data/README.md +70 -56
  10. data/Rakefile +12 -25
  11. data/gemfiles/prawn-2.2.gemfile +5 -0
  12. data/gemfiles/prawn-2.3.gemfile +5 -0
  13. data/gemfiles/prawn-2.4.gemfile +5 -0
  14. data/lib/thinreports/core/shape/basic/format.rb +5 -0
  15. data/lib/thinreports/core/shape/image_block.rb +1 -1
  16. data/lib/thinreports/core/shape/list.rb +1 -1
  17. data/lib/thinreports/core/shape/page_number.rb +1 -1
  18. data/lib/thinreports/core/shape/stack_view/format.rb +27 -0
  19. data/lib/thinreports/core/shape/stack_view/interface.rb +17 -0
  20. data/lib/thinreports/core/shape/stack_view/internal.rb +22 -0
  21. data/lib/thinreports/core/shape/stack_view/row_format.rb +39 -0
  22. data/lib/thinreports/core/shape/stack_view.rb +17 -0
  23. data/lib/thinreports/core/shape/style/basic.rb +4 -1
  24. data/lib/thinreports/core/shape/text.rb +1 -1
  25. data/lib/thinreports/core/shape/text_block/formatter/number.rb +6 -1
  26. data/lib/thinreports/core/shape/text_block/internal.rb +0 -2
  27. data/lib/thinreports/core/shape/text_block.rb +1 -1
  28. data/lib/thinreports/core/shape.rb +2 -0
  29. data/lib/thinreports/generate.rb +11 -0
  30. data/lib/thinreports/generator/pdf/document/draw_shape.rb +31 -10
  31. data/lib/thinreports/generator/pdf/document/draw_template_items.rb +1 -1
  32. data/lib/thinreports/generator/pdf/document/graphics/image.rb +19 -1
  33. data/lib/thinreports/generator/pdf/document/graphics/text.rb +10 -5
  34. data/lib/thinreports/generator/pdf/document/page.rb +12 -0
  35. data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +7 -7
  36. data/lib/thinreports/layout/base.rb +1 -1
  37. data/lib/thinreports/layout/legacy_schema.rb +1 -0
  38. data/lib/thinreports/layout/version.rb +1 -1
  39. data/lib/thinreports/report/internal.rb +2 -0
  40. data/lib/thinreports/report.rb +2 -2
  41. data/lib/thinreports/section_report/build.rb +32 -0
  42. data/lib/thinreports/section_report/builder/item_builder.rb +49 -0
  43. data/lib/thinreports/section_report/builder/report_builder.rb +82 -0
  44. data/lib/thinreports/section_report/builder/report_data.rb +13 -0
  45. data/lib/thinreports/section_report/builder/stack_view_builder.rb +53 -0
  46. data/lib/thinreports/section_report/builder/stack_view_data.rb +11 -0
  47. data/lib/thinreports/section_report/generate.rb +26 -0
  48. data/lib/thinreports/section_report/pdf/render.rb +23 -0
  49. data/lib/thinreports/section_report/pdf/renderer/draw_item.rb +68 -0
  50. data/lib/thinreports/section_report/pdf/renderer/group_renderer.rb +57 -0
  51. data/lib/thinreports/section_report/pdf/renderer/section_height.rb +100 -0
  52. data/lib/thinreports/section_report/pdf/renderer/section_renderer.rb +39 -0
  53. data/lib/thinreports/section_report/pdf/renderer/stack_view_renderer.rb +55 -0
  54. data/lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb +38 -0
  55. data/lib/thinreports/section_report/schema/loader.rb +28 -0
  56. data/lib/thinreports/section_report/schema/parser.rb +52 -0
  57. data/lib/thinreports/section_report/schema/report.rb +30 -0
  58. data/lib/thinreports/section_report/schema/section.rb +47 -0
  59. data/lib/thinreports/version.rb +1 -1
  60. data/lib/thinreports.rb +5 -0
  61. data/thinreports.gemspec +11 -10
  62. metadata +48 -150
  63. data/.travis.yml +0 -16
  64. data/examples/character_spacing/character_spacing.rb +0 -8
  65. data/examples/character_spacing/character_spacing.tlf +0 -293
  66. data/examples/dynamic_image/dynamic_image.rb +0 -31
  67. data/examples/dynamic_image/dynamic_image.tlf +0 -661
  68. data/examples/dynamic_image/img200x100.png +0 -0
  69. data/examples/dynamic_image/img50x50.png +0 -0
  70. data/examples/dynamic_style/dynamic_style.rb +0 -150
  71. data/examples/dynamic_style/dynamic_style.tlf +0 -1835
  72. data/examples/dynamic_style/dynamic_style_in_list.tlf +0 -344
  73. data/examples/dynamic_style/image.png +0 -0
  74. data/examples/eudc/eudc.rb +0 -20
  75. data/examples/eudc/eudc.tlf +0 -180
  76. data/examples/eudc/eudc.ttf +0 -0
  77. data/examples/helper.rb +0 -50
  78. data/examples/hidden_shapes/hidden_shapes.rb +0 -9
  79. data/examples/hidden_shapes/hidden_shapes.tlf +0 -449
  80. data/examples/list_events/list_events.rb +0 -32
  81. data/examples/list_events/list_events.tlf +0 -361
  82. data/examples/list_manual_generation/list_manual_generation.rb +0 -22
  83. data/examples/list_manual_generation/list_manual_generation.tlf +0 -132
  84. data/examples/list_page_number/list_page_number.rb +0 -17
  85. data/examples/list_page_number/list_page_number.tlf +0 -254
  86. data/examples/page_number/page_number.rb +0 -33
  87. data/examples/page_number/page_number.tlf +0 -215
  88. data/examples/palleted_png/palleted_png.png +0 -0
  89. data/examples/palleted_png/palleted_png.rb +0 -9
  90. data/examples/palleted_png/palleted_png.tlf +0 -47
  91. data/examples/password_setting/password_setting.rb +0 -10
  92. data/examples/password_setting/password_setting.tlf +0 -45
  93. data/examples/report_callbacks/report_callbacks.rb +0 -14
  94. data/examples/report_callbacks/report_callbacks.tlf +0 -147
  95. data/examples/single_line_tblock/single_line_tblock.rb +0 -13
  96. data/examples/single_line_tblock/single_line_tblock.tlf +0 -170
  97. data/examples/tblock_overflow/tblock_overflow.rb +0 -20
  98. data/examples/tblock_overflow/tblock_overflow.tlf +0 -538
  99. data/examples/tblock_styles/font_size.tlf +0 -383
  100. data/examples/tblock_styles/tblock_styles.rb +0 -43
  101. data/examples/tblock_styles/tblock_styles.tlf +0 -889
  102. data/examples/text_align/text_align.rb +0 -8
  103. data/examples/text_align/text_align.tlf +0 -241
  104. data/examples/typeB_page_size/B4_ISO.tlf +0 -45
  105. data/examples/typeB_page_size/B4_JIS.tlf +0 -45
  106. data/examples/typeB_page_size/typeB_page_size.rb +0 -17
  107. data/examples/word_wrap/word_wrap.rb +0 -26
  108. data/examples/word_wrap/word_wrap.tlf +0 -297
  109. data/test/data/font.ttf +0 -0
  110. data/test/data/image_normal.jpg +0 -0
  111. data/test/data/image_normal.png +0 -0
  112. data/test/data/image_normal_jpg_noext +0 -0
  113. data/test/data/image_normal_png_noext +0 -0
  114. data/test/data/image_pallete_based.png +0 -0
  115. data/test/data/legacy_layout/all-items.tlf +0 -1
  116. data/test/schema_helper.rb +0 -122
  117. data/test/test_helper.rb +0 -48
  118. data/test/tmp/.gitkeep +0 -0
  119. data/test/unit/core/format/test_base.rb +0 -152
  120. data/test/unit/core/shape/base/test_internal.rb +0 -87
  121. data/test/unit/core/shape/basic/test_block_format.rb +0 -23
  122. data/test/unit/core/shape/basic/test_block_interface.rb +0 -29
  123. data/test/unit/core/shape/basic/test_block_internal.rb +0 -55
  124. data/test/unit/core/shape/basic/test_format.rb +0 -37
  125. data/test/unit/core/shape/basic/test_interface.rb +0 -108
  126. data/test/unit/core/shape/basic/test_internal.rb +0 -55
  127. data/test/unit/core/shape/image_block/test_interface.rb +0 -24
  128. data/test/unit/core/shape/image_block/test_internal.rb +0 -31
  129. data/test/unit/core/shape/list/test_format.rb +0 -111
  130. data/test/unit/core/shape/list/test_manager.rb +0 -67
  131. data/test/unit/core/shape/list/test_page.rb +0 -156
  132. data/test/unit/core/shape/list/test_page_state.rb +0 -31
  133. data/test/unit/core/shape/list/test_section_format.rb +0 -36
  134. data/test/unit/core/shape/list/test_section_interface.rb +0 -75
  135. data/test/unit/core/shape/list/test_section_internal.rb +0 -50
  136. data/test/unit/core/shape/manager/test_format.rb +0 -38
  137. data/test/unit/core/shape/manager/test_internal.rb +0 -132
  138. data/test/unit/core/shape/manager/test_target.rb +0 -140
  139. data/test/unit/core/shape/page_number/test_format.rb +0 -55
  140. data/test/unit/core/shape/page_number/test_interface.rb +0 -33
  141. data/test/unit/core/shape/page_number/test_internal.rb +0 -81
  142. data/test/unit/core/shape/styles/test_base.rb +0 -191
  143. data/test/unit/core/shape/styles/test_basic.rb +0 -24
  144. data/test/unit/core/shape/styles/test_graphic.rb +0 -50
  145. data/test/unit/core/shape/styles/test_text.rb +0 -97
  146. data/test/unit/core/shape/text/test_format.rb +0 -44
  147. data/test/unit/core/shape/text/test_internal.rb +0 -20
  148. data/test/unit/core/shape/text_block/formatter/test_basic.rb +0 -24
  149. data/test/unit/core/shape/text_block/formatter/test_datetime.rb +0 -49
  150. data/test/unit/core/shape/text_block/formatter/test_number.rb +0 -76
  151. data/test/unit/core/shape/text_block/formatter/test_padding.rb +0 -77
  152. data/test/unit/core/shape/text_block/test_format.rb +0 -169
  153. data/test/unit/core/shape/text_block/test_formatter.rb +0 -28
  154. data/test/unit/core/shape/text_block/test_interface.rb +0 -63
  155. data/test/unit/core/shape/text_block/test_internal.rb +0 -128
  156. data/test/unit/core/test_shape.rb +0 -52
  157. data/test/unit/core/test_utils.rb +0 -68
  158. data/test/unit/generator/pdf/document/graphics/test_attributes.rb +0 -135
  159. data/test/unit/generator/pdf/document/graphics/test_basic.rb +0 -46
  160. data/test/unit/generator/pdf/document/graphics/test_image.rb +0 -46
  161. data/test/unit/generator/pdf/document/graphics/test_text.rb +0 -171
  162. data/test/unit/generator/pdf/document/test_font.rb +0 -110
  163. data/test/unit/generator/pdf/document/test_graphics.rb +0 -42
  164. data/test/unit/generator/pdf/document/test_page.rb +0 -122
  165. data/test/unit/generator/pdf/document/test_parse_color.rb +0 -30
  166. data/test/unit/generator/pdf/prawn_ext/test_calc_image_dimensions.rb +0 -41
  167. data/test/unit/generator/pdf/prawn_ext/test_width_of.rb +0 -22
  168. data/test/unit/generator/pdf/test_document.rb +0 -22
  169. data/test/unit/generator/test_pdf.rb +0 -26
  170. data/test/unit/layout/test_base.rb +0 -41
  171. data/test/unit/layout/test_format.rb +0 -100
  172. data/test/unit/layout/test_legacy_schema.rb +0 -574
  173. data/test/unit/layout/test_version.rb +0 -26
  174. data/test/unit/report/test_base.rb +0 -248
  175. data/test/unit/report/test_internal.rb +0 -206
  176. data/test/unit/test_config.rb +0 -36
  177. data/test/unit/test_layout.rb +0 -12
  178. data/test/unit/test_report.rb +0 -18
@@ -1,383 +0,0 @@
1
- {
2
- "version": "0.9.0",
3
- "items": [
4
- {
5
- "id": "",
6
- "type": "text",
7
- "display": true,
8
- "description": "",
9
- "x": 40,
10
- "y": 60,
11
- "width": 151.8,
12
- "height": 46,
13
- "style": {
14
- "font-family": [
15
- "Helvetica"
16
- ],
17
- "font-size": 18,
18
- "color": "#000000",
19
- "text-align": "left",
20
- "vertical-align": "top",
21
- "line-height": "",
22
- "line-height-ratio": "",
23
- "letter-spacing": "",
24
- "font-style": []
25
- },
26
- "texts": [
27
- "サイズ18"
28
- ]
29
- },
30
- {
31
- "id": "text_single24",
32
- "type": "text",
33
- "display": true,
34
- "description": "",
35
- "x": 165,
36
- "y": 60,
37
- "width": 151.8,
38
- "height": 46,
39
- "style": {
40
- "font-family": [
41
- "Helvetica"
42
- ],
43
- "font-size": 18,
44
- "color": "#000000",
45
- "text-align": "left",
46
- "vertical-align": "top",
47
- "line-height": "",
48
- "line-height-ratio": "",
49
- "letter-spacing": "",
50
- "font-style": []
51
- },
52
- "texts": [
53
- "サイズ24"
54
- ]
55
- },
56
- {
57
- "id": "text_single32",
58
- "type": "text",
59
- "display": true,
60
- "description": "",
61
- "x": 345,
62
- "y": 60,
63
- "width": 151.8,
64
- "height": 46,
65
- "style": {
66
- "font-family": [
67
- "Helvetica"
68
- ],
69
- "font-size": 18,
70
- "color": "#000000",
71
- "text-align": "left",
72
- "vertical-align": "top",
73
- "line-height": "",
74
- "line-height-ratio": "",
75
- "letter-spacing": "",
76
- "font-style": []
77
- },
78
- "texts": [
79
- "サイズ32"
80
- ]
81
- },
82
- {
83
- "id": "",
84
- "type": "text",
85
- "display": true,
86
- "description": "",
87
- "x": 35,
88
- "y": 179.8,
89
- "width": 200,
90
- "height": 100,
91
- "style": {
92
- "font-family": [
93
- "Helvetica"
94
- ],
95
- "font-size": 18,
96
- "color": "#000000",
97
- "text-align": "left",
98
- "vertical-align": "top",
99
- "line-height": "",
100
- "line-height-ratio": "",
101
- "letter-spacing": "",
102
- "font-style": []
103
- },
104
- "texts": [
105
- "サイズ18",
106
- "サイズ18"
107
- ]
108
- },
109
- {
110
- "id": "text_multiple24",
111
- "type": "text",
112
- "display": true,
113
- "description": "",
114
- "x": 165,
115
- "y": 179.8,
116
- "width": 200,
117
- "height": 100,
118
- "style": {
119
- "font-family": [
120
- "Helvetica"
121
- ],
122
- "font-size": 18,
123
- "color": "#000000",
124
- "text-align": "left",
125
- "vertical-align": "top",
126
- "line-height": "",
127
- "line-height-ratio": "",
128
- "letter-spacing": "",
129
- "font-style": []
130
- },
131
- "texts": [
132
- "サイズ24",
133
- "サイズ24"
134
- ]
135
- },
136
- {
137
- "id": "text_multiple32",
138
- "type": "text",
139
- "display": true,
140
- "description": "",
141
- "x": 345,
142
- "y": 179.8,
143
- "width": 200,
144
- "height": 100,
145
- "style": {
146
- "font-family": [
147
- "Helvetica"
148
- ],
149
- "font-size": 18,
150
- "color": "#000000",
151
- "text-align": "left",
152
- "vertical-align": "top",
153
- "line-height": "",
154
- "line-height-ratio": "",
155
- "letter-spacing": "",
156
- "font-style": []
157
- },
158
- "texts": [
159
- "サイズ32",
160
- "サイズ32"
161
- ]
162
- },
163
- {
164
- "id": "block_single18",
165
- "type": "text-block",
166
- "display": true,
167
- "description": "",
168
- "x": 40,
169
- "y": 320.6,
170
- "width": 103.4,
171
- "height": 17,
172
- "style": {
173
- "font-family": [
174
- "Helvetica"
175
- ],
176
- "font-size": 18,
177
- "color": "#000000",
178
- "text-align": "left",
179
- "vertical-align": "top",
180
- "line-height": "",
181
- "line-height-ratio": "",
182
- "letter-spacing": "",
183
- "font-style": [],
184
- "overflow": "truncate",
185
- "word-wrap": "break-word"
186
- },
187
- "reference-id": "",
188
- "value": "",
189
- "multiple-line": false,
190
- "format": {
191
- "base": "",
192
- "type": ""
193
- }
194
- },
195
- {
196
- "id": "block_single24",
197
- "type": "text-block",
198
- "display": true,
199
- "description": "",
200
- "x": 165,
201
- "y": 320.6,
202
- "width": 157.2,
203
- "height": 17,
204
- "style": {
205
- "font-family": [
206
- "Helvetica"
207
- ],
208
- "font-size": 18,
209
- "color": "#000000",
210
- "text-align": "left",
211
- "vertical-align": "top",
212
- "line-height": "",
213
- "line-height-ratio": "",
214
- "letter-spacing": "",
215
- "font-style": [],
216
- "overflow": "truncate",
217
- "word-wrap": "none"
218
- },
219
- "reference-id": "",
220
- "value": "",
221
- "multiple-line": false,
222
- "format": {
223
- "base": "",
224
- "type": ""
225
- }
226
- },
227
- {
228
- "id": "block_single32",
229
- "type": "text-block",
230
- "display": true,
231
- "description": "",
232
- "x": 345,
233
- "y": 320.6,
234
- "width": 230.2,
235
- "height": 17,
236
- "style": {
237
- "font-family": [
238
- "Helvetica"
239
- ],
240
- "font-size": 18,
241
- "color": "#000000",
242
- "text-align": "left",
243
- "vertical-align": "top",
244
- "line-height": "",
245
- "line-height-ratio": "",
246
- "letter-spacing": "",
247
- "font-style": [],
248
- "overflow": "truncate",
249
- "word-wrap": "none"
250
- },
251
- "reference-id": "",
252
- "value": "",
253
- "multiple-line": false,
254
- "format": {
255
- "base": "",
256
- "type": ""
257
- }
258
- },
259
- {
260
- "id": "block_multiple18",
261
- "type": "text-block",
262
- "display": true,
263
- "description": "",
264
- "x": 40,
265
- "y": 390,
266
- "width": 103.4,
267
- "height": 113.3,
268
- "style": {
269
- "font-family": [
270
- "Helvetica"
271
- ],
272
- "font-size": 18,
273
- "color": "#000000",
274
- "text-align": "left",
275
- "vertical-align": "top",
276
- "line-height": "",
277
- "line-height-ratio": "",
278
- "letter-spacing": "",
279
- "font-style": [],
280
- "overflow": "truncate",
281
- "word-wrap": "none"
282
- },
283
- "reference-id": "",
284
- "value": "",
285
- "multiple-line": true,
286
- "format": {
287
- "base": "",
288
- "type": ""
289
- }
290
- },
291
- {
292
- "id": "block_multiple24",
293
- "type": "text-block",
294
- "display": true,
295
- "description": "",
296
- "x": 165,
297
- "y": 390,
298
- "width": 157.2,
299
- "height": 113.3,
300
- "style": {
301
- "font-family": [
302
- "Helvetica"
303
- ],
304
- "font-size": 18,
305
- "color": "#000000",
306
- "text-align": "left",
307
- "vertical-align": "top",
308
- "line-height": "",
309
- "line-height-ratio": "",
310
- "letter-spacing": "",
311
- "font-style": [],
312
- "overflow": "truncate",
313
- "word-wrap": "none"
314
- },
315
- "reference-id": "",
316
- "value": "",
317
- "multiple-line": true,
318
- "format": {
319
- "base": "",
320
- "type": ""
321
- }
322
- },
323
- {
324
- "id": "block_multiple32",
325
- "type": "text-block",
326
- "display": true,
327
- "description": "",
328
- "x": 345,
329
- "y": 390,
330
- "width": 230.2,
331
- "height": 113.3,
332
- "style": {
333
- "font-family": [
334
- "Helvetica"
335
- ],
336
- "font-size": 18,
337
- "color": "#000000",
338
- "text-align": "left",
339
- "vertical-align": "top",
340
- "line-height": "",
341
- "line-height-ratio": "",
342
- "letter-spacing": "",
343
- "font-style": [],
344
- "overflow": "truncate",
345
- "word-wrap": "none"
346
- },
347
- "reference-id": "",
348
- "value": "",
349
- "multiple-line": true,
350
- "format": {
351
- "base": "",
352
- "type": ""
353
- }
354
- }
355
- ],
356
- "state": {
357
- "layout-guides": [
358
- {
359
- "type": "x",
360
- "position": 164.4
361
- },
362
- {
363
- "type": "x",
364
- "position": 344.1
365
- },
366
- {
367
- "type": "y",
368
- "position": 503.3
369
- }
370
- ]
371
- },
372
- "title": "FontSize",
373
- "report": {
374
- "paper-type": "A4",
375
- "orientation": "portrait",
376
- "margin": [
377
- 20,
378
- 20,
379
- 20,
380
- 20
381
- ]
382
- }
383
- }
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- example :tblock_styles, 'Set the styles of Tblock in the Editor' do |t|
4
- Thinreports::Report.generate filename: t.output_filename do |report|
5
- report.use_layout t.layout_filename
6
-
7
- report.start_new_page do |page|
8
- page.item(:space_single_helvetica).value('Char Space in Single(Helvetica)')
9
- page.item(:space_single_ipamincho).value = '文字間隔 in 単行(IPA明朝)'
10
-
11
- page[:space_multi_times] = "Char Space\nin Multiple(Times New Roman)"
12
- page.item(:space_multi_ipamincho).value("文字間隔\nin 複数行(IPA明朝)")
13
-
14
- page.values(left_top: '左上揃え',
15
- left_center: '左中央揃え',
16
- left_bottom: '左下揃え',
17
- center_top: '中央上揃え',
18
- center_center: '中央揃え',
19
- center_bottom: '中央下揃え',
20
- right_top: '右上揃え',
21
- right_center: '右中央揃え',
22
- right_bottom: '右下揃え')
23
-
24
- page.item(:line_height).value("行間隔2.0\n日本語\nThinreports")
25
- end
26
-
27
- report.start_new_page layout: t.resource('font_size.tlf') do |page|
28
- page[:text_single24].style(:font_size, 24)
29
- page[:text_single32].style(:font_size, 32)
30
-
31
- page.item(:text_multiple24).style(:font_size, 24)
32
- page.item(:text_multiple32).style(:font_size, 32)
33
-
34
- page.item(:block_single18).value('サイズ18')
35
- page.item(:block_single24).style(:font_size, 24).value('サイズ24')
36
- page.item(:block_single32).style(:font_size, 32).value('サイズ32')
37
-
38
- page.item(:block_multiple18).value("サイズ18\nサイズ18")
39
- page.item(:block_multiple24).style(:font_size, 24).value("サイズ24\nサイズ24")
40
- page.item(:block_multiple32).style(:font_size, 32).value("サイズ32\nサイズ32")
41
- end
42
- end
43
- end