evui 3.4.138 → 3.4.140

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.
@@ -11191,7 +11191,7 @@ $({ target: 'Number', stat: true }, {
11191
11191
  /***/ "9224":
11192
11192
  /***/ (function(module) {
11193
11193
 
11194
- module.exports = JSON.parse("{\"a\":\"3.4.138\"}");
11194
+ module.exports = JSON.parse("{\"a\":\"3.4.140\"}");
11195
11195
 
11196
11196
  /***/ }),
11197
11197
 
@@ -41356,7 +41356,8 @@ var AXIS_OPTION = {
41356
41356
  fitWidth: false,
41357
41357
  fitDir: 'right',
41358
41358
  alignToGridLine: false,
41359
- padding: 0
41359
+ padding: 0,
41360
+ fixWidth: undefined
41360
41361
  },
41361
41362
  title: {
41362
41363
  use: false,
@@ -45180,6 +45181,7 @@ var model_series_modules = {
45180
45181
 
45181
45182
 
45182
45183
 
45184
+
45183
45185
  var scale_Scale = /*#__PURE__*/function () {
45184
45186
  function Scale(type, axisOpt, ctx, options) {
45185
45187
  var _this = this;
@@ -45572,7 +45574,7 @@ var scale_Scale = /*#__PURE__*/function () {
45572
45574
  labelPoint = _this3.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
45573
45575
 
45574
45576
  if (options !== null && options !== void 0 && (_options$brush = options.brush) !== null && _options$brush !== void 0 && _options$brush.showLabel || !(options !== null && options !== void 0 && options.brush)) {
45575
- ctx.fillText(labelText, labelCenter, labelPoint);
45577
+ ctx.fillText(_this3.checkFixWidth(labelText), labelCenter, labelPoint);
45576
45578
  }
45577
45579
 
45578
45580
  if (!isBlurredLabel && options !== null && options !== void 0 && (_options$selectItem = options.selectItem) !== null && _options$selectItem !== void 0 && _options$selectItem.showLabelTip && hitInfo !== null && hitInfo !== void 0 && hitInfo.label && !((_this3$options3 = _this3.options) !== null && _this3$options3 !== void 0 && _this3$options3.horizontal)) {
@@ -45620,7 +45622,7 @@ var scale_Scale = /*#__PURE__*/function () {
45620
45622
  labelPoint = _this3.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
45621
45623
 
45622
45624
  if (options !== null && options !== void 0 && (_options$brush2 = options.brush) !== null && _options$brush2 !== void 0 && _options$brush2.showLabel || !(options !== null && options !== void 0 && options.brush)) {
45623
- ctx.fillText(labelText, labelPoint, labelCenter);
45625
+ ctx.fillText(_this3.checkFixWidth(labelText), labelPoint, labelCenter);
45624
45626
  }
45625
45627
 
45626
45628
  if (ix === steps) {
@@ -46176,6 +46178,25 @@ var scale_Scale = /*#__PURE__*/function () {
46176
46178
  ctx.fillText(label, textX, textY);
46177
46179
  ctx.closePath();
46178
46180
  }
46181
+ /**
46182
+ * Check if the label width is greater than the fix width
46183
+ * @param {string} value label value
46184
+ * @returns
46185
+ */
46186
+
46187
+ }, {
46188
+ key: "checkFixWidth",
46189
+ value: function checkFixWidth(value) {
46190
+ var _this$labelStyle3 = this.labelStyle,
46191
+ fixWidth = _this$labelStyle3.fixWidth,
46192
+ fitDir = _this$labelStyle3.fitDir;
46193
+
46194
+ if (truthyNumber(fixWidth) && fixWidth > 0) {
46195
+ return helpers_util.truncateLabelWithEllipsis(value, fixWidth, this.ctx, fitDir);
46196
+ }
46197
+
46198
+ return value;
46199
+ }
46179
46200
  }]);
46180
46201
 
46181
46202
  return Scale;
@@ -46282,7 +46303,7 @@ var scale_linear_LinearScale = /*#__PURE__*/function (_Scale) {
46282
46303
  }
46283
46304
 
46284
46305
  _createClass(LinearScale, [{
46285
- key: "getLabelFormat",
46306
+ key: "getTruthyValue",
46286
46307
 
46287
46308
  /**
46288
46309
  * Transforming label by designated format
@@ -46291,13 +46312,18 @@ var scale_linear_LinearScale = /*#__PURE__*/function (_Scale) {
46291
46312
  *
46292
46313
  * @returns {string} formatted label
46293
46314
  */
46315
+ value: function getTruthyValue(value) {
46316
+ return truthyNumber(value) ? Number(value.toFixed(this.decimalPoint)) : value;
46317
+ }
46318
+ }, {
46319
+ key: "getLabelFormat",
46294
46320
  value: function getLabelFormat(value) {
46295
46321
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46296
46322
 
46297
46323
  if (this.formatter) {
46298
- var formattedLabel = this.formatter(Number(value.toFixed(this.decimalPoint)), _objectSpread2(_objectSpread2({}, data), {}, {
46324
+ var formattedLabel = this.formatter(this.getTruthyValue(value), _objectSpread2(_objectSpread2({}, data), {}, {
46299
46325
  prevOriginalValue: data === null || data === void 0 ? void 0 : data.prev,
46300
- prevDecimalPointValue: truthyNumber(data === null || data === void 0 ? void 0 : data.prev) ? Number(data === null || data === void 0 ? void 0 : data.prev.toFixed(this.decimalPoint)) : null,
46326
+ prevDecimalPointValue: this.getTruthyValue(data === null || data === void 0 ? void 0 : data.prev),
46301
46327
  currentOriginalValue: value,
46302
46328
  currentDecimalPointValue: Number(value.toFixed(this.decimalPoint))
46303
46329
  }));
@@ -46798,7 +46824,7 @@ var scale_step_StepScale = /*#__PURE__*/function (_Scale) {
46798
46824
  if (this.type === 'x') {
46799
46825
  labelPoint = this.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
46800
46826
  var xPoint = alignToGridLine ? labelCenter : labelCenter + labelGap / 2;
46801
- ctx.fillText(labelText, xPoint, labelPoint);
46827
+ ctx.fillText(this.checkFixWidth(labelText), xPoint, labelPoint);
46802
46828
 
46803
46829
  if (!isBlurredLabel && selectItemOpt !== null && selectItemOpt !== void 0 && selectItemOpt.showLabelTip && hitInfo !== null && hitInfo !== void 0 && hitInfo.label && !horizontal) {
46804
46830
  var selectedLabel = hitInfo.label;
@@ -46842,7 +46868,7 @@ var scale_step_StepScale = /*#__PURE__*/function (_Scale) {
46842
46868
  } else {
46843
46869
  labelPoint = this.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
46844
46870
  var yPoint = alignToGridLine ? labelCenter : labelCenter + labelGap / 2;
46845
- ctx.fillText(labelText, labelPoint, yPoint);
46871
+ ctx.fillText(this.checkFixWidth(labelText), labelPoint, yPoint);
46846
46872
  drawnLabels.push(labelText);
46847
46873
 
46848
46874
  if (this.showAxisTick) {
@@ -46882,14 +46908,14 @@ var scale_step_StepScale = /*#__PURE__*/function (_Scale) {
46882
46908
  var lastLabelText = this.getLabelFormat("".concat(lastLabelValue), maxWidth);
46883
46909
 
46884
46910
  if (this.type === 'x') {
46885
- ctx.fillText(lastLabelText, labelCenter, labelPoint);
46911
+ ctx.fillText(this.checkFixWidth(lastLabelText), labelCenter, labelPoint);
46886
46912
 
46887
46913
  if (this.showGrid) {
46888
46914
  ctx.moveTo(linePosition, offsetPoint);
46889
46915
  ctx.lineTo(linePosition, offsetCounterPoint);
46890
46916
  }
46891
46917
  } else {
46892
- ctx.fillText(lastLabelText, labelPoint, labelCenter);
46918
+ ctx.fillText(this.checkFixWidth(lastLabelText), labelPoint, labelCenter);
46893
46919
 
46894
46920
  if (this.showGrid) {
46895
46921
  ctx.moveTo(offsetPoint, linePosition);
@@ -47283,7 +47309,7 @@ var scale_time_category_TimeCategoryScale = /*#__PURE__*/function (_Scale) {
47283
47309
  var _this2$options3, _this2$options3$selec, _this2$options4;
47284
47310
 
47285
47311
  labelPoint = _this2.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
47286
- ctx.fillText(labelText, labelCenter, labelPoint);
47312
+ ctx.fillText(_this2.checkFixWidth(labelText), labelCenter, labelPoint);
47287
47313
 
47288
47314
  if (!isBlurredLabel && (_this2$options3 = _this2.options) !== null && _this2$options3 !== void 0 && (_this2$options3$selec = _this2$options3.selectItem) !== null && _this2$options3$selec !== void 0 && _this2$options3$selec.showLabelTip && hitInfo !== null && hitInfo !== void 0 && hitInfo.label && !((_this2$options4 = _this2.options) !== null && _this2$options4 !== void 0 && _this2$options4.horizontal)) {
47289
47315
  var selectedLabel = _this2.getLabelFormat(Math.min(axisMax, hitInfo.label + 0 * stepValue));
@@ -47326,7 +47352,7 @@ var scale_time_category_TimeCategoryScale = /*#__PURE__*/function (_Scale) {
47326
47352
  }
47327
47353
  } else {
47328
47354
  labelPoint = _this2.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
47329
- ctx.fillText(labelText, labelPoint, labelCenter);
47355
+ ctx.fillText(_this2.checkFixWidth(labelText), labelPoint, labelCenter);
47330
47356
 
47331
47357
  if (_this2.showAxisTick) {
47332
47358
  var _this2$axisLineWidth;
@@ -47363,14 +47389,14 @@ var scale_time_category_TimeCategoryScale = /*#__PURE__*/function (_Scale) {
47363
47389
  linePosition = labelCenter + aliasPixel;
47364
47390
 
47365
47391
  if (this.type === 'x') {
47366
- ctx.fillText(labelLastText, labelCenter, labelPoint);
47392
+ ctx.fillText(this.checkFixWidth(labelLastText), labelCenter, labelPoint);
47367
47393
 
47368
47394
  if (this.showGrid) {
47369
47395
  ctx.moveTo(linePosition, offsetPoint);
47370
47396
  ctx.lineTo(linePosition, offsetCounterPoint);
47371
47397
  }
47372
47398
  } else {
47373
- ctx.fillText(labelLastText, labelPoint, labelCenter);
47399
+ ctx.fillText(this.checkFixWidth(labelLastText), labelPoint, labelCenter);
47374
47400
 
47375
47401
  if (this.showGrid) {
47376
47402
  ctx.moveTo(offsetPoint, linePosition);
@@ -55309,8 +55335,16 @@ var chart_core_EvChart = /*#__PURE__*/function () {
55309
55335
  _this2 = this,
55310
55336
  _this$axesSteps,
55311
55337
  _this$axesSteps2,
55312
- _this$axesX$,
55313
55338
  _this$axesY$,
55339
+ _this$axesY$$labelSty,
55340
+ _this$axesY$2,
55341
+ _this$axesY$2$labelSt,
55342
+ _this$axesX$,
55343
+ _this$axesX$$labelSty,
55344
+ _this$axesX$2,
55345
+ _this$axesX$2$labelSt,
55346
+ _this$axesX$3,
55347
+ _this$axesY$3,
55314
55348
  _this$axesRange,
55315
55349
  _this$axesRange$x,
55316
55350
  _this$axesRange2,
@@ -55359,13 +55393,15 @@ var chart_core_EvChart = /*#__PURE__*/function () {
55359
55393
 
55360
55394
  var notFormattedXLabels = getNotFormattedLabels((_this$axesSteps = this.axesSteps) === null || _this$axesSteps === void 0 ? void 0 : _this$axesSteps.x[0]);
55361
55395
  var notFormattedYLabels = getNotFormattedLabels((_this$axesSteps2 = this.axesSteps) === null || _this$axesSteps2 === void 0 ? void 0 : _this$axesSteps2.y[0]);
55362
- var xMaxWidth = (_this$axesX$ = this.axesX[0]) === null || _this$axesX$ === void 0 ? void 0 : _this$axesX$.getLabelWidthHasMaxLength(notFormattedXLabels);
55363
- var yMaxWidth = (_this$axesY$ = this.axesY[0]) === null || _this$axesY$ === void 0 ? void 0 : _this$axesY$.getLabelWidthHasMaxLength(notFormattedYLabels);
55396
+ var yFixWidth = truthyNumber((_this$axesY$ = this.axesY[0]) === null || _this$axesY$ === void 0 ? void 0 : (_this$axesY$$labelSty = _this$axesY$.labelStyle) === null || _this$axesY$$labelSty === void 0 ? void 0 : _this$axesY$$labelSty.fixWidth) ? (_this$axesY$2 = this.axesY[0]) === null || _this$axesY$2 === void 0 ? void 0 : (_this$axesY$2$labelSt = _this$axesY$2.labelStyle) === null || _this$axesY$2$labelSt === void 0 ? void 0 : _this$axesY$2$labelSt.fixWidth : 0;
55397
+ var xFixWidth = truthyNumber((_this$axesX$ = this.axesX[0]) === null || _this$axesX$ === void 0 ? void 0 : (_this$axesX$$labelSty = _this$axesX$.labelStyle) === null || _this$axesX$$labelSty === void 0 ? void 0 : _this$axesX$$labelSty.fixWidth) ? (_this$axesX$2 = this.axesX[0]) === null || _this$axesX$2 === void 0 ? void 0 : (_this$axesX$2$labelSt = _this$axesX$2.labelStyle) === null || _this$axesX$2$labelSt === void 0 ? void 0 : _this$axesX$2$labelSt.fixWidth : 0;
55398
+ var xMaxWidth = (_this$axesX$3 = this.axesX[0]) === null || _this$axesX$3 === void 0 ? void 0 : _this$axesX$3.getLabelWidthHasMaxLength(notFormattedXLabels);
55399
+ var yMaxWidth = (_this$axesY$3 = this.axesY[0]) === null || _this$axesY$3 === void 0 ? void 0 : _this$axesY$3.getLabelWidthHasMaxLength(notFormattedYLabels);
55364
55400
  var adjustedRange = {
55365
55401
  x: !isStepXAxisUseFitWidth ? (_this$axesRange = this.axesRange) === null || _this$axesRange === void 0 ? void 0 : (_this$axesRange$x = _this$axesRange.x) === null || _this$axesRange$x === void 0 ? void 0 : _this$axesRange$x.map(function (value) {
55366
55402
  return _objectSpread2(_objectSpread2({}, value), {}, {
55367
55403
  size: {
55368
- width: Math.max(xMaxWidth, value.size.width),
55404
+ width: xFixWidth || Math.max(xMaxWidth, value.size.width),
55369
55405
  height: value.size.height
55370
55406
  }
55371
55407
  });
@@ -55373,7 +55409,7 @@ var chart_core_EvChart = /*#__PURE__*/function () {
55373
55409
  y: !isStepYAxisUseFitWidth ? (_this$axesRange3 = this.axesRange) === null || _this$axesRange3 === void 0 ? void 0 : (_this$axesRange3$y = _this$axesRange3.y) === null || _this$axesRange3$y === void 0 ? void 0 : _this$axesRange3$y.map(function (value) {
55374
55410
  return _objectSpread2(_objectSpread2({}, value), {}, {
55375
55411
  size: {
55376
- width: Math.max(yMaxWidth, value.size.width),
55412
+ width: yFixWidth || Math.max(yMaxWidth, value.size.width),
55377
55413
  height: value.size.height
55378
55414
  }
55379
55415
  });