提交 7d12ce55 编写于 作者: R rebornix

list view set row height option

上级 612a935c
......@@ -53,6 +53,7 @@ export interface IListViewOptions<T> {
readonly useShadows?: boolean;
readonly verticalScrollMode?: ScrollbarVisibility;
readonly setRowLineHeight?: boolean;
readonly setRowHeight?: boolean;
readonly supportDynamicHeights?: boolean;
readonly mouseSupport?: boolean;
readonly horizontalScrolling?: boolean;
......@@ -64,6 +65,7 @@ const DefaultOptions = {
useShadows: true,
verticalScrollMode: ScrollbarVisibility.Auto,
setRowLineHeight: true,
setRowHeight: true,
supportDynamicHeights: false,
dnd: {
getDragElements<T>(e: T) { return [e]; },
......@@ -175,6 +177,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
private dragOverAnimationStopDisposable: IDisposable = Disposable.None;
private dragOverMouseY: number = 0;
private setRowLineHeight: boolean;
private setRowHeight: boolean;
private supportDynamicHeights: boolean;
private horizontalScrolling: boolean;
private additionalScrollHeight: number;
......@@ -275,6 +278,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
domEvent(window, 'dragend')(this.onDragEnd, this, this.disposables);
this.setRowLineHeight = getOrDefault(options, o => o.setRowLineHeight, DefaultOptions.setRowLineHeight);
this.setRowHeight = getOrDefault(options, o => o.setRowHeight, DefaultOptions.setRowHeight);
this.supportDynamicHeights = getOrDefault(options, o => o.supportDynamicHeights, DefaultOptions.supportDynamicHeights);
this.dnd = getOrDefault<IListViewOptions<T>, IListViewDragAndDrop<T>>(options, o => o.dnd, DefaultOptions.dnd);
......@@ -670,7 +674,9 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
private updateItemInDOM(item: IItem<T>, index: number): void {
item.row!.domNode!.style.top = `${this.elementTop(index)}px`;
// item.row!.domNode!.style.height = `${item.size}px`;
if (this.setRowHeight) {
item.row!.domNode!.style.height = `${item.size}px`;
}
if (this.setRowLineHeight) {
item.row!.domNode!.style.lineHeight = `${item.size}px`;
......
......@@ -852,6 +852,7 @@ export interface IListOptions<T> {
readonly useShadows?: boolean;
readonly verticalScrollMode?: ScrollbarVisibility;
readonly setRowLineHeight?: boolean;
readonly setRowHeight?: boolean;
readonly supportDynamicHeights?: boolean;
readonly mouseSupport?: boolean;
readonly horizontalScrolling?: boolean;
......
......@@ -138,6 +138,7 @@ export class NotebookEditor extends BaseEditor implements NotebookHandler {
renders,
{
setRowLineHeight: false,
setRowHeight: false,
supportDynamicHeights: true,
horizontalScrolling: false,
keyboardSupport: false,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册