Merge branch 'master' into 623-kursassoziierte-studienfacher-abschaffen
This commit is contained in:
commit
ab841a65a3
@ -34,7 +34,7 @@ npm install:
|
||||
- install -v -T -m 0644 ${APT_SOURCES_LIST} /etc/apt/sources.list
|
||||
- apt-get update -y
|
||||
- npm install -g n
|
||||
- n 13.5.0
|
||||
- n 14.8.0
|
||||
- export PATH="${N_PREFIX}/bin:$PATH"
|
||||
- npm install -g npm
|
||||
- hash -r
|
||||
@ -149,7 +149,7 @@ frontend:test:
|
||||
- install -v -T -m 0644 ${APT_SOURCES_LIST} /etc/apt/sources.list
|
||||
- apt-get update -y
|
||||
- npm install -g n
|
||||
- n 13.5.0
|
||||
- n 14.8.0
|
||||
- export PATH="${N_PREFIX}/bin:$PATH"
|
||||
- npm install -g npm
|
||||
- hash -r
|
||||
|
||||
@ -2,6 +2,13 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [19.2.1](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v19.2.0...v19.2.1) (2020-08-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* improve hidecolumns behaviour ([9a4f30b](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/commit/9a4f30b811fdf8c58ec5c50c185628eb3158931a))
|
||||
|
||||
## [19.2.0](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v19.1.5...v19.2.0) (2020-08-24)
|
||||
|
||||
|
||||
|
||||
@ -5,17 +5,26 @@ import * as defer from 'lodash.defer';
|
||||
class Overhang {
|
||||
colSpan;
|
||||
rowSpan;
|
||||
cell;
|
||||
|
||||
constructor(colSpan, rowSpan) {
|
||||
constructor(colSpan, rowSpan, cell) {
|
||||
this.colSpan = colSpan;
|
||||
this.rowSpan = rowSpan;
|
||||
this.cell = cell;
|
||||
|
||||
if (new.target === Overhang)
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
nextLine() {
|
||||
return new Overhang(this.colSpan, Math.max(0, this.rowSpan - 1));
|
||||
return new Overhang(this.colSpan, Math.max(0, this.rowSpan - 1), this.cell);
|
||||
}
|
||||
|
||||
reduceCol(n) {
|
||||
if (this.colSpan > n)
|
||||
return new Overhang(this.colSpan - n, this.rowSpan, this.cell);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
isHole() {
|
||||
@ -57,11 +66,10 @@ export class TableIndices {
|
||||
this._table = table;
|
||||
|
||||
|
||||
let overhangs = new Array();
|
||||
let currentOverhangs = new Array();
|
||||
let currentRow = 0;
|
||||
|
||||
for (const rowParent of this._table.rows) {
|
||||
let currentOverhangs = Array.from(overhangs);
|
||||
let newOverhangs = new Array();
|
||||
|
||||
let cellBefore = 0;
|
||||
@ -76,18 +84,38 @@ export class TableIndices {
|
||||
break;
|
||||
else
|
||||
newOverhangs.push(overhang.nextLine());
|
||||
|
||||
if (DEBUG_MODE > 1)
|
||||
console.log('From overhang', overhang);
|
||||
|
||||
cellBefore += overhang.colSpan;
|
||||
}
|
||||
|
||||
currentOverhangs = currentOverhangs.slice(i);
|
||||
let remCols = this.colSpan(cell);
|
||||
while (remCols > 0 && currentOverhangs[0]) {
|
||||
let firstOverhang = currentOverhangs[0].reduceCol(this.colSpan(cell));
|
||||
if (firstOverhang) {
|
||||
if (DEBUG_MODE > 1)
|
||||
console.log('Replace first overhang', remCols, currentOverhangs[0], firstOverhang);
|
||||
currentOverhangs[0] = firstOverhang;
|
||||
break;
|
||||
} else {
|
||||
if (DEBUG_MODE > 1)
|
||||
console.log('Drop first overhang', remCols, currentOverhangs[0], firstOverhang);
|
||||
remCols -= currentOverhangs[0].colSpan;
|
||||
currentOverhangs.shift();
|
||||
}
|
||||
}
|
||||
|
||||
this._cellToIndices.set(cell, { row: currentRow, col: cellBefore });
|
||||
|
||||
let rows = range(currentRow, currentRow + this.rowSpan(cell));
|
||||
let columns = range(cellBefore, cellBefore + this.colSpan(cell));
|
||||
|
||||
if (DEBUG_MODE > 0) {
|
||||
if (DEBUG_MODE > 1) {
|
||||
console.log('Result', rows, columns);
|
||||
|
||||
cell.dataset.rows = JSON.stringify(rows);
|
||||
cell.dataset.columns = JSON.stringify(columns);
|
||||
}
|
||||
@ -104,11 +132,14 @@ export class TableIndices {
|
||||
}
|
||||
}
|
||||
|
||||
newOverhangs.push(new Overhang(this.colSpan(cell), this.rowSpan(cell) - 1));
|
||||
newOverhangs.push(new Overhang(this.colSpan(cell), this.rowSpan(cell) - 1, cell));
|
||||
|
||||
if (DEBUG_MODE > 1)
|
||||
console.log('From current cell', this.colSpan(cell));
|
||||
cellBefore += this.colSpan(cell);
|
||||
}
|
||||
|
||||
overhangs = newOverhangs;
|
||||
currentOverhangs = Array.from(newOverhangs);
|
||||
currentRow++;
|
||||
}
|
||||
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "uni2work",
|
||||
"version": "19.2.0",
|
||||
"version": "19.2.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "uni2work",
|
||||
"version": "19.2.0",
|
||||
"version": "19.2.1",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: uniworx
|
||||
version: 19.2.0
|
||||
version: 19.2.1
|
||||
|
||||
dependencies:
|
||||
- base
|
||||
|
||||
@ -74,7 +74,6 @@ import Control.Monad.State (evalStateT, execStateT)
|
||||
import Control.Monad.Trans.Maybe
|
||||
import Control.Monad.State.Class (modify)
|
||||
import qualified Control.Monad.State.Class as State
|
||||
import Control.Monad.Trans.Writer.Lazy (censor)
|
||||
|
||||
import Data.Map ((!))
|
||||
import qualified Data.Map as Map
|
||||
@ -1277,22 +1276,22 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db
|
||||
_other -> False
|
||||
|
||||
genHeaders :: forall h. Cornice h _ _ (DBCell m x) -> SortableP h -> WriterT x m Widget
|
||||
genHeaders cornice SortableP{..} = execWriterT . go mempty $ annotate cornice
|
||||
genHeaders cornice SortableP{..} = fmap wrap' . execWriterT . go mempty $ annotate cornice
|
||||
where
|
||||
go :: forall (p' :: Pillar) r'.
|
||||
[(Int, Int, Int)]
|
||||
-> AnnotatedCornice (Maybe Int) h p' r' (DBCell m x)
|
||||
-> WriterT Widget (WriterT x m) ()
|
||||
go rowspanAcc (AnnotatedCorniceBase _ (Colonnade (toList -> v))) = censor wrap . forM_ (zip (inits v) v) $ \(before, OneColonnade Sized{..} _) -> do
|
||||
-> WriterT (Seq (Seq (Widget, Int))) (WriterT x m) ()
|
||||
go rowspanAcc (AnnotatedCorniceBase _ (Colonnade (toList -> v))) = mapWriterT (over (mapped . _2) pure) . forM_ (zip (inits v) v) $ \(before, OneColonnade Sized{..} _) -> do
|
||||
let (_, cellSize') = compCellSize rowspanAcc (map oneColonnadeHead before) Sized{..}
|
||||
whenIsJust cellSize' $ \cellSize -> tellM $ fromContent Sized { sizedSize = cellSize, sizedContent }
|
||||
whenIsJust cellSize' $ \cellSize -> tellM . fmap pure $ fromContent Sized { sizedSize = cellSize, sizedContent }
|
||||
go rowspanAcc (AnnotatedCorniceCap _ v@(toList -> oneCornices)) = do
|
||||
rowspanAcc' <- (execStateT ?? rowspanAcc) . hoist (censor wrap) . forM_ (zip (inits oneCornices) oneCornices) $ \(before, OneCornice h (size -> sz')) -> do
|
||||
rowspanAcc' <- (execStateT ?? rowspanAcc) . hoist (mapWriterT $ over (mapped . _2) pure) . forM_ (zip (inits oneCornices) oneCornices) $ \(before, OneCornice h (size -> sz')) -> do
|
||||
let sz = Sized sz' h
|
||||
let (beforeSize, cellSize') = compCellSize rowspanAcc (concatMap (map oneColonnadeHead . toList . getColonnade . uncapAnnotated . oneCorniceBody) before) sz
|
||||
whenIsJust cellSize' $ \cellSize -> do
|
||||
let Sized{..} = sz
|
||||
lift . tellM $ fromContent Sized { sizedSize = cellSize, sizedContent }
|
||||
lift . tellM . fmap pure $ fromContent Sized { sizedSize = cellSize, sizedContent }
|
||||
if | [n] <- mapMaybe (\(key, val) -> guardOnM (is _Rowspan key) $ readMay val) (toSortable sizedContent ^. _sortableContent . cellAttrs)
|
||||
-> State.modify $ (:) (n, beforeSize, cellSize)
|
||||
| otherwise -> return ()
|
||||
@ -1309,11 +1308,14 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db
|
||||
guard $ beforeSize < firstCol + sz
|
||||
return . Sum $ sz - (beforeSize - firstCol)
|
||||
|
||||
wrap :: Widget -> Widget
|
||||
wrap row = case dbsTemplate of
|
||||
wrap' :: Seq (Seq (Widget, Int)) -> Widget
|
||||
wrap' wRows = view _2 $ Foldable.foldl (\(stackHeight', acc) row -> (Nothing, (acc <>) . wrap stackHeight' $ foldOf (folded . _1) row)) (stackHeight, mempty) wRows
|
||||
where stackHeight = maximumOf (folded . to (ala Sum foldMap . fmap (view _2))) wRows
|
||||
wrap :: Maybe Int -> Widget -> Widget
|
||||
wrap stackHeight row = case dbsTemplate of
|
||||
DBSTCourse{} -> row
|
||||
DBSTDefault{} -> $(widgetFile "table/header")
|
||||
fromContent :: Sized Int h (DBCell m x) -> WriterT x m Widget
|
||||
fromContent :: Sized Int h (DBCell m x) -> WriterT x m (Widget, Int)
|
||||
fromContent Sized{ sizedSize = cellSize, sizedContent = toSortable -> Sortable{..} } = do
|
||||
widget <- sortableContent ^. cellContents
|
||||
let
|
||||
@ -1322,9 +1324,13 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db
|
||||
isSorted dir = fromMaybe False $ (==) <$> (SortingSetting <$> sortableKey <*> pure dir) <*> listToMaybe psSorting
|
||||
attrs = sortableContent ^. cellAttrs
|
||||
piSorting' = [ sSet | sSet <- fromMaybe [] piSorting, Just (sortKey sSet) /= sortableKey ]
|
||||
case dbsTemplate of
|
||||
DBSTCourse{} -> return $(widgetFile "table/course/header")
|
||||
DBSTDefault{} -> return $(widgetFile "table/cell/header")
|
||||
rowspan = preview _head $ do
|
||||
(key, val) <- attrs
|
||||
guard $ is _Rowspan key
|
||||
hoistMaybe $ readMay val
|
||||
return . (, fromMaybe 1 rowspan) $ case dbsTemplate of
|
||||
DBSTCourse{} -> $(widgetFile "table/course/header")
|
||||
DBSTDefault{} -> $(widgetFile "table/cell/header")
|
||||
in do
|
||||
wHeaders <- maybe (return Nothing) (fmap Just . genHeaders (dbtColonnade ^. _Cornice)) pSortable
|
||||
now <- liftIO getCurrentTime
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
$newline never
|
||||
<tr .table__row.table__row--head>
|
||||
$if numberColumn
|
||||
<th .table__th uw-hide-columns--no-hide .table__th--number>
|
||||
$maybe rowspan <- stackHeight
|
||||
$if numberColumn
|
||||
<th .table__th uw-hide-columns--no-hide .table__th--number :rowspan /= 1:rowspan=#{rowspan}>
|
||||
$# cell/header.hamlet
|
||||
^{row}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user