@visactor/vtable 1.0.4-alpha.0 → 1.1.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 -5
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +5 -3
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +5 -3
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/empty-tip/empty-tip.d.ts +15 -0
- package/cjs/components/empty-tip/empty-tip.js +83 -0
- package/cjs/components/empty-tip/empty-tip.js.map +1 -0
- package/cjs/core/BaseTable.js +29 -23
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/data/DataSource.d.ts +1 -0
- package/cjs/data/DataSource.js +23 -13
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/event/event.js +3 -2
- package/cjs/event/event.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +3 -2
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/tools/get-data-path/create-dataset.js +4 -4
- package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +4 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/component/empty-tip.d.ts +19 -0
- package/cjs/ts-types/component/empty-tip.js +6 -0
- package/cjs/ts-types/component/empty-tip.js.map +1 -0
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +71537 -70193
- package/dist/vtable.min.js +12 -12
- package/es/ListTable.js +7 -2
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +5 -1
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +4 -0
- package/es/PivotTable.js.map +1 -1
- package/es/components/empty-tip/empty-tip.d.ts +15 -0
- package/es/components/empty-tip/empty-tip.js +79 -0
- package/es/components/empty-tip/empty-tip.js.map +1 -0
- package/es/core/BaseTable.js +29 -23
- package/es/core/BaseTable.js.map +1 -1
- package/es/data/DataSource.d.ts +1 -0
- package/es/data/DataSource.js +23 -13
- package/es/data/DataSource.js.map +1 -1
- package/es/event/event.js +2 -1
- package/es/event/event.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/pivot-header-layout.js +3 -2
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/tools/get-data-path/create-dataset.js +4 -4
- package/es/tools/get-data-path/create-dataset.js.map +1 -1
- package/es/ts-types/base-table.d.ts +4 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/component/empty-tip.d.ts +19 -0
- package/es/ts-types/component/empty-tip.js +2 -0
- package/es/ts-types/component/empty-tip.js.map +1 -0
- package/es/vrender.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.EmptyTip = void 0;
|
|
6
|
+
|
|
7
|
+
const vrender_components_1 = require("@visactor/vrender-components"), vutils_1 = require("@visactor/vutils"), emptyTipSvg = '<svg t="1716726614852" class="icon" viewBox="0 0 1194 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2621" width="200" height="200"><path d="M1038.694079 367.237067c13.265507 23.342857-16.633865-40.004445-63.05621-40.004446H219.018794c-26.558738 0-46.46393 13.334815-63.05621 40.004446S0.006238 607.277601 0.006238 650.608819V940.647979a82.351494 82.351494 0 0 0 82.961402 83.349526H1111.702885a82.337632 82.337632 0 0 0 82.975264-83.349526V650.608819c0-43.331218-155.970208-283.371753-155.970208-283.371752zM730.066575 667.284269a136.328386 136.328386 0 0 1-132.738243 133.33429 133.417459 133.417459 0 0 1-132.738243-133.33429v-6.681269a40.6698 40.6698 0 0 0-36.497473-26.66963H73.015044l119.458874-220.02445s23.231965-40.004445 53.103614-40.004446h713.481918c26.544876 0 29.871649 10.008042 46.436207 40.004446L1128.33675 633.947231H769.904682c-26.184476 0-39.838107 7.623855-39.838107 33.337038zM338.505391 210.559919l-89.601086-86.69016a22.178487 22.178487 0 0 1 0-33.26773 21.984425 21.984425 0 0 1 33.170699 0l89.601087 86.676299a22.317102 22.317102 0 0 1 0 33.26773 24.950798 24.950798 0 0 1-33.1707 0z m252.197118-40.059891a25.532983 25.532983 0 0 1-6.639685-16.633865l-3.326773-126.694606A28.263709 28.263709 0 0 1 603.995739 0.515788c13.251646-3.326773 23.204242 10.021904 26.544877 23.342858V153.866163a28.249847 28.249847 0 0 1-23.259688 26.66963c-6.611961-3.312911-13.279369-3.312911-16.578419-10.035765z m235.646421 33.337038a22.372548 22.372548 0 0 1 0-33.337038l86.288175-90.030795a22.039871 22.039871 0 0 1 33.170699 0 22.289379 22.289379 0 0 1 0 33.364761l-82.961401 90.003072a25.962691 25.962691 0 0 1-36.483611 0z" fill="#8a8a8a" p-id="2622"></path></svg>';
|
|
8
|
+
|
|
9
|
+
class EmptyTip {
|
|
10
|
+
constructor(emptyTipOption, table) {
|
|
11
|
+
this._emptyTipOption = {
|
|
12
|
+
spaceBetweenTextAndIcon: 20,
|
|
13
|
+
text: "no data",
|
|
14
|
+
textStyle: {
|
|
15
|
+
fontSize: 14,
|
|
16
|
+
color: "#000"
|
|
17
|
+
},
|
|
18
|
+
icon: {
|
|
19
|
+
image: emptyTipSvg,
|
|
20
|
+
width: 100,
|
|
21
|
+
height: 100
|
|
22
|
+
}
|
|
23
|
+
}, this.isReleased = !1, this.table = table, this._emptyTipOption = Object.assign(this._emptyTipOption, !0 === emptyTipOption ? {} : emptyTipOption),
|
|
24
|
+
this._emptyTipComponent = this._createOrUpdateEmptyTipComponent(this._getEmptyTipAttrs());
|
|
25
|
+
}
|
|
26
|
+
_createOrUpdateEmptyTipComponent(attrs) {
|
|
27
|
+
if (this._emptyTipComponent) (0, vutils_1.isEqual)(attrs, this._cacheAttrs) || this._emptyTipComponent.setAttributes(attrs); else {
|
|
28
|
+
const emptyTip = new vrender_components_1.EmptyTip(attrs);
|
|
29
|
+
emptyTip.name = "emptyTip", this.table.scenegraph.stage.defaultLayer.appendChild(emptyTip),
|
|
30
|
+
this._emptyTipComponent = emptyTip;
|
|
31
|
+
}
|
|
32
|
+
return this._emptyTipComponent;
|
|
33
|
+
}
|
|
34
|
+
resize() {
|
|
35
|
+
var _a;
|
|
36
|
+
if (!this._emptyTipComponent) return;
|
|
37
|
+
const leftHeaderWidth = this.table.transpose || !1 === this.table.options.indicatorsAsCol ? this.table.getFrozenColsWidth() : 0, topHeaderHeight = !this.table.transpose || this.table.options.indicatorsAsCol ? this.table.getFrozenRowsHeight() : 0, width = (this.table.columnHeaderLevelCount > 0 ? this.table.getDrawRange().width : this.table.tableNoFrameWidth) - leftHeaderWidth, height = (this.table.rowHeaderLevelCount > 0 ? this.table.getDrawRange().height : this.table.tableNoFrameHeight) - topHeaderHeight;
|
|
38
|
+
this._emptyTipComponent.setAttributes({
|
|
39
|
+
spaceBetweenTextAndIcon: this._emptyTipOption.spaceBetweenTextAndIcon,
|
|
40
|
+
x: this.table.tableX + leftHeaderWidth,
|
|
41
|
+
y: this.table.tableY + topHeaderHeight,
|
|
42
|
+
width: width,
|
|
43
|
+
height: height,
|
|
44
|
+
text: Object.assign(Object.assign({
|
|
45
|
+
text: this._emptyTipOption.text
|
|
46
|
+
}, this._emptyTipOption.textStyle), {
|
|
47
|
+
fill: null === (_a = this._emptyTipOption.textStyle) || void 0 === _a ? void 0 : _a.color
|
|
48
|
+
}),
|
|
49
|
+
icon: Object.assign({}, this._emptyTipOption.icon)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
release() {
|
|
53
|
+
this._emptyTipComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._emptyTipComponent),
|
|
54
|
+
this._emptyTipComponent = null, this.isReleased = !0;
|
|
55
|
+
}
|
|
56
|
+
resetVisible() {
|
|
57
|
+
this.table.recordsCount && 0 !== this.table.recordsCount ? (this._emptyTipComponent.setAttributes({
|
|
58
|
+
visible: !1
|
|
59
|
+
}), this._emptyTipComponent.hideAll()) : (this._emptyTipComponent.setAttributes({
|
|
60
|
+
visible: !0
|
|
61
|
+
}), this._emptyTipComponent.showAll());
|
|
62
|
+
}
|
|
63
|
+
_getEmptyTipAttrs() {
|
|
64
|
+
var _a;
|
|
65
|
+
const leftHeaderWidth = this.table.transpose || !1 === this.table.options.indicatorsAsCol ? this.table.getFrozenColsWidth() : 0, topHeaderHeight = !this.table.transpose || this.table.options.indicatorsAsCol ? this.table.getFrozenRowsHeight() : 0, width = (this.table.columnHeaderLevelCount > 0 ? this.table.getDrawRange().width : this.table.tableNoFrameWidth) - leftHeaderWidth, height = (this.table.rowHeaderLevelCount > 0 ? this.table.getDrawRange().height : this.table.tableNoFrameHeight) - topHeaderHeight;
|
|
66
|
+
return {
|
|
67
|
+
spaceBetweenTextAndIcon: this._emptyTipOption.spaceBetweenTextAndIcon,
|
|
68
|
+
x: this.table.tableX + leftHeaderWidth,
|
|
69
|
+
y: this.table.tableY + topHeaderHeight,
|
|
70
|
+
width: width,
|
|
71
|
+
height: height,
|
|
72
|
+
text: Object.assign(Object.assign({
|
|
73
|
+
text: this._emptyTipOption.text
|
|
74
|
+
}, this._emptyTipOption.textStyle), {
|
|
75
|
+
fill: null === (_a = this._emptyTipOption.textStyle) || void 0 === _a ? void 0 : _a.color
|
|
76
|
+
}),
|
|
77
|
+
icon: Object.assign({}, this._emptyTipOption.icon)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
exports.EmptyTip = EmptyTip;
|
|
83
|
+
//# sourceMappingURL=empty-tip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/empty-tip/empty-tip.ts"],"names":[],"mappings":";;;AAAA,qEAA8E;AAK9E,6CAA2C;AAG3C,MAAM,WAAW,GACf,4pDAA4pD,C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,CAAC,KAAK,CAAC,sBAAsB,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC;YACxG,eAAe,CAAC;QAClB,MAAM,MAAM,GACV,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;YACvG,eAAe,CAAC;QAElB,OAAO;YACL,uBAAuB,EAAE,IAAI,CAAC,eAAe,CAAC,uBAAuB;YACrE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,eAAe;YACtC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,eAAe;YACtC,KAAK;YACL,MAAM;YACN,IAAI,gCACF,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,IAC5B,IAAI,CAAC,eAAe,CAAC,SAAS,KACjC,IAAI,EAAE,MAAA,IAAI,CAAC,eAAe,CAAC,SAAS,0CAAE,KAAK,GAC5C;YACD,IAAI,oBACC,IAAI,CAAC,eAAe,CAAC,IAAI,CAC7B;SAEoB,CAAC;IAC1B,CAAC;CACF;AAjID,4BAiIC","file":"empty-tip.js","sourcesContent":["import { EmptyTip as EmptyTipComponents } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport type { EmptyTipAttributes } from '@visactor/vrender-components';\nimport type { IEmptyTip } from '../../ts-types/component/empty-tip';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { isEqual } from '@visactor/vutils';\nimport type { ListTable } from '../../ListTable';\nimport type { PivotTable } from '../../PivotTable';\nconst emptyTipSvg =\n '<svg t=\"1716726614852\" class=\"icon\" viewBox=\"0 0 1194 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2621\" width=\"200\" height=\"200\"><path d=\"M1038.694079 367.237067c13.265507 23.342857-16.633865-40.004445-63.05621-40.004446H219.018794c-26.558738 0-46.46393 13.334815-63.05621 40.004446S0.006238 607.277601 0.006238 650.608819V940.647979a82.351494 82.351494 0 0 0 82.961402 83.349526H1111.702885a82.337632 82.337632 0 0 0 82.975264-83.349526V650.608819c0-43.331218-155.970208-283.371753-155.970208-283.371752zM730.066575 667.284269a136.328386 136.328386 0 0 1-132.738243 133.33429 133.417459 133.417459 0 0 1-132.738243-133.33429v-6.681269a40.6698 40.6698 0 0 0-36.497473-26.66963H73.015044l119.458874-220.02445s23.231965-40.004445 53.103614-40.004446h713.481918c26.544876 0 29.871649 10.008042 46.436207 40.004446L1128.33675 633.947231H769.904682c-26.184476 0-39.838107 7.623855-39.838107 33.337038zM338.505391 210.559919l-89.601086-86.69016a22.178487 22.178487 0 0 1 0-33.26773 21.984425 21.984425 0 0 1 33.170699 0l89.601087 86.676299a22.317102 22.317102 0 0 1 0 33.26773 24.950798 24.950798 0 0 1-33.1707 0z m252.197118-40.059891a25.532983 25.532983 0 0 1-6.639685-16.633865l-3.326773-126.694606A28.263709 28.263709 0 0 1 603.995739 0.515788c13.251646-3.326773 23.204242 10.021904 26.544877 23.342858V153.866163a28.249847 28.249847 0 0 1-23.259688 26.66963c-6.611961-3.312911-13.279369-3.312911-16.578419-10.035765z m235.646421 33.337038a22.372548 22.372548 0 0 1 0-33.337038l86.288175-90.030795a22.039871 22.039871 0 0 1 33.170699 0 22.289379 22.289379 0 0 1 0 33.364761l-82.961401 90.003072a25.962691 25.962691 0 0 1-36.483611 0z\" fill=\"#8a8a8a\" p-id=\"2622\"></path></svg>';\n\nexport class EmptyTip {\n table: BaseTableAPI;\n _emptyTipOption: IEmptyTip = {\n spaceBetweenTextAndIcon: 20,\n text: 'no data',\n textStyle: {\n fontSize: 14,\n color: '#000'\n },\n icon: {\n image: emptyTipSvg,\n width: 100,\n height: 100\n }\n };\n isReleased: boolean = false;\n private _emptyTipComponent: EmptyTipComponents;\n private _cacheAttrs: EmptyTipAttributes;\n constructor(emptyTipOption: IEmptyTip | true, table: BaseTableAPI) {\n this.table = table;\n this._emptyTipOption = Object.assign(this._emptyTipOption, emptyTipOption === true ? {} : emptyTipOption);\n this._emptyTipComponent = this._createOrUpdateEmptyTipComponent(this._getEmptyTipAttrs());\n }\n\n private _createOrUpdateEmptyTipComponent(attrs: EmptyTipAttributes): EmptyTipComponents {\n if (this._emptyTipComponent) {\n if (!isEqual(attrs, this._cacheAttrs)) {\n this._emptyTipComponent.setAttributes(attrs);\n }\n } else {\n const emptyTip = new EmptyTipComponents(attrs);\n emptyTip.name = 'emptyTip';\n this.table.scenegraph.stage.defaultLayer.appendChild(emptyTip);\n this._emptyTipComponent = emptyTip;\n // 代理 emptyTip 组件上的事件\n // emptyTip.on('*', (event: any, type: string) => this._delegateEvent(emptyTip as unknown as INode, event, type));\n }\n // update table size\n // this._adjustTableSize(this._emptyTipComponent.attribute);\n return this._emptyTipComponent;\n }\n\n resize() {\n if (!this._emptyTipComponent) {\n return;\n }\n const leftHeaderWidth =\n (this.table as ListTable).transpose || (this.table as PivotTable).options.indicatorsAsCol === false\n ? this.table.getFrozenColsWidth()\n : 0;\n const topHeaderHeight =\n !(this.table as ListTable).transpose || (this.table as PivotTable).options.indicatorsAsCol\n ? this.table.getFrozenRowsHeight()\n : 0;\n const width =\n (this.table.columnHeaderLevelCount > 0 ? this.table.getDrawRange().width : this.table.tableNoFrameWidth) -\n leftHeaderWidth;\n const height =\n (this.table.rowHeaderLevelCount > 0 ? this.table.getDrawRange().height : this.table.tableNoFrameHeight) -\n topHeaderHeight;\n this._emptyTipComponent.setAttributes({\n spaceBetweenTextAndIcon: this._emptyTipOption.spaceBetweenTextAndIcon,\n x: this.table.tableX + leftHeaderWidth,\n y: this.table.tableY + topHeaderHeight,\n width,\n height,\n text: {\n text: this._emptyTipOption.text,\n ...this._emptyTipOption.textStyle,\n fill: this._emptyTipOption.textStyle?.color\n },\n icon: {\n ...this._emptyTipOption.icon\n }\n });\n }\n\n release(): void {\n this._emptyTipComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._emptyTipComponent);\n this._emptyTipComponent = null;\n this.isReleased = true;\n }\n resetVisible() {\n if (!this.table.recordsCount || this.table.recordsCount === 0) {\n this._emptyTipComponent.setAttributes({\n visible: true\n });\n this._emptyTipComponent.showAll();\n } else {\n this._emptyTipComponent.setAttributes({\n visible: false\n });\n this._emptyTipComponent.hideAll();\n }\n }\n\n private _getEmptyTipAttrs() {\n const leftHeaderWidth =\n (this.table as ListTable).transpose || (this.table as PivotTable).options.indicatorsAsCol === false\n ? this.table.getFrozenColsWidth()\n : 0;\n const topHeaderHeight =\n !(this.table as ListTable).transpose || (this.table as PivotTable).options.indicatorsAsCol\n ? this.table.getFrozenRowsHeight()\n : 0;\n const width =\n (this.table.columnHeaderLevelCount > 0 ? this.table.getDrawRange().width : this.table.tableNoFrameWidth) -\n leftHeaderWidth;\n const height =\n (this.table.rowHeaderLevelCount > 0 ? this.table.getDrawRange().height : this.table.tableNoFrameHeight) -\n topHeaderHeight;\n\n return {\n spaceBetweenTextAndIcon: this._emptyTipOption.spaceBetweenTextAndIcon,\n x: this.table.tableX + leftHeaderWidth,\n y: this.table.tableY + topHeaderHeight,\n width,\n height,\n text: {\n text: this._emptyTipOption.text,\n ...this._emptyTipOption.textStyle,\n fill: this._emptyTipOption.textStyle?.color\n },\n icon: {\n ...this._emptyTipOption.icon\n }\n // visible:this.table.recordsCount === 0?true:false\n } as EmptyTipAttributes;\n }\n}\n"]}
|
package/cjs/core/BaseTable.js
CHANGED
|
@@ -45,7 +45,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
45
45
|
}
|
|
46
46
|
constructor(container, options = {}) {
|
|
47
47
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
48
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.
|
|
48
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.1.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;
|
|
@@ -75,7 +75,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
75
75
|
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
|
|
76
76
|
internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
|
|
77
77
|
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.columnResizeMode = columnResizeMode,
|
|
78
|
-
internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = dragHeaderMode,
|
|
78
|
+
internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = null != dragHeaderMode ? dragHeaderMode : "none",
|
|
79
79
|
internalProps.renderChartAsync = renderChartAsync, (0, chart_render_helper_1.setBatchRenderChartCount)(renderChartAsyncBatchCount),
|
|
80
80
|
internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
|
|
81
81
|
internalProps._rowHeightsMap = new row_height_map_1.NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map,
|
|
@@ -141,7 +141,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
141
141
|
var _a;
|
|
142
142
|
this._updateSize(), null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach((legend => {
|
|
143
143
|
null == legend || legend.resize();
|
|
144
|
-
})), this.internalProps.title && this.internalProps.title.resize(), this.
|
|
144
|
+
})), this.internalProps.title && this.internalProps.title.resize(), this.internalProps.emptyTip && this.internalProps.emptyTip.resize(),
|
|
145
|
+
this.scenegraph.resize();
|
|
145
146
|
}
|
|
146
147
|
get rowCount() {
|
|
147
148
|
return this.internalProps.rowCount;
|
|
@@ -742,7 +743,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
742
743
|
this.release();
|
|
743
744
|
}
|
|
744
745
|
release() {
|
|
745
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
746
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
746
747
|
const internalProps = this.internalProps;
|
|
747
748
|
null === (_b = null === (_a = internalProps.tooltipHandler) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a),
|
|
748
749
|
null === (_d = null === (_c = internalProps.menuHandler) || void 0 === _c ? void 0 : _c.release) || void 0 === _d || _d.call(_c),
|
|
@@ -751,20 +752,21 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
751
752
|
null === (_j = null === (_h = internalProps.focusControl) || void 0 === _h ? void 0 : _h.release) || void 0 === _j || _j.call(_h),
|
|
752
753
|
null === (_k = internalProps.legends) || void 0 === _k || _k.forEach((legend => {
|
|
753
754
|
null == legend || legend.release();
|
|
754
|
-
})), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.
|
|
755
|
-
|
|
755
|
+
})), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.title = null,
|
|
756
|
+
null === (_m = internalProps.emptyTip) || void 0 === _m || _m.release(), internalProps.emptyTip = null,
|
|
757
|
+
internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
|
|
756
758
|
var _a;
|
|
757
759
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
758
760
|
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
759
761
|
const {parentElement: parentElement} = internalProps.element;
|
|
760
|
-
parentElement && parentElement.removeChild(internalProps.element), null === (
|
|
762
|
+
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),
|
|
761
763
|
this.isReleased = !0;
|
|
762
764
|
}
|
|
763
765
|
fireListeners(type, event) {
|
|
764
766
|
return super.fireListeners(type, event);
|
|
765
767
|
}
|
|
766
768
|
updateOption(options) {
|
|
767
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
769
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
768
770
|
this.options = options, this._hasAutoImageColumn = void 0;
|
|
769
771
|
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth = 80, 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, pixelRatio: pixelRatio, widthMode: widthMode, heightMode: heightMode, autoFillWidth: autoFillWidth, autoFillHeight: autoFillHeight, widthAdaptiveMode: widthAdaptiveMode, heightAdaptiveMode: heightAdaptiveMode, customRender: customRender, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight} = options;
|
|
770
772
|
pixelRatio && pixelRatio !== this.internalProps.pixelRatio && (this.internalProps.pixelRatio = pixelRatio),
|
|
@@ -786,7 +788,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
786
788
|
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
|
|
787
789
|
internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
|
|
788
790
|
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.columnResizeMode = columnResizeMode,
|
|
789
|
-
internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = dragHeaderMode,
|
|
791
|
+
internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = null != dragHeaderMode ? dragHeaderMode : "none",
|
|
790
792
|
internalProps.renderChartAsync = renderChartAsync, (0, chart_render_helper_1.setBatchRenderChartCount)(renderChartAsyncBatchCount),
|
|
791
793
|
internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
|
|
792
794
|
internalProps.cellTextOverflows = {}, internalProps._rowHeightsMap = new row_height_map_1.NumberRangeMap(this),
|
|
@@ -802,10 +804,11 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
802
804
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
803
805
|
this._vDataSet = new vdataset_1.DataSet, null === (_e = internalProps.legends) || void 0 === _e || _e.forEach((legend => {
|
|
804
806
|
null == legend || legend.release();
|
|
805
|
-
})), null === (_f = internalProps.title) || void 0 === _f || _f.release(), internalProps.
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
807
|
+
})), null === (_f = internalProps.title) || void 0 === _f || _f.release(), internalProps.title = null,
|
|
808
|
+
null === (_g = internalProps.emptyTip) || void 0 === _g || _g.release(), internalProps.emptyTip = null,
|
|
809
|
+
internalProps.layoutMap.release(), this.scenegraph.clearCells(), this.scenegraph.updateComponent(),
|
|
810
|
+
this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(),
|
|
811
|
+
options.legends) if (internalProps.legends = [], Array.isArray(options.legends)) {
|
|
809
812
|
for (let i = 0; i < options.legends.length; i++) internalProps.legends.push((0,
|
|
810
813
|
create_legend_1.createLegend)(options.legends[i], this));
|
|
811
814
|
this.scenegraph.tableGroup.setAttributes({
|
|
@@ -824,11 +827,11 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
824
827
|
}, options.tooltip), "html" !== internalProps.tooltip.renderMode || internalProps.tooltipHandler || (internalProps.tooltipHandler = new TooltipHandler_1.TooltipHandler(this, internalProps.tooltip.confine)),
|
|
825
828
|
internalProps.menu = Object.assign({
|
|
826
829
|
renderMode: "html"
|
|
827
|
-
}, options.menu), Array.isArray(null === (
|
|
828
|
-
Array.isArray(null === (
|
|
830
|
+
}, options.menu), Array.isArray(null === (_h = options.menu) || void 0 === _h ? void 0 : _h.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_j = options.menu) || void 0 === _j ? void 0 : _j.dropDownMenuHighlight),
|
|
831
|
+
Array.isArray(null === (_k = options.menu) || void 0 === _k ? void 0 : _k.defaultHeaderMenuItems) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
|
|
829
832
|
"html" !== internalProps.menu.renderMode || internalProps.menuHandler || (internalProps.menuHandler = new MenuHandler_1.MenuHandler(this)),
|
|
830
833
|
this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(),
|
|
831
|
-
internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin.updateCustomCell(null !== (
|
|
834
|
+
internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin.updateCustomCell(null !== (_l = options.customCellStyle) && void 0 !== _l ? _l : [], null !== (_m = options.customCellStyleArrangement) && void 0 !== _m ? _m : []);
|
|
832
835
|
}
|
|
833
836
|
renderWithRecreateCells() {
|
|
834
837
|
const oldHoverState = {
|
|
@@ -1378,14 +1381,17 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1378
1381
|
return !0;
|
|
1379
1382
|
}
|
|
1380
1383
|
_canDragHeaderPosition(col, row) {
|
|
1381
|
-
|
|
1384
|
+
var _a, _b;
|
|
1385
|
+
if (this.isHeader(col, row) && (this.stateManager.isSelected(col, row) || (null === (_a = this.options.select) || void 0 === _a ? void 0 : _a.disableHeaderSelect) || (null === (_b = this.options.select) || void 0 === _b ? void 0 : _b.disableSelect))) {
|
|
1382
1386
|
if ("disabled" === this.internalProps.frozenColDragHeaderMode && this.isFrozenColumn(col)) return !1;
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
if (
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1387
|
+
if (this.stateManager.isSelected(col, row)) {
|
|
1388
|
+
const selectRange = this.stateManager.select.ranges[0];
|
|
1389
|
+
if (this.isColumnHeader(col, row)) {
|
|
1390
|
+
if (selectRange.end.row !== this.rowCount - 1) return !1;
|
|
1391
|
+
} else {
|
|
1392
|
+
if (!this.isRowHeader(col, row)) return !1;
|
|
1393
|
+
if (selectRange.end.col !== this.colCount - 1) return !1;
|
|
1394
|
+
}
|
|
1389
1395
|
}
|
|
1390
1396
|
const define = this.getHeaderDefine(col, row);
|
|
1391
1397
|
if (!define) return !1;
|