mirror of
https://github.com/byteverse/colonnade.git
synced 2026-09-14 23:24:55 +02:00
use display:none instead of setting colspan to 0
This commit is contained in:
parent
4886ad9ff0
commit
f62d10b75c
@ -144,7 +144,12 @@ bodyResizable bodyAttrs trAttrs colonnade collection = elAttr "tbody" bodyAttrs
|
|||||||
$ elAttr "tr" (trAttrs a)
|
$ elAttr "tr" (trAttrs a)
|
||||||
$ unWrappedApplicative
|
$ unWrappedApplicative
|
||||||
$ E.rowMonoidalHeader colonnade (\(Resizable dynSize _) (Cell cattr content) ->
|
$ E.rowMonoidalHeader colonnade (\(Resizable dynSize _) (Cell cattr content) ->
|
||||||
WrappedApplicative (elDynAttr "td" (zipDynWith (\i at -> M.insert "colspan" (T.pack (show i)) at) dynSize cattr) content)) a
|
WrappedApplicative (elDynAttr "td" (zipDynWith setColspanOrHide dynSize cattr) content)) a
|
||||||
|
|
||||||
|
setColspanOrHide :: Int -> Map Text Text -> Map Text Text
|
||||||
|
setColspanOrHide i m
|
||||||
|
| i < 1 = M.insertWith T.append "style" "display:none;" m
|
||||||
|
| otherwise = M.insert "colspan" (T.pack (show i)) m
|
||||||
|
|
||||||
static ::
|
static ::
|
||||||
(DomBuilder t m, PostBuild t m, Foldable f, Foldable h, Monoid e)
|
(DomBuilder t m, PostBuild t m, Foldable f, Foldable h, Monoid e)
|
||||||
@ -213,10 +218,7 @@ encodeCorniceResizableHead headAttrs fascia annCornice =
|
|||||||
thead :: WrappedApplicative m e
|
thead :: WrappedApplicative m e
|
||||||
thead = E.headersMonoidal (Just (fascia, addAttr)) [(th,id)] annCornice
|
thead = E.headersMonoidal (Just (fascia, addAttr)) [(th,id)] annCornice
|
||||||
th :: Dynamic t Int -> Cell t m e -> WrappedApplicative m e
|
th :: Dynamic t Int -> Cell t m e -> WrappedApplicative m e
|
||||||
th size (Cell attrs contents) = WrappedApplicative (elDynAttr "th" (zipDynWith addColspan size attrs) contents)
|
th size (Cell attrs contents) = WrappedApplicative (elDynAttr "th" (zipDynWith setColspanOrHide size attrs) contents)
|
||||||
where
|
|
||||||
addColspan :: Int -> Map Text Text -> Map Text Text
|
|
||||||
addColspan i = M.insert "colspan" (T.pack (show i))
|
|
||||||
addAttr :: Map Text Text -> WrappedApplicative m b -> WrappedApplicative m b
|
addAttr :: Map Text Text -> WrappedApplicative m b -> WrappedApplicative m b
|
||||||
addAttr attrs = WrappedApplicative . elAttr "tr" attrs . unWrappedApplicative
|
addAttr attrs = WrappedApplicative . elAttr "tr" attrs . unWrappedApplicative
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user