@visactor/vtable 0.22.0 → 0.22.1

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.
Files changed (57) hide show
  1. package/cjs/ListTable.js.map +1 -1
  2. package/cjs/core/BaseTable.js +21 -7
  3. package/cjs/core/BaseTable.js.map +1 -1
  4. package/cjs/data/DataSource.js +5 -1
  5. package/cjs/data/DataSource.js.map +1 -1
  6. package/cjs/index.d.ts +1 -1
  7. package/cjs/index.js +1 -1
  8. package/cjs/index.js.map +1 -1
  9. package/cjs/layout/pivot-header-layout.js +1 -1
  10. package/cjs/layout/pivot-header-layout.js.map +1 -1
  11. package/cjs/layout/tree-helper.js +0 -1
  12. package/cjs/plugins/themes.js +2 -1
  13. package/cjs/scenegraph/component/custom.js +1 -1
  14. package/cjs/scenegraph/component/custom.js.map +1 -1
  15. package/cjs/scenegraph/group-creater/cell-helper.d.ts +1 -0
  16. package/cjs/scenegraph/group-creater/cell-helper.js +16 -26
  17. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  18. package/cjs/scenegraph/group-creater/column-helper.js +3 -2
  19. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  20. package/cjs/scenegraph/group-creater/progress/proxy.js +1 -1
  21. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  22. package/cjs/scenegraph/select/update-select-border.d.ts +2 -0
  23. package/cjs/scenegraph/select/update-select-border.js +19 -2
  24. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  25. package/cjs/ts-types/new-data-set.d.ts +2 -1
  26. package/cjs/ts-types/new-data-set.js.map +1 -1
  27. package/cjs/vrender.js.map +1 -1
  28. package/dist/vtable.js +64 -51
  29. package/dist/vtable.min.js +2 -2
  30. package/es/ListTable.js.map +1 -1
  31. package/es/core/BaseTable.js +20 -7
  32. package/es/core/BaseTable.js.map +1 -1
  33. package/es/data/DataSource.js +5 -1
  34. package/es/data/DataSource.js.map +1 -1
  35. package/es/index.d.ts +1 -1
  36. package/es/index.js +1 -1
  37. package/es/index.js.map +1 -1
  38. package/es/layout/pivot-header-layout.js +1 -1
  39. package/es/layout/pivot-header-layout.js.map +1 -1
  40. package/es/layout/tree-helper.js +1 -2
  41. package/es/plugins/themes.js +2 -1
  42. package/es/scenegraph/component/custom.js +1 -1
  43. package/es/scenegraph/component/custom.js.map +1 -1
  44. package/es/scenegraph/group-creater/cell-helper.d.ts +1 -0
  45. package/es/scenegraph/group-creater/cell-helper.js +12 -24
  46. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  47. package/es/scenegraph/group-creater/column-helper.js +5 -4
  48. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  49. package/es/scenegraph/group-creater/progress/proxy.js +1 -1
  50. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  51. package/es/scenegraph/select/update-select-border.d.ts +2 -0
  52. package/es/scenegraph/select/update-select-border.js +16 -0
  53. package/es/scenegraph/select/update-select-border.js.map +1 -1
  54. package/es/ts-types/new-data-set.d.ts +2 -1
  55. package/es/ts-types/new-data-set.js.map +1 -1
  56. package/es/vrender.js.map +1 -1
  57. package/package.json +2 -2
@@ -68,6 +68,8 @@ import { RowSeriesNumberHelper } from "./row-series-number-helper";
68
68
 
69
69
  import { CustomCellStylePlugin, mergeStyle } from "../plugins/custom-cell-style";
70
70
 
71
+ import { hideCellSelectBorder, restoreCellSelectBorder } from "../scenegraph/select/update-select-border";
72
+
71
73
  const {toBoxArray: toBoxArray} = utilStyle, {isTouchEvent: isTouchEvent} = event, rangeReg = /^\$(\d+)\$(\d+)$/;
72
74
 
73
75
  importStyle();
@@ -80,7 +82,7 @@ export class BaseTable extends EventTarget {
80
82
  }
81
83
  constructor(container, options = {}) {
82
84
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
83
- if (super(), this.showFrozenIcon = !0, this.version = "0.22.0", this.id = `VTable${Date.now()}`,
85
+ if (super(), this.showFrozenIcon = !0, this.version = "0.22.1", this.id = `VTable${Date.now()}`,
84
86
  this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
85
87
  !container && "node" !== options.mode) throw new Error("vtable's container is undefined");
86
88
  const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth} = options;
@@ -1178,7 +1180,7 @@ export class BaseTable extends EventTarget {
1178
1180
  return null === (_a = this.internalProps.dataSource) || void 0 === _a ? void 0 : _a.hasField(index, field);
1179
1181
  }
1180
1182
  _getCellStyle(col, row) {
1181
- var _a, _b, _c, _d;
1183
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1182
1184
  const customCellStyle = this.customCellStylePlugin.getCustomCellStyle(col, row), {layoutMap: layoutMap} = this.internalProps;
1183
1185
  if (layoutMap.isHeader(col, row)) {
1184
1186
  let cacheKey;
@@ -1228,7 +1230,10 @@ export class BaseTable extends EventTarget {
1228
1230
  }
1229
1231
  return this.headerStyleCache.set(cacheKey, cacheStyle), customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
1230
1232
  }
1231
- let cacheKey;
1233
+ let bgColorFunc, cacheKey;
1234
+ (null === (_f = null === (_e = this.internalProps) || void 0 === _e ? void 0 : _e.dataConfig) || void 0 === _f ? void 0 : _f.mappingRules) && !this.isHeader(col, row) && (null === (_j = null === (_h = null === (_g = this.internalProps) || void 0 === _g ? void 0 : _g.dataConfig) || void 0 === _h ? void 0 : _h.mappingRules) || void 0 === _j || _j.forEach(((mappingRule, i) => {
1235
+ mappingRule.bgColor && this.internalProps.layoutMap.getIndicatorKey(col, row) === mappingRule.bgColor.indicatorKey && (bgColorFunc = mappingRule.bgColor.mapping);
1236
+ })));
1232
1237
  const cellType = this.getCellType(col, row);
1233
1238
  let cacheStyle;
1234
1239
  if (cacheKey = this.isSeriesNumberInBody(col, row) ? `${col}-series-` + cellType : this.isListTable() && !this.transpose || this.isPivotTable() && this.internalProps.layoutMap.indicatorsAsCol ? col + cellType : row + cellType,
@@ -1242,7 +1247,9 @@ export class BaseTable extends EventTarget {
1242
1247
  value: this.getCellValue(col, row),
1243
1248
  dataValue: this.getCellOriginValue(col, row),
1244
1249
  cellHeaderPaths: this.getCellHeaderPaths(col, row)
1245
- }, styleClass, this.options.autoWrapText, this.theme), isFunction(style) || (layoutMap.isBottomFrozenRow(row) ? this.bodyBottomStyleCache.set(cacheKey, cacheStyle) : this.bodyStyleCache.set(cacheKey, cacheStyle)),
1250
+ }, styleClass, this.options.autoWrapText, this.theme), bgColorFunc && (cacheStyle = mergeStyle(cacheStyle, {
1251
+ bgColor: bgColorFunc
1252
+ })), isFunction(style) || (layoutMap.isBottomFrozenRow(row) ? this.bodyBottomStyleCache.set(cacheKey, cacheStyle) : this.bodyStyleCache.set(cacheKey, cacheStyle)),
1246
1253
  customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
1247
1254
  }
1248
1255
  clearCellStyleCache() {
@@ -1414,7 +1421,7 @@ export class BaseTable extends EventTarget {
1414
1421
  if (range) {
1415
1422
  const copyCellValue = getCopyCellValue(c, r, range);
1416
1423
  if ("undefined" != typeof Promise && copyCellValue instanceof Promise) ; else {
1417
- const strCellValue = `${copyCellValue}`;
1424
+ const strCellValue = isValid(copyCellValue) ? `${copyCellValue}` : "";
1418
1425
  /^\[object .*\]$/.exec(strCellValue) || (copyValue += strCellValue);
1419
1426
  }
1420
1427
  (c < range.end.col || c < maxCol) && (copyValue += "\t");
@@ -1523,14 +1530,20 @@ export class BaseTable extends EventTarget {
1523
1530
  return this.scenegraph.stage.toCanvas().toDataURL();
1524
1531
  }
1525
1532
  exportCellImg(col, row) {
1533
+ var _a, _b, _c, _d;
1526
1534
  const isInView = this.cellIsInVisualView(col, row), {scrollTop: scrollTop, scrollLeft: scrollLeft} = this;
1527
1535
  isInView || this.scrollToCell({
1528
1536
  col: col,
1529
1537
  row: row
1530
1538
  });
1531
- const cellRect = this.getCellRelativeRect(col, row), c = this.scenegraph.stage.toCanvas(!1, (new AABBBounds).set(cellRect.left + this.tableX + 1, cellRect.top + this.tableY + 1, cellRect.right + this.tableX, cellRect.bottom + this.tableY));
1539
+ const cellRect = this.getCellRelativeRect(col, row);
1540
+ (null === (_b = null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.ranges) || void 0 === _b ? void 0 : _b.length) > 0 && hideCellSelectBorder(this.scenegraph);
1541
+ const {col: hoverCol, row: hoverRow} = this.stateManager.hover.cellPos;
1542
+ this.stateManager.updateHoverPos(-1, -1);
1543
+ const c = this.scenegraph.stage.toCanvas(!1, (new AABBBounds).set(cellRect.left + this.tableX + 1, cellRect.top + this.tableY + 1, cellRect.right + this.tableX, cellRect.bottom + this.tableY));
1532
1544
  return isInView || (this.setScrollTop(scrollTop), this.setScrollLeft(scrollLeft)),
1533
- c.toDataURL();
1545
+ (null === (_d = null === (_c = this.stateManager.select) || void 0 === _c ? void 0 : _c.ranges) || void 0 === _d ? void 0 : _d.length) > 0 && restoreCellSelectBorder(this.scenegraph),
1546
+ this.stateManager.updateHoverPos(hoverCol, hoverRow), c.toDataURL();
1534
1547
  }
1535
1548
  exportCellRangeImg(cellRange) {
1536
1549
  const {scrollTop: scrollTop, scrollLeft: scrollLeft} = this, minCol = Math.min(cellRange.start.col, cellRange.end.col), minRow = Math.min(cellRange.start.row, cellRange.end.row), maxCol = Math.max(cellRange.start.col, cellRange.end.col), maxRow = Math.max(cellRange.start.row, cellRange.end.row), isInView = this.cellIsInVisualView(minCol, minRow), isMaxCellInView = this.cellIsInVisualView(maxCol, maxRow);