@visactor/vtable 1.0.2 → 1.0.4-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.
@@ -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.0.2", this.id = `VTable${Date.now()}`,
87
+ if (super(), this.showFrozenIcon = !0, this.version = "1.0.4-alpha.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;
@@ -103,7 +103,7 @@ export class BaseTable extends EventTarget {
103
103
  this.tableNoFrameHeight = 0, this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight,
104
104
  this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal";
105
105
  const internalProps = this.internalProps = {};
106
- void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
106
+ if (void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
107
107
  "node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
108
108
  internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"),
109
109
  internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d")),
@@ -137,11 +137,18 @@ export class BaseTable extends EventTarget {
137
137
  internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
138
138
  internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
139
139
  this._vDataSet = new DataSet, this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this),
140
- this.eventManager = new EventManager(this), options.legends && (internalProps.legends = createLegend(options.legends, this),
141
- this.scenegraph.tableGroup.setAttributes({
140
+ this.eventManager = new EventManager(this), options.legends) if (internalProps.legends = [],
141
+ Array.isArray(options.legends)) {
142
+ for (let i = 0; i < options.legends.length; i++) internalProps.legends.push(createLegend(options.legends[i], this));
143
+ this.scenegraph.tableGroup.setAttributes({
144
+ x: this.tableX,
145
+ y: this.tableY
146
+ });
147
+ } else internalProps.legends.push(createLegend(options.legends, this)), this.scenegraph.tableGroup.setAttributes({
142
148
  x: this.tableX,
143
149
  y: this.tableY
144
- })), internalProps.tooltip = Object.assign({
150
+ });
151
+ internalProps.tooltip = Object.assign({
145
152
  renderMode: "html",
146
153
  isShowOverflowTextTooltip: !1,
147
154
  confine: !0
@@ -166,8 +173,10 @@ export class BaseTable extends EventTarget {
166
173
  return this.internalProps.canvas;
167
174
  }
168
175
  resize() {
169
- this._updateSize(), this.internalProps.legends && this.internalProps.legends.resize(),
170
- this.internalProps.title && this.internalProps.title.resize(), this.scenegraph.resize();
176
+ var _a;
177
+ this._updateSize(), null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach((legend => {
178
+ null == legend || legend.resize();
179
+ })), this.internalProps.title && this.internalProps.title.resize(), this.scenegraph.resize();
171
180
  }
172
181
  get rowCount() {
173
182
  return this.internalProps.rowCount;
@@ -773,8 +782,10 @@ export class BaseTable extends EventTarget {
773
782
  IconCache.clearAll(), null === (_e = super.release) || void 0 === _e || _e.call(this),
774
783
  null === (_g = null === (_f = internalProps.handler) || void 0 === _f ? void 0 : _f.release) || void 0 === _g || _g.call(_f),
775
784
  null === (_j = null === (_h = internalProps.focusControl) || void 0 === _h ? void 0 : _h.release) || void 0 === _j || _j.call(_h),
776
- null === (_k = internalProps.legends) || void 0 === _k || _k.release(), null === (_l = internalProps.title) || void 0 === _l || _l.release(),
777
- internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
785
+ null === (_k = internalProps.legends) || void 0 === _k || _k.forEach((legend => {
786
+ null == legend || legend.release();
787
+ })), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.layoutMap.release(),
788
+ internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
778
789
  var _a;
779
790
  return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
780
791
  })), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
@@ -801,7 +812,7 @@ export class BaseTable extends EventTarget {
801
812
  this.autoFillWidth = null != autoFillWidth && autoFillWidth, this.autoFillHeight = null != autoFillHeight && autoFillHeight,
802
813
  this.customRender = customRender;
803
814
  const internalProps = this.internalProps;
804
- "node" !== Env.mode && updateRootElementPadding(internalProps.element, this.padding),
815
+ if ("node" !== Env.mode && updateRootElementPadding(internalProps.element, this.padding),
805
816
  this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal",
806
817
  internalProps.frozenColCount = frozenColCount, internalProps.defaultRowHeight = defaultRowHeight,
807
818
  internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
@@ -822,14 +833,22 @@ export class BaseTable extends EventTarget {
822
833
  internalProps.limitMaxAutoWidth = null !== (_d = options.limitMaxAutoWidth) && void 0 !== _d ? _d : 450,
823
834
  internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
824
835
  internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
825
- this._vDataSet = new DataSet, null === (_e = internalProps.legends) || void 0 === _e || _e.release(),
826
- null === (_f = internalProps.title) || void 0 === _f || _f.release(), internalProps.layoutMap.release(),
836
+ this._vDataSet = new DataSet, null === (_e = internalProps.legends) || void 0 === _e || _e.forEach((legend => {
837
+ null == legend || legend.release();
838
+ })), null === (_f = internalProps.title) || void 0 === _f || _f.release(), internalProps.layoutMap.release(),
827
839
  this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(),
828
- this._updateSize(), this.eventManager.updateEventBinder(), options.legends && (internalProps.legends = createLegend(options.legends, this),
829
- this.scenegraph.tableGroup.setAttributes({
840
+ this._updateSize(), this.eventManager.updateEventBinder(), options.legends) if (internalProps.legends = [],
841
+ Array.isArray(options.legends)) {
842
+ for (let i = 0; i < options.legends.length; i++) internalProps.legends.push(createLegend(options.legends[i], this));
843
+ this.scenegraph.tableGroup.setAttributes({
844
+ x: this.tableX,
845
+ y: this.tableY
846
+ });
847
+ } else internalProps.legends.push(createLegend(options.legends, this)), this.scenegraph.tableGroup.setAttributes({
830
848
  x: this.tableX,
831
849
  y: this.tableY
832
- })), internalProps.tooltip = Object.assign({
850
+ });
851
+ internalProps.tooltip = Object.assign({
833
852
  renderMode: "html",
834
853
  isShowOverflowTextTooltip: !1,
835
854
  confine: !0