@neatui/nuxt 1.6.4 → 1.6.6
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
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<input
|
|
18
18
|
:title="props.modelValue"
|
|
19
19
|
:value="props.modelValue"
|
|
20
|
-
:type="
|
|
20
|
+
:type="inputType"
|
|
21
21
|
:placeholder="placeholder"
|
|
22
22
|
:disabled="disabled"
|
|
23
23
|
:readonly="readonly"
|
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
</slot>
|
|
31
31
|
<div ui-form-suffix="">
|
|
32
32
|
<i ui-form-clean="" v-if="clearable && props.modelValue && !readonly && !disabled" @click.stop="clear"></i>
|
|
33
|
+
<div
|
|
34
|
+
class="o-ls"
|
|
35
|
+
v-if="type === 'password' && cipher"
|
|
36
|
+
:ui-form-cipher="cipherVisible ? '1' : ''"
|
|
37
|
+
@click.stop="toggleCipher"
|
|
38
|
+
></div>
|
|
33
39
|
<slot name="suffix"></slot>
|
|
34
40
|
<template v-for="(item, idx) in suffix" :key="idx">
|
|
35
41
|
<div v-if="isObject(item)" v-bind="item.attrs" v-on="event(item, props.modelValue)">
|
|
@@ -43,7 +49,7 @@
|
|
|
43
49
|
</template>
|
|
44
50
|
|
|
45
51
|
<script setup lang="ts">
|
|
46
|
-
import { reactive, watch } from 'vue';
|
|
52
|
+
import { computed, reactive, ref, watch } from 'vue';
|
|
47
53
|
import { isObject, isFunction } from '@fekit/utils';
|
|
48
54
|
|
|
49
55
|
const emits = defineEmits(['update:modelValue', 'click', 'blur', 'focus', 'change', 'input', 'clear']);
|
|
@@ -89,6 +95,7 @@
|
|
|
89
95
|
disabled?: boolean;
|
|
90
96
|
readonly?: boolean;
|
|
91
97
|
clearable?: boolean;
|
|
98
|
+
cipher?: boolean;
|
|
92
99
|
verify?: boolean;
|
|
93
100
|
prefix?: Array<any>;
|
|
94
101
|
suffix?: Array<any>;
|
|
@@ -110,6 +117,7 @@
|
|
|
110
117
|
disabled: false,
|
|
111
118
|
readonly: false,
|
|
112
119
|
clearable: true,
|
|
120
|
+
cipher: true,
|
|
113
121
|
verify: false,
|
|
114
122
|
prefix: () => [],
|
|
115
123
|
suffix: () => [],
|
|
@@ -124,6 +132,14 @@
|
|
|
124
132
|
// 错误
|
|
125
133
|
error: {},
|
|
126
134
|
});
|
|
135
|
+
const cipherVisible = ref(false);
|
|
136
|
+
|
|
137
|
+
const inputType = computed(() => {
|
|
138
|
+
if (props.type === 'password') {
|
|
139
|
+
return cipherVisible.value ? 'text' : 'password';
|
|
140
|
+
}
|
|
141
|
+
return props.type;
|
|
142
|
+
});
|
|
127
143
|
// 外部传入交互标识,主要用于外部没有输入但点击了提交,或表单提交成功后重置状态
|
|
128
144
|
watch(
|
|
129
145
|
() => props.interacted,
|
|
@@ -199,6 +215,11 @@
|
|
|
199
215
|
emits('update:modelValue', null);
|
|
200
216
|
emits('clear');
|
|
201
217
|
}
|
|
218
|
+
|
|
219
|
+
const toggleCipher = () => {
|
|
220
|
+
if (props.disabled || props.readonly) return;
|
|
221
|
+
cipherVisible.value = !cipherVisible.value;
|
|
222
|
+
};
|
|
202
223
|
// 输入
|
|
203
224
|
const input = (e: any) => {
|
|
204
225
|
// 用户交互
|
|
@@ -3,14 +3,19 @@
|
|
|
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' : ''}`">
|
|
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
10
|
<span>{{ formatLabel(col) }}</span>
|
|
11
11
|
</template>
|
|
12
12
|
</h6>
|
|
13
|
-
<p
|
|
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>
|
|
@@ -267,6 +272,11 @@
|
|
|
267
272
|
type: [Boolean, String],
|
|
268
273
|
default: true,
|
|
269
274
|
},
|
|
275
|
+
// 统一的label class
|
|
276
|
+
labelClass: {
|
|
277
|
+
type: [String, Array, Object],
|
|
278
|
+
default: '',
|
|
279
|
+
},
|
|
270
280
|
// 是否垂直排列
|
|
271
281
|
vertical: {
|
|
272
282
|
type: Boolean,
|