@neatui/nuxt 1.0.8 → 1.2.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 +1 -1
- package/src/components/basic/LayerView/Layer.vue +1 -1
- package/src/components/loader/LayerLoader/LayerLoader.vue +18 -14
- package/src/components/loader/LimitLoader/LimitLoader@v3.vue +2 -2
- package/src/components/loader/MoveLoader/MoveLoader.vue +4 -2
- package/src/components/loader/TableLoader/TableLoader.vue +2 -2
- package/src/components/tools/Pagination@a.vue +6 -4
- package/src/components/tools/Pagination@b.vue +1 -1
- package/src/components/tools/index.ts +1 -2
- package/src/components/tools/FormVerifyView.vue +0 -207
package/package.json
CHANGED
@@ -103,8 +103,10 @@
|
|
103
103
|
|
104
104
|
const ph = ref(0);
|
105
105
|
onMounted(() => {
|
106
|
-
|
107
|
-
|
106
|
+
if (import.meta.client) {
|
107
|
+
const side = document.getElementById('side-layerloader');
|
108
|
+
ph.value = side?.clientHeight || 0;
|
109
|
+
}
|
108
110
|
});
|
109
111
|
|
110
112
|
// 计算路径
|
@@ -131,18 +133,20 @@
|
|
131
133
|
unfoldActivePath(props.data, newActive);
|
132
134
|
|
133
135
|
nextTick(() => {
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
136
|
+
if (import.meta.client) {
|
137
|
+
const el = document.getElementById(`LID${newActive.replace(/\./g, '')}`);
|
138
|
+
if (el && !store.isMouseInLayer) {
|
139
|
+
scrollto({
|
140
|
+
el: '#side-layerloader',
|
141
|
+
to: {
|
142
|
+
y: el,
|
143
|
+
},
|
144
|
+
offset: {
|
145
|
+
y: -(ph.value / 2.5),
|
146
|
+
},
|
147
|
+
time: 600,
|
148
|
+
});
|
149
|
+
}
|
146
150
|
}
|
147
151
|
});
|
148
152
|
},
|
@@ -108,7 +108,7 @@
|
|
108
108
|
watch(
|
109
109
|
() => props.limit,
|
110
110
|
() => {
|
111
|
-
const _cache = JSON.parse(localStorage.getItem(`${state.name}_limit`) || '{}');
|
111
|
+
const _cache = import.meta.client ? JSON.parse(localStorage.getItem(`${state.name}_limit`) || '{}') : {};
|
112
112
|
state.limit = deepcopy(props.limit)?.map((item: any) => {
|
113
113
|
if (_cache[item.field] && Object.prototype.hasOwnProperty.call(_cache[item.field], '_close')) {
|
114
114
|
item._close = Number(_cache[item.field]?._close);
|
@@ -159,7 +159,7 @@
|
|
159
159
|
}
|
160
160
|
}
|
161
161
|
});
|
162
|
-
localStorage.setItem(`${state.name}_limit`, JSON.stringify(_limit));
|
162
|
+
if (import.meta.client) localStorage.setItem(`${state.name}_limit`, JSON.stringify(_limit));
|
163
163
|
},
|
164
164
|
{ deep: true },
|
165
165
|
);
|
@@ -70,8 +70,10 @@
|
|
70
70
|
|
71
71
|
const ph = ref(0);
|
72
72
|
onMounted(() => {
|
73
|
-
|
74
|
-
|
73
|
+
if (import.meta.client) {
|
74
|
+
const side = document.getElementById('side-layerloader');
|
75
|
+
ph.value = side?.clientHeight || 0;
|
76
|
+
}
|
75
77
|
});
|
76
78
|
|
77
79
|
// 计算路径
|
@@ -264,7 +264,7 @@
|
|
264
264
|
watch(
|
265
265
|
() => props.table,
|
266
266
|
() => {
|
267
|
-
const _cache = JSON.parse(localStorage.getItem(`${name}_table`) || '{}');
|
267
|
+
const _cache = import.meta.client ? JSON.parse(localStorage.getItem(`${name}_table`) || '{}') : {};
|
268
268
|
state.__last = 0;
|
269
269
|
state.table = deepcopy(props.table || [])
|
270
270
|
?.map((col: TableColumn, idx: number) => {
|
@@ -340,7 +340,7 @@
|
|
340
340
|
state.__last = idx;
|
341
341
|
}
|
342
342
|
});
|
343
|
-
localStorage.setItem(`${name}_table`, JSON.stringify(_table));
|
343
|
+
if (import.meta.client) localStorage.setItem(`${name}_table`, JSON.stringify(_table));
|
344
344
|
},
|
345
345
|
{ deep: true },
|
346
346
|
);
|
@@ -210,12 +210,14 @@
|
|
210
210
|
const size = (size: any) => {
|
211
211
|
emits('update:modelValue', { ...props.modelValue, ...{ [props.defined.pageSize || 'pageSize']: size } });
|
212
212
|
emits('size', size);
|
213
|
-
window.localStorage.setItem(state.id, `${size}`);
|
213
|
+
if (import.meta.client) window.localStorage.setItem(state.id, `${size}`);
|
214
214
|
};
|
215
215
|
|
216
216
|
// 缓存
|
217
|
-
|
218
|
-
|
219
|
-
|
217
|
+
if (import.meta.client) {
|
218
|
+
const cache = window.localStorage.getItem(state.id);
|
219
|
+
if (cache) {
|
220
|
+
size(Number(cache));
|
221
|
+
}
|
220
222
|
}
|
221
223
|
</script>
|
@@ -216,6 +216,6 @@
|
|
216
216
|
const size = (size: any) => {
|
217
217
|
emits('update:modelValue', { ...props.modelValue, ...{ pageSize: size } });
|
218
218
|
emits('size', size);
|
219
|
-
window.localStorage.setItem(state.id, `${size}`);
|
219
|
+
if (import.meta.client) window.localStorage.setItem(state.id, `${size}`);
|
220
220
|
};
|
221
221
|
</script>
|
@@ -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: () => (typeof document !== 'undefined' ? 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 (typeof document === 'undefined') 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>
|