k-vtable 1.0.2 → 1.0.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.
Files changed (121) hide show
  1. package/cjs/ListTable.d.ts +3 -1
  2. package/cjs/ListTable.js +4 -4
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/body-helper/style/ButtonStyle.d.ts +1 -1
  5. package/cjs/body-helper/style/ButtonStyle.js +2 -2
  6. package/cjs/body-helper/style/ButtonStyle.js.map +1 -1
  7. package/cjs/body-helper/style/SwitchStyle.d.ts +1 -1
  8. package/cjs/body-helper/style/SwitchStyle.js +2 -2
  9. package/cjs/body-helper/style/SwitchStyle.js.map +1 -1
  10. package/cjs/components/menu/dom/logic/MenuElement.js +7 -3
  11. package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
  12. package/cjs/core/BaseTable.d.ts +13 -0
  13. package/cjs/core/BaseTable.js +112 -40
  14. package/cjs/core/BaseTable.js.map +1 -1
  15. package/cjs/core/animation.js +1 -1
  16. package/cjs/core/animation.js.map +1 -1
  17. package/cjs/data/DataSource.js +2 -2
  18. package/cjs/data/DataSource.js.map +1 -1
  19. package/cjs/event/event.js +2 -2
  20. package/cjs/event/event.js.map +1 -1
  21. package/cjs/event/listener/container-dom.js +1 -0
  22. package/cjs/event/listener/container-dom.js.map +1 -1
  23. package/cjs/event/listener/table-group.js +4 -4
  24. package/cjs/event/listener/table-group.js.map +1 -1
  25. package/cjs/event/scroll.js +6 -5
  26. package/cjs/event/scroll.js.map +1 -1
  27. package/cjs/event/self-event-listener/base-table/right-button-click.js +2 -2
  28. package/cjs/event/self-event-listener/base-table/right-button-click.js.map +1 -1
  29. package/cjs/index.d.ts +1 -1
  30. package/cjs/index.js +1 -1
  31. package/cjs/index.js.map +1 -1
  32. package/cjs/layout/row-height-map.js +10 -3
  33. package/cjs/layout/row-height-map.js.map +1 -1
  34. package/cjs/layout/simple-header-layout.js +2 -2
  35. package/cjs/layout/simple-header-layout.js.map +1 -1
  36. package/cjs/scenegraph/component/custom.js.map +1 -1
  37. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +6 -3
  38. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  39. package/cjs/scenegraph/graphic/icon.d.ts +1 -0
  40. package/cjs/scenegraph/graphic/icon.js +30 -2
  41. package/cjs/scenegraph/graphic/icon.js.map +1 -1
  42. package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
  43. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  44. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +4 -4
  45. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  46. package/cjs/scenegraph/group-creater/progress/proxy.js +3 -3
  47. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  48. package/cjs/scenegraph/scenegraph.js +22 -17
  49. package/cjs/scenegraph/scenegraph.js.map +1 -1
  50. package/cjs/state/state.js +1 -1
  51. package/cjs/state/state.js.map +1 -1
  52. package/cjs/tools/env.d.ts +1 -0
  53. package/cjs/tools/env.js +13 -2
  54. package/cjs/tools/env.js.map +1 -1
  55. package/cjs/ts-types/base-table.d.ts +10 -0
  56. package/cjs/ts-types/base-table.js.map +1 -1
  57. package/cjs/vrender.d.ts +3 -3
  58. package/cjs/vrender.js +4 -21
  59. package/cjs/vrender.js.map +1 -1
  60. package/dist/vtable.js +4922 -4000
  61. package/dist/vtable.min.js +2 -2
  62. package/es/ListTable.d.ts +3 -1
  63. package/es/ListTable.js +2 -1
  64. package/es/ListTable.js.map +1 -1
  65. package/es/body-helper/style/ButtonStyle.d.ts +1 -1
  66. package/es/body-helper/style/ButtonStyle.js +1 -1
  67. package/es/body-helper/style/ButtonStyle.js.map +1 -1
  68. package/es/body-helper/style/SwitchStyle.d.ts +1 -1
  69. package/es/body-helper/style/SwitchStyle.js +1 -1
  70. package/es/body-helper/style/SwitchStyle.js.map +1 -1
  71. package/es/components/menu/dom/logic/MenuElement.js +7 -3
  72. package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
  73. package/es/core/BaseTable.d.ts +13 -0
  74. package/es/core/BaseTable.js +112 -40
  75. package/es/core/BaseTable.js.map +1 -1
  76. package/es/core/animation.js +1 -1
  77. package/es/core/animation.js.map +1 -1
  78. package/es/data/DataSource.js +2 -2
  79. package/es/data/DataSource.js.map +1 -1
  80. package/es/event/event.js +1 -3
  81. package/es/event/event.js.map +1 -1
  82. package/es/event/listener/container-dom.js +1 -0
  83. package/es/event/listener/container-dom.js.map +1 -1
  84. package/es/event/listener/table-group.js +5 -3
  85. package/es/event/listener/table-group.js.map +1 -1
  86. package/es/event/scroll.js +6 -5
  87. package/es/event/scroll.js.map +1 -1
  88. package/es/event/self-event-listener/base-table/right-button-click.js +2 -2
  89. package/es/event/self-event-listener/base-table/right-button-click.js.map +1 -1
  90. package/es/index.d.ts +1 -1
  91. package/es/index.js +1 -1
  92. package/es/index.js.map +1 -1
  93. package/es/layout/row-height-map.js +10 -3
  94. package/es/layout/row-height-map.js.map +1 -1
  95. package/es/layout/simple-header-layout.js +2 -2
  96. package/es/layout/simple-header-layout.js.map +1 -1
  97. package/es/scenegraph/component/custom.js.map +1 -1
  98. package/es/scenegraph/graphic/contributions/group-contribution-render.js +6 -3
  99. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  100. package/es/scenegraph/graphic/icon.d.ts +1 -0
  101. package/es/scenegraph/graphic/icon.js +6 -1
  102. package/es/scenegraph/graphic/icon.js.map +1 -1
  103. package/es/scenegraph/group-creater/cell-helper.js +2 -2
  104. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  105. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +4 -4
  106. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  107. package/es/scenegraph/group-creater/progress/proxy.js +3 -3
  108. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  109. package/es/scenegraph/scenegraph.js +22 -17
  110. package/es/scenegraph/scenegraph.js.map +1 -1
  111. package/es/state/state.js +1 -1
  112. package/es/state/state.js.map +1 -1
  113. package/es/tools/env.d.ts +1 -0
  114. package/es/tools/env.js +11 -0
  115. package/es/tools/env.js.map +1 -1
  116. package/es/ts-types/base-table.d.ts +10 -0
  117. package/es/ts-types/base-table.js.map +1 -1
  118. package/es/vrender.d.ts +3 -3
  119. package/es/vrender.js +2 -4
  120. package/es/vrender.js.map +1 -1
  121. package/package.json +7 -6
@@ -89,8 +89,8 @@ export class BaseTable extends EventTarget {
89
89
  return TABLE_EVENT_TYPE;
90
90
  }
91
91
  constructor(container, options = {}) {
92
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
93
- if (super(), this.showFrozenIcon = !0, this.version = "1.0.2", this.id = `VTable${Date.now()}`,
92
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
93
+ if (super(), this.showFrozenIcon = !0, this.version = "1.0.4", this.id = `VTable${Date.now()}`,
94
94
  this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
95
95
  "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
96
96
  container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
@@ -99,11 +99,22 @@ export class BaseTable extends EventTarget {
99
99
  container: container
100
100
  }), container = options.container && options.container instanceof HTMLElement ? options.container : container,
101
101
  !1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vglobal.isImageAnonymous = !1);
102
- const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, 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, enableCheckboxCascade: enableCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, 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;
102
+ const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, frozenRowCount: frozenRowCount, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, containerFit: containerFit = {
103
+ width: !1,
104
+ height: !1
105
+ }, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, enableCheckboxCascade: enableCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, 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
106
  this.container = container, this.options = options, this._widthMode = widthMode,
104
107
  this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
105
- this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, this.customRender = customRender,
106
- this.padding = {
108
+ this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, void 0 !== containerFit && (this._containerFit = "boolean" == typeof containerFit ? {
109
+ width: containerFit,
110
+ height: containerFit
111
+ } : containerFit && "object" == typeof containerFit ? {
112
+ width: null === (_b = containerFit.width) || void 0 === _b || _b,
113
+ height: null === (_c = containerFit.height) || void 0 === _c || _c
114
+ } : {
115
+ width: !1,
116
+ height: !1
117
+ }), this.customRender = customRender, this.padding = {
107
118
  top: 0,
108
119
  right: 0,
109
120
  left: 0,
@@ -113,7 +124,7 @@ export class BaseTable extends EventTarget {
113
124
  padding.bottom && (this.padding.bottom = padding.bottom), padding.left && (this.padding.left = padding.left),
114
125
  padding.right && (this.padding.right = padding.right))), (isValid(canvasHeight) || isValid(canvasWidth)) && (this.canvasSizeSeted = !0),
115
126
  this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.canvasWidth = isNumber(canvasWidth) ? canvasWidth : void 0,
116
- this.canvasHeight = isNumber(canvasHeight) ? canvasHeight : void 0, this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal";
127
+ this.canvasHeight = isNumber(canvasHeight) ? canvasHeight : void 0, this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal";
117
128
  const internalProps = this.internalProps = {};
118
129
  void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
119
130
  this.options.canvas ? ("node" !== Env.mode && (internalProps.element = this.options.canvas.parentElement,
@@ -121,7 +132,7 @@ export class BaseTable extends EventTarget {
121
132
  internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding),
122
133
  internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"),
123
134
  internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d"),
124
- (null === (_c = options.customConfig) || void 0 === _c ? void 0 : _c.createReactContainer) && createReactContainer(this)),
135
+ (null === (_e = options.customConfig) || void 0 === _e ? void 0 : _e.createReactContainer) && createReactContainer(this)),
125
136
  internalProps.handler = new EventHandler, isNumber(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
126
137
  internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount,
127
138
  internalProps.frozenRowCount = frozenRowCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth,
@@ -129,9 +140,9 @@ export class BaseTable extends EventTarget {
129
140
  internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
130
141
  internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
131
142
  internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = enableCheckboxCascade,
132
- internalProps.columnResizeMode = null !== (_d = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _d ? _d : columnResizeMode,
133
- internalProps.rowResizeMode = null !== (_e = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _e ? _e : rowResizeMode,
134
- internalProps.dragHeaderMode = null !== (_g = null !== (_f = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _f ? _f : dragHeaderMode) && void 0 !== _g ? _g : "none",
143
+ internalProps.columnResizeMode = null !== (_f = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _f ? _f : columnResizeMode,
144
+ internalProps.rowResizeMode = null !== (_g = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _g ? _g : rowResizeMode,
145
+ internalProps.dragHeaderMode = null !== (_j = null !== (_h = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _h ? _h : dragHeaderMode) && void 0 !== _j ? _j : "none",
135
146
  internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount),
136
147
  internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
137
148
  internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map,
@@ -145,14 +156,14 @@ export class BaseTable extends EventTarget {
145
156
  var _a;
146
157
  return "node" === Env.mode ? that.canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
147
158
  }
148
- }, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_h = options.theme) && void 0 !== _h ? _h : themes.DEFAULT),
159
+ }, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_k = options.theme) && void 0 !== _k ? _k : themes.DEFAULT),
149
160
  internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle),
150
161
  container ? (clearDOM && (container.innerHTML = ""), container.appendChild(internalProps.element),
151
162
  this._updateSize()) : this._updateSize(), internalProps.bodyHelper = new BodyHelper(this),
152
163
  internalProps.headerHelper = new HeaderHelper(this), internalProps.rowSeriesNumberHelper = new RowSeriesNumberHelper(this),
153
164
  internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak,
154
- internalProps.allowFrozenColCount = null !== (_j = options.allowFrozenColCount) && void 0 !== _j ? _j : 0,
155
- internalProps.limitMaxAutoWidth = null !== (_k = options.limitMaxAutoWidth) && void 0 !== _k ? _k : 450,
165
+ internalProps.allowFrozenColCount = null !== (_l = options.allowFrozenColCount) && void 0 !== _l ? _l : 0,
166
+ internalProps.limitMaxAutoWidth = null !== (_m = options.limitMaxAutoWidth) && void 0 !== _m ? _m : 450,
156
167
  internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
157
168
  internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
158
169
  this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this),
@@ -183,8 +194,8 @@ export class BaseTable extends EventTarget {
183
194
  }
184
195
  if (internalProps.menu = Object.assign({
185
196
  renderMode: "html"
186
- }, options.menu), Array.isArray(null === (_l = options.menu) || void 0 === _l ? void 0 : _l.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_m = options.menu) || void 0 === _m ? void 0 : _m.dropDownMenuHighlight),
187
- (Array.isArray(null === (_o = options.menu) || void 0 === _o ? void 0 : _o.defaultHeaderMenuItems) || "function" == typeof (null === (_p = options.menu) || void 0 === _p ? void 0 : _p.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
197
+ }, options.menu), Array.isArray(null === (_o = options.menu) || void 0 === _o ? void 0 : _o.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_p = options.menu) || void 0 === _p ? void 0 : _p.dropDownMenuHighlight),
198
+ (Array.isArray(null === (_q = options.menu) || void 0 === _q ? void 0 : _q.defaultHeaderMenuItems) || "function" == typeof (null === (_r = options.menu) || void 0 === _r ? void 0 : _r.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
188
199
  "html" === internalProps.menu.renderMode) {
189
200
  const MenuHandler = Factory.getComponent("menuHandler");
190
201
  internalProps.menuHandler = new MenuHandler(this);
@@ -194,7 +205,7 @@ export class BaseTable extends EventTarget {
194
205
  changedCells: new Map
195
206
  }, internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell);
196
207
  const CustomCellStylePlugin = Factory.getComponent("customCellStylePlugin");
197
- CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_q = options.customCellStyle) && void 0 !== _q ? _q : [], null !== (_r = options.customCellStyleArrangement) && void 0 !== _r ? _r : [])),
208
+ CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_s = options.customCellStyle) && void 0 !== _s ? _s : [], null !== (_t = options.customCellStyleArrangement) && void 0 !== _t ? _t : [])),
198
209
  this._adjustCanvasSizeByOption();
199
210
  }
200
211
  _adjustCanvasSizeByOption() {
@@ -521,13 +532,14 @@ export class BaseTable extends EventTarget {
521
532
  if (null != cachedColWidth) return cachedColWidth;
522
533
  const cachedLowerColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol - 1}`);
523
534
  if (null != cachedLowerColWidth) {
524
- const addWidth = cachedLowerColWidth + this.getColWidth(endCol);
525
- return startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth) && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)),
535
+ let addWidth = cachedLowerColWidth + this.getColWidth(endCol);
536
+ return this.rightFrozenColCount > 0 && endCol === this.colCount - this.rightFrozenColCount && (addWidth = this._getRangeSizeForContainerFit(startCol, endCol, addWidth, "col")),
537
+ startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth) && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)),
526
538
  Math.round(addWidth);
527
539
  }
528
540
  let w = 0;
529
541
  for (let col = startCol; col <= endCol; col++) w += this.getColWidth(col);
530
- return startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
542
+ return w = this._getRangeSizeForContainerFit(startCol, endCol, w, "col"), startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
531
543
  Math.round(w);
532
544
  }
533
545
  getRowHeight(row) {
@@ -576,12 +588,43 @@ export class BaseTable extends EventTarget {
576
588
  }
577
589
  h = this.rowHeightsMap.getSumInRange(startRow, endRow);
578
590
  } else {
591
+ const bottomFrozenStartRow = this.rowCount - this.bottomFrozenRowCount;
579
592
  for (let i = startRow; i < Math.min(endRow + 1, this.columnHeaderLevelCount); i++) h += this.getRowHeight(i);
580
- endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, this.rowCount - this.bottomFrozenRowCount - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
581
- for (let i = this.rowCount - this.bottomFrozenRowCount; i < endRow + 1; i++) h += this.getRowHeight(i);
593
+ endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, bottomFrozenStartRow - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
594
+ let currentBottomFrozenRowsHeight = 0;
595
+ for (let i = bottomFrozenStartRow; i < endRow + 1; i++) currentBottomFrozenRowsHeight += this.getRowHeight(i);
596
+ h = this._getRangeSizeForContainerFit(startRow, endRow, h + currentBottomFrozenRowsHeight, "row");
582
597
  }
583
598
  return Math.round(h);
584
599
  }
600
+ _getRangeSizeForContainerFit(start, end, totalSize, type = "col") {
601
+ var _a;
602
+ if (!isFinite(start) || !isFinite(end)) return totalSize;
603
+ const keyMap = "col" === type ? {
604
+ totalCount: "colCount",
605
+ frozenCount: "rightFrozenColCount",
606
+ fitType: "width",
607
+ tableSize: "tableNoFrameWidth",
608
+ getSize: "getColWidth"
609
+ } : {
610
+ totalCount: "rowCount",
611
+ frozenCount: "bottomFrozenRowCount",
612
+ fitType: "height",
613
+ tableSize: "tableNoFrameHeight",
614
+ getSize: "getRowHeight"
615
+ }, tableSize = this[keyMap.tableSize];
616
+ if (totalSize >= tableSize) return totalSize;
617
+ const frozenStart = this[keyMap.totalCount] - this[keyMap.frozenCount];
618
+ if (!isFinite(this[keyMap.totalCount]) || this[keyMap.frozenCount] <= 0 || frozenStart < 0) return totalSize;
619
+ if (start > frozenStart || end < frozenStart || start === end || !(null === (_a = this.containerFit) || void 0 === _a ? void 0 : _a[keyMap.fitType])) return totalSize;
620
+ const last = this[keyMap.totalCount] - 1;
621
+ let size = tableSize;
622
+ if (start > 0) for (let i = 0; i < start; i++) if (size -= this[keyMap.getSize](i),
623
+ size <= 0) return totalSize;
624
+ if (end !== last) for (let i = end + 1; i <= last; i++) if (size -= this[keyMap.getSize](i),
625
+ size <= 0) return totalSize;
626
+ return size;
627
+ }
585
628
  getColWidthDefined(col) {
586
629
  var _a;
587
630
  const {layoutMap: layoutMap} = this.internalProps;
@@ -904,10 +947,10 @@ export class BaseTable extends EventTarget {
904
947
  return super.fireListeners(type, event);
905
948
  }
906
949
  updateOption(options) {
907
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
950
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
908
951
  null === (_a = this.editorManager) || void 0 === _a || _a.cancelEdit(), this.options = options,
909
952
  this._hasAutoImageColumn = void 0;
910
- const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth = 80, keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, enableCheckboxCascade: enableCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, pixelRatio: pixelRatio, widthMode: widthMode, heightMode: heightMode, autoFillWidth: autoFillWidth, autoFillHeight: autoFillHeight, widthAdaptiveMode: widthAdaptiveMode, heightAdaptiveMode: heightAdaptiveMode, customRender: customRender, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight} = options;
953
+ const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth = 80, keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, enableCheckboxCascade: enableCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, pixelRatio: pixelRatio, widthMode: widthMode, heightMode: heightMode, autoFillWidth: autoFillWidth, autoFillHeight: autoFillHeight, containerFit: containerFit, widthAdaptiveMode: widthAdaptiveMode, heightAdaptiveMode: heightAdaptiveMode, customRender: customRender, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight} = options;
911
954
  pixelRatio && pixelRatio !== this.internalProps.pixelRatio && (this.internalProps.pixelRatio = pixelRatio),
912
955
  padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding,
913
956
  this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top),
@@ -918,36 +961,45 @@ export class BaseTable extends EventTarget {
918
961
  this._widthAdaptiveMode = null != widthAdaptiveMode ? widthAdaptiveMode : "only-body",
919
962
  this._heightAdaptiveMode = null != heightAdaptiveMode ? heightAdaptiveMode : "only-body",
920
963
  this.autoFillWidth = null != autoFillWidth && autoFillWidth, this.autoFillHeight = null != autoFillHeight && autoFillHeight,
921
- this.customRender = customRender, this.canvasWidth = isNumber(canvasWidth) ? canvasWidth : void 0,
964
+ void 0 !== containerFit && (this._containerFit = "boolean" == typeof containerFit ? {
965
+ width: containerFit,
966
+ height: containerFit
967
+ } : containerFit && "object" == typeof containerFit ? {
968
+ width: null === (_b = containerFit.width) || void 0 === _b || _b,
969
+ height: null === (_c = containerFit.height) || void 0 === _c || _c
970
+ } : {
971
+ width: !1,
972
+ height: !1
973
+ }), this.customRender = customRender, this.canvasWidth = isNumber(canvasWidth) ? canvasWidth : void 0,
922
974
  this.canvasHeight = isNumber(canvasHeight) ? canvasHeight : void 0;
923
975
  const internalProps = this.internalProps;
924
976
  if ("node" === Env.mode || options.canvas || updateRootElementPadding(internalProps.element, this.padding),
925
- this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal",
977
+ this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal",
926
978
  internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth,
927
979
  internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
928
980
  internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
929
981
  internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
930
982
  internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = enableCheckboxCascade,
931
- internalProps.columnResizeMode = null !== (_c = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _c ? _c : columnResizeMode,
932
- internalProps.rowResizeMode = null !== (_d = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _d ? _d : rowResizeMode,
933
- internalProps.dragHeaderMode = null !== (_f = null !== (_e = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _e ? _e : dragHeaderMode) && void 0 !== _f ? _f : "none",
983
+ internalProps.columnResizeMode = null !== (_e = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _e ? _e : columnResizeMode,
984
+ internalProps.rowResizeMode = null !== (_f = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _f ? _f : rowResizeMode,
985
+ internalProps.dragHeaderMode = null !== (_h = null !== (_g = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _g ? _g : dragHeaderMode) && void 0 !== _h ? _h : "none",
934
986
  internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount),
935
987
  internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
936
988
  internalProps.cellTextOverflows = {}, internalProps._rowHeightsMap = new NumberRangeMap(this),
937
989
  internalProps._rowRangeHeightsMap = new Map, internalProps._colRangeWidthsMap = new Map,
938
990
  internalProps._widthResizedColMap = new Set, internalProps._heightResizedRowMap = new Set,
939
991
  this.colWidthsMap = new NumberMap, this.colContentWidthsMap = new NumberMap, this.colWidthsLimit = {},
940
- internalProps.stick.changedCells.clear(), internalProps.theme = themes.of(null !== (_g = options.theme) && void 0 !== _g ? _g : themes.DEFAULT),
992
+ internalProps.stick.changedCells.clear(), internalProps.theme = themes.of(null !== (_j = options.theme) && void 0 !== _j ? _j : themes.DEFAULT),
941
993
  internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle),
942
994
  this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText,
943
- internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_h = options.allowFrozenColCount) && void 0 !== _h ? _h : 0,
944
- internalProps.limitMaxAutoWidth = null !== (_j = options.limitMaxAutoWidth) && void 0 !== _j ? _j : 450,
995
+ internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_k = options.allowFrozenColCount) && void 0 !== _k ? _k : 0,
996
+ internalProps.limitMaxAutoWidth = null !== (_l = options.limitMaxAutoWidth) && void 0 !== _l ? _l : 450,
945
997
  internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
946
998
  internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
947
- null === (_k = internalProps.legends) || void 0 === _k || _k.forEach((legend => {
999
+ null === (_m = internalProps.legends) || void 0 === _m || _m.forEach((legend => {
948
1000
  null == legend || legend.release();
949
- })), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.title = null,
950
- null === (_m = internalProps.emptyTip) || void 0 === _m || _m.release(), internalProps.emptyTip = null,
1001
+ })), null === (_o = internalProps.title) || void 0 === _o || _o.release(), internalProps.title = null,
1002
+ null === (_p = internalProps.emptyTip) || void 0 === _p || _p.release(), internalProps.emptyTip = null,
951
1003
  internalProps.layoutMap.release(), clearChartRenderQueue(), this.scenegraph.clearCells(),
952
1004
  this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(),
953
1005
  this.eventManager.updateEventBinder(), options.legends) {
@@ -976,15 +1028,15 @@ export class BaseTable extends EventTarget {
976
1028
  }
977
1029
  if (internalProps.menu = Object.assign({
978
1030
  renderMode: "html"
979
- }, options.menu), Array.isArray(null === (_o = options.menu) || void 0 === _o ? void 0 : _o.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_p = options.menu) || void 0 === _p ? void 0 : _p.dropDownMenuHighlight),
980
- (Array.isArray(null === (_q = options.menu) || void 0 === _q ? void 0 : _q.defaultHeaderMenuItems) || "function" == typeof (null === (_r = options.menu) || void 0 === _r ? void 0 : _r.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
1031
+ }, options.menu), Array.isArray(null === (_q = options.menu) || void 0 === _q ? void 0 : _q.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_r = options.menu) || void 0 === _r ? void 0 : _r.dropDownMenuHighlight),
1032
+ (Array.isArray(null === (_s = options.menu) || void 0 === _s ? void 0 : _s.defaultHeaderMenuItems) || "function" == typeof (null === (_t = options.menu) || void 0 === _t ? void 0 : _t.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
981
1033
  "html" === internalProps.menu.renderMode && !internalProps.menuHandler) {
982
1034
  const MenuHandler = Factory.getComponent("menuHandler");
983
1035
  internalProps.menuHandler = new MenuHandler(this);
984
1036
  }
985
1037
  this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(),
986
1038
  internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell),
987
- null === (_s = this.customCellStylePlugin) || void 0 === _s || _s.updateCustomCell(null !== (_t = options.customCellStyle) && void 0 !== _t ? _t : [], null !== (_u = options.customCellStyleArrangement) && void 0 !== _u ? _u : []),
1039
+ null === (_u = this.customCellStylePlugin) || void 0 === _u || _u.updateCustomCell(null !== (_v = options.customCellStyle) && void 0 !== _v ? _v : [], null !== (_w = options.customCellStyleArrangement) && void 0 !== _w ? _w : []),
988
1040
  this._adjustCanvasSizeByOption();
989
1041
  }
990
1042
  renderWithRecreateCells() {
@@ -1020,7 +1072,8 @@ export class BaseTable extends EventTarget {
1020
1072
  return 0;
1021
1073
  }
1022
1074
  getDrawRange() {
1023
- const width = Math.min(this.tableNoFrameWidth, this.getAllColsWidth()), height = Math.min(this.tableNoFrameHeight, this.getAllRowsHeight());
1075
+ var _a, _b;
1076
+ const width = (null === (_a = this.containerFit) || void 0 === _a ? void 0 : _a.width) ? this.tableNoFrameWidth : Math.min(this.tableNoFrameWidth, this.getAllColsWidth()), height = (null === (_b = this.containerFit) || void 0 === _b ? void 0 : _b.height) ? this.tableNoFrameHeight : Math.min(this.tableNoFrameHeight, this.getAllRowsHeight());
1024
1077
  return new Rect(this.tableX, this.tableY, width, height);
1025
1078
  }
1026
1079
  _getMouseAbstractPoint(evt) {
@@ -1770,8 +1823,11 @@ export class BaseTable extends EventTarget {
1770
1823
  this.render();
1771
1824
  const stage = this.scenegraph.stage;
1772
1825
  if (stage) {
1773
- const contentWidth = this.tableX + this.getAllColsWidth(), contentHeight = this.tableY + this.getAllRowsHeight();
1774
- if (contentWidth >= this.canvasWidth && contentHeight >= this.canvasHeight) {
1826
+ let contentWidth = this.tableX + this.getAllColsWidth(), contentHeight = this.tableY + this.getAllRowsHeight();
1827
+ if (this.internalProps.legends && this.internalProps.legends.forEach((legend => {
1828
+ "right" === legend.orient ? contentWidth = Math.max(contentWidth, legend.legendComponent.globalAABBBounds.x2) : "bottom" === legend.orient && (contentHeight = Math.max(contentHeight, legend.legendComponent.globalAABBBounds.y2));
1829
+ })), this.internalProps.title && ("right" === this.internalProps.title._titleOption.orient ? contentWidth = Math.max(contentWidth, this.internalProps.title.getComponentGraphic().globalAABBBounds.x2) : "bottom" === this.internalProps.title._titleOption.orient && (contentHeight = Math.max(contentHeight, this.internalProps.title.getComponentGraphic().globalAABBBounds.y2))),
1830
+ contentWidth >= this.canvasWidth && contentHeight >= this.canvasHeight) {
1775
1831
  stage.render();
1776
1832
  return stage.window.getImageBuffer(type);
1777
1833
  }
@@ -1919,5 +1975,21 @@ export class BaseTable extends EventTarget {
1919
1975
  checkHasColumnAutoWidth() {
1920
1976
  return checkHasColumnAutoWidth(this);
1921
1977
  }
1978
+ get containerFit() {
1979
+ return this._containerFit;
1980
+ }
1981
+ set containerFit(containerFit) {
1982
+ var _a, _b;
1983
+ this._containerFit = "boolean" == typeof containerFit ? {
1984
+ width: containerFit,
1985
+ height: containerFit
1986
+ } : containerFit && "object" == typeof containerFit ? {
1987
+ width: null === (_a = containerFit.width) || void 0 === _a || _a,
1988
+ height: null === (_b = containerFit.height) || void 0 === _b || _b
1989
+ } : {
1990
+ width: !1,
1991
+ height: !1
1992
+ };
1993
+ }
1922
1994
  }
1923
1995
  //# sourceMappingURL=BaseTable.js.map