@visactor/vtable 1.3.2 → 1.3.3-alpha.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 +7 -6
- package/cjs/ListTable.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 +34 -20
- 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/event/media-click.js +2 -1
- package/cjs/event/sparkline-event.js +1 -2
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +14 -5
- package/cjs/index.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 +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -0
- package/cjs/scenegraph/scenegraph.js +11 -2
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/themes/ARCO.js +1 -1
- package/cjs/themes/BRIGHT.js +1 -1
- package/cjs/themes/DARK.js +1 -1
- package/cjs/themes/DEFAULT.js +1 -1
- package/cjs/themes/SIMPLIFY.js +1 -1
- package/cjs/themes/component.js +1 -1
- package/cjs/tools/LimitPromiseQueue.js +1 -1
- package/cjs/tools/NumberMap.js +1 -1
- package/cjs/tools/Rect.js +1 -1
- package/cjs/tools/calc.js +1 -1
- package/cjs/tools/debounce.js +1 -1
- package/cjs/tools/diff-cell.js +2 -2
- 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/vrender.d.ts +4 -0
- package/cjs/vrender.js +39 -11
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +24722 -9322
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +3 -3
- package/es/ListTable.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 +37 -20
- 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/event/media-click.js +2 -1
- package/es/event/sparkline-event.js +1 -2
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- package/es/index.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 +2 -2
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +2 -2
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -0
- package/es/scenegraph/scenegraph.js +11 -2
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/themes/ARCO.js +1 -1
- package/es/themes/BRIGHT.js +1 -1
- package/es/themes/DARK.js +1 -1
- package/es/themes/DEFAULT.js +1 -1
- package/es/themes/SIMPLIFY.js +1 -1
- package/es/themes/component.js +1 -1
- package/es/tools/LimitPromiseQueue.js +1 -1
- package/es/tools/NumberMap.js +1 -1
- package/es/tools/Rect.js +1 -1
- package/es/tools/calc.js +1 -1
- package/es/tools/debounce.js +1 -1
- package/es/tools/diff-cell.js +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/vrender.d.ts +4 -0
- package/es/vrender.js +9 -3
- package/es/vrender.js.map +1 -1
- package/package.json +7 -6
|
@@ -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,38 @@
|
|
|
1
|
+
import { Group } from "./../../vrender";
|
|
2
|
+
|
|
3
|
+
export function emptyCustomLayout(args) {
|
|
4
|
+
return {
|
|
5
|
+
rootContainer: new Group({}),
|
|
6
|
+
renderDefault: !0
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class ReactCustomLayout {
|
|
11
|
+
constructor(table) {
|
|
12
|
+
this.table = table, this.customLayoutFuncCache = new Map, this.reactRemoveGraphicCache = new Map,
|
|
13
|
+
this.headerCustomLayoutFuncCache = new Map, this.headerReactRemoveGraphicCache = new Map;
|
|
14
|
+
}
|
|
15
|
+
hasReactCreateGraphic(componentIndex, isHeaderCustomLayout) {
|
|
16
|
+
return isHeaderCustomLayout ? this.headerCustomLayoutFuncCache.has(componentIndex) : this.customLayoutFuncCache.has(componentIndex);
|
|
17
|
+
}
|
|
18
|
+
setReactCreateGraphic(componentIndex, createGraphic, isHeaderCustomLayout) {
|
|
19
|
+
isHeaderCustomLayout ? this.headerCustomLayoutFuncCache.set(componentIndex, createGraphic) : this.customLayoutFuncCache.set(componentIndex, createGraphic);
|
|
20
|
+
}
|
|
21
|
+
setReactRemoveGraphic(componentIndex, removeGraphic, isHeaderCustomLayout) {
|
|
22
|
+
isHeaderCustomLayout ? this.headerReactRemoveGraphicCache.set(componentIndex, removeGraphic) : this.reactRemoveGraphicCache.set(componentIndex, removeGraphic);
|
|
23
|
+
}
|
|
24
|
+
updateCustomCell(componentIndex, isHeaderCustomLayout) {
|
|
25
|
+
const table = this.table, col = componentIndex;
|
|
26
|
+
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);
|
|
27
|
+
table.scenegraph.renderSceneGraph();
|
|
28
|
+
}
|
|
29
|
+
getCustomLayoutFunc(col, row) {
|
|
30
|
+
const {startInTotal: startInTotal} = this.table.getBodyColumnDefine(col, row);
|
|
31
|
+
return (this.table.isHeader(col, row) ? this.headerCustomLayoutFuncCache.get(startInTotal) : this.customLayoutFuncCache.get(startInTotal)) || emptyCustomLayout;
|
|
32
|
+
}
|
|
33
|
+
removeCustomCell(col, row) {
|
|
34
|
+
const {startInTotal: startInTotal} = this.table.getBodyColumnDefine(col, row), removeFun = this.table.isHeader(col, row) ? this.headerReactRemoveGraphicCache.get(startInTotal) : this.reactRemoveGraphicCache.get(startInTotal);
|
|
35
|
+
removeFun && removeFun(col, row);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=react-custom-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/react/react-custom-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAIxC,MAAM,UAAU,iBAAiB,CAAC,IAA6B;IAC7D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,iBAAiB;IAO5B,YAAY,KAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QAEvC,IAAI,CAAC,uBAAuB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,IAAI,CAAC,2BAA2B,GAAG,IAAI,GAAG,EAAE,CAAC;QAE7C,IAAI,CAAC,6BAA6B,GAAG,IAAI,GAAG,EAAE,CAAC;IACjD,CAAC;IAED,qBAAqB,CAAC,cAAsB,EAAE,oBAA8B;QAC1E,IAAI,oBAAoB,EAAE;YACxB,OAAO,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;SAC7D;QACD,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACxD,CAAC;IAED,qBAAqB,CACnB,cAAsB,EACtB,aAA+B,EAE/B,oBAA8B;QAE9B,IAAI,oBAAoB,EAAE;YACxB,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;SACrE;aAAM;YACL,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;SAC/D;IAEH,CAAC;IAED,qBAAqB,CACnB,cAAsB,EACtB,aAAiD,EACjD,oBAA8B;QAE9B,IAAI,oBAAoB,EAAE;YACxB,IAAI,CAAC,6BAA6B,CAAC,GAAG,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;SACvE;aAAM;YACL,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;SACjE;IACH,CAAC;IAED,gBAAgB,CAAC,cAAsB,EAAE,oBAA8B;QACrE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,GAAG,GAAG,cAAc,CAAC;QAE3B,IAAI,oBAAoB,EAAE;YACxB,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,sBAAsB,EAAE,GAAG,EAAE,EAAE;gBAC3D,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;aAC9C;SACF;aAAM;YACL,KAAK,IAAI,GAAG,GAAG,KAAK,CAAC,sBAAsB,EAAE,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;gBACxE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;aAC9C;SACF;QAED,KAAK,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;IACtC,CAAC;IAED,mBAAmB,CAAC,GAAW,EAAE,GAAW;QAC1C,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAQ,CAAC;QACzE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/C,OAAO,CACL,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC9G,iBAAiB,CAClB,CAAC;IACJ,CAAC;IAED,gBAAgB,CAAC,GAAW,EAAE,GAAW;QACvC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAQ,CAAC;QACzE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/C,MAAM,SAAS,GAAG,QAAQ;YACxB,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,GAAG,CAAC,YAAY,CAAC;YACtD,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACnD,IAAI,SAAS,EAAE;YACb,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SACrB;IACH,CAAC;CACF","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/es/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;
|
|
@@ -416,4 +418,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
416
418
|
get leftRowSeriesNumberCount(): number;
|
|
417
419
|
setMinMaxLimitWidth(setWidth?: boolean): void;
|
|
418
420
|
setSortedIndexMap(field: FieldDef, filedMap: ISortedMapItem): void;
|
|
421
|
+
checkReactCustomLayout(): void;
|
|
422
|
+
get bodyDomContainer(): HTMLElement;
|
|
423
|
+
get headerDomContainer(): HTMLElement;
|
|
419
424
|
}
|
package/es/core/BaseTable.js
CHANGED
|
@@ -70,6 +70,8 @@ import { CustomCellStylePlugin, mergeStyle } from "../plugins/custom-cell-style"
|
|
|
70
70
|
|
|
71
71
|
import { hideCellSelectBorder, restoreCellSelectBorder } from "../scenegraph/select/update-select-border";
|
|
72
72
|
|
|
73
|
+
import { ReactCustomLayout } from "../components/react/react-custom-layout";
|
|
74
|
+
|
|
73
75
|
import { hasAutoImageColumn } from "../layout/layout-helper";
|
|
74
76
|
|
|
75
77
|
const {toBoxArray: toBoxArray} = utilStyle, {isTouchEvent: isTouchEvent} = event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
@@ -83,8 +85,8 @@ export class BaseTable extends EventTarget {
|
|
|
83
85
|
return TABLE_EVENT_TYPE;
|
|
84
86
|
}
|
|
85
87
|
constructor(container, options = {}) {
|
|
86
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
87
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.3.
|
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
89
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.3.3-alpha.0", this.id = `VTable${Date.now()}`,
|
|
88
90
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
89
91
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
90
92
|
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 = defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
@@ -106,8 +108,12 @@ export class BaseTable extends EventTarget {
|
|
|
106
108
|
if (void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
107
109
|
"node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
|
|
108
110
|
internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"),
|
|
109
|
-
internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d")
|
|
110
|
-
|
|
111
|
+
internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d"),
|
|
112
|
+
(null === (_b = options.customConfig) || void 0 === _b ? void 0 : _b.createReactContainer) && (internalProps.bodyDomContainer = document.createElement("div"),
|
|
113
|
+
internalProps.bodyDomContainer.classList.add("table-component-container"), internalProps.element.appendChild(internalProps.bodyDomContainer),
|
|
114
|
+
internalProps.headerDomContainer = document.createElement("div"), internalProps.headerDomContainer.classList.add("table-component-container"),
|
|
115
|
+
internalProps.element.appendChild(internalProps.headerDomContainer))), internalProps.handler = new EventHandler,
|
|
116
|
+
isNumber(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
|
|
111
117
|
internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount,
|
|
112
118
|
internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
|
|
113
119
|
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
|
|
@@ -125,15 +131,15 @@ export class BaseTable extends EventTarget {
|
|
|
125
131
|
var _a;
|
|
126
132
|
return "node" === Env.mode ? canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
|
|
127
133
|
}
|
|
128
|
-
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (
|
|
134
|
+
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_c = options.theme) && void 0 !== _c ? _c : themes.DEFAULT),
|
|
129
135
|
internalProps.theme.isPivot = this.isPivotTable(), container ? (clearDOM && (container.innerHTML = ""),
|
|
130
136
|
container.appendChild(internalProps.element), this._updateSize()) : this._updateSize(),
|
|
131
|
-
this.options = options, internalProps.theme = themes.of(null !== (
|
|
137
|
+
this.options = options, internalProps.theme = themes.of(null !== (_d = options.theme) && void 0 !== _d ? _d : themes.DEFAULT),
|
|
132
138
|
internalProps.theme.isPivot = this.isPivotTable(), internalProps.bodyHelper = new BodyHelper(this),
|
|
133
139
|
internalProps.headerHelper = new HeaderHelper(this), internalProps.rowSeriesNumberHelper = new RowSeriesNumberHelper(this),
|
|
134
140
|
internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak,
|
|
135
|
-
internalProps.allowFrozenColCount = null !== (
|
|
136
|
-
internalProps.limitMaxAutoWidth = null !== (
|
|
141
|
+
internalProps.allowFrozenColCount = null !== (_e = options.allowFrozenColCount) && void 0 !== _e ? _e : 0,
|
|
142
|
+
internalProps.limitMaxAutoWidth = null !== (_f = options.limitMaxAutoWidth) && void 0 !== _f ? _f : 450,
|
|
137
143
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
138
144
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
139
145
|
this._vDataSet = new DataSet, this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this),
|
|
@@ -155,13 +161,13 @@ export class BaseTable extends EventTarget {
|
|
|
155
161
|
}, options.tooltip), "html" === internalProps.tooltip.renderMode && (internalProps.tooltipHandler = new TooltipHandler(this, internalProps.tooltip.confine)),
|
|
156
162
|
internalProps.menu = Object.assign({
|
|
157
163
|
renderMode: "html"
|
|
158
|
-
}, options.menu), Array.isArray(null === (
|
|
159
|
-
Array.isArray(null === (
|
|
164
|
+
}, 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),
|
|
165
|
+
Array.isArray(null === (_j = options.menu) || void 0 === _j ? void 0 : _j.defaultHeaderMenuItems) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
|
|
160
166
|
"html" === internalProps.menu.renderMode && (internalProps.menuHandler = new MenuHandler(this)),
|
|
161
167
|
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.bodyBottomStyleCache = new Map,
|
|
162
168
|
internalProps.stick = {
|
|
163
169
|
changedCells: new Map
|
|
164
|
-
}, internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (
|
|
170
|
+
}, 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 : []);
|
|
165
171
|
}
|
|
166
172
|
getContainer() {
|
|
167
173
|
return this.container;
|
|
@@ -193,8 +199,8 @@ export class BaseTable extends EventTarget {
|
|
|
193
199
|
this.internalProps.colCount = colCount;
|
|
194
200
|
}
|
|
195
201
|
get frozenColCount() {
|
|
196
|
-
var _a, _b, _c;
|
|
197
|
-
return null !== (
|
|
202
|
+
var _a, _b, _c, _d, _e;
|
|
203
|
+
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;
|
|
198
204
|
}
|
|
199
205
|
set frozenColCount(frozenColCount) {
|
|
200
206
|
frozenColCount >= this.colCount && (frozenColCount = 0), this.internalProps.frozenColCount = frozenColCount,
|
|
@@ -213,22 +219,22 @@ export class BaseTable extends EventTarget {
|
|
|
213
219
|
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));
|
|
214
220
|
}
|
|
215
221
|
get frozenRowCount() {
|
|
216
|
-
var _a, _b, _c;
|
|
217
|
-
return null !== (
|
|
222
|
+
var _a, _b, _c, _d, _e;
|
|
223
|
+
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;
|
|
218
224
|
}
|
|
219
225
|
set frozenRowCount(frozenRowCount) {
|
|
220
226
|
this.internalProps.frozenRowCount = frozenRowCount;
|
|
221
227
|
}
|
|
222
228
|
get rightFrozenColCount() {
|
|
223
|
-
var _a, _b, _c;
|
|
224
|
-
return null !== (
|
|
229
|
+
var _a, _b, _c, _d, _e;
|
|
230
|
+
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;
|
|
225
231
|
}
|
|
226
232
|
set rightFrozenColCount(rightFrozenColCount) {
|
|
227
233
|
this.scenegraph.dealWidthRightFrozen(rightFrozenColCount);
|
|
228
234
|
}
|
|
229
235
|
get bottomFrozenRowCount() {
|
|
230
|
-
var _a, _b, _c;
|
|
231
|
-
return null !== (
|
|
236
|
+
var _a, _b, _c, _d, _e;
|
|
237
|
+
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;
|
|
232
238
|
}
|
|
233
239
|
set bottomFrozenRowCount(bottomFrozenRowCount) {
|
|
234
240
|
this.scenegraph.dealWidthBottomFrozen(bottomFrozenRowCount);
|
|
@@ -391,7 +397,9 @@ export class BaseTable extends EventTarget {
|
|
|
391
397
|
heightP = null !== (_d = null === (_c = canvas.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0,
|
|
392
398
|
(null === (_e = null == this ? void 0 : this.scenegraph) || void 0 === _e ? void 0 : _e.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
393
399
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
394
|
-
canvas.style.height = `${heightP}px`)
|
|
400
|
+
canvas.style.height = `${heightP}px`), this.internalProps.bodyDomContainer && (this.internalProps.bodyDomContainer.style.width = `${widthP}px`,
|
|
401
|
+
this.internalProps.bodyDomContainer.style.height = `${heightP}px`), this.internalProps.headerDomContainer && (this.internalProps.headerDomContainer.style.width = `${widthP}px`,
|
|
402
|
+
this.internalProps.headerDomContainer.style.height = `${heightP}px`);
|
|
395
403
|
} else "node" === Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
396
404
|
const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
|
|
397
405
|
if (null === (_f = this.internalProps.theme) || void 0 === _f ? void 0 : _f.frameStyle) {
|
|
@@ -1873,5 +1881,14 @@ export class BaseTable extends EventTarget {
|
|
|
1873
1881
|
var _a;
|
|
1874
1882
|
null === (_a = this.dataSource) || void 0 === _a || _a.setSortedIndexMap(field, filedMap);
|
|
1875
1883
|
}
|
|
1884
|
+
checkReactCustomLayout() {
|
|
1885
|
+
this.reactCustomLayout || (this.reactCustomLayout = new ReactCustomLayout(this));
|
|
1886
|
+
}
|
|
1887
|
+
get bodyDomContainer() {
|
|
1888
|
+
return this.internalProps.bodyDomContainer;
|
|
1889
|
+
}
|
|
1890
|
+
get headerDomContainer() {
|
|
1891
|
+
return this.internalProps.headerDomContainer;
|
|
1892
|
+
}
|
|
1876
1893
|
}
|
|
1877
1894
|
//# sourceMappingURL=BaseTable.js.map
|