@neatui/nuxt 1.6.3 → 1.6.5

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/nuxt",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "NeatUI component library for Nuxt 3",
5
5
  "main": "./src/index.ts",
6
6
  "license": "MIT",
@@ -3,18 +3,23 @@
3
3
  <template v-for="(col, idx) in state.form" :key="idx">
4
4
  <div v-if="!col.clear" :id="col._fid" :ui-col="col.media" :ui-flex="`${vertical ? 'col xm' : 'row lt'}`">
5
5
  <template v-if="col.label">
6
- <h6 v-if="vertical" :style="`${col.rules?.some((validator: any) => validator.required) ? 'text-indent: -1em' : ''}`" class="o-ls">
6
+ <h6 v-if="vertical" :style="`${col.rules?.some((validator: any) => validator.required) ? 'text-indent: -1em' : ''}`" :class="labelClass">
7
7
  <template v-if="col.label == '*'"></template>
8
8
  <template v-else>
9
9
  <b v-if="col.rules?.some((validator: any) => validator.required)" class="co-risk pr" style="left: 0.1em">﹡</b>
10
- <span>{{ col.label ? col.label + ':' : '' }}</span>
10
+ <span>{{ formatLabel(col) }}</span>
11
11
  </template>
12
12
  </h6>
13
- <p v-else :class="`${clh({ ...(col.model[1] || {}) })}`" :style="`width:${state._lw + 'em'}; max-width:50%;`" class="ar nr-sm flex-fixed o-ls">
13
+ <p
14
+ v-else
15
+ :class="[labelClass, `${clh({ ...(col.model[1] || {}) })}`]"
16
+ :style="`width:${state._lw + 'em'}; max-width:50%;`"
17
+ class="ar nr-sm flex-fixed o-ls"
18
+ >
14
19
  <template v-if="col.label == '*'"></template>
15
20
  <template v-else>
16
21
  <b v-if="col.rules?.some((validator: any) => validator.required)" class="co-risk">﹡</b>
17
- <span>{{ col.label ? col.label + ':' : '' }}</span>
22
+ <span>{{ formatLabel(col) }}</span>
18
23
  </template>
19
24
  </p>
20
25
  </template>
@@ -262,6 +267,16 @@
262
267
  type: [String, Number],
263
268
  default: '',
264
269
  },
270
+ // label冒号控制,false不显示,string自定义字符
271
+ colon: {
272
+ type: [Boolean, String],
273
+ default: true,
274
+ },
275
+ // 统一的label class
276
+ labelClass: {
277
+ type: [String, Array, Object],
278
+ default: '',
279
+ },
265
280
  // 是否垂直排列
266
281
  vertical: {
267
282
  type: Boolean,
@@ -269,6 +284,21 @@
269
284
  },
270
285
  });
271
286
 
287
+ // label展示文案,支持全局/单个字段开关冒号
288
+ const formatLabel = (col: any = {}) => {
289
+ const { label = '', colon: localColon = undefined } = col || {};
290
+ if (!label) return '';
291
+ if (/[::]\s*$/.test(label)) return label;
292
+ const suffix = (() => {
293
+ if (localColon === false) return '';
294
+ if (isString(localColon)) return localColon;
295
+ if (localColon === true) return ':';
296
+ if (isString(props.colon)) return props.colon;
297
+ return props.colon ? ':' : '';
298
+ })();
299
+ return suffix ? `${label}${suffix}` : label;
300
+ };
301
+
272
302
  // 数据
273
303
  const state: any = reactive({
274
304
  form: [],