-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from lineupjs/sgratzl/frozenshift
fix shifting of frozen columns
- Loading branch information
Showing
8 changed files
with
712 additions
and
622 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head lang="en"> | ||
<meta charset="UTF-8" /> | ||
<title>Engine test</title> | ||
<link href="./frozen.css" rel="stylesheet" /> | ||
<style> | ||
.lineup-engine { | ||
height: 90vh; | ||
max-width: 100vw; | ||
} | ||
.le-tr { | ||
margin-top: 2px; | ||
} | ||
.le-frozen { | ||
background: red !important; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<script src="./frozen.js"></script> | ||
<div></div> | ||
<script> | ||
(function () { | ||
const test = new lineupengine.default(document.querySelector('div'), 'asdf'); | ||
|
||
test.run(); | ||
})(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* eslint-disable class-methods-use-this */ | ||
import { ACellRenderer, ICellRenderContext, PrefetchMixin, uniformContext, nonUniformContext } from '../src'; | ||
import Column from './column'; | ||
|
||
/** @internal */ | ||
export default class TestRenderer extends ACellRenderer<Column<number>> { | ||
protected readonly privateContext: ICellRenderContext<Column<number>>; | ||
|
||
constructor(root: HTMLElement, id: string, numberOfRows = 1000, numberOfColumns = 15) { | ||
super(root, `#${id}`, { mixins: [], striped: true }); | ||
// eslint-disable-next-line no-param-reassign | ||
root.id = id; | ||
|
||
const defaultRowHeight = 20; | ||
|
||
const columns: Column<number>[] = []; | ||
for (let i = 0; i < numberOfColumns; i += 1) { | ||
columns.push(new Column(i, i.toString(36), i < 2, i > 3 ? 500 : 100)); | ||
} | ||
this.privateContext = { | ||
columns, | ||
column: nonUniformContext( | ||
columns.map((d) => d.width), | ||
100 | ||
), | ||
...uniformContext(numberOfRows, defaultRowHeight), | ||
}; | ||
} | ||
|
||
protected createHeader(doc: Document, column: Column<number>): HTMLElement { | ||
return column.header(doc); | ||
} | ||
|
||
protected updateHeader(): void { | ||
// nothing do to | ||
} | ||
|
||
protected createCell(doc: Document, index: number, column: Column<number>): HTMLElement { | ||
return column.cell(index, doc); | ||
} | ||
|
||
protected updateCell(node: HTMLElement, index: number, column: Column<number>): HTMLElement { | ||
return column.update(node, index); | ||
} | ||
|
||
run(): void { | ||
// wait till layouted | ||
setTimeout(super.init.bind(this), 100); | ||
} | ||
|
||
protected get context(): ICellRenderContext<Column<number>> { | ||
return this.privateContext; | ||
} | ||
|
||
// protected updateRow(node: HTMLElement, index: number) { | ||
// // return abortAble(resolveIn(2000)).then(() => { | ||
// super.updateRow(node, index); | ||
// // }); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.