@visactor/vtable 1.0.0 → 1.0.1

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 (47) hide show
  1. package/cjs/body-helper/body-helper.js +4 -3
  2. package/cjs/body-helper/body-helper.js.map +1 -1
  3. package/cjs/core/BaseTable.d.ts +2 -0
  4. package/cjs/core/BaseTable.js +9 -3
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/index.d.ts +1 -1
  7. package/cjs/index.js +1 -1
  8. package/cjs/index.js.map +1 -1
  9. package/cjs/scenegraph/layout/compute-col-width.js +4 -2
  10. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  11. package/cjs/scenegraph/utils/text-icon-layout.d.ts +3 -1
  12. package/cjs/scenegraph/utils/text-icon-layout.js +13 -7
  13. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  14. package/cjs/state/select/update-position.d.ts +1 -1
  15. package/cjs/state/select/update-position.js +2 -2
  16. package/cjs/state/select/update-position.js.map +1 -1
  17. package/cjs/state/state.d.ts +1 -1
  18. package/cjs/state/state.js +2 -2
  19. package/cjs/state/state.js.map +1 -1
  20. package/cjs/ts-types/base-table.d.ts +2 -0
  21. package/cjs/ts-types/base-table.js.map +1 -1
  22. package/cjs/vrender.js.map +1 -1
  23. package/dist/vtable.js +46 -18
  24. package/dist/vtable.min.js +2 -2
  25. package/es/body-helper/body-helper.js +4 -3
  26. package/es/body-helper/body-helper.js.map +1 -1
  27. package/es/core/BaseTable.d.ts +2 -0
  28. package/es/core/BaseTable.js +9 -3
  29. package/es/core/BaseTable.js.map +1 -1
  30. package/es/index.d.ts +1 -1
  31. package/es/index.js +1 -1
  32. package/es/index.js.map +1 -1
  33. package/es/scenegraph/layout/compute-col-width.js +4 -2
  34. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  35. package/es/scenegraph/utils/text-icon-layout.d.ts +3 -1
  36. package/es/scenegraph/utils/text-icon-layout.js +11 -7
  37. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  38. package/es/state/select/update-position.d.ts +1 -1
  39. package/es/state/select/update-position.js +2 -2
  40. package/es/state/select/update-position.js.map +1 -1
  41. package/es/state/state.d.ts +1 -1
  42. package/es/state/state.js +2 -2
  43. package/es/state/state.js.map +1 -1
  44. package/es/ts-types/base-table.d.ts +2 -0
  45. package/es/ts-types/base-table.js.map +1 -1
  46. package/es/vrender.js.map +1 -1
  47. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vrender.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAIhC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,SAAgB,kBAAkB;IAChC,IAAI,QAAQ,EAAE;QACZ,OAAO;KACR;IACD,QAAQ,GAAG,IAAI,CAAC;IAEhB,IAAA,+BAAgB,GAAE,CAAC;IAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;QAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;KAC3B;SAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;QACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;KACxB;IACD,IAAA,0BAAW,GAAE,CAAC;IACd,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,8BAAe,GAAE,CAAC;IAClB,IAAA,gCAAiB,GAAE,CAAC;IACpB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,+BAAgB,GAAE,CAAC;IACnB,IAAA,iCAAkB,GAAE,CAAC;IACrB,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,+BAAgB,GAAE,CAAC;AACrB,CAAC;AA/BD,gDA+BC;AAED,yDAAuC;AACvC,yDAAuC","file":"vrender.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\n// export const version = \"1.0.0\";\n\nlet registed = false;\nexport function registerForVrender() {\n if (registed) {\n return;\n }\n registed = true;\n // 注册内置组件\n preLoadAllModule();\n\n if (isBrowserEnv()) {\n loadBrowserEnv(container);\n } else if (isNodeEnv()) {\n loadNodeEnv(container);\n }\n registerArc();\n registerArc3d();\n registerArea();\n registerCircle();\n registerGlyph();\n registerGroup();\n registerImage();\n registerLine();\n registerPath();\n registerPolygon();\n registerPyramid3d();\n registerRect();\n registerRect3d();\n registerRichtext();\n registerShadowRoot();\n registerSymbol();\n registerText();\n registerWrapText();\n}\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
1
+ {"version":3,"sources":["../src/vrender.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAIhC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,SAAgB,kBAAkB;IAChC,IAAI,QAAQ,EAAE;QACZ,OAAO;KACR;IACD,QAAQ,GAAG,IAAI,CAAC;IAEhB,IAAA,+BAAgB,GAAE,CAAC;IAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;QAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;KAC3B;SAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;QACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;KACxB;IACD,IAAA,0BAAW,GAAE,CAAC;IACd,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,8BAAe,GAAE,CAAC;IAClB,IAAA,gCAAiB,GAAE,CAAC;IACpB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,+BAAgB,GAAE,CAAC;IACnB,IAAA,iCAAkB,GAAE,CAAC;IACrB,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,+BAAgB,GAAE,CAAC;AACrB,CAAC;AA/BD,gDA+BC;AAED,yDAAuC;AACvC,yDAAuC","file":"vrender.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\n// export const version = \"1.0.1\";\n\nlet registed = false;\nexport function registerForVrender() {\n if (registed) {\n return;\n }\n registed = true;\n // 注册内置组件\n preLoadAllModule();\n\n if (isBrowserEnv()) {\n loadBrowserEnv(container);\n } else if (isNodeEnv()) {\n loadNodeEnv(container);\n }\n registerArc();\n registerArc3d();\n registerArea();\n registerCircle();\n registerGlyph();\n registerGroup();\n registerImage();\n registerLine();\n registerPath();\n registerPolygon();\n registerPyramid3d();\n registerRect();\n registerRect3d();\n registerRichtext();\n registerShadowRoot();\n registerSymbol();\n registerText();\n registerWrapText();\n}\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
package/dist/vtable.js CHANGED
@@ -38291,8 +38291,7 @@
38291
38291
  lineClamp,
38292
38292
  wordBreak: 'break-word',
38293
38293
  whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal',
38294
- dx: (textAlign === 'left' ? (!contentLeftIcons.length && !contentRightIcons.length ? hierarchyOffset : 0) : 0) +
38295
- _contentOffset
38294
+ dx: (textAlign === 'left' ? (!contentLeftIcons.length ? hierarchyOffset : 0) : 0) + _contentOffset
38296
38295
  };
38297
38296
  const wrapText = new Text$1(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
38298
38297
  wrapText.name = 'text';
@@ -38339,14 +38338,17 @@
38339
38338
  align: textAlign,
38340
38339
  baseline: textBaseline
38341
38340
  });
38341
+ const dealWithIconComputeVar = {
38342
+ addedHierarchyOffset: 0
38343
+ };
38342
38344
  contentLeftIcons.forEach(icon => {
38343
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
38345
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table, dealWithIconComputeVar);
38344
38346
  iconMark.role = 'icon-content-left';
38345
38347
  iconMark.name = icon.name;
38346
38348
  cellContent.addLeftOccupyingIcon(iconMark);
38347
38349
  });
38348
38350
  contentRightIcons.forEach(icon => {
38349
- const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table);
38351
+ const iconMark = dealWithIcon(icon, undefined, cellGroup.col, cellGroup.row, range, table, dealWithIconComputeVar);
38350
38352
  iconMark.role = 'icon-content-right';
38351
38353
  iconMark.name = icon.name;
38352
38354
  cellContent.addRightOccupyingIcon(iconMark);
@@ -38410,7 +38412,7 @@
38410
38412
  height: height + padding[0] + padding[2]
38411
38413
  });
38412
38414
  }
38413
- function dealWithIcon(icon, mark, col, row, range, table) {
38415
+ function dealWithIcon(icon, mark, col, row, range, table, dealWithIconComputeVar) {
38414
38416
  const iconAttribute = {};
38415
38417
  if (icon.type === 'image') {
38416
38418
  iconAttribute.image = icon.src;
@@ -38424,13 +38426,20 @@
38424
38426
  iconAttribute.funcType = icon.funcType;
38425
38427
  iconAttribute.interactive = icon.interactive;
38426
38428
  let hierarchyOffset = 0;
38427
- if (isNumber$4(col) &&
38429
+ if ((!dealWithIconComputeVar || dealWithIconComputeVar?.addedHierarchyOffset === 0) &&
38430
+ isNumber$4(col) &&
38428
38431
  isNumber$4(row) &&
38429
38432
  table &&
38430
- (icon.funcType === IconFuncTypeEnum.collapse || icon.funcType === IconFuncTypeEnum.expand)) {
38433
+ (icon.funcType === IconFuncTypeEnum.collapse ||
38434
+ icon.funcType === IconFuncTypeEnum.expand ||
38435
+ icon.positionType === IconPosition.contentLeft ||
38436
+ icon.positionType === IconPosition.contentRight)) {
38431
38437
  hierarchyOffset = range
38432
38438
  ? getHierarchyOffset(range.start.col, range.start.row, table)
38433
38439
  : getHierarchyOffset(col, row, table);
38440
+ if (dealWithIconComputeVar) {
38441
+ dealWithIconComputeVar.addedHierarchyOffset = 1;
38442
+ }
38434
38443
  }
38435
38444
  iconAttribute.marginLeft = (icon.marginLeft ?? 0) + hierarchyOffset;
38436
38445
  iconAttribute.marginRight = icon.marginRight ?? 0;
@@ -44903,6 +44912,10 @@
44903
44912
  if (hd?.hierarchyLevel) {
44904
44913
  cellHierarchyIndent =
44905
44914
  (hd.hierarchyLevel ?? 0) * (layoutMap.rowHierarchyIndent ?? 0);
44915
+ if (layoutMap.rowHierarchyTextStartAlignment &&
44916
+ !table.internalProps.headerHelper.getHierarchyIcon(col, row)) {
44917
+ cellHierarchyIndent += table.internalProps.headerHelper.getHierarchyIconWidth();
44918
+ }
44906
44919
  }
44907
44920
  }
44908
44921
  else {
@@ -44914,6 +44927,10 @@
44914
44927
  Array.isArray(indexArr) && table.getHierarchyState(col, row) !== HierarchyState.none
44915
44928
  ? (indexArr.length - 1) * (layoutMap.hierarchyIndent ?? 0)
44916
44929
  : 0;
44930
+ if (layoutMap.hierarchyTextStartAlignment &&
44931
+ !table.internalProps.bodyHelper.getHierarchyIcon(col, row)) {
44932
+ cellHierarchyIndent += table.internalProps.headerHelper.getHierarchyIconWidth();
44933
+ }
44917
44934
  }
44918
44935
  }
44919
44936
  const textWidth = computeTextWidth(col, row, cellType, table);
@@ -50680,7 +50697,7 @@
50680
50697
  return table._getLayoutCellId(col, row) === table._getLayoutCellId(range1Col, range1Row);
50681
50698
  }
50682
50699
 
50683
- function updateSelectPosition(state, col, row, isShift, isCtrl, isSelectAll, isSelectMoving = false) {
50700
+ function updateSelectPosition(state, col, row, isShift, isCtrl, isSelectAll, isSelectMoving = false, skipBodyMerge = false) {
50684
50701
  const { table, interactionState } = state;
50685
50702
  const { scenegraph } = table;
50686
50703
  const { highlightScope, disableHeader, cellPos } = state.select;
@@ -50892,6 +50909,9 @@
50892
50909
  col,
50893
50910
  row
50894
50911
  };
50912
+ if (skipBodyMerge) {
50913
+ currentRange.skipBodyMerge = true;
50914
+ }
50895
50915
  }
50896
50916
  }
50897
50917
  scenegraph.updateCellSelectBorder(currentRange, extendSelectRange);
@@ -52205,11 +52225,11 @@
52205
52225
  updateHoverPos(col, row) {
52206
52226
  updateHoverPosition(this, col, row);
52207
52227
  }
52208
- updateSelectPos(col, row, isShift = false, isCtrl = false, isSelectAll = false, isSelectMoving = false) {
52228
+ updateSelectPos(col, row, isShift = false, isCtrl = false, isSelectAll = false, isSelectMoving = false, skipBodyMerge = false) {
52209
52229
  if (row !== -1 && row !== -1) {
52210
52230
  this.select.selecting = true;
52211
52231
  }
52212
- updateSelectPosition(this, col, row, isShift, isCtrl, isSelectAll, isSelectMoving);
52232
+ updateSelectPosition(this, col, row, isShift, isCtrl, isSelectAll, isSelectMoving, skipBodyMerge);
52213
52233
  }
52214
52234
  checkCellRangeInSelect(cellPosStart, cellPosEnd) {
52215
52235
  return checkMultiCellInSelect(cellPosStart, cellPosEnd, this.select.ranges, this.select.highlightScope);
@@ -55367,6 +55387,10 @@
55367
55387
  }
55368
55388
  getIcons(col, row, cellValue, dataValue, context) {
55369
55389
  const iconArr = [];
55390
+ const hierarchyIcon = this.getHierarchyIcon(col, row);
55391
+ if (hierarchyIcon) {
55392
+ iconArr.push(hierarchyIcon);
55393
+ }
55370
55394
  const { icon: iconDefine } = this._table.getBodyColumnDefine(col, row);
55371
55395
  if (iconDefine) {
55372
55396
  let iconResults;
@@ -55405,10 +55429,6 @@
55405
55429
  addIcon(iconResults);
55406
55430
  }
55407
55431
  }
55408
- const hierarchyIcon = this.getHierarchyIcon(col, row);
55409
- if (hierarchyIcon) {
55410
- iconArr.push(hierarchyIcon);
55411
- }
55412
55432
  context &&
55413
55433
  iconArr.forEach((i, index) => {
55414
55434
  if (i.content || i.src) {
@@ -58441,7 +58461,7 @@
58441
58461
  return TABLE_EVENT_TYPE;
58442
58462
  }
58443
58463
  options;
58444
- version = "1.0.0";
58464
+ version = "1.0.1";
58445
58465
  pagination;
58446
58466
  id = `VTable${Date.now()}`;
58447
58467
  headerStyleCache;
@@ -59015,6 +59035,10 @@
59015
59035
  this._clearRowRangeHeightsMap(row);
59016
59036
  }
59017
59037
  }
59038
+ setRowHeight(row, height) {
59039
+ this.scenegraph.setRowHeight(row, height);
59040
+ this.internalProps._heightResizedRowMap.add(row);
59041
+ }
59018
59042
  getRowsHeight(startRow, endRow) {
59019
59043
  if (startRow > endRow || this.rowCount === 0) {
59020
59044
  return 0;
@@ -59108,6 +59132,10 @@
59108
59132
  this.stateManager.checkFrozen();
59109
59133
  }
59110
59134
  }
59135
+ setColWidth(col, width) {
59136
+ this.scenegraph.setColWidth(col, width);
59137
+ this.internalProps._widthResizedColMap.add(col);
59138
+ }
59111
59139
  _clearColRangeWidthsMap(col) {
59112
59140
  if (typeof col !== 'number') {
59113
59141
  this._colRangeWidthsMap.clear();
@@ -59999,12 +60027,12 @@
59999
60027
  const { scrollLeft, scrollTop } = this;
60000
60028
  cellRanges.forEach((cellRange, index) => {
60001
60029
  if (cellRange.start.col === cellRange.end.col && cellRange.start.row === cellRange.end.row) {
60002
- this.stateManager.updateSelectPos(cellRange.start.col, cellRange.start.row, false, index >= 1);
60030
+ this.stateManager.updateSelectPos(cellRange.start.col, cellRange.start.row, false, index >= 1, false, false, true);
60003
60031
  }
60004
60032
  else {
60005
60033
  this.stateManager.updateSelectPos(cellRange.start.col, cellRange.start.row, false, index >= 1);
60006
60034
  this.stateManager.updateInteractionState(InteractionState.grabing);
60007
- this.stateManager.updateSelectPos(cellRange.end.col, cellRange.end.row, false, index >= 1);
60035
+ this.stateManager.updateSelectPos(cellRange.end.col, cellRange.end.row, false, index >= 1, false, false, true);
60008
60036
  }
60009
60037
  this.stateManager.endSelectCells(false);
60010
60038
  this.stateManager.updateInteractionState(InteractionState.default);
@@ -71647,7 +71675,7 @@
71647
71675
  }
71648
71676
 
71649
71677
  registerForVrender();
71650
- const version = "1.0.0";
71678
+ const version = "1.0.1";
71651
71679
  function getIcons() {
71652
71680
  return get$2();
71653
71681
  }