@visactor/vchart 1.13.23-alpha.0 → 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.es.js CHANGED
@@ -98888,7 +98888,7 @@ class Title extends BaseComponent {
98888
98888
  };
98889
98889
  }
98890
98890
  _getTitleAttrs() {
98891
- var _a, _b, _c, _d, _e, _f, _g, _h;
98891
+ var _a, _b, _c, _d, _e, _f;
98892
98892
  if (this._spec.visible === false) {
98893
98893
  return { visible: false };
98894
98894
  }
@@ -98896,10 +98896,26 @@ class Title extends BaseComponent {
98896
98896
  const titleWidth = calcLayoutNumber(this._spec.width, layoutRect.width, null, layoutRect.width);
98897
98897
  const titleMaxWidth = calcLayoutNumber(this._spec.maxWidth, layoutRect.width, null, layoutRect.width);
98898
98898
  const maxWidth = Math.max(Math.min(titleWidth, titleMaxWidth, layoutRect.width), 0);
98899
- 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) });
98899
+ const hasText = isValid$1(this._spec.text) && this._spec.text !== '';
98900
+ const hasSubtext = isValid$1(this._spec.subtext) && this._spec.subtext !== '';
98901
+ 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) });
98902
+ if (hasText) {
98903
+ attrs.textStyle.width = maxWidth;
98904
+ }
98905
+ if (hasSubtext) {
98906
+ attrs.subtextStyle.width = maxWidth;
98907
+ }
98900
98908
  if (isValid$1(this._spec.width)) {
98901
- attrs.textStyle.width = Math.max(titleWidth, layoutRect.width);
98902
- attrs.subtextStyle.width = attrs.textStyle.width;
98909
+ const clampedWidth = Math.max(Math.min(titleWidth, layoutRect.width), 0);
98910
+ if (hasText) {
98911
+ attrs.textStyle.width = clampedWidth;
98912
+ }
98913
+ else {
98914
+ delete attrs.textStyle.width;
98915
+ }
98916
+ if (hasSubtext) {
98917
+ attrs.subtextStyle.width = clampedWidth;
98918
+ }
98903
98919
  }
98904
98920
  return attrs;
98905
98921
  }
package/build/index.js CHANGED
@@ -98894,7 +98894,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98894
98894
  };
98895
98895
  }
98896
98896
  _getTitleAttrs() {
98897
- var _a, _b, _c, _d, _e, _f, _g, _h;
98897
+ var _a, _b, _c, _d, _e, _f;
98898
98898
  if (this._spec.visible === false) {
98899
98899
  return { visible: false };
98900
98900
  }
@@ -98902,10 +98902,26 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98902
98902
  const titleWidth = calcLayoutNumber(this._spec.width, layoutRect.width, null, layoutRect.width);
98903
98903
  const titleMaxWidth = calcLayoutNumber(this._spec.maxWidth, layoutRect.width, null, layoutRect.width);
98904
98904
  const maxWidth = Math.max(Math.min(titleWidth, titleMaxWidth, layoutRect.width), 0);
98905
- 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
+ }
98906
98914
  if (isValid$1(this._spec.width)) {
98907
- attrs.textStyle.width = Math.max(titleWidth, layoutRect.width);
98908
- 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
+ }
98909
98925
  }
98910
98926
  return attrs;
98911
98927
  }