Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
a869e338
I
incubator-echarts
项目概览
missman
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
incubator-echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a869e338
编写于
3月 17, 2020
作者:
1
100pah
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ts: add and unify defaultOption inheritance.
上级
b9960764
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
26 addition
and
26 deletion
+26
-26
src/chart/bar/BarSeries.ts
src/chart/bar/BarSeries.ts
+3
-2
src/chart/bar/PictorialBarSeries.ts
src/chart/bar/PictorialBarSeries.ts
+3
-2
src/component/dataZoom/InsideZoomModel.ts
src/component/dataZoom/InsideZoomModel.ts
+3
-2
src/component/dataZoom/SliderZoomModel.ts
src/component/dataZoom/SliderZoomModel.ts
+3
-2
src/component/legend/ScrollableLegendModel.ts
src/component/legend/ScrollableLegendModel.ts
+2
-3
src/component/visualMap/ContinuousModel.ts
src/component/visualMap/ContinuousModel.ts
+2
-3
src/component/visualMap/PiecewiseModel.ts
src/component/visualMap/PiecewiseModel.ts
+2
-3
src/model/Component.ts
src/model/Component.ts
+3
-3
src/util/component.ts
src/util/component.ts
+5
-0
src/util/model.ts
src/util/model.ts
+0
-6
未找到文件。
src/chart/bar/BarSeries.ts
浏览文件 @
a869e338
...
...
@@ -22,6 +22,7 @@ import SeriesModel from '../../model/Series';
import
{
ItemStyleOption
,
OptionDataValue
,
LabelOption
,
SeriesStackOptionMixin
}
from
'
../../util/types
'
;
import
type
Cartesian2D
from
'
../../coord/cartesian/Cartesian2D
'
;
import
type
Polar
from
'
../../coord/polar/Polar
'
;
import
{
inheritDefaultOption
}
from
'
../../util/component
'
;
type
BarDataValue
=
OptionDataValue
|
OptionDataValue
[]
...
...
@@ -112,7 +113,7 @@ class BarSeriesModel extends BaseBarSeriesModel<BarSeriesOption> {
return
progressiveThreshold
;
}
static
defaultOption
:
BarSeriesOption
=
{
static
defaultOption
:
BarSeriesOption
=
inheritDefaultOption
(
BaseBarSeriesModel
.
defaultOption
,
{
// If clipped
// Only available on cartesian2d
clip
:
true
,
...
...
@@ -132,7 +133,7 @@ class BarSeriesModel extends BaseBarSeriesModel<BarSeriesOption> {
shadowOffsetY
:
0
,
opacity
:
1
}
}
}
);
}
...
...
src/chart/bar/PictorialBarSeries.ts
浏览文件 @
a869e338
...
...
@@ -27,6 +27,7 @@ import {
SeriesStackOptionMixin
}
from
'
../../util/types
'
;
import
type
Cartesian2D
from
'
../../coord/cartesian/Cartesian2D
'
;
import
{
inheritDefaultOption
}
from
'
../../util/component
'
;
interface
PictorialBarSeriesSymbolOption
{
/**
...
...
@@ -123,7 +124,7 @@ class PictorialBarSeriesModel extends BaseBarSeriesModel<PictorialBarSeriesOptio
coordinateSystem
:
Cartesian2D
static
defaultOption
:
PictorialBarSeriesOption
=
{
static
defaultOption
:
PictorialBarSeriesOption
=
inheritDefaultOption
(
BaseBarSeriesModel
.
defaultOption
,
{
symbol
:
'
circle
'
,
// Customized bar shape
symbolSize
:
null
,
//
...
...
@@ -146,7 +147,7 @@ class PictorialBarSeriesModel extends BaseBarSeriesModel<PictorialBarSeriesOptio
// Disable progressive
progressive
:
0
,
hoverAnimation
:
false
// Open only when needed.
}
}
);
getInitialData
(
option
:
PictorialBarSeriesOption
)
{
// Disable stack.
...
...
src/component/dataZoom/InsideZoomModel.ts
浏览文件 @
a869e338
...
...
@@ -19,6 +19,7 @@
import
DataZoomModel
,
{
DataZoomOption
}
from
'
./DataZoomModel
'
;
import
ComponentModel
from
'
../../model/Component
'
;
import
{
inheritDefaultOption
}
from
'
../../util/component
'
;
interface
InsideDataZoomOption
extends
DataZoomOption
{
...
...
@@ -51,14 +52,14 @@ class InsideZoomModel extends DataZoomModel<InsideDataZoomOption> {
static
readonly
type
=
'
dataZoom.inside
'
type
=
InsideZoomModel
.
type
static
defaultOption
:
InsideDataZoomOption
=
{
static
defaultOption
:
InsideDataZoomOption
=
inheritDefaultOption
(
DataZoomModel
.
defaultOption
,
{
disabled
:
false
,
zoomLock
:
false
,
zoomOnMouseWheel
:
true
,
moveOnMouseMove
:
true
,
moveOnMouseWheel
:
false
,
preventDefaultMouseMove
:
true
}
}
);
}
ComponentModel
.
registerClass
(
InsideZoomModel
);
...
...
src/component/dataZoom/SliderZoomModel.ts
浏览文件 @
a869e338
...
...
@@ -27,6 +27,7 @@ import {
ItemStyleOption
,
LabelOption
}
from
'
../../util/types
'
;
import
{
inheritDefaultOption
}
from
'
../../util/component
'
;
interface
SliderDataZoomOption
extends
DataZoomOption
,
BoxLayoutOptionMixin
{
...
...
@@ -96,7 +97,7 @@ class SliderZoomModel extends DataZoomModel<SliderDataZoomOption> {
static
readonly
layoutMode
=
'
box
'
static
defaultOption
:
SliderDataZoomOption
=
{
static
defaultOption
:
SliderDataZoomOption
=
inheritDefaultOption
(
DataZoomModel
.
defaultOption
,
{
show
:
true
,
// deault value can only be drived in view stage.
...
...
@@ -141,7 +142,7 @@ class SliderZoomModel extends DataZoomModel<SliderDataZoomOption> {
textStyle
:
{
color
:
'
#333
'
}
}
}
);
}
ComponentModel
.
registerClass
(
SliderZoomModel
);
...
...
src/component/legend/ScrollableLegendModel.ts
浏览文件 @
a869e338
...
...
@@ -27,6 +27,7 @@ import Model from '../../model/Model';
import
ComponentModel
from
'
../../model/Component
'
;
import
GlobalModel
from
'
../../model/Global
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
{
inheritDefaultOption
}
from
'
../../util/component
'
;
export
interface
ScrollableLegendOption
extends
LegendOption
{
scrollDataIndex
?:
number
...
...
@@ -86,9 +87,7 @@ class ScrollableLegendModel extends LegendModel<ScrollableLegendOption> {
mergeAndNormalizeLayoutParams
(
this
,
this
.
option
,
option
);
}
static
defaultOption
:
ScrollableLegendOption
=
zrUtil
.
merge
(
zrUtil
.
clone
(
LegendModel
.
defaultOption
),
{
static
defaultOption
:
ScrollableLegendOption
=
inheritDefaultOption
(
LegendModel
.
defaultOption
,
{
scrollDataIndex
:
0
,
pageButtonItemGap
:
5
,
pageButtonGap
:
null
,
...
...
src/component/visualMap/ContinuousModel.ts
浏览文件 @
a869e338
...
...
@@ -22,6 +22,7 @@ import VisualMapModel, { VisualMapOption, VisualMeta } from './VisualMapModel';
import
*
as
numberUtil
from
'
../../util/number
'
;
import
ComponentModel
from
'
../../model/Component
'
;
import
{
VisualMappingOption
}
from
'
../../visual/VisualMapping
'
;
import
{
inheritDefaultOption
}
from
'
../../util/component
'
;
// Constant
var
DEFAULT_BAR_BOUND
=
[
20
,
140
];
...
...
@@ -259,9 +260,7 @@ class ContinuousModel extends VisualMapModel<ContinousVisualMapOption> {
};
}
static
defaultOption
=
zrUtil
.
merge
(
zrUtil
.
clone
(
VisualMapModel
.
defaultOption
),
{
static
defaultOption
=
inheritDefaultOption
(
VisualMapModel
.
defaultOption
,
{
align
:
'
auto
'
,
// 'auto', 'left', 'right', 'top', 'bottom'
calculable
:
false
,
hoverLink
:
true
...
...
src/component/visualMap/PiecewiseModel.ts
浏览文件 @
a869e338
...
...
@@ -26,6 +26,7 @@ import {reformIntervals} from '../../util/number';
import
{
VisualOptionPiecewise
,
BuiltinVisualProperty
}
from
'
../../util/types
'
;
import
{
Dictionary
}
from
'
zrender/src/core/types
'
;
import
ComponentModel
from
'
../../model/Component
'
;
import
{
inheritDefaultOption
}
from
'
../../util/component
'
;
interface
VisualPiece
extends
VisualOptionPiecewise
{
...
...
@@ -408,9 +409,7 @@ class PiecewiseModel extends VisualMapModel<PiecewiseVisualMapOption> {
}
static
defaultOption
=
zrUtil
.
merge
(
zrUtil
.
clone
(
VisualMapModel
.
defaultOption
),
{
static
defaultOption
=
inheritDefaultOption
(
VisualMapModel
.
defaultOption
,
{
selected
:
null
,
minOpen
:
false
,
// Whether include values that smaller than `min`.
maxOpen
:
false
,
// Whether include values that bigger than `max`.
...
...
src/model/Component.ts
浏览文件 @
a869e338
...
...
@@ -194,15 +194,15 @@ class ComponentModel<Opt extends ComponentOption = ComponentOption> extends Mode
* Component.registerClass(XxxModel);
* ```
* ```ts
* import {
mergeOption} from '../model/util
';
* import {
inheritDefaultOption} from '../util/component
';
* import {XxxModel, XxxOption} from './XxxModel';
* export interface XxxSubOption extends XxxOption {
* bbb: number
* }
* class XxxSubModel extends XxxModel {
*
readonly defaultOption: XxxSubOption = mergeOption(
{
*
static defaultOption: XxxSubOption = inheritDefaultOption(XxxModel.defaultOption,
{
* bbb: 456
* }
, XxxModel.prototype.defaultOption
)
* })
* fn() {
* var opt = this.getDefaultOption();
* // opt is {aaa: 123, bbb: 456}
...
...
src/util/component.ts
浏览文件 @
a869e338
...
...
@@ -216,3 +216,8 @@ export function enableTopologicalTravel<T>(
}
}
export
function
inheritDefaultOption
<
T
,
K
>
(
superOption
:
T
,
subOption
:
K
):
K
{
// See also `model/Component.ts#getDefaultOption`
return
zrUtil
.
merge
(
zrUtil
.
merge
({},
superOption
,
true
),
subOption
,
true
);
}
src/util/model.ts
浏览文件 @
a869e338
...
...
@@ -21,7 +21,6 @@ import {
each
,
isObject
,
isArray
,
merge
,
createHashMap
,
HashMap
,
map
,
...
...
@@ -669,8 +668,3 @@ export function groupData<T, R extends string | number>(
buckets
:
buckets
};
}
export
function
mergeOption
<
T
,
K
>
(
option1
:
T
,
option2
:
K
):
T
&
K
{
// See also `model/Component.ts#getDefaultOption`
return
merge
(
merge
({},
option1
,
true
),
option2
,
true
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录