@visactor/vtable 1.15.1-alpha.1 → 1.15.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ListTable.d.ts +3 -3
- package/cjs/ListTable.js +6 -8
- package/cjs/ListTable.js.map +1 -1
- package/cjs/components/empty-tip/empty-tip.d.ts +6 -0
- package/cjs/components/empty-tip/empty-tip.js +11 -2
- package/cjs/components/empty-tip/empty-tip.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +3 -2
- package/cjs/core/BaseTable.js +42 -10
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/record-helper.d.ts +3 -3
- package/cjs/core/record-helper.js +24 -16
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/core/tableHelper.js +5 -5
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/core/utils/get-cell-position.d.ts +2 -12
- package/cjs/core/utils/get-cell-position.js +6 -8
- package/cjs/core/utils/get-cell-position.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +13 -5
- package/cjs/data/CachedDataSource.js +106 -15
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/data/DataSource.d.ts +16 -8
- package/cjs/data/DataSource.js +71 -33
- package/cjs/data/DataSource.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/simple-header-layout.js +1 -1
- package/cjs/layout/simple-header-layout.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/column-helper.js +2 -2
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +7 -13
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.js +1 -1
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/state/checkbox/checkbox.js +1 -1
- package/cjs/state/checkbox/checkbox.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +4 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +3 -2
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +406 -120
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +3 -3
- package/es/ListTable.js +7 -8
- package/es/ListTable.js.map +1 -1
- package/es/components/empty-tip/empty-tip.d.ts +6 -0
- package/es/components/empty-tip/empty-tip.js +11 -2
- package/es/components/empty-tip/empty-tip.js.map +1 -1
- package/es/core/BaseTable.d.ts +3 -2
- package/es/core/BaseTable.js +42 -10
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/record-helper.d.ts +3 -3
- package/es/core/record-helper.js +24 -16
- package/es/core/record-helper.js.map +1 -1
- package/es/core/tableHelper.js +5 -5
- package/es/core/tableHelper.js.map +1 -1
- package/es/core/utils/get-cell-position.d.ts +2 -12
- package/es/core/utils/get-cell-position.js +6 -8
- package/es/core/utils/get-cell-position.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +13 -5
- package/es/data/CachedDataSource.js +106 -17
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/data/DataSource.d.ts +16 -8
- package/es/data/DataSource.js +75 -37
- package/es/data/DataSource.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/simple-header-layout.js +1 -1
- package/es/layout/simple-header-layout.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/column-helper.js +2 -2
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +7 -13
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/stick-text/index.js +1 -1
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/state/checkbox/checkbox.js +1 -1
- package/es/state/checkbox/checkbox.js.map +1 -1
- package/es/ts-types/base-table.d.ts +4 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +3 -2
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/empty-tip/empty-tip.ts"],"names":[],"mappings":";;;AAAA,6CAAiE;AAKjE,6CAA2E;AAI3E,MAAM,WAAW,GACf,4pDAA4pD,CAAC;AAM/pD,MAAa,QAAQ;IAkBnB,YAAY,cAAgC,EAAE,KAAmB;QAhBjE,oBAAe,GAAc;YAC3B,uBAAuB,EAAE,EAAE;YAC3B,IAAI,EAAE,SAAS;YACf,SAAS,EAAE;gBACT,QAAQ,EAAE,EAAE;gBACZ,KAAK,EAAE,MAAM;aACd;YACD,IAAI,EAAE;gBACJ,KAAK,EAAE,WAAW;gBAClB,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;aACZ;SACF,CAAC;QACF,eAAU,GAAY,KAAK,CAAC;QAI1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,IAAA,kBAAS,EAAC,cAAc,CAAC,IAAI,CAAC,IAAA,gBAAO,EAAC,cAAc,CAAC,WAAW,CAAC,EAAE;YAEtE,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE;gBAC5B,cAAc,CAAC,WAAW,GAAG,cAAc,CAAC;aAC7C;iBAAM;gBACL,cAAc,CAAC,WAAW,GAAG,kBAAkB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I,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;AA7LD,4BA6LC","file":"empty-tip.js","sourcesContent":["import { EmptyTip as EmptyTipComponents } from './../../vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport type { EmptyTipAttributes, FederatedPointerEvent } from './../../vrender';\nimport type { IEmptyTip } from '../../ts-types/component/empty-tip';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { AABBBounds, isBoolean, isEqual, isValid } from '@visactor/vutils';\nimport type { ListTable } from '../../ListTable';\nimport type { PivotTable } from '../../PivotTable';\nimport type { BaseTable } from '../../core';\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 interface IEmptyTipComponent {\n new (emptyTipOption: IEmptyTip | true, table: BaseTableAPI): EmptyTip;\n}\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 // deal with displayMode\n if (!isBoolean(emptyTipOption) && !isValid(emptyTipOption.displayMode)) {\n // for list table and pivot table current display effect\n if (this.table.isListTable()) {\n emptyTipOption.displayMode = 'basedOnTable';\n } else {\n emptyTipOption.displayMode = 'basedOnContainer';\n }\n }\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\n // bind events\n this.bindEvents();\n }\n // update table size\n // this._adjustTableSize(this._emptyTipComponent.attribute);\n return this._emptyTipComponent;\n }\n\n bindEvents() {\n this._emptyTipComponent.on('click', (e: FederatedPointerEvent) => {\n const bounds = new AABBBounds();\n this._emptyTipComponent.forEachChildren((child: any) => {\n bounds.union(child.globalAABBBounds);\n });\n if (bounds.contains(e.x, e.y)) {\n this.table.fireListeners('empty_tip_click', e);\n return;\n }\n });\n this._emptyTipComponent.on('dblclick', (e: FederatedPointerEvent) => {\n const bounds = new AABBBounds();\n this._emptyTipComponent.forEachChildren((child: any) => {\n bounds.union(child.globalAABBBounds);\n });\n if (bounds.contains(e.x, e.y)) {\n this.table.fireListeners('empty_tip_dblclick', e);\n return;\n }\n });\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.isListTable()\n ? this.table.getDrawRange().width\n : this.table.tableNoFrameWidth) -\n leftHeaderWidth -\n (this.table as BaseTable).getTheme().scrollStyle.width;\n\n const height =\n (this.table.rowHeaderLevelCount > 0 && this.table.isListTable()\n ? this.table.getDrawRange().height\n : this.table.tableNoFrameHeight) -\n topHeaderHeight -\n (this.table as BaseTable).getTheme().scrollStyle.width;\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 (\n ((!this.table.recordsCount || this.table.recordsCount === 0) &&\n this.table.internalProps.layoutMap.rowCount === this.table.internalProps.layoutMap.columnHeaderLevelCount) ||\n this.table.internalProps.layoutMap.colCount === this.table.internalProps.layoutMap.rowHeaderLevelCount\n ) {\n // this._emptyTipComponent.setAttributes({\n // visible: true\n // });\n // this._emptyTipComponent.showAll();\n if (!this.table.scenegraph.stage.defaultLayer.children.includes(this._emptyTipComponent)) {\n this.table.scenegraph.stage.defaultLayer.appendChild(this._emptyTipComponent);\n }\n } else {\n // this._emptyTipComponent.setAttributes({\n // visible: false\n // });\n // this._emptyTipComponent.hideAll();\n if (this.table.scenegraph.stage.defaultLayer.children.includes(this._emptyTipComponent)) {\n this.table.scenegraph.stage.defaultLayer.removeChild(this._emptyTipComponent);\n }\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._emptyTipOption.displayMode !== 'basedOnContainer' &&\n this.table.columnHeaderLevelCount > 0 &&\n this.table.colCount > this.table.rowHeaderLevelCount\n ? this.table.getDrawRange().width\n : this.table.tableNoFrameWidth) -\n leftHeaderWidth -\n (this.table as BaseTable).getTheme().scrollStyle.width;\n const height =\n (this._emptyTipOption.displayMode !== 'basedOnContainer' &&\n this.table.rowHeaderLevelCount > 0 &&\n this.table.rowCount > this.table.columnHeaderLevelCount\n ? this.table.getDrawRange().height\n : this.table.tableNoFrameHeight) -\n topHeaderHeight -\n (this.table as BaseTable).getTheme().scrollStyle.width;\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"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/empty-tip/empty-tip.ts"],"names":[],"mappings":";;;AAAA,6CAAiE;AAKjE,6CAA2E;AAI3E,MAAM,WAAW,GACf,4pDAA4pD,CAAC;AAM/pD,MAAa,QAAQ;IAkBnB,YAAY,cAAgC,EAAE,KAAmB;QAhBjE,oBAAe,GAAc;YAC3B,uBAAuB,EAAE,EAAE;YAC3B,IAAI,EAAE,SAAS;YACf,SAAS,EAAE;gBACT,QAAQ,EAAE,EAAE;gBACZ,KAAK,EAAE,MAAM;aACd;YACD,IAAI,EAAE;gBACJ,KAAK,EAAE,WAAW;gBAClB,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;aACZ;SACF,CAAC;QACF,eAAU,GAAY,KAAK,CAAC;QAI1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,IAAA,kBAAS,EAAC,cAAc,CAAC,IAAI,CAAC,IAAA,gBAAO,EAAC,cAAc,CAAC,WAAW,CAAC,EAAE;YAEtE,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE;gBAC5B,cAAc,CAAC,WAAW,GAAG,cAAc,CAAC;aAC7C;iBAAM;gBACL,cAAc,CAAC,WAAW,GAAG,kBAAkB,CAAC;aACjD;SACF;QACD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,e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;IAEO,iBAAiB;;QACvB,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAErF,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;AAnLD,4BAmLC","file":"empty-tip.js","sourcesContent":["import { EmptyTip as EmptyTipComponents } from './../../vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport type { EmptyTipAttributes, FederatedPointerEvent } from './../../vrender';\nimport type { IEmptyTip } from '../../ts-types/component/empty-tip';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { AABBBounds, isBoolean, isEqual, isValid } from '@visactor/vutils';\nimport type { ListTable } from '../../ListTable';\nimport type { PivotTable } from '../../PivotTable';\nimport type { BaseTable } from '../../core';\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 interface IEmptyTipComponent {\n new (emptyTipOption: IEmptyTip | true, table: BaseTableAPI): EmptyTip;\n}\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 // deal with displayMode\n if (!isBoolean(emptyTipOption) && !isValid(emptyTipOption.displayMode)) {\n // for list table and pivot table current display effect\n if (this.table.isListTable()) {\n emptyTipOption.displayMode = 'basedOnTable';\n } else {\n emptyTipOption.displayMode = 'basedOnContainer';\n }\n }\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\n // bind events\n this.bindEvents();\n }\n // update table size\n // this._adjustTableSize(this._emptyTipComponent.attribute);\n return this._emptyTipComponent;\n }\n\n bindEvents() {\n this._emptyTipComponent.on('click', (e: FederatedPointerEvent) => {\n const bounds = new AABBBounds();\n this._emptyTipComponent.forEachChildren((child: any) => {\n bounds.union(child.globalAABBBounds);\n });\n if (bounds.contains(e.x, e.y)) {\n this.table.fireListeners('empty_tip_click', e);\n return;\n }\n });\n this._emptyTipComponent.on('dblclick', (e: FederatedPointerEvent) => {\n const bounds = new AABBBounds();\n this._emptyTipComponent.forEachChildren((child: any) => {\n bounds.union(child.globalAABBBounds);\n });\n if (bounds.contains(e.x, e.y)) {\n this.table.fireListeners('empty_tip_dblclick', e);\n return;\n }\n });\n }\n\n resize() {\n if (!this._emptyTipComponent) {\n return;\n }\n const { leftHeaderWidth, topHeaderHeight, width, height } = this.getWidthAndHeight();\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 (\n ((!this.table.recordsCount || this.table.recordsCount === 0) &&\n this.table.internalProps.layoutMap.rowCount === this.table.internalProps.layoutMap.columnHeaderLevelCount) ||\n this.table.internalProps.layoutMap.colCount === this.table.internalProps.layoutMap.rowHeaderLevelCount\n ) {\n // this._emptyTipComponent.setAttributes({\n // visible: true\n // });\n // this._emptyTipComponent.showAll();\n if (!this.table.scenegraph.stage.defaultLayer.children.includes(this._emptyTipComponent)) {\n this.table.scenegraph.stage.defaultLayer.appendChild(this._emptyTipComponent);\n }\n } else {\n // this._emptyTipComponent.setAttributes({\n // visible: false\n // });\n // this._emptyTipComponent.hideAll();\n if (this.table.scenegraph.stage.defaultLayer.children.includes(this._emptyTipComponent)) {\n this.table.scenegraph.stage.defaultLayer.removeChild(this._emptyTipComponent);\n }\n }\n }\n\n getWidthAndHeight() {\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._emptyTipOption.displayMode !== 'basedOnContainer' &&\n this.table.columnHeaderLevelCount > 0 &&\n this.table.colCount > this.table.rowHeaderLevelCount\n ? this.table.getDrawRange().width\n : this.table.tableNoFrameWidth) -\n leftHeaderWidth -\n (this.table as BaseTable).getTheme().scrollStyle.width;\n const height =\n (this._emptyTipOption.displayMode !== 'basedOnContainer' &&\n this.table.rowHeaderLevelCount > 0 &&\n this.table.rowCount > this.table.columnHeaderLevelCount\n ? this.table.getDrawRange().height\n : this.table.tableNoFrameHeight) -\n topHeaderHeight -\n (this.table as BaseTable).getTheme().scrollStyle.width;\n return {\n leftHeaderWidth,\n topHeaderHeight,\n width,\n height\n };\n }\n\n private _getEmptyTipAttrs() {\n const { leftHeaderWidth, topHeaderHeight, width, height } = this.getWidthAndHeight();\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.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
74
74
|
reactCustomLayout?: ReactCustomLayout;
|
|
75
75
|
_hasAutoImageColumn?: boolean;
|
|
76
76
|
constructor(container: HTMLElement, options?: BaseTableConstructorOptions);
|
|
77
|
+
_adjustCanvasSizeByOption(): void;
|
|
77
78
|
throttleInvalidate: (this: any, ...args: any[]) => void;
|
|
78
79
|
getContainer(): HTMLElement;
|
|
79
80
|
getElement(): HTMLElement;
|
|
@@ -296,8 +297,8 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
296
297
|
get rowHeaderLevelCount(): number;
|
|
297
298
|
get columnHeaderLevelCount(): number;
|
|
298
299
|
get records(): any;
|
|
299
|
-
get dataSource():
|
|
300
|
-
set dataSource(dataSource:
|
|
300
|
+
get dataSource(): CachedDataSource | DataSource;
|
|
301
|
+
set dataSource(dataSource: CachedDataSource | DataSource);
|
|
301
302
|
get autoWrapText(): boolean;
|
|
302
303
|
set autoWrapText(autoWrapText: boolean);
|
|
303
304
|
get enableLineBreak(): boolean;
|
package/cjs/core/BaseTable.js
CHANGED
|
@@ -43,7 +43,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
43
43
|
}
|
|
44
44
|
constructor(container, options = {}) {
|
|
45
45
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
46
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.15.
|
|
46
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.15.2-alpha.0", 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
|
!container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
49
49
|
!1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vrender_1.vglobal.isImageAnonymous = !1);
|
|
@@ -61,10 +61,11 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
61
61
|
padding.bottom && (this.padding.bottom = padding.bottom), padding.left && (this.padding.left = padding.left),
|
|
62
62
|
padding.right && (this.padding.right = padding.right))), (0, vutils_1.isValid)(canvasHeight) && (0,
|
|
63
63
|
vutils_1.isValid)(canvasWidth) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0,
|
|
64
|
-
this.tableNoFrameHeight = 0, this.canvasWidth =
|
|
64
|
+
this.tableNoFrameHeight = 0, this.canvasWidth = (0, vutils_1.isNumber)(canvasWidth) ? canvasWidth : void 0,
|
|
65
|
+
this.canvasHeight = (0, vutils_1.isNumber)(canvasHeight) ? canvasHeight : void 0,
|
|
65
66
|
this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal";
|
|
66
67
|
const internalProps = this.internalProps = {};
|
|
67
|
-
|
|
68
|
+
void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
68
69
|
this.options.canvas ? (internalProps.element = this.options.canvas.parentElement,
|
|
69
70
|
internalProps.element.style.position = "relative", internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
|
|
70
71
|
internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== env_1.Env.mode && (internalProps.element = (0,
|
|
@@ -85,12 +86,13 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
85
86
|
internalProps._rowHeightsMap = new row_height_map_1.NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map,
|
|
86
87
|
internalProps._colRangeWidthsMap = new Map, internalProps._widthResizedColMap = new Set,
|
|
87
88
|
internalProps._heightResizedRowMap = new Set, this.colWidthsMap = new NumberMap_1.NumberMap,
|
|
88
|
-
this.colContentWidthsMap = new NumberMap_1.NumberMap, this.colWidthsLimit = {}
|
|
89
|
-
|
|
89
|
+
this.colContentWidthsMap = new NumberMap_1.NumberMap, this.colWidthsLimit = {};
|
|
90
|
+
const that = this;
|
|
91
|
+
if (internalProps.calcWidthContext = {
|
|
90
92
|
_: internalProps,
|
|
91
93
|
get full() {
|
|
92
94
|
var _a;
|
|
93
|
-
return "node" === env_1.Env.mode ? canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
|
|
95
|
+
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);
|
|
94
96
|
}
|
|
95
97
|
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (_d = options.theme) && void 0 !== _d ? _d : themes_1.default.DEFAULT),
|
|
96
98
|
internalProps.theme.isPivot = this.isPivotTable(), (0, icons_2.setIconColor)(internalProps.theme.functionalIconsStyle),
|
|
@@ -141,7 +143,35 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
141
143
|
changedCells: new Map
|
|
142
144
|
}, internalProps.customMergeCell = (0, get_custom_merge_cell_func_1.getCustomMergeCellFunc)(options.customMergeCell);
|
|
143
145
|
const CustomCellStylePlugin = factory_1.Factory.getComponent("customCellStylePlugin");
|
|
144
|
-
CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_k = options.customCellStyle) && void 0 !== _k ? _k : [], null !== (_l = options.customCellStyleArrangement) && void 0 !== _l ? _l : []))
|
|
146
|
+
CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_k = options.customCellStyle) && void 0 !== _k ? _k : [], null !== (_l = options.customCellStyleArrangement) && void 0 !== _l ? _l : [])),
|
|
147
|
+
this._adjustCanvasSizeByOption();
|
|
148
|
+
}
|
|
149
|
+
_adjustCanvasSizeByOption() {
|
|
150
|
+
"auto" !== this.options.canvasHeight && "auto" !== this.options.canvasWidth || setTimeout((() => {
|
|
151
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
152
|
+
let canvasWidth, canvasHeight;
|
|
153
|
+
if ("auto" === this.options.canvasHeight) {
|
|
154
|
+
let borderWidth = 0;
|
|
155
|
+
if (null === (_a = this.theme.frameStyle) || void 0 === _a ? void 0 : _a.innerBorder) {
|
|
156
|
+
borderWidth += null !== (_d = toBoxArray(null !== (_c = null === (_b = this.internalProps.theme.frameStyle) || void 0 === _b ? void 0 : _b.shadowBlur) && void 0 !== _c ? _c : [ 0 ])[1]) && void 0 !== _d ? _d : 0;
|
|
157
|
+
} else if (this.theme.frameStyle) {
|
|
158
|
+
const lineWidths = toBoxArray(null !== (_f = null === (_e = this.internalProps.theme.frameStyle) || void 0 === _e ? void 0 : _e.borderLineWidth) && void 0 !== _f ? _f : [ null ]), shadowWidths = toBoxArray(null !== (_h = null === (_g = this.internalProps.theme.frameStyle) || void 0 === _g ? void 0 : _g.shadowBlur) && void 0 !== _h ? _h : [ 0 ]);
|
|
159
|
+
borderWidth += (null !== (_j = lineWidths[0]) && void 0 !== _j ? _j : 0) + (null !== (_k = shadowWidths[0]) && void 0 !== _k ? _k : 0) + ((null !== (_l = lineWidths[2]) && void 0 !== _l ? _l : 0) + (null !== (_m = shadowWidths[2]) && void 0 !== _m ? _m : 0));
|
|
160
|
+
}
|
|
161
|
+
canvasHeight = Math.min(this.options.maxCanvasHeight ? this.options.maxCanvasHeight - borderWidth : 2e4, this.getAllRowsHeight()) + borderWidth;
|
|
162
|
+
} else canvasHeight = this.canvasHeight;
|
|
163
|
+
if ("auto" === this.options.canvasWidth) {
|
|
164
|
+
let borderWidth = 0;
|
|
165
|
+
if (null === (_o = this.theme.frameStyle) || void 0 === _o ? void 0 : _o.innerBorder) {
|
|
166
|
+
borderWidth += null !== (_r = toBoxArray(null !== (_q = null === (_p = this.internalProps.theme.frameStyle) || void 0 === _p ? void 0 : _p.shadowBlur) && void 0 !== _q ? _q : [ 0 ])[2]) && void 0 !== _r ? _r : 0;
|
|
167
|
+
} else if (this.theme.frameStyle) {
|
|
168
|
+
const lineWidths = toBoxArray(null !== (_t = null === (_s = this.internalProps.theme.frameStyle) || void 0 === _s ? void 0 : _s.borderLineWidth) && void 0 !== _t ? _t : [ null ]), shadowWidths = toBoxArray(null !== (_v = null === (_u = this.internalProps.theme.frameStyle) || void 0 === _u ? void 0 : _u.shadowBlur) && void 0 !== _v ? _v : [ 0 ]);
|
|
169
|
+
borderWidth += (null !== (_w = lineWidths[1]) && void 0 !== _w ? _w : 0) + (null !== (_x = shadowWidths[1]) && void 0 !== _x ? _x : 0) + ((null !== (_y = lineWidths[3]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[3]) && void 0 !== _z ? _z : 0));
|
|
170
|
+
}
|
|
171
|
+
canvasWidth = Math.min(this.options.maxCanvasWidth ? this.options.maxCanvasWidth - borderWidth : 2e4, this.getAllColsWidth()) + borderWidth;
|
|
172
|
+
} else canvasWidth = this.canvasWidth;
|
|
173
|
+
this.setCanvasSize(canvasWidth, canvasHeight);
|
|
174
|
+
}), 0);
|
|
145
175
|
}
|
|
146
176
|
getContainer() {
|
|
147
177
|
return this.container;
|
|
@@ -370,7 +400,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
370
400
|
setPixelRatio(pixelRatio) {
|
|
371
401
|
if (pixelRatio !== this.internalProps.pixelRatio) {
|
|
372
402
|
this.internalProps.pixelRatio = pixelRatio;
|
|
373
|
-
const canvasWidth = this.
|
|
403
|
+
const canvasWidth = this.canvasWidth;
|
|
374
404
|
this.internalProps.calcWidthContext = {
|
|
375
405
|
_: this.internalProps,
|
|
376
406
|
get full() {
|
|
@@ -827,7 +857,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
827
857
|
this._widthAdaptiveMode = null != widthAdaptiveMode ? widthAdaptiveMode : "only-body",
|
|
828
858
|
this._heightAdaptiveMode = null != heightAdaptiveMode ? heightAdaptiveMode : "only-body",
|
|
829
859
|
this.autoFillWidth = null != autoFillWidth && autoFillWidth, this.autoFillHeight = null != autoFillHeight && autoFillHeight,
|
|
830
|
-
this.customRender = customRender, this.canvasWidth =
|
|
860
|
+
this.customRender = customRender, this.canvasWidth = (0, vutils_1.isNumber)(canvasWidth) ? canvasWidth : void 0,
|
|
861
|
+
this.canvasHeight = (0, vutils_1.isNumber)(canvasHeight) ? canvasHeight : void 0;
|
|
831
862
|
const internalProps = this.internalProps;
|
|
832
863
|
if ("node" === env_1.Env.mode || options.canvas || (0, tableHelper_1.updateRootElementPadding)(internalProps.element, this.padding),
|
|
833
864
|
this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal",
|
|
@@ -890,7 +921,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
890
921
|
}
|
|
891
922
|
this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(),
|
|
892
923
|
internalProps.customMergeCell = (0, get_custom_merge_cell_func_1.getCustomMergeCellFunc)(options.customMergeCell),
|
|
893
|
-
null === (_l = this.customCellStylePlugin) || void 0 === _l || _l.updateCustomCell(null !== (_m = options.customCellStyle) && void 0 !== _m ? _m : [], null !== (_o = options.customCellStyleArrangement) && void 0 !== _o ? _o : [])
|
|
924
|
+
null === (_l = this.customCellStylePlugin) || void 0 === _l || _l.updateCustomCell(null !== (_m = options.customCellStyle) && void 0 !== _m ? _m : [], null !== (_o = options.customCellStyleArrangement) && void 0 !== _o ? _o : []),
|
|
925
|
+
this._adjustCanvasSizeByOption();
|
|
894
926
|
}
|
|
895
927
|
renderWithRecreateCells() {
|
|
896
928
|
const oldHoverState = {
|