@visactor/vtable 1.3.3 → 1.4.0
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 +25 -15
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -2
- package/cjs/PivotChart.js +0 -7
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +34 -14
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/react/react-custom-layout.d.ts +21 -0
- package/cjs/components/react/react-custom-layout.js +48 -0
- package/cjs/components/react/react-custom-layout.js.map +1 -0
- package/cjs/core/BaseTable.d.ts +5 -0
- package/cjs/core/BaseTable.js +37 -23
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/style.js +1 -1
- package/cjs/core/style.js.map +1 -1
- package/cjs/data/DataSource.d.ts +6 -1
- package/cjs/data/DataSource.js +12 -2
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +15 -2
- package/cjs/dataset/dataset.js +187 -72
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/statistics-helper.d.ts +43 -3
- package/cjs/dataset/statistics-helper.js +61 -26
- package/cjs/dataset/statistics-helper.js.map +1 -1
- package/cjs/event/listener/table-group.js +2 -2
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +14 -5
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +1 -0
- package/cjs/layout/pivot-header-layout.js +7 -0
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/custom.js +6 -4
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +4 -0
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +2 -2
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +3 -3
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -1
- package/cjs/scenegraph/scenegraph.js +12 -3
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +8 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/customLayout.d.ts +1 -1
- package/cjs/ts-types/customLayout.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +9 -1
- package/cjs/ts-types/new-data-set.js +1 -1
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/pivot-table/corner.d.ts +12 -0
- package/cjs/ts-types/pivot-table/corner.js.map +1 -1
- package/cjs/vrender.d.ts +4 -0
- package/cjs/vrender.js +39 -11
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +25311 -9542
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +21 -11
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -2
- package/es/PivotChart.js +0 -7
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +34 -14
- package/es/PivotTable.js.map +1 -1
- package/es/components/react/react-custom-layout.d.ts +21 -0
- package/es/components/react/react-custom-layout.js +38 -0
- package/es/components/react/react-custom-layout.js.map +1 -0
- package/es/core/BaseTable.d.ts +5 -0
- package/es/core/BaseTable.js +40 -23
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/style.js +1 -1
- package/es/core/style.js.map +1 -1
- package/es/data/DataSource.d.ts +6 -1
- package/es/data/DataSource.js +12 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.d.ts +15 -2
- package/es/dataset/dataset.js +187 -73
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/statistics-helper.d.ts +43 -3
- package/es/dataset/statistics-helper.js +55 -23
- package/es/dataset/statistics-helper.js.map +1 -1
- package/es/event/listener/table-group.js +2 -2
- package/es/event/listener/table-group.js.map +1 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +1 -0
- package/es/layout/pivot-header-layout.js +7 -0
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/component/custom.js +7 -3
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +4 -0
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +3 -3
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +4 -4
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -1
- package/es/scenegraph/scenegraph.js +12 -3
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/ts-types/base-table.d.ts +8 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/customLayout.d.ts +1 -1
- package/es/ts-types/customLayout.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +9 -1
- package/es/ts-types/new-data-set.js +1 -1
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/pivot-table/corner.d.ts +12 -0
- package/es/ts-types/pivot-table/corner.js.map +1 -1
- package/es/vrender.d.ts +4 -0
- package/es/vrender.js +9 -3
- package/es/vrender.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Group } from './../../vrender';
|
|
2
|
+
import type { CustomRenderFunctionArg, ICustomLayoutFuc } from '../../ts-types';
|
|
3
|
+
import type { BaseTableAPI } from '../../ts-types/base-table';
|
|
4
|
+
export declare function emptyCustomLayout(args: CustomRenderFunctionArg): {
|
|
5
|
+
rootContainer: Group;
|
|
6
|
+
renderDefault: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare class ReactCustomLayout {
|
|
9
|
+
table: BaseTableAPI;
|
|
10
|
+
customLayoutFuncCache: Map<number, ICustomLayoutFuc>;
|
|
11
|
+
reactRemoveGraphicCache: Map<number, (col: number, row: number) => void>;
|
|
12
|
+
headerCustomLayoutFuncCache: Map<number, ICustomLayoutFuc>;
|
|
13
|
+
headerReactRemoveGraphicCache: Map<number, (col: number, row: number) => void>;
|
|
14
|
+
constructor(table: BaseTableAPI);
|
|
15
|
+
hasReactCreateGraphic(componentIndex: number, isHeaderCustomLayout?: boolean): boolean;
|
|
16
|
+
setReactCreateGraphic(componentIndex: number, createGraphic: ICustomLayoutFuc, isHeaderCustomLayout?: boolean): void;
|
|
17
|
+
setReactRemoveGraphic(componentIndex: number, removeGraphic: (col: number, row: number) => void, isHeaderCustomLayout?: boolean): void;
|
|
18
|
+
updateCustomCell(componentIndex: number, isHeaderCustomLayout?: boolean): void;
|
|
19
|
+
getCustomLayoutFunc(col: number, row: number): ICustomLayoutFuc | typeof emptyCustomLayout;
|
|
20
|
+
removeCustomCell(col: number, row: number): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.ReactCustomLayout = exports.emptyCustomLayout = void 0;
|
|
6
|
+
|
|
7
|
+
const vrender_1 = require("./../../vrender");
|
|
8
|
+
|
|
9
|
+
function emptyCustomLayout(args) {
|
|
10
|
+
return {
|
|
11
|
+
rootContainer: new vrender_1.Group({}),
|
|
12
|
+
renderDefault: !0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.emptyCustomLayout = emptyCustomLayout;
|
|
17
|
+
|
|
18
|
+
class ReactCustomLayout {
|
|
19
|
+
constructor(table) {
|
|
20
|
+
this.table = table, this.customLayoutFuncCache = new Map, this.reactRemoveGraphicCache = new Map,
|
|
21
|
+
this.headerCustomLayoutFuncCache = new Map, this.headerReactRemoveGraphicCache = new Map;
|
|
22
|
+
}
|
|
23
|
+
hasReactCreateGraphic(componentIndex, isHeaderCustomLayout) {
|
|
24
|
+
return isHeaderCustomLayout ? this.headerCustomLayoutFuncCache.has(componentIndex) : this.customLayoutFuncCache.has(componentIndex);
|
|
25
|
+
}
|
|
26
|
+
setReactCreateGraphic(componentIndex, createGraphic, isHeaderCustomLayout) {
|
|
27
|
+
isHeaderCustomLayout ? this.headerCustomLayoutFuncCache.set(componentIndex, createGraphic) : this.customLayoutFuncCache.set(componentIndex, createGraphic);
|
|
28
|
+
}
|
|
29
|
+
setReactRemoveGraphic(componentIndex, removeGraphic, isHeaderCustomLayout) {
|
|
30
|
+
isHeaderCustomLayout ? this.headerReactRemoveGraphicCache.set(componentIndex, removeGraphic) : this.reactRemoveGraphicCache.set(componentIndex, removeGraphic);
|
|
31
|
+
}
|
|
32
|
+
updateCustomCell(componentIndex, isHeaderCustomLayout) {
|
|
33
|
+
const table = this.table, col = componentIndex;
|
|
34
|
+
if (isHeaderCustomLayout) for (let row = 0; row < table.columnHeaderLevelCount; row++) table.scenegraph.updateCellContent(col, row); else for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) table.scenegraph.updateCellContent(col, row);
|
|
35
|
+
table.scenegraph.renderSceneGraph();
|
|
36
|
+
}
|
|
37
|
+
getCustomLayoutFunc(col, row) {
|
|
38
|
+
const {startInTotal: startInTotal} = this.table.getBodyColumnDefine(col, row);
|
|
39
|
+
return (this.table.isHeader(col, row) ? this.headerCustomLayoutFuncCache.get(startInTotal) : this.customLayoutFuncCache.get(startInTotal)) || emptyCustomLayout;
|
|
40
|
+
}
|
|
41
|
+
removeCustomCell(col, row) {
|
|
42
|
+
const {startInTotal: startInTotal} = this.table.getBodyColumnDefine(col, row), removeFun = this.table.isHeader(col, row) ? this.headerReactRemoveGraphicCache.get(startInTotal) : this.reactRemoveGraphicCache.get(startInTotal);
|
|
43
|
+
removeFun && removeFun(col, row);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.ReactCustomLayout = ReactCustomLayout;
|
|
48
|
+
//# sourceMappingURL=react-custom-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/react/react-custom-layout.ts"],"names":[],"mappings":"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","file":"react-custom-layout.js","sourcesContent":["import { Group } from './../../vrender';\nimport type { CustomRenderFunctionArg, ICustomLayoutFuc } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nexport function emptyCustomLayout(args: CustomRenderFunctionArg) {\n const group = new Group({});\n return {\n rootContainer: group,\n renderDefault: true\n };\n}\n\nexport class ReactCustomLayout {\n table: BaseTableAPI;\n customLayoutFuncCache: Map<number, ICustomLayoutFuc>;\n reactRemoveGraphicCache: Map<number, (col: number, row: number) => void>;\n headerCustomLayoutFuncCache: Map<number, ICustomLayoutFuc>;\n headerReactRemoveGraphicCache: Map<number, (col: number, row: number) => void>;\n // reactContainerCache: Map<number, Map<string, any>>;\n constructor(table: BaseTableAPI) {\n this.table = table;\n this.customLayoutFuncCache = new Map();\n // this.reactContainerCache = new Map();\n this.reactRemoveGraphicCache = new Map();\n this.headerCustomLayoutFuncCache = new Map();\n // this.headerCeactContainerCache = new Map();\n this.headerReactRemoveGraphicCache = new Map();\n }\n\n hasReactCreateGraphic(componentIndex: number, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n return this.headerCustomLayoutFuncCache.has(componentIndex);\n }\n return this.customLayoutFuncCache.has(componentIndex);\n }\n\n setReactCreateGraphic(\n componentIndex: number,\n createGraphic: ICustomLayoutFuc,\n // containerCache: Map<string, any>,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerCustomLayoutFuncCache.set(componentIndex, createGraphic);\n } else {\n this.customLayoutFuncCache.set(componentIndex, createGraphic);\n }\n // this.reactContainerCache.set(componentIndex, containerCache);\n }\n\n setReactRemoveGraphic(\n componentIndex: number,\n removeGraphic: (col: number, row: number) => void,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveGraphicCache.set(componentIndex, removeGraphic);\n } else {\n this.reactRemoveGraphicCache.set(componentIndex, removeGraphic);\n }\n }\n\n updateCustomCell(componentIndex: number, isHeaderCustomLayout?: boolean) {\n const table = this.table;\n const col = componentIndex;\n // to do: deal with transpose table\n if (isHeaderCustomLayout) {\n for (let row = 0; row < table.columnHeaderLevelCount; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n } else {\n for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n // table.scenegraph.updateNextFrame();\n table.scenegraph.renderSceneGraph(); // use sync render for faster update\n }\n\n getCustomLayoutFunc(col: number, row: number) {\n const { startInTotal } = this.table.getBodyColumnDefine(col, row) as any;\n const isHeader = this.table.isHeader(col, row);\n return (\n (isHeader ? this.headerCustomLayoutFuncCache.get(startInTotal) : this.customLayoutFuncCache.get(startInTotal)) ||\n emptyCustomLayout\n );\n }\n\n removeCustomCell(col: number, row: number) {\n const { startInTotal } = this.table.getBodyColumnDefine(col, row) as any;\n const isHeader = this.table.isHeader(col, row);\n const removeFun = isHeader\n ? this.headerReactRemoveGraphicCache.get(startInTotal)\n : this.reactRemoveGraphicCache.get(startInTotal);\n if (removeFun) {\n removeFun(col, row);\n }\n }\n}\n"]}
|
package/cjs/core/BaseTable.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { DataSet } from '@visactor/vdataset';
|
|
|
17
17
|
import { NumberRangeMap } from '../layout/row-height-map';
|
|
18
18
|
import { CustomCellStylePlugin } from '../plugins/custom-cell-style';
|
|
19
19
|
import type { ITextGraphicAttribute } from './../vrender';
|
|
20
|
+
import { ReactCustomLayout } from '../components/react/react-custom-layout';
|
|
20
21
|
import type { ISortedMapItem } from '../data/DataSource';
|
|
21
22
|
export declare abstract class BaseTable extends EventTarget implements BaseTableAPI {
|
|
22
23
|
internalProps: IBaseTableProtected;
|
|
@@ -62,6 +63,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
62
63
|
}[]>;
|
|
63
64
|
customCellStylePlugin: CustomCellStylePlugin;
|
|
64
65
|
columnWidthComputeMode?: 'normal' | 'only-header' | 'only-body';
|
|
66
|
+
reactCustomLayout?: ReactCustomLayout;
|
|
65
67
|
_hasAutoImageColumn?: boolean;
|
|
66
68
|
constructor(container: HTMLElement, options?: BaseTableConstructorOptions);
|
|
67
69
|
throttleInvalidate: (this: any, ...args: any[]) => void;
|
|
@@ -396,4 +398,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
396
398
|
get leftRowSeriesNumberCount(): number;
|
|
397
399
|
setMinMaxLimitWidth(setWidth?: boolean): void;
|
|
398
400
|
setSortedIndexMap(field: FieldDef, filedMap: ISortedMapItem): void;
|
|
401
|
+
checkReactCustomLayout(): void;
|
|
402
|
+
get bodyDomContainer(): HTMLElement;
|
|
403
|
+
get headerDomContainer(): HTMLElement;
|
|
399
404
|
}
|
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"), 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"), layout_helper_1 = require("../layout/layout-helper"), {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"), 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"), {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, _h, _j, _k;
|
|
48
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.
|
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
48
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.4.0", 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, 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;
|
|
@@ -68,7 +68,10 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
68
68
|
"node" !== env_1.Env.mode && (internalProps.element = (0, tableHelper_1.createRootElement)(this.padding),
|
|
69
69
|
internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
|
|
70
70
|
internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas),
|
|
71
|
-
internalProps.context = internalProps.canvas.getContext("2d")
|
|
71
|
+
internalProps.context = internalProps.canvas.getContext("2d"), (null === (_b = options.customConfig) || void 0 === _b ? void 0 : _b.createReactContainer) && (internalProps.bodyDomContainer = document.createElement("div"),
|
|
72
|
+
internalProps.bodyDomContainer.classList.add("table-component-container"), internalProps.element.appendChild(internalProps.bodyDomContainer),
|
|
73
|
+
internalProps.headerDomContainer = document.createElement("div"), internalProps.headerDomContainer.classList.add("table-component-container"),
|
|
74
|
+
internalProps.element.appendChild(internalProps.headerDomContainer))), internalProps.handler = new EventHandler_1.EventHandler,
|
|
72
75
|
(0, vutils_1.isNumber)(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
|
|
73
76
|
internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount,
|
|
74
77
|
internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
|
|
@@ -88,15 +91,15 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
88
91
|
var _a;
|
|
89
92
|
return "node" === env_1.Env.mode ? canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
|
|
90
93
|
}
|
|
91
|
-
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (
|
|
94
|
+
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (_c = options.theme) && void 0 !== _c ? _c : themes_1.default.DEFAULT),
|
|
92
95
|
internalProps.theme.isPivot = this.isPivotTable(), container ? (clearDOM && (container.innerHTML = ""),
|
|
93
96
|
container.appendChild(internalProps.element), this._updateSize()) : this._updateSize(),
|
|
94
|
-
this.options = options, internalProps.theme = themes_1.default.of(null !== (
|
|
97
|
+
this.options = options, internalProps.theme = themes_1.default.of(null !== (_d = options.theme) && void 0 !== _d ? _d : themes_1.default.DEFAULT),
|
|
95
98
|
internalProps.theme.isPivot = this.isPivotTable(), internalProps.bodyHelper = new body_helper_1.BodyHelper(this),
|
|
96
99
|
internalProps.headerHelper = new header_helper_1.HeaderHelper(this), internalProps.rowSeriesNumberHelper = new row_series_number_helper_1.RowSeriesNumberHelper(this),
|
|
97
100
|
internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak,
|
|
98
|
-
internalProps.allowFrozenColCount = null !== (
|
|
99
|
-
internalProps.limitMaxAutoWidth = null !== (
|
|
101
|
+
internalProps.allowFrozenColCount = null !== (_e = options.allowFrozenColCount) && void 0 !== _e ? _e : 0,
|
|
102
|
+
internalProps.limitMaxAutoWidth = null !== (_f = options.limitMaxAutoWidth) && void 0 !== _f ? _f : 450,
|
|
100
103
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
101
104
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
102
105
|
this._vDataSet = new vdataset_1.DataSet, this.scenegraph = new scenegraph_1.Scenegraph(this),
|
|
@@ -120,13 +123,13 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
120
123
|
}, options.tooltip), "html" === internalProps.tooltip.renderMode && (internalProps.tooltipHandler = new TooltipHandler_1.TooltipHandler(this, internalProps.tooltip.confine)),
|
|
121
124
|
internalProps.menu = Object.assign({
|
|
122
125
|
renderMode: "html"
|
|
123
|
-
}, options.menu), Array.isArray(null === (
|
|
124
|
-
Array.isArray(null === (
|
|
126
|
+
}, options.menu), Array.isArray(null === (_g = options.menu) || void 0 === _g ? void 0 : _g.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_h = options.menu) || void 0 === _h ? void 0 : _h.dropDownMenuHighlight),
|
|
127
|
+
Array.isArray(null === (_j = options.menu) || void 0 === _j ? void 0 : _j.defaultHeaderMenuItems) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
|
|
125
128
|
"html" === internalProps.menu.renderMode && (internalProps.menuHandler = new MenuHandler_1.MenuHandler(this)),
|
|
126
129
|
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.bodyBottomStyleCache = new Map,
|
|
127
130
|
internalProps.stick = {
|
|
128
131
|
changedCells: new Map
|
|
129
|
-
}, internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin = new custom_cell_style_1.CustomCellStylePlugin(this, null !== (
|
|
132
|
+
}, 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 : []);
|
|
130
133
|
}
|
|
131
134
|
getContainer() {
|
|
132
135
|
return this.container;
|
|
@@ -158,8 +161,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
158
161
|
this.internalProps.colCount = colCount;
|
|
159
162
|
}
|
|
160
163
|
get frozenColCount() {
|
|
161
|
-
var _a, _b, _c;
|
|
162
|
-
return null !== (
|
|
164
|
+
var _a, _b, _c, _d, _e;
|
|
165
|
+
return null !== (_e = null !== (_c = null === (_b = null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.layoutMap) || void 0 === _b ? void 0 : _b.frozenColCount) && void 0 !== _c ? _c : null === (_d = this.internalProps) || void 0 === _d ? void 0 : _d.frozenColCount) && void 0 !== _e ? _e : 0;
|
|
163
166
|
}
|
|
164
167
|
set frozenColCount(frozenColCount) {
|
|
165
168
|
frozenColCount >= this.colCount && (frozenColCount = 0), this.internalProps.frozenColCount = frozenColCount,
|
|
@@ -178,22 +181,22 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
178
181
|
this.options.frozenColCount && (this.tableNoFrameWidth - this.getColsWidth(0, this.options.frozenColCount - 1) <= 120 ? this._setFrozenColCount(0) : this.frozenColCount !== this.options.frozenColCount && this._setFrozenColCount(this.options.frozenColCount));
|
|
179
182
|
}
|
|
180
183
|
get frozenRowCount() {
|
|
181
|
-
var _a, _b, _c;
|
|
182
|
-
return null !== (
|
|
184
|
+
var _a, _b, _c, _d, _e;
|
|
185
|
+
return null !== (_e = null !== (_c = null === (_b = null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.layoutMap) || void 0 === _b ? void 0 : _b.frozenRowCount) && void 0 !== _c ? _c : null === (_d = this.internalProps) || void 0 === _d ? void 0 : _d.frozenRowCount) && void 0 !== _e ? _e : 0;
|
|
183
186
|
}
|
|
184
187
|
set frozenRowCount(frozenRowCount) {
|
|
185
188
|
this.internalProps.frozenRowCount = frozenRowCount;
|
|
186
189
|
}
|
|
187
190
|
get rightFrozenColCount() {
|
|
188
|
-
var _a, _b, _c;
|
|
189
|
-
return null !== (
|
|
191
|
+
var _a, _b, _c, _d, _e;
|
|
192
|
+
return null !== (_e = null !== (_c = null === (_b = null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.layoutMap) || void 0 === _b ? void 0 : _b.rightFrozenColCount) && void 0 !== _c ? _c : null === (_d = this.internalProps) || void 0 === _d ? void 0 : _d.rightFrozenColCount) && void 0 !== _e ? _e : 0;
|
|
190
193
|
}
|
|
191
194
|
set rightFrozenColCount(rightFrozenColCount) {
|
|
192
195
|
this.scenegraph.dealWidthRightFrozen(rightFrozenColCount);
|
|
193
196
|
}
|
|
194
197
|
get bottomFrozenRowCount() {
|
|
195
|
-
var _a, _b, _c;
|
|
196
|
-
return null !== (
|
|
198
|
+
var _a, _b, _c, _d, _e;
|
|
199
|
+
return null !== (_e = null !== (_c = null === (_b = null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.layoutMap) || void 0 === _b ? void 0 : _b.bottomFrozenRowCount) && void 0 !== _c ? _c : null === (_d = this.internalProps) || void 0 === _d ? void 0 : _d.bottomFrozenRowCount) && void 0 !== _e ? _e : 0;
|
|
197
200
|
}
|
|
198
201
|
set bottomFrozenRowCount(bottomFrozenRowCount) {
|
|
199
202
|
this.scenegraph.dealWidthBottomFrozen(bottomFrozenRowCount);
|
|
@@ -356,7 +359,9 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
356
359
|
heightP = null !== (_d = null === (_c = canvas.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0,
|
|
357
360
|
(null === (_e = null == this ? void 0 : this.scenegraph) || void 0 === _e ? void 0 : _e.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
358
361
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
359
|
-
canvas.style.height = `${heightP}px`)
|
|
362
|
+
canvas.style.height = `${heightP}px`), this.internalProps.bodyDomContainer && (this.internalProps.bodyDomContainer.style.width = `${widthP}px`,
|
|
363
|
+
this.internalProps.bodyDomContainer.style.height = `${heightP}px`), this.internalProps.headerDomContainer && (this.internalProps.headerDomContainer.style.width = `${widthP}px`,
|
|
364
|
+
this.internalProps.headerDomContainer.style.height = `${heightP}px`);
|
|
360
365
|
} else "node" === env_1.Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
361
366
|
const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
|
|
362
367
|
if (null === (_f = this.internalProps.theme) || void 0 === _f ? void 0 : _f.frameStyle) {
|
|
@@ -520,9 +525,9 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
520
525
|
let absoluteLeft;
|
|
521
526
|
const width = this.getColWidth(col);
|
|
522
527
|
let absoluteTop;
|
|
523
|
-
absoluteLeft = isFrozenCell && isFrozenCell.col && this.isRightFrozenColumn(col, row) ? this.tableNoFrameWidth - (null !== (_a = this.getColsWidth(col, this.colCount - 1)) && void 0 !== _a ? _a : 0) : this.getColsWidth(0, col - 1) || 0;
|
|
528
|
+
absoluteLeft = isFrozenCell && isFrozenCell.col && this.isRightFrozenColumn(col, row) ? this.getAllColsWidth() <= this.tableNoFrameWidth ? this.getColsWidth(0, col - 1) || 0 : this.tableNoFrameWidth - (null !== (_a = this.getColsWidth(col, this.colCount - 1)) && void 0 !== _a ? _a : 0) : this.getColsWidth(0, col - 1) || 0;
|
|
524
529
|
const height = this.getRowHeight(row);
|
|
525
|
-
return absoluteTop = isFrozenCell && isFrozenCell.row && this.isBottomFrozenRow(col, row) ? this.tableNoFrameHeight - (null !== (_b = this.getRowsHeight(row, this.rowCount - 1)) && void 0 !== _b ? _b : 0) : this.getRowsHeight(0, row - 1),
|
|
530
|
+
return absoluteTop = isFrozenCell && isFrozenCell.row && this.isBottomFrozenRow(col, row) ? this.getAllRowsHeight() <= this.tableNoFrameHeight ? this.getRowsHeight(0, row - 1) : this.tableNoFrameHeight - (null !== (_b = this.getRowsHeight(row, this.rowCount - 1)) && void 0 !== _b ? _b : 0) : this.getRowsHeight(0, row - 1),
|
|
526
531
|
new Rect_1.Rect(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
|
|
527
532
|
}
|
|
528
533
|
getMergeCellRect(col, row) {
|
|
@@ -1164,7 +1169,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1164
1169
|
var _a;
|
|
1165
1170
|
if (this.internalProps.customMergeCell) {
|
|
1166
1171
|
const customMerge = this.internalProps.customMergeCell(col, row, this);
|
|
1167
|
-
if (customMerge && customMerge.range && customMerge.text) return customMerge.range;
|
|
1172
|
+
if (customMerge && customMerge.range && (customMerge.text || customMerge.customLayout || customMerge.customRender)) return customMerge.range;
|
|
1168
1173
|
}
|
|
1169
1174
|
return null === (_a = this.internalProps.layoutMap) || void 0 === _a ? void 0 : _a.getCellRange(col, row);
|
|
1170
1175
|
}
|
|
@@ -1847,6 +1852,15 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1847
1852
|
var _a;
|
|
1848
1853
|
null === (_a = this.dataSource) || void 0 === _a || _a.setSortedIndexMap(field, filedMap);
|
|
1849
1854
|
}
|
|
1855
|
+
checkReactCustomLayout() {
|
|
1856
|
+
this.reactCustomLayout || (this.reactCustomLayout = new react_custom_layout_1.ReactCustomLayout(this));
|
|
1857
|
+
}
|
|
1858
|
+
get bodyDomContainer() {
|
|
1859
|
+
return this.internalProps.bodyDomContainer;
|
|
1860
|
+
}
|
|
1861
|
+
get headerDomContainer() {
|
|
1862
|
+
return this.internalProps.headerDomContainer;
|
|
1863
|
+
}
|
|
1850
1864
|
}
|
|
1851
1865
|
|
|
1852
1866
|
exports.BaseTable = BaseTable;
|