@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,79 @@
|
|
|
1
|
+
import { EmptyTip as EmptyTipComponents } from "@visactor/vrender-components";
|
|
2
|
+
|
|
3
|
+
import { isEqual } from "@visactor/vutils";
|
|
4
|
+
|
|
5
|
+
const 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>';
|
|
6
|
+
|
|
7
|
+
export class EmptyTip {
|
|
8
|
+
constructor(emptyTipOption, table) {
|
|
9
|
+
this._emptyTipOption = {
|
|
10
|
+
spaceBetweenTextAndIcon: 20,
|
|
11
|
+
text: "no data",
|
|
12
|
+
textStyle: {
|
|
13
|
+
fontSize: 14,
|
|
14
|
+
color: "#000"
|
|
15
|
+
},
|
|
16
|
+
icon: {
|
|
17
|
+
image: emptyTipSvg,
|
|
18
|
+
width: 100,
|
|
19
|
+
height: 100
|
|
20
|
+
}
|
|
21
|
+
}, this.isReleased = !1, this.table = table, this._emptyTipOption = Object.assign(this._emptyTipOption, !0 === emptyTipOption ? {} : emptyTipOption),
|
|
22
|
+
this._emptyTipComponent = this._createOrUpdateEmptyTipComponent(this._getEmptyTipAttrs());
|
|
23
|
+
}
|
|
24
|
+
_createOrUpdateEmptyTipComponent(attrs) {
|
|
25
|
+
if (this._emptyTipComponent) isEqual(attrs, this._cacheAttrs) || this._emptyTipComponent.setAttributes(attrs); else {
|
|
26
|
+
const emptyTip = new EmptyTipComponents(attrs);
|
|
27
|
+
emptyTip.name = "emptyTip", this.table.scenegraph.stage.defaultLayer.appendChild(emptyTip),
|
|
28
|
+
this._emptyTipComponent = emptyTip;
|
|
29
|
+
}
|
|
30
|
+
return this._emptyTipComponent;
|
|
31
|
+
}
|
|
32
|
+
resize() {
|
|
33
|
+
var _a;
|
|
34
|
+
if (!this._emptyTipComponent) return;
|
|
35
|
+
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;
|
|
36
|
+
this._emptyTipComponent.setAttributes({
|
|
37
|
+
spaceBetweenTextAndIcon: this._emptyTipOption.spaceBetweenTextAndIcon,
|
|
38
|
+
x: this.table.tableX + leftHeaderWidth,
|
|
39
|
+
y: this.table.tableY + topHeaderHeight,
|
|
40
|
+
width: width,
|
|
41
|
+
height: height,
|
|
42
|
+
text: Object.assign(Object.assign({
|
|
43
|
+
text: this._emptyTipOption.text
|
|
44
|
+
}, this._emptyTipOption.textStyle), {
|
|
45
|
+
fill: null === (_a = this._emptyTipOption.textStyle) || void 0 === _a ? void 0 : _a.color
|
|
46
|
+
}),
|
|
47
|
+
icon: Object.assign({}, this._emptyTipOption.icon)
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
release() {
|
|
51
|
+
this._emptyTipComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._emptyTipComponent),
|
|
52
|
+
this._emptyTipComponent = null, this.isReleased = !0;
|
|
53
|
+
}
|
|
54
|
+
resetVisible() {
|
|
55
|
+
this.table.recordsCount && 0 !== this.table.recordsCount ? (this._emptyTipComponent.setAttributes({
|
|
56
|
+
visible: !1
|
|
57
|
+
}), this._emptyTipComponent.hideAll()) : (this._emptyTipComponent.setAttributes({
|
|
58
|
+
visible: !0
|
|
59
|
+
}), this._emptyTipComponent.showAll());
|
|
60
|
+
}
|
|
61
|
+
_getEmptyTipAttrs() {
|
|
62
|
+
var _a;
|
|
63
|
+
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;
|
|
64
|
+
return {
|
|
65
|
+
spaceBetweenTextAndIcon: this._emptyTipOption.spaceBetweenTextAndIcon,
|
|
66
|
+
x: this.table.tableX + leftHeaderWidth,
|
|
67
|
+
y: this.table.tableY + topHeaderHeight,
|
|
68
|
+
width: width,
|
|
69
|
+
height: height,
|
|
70
|
+
text: Object.assign(Object.assign({
|
|
71
|
+
text: this._emptyTipOption.text
|
|
72
|
+
}, this._emptyTipOption.textStyle), {
|
|
73
|
+
fill: null === (_a = this._emptyTipOption.textStyle) || void 0 === _a ? void 0 : _a.color
|
|
74
|
+
}),
|
|
75
|
+
icon: Object.assign({}, this._emptyTipOption.icon)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=empty-tip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/empty-tip/empty-tip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAK9E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,MAAM,WAAW,GACf,4pDAA4pD,CAAC;AAE/pD,MAAM,OAAO,QAAQ;IAkBnB,YAAY,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AC,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","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/es/core/BaseTable.js
CHANGED
|
@@ -84,7 +84,7 @@ export class BaseTable extends EventTarget {
|
|
|
84
84
|
}
|
|
85
85
|
constructor(container, options = {}) {
|
|
86
86
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
87
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.
|
|
87
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.1.0", this.id = `VTable${Date.now()}`,
|
|
88
88
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
89
89
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
90
90
|
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
@@ -113,7 +113,7 @@ export class BaseTable extends EventTarget {
|
|
|
113
113
|
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
|
|
114
114
|
internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
|
|
115
115
|
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.columnResizeMode = columnResizeMode,
|
|
116
|
-
internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = dragHeaderMode,
|
|
116
|
+
internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = null != dragHeaderMode ? dragHeaderMode : "none",
|
|
117
117
|
internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount),
|
|
118
118
|
internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
|
|
119
119
|
internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map,
|
|
@@ -176,7 +176,8 @@ export class BaseTable extends EventTarget {
|
|
|
176
176
|
var _a;
|
|
177
177
|
this._updateSize(), null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach((legend => {
|
|
178
178
|
null == legend || legend.resize();
|
|
179
|
-
})), this.internalProps.title && this.internalProps.title.resize(), this.
|
|
179
|
+
})), this.internalProps.title && this.internalProps.title.resize(), this.internalProps.emptyTip && this.internalProps.emptyTip.resize(),
|
|
180
|
+
this.scenegraph.resize();
|
|
180
181
|
}
|
|
181
182
|
get rowCount() {
|
|
182
183
|
return this.internalProps.rowCount;
|
|
@@ -775,7 +776,7 @@ export class BaseTable extends EventTarget {
|
|
|
775
776
|
this.release();
|
|
776
777
|
}
|
|
777
778
|
release() {
|
|
778
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
779
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
779
780
|
const internalProps = this.internalProps;
|
|
780
781
|
null === (_b = null === (_a = internalProps.tooltipHandler) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a),
|
|
781
782
|
null === (_d = null === (_c = internalProps.menuHandler) || void 0 === _c ? void 0 : _c.release) || void 0 === _d || _d.call(_c),
|
|
@@ -784,20 +785,21 @@ export class BaseTable extends EventTarget {
|
|
|
784
785
|
null === (_j = null === (_h = internalProps.focusControl) || void 0 === _h ? void 0 : _h.release) || void 0 === _j || _j.call(_h),
|
|
785
786
|
null === (_k = internalProps.legends) || void 0 === _k || _k.forEach((legend => {
|
|
786
787
|
null == legend || legend.release();
|
|
787
|
-
})), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.
|
|
788
|
-
|
|
788
|
+
})), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.title = null,
|
|
789
|
+
null === (_m = internalProps.emptyTip) || void 0 === _m || _m.release(), internalProps.emptyTip = null,
|
|
790
|
+
internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
|
|
789
791
|
var _a;
|
|
790
792
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
791
793
|
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
792
794
|
const {parentElement: parentElement} = internalProps.element;
|
|
793
|
-
parentElement && parentElement.removeChild(internalProps.element), null === (
|
|
795
|
+
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),
|
|
794
796
|
this.isReleased = !0;
|
|
795
797
|
}
|
|
796
798
|
fireListeners(type, event) {
|
|
797
799
|
return super.fireListeners(type, event);
|
|
798
800
|
}
|
|
799
801
|
updateOption(options) {
|
|
800
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
802
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
801
803
|
this.options = options, this._hasAutoImageColumn = void 0;
|
|
802
804
|
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;
|
|
803
805
|
pixelRatio && pixelRatio !== this.internalProps.pixelRatio && (this.internalProps.pixelRatio = pixelRatio),
|
|
@@ -819,7 +821,7 @@ export class BaseTable extends EventTarget {
|
|
|
819
821
|
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
|
|
820
822
|
internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
|
|
821
823
|
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.columnResizeMode = columnResizeMode,
|
|
822
|
-
internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = dragHeaderMode,
|
|
824
|
+
internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = null != dragHeaderMode ? dragHeaderMode : "none",
|
|
823
825
|
internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount),
|
|
824
826
|
internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
|
|
825
827
|
internalProps.cellTextOverflows = {}, internalProps._rowHeightsMap = new NumberRangeMap(this),
|
|
@@ -835,10 +837,11 @@ export class BaseTable extends EventTarget {
|
|
|
835
837
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
836
838
|
this._vDataSet = new DataSet, null === (_e = internalProps.legends) || void 0 === _e || _e.forEach((legend => {
|
|
837
839
|
null == legend || legend.release();
|
|
838
|
-
})), null === (_f = internalProps.title) || void 0 === _f || _f.release(), internalProps.
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
840
|
+
})), null === (_f = internalProps.title) || void 0 === _f || _f.release(), internalProps.title = null,
|
|
841
|
+
null === (_g = internalProps.emptyTip) || void 0 === _g || _g.release(), internalProps.emptyTip = null,
|
|
842
|
+
internalProps.layoutMap.release(), this.scenegraph.clearCells(), this.scenegraph.updateComponent(),
|
|
843
|
+
this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(),
|
|
844
|
+
options.legends) if (internalProps.legends = [], Array.isArray(options.legends)) {
|
|
842
845
|
for (let i = 0; i < options.legends.length; i++) internalProps.legends.push(createLegend(options.legends[i], this));
|
|
843
846
|
this.scenegraph.tableGroup.setAttributes({
|
|
844
847
|
x: this.tableX,
|
|
@@ -855,11 +858,11 @@ export class BaseTable extends EventTarget {
|
|
|
855
858
|
}, options.tooltip), "html" !== internalProps.tooltip.renderMode || internalProps.tooltipHandler || (internalProps.tooltipHandler = new TooltipHandler(this, internalProps.tooltip.confine)),
|
|
856
859
|
internalProps.menu = Object.assign({
|
|
857
860
|
renderMode: "html"
|
|
858
|
-
}, options.menu), Array.isArray(null === (
|
|
859
|
-
Array.isArray(null === (
|
|
861
|
+
}, 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),
|
|
862
|
+
Array.isArray(null === (_k = options.menu) || void 0 === _k ? void 0 : _k.defaultHeaderMenuItems) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
|
|
860
863
|
"html" !== internalProps.menu.renderMode || internalProps.menuHandler || (internalProps.menuHandler = new MenuHandler(this)),
|
|
861
864
|
this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(),
|
|
862
|
-
internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin.updateCustomCell(null !== (
|
|
865
|
+
internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin.updateCustomCell(null !== (_l = options.customCellStyle) && void 0 !== _l ? _l : [], null !== (_m = options.customCellStyleArrangement) && void 0 !== _m ? _m : []);
|
|
863
866
|
}
|
|
864
867
|
renderWithRecreateCells() {
|
|
865
868
|
const oldHoverState = {
|
|
@@ -1407,14 +1410,17 @@ export class BaseTable extends EventTarget {
|
|
|
1407
1410
|
return !0;
|
|
1408
1411
|
}
|
|
1409
1412
|
_canDragHeaderPosition(col, row) {
|
|
1410
|
-
|
|
1413
|
+
var _a, _b;
|
|
1414
|
+
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))) {
|
|
1411
1415
|
if ("disabled" === this.internalProps.frozenColDragHeaderMode && this.isFrozenColumn(col)) return !1;
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
if (
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1416
|
+
if (this.stateManager.isSelected(col, row)) {
|
|
1417
|
+
const selectRange = this.stateManager.select.ranges[0];
|
|
1418
|
+
if (this.isColumnHeader(col, row)) {
|
|
1419
|
+
if (selectRange.end.row !== this.rowCount - 1) return !1;
|
|
1420
|
+
} else {
|
|
1421
|
+
if (!this.isRowHeader(col, row)) return !1;
|
|
1422
|
+
if (selectRange.end.col !== this.colCount - 1) return !1;
|
|
1423
|
+
}
|
|
1418
1424
|
}
|
|
1419
1425
|
const define = this.getHeaderDefine(col, row);
|
|
1420
1426
|
if (!define) return !1;
|