umy-ui-table 1.2.2 → 1.2.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umy-ui-table",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "一个基于 vue 的 PC 端表格UI库,解决万级数据渲染卡顿问题,过万数据点击全选卡顿,等等问题",
5
5
  "author": {
6
6
  "name": "foriacus"
@@ -24,6 +24,8 @@ export default {
24
24
  return { enabled: true, gt: 24, oSize: 0 };
25
25
  },
26
26
  }, // 横向虚拟滚动配置(列数超过 gt 时启用)
27
+ virtualYConfig: Object, // vxe3 新接口:纵向虚拟滚动(优先于 scrollY)
28
+ virtualXConfig: Object, // vxe3 新接口:横向虚拟滚动(优先于 scrollX)
27
29
  widthResize: Boolean,
28
30
  mergeCells: Array,
29
31
  validConfig: Object, // 校验配置项
@@ -51,6 +53,7 @@ export default {
51
53
  columnKey: Boolean, // 是否需要为每一列的 VNode 设置 key 属性(非特殊情况下不需要使用, 常用于拖拽列)
52
54
  rowId: String, // 自定义行数据唯一主键的字段名(行数据必须要有唯一主键,默认自动生成)
53
55
  highlightCurrentRow: { default: true, type: Boolean }, // 是否要高亮当前行
56
+ highlightHoverRow: { default: true, type: Boolean }, // 鼠标移到行是否要高亮显示
54
57
  showAmend: { default: false, type: Boolean }, // 是否显示修改字段名按钮(侧滑框)
55
58
  amendBtnIcon: { default: "", type: String }, // 修改字段按钮的图标(侧滑框)
56
59
  fieldTitle: { default: "选择显示字段", type: String }, // 弹框的标题(侧滑框)
@@ -691,10 +694,6 @@ export default {
691
694
  keydown({ $event }) {
692
695
  this.$emit("keydown", { $event });
693
696
  },
694
- // 当前被激活的单元格
695
- editCurrentlyActive({ row, column, cell }) {
696
- this.$emit("edit-currently-active", { row, column, cell });
697
- },
698
697
  // vxe 首次加载完数据并渲染完成后触发(此时列信息已构建完,DOM 稳定,可安全绑定第三方拖拽等)
699
698
  initRendered(params) {
700
699
  this.$emit("init-rendered", params);
@@ -21,7 +21,8 @@
21
21
  :border="beautifyTable ? false : border"
22
22
  :scroll-y="scrollYConfig"
23
23
  :scroll-x="scrollXConfig"
24
- context-menu
24
+ :virtual-y-config="computedVirtualYConfig"
25
+ :virtual-x-config="computedVirtualXConfig"
25
26
  :stripe="stripe"
26
27
  :row-key="rowKey"
27
28
  :column-key="columnKey"
@@ -42,7 +43,7 @@
42
43
  :show-header-overflow="showHeaderOverflow"
43
44
  :show-footer-overflow="showFooterOverflow"
44
45
  :highlight-current-row="highlightCurrentRow"
45
- :highlight-hover-row="highlightCurrentRow"
46
+ :highlight-hover-row="highlightHoverRow"
46
47
  :row-class-name="rowClassName"
47
48
  :cell-class-name="cellClassName"
48
49
  :header-row-class-name="headerRowClassName"
@@ -72,7 +73,6 @@
72
73
  @toggle-tree-expand="toggleTreeExpandEv"
73
74
  @toggle-row-expand="expChang"
74
75
  @keydown="keydown"
75
- @edit-currently-active="editCurrentlyActive"
76
76
  @scroll="tableBodyScroll"
77
77
  @init-rendered="initRendered"
78
78
  @data-rendered="dataRendered"
@@ -199,6 +199,29 @@ export default {
199
199
  }
200
200
  return this.scrollX;
201
201
  },
202
+ // vxe3 新接口:优先使用 virtualYConfig/virtualXConfig,不存在时回退到兼容 scrollY/scrollX
203
+ computedVirtualYConfig() {
204
+ if (this.virtualYConfig) return this.virtualYConfig;
205
+ const propsData = this.$options.propsData || {};
206
+ if (
207
+ this.spanMethod &&
208
+ !(propsData.virtualYConfig && propsData.virtualYConfig.enabled !== undefined)
209
+ ) {
210
+ return Object.assign({}, this.scrollY, { enabled: false });
211
+ }
212
+ return this.scrollY;
213
+ },
214
+ computedVirtualXConfig() {
215
+ if (this.virtualXConfig) return this.virtualXConfig;
216
+ const propsData = this.$options.propsData || {};
217
+ if (
218
+ this.spanMethod &&
219
+ !(propsData.virtualXConfig && propsData.virtualXConfig.enabled !== undefined)
220
+ ) {
221
+ return Object.assign({}, this.scrollX, { enabled: false });
222
+ }
223
+ return this.scrollX;
224
+ },
202
225
  plTableHeight() {
203
226
  if (this.height) {
204
227
  return {
@@ -281,7 +304,7 @@ export default {
281
304
  const { propsData = {}, children } = vnode.componentOptions;
282
305
  const scopedSlots = (vnode.data && vnode.data.scopedSlots) || {};
283
306
  const column = Object.assign({}, propsData);
284
- const slotKeys = Object.keys(scopedSlots);
307
+ const slotKeys = Object.keys(scopedSlots).filter((k) => k.charAt(0) !== "$"); // 过滤 Vue 2 内部标记 $stable 等
285
308
  if (slotKeys.length) {
286
309
  column.slots = {};
287
310
  slotKeys.forEach((key) => {