monomer-hagrid 0.2.1.1 → 0.3.0.0
raw patch · 6 files changed
+42/−45 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- example-basic/Main.hs +4/−7
- example-big-grid/Main.hs +0/−4
- example-resizing-cells/Main.hs +0/−4
- monomer-hagrid.cabal +26/−13
- src/Monomer/Hagrid.hs +4/−9
- test/Monomer/HagridSpec.hs +8/−8
example-basic/Main.hs view
@@ -1,6 +1,3 @@-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-name-shadowing #-} @@ -175,11 +172,11 @@ (textColumn "Species" (.species)) { initialWidth = 200 },- (textColumn "Date of Birth" (T.pack . formatTime defaultTimeLocale "%Y-%m-%d" . dateOfBirth))+ (textColumn "Date of Birth" (T.pack . formatTime defaultTimeLocale "%Y-%m-%d" . (.dateOfBirth))) { initialWidth = 200 },- (textColumn "Weight (Kg)" (T.pack . printf "%.2f" . weightKilos))- { sortKey = SortWith weightKilos,+ (textColumn "Weight (Kg)" (T.pack . printf "%.2f" . (.weightKilos)))+ { sortKey = SortWith (.weightKilos), initialWidth = 200, align = ColumnAlignRight, footerWidget = CustomFooterWidget sumWeightFooter@@ -197,7 +194,7 @@ sumWeightFooter spiders = tree where tree = labelledFooter "Sum" (T.pack (printf "%.2f" totalWeightKilos))- totalWeightKilos = sum (weightKilos . fst <$> spiders)+ totalWeightKilos = sum ((.weightKilos) . fst <$> spiders) labelledFooter labelText text = hstack
example-big-grid/Main.hs view
@@ -1,7 +1,3 @@-{-# LANGUAGE EmptyCase #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE NamedFieldPuns #-}- module Main (main) where import Data.Function ((&))
example-resizing-cells/Main.hs view
@@ -1,7 +1,3 @@-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE NumericUnderscores #-}- module Main (main) where import Control.Concurrent (threadDelay)
monomer-hagrid.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: monomer-hagrid-version: 0.2.1.1+version: 0.3.0.0 license: MIT license-file: LICENSE maintainer: garethdanielsmith@gmail.com@@ -21,9 +21,12 @@ location: https://github.com/Dretch/monomer-hagrid flag examples- default: False- manual: True+ description:+ Whether to build the example executables. Off by default because they are not usually wanted. + default: False+ manual: True+ library exposed-modules: Monomer.Hagrid hs-source-dirs: src@@ -31,8 +34,10 @@ autogen-modules: Paths_monomer_hagrid default-language: Haskell2010 default-extensions:- DisambiguateRecordFields DuplicateRecordFields FlexibleContexts- OverloadedRecordDot OverloadedStrings+ DisambiguateRecordFields DuplicateRecordFields EmptyCase+ FlexibleContexts GADTs LambdaCase NamedFieldPuns NoFieldSelectors+ NumericUnderscores OverloadedRecordDot OverloadedStrings RankNTypes+ ScopedTypeVariables ghc-options: -Wall -Wcompat -Wincomplete-record-updates@@ -54,8 +59,10 @@ autogen-modules: Paths_monomer_hagrid default-language: Haskell2010 default-extensions:- DisambiguateRecordFields DuplicateRecordFields FlexibleContexts- OverloadedRecordDot OverloadedStrings+ DisambiguateRecordFields DuplicateRecordFields EmptyCase+ FlexibleContexts GADTs LambdaCase NamedFieldPuns NoFieldSelectors+ NumericUnderscores OverloadedRecordDot OverloadedStrings RankNTypes+ ScopedTypeVariables ghc-options: -Wall -Wcompat -Wincomplete-record-updates@@ -85,8 +92,10 @@ autogen-modules: Paths_monomer_hagrid default-language: Haskell2010 default-extensions:- DisambiguateRecordFields DuplicateRecordFields FlexibleContexts- OverloadedRecordDot OverloadedStrings+ DisambiguateRecordFields DuplicateRecordFields EmptyCase+ FlexibleContexts GADTs LambdaCase NamedFieldPuns NoFieldSelectors+ NumericUnderscores OverloadedRecordDot OverloadedStrings RankNTypes+ ScopedTypeVariables ghc-options: -Wall -Wcompat -Wincomplete-record-updates@@ -115,8 +124,10 @@ autogen-modules: Paths_monomer_hagrid default-language: Haskell2010 default-extensions:- DisambiguateRecordFields DuplicateRecordFields FlexibleContexts- OverloadedRecordDot OverloadedStrings+ DisambiguateRecordFields DuplicateRecordFields EmptyCase+ FlexibleContexts GADTs LambdaCase NamedFieldPuns NoFieldSelectors+ NumericUnderscores OverloadedRecordDot OverloadedStrings RankNTypes+ ScopedTypeVariables ghc-options: -Wall -Wcompat -Wincomplete-record-updates@@ -152,8 +163,10 @@ autogen-modules: Paths_monomer_hagrid default-language: Haskell2010 default-extensions:- DisambiguateRecordFields DuplicateRecordFields FlexibleContexts- OverloadedRecordDot OverloadedStrings+ DisambiguateRecordFields DuplicateRecordFields EmptyCase+ FlexibleContexts GADTs LambdaCase NamedFieldPuns NoFieldSelectors+ NumericUnderscores OverloadedRecordDot OverloadedStrings RankNTypes+ ScopedTypeVariables ghc-options: -Wall -Wcompat -Wincomplete-record-updates
src/Monomer/Hagrid.hs view
@@ -1,8 +1,3 @@-{-# LANGUAGE GADTs #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS_GHC -Wno-name-shadowing #-} -- | A datagrid widget for the Monomer UI library.@@ -414,7 +409,7 @@ where Rect l t _w h = viewport widgetWidths = do- (i, w) <- indexed (currentWidth <$> model.columns)+ (i, w) <- indexed ((.currentWidth) <$> model.columns) -- center the drag handle inbetween the columns let buttonW | i == 0 = fromIntegral w - (dragHandleWidth / 2)@@ -466,7 +461,7 @@ & L.children .~ S.fromList (catMaybes childWidgets) childWidgets :: [Maybe (WidgetNode (HagridModel a) (HagridEvent e))]- childWidgets = footerWidgetNode model.sortedItems . footerWidget <$> columnDefs+ childWidgets = footerWidgetNode model.sortedItems . (.footerWidget) <$> columnDefs makeWidget :: HeaderFooterState -> Widget (HagridModel a) (HagridEvent e) makeWidget state = container@@ -491,7 +486,7 @@ initialHeaderFooterState :: HagridModel a -> HeaderFooterState initialHeaderFooterState model = HeaderFooterState- { columnWidths = currentWidth <$> model.columns,+ { columnWidths = (.currentWidth) <$> model.columns, offsetX = 0 } @@ -621,7 +616,7 @@ where initialModel = ContentPaneModel- { columnWidths = currentWidth <$> model.columns,+ { columnWidths = (.currentWidth) <$> model.columns, visibleArea = Rect 0 0 0 0, fixedRowIndex = 0, fixedRowViewportOffset = 0,
test/Monomer/HagridSpec.hs view
@@ -33,8 +33,8 @@ resize = describe "resize" $ do it "should assign cell widths according to column widths" $ do cellViewports- [ (testColumn "Col 1" sizeReq) {initialWidth = 33},- (testColumn "Col 2" sizeReq) {initialWidth = 77}+ [ (testColumn "Col 1" (.sizeReq)) {initialWidth = 33},+ (testColumn "Col 2" (.sizeReq)) {initialWidth = 77} ] [TestItem (fixedSize 10)] `shouldBe` [ Rect 0 40 33 10,@@ -43,7 +43,7 @@ it "should assign single column cell heights according to cell heights" $ do cellViewports- [ (testColumn "Col 1" sizeReq) {initialWidth = 50}+ [ (testColumn "Col 1" (.sizeReq)) {initialWidth = 50} ] [TestItem (fixedSize 33), TestItem (fixedSize 77)] `shouldBe` [Rect 0 40 50 33, Rect 0 73 50 77]@@ -58,7 +58,7 @@ it "should use both fixed and flex height to calculate row height" $ do cellViewports- [ (testColumn "Col 1" sizeReq) {initialWidth = 50}+ [ (testColumn "Col 1" (.sizeReq)) {initialWidth = 50} ] [TestItem (fixedSize 10 & L.flex .~ 7)] `shouldBe` [Rect 0 40 50 17]@@ -88,7 +88,7 @@ sorting = describe "sorting" $ do it "should not sort rows by default" $ do cellViewports- [(testColumn "Col 1" sizeReq) {initialWidth = 50, sortKey = SortWith (_szrFixed . sizeReq)}]+ [(testColumn "Col 1" (.sizeReq)) {initialWidth = 50, sortKey = SortWith (_szrFixed . (.sizeReq))}] [ TestItem (fixedSize 20), TestItem (fixedSize 10), TestItem (fixedSize 30)@@ -100,7 +100,7 @@ it "should sort in ascending order when column header clicked" $ do cellViewportsEvts- [(testColumn "Col 1" sizeReq) {initialWidth = 50, sortKey = SortWith (_szrFixed . sizeReq)}]+ [(testColumn "Col 1" (.sizeReq)) {initialWidth = 50, sortKey = SortWith (_szrFixed . (.sizeReq))}] [ TestItem (fixedSize 20), TestItem (fixedSize 10), TestItem (fixedSize 30)@@ -113,7 +113,7 @@ it "should sort in descending order when column header clicked again" $ do cellViewportsEvts- [(testColumn "Col 1" sizeReq) {initialWidth = 50, sortKey = SortWith (_szrFixed . sizeReq)}]+ [(testColumn "Col 1" (.sizeReq)) {initialWidth = 50, sortKey = SortWith (_szrFixed . (.sizeReq))}] [ TestItem (fixedSize 20), TestItem (fixedSize 10), TestItem (fixedSize 30)@@ -141,7 +141,7 @@ it "should give items and sorted indices to scrollToRow callback" $ do itemsMVar <- newEmptyMVar let cols =- [(textColumn "Col" (const "")) {sortKey = SortWith (_szrFixed . sizeReq)}]+ [(textColumn "Col" (const "")) {sortKey = SortWith (_szrFixed . (.sizeReq))}] items = S.fromList [ TestItem (fixedSize 1),