@visactor/vtable 0.19.2-alpha.2 → 0.19.2-alpha.3

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 (59) hide show
  1. package/cjs/ListTable.js +1 -1
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/body-helper/body-helper.js +1 -0
  4. package/cjs/body-helper/body-helper.js.map +1 -1
  5. package/cjs/core/BaseTable.js +16 -11
  6. package/cjs/core/BaseTable.js.map +1 -1
  7. package/cjs/event/listener/table-group.js +14 -4
  8. package/cjs/event/listener/table-group.js.map +1 -1
  9. package/cjs/event/sparkline-event.js +1 -1
  10. package/cjs/event/sparkline-event.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/scenegraph.js +20 -5
  15. package/cjs/scenegraph/scenegraph.js.map +1 -1
  16. package/cjs/scenegraph/style/frame-border.js +7 -4
  17. package/cjs/scenegraph/style/frame-border.js.map +1 -1
  18. package/cjs/state/hover/is-cell-hover.js +1 -1
  19. package/cjs/state/hover/is-cell-hover.js.map +1 -1
  20. package/cjs/state/state.js +2 -2
  21. package/cjs/state/state.js.map +1 -1
  22. package/cjs/themes/theme.js +3 -0
  23. package/cjs/themes/theme.js.map +1 -1
  24. package/cjs/ts-types/list-table/layout-map/api.d.ts +1 -1
  25. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  26. package/cjs/ts-types/theme.d.ts +1 -0
  27. package/cjs/ts-types/theme.js.map +1 -1
  28. package/cjs/vrender.js.map +1 -1
  29. package/dist/vtable.js +133 -48
  30. package/dist/vtable.min.js +2 -2
  31. package/es/ListTable.js +1 -1
  32. package/es/ListTable.js.map +1 -1
  33. package/es/body-helper/body-helper.js +1 -0
  34. package/es/body-helper/body-helper.js.map +1 -1
  35. package/es/core/BaseTable.js +16 -11
  36. package/es/core/BaseTable.js.map +1 -1
  37. package/es/event/listener/table-group.js +14 -4
  38. package/es/event/listener/table-group.js.map +1 -1
  39. package/es/event/sparkline-event.js +1 -1
  40. package/es/event/sparkline-event.js.map +1 -1
  41. package/es/index.d.ts +1 -1
  42. package/es/index.js +1 -1
  43. package/es/index.js.map +1 -1
  44. package/es/scenegraph/scenegraph.js +20 -5
  45. package/es/scenegraph/scenegraph.js.map +1 -1
  46. package/es/scenegraph/style/frame-border.js +7 -4
  47. package/es/scenegraph/style/frame-border.js.map +1 -1
  48. package/es/state/hover/is-cell-hover.js +1 -1
  49. package/es/state/hover/is-cell-hover.js.map +1 -1
  50. package/es/state/state.js +2 -2
  51. package/es/state/state.js.map +1 -1
  52. package/es/themes/theme.js +3 -0
  53. package/es/themes/theme.js.map +1 -1
  54. package/es/ts-types/list-table/layout-map/api.d.ts +1 -1
  55. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  56. package/es/ts-types/theme.d.ts +1 -0
  57. package/es/ts-types/theme.js.map +1 -1
  58. package/es/vrender.js.map +1 -1
  59. package/package.json +2 -2
package/dist/vtable.js CHANGED
@@ -23984,6 +23984,9 @@
23984
23984
  get borderLineDash() {
23985
23985
  return frameStyle.borderLineDash;
23986
23986
  },
23987
+ get innerBorder() {
23988
+ return frameStyle.innerBorder;
23989
+ },
23987
23990
  get shadowBlur() {
23988
23991
  return frameStyle.shadowBlur;
23989
23992
  },
@@ -38923,10 +38926,18 @@
38923
38926
  rectAttributes.y = borderTop / 2;
38924
38927
  rectAttributes.pickable = false;
38925
38928
  if (isTableGroup) {
38926
- rectAttributes.x = group.attribute.x - borderLeft / 2;
38927
- rectAttributes.y = group.attribute.y - borderTop / 2;
38928
- rectAttributes.width = group.attribute.width + borderLeft / 2 + borderRight / 2;
38929
- rectAttributes.height = group.attribute.height + borderTop / 2 + borderBottom / 2;
38929
+ if (frameTheme.innerBorder) {
38930
+ rectAttributes.x = group.attribute.x + borderLeft / 2;
38931
+ rectAttributes.y = group.attribute.y + borderTop / 2;
38932
+ rectAttributes.width = group.attribute.width - borderLeft / 2 - borderRight / 2;
38933
+ rectAttributes.height = group.attribute.height - borderTop / 2 - borderBottom / 2;
38934
+ }
38935
+ else {
38936
+ rectAttributes.x = group.attribute.x - borderLeft / 2;
38937
+ rectAttributes.y = group.attribute.y - borderTop / 2;
38938
+ rectAttributes.width = group.attribute.width + borderLeft / 2 + borderRight / 2;
38939
+ rectAttributes.height = group.attribute.height + borderTop / 2 + borderBottom / 2;
38940
+ }
38930
38941
  let shadowRect;
38931
38942
  let borderRect;
38932
38943
  if (hasShadow) {
@@ -38956,7 +38967,12 @@
38956
38967
  borderRect = createRect(rectAttributes);
38957
38968
  borderRect.name = 'table-border-rect';
38958
38969
  }
38959
- group.parent.insertBefore(borderRect, group);
38970
+ if (frameTheme.innerBorder && !hasShadow) {
38971
+ group.parent.insertAfter(borderRect, group);
38972
+ }
38973
+ else {
38974
+ group.parent.insertBefore(borderRect, group);
38975
+ }
38960
38976
  group.border = borderRect;
38961
38977
  }
38962
38978
  else {
@@ -39426,10 +39442,20 @@
39426
39442
  hoverMode = 'cellBgColor';
39427
39443
  }
39428
39444
  else if (highlightScope === HighlightScope.column && cellPos.col === col) {
39429
- hoverMode = 'inlineColumnBgColor';
39445
+ if (cellPos.col === col && cellPos.row === row) {
39446
+ hoverMode = 'cellBgColor';
39447
+ }
39448
+ else {
39449
+ hoverMode = 'inlineColumnBgColor';
39450
+ }
39430
39451
  }
39431
39452
  else if (highlightScope === HighlightScope.row && cellPos.row === row) {
39432
- hoverMode = 'inlineRowBgColor';
39453
+ if (cellPos.col === col && cellPos.row === row) {
39454
+ hoverMode = 'cellBgColor';
39455
+ }
39456
+ else {
39457
+ hoverMode = 'inlineRowBgColor';
39458
+ }
39433
39459
  }
39434
39460
  else if (highlightScope === HighlightScope.cross) {
39435
39461
  if (cellPos.col === col && cellPos.row === row) {
@@ -44661,26 +44687,52 @@
44661
44687
  Math.max(this.leftBottomCornerGroup.attribute.height, this.bottomFrozenGroup.attribute.height, this.rightBottomCornerGroup.attribute.height, 0))
44662
44688
  });
44663
44689
  if (this.tableGroup.border && this.tableGroup.border.type === 'rect') {
44664
- this.tableGroup.border.setAttributes({
44665
- x: this.table.tableX - this.tableGroup.border.attribute.lineWidth / 2,
44666
- y: this.table.tableY - this.tableGroup.border.attribute.lineWidth / 2,
44667
- width: this.tableGroup.attribute.width + this.tableGroup.border.attribute.lineWidth,
44668
- height: this.tableGroup.attribute.height + this.tableGroup.border.attribute.lineWidth
44669
- });
44690
+ if (this.table.theme.frameStyle?.innerBorder) {
44691
+ this.tableGroup.border.setAttributes({
44692
+ x: this.table.tableX + this.tableGroup.border.attribute.lineWidth / 2,
44693
+ y: this.table.tableY + this.tableGroup.border.attribute.lineWidth / 2,
44694
+ width: this.tableGroup.attribute.width - this.tableGroup.border.attribute.lineWidth,
44695
+ height: this.tableGroup.attribute.height - this.tableGroup.border.attribute.lineWidth
44696
+ });
44697
+ }
44698
+ else {
44699
+ this.tableGroup.border.setAttributes({
44700
+ x: this.table.tableX - this.tableGroup.border.attribute.lineWidth / 2,
44701
+ y: this.table.tableY - this.tableGroup.border.attribute.lineWidth / 2,
44702
+ width: this.tableGroup.attribute.width + this.tableGroup.border.attribute.lineWidth,
44703
+ height: this.tableGroup.attribute.height + this.tableGroup.border.attribute.lineWidth
44704
+ });
44705
+ }
44670
44706
  }
44671
44707
  else if (this.tableGroup.border && this.tableGroup.border.type === 'group') {
44672
- this.tableGroup.border.setAttributes({
44673
- x: this.table.tableX - this.tableGroup.border.attribute.lineWidth / 2,
44674
- y: this.table.tableY - this.tableGroup.border.attribute.lineWidth / 2,
44675
- width: this.tableGroup.attribute.width + this.tableGroup.border.attribute.lineWidth,
44676
- height: this.tableGroup.attribute.height + this.tableGroup.border.attribute.lineWidth
44677
- });
44678
- this.tableGroup.border.firstChild?.setAttributes({
44679
- x: this.tableGroup.border.attribute.lineWidth / 2,
44680
- y: this.tableGroup.border.attribute.lineWidth / 2,
44681
- width: this.tableGroup.attribute.width,
44682
- height: this.tableGroup.attribute.height
44683
- });
44708
+ if (this.table.theme.frameStyle?.innerBorder) {
44709
+ this.tableGroup.border.setAttributes({
44710
+ x: this.table.tableX + this.tableGroup.border.attribute.lineWidth / 2,
44711
+ y: this.table.tableY + this.tableGroup.border.attribute.lineWidth / 2,
44712
+ width: this.tableGroup.attribute.width - this.tableGroup.border.attribute.lineWidth,
44713
+ height: this.tableGroup.attribute.height - this.tableGroup.border.attribute.lineWidth
44714
+ });
44715
+ this.tableGroup.border.firstChild?.setAttributes({
44716
+ x: 0,
44717
+ y: 0,
44718
+ width: this.tableGroup.attribute.width - this.tableGroup.border.attribute.lineWidth,
44719
+ height: this.tableGroup.attribute.height - this.tableGroup.border.attribute.lineWidth
44720
+ });
44721
+ }
44722
+ else {
44723
+ this.tableGroup.border.setAttributes({
44724
+ x: this.table.tableX - this.tableGroup.border.attribute.lineWidth / 2,
44725
+ y: this.table.tableY - this.tableGroup.border.attribute.lineWidth / 2,
44726
+ width: this.tableGroup.attribute.width + this.tableGroup.border.attribute.lineWidth,
44727
+ height: this.tableGroup.attribute.height + this.tableGroup.border.attribute.lineWidth
44728
+ });
44729
+ this.tableGroup.border.firstChild?.setAttributes({
44730
+ x: this.tableGroup.border.attribute.lineWidth / 2,
44731
+ y: this.tableGroup.border.attribute.lineWidth / 2,
44732
+ width: this.tableGroup.attribute.width,
44733
+ height: this.tableGroup.attribute.height
44734
+ });
44735
+ }
44684
44736
  }
44685
44737
  if (this.table.bottomFrozenRowCount > 0) {
44686
44738
  this.bottomFrozenGroup.setAttribute('y', this.tableGroup.attribute.height - this.bottomFrozenGroup.attribute.height);
@@ -46764,7 +46816,15 @@
46764
46816
  this.menu.dropDownMenuHighlight = cells;
46765
46817
  for (let i = 0; i < cells.length; i++) {
46766
46818
  const { col, row } = cells[i];
46767
- this.table.scenegraph.updateCellContent(col, row);
46819
+ const range = this.table.getCellRange(col, row);
46820
+ if (!range) {
46821
+ continue;
46822
+ }
46823
+ for (let col = range.start.col; col <= range.end.col; col++) {
46824
+ for (let row = range.start.row; row <= range.end.row; row++) {
46825
+ this.table.scenegraph.updateCellContent(col, row);
46826
+ }
46827
+ }
46768
46828
  }
46769
46829
  }
46770
46830
  dropDownMenuIsHighlight(colNow, rowNow, index) {
@@ -47195,7 +47255,7 @@
47195
47255
  else {
47196
47256
  const layoutMap = table.internalProps.layoutMap;
47197
47257
  hasSparkLine = layoutMap.columnObjects.some(column => {
47198
- return column.cellType === 'sparkline';
47258
+ return column.cellType === 'sparkline' || typeof column.cellType === 'function';
47199
47259
  });
47200
47260
  }
47201
47261
  if (!hasSparkLine) {
@@ -47311,10 +47371,10 @@
47311
47371
  }
47312
47372
  const cellGoup = e.path.find(node => node.role === 'cell');
47313
47373
  if (table.hasListeners(TABLE_EVENT_TYPE.MOUSELEAVE_CELL)) {
47314
- if (cellGoup?.role === 'cell' &&
47315
- table.stateManager.hover.cellPos.col !== -1 &&
47374
+ if (table.stateManager.hover.cellPos.col !== -1 &&
47316
47375
  table.stateManager.hover.cellPos.row !== -1 &&
47317
- (cellGoup.col !== table.stateManager.hover.cellPos.col || cellGoup.row !== table.stateManager.hover.cellPos.row)) {
47376
+ (cellGoup?.col !== table.stateManager.hover.cellPos.col ||
47377
+ cellGoup?.row !== table.stateManager.hover.cellPos.row)) {
47318
47378
  table.fireListeners(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, {
47319
47379
  col: table.stateManager.hover.cellPos.col,
47320
47380
  row: table.stateManager.hover.cellPos.row,
@@ -47416,6 +47476,21 @@
47416
47476
  stateManager.updateInteractionState(InteractionState.default);
47417
47477
  stateManager.updateCursor();
47418
47478
  }
47479
+ if (table.hasListeners(TABLE_EVENT_TYPE.MOUSELEAVE_CELL)) {
47480
+ if (table.stateManager.hover.cellPos.col !== -1 && table.stateManager.hover.cellPos.row !== -1) {
47481
+ table.fireListeners(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, {
47482
+ col: table.stateManager.hover.cellPos.col,
47483
+ row: table.stateManager.hover.cellPos.row,
47484
+ cellRange: table.getCellRangeRelativeRect({
47485
+ col: table.stateManager.hover.cellPos.col,
47486
+ row: table.stateManager.hover.cellPos.row
47487
+ }),
47488
+ scaleRatio: table.canvas.getBoundingClientRect().width / table.canvas.offsetWidth,
47489
+ event: e.nativeEvent,
47490
+ target: undefined
47491
+ });
47492
+ }
47493
+ }
47419
47494
  eventManager.dealTableHover();
47420
47495
  const target = e.target;
47421
47496
  if (target && !target.isDescendantsOf(table.scenegraph.tableGroup)) {
@@ -47745,15 +47820,15 @@
47745
47820
  };
47746
47821
  if (table.isHeader(col, row)) {
47747
47822
  table.stateManager.setHeaderCheckedState(cellInfo.field, e.detail.checked);
47748
- const define = table.getBodyColumnDefine(col, row);
47749
- if (define.cellType === 'checkbox') {
47823
+ const cellType = table.getCellType(col, row);
47824
+ if (cellType === 'checkbox') {
47750
47825
  table.scenegraph.updateCheckboxCellState(col, row, e.detail.checked);
47751
47826
  }
47752
47827
  }
47753
47828
  else {
47754
47829
  table.stateManager.setCheckedState(col, row, cellInfo.field, e.detail.checked);
47755
- const define = table.getBodyColumnDefine(col, row);
47756
- if (define.headerType === 'checkbox') {
47830
+ const cellType = table.getCellType(col, row);
47831
+ if (cellType === 'checkbox') {
47757
47832
  const oldHeaderCheckedState = table.stateManager.headerCheckedState[cellInfo.field];
47758
47833
  const newHeaderCheckedState = table.stateManager.updateHeaderCheckedState(cellInfo.field);
47759
47834
  if (oldHeaderCheckedState !== newHeaderCheckedState) {
@@ -48930,6 +49005,7 @@
48930
49005
  case 'checkbox':
48931
49006
  return CheckboxStyle$1;
48932
49007
  }
49008
+ return TextStyle;
48933
49009
  }
48934
49010
  getCellIconFromRecordValue(icon, col, row) {
48935
49011
  if (Array.isArray(icon)) {
@@ -51738,7 +51814,7 @@
51738
51814
  return TABLE_EVENT_TYPE;
51739
51815
  }
51740
51816
  options;
51741
- version = "0.19.2-alpha.2";
51817
+ version = "0.19.2-alpha.3";
51742
51818
  pagination;
51743
51819
  id = `VTable${Date.now()}`;
51744
51820
  headerStyleCache;
@@ -52151,12 +52227,20 @@
52151
52227
  if (this.internalProps.theme?.frameStyle) {
52152
52228
  const lineWidths = toBoxArray(this.internalProps.theme.frameStyle?.borderLineWidth ?? [null]);
52153
52229
  const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]);
52154
- this.tableX = (lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0);
52155
- this.tableY = (lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0);
52156
- this.tableNoFrameWidth =
52157
- width - ((lineWidths[1] ?? 0) + (shadowWidths[1] ?? 0)) - ((lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0));
52158
- this.tableNoFrameHeight =
52159
- height - ((lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0)) - ((lineWidths[2] ?? 0) + (shadowWidths[2] ?? 0));
52230
+ if (this.theme.frameStyle?.innerBorder) {
52231
+ this.tableX = 0;
52232
+ this.tableY = 0;
52233
+ this.tableNoFrameWidth = width - (shadowWidths[1] ?? 0);
52234
+ this.tableNoFrameHeight = height - (shadowWidths[2] ?? 0);
52235
+ }
52236
+ else {
52237
+ this.tableX = (lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0);
52238
+ this.tableY = (lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0);
52239
+ this.tableNoFrameWidth =
52240
+ width - ((lineWidths[1] ?? 0) + (shadowWidths[1] ?? 0)) - ((lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0));
52241
+ this.tableNoFrameHeight =
52242
+ height - ((lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0)) - ((lineWidths[2] ?? 0) + (shadowWidths[2] ?? 0));
52243
+ }
52160
52244
  }
52161
52245
  }
52162
52246
  get rowHierarchyType() {
@@ -53285,7 +53369,7 @@
53285
53369
  return customMerge.range;
53286
53370
  }
53287
53371
  }
53288
- return this.internalProps.layoutMap.getCellRange(col, row);
53372
+ return this.internalProps.layoutMap?.getCellRange(col, row);
53289
53373
  }
53290
53374
  hasCustomMerge() {
53291
53375
  return !!this.internalProps.customMergeCell;
@@ -53378,7 +53462,7 @@
53378
53462
  field: this.getHeaderField(col, row),
53379
53463
  cellHeaderPaths: this.internalProps.layoutMap.getCellHeaderPaths(col, row),
53380
53464
  title: colDef?.title,
53381
- cellType: colDef?.cellType ? (typeof colDef.cellType === 'string' ? colDef.cellType : 'progressbar') : 'text',
53465
+ cellType: this.getCellType(col, row),
53382
53466
  originData: this.getCellOriginRecord(col, row),
53383
53467
  cellRange: this.getCellRangeRelativeRect({ col, row }),
53384
53468
  value: this.getCellValue(col, row),
@@ -53495,12 +53579,13 @@
53495
53579
  return cacheStyle;
53496
53580
  }
53497
53581
  let cacheKey;
53582
+ const cellType = this.getCellType(col, row);
53498
53583
  if ((this.isListTable() && !this.transpose) ||
53499
53584
  (this.isPivotTable() && this.internalProps.layoutMap.indicatorsAsCol)) {
53500
- cacheKey = col;
53585
+ cacheKey = col + cellType;
53501
53586
  }
53502
53587
  else {
53503
- cacheKey = row;
53588
+ cacheKey = row + cellType;
53504
53589
  }
53505
53590
  let cacheStyle;
53506
53591
  if (layoutMap.isBottomFrozenRow(row)) {
@@ -53513,7 +53598,7 @@
53513
53598
  return cacheStyle;
53514
53599
  }
53515
53600
  const column = layoutMap.getBody(col, row);
53516
- const styleClass = this.internalProps.bodyHelper.getStyleClass(column.cellType);
53601
+ const styleClass = this.internalProps.bodyHelper.getStyleClass(this.getCellType(col, row));
53517
53602
  const style = column?.style;
53518
53603
  cacheStyle = of$2(style, layoutMap.isBottomFrozenRow(row) && this.theme.bottomFrozenStyle
53519
53604
  ? this.theme.bottomFrozenStyle
@@ -56555,7 +56640,7 @@
56555
56640
  getCellCheckboxState(col, row) {
56556
56641
  const define = this.getBodyColumnDefine(col, row);
56557
56642
  const field = define?.field;
56558
- const cellType = define?.cellType;
56643
+ const cellType = this.getCellType(col, row);
56559
56644
  if (isValid$1(field) && cellType === 'checkbox') {
56560
56645
  const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row));
56561
56646
  return this.stateManager.checkedState[dataIndex][field];
@@ -63169,7 +63254,7 @@
63169
63254
  }
63170
63255
 
63171
63256
  registerForVrender();
63172
- const version = "0.19.2-alpha.2";
63257
+ const version = "0.19.2-alpha.3";
63173
63258
  function getIcons() {
63174
63259
  return get$1();
63175
63260
  }