@visactor/vtable 0.25.7 → 0.25.8
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 +2 -1
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable.js +6 -3
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +4 -1
- package/cjs/core/BaseTable.js +46 -21
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/FouseInput.js +2 -1
- package/cjs/core/row-series-number-helper.js +1 -2
- package/cjs/event/drill.js +2 -1
- package/cjs/event/media-click.js +1 -2
- package/cjs/header-helper/header-helper.js +1 -1
- package/cjs/header-helper/header-helper.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.d.ts +5 -1
- package/cjs/layout/pivot-header-layout.js +82 -57
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/tree-helper.js +1 -0
- package/cjs/plugins/themes.js +1 -2
- package/cjs/scenegraph/component/table-component.js +26 -22
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +24 -18
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +18 -16
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/themes/component.js +1 -1
- package/cjs/themes/theme.js +3 -0
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/tools/helper.js +2 -2
- package/cjs/tools/helper.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +7 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +1 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +1 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +208 -67
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +2 -1
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.js +6 -3
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +4 -1
- package/es/core/BaseTable.js +47 -21
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/FouseInput.js +2 -1
- package/es/core/row-series-number-helper.js +1 -2
- package/es/event/drill.js +2 -1
- package/es/event/media-click.js +1 -2
- package/es/header-helper/header-helper.js +1 -1
- package/es/header-helper/header-helper.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.d.ts +5 -1
- package/es/layout/pivot-header-layout.js +83 -56
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/tree-helper.js +2 -1
- package/es/plugins/themes.js +1 -2
- package/es/scenegraph/component/table-component.js +27 -21
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.js +21 -17
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js +18 -15
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/themes/component.js +1 -1
- package/es/themes/theme.js +3 -0
- package/es/themes/theme.js.map +1 -1
- package/es/tools/helper.js +2 -2
- package/es/tools/helper.js.map +1 -1
- package/es/ts-types/base-table.d.ts +7 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +1 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/ts-types/theme.d.ts +1 -0
- package/es/ts-types/theme.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
package/es/core/BaseTable.js
CHANGED
|
@@ -82,7 +82,7 @@ export class BaseTable extends EventTarget {
|
|
|
82
82
|
}
|
|
83
83
|
constructor(container, options = {}) {
|
|
84
84
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
85
|
-
if (super(), this.showFrozenIcon = !0, this.version = "0.25.
|
|
85
|
+
if (super(), this.showFrozenIcon = !0, this.version = "0.25.8", this.id = `VTable${Date.now()}`,
|
|
86
86
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
87
87
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
88
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, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", 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, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
@@ -350,29 +350,36 @@ export class BaseTable extends EventTarget {
|
|
|
350
350
|
this.internalProps.pixelRatio = pixelRatio, this.scenegraph.setPixelRatio(pixelRatio);
|
|
351
351
|
}
|
|
352
352
|
_updateSize() {
|
|
353
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0
|
|
353
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
354
354
|
const {padding: padding} = this;
|
|
355
355
|
let widthP = 0, heightP = 0;
|
|
356
356
|
if ("browser" === Env.mode) {
|
|
357
|
-
const element = this.getElement()
|
|
357
|
+
const element = this.getElement();
|
|
358
|
+
let widthWithoutPadding = 0, heightWithoutPadding = 0;
|
|
359
|
+
if (element.parentElement) {
|
|
360
|
+
const computedStyle = element.parentElement.style || window.getComputedStyle(element.parentElement);
|
|
361
|
+
widthWithoutPadding = element.parentElement.offsetWidth - parseInt(computedStyle.paddingLeft || "0px", 10) - parseInt(computedStyle.paddingRight || "0px", 10),
|
|
362
|
+
heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20);
|
|
363
|
+
}
|
|
364
|
+
const width1 = null != widthWithoutPadding ? widthWithoutPadding : 0, height1 = null != heightWithoutPadding ? heightWithoutPadding : 0;
|
|
358
365
|
element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px",
|
|
359
366
|
element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
|
|
360
367
|
const {canvas: canvas} = this.internalProps;
|
|
361
|
-
widthP = null !== (
|
|
362
|
-
heightP = null !== (
|
|
363
|
-
(null === (
|
|
368
|
+
widthP = null !== (_b = null === (_a = canvas.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 0,
|
|
369
|
+
heightP = null !== (_d = null === (_c = canvas.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0,
|
|
370
|
+
(null === (_e = null == this ? void 0 : this.scenegraph) || void 0 === _e ? void 0 : _e.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
364
371
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
365
372
|
canvas.style.height = `${heightP}px`);
|
|
366
373
|
} else "node" === Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
367
374
|
const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
|
|
368
|
-
if (null === (
|
|
369
|
-
const lineWidths = toBoxArray(null !== (
|
|
370
|
-
(null === (
|
|
371
|
-
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (
|
|
372
|
-
this.tableNoFrameHeight = height - (null !== (
|
|
373
|
-
this.tableY = (null !== (
|
|
374
|
-
this.tableNoFrameWidth = width - ((null !== (
|
|
375
|
-
this.tableNoFrameHeight = height - ((null !== (
|
|
375
|
+
if (null === (_f = this.internalProps.theme) || void 0 === _f ? void 0 : _f.frameStyle) {
|
|
376
|
+
const lineWidths = toBoxArray(null !== (_h = null === (_g = this.internalProps.theme.frameStyle) || void 0 === _g ? void 0 : _g.borderLineWidth) && void 0 !== _h ? _h : [ null ]), shadowWidths = toBoxArray(null !== (_k = null === (_j = this.internalProps.theme.frameStyle) || void 0 === _j ? void 0 : _j.shadowBlur) && void 0 !== _k ? _k : [ 0 ]);
|
|
377
|
+
(null === (_l = this.theme.frameStyle) || void 0 === _l ? void 0 : _l.innerBorder) ? (this.tableX = 0,
|
|
378
|
+
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_m = shadowWidths[1]) && void 0 !== _m ? _m : 0),
|
|
379
|
+
this.tableNoFrameHeight = height - (null !== (_o = shadowWidths[2]) && void 0 !== _o ? _o : 0)) : (this.tableX = (null !== (_p = lineWidths[3]) && void 0 !== _p ? _p : 0) + (null !== (_q = shadowWidths[3]) && void 0 !== _q ? _q : 0),
|
|
380
|
+
this.tableY = (null !== (_r = lineWidths[0]) && void 0 !== _r ? _r : 0) + (null !== (_s = shadowWidths[0]) && void 0 !== _s ? _s : 0),
|
|
381
|
+
this.tableNoFrameWidth = width - ((null !== (_t = lineWidths[1]) && void 0 !== _t ? _t : 0) + (null !== (_u = shadowWidths[1]) && void 0 !== _u ? _u : 0)) - ((null !== (_v = lineWidths[3]) && void 0 !== _v ? _v : 0) + (null !== (_w = shadowWidths[3]) && void 0 !== _w ? _w : 0)),
|
|
382
|
+
this.tableNoFrameHeight = height - ((null !== (_x = lineWidths[0]) && void 0 !== _x ? _x : 0) + (null !== (_y = shadowWidths[0]) && void 0 !== _y ? _y : 0)) - ((null !== (_z = lineWidths[2]) && void 0 !== _z ? _z : 0) + (null !== (_0 = shadowWidths[2]) && void 0 !== _0 ? _0 : 0)));
|
|
376
383
|
}
|
|
377
384
|
}
|
|
378
385
|
get rowHierarchyType() {
|
|
@@ -1662,7 +1669,7 @@ export class BaseTable extends EventTarget {
|
|
|
1662
1669
|
exportImg() {
|
|
1663
1670
|
return this.scenegraph.stage.toCanvas().toDataURL();
|
|
1664
1671
|
}
|
|
1665
|
-
exportCellImg(col, row) {
|
|
1672
|
+
exportCellImg(col, row, options) {
|
|
1666
1673
|
var _a, _b, _c, _d;
|
|
1667
1674
|
const isInView = this.cellIsInVisualView(col, row), {scrollTop: scrollTop, scrollLeft: scrollLeft} = this;
|
|
1668
1675
|
isInView || this.scrollToCell({
|
|
@@ -1672,12 +1679,31 @@ export class BaseTable extends EventTarget {
|
|
|
1672
1679
|
const cellRect = this.getCellRelativeRect(col, row);
|
|
1673
1680
|
(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);
|
|
1674
1681
|
const {col: hoverCol, row: hoverRow} = this.stateManager.hover.cellPos;
|
|
1675
|
-
|
|
1676
|
-
this.
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1682
|
+
let oldFill, oldStroke;
|
|
1683
|
+
if (this.stateManager.updateHoverPos(-1, -1), this.scenegraph.component.hideVerticalScrollBar(),
|
|
1684
|
+
this.scenegraph.component.hideHorizontalScrollBar(), this.scenegraph.tableGroup.border.setAttribute("visible", !1),
|
|
1685
|
+
null == options ? void 0 : options.disableBackground) {
|
|
1686
|
+
const cellGroup = this.scenegraph.getCell(col, row);
|
|
1687
|
+
oldFill = cellGroup.attribute.fill, cellGroup.setAttribute("fill", "transparent");
|
|
1688
|
+
}
|
|
1689
|
+
if (null == options ? void 0 : options.disableBorder) {
|
|
1690
|
+
const cellGroup = this.scenegraph.getCell(col, row);
|
|
1691
|
+
oldStroke = cellGroup.attribute.stroke, cellGroup.setAttribute("stroke", !1);
|
|
1692
|
+
}
|
|
1693
|
+
this.scenegraph.renderSceneGraph();
|
|
1694
|
+
let sizeOffset = 0;
|
|
1695
|
+
"bottom-right" === this.theme.cellBorderClipDirection && (sizeOffset = 1);
|
|
1696
|
+
const c = this.scenegraph.stage.toCanvas(!1, (new AABBBounds).set(cellRect.left + this.tableX + 1, cellRect.top + this.tableY + 1, cellRect.right + this.tableX - sizeOffset, cellRect.bottom + this.tableY - sizeOffset));
|
|
1697
|
+
if (isInView || (this.setScrollTop(scrollTop), this.setScrollLeft(scrollLeft)),
|
|
1698
|
+
this.scenegraph.tableGroup.border.setAttribute("visible", !0), oldFill) {
|
|
1699
|
+
this.scenegraph.getCell(col, row).setAttribute("fill", oldFill);
|
|
1700
|
+
}
|
|
1701
|
+
if (oldStroke) {
|
|
1702
|
+
this.scenegraph.getCell(col, row).setAttribute("stroke", oldStroke);
|
|
1703
|
+
}
|
|
1704
|
+
return (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),
|
|
1705
|
+
this.stateManager.updateHoverPos(hoverCol, hoverRow), this.scenegraph.updateNextFrame(),
|
|
1706
|
+
c.toDataURL();
|
|
1681
1707
|
}
|
|
1682
1708
|
exportCellRangeImg(cellRange) {
|
|
1683
1709
|
var _a, _b, _c, _d;
|