@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/cjs/core/BaseTable.js
CHANGED
|
@@ -33,19 +33,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
33
33
|
value: !0
|
|
34
34
|
}), exports.BaseTable = void 0;
|
|
35
35
|
|
|
36
|
-
const columnStyleContents = __importStar(require("../body-helper/style")),
|
|
36
|
+
const columnStyleContents = __importStar(require("../body-helper/style")), style_1 = require("./style"), style = __importStar(require("../tools/style")), ts_types_1 = require("../ts-types"), helper_1 = require("../tools/helper"), TABLE_EVENT_TYPE_1 = require("./TABLE_EVENT_TYPE"), EventHandler_1 = require("../event/EventHandler"), EventTarget_1 = require("../event/EventTarget"), NumberMap_1 = require("../tools/NumberMap"), Rect_1 = require("../tools/Rect"), util_1 = require("../tools/util"), themes_1 = __importDefault(require("../themes")), env_1 = require("../tools/env"), scenegraph_1 = require("../scenegraph/scenegraph"), state_1 = require("../state/state"), event_1 = require("../event/event"), body_helper_1 = require("../body-helper/body-helper"), header_helper_1 = require("../header-helper/header-helper"), vutils_1 = require("@visactor/vutils"), text_measure_1 = require("../scenegraph/utils/text-measure"), get_prop_1 = require("../scenegraph/utils/get-prop"), icons_1 = require("../plugins/icons"), tableHelper_1 = require("./tableHelper"), FouseInput_1 = require("./FouseInput"), pixel_ratio_1 = require("../tools/pixel-ratio"), chart_render_helper_1 = require("../scenegraph/graphic/contributions/chart-render-helper"), row_height_map_1 = require("../layout/row-height-map"), row_series_number_helper_1 = require("./row-series-number-helper"), custom_cell_style_1 = require("../plugins/custom-cell-style"), update_select_border_1 = require("../scenegraph/select/update-select-border"), react_custom_layout_1 = require("../components/react/react-custom-layout"), layout_helper_1 = require("../layout/layout-helper"), factory_1 = require("./factory"), get_cell_position_1 = require("./utils/get-cell-position"), style_helper_1 = require("./style-helper"), {toBoxArray: toBoxArray} = helper_1.style, {isTouchEvent: isTouchEvent} = helper_1.event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
37
37
|
|
|
38
38
|
(0, style_1.importStyle)();
|
|
39
39
|
|
|
40
|
-
const EMPTY_STYLE = {};
|
|
41
|
-
|
|
42
40
|
class BaseTable extends EventTarget_1.EventTarget {
|
|
43
41
|
static get EVENT_TYPE() {
|
|
44
42
|
return TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE;
|
|
45
43
|
}
|
|
46
44
|
constructor(container, options = {}) {
|
|
47
45
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
48
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.5.
|
|
46
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.5.3-alpha.1", this.id = `VTable${Date.now()}`,
|
|
49
47
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
50
48
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
51
49
|
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 = pixel_ratio_1.defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
@@ -134,8 +132,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
134
132
|
const MenuHandler = factory_1.Factory.getComponent("menuHandler");
|
|
135
133
|
internalProps.menuHandler = new MenuHandler(this);
|
|
136
134
|
}
|
|
137
|
-
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.
|
|
138
|
-
internalProps.stick = {
|
|
135
|
+
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.bodyMergeTitleCache = new Map,
|
|
136
|
+
this.bodyBottomStyleCache = new Map, internalProps.stick = {
|
|
139
137
|
changedCells: new Map
|
|
140
138
|
}, internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin = new custom_cell_style_1.CustomCellStylePlugin(this, null !== (_k = options.customCellStyle) && void 0 !== _k ? _k : [], null !== (_l = options.customCellStyleArrangement) && void 0 !== _l ? _l : []);
|
|
141
139
|
}
|
|
@@ -1175,81 +1173,11 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1175
1173
|
return null === (_a = this.internalProps.dataSource) || void 0 === _a ? void 0 : _a.hasField(index, field);
|
|
1176
1174
|
}
|
|
1177
1175
|
_getCellStyle(col, row) {
|
|
1178
|
-
|
|
1179
|
-
const customCellStyle = this.customCellStylePlugin.getCustomCellStyle(col, row), {layoutMap: layoutMap} = this.internalProps;
|
|
1180
|
-
if (layoutMap.isHeader(col, row)) {
|
|
1181
|
-
let cacheKey;
|
|
1182
|
-
if (!this.isPivotTable() || this.isBottomFrozenRow(row) || this.isRightFrozenColumn(col)) cacheKey = `${col}-${row}`; else {
|
|
1183
|
-
const define = this.getHeaderDefine(col, row), isCorner = this.isCornerHeader(col, row);
|
|
1184
|
-
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}`;
|
|
1185
|
-
}
|
|
1186
|
-
let cacheStyle = this.headerStyleCache.get(cacheKey);
|
|
1187
|
-
if (cacheStyle) return customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
1188
|
-
const hd = layoutMap.getHeader(col, row);
|
|
1189
|
-
let paddingForAxis;
|
|
1190
|
-
if (this.isPivotChart() && (0, get_axis_config_1.isTopOrBottomAxis)(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
|
|
1191
|
-
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;
|
|
1192
|
-
} else if (this.isPivotChart() && (0, get_axis_config_1.isLeftOrRightAxis)(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
|
|
1193
|
-
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;
|
|
1194
|
-
}
|
|
1195
|
-
if ((!hd || hd.isEmpty) && (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightBottomCorner(col, row) || layoutMap.isCornerHeader(col, row) || layoutMap.isRightTopCorner(col, row))) return EMPTY_STYLE;
|
|
1196
|
-
const styleClass = this.internalProps.headerHelper.getStyleClass((null == hd ? void 0 : hd.headerType) || "text");
|
|
1197
|
-
if (layoutMap.isBottomFrozenRow(col, row) && this.theme.bottomFrozenStyle) cacheStyle = headerStyleContents.of(paddingForAxis ? {
|
|
1198
|
-
padding: paddingForAxis
|
|
1199
|
-
} : {}, this.theme.bottomFrozenStyle, {
|
|
1200
|
-
col: col,
|
|
1201
|
-
row: row,
|
|
1202
|
-
table: this,
|
|
1203
|
-
value: this.getCellValue(col, row),
|
|
1204
|
-
dataValue: this.getCellOriginValue(col, row),
|
|
1205
|
-
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1206
|
-
}, styleClass, this.options.autoWrapText, this.theme); else if (layoutMap.isRightFrozenColumn(col, row) && this.theme.rightFrozenStyle) cacheStyle = headerStyleContents.of(paddingForAxis ? {
|
|
1207
|
-
padding: paddingForAxis
|
|
1208
|
-
} : {}, this.theme.rightFrozenStyle, {
|
|
1209
|
-
col: col,
|
|
1210
|
-
row: row,
|
|
1211
|
-
table: this,
|
|
1212
|
-
value: this.getCellValue(col, row),
|
|
1213
|
-
dataValue: this.getCellOriginValue(col, row),
|
|
1214
|
-
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1215
|
-
}, styleClass, this.options.autoWrapText, this.theme); else {
|
|
1216
|
-
const style = (null == hd ? void 0 : hd.style) || {};
|
|
1217
|
-
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, {
|
|
1218
|
-
col: col,
|
|
1219
|
-
row: row,
|
|
1220
|
-
table: this,
|
|
1221
|
-
value: this.getCellValue(col, row),
|
|
1222
|
-
dataValue: this.getCellOriginValue(col, row),
|
|
1223
|
-
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1224
|
-
}, styleClass, this.options.autoWrapText, this.theme);
|
|
1225
|
-
}
|
|
1226
|
-
return this.headerStyleCache.set(cacheKey, cacheStyle), customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
1227
|
-
}
|
|
1228
|
-
let bgColorFunc, cacheKey;
|
|
1229
|
-
(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) => {
|
|
1230
|
-
mappingRule.bgColor && this.internalProps.layoutMap.getIndicatorKey(col, row) === mappingRule.bgColor.indicatorKey && (bgColorFunc = mappingRule.bgColor.mapping);
|
|
1231
|
-
})));
|
|
1232
|
-
const cellType = this.getCellType(col, row);
|
|
1233
|
-
let cacheStyle;
|
|
1234
|
-
if (cacheKey = this.isSeriesNumberInBody(col, row) ? `${col}-series-` + cellType : this.isListTable() && !this.transpose || this.isPivotTable() && this.internalProps.layoutMap.indicatorsAsCol ? col + cellType : row + cellType,
|
|
1235
|
-
cacheStyle = layoutMap.isBottomFrozenRow(row) ? this.bodyBottomStyleCache.get(cacheKey) : this.bodyStyleCache.get(cacheKey),
|
|
1236
|
-
cacheStyle) return customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
1237
|
-
const column = layoutMap.getBody(col, row), styleClass = this.internalProps.bodyHelper.getStyleClass(this.getCellType(col, row)), style = null == column ? void 0 : column.style;
|
|
1238
|
-
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, {
|
|
1239
|
-
col: col,
|
|
1240
|
-
row: row,
|
|
1241
|
-
table: this,
|
|
1242
|
-
value: this.getCellValue(col, row),
|
|
1243
|
-
dataValue: this.getCellOriginValue(col, row),
|
|
1244
|
-
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1245
|
-
}, styleClass, this.options.autoWrapText, this.theme), bgColorFunc && (cacheStyle = (0,
|
|
1246
|
-
custom_cell_style_1.mergeStyle)(cacheStyle, {
|
|
1247
|
-
bgColor: bgColorFunc
|
|
1248
|
-
})), (0, vutils_1.isFunction)(style) || (layoutMap.isBottomFrozenRow(row) ? this.bodyBottomStyleCache.set(cacheKey, cacheStyle) : this.bodyStyleCache.set(cacheKey, cacheStyle)),
|
|
1249
|
-
customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
1176
|
+
return (0, style_helper_1.getCellStyle)(col, row, this);
|
|
1250
1177
|
}
|
|
1251
1178
|
clearCellStyleCache() {
|
|
1252
|
-
this.headerStyleCache.clear(), this.bodyStyleCache.clear(), this.
|
|
1179
|
+
this.headerStyleCache.clear(), this.bodyStyleCache.clear(), this.bodyMergeTitleCache.clear(),
|
|
1180
|
+
this.bodyBottomStyleCache.clear();
|
|
1253
1181
|
}
|
|
1254
1182
|
clearRowHeightCache() {
|
|
1255
1183
|
this.internalProps._rowHeightsMap.clear(), this._clearRowRangeHeightsMap();
|
|
@@ -1755,6 +1683,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1755
1683
|
enableScroll() {
|
|
1756
1684
|
this.eventManager.enableScroll();
|
|
1757
1685
|
}
|
|
1686
|
+
getGroupTitleLevel(col, row) {}
|
|
1758
1687
|
}
|
|
1759
1688
|
|
|
1760
1689
|
exports.BaseTable = BaseTable;
|