File tree Expand file tree Collapse file tree 5 files changed +20
-5
lines changed Expand file tree Collapse file tree 5 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 1
1
# Change Log
2
2
3
+ ## [ 1.1.2] - 2019-06-04
4
+ ### Fixed
5
+ - If the first level of the tree is a leaf, ` accounting-table ` doesn't walk it
6
+ correctly.
7
+ ### Added
8
+ - Can pass through a custom ` :min-leaf-depth ` key to ` tree ` (replaces binding a
9
+ dynamic var in earlier versions).
10
+
11
+ ## [ 1.1.1] - 2019-06-01
12
+ ### Fixed
13
+ - Total rows were not always being displayed correctly for trees
14
+
3
15
## [ 1.1.0] - 2019-05-28
4
16
### Added
5
17
- More flexible tree rendering/aggregation
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ common sense styling.
8
8
9
9
Lein:
10
10
```
11
- [org.clojars.mjdowney/excel-clj "1.1.1 "]
11
+ [org.clojars.mjdowney/excel-clj "1.1.2 "]
12
12
```
13
13
14
14
- [ Getting Started] ( #getting-started )
Original file line number Diff line number Diff line change 1
- (defproject org.clojars.mjdowney /excel-clj " 1.1.1 "
1
+ (defproject org.clojars.mjdowney /excel-clj " 1.1.2 "
2
2
:description " Generate Excel documents & PDFs from Clojure data."
3
3
:url " https://github.com/matthewdowney/excel-clj"
4
4
:license {:name " Eclipse Public License"
Original file line number Diff line number Diff line change 200
200
If provided, the formatters argument is a function that takes the integer
201
201
depth of a category (increases with nesting) and returns a cell format for
202
202
the row, and total-formatters is the same for rows that are totals."
203
- [t & {:keys [headers formatters total-formatters data-format]
203
+ [t & {:keys [headers formatters total-formatters min-leaf-depth data-format]
204
204
:or {formatters style/default-tree-formatters
205
205
total-formatters style/default-tree-total-formatters
206
+ min-leaf-depth 2
206
207
data-format :accounting }}]
207
208
(try
208
- (let [tabular (tree/accounting-table (second t))
209
+ (let [tabular (tree/accounting-table (second t) :min-leaf-depth min-leaf-depth )
209
210
fmt-or-max (fn [fs n]
210
211
(or (get fs n) (second (apply max-key first fs))))
211
212
all-colls (or headers
Original file line number Diff line number Diff line change 161
161
[{::depth 0 ::label (label node) ::header? true }]
162
162
; ; Then the children & their values
163
163
(mapv #(update % ::depth inc) children)
164
+
164
165
; ; And finally an aggregation if there are multiple header children
165
166
; ; or any leaf children
166
167
(let [fchild (first children)
167
168
siblings (get (group-by :depth children) (:depth fchild))]
168
169
(when (or (>= (count siblings) 2 ) (not (::header? fchild)))
169
170
[(merge {::depth 0 ::label " " ::total? true } (value node aggregate-with))])))
171
+
170
172
; ; A leaf just has its label & value attrs. The depth is inc'd by each
171
173
; ; parent back to the root, so it does not stay at 0.
172
- (merge {::depth 0 ::label (label node)} (value node aggregate-with))))
174
+ [ (merge {::depth 0 ::label (label node)} (value node aggregate-with))] ))
173
175
tree)))
174
176
(map
175
177
(fn [table-row]
You can’t perform that action at this time.
0 commit comments