@visactor/vtable 0.19.2-alpha.1 → 0.19.2-alpha.2
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/PivotChart.d.ts +0 -1
- package/cjs/PivotChart.js +0 -4
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +0 -3
- package/cjs/core/BaseTable.js +23 -37
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/event/event.js +1 -2
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -1
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/util.js +2 -2
- package/cjs/event/util.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/scenegraph/debug-tool/debug-tool.js +1 -4
- package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +0 -1
- package/cjs/scenegraph/graphic/chart.js +19 -33
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
- package/cjs/scenegraph/graphic/contributions/chart-render.js +24 -40
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +1 -2
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.d.ts +0 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +2 -9
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +5 -11
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -11
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +370 -488
- package/dist/vtable.min.js +2 -2
- package/es/PivotChart.d.ts +0 -1
- package/es/PivotChart.js +2 -5
- package/es/PivotChart.js.map +1 -1
- package/es/core/BaseTable.d.ts +0 -3
- package/es/core/BaseTable.js +22 -36
- package/es/core/BaseTable.js.map +1 -1
- package/es/event/event.js +1 -2
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -1
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/util.js +2 -2
- package/es/event/util.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/scenegraph/debug-tool/debug-tool.js +1 -4
- package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +0 -1
- package/es/scenegraph/graphic/chart.js +20 -32
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
- package/es/scenegraph/graphic/contributions/chart-render.js +25 -41
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +1 -2
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.d.ts +0 -1
- package/es/scenegraph/refresh-node/update-chart.js +0 -6
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.js +5 -11
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -11
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/es/core/BaseTable.js
CHANGED
|
@@ -76,9 +76,9 @@ export class BaseTable extends EventTarget {
|
|
|
76
76
|
}
|
|
77
77
|
constructor(container, options = {}) {
|
|
78
78
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
79
|
-
if (super(), this.showFrozenIcon = !0, this.version = "0.19.2-alpha.
|
|
79
|
+
if (super(), this.showFrozenIcon = !0, this.version = "0.19.2-alpha.2", this.id = `VTable${Date.now()}`,
|
|
80
80
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
81
|
-
!container && "node" !== options.mode
|
|
81
|
+
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
82
82
|
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;
|
|
83
83
|
this.container = container, this.options = options, this.options.container = container,
|
|
84
84
|
this._widthMode = widthMode, this._heightMode = heightMode, this._autoFillWidth = autoFillWidth,
|
|
@@ -94,9 +94,7 @@ export class BaseTable extends EventTarget {
|
|
|
94
94
|
this.tableNoFrameHeight = 0, this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight;
|
|
95
95
|
const internalProps = this.internalProps = {};
|
|
96
96
|
void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
97
|
-
|
|
98
|
-
internalProps.element.style.position = "relative", internalProps.focusControl = new FocusInput(this, internalProps.element),
|
|
99
|
-
internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
|
|
97
|
+
"node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
|
|
100
98
|
internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"),
|
|
101
99
|
internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d")),
|
|
102
100
|
internalProps.handler = new EventHandler, isNumber(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
|
|
@@ -327,37 +325,28 @@ export class BaseTable extends EventTarget {
|
|
|
327
325
|
this.internalProps.pixelRatio = pixelRatio, this.scenegraph.setPixelRatio(pixelRatio);
|
|
328
326
|
}
|
|
329
327
|
_updateSize() {
|
|
330
|
-
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, _1
|
|
328
|
+
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, _1;
|
|
331
329
|
const {padding: padding} = this;
|
|
332
330
|
let widthP = 0, heightP = 0;
|
|
333
|
-
if (
|
|
334
|
-
|
|
335
|
-
const element = this.getElement(), width1 = null !== (_c = null === (_b = element.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 0, height1 = null !== (_e = null === (_d = element.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 0;
|
|
331
|
+
if ("browser" === Env.mode) {
|
|
332
|
+
const element = this.getElement(), width1 = null !== (_b = null === (_a = element.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 0, height1 = null !== (_d = null === (_c = element.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0;
|
|
336
333
|
element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px",
|
|
337
334
|
element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
|
|
338
335
|
const {canvas: canvas} = this.internalProps;
|
|
339
|
-
widthP = null !== (
|
|
340
|
-
heightP = null !== (
|
|
341
|
-
(null === (
|
|
336
|
+
widthP = null !== (_f = null === (_e = canvas.parentElement) || void 0 === _e ? void 0 : _e.offsetWidth) && void 0 !== _f ? _f : 0,
|
|
337
|
+
heightP = null !== (_h = null === (_g = canvas.parentElement) || void 0 === _g ? void 0 : _g.offsetHeight) && void 0 !== _h ? _h : 0,
|
|
338
|
+
(null === (_j = null == this ? void 0 : this.scenegraph) || void 0 === _j ? void 0 : _j.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
342
339
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
343
340
|
canvas.style.height = `${heightP}px`);
|
|
344
341
|
} else "node" === Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
345
342
|
const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
|
|
346
|
-
if (null === (
|
|
347
|
-
const lineWidths = toBoxArray(null !== (
|
|
348
|
-
this.tableX
|
|
349
|
-
this.tableY
|
|
350
|
-
this.tableNoFrameWidth = width - ((null !== (
|
|
351
|
-
this.tableNoFrameHeight = height - ((null !== (
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
updateViewBox(newViewBox) {
|
|
355
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
356
|
-
const oldWidth = null !== (_d = null !== (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.viewBox.x2) && void 0 !== _b ? _b : 0 - (null === (_c = this.options) || void 0 === _c ? void 0 : _c.viewBox.x1)) && void 0 !== _d ? _d : 0, oldHeight = null !== (_h = null !== (_f = null === (_e = this.options) || void 0 === _e ? void 0 : _e.viewBox.y2) && void 0 !== _f ? _f : 0 - (null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox.y1)) && void 0 !== _h ? _h : 0, newWidth = newViewBox.x2 - newViewBox.x1, newHeight = newViewBox.y2 - newViewBox.y1;
|
|
357
|
-
this.options.viewBox = newViewBox, oldWidth !== newWidth || oldHeight !== newHeight ? this.resize() : this.scenegraph.stage.setViewBox(this.options.viewBox, !0);
|
|
358
|
-
}
|
|
359
|
-
setViewBoxTransform(a, b, c, d, e, f) {
|
|
360
|
-
this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
|
|
343
|
+
if (null === (_k = this.internalProps.theme) || void 0 === _k ? void 0 : _k.frameStyle) {
|
|
344
|
+
const lineWidths = toBoxArray(null !== (_m = null === (_l = this.internalProps.theme.frameStyle) || void 0 === _l ? void 0 : _l.borderLineWidth) && void 0 !== _m ? _m : [ null ]), shadowWidths = toBoxArray(null !== (_p = null === (_o = this.internalProps.theme.frameStyle) || void 0 === _o ? void 0 : _o.shadowBlur) && void 0 !== _p ? _p : [ 0 ]);
|
|
345
|
+
this.tableX = (null !== (_q = lineWidths[3]) && void 0 !== _q ? _q : 0) + (null !== (_r = shadowWidths[3]) && void 0 !== _r ? _r : 0),
|
|
346
|
+
this.tableY = (null !== (_s = lineWidths[0]) && void 0 !== _s ? _s : 0) + (null !== (_t = shadowWidths[0]) && void 0 !== _t ? _t : 0),
|
|
347
|
+
this.tableNoFrameWidth = width - ((null !== (_u = lineWidths[1]) && void 0 !== _u ? _u : 0) + (null !== (_v = shadowWidths[1]) && void 0 !== _v ? _v : 0)) - ((null !== (_w = lineWidths[3]) && void 0 !== _w ? _w : 0) + (null !== (_x = shadowWidths[3]) && void 0 !== _x ? _x : 0)),
|
|
348
|
+
this.tableNoFrameHeight = height - ((null !== (_y = lineWidths[0]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[0]) && void 0 !== _z ? _z : 0)) - ((null !== (_0 = lineWidths[2]) && void 0 !== _0 ? _0 : 0) + (null !== (_1 = shadowWidths[2]) && void 0 !== _1 ? _1 : 0));
|
|
349
|
+
}
|
|
361
350
|
}
|
|
362
351
|
get rowHierarchyType() {
|
|
363
352
|
return "grid";
|
|
@@ -616,11 +605,8 @@ export class BaseTable extends EventTarget {
|
|
|
616
605
|
}));
|
|
617
606
|
}
|
|
618
607
|
_toRelativeRect(absoluteRect, relativeX = !0, relativeY = !0) {
|
|
619
|
-
var _a, _b, _c, _d;
|
|
620
608
|
const rect = absoluteRect.copy(), visibleRect = this.getVisibleRect();
|
|
621
609
|
return rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0)), rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0)),
|
|
622
|
-
rect.offsetLeft(null !== (_b = null === (_a = this.options.viewBox) || void 0 === _a ? void 0 : _a.x1) && void 0 !== _b ? _b : 0),
|
|
623
|
-
rect.offsetTop(null !== (_d = null === (_c = this.options.viewBox) || void 0 === _c ? void 0 : _c.y1) && void 0 !== _d ? _d : 0),
|
|
624
610
|
rect;
|
|
625
611
|
}
|
|
626
612
|
getVisibleRect() {
|
|
@@ -724,8 +710,7 @@ export class BaseTable extends EventTarget {
|
|
|
724
710
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
725
711
|
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
726
712
|
const {parentElement: parentElement} = internalProps.element;
|
|
727
|
-
parentElement &&
|
|
728
|
-
this.isReleased = !0;
|
|
713
|
+
parentElement && parentElement.removeChild(internalProps.element), this.isReleased = !0;
|
|
729
714
|
}
|
|
730
715
|
fireListeners(type, event) {
|
|
731
716
|
return super.fireListeners(type, event);
|
|
@@ -810,7 +795,6 @@ export class BaseTable extends EventTarget {
|
|
|
810
795
|
return new Rect(this.tableX, this.tableY, width, height);
|
|
811
796
|
}
|
|
812
797
|
_getMouseAbstractPoint(evt, isAddScroll = !0) {
|
|
813
|
-
var _a, _b, _c, _d;
|
|
814
798
|
let e;
|
|
815
799
|
if (!evt) return {
|
|
816
800
|
inTable: !1,
|
|
@@ -823,8 +807,8 @@ export class BaseTable extends EventTarget {
|
|
|
823
807
|
rect.right <= clientX && (inTable = !1), rect.bottom <= clientY && (inTable = !1);
|
|
824
808
|
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight);
|
|
825
809
|
return {
|
|
826
|
-
x: (clientX - rect.left) / widthRatio + (isAddScroll ? this.scrollLeft : 0)
|
|
827
|
-
y: (clientY - rect.top) / heightRatio + (isAddScroll ? this.scrollTop : 0)
|
|
810
|
+
x: (clientX - rect.left) / widthRatio + (isAddScroll ? this.scrollLeft : 0),
|
|
811
|
+
y: (clientY - rect.top) / heightRatio + (isAddScroll ? this.scrollTop : 0),
|
|
828
812
|
inTable: inTable
|
|
829
813
|
};
|
|
830
814
|
}
|
|
@@ -1217,8 +1201,10 @@ export class BaseTable extends EventTarget {
|
|
|
1217
1201
|
dataValue: this.getCellOriginValue(col, row),
|
|
1218
1202
|
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1219
1203
|
}, styleClass, this.options.autoWrapText); else {
|
|
1204
|
+
let defaultStyle;
|
|
1205
|
+
defaultStyle = layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row) || this.internalProps.transpose && layoutMap.isRowHeader(col, row) ? this.theme.headerStyle : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row) ? this.theme.rowHeaderStyle : this.theme.cornerHeaderStyle;
|
|
1220
1206
|
const style = (null == hd ? void 0 : hd.style) || {};
|
|
1221
|
-
paddingForAxis && (style.padding = paddingForAxis), cacheStyle = headerStyleContents.of(style,
|
|
1207
|
+
paddingForAxis && (style.padding = paddingForAxis), cacheStyle = headerStyleContents.of(style, defaultStyle, {
|
|
1222
1208
|
col: col,
|
|
1223
1209
|
row: row,
|
|
1224
1210
|
table: this,
|