@visactor/vtable 1.5.2 → 1.5.3-alpha.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.d.ts +1 -0
- package/cjs/ListTable.js +23 -191
- package/cjs/ListTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +5 -3
- package/cjs/core/BaseTable.js +8 -79
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/group-helper.d.ts +6 -0
- package/cjs/core/group-helper.js +22 -0
- package/cjs/core/group-helper.js.map +1 -0
- package/cjs/core/record-helper.d.ts +6 -0
- package/cjs/core/record-helper.js +230 -0
- package/cjs/core/record-helper.js.map +1 -0
- package/cjs/core/style-helper.d.ts +3 -0
- package/cjs/core/style-helper.js +110 -0
- package/cjs/core/style-helper.js.map +1 -0
- package/cjs/core/tableHelper.d.ts +0 -2
- package/cjs/core/tableHelper.js +9 -18
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +10 -1
- package/cjs/data/CachedDataSource.js +78 -3
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/dataset/statistics-helper.js +0 -1
- package/cjs/event/event.js +2 -1
- 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/cell-range/simple-cell-range.d.ts +4 -0
- package/cjs/layout/cell-range/simple-cell-range.js +106 -0
- package/cjs/layout/cell-range/simple-cell-range.js.map +1 -0
- package/cjs/layout/layout-helper.js +2 -2
- package/cjs/layout/layout-helper.js.map +1 -1
- package/cjs/layout/row-height-map.js +1 -0
- package/cjs/layout/simple-header-layout.d.ts +1 -2
- package/cjs/layout/simple-header-layout.js +2 -88
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/plugins/icons.js +1 -1
- package/cjs/plugins/themes.js +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +11 -6
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +7 -2
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +1 -1
- package/cjs/scenegraph/utils/get-cell-merge.js +1 -1
- package/cjs/scenegraph/utils/get-cell-merge.js.map +1 -1
- package/cjs/scenegraph/utils/get-hierarchy-offset.js +6 -8
- package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/cjs/themes/theme.d.ts +2 -0
- package/cjs/themes/theme.js +12 -4
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/tools/helper.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +9 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +1 -0
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +8 -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 +3137 -2870
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +1 -0
- package/es/ListTable.js +27 -189
- package/es/ListTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +5 -3
- package/es/core/BaseTable.js +11 -83
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/group-helper.d.ts +6 -0
- package/es/core/group-helper.js +14 -0
- package/es/core/group-helper.js.map +1 -0
- package/es/core/record-helper.d.ts +6 -0
- package/es/core/record-helper.js +220 -0
- package/es/core/record-helper.js.map +1 -0
- package/es/core/style-helper.d.ts +3 -0
- package/es/core/style-helper.js +86 -0
- package/es/core/style-helper.js.map +1 -0
- package/es/core/tableHelper.d.ts +0 -2
- package/es/core/tableHelper.js +6 -16
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +10 -1
- package/es/data/CachedDataSource.js +79 -0
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/dataset/statistics-helper.js +1 -2
- package/es/event/event.js +2 -1
- 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/cell-range/simple-cell-range.d.ts +4 -0
- package/es/layout/cell-range/simple-cell-range.js +99 -0
- package/es/layout/cell-range/simple-cell-range.js.map +1 -0
- package/es/layout/layout-helper.js +2 -2
- package/es/layout/layout-helper.js.map +1 -1
- package/es/layout/row-height-map.js +2 -1
- package/es/layout/simple-header-layout.d.ts +1 -2
- package/es/layout/simple-header-layout.js +3 -87
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/plugins/icons.js +1 -1
- package/es/plugins/themes.js +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +11 -6
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +7 -2
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/scenegraph.js +1 -1
- package/es/scenegraph/utils/get-cell-merge.js +1 -1
- package/es/scenegraph/utils/get-cell-merge.js.map +1 -1
- package/es/scenegraph/utils/get-hierarchy-offset.js +7 -9
- package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/es/themes/theme.d.ts +2 -0
- package/es/themes/theme.js +11 -4
- package/es/themes/theme.js.map +1 -1
- package/es/tools/helper.js.map +1 -1
- package/es/ts-types/base-table.d.ts +9 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +1 -0
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +8 -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
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as columnStyleContents from "../body-helper/style";
|
|
2
2
|
|
|
3
|
-
import * as headerStyleContents from "../header-helper/style";
|
|
4
|
-
|
|
5
3
|
import { importStyle } from "./style";
|
|
6
4
|
|
|
7
5
|
import * as style from "../tools/style";
|
|
@@ -36,7 +34,7 @@ import { BodyHelper } from "../body-helper/body-helper";
|
|
|
36
34
|
|
|
37
35
|
import { HeaderHelper } from "../header-helper/header-helper";
|
|
38
36
|
|
|
39
|
-
import { AABBBounds, isNumber, isBoolean,
|
|
37
|
+
import { AABBBounds, isNumber, isBoolean, isValid, cloneDeep } from "@visactor/vutils";
|
|
40
38
|
|
|
41
39
|
import { measureTextBounds, textMeasure } from "../scenegraph/utils/text-measure";
|
|
42
40
|
|
|
@@ -52,13 +50,11 @@ import { defaultPixelRatio } from "../tools/pixel-ratio";
|
|
|
52
50
|
|
|
53
51
|
import { setBatchRenderChartCount } from "../scenegraph/graphic/contributions/chart-render-helper";
|
|
54
52
|
|
|
55
|
-
import { isLeftOrRightAxis, isTopOrBottomAxis } from "../layout/chart-helper/get-axis-config";
|
|
56
|
-
|
|
57
53
|
import { NumberRangeMap } from "../layout/row-height-map";
|
|
58
54
|
|
|
59
55
|
import { RowSeriesNumberHelper } from "./row-series-number-helper";
|
|
60
56
|
|
|
61
|
-
import { CustomCellStylePlugin
|
|
57
|
+
import { CustomCellStylePlugin } from "../plugins/custom-cell-style";
|
|
62
58
|
|
|
63
59
|
import { hideCellSelectBorder, restoreCellSelectBorder } from "../scenegraph/select/update-select-border";
|
|
64
60
|
|
|
@@ -70,19 +66,19 @@ import { Factory } from "./factory";
|
|
|
70
66
|
|
|
71
67
|
import { getCellAt, getCellAtRelativePosition, getColAt, getRowAt, getTargetColAt, getTargetColAtConsiderRightFrozen, getTargetRowAt, getTargetRowAtConsiderBottomFrozen } from "./utils/get-cell-position";
|
|
72
68
|
|
|
69
|
+
import { getCellStyle } from "./style-helper";
|
|
70
|
+
|
|
73
71
|
const {toBoxArray: toBoxArray} = utilStyle, {isTouchEvent: isTouchEvent} = event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
74
72
|
|
|
75
73
|
importStyle();
|
|
76
74
|
|
|
77
|
-
const EMPTY_STYLE = {};
|
|
78
|
-
|
|
79
75
|
export class BaseTable extends EventTarget {
|
|
80
76
|
static get EVENT_TYPE() {
|
|
81
77
|
return TABLE_EVENT_TYPE;
|
|
82
78
|
}
|
|
83
79
|
constructor(container, options = {}) {
|
|
84
80
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
85
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.5.
|
|
81
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.5.3-alpha.1", this.id = `VTable${Date.now()}`,
|
|
86
82
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
87
83
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
88
84
|
const {frozenColCount: frozenColCount = 0, frozenRowCount: frozenRowCount, 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;
|
|
@@ -170,8 +166,8 @@ export class BaseTable extends EventTarget {
|
|
|
170
166
|
const MenuHandler = Factory.getComponent("menuHandler");
|
|
171
167
|
internalProps.menuHandler = new MenuHandler(this);
|
|
172
168
|
}
|
|
173
|
-
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.
|
|
174
|
-
internalProps.stick = {
|
|
169
|
+
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.bodyMergeTitleCache = new Map,
|
|
170
|
+
this.bodyBottomStyleCache = new Map, internalProps.stick = {
|
|
175
171
|
changedCells: new Map
|
|
176
172
|
}, internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_k = options.customCellStyle) && void 0 !== _k ? _k : [], null !== (_l = options.customCellStyleArrangement) && void 0 !== _l ? _l : []);
|
|
177
173
|
}
|
|
@@ -1208,80 +1204,11 @@ export class BaseTable extends EventTarget {
|
|
|
1208
1204
|
return null === (_a = this.internalProps.dataSource) || void 0 === _a ? void 0 : _a.hasField(index, field);
|
|
1209
1205
|
}
|
|
1210
1206
|
_getCellStyle(col, row) {
|
|
1211
|
-
|
|
1212
|
-
const customCellStyle = this.customCellStylePlugin.getCustomCellStyle(col, row), {layoutMap: layoutMap} = this.internalProps;
|
|
1213
|
-
if (layoutMap.isHeader(col, row)) {
|
|
1214
|
-
let cacheKey;
|
|
1215
|
-
if (!this.isPivotTable() || this.isBottomFrozenRow(row) || this.isRightFrozenColumn(col)) cacheKey = `${col}-${row}`; else {
|
|
1216
|
-
const define = this.getHeaderDefine(col, row), isCorner = this.isCornerHeader(col, row);
|
|
1217
|
-
cacheKey = (null == define ? void 0 : define.dimensionKey) ? isCorner ? `dim-cor-${define.dimensionKey}` : `dim-${define.dimensionKey}` : (null == define ? void 0 : define.indicatorKey) ? `ind-${define.indicatorKey}` : `${col}-${row}`;
|
|
1218
|
-
}
|
|
1219
|
-
let cacheStyle = this.headerStyleCache.get(cacheKey);
|
|
1220
|
-
if (cacheStyle) return customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
|
|
1221
|
-
const hd = layoutMap.getHeader(col, row);
|
|
1222
|
-
let paddingForAxis;
|
|
1223
|
-
if (this.isPivotChart() && isTopOrBottomAxis(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
|
|
1224
|
-
paddingForAxis = null !== (_b = null === (_a = layoutMap.getBody(col, this.rowHeaderLevelCount).style) || void 0 === _a ? void 0 : _a.padding) && void 0 !== _b ? _b : this.theme.bodyStyle.padding;
|
|
1225
|
-
} else if (this.isPivotChart() && isLeftOrRightAxis(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
|
|
1226
|
-
paddingForAxis = null !== (_d = null === (_c = layoutMap.getBody(this.columnHeaderLevelCount, row).style) || void 0 === _c ? void 0 : _c.padding) && void 0 !== _d ? _d : this.theme.bodyStyle.padding;
|
|
1227
|
-
}
|
|
1228
|
-
if ((!hd || hd.isEmpty) && (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightBottomCorner(col, row) || layoutMap.isCornerHeader(col, row) || layoutMap.isRightTopCorner(col, row))) return EMPTY_STYLE;
|
|
1229
|
-
const styleClass = this.internalProps.headerHelper.getStyleClass((null == hd ? void 0 : hd.headerType) || "text");
|
|
1230
|
-
if (layoutMap.isBottomFrozenRow(col, row) && this.theme.bottomFrozenStyle) cacheStyle = headerStyleContents.of(paddingForAxis ? {
|
|
1231
|
-
padding: paddingForAxis
|
|
1232
|
-
} : {}, this.theme.bottomFrozenStyle, {
|
|
1233
|
-
col: col,
|
|
1234
|
-
row: row,
|
|
1235
|
-
table: this,
|
|
1236
|
-
value: this.getCellValue(col, row),
|
|
1237
|
-
dataValue: this.getCellOriginValue(col, row),
|
|
1238
|
-
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1239
|
-
}, styleClass, this.options.autoWrapText, this.theme); else if (layoutMap.isRightFrozenColumn(col, row) && this.theme.rightFrozenStyle) cacheStyle = headerStyleContents.of(paddingForAxis ? {
|
|
1240
|
-
padding: paddingForAxis
|
|
1241
|
-
} : {}, this.theme.rightFrozenStyle, {
|
|
1242
|
-
col: col,
|
|
1243
|
-
row: row,
|
|
1244
|
-
table: this,
|
|
1245
|
-
value: this.getCellValue(col, row),
|
|
1246
|
-
dataValue: this.getCellOriginValue(col, row),
|
|
1247
|
-
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1248
|
-
}, styleClass, this.options.autoWrapText, this.theme); else {
|
|
1249
|
-
const style = (null == hd ? void 0 : hd.style) || {};
|
|
1250
|
-
paddingForAxis && (style.padding = paddingForAxis), cacheStyle = headerStyleContents.of(style, layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row) ? this.theme.headerStyle : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row) ? this.theme.rowHeaderStyle : this.theme.cornerHeaderStyle, {
|
|
1251
|
-
col: col,
|
|
1252
|
-
row: row,
|
|
1253
|
-
table: this,
|
|
1254
|
-
value: this.getCellValue(col, row),
|
|
1255
|
-
dataValue: this.getCellOriginValue(col, row),
|
|
1256
|
-
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1257
|
-
}, styleClass, this.options.autoWrapText, this.theme);
|
|
1258
|
-
}
|
|
1259
|
-
return this.headerStyleCache.set(cacheKey, cacheStyle), customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
|
|
1260
|
-
}
|
|
1261
|
-
let bgColorFunc, cacheKey;
|
|
1262
|
-
(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) => {
|
|
1263
|
-
mappingRule.bgColor && this.internalProps.layoutMap.getIndicatorKey(col, row) === mappingRule.bgColor.indicatorKey && (bgColorFunc = mappingRule.bgColor.mapping);
|
|
1264
|
-
})));
|
|
1265
|
-
const cellType = this.getCellType(col, row);
|
|
1266
|
-
let cacheStyle;
|
|
1267
|
-
if (cacheKey = this.isSeriesNumberInBody(col, row) ? `${col}-series-` + cellType : this.isListTable() && !this.transpose || this.isPivotTable() && this.internalProps.layoutMap.indicatorsAsCol ? col + cellType : row + cellType,
|
|
1268
|
-
cacheStyle = layoutMap.isBottomFrozenRow(row) ? this.bodyBottomStyleCache.get(cacheKey) : this.bodyStyleCache.get(cacheKey),
|
|
1269
|
-
cacheStyle) return customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
|
|
1270
|
-
const column = layoutMap.getBody(col, row), styleClass = this.internalProps.bodyHelper.getStyleClass(this.getCellType(col, row)), style = null == column ? void 0 : column.style;
|
|
1271
|
-
return cacheStyle = columnStyleContents.of(style, layoutMap.isBottomFrozenRow(row) && this.theme.bottomFrozenStyle ? this.theme.bottomFrozenStyle : layoutMap.isRightFrozenColumn(col) && this.theme.rightFrozenStyle ? this.theme.rightFrozenStyle : this.theme.bodyStyle, {
|
|
1272
|
-
col: col,
|
|
1273
|
-
row: row,
|
|
1274
|
-
table: this,
|
|
1275
|
-
value: this.getCellValue(col, row),
|
|
1276
|
-
dataValue: this.getCellOriginValue(col, row),
|
|
1277
|
-
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1278
|
-
}, styleClass, this.options.autoWrapText, this.theme), bgColorFunc && (cacheStyle = mergeStyle(cacheStyle, {
|
|
1279
|
-
bgColor: bgColorFunc
|
|
1280
|
-
})), isFunction(style) || (layoutMap.isBottomFrozenRow(row) ? this.bodyBottomStyleCache.set(cacheKey, cacheStyle) : this.bodyStyleCache.set(cacheKey, cacheStyle)),
|
|
1281
|
-
customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
|
|
1207
|
+
return getCellStyle(col, row, this);
|
|
1282
1208
|
}
|
|
1283
1209
|
clearCellStyleCache() {
|
|
1284
|
-
this.headerStyleCache.clear(), this.bodyStyleCache.clear(), this.
|
|
1210
|
+
this.headerStyleCache.clear(), this.bodyStyleCache.clear(), this.bodyMergeTitleCache.clear(),
|
|
1211
|
+
this.bodyBottomStyleCache.clear();
|
|
1285
1212
|
}
|
|
1286
1213
|
clearRowHeightCache() {
|
|
1287
1214
|
this.internalProps._rowHeightsMap.clear(), this._clearRowRangeHeightsMap();
|
|
@@ -1784,5 +1711,6 @@ export class BaseTable extends EventTarget {
|
|
|
1784
1711
|
enableScroll() {
|
|
1785
1712
|
this.eventManager.enableScroll();
|
|
1786
1713
|
}
|
|
1714
|
+
getGroupTitleLevel(col, row) {}
|
|
1787
1715
|
}
|
|
1788
1716
|
//# sourceMappingURL=BaseTable.js.map
|