@zhaoyifannan/tvue 3.7.17-beta → 3.7.18-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.17-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,28 @@ 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
+ } else {
3690
+ clientHeight += 10;
3691
+ }
3692
+ var calcHeight = _this4.calcHeight || 0;
3693
+ var tableRef = _this4.$refs.table;
3694
+ var tablePageRef = _this4.$refs.tablePage;
3695
+ var tableHeight = clientHeight - calcHeight - paddingBottom;
3686
3696
  if (tableRef) {
3687
3697
  var height = tableRef.$el.offsetTop || 0;
3688
3698
  tableHeight -= height;
@@ -3691,12 +3701,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3691
3701
  var _height = tablePageRef.$el.offsetHeight || 0;
3692
3702
  tableHeight -= _height;
3693
3703
  }
3694
- _this3.tableHeight = tableHeight;
3695
- _this3.doLayout();
3704
+ _this4.tableHeight = tableHeight;
3705
+ _this4.doLayout();
3696
3706
  });
3697
3707
  } else {
3698
- _this3.tableHeight = _this3.tableOption.height;
3699
- _this3.doLayout();
3708
+ _this4.tableHeight = _this4.tableOption.height;
3709
+ _this4.doLayout();
3700
3710
  }
3701
3711
  });
3702
3712
  },
@@ -3730,12 +3740,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3730
3740
  this.$refs.table.clearSelection();
3731
3741
  },
3732
3742
  dataInit: function dataInit() {
3733
- var _this4 = this;
3743
+ var _this5 = this;
3734
3744
  this.list = this.data;
3735
3745
  //初始化序列的参数
3736
3746
  this.list.forEach(function (ele, index) {
3737
- if (ele.$cellEdit && !_this4.cascaderFormList[index]) {
3738
- _this4.cascaderFormList[index] = _this4.deepClone(ele);
3747
+ if (ele.$cellEdit && !_this5.cascaderFormList[index]) {
3748
+ _this5.cascaderFormList[index] = _this5.deepClone(ele);
3739
3749
  }
3740
3750
  ele.$cellEdit = ele.$cellEdit || false;
3741
3751
  ele.$index = index;
@@ -3779,10 +3789,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3779
3789
  },
3780
3790
  // 选中实例
3781
3791
  toggleSelection: function toggleSelection(rows, checked) {
3782
- var _this5 = this;
3792
+ var _this6 = this;
3783
3793
  if (rows) {
3784
3794
  rows.forEach(function (row) {
3785
- _this5.$refs.table.toggleRowSelection(row, checked);
3795
+ _this6.$refs.table.toggleRowSelection(row, checked);
3786
3796
  });
3787
3797
  } else {
3788
3798
  this.$refs.table.clearSelection();
@@ -3879,27 +3889,27 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3879
3889
  }
3880
3890
  },
3881
3891
  rowCellUpdate: function rowCellUpdate(row, index) {
3882
- var _this6 = this;
3892
+ var _this7 = this;
3883
3893
  var done = function done(newRow) {
3884
3894
  row = newRow || row;
3885
- _this6.btnDisabledList[index] = false;
3886
- _this6.btnDisabled = false;
3895
+ _this7.btnDisabledList[index] = false;
3896
+ _this7.btnDisabled = false;
3887
3897
  row.$cellEdit = false;
3888
- _this6.list[index] = row;
3889
- _this6.cascaderIndexList.splice(_this6.cascaderIndexList.indexOf(index), 1);
3890
- delete _this6.cascaderFormList[index];
3898
+ _this7.list[index] = row;
3899
+ _this7.cascaderIndexList.splice(_this7.cascaderIndexList.indexOf(index), 1);
3900
+ delete _this7.cascaderFormList[index];
3891
3901
  };
3892
3902
  var loading = function loading() {
3893
- _this6.btnDisabledList[index] = false;
3894
- _this6.btnDisabled = false;
3903
+ _this7.btnDisabledList[index] = false;
3904
+ _this7.btnDisabled = false;
3895
3905
  };
3896
3906
  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);
3907
+ _this7.btnDisabledList[index] = true;
3908
+ _this7.btnDisabled = true;
3909
+ if (_this7.validatenull(row[_this7.rowKey])) {
3910
+ _this7.$emit("row-save", row, done, loading);
3901
3911
  } else {
3902
- _this6.$emit("row-update", row, index, done, loading);
3912
+ _this7.$emit("row-update", row, index, done, loading);
3903
3913
  }
3904
3914
  });
3905
3915
  },
@@ -3913,17 +3923,17 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3913
3923
  },
3914
3924
  // 对部分表单字段进行校验
3915
3925
  validateCellForm: function validateCellForm(cb) {
3916
- var _this7 = this;
3926
+ var _this8 = this;
3917
3927
  return new Promise(function (resolve) {
3918
- _this7.$refs.cellForm.validate(function (valid, msg) {
3928
+ _this8.$refs.cellForm.validate(function (valid, msg) {
3919
3929
  resolve(msg);
3920
3930
  });
3921
3931
  });
3922
3932
  },
3923
3933
  validateCellField: function validateCellField(index) {
3924
- var _this8 = this;
3934
+ var _this9 = this;
3925
3935
  return new Promise(function (resolve, reject) {
3926
- _this8.$refs.cellForm.validate(function (valid) {
3936
+ _this9.$refs.cellForm.validate(function (valid) {
3927
3937
  var msg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3928
3938
  var result = true;
3929
3939
  var list = [];
@@ -3934,7 +3944,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3934
3944
  list.push(ele);
3935
3945
  }
3936
3946
  });
3937
- if (!_this8.validatenull(list)) _this8.$refs.cellForm.clearValidate(list);
3947
+ if (!_this9.validatenull(list)) _this9.$refs.cellForm.clearValidate(list);
3938
3948
  if (result) resolve();
3939
3949
  });
3940
3950
  });
@@ -3985,11 +3995,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3985
3995
  },
3986
3996
  // 删除
3987
3997
  rowDel: function rowDel(row, index) {
3988
- var _this9 = this;
3998
+ var _this10 = this;
3989
3999
  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;
4000
+ var _this10$findData = _this10.findData(row[_this10.rowKey]),
4001
+ parentList = _this10$findData.parentList,
4002
+ index = _this10$findData.index;
3993
4003
  if (parentList) parentList.splice(index, 1);
3994
4004
  });
3995
4005
  },
@@ -3999,7 +4009,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3999
4009
  },
4000
4010
  //合集统计逻辑
4001
4011
  tableSummaryMethod: function tableSummaryMethod(param) {
4002
- var _this10 = this;
4012
+ var _this11 = this;
4003
4013
  var sumsList = {};
4004
4014
  var sums = [];
4005
4015
  var columns = param.columns,
@@ -4013,7 +4023,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4013
4023
  this.sumsList = sumsList;
4014
4024
  } else {
4015
4025
  columns.forEach(function (column, index) {
4016
- var currItem = _this10.sumColumnList.find(function (item) {
4026
+ var currItem = _this11.sumColumnList.find(function (item) {
4017
4027
  return item.name === column.property;
4018
4028
  });
4019
4029
  if (currItem) {
@@ -4086,11 +4096,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4086
4096
  });
4087
4097
  },
4088
4098
  findData: function findData(id) {
4089
- var _this11 = this;
4099
+ var _this12 = this;
4090
4100
  var result = {};
4091
4101
  var _callback = function callback(parentList, parent) {
4092
4102
  parentList.forEach(function (ele, index) {
4093
- if (ele[_this11.rowKey] == id) {
4103
+ if (ele[_this12.rowKey] == id) {
4094
4104
  result = {
4095
4105
  item: ele,
4096
4106
  index: index,
@@ -4098,8 +4108,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4098
4108
  parent: parent
4099
4109
  };
4100
4110
  }
4101
- if (ele[_this11.childrenKey]) {
4102
- _callback(ele[_this11.childrenKey], ele);
4111
+ if (ele[_this12.childrenKey]) {
4112
+ _callback(ele[_this12.childrenKey], ele);
4103
4113
  }
4104
4114
  });
4105
4115
  };
@@ -31338,7 +31348,7 @@ function validatenull(val) {
31338
31348
 
31339
31349
  "use strict";
31340
31350
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return version; });
31341
- var version = '3.7.16-beta';
31351
+ var version = '3.7.17-beta';
31342
31352
 
31343
31353
  /***/ }),
31344
31354