@visactor/vchart 1.13.23-alpha.1 → 1.13.23

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/build/index.js CHANGED
@@ -80493,41 +80493,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80493
80493
  'rect'
80494
80494
  ];
80495
80495
 
80496
- class WordMeasureCache {
80497
- constructor(maxSize = 1000) {
80498
- this._map = new Map();
80499
- this._maxSize = maxSize;
80500
- }
80501
- get(key) {
80502
- const v = this._map.get(key);
80503
- if (!v) {
80504
- return undefined;
80505
- }
80506
- this._map.delete(key);
80507
- this._map.set(key, v);
80508
- return v;
80509
- }
80510
- set(key, value) {
80511
- if (this._map.has(key)) {
80512
- this._map.set(key, value);
80513
- return;
80514
- }
80515
- if (this._map.size >= this._maxSize) {
80516
- const oldest = this._map.keys().next().value;
80517
- if (oldest !== undefined) {
80518
- this._map.delete(oldest);
80519
- }
80520
- }
80521
- this._map.set(key, value);
80522
- }
80523
- clear() {
80524
- this._map.clear();
80525
- }
80526
- size() {
80527
- return this._map.size;
80528
- }
80529
- }
80530
-
80531
80496
  const WORD_CLOUD_TEXT = `${PREFIX}_WORD_CLOUD_TEXT`;
80532
80497
 
80533
80498
  const wordCloudSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), { ["word"]: { name: "word", type: "text" }, ["fillingWord"]: { name: "fillingWord", type: "text" }, ["wordMask"]: { name: "wordMask", type: "rect" } });
@@ -80604,16 +80569,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80604
80569
  !SHAPE_TYPE.includes(this._maskShape) &&
80605
80570
  !['fast', 'grid', 'cloud'].includes(this._wordCloudConfig.layoutMode);
80606
80571
  this._defaultFontFamily = this._option.getTheme().fontFamily;
80607
- if (!this._wordMeasureCache) {
80608
- this._wordMeasureCache = new WordMeasureCache(1000);
80609
- }
80610
80572
  }
80611
80573
  initData() {
80612
80574
  var _a, _b;
80613
80575
  super.initData();
80614
80576
  (_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.addListener('change', () => {
80615
- var _a;
80616
- (_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
80617
80577
  this._dataChange = true;
80618
80578
  this.compile();
80619
80579
  });
@@ -80782,7 +80742,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80782
80742
  var _a, _b, _c, _d, _e, _f;
80783
80743
  const fillingWordStyleSpec = (_b = (_a = this._spec.fillingWord) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
80784
80744
  const wordCloudShapeConfig = (_c = this._wordCloudShapeConfig) !== null && _c !== void 0 ? _c : {};
80785
- return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), { measureCache: this._wordMeasureCache, rotateList: this._rotateAngles, fillingRotateList: wordCloudShapeConfig.fillingRotateAngles, fillingFontFamily: isValid$1(wordCloudShapeConfig.fillingFontFamilyField)
80745
+ return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), { rotateList: this._rotateAngles, fillingRotateList: wordCloudShapeConfig.fillingRotateAngles, fillingFontFamily: isValid$1(wordCloudShapeConfig.fillingFontFamilyField)
80786
80746
  ? { field: wordCloudShapeConfig.fillingFontFamilyField }
80787
80747
  : (_d = fillingWordStyleSpec.fontFamily) !== null && _d !== void 0 ? _d : this._defaultFontFamily, fillingPadding: (_f = (_e = this._spec.fillingWord) === null || _e === void 0 ? void 0 : _e.padding) !== null && _f !== void 0 ? _f : DEFAULT_FONT_PADDING, fillingFontStyle: isValid$1(wordCloudShapeConfig.fillingFontStyleField)
80788
80748
  ? { field: wordCloudShapeConfig.fillingFontStyleField }
@@ -80831,7 +80791,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80831
80791
  return [this._wordMark];
80832
80792
  }
80833
80793
  reInit() {
80834
- var _a;
80835
80794
  super.reInit();
80836
80795
  if (this._keyWordColorCallback) {
80837
80796
  this._keyWordColorCallback = null;
@@ -80839,13 +80798,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80839
80798
  if (this._fillingColorCallback) {
80840
80799
  this._fillingColorCallback = null;
80841
80800
  }
80842
- (_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
80843
- }
80844
- release() {
80845
- var _a;
80846
- super.release();
80847
- (_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
80848
- this._wordMeasureCache = undefined;
80849
80801
  }
80850
80802
  }
80851
80803
  BaseWordCloudSeries.mark = wordCloudSeriesMark;
@@ -81772,30 +81724,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
81772
81724
  !function (WORDCLOUD_SHAPE_HOOK_EVENT) {
81773
81725
  WORDCLOUD_SHAPE_HOOK_EVENT.BEFORE_WORDCLOUD_SHAPE_LAYOUT = "beforeWordcloudShapeLayout", WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_LAYOUT = "afterWordcloudShapeLayout", WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW = "afterWordcloudShapeDraw";
81774
81726
  }(WORDCLOUD_SHAPE_HOOK_EVENT || (WORDCLOUD_SHAPE_HOOK_EVENT = {}));
81775
- class MapWordMeasureCache {
81776
- constructor(maxSize = 1e3) {
81777
- this._map = new Map(), this._maxSize = maxSize;
81778
- }
81779
- get(key) {
81780
- const value = this._map.get(key);
81781
- if (void 0 !== value) return this._map.delete(key), this._map.set(key, value), value;
81782
- }
81783
- set(key, value) {
81784
- if (this._map.has(key)) this._map.set(key, value);else {
81785
- if (this._map.size >= this._maxSize) {
81786
- const firstKey = this._map.keys().next().value;
81787
- void 0 !== firstKey && this._map.delete(firstKey);
81788
- }
81789
- this._map.set(key, value);
81790
- }
81791
- }
81792
- clear() {
81793
- this._map.clear();
81794
- }
81795
- size() {
81796
- return this._map.size;
81797
- }
81798
- }
81799
81727
  const colorListEqual = (arr0, arr1) => {
81800
81728
  if (1 === arr1.length && "#537EF5" === arr1[0]) return !0;
81801
81729
  if (!Array.isArray(arr0) || !Array.isArray(arr1) || arr0.length !== arr1.length) return !1;
@@ -82035,7 +81963,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82035
81963
  ratio: ratio
82036
81964
  } = region;
82037
81965
  for (let i = 0; i < regionWords.length; i++) {
82038
- measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
81966
+ measureSprite(canvas, ctx, words, i);
82039
81967
  const word = regionWords[i];
82040
81968
  word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82041
81969
  }
@@ -82045,7 +81973,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82045
81973
  if (0 === failedWords.length) break;
82046
81974
  for (let i = 0; i < failedWords.length; i++) {
82047
81975
  const word = failedWords[i];
82048
- measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
81976
+ measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82049
81977
  }
82050
81978
  }
82051
81979
  layoutConfig.board = board;
@@ -82091,7 +82019,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82091
82019
  } = region;
82092
82020
  let restartTag = !1;
82093
82021
  for (let i = 0; i < regionWords.length; i++) {
82094
- measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
82022
+ measureSprite(canvas, ctx, words, i);
82095
82023
  const word = regionWords[i];
82096
82024
  if (word.x = center[0], word.y = center[1], !word.skip && word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor)) word.hasPlaced = !0;else {
82097
82025
  if (!word.skip && word.weight > weightStd && globalShinkFactor > globalShinkLimit) {
@@ -82116,7 +82044,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82116
82044
  if (0 === failedWords.length) break;
82117
82045
  for (let i = 0; i < failedWords.length; i++) {
82118
82046
  const word = failedWords[i];
82119
- measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82047
+ measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82120
82048
  }
82121
82049
  }
82122
82050
  layoutConfig.board = board;
@@ -82161,7 +82089,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82161
82089
  } = region;
82162
82090
  let restartTag = !1;
82163
82091
  for (let i = 0; i < regionWords.length; i++) {
82164
- measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
82092
+ measureSprite(canvas, ctx, words, i);
82165
82093
  const word = regionWords[i];
82166
82094
  if (word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor)) {
82167
82095
  if (word.hasPlaced = !0, word.weight >= weightStd && importantWordSuccessedNum++, importantWordSuccessedNum >= importantCount && !layoutFinish) {
@@ -82187,7 +82115,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82187
82115
  if (0 === failedWords.length) break;
82188
82116
  for (let i = 0; i < failedWords.length; i++) {
82189
82117
  const word = failedWords[i];
82190
- measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82118
+ measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82191
82119
  }
82192
82120
  }
82193
82121
  layoutConfig.board = board;
@@ -82266,13 +82194,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82266
82194
  return [ratio * (t *= .1) * Math.cos(t), t * Math.sin(t)];
82267
82195
  };
82268
82196
  }
82269
- function measureSprite(canvas, ctx, words, wi, cache) {
82270
- const targetWord = words[wi];
82271
- if (targetWord.sprite || 0 === targetWord.fontSize) return;
82272
- if (cache) {
82273
- const cached = cache.get(getWordMeasureKey(targetWord));
82274
- if (cached) return targetWord.sprite = cached.sprite, targetWord.bounds = cached.bounds, targetWord.wordSize = cached.wordSize, void (targetWord.hasText = !0);
82275
- }
82197
+ function measureSprite(canvas, ctx, words, wi) {
82198
+ if (words[wi].sprite || 0 === words[wi].fontSize) return;
82276
82199
  const cw = 2048,
82277
82200
  radians = Math.PI / 180,
82278
82201
  n = words.length;
@@ -82335,25 +82258,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82335
82258
  }
82336
82259
  seen && (j < dTop && (dTop = j), j > dBottom && (dBottom = j));
82337
82260
  }
82338
- if (word.bounds = {
82261
+ word.bounds = {
82339
82262
  dTop: (wordSize[1] >> 1) - dTop,
82340
82263
  dBottom: dBottom - (wordSize[1] >> 1),
82341
82264
  dLeft: (wordSize[0] >> 1) - dLeft,
82342
82265
  dRight: dRight - (wordSize[0] >> 1)
82343
- }, word.sprite = sprite, cache) {
82344
- const key = getWordMeasureKey(word);
82345
- cache.set(key, {
82346
- sprite: sprite,
82347
- bounds: word.bounds,
82348
- wordSize: wordSize
82349
- });
82350
- }
82351
- delete word.LT;
82266
+ }, word.sprite = sprite, delete word.LT;
82352
82267
  }
82353
82268
  }
82354
- function getWordMeasureKey(word) {
82355
- return String(word.text) + "|" + String(word.fontFamily) + "|" + String(word.fontStyle) + "|" + String(word.fontWeight) + "|" + String(word.fontSize) + "|" + String(word.rotate) + "|" + String(word.padding);
82356
- }
82357
82269
  function initBoardWithShape(segmentationOutput) {
82358
82270
  const {
82359
82271
  segmentation: {
@@ -82450,7 +82362,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82450
82362
  } = shapeBounds,
82451
82363
  [startX, startY] = [x1 + ~~(randomGenerator() * fillingXStep * 2), y1 + ~~(randomGenerator() * fillingYStep * 2)];
82452
82364
  for (let y = startY; y <= y2; y += fillingYStep) for (let x = startX; x <= x2; x += fillingXStep) {
82453
- measureSprite(canvas, ctx, fillingWords, wi, layoutConfig.measureCache);
82365
+ measureSprite(canvas, ctx, fillingWords, wi);
82454
82366
  const word = fillingWords[wi];
82455
82367
  word.x = x, word.y = y;
82456
82368
  const {
@@ -82567,7 +82479,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82567
82479
  return this.progressiveResult;
82568
82480
  }
82569
82481
  doLayout() {
82570
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
82482
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
82571
82483
  const segmentationInput = this.segmentationInput,
82572
82484
  segmentationOutput = segmentation(segmentationInput);
82573
82485
  if (!segmentationOutput.segmentation.regions.length) return;
@@ -82594,36 +82506,35 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82594
82506
  const layoutConfig = {
82595
82507
  size: options.size,
82596
82508
  ratio: options.ratio || .8,
82597
- measureCache: null !== (_a = options.measureCache) && void 0 !== _a ? _a : new MapWordMeasureCache(),
82598
82509
  shapeUrl: options.shape,
82599
82510
  random: void 0 === options.random || options.random,
82600
- textLayoutTimes: null !== (_b = options.textLayoutTimes) && void 0 !== _b ? _b : 3,
82511
+ textLayoutTimes: null !== (_a = options.textLayoutTimes) && void 0 !== _a ? _a : 3,
82601
82512
  removeWhiteBorder: options.removeWhiteBorder,
82602
- layoutMode: null !== (_c = options.layoutMode) && void 0 !== _c ? _c : "default",
82603
- fontSizeShrinkFactor: null !== (_d = options.fontSizeShrinkFactor) && void 0 !== _d ? _d : .8,
82604
- stepFactor: null !== (_e = options.stepFactor) && void 0 !== _e ? _e : 1,
82605
- importantWordCount: null !== (_f = options.importantWordCount) && void 0 !== _f ? _f : 10,
82513
+ layoutMode: null !== (_b = options.layoutMode) && void 0 !== _b ? _b : "default",
82514
+ fontSizeShrinkFactor: null !== (_c = options.fontSizeShrinkFactor) && void 0 !== _c ? _c : .8,
82515
+ stepFactor: null !== (_d = options.stepFactor) && void 0 !== _d ? _d : 1,
82516
+ importantWordCount: null !== (_e = options.importantWordCount) && void 0 !== _e ? _e : 10,
82606
82517
  globalShinkLimit: options.globalShinkLimit || .2,
82607
- fontSizeEnlargeFactor: null !== (_g = options.fontSizeEnlargeFactor) && void 0 !== _g ? _g : 1.5,
82608
- fillingRatio: null !== (_h = options.fillingRatio) && void 0 !== _h ? _h : .7,
82609
- fillingTimes: null !== (_j = options.fillingTimes) && void 0 !== _j ? _j : 4,
82610
- fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (_k = options.fillingXStep) && void 0 !== _k ? _k : 4,
82611
- fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (_l = options.fillingYStep) && void 0 !== _l ? _l : 4,
82518
+ fontSizeEnlargeFactor: null !== (_f = options.fontSizeEnlargeFactor) && void 0 !== _f ? _f : 1.5,
82519
+ fillingRatio: null !== (_g = options.fillingRatio) && void 0 !== _g ? _g : .7,
82520
+ fillingTimes: null !== (_h = options.fillingTimes) && void 0 !== _h ? _h : 4,
82521
+ fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (_j = options.fillingXStep) && void 0 !== _j ? _j : 4,
82522
+ fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (_k = options.fillingYStep) && void 0 !== _k ? _k : 4,
82612
82523
  fillingInitialFontSize: options.fillingInitialFontSize,
82613
82524
  fillingDeltaFontSize: options.fillingDeltaFontSize,
82614
- fillingInitialOpacity: null !== (_m = options.fillingInitialOpacity) && void 0 !== _m ? _m : .8,
82615
- fillingDeltaOpacity: null !== (_o = options.fillingDeltaOpacity) && void 0 !== _o ? _o : .05,
82525
+ fillingInitialOpacity: null !== (_l = options.fillingInitialOpacity) && void 0 !== _l ? _l : .8,
82526
+ fillingDeltaOpacity: null !== (_m = options.fillingDeltaOpacity) && void 0 !== _m ? _m : .05,
82616
82527
  getFillingFontFamily: field(options.fillingFontFamily || "sans-serif"),
82617
82528
  getFillingFontStyle: field(options.fillingFontStyle || "normal"),
82618
82529
  getFillingFontWeight: field(options.fillingFontWeight || "normal"),
82619
- getFillingPadding: field(null !== (_p = options.fillingPadding) && void 0 !== _p ? _p : .4),
82620
- fillingRotateList: null !== (_q = options.fillingRotateList) && void 0 !== _q ? _q : [0, 90],
82621
- fillingDeltaFontSizeFactor: null !== (_r = options.fillingDeltaFontSizeFactor) && void 0 !== _r ? _r : .2,
82530
+ getFillingPadding: field(null !== (_o = options.fillingPadding) && void 0 !== _o ? _o : .4),
82531
+ fillingRotateList: null !== (_p = options.fillingRotateList) && void 0 !== _p ? _p : [0, 90],
82532
+ fillingDeltaFontSizeFactor: null !== (_q = options.fillingDeltaFontSizeFactor) && void 0 !== _q ? _q : .2,
82622
82533
  fillingColorList: options.fillingColorList || ["#537EF5"],
82623
82534
  sameColorList: !1,
82624
- minInitFontSize: null !== (_s = options.minInitFontSize) && void 0 !== _s ? _s : 10,
82625
- minFontSize: null !== (_t = options.minFontSize) && void 0 !== _t ? _t : 4,
82626
- minFillFontSize: null !== (_u = options.minFillFontSize) && void 0 !== _u ? _u : 2
82535
+ minInitFontSize: null !== (_r = options.minInitFontSize) && void 0 !== _r ? _r : 10,
82536
+ minFontSize: null !== (_s = options.minFontSize) && void 0 !== _s ? _s : 4,
82537
+ minFillFontSize: null !== (_t = options.minFillFontSize) && void 0 !== _t ? _t : 2
82627
82538
  },
82628
82539
  sameColorList = colorListEqual(wordsConfig.colorList, layoutConfig.fillingColorList);
82629
82540
  layoutConfig.sameColorList = sameColorList, initColorScale(data, wordsConfig, layoutConfig, options), initFillingWordsFontSize(data, wordsConfig, layoutConfig, segmentationOutput);
@@ -82670,8 +82581,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82670
82581
  successedWords: successedWords,
82671
82582
  failedWords: failedWords
82672
82583
  } = cloud(words, layoutConfig, segmentationOutput),
82673
- textKey = null !== (_w = null === (_v = options.text) || void 0 === _v ? void 0 : _v.field) && void 0 !== _w ? _w : "textKey",
82674
- dataIndexKey = null !== (_x = options.dataIndexKey) && void 0 !== _x ? _x : "defaultDataIndexKey",
82584
+ textKey = null !== (_v = null === (_u = options.text) || void 0 === _u ? void 0 : _u.field) && void 0 !== _v ? _v : "textKey",
82585
+ dataIndexKey = null !== (_w = options.dataIndexKey) && void 0 !== _w ? _w : "defaultDataIndexKey",
82675
82586
  as = options.as ? Object.assign(Object.assign({}, OUTPUT), options.as) : OUTPUT;
82676
82587
  let w, t;
82677
82588
  const modKeywords = [];
@@ -82686,7 +82597,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82686
82597
  successedWords: successedWords,
82687
82598
  failedWords: failedWords
82688
82599
  });
82689
- const stage = null === (_y = this.view.renderer) || void 0 === _y ? void 0 : _y.stage();
82600
+ const stage = null === (_x = this.view.renderer) || void 0 === _x ? void 0 : _x.stage();
82690
82601
  stage && stage.hooks.afterRender.tap(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, () => {
82691
82602
  this.view.emit(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, {
82692
82603
  successedWords: successedWords,
@@ -98983,7 +98894,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98983
98894
  };
98984
98895
  }
98985
98896
  _getTitleAttrs() {
98986
- var _a, _b, _c, _d, _e, _f, _g, _h;
98897
+ var _a, _b, _c, _d, _e, _f;
98987
98898
  if (this._spec.visible === false) {
98988
98899
  return { visible: false };
98989
98900
  }
@@ -98991,10 +98902,26 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98991
98902
  const titleWidth = calcLayoutNumber(this._spec.width, layoutRect.width, null, layoutRect.width);
98992
98903
  const titleMaxWidth = calcLayoutNumber(this._spec.maxWidth, layoutRect.width, null, layoutRect.width);
98993
98904
  const maxWidth = Math.max(Math.min(titleWidth, titleMaxWidth, layoutRect.width), 0);
98994
- const attrs = Object.assign(Object.assign({}, pickWithout(this._spec, ['padding'])), { textType: (_a = this._spec.textType) !== null && _a !== void 0 ? _a : 'text', text: (_b = this._spec.text) !== null && _b !== void 0 ? _b : '', subtextType: (_c = this._spec.subtextType) !== null && _c !== void 0 ? _c : 'text', subtext: (_d = this._spec.subtext) !== null && _d !== void 0 ? _d : '', x: (_e = this._spec.x) !== null && _e !== void 0 ? _e : 0, y: (_f = this._spec.y) !== null && _f !== void 0 ? _f : 0, height: this._spec.height, minWidth: this._spec.minWidth, maxWidth, minHeight: this._spec.minHeight, maxHeight: this._spec.maxHeight, padding: this._spec.innerPadding, align: (_g = this._spec.align) !== null && _g !== void 0 ? _g : 'left', verticalAlign: (_h = this._spec.verticalAlign) !== null && _h !== void 0 ? _h : 'top', textStyle: Object.assign({ width: maxWidth, maxLineWidth: maxWidth }, this._spec.textStyle), subtextStyle: Object.assign({ maxLineWidth: maxWidth }, this._spec.subtextStyle) });
98905
+ const hasText = isValid$1(this._spec.text) && this._spec.text !== '';
98906
+ const hasSubtext = isValid$1(this._spec.subtext) && this._spec.subtext !== '';
98907
+ const attrs = Object.assign(Object.assign({}, pickWithout(this._spec, ['padding'])), { textType: (_a = this._spec.textType) !== null && _a !== void 0 ? _a : 'text', text: hasText ? this._spec.text : undefined, subtextType: (_b = this._spec.subtextType) !== null && _b !== void 0 ? _b : 'text', subtext: hasSubtext ? this._spec.subtext : undefined, x: (_c = this._spec.x) !== null && _c !== void 0 ? _c : 0, y: (_d = this._spec.y) !== null && _d !== void 0 ? _d : 0, height: this._spec.height, minWidth: this._spec.minWidth, maxWidth, minHeight: this._spec.minHeight, maxHeight: this._spec.maxHeight, padding: this._spec.innerPadding, align: (_e = this._spec.align) !== null && _e !== void 0 ? _e : 'left', verticalAlign: (_f = this._spec.verticalAlign) !== null && _f !== void 0 ? _f : 'top', textStyle: Object.assign({ maxLineWidth: maxWidth }, this._spec.textStyle), subtextStyle: Object.assign({ maxLineWidth: maxWidth }, this._spec.subtextStyle) });
98908
+ if (hasText) {
98909
+ attrs.textStyle.width = maxWidth;
98910
+ }
98911
+ if (hasSubtext) {
98912
+ attrs.subtextStyle.width = maxWidth;
98913
+ }
98995
98914
  if (isValid$1(this._spec.width)) {
98996
- attrs.textStyle.width = Math.max(titleWidth, layoutRect.width);
98997
- attrs.subtextStyle.width = attrs.textStyle.width;
98915
+ const clampedWidth = Math.max(Math.min(titleWidth, layoutRect.width), 0);
98916
+ if (hasText) {
98917
+ attrs.textStyle.width = clampedWidth;
98918
+ }
98919
+ else {
98920
+ delete attrs.textStyle.width;
98921
+ }
98922
+ if (hasSubtext) {
98923
+ attrs.subtextStyle.width = clampedWidth;
98924
+ }
98998
98925
  }
98999
98926
  return attrs;
99000
98927
  }