@visactor/vtable 0.20.4-alpha.1 → 0.20.4-alpha.3
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/core/BaseTable.d.ts +9 -1
- package/cjs/core/BaseTable.js +15 -9
- package/cjs/core/BaseTable.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/plugins/custom-cell-style.d.ts +19 -0
- package/cjs/plugins/custom-cell-style.js +60 -0
- package/cjs/plugins/custom-cell-style.js.map +1 -0
- package/cjs/scenegraph/scenegraph.js +1 -2
- package/cjs/state/state.js +2 -1
- package/cjs/themes/theme.js +1 -1
- package/cjs/tools/isx.d.ts +1 -1
- package/cjs/tools/util.d.ts +1 -1
- package/cjs/ts-types/base-table.d.ts +10 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/common.d.ts +12 -2
- package/cjs/ts-types/common.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +135 -2
- package/dist/vtable.min.js +1 -1
- package/es/core/BaseTable.d.ts +9 -1
- package/es/core/BaseTable.js +16 -8
- package/es/core/BaseTable.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/plugins/custom-cell-style.d.ts +19 -0
- package/es/plugins/custom-cell-style.js +52 -0
- package/es/plugins/custom-cell-style.js.map +1 -0
- package/es/scenegraph/scenegraph.js +1 -2
- package/es/state/state.js +2 -1
- package/es/themes/theme.js +1 -1
- package/es/tools/isx.d.ts +1 -1
- package/es/tools/util.d.ts +1 -1
- package/es/ts-types/base-table.d.ts +10 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/common.d.ts +12 -2
- package/es/ts-types/common.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +2 -2
package/cjs/core/BaseTable.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CellAddress, type CellRange, type TableEventHandlersEventArgumentMap, type TableEventHandlersReturnMap, type TableKeyboardOptions, type DropDownMenuHighlightInfo, type MenuListItem, type WidthModeDef, type ICustomRender, type ICellHeaderPaths, type HeaderData, type FullExtendStyle, type FieldDef, type ColumnTypeOption, type SortState, type IPagination, type ICustomLayout, type CellInfo, type CellStyle, type DropDownMenuOptions, type FieldData, type MaybePromiseOrUndefined, type MousePointerCellEvent, type DropDownMenuEventInfo, type HierarchyState, type FieldKeyDef, type CellLocation, type LayoutObjectId, type HeightModeDef, type ITableThemeDefine } from '../ts-types';
|
|
2
|
-
import type { AnyFunction, CellAddressWithBound, ColumnIconOption, TableEventOptions } from '../ts-types';
|
|
2
|
+
import type { AnyFunction, CellAddressWithBound, ColumnIconOption, ColumnStyleOption, TableEventOptions } from '../ts-types';
|
|
3
3
|
import { TABLE_EVENT_TYPE } from './TABLE_EVENT_TYPE';
|
|
4
4
|
import { EventTarget } from '../event/EventTarget';
|
|
5
5
|
import { NumberMap } from '../tools/NumberMap';
|
|
@@ -15,6 +15,7 @@ import type { TooltipOptions } from '../ts-types/tooltip';
|
|
|
15
15
|
import type { BaseTableAPI, BaseTableConstructorOptions, IBaseTableProtected } from '../ts-types/base-table';
|
|
16
16
|
import { DataSet } from '@visactor/vdataset';
|
|
17
17
|
import { NumberRangeMap } from '../layout/row-height-map';
|
|
18
|
+
import { CustomCellStylePlugin } from '../plugins/custom-cell-style';
|
|
18
19
|
export declare abstract class BaseTable extends EventTarget implements BaseTableAPI {
|
|
19
20
|
internalProps: IBaseTableProtected;
|
|
20
21
|
showFrozenIcon: boolean;
|
|
@@ -55,6 +56,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
55
56
|
query?: any;
|
|
56
57
|
callback: AnyFunction;
|
|
57
58
|
}[]>;
|
|
59
|
+
customCellStylePlugin: CustomCellStylePlugin;
|
|
58
60
|
constructor(container: HTMLElement, options?: BaseTableConstructorOptions);
|
|
59
61
|
throttleInvalidate: (this: any, ...args: any[]) => void;
|
|
60
62
|
getContainer(): HTMLElement;
|
|
@@ -360,4 +362,10 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
360
362
|
onVChartEvent(type: string, query: any, callback: AnyFunction): void;
|
|
361
363
|
offVChartEvent(type: string, callback?: AnyFunction): void;
|
|
362
364
|
_bindChartEvent(activeChartInstance: any): void;
|
|
365
|
+
registerCustomCellStyle(customStyleId: string, customStyle: ColumnStyleOption | undefined | null): void;
|
|
366
|
+
arrangeCustomCellStyle(cellPos: {
|
|
367
|
+
col?: number;
|
|
368
|
+
row?: number;
|
|
369
|
+
range?: CellRange;
|
|
370
|
+
}, customStyleId: string): void;
|
|
363
371
|
}
|
package/cjs/core/BaseTable.js
CHANGED
|
@@ -33,7 +33,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
33
33
|
value: !0
|
|
34
34
|
}), exports.BaseTable = void 0;
|
|
35
35
|
|
|
36
|
-
const columnStyleContents = __importStar(require("../body-helper/style")), headerStyleContents = __importStar(require("../header-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"), TooltipHandler_1 = require("../components/tooltip/TooltipHandler"), 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"), MenuHandler_1 = require("../components/menu/dom/MenuHandler"), FouseInput_1 = require("./FouseInput"), pixel_ratio_1 = require("../tools/pixel-ratio"), create_legend_1 = require("../components/legend/create-legend"), vdataset_1 = require("@visactor/vdataset"), chart_render_helper_1 = require("../scenegraph/graphic/contributions/chart-render-helper"), get_axis_config_1 = require("../layout/chart-helper/get-axis-config"), row_height_map_1 = require("../layout/row-height-map"), {toBoxArray: toBoxArray} = helper_1.style, {isTouchEvent: isTouchEvent} = helper_1.event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
36
|
+
const columnStyleContents = __importStar(require("../body-helper/style")), headerStyleContents = __importStar(require("../header-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"), TooltipHandler_1 = require("../components/tooltip/TooltipHandler"), 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"), MenuHandler_1 = require("../components/menu/dom/MenuHandler"), FouseInput_1 = require("./FouseInput"), pixel_ratio_1 = require("../tools/pixel-ratio"), create_legend_1 = require("../components/legend/create-legend"), vdataset_1 = require("@visactor/vdataset"), chart_render_helper_1 = require("../scenegraph/graphic/contributions/chart-render-helper"), get_axis_config_1 = require("../layout/chart-helper/get-axis-config"), row_height_map_1 = require("../layout/row-height-map"), custom_cell_style_1 = require("../plugins/custom-cell-style"), {toBoxArray: toBoxArray} = helper_1.style, {isTouchEvent: isTouchEvent} = helper_1.event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
37
37
|
|
|
38
38
|
(0, style_1.importStyle)();
|
|
39
39
|
|
|
@@ -44,8 +44,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
44
44
|
return TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE;
|
|
45
45
|
}
|
|
46
46
|
constructor(container, options = {}) {
|
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
48
|
-
if (super(), this.showFrozenIcon = !0, this.version = "0.20.4-alpha.
|
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
48
|
+
if (super(), this.showFrozenIcon = !0, this.version = "0.20.4-alpha.3", this.id = `VTable${Date.now()}`,
|
|
49
49
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
50
50
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
51
51
|
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 = pixel_ratio_1.defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth} = options;
|
|
@@ -112,7 +112,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
112
112
|
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.bodyBottomStyleCache = new Map,
|
|
113
113
|
internalProps.stick = {
|
|
114
114
|
changedCells: new Map
|
|
115
|
-
}, internalProps.customMergeCell = options.customMergeCell;
|
|
115
|
+
}, internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin = new custom_cell_style_1.CustomCellStylePlugin(this, null !== (_h = options.customCellStyle) && void 0 !== _h ? _h : [], null !== (_j = options.customCellStyleArrangement) && void 0 !== _j ? _j : []);
|
|
116
116
|
}
|
|
117
117
|
getContainer() {
|
|
118
118
|
return this.container;
|
|
@@ -1143,7 +1143,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
_getCellStyle(col, row) {
|
|
1145
1145
|
var _a, _b, _c, _d;
|
|
1146
|
-
const {layoutMap: layoutMap} = this.internalProps;
|
|
1146
|
+
const customCellStyle = this.customCellStylePlugin.getCustomCellStyle(col, row), {layoutMap: layoutMap} = this.internalProps;
|
|
1147
1147
|
if (layoutMap.isHeader(col, row)) {
|
|
1148
1148
|
let cacheKey;
|
|
1149
1149
|
if (!this.isPivotTable() || this.isBottomFrozenRow(row) || this.isRightFrozenColumn(col)) cacheKey = `${col}-${row}`; else {
|
|
@@ -1151,7 +1151,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1151
1151
|
cacheKey = (null == define ? void 0 : define.dimensionKey) ? `dim-${define.dimensionKey}` : (null == define ? void 0 : define.indicatorKey) ? `ind-${define.indicatorKey}` : `${col}-${row}`;
|
|
1152
1152
|
}
|
|
1153
1153
|
let cacheStyle = this.headerStyleCache.get(cacheKey);
|
|
1154
|
-
if (cacheStyle) return cacheStyle;
|
|
1154
|
+
if (cacheStyle) return customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
1155
1155
|
const hd = layoutMap.getHeader(col, row);
|
|
1156
1156
|
let paddingForAxis;
|
|
1157
1157
|
if (this.isPivotChart() && (0, get_axis_config_1.isTopOrBottomAxis)(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
|
|
@@ -1190,14 +1190,14 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1190
1190
|
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1191
1191
|
}, styleClass, this.options.autoWrapText, this.theme);
|
|
1192
1192
|
}
|
|
1193
|
-
return this.headerStyleCache.set(cacheKey, cacheStyle), cacheStyle;
|
|
1193
|
+
return this.headerStyleCache.set(cacheKey, cacheStyle), customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
1194
1194
|
}
|
|
1195
1195
|
let cacheKey;
|
|
1196
1196
|
const cellType = this.getCellType(col, row);
|
|
1197
1197
|
let cacheStyle;
|
|
1198
1198
|
if (cacheKey = this.isListTable() && !this.transpose || this.isPivotTable() && this.internalProps.layoutMap.indicatorsAsCol ? col + cellType : row + cellType,
|
|
1199
1199
|
cacheStyle = layoutMap.isBottomFrozenRow(row) ? this.bodyBottomStyleCache.get(cacheKey) : this.bodyStyleCache.get(cacheKey),
|
|
1200
|
-
cacheStyle) return cacheStyle;
|
|
1200
|
+
cacheStyle) return customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
1201
1201
|
const column = layoutMap.getBody(col, row), styleClass = this.internalProps.bodyHelper.getStyleClass(this.getCellType(col, row)), style = null == column ? void 0 : column.style;
|
|
1202
1202
|
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, {
|
|
1203
1203
|
col: col,
|
|
@@ -1207,7 +1207,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1207
1207
|
dataValue: this.getCellOriginValue(col, row),
|
|
1208
1208
|
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1209
1209
|
}, styleClass, this.options.autoWrapText, this.theme), (0, vutils_1.isFunction)(style) || (layoutMap.isBottomFrozenRow(row) ? this.bodyBottomStyleCache.set(cacheKey, cacheStyle) : this.bodyStyleCache.set(cacheKey, cacheStyle)),
|
|
1210
|
-
cacheStyle;
|
|
1210
|
+
customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
1211
1211
|
}
|
|
1212
1212
|
clearCellStyleCache() {
|
|
1213
1213
|
this.headerStyleCache.clear(), this.bodyStyleCache.clear(), this.bodyBottomStyleCache.clear();
|
|
@@ -1553,6 +1553,12 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1553
1553
|
e.query ? activeChartInstance.on(key, e.query, e.callback) : activeChartInstance.on(key, e.callback);
|
|
1554
1554
|
}));
|
|
1555
1555
|
}
|
|
1556
|
+
registerCustomCellStyle(customStyleId, customStyle) {
|
|
1557
|
+
this.customCellStylePlugin.registerCustomCellStyle(customStyleId, customStyle);
|
|
1558
|
+
}
|
|
1559
|
+
arrangeCustomCellStyle(cellPos, customStyleId) {
|
|
1560
|
+
this.customCellStylePlugin.arrangeCustomCellStyle(cellPos, customStyleId);
|
|
1561
|
+
}
|
|
1556
1562
|
}
|
|
1557
1563
|
|
|
1558
1564
|
exports.BaseTable = BaseTable;
|