@neatui/nuxt 1.1.0 → 1.2.1
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
@@ -93,7 +93,7 @@
|
|
93
93
|
}
|
94
94
|
};
|
95
95
|
|
96
|
-
if (import
|
96
|
+
if (import?.meta?.client) {
|
97
97
|
provide('onlist', evs('list', 'item'));
|
98
98
|
provide('onitem', evs('item', 'list'));
|
99
99
|
watch(() => route.query[props.queryName], a);
|
@@ -103,7 +103,6 @@
|
|
103
103
|
// 取消
|
104
104
|
const cancel = () => {
|
105
105
|
const _query = { ...route.query };
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
107
106
|
delete _query[props.queryName];
|
108
107
|
router.push({ path: route.path, query: _query });
|
109
108
|
};
|
@@ -177,27 +176,27 @@
|
|
177
176
|
}
|
178
177
|
}
|
179
178
|
&[am-view='list'] {
|
180
|
-
[am-view-item~='list'] {
|
179
|
+
& > [am-view-item~='list'] {
|
181
180
|
flex-direction: column;
|
182
181
|
display: flex;
|
183
182
|
animation: am-show-default 0.35s ease both;
|
184
183
|
}
|
185
184
|
}
|
186
185
|
&[am-view='listing'] {
|
187
|
-
[am-view-item~='item'] {
|
186
|
+
& > [am-view-item~='item'] {
|
188
187
|
flex-direction: column;
|
189
188
|
display: flex;
|
190
189
|
animation: am-hide-default 0.3s ease-in-out both;
|
191
190
|
}
|
192
191
|
}
|
193
192
|
&[am-view='item'] {
|
194
|
-
[am-view-item~='item'] {
|
193
|
+
& > [am-view-item~='item'] {
|
195
194
|
display: flex;
|
196
195
|
animation: am-show-default 0.35s ease both;
|
197
196
|
}
|
198
197
|
}
|
199
198
|
&[am-view='iteming'] {
|
200
|
-
[am-view-item~='list'] {
|
199
|
+
& > [am-view-item~='list'] {
|
201
200
|
display: flex;
|
202
201
|
animation: am-hide-default 0.3s ease-in-out both;
|
203
202
|
}
|
@@ -247,9 +246,6 @@
|
|
247
246
|
flex-direction: row !important;
|
248
247
|
}
|
249
248
|
|
250
|
-
&[am-view-item~='list'] {
|
251
|
-
display: flex;
|
252
|
-
}
|
253
249
|
&[am-view-item~='item'] {
|
254
250
|
position: absolute;
|
255
251
|
top: 0;
|
@@ -264,14 +260,14 @@
|
|
264
260
|
}
|
265
261
|
&[am-view='list'],
|
266
262
|
&[am-view='listing'] {
|
267
|
-
[am-view-item~='item'] {
|
263
|
+
& > [am-view-item~='item'] {
|
268
264
|
display: flex;
|
269
265
|
animation: am-hide-preview 0.5s ease-in-out both;
|
270
266
|
}
|
271
267
|
}
|
272
268
|
&[am-view='item'],
|
273
269
|
&[am-view='iteming'] {
|
274
|
-
[am-view-item~='item'] {
|
270
|
+
& > [am-view-item~='item'] {
|
275
271
|
display: flex;
|
276
272
|
animation: am-show-preview 0.5s ease both;
|
277
273
|
}
|
@@ -358,7 +354,7 @@
|
|
358
354
|
}
|
359
355
|
&[am-view='list'],
|
360
356
|
&[am-view='listing'] {
|
361
|
-
[am-view-item~='item'] {
|
357
|
+
& > [am-view-item~='item'] {
|
362
358
|
display: flex;
|
363
359
|
opacity: 0;
|
364
360
|
& > * {
|
@@ -368,7 +364,7 @@
|
|
368
364
|
}
|
369
365
|
&[am-view='item'],
|
370
366
|
&[am-view='iteming'] {
|
371
|
-
[am-view-item~='item'] {
|
367
|
+
& > [am-view-item~='item'] {
|
372
368
|
display: flex;
|
373
369
|
opacity: 1;
|
374
370
|
& > * {
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import Pagination from './Pagination@a.vue';
|
2
2
|
import MoreTools from './MoreTools.vue';
|
3
3
|
import FormDraftsView from './FormDraftsView.vue';
|
4
|
-
|
5
|
-
export { Pagination, MoreTools, FormDraftsView, FormVerifyView };
|
4
|
+
export { Pagination, MoreTools, FormDraftsView };
|
@@ -1,207 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div ui-tips="@a co:well">
|
3
|
-
<button :ui-btn="`@a s none ${verify?.length ? '' : ':square'}`" :class="`${verify?.length ? 'co-risk' : 'co-well'}`" @click="state.show = state.show ? 0 : 1">
|
4
|
-
<i v-if="verify?.length" class="icon icon-verify-no co-risk"></i>
|
5
|
-
<i v-else class="icon icon-verify-ok co-well"></i>
|
6
|
-
<span v-if="verify?.length">{{ verify?.length }}</span>
|
7
|
-
</button>
|
8
|
-
<div ui-tips-box="tl" :ux-view="state.show" class="w-xl mob:w-ll n-ms">
|
9
|
-
<div class="fekit-layer-close" ui-flex="row cm" @click="state.show = 0"><i class="icon icon-close fs-xs"></i></div>
|
10
|
-
<h4>温馨提示</h4>
|
11
|
-
<p v-if="verify?.length" class="ny-sm">本条记录疑似有{{ verify?.length }}个错误,您再检查一遍吧~</p>
|
12
|
-
<p v-else class="nb-sm">好棒哦,没有发现任何错误!</p>
|
13
|
-
<p v-if="verify.length">
|
14
|
-
<span v-if="state.detail" class="ux-click co-link" @click="state.detail = 0">隐藏详情<i class="icon icon-dropdown r180"></i></span>
|
15
|
-
<span v-else class="ux-click co-link" @click="state.detail = 1">显示详情<i class="icon icon-dropdown"></i></span>
|
16
|
-
</p>
|
17
|
-
<ul v-if="state.detail" class="co-read" ui-scroll=":y s" style="max-height: 8em">
|
18
|
-
<li v-for="(err, idx) in verify" :key="idx">
|
19
|
-
<i v-if="err.type === 'warn'" class="icon icon-warn co-warn"></i>
|
20
|
-
<i v-else class="icon icon-error co-risk"></i>
|
21
|
-
<span class="nl-ss">
|
22
|
-
<span class="ux-hover ny-xs nx-ss r-sm" @click="fScrollToField(err.path)">[{{ err.label }}]</span>
|
23
|
-
<span class="ml-sm">{{ err.msg || '有一个错误' }}</span>
|
24
|
-
</span>
|
25
|
-
</li>
|
26
|
-
</ul>
|
27
|
-
</div>
|
28
|
-
</div>
|
29
|
-
</template>
|
30
|
-
<script setup lang="ts">
|
31
|
-
import { computed, reactive, toRefs, watch, onMounted, ref, onUnmounted } from 'vue';
|
32
|
-
import { useRoute } from 'vue-router';
|
33
|
-
import scrollTo from '@fekit/scrollto';
|
34
|
-
import { deepcopy, isArray, isObject, isFunction } from '@fekit/utils';
|
35
|
-
|
36
|
-
const route: any = useRoute();
|
37
|
-
|
38
|
-
const props: any = defineProps({
|
39
|
-
area: {
|
40
|
-
type: [Object, HTMLElement],
|
41
|
-
default: () => (import.meta.client ? document.body : null),
|
42
|
-
},
|
43
|
-
data: {
|
44
|
-
type: Object,
|
45
|
-
required: true,
|
46
|
-
default: () => ({}),
|
47
|
-
},
|
48
|
-
form: {
|
49
|
-
type: Object,
|
50
|
-
default: () => ({}),
|
51
|
-
},
|
52
|
-
});
|
53
|
-
|
54
|
-
const state: any = reactive({
|
55
|
-
__update: true,
|
56
|
-
mode: route.query.mode,
|
57
|
-
show: 0,
|
58
|
-
detail: 1,
|
59
|
-
// 数据校验
|
60
|
-
verify: computed(() => {
|
61
|
-
const error: any = [{ __update: state.__update }];
|
62
|
-
const edit = props.data || {};
|
63
|
-
const form = props.form || {};
|
64
|
-
// 核心
|
65
|
-
const core = (data: any = {}, form: any = {}, path: any = '') => {
|
66
|
-
Object.keys(data).forEach((item: any) => {
|
67
|
-
// 是否有表单结构
|
68
|
-
if (form[item]) {
|
69
|
-
// 是否末端
|
70
|
-
if (form[item]?.child && (isArray(data[item]) || isObject(data[item]))) {
|
71
|
-
if (isArray(data[item])) {
|
72
|
-
data[item].forEach((sub: any, idx: number) => {
|
73
|
-
core(sub, form[item].child, path + '-' + form[item].field + '-' + idx);
|
74
|
-
});
|
75
|
-
} else {
|
76
|
-
(Object.values(data[item]) || []).forEach((sub: any, idx: number) => {
|
77
|
-
core(sub, form[item].child, path + '-' + form[item].field + '-' + idx);
|
78
|
-
});
|
79
|
-
}
|
80
|
-
} else {
|
81
|
-
const value = data[item];
|
82
|
-
const { label = '', field = '', rules = [], clear = false } = form[item] || {};
|
83
|
-
if (isFunction(clear) ? !clear(data) : !clear) {
|
84
|
-
const _path = path + '-' + field;
|
85
|
-
rules?.forEach((rule: any = {}) => {
|
86
|
-
const { type = '', msg = '', required = null, validator = null } = rule;
|
87
|
-
if (required) {
|
88
|
-
if (isArray(value)) {
|
89
|
-
if (!value.length) {
|
90
|
-
error.push({ field, label, type, msg, path: _path });
|
91
|
-
}
|
92
|
-
} else {
|
93
|
-
if (!value) {
|
94
|
-
error.push({ field, label, type, msg, path: _path });
|
95
|
-
}
|
96
|
-
}
|
97
|
-
}
|
98
|
-
const _validator = isFunction(validator) ? validator(deepcopy(props.data)) : null;
|
99
|
-
if (value && _validator && !_validator(value)) {
|
100
|
-
error.push({ field, label, type, msg, path: _path });
|
101
|
-
}
|
102
|
-
});
|
103
|
-
}
|
104
|
-
}
|
105
|
-
}
|
106
|
-
});
|
107
|
-
};
|
108
|
-
core(edit, form, '#form-field');
|
109
|
-
error.shift();
|
110
|
-
return error;
|
111
|
-
}),
|
112
|
-
});
|
113
|
-
const { verify = [] }: any = toRefs(state);
|
114
|
-
|
115
|
-
// 为了在退出编辑的时候平滑过滤
|
116
|
-
watch(
|
117
|
-
() => route.query.mode,
|
118
|
-
(mode) => {
|
119
|
-
if (mode) {
|
120
|
-
state.mode = mode;
|
121
|
-
} else {
|
122
|
-
setTimeout(() => {
|
123
|
-
state.mode = '';
|
124
|
-
state.show = 0;
|
125
|
-
}, 300);
|
126
|
-
}
|
127
|
-
},
|
128
|
-
);
|
129
|
-
|
130
|
-
const fScrollToField = (path: any) => {
|
131
|
-
if (!import.meta.client) return;
|
132
|
-
const dom = document.querySelector(path);
|
133
|
-
if (dom) {
|
134
|
-
scrollTo({
|
135
|
-
el: props.area,
|
136
|
-
to: {
|
137
|
-
y: dom,
|
138
|
-
},
|
139
|
-
offset: { y: -36 },
|
140
|
-
then() {
|
141
|
-
const input = dom.querySelector('input');
|
142
|
-
if (input) {
|
143
|
-
input?.focus();
|
144
|
-
}
|
145
|
-
},
|
146
|
-
});
|
147
|
-
}
|
148
|
-
};
|
149
|
-
|
150
|
-
// 初始化时进入页面时自动弹出
|
151
|
-
const timer1: any = ref(null);
|
152
|
-
onMounted(() => {
|
153
|
-
timer1.value = setTimeout(() => {
|
154
|
-
if (state.verify.length) {
|
155
|
-
state.show = 1;
|
156
|
-
}
|
157
|
-
}, 1000);
|
158
|
-
});
|
159
|
-
onUnmounted(() => {
|
160
|
-
clearTimeout(timer1.value);
|
161
|
-
});
|
162
|
-
|
163
|
-
const timer2: any = ref(null);
|
164
|
-
watch(
|
165
|
-
() => state.verify,
|
166
|
-
() => {
|
167
|
-
clearTimeout(timer2.value);
|
168
|
-
if (state.show && !state.verify.length) {
|
169
|
-
timer2.value = setTimeout(() => {
|
170
|
-
state.show = 0;
|
171
|
-
}, 1000);
|
172
|
-
}
|
173
|
-
},
|
174
|
-
);
|
175
|
-
|
176
|
-
// 初始化后进入页面时自动弹出
|
177
|
-
const timer3: any = ref(null);
|
178
|
-
watch(
|
179
|
-
() => route.query.mode,
|
180
|
-
(mode: any) => {
|
181
|
-
clearTimeout(timer3.value);
|
182
|
-
if (mode === 'edit') {
|
183
|
-
timer3.value = setTimeout(() => {
|
184
|
-
if (state.verify.length) {
|
185
|
-
state.show = 1;
|
186
|
-
}
|
187
|
-
}, 1000);
|
188
|
-
} else {
|
189
|
-
if (state.show) {
|
190
|
-
setTimeout(() => {
|
191
|
-
state.show = 0;
|
192
|
-
}, 300);
|
193
|
-
}
|
194
|
-
}
|
195
|
-
},
|
196
|
-
);
|
197
|
-
|
198
|
-
watch(
|
199
|
-
() => props.data,
|
200
|
-
() => {
|
201
|
-
state.__update = !state.__update;
|
202
|
-
},
|
203
|
-
{
|
204
|
-
deep: true,
|
205
|
-
},
|
206
|
-
);
|
207
|
-
</script>
|