k-vtable 1.0.3 → 1.0.4
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.d.ts +3 -1
- package/cjs/ListTable.js +4 -4
- package/cjs/ListTable.js.map +1 -1
- package/cjs/body-helper/style/ButtonStyle.d.ts +1 -1
- package/cjs/body-helper/style/ButtonStyle.js +2 -2
- package/cjs/body-helper/style/ButtonStyle.js.map +1 -1
- package/cjs/body-helper/style/SwitchStyle.d.ts +1 -1
- package/cjs/body-helper/style/SwitchStyle.js +2 -2
- package/cjs/body-helper/style/SwitchStyle.js.map +1 -1
- package/cjs/components/menu/dom/logic/MenuElement.js +7 -3
- package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +13 -0
- package/cjs/core/BaseTable.js +112 -40
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/animation.js +1 -1
- package/cjs/core/animation.js.map +1 -1
- package/cjs/data/DataSource.js +2 -2
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset-pivot-table.js +1 -2
- package/cjs/dataset/flatDataToObject.js +2 -1
- package/cjs/event/event.js +2 -2
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -0
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +4 -4
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/scroll.js +6 -5
- package/cjs/event/scroll.js.map +1 -1
- package/cjs/event/self-event-listener/base-table/right-button-click.js +2 -2
- package/cjs/event/self-event-listener/base-table/right-button-click.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/row-height-map.js +10 -3
- package/cjs/layout/row-height-map.js.map +1 -1
- package/cjs/layout/simple-header-layout.js +2 -2
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/icon.d.ts +1 -0
- package/cjs/scenegraph/graphic/icon.js +30 -2
- package/cjs/scenegraph/graphic/icon.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +4 -4
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +3 -3
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +22 -17
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/state/state.js.map +1 -1
- package/cjs/tools/env.d.ts +1 -0
- package/cjs/tools/env.js +13 -2
- package/cjs/tools/env.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +10 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.d.ts +3 -3
- package/cjs/vrender.js +4 -21
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +4919 -3998
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +3 -1
- package/es/ListTable.js +2 -1
- package/es/ListTable.js.map +1 -1
- package/es/body-helper/style/ButtonStyle.d.ts +1 -1
- package/es/body-helper/style/ButtonStyle.js +1 -1
- package/es/body-helper/style/ButtonStyle.js.map +1 -1
- package/es/body-helper/style/SwitchStyle.d.ts +1 -1
- package/es/body-helper/style/SwitchStyle.js +1 -1
- package/es/body-helper/style/SwitchStyle.js.map +1 -1
- package/es/components/menu/dom/logic/MenuElement.js +7 -3
- package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/es/core/BaseTable.d.ts +13 -0
- package/es/core/BaseTable.js +112 -40
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/animation.js +1 -1
- package/es/core/animation.js.map +1 -1
- package/es/data/DataSource.js +2 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset-pivot-table.js +1 -2
- package/es/dataset/flatDataToObject.js +2 -1
- package/es/event/event.js +1 -3
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -0
- 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/scroll.js +6 -5
- package/es/event/scroll.js.map +1 -1
- package/es/event/self-event-listener/base-table/right-button-click.js +2 -2
- package/es/event/self-event-listener/base-table/right-button-click.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/row-height-map.js +10 -3
- package/es/layout/row-height-map.js.map +1 -1
- package/es/layout/simple-header-layout.js +2 -2
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/icon.d.ts +1 -0
- package/es/scenegraph/graphic/icon.js +6 -1
- package/es/scenegraph/graphic/icon.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +2 -2
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +4 -4
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +3 -3
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/scenegraph.js +22 -17
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/state/state.js.map +1 -1
- package/es/tools/env.d.ts +1 -0
- package/es/tools/env.js +11 -0
- package/es/tools/env.js.map +1 -1
- package/es/ts-types/base-table.d.ts +10 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.d.ts +3 -3
- package/es/vrender.js +2 -4
- package/es/vrender.js.map +1 -1
- package/package.json +7 -6
package/cjs/core/BaseTable.js
CHANGED
|
@@ -42,8 +42,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
42
42
|
return TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE;
|
|
43
43
|
}
|
|
44
44
|
constructor(container, options = {}) {
|
|
45
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
46
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.0.
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
46
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.0.4", this.id = `VTable${Date.now()}`,
|
|
47
47
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
48
48
|
"node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
|
|
49
49
|
container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
@@ -52,11 +52,22 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
52
52
|
container: container
|
|
53
53
|
}), container = options.container && options.container instanceof HTMLElement ? options.container : container,
|
|
54
54
|
!1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vrender_1.vglobal.isImageAnonymous = !1);
|
|
55
|
-
const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, frozenRowCount: frozenRowCount, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1,
|
|
55
|
+
const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, frozenRowCount: frozenRowCount, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, containerFit: containerFit = {
|
|
56
|
+
width: !1,
|
|
57
|
+
height: !1
|
|
58
|
+
}, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, enableCheckboxCascade: enableCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, 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;
|
|
56
59
|
this.container = container, this.options = options, this._widthMode = widthMode,
|
|
57
60
|
this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
|
|
58
|
-
this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, this.
|
|
59
|
-
|
|
61
|
+
this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, void 0 !== containerFit && (this._containerFit = "boolean" == typeof containerFit ? {
|
|
62
|
+
width: containerFit,
|
|
63
|
+
height: containerFit
|
|
64
|
+
} : containerFit && "object" == typeof containerFit ? {
|
|
65
|
+
width: null === (_b = containerFit.width) || void 0 === _b || _b,
|
|
66
|
+
height: null === (_c = containerFit.height) || void 0 === _c || _c
|
|
67
|
+
} : {
|
|
68
|
+
width: !1,
|
|
69
|
+
height: !1
|
|
70
|
+
}), this.customRender = customRender, this.padding = {
|
|
60
71
|
top: 0,
|
|
61
72
|
right: 0,
|
|
62
73
|
left: 0,
|
|
@@ -68,7 +79,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
68
79
|
vutils_1.isValid)(canvasWidth)) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0,
|
|
69
80
|
this.tableNoFrameHeight = 0, this.canvasWidth = (0, vutils_1.isNumber)(canvasWidth) ? canvasWidth : void 0,
|
|
70
81
|
this.canvasHeight = (0, vutils_1.isNumber)(canvasHeight) ? canvasHeight : void 0,
|
|
71
|
-
this.columnWidthComputeMode = null !== (
|
|
82
|
+
this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal";
|
|
72
83
|
const internalProps = this.internalProps = {};
|
|
73
84
|
void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
74
85
|
this.options.canvas ? ("node" !== env_1.Env.mode && (internalProps.element = this.options.canvas.parentElement,
|
|
@@ -76,7 +87,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
76
87
|
internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== env_1.Env.mode && (internalProps.element = (0,
|
|
77
88
|
tableHelper_1.createRootElement)(this.padding), internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
|
|
78
89
|
internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas),
|
|
79
|
-
internalProps.context = internalProps.canvas.getContext("2d"), (null === (
|
|
90
|
+
internalProps.context = internalProps.canvas.getContext("2d"), (null === (_e = options.customConfig) || void 0 === _e ? void 0 : _e.createReactContainer) && (0,
|
|
80
91
|
frozen_react_1.createReactContainer)(this)), internalProps.handler = new EventHandler_1.EventHandler,
|
|
81
92
|
(0, vutils_1.isNumber)(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
|
|
82
93
|
internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount,
|
|
@@ -85,9 +96,9 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
85
96
|
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
|
|
86
97
|
internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
|
|
87
98
|
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = enableCheckboxCascade,
|
|
88
|
-
internalProps.columnResizeMode = null !== (
|
|
89
|
-
internalProps.rowResizeMode = null !== (
|
|
90
|
-
internalProps.dragHeaderMode = null !== (
|
|
99
|
+
internalProps.columnResizeMode = null !== (_f = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _f ? _f : columnResizeMode,
|
|
100
|
+
internalProps.rowResizeMode = null !== (_g = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _g ? _g : rowResizeMode,
|
|
101
|
+
internalProps.dragHeaderMode = null !== (_j = null !== (_h = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _h ? _h : dragHeaderMode) && void 0 !== _j ? _j : "none",
|
|
91
102
|
internalProps.renderChartAsync = renderChartAsync, (0, chart_render_helper_1.setBatchRenderChartCount)(renderChartAsyncBatchCount),
|
|
92
103
|
internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
|
|
93
104
|
internalProps._rowHeightsMap = new row_height_map_1.NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map,
|
|
@@ -101,14 +112,14 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
101
112
|
var _a;
|
|
102
113
|
return "node" === env_1.Env.mode ? that.canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
|
|
103
114
|
}
|
|
104
|
-
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (
|
|
115
|
+
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (_k = options.theme) && void 0 !== _k ? _k : themes_1.default.DEFAULT),
|
|
105
116
|
internalProps.theme.isPivot = this.isPivotTable(), (0, icons_1.setIconColor)(internalProps.theme.functionalIconsStyle),
|
|
106
117
|
container ? (clearDOM && (container.innerHTML = ""), container.appendChild(internalProps.element),
|
|
107
118
|
this._updateSize()) : this._updateSize(), internalProps.bodyHelper = new body_helper_1.BodyHelper(this),
|
|
108
119
|
internalProps.headerHelper = new header_helper_1.HeaderHelper(this), internalProps.rowSeriesNumberHelper = new row_series_number_helper_1.RowSeriesNumberHelper(this),
|
|
109
120
|
internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak,
|
|
110
|
-
internalProps.allowFrozenColCount = null !== (
|
|
111
|
-
internalProps.limitMaxAutoWidth = null !== (
|
|
121
|
+
internalProps.allowFrozenColCount = null !== (_l = options.allowFrozenColCount) && void 0 !== _l ? _l : 0,
|
|
122
|
+
internalProps.limitMaxAutoWidth = null !== (_m = options.limitMaxAutoWidth) && void 0 !== _m ? _m : 450,
|
|
112
123
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
113
124
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
114
125
|
this.scenegraph = new scenegraph_1.Scenegraph(this), this.stateManager = new state_1.StateManager(this),
|
|
@@ -139,8 +150,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
139
150
|
}
|
|
140
151
|
if (internalProps.menu = Object.assign({
|
|
141
152
|
renderMode: "html"
|
|
142
|
-
}, options.menu), Array.isArray(null === (
|
|
143
|
-
(Array.isArray(null === (
|
|
153
|
+
}, options.menu), Array.isArray(null === (_o = options.menu) || void 0 === _o ? void 0 : _o.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_p = options.menu) || void 0 === _p ? void 0 : _p.dropDownMenuHighlight),
|
|
154
|
+
(Array.isArray(null === (_q = options.menu) || void 0 === _q ? void 0 : _q.defaultHeaderMenuItems) || "function" == typeof (null === (_r = options.menu) || void 0 === _r ? void 0 : _r.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
|
|
144
155
|
"html" === internalProps.menu.renderMode) {
|
|
145
156
|
const MenuHandler = factory_1.Factory.getComponent("menuHandler");
|
|
146
157
|
internalProps.menuHandler = new MenuHandler(this);
|
|
@@ -150,7 +161,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
150
161
|
changedCells: new Map
|
|
151
162
|
}, internalProps.customMergeCell = (0, get_custom_merge_cell_func_1.getCustomMergeCellFunc)(options.customMergeCell);
|
|
152
163
|
const CustomCellStylePlugin = factory_1.Factory.getComponent("customCellStylePlugin");
|
|
153
|
-
CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (
|
|
164
|
+
CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_s = options.customCellStyle) && void 0 !== _s ? _s : [], null !== (_t = options.customCellStyleArrangement) && void 0 !== _t ? _t : [])),
|
|
154
165
|
this._adjustCanvasSizeByOption();
|
|
155
166
|
}
|
|
156
167
|
_adjustCanvasSizeByOption() {
|
|
@@ -477,13 +488,14 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
477
488
|
if (null != cachedColWidth) return cachedColWidth;
|
|
478
489
|
const cachedLowerColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol - 1}`);
|
|
479
490
|
if (null != cachedLowerColWidth) {
|
|
480
|
-
|
|
481
|
-
return
|
|
491
|
+
let addWidth = cachedLowerColWidth + this.getColWidth(endCol);
|
|
492
|
+
return this.rightFrozenColCount > 0 && endCol === this.colCount - this.rightFrozenColCount && (addWidth = this._getRangeSizeForContainerFit(startCol, endCol, addWidth, "col")),
|
|
493
|
+
startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth) && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)),
|
|
482
494
|
Math.round(addWidth);
|
|
483
495
|
}
|
|
484
496
|
let w = 0;
|
|
485
497
|
for (let col = startCol; col <= endCol; col++) w += this.getColWidth(col);
|
|
486
|
-
return startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
|
|
498
|
+
return w = this._getRangeSizeForContainerFit(startCol, endCol, w, "col"), startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
|
|
487
499
|
Math.round(w);
|
|
488
500
|
}
|
|
489
501
|
getRowHeight(row) {
|
|
@@ -532,12 +544,43 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
532
544
|
}
|
|
533
545
|
h = this.rowHeightsMap.getSumInRange(startRow, endRow);
|
|
534
546
|
} else {
|
|
547
|
+
const bottomFrozenStartRow = this.rowCount - this.bottomFrozenRowCount;
|
|
535
548
|
for (let i = startRow; i < Math.min(endRow + 1, this.columnHeaderLevelCount); i++) h += this.getRowHeight(i);
|
|
536
|
-
endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow,
|
|
537
|
-
|
|
549
|
+
endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, bottomFrozenStartRow - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
|
|
550
|
+
let currentBottomFrozenRowsHeight = 0;
|
|
551
|
+
for (let i = bottomFrozenStartRow; i < endRow + 1; i++) currentBottomFrozenRowsHeight += this.getRowHeight(i);
|
|
552
|
+
h = this._getRangeSizeForContainerFit(startRow, endRow, h + currentBottomFrozenRowsHeight, "row");
|
|
538
553
|
}
|
|
539
554
|
return Math.round(h);
|
|
540
555
|
}
|
|
556
|
+
_getRangeSizeForContainerFit(start, end, totalSize, type = "col") {
|
|
557
|
+
var _a;
|
|
558
|
+
if (!isFinite(start) || !isFinite(end)) return totalSize;
|
|
559
|
+
const keyMap = "col" === type ? {
|
|
560
|
+
totalCount: "colCount",
|
|
561
|
+
frozenCount: "rightFrozenColCount",
|
|
562
|
+
fitType: "width",
|
|
563
|
+
tableSize: "tableNoFrameWidth",
|
|
564
|
+
getSize: "getColWidth"
|
|
565
|
+
} : {
|
|
566
|
+
totalCount: "rowCount",
|
|
567
|
+
frozenCount: "bottomFrozenRowCount",
|
|
568
|
+
fitType: "height",
|
|
569
|
+
tableSize: "tableNoFrameHeight",
|
|
570
|
+
getSize: "getRowHeight"
|
|
571
|
+
}, tableSize = this[keyMap.tableSize];
|
|
572
|
+
if (totalSize >= tableSize) return totalSize;
|
|
573
|
+
const frozenStart = this[keyMap.totalCount] - this[keyMap.frozenCount];
|
|
574
|
+
if (!isFinite(this[keyMap.totalCount]) || this[keyMap.frozenCount] <= 0 || frozenStart < 0) return totalSize;
|
|
575
|
+
if (start > frozenStart || end < frozenStart || start === end || !(null === (_a = this.containerFit) || void 0 === _a ? void 0 : _a[keyMap.fitType])) return totalSize;
|
|
576
|
+
const last = this[keyMap.totalCount] - 1;
|
|
577
|
+
let size = tableSize;
|
|
578
|
+
if (start > 0) for (let i = 0; i < start; i++) if (size -= this[keyMap.getSize](i),
|
|
579
|
+
size <= 0) return totalSize;
|
|
580
|
+
if (end !== last) for (let i = end + 1; i <= last; i++) if (size -= this[keyMap.getSize](i),
|
|
581
|
+
size <= 0) return totalSize;
|
|
582
|
+
return size;
|
|
583
|
+
}
|
|
541
584
|
getColWidthDefined(col) {
|
|
542
585
|
var _a;
|
|
543
586
|
const {layoutMap: layoutMap} = this.internalProps;
|
|
@@ -862,10 +905,10 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
862
905
|
return super.fireListeners(type, event);
|
|
863
906
|
}
|
|
864
907
|
updateOption(options) {
|
|
865
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
908
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
866
909
|
null === (_a = this.editorManager) || void 0 === _a || _a.cancelEdit(), this.options = options,
|
|
867
910
|
this._hasAutoImageColumn = void 0;
|
|
868
|
-
const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth = 80, keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, enableCheckboxCascade: enableCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, pixelRatio: pixelRatio, widthMode: widthMode, heightMode: heightMode, autoFillWidth: autoFillWidth, autoFillHeight: autoFillHeight, widthAdaptiveMode: widthAdaptiveMode, heightAdaptiveMode: heightAdaptiveMode, customRender: customRender, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight} = options;
|
|
911
|
+
const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth = 80, keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, enableCheckboxCascade: enableCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, pixelRatio: pixelRatio, widthMode: widthMode, heightMode: heightMode, autoFillWidth: autoFillWidth, autoFillHeight: autoFillHeight, containerFit: containerFit, widthAdaptiveMode: widthAdaptiveMode, heightAdaptiveMode: heightAdaptiveMode, customRender: customRender, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight} = options;
|
|
869
912
|
pixelRatio && pixelRatio !== this.internalProps.pixelRatio && (this.internalProps.pixelRatio = pixelRatio),
|
|
870
913
|
padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding,
|
|
871
914
|
this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top),
|
|
@@ -876,36 +919,45 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
876
919
|
this._widthAdaptiveMode = null != widthAdaptiveMode ? widthAdaptiveMode : "only-body",
|
|
877
920
|
this._heightAdaptiveMode = null != heightAdaptiveMode ? heightAdaptiveMode : "only-body",
|
|
878
921
|
this.autoFillWidth = null != autoFillWidth && autoFillWidth, this.autoFillHeight = null != autoFillHeight && autoFillHeight,
|
|
879
|
-
|
|
922
|
+
void 0 !== containerFit && (this._containerFit = "boolean" == typeof containerFit ? {
|
|
923
|
+
width: containerFit,
|
|
924
|
+
height: containerFit
|
|
925
|
+
} : containerFit && "object" == typeof containerFit ? {
|
|
926
|
+
width: null === (_b = containerFit.width) || void 0 === _b || _b,
|
|
927
|
+
height: null === (_c = containerFit.height) || void 0 === _c || _c
|
|
928
|
+
} : {
|
|
929
|
+
width: !1,
|
|
930
|
+
height: !1
|
|
931
|
+
}), this.customRender = customRender, this.canvasWidth = (0, vutils_1.isNumber)(canvasWidth) ? canvasWidth : void 0,
|
|
880
932
|
this.canvasHeight = (0, vutils_1.isNumber)(canvasHeight) ? canvasHeight : void 0;
|
|
881
933
|
const internalProps = this.internalProps;
|
|
882
934
|
if ("node" === env_1.Env.mode || options.canvas || (0, tableHelper_1.updateRootElementPadding)(internalProps.element, this.padding),
|
|
883
|
-
this.columnWidthComputeMode = null !== (
|
|
935
|
+
this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal",
|
|
884
936
|
internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth,
|
|
885
937
|
internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
|
|
886
938
|
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
|
|
887
939
|
internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
|
|
888
940
|
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = enableCheckboxCascade,
|
|
889
|
-
internalProps.columnResizeMode = null !== (
|
|
890
|
-
internalProps.rowResizeMode = null !== (
|
|
891
|
-
internalProps.dragHeaderMode = null !== (
|
|
941
|
+
internalProps.columnResizeMode = null !== (_e = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _e ? _e : columnResizeMode,
|
|
942
|
+
internalProps.rowResizeMode = null !== (_f = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _f ? _f : rowResizeMode,
|
|
943
|
+
internalProps.dragHeaderMode = null !== (_h = null !== (_g = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _g ? _g : dragHeaderMode) && void 0 !== _h ? _h : "none",
|
|
892
944
|
internalProps.renderChartAsync = renderChartAsync, (0, chart_render_helper_1.setBatchRenderChartCount)(renderChartAsyncBatchCount),
|
|
893
945
|
internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
|
|
894
946
|
internalProps.cellTextOverflows = {}, internalProps._rowHeightsMap = new row_height_map_1.NumberRangeMap(this),
|
|
895
947
|
internalProps._rowRangeHeightsMap = new Map, internalProps._colRangeWidthsMap = new Map,
|
|
896
948
|
internalProps._widthResizedColMap = new Set, internalProps._heightResizedRowMap = new Set,
|
|
897
949
|
this.colWidthsMap = new NumberMap_1.NumberMap, this.colContentWidthsMap = new NumberMap_1.NumberMap,
|
|
898
|
-
this.colWidthsLimit = {}, internalProps.stick.changedCells.clear(), internalProps.theme = themes_1.default.of(null !== (
|
|
950
|
+
this.colWidthsLimit = {}, internalProps.stick.changedCells.clear(), internalProps.theme = themes_1.default.of(null !== (_j = options.theme) && void 0 !== _j ? _j : themes_1.default.DEFAULT),
|
|
899
951
|
internalProps.theme.isPivot = this.isPivotTable(), (0, icons_1.setIconColor)(internalProps.theme.functionalIconsStyle),
|
|
900
952
|
this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText,
|
|
901
|
-
internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (
|
|
902
|
-
internalProps.limitMaxAutoWidth = null !== (
|
|
953
|
+
internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_k = options.allowFrozenColCount) && void 0 !== _k ? _k : 0,
|
|
954
|
+
internalProps.limitMaxAutoWidth = null !== (_l = options.limitMaxAutoWidth) && void 0 !== _l ? _l : 450,
|
|
903
955
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
904
956
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
905
|
-
null === (
|
|
957
|
+
null === (_m = internalProps.legends) || void 0 === _m || _m.forEach((legend => {
|
|
906
958
|
null == legend || legend.release();
|
|
907
|
-
})), null === (
|
|
908
|
-
null === (
|
|
959
|
+
})), null === (_o = internalProps.title) || void 0 === _o || _o.release(), internalProps.title = null,
|
|
960
|
+
null === (_p = internalProps.emptyTip) || void 0 === _p || _p.release(), internalProps.emptyTip = null,
|
|
909
961
|
internalProps.layoutMap.release(), (0, chart_render_helper_1.clearChartRenderQueue)(),
|
|
910
962
|
this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(),
|
|
911
963
|
this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
|
|
@@ -934,15 +986,15 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
934
986
|
}
|
|
935
987
|
if (internalProps.menu = Object.assign({
|
|
936
988
|
renderMode: "html"
|
|
937
|
-
}, options.menu), Array.isArray(null === (
|
|
938
|
-
(Array.isArray(null === (
|
|
989
|
+
}, options.menu), Array.isArray(null === (_q = options.menu) || void 0 === _q ? void 0 : _q.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_r = options.menu) || void 0 === _r ? void 0 : _r.dropDownMenuHighlight),
|
|
990
|
+
(Array.isArray(null === (_s = options.menu) || void 0 === _s ? void 0 : _s.defaultHeaderMenuItems) || "function" == typeof (null === (_t = options.menu) || void 0 === _t ? void 0 : _t.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
|
|
939
991
|
"html" === internalProps.menu.renderMode && !internalProps.menuHandler) {
|
|
940
992
|
const MenuHandler = factory_1.Factory.getComponent("menuHandler");
|
|
941
993
|
internalProps.menuHandler = new MenuHandler(this);
|
|
942
994
|
}
|
|
943
995
|
this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(),
|
|
944
996
|
internalProps.customMergeCell = (0, get_custom_merge_cell_func_1.getCustomMergeCellFunc)(options.customMergeCell),
|
|
945
|
-
null === (
|
|
997
|
+
null === (_u = this.customCellStylePlugin) || void 0 === _u || _u.updateCustomCell(null !== (_v = options.customCellStyle) && void 0 !== _v ? _v : [], null !== (_w = options.customCellStyleArrangement) && void 0 !== _w ? _w : []),
|
|
946
998
|
this._adjustCanvasSizeByOption();
|
|
947
999
|
}
|
|
948
1000
|
renderWithRecreateCells() {
|
|
@@ -978,7 +1030,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
978
1030
|
return 0;
|
|
979
1031
|
}
|
|
980
1032
|
getDrawRange() {
|
|
981
|
-
|
|
1033
|
+
var _a, _b;
|
|
1034
|
+
const width = (null === (_a = this.containerFit) || void 0 === _a ? void 0 : _a.width) ? this.tableNoFrameWidth : Math.min(this.tableNoFrameWidth, this.getAllColsWidth()), height = (null === (_b = this.containerFit) || void 0 === _b ? void 0 : _b.height) ? this.tableNoFrameHeight : Math.min(this.tableNoFrameHeight, this.getAllRowsHeight());
|
|
982
1035
|
return new Rect_1.Rect(this.tableX, this.tableY, width, height);
|
|
983
1036
|
}
|
|
984
1037
|
_getMouseAbstractPoint(evt) {
|
|
@@ -1734,8 +1787,11 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1734
1787
|
this.render();
|
|
1735
1788
|
const stage = this.scenegraph.stage;
|
|
1736
1789
|
if (stage) {
|
|
1737
|
-
|
|
1738
|
-
if (
|
|
1790
|
+
let contentWidth = this.tableX + this.getAllColsWidth(), contentHeight = this.tableY + this.getAllRowsHeight();
|
|
1791
|
+
if (this.internalProps.legends && this.internalProps.legends.forEach((legend => {
|
|
1792
|
+
"right" === legend.orient ? contentWidth = Math.max(contentWidth, legend.legendComponent.globalAABBBounds.x2) : "bottom" === legend.orient && (contentHeight = Math.max(contentHeight, legend.legendComponent.globalAABBBounds.y2));
|
|
1793
|
+
})), this.internalProps.title && ("right" === this.internalProps.title._titleOption.orient ? contentWidth = Math.max(contentWidth, this.internalProps.title.getComponentGraphic().globalAABBBounds.x2) : "bottom" === this.internalProps.title._titleOption.orient && (contentHeight = Math.max(contentHeight, this.internalProps.title.getComponentGraphic().globalAABBBounds.y2))),
|
|
1794
|
+
contentWidth >= this.canvasWidth && contentHeight >= this.canvasHeight) {
|
|
1739
1795
|
stage.render();
|
|
1740
1796
|
return stage.window.getImageBuffer(type);
|
|
1741
1797
|
}
|
|
@@ -1883,6 +1939,22 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1883
1939
|
checkHasColumnAutoWidth() {
|
|
1884
1940
|
return (0, tableHelper_1.checkHasColumnAutoWidth)(this);
|
|
1885
1941
|
}
|
|
1942
|
+
get containerFit() {
|
|
1943
|
+
return this._containerFit;
|
|
1944
|
+
}
|
|
1945
|
+
set containerFit(containerFit) {
|
|
1946
|
+
var _a, _b;
|
|
1947
|
+
this._containerFit = "boolean" == typeof containerFit ? {
|
|
1948
|
+
width: containerFit,
|
|
1949
|
+
height: containerFit
|
|
1950
|
+
} : containerFit && "object" == typeof containerFit ? {
|
|
1951
|
+
width: null === (_a = containerFit.width) || void 0 === _a || _a,
|
|
1952
|
+
height: null === (_b = containerFit.height) || void 0 === _b || _b
|
|
1953
|
+
} : {
|
|
1954
|
+
width: !1,
|
|
1955
|
+
height: !1
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1886
1958
|
}
|
|
1887
1959
|
|
|
1888
1960
|
exports.BaseTable = BaseTable;
|