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