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

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,19 @@ 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;
93
- }
94
- });
90
+ const maxHeight = ref(0);
91
+ function updateMaxHeight(list) {
92
+ nextTick(() => {
93
+ if (!elTable.value)
94
+ return;
95
+ let h = (list == null ? void 0 : list.length) ? list.length * 64 + 62 : void 0;
96
+ if (h) {
97
+ elTable.value.$el.style.maxHeight = h + "px";
98
+ } else {
99
+ elTable.value.$el.style.maxHeight = "";
100
+ }
101
+ });
102
+ }
95
103
  const tableAutoHeight = ref(300);
96
104
  const PAGINATION_HEIGHT = 160;
97
105
  function calcTableHeight() {
@@ -100,7 +108,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
100
108
  return;
101
109
  const top = dataTableEl.value.offsetTop;
102
110
  const viewHeight = window.innerHeight;
103
- const height = viewHeight - top - PAGINATION_HEIGHT;
111
+ const height = viewHeight - top - PAGINATION_HEIGHT - 45;
104
112
  console.log(height);
105
113
  tableAutoHeight.value = Math.max(height, 100);
106
114
  });
@@ -113,6 +121,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
113
121
  onMounted(() => {
114
122
  calcTableHeight();
115
123
  window.addEventListener("resize", watchResize);
124
+ nextTick(() => {
125
+ var _a2;
126
+ if ((_a2 = props.dataTable.data) == null ? void 0 : _a2.length) {
127
+ updateMaxHeight(props.dataTable.data);
128
+ }
129
+ });
116
130
  });
117
131
  onBeforeUnmount(() => {
118
132
  window.removeEventListener("resize", watchResize);
@@ -153,6 +167,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
153
167
  if (res.code != 0) {
154
168
  return;
155
169
  }
170
+ updateMaxHeight(res.data);
156
171
  const _userService = unref(userService);
157
172
  if (!_userService) {
158
173
  return;
@@ -218,6 +233,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
218
233
  if (res.code != 0) {
219
234
  ElMessage.error(res.msg);
220
235
  }
236
+ updateMaxHeight(res.data);
221
237
  });
222
238
  function sortColumn(array) {
223
239
  array.forEach((item) => {
package/es/utils.css ADDED
@@ -0,0 +1 @@
1
+ .letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}.letter-circle[data-v-cb2d8ca5]{align-items:center;border-radius:50%;color:#fff;display:flex;flex-shrink:0;font-size:12px;height:22px;justify-content:center;width:22px}.option-container[data-v-cb2d8ca5]{align-items:center;display:flex;width:100%}.option-text[data-v-cb2d8ca5]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -91,11 +91,19 @@ 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;
97
- }
98
- });
94
+ const maxHeight = vue.ref(0);
95
+ function updateMaxHeight(list) {
96
+ vue.nextTick(() => {
97
+ if (!elTable.value)
98
+ return;
99
+ let h = (list == null ? void 0 : list.length) ? list.length * 64 + 62 : void 0;
100
+ if (h) {
101
+ elTable.value.$el.style.maxHeight = h + "px";
102
+ } else {
103
+ elTable.value.$el.style.maxHeight = "";
104
+ }
105
+ });
106
+ }
99
107
  const tableAutoHeight = vue.ref(300);
100
108
  const PAGINATION_HEIGHT = 160;
101
109
  function calcTableHeight() {
@@ -104,7 +112,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
104
112
  return;
105
113
  const top = dataTableEl.value.offsetTop;
106
114
  const viewHeight = window.innerHeight;
107
- const height = viewHeight - top - PAGINATION_HEIGHT;
115
+ const height = viewHeight - top - PAGINATION_HEIGHT - 45;
108
116
  console.log(height);
109
117
  tableAutoHeight.value = Math.max(height, 100);
110
118
  });
@@ -117,6 +125,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
117
125
  vue.onMounted(() => {
118
126
  calcTableHeight();
119
127
  window.addEventListener("resize", watchResize);
128
+ vue.nextTick(() => {
129
+ var _a2;
130
+ if ((_a2 = props.dataTable.data) == null ? void 0 : _a2.length) {
131
+ updateMaxHeight(props.dataTable.data);
132
+ }
133
+ });
120
134
  });
121
135
  vue.onBeforeUnmount(() => {
122
136
  window.removeEventListener("resize", watchResize);
@@ -157,6 +171,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
157
171
  if (res.code != 0) {
158
172
  return;
159
173
  }
174
+ updateMaxHeight(res.data);
160
175
  const _userService = vue.unref(userService);
161
176
  if (!_userService) {
162
177
  return;
@@ -222,6 +237,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
222
237
  if (res.code != 0) {
223
238
  ElementPlus.ElMessage.error(res.msg);
224
239
  }
240
+ updateMaxHeight(res.data);
225
241
  });
226
242
  function sortColumn(array) {
227
243
  array.forEach((item) => {
package/lib/utils.css ADDED
@@ -0,0 +1 @@
1
+ .letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}.letter-circle[data-v-cb2d8ca5]{align-items:center;border-radius:50%;color:#fff;display:flex;flex-shrink:0;font-size:12px;height:22px;justify-content:center;width:22px}.option-container[data-v-cb2d8ca5]{align-items:center;display:flex;width:100%}.option-text[data-v-cb2d8ca5]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
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.50",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "exports": {
@@ -212,16 +212,20 @@ 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
221
- }
222
- // 否则自动计算表格高度
223
-
224
- })
215
+ const maxHeight = ref(0)
216
+
217
+ // 计算最大高度
218
+ function updateMaxHeight(list) {
219
+ nextTick(()=>{
220
+ if(!elTable.value) return
221
+ let h = list?.length ? list.length * 64 + 62 : undefined
222
+ if(h){
223
+ elTable.value.$el.style.maxHeight = h + 'px'
224
+ }else{
225
+ elTable.value.$el.style.maxHeight = ''
226
+ }
227
+ })
228
+ }
225
229
  // ====================
226
230
  // 自动高度计算(react-base-table 同款逻辑)
227
231
  // ====================
@@ -237,7 +241,7 @@ function calcTableHeight() {
237
241
  if (!dataTableEl.value) return
238
242
  const top = dataTableEl.value.offsetTop // 自动获取顶部距离
239
243
  const viewHeight = window.innerHeight
240
- const height = viewHeight - top - PAGINATION_HEIGHT
244
+ const height = viewHeight - top - PAGINATION_HEIGHT-45
241
245
  console.log(height)
242
246
  tableAutoHeight.value = Math.max(height, 100) // 最小200px
243
247
 
@@ -253,6 +257,11 @@ function watchResize() {
253
257
  onMounted(() => {
254
258
  calcTableHeight()
255
259
  window.addEventListener('resize', watchResize)
260
+ nextTick(()=>{
261
+ if(props.dataTable.data?.length){
262
+ updateMaxHeight(props.dataTable.data)
263
+ }
264
+ })
256
265
  })
257
266
 
258
267
  onBeforeUnmount(() => {
@@ -306,7 +315,7 @@ useEventDispatcher(dataTable, 'load-successfully', async (res) => {
306
315
  if (res.code != 0) {
307
316
  return;
308
317
  }
309
-
318
+ updateMaxHeight(res.data)
310
319
  const _userService = unref(userService);
311
320
 
312
321
  if (!_userService) {
@@ -388,7 +397,7 @@ useEventDispatcher(dataTable, 'load-successfully', (res) => {
388
397
  if (!elTable.value) {
389
398
  return;
390
399
  }
391
-
400
+
392
401
  if (unref(elTable)?.store?.updateSelectionByRowKey) {
393
402
  unref(elTable).store.updateSelectionByRowKey()
394
403
  }
@@ -400,6 +409,7 @@ useEventDispatcher(dataTable, 'load-successfully', (res) => {
400
409
  if (res.code != 0) {
401
410
  ElMessage.error(res.msg);
402
411
  }
412
+ updateMaxHeight(res.data)
403
413
  });
404
414
 
405
415
  function sortColumn(array) {
package/es/components.css DELETED
@@ -1 +0,0 @@
1
- .letter-circle[data-v-9ba46efc]{font-size:14px;height:24px;margin-right:8px;width:24px}.letter-circle[data-v-9ba46efc],.letter-circle[data-v-cb2d8ca5]{align-items:center;border-radius:50%;color:#fff;display:flex;justify-content:center}.letter-circle[data-v-cb2d8ca5]{flex-shrink:0;font-size:12px;height:22px;width:22px}.option-container[data-v-cb2d8ca5]{align-items:center;display:flex;width:100%}.option-text[data-v-cb2d8ca5]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}
@@ -1 +0,0 @@
1
- .letter-circle[data-v-9ba46efc]{font-size:14px;height:24px;margin-right:8px;width:24px}.letter-circle[data-v-9ba46efc],.letter-circle[data-v-cb2d8ca5]{align-items:center;border-radius:50%;color:#fff;display:flex;justify-content:center}.letter-circle[data-v-cb2d8ca5]{flex-shrink:0;font-size:12px;height:22px;width:22px}.option-container[data-v-cb2d8ca5]{align-items:center;display:flex;width:100%}.option-text[data-v-cb2d8ca5]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}