@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.
@@ -45,7 +45,7 @@ class BaseTable extends EventTarget_1.EventTarget {
45
45
  }
46
46
  constructor(container, options = {}) {
47
47
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
48
- if (super(), this.showFrozenIcon = !0, this.version = "1.0.2", this.id = `VTable${Date.now()}`,
48
+ if (super(), this.showFrozenIcon = !0, this.version = "1.0.4-alpha.0", 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, 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;
@@ -64,7 +64,7 @@ class BaseTable extends EventTarget_1.EventTarget {
64
64
  this.tableNoFrameHeight = 0, this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight,
65
65
  this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal";
66
66
  const internalProps = this.internalProps = {};
67
- void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
67
+ if (void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
68
68
  "node" !== env_1.Env.mode && (internalProps.element = (0, tableHelper_1.createRootElement)(this.padding),
69
69
  internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
70
70
  internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas),
@@ -101,11 +101,19 @@ class BaseTable extends EventTarget_1.EventTarget {
101
101
  internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
102
102
  this._vDataSet = new vdataset_1.DataSet, this.scenegraph = new scenegraph_1.Scenegraph(this),
103
103
  this.stateManager = new state_1.StateManager(this), this.eventManager = new event_1.EventManager(this),
104
- options.legends && (internalProps.legends = (0, create_legend_1.createLegend)(options.legends, this),
104
+ options.legends) if (internalProps.legends = [], Array.isArray(options.legends)) {
105
+ for (let i = 0; i < options.legends.length; i++) internalProps.legends.push((0,
106
+ create_legend_1.createLegend)(options.legends[i], this));
107
+ this.scenegraph.tableGroup.setAttributes({
108
+ x: this.tableX,
109
+ y: this.tableY
110
+ });
111
+ } else internalProps.legends.push((0, create_legend_1.createLegend)(options.legends, this)),
105
112
  this.scenegraph.tableGroup.setAttributes({
106
113
  x: this.tableX,
107
114
  y: this.tableY
108
- })), internalProps.tooltip = Object.assign({
115
+ });
116
+ internalProps.tooltip = Object.assign({
109
117
  renderMode: "html",
110
118
  isShowOverflowTextTooltip: !1,
111
119
  confine: !0
@@ -130,8 +138,10 @@ class BaseTable extends EventTarget_1.EventTarget {
130
138
  return this.internalProps.canvas;
131
139
  }
132
140
  resize() {
133
- this._updateSize(), this.internalProps.legends && this.internalProps.legends.resize(),
134
- this.internalProps.title && this.internalProps.title.resize(), this.scenegraph.resize();
141
+ var _a;
142
+ this._updateSize(), null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach((legend => {
143
+ null == legend || legend.resize();
144
+ })), this.internalProps.title && this.internalProps.title.resize(), this.scenegraph.resize();
135
145
  }
136
146
  get rowCount() {
137
147
  return this.internalProps.rowCount;
@@ -739,8 +749,10 @@ class BaseTable extends EventTarget_1.EventTarget {
739
749
  icons_1.IconCache.clearAll(), null === (_e = super.release) || void 0 === _e || _e.call(this),
740
750
  null === (_g = null === (_f = internalProps.handler) || void 0 === _f ? void 0 : _f.release) || void 0 === _g || _g.call(_f),
741
751
  null === (_j = null === (_h = internalProps.focusControl) || void 0 === _h ? void 0 : _h.release) || void 0 === _j || _j.call(_h),
742
- null === (_k = internalProps.legends) || void 0 === _k || _k.release(), null === (_l = internalProps.title) || void 0 === _l || _l.release(),
743
- internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
752
+ null === (_k = internalProps.legends) || void 0 === _k || _k.forEach((legend => {
753
+ null == legend || legend.release();
754
+ })), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.layoutMap.release(),
755
+ internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
744
756
  var _a;
745
757
  return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
746
758
  })), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
@@ -767,7 +779,7 @@ class BaseTable extends EventTarget_1.EventTarget {
767
779
  this.autoFillWidth = null != autoFillWidth && autoFillWidth, this.autoFillHeight = null != autoFillHeight && autoFillHeight,
768
780
  this.customRender = customRender;
769
781
  const internalProps = this.internalProps;
770
- "node" !== env_1.Env.mode && (0, tableHelper_1.updateRootElementPadding)(internalProps.element, this.padding),
782
+ if ("node" !== env_1.Env.mode && (0, tableHelper_1.updateRootElementPadding)(internalProps.element, this.padding),
771
783
  this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal",
772
784
  internalProps.frozenColCount = frozenColCount, internalProps.defaultRowHeight = defaultRowHeight,
773
785
  internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
@@ -788,14 +800,24 @@ class BaseTable extends EventTarget_1.EventTarget {
788
800
  internalProps.limitMaxAutoWidth = null !== (_d = options.limitMaxAutoWidth) && void 0 !== _d ? _d : 450,
789
801
  internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
790
802
  internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
791
- this._vDataSet = new vdataset_1.DataSet, null === (_e = internalProps.legends) || void 0 === _e || _e.release(),
792
- null === (_f = internalProps.title) || void 0 === _f || _f.release(), internalProps.layoutMap.release(),
803
+ this._vDataSet = new vdataset_1.DataSet, null === (_e = internalProps.legends) || void 0 === _e || _e.forEach((legend => {
804
+ null == legend || legend.release();
805
+ })), null === (_f = internalProps.title) || void 0 === _f || _f.release(), internalProps.layoutMap.release(),
793
806
  this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(),
794
- this._updateSize(), this.eventManager.updateEventBinder(), options.legends && (internalProps.legends = (0,
795
- create_legend_1.createLegend)(options.legends, this), this.scenegraph.tableGroup.setAttributes({
807
+ this._updateSize(), this.eventManager.updateEventBinder(), options.legends) if (internalProps.legends = [],
808
+ Array.isArray(options.legends)) {
809
+ for (let i = 0; i < options.legends.length; i++) internalProps.legends.push((0,
810
+ create_legend_1.createLegend)(options.legends[i], this));
811
+ this.scenegraph.tableGroup.setAttributes({
812
+ x: this.tableX,
813
+ y: this.tableY
814
+ });
815
+ } else internalProps.legends.push((0, create_legend_1.createLegend)(options.legends, this)),
816
+ this.scenegraph.tableGroup.setAttributes({
796
817
  x: this.tableX,
797
818
  y: this.tableY
798
- })), internalProps.tooltip = Object.assign({
819
+ });
820
+ internalProps.tooltip = Object.assign({
799
821
  renderMode: "html",
800
822
  isShowOverflowTextTooltip: !1,
801
823
  confine: !0