@neatui/vue 1.0.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/README.md +139 -0
- package/package.json +26 -0
- package/src/components/basic/IDraggable.vue +84 -0
- package/src/components/basic/IDraggable@b.vue +80 -0
- package/src/components/basic/IFollowView.vue +172 -0
- package/src/components/basic/IFollowView@v2.vue +188 -0
- package/src/components/basic/IPickerView.vue +351 -0
- package/src/components/basic/IRouterView@v2.vue.backup +119 -0
- package/src/components/basic/IRouterView@v3.vue.backup +252 -0
- package/src/components/basic/IRouterView@v4.vue +362 -0
- package/src/components/basic/IScrollView.vue +127 -0
- package/src/components/basic/Icon.vue +54 -0
- package/src/components/basic/LayerView/Layer.vue +333 -0
- package/src/components/basic/LayerView/index.ts +5 -0
- package/src/components/basic/follow.ts +119 -0
- package/src/components/basic/index.ts +7 -0
- package/src/components/display/Avatar.vue +1 -0
- package/src/components/display/Badge.vue +1 -0
- package/src/components/display/Calendar.vue +245 -0
- package/src/components/display/CalendarReg.vue +245 -0
- package/src/components/display/Card.vue +1 -0
- package/src/components/display/Carousel.vue +1 -0
- package/src/components/display/Collapse.vue +1 -0
- package/src/components/display/Desriptions.vue +1 -0
- package/src/components/display/Empty.vue +1 -0
- package/src/components/display/Image.vue +112 -0
- package/src/components/display/List.vue +1 -0
- package/src/components/display/PhotoEditor.vue +181 -0
- package/src/components/display/PhotoViewer.vue +50 -0
- package/src/components/display/Popover.vue +1 -0
- package/src/components/display/QRCode.vue +1 -0
- package/src/components/display/Segmented.vue +1 -0
- package/src/components/display/Statistic.vue +1 -0
- package/src/components/display/Table.vue +1 -0
- package/src/components/display/Tabs.vue +1 -0
- package/src/components/display/Tag.vue +1 -0
- package/src/components/display/Timeline.vue +1 -0
- package/src/components/display/Tooltip.vue +1 -0
- package/src/components/display/Tour.vue +1 -0
- package/src/components/display/Tree.vue +431 -0
- package/src/components/display/TreeView.vue +222 -0
- package/src/components/display/index.ts +7 -0
- package/src/components/form/Cascader.vue +435 -0
- package/src/components/form/DatePicker.vue +124 -0
- package/src/components/form/DateRangePicker@v2.vue.backup +224 -0
- package/src/components/form/DateRangePicker@v3.vue +116 -0
- package/src/components/form/DateRangeView@v3.vue +386 -0
- package/src/components/form/DateView.vue +231 -0
- package/src/components/form/DateView@v2.vue +386 -0
- package/src/components/form/DateView@v3.vue +471 -0
- package/src/components/form/EditUpload.vue +4 -0
- package/src/components/form/ImgUpload.vue +174 -0
- package/src/components/form/Input.vue.backup +230 -0
- package/src/components/form/Input@v3.vue +267 -0
- package/src/components/form/InputNumber.vue +200 -0
- package/src/components/form/InputRange.vue +235 -0
- package/src/components/form/MoreSelect.vue.backup +144 -0
- package/src/components/form/MoreSelect@v3.vue +190 -0
- package/src/components/form/MoreSelectList.vue +120 -0
- package/src/components/form/MoreSelectPanel@v3.vue +190 -0
- package/src/components/form/MoreSelectPicker.vue +119 -0
- package/src/components/form/MoreSelectTags.vue +119 -0
- package/src/components/form/PageMoreSelect.vue +187 -0
- package/src/components/form/PageSelect.vue +189 -0
- package/src/components/form/SearchMoreSelect.vue +168 -0
- package/src/components/form/SearchSelect.vue.backup +194 -0
- package/src/components/form/SearchSelect@v3.vue +202 -0
- package/src/components/form/Select@v3.vue +201 -0
- package/src/components/form/SelectList.vue +58 -0
- package/src/components/form/SelectPicker.vue +97 -0
- package/src/components/form/SelectTags.vue +52 -0
- package/src/components/form/SelectTree/SelectTree@v1.vue +227 -0
- package/src/components/form/Switch.vue +135 -0
- package/src/components/form/TextArea.vue +171 -0
- package/src/components/form/TimePicker.vue +11 -0
- package/src/components/form/TimeView.vue +244 -0
- package/src/components/form/Upload.vue +349 -0
- package/src/components/form/index.ts +82 -0
- package/src/components/loader/FormLoader/FormLoader@v2.vue +422 -0
- package/src/components/loader/FormLoader/FormLoader@v3.vue.backup +318 -0
- package/src/components/loader/FormLoader/index.ts +2 -0
- package/src/components/loader/LimitLoader/LimitLoader.vue.backup +131 -0
- package/src/components/loader/LimitLoader/LimitLoader@v2.vue.backup +174 -0
- package/src/components/loader/LimitLoader/LimitLoader@v3.vue +183 -0
- package/src/components/loader/LimitLoader/index.ts +2 -0
- package/src/components/loader/TableLoader/TableColView.vue +115 -0
- package/src/components/loader/TableLoader/TableLoader.vue +356 -0
- package/src/components/loader/TableLoader/index.ts +2 -0
- package/src/components/loader/ViewLoader/ViewLoader@v1.vue +256 -0
- package/src/components/loader/ViewLoader/index.ts +2 -0
- package/src/components/loader/index.ts +5 -0
- package/src/components/tools/FormDraftsView.vue +308 -0
- package/src/components/tools/FormVerifyView.vue +206 -0
- package/src/components/tools/MoreTools.vue +74 -0
- package/src/components/tools/MoreTools@v2.vue +74 -0
- package/src/components/tools/Pagination@a.vue +222 -0
- package/src/components/tools/Pagination@b.vue +221 -0
- package/src/components/tools/index.ts +5 -0
- package/src/index.ts +5 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="dom" :class="btnClass" :style="btnStyle" class="fekit-picker-button" data-aaa="111" @click="toggle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
<Teleport to="#fekit">
|
|
6
|
+
<div v-if="state.view" :view="state.view" am-view="am" class="fekit-picker">
|
|
7
|
+
<div :ui-flex="`col cb`" class="fekit-picker-wrap" @animationend="anim" @click="_sys_hide">
|
|
8
|
+
<div class="picker bg-fore picker-virtual-key">
|
|
9
|
+
<slot name="options"></slot>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</Teleport>
|
|
14
|
+
</template>
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
import { reactive, ref, onMounted } from 'vue';
|
|
17
|
+
|
|
18
|
+
// 回调合集
|
|
19
|
+
const on: any = {
|
|
20
|
+
show() {},
|
|
21
|
+
hide() {},
|
|
22
|
+
open() {},
|
|
23
|
+
none() {}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const area: any = document.querySelector('#fekit');
|
|
27
|
+
if (!area) {
|
|
28
|
+
const el = document.createElement('div');
|
|
29
|
+
el.id = 'fekit';
|
|
30
|
+
el.style.position = 'absolute';
|
|
31
|
+
document.body.appendChild(el);
|
|
32
|
+
}
|
|
33
|
+
const emits = defineEmits(['update:modelValue', 'show', 'hide']);
|
|
34
|
+
const props = defineProps({
|
|
35
|
+
btnClass: { type: String, default: 'dib' },
|
|
36
|
+
btnStyle: { type: String, default: 'dib' }
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const dom: any = ref(null);
|
|
40
|
+
const tip: any = ref(null);
|
|
41
|
+
const state = reactive({
|
|
42
|
+
view: 0,
|
|
43
|
+
show: 0
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// 开关
|
|
47
|
+
const toggle = () => {
|
|
48
|
+
state.view = state.view ? 0 : 2;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// 显示弹层
|
|
52
|
+
const show = (then = () => {}) => {
|
|
53
|
+
state.view = 2;
|
|
54
|
+
on.show = then;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// 隐藏弹层
|
|
58
|
+
const hide = (then = () => {}) => {
|
|
59
|
+
if (state.view === 3) {
|
|
60
|
+
state.view = 1;
|
|
61
|
+
on.hide = then;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// 监听动画
|
|
66
|
+
const anim = () => {
|
|
67
|
+
if (state.view === 1) {
|
|
68
|
+
state.view = 0;
|
|
69
|
+
on.hide();
|
|
70
|
+
emits('hide');
|
|
71
|
+
}
|
|
72
|
+
if (state.view === 2) {
|
|
73
|
+
state.view = 3;
|
|
74
|
+
on.show();
|
|
75
|
+
emits('show');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// 取消
|
|
80
|
+
const cancel = ({ target }: any = {}) => {
|
|
81
|
+
if (tip.value && !tip.value?.contains(target) && dom.value && !dom.value.contains(target)) {
|
|
82
|
+
state.show = 0;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// 点暗层关闭
|
|
87
|
+
const _sys_hide = (ev: any) => {
|
|
88
|
+
if (ev.target.className === 'fekit-picker-wrap' && state.view === 3) {
|
|
89
|
+
state.view = 1;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
document.addEventListener('click', cancel, true);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
defineExpose({
|
|
98
|
+
show,
|
|
99
|
+
hide
|
|
100
|
+
});
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<style lang="scss">
|
|
104
|
+
.fekit-picker-button {
|
|
105
|
+
& > *,
|
|
106
|
+
[ui-form-prefix],
|
|
107
|
+
[ui-form-suffix] {
|
|
108
|
+
pointer-events: none !important;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.picker {
|
|
113
|
+
width: 100%;
|
|
114
|
+
max-height: 50%;
|
|
115
|
+
border-radius: 0.5em 0.5em 0 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// 显示动画
|
|
119
|
+
@keyframes am-show-am {
|
|
120
|
+
0% {
|
|
121
|
+
opacity: 0;
|
|
122
|
+
transform: translate3d(0, 100%, 0) scale3d(1, 1, 1);
|
|
123
|
+
}
|
|
124
|
+
100% {
|
|
125
|
+
opacity: 1;
|
|
126
|
+
transform: translate3d(0, 0%, 0) scale3d(1, 1, 1);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// 隐藏动画
|
|
131
|
+
@keyframes am-hide-am {
|
|
132
|
+
0% {
|
|
133
|
+
opacity: 1;
|
|
134
|
+
transform: translate3d(0, 0%, 0) scale3d(1, 1, 1);
|
|
135
|
+
}
|
|
136
|
+
100% {
|
|
137
|
+
opacity: 0;
|
|
138
|
+
transform: translate3d(0, 100%, 0) scale3d(1, 1, 1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 引用显示
|
|
143
|
+
%am-show-am {
|
|
144
|
+
transform: translate3d(0, -150%, 0);
|
|
145
|
+
opacity: 0;
|
|
146
|
+
transform-style: preserve-3d;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// 引用隐藏
|
|
150
|
+
%am-hide-am {
|
|
151
|
+
transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
|
|
152
|
+
opacity: 0;
|
|
153
|
+
transform-style: preserve-3d;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 传参调用
|
|
157
|
+
@mixin am-view-am($time: 450ms, $delay: 100ms) {
|
|
158
|
+
&.show,
|
|
159
|
+
&[view='2'] {
|
|
160
|
+
& > * {
|
|
161
|
+
@extend %am-show-am;
|
|
162
|
+
animation: am-show-am $time $delay both;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&.hide,
|
|
167
|
+
&[view='1'] {
|
|
168
|
+
opacity: 0;
|
|
169
|
+
transition: ($time + $delay) * (4 * 0.1) ($time + $delay) * (6 * 0.1);
|
|
170
|
+
pointer-events: none;
|
|
171
|
+
|
|
172
|
+
& > * {
|
|
173
|
+
@extend %am-hide-am;
|
|
174
|
+
animation: am-hide-am $time $delay both;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&.none,
|
|
179
|
+
&[view='0'] {
|
|
180
|
+
display: none;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// 动画时间
|
|
185
|
+
$time: 400ms;
|
|
186
|
+
$delay: 100ms;
|
|
187
|
+
|
|
188
|
+
// 全套引用
|
|
189
|
+
[am-view='am'] {
|
|
190
|
+
&.show,
|
|
191
|
+
&[view='2'] {
|
|
192
|
+
& > * {
|
|
193
|
+
@extend %am-show-am;
|
|
194
|
+
animation: am-show-am $time $delay both;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&.hide,
|
|
199
|
+
&[view='1'] {
|
|
200
|
+
opacity: 0;
|
|
201
|
+
transition: ($time + $delay) * 0.4 ($time + $delay) * 0.6;
|
|
202
|
+
pointer-events: none;
|
|
203
|
+
|
|
204
|
+
& > * {
|
|
205
|
+
@extend %am-hide-am;
|
|
206
|
+
animation: am-hide-am $time $delay ease-in-out both;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&.none,
|
|
211
|
+
&[view='0'] {
|
|
212
|
+
display: none;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@keyframes am-dark-show {
|
|
217
|
+
0% {
|
|
218
|
+
background-color: rgba(0, 0, 0, 0);
|
|
219
|
+
}
|
|
220
|
+
100% {
|
|
221
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@keyframes am-dark-hide {
|
|
226
|
+
0% {
|
|
227
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
228
|
+
}
|
|
229
|
+
100% {
|
|
230
|
+
background-color: rgba(0, 0, 0, 0);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// 弹层
|
|
235
|
+
.fekit-picker {
|
|
236
|
+
position: fixed;
|
|
237
|
+
width: 100%;
|
|
238
|
+
height: 100%;
|
|
239
|
+
left: 0;
|
|
240
|
+
top: 0;
|
|
241
|
+
z-index: 50;
|
|
242
|
+
background-color: rgba(0, 0, 0, 0);
|
|
243
|
+
pointer-events: none;
|
|
244
|
+
transition: all 0.3s;
|
|
245
|
+
|
|
246
|
+
&[view~='1'] {
|
|
247
|
+
animation: am-dark-hide 0.3s both;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&[view~='2'],
|
|
251
|
+
&[view~='3'] {
|
|
252
|
+
animation: am-dark-show 0.3s both;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
&-wrap {
|
|
256
|
+
position: relative;
|
|
257
|
+
width: 100%;
|
|
258
|
+
height: 100%;
|
|
259
|
+
pointer-events: auto;
|
|
260
|
+
|
|
261
|
+
& > * {
|
|
262
|
+
position: relative !important;
|
|
263
|
+
|
|
264
|
+
&.com-dialog {
|
|
265
|
+
max-width: 80%;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&-close {
|
|
271
|
+
position: absolute;
|
|
272
|
+
width: 2rem;
|
|
273
|
+
height: 2rem;
|
|
274
|
+
line-height: 2rem;
|
|
275
|
+
right: 0.5rem;
|
|
276
|
+
top: 0.5rem;
|
|
277
|
+
text-align: center;
|
|
278
|
+
transform: rotate(0deg);
|
|
279
|
+
transition: all 0.2s;
|
|
280
|
+
|
|
281
|
+
&:hover {
|
|
282
|
+
transform: rotate(-90deg);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&-close {
|
|
287
|
+
position: absolute;
|
|
288
|
+
width: 18px;
|
|
289
|
+
height: 18px;
|
|
290
|
+
right: 0.5em;
|
|
291
|
+
top: 0.5em;
|
|
292
|
+
padding: 0.25em;
|
|
293
|
+
text-align: center;
|
|
294
|
+
transition: all 0.2s;
|
|
295
|
+
border-radius: 50%;
|
|
296
|
+
background:
|
|
297
|
+
linear-gradient(45deg, transparent 44%, currentColor 46%, currentColor 54%, transparent 56%) no-repeat center / 50% 50%,
|
|
298
|
+
linear-gradient(-45deg, transparent 44%, currentColor 46%, currentColor 54%, transparent 56%) no-repeat center / 50% 50%;
|
|
299
|
+
transform: scale(1) rotate(0deg);
|
|
300
|
+
opacity: 0.8;
|
|
301
|
+
transition: all 0.25s;
|
|
302
|
+
|
|
303
|
+
&:hover {
|
|
304
|
+
transform: scale(1) rotate(-90deg);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
&:active {
|
|
308
|
+
transform: scale(0.8) rotate(-90deg);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
&::before {
|
|
312
|
+
position: absolute;
|
|
313
|
+
content: '';
|
|
314
|
+
width: 200%;
|
|
315
|
+
height: 200%;
|
|
316
|
+
left: -50%;
|
|
317
|
+
top: -50%;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
@supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) {
|
|
323
|
+
.picker-virtual-key {
|
|
324
|
+
padding-bottom: constant(safe-area-inset-bottom) !important;
|
|
325
|
+
padding-bottom: env(safe-area-inset-bottom) !important;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
html {
|
|
330
|
+
&[size='xs'] {
|
|
331
|
+
.fekit-picker-close {
|
|
332
|
+
width: 16px;
|
|
333
|
+
height: 16px;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
&[size='l'] {
|
|
338
|
+
.fekit-picker-close {
|
|
339
|
+
width: 20px;
|
|
340
|
+
height: 20px;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
&[size='xl'] {
|
|
345
|
+
.fekit-picker-close {
|
|
346
|
+
width: 22px;
|
|
347
|
+
height: 22px;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
</style>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :am-view="view" :am-mode="mode" class="route-view pr full bg-back" :view-full="full ? 1 : 0" @animationend="anim">
|
|
3
|
+
<div class="full" am-view-item="list">
|
|
4
|
+
<slot name="list" :mode="mode"></slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="full" am-view-item="item">
|
|
7
|
+
<slot name="item" :mode="mode"></slot>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { ref, watch } from 'vue';
|
|
13
|
+
import { useRoute } from 'vue-router';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
full?: boolean | 0 | 1;
|
|
17
|
+
once?: number;
|
|
18
|
+
mode?: 'default' | 'preview' | 'window';
|
|
19
|
+
}
|
|
20
|
+
const props: any = withDefaults(defineProps<Props>(), {
|
|
21
|
+
full: 0,
|
|
22
|
+
once: 0,
|
|
23
|
+
mode: 'default'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const route = useRoute();
|
|
27
|
+
const init = ref(0);
|
|
28
|
+
const view = ref('');
|
|
29
|
+
const anim = (e: any) => {
|
|
30
|
+
if (e.animationName === 'am-hide') {
|
|
31
|
+
view.value = route.query.id ? 'item' : 'list';
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const a = () => {
|
|
36
|
+
if (init.value) {
|
|
37
|
+
if (!props.once) {
|
|
38
|
+
view.value = route.query.id ? 'iteming' : 'listing';
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
view.value = route.query.id ? 'item' : 'list';
|
|
42
|
+
init.value = 1;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
watch(() => route.query.id, a);
|
|
47
|
+
a();
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<style lang="scss">
|
|
51
|
+
// 默认模式
|
|
52
|
+
[am-view] {
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
|
|
55
|
+
@keyframes am-show {
|
|
56
|
+
0% {
|
|
57
|
+
opacity: 0;
|
|
58
|
+
transform: translate3d(2em, 0, 0);
|
|
59
|
+
}
|
|
60
|
+
100% {
|
|
61
|
+
opacity: 1;
|
|
62
|
+
transform: translate3d(0, 0, 0);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
@keyframes am-hide {
|
|
66
|
+
0% {
|
|
67
|
+
opacity: 1;
|
|
68
|
+
transform: translate3d(0, 0, 0);
|
|
69
|
+
}
|
|
70
|
+
100% {
|
|
71
|
+
opacity: 0;
|
|
72
|
+
transform: translate3d(2em, 0, 0);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&[view-full~='1'] {
|
|
77
|
+
position: fixed;
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 100%;
|
|
80
|
+
left: 0;
|
|
81
|
+
top: 0;
|
|
82
|
+
z-index: 15;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[am-view-item] {
|
|
86
|
+
display: none;
|
|
87
|
+
|
|
88
|
+
&[am-view-item~='row'] {
|
|
89
|
+
flex-direction: row !important;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
&[am-view='list'] {
|
|
93
|
+
[am-view-item~='list'] {
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
display: flex;
|
|
96
|
+
animation: am-show 0.35s ease both;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
&[am-view='listing'] {
|
|
100
|
+
[am-view-item~='item'] {
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
display: flex;
|
|
103
|
+
animation: am-hide 0.3s ease-in-out both;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
&[am-view='item'] {
|
|
107
|
+
[am-view-item~='item'] {
|
|
108
|
+
display: flex;
|
|
109
|
+
animation: am-show 0.35s ease both;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
&[am-view='iteming'] {
|
|
113
|
+
[am-view-item~='list'] {
|
|
114
|
+
display: flex;
|
|
115
|
+
animation: am-hide 0.3s ease-in-out both;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :am-view="view" :am-mode="mode" class="route-view pr full bg-back" :view-full="full ? 1 : 0" @animationend="anim">
|
|
3
|
+
<div class="full" am-view-item="list">
|
|
4
|
+
<slot name="list" :mode="mode"></slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div v-if="mode === 'default'" class="full" am-view-item="item">
|
|
7
|
+
<slot name="item" :mode="mode"></slot>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-if="mode === 'preview'" class="full" am-view-item="side" ref="SideRef">
|
|
10
|
+
<slot name="side" :mode="mode"></slot>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { onMounted, ref, watch } from 'vue';
|
|
16
|
+
import { useRoute, useRouter } from 'vue-router';
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
full?: boolean | 0 | 1;
|
|
20
|
+
once?: number;
|
|
21
|
+
mode?: 'default' | 'preview' | 'window';
|
|
22
|
+
queryName?: string;
|
|
23
|
+
}
|
|
24
|
+
const props: any = withDefaults(defineProps<Props>(), {
|
|
25
|
+
full: 0,
|
|
26
|
+
once: 0,
|
|
27
|
+
mode: 'default',
|
|
28
|
+
queryName: 'id'
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const route = useRoute();
|
|
32
|
+
const router = useRouter();
|
|
33
|
+
const init = ref(0);
|
|
34
|
+
const view = ref('');
|
|
35
|
+
const anim = (e: any) => {
|
|
36
|
+
if (e.animationName === 'am-hide') {
|
|
37
|
+
view.value = route.query[props.queryName] ? 'item' : 'list';
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const a = () => {
|
|
42
|
+
if (init.value) {
|
|
43
|
+
if (!props.once) {
|
|
44
|
+
view.value = route.query[props.queryName] ? 'iteming' : 'listing';
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
view.value = route.query[props.queryName] ? 'item' : 'list';
|
|
48
|
+
init.value = 1;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
watch(() => route.query[props.queryName], a);
|
|
53
|
+
a();
|
|
54
|
+
|
|
55
|
+
const SideRef: any = ref(null);
|
|
56
|
+
// 取消
|
|
57
|
+
const cancel = ({ target }: any = {}) => {
|
|
58
|
+
const ifollow: any = document.querySelector('#ifollow');
|
|
59
|
+
const toasts: any = document.querySelectorAll('.mc-toast');
|
|
60
|
+
if (SideRef.value && !SideRef.value.contains(target) && !ifollow?.contains(target) && Array.from(toasts).every((t: any) => !t.contains(target))) {
|
|
61
|
+
const _query = { ...route.query };
|
|
62
|
+
delete _query[props.queryName];
|
|
63
|
+
router.push({ path: route.path, query: _query });
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
onMounted(() => {
|
|
67
|
+
document.addEventListener('click', cancel, true);
|
|
68
|
+
});
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<style lang="scss">
|
|
72
|
+
// 默认模式
|
|
73
|
+
[am-view][am-mode~='default'] {
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
|
|
76
|
+
@keyframes am-show {
|
|
77
|
+
0% {
|
|
78
|
+
opacity: 0;
|
|
79
|
+
transform: translate3d(2em, 0, 0);
|
|
80
|
+
}
|
|
81
|
+
100% {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
transform: translate3d(0, 0, 0);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
@keyframes am-hide {
|
|
87
|
+
0% {
|
|
88
|
+
opacity: 1;
|
|
89
|
+
transform: translate3d(0, 0, 0);
|
|
90
|
+
}
|
|
91
|
+
100% {
|
|
92
|
+
opacity: 0;
|
|
93
|
+
transform: translate3d(2em, 0, 0);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&[view-full~='1'] {
|
|
98
|
+
position: fixed;
|
|
99
|
+
width: 100%;
|
|
100
|
+
height: 100%;
|
|
101
|
+
left: 0;
|
|
102
|
+
top: 0;
|
|
103
|
+
z-index: 15;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[am-view-item] {
|
|
107
|
+
display: none;
|
|
108
|
+
|
|
109
|
+
&[am-view-item~='row'] {
|
|
110
|
+
flex-direction: row !important;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
&[am-view='list'] {
|
|
114
|
+
[am-view-item~='list'] {
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
display: flex;
|
|
117
|
+
animation: am-show 0.35s ease both;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
&[am-view='listing'] {
|
|
121
|
+
[am-view-item~='item'] {
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
display: flex;
|
|
124
|
+
animation: am-hide 0.3s ease-in-out both;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
&[am-view='item'] {
|
|
128
|
+
[am-view-item~='item'] {
|
|
129
|
+
display: flex;
|
|
130
|
+
animation: am-show 0.35s ease both;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
&[am-view='iteming'] {
|
|
134
|
+
[am-view-item~='list'] {
|
|
135
|
+
display: flex;
|
|
136
|
+
animation: am-hide 0.3s ease-in-out both;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// 默认模式
|
|
142
|
+
[am-view][am-mode~='preview'] {
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
|
|
145
|
+
&[view-full~='1'] {
|
|
146
|
+
position: fixed;
|
|
147
|
+
width: 100%;
|
|
148
|
+
height: 100%;
|
|
149
|
+
left: 0;
|
|
150
|
+
top: 0;
|
|
151
|
+
z-index: 15;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
[am-view-item] {
|
|
155
|
+
&[am-view-item~='row'] {
|
|
156
|
+
flex-direction: row !important;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&[am-view-item~='list'] {
|
|
160
|
+
display: flex;
|
|
161
|
+
}
|
|
162
|
+
&[am-view-item~='side'] {
|
|
163
|
+
position: absolute;
|
|
164
|
+
top: 0;
|
|
165
|
+
right: 0;
|
|
166
|
+
z-index: 10;
|
|
167
|
+
display: flex;
|
|
168
|
+
justify-content: flex-end;
|
|
169
|
+
align-items: stretch;
|
|
170
|
+
align-content: space-between;
|
|
171
|
+
pointer-events: none;
|
|
172
|
+
& > * {
|
|
173
|
+
pointer-events: auto;
|
|
174
|
+
}
|
|
175
|
+
transition: all 0.5s;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
&[am-view='list'],
|
|
179
|
+
&[am-view='listing'] {
|
|
180
|
+
[am-view-item~='side'] {
|
|
181
|
+
display: flex;
|
|
182
|
+
opacity: 0;
|
|
183
|
+
transform: translate3d(110%, 0, 0);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
&[am-view='item'],
|
|
187
|
+
&[am-view='iteming'] {
|
|
188
|
+
[am-view-item~='side'] {
|
|
189
|
+
display: flex;
|
|
190
|
+
opacity: 1;
|
|
191
|
+
transform: translate3d(0, 0, 0);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// 开新窗口
|
|
197
|
+
|
|
198
|
+
// 弹出窗口
|
|
199
|
+
[am-view][am-mode~='pop-up'] {
|
|
200
|
+
overflow: hidden;
|
|
201
|
+
|
|
202
|
+
&[view-full~='1'] {
|
|
203
|
+
position: fixed;
|
|
204
|
+
width: 100%;
|
|
205
|
+
height: 100%;
|
|
206
|
+
left: 0;
|
|
207
|
+
top: 0;
|
|
208
|
+
z-index: 15;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
[am-view-item] {
|
|
212
|
+
&[am-view-item~='row'] {
|
|
213
|
+
flex-direction: row !important;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
&[am-view-item~='list'] {
|
|
217
|
+
display: flex;
|
|
218
|
+
}
|
|
219
|
+
&[am-view-item~='side'] {
|
|
220
|
+
position: absolute;
|
|
221
|
+
top: 0;
|
|
222
|
+
right: 0;
|
|
223
|
+
z-index: 10;
|
|
224
|
+
display: flex;
|
|
225
|
+
justify-content: flex-end;
|
|
226
|
+
align-items: stretch;
|
|
227
|
+
align-content: space-between;
|
|
228
|
+
pointer-events: none;
|
|
229
|
+
& > * {
|
|
230
|
+
pointer-events: auto;
|
|
231
|
+
}
|
|
232
|
+
transition: all 0.5s;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
&[am-view='list'],
|
|
236
|
+
&[am-view='listing'] {
|
|
237
|
+
[am-view-item~='side'] {
|
|
238
|
+
display: flex;
|
|
239
|
+
opacity: 0;
|
|
240
|
+
transform: translate3d(110%, 0, 0);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
&[am-view='item'],
|
|
244
|
+
&[am-view='iteming'] {
|
|
245
|
+
[am-view-item~='side'] {
|
|
246
|
+
display: flex;
|
|
247
|
+
opacity: 1;
|
|
248
|
+
transform: translate3d(0, 0, 0);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
</style>
|