From 694c75d6d397cc5294c871ac32c59e18e22546cb Mon Sep 17 00:00:00 2001 From: hustcc Date: Mon, 21 Dec 2020 15:26:22 +0800 Subject: [PATCH 1/2] fix(esm): remove all import of lib --- src/animate/animation/sector-path-update.ts | 4 +++- src/dependents.ts | 24 ++++++++++++------- src/geometry/element/index.ts | 4 +++- .../action/component/list-highlight-util.ts | 4 +++- src/interaction/action/util.ts | 2 +- src/interaction/action/view/button.ts | 2 +- src/theme/util/create-by-style-sheet.ts | 4 +++- 7 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/animate/animation/sector-path-update.ts b/src/animate/animation/sector-path-update.ts index cd8bdbfc3b..1d921fcb14 100644 --- a/src/animate/animation/sector-path-update.ts +++ b/src/animate/animation/sector-path-update.ts @@ -1,4 +1,6 @@ -import getArcParams from '@antv/g-canvas/lib/util/arc-params'; +// TODO: 暂未发包 +// @ts-ignore +import { getArcParams } from '@antv/g-canvas'; import { isNumberEqual, isEqual } from '@antv/util'; import { IShape, PathCommand } from '../../dependents'; diff --git a/src/dependents.ts b/src/dependents.ts index e2d797363d..b2045716ad 100644 --- a/src/dependents.ts +++ b/src/dependents.ts @@ -1,17 +1,19 @@ /* 依赖的模块,在这里统一引入,方便打包优化 */ // G -export { ICanvas, IElement, IGroup, IShape } from '@antv/g-base/lib/interfaces'; -export { PathCommand, BBox, Point, ShapeAttrs } from '@antv/g-base/lib/types'; -export { Event, AbstractGroup, AbstractShape } from '@antv/g-base'; +export { + ICanvas, IElement, IGroup, IShape, + PathCommand, BBox, Point, ShapeAttrs, + Event, AbstractGroup, AbstractShape +} from '@antv/g-base'; // 需要有 G-base 提供 g engine 类型定义 export type IG = any; // adjust -export { registerAdjust, getAdjust, Adjust } from '@antv/adjust/lib/factory'; +export { registerAdjust, getAdjust, Adjust } from '@antv/adjust'; // attr -export { getAttribute, Attribute } from '@antv/attr/lib/factory'; +export { getAttribute, Attribute } from '@antv/attr'; export { Color } from '@antv/attr'; // coordinate @@ -19,7 +21,9 @@ export { getCoordinate, registerCoordinate, Coordinate, CoordinateCfg } from '@a // scale export { getScale, registerScale, Scale, ScaleConfig } from '@antv/scale'; -export { Tick } from '@antv/scale/lib/types'; +// TODO: scale 暂时还没有发包 +// @ts-ignore +export { Tick } from '@antv/scale'; // component import { @@ -35,7 +39,11 @@ import { Tooltip, Scrollbar, } from '@antv/component'; -export { IComponent, IList } from '@antv/component/lib/interfaces'; +// TODO: 暂未发包 +// @ts-ignore +export { IComponent, IList } from '@antv/component'; +// TODO: 暂未发包 +// @ts-ignore export { CategoryLegendCfg, CircleAxisCfg, @@ -65,7 +73,7 @@ export { TrendCfg, EnhancedTextCfg, LineAnnotationTextCfg, -} from '@antv/component/lib/types'; +} from '@antv/component'; export { HtmlComponent, GroupComponent, Component, Crosshair }; export { Annotation }; // axis diff --git a/src/geometry/element/index.ts b/src/geometry/element/index.ts index b034a349ed..b1418968fa 100644 --- a/src/geometry/element/index.ts +++ b/src/geometry/element/index.ts @@ -1,5 +1,7 @@ import { deepMix, each, get, isArray, isEmpty, isEqual, isFunction, isString } from '@antv/util'; -import { propagationDelegate } from '@antv/component/lib/util/event'; +// 暂未发包 +// @ts-ignore +import { propagationDelegate } from '@antv/component'; import { doAnimate } from '../../animate'; import Base from '../../base'; import { BBox, IGroup, IShape } from '../../dependents'; diff --git a/src/interaction/action/component/list-highlight-util.ts b/src/interaction/action/component/list-highlight-util.ts index cebcf1a220..4e89acc287 100644 --- a/src/interaction/action/component/list-highlight-util.ts +++ b/src/interaction/action/component/list-highlight-util.ts @@ -1,4 +1,6 @@ -import { IList } from '@antv/component/lib/interfaces'; +// TODO: 暂未发包 +// @ts-ignore +import { IList } from '@antv/component'; import { each } from '@antv/util'; const STATUS_UNACTIVE = 'inactive'; diff --git a/src/interaction/action/util.ts b/src/interaction/action/util.ts index 50e730f3bc..ee05d5ac33 100644 --- a/src/interaction/action/util.ts +++ b/src/interaction/action/util.ts @@ -5,7 +5,7 @@ import Geometry from '../../geometry/base'; import Element from '../../geometry/element/'; import { catmullRom2bezier, getLinePath } from '../../geometry/shape/util/path'; import { toPoints } from '../../util/bbox'; -import isPolygonsIntersect from '@antv/path-util/lib/is-polygons-intersect'; +import { isPolygonsIntersect } from '@antv/path-util'; import { ComponentOption, IInteractionContext, LooseObject } from '../../interface'; function getMaskBBox(context: IInteractionContext, tolerance: number) { diff --git a/src/interaction/action/view/button.ts b/src/interaction/action/view/button.ts index 5d5fdea84c..c644bc9b99 100644 --- a/src/interaction/action/view/button.ts +++ b/src/interaction/action/view/button.ts @@ -1,4 +1,4 @@ -import { LooseObject } from '@antv/component/lib/types'; +import { LooseObject } from '../../../interface'; import { IGroup } from '@antv/g-base'; import { ext } from '@antv/matrix-util'; import { deepMix } from '@antv/util'; diff --git a/src/theme/util/create-by-style-sheet.ts b/src/theme/util/create-by-style-sheet.ts index 83eb2b7b5d..0315e217d6 100644 --- a/src/theme/util/create-by-style-sheet.ts +++ b/src/theme/util/create-by-style-sheet.ts @@ -1,4 +1,6 @@ -import * as TOOLTIP_CSS_CONST from '@antv/component/lib/tooltip/css-const'; +// TODO: 暂未发包 +// @ts-ignore +import { TOOLTIP_CSS_CONST } from '@antv/component'; import { ext } from '@antv/matrix-util'; import { deepMix } from '@antv/util'; import Element from '../../geometry/element'; From bc8b382286dd7ed330c31fd1f5bfa4246c5666b0 Mon Sep 17 00:00:00 2001 From: hustcc Date: Mon, 21 Dec 2020 17:55:12 +0800 Subject: [PATCH 2/2] chore: fix ci --- package.json | 2 +- src/animate/animation/sector-path-update.ts | 2 -- src/core.ts | 2 +- src/dependents.ts | 14 +++++--------- .../action/component/list-highlight-util.ts | 2 -- src/theme/util/create-by-style-sheet.ts | 2 -- tests/bugs/2173-spec.ts | 2 +- tests/unit/component/axis-circle-spec.ts | 2 +- 8 files changed, 9 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 347ea510f2..f593d9fe99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g2", - "version": "4.1.3", + "version": "4.1.4", "description": "the Grammar of Graphics in Javascript", "main": "lib/index.js", "module": "esm/index.js", diff --git a/src/animate/animation/sector-path-update.ts b/src/animate/animation/sector-path-update.ts index 1d921fcb14..7bcad8a61a 100644 --- a/src/animate/animation/sector-path-update.ts +++ b/src/animate/animation/sector-path-update.ts @@ -1,5 +1,3 @@ -// TODO: 暂未发包 -// @ts-ignore import { getArcParams } from '@antv/g-canvas'; import { isNumberEqual, isEqual } from '@antv/util'; diff --git a/src/core.ts b/src/core.ts index 0bf17b06b9..4b656d977b 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1,6 +1,6 @@ /* G2 的一个壳子,不包含 Geometry,由开发者自己定义和引入 */ -export const VERSION = '4.1.3'; +export const VERSION = '4.1.4'; // 核心基类导出 export { Chart, View, Event } from './chart'; // Chart, View 类 diff --git a/src/dependents.ts b/src/dependents.ts index b2045716ad..b3ebe07f91 100644 --- a/src/dependents.ts +++ b/src/dependents.ts @@ -20,10 +20,7 @@ export { Color } from '@antv/attr'; export { getCoordinate, registerCoordinate, Coordinate, CoordinateCfg } from '@antv/coord'; // scale -export { getScale, registerScale, Scale, ScaleConfig } from '@antv/scale'; -// TODO: scale 暂时还没有发包 -// @ts-ignore -export { Tick } from '@antv/scale'; +export { getScale, registerScale, Scale, ScaleConfig, Tick } from '@antv/scale'; // component import { @@ -39,11 +36,7 @@ import { Tooltip, Scrollbar, } from '@antv/component'; -// TODO: 暂未发包 -// @ts-ignore -export { IComponent, IList } from '@antv/component'; -// TODO: 暂未发包 -// @ts-ignore + export { CategoryLegendCfg, CircleAxisCfg, @@ -73,7 +66,10 @@ export { TrendCfg, EnhancedTextCfg, LineAnnotationTextCfg, + IComponent, + IList, } from '@antv/component'; + export { HtmlComponent, GroupComponent, Component, Crosshair }; export { Annotation }; // axis diff --git a/src/interaction/action/component/list-highlight-util.ts b/src/interaction/action/component/list-highlight-util.ts index 4e89acc287..de3d2af422 100644 --- a/src/interaction/action/component/list-highlight-util.ts +++ b/src/interaction/action/component/list-highlight-util.ts @@ -1,5 +1,3 @@ -// TODO: 暂未发包 -// @ts-ignore import { IList } from '@antv/component'; import { each } from '@antv/util'; diff --git a/src/theme/util/create-by-style-sheet.ts b/src/theme/util/create-by-style-sheet.ts index 0315e217d6..d388b966c1 100644 --- a/src/theme/util/create-by-style-sheet.ts +++ b/src/theme/util/create-by-style-sheet.ts @@ -1,5 +1,3 @@ -// TODO: 暂未发包 -// @ts-ignore import { TOOLTIP_CSS_CONST } from '@antv/component'; import { ext } from '@antv/matrix-util'; import { deepMix } from '@antv/util'; diff --git a/tests/bugs/2173-spec.ts b/tests/bugs/2173-spec.ts index 979f31595f..2b8b4dda56 100644 --- a/tests/bugs/2173-spec.ts +++ b/tests/bugs/2173-spec.ts @@ -46,6 +46,6 @@ describe('#2173', () => { it('legend should not be overlap', () => { const [l1, l2] = chart.getComponents().filter((co) => co.type === COMPONENT_TYPE.LEGEND); - expect(Math.abs(l1.component.getBBox().y - l2.component.getBBox().y)).toBe(13); + expect(Math.abs(l1.component.getBBox().y - l2.component.getBBox().y)).toBe(14); }); }); diff --git a/tests/unit/component/axis-circle-spec.ts b/tests/unit/component/axis-circle-spec.ts index 84ffa22a40..6eff962d91 100644 --- a/tests/unit/component/axis-circle-spec.ts +++ b/tests/unit/component/axis-circle-spec.ts @@ -59,7 +59,7 @@ describe('Component', () => { const grids = chart.getComponents().filter((co) => co.type === COMPONENT_TYPE.GRID); // circle grid 需要传入 coordinate 的 center - expect(grids[0].component.get('center')).toEqual({ x: 400, y: 285.5 }); + expect(grids[0].component.get('center')).toEqual({ x: 400, y: 285 }); }); it('linear x axis ticks', () => {