@visactor/vtable 0.22.2-alpha.2 → 0.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/cjs/ListTable.js +5 -3
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/core/BaseTable.js +7 -3
  4. package/cjs/core/BaseTable.js.map +1 -1
  5. package/cjs/edit/edit-manager.js +10 -9
  6. package/cjs/edit/edit-manager.js.map +1 -1
  7. package/cjs/event/event.js +6 -0
  8. package/cjs/event/event.js.map +1 -1
  9. package/cjs/event/listener/table-group.js +1 -1
  10. package/cjs/event/listener/table-group.js.map +1 -1
  11. package/cjs/index.d.ts +1 -1
  12. package/cjs/index.js +1 -1
  13. package/cjs/index.js.map +1 -1
  14. package/cjs/scenegraph/component/table-component.js +1 -1
  15. package/cjs/scenegraph/component/table-component.js.map +1 -1
  16. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.d.ts +3 -2
  17. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +15 -2
  18. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  19. package/cjs/scenegraph/layout/compute-row-height.js +4 -2
  20. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  21. package/cjs/scenegraph/utils/cell-border-stroke-width.js +15 -10
  22. package/cjs/scenegraph/utils/cell-border-stroke-width.js.map +1 -1
  23. package/cjs/scenegraph/utils/text-icon-layout.js +3 -3
  24. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  25. package/cjs/state/state.js +1 -1
  26. package/cjs/themes/component.js +1 -1
  27. package/cjs/themes/theme.js +7 -3
  28. package/cjs/themes/theme.js.map +1 -1
  29. package/cjs/ts-types/list-table/define/progressbar-define.d.ts +2 -2
  30. package/cjs/ts-types/list-table/define/progressbar-define.js.map +1 -1
  31. package/cjs/ts-types/theme.js.map +1 -1
  32. package/cjs/vrender.js.map +1 -1
  33. package/dist/vtable.js +101 -47
  34. package/dist/vtable.min.js +2 -2
  35. package/es/ListTable.js +5 -3
  36. package/es/ListTable.js.map +1 -1
  37. package/es/core/BaseTable.js +7 -3
  38. package/es/core/BaseTable.js.map +1 -1
  39. package/es/edit/edit-manager.js +10 -9
  40. package/es/edit/edit-manager.js.map +1 -1
  41. package/es/event/event.js +6 -0
  42. package/es/event/event.js.map +1 -1
  43. package/es/event/listener/table-group.js +1 -1
  44. package/es/event/listener/table-group.js.map +1 -1
  45. package/es/index.d.ts +1 -1
  46. package/es/index.js +1 -1
  47. package/es/index.js.map +1 -1
  48. package/es/scenegraph/component/table-component.js +1 -1
  49. package/es/scenegraph/component/table-component.js.map +1 -1
  50. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.d.ts +3 -2
  51. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +15 -2
  52. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  53. package/es/scenegraph/layout/compute-row-height.js +4 -2
  54. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  55. package/es/scenegraph/utils/cell-border-stroke-width.js +10 -7
  56. package/es/scenegraph/utils/cell-border-stroke-width.js.map +1 -1
  57. package/es/scenegraph/utils/text-icon-layout.js +3 -3
  58. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  59. package/es/state/state.js +1 -1
  60. package/es/themes/component.js +1 -1
  61. package/es/themes/theme.js +4 -2
  62. package/es/themes/theme.js.map +1 -1
  63. package/es/ts-types/list-table/define/progressbar-define.d.ts +2 -2
  64. package/es/ts-types/list-table/define/progressbar-define.js.map +1 -1
  65. package/es/ts-types/theme.js.map +1 -1
  66. package/es/vrender.js.map +1 -1
  67. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -24122,9 +24122,9 @@
24122
24122
  };
24123
24123
 
24124
24124
  function getProp$1(obj, superObj, names, defNames) {
24125
- return (getChainSafe(obj, ...names) ||
24126
- getChainSafe(superObj, ...names) ||
24127
- (defNames && getChainSafe(obj, ...defNames)) ||
24125
+ return (getChainSafe(obj, ...names) ??
24126
+ getChainSafe(superObj, ...names) ??
24127
+ (defNames && getChainSafe(obj, ...defNames)) ??
24128
24128
  (defNames && getChainSafe(superObj, ...defNames)));
24129
24129
  }
24130
24130
  class TableTheme {
@@ -24166,7 +24166,7 @@
24166
24166
  }
24167
24167
  get cellInnerBorder() {
24168
24168
  const { obj, superTheme } = this.internalTheme;
24169
- return !!getProp$1(obj, superTheme, ['cellInnerBorder']);
24169
+ return getProp$1(obj, superTheme, ['cellInnerBorder']) ?? true;
24170
24170
  }
24171
24171
  get cellBorderClipDirection() {
24172
24172
  const { obj, superTheme } = this.internalTheme;
@@ -36162,11 +36162,12 @@
36162
36162
  }
36163
36163
 
36164
36164
  function getCellBorderStrokeWidth(col, row, cellTheme, table) {
36165
+ const frameBorderLineWidths = style.toBoxArray(table.internalProps.theme.frameStyle?.borderLineWidth ?? [null]);
36165
36166
  let strokeArrayWidth = cellTheme?.group?.strokeArrayWidth ?? undefined;
36166
- if (!table.theme.cellInnerBorder) {
36167
+ if (table.theme.cellInnerBorder) {
36167
36168
  return strokeArrayWidth;
36168
36169
  }
36169
- if (col === 0) {
36170
+ if (col === 0 && frameBorderLineWidths[3]) {
36170
36171
  strokeArrayWidth = strokeArrayWidth ?? [
36171
36172
  cellTheme?.group?.lineWidth,
36172
36173
  cellTheme?.group?.lineWidth,
@@ -36175,7 +36176,7 @@
36175
36176
  ];
36176
36177
  strokeArrayWidth[3] = 0;
36177
36178
  }
36178
- if (col === table.colCount - 1) {
36179
+ if (col === table.colCount - 1 && frameBorderLineWidths[1]) {
36179
36180
  strokeArrayWidth = strokeArrayWidth ?? [
36180
36181
  cellTheme?.group?.lineWidth,
36181
36182
  cellTheme?.group?.lineWidth,
@@ -36184,7 +36185,7 @@
36184
36185
  ];
36185
36186
  strokeArrayWidth[1] = 0;
36186
36187
  }
36187
- if (row === 0) {
36188
+ if (row === 0 && frameBorderLineWidths[0]) {
36188
36189
  strokeArrayWidth = strokeArrayWidth ?? [
36189
36190
  cellTheme?.group?.lineWidth,
36190
36191
  cellTheme?.group?.lineWidth,
@@ -36193,7 +36194,7 @@
36193
36194
  ];
36194
36195
  strokeArrayWidth[0] = 0;
36195
36196
  }
36196
- if (row === table.rowCount - 1) {
36197
+ if (row === table.rowCount - 1 && frameBorderLineWidths[2]) {
36197
36198
  strokeArrayWidth = strokeArrayWidth ?? [
36198
36199
  cellTheme?.group?.lineWidth,
36199
36200
  cellTheme?.group?.lineWidth,
@@ -36470,8 +36471,24 @@
36470
36471
  dataValue = table.getCellOriginRecord(col, row)?.[progressBarDefine.dependField] ?? dataValue;
36471
36472
  }
36472
36473
  progressBarDefine.barType = progressBarDefine.barType ?? 'default';
36473
- progressBarDefine.min = progressBarDefine.min ?? 0;
36474
- progressBarDefine.max = progressBarDefine.max ?? progressBarDefine.min + 100;
36474
+ progressBarDefine.min =
36475
+ getOrApply(progressBarDefine.min, {
36476
+ col,
36477
+ row,
36478
+ table,
36479
+ value,
36480
+ dataValue,
36481
+ cellHeaderPaths: undefined
36482
+ }) ?? 0;
36483
+ progressBarDefine.max =
36484
+ getOrApply(progressBarDefine.max, {
36485
+ col,
36486
+ row,
36487
+ table,
36488
+ value,
36489
+ dataValue,
36490
+ cellHeaderPaths: undefined
36491
+ }) ?? progressBarDefine.min + 100;
36475
36492
  const height = table.getRowHeight(row);
36476
36493
  let contentWidth = width;
36477
36494
  let contentHeight = height;
@@ -37690,9 +37707,9 @@
37690
37707
  textConfig[0].textAlign = textAlign;
37691
37708
  const text = new RichText({
37692
37709
  width: autoColWidth ? 0 : cellWidth - (padding[1] + padding[3]) - leftIconWidth - rightIconWidth,
37693
- height: autoRowHeight ? 0 : cellHeight - (padding[0] + padding[2]),
37710
+ height: autoRowHeight && autoWrapText ? 0 : Math.ceil(cellHeight - (padding[0] + padding[2])),
37694
37711
  textConfig,
37695
- verticalDirection: autoRowHeight ? 'top' : textBaseline,
37712
+ verticalDirection: autoRowHeight && autoWrapText ? 'top' : textBaseline,
37696
37713
  ellipsis: textOption.ellipsis
37697
37714
  });
37698
37715
  text.name = 'text';
@@ -37898,7 +37915,7 @@
37898
37915
  cellContent.updateWidth(distWidth - leftIconWidth - rightIconHeight - (padding[1] + padding[3]));
37899
37916
  contentHeight = cellContent.AABBBounds.height();
37900
37917
  }
37901
- const oldCellHeight = Math.max(leftIconHeight, rightIconHeight, oldTextHeight) + padding[0] + padding[2];
37918
+ const oldCellHeight = Math.round(Math.max(leftIconHeight, rightIconHeight, oldTextHeight) + padding[0] + padding[2]);
37902
37919
  cellGroup.forEachChildren((child) => {
37903
37920
  if (child.role === 'icon-left') ;
37904
37921
  else if (child.role === 'icon-right') {
@@ -40225,26 +40242,42 @@
40225
40242
  }
40226
40243
  }
40227
40244
  else if (iconInlineFront.length || iconInlineEnd.length) {
40228
- const textOption = Object.assign({
40229
- text: cellValue?.toString(),
40230
- fontFamily,
40231
- fontSize,
40232
- fontStyle,
40233
- fontWeight,
40234
- lineHeight
40235
- });
40236
- textOption.textBaseline = 'middle';
40237
- const textConfig = [
40238
- ...iconInlineFront.map(icon => dealWithRichTextIcon(icon)),
40239
- textOption,
40240
- ...iconInlineEnd.map(icon => dealWithRichTextIcon(icon))
40241
- ];
40242
- utilRichTextMark.setAttributes({
40243
- width: cellWidth - (padding[1] + padding[3]) - iconWidth,
40244
- height: 0,
40245
- textConfig
40246
- });
40247
- maxHeight = utilRichTextMark.AABBBounds.height();
40245
+ if (autoWrapText) {
40246
+ const textOption = Object.assign({
40247
+ text: cellValue?.toString(),
40248
+ fontFamily,
40249
+ fontSize,
40250
+ fontStyle,
40251
+ fontWeight,
40252
+ lineHeight
40253
+ });
40254
+ textOption.textBaseline = 'middle';
40255
+ const textConfig = [
40256
+ ...iconInlineFront.map(icon => dealWithRichTextIcon(icon)),
40257
+ textOption,
40258
+ ...iconInlineEnd.map(icon => dealWithRichTextIcon(icon))
40259
+ ];
40260
+ utilRichTextMark.setAttributes({
40261
+ width: cellWidth - (padding[1] + padding[3]) - iconWidth,
40262
+ height: 0,
40263
+ textConfig
40264
+ });
40265
+ maxHeight = utilRichTextMark.AABBBounds.height();
40266
+ }
40267
+ else {
40268
+ maxHeight = 0;
40269
+ lines.forEach((line, index) => {
40270
+ if (index === 0 && iconInlineFront.length) {
40271
+ maxHeight += Math.max(lineHeight, iconInlineFrontHeight);
40272
+ }
40273
+ else if (index === lines.length - 1 && iconInlineEnd.length) {
40274
+ maxHeight += Math.max(lineHeight, iconInlineEndHeight);
40275
+ }
40276
+ else {
40277
+ maxHeight += lineHeight;
40278
+ }
40279
+ });
40280
+ }
40248
40281
  }
40249
40282
  else if (autoWrapText) {
40250
40283
  const maxLineWidth = cellWidth - (padding[1] + padding[3]) - iconWidth;
@@ -41626,7 +41659,7 @@
41626
41659
  this.frozenShadowLine.setAttributes({
41627
41660
  visible: true,
41628
41661
  x: colX,
41629
- height: this.table.getRowsHeight(0, this.table.rowCount - 1)
41662
+ height: this.table.tableNoFrameHeight
41630
41663
  });
41631
41664
  }
41632
41665
  }
@@ -51090,7 +51123,7 @@
51090
51123
  target: { col: eventArgsSet.eventArgs.col, row: eventArgsSet.eventArgs.row },
51091
51124
  source: {
51092
51125
  col: table.stateManager.columnMove.colSource,
51093
- row: table.stateManager.columnMove.colSource
51126
+ row: table.stateManager.columnMove.rowSource
51094
51127
  }
51095
51128
  });
51096
51129
  }
@@ -52189,6 +52222,14 @@
52189
52222
  !state.table.transpose) {
52190
52223
  state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen);
52191
52224
  }
52225
+ const colWidths = [];
52226
+ for (let col = 0; col < this.table.colCount; col++) {
52227
+ colWidths.push(this.table.getColWidth(col));
52228
+ }
52229
+ this.table.fireListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN_END, {
52230
+ col: resizeCol.col,
52231
+ colWidths
52232
+ });
52192
52233
  }
52193
52234
  }
52194
52235
  });
@@ -55565,7 +55606,7 @@
55565
55606
  return TABLE_EVENT_TYPE;
55566
55607
  }
55567
55608
  options;
55568
- version = "0.22.2-alpha.2";
55609
+ version = "0.22.2";
55569
55610
  pagination;
55570
55611
  id = `VTable${Date.now()}`;
55571
55612
  headerStyleCache;
@@ -56778,14 +56819,20 @@
56778
56819
  }
56779
56820
  getBottomFrozenRowsHeight() {
56780
56821
  if (this.bottomFrozenRowCount > 0) {
56781
- const height = this.getRowsHeight(this.rowCount - this.bottomFrozenRowCount, this.rowCount - 1);
56822
+ let height = 0;
56823
+ for (let row = this.rowCount - this.bottomFrozenRowCount; row <= this.rowCount - 1; row++) {
56824
+ height += this.getRowHeight(row);
56825
+ }
56782
56826
  return height;
56783
56827
  }
56784
56828
  return 0;
56785
56829
  }
56786
56830
  getRightFrozenColsWidth() {
56787
56831
  if (this.rightFrozenColCount > 0) {
56788
- const width = this.getColsWidth(this.colCount - this.rightFrozenColCount, this.colCount - 1);
56832
+ let width = 0;
56833
+ for (let col = this.colCount - this.rightFrozenColCount; col <= this.colCount - 1; col++) {
56834
+ width += this.getColWidth(col);
56835
+ }
56789
56836
  return width;
56790
56837
  }
56791
56838
  return 0;
@@ -60366,8 +60413,10 @@
60366
60413
  if (this.table.internalProps.layoutMap?.isAggregation?.(col, row)) {
60367
60414
  return;
60368
60415
  }
60416
+ if (!this.editingEditor) {
60417
+ this.editCell = { col, row };
60418
+ }
60369
60419
  this.editingEditor = editor;
60370
- this.editCell = { col, row };
60371
60420
  const dataValue = this.table.getCellOriginValue(col, row);
60372
60421
  const rect = this.table.getCellRangeRelativeRect(this.table.getCellRange(col, row));
60373
60422
  const referencePosition = { rect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height } };
@@ -60406,12 +60455,14 @@
60406
60455
  }
60407
60456
  }
60408
60457
  if (!this.editingEditor.getValue) ;
60409
- const changedValue = this.editingEditor.getValue?.();
60410
- this.table.changeCellValue(this.editCell.col, this.editCell.row, changedValue);
60411
- this.editingEditor.exit && (void 0);
60412
- this.editingEditor.exit?.();
60413
- this.editingEditor.onEnd?.();
60414
- this.editingEditor = null;
60458
+ if (!this.editingEditor.validateValue || this.editingEditor.validateValue?.()) {
60459
+ const changedValue = this.editingEditor.getValue?.();
60460
+ this.table.changeCellValue(this.editCell.col, this.editCell.row, changedValue);
60461
+ this.editingEditor.exit && (void 0);
60462
+ this.editingEditor.exit?.();
60463
+ this.editingEditor.onEnd?.();
60464
+ this.editingEditor = null;
60465
+ }
60415
60466
  }
60416
60467
  cancelEdit() {
60417
60468
  if (this.editingEditor) {
@@ -61092,6 +61143,9 @@
61092
61143
  return undefined;
61093
61144
  }
61094
61145
  setRecords(records, option) {
61146
+ this.internalProps.dataSource?.release();
61147
+ this.internalProps.releaseList = this.internalProps.releaseList?.filter((item) => !item.dataSourceObj);
61148
+ this.internalProps.dataSource = null;
61095
61149
  let sort;
61096
61150
  if (Array.isArray(option) || option?.order) {
61097
61151
  sort = option;
@@ -67662,7 +67716,7 @@
67662
67716
  }
67663
67717
 
67664
67718
  registerForVrender();
67665
- const version = "0.22.2-alpha.2";
67719
+ const version = "0.22.2";
67666
67720
  function getIcons() {
67667
67721
  return get$2();
67668
67722
  }