tvcharts 0.8.56 → 0.8.58

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.
@@ -152,7 +152,9 @@ var BoxesLayout = {
152
152
  text_halign = _a.text_halign,
153
153
  text_size = _a.text_size,
154
154
  text_valign = _a.text_valign,
155
- text_wrap = _a.text_wrap;
155
+ text_wrap = _a.text_wrap,
156
+ fontStyle = _a.fontStyle,
157
+ fontWeight = _a.fontWeight;
156
158
  if (!border_color && !text && !bgcolor) {
157
159
  continue;
158
160
  }
@@ -185,7 +187,9 @@ var BoxesLayout = {
185
187
  width: width_1,
186
188
  height: height,
187
189
  x: x,
188
- y: y
190
+ y: y,
191
+ fontStyle: fontStyle,
192
+ fontWeight: fontWeight
189
193
  });
190
194
  }
191
195
  points.push(left, right, startPoint[1], endPoint[1]);
@@ -126,7 +126,9 @@ var BoxesView = /** @class */function (_super) {
126
126
  align: item.align,
127
127
  fill: (_a = item.text_color) !== null && _a !== void 0 ? _a : '#fff',
128
128
  fontSize: item.text_size,
129
- overflow: item.text_wrap === 'wrap_auto' ? 'breakAll' : 'none'
129
+ overflow: item.text_wrap === 'wrap_auto' ? 'breakAll' : 'none',
130
+ fontStyle: item.fontStyle,
131
+ fontWeight: item.fontWeight
130
132
  };
131
133
  var el = new graphic.Text({
132
134
  style: __assign({}, textStyle),
@@ -111,7 +111,9 @@ var LabelsView = /** @class */function (_super) {
111
111
  _a = item.offset,
112
112
  offset = _a === void 0 ? [0, 0] : _a,
113
113
  textBorderColor = item.textBorderColor,
114
- textBorderWidth = item.textBorderWidth;
114
+ textBorderWidth = item.textBorderWidth,
115
+ fontStyle = item.fontStyle,
116
+ fontWeight = item.fontWeight;
115
117
  var el = new graphic.Text({
116
118
  style: {
117
119
  text: text,
@@ -122,7 +124,9 @@ var LabelsView = /** @class */function (_super) {
122
124
  stroke: textBorderColor,
123
125
  lineWidth: textBorderWidth,
124
126
  x: point[0] + offset[0],
125
- y: point[1] + offset[1]
127
+ y: point[1] + offset[1],
128
+ fontStyle: fontStyle,
129
+ fontWeight: fontWeight
126
130
  }
127
131
  });
128
132
  el.states.emphasis = emphasisState;
@@ -43,7 +43,7 @@
43
43
  */
44
44
  /* global Float32Array */
45
45
  import createRenderPlanner from '../helper/createRenderPlanner.js';
46
- import { map, each } from 'tvrender/lib/core/util.js';
46
+ import { map, each, trim } from 'tvrender/lib/core/util.js';
47
47
  import { getSymbolLabelFontSize, getSymbolSize } from '../../util/symbolSize.js';
48
48
  import { getLineHeight, getWidth } from 'tvrender/lib/contain/text.js';
49
49
  // import { createFloat32Array } from '../../util/vendor.js';
@@ -185,6 +185,8 @@ var labelsLayout = {
185
185
  var textShow = labelModel.show;
186
186
  var fontSize = labelModel.fontSize;
187
187
  var position = labelModel.position || 'top';
188
+ var fontStyle = labelModel.fontStyle;
189
+ var fontWeight = labelModel.fontWeight;
188
190
  // const isBelowbar = yloc === 'belowbar';
189
191
  // if (isBelowbar) {
190
192
  // position = 'bottom';
@@ -207,7 +209,10 @@ var labelsLayout = {
207
209
  // });
208
210
  // textRect = computedText.getBoundingRect();
209
211
  var textSize = fontSize ? fontSize + 'px' : gfontSize;
210
- textRect = getTextRect(text, textSize + " " + (labelModel.fontFamily || gfontFamily));
212
+ var font = trim([
213
+ // FIXME in node-canvas fontWeight is before fontStyle
214
+ fontStyle || '', fontWeight || '', textSize, labelModel.fontFamily || gfontFamily].join(' '));
215
+ textRect = getTextRect(text, font);
211
216
  if (isLabel) {
212
217
  symbolSize = [textRect.width + HPadding, textRect.height + VPadding];
213
218
  }
@@ -275,7 +280,9 @@ var labelsLayout = {
275
280
  fontFamily: labelModel.fontFamily,
276
281
  offset: [oldOffset[0] + symbolOffset[0], oldOffset[1] + symbolOffset[1]],
277
282
  textBorderColor: labelModel.textBorderColor,
278
- textBorderWidth: labelModel.textBorderWidth
283
+ textBorderWidth: labelModel.textBorderWidth,
284
+ fontStyle: fontStyle,
285
+ fontWeight: fontWeight
279
286
  });
280
287
  }
281
288
  // labelsData.setItemLayout(i, [point[0], price ?? point[1]]);
@@ -238,8 +238,8 @@ var RoamController = /** @class */function (_super) {
238
238
  if (interactionMutex.isTaken(this._zr, 'globalPan')) {
239
239
  return;
240
240
  }
241
- // const scale = e.pinchScale > 1 ? 1.1 : 1 / 1.1;
242
- var scale = e.pinchScale;
241
+ var scale = e.pinchScale > 1 ? 1.05 : 1 / 1.05;
242
+ // const scale = e.pinchScale;
243
243
  // if (e.pinchScale === 1) {
244
244
  // console.log('%c [ e ]-316', 'font-size:13px; background:pink; color:#bf2c9f;', e)
245
245
  // }
@@ -266,6 +266,10 @@ var RoamController = /** @class */function (_super) {
266
266
  requestAnimationFrame(function () {
267
267
  return _this._kineticScroll();
268
268
  });
269
+ } else {
270
+ trigger(this, 'dragEnd', 'moveOnMouseMove', {}, {
271
+ isAvailableBehavior: null
272
+ });
269
273
  }
270
274
  };
271
275
  RoamController.prototype._startKineticScroll = function () {
@@ -190,12 +190,16 @@ var TableView = /** @class */function (_super) {
190
190
  height = cellItem.height,
191
191
  text_size = cellItem.text_size,
192
192
  _a = cellItem.text_font_family,
193
- text_font_family = _a === void 0 ? DefaultFamily : _a;
193
+ text_font_family = _a === void 0 ? DefaultFamily : _a,
194
+ fontStyle = cellItem.fontStyle,
195
+ fontWeight = cellItem.fontWeight;
194
196
  var mergeCell = margeCellByKey[row + ':' + column];
195
197
  var fontSize = getSymbolLabelFontSize(text_size);
196
198
  var font = getFont({
197
199
  fontSize: fontSize,
198
- fontFamily: text_font_family
200
+ fontFamily: text_font_family,
201
+ fontStyle: fontStyle,
202
+ fontWeight: fontWeight
199
203
  }, ecModel);
200
204
  // todo这个api算出来有问题
201
205
  // const textRect = textContain.getBoundingRect(text, font);
@@ -323,7 +327,9 @@ var TableView = /** @class */function (_super) {
323
327
  text_halign = cellItem.text_halign,
324
328
  text_color = cellItem.text_color,
325
329
  bgcolor = cellItem.bgcolor,
326
- text_valign = cellItem.text_valign;
330
+ text_valign = cellItem.text_valign,
331
+ fontStyle = cellItem.fontStyle,
332
+ fontWeight = cellItem.fontWeight;
327
333
  var fontSize = getSymbolLabelFontSize(text_size);
328
334
  var x = columnObjByIndex[column].x;
329
335
  var width = columnObjByIndex[column].width;
@@ -365,7 +371,9 @@ var TableView = /** @class */function (_super) {
365
371
  fontFamily: text_font_family,
366
372
  verticalAlign: verticalAlign,
367
373
  align: align,
368
- overflow: 'truncate'
374
+ overflow: 'truncate',
375
+ fontStyle: fontStyle,
376
+ fontWeight: fontWeight
369
377
  },
370
378
  x: x + getTextXOffset(width, align, 0),
371
379
  y: y + getTextYOffset(height, verticalAlign, 0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tvcharts",
3
- "version": "0.8.56",
3
+ "version": "0.8.58",
4
4
  "description": "基于echarts5.5.0二次开发",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  import SeriesModel from '../../model/Series.js';
2
2
  import SeriesData from '../../data/SeriesData.js';
3
- import { SeriesOption, SeriesOnCartesianOptionMixin, SeriesOnGeoOptionMixin, SeriesOnPolarOptionMixin, SeriesOnCalendarOptionMixin, SeriesLargeOptionMixin, OptionDataValue, StatesOptionMixin, SeriesEncodeOptionMixin } from '../../util/types.js';
3
+ import { SeriesOption, SeriesOnCartesianOptionMixin, SeriesOnGeoOptionMixin, SeriesOnPolarOptionMixin, SeriesOnCalendarOptionMixin, SeriesLargeOptionMixin, OptionDataValue, StatesOptionMixin, SeriesEncodeOptionMixin, ZRFontStyle, ZRFontWeight } from '../../util/types.js';
4
4
  import { PathState } from 'tvrender/lib/graphic/Path.js';
5
5
  declare type LinesValue = OptionDataValue | OptionDataValue[];
6
6
  interface LinesStatesMixin {
@@ -20,6 +20,8 @@ export interface ITextEl {
20
20
  y: number;
21
21
  width?: number;
22
22
  height?: number;
23
+ fontStyle?: ZRFontStyle;
24
+ fontWeight?: ZRFontWeight;
23
25
  }
24
26
  export interface LinesStateOption {
25
27
  id: string;
@@ -35,6 +37,8 @@ export interface LinesStateOption {
35
37
  text_size?: ISize;
36
38
  text_valign?: ITextAlign;
37
39
  text_wrap?: 'wrap_none' | 'wrap_auto';
40
+ fontStyle?: ZRFontStyle;
41
+ fontWeight?: ZRFontWeight;
38
42
  };
39
43
  }
40
44
  export interface BoxesDataItemOption extends LinesStateOption, StatesOptionMixin<LinesStateOption, LinesStatesMixin & {
@@ -1,5 +1,5 @@
1
1
  import ComponentModel from '../../model/Component.js';
2
- import { ComponentOption } from '../../util/types.js';
2
+ import { ComponentOption, ZRFontStyle, ZRFontWeight } from '../../util/types.js';
3
3
  import { PathState } from 'tvrender/lib/graphic/Path.js';
4
4
  export interface IMergeCell {
5
5
  end_column: number;
@@ -21,6 +21,8 @@ interface ICell {
21
21
  row: number;
22
22
  merge_columns?: number;
23
23
  merge_rows?: number;
24
+ fontStyle?: ZRFontStyle;
25
+ fontWeight?: ZRFontWeight;
24
26
  }
25
27
  export declare type IPosition = 'top_right' | 'top_left' | 'bottom_center' | 'bottom_left' | 'bottom_right' | 'middle_left' | 'middle_right' | 'top_center' | 'middle_center';
26
28
  export interface ITable {