@easyv/charts 1.8.15 → 1.8.17

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.
@@ -1,359 +1,359 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- var _react = _interopRequireWildcard(require("react"));
14
- var _d3v = require("d3v7");
15
- var _utils = require("../utils");
16
- var _excluded = ["show", "extent"],
17
- _excluded2 = ["pattern", "seriesIntervalWidth", "paddingInner", "highlight"],
18
- _excluded3 = ["bgAttr"];
19
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
21
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+ var _react = _interopRequireWildcard(require("react"));
14
+ var _d3v = require("d3v7");
15
+ var _utils = require("../utils");
16
+ var _excluded = ["show", "extent"],
17
+ _excluded2 = ["pattern", "seriesIntervalWidth", "paddingInner", "highlight"],
18
+ _excluded3 = ["bgAttr"];
19
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
21
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
22
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
23
23
  * (柱状/条形)图柱子
24
- */
25
- var getHighlightData = function getHighlightData(data, extent) {
26
- switch (extent) {
27
- case "min":
28
- var minData = (0, _d3v.min)(data, function (d) {
29
- return d.data.y;
30
- });
31
- return data.map(function (item) {
32
- return _objectSpread(_objectSpread({}, item), {}, {
33
- flag: minData == item.data.y ? "min" : ""
34
- });
35
- });
36
- case "max":
37
- var maxData = (0, _d3v.max)(data, function (d) {
38
- return d.data.y;
39
- });
40
- return data.map(function (item) {
41
- return _objectSpread(_objectSpread({}, item), {}, {
42
- flag: maxData == item.data.y ? "max" : ""
43
- });
44
- });
45
- default:
46
- return data;
47
- }
48
- };
49
- var getAttr = function getAttr(_ref) {
50
- var isVertical = _ref.isVertical,
51
- seriesWidth = _ref.seriesWidth,
52
- length = _ref.length,
53
- x = _ref.x,
54
- y = _ref.y;
55
- var len = length ? length : 0.1; //柱子长度
56
- if (isVertical) {
57
- return {
58
- width: len,
59
- height: seriesWidth,
60
- x: y,
61
- y: x,
62
- bgAttr: {
63
- x: 0,
64
- y: x,
65
- width: len + x,
66
- height: seriesWidth
67
- }
68
- };
69
- } else {
70
- return {
71
- x: x,
72
- y: y,
73
- width: seriesWidth,
74
- height: len,
75
- bgAttr: {
76
- x: x,
77
- y: 0,
78
- width: seriesWidth,
79
- height: y + len
80
- }
81
- };
82
- }
83
- };
84
- var getBorderRadius = function getBorderRadius(_ref2) {
85
- var isVertical = _ref2.isVertical,
86
- positive = _ref2.positive,
87
- seriesWidth = _ref2.seriesWidth;
88
- return isVertical ? positive ? "0px " + seriesWidth + "px " + seriesWidth + "px 0" : seriesWidth + "px 0 0 " + seriesWidth + "px" : positive ? seriesWidth / 2 + "px " + seriesWidth / 2 + "px 0 0" : "0 0 " + seriesWidth / 2 + "px " + seriesWidth / 2 + "px";
89
- };
90
- var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
91
- var triggerClick = _ref3.triggerClick,
92
- indicatorWidth = _ref3.indicatorWidth,
93
- _ref3$isControlChart = _ref3.isControlChart,
94
- isControlChart = _ref3$isControlChart === void 0 ? false : _ref3$isControlChart,
95
- setCtlTip = _ref3.setCtlTip,
96
- isXRepeat = _ref3.isXRepeat,
97
- _ref3$config = _ref3.config,
98
- _ref3$config$pattern = _ref3$config.pattern,
99
- pattern = _ref3$config$pattern === void 0 ? {} : _ref3$config$pattern,
100
- _ref3$config$seriesIn = _ref3$config.seriesIntervalWidth,
101
- paddingInner = _ref3$config$seriesIn === void 0 ? 0 : _ref3$config$seriesIn,
102
- _ref3$config$paddingI = _ref3$config.paddingInner,
103
- paddingOuter = _ref3$config$paddingI === void 0 ? 0 : _ref3$config$paddingI,
104
- _ref3$config$highligh = _ref3$config.highlight,
105
- showHighlight = _ref3$config$highligh.show,
106
- extent = _ref3$config$highligh.extent,
107
- highlightStyle = (0, _objectWithoutProperties2["default"])(_ref3$config$highligh, _excluded),
108
- other = (0, _objectWithoutProperties2["default"])(_ref3$config, _excluded2),
109
- curXLabel = _ref3.curXLabel,
110
- selectStyle = _ref3.selectStyle,
111
- _ref3$bandLength = _ref3.bandLength,
112
- bandLength = _ref3$bandLength === void 0 ? 0 : _ref3$bandLength,
113
- _ref3$auto = _ref3.auto,
114
- auto = _ref3$auto === void 0 ? false : _ref3$auto,
115
- data = _ref3.data,
116
- _ref3$xAxis = _ref3.xAxis,
117
- normalScaler = _ref3$xAxis.scaler,
118
- normalStep = _ref3$xAxis.step,
119
- controlStep = _ref3$xAxis.controlStep,
120
- direction = _ref3$xAxis.direction,
121
- controlDragScaler = _ref3$xAxis.controlDragScaler,
122
- _ref3$yAxis = _ref3.yAxis,
123
- yScaler = _ref3$yAxis.scaler,
124
- isClipAxis = _ref3$yAxis.isClipAxis,
125
- clipValue = _ref3$yAxis.clipValue,
126
- reverse = _ref3$yAxis.reverse;
127
- if (!data.length) return null;
128
- var selectConfig = other;
129
- if (selectStyle) {
130
- var show = selectStyle.show,
131
- showType = selectStyle.showType,
132
- barStyle = selectStyle.barStyle,
133
- headDecorate = selectStyle.headDecorate;
134
- if (show && showType == "bar") {
135
- selectConfig = _objectSpread(_objectSpread({}, barStyle), {}, {
136
- headDecorate: headDecorate
137
- });
138
- }
139
- }
140
- var highlightConfig = other;
141
- if (highlightStyle) {
142
- highlightConfig = _objectSpread(_objectSpread({}, other), highlightStyle);
143
- }
144
- var step = isControlChart ? controlStep : normalStep;
145
- var xScaler = isControlChart ? controlDragScaler : normalScaler;
146
- var _getSeriesInfo = (0, _utils.getSeriesInfo)({
147
- step: step,
148
- bandLength: bandLength,
149
- paddingInner: paddingInner,
150
- paddingOuter: paddingOuter
151
- }),
152
- seriesWidth = _getSeriesInfo.seriesWidth,
153
- seriesStep = _getSeriesInfo.seriesStep,
154
- seriesStart = _getSeriesInfo.seriesStart;
155
- var _data = showHighlight ? getHighlightData(data, extent) : data;
156
- var isVertical = direction === "vertical";
157
- return /*#__PURE__*/_react["default"].createElement("g", {
158
- className: "__easyv-band"
159
- }, _data.map(function (_ref4, i) {
160
- var flag = _ref4.flag,
161
- index = _ref4.index,
162
- _ref4$bound = (0, _slicedToArray2["default"])(_ref4.bound, 2),
163
- start = _ref4$bound[0],
164
- end = _ref4$bound[1],
165
- data = _ref4.data,
166
- _ref4$data = _ref4.data,
167
- x = _ref4$data.x,
168
- y = _ref4$data.y,
169
- s = _ref4$data.s;
170
- var y1, y2;
171
- //断轴图相关,断轴图的scaler是一个数组,内含上断轴下断轴的scaler
172
- if (isClipAxis) {
173
- if (end > +clipValue) {
174
- y1 = yScaler[1](start);
175
- y2 = yScaler[0](end);
176
- } else {
177
- y1 = yScaler[1](start);
178
- y2 = yScaler[1](end);
179
- }
180
- } else {
181
- y1 = yScaler(isVertical ? end : start);
182
- y2 = yScaler(isVertical ? start : end);
183
- }
184
- var _ref5 = x == curXLabel ? selectConfig : flag ? highlightConfig : other,
185
- style = _ref5.style,
186
- fillType = _ref5.fillType,
187
- _ref5$fillMode = _ref5.fillMode,
188
- fillMode = _ref5$fillMode === void 0 ? "tile" : _ref5$fillMode,
189
- url = _ref5.url,
190
- size = _ref5.size,
191
- fill = _ref5.fill,
192
- border = _ref5.border,
193
- opacity = _ref5.opacity,
194
- headDecorate = _ref5.headDecorate;
195
- var _ref6 = border || {},
196
- _ref6$borderColor = _ref6.borderColor,
197
- _ref6$borderColor$typ = _ref6$borderColor.type,
198
- type = _ref6$borderColor$typ === void 0 ? "pure" : _ref6$borderColor$typ,
199
- _ref6$borderColor$pur = _ref6$borderColor.pure,
200
- pure = _ref6$borderColor$pur === void 0 ? "transparent" : _ref6$borderColor$pur,
201
- linear = _ref6$borderColor.linear,
202
- _ref6$borderWidth = _ref6.borderWidth,
203
- borderWidth = _ref6$borderWidth === void 0 ? 0 : _ref6$borderWidth;
204
- var borderStr = "".concat(pure, " solid ").concat(borderWidth, "px");
205
- var borderImageSource = (0, _utils.getMultiColorStr)(linear);
206
- var positionX = isXRepeat ? xScaler(x) - step / 2 + seriesStart + index * seriesStep : xScaler(x) - seriesStart / 2;
207
- var showHead, headType, headUrl, headVideo, headWidth, headHeight, headTranslate;
208
- if (headDecorate) {
209
- showHead = headDecorate.show, headType = headDecorate.type, headUrl = headDecorate.url, headVideo = headDecorate.video, headWidth = headDecorate.size.width, headHeight = headDecorate.size.height, headTranslate = headDecorate.translate;
210
- }
211
- //断轴图相关,将柱形在断轴处切开
212
- var setClipPath = function setClipPath() {
213
- if (isClipAxis && end > +clipValue) {
214
- var clipValueY2 = yScaler[0](clipValue); //上方
215
- var clipValueY1 = yScaler[1](clipValue); //下方
216
- var top = Math.abs((y2 - clipValueY2) / (y1 - y2)) * 100;
217
- var bottom = Math.abs((y2 - clipValueY1) / (y1 - y2)) * 100;
218
-
219
- //clip path属性
220
- return "polygon(0% 0%, 0% 100%, 0 100%, 0 ".concat(top, "%, 100% ").concat(top, "%, 100% ").concat(bottom, "%, 0 ").concat(bottom, "%, 0 100%, 100% 100%, 100% 0%)");
221
- } else {
222
- return "none";
223
- }
224
- };
225
- if (isNaN(positionX)) return null;
226
- var positionY = reverse ? y > 0 ? y1 : y2 : y < 0 ? y1 : y2;
227
- var _getAttr = getAttr({
228
- isVertical: isVertical,
229
- x: positionX,
230
- y: positionY,
231
- length: Math.abs(y1 - y2),
232
- seriesWidth: seriesWidth
233
- }),
234
- bgAttr = _getAttr.bgAttr,
235
- attr = (0, _objectWithoutProperties2["default"])(_getAttr, _excluded3);
236
- return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
237
- key: i
238
- }, /*#__PURE__*/_react["default"].createElement("foreignObject", (0, _extends2["default"])({
239
- style: {
240
- overflow: "visible",
241
- position: "relative",
242
- cursor: "pointer"
243
- }
244
- }, bgAttr, {
245
- onClick: function onClick(e) {
246
- return triggerClick(e, "setCurrent");
247
- },
248
- onMouseEnter: function onMouseEnter() {
249
- if (isControlChart) {
250
- setCtlTip(function (pre) {
251
- return {
252
- show: true,
253
- x: xScaler(x),
254
- xName: data.x,
255
- indicatorList: pre.indicatorList.map(function (item) {
256
- if (item.tick === data.x) {
257
- return _objectSpread(_objectSpread({}, item), {}, {
258
- isShow: true
259
- });
260
- } else {
261
- return item;
262
- }
263
- })
264
- };
265
- });
266
- }
267
- },
268
- onMouseLeave: function onMouseLeave() {
269
- if (isControlChart && !auto) {
270
- setCtlTip(function (pre) {
271
- return {
272
- show: false,
273
- x: undefined,
274
- xName: undefined,
275
- indicatorList: pre.indicatorList.map(function (item) {
276
- return _objectSpread(_objectSpread({}, item), {}, {
277
- isShow: false
278
- });
279
- })
280
- };
281
- });
282
- }
283
- },
284
- "data-mobile": JSON.stringify({
285
- x: xScaler(x),
286
- xName: data.x
287
- }),
288
- "data-data": JSON.stringify(data)
289
- })), /*#__PURE__*/_react["default"].createElement("foreignObject", (0, _extends2["default"])({
290
- style: {
291
- overflow: "visible",
292
- position: "relative",
293
- pointerEvents: "none"
294
- }
295
- }, attr), (headUrl || headVideo) && showHead && (headType == "image" ? /*#__PURE__*/_react["default"].createElement("div", {
296
- style: {
297
- position: "absolute",
298
- background: "url(".concat(
299
- //@ts-ignore
300
- window.appConfig.ASSETS_URL + headUrl, ") 0 0/100% 100%"),
301
- width: headWidth,
302
- height: headHeight,
303
- left: isVertical ? y < 0 ? "0%" : "100%" : "50%",
304
- top: isVertical ? "50%" : y < 0 ? "100%" : "0%",
305
- zIndex: 1,
306
- transform: "translate(calc(-50% + ".concat(headTranslate.x, "px), calc(-50% + ").concat(headTranslate.y, "px))")
307
- }
308
- }) : /*#__PURE__*/_react["default"].createElement("video", {
309
- width: headWidth,
310
- height: headHeight
311
- //@ts-ignore
312
- ,
313
- src: window.appConfig.ASSETS_URL + headVideo
314
- // controls={true}
315
- ,
316
- loop: true,
317
- muted: true,
318
- autoPlay: true,
319
- style: {
320
- position: "absolute",
321
- left: isVertical ? "100%" : "50%",
322
- top: isVertical ? "50%" : "0",
323
- zIndex: 1,
324
- transform: "translate(calc(-50% + ".concat(headTranslate.x, "px), calc(-50% + ").concat(headTranslate.y, "px))")
325
- }
326
- })), /*#__PURE__*/_react["default"].createElement("div", {
327
- style: _objectSpread(_objectSpread({
328
- width: "100%",
329
- height: "100%",
330
- /** Safari Bug **/
331
- // position: "absolute",
332
- clipPath: setClipPath(),
333
- opacity: fillType == "pattern" ? opacity : 1,
334
- background: fillType == "pattern" ? "".concat(isVertical ? y < 0 ? "100%" : "0%" : "50%", " ").concat(isVertical ? "50%" : y < 0 ? "0%" : "100%", " / ").concat(fillMode == "tile" ? size.width + "px " + size.height + "px" : "100% 100%", " repeat ") + "url(" +
335
- //@ts-ignore
336
- window.appConfig.ASSETS_URL + url + ")" : (0, _utils.getBandBackground)(pattern, fill, y //是否小于0
337
- ),
338
- borderRadius: style == "square" ? "0 0 0 0" : getBorderRadius({
339
- isVertical: isVertical,
340
- positive: y > 0,
341
- seriesWidth: seriesWidth
342
- })
343
- }, type == "pure" && (isVertical ? {
344
- borderTop: borderStr,
345
- borderRight: borderStr,
346
- borderBottom: borderStr
347
- } : {
348
- borderTop: borderStr,
349
- borderRight: borderStr,
350
- borderLeft: borderStr
351
- })), type == "linear" && {
352
- borderImageSource: borderImageSource,
353
- borderImageSlice: 1,
354
- borderWidth: isVertical ? "".concat(borderWidth, "px ").concat(borderWidth, "px ").concat(borderWidth, "px 0") : "".concat(borderWidth, "px ").concat(borderWidth, "px 0 ").concat(borderWidth, "px"),
355
- borderStyle: "solid"
356
- })
357
- })));
358
- }));
24
+ */
25
+ var getHighlightData = function getHighlightData(data, extent) {
26
+ switch (extent) {
27
+ case "min":
28
+ var minData = (0, _d3v.min)(data, function (d) {
29
+ return d.data.y;
30
+ });
31
+ return data.map(function (item) {
32
+ return _objectSpread(_objectSpread({}, item), {}, {
33
+ flag: minData == item.data.y ? "min" : ""
34
+ });
35
+ });
36
+ case "max":
37
+ var maxData = (0, _d3v.max)(data, function (d) {
38
+ return d.data.y;
39
+ });
40
+ return data.map(function (item) {
41
+ return _objectSpread(_objectSpread({}, item), {}, {
42
+ flag: maxData == item.data.y ? "max" : ""
43
+ });
44
+ });
45
+ default:
46
+ return data;
47
+ }
48
+ };
49
+ var getAttr = function getAttr(_ref) {
50
+ var isVertical = _ref.isVertical,
51
+ seriesWidth = _ref.seriesWidth,
52
+ length = _ref.length,
53
+ x = _ref.x,
54
+ y = _ref.y;
55
+ var len = length ? length : 0.1; //柱子长度
56
+ if (isVertical) {
57
+ return {
58
+ width: len,
59
+ height: seriesWidth,
60
+ x: y,
61
+ y: x,
62
+ bgAttr: {
63
+ x: 0,
64
+ y: x,
65
+ width: len + x,
66
+ height: seriesWidth
67
+ }
68
+ };
69
+ } else {
70
+ return {
71
+ x: x,
72
+ y: y,
73
+ width: seriesWidth,
74
+ height: len,
75
+ bgAttr: {
76
+ x: x,
77
+ y: 0,
78
+ width: seriesWidth,
79
+ height: y + len
80
+ }
81
+ };
82
+ }
83
+ };
84
+ var getBorderRadius = function getBorderRadius(_ref2) {
85
+ var isVertical = _ref2.isVertical,
86
+ positive = _ref2.positive,
87
+ seriesWidth = _ref2.seriesWidth;
88
+ return isVertical ? positive ? "0px " + seriesWidth + "px " + seriesWidth + "px 0" : seriesWidth + "px 0 0 " + seriesWidth + "px" : positive ? seriesWidth / 2 + "px " + seriesWidth / 2 + "px 0 0" : "0 0 " + seriesWidth / 2 + "px " + seriesWidth / 2 + "px";
89
+ };
90
+ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
91
+ var triggerClick = _ref3.triggerClick,
92
+ indicatorWidth = _ref3.indicatorWidth,
93
+ _ref3$isControlChart = _ref3.isControlChart,
94
+ isControlChart = _ref3$isControlChart === void 0 ? false : _ref3$isControlChart,
95
+ setCtlTip = _ref3.setCtlTip,
96
+ isXRepeat = _ref3.isXRepeat,
97
+ _ref3$config = _ref3.config,
98
+ _ref3$config$pattern = _ref3$config.pattern,
99
+ pattern = _ref3$config$pattern === void 0 ? {} : _ref3$config$pattern,
100
+ _ref3$config$seriesIn = _ref3$config.seriesIntervalWidth,
101
+ paddingInner = _ref3$config$seriesIn === void 0 ? 0 : _ref3$config$seriesIn,
102
+ _ref3$config$paddingI = _ref3$config.paddingInner,
103
+ paddingOuter = _ref3$config$paddingI === void 0 ? 0 : _ref3$config$paddingI,
104
+ _ref3$config$highligh = _ref3$config.highlight,
105
+ showHighlight = _ref3$config$highligh.show,
106
+ extent = _ref3$config$highligh.extent,
107
+ highlightStyle = (0, _objectWithoutProperties2["default"])(_ref3$config$highligh, _excluded),
108
+ other = (0, _objectWithoutProperties2["default"])(_ref3$config, _excluded2),
109
+ curXLabel = _ref3.curXLabel,
110
+ selectStyle = _ref3.selectStyle,
111
+ _ref3$bandLength = _ref3.bandLength,
112
+ bandLength = _ref3$bandLength === void 0 ? 0 : _ref3$bandLength,
113
+ _ref3$auto = _ref3.auto,
114
+ auto = _ref3$auto === void 0 ? false : _ref3$auto,
115
+ data = _ref3.data,
116
+ _ref3$xAxis = _ref3.xAxis,
117
+ normalScaler = _ref3$xAxis.scaler,
118
+ normalStep = _ref3$xAxis.step,
119
+ controlStep = _ref3$xAxis.controlStep,
120
+ direction = _ref3$xAxis.direction,
121
+ controlDragScaler = _ref3$xAxis.controlDragScaler,
122
+ _ref3$yAxis = _ref3.yAxis,
123
+ yScaler = _ref3$yAxis.scaler,
124
+ isClipAxis = _ref3$yAxis.isClipAxis,
125
+ clipValue = _ref3$yAxis.clipValue,
126
+ reverse = _ref3$yAxis.reverse;
127
+ if (!data.length) return null;
128
+ var selectConfig = other;
129
+ if (selectStyle) {
130
+ var show = selectStyle.show,
131
+ showType = selectStyle.showType,
132
+ barStyle = selectStyle.barStyle,
133
+ headDecorate = selectStyle.headDecorate;
134
+ if (show && showType == "bar") {
135
+ selectConfig = _objectSpread(_objectSpread({}, barStyle), {}, {
136
+ headDecorate: headDecorate
137
+ });
138
+ }
139
+ }
140
+ var highlightConfig = other;
141
+ if (highlightStyle) {
142
+ highlightConfig = _objectSpread(_objectSpread({}, other), highlightStyle);
143
+ }
144
+ var step = isControlChart ? controlStep : normalStep;
145
+ var xScaler = isControlChart ? controlDragScaler : normalScaler;
146
+ var _getSeriesInfo = (0, _utils.getSeriesInfo)({
147
+ step: step,
148
+ bandLength: bandLength,
149
+ paddingInner: paddingInner,
150
+ paddingOuter: paddingOuter
151
+ }),
152
+ seriesWidth = _getSeriesInfo.seriesWidth,
153
+ seriesStep = _getSeriesInfo.seriesStep,
154
+ seriesStart = _getSeriesInfo.seriesStart;
155
+ var _data = showHighlight ? getHighlightData(data, extent) : data;
156
+ var isVertical = direction === "vertical";
157
+ return /*#__PURE__*/_react["default"].createElement("g", {
158
+ className: "__easyv-band"
159
+ }, _data.map(function (_ref4, i) {
160
+ var flag = _ref4.flag,
161
+ index = _ref4.index,
162
+ _ref4$bound = (0, _slicedToArray2["default"])(_ref4.bound, 2),
163
+ start = _ref4$bound[0],
164
+ end = _ref4$bound[1],
165
+ data = _ref4.data,
166
+ _ref4$data = _ref4.data,
167
+ x = _ref4$data.x,
168
+ y = _ref4$data.y,
169
+ s = _ref4$data.s;
170
+ var y1, y2;
171
+ //断轴图相关,断轴图的scaler是一个数组,内含上断轴下断轴的scaler
172
+ if (isClipAxis) {
173
+ if (end > +clipValue) {
174
+ y1 = yScaler[1](start);
175
+ y2 = yScaler[0](end);
176
+ } else {
177
+ y1 = yScaler[1](start);
178
+ y2 = yScaler[1](end);
179
+ }
180
+ } else {
181
+ y1 = yScaler(isVertical ? end : start);
182
+ y2 = yScaler(isVertical ? start : end);
183
+ }
184
+ var _ref5 = x == curXLabel ? selectConfig : flag ? highlightConfig : other,
185
+ style = _ref5.style,
186
+ fillType = _ref5.fillType,
187
+ _ref5$fillMode = _ref5.fillMode,
188
+ fillMode = _ref5$fillMode === void 0 ? "tile" : _ref5$fillMode,
189
+ url = _ref5.url,
190
+ size = _ref5.size,
191
+ fill = _ref5.fill,
192
+ border = _ref5.border,
193
+ opacity = _ref5.opacity,
194
+ headDecorate = _ref5.headDecorate;
195
+ var _ref6 = border || {},
196
+ _ref6$borderColor = _ref6.borderColor,
197
+ _ref6$borderColor$typ = _ref6$borderColor.type,
198
+ type = _ref6$borderColor$typ === void 0 ? "pure" : _ref6$borderColor$typ,
199
+ _ref6$borderColor$pur = _ref6$borderColor.pure,
200
+ pure = _ref6$borderColor$pur === void 0 ? "transparent" : _ref6$borderColor$pur,
201
+ linear = _ref6$borderColor.linear,
202
+ _ref6$borderWidth = _ref6.borderWidth,
203
+ borderWidth = _ref6$borderWidth === void 0 ? 0 : _ref6$borderWidth;
204
+ var borderStr = "".concat(pure, " solid ").concat(borderWidth, "px");
205
+ var borderImageSource = (0, _utils.getMultiColorStr)(linear);
206
+ var positionX = isXRepeat ? xScaler(x) - step / 2 + seriesStart + index * seriesStep : xScaler(x) - seriesWidth / 2;
207
+ var showHead, headType, headUrl, headVideo, headWidth, headHeight, headTranslate;
208
+ if (headDecorate) {
209
+ showHead = headDecorate.show, headType = headDecorate.type, headUrl = headDecorate.url, headVideo = headDecorate.video, headWidth = headDecorate.size.width, headHeight = headDecorate.size.height, headTranslate = headDecorate.translate;
210
+ }
211
+ //断轴图相关,将柱形在断轴处切开
212
+ var setClipPath = function setClipPath() {
213
+ if (isClipAxis && end > +clipValue) {
214
+ var clipValueY2 = yScaler[0](clipValue); //上方
215
+ var clipValueY1 = yScaler[1](clipValue); //下方
216
+ var top = Math.abs((y2 - clipValueY2) / (y1 - y2)) * 100;
217
+ var bottom = Math.abs((y2 - clipValueY1) / (y1 - y2)) * 100;
218
+
219
+ //clip path属性
220
+ return "polygon(0% 0%, 0% 100%, 0 100%, 0 ".concat(top, "%, 100% ").concat(top, "%, 100% ").concat(bottom, "%, 0 ").concat(bottom, "%, 0 100%, 100% 100%, 100% 0%)");
221
+ } else {
222
+ return "none";
223
+ }
224
+ };
225
+ if (isNaN(positionX)) return null;
226
+ var positionY = reverse ? y > 0 ? y1 : y2 : y < 0 ? y1 : y2;
227
+ var _getAttr = getAttr({
228
+ isVertical: isVertical,
229
+ x: positionX,
230
+ y: positionY,
231
+ length: Math.abs(y1 - y2),
232
+ seriesWidth: seriesWidth
233
+ }),
234
+ bgAttr = _getAttr.bgAttr,
235
+ attr = (0, _objectWithoutProperties2["default"])(_getAttr, _excluded3);
236
+ return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
237
+ key: i
238
+ }, /*#__PURE__*/_react["default"].createElement("foreignObject", (0, _extends2["default"])({
239
+ style: {
240
+ overflow: "visible",
241
+ position: "relative",
242
+ cursor: "pointer"
243
+ }
244
+ }, bgAttr, {
245
+ onClick: function onClick(e) {
246
+ return triggerClick(e, "setCurrent");
247
+ },
248
+ onMouseEnter: function onMouseEnter() {
249
+ if (isControlChart) {
250
+ setCtlTip(function (pre) {
251
+ return {
252
+ show: true,
253
+ x: xScaler(x),
254
+ xName: data.x,
255
+ indicatorList: pre.indicatorList.map(function (item) {
256
+ if (item.tick === data.x) {
257
+ return _objectSpread(_objectSpread({}, item), {}, {
258
+ isShow: true
259
+ });
260
+ } else {
261
+ return item;
262
+ }
263
+ })
264
+ };
265
+ });
266
+ }
267
+ },
268
+ onMouseLeave: function onMouseLeave() {
269
+ if (isControlChart && !auto) {
270
+ setCtlTip(function (pre) {
271
+ return {
272
+ show: false,
273
+ x: undefined,
274
+ xName: undefined,
275
+ indicatorList: pre.indicatorList.map(function (item) {
276
+ return _objectSpread(_objectSpread({}, item), {}, {
277
+ isShow: false
278
+ });
279
+ })
280
+ };
281
+ });
282
+ }
283
+ },
284
+ "data-mobile": JSON.stringify({
285
+ x: xScaler(x),
286
+ xName: data.x
287
+ }),
288
+ "data-data": JSON.stringify(data)
289
+ })), /*#__PURE__*/_react["default"].createElement("foreignObject", (0, _extends2["default"])({
290
+ style: {
291
+ overflow: "visible",
292
+ position: "relative",
293
+ pointerEvents: "none"
294
+ }
295
+ }, attr), (headUrl || headVideo) && showHead && (headType == "image" ? /*#__PURE__*/_react["default"].createElement("div", {
296
+ style: {
297
+ position: "absolute",
298
+ background: "url(".concat(
299
+ //@ts-ignore
300
+ window.appConfig.ASSETS_URL + headUrl, ") 0 0/100% 100%"),
301
+ width: headWidth,
302
+ height: headHeight,
303
+ left: isVertical ? y < 0 ? "0%" : "100%" : "50%",
304
+ top: isVertical ? "50%" : y < 0 ? "100%" : "0%",
305
+ zIndex: 1,
306
+ transform: "translate(calc(-50% + ".concat(headTranslate.x, "px), calc(-50% + ").concat(headTranslate.y, "px))")
307
+ }
308
+ }) : /*#__PURE__*/_react["default"].createElement("video", {
309
+ width: headWidth,
310
+ height: headHeight
311
+ //@ts-ignore
312
+ ,
313
+ src: window.appConfig.ASSETS_URL + headVideo
314
+ // controls={true}
315
+ ,
316
+ loop: true,
317
+ muted: true,
318
+ autoPlay: true,
319
+ style: {
320
+ position: "absolute",
321
+ left: isVertical ? "100%" : "50%",
322
+ top: isVertical ? "50%" : "0",
323
+ zIndex: 1,
324
+ transform: "translate(calc(-50% + ".concat(headTranslate.x, "px), calc(-50% + ").concat(headTranslate.y, "px))")
325
+ }
326
+ })), /*#__PURE__*/_react["default"].createElement("div", {
327
+ style: _objectSpread(_objectSpread({
328
+ width: "100%",
329
+ height: "100%",
330
+ /** Safari Bug **/
331
+ // position: "absolute",
332
+ clipPath: setClipPath(),
333
+ opacity: fillType == "pattern" ? opacity : 1,
334
+ background: fillType == "pattern" ? "".concat(isVertical ? y < 0 ? "100%" : "0%" : "50%", " ").concat(isVertical ? "50%" : y < 0 ? "0%" : "100%", " / ").concat(fillMode == "tile" ? size.width + "px " + size.height + "px" : "100% 100%", " repeat ") + "url(" +
335
+ //@ts-ignore
336
+ window.appConfig.ASSETS_URL + url + ")" : (0, _utils.getBandBackground)(pattern, fill, y //是否小于0
337
+ ),
338
+ borderRadius: style == "square" ? "0 0 0 0" : getBorderRadius({
339
+ isVertical: isVertical,
340
+ positive: y > 0,
341
+ seriesWidth: seriesWidth
342
+ })
343
+ }, type == "pure" && (isVertical ? {
344
+ borderTop: borderStr,
345
+ borderRight: borderStr,
346
+ borderBottom: borderStr
347
+ } : {
348
+ borderTop: borderStr,
349
+ borderRight: borderStr,
350
+ borderLeft: borderStr
351
+ })), type == "linear" && {
352
+ borderImageSource: borderImageSource,
353
+ borderImageSlice: 1,
354
+ borderWidth: isVertical ? "".concat(borderWidth, "px ").concat(borderWidth, "px ").concat(borderWidth, "px 0") : "".concat(borderWidth, "px ").concat(borderWidth, "px 0 ").concat(borderWidth, "px"),
355
+ borderStyle: "solid"
356
+ })
357
+ })));
358
+ }));
359
359
  });