@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.
Files changed (95) hide show
  1. package/cjs/ListTable.js +7 -6
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/components/react/react-custom-layout.d.ts +21 -0
  4. package/cjs/components/react/react-custom-layout.js +48 -0
  5. package/cjs/components/react/react-custom-layout.js.map +1 -0
  6. package/cjs/core/BaseTable.d.ts +5 -0
  7. package/cjs/core/BaseTable.js +34 -20
  8. package/cjs/core/BaseTable.js.map +1 -1
  9. package/cjs/core/style.js +1 -1
  10. package/cjs/core/style.js.map +1 -1
  11. package/cjs/event/media-click.js +2 -1
  12. package/cjs/event/sparkline-event.js +1 -2
  13. package/cjs/index.d.ts +3 -1
  14. package/cjs/index.js +14 -5
  15. package/cjs/index.js.map +1 -1
  16. package/cjs/scenegraph/component/custom.js +6 -4
  17. package/cjs/scenegraph/component/custom.js.map +1 -1
  18. package/cjs/scenegraph/group-creater/cell-helper.js +4 -0
  19. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  20. package/cjs/scenegraph/layout/compute-col-width.js +1 -1
  21. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  22. package/cjs/scenegraph/layout/compute-row-height.js +1 -1
  23. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  24. package/cjs/scenegraph/scenegraph.d.ts +1 -0
  25. package/cjs/scenegraph/scenegraph.js +11 -2
  26. package/cjs/scenegraph/scenegraph.js.map +1 -1
  27. package/cjs/state/state.js +1 -1
  28. package/cjs/themes/ARCO.js +1 -1
  29. package/cjs/themes/BRIGHT.js +1 -1
  30. package/cjs/themes/DARK.js +1 -1
  31. package/cjs/themes/DEFAULT.js +1 -1
  32. package/cjs/themes/SIMPLIFY.js +1 -1
  33. package/cjs/themes/component.js +1 -1
  34. package/cjs/tools/LimitPromiseQueue.js +1 -1
  35. package/cjs/tools/NumberMap.js +1 -1
  36. package/cjs/tools/Rect.js +1 -1
  37. package/cjs/tools/calc.js +1 -1
  38. package/cjs/tools/debounce.js +1 -1
  39. package/cjs/tools/diff-cell.js +2 -2
  40. package/cjs/ts-types/base-table.d.ts +8 -0
  41. package/cjs/ts-types/base-table.js.map +1 -1
  42. package/cjs/ts-types/customLayout.d.ts +1 -1
  43. package/cjs/ts-types/customLayout.js.map +1 -1
  44. package/cjs/vrender.d.ts +4 -0
  45. package/cjs/vrender.js +39 -11
  46. package/cjs/vrender.js.map +1 -1
  47. package/dist/vtable.js +24722 -9322
  48. package/dist/vtable.min.js +2 -2
  49. package/es/ListTable.js +3 -3
  50. package/es/ListTable.js.map +1 -1
  51. package/es/components/react/react-custom-layout.d.ts +21 -0
  52. package/es/components/react/react-custom-layout.js +38 -0
  53. package/es/components/react/react-custom-layout.js.map +1 -0
  54. package/es/core/BaseTable.d.ts +5 -0
  55. package/es/core/BaseTable.js +37 -20
  56. package/es/core/BaseTable.js.map +1 -1
  57. package/es/core/style.js +1 -1
  58. package/es/core/style.js.map +1 -1
  59. package/es/event/media-click.js +2 -1
  60. package/es/event/sparkline-event.js +1 -2
  61. package/es/index.d.ts +3 -1
  62. package/es/index.js +5 -1
  63. package/es/index.js.map +1 -1
  64. package/es/scenegraph/component/custom.js +7 -3
  65. package/es/scenegraph/component/custom.js.map +1 -1
  66. package/es/scenegraph/group-creater/cell-helper.js +4 -0
  67. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  68. package/es/scenegraph/layout/compute-col-width.js +2 -2
  69. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  70. package/es/scenegraph/layout/compute-row-height.js +2 -2
  71. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  72. package/es/scenegraph/scenegraph.d.ts +1 -0
  73. package/es/scenegraph/scenegraph.js +11 -2
  74. package/es/scenegraph/scenegraph.js.map +1 -1
  75. package/es/state/state.js +1 -1
  76. package/es/themes/ARCO.js +1 -1
  77. package/es/themes/BRIGHT.js +1 -1
  78. package/es/themes/DARK.js +1 -1
  79. package/es/themes/DEFAULT.js +1 -1
  80. package/es/themes/SIMPLIFY.js +1 -1
  81. package/es/themes/component.js +1 -1
  82. package/es/tools/LimitPromiseQueue.js +1 -1
  83. package/es/tools/NumberMap.js +1 -1
  84. package/es/tools/Rect.js +1 -1
  85. package/es/tools/calc.js +1 -1
  86. package/es/tools/debounce.js +1 -1
  87. package/es/tools/diff-cell.js +1 -1
  88. package/es/ts-types/base-table.d.ts +8 -0
  89. package/es/ts-types/base-table.js.map +1 -1
  90. package/es/ts-types/customLayout.d.ts +1 -1
  91. package/es/ts-types/customLayout.js.map +1 -1
  92. package/es/vrender.d.ts +4 -0
  93. package/es/vrender.js +9 -3
  94. package/es/vrender.js.map +1 -1
  95. 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,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"]}
@@ -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
  }
@@ -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.3.2", this.id = `VTable${Date.now()}`,
47
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
48
+ if (super(), this.showFrozenIcon = !0, this.version = "1.3.3-alpha.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")), internalProps.handler = new EventHandler_1.EventHandler,
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 !== (_b = options.theme) && void 0 !== _b ? _b : themes_1.default.DEFAULT),
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 !== (_c = options.theme) && void 0 !== _c ? _c : themes_1.default.DEFAULT),
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 !== (_d = options.allowFrozenColCount) && void 0 !== _d ? _d : 0,
99
- internalProps.limitMaxAutoWidth = null !== (_e = options.limitMaxAutoWidth) && void 0 !== _e ? _e : 450,
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 === (_f = options.menu) || void 0 === _f ? void 0 : _f.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_g = options.menu) || void 0 === _g ? void 0 : _g.dropDownMenuHighlight),
124
- Array.isArray(null === (_h = options.menu) || void 0 === _h ? void 0 : _h.defaultHeaderMenuItems) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
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 !== (_j = options.customCellStyle) && void 0 !== _j ? _j : [], null !== (_k = options.customCellStyleArrangement) && void 0 !== _k ? _k : []);
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 !== (_c = null !== (_b = null === (_a = this.internalProps.layoutMap) || void 0 === _a ? void 0 : _a.frozenColCount) && void 0 !== _b ? _b : this.internalProps.frozenColCount) && void 0 !== _c ? _c : 0;
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 !== (_c = null !== (_b = null === (_a = this.internalProps.layoutMap) || void 0 === _a ? void 0 : _a.frozenRowCount) && void 0 !== _b ? _b : this.internalProps.frozenRowCount) && void 0 !== _c ? _c : 0;
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 !== (_c = null !== (_b = null === (_a = this.internalProps.layoutMap) || void 0 === _a ? void 0 : _a.rightFrozenColCount) && void 0 !== _b ? _b : this.internalProps.rightFrozenColCount) && void 0 !== _c ? _c : 0;
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 !== (_c = null !== (_b = null === (_a = this.internalProps.layoutMap) || void 0 === _a ? void 0 : _a.bottomFrozenRowCount) && void 0 !== _b ? _b : this.internalProps.bottomFrozenRowCount) && void 0 !== _c ? _c : 0;
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) {
@@ -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;