monomer-hagrid 0.3.0.1 → 0.3.1.0
raw patch · 3 files changed
+21/−25 lines, 3 filesdep −ilistdep ~lensdep ~textdep ~time
Dependencies removed: ilist
Dependency ranges changed: lens, text, time
Files
- ChangeLog.md +4/−0
- monomer-hagrid.cabal +12/−17
- src/Monomer/Hagrid.hs +5/−8
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.3.1.0+### Changed+- Remove ilist package dependency, since it is not in the latest Stackage LTS and is easily replaced.+ ## 0.3.0.1 ### Fixed - Fix a bug where header buttons were drawn outside the grid during horizontal scrolling.
monomer-hagrid.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: monomer-hagrid-version: 0.3.0.1+version: 0.3.1.0 license: MIT license-file: LICENSE maintainer: garethdanielsmith@gmail.com@@ -47,10 +47,9 @@ base >=4.7 && <5, containers <0.7, data-default-class <0.2,- ilist <0.5,- lens <5.2,+ lens <5.3, monomer >=1.5.1.0 && <1.6,- text <1.3+ text <2.1 executable example-basic main-is: Main.hs@@ -73,12 +72,11 @@ base >=4.7 && <5, containers <0.7, data-default-class <0.2,- ilist <0.5,- lens <5.2,+ lens <5.3, monomer >=1.5.1.0 && <1.6, monomer-hagrid,- text <1.3,- time <1.12+ text <2.1,+ time <1.13 if flag(examples) @@ -106,11 +104,10 @@ base >=4.7 && <5, containers <0.7, data-default-class <0.2,- ilist <0.5,- lens <5.2,+ lens <5.3, monomer >=1.5.1.0 && <1.6, monomer-hagrid,- text <1.3+ text <2.1 if flag(examples) @@ -138,12 +135,11 @@ base >=4.7 && <5, containers <0.7, data-default-class <0.2,- ilist <0.5,- lens <5.2,+ lens <5.3, monomer >=1.5.1.0 && <1.6, monomer-hagrid, random <1.3,- text <1.3+ text <2.1 if flag(examples) @@ -180,10 +176,9 @@ data-default <0.8, data-default-class <0.2, hspec >=2 && <3,- ilist <0.5,- lens <5.2,+ lens <5.3, monomer >=1.5.1.0 && <1.6, monomer-hagrid, mtl <2.3, stm <2.6,- text <1.3+ text <2.1
src/Monomer/Hagrid.hs view
@@ -40,7 +40,6 @@ import Data.Data (Typeable) import Data.Default.Class (Default, def) import Data.Foldable (foldl')-import Data.List.Index (indexed, izipWith, modifyAt) import Data.Maybe (catMaybes, isNothing, maybeToList) import Data.Maybe as X (fromMaybe) import Data.Ord (Down (Down))@@ -332,7 +331,7 @@ handler = Report <$> maybeToList (sortHandler <*> (snd <$> sortColumn)) ResizeColumn colIndex newWidth ->- [Model (model {columns = modifyAt colIndex (\c -> c {currentWidth = newWidth}) model.columns})]+ [Model model {columns = model.columns & ix colIndex %~ (\c -> c {currentWidth = newWidth})}] ResizeColumnFinished colIndex -> result where ModelColumn {currentWidth} = model.columns !! colIndex@@ -389,7 +388,7 @@ & L.children .~ S.fromList childWidgets childWidgets =- mconcat (izipWith childWidgetPair columnDefs model.columns)+ mconcat (zipWith3 childWidgetPair [0 ..] columnDefs model.columns) childWidgetPair i columnDef column = [btn, handle] where@@ -409,12 +408,10 @@ where Rect l t _w h = viewport widgetWidths = do- (i, w) <- indexed ((.currentWidth) <$> model.columns) -- center the drag handle inbetween the columns- let buttonW- | i == 0 = fromIntegral w - (dragHandleWidth / 2)- | otherwise = fromIntegral w - dragHandleWidth- [buttonW, dragHandleWidth]+ let wDeltas = dragHandleWidth / 2 : repeat dragHandleWidth+ (wd, w) <- zip wDeltas ((.currentWidth) <$> model.columns)+ [fromIntegral w - wd, dragHandleWidth] (assignedAreas, _) = foldl' assignArea (mempty, l) widgetWidths assignArea (areas, colX) columnWidth = (areas :|> Rect colX t columnWidth h, colX + columnWidth)