@visactor/vtable 1.17.6-alpha.2 → 1.17.6

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 (73) hide show
  1. package/cjs/ListTable.d.ts +2 -2
  2. package/cjs/ListTable.js +23 -5
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/core/BaseTable.js +1 -1
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/core/record-helper.d.ts +2 -2
  7. package/cjs/core/record-helper.js +4 -4
  8. package/cjs/core/record-helper.js.map +1 -1
  9. package/cjs/dataset/dataset-pivot-table.js +2 -1
  10. package/cjs/edit/editors.js +1 -2
  11. package/cjs/event/listener/container-dom.js +3 -1
  12. package/cjs/event/listener/container-dom.js.map +1 -1
  13. package/cjs/index.d.ts +1 -1
  14. package/cjs/index.js +1 -1
  15. package/cjs/index.js.map +1 -1
  16. package/cjs/layout/simple-header-layout.d.ts +3 -1
  17. package/cjs/layout/simple-header-layout.js +11 -5
  18. package/cjs/layout/simple-header-layout.js.map +1 -1
  19. package/cjs/scenegraph/component/menu.js.map +1 -1
  20. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +1 -1
  21. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  22. package/cjs/state/checkbox/checkbox.js +2 -2
  23. package/cjs/state/checkbox/checkbox.js.map +1 -1
  24. package/cjs/state/select/update-position.js +138 -44
  25. package/cjs/state/select/update-position.js.map +1 -1
  26. package/cjs/state/state.d.ts +1 -0
  27. package/cjs/state/state.js +4 -4
  28. package/cjs/state/state.js.map +1 -1
  29. package/cjs/ts-types/base-table.d.ts +1 -0
  30. package/cjs/ts-types/base-table.js.map +1 -1
  31. package/cjs/ts-types/events.d.ts +1 -0
  32. package/cjs/ts-types/events.js.map +1 -1
  33. package/cjs/ts-types/table-engine.d.ts +2 -0
  34. package/cjs/ts-types/table-engine.js.map +1 -1
  35. package/cjs/vrender.js.map +1 -1
  36. package/dist/vtable.js +103 -19
  37. package/dist/vtable.min.js +1 -1
  38. package/es/ListTable.d.ts +2 -2
  39. package/es/ListTable.js +23 -5
  40. package/es/ListTable.js.map +1 -1
  41. package/es/core/BaseTable.js +1 -1
  42. package/es/core/BaseTable.js.map +1 -1
  43. package/es/core/record-helper.d.ts +2 -2
  44. package/es/core/record-helper.js +4 -4
  45. package/es/core/record-helper.js.map +1 -1
  46. package/es/dataset/dataset-pivot-table.js +2 -1
  47. package/es/edit/editors.js +1 -2
  48. package/es/event/listener/container-dom.js +2 -1
  49. package/es/event/listener/container-dom.js.map +1 -1
  50. package/es/index.d.ts +1 -1
  51. package/es/index.js +1 -1
  52. package/es/index.js.map +1 -1
  53. package/es/layout/simple-header-layout.d.ts +3 -1
  54. package/es/layout/simple-header-layout.js +12 -4
  55. package/es/layout/simple-header-layout.js.map +1 -1
  56. package/es/scenegraph/component/menu.js.map +1 -1
  57. package/es/scenegraph/graphic/contributions/rect-contribution-render.js +1 -1
  58. package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  59. package/es/state/checkbox/checkbox.js +2 -2
  60. package/es/state/checkbox/checkbox.js.map +1 -1
  61. package/es/state/select/update-position.js +138 -44
  62. package/es/state/select/update-position.js.map +1 -1
  63. package/es/state/state.d.ts +1 -0
  64. package/es/state/state.js +4 -4
  65. package/es/state/state.js.map +1 -1
  66. package/es/ts-types/base-table.d.ts +1 -0
  67. package/es/ts-types/base-table.js.map +1 -1
  68. package/es/ts-types/events.d.ts +1 -0
  69. package/es/ts-types/events.js.map +1 -1
  70. package/es/ts-types/table-engine.d.ts +2 -0
  71. package/es/ts-types/table-engine.js.map +1 -1
  72. package/es/vrender.js.map +1 -1
  73. package/package.json +5 -5
package/dist/vtable.js CHANGED
@@ -42705,7 +42705,7 @@
42705
42705
  context.stroke();
42706
42706
  }
42707
42707
  else {
42708
- renderStroke(rect, context, x, y, rectAttribute, stroke, strokeArrayWidth || lineWidth, strokeArrayColor || strokeColor, Math.ceil(width + deltaWidth), Math.ceil(height + deltaHeight));
42708
+ renderStroke(rect, context, x, y, rectAttribute, stroke, strokeArrayWidth || lineWidth, strokeArrayColor || strokeColor, rect.name !== 'table-border-rect' ? Math.ceil(width + deltaWidth) : width + deltaWidth, rect.name !== 'table-border-rect' ? Math.ceil(height + deltaHeight) : height + deltaHeight);
42709
42709
  }
42710
42710
  }
42711
42711
  }
@@ -50398,7 +50398,8 @@
50398
50398
  }
50399
50399
  else if (table.internalProps.layoutMap.isSeriesNumberInHeader(col, row)) {
50400
50400
  extendSelectRange = false;
50401
- if (state.select.headerSelectMode === 'body') {
50401
+ const { cornerHeaderSelectMode } = state.select;
50402
+ if (cornerHeaderSelectMode === 'body') {
50402
50403
  state.select.ranges.push({
50403
50404
  start: {
50404
50405
  col: table.leftRowSeriesNumberCount,
@@ -50408,6 +50409,22 @@
50408
50409
  skipBodyMerge: true
50409
50410
  });
50410
50411
  }
50412
+ else if (cornerHeaderSelectMode === 'inline') {
50413
+ const cellRange = skipBodyMerge ? { start: { col, row }, end: { col, row } } : table.getCellRange(col, row);
50414
+ state.select.ranges.push({
50415
+ start: { col: cellRange.start.col, row: cellRange.start.row },
50416
+ end: { col: cellRange.end.col, row: table.rowCount - 1 },
50417
+ skipBodyMerge: true
50418
+ });
50419
+ }
50420
+ else if (cornerHeaderSelectMode === 'cell') {
50421
+ const cellRange = skipBodyMerge ? { start: { col, row }, end: { col, row } } : table.getCellRange(col, row);
50422
+ state.select.ranges.push({
50423
+ start: { col: cellRange.start.col, row: cellRange.start.row },
50424
+ end: { col: cellRange.end.col, row: cellRange.end.row },
50425
+ skipBodyMerge: skipBodyMerge || undefined
50426
+ });
50427
+ }
50411
50428
  else {
50412
50429
  state.select.ranges.push({
50413
50430
  start: { col: 0, row: 0 },
@@ -50438,7 +50455,8 @@
50438
50455
  }
50439
50456
  else if (table.internalProps.layoutMap.isCornerHeader(col, row)) {
50440
50457
  extendSelectRange = false;
50441
- if (state.select.headerSelectMode === 'body') {
50458
+ const { cornerHeaderSelectMode } = state.select;
50459
+ if (cornerHeaderSelectMode === 'body') {
50442
50460
  state.select.ranges.push({
50443
50461
  start: {
50444
50462
  col: table.rowHeaderLevelCount + table.leftRowSeriesNumberCount,
@@ -50448,9 +50466,38 @@
50448
50466
  skipBodyMerge: true
50449
50467
  });
50450
50468
  }
50469
+ else if (cornerHeaderSelectMode === 'cell') {
50470
+ const cellRange = skipBodyMerge ? { start: { col, row }, end: { col, row } } : table.getCellRange(col, row);
50471
+ state.select.ranges.push({
50472
+ start: { col: cellRange.start.col, row: cellRange.start.row },
50473
+ end: { col: cellRange.end.col, row: cellRange.end.row },
50474
+ skipBodyMerge: skipBodyMerge || undefined
50475
+ });
50476
+ }
50477
+ else if (cornerHeaderSelectMode === 'inline') {
50478
+ const cellRange = skipBodyMerge ? { start: { col, row }, end: { col, row } } : table.getCellRange(col, row);
50479
+ state.select.ranges.push({
50480
+ start: { col: cellRange.start.col, row: cellRange.start.row },
50481
+ end: { col: cellRange.end.col, row: table.rowCount - 1 },
50482
+ skipBodyMerge: true
50483
+ });
50484
+ }
50485
+ else if (cornerHeaderSelectMode === 'all') {
50486
+ state.select.ranges.push({
50487
+ start: {
50488
+ col: table.leftRowSeriesNumberCount,
50489
+ row: 0
50490
+ },
50491
+ end: { col: table.colCount - 1, row: table.rowCount - 1 },
50492
+ skipBodyMerge: true
50493
+ });
50494
+ }
50451
50495
  else {
50452
50496
  state.select.ranges.push({
50453
- start: { col: table.leftRowSeriesNumberCount, row: 0 },
50497
+ start: {
50498
+ col: table.leftRowSeriesNumberCount,
50499
+ row: 0
50500
+ },
50454
50501
  end: { col: table.colCount - 1, row: table.rowCount - 1 },
50455
50502
  skipBodyMerge: true
50456
50503
  });
@@ -51427,7 +51474,7 @@
51427
51474
  const recordIndex = state.table.getRecordShowIndexByCell(col, row);
51428
51475
  if (recordIndex >= 0) {
51429
51476
  const dataIndex = state.table.dataSource.getIndexKey(recordIndex).toString();
51430
- if (state.checkedState.has(dataIndex)) {
51477
+ if (state.checkedState.get(dataIndex)) {
51431
51478
  state.checkedState.get(dataIndex)[field] = checked;
51432
51479
  }
51433
51480
  else {
@@ -51466,7 +51513,7 @@
51466
51513
  if (isValid$3(state.checkedState.get(dataIndex)?.[field])) {
51467
51514
  return state.checkedState.get(dataIndex)[field];
51468
51515
  }
51469
- if (state.checkedState.has(dataIndex)) {
51516
+ if (state.checkedState.get(dataIndex)) {
51470
51517
  state.checkedState.get(dataIndex)[field] = checked;
51471
51518
  }
51472
51519
  else if (dataIndex.includes(',')) {
@@ -52141,6 +52188,11 @@
52141
52188
  highlightMode: 'cell',
52142
52189
  highlightInRange: false
52143
52190
  }, this.table.options.select);
52191
+ const cornerHeaderSelectMode = this.table.options.select?.cornerHeaderSelectMode
52192
+ ? this.table.options.select?.cornerHeaderSelectMode
52193
+ : this.table.options.select?.headerSelectMode === 'body'
52194
+ ? this.table.options.select?.headerSelectMode
52195
+ : 'all';
52144
52196
  if (disableSelect === true) {
52145
52197
  this.select.highlightScope = HighlightScope.none;
52146
52198
  }
@@ -52161,6 +52213,7 @@
52161
52213
  this.select.singleStyle = !disableSelect;
52162
52214
  this.select.disableHeader = disableHeaderSelect;
52163
52215
  this.select.headerSelectMode = headerSelectMode;
52216
+ this.select.cornerHeaderSelectMode = cornerHeaderSelectMode;
52164
52217
  this.select.highlightInRange = highlightInRange;
52165
52218
  this.select.disableCtrlMultiSelect = this.table.options.keyboardOptions?.ctrlMultiSelect === false;
52166
52219
  }
@@ -55123,7 +55176,7 @@
55123
55176
  table.stateManager.updateInteractionState(InteractionState.grabing);
55124
55177
  const targetCol = table.getTargetColAtConsiderRightFrozen(selectX, considerFrozenX);
55125
55178
  const targetRow = table.getTargetRowAtConsiderBottomFrozen(selectY, considerFrozenY);
55126
- if (isValid$3(targetCol) && isValid$3(targetRow)) {
55179
+ if (!table.options.select?.disableDragSelect && isValid$3(targetCol) && isValid$3(targetRow)) {
55127
55180
  table.stateManager.updateSelectPos(targetCol.col, targetRow.row, false, false, false, false);
55128
55181
  }
55129
55182
  });
@@ -60597,7 +60650,7 @@
60597
60650
  return TABLE_EVENT_TYPE;
60598
60651
  }
60599
60652
  options;
60600
- version = "1.17.6-alpha.2";
60653
+ version = "1.17.6";
60601
60654
  pagination;
60602
60655
  id = `VTable${Date.now()}`;
60603
60656
  headerStyleCache;
@@ -65438,6 +65491,8 @@
65438
65491
  _hasAggregationOnTopCount = 0;
65439
65492
  _hasAggregationOnBottomCount = 0;
65440
65493
  rowHierarchyType;
65494
+ columnHierarchyType;
65495
+ columnExpandLevel;
65441
65496
  _cellRangeMap;
65442
65497
  constructor(table, columns, showHeader, hierarchyIndent) {
65443
65498
  this._cellRangeMap = new Map();
@@ -65448,7 +65503,9 @@
65448
65503
  this._headerCellIds = [];
65449
65504
  this.hierarchyIndent = hierarchyIndent ?? 20;
65450
65505
  this.hierarchyTextStartAlignment = table.options.hierarchyTextStartAlignment;
65451
- this.columnTree = new DimensionTree(columns, { seqId: 0 }, null);
65506
+ this.columnHierarchyType = table.options.headerHierarchyType;
65507
+ this.columnExpandLevel = table.options.headerExpandLevel ?? 1;
65508
+ this.columnTree = new DimensionTree(columns, { seqId: 0 }, this.columnHierarchyType ?? null, this.columnHierarchyType === 'grid-tree' ? this.columnExpandLevel : undefined);
65452
65509
  this._headerObjectsIncludeHided = this._addHeaders(0, columns, []);
65453
65510
  this._headerObjects = this._headerObjectsIncludeHided.filter(col => {
65454
65511
  return col.define.hide !== true;
@@ -66244,6 +66301,7 @@
66244
66301
  headerType: hd.headerType ?? 'text',
66245
66302
  dropDownMenu: hd.dropDownMenu,
66246
66303
  define: hd,
66304
+ hierarchyState: hd.hierarchyState,
66247
66305
  columnWidthComputeMode: hd.columnWidthComputeMode
66248
66306
  };
66249
66307
  results[id] = cell;
@@ -66256,7 +66314,8 @@
66256
66314
  else if (this._headerCellIds[row - 1]) {
66257
66315
  rowCells[col] = this._headerCellIds[row - 1][col];
66258
66316
  }
66259
- if (hd.columns) {
66317
+ const expand = !hd.hierarchyState || hd.hierarchyState === HierarchyState.expand;
66318
+ if (!!hd.columns && !!expand) {
66260
66319
  const isAllHided = hd.columns.every((c) => c.hide);
66261
66320
  !isAllHided &&
66262
66321
  this._addHeaders(row + 1, hd.columns, [...roots, id], hd.hideColumnsSubHeader || hideColumnsSubHeader).forEach(c => results.push(c));
@@ -66812,7 +66871,7 @@
66812
66871
  return {};
66813
66872
  }
66814
66873
 
66815
- function listTableChangeCellValue(col, row, value, workOnEditableCell, table) {
66874
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
66816
66875
  if ((workOnEditableCell && table.isHasEditorDefine(col, row)) || workOnEditableCell === false) {
66817
66876
  const recordIndex = table.getRecordShowIndexByCell(col, row);
66818
66877
  const { field } = table.internalProps.layoutMap.getBody(col, row);
@@ -66874,7 +66933,7 @@
66874
66933
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
66875
66934
  }
66876
66935
  const changedValue = table.getCellOriginValue(col, row);
66877
- if (oldValue !== changedValue) {
66936
+ if (oldValue !== changedValue && triggerEvent) {
66878
66937
  table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
66879
66938
  col,
66880
66939
  row,
@@ -66886,7 +66945,7 @@
66886
66945
  table.scenegraph.updateNextFrame();
66887
66946
  }
66888
66947
  }
66889
- function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, table) {
66948
+ function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
66890
66949
  let pasteColEnd = startCol;
66891
66950
  let pasteRowEnd = startRow;
66892
66951
  const beforeChangeValues = [];
@@ -66958,7 +67017,7 @@
66958
67017
  table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
66959
67018
  }
66960
67019
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
66961
- if (oldValue !== changedValue) {
67020
+ if (oldValue !== changedValue && triggerEvent) {
66962
67021
  table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
66963
67022
  col: startCol + j,
66964
67023
  row: startRow + i,
@@ -68134,6 +68193,9 @@
68134
68193
  return null;
68135
68194
  }
68136
68195
  getHierarchyState(col, row) {
68196
+ if (this.isHeader(col, row)) {
68197
+ return this._getHeaderLayoutMap(col, row)?.hierarchyState;
68198
+ }
68137
68199
  if (!this.options.groupBy || (isArray$7(this.options.groupBy) && this.options.groupBy.length === 0)) {
68138
68200
  const define = this.getBodyColumnDefine(col, row);
68139
68201
  if (!define.tree) {
@@ -68146,6 +68208,28 @@
68146
68208
  toggleHierarchyState(col, row, recalculateColWidths = true) {
68147
68209
  this.stateManager.updateHoverIcon(col, row, undefined, undefined);
68148
68210
  const hierarchyState = this.getHierarchyState(col, row);
68211
+ if (this.isHeader(col, row)) {
68212
+ const headerTreeNode = this.internalProps.layoutMap.getHeader(col, row);
68213
+ const { hierarchyState: rawHierarchyState, define: columnDefine } = headerTreeNode;
68214
+ if (![HierarchyState.collapse, HierarchyState.expand].includes(rawHierarchyState) || !columnDefine) {
68215
+ return;
68216
+ }
68217
+ const children = columnDefine.columns;
68218
+ if (!!Array.isArray(children) && children.length > 0) {
68219
+ const hierarchyState = rawHierarchyState === HierarchyState.expand ? HierarchyState.collapse : HierarchyState.expand;
68220
+ headerTreeNode.hierarchyState = hierarchyState;
68221
+ headerTreeNode.define.hierarchyState = hierarchyState;
68222
+ this.updateColumns(this.internalProps.columns);
68223
+ }
68224
+ this.fireListeners(TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
68225
+ col,
68226
+ row,
68227
+ hierarchyState,
68228
+ originData: headerTreeNode,
68229
+ cellLocation: this.getCellLocation(col, row)
68230
+ });
68231
+ return;
68232
+ }
68149
68233
  if (hierarchyState === HierarchyState.expand) {
68150
68234
  this._refreshHierarchyState(col, row, recalculateColWidths);
68151
68235
  this.fireListeners(TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
@@ -68490,11 +68574,11 @@
68490
68574
  }
68491
68575
  return isValid$3(editorDefine);
68492
68576
  }
68493
- changeCellValue(col, row, value, workOnEditableCell = false) {
68494
- return listTableChangeCellValue(col, row, value, workOnEditableCell, this);
68577
+ changeCellValue(col, row, value, workOnEditableCell = false, triggerEvent = true) {
68578
+ return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
68495
68579
  }
68496
- changeCellValues(startCol, startRow, values, workOnEditableCell = false) {
68497
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, this);
68580
+ changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true) {
68581
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
68498
68582
  }
68499
68583
  addRecord(record, recordIndex) {
68500
68584
  listTableAddRecord(record, recordIndex, this);
@@ -83418,7 +83502,7 @@
83418
83502
  }
83419
83503
 
83420
83504
  registerForVrender();
83421
- const version = "1.17.6-alpha.2";
83505
+ const version = "1.17.6";
83422
83506
  function getIcons() {
83423
83507
  return get$2();
83424
83508
  }