@visactor/vtable 0.21.3-alpha.1 → 0.21.3
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/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/cell-type/image-cell.js +3 -2
- package/cjs/scenegraph/group-creater/cell-type/image-cell.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 +4 -5
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/icon/icon-update.js +3 -2
- package/cjs/scenegraph/icon/icon-update.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/state/hover/update-cell.js +3 -2
- package/cjs/state/hover/update-cell.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/themes/theme.js +1 -1
- package/cjs/tools/merge-range.js +6 -0
- package/cjs/tools/merge-range.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 +75 -55
- 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/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/cell-type/image-cell.js +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.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 +4 -5
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/icon/icon-update.js +1 -1
- package/es/scenegraph/icon/icon-update.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/state/hover/update-cell.js +1 -1
- package/es/state/hover/update-cell.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/themes/theme.js +1 -1
- package/es/tools/merge-range.js +6 -0
- package/es/tools/merge-range.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 +6 -6
package/es/core/BaseTable.js
CHANGED
|
@@ -66,6 +66,8 @@ import { NumberRangeMap } from "../layout/row-height-map";
|
|
|
66
66
|
|
|
67
67
|
import { CustomCellStylePlugin, mergeStyle } from "../plugins/custom-cell-style";
|
|
68
68
|
|
|
69
|
+
import { hideCellSelectBorder, restoreCellSelectBorder } from "../scenegraph/select/update-select-border";
|
|
70
|
+
|
|
69
71
|
const {toBoxArray: toBoxArray} = utilStyle, {isTouchEvent: isTouchEvent} = event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
70
72
|
|
|
71
73
|
importStyle();
|
|
@@ -78,7 +80,7 @@ export class BaseTable extends EventTarget {
|
|
|
78
80
|
}
|
|
79
81
|
constructor(container, options = {}) {
|
|
80
82
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
81
|
-
if (super(), this.showFrozenIcon = !0, this.version = "0.21.3
|
|
83
|
+
if (super(), this.showFrozenIcon = !0, this.version = "0.21.3", this.id = `VTable${Date.now()}`,
|
|
82
84
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
83
85
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
84
86
|
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, 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;
|
|
@@ -1170,7 +1172,7 @@ export class BaseTable extends EventTarget {
|
|
|
1170
1172
|
return null === (_a = this.internalProps.dataSource) || void 0 === _a ? void 0 : _a.hasField(index, field);
|
|
1171
1173
|
}
|
|
1172
1174
|
_getCellStyle(col, row) {
|
|
1173
|
-
var _a, _b, _c, _d;
|
|
1175
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1174
1176
|
const customCellStyle = this.customCellStylePlugin.getCustomCellStyle(col, row), {layoutMap: layoutMap} = this.internalProps;
|
|
1175
1177
|
if (layoutMap.isHeader(col, row)) {
|
|
1176
1178
|
let cacheKey;
|
|
@@ -1220,7 +1222,10 @@ export class BaseTable extends EventTarget {
|
|
|
1220
1222
|
}
|
|
1221
1223
|
return this.headerStyleCache.set(cacheKey, cacheStyle), customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
|
|
1222
1224
|
}
|
|
1223
|
-
let cacheKey;
|
|
1225
|
+
let bgColorFunc, cacheKey;
|
|
1226
|
+
(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) => {
|
|
1227
|
+
mappingRule.bgColor && this.internalProps.layoutMap.getIndicatorKey(col, row) === mappingRule.bgColor.indicatorKey && (bgColorFunc = mappingRule.bgColor.mapping);
|
|
1228
|
+
})));
|
|
1224
1229
|
const cellType = this.getCellType(col, row);
|
|
1225
1230
|
let cacheStyle;
|
|
1226
1231
|
if (cacheKey = this.isListTable() && !this.transpose || this.isPivotTable() && this.internalProps.layoutMap.indicatorsAsCol ? col + cellType : row + cellType,
|
|
@@ -1234,7 +1239,9 @@ export class BaseTable extends EventTarget {
|
|
|
1234
1239
|
value: this.getCellValue(col, row),
|
|
1235
1240
|
dataValue: this.getCellOriginValue(col, row),
|
|
1236
1241
|
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1237
|
-
}, styleClass, this.options.autoWrapText, this.theme),
|
|
1242
|
+
}, styleClass, this.options.autoWrapText, this.theme), bgColorFunc && (cacheStyle = mergeStyle(cacheStyle, {
|
|
1243
|
+
bgColor: bgColorFunc
|
|
1244
|
+
})), isFunction(style) || (layoutMap.isBottomFrozenRow(row) ? this.bodyBottomStyleCache.set(cacheKey, cacheStyle) : this.bodyStyleCache.set(cacheKey, cacheStyle)),
|
|
1238
1245
|
customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
|
|
1239
1246
|
}
|
|
1240
1247
|
clearCellStyleCache() {
|
|
@@ -1401,7 +1408,7 @@ export class BaseTable extends EventTarget {
|
|
|
1401
1408
|
if (range) {
|
|
1402
1409
|
const copyCellValue = getCopyCellValue(c, r, range);
|
|
1403
1410
|
if ("undefined" != typeof Promise && copyCellValue instanceof Promise) ; else {
|
|
1404
|
-
const strCellValue = `${copyCellValue}
|
|
1411
|
+
const strCellValue = isValid(copyCellValue) ? `${copyCellValue}` : "";
|
|
1405
1412
|
/^\[object .*\]$/.exec(strCellValue) || (copyValue += strCellValue);
|
|
1406
1413
|
}
|
|
1407
1414
|
(c < range.end.col || c < maxCol) && (copyValue += "\t");
|
|
@@ -1510,14 +1517,20 @@ export class BaseTable extends EventTarget {
|
|
|
1510
1517
|
return this.scenegraph.stage.toCanvas().toDataURL();
|
|
1511
1518
|
}
|
|
1512
1519
|
exportCellImg(col, row) {
|
|
1520
|
+
var _a, _b, _c, _d;
|
|
1513
1521
|
const isInView = this.cellIsInVisualView(col, row), {scrollTop: scrollTop, scrollLeft: scrollLeft} = this;
|
|
1514
1522
|
isInView || this.scrollToCell({
|
|
1515
1523
|
col: col,
|
|
1516
1524
|
row: row
|
|
1517
1525
|
});
|
|
1518
|
-
const cellRect = this.getCellRelativeRect(col, row)
|
|
1526
|
+
const cellRect = this.getCellRelativeRect(col, row);
|
|
1527
|
+
(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);
|
|
1528
|
+
const {col: hoverCol, row: hoverRow} = this.stateManager.hover.cellPos;
|
|
1529
|
+
this.stateManager.updateHoverPos(-1, -1);
|
|
1530
|
+
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));
|
|
1519
1531
|
return isInView || (this.setScrollTop(scrollTop), this.setScrollLeft(scrollLeft)),
|
|
1520
|
-
|
|
1532
|
+
(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),
|
|
1533
|
+
this.stateManager.updateHoverPos(hoverCol, hoverRow), c.toDataURL();
|
|
1521
1534
|
}
|
|
1522
1535
|
exportCellRangeImg(cellRange) {
|
|
1523
1536
|
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);
|