@antv/g2 4.2.1 → 4.2.2
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/dist/g2.min.js +3 -3
- package/dist/g2.min.js.map +1 -1
- package/esm/core.d.ts +1 -1
- package/esm/core.js +1 -1
- package/esm/core.js.map +1 -1
- package/esm/interaction/action/component/axis/axis-description.d.ts +1 -1
- package/esm/interaction/action/component/axis/axis-description.js +13 -17
- package/esm/interaction/action/component/axis/axis-description.js.map +1 -1
- package/lib/core.d.ts +1 -1
- package/lib/core.js +1 -1
- package/lib/core.js.map +1 -1
- package/lib/interaction/action/component/axis/axis-description.d.ts +1 -1
- package/lib/interaction/action/component/axis/axis-description.js +8 -12
- package/lib/interaction/action/component/axis/axis-description.js.map +1 -1
- package/package.json +1 -1
- package/src/core.ts +1 -1
- package/src/interaction/action/component/axis/axis-description.ts +36 -38
package/esm/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const VERSION = "4.2.
|
|
1
|
+
export declare const VERSION = "4.2.2";
|
|
2
2
|
export { Chart, View, Event } from './chart';
|
|
3
3
|
export { Controller as ComponentController } from './chart/controller/base';
|
|
4
4
|
export { default as TooltipController } from './chart/controller/tooltip';
|
package/esm/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* G2 的一个壳子,不包含 Geometry,由开发者自己定义和引入 */
|
|
2
|
-
export var VERSION = '4.2.
|
|
2
|
+
export var VERSION = '4.2.2';
|
|
3
3
|
// 核心基类导出
|
|
4
4
|
export { Chart, View, Event } from './chart'; // Chart, View 类
|
|
5
5
|
export { Controller as ComponentController } from './chart/controller/base'; // G2 组件基类
|
package/esm/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,uCAAuC;AAEvC,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC;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AA;IACf,gBAAgB;IAChB,OAAO,SAAA;IACP,aAAa,eAAA;CACd,CAAC","sourcesContent":["/* G2 的一个壳子,不包含 Geometry,由开发者自己定义和引入 */\n\nexport const VERSION = '4.2.2';\n\n// 核心基类导出\nexport { Chart, View, Event } from './chart'; // Chart, View 类\nexport { Controller as ComponentController } from './chart/controller/base'; // G2 组件基类\nexport { default as TooltipController } from './chart/controller/tooltip'; // G2 tooltip 组件基类\nexport { default as Geometry } from './geometry/base'; // Geometry 基类\nexport { default as Element } from './geometry/element'; // Element 类\nexport { default as GeometryLabel } from './geometry/label/base'; // Geometry Label 基类\nexport { Interaction, Action } from './interaction'; // Interaction, Action 基类\nexport { Facet } from './facet'; // Facet 基类\nexport { default as InteractionAction } from './interaction/action/base'; // Interaction Action 基类\n\n// 注册 ComponentController\nexport { registerComponentController } from './chart';\n\n// 注册 Geometry\nexport { registerGeometry } from './chart';\n\n// 注册 Geometry Shape\nexport { registerShape, registerShapeFactory, getShapeFactory } from './geometry/shape/base';\n\n// 注册 Geometry label 以及 Geometry Label 布局函数\nexport {\n registerGeometryLabel,\n registerGeometryLabelLayout,\n getGeometryLabel,\n getGeometryLabelLayout,\n} from './geometry/label';\n\n// 注册 interaction\nexport { getInteraction, registerInteraction, registerAction, getActionClass } from './interaction';\n\n// 注册 facet\nexport { getFacet, registerFacet } from './facet';\n\n// 注册主题\nexport { getTheme, registerTheme } from './theme';\n\n// G engine 管理相关\nexport { registerEngine, getEngine } from './engine';\n\n// 注册动画函数\nexport { registerAnimation, getAnimation } from './animate/animation';\n\nexport { LAYER, DIRECTION } from './constant';\n\n// 因为 typescript 部分版本不支持 export * as 语法。\nimport * as Types from './interface';\nexport type { Types };\n\nexport { IGroup, ShapeAttrs, Coordinate, Scale, ScaleConfig } from './dependents';\n\n// 一些工具方法导出\nimport { getMappingValue } from './util/attr';\nimport { getLegendItems } from './util/legend';\nimport { getAngle, getSectorPath, polarToCartesian } from './util/graphics';\nimport { rotate, transform, translate, zoom } from './util/transform';\nimport { getTooltipItems } from './util/tooltip';\nimport { getDelegationObject } from './interaction/action/util';\nimport { getPathPoints } from './geometry/shape/util/get-path-points';\nimport { getPath } from './geometry/shape/line';\n\nexport const Util = {\n getLegendItems,\n translate,\n rotate,\n zoom,\n transform,\n getAngle,\n getSectorPath,\n polarToCartesian,\n getDelegationObject,\n getTooltipItems,\n getMappingValue,\n // shape 的一些操作方法\n getPath,\n getPathPoints,\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __assign, __extends } from "tslib";
|
|
2
|
-
import { TOOLTIP_CSS_CONST } from
|
|
3
|
-
import { deepMix } from
|
|
4
|
-
import { HtmlTooltip } from
|
|
5
|
-
import Action from
|
|
6
|
-
import { getDelegationObject } from
|
|
2
|
+
import { TOOLTIP_CSS_CONST } from '@antv/component';
|
|
3
|
+
import { deepMix } from '@antv/util';
|
|
4
|
+
import { HtmlTooltip } from '../../../../dependents';
|
|
5
|
+
import Action from '../../base';
|
|
6
|
+
import { getDelegationObject } from '../../util';
|
|
7
7
|
var AXIS_DESCRIPTION_TOOLTIP = 'aixs-description-tooltip';
|
|
8
8
|
var AxisDescription = /** @class */ (function (_super) {
|
|
9
9
|
__extends(AxisDescription, _super);
|
|
@@ -13,19 +13,18 @@ var AxisDescription = /** @class */ (function (_super) {
|
|
|
13
13
|
AxisDescription.prototype.show = function () {
|
|
14
14
|
var context = this.context;
|
|
15
15
|
var axis = getDelegationObject(context).axis;
|
|
16
|
-
var _a = axis.cfg.title, description = _a.description, text = _a.text;
|
|
16
|
+
var _a = axis.cfg.title, description = _a.description, text = _a.text, descriptionTooltipStyle = _a.descriptionTooltipStyle;
|
|
17
17
|
var _b = context.event, x = _b.x, y = _b.y;
|
|
18
18
|
if (!this.tooltip) {
|
|
19
19
|
this.renderTooltip();
|
|
20
20
|
}
|
|
21
|
-
;
|
|
22
21
|
this.tooltip.update({
|
|
23
22
|
title: text || '',
|
|
24
23
|
customContent: function () {
|
|
25
|
-
return
|
|
24
|
+
return "\n <div class=\"".concat(TOOLTIP_CSS_CONST.CONTAINER_CLASS, "\" style={").concat(descriptionTooltipStyle, "}>\n <div class=\"").concat(TOOLTIP_CSS_CONST.TITLE_CLASS, "\">\n \u5B57\u6BB5\u8BF4\u660E\uFF1A").concat(description, "\n </div>\n </div>\n ");
|
|
26
25
|
},
|
|
27
26
|
x: x,
|
|
28
|
-
y: y
|
|
27
|
+
y: y,
|
|
29
28
|
});
|
|
30
29
|
this.tooltip.show();
|
|
31
30
|
};
|
|
@@ -53,17 +52,14 @@ var AxisDescription = /** @class */ (function (_super) {
|
|
|
53
52
|
// 超长的时候,tooltip tip 最大宽度为 50%,然后可以换行
|
|
54
53
|
_a[TOOLTIP_CSS_CONST.CONTAINER_CLASS] = {
|
|
55
54
|
'max-width': '50%',
|
|
56
|
-
|
|
57
|
-
'line-height': '15px'
|
|
55
|
+
padding: '10px',
|
|
56
|
+
'line-height': '15px',
|
|
57
|
+
'font-size': '12px',
|
|
58
|
+
color: 'rgba(0, 0, 0, .65)',
|
|
58
59
|
},
|
|
59
60
|
_a[TOOLTIP_CSS_CONST.TITLE_CLASS] = {
|
|
60
61
|
'word-break': 'break-all',
|
|
61
|
-
'
|
|
62
|
-
'margin-bottom': '3px'
|
|
63
|
-
},
|
|
64
|
-
_a[TOOLTIP_CSS_CONST.LIST_CLASS] = {
|
|
65
|
-
'word-break': 'break-all',
|
|
66
|
-
'opacity': '.5'
|
|
62
|
+
'margin-bottom': '3px',
|
|
67
63
|
},
|
|
68
64
|
_a))),
|
|
69
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axis-description.js","sourceRoot":"","sources":["../../../../../src/interaction/action/component/axis/axis-description.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,MAAM,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"axis-description.js","sourceRoot":"","sources":["../../../../../src/interaction/action/component/axis/axis-description.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,MAAM,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,IAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAE5D;IAA8B,mCAAM;IAApC;;IAyEA,CAAC;IAtEQ,8BAAI,GAAX;QACE,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QACrB,IAAA,IAAI,GAAK,mBAAmB,CAAC,OAAO,CAAC,KAAjC,CAAkC;QACxC,IAAA,KAAiD,IAAI,CAAC,GAAG,CAAC,KAAK,EAA7D,WAAW,iBAAA,EAAE,IAAI,UAAA,EAAE,uBAAuB,6BAAmB,CAAC;QAChE,IAAA,KAAW,OAAO,CAAC,KAAK,EAAtB,CAAC,OAAA,EAAE,CAAC,OAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,aAAa,EAAE,CAAC;SACtB;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YAClB,KAAK,EAAE,IAAI,IAAI,EAAE;YACjB,aAAa,EAAE;gBACb,OAAO,mCACS,iBAAiB,CAAC,eAAe,uBAAY,uBAAuB,0CAClE,iBAAiB,CAAC,WAAW,8DAClC,WAAW,qDAGvB,CAAC;YACJ,CAAC;YACD,CAAC,GAAA;YACD,CAAC,GAAA;SACF,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CA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QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACH,sBAAC;AAAD,CAAC,AAzED,CAA8B,MAAM,GAyEnC;AACD,eAAe,eAAe,CAAC","sourcesContent":["import { TOOLTIP_CSS_CONST } from '@antv/component';\nimport { deepMix } from '@antv/util';\nimport { HtmlTooltip } from '../../../../dependents';\nimport Action from '../../base';\nimport { getDelegationObject } from '../../util';\nimport cx from 'classnames';\n\nconst AXIS_DESCRIPTION_TOOLTIP = 'aixs-description-tooltip';\n\nclass AxisDescription extends Action {\n private tooltip;\n\n public show() {\n const context = this.context;\n const { axis } = getDelegationObject(context);\n const { description, text, descriptionTooltipStyle } = axis.cfg.title;\n const { x, y } = context.event;\n if (!this.tooltip) {\n this.renderTooltip();\n }\n this.tooltip.update({\n title: text || '',\n customContent: () => {\n return `\n <div class=\"${TOOLTIP_CSS_CONST.CONTAINER_CLASS}\" style={${descriptionTooltipStyle}}>\n <div class=\"${TOOLTIP_CSS_CONST.TITLE_CLASS}\">\n 字段说明:${description}\n </div>\n </div>\n `;\n },\n x,\n y,\n });\n this.tooltip.show();\n }\n\n public destroy() {\n super.destroy();\n this.tooltip && this.tooltip.destroy();\n }\n\n public hide() {\n this.tooltip && this.tooltip.hide();\n }\n\n public renderTooltip() {\n const view = this.context.view;\n const canvas = view.canvas;\n const region = {\n start: { x: 0, y: 0 },\n end: { x: canvas.get('width'), y: canvas.get('height') },\n };\n const tooltip = new HtmlTooltip({\n parent: canvas.get('el').parentNode,\n region,\n visible: false,\n containerId: AXIS_DESCRIPTION_TOOLTIP,\n domStyles: {\n ...deepMix(\n {},\n {\n // 超长的时候,tooltip tip 最大宽度为 50%,然后可以换行\n [TOOLTIP_CSS_CONST.CONTAINER_CLASS]: {\n 'max-width': '50%',\n padding: '10px',\n 'line-height': '15px',\n 'font-size': '12px',\n color: 'rgba(0, 0, 0, .65)',\n },\n [TOOLTIP_CSS_CONST.TITLE_CLASS]: {\n 'word-break': 'break-all',\n 'margin-bottom': '3px',\n },\n }\n ),\n },\n });\n tooltip.init();\n tooltip.setCapture(false);\n this.tooltip = tooltip;\n }\n}\nexport default AxisDescription;\n"]}
|
package/lib/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const VERSION = "4.2.
|
|
1
|
+
export declare const VERSION = "4.2.2";
|
|
2
2
|
export { Chart, View, Event } from './chart';
|
|
3
3
|
export { Controller as ComponentController } from './chart/controller/base';
|
|
4
4
|
export { default as TooltipController } from './chart/controller/tooltip';
|
package/lib/core.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Util = exports.Scale = exports.Coordinate = exports.DIRECTION = exports.LAYER = exports.getAnimation = exports.registerAnimation = exports.getEngine = exports.registerEngine = exports.registerTheme = exports.getTheme = exports.registerFacet = exports.getFacet = exports.getActionClass = exports.registerAction = exports.registerInteraction = exports.getInteraction = exports.getGeometryLabelLayout = exports.getGeometryLabel = exports.registerGeometryLabelLayout = exports.registerGeometryLabel = exports.getShapeFactory = exports.registerShapeFactory = exports.registerShape = exports.registerGeometry = exports.registerComponentController = exports.InteractionAction = exports.Facet = exports.Action = exports.Interaction = exports.GeometryLabel = exports.Element = exports.Geometry = exports.TooltipController = exports.ComponentController = exports.Event = exports.View = exports.Chart = exports.VERSION = void 0;
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
|
-
exports.VERSION = '4.2.
|
|
6
|
+
exports.VERSION = '4.2.2';
|
|
7
7
|
// 核心基类导出
|
|
8
8
|
var chart_1 = require("./chart"); // Chart, View 类
|
|
9
9
|
Object.defineProperty(exports, "Chart", { enumerable: true, get: function () { return chart_1.Chart; } });
|
package/lib/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;AAE1B,QAAA,OAAO,GAAG,OAAO,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AA,aAAa,OAAA;AAEhC,gBAAgB;AAChB,mCAAqD;AAA5C,wGAAA,cAAc,OAAA;AAAE,mGAAA,SAAS,OAAA;AAElC,SAAS;AACT,iDAAsE;AAA7D,8GAAA,iBAAiB,OAAA;AAAE,yGAAA,YAAY,OAAA;AAExC,uCAA8C;AAArC,iGAAA,KAAK,OAAA;AAAE,qGAAA,SAAS,OAAA;AAEzB,wCAAwC;AACxC,yDAAqC;AAGrC,2CAAkF;AAArD,wGAAA,UAAU,OAAA;AAAE,mGAAA,KAAK,OAAA;AAE9C,WAAW;AACX,oCAA8C;AAC9C,wCAA+C;AAC/C,4CAA4E;AAC5E,8CAAsE;AACtE,0CAAiD;AACjD,kDAAgE;AAChE,yEAAsE;AACtE,8CAAgD;AAEnC,QAAA,IAAI,GAAG;IAClB,cAAc,yBAAA;IACd,SAAS,uBAAA;IACT,MAAM,oBAAA;IACN,IAAI,kBAAA;IACJ,SAAS,uBAAA;IACT,QAAQ,qBAAA;IACR,aAAa,0BAAA;IACb,gBAAgB,6BAAA;IAChB,mBAAmB,4BAAA;IACnB,eAAe,2BAAA;IACf,eAAe,wBAAA;IACf,gBAAgB;IAChB,OAAO,gBAAA;IACP,aAAa,iCAAA;CACd,CAAC","sourcesContent":["/* G2 的一个壳子,不包含 Geometry,由开发者自己定义和引入 */\n\nexport const VERSION = '4.2.
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;AAE1B,QAAA,OAAO,GAAG,OAAO,CAAC;AAE/B,SAAS;AACT,iCAA6C,CAAC,gBAAgB;AAArD,8FAAA,KAAK,OAAA;AAAE,6FAAA,IAAI,OAAA;AAAE,8FAAA,KAAK,OAAA;AAC3B,gDAA4E,CAAC,UAAU;AAA9E,2GAAA,UAAU,OAAuB;AAC1C,sDAA0E,CAAC,kBAAkB;AAApF,qIAAA,OAAO,OAAqB;AACrC,wCAAsD,CAAC,cAAc;AAA5D,yHAAA,O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C,2CAAkF;AAArD,wGAAA,UAAU,OAAA;AAAE,mGAAA,KAAK,OAAA;AAE9C,WAAW;AACX,oCAA8C;AAC9C,wCAA+C;AAC/C,4CAA4E;AAC5E,8CAAsE;AACtE,0CAAiD;AACjD,kDAAgE;AAChE,yEAAsE;AACtE,8CAAgD;AAEnC,QAAA,IAAI,GAAG;IAClB,cAAc,yBAAA;IACd,SAAS,uBAAA;IACT,MAAM,oBAAA;IACN,IAAI,kBAAA;IACJ,SAAS,uBAAA;IACT,QAAQ,qBAAA;IACR,aAAa,0BAAA;IACb,gBAAgB,6BAAA;IAChB,mBAAmB,4BAAA;IACnB,eAAe,2BAAA;IACf,eAAe,wBAAA;IACf,gBAAgB;IAChB,OAAO,gBAAA;IACP,aAAa,iCAAA;CACd,CAAC","sourcesContent":["/* G2 的一个壳子,不包含 Geometry,由开发者自己定义和引入 */\n\nexport const VERSION = '4.2.2';\n\n// 核心基类导出\nexport { Chart, View, Event } from './chart'; // Chart, View 类\nexport { Controller as ComponentController } from './chart/controller/base'; // G2 组件基类\nexport { default as TooltipController } from './chart/controller/tooltip'; // G2 tooltip 组件基类\nexport { default as Geometry } from './geometry/base'; // Geometry 基类\nexport { default as Element } from './geometry/element'; // Element 类\nexport { default as GeometryLabel } from './geometry/label/base'; // Geometry Label 基类\nexport { Interaction, Action } from './interaction'; // Interaction, Action 基类\nexport { Facet } from './facet'; // Facet 基类\nexport { default as InteractionAction } from './interaction/action/base'; // Interaction Action 基类\n\n// 注册 ComponentController\nexport { registerComponentController } from './chart';\n\n// 注册 Geometry\nexport { registerGeometry } from './chart';\n\n// 注册 Geometry Shape\nexport { registerShape, registerShapeFactory, getShapeFactory } from './geometry/shape/base';\n\n// 注册 Geometry label 以及 Geometry Label 布局函数\nexport {\n registerGeometryLabel,\n registerGeometryLabelLayout,\n getGeometryLabel,\n getGeometryLabelLayout,\n} from './geometry/label';\n\n// 注册 interaction\nexport { getInteraction, registerInteraction, registerAction, getActionClass } from './interaction';\n\n// 注册 facet\nexport { getFacet, registerFacet } from './facet';\n\n// 注册主题\nexport { getTheme, registerTheme } from './theme';\n\n// G engine 管理相关\nexport { registerEngine, getEngine } from './engine';\n\n// 注册动画函数\nexport { registerAnimation, getAnimation } from './animate/animation';\n\nexport { LAYER, DIRECTION } from './constant';\n\n// 因为 typescript 部分版本不支持 export * as 语法。\nimport * as Types from './interface';\nexport type { Types };\n\nexport { IGroup, ShapeAttrs, Coordinate, Scale, ScaleConfig } from './dependents';\n\n// 一些工具方法导出\nimport { getMappingValue } from './util/attr';\nimport { getLegendItems } from './util/legend';\nimport { getAngle, getSectorPath, polarToCartesian } from './util/graphics';\nimport { rotate, transform, translate, zoom } from './util/transform';\nimport { getTooltipItems } from './util/tooltip';\nimport { getDelegationObject } from './interaction/action/util';\nimport { getPathPoints } from './geometry/shape/util/get-path-points';\nimport { getPath } from './geometry/shape/line';\n\nexport const Util = {\n getLegendItems,\n translate,\n rotate,\n zoom,\n transform,\n getAngle,\n getSectorPath,\n polarToCartesian,\n getDelegationObject,\n getTooltipItems,\n getMappingValue,\n // shape 的一些操作方法\n getPath,\n getPathPoints,\n};\n"]}
|
|
@@ -15,19 +15,18 @@ var AxisDescription = /** @class */ (function (_super) {
|
|
|
15
15
|
AxisDescription.prototype.show = function () {
|
|
16
16
|
var context = this.context;
|
|
17
17
|
var axis = (0, util_2.getDelegationObject)(context).axis;
|
|
18
|
-
var _a = axis.cfg.title, description = _a.description, text = _a.text;
|
|
18
|
+
var _a = axis.cfg.title, description = _a.description, text = _a.text, descriptionTooltipStyle = _a.descriptionTooltipStyle;
|
|
19
19
|
var _b = context.event, x = _b.x, y = _b.y;
|
|
20
20
|
if (!this.tooltip) {
|
|
21
21
|
this.renderTooltip();
|
|
22
22
|
}
|
|
23
|
-
;
|
|
24
23
|
this.tooltip.update({
|
|
25
24
|
title: text || '',
|
|
26
25
|
customContent: function () {
|
|
27
|
-
return
|
|
26
|
+
return "\n <div class=\"".concat(component_1.TOOLTIP_CSS_CONST.CONTAINER_CLASS, "\" style={").concat(descriptionTooltipStyle, "}>\n <div class=\"").concat(component_1.TOOLTIP_CSS_CONST.TITLE_CLASS, "\">\n \u5B57\u6BB5\u8BF4\u660E\uFF1A").concat(description, "\n </div>\n </div>\n ");
|
|
28
27
|
},
|
|
29
28
|
x: x,
|
|
30
|
-
y: y
|
|
29
|
+
y: y,
|
|
31
30
|
});
|
|
32
31
|
this.tooltip.show();
|
|
33
32
|
};
|
|
@@ -55,17 +54,14 @@ var AxisDescription = /** @class */ (function (_super) {
|
|
|
55
54
|
// 超长的时候,tooltip tip 最大宽度为 50%,然后可以换行
|
|
56
55
|
_a[component_1.TOOLTIP_CSS_CONST.CONTAINER_CLASS] = {
|
|
57
56
|
'max-width': '50%',
|
|
58
|
-
|
|
59
|
-
'line-height': '15px'
|
|
57
|
+
padding: '10px',
|
|
58
|
+
'line-height': '15px',
|
|
59
|
+
'font-size': '12px',
|
|
60
|
+
color: 'rgba(0, 0, 0, .65)',
|
|
60
61
|
},
|
|
61
62
|
_a[component_1.TOOLTIP_CSS_CONST.TITLE_CLASS] = {
|
|
62
63
|
'word-break': 'break-all',
|
|
63
|
-
'
|
|
64
|
-
'margin-bottom': '3px'
|
|
65
|
-
},
|
|
66
|
-
_a[component_1.TOOLTIP_CSS_CONST.LIST_CLASS] = {
|
|
67
|
-
'word-break': 'break-all',
|
|
68
|
-
'opacity': '.5'
|
|
64
|
+
'margin-bottom': '3px',
|
|
69
65
|
},
|
|
70
66
|
_a))),
|
|
71
67
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axis-description.js","sourceRoot":"","sources":["../../../../../src/interaction/action/component/axis/axis-description.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AACpD,mCAAqC;AACrC,qDAAqD;AACrD,4DAAgC;AAChC,mCAAiD;
|
|
1
|
+
{"version":3,"file":"axis-description.js","sourceRoot":"","sources":["../../../../../src/interaction/action/component/axis/axis-description.ts"],"names":[],"mappings":";;;AAAA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M,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAM,MAAM,GAAG;YACb,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;YACrB,GAAG,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;SACzD,CAAC;QACF,IAAM,OAAO,GAAG,IAAI,wBAAW,CAAC;YAC9B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU;YACnC,MAAM,QAAA;YACN,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,wBAAwB;YACrC,SAAS,uBACJ,IAAA,cAAO,EACR,EAAE;gBAEA,qCAAqC;gBACrC,GAAC,6BAAiB,CAAC,eAAe,IAAG;oBACnC,WAAW,EAAE,KAAK;oBAClB,OAAO,EAAE,MAAM;oBACf,aAAa,EAAE,MAAM;oBACrB,WAAW,EAAE,MAAM;oBACnB,KAAK,EAAE,oBAAoB;iBAC5B;gBACD,GAAC,6BAAiB,CAAC,WAAW,IAAG;oBAC/B,YAAY,EAAE,WAAW;oBACzB,eAAe,EAAE,KAAK;iBACvB;oBAEJ,CACF;SACF,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACH,sBAAC;AAAD,CAAC,AAzED,CAA8B,cAAM,GAyEnC;AACD,kBAAe,eAAe,CAAC","sourcesContent":["import { TOOLTIP_CSS_CONST } from '@antv/component';\nimport { deepMix } from '@antv/util';\nimport { HtmlTooltip } from '../../../../dependents';\nimport Action from '../../base';\nimport { getDelegationObject } from '../../util';\nimport cx from 'classnames';\n\nconst AXIS_DESCRIPTION_TOOLTIP = 'aixs-description-tooltip';\n\nclass AxisDescription extends Action {\n private tooltip;\n\n public show() {\n const context = this.context;\n const { axis } = getDelegationObject(context);\n const { description, text, descriptionTooltipStyle } = axis.cfg.title;\n const { x, y } = context.event;\n if (!this.tooltip) {\n this.renderTooltip();\n }\n this.tooltip.update({\n title: text || '',\n customContent: () => {\n return `\n <div class=\"${TOOLTIP_CSS_CONST.CONTAINER_CLASS}\" style={${descriptionTooltipStyle}}>\n <div class=\"${TOOLTIP_CSS_CONST.TITLE_CLASS}\">\n 字段说明:${description}\n </div>\n </div>\n `;\n },\n x,\n y,\n });\n this.tooltip.show();\n }\n\n public destroy() {\n super.destroy();\n this.tooltip && this.tooltip.destroy();\n }\n\n public hide() {\n this.tooltip && this.tooltip.hide();\n }\n\n public renderTooltip() {\n const view = this.context.view;\n const canvas = view.canvas;\n const region = {\n start: { x: 0, y: 0 },\n end: { x: canvas.get('width'), y: canvas.get('height') },\n };\n const tooltip = new HtmlTooltip({\n parent: canvas.get('el').parentNode,\n region,\n visible: false,\n containerId: AXIS_DESCRIPTION_TOOLTIP,\n domStyles: {\n ...deepMix(\n {},\n {\n // 超长的时候,tooltip tip 最大宽度为 50%,然后可以换行\n [TOOLTIP_CSS_CONST.CONTAINER_CLASS]: {\n 'max-width': '50%',\n padding: '10px',\n 'line-height': '15px',\n 'font-size': '12px',\n color: 'rgba(0, 0, 0, .65)',\n },\n [TOOLTIP_CSS_CONST.TITLE_CLASS]: {\n 'word-break': 'break-all',\n 'margin-bottom': '3px',\n },\n }\n ),\n },\n });\n tooltip.init();\n tooltip.setCapture(false);\n this.tooltip = tooltip;\n }\n}\nexport default AxisDescription;\n"]}
|
package/package.json
CHANGED
package/src/core.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { TOOLTIP_CSS_CONST } from
|
|
2
|
-
import { deepMix } from
|
|
3
|
-
import { HtmlTooltip } from
|
|
4
|
-
import Action from
|
|
5
|
-
import { getDelegationObject } from
|
|
1
|
+
import { TOOLTIP_CSS_CONST } from '@antv/component';
|
|
2
|
+
import { deepMix } from '@antv/util';
|
|
3
|
+
import { HtmlTooltip } from '../../../../dependents';
|
|
4
|
+
import Action from '../../base';
|
|
5
|
+
import { getDelegationObject } from '../../util';
|
|
6
|
+
import cx from 'classnames';
|
|
6
7
|
|
|
7
|
-
const AXIS_DESCRIPTION_TOOLTIP = 'aixs-description-tooltip'
|
|
8
|
+
const AXIS_DESCRIPTION_TOOLTIP = 'aixs-description-tooltip';
|
|
8
9
|
|
|
9
10
|
class AxisDescription extends Action {
|
|
10
11
|
private tooltip;
|
|
@@ -12,29 +13,26 @@ class AxisDescription extends Action {
|
|
|
12
13
|
public show() {
|
|
13
14
|
const context = this.context;
|
|
14
15
|
const { axis } = getDelegationObject(context);
|
|
15
|
-
const { description, text } = axis.cfg.title;
|
|
16
|
+
const { description, text, descriptionTooltipStyle } = axis.cfg.title;
|
|
16
17
|
const { x, y } = context.event;
|
|
17
|
-
if(!this.tooltip) {
|
|
18
|
-
this.renderTooltip()
|
|
19
|
-
}
|
|
18
|
+
if (!this.tooltip) {
|
|
19
|
+
this.renderTooltip();
|
|
20
|
+
}
|
|
20
21
|
this.tooltip.update({
|
|
21
22
|
title: text || '',
|
|
22
23
|
customContent: () => {
|
|
23
|
-
return
|
|
24
|
-
<div class="${TOOLTIP_CSS_CONST.CONTAINER_CLASS}">
|
|
24
|
+
return `
|
|
25
|
+
<div class="${TOOLTIP_CSS_CONST.CONTAINER_CLASS}" style={${descriptionTooltipStyle}}>
|
|
25
26
|
<div class="${TOOLTIP_CSS_CONST.TITLE_CLASS}">
|
|
26
|
-
|
|
27
|
-
</div>
|
|
28
|
-
<div class="${TOOLTIP_CSS_CONST.LIST_CLASS}">
|
|
29
|
-
${description}
|
|
27
|
+
字段说明:${description}
|
|
30
28
|
</div>
|
|
31
29
|
</div>
|
|
32
|
-
|
|
30
|
+
`;
|
|
33
31
|
},
|
|
34
32
|
x,
|
|
35
|
-
y
|
|
33
|
+
y,
|
|
36
34
|
});
|
|
37
|
-
this.tooltip.show()
|
|
35
|
+
this.tooltip.show();
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
public destroy() {
|
|
@@ -43,7 +41,7 @@ class AxisDescription extends Action {
|
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
public hide() {
|
|
46
|
-
this.tooltip && this.tooltip.hide()
|
|
44
|
+
this.tooltip && this.tooltip.hide();
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
public renderTooltip() {
|
|
@@ -59,28 +57,28 @@ class AxisDescription extends Action {
|
|
|
59
57
|
visible: false,
|
|
60
58
|
containerId: AXIS_DESCRIPTION_TOOLTIP,
|
|
61
59
|
domStyles: {
|
|
62
|
-
...deepMix(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
...deepMix(
|
|
61
|
+
{},
|
|
62
|
+
{
|
|
63
|
+
// 超长的时候,tooltip tip 最大宽度为 50%,然后可以换行
|
|
64
|
+
[TOOLTIP_CSS_CONST.CONTAINER_CLASS]: {
|
|
65
|
+
'max-width': '50%',
|
|
66
|
+
padding: '10px',
|
|
67
|
+
'line-height': '15px',
|
|
68
|
+
'font-size': '12px',
|
|
69
|
+
color: 'rgba(0, 0, 0, .65)',
|
|
70
|
+
},
|
|
71
|
+
[TOOLTIP_CSS_CONST.TITLE_CLASS]: {
|
|
72
|
+
'word-break': 'break-all',
|
|
73
|
+
'margin-bottom': '3px',
|
|
74
|
+
},
|
|
77
75
|
}
|
|
78
|
-
|
|
76
|
+
),
|
|
79
77
|
},
|
|
80
78
|
});
|
|
81
79
|
tooltip.init();
|
|
82
80
|
tooltip.setCapture(false);
|
|
83
|
-
this.tooltip = tooltip
|
|
81
|
+
this.tooltip = tooltip;
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
|
-
export default AxisDescription
|
|
84
|
+
export default AxisDescription;
|