thinreports 0.12.1 → 0.13.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 +4 -4
- data/.github/dependabot.yml +3 -3
- data/.github/workflows/test.yml +28 -36
- data/.gitignore +1 -1
- data/CHANGELOG.md +19 -1
- data/Gemfile +11 -0
- data/README.md +12 -17
- data/Rakefile +17 -11
- data/lib/thinreports/basic_report/core/errors.rb +62 -0
- data/lib/thinreports/basic_report/core/format/base.rb +91 -0
- data/lib/thinreports/basic_report/core/shape/base/interface.rb +42 -0
- data/lib/thinreports/basic_report/core/shape/base/internal.rb +53 -0
- data/lib/thinreports/basic_report/core/shape/basic/block_format.rb +15 -0
- data/lib/thinreports/basic_report/core/shape/basic/block_interface.rb +34 -0
- data/lib/thinreports/basic_report/core/shape/basic/block_internal.rb +36 -0
- data/lib/thinreports/basic_report/core/shape/basic/format.rb +24 -0
- data/lib/thinreports/basic_report/core/shape/basic/interface.rb +87 -0
- data/lib/thinreports/basic_report/core/shape/basic/internal.rb +28 -0
- data/lib/thinreports/{core → basic_report/core}/shape/basic.rb +6 -4
- data/lib/thinreports/basic_report/core/shape/image_block/format.rb +14 -0
- data/lib/thinreports/basic_report/core/shape/image_block/interface.rb +25 -0
- data/lib/thinreports/basic_report/core/shape/image_block/internal.rb +19 -0
- data/lib/thinreports/{core → basic_report/core}/shape/image_block.rb +6 -4
- data/lib/thinreports/basic_report/core/shape/list/format.rb +92 -0
- data/lib/thinreports/basic_report/core/shape/list/manager.rb +231 -0
- data/lib/thinreports/basic_report/core/shape/list/page.rb +112 -0
- data/lib/thinreports/basic_report/core/shape/list/page_state.rb +50 -0
- data/lib/thinreports/basic_report/core/shape/list/section_format.rb +37 -0
- data/lib/thinreports/basic_report/core/shape/list/section_interface.rb +51 -0
- data/lib/thinreports/basic_report/core/shape/list/section_internal.rb +33 -0
- data/lib/thinreports/{core → basic_report/core}/shape/list.rb +6 -4
- data/lib/thinreports/basic_report/core/shape/manager/format.rb +33 -0
- data/lib/thinreports/basic_report/core/shape/manager/internal.rb +109 -0
- data/lib/thinreports/basic_report/core/shape/manager/target.rb +114 -0
- data/lib/thinreports/basic_report/core/shape/page_number/format.rb +32 -0
- data/lib/thinreports/basic_report/core/shape/page_number/interface.rb +31 -0
- data/lib/thinreports/basic_report/core/shape/page_number/internal.rb +57 -0
- data/lib/thinreports/{core → basic_report/core}/shape/page_number.rb +6 -4
- data/lib/thinreports/basic_report/core/shape/stack_view/format.rb +29 -0
- data/lib/thinreports/basic_report/core/shape/stack_view/interface.rb +19 -0
- data/lib/thinreports/basic_report/core/shape/stack_view/internal.rb +24 -0
- data/lib/thinreports/basic_report/core/shape/stack_view/row_format.rb +41 -0
- data/lib/thinreports/{core → basic_report/core}/shape/stack_view.rb +6 -4
- data/lib/thinreports/basic_report/core/shape/style/base.rb +149 -0
- data/lib/thinreports/basic_report/core/shape/style/basic.rb +24 -0
- data/lib/thinreports/basic_report/core/shape/style/graphic.rb +43 -0
- data/lib/thinreports/basic_report/core/shape/style/text.rb +122 -0
- data/lib/thinreports/basic_report/core/shape/text/format.rb +17 -0
- data/lib/thinreports/basic_report/core/shape/text/interface.rb +20 -0
- data/lib/thinreports/basic_report/core/shape/text/internal.rb +24 -0
- data/lib/thinreports/{core → basic_report/core}/shape/text.rb +6 -4
- data/lib/thinreports/basic_report/core/shape/text_block/format.rb +43 -0
- data/lib/thinreports/basic_report/core/shape/text_block/formatter/basic.rb +41 -0
- data/lib/thinreports/basic_report/core/shape/text_block/formatter/datetime.rb +25 -0
- data/lib/thinreports/basic_report/core/shape/text_block/formatter/number.rb +69 -0
- data/lib/thinreports/basic_report/core/shape/text_block/formatter/padding.rb +27 -0
- data/lib/thinreports/basic_report/core/shape/text_block/formatter.rb +38 -0
- data/lib/thinreports/basic_report/core/shape/text_block/interface.rb +37 -0
- data/lib/thinreports/basic_report/core/shape/text_block/internal.rb +75 -0
- data/lib/thinreports/{core → basic_report/core}/shape/text_block.rb +6 -4
- data/lib/thinreports/basic_report/core/shape.rb +44 -0
- data/lib/thinreports/basic_report/core/utils.rb +47 -0
- data/lib/thinreports/basic_report/generator/pdf/document/draw_shape.rb +108 -0
- data/lib/thinreports/basic_report/generator/pdf/document/draw_template_items.rb +71 -0
- data/lib/thinreports/basic_report/generator/pdf/document/font.rb +90 -0
- data/lib/thinreports/basic_report/generator/pdf/document/graphics/attributes.rb +149 -0
- data/lib/thinreports/basic_report/generator/pdf/document/graphics/basic.rb +137 -0
- data/lib/thinreports/basic_report/generator/pdf/document/graphics/image.rb +99 -0
- data/lib/thinreports/basic_report/generator/pdf/document/graphics/text.rb +180 -0
- data/lib/thinreports/basic_report/generator/pdf/document/graphics.rb +42 -0
- data/lib/thinreports/basic_report/generator/pdf/document/page.rb +96 -0
- data/lib/thinreports/basic_report/generator/pdf/document/parse_color.rb +51 -0
- data/lib/thinreports/basic_report/generator/pdf/document.rb +132 -0
- data/lib/thinreports/basic_report/generator/pdf/drawer/base.rb +50 -0
- data/lib/thinreports/basic_report/generator/pdf/drawer/list.rb +65 -0
- data/lib/thinreports/basic_report/generator/pdf/drawer/list_section.rb +51 -0
- data/lib/thinreports/basic_report/generator/pdf/drawer/page.rb +127 -0
- data/lib/thinreports/basic_report/generator/pdf/prawn_ext/calc_image_dimensions.rb +34 -0
- data/lib/thinreports/basic_report/generator/pdf/prawn_ext/width_of.rb +31 -0
- data/lib/thinreports/basic_report/generator/pdf.rb +66 -0
- data/lib/thinreports/basic_report/layout/base.rb +48 -0
- data/lib/thinreports/basic_report/layout/format.rb +67 -0
- data/lib/thinreports/basic_report/layout/legacy_schema.rb +383 -0
- data/lib/thinreports/basic_report/layout/version.rb +41 -0
- data/lib/thinreports/{layout.rb → basic_report/layout.rb} +6 -4
- data/lib/thinreports/basic_report/report/base.rb +173 -0
- data/lib/thinreports/basic_report/report/internal.rb +107 -0
- data/lib/thinreports/basic_report/report/page.rb +97 -0
- data/lib/thinreports/basic_report/report.rb +26 -0
- data/lib/thinreports/basic_report.rb +15 -0
- data/lib/thinreports/config.rb +1 -1
- data/lib/thinreports/section_report.rb +12 -0
- data/lib/thinreports/version.rb +1 -1
- data/lib/thinreports.rb +2 -13
- data/thinreports.gemspec +3 -7
- metadata +97 -154
- data/gemfiles/prawn-2.2.gemfile +0 -5
- data/gemfiles/prawn-2.3.gemfile +0 -5
- data/gemfiles/prawn-2.4.gemfile +0 -5
- data/lib/thinreports/core/errors.rb +0 -60
- data/lib/thinreports/core/format/base.rb +0 -89
- data/lib/thinreports/core/shape/base/interface.rb +0 -40
- data/lib/thinreports/core/shape/base/internal.rb +0 -51
- data/lib/thinreports/core/shape/basic/block_format.rb +0 -13
- data/lib/thinreports/core/shape/basic/block_interface.rb +0 -32
- data/lib/thinreports/core/shape/basic/block_internal.rb +0 -34
- data/lib/thinreports/core/shape/basic/format.rb +0 -22
- data/lib/thinreports/core/shape/basic/interface.rb +0 -85
- data/lib/thinreports/core/shape/basic/internal.rb +0 -26
- data/lib/thinreports/core/shape/image_block/format.rb +0 -12
- data/lib/thinreports/core/shape/image_block/interface.rb +0 -23
- data/lib/thinreports/core/shape/image_block/internal.rb +0 -17
- data/lib/thinreports/core/shape/list/format.rb +0 -90
- data/lib/thinreports/core/shape/list/manager.rb +0 -229
- data/lib/thinreports/core/shape/list/page.rb +0 -110
- data/lib/thinreports/core/shape/list/page_state.rb +0 -48
- data/lib/thinreports/core/shape/list/section_format.rb +0 -35
- data/lib/thinreports/core/shape/list/section_interface.rb +0 -49
- data/lib/thinreports/core/shape/list/section_internal.rb +0 -31
- data/lib/thinreports/core/shape/manager/format.rb +0 -31
- data/lib/thinreports/core/shape/manager/internal.rb +0 -107
- data/lib/thinreports/core/shape/manager/target.rb +0 -112
- data/lib/thinreports/core/shape/page_number/format.rb +0 -30
- data/lib/thinreports/core/shape/page_number/interface.rb +0 -29
- data/lib/thinreports/core/shape/page_number/internal.rb +0 -55
- data/lib/thinreports/core/shape/stack_view/format.rb +0 -27
- data/lib/thinreports/core/shape/stack_view/interface.rb +0 -17
- data/lib/thinreports/core/shape/stack_view/internal.rb +0 -22
- data/lib/thinreports/core/shape/stack_view/row_format.rb +0 -39
- data/lib/thinreports/core/shape/style/base.rb +0 -146
- data/lib/thinreports/core/shape/style/basic.rb +0 -22
- data/lib/thinreports/core/shape/style/graphic.rb +0 -41
- data/lib/thinreports/core/shape/style/text.rb +0 -120
- data/lib/thinreports/core/shape/text/format.rb +0 -15
- data/lib/thinreports/core/shape/text/interface.rb +0 -18
- data/lib/thinreports/core/shape/text/internal.rb +0 -22
- data/lib/thinreports/core/shape/text_block/format.rb +0 -41
- data/lib/thinreports/core/shape/text_block/formatter/basic.rb +0 -39
- data/lib/thinreports/core/shape/text_block/formatter/datetime.rb +0 -23
- data/lib/thinreports/core/shape/text_block/formatter/number.rb +0 -67
- data/lib/thinreports/core/shape/text_block/formatter/padding.rb +0 -25
- data/lib/thinreports/core/shape/text_block/formatter.rb +0 -34
- data/lib/thinreports/core/shape/text_block/interface.rb +0 -35
- data/lib/thinreports/core/shape/text_block/internal.rb +0 -73
- data/lib/thinreports/core/shape.rb +0 -42
- data/lib/thinreports/core/utils.rb +0 -45
- data/lib/thinreports/generate.rb +0 -11
- data/lib/thinreports/generator/pdf/document/draw_shape.rb +0 -106
- data/lib/thinreports/generator/pdf/document/draw_template_items.rb +0 -69
- data/lib/thinreports/generator/pdf/document/font.rb +0 -88
- data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +0 -147
- data/lib/thinreports/generator/pdf/document/graphics/basic.rb +0 -135
- data/lib/thinreports/generator/pdf/document/graphics/image.rb +0 -98
- data/lib/thinreports/generator/pdf/document/graphics/text.rb +0 -178
- data/lib/thinreports/generator/pdf/document/graphics.rb +0 -40
- data/lib/thinreports/generator/pdf/document/page.rb +0 -94
- data/lib/thinreports/generator/pdf/document/parse_color.rb +0 -49
- data/lib/thinreports/generator/pdf/document.rb +0 -130
- data/lib/thinreports/generator/pdf/drawer/base.rb +0 -48
- data/lib/thinreports/generator/pdf/drawer/list.rb +0 -63
- data/lib/thinreports/generator/pdf/drawer/list_section.rb +0 -49
- data/lib/thinreports/generator/pdf/drawer/page.rb +0 -125
- data/lib/thinreports/generator/pdf/prawn_ext/calc_image_dimensions.rb +0 -32
- data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +0 -29
- data/lib/thinreports/generator/pdf.rb +0 -63
- data/lib/thinreports/layout/base.rb +0 -46
- data/lib/thinreports/layout/format.rb +0 -65
- data/lib/thinreports/layout/legacy_schema.rb +0 -381
- data/lib/thinreports/layout/version.rb +0 -39
- data/lib/thinreports/report/base.rb +0 -169
- data/lib/thinreports/report/internal.rb +0 -105
- data/lib/thinreports/report/page.rb +0 -95
- data/lib/thinreports/report.rb +0 -24
- /data/lib/thinreports/{core → basic_report/core}/shape/base.rb +0 -0
- /data/lib/thinreports/{core → basic_report/core}/shape/manager.rb +0 -0
- /data/lib/thinreports/{core → basic_report/core}/shape/style.rb +0 -0
- /data/lib/thinreports/{generator → basic_report/generator}/pdf/prawn_ext.rb +0 -0
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Errors
|
|
5
|
-
class Basic < ::StandardError
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
class UnknownShapeStyleName < Basic
|
|
9
|
-
def initialize(style, availables)
|
|
10
|
-
super("The specified style name, '#{style}', cannot be used. " \
|
|
11
|
-
"The available styles are #{availables.map { |s| ":#{s}" }.join(', ')}.")
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
class UnknownShapeType < Basic
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
class UnknownFormatterType < Basic
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
class LayoutFileNotFound < Basic
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
class FontFileNotFound < Basic
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
class NoRegisteredLayoutFound < Basic
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
class UnknownItemId < Basic
|
|
31
|
-
def initialize(id, item_type = 'Basic')
|
|
32
|
-
super("The layout does not have a #{item_type} Item with id '#{id}'.")
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
class DisabledListSection < Basic
|
|
37
|
-
def initialize(section)
|
|
38
|
-
super("The #{section} section is disabled.")
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
class UnknownLayoutId < Basic
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
class UnsupportedColorName < Basic
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
class InvalidLayoutFormat < Basic
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
class IncompatibleLayoutFormat < Basic
|
|
52
|
-
def initialize(filename, fileversion, required_rules)
|
|
53
|
-
super("Generator #{Thinreports::VERSION} can not be built this file, " \
|
|
54
|
-
"'#{File.basename(filename)}'. " \
|
|
55
|
-
"This file is updated in the Editor of version '#{fileversion}', " \
|
|
56
|
-
"but Generator requires version #{required_rules}.")
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Format
|
|
6
|
-
# @abstract
|
|
7
|
-
class Base
|
|
8
|
-
class << self
|
|
9
|
-
def config_reader(*configs, &block)
|
|
10
|
-
each_configs(*configs) do |m, location|
|
|
11
|
-
define_read_method(m, location, &block)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def config_checker(check, *configs)
|
|
16
|
-
checker = ->(val) { val == check }
|
|
17
|
-
each_configs(*configs) do |m, location|
|
|
18
|
-
define_read_method(:"#{m}?", location, &checker)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def config_writer(*configs)
|
|
23
|
-
each_configs(*configs) do |m, location|
|
|
24
|
-
define_write_method(m, location)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def config_accessor(*configs, &block)
|
|
29
|
-
config_reader(*configs, &block)
|
|
30
|
-
config_writer(*configs)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
|
|
35
|
-
def define_read_method(m, location = nil, &block)
|
|
36
|
-
define_method(m) do
|
|
37
|
-
read(*location, &block)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def define_write_method(m, location = nil)
|
|
42
|
-
define_method(:"#{m}=") do |value|
|
|
43
|
-
write(value, *location)
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def each_configs(*configs, &block)
|
|
48
|
-
c = configs.first.is_a?(::Hash) ? configs.first : (configs || [])
|
|
49
|
-
c.each do |m, location|
|
|
50
|
-
block.call(m, location || [m.to_s])
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def initialize(config, &block)
|
|
56
|
-
@config = config
|
|
57
|
-
block.call(self) if ::Kernel.block_given?
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def attributes
|
|
61
|
-
@config
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
private
|
|
65
|
-
|
|
66
|
-
def find(*keys)
|
|
67
|
-
if keys.empty?
|
|
68
|
-
@config
|
|
69
|
-
else
|
|
70
|
-
keys.inject(@config) do |c, k|
|
|
71
|
-
c.is_a?(::Hash) ? c[k] : (break c)
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def write(value, *keys)
|
|
77
|
-
key = keys.pop
|
|
78
|
-
owner = find(*keys)
|
|
79
|
-
owner[key] = value
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def read(*keys, &block)
|
|
83
|
-
value = find(*keys)
|
|
84
|
-
::Kernel.block_given? ? block.call(value) : value
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module Base
|
|
7
|
-
# @abstract
|
|
8
|
-
class Interface
|
|
9
|
-
include Utils
|
|
10
|
-
extend Forwardable
|
|
11
|
-
|
|
12
|
-
def self.internal_delegators(*args)
|
|
13
|
-
def_delegators :internal, *args
|
|
14
|
-
end
|
|
15
|
-
private_class_method :internal_delegators
|
|
16
|
-
|
|
17
|
-
attr_reader :internal
|
|
18
|
-
|
|
19
|
-
def initialize(parent, format, internal = nil)
|
|
20
|
-
@internal = internal || init_internal(parent, format)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def copy(parent)
|
|
24
|
-
self.class.new(parent, internal.format, internal.copy(parent))
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
# @param [Thinreports::Report::Page, Thinreports::Core::Shape::List::SectionInterface] parent
|
|
30
|
-
# @param [Thinreports::Core::Shape::Basic::Format] format
|
|
31
|
-
# @return [Thinreports::Core::Shape::Basic::Internal]
|
|
32
|
-
# @abstract
|
|
33
|
-
def init_internal(parent, format)
|
|
34
|
-
raise NotImplementedError
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module Base
|
|
7
|
-
# @abstract
|
|
8
|
-
class Internal
|
|
9
|
-
include Utils
|
|
10
|
-
extend Forwardable
|
|
11
|
-
|
|
12
|
-
def self.format_delegators(*args)
|
|
13
|
-
def_delegators :format, *args
|
|
14
|
-
end
|
|
15
|
-
private_class_method :format_delegators
|
|
16
|
-
|
|
17
|
-
attr_reader :parent
|
|
18
|
-
attr_reader :format
|
|
19
|
-
attr_writer :style
|
|
20
|
-
attr_accessor :states
|
|
21
|
-
|
|
22
|
-
def initialize(parent, format)
|
|
23
|
-
@parent = parent
|
|
24
|
-
@format = format
|
|
25
|
-
@states = {}
|
|
26
|
-
@style = nil
|
|
27
|
-
|
|
28
|
-
@finalized_attributes = nil
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def style
|
|
32
|
-
raise NotImplementedError
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def copy(new_parent, &block)
|
|
36
|
-
new_internal = self.class.new(new_parent, format)
|
|
37
|
-
new_internal.style = style.copy
|
|
38
|
-
new_internal.states = deep_copy(states)
|
|
39
|
-
|
|
40
|
-
block.call(new_internal) if block_given?
|
|
41
|
-
new_internal
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def type_of?
|
|
45
|
-
raise NotImplementedError
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module Basic
|
|
7
|
-
class BlockInterface < Basic::Interface
|
|
8
|
-
# @overload value(val)
|
|
9
|
-
# Set a val
|
|
10
|
-
# @param [Object] val
|
|
11
|
-
# @return [self]
|
|
12
|
-
# @overload value
|
|
13
|
-
# Return the value
|
|
14
|
-
# @return [Object]
|
|
15
|
-
def value(*args)
|
|
16
|
-
if args.empty?
|
|
17
|
-
internal.read_value
|
|
18
|
-
else
|
|
19
|
-
internal.write_value(args.first)
|
|
20
|
-
self
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# @param [Object] val
|
|
25
|
-
def value=(val)
|
|
26
|
-
value(val)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module Basic
|
|
7
|
-
class BlockInternal < Basic::Internal
|
|
8
|
-
format_delegators :box
|
|
9
|
-
|
|
10
|
-
def style
|
|
11
|
-
@style ||= Style::Basic.new(format)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def read_value
|
|
15
|
-
states.key?(:value) ? states[:value] : format.value.dup
|
|
16
|
-
end
|
|
17
|
-
alias value read_value
|
|
18
|
-
|
|
19
|
-
def write_value(val)
|
|
20
|
-
states[:value] = val
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def real_value
|
|
24
|
-
read_value
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def type_of?(type_name)
|
|
28
|
-
type_name == :block
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module Basic
|
|
7
|
-
class Format < Core::Format::Base
|
|
8
|
-
include Utils
|
|
9
|
-
|
|
10
|
-
config_reader :type, :id
|
|
11
|
-
config_reader :style
|
|
12
|
-
config_checker true, :display
|
|
13
|
-
config_reader follow_stretch: %w[follow-stretch]
|
|
14
|
-
|
|
15
|
-
def affect_bottom_margin?
|
|
16
|
-
attributes.fetch('affect-bottom-margin', true)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module Basic
|
|
7
|
-
class Interface < Base::Interface
|
|
8
|
-
internal_delegators :type
|
|
9
|
-
|
|
10
|
-
# @return [String]
|
|
11
|
-
def id
|
|
12
|
-
internal.id.dup
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# @param [Boolean] visibility
|
|
16
|
-
# @return [self]
|
|
17
|
-
def visible(visibility)
|
|
18
|
-
internal.style.visible = visibility
|
|
19
|
-
self
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# @return [Boolean]
|
|
23
|
-
def visible?
|
|
24
|
-
internal.style.visible
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# @overload style(style_name)
|
|
28
|
-
# @param [Symbol] style_name
|
|
29
|
-
# @return [Object]
|
|
30
|
-
# @overload style(style_name, value)
|
|
31
|
-
# @param [Symbol] style_name
|
|
32
|
-
# @param [String, Symbol, Number, Array] value
|
|
33
|
-
# @return [self]
|
|
34
|
-
# @overload style(style_name, value1, value2)
|
|
35
|
-
# @param [Symbol] style_name
|
|
36
|
-
# @param [String, Number] value1
|
|
37
|
-
# @param [String, Number] value2
|
|
38
|
-
# @return [self]
|
|
39
|
-
def style(*args)
|
|
40
|
-
case args.length
|
|
41
|
-
when 1
|
|
42
|
-
internal.style[args.first]
|
|
43
|
-
when 2
|
|
44
|
-
internal.style[args.first] = args.last
|
|
45
|
-
self
|
|
46
|
-
when 3
|
|
47
|
-
internal.style[args.shift] = args
|
|
48
|
-
self
|
|
49
|
-
else
|
|
50
|
-
raise ArgumentError, '#style requires 1 or 2, 3 arguments'
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# @param [Hash] settings style_name: value
|
|
55
|
-
# @return [self]
|
|
56
|
-
def styles(settings)
|
|
57
|
-
settings.each { |args| style(*args) }
|
|
58
|
-
self
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# @see #visible
|
|
62
|
-
# @return [self]
|
|
63
|
-
def hide
|
|
64
|
-
visible(false)
|
|
65
|
-
self
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# @see #visible
|
|
69
|
-
# @return [self]
|
|
70
|
-
def show
|
|
71
|
-
visible(true)
|
|
72
|
-
self
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
private
|
|
76
|
-
|
|
77
|
-
# @see Thinreports::Core::Shape::Base::Interface#init_internal
|
|
78
|
-
def init_internal(parent, format)
|
|
79
|
-
Basic::Internal.new(parent, format)
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module Basic
|
|
7
|
-
class Internal < Base::Internal
|
|
8
|
-
# Delegate to Format's methods
|
|
9
|
-
format_delegators :id, :type
|
|
10
|
-
|
|
11
|
-
def style
|
|
12
|
-
@style ||= Style::Graphic.new(format)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def type_of?(type_name)
|
|
16
|
-
[:basic, type].include?(type_name)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def identifier
|
|
20
|
-
"#{id}#{style.identifier}"
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module ImageBlock
|
|
7
|
-
class Interface < Basic::BlockInterface
|
|
8
|
-
# @see #value
|
|
9
|
-
alias src value
|
|
10
|
-
# @see #value=
|
|
11
|
-
alias src= value=
|
|
12
|
-
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
# @see Thinreports::Core::Shape::Base::Interface#init_internal
|
|
16
|
-
def init_internal(parent, format)
|
|
17
|
-
ImageBlock::Internal.new(parent, format)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module ImageBlock
|
|
7
|
-
class Internal < Basic::BlockInternal
|
|
8
|
-
alias src read_value
|
|
9
|
-
|
|
10
|
-
def type_of?(type_name)
|
|
11
|
-
type_name == ImageBlock::TYPE_NAME || super
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Thinreports
|
|
4
|
-
module Core
|
|
5
|
-
module Shape
|
|
6
|
-
module List
|
|
7
|
-
class Format < Basic::Format
|
|
8
|
-
config_reader height: %w[content-height]
|
|
9
|
-
config_checker true, auto_page_break: %w[auto-page-break]
|
|
10
|
-
|
|
11
|
-
# @deprecated
|
|
12
|
-
config_reader :header,
|
|
13
|
-
:detail,
|
|
14
|
-
:footer
|
|
15
|
-
# @deprecated
|
|
16
|
-
config_reader page_footer: %w[page-footer]
|
|
17
|
-
|
|
18
|
-
config_checker true, has_header: %w[header enabled]
|
|
19
|
-
config_checker true, has_footer: %w[footer enabled]
|
|
20
|
-
config_checker true, has_page_footer: %w[page-footer enabled]
|
|
21
|
-
|
|
22
|
-
config_reader page_footer_height: %w[page-footer height]
|
|
23
|
-
config_reader footer_height: %w[footer height]
|
|
24
|
-
config_reader header_height: %w[header height]
|
|
25
|
-
config_reader detail_height: %w[detail height]
|
|
26
|
-
|
|
27
|
-
attr_reader :sections
|
|
28
|
-
|
|
29
|
-
def initialize(*)
|
|
30
|
-
super
|
|
31
|
-
initialize_sections
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# @param [Symbol] section_name
|
|
35
|
-
# @return [Hash]
|
|
36
|
-
# @deprecated
|
|
37
|
-
def section(section_name)
|
|
38
|
-
__send__(section_name)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# @param [Symbol] section_name
|
|
42
|
-
# @return [Boolean]
|
|
43
|
-
def has_section?(section_name)
|
|
44
|
-
section_name == :detail ? true : __send__(:"has_#{section_name}?")
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# @param [Symbol] section_name
|
|
48
|
-
# @return [Numeric]
|
|
49
|
-
def section_height(section_name)
|
|
50
|
-
has_section?(section_name) ? __send__(:"#{section_name}_height") : 0
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# @param [:detai, :header, :page_footer, :footer] section_name
|
|
54
|
-
# @return [Numeric]
|
|
55
|
-
def section_base_position_top(section_name)
|
|
56
|
-
section = @sections[section_name]
|
|
57
|
-
return 0 unless has_section?(section_name)
|
|
58
|
-
|
|
59
|
-
top = section.relative_top
|
|
60
|
-
|
|
61
|
-
case section_name
|
|
62
|
-
when :page_footer
|
|
63
|
-
top - section_height(:detail)
|
|
64
|
-
when :footer
|
|
65
|
-
top - section_height(:detail) - section_height(:page_footer)
|
|
66
|
-
else
|
|
67
|
-
top
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
private
|
|
72
|
-
|
|
73
|
-
def initialize_sections
|
|
74
|
-
@sections = {
|
|
75
|
-
detail: List::SectionFormat.new(attributes['detail'])
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@sections[:header] = section_format('header') if has_section?(:header)
|
|
79
|
-
@sections[:page_footer] = section_format('page-footer') if has_section?(:page_footer)
|
|
80
|
-
@sections[:footer] = section_format('footer') if has_section?(:footer)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def section_format(section_name)
|
|
84
|
-
List::SectionFormat.new(attributes[section_name])
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|