@antv/g2plot 2.4.19 → 2.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1626 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/dist/g2plot.min.js +2 -2
- package/dist/g2plot.min.js.map +1 -1
- package/esm/adaptor/brush.js +2 -3
- package/esm/adaptor/brush.js.map +1 -1
- package/esm/adaptor/common.js +2 -11
- package/esm/adaptor/common.js.map +1 -1
- package/esm/adaptor/geometries/base.d.ts +2 -2
- package/esm/adaptor/geometries/base.js +3 -1
- package/esm/adaptor/geometries/base.js.map +1 -1
- package/esm/adaptor/pattern.d.ts +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/interactions/brush.d.ts +18 -6
- package/esm/interactions/brush.js +35 -25
- package/esm/interactions/brush.js.map +1 -1
- package/esm/plots/box/adaptor.js +2 -2
- package/esm/plots/box/adaptor.js.map +1 -1
- package/esm/plots/chord/adaptor.js +2 -13
- package/esm/plots/chord/adaptor.js.map +1 -1
- package/esm/plots/chord/constant.d.ts +4 -4
- package/esm/plots/chord/constant.js +4 -4
- package/esm/plots/chord/constant.js.map +1 -1
- package/esm/plots/column/adaptor.js +3 -1
- package/esm/plots/column/adaptor.js.map +1 -1
- package/esm/plots/facet/types.d.ts +1 -2
- package/esm/plots/facet/types.js.map +1 -1
- package/esm/plots/facet/utils.js +2 -11
- package/esm/plots/facet/utils.js.map +1 -1
- package/esm/plots/funnel/adaptor.d.ts +5 -0
- package/esm/plots/funnel/adaptor.js +31 -2
- package/esm/plots/funnel/adaptor.js.map +1 -1
- package/esm/plots/funnel/geometries/basic.d.ts +5 -0
- package/esm/plots/funnel/geometries/basic.js +8 -4
- package/esm/plots/funnel/geometries/basic.js.map +1 -1
- package/esm/plots/funnel/geometries/common.d.ts +1 -0
- package/esm/plots/funnel/geometries/common.js +5 -2
- package/esm/plots/funnel/geometries/common.js.map +1 -1
- package/esm/plots/funnel/geometries/compare.d.ts +1 -0
- package/esm/plots/funnel/geometries/compare.js +37 -30
- package/esm/plots/funnel/geometries/compare.js.map +1 -1
- package/esm/plots/funnel/index.d.ts +1 -0
- package/esm/plots/funnel/index.js +1 -0
- package/esm/plots/funnel/index.js.map +1 -1
- package/esm/plots/funnel/interactions/funnel-conversion-tag.d.ts +9 -0
- package/esm/plots/funnel/interactions/funnel-conversion-tag.js +57 -0
- package/esm/plots/funnel/interactions/funnel-conversion-tag.js.map +1 -0
- package/esm/plots/funnel/interactions/index.d.ts +5 -0
- package/esm/plots/funnel/interactions/index.js +10 -0
- package/esm/plots/funnel/interactions/index.js.map +1 -0
- package/esm/plots/funnel/types.d.ts +1 -0
- package/esm/plots/funnel/types.js.map +1 -1
- package/esm/plots/gauge/utils.js +6 -5
- package/esm/plots/gauge/utils.js.map +1 -1
- package/esm/plots/heatmap/adaptor.js +9 -11
- package/esm/plots/heatmap/adaptor.js.map +1 -1
- package/esm/plots/histogram/adaptor.js +3 -0
- package/esm/plots/histogram/adaptor.js.map +1 -1
- package/esm/plots/pie/adaptor.js +3 -1
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/plots/pie/types.d.ts +6 -1
- package/esm/plots/pie/types.js.map +1 -1
- package/esm/plots/progress/adaptor.js +1 -2
- package/esm/plots/progress/adaptor.js.map +1 -1
- package/esm/plots/progress/utils.d.ts +1 -0
- package/esm/plots/progress/utils.js +4 -1
- package/esm/plots/progress/utils.js.map +1 -1
- package/esm/plots/sankey/adaptor.js +2 -11
- package/esm/plots/sankey/adaptor.js.map +1 -1
- package/esm/plots/stock/utils.d.ts +3 -1
- package/esm/plots/stock/utils.js +4 -2
- package/esm/plots/stock/utils.js.map +1 -1
- package/esm/plots/violin/adaptor.js +2 -10
- package/esm/plots/violin/adaptor.js.map +1 -1
- package/esm/types/common.d.ts +4 -3
- package/esm/types/common.js.map +1 -1
- package/esm/types/interaction.d.ts +5 -0
- package/esm/types/interaction.js.map +1 -1
- package/esm/utils/conversion.js +4 -3
- package/esm/utils/conversion.js.map +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/view.d.ts +8 -1
- package/esm/utils/view.js +27 -0
- package/esm/utils/view.js.map +1 -1
- package/lib/adaptor/brush.js +2 -3
- package/lib/adaptor/brush.js.map +1 -1
- package/lib/adaptor/common.js +1 -10
- package/lib/adaptor/common.js.map +1 -1
- package/lib/adaptor/geometries/base.d.ts +2 -2
- package/lib/adaptor/geometries/base.js +3 -1
- package/lib/adaptor/geometries/base.js.map +1 -1
- package/lib/adaptor/pattern.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interactions/brush.d.ts +18 -6
- package/lib/interactions/brush.js +35 -25
- package/lib/interactions/brush.js.map +1 -1
- package/lib/plots/box/adaptor.js +1 -1
- package/lib/plots/box/adaptor.js.map +1 -1
- package/lib/plots/chord/adaptor.js +1 -12
- package/lib/plots/chord/adaptor.js.map +1 -1
- package/lib/plots/chord/constant.d.ts +4 -4
- package/lib/plots/chord/constant.js +4 -4
- package/lib/plots/chord/constant.js.map +1 -1
- package/lib/plots/column/adaptor.js +3 -1
- package/lib/plots/column/adaptor.js.map +1 -1
- package/lib/plots/facet/types.d.ts +1 -2
- package/lib/plots/facet/types.js.map +1 -1
- package/lib/plots/facet/utils.js +1 -10
- package/lib/plots/facet/utils.js.map +1 -1
- package/lib/plots/funnel/adaptor.d.ts +5 -0
- package/lib/plots/funnel/adaptor.js +32 -2
- package/lib/plots/funnel/adaptor.js.map +1 -1
- package/lib/plots/funnel/geometries/basic.d.ts +5 -0
- package/lib/plots/funnel/geometries/basic.js +8 -3
- package/lib/plots/funnel/geometries/basic.js.map +1 -1
- package/lib/plots/funnel/geometries/common.d.ts +1 -0
- package/lib/plots/funnel/geometries/common.js +6 -3
- package/lib/plots/funnel/geometries/common.js.map +1 -1
- package/lib/plots/funnel/geometries/compare.d.ts +1 -0
- package/lib/plots/funnel/geometries/compare.js +38 -30
- package/lib/plots/funnel/geometries/compare.js.map +1 -1
- package/lib/plots/funnel/index.d.ts +1 -0
- package/lib/plots/funnel/index.js +1 -0
- package/lib/plots/funnel/index.js.map +1 -1
- package/lib/plots/funnel/interactions/funnel-conversion-tag.d.ts +9 -0
- package/lib/plots/funnel/interactions/funnel-conversion-tag.js +60 -0
- package/lib/plots/funnel/interactions/funnel-conversion-tag.js.map +1 -0
- package/lib/plots/funnel/interactions/index.d.ts +5 -0
- package/lib/plots/funnel/interactions/index.js +13 -0
- package/lib/plots/funnel/interactions/index.js.map +1 -0
- package/lib/plots/funnel/types.d.ts +1 -0
- package/lib/plots/funnel/types.js.map +1 -1
- package/lib/plots/gauge/utils.js +5 -4
- package/lib/plots/gauge/utils.js.map +1 -1
- package/lib/plots/heatmap/adaptor.js +8 -10
- package/lib/plots/heatmap/adaptor.js.map +1 -1
- package/lib/plots/histogram/adaptor.js +3 -0
- package/lib/plots/histogram/adaptor.js.map +1 -1
- package/lib/plots/pie/adaptor.js +3 -1
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/plots/pie/types.d.ts +6 -1
- package/lib/plots/pie/types.js.map +1 -1
- package/lib/plots/progress/adaptor.js +1 -2
- package/lib/plots/progress/adaptor.js.map +1 -1
- package/lib/plots/progress/utils.d.ts +1 -0
- package/lib/plots/progress/utils.js +4 -1
- package/lib/plots/progress/utils.js.map +1 -1
- package/lib/plots/sankey/adaptor.js +2 -11
- package/lib/plots/sankey/adaptor.js.map +1 -1
- package/lib/plots/stock/utils.d.ts +3 -1
- package/lib/plots/stock/utils.js +4 -2
- package/lib/plots/stock/utils.js.map +1 -1
- package/lib/plots/violin/adaptor.js +2 -10
- package/lib/plots/violin/adaptor.js.map +1 -1
- package/lib/types/common.d.ts +4 -3
- package/lib/types/common.js.map +1 -1
- package/lib/types/interaction.d.ts +5 -0
- package/lib/types/interaction.js.map +1 -1
- package/lib/utils/conversion.js +4 -3
- package/lib/utils/conversion.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/view.d.ts +8 -1
- package/lib/utils/view.js +29 -1
- package/lib/utils/view.js.map +1 -1
- package/package.json +4 -2
- package/src/adaptor/brush.ts +2 -2
- package/src/adaptor/common.ts +2 -11
- package/src/adaptor/geometries/base.ts +5 -3
- package/src/index.ts +1 -1
- package/src/interactions/brush.ts +38 -25
- package/src/plots/box/adaptor.ts +2 -2
- package/src/plots/chord/adaptor.ts +2 -14
- package/src/plots/chord/constant.ts +4 -4
- package/src/plots/column/adaptor.ts +3 -1
- package/src/plots/facet/types.ts +1 -1
- package/src/plots/facet/utils.ts +4 -12
- package/src/plots/funnel/adaptor.ts +32 -2
- package/src/plots/funnel/geometries/basic.ts +10 -5
- package/src/plots/funnel/geometries/common.ts +6 -3
- package/src/plots/funnel/geometries/compare.ts +50 -41
- package/src/plots/funnel/index.ts +1 -0
- package/src/plots/funnel/interactions/funnel-conversion-tag.ts +57 -0
- package/src/plots/funnel/interactions/index.ts +11 -0
- package/src/plots/funnel/types.ts +1 -0
- package/src/plots/gauge/utils.ts +5 -4
- package/src/plots/heatmap/adaptor.ts +10 -11
- package/src/plots/histogram/adaptor.ts +2 -0
- package/src/plots/pie/adaptor.ts +3 -1
- package/src/plots/pie/types.ts +6 -1
- package/src/plots/progress/adaptor.ts +1 -2
- package/src/plots/progress/utils.ts +4 -1
- package/src/plots/sankey/adaptor.ts +2 -11
- package/src/plots/stock/utils.ts +4 -3
- package/src/plots/violin/adaptor.ts +2 -11
- package/src/types/common.ts +5 -3
- package/src/types/interaction.ts +6 -0
- package/src/utils/conversion.ts +6 -3
- package/src/utils/index.ts +1 -0
- package/src/utils/view.ts +34 -1
package/esm/utils/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { kebabCase } from './kebab-case';
|
|
|
12
12
|
export { renderStatistic, renderGaugeStatistic } from './statistic';
|
|
13
13
|
export { measureTextWidth } from './measure-text';
|
|
14
14
|
export { isBetween, isRealNumber } from './number';
|
|
15
|
+
export { addViewAnimation } from './view';
|
|
15
16
|
export * from './data';
|
|
16
17
|
export * from './padding';
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
package/esm/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACnD,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC","sourcesContent":["export { flow } from './flow';\nexport { pick } from './pick';\nexport { template } from './template';\nexport { log, invariant, LEVEL } from './invariant';\nexport { getContainerSize } from './dom';\nexport * from './geometry';\nexport { findViewById, getViews, getSiblingViews } from './view';\nexport { transformLabel } from './label';\nexport { getSplinePath } from './path';\nexport { deepAssign } from './deep-assign';\nexport { kebabCase } from './kebab-case';\nexport { renderStatistic, renderGaugeStatistic } from './statistic';\nexport { measureTextWidth } from './measure-text';\nexport { isBetween, isRealNumber } from './number';\nexport * from './data';\nexport * from './padding';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC","sourcesContent":["export { flow } from './flow';\nexport { pick } from './pick';\nexport { template } from './template';\nexport { log, invariant, LEVEL } from './invariant';\nexport { getContainerSize } from './dom';\nexport * from './geometry';\nexport { findViewById, getViews, getSiblingViews } from './view';\nexport { transformLabel } from './label';\nexport { getSplinePath } from './path';\nexport { deepAssign } from './deep-assign';\nexport { kebabCase } from './kebab-case';\nexport { renderStatistic, renderGaugeStatistic } from './statistic';\nexport { measureTextWidth } from './measure-text';\nexport { isBetween, isRealNumber } from './number';\nexport { addViewAnimation } from './view';\nexport * from './data';\nexport * from './padding';\n"]}
|
package/esm/utils/view.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { View } from '@antv/g2';
|
|
1
|
+
import { Geometry, View, Types } from '@antv/g2';
|
|
2
|
+
import { Options } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* 在 Chart 中查找特定 id 的子 View
|
|
4
5
|
* @param chart
|
|
@@ -19,3 +20,9 @@ export declare function getViews(view: View): View[];
|
|
|
19
20
|
* @ignore
|
|
20
21
|
*/
|
|
21
22
|
export declare function getSiblingViews(view: View): View[];
|
|
23
|
+
/**
|
|
24
|
+
* 所有的 Geometries 都使用同一动画(各个图形如有区别,自行覆盖)并添加处理动画回调
|
|
25
|
+
* @param view View
|
|
26
|
+
* @param animation 动画配置
|
|
27
|
+
*/
|
|
28
|
+
export declare function addViewAnimation(view: View, animation: Options['animation'], geometries?: Geometry<Types.ShapePoint>[]): void;
|
package/esm/utils/view.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { each, isFunction } from '@antv/util';
|
|
1
2
|
/**
|
|
2
3
|
* 在 Chart 中查找特定 id 的子 View
|
|
3
4
|
* @param chart
|
|
@@ -25,4 +26,30 @@ export function getViews(view) {
|
|
|
25
26
|
export function getSiblingViews(view) {
|
|
26
27
|
return getViews(view).filter(function (sub) { return sub !== view; });
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* 所有的 Geometries 都使用同一动画(各个图形如有区别,自行覆盖)并添加处理动画回调
|
|
31
|
+
* @param view View
|
|
32
|
+
* @param animation 动画配置
|
|
33
|
+
*/
|
|
34
|
+
export function addViewAnimation(view, animation, geometries) {
|
|
35
|
+
if (geometries === void 0) { geometries = view.geometries; }
|
|
36
|
+
// 同时设置整个 view 动画选项
|
|
37
|
+
if (typeof animation === 'boolean') {
|
|
38
|
+
view.animate(animation);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
view.animate(true);
|
|
42
|
+
}
|
|
43
|
+
// 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)
|
|
44
|
+
each(geometries, function (g) {
|
|
45
|
+
var animationCfg;
|
|
46
|
+
if (isFunction(animation)) {
|
|
47
|
+
animationCfg = animation(g.type || g.shapeType, g) || true;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
animationCfg = animation;
|
|
51
|
+
}
|
|
52
|
+
g.animate(animationCfg);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
28
55
|
//# sourceMappingURL=view.js.map
|
package/esm/utils/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/utils/view.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/utils/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI9C;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAW,EAAE,EAAU;IAClD,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAC,IAAU,IAAK,OAAA,IAAI,CAAC,EAAE,KAAK,EAAE,EAAd,CAAc,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAU;IACjC,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAU;IACxC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,KAAK,IAAI,EAAZ,CAAY,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAU,EACV,SAA+B,EAC/B,UAA0D;IAA1D,2BAAA,EAAA,aAA2C,IAAI,CAAC,UAAU;IAE1D,mBAAmB;IACnB,IAAI,OAAO,SAAS,KAAK,SAAS,EAAE;QAClC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;KACzB;SAAM;QACL,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,sCAAsC;IACtC,IAAI,CAAC,UAAU,EAAE,UAAC,CAAW;QAC3B,IAAI,YAAY,CAAC;QACjB,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE;YACzB,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;SAC5D;aAAM;YACL,YAAY,GAAG,SAAS,CAAC;SAC1B;QAED,CAAC,CAAC,OAAO,CAAC,YAAyB,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Geometry, View, Types } from '@antv/g2';\nimport { each, isFunction } from '@antv/util';\nimport { Options } from '../types';\nimport { Animation } from '../types/animation';\n\n/**\n * 在 Chart 中查找特定 id 的子 View\n * @param chart\n * @param id\n */\nexport function findViewById(chart: View, id: string): View {\n return chart.views.find((view: View) => view.id === id);\n}\n\n/**\n * 获取同 view 同一级的所有 views\n * @param view 当前 view\n * @returns 同一级的 views\n * @ignore\n */\nexport function getViews(view: View): View[] {\n const parent = view.parent;\n return parent ? parent.views : [];\n}\n\n/**\n * 获取同 view 同一级的 views,不包括自身\n * @param view 当前 view\n * @returns 同一级的 views\n * @ignore\n */\nexport function getSiblingViews(view: View): View[] {\n return getViews(view).filter((sub) => sub !== view);\n}\n\n/**\n * 所有的 Geometries 都使用同一动画(各个图形如有区别,自行覆盖)并添加处理动画回调\n * @param view View\n * @param animation 动画配置\n */\nexport function addViewAnimation(\n view: View,\n animation: Options['animation'],\n geometries: Geometry<Types.ShapePoint>[] = view.geometries\n) {\n // 同时设置整个 view 动画选项\n if (typeof animation === 'boolean') {\n view.animate(animation);\n } else {\n view.animate(true);\n }\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n each(geometries, (g: Geometry) => {\n let animationCfg;\n if (isFunction(animation)) {\n animationCfg = animation(g.type || g.shapeType, g) || true;\n } else {\n animationCfg = animation;\n }\n\n g.animate(animationCfg as Animation);\n });\n}\n"]}
|
package/lib/adaptor/brush.js
CHANGED
|
@@ -18,7 +18,6 @@ function brushInteraction(params) {
|
|
|
18
18
|
// 设置 brush 交互
|
|
19
19
|
if (brush === null || brush === void 0 ? void 0 : brush.enabled) {
|
|
20
20
|
BRUSH_TYPES.forEach(function (type) {
|
|
21
|
-
var _a;
|
|
22
21
|
var enable = false;
|
|
23
22
|
switch (brush.type) {
|
|
24
23
|
case 'x-rect':
|
|
@@ -32,8 +31,8 @@ function brushInteraction(params) {
|
|
|
32
31
|
break;
|
|
33
32
|
}
|
|
34
33
|
var obj = { type: type, enable: enable };
|
|
35
|
-
if (
|
|
36
|
-
obj.cfg = brush_1.getInteractionCfg(type, brush.type, brush
|
|
34
|
+
if (brush) {
|
|
35
|
+
obj.cfg = brush_1.getInteractionCfg(type, brush.type, brush);
|
|
37
36
|
}
|
|
38
37
|
interactions.push(obj);
|
|
39
38
|
});
|
package/lib/adaptor/brush.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brush.js","sourceRoot":"","sources":["../../src/adaptor/brush.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAEpC,+CAA0D;AAC1D,kCAAsC;AAGt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,YAAY,cAAA,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC;AA1CD,4CA0CC","sourcesContent":["import { filter } from '@antv/util';\nimport { Params } from '../core/adaptor';\nimport { getInteractionCfg } from '../interactions/brush';\nimport { deepAssign } from '../utils';\nimport { Options as BaseOptions, BrushCfg, Interaction, Writable } from '../types';\n\n/** 先引入brush 交互 */\nimport '../interactions/brush';\n\ntype Options = Pick<BaseOptions, 'interactions'> & { brush?: BrushCfg };\n\nconst BRUSH_TYPES = ['brush', 'brush-x', 'brush-y', 'brush-highlight', 'brush-x-highlight', 'brush-y-highlight'];\n\n/**\n * brush 交互\n */\nexport function brushInteraction<O extends Options = Options>(params: Params<O>): Params<O> {\n const { options } = params;\n\n const { brush } = options;\n\n // 先过滤掉 brush 等交互\n const interactions = filter(options.interactions || [], (i) => BRUSH_TYPES.indexOf(i.type) === -1);\n\n // 设置 brush 交互\n if (brush?.enabled) {\n BRUSH_TYPES.forEach((type) => {\n let enable = false;\n switch (brush.type) {\n case 'x-rect':\n enable = type === (brush.action === 'highlight' ? 'brush-x-highlight' : 'brush-x');\n break;\n case 'y-rect':\n enable = type === (brush.action === 'highlight' ? 'brush-y-highlight' : 'brush-y');\n break;\n default:\n enable = type === (brush.action === 'highlight' ? 'brush-highlight' : 'brush');\n break;\n }\n const obj: Writable<Interaction> = { type, enable };\n\n if (brush) {\n obj.cfg = getInteractionCfg(type, brush.type, brush);\n }\n interactions.push(obj);\n });\n\n // 塞入 button 配置 (G2Plot 的封装)\n if (brush?.action !== 'highlight') {\n interactions.push({\n type: 'filter-action',\n cfg: {\n buttonConfig: brush.button,\n },\n });\n }\n }\n return deepAssign({}, params, { options: { interactions } });\n}\n"]}
|
package/lib/adaptor/common.js
CHANGED
|
@@ -59,17 +59,8 @@ exports.interaction = interaction;
|
|
|
59
59
|
function animation(params) {
|
|
60
60
|
var chart = params.chart, options = params.options;
|
|
61
61
|
var animation = options.animation;
|
|
62
|
-
// 同时设置整个 view 动画选项
|
|
63
|
-
if (typeof animation === 'boolean') {
|
|
64
|
-
chart.animate(animation);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
chart.animate(true);
|
|
68
|
-
}
|
|
69
62
|
// 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)
|
|
70
|
-
|
|
71
|
-
g.animate(animation);
|
|
72
|
-
});
|
|
63
|
+
utils_1.addViewAnimation(chart, animation);
|
|
73
64
|
return params;
|
|
74
65
|
}
|
|
75
66
|
exports.animation = animation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/adaptor/common.ts"],"names":[],"mappings":";;;;AACA,mCAAmD;AAMnD,wCAAoD;AACpD,kCAA4C;AAE5C;;;GAGG;AACH,SAAgB,MAAM,CACpB,MAAiB;IAET,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,MAAM,GAA8B,OAAO,OAArC,EAAE,UAAU,GAAkB,OAAO,WAAzB,EAAE,WAAW,GAAK,OAAO,YAAZ,CAAa;IAEpD,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACrB;SAAM,IAAI,UAAU,IAAI,WAAW,EAAE;QACpC,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,WAAW,EAAE,MAAM,CAAC,CAAC;KACjD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wBAaC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAqC,MAAiB;IACnE,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GAAK,OAAO,QAAZ,CAAa;IAE5B,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACxB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,0B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AO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AArBD,0CAqBC;AAED,qCAAoC;AAA3B,kGAAA,OAAO,OAAA","sourcesContent":["import { Geometry, Types } from '@antv/g2';\nimport { each, isNil, isObject } from '@antv/util';\nimport { Params } from '../core/adaptor';\nimport { Options } from '../types';\nimport { Interaction } from '../types/interaction';\nimport { Transformations } from '../types/coordinate';\nimport { Axis } from '../types/axis';\nimport { AXIS_META_CONFIG_KEYS } from '../constant';\nimport { pick, deepAssign } from '../utils';\n\n/**\n * 通用 legend 配置, 适用于带 colorField 或 seriesField 的图表\n * @param params\n */\nexport function legend<O extends Pick<Options, 'legend'> & { colorField?: string; seriesField?: string }>(\n params: Params<O>\n): Params<O> {\n const { chart, options } = params;\n const { legend, colorField, seriesField } = options;\n\n if (legend === false) {\n chart.legend(false);\n } else if (colorField || seriesField) {\n chart.legend(colorField || seriesField, legend);\n }\n\n return params;\n}\n\n/**\n * 通用 tooltip 配置\n * @param params\n */\nexport function tooltip<O extends Pick<Options, 'tooltip'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip !== undefined) {\n chart.tooltip(tooltip);\n }\n\n return params;\n}\n\n/**\n * Interaction 配置\n * @param params\n */\nexport function interaction<O extends Pick<Options, 'interactions'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { interactions } = options;\n\n each(interactions, (i: Interaction) => {\n if (i.enable === false) {\n chart.removeInteraction(i.type);\n } else {\n chart.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation<O extends Pick<Options, 'animation'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { animation } = options;\n\n // 同时设置整个 view 动画选项\n if (typeof animation === 'boolean') {\n chart.animate(animation);\n } else {\n chart.animate(true);\n }\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n each(chart.geometries, (g: Geometry) => {\n g.animate(animation);\n });\n\n return params;\n}\n\n/**\n * 设置全局主题配置\n * @param params\n */\nexport function theme<O extends Pick<Options, 'theme'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { theme } = options;\n\n // 存在主题才设置主题\n if (theme) {\n chart.theme(theme);\n }\n return params;\n}\n\n/**\n * 状态 state 配置\n * @param params\n */\nexport function state<O extends Options>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { state } = options;\n\n if (state) {\n each(chart.geometries, (geometry: Geometry) => {\n geometry.state(state);\n });\n }\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function slider(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { slider } = options;\n\n chart.option('slider', slider);\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function scrollbar(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { scrollbar } = options;\n\n chart.option('scrollbar', scrollbar);\n\n return params;\n}\n\n/**\n * scale 的 adaptor\n * @param axes\n */\nexport function scale(axes: Record<string, Axis>, meta?: Options['meta']) {\n return function <O extends Pick<Options, 'meta'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n // 1. 轴配置中的 scale 信息\n let scales: Record<string, any> = {};\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n\n // 2. meta 直接是 scale 的信息\n scales = deepAssign({}, meta, options.meta, scales);\n\n chart.scale(scales);\n\n return params;\n };\n}\n\n/**\n * annotation 配置\n * @param params\n */\nexport function annotation(annotationOptions?: Options['annotations']) {\n return function <O extends Pick<Options, 'annotations'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n const annotationController = chart.getController('annotation');\n\n /** 自定义 annotation */\n each([...(options.annotations || []), ...(annotationOptions || [])], (annotationOption) => {\n // @ts-ignore\n annotationController.annotation(annotationOption);\n });\n\n return params;\n };\n}\n\n/**\n * 自动设置 limitInPlot\n * @param params\n */\nexport function limitInPlot(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { yAxis, limitInPlot } = options;\n\n let value = limitInPlot;\n\n // 用户没有设置 limitInPlot,则自动根据 yAxis 是否有 min/max 来设置 limitInPlot\n if (isObject(yAxis) && isNil(limitInPlot)) {\n if (Object.values(pick(yAxis, ['min', 'max', 'minLimit', 'maxLimit'])).some((value) => !isNil(value))) {\n value = true;\n } else {\n value = false;\n }\n }\n chart.limitInPlot = value;\n\n return params;\n}\n\n/**\n * 坐标系转换\n */\nexport function transformations(coordinateType: Types.CoordinateOption['type'] = 'rect') {\n return (params: Params<Options & { coordinate: Transformations }>) => {\n const { chart, options } = params;\n const { coordinate } = options;\n\n const actions: Types.CoordinateActions[] = Array.from(coordinate || [])\n .map((cfg) => {\n if (cfg.type === 'reflectX') return ['reflect', 'x'] as Types.CoordinateActions;\n if (cfg.type === 'reflectY') return ['reflect', 'y'] as Types.CoordinateActions;\n if (cfg.type === 'transpose') return ['transpose'] as Types.CoordinateActions;\n\n return null;\n })\n .filter((d) => !!d);\n\n if (actions.length !== 0) {\n chart.coordinate({ type: coordinateType, actions });\n }\n\n return params;\n };\n}\n\nexport { pattern } from './pattern';\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/adaptor/common.ts"],"names":[],"mappings":";;;;AACA,mCAAmD;AAMnD,wCAAoD;AACpD,kCAA8D;AAE9D;;;GAGG;AACH,SAAgB,MAAM,CACpB,MAAiB;IAET,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,MAAM,GAA8B,OAAO,OAArC,EAAE,UAAU,GAAkB,OAAO,WAAzB,EAAE,WAAW,GAAK,OAAO,YAAZ,CAAa;IAEpD,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACrB;SAAM,IAAI,UAAU,IAAI,WAAW,EAAE;QACpC,KAAK,CAAC,MAAM,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EtB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;SACrD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AArBD,0CAqBC;AAED,qCAAoC;AAA3B,kGAAA,OAAO,OAAA","sourcesContent":["import { Geometry, Types } from '@antv/g2';\nimport { each, isNil, isObject } from '@antv/util';\nimport { Params } from '../core/adaptor';\nimport { Options } from '../types';\nimport { Interaction } from '../types/interaction';\nimport { Transformations } from '../types/coordinate';\nimport { Axis } from '../types/axis';\nimport { AXIS_META_CONFIG_KEYS } from '../constant';\nimport { pick, deepAssign, addViewAnimation } from '../utils';\n\n/**\n * 通用 legend 配置, 适用于带 colorField 或 seriesField 的图表\n * @param params\n */\nexport function legend<O extends Pick<Options, 'legend'> & { colorField?: string; seriesField?: string }>(\n params: Params<O>\n): Params<O> {\n const { chart, options } = params;\n const { legend, colorField, seriesField } = options;\n\n if (legend === false) {\n chart.legend(false);\n } else if (colorField || seriesField) {\n chart.legend(colorField || seriesField, legend);\n }\n\n return params;\n}\n\n/**\n * 通用 tooltip 配置\n * @param params\n */\nexport function tooltip<O extends Pick<Options, 'tooltip'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip !== undefined) {\n chart.tooltip(tooltip);\n }\n\n return params;\n}\n\n/**\n * Interaction 配置\n * @param params\n */\nexport function interaction<O extends Pick<Options, 'interactions'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { interactions } = options;\n\n each(interactions, (i: Interaction) => {\n if (i.enable === false) {\n chart.removeInteraction(i.type);\n } else {\n chart.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation<O extends Pick<Options, 'animation'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { animation } = options;\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n addViewAnimation(chart, animation);\n\n return params;\n}\n\n/**\n * 设置全局主题配置\n * @param params\n */\nexport function theme<O extends Pick<Options, 'theme'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { theme } = options;\n\n // 存在主题才设置主题\n if (theme) {\n chart.theme(theme);\n }\n return params;\n}\n\n/**\n * 状态 state 配置\n * @param params\n */\nexport function state<O extends Options>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { state } = options;\n\n if (state) {\n each(chart.geometries, (geometry: Geometry) => {\n geometry.state(state);\n });\n }\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function slider(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { slider } = options;\n\n chart.option('slider', slider);\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function scrollbar(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { scrollbar } = options;\n\n chart.option('scrollbar', scrollbar);\n\n return params;\n}\n\n/**\n * scale 的 adaptor\n * @param axes\n */\nexport function scale(axes: Record<string, Axis>, meta?: Options['meta']) {\n return function <O extends Pick<Options, 'meta'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n // 1. 轴配置中的 scale 信息\n let scales: Record<string, any> = {};\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n\n // 2. meta 直接是 scale 的信息\n scales = deepAssign({}, meta, options.meta, scales);\n\n chart.scale(scales);\n\n return params;\n };\n}\n\n/**\n * annotation 配置\n * @param params\n */\nexport function annotation(annotationOptions?: Options['annotations']) {\n return function <O extends Pick<Options, 'annotations'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n const annotationController = chart.getController('annotation');\n\n /** 自定义 annotation */\n each([...(options.annotations || []), ...(annotationOptions || [])], (annotationOption) => {\n // @ts-ignore\n annotationController.annotation(annotationOption);\n });\n\n return params;\n };\n}\n\n/**\n * 自动设置 limitInPlot\n * @param params\n */\nexport function limitInPlot(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { yAxis, limitInPlot } = options;\n\n let value = limitInPlot;\n\n // 用户没有设置 limitInPlot,则自动根据 yAxis 是否有 min/max 来设置 limitInPlot\n if (isObject(yAxis) && isNil(limitInPlot)) {\n if (Object.values(pick(yAxis, ['min', 'max', 'minLimit', 'maxLimit'])).some((value) => !isNil(value))) {\n value = true;\n } else {\n value = false;\n }\n }\n chart.limitInPlot = value;\n\n return params;\n}\n\n/**\n * 坐标系转换\n */\nexport function transformations(coordinateType: Types.CoordinateOption['type'] = 'rect') {\n return (params: Params<Options & { coordinate: Transformations }>) => {\n const { chart, options } = params;\n const { coordinate } = options;\n\n const actions: Types.CoordinateActions[] = Array.from(coordinate || [])\n .map((cfg) => {\n if (cfg.type === 'reflectX') return ['reflect', 'x'] as Types.CoordinateActions;\n if (cfg.type === 'reflectY') return ['reflect', 'y'] as Types.CoordinateActions;\n if (cfg.type === 'transpose') return ['transpose'] as Types.CoordinateActions;\n\n return null;\n })\n .filter((d) => !!d);\n\n if (actions.length !== 0) {\n chart.coordinate({ type: coordinateType, actions });\n }\n\n return params;\n };\n}\n\nexport { pattern } from './pattern';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Params } from '../../core/adaptor';
|
|
2
|
-
import { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum } from '../../types';
|
|
2
|
+
import { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum, RawFields } from '../../types';
|
|
3
3
|
import { Label } from '../../types/label';
|
|
4
4
|
import { State } from '../../types/state';
|
|
5
5
|
/**
|
|
@@ -39,7 +39,7 @@ export declare type Geometry = {
|
|
|
39
39
|
/** tooltip 的映射字段 */
|
|
40
40
|
readonly tooltipFields?: string[] | false;
|
|
41
41
|
/** 其他原始字段, 用于 mapping 回调参数 */
|
|
42
|
-
readonly rawFields?:
|
|
42
|
+
readonly rawFields?: RawFields;
|
|
43
43
|
/** 图形映射规则 */
|
|
44
44
|
readonly mapping?: MappingOptions;
|
|
45
45
|
/** label 映射通道,因为历史原因导致实现略有区别 */
|
|
@@ -10,8 +10,10 @@ var utils_1 = require("../../utils");
|
|
|
10
10
|
* @param field
|
|
11
11
|
*/
|
|
12
12
|
function getMappingField(o, field) {
|
|
13
|
-
var type = o.type, xField = o.xField, yField = o.yField, colorField = o.colorField, shapeField = o.shapeField, sizeField = o.sizeField, styleField = o.styleField
|
|
13
|
+
var type = o.type, xField = o.xField, yField = o.yField, colorField = o.colorField, shapeField = o.shapeField, sizeField = o.sizeField, styleField = o.styleField;
|
|
14
|
+
var rawFields = o.rawFields;
|
|
14
15
|
var fields = [];
|
|
16
|
+
rawFields = (util_1.isFunction(rawFields) ? rawFields(type, field) : rawFields) || [];
|
|
15
17
|
// 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效
|
|
16
18
|
// 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields
|
|
17
19
|
// shape, size 同理
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/base.ts"],"names":[],"mappings":";;;;AAAA,mCAAqF;AAKrF,qCAA6C;AA0D7C;;;;GAIG;AACH,SAAgB,eAAe,CAC7B,CAAkB,EAClB,KAA2C;IAKnC,IAAA,IAAI,GAAoF,CAAC,KAArF,EAAE,MAAM,GAA4E,CAAC,OAA7E,EAAE,MAAM,GAAoE,CAAC,OAArE,EAAE,UAAU,GAAwD,CAAC,WAAzD,EAAE,UAAU,GAA4C,CAAC,WAA7C,EAAE,SAAS,GAAiC,CAAC,UAAlC,EAAE,UAAU,GAAqB,CAAC,WAAtB,EAAE,KAAmB,CAAC,UAAN,EAAd,SAAS,mBAAG,EAAE,KAAA,CAAO;IAElG,IAAI,MAAM,GAAG,EAAE,CAAC;IA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,CAAC,CAAC,CAAC;KACvF;IAED;;OAEG;IACH,IAAI,KAAK,KAAK,KAAK,EAAE;QACnB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACvB;SAAM,IAAI,KAAK,EAAE;QACR,IAAA,QAAQ,GAAqB,KAAK,SAA1B,EAAE,MAAM,GAAa,KAAK,OAAlB,EAAK,GAAG,kBAAK,KAAK,EAApC,sBAA4B,CAAF,CAAW;QAC3C,QAAQ,CAAC,KAAK,CAAC;YACb,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC;YAC1B,QAAQ,UAAA;YACR,GAAG,EAAE,sBAAc,CAAC,GAAG,CAAC;SACzB,CAAC,CAAC;KACJ;IAED;;OAEG;IACH,IAAI,KAAK,EAAE;QACT,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACvB;IAED;;OAEG;IACH,IAAI,UAAU,EAAE;QACd,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;KACjC;IAED,2BAA2B;IAC3B,CAAC,MAAM,EAAE,MAAM,CAAC;SACb,MAAM,CAAC,UAAC,CAAS,IAAK,OAAA,CAAC,KAAK,UAAU,EAAhB,CAAgB,CAAC;SACvC,OAAO,CAAC,UAAC,CAAS;QACjB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACL,6CACK,MAAM;QACT,gFAAgF;QAChF,GAAG,EAAE,EAAE,QAAQ,UAAA,EAAE,IACjB;AACJ,CAAC;AAzID,4BAyIC","sourcesContent":["import { uniq, isFunction, isObject, isString, isNumber, isEmpty } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum } from '../../types';\nimport { Label } from '../../types/label';\nimport { State } from '../../types/state';\nimport { transformLabel } from '../../utils';\n\n/**\n * 图形映射属性,按照优先级来的\n */\nexport type MappingOptions = {\n /** color 映射 */\n readonly color?: ColorAttr;\n /** shape 映射 */\n readonly shape?: ShapeAttr;\n /** 大小映射, 提供回调的方式 */\n readonly size?: SizeAttr;\n /** 样式映射 */\n readonly style?: StyleAttr;\n /** tooltip 映射 */\n readonly tooltip?: TooltipAttr;\n};\n\n/**\n * 一个图形映射的逻辑,纯粹的图形语法\n * // TODO 后续需要处理 adjust 的配置,然后通过 field 信息。比如 styleField,labelField 等一定是一个数组形式\n */\nexport type Geometry = {\n /** geometry 类型, 'line' | 'interval' | 'point' | 'area' | 'polygon' */\n readonly type?: string;\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly colorField?: string;\n /** shape 的映射字段 */\n readonly shapeField?: string;\n /** size 映射字段 */\n readonly sizeField?: string;\n /** style 的映射字段 */\n readonly styleField?: string;\n /** tooltip 的映射字段 */\n readonly tooltipFields?: string[] | false;\n /** 其他原始字段, 用于 mapping 回调参数 */\n readonly rawFields?: string[];\n /** 图形映射规则 */\n readonly mapping?: MappingOptions;\n /** label 映射通道,因为历史原因导致实现略有区别 */\n readonly label?: Label;\n /** 不同状态的样式 */\n readonly state?: State;\n /** 自定义信息,一般在 registerShape 中使用 */\n readonly customInfo?: any;\n /** geometry params */\n readonly args?: any;\n};\n\n/**\n * geometry options\n */\nexport type GeometryOptions = Geometry & Partial<Options>;\n\n/**\n * 获得映射的字段列表\n * @param options\n * @param field\n */\nexport function getMappingField(\n o: GeometryOptions,\n field: 'color' | 'shape' | 'size' | 'style'\n): {\n mappingFields: string[];\n tileMappingField: string;\n} {\n const { type, xField, yField, colorField, shapeField, sizeField, styleField, rawFields = [] } = o;\n\n let fields = [];\n\n // 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效\n // 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields\n // shape, size 同理\n if (field === 'color') {\n fields = [colorField || xField, ...rawFields];\n } else if (field === 'shape') {\n fields = [shapeField || xField, ...rawFields];\n } else if (field === 'size') {\n fields = [sizeField || xField, ...rawFields];\n } else {\n fields = [xField, yField, colorField, shapeField, sizeField, styleField, ...rawFields];\n\n // 一定能找到的!\n const idx = ['x', 'y', 'color', 'shape', 'size', 'style'].indexOf(field);\n\n const f = fields[idx];\n // 删除当前字段\n fields.splice(idx, 1);\n // 插入到第一个\n fields.unshift(f);\n }\n\n const mappingFields = uniq(fields.filter((f) => !!f));\n /**\n * 修复 line geometry 无拆分时 color 回调错误\n * eg:\n * geometry.color(xField, ()=> '#f24')\n */\n const tileMappingField =\n type === 'line' && [xField, yField].includes(mappingFields.join('*')) ? '' : mappingFields.join('*');\n return {\n mappingFields,\n tileMappingField,\n };\n}\n\n/**\n * 获得映射函数\n * @param mappingFields\n * @param func\n */\nexport function getMappingFunction(mappingFields: string[], func: (datum: Datum) => any) {\n if (!func) return undefined;\n // 返回函数\n return (...args: any[]) => {\n const params: Datum = {};\n\n mappingFields.forEach((f: string, idx: number) => {\n params[f] = args[idx];\n });\n\n // 删除 undefined\n delete params['undefined'];\n\n return func(params);\n };\n}\n\n/**\n * 通用 geometry 的配置处理的 adaptor\n * @param params\n */\nexport function geometry<O extends GeometryOptions>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const {\n type,\n args,\n mapping,\n xField,\n yField,\n colorField,\n shapeField,\n sizeField,\n tooltipFields,\n label,\n state,\n customInfo,\n } = options;\n\n // 如果没有 mapping 信息,那么直接返回\n if (!mapping) {\n return params;\n }\n\n const { color, shape, size, style, tooltip } = mapping;\n\n // 创建 geometry\n const geometry = chart[type](args).position(`${xField}*${yField}`);\n\n /**\n * color 的几种情况\n * g.color('red');\n * g.color('color', ['red', 'blue']);\n * g.color('x', (x, y) => 'red');\n * g.color('color', (color, x, y) => 'red');\n */\n if (isString(color)) {\n colorField ? geometry.color(colorField, color) : geometry.color(color);\n } else if (isFunction(color)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'color');\n geometry.color(tileMappingField, getMappingFunction(mappingFields, color));\n } else {\n colorField && geometry.color(colorField, color);\n }\n\n /**\n * shape 的几种情况\n * g.shape('rect');\n * g.shape('shape', ['rect', 'circle']);\n * g.shape('x*y', (x, y) => 'rect');\n * g.shape('shape*x*y', (shape, x, y) => 'rect');\n */\n if (isString(shape)) {\n shapeField ? geometry.shape(shapeField, [shape]) : geometry.shape(shape); // [shape] 需要在 G2 做掉\n } else if (isFunction(shape)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'shape');\n geometry.shape(tileMappingField, getMappingFunction(mappingFields, shape));\n } else {\n shapeField && geometry.shape(shapeField, shape);\n }\n\n /**\n * size 的几种情况\n * g.size(10);\n * g.size('size', [10, 20]);\n * g.size('x*y', (x, y) => 10);\n * g.color('size*x*y', (size, x, y) => 1-);\n */\n if (isNumber(size)) {\n sizeField ? geometry.size(sizeField, size) : geometry.size(size);\n } else if (isFunction(size)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'size');\n geometry.size(tileMappingField, getMappingFunction(mappingFields, size));\n } else {\n sizeField && geometry.size(sizeField, size);\n }\n\n /**\n * style 的几种情况\n * g.style({ fill: 'red' });\n * g.style('x*y*color', (x, y, color) => ({ fill: 'red' }));\n */\n if (isFunction(style)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'style');\n geometry.style(tileMappingField, getMappingFunction(mappingFields, style));\n } else if (isObject(style)) {\n geometry.style(style);\n }\n\n /**\n * tooltip 的 API\n * g.tooltip('x*y*color', (x, y, color) => ({ name, value }));\n * g.tooltip(false);\n */\n if (tooltipFields === false) {\n geometry.tooltip(false);\n } else if (!isEmpty(tooltipFields)) {\n geometry.tooltip(tooltipFields.join('*'), getMappingFunction(tooltipFields, tooltip));\n }\n\n /**\n * label 的映射\n */\n if (label === false) {\n geometry.label(false);\n } else if (label) {\n const { callback, fields, ...cfg } = label;\n geometry.label({\n fields: fields || [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n /**\n * state 状态样式\n */\n if (state) {\n geometry.state(state);\n }\n\n /**\n * 自定义信息\n */\n if (customInfo) {\n geometry.customInfo(customInfo);\n }\n\n // 防止因为 x y 字段做了通道映射,导致生成图例\n [xField, yField]\n .filter((f: string) => f !== colorField)\n .forEach((f: string) => {\n chart.legend(f, false);\n });\n return {\n ...params,\n // geometry adaptor 额外需要做的事情,就是将创建好的 geometry 返回到下一层 adaptor,防止通过 type 查询的时候容易误判\n ext: { geometry },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/base.ts"],"names":[],"mappings":";;;;AAAA,mCAAqF;AAKrF,qCAA6C;AA0D7C;;;;GAIG;AACH,SAAgB,eAAe,CAC7B,CAAkB,EAClB,KAA2C;IAKnC,IAAA,IAAI,GAAoE,CAAC,KAArE,EAAE,MAAM,GAA4D,CAAC,OAA7D,EAAE,MAAM,GAAoD,CAAC,OAArD,EAAE,UAAU,GAAwC,CAAC,WAAzC,EAAE,UAAU,GAA4B,CAAC,WAA7B,EAAE,SAAS,GAAiB,CAAC,UAAlB,EAAE,UAAU,GAAK,CAAC,WAAN,CAAO;IAC5E,IAAA,SAAS,GAAK,CAAC,UAAN,CAAO;IAEtB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,SAAS,GAAG,CAAC,iBAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAE/E,4DAA4D;IAC5D,gDAAgD;IAChD,iBAAiB;IACjB,IAAI,KAAK,KAAK,OAAO,EAAE;QACrB,MAAM,2BAAI,UAAU,IAAI,MAAM,GAAK,SAAS,CAAC,CAAC;KAC/C;SAAM,IAAI,KAAK,KAAK,OAAO,EAAE;QAC5B,MAAM,2BAAI,UAAU,IAAI,MAAM,GAAK,SAAS,CAAC,CAAC;KAC/C;SAAM,IAAI,KAAK,KAAK,MAAM,EAAE;QAC3B,MAAM,2BAAI,SAAS,IAAI,MA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AM,IAAI,CAAC,MAAM,CAAC;YAC1B,QAAQ,UAAA;YACR,GAAG,EAAE,sBAAc,CAAC,GAAG,CAAC;SACzB,CAAC,CAAC;KACJ;IAED;;OAEG;IACH,IAAI,KAAK,EAAE;QACT,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACvB;IAED;;OAEG;IACH,IAAI,UAAU,EAAE;QACd,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;KACjC;IAED,2BAA2B;IAC3B,CAAC,MAAM,EAAE,MAAM,CAAC;SACb,MAAM,CAAC,UAAC,CAAS,IAAK,OAAA,CAAC,KAAK,UAAU,EAAhB,CAAgB,CAAC;SACvC,OAAO,CAAC,UAAC,CAAS;QACjB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACL,6CACK,MAAM;QACT,gFAAgF;QAChF,GAAG,EAAE,EAAE,QAAQ,UAAA,EAAE,IACjB;AACJ,CAAC;AAzID,4BAyIC","sourcesContent":["import { uniq, isFunction, isObject, isString, isNumber, isEmpty } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum, RawFields } from '../../types';\nimport { Label } from '../../types/label';\nimport { State } from '../../types/state';\nimport { transformLabel } from '../../utils';\n\n/**\n * 图形映射属性,按照优先级来的\n */\nexport type MappingOptions = {\n /** color 映射 */\n readonly color?: ColorAttr;\n /** shape 映射 */\n readonly shape?: ShapeAttr;\n /** 大小映射, 提供回调的方式 */\n readonly size?: SizeAttr;\n /** 样式映射 */\n readonly style?: StyleAttr;\n /** tooltip 映射 */\n readonly tooltip?: TooltipAttr;\n};\n\n/**\n * 一个图形映射的逻辑,纯粹的图形语法\n * // TODO 后续需要处理 adjust 的配置,然后通过 field 信息。比如 styleField,labelField 等一定是一个数组形式\n */\nexport type Geometry = {\n /** geometry 类型, 'line' | 'interval' | 'point' | 'area' | 'polygon' */\n readonly type?: string;\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly colorField?: string;\n /** shape 的映射字段 */\n readonly shapeField?: string;\n /** size 映射字段 */\n readonly sizeField?: string;\n /** style 的映射字段 */\n readonly styleField?: string;\n /** tooltip 的映射字段 */\n readonly tooltipFields?: string[] | false;\n /** 其他原始字段, 用于 mapping 回调参数 */\n readonly rawFields?: RawFields;\n /** 图形映射规则 */\n readonly mapping?: MappingOptions;\n /** label 映射通道,因为历史原因导致实现略有区别 */\n readonly label?: Label;\n /** 不同状态的样式 */\n readonly state?: State;\n /** 自定义信息,一般在 registerShape 中使用 */\n readonly customInfo?: any;\n /** geometry params */\n readonly args?: any;\n};\n\n/**\n * geometry options\n */\nexport type GeometryOptions = Geometry & Partial<Options>;\n\n/**\n * 获得映射的字段列表\n * @param options\n * @param field\n */\nexport function getMappingField(\n o: GeometryOptions,\n field: 'color' | 'shape' | 'size' | 'style'\n): {\n mappingFields: string[];\n tileMappingField: string;\n} {\n const { type, xField, yField, colorField, shapeField, sizeField, styleField } = o;\n let { rawFields } = o;\n\n let fields = [];\n rawFields = (isFunction(rawFields) ? rawFields(type, field) : rawFields) || [];\n\n // 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效\n // 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields\n // shape, size 同理\n if (field === 'color') {\n fields = [colorField || xField, ...rawFields];\n } else if (field === 'shape') {\n fields = [shapeField || xField, ...rawFields];\n } else if (field === 'size') {\n fields = [sizeField || xField, ...rawFields];\n } else {\n fields = [xField, yField, colorField, shapeField, sizeField, styleField, ...rawFields];\n\n // 一定能找到的!\n const idx = ['x', 'y', 'color', 'shape', 'size', 'style'].indexOf(field);\n\n const f = fields[idx];\n // 删除当前字段\n fields.splice(idx, 1);\n // 插入到第一个\n fields.unshift(f);\n }\n\n const mappingFields = uniq(fields.filter((f) => !!f));\n /**\n * 修复 line geometry 无拆分时 color 回调错误\n * eg:\n * geometry.color(xField, ()=> '#f24')\n */\n const tileMappingField =\n type === 'line' && [xField, yField].includes(mappingFields.join('*')) ? '' : mappingFields.join('*');\n return {\n mappingFields,\n tileMappingField,\n };\n}\n\n/**\n * 获得映射函数\n * @param mappingFields\n * @param func\n */\nexport function getMappingFunction(mappingFields: string[], func: (datum: Datum) => any) {\n if (!func) return undefined;\n // 返回函数\n return (...args: any[]) => {\n const params: Datum = {};\n\n mappingFields.forEach((f: string, idx: number) => {\n params[f] = args[idx];\n });\n\n // 删除 undefined\n delete params['undefined'];\n\n return func(params);\n };\n}\n\n/**\n * 通用 geometry 的配置处理的 adaptor\n * @param params\n */\nexport function geometry<O extends GeometryOptions>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const {\n type,\n args,\n mapping,\n xField,\n yField,\n colorField,\n shapeField,\n sizeField,\n tooltipFields,\n label,\n state,\n customInfo,\n } = options;\n\n // 如果没有 mapping 信息,那么直接返回\n if (!mapping) {\n return params;\n }\n\n const { color, shape, size, style, tooltip } = mapping;\n\n // 创建 geometry\n const geometry = chart[type](args).position(`${xField}*${yField}`);\n\n /**\n * color 的几种情况\n * g.color('red');\n * g.color('color', ['red', 'blue']);\n * g.color('x', (x, y) => 'red');\n * g.color('color', (color, x, y) => 'red');\n */\n if (isString(color)) {\n colorField ? geometry.color(colorField, color) : geometry.color(color);\n } else if (isFunction(color)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'color');\n geometry.color(tileMappingField, getMappingFunction(mappingFields, color));\n } else {\n colorField && geometry.color(colorField, color);\n }\n\n /**\n * shape 的几种情况\n * g.shape('rect');\n * g.shape('shape', ['rect', 'circle']);\n * g.shape('x*y', (x, y) => 'rect');\n * g.shape('shape*x*y', (shape, x, y) => 'rect');\n */\n if (isString(shape)) {\n shapeField ? geometry.shape(shapeField, [shape]) : geometry.shape(shape); // [shape] 需要在 G2 做掉\n } else if (isFunction(shape)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'shape');\n geometry.shape(tileMappingField, getMappingFunction(mappingFields, shape));\n } else {\n shapeField && geometry.shape(shapeField, shape);\n }\n\n /**\n * size 的几种情况\n * g.size(10);\n * g.size('size', [10, 20]);\n * g.size('x*y', (x, y) => 10);\n * g.color('size*x*y', (size, x, y) => 1-);\n */\n if (isNumber(size)) {\n sizeField ? geometry.size(sizeField, size) : geometry.size(size);\n } else if (isFunction(size)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'size');\n geometry.size(tileMappingField, getMappingFunction(mappingFields, size));\n } else {\n sizeField && geometry.size(sizeField, size);\n }\n\n /**\n * style 的几种情况\n * g.style({ fill: 'red' });\n * g.style('x*y*color', (x, y, color) => ({ fill: 'red' }));\n */\n if (isFunction(style)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'style');\n geometry.style(tileMappingField, getMappingFunction(mappingFields, style));\n } else if (isObject(style)) {\n geometry.style(style);\n }\n\n /**\n * tooltip 的 API\n * g.tooltip('x*y*color', (x, y, color) => ({ name, value }));\n * g.tooltip(false);\n */\n if (tooltipFields === false) {\n geometry.tooltip(false);\n } else if (!isEmpty(tooltipFields)) {\n geometry.tooltip(tooltipFields.join('*'), getMappingFunction(tooltipFields, tooltip));\n }\n\n /**\n * label 的映射\n */\n if (label === false) {\n geometry.label(false);\n } else if (label) {\n const { callback, fields, ...cfg } = label;\n geometry.label({\n fields: fields || [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n /**\n * state 状态样式\n */\n if (state) {\n geometry.state(state);\n }\n\n /**\n * 自定义信息\n */\n if (customInfo) {\n geometry.customInfo(customInfo);\n }\n\n // 防止因为 x y 字段做了通道映射,导致生成图例\n [xField, yField]\n .filter((f: string) => f !== colorField)\n .forEach((f: string) => {\n chart.legend(f, false);\n });\n return {\n ...params,\n // geometry adaptor 额外需要做的事情,就是将创建好的 geometry 返回到下一层 adaptor,防止通过 type 查询的时候容易误判\n ext: { geometry },\n };\n}\n"]}
|
package/lib/adaptor/pattern.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ import { Options } from '../types';
|
|
|
7
7
|
* @param key key of style property
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function pattern(key: string): <O extends Pick<Options, "label" | "legend" | "meta" | "padding" | "
|
|
10
|
+
export declare function pattern(key: string): <O extends Pick<Options, "label" | "legend" | "meta" | "padding" | "color" | "animation" | "height" | "width" | "appendPadding" | "renderer" | "pixelRatio" | "autoFit" | "syncViewPadding" | "supportCSSTransform" | "limitInPlot" | "locale" | "defaultInteractions" | "localRefresh" | "useDeferredLabel" | "theme" | "pattern" | "xAxis" | "yAxis" | "tooltip" | "slider" | "scrollbar" | "interactions" | "annotations" | "state"> = Pick<Options, "label" | "legend" | "meta" | "padding" | "color" | "animation" | "height" | "width" | "appendPadding" | "renderer" | "pixelRatio" | "autoFit" | "syncViewPadding" | "supportCSSTransform" | "limitInPlot" | "locale" | "defaultInteractions" | "localRefresh" | "useDeferredLabel" | "theme" | "pattern" | "xAxis" | "yAxis" | "tooltip" | "slider" | "scrollbar" | "interactions" | "annotations" | "state">>(params: Params<O>) => Params<O>;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.adaptors = exports.registerLocale = exports.G2 = exports.version = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
exports.version = '2.4.
|
|
5
|
+
exports.version = '2.4.22';
|
|
6
6
|
// G2 自定义能力透出
|
|
7
7
|
var G2 = tslib_1.__importStar(require("@antv/g2"));
|
|
8
8
|
exports.G2 = G2;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,mDAA+B;AAC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pB,mCAAyC;AAAhC,0FAAA,GAAG,OAAO;AAGnB,2DAA2D;AAC3D,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAGd,uCAAuC;AACvC,iCAAiD;AAAxC,6FAAA,IAAI,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAE/B,0CAA0C;AAC1C,mDAAoF;AAA3E,kGAAA,IAAI,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,qGAAA,OAAO,OAAA;AAAE,oGAAA,MAAM,OAAA;AASrD,uCAAuC;AACvC,2CAAqG;AACxF,QAAA,QAAQ,GAAG,EAAE,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC;AAE9F,oDAAoD;AACpD,6BAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export const version = '2.4.19';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid, addWaterWave } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,mDAA+B;AACtB,gBAAE;AAEX,QAAQ;AACR,wCAA+C;AAOtC,+FAPA,uBAAc,OAOA;AANvB,yCAA+C;AAC/C,yCAA+C;AAC/C,8BAA8B;AAC9B,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAItC,WAAW;AACX,wCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAElB,uBAAuB;AACvB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AAKb,SAAS;AACT,kDAAwB;AAExB,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,uDAAuD;AACvD,yCAAwC;AAA/B,gGAAA,MAAM,OAAA;AAGf,yDAAyD;AACzD,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAGZ,0DAA0D;AAC1D,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAGZ,uEAAuE;AACvE,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,uEAAuE;AACvE,iDAA+C;AAAtC,uGA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AAAtC,uGAAA,SAAS,OAAA;AAGlB,+DAA+D;AAC/D,+DAA6D;AAApD,qHAAA,gBAAgB,OAAA;AAGzB,OAAO;AACP,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAGhB,2DAA2D;AAC3D,yCAAwC;AAA/B,gGAAA,MAAM,OAAA;AAGf,uGAAuG;AACvG,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAGd,6GAA6G;AAC7G,yDAAuD;AAA9C,+GAAA,aAAa,OAAA;AAGtB,2BAA2B;AAC3B,mEAAmE;AACnE,mCAA6B;AAApB,2FAAA,CAAC,OAAA;AAEV,8BAA8B;AAC9B,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AAEzB,eAAe;AACf,mCAA+C;AAAtC,gGAAA,GAAG,OAAa;AAEzB,oBAAoB;AACpB,mCAAyC;AAAhC,0FAAA,GAAG,OAAO;AAGnB,2DAA2D;AAC3D,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAGd,uCAAuC;AACvC,iCAAiD;AAAxC,6FAAA,IAAI,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAE/B,0CAA0C;AAC1C,mDAAoF;AAA3E,kGAAA,IAAI,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,qGAAA,OAAO,OAAA;AAAE,oGAAA,MAAM,OAAA;AASrD,uCAAuC;AACvC,2CAAqG;AACxF,QAAA,QAAQ,GAAG,EAAE,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC;AAE9F,oDAAoD;AACpD,6BAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export const version = '2.4.22';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid, addWaterWave } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n"]}
|
|
@@ -9,11 +9,16 @@ declare function isPointInView(context: any): any;
|
|
|
9
9
|
/**
|
|
10
10
|
* 获取 交互 start 阶段的相关配置
|
|
11
11
|
*/
|
|
12
|
-
export declare function getInteractionCfg(interactionType: string, brushType?: string,
|
|
13
|
-
showEnable: {
|
|
12
|
+
export declare function getInteractionCfg(interactionType: string, brushType?: string, options?: BrushCfg): {
|
|
13
|
+
showEnable: ({
|
|
14
14
|
trigger: string;
|
|
15
15
|
action: string;
|
|
16
|
-
|
|
16
|
+
isEnable: ((context: any) => boolean) | (() => true);
|
|
17
|
+
} | {
|
|
18
|
+
trigger: string;
|
|
19
|
+
action: string;
|
|
20
|
+
isEnable?: undefined;
|
|
21
|
+
})[];
|
|
17
22
|
start: {
|
|
18
23
|
trigger: string;
|
|
19
24
|
isEnable: typeof isPointInView;
|
|
@@ -37,13 +42,18 @@ export declare function getInteractionCfg(interactionType: string, brushType?: s
|
|
|
37
42
|
action: string[];
|
|
38
43
|
}[];
|
|
39
44
|
} | {
|
|
40
|
-
showEnable: {
|
|
45
|
+
showEnable: ({
|
|
41
46
|
trigger: string;
|
|
42
47
|
action: string;
|
|
43
|
-
|
|
48
|
+
isEnable: ((context: any) => boolean) | (() => true);
|
|
49
|
+
} | {
|
|
50
|
+
trigger: string;
|
|
51
|
+
action: string;
|
|
52
|
+
isEnable?: undefined;
|
|
53
|
+
})[];
|
|
44
54
|
start: ({
|
|
45
55
|
trigger: string;
|
|
46
|
-
isEnable(context: any)
|
|
56
|
+
isEnable: (context: any) => boolean;
|
|
47
57
|
action: string[];
|
|
48
58
|
arg: {
|
|
49
59
|
maskStyle: import("@antv/g2").ShapeAttrs;
|
|
@@ -51,6 +61,7 @@ export declare function getInteractionCfg(interactionType: string, brushType?: s
|
|
|
51
61
|
} | {
|
|
52
62
|
trigger: string;
|
|
53
63
|
action: string[];
|
|
64
|
+
isEnable?: undefined;
|
|
54
65
|
arg?: undefined;
|
|
55
66
|
})[];
|
|
56
67
|
processing: {
|
|
@@ -60,6 +71,7 @@ export declare function getInteractionCfg(interactionType: string, brushType?: s
|
|
|
60
71
|
end: ({
|
|
61
72
|
trigger: string;
|
|
62
73
|
action: string[];
|
|
74
|
+
isEnable?: undefined;
|
|
63
75
|
} | {
|
|
64
76
|
trigger: string;
|
|
65
77
|
isEnable(context: any): boolean;
|
|
@@ -19,19 +19,20 @@ function isPointInView(context) {
|
|
|
19
19
|
/**
|
|
20
20
|
* 获取 交互 start 阶段的相关配置
|
|
21
21
|
*/
|
|
22
|
-
function getInteractionCfg(interactionType, brushType,
|
|
22
|
+
function getInteractionCfg(interactionType, brushType, options) {
|
|
23
|
+
var _a = options || {}, mask = _a.mask, isStartEnable = _a.isStartEnable;
|
|
23
24
|
var maskType = brushType || 'rect';
|
|
24
25
|
switch (interactionType) {
|
|
25
26
|
case 'brush':
|
|
26
27
|
return {
|
|
27
28
|
showEnable: [
|
|
28
|
-
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
|
29
|
+
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair', isEnable: isStartEnable || (function () { return true; }) },
|
|
29
30
|
{ trigger: 'plot:mouseleave', action: 'cursor:default' },
|
|
30
31
|
],
|
|
31
32
|
start: [
|
|
32
33
|
{
|
|
33
34
|
trigger: 'mousedown',
|
|
34
|
-
isEnable: isPointInView,
|
|
35
|
+
isEnable: isStartEnable || isPointInView,
|
|
35
36
|
action: ['brush:start', maskType + "-mask:start", maskType + "-mask:show"],
|
|
36
37
|
// 对应第二个action的参数
|
|
37
38
|
arg: [null, { maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }],
|
|
@@ -67,18 +68,25 @@ function getInteractionCfg(interactionType, brushType, mask) {
|
|
|
67
68
|
case 'brush-highlight':
|
|
68
69
|
return {
|
|
69
70
|
showEnable: [
|
|
70
|
-
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
|
71
|
-
{ trigger: '
|
|
71
|
+
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair', isEnable: isStartEnable || (function () { return true; }) },
|
|
72
|
+
{ trigger: 'plot:mousemove', action: 'cursor:crosshair', isEnable: isStartEnable || (function () { return true; }) },
|
|
73
|
+
{
|
|
74
|
+
trigger: 'plot:mousemove',
|
|
75
|
+
action: 'cursor:default',
|
|
76
|
+
isEnable: function (context) { return (isStartEnable ? !isStartEnable(context) : false); },
|
|
77
|
+
},
|
|
78
|
+
{ trigger: 'mask:mouseenter', action: 'cursor:move', isEnable: isStartEnable || (function () { return true; }) },
|
|
72
79
|
{ trigger: 'plot:mouseleave', action: 'cursor:default' },
|
|
73
80
|
{ trigger: 'mask:mouseleave', action: 'cursor:crosshair' },
|
|
74
81
|
],
|
|
75
82
|
start: [
|
|
76
83
|
{
|
|
77
84
|
trigger: 'plot:mousedown',
|
|
78
|
-
isEnable:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
isEnable: isStartEnable ||
|
|
86
|
+
(function (context) {
|
|
87
|
+
// 不要点击在 mask 上重新开始
|
|
88
|
+
return !context.isInShape('mask');
|
|
89
|
+
}),
|
|
82
90
|
action: [maskType + "-mask:start", maskType + "-mask:show"],
|
|
83
91
|
// 对应第 1 个action的参数
|
|
84
92
|
arg: [{ maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }],
|
|
@@ -118,13 +126,13 @@ function getInteractionCfg(interactionType, brushType, mask) {
|
|
|
118
126
|
case 'brush-x':
|
|
119
127
|
return {
|
|
120
128
|
showEnable: [
|
|
121
|
-
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
|
129
|
+
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair', isEnable: isStartEnable || (function () { return true; }) },
|
|
122
130
|
{ trigger: 'plot:mouseleave', action: 'cursor:default' },
|
|
123
131
|
],
|
|
124
132
|
start: [
|
|
125
133
|
{
|
|
126
134
|
trigger: 'mousedown',
|
|
127
|
-
isEnable: isPointInView,
|
|
135
|
+
isEnable: isStartEnable || isPointInView,
|
|
128
136
|
action: ['brush-x:start', maskType + "-mask:start", maskType + "-mask:show"],
|
|
129
137
|
// 对应第二个action的参数
|
|
130
138
|
arg: [null, { maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }],
|
|
@@ -149,18 +157,19 @@ function getInteractionCfg(interactionType, brushType, mask) {
|
|
|
149
157
|
case 'brush-x-highlight':
|
|
150
158
|
return {
|
|
151
159
|
showEnable: [
|
|
152
|
-
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
|
153
|
-
{ trigger: 'mask:mouseenter', action: 'cursor:move' },
|
|
160
|
+
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair', isEnable: isStartEnable || (function () { return true; }) },
|
|
161
|
+
{ trigger: 'mask:mouseenter', action: 'cursor:move', isEnable: isStartEnable || (function () { return true; }) },
|
|
154
162
|
{ trigger: 'plot:mouseleave', action: 'cursor:default' },
|
|
155
163
|
{ trigger: 'mask:mouseleave', action: 'cursor:crosshair' },
|
|
156
164
|
],
|
|
157
165
|
start: [
|
|
158
166
|
{
|
|
159
167
|
trigger: 'plot:mousedown',
|
|
160
|
-
isEnable:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
168
|
+
isEnable: isStartEnable ||
|
|
169
|
+
(function (context) {
|
|
170
|
+
// 不要点击在 mask 上重新开始
|
|
171
|
+
return !context.isInShape('mask');
|
|
172
|
+
}),
|
|
164
173
|
action: [maskType + "-mask:start", maskType + "-mask:show"],
|
|
165
174
|
// 对应第 1 个action的参数
|
|
166
175
|
arg: [{ maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }],
|
|
@@ -200,13 +209,13 @@ function getInteractionCfg(interactionType, brushType, mask) {
|
|
|
200
209
|
case 'brush-y':
|
|
201
210
|
return {
|
|
202
211
|
showEnable: [
|
|
203
|
-
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
|
212
|
+
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair', isEnable: isStartEnable || (function () { return true; }) },
|
|
204
213
|
{ trigger: 'plot:mouseleave', action: 'cursor:default' },
|
|
205
214
|
],
|
|
206
215
|
start: [
|
|
207
216
|
{
|
|
208
217
|
trigger: 'mousedown',
|
|
209
|
-
isEnable: isPointInView,
|
|
218
|
+
isEnable: isStartEnable || isPointInView,
|
|
210
219
|
action: ['brush-y:start', maskType + "-mask:start", maskType + "-mask:show"],
|
|
211
220
|
// 对应第二个action的参数
|
|
212
221
|
arg: [null, { maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }],
|
|
@@ -231,18 +240,19 @@ function getInteractionCfg(interactionType, brushType, mask) {
|
|
|
231
240
|
case 'brush-y-highlight':
|
|
232
241
|
return {
|
|
233
242
|
showEnable: [
|
|
234
|
-
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
|
235
|
-
{ trigger: 'mask:mouseenter', action: 'cursor:move' },
|
|
243
|
+
{ trigger: 'plot:mouseenter', action: 'cursor:crosshair', isEnable: isStartEnable || (function () { return true; }) },
|
|
244
|
+
{ trigger: 'mask:mouseenter', action: 'cursor:move', isEnable: isStartEnable || (function () { return true; }) },
|
|
236
245
|
{ trigger: 'plot:mouseleave', action: 'cursor:default' },
|
|
237
246
|
{ trigger: 'mask:mouseleave', action: 'cursor:crosshair' },
|
|
238
247
|
],
|
|
239
248
|
start: [
|
|
240
249
|
{
|
|
241
250
|
trigger: 'plot:mousedown',
|
|
242
|
-
isEnable:
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
251
|
+
isEnable: isStartEnable ||
|
|
252
|
+
(function (context) {
|
|
253
|
+
// 不要点击在 mask 上重新开始
|
|
254
|
+
return !context.isInShape('mask');
|
|
255
|
+
}),
|
|
246
256
|
action: [maskType + "-mask:start", maskType + "-mask:show"],
|
|
247
257
|
// 对应第 1 个action的参数
|
|
248
258
|
arg: [{ maskStyle: mask === null || mask === void 0 ? void 0 : mask.style }],
|