wui-components-v2 1.2.40 → 1.2.41

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.
@@ -127,7 +127,8 @@ const tableData = computed<Record<string, any>[]>(() => {
127
127
  })
128
128
 
129
129
  // 根据内容计算每列宽度(中文字符约16px,英文/数字约8px,最大宽度300px)
130
- // 无数据时用 1fr 让列均分占满整行
130
+ // 每列宽度用 minmax(最小px, 1fr):保证内容最小宽度,同时按比例拉伸铺满整行,
131
+ // 这样切换全屏/宽屏时表格会自动撑满,而不是固定像素。
131
132
  const columnWidths = computed<Record<string, string>>(() => {
132
133
  const widths: Record<string, string> = {}
133
134
  const MAX_WIDTH = 300
@@ -136,9 +137,7 @@ const columnWidths = computed<Record<string, string>>(() => {
136
137
  const CHAR_WIDTH_EN = 8
137
138
  const PADDING = 32
138
139
 
139
- // 无数据时,所有列按百分比均分占满整行
140
- // 注意:不能用 1fr,因为 wd-table 的 contentWidthStyle 会用 calc() 求和,
141
- // fr 单位在 calc() 中是非法值,这里改用百分比
140
+ // 无数据时,所有列按 1fr 均分占满整行
142
141
  if (datas.value.length === 0 && tableColumns.value.length > 0) {
143
142
  const colCount = tableColumns.value.length
144
143
  const percent = (100 / colCount).toFixed(4) + '%'
@@ -161,7 +160,8 @@ const columnWidths = computed<Record<string, string>>(() => {
161
160
  maxLen = Math.max(maxLen, charCount)
162
161
  })
163
162
  const px = Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, maxLen * CHAR_WIDTH_EN + PADDING))
164
- widths[col.sourceId] = `${px}px`
163
+ // 用 minmax 保证列最小宽度为内容宽度,多余空间按 1fr 均分,让整表撑满容器
164
+ widths[col.sourceId] = `minmax(${px}px, 1fr)`
165
165
  })
166
166
  return widths
167
167
  })
@@ -398,6 +398,13 @@ function tabSearchClick(data: any) {
398
398
  width: auto;
399
399
  }
400
400
 
401
+ // wd-table 内部内容容器宽度默认是 calc(各列宽之和),
402
+ // 当列宽使用 minmax() 时 calc() 失效,这里强制内容容器占满宽度,
403
+ // 让 grid 的 minmax(px, 1fr) 生效,使表格随屏幕宽度自动铺满。
404
+ :deep(.wd-table > scroll-view > view) {
405
+ width: 100%;
406
+ }
407
+
401
408
  // 修复合并单元格后内容不垂直居中
402
409
  ::deep(.wd-table__value) {
403
410
  display: flex !important;
@@ -408,7 +415,11 @@ function tabSearchClick(data: any) {
408
415
  .time-filter-bar {
409
416
  padding: 16rpx;
410
417
  }
418
+
419
+ // 用 box-shadow 画单元格边框:不占用布局空间,避免 border-box 下挤压内容导致换行
411
420
  :deep(.wd-table__cell) {
412
- border: 0.5px solid #e5e5e5;
421
+ box-shadow:
422
+ inset 0 -0.5px 0 #e5e5e5,
423
+ inset -0.5px 0 0 #e5e5e5;
413
424
  }
414
425
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.40",
3
+ "version": "1.2.41",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",