k-vtable 1.0.3 → 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 (125) 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/dataset/dataset-pivot-table.js +1 -2
  20. package/cjs/dataset/flatDataToObject.js +2 -1
  21. package/cjs/event/event.js +2 -2
  22. package/cjs/event/event.js.map +1 -1
  23. package/cjs/event/listener/container-dom.js +1 -0
  24. package/cjs/event/listener/container-dom.js.map +1 -1
  25. package/cjs/event/listener/table-group.js +4 -4
  26. package/cjs/event/listener/table-group.js.map +1 -1
  27. package/cjs/event/scroll.js +6 -5
  28. package/cjs/event/scroll.js.map +1 -1
  29. package/cjs/event/self-event-listener/base-table/right-button-click.js +2 -2
  30. package/cjs/event/self-event-listener/base-table/right-button-click.js.map +1 -1
  31. package/cjs/index.d.ts +1 -1
  32. package/cjs/index.js +1 -1
  33. package/cjs/index.js.map +1 -1
  34. package/cjs/layout/row-height-map.js +10 -3
  35. package/cjs/layout/row-height-map.js.map +1 -1
  36. package/cjs/layout/simple-header-layout.js +2 -2
  37. package/cjs/layout/simple-header-layout.js.map +1 -1
  38. package/cjs/scenegraph/component/custom.js.map +1 -1
  39. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
  40. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  41. package/cjs/scenegraph/graphic/icon.d.ts +1 -0
  42. package/cjs/scenegraph/graphic/icon.js +30 -2
  43. package/cjs/scenegraph/graphic/icon.js.map +1 -1
  44. package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
  45. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  46. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +4 -4
  47. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  48. package/cjs/scenegraph/group-creater/progress/proxy.js +3 -3
  49. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  50. package/cjs/scenegraph/scenegraph.js +22 -17
  51. package/cjs/scenegraph/scenegraph.js.map +1 -1
  52. package/cjs/state/state.js +1 -1
  53. package/cjs/state/state.js.map +1 -1
  54. package/cjs/tools/env.d.ts +1 -0
  55. package/cjs/tools/env.js +13 -2
  56. package/cjs/tools/env.js.map +1 -1
  57. package/cjs/ts-types/base-table.d.ts +10 -0
  58. package/cjs/ts-types/base-table.js.map +1 -1
  59. package/cjs/vrender.d.ts +3 -3
  60. package/cjs/vrender.js +4 -21
  61. package/cjs/vrender.js.map +1 -1
  62. package/dist/vtable.js +4919 -3998
  63. package/dist/vtable.min.js +2 -2
  64. package/es/ListTable.d.ts +3 -1
  65. package/es/ListTable.js +2 -1
  66. package/es/ListTable.js.map +1 -1
  67. package/es/body-helper/style/ButtonStyle.d.ts +1 -1
  68. package/es/body-helper/style/ButtonStyle.js +1 -1
  69. package/es/body-helper/style/ButtonStyle.js.map +1 -1
  70. package/es/body-helper/style/SwitchStyle.d.ts +1 -1
  71. package/es/body-helper/style/SwitchStyle.js +1 -1
  72. package/es/body-helper/style/SwitchStyle.js.map +1 -1
  73. package/es/components/menu/dom/logic/MenuElement.js +7 -3
  74. package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
  75. package/es/core/BaseTable.d.ts +13 -0
  76. package/es/core/BaseTable.js +112 -40
  77. package/es/core/BaseTable.js.map +1 -1
  78. package/es/core/animation.js +1 -1
  79. package/es/core/animation.js.map +1 -1
  80. package/es/data/DataSource.js +2 -2
  81. package/es/data/DataSource.js.map +1 -1
  82. package/es/dataset/dataset-pivot-table.js +1 -2
  83. package/es/dataset/flatDataToObject.js +2 -1
  84. package/es/event/event.js +1 -3
  85. package/es/event/event.js.map +1 -1
  86. package/es/event/listener/container-dom.js +1 -0
  87. package/es/event/listener/container-dom.js.map +1 -1
  88. package/es/event/listener/table-group.js +5 -3
  89. package/es/event/listener/table-group.js.map +1 -1
  90. package/es/event/scroll.js +6 -5
  91. package/es/event/scroll.js.map +1 -1
  92. package/es/event/self-event-listener/base-table/right-button-click.js +2 -2
  93. package/es/event/self-event-listener/base-table/right-button-click.js.map +1 -1
  94. package/es/index.d.ts +1 -1
  95. package/es/index.js +1 -1
  96. package/es/index.js.map +1 -1
  97. package/es/layout/row-height-map.js +10 -3
  98. package/es/layout/row-height-map.js.map +1 -1
  99. package/es/layout/simple-header-layout.js +2 -2
  100. package/es/layout/simple-header-layout.js.map +1 -1
  101. package/es/scenegraph/component/custom.js.map +1 -1
  102. package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
  103. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  104. package/es/scenegraph/graphic/icon.d.ts +1 -0
  105. package/es/scenegraph/graphic/icon.js +6 -1
  106. package/es/scenegraph/graphic/icon.js.map +1 -1
  107. package/es/scenegraph/group-creater/cell-helper.js +2 -2
  108. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  109. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +4 -4
  110. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  111. package/es/scenegraph/group-creater/progress/proxy.js +3 -3
  112. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  113. package/es/scenegraph/scenegraph.js +22 -17
  114. package/es/scenegraph/scenegraph.js.map +1 -1
  115. package/es/state/state.js +1 -1
  116. package/es/state/state.js.map +1 -1
  117. package/es/tools/env.d.ts +1 -0
  118. package/es/tools/env.js +11 -0
  119. package/es/tools/env.js.map +1 -1
  120. package/es/ts-types/base-table.d.ts +10 -0
  121. package/es/ts-types/base-table.js.map +1 -1
  122. package/es/vrender.d.ts +3 -3
  123. package/es/vrender.js +2 -4
  124. package/es/vrender.js.map +1 -1
  125. package/package.json +7 -6
@@ -42,8 +42,8 @@ class BaseTable extends EventTarget_1.EventTarget {
42
42
  return TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE;
43
43
  }
44
44
  constructor(container, options = {}) {
45
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
46
- if (super(), this.showFrozenIcon = !0, this.version = "1.0.3", this.id = `VTable${Date.now()}`,
45
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
46
+ if (super(), this.showFrozenIcon = !0, this.version = "1.0.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
  "node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
49
49
  container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
@@ -52,11 +52,22 @@ class BaseTable extends EventTarget_1.EventTarget {
52
52
  container: container
53
53
  }), container = options.container && options.container instanceof HTMLElement ? options.container : container,
54
54
  !1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vrender_1.vglobal.isImageAnonymous = !1);
55
- 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 = 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;
55
+ 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 = {
56
+ width: !1,
57
+ height: !1
58
+ }, 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 = 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;
56
59
  this.container = container, this.options = options, this._widthMode = widthMode,
57
60
  this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
58
- this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, this.customRender = customRender,
59
- this.padding = {
61
+ this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, void 0 !== containerFit && (this._containerFit = "boolean" == typeof containerFit ? {
62
+ width: containerFit,
63
+ height: containerFit
64
+ } : containerFit && "object" == typeof containerFit ? {
65
+ width: null === (_b = containerFit.width) || void 0 === _b || _b,
66
+ height: null === (_c = containerFit.height) || void 0 === _c || _c
67
+ } : {
68
+ width: !1,
69
+ height: !1
70
+ }), this.customRender = customRender, this.padding = {
60
71
  top: 0,
61
72
  right: 0,
62
73
  left: 0,
@@ -68,7 +79,7 @@ class BaseTable extends EventTarget_1.EventTarget {
68
79
  vutils_1.isValid)(canvasWidth)) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0,
69
80
  this.tableNoFrameHeight = 0, this.canvasWidth = (0, vutils_1.isNumber)(canvasWidth) ? canvasWidth : void 0,
70
81
  this.canvasHeight = (0, vutils_1.isNumber)(canvasHeight) ? canvasHeight : void 0,
71
- this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal";
82
+ this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal";
72
83
  const internalProps = this.internalProps = {};
73
84
  void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
74
85
  this.options.canvas ? ("node" !== env_1.Env.mode && (internalProps.element = this.options.canvas.parentElement,
@@ -76,7 +87,7 @@ class BaseTable extends EventTarget_1.EventTarget {
76
87
  internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== env_1.Env.mode && (internalProps.element = (0,
77
88
  tableHelper_1.createRootElement)(this.padding), internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
78
89
  internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas),
79
- internalProps.context = internalProps.canvas.getContext("2d"), (null === (_c = options.customConfig) || void 0 === _c ? void 0 : _c.createReactContainer) && (0,
90
+ internalProps.context = internalProps.canvas.getContext("2d"), (null === (_e = options.customConfig) || void 0 === _e ? void 0 : _e.createReactContainer) && (0,
80
91
  frozen_react_1.createReactContainer)(this)), internalProps.handler = new EventHandler_1.EventHandler,
81
92
  (0, vutils_1.isNumber)(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
82
93
  internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount,
@@ -85,9 +96,9 @@ class BaseTable extends EventTarget_1.EventTarget {
85
96
  internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
86
97
  internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
87
98
  internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = enableCheckboxCascade,
88
- internalProps.columnResizeMode = null !== (_d = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _d ? _d : columnResizeMode,
89
- internalProps.rowResizeMode = null !== (_e = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _e ? _e : rowResizeMode,
90
- internalProps.dragHeaderMode = null !== (_g = null !== (_f = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _f ? _f : dragHeaderMode) && void 0 !== _g ? _g : "none",
99
+ internalProps.columnResizeMode = null !== (_f = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _f ? _f : columnResizeMode,
100
+ internalProps.rowResizeMode = null !== (_g = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _g ? _g : rowResizeMode,
101
+ internalProps.dragHeaderMode = null !== (_j = null !== (_h = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _h ? _h : dragHeaderMode) && void 0 !== _j ? _j : "none",
91
102
  internalProps.renderChartAsync = renderChartAsync, (0, chart_render_helper_1.setBatchRenderChartCount)(renderChartAsyncBatchCount),
92
103
  internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
93
104
  internalProps._rowHeightsMap = new row_height_map_1.NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map,
@@ -101,14 +112,14 @@ class BaseTable extends EventTarget_1.EventTarget {
101
112
  var _a;
102
113
  return "node" === env_1.Env.mode ? that.canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
103
114
  }
104
- }, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (_h = options.theme) && void 0 !== _h ? _h : themes_1.default.DEFAULT),
115
+ }, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (_k = options.theme) && void 0 !== _k ? _k : themes_1.default.DEFAULT),
105
116
  internalProps.theme.isPivot = this.isPivotTable(), (0, icons_1.setIconColor)(internalProps.theme.functionalIconsStyle),
106
117
  container ? (clearDOM && (container.innerHTML = ""), container.appendChild(internalProps.element),
107
118
  this._updateSize()) : this._updateSize(), internalProps.bodyHelper = new body_helper_1.BodyHelper(this),
108
119
  internalProps.headerHelper = new header_helper_1.HeaderHelper(this), internalProps.rowSeriesNumberHelper = new row_series_number_helper_1.RowSeriesNumberHelper(this),
109
120
  internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak,
110
- internalProps.allowFrozenColCount = null !== (_j = options.allowFrozenColCount) && void 0 !== _j ? _j : 0,
111
- internalProps.limitMaxAutoWidth = null !== (_k = options.limitMaxAutoWidth) && void 0 !== _k ? _k : 450,
121
+ internalProps.allowFrozenColCount = null !== (_l = options.allowFrozenColCount) && void 0 !== _l ? _l : 0,
122
+ internalProps.limitMaxAutoWidth = null !== (_m = options.limitMaxAutoWidth) && void 0 !== _m ? _m : 450,
112
123
  internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
113
124
  internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
114
125
  this.scenegraph = new scenegraph_1.Scenegraph(this), this.stateManager = new state_1.StateManager(this),
@@ -139,8 +150,8 @@ class BaseTable extends EventTarget_1.EventTarget {
139
150
  }
140
151
  if (internalProps.menu = Object.assign({
141
152
  renderMode: "html"
142
- }, 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),
143
- (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),
153
+ }, 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),
154
+ (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),
144
155
  "html" === internalProps.menu.renderMode) {
145
156
  const MenuHandler = factory_1.Factory.getComponent("menuHandler");
146
157
  internalProps.menuHandler = new MenuHandler(this);
@@ -150,7 +161,7 @@ class BaseTable extends EventTarget_1.EventTarget {
150
161
  changedCells: new Map
151
162
  }, internalProps.customMergeCell = (0, get_custom_merge_cell_func_1.getCustomMergeCellFunc)(options.customMergeCell);
152
163
  const CustomCellStylePlugin = factory_1.Factory.getComponent("customCellStylePlugin");
153
- CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_q = options.customCellStyle) && void 0 !== _q ? _q : [], null !== (_r = options.customCellStyleArrangement) && void 0 !== _r ? _r : [])),
164
+ CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_s = options.customCellStyle) && void 0 !== _s ? _s : [], null !== (_t = options.customCellStyleArrangement) && void 0 !== _t ? _t : [])),
154
165
  this._adjustCanvasSizeByOption();
155
166
  }
156
167
  _adjustCanvasSizeByOption() {
@@ -477,13 +488,14 @@ class BaseTable extends EventTarget_1.EventTarget {
477
488
  if (null != cachedColWidth) return cachedColWidth;
478
489
  const cachedLowerColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol - 1}`);
479
490
  if (null != cachedLowerColWidth) {
480
- const addWidth = cachedLowerColWidth + this.getColWidth(endCol);
481
- return startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth) && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)),
491
+ let addWidth = cachedLowerColWidth + this.getColWidth(endCol);
492
+ return this.rightFrozenColCount > 0 && endCol === this.colCount - this.rightFrozenColCount && (addWidth = this._getRangeSizeForContainerFit(startCol, endCol, addWidth, "col")),
493
+ startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth) && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)),
482
494
  Math.round(addWidth);
483
495
  }
484
496
  let w = 0;
485
497
  for (let col = startCol; col <= endCol; col++) w += this.getColWidth(col);
486
- return startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
498
+ return w = this._getRangeSizeForContainerFit(startCol, endCol, w, "col"), startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
487
499
  Math.round(w);
488
500
  }
489
501
  getRowHeight(row) {
@@ -532,12 +544,43 @@ class BaseTable extends EventTarget_1.EventTarget {
532
544
  }
533
545
  h = this.rowHeightsMap.getSumInRange(startRow, endRow);
534
546
  } else {
547
+ const bottomFrozenStartRow = this.rowCount - this.bottomFrozenRowCount;
535
548
  for (let i = startRow; i < Math.min(endRow + 1, this.columnHeaderLevelCount); i++) h += this.getRowHeight(i);
536
- endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, this.rowCount - this.bottomFrozenRowCount - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
537
- for (let i = this.rowCount - this.bottomFrozenRowCount; i < endRow + 1; i++) h += this.getRowHeight(i);
549
+ endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, bottomFrozenStartRow - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
550
+ let currentBottomFrozenRowsHeight = 0;
551
+ for (let i = bottomFrozenStartRow; i < endRow + 1; i++) currentBottomFrozenRowsHeight += this.getRowHeight(i);
552
+ h = this._getRangeSizeForContainerFit(startRow, endRow, h + currentBottomFrozenRowsHeight, "row");
538
553
  }
539
554
  return Math.round(h);
540
555
  }
556
+ _getRangeSizeForContainerFit(start, end, totalSize, type = "col") {
557
+ var _a;
558
+ if (!isFinite(start) || !isFinite(end)) return totalSize;
559
+ const keyMap = "col" === type ? {
560
+ totalCount: "colCount",
561
+ frozenCount: "rightFrozenColCount",
562
+ fitType: "width",
563
+ tableSize: "tableNoFrameWidth",
564
+ getSize: "getColWidth"
565
+ } : {
566
+ totalCount: "rowCount",
567
+ frozenCount: "bottomFrozenRowCount",
568
+ fitType: "height",
569
+ tableSize: "tableNoFrameHeight",
570
+ getSize: "getRowHeight"
571
+ }, tableSize = this[keyMap.tableSize];
572
+ if (totalSize >= tableSize) return totalSize;
573
+ const frozenStart = this[keyMap.totalCount] - this[keyMap.frozenCount];
574
+ if (!isFinite(this[keyMap.totalCount]) || this[keyMap.frozenCount] <= 0 || frozenStart < 0) return totalSize;
575
+ if (start > frozenStart || end < frozenStart || start === end || !(null === (_a = this.containerFit) || void 0 === _a ? void 0 : _a[keyMap.fitType])) return totalSize;
576
+ const last = this[keyMap.totalCount] - 1;
577
+ let size = tableSize;
578
+ if (start > 0) for (let i = 0; i < start; i++) if (size -= this[keyMap.getSize](i),
579
+ size <= 0) return totalSize;
580
+ if (end !== last) for (let i = end + 1; i <= last; i++) if (size -= this[keyMap.getSize](i),
581
+ size <= 0) return totalSize;
582
+ return size;
583
+ }
541
584
  getColWidthDefined(col) {
542
585
  var _a;
543
586
  const {layoutMap: layoutMap} = this.internalProps;
@@ -862,10 +905,10 @@ class BaseTable extends EventTarget_1.EventTarget {
862
905
  return super.fireListeners(type, event);
863
906
  }
864
907
  updateOption(options) {
865
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
908
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
866
909
  null === (_a = this.editorManager) || void 0 === _a || _a.cancelEdit(), this.options = options,
867
910
  this._hasAutoImageColumn = void 0;
868
- 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;
911
+ 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;
869
912
  pixelRatio && pixelRatio !== this.internalProps.pixelRatio && (this.internalProps.pixelRatio = pixelRatio),
870
913
  padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding,
871
914
  this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top),
@@ -876,36 +919,45 @@ class BaseTable extends EventTarget_1.EventTarget {
876
919
  this._widthAdaptiveMode = null != widthAdaptiveMode ? widthAdaptiveMode : "only-body",
877
920
  this._heightAdaptiveMode = null != heightAdaptiveMode ? heightAdaptiveMode : "only-body",
878
921
  this.autoFillWidth = null != autoFillWidth && autoFillWidth, this.autoFillHeight = null != autoFillHeight && autoFillHeight,
879
- this.customRender = customRender, this.canvasWidth = (0, vutils_1.isNumber)(canvasWidth) ? canvasWidth : void 0,
922
+ void 0 !== containerFit && (this._containerFit = "boolean" == typeof containerFit ? {
923
+ width: containerFit,
924
+ height: containerFit
925
+ } : containerFit && "object" == typeof containerFit ? {
926
+ width: null === (_b = containerFit.width) || void 0 === _b || _b,
927
+ height: null === (_c = containerFit.height) || void 0 === _c || _c
928
+ } : {
929
+ width: !1,
930
+ height: !1
931
+ }), this.customRender = customRender, this.canvasWidth = (0, vutils_1.isNumber)(canvasWidth) ? canvasWidth : void 0,
880
932
  this.canvasHeight = (0, vutils_1.isNumber)(canvasHeight) ? canvasHeight : void 0;
881
933
  const internalProps = this.internalProps;
882
934
  if ("node" === env_1.Env.mode || options.canvas || (0, tableHelper_1.updateRootElementPadding)(internalProps.element, this.padding),
883
- this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal",
935
+ this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal",
884
936
  internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth,
885
937
  internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
886
938
  internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
887
939
  internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
888
940
  internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = enableCheckboxCascade,
889
- internalProps.columnResizeMode = null !== (_c = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _c ? _c : columnResizeMode,
890
- internalProps.rowResizeMode = null !== (_d = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _d ? _d : rowResizeMode,
891
- internalProps.dragHeaderMode = null !== (_f = null !== (_e = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _e ? _e : dragHeaderMode) && void 0 !== _f ? _f : "none",
941
+ internalProps.columnResizeMode = null !== (_e = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _e ? _e : columnResizeMode,
942
+ internalProps.rowResizeMode = null !== (_f = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _f ? _f : rowResizeMode,
943
+ internalProps.dragHeaderMode = null !== (_h = null !== (_g = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _g ? _g : dragHeaderMode) && void 0 !== _h ? _h : "none",
892
944
  internalProps.renderChartAsync = renderChartAsync, (0, chart_render_helper_1.setBatchRenderChartCount)(renderChartAsyncBatchCount),
893
945
  internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
894
946
  internalProps.cellTextOverflows = {}, internalProps._rowHeightsMap = new row_height_map_1.NumberRangeMap(this),
895
947
  internalProps._rowRangeHeightsMap = new Map, internalProps._colRangeWidthsMap = new Map,
896
948
  internalProps._widthResizedColMap = new Set, internalProps._heightResizedRowMap = new Set,
897
949
  this.colWidthsMap = new NumberMap_1.NumberMap, this.colContentWidthsMap = new NumberMap_1.NumberMap,
898
- this.colWidthsLimit = {}, internalProps.stick.changedCells.clear(), internalProps.theme = themes_1.default.of(null !== (_g = options.theme) && void 0 !== _g ? _g : themes_1.default.DEFAULT),
950
+ this.colWidthsLimit = {}, internalProps.stick.changedCells.clear(), internalProps.theme = themes_1.default.of(null !== (_j = options.theme) && void 0 !== _j ? _j : themes_1.default.DEFAULT),
899
951
  internalProps.theme.isPivot = this.isPivotTable(), (0, icons_1.setIconColor)(internalProps.theme.functionalIconsStyle),
900
952
  this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText,
901
- internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_h = options.allowFrozenColCount) && void 0 !== _h ? _h : 0,
902
- internalProps.limitMaxAutoWidth = null !== (_j = options.limitMaxAutoWidth) && void 0 !== _j ? _j : 450,
953
+ internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_k = options.allowFrozenColCount) && void 0 !== _k ? _k : 0,
954
+ internalProps.limitMaxAutoWidth = null !== (_l = options.limitMaxAutoWidth) && void 0 !== _l ? _l : 450,
903
955
  internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
904
956
  internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
905
- null === (_k = internalProps.legends) || void 0 === _k || _k.forEach((legend => {
957
+ null === (_m = internalProps.legends) || void 0 === _m || _m.forEach((legend => {
906
958
  null == legend || legend.release();
907
- })), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.title = null,
908
- null === (_m = internalProps.emptyTip) || void 0 === _m || _m.release(), internalProps.emptyTip = null,
959
+ })), null === (_o = internalProps.title) || void 0 === _o || _o.release(), internalProps.title = null,
960
+ null === (_p = internalProps.emptyTip) || void 0 === _p || _p.release(), internalProps.emptyTip = null,
909
961
  internalProps.layoutMap.release(), (0, chart_render_helper_1.clearChartRenderQueue)(),
910
962
  this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(),
911
963
  this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
@@ -934,15 +986,15 @@ class BaseTable extends EventTarget_1.EventTarget {
934
986
  }
935
987
  if (internalProps.menu = Object.assign({
936
988
  renderMode: "html"
937
- }, 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),
938
- (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),
989
+ }, 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),
990
+ (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),
939
991
  "html" === internalProps.menu.renderMode && !internalProps.menuHandler) {
940
992
  const MenuHandler = factory_1.Factory.getComponent("menuHandler");
941
993
  internalProps.menuHandler = new MenuHandler(this);
942
994
  }
943
995
  this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(),
944
996
  internalProps.customMergeCell = (0, get_custom_merge_cell_func_1.getCustomMergeCellFunc)(options.customMergeCell),
945
- 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 : []),
997
+ 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 : []),
946
998
  this._adjustCanvasSizeByOption();
947
999
  }
948
1000
  renderWithRecreateCells() {
@@ -978,7 +1030,8 @@ class BaseTable extends EventTarget_1.EventTarget {
978
1030
  return 0;
979
1031
  }
980
1032
  getDrawRange() {
981
- const width = Math.min(this.tableNoFrameWidth, this.getAllColsWidth()), height = Math.min(this.tableNoFrameHeight, this.getAllRowsHeight());
1033
+ var _a, _b;
1034
+ 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());
982
1035
  return new Rect_1.Rect(this.tableX, this.tableY, width, height);
983
1036
  }
984
1037
  _getMouseAbstractPoint(evt) {
@@ -1734,8 +1787,11 @@ class BaseTable extends EventTarget_1.EventTarget {
1734
1787
  this.render();
1735
1788
  const stage = this.scenegraph.stage;
1736
1789
  if (stage) {
1737
- const contentWidth = this.tableX + this.getAllColsWidth(), contentHeight = this.tableY + this.getAllRowsHeight();
1738
- if (contentWidth >= this.canvasWidth && contentHeight >= this.canvasHeight) {
1790
+ let contentWidth = this.tableX + this.getAllColsWidth(), contentHeight = this.tableY + this.getAllRowsHeight();
1791
+ if (this.internalProps.legends && this.internalProps.legends.forEach((legend => {
1792
+ "right" === legend.orient ? contentWidth = Math.max(contentWidth, legend.legendComponent.globalAABBBounds.x2) : "bottom" === legend.orient && (contentHeight = Math.max(contentHeight, legend.legendComponent.globalAABBBounds.y2));
1793
+ })), 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))),
1794
+ contentWidth >= this.canvasWidth && contentHeight >= this.canvasHeight) {
1739
1795
  stage.render();
1740
1796
  return stage.window.getImageBuffer(type);
1741
1797
  }
@@ -1883,6 +1939,22 @@ class BaseTable extends EventTarget_1.EventTarget {
1883
1939
  checkHasColumnAutoWidth() {
1884
1940
  return (0, tableHelper_1.checkHasColumnAutoWidth)(this);
1885
1941
  }
1942
+ get containerFit() {
1943
+ return this._containerFit;
1944
+ }
1945
+ set containerFit(containerFit) {
1946
+ var _a, _b;
1947
+ this._containerFit = "boolean" == typeof containerFit ? {
1948
+ width: containerFit,
1949
+ height: containerFit
1950
+ } : containerFit && "object" == typeof containerFit ? {
1951
+ width: null === (_a = containerFit.width) || void 0 === _a || _a,
1952
+ height: null === (_b = containerFit.height) || void 0 === _b || _b
1953
+ } : {
1954
+ width: !1,
1955
+ height: !1
1956
+ };
1957
+ }
1886
1958
  }
1887
1959
 
1888
1960
  exports.BaseTable = BaseTable;