@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.
- package/cjs/ListTable.js.map +1 -1
- package/cjs/core/BaseTable.js +21 -7
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/data/DataSource.js +5 -1
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +1 -1
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/tree-helper.js +0 -1
- package/cjs/plugins/themes.js +2 -1
- package/cjs/scenegraph/component/custom.js +1 -1
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.d.ts +1 -0
- package/cjs/scenegraph/group-creater/cell-helper.js +16 -26
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +3 -2
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.d.ts +2 -0
- package/cjs/scenegraph/select/update-select-border.js +19 -2
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +2 -1
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +64 -51
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js.map +1 -1
- package/es/core/BaseTable.js +20 -7
- package/es/core/BaseTable.js.map +1 -1
- package/es/data/DataSource.js +5 -1
- package/es/data/DataSource.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.js +1 -1
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/tree-helper.js +1 -2
- package/es/plugins/themes.js +2 -1
- package/es/scenegraph/component/custom.js +1 -1
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.d.ts +1 -0
- package/es/scenegraph/group-creater/cell-helper.js +12 -24
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +5 -4
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/select/update-select-border.d.ts +2 -0
- package/es/scenegraph/select/update-select-border.js +16 -0
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +2 -1
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +2 -2
package/es/core/BaseTable.js
CHANGED
|
@@ -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.
|
|
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),
|
|
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)
|
|
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
|
-
|
|
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);
|