@neatui/vue 4.3.0 → 4.4.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neatui/vue",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "basic component ui",
5
5
  "main": "./src/index.ts",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "@fekit/scrollto": "^3.0.3",
35
35
  "@fekit/toast": "^2.7.2",
36
36
  "@fekit/utils": "^6.0.0",
37
- "@neatui/css": "^4.4.0",
37
+ "@neatui/css": "^4.4.1",
38
38
  "@rollup/plugin-commonjs": "^26.0.1",
39
39
  "@rollup/plugin-node-resolve": "^15.2.3",
40
40
  "@vue/compiler-sfc": "^3.4.30",
@@ -8,7 +8,7 @@
8
8
  <label class="mb-ss" ui-form="@a type:checkbox"><input type="checkbox" v-model="all" /><span></span></label>
9
9
  </th>
10
10
  <template v-for="(col, idx) in state.table" :key="idx">
11
- <th v-if="!col.__close" :min-width="col.fixed" :col-fixed="col.fixed" :col-fixed-side="col.fixed || 'l'" :data-field="col.field">
11
+ <th v-if="!col.__close" v-bind="colSizeAttrs(col)" :col-fixed="col.fixed" :col-fixed-side="col.fixed || 'l'" :data-field="col.field">
12
12
  <slot :name="`thead-${col.field}`" :col="col" :idx="idx">
13
13
  <div :class="!slots.operate && idx === state.__last ? 'ar' : ''" v-bind="col.thead">
14
14
  <span class="ux-none" ui-flex="row rm" v-if="col.order === 0 || col.order === 1 || col.order === 2" @click="fSetOrder(col)">
@@ -82,7 +82,7 @@
82
82
  <td
83
83
  v-if="!col.__close"
84
84
  :class="`${!slots.operate && cid === state.__last ? 'ar' : ''}`"
85
- :min-width="col.fixed"
85
+ v-bind="colSizeAttrs(col)"
86
86
  :col-fixed="col.fixed"
87
87
  :col-fixed-side="col.fixed || 'l'"
88
88
  :data-field="col.field"
@@ -165,7 +165,7 @@
165
165
  interface JSONRules {
166
166
  label: string | (() => string);
167
167
  field: string | (() => string);
168
- width?: string | (() => string);
168
+ width?: 'min' | 'max' | string | (() => string);
169
169
  fixed?: string | (() => string);
170
170
  paths?: string | (() => string);
171
171
  thead?: Record<string, any> | ((data: any) => Record<string, any>);
@@ -232,6 +232,16 @@
232
232
 
233
233
  const name = computed(() => 'confs' + route.path?.replace(/\//g, '_')) || '';
234
234
 
235
+ const colSizeAttrs = (col: TableColumn) => {
236
+ const raw = isFunction(col.width) ? col.width() : col.width;
237
+ const width = raw == null ? '' : String(raw).trim();
238
+ const attrs: Record<string, any> = {};
239
+ if (width === 'min' || (!width && col.fixed)) attrs['min-width'] = '';
240
+ if (width === 'max') attrs['max-width'] = '';
241
+ if (width && width !== 'min' && width !== 'max') attrs.style = { width, minWidth: width, maxWidth: width };
242
+ return attrs;
243
+ };
244
+
235
245
  // 全选状态
236
246
  const all = computed({
237
247
  get() {