@visactor/vtable 1.9.2-alpha.2 → 1.9.2-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/title/title.js +3 -3
- package/cjs/components/title/title.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +20 -2
- package/cjs/index.js.map +1 -1
- package/cjs/plugins/carousel-animation.d.ts +29 -0
- package/cjs/plugins/carousel-animation.js +60 -0
- package/cjs/plugins/carousel-animation.js.map +1 -0
- package/cjs/plugins/chartModules.js +1 -1
- package/cjs/plugins/invert-highlight.d.ts +19 -0
- package/cjs/plugins/invert-highlight.js +72 -0
- package/cjs/plugins/invert-highlight.js.map +1 -0
- package/cjs/scenegraph/graphic/group.js +2 -1
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +3 -2
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/tools/cell-range.d.ts +2 -0
- package/cjs/tools/cell-range.js +10 -0
- package/cjs/tools/cell-range.js.map +1 -0
- package/cjs/ts-types/base-table.d.ts +4 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +212 -4
- package/dist/vtable.min.js +2 -2
- package/es/components/title/title.js +4 -4
- package/es/components/title/title.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- package/es/index.js.map +1 -1
- package/es/plugins/carousel-animation.d.ts +29 -0
- package/es/plugins/carousel-animation.js +52 -0
- package/es/plugins/carousel-animation.js.map +1 -0
- package/es/plugins/chartModules.js +1 -1
- package/es/plugins/invert-highlight.d.ts +19 -0
- package/es/plugins/invert-highlight.js +69 -0
- package/es/plugins/invert-highlight.js.map +1 -0
- package/es/scenegraph/graphic/group.js +2 -1
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +4 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +1 -1
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/tools/cell-range.d.ts +2 -0
- package/es/tools/cell-range.js +4 -0
- package/es/tools/cell-range.js.map +1 -0
- package/es/ts-types/base-table.d.ts +4 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +4 -4
|
@@ -8,9 +8,9 @@ const vrender_components_1 = require("@visactor/vrender-components"), padding_1
|
|
|
8
8
|
|
|
9
9
|
class Title {
|
|
10
10
|
constructor(titleOption, table) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
var _a;
|
|
12
|
+
this.isReleased = !1, this.table = table, this._titleOption = titleOption, this._titleOption.orient = null !== (_a = titleOption.orient) && void 0 !== _a ? _a : "top",
|
|
13
|
+
!1 !== titleOption.visible && (this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs()));
|
|
14
14
|
}
|
|
15
15
|
_createOrUpdateTitleComponent(attrs) {
|
|
16
16
|
if (this._titleComponent) (0, vutils_1.isEqual)(attrs, this._cacheAttrs) || this._titleComponent.setAttributes(attrs); else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/title/title.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAIxE,4DAA8D;AAE9D,6CAAkD;AAKlD,MAAa,KAAK;IAMhB,YAAY,WAAmB,EAAE,KAAmB;QAHpD,eAAU,GAAY,KAAK,CAAC;QAI1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,IAAA,cAAK,EAAC,EAAE,MAAM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I,CAAC,YAAY,CAAC,YAAY,CAClC;YACD,EAAE,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,EAAE,mCAAI,CAAC;YAC7B,EAAE,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,EAAE,mCAAI,CAAC;SAChB,CAAC;IAClB,CAAC;CACF;AAlLD,sBAkLC","file":"title.js","sourcesContent":["import { Title as TitleComponents } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TitleAttrs } from '@visactor/vrender-components';\nimport type { ITitle } from '../../ts-types/component/title';\nimport { getQuadProps } from '../../scenegraph/utils/padding';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { isEqual, merge } from '@visactor/vutils';\n\nexport interface ITitleComponent {\n new (titleOption: ITitle, table: BaseTableAPI): Title;\n}\nexport class Title {\n table: BaseTableAPI;\n _titleOption: ITitle;\n isReleased: boolean = false;\n private _titleComponent: TitleComponents;\n private _cacheAttrs: TitleAttrs;\n constructor(titleOption: ITitle, table: BaseTableAPI) {\n this.table = table;\n this._titleOption = merge({ orient: 'top' }, titleOption);\n if (titleOption.visible !== false) {\n this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());\n }\n }\n\n private _createOrUpdateTitleComponent(attrs: TitleAttrs): TitleComponents {\n if (this._titleComponent) {\n if (!isEqual(attrs, this._cacheAttrs)) {\n this._titleComponent.setAttributes(attrs);\n }\n } else {\n const title = new TitleComponents(attrs);\n title.name = 'title';\n this.table.scenegraph.stage.defaultLayer.appendChild(title);\n this._titleComponent = title;\n // 代理 title 组件上的事件\n // title.on('*', (event: any, type: string) => this._delegateEvent(title as unknown as INode, event, type));\n }\n // update table size\n this._adjustTableSize(this._titleComponent.attribute);\n return this._titleComponent;\n }\n\n resize() {\n if (!this._titleComponent) {\n return;\n }\n const padding = getQuadProps(this._titleOption.padding ?? 10);\n const realWidth =\n this._titleOption.width ??\n Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];\n const realHeight =\n this._titleOption.height ??\n Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width)\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n // width: realWidth,\n width:\n this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'\n ? realWidth\n : this._titleOption.width,\n height:\n this._titleOption.orient === 'left' || this._titleOption.orient === 'right'\n ? realHeight\n : this._titleOption.height,\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n }\n });\n this._adjustTableSize(this._titleComponent.attribute);\n }\n\n _adjustTableSize(attrs: TitleAttrs) {\n // 调整位置\n const width = isFinite(this._titleComponent?.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0;\n const height = isFinite(this._titleComponent?.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0;\n // const rectWidth = this.table.tableNoFrameWidth;\n // const rectHeight = this.table.tableNoFrameHeight;\n // const padding = getQuadProps((attrs.padding as number | number[]) ?? this._titleOption.padding ?? 10);\n\n // let x = 0;\n // let y = 0;\n // if (this._titleOption.orient === 'left') {\n // x = padding[3];\n // y = 0;\n // // width += padding[1] + padding[3];\n // } else if (this._titleOption.orient === 'top') {\n // x = 0;\n // y = padding[0];\n // // height += padding[0] + padding[2];\n // } else if (this._titleOption.orient === 'right') {\n // x = rectWidth - width - padding[1];\n // y = 0;\n // width += padding[1] + padding[3];\n // } else if (this._titleOption.orient === 'bottom') {\n // x = 0;\n // y = rectHeight - height - padding[2];\n // // height += padding[0] + padding[2];\n // }\n if (this._titleOption.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this._titleOption.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this._titleOption.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this._titleOption.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n this._cacheAttrs = attrs;\n if (this._titleOption.orient === 'right' || this._titleOption.orient === 'bottom') {\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + this.table.tableNoFrameWidth\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY\n });\n }\n }\n\n release(): void {\n this._titleComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);\n this._titleComponent = null;\n this.isReleased = true;\n }\n private _getTitleAttrs() {\n const defaultPadding = this._titleOption.text || this._titleOption.subtext ? 10 : 0;\n const padding = getQuadProps(this._titleOption.padding ?? defaultPadding);\n const realWidth =\n this._titleOption.width ??\n Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];\n const realHeight =\n this._titleOption.height ??\n Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];\n return {\n text: this._titleOption.text ?? '',\n subtext: this._titleOption.subtext ?? '',\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width)\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n width:\n this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'\n ? realWidth\n : this._titleOption.width,\n height:\n this._titleOption.orient === 'left' || this._titleOption.orient === 'right'\n ? realHeight\n : this._titleOption.height,\n minWidth: this._titleOption.minWidth,\n maxWidth: this._titleOption.maxWidth,\n minHeight: this._titleOption.minHeight,\n maxHeight: this._titleOption.maxHeight,\n padding: this._titleOption.padding,\n align: this._titleOption.align ?? 'left',\n verticalAlign: this._titleOption.verticalAlign ?? 'top',\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n },\n dx: this._titleOption.dx ?? 0,\n dy: this._titleOption.dy ?? 0\n } as TitleAttrs;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/title/title.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAIxE,4DAA8D;AAE9D,6CAA2C;AAK3C,MAAa,KAAK;IAMhB,YAAY,WAAmB,EAAE,KAAmB;;QAHpD,eAAU,GAAY,KAAK,CAAC;QAI1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,MAAA,WAAW,CAAC,MAAM,mCAAI,KAAK,CAAC;QACvD,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,EAAE;YACjC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;SAClF;IACH,CAAC;IAEO,6BAA6B,CAAC,KAAiB;QACrD,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,IAAI,CAAC,IAAA,gBAAO,EAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE;gBACrC,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aAC3C;SACF;aAAM;YACL,MAAM,KAAK,GAAG,IAAI,0BAAe,CAAC,KAAK,CAAC,CAAC;YACzC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC;YACrB,IAAI,CAAC,KAA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7B,MAAM,EACJ,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,OAAO;gBACzE,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM;YAC9B,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;YAClC,KAAK,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,KAAK,mCAAI,MAAM;YACxC,aAAa,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,aAAa,mCAAI,KAAK;YACvD,SAAS,kBACP,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,SAAS,CAC/B;YACD,YAAY,kBACV,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,YAAY,CAClC;YACD,EAAE,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,EAAE,mCAAI,CAAC;YAC7B,EAAE,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,EAAE,mCAAI,CAAC;SAChB,CAAC;IAClB,CAAC;CACF;AAnLD,sBAmLC","file":"title.js","sourcesContent":["import { Title as TitleComponents } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TitleAttrs } from '@visactor/vrender-components';\nimport type { ITitle } from '../../ts-types/component/title';\nimport { getQuadProps } from '../../scenegraph/utils/padding';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { isEqual } from '@visactor/vutils';\n\nexport interface ITitleComponent {\n new (titleOption: ITitle, table: BaseTableAPI): Title;\n}\nexport class Title {\n table: BaseTableAPI;\n _titleOption: ITitle;\n isReleased: boolean = false;\n private _titleComponent: TitleComponents;\n private _cacheAttrs: TitleAttrs;\n constructor(titleOption: ITitle, table: BaseTableAPI) {\n this.table = table;\n this._titleOption = titleOption;\n this._titleOption.orient = titleOption.orient ?? 'top';\n if (titleOption.visible !== false) {\n this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());\n }\n }\n\n private _createOrUpdateTitleComponent(attrs: TitleAttrs): TitleComponents {\n if (this._titleComponent) {\n if (!isEqual(attrs, this._cacheAttrs)) {\n this._titleComponent.setAttributes(attrs);\n }\n } else {\n const title = new TitleComponents(attrs);\n title.name = 'title';\n this.table.scenegraph.stage.defaultLayer.appendChild(title);\n this._titleComponent = title;\n // 代理 title 组件上的事件\n // title.on('*', (event: any, type: string) => this._delegateEvent(title as unknown as INode, event, type));\n }\n // update table size\n this._adjustTableSize(this._titleComponent.attribute);\n return this._titleComponent;\n }\n\n resize() {\n if (!this._titleComponent) {\n return;\n }\n const padding = getQuadProps(this._titleOption.padding ?? 10);\n const realWidth =\n this._titleOption.width ??\n Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];\n const realHeight =\n this._titleOption.height ??\n Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width)\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n // width: realWidth,\n width:\n this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'\n ? realWidth\n : this._titleOption.width,\n height:\n this._titleOption.orient === 'left' || this._titleOption.orient === 'right'\n ? realHeight\n : this._titleOption.height,\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n }\n });\n this._adjustTableSize(this._titleComponent.attribute);\n }\n\n _adjustTableSize(attrs: TitleAttrs) {\n // 调整位置\n const width = isFinite(this._titleComponent?.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0;\n const height = isFinite(this._titleComponent?.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0;\n // const rectWidth = this.table.tableNoFrameWidth;\n // const rectHeight = this.table.tableNoFrameHeight;\n // const padding = getQuadProps((attrs.padding as number | number[]) ?? this._titleOption.padding ?? 10);\n\n // let x = 0;\n // let y = 0;\n // if (this._titleOption.orient === 'left') {\n // x = padding[3];\n // y = 0;\n // // width += padding[1] + padding[3];\n // } else if (this._titleOption.orient === 'top') {\n // x = 0;\n // y = padding[0];\n // // height += padding[0] + padding[2];\n // } else if (this._titleOption.orient === 'right') {\n // x = rectWidth - width - padding[1];\n // y = 0;\n // width += padding[1] + padding[3];\n // } else if (this._titleOption.orient === 'bottom') {\n // x = 0;\n // y = rectHeight - height - padding[2];\n // // height += padding[0] + padding[2];\n // }\n if (this._titleOption.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this._titleOption.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this._titleOption.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this._titleOption.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n this._cacheAttrs = attrs;\n if (this._titleOption.orient === 'right' || this._titleOption.orient === 'bottom') {\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + this.table.tableNoFrameWidth\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY\n });\n }\n }\n\n release(): void {\n this._titleComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);\n this._titleComponent = null;\n this.isReleased = true;\n }\n private _getTitleAttrs() {\n const defaultPadding = this._titleOption.text || this._titleOption.subtext ? 10 : 0;\n const padding = getQuadProps(this._titleOption.padding ?? defaultPadding);\n const realWidth =\n this._titleOption.width ??\n Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];\n const realHeight =\n this._titleOption.height ??\n Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];\n return {\n text: this._titleOption.text ?? '',\n subtext: this._titleOption.subtext ?? '',\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width)\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n width:\n this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'\n ? realWidth\n : this._titleOption.width,\n height:\n this._titleOption.orient === 'left' || this._titleOption.orient === 'right'\n ? realHeight\n : this._titleOption.height,\n minWidth: this._titleOption.minWidth,\n maxWidth: this._titleOption.maxWidth,\n minHeight: this._titleOption.minHeight,\n maxHeight: this._titleOption.maxHeight,\n padding: this._titleOption.padding,\n align: this._titleOption.align ?? 'left',\n verticalAlign: this._titleOption.verticalAlign ?? 'top',\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n },\n dx: this._titleOption.dx ?? 0,\n dy: this._titleOption.dy ?? 0\n } as TitleAttrs;\n }\n}\n"]}
|
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;
|
|
46
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.9.2-alpha.
|
|
46
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.9.2-alpha.4", this.id = `VTable${Date.now()}`,
|
|
47
47
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
48
48
|
!container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
49
49
|
const {frozenColCount: frozenColCount = 0, frozenRowCount: frozenRowCount, 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;
|