@visactor/vtable 0.22.0 → 0.23.0-alpha.0
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.d.ts +1 -0
- package/cjs/core/BaseTable.js +25 -7
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +3 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +4 -1
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/data/DataSource.js +5 -1
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/event/event.d.ts +2 -0
- package/cjs/event/event.js +30 -1
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +78 -39
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +5 -4
- package/cjs/event/listener/table-group.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/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/scenegraph.d.ts +3 -0
- package/cjs/scenegraph/scenegraph.js +3 -0
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/create-select-border.d.ts +1 -1
- package/cjs/scenegraph/select/create-select-border.js +24 -5
- package/cjs/scenegraph/select/create-select-border.js.map +1 -1
- package/cjs/scenegraph/select/delete-select-border.d.ts +1 -0
- package/cjs/scenegraph/select/delete-select-border.js +15 -4
- package/cjs/scenegraph/select/delete-select-border.js.map +1 -1
- package/cjs/scenegraph/select/move-select-border.js +3 -1
- package/cjs/scenegraph/select/move-select-border.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.d.ts +2 -0
- package/cjs/scenegraph/select/update-select-border.js +28 -4
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/state/state.d.ts +10 -0
- package/cjs/state/state.js +17 -0
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +4 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +8 -0
- package/cjs/ts-types/events.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/ts-types/theme.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +396 -129
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +1 -0
- package/es/core/BaseTable.js +25 -8
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +3 -0
- package/es/core/TABLE_EVENT_TYPE.js +4 -1
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/data/DataSource.js +5 -1
- package/es/data/DataSource.js.map +1 -1
- package/es/event/event.d.ts +2 -0
- package/es/event/event.js +30 -1
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +78 -39
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js +5 -4
- package/es/event/listener/table-group.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/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/scenegraph.d.ts +3 -0
- package/es/scenegraph/scenegraph.js +4 -1
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/create-select-border.d.ts +1 -1
- package/es/scenegraph/select/create-select-border.js +24 -5
- package/es/scenegraph/select/create-select-border.js.map +1 -1
- package/es/scenegraph/select/delete-select-border.d.ts +1 -0
- package/es/scenegraph/select/delete-select-border.js +12 -2
- package/es/scenegraph/select/delete-select-border.js.map +1 -1
- package/es/scenegraph/select/move-select-border.js +3 -1
- package/es/scenegraph/select/move-select-border.js.map +1 -1
- package/es/scenegraph/select/update-select-border.d.ts +2 -0
- package/es/scenegraph/select/update-select-border.js +25 -2
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/state/state.d.ts +10 -0
- package/es/state/state.js +17 -0
- package/es/state/state.js.map +1 -1
- package/es/ts-types/base-table.d.ts +4 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +8 -0
- package/es/ts-types/events.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/ts-types/theme.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/es/core/BaseTable.js
CHANGED
|
@@ -38,7 +38,7 @@ import { HeaderHelper } from "../header-helper/header-helper";
|
|
|
38
38
|
|
|
39
39
|
import { TooltipHandler } from "../components/tooltip/TooltipHandler";
|
|
40
40
|
|
|
41
|
-
import { AABBBounds, isNumber, isBoolean, isFunction, isValid } from "@visactor/vutils";
|
|
41
|
+
import { AABBBounds, isNumber, isBoolean, isFunction, isValid, cloneDeep } from "@visactor/vutils";
|
|
42
42
|
|
|
43
43
|
import { textMeasure } from "../scenegraph/utils/text-measure";
|
|
44
44
|
|
|
@@ -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.
|
|
85
|
+
if (super(), this.showFrozenIcon = !0, this.version = "0.23.0-alpha.0", 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");
|
|
@@ -1473,6 +1480,10 @@ export class BaseTable extends EventTarget {
|
|
|
1473
1480
|
}
|
|
1474
1481
|
return cellInfoArray;
|
|
1475
1482
|
}
|
|
1483
|
+
getSelectedCellRanges() {
|
|
1484
|
+
const ranges = this.stateManager.select.ranges;
|
|
1485
|
+
return ranges.length ? cloneDeep(ranges) : [];
|
|
1486
|
+
}
|
|
1476
1487
|
measureText(text, font) {
|
|
1477
1488
|
return textMeasure.measureText(text, font);
|
|
1478
1489
|
}
|
|
@@ -1523,14 +1534,20 @@ export class BaseTable extends EventTarget {
|
|
|
1523
1534
|
return this.scenegraph.stage.toCanvas().toDataURL();
|
|
1524
1535
|
}
|
|
1525
1536
|
exportCellImg(col, row) {
|
|
1537
|
+
var _a, _b, _c, _d;
|
|
1526
1538
|
const isInView = this.cellIsInVisualView(col, row), {scrollTop: scrollTop, scrollLeft: scrollLeft} = this;
|
|
1527
1539
|
isInView || this.scrollToCell({
|
|
1528
1540
|
col: col,
|
|
1529
1541
|
row: row
|
|
1530
1542
|
});
|
|
1531
|
-
const cellRect = this.getCellRelativeRect(col, row)
|
|
1543
|
+
const cellRect = this.getCellRelativeRect(col, row);
|
|
1544
|
+
(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);
|
|
1545
|
+
const {col: hoverCol, row: hoverRow} = this.stateManager.hover.cellPos;
|
|
1546
|
+
this.stateManager.updateHoverPos(-1, -1);
|
|
1547
|
+
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
1548
|
return isInView || (this.setScrollTop(scrollTop), this.setScrollLeft(scrollLeft)),
|
|
1533
|
-
|
|
1549
|
+
(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),
|
|
1550
|
+
this.stateManager.updateHoverPos(hoverCol, hoverRow), c.toDataURL();
|
|
1534
1551
|
}
|
|
1535
1552
|
exportCellRangeImg(cellRange) {
|
|
1536
1553
|
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);
|