@visactor/vtable 0.22.2-alpha.0 → 0.22.2-alpha.2
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/legend/continue-legend/continue-legend.js +1 -1
- package/cjs/components/legend/continue-legend/continue-legend.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +2 -0
- package/cjs/core/BaseTable.js +19 -14
- package/cjs/core/BaseTable.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/pivot-header-layout.js +4 -2
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +10 -6
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +5 -4
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/themes/component.js +1 -1
- package/cjs/ts-types/base-table.d.ts +3 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +59 -33
- package/dist/vtable.min.js +2 -2
- package/es/components/legend/continue-legend/continue-legend.js +1 -1
- package/es/components/legend/continue-legend/continue-legend.js.map +1 -1
- package/es/core/BaseTable.d.ts +2 -0
- package/es/core/BaseTable.js +19 -14
- package/es/core/BaseTable.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 +4 -2
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +10 -6
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +5 -4
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/themes/component.js +1 -1
- package/es/ts-types/base-table.d.ts +3 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +4 -4
|
@@ -11,7 +11,7 @@ class ContinueTableLegend {
|
|
|
11
11
|
var _a, _b, _c, _d;
|
|
12
12
|
this.table = table, this.option = (0, vutils_1.cloneDeep)(option), this.orient = null !== (_a = option.orient) && void 0 !== _a ? _a : "left",
|
|
13
13
|
this.visible = null === (_b = option.visible) || void 0 === _b || _b, this.position = null !== (_c = option.position) && void 0 !== _c ? _c : "middle",
|
|
14
|
-
this.selectedData = null !== (_d = option.defaultSelected) && void 0 !== _d ? _d :
|
|
14
|
+
this.selectedData = null !== (_d = option.defaultSelected) && void 0 !== _d ? _d : null,
|
|
15
15
|
this.createComponent(), this.initEvent();
|
|
16
16
|
}
|
|
17
17
|
createComponent() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/legend/continue-legend/continue-legend.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAGzD,qEAAwG;AACxG,qFAAiF;AACjF,qEAAkE;AAClE,+DAAiE;AAGjE,MAAa,mBAAmB;IAS9B,YAAY,MAAwD,EAAE,KAAmB;;QACvF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAA,kBAAS,EAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAA,MAAM,CAAC,MAAM,mCAAI,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,IAAI,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAA,MAAM,CAAC,QAAQ,mCAAI,QAAQ,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,EAAE,CAAC;QAEjD,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED,eAAe;QACb,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U,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9G,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjH,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;SACf,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnG,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AArLD,kDAqLC","file":"continue-legend.js","sourcesContent":["import { cloneDeep, get, merge } from '@visactor/vutils';\nimport type { IColorTableLegendOption, ISizeTableLegendOption } from '../../../ts-types/component/legend';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { ColorContinuousLegend, SizeContinuousLegend, LegendEvent } from '@visactor/vrender-components';\nimport { getContinuousLegendAttributes } from './get-continue-legend-attributes';\nimport { TABLE_EVENT_TYPE } from '../../../core/TABLE_EVENT_TYPE';\nimport { getQuadProps } from '../../../scenegraph/utils/padding';\nimport type { IOrientType } from '../../../ts-types/component/util';\n\nexport class ContinueTableLegend {\n table: BaseTableAPI;\n option: IColorTableLegendOption | ISizeTableLegendOption;\n orient: IOrientType;\n visible: boolean;\n position: 'start' | 'middle' | 'end';\n selectedData: (string | number)[];\n legendComponent: ColorContinuousLegend | SizeContinuousLegend;\n\n constructor(option: IColorTableLegendOption | ISizeTableLegendOption, table: BaseTableAPI) {\n this.table = table;\n this.option = cloneDeep(option);\n this.orient = option.orient ?? 'left';\n this.visible = option.visible ?? true;\n this.position = option.position ?? 'middle';\n this.selectedData = option.defaultSelected ?? [];\n\n this.createComponent();\n this.initEvent();\n }\n\n createComponent() {\n const attrs = this.getLegendAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n let legend;\n if (this.option.type === 'color') {\n legend = new ColorContinuousLegend(\n merge({}, attrs, {\n slidable: true\n // defaultSelected: this.selectedData\n })\n );\n } else {\n legend = new SizeContinuousLegend(\n merge({}, attrs, {\n slidable: true\n // defaultSelected: this.selectedData\n })\n );\n }\n legend.name = 'legend';\n this.legendComponent = legend;\n this.table.scenegraph.stage.defaultLayer.appendChild(legend);\n\n this.adjustTableSize(attrs);\n }\n\n resize() {\n if (!this.legendComponent) {\n return;\n }\n\n this.legendComponent.setAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n this.adjustTableSize(this.legendComponent.attribute);\n }\n\n adjustTableSize(attrs: any) {\n // 调整位置\n let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n if (width <= 0 || height <= 0) {\n return;\n }\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this.orient === 'left') {\n x = padding[3];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'top') {\n x = 0;\n y = padding[0];\n height += padding[0] + padding[2];\n } else if (this.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n height += padding[0] + padding[2];\n }\n\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const position = this.position;\n // const { width: rectWidth, height: rectHeight } = fullSpace;\n let offsetX = 0;\n let offsetY = 0;\n if (layout === 'horizontal') {\n if (position === 'middle') {\n offsetX = (rectWidth - width) / 2;\n } else if (position === 'end') {\n offsetX = rectWidth - width - padding[1];\n } else {\n offsetX = padding[3];\n }\n } else {\n if (position === 'middle') {\n offsetY = (rectHeight - height) / 2;\n } else if (position === 'end') {\n offsetY = rectHeight - height - padding[2];\n } else {\n offsetY = padding[0];\n }\n }\n\n this.legendComponent.setAttributes({\n dx: offsetX,\n dy: offsetY,\n x,\n y\n });\n\n // update table size\n if (this.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n }\n\n getLegendAttributes(rect: any) {\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const align = layout === 'horizontal' ? 'bottom' : this.orient;\n\n const attrs = {\n ...getContinuousLegendAttributes(this.option, rect),\n layout,\n align,\n // zIndex: this.layoutZIndex,\n min: this.option.min,\n max: this.option.max,\n value: this.option.value,\n [this.option.type === 'color' ? 'colors' : 'sizeRange']:\n this.option.type === 'color'\n ? (this.option as IColorTableLegendOption).colors\n : (this.option as ISizeTableLegendOption).sizeRange\n };\n return attrs;\n }\n\n initEvent() {\n if (this.legendComponent) {\n this.legendComponent.addEventListener('change', (e: any) => {\n const selectedData = get(e, 'detail.value');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_CHANGE, { model: this, value: selectedData, event: e });\n this.table.scenegraph.updateNextFrame();\n });\n }\n }\n\n getLegendBounds() {\n const width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n const height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n\n return {\n width: width,\n height: height\n };\n }\n release() {\n this.legendComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent);\n this.legendComponent = null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/legend/continue-legend/continue-legend.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAGzD,qEAAwG;AACxG,qFAAiF;AACjF,qEAAkE;AAClE,+DAAiE;AAGjE,MAAa,mBAAmB;IAS9B,YAAY,MAAwD,EAAE,KAAmB;;QACvF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAA,kBAAS,EAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAA,MAAM,CAAC,MAAM,mCAAI,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,IAAI,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAA,MAAM,CAAC,QAAQ,mCAAI,QAAQ,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,IAAI,CAAC;QAEnD,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED,eAAe;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC;YACrC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB;YACnC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB;SACtC,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC;QACX,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE;YAChC,MAAM,GAAG,IAAI,0CAAqB,CAChC,IAAA,cAAK,EAAC,EAAE,EAAE,KAAK,EAAE;gBACf,QAAQ,EAAE,IAAI;aAEf,CAAC,CACH,CAAC;SACH;aAAM;YACL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U,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnG,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AArLD,kDAqLC","file":"continue-legend.js","sourcesContent":["import { cloneDeep, get, merge } from '@visactor/vutils';\nimport type { IColorTableLegendOption, ISizeTableLegendOption } from '../../../ts-types/component/legend';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { ColorContinuousLegend, SizeContinuousLegend, LegendEvent } from '@visactor/vrender-components';\nimport { getContinuousLegendAttributes } from './get-continue-legend-attributes';\nimport { TABLE_EVENT_TYPE } from '../../../core/TABLE_EVENT_TYPE';\nimport { getQuadProps } from '../../../scenegraph/utils/padding';\nimport type { IOrientType } from '../../../ts-types/component/util';\n\nexport class ContinueTableLegend {\n table: BaseTableAPI;\n option: IColorTableLegendOption | ISizeTableLegendOption;\n orient: IOrientType;\n visible: boolean;\n position: 'start' | 'middle' | 'end';\n selectedData: (string | number)[];\n legendComponent: ColorContinuousLegend | SizeContinuousLegend;\n\n constructor(option: IColorTableLegendOption | ISizeTableLegendOption, table: BaseTableAPI) {\n this.table = table;\n this.option = cloneDeep(option);\n this.orient = option.orient ?? 'left';\n this.visible = option.visible ?? true;\n this.position = option.position ?? 'middle';\n this.selectedData = option.defaultSelected ?? null;\n\n this.createComponent();\n this.initEvent();\n }\n\n createComponent() {\n const attrs = this.getLegendAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n let legend;\n if (this.option.type === 'color') {\n legend = new ColorContinuousLegend(\n merge({}, attrs, {\n slidable: true\n // defaultSelected: this.selectedData\n })\n );\n } else {\n legend = new SizeContinuousLegend(\n merge({}, attrs, {\n slidable: true\n // defaultSelected: this.selectedData\n })\n );\n }\n legend.name = 'legend';\n this.legendComponent = legend;\n this.table.scenegraph.stage.defaultLayer.appendChild(legend);\n\n this.adjustTableSize(attrs);\n }\n\n resize() {\n if (!this.legendComponent) {\n return;\n }\n\n this.legendComponent.setAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n this.adjustTableSize(this.legendComponent.attribute);\n }\n\n adjustTableSize(attrs: any) {\n // 调整位置\n let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n if (width <= 0 || height <= 0) {\n return;\n }\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this.orient === 'left') {\n x = padding[3];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'top') {\n x = 0;\n y = padding[0];\n height += padding[0] + padding[2];\n } else if (this.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n height += padding[0] + padding[2];\n }\n\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const position = this.position;\n // const { width: rectWidth, height: rectHeight } = fullSpace;\n let offsetX = 0;\n let offsetY = 0;\n if (layout === 'horizontal') {\n if (position === 'middle') {\n offsetX = (rectWidth - width) / 2;\n } else if (position === 'end') {\n offsetX = rectWidth - width - padding[1];\n } else {\n offsetX = padding[3];\n }\n } else {\n if (position === 'middle') {\n offsetY = (rectHeight - height) / 2;\n } else if (position === 'end') {\n offsetY = rectHeight - height - padding[2];\n } else {\n offsetY = padding[0];\n }\n }\n\n this.legendComponent.setAttributes({\n dx: offsetX,\n dy: offsetY,\n x,\n y\n });\n\n // update table size\n if (this.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n }\n\n getLegendAttributes(rect: any) {\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const align = layout === 'horizontal' ? 'bottom' : this.orient;\n\n const attrs = {\n ...getContinuousLegendAttributes(this.option, rect),\n layout,\n align,\n // zIndex: this.layoutZIndex,\n min: this.option.min,\n max: this.option.max,\n value: this.option.value,\n [this.option.type === 'color' ? 'colors' : 'sizeRange']:\n this.option.type === 'color'\n ? (this.option as IColorTableLegendOption).colors\n : (this.option as ISizeTableLegendOption).sizeRange\n };\n return attrs;\n }\n\n initEvent() {\n if (this.legendComponent) {\n this.legendComponent.addEventListener('change', (e: any) => {\n const selectedData = get(e, 'detail.value');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_CHANGE, { model: this, value: selectedData, event: e });\n this.table.scenegraph.updateNextFrame();\n });\n }\n }\n\n getLegendBounds() {\n const width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n const height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n\n return {\n width: width,\n height: height\n };\n }\n release() {\n this.legendComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent);\n this.legendComponent = null;\n }\n}\n"]}
|
package/cjs/core/BaseTable.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
57
57
|
callback: AnyFunction;
|
|
58
58
|
}[]>;
|
|
59
59
|
customCellStylePlugin: CustomCellStylePlugin;
|
|
60
|
+
columnWidthComputeMode?: 'normal' | 'only-header' | 'only-body';
|
|
60
61
|
constructor(container: HTMLElement, options?: BaseTableConstructorOptions);
|
|
61
62
|
throttleInvalidate: (this: any, ...args: any[]) => void;
|
|
62
63
|
getContainer(): HTMLElement;
|
|
@@ -128,6 +129,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
128
129
|
get rowHierarchyType(): 'grid' | 'tree';
|
|
129
130
|
getColsWidth(startCol: number, endCol: number): number;
|
|
130
131
|
getRowHeight(row: number): number;
|
|
132
|
+
getDefaultColumnWidth(col: number): number | "auto";
|
|
131
133
|
getDefaultRowHeight(row: number): number | "auto";
|
|
132
134
|
_setRowHeight(row: number, height: number, clearCache?: boolean): void;
|
|
133
135
|
getRowsHeight(startRow: number, endRow: number): number;
|
package/cjs/core/BaseTable.js
CHANGED
|
@@ -44,8 +44,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
44
44
|
return TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE;
|
|
45
45
|
}
|
|
46
46
|
constructor(container, options = {}) {
|
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
48
|
-
if (super(), this.showFrozenIcon = !0, this.version = "0.22.2-alpha.
|
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
48
|
+
if (super(), this.showFrozenIcon = !0, this.version = "0.22.2-alpha.2", 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, keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, 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} = options;
|
|
@@ -60,7 +60,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
60
60
|
this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top),
|
|
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))), this.tableNoFrameWidth = 0,
|
|
63
|
-
this.tableNoFrameHeight = 0, this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight
|
|
63
|
+
this.tableNoFrameHeight = 0, this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight,
|
|
64
|
+
this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal";
|
|
64
65
|
const internalProps = this.internalProps = {};
|
|
65
66
|
void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
66
67
|
"node" !== env_1.Env.mode && (internalProps.element = (0, tableHelper_1.createRootElement)(this.padding),
|
|
@@ -85,14 +86,14 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
85
86
|
var _a;
|
|
86
87
|
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);
|
|
87
88
|
}
|
|
88
|
-
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (
|
|
89
|
+
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (_b = options.theme) && void 0 !== _b ? _b : themes_1.default.DEFAULT),
|
|
89
90
|
internalProps.theme.isPivot = this.isPivotTable(), container ? (container.innerHTML = "",
|
|
90
91
|
container.appendChild(internalProps.element), this._updateSize()) : this._updateSize(),
|
|
91
|
-
this.options = options, internalProps.theme = themes_1.default.of(null !== (
|
|
92
|
+
this.options = options, internalProps.theme = themes_1.default.of(null !== (_c = options.theme) && void 0 !== _c ? _c : themes_1.default.DEFAULT),
|
|
92
93
|
internalProps.theme.isPivot = this.isPivotTable(), internalProps.bodyHelper = new body_helper_1.BodyHelper(this),
|
|
93
94
|
internalProps.headerHelper = new header_helper_1.HeaderHelper(this), internalProps.rowSeriesNumberHelper = new row_series_number_helper_1.RowSeriesNumberHelper(this),
|
|
94
|
-
internalProps.autoWrapText = options.autoWrapText, internalProps.allowFrozenColCount = null !== (
|
|
95
|
-
internalProps.limitMaxAutoWidth = null !== (
|
|
95
|
+
internalProps.autoWrapText = options.autoWrapText, internalProps.allowFrozenColCount = null !== (_d = options.allowFrozenColCount) && void 0 !== _d ? _d : 0,
|
|
96
|
+
internalProps.limitMaxAutoWidth = null !== (_e = options.limitMaxAutoWidth) && void 0 !== _e ? _e : 450,
|
|
96
97
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
97
98
|
this._vDataSet = new vdataset_1.DataSet, this.scenegraph = new scenegraph_1.Scenegraph(this),
|
|
98
99
|
this.stateManager = new state_1.StateManager(this), this.eventManager = new event_1.EventManager(this),
|
|
@@ -107,13 +108,13 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
107
108
|
}, options.tooltip), "html" === internalProps.tooltip.renderMode && (internalProps.tooltipHandler = new TooltipHandler_1.TooltipHandler(this, internalProps.tooltip.confine)),
|
|
108
109
|
internalProps.menu = Object.assign({
|
|
109
110
|
renderMode: "html"
|
|
110
|
-
}, options.menu), Array.isArray(null === (
|
|
111
|
-
Array.isArray(null === (
|
|
111
|
+
}, options.menu), Array.isArray(null === (_f = options.menu) || void 0 === _f ? void 0 : _f.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_g = options.menu) || void 0 === _g ? void 0 : _g.dropDownMenuHighlight),
|
|
112
|
+
Array.isArray(null === (_h = options.menu) || void 0 === _h ? void 0 : _h.defaultHeaderMenuItems) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
|
|
112
113
|
"html" === internalProps.menu.renderMode && (internalProps.menuHandler = new MenuHandler_1.MenuHandler(this)),
|
|
113
114
|
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.bodyBottomStyleCache = new Map,
|
|
114
115
|
internalProps.stick = {
|
|
115
116
|
changedCells: new Map
|
|
116
|
-
}, internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin = new custom_cell_style_1.CustomCellStylePlugin(this, null !== (
|
|
117
|
+
}, internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin = new custom_cell_style_1.CustomCellStylePlugin(this, null !== (_j = options.customCellStyle) && void 0 !== _j ? _j : [], null !== (_k = options.customCellStyleArrangement) && void 0 !== _k ? _k : []);
|
|
117
118
|
}
|
|
118
119
|
getContainer() {
|
|
119
120
|
return this.container;
|
|
@@ -349,6 +350,10 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
349
350
|
const defaultHeight = this.getDefaultRowHeight(row);
|
|
350
351
|
return (0, vutils_1.isNumber)(defaultHeight) ? defaultHeight : this.defaultRowHeight;
|
|
351
352
|
}
|
|
353
|
+
getDefaultColumnWidth(col) {
|
|
354
|
+
var _a, _b;
|
|
355
|
+
return this.isRowHeader(col, 0) || this.isCornerHeader(col, 0) ? Array.isArray(this.defaultHeaderColWidth) ? null !== (_a = this.defaultHeaderColWidth[col]) && void 0 !== _a ? _a : this.defaultColWidth : this.defaultHeaderColWidth : this.isRightFrozenColumn(col, this.columnHeaderLevelCount) && this.isPivotTable() ? Array.isArray(this.defaultHeaderColWidth) ? null !== (_b = this.defaultHeaderColWidth[this.rowHeaderLevelCount - this.rightFrozenColCount]) && void 0 !== _b ? _b : this.defaultColWidth : this.defaultHeaderColWidth : this.defaultColWidth;
|
|
356
|
+
}
|
|
352
357
|
getDefaultRowHeight(row) {
|
|
353
358
|
var _a, _b;
|
|
354
359
|
return this.isColumnHeader(0, row) || this.isCornerHeader(0, row) ? Array.isArray(this.defaultHeaderRowHeight) ? null !== (_a = this.defaultHeaderRowHeight[row]) && void 0 !== _a ? _a : this.internalProps.defaultRowHeight : this.defaultHeaderRowHeight : this.isBottomFrozenRow(this.rowHeaderLevelCount, row) ? Array.isArray(this.defaultHeaderRowHeight) ? null !== (_b = this.defaultHeaderRowHeight[this.columnHeaderLevelCount > 0 ? this.columnHeaderLevelCount - this.bottomFrozenRowCount : 0]) && void 0 !== _b ? _b : this.internalProps.defaultRowHeight : this.defaultHeaderRowHeight : this.internalProps.defaultRowHeight;
|
|
@@ -368,19 +373,19 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
368
373
|
return Math.round(h);
|
|
369
374
|
}
|
|
370
375
|
getColWidthDefined(col) {
|
|
371
|
-
var _a
|
|
376
|
+
var _a;
|
|
372
377
|
const {layoutMap: layoutMap} = this.internalProps;
|
|
373
378
|
if ("autoWidth" === this.widthMode) return "auto";
|
|
374
379
|
const {width: width} = null !== (_a = null == layoutMap ? void 0 : layoutMap.getColumnWidthDefined(col)) && void 0 !== _a ? _a : {};
|
|
375
|
-
return "number" == typeof width && width <= 0 ? 0 : width ||
|
|
380
|
+
return "number" == typeof width && width <= 0 ? 0 : width || this.getDefaultColumnWidth(col);
|
|
376
381
|
}
|
|
377
382
|
getColWidthDefinedNumber(col) {
|
|
378
383
|
const width = this.getColWidthDefined(col);
|
|
379
384
|
return this._adjustColWidth(col, this._colWidthDefineToPxWidth(width));
|
|
380
385
|
}
|
|
381
386
|
getColWidth(col) {
|
|
382
|
-
var _a
|
|
383
|
-
const width = null !== (_a = this.colWidthsMap.get(col)) && void 0 !== _a ? _a :
|
|
387
|
+
var _a;
|
|
388
|
+
const width = null !== (_a = this.colWidthsMap.get(col)) && void 0 !== _a ? _a : this.getDefaultColumnWidth(col);
|
|
384
389
|
return "adaptive" === this.widthMode && "number" == typeof width || this.transpose && "number" == typeof width ? this._colWidthDefineToPxWidth(width) : this._adjustColWidth(col, this._colWidthDefineToPxWidth(width));
|
|
385
390
|
}
|
|
386
391
|
_setColWidth(col, width, clearCache, skipCheckFrozen) {
|