提交 07e43687 编写于 作者: J Joao Moreno

data tree: use proper loading

上级 f8e9f80d
...@@ -151,16 +151,12 @@ class TreeRenderer<T, TFilterData, TTemplateData> implements IListRenderer<ITree ...@@ -151,16 +151,12 @@ class TreeRenderer<T, TFilterData, TTemplateData> implements IListRenderer<ITree
} }
private renderTwistie(node: ITreeNode<T, TFilterData>, twistieElement: HTMLElement) { private renderTwistie(node: ITreeNode<T, TFilterData>, twistieElement: HTMLElement) {
if (this.renderer.renderTwistie && this.renderer.renderTwistie(node.element, twistieElement)) { if (this.renderer.renderTwistie) {
return; this.renderer.renderTwistie(node.element, twistieElement);
} }
TreeRenderer.renderDefaultTwistie(node, twistieElement); toggleClass(twistieElement, 'collapsible', node.collapsible);
} toggleClass(twistieElement, 'collapsed', node.collapsed);
private static renderDefaultTwistie<T>(node: ITreeNode<T, any>, twistie: HTMLElement): void {
toggleClass(twistie, 'collapsible', node.collapsible);
toggleClass(twistie, 'collapsed', node.collapsed);
} }
dispose(): void { dispose(): void {
......
...@@ -12,6 +12,7 @@ import { Emitter, Event, mapEvent } from 'vs/base/common/event'; ...@@ -12,6 +12,7 @@ import { Emitter, Event, mapEvent } from 'vs/base/common/event';
import { timeout, always } from 'vs/base/common/async'; import { timeout, always } from 'vs/base/common/async';
import { ISequence } from 'vs/base/common/iterator'; import { ISequence } from 'vs/base/common/iterator';
import { IListStyles } from 'vs/base/browser/ui/list/listWidget'; import { IListStyles } from 'vs/base/browser/ui/list/listWidget';
import { toggleClass } from 'vs/base/browser/dom';
export interface IDataSource<T extends NonNullable<any>> { export interface IDataSource<T extends NonNullable<any>> {
hasChildren(element: T | null): boolean; hasChildren(element: T | null): boolean;
...@@ -72,11 +73,7 @@ class DataTreeRenderer<T, TFilterData, TTemplateData> implements ITreeRenderer<I ...@@ -72,11 +73,7 @@ class DataTreeRenderer<T, TFilterData, TTemplateData> implements ITreeRenderer<I
} }
renderTwistie(element: IDataTreeNode<T>, twistieElement: HTMLElement): boolean { renderTwistie(element: IDataTreeNode<T>, twistieElement: HTMLElement): boolean {
if (element.state === DataTreeNodeState.Slow) { toggleClass(twistieElement, 'loading', element.state === DataTreeNodeState.Slow);
twistieElement.innerText = '🤨';
return true;
}
return false; return false;
} }
......
<?xml version='1.0' standalone='no' ?>
<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='10px' height='10px'>
<style>
circle {
animation: ball 0.6s linear infinite;
}
circle:nth-child(2) { animation-delay: 0.075s; }
circle:nth-child(3) { animation-delay: 0.15s; }
circle:nth-child(4) { animation-delay: 0.225s; }
circle:nth-child(5) { animation-delay: 0.3s; }
circle:nth-child(6) { animation-delay: 0.375s; }
circle:nth-child(7) { animation-delay: 0.45s; }
circle:nth-child(8) { animation-delay: 0.525s; }
@keyframes ball {
from { opacity: 1; }
to { opacity: 0.3; }
}
</style>
<g style="fill:grey;">
<circle cx='5' cy='1' r='1' style='opacity:0.3;' />
<circle cx='7.8284' cy='2.1716' r='1' style='opacity:0.3;' />
<circle cx='9' cy='5' r='1' style='opacity:0.3;' />
<circle cx='7.8284' cy='7.8284' r='1' style='opacity:0.3;' />
<circle cx='5' cy='9' r='1' style='opacity:0.3;' />
<circle cx='2.1716' cy='7.8284' r='1' style='opacity:0.3;' />
<circle cx='1' cy='5' r='1' style='opacity:0.3;' />
<circle cx='2.1716' cy='2.1716' r='1' style='opacity:0.3;' />
</g>
</svg>
<?xml version='1.0' standalone='no' ?>
<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='10px' height='10px'>
<style>
circle {
animation: ball 0.6s linear infinite;
}
circle:nth-child(2) { animation-delay: 0.075s; }
circle:nth-child(3) { animation-delay: 0.15s; }
circle:nth-child(4) { animation-delay: 0.225s; }
circle:nth-child(5) { animation-delay: 0.3s; }
circle:nth-child(6) { animation-delay: 0.375s; }
circle:nth-child(7) { animation-delay: 0.45s; }
circle:nth-child(8) { animation-delay: 0.525s; }
@keyframes ball {
from { opacity: 1; }
to { opacity: 0.3; }
}
</style>
<g style="fill:white;">
<circle cx='5' cy='1' r='1' style='opacity:0.3;' />
<circle cx='7.8284' cy='2.1716' r='1' style='opacity:0.3;' />
<circle cx='9' cy='5' r='1' style='opacity:0.3;' />
<circle cx='7.8284' cy='7.8284' r='1' style='opacity:0.3;' />
<circle cx='5' cy='9' r='1' style='opacity:0.3;' />
<circle cx='2.1716' cy='7.8284' r='1' style='opacity:0.3;' />
<circle cx='1' cy='5' r='1' style='opacity:0.3;' />
<circle cx='2.1716' cy='2.1716' r='1' style='opacity:0.3;' />
</g>
</svg>
<?xml version='1.0' standalone='no' ?>
<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='10px' height='10px'>
<style>
circle {
animation: ball 0.6s linear infinite;
}
circle:nth-child(2) { animation-delay: 0.075s; }
circle:nth-child(3) { animation-delay: 0.15s; }
circle:nth-child(4) { animation-delay: 0.225s; }
circle:nth-child(5) { animation-delay: 0.3s; }
circle:nth-child(6) { animation-delay: 0.375s; }
circle:nth-child(7) { animation-delay: 0.45s; }
circle:nth-child(8) { animation-delay: 0.525s; }
@keyframes ball {
from { opacity: 1; }
to { opacity: 0.3; }
}
</style>
<g>
<circle cx='5' cy='1' r='1' style='opacity:0.3;' />
<circle cx='7.8284' cy='2.1716' r='1' style='opacity:0.3;' />
<circle cx='9' cy='5' r='1' style='opacity:0.3;' />
<circle cx='7.8284' cy='7.8284' r='1' style='opacity:0.3;' />
<circle cx='5' cy='9' r='1' style='opacity:0.3;' />
<circle cx='2.1716' cy='7.8284' r='1' style='opacity:0.3;' />
<circle cx='1' cy='5' r='1' style='opacity:0.3;' />
<circle cx='2.1716' cy='2.1716' r='1' style='opacity:0.3;' />
</g>
</svg>
...@@ -51,4 +51,16 @@ ...@@ -51,4 +51,16 @@
.hc-black .monaco-tl-twistie.collapsible.collapsed { .hc-black .monaco-tl-twistie.collapsible.collapsed {
background-image: url("collapsed-hc.svg"); background-image: url("collapsed-hc.svg");
}
.monaco-tl-twistie.loading {
background-image: url("loading.svg");
}
.vs-dark .monaco-tl-twistie.loading {
background-image: url("loading-dark.svg");
}
.hc-black .monaco-tl-twistie.loading {
background-image: url("loading-hc.svg");
} }
\ No newline at end of file
...@@ -107,7 +107,7 @@ export interface ITreeModel<T, TFilterData, TRef> { ...@@ -107,7 +107,7 @@ export interface ITreeModel<T, TFilterData, TRef> {
} }
export interface ITreeRenderer<T, TFilterData, TTemplateData> extends IListRenderer<ITreeNode<T, TFilterData>, TTemplateData> { export interface ITreeRenderer<T, TFilterData, TTemplateData> extends IListRenderer<ITreeNode<T, TFilterData>, TTemplateData> {
renderTwistie?(element: T, twistieElement: HTMLElement): boolean; renderTwistie?(element: T, twistieElement: HTMLElement): void;
onDidChangeTwistieState?: Event<T>; onDidChangeTwistieState?: Event<T>;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册