@visactor/vtable 1.3.2-alpha.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/PivotChart.d.ts +0 -1
- package/cjs/PivotChart.js +0 -4
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/components/axis/axis.js +2 -3
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/components/empty-tip/empty-tip.js +2 -2
- package/cjs/components/empty-tip/empty-tip.js.map +1 -1
- package/cjs/components/legend/discrete-legend/discrete-legend.js +1 -2
- package/cjs/components/legend/discrete-legend/discrete-legend.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/components/tooltip/TooltipHandler.js +1 -3
- package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElement.js +7 -3
- package/cjs/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +7 -4
- package/cjs/core/BaseTable.js +229 -80
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/FouseInput.d.ts +0 -1
- package/cjs/core/FouseInput.js +2 -5
- package/cjs/core/FouseInput.js.map +1 -1
- package/cjs/core/style.js +1 -1
- package/cjs/core/style.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +2 -0
- package/cjs/dataset/dataset.js +8 -7
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/event/event.js +1 -2
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -1
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +5 -3
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/media-click.js +2 -1
- package/cjs/event/sparkline-event.js +1 -2
- package/cjs/event/util.js +2 -2
- package/cjs/event/util.js.map +1 -1
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +13 -4
- package/cjs/index.js.map +1 -1
- package/cjs/layout/layout-helper.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +57 -37
- 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/debug-tool/debug-tool.js +1 -4
- package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +0 -1
- package/cjs/scenegraph/graphic/chart.js +20 -34
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
- package/cjs/scenegraph/graphic/contributions/chart-render.js +24 -40
- package/cjs/scenegraph/graphic/contributions/chart-render.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/group-creater/cell-type/chart-cell.js +1 -2
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.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/layout/update-width.js +3 -0
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.d.ts +0 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +2 -9
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -0
- package/cjs/scenegraph/scenegraph.js +15 -12
- package/cjs/scenegraph/scenegraph.js.map +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/theme.js +6 -0
- package/cjs/themes/theme.js.map +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 +12 -15
- 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/icon.d.ts +2 -0
- package/cjs/ts-types/icon.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +2 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/ts-types/tooltip.d.ts +2 -0
- package/cjs/ts-types/tooltip.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 +25304 -9898
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +3 -3
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +0 -1
- package/es/PivotChart.js +2 -5
- package/es/PivotChart.js.map +1 -1
- package/es/components/axis/axis.js +1 -3
- package/es/components/axis/axis.js.map +1 -1
- package/es/components/empty-tip/empty-tip.js +2 -2
- package/es/components/empty-tip/empty-tip.js.map +1 -1
- package/es/components/legend/discrete-legend/discrete-legend.js +1 -2
- package/es/components/legend/discrete-legend/discrete-legend.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/components/tooltip/TooltipHandler.js +1 -3
- package/es/components/tooltip/TooltipHandler.js.map +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElement.js +7 -3
- package/es/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
- package/es/core/BaseTable.d.ts +7 -4
- package/es/core/BaseTable.js +232 -82
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/FouseInput.d.ts +0 -1
- package/es/core/FouseInput.js +2 -5
- package/es/core/FouseInput.js.map +1 -1
- package/es/core/style.js +1 -1
- package/es/core/style.js.map +1 -1
- package/es/dataset/dataset.d.ts +2 -0
- package/es/dataset/dataset.js +8 -7
- package/es/dataset/dataset.js.map +1 -1
- package/es/event/event.js +1 -2
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -1
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js +5 -3
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/media-click.js +2 -1
- package/es/event/sparkline-event.js +1 -2
- package/es/event/util.js +2 -2
- package/es/event/util.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/layout-helper.js.map +1 -1
- package/es/layout/pivot-header-layout.js +56 -36
- 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/debug-tool/debug-tool.js +1 -4
- package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +0 -1
- package/es/scenegraph/graphic/chart.js +21 -33
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
- package/es/scenegraph/graphic/contributions/chart-render.js +25 -41
- package/es/scenegraph/graphic/contributions/chart-render.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/group-creater/cell-type/chart-cell.js +1 -2
- package/es/scenegraph/group-creater/cell-type/chart-cell.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/layout/update-width.js +3 -0
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.d.ts +0 -1
- package/es/scenegraph/refresh-node/update-chart.js +0 -6
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -0
- package/es/scenegraph/scenegraph.js +15 -12
- package/es/scenegraph/scenegraph.js.map +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/theme.js +6 -0
- package/es/themes/theme.js.map +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 +12 -15
- 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/icon.d.ts +2 -0
- package/es/ts-types/icon.js.map +1 -1
- package/es/ts-types/theme.d.ts +2 -0
- package/es/ts-types/theme.js.map +1 -1
- package/es/ts-types/tooltip.d.ts +2 -0
- package/es/ts-types/tooltip.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 +6 -5
- package/cjs/core/utils/get-cell-position.d.ts +0 -42
- package/cjs/core/utils/get-cell-position.js +0 -206
- package/cjs/core/utils/get-cell-position.js.map +0 -1
- package/es/core/utils/get-cell-position.d.ts +0 -42
- package/es/core/utils/get-cell-position.js +0 -194
- package/es/core/utils/get-cell-position.js.map +0 -1
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"),
|
|
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,10 +44,10 @@ 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.
|
|
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
|
-
!container && "node" !== options.mode
|
|
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;
|
|
52
52
|
this.container = container, this.options = options, this._widthMode = widthMode,
|
|
53
53
|
this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
|
|
@@ -65,12 +65,13 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
65
65
|
this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal";
|
|
66
66
|
const internalProps = this.internalProps = {};
|
|
67
67
|
if (void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
68
|
-
|
|
69
|
-
internalProps.
|
|
70
|
-
internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== env_1.Env.mode && (internalProps.element = (0,
|
|
71
|
-
tableHelper_1.createRootElement)(this.padding), internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
|
|
68
|
+
"node" !== env_1.Env.mode && (internalProps.element = (0, tableHelper_1.createRootElement)(this.padding),
|
|
69
|
+
internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
|
|
72
70
|
internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas),
|
|
73
|
-
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,
|
|
74
75
|
(0, vutils_1.isNumber)(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
|
|
75
76
|
internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount,
|
|
76
77
|
internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
|
|
@@ -90,15 +91,15 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
90
91
|
var _a;
|
|
91
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);
|
|
92
93
|
}
|
|
93
|
-
}, 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),
|
|
94
95
|
internalProps.theme.isPivot = this.isPivotTable(), container ? (clearDOM && (container.innerHTML = ""),
|
|
95
96
|
container.appendChild(internalProps.element), this._updateSize()) : this._updateSize(),
|
|
96
|
-
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),
|
|
97
98
|
internalProps.theme.isPivot = this.isPivotTable(), internalProps.bodyHelper = new body_helper_1.BodyHelper(this),
|
|
98
99
|
internalProps.headerHelper = new header_helper_1.HeaderHelper(this), internalProps.rowSeriesNumberHelper = new row_series_number_helper_1.RowSeriesNumberHelper(this),
|
|
99
100
|
internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak,
|
|
100
|
-
internalProps.allowFrozenColCount = null !== (
|
|
101
|
-
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,
|
|
102
103
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
103
104
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
104
105
|
this._vDataSet = new vdataset_1.DataSet, this.scenegraph = new scenegraph_1.Scenegraph(this),
|
|
@@ -122,13 +123,13 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
122
123
|
}, options.tooltip), "html" === internalProps.tooltip.renderMode && (internalProps.tooltipHandler = new TooltipHandler_1.TooltipHandler(this, internalProps.tooltip.confine)),
|
|
123
124
|
internalProps.menu = Object.assign({
|
|
124
125
|
renderMode: "html"
|
|
125
|
-
}, options.menu), Array.isArray(null === (
|
|
126
|
-
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),
|
|
127
128
|
"html" === internalProps.menu.renderMode && (internalProps.menuHandler = new MenuHandler_1.MenuHandler(this)),
|
|
128
129
|
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.bodyBottomStyleCache = new Map,
|
|
129
130
|
internalProps.stick = {
|
|
130
131
|
changedCells: new Map
|
|
131
|
-
}, 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 : []);
|
|
132
133
|
}
|
|
133
134
|
getContainer() {
|
|
134
135
|
return this.container;
|
|
@@ -160,8 +161,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
160
161
|
this.internalProps.colCount = colCount;
|
|
161
162
|
}
|
|
162
163
|
get frozenColCount() {
|
|
163
|
-
var _a, _b, _c;
|
|
164
|
-
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;
|
|
165
166
|
}
|
|
166
167
|
set frozenColCount(frozenColCount) {
|
|
167
168
|
frozenColCount >= this.colCount && (frozenColCount = 0), this.internalProps.frozenColCount = frozenColCount,
|
|
@@ -180,22 +181,22 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
180
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));
|
|
181
182
|
}
|
|
182
183
|
get frozenRowCount() {
|
|
183
|
-
var _a, _b, _c;
|
|
184
|
-
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;
|
|
185
186
|
}
|
|
186
187
|
set frozenRowCount(frozenRowCount) {
|
|
187
188
|
this.internalProps.frozenRowCount = frozenRowCount;
|
|
188
189
|
}
|
|
189
190
|
get rightFrozenColCount() {
|
|
190
|
-
var _a, _b, _c;
|
|
191
|
-
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;
|
|
192
193
|
}
|
|
193
194
|
set rightFrozenColCount(rightFrozenColCount) {
|
|
194
195
|
this.scenegraph.dealWidthRightFrozen(rightFrozenColCount);
|
|
195
196
|
}
|
|
196
197
|
get bottomFrozenRowCount() {
|
|
197
|
-
var _a, _b, _c;
|
|
198
|
-
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;
|
|
199
200
|
}
|
|
200
201
|
set bottomFrozenRowCount(bottomFrozenRowCount) {
|
|
201
202
|
this.scenegraph.dealWidthBottomFrozen(bottomFrozenRowCount);
|
|
@@ -339,11 +340,10 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
339
340
|
}
|
|
340
341
|
}
|
|
341
342
|
_updateSize() {
|
|
342
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0
|
|
343
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
343
344
|
const {padding: padding} = this;
|
|
344
345
|
let widthP = 0, heightP = 0;
|
|
345
|
-
if (
|
|
346
|
-
heightP = this.options.viewBox.y2 - this.options.viewBox.y1, (null === (_a = null == this ? void 0 : this.scenegraph) || void 0 === _a ? void 0 : _a.stage) && (this.options.viewBox ? this.scenegraph.stage.setViewBox(this.options.viewBox, !1) : this.scenegraph.stage.resize(widthP, heightP)); else if ("browser" === env_1.Env.mode) {
|
|
346
|
+
if ("browser" === env_1.Env.mode) {
|
|
347
347
|
const element = this.getElement();
|
|
348
348
|
let widthWithoutPadding = 0, heightWithoutPadding = 0;
|
|
349
349
|
if (element.parentElement) {
|
|
@@ -355,31 +355,25 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
355
355
|
element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px",
|
|
356
356
|
element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
|
|
357
357
|
const {canvas: canvas} = this.internalProps;
|
|
358
|
-
widthP = null !== (
|
|
359
|
-
heightP = null !== (
|
|
360
|
-
(null === (
|
|
358
|
+
widthP = null !== (_b = null === (_a = canvas.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 0,
|
|
359
|
+
heightP = null !== (_d = null === (_c = canvas.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0,
|
|
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 = "",
|
|
361
361
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
362
|
-
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`);
|
|
363
365
|
} else "node" === env_1.Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
364
366
|
const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
|
|
365
|
-
if (null === (
|
|
366
|
-
const lineWidths = toBoxArray(null !== (
|
|
367
|
-
(null === (
|
|
368
|
-
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (
|
|
369
|
-
this.tableNoFrameHeight = height - (null !== (
|
|
370
|
-
this.tableY = (null !== (
|
|
371
|
-
this.tableNoFrameWidth = width - ((null !== (
|
|
372
|
-
this.tableNoFrameHeight = height - ((null !== (
|
|
367
|
+
if (null === (_f = this.internalProps.theme) || void 0 === _f ? void 0 : _f.frameStyle) {
|
|
368
|
+
const lineWidths = toBoxArray(null !== (_h = null === (_g = this.internalProps.theme.frameStyle) || void 0 === _g ? void 0 : _g.borderLineWidth) && void 0 !== _h ? _h : [ null ]), shadowWidths = toBoxArray(null !== (_k = null === (_j = this.internalProps.theme.frameStyle) || void 0 === _j ? void 0 : _j.shadowBlur) && void 0 !== _k ? _k : [ 0 ]);
|
|
369
|
+
(null === (_l = this.theme.frameStyle) || void 0 === _l ? void 0 : _l.innerBorder) ? (this.tableX = 0,
|
|
370
|
+
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_m = shadowWidths[1]) && void 0 !== _m ? _m : 0),
|
|
371
|
+
this.tableNoFrameHeight = height - (null !== (_o = shadowWidths[2]) && void 0 !== _o ? _o : 0)) : (this.tableX = (null !== (_p = lineWidths[3]) && void 0 !== _p ? _p : 0) + (null !== (_q = shadowWidths[3]) && void 0 !== _q ? _q : 0),
|
|
372
|
+
this.tableY = (null !== (_r = lineWidths[0]) && void 0 !== _r ? _r : 0) + (null !== (_s = shadowWidths[0]) && void 0 !== _s ? _s : 0),
|
|
373
|
+
this.tableNoFrameWidth = width - ((null !== (_t = lineWidths[1]) && void 0 !== _t ? _t : 0) + (null !== (_u = shadowWidths[1]) && void 0 !== _u ? _u : 0)) - ((null !== (_v = lineWidths[3]) && void 0 !== _v ? _v : 0) + (null !== (_w = shadowWidths[3]) && void 0 !== _w ? _w : 0)),
|
|
374
|
+
this.tableNoFrameHeight = height - ((null !== (_x = lineWidths[0]) && void 0 !== _x ? _x : 0) + (null !== (_y = shadowWidths[0]) && void 0 !== _y ? _y : 0)) - ((null !== (_z = lineWidths[2]) && void 0 !== _z ? _z : 0) + (null !== (_0 = shadowWidths[2]) && void 0 !== _0 ? _0 : 0)));
|
|
373
375
|
}
|
|
374
376
|
}
|
|
375
|
-
updateViewBox(newViewBox) {
|
|
376
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
377
|
-
const oldWidth = null !== (_d = null !== (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.viewBox.x2) && void 0 !== _b ? _b : 0 - (null === (_c = this.options) || void 0 === _c ? void 0 : _c.viewBox.x1)) && void 0 !== _d ? _d : 0, oldHeight = null !== (_h = null !== (_f = null === (_e = this.options) || void 0 === _e ? void 0 : _e.viewBox.y2) && void 0 !== _f ? _f : 0 - (null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox.y1)) && void 0 !== _h ? _h : 0, newWidth = newViewBox.x2 - newViewBox.x1, newHeight = newViewBox.y2 - newViewBox.y1;
|
|
378
|
-
this.options.viewBox = newViewBox, oldWidth !== newWidth || oldHeight !== newHeight ? this.resize() : this.scenegraph.stage.setViewBox(this.options.viewBox, !0);
|
|
379
|
-
}
|
|
380
|
-
setViewBoxTransform(a, b, c, d, e, f) {
|
|
381
|
-
this.internalProps.modifiedViewBoxTransform = !0, this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
|
|
382
|
-
}
|
|
383
377
|
get rowHierarchyType() {
|
|
384
378
|
return "grid";
|
|
385
379
|
}
|
|
@@ -612,16 +606,41 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
612
606
|
} : null;
|
|
613
607
|
}
|
|
614
608
|
getRowAt(absoluteY) {
|
|
615
|
-
|
|
609
|
+
const frozen = (0, tableHelper_1._getTargetFrozenRowAt)(this, absoluteY);
|
|
610
|
+
if (frozen) return frozen;
|
|
611
|
+
let row = this.getTargetRowAt(absoluteY);
|
|
612
|
+
return row || (row = {
|
|
613
|
+
top: -1,
|
|
614
|
+
row: -1,
|
|
615
|
+
bottom: -1,
|
|
616
|
+
height: -1
|
|
617
|
+
}), row;
|
|
616
618
|
}
|
|
617
619
|
getColAt(absoluteX) {
|
|
618
|
-
|
|
620
|
+
const frozen = (0, tableHelper_1._getTargetFrozenColAt)(this, absoluteX);
|
|
621
|
+
if (frozen) return frozen;
|
|
622
|
+
let col = this.getTargetColAt(absoluteX);
|
|
623
|
+
return col || (col = {
|
|
624
|
+
left: -1,
|
|
625
|
+
col: -1,
|
|
626
|
+
right: -1,
|
|
627
|
+
width: 1
|
|
628
|
+
}), col;
|
|
619
629
|
}
|
|
620
630
|
getCellAt(absoluteX, absoluteY) {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
631
|
+
const rowInfo = this.getRowAt(absoluteY), {row: row, top: top, bottom: bottom, height: height} = rowInfo, colInfo = this.getColAt(absoluteX), {col: col, left: left, right: right, width: width} = colInfo;
|
|
632
|
+
return {
|
|
633
|
+
row: row,
|
|
634
|
+
col: col,
|
|
635
|
+
rect: {
|
|
636
|
+
left: left,
|
|
637
|
+
right: right,
|
|
638
|
+
top: top,
|
|
639
|
+
bottom: bottom,
|
|
640
|
+
width: width,
|
|
641
|
+
height: height
|
|
642
|
+
}
|
|
643
|
+
};
|
|
625
644
|
}
|
|
626
645
|
_checkRowCol(col, row) {
|
|
627
646
|
return col >= 0 && col < this.colCount && row >= 0 && row < this.rowCount;
|
|
@@ -647,11 +666,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
647
666
|
}));
|
|
648
667
|
}
|
|
649
668
|
_toRelativeRect(absoluteRect, relativeX = !0, relativeY = !0) {
|
|
650
|
-
var _a, _b, _c, _d;
|
|
651
669
|
const rect = absoluteRect.copy(), visibleRect = this.getVisibleRect();
|
|
652
670
|
return rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0)), rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0)),
|
|
653
|
-
rect.offsetLeft(null !== (_b = null === (_a = this.options.viewBox) || void 0 === _a ? void 0 : _a.x1) && void 0 !== _b ? _b : 0),
|
|
654
|
-
rect.offsetTop(null !== (_d = null === (_c = this.options.viewBox) || void 0 === _c ? void 0 : _c.y1) && void 0 !== _d ? _d : 0),
|
|
655
671
|
rect;
|
|
656
672
|
}
|
|
657
673
|
getVisibleRect() {
|
|
@@ -756,11 +772,9 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
756
772
|
internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
|
|
757
773
|
var _a;
|
|
758
774
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
759
|
-
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release()
|
|
760
|
-
internalProps.focusControl.release();
|
|
775
|
+
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
761
776
|
const {parentElement: parentElement} = internalProps.element;
|
|
762
|
-
parentElement &&
|
|
763
|
-
null === (_q = null === (_p = null === (_o = this.editorManager) || void 0 === _o ? void 0 : _o.editingEditor) || void 0 === _p ? void 0 : _p.onEnd) || void 0 === _q || _q.call(_p),
|
|
777
|
+
parentElement && parentElement.removeChild(internalProps.element), null === (_q = null === (_p = null === (_o = this.editorManager) || void 0 === _o ? void 0 : _o.editingEditor) || void 0 === _p ? void 0 : _p.onEnd) || void 0 === _q || _q.call(_p),
|
|
764
778
|
this.isReleased = !0, this.scenegraph = null, this.internalProps = null;
|
|
765
779
|
}
|
|
766
780
|
fireListeners(type, event) {
|
|
@@ -870,7 +884,6 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
870
884
|
return new Rect_1.Rect(this.tableX, this.tableY, width, height);
|
|
871
885
|
}
|
|
872
886
|
_getMouseAbstractPoint(evt, isAddScroll = !0) {
|
|
873
|
-
var _a, _b, _c, _d;
|
|
874
887
|
let e;
|
|
875
888
|
if (!evt) return {
|
|
876
889
|
inTable: !1,
|
|
@@ -881,30 +894,138 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
881
894
|
const clientX = e.clientX || e.pageX + window.scrollX, clientY = e.clientY || e.pageY + window.scrollY, rect = this.internalProps.canvas.getBoundingClientRect();
|
|
882
895
|
let inTable = !0;
|
|
883
896
|
rect.right <= clientX && (inTable = !1), rect.bottom <= clientY && (inTable = !1);
|
|
884
|
-
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight)
|
|
885
|
-
|
|
886
|
-
|
|
897
|
+
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight);
|
|
898
|
+
return {
|
|
899
|
+
x: (clientX - rect.left) / widthRatio + (isAddScroll ? this.scrollLeft : 0),
|
|
900
|
+
y: (clientY - rect.top) / heightRatio + (isAddScroll ? this.scrollTop : 0),
|
|
887
901
|
inTable: inTable
|
|
888
902
|
};
|
|
889
|
-
if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
|
|
890
|
-
this.scenegraph.stage.window.getViewBoxTransform().transformPoint(point, point);
|
|
891
|
-
}
|
|
892
|
-
return point;
|
|
893
903
|
}
|
|
894
904
|
getTheme() {
|
|
895
905
|
return this.internalProps.theme;
|
|
896
906
|
}
|
|
897
907
|
getTargetColAt(absoluteX) {
|
|
898
|
-
|
|
908
|
+
if (0 === absoluteX) return {
|
|
909
|
+
left: 0,
|
|
910
|
+
col: 0,
|
|
911
|
+
right: 0,
|
|
912
|
+
width: 0
|
|
913
|
+
};
|
|
914
|
+
const findAfter = (startCol, startRight) => {
|
|
915
|
+
let left = startRight - this.getColWidth(startCol);
|
|
916
|
+
const {colCount: colCount} = this.internalProps;
|
|
917
|
+
for (let col = startCol; col < colCount; col++) {
|
|
918
|
+
const width = this.getColWidth(col), right = left + width;
|
|
919
|
+
if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) return {
|
|
920
|
+
left: left,
|
|
921
|
+
col: col,
|
|
922
|
+
right: right,
|
|
923
|
+
width: width
|
|
924
|
+
};
|
|
925
|
+
left = right;
|
|
926
|
+
}
|
|
927
|
+
return null;
|
|
928
|
+
}, candCol = this.computeTargetColByX(absoluteX), right = this.getColsWidth(0, candCol);
|
|
929
|
+
return absoluteX >= right ? findAfter(candCol, right) : ((startCol, startRight) => {
|
|
930
|
+
let right = startRight;
|
|
931
|
+
for (let col = startCol; col >= 0; col--) {
|
|
932
|
+
const width = this.getColWidth(col), left = right - width;
|
|
933
|
+
if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) return {
|
|
934
|
+
left: left,
|
|
935
|
+
col: col,
|
|
936
|
+
right: right,
|
|
937
|
+
width: width
|
|
938
|
+
};
|
|
939
|
+
right = left;
|
|
940
|
+
}
|
|
941
|
+
return null;
|
|
942
|
+
})(candCol, right);
|
|
899
943
|
}
|
|
900
944
|
getTargetRowAt(absoluteY) {
|
|
901
|
-
|
|
945
|
+
if (0 === absoluteY) return {
|
|
946
|
+
top: 0,
|
|
947
|
+
row: 0,
|
|
948
|
+
bottom: 0,
|
|
949
|
+
height: 0
|
|
950
|
+
};
|
|
951
|
+
const findAfter = (startRow, startBottom) => {
|
|
952
|
+
let top = startBottom - this.getRowHeight(startRow);
|
|
953
|
+
const {rowCount: rowCount} = this.internalProps;
|
|
954
|
+
for (let row = startRow; row < rowCount; row++) {
|
|
955
|
+
const height = this.getRowHeight(row), bottom = top + height;
|
|
956
|
+
if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) return {
|
|
957
|
+
top: top,
|
|
958
|
+
row: row,
|
|
959
|
+
bottom: bottom,
|
|
960
|
+
height: height
|
|
961
|
+
};
|
|
962
|
+
top = bottom;
|
|
963
|
+
}
|
|
964
|
+
return null;
|
|
965
|
+
}, candRow = this.computeTargetRowByY(absoluteY), bottom = this.getRowsHeight(0, candRow);
|
|
966
|
+
return absoluteY >= bottom ? findAfter(candRow, bottom) : ((startRow, startBottom) => {
|
|
967
|
+
let bottom = startBottom;
|
|
968
|
+
for (let row = startRow; row >= 0; row--) {
|
|
969
|
+
const height = this.getRowHeight(row), top = bottom - height;
|
|
970
|
+
if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) return {
|
|
971
|
+
top: top,
|
|
972
|
+
row: row,
|
|
973
|
+
bottom: bottom,
|
|
974
|
+
height: height
|
|
975
|
+
};
|
|
976
|
+
bottom = top;
|
|
977
|
+
}
|
|
978
|
+
return null;
|
|
979
|
+
})(candRow, bottom);
|
|
902
980
|
}
|
|
903
981
|
getTargetColAtConsiderRightFrozen(absoluteX, isConsider) {
|
|
904
|
-
|
|
982
|
+
if (0 === absoluteX) return {
|
|
983
|
+
left: 0,
|
|
984
|
+
col: 0,
|
|
985
|
+
right: 0,
|
|
986
|
+
width: 0
|
|
987
|
+
};
|
|
988
|
+
if (isConsider && absoluteX > this.tableNoFrameWidth - this.getRightFrozenColsWidth() && absoluteX < this.tableNoFrameWidth) for (let i = 0; i < this.rightFrozenColCount; i++) if (absoluteX > this.tableNoFrameWidth - this.getColsWidth(this.colCount - i - 1, this.colCount - 1)) return {
|
|
989
|
+
col: this.colCount - i - 1,
|
|
990
|
+
left: void 0,
|
|
991
|
+
right: void 0,
|
|
992
|
+
width: void 0
|
|
993
|
+
};
|
|
994
|
+
return this.getTargetColAt(absoluteX);
|
|
905
995
|
}
|
|
906
996
|
getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider) {
|
|
907
|
-
|
|
997
|
+
if (0 === absoluteY) return {
|
|
998
|
+
top: 0,
|
|
999
|
+
row: 0,
|
|
1000
|
+
bottom: 0,
|
|
1001
|
+
height: 0
|
|
1002
|
+
};
|
|
1003
|
+
if (isConsider && absoluteY > this.tableNoFrameHeight - this.getBottomFrozenRowsHeight() && absoluteY < this.tableNoFrameHeight) for (let i = 0; i < this.rightFrozenColCount; i++) if (absoluteY > this.tableNoFrameHeight - this.getRowsHeight(this.rowCount - i - 1, this.rowCount - 1)) return {
|
|
1004
|
+
row: this.rowCount - i - 1,
|
|
1005
|
+
top: void 0,
|
|
1006
|
+
bottom: void 0,
|
|
1007
|
+
height: void 0
|
|
1008
|
+
};
|
|
1009
|
+
return this.getTargetRowAt(absoluteY);
|
|
1010
|
+
}
|
|
1011
|
+
computeTargetRowByY(absoluteY) {
|
|
1012
|
+
let defaultRowHeight = this.internalProps.defaultRowHeight;
|
|
1013
|
+
return this._rowRangeHeightsMap.get("$0$" + (this.rowCount - 1)) && (defaultRowHeight = this._rowRangeHeightsMap.get("$0$" + (this.rowCount - 1)) / this.rowCount),
|
|
1014
|
+
Math.min(Math.ceil(absoluteY / defaultRowHeight), this.rowCount - 1);
|
|
1015
|
+
}
|
|
1016
|
+
computeTargetColByX(absoluteX) {
|
|
1017
|
+
if (this._colRangeWidthsMap.get("$0$" + (this.colCount - 1))) {
|
|
1018
|
+
let startCol = 0, endCol = this.colCount - 1;
|
|
1019
|
+
for (;endCol - startCol > 1; ) {
|
|
1020
|
+
const midCol = Math.floor((startCol + endCol) / 2);
|
|
1021
|
+
if (absoluteX < this._colRangeWidthsMap.get(`$0$${midCol}`)) endCol = midCol; else {
|
|
1022
|
+
if (!(absoluteX > this._colRangeWidthsMap.get(`$0$${midCol}`))) return midCol;
|
|
1023
|
+
startCol = midCol;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
return endCol;
|
|
1027
|
+
}
|
|
1028
|
+
return Math.min(Math.ceil(absoluteX / this.internalProps.defaultColWidth), this.colCount - 1);
|
|
908
1029
|
}
|
|
909
1030
|
clearSelected() {
|
|
910
1031
|
this.stateManager.updateSelectPos(-1, -1);
|
|
@@ -1528,30 +1649,49 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1528
1649
|
return "chart" === (null === (_f = null === (_e = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _e ? void 0 : _e[0]) || void 0 === _f ? void 0 : _f.type) ? cellGroup.getChildren()[0].activeChartInstance : null;
|
|
1529
1650
|
}
|
|
1530
1651
|
cellIsInVisualView(col, row) {
|
|
1652
|
+
var _a, _b, _c, _d;
|
|
1531
1653
|
const drawRange = this.getDrawRange(), rect = this.getCellRelativeRect(col, row);
|
|
1532
1654
|
if (col < this.frozenColCount && row < this.frozenRowCount) return !0;
|
|
1533
|
-
|
|
1655
|
+
let colHeaderRangeRect, rowHeaderRangeRect, bottomFrozenRangeRect, rightFrozenRangeRect;
|
|
1656
|
+
if (this.frozenRowCount >= 1 && (colHeaderRangeRect = this.getCellRangeRelativeRect({
|
|
1534
1657
|
start: {
|
|
1535
1658
|
col: 0,
|
|
1536
1659
|
row: 0
|
|
1537
1660
|
},
|
|
1538
1661
|
end: {
|
|
1539
1662
|
col: this.colCount - 1,
|
|
1540
|
-
row: this.
|
|
1663
|
+
row: this.frozenRowCount - 1
|
|
1541
1664
|
}
|
|
1542
|
-
}), rowHeaderRangeRect = this.getCellRangeRelativeRect({
|
|
1665
|
+
})), this.frozenColCount >= 1 && (rowHeaderRangeRect = this.getCellRangeRelativeRect({
|
|
1543
1666
|
start: {
|
|
1544
1667
|
col: 0,
|
|
1545
1668
|
row: 0
|
|
1546
1669
|
},
|
|
1547
1670
|
end: {
|
|
1548
|
-
col: this.
|
|
1671
|
+
col: this.frozenColCount - 1,
|
|
1549
1672
|
row: this.rowCount - 1
|
|
1550
1673
|
}
|
|
1551
|
-
})
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1674
|
+
})), this.bottomFrozenRowCount >= 1 && (bottomFrozenRangeRect = this.getCellRangeRelativeRect({
|
|
1675
|
+
start: {
|
|
1676
|
+
col: 0,
|
|
1677
|
+
row: this.rowCount - this.bottomFrozenRowCount
|
|
1678
|
+
},
|
|
1679
|
+
end: {
|
|
1680
|
+
col: this.colCount - 1,
|
|
1681
|
+
row: this.rowCount - 1
|
|
1682
|
+
}
|
|
1683
|
+
})), this.rightFrozenColCount >= 1 && (rightFrozenRangeRect = this.getCellRangeRelativeRect({
|
|
1684
|
+
start: {
|
|
1685
|
+
col: this.colCount - this.rightFrozenColCount,
|
|
1686
|
+
row: 0
|
|
1687
|
+
},
|
|
1688
|
+
end: {
|
|
1689
|
+
col: this.colCount - 1,
|
|
1690
|
+
row: this.rowCount - 1
|
|
1691
|
+
}
|
|
1692
|
+
})), rect.top >= drawRange.top && rect.bottom <= drawRange.bottom && rect.left >= drawRange.left && rect.right <= drawRange.right) {
|
|
1693
|
+
if (this.isFrozenCell(col, row)) return !0;
|
|
1694
|
+
if (rect.top >= (null !== (_a = null == colHeaderRangeRect ? void 0 : colHeaderRangeRect.bottom) && void 0 !== _a ? _a : rect.top) && rect.left >= (null !== (_b = null == rowHeaderRangeRect ? void 0 : rowHeaderRangeRect.right) && void 0 !== _b ? _b : rect.left) && rect.bottom <= (null !== (_c = null == bottomFrozenRangeRect ? void 0 : bottomFrozenRangeRect.top) && void 0 !== _c ? _c : rect.bottom) && rect.right <= (null !== (_d = null == rightFrozenRangeRect ? void 0 : rightFrozenRangeRect.left) && void 0 !== _d ? _d : rect.right)) return !0;
|
|
1555
1695
|
}
|
|
1556
1696
|
return !1;
|
|
1557
1697
|
}
|
|
@@ -1712,6 +1852,15 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1712
1852
|
var _a;
|
|
1713
1853
|
null === (_a = this.dataSource) || void 0 === _a || _a.setSortedIndexMap(field, filedMap);
|
|
1714
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
|
+
}
|
|
1715
1864
|
}
|
|
1716
1865
|
|
|
1717
1866
|
exports.BaseTable = BaseTable;
|