@visactor/vrender-components 0.16.12 → 0.16.13

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.13";
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.13", __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,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.13\";\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,
@@ -9964,7 +9967,7 @@
9964
9967
  return CanvasTextLayout;
9965
9968
  }();
9966
9969
 
9967
- var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
9970
+ var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
9968
9971
  var Text = /*#__PURE__*/function (_Graphic) {
9969
9972
  _inherits(Text, _Graphic);
9970
9973
  var _super = _createSuper(Text);
@@ -10038,6 +10041,118 @@
10038
10041
  paddingArray = parsePadding(boundsPadding);
10039
10042
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
10040
10043
  }
10044
+ }, {
10045
+ key: "updateWrapAABBBounds",
10046
+ value: function updateWrapAABBBounds(text) {
10047
+ var _a, _b, _c;
10048
+ var textTheme = getTheme(this).text,
10049
+ _this$attribute = this.attribute,
10050
+ _this$attribute$fontF = _this$attribute.fontFamily,
10051
+ fontFamily = _this$attribute$fontF === void 0 ? textTheme.fontFamily : _this$attribute$fontF,
10052
+ _this$attribute$textA = _this$attribute.textAlign,
10053
+ textAlign = _this$attribute$textA === void 0 ? textTheme.textAlign : _this$attribute$textA,
10054
+ _this$attribute$textB = _this$attribute.textBaseline,
10055
+ textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
10056
+ _this$attribute$fontS = _this$attribute.fontSize,
10057
+ fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
10058
+ _this$attribute$lineH = _this$attribute.lineHeight,
10059
+ lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
10060
+ _this$attribute$ellip = _this$attribute.ellipsis,
10061
+ ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
10062
+ maxLineWidth = _this$attribute.maxLineWidth,
10063
+ _this$attribute$strok = _this$attribute.stroke,
10064
+ stroke = _this$attribute$strok === void 0 ? textTheme.stroke : _this$attribute$strok,
10065
+ _this$attribute$lineW = _this$attribute.lineWidth,
10066
+ lineWidth = _this$attribute$lineW === void 0 ? textTheme.lineWidth : _this$attribute$lineW,
10067
+ _this$attribute$wordB = _this$attribute.wordBreak,
10068
+ wordBreak = _this$attribute$wordB === void 0 ? textTheme.wordBreak : _this$attribute$wordB,
10069
+ _this$attribute$fontW = _this$attribute.fontWeight,
10070
+ fontWeight = _this$attribute$fontW === void 0 ? textTheme.fontWeight : _this$attribute$fontW,
10071
+ _this$attribute$ignor = _this$attribute.ignoreBuf,
10072
+ ignoreBuf = _this$attribute$ignor === void 0 ? textTheme.ignoreBuf : _this$attribute$ignor,
10073
+ _this$attribute$heigh = _this$attribute.heightLimit,
10074
+ heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
10075
+ lineClamp = _this$attribute.lineClamp,
10076
+ buf = ignoreBuf ? 0 : 2;
10077
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
10078
+ var _bbox = this.cache.layoutData.bbox;
10079
+ return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
10080
+ }
10081
+ var textMeasure = application.graphicUtil.textMeasure,
10082
+ layoutObj = new CanvasTextLayout(fontFamily, {
10083
+ fontSize: fontSize,
10084
+ fontWeight: fontWeight,
10085
+ fontFamily: fontFamily
10086
+ }, textMeasure),
10087
+ lines = vutils.isArray(text) ? text.map(function (l) {
10088
+ return l.toString();
10089
+ }) : [text.toString()],
10090
+ linesLayout = [],
10091
+ bboxWH = [0, 0];
10092
+ var lineCountLimit = 1 / 0;
10093
+ if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
10094
+ if (maxLineWidth > 0) for (var i = 0; i < lines.length; i++) {
10095
+ var str = lines[i];
10096
+ var needCut = !0;
10097
+ if (i === lineCountLimit - 1) {
10098
+ var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
10099
+ linesLayout.push({
10100
+ str: _clip.str,
10101
+ width: _clip.width
10102
+ });
10103
+ break;
10104
+ }
10105
+ var clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-word" === wordBreak);
10106
+ if ("" !== str && "" === clip.str) {
10107
+ if (ellipsis) {
10108
+ var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
10109
+ clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
10110
+ } else clip.str = "", clip.width = 0;
10111
+ needCut = !1;
10112
+ }
10113
+ if (linesLayout.push({
10114
+ str: clip.str,
10115
+ width: clip.width
10116
+ }), clip.str.length === str.length) ;else if (needCut) {
10117
+ var newStr = str.substring(clip.str.length);
10118
+ lines.splice(i + 1, 0, newStr);
10119
+ }
10120
+ }
10121
+ var maxWidth = 0;
10122
+ linesLayout.forEach(function (layout) {
10123
+ maxWidth = Math.max(maxWidth, layout.width);
10124
+ }), bboxWH[0] = maxWidth;
10125
+ } else {
10126
+ var width,
10127
+ _text,
10128
+ _lineWidth = 0;
10129
+ for (var _i = 0, len = lines.length; _i < len; _i++) {
10130
+ if (_i === lineCountLimit - 1) {
10131
+ var _clip2 = layoutObj.textMeasure.clipTextWithSuffix(lines[_i], layoutObj.textOptions, maxLineWidth, ellipsis, !1);
10132
+ linesLayout.push({
10133
+ str: _clip2.str,
10134
+ width: _clip2.width
10135
+ }), _lineWidth = Math.max(_lineWidth, _clip2.width);
10136
+ break;
10137
+ }
10138
+ _text = lines[_i], width = layoutObj.textMeasure.measureTextWidth(_text, layoutObj.textOptions, "break-word" === wordBreak), _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
10139
+ str: _text,
10140
+ width: width
10141
+ });
10142
+ }
10143
+ bboxWH[0] = _lineWidth;
10144
+ }
10145
+ bboxWH[1] = linesLayout.length * (lineHeight + buf);
10146
+ var bbox = {
10147
+ xOffset: 0,
10148
+ yOffset: 0,
10149
+ width: bboxWH[0],
10150
+ height: bboxWH[1]
10151
+ };
10152
+ layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
10153
+ var layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
10154
+ 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;
10155
+ }
10041
10156
  }, {
10042
10157
  key: "updateSingallineAABBBounds",
10043
10158
  value: function updateSingallineAABBBounds(text) {
@@ -10084,7 +10199,10 @@
10084
10199
  _attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
10085
10200
  var _attribute$ignoreBuf = attribute.ignoreBuf,
10086
10201
  ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
10087
- buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
10202
+ _attribute$whiteSpace = attribute.whiteSpace,
10203
+ whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
10204
+ if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
10205
+ var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
10088
10206
  _attribute$lineHeight = attribute.lineHeight,
10089
10207
  lineHeight = _attribute$lineHeight === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight;
10090
10208
  if (!this.shouldUpdateShape() && this.cache) {
@@ -10233,11 +10351,12 @@
10233
10351
  stroke = _attribute$stroke3 === void 0 ? textTheme.stroke : _attribute$stroke3,
10234
10352
  _attribute$lineWidth3 = attribute.lineWidth,
10235
10353
  lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
10236
- _attribute$wordBreak2 = attribute.wordBreak;
10237
- _attribute$wordBreak2 === void 0 ? textTheme.wordBreak : _attribute$wordBreak2;
10354
+ _attribute$whiteSpace2 = attribute.whiteSpace,
10355
+ whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2;
10356
+ if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
10238
10357
  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;
10358
+ var _bbox2 = this.cache.layoutData.bbox;
10359
+ 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
10360
  }
10242
10361
  var textMeasure = application.graphicUtil.textMeasure,
10243
10362
  layoutData = new CanvasTextLayout(fontFamily, {
@@ -31285,7 +31404,7 @@
31285
31404
  }
31286
31405
  };
31287
31406
 
31288
- const version = "0.16.12";
31407
+ const version = "0.16.13";
31289
31408
 
31290
31409
  exports.AbstractComponent = AbstractComponent;
31291
31410
  exports.ArcInfo = ArcInfo;