@deot/vc 1.0.66 → 1.0.67

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.
@@ -115262,7 +115262,7 @@ ${r}
115262
115262
  const onSuccess = async (request) => {
115263
115263
  try {
115264
115264
  let response = await onResponse(request, options) || request;
115265
- if (response === request) {
115265
+ if (request && response === request) {
115266
115266
  const text = request.responseType ? request.responseText : request.response;
115267
115267
  try {
115268
115268
  response = JSON.parse(text);
@@ -115297,6 +115297,10 @@ ${r}
115297
115297
  }
115298
115298
  emit("file-start", vFile, $mode);
115299
115299
  options = await onRequest(options, instance) || options;
115300
+ if (typeof options.url === "undefined") {
115301
+ onSuccess();
115302
+ return;
115303
+ }
115300
115304
  const xhr = new XMLHttpRequest();
115301
115305
  xhr.open("POST", options.url);
115302
115306
  options.timeout && (xhr.timeout = options.timeout);
@@ -120374,6 +120378,7 @@ ${r}
120374
120378
  });
120375
120379
  expose({
120376
120380
  recycleListId: getUid("recycle-list"),
120381
+ scroller,
120377
120382
  store,
120378
120383
  hasPlaceholder,
120379
120384
  renderer,
@@ -121206,8 +121211,6 @@ ${r}
121206
121211
  scrollX: false,
121207
121212
  scrollY: false,
121208
121213
  bodyWidth: null,
121209
- leftFixedWidth: null,
121210
- rightFixedWidth: null,
121211
121214
  tableHeight: null,
121212
121215
  headerHeight: 44,
121213
121216
  appendHeight: 0,
@@ -121302,22 +121305,42 @@ ${r}
121302
121305
  this.states.scrollX = bodyMinWidth > bodyWidth;
121303
121306
  this.states.bodyWidth = bodyMinWidth;
121304
121307
  }
121305
- const leftFixedColumns = this.store.states.leftFixedColumns;
121306
- if (leftFixedColumns.length > 0) {
121307
- let leftFixedWidth = 0;
121308
- leftFixedColumns.forEach(function(column) {
121309
- leftFixedWidth += column.realWidth || column.width;
121310
- });
121311
- this.states.leftFixedWidth = leftFixedWidth;
121312
- }
121313
- const rightFixedColumns = this.store.states.rightFixedColumns;
121314
- if (rightFixedColumns.length > 0) {
121315
- let rightFixedWidth = 0;
121316
- rightFixedColumns.forEach(function(column) {
121317
- rightFixedWidth += column.realWidth || column.width;
121318
- });
121319
- this.states.rightFixedWidth = rightFixedWidth;
121320
- }
121308
+ this.syncStickyOffsets();
121309
+ }
121310
+ /**
121311
+ * 提前计算固定列的 sticky 偏移并写到列对象上(包含分组列),渲染层(header /
121312
+ * body-row / footer)从 column.stickyLeft / column.stickyRight 直接消费即可。
121313
+ * 非固定列上的 sticky 信息一并清除,避免列从 fixed 切换为非 fixed 时残留。
121314
+ */
121315
+ syncStickyOffsets() {
121316
+ const { leftFixedColumns = [], rightFixedColumns = [], notFixedColumns = [] } = this.store.states;
121317
+ leftFixedColumns.reduce((offset, column, index) => {
121318
+ column.stickyOffset = offset;
121319
+ column.stickyStyle = {
121320
+ position: "sticky",
121321
+ left: `${offset}px`
121322
+ };
121323
+ column.stickyClass = "is-fixed-left";
121324
+ if (index === leftFixedColumns.length - 1) column.stickyClass += " is-fixed-left-tail";
121325
+ offset += column.realWidth || column.width || 0;
121326
+ return offset;
121327
+ }, 0);
121328
+ rightFixedColumns.reduceRight((offset, column, index) => {
121329
+ column.stickyOffset = offset;
121330
+ column.stickyStyle = {
121331
+ position: "sticky",
121332
+ right: `${offset}px`
121333
+ };
121334
+ column.stickyClass = "is-fixed-right";
121335
+ if (index === rightFixedColumns.length - 1) column.stickyClass += " is-fixed-right-head";
121336
+ offset += column.realWidth || column.width || 0;
121337
+ return offset;
121338
+ }, 0);
121339
+ notFixedColumns.forEach((column) => {
121340
+ delete column.stickyOffset;
121341
+ delete column.stickyStyle;
121342
+ delete column.stickyClass;
121343
+ });
121321
121344
  }
121322
121345
  };
121323
121346
  var Store$1 = class extends BaseWatcher {
@@ -121361,16 +121384,10 @@ ${r}
121361
121384
  });
121362
121385
  });
121363
121386
  this.states.list = data.reduce((pre, row, index) => {
121364
- const cache = caches.get(row) || { heightMap: {} };
121365
121387
  const rows = [{
121366
121388
  index,
121367
121389
  data: row,
121368
- height: cache.height || "",
121369
- heightMap: {
121370
- left: cache.heightMap.left || "",
121371
- main: cache.heightMap.main || "",
121372
- right: cache.heightMap.right || ""
121373
- }
121390
+ height: (caches.get(row) || {}).height || ""
121374
121391
  }];
121375
121392
  const id = primaryKey ? rows.map((rowData) => getRowValue(rowData.data, primaryKey)).join(",") : index;
121376
121393
  pre.push({
@@ -121747,11 +121764,7 @@ ${r}
121747
121764
  type: Number,
121748
121765
  required: true
121749
121766
  },
121750
- height: { type: [Number, String] },
121751
- columnsHidden: {
121752
- type: Array,
121753
- required: true
121754
- }
121767
+ height: { type: [Number, String] }
121755
121768
  },
121756
121769
  setup(props) {
121757
121770
  const table = (0, vue.inject)("vc-table");
@@ -121789,8 +121802,11 @@ ${r}
121789
121802
  };
121790
121803
  };
121791
121804
  const getCellClass = (rowIndex, columnIndex, row, column) => {
121792
- const classes = [column.realAlign, column.class];
121793
- if (props.columnsHidden[columnIndex]) classes.push("is-hidden");
121805
+ const classes = [
121806
+ column.realAlign,
121807
+ column.class,
121808
+ column.stickyClass
121809
+ ];
121794
121810
  const cellClass = table.props.cellClass;
121795
121811
  if (typeof cellClass === "string") classes.push(cellClass);
121796
121812
  else if (typeof cellClass === "function") classes.push(cellClass.call(null, {
@@ -121893,13 +121909,13 @@ ${r}
121893
121909
  width: `${realWidth}px`,
121894
121910
  height: `${props.height ? `${props.height}px` : "auto"}`
121895
121911
  };
121896
- if (props.columnsHidden[columnIndex]) return (0, vue.createVNode)("div", {
121897
- "key": column.id,
121898
- "style": [sizeStyle]
121899
- }, null);
121900
121912
  return (0, vue.createVNode)("div", {
121901
121913
  "key": column.id,
121902
- "style": [getCellStyle(props.index, columnIndex, props.data, column), sizeStyle],
121914
+ "style": [
121915
+ getCellStyle(props.index, columnIndex, props.data, column),
121916
+ sizeStyle,
121917
+ column.stickyStyle
121918
+ ],
121903
121919
  "class": [getCellClass(props.index, columnIndex, props.data, column), "vc-table__td"],
121904
121920
  "onMouseenter": (e) => handleCellMouseEnter(e, props.data, column),
121905
121921
  "onMouseleave": (e) => handleCellMouseLeave(e, props.data, column)
@@ -121919,16 +121935,10 @@ ${r}
121919
121935
  });
121920
121936
  var TableBodyMergeRow = /* @__PURE__ */ (0, vue.defineComponent)({
121921
121937
  name: "vc-table-body-merge-row",
121922
- props: {
121923
- store: {
121924
- type: Object,
121925
- required: true
121926
- },
121927
- columnsHidden: {
121928
- type: Array,
121929
- required: true
121930
- }
121931
- },
121938
+ props: { store: {
121939
+ type: Object,
121940
+ required: true
121941
+ } },
121932
121942
  setup(props) {
121933
121943
  const table = (0, vue.inject)("vc-table");
121934
121944
  const getValueOfRow = (row, index) => {
@@ -121942,8 +121952,7 @@ ${r}
121942
121952
  "key": getValueOfRow(row, row.index),
121943
121953
  "data": row.data,
121944
121954
  "index": row.index,
121945
- "height": table.props.rowHeight || row.height,
121946
- "columnsHidden": props.columnsHidden
121955
+ "height": table.props.rowHeight || row.height
121947
121956
  }, null);
121948
121957
  })]);
121949
121958
  };
@@ -121954,40 +121963,22 @@ ${r}
121954
121963
  }
121955
121964
  var TableBody = /* @__PURE__ */ (0, vue.defineComponent)({
121956
121965
  name: "vc-table-body",
121957
- props: {
121958
- fixed: String,
121959
- heightStyle: [
121960
- Object,
121961
- Array,
121962
- String
121963
- ]
121964
- },
121966
+ props: { heightStyle: [
121967
+ Object,
121968
+ Array,
121969
+ String
121970
+ ] },
121965
121971
  emits: ["scroll"],
121966
- setup(props, { emit, expose }) {
121972
+ setup(props, { emit, expose, slots }) {
121967
121973
  const instance = (0, vue.getCurrentInstance)();
121968
121974
  const table = (0, vue.inject)("vc-table");
121969
121975
  const allowRender = (0, vue.ref)(false);
121970
121976
  const states = useStates({
121971
121977
  data: "data",
121972
121978
  list: "list",
121973
- columns: "columns",
121974
- leftFixedLeafCount: "leftFixedLeafColumnsLength",
121975
- rightFixedLeafCount: "rightFixedLeafColumnsLength",
121976
- columnsCount: (states$) => states$.columns.length,
121977
- leftFixedCount: (states$) => states$.leftFixedColumns.length,
121978
- rightFixedCount: (states$) => states$.rightFixedColumns.length,
121979
- hasExpandColumn: (states$) => states$.columns.some(({ type }) => type === "expand"),
121980
- firstDefaultColumnIndex: (states$) => states$.columns.findIndex(({ type }) => type === "default")
121981
- });
121982
- const isColumnHidden = (index) => {
121983
- if (props.fixed === "left") return index >= states.leftFixedLeafCount;
121984
- else if (props.fixed === "right") return index < states.columnsCount - states.rightFixedLeafCount;
121985
- else return index < states.leftFixedLeafCount || index >= states.columnsCount - states.rightFixedLeafCount;
121986
- };
121987
- const columnsHidden = (0, vue.computed)(() => {
121988
- return states.columns.map((_, index) => isColumnHidden(index));
121989
- });
121990
- const wrapper = (0, vue.ref)();
121979
+ columns: "columns"
121980
+ });
121981
+ const target = (0, vue.ref)();
121991
121982
  (0, vue.watch)(() => table.store.states.hoverRowIndex, (v, oldV) => {
121992
121983
  if (!table.store.states.isComplex || IS_SERVER$3) return;
121993
121984
  raf(() => {
@@ -122001,37 +121992,29 @@ ${r}
122001
121992
  if (table.props.rowHeight) return;
122002
121993
  changes.forEach((v) => {
122003
121994
  states.list[v.index].rows.forEach((row) => {
122004
- if (row.heightMap[props.fixed || "main"] === v.size) return;
122005
- row.heightMap[props.fixed || "main"] = v.size;
122006
- const heights = [row.heightMap.main];
122007
- if (states.leftFixedCount) heights.push(row.heightMap.left);
122008
- if (states.rightFixedCount) heights.push(row.heightMap.right);
122009
- if (heights.every((i) => !!i)) row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || "";
121995
+ if (row.height === v.size) return;
121996
+ row.height = v.size || "";
122010
121997
  });
122011
121998
  });
122012
121999
  };
122013
- expose({
122014
- wrapper,
122015
- getRootElement: () => instance.vnode.el
122016
- });
122000
+ expose({ target });
122017
122001
  const layout = table.layout;
122018
122002
  const scrollerOptions = (0, vue.computed)(() => ({
122019
122003
  barTo: `.${table.tableId}`,
122020
122004
  native: false,
122021
122005
  always: false,
122022
- showBar: !props.fixed,
122023
- stopPropagation: !props.fixed,
122006
+ showBar: true,
122007
+ stopPropagation: true,
122008
+ contentClass: "vc-table__tbody",
122009
+ contentStyle: { width: layout.states.bodyWidth ? layout.states.bodyWidth + "px" : "" },
122024
122010
  trackOffsetY: [
122025
122011
  layout.states.headerHeight,
122026
122012
  0,
122027
- -layout.states.headerHeight - layout.states.footerHeight + 2,
122013
+ -layout.states.headerHeight,
122028
122014
  0
122029
122015
  ]
122030
122016
  }));
122031
- const renderers = { default: ({ row }) => (0, vue.createVNode)(TableBodyMergeRow, {
122032
- "store": row,
122033
- "columnsHidden": columnsHidden.value
122034
- }, null) };
122017
+ const renderers = { default: ({ row }) => (0, vue.createVNode)(TableBodyMergeRow, { "store": row }, null) };
122035
122018
  let timer;
122036
122019
  (0, vue.onBeforeMount)(() => {
122037
122020
  if (table.props.delay) timer = setTimeout(() => allowRender.value = true, table.props.delay);
@@ -122043,20 +122026,26 @@ ${r}
122043
122026
  });
122044
122027
  return () => {
122045
122028
  if (!allowRender.value) return;
122046
- return (0, vue.createVNode)("div", { "class": "vc-table__body" }, [table.props.height ? (0, vue.createVNode)(RecycleList, {
122047
- "ref": wrapper,
122029
+ if (table.props.height) return (0, vue.createVNode)("div", { "class": ["vc-table__body-wrapper"] }, [(0, vue.createVNode)(RecycleList, {
122030
+ "ref": target,
122048
122031
  "data": states.list,
122049
122032
  "disabled": true,
122050
- "class": "vc-table__tbody",
122051
122033
  "scrollerOptions": scrollerOptions.value,
122052
122034
  "pageSize": table.props.rows,
122053
122035
  "onScroll": (e) => emit("scroll", e),
122054
122036
  "onRowResize": handleMergeRowResize,
122055
122037
  "style": props.heightStyle
122056
- }, _isSlot(renderers) ? renderers : { default: () => [renderers] }) : (0, vue.createVNode)(NormalList, {
122038
+ }, _isSlot(renderers) ? renderers : { default: () => [renderers] }), slots.default?.()]);
122039
+ return (0, vue.createVNode)(ScrollerWheel, (0, vue.mergeProps)({
122040
+ "ref": target,
122041
+ "class": "vc-table__body-wrapper"
122042
+ }, scrollerOptions.value, {
122043
+ "style": props.heightStyle,
122044
+ "onScroll": (e) => emit("scroll", e)
122045
+ }), { default: () => [(0, vue.createVNode)(NormalList, {
122057
122046
  "data": states.list,
122058
122047
  "onRowResize": handleMergeRowResize
122059
- }, _isSlot(renderers) ? renderers : { default: () => [renderers] })]);
122048
+ }, _isSlot(renderers) ? renderers : { default: () => [renderers] }), slots.default?.()] });
122060
122049
  };
122061
122050
  }
122062
122051
  });
@@ -122083,7 +122072,6 @@ ${r}
122083
122072
  var TableHeader = /* @__PURE__ */ (0, vue.defineComponent)({
122084
122073
  name: "vc-table-header",
122085
122074
  props: {
122086
- fixed: [Boolean, String],
122087
122075
  border: Boolean,
122088
122076
  sort: {
122089
122077
  type: Object,
@@ -122110,24 +122098,8 @@ ${r}
122110
122098
  const states = useStates({
122111
122099
  columns: "columns",
122112
122100
  isAllSelected: "isAllSelected",
122113
- leftFixedLeafCount: "leftFixedLeafColumnsLength",
122114
- rightFixedLeafCount: "rightFixedLeafColumnsLength",
122115
122101
  isGroup: "isGroup",
122116
- headerRows: "headerRows",
122117
- columnsCount: ($states) => $states.columns.length,
122118
- leftFixedCount: ($states) => $states.leftFixedColumns.length,
122119
- rightFixedCount: ($states) => $states.rightFixedColumns.length
122120
- });
122121
- const isColumnHidden = (index) => {
122122
- let start = 0;
122123
- for (let i = 0; i < index; i++) start += states.columns[i].colSpan;
122124
- const after = start + states.columns[index].colSpan - 1;
122125
- if (props.fixed === true || props.fixed === "left") return after >= states.leftFixedLeafCount;
122126
- else if (props.fixed === "right") return start < states.columnsCount - states.rightFixedLeafCount;
122127
- else return after < states.leftFixedLeafCount || start >= states.columnsCount - states.rightFixedLeafCount;
122128
- };
122129
- const columnsHidden = (0, vue.computed)(() => {
122130
- return states.columns.map((_, index) => isColumnHidden(index));
122102
+ headerRows: "headerRows"
122131
122103
  });
122132
122104
  const getHeaderRowStyle = (rowIndex) => {
122133
122105
  const { headerRowStyle } = table.props;
@@ -122162,7 +122134,6 @@ ${r}
122162
122134
  column.class,
122163
122135
  column.labelClass
122164
122136
  ];
122165
- if (rowIndex === 0 && columnsHidden.value[columnIndex]) classes.push("is-hidden");
122166
122137
  if (!column.children) classes.push("is-leaf");
122167
122138
  const { headerCellClass } = table.props;
122168
122139
  if (typeof headerCellClass === "string") classes.push(headerCellClass);
@@ -122282,50 +122253,56 @@ ${r}
122282
122253
  return (0, vue.createVNode)("div", { "class": "vc-table__header" }, [(0, vue.createVNode)("div", { "class": [{ "is-group": states.isGroup }, "vc-table__thead"] }, [states.headerRows.map((columns, rowIndex) => (0, vue.createVNode)("div", {
122283
122254
  "style": getHeaderRowStyle(rowIndex),
122284
122255
  "class": [getHeaderRowClass(rowIndex), "vc-table__tr"]
122285
- }, [columns.map((column, columnIndex) => (0, vue.createVNode)("div", {
122286
- "onMousemove": (e) => handleMouseMove(e, column),
122287
- "onMouseout": handleMouseOut,
122288
- "onMousedown": (e) => handleMouseDown(e, column),
122289
- "onClick": (e) => handleHeaderClick(e, column),
122290
- "onContextmenu": (e) => handleHeaderContextMenu(e, column),
122291
- "style": [getHeaderCellStyle(rowIndex, columnIndex, columns, column), { width: `${column.realWidth}px` }],
122292
- "class": [
122293
- getHeaderCellClass(rowIndex, columnIndex, columns, column),
122294
- column.resizable && dragLineClass.value,
122295
- "vc-table__th"
122296
- ],
122297
- "key": column.id
122298
- }, [(0, vue.createVNode)("div", { "class": ["vc-table__cell", column.labelClass] }, [
122299
- column.renderHeader ? column.renderHeader({
122300
- column,
122301
- columnIndex,
122302
- store: table.store
122303
- }) : column.label,
122304
- column.tooltip ? (0, vue.createVNode)(Icon, {
122305
- "type": "o-info",
122306
- "class": "vc-table__tooltip",
122307
- "onMouseenter": (e) => handleCellMouseEnter(e, column)
122308
- }, null) : null,
122309
- column.sortable ? (0, vue.createVNode)(TableSort, {
122310
- "order": column.prop === props.sort.prop ? props.sort.order : "",
122311
- "onClick": (order) => handleSort(column.prop, order)
122312
- }, null) : null,
122313
- column.filters ? (0, vue.createVNode)(TableFilter, {
122314
- "data": column.filters,
122315
- "value": column.filteredValue,
122316
- "icon": column.filterIcon,
122317
- "portalClass": column.filterPopupClass,
122318
- "multiple": column.filterMultiple,
122319
- "onChange": (v) => handleFilter(column, v)
122320
- }, null) : null
122321
- ])]))]))])]);
122256
+ }, [columns.map((column, columnIndex) => {
122257
+ return (0, vue.createVNode)("div", {
122258
+ "onMousemove": (e) => handleMouseMove(e, column),
122259
+ "onMouseout": handleMouseOut,
122260
+ "onMousedown": (e) => handleMouseDown(e, column),
122261
+ "onClick": (e) => handleHeaderClick(e, column),
122262
+ "onContextmenu": (e) => handleHeaderContextMenu(e, column),
122263
+ "style": [
122264
+ getHeaderCellStyle(rowIndex, columnIndex, columns, column),
122265
+ { width: `${column.realWidth}px` },
122266
+ column.stickyStyle
122267
+ ],
122268
+ "class": [
122269
+ getHeaderCellClass(rowIndex, columnIndex, columns, column),
122270
+ column.resizable && dragLineClass.value,
122271
+ column.stickyClass,
122272
+ "vc-table__th"
122273
+ ],
122274
+ "key": column.id
122275
+ }, [(0, vue.createVNode)("div", { "class": ["vc-table__cell", column.labelClass] }, [
122276
+ column.renderHeader ? column.renderHeader({
122277
+ column,
122278
+ columnIndex,
122279
+ store: table.store
122280
+ }) : column.label,
122281
+ column.tooltip ? (0, vue.createVNode)(Icon, {
122282
+ "type": "o-info",
122283
+ "class": "vc-table__tooltip",
122284
+ "onMouseenter": (e) => handleCellMouseEnter(e, column)
122285
+ }, null) : null,
122286
+ column.sortable ? (0, vue.createVNode)(TableSort, {
122287
+ "order": column.prop === props.sort.prop ? props.sort.order : "",
122288
+ "onClick": (order) => handleSort(column.prop, order)
122289
+ }, null) : null,
122290
+ column.filters ? (0, vue.createVNode)(TableFilter, {
122291
+ "data": column.filters,
122292
+ "value": column.filteredValue,
122293
+ "icon": column.filterIcon,
122294
+ "portalClass": column.filterPopupClass,
122295
+ "multiple": column.filterMultiple,
122296
+ "onChange": (v) => handleFilter(column, v)
122297
+ }, null) : null
122298
+ ])]);
122299
+ })]))])]);
122322
122300
  };
122323
122301
  }
122324
122302
  });
122325
122303
  var TableFooter = /* @__PURE__ */ (0, vue.defineComponent)({
122326
122304
  name: "vc-table-footer",
122327
122305
  props: {
122328
- fixed: [String, Boolean],
122329
122306
  getSummary: Function,
122330
122307
  sumText: String,
122331
122308
  border: Boolean
@@ -122334,27 +122311,13 @@ ${r}
122334
122311
  const states = useStates({
122335
122312
  data: "data",
122336
122313
  columns: "columns",
122337
- isAllSelected: "isAllSelected",
122338
- leftFixedLeafCount: "leftFixedLeafColumnsLength",
122339
- rightFixedLeafCount: "rightFixedLeafColumnsLength",
122340
- columnsCount: ($states) => $states.columns.length,
122341
- leftFixedCount: ($states) => $states.leftFixedColumns.length,
122342
- rightFixedCount: ($states) => $states.rightFixedColumns.length
122343
- });
122344
- const isColumnHidden = (column, index) => {
122345
- if (props.fixed === true || props.fixed === "left") return index >= states.leftFixedLeafCount;
122346
- else if (props.fixed === "right") {
122347
- let before = 0;
122348
- for (let i = 0; i < index; i++) before += states.columns[i].colspan;
122349
- return before < states.columnsCount - states.rightFixedLeafCount;
122350
- } else if (!props.fixed && column.fixed) return true;
122351
- else return index < states.leftFixedCount || index >= states.columnsCount - states.rightFixedCount;
122352
- };
122353
- const columnsHidden = (0, vue.computed)(() => states.columns.map(isColumnHidden));
122354
- const getRowClasses = (column, columnIndex) => {
122314
+ isAllSelected: "isAllSelected"
122315
+ });
122316
+ const getRowClasses = (column) => {
122355
122317
  const classes = [column.realAlign, column.labelClass];
122356
122318
  if (column.className) classes.push(column.className);
122357
- if (columnsHidden.value[columnIndex]) classes.push("is-hidden");
122319
+ if (column.fixed === true || column.fixed === "left") classes.push("is-fixed-left");
122320
+ else if (column.fixed === "right") classes.push("is-fixed-right");
122358
122321
  if (!column.children) classes.push("is-leaf");
122359
122322
  return classes;
122360
122323
  };
@@ -122395,14 +122358,16 @@ ${r}
122395
122358
  "cellspacing": "0",
122396
122359
  "cellpadding": "0",
122397
122360
  "border": "0"
122398
- }, [(0, vue.createVNode)("div", { "class": "vc-table__tbody" }, [(0, vue.createVNode)("div", { "class": "vc-table__tr" }, [states.columns.map((column, columnIndex) => (0, vue.createVNode)("div", {
122399
- "key": columnIndex,
122400
- "class": [getRowClasses(column, columnIndex), "vc-table__td"],
122401
- "style": [{
122402
- width: `${column.realWidth}px`,
122403
- height: `44px`
122404
- }]
122405
- }, [(0, vue.createVNode)("div", { "class": ["vc-table__cell", column.labelClass] }, [sums.value[columnIndex]])]))])])]);
122361
+ }, [(0, vue.createVNode)("div", { "class": "vc-table__tbody" }, [(0, vue.createVNode)("div", { "class": "vc-table__tr" }, [states.columns.map((column, columnIndex) => {
122362
+ return (0, vue.createVNode)("div", {
122363
+ "key": columnIndex,
122364
+ "class": [getRowClasses(column), "vc-table__td"],
122365
+ "style": [{
122366
+ width: `${column.realWidth}px`,
122367
+ height: `44px`
122368
+ }, column.stickyStyle]
122369
+ }, [(0, vue.createVNode)("div", { "class": ["vc-table__cell", column.labelClass] }, [sums.value[columnIndex]])]);
122370
+ })])])]);
122406
122371
  };
122407
122372
  }
122408
122373
  });
@@ -122527,24 +122492,9 @@ ${r}
122527
122492
  const tableWrapper = (0, vue.ref)(null);
122528
122493
  const hiddenColumns = (0, vue.ref)(null);
122529
122494
  const headerWrapper = (0, vue.ref)(null);
122530
- const tableHeader = (0, vue.ref)(null);
122531
- const scroller = (0, vue.ref)(null);
122532
122495
  const body = (0, vue.ref)();
122533
- const emptyBlock = (0, vue.ref)(null);
122534
122496
  const appendWrapper = (0, vue.ref)(null);
122535
122497
  const footerWrapper = (0, vue.ref)(null);
122536
- const leftFixedWrapper = (0, vue.ref)(null);
122537
- const leftFixedHeaderWrapper = (0, vue.ref)(null);
122538
- const leftFixedTableHeader = (0, vue.ref)(null);
122539
- const leftFixedBodyWrapper = (0, vue.ref)(null);
122540
- const leftFixedBody = (0, vue.ref)(null);
122541
- const leftFixedFooterWrapper = (0, vue.ref)(null);
122542
- const rightFixedWrapper = (0, vue.ref)(null);
122543
- const rightFixedHeaderWrapper = (0, vue.ref)(null);
122544
- const rightFixedTableHeader = (0, vue.ref)(null);
122545
- const rightFixedBodyWrapper = (0, vue.ref)(null);
122546
- const rightFixedBody = (0, vue.ref)(null);
122547
- const rightFixedFooterWrapper = (0, vue.ref)(null);
122548
122498
  const resizeProxy = (0, vue.ref)(null);
122549
122499
  const scrollPosition = (0, vue.ref)("left");
122550
122500
  const hoverState = (0, vue.ref)(null);
@@ -122565,18 +122515,19 @@ ${r}
122565
122515
  "vc-table--fluid-height": props.maxHeight,
122566
122516
  "vc-table--scrollable-x": layout.states.scrollX,
122567
122517
  "vc-table--scrollable-y": layout.states.scrollY,
122518
+ "vc-table--sticky-columns": true,
122568
122519
  "vc-table--enable-row-hover": !store.states.isComplex,
122569
122520
  "vc-table--enable-row-transition": (store.states.data || []).length !== 0 && (store.states.data || []).length < 100
122570
122521
  };
122571
122522
  });
122523
+ const scroller = (0, vue.computed)(() => {
122524
+ return body.value?.target;
122525
+ });
122572
122526
  const bodyXWrapper = (0, vue.computed)(() => {
122527
+ if (props.height) return scroller.value.scroller.wrapper;
122573
122528
  return scroller.value?.wrapper;
122574
122529
  });
122575
- const bodyYWrapper = (0, vue.computed)(() => {
122576
- if (!props.height) return bodyXWrapper.value;
122577
- const root = body.value?.getRootElement?.();
122578
- return root ? root.querySelector(".vc-scroller__wrapper") : null;
122579
- });
122530
+ const bodyYWrapper = (0, vue.computed)(() => bodyXWrapper.value);
122580
122531
  const shouldUpdateHeight = (0, vue.computed)(() => {
122581
122532
  return props.height || props.maxHeight || states.leftFixedColumns.length > 0 || states.rightFixedColumns.length > 0;
122582
122533
  });
@@ -122593,18 +122544,6 @@ ${r}
122593
122544
  }
122594
122545
  return {};
122595
122546
  });
122596
- const fixedHeightStyle = (0, vue.computed)(() => {
122597
- if (props.maxHeight) {
122598
- if (props.showSummary) return { bottom: 0 };
122599
- return { bottom: layout.states.scrollX && props.data.length ? 0 : "" };
122600
- } else {
122601
- if (props.showSummary) return { height: layout.states.tableHeight ? layout.states.tableHeight + "px" : "" };
122602
- return {
122603
- height: layout.states.viewportHeight ? layout.states.viewportHeight + "px" : "",
122604
- bottom: 0
122605
- };
122606
- }
122607
- });
122608
122547
  let isUnMount = false;
122609
122548
  const updateScrollY = () => {
122610
122549
  if (isUnMount) return;
@@ -122637,7 +122576,7 @@ ${r}
122637
122576
  const clearSelection = () => {
122638
122577
  store.clearSelection();
122639
122578
  };
122640
- const handleScollX = () => {
122579
+ const handleScrollX = () => {
122641
122580
  if (!bodyXWrapper.value) return;
122642
122581
  const { scrollLeft, offsetWidth, scrollWidth } = bodyXWrapper.value;
122643
122582
  if (headerWrapper.value) headerWrapper.value.scrollLeft = scrollLeft;
@@ -122645,18 +122584,6 @@ ${r}
122645
122584
  if (scrollLeft >= scrollWidth - offsetWidth - 1) scrollPosition.value = "right";
122646
122585
  else if (scrollLeft === 0) scrollPosition.value = "left";
122647
122586
  else scrollPosition.value = "middle";
122648
- if (!props.height) {
122649
- leftFixedBody.value && (leftFixedBody.value.getRootElement().scrollTop = bodyXWrapper.value.scrollTop);
122650
- rightFixedBody.value && (rightFixedBody.value.getRootElement().scrollTop = bodyXWrapper.value.scrollTop);
122651
- }
122652
- };
122653
- const handleScollY = (e) => {
122654
- const v = {
122655
- x: e.target.scrollLeft,
122656
- y: e.target.scrollTop
122657
- };
122658
- rightFixedBody.value?.wrapper.scrollTo(v, true);
122659
- leftFixedBody.value?.wrapper.scrollTo(v, true);
122660
122587
  };
122661
122588
  const handleResize = () => {
122662
122589
  if (!isReady.value) return;
@@ -122680,22 +122607,17 @@ ${r}
122680
122607
  if (hoverState.value) hoverState.value = null;
122681
122608
  };
122682
122609
  const handleMousewheel = (deltaX, deltaY) => {
122683
- const { scrollWidth: contentW, clientWidth: wrapperW, scrollLeft: scrollX } = bodyXWrapper.value;
122684
- const { scrollHeight: contentH, clientHeight: wrapperH, scrollTop: scrollY } = bodyYWrapper.value;
122685
- if (Math.abs(deltaY) > Math.abs(deltaX) && contentH > wrapperH) if (props.height) body.value.wrapper?.scrollTo({ y: scrollY + deltaY });
122686
- else scroller.value.scrollTo({ y: scrollY + deltaY });
122610
+ if (!bodyXWrapper.value) return;
122611
+ const { scrollWidth: contentW, clientWidth: wrapperW, scrollLeft: scrollX, scrollHeight: contentH, clientHeight: wrapperH, scrollTop: scrollY } = bodyXWrapper.value;
122612
+ if (!scroller.value) return;
122613
+ if (Math.abs(deltaY) > Math.abs(deltaX) && contentH > wrapperH) scroller.value.scrollTo({ y: scrollY + deltaY });
122687
122614
  else if (deltaX && contentW > wrapperW) scroller.value.scrollTo({ x: scrollX + deltaX });
122688
122615
  };
122689
122616
  let wheels = [];
122690
122617
  const bindEvents = () => {
122691
122618
  if (props.fit) Resize.on(instance.vnode.el, handleResize);
122692
122619
  (0, vue.nextTick)(() => {
122693
- wheels = [
122694
- headerWrapper,
122695
- footerWrapper,
122696
- leftFixedWrapper,
122697
- rightFixedWrapper
122698
- ].map((wrapper) => {
122620
+ wheels = [headerWrapper, footerWrapper].map((wrapper) => {
122699
122621
  if (!wrapper.value) return;
122700
122622
  const wheel = new Wheel(wrapper.value, {
122701
122623
  shouldWheelX: (delta) => {
@@ -122742,8 +122664,9 @@ ${r}
122742
122664
  }, { immediate: true });
122743
122665
  (0, vue.watch)(() => scrollPosition.value, (v) => {
122744
122666
  raf(() => {
122667
+ const el = tableWrapper.value;
122668
+ if (!el) return;
122745
122669
  const className = `is-scrolling-${layout.states.scrollX ? v : "none"}`;
122746
- const el = bodyXWrapper.value;
122747
122670
  el && el.classList.replace(el.classList.item(el.classList.length - 1), className);
122748
122671
  });
122749
122672
  }, { immediate: true });
@@ -122799,7 +122722,7 @@ ${r}
122799
122722
  "class": [
122800
122723
  classes.value,
122801
122724
  tableId,
122802
- "vc-table"
122725
+ "vc-table is-scrolling-none"
122803
122726
  ],
122804
122727
  "onMouseleave": handleMouseLeave
122805
122728
  }, [
@@ -122811,42 +122734,22 @@ ${r}
122811
122734
  "ref": headerWrapper,
122812
122735
  "class": "vc-table__header-wrapper"
122813
122736
  }, [(0, vue.createVNode)(TableHeader, {
122814
- "ref": tableHeader,
122815
122737
  "border": props.border,
122816
122738
  "resizable": props.resizable,
122817
122739
  "sort": props.sort,
122818
122740
  "style": bodyWidthStyle.value
122819
122741
  }, null)]),
122820
- states.columns.length > 0 && (0, vue.createVNode)(ScrollerWheel, {
122821
- "ref": scroller,
122822
- "class": ["vc-table__body-wrapper is-scrolling-none"],
122823
- "barTo": `.${tableId}`,
122824
- "native": false,
122825
- "always": false,
122826
- "track-offset-y": [
122827
- layout.states.headerHeight,
122828
- 0,
122829
- -layout.states.headerHeight - layout.states.footerHeight,
122830
- 0
122831
- ],
122832
- "style": [bodyHeightStyle.value],
122833
- "onScroll": handleScollX
122834
- }, { default: () => [
122835
- (0, vue.createVNode)(TableBody, {
122836
- "ref": body,
122837
- "style": [bodyWidthStyle.value],
122838
- "height-style": [bodyHeightStyle.value],
122839
- "onScroll": handleScollY
122840
- }, null),
122841
- props.data.length === 0 && !props.height && (0, vue.createVNode)("div", {
122842
- "class": "vc-table__empty-placeholder",
122843
- "style": [bodyWidthStyle.value]
122844
- }, null),
122845
- slots.append && (0, vue.createVNode)("div", {
122846
- "ref": appendWrapper,
122847
- "class": "vc-table__append-wrapper"
122848
- }, [slots.append()])
122849
- ] }),
122742
+ states.columns.length > 0 && (0, vue.createVNode)(TableBody, {
122743
+ "ref": body,
122744
+ "height-style": [bodyHeightStyle.value],
122745
+ "onScroll": handleScrollX
122746
+ }, { default: () => [props.data.length === 0 && (0, vue.createVNode)("div", {
122747
+ "class": "vc-table__empty-placeholder",
122748
+ "style": [bodyWidthStyle.value]
122749
+ }, null), slots.append && (0, vue.createVNode)("div", {
122750
+ "ref": appendWrapper,
122751
+ "class": "vc-table__append-wrapper"
122752
+ }, [slots.append()])] }),
122850
122753
  props.showSummary && (0, vue.withDirectives)((0, vue.createVNode)("div", {
122851
122754
  "ref": footerWrapper,
122852
122755
  "class": "vc-table__footer-wrapper"
@@ -122856,88 +122759,7 @@ ${r}
122856
122759
  "get-summary": props.getSummary,
122857
122760
  "style": bodyWidthStyle.value
122858
122761
  }, null)]), [[vue.vShow, props.data && props.data.length > 0]]),
122859
- states.leftFixedColumns.length > 0 && states.columns.length > 0 && (0, vue.createVNode)("div", {
122860
- "ref": leftFixedWrapper,
122861
- "style": [{ width: layout.states.leftFixedWidth ? layout.states.leftFixedWidth + "px" : "" }, fixedHeightStyle.value],
122862
- "class": "vc-table__fixed"
122863
- }, [
122864
- props.showHeader && (0, vue.createVNode)("div", {
122865
- "ref": leftFixedHeaderWrapper,
122866
- "class": "vc-table__fixed-header-wrapper"
122867
- }, [(0, vue.createVNode)(TableHeader, {
122868
- "ref": leftFixedTableHeader,
122869
- "border": props.border,
122870
- "resizable": props.resizable,
122871
- "sort": props.sort,
122872
- "style": bodyWidthStyle.value,
122873
- "fixed": "left"
122874
- }, null)]),
122875
- (0, vue.createVNode)("div", {
122876
- "ref": leftFixedBodyWrapper,
122877
- "style": [{ top: layout.states.headerHeight + "px" }],
122878
- "class": "vc-table__fixed-body-wrapper"
122879
- }, [(0, vue.createVNode)(TableBody, {
122880
- "ref": leftFixedBody,
122881
- "style": [bodyWidthStyle.value, bodyHeightStyle.value],
122882
- "fixed": "left"
122883
- }, null), slots.append && (0, vue.createVNode)("div", {
122884
- "style": [{ height: layout.states.appendHeight + "px" }],
122885
- "class": "vc-table__append-gutter"
122886
- }, [slots.append()])]),
122887
- props.showSummary && (0, vue.withDirectives)((0, vue.createVNode)("div", {
122888
- "ref": leftFixedFooterWrapper,
122889
- "class": "vc-table__fixed-footer-wrapper"
122890
- }, [(0, vue.createVNode)(TableFooter, {
122891
- "border": props.border,
122892
- "sum-text": props.sumText || "合计",
122893
- "get-summary": props.getSummary,
122894
- "style": bodyWidthStyle.value,
122895
- "fixed": "left"
122896
- }, null)]), [[vue.vShow, props.data && props.data.length > 0]])
122897
- ]),
122898
- states.rightFixedColumns.length > 0 && (0, vue.createVNode)("div", {
122899
- "ref": rightFixedWrapper,
122900
- "style": [{ width: layout.states.rightFixedWidth ? layout.states.rightFixedWidth + "px" : "" }, fixedHeightStyle.value],
122901
- "class": "vc-table__fixed-right"
122902
- }, [
122903
- props.showHeader && (0, vue.createVNode)("div", {
122904
- "ref": rightFixedHeaderWrapper,
122905
- "class": "vc-table__fixed-header-wrapper"
122906
- }, [(0, vue.createVNode)(TableHeader, {
122907
- "ref": rightFixedTableHeader,
122908
- "border": props.border,
122909
- "resizable": props.resizable,
122910
- "sort": props.sort,
122911
- "style": bodyWidthStyle.value,
122912
- "fixed": "right"
122913
- }, null)]),
122914
- (0, vue.createVNode)("div", {
122915
- "ref": rightFixedBodyWrapper,
122916
- "style": [{ top: layout.states.headerHeight + "px" }],
122917
- "class": "vc-table__fixed-body-wrapper"
122918
- }, [(0, vue.createVNode)(TableBody, {
122919
- "ref": rightFixedBody,
122920
- "style": [bodyWidthStyle.value, bodyHeightStyle.value],
122921
- "fixed": "right"
122922
- }, null), slots.append && (0, vue.createVNode)("div", {
122923
- "style": [{ height: layout.states.appendHeight + "px" }],
122924
- "class": "vc-table__append-gutter"
122925
- }, [slots.append()])]),
122926
- props.showSummary && (0, vue.withDirectives)((0, vue.createVNode)("div", {
122927
- "ref": rightFixedFooterWrapper,
122928
- "class": "vc-table__fixed-footer-wrapper"
122929
- }, [(0, vue.createVNode)(TableFooter, {
122930
- "border": props.border,
122931
- "sum-text": props.sumText || "合计",
122932
- "get-summary": props.getSummary,
122933
- "style": bodyWidthStyle.value,
122934
- "fixed": "right"
122935
- }, null)]), [[vue.vShow, props.data && props.data.length > 0]])
122936
- ]),
122937
- props.data.length === 0 && (0, vue.createVNode)("div", {
122938
- "ref": emptyBlock,
122939
- "class": [{ "has-height": !!props.height }, "vc-table__empty-wrapper"]
122940
- }, [slots.empty ? slots.empty() : (0, vue.createVNode)("span", { "class": "vc-table__empty-text" }, [props.emptyText || "暂无数据"])]),
122762
+ props.data.length === 0 && (0, vue.createVNode)("div", { "class": [{ "has-height": !!props.height }, "vc-table__empty-wrapper"] }, [slots.empty ? slots.empty() : (0, vue.createVNode)("span", { "class": "vc-table__empty-text" }, [props.emptyText || "暂无数据"])]),
122941
122763
  (0, vue.withDirectives)((0, vue.createVNode)("div", {
122942
122764
  "ref": resizeProxy,
122943
122765
  "class": "vc-table__column-resize-proxy"