@ctzy-web-client/plugin-component-vue 1.0.48 → 1.0.49

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.
@@ -87,11 +87,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
87
87
  }
88
88
  return tableAutoHeight.value;
89
89
  });
90
- const maxHeight = computed(() => {
91
- if (props.dataTable.data.length !== 0) {
92
- return props.dataTable.data.length * 64 + 62;
90
+ const maxHeight = ref(0);
91
+ function updateMaxHeight(list) {
92
+ if (list == null ? void 0 : list.length) {
93
+ maxHeight.value = list.length * 64 + 62;
94
+ } else {
95
+ maxHeight.value = 0;
93
96
  }
94
- });
97
+ }
95
98
  const tableAutoHeight = ref(300);
96
99
  const PAGINATION_HEIGHT = 160;
97
100
  function calcTableHeight() {
@@ -100,7 +103,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
100
103
  return;
101
104
  const top = dataTableEl.value.offsetTop;
102
105
  const viewHeight = window.innerHeight;
103
- const height = viewHeight - top - PAGINATION_HEIGHT;
106
+ const height = viewHeight - top - PAGINATION_HEIGHT - 45;
104
107
  console.log(height);
105
108
  tableAutoHeight.value = Math.max(height, 100);
106
109
  });
@@ -153,6 +156,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
153
156
  if (res.code != 0) {
154
157
  return;
155
158
  }
159
+ updateMaxHeight(res.data);
156
160
  const _userService = unref(userService);
157
161
  if (!_userService) {
158
162
  return;
@@ -218,6 +222,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
218
222
  if (res.code != 0) {
219
223
  ElMessage.error(res.msg);
220
224
  }
225
+ updateMaxHeight(res.data);
221
226
  });
222
227
  function sortColumn(array) {
223
228
  array.forEach((item) => {
@@ -91,11 +91,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
91
91
  }
92
92
  return tableAutoHeight.value;
93
93
  });
94
- const maxHeight = vue.computed(() => {
95
- if (props.dataTable.data.length !== 0) {
96
- return props.dataTable.data.length * 64 + 62;
94
+ const maxHeight = vue.ref(0);
95
+ function updateMaxHeight(list) {
96
+ if (list == null ? void 0 : list.length) {
97
+ maxHeight.value = list.length * 64 + 62;
98
+ } else {
99
+ maxHeight.value = 0;
97
100
  }
98
- });
101
+ }
99
102
  const tableAutoHeight = vue.ref(300);
100
103
  const PAGINATION_HEIGHT = 160;
101
104
  function calcTableHeight() {
@@ -104,7 +107,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
104
107
  return;
105
108
  const top = dataTableEl.value.offsetTop;
106
109
  const viewHeight = window.innerHeight;
107
- const height = viewHeight - top - PAGINATION_HEIGHT;
110
+ const height = viewHeight - top - PAGINATION_HEIGHT - 45;
108
111
  console.log(height);
109
112
  tableAutoHeight.value = Math.max(height, 100);
110
113
  });
@@ -157,6 +160,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
157
160
  if (res.code != 0) {
158
161
  return;
159
162
  }
163
+ updateMaxHeight(res.data);
160
164
  const _userService = vue.unref(userService);
161
165
  if (!_userService) {
162
166
  return;
@@ -222,6 +226,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
222
226
  if (res.code != 0) {
223
227
  ElementPlus.ElMessage.error(res.msg);
224
228
  }
229
+ updateMaxHeight(res.data);
225
230
  });
226
231
  function sortColumn(array) {
227
232
  array.forEach((item) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzy-web-client/plugin-component-vue",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "exports": {
@@ -212,16 +212,16 @@ const realHeight = computed(() => {
212
212
  // 否则自动计算表格高度
213
213
  return tableAutoHeight.value
214
214
  })
215
- const maxHeight = computed(() => {
216
- // 如果用户传了 height,就用用户的
217
-
218
- if (props.dataTable.data.length !==0) {
219
-
220
- return props.dataTable.data.length * 64 +62
215
+ const maxHeight = ref(0)
216
+
217
+ // 计算最大高度
218
+ function updateMaxHeight(list) {
219
+ if (list?.length) {
220
+ maxHeight.value = list.length * 64 + 62
221
+ } else {
222
+ maxHeight.value = 0
221
223
  }
222
- // 否则自动计算表格高度
223
-
224
- })
224
+ }
225
225
  // ====================
226
226
  // 自动高度计算(react-base-table 同款逻辑)
227
227
  // ====================
@@ -237,7 +237,7 @@ function calcTableHeight() {
237
237
  if (!dataTableEl.value) return
238
238
  const top = dataTableEl.value.offsetTop // 自动获取顶部距离
239
239
  const viewHeight = window.innerHeight
240
- const height = viewHeight - top - PAGINATION_HEIGHT
240
+ const height = viewHeight - top - PAGINATION_HEIGHT-45
241
241
  console.log(height)
242
242
  tableAutoHeight.value = Math.max(height, 100) // 最小200px
243
243
 
@@ -306,7 +306,7 @@ useEventDispatcher(dataTable, 'load-successfully', async (res) => {
306
306
  if (res.code != 0) {
307
307
  return;
308
308
  }
309
-
309
+ updateMaxHeight(res.data)
310
310
  const _userService = unref(userService);
311
311
 
312
312
  if (!_userService) {
@@ -388,7 +388,7 @@ useEventDispatcher(dataTable, 'load-successfully', (res) => {
388
388
  if (!elTable.value) {
389
389
  return;
390
390
  }
391
-
391
+
392
392
  if (unref(elTable)?.store?.updateSelectionByRowKey) {
393
393
  unref(elTable).store.updateSelectionByRowKey()
394
394
  }
@@ -400,6 +400,7 @@ useEventDispatcher(dataTable, 'load-successfully', (res) => {
400
400
  if (res.code != 0) {
401
401
  ElMessage.error(res.msg);
402
402
  }
403
+ updateMaxHeight(res.data)
403
404
  });
404
405
 
405
406
  function sortColumn(array) {