@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.
@@ -31718,6 +31718,7 @@ var Vc = (function (exports, vue) {
31718
31718
  isVisible.value = cursorDown.value;
31719
31719
  };
31720
31720
  const refreshThumb = () => raf(() => {
31721
+ if (!thumb.value) return;
31721
31722
  thumb.value.style[prefixStyle("transform").camel] = `translate${barOptions.value.axis}(${thumbMove.value}px)`;
31722
31723
  });
31723
31724
  const refreshThrottleThumb = throttle$2(refreshThumb, 10);
@@ -36510,6 +36511,7 @@ var Vc = (function (exports, vue) {
36510
36511
  columnFillSize.value = sizes.map((i) => contentMaxSize.value - i);
36511
36512
  };
36512
36513
  const setFirstItemIndex = () => {
36514
+ if (!wrapper.value) return;
36513
36515
  const position = wrapper.value[K.scrollAxis];
36514
36516
  let item;
36515
36517
  for (let i = 0; i < rebuildData.value.length; i++) {
@@ -36674,6 +36676,7 @@ var Vc = (function (exports, vue) {
36674
36676
  await refreshLayout(0, rebuildData.value.length);
36675
36677
  };
36676
36678
  const handleResize = throttle$1(async () => {
36679
+ if (!wrapper.value) return;
36677
36680
  const isNeedRefreshLayout = rebuildData.value.some((i) => !i.isPlaceholder);
36678
36681
  if (isNeedRefreshLayout) {
36679
36682
  const oldFirstItemIndex = firstItemIndex.value;
@@ -37077,88 +37080,65 @@ var Vc = (function (exports, vue) {
37077
37080
  };
37078
37081
  }
37079
37082
  });
37080
- const parseHeight = (height) => {
37081
- if (typeof height === "number") {
37082
- return height;
37083
+ const parseHeight = (v) => {
37084
+ if (typeof v === "number") {
37085
+ return v;
37083
37086
  }
37084
- if (height && typeof height === "string") {
37085
- if (/^\d+(?:px)?/.test(height)) {
37086
- return parseInt(height, 10);
37087
+ if (v && typeof v === "string") {
37088
+ if (/^\d+(?:px)?/.test(v)) {
37089
+ return parseInt(v, 10);
37087
37090
  }
37088
37091
  throw new VcError("table", "Invalid Height");
37089
37092
  }
37090
37093
  return null;
37091
37094
  };
37092
- const parseWidth = (width) => {
37093
- if (width !== void 0) {
37094
- width = parseInt(width, 10);
37095
- if (isNaN(width)) {
37096
- width = null;
37095
+ const parseWidth = (v) => {
37096
+ if (typeof v === "number") {
37097
+ return v;
37098
+ }
37099
+ let v1;
37100
+ if (typeof v !== "undefined") {
37101
+ v1 = parseInt(v, 10);
37102
+ if (isNaN(v1)) {
37103
+ v1 = null;
37097
37104
  }
37098
37105
  }
37099
- return width;
37106
+ return v1;
37100
37107
  };
37101
- const parseMinWidth = (minWidth) => {
37102
- if (typeof minWidth !== "undefined") {
37103
- minWidth = parseWidth(minWidth);
37104
- if (isNaN(minWidth)) {
37105
- minWidth = 80;
37108
+ const parseMinWidth = (v) => {
37109
+ if (typeof v === "number") {
37110
+ return v;
37111
+ }
37112
+ let v1;
37113
+ if (typeof v !== "undefined") {
37114
+ v1 = parseWidth(v);
37115
+ if (isNaN(v1)) {
37116
+ v = 80;
37106
37117
  }
37107
37118
  }
37108
- return minWidth;
37119
+ return v1;
37109
37120
  };
37110
- const getRowIdentity = (row, rowKey) => {
37121
+ const getRowValue = (row, primaryKey) => {
37111
37122
  if (row.__KEY__) return row.__KEY__;
37112
37123
  if (!row) throw new VcError("table", "row is required when get row identity");
37113
- if (typeof rowKey === "string") {
37114
- if (!rowKey.includes(".")) {
37115
- return row[rowKey];
37124
+ if (typeof primaryKey === "string") {
37125
+ if (!primaryKey.includes(".")) {
37126
+ return row[primaryKey];
37116
37127
  }
37117
- const key = rowKey.split(".");
37128
+ const key = primaryKey.split(".");
37118
37129
  let current = row;
37119
37130
  for (let i = 0; i < key.length; i++) {
37120
37131
  current = current[key[i]];
37121
37132
  }
37122
37133
  return current;
37123
- } else if (typeof rowKey === "function") {
37124
- return rowKey.call(null, row);
37134
+ } else if (typeof primaryKey === "function") {
37135
+ return primaryKey.call(null, row);
37125
37136
  }
37126
37137
  };
37127
- const walkTreeNode = (root, cb, opts = {}) => {
37128
- const {
37129
- childrenKey = "children",
37130
- lazyKey = "hasChildren",
37131
- level: baseLevel = 0
37132
- } = opts;
37133
- const isNil = (array) => !(Array.isArray(array) && array.length);
37134
- function _walker(parent, children, level) {
37135
- cb(parent, children, level);
37136
- children.forEach((item) => {
37137
- if (item[lazyKey]) {
37138
- cb(item, null, level + 1);
37139
- return;
37140
- }
37141
- const $children = item[childrenKey];
37142
- if (!isNil($children)) {
37143
- _walker(item, $children, level + 1);
37144
- }
37145
- });
37146
- }
37147
- root.forEach((item) => {
37148
- if (item[lazyKey]) {
37149
- cb(item, null, baseLevel);
37150
- return;
37151
- }
37152
- const children = item[childrenKey];
37153
- if (!isNil(children)) {
37154
- _walker(item, children, baseLevel);
37155
- }
37156
- });
37157
- };
37158
- const getKeysMap = (array = [], rowKey) => {
37138
+ const getValuesMap = (array = [], primaryKey) => {
37159
37139
  const arrayMap = {};
37160
37140
  array.forEach((row, index) => {
37161
- arrayMap[getRowIdentity(row, rowKey)] = { row, index };
37141
+ arrayMap[getRowValue(row, primaryKey)] = { row, index };
37162
37142
  });
37163
37143
  return arrayMap;
37164
37144
  };
@@ -37171,23 +37151,74 @@ var Vc = (function (exports, vue) {
37171
37151
  });
37172
37152
  return column;
37173
37153
  };
37174
- const getColumnByCell = (table, cell) => {
37154
+ const getColumnByCell = (columns, cell) => {
37175
37155
  const matches = (cell.className || "").match(/vc-table_[^\s]+/gm);
37176
37156
  if (matches) {
37177
- return getColumnById(table, matches[0]);
37157
+ return getColumnById(columns, matches[0]);
37178
37158
  }
37179
37159
  return null;
37180
37160
  };
37181
- const getCell = (event2) => {
37182
- let cell = event2.target;
37161
+ const getCell = (e) => {
37162
+ let cell = e.target;
37183
37163
  while (cell && cell.tagName.toUpperCase() !== "HTML") {
37184
- if (cell.tagName.toUpperCase() === "TD") {
37164
+ if (cell.classList.contains("vc-table__td")) {
37185
37165
  return cell;
37186
37166
  }
37187
37167
  cell = cell.parentNode;
37188
37168
  }
37189
37169
  return null;
37190
37170
  };
37171
+ const getAllColumns = (columns) => {
37172
+ const result = [];
37173
+ columns.forEach((column) => {
37174
+ if (column.children) {
37175
+ result.push(column);
37176
+ result.push(...getAllColumns(column.children));
37177
+ } else {
37178
+ result.push(column);
37179
+ }
37180
+ });
37181
+ return result;
37182
+ };
37183
+ const columnsToRowsEffect = (v) => {
37184
+ let maxLevel = 1;
37185
+ const traverse = (column, parent) => {
37186
+ if (parent) {
37187
+ column.level = parent.level + 1;
37188
+ if (maxLevel < column.level) {
37189
+ maxLevel = column.level;
37190
+ }
37191
+ }
37192
+ if (column.children) {
37193
+ let colSpan = 0;
37194
+ column.children.forEach((subColumn) => {
37195
+ traverse(subColumn, column);
37196
+ colSpan += subColumn.colSpan;
37197
+ });
37198
+ column.colSpan = colSpan;
37199
+ } else {
37200
+ column.colSpan = 1;
37201
+ }
37202
+ };
37203
+ v.forEach((column) => {
37204
+ column.level = 1;
37205
+ traverse(column);
37206
+ });
37207
+ const rows = [];
37208
+ for (let i = 0; i < maxLevel; i++) {
37209
+ rows.push([]);
37210
+ }
37211
+ const allColumns = getAllColumns(v);
37212
+ allColumns.forEach((column) => {
37213
+ if (!column.children) {
37214
+ column.rowSpan = maxLevel - column.level + 1;
37215
+ } else {
37216
+ column.rowSpan = 1;
37217
+ }
37218
+ rows[column.level - 1].push(column);
37219
+ });
37220
+ return rows;
37221
+ };
37191
37222
  const flattenData = (data, opts = {}) => {
37192
37223
  const result = [];
37193
37224
  data.forEach((item) => {
@@ -37200,29 +37231,51 @@ var Vc = (function (exports, vue) {
37200
37231
  });
37201
37232
  return result;
37202
37233
  };
37234
+ const walkTreeNode = (root, cb, opts = {}) => {
37235
+ const {
37236
+ childrenKey = "children",
37237
+ lazyKey = "hasChildren",
37238
+ level: baseLevel = 0
37239
+ } = opts;
37240
+ const isNil = (array) => !(Array.isArray(array) && array.length);
37241
+ function _walker(parent, children, level) {
37242
+ cb(parent, children, level);
37243
+ children.forEach((item) => {
37244
+ if (item[lazyKey]) {
37245
+ cb(item, null, level + 1);
37246
+ return;
37247
+ }
37248
+ const $children = item[childrenKey];
37249
+ if (!isNil($children)) {
37250
+ _walker(item, $children, level + 1);
37251
+ }
37252
+ });
37253
+ }
37254
+ root.forEach((item) => {
37255
+ if (item[lazyKey]) {
37256
+ cb(item, null, baseLevel);
37257
+ return;
37258
+ }
37259
+ const children = item[childrenKey];
37260
+ if (!isNil(children)) {
37261
+ _walker(item, children, baseLevel);
37262
+ }
37263
+ });
37264
+ };
37203
37265
  class BaseWatcher {
37204
37266
  states = vue.reactive({
37205
37267
  // 渲染的数据来源,是对 table 中的 data 过滤排序后的结果
37206
37268
  _data: [],
37207
37269
  data: [],
37208
37270
  list: [],
37209
- // 是否包含固定列
37210
- isComplex: false,
37211
- // 列
37271
+ // 表头数据
37272
+ headerRows: [],
37273
+ // 列 动态收集vc-table-column中的columnConfig
37212
37274
  _columns: [],
37213
- // 动态收集vc-table-column中的columnConfig
37214
37275
  originColumns: [],
37215
- // leftFixedColumns, notFixedColumns, rightFixedColumns
37216
- columns: [],
37217
- // 包括 leftFixedLeafColumns,leafColumns,rightFixedLeafColumns
37276
+ notFixedColumns: [],
37218
37277
  leftFixedColumns: [],
37219
37278
  rightFixedColumns: [],
37220
- leafColumns: [],
37221
- leftFixedLeafColumns: [],
37222
- rightFixedLeafColumns: [],
37223
- leafColumnsLength: 0,
37224
- leftFixedLeafColumnsLength: 0,
37225
- rightFixedLeafColumnsLength: 0,
37226
37279
  // 选择
37227
37280
  isAllSelected: false,
37228
37281
  selection: [],
@@ -37244,7 +37297,17 @@ var Vc = (function (exports, vue) {
37244
37297
  treeLazyData: [],
37245
37298
  // 源数据展开
37246
37299
  treeLazyColumnIdentifier: "hasChildren",
37247
- treeChildrenColumnName: "children"
37300
+ treeChildrenColumnName: "children",
37301
+ // compputeds
37302
+ isComplex: vue.computed(() => this.states.leftFixedColumns.length > 0 || this.states.rightFixedColumns.length > 0),
37303
+ isGroup: vue.computed(() => this.states.columns.length > this.states.originColumns.length),
37304
+ columns: vue.computed(() => lodashExports.concat(this.states.leftFixedLeafColumns, this.states.leafColumns, this.states.rightFixedLeafColumns)),
37305
+ leafColumns: vue.computed(() => flattenData(this.states.notFixedColumns)),
37306
+ leftFixedLeafColumns: vue.computed(() => flattenData(this.states.leftFixedColumns)),
37307
+ rightFixedLeafColumns: vue.computed(() => flattenData(this.states.rightFixedColumns)),
37308
+ leafColumnsLength: vue.computed(() => this.states.leafColumns.length),
37309
+ leftFixedLeafColumnsLength: vue.computed(() => this.states.leftFixedLeafColumns.length),
37310
+ rightFixedLeafColumnsLength: vue.computed(() => this.states.rightFixedLeafColumns.length)
37248
37311
  });
37249
37312
  }
37250
37313
  class Expand {
@@ -37254,14 +37317,14 @@ var Vc = (function (exports, vue) {
37254
37317
  }
37255
37318
  update() {
37256
37319
  const store = this.store;
37257
- const { rowKey, defaultExpandAll } = this.store.table.props;
37320
+ const { primaryKey, defaultExpandAll } = this.store.table.props;
37258
37321
  const { data = [], expandRows } = store.states;
37259
37322
  if (defaultExpandAll) {
37260
37323
  store.states.expandRows = data.slice();
37261
- } else if (rowKey) {
37262
- const expandRowsMap = getKeysMap(expandRows, rowKey);
37324
+ } else if (primaryKey) {
37325
+ const expandRowsMap = getValuesMap(expandRows, primaryKey);
37263
37326
  store.states.expandRows = data.reduce((prev, row) => {
37264
- const rowId = getRowIdentity(row, rowKey);
37327
+ const rowId = getRowValue(row, primaryKey);
37265
37328
  const rowInfo = expandRowsMap[rowId];
37266
37329
  if (rowInfo) {
37267
37330
  prev.push(row);
@@ -37283,10 +37346,10 @@ var Vc = (function (exports, vue) {
37283
37346
  }
37284
37347
  reset(ids) {
37285
37348
  const store = this.store;
37286
- store.checkRowKey();
37287
- const { rowKey } = store.table.props;
37349
+ store.checkPrimaryKey();
37350
+ const { primaryKey } = store.table.props;
37288
37351
  const { data } = store.states;
37289
- const keysMap = getKeysMap(data, rowKey);
37352
+ const keysMap = getValuesMap(data, primaryKey);
37290
37353
  store.states.expandRows = ids.reduce((prev, cur) => {
37291
37354
  const info2 = keysMap[cur];
37292
37355
  if (info2) {
@@ -37296,11 +37359,11 @@ var Vc = (function (exports, vue) {
37296
37359
  }, []);
37297
37360
  }
37298
37361
  isExpanded(row) {
37299
- const { rowKey } = this.store.table.props;
37362
+ const { primaryKey } = this.store.table.props;
37300
37363
  const { expandRows = [] } = this.store.states;
37301
- if (rowKey) {
37302
- const expandMap = getKeysMap(expandRows, rowKey);
37303
- return !!expandMap[getRowIdentity(row, rowKey)];
37364
+ if (primaryKey) {
37365
+ const expandMap = getValuesMap(expandRows, primaryKey);
37366
+ return !!expandMap[getRowValue(row, primaryKey)];
37304
37367
  }
37305
37368
  return expandRows.indexOf(row) !== -1;
37306
37369
  }
@@ -37312,22 +37375,22 @@ var Vc = (function (exports, vue) {
37312
37375
  }
37313
37376
  reset(id) {
37314
37377
  const store = this.store;
37315
- const { rowKey } = store.table.props;
37316
- store.checkRowKey();
37378
+ const { primaryKey } = store.table.props;
37379
+ store.checkPrimaryKey();
37317
37380
  const { data = [] } = store.states;
37318
- const currentRow = data.find((item) => getRowIdentity(item, rowKey) === id);
37381
+ const currentRow = data.find((item) => getRowValue(item, primaryKey) === id);
37319
37382
  store.states.currentRow = currentRow || null;
37320
37383
  }
37321
37384
  update() {
37322
37385
  const store = this.store;
37323
- const { rowKey } = store.table.props;
37386
+ const { primaryKey } = store.table.props;
37324
37387
  const { data = [], currentRow } = store.states;
37325
37388
  const oldCurrentRow = currentRow;
37326
37389
  if (oldCurrentRow && !data.includes(oldCurrentRow)) {
37327
37390
  let newCurrentRow = null;
37328
- if (rowKey) {
37391
+ if (primaryKey) {
37329
37392
  newCurrentRow = data.find((item) => {
37330
- return getRowIdentity(item, rowKey) === getRowIdentity(oldCurrentRow, rowKey);
37393
+ return getRowValue(item, primaryKey) === getRowValue(oldCurrentRow, primaryKey);
37331
37394
  });
37332
37395
  }
37333
37396
  store.states.currentRow = newCurrentRow;
@@ -37345,8 +37408,8 @@ var Vc = (function (exports, vue) {
37345
37408
  * { id: { level, children } }
37346
37409
  */
37347
37410
  normalizedData = vue.computed(() => {
37348
- const { rowKey } = this.store.table.props;
37349
- if (!rowKey) return {};
37411
+ const { primaryKey } = this.store.table.props;
37412
+ if (!primaryKey) return {};
37350
37413
  return this.normalize(this.store.states.data || []);
37351
37414
  });
37352
37415
  /**
@@ -37354,7 +37417,7 @@ var Vc = (function (exports, vue) {
37354
37417
  * { id: { children } }
37355
37418
  */
37356
37419
  normalizedLazyNode = vue.computed(() => {
37357
- const { rowKey } = this.store.table.props;
37420
+ const { primaryKey } = this.store.table.props;
37358
37421
  const { treelazyNodeMap, treeLazyColumnIdentifier, treeChildrenColumnName } = this.store.states;
37359
37422
  const keys = Object.keys(treelazyNodeMap);
37360
37423
  const res = {};
@@ -37363,7 +37426,7 @@ var Vc = (function (exports, vue) {
37363
37426
  if (treelazyNodeMap[key].length) {
37364
37427
  const item = { children: [] };
37365
37428
  treelazyNodeMap[key].forEach((row) => {
37366
- const id = getRowIdentity(row, rowKey);
37429
+ const id = getRowValue(row, primaryKey);
37367
37430
  item.children.push(id);
37368
37431
  const hasChildren = row[treeLazyColumnIdentifier] || row[treeChildrenColumnName] && row[treeChildrenColumnName].length === 0;
37369
37432
  if (hasChildren && !res[id]) {
@@ -37383,16 +37446,16 @@ var Vc = (function (exports, vue) {
37383
37446
  );
37384
37447
  }
37385
37448
  normalize(data) {
37386
- const { rowKey } = this.store.table.props;
37449
+ const { primaryKey } = this.store.table.props;
37387
37450
  const { treeChildrenColumnName, treeLazyColumnIdentifier, treeLazy } = this.store.states;
37388
37451
  const res = {};
37389
37452
  walkTreeNode(
37390
37453
  data,
37391
37454
  (parent, children, level) => {
37392
- const parentId = getRowIdentity(parent, rowKey);
37455
+ const parentId = getRowValue(parent, primaryKey);
37393
37456
  if (Array.isArray(children)) {
37394
37457
  res[parentId] = {
37395
- children: children.map((row) => getRowIdentity(row, rowKey)),
37458
+ children: children.map((row) => getRowValue(row, primaryKey)),
37396
37459
  level
37397
37460
  };
37398
37461
  } else if (treeLazy) {
@@ -37412,7 +37475,7 @@ var Vc = (function (exports, vue) {
37412
37475
  }
37413
37476
  // 获取当前展开最大的level
37414
37477
  getMaxLevel() {
37415
- const { rowKey } = this.store.table.props;
37478
+ const { primaryKey } = this.store.table.props;
37416
37479
  const { data, treeData } = this.store.states;
37417
37480
  const levels = data.map((item) => {
37418
37481
  const traverse = (source) => {
@@ -37423,7 +37486,7 @@ var Vc = (function (exports, vue) {
37423
37486
  return source.level;
37424
37487
  }
37425
37488
  };
37426
- const id = getRowIdentity(item, rowKey);
37489
+ const id = getRowValue(item, primaryKey);
37427
37490
  return traverse(treeData[id]);
37428
37491
  });
37429
37492
  return max$2(levels) || 0;
@@ -37485,10 +37548,10 @@ var Vc = (function (exports, vue) {
37485
37548
  this.update();
37486
37549
  }
37487
37550
  toggle(row, expanded) {
37488
- this.store.checkRowKey();
37489
- const { rowKey } = this.store.table.props;
37551
+ this.store.checkPrimaryKey();
37552
+ const { primaryKey } = this.store.table.props;
37490
37553
  const { treeData } = this.store.states;
37491
- const id = getRowIdentity(row, rowKey);
37554
+ const id = getRowValue(row, primaryKey);
37492
37555
  const data = id && treeData[id];
37493
37556
  if (id && data && "expanded" in data) {
37494
37557
  const oldExpanded = data.expanded;
@@ -37501,10 +37564,10 @@ var Vc = (function (exports, vue) {
37501
37564
  }
37502
37565
  }
37503
37566
  loadOrToggle(row) {
37504
- this.store.checkRowKey();
37505
- const { rowKey } = this.store.table.props;
37567
+ this.store.checkPrimaryKey();
37568
+ const { primaryKey } = this.store.table.props;
37506
37569
  const { treeLazy, treeData } = this.store.states;
37507
- const id = getRowIdentity(row, rowKey);
37570
+ const id = getRowValue(row, primaryKey);
37508
37571
  const data = treeData[id];
37509
37572
  if (treeLazy && data && "loaded" in data && !data.loaded) {
37510
37573
  this.loadData(row, id, data);
@@ -37513,9 +37576,9 @@ var Vc = (function (exports, vue) {
37513
37576
  }
37514
37577
  }
37515
37578
  loadData(row, key, treeNode) {
37516
- this.store.checkRowKey();
37579
+ this.store.checkPrimaryKey();
37517
37580
  const { table } = this.store;
37518
- const { rowKey } = table.props;
37581
+ const { primaryKey } = table.props;
37519
37582
  const { treelazyNodeMap, treeData, treeChildrenColumnName, treeLazyColumnIdentifier } = this.store.states;
37520
37583
  if (table.props.loadExpand && !treeData[key].loaded) {
37521
37584
  this.store.states.treeData[key].loading = true;
@@ -37530,7 +37593,7 @@ var Vc = (function (exports, vue) {
37530
37593
  walkTreeNode(
37531
37594
  data,
37532
37595
  (parent, _, level) => {
37533
- const id = getRowIdentity(parent, rowKey);
37596
+ const id = getRowValue(parent, primaryKey);
37534
37597
  Object.defineProperty(parent, "__KEY__", {
37535
37598
  value: `${level}__${id}`,
37536
37599
  writable: false
@@ -37599,27 +37662,13 @@ var Vc = (function (exports, vue) {
37599
37662
  if (!this.store) {
37600
37663
  throw new VcError("table", "Table Layout 必须包含store实例");
37601
37664
  }
37602
- this.updateScroller = this.updateScroller.bind(this);
37603
- this.updateColumns = this.updateColumns.bind(this);
37604
- vue.onMounted(() => {
37605
- this.updateColumns();
37606
- this.updateScroller();
37607
- });
37608
- let __updated__;
37609
- vue.onUpdated(() => {
37610
- if (__updated__) return;
37611
- this.updateColumns();
37612
- this.updateScroller();
37613
- __updated__ = true;
37614
- });
37615
37665
  }
37616
37666
  updateScrollY() {
37617
37667
  const { height, bodyHeight } = this.states;
37618
37668
  if (height === null || bodyHeight === null) return;
37619
- const scroller = this.table.exposed.scroller.value;
37620
- if (this.table.vnode.el && scroller) {
37621
- const body = scroller.$el.querySelector(".vc-table__body");
37622
- this.states.scrollY = body.offsetHeight > bodyHeight;
37669
+ const bodyYWrapper = this.table.exposed.bodyYWrapper.value;
37670
+ if (this.table.vnode.el && bodyYWrapper) {
37671
+ this.states.scrollY = bodyYWrapper.offsetHeight > bodyHeight;
37623
37672
  }
37624
37673
  }
37625
37674
  setHeight(value, prop = "height") {
@@ -37636,18 +37685,6 @@ var Vc = (function (exports, vue) {
37636
37685
  setMaxHeight(value) {
37637
37686
  this.setHeight(value, "max-height");
37638
37687
  }
37639
- getFlattenColumns() {
37640
- const flattenColumns = [];
37641
- const columns = this.store.states.columns;
37642
- columns.forEach((column) => {
37643
- if (column.isColumnGroup) {
37644
- flattenColumns.push(...column.columns);
37645
- } else {
37646
- flattenColumns.push(column);
37647
- }
37648
- });
37649
- return flattenColumns;
37650
- }
37651
37688
  updateElsHeight() {
37652
37689
  if (!this.table.exposed.isReady.value) return vue.nextTick(() => this.updateElsHeight());
37653
37690
  const table = this.table.exposed;
@@ -37670,13 +37707,12 @@ var Vc = (function (exports, vue) {
37670
37707
  this.states.bodyHeight = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
37671
37708
  }
37672
37709
  this.updateScrollY();
37673
- this.updateScroller();
37674
37710
  }
37675
37711
  updateColumnsWidth() {
37676
37712
  if (IS_SERVER$3) return;
37677
37713
  const bodyWidth = this.table.vnode.el.clientWidth;
37678
37714
  let bodyMinWidth = 0;
37679
- const flattenColumns = this.getFlattenColumns();
37715
+ const flattenColumns = this.store.states.columns;
37680
37716
  const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
37681
37717
  const { fit } = this.table.props;
37682
37718
  if (flexColumns.length > 0 && fit) {
@@ -37702,7 +37738,7 @@ var Vc = (function (exports, vue) {
37702
37738
  }
37703
37739
  } else {
37704
37740
  this.states.scrollX = true;
37705
- flexColumns.forEach(function(column) {
37741
+ flexColumns.forEach((column) => {
37706
37742
  column.realWidth = column.width || column.minWidth;
37707
37743
  });
37708
37744
  }
@@ -37736,12 +37772,6 @@ var Vc = (function (exports, vue) {
37736
37772
  });
37737
37773
  this.states.rightFixedWidth = rightFixedWidth;
37738
37774
  }
37739
- this.updateColumns();
37740
- }
37741
- // v2.x中的 notifyObservers
37742
- updateColumns() {
37743
- }
37744
- updateScroller() {
37745
37775
  }
37746
37776
  }
37747
37777
  class Store extends BaseWatcher {
@@ -37750,7 +37780,7 @@ var Vc = (function (exports, vue) {
37750
37780
  expand;
37751
37781
  tree;
37752
37782
  layout;
37753
- flattenData = vue.computed(() => {
37783
+ flatData = vue.computed(() => {
37754
37784
  if (this.table.props.expandSelectable) {
37755
37785
  return lodashExports.concat(
37756
37786
  flattenData(this.states.data, { parent: true, cascader: true }),
@@ -37808,7 +37838,7 @@ var Vc = (function (exports, vue) {
37808
37838
  this.cleanSelection();
37809
37839
  }
37810
37840
  } else {
37811
- this.checkRowKey();
37841
+ this.checkPrimaryKey();
37812
37842
  this.updateSelectionByRowKey();
37813
37843
  }
37814
37844
  this.updateAllSelected();
@@ -37830,10 +37860,10 @@ var Vc = (function (exports, vue) {
37830
37860
  }
37831
37861
  }
37832
37862
  /**
37833
- * 检查 rowKey 是否存在
37863
+ * 检查 primaryKey 是否存在
37834
37864
  */
37835
- checkRowKey() {
37836
- const { rowKey } = this.table.props;
37865
+ checkPrimaryKey() {
37866
+ const { primaryKey } = this.table.props;
37837
37867
  }
37838
37868
  /**
37839
37869
  * states
@@ -37894,22 +37924,20 @@ var Vc = (function (exports, vue) {
37894
37924
  updateColumns() {
37895
37925
  const { states } = this;
37896
37926
  const _columns = states._columns || [];
37897
- states.leftFixedColumns = _columns.filter((column) => column.fixed === true || column.fixed === "left");
37898
- states.rightFixedColumns = _columns.filter((column) => column.fixed === "right");
37899
- if (states.leftFixedColumns.length > 0 && _columns[0] && _columns[0].type === "selection" && !_columns[0].fixed) {
37927
+ const leftFixedColumns = _columns.filter((column) => column.fixed === true || column.fixed === "left");
37928
+ const rightFixedColumns = _columns.filter((column) => column.fixed === "right");
37929
+ if (leftFixedColumns.length > 0 && _columns[0] && _columns[0].type === "selection" && !_columns[0].fixed) {
37900
37930
  _columns[0].fixed = true;
37901
- states.leftFixedColumns.unshift(_columns[0]);
37931
+ leftFixedColumns.unshift(_columns[0]);
37902
37932
  }
37903
37933
  const notFixedColumns = _columns.filter((column) => !column.fixed);
37904
- states.originColumns = lodashExports.concat(states.leftFixedColumns, notFixedColumns, states.rightFixedColumns);
37905
- const leafColumns = flattenData(notFixedColumns);
37906
- const leftFixedLeafColumns = flattenData(states.leftFixedColumns);
37907
- const rightFixedLeafColumns = flattenData(states.rightFixedColumns);
37908
- states.leafColumnsLength = leafColumns.length;
37909
- states.leftFixedLeafColumnsLength = leftFixedLeafColumns.length;
37910
- states.rightFixedLeafColumnsLength = rightFixedLeafColumns.length;
37911
- states.columns = lodashExports.concat(leftFixedLeafColumns, leafColumns, rightFixedLeafColumns);
37912
- states.isComplex = states.leftFixedColumns.length > 0 || states.rightFixedColumns.length > 0;
37934
+ const originColumns = lodashExports.concat(leftFixedColumns, notFixedColumns, rightFixedColumns);
37935
+ const headerRows = columnsToRowsEffect(originColumns);
37936
+ states.leftFixedColumns = leftFixedColumns;
37937
+ states.notFixedColumns = notFixedColumns;
37938
+ states.rightFixedColumns = rightFixedColumns;
37939
+ states.originColumns = originColumns;
37940
+ states.headerRows = headerRows;
37913
37941
  }
37914
37942
  // 选择
37915
37943
  isSelected(row) {
@@ -37933,13 +37961,13 @@ var Vc = (function (exports, vue) {
37933
37961
  * 清理选择
37934
37962
  */
37935
37963
  cleanSelection() {
37936
- const { rowKey } = this.table.props;
37964
+ const { primaryKey } = this.table.props;
37937
37965
  const { selection = [] } = this.states;
37938
37966
  let deleted;
37939
- if (rowKey) {
37967
+ if (primaryKey) {
37940
37968
  deleted = [];
37941
- const selectedMap = getKeysMap(selection, rowKey);
37942
- const dataMap = getKeysMap(selection, rowKey);
37969
+ const selectedMap = getValuesMap(selection, primaryKey);
37970
+ const dataMap = getValuesMap(selection, primaryKey);
37943
37971
  for (const key in selectedMap) {
37944
37972
  if (hasOwn$1(selectedMap, key) && !dataMap[key]) {
37945
37973
  deleted.push(selectedMap[key].row);
@@ -37947,7 +37975,7 @@ var Vc = (function (exports, vue) {
37947
37975
  }
37948
37976
  } else {
37949
37977
  deleted = selection.filter((item) => {
37950
- return !this.flattenData.value.includes(item);
37978
+ return !this.flatData.value.includes(item);
37951
37979
  });
37952
37980
  }
37953
37981
  deleted.forEach((deletedItem) => {
@@ -38008,7 +38036,7 @@ var Vc = (function (exports, vue) {
38008
38036
  const value = indeterminate ? !isAllSelected : !(isAllSelected || selection.length);
38009
38037
  this.states.isAllSelected = value;
38010
38038
  let selectionChanged = false;
38011
- this.flattenData.value.forEach((row, index) => {
38039
+ this.flatData.value.forEach((row, index) => {
38012
38040
  if (selectable) {
38013
38041
  if (selectable.call(null, row, index) && this.toggleRowStatus(selection, row, value)) {
38014
38042
  selectionChanged = true;
@@ -38039,11 +38067,11 @@ var Vc = (function (exports, vue) {
38039
38067
  this.tree.expand(val);
38040
38068
  }
38041
38069
  updateSelectionByRowKey() {
38042
- const { rowKey } = this.table.props;
38070
+ const { primaryKey } = this.table.props;
38043
38071
  const { selection } = this.states;
38044
- const selectedMap = getKeysMap(selection, rowKey);
38045
- this.states.selection = this.flattenData.value.reduce((prev, row) => {
38046
- const rowId = getRowIdentity(row, rowKey);
38072
+ const selectedMap = getValuesMap(selection, primaryKey);
38073
+ this.states.selection = this.flatData.value.reduce((prev, row) => {
38074
+ const rowId = getRowValue(row, primaryKey);
38047
38075
  const rowInfo = selectedMap[rowId];
38048
38076
  if (rowInfo) {
38049
38077
  prev.push(row);
@@ -38059,7 +38087,7 @@ var Vc = (function (exports, vue) {
38059
38087
  }
38060
38088
  let isAllSelected = true;
38061
38089
  let selectedCount = 0;
38062
- const temp = this.flattenData.value;
38090
+ const temp = this.flatData.value;
38063
38091
  for (let i = 0, j = temp.length; i < j; i++) {
38064
38092
  const row = temp[i];
38065
38093
  const isRowSelectable = selectable && selectable.call(null, row, i);
@@ -38169,6 +38197,7 @@ var Vc = (function (exports, vue) {
38169
38197
  type
38170
38198
  }) => type === "default")
38171
38199
  });
38200
+ const wrapper = vue.ref();
38172
38201
  vue.watch(() => props2.store.states.hoverRowIndex, (v, oldV) => {
38173
38202
  if (!props2.store.states.isComplex || IS_SERVER$3) return;
38174
38203
  raf(() => {
@@ -38179,12 +38208,12 @@ var Vc = (function (exports, vue) {
38179
38208
  newRow && addClass(newRow, "hover-row");
38180
38209
  });
38181
38210
  });
38182
- const getKeyOfRow = (row, index) => {
38211
+ const getValueOfRow = (row, index) => {
38183
38212
  const {
38184
- rowKey
38213
+ primaryKey
38185
38214
  } = table.props;
38186
- if (rowKey) {
38187
- return getRowIdentity(row, rowKey);
38215
+ if (primaryKey) {
38216
+ return getRowValue(row, primaryKey);
38188
38217
  }
38189
38218
  return index;
38190
38219
  };
@@ -38249,7 +38278,7 @@ var Vc = (function (exports, vue) {
38249
38278
  return cellStyle;
38250
38279
  };
38251
38280
  const getCellClass = (rowIndex, columnIndex, row, column) => {
38252
- const classes = [column.align, column.className];
38281
+ const classes = [column.realAlign, column.className];
38253
38282
  if (isColumnHidden(columnIndex)) {
38254
38283
  classes.push("is-hidden");
38255
38284
  }
@@ -38305,7 +38334,7 @@ var Vc = (function (exports, vue) {
38305
38334
  const cell = getCell(e);
38306
38335
  if (!cell) return;
38307
38336
  const oldHoverState = table.exposed.hoverState.value || {};
38308
- table.emit("cell-mouse-leave", oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
38337
+ table.emit("cell-mouse-leave", oldHoverState.row, oldHoverState.column, oldHoverState.cell, e);
38309
38338
  };
38310
38339
  const handleMouseEnter = debounce$1((index) => {
38311
38340
  props2.store.setHoverRow(index);
@@ -38341,7 +38370,7 @@ var Vc = (function (exports, vue) {
38341
38370
  const {
38342
38371
  columns
38343
38372
  } = states;
38344
- const key = getKeyOfRow(row, rowIndex);
38373
+ const key = getValueOfRow(row, rowIndex);
38345
38374
  return vue.createVNode("div", {
38346
38375
  "key": key,
38347
38376
  "class": [getRowClass(row, rowIndex), "vc-table__tr"],
@@ -38405,13 +38434,12 @@ var Vc = (function (exports, vue) {
38405
38434
  }
38406
38435
  });
38407
38436
  };
38408
- const wrapper = vue.ref();
38409
38437
  expose({
38410
38438
  wrapper,
38411
38439
  getRootElement: () => instance.vnode.el
38412
38440
  });
38441
+ const layout = table.exposed.layout;
38413
38442
  return () => {
38414
- const layout = table.exposed.layout;
38415
38443
  return vue.createVNode("div", {
38416
38444
  "class": "vc-table__body"
38417
38445
  }, [table.props.height ? vue.createVNode(RecycleList, {
@@ -38456,57 +38484,6 @@ var Vc = (function (exports, vue) {
38456
38484
  });
38457
38485
  const TableSort = "div";
38458
38486
  const TableFilter = "div";
38459
- const getAllColumns = (columns) => {
38460
- const result = [];
38461
- columns.forEach((column) => {
38462
- if (column.children) {
38463
- result.push(column);
38464
- result.push(...getAllColumns(column.children));
38465
- } else {
38466
- result.push(column);
38467
- }
38468
- });
38469
- return result;
38470
- };
38471
- const convertToRows = (originColumns) => {
38472
- let maxLevel = 1;
38473
- const traverse = (column, parent) => {
38474
- if (parent) {
38475
- column.level = parent.level + 1;
38476
- if (maxLevel < column.level) {
38477
- maxLevel = column.level;
38478
- }
38479
- }
38480
- if (column.children) {
38481
- let colSpan = 0;
38482
- column.children.forEach((subColumn) => {
38483
- traverse(subColumn, column);
38484
- colSpan += subColumn.colSpan;
38485
- });
38486
- column.colSpan = colSpan;
38487
- } else {
38488
- column.colSpan = 1;
38489
- }
38490
- };
38491
- originColumns.forEach((column) => {
38492
- column.level = 1;
38493
- traverse(column);
38494
- });
38495
- const rows = [];
38496
- for (let i = 0; i < maxLevel; i++) {
38497
- rows.push([]);
38498
- }
38499
- const allColumns = getAllColumns(originColumns);
38500
- allColumns.forEach((column) => {
38501
- if (!column.children) {
38502
- column.rowSpan = maxLevel - column.level + 1;
38503
- } else {
38504
- column.rowSpan = 1;
38505
- }
38506
- rows[column.level - 1].push(column);
38507
- });
38508
- return rows;
38509
- };
38510
38487
  const TableHeader = /* @__PURE__ */ vue.defineComponent({
38511
38488
  name: "vc-table-header",
38512
38489
  props: {
@@ -38533,16 +38510,18 @@ var Vc = (function (exports, vue) {
38533
38510
  isAllSelected: "isAllSelected",
38534
38511
  leftFixedLeafCount: "leftFixedLeafColumnsLength",
38535
38512
  rightFixedLeafCount: "rightFixedLeafColumnsLength",
38513
+ isGroup: "isGroup",
38514
+ headerRows: "headerRows",
38536
38515
  columnsCount: ($states) => $states.columns.length,
38537
38516
  leftFixedCount: ($states) => $states.leftFixedColumns.length,
38538
38517
  rightFixedCount: ($states) => $states.rightFixedColumns.length
38539
38518
  });
38540
- const isCellHidden = (index, columns) => {
38519
+ const isColumnHidden = (index) => {
38541
38520
  let start = 0;
38542
38521
  for (let i = 0; i < index; i++) {
38543
- start += columns[i].colSpan;
38522
+ start += states.columns[i].colSpan;
38544
38523
  }
38545
- const after = start + columns[index].colSpan - 1;
38524
+ const after = start + states.columns[index].colSpan - 1;
38546
38525
  if (props2.fixed === true || props2.fixed === "left") {
38547
38526
  return after >= states.leftFixedLeafCount;
38548
38527
  } else if (props2.fixed === "right") {
@@ -38551,6 +38530,9 @@ var Vc = (function (exports, vue) {
38551
38530
  return after < states.leftFixedLeafCount || start >= states.columnsCount - states.rightFixedLeafCount;
38552
38531
  }
38553
38532
  };
38533
+ const columnsHidden = vue.computed(() => {
38534
+ return states.columns.map((_, index) => isColumnHidden(index));
38535
+ });
38554
38536
  const getHeaderRowStyle = (rowIndex) => {
38555
38537
  const {
38556
38538
  headerRowStyle
@@ -38591,8 +38573,8 @@ var Vc = (function (exports, vue) {
38591
38573
  return headerCellStyle;
38592
38574
  };
38593
38575
  const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
38594
- const classes = [column.id, column.order, column.headerAlign, column.className, column.labelClass];
38595
- if (rowIndex === 0 && isCellHidden(columnIndex, row)) {
38576
+ const classes = [column.id, column.order, column.realHeaderAlign, column.className, column.labelClass];
38577
+ if (rowIndex === 0 && columnsHidden.value[columnIndex]) {
38596
38578
  classes.push("is-hidden");
38597
38579
  }
38598
38580
  if (!column.children) {
@@ -38731,35 +38713,27 @@ var Vc = (function (exports, vue) {
38731
38713
  });
38732
38714
  };
38733
38715
  return () => {
38734
- const {
38735
- originColumns
38736
- } = props2.store.states;
38737
- const columnRows = convertToRows(originColumns);
38738
- const isGroup = columnRows.length > 1;
38739
- if (isGroup) table.exposed.isGroup.value = true;
38740
38716
  return vue.createVNode("div", {
38741
38717
  "class": "vc-table__header"
38742
38718
  }, [vue.createVNode("div", {
38743
38719
  "class": [{
38744
- "is-group": isGroup
38720
+ "is-group": states.isGroup
38745
38721
  }, "vc-table__thead"]
38746
38722
  }, [
38747
38723
  // renderList
38748
- columnRows.map((columns, rowIndex) => vue.createVNode("div", {
38724
+ states.headerRows.map((columns, rowIndex) => vue.createVNode("div", {
38749
38725
  "style": getHeaderRowStyle(rowIndex),
38750
38726
  "class": [getHeaderRowClass(rowIndex), "vc-table__tr"]
38751
- }, [columns.map((column, cellIndex) => vue.createVNode("div", {
38752
- "colspan": column.colSpan,
38753
- "rowspan": column.rowSpan,
38754
- "onMousemove": ($event) => handleMouseMove($event, column),
38727
+ }, [columns.map((column, columnIndex) => vue.createVNode("div", {
38728
+ "onMousemove": (e) => handleMouseMove(e, column),
38755
38729
  "onMouseout": handleMouseOut,
38756
- "onMousedown": ($event) => handleMouseDown($event, column),
38757
- "onClick": ($event) => handleHeaderClick($event, column),
38758
- "onContextmenu": ($event) => handleHeaderContextMenu($event, column),
38759
- "style": [getHeaderCellStyle(rowIndex, cellIndex, columns, column), {
38730
+ "onMousedown": (e) => handleMouseDown(e, column),
38731
+ "onClick": (e) => handleHeaderClick(e, column),
38732
+ "onContextmenu": (e) => handleHeaderContextMenu(e, column),
38733
+ "style": [getHeaderCellStyle(rowIndex, columnIndex, columns, column), {
38760
38734
  width: `${column.realWidth}px`
38761
38735
  }],
38762
- "class": [getHeaderCellClass(rowIndex, cellIndex, columns, column), "vc-table__th"],
38736
+ "class": [getHeaderCellClass(rowIndex, columnIndex, columns, column), "vc-table__th"],
38763
38737
  "key": column.id
38764
38738
  }, [vue.createVNode("div", {
38765
38739
  "class": [
@@ -38771,10 +38745,8 @@ var Vc = (function (exports, vue) {
38771
38745
  ]
38772
38746
  }, [column.renderHeader ? column.renderHeader({
38773
38747
  column,
38774
- $index: cellIndex,
38775
- // index: cellIndex,
38776
- store: props2.store,
38777
- _self: instance
38748
+ columnIndex,
38749
+ store: props2.store
38778
38750
  }) : column.label, column.tooltip ? vue.createVNode(Icon, {
38779
38751
  "type": "o-info",
38780
38752
  "onMouseenter": (e) => handleCellMouseEnter(e, column)
@@ -38816,13 +38788,13 @@ var Vc = (function (exports, vue) {
38816
38788
  leftFixedCount: ($states) => $states.leftFixedColumns.length,
38817
38789
  rightFixedCount: ($states) => $states.rightFixedColumns.length
38818
38790
  });
38819
- const isCellHidden = (index, columns, column) => {
38791
+ const isColumnHidden = (column, index) => {
38820
38792
  if (props2.fixed === true || props2.fixed === "left") {
38821
38793
  return index >= states.leftFixedLeafCount;
38822
38794
  } else if (props2.fixed === "right") {
38823
38795
  let before = 0;
38824
38796
  for (let i = 0; i < index; i++) {
38825
- before += columns[i].colSpan;
38797
+ before += states.columns[i].colSpan;
38826
38798
  }
38827
38799
  return before < states.columnsCount - states.rightFixedLeafCount;
38828
38800
  } else if (!props2.fixed && column.fixed) {
@@ -38831,12 +38803,13 @@ var Vc = (function (exports, vue) {
38831
38803
  return index < states.leftFixedCount || index >= states.columnsCount - states.rightFixedCount;
38832
38804
  }
38833
38805
  };
38834
- const getRowClasses = (column, cellIndex) => {
38835
- const classes = [column.id, column.align, column.labelClass];
38806
+ const columnsHidden = vue.computed(() => states.columns.map(isColumnHidden));
38807
+ const getRowClasses = (column, columnIndex) => {
38808
+ const classes = [column.realAlign, column.labelClass];
38836
38809
  if (column.className) {
38837
38810
  classes.push(column.className);
38838
38811
  }
38839
- if (isCellHidden(cellIndex, states.columns, column)) {
38812
+ if (columnsHidden.value[columnIndex]) {
38840
38813
  classes.push("is-hidden");
38841
38814
  }
38842
38815
  if (!column.children) {
@@ -38844,17 +38817,17 @@ var Vc = (function (exports, vue) {
38844
38817
  }
38845
38818
  return classes;
38846
38819
  };
38847
- return () => {
38848
- let sums = [];
38820
+ const sums = vue.computed(() => {
38821
+ let v = [];
38849
38822
  if (props2.getSummary) {
38850
- sums = props2.getSummary({
38823
+ v = props2.getSummary({
38851
38824
  columns: states.columns,
38852
38825
  data: states.data
38853
38826
  });
38854
38827
  } else {
38855
38828
  states.columns.forEach((column, index) => {
38856
38829
  if (index === 0) {
38857
- sums[index] = props2.sumText;
38830
+ v[index] = props2.sumText;
38858
38831
  return;
38859
38832
  }
38860
38833
  const values = states.data.map((item) => Number(item[column.prop]));
@@ -38869,7 +38842,7 @@ var Vc = (function (exports, vue) {
38869
38842
  });
38870
38843
  const precision = Math.max.apply(null, precisions);
38871
38844
  if (!notNumber) {
38872
- sums[index] = values.reduce((prev, curr) => {
38845
+ v[index] = values.reduce((prev, curr) => {
38873
38846
  const value = Number(curr);
38874
38847
  if (!isNaN(value)) {
38875
38848
  return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
@@ -38878,10 +38851,13 @@ var Vc = (function (exports, vue) {
38878
38851
  }
38879
38852
  }, 0);
38880
38853
  } else {
38881
- sums[index] = "";
38854
+ v[index] = "";
38882
38855
  }
38883
38856
  });
38884
38857
  }
38858
+ return v;
38859
+ });
38860
+ return () => {
38885
38861
  return vue.createVNode("div", {
38886
38862
  "class": "vc-table__footer",
38887
38863
  "cellspacing": "0",
@@ -38891,17 +38867,15 @@ var Vc = (function (exports, vue) {
38891
38867
  "class": "vc-table__tbody"
38892
38868
  }, [vue.createVNode("div", {
38893
38869
  "class": "vc-table__tr"
38894
- }, [states.columns.map((column, cellIndex) => vue.createVNode("div", {
38895
- "key": cellIndex,
38896
- "colspan": column.colSpan,
38897
- "rowspan": column.rowSpan,
38898
- "class": [getRowClasses(column, cellIndex), "vc-table__td"],
38870
+ }, [states.columns.map((column, columnIndex) => vue.createVNode("div", {
38871
+ "key": columnIndex,
38872
+ "class": [getRowClasses(column, columnIndex), "vc-table__td"],
38899
38873
  "style": [{
38900
38874
  width: `${column.realWidth}px`
38901
38875
  }]
38902
38876
  }, [vue.createVNode("div", {
38903
38877
  "class": ["vc-table__cell", column.labelClass]
38904
- }, [sums[cellIndex]])]))])])]);
38878
+ }, [sums.value[columnIndex]])]))])])]);
38905
38879
  };
38906
38880
  }
38907
38881
  });
@@ -38928,7 +38902,7 @@ var Vc = (function (exports, vue) {
38928
38902
  type: Number,
38929
38903
  default: 10
38930
38904
  },
38931
- rowKey: [String, Function],
38905
+ primaryKey: [String, Function],
38932
38906
  // 是否显示表头
38933
38907
  showHeader: {
38934
38908
  type: Boolean,
@@ -39038,21 +39012,21 @@ var Vc = (function (exports, vue) {
39038
39012
  const rightFixedBody = vue.ref(null);
39039
39013
  const rightFixedFooterWrapper = vue.ref(null);
39040
39014
  const resizeProxy = vue.ref(null);
39041
- const isGroup = vue.ref(false);
39042
39015
  const scrollPosition = vue.ref("left");
39043
39016
  const hoverState = vue.ref(null);
39044
39017
  const isReady = vue.ref(false);
39045
39018
  const states = useStates({
39046
39019
  columns: "columns",
39047
39020
  leftFixedColumns: "leftFixedColumns",
39048
- rightFixedColumns: "rightFixedColumns"
39021
+ rightFixedColumns: "rightFixedColumns",
39022
+ isGroup: "isGroup"
39049
39023
  }, store);
39050
39024
  const classes = vue.computed(() => {
39051
39025
  return {
39052
39026
  "vc-table--fit": props2.fit,
39053
39027
  "vc-table--striped": props2.stripe,
39054
- "vc-table--border": props2.border || isGroup.value,
39055
- "vc-table--group": isGroup.value,
39028
+ "vc-table--border": props2.border || states.isGroup,
39029
+ "vc-table--group": states.isGroup,
39056
39030
  "vc-table--fluid-height": props2.maxHeight,
39057
39031
  "vc-table--scrollable-x": layout.states.scrollX,
39058
39032
  "vc-table--scrollable-y": layout.states.scrollY,
@@ -39296,7 +39270,7 @@ var Vc = (function (exports, vue) {
39296
39270
  immediate: true
39297
39271
  });
39298
39272
  vue.watch(() => props2.currentRowValue, (v) => {
39299
- if (!props2.rowKey) return;
39273
+ if (!props2.primaryKey) return;
39300
39274
  store.current.reset(v);
39301
39275
  }, {
39302
39276
  immediate: true
@@ -39323,6 +39297,7 @@ var Vc = (function (exports, vue) {
39323
39297
  }, {
39324
39298
  immediate: true
39325
39299
  });
39300
+ const tableId = getUid("table");
39326
39301
  vue.onMounted(() => {
39327
39302
  bindEvents();
39328
39303
  store.updateColumns();
@@ -39333,12 +39308,13 @@ var Vc = (function (exports, vue) {
39333
39308
  };
39334
39309
  isReady.value = true;
39335
39310
  });
39336
- vue.onBeforeUnmount(() => {
39311
+ vue.onUnmounted(() => {
39337
39312
  isUnMount = true;
39338
39313
  unbindEvents();
39339
39314
  });
39340
- const tableId = getUid("table");
39341
39315
  expose({
39316
+ bodyXWrapper,
39317
+ bodyYWrapper,
39342
39318
  tableId,
39343
39319
  store,
39344
39320
  layout,
@@ -39507,22 +39483,19 @@ var Vc = (function (exports, vue) {
39507
39483
  order: ""
39508
39484
  },
39509
39485
  selection: {
39510
- width: 48,
39511
- minWidth: 48,
39512
- realWidth: 48,
39486
+ width: 60,
39487
+ minWidth: 60,
39513
39488
  order: "",
39514
39489
  className: "vc-table-column--selection"
39515
39490
  },
39516
39491
  expand: {
39517
- width: 48,
39518
- minWidth: 48,
39519
- realWidth: 48,
39492
+ width: 60,
39493
+ minWidth: 60,
39520
39494
  order: ""
39521
39495
  },
39522
39496
  index: {
39523
- width: 48,
39524
- minWidth: 48,
39525
- realWidth: 48,
39497
+ width: 60,
39498
+ minWidth: 60,
39526
39499
  order: ""
39527
39500
  }
39528
39501
  };
@@ -39682,8 +39655,8 @@ var Vc = (function (exports, vue) {
39682
39655
  customClass: String,
39683
39656
  labelClass: String,
39684
39657
  prop: String,
39685
- width: [Number, String],
39686
- minWidth: [Number, String],
39658
+ width: Number,
39659
+ minWidth: Number,
39687
39660
  renderHeader: Function,
39688
39661
  resizable: {
39689
39662
  type: Boolean,
@@ -39825,24 +39798,14 @@ var Vc = (function (exports, vue) {
39825
39798
  }
39826
39799
  return column;
39827
39800
  };
39828
- const refreshColumnBasicConfig = () => {
39801
+ const registerColumn = () => {
39829
39802
  const defaults2 = {
39830
39803
  ...cellStarts[props2.type],
39831
- type: props2.type,
39832
39804
  id: columnId.value,
39833
- align: realAlign.value,
39834
- headerAlign: realHeaderAlign.value,
39835
- prop: props2.prop,
39836
- showPopover: props2.showPopover,
39837
- // index 列
39838
- index: props2.index
39805
+ realAlign,
39806
+ realHeaderAlign
39839
39807
  };
39840
- const basicProps = ["columnKey", "label", "customClass", "labelClass", "type", "renderHeader", "resizable", "formatter", "fixed", "resizable"];
39841
- const selectProps = ["selectable", "reserveSelection"];
39842
- const sortProps = ["sortable"];
39843
- const filterProps = ["filters", "filteredValue", "filterMultiple", "filter", "filterIcon", "filterPopupClass"];
39844
- let column = getPropsData(basicProps, selectProps, sortProps, filterProps);
39845
- column = merge$1(defaults2, column);
39808
+ let column = merge$1(defaults2, getPropsData(Object.keys(props2)));
39846
39809
  column = compose(setColumnRenders, setColumnWidth, setColumnForcedProps)(column);
39847
39810
  for (const key in column) {
39848
39811
  if (hasOwn$1(column, key)) {
@@ -39850,11 +39813,14 @@ var Vc = (function (exports, vue) {
39850
39813
  }
39851
39814
  }
39852
39815
  };
39853
- const registerComplexWatchers = () => {
39816
+ const registerWatchers = () => {
39817
+ Object.keys(props2).forEach((k) => vue.watch(() => props2[k], (v) => columnConfig[k] = v));
39854
39818
  vue.watch(() => props2.fixed, () => {
39855
39819
  table.exposed.store.scheduleLayout(true);
39856
39820
  });
39857
- vue.watch(() => realWidth.value, () => {
39821
+ vue.watch(() => realWidth.value, (v) => {
39822
+ columnConfig["width"] = v;
39823
+ columnConfig["realWidth"] = v;
39858
39824
  table.exposed.store.scheduleLayout(false);
39859
39825
  });
39860
39826
  vue.watch(() => realMinWidth.value, () => {
@@ -39862,10 +39828,9 @@ var Vc = (function (exports, vue) {
39862
39828
  });
39863
39829
  };
39864
39830
  vue.onBeforeMount(() => {
39865
- refreshColumnBasicConfig();
39866
- registerComplexWatchers();
39831
+ registerColumn();
39832
+ registerWatchers();
39867
39833
  });
39868
- vue.onUpdated(refreshColumnBasicConfig);
39869
39834
  vue.onMounted(() => {
39870
39835
  const children = isSubColumn ? parent.vnode.el.children : parent.exposed.hiddenColumns.value.children;
39871
39836
  const columnIndex = [...children].indexOf(instance.vnode.el);
@@ -39885,7 +39850,8 @@ var Vc = (function (exports, vue) {
39885
39850
  const renderDefault = slots?.default?.({
39886
39851
  row: {},
39887
39852
  column: {},
39888
- $index: -1
39853
+ columnIndex: -1,
39854
+ rowIndex: -1
39889
39855
  });
39890
39856
  if (renderDefault instanceof Array) {
39891
39857
  for (const childNode of renderDefault) {