drawio_dsl 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.builders/generators/sample_diagrams/50-willoughby-council.rb +38 -0
- data/CHANGELOG.md +7 -0
- data/lib/drawio_dsl/schema/layouts/grid_layout.rb +17 -10
- data/lib/drawio_dsl/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc020dbec3ff4115cab4aa60206f9e7321670c6337c6621134b592695f2f8037
|
4
|
+
data.tar.gz: 42f7bab79c6318c124cf457f1f2cabfd3738eff6ba3d8c8066bb486901cb0021
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62b9fa5927e15b638fe9e135fd90b5a304c248f9328a2c42d43079a15b06e839c309ebfa3a356d824fd29fe85bdcf2c02ccbe262dbd1a62aaa8a60ea2cca055d
|
7
|
+
data.tar.gz: 402641432dd415ff7694a3204ba2c5180910bb1f8642ce238c6374b4b2e3d930a93ea5ed4e6a04350cfa98f7c0fb5d7d5b49002022997e77e8c200ce242cfba9
|
@@ -0,0 +1,38 @@
|
|
1
|
+
KManager.action :bootstrap do
|
2
|
+
action do
|
3
|
+
|
4
|
+
# :rounded, :shadow, :sketch, :glass
|
5
|
+
director = DrawioDsl::Drawio
|
6
|
+
.init(k_builder)
|
7
|
+
.diagram(theme: :style_06)
|
8
|
+
.page('Shapes', margin_left: 0, margin_top: 0, rounded: 1) do
|
9
|
+
grid_layout(wrap_at: 40, direction: :vertical, )
|
10
|
+
|
11
|
+
square(w: 300, h: 100, title: 'PREPARATION FOR INVESTIGATION ')
|
12
|
+
square(w: 300, h: 100, title: '(source: Hunter & Central Coast Regional Environmental Management Strategy – Investigations guideline) ')
|
13
|
+
square(w: 300, h: 100, title: 'Enter report into system')
|
14
|
+
square(w: 300, h: 100, title: 'Preliminary Review ')
|
15
|
+
square(w: 300, h: 100, title: 'Insufficient Information ')
|
16
|
+
square(w: 300, h: 100, title: 'Seek Additional Information ')
|
17
|
+
square(w: 300, h: 100, title: 'Identify Possible Breach ')
|
18
|
+
square(w: 300, h: 100, title: 'Insufficient evidence or no breach detected ')
|
19
|
+
square(w: 300, h: 100, title: 'Plan follow up action ')
|
20
|
+
square(w: 300, h: 100, title: 'Establish Jurisdiction - Council or other agency? ')
|
21
|
+
square(w: 300, h: 100, title: 'Refer to other agency ')
|
22
|
+
square(w: 300, h: 100, title: 'Council Responsibility ')
|
23
|
+
square(w: 300, h: 100, title: 'Plan investigation ')
|
24
|
+
square(w: 300, h: 100, title: 'Conduct investigation Gather and manage evidence (Evidence Gathering Guideline) ')
|
25
|
+
square(w: 300, h: 100, title: 'Prepare recommendations report ')
|
26
|
+
square(w: 300, h: 100, title: 'Make decision ')
|
27
|
+
square(w: 300, h: 100, title: 'Take action (Enforcement Options Guideline) ')
|
28
|
+
square(w: 300, h: 100, title: 'Review investigation ')
|
29
|
+
square(w: 300, h: 100, title: 'Close case ')
|
30
|
+
square(w: 300, h: 100, title: 'Feedback to complainant ')
|
31
|
+
end
|
32
|
+
|
33
|
+
diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
|
34
|
+
|
35
|
+
File.write('../spec/.samples/drawio/50-willoughby-council.xml', diagram.build)
|
36
|
+
File.write('../spec/.samples/drawio/50-willoughby-council.drawio', diagram.build)
|
37
|
+
end
|
38
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.5.1](https://github.com/klueless-io/drawio_dsl/compare/v0.5.0...v0.5.1) (2022-03-07)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* refactor nodes array to nodelist object ([10372a5](https://github.com/klueless-io/drawio_dsl/commit/10372a529e6274bae451dae15626dfbac4b9cccb))
|
7
|
+
|
1
8
|
# [0.5.0](https://github.com/klueless-io/drawio_dsl/compare/v0.4.1...v0.5.0) (2022-03-07)
|
2
9
|
|
3
10
|
|
@@ -6,22 +6,28 @@ module DrawioDsl
|
|
6
6
|
class GridLayout < Layout
|
7
7
|
attr_accessor :direction
|
8
8
|
attr_accessor :wrap_at
|
9
|
-
attr_accessor :grid_size
|
9
|
+
attr_accessor :grid_size # this is an alternative to grid_w/grid_h
|
10
|
+
attr_accessor :grid_w
|
11
|
+
attr_accessor :grid_h
|
10
12
|
attr_accessor :cell_no
|
11
13
|
attr_accessor :h_align
|
12
14
|
attr_accessor :v_align
|
13
15
|
|
16
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
14
17
|
def initialize(page, **args)
|
15
18
|
@type = :grid_layout
|
16
19
|
@direction = args[:direction] || :horizontal
|
17
20
|
@wrap_at = args[:wrap_at] || 5
|
18
21
|
@grid_size = args[:grid_size] || 220
|
22
|
+
@grid_w = args[:grid_w] || grid_size
|
23
|
+
@grid_h = args[:grid_h] || grid_size
|
19
24
|
@h_align = args[:h_align] || :center
|
20
25
|
@v_align = args[:v_align] || :center
|
21
26
|
@cell_no = 1
|
22
27
|
|
23
28
|
super(page, **args)
|
24
29
|
end
|
30
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
25
31
|
|
26
32
|
def position_shape(shape)
|
27
33
|
fire_after_init
|
@@ -47,7 +53,8 @@ module DrawioDsl
|
|
47
53
|
super.merge(
|
48
54
|
direction: direction,
|
49
55
|
wrap_at: wrap_at,
|
50
|
-
|
56
|
+
grid_w: grid_w,
|
57
|
+
grid_h: grid_h,
|
51
58
|
cell_no: cell_no
|
52
59
|
)
|
53
60
|
end
|
@@ -56,8 +63,8 @@ module DrawioDsl
|
|
56
63
|
|
57
64
|
# rubocop:disable Metrics/AbcSize
|
58
65
|
def horizontal_shape_alignment(shape)
|
59
|
-
return page.position_x + ((
|
60
|
-
return page.position_x + (
|
66
|
+
return page.position_x + ((grid_w - shape.w) / 2) if h_align == :center
|
67
|
+
return page.position_x + (grid_w - shape.w) if h_align == :right
|
61
68
|
|
62
69
|
page.position_x
|
63
70
|
end
|
@@ -65,8 +72,8 @@ module DrawioDsl
|
|
65
72
|
|
66
73
|
# rubocop:disable Metrics/AbcSize
|
67
74
|
def vertical_shape_alignment(shape)
|
68
|
-
return page.position_y + ((
|
69
|
-
return page.position_y + (
|
75
|
+
return page.position_y + ((grid_h - shape.h) / 2) if v_align == :center || v_align == :middle
|
76
|
+
return page.position_y + (grid_h - shape.h) if v_align == :bottom
|
70
77
|
|
71
78
|
page.position_y
|
72
79
|
end
|
@@ -74,27 +81,27 @@ module DrawioDsl
|
|
74
81
|
|
75
82
|
def move_cell_horizontally
|
76
83
|
if cell_no < wrap_at
|
77
|
-
page.position_x +=
|
84
|
+
page.position_x += grid_w
|
78
85
|
@cell_no += 1
|
79
86
|
return
|
80
87
|
end
|
81
88
|
|
82
89
|
# Flow down to the next row
|
83
90
|
page.position_x = anchor_x
|
84
|
-
page.position_y +=
|
91
|
+
page.position_y += grid_w
|
85
92
|
@cell_no = 1
|
86
93
|
end
|
87
94
|
|
88
95
|
def move_cell_vertically
|
89
96
|
if cell_no < wrap_at
|
90
|
-
page.position_y +=
|
97
|
+
page.position_y += grid_h
|
91
98
|
@cell_no += 1
|
92
99
|
return
|
93
100
|
end
|
94
101
|
|
95
102
|
# Flow right to the next column
|
96
103
|
page.position_y = anchor_y
|
97
|
-
page.position_x +=
|
104
|
+
page.position_x += grid_h
|
98
105
|
@cell_no = 1
|
99
106
|
end
|
100
107
|
end
|
data/lib/drawio_dsl/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "drawio_dsl",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.2",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "drawio_dsl",
|
9
|
-
"version": "0.5.
|
9
|
+
"version": "0.5.2",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drawio_dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- ".builders/generators/sample_diagrams/20-styles.rb"
|
92
92
|
- ".builders/generators/sample_diagrams/25-themes.rb"
|
93
93
|
- ".builders/generators/sample_diagrams/30-shapes.rb"
|
94
|
+
- ".builders/generators/sample_diagrams/50-willoughby-council.rb"
|
94
95
|
- ".releaserc.json"
|
95
96
|
- ".rspec"
|
96
97
|
- ".rubocop.yml"
|