@visactor/vtable 0.17.4 → 0.17.5-alpha.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/state/cell-move/adjust-header.ts"],"names":[],"mappings":";;;AAIA,SAAgB,sBAAsB,CAAC,MAAmB,EAAE,MAAmB,EAAE,KAAmB;IAClG,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAEnE,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE;QAEhD,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAElF,IAAI,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,sBAAsB,EAAE;YAC9C,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,sBAAsB,GAAG,CAAC,CAAC;SAC/C;QAED,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE;YAC5B,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;SACtC;aAAM;YACL,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;SACxC;KACF;SAAM,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE;QACpD,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QAClF,IAAI,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,mBAAmB,EAAE;YAC3C,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,mBAAmB,GAAG,CAAC,CAAC;SAC5C;QAED,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,SAAiC,CAAC;QACxE,IAAI,SAAS,CAAC,gBAAgB,KAAK,MAAM,EAAE;YACzC,MAAM,oBAAoB,GAAG,SAAS,CAAC,+BAA+B,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC;YAC9G,MAAM,oBAAoB,GAAG,SAAS,CAAC,+BAA+B,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC;YAC9G,IAAI,oBAAoB,CAAC,MAAM,IAAI,oBAAoB,CAAC,MAAM,EAAE;gBAC9D,MAAM,cAAc,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAE7E,IAAI,cAAc,EAAE;oBAClB,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE;wBAE5B,MAAM,CAAC,GAAG,GAAG,cAAc,CAAC,YAAY,GAAG,cAAc,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,sBAAsB,CAAC;qBACnG;yBAAM;wBACL,MAAM,CAAC,GAAG,GAAG,cAAc,CAAC,YAAY,GAAG,KAAK,CAAC,sBAAsB,CAAC;qBACzE;iBACF;aACF;SACF;aAAM,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE;YAEnC,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;SACtC;aAAM;YAEL,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;SACxC;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AA/CD,wDA+CC","file":"adjust-header.js","sourcesContent":["import type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport type { CellAddress } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nexport function adjustMoveHeaderTarget(source: CellAddress, target: CellAddress, table: BaseTableAPI) {\n const sourceCellRange = table.getCellRange(source.col, source.row);\n\n if (table.isColumnHeader(source.col, source.row)) {\n // 处理是目标位置处是合并单元格的情况\n const targetCellRange = table.getCellRange(target.col, sourceCellRange.start.row);\n // 如果是拖拽处是body target.row处理成表头最后一层\n if (target.row >= table.columnHeaderLevelCount) {\n target.row = table.columnHeaderLevelCount - 1;\n }\n //如果拖拽目标的列在原位置的右侧 位置是合并单元格的最右侧\n if (target.col >= source.col) {\n target.col = targetCellRange.end.col;\n } else {\n target.col = targetCellRange.start.col;\n } //左侧 位置是合并单元格的最左侧\n } else if (table.isRowHeader(source.col, source.row)) {\n const targetCellRange = table.getCellRange(sourceCellRange.start.col, target.row);\n if (target.col >= table.rowHeaderLevelCount) {\n target.col = table.rowHeaderLevelCount - 1;\n }\n // tree模式[透视表行表头]\n const layoutMap = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n if (layoutMap.rowHierarchyType === 'tree') {\n const sourceRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(source.col, source.row).rowHeaderPaths;\n const targetRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(target.col, target.row).rowHeaderPaths;\n if (sourceRowHeaderPaths.length <= targetRowHeaderPaths.length) {\n const targetPathNode = targetRowHeaderPaths[sourceRowHeaderPaths.length - 1]; //找到共同层级节点\n // 根据这个目标节点找到结束的row index\n if (targetPathNode) {\n if (target.row >= source.row) {\n //如果拖拽目标的列在原位置的上面 位置是层级的最上端\n target.row = targetPathNode.startInTotal + targetPathNode.size - 1 + table.columnHeaderLevelCount;\n } else {\n target.row = targetPathNode.startInTotal + table.columnHeaderLevelCount;\n }\n } //如果拖拽目标的列在原位置的下面 位置是层级的最下端\n }\n } else if (target.row >= source.row) {\n //table模式 如果拖拽目标的列在原位置的下面 位置是层级的最下端\n target.row = targetCellRange.end.row;\n } else {\n //table模式 如果拖拽目标的列在原位置的上面 位置是层级的最上端\n target.row = targetCellRange.start.row;\n }\n }\n return target;\n}\n"]}
1
+ {"version":3,"sources":["../src/state/cell-move/adjust-header.ts"],"names":[],"mappings":";;;AAIA,SAAgB,sBAAsB,CAAC,MAAmB,EAAE,MAAmB,EAAE,KAAmB;IAClG,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAEnE,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE;QAEhD,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAElF,IAAI,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,sBAAsB,EAAE;YAC9C,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,sBAAsB,GAAG,CAAC,CAAC;SAC/C;QAED,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE;YAC5B,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;SACtC;aAAM;YACL,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;SACxC;KACF;SAAM,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE;QACpD,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QAClF,IAAI,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,mBAAmB,EAAE;YAC3C,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,mBAAmB,GAAG,CAAC,CAAC;SAC5C;QAED,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,SAAiC,CAAC;QACxE,IAAI,SAAS,CAAC,gBAAgB,KAAK,MAAM,EAAE;YACzC,MAAM,oBAAoB,GAAG,SAAS,CAAC,+BAA+B,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC;iBAC3F,cAAqB,CAAC;YACzB,MAAM,oBAAoB,GAAG,SAAS,CAAC,+BAA+B,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC;iBAC3F,cAAqB,CAAC;YACzB,IAAI,oBAAoB,CAAC,MAAM,IAAI,oBAAoB,CAAC,MAAM,EAAE;gBAC9D,MAAM,cAAc,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAE7E,IAAI,cAAc,EAAE;oBAClB,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE;wBAE5B,MAAM,CAAC,GAAG,GAAG,cAAc,CAAC,YAAY,GAAG,cAAc,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,sBAAsB,CAAC;qBACnG;yBAAM;wBACL,MAAM,CAAC,GAAG,GAAG,cAAc,CAAC,YAAY,GAAG,KAAK,CAAC,sBAAsB,CAAC;qBACzE;iBACF;aACF;SACF;aAAM,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE;YAEnC,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;SACtC;aAAM;YAEL,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;SACxC;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAjDD,wDAiDC","file":"adjust-header.js","sourcesContent":["import type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport type { CellAddress } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nexport function adjustMoveHeaderTarget(source: CellAddress, target: CellAddress, table: BaseTableAPI) {\n const sourceCellRange = table.getCellRange(source.col, source.row);\n\n if (table.isColumnHeader(source.col, source.row)) {\n // 处理是目标位置处是合并单元格的情况\n const targetCellRange = table.getCellRange(target.col, sourceCellRange.start.row);\n // 如果是拖拽处是body target.row处理成表头最后一层\n if (target.row >= table.columnHeaderLevelCount) {\n target.row = table.columnHeaderLevelCount - 1;\n }\n //如果拖拽目标的列在原位置的右侧 位置是合并单元格的最右侧\n if (target.col >= source.col) {\n target.col = targetCellRange.end.col;\n } else {\n target.col = targetCellRange.start.col;\n } //左侧 位置是合并单元格的最左侧\n } else if (table.isRowHeader(source.col, source.row)) {\n const targetCellRange = table.getCellRange(sourceCellRange.start.col, target.row);\n if (target.col >= table.rowHeaderLevelCount) {\n target.col = table.rowHeaderLevelCount - 1;\n }\n // tree模式[透视表行表头]\n const layoutMap = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n if (layoutMap.rowHierarchyType === 'tree') {\n const sourceRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(source.col, source.row)\n .rowHeaderPaths as any;\n const targetRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(target.col, target.row)\n .rowHeaderPaths as any;\n if (sourceRowHeaderPaths.length <= targetRowHeaderPaths.length) {\n const targetPathNode = targetRowHeaderPaths[sourceRowHeaderPaths.length - 1]; //找到共同层级节点\n // 根据这个目标节点找到结束的row index\n if (targetPathNode) {\n if (target.row >= source.row) {\n //如果拖拽目标的列在原位置的上面 位置是层级的最上端\n target.row = targetPathNode.startInTotal + targetPathNode.size - 1 + table.columnHeaderLevelCount;\n } else {\n target.row = targetPathNode.startInTotal + table.columnHeaderLevelCount;\n }\n } //如果拖拽目标的列在原位置的下面 位置是层级的最下端\n }\n } else if (target.row >= source.row) {\n //table模式 如果拖拽目标的列在原位置的下面 位置是层级的最下端\n target.row = targetCellRange.end.row;\n } else {\n //table模式 如果拖拽目标的列在原位置的上面 位置是层级的最上端\n target.row = targetCellRange.start.row;\n }\n }\n return target;\n}\n"]}
package/dist/vtable.js CHANGED
@@ -61240,8 +61240,10 @@
61240
61240
  }
61241
61241
  const layoutMap = table.internalProps.layoutMap;
61242
61242
  if (layoutMap.rowHierarchyType === 'tree') {
61243
- const sourceRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(source.col, source.row).rowHeaderPaths;
61244
- const targetRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(target.col, target.row).rowHeaderPaths;
61243
+ const sourceRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(source.col, source.row)
61244
+ .rowHeaderPaths;
61245
+ const targetRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(target.col, target.row)
61246
+ .rowHeaderPaths;
61245
61247
  if (sourceRowHeaderPaths.length <= targetRowHeaderPaths.length) {
61246
61248
  const targetPathNode = targetRowHeaderPaths[sourceRowHeaderPaths.length - 1];
61247
61249
  if (targetPathNode) {
@@ -66821,7 +66823,7 @@
66821
66823
  return TABLE_EVENT_TYPE;
66822
66824
  }
66823
66825
  options;
66824
- version = "0.17.4";
66826
+ version = "0.17.5-alpha.1";
66825
66827
  pagination;
66826
66828
  id = `VTable${Date.now()}`;
66827
66829
  headerStyleCache;
@@ -72833,7 +72835,7 @@
72833
72835
  const headerPaths = {
72834
72836
  colHeaderPaths: [],
72835
72837
  rowHeaderPaths: [],
72836
- cellLocation: this.getCellLocation(col, row)
72838
+ cellLocation: headerPathsWidthNode.cellLocation
72837
72839
  };
72838
72840
  headerPathsWidthNode.colHeaderPaths?.forEach((colHeader) => {
72839
72841
  const colHeaderPath = {};
@@ -76008,6 +76010,11 @@
76008
76010
  const layoutMap = this.internalProps.layoutMap;
76009
76011
  return layoutMap.getLayoutRowTreeCount();
76010
76012
  }
76013
+ getCellHeaderTreeNodes(col, row) {
76014
+ const layoutMap = this.internalProps.layoutMap;
76015
+ const headerNodes = layoutMap.getCellHeaderPathsWidthTreeNode(col, row);
76016
+ return headerNodes;
76017
+ }
76011
76018
  _hasHierarchyTreeHeader() {
76012
76019
  return this.internalProps.layoutMap.rowHierarchyType === 'tree';
76013
76020
  }
@@ -77519,7 +77526,7 @@
77519
77526
  return new Tag$1(params ? params.attribute : {});
77520
77527
  }
77521
77528
 
77522
- const version = "0.17.4";
77529
+ const version = "0.17.5-alpha.1";
77523
77530
  function getIcons() {
77524
77531
  return get$2();
77525
77532
  }