Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
faf223aa
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,发现更多精彩内容 >>
提交
faf223aa
编写于
1月 14, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some linting and import polish
上级
542d6738
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
188 addition
and
196 deletion
+188
-196
src/vs/base/browser/ui/actionbar/actionbar.ts
src/vs/base/browser/ui/actionbar/actionbar.ts
+140
-142
src/vs/base/browser/ui/button/button.ts
src/vs/base/browser/ui/button/button.ts
+5
-7
src/vs/base/browser/ui/checkbox/checkbox.ts
src/vs/base/browser/ui/checkbox/checkbox.ts
+3
-3
src/vs/base/browser/ui/countBadge/countBadge.ts
src/vs/base/browser/ui/countBadge/countBadge.ts
+5
-7
src/vs/base/browser/ui/toolbar/toolbar.ts
src/vs/base/browser/ui/toolbar/toolbar.ts
+35
-37
未找到文件。
src/vs/base/browser/ui/actionbar/actionbar.ts
浏览文件 @
faf223aa
此差异已折叠。
点击以展开。
src/vs/base/browser/ui/button/button.ts
浏览文件 @
faf223aa
...
@@ -6,17 +6,15 @@
...
@@ -6,17 +6,15 @@
'
use strict
'
;
'
use strict
'
;
import
'
vs/css!./button
'
;
import
'
vs/css!./button
'
;
import
EventEmitter
=
require
(
'
vs/base/common/eventEmitter
'
)
;
import
{
EventEmitter
}
from
'
vs/base/common/eventEmitter
'
;
import
DOM
=
require
(
'
vs/base/browser/dom
'
);
import
DOM
=
require
(
'
vs/base/browser/dom
'
);
import
Builder
=
require
(
'
vs/base/browser/builder
'
)
;
import
{
Builder
,
$
}
from
'
vs/base/browser/builder
'
;
var
$
=
Builder
.
$
;
export
class
Button
extends
EventEmitter
{
export
class
Button
extends
EventEmitter
.
EventEmitter
{
private
$el
:
Builder
;
private
$el
:
Builder
.
Builder
;
constructor
(
container
:
Builder
);
constructor
(
container
:
Builder
.
Builder
);
constructor
(
container
:
HTMLElement
);
constructor
(
container
:
HTMLElement
);
constructor
(
container
:
any
)
{
constructor
(
container
:
any
)
{
super
();
super
();
...
...
src/vs/base/browser/ui/checkbox/checkbox.ts
浏览文件 @
faf223aa
...
@@ -17,7 +17,7 @@ export interface ICheckboxOpts {
...
@@ -17,7 +17,7 @@ export interface ICheckboxOpts {
title
:
string
;
title
:
string
;
isChecked
:
boolean
;
isChecked
:
boolean
;
onChange
:
()
=>
void
;
onChange
:
()
=>
void
;
onKeyDown
?:
(
e
:
StandardKeyboardEvent
)
=>
void
;
onKeyDown
?:
(
e
:
StandardKeyboardEvent
)
=>
void
;
}
}
export
class
Checkbox
extends
Widget
{
export
class
Checkbox
extends
Widget
{
...
@@ -27,7 +27,7 @@ export class Checkbox extends Widget {
...
@@ -27,7 +27,7 @@ export class Checkbox extends Widget {
private
_checked
:
boolean
;
private
_checked
:
boolean
;
constructor
(
opts
:
ICheckboxOpts
)
{
constructor
(
opts
:
ICheckboxOpts
)
{
super
();
super
();
this
.
_opts
=
opts
;
this
.
_opts
=
opts
;
this
.
_checked
=
this
.
_opts
.
isChecked
;
this
.
_checked
=
this
.
_opts
.
isChecked
;
...
@@ -70,7 +70,7 @@ export class Checkbox extends Widget {
...
@@ -70,7 +70,7 @@ export class Checkbox extends Widget {
return
this
.
_checked
;
return
this
.
_checked
;
}
}
public
set
checked
(
newIsChecked
:
boolean
)
{
public
set
checked
(
newIsChecked
:
boolean
)
{
this
.
_checked
=
newIsChecked
;
this
.
_checked
=
newIsChecked
;
this
.
domNode
.
setAttribute
(
'
aria-checked
'
,
String
(
this
.
_checked
));
this
.
domNode
.
setAttribute
(
'
aria-checked
'
,
String
(
this
.
_checked
));
this
.
domNode
.
className
=
this
.
_className
();
this
.
domNode
.
className
=
this
.
_className
();
...
...
src/vs/base/browser/ui/countBadge/countBadge.ts
浏览文件 @
faf223aa
...
@@ -6,18 +6,16 @@
...
@@ -6,18 +6,16 @@
'
use strict
'
;
'
use strict
'
;
import
'
vs/css!./countBadge
'
;
import
'
vs/css!./countBadge
'
;
import
Builder
=
require
(
'
vs/base/browser/builder
'
);
import
{
Builder
,
$
}
from
'
vs/base/browser/builder
'
;
import
Strings
=
require
(
'
vs/base/common/strings
'
);
import
strings
=
require
(
'
vs/base/common/strings
'
);
const
$
=
Builder
.
$
;
export
class
CountBadge
{
export
class
CountBadge
{
private
$el
:
Builder
.
Builder
;
private
$el
:
Builder
;
private
count
:
number
;
private
count
:
number
;
private
titleFormat
:
string
;
private
titleFormat
:
string
;
constructor
(
container
:
Builder
.
Builder
,
count
?:
number
,
titleFormat
?:
string
);
constructor
(
container
:
Builder
,
count
?:
number
,
titleFormat
?:
string
);
constructor
(
container
:
HTMLElement
,
count
?:
number
,
titleFormat
?:
string
);
constructor
(
container
:
HTMLElement
,
count
?:
number
,
titleFormat
?:
string
);
constructor
(
container
:
any
,
count
?:
number
,
titleFormat
?:
string
)
{
constructor
(
container
:
any
,
count
?:
number
,
titleFormat
?:
string
)
{
this
.
$el
=
$
(
'
.monaco-count-badge
'
).
appendTo
(
container
);
this
.
$el
=
$
(
'
.monaco-count-badge
'
).
appendTo
(
container
);
...
@@ -37,7 +35,7 @@ export class CountBadge {
...
@@ -37,7 +35,7 @@ export class CountBadge {
private
render
()
{
private
render
()
{
this
.
$el
.
text
(
''
+
this
.
count
);
this
.
$el
.
text
(
''
+
this
.
count
);
this
.
$el
.
title
(
S
trings
.
format
(
this
.
titleFormat
,
this
.
count
));
this
.
$el
.
title
(
s
trings
.
format
(
this
.
titleFormat
,
this
.
count
));
}
}
public
dispose
()
{
public
dispose
()
{
...
...
src/vs/base/browser/ui/toolbar/toolbar.ts
浏览文件 @
faf223aa
...
@@ -7,21 +7,19 @@
...
@@ -7,21 +7,19 @@
import
'
vs/css!./toolbar
'
;
import
'
vs/css!./toolbar
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
nls
=
require
(
'
vs/nls
'
);
import
Lifecycle
=
require
(
'
vs/base/common/lifecycle
'
);
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
Builder
=
require
(
'
vs/base/browser/builder
'
);
import
{
Builder
,
$
}
from
'
vs/base/browser/builder
'
;
import
Types
=
require
(
'
vs/base/common/types
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
import
Actions
=
require
(
'
vs/base/common/actions
'
);
import
{
Action
,
IActionRunner
,
IAction
}
from
'
vs/base/common/actions
'
;
import
ActionBar
=
require
(
'
vs/base/browser/ui/actionbar/actionbar
'
);
import
{
ActionBar
,
ActionsOrientation
,
IActionItemProvider
,
BaseActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
Dropdown
=
require
(
'
vs/base/browser/ui/dropdown/dropdown
'
);
import
{
IContextMenuProvider
,
DropdownMenu
,
IActionProvider
,
ILabelRenderer
,
IDropdownMenuOptions
}
from
'
vs/base/browser/ui/dropdown/dropdown
'
;
import
EventEmitter
=
require
(
'
vs/base/common/eventEmitter
'
);
import
{
ListenerUnbind
}
from
'
vs/base/common/eventEmitter
'
;
var
$
=
<
Builder
.
QuickBuilder
>
Builder
.
$
;
export
var
CONTEXT
=
'
context.toolbar
'
;
export
var
CONTEXT
=
'
context.toolbar
'
;
export
interface
IToolBarOptions
{
export
interface
IToolBarOptions
{
orientation
?:
Action
Bar
.
Action
sOrientation
;
orientation
?:
ActionsOrientation
;
actionItemProvider
?:
ActionBar
.
IActionItemProvider
;
actionItemProvider
?:
IActionItemProvider
;
}
}
/**
/**
...
@@ -29,12 +27,12 @@ export interface IToolBarOptions {
...
@@ -29,12 +27,12 @@ export interface IToolBarOptions {
*/
*/
export
class
ToolBar
{
export
class
ToolBar
{
private
options
:
IToolBarOptions
;
private
options
:
IToolBarOptions
;
private
actionBar
:
ActionBar
.
ActionBar
;
private
actionBar
:
ActionBar
;
private
toggleMenuAction
:
ToggleMenuAction
;
private
toggleMenuAction
:
ToggleMenuAction
;
private
toggleMenuActionItem
:
DropdownMenuActionItem
;
private
toggleMenuActionItem
:
DropdownMenuActionItem
;
private
hasSecondaryActions
:
boolean
;
private
hasSecondaryActions
:
boolean
;
constructor
(
container
:
HTMLElement
,
contextMenuProvider
:
Dropdown
.
IContextMenuProvider
,
options
:
IToolBarOptions
=
{
orientation
:
ActionBar
.
ActionsOrientation
.
HORIZONTAL
})
{
constructor
(
container
:
HTMLElement
,
contextMenuProvider
:
IContextMenuProvider
,
options
:
IToolBarOptions
=
{
orientation
:
ActionsOrientation
.
HORIZONTAL
})
{
this
.
options
=
options
;
this
.
options
=
options
;
this
.
toggleMenuAction
=
new
ToggleMenuAction
();
this
.
toggleMenuAction
=
new
ToggleMenuAction
();
...
@@ -42,9 +40,9 @@ export class ToolBar {
...
@@ -42,9 +40,9 @@ export class ToolBar {
element
.
className
=
'
monaco-toolbar
'
;
element
.
className
=
'
monaco-toolbar
'
;
container
.
appendChild
(
element
);
container
.
appendChild
(
element
);
this
.
actionBar
=
new
ActionBar
.
ActionBar
(
$
(
element
),
{
this
.
actionBar
=
new
ActionBar
(
$
(
element
),
{
orientation
:
options
.
orientation
,
orientation
:
options
.
orientation
,
actionItemProvider
:
(
action
:
Action
s
.
Action
)
=>
{
actionItemProvider
:
(
action
:
Action
)
=>
{
// Return special action item for the toggle menu action
// Return special action item for the toggle menu action
if
(
action
.
id
===
ToggleMenuAction
.
ID
)
{
if
(
action
.
id
===
ToggleMenuAction
.
ID
)
{
...
@@ -60,7 +58,7 @@ export class ToolBar {
...
@@ -60,7 +58,7 @@ export class ToolBar {
(
<
ToggleMenuAction
>
action
).
menuActions
,
(
<
ToggleMenuAction
>
action
).
menuActions
,
contextMenuProvider
,
contextMenuProvider
,
this
.
options
.
actionItemProvider
,
this
.
options
.
actionItemProvider
,
this
.
options
.
orientation
===
Action
Bar
.
Action
sOrientation
.
HORIZONTAL
,
this
.
options
.
orientation
===
ActionsOrientation
.
HORIZONTAL
,
this
.
actionRunner
,
this
.
actionRunner
,
'
toolbar-toggle-more
'
'
toolbar-toggle-more
'
);
);
...
@@ -73,19 +71,19 @@ export class ToolBar {
...
@@ -73,19 +71,19 @@ export class ToolBar {
});
});
}
}
public
set
actionRunner
(
actionRunner
:
Actions
.
IActionRunner
)
{
public
set
actionRunner
(
actionRunner
:
IActionRunner
)
{
this
.
actionBar
.
actionRunner
=
actionRunner
;
this
.
actionBar
.
actionRunner
=
actionRunner
;
}
}
public
get
actionRunner
():
Actions
.
IActionRunner
{
public
get
actionRunner
():
IActionRunner
{
return
this
.
actionBar
.
actionRunner
;
return
this
.
actionBar
.
actionRunner
;
}
}
public
getContainer
():
Builder
.
Builder
{
public
getContainer
():
Builder
{
return
this
.
actionBar
.
getContainer
();
return
this
.
actionBar
.
getContainer
();
}
}
public
setActions
(
primaryActions
:
Actions
.
IAction
[],
secondaryActions
?:
Actions
.
IAction
[]):
()
=>
void
{
public
setActions
(
primaryActions
:
IAction
[],
secondaryActions
?:
IAction
[]):
()
=>
void
{
return
()
=>
{
return
()
=>
{
var
primaryActionsToSet
=
primaryActions
?
primaryActions
.
slice
(
0
)
:
[];
var
primaryActionsToSet
=
primaryActions
?
primaryActions
.
slice
(
0
)
:
[];
...
@@ -101,7 +99,7 @@ export class ToolBar {
...
@@ -101,7 +99,7 @@ export class ToolBar {
};
};
}
}
public
addPrimaryAction
(
primaryActions
:
Actions
.
IAction
):
()
=>
void
{
public
addPrimaryAction
(
primaryActions
:
IAction
):
()
=>
void
{
return
()
=>
{
return
()
=>
{
// Add after the "..." action if we have secondary actions
// Add after the "..." action if we have secondary actions
...
@@ -127,11 +125,11 @@ export class ToolBar {
...
@@ -127,11 +125,11 @@ export class ToolBar {
}
}
}
}
class
ToggleMenuAction
extends
Action
s
.
Action
{
class
ToggleMenuAction
extends
Action
{
public
static
ID
=
'
toolbar.toggle.more
'
;
public
static
ID
=
'
toolbar.toggle.more
'
;
private
_menuActions
:
Actions
.
IAction
[];
private
_menuActions
:
IAction
[];
constructor
()
{
constructor
()
{
super
(
ToggleMenuAction
.
ID
,
nls
.
localize
(
'
more
'
,
"
More
"
),
null
,
true
);
super
(
ToggleMenuAction
.
ID
,
nls
.
localize
(
'
more
'
,
"
More
"
),
null
,
true
);
...
@@ -141,24 +139,24 @@ class ToggleMenuAction extends Actions.Action {
...
@@ -141,24 +139,24 @@ class ToggleMenuAction extends Actions.Action {
return
this
.
_menuActions
;
return
this
.
_menuActions
;
}
}
public
set
menuActions
(
actions
:
Actions
.
IAction
[])
{
public
set
menuActions
(
actions
:
IAction
[])
{
this
.
_menuActions
=
actions
;
this
.
_menuActions
=
actions
;
}
}
}
}
export
class
DropdownMenuActionItem
extends
ActionBar
.
BaseActionItem
{
export
class
DropdownMenuActionItem
extends
BaseActionItem
{
private
menuActionsOrProvider
:
any
;
private
menuActionsOrProvider
:
any
;
private
animateClick
:
boolean
;
private
animateClick
:
boolean
;
private
dropdownMenu
:
Dropdown
.
Dropdown
Menu
;
private
dropdownMenu
:
DropdownMenu
;
private
toUnbind
:
EventEmitter
.
ListenerUnbind
;
private
toUnbind
:
ListenerUnbind
;
private
contextMenuProvider
:
Dropdown
.
IContextMenuProvider
;
private
contextMenuProvider
:
IContextMenuProvider
;
private
actionItemProvider
:
ActionBar
.
IActionItemProvider
;
private
actionItemProvider
:
IActionItemProvider
;
private
clazz
:
string
;
private
clazz
:
string
;
constructor
(
action
:
Actions
.
IAction
,
menuActions
:
Actions
.
IAction
[],
contextMenuProvider
:
Dropdown
.
IContextMenuProvider
,
actionItemProvider
:
ActionBar
.
IActionItemProvider
,
animateClick
:
boolean
,
actionRunner
:
Actions
.
IActionRunner
,
clazz
:
string
);
constructor
(
action
:
IAction
,
menuActions
:
IAction
[],
contextMenuProvider
:
IContextMenuProvider
,
actionItemProvider
:
IActionItemProvider
,
animateClick
:
boolean
,
actionRunner
:
IActionRunner
,
clazz
:
string
);
constructor
(
action
:
Actions
.
IAction
,
actionProvider
:
Dropdown
.
IActionProvider
,
contextMenuProvider
:
Dropdown
.
IContextMenuProvider
,
actionItemProvider
:
ActionBar
.
IActionItemProvider
,
animateClick
:
boolean
,
actionRunner
:
Actions
.
IActionRunner
,
clazz
:
string
);
constructor
(
action
:
IAction
,
actionProvider
:
IActionProvider
,
contextMenuProvider
:
IContextMenuProvider
,
actionItemProvider
:
IActionItemProvider
,
animateClick
:
boolean
,
actionRunner
:
IActionRunner
,
clazz
:
string
);
constructor
(
action
:
Actions
.
IAction
,
menuActionsOrProvider
:
any
,
contextMenuProvider
:
Dropdown
.
IContextMenuProvider
,
actionItemProvider
:
ActionBar
.
IActionItemProvider
,
animateClick
:
boolean
,
actionRunner
:
Actions
.
IActionRunner
,
clazz
:
string
)
{
constructor
(
action
:
IAction
,
menuActionsOrProvider
:
any
,
contextMenuProvider
:
IContextMenuProvider
,
actionItemProvider
:
IActionItemProvider
,
animateClick
:
boolean
,
actionRunner
:
IActionRunner
,
clazz
:
string
)
{
super
(
null
,
action
);
super
(
null
,
action
);
this
.
menuActionsOrProvider
=
menuActionsOrProvider
;
this
.
menuActionsOrProvider
=
menuActionsOrProvider
;
...
@@ -172,8 +170,8 @@ export class DropdownMenuActionItem extends ActionBar.BaseActionItem {
...
@@ -172,8 +170,8 @@ export class DropdownMenuActionItem extends ActionBar.BaseActionItem {
public
render
(
container
:
HTMLElement
):
void
{
public
render
(
container
:
HTMLElement
):
void
{
super
.
render
(
container
);
super
.
render
(
container
);
var
labelRenderer
:
Dropdown
.
ILabelRenderer
=
(
el
:
HTMLElement
):
Lifecycle
.
IDisposable
=>
{
var
labelRenderer
:
ILabelRenderer
=
(
el
:
HTMLElement
):
IDisposable
=>
{
var
e
=
Builder
.
$
(
'
a.action-label
'
).
attr
({
var
e
=
$
(
'
a.action-label
'
).
attr
({
tabIndex
:
'
-1
'
,
tabIndex
:
'
-1
'
,
role
:
'
menuitem
'
,
role
:
'
menuitem
'
,
title
:
this
.
_action
.
label
||
''
,
title
:
this
.
_action
.
label
||
''
,
...
@@ -199,19 +197,19 @@ export class DropdownMenuActionItem extends ActionBar.BaseActionItem {
...
@@ -199,19 +197,19 @@ export class DropdownMenuActionItem extends ActionBar.BaseActionItem {
return
null
;
return
null
;
};
};
var
options
:
Dropdown
.
IDropdownMenuOptions
=
{
var
options
:
IDropdownMenuOptions
=
{
contextMenuProvider
:
this
.
contextMenuProvider
,
contextMenuProvider
:
this
.
contextMenuProvider
,
labelRenderer
:
labelRenderer
labelRenderer
:
labelRenderer
};
};
// Render the DropdownMenu around a simple action to toggle it
// Render the DropdownMenu around a simple action to toggle it
if
(
T
ypes
.
isArray
(
this
.
menuActionsOrProvider
))
{
if
(
t
ypes
.
isArray
(
this
.
menuActionsOrProvider
))
{
options
.
actions
=
this
.
menuActionsOrProvider
;
options
.
actions
=
this
.
menuActionsOrProvider
;
}
else
{
}
else
{
options
.
actionProvider
=
this
.
menuActionsOrProvider
;
options
.
actionProvider
=
this
.
menuActionsOrProvider
;
}
}
this
.
dropdownMenu
=
new
Dropdown
.
Dropdown
Menu
(
container
,
options
);
this
.
dropdownMenu
=
new
DropdownMenu
(
container
,
options
);
this
.
dropdownMenu
.
menuOptions
=
{
this
.
dropdownMenu
.
menuOptions
=
{
actionItemProvider
:
this
.
actionItemProvider
,
actionItemProvider
:
this
.
actionItemProvider
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录