@zhaoyifannan/tvue 3.7.17-beta → 3.7.19-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tvue.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Tvue.js v3.7.16-beta
2
+ * Tvue.js v3.7.19-beta
3
3
  * (c) 2024-2026 Zhaoyifannan
4
4
  * Released under the MIT License.
5
5
  */
@@ -3404,8 +3404,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3404
3404
  };
3405
3405
  },
3406
3406
  mounted: function mounted() {
3407
+ var _this = this;
3407
3408
  this.dataInit();
3408
- this.getTableHeight();
3409
+ setTimeout(function () {
3410
+ _this.getTableHeight();
3411
+ }, 500);
3409
3412
  this.initFun();
3410
3413
  this.initVirtualizeFun();
3411
3414
  },
@@ -3465,11 +3468,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3465
3468
  return this.getSlotList(["-search"], this.$slots, this.propOption);
3466
3469
  },
3467
3470
  mainSlot: function mainSlot() {
3468
- var _this = this;
3471
+ var _this2 = this;
3469
3472
  var result = [];
3470
3473
  this.propOption.forEach(function (item) {
3471
3474
  var prop = item.prop;
3472
- if (_this.$slots[prop]) result.push(prop);
3475
+ if (_this2.$slots[prop]) result.push(prop);
3473
3476
  });
3474
3477
  return this.getSlotList(["-header", "-form"], this.$slots, this.propOption).concat(result);
3475
3478
  },
@@ -3636,10 +3639,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3636
3639
  this.initTableMethods(["scrollTo", "setScrollTop", "setScrollLeft", "columns", "doLayout", "updateKeyChildren", "toggleAllSelection", "toggleRowSelection", "toggleRowExpansion", "setCurrentRow", "clearFilter", "clearSort"]);
3637
3640
  },
3638
3641
  initTableMethods: function initTableMethods(methods) {
3639
- var _this2 = this;
3642
+ var _this3 = this;
3640
3643
  methods.forEach(function (ele) {
3641
- _this2[ele] = function () {
3642
- var tableRef = _this2.$refs.table;
3644
+ _this3[ele] = function () {
3645
+ var tableRef = _this3.$refs.table;
3643
3646
  if (tableRef && typeof tableRef[ele] === "function") {
3644
3647
  return tableRef[ele].apply(tableRef, arguments);
3645
3648
  }
@@ -3668,21 +3671,26 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3668
3671
  }
3669
3672
  },
3670
3673
  getTableHeight: function getTableHeight() {
3671
- var _this3 = this;
3674
+ var _this4 = this;
3672
3675
  this.$nextTick(function () {
3673
- if (_this3.isAutoHeight) {
3674
- var element = _this3.$el;
3676
+ if (_this4.isAutoHeight) {
3677
+ var element = _this4.$el;
3675
3678
  if (!element) return;
3676
3679
  var parentElement = element.parentElement;
3677
3680
  if (!parentElement) return;
3678
3681
 
3679
3682
  // 使用 requestAnimationFrame 确保布局已完成
3680
3683
  requestAnimationFrame(function () {
3681
- var clientHeight = parentElement.clientHeight - 16;
3682
- var calcHeight = _this3.calcHeight || 0;
3683
- var tableRef = _this3.$refs.table;
3684
- var tablePageRef = _this3.$refs.tablePage;
3685
- var tableHeight = clientHeight - calcHeight;
3684
+ var clientHeight = parentElement.clientHeight;
3685
+ var computedStyle = window.getComputedStyle(parentElement);
3686
+ var paddingBottom = parseFloat(computedStyle.paddingBottom);
3687
+ if (_this4.option.card) {
3688
+ clientHeight -= 16;
3689
+ }
3690
+ var calcHeight = _this4.calcHeight || 0;
3691
+ var tableRef = _this4.$refs.table;
3692
+ var tablePageRef = _this4.$refs.tablePage;
3693
+ var tableHeight = clientHeight - calcHeight - paddingBottom;
3686
3694
  if (tableRef) {
3687
3695
  var height = tableRef.$el.offsetTop || 0;
3688
3696
  tableHeight -= height;
@@ -3691,12 +3699,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3691
3699
  var _height = tablePageRef.$el.offsetHeight || 0;
3692
3700
  tableHeight -= _height;
3693
3701
  }
3694
- _this3.tableHeight = tableHeight;
3695
- _this3.doLayout();
3702
+ _this4.tableHeight = tableHeight;
3703
+ _this4.doLayout();
3696
3704
  });
3697
3705
  } else {
3698
- _this3.tableHeight = _this3.tableOption.height;
3699
- _this3.doLayout();
3706
+ _this4.tableHeight = _this4.tableOption.height;
3707
+ _this4.doLayout();
3700
3708
  }
3701
3709
  });
3702
3710
  },
@@ -3730,12 +3738,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3730
3738
  this.$refs.table.clearSelection();
3731
3739
  },
3732
3740
  dataInit: function dataInit() {
3733
- var _this4 = this;
3741
+ var _this5 = this;
3734
3742
  this.list = this.data;
3735
3743
  //初始化序列的参数
3736
3744
  this.list.forEach(function (ele, index) {
3737
- if (ele.$cellEdit && !_this4.cascaderFormList[index]) {
3738
- _this4.cascaderFormList[index] = _this4.deepClone(ele);
3745
+ if (ele.$cellEdit && !_this5.cascaderFormList[index]) {
3746
+ _this5.cascaderFormList[index] = _this5.deepClone(ele);
3739
3747
  }
3740
3748
  ele.$cellEdit = ele.$cellEdit || false;
3741
3749
  ele.$index = index;
@@ -3779,10 +3787,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3779
3787
  },
3780
3788
  // 选中实例
3781
3789
  toggleSelection: function toggleSelection(rows, checked) {
3782
- var _this5 = this;
3790
+ var _this6 = this;
3783
3791
  if (rows) {
3784
3792
  rows.forEach(function (row) {
3785
- _this5.$refs.table.toggleRowSelection(row, checked);
3793
+ _this6.$refs.table.toggleRowSelection(row, checked);
3786
3794
  });
3787
3795
  } else {
3788
3796
  this.$refs.table.clearSelection();
@@ -3879,27 +3887,27 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3879
3887
  }
3880
3888
  },
3881
3889
  rowCellUpdate: function rowCellUpdate(row, index) {
3882
- var _this6 = this;
3890
+ var _this7 = this;
3883
3891
  var done = function done(newRow) {
3884
3892
  row = newRow || row;
3885
- _this6.btnDisabledList[index] = false;
3886
- _this6.btnDisabled = false;
3893
+ _this7.btnDisabledList[index] = false;
3894
+ _this7.btnDisabled = false;
3887
3895
  row.$cellEdit = false;
3888
- _this6.list[index] = row;
3889
- _this6.cascaderIndexList.splice(_this6.cascaderIndexList.indexOf(index), 1);
3890
- delete _this6.cascaderFormList[index];
3896
+ _this7.list[index] = row;
3897
+ _this7.cascaderIndexList.splice(_this7.cascaderIndexList.indexOf(index), 1);
3898
+ delete _this7.cascaderFormList[index];
3891
3899
  };
3892
3900
  var loading = function loading() {
3893
- _this6.btnDisabledList[index] = false;
3894
- _this6.btnDisabled = false;
3901
+ _this7.btnDisabledList[index] = false;
3902
+ _this7.btnDisabled = false;
3895
3903
  };
3896
3904
  this.validateCellField(index).then(function () {
3897
- _this6.btnDisabledList[index] = true;
3898
- _this6.btnDisabled = true;
3899
- if (_this6.validatenull(row[_this6.rowKey])) {
3900
- _this6.$emit("row-save", row, done, loading);
3905
+ _this7.btnDisabledList[index] = true;
3906
+ _this7.btnDisabled = true;
3907
+ if (_this7.validatenull(row[_this7.rowKey])) {
3908
+ _this7.$emit("row-save", row, done, loading);
3901
3909
  } else {
3902
- _this6.$emit("row-update", row, index, done, loading);
3910
+ _this7.$emit("row-update", row, index, done, loading);
3903
3911
  }
3904
3912
  });
3905
3913
  },
@@ -3913,17 +3921,17 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3913
3921
  },
3914
3922
  // 对部分表单字段进行校验
3915
3923
  validateCellForm: function validateCellForm(cb) {
3916
- var _this7 = this;
3924
+ var _this8 = this;
3917
3925
  return new Promise(function (resolve) {
3918
- _this7.$refs.cellForm.validate(function (valid, msg) {
3926
+ _this8.$refs.cellForm.validate(function (valid, msg) {
3919
3927
  resolve(msg);
3920
3928
  });
3921
3929
  });
3922
3930
  },
3923
3931
  validateCellField: function validateCellField(index) {
3924
- var _this8 = this;
3932
+ var _this9 = this;
3925
3933
  return new Promise(function (resolve, reject) {
3926
- _this8.$refs.cellForm.validate(function (valid) {
3934
+ _this9.$refs.cellForm.validate(function (valid) {
3927
3935
  var msg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3928
3936
  var result = true;
3929
3937
  var list = [];
@@ -3934,7 +3942,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3934
3942
  list.push(ele);
3935
3943
  }
3936
3944
  });
3937
- if (!_this8.validatenull(list)) _this8.$refs.cellForm.clearValidate(list);
3945
+ if (!_this9.validatenull(list)) _this9.$refs.cellForm.clearValidate(list);
3938
3946
  if (result) resolve();
3939
3947
  });
3940
3948
  });
@@ -3985,11 +3993,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3985
3993
  },
3986
3994
  // 删除
3987
3995
  rowDel: function rowDel(row, index) {
3988
- var _this9 = this;
3996
+ var _this10 = this;
3989
3997
  this.$emit("row-del", row, index, function () {
3990
- var _this9$findData = _this9.findData(row[_this9.rowKey]),
3991
- parentList = _this9$findData.parentList,
3992
- index = _this9$findData.index;
3998
+ var _this10$findData = _this10.findData(row[_this10.rowKey]),
3999
+ parentList = _this10$findData.parentList,
4000
+ index = _this10$findData.index;
3993
4001
  if (parentList) parentList.splice(index, 1);
3994
4002
  });
3995
4003
  },
@@ -3999,7 +4007,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3999
4007
  },
4000
4008
  //合集统计逻辑
4001
4009
  tableSummaryMethod: function tableSummaryMethod(param) {
4002
- var _this10 = this;
4010
+ var _this11 = this;
4003
4011
  var sumsList = {};
4004
4012
  var sums = [];
4005
4013
  var columns = param.columns,
@@ -4013,7 +4021,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4013
4021
  this.sumsList = sumsList;
4014
4022
  } else {
4015
4023
  columns.forEach(function (column, index) {
4016
- var currItem = _this10.sumColumnList.find(function (item) {
4024
+ var currItem = _this11.sumColumnList.find(function (item) {
4017
4025
  return item.name === column.property;
4018
4026
  });
4019
4027
  if (currItem) {
@@ -4086,11 +4094,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4086
4094
  });
4087
4095
  },
4088
4096
  findData: function findData(id) {
4089
- var _this11 = this;
4097
+ var _this12 = this;
4090
4098
  var result = {};
4091
4099
  var _callback = function callback(parentList, parent) {
4092
4100
  parentList.forEach(function (ele, index) {
4093
- if (ele[_this11.rowKey] == id) {
4101
+ if (ele[_this12.rowKey] == id) {
4094
4102
  result = {
4095
4103
  item: ele,
4096
4104
  index: index,
@@ -4098,8 +4106,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4098
4106
  parent: parent
4099
4107
  };
4100
4108
  }
4101
- if (ele[_this11.childrenKey]) {
4102
- _callback(ele[_this11.childrenKey], ele);
4109
+ if (ele[_this12.childrenKey]) {
4110
+ _callback(ele[_this12.childrenKey], ele);
4103
4111
  }
4104
4112
  });
4105
4113
  };
@@ -31338,7 +31346,7 @@ function validatenull(val) {
31338
31346
 
31339
31347
  "use strict";
31340
31348
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return version; });
31341
- var version = '3.7.16-beta';
31349
+ var version = '3.7.19-beta';
31342
31350
 
31343
31351
  /***/ }),
31344
31352