Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3f0f7c00
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f0f7c00
编写于
3月 26, 2018
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Count badge (#45589)
上级
61e1f7f7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
37 addition
and
10 deletion
+37
-10
src/vs/workbench/browser/parts/quickinput/quickInput.css
src/vs/workbench/browser/parts/quickinput/quickInput.css
+9
-0
src/vs/workbench/browser/parts/quickinput/quickInput.ts
src/vs/workbench/browser/parts/quickinput/quickInput.ts
+15
-4
src/vs/workbench/browser/parts/quickinput/quickInputCheckboxList.ts
...kbench/browser/parts/quickinput/quickInputCheckboxList.ts
+13
-6
未找到文件。
src/vs/workbench/browser/parts/quickinput/quickInput.css
浏览文件 @
3f0f7c00
...
...
@@ -27,6 +27,15 @@
margin-left
:
5px
;
}
.quick-input-count
{
align-self
:
center
;
margin-left
:
5px
;
}
.quick-input-count
.monaco-count-badge
{
vertical-align
:
middle
;
}
.quick-input-action
{
margin-left
:
6px
;
border
:
0
;
...
...
src/vs/workbench/browser/parts/quickinput/quickInput.ts
浏览文件 @
3f0f7c00
...
...
@@ -25,6 +25,8 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import
{
localize
}
from
'
vs/nls
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CLOSE_ON_FOCUS_LOST_CONFIG
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
CountBadge
}
from
'
vs/base/browser/ui/countBadge/countBadge
'
;
import
{
attachBadgeStyler
}
from
'
vs/platform/theme/common/styler
'
;
const
$
=
dom
.
$
;
...
...
@@ -39,6 +41,7 @@ export class QuickInputService extends Component implements IQuickInputService {
private
container
:
HTMLElement
;
private
selectAll
:
HTMLInputElement
;
private
inputBox
:
QuickInputBox
;
private
count
:
CountBadge
;
private
checkboxList
:
QuickInputCheckboxList
;
private
resolve
:
(
value
?:
object
[]
|
Thenable
<
object
[]
>
)
=>
void
;
...
...
@@ -68,7 +71,7 @@ export class QuickInputService extends Component implements IQuickInputService {
this
.
selectAll
.
type
=
'
checkbox
'
;
this
.
toUnbind
.
push
(
dom
.
addStandardDisposableListener
(
this
.
selectAll
,
dom
.
EventType
.
CHANGE
,
e
=>
{
const
checked
=
this
.
selectAll
.
checked
;
this
.
checkboxList
.
setAllSelected
(
checked
);
this
.
checkboxList
.
setAll
Visible
Selected
(
checked
);
}));
this
.
inputBox
=
new
QuickInputBox
(
headerContainer
);
...
...
@@ -103,10 +106,17 @@ export class QuickInputService extends Component implements IQuickInputService {
ok
.
textContent
=
localize
(
'
ok
'
,
"
OK
"
);
this
.
toUnbind
.
push
(
dom
.
addDisposableListener
(
ok
,
dom
.
EventType
.
CLICK
,
e
=>
this
.
close
(
true
)));
const
badgeContainer
=
dom
.
append
(
headerContainer
,
$
(
'
.quick-input-count
'
));
this
.
count
=
new
CountBadge
(
badgeContainer
);
this
.
toUnbind
.
push
(
attachBadgeStyler
(
this
.
count
,
this
.
themeService
));
this
.
checkboxList
=
this
.
instantiationService
.
createInstance
(
QuickInputCheckboxList
,
this
.
container
);
this
.
toUnbind
.
push
(
this
.
checkboxList
);
this
.
toUnbind
.
push
(
this
.
checkboxList
.
onAllSelectedChanged
(()
=>
{
this
.
selectAll
.
checked
=
this
.
checkboxList
.
getAllSelected
();
this
.
toUnbind
.
push
(
this
.
checkboxList
.
onAllVisibleSelectedChanged
(
allSelected
=>
{
this
.
selectAll
.
checked
=
allSelected
;
}));
this
.
toUnbind
.
push
(
this
.
checkboxList
.
onSelectedCountChanged
(
count
=>
{
this
.
count
.
setCount
(
count
);
}));
this
.
toUnbind
.
push
(
dom
.
addDisposableListener
(
this
.
container
,
'
focusout
'
,
(
e
:
FocusEvent
)
=>
{
...
...
@@ -161,7 +171,8 @@ export class QuickInputService extends Component implements IQuickInputService {
this
.
inputBox
.
setPlaceholder
(
options
.
placeHolder
?
localize
(
'
quickInput.ctrlSpaceToSelectWithPlaceholder
'
,
"
{1} ({0} to toggle)
"
,
'
Ctrl+Space
'
,
options
.
placeHolder
)
:
localize
(
'
quickInput.ctrlSpaceToSelect
'
,
"
{0} to toggle
"
,
'
Ctrl+Space
'
));
// TODO: Progress indication.
this
.
checkboxList
.
setElements
(
await
picks
);
this
.
selectAll
.
checked
=
this
.
checkboxList
.
getAllSelected
();
this
.
selectAll
.
checked
=
this
.
checkboxList
.
getAllVisibleSelected
();
this
.
count
.
setCount
(
this
.
checkboxList
.
getSelectedCount
());
this
.
container
.
style
.
display
=
null
;
this
.
updateLayout
();
...
...
src/vs/workbench/browser/parts/quickinput/quickInputCheckboxList.ts
浏览文件 @
3f0f7c00
...
...
@@ -143,8 +143,10 @@ export class QuickInputCheckboxList {
private
container
:
HTMLElement
;
private
list
:
WorkbenchList
<
SelectableElement
>
;
private
elements
:
SelectableElement
[]
=
[];
private
_onAllSelectedChanged
=
new
Emitter
<
boolean
>
();
// TODO: Debounce
onAllSelectedChanged
:
Event
<
boolean
>
=
this
.
_onAllSelectedChanged
.
event
;
private
_onAllVisibleSelectedChanged
=
new
Emitter
<
boolean
>
();
// TODO: Debounce
onAllVisibleSelectedChanged
:
Event
<
boolean
>
=
this
.
_onAllVisibleSelectedChanged
.
event
;
private
_onSelectedCountChanged
=
new
Emitter
<
number
>
();
// TODO: Debounce
onSelectedCountChanged
:
Event
<
number
>
=
this
.
_onSelectedCountChanged
.
event
;
private
elementDisposables
:
IDisposable
[]
=
[];
private
disposables
:
IDisposable
[]
=
[];
...
...
@@ -167,11 +169,15 @@ export class QuickInputCheckboxList {
}));
}
getAllSelected
()
{
getAll
Visible
Selected
()
{
return
!
this
.
elements
.
some
(
element
=>
!
element
.
hidden
&&
!
element
.
selected
);
}
setAllSelected
(
select
:
boolean
)
{
getSelectedCount
()
{
return
this
.
getSelectedElements
().
length
;
}
setAllVisibleSelected
(
select
:
boolean
)
{
this
.
elements
.
forEach
(
element
=>
{
if
(
!
element
.
hidden
)
{
element
.
selected
=
select
;
...
...
@@ -187,7 +193,8 @@ export class QuickInputCheckboxList {
selected
:
!!
item
.
selected
}));
this
.
elementDisposables
.
push
(...
this
.
elements
.
map
(
element
=>
element
.
onSelected
(()
=>
{
this
.
_onAllSelectedChanged
.
fire
(
this
.
getAllSelected
());
this
.
_onAllVisibleSelectedChanged
.
fire
(
this
.
getAllVisibleSelected
());
this
.
_onSelectedCountChanged
.
fire
(
this
.
getSelectedCount
());
})));
this
.
list
.
splice
(
0
,
this
.
list
.
length
,
this
.
elements
);
this
.
list
.
setSelection
([]);
...
...
@@ -255,7 +262,7 @@ export class QuickInputCheckboxList {
this
.
list
.
focusFirst
();
this
.
list
.
layout
();
this
.
_onAll
SelectedChanged
.
fire
(
this
.
getAll
Selected
());
this
.
_onAll
VisibleSelectedChanged
.
fire
(
this
.
getAllVisible
Selected
());
}
toggleCheckbox
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录