@deot/vc 1.0.11 → 1.0.12

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.
@@ -31721,6 +31721,7 @@
31721
31721
  isVisible.value = cursorDown.value;
31722
31722
  };
31723
31723
  const refreshThumb = () => raf(() => {
31724
+ if (!thumb.value) return;
31724
31725
  thumb.value.style[prefixStyle("transform").camel] = `translate${barOptions.value.axis}(${thumbMove.value}px)`;
31725
31726
  });
31726
31727
  const refreshThrottleThumb = throttle$2(refreshThumb, 10);
@@ -36513,6 +36514,7 @@
36513
36514
  columnFillSize.value = sizes.map((i) => contentMaxSize.value - i);
36514
36515
  };
36515
36516
  const setFirstItemIndex = () => {
36517
+ if (!wrapper.value) return;
36516
36518
  const position = wrapper.value[K.scrollAxis];
36517
36519
  let item;
36518
36520
  for (let i = 0; i < rebuildData.value.length; i++) {
@@ -36677,6 +36679,7 @@
36677
36679
  await refreshLayout(0, rebuildData.value.length);
36678
36680
  };
36679
36681
  const handleResize = throttle$1(async () => {
36682
+ if (!wrapper.value) return;
36680
36683
  const isNeedRefreshLayout = rebuildData.value.some((i) => !i.isPlaceholder);
36681
36684
  if (isNeedRefreshLayout) {
36682
36685
  const oldFirstItemIndex = firstItemIndex.value;
@@ -37080,88 +37083,65 @@
37080
37083
  };
37081
37084
  }
37082
37085
  });
37083
- const parseHeight = (height) => {
37084
- if (typeof height === "number") {
37085
- return height;
37086
+ const parseHeight = (v) => {
37087
+ if (typeof v === "number") {
37088
+ return v;
37086
37089
  }
37087
- if (height && typeof height === "string") {
37088
- if (/^\d+(?:px)?/.test(height)) {
37089
- return parseInt(height, 10);
37090
+ if (v && typeof v === "string") {
37091
+ if (/^\d+(?:px)?/.test(v)) {
37092
+ return parseInt(v, 10);
37090
37093
  }
37091
37094
  throw new VcError("table", "Invalid Height");
37092
37095
  }
37093
37096
  return null;
37094
37097
  };
37095
- const parseWidth = (width) => {
37096
- if (width !== void 0) {
37097
- width = parseInt(width, 10);
37098
- if (isNaN(width)) {
37099
- width = null;
37098
+ const parseWidth = (v) => {
37099
+ if (typeof v === "number") {
37100
+ return v;
37101
+ }
37102
+ let v1;
37103
+ if (typeof v !== "undefined") {
37104
+ v1 = parseInt(v, 10);
37105
+ if (isNaN(v1)) {
37106
+ v1 = null;
37100
37107
  }
37101
37108
  }
37102
- return width;
37109
+ return v1;
37103
37110
  };
37104
- const parseMinWidth = (minWidth) => {
37105
- if (typeof minWidth !== "undefined") {
37106
- minWidth = parseWidth(minWidth);
37107
- if (isNaN(minWidth)) {
37108
- minWidth = 80;
37111
+ const parseMinWidth = (v) => {
37112
+ if (typeof v === "number") {
37113
+ return v;
37114
+ }
37115
+ let v1;
37116
+ if (typeof v !== "undefined") {
37117
+ v1 = parseWidth(v);
37118
+ if (isNaN(v1)) {
37119
+ v = 80;
37109
37120
  }
37110
37121
  }
37111
- return minWidth;
37122
+ return v1;
37112
37123
  };
37113
- const getRowIdentity = (row, rowKey) => {
37124
+ const getRowValue = (row, primaryKey) => {
37114
37125
  if (row.__KEY__) return row.__KEY__;
37115
37126
  if (!row) throw new VcError("table", "row is required when get row identity");
37116
- if (typeof rowKey === "string") {
37117
- if (!rowKey.includes(".")) {
37118
- return row[rowKey];
37127
+ if (typeof primaryKey === "string") {
37128
+ if (!primaryKey.includes(".")) {
37129
+ return row[primaryKey];
37119
37130
  }
37120
- const key = rowKey.split(".");
37131
+ const key = primaryKey.split(".");
37121
37132
  let current = row;
37122
37133
  for (let i = 0; i < key.length; i++) {
37123
37134
  current = current[key[i]];
37124
37135
  }
37125
37136
  return current;
37126
- } else if (typeof rowKey === "function") {
37127
- return rowKey.call(null, row);
37137
+ } else if (typeof primaryKey === "function") {
37138
+ return primaryKey.call(null, row);
37128
37139
  }
37129
37140
  };
37130
- const walkTreeNode = (root, cb, opts = {}) => {
37131
- const {
37132
- childrenKey = "children",
37133
- lazyKey = "hasChildren",
37134
- level: baseLevel = 0
37135
- } = opts;
37136
- const isNil = (array) => !(Array.isArray(array) && array.length);
37137
- function _walker(parent, children, level) {
37138
- cb(parent, children, level);
37139
- children.forEach((item) => {
37140
- if (item[lazyKey]) {
37141
- cb(item, null, level + 1);
37142
- return;
37143
- }
37144
- const $children = item[childrenKey];
37145
- if (!isNil($children)) {
37146
- _walker(item, $children, level + 1);
37147
- }
37148
- });
37149
- }
37150
- root.forEach((item) => {
37151
- if (item[lazyKey]) {
37152
- cb(item, null, baseLevel);
37153
- return;
37154
- }
37155
- const children = item[childrenKey];
37156
- if (!isNil(children)) {
37157
- _walker(item, children, baseLevel);
37158
- }
37159
- });
37160
- };
37161
- const getKeysMap = (array = [], rowKey) => {
37141
+ const getValuesMap = (array = [], primaryKey) => {
37162
37142
  const arrayMap = {};
37163
37143
  array.forEach((row, index) => {
37164
- arrayMap[getRowIdentity(row, rowKey)] = { row, index };
37144
+ arrayMap[getRowValue(row, primaryKey)] = { row, index };
37165
37145
  });
37166
37146
  return arrayMap;
37167
37147
  };
@@ -37174,23 +37154,74 @@
37174
37154
  });
37175
37155
  return column;
37176
37156
  };
37177
- const getColumnByCell = (table, cell) => {
37157
+ const getColumnByCell = (columns, cell) => {
37178
37158
  const matches = (cell.className || "").match(/vc-table_[^\s]+/gm);
37179
37159
  if (matches) {
37180
- return getColumnById(table, matches[0]);
37160
+ return getColumnById(columns, matches[0]);
37181
37161
  }
37182
37162
  return null;
37183
37163
  };
37184
- const getCell = (event2) => {
37185
- let cell = event2.target;
37164
+ const getCell = (e) => {
37165
+ let cell = e.target;
37186
37166
  while (cell && cell.tagName.toUpperCase() !== "HTML") {
37187
- if (cell.tagName.toUpperCase() === "TD") {
37167
+ if (cell.classList.contains("vc-table__td")) {
37188
37168
  return cell;
37189
37169
  }
37190
37170
  cell = cell.parentNode;
37191
37171
  }
37192
37172
  return null;
37193
37173
  };
37174
+ const getAllColumns = (columns) => {
37175
+ const result = [];
37176
+ columns.forEach((column) => {
37177
+ if (column.children) {
37178
+ result.push(column);
37179
+ result.push(...getAllColumns(column.children));
37180
+ } else {
37181
+ result.push(column);
37182
+ }
37183
+ });
37184
+ return result;
37185
+ };
37186
+ const columnsToRowsEffect = (v) => {
37187
+ let maxLevel = 1;
37188
+ const traverse = (column, parent) => {
37189
+ if (parent) {
37190
+ column.level = parent.level + 1;
37191
+ if (maxLevel < column.level) {
37192
+ maxLevel = column.level;
37193
+ }
37194
+ }
37195
+ if (column.children) {
37196
+ let colSpan = 0;
37197
+ column.children.forEach((subColumn) => {
37198
+ traverse(subColumn, column);
37199
+ colSpan += subColumn.colSpan;
37200
+ });
37201
+ column.colSpan = colSpan;
37202
+ } else {
37203
+ column.colSpan = 1;
37204
+ }
37205
+ };
37206
+ v.forEach((column) => {
37207
+ column.level = 1;
37208
+ traverse(column);
37209
+ });
37210
+ const rows = [];
37211
+ for (let i = 0; i < maxLevel; i++) {
37212
+ rows.push([]);
37213
+ }
37214
+ const allColumns = getAllColumns(v);
37215
+ allColumns.forEach((column) => {
37216
+ if (!column.children) {
37217
+ column.rowSpan = maxLevel - column.level + 1;
37218
+ } else {
37219
+ column.rowSpan = 1;
37220
+ }
37221
+ rows[column.level - 1].push(column);
37222
+ });
37223
+ return rows;
37224
+ };
37194
37225
  const flattenData = (data, opts = {}) => {
37195
37226
  const result = [];
37196
37227
  data.forEach((item) => {
@@ -37203,29 +37234,51 @@
37203
37234
  });
37204
37235
  return result;
37205
37236
  };
37237
+ const walkTreeNode = (root, cb, opts = {}) => {
37238
+ const {
37239
+ childrenKey = "children",
37240
+ lazyKey = "hasChildren",
37241
+ level: baseLevel = 0
37242
+ } = opts;
37243
+ const isNil = (array) => !(Array.isArray(array) && array.length);
37244
+ function _walker(parent, children, level) {
37245
+ cb(parent, children, level);
37246
+ children.forEach((item) => {
37247
+ if (item[lazyKey]) {
37248
+ cb(item, null, level + 1);
37249
+ return;
37250
+ }
37251
+ const $children = item[childrenKey];
37252
+ if (!isNil($children)) {
37253
+ _walker(item, $children, level + 1);
37254
+ }
37255
+ });
37256
+ }
37257
+ root.forEach((item) => {
37258
+ if (item[lazyKey]) {
37259
+ cb(item, null, baseLevel);
37260
+ return;
37261
+ }
37262
+ const children = item[childrenKey];
37263
+ if (!isNil(children)) {
37264
+ _walker(item, children, baseLevel);
37265
+ }
37266
+ });
37267
+ };
37206
37268
  class BaseWatcher {
37207
37269
  states = vue.reactive({
37208
37270
  // 渲染的数据来源,是对 table 中的 data 过滤排序后的结果
37209
37271
  _data: [],
37210
37272
  data: [],
37211
37273
  list: [],
37212
- // 是否包含固定列
37213
- isComplex: false,
37214
- // 列
37274
+ // 表头数据
37275
+ headerRows: [],
37276
+ // 列 动态收集vc-table-column中的columnConfig
37215
37277
  _columns: [],
37216
- // 动态收集vc-table-column中的columnConfig
37217
37278
  originColumns: [],
37218
- // leftFixedColumns, notFixedColumns, rightFixedColumns
37219
- columns: [],
37220
- // 包括 leftFixedLeafColumns,leafColumns,rightFixedLeafColumns
37279
+ notFixedColumns: [],
37221
37280
  leftFixedColumns: [],
37222
37281
  rightFixedColumns: [],
37223
- leafColumns: [],
37224
- leftFixedLeafColumns: [],
37225
- rightFixedLeafColumns: [],
37226
- leafColumnsLength: 0,
37227
- leftFixedLeafColumnsLength: 0,
37228
- rightFixedLeafColumnsLength: 0,
37229
37282
  // 选择
37230
37283
  isAllSelected: false,
37231
37284
  selection: [],
@@ -37247,7 +37300,17 @@
37247
37300
  treeLazyData: [],
37248
37301
  // 源数据展开
37249
37302
  treeLazyColumnIdentifier: "hasChildren",
37250
- treeChildrenColumnName: "children"
37303
+ treeChildrenColumnName: "children",
37304
+ // compputeds
37305
+ isComplex: vue.computed(() => this.states.leftFixedColumns.length > 0 || this.states.rightFixedColumns.length > 0),
37306
+ isGroup: vue.computed(() => this.states.columns.length > this.states.originColumns.length),
37307
+ columns: vue.computed(() => lodashExports.concat(this.states.leftFixedLeafColumns, this.states.leafColumns, this.states.rightFixedLeafColumns)),
37308
+ leafColumns: vue.computed(() => flattenData(this.states.notFixedColumns)),
37309
+ leftFixedLeafColumns: vue.computed(() => flattenData(this.states.leftFixedColumns)),
37310
+ rightFixedLeafColumns: vue.computed(() => flattenData(this.states.rightFixedColumns)),
37311
+ leafColumnsLength: vue.computed(() => this.states.leafColumns.length),
37312
+ leftFixedLeafColumnsLength: vue.computed(() => this.states.leftFixedLeafColumns.length),
37313
+ rightFixedLeafColumnsLength: vue.computed(() => this.states.rightFixedLeafColumns.length)
37251
37314
  });
37252
37315
  }
37253
37316
  class Expand {
@@ -37257,14 +37320,14 @@
37257
37320
  }
37258
37321
  update() {
37259
37322
  const store = this.store;
37260
- const { rowKey, defaultExpandAll } = this.store.table.props;
37323
+ const { primaryKey, defaultExpandAll } = this.store.table.props;
37261
37324
  const { data = [], expandRows } = store.states;
37262
37325
  if (defaultExpandAll) {
37263
37326
  store.states.expandRows = data.slice();
37264
- } else if (rowKey) {
37265
- const expandRowsMap = getKeysMap(expandRows, rowKey);
37327
+ } else if (primaryKey) {
37328
+ const expandRowsMap = getValuesMap(expandRows, primaryKey);
37266
37329
  store.states.expandRows = data.reduce((prev, row) => {
37267
- const rowId = getRowIdentity(row, rowKey);
37330
+ const rowId = getRowValue(row, primaryKey);
37268
37331
  const rowInfo = expandRowsMap[rowId];
37269
37332
  if (rowInfo) {
37270
37333
  prev.push(row);
@@ -37286,10 +37349,10 @@
37286
37349
  }
37287
37350
  reset(ids) {
37288
37351
  const store = this.store;
37289
- store.checkRowKey();
37290
- const { rowKey } = store.table.props;
37352
+ store.checkPrimaryKey();
37353
+ const { primaryKey } = store.table.props;
37291
37354
  const { data } = store.states;
37292
- const keysMap = getKeysMap(data, rowKey);
37355
+ const keysMap = getValuesMap(data, primaryKey);
37293
37356
  store.states.expandRows = ids.reduce((prev, cur) => {
37294
37357
  const info2 = keysMap[cur];
37295
37358
  if (info2) {
@@ -37299,11 +37362,11 @@
37299
37362
  }, []);
37300
37363
  }
37301
37364
  isExpanded(row) {
37302
- const { rowKey } = this.store.table.props;
37365
+ const { primaryKey } = this.store.table.props;
37303
37366
  const { expandRows = [] } = this.store.states;
37304
- if (rowKey) {
37305
- const expandMap = getKeysMap(expandRows, rowKey);
37306
- return !!expandMap[getRowIdentity(row, rowKey)];
37367
+ if (primaryKey) {
37368
+ const expandMap = getValuesMap(expandRows, primaryKey);
37369
+ return !!expandMap[getRowValue(row, primaryKey)];
37307
37370
  }
37308
37371
  return expandRows.indexOf(row) !== -1;
37309
37372
  }
@@ -37315,22 +37378,22 @@
37315
37378
  }
37316
37379
  reset(id) {
37317
37380
  const store = this.store;
37318
- const { rowKey } = store.table.props;
37319
- store.checkRowKey();
37381
+ const { primaryKey } = store.table.props;
37382
+ store.checkPrimaryKey();
37320
37383
  const { data = [] } = store.states;
37321
- const currentRow = data.find((item) => getRowIdentity(item, rowKey) === id);
37384
+ const currentRow = data.find((item) => getRowValue(item, primaryKey) === id);
37322
37385
  store.states.currentRow = currentRow || null;
37323
37386
  }
37324
37387
  update() {
37325
37388
  const store = this.store;
37326
- const { rowKey } = store.table.props;
37389
+ const { primaryKey } = store.table.props;
37327
37390
  const { data = [], currentRow } = store.states;
37328
37391
  const oldCurrentRow = currentRow;
37329
37392
  if (oldCurrentRow && !data.includes(oldCurrentRow)) {
37330
37393
  let newCurrentRow = null;
37331
- if (rowKey) {
37394
+ if (primaryKey) {
37332
37395
  newCurrentRow = data.find((item) => {
37333
- return getRowIdentity(item, rowKey) === getRowIdentity(oldCurrentRow, rowKey);
37396
+ return getRowValue(item, primaryKey) === getRowValue(oldCurrentRow, primaryKey);
37334
37397
  });
37335
37398
  }
37336
37399
  store.states.currentRow = newCurrentRow;
@@ -37348,8 +37411,8 @@
37348
37411
  * { id: { level, children } }
37349
37412
  */
37350
37413
  normalizedData = vue.computed(() => {
37351
- const { rowKey } = this.store.table.props;
37352
- if (!rowKey) return {};
37414
+ const { primaryKey } = this.store.table.props;
37415
+ if (!primaryKey) return {};
37353
37416
  return this.normalize(this.store.states.data || []);
37354
37417
  });
37355
37418
  /**
@@ -37357,7 +37420,7 @@
37357
37420
  * { id: { children } }
37358
37421
  */
37359
37422
  normalizedLazyNode = vue.computed(() => {
37360
- const { rowKey } = this.store.table.props;
37423
+ const { primaryKey } = this.store.table.props;
37361
37424
  const { treelazyNodeMap, treeLazyColumnIdentifier, treeChildrenColumnName } = this.store.states;
37362
37425
  const keys = Object.keys(treelazyNodeMap);
37363
37426
  const res = {};
@@ -37366,7 +37429,7 @@
37366
37429
  if (treelazyNodeMap[key].length) {
37367
37430
  const item = { children: [] };
37368
37431
  treelazyNodeMap[key].forEach((row) => {
37369
- const id = getRowIdentity(row, rowKey);
37432
+ const id = getRowValue(row, primaryKey);
37370
37433
  item.children.push(id);
37371
37434
  const hasChildren = row[treeLazyColumnIdentifier] || row[treeChildrenColumnName] && row[treeChildrenColumnName].length === 0;
37372
37435
  if (hasChildren && !res[id]) {
@@ -37386,16 +37449,16 @@
37386
37449
  );
37387
37450
  }
37388
37451
  normalize(data) {
37389
- const { rowKey } = this.store.table.props;
37452
+ const { primaryKey } = this.store.table.props;
37390
37453
  const { treeChildrenColumnName, treeLazyColumnIdentifier, treeLazy } = this.store.states;
37391
37454
  const res = {};
37392
37455
  walkTreeNode(
37393
37456
  data,
37394
37457
  (parent, children, level) => {
37395
- const parentId = getRowIdentity(parent, rowKey);
37458
+ const parentId = getRowValue(parent, primaryKey);
37396
37459
  if (Array.isArray(children)) {
37397
37460
  res[parentId] = {
37398
- children: children.map((row) => getRowIdentity(row, rowKey)),
37461
+ children: children.map((row) => getRowValue(row, primaryKey)),
37399
37462
  level
37400
37463
  };
37401
37464
  } else if (treeLazy) {
@@ -37415,7 +37478,7 @@
37415
37478
  }
37416
37479
  // 获取当前展开最大的level
37417
37480
  getMaxLevel() {
37418
- const { rowKey } = this.store.table.props;
37481
+ const { primaryKey } = this.store.table.props;
37419
37482
  const { data, treeData } = this.store.states;
37420
37483
  const levels = data.map((item) => {
37421
37484
  const traverse = (source) => {
@@ -37426,7 +37489,7 @@
37426
37489
  return source.level;
37427
37490
  }
37428
37491
  };
37429
- const id = getRowIdentity(item, rowKey);
37492
+ const id = getRowValue(item, primaryKey);
37430
37493
  return traverse(treeData[id]);
37431
37494
  });
37432
37495
  return max$2(levels) || 0;
@@ -37488,10 +37551,10 @@
37488
37551
  this.update();
37489
37552
  }
37490
37553
  toggle(row, expanded) {
37491
- this.store.checkRowKey();
37492
- const { rowKey } = this.store.table.props;
37554
+ this.store.checkPrimaryKey();
37555
+ const { primaryKey } = this.store.table.props;
37493
37556
  const { treeData } = this.store.states;
37494
- const id = getRowIdentity(row, rowKey);
37557
+ const id = getRowValue(row, primaryKey);
37495
37558
  const data = id && treeData[id];
37496
37559
  if (id && data && "expanded" in data) {
37497
37560
  const oldExpanded = data.expanded;
@@ -37504,10 +37567,10 @@
37504
37567
  }
37505
37568
  }
37506
37569
  loadOrToggle(row) {
37507
- this.store.checkRowKey();
37508
- const { rowKey } = this.store.table.props;
37570
+ this.store.checkPrimaryKey();
37571
+ const { primaryKey } = this.store.table.props;
37509
37572
  const { treeLazy, treeData } = this.store.states;
37510
- const id = getRowIdentity(row, rowKey);
37573
+ const id = getRowValue(row, primaryKey);
37511
37574
  const data = treeData[id];
37512
37575
  if (treeLazy && data && "loaded" in data && !data.loaded) {
37513
37576
  this.loadData(row, id, data);
@@ -37516,9 +37579,9 @@
37516
37579
  }
37517
37580
  }
37518
37581
  loadData(row, key, treeNode) {
37519
- this.store.checkRowKey();
37582
+ this.store.checkPrimaryKey();
37520
37583
  const { table } = this.store;
37521
- const { rowKey } = table.props;
37584
+ const { primaryKey } = table.props;
37522
37585
  const { treelazyNodeMap, treeData, treeChildrenColumnName, treeLazyColumnIdentifier } = this.store.states;
37523
37586
  if (table.props.loadExpand && !treeData[key].loaded) {
37524
37587
  this.store.states.treeData[key].loading = true;
@@ -37533,7 +37596,7 @@
37533
37596
  walkTreeNode(
37534
37597
  data,
37535
37598
  (parent, _, level) => {
37536
- const id = getRowIdentity(parent, rowKey);
37599
+ const id = getRowValue(parent, primaryKey);
37537
37600
  Object.defineProperty(parent, "__KEY__", {
37538
37601
  value: `${level}__${id}`,
37539
37602
  writable: false
@@ -37602,27 +37665,13 @@
37602
37665
  if (!this.store) {
37603
37666
  throw new VcError("table", "Table Layout 必须包含store实例");
37604
37667
  }
37605
- this.updateScroller = this.updateScroller.bind(this);
37606
- this.updateColumns = this.updateColumns.bind(this);
37607
- vue.onMounted(() => {
37608
- this.updateColumns();
37609
- this.updateScroller();
37610
- });
37611
- let __updated__;
37612
- vue.onUpdated(() => {
37613
- if (__updated__) return;
37614
- this.updateColumns();
37615
- this.updateScroller();
37616
- __updated__ = true;
37617
- });
37618
37668
  }
37619
37669
  updateScrollY() {
37620
37670
  const { height, bodyHeight } = this.states;
37621
37671
  if (height === null || bodyHeight === null) return;
37622
- const scroller = this.table.exposed.scroller.value;
37623
- if (this.table.vnode.el && scroller) {
37624
- const body = scroller.$el.querySelector(".vc-table__body");
37625
- this.states.scrollY = body.offsetHeight > bodyHeight;
37672
+ const bodyYWrapper = this.table.exposed.bodyYWrapper.value;
37673
+ if (this.table.vnode.el && bodyYWrapper) {
37674
+ this.states.scrollY = bodyYWrapper.offsetHeight > bodyHeight;
37626
37675
  }
37627
37676
  }
37628
37677
  setHeight(value, prop = "height") {
@@ -37639,18 +37688,6 @@
37639
37688
  setMaxHeight(value) {
37640
37689
  this.setHeight(value, "max-height");
37641
37690
  }
37642
- getFlattenColumns() {
37643
- const flattenColumns = [];
37644
- const columns = this.store.states.columns;
37645
- columns.forEach((column) => {
37646
- if (column.isColumnGroup) {
37647
- flattenColumns.push(...column.columns);
37648
- } else {
37649
- flattenColumns.push(column);
37650
- }
37651
- });
37652
- return flattenColumns;
37653
- }
37654
37691
  updateElsHeight() {
37655
37692
  if (!this.table.exposed.isReady.value) return vue.nextTick(() => this.updateElsHeight());
37656
37693
  const table = this.table.exposed;
@@ -37673,13 +37710,12 @@
37673
37710
  this.states.bodyHeight = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
37674
37711
  }
37675
37712
  this.updateScrollY();
37676
- this.updateScroller();
37677
37713
  }
37678
37714
  updateColumnsWidth() {
37679
37715
  if (IS_SERVER$3) return;
37680
37716
  const bodyWidth = this.table.vnode.el.clientWidth;
37681
37717
  let bodyMinWidth = 0;
37682
- const flattenColumns = this.getFlattenColumns();
37718
+ const flattenColumns = this.store.states.columns;
37683
37719
  const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
37684
37720
  const { fit } = this.table.props;
37685
37721
  if (flexColumns.length > 0 && fit) {
@@ -37705,7 +37741,7 @@
37705
37741
  }
37706
37742
  } else {
37707
37743
  this.states.scrollX = true;
37708
- flexColumns.forEach(function(column) {
37744
+ flexColumns.forEach((column) => {
37709
37745
  column.realWidth = column.width || column.minWidth;
37710
37746
  });
37711
37747
  }
@@ -37739,12 +37775,6 @@
37739
37775
  });
37740
37776
  this.states.rightFixedWidth = rightFixedWidth;
37741
37777
  }
37742
- this.updateColumns();
37743
- }
37744
- // v2.x中的 notifyObservers
37745
- updateColumns() {
37746
- }
37747
- updateScroller() {
37748
37778
  }
37749
37779
  }
37750
37780
  class Store extends BaseWatcher {
@@ -37753,7 +37783,7 @@
37753
37783
  expand;
37754
37784
  tree;
37755
37785
  layout;
37756
- flattenData = vue.computed(() => {
37786
+ flatData = vue.computed(() => {
37757
37787
  if (this.table.props.expandSelectable) {
37758
37788
  return lodashExports.concat(
37759
37789
  flattenData(this.states.data, { parent: true, cascader: true }),
@@ -37811,7 +37841,7 @@
37811
37841
  this.cleanSelection();
37812
37842
  }
37813
37843
  } else {
37814
- this.checkRowKey();
37844
+ this.checkPrimaryKey();
37815
37845
  this.updateSelectionByRowKey();
37816
37846
  }
37817
37847
  this.updateAllSelected();
@@ -37833,10 +37863,10 @@
37833
37863
  }
37834
37864
  }
37835
37865
  /**
37836
- * 检查 rowKey 是否存在
37866
+ * 检查 primaryKey 是否存在
37837
37867
  */
37838
- checkRowKey() {
37839
- const { rowKey } = this.table.props;
37868
+ checkPrimaryKey() {
37869
+ const { primaryKey } = this.table.props;
37840
37870
  }
37841
37871
  /**
37842
37872
  * states
@@ -37897,22 +37927,20 @@
37897
37927
  updateColumns() {
37898
37928
  const { states } = this;
37899
37929
  const _columns = states._columns || [];
37900
- states.leftFixedColumns = _columns.filter((column) => column.fixed === true || column.fixed === "left");
37901
- states.rightFixedColumns = _columns.filter((column) => column.fixed === "right");
37902
- if (states.leftFixedColumns.length > 0 && _columns[0] && _columns[0].type === "selection" && !_columns[0].fixed) {
37930
+ const leftFixedColumns = _columns.filter((column) => column.fixed === true || column.fixed === "left");
37931
+ const rightFixedColumns = _columns.filter((column) => column.fixed === "right");
37932
+ if (leftFixedColumns.length > 0 && _columns[0] && _columns[0].type === "selection" && !_columns[0].fixed) {
37903
37933
  _columns[0].fixed = true;
37904
- states.leftFixedColumns.unshift(_columns[0]);
37934
+ leftFixedColumns.unshift(_columns[0]);
37905
37935
  }
37906
37936
  const notFixedColumns = _columns.filter((column) => !column.fixed);
37907
- states.originColumns = lodashExports.concat(states.leftFixedColumns, notFixedColumns, states.rightFixedColumns);
37908
- const leafColumns = flattenData(notFixedColumns);
37909
- const leftFixedLeafColumns = flattenData(states.leftFixedColumns);
37910
- const rightFixedLeafColumns = flattenData(states.rightFixedColumns);
37911
- states.leafColumnsLength = leafColumns.length;
37912
- states.leftFixedLeafColumnsLength = leftFixedLeafColumns.length;
37913
- states.rightFixedLeafColumnsLength = rightFixedLeafColumns.length;
37914
- states.columns = lodashExports.concat(leftFixedLeafColumns, leafColumns, rightFixedLeafColumns);
37915
- states.isComplex = states.leftFixedColumns.length > 0 || states.rightFixedColumns.length > 0;
37937
+ const originColumns = lodashExports.concat(leftFixedColumns, notFixedColumns, rightFixedColumns);
37938
+ const headerRows = columnsToRowsEffect(originColumns);
37939
+ states.leftFixedColumns = leftFixedColumns;
37940
+ states.notFixedColumns = notFixedColumns;
37941
+ states.rightFixedColumns = rightFixedColumns;
37942
+ states.originColumns = originColumns;
37943
+ states.headerRows = headerRows;
37916
37944
  }
37917
37945
  // 选择
37918
37946
  isSelected(row) {
@@ -37936,13 +37964,13 @@
37936
37964
  * 清理选择
37937
37965
  */
37938
37966
  cleanSelection() {
37939
- const { rowKey } = this.table.props;
37967
+ const { primaryKey } = this.table.props;
37940
37968
  const { selection = [] } = this.states;
37941
37969
  let deleted;
37942
- if (rowKey) {
37970
+ if (primaryKey) {
37943
37971
  deleted = [];
37944
- const selectedMap = getKeysMap(selection, rowKey);
37945
- const dataMap = getKeysMap(selection, rowKey);
37972
+ const selectedMap = getValuesMap(selection, primaryKey);
37973
+ const dataMap = getValuesMap(selection, primaryKey);
37946
37974
  for (const key in selectedMap) {
37947
37975
  if (hasOwn$1(selectedMap, key) && !dataMap[key]) {
37948
37976
  deleted.push(selectedMap[key].row);
@@ -37950,7 +37978,7 @@
37950
37978
  }
37951
37979
  } else {
37952
37980
  deleted = selection.filter((item) => {
37953
- return !this.flattenData.value.includes(item);
37981
+ return !this.flatData.value.includes(item);
37954
37982
  });
37955
37983
  }
37956
37984
  deleted.forEach((deletedItem) => {
@@ -38011,7 +38039,7 @@
38011
38039
  const value = indeterminate ? !isAllSelected : !(isAllSelected || selection.length);
38012
38040
  this.states.isAllSelected = value;
38013
38041
  let selectionChanged = false;
38014
- this.flattenData.value.forEach((row, index) => {
38042
+ this.flatData.value.forEach((row, index) => {
38015
38043
  if (selectable) {
38016
38044
  if (selectable.call(null, row, index) && this.toggleRowStatus(selection, row, value)) {
38017
38045
  selectionChanged = true;
@@ -38042,11 +38070,11 @@
38042
38070
  this.tree.expand(val);
38043
38071
  }
38044
38072
  updateSelectionByRowKey() {
38045
- const { rowKey } = this.table.props;
38073
+ const { primaryKey } = this.table.props;
38046
38074
  const { selection } = this.states;
38047
- const selectedMap = getKeysMap(selection, rowKey);
38048
- this.states.selection = this.flattenData.value.reduce((prev, row) => {
38049
- const rowId = getRowIdentity(row, rowKey);
38075
+ const selectedMap = getValuesMap(selection, primaryKey);
38076
+ this.states.selection = this.flatData.value.reduce((prev, row) => {
38077
+ const rowId = getRowValue(row, primaryKey);
38050
38078
  const rowInfo = selectedMap[rowId];
38051
38079
  if (rowInfo) {
38052
38080
  prev.push(row);
@@ -38062,7 +38090,7 @@
38062
38090
  }
38063
38091
  let isAllSelected = true;
38064
38092
  let selectedCount = 0;
38065
- const temp = this.flattenData.value;
38093
+ const temp = this.flatData.value;
38066
38094
  for (let i = 0, j = temp.length; i < j; i++) {
38067
38095
  const row = temp[i];
38068
38096
  const isRowSelectable = selectable && selectable.call(null, row, i);
@@ -38172,6 +38200,7 @@
38172
38200
  type
38173
38201
  }) => type === "default")
38174
38202
  });
38203
+ const wrapper = vue.ref();
38175
38204
  vue.watch(() => props2.store.states.hoverRowIndex, (v, oldV) => {
38176
38205
  if (!props2.store.states.isComplex || IS_SERVER$3) return;
38177
38206
  raf(() => {
@@ -38182,12 +38211,12 @@
38182
38211
  newRow && addClass(newRow, "hover-row");
38183
38212
  });
38184
38213
  });
38185
- const getKeyOfRow = (row, index) => {
38214
+ const getValueOfRow = (row, index) => {
38186
38215
  const {
38187
- rowKey
38216
+ primaryKey
38188
38217
  } = table.props;
38189
- if (rowKey) {
38190
- return getRowIdentity(row, rowKey);
38218
+ if (primaryKey) {
38219
+ return getRowValue(row, primaryKey);
38191
38220
  }
38192
38221
  return index;
38193
38222
  };
@@ -38252,7 +38281,7 @@
38252
38281
  return cellStyle;
38253
38282
  };
38254
38283
  const getCellClass = (rowIndex, columnIndex, row, column) => {
38255
- const classes = [column.align, column.className];
38284
+ const classes = [column.realAlign, column.className];
38256
38285
  if (isColumnHidden(columnIndex)) {
38257
38286
  classes.push("is-hidden");
38258
38287
  }
@@ -38308,7 +38337,7 @@
38308
38337
  const cell = getCell(e);
38309
38338
  if (!cell) return;
38310
38339
  const oldHoverState = table.exposed.hoverState.value || {};
38311
- table.emit("cell-mouse-leave", oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
38340
+ table.emit("cell-mouse-leave", oldHoverState.row, oldHoverState.column, oldHoverState.cell, e);
38312
38341
  };
38313
38342
  const handleMouseEnter = debounce$1((index) => {
38314
38343
  props2.store.setHoverRow(index);
@@ -38344,7 +38373,7 @@
38344
38373
  const {
38345
38374
  columns
38346
38375
  } = states;
38347
- const key = getKeyOfRow(row, rowIndex);
38376
+ const key = getValueOfRow(row, rowIndex);
38348
38377
  return vue.createVNode("div", {
38349
38378
  "key": key,
38350
38379
  "class": [getRowClass(row, rowIndex), "vc-table__tr"],
@@ -38408,13 +38437,12 @@
38408
38437
  }
38409
38438
  });
38410
38439
  };
38411
- const wrapper = vue.ref();
38412
38440
  expose({
38413
38441
  wrapper,
38414
38442
  getRootElement: () => instance.vnode.el
38415
38443
  });
38444
+ const layout = table.exposed.layout;
38416
38445
  return () => {
38417
- const layout = table.exposed.layout;
38418
38446
  return vue.createVNode("div", {
38419
38447
  "class": "vc-table__body"
38420
38448
  }, [table.props.height ? vue.createVNode(RecycleList, {
@@ -38459,57 +38487,6 @@
38459
38487
  });
38460
38488
  const TableSort = "div";
38461
38489
  const TableFilter = "div";
38462
- const getAllColumns = (columns) => {
38463
- const result = [];
38464
- columns.forEach((column) => {
38465
- if (column.children) {
38466
- result.push(column);
38467
- result.push(...getAllColumns(column.children));
38468
- } else {
38469
- result.push(column);
38470
- }
38471
- });
38472
- return result;
38473
- };
38474
- const convertToRows = (originColumns) => {
38475
- let maxLevel = 1;
38476
- const traverse = (column, parent) => {
38477
- if (parent) {
38478
- column.level = parent.level + 1;
38479
- if (maxLevel < column.level) {
38480
- maxLevel = column.level;
38481
- }
38482
- }
38483
- if (column.children) {
38484
- let colSpan = 0;
38485
- column.children.forEach((subColumn) => {
38486
- traverse(subColumn, column);
38487
- colSpan += subColumn.colSpan;
38488
- });
38489
- column.colSpan = colSpan;
38490
- } else {
38491
- column.colSpan = 1;
38492
- }
38493
- };
38494
- originColumns.forEach((column) => {
38495
- column.level = 1;
38496
- traverse(column);
38497
- });
38498
- const rows = [];
38499
- for (let i = 0; i < maxLevel; i++) {
38500
- rows.push([]);
38501
- }
38502
- const allColumns = getAllColumns(originColumns);
38503
- allColumns.forEach((column) => {
38504
- if (!column.children) {
38505
- column.rowSpan = maxLevel - column.level + 1;
38506
- } else {
38507
- column.rowSpan = 1;
38508
- }
38509
- rows[column.level - 1].push(column);
38510
- });
38511
- return rows;
38512
- };
38513
38490
  const TableHeader = /* @__PURE__ */ vue.defineComponent({
38514
38491
  name: "vc-table-header",
38515
38492
  props: {
@@ -38536,16 +38513,18 @@
38536
38513
  isAllSelected: "isAllSelected",
38537
38514
  leftFixedLeafCount: "leftFixedLeafColumnsLength",
38538
38515
  rightFixedLeafCount: "rightFixedLeafColumnsLength",
38516
+ isGroup: "isGroup",
38517
+ headerRows: "headerRows",
38539
38518
  columnsCount: ($states) => $states.columns.length,
38540
38519
  leftFixedCount: ($states) => $states.leftFixedColumns.length,
38541
38520
  rightFixedCount: ($states) => $states.rightFixedColumns.length
38542
38521
  });
38543
- const isCellHidden = (index, columns) => {
38522
+ const isColumnHidden = (index) => {
38544
38523
  let start = 0;
38545
38524
  for (let i = 0; i < index; i++) {
38546
- start += columns[i].colSpan;
38525
+ start += states.columns[i].colSpan;
38547
38526
  }
38548
- const after = start + columns[index].colSpan - 1;
38527
+ const after = start + states.columns[index].colSpan - 1;
38549
38528
  if (props2.fixed === true || props2.fixed === "left") {
38550
38529
  return after >= states.leftFixedLeafCount;
38551
38530
  } else if (props2.fixed === "right") {
@@ -38554,6 +38533,9 @@
38554
38533
  return after < states.leftFixedLeafCount || start >= states.columnsCount - states.rightFixedLeafCount;
38555
38534
  }
38556
38535
  };
38536
+ const columnsHidden = vue.computed(() => {
38537
+ return states.columns.map((_, index) => isColumnHidden(index));
38538
+ });
38557
38539
  const getHeaderRowStyle = (rowIndex) => {
38558
38540
  const {
38559
38541
  headerRowStyle
@@ -38594,8 +38576,8 @@
38594
38576
  return headerCellStyle;
38595
38577
  };
38596
38578
  const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
38597
- const classes = [column.id, column.order, column.headerAlign, column.className, column.labelClass];
38598
- if (rowIndex === 0 && isCellHidden(columnIndex, row)) {
38579
+ const classes = [column.id, column.order, column.realHeaderAlign, column.className, column.labelClass];
38580
+ if (rowIndex === 0 && columnsHidden.value[columnIndex]) {
38599
38581
  classes.push("is-hidden");
38600
38582
  }
38601
38583
  if (!column.children) {
@@ -38734,35 +38716,27 @@
38734
38716
  });
38735
38717
  };
38736
38718
  return () => {
38737
- const {
38738
- originColumns
38739
- } = props2.store.states;
38740
- const columnRows = convertToRows(originColumns);
38741
- const isGroup = columnRows.length > 1;
38742
- if (isGroup) table.exposed.isGroup.value = true;
38743
38719
  return vue.createVNode("div", {
38744
38720
  "class": "vc-table__header"
38745
38721
  }, [vue.createVNode("div", {
38746
38722
  "class": [{
38747
- "is-group": isGroup
38723
+ "is-group": states.isGroup
38748
38724
  }, "vc-table__thead"]
38749
38725
  }, [
38750
38726
  // renderList
38751
- columnRows.map((columns, rowIndex) => vue.createVNode("div", {
38727
+ states.headerRows.map((columns, rowIndex) => vue.createVNode("div", {
38752
38728
  "style": getHeaderRowStyle(rowIndex),
38753
38729
  "class": [getHeaderRowClass(rowIndex), "vc-table__tr"]
38754
- }, [columns.map((column, cellIndex) => vue.createVNode("div", {
38755
- "colspan": column.colSpan,
38756
- "rowspan": column.rowSpan,
38757
- "onMousemove": ($event) => handleMouseMove($event, column),
38730
+ }, [columns.map((column, columnIndex) => vue.createVNode("div", {
38731
+ "onMousemove": (e) => handleMouseMove(e, column),
38758
38732
  "onMouseout": handleMouseOut,
38759
- "onMousedown": ($event) => handleMouseDown($event, column),
38760
- "onClick": ($event) => handleHeaderClick($event, column),
38761
- "onContextmenu": ($event) => handleHeaderContextMenu($event, column),
38762
- "style": [getHeaderCellStyle(rowIndex, cellIndex, columns, column), {
38733
+ "onMousedown": (e) => handleMouseDown(e, column),
38734
+ "onClick": (e) => handleHeaderClick(e, column),
38735
+ "onContextmenu": (e) => handleHeaderContextMenu(e, column),
38736
+ "style": [getHeaderCellStyle(rowIndex, columnIndex, columns, column), {
38763
38737
  width: `${column.realWidth}px`
38764
38738
  }],
38765
- "class": [getHeaderCellClass(rowIndex, cellIndex, columns, column), "vc-table__th"],
38739
+ "class": [getHeaderCellClass(rowIndex, columnIndex, columns, column), "vc-table__th"],
38766
38740
  "key": column.id
38767
38741
  }, [vue.createVNode("div", {
38768
38742
  "class": [
@@ -38774,10 +38748,8 @@
38774
38748
  ]
38775
38749
  }, [column.renderHeader ? column.renderHeader({
38776
38750
  column,
38777
- $index: cellIndex,
38778
- // index: cellIndex,
38779
- store: props2.store,
38780
- _self: instance
38751
+ columnIndex,
38752
+ store: props2.store
38781
38753
  }) : column.label, column.tooltip ? vue.createVNode(Icon, {
38782
38754
  "type": "o-info",
38783
38755
  "onMouseenter": (e) => handleCellMouseEnter(e, column)
@@ -38819,13 +38791,13 @@
38819
38791
  leftFixedCount: ($states) => $states.leftFixedColumns.length,
38820
38792
  rightFixedCount: ($states) => $states.rightFixedColumns.length
38821
38793
  });
38822
- const isCellHidden = (index, columns, column) => {
38794
+ const isColumnHidden = (column, index) => {
38823
38795
  if (props2.fixed === true || props2.fixed === "left") {
38824
38796
  return index >= states.leftFixedLeafCount;
38825
38797
  } else if (props2.fixed === "right") {
38826
38798
  let before = 0;
38827
38799
  for (let i = 0; i < index; i++) {
38828
- before += columns[i].colSpan;
38800
+ before += states.columns[i].colSpan;
38829
38801
  }
38830
38802
  return before < states.columnsCount - states.rightFixedLeafCount;
38831
38803
  } else if (!props2.fixed && column.fixed) {
@@ -38834,12 +38806,13 @@
38834
38806
  return index < states.leftFixedCount || index >= states.columnsCount - states.rightFixedCount;
38835
38807
  }
38836
38808
  };
38837
- const getRowClasses = (column, cellIndex) => {
38838
- const classes = [column.id, column.align, column.labelClass];
38809
+ const columnsHidden = vue.computed(() => states.columns.map(isColumnHidden));
38810
+ const getRowClasses = (column, columnIndex) => {
38811
+ const classes = [column.realAlign, column.labelClass];
38839
38812
  if (column.className) {
38840
38813
  classes.push(column.className);
38841
38814
  }
38842
- if (isCellHidden(cellIndex, states.columns, column)) {
38815
+ if (columnsHidden.value[columnIndex]) {
38843
38816
  classes.push("is-hidden");
38844
38817
  }
38845
38818
  if (!column.children) {
@@ -38847,17 +38820,17 @@
38847
38820
  }
38848
38821
  return classes;
38849
38822
  };
38850
- return () => {
38851
- let sums = [];
38823
+ const sums = vue.computed(() => {
38824
+ let v = [];
38852
38825
  if (props2.getSummary) {
38853
- sums = props2.getSummary({
38826
+ v = props2.getSummary({
38854
38827
  columns: states.columns,
38855
38828
  data: states.data
38856
38829
  });
38857
38830
  } else {
38858
38831
  states.columns.forEach((column, index) => {
38859
38832
  if (index === 0) {
38860
- sums[index] = props2.sumText;
38833
+ v[index] = props2.sumText;
38861
38834
  return;
38862
38835
  }
38863
38836
  const values = states.data.map((item) => Number(item[column.prop]));
@@ -38872,7 +38845,7 @@
38872
38845
  });
38873
38846
  const precision = Math.max.apply(null, precisions);
38874
38847
  if (!notNumber) {
38875
- sums[index] = values.reduce((prev, curr) => {
38848
+ v[index] = values.reduce((prev, curr) => {
38876
38849
  const value = Number(curr);
38877
38850
  if (!isNaN(value)) {
38878
38851
  return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
@@ -38881,10 +38854,13 @@
38881
38854
  }
38882
38855
  }, 0);
38883
38856
  } else {
38884
- sums[index] = "";
38857
+ v[index] = "";
38885
38858
  }
38886
38859
  });
38887
38860
  }
38861
+ return v;
38862
+ });
38863
+ return () => {
38888
38864
  return vue.createVNode("div", {
38889
38865
  "class": "vc-table__footer",
38890
38866
  "cellspacing": "0",
@@ -38894,17 +38870,15 @@
38894
38870
  "class": "vc-table__tbody"
38895
38871
  }, [vue.createVNode("div", {
38896
38872
  "class": "vc-table__tr"
38897
- }, [states.columns.map((column, cellIndex) => vue.createVNode("div", {
38898
- "key": cellIndex,
38899
- "colspan": column.colSpan,
38900
- "rowspan": column.rowSpan,
38901
- "class": [getRowClasses(column, cellIndex), "vc-table__td"],
38873
+ }, [states.columns.map((column, columnIndex) => vue.createVNode("div", {
38874
+ "key": columnIndex,
38875
+ "class": [getRowClasses(column, columnIndex), "vc-table__td"],
38902
38876
  "style": [{
38903
38877
  width: `${column.realWidth}px`
38904
38878
  }]
38905
38879
  }, [vue.createVNode("div", {
38906
38880
  "class": ["vc-table__cell", column.labelClass]
38907
- }, [sums[cellIndex]])]))])])]);
38881
+ }, [sums.value[columnIndex]])]))])])]);
38908
38882
  };
38909
38883
  }
38910
38884
  });
@@ -38931,7 +38905,7 @@
38931
38905
  type: Number,
38932
38906
  default: 10
38933
38907
  },
38934
- rowKey: [String, Function],
38908
+ primaryKey: [String, Function],
38935
38909
  // 是否显示表头
38936
38910
  showHeader: {
38937
38911
  type: Boolean,
@@ -39041,21 +39015,21 @@
39041
39015
  const rightFixedBody = vue.ref(null);
39042
39016
  const rightFixedFooterWrapper = vue.ref(null);
39043
39017
  const resizeProxy = vue.ref(null);
39044
- const isGroup = vue.ref(false);
39045
39018
  const scrollPosition = vue.ref("left");
39046
39019
  const hoverState = vue.ref(null);
39047
39020
  const isReady = vue.ref(false);
39048
39021
  const states = useStates({
39049
39022
  columns: "columns",
39050
39023
  leftFixedColumns: "leftFixedColumns",
39051
- rightFixedColumns: "rightFixedColumns"
39024
+ rightFixedColumns: "rightFixedColumns",
39025
+ isGroup: "isGroup"
39052
39026
  }, store);
39053
39027
  const classes = vue.computed(() => {
39054
39028
  return {
39055
39029
  "vc-table--fit": props2.fit,
39056
39030
  "vc-table--striped": props2.stripe,
39057
- "vc-table--border": props2.border || isGroup.value,
39058
- "vc-table--group": isGroup.value,
39031
+ "vc-table--border": props2.border || states.isGroup,
39032
+ "vc-table--group": states.isGroup,
39059
39033
  "vc-table--fluid-height": props2.maxHeight,
39060
39034
  "vc-table--scrollable-x": layout.states.scrollX,
39061
39035
  "vc-table--scrollable-y": layout.states.scrollY,
@@ -39299,7 +39273,7 @@
39299
39273
  immediate: true
39300
39274
  });
39301
39275
  vue.watch(() => props2.currentRowValue, (v) => {
39302
- if (!props2.rowKey) return;
39276
+ if (!props2.primaryKey) return;
39303
39277
  store.current.reset(v);
39304
39278
  }, {
39305
39279
  immediate: true
@@ -39326,6 +39300,7 @@
39326
39300
  }, {
39327
39301
  immediate: true
39328
39302
  });
39303
+ const tableId = getUid("table");
39329
39304
  vue.onMounted(() => {
39330
39305
  bindEvents();
39331
39306
  store.updateColumns();
@@ -39336,12 +39311,13 @@
39336
39311
  };
39337
39312
  isReady.value = true;
39338
39313
  });
39339
- vue.onBeforeUnmount(() => {
39314
+ vue.onUnmounted(() => {
39340
39315
  isUnMount = true;
39341
39316
  unbindEvents();
39342
39317
  });
39343
- const tableId = getUid("table");
39344
39318
  expose({
39319
+ bodyXWrapper,
39320
+ bodyYWrapper,
39345
39321
  tableId,
39346
39322
  store,
39347
39323
  layout,
@@ -39510,22 +39486,19 @@
39510
39486
  order: ""
39511
39487
  },
39512
39488
  selection: {
39513
- width: 48,
39514
- minWidth: 48,
39515
- realWidth: 48,
39489
+ width: 60,
39490
+ minWidth: 60,
39516
39491
  order: "",
39517
39492
  className: "vc-table-column--selection"
39518
39493
  },
39519
39494
  expand: {
39520
- width: 48,
39521
- minWidth: 48,
39522
- realWidth: 48,
39495
+ width: 60,
39496
+ minWidth: 60,
39523
39497
  order: ""
39524
39498
  },
39525
39499
  index: {
39526
- width: 48,
39527
- minWidth: 48,
39528
- realWidth: 48,
39500
+ width: 60,
39501
+ minWidth: 60,
39529
39502
  order: ""
39530
39503
  }
39531
39504
  };
@@ -39685,8 +39658,8 @@
39685
39658
  customClass: String,
39686
39659
  labelClass: String,
39687
39660
  prop: String,
39688
- width: [Number, String],
39689
- minWidth: [Number, String],
39661
+ width: Number,
39662
+ minWidth: Number,
39690
39663
  renderHeader: Function,
39691
39664
  resizable: {
39692
39665
  type: Boolean,
@@ -39828,24 +39801,14 @@
39828
39801
  }
39829
39802
  return column;
39830
39803
  };
39831
- const refreshColumnBasicConfig = () => {
39804
+ const registerColumn = () => {
39832
39805
  const defaults2 = {
39833
39806
  ...cellStarts[props2.type],
39834
- type: props2.type,
39835
39807
  id: columnId.value,
39836
- align: realAlign.value,
39837
- headerAlign: realHeaderAlign.value,
39838
- prop: props2.prop,
39839
- showPopover: props2.showPopover,
39840
- // index 列
39841
- index: props2.index
39808
+ realAlign,
39809
+ realHeaderAlign
39842
39810
  };
39843
- const basicProps = ["columnKey", "label", "customClass", "labelClass", "type", "renderHeader", "resizable", "formatter", "fixed", "resizable"];
39844
- const selectProps = ["selectable", "reserveSelection"];
39845
- const sortProps = ["sortable"];
39846
- const filterProps = ["filters", "filteredValue", "filterMultiple", "filter", "filterIcon", "filterPopupClass"];
39847
- let column = getPropsData(basicProps, selectProps, sortProps, filterProps);
39848
- column = merge$1(defaults2, column);
39811
+ let column = merge$1(defaults2, getPropsData(Object.keys(props2)));
39849
39812
  column = compose(setColumnRenders, setColumnWidth, setColumnForcedProps)(column);
39850
39813
  for (const key in column) {
39851
39814
  if (hasOwn$1(column, key)) {
@@ -39853,11 +39816,14 @@
39853
39816
  }
39854
39817
  }
39855
39818
  };
39856
- const registerComplexWatchers = () => {
39819
+ const registerWatchers = () => {
39820
+ Object.keys(props2).forEach((k) => vue.watch(() => props2[k], (v) => columnConfig[k] = v));
39857
39821
  vue.watch(() => props2.fixed, () => {
39858
39822
  table.exposed.store.scheduleLayout(true);
39859
39823
  });
39860
- vue.watch(() => realWidth.value, () => {
39824
+ vue.watch(() => realWidth.value, (v) => {
39825
+ columnConfig["width"] = v;
39826
+ columnConfig["realWidth"] = v;
39861
39827
  table.exposed.store.scheduleLayout(false);
39862
39828
  });
39863
39829
  vue.watch(() => realMinWidth.value, () => {
@@ -39865,10 +39831,9 @@
39865
39831
  });
39866
39832
  };
39867
39833
  vue.onBeforeMount(() => {
39868
- refreshColumnBasicConfig();
39869
- registerComplexWatchers();
39834
+ registerColumn();
39835
+ registerWatchers();
39870
39836
  });
39871
- vue.onUpdated(refreshColumnBasicConfig);
39872
39837
  vue.onMounted(() => {
39873
39838
  const children = isSubColumn ? parent.vnode.el.children : parent.exposed.hiddenColumns.value.children;
39874
39839
  const columnIndex = [...children].indexOf(instance.vnode.el);
@@ -39888,7 +39853,8 @@
39888
39853
  const renderDefault = slots?.default?.({
39889
39854
  row: {},
39890
39855
  column: {},
39891
- $index: -1
39856
+ columnIndex: -1,
39857
+ rowIndex: -1
39892
39858
  });
39893
39859
  if (renderDefault instanceof Array) {
39894
39860
  for (const childNode of renderDefault) {