@neatui/nuxt 1.6.2 → 1.6.4

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.2",
3
+ "version": "1.6.4",
4
4
  "description": "NeatUI component library for Nuxt 3",
5
5
  "main": "./src/index.ts",
6
6
  "license": "MIT",
@@ -3,18 +3,18 @@
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' : ''}`">
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
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">
14
14
  <template v-if="col.label == '*'"></template>
15
15
  <template v-else>
16
16
  <b v-if="col.rules?.some((validator: any) => validator.required)" class="co-risk">﹡</b>
17
- <span>{{ col.label ? col.label + ':' : '' }}</span>
17
+ <span>{{ formatLabel(col) }}</span>
18
18
  </template>
19
19
  </p>
20
20
  </template>
@@ -262,6 +262,11 @@
262
262
  type: [String, Number],
263
263
  default: '',
264
264
  },
265
+ // label冒号控制,false不显示,string自定义字符
266
+ colon: {
267
+ type: [Boolean, String],
268
+ default: true,
269
+ },
265
270
  // 是否垂直排列
266
271
  vertical: {
267
272
  type: Boolean,
@@ -269,6 +274,21 @@
269
274
  },
270
275
  });
271
276
 
277
+ // label展示文案,支持全局/单个字段开关冒号
278
+ const formatLabel = (col: any = {}) => {
279
+ const { label = '', colon: localColon = undefined } = col || {};
280
+ if (!label) return '';
281
+ if (/[::]\s*$/.test(label)) return label;
282
+ const suffix = (() => {
283
+ if (localColon === false) return '';
284
+ if (isString(localColon)) return localColon;
285
+ if (localColon === true) return ':';
286
+ if (isString(props.colon)) return props.colon;
287
+ return props.colon ? ':' : '';
288
+ })();
289
+ return suffix ? `${label}${suffix}` : label;
290
+ };
291
+
272
292
  // 数据
273
293
  const state: any = reactive({
274
294
  form: [],