@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,333 @@
|
|
|
1
|
+
<!-- 实验性插件 -->
|
|
2
|
+
<template>
|
|
3
|
+
<Teleport :to="area">
|
|
4
|
+
<div
|
|
5
|
+
v-if="state.view"
|
|
6
|
+
:am-view="am"
|
|
7
|
+
:data-key="id"
|
|
8
|
+
:style="`${`${dark}` ? 'background-color: rgba(0, 0, 0, ' + dark + ');' : ''}${zIndex ? 'z-index:' + zIndex + ';' : ''}`"
|
|
9
|
+
:view="state.view"
|
|
10
|
+
class="fekit-layer"
|
|
11
|
+
>
|
|
12
|
+
<div :ui-flex="`col ${flex}`" :style="wrapStyle" class="fekit-layer-wrap" @animationend="anim" @click="_sys_hide">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</Teleport>
|
|
17
|
+
</template>
|
|
18
|
+
<script lang="ts" setup>
|
|
19
|
+
import { onBeforeUnmount, PropType, reactive, ref, watch } from 'vue';
|
|
20
|
+
import { isFunction } from '@fekit/utils';
|
|
21
|
+
|
|
22
|
+
// 弹层队列
|
|
23
|
+
if (!(window as any)._FEKIT_LAYER_TASKS) {
|
|
24
|
+
(window as any)._FEKIT_LAYER_TASKS = {};
|
|
25
|
+
}
|
|
26
|
+
const _tasks: any = (window as any)._FEKIT_LAYER_TASKS;
|
|
27
|
+
|
|
28
|
+
// 弹窗入参
|
|
29
|
+
const props: any = defineProps({
|
|
30
|
+
zIndex: {
|
|
31
|
+
type: [String, Number],
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
area: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: '#fekit'
|
|
37
|
+
},
|
|
38
|
+
id: {
|
|
39
|
+
type: String
|
|
40
|
+
},
|
|
41
|
+
am: {
|
|
42
|
+
type: String as PropType<'aa' | 'ab' | 'ac' | 'ad' | 'ae' | 'af' | 'ag' | 'ah' | 'ai' | 'aj' | 'ak' | 'al' | 'am' | 'an' | 'ao' | 'ap' | 'aq' | 'ar' | 'as' | 'at'>,
|
|
43
|
+
default: 'as'
|
|
44
|
+
},
|
|
45
|
+
flex: {
|
|
46
|
+
type: String as PropType<'lt' | 'ct' | 'rt' | 'lm' | 'cm' | 'rm' | 'lb' | 'cb' | 'rb'>,
|
|
47
|
+
default: 'cm'
|
|
48
|
+
},
|
|
49
|
+
dark: {
|
|
50
|
+
type: [String, Number],
|
|
51
|
+
default: ''
|
|
52
|
+
},
|
|
53
|
+
darkClickClose: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true
|
|
56
|
+
},
|
|
57
|
+
wrapStyle: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: ''
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const _area: any = document.querySelector(props.area);
|
|
64
|
+
if (!_area) {
|
|
65
|
+
const el = document.createElement('div');
|
|
66
|
+
el.id = (props.area || '#fekit').substring(1);
|
|
67
|
+
el.style.position = 'absolute';
|
|
68
|
+
document.body.appendChild(el);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 状态管理
|
|
72
|
+
const state = reactive({
|
|
73
|
+
view: 0,
|
|
74
|
+
params: {},
|
|
75
|
+
top: 0
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
function disableScroll() {
|
|
79
|
+
state.top = document.documentElement.scrollTop;
|
|
80
|
+
document.body.style.overflow = 'hidden';
|
|
81
|
+
document.body.style.position = 'fixed';
|
|
82
|
+
document.body.style.top = `-${state.top}px`;
|
|
83
|
+
document.body.style.width = '100%';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function enableScroll() {
|
|
87
|
+
document.body.style.removeProperty('overflow');
|
|
88
|
+
document.body.style.removeProperty('position');
|
|
89
|
+
document.body.style.removeProperty('top');
|
|
90
|
+
document.body.style.removeProperty('width');
|
|
91
|
+
window.scrollTo(0, state.top);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
watch(
|
|
95
|
+
() => state.view,
|
|
96
|
+
(view: any) => {
|
|
97
|
+
if (view === 2) {
|
|
98
|
+
disableScroll();
|
|
99
|
+
}
|
|
100
|
+
if (view === 0) {
|
|
101
|
+
enableScroll();
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{ deep: true, immediate: true }
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
// 回调合集
|
|
108
|
+
const on: any = {
|
|
109
|
+
show: [],
|
|
110
|
+
hide: [],
|
|
111
|
+
open: [],
|
|
112
|
+
none: []
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// 注入参数
|
|
116
|
+
const init = (params: any = {}) => {
|
|
117
|
+
_tasks[id].params = params;
|
|
118
|
+
if (params?.on?.show) {
|
|
119
|
+
on.show.push(params.on.show);
|
|
120
|
+
}
|
|
121
|
+
if (params?.on?.hide) {
|
|
122
|
+
on.hide.push(params.on.hide);
|
|
123
|
+
}
|
|
124
|
+
return _tasks[id];
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// 显示弹层
|
|
128
|
+
const show = (params: any = {}, then = () => {}) => {
|
|
129
|
+
state.view = 2;
|
|
130
|
+
if (params?.on?.show) {
|
|
131
|
+
on.show.push(params.on.show);
|
|
132
|
+
}
|
|
133
|
+
if (params?.on?.hide) {
|
|
134
|
+
on.hide.push(params.on.hide);
|
|
135
|
+
}
|
|
136
|
+
on.show.push(then);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// 隐藏弹层
|
|
140
|
+
const hide = (_params: any = {}, then = () => {}) => {
|
|
141
|
+
if (state.view === 3) {
|
|
142
|
+
state.view = 1;
|
|
143
|
+
on.hide.push(then);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// 打开弹层(没有动画过程)
|
|
148
|
+
const open = (_params: any = {}, then = () => {}) => {
|
|
149
|
+
state.view = 3;
|
|
150
|
+
on.show.push(then);
|
|
151
|
+
};
|
|
152
|
+
// 关闭弹层(没有动画过程)
|
|
153
|
+
const none = (_params: any = {}, then = () => {}) => {
|
|
154
|
+
state.view = 0;
|
|
155
|
+
on.show.push(then);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// 点暗层关闭
|
|
159
|
+
const _sys_hide = (ev: any) => {
|
|
160
|
+
if (props.darkClickClose && ev.target.className === 'fekit-layer-wrap' && state.view === 3) {
|
|
161
|
+
state.view = 1;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// 监听动画
|
|
166
|
+
const anim = () => {
|
|
167
|
+
if (state.view === 1) {
|
|
168
|
+
state.view = 0;
|
|
169
|
+
on.hide.forEach((fun: any) => {
|
|
170
|
+
isFunction(fun) && fun();
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (state.view === 2) {
|
|
174
|
+
state.view = 3;
|
|
175
|
+
on.show.forEach((fun: any) => {
|
|
176
|
+
isFunction(fun) && fun();
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// 注册弹层
|
|
182
|
+
const { id = '' }: any = { ...props };
|
|
183
|
+
if (_tasks[id]) {
|
|
184
|
+
console.error('Layer 有重复 id', id);
|
|
185
|
+
}
|
|
186
|
+
if (id) {
|
|
187
|
+
_tasks[id] = { init, show, hide, open, none };
|
|
188
|
+
} else {
|
|
189
|
+
console.error('Layer 必须填写全局统一的 id');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// 卸载弹层
|
|
193
|
+
onBeforeUnmount(() => {
|
|
194
|
+
delete _tasks[id];
|
|
195
|
+
});
|
|
196
|
+
</script>
|
|
197
|
+
<!-- <script lang="ts">
|
|
198
|
+
export const LayerById = (id: any) => {
|
|
199
|
+
return (window as any)._FEKIT_LAYER_TASKS[id];
|
|
200
|
+
};
|
|
201
|
+
</script> -->
|
|
202
|
+
|
|
203
|
+
<style lang="scss">
|
|
204
|
+
// 弹层
|
|
205
|
+
.fekit-layer {
|
|
206
|
+
position: fixed;
|
|
207
|
+
width: 100%;
|
|
208
|
+
height: 100%;
|
|
209
|
+
left: 0;
|
|
210
|
+
top: 0;
|
|
211
|
+
z-index: 50;
|
|
212
|
+
background-color: rgba(0, 0, 0, 0.75);
|
|
213
|
+
pointer-events: none;
|
|
214
|
+
|
|
215
|
+
&-wrap {
|
|
216
|
+
position: relative;
|
|
217
|
+
width: 100%;
|
|
218
|
+
height: 100%;
|
|
219
|
+
pointer-events: auto;
|
|
220
|
+
|
|
221
|
+
& > * {
|
|
222
|
+
position: relative !important;
|
|
223
|
+
|
|
224
|
+
&.com-dialog {
|
|
225
|
+
max-width: 80%;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&-close {
|
|
231
|
+
position: absolute;
|
|
232
|
+
width: 1.5em;
|
|
233
|
+
height: 1.5em;
|
|
234
|
+
left: 50%;
|
|
235
|
+
bottom: -2.5rem;
|
|
236
|
+
margin-left: -1rem;
|
|
237
|
+
padding: 0.25em;
|
|
238
|
+
text-align: center;
|
|
239
|
+
transform: scale(1) translate3d(0, -100%, 0);
|
|
240
|
+
transition: all 0.2s;
|
|
241
|
+
color: #fff;
|
|
242
|
+
box-shadow: 0 0 0 2px currentColor;
|
|
243
|
+
border-radius: 50%;
|
|
244
|
+
opacity: 0;
|
|
245
|
+
background:
|
|
246
|
+
linear-gradient(45deg, transparent 44%, currentColor 45%, currentColor 56%, transparent 57%) no-repeat center / 50% 50%,
|
|
247
|
+
linear-gradient(-45deg, transparent 44%, currentColor 45%, currentColor 56%, transparent 57%) no-repeat center / 50% 50%;
|
|
248
|
+
|
|
249
|
+
&:active {
|
|
250
|
+
transform: scale(0.9);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
&[view='3'] {
|
|
255
|
+
.fekit-layer-close {
|
|
256
|
+
opacity: 0.85;
|
|
257
|
+
transform: translate3d(0, 0, 0);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// &-close {
|
|
262
|
+
// position: absolute;
|
|
263
|
+
// width: 2rem;
|
|
264
|
+
// height: 2rem;
|
|
265
|
+
// line-height: 2rem;
|
|
266
|
+
// right: 0.5rem;
|
|
267
|
+
// top: 0.5rem;
|
|
268
|
+
// text-align: center;
|
|
269
|
+
// transform: rotate(0deg);
|
|
270
|
+
// transition: all 0.2s;
|
|
271
|
+
|
|
272
|
+
// &:hover {
|
|
273
|
+
// transform: rotate(-90deg);
|
|
274
|
+
// }
|
|
275
|
+
// }
|
|
276
|
+
|
|
277
|
+
// &-close {
|
|
278
|
+
// position: absolute;
|
|
279
|
+
// width: 18px;
|
|
280
|
+
// height: 18px;
|
|
281
|
+
// right: 0.5em;
|
|
282
|
+
// top: 0.5em;
|
|
283
|
+
// padding: 0.25em;
|
|
284
|
+
// text-align: center;
|
|
285
|
+
// transition: all 0.2s;
|
|
286
|
+
// // box-shadow: 0 0 0 1px currentColor;
|
|
287
|
+
// border-radius: 50%;
|
|
288
|
+
// background: linear-gradient(45deg, transparent 44%, currentColor 46%, currentColor 54%, transparent 56%) no-repeat center / 50% 50%,
|
|
289
|
+
// linear-gradient(-45deg, transparent 44%, currentColor 46%, currentColor 54%, transparent 56%) no-repeat center / 50% 50%;
|
|
290
|
+
// transform: scale(1) rotate(0deg);
|
|
291
|
+
// opacity: 0.8;
|
|
292
|
+
// transition: all 0.25s;
|
|
293
|
+
|
|
294
|
+
// &:hover {
|
|
295
|
+
// transform: scale(1) rotate(-90deg);
|
|
296
|
+
// }
|
|
297
|
+
|
|
298
|
+
// &:active {
|
|
299
|
+
// transform: scale(0.8) rotate(-90deg);
|
|
300
|
+
// }
|
|
301
|
+
|
|
302
|
+
// &::before {
|
|
303
|
+
// position: absolute;
|
|
304
|
+
// content: '';
|
|
305
|
+
// width: 200%;
|
|
306
|
+
// height: 200%;
|
|
307
|
+
// left: -50%;
|
|
308
|
+
// top: -50%;
|
|
309
|
+
// }
|
|
310
|
+
// }
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// html {
|
|
314
|
+
// &[size='xs'] {
|
|
315
|
+
// .fekit-layer-close {
|
|
316
|
+
// width: 16px;
|
|
317
|
+
// height: 16px;
|
|
318
|
+
// }
|
|
319
|
+
// }
|
|
320
|
+
// &[size='l'] {
|
|
321
|
+
// .fekit-layer-close {
|
|
322
|
+
// width: 20px;
|
|
323
|
+
// height: 20px;
|
|
324
|
+
// }
|
|
325
|
+
// }
|
|
326
|
+
// &[size='xl'] {
|
|
327
|
+
// .fekit-layer-close {
|
|
328
|
+
// width: 22px;
|
|
329
|
+
// height: 22px;
|
|
330
|
+
// }
|
|
331
|
+
// }
|
|
332
|
+
// }
|
|
333
|
+
</style>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
2
|
+
|
|
3
|
+
class Follow {
|
|
4
|
+
box: any[];
|
|
5
|
+
dom: any;
|
|
6
|
+
tip: any;
|
|
7
|
+
ing: any;
|
|
8
|
+
sub: any;
|
|
9
|
+
obs: any;
|
|
10
|
+
fun: (status: any) => void;
|
|
11
|
+
private css: () => void;
|
|
12
|
+
z: number;
|
|
13
|
+
constructor(dom: any, tip: any, fun = (_status: any) => {}) {
|
|
14
|
+
this.dom = dom;
|
|
15
|
+
this.tip = tip;
|
|
16
|
+
this.box = [];
|
|
17
|
+
this.css = this.setcss.bind(this);
|
|
18
|
+
this.fun = fun;
|
|
19
|
+
this.sub = this.tip.firstElementChild;
|
|
20
|
+
this.z = 0;
|
|
21
|
+
}
|
|
22
|
+
setcss() {
|
|
23
|
+
if (!this.ing) {
|
|
24
|
+
window.requestAnimationFrame(() => {
|
|
25
|
+
this.ing = false;
|
|
26
|
+
const dr = this.dom?.getBoundingClientRect() || { width: 0, height: 0, top: 0, bottom: 0, left: 0, right: 0 };
|
|
27
|
+
const sr = this.sub?.getBoundingClientRect() || { height: 0 };
|
|
28
|
+
this.tip.style.inset = `${dr.top}px auto auto ${dr.left}px`;
|
|
29
|
+
this.tip.style.width = dr.width + 'px';
|
|
30
|
+
this.tip.style.height = dr.height + 'px';
|
|
31
|
+
this.fun('');
|
|
32
|
+
this.box.forEach((e: any) => {
|
|
33
|
+
const ar = e?.getBoundingClientRect() || {};
|
|
34
|
+
if (dr.bottom < ar.top || dr.top > ar.bottom || dr.right < ar.left || dr.left > ar.right) {
|
|
35
|
+
this.tip.style.opacity = '0';
|
|
36
|
+
this.sub.style.pointerEvents = 'none';
|
|
37
|
+
} else {
|
|
38
|
+
this.tip.style.opacity = '';
|
|
39
|
+
this.sub.style.pointerEvents = '';
|
|
40
|
+
}
|
|
41
|
+
if (dr.bottom + sr.height + 10 > ar.bottom) {
|
|
42
|
+
this.fun('b');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const tr = this.tip?.getBoundingClientRect() || { left: 0 };
|
|
46
|
+
const x = this.sub.offsetLeft + tr.left;
|
|
47
|
+
const arrow = this.sub.querySelector('[ui-tips-arrow]');
|
|
48
|
+
if (x < 0) {
|
|
49
|
+
this.sub.style.transform = `translate3d(${-x}px,0,0)`;
|
|
50
|
+
if (arrow && arrow.style) {
|
|
51
|
+
arrow.style.transform = `translateX(${x}px) rotate(45deg)`;
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
this.sub.style.transform = '';
|
|
55
|
+
if (arrow && arrow.style) {
|
|
56
|
+
arrow.style.transform = '';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
this.ing = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
listen() {
|
|
64
|
+
// 向上查询有滚动条的元素
|
|
65
|
+
const _find = (e: any) => {
|
|
66
|
+
// 判断是否为DOM节点
|
|
67
|
+
if (e && e.nodeType === 1) {
|
|
68
|
+
const css: any = window.getComputedStyle(e);
|
|
69
|
+
// 查询所有父组节点的最高层级
|
|
70
|
+
if (!isNaN(css.zIndex) && css.zIndex >= this.z) {
|
|
71
|
+
this.z = Number(css.zIndex) + 10;
|
|
72
|
+
}
|
|
73
|
+
// 节点是否有滚动条
|
|
74
|
+
if (
|
|
75
|
+
(css.overflowY === 'auto' || css.overflowY === 'scroll' || css.overflowX === 'auto' || css.overflowX === 'scroll') &&
|
|
76
|
+
(e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth)
|
|
77
|
+
) {
|
|
78
|
+
this.box.push(e);
|
|
79
|
+
}
|
|
80
|
+
_find(e.parentNode);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
_find(this.dom);
|
|
84
|
+
|
|
85
|
+
// 自动层级
|
|
86
|
+
if (window.getComputedStyle(this.tip).zIndex) {
|
|
87
|
+
this.tip.style.zIndex = `${this.z}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
this.css();
|
|
91
|
+
// 监听窗口尺寸变化
|
|
92
|
+
window.addEventListener('resize', this.css);
|
|
93
|
+
window.addEventListener('click', this.css);
|
|
94
|
+
// 监听滚动条的元素
|
|
95
|
+
this.box.forEach((e: any) => {
|
|
96
|
+
e.addEventListener('scroll', this.css);
|
|
97
|
+
});
|
|
98
|
+
// 监听移入事件
|
|
99
|
+
this.dom?.addEventListener('mouseenter', this.css);
|
|
100
|
+
// 监听参考元素变化
|
|
101
|
+
this.obs = new ResizeObserver(this.css);
|
|
102
|
+
this.obs?.observe(this.dom);
|
|
103
|
+
}
|
|
104
|
+
remove() {
|
|
105
|
+
// console.log('移除监听');
|
|
106
|
+
// 清除窗口尺寸变化事件监听器
|
|
107
|
+
window.removeEventListener('resize', this.css);
|
|
108
|
+
window.removeEventListener('click', this.css);
|
|
109
|
+
// 清除滚动条元素的事件监听器
|
|
110
|
+
this.box.forEach((e: any) => {
|
|
111
|
+
e.removeEventListener('scroll', this.css);
|
|
112
|
+
});
|
|
113
|
+
// 清除鼠标移入事件监听器
|
|
114
|
+
this.dom?.removeEventListener('mouseenter', this.css);
|
|
115
|
+
// 清除监听参考元素变化
|
|
116
|
+
this.obs?.disconnect();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export default Follow;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Layer, LayerById } from './LayerView';
|
|
2
|
+
import Icon from './Icon.vue';
|
|
3
|
+
import IFollowView from './IFollowView@v2.vue';
|
|
4
|
+
import IPickerView from './IPickerView.vue';
|
|
5
|
+
import IScrollView from './IScrollView.vue';
|
|
6
|
+
import IRouterView from './IRouterView@v4.vue';
|
|
7
|
+
export { Icon, IRouterView, IFollowView, IPickerView, IScrollView, Layer, LayerById };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template><div></div></template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template><div></div></template>
|