File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
ghcjs/delivery-calculator/src/App Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,16 @@ newXlsx st imgs = xlsx
18
18
xlsx =
19
19
fromXlsx 0
20
20
$ def
21
- & atSheet " Delivery Calculator "
21
+ & atSheet " Delivery_Calculator "
22
22
?~ sheet
23
23
sheet =
24
24
def
25
25
& # wsDrawing
26
26
.~ Just (Drawing mempty )
27
27
& # wsRowPropertiesMap
28
28
.~ newRowProps rows
29
+ & # wsColumnsProperties
30
+ .~ newColProps (fmap snd rows)
29
31
& addHeader st
30
32
& flip (foldl $ addRow imgs) rows
31
33
rows =
@@ -43,10 +45,28 @@ newRowProps =
43
45
. fmap
44
46
( \ (rowIdx, rowVal) ->
45
47
if any (\ x -> x ^. # fieldType == FieldTypeImage ) rowVal
46
- then Just (rowIdx, def & # rowHeight ?~ CustomHeight 200 )
48
+ then Just (rowIdx, def & # rowHeight ?~ CustomHeight 180 )
47
49
else Nothing
48
50
)
49
51
52
+ newColProps :: [[Field DynamicField Unique ]] -> [ColumnsProperties ]
53
+ newColProps rows = nubOrd $ do
54
+ row <- rows
55
+ (colIdx, colVal) <- zip [1 .. ] row
56
+ if colVal ^. # fieldType /= FieldTypeImage
57
+ then mempty
58
+ else
59
+ pure
60
+ ColumnsProperties
61
+ { cpMin = colIdx,
62
+ cpMax = colIdx,
63
+ cpWidth = Just 45 ,
64
+ cpStyle = Nothing ,
65
+ cpHidden = False ,
66
+ cpCollapsed = False ,
67
+ cpBestFit = False
68
+ }
69
+
50
70
addHeader :: St Unique -> Worksheet -> Worksheet
51
71
addHeader st sheet =
52
72
case sortOn length headers of
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ data ColumnsProperties = ColumnsProperties
179
179
-- fit'.
180
180
cpBestFit :: Bool
181
181
}
182
- deriving (Eq , Show , Generic )
182
+ deriving (Eq , Ord , Show , Generic )
183
183
184
184
instance NFData ColumnsProperties
185
185
You can’t perform that action at this time.
0 commit comments