@visactor/vrender-components 0.16.12 → 0.16.14-alpha.1

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/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.16.12";
1
+ export declare const version = "0.16.14-alpha.1";
2
2
  export * from './core/base';
3
3
  export * from './scrollbar';
4
4
  export * from './tag';
package/cjs/index.js CHANGED
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
17
17
 
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
- }), exports.version = void 0, exports.version = "0.16.12", __exportStar(require("./core/base"), exports),
20
+ }), exports.version = void 0, exports.version = "0.16.14-alpha.1", __exportStar(require("./core/base"), exports),
21
21
  __exportStar(require("./scrollbar"), exports), __exportStar(require("./tag"), exports),
22
22
  __exportStar(require("./poptip"), exports), __exportStar(require("./crosshair"), exports),
23
23
  __exportStar(require("./label"), exports), __exportStar(require("./axis"), exports),
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,SAAS,CAAC;AAEjC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.16.12\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.16.14-alpha.1\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\n"]}
package/dist/index.js CHANGED
@@ -4470,7 +4470,10 @@
4470
4470
  direction: "horizontal",
4471
4471
  wordBreak: "break-all",
4472
4472
  ignoreBuf: !1,
4473
- verticalMode: 0
4473
+ verticalMode: 0,
4474
+ whiteSpace: "no-wrap",
4475
+ heightLimit: 1 / 0,
4476
+ lineClamp: 1 / 0
4474
4477
  };
4475
4478
  var DefaultStyle = Object.assign(Object.assign(Object.assign({
4476
4479
  opacity: 1,
@@ -7460,6 +7463,12 @@
7460
7463
  }();
7461
7464
  RafBasedSTO.TimeOut = 1e3 / 60;
7462
7465
  new RafBasedSTO();
7466
+ var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
7467
+ if (vutils.isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
7468
+ return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
7469
+ }
7470
+ return lineHeight;
7471
+ };
7463
7472
 
7464
7473
  var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
7465
7474
  _inherits(IncreaseCount, _ACustomAnimate);
@@ -9964,7 +9973,7 @@
9964
9973
  return CanvasTextLayout;
9965
9974
  }();
9966
9975
 
9967
- var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
9976
+ var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
9968
9977
  var Text = /*#__PURE__*/function (_Graphic) {
9969
9978
  _inherits(Text, _Graphic);
9970
9979
  var _super = _createSuper(Text);
@@ -10038,6 +10047,118 @@
10038
10047
  paddingArray = parsePadding(boundsPadding);
10039
10048
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
10040
10049
  }
10050
+ }, {
10051
+ key: "updateWrapAABBBounds",
10052
+ value: function updateWrapAABBBounds(text) {
10053
+ var _a, _b, _c;
10054
+ var textTheme = getTheme(this).text,
10055
+ _this$attribute = this.attribute,
10056
+ _this$attribute$fontF = _this$attribute.fontFamily,
10057
+ fontFamily = _this$attribute$fontF === void 0 ? textTheme.fontFamily : _this$attribute$fontF,
10058
+ _this$attribute$textA = _this$attribute.textAlign,
10059
+ textAlign = _this$attribute$textA === void 0 ? textTheme.textAlign : _this$attribute$textA,
10060
+ _this$attribute$textB = _this$attribute.textBaseline,
10061
+ textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
10062
+ _this$attribute$fontS = _this$attribute.fontSize,
10063
+ fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
10064
+ _this$attribute$lineH = _this$attribute.lineHeight,
10065
+ lineHeight = _this$attribute$lineH === void 0 ? calculateLineHeight(this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize, this.attribute.fontSize || textTheme.fontSize) : _this$attribute$lineH,
10066
+ _this$attribute$ellip = _this$attribute.ellipsis,
10067
+ ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
10068
+ maxLineWidth = _this$attribute.maxLineWidth,
10069
+ _this$attribute$strok = _this$attribute.stroke,
10070
+ stroke = _this$attribute$strok === void 0 ? textTheme.stroke : _this$attribute$strok,
10071
+ _this$attribute$lineW = _this$attribute.lineWidth,
10072
+ lineWidth = _this$attribute$lineW === void 0 ? textTheme.lineWidth : _this$attribute$lineW,
10073
+ _this$attribute$wordB = _this$attribute.wordBreak,
10074
+ wordBreak = _this$attribute$wordB === void 0 ? textTheme.wordBreak : _this$attribute$wordB,
10075
+ _this$attribute$fontW = _this$attribute.fontWeight,
10076
+ fontWeight = _this$attribute$fontW === void 0 ? textTheme.fontWeight : _this$attribute$fontW,
10077
+ _this$attribute$ignor = _this$attribute.ignoreBuf,
10078
+ ignoreBuf = _this$attribute$ignor === void 0 ? textTheme.ignoreBuf : _this$attribute$ignor,
10079
+ _this$attribute$heigh = _this$attribute.heightLimit,
10080
+ heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
10081
+ lineClamp = _this$attribute.lineClamp,
10082
+ buf = ignoreBuf ? 0 : 2;
10083
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
10084
+ var _bbox = this.cache.layoutData.bbox;
10085
+ return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
10086
+ }
10087
+ var textMeasure = application.graphicUtil.textMeasure,
10088
+ layoutObj = new CanvasTextLayout(fontFamily, {
10089
+ fontSize: fontSize,
10090
+ fontWeight: fontWeight,
10091
+ fontFamily: fontFamily
10092
+ }, textMeasure),
10093
+ lines = vutils.isArray(text) ? text.map(function (l) {
10094
+ return l.toString();
10095
+ }) : [text.toString()],
10096
+ linesLayout = [],
10097
+ bboxWH = [0, 0];
10098
+ var lineCountLimit = 1 / 0;
10099
+ if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
10100
+ if (maxLineWidth > 0) for (var i = 0; i < lines.length; i++) {
10101
+ var str = lines[i];
10102
+ var needCut = !0;
10103
+ if (i === lineCountLimit - 1) {
10104
+ var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
10105
+ linesLayout.push({
10106
+ str: _clip.str,
10107
+ width: _clip.width
10108
+ });
10109
+ break;
10110
+ }
10111
+ var clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-word" === wordBreak);
10112
+ if ("" !== str && "" === clip.str) {
10113
+ if (ellipsis) {
10114
+ var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
10115
+ clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
10116
+ } else clip.str = "", clip.width = 0;
10117
+ needCut = !1;
10118
+ }
10119
+ if (linesLayout.push({
10120
+ str: clip.str,
10121
+ width: clip.width
10122
+ }), clip.str.length === str.length) ;else if (needCut) {
10123
+ var newStr = str.substring(clip.str.length);
10124
+ lines.splice(i + 1, 0, newStr);
10125
+ }
10126
+ }
10127
+ var maxWidth = 0;
10128
+ linesLayout.forEach(function (layout) {
10129
+ maxWidth = Math.max(maxWidth, layout.width);
10130
+ }), bboxWH[0] = maxWidth;
10131
+ } else {
10132
+ var width,
10133
+ _text,
10134
+ _lineWidth = 0;
10135
+ for (var _i = 0, len = lines.length; _i < len; _i++) {
10136
+ if (_i === lineCountLimit - 1) {
10137
+ var _clip2 = layoutObj.textMeasure.clipTextWithSuffix(lines[_i], layoutObj.textOptions, maxLineWidth, ellipsis, !1);
10138
+ linesLayout.push({
10139
+ str: _clip2.str,
10140
+ width: _clip2.width
10141
+ }), _lineWidth = Math.max(_lineWidth, _clip2.width);
10142
+ break;
10143
+ }
10144
+ _text = lines[_i], width = layoutObj.textMeasure.measureTextWidth(_text, layoutObj.textOptions, "break-word" === wordBreak), _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
10145
+ str: _text,
10146
+ width: width
10147
+ });
10148
+ }
10149
+ bboxWH[0] = _lineWidth;
10150
+ }
10151
+ bboxWH[1] = linesLayout.length * (lineHeight + buf);
10152
+ var bbox = {
10153
+ xOffset: 0,
10154
+ yOffset: 0,
10155
+ width: bboxWH[0],
10156
+ height: bboxWH[1]
10157
+ };
10158
+ layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
10159
+ var layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
10160
+ return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
10161
+ }
10041
10162
  }, {
10042
10163
  key: "updateSingallineAABBBounds",
10043
10164
  value: function updateSingallineAABBBounds(text) {
@@ -10084,9 +10205,13 @@
10084
10205
  _attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
10085
10206
  var _attribute$ignoreBuf = attribute.ignoreBuf,
10086
10207
  ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
10087
- buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
10208
+ _attribute$whiteSpace = attribute.whiteSpace,
10209
+ whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
10210
+ if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
10211
+ var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
10212
+ textFontSize = attribute.fontSize || textTheme.fontSize,
10088
10213
  _attribute$lineHeight = attribute.lineHeight,
10089
- lineHeight = _attribute$lineHeight === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight;
10214
+ lineHeight = _attribute$lineHeight === void 0 ? calculateLineHeight(null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : textFontSize, textFontSize) + buf : _attribute$lineHeight;
10090
10215
  if (!this.shouldUpdateShape() && this.cache) {
10091
10216
  width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
10092
10217
  var _dx = textDrawOffsetX(textAlign, width),
@@ -10157,7 +10282,7 @@
10157
10282
  _attribute$stroke2 = attribute.stroke,
10158
10283
  stroke = _attribute$stroke2 === void 0 ? textTheme.stroke : _attribute$stroke2,
10159
10284
  _attribute$lineHeight2 = attribute.lineHeight,
10160
- lineHeight = _attribute$lineHeight2 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight2,
10285
+ lineHeight = _attribute$lineHeight2 === void 0 ? calculateLineHeight(null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize, attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight2,
10161
10286
  _attribute$lineWidth2 = attribute.lineWidth,
10162
10287
  lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
10163
10288
  _attribute$verticalMo = attribute.verticalMode,
@@ -10225,7 +10350,7 @@
10225
10350
  _attribute$fontWeight3 = attribute.fontWeight,
10226
10351
  fontWeight = _attribute$fontWeight3 === void 0 ? textTheme.fontWeight : _attribute$fontWeight3,
10227
10352
  _attribute$lineHeight3 = attribute.lineHeight,
10228
- lineHeight = _attribute$lineHeight3 === void 0 ? attribute.lineHeight || attribute.fontSize || textTheme.fontSize : _attribute$lineHeight3,
10353
+ lineHeight = _attribute$lineHeight3 === void 0 ? calculateLineHeight(attribute.lineHeight || attribute.fontSize || textTheme.fontSize, attribute.fontSize || textTheme.fontSize) : _attribute$lineHeight3,
10229
10354
  _attribute$ellipsis3 = attribute.ellipsis,
10230
10355
  ellipsis = _attribute$ellipsis3 === void 0 ? textTheme.ellipsis : _attribute$ellipsis3,
10231
10356
  maxLineWidth = attribute.maxLineWidth,
@@ -10233,11 +10358,12 @@
10233
10358
  stroke = _attribute$stroke3 === void 0 ? textTheme.stroke : _attribute$stroke3,
10234
10359
  _attribute$lineWidth3 = attribute.lineWidth,
10235
10360
  lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
10236
- _attribute$wordBreak2 = attribute.wordBreak;
10237
- _attribute$wordBreak2 === void 0 ? textTheme.wordBreak : _attribute$wordBreak2;
10361
+ _attribute$whiteSpace2 = attribute.whiteSpace,
10362
+ whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2;
10363
+ if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
10238
10364
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
10239
- var _bbox = this.cache.layoutData.bbox;
10240
- return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
10365
+ var _bbox2 = this.cache.layoutData.bbox;
10366
+ return this._AABBBounds.set(_bbox2.xOffset, _bbox2.yOffset, _bbox2.xOffset + _bbox2.width, _bbox2.yOffset + _bbox2.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
10241
10367
  }
10242
10368
  var textMeasure = application.graphicUtil.textMeasure,
10243
10369
  layoutData = new CanvasTextLayout(fontFamily, {
@@ -10272,7 +10398,7 @@
10272
10398
  _attribute$stroke4 = attribute.stroke,
10273
10399
  stroke = _attribute$stroke4 === void 0 ? textTheme.stroke : _attribute$stroke4,
10274
10400
  _attribute$lineHeight4 = attribute.lineHeight,
10275
- lineHeight = _attribute$lineHeight4 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight4,
10401
+ lineHeight = _attribute$lineHeight4 === void 0 ? calculateLineHeight(null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize, attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight4,
10276
10402
  _attribute$lineWidth4 = attribute.lineWidth,
10277
10403
  lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
10278
10404
  _attribute$verticalMo2 = attribute.verticalMode,
@@ -10421,7 +10547,7 @@
10421
10547
  _this$attribute$fontS = _this$attribute.fontSize,
10422
10548
  fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
10423
10549
  _this$attribute$lineH = _this$attribute.lineHeight,
10424
- lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
10550
+ lineHeight = _this$attribute$lineH === void 0 ? calculateLineHeight(this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize, this.attribute.fontSize || textTheme.fontSize) : _this$attribute$lineH,
10425
10551
  _this$attribute$ellip = _this$attribute.ellipsis,
10426
10552
  ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
10427
10553
  maxLineWidth = _this$attribute.maxLineWidth,
@@ -31285,7 +31411,7 @@
31285
31411
  }
31286
31412
  };
31287
31413
 
31288
- const version = "0.16.12";
31414
+ const version = "0.16.14-alpha.1";
31289
31415
 
31290
31416
  exports.AbstractComponent = AbstractComponent;
31291
31417
  exports.ArcInfo = ArcInfo;